Template
Functions

Template Functions

Built-in functions

Apart from the functions you can add via module, there are built-in functions, that are statically compiled and have no restrictions on the number of parallel calls they support. They are available in all templates.

FunctionDescription
replace(text: string, searchString: string, replacement: string) : stringReplaces all occurrences of a searchString within text.
sha1(text: string) : stringReturns the SHA-1 of text. The returned value is a string representing the hexadecimal values of each byte in order of the resulted SHA-1 byte array.
toLowerCase(text: string) : stringReturns same text with all of its characters in lower case.
uuid() : stringReturns a pseudo randomly generated UUID.
emptyList(list : object[]) : booleanReturns true if list contains no elements.
base64Encode(text: string) : stringEncodes text using Base64 encoding scheme.
base64Decode(text: string) : stringDecodes text using Base64 encoding scheme.
fromJsonArrayToIterable(jsonArray: string[]) : list<kv<string, object>>Given a list of JSON documents, returns a list of key-value stores for each one.
fromYamlArrayToIterable(yamlArray: string[]) : list<kv<string, object>>Given a list of YAML documents, returns a list of key-value stores for each one.
setVar(var: string, newVal : object)Set the newVal to variable var in the current scope.
consolePrint(message: string)Prints a message to the console.
recordExists(vdb: string, entity : string, filters : string) : booleanReturns true if at least one record in the in the Virtual Database vdb and Table entity, that matches specific filters. The format expected for filters param is a semicolon separated list of filters in the form field<operation>value, for example myfield=myvalue or myfield>100.
getFirstMatchField(vdb: string, entity : string, field : string, filters : string)Returns the value of column field using same filtering criteria than recordExists. If the query returns more than one row, the function returns the first one.
getSchemasByProperties(vdb: string, properties : string) string[]Returns the list of schema names that contains specified properties. The format expected for properties param is a semicolon separated list of properties in the form property:value, for example azure_subscription:mysubscription. When vdb has the special param all, function searches in all registered Virtual Databases.
getTablesByDirectives(vdb: string, schema : string, directives : string) string[]Returns the list of table names of a specific schema with specified directives. The format expected for directives param is a semicolon separated list of names. When vdb and/or schema contain the special param all, function searches in all registered Virtual Databases and Schemas respectively.
getTablesByDirectivesAndValues(vdb: string, schema : string, directives : string) string[]Returns the list of table names of a specific schema with specified directives and values. Searching mechanism is the same as in getTablesByDirectives, but this function expects also a directive value, in the form directive:value, for example supports_idempotency:false.
getTablesByTags(vdb: string, schema : string, tags : string) string[]Returns the list of table names that contain specified tags. The format expected for tags param is a semicolon separated list of values. When vdb and/or schema contain the special param all, function searches in all registered Virtual Databases and Schemas respectively.

Meta-functions

FunctionDescription
deferValueProcessing(contextVar : string) : objectThis function creates a promise that ensures the value of the variable whose name in passed in contextVar will be available in the context at some later point, preventing the parser from throwing an error when trying to replace by an not existent variable's value. This works only in Action Endpoints definitions.