@telorun/sdk 0.19.0 → 0.23.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/dist/compiled-value.d.ts +18 -0
- package/dist/compiled-value.d.ts.map +1 -1
- package/dist/compiled-value.js +3 -0
- package/dist/evaluation-context.d.ts +1 -0
- package/dist/evaluation-context.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/compiled-value.ts +24 -0
- package/src/evaluation-context.ts +9 -1
package/dist/compiled-value.d.ts
CHANGED
|
@@ -5,7 +5,25 @@ export interface CompiledValue {
|
|
|
5
5
|
readonly __compiled: true;
|
|
6
6
|
/** Original expression source text (e.g. "env.PORT"), if available. */
|
|
7
7
|
readonly source?: string;
|
|
8
|
+
/** For an interpolated string ("a ${{ x }} b"), the ordered literal
|
|
9
|
+
* fragments and embedded expression segments before they are joined into a
|
|
10
|
+
* single string by `call()`. Absent for a bare single expression. Consumers
|
|
11
|
+
* that need each interpolation as a separate value (e.g. SQL bind
|
|
12
|
+
* parameters) read this instead of the joined `call()` result. */
|
|
13
|
+
readonly parts?: ReadonlyArray<string | CompiledValue>;
|
|
8
14
|
call(ctx: Record<string, unknown>): unknown;
|
|
9
15
|
}
|
|
10
16
|
export declare function isCompiledValue(v: unknown): v is CompiledValue;
|
|
17
|
+
/** The value a parameterized template (the `!sql` engine) evaluates to: literal
|
|
18
|
+
* text fragments plus the separately-evaluated value of each embedded `${{ }}`
|
|
19
|
+
* interpolation, with `fragments.length === values.length + 1`. A consumer emits
|
|
20
|
+
* its own placeholder between fragments and binds the values — never splicing
|
|
21
|
+
* them into the text. Single source of truth for the marker contract shared
|
|
22
|
+
* across the producing engine and any consuming controller. */
|
|
23
|
+
export interface ParameterizedSql {
|
|
24
|
+
readonly __teloParameterized: true;
|
|
25
|
+
readonly fragments: string[];
|
|
26
|
+
readonly values: unknown[];
|
|
27
|
+
}
|
|
28
|
+
export declare function isParameterizedSql(v: unknown): v is ParameterizedSql;
|
|
11
29
|
//# sourceMappingURL=compiled-value.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compiled-value.d.ts","sourceRoot":"","sources":["../src/compiled-value.ts"],"names":[],"mappings":"AAAA;;+DAE+D;AAC/D,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,UAAU,EAAE,IAAI,CAAC;IAC1B,uEAAuE;IACvE,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IACzB,IAAI,CAAC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC;CAC7C;AAED,wBAAgB,eAAe,CAAC,CAAC,EAAE,OAAO,GAAG,CAAC,IAAI,aAAa,CAE9D"}
|
|
1
|
+
{"version":3,"file":"compiled-value.d.ts","sourceRoot":"","sources":["../src/compiled-value.ts"],"names":[],"mappings":"AAAA;;+DAE+D;AAC/D,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,UAAU,EAAE,IAAI,CAAC;IAC1B,uEAAuE;IACvE,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IACzB;;;;uEAImE;IACnE,QAAQ,CAAC,KAAK,CAAC,EAAE,aAAa,CAAC,MAAM,GAAG,aAAa,CAAC,CAAC;IACvD,IAAI,CAAC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC;CAC7C;AAED,wBAAgB,eAAe,CAAC,CAAC,EAAE,OAAO,GAAG,CAAC,IAAI,aAAa,CAE9D;AAED;;;;;gEAKgE;AAChE,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,mBAAmB,EAAE,IAAI,CAAC;IACnC,QAAQ,CAAC,SAAS,EAAE,MAAM,EAAE,CAAC;IAC7B,QAAQ,CAAC,MAAM,EAAE,OAAO,EAAE,CAAC;CAC5B;AAED,wBAAgB,kBAAkB,CAAC,CAAC,EAAE,OAAO,GAAG,CAAC,IAAI,gBAAgB,CAIpE"}
|
package/dist/compiled-value.js
CHANGED
|
@@ -13,6 +13,7 @@ export type LifecycleState = "Pending" | "Validated" | "Initialized" | "Draining
|
|
|
13
13
|
export type CreatedResource = {
|
|
14
14
|
instance: ResourceInstance;
|
|
15
15
|
ctx: any;
|
|
16
|
+
resource: ResourceManifest;
|
|
16
17
|
};
|
|
17
18
|
/**
|
|
18
19
|
* Creates a ResourceInstance for the given manifest, or returns null if not yet
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"evaluation-context.d.ts","sourceRoot":"","sources":["../src/evaluation-context.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AACvD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAC5C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC/D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC/D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAErD,MAAM,MAAM,SAAS,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,GAAG,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;AAE/E,qEAAqE;AACrE,MAAM,MAAM,cAAc,GAAG,SAAS,GAAG,WAAW,GAAG,aAAa,GAAG,UAAU,GAAG,UAAU,CAAC;AAE/F;;;GAGG;AACH,MAAM,MAAM,eAAe,GAAG;
|
|
1
|
+
{"version":3,"file":"evaluation-context.d.ts","sourceRoot":"","sources":["../src/evaluation-context.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AACvD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAC5C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC/D,OAAO,KAAK,EAAE,gBAAgB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OAAO,EACpB,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,gBAAgB,EAC1B,MAAM,EAAE,OAAO,EACf,GAAG,CAAC,EAAE,aAAa,GAClB,OAAO,CAAC,GAAG,CAAC,CAAC;IAChB,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,CAAC,EAAE,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACtD,MAAM,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAAC;IAChC,UAAU,CAAC,KAAK,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC;IAC3E,WAAW,CACT,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC9B,KAAK,EAAE,MAAM,EAAE,EACf,YAAY,CAAC,EAAE,MAAM,EAAE,GACtB,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAC5B"}
|
package/package.json
CHANGED
package/src/compiled-value.ts
CHANGED
|
@@ -5,9 +5,33 @@ export interface CompiledValue {
|
|
|
5
5
|
readonly __compiled: true;
|
|
6
6
|
/** Original expression source text (e.g. "env.PORT"), if available. */
|
|
7
7
|
readonly source?: string;
|
|
8
|
+
/** For an interpolated string ("a ${{ x }} b"), the ordered literal
|
|
9
|
+
* fragments and embedded expression segments before they are joined into a
|
|
10
|
+
* single string by `call()`. Absent for a bare single expression. Consumers
|
|
11
|
+
* that need each interpolation as a separate value (e.g. SQL bind
|
|
12
|
+
* parameters) read this instead of the joined `call()` result. */
|
|
13
|
+
readonly parts?: ReadonlyArray<string | CompiledValue>;
|
|
8
14
|
call(ctx: Record<string, unknown>): unknown;
|
|
9
15
|
}
|
|
10
16
|
|
|
11
17
|
export function isCompiledValue(v: unknown): v is CompiledValue {
|
|
12
18
|
return v !== null && typeof v === "object" && (v as any).__compiled === true;
|
|
13
19
|
}
|
|
20
|
+
|
|
21
|
+
/** The value a parameterized template (the `!sql` engine) evaluates to: literal
|
|
22
|
+
* text fragments plus the separately-evaluated value of each embedded `${{ }}`
|
|
23
|
+
* interpolation, with `fragments.length === values.length + 1`. A consumer emits
|
|
24
|
+
* its own placeholder between fragments and binds the values — never splicing
|
|
25
|
+
* them into the text. Single source of truth for the marker contract shared
|
|
26
|
+
* across the producing engine and any consuming controller. */
|
|
27
|
+
export interface ParameterizedSql {
|
|
28
|
+
readonly __teloParameterized: true;
|
|
29
|
+
readonly fragments: string[];
|
|
30
|
+
readonly values: unknown[];
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export function isParameterizedSql(v: unknown): v is ParameterizedSql {
|
|
34
|
+
return (
|
|
35
|
+
v !== null && typeof v === "object" && (v as any).__teloParameterized === true
|
|
36
|
+
);
|
|
37
|
+
}
|
|
@@ -13,7 +13,15 @@ export type LifecycleState = "Pending" | "Validated" | "Initialized" | "Draining
|
|
|
13
13
|
* Result of the create phase: the instance and its bound ResourceContext.
|
|
14
14
|
* The ctx is typed as any to avoid a circular import with resource-context.ts.
|
|
15
15
|
*/
|
|
16
|
-
export type CreatedResource = {
|
|
16
|
+
export type CreatedResource = {
|
|
17
|
+
instance: ResourceInstance;
|
|
18
|
+
ctx: any;
|
|
19
|
+
// The resource manifest the controller was actually created with. When the factory
|
|
20
|
+
// expands compile-time CEL fields it hands the controller an expanded clone; returning
|
|
21
|
+
// it here lets initializeResources inject live instances (preInitHook) into THAT object
|
|
22
|
+
// — the one the controller reads — instead of the pre-expansion original.
|
|
23
|
+
resource: ResourceManifest;
|
|
24
|
+
};
|
|
17
25
|
|
|
18
26
|
/**
|
|
19
27
|
* Creates a ResourceInstance for the given manifest, or returns null if not yet
|