Skip to content

@usine/expression/expression-engine

The types and root variables an expression is checked and evaluated against.

  • Schema.Class

new Environment(…args): Environment

Parameter Type
…args [props: object, options?: MakeOptions]

Environment

readonly types: readonly ObjectType[]

readonly variables: readonly Variable[]


The expression failed to parse, to type-check, or to produce the expected result type.

  • Schema.Class

new ExpressionCheckError(…args): ExpressionCheckError

Parameter Type
…args [props: object, options?: MakeOptions]

ExpressionCheckError

readonly code: "check_failed" | "parse_error" | "type_error" | "unexpected_result_type"

readonly message: string

readonly position: Option<number>

readonly source: string & Brand<"ExpressionSource">


Evaluates Loop conditions and prompt expressions against their declared payload context.

  • Context.ServiceClass

readonly Service: ExpressionEngineService

The service’s operations: what yield* ExpressionEngine returns.


Evaluation failed on an expression that had already checked.

  • Schema.Class

new ExpressionEvaluationError(…args): ExpressionEvaluationError

Parameter Type
…args [props: object, options?: MakeOptions]

ExpressionEvaluationError

readonly message: string

readonly source: string & Brand<"ExpressionSource">


One named field and its CEL type within an object descriptor.

  • Schema.Class

new ObjectField(…args): ObjectField

Parameter Type
…args [props: object, options?: MakeOptions]

ObjectField

readonly name: string

readonly type: string & Brand<"CelTypeReference">


A CEL object type. Declare a type before the types that reference it.

  • Schema.Class

new ObjectType(…args): ObjectType

Parameter Type
…args [props: object, options?: MakeOptions]

ObjectType

readonly fields: readonly ObjectField[]

readonly name: string


A root variable available to CEL expressions in an Environment.

  • Schema.Class

new Variable(…args): Variable

Parameter Type
…args [props: object, options?: MakeOptions]

Variable

readonly name: string

readonly type: string & Brand<"CelTypeReference">

Checks and evaluates the expressions used to select Items and fill Loop task templates.

readonly checkBoolean: (source, environment) => Effect<void, ExpressionCheckError>

Checks whether the expression can select Items, without evaluating a payload.

Parameter Type
source string & Brand<"ExpressionSource">
environment Environment

Effect<void, ExpressionCheckError>

readonly checkScalar: (source, environment) => Effect<void, ExpressionCheckError>

Checks whether the expression can produce one value for prompt interpolation.

Parameter Type
source string & Brand<"ExpressionSource">
environment Environment

Effect<void, ExpressionCheckError>

readonly evaluateBoolean: (source, environment, context) => Effect<boolean, ExpressionCheckError | ExpressionEvaluationError>

Checks and evaluates a selection condition; context supplies values for the environment’s root variables.

Parameter Type
source string & Brand<"ExpressionSource">
environment Environment
context JsonObject

Effect<boolean, ExpressionCheckError | ExpressionEvaluationError>

readonly evaluateScalar: (source, environment, context) => Effect<string | number | bigint | boolean | null, ExpressionCheckError | ExpressionEvaluationError>

Checks and evaluates a prompt interpolation; context supplies values for the environment’s root variables.

Parameter Type
source string & Brand<"ExpressionSource">
environment Environment
context JsonObject

Effect<string | number | bigint | boolean | null, ExpressionCheckError | ExpressionEvaluationError>

readonly relatedStringLiterals: (source, memberPath) => Effect<readonly string[], ExpressionCheckError>

The string literals the expression compares against the name field of values reached from memberPath, following macro bindings and collection transformations. Config validation uses it to spot undeclared labels.

Parameter Type
source string & Brand<"ExpressionSource">
memberPath readonly string[]

Effect<readonly string[], ExpressionCheckError>

CheckErrorCode = typeof CheckErrorCode.Type

Whether checking failed during parsing, type resolution, or result-type validation.


ExpressionError = typeof ExpressionError.Type

The failures callers can receive when checking or evaluating a CEL expression.


Scalar = typeof Scalar.Type

Values prompt interpolation can render. CEL ints stay bigint.


Source = typeof Source.Type

Non-blank CEL source text.


TypeReference = typeof TypeReference.Type

A type name in CEL syntax such as string, Issue, or list<Label>.

const CheckErrorCode: Schema.Literals<readonly ["check_failed", "parse_error", "type_error", "unexpected_result_type"]>

Whether checking failed during parsing, type resolution, or result-type validation.


const ExpressionError: Schema.Union<readonly [typeof ExpressionCheckError, typeof ExpressionEvaluationError]>

The failures callers can receive when checking or evaluating a CEL expression.


const Scalar: Schema.Union<readonly [Schema.String, Schema.Number, Schema.BigInt, Schema.Boolean, Schema.Null]>

Values prompt interpolation can render. CEL ints stay bigint.


const Source: Schema.brand<Schema.String, "ExpressionSource">

Non-blank CEL source text.


const TypeReference: Schema.brand<Schema.String, "CelTypeReference">

A type name in CEL syntax such as string, Issue, or list<Label>.