Defines static constructor signature for communication binding types that
extend and implement the abstract CommunicationBinding
class.
A utility type used to specify a value for the CommunicationOptions.binding
property in the agent container configuration.
Type alias for all framework core types. This type is used for the coreType property of objects based on the CoatyObject interface.
Defines a set of conditions for filtering objects. Filter conditions can be combined by logical AND or OR as follows:
{
and: ObjectFilterCondition[],
}
{
or: ObjectFilterCondition[],
}
Multiple filter conditions combined by logical AND.
Specify either the and
or the or
property, or none, but never both.
An object filter condition is defined as a tuple specifying the name of an object property and a filter expression. The filter expression must evaluate to true when applied to the property's value for the condition to become true.
The object property to be applied for filtering is specified either
in dot notation or array notation. In dot notation, the name of the
object property is specified as a string (e.g. "objectId"
). It may
include dots (.
) to access nested properties of subobjects (e.g.
"message.name"
). If a single property name contains dots itself,
you obviously cannot use dot notation. Instead, specify the property
or nested properties as an array of strings (e.g.
["property.with.dots", "subproperty.with.dots"]
).
A filter expression is a tuple consisting of a filter operator and an
operator-specific number of filter operands. You should use one of the
typesafe filterOp
functions to specify a filter expression.
Multiple filter conditions combined by logical OR.
Specify either the and
or the or
property, or none, but never both.
An object filter condition is defined as a tuple specifying the name of an object property and a filter expression. The filter expression must evaluate to true when applied to the property's value for the condition to become true.
The object property to be applied for filtering is specified either
in dot notation or array notation. In dot notation, the name of the
object property is specified as a string (e.g. "objectId"
). It may
include dots (.
) to access nested properties of subobjects (e.g.
"message.name"
). If a single property name contains dots itself,
you obviously cannot use dot notation. Instead, specify the property
or nested properties as an array of strings (e.g.
["property.with.dots", "subproperty.with.dots"]
).
A filter expression is a tuple consisting of a filter operator and an
operator-specific number of filter operands. You should use one of the
typesafe filterOp
functions to specify a filter expression.
Defines the format of nested properties used in ObjectFilter conditions
and
orderByProperties
clauses. Both dot notation ("property.subproperty.subsubproperty"
)
and array notation (["property", "subproperty", "subsubproperty"]
) are supported for
naming nested properties. Note that dot notation cannot be used if one of the properties
contains a dot (.) in its name. In such cases, array notation must be used.
Type alias for RFC4122 V4 UUIDs represented as strings.
Defines filter operator functions that yield object filter expressions.
Checks if the filter property is between the given values, i.e. prop >= value1 AND prop <= value2.
If the first argument value1
is not less than or equal to the second
argument value2
, those two arguments are automatically swapped. For
string comparison, a default lexical ordering is used. Note: Do not
compare a number with a string, as the result is not defined.
Checks if the filter property value (usually an object or array) contains the given values.
Primitive value types (number, string, boolean, null) contain only the identical value. Object properties match if all the key-value pairs of the specified object are contained in them. Array properties match if all the specified array elements are contained in them.
The general principle is that the contained object must match the containing object as to structure and data contents recursively on all levels, possibly after discarding some non-matching array elements or object key/value pairs from the containing object. But remember that the order of array elements is not significant when doing a containment match, and duplicate array elements are effectively considered only once.
As a special exception to the general principle that the structures must match, an array on toplevel may contain a primitive value:
contains([1, 2, 3], [3]) => true
contains([1, 2, 3], 3) => true
Checks if the filter property is deep equal to the given value according to a recursive equality algorithm.
Note: do not check for undefined
value as it is converted to null
implicitely by JSON. Use the notExists
operator instead.
Checks if the filter property exists.
Checks if the filter property is greater than the given value.
For string comparison, a default lexical ordering is used. Note: Do not compare a number with a string, as the result is not defined.
Checks if the filter property is greater than or equal to the given value.
For string comparison, a default lexical ordering is used. Note: Do not compare a number with a string, as the result is not defined.
Checks if the filter property value is included on toplevel in the given operand array of values which may be primitive types (number, string, boolean, null) or object types compared using the deep equality operator.
For example:
in(47, [1, 46, 47, "foo"]) => true
in(47, [1, 46, "47", "foo"]) => false
in({ "foo": 47 }, [1, 46, { "foo": 47 }, "foo"]) => true
in({ "foo": 47 }, [1, 46, { "foo": 47, "bar": 42 }, "foo"]) => false
Checks if the filter property is less than the given value.
For string comparison, a default lexical ordering is used. Note: Do not compare a number with a string, as the result is not defined.
Checks if the filter property is less than or equal to the given value.
For string comparison, a default lexical ordering is used. Note: Do not compare a number with a string, as the result is not defined.
Checks if the filter property string matches the given pattern.
If pattern does not contain percent signs or underscores, then the pattern only represents the string itself; in that case LIKE acts like the equals operator (but less performant). An underscore (_) in pattern stands for (matches) any single character; a percent sign (%) matches any sequence of zero or more characters.
LIKE pattern matching always covers the entire string. Therefore, if it's desired to match a sequence anywhere within a string, the pattern must start and end with a percent sign.
To match a literal underscore or percent sign without matching other characters, the respective character in pattern must be preceded by the escape character. The default escape character is the backslash. To match the escape character itself, write two escape characters.
For example, the pattern string %a_c\\d\_
matches abc\d_
in hello abc\d_
and acc\d_
in acc\d_
, but nothing in hello abc\d_world
.
Note that in programming languages like JavaScript, Java, or C#, where
the backslash character is used as escape character for certain special
characters you have to double backslashes in literal string constants.
Thus, for the example above the pattern string literal would look like
"%a_c\\\\d\\_"
.
Checks if the filter property is not between the given values, i.e. prop < value1 OR prop > value2.
If the first argument value1
is not less than or equal to the second
argument value2
, those two arguments are automatically swapped. For
string comparison, a default lexical ordering is used. Note: Do not
compare a number with a string, as the result is not defined.
Checks if the filter property value (usually an object or array) does not contain the given values.
Primitive value types (number, string, boolean, null) contain only the identical value. Object properties match if all the key-value pairs of the specified object are not contained in them. Array properties match if all the specified array elements are not contained in them.
The general principle is that the contained object must match the containing object as to structure and data contents recursively on all levels, possibly after discarding some non-matching array elements or object key/value pairs from the containing object. But remember that the order of array elements is not significant when doing a containment match, and duplicate array elements are effectively considered only once.
As a special exception to the general principle that the structures must match, an array on toplevel may contain a primitive value:
notContains([1, 2, 3], [3]) => false
notContains([1, 2, 3], 3) => false
Checks if the filter property is not deep equal to the given value according to a recursive equality algorithm.
Note: do not check for undefined
value as it is converted to null
implicitely by JSON. Use the Exists
operator instead.
Checks if the filter property doesn't exist.
Checks if the filter property value is not included on toplevel in the given operand array of values which may be primitive types (number, string, boolean, null) or object types compared using the deep equality operator.
For example:
notIn(47, [1, 46, 47, "foo"]) => false
notIn(47, [1, 46, "47", "foo"]) => true
notIn({ "foo": 47 }, [1, 46, { "foo": 47 }, "foo"]) => false
notIn({ "foo": 47 }, [1, 46, { "foo": 47, "bar": 42 }, "foo"]) => true
Inserts the item into the sorted Array<T>
using the given compare function
on the item.
The Array<T>
must already be sorted according to the compare function
implementation; otherwise, the result is incorrect.
The compare function returns a value indicating whether the first argument is less than (return value < 0), equal to (return value === 0), or greater than (return value > 0) the second argument. The first argument is an item from the source array, the second argument is always the given item.
The sorted source array
The value to insert.
The function to use when comparing elements.
Searches the entire sorted Array<T>
for an element using the specified
compare function and returns the zero-based index of the element.
Returns the zero-based index of item in the sorted Array<T>
, if item is
found; otherwise, a negative number that is the bitwise complement of the
index of the next element that is larger than item or, if there is no larger
element, the bitwise complement of the array length.
The Array<T>
must already be sorted according to the compare function
implementation; otherwise, the result is incorrect.
The compare function returns a value indicating whether the first argument is less than (return value < 0), equal to (return value === 0), or greater than (return value > 0) the second argument. The first argument is an item from the source array, the second argument is always the given value.
If the Array<T>
contains more than one element with the same value, the
function returns only one of the occurrences, and it might return any one of
the occurrences, not necessarily the first one.
The sorted source array
The value to locate.
The function to use when comparing elements.
The zero-based starting index of the range to search (optional).
The zero-based ending index (inclusive) of the range to search (optional).
Deep copies a given value that can be represented as a JSON value.
Behaves identical to JSON.parse(JSON.stringify(obj))
., i.e. it throws
an exception when a circular structure is detected, and copies a Date
object into its ISO date string. All (own and inherited) enumerable properties
of objects are copied.
any value that can be represented as a JSON value
Checks if a JavaScript value (usually an object or array) contains other values. Primitive value types (number, string, boolean, null,undefined) contain only the identical value. Object properties match if all the key-value pairs of the specified object are contained in them. Array properties match if all the specified array elements are contained in them.
The general principle is that the contained object must match the containing object as to structure and data contents recursively on all levels, possibly after discarding some non-matching array elements or object key/value pairs from the containing object. But remember that the order of array elements is not significant when doing a containment match, and duplicate array elements are effectively considered only once.
As a special exception to the general principle that the structures must match, an array on toplevel may contain a primitive value:
contains([1, 2, 3], [3]) => true
contains([1, 2, 3], 3) => true
Note that the strict equality operator ===
is used to compare primitive values. For checking the
containment of properties in objects the hasOwnProperty
operator is used, i.e. only properties
defined on the object directly (not inherited) are considered.
For example:
import { contains } from "@coaty/core";
contains("foo" , "foo") => true
contains([1, 2, 3] , []) => true
contains([1, 2, 3] , [3, 1]) => true
contains([1, 2, 3] , [3, 1, 3, 1]) => true
contains([1, 2, 3] , [3, 1, 5]) => false
contains([1, [2, 3, 4], 3] , [3, [3, 2]]) => true
contains([1, [2, 3, 4], 3] , [3, [3, 1]]) => false
contains{( "foo": 1, "bar": 2 } , { "bar": 2 }) => true
contains({ "foo": 1, "bar": 2 } , { "bar": 2, "foo": 1 }) => true
contains({ "foo": 1, "bar": 2 } , { "bar": 2, "foo": 2 }) => false
contains({ "foo": { "bar": "baz" }}, { "foo": {} }) => true
contains({ "foo": { "bar": "baz" }}, { "bar": "baz" }) => false
contains([1, { "foo": [{ "bar": [1, 2, 3] }, 2, 3] }], [{ "foo": [{ "bar": [3] }] }]) => true
a JavaScript value containing another value
a JavaScript value to be contained in another value
Determines whether two JavaScript values, typically objects or arrays, are structurally equal (aka. deep equal) according to a recursive equality algorithm.
Note that the strict equality operator ===
is used to compare leaf values. For checking the
containment of properties in objects the hasOwnProperty
operator is used, i.e. only properties
defined on the object directly (not inherited) are considered.
For example:
import { equals } from "@coaty/core";
equals({ a : [ 2, 3 ], b : [ 4 ] }, { a : [ 2, 3 ], b : [ 4 ] })) => true
equals({ x : 5, y : [6] }, { x : 5, y : 6 })) => false
a JavaScript value
a JavaScript value
Checks if a value is included on toplevel in the given
operand array of values which may be primitive types (number, string, boolean, null)
or object types compared using the equals
deep equality operator.
For example:
import { includes } from "@coaty/core";
includes([1, 46, 47, "foo"], 47) => true
includes([1, 46, "47", "foo"], 47) => false
includes([1, 46, { "foo": 47 }, "foo"], { "foo": 47 }) => true
includes([1, 46, { "foo": 47, "bar": 42 }, "foo"], { "foo": 47 }) => false
a JavaScript value to be contained on toplevel in an array
a JavaScript array containing another value on toplevel
Checks if value
is a plain JavaScript object, that is, an object created by
an object literal, the Object
constructor, or one with a prototype of
null
, i.e. Object.create(null)
.
the value to check.
true
if value
is a plain object, else false
Returns whether the given time interval object is valid.
Returns a new Coaty container configuration object as a result of merging the two given (partial) primary and secondary configurations.
For each sub-configuration object (common, communication, etc.) the value of a property specified in primary overrides the value specified in secondary. In other words, the value of a secondary sub-configuration property is only taken if this property is not defined in primary. Note that merging only considers direct properties on the subconfiguration object level, not sub-levels thereof.
the (partial) primary configuration
the (partial) secondary configuration to be merged
Returns a string in ISO 8601 format for a duration.
a duration given in milliseconds
Returns a string in ISO 8601 format for a time interval including timezone offset information.
a TimeInterval object
whether to include milliseconds in the string (defaults to false)
Returns a string in ISO 8601 format including timezone offset information.
a Date object
whether to include milliseconds in the string (defaults to false)
Generated using TypeDoc
Module to export all public core APIs.