AuQL Built-in Function Reference¶
AuQL scripts allow users to create and invoke user defined functions, but most of the functionality behind AuQL scripts is provided by built-in functions which allow AuQL script creators to perform basic arithmetic, data manipulation, and logic operations. In addition, Aunsight also exposes certain platform resources to script creators through an Aunsight platform object (AU.
namespace) which contains various functions for interacting with Aunsight from within AuQL scripts.
An important point about AuQL functions is that all operations except assignment (=
) take the form of a function. There are no shortcuts for basic functions like operators as in many languages (e.g. +
). Rather, even simple operators are invoked using a function syntax, e.g. Math.Add()
.
The following reference provides a thorough list of AuQL built-in functions along with an explanation of their parameters and expected output values. Functions are described using the following conventions:
- bold input name indicates that it is required
- (parentheses) indicate data type accepted or emitted
- all type means the data can be any type
- bang means the data type is irrelevant; only the presence of data matters
- variadic means that an argument can have multiple input connections
- aliases are also recognized as valid names for the operation
Aunsight Platform Functions¶
AU.Dataflow.Get¶
Returns TokamakDataFlow AU object.
Output Types:
- TokamakDataFlow
Inputs:
- id (string)
Aliases:
- AU.TokamakDataFlow
AU.Dataflow.LatestJob¶
Returns most recent TokamakDataflowJob AU object related to specified Dataflow. Accepts id string or TokamakDataFlow object for input.
Output Types:
- TokamakDataflowJob
Inputs:
- dataflow (TokamakDataFlow, string, object)
Aliases:
- AU.LatestTokamakDataflowJob
=======
AU.Dataflow.List¶
Returns list of TokamakDataFlow AU objects in current context. Accepts arguments for fields to return, queries to run (KVP of field__qop:value), term for which to search, an array of objects describing the desired fields and directions on which to sort results, and an array of KVPs of requested distinct field values.
Output Types:
- array
Inputs:
- fields (array)
- array items: string
- limit (integer)
- skip (integer)
- query (object)
- search (object)
- sort (array)
- array items: object
- distinct (array)
- array items: string
- options: tags, location.resource, format, solution, dev_mode
- all (boolean)
Example:
AU.Dataflow.List(
fields=['name','description','inputRecords'],
query={'dev_mode__ne':'PROD'},
search={'term':'test', 'fields':['id','name','description']},
sort=[{'field': 'name', 'direction': 'ASC'}]
)
AU.DataLab.Volume.List¶
Returns list of DataLab Volume AU objects in current context. Accepts arguments for fields to return, queries to run (KVP of field__qop:value), term for which to search, an array of objects describing the desired fields and directions on which to sort results, and an array of KVPs of requested distinct field values.
Output Types:
- array
Inputs:
- fields (array)
- array items: string
- limit (integer)
- skip (integer)
- query (object)
- search (object)
- sort (array)
- array items: object
- distinct (array)
- array items: string
- options: tags, location.resource, format, solution, dev_mode
- all (boolean)
Example:
AU.DataLab.Volume.List(
fields=['id','name','description'],
query={'dev_mode__ne':'PROD'},
search={'term':'auto', 'fields':['name','description']},
sort=[{'field': 'created_at', 'direction': 'DESC'}]
)
AU.DataLab.Workspace.List¶
Returns list of DataLab Workspace AU objects in current context. Accepts arguments for fields to return, queries to run (KVP of field__qop:value), term for which to search, an array of objects describing the desired fields and directions on which to sort results, and an array of KVPs of requested distinct field values.
Output Types:
- array
Inputs:
- fields (array)
- array items: string
- limit (integer)
- skip (integer)
- query (object)
- search (object)
- sort (array)
- array items: object
- distinct (array)
- array items: string
- options: tags, location.resource, format, solution, dev_mode
- all (boolean)
Example:
AU.DataLab.Workspace.List(
fields=['id','name','description'],
query={'dev_mode__ne':'PROD'},
search={'term':'test', 'fields':['name','description']},
sort=[{'field': 'created_at', 'direction': 'DESC'}]
)
AU.Daybreak.List¶
Returns list of DaybreakConfig AU objects in current context. Accepts arguments for fields to return, queries to run (KVP of field__qop:value), term for which to search, an array of objects describing the desired fields and directions on which to sort results, and an array of KVPs of requested distinct field values.
Output Types:
- array
Inputs:
- fields (array)
- array items: string
- limit (integer)
- skip (integer)
- query (object)
- search (object)
- sort (array)
- array items: object
- distinct (array)
- array items: string
- options: tags, location.resource, format, solution, dev_mode
- all (boolean)
Example:
AU.Daybreak.List(
fields=['id','name','description'],
query={'dev_mode__ne':'PROD'},
search={'term':'test', 'fields':['id','name','description']},
sort=[{'field': 'created_at', 'direction': 'DESC'}]
)
AU.GraphQL.Query¶
Submits GraphQL query to Aunsight API. The raw
argument specifies whether raw GraphQL error should be returned (true
) or whether the AuQL should handle the error (false
). Defaults to false
.
Output Types:
- object
Inputs:
- query (string)
- raw (boolean)
AU.Logger.Get¶
Returns LoggerStream AU object.
Output Types:
- LoggerStream
Inputs:
- id (string)
AU.Logger.List¶
Returns list of LoggerStream AU objects in current context. Accepts arguments for fields to return, queries to run (KVP of field__qop:value), term for which to search, an array of objects describing the desired fields and directions on which to sort results, and an array of KVPs of requested distinct field values.
Output Types:
- array
Inputs:
- fields (array)
- array items: string
- limit (integer)
- skip (integer)
- query (object)
- search (object)
- sort (array)
- array items: object
- distinct (array)
- array items: string
- options: tags, location.resource, format, solution, dev_mode
- all (boolean)
Example:
AU.Logger.List(
fields=['id','name','closed_at'],
query={'dev_mode__ne':'PROD'},
search={'term':'SG', 'fields':['id','name','description']},
sort=[{'field': 'closed_at', 'direction': 'DESC'}]
)
AU.Logger.Query¶
Returns contents of a logger stream. Accepts id string or LoggerStream object for input.
Output Types:
- array
Inputs:
- stream (LoggerStream, string, object)
- limit (integer)
- skip (integer)
- direction (string)
- options: asc, desc
- before (string)
- after (string)
AU.Memento¶
Returns Memento AU object.
Output Types:
- Memento
Inputs:
- id (string)
AU.Memento.Latest¶
Returns single most recent Memento from input series. Accepts id string or MementoSeries object for input.
Output Types:
- Memento
Inputs:
- series (MementoSeries, string, object)
Aliases:
- AU.LatestMemento
AU.Memento.LatestN¶
Returns the most recent N mementos from input series. Accepts id string or MementoSeries object for input.
Note
Although limit
can be set to any integer, the platform itself will only return up to 2,000 mementos per API call.
Output Types:
- array
Inputs:
- series (MementoSeries, string, object)
- limit (integer)
Aliases:
- AU.LatestNMementos
AU.Memento.Series¶
Returns MementoSeries AU object.
Output Types:
- MementoSeries
Inputs:
- id (string)
Aliases:
- AU.MementoSeries
AU.Memento.Series.List¶
Returns list of MementoSeries AU objects in current context. Accepts arguments for fields to return, queries to run (KVP of field__qop:value), term for which to search, an array of objects describing the desired fields and directions on which to sort results, and an array of KVPs of requested distinct field values.
Output Types:
- array
Inputs:
- fields (array)
- array items: string
- limit (integer)
- skip (integer)
- query (object)
- search (object)
- sort (array)
- array items: object
- distinct (array)
- array items: string
- options: tags, location.resource, format, solution, dev_mode
- all (boolean)
Example:
AU.Memento.Series.List(
fields=['id','description','value_type'],
query={'dev_mode__ne':'PROD'},
search={'term':'7ed', 'fields':['id','description']},
sort=[{'field': 'name', 'direction': 'ASC'}]
)
AU.Metric.List¶
Returns list of MetricStream AU objects in current context. Accepts arguments for fields to return, queries to run (KVP of field__qop:value), term for which to search, an array of objects describing the desired fields and directions on which to sort results, and an array of KVPs of requested distinct field values.
Output Types:
- array
Inputs:
- fields (array)
- array items: string
- limit (integer)
- skip (integer)
- query (object)
- search (object)
- sort (array)
- array items: object
- distinct (array)
- array items: string
- options: tags, location.resource, format, solution, dev_mode
- all (boolean)
Example:
AU.Metric.List(
fields=['id','name','closed_at'],
query={'dev_mode__ne':'PROD'},
search={'term':'SG', 'fields':['id','name','description']},
sort=[{'field': 'closed_at', 'direction': 'DESC'}]
)
AU.Model.List¶
Returns list of Model AU objects in current context. Accepts arguments for fields to return, queries to run (KVP of field__qop:value), term for which to search, an array of objects describing the desired fields and directions on which to sort results, and an array of KVPs of requested distinct field values.
Output Types:
- array
Inputs:
- fields (array)
- array items: string
- limit (integer)
- skip (integer)
- query (object)
- search (object)
- sort (array)
- array items: object
- distinct (array)
- array items: string
- options: tags, location.resource, format, solution, dev_mode
- all (boolean)
Example:
AU.Model.List(
fields=['id','name','latest_version.id'],
query={'dev_mode__ne':'PROD'},
search={'term':'test', 'fields':['name']},
sort=[{'field': 'created_at', 'direction': 'DESC'}]
)
AU.Process.Layer.List¶
Returns list of Process Layer AU objects in current context. Accepts arguments for fields to return, queries to run (KVP of field__qop:value), term for which to search, an array of objects describing the desired fields and directions on which to sort results, and an array of KVPs of requested distinct field values.
Output Types:
- array
Inputs:
- fields (array)
- array items: string
- limit (integer)
- skip (integer)
- query (object)
- search (object)
- sort (array)
- array items: object
- distinct (array)
- array items: string
- options: tags, location.resource, format, solution, dev_mode
- all (boolean)
Example:
AU.Process.Layer.List(
fields=['id','name','main_language'],
query={'dev_mode__ne':'PROD'},
search={'term':'au', 'fields':['name','description']},
sort=[{'field': 'created_at', 'direction': 'DESC'}]
)
AU.Process.List¶
Returns list of Process AU objects in current context. Accepts arguments for fields to return, queries to run (KVP of field__qop:value), term for which to search, an array of objects describing the desired fields and directions on which to sort results, and an array of KVPs of requested distinct field values.
Output Types:
- array
Inputs:
- fields (array)
- array items: string
- limit (integer)
- skip (integer)
- query (object)
- search (object)
- sort (array)
- array items: object
- distinct (array)
- array items: string
- options: tags, location.resource, format, solution, dev_mode
- all (boolean)
Example:
AU.Process.List(
fields=['id','name','description'],
query={'dev_mode__ne':'PROD'},
search={'term':'test', 'fields':['name','description']},
sort=[{'field': 'created_at', 'direction': 'DESC'}]
)
AU.Process.Runtime.List¶
Returns list of Process Runtime AU objects in current context. Accepts arguments for fields to return, queries to run (KVP of field__qop:value), term for which to search, an array of objects describing the desired fields and directions on which to sort results, and an array of KVPs of requested distinct field values.
Output Types:
- array
Inputs:
- fields (array)
- array items: string
- limit (integer)
- skip (integer)
- query (object)
- search (object)
- sort (array)
- array items: object
- distinct (array)
- array items: string
- options: tags, location.resource, format, solution, dev_mode
- all (boolean)
Example:
AU.Process.Runtime.List(
fields=['id','name','main_language'],
query={'dev_mode__ne':'PROD'},
search={'term':'au', 'fields':['name','description']},
sort=[{'field': 'created_at', 'direction': 'DESC'}]
)
AU.Query¶
Returns up to 100 rows of an Aunsight Query.
Output Types:
- array
Inputs:
- query (StoredQuery, string, object)
- resource (string)
- organization (string)
- task_resource (string)
- include_header (boolean)
- string_mode (boolean)
- format (string)
- options: ldarray, ldjson, csv, psv, tsv
- parameters (string)
- project (string)
AU.Query.Get¶
Returns StoredQuery AU object.
Output Types:
- StoredQuery
Inputs:
- id (string)
AU.Query.List¶
Returns list of StoredQuery AU objects in current context. Accepts arguments for fields to return, queries to run (KVP of field__qop:value), term for which to search, an array of objects describing the desired fields and directions on which to sort results, and an array of KVPs of requested distinct field values.
Output Types:
- array
Inputs:
- fields (array)
- array items: string
- limit (integer)
- skip (integer)
- query (object)
- search (object)
- sort (array)
- array items: object
- distinct (array)
- array items: string
- options: tags, location.resource, format, solution, dev_mode
- all (boolean)
Example:
AU.Query.List(
fields=['name','query','description'],
query={'dev_mode__ne':'PROD'},
search={'term':'SG', 'fields':['id','name','description']},
sort=[{'field': 'name', 'direction': 'ASC'}]
)
AU.Record.Describe¶
Returns Atlas Record stats. Accepts id string or AtlasRecord object for input record.
Output Types:
- object
Inputs:
- record (AtlasRecord, string, object)
AU.Record.Download¶
Returns limited number of rows from input AtlasRecord object or AtlasRecord id.
Output Types:
- array
Inputs:
- record (AtlasRecord, string, object)
- limit (integer)
- skip (integer)
Aliases:
- AU.AtlasRecordDownload
AU.Record.Get¶
Returns AtlasRecord AU object.
Output Types:
- AtlasRecord
Inputs:
- id (string)
Aliases:
- AU.AtlasRecordGet
AU.Record.Hash¶
Returns Atlas Record hashed values. Accepts id string or AtlasRecord object for input record.
Output Types:
- object
Inputs:
- record (AtlasRecord, string, object)
AU.Record.List¶
Returns list of AtlasRecord AU objects in current context. Accepts arguments for fields to return, queries to run (KVP of field__qop:value), term for which to search, an array of objects describing the desired fields and directions on which to sort results, and an array of KVPs of requested distinct field values.
Output Types:
- array
Inputs:
- fields (array)
- array items: string
- limit (integer)
- skip (integer)
- query (object)
- search (object)
- sort (array)
- array items: object
- distinct (array)
- array items: string
- options: tags, location.resource, format, solution, dev_mode
- all (boolean)
Example:
AU.Record.List(
fields=['name','location.resource.type','dev_mode'],
query={'dev_mode__ne':'PROD'},
search={'term':'sightglass', 'fields':['id','name','description']},
sort=[{'field': 'name', 'direction': 'ASC'}]
)
AU.Record.Peeper¶
Returns latest Peeper Report for an AtlasRecord. Accepts id string or AtlasRecord object for input record.
Output Types:
- AtlasRecord
Inputs:
- record (AtlasRecord, string, object)
AU.Record.Validate¶
Validates limited number of rows from input AtlasRecord object or AtlasRecord id against the schema for that record. Returns any errors keyed by their row and the total number of errors.
Output Types:
- object
Inputs:
- record (AtlasRecord, string, object)
- limit (integer)
- skip (integer)
AU.Script.Evaluate¶
Evaluates another AuQLScript and returns output.
Output Types:
- object
Inputs:
- script (AuQLScript, string, object)
- parameters (string, integer, number, date, array, object)
- variadic
AU.Script.List¶
Returns list of AuQLScript AU objects in current context. Accepts arguments for fields to return, queries to run (KVP of field__qop:value), term for which to search, an array of objects describing the desired fields and directions on which to sort results, and an array of KVPs of requested distinct field values.
Output Types:
- array
Inputs:
- fields (array)
- array items: string
- limit (integer)
- skip (integer)
- query (object)
- search (object)
- sort (array)
- array items: object
- distinct (array)
- array items: string
- options: tags, location.resource, format, solution, dev_mode
- all (boolean)
Example:
AU.Script.List(
fields=['name','description','main'],
query={'dev_mode__ne':'PROD'},
search={'term':'test', 'fields':['id','name','description']},
sort=[{'field': 'name', 'direction': 'ASC'}]
)
AU.Secret.List¶
Returns list of Secret AU objects in current context. Accepts arguments for fields to return, queries to run (KVP of field__qop:value), term for which to search, an array of objects describing the desired fields and directions on which to sort results, and an array of KVPs of requested distinct field values.
Output Types:
- array
Inputs:
- fields (array)
- array items: string
- limit (integer)
- skip (integer)
- query (object)
- search (object)
- sort (array)
- array items: object
- distinct (array)
- array items: string
- options: tags, location.resource, format, solution, dev_mode
- all (boolean)
Example:
AU.Secret.List(
fields=['id','name','description'],
query={'dev_mode__ne':'PROD'},
search={'term':'test', 'fields':['name','description']},
sort=[{'field': 'created_at', 'direction': 'DESC'}]
)
AU.Sightglass.List¶
Returns list of SightglassApp AU objects in current context. Accepts arguments for fields to return, queries to run (KVP of field__qop:value), term for which to search, an array of objects describing the desired fields and directions on which to sort results, and an array of KVPs of requested distinct field values.
Output Types:
- array
Inputs:
- fields (array)
- array items: string
- limit (integer)
- skip (integer)
- query (object)
- search (object)
- sort (array)
- array items: object
- distinct (array)
- array items: string
- options: tags, location.resource, format, solution, dev_mode
- all (boolean)
Example:
AU.Sightglass.List(
fields=['id','title','subtitle'],
query={'dev_mode__ne':'PROD'},
search={'term':'test', 'fields':['id','title','subtitle']},
sort=[{'field': 'created_at', 'direction': 'DESC'}]
)
AU.toJSON¶
Converts AU object to plain JSON object.
Output Types:
- object
Inputs:
- object (object)
AU.TrackerJob.List¶
Returns list of TrackerJob AU objects in current context. Accepts arguments for fields to return, queries to run (KVP of field__qop:value), term for which to search, an array of types of jobs to return, and before/after cursor args for pagination.
Output Types:
- array
Inputs:
- fields (array)
- array items: string
- limit (integer)
- before (integer)
- after (integer)
- query (object)
- search (object)
- types (array)
- array items: string
Example:
AU.TrackerJob.List(
fields=['id','created_at','query'],
query={'created_at__gt':'2020'},
types=['query'],
search={'term':'test', 'fields':['query']}
)
AU.Workflow.Get¶
Returns Workflow AU object.
Output Types:
- Workflow
Inputs:
- id (string)
AU.Workflow.LatestJob¶
Returns most recent WorkflowJob AU object related to specified Workflow. Accepts id string or Workflow object for input.
Output Types:
- WorkflowJob
Inputs:
- workflow (Workflow, string, object)
Aliases:
- AU.LatestWorkflowJob
AU.Workflow.List¶
Returns list of Workflow AU objects in current context. Accepts arguments for fields to return, queries to run (KVP of field__qop:value), term for which to search, an array of objects describing the desired fields and directions on which to sort results, and an array of KVPs of requested distinct field values.
Output Types:
- array
Inputs:
- fields (array)
- array items: string
- limit (integer)
- skip (integer)
- query (object)
- search (object)
- sort (array)
- array items: object
- distinct (array)
- array items: string
- options: tags, location.resource, format, solution, dev_mode
- all (boolean)
Example:
AU.Workflow.List(
fields=['name','description','token'],
query={'dev_mode__ne':'PROD'},
search={'term':'test', 'fields':['id','name','description']},
sort=[{'field': 'name', 'direction': 'ASC'}]
)
Date Functions¶
Date.Add¶
Adds an amount of a unit of time to a date.
Output Types:
- string
Inputs:
- date (string, integer, number, date, array, object)
- amount (integer, number)
- unit (string)
- options: years, months, weeks, days, hours, minutes, seconds
Example:
Date.Add("2019-02-26T15:49:35.051Z", 1, "days") --> "2019-02-27T15:49:35.051Z"
Date.Between¶
Returns whether the target
date is between the start
and end
dates. To specify which date part is used for comparison, a unit
can be passed in. For example, with “years” or “months”, the value “2001-10-05” is not between “2001-10-01” and “2001-10-31”.
Output Types:
- integer
Inputs:
- start (string, integer, number, date, array, object)
- end (string, integer, number, date, array, object)
- target (string, integer, number, date, array, object)
- unit (string)
- options: years, months, weeks, days, hours, minutes, seconds
Example:
Date.Between("2001-10-01", "2001-10-31", "2001-10-05", "days") --> true
Date.Difference¶
Returns the difference between two dates as a trunctated integer. Accepts args for unit (default ms), whether to calculate as an absolute value, and whether to return a float instead of truncating.
Output Types:
- integer
Inputs:
- left (string, integer, number, date, array, object)
- right (string, integer, number, date, array, object)
- unit (string)
- options: years, months, weeks, days, hours, minutes, seconds
- abs (boolean)
- float (boolean)
Example:
Date.Difference("2018-11-11T17:53:41.404", "2018-11-12T17:54:41.404", "days", true, false) --> 1
Date.Equal¶
Returns whether the left
date is equal to the right
date. To specify which date part is used for comparison, a unit
can be passed in. For example, with “years” or “months”, the value “2001-10-01” is equal to “2001-10-31”.
Output Types:
- boolean
Inputs:
- left (string, integer, number, date, array, object)
- right (string, integer, number, date, array, object)
- unit (string)
- options: years, months, weeks, days, hours, minutes, seconds
Example:
Date.Equal("2001-10-01", "2001-10-31", "months") --> true
Date.Format¶
Formats an input date according to moment.js
conventions found here. Defaults to formatting as ISO string if no format is provided.
Output Types:
- string
Inputs:
- date (string)
- format (string)
Example:
Date.Format("2020-01-30T19:45:41.484Z", "MM/DD/YYYY") --> "01/30/2020"
Date.GetDate¶
Returns the day of the month as an integer. Returns today's date if no arg is provided.
Output Types:
- integer
Inputs:
- date (number, integer, string, object)
Example:
Date.GetDate("2018-11-12T17:54:41.404") --> 12
Date.GetDay¶
Returns the day of the week as an integer, where Sunday is 0. Returns today's day if no arg is provided.
Output Types:
- integer
Inputs:
- date (number, integer, string, object)
Example:
Date.GetDay("2018-11-12T17:54:41.404") --> 1
Date.GreaterThan¶
Returns whether the left
date is greater than the right
date. To specify which date part is used for comparison, a unit
can be passed in. For example, with “days”, the value “2001-10-31” is greater than “2001-10-01”, while with “months”, it is not.
Output Types:
- boolean
Inputs:
- left (string, integer, number, date, array, object)
- right (string, integer, number, date, array, object)
- unit (string)
- options: years, months, weeks, days, hours, minutes, seconds
Example:
Date.GreaterThan("2001-10-31", "2001-10-01", "days") --> true
Date.GreaterThanEqual¶
Returns whether the left
date is greater than or equal to the right
date. To specify which date part is used for comparison, a unit
can be passed in. For example, with “days”, the value “2001-10-31” is greater than or equal to “2001-10-01”, while with “seconds”, it is not
Output Types:
- boolean
Inputs:
- left (string, integer, number, date, array, object)
- right (string, integer, number, date, array, object)
- unit (string)
- options: years, months, weeks, days, hours, minutes, seconds
Example:
Date.GreaterThanEqual("2001-10-31", "2001-10-01", "days") --> true
Date.LessThan¶
Returns whether the left
date is less than the right
date. To specify which date part is used for comparison, a unit
can be passed in. For example, with “days”, the value “2001-10-01” is less than “2001-10-31”, while with “months”, it is not.
Output Types:
- boolean
Inputs:
- left (string, integer, number, date, array, object)
- right (string, integer, number, date, array, object)
- unit (string)
- options: years, months, weeks, days, hours, minutes, seconds
Example:
Date.LessThan("2001-10-31", "2001-10-01", "days") --> true
Date.LessThanEqual¶
Returns whether the left
date is less than or equal to the right
date. To specify which date part is used for comparison, a unit
can be passed in. For example, with “days”, the value “2001-10-01” is less than or equal to “2001-10-31”, while with “seconds”, it is not
Output Types:
- boolean
Inputs:
- left (string, integer, number, date, array, object)
- right (string, integer, number, date, array, object)
- unit (string)
- options: years, months, weeks, days, hours, minutes, seconds
Example:
Date.LessThanEqual("2001-10-31", "2001-10-01", "days") --> true
Date.Now¶
Returns the current date as an ISO string.
Output Types:
- string
Inputs:
- None
Example:
Date.Now() --> [ISO string]
Date.Subtract¶
Subtracts an amount of a unit of time from a date.
Output Types:
- string
Inputs:
- date (string, integer, number, date, array, object)
- amount (integer, number)
- unit (string)
- options: years, months, weeks, days, hours, minutes, seconds
Example:
Date.Subtract("2019-02-26T15:49:35.051Z", 1, "days") --> "2019-02-25T15:49:35.051Z"
Logic Operator Functions¶
Logic.And¶
Test whether left and right args are both truthy.
Output Types:
- boolean
Inputs:
- left (string, integer, number, boolean, object)
- right (string, integer, number, boolean, object, array)
- variadic
Example:
Logic.And(true, true) --> true
Logic.Equal¶
Tests whether args are deeply equal to each other.
Output Types:
- boolean
Inputs:
- left (string, integer, number, boolean, object, array)
- right (string, integer, number, boolean, object, array)
Example:
Logic.Equal(1, 1) --> true
Logic.Every¶
Tests whether every element of input collection is truthy.
Output Types:
- boolean
Inputs:
- collection (object, array)
Example:
Logic.Every([true,true]) --> true
Logic.GreaterThan¶
Tests whether left arg is greater than right arg (left > right).
Output Types:
- boolean
Inputs:
- left (integer, number)
- right (integer, number)
Example:
Logic.GreaterThan(2, 1) --> true
Logic.GreaterThanEqual¶
Tests whether left arg is greater than or equal to right arg (left >= right).
Output Types:
- boolean
Inputs:
- left (integer, number)
- right (integer, number)
Example:
Logic.GreaterThanEqual(2, 1) --> true
Logic.If¶
If condition is truthy, return ifTrue input; else return ifFalse input.
Output Types:
- string, integer, number, boolean, object, array
Inputs:
- condition (boolean, integer, string, number, array, object, null)
- ifTrue (string, integer, number, boolean, object, array)
- ifFalse (string, integer, number, boolean, object, array)
Example:
Logic.If(true, "was true", "was false") --> "was true"
Logic.IfCase¶
Returns the first case value for which the case is true; else return else value. Cases is an array of objects structured as {"case":
Output Types:
- string, integer, number, boolean, object, array
Inputs:
- cases (array)
- array items: object
- else (boolean, integer, string, number, array, object, null)
Example:
Logic.IfCase([{"case":false,"value":"should not return"},{"case":true,"value":"second case true"}], "no cases true") --> "second case true"
Logic.LessThan¶
Tests whether left arg is less than right arg (left < right).
Output Types:
- boolean
Inputs:
- left (integer, number)
- right (integer, number)
Example:
Logic.LessThan(1, 2) --> true
Logic.LessThanEqual¶
Tests whether left arg is less than or equal to right arg (left <= right).
Output Types:
- boolean
Inputs:
- left (integer, number)
- right (integer, number)
Example:
Logic.LessThanEqual(1, 2) --> true
Logic.NotEqual¶
Tests whether args are not deeply equal to each other.
Output Types:
- boolean
Inputs:
- left (integer, number, string, object, array, boolean)
- right (integer, number, string, object, array, boolean)
Example:
Logic.NotEqual(1, 2) --> true
Logic.Or¶
Tests whether either left or right args are truthy.
Output Types:
- boolean
Inputs:
- left (string, integer, number, boolean, object)
- right (string, integer, number, boolean, object, array)
- variadic
Example:
Logic.Or(true, false) --> true
Logic.Some¶
Tests whether at least one element of input collection is truthy.
Output Types:
- boolean
Inputs:
- collection (object, array)
Example:
Logic.Some({"key1":true,"key2":false}) --> true
Logic.SwitchCase¶
Returns the first case value for which the case is equal to expr input; else return else value. Cases is an array of objects structured as {"case":
Output Types:
- string, integer, number, boolean, object, array
Inputs:
- expr (string, integer, number, boolean, object)
- cases (array)
- else (boolean, integer, string, number, array, object, null)
Example:
Logic.SwitchCase(1, [{"case":7,"value":"should not return"},{"case":1,"value":"second case was 1"}], "no cases equal expr") --> "second case was 1"
Mathematical Operator Functions¶
Math.Add¶
Adds left and right args or sums all args connected to values input.
Output Types:
- integer, number
Inputs:
- left (integer, number)
- right (integer, number)
Or:
- values (integer, number, array)
- array items: integer, number
- variadic
Aliases:
- Add
Example:
Math.Add(1, 2, 3) --> 6
Math.Count¶
Returns the size of input collection.
Output Types:
- integer
Inputs:
- values (array, object, string)
Example:
Math.Count([1,2,3]) --> 3
Math.Divide¶
Divides left arg by right arg (left / right).
Output Types:
- integer, number
Inputs:
- left (integer, number)
- right (integer, number)
Example:
Math.Divide(3, 5) --> 0.6
Math.Max¶
Returns the maximum value of input(s).
Output Types:
- integer, number
Inputs:
- values (integer, number, array)
- array items: integer, number
- variadic
Example:
Math.Max([1, 2, 3]) --> 3
Math.Mean¶
Returns the mean value of input(s).
Output Types:
- integer, number
Inputs:
- values (integer, number, array)
- array items: integer, number
- variadic
Example:
Math.Mean([1, 2, 3]) --> 2
Math.Min¶
Returns the minimum value in input(s).
Output Types:
- integer, number
Inputs:
- values (integer, number, array)
- array items: integer, number
- variadic
Example:
Math.Min([1, 2, 3]) --> 1
Math.Modulus¶
Returns left arg modulo right arg (left % right).
Output Types:
- integer, number
Inputs:
- left (integer, number)
- right (integer, number)
Example:
Math.Modulus(3, 5) --> 3
Math.Multiply¶
Multiplies args left and right args or multiplies all values.
Output Types:
- integer, number
Inputs:
- left (integer, number)
- right (integer, number)
Or:
- values (integer, number, array)
- array items: integer, number
- variadic
Example:
Math.Multiply(1, 2, 3) --> 6
Math.MultiplyAll¶
Multiplies elements of input array.
Output Types:
- integer, number
Inputs:
- values (array)
Example:
Math.MultiplyAll([1, 2, 3]) --> 6
Math.Subtract¶
Subtracts right arg from left arg (left - right).
Output Types:
- integer, number
Inputs:
- left (integer, number)
- right (integer, number)
Aliases:
- Subtract
Example:
Math.Subtract(5, 3) --> 2
Math.Sum¶
Sums elements of input array.
Output Types:
- integer, number
Inputs:
- values (array)
- array items: number, integer
- variadic
Example:
Math.Sum([1, 2, 3]) --> 6
String Functions¶
String.Concat¶
Concatenates input strings. Casts args as strings if they are not strings.
Output Types:
- string
Inputs:
- left (string, number, integer, object, array, boolean)
- right (string, number, integer, object, array, boolean)
- variadic
Example:
String.Concat("concat", "enated" " strings") --> "concatenated strings"
String.EndsWith¶
Tests whether input string ends with target string.
Output Types:
- boolean
Inputs:
- string (string)
- target (string)
Example:
String.EndsWith("TestString123", "123") --> true
String.Format¶
Formats placeholder string according to input args.
Output Types:
- string
Inputs:
- placeholder (string, integer, number, boolean, object)
- args (array)
Example:
String.Format("Tes%sString1%d3", ["t",2]) --> TestString123
String.Join¶
Joins all elements of input array as strings separated by the separator, which defaults to a comma.
Output Types:
- string
Inputs:
- array (array)
- separator (string)
Example:
String.Join(["one","two","three"], ", ") --> "one, two, three"
String.Match¶
Performs string matching based on input RegExp. RegExp flags can be passed in via the flags
argument.
Output Types:
- array
Inputs:
- string (string)
- regex (string)
- flags (string)
Example:
String.Match("TestString123", "[A-Z]", "g") --> ["T", "S"]
String.Replace¶
Replaces matches for RegExp pattern (or simple string) in target string with replacement. RegExp flags can be passed in via the flags
argument.
Output Types:
- array
Inputs:
- string (string)
- regex (string)
- replacement (string)
- flags (string)
Example:
String.Replace("this is the target string", "target", "output") --> "this is the output string"
String.Split¶
Splits input string by delimiter.
Output Types:
- array
Inputs:
- string (string)
- delimiter (string)
Example:
String.Split("1,2,3", ",") --> ["1", "2", "3"]
String.StartsWith¶
Tests whether string input starts with target string.
Output Types:
- boolean
Inputs:
- string (string)
- target (string)
Example:
String.StartsWith("TestString123", "Test") --> true
String.Substring¶
Retrieves substring of input string from starting to ending index.
Output Types:
- string
Inputs:
- string (string)
- indexStart (integer)
- indexEnd (integer)
Example:
String.Substring("TestString123", 0, 4) --> "Test"
String.ToLowerCase¶
Converts the string into all lower case.
Output Types:
- string
Inputs:
- string (string)
Example:
String.ToLowerCase("EXAMPLE STRING") --> "example string"
String.ToLowerCaseFirst¶
Converts only the first letter of the string to lower case.
Output Types:
- string
Inputs:
- string (string)
Example:
String.ToLowerCaseFirst("EXAMPLE STRING") --> "eXAMPLE STRING"
String.ToUpperCase¶
Converts the string into all upper case.
Output Types:
- string
Inputs:
- string (string)
Example:
String.ToUpperCase("example string") --> "EXAMPLE STRING"
String.ToUpperCaseFirst¶
Converts only the first letter of the string to upper case.
Output Types:
- string
Inputs:
- string (string)
Example:
String.ToUpperCaseFirst("example string") --> "Example string"
String.Trim¶
Trims whitespace from the beginning and end of the input string.
Output Types:
- string
Inputs:
- string (string)
Example:
String.Trim(" example string ") --> "example string"
Utility Functions¶
Util.Array¶
Converts array-like input to array.
Output Types:
- array
Inputs:
- value (string, object, array)
Aliases:
- Array
Example:
Util.Array("123") --> ["1","2","3"]
Util.ArrayOf¶
Makes an array containing the provided value(s) in order of connections (argument order in DSL).
Output Types:
- array
Inputs:
- value (string, number, integer, object, array, boolean)
- variadic
Aliases:
- Util.ArrayOrderedCreate
Example:
Util.ArrayOf(123, 456) --> [123, 456]
Util.ArrayOrderedConcat¶
Concats 2-N arrays in order of connections (argument order in DSL).
Output Types:
- array
Inputs:
- arrays (array)
- variadic
Example:
Util.ArrayOrderedConcat([1,2,3], [4,5,6]) --> [1, 2, 3, 4, 5]
Util.ArrayPush¶
Pushes value to end of input array.
Output Types:
- array
Inputs:
- array (array)
- value (string, number, integer, object, array, boolean)
- variadic
Example:
Util.ArrayPush([1,2], 3) --> [1, 2, 3]
Util.ArrayToKeyGroupsDistinct¶
Transform array of objects to object of arrays with distinct values.
Output Types:
- object
Inputs:
- array (array)
- array items: object
Example:
Util.ArrayToKeyGroupsDistinct([{"k1":"v1","k2":"v2"},{"k3":"v3","k2":"v4"}]) --> {"k1": ["v1"], "k2": ["v2","v4"], "k3": ["v3"]}
Util.Difference¶
Returns collection of items that are present in left collection and not in right collection. Collections must be of the same type (object or array).
Output Types:
- array
Inputs:
- left (array)
- right (array)
Or:
- left (object)
- right (object)
Example:
Util.Difference(["a","b","c","d"], ["a","c"]) --> ["b", "d"]
Util.Filter¶
Filters input array according to the filterer script, returning only elements for which the filterer returns true
. Filterer function takes value
and index
arguments, as well as any number of optional arguments.
Output Types:
- array
Inputs:
- input (array)
- filterer (script, object, string)
- opts (object, array, boolean, integer, number, string)
- variadic
- concurrency (string)
Example:
Util.Filter([1,2,3,4,5], "lessThanThreeFunc") --> [1,2]
Util.Find¶
Returns the first array element for which the finder script returns true
. Finder function takes value
and index
arguments, as well as any number of optional arguments.
Output Types:
- array
Inputs:
- input (array)
- finder (script, object, string)
- opts (object, array, boolean, integer, number, string)
- variadic
- concurrency (string)
Example:
Util.Find([1,2,3,4,5], "moreThanThreeFunc") --> 4
Util.FindIndex¶
Returns the index of the first array element for which the finder script returns true
. Finder function takes value
and index
arguments, as well as any number of optional arguments.
Output Types:
- array
Inputs:
- input (array)
- finder (script, object, string)
- opts (object, array, boolean, integer, number, string)
- variadic
- concurrency (string)
Example:
Util.FindIndex([1,2,3,4,5], "moreThanThreeFunc") --> 3
Util.First¶
Returns the first element of an array.
Output Types:
- string, integer, number, boolean, object, array
Inputs:
- array (array)
Aliases:
- Util.ArrayFirstItem
Example:
Util.First([1,2,3]) --> 1
Util.Get¶
Returns the value in the specified path of an object or index of an array. For AU objects, also fetches the value if it has not already been read.
Output Types:
- string, integer, number, boolean, object, array
Inputs:
- object (MementoSeries, Memento, AtlasRecord, TokamakDataFlow, LatestTokamakDataflowJob, Workflow, LatestWorkflowJob, object, array)
- path (string, integer, number)
- default (string, integer, number, object, array, boolean, null)
Aliases:
- Get
Example:
Util.Get({"k1":1}, "k1") --> 1
Util.Includes¶
Tests whether value is contained in collection.
Output Types:
- boolean
Inputs:
- collection (array, object, string)
- value (object, array, boolean, integer, number, string)
Example:
Util.Includes([1,2,3], 1) --> true
Util.Intersection¶
Returns array of items that are present in left array and in right array(s).
Output Types:
- array
Inputs:
- left (array)
- right (array)
- variadic
Example:
Util.Intersection([1,2,3], [2,3,4]) --> [2, 3]
Util.Invoke¶
Invokes a subscript, referenced by id string, along with any number of optional, ordered parameters. Assumes that invoked function returns a single keyed value, e.g. return(key = value)
.
Output Types:
- script
Inputs:
- name (string)
- parameters (object, array, boolean, integer, number, string)
- variadic
Example:
Util.Invoke("squareFunc", 3) --> 9
Util.IsArray¶
Tests whether input is an array.
Output Types:
- boolean
Inputs:
- value (object, array, boolean, integer, number, string)
Example:
Util.IsArray([1,2,3]) --> true
Util.IsBoolean¶
Tests whether input is a boolean.
Output Types:
- boolean
Inputs:
- value (object, array, boolean, integer, number, string)
Example:
Util.IsBoolean(true) --> true
Util.IsInteger¶
Tests whether input is a floating point number.
Output Types:
- boolean
Inputs:
- value (object, array, boolean, integer, number, string)
Example:
Util.IsInteger(1) --> true
Util.IsNumber¶
Tests whether input is a floating point number.
Output Types:
- boolean
Inputs:
- value (object, array, boolean, integer, number, string)
Example:
Util.IsNumber(1.5) --> true
Util.IsObject¶
Tests whether input is an object. Will return false
for arrays.
Output Types:
- boolean
Inputs:
- value (object, array, boolean, integer, number, string)
Example:
Util.IsObject({"key":1}) --> true
Util.IsString¶
Tests whether input is a string.
Output Types:
- boolean
Inputs:
- value (object, array, boolean, integer, number, string)
Example:
Util.IsString("string") --> true
Util.JSON.Parse¶
Parses input JSON string to object. If input is already object, returns object.
Output Types:
- object
Inputs:
- value (string, object)
Aliases:
- Util.Object, Object
Example:
Util.JSON.Parse("{\"1\": 1, \"2\": 2, \"3\": 3}") --> {"1": 1, "2": 2, "3": 3}
Util.JSON.Stringify¶
Stringifies object to JSON. If input is already string, return string.
Output Types:
- object
Inputs:
- value (object, array, string)
Example:
Util.JSON.Stringify({"1":1,"2":2,"3":3}) --> "{\"1\":1,\"2\":2,\"3\":3}"
Util.Keys¶
Returns the keys of an object in an array.
Output Types:
- array
Inputs:
- object (object)
Example:
Util.Keys({"1":1,"2":2,"3":3}) --> ["1", "2", "3"]
Util.Log¶
Logs a message to the script job's logger stream at specified level (default is "info"). String input is sent to 'message' field, while object input is sent to the specified KVPs. Must still be assigned to placeholder value; returns input.
Output Types:
- number, string, object, array
Inputs:
- message (number, string, object, array)
- level (string)
- options: fatal, error, warn, info, debug, trace
Example:
Util.Log("Hello World!") --> "Hello World!"
Util.MakeCase¶
Converts input case and value to case object for use with Logic.IfCase and Logic.SwitchCase operators.
Output Types:
- object
Inputs:
- case (object, array, boolean, integer, number, string)
- value (object, array, boolean, integer, number, string)
Example:
Util.MakeCase(true, "TestString123") --> {"case": true, "value": "TestString123"}
Util.MapArray¶
Maps an input array according to mapper script. Assumes that mapper script returns a single keyed value for each item, e.g. return(key = value)
, and is invoked with value
and index
arguments, as well as any number of optional arguments.
Output Types:
- array
Inputs:
- input (array)
- mapper (script, object, string)
- opts (object, array, boolean, integer, number, string)
- variadic
- concurrency (string)
Example:
Util.MapArray([1,2,3,4,5], "squareFunc") --> [1,4,9,16,25]
Util.Merge¶
Merges objects in order of connections (argument order in DSL).
Output Types:
- object
Inputs:
- objects (object, array)
- array items: object
- variadic
Aliases:
- Util.ObjectOrderedMerge
Example:
Util.Merge({"k1":"v1","k2":"v2"}, {"k3":"v3","k2":"v4"}) --> {"k1": "v1","k2": "v4","k3": "v3"}
Util.Parameter¶
Parses parameter input. Note: deprecated.
Output Types:
- string, integer, number, boolean
Inputs:
- key (string, integer, boolean)
Util.Pick¶
Creates an object composed of the picked object properties. If all
is true and not all specified paths exist, an error will be thrown.
Output Types:
- object
Inputs:
- object (object, array)
- paths (array)
- array items: string, integer
- all (boolean)
Aliases:
- Util.ObjectPickPaths
Example:
Util.Pick({"k1":"v1","k2":"v2","k3":"v3","k4":"v4"}, ["k1","k3"]) --> {"k1": "v1", "k3": "v3"}
Util.Range¶
Returns an array of the range between inputs at the given step count.
Output Types:
- array
Inputs:
- start (integer)
- end (integer)
- step (integer)
Example:
Util.Range(10, 31, 10) --> [10, 20, 30]
Util.Reduce¶
Reduces an input array to a single accumulated value. Applies the reducer function to each element, taking the result of each iteration as input for the next. If no initial value is given, the first element is used as the initial value. Assumes that reduce script returns a single value for each item and is invoked with value
, index
, and accumulator
, as well as any number of optional arguments.
Output Types:
- array
Inputs:
- input (array)
- reducer (script, object, string)
- accumulator (object, array, boolean, integer, number, string)
- opts (object, array, boolean, integer, number, string)
- variadic
Example:
Util.Reduce([1,2,3,4,5], "sumFunc", 0) --> 15
Util.Reverse¶
Reverse the order of the input array.
Output Types:
- array
Inputs:
- array (array)
Example:
Util.Reverse([1,2,3]) --> [3,2,1]
Util.Set¶
Sets the value of an object at the specified path or index of an array.
Output Types:
- object, array
Inputs:
- object (MementoSeries, Memento, AtlasRecord, TokamakDataFlow, LatestTokamakDataflowJob, Workflow, LatestWorkflowJob, object, array)
- path (string)
- value (string, integer, number, object, boolean, null, array)
Aliases:
- Set
Example:
Util.Set({"1":1,"2":2}, "3", 3) --> {"1": 1, "2": 2, "3": 3}
Util.Slice¶
Slices an array from start
up to, but not including, end
.
Output Types:
- array
Inputs:
- array (array)
- start (integer)
- end (integer)
Example:
Util.Slice([1,2,3,4,5], 1,3) --> [2,3]
Util.Sort¶
Sorts an input array according to one or more sorter scripts, along with an optional array specifying whether each sorter should sort by ascending or descending values. Assumes that sorter scripts return a single integer value for each item, e.g. return(key = <integer>)
. Input array is then sorted by this output for each sorter. Sorters are invoked with value
and any number of optional arguments.
Output Types:
- array
Inputs:
- input (array)
- sorter (script, object, string, array)
- array items: string, object
- order (string, array)
- array items: string
- opts (object, array, boolean, integer, number, string)
- variadic
- concurrency (string)
Example:
Util.Sort([{"a":3,"b":1},{"a":2,"b":2},{"a":2,"b":3}], ["sortByA","sortByB"], ["asc","desc"]) --> [{"a":2,"b":3},{"a":2,"b":2},{"a":3,"b":1}]
Util.SubScript¶
Imports a subscript, referenced by id, for use in the current script. Note: deprecated.
Output Types:
- script
Inputs:
- name (string)
Aliases:
- Util.Function
Util.Tail¶
Returns all but the first element of an array.
Output Types:
- array
Inputs:
- array (array)
Aliases:
- Util.Rest
Example:
Util.Tail([1,2,3]) --> [2,3]
Util.ToBoolean¶
Converts input to boolean.
Output Types:
- boolean
Inputs:
- value (string, integer)
Aliases:
- Util.Boolean, Boolean, bool
Example:
Util.Boolean("true") --> true
Util.ToDate¶
Converts input to date (ISO string). Returns current date if no input is provided.
Output Types:
- date
Inputs:
- date (string, integer)
Aliases:
- Util.MakeDate
Example:
Util.ToDate(1542053701973) --> "2018-11-12T20:15:01.973Z"
Util.ToFloat¶
Converts input to floating point number.
Output Types:
- number
Inputs:
- value (string, integer, number)
Aliases:
- Util.Float, Float, float, Number, num
Example:
Util.Float("1.1") --> 1.1
Util.ToInteger¶
Converts input to integer.
Output Types:
- integer
Inputs:
- value (number, string)
Aliases:
- Util.Integer, Integer, int
Example:
Util.Integer("1.1") --> 1
Util.ToString¶
Converts input value to string if it is not already a string.
Output Types:
- string
Inputs:
- value (integer, number, object, array, boolean, null, string)
Aliases:
- String, str, Util.String
Example:
Util.String(123) --> "123"
Util.TypeOf¶
Returns the AuQL type (string, integer, number, boolean, array, object) of input as a string.
Output Types:
- string
Inputs:
- value (object, array, boolean, integer, number, string, null)
Example:
Util.TypeOf("string") --> "string"
Util.Unset¶
Unsets the value in the specified path of an object or index of an array and returns the collection.
Output Types:
- object, array
Inputs:
- collection (MementoSeries, Memento, AtlasRecord, TokamakDataFlow, LatestTokamakDataflowJob, Workflow, LatestWorkflowJob, object, array)
- path (string)
Example:
Util.Unset({"1":1,"2":2,"3":3}, "3") --> {"1": 1, "2": 2}
Util.Validate¶
Validates an object against a JSON Schema.
Output Types:
- array
Inputs:
- object (object)
- schema (object)
Example:
Util.Validate({"company":"Balistreri, Durgan and Smith","stock":294,"stock_sent":"negative","new_stock":2940}, {"title":"relation___3_0","type":"object","properties":{"company":{"type":"string","pigType":"chararray"},"stock":{"type":"integer","pigType":"long"},"stock_sent":{"type":"string","pigType":"chararray"},"new_stock":{"type":"integer","pigType":"long"}},"propertiesOrder":["company","stock","stock_sent","new_stock"]}) --> true
Util.Values¶
Returns the values of an object as an array.
Output Types:
- array
Inputs:
- object (object)
Example:
Util.Values({"1":1,"2":2,"3":3}) --> [1, 2, 3]