Runtime Types (dw::Runtime)

Type Definition Description

DataFormatDescriptor

type DataFormatDescriptor = { name: String, binary: Boolean, defaultEncoding?: String, extensions: Array<String>, defaultMimeType: String, acceptedMimeTypes: Array<String>, readerProperties: Array<DataFormatProperty>, writerProperties: Array<DataFormatProperty> }

Description of a DataFormat that provides all metadata information.

Experimental: This type is an experimental feature that is subject to change or removal from future versions of DataWeave.

DataFormatProperty

type DataFormatProperty = { name: String, optional: Boolean, defaultValue?: Any, description: String, possibleValues: Array<Any> }

Type that describes a data format property. The fields include a name, description, array of possible values (possibleValues), an optional default value (defaultValue), and an optional flag that indicates whether the property is required or not.

Experimental: This type is an experimental feature that is subject to change or removal from future versions of DataWeave.

EvalSuccess

type EvalSuccess = { success: true, value: Any, logs: Array<LogEntry> }

Data type of the data that returns when an eval function executes successfully.

Experimental: This type is an experimental feature that is subject to change or removal from future versions of DataWeave.

ExecutionFailure

type ExecutionFailure = { success: false, message: String, kind: String, stack?: Array<String>, location: Location, logs: Array<LogEntry> }

Data type of the data that returns when a run or eval function fails.

Experimental: This type is an experimental feature that is subject to change or removal from future versions of DataWeave.

Location

type Location = { start?: Position, end?: Position, locationString: String, text?: String, sourceIdentifier?: String }

Type that represents the location of an expression in a DataWeave file.

Experimental: This type is an experimental feature that is subject to change or removal from future versions of DataWeave.

LogEntry

type LogEntry = { level: LogLevel, timestamp: String, message: String }

Type for a log entry, which consists of a level for a LogLevel value, a timestamp, and message.

Experimental: This type is an experimental feature that is subject to change or removal from future versions of DataWeave.

LogLevel

type LogLevel = "INFO" | "ERROR" | "WARN"

Identifies the different kinds of log levels (INFO, ERROR, or WARN).

Experimental: This type is an experimental feature that is subject to change or removal from future versions of DataWeave.

LoggerService

type LoggerService = { initialize?: () -> Object, log: (level: LogLevel, msg: String, context: Object) -> Any, shutdown?: () -> Boolean }

Service that handles all logging.

  • initialize : Function called when the execution starts. DataWeave sends the result to every log call through the context parameter, so that, for example, a logging header can be sent at initialization and recovered in each log.

  • log: Function that is called on every log message.

  • shutdown: Function called when the execution completes, which is a time to flush any buffer or to log out gracefully.

Experimental: This type is an experimental feature that is subject to change or removal from future versions of DataWeave.

MimeType

type MimeType = String

A String representation of a MIME type.

Position

type Position = { index: Number, line: Number, column: Number }

Type that represents a position in a file by its index and its line and column.

Experimental: This type is an experimental feature that is subject to change or removal from future versions of DataWeave.

ReaderInput

type ReaderInput = { value: Binary, encoding?: String, properties?: Dictionary<SimpleType>, mimeType: MimeType }

Input to the DataWeave reader created for the specified MIME type, which includes the Binary input and MIME type, as well as optional encoding and properties values.

  • value: The input, in Binary format.

  • encoding: The encoding for the reader to use.

  • properties: The reader properties used to parse the input.

  • mimeType: The MIME type of the input.

Experimental: This type is an experimental feature that is subject to change or removal from future versions of DataWeave.

RunSuccess

type RunSuccess = { success: true, value: Binary, mimeType: MimeType, encoding?: String, logs: Array<LogEntry> }

Data type of the data that returns when a run function executes successfully.

Experimental: This type is an experimental feature that is subject to change or removal from future versions of DataWeave.

RuntimeExecutionConfiguration

type RuntimeExecutionConfiguration = { timeOut?: Number, outputMimeType?: MimeType, writerProperties?: Dictionary<SimpleType>, onException?: "HANDLE" | "FAIL", securityManager?: SecurityManager, loggerService?: LoggerService, maxStackSize?: Number }

Configuration of the runtime execution that has advanced parameters.

  • timeOut: Maximum amount of time the DataWeave script takes before timing out.

  • outputMimeType: Default output MIME type if not specified in the DataWeave script.

  • writerProperties: Writer properties to use with the specified the outputMimeType property.

  • onException: Specifies the behavior that occurs when the execution fails:

    • HANDLE (default value) returns ExecutionFailure.

    • FAIL propagates an exception.

  • securityManager: Identifies the SecurityManager to use in this execution. This security manager is composed by the current SecurityManager.

  • loggerService: The LoggerService to use in this execution.

  • maxStackSize: The maximum stack size.

Experimental: This type is an experimental feature that is subject to change or removal from future versions of DataWeave.

SecurityManager

type SecurityManager = (grant: String, args: Array<Any>) -> Boolean

Function that is called when a privilege must be granted to the current execution.

  • grant is the name of the privilege, such as Resource.

  • args provides a list of parameters that the function requesting the privilege calls.

Experimental: This type is an experimental feature that is subject to change or removal from future versions of DataWeave.

TryResult

type TryResult = { success: Boolean, result?: T, error?: { kind: String, message: String, stack?: Array<String>, stackTrace?: String, location?: String } }

Object with a result or error message. If success is false, data type provides the error. If true, the data type provides the result.

Starting in Mule version 4.3.1 (DataWeave version 2.3.1), stackTrace is available only when stack is not present. The stackTrace field provides the native Java stack trace.

Was this article helpful?

💙 Thanks for your feedback!

Edit on GitHub