Iris

"intersystems-iris". Iris

A way to execute basic ObjectScript commands on an IRIS server instance. This class has methods to work with globals and to call class methods and routines. Any errors on the server generate Node.js Errors.

Methods

# classMethodAsync(className, methodName, argument, callback)

Invokes a class method that returns a value and returns the value asynchronously to the provided callback. To be used with functions that return a value.

Parameters:
Name Type Description
className string

the name of the class in which the method is implemented

methodName string

the name of the method to call

argument Array.<any>

arguments to pass to the method, zero one or more.

callback function

a function that takes arguments (err: Error, returnValue: any) to call with the returned value or error

Tutorials:
Throws:

If wrong number of arguments (at least 2)

# classMethodBigInt(className, methodName, …argument) → {bigint|null}

Invokes a class method that returns a value.

Parameters:
Name Type Attributes Description
className string

the name of the class in which the method is implemented

methodName string

the name of the method to call

argument any <repeatable>

arguments to pass to the method, zero one or more.

Tutorials:
Throws:

If wrong number of arguments (at least 2)

Returns:

the class method's return value as an integer number or null if empty string returned from IRIS

Type
bigint | null

# classMethodBoolean(className, methodName, …argument) → {boolean|null}

Invokes a class method that returns a value.

Parameters:
Name Type Attributes Description
className string

the name of the class in which the method is implemented

methodName string

the name of the method to call

argument any <repeatable>

arguments to pass to the method, zero one or more.

Tutorials:
Throws:

If wrong number of arguments (at least 2)

Returns:

the class method's return value as a boolean or null if empty string returned from IRIS

Type
boolean | null

# classMethodBytes(className, methodName, …argument) → {Buffer|null}

Invokes a class method that returns a value.

Parameters:
Name Type Attributes Description
className string

the name of the class in which the method is implemented

methodName string

the name of the method to call

argument any <repeatable>

arguments to pass to the method, zero one or more.

Tutorials:
Throws:

If wrong number of arguments (at least 2)

Returns:

the class method's return value as a Buffer or null if empty string returned from IRIS

Type
Buffer | null

# classMethodDecimal(className, methodName, …argument) → {external:"decimal.js".Decimal|null}

Invokes a class method that returns a value.

Parameters:
Name Type Attributes Description
className string

the name of the class in which the method is implemented

methodName string

the name of the method to call

argument any <repeatable>

arguments to pass to the method, zero one or more.

Tutorials:
Throws:

If wrong number of arguments (at least 2)

Returns:

the class method's return value as a Decimal or null if empty string returned from IRIS

Type
external:"decimal.js".Decimal | null

# classMethodIRISList(className, methodName, …argument) → {module:"intersystems-iris".IRISList}

Invokes a class method that returns a value.

Parameters:
Name Type Attributes Description
className string

the name of the class in which the method is implemented

methodName string

the name of the method to call

argument any <repeatable>

arguments to pass to the method, zero one or more.

Tutorials:
Throws:

If wrong number of arguments (at least 2)

Returns:

the class method's return value as an IRISList. If empty string returned from IRIS list will be empty

Type
module:"intersystems-iris".IRISList

# classMethodNumber(className, methodName, …argument) → {number|null}

Invokes a class method that returns a value.

Parameters:
Name Type Attributes Description
className string

the name of the class in which the method is implemented

methodName string

the name of the method to call

argument any <repeatable>

arguments to pass to the method, zero one or more.

Tutorials:
Throws:

If wrong number of arguments (at least 2)

Returns:

the class method's return value as a number or null if empty string returned from IRIS

Type
number | null

# classMethodObject(className, methodName, …argument) → {any}

Invokes a class method that returns a value.

Parameters:
Name Type Attributes Description
className string

the name of the class in which the method is implemented

methodName string

the name of the method to call

argument any <repeatable>

arguments to pass to the method, zero one or more.

Tutorials:
Throws:

If wrong number of arguments (at least 2)

Returns:
  • the class method's return value (null|Buffer|string|number|bigint|Decimal - null if empty string returned form IRIS)
Type
any

# classMethodString(className, methodName, …argument) → {string|null}

Invokes a class method that returns a value.

Parameters:
Name Type Attributes Description
className string

the name of the class in which the method is implemented

methodName string

the name of the method to call

argument any <repeatable>

arguments to pass to the method, zero one or more.

Tutorials:
Throws:

If wrong number of arguments (at least 2)

Returns:

the class method's return value as a string or null if empty string returned from IRIS

Type
string | null

# classMethodValue(className, methodName, …argument) → {any}

Invokes a class method that returns a value.

Parameters:
Name Type Attributes Description
className string

the name of the class in which the method is implemented

methodName string

the name of the method to call

argument any <repeatable>

arguments to pass to the method, zero one or more.

Tutorials:
Throws:

If wrong number of arguments (at least 2)

Returns:
  • the class method's return value (null|Buffer|string|number|bigint|Decimal - null if empty string returned form IRIS)
Type
any

# classMethodVoid(className, methodName, …argument)

Invokes a class method that does not return a value

Parameters:
Name Type Attributes Description
className string

the name of the class in which the method is implemented

methodName string

the name of the method to call

argument any <repeatable>

zero, one or more arguments to pass to the method.

Tutorials:
Throws:

If wrong number of arguments (at least 2)

# function(functionName, routineName, …argument) → {any}

Invokes a function in a routine.

Warning: Since version 2024.1, InterSystems IRIS prohibits access to routine execution through the Native API. If you need to use routines through the Native API, InterSystems recommends using class execution instead.
Parameters:
Name Type Attributes Description
functionName string

the name of the function to invoke

routineName string

the name of the routine in which the function is implemented

argument any <repeatable>

zero, one or more arguments to pass to the function

Tutorials:
Throws:
  • If wrong number of arguments (at least 2)

  • <PROTECT> Server error for IRIS Server 2024.1+

Returns:
  • the function's return value (null|Buffer|string|number|bigint|Decimal)
Type
any

# functionBigInt(functionName, routineName, …argument) → {bigint|null}

Invokes a function in a routine.

Warning: Since version 2024.1, InterSystems IRIS prohibits access to routine execution through the Native API. If you need to use routines through the Native API, InterSystems recommends using class execution instead.
Parameters:
Name Type Attributes Description
functionName string

the name of the function to invoke

routineName string

the name of the routine in which the function is implemented

argument any <repeatable>

zero, one or more arguments to pass to the function

Tutorials:
Throws:
  • If wrong number of arguments (at least 2)

  • <PROTECT> Server error for IRIS Server 2024.1+

Returns:

the return value as an integer number or null if empty string returned from IRIS

Type
bigint | null

# functionBoolean(functionName, routineName, …argument) → {boolean|null}

Invokes a function in a routine.

Warning: Since version 2024.1, InterSystems IRIS prohibits access to routine execution through the Native API. If you need to use routines through the Native API, InterSystems recommends using class execution instead.
Parameters:
Name Type Attributes Description
functionName string

the name of the function to invoke

routineName string

the name of the routine in which the function is implemented

argument any <repeatable>

zero, one or more arguments to pass to the function

Tutorials:
Throws:
  • If wrong number of arguments (at least 2)

  • <PROTECT> Server error for IRIS Server 2024.1+

Returns:

the return value as a boolean or null if empty string returned from IRIS

Type
boolean | null

# functionBytes(functionName, routineName, …argument) → {Buffer|null}

Invokes a function in a routine.

Warning: Since version 2024.1, InterSystems IRIS prohibits access to routine execution through the Native API. If you need to use routines through the Native API, InterSystems recommends using class execution instead.
Parameters:
Name Type Attributes Description
functionName string

the name of the function to invoke

routineName string

the name of the routine in which the function is implemented

argument any <repeatable>

zero, one or more arguments to pass to the function

Tutorials:
Throws:
  • If wrong number of arguments (at least 2)

  • <PROTECT> Server error for IRIS Server 2024.1+

Returns:
  • the return value as Buffer or null if empty string returned from IRIS
Type
Buffer | null

# functionDecimal(functionName, routineName, …argument) → {external:"decimal.js".Decimal|null}

Invokes a function in a routine.

Warning: Since version 2024.1, InterSystems IRIS prohibits access to routine execution through the Native API. If you need to use routines through the Native API, InterSystems recommends using class execution instead.
Parameters:
Name Type Attributes Description
functionName string

the name of the function to invoke

routineName string

the name of the routine in which the function is implemented

argument any <repeatable>

zero, one or more arguments to pass to the function

Tutorials:
Throws:
  • If wrong number of arguments (at least 2)

  • <PROTECT> Server error for IRIS Server 2024.1+

Returns:

the return value as Decimal or null if empty string returned from IRIS

Type
external:"decimal.js".Decimal | null

# functionIRISList(functionName, routineName, …argument) → {module:"intersystems-iris".IRISList}

Invokes a function in a routine that returns an IRISList.

Warning: Since version 2024.1, InterSystems IRIS prohibits access to routine execution through the Native API. If you need to use routines through the Native API, InterSystems recommends using class execution instead.
Parameters:
Name Type Attributes Description
functionName string

the name of the function to invoke

routineName string

the name of the routine in which the function is implemented

argument any <repeatable>

zero, one or more arguments to pass to the function

Tutorials:
Throws:
  • If wrong number of arguments (at least 2)

  • <PROTECT> Server error for IRIS Server 2024.1+

Returns:

the return value as an IRISList. If empty string returned from IRIS the list will be empty.

Type
module:"intersystems-iris".IRISList

# functionNumber(functionName, routineName, …argument) → {number|null}

Invokes a function in a routine.

Warning: Since version 2024.1, InterSystems IRIS prohibits access to routine execution through the Native API. If you need to use routines through the Native API, InterSystems recommends using class execution instead.
Parameters:
Name Type Attributes Description
functionName string

the name of the function to invoke

routineName string

the name of the routine in which the function is implemented

argument any <repeatable>

zero, one or more arguments to pass to the function

Tutorials:
Throws:
  • If wrong number of arguments (at least 2)

  • <PROTECT> Server error for IRIS Server 2024.1+

Returns:

the return value as a number or null if empty string returned from IRIS

Type
number | null

# functionObject(functionName, routineName, …argument) → {any}

Invokes a function in a routine.

Warning: Since version 2024.1, InterSystems IRIS prohibits access to routine execution through the Native API. If you need to use routines through the Native API, InterSystems recommends using class execution instead.
Parameters:
Name Type Attributes Description
functionName string

the name of the function to invoke

routineName string

the name of the routine in which the function is implemented

argument any <repeatable>

zero, one or more arguments to pass to the function

Tutorials:
Throws:
  • If wrong number of arguments (at least 2)

  • <PROTECT> Server error for IRIS Server 2024.1+

Returns:
  • the function's return value (null|Buffer|string|number|bigint|Decimal)
Type
any

# functionString(functionName, routineName, …argument) → {string|null}

Invokes a function in a routine.

Warning: Since version 2024.1, InterSystems IRIS prohibits access to routine execution through the Native API. If you need to use routines through the Native API, InterSystems recommends using class execution instead.
Parameters:
Name Type Attributes Description
functionName string

the name of the function to invoke

routineName string

the name of the routine in which the function is implemented

argument any <repeatable>

zero, one or more arguments to pass to the function

Tutorials:
Throws:
  • If wrong number of arguments (at least 2)

  • <PROTECT> Server error for IRIS Server 2024.1+

Returns:

the return value as a string or null if empty string returned from IRIS

Type
string | null

# get(globalName, …subscript) → {null|Buffer|external:"decimal.js".Decimal|number|string|bigint}

Gets the value of a global array node, returns null if the node is not defined or is an empty string.

Parameters:
Name Type Attributes Description
globalName string

the name of the global array

subscript any <repeatable>

variable number of subscript values

Tutorials:
Throws:

If wrong number of arguments (at least 1)

Returns:
  • null if node not defined, else any of the Buffer, string, number and Decimal.
Type
null | Buffer | external:"decimal.js".Decimal | number | string | bigint

# getAPIVersion() → {string}

Get the API version string as major.minor.patch

Returns:
Type
string

# getBigInt(globalName, …subscript) → {null|bigint}

Gets the value of a global array node as an integer number, returns null if the node is not defined. If the global array node contains an empty string, return value is 0n.

Parameters:
Name Type Attributes Description
globalName string

the name of the global array

subscript any <repeatable>

variable number of subscript values

Tutorials:
Throws:

If wrong number of arguments (at least 1)

Returns:
  • null if the node is not defined, else number.
Type
null | bigint

# getBoolean(globalName, …subscript) → {null|boolean}

Gets the boolean value of a global array node, returns null if the node is not defined. If the global array node contains an empty string, return value is false.

Parameters:
Name Type Attributes Description
globalName string

the name of the global array

subscript any <repeatable>

variable number of subscript values

Tutorials:
Throws:

If wrong number of arguments (at least 1)

Returns:
  • null if the node is not defined, else boolean.
Type
null | boolean

# getBytes(globalName, …subscript) → {null|Buffer}

Gets the value of a global array node as a Buffer, returns null if the node is not defined. If the global array node contains an empty string, an empty Buffer will be returned.

Parameters:
Name Type Attributes Description
globalName string

the name of the global array

subscript any <repeatable>

variable number of subscript values

Tutorials:
Throws:

If wrong number of arguments (at least 1)

Returns:
  • null if the node is not defined, else Buffer.
Type
null | Buffer

# getDecimal(globalName, …subscript) → {null|external:"decimal.js".Decimal}

Gets the value of a global array node as a Decimal, returns null if the node is not defined. If the global array node contains an empty string, return value is Decimal(0).

Parameters:
Name Type Attributes Description
globalName string

the name of the global array

subscript any <repeatable>

variable number of subscript values

Tutorials:
Throws:

If wrong number of arguments (at least 1)

Returns:
  • null ifthe node is not defined, else Decimal.
Type
null | external:"decimal.js".Decimal

# getIRISList(globalName, …subscript) → {null|module:"intersystems-iris".IRISList}

Gets the value of a global array node as an IRISList , returns null if the node is not defined. If the global array node contains an empty string, return value is an empty list. Values that do not have an iris list format will generate an IRISList error.

Alias of getList

Parameters:
Name Type Attributes Description
globalName string

the name of the global array

subscript any <repeatable>

variable number of subscript values

Tutorials:
Throws:

If wrong number of arguments (at least 1)

Returns:
  • null if the node is not defined, else IRISList.
Type
null | module:"intersystems-iris".IRISList

# getList(globalName, …subscript) → {null|module:"intersystems-iris".IRISList}

Gets the value of a global array node as an IRISList, returns null if the node is not defined. If the global array node contains an empty string, return value is an empty list. Values that do not have an iris list format will generate an IRISList error.

Parameters:
Name Type Attributes Description
globalName string

the name of the global array

subscript any <repeatable>

variable number of subscript values

Tutorials:
Throws:

If wrong number of arguments (at least 1)

Returns:
  • null if the node is not defined, else IRISList.
Type
null | module:"intersystems-iris".IRISList

# getNumber(globalName, …subscript) → {null|number}

Gets the numeric value of a global array node, returns null if the node is not defined. If the global array node contains an empty string, return value is 0.

Parameters:
Name Type Attributes Description
globalName string

the name of the global array

subscript any <repeatable>

variable number of subscript values

Tutorials:
Throws:

If wrong number of arguments (at least 1)

Returns:
  • null if the node is not defined, else number.
Type
null | number

# getObject(globalName, …subscript) → {null|Buffer|external:"decimal.js".Decimal|number|string|bigint}

Gets the value of a global array node, returns null if the node is not defined or is an empty string.

Parameters:
Name Type Attributes Description
globalName string

the name of the global array

subscript any <repeatable>

variable number of subscript values

Tutorials:
Throws:

If wrong number of arguments (at least 1)

Returns:
  • null if node not defined, else any of the Buffer, string, number and Decimal.
Type
null | Buffer | external:"decimal.js".Decimal | number | string | bigint

# getServerVersion() → {string}

Get the IRIS Server's version string.

Throws:

exception

Returns:
Type
string

# getString(globalName, …subscript) → {null|string}

Gets the value of a global array node as a string, returns null if the node is not defined. If the global array node contains an empty string, return value is a string of length 0.

Parameters:
Name Type Attributes Description
globalName string

the name of the global array

subscript any <repeatable>

variable number of subscript values

Tutorials:
Throws:

If wrong number of arguments (at least 1)

Returns:
  • null if the node is undefined, else string.
Type
null | string

# getTLevel() → {number}

Gets the nesting level of the current IRIS transaction. This is equivalent to fetching the value of the $TLEVEL special variable in IRIS.

Tutorials:
Returns:
  • the nesting level of the current IRIS transaction, 0 if no transaction is active
Type
number

# increment(incrementBy, globalName, …subscript) → {number|bigint|external:"decimal.js".Decimal}

Increments the value of a global array node.

Parameters:
Name Type Attributes Description
incrementBy number | bigint | external:"decimal.js".Decimal

the amount to increment the global array node by

globalName string

the name of the global array

subscript any <repeatable>

variable number of subscript values

Tutorials:
Throws:

If wrong number of arguments (at least 2)

Returns:

the new value of the global node.

Type
number | bigint | external:"decimal.js".Decimal

# isDefined(globalName, …subscript) → {number}

Returns whether a global node contains data and whether it has children. This method is similar to $DATA in IRIS.

Parameters:
Name Type Attributes Description
globalName string

the name of the global array

subscript any <repeatable>

variable number of subscript values

Tutorials:
Throws:

If wrong number of arguments (at least 1)

Returns:
  • 0 if the global array node is not defined, 1 if it is defined and has no subordinate nodes, 10 if not defined but has subordinate nodes, 11 if defined and has subordinate nodes.
Type
number

# iterator(globalName, …subscript) → {module:"intersystems-iris".Iterator}

Instantiates the Iterator class. Another way to instantiate an Iterator is by iterating an IRISGlobalNode object.

Parameters:
Name Type Attributes Description
globalName string

the name of the global array

subscript any <repeatable>

variable number of subscript values

Tutorials:
Throws:

exception

# kill(globalName, …subscript)

Kills a global array node, including any descendants.

Parameters:
Name Type Attributes Description
globalName string

the name of the global array

subscript any <repeatable>

variable number of subscript values

Tutorials:
Throws:

If wrong number of arguments (at least 1)

# lock(lockType, timeout, lockReference, …subscript) → {boolean}

Locks a global array node. The lockMode argument specifies whether any previously held locks should be released. This method will time out after a predefined interval if the lock cannot be acquired. NOTE: The lockReference value must begin with '^' to acquire a lock on a global node.

Parameters:
Name Type Attributes Description
lockType string

'S' for shared lock, 'E' for an escalating lock, 'SE' for both and empty string for none.

timeout number

the number (integer) of seconds before the attempt to acquire the lock will timeout

lockReference string

a leading '^' is required for global array references. Note that lock() and unlock() are different from all other functions where only a globalName - without the '^' prefix - is required.

subscript any <repeatable>
Tutorials:
Throws:

If wrong number of arguments (at least 2)

Returns:
Type
boolean

# nextSubscript(reversed, globalName, …subscript) → {null|string}

Gets the next $order subscript value of a global array node as a string, returns null if at the end. This method is similar to $ORDER in IRIS.

⚠ Warning: In the previous version of thi driver the $c(0) subscript (for example for IRIS global ^x($c(0))) was returned as a string of length 0. Since string of length 0 is used to help us move to the first subscript in the node defined by all subscripts but the last one (see subscript argument description bellow), this behavior was problematic. For this, we deprecate the return of 0 length string for $c(0) subscript. A string of length 1 and value \0 will be returned will be returned instead.

Parameters:
Name Type Attributes Description
reversed boolean

if true, reverse $order

globalName string

the name of the global array

subscript any <repeatable>

variable number of subscript values. If last subscript is '' then this function will return the first subscript within the node defined by all the subscripts but the last one

Throws:

If wrong number of arguments (at least 2)

Returns:

null if the end, else the next subscript that is the sibling of the last subscript

Type
null | string

# node(globalName, …subscript) → {module:"intersystems-iris".IRISGlobalNode}

Instantiates the IRISGlobalNode class.

Parameters:
Name Type Attributes Description
globalName string

the name of the global array

subscript any <repeatable>

variable number of subscript values

Tutorials:

# procedure(procedureName, routineName, …argument)

Invokes a procedure (no value is returned) in a routine.

Warning: Since version 2024.1, InterSystems IRIS prohibits access to routine execution through the Native API. If you need to use routines through the Native API, InterSystems recommends using class execution instead.
Parameters:
Name Type Attributes Description
procedureName string

the name of the procedure to invoke

routineName string

the name of the routine in which the procedure is implemented

argument any <repeatable>

zero, one or more arguments to pass to the procedure

Tutorials:
Throws:
  • If wrong number of arguments (at least 2)

  • <PROTECT> Server error for IRIS Server 2024.1+

# releaseAllLocks()

Releases all global array locks held by the connection.

Tutorials:

# set(value, globalName, …subscript)

Sets the value of a global array node.

Parameters:
Name Type Attributes Description
value string | number | boolean | null | bigint | external:"decimal.js".Decimal | module:"intersystems-iris".IRISList

the value to assign to the global array

globalName string

the name of the global array

subscript any <repeatable>

variable number of subscript values

Tutorials:
Throws:

If wrong number of arguments (at least 2)

# tCommit()

Commits one level of the IRIS transaction.

Tutorials:

# tRollback()

Rollbacks all open levels of the IRIS transaction.

Tutorials:

# tRollbackOne()

Rollbacks one level of the transaction.

Tutorials:

# tStart()

Starts an IRIS transaction.

Tutorials:

# unlock(lockMode, lockReference, …subscript)

Releases a previously acquired lock on lockReference.

Parameters:
Name Type Attributes Description
lockMode string

a string containing lock type ('S', 'E', 'SE', '') and 'I' for an immediate unlock or 'D' for deferred (none or one of them since they are mutually exclusive.)

lockReference string

a leading '^' is required for global array references. Note that lock() and unlock() are different from all other functions. where only a globalName - without the '^' prefix - is required.

subscript any <repeatable>
Tutorials:
Throws:

If wrong number of arguments (at least 2)