@usine/expression 0.1.0 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +8 -0
- package/dist/environment.d.ts +34 -0
- package/dist/environment.d.ts.map +1 -0
- package/dist/environment.js +33 -0
- package/dist/environment.js.map +1 -0
- package/dist/expression-engine.d.ts +43 -4
- package/dist/expression-engine.d.ts.map +1 -1
- package/dist/expression-engine.js +37 -1
- package/dist/expression-engine.js.map +1 -1
- package/dist/marcbachmann-cel.d.ts +1 -1
- package/dist/marcbachmann-cel.d.ts.map +1 -1
- package/dist/marcbachmann-cel.js +153 -7
- package/dist/marcbachmann-cel.js.map +1 -1
- package/package.json +8 -4
- package/dist/index.d.ts +0 -9
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js +0 -9
- package/dist/index.js.map +0 -1
- package/dist/model.d.ts +0 -61
- package/dist/model.d.ts.map +0 -1
- package/dist/model.js +0 -66
- package/dist/model.js.map +0 -1
package/README.md
CHANGED
|
@@ -4,6 +4,14 @@ Typed CEL checking and evaluation for [usine](https://github.com/basaltbytes/usi
|
|
|
4
4
|
|
|
5
5
|
Unknown variables and object paths fail during checking, including paths inside CEL macros such as `exists`. Failures are typed values: `ExpressionCheckError` from parsing, type checking, or result-type checking, `ExpressionEvaluationError` from evaluation, and the `ExpressionError` union covering both. JSON integers declared as CEL `int` or `uint` are converted to `bigint` before evaluation so GraphQL payloads keep CEL integer semantics.
|
|
6
6
|
|
|
7
|
+
`relatedStringLiterals(source, memberPath)` reports string literals from the smallest expression subtrees that use a member path. Config validation uses it to diagnose undeclared GitHub labels without coupling `@usine/config` to the CEL adapter's AST.
|
|
8
|
+
|
|
7
9
|
`MarcbachmannCelLayer` uses `@marcbachmann/cel-js@8.0.0`. The exported `ExpressionEngine` contract contains CEL type names and usine-owned descriptors rather than library objects; an `@bufbuild/cel` adapter can provide the same service tag without changing callers.
|
|
8
10
|
|
|
9
11
|
All APIs remain 0.x and can change between minor releases.
|
|
12
|
+
|
|
13
|
+
Import `ExpressionEngine`, `Source`, `Environment`, the environment descriptors,
|
|
14
|
+
`Scalar`, and the typed expression errors from `@usine/expression/expression-engine`.
|
|
15
|
+
This entry point replaces `@usine/expression/model`; existing imports from that
|
|
16
|
+
subpath must use `/expression-engine`. Import the CEL adapter layer separately
|
|
17
|
+
from `@usine/expression/marcbachmann-cel`.
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { Schema } from "effect";
|
|
2
|
+
/** A type name in CEL syntax such as `string`, `Issue`, or `list<Label>`. */
|
|
3
|
+
export declare const TypeReference: Schema.brand<Schema.String, "CelTypeReference">;
|
|
4
|
+
export type TypeReference = typeof TypeReference.Type;
|
|
5
|
+
declare const ObjectField_base: Schema.Class<ObjectField, Schema.Struct<{
|
|
6
|
+
readonly name: Schema.String;
|
|
7
|
+
readonly type: Schema.brand<Schema.String, "CelTypeReference">;
|
|
8
|
+
}>, {}>;
|
|
9
|
+
/** One named field and its CEL type within an object descriptor. */
|
|
10
|
+
export declare class ObjectField extends ObjectField_base {
|
|
11
|
+
}
|
|
12
|
+
declare const ObjectType_base: Schema.Class<ObjectType, Schema.Struct<{
|
|
13
|
+
readonly name: Schema.String;
|
|
14
|
+
readonly fields: Schema.$Array<typeof ObjectField>;
|
|
15
|
+
}>, {}>;
|
|
16
|
+
/** A CEL object type. Declare a type before the types that reference it. */
|
|
17
|
+
export declare class ObjectType extends ObjectType_base {
|
|
18
|
+
}
|
|
19
|
+
declare const Variable_base: Schema.Class<Variable, Schema.Struct<{
|
|
20
|
+
readonly name: Schema.String;
|
|
21
|
+
readonly type: Schema.brand<Schema.String, "CelTypeReference">;
|
|
22
|
+
}>, {}>;
|
|
23
|
+
/** A root variable available to CEL expressions in an Environment. */
|
|
24
|
+
export declare class Variable extends Variable_base {
|
|
25
|
+
}
|
|
26
|
+
declare const Environment_base: Schema.Class<Environment, Schema.Struct<{
|
|
27
|
+
readonly types: Schema.$Array<typeof ObjectType>;
|
|
28
|
+
readonly variables: Schema.$Array<typeof Variable>;
|
|
29
|
+
}>, {}>;
|
|
30
|
+
/** The types and root variables an expression is checked and evaluated against. */
|
|
31
|
+
export declare class Environment extends Environment_base {
|
|
32
|
+
}
|
|
33
|
+
export {};
|
|
34
|
+
//# sourceMappingURL=environment.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"environment.d.ts","sourceRoot":"","sources":["../src/environment.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAEhC,6EAA6E;AAC7E,eAAO,MAAM,aAAa,iDAKc,CAAC;AACzC,MAAM,MAAM,aAAa,GAAG,OAAO,aAAa,CAAC,IAAI,CAAC;;;;;AAkBtD,oEAAoE;AACpE,qBAAa,WAAY,SAAQ,gBAG/B;CAAG;;;;;AAEL,4EAA4E;AAC5E,qBAAa,UAAW,SAAQ,eAG9B;CAAG;;;;;AAEL,sEAAsE;AACtE,qBAAa,QAAS,SAAQ,aAG5B;CAAG;;;;;AAEL,mFAAmF;AACnF,qBAAa,WAAY,SAAQ,gBAG/B;CAAG"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { Schema } from "effect";
|
|
2
|
+
/** A type name in CEL syntax such as `string`, `Issue`, or `list<Label>`. */
|
|
3
|
+
export const TypeReference = Schema.String.check(Schema.isPattern(/^(?:[A-Za-z_][A-Za-z0-9_.]*|list<[A-Za-z_][A-Za-z0-9_.]*>|map<[A-Za-z_][A-Za-z0-9_.]*,[A-Za-z_][A-Za-z0-9_.]*>)$/u, { message: "Expected a CEL type reference" })).pipe(Schema.brand("CelTypeReference"));
|
|
4
|
+
const Identifier = Schema.String.check(Schema.isPattern(/^[A-Za-z_][A-Za-z0-9_]*$/u, { message: "Expected a CEL identifier" }));
|
|
5
|
+
const ObjectTypeName = Schema.String.check(Schema.isPattern(/^[A-Za-z_][A-Za-z0-9_.]*$/u, {
|
|
6
|
+
message: "Expected a CEL object-type name",
|
|
7
|
+
}));
|
|
8
|
+
const uniqueNames = (message) => Schema.makeFilter((values) => new Set(values.map(({ name }) => name)).size === values.length, { message });
|
|
9
|
+
/** One named field and its CEL type within an object descriptor. */
|
|
10
|
+
export class ObjectField extends Schema.Class("@usine/expression/ObjectField")({
|
|
11
|
+
name: Identifier,
|
|
12
|
+
type: TypeReference,
|
|
13
|
+
}) {
|
|
14
|
+
}
|
|
15
|
+
/** A CEL object type. Declare a type before the types that reference it. */
|
|
16
|
+
export class ObjectType extends Schema.Class("@usine/expression/ObjectType")({
|
|
17
|
+
name: ObjectTypeName,
|
|
18
|
+
fields: Schema.Array(ObjectField).check(uniqueNames("Expected unique CEL object-field names")),
|
|
19
|
+
}) {
|
|
20
|
+
}
|
|
21
|
+
/** A root variable available to CEL expressions in an Environment. */
|
|
22
|
+
export class Variable extends Schema.Class("@usine/expression/Variable")({
|
|
23
|
+
name: Identifier,
|
|
24
|
+
type: TypeReference,
|
|
25
|
+
}) {
|
|
26
|
+
}
|
|
27
|
+
/** The types and root variables an expression is checked and evaluated against. */
|
|
28
|
+
export class Environment extends Schema.Class("@usine/expression/Environment")({
|
|
29
|
+
types: Schema.Array(ObjectType).check(uniqueNames("Expected unique CEL object-type names")),
|
|
30
|
+
variables: Schema.Array(Variable).check(uniqueNames("Expected unique CEL variable names")),
|
|
31
|
+
}) {
|
|
32
|
+
}
|
|
33
|
+
//# sourceMappingURL=environment.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"environment.js","sourceRoot":"","sources":["../src/environment.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAEhC,6EAA6E;AAC7E,MAAM,CAAC,MAAM,aAAa,GAAG,MAAM,CAAC,MAAM,CAAC,KAAK,CAC9C,MAAM,CAAC,SAAS,CACd,mHAAmH,EACnH,EAAE,OAAO,EAAE,+BAA+B,EAAE,CAC7C,CACF,CAAC,IAAI,CAAC,MAAM,CA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CAAC,KAAK,CAAc,+BAA+B,CAAC,CAAC;IAC1F,KAAK,EAAE,MAAM,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,KAAK,CAAC,WAAW,CAAC,uCAAuC,CAAC,CAAC;IAC3F,SAAS,EAAE,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,KAAK,CAAC,WAAW,CAAC,oCAAoC,CAAC,CAAC;CAC3F,CAAC;CAAG"}
|
|
@@ -1,14 +1,53 @@
|
|
|
1
|
-
import { Context, type Effect,
|
|
2
|
-
import type { Environment
|
|
3
|
-
/**
|
|
1
|
+
import { Context, type Effect, Schema } from "effect";
|
|
2
|
+
import type { Environment } from "./environment.ts";
|
|
3
|
+
/** Non-blank CEL source text. */
|
|
4
|
+
export declare const Source: Schema.brand<Schema.String, "ExpressionSource">;
|
|
5
|
+
export type Source = typeof Source.Type;
|
|
6
|
+
/** Whether checking failed during parsing, type resolution, or result-type validation. */
|
|
7
|
+
export declare const CheckErrorCode: Schema.Literals<readonly ["check_failed", "parse_error", "type_error", "unexpected_result_type"]>;
|
|
8
|
+
export type CheckErrorCode = typeof CheckErrorCode.Type;
|
|
9
|
+
declare const ExpressionCheckError_base: Schema.Class<ExpressionCheckError, Schema.TaggedStruct<"ExpressionCheckError", {
|
|
10
|
+
readonly source: Schema.brand<Schema.String, "ExpressionSource">;
|
|
11
|
+
readonly code: Schema.Literals<readonly ["check_failed", "parse_error", "type_error", "unexpected_result_type"]>;
|
|
12
|
+
readonly message: Schema.NonEmptyString;
|
|
13
|
+
readonly position: Schema.Option<Schema.Int>;
|
|
14
|
+
}>, import("effect/Cause").YieldableError>;
|
|
15
|
+
/** The expression failed to parse, to type-check, or to produce the expected result type. */
|
|
16
|
+
export declare class ExpressionCheckError extends ExpressionCheckError_base {
|
|
17
|
+
}
|
|
18
|
+
declare const ExpressionEvaluationError_base: Schema.Class<ExpressionEvaluationError, Schema.TaggedStruct<"ExpressionEvaluationError", {
|
|
19
|
+
readonly source: Schema.brand<Schema.String, "ExpressionSource">;
|
|
20
|
+
readonly message: Schema.NonEmptyString;
|
|
21
|
+
}>, import("effect/Cause").YieldableError>;
|
|
22
|
+
/** Evaluation failed on an expression that had already checked. */
|
|
23
|
+
export declare class ExpressionEvaluationError extends ExpressionEvaluationError_base {
|
|
24
|
+
}
|
|
25
|
+
/** The failures callers can receive when checking or evaluating a CEL expression. */
|
|
26
|
+
export declare const ExpressionError: Schema.Union<readonly [typeof ExpressionCheckError, typeof ExpressionEvaluationError]>;
|
|
27
|
+
export type ExpressionError = typeof ExpressionError.Type;
|
|
28
|
+
/** Values prompt interpolation can render. CEL ints stay bigint. */
|
|
29
|
+
export declare const Scalar: Schema.Union<readonly [Schema.String, Schema.Number, Schema.BigInt, Schema.Boolean, Schema.Null]>;
|
|
30
|
+
export type Scalar = typeof Scalar.Type;
|
|
31
|
+
/** Checks and evaluates the expressions used to select Items and fill Loop task templates. */
|
|
4
32
|
export interface ExpressionEngineService {
|
|
33
|
+
/**
|
|
34
|
+
* The string literals the expression compares against the `name` field of
|
|
35
|
+
* values reached from `memberPath`, following macro bindings and collection
|
|
36
|
+
* transformations. Config validation uses it to spot undeclared labels.
|
|
37
|
+
*/
|
|
38
|
+
readonly relatedStringLiterals: (source: Source, memberPath: ReadonlyArray<string>) => Effect.Effect<ReadonlyArray<string>, ExpressionCheckError>;
|
|
39
|
+
/** Checks whether the expression can select Items, without evaluating a payload. */
|
|
5
40
|
readonly checkBoolean: (source: Source, environment: Environment) => Effect.Effect<void, ExpressionCheckError>;
|
|
41
|
+
/** Checks whether the expression can produce one value for prompt interpolation. */
|
|
6
42
|
readonly checkScalar: (source: Source, environment: Environment) => Effect.Effect<void, ExpressionCheckError>;
|
|
43
|
+
/** Checks and evaluates a selection condition; `context` supplies values for the environment's root variables. */
|
|
7
44
|
readonly evaluateBoolean: (source: Source, environment: Environment, context: Schema.JsonObject) => Effect.Effect<boolean, ExpressionError>;
|
|
45
|
+
/** Checks and evaluates a prompt interpolation; `context` supplies values for the environment's root variables. */
|
|
8
46
|
readonly evaluateScalar: (source: Source, environment: Environment, context: Schema.JsonObject) => Effect.Effect<Scalar, ExpressionError>;
|
|
9
47
|
}
|
|
10
48
|
declare const ExpressionEngine_base: Context.ServiceClass<ExpressionEngine, "@usine/expression/ExpressionEngine", ExpressionEngineService>;
|
|
49
|
+
/** Evaluates Loop conditions and prompt expressions against their declared payload context. */
|
|
11
50
|
export declare class ExpressionEngine extends ExpressionEngine_base {
|
|
12
51
|
}
|
|
13
|
-
export {};
|
|
52
|
+
export { TypeReference, ObjectField, ObjectType, Variable, Environment } from "./environment.ts";
|
|
14
53
|
//# sourceMappingURL=expression-engine.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"expression-engine.d.ts","sourceRoot":"","sources":["../src/expression-engine.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,KAAK,MAAM,EAAE,
|
|
1
|
+
{"version":3,"file":"expression-engine.d.ts","sourceRoot":"","sources":["../src/expression-engine.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,KAAK,MAAM,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AACtD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAEpD,iCAAiC;AACjC,eAAO,MAAM,MAAM,iDAEqB,CAAC;AACzC,MAAM,MAAM,MAAM,GAAG,OAAO,MAAM,CAAC,IAAI,CAAC;AAIxC,0FAA0F;AAC1F,eAAO,MAAM,cAAc,mGAKzB,CAAC;AACH,MAAM,MAAM,cAAc,GAAG,OAAO,cAAc,CAAC,IAAI,CAAC;;;;;;;AAExD,6FAA6F;AAC7F,qBAAa,oBAAqB,SAAQ,yBAOxC;CAAG;;;;;AAEL,mEAAmE;AACnE,qBAAa,yBAA0B,SAAQ,8BAK7C;CAAG;AAEL,qFAAqF;AACrF,eAAO,MAAM,eAAe,wFAAkE,CAAC;AAC/F,MAAM,MAAM,eAAe,GAAG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B,CAAC"}
|
|
@@ -1,4 +1,40 @@
|
|
|
1
|
-
import { Context } from "effect";
|
|
1
|
+
import { Context, Schema } from "effect";
|
|
2
|
+
/** Non-blank CEL source text. */
|
|
3
|
+
export const Source = Schema.String.check(Schema.isPattern(/\S/u, { message: "Expected a non-blank CEL expression" })).pipe(Schema.brand("ExpressionSource"));
|
|
4
|
+
const Position = Schema.Int.check(Schema.isGreaterThanOrEqualTo(0));
|
|
5
|
+
/** Whether checking failed during parsing, type resolution, or result-type validation. */
|
|
6
|
+
export const CheckErrorCode = Schema.Literals([
|
|
7
|
+
"check_failed",
|
|
8
|
+
"parse_error",
|
|
9
|
+
"type_error",
|
|
10
|
+
"unexpected_result_type",
|
|
11
|
+
]);
|
|
12
|
+
/** The expression failed to parse, to type-check, or to produce the expected result type. */
|
|
13
|
+
export class ExpressionCheckError extends Schema.TaggedError("@usine/expression/ExpressionCheckError")("ExpressionCheckError", {
|
|
14
|
+
source: Source,
|
|
15
|
+
code: CheckErrorCode,
|
|
16
|
+
message: Schema.NonEmptyString,
|
|
17
|
+
position: Schema.Option(Position),
|
|
18
|
+
}) {
|
|
19
|
+
}
|
|
20
|
+
/** Evaluation failed on an expression that had already checked. */
|
|
21
|
+
export class ExpressionEvaluationError extends Schema.TaggedError("@usine/expression/ExpressionEvaluationError")("ExpressionEvaluationError", {
|
|
22
|
+
source: Source,
|
|
23
|
+
message: Schema.NonEmptyString,
|
|
24
|
+
}) {
|
|
25
|
+
}
|
|
26
|
+
/** The failures callers can receive when checking or evaluating a CEL expression. */
|
|
27
|
+
export const ExpressionError = Schema.Union([ExpressionCheckError, ExpressionEvaluationError]);
|
|
28
|
+
/** Values prompt interpolation can render. CEL ints stay bigint. */
|
|
29
|
+
export const Scalar = Schema.Union([
|
|
30
|
+
Schema.String,
|
|
31
|
+
Schema.Number,
|
|
32
|
+
Schema.BigInt,
|
|
33
|
+
Schema.Boolean,
|
|
34
|
+
Schema.Null,
|
|
35
|
+
]);
|
|
36
|
+
/** Evaluates Loop conditions and prompt expressions against their declared payload context. */
|
|
2
37
|
export class ExpressionEngine extends Context.Service()("@usine/expression/ExpressionEngine") {
|
|
3
38
|
}
|
|
39
|
+
export { TypeReference, ObjectField, ObjectType, Variable, Environment } from "./environment.js";
|
|
4
40
|
//# sourceMappingURL=expression-engine.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"expression-engine.js","sourceRoot":"","sources":["../src/expression-engine.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,
|
|
1
|
+
{"version":3,"file":"expression-engine.js","sourceRoot":"","sources":["../src/expression-engine.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAe,MAAM,EAAE,MAAM,QAAQ,CAAC;AAGtD,iCAAiC;AACjC,MAAM,CAAC,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,KAAK,CACvC,MAAM,CAAC,SAAS,CAAC,KAAK,EAAE,EAAE,OAAO,EAAE,qCAAqC,EAAE,CAAC,CAC5E,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,kBAAkB,CAAC,CAAC,CAAC;AAGzC,MAAM,QAAQ,GAAG,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC,sBAAsB,CAAC,CAAC,CAAC,CAAC,CAAC;AAEpE,0FAA0F;AAC1F,MAAM,CAAC,MAAM,cAAc,GAAG,MAAM,CAAC,QAAQ,CAAC;IAC5C,cAAc;IACd,aAAa;IACb,YAAY;IACZ,wBAAwB;CACzB,CAAC,CAAC;AAGH,6FAA6F;AAC7F,MAAM,OAAO,oBAAqB,SAAQ,MAAM,CAAC,WAAW,CAC1D,wCAAwC,CACzC,CAAC,sBAAsB,EAAE;IACxB,MAAM,EAAE,MAAM;IACd,IAAI,EAAE,cAAc;IACpB,OAAO,EAAE,MAAM,CAAC,cAAc;IAC9B,QAAQ,EAAE,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC;CAClC,CAAC;CAAG;AAEL,mEAAmE;AACnE,MAAM,OAAO,yBAA0B,SAAQ,MAAM,CAAC,WAAW,CAC/D,6CAA6C,CAC9C,CAAC,2BAA2B,EAAE;IAC7B,MAAM,EAAE,MAAM;IACd,OAAO,EAAE,MAAM,CAAC,cAAc;CAC/B,CAAC;CAAG;AAEL,qFAAqF;AACrF,MAAM,CAAC,MAAM,eAAe,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,oBAAoB,EAAE,yBAAyB,CAAC,CAAC,CAAC;AAG/F,oEAAoE;AACpE,MAAM,CAAC,MAAM,MAAM,GAAG,MAAM,CAAC,KAAK,CAAC;IACjC,MAAM,CAAC,MAAM;IACb,MAAM,CAAC,MAAM;IACb,MAAM,CAAC,MAAM;IACb,MAAM,CAAC,OAAO;IACd,MAAM,CAAC,IAAI;CACZ,CAAC,CAAC;AAsCH,+FAA+F;AAC/F,MAAM,OAAO,gBAAiB,SAAQ,OAAO,CAAC,OAAO,EAA6C,CAChG,oCAAoC,CACrC;CAAG;AAEJ,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,UAAU,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Layer } from "effect";
|
|
2
2
|
import { ExpressionEngine } from "./expression-engine.ts";
|
|
3
|
-
/**
|
|
3
|
+
/** The ExpressionEngine implementation on @marcbachmann/cel-js. */
|
|
4
4
|
export declare const MarcbachmannCelLayer: Layer.Layer<ExpressionEngine, never, never>;
|
|
5
5
|
//# sourceMappingURL=marcbachmann-cel.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"marcbachmann-cel.d.ts","sourceRoot":"","sources":["../src/marcbachmann-cel.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"marcbachmann-cel.d.ts","sourceRoot":"","sources":["../src/marcbachmann-cel.ts"],"names":[],"mappings":"AAOA,OAAO,EAAU,KAAK,EAAkB,MAAM,QAAQ,CAAC;AAEvD,OAAO,EACL,gBAAgB,EAKjB,MAAM,wBAAwB,CAAC;AA6XhC,mEAAmE;AACnE,eAAO,MAAM,oBAAoB,6CAM/B,CAAC"}
|
package/dist/marcbachmann-cel.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { Environment as CelEnvironment, ParseError as CelParseError, TypeError as CelTypeError, } from "@marcbachmann/cel-js";
|
|
1
|
+
import { Environment as CelEnvironment, ParseError as CelParseError, TypeError as CelTypeError, parse, } from "@marcbachmann/cel-js";
|
|
2
2
|
import { Effect, Layer, Option, Schema } from "effect";
|
|
3
|
-
import {
|
|
4
|
-
import { ExpressionCheckError, ExpressionEvaluationError, Scalar,
|
|
3
|
+
import { TypeReference } from "./environment.js";
|
|
4
|
+
import { ExpressionEngine, ExpressionCheckError, ExpressionEvaluationError, Scalar, } from "./expression-engine.js";
|
|
5
5
|
const decodeTypeReference = Schema.decodeUnknownSync(TypeReference);
|
|
6
6
|
const acceptedScalarTypes = new Set([
|
|
7
7
|
"bool",
|
|
@@ -28,6 +28,152 @@ const checkFailure = (source, error) => error === undefined
|
|
|
28
28
|
message: error.message,
|
|
29
29
|
position: Option.fromNullishOr(error.range?.start),
|
|
30
30
|
});
|
|
31
|
+
const childNodes = (node) => {
|
|
32
|
+
switch (node.op) {
|
|
33
|
+
case "value":
|
|
34
|
+
case "id":
|
|
35
|
+
return [];
|
|
36
|
+
case ".":
|
|
37
|
+
case ".?":
|
|
38
|
+
return [node.args[0]];
|
|
39
|
+
case "!_":
|
|
40
|
+
case "-_":
|
|
41
|
+
return [node.args];
|
|
42
|
+
case "call":
|
|
43
|
+
return node.args[1];
|
|
44
|
+
case "rcall":
|
|
45
|
+
return [node.args[1], ...node.args[2]];
|
|
46
|
+
case "list":
|
|
47
|
+
return node.args;
|
|
48
|
+
case "map":
|
|
49
|
+
return node.args.flatMap(([key, value]) => [key, value]);
|
|
50
|
+
default:
|
|
51
|
+
return node.args;
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
const pathOf = (node) => {
|
|
55
|
+
if (node.op === "id")
|
|
56
|
+
return [node.args];
|
|
57
|
+
if (node.op !== "." && node.op !== ".?")
|
|
58
|
+
return undefined;
|
|
59
|
+
const parent = pathOf(node.args[0]);
|
|
60
|
+
return parent === undefined ? undefined : [...parent, node.args[1]];
|
|
61
|
+
};
|
|
62
|
+
const decodeStringLiteral = Schema.decodeUnknownOption(Schema.String);
|
|
63
|
+
const MACROS_WITH_BINDINGS = new Set([
|
|
64
|
+
"all",
|
|
65
|
+
"exists",
|
|
66
|
+
"exists_one",
|
|
67
|
+
"filter",
|
|
68
|
+
"map",
|
|
69
|
+
]);
|
|
70
|
+
/** The member path a node reads from, followed back through macro bindings and collection transformations. */
|
|
71
|
+
const lineagePathOf = (node, bindings) => {
|
|
72
|
+
const path = pathOf(node);
|
|
73
|
+
if (path !== undefined) {
|
|
74
|
+
const boundPath = bindings.get(path[0]);
|
|
75
|
+
return boundPath === undefined ? path : [...boundPath, ...path.slice(1)];
|
|
76
|
+
}
|
|
77
|
+
if (node.op !== "rcall")
|
|
78
|
+
return undefined;
|
|
79
|
+
const [macro, receiver, args] = node.args;
|
|
80
|
+
const receiverPath = lineagePathOf(receiver, bindings);
|
|
81
|
+
if (receiverPath === undefined)
|
|
82
|
+
return undefined;
|
|
83
|
+
if (macro === "filter")
|
|
84
|
+
return receiverPath;
|
|
85
|
+
if (macro !== "map")
|
|
86
|
+
return undefined;
|
|
87
|
+
const [binding, ...body] = args;
|
|
88
|
+
const projection = body[body.length - 1];
|
|
89
|
+
if (binding?.op !== "id" || projection === undefined)
|
|
90
|
+
return undefined;
|
|
91
|
+
return lineagePathOf(projection, new Map(bindings).set(binding.args, receiverPath));
|
|
92
|
+
};
|
|
93
|
+
const startsWithPath = (path, prefix) => prefix.every((part, index) => path[index] === part);
|
|
94
|
+
/**
|
|
95
|
+
* The string literals an operand can evaluate to. Only result positions count:
|
|
96
|
+
* a conditional contributes its branches and not its test, a list its
|
|
97
|
+
* elements. `item.state == "OPEN" ? "ready" : "review"` yields the two labels
|
|
98
|
+
* and not the state.
|
|
99
|
+
*/
|
|
100
|
+
const resultStringLiterals = (node) => {
|
|
101
|
+
switch (node.op) {
|
|
102
|
+
case "value":
|
|
103
|
+
return Option.match(decodeStringLiteral(node.args), {
|
|
104
|
+
onNone: () => [],
|
|
105
|
+
onSome: (literal) => [literal],
|
|
106
|
+
});
|
|
107
|
+
case "?:": {
|
|
108
|
+
const [, whenTrue, whenFalse] = node.args;
|
|
109
|
+
return [...resultStringLiterals(whenTrue), ...resultStringLiterals(whenFalse)];
|
|
110
|
+
}
|
|
111
|
+
case "list":
|
|
112
|
+
return node.args.flatMap(resultStringLiterals);
|
|
113
|
+
default:
|
|
114
|
+
return [];
|
|
115
|
+
}
|
|
116
|
+
};
|
|
117
|
+
const isRelatedName = (node, memberPath, bindings) => {
|
|
118
|
+
const path = lineagePathOf(node, bindings);
|
|
119
|
+
return path !== undefined && startsWithPath(path, memberPath) && path[path.length - 1] === "name";
|
|
120
|
+
};
|
|
121
|
+
const comparisonLiterals = (node, memberPath, bindings) => {
|
|
122
|
+
switch (node.op) {
|
|
123
|
+
case "!=":
|
|
124
|
+
case "==":
|
|
125
|
+
case "in": {
|
|
126
|
+
const [left, right] = node.args;
|
|
127
|
+
return [
|
|
128
|
+
...(isRelatedName(left, memberPath, bindings) ? resultStringLiterals(right) : []),
|
|
129
|
+
...(isRelatedName(right, memberPath, bindings) ? resultStringLiterals(left) : []),
|
|
130
|
+
];
|
|
131
|
+
}
|
|
132
|
+
default:
|
|
133
|
+
return [];
|
|
134
|
+
}
|
|
135
|
+
};
|
|
136
|
+
/** Collects the literals compared against `name` on members bound by macros over the watched collection. */
|
|
137
|
+
const scanRelatedLiterals = (node, memberPath, bindings) => {
|
|
138
|
+
const related = comparisonLiterals(node, memberPath, bindings);
|
|
139
|
+
if (node.op !== "rcall" || !MACROS_WITH_BINDINGS.has(node.args[0])) {
|
|
140
|
+
return [
|
|
141
|
+
...related,
|
|
142
|
+
...childNodes(node).flatMap((child) => scanRelatedLiterals(child, memberPath, bindings)),
|
|
143
|
+
];
|
|
144
|
+
}
|
|
145
|
+
const [, receiver, args] = node.args;
|
|
146
|
+
const [binding, ...body] = args;
|
|
147
|
+
const receiverPath = lineagePathOf(receiver, bindings);
|
|
148
|
+
if (binding?.op !== "id" || receiverPath === undefined) {
|
|
149
|
+
return [
|
|
150
|
+
...related,
|
|
151
|
+
...childNodes(node).flatMap((child) => scanRelatedLiterals(child, memberPath, bindings)),
|
|
152
|
+
];
|
|
153
|
+
}
|
|
154
|
+
const bodyBindings = new Map(bindings).set(binding.args, receiverPath);
|
|
155
|
+
return [
|
|
156
|
+
...related,
|
|
157
|
+
...scanRelatedLiterals(receiver, memberPath, bindings),
|
|
158
|
+
...body.flatMap((child) => scanRelatedLiterals(child, memberPath, bodyBindings)),
|
|
159
|
+
];
|
|
160
|
+
};
|
|
161
|
+
const relatedStringLiterals = Effect.fn("ExpressionEngine.relatedStringLiterals")(function* (source, memberPath) {
|
|
162
|
+
if (memberPath.length === 0)
|
|
163
|
+
return [];
|
|
164
|
+
const ast = yield* Effect.try({
|
|
165
|
+
try: () => parse(source).ast,
|
|
166
|
+
catch: (cause) => cause instanceof CelParseError
|
|
167
|
+
? checkFailure(source, cause)
|
|
168
|
+
: new ExpressionCheckError({
|
|
169
|
+
source,
|
|
170
|
+
code: "check_failed",
|
|
171
|
+
message: messageFromCause(cause, "CEL analysis failed"),
|
|
172
|
+
position: Option.none(),
|
|
173
|
+
}),
|
|
174
|
+
});
|
|
175
|
+
return [...new Set(scanRelatedLiterals(ast, memberPath, new Map()))];
|
|
176
|
+
});
|
|
31
177
|
const makeEnvironment = (descriptor) => {
|
|
32
178
|
const environment = new CelEnvironment({ unlistedVariablesAreDyn: false });
|
|
33
179
|
for (const objectType of descriptor.types) {
|
|
@@ -96,9 +242,8 @@ const checkExpected = (source, environment, accepts, expected) => Effect.gen(fun
|
|
|
96
242
|
});
|
|
97
243
|
const evaluateRaw = (source, environment, context) => Effect.try({
|
|
98
244
|
try: () =>
|
|
99
|
-
// SAFETY: CEL
|
|
100
|
-
//
|
|
101
|
-
// before anything leaves the seam.
|
|
245
|
+
// SAFETY: CEL evaluates to the same value vocabulary the context is built
|
|
246
|
+
// from, and every caller decodes the expected result type before use.
|
|
102
247
|
makeEnvironment(environment).evaluate(source, normalizeContext(context, environment)),
|
|
103
248
|
catch: (cause) => new ExpressionEvaluationError({
|
|
104
249
|
source,
|
|
@@ -123,8 +268,9 @@ const evaluateScalar = Effect.fn("ExpressionEngine.evaluateScalar")(function* (s
|
|
|
123
268
|
const value = yield* evaluateRaw(source, environment, context);
|
|
124
269
|
return yield* decodeScalar(value).pipe(Effect.mapError(unexpectedResult(source, "a scalar value")));
|
|
125
270
|
});
|
|
126
|
-
/**
|
|
271
|
+
/** The ExpressionEngine implementation on @marcbachmann/cel-js. */
|
|
127
272
|
export const MarcbachmannCelLayer = Layer.succeed(ExpressionEngine, {
|
|
273
|
+
relatedStringLiterals,
|
|
128
274
|
checkBoolean,
|
|
129
275
|
checkScalar,
|
|
130
276
|
evaluateBoolean,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"marcbachmann-cel.js","sourceRoot":"","sources":["../src/marcbachmann-cel.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,WAAW,IAAI,cAAc,EAC7B,UAAU,IAAI,aAAa,EAC3B,SAAS,IAAI,YAAY,GAC1B,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AACvD,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,EAEL,oBAAoB,EACpB,yBAAyB,EAEzB,MAAM,EAEN,aAAa,GACd,MAAM,YAAY,CAAC;AAEpB,MAAM,mBAAmB,GAAG,MAAM,CAAC,iBAAiB,CAAC,aAAa,CA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AC3E,MAAc,EACd,WAAwB,EACxB,OAA0B;IAE1B,KAAK,CAAC,CAAC,WAAW,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;IACxC,MAAM,KAAK,GAAG,KAAK,CAAC,CAAC,WAAW,CAAC,MAAM,EAAE,WAAW,EAAE,OAAO,CAAC,CAAC;IAC/D,OAAO,KAAK,CAAC,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC,IAAI,CACpC,MAAM,CAAC,QAAQ,CAAC,gBAAgB,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAC,CAC5D,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,mEAAmE;AACnE,MAAM,CAAC,MAAM,oBAAoB,GAAG,KAAK,CAAC,OAAO,CAAC,gBAAgB,EAAE;IAClE,qBAAqB;IACrB,YAAY;IACZ,WAAW;IACX,eAAe;IACf,cAAc;CACf,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@usine/expression",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "CEL expression seam for usine: check and evaluate the selection expressions loop files use.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -14,9 +14,13 @@
|
|
|
14
14
|
"type": "module",
|
|
15
15
|
"sideEffects": false,
|
|
16
16
|
"exports": {
|
|
17
|
-
"
|
|
18
|
-
"types": "./dist/
|
|
19
|
-
"default": "./dist/
|
|
17
|
+
"./expression-engine": {
|
|
18
|
+
"types": "./dist/expression-engine.d.ts",
|
|
19
|
+
"default": "./dist/expression-engine.js"
|
|
20
|
+
},
|
|
21
|
+
"./marcbachmann-cel": {
|
|
22
|
+
"types": "./dist/marcbachmann-cel.d.ts",
|
|
23
|
+
"default": "./dist/marcbachmann-cel.js"
|
|
20
24
|
}
|
|
21
25
|
},
|
|
22
26
|
"publishConfig": {
|
package/dist/index.d.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @usine/expression — a vendor-neutral CEL check/evaluation seam. The live
|
|
3
|
-
* layer exact-pins @marcbachmann/cel-js; callers depend only on CEL types and
|
|
4
|
-
* typed Effect failures, so another backend can implement the service.
|
|
5
|
-
*/
|
|
6
|
-
export * from "./expression-engine.ts";
|
|
7
|
-
export * from "./marcbachmann-cel.ts";
|
|
8
|
-
export * from "./model.ts";
|
|
9
|
-
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,cAAc,wBAAwB,CAAC;AACvC,cAAc,uBAAuB,CAAC;AACtC,cAAc,YAAY,CAAC"}
|
package/dist/index.js
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @usine/expression — a vendor-neutral CEL check/evaluation seam. The live
|
|
3
|
-
* layer exact-pins @marcbachmann/cel-js; callers depend only on CEL types and
|
|
4
|
-
* typed Effect failures, so another backend can implement the service.
|
|
5
|
-
*/
|
|
6
|
-
export * from "./expression-engine.js";
|
|
7
|
-
export * from "./marcbachmann-cel.js";
|
|
8
|
-
export * from "./model.js";
|
|
9
|
-
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,cAAc,wBAAwB,CAAC;AACvC,cAAc,uBAAuB,CAAC;AACtC,cAAc,YAAY,CAAC"}
|
package/dist/model.d.ts
DELETED
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
import { Schema } from "effect";
|
|
2
|
-
/** CEL source accepted at the config boundary. */
|
|
3
|
-
export declare const Source: Schema.brand<Schema.String, "ExpressionSource">;
|
|
4
|
-
export type Source = typeof Source.Type;
|
|
5
|
-
/** A CEL-spec type reference such as `string`, `Issue`, or `list<Label>`. */
|
|
6
|
-
export declare const TypeReference: Schema.brand<Schema.String, "CelTypeReference">;
|
|
7
|
-
export type TypeReference = typeof TypeReference.Type;
|
|
8
|
-
declare const ObjectField_base: Schema.Class<ObjectField, Schema.Struct<{
|
|
9
|
-
readonly name: Schema.String;
|
|
10
|
-
readonly type: Schema.brand<Schema.String, "CelTypeReference">;
|
|
11
|
-
}>, {}>;
|
|
12
|
-
/** One field in a backend-neutral CEL object-type declaration. */
|
|
13
|
-
export declare class ObjectField extends ObjectField_base {
|
|
14
|
-
}
|
|
15
|
-
declare const ObjectType_base: Schema.Class<ObjectType, Schema.Struct<{
|
|
16
|
-
readonly name: Schema.String;
|
|
17
|
-
readonly fields: Schema.$Array<typeof ObjectField>;
|
|
18
|
-
}>, {}>;
|
|
19
|
-
/** A CEL object type. Types are registered in declaration order. */
|
|
20
|
-
export declare class ObjectType extends ObjectType_base {
|
|
21
|
-
}
|
|
22
|
-
declare const Variable_base: Schema.Class<Variable, Schema.Struct<{
|
|
23
|
-
readonly name: Schema.String;
|
|
24
|
-
readonly type: Schema.brand<Schema.String, "CelTypeReference">;
|
|
25
|
-
}>, {}>;
|
|
26
|
-
/** One root variable available to a CEL expression. */
|
|
27
|
-
export declare class Variable extends Variable_base {
|
|
28
|
-
}
|
|
29
|
-
declare const Environment_base: Schema.Class<Environment, Schema.Struct<{
|
|
30
|
-
readonly types: Schema.$Array<typeof ObjectType>;
|
|
31
|
-
readonly variables: Schema.$Array<typeof Variable>;
|
|
32
|
-
}>, {}>;
|
|
33
|
-
/** The checked namespace for one expression family, expressed in CEL's type vocabulary. */
|
|
34
|
-
export declare class Environment extends Environment_base {
|
|
35
|
-
}
|
|
36
|
-
export declare const CheckErrorCode: Schema.Literals<readonly ["check_failed", "parse_error", "type_error", "unexpected_result_type"]>;
|
|
37
|
-
export type CheckErrorCode = typeof CheckErrorCode.Type;
|
|
38
|
-
declare const ExpressionCheckError_base: Schema.Class<ExpressionCheckError, Schema.TaggedStruct<"ExpressionCheckError", {
|
|
39
|
-
readonly source: Schema.brand<Schema.String, "ExpressionSource">;
|
|
40
|
-
readonly code: Schema.Literals<readonly ["check_failed", "parse_error", "type_error", "unexpected_result_type"]>;
|
|
41
|
-
readonly message: Schema.NonEmptyString;
|
|
42
|
-
readonly position: Schema.Option<Schema.Int>;
|
|
43
|
-
}>, import("effect/Cause").YieldableError>;
|
|
44
|
-
/** Typed failure from CEL parsing, type checking, or expected-result checking. */
|
|
45
|
-
export declare class ExpressionCheckError extends ExpressionCheckError_base {
|
|
46
|
-
}
|
|
47
|
-
declare const ExpressionEvaluationError_base: Schema.Class<ExpressionEvaluationError, Schema.TaggedStruct<"ExpressionEvaluationError", {
|
|
48
|
-
readonly source: Schema.brand<Schema.String, "ExpressionSource">;
|
|
49
|
-
readonly message: Schema.NonEmptyString;
|
|
50
|
-
}>, import("effect/Cause").YieldableError>;
|
|
51
|
-
/** Typed failure from evaluating an expression that previously checked. */
|
|
52
|
-
export declare class ExpressionEvaluationError extends ExpressionEvaluationError_base {
|
|
53
|
-
}
|
|
54
|
-
/** Every failure mode this package's service can produce. */
|
|
55
|
-
export declare const ExpressionError: Schema.Union<readonly [typeof ExpressionCheckError, typeof ExpressionEvaluationError]>;
|
|
56
|
-
export type ExpressionError = typeof ExpressionError.Type;
|
|
57
|
-
/** Values admitted by prompt interpolation. CEL ints deliberately remain bigint here. */
|
|
58
|
-
export declare const Scalar: Schema.Union<readonly [Schema.String, Schema.Number, Schema.BigInt, Schema.Boolean, Schema.Null]>;
|
|
59
|
-
export type Scalar = typeof Scalar.Type;
|
|
60
|
-
export {};
|
|
61
|
-
//# sourceMappingURL=model.d.ts.map
|
package/dist/model.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"model.d.ts","sourceRoot":"","sources":["../src/model.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAEhC,kDAAkD;AAClD,eAAO,MAAM,MAAM,iDAEqB,CAAC;AACzC,MAAM,MAAM,MAAM,GAAG,OAAO,MAAM,CAAC,IAAI,CAAC;AAExC,6EAA6E;AAC7E,eAAO,MAAM,aAAa,iDAKc,CAAC;AACzC,MAAM,MAAM,aAAa,GAAG,OAAO,aAAa,CAAC,IAAI,CAAC;;;;;AAkBtD,kEAAkE;AAClE,qBAAa,WAAY,SAAQ,gBAG/B;CAAG;;;;;AAEL,oEAAoE;AACpE,qBAAa,UAAW,SAAQ,eAG9B;CAAG;;;;;AAEL,uDAAuD;AACvD,qBAAa,QAAS,SAAQ,aAG5B;CAAG;;;;;AAEL,2FAA2F;AAC3F,qBAAa,WAAY,SAAQ,gBAG/B;CAAG;AAIL,eAAO,MAAM,cAAc,mGAKzB,CAAC;AACH,MAAM,MAAM,cAAc,GAAG,OAAO,cAAc,CAAC,IAAI,CAAC;;;;;;;AAExD,kFAAkF;AAClF,qBAAa,oBAAqB,SAAQ,yBAOxC;CAAG;;;;;AAEL,2EAA2E;AAC3E,qBAAa,yBAA0B,SAAQ,8BAK7C;CAAG;AAEL,6DAA6D;AAC7D,eAAO,MAAM,eAAe,wFAAkE,CAAC;AAC/F,MAAM,MAAM,eAAe,GAAG,OAAO,eAAe,CAAC,IAAI,CAAC;AAE1D,yFAAyF;AACzF,eAAO,MAAM,MAAM,mGAMjB,CAAC;AACH,MAAM,MAAM,MAAM,GAAG,OAAO,MAAM,CAAC,IAAI,CAAC"}
|
package/dist/model.js
DELETED
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
import { Schema } from "effect";
|
|
2
|
-
/** CEL source accepted at the config boundary. */
|
|
3
|
-
export const Source = Schema.String.check(Schema.isPattern(/\S/u, { message: "Expected a non-blank CEL expression" })).pipe(Schema.brand("ExpressionSource"));
|
|
4
|
-
/** A CEL-spec type reference such as `string`, `Issue`, or `list<Label>`. */
|
|
5
|
-
export const TypeReference = Schema.String.check(Schema.isPattern(/^(?:[A-Za-z_][A-Za-z0-9_.]*|list<[A-Za-z_][A-Za-z0-9_.]*>|map<[A-Za-z_][A-Za-z0-9_.]*,[A-Za-z_][A-Za-z0-9_.]*>)$/u, { message: "Expected a CEL type reference" })).pipe(Schema.brand("CelTypeReference"));
|
|
6
|
-
const Identifier = Schema.String.check(Schema.isPattern(/^[A-Za-z_][A-Za-z0-9_]*$/u, { message: "Expected a CEL identifier" }));
|
|
7
|
-
const ObjectTypeName = Schema.String.check(Schema.isPattern(/^[A-Za-z_][A-Za-z0-9_.]*$/u, {
|
|
8
|
-
message: "Expected a CEL object-type name",
|
|
9
|
-
}));
|
|
10
|
-
const uniqueNames = (message) => Schema.makeFilter((values) => new Set(values.map(({ name }) => name)).size === values.length, { message });
|
|
11
|
-
/** One field in a backend-neutral CEL object-type declaration. */
|
|
12
|
-
export class ObjectField extends Schema.Class("@usine/expression/ObjectField")({
|
|
13
|
-
name: Identifier,
|
|
14
|
-
type: TypeReference,
|
|
15
|
-
}) {
|
|
16
|
-
}
|
|
17
|
-
/** A CEL object type. Types are registered in declaration order. */
|
|
18
|
-
export class ObjectType extends Schema.Class("@usine/expression/ObjectType")({
|
|
19
|
-
name: ObjectTypeName,
|
|
20
|
-
fields: Schema.Array(ObjectField).check(uniqueNames("Expected unique CEL object-field names")),
|
|
21
|
-
}) {
|
|
22
|
-
}
|
|
23
|
-
/** One root variable available to a CEL expression. */
|
|
24
|
-
export class Variable extends Schema.Class("@usine/expression/Variable")({
|
|
25
|
-
name: Identifier,
|
|
26
|
-
type: TypeReference,
|
|
27
|
-
}) {
|
|
28
|
-
}
|
|
29
|
-
/** The checked namespace for one expression family, expressed in CEL's type vocabulary. */
|
|
30
|
-
export class Environment extends Schema.Class("@usine/expression/Environment")({
|
|
31
|
-
types: Schema.Array(ObjectType).check(uniqueNames("Expected unique CEL object-type names")),
|
|
32
|
-
variables: Schema.Array(Variable).check(uniqueNames("Expected unique CEL variable names")),
|
|
33
|
-
}) {
|
|
34
|
-
}
|
|
35
|
-
const Position = Schema.Int.check(Schema.isGreaterThanOrEqualTo(0));
|
|
36
|
-
export const CheckErrorCode = Schema.Literals([
|
|
37
|
-
"check_failed",
|
|
38
|
-
"parse_error",
|
|
39
|
-
"type_error",
|
|
40
|
-
"unexpected_result_type",
|
|
41
|
-
]);
|
|
42
|
-
/** Typed failure from CEL parsing, type checking, or expected-result checking. */
|
|
43
|
-
export class ExpressionCheckError extends Schema.TaggedError("@usine/expression/ExpressionCheckError")("ExpressionCheckError", {
|
|
44
|
-
source: Source,
|
|
45
|
-
code: CheckErrorCode,
|
|
46
|
-
message: Schema.NonEmptyString,
|
|
47
|
-
position: Schema.Option(Position),
|
|
48
|
-
}) {
|
|
49
|
-
}
|
|
50
|
-
/** Typed failure from evaluating an expression that previously checked. */
|
|
51
|
-
export class ExpressionEvaluationError extends Schema.TaggedError("@usine/expression/ExpressionEvaluationError")("ExpressionEvaluationError", {
|
|
52
|
-
source: Source,
|
|
53
|
-
message: Schema.NonEmptyString,
|
|
54
|
-
}) {
|
|
55
|
-
}
|
|
56
|
-
/** Every failure mode this package's service can produce. */
|
|
57
|
-
export const ExpressionError = Schema.Union([ExpressionCheckError, ExpressionEvaluationError]);
|
|
58
|
-
/** Values admitted by prompt interpolation. CEL ints deliberately remain bigint here. */
|
|
59
|
-
export const Scalar = Schema.Union([
|
|
60
|
-
Schema.String,
|
|
61
|
-
Schema.Number,
|
|
62
|
-
Schema.BigInt,
|
|
63
|
-
Schema.Boolean,
|
|
64
|
-
Schema.Null,
|
|
65
|
-
]);
|
|
66
|
-
//# sourceMappingURL=model.js.map
|
package/dist/model.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"model.js","sourceRoot":"","sources":["../src/model.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAEhC,kDAAkD;AAClD,MAAM,CAAC,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC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