@telorun/sdk 0.77.0 → 0.80.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/cancellation.d.ts +50 -1
- package/dist/cancellation.d.ts.map +1 -1
- package/dist/contract-errors.d.ts +8 -1
- package/dist/contract-errors.d.ts.map +1 -1
- package/dist/contract-errors.js +8 -0
- package/dist/durable-run.d.ts +310 -0
- package/dist/durable-run.d.ts.map +1 -0
- package/dist/durable-run.js +223 -0
- package/dist/durable-suspension.d.ts +143 -0
- package/dist/durable-suspension.d.ts.map +1 -0
- package/dist/durable-suspension.js +153 -0
- package/dist/durable-target-encoding.d.ts +49 -0
- package/dist/durable-target-encoding.d.ts.map +1 -0
- package/dist/durable-target-encoding.js +121 -0
- package/dist/duration.d.ts +1 -1
- package/dist/duration.js +5 -5
- package/dist/evaluation-context.d.ts +16 -0
- package/dist/evaluation-context.d.ts.map +1 -1
- package/dist/index.d.ts +5 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -0
- package/dist/invoke-step.d.ts +86 -1
- package/dist/invoke-step.d.ts.map +1 -1
- package/dist/invoke-step.js +261 -18
- package/dist/resource-context.d.ts +37 -0
- package/dist/resource-context.d.ts.map +1 -1
- package/dist/resource-instance.d.ts +21 -1
- package/dist/resource-instance.d.ts.map +1 -1
- package/dist/resource-instance.js +6 -2
- package/dist/step-engine.d.ts +170 -0
- package/dist/step-engine.d.ts.map +1 -0
- package/dist/step-engine.js +365 -0
- package/dist/zone-attribute.d.ts +101 -0
- package/dist/zone-attribute.d.ts.map +1 -0
- package/dist/zone-attribute.js +130 -0
- package/dist/zone-attributes/entries/atomic.json +7 -0
- package/dist/zone-attributes/entries/idempotent.json +6 -0
- package/dist/zone-attributes/entries/index.d.ts +3 -0
- package/dist/zone-attributes/entries/index.d.ts.map +1 -0
- package/dist/zone-attributes/entries/index.js +13 -0
- package/dist/zone-attributes/entries/no-suspend.json +6 -0
- package/dist/zone-attributes/entries/replayed.json +6 -0
- package/package.json +1 -1
- package/src/cancellation.ts +50 -1
- package/src/contract-errors.ts +9 -0
- package/src/durable-run.ts +450 -0
- package/src/durable-suspension.ts +188 -0
- package/src/durable-target-encoding.ts +181 -0
- package/src/duration.ts +5 -5
- package/src/evaluation-context.ts +17 -0
- package/src/index.ts +5 -1
- package/src/invoke-step.ts +378 -24
- package/src/resource-context.ts +37 -0
- package/src/resource-instance.ts +32 -2
- package/src/step-engine.ts +627 -0
- package/src/zone-attribute.ts +208 -0
- package/src/zone-attributes/entries/atomic.json +7 -0
- package/src/zone-attributes/entries/idempotent.json +6 -0
- package/src/zone-attributes/entries/index.ts +14 -0
- package/src/zone-attributes/entries/no-suspend.json +6 -0
- package/src/zone-attributes/entries/replayed.json +6 -0
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import { InvokeError } from "./invoke-error.js";
|
|
2
|
+
/** Bumped only for a change a previous reader would MISREAD. A new optional
|
|
3
|
+
* field a reader can ignore is not one; a change to what an existing field
|
|
4
|
+
* means is. */
|
|
5
|
+
export const DURABLE_TARGET_ENCODING_VERSION = 1;
|
|
6
|
+
/**
|
|
7
|
+
* Canonical key order: `v`, `kind`, `name`, `module`, `pointer`, `scope`, and
|
|
8
|
+
* inside `scope`, `owner`, `site`, `stepPath`.
|
|
9
|
+
*
|
|
10
|
+
* Fixed rather than left to whichever code path built the target, because two
|
|
11
|
+
* paths producing the same identity must produce the same bytes — that is what
|
|
12
|
+
* lets a recipient compare, log and key on the encoded form without decoding it
|
|
13
|
+
* first. Enforced by BUILDING the payload in this order and letting
|
|
14
|
+
* `JSON.stringify` follow insertion order, not by passing these as its replacer
|
|
15
|
+
* array: a replacer array filters keys at EVERY depth, so the nested scope keys
|
|
16
|
+
* are absent from the top-level list and a scoped target would encode with an
|
|
17
|
+
* empty `scope` — the identity's whole distinguishing half, dropped silently.
|
|
18
|
+
*/
|
|
19
|
+
const SCOPE_KEY_ORDER = ["owner", "site", "stepPath"];
|
|
20
|
+
/**
|
|
21
|
+
* Encode a target for transport.
|
|
22
|
+
*
|
|
23
|
+
* Refuses rather than guesses. An identity missing what its form requires would
|
|
24
|
+
* decode at the far end into a resource that is merely *similar*, and a step
|
|
25
|
+
* executed against the wrong resource is the one failure durable execution must
|
|
26
|
+
* never produce quietly — so an incomplete target is an error at the sender,
|
|
27
|
+
* where the manifest that produced it is still in reach.
|
|
28
|
+
*/
|
|
29
|
+
export function encodeDurableTarget(target) {
|
|
30
|
+
if (!target.kind || !target.name) {
|
|
31
|
+
throw new InvokeError("ERR_DURABLE_TARGET_UNENCODABLE", `A step target must carry both a kind and a name to cross a process boundary; ` +
|
|
32
|
+
`got kind='${target.kind ?? ""}' name='${target.name ?? ""}'.`, { target });
|
|
33
|
+
}
|
|
34
|
+
if (target.pointer !== undefined && (target.scoped || target.scope !== undefined)) {
|
|
35
|
+
throw new InvokeError("ERR_DURABLE_TARGET_UNENCODABLE", `A step target is declared one way: at module level, inside a 'with:' scope, or ` +
|
|
36
|
+
`inline. This one carries both a scope and a pointer, which describes no ` +
|
|
37
|
+
`declaration site.`, { target });
|
|
38
|
+
}
|
|
39
|
+
// The module is what disambiguates two libraries that each declare a `store`,
|
|
40
|
+
// and a recipient resolving without it would pick whichever it saw first. It
|
|
41
|
+
// is required for every form that leaves the process, and optional only on the
|
|
42
|
+
// in-process interface, where an entry written before it was recorded must
|
|
43
|
+
// still replay.
|
|
44
|
+
if (!target.module) {
|
|
45
|
+
throw new InvokeError("ERR_DURABLE_TARGET_UNENCODABLE", `Step target ${target.kind} '${target.name}' carries no declaring module, so a ` +
|
|
46
|
+
`recipient could not tell it from a same-named resource in another module.`, { target });
|
|
47
|
+
}
|
|
48
|
+
// A SCOPED target must carry its tuple, and the check is on `scoped` rather
|
|
49
|
+
// than on the presence of `scope` — otherwise a scoped target whose tuple
|
|
50
|
+
// could not be derived would pass here as module-level, which is precisely the
|
|
51
|
+
// misresolution this refusal exists to prevent: at the far end that identity
|
|
52
|
+
// names a DIFFERENT resource that merely shares the name.
|
|
53
|
+
if (target.scoped || target.scope !== undefined) {
|
|
54
|
+
for (const key of SCOPE_KEY_ORDER) {
|
|
55
|
+
if (target.scope?.[key])
|
|
56
|
+
continue;
|
|
57
|
+
throw new InvokeError("ERR_DURABLE_TARGET_UNENCODABLE", `Step target ${target.kind} '${target.name}' is declared inside a 'with:' scope ` +
|
|
58
|
+
`but records no ${key}. A scoped instance is distinguished by its scope RUN, so ` +
|
|
59
|
+
`an identity missing that names every run of the scope at once.`, { target });
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
const payload = {
|
|
63
|
+
v: DURABLE_TARGET_ENCODING_VERSION,
|
|
64
|
+
kind: target.kind,
|
|
65
|
+
name: target.name,
|
|
66
|
+
module: target.module,
|
|
67
|
+
...(target.pointer === undefined ? {} : { pointer: target.pointer }),
|
|
68
|
+
...(target.scope === undefined
|
|
69
|
+
? {}
|
|
70
|
+
: {
|
|
71
|
+
scope: {
|
|
72
|
+
owner: target.scope.owner,
|
|
73
|
+
site: target.scope.site,
|
|
74
|
+
stepPath: target.scope.stepPath,
|
|
75
|
+
},
|
|
76
|
+
}),
|
|
77
|
+
};
|
|
78
|
+
return JSON.stringify(payload);
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Decode a target received from another process.
|
|
82
|
+
*
|
|
83
|
+
* A version this reader does not know is REFUSED, never read as far as it
|
|
84
|
+
* understands: the fields it recognizes may mean something else in a form it has
|
|
85
|
+
* never seen, and resolving anyway is how a step gets executed against a
|
|
86
|
+
* resource nobody named.
|
|
87
|
+
*/
|
|
88
|
+
export function decodeDurableTarget(encoded) {
|
|
89
|
+
let parsed;
|
|
90
|
+
try {
|
|
91
|
+
parsed = JSON.parse(encoded);
|
|
92
|
+
}
|
|
93
|
+
catch (err) {
|
|
94
|
+
throw new InvokeError("ERR_DURABLE_TARGET_UNDECODABLE", `A step target arrived that is not valid JSON: ${err.message}`, { encoded }, { cause: err });
|
|
95
|
+
}
|
|
96
|
+
if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) {
|
|
97
|
+
throw new InvokeError("ERR_DURABLE_TARGET_UNDECODABLE", `A step target arrived that is not an object.`, { encoded });
|
|
98
|
+
}
|
|
99
|
+
const raw = parsed;
|
|
100
|
+
if (raw.v !== DURABLE_TARGET_ENCODING_VERSION) {
|
|
101
|
+
throw new InvokeError("ERR_DURABLE_TARGET_UNDECODABLE", `A step target arrived in encoding version ${String(raw.v)}, and this runtime reads ` +
|
|
102
|
+
`version ${DURABLE_TARGET_ENCODING_VERSION}. Reading the fields it recognizes would ` +
|
|
103
|
+
`risk resolving a resource nobody named.`, { encoded });
|
|
104
|
+
}
|
|
105
|
+
if (typeof raw.kind !== "string" || typeof raw.name !== "string" || typeof raw.module !== "string") {
|
|
106
|
+
throw new InvokeError("ERR_DURABLE_TARGET_UNDECODABLE", `A step target arrived without a kind, a name or a module.`, { encoded });
|
|
107
|
+
}
|
|
108
|
+
const scope = raw.scope;
|
|
109
|
+
return {
|
|
110
|
+
kind: raw.kind,
|
|
111
|
+
name: raw.name,
|
|
112
|
+
module: raw.module,
|
|
113
|
+
...(typeof raw.pointer === "string" ? { pointer: raw.pointer } : {}),
|
|
114
|
+
...(scope &&
|
|
115
|
+
typeof scope.owner === "string" &&
|
|
116
|
+
typeof scope.site === "string" &&
|
|
117
|
+
typeof scope.stepPath === "string"
|
|
118
|
+
? { scope: { owner: scope.owner, site: scope.site, stepPath: scope.stepPath } }
|
|
119
|
+
: {}),
|
|
120
|
+
};
|
|
121
|
+
}
|
package/dist/duration.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/** Parse a duration string to milliseconds, or `null` if it is not a valid
|
|
2
2
|
* duration. Lets the caller own the error message and error type. */
|
|
3
3
|
export declare function tryParseDurationMs(value: string): number | null;
|
|
4
|
-
/** Parse a duration string (`300s`, `5m`, `1h`, `50ms`) to milliseconds. An
|
|
4
|
+
/** Parse a duration string (`300s`, `5m`, `1h`, `30d`, `50ms`) to milliseconds. An
|
|
5
5
|
* `undefined` value yields `fallback` (default `0`) for optional fields; an
|
|
6
6
|
* invalid string throws a plain `Error`. */
|
|
7
7
|
export declare function parseDurationMs(value: string | undefined, fallback?: number): number;
|
package/dist/duration.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Duration parsing — the shared time helper for controllers. Telo writes human
|
|
3
|
-
* durations (`250ms`, `2s`, `1.5m`, `1h`) in manifests for timers, TTLs,
|
|
3
|
+
* durations (`250ms`, `2s`, `1.5m`, `1h`, `30d`) in manifests for timers, TTLs,
|
|
4
4
|
* windows, connect timeouts, backoff, and so on; this is the single place that
|
|
5
5
|
* turns one into a millisecond count. Consumers own their own error UX:
|
|
6
6
|
* `tryParseDurationMs` returns `null` on a bad string so a caller can throw its
|
|
@@ -9,8 +9,8 @@
|
|
|
9
9
|
* fields), so a bad duration in a manifest surfaces as a structured config error.
|
|
10
10
|
*/
|
|
11
11
|
import { RuntimeError } from "./types.js";
|
|
12
|
-
const DURATION_PATTERN = /^(\d+(?:\.\d+)?)\s*(ms|s|m|h)$/;
|
|
13
|
-
const UNIT_MS = { ms: 1, s: 1_000, m: 60_000, h: 3_600_000 };
|
|
12
|
+
const DURATION_PATTERN = /^(\d+(?:\.\d+)?)\s*(ms|s|m|h|d)$/;
|
|
13
|
+
const UNIT_MS = { ms: 1, s: 1_000, m: 60_000, h: 3_600_000, d: 86_400_000 };
|
|
14
14
|
/** Parse a duration string to milliseconds, or `null` if it is not a valid
|
|
15
15
|
* duration. Lets the caller own the error message and error type. */
|
|
16
16
|
export function tryParseDurationMs(value) {
|
|
@@ -19,7 +19,7 @@ export function tryParseDurationMs(value) {
|
|
|
19
19
|
return null;
|
|
20
20
|
return Number(match[1]) * UNIT_MS[match[2]];
|
|
21
21
|
}
|
|
22
|
-
/** Parse a duration string (`300s`, `5m`, `1h`, `50ms`) to milliseconds. An
|
|
22
|
+
/** Parse a duration string (`300s`, `5m`, `1h`, `30d`, `50ms`) to milliseconds. An
|
|
23
23
|
* `undefined` value yields `fallback` (default `0`) for optional fields; an
|
|
24
24
|
* invalid string throws a plain `Error`. */
|
|
25
25
|
export function parseDurationMs(value, fallback = 0) {
|
|
@@ -27,7 +27,7 @@ export function parseDurationMs(value, fallback = 0) {
|
|
|
27
27
|
return fallback;
|
|
28
28
|
const ms = tryParseDurationMs(value);
|
|
29
29
|
if (ms === null) {
|
|
30
|
-
throw new RuntimeError("ERR_INVALID_VALUE", `Invalid duration ${JSON.stringify(value)}; use a number with a unit, e.g. "250ms", "2s", "1.5m", "1h".`);
|
|
30
|
+
throw new RuntimeError("ERR_INVALID_VALUE", `Invalid duration ${JSON.stringify(value)}; use a number with a unit, e.g. "250ms", "2s", "1.5m", "1h", "30d".`);
|
|
31
31
|
}
|
|
32
32
|
return ms;
|
|
33
33
|
}
|
|
@@ -87,6 +87,22 @@ export interface EvaluationContext {
|
|
|
87
87
|
instance: ResourceInstance;
|
|
88
88
|
}>;
|
|
89
89
|
preInitHook?: PreInitHook;
|
|
90
|
+
/**
|
|
91
|
+
* The manifest a name was DECLARED with, resolved scope-local first and then
|
|
92
|
+
* up the enclosing chain; `alias` routes into that import's exported
|
|
93
|
+
* instances. Undefined when the name resolves to nothing.
|
|
94
|
+
*
|
|
95
|
+
* A DECLARATION, not an instance — nothing here yields one. It is what a
|
|
96
|
+
* contract typed from a referenced declaration reads
|
|
97
|
+
* (`x-telo-schema-projection-from`), which the pending-resource queue cannot
|
|
98
|
+
* answer because it has drained by the time a contract is bound.
|
|
99
|
+
*
|
|
100
|
+
* Optional, like every other kernel-supplied hook on this interface
|
|
101
|
+
* (`getDefinition?`, `preInitHook?`) and for the same reason: a third-party
|
|
102
|
+
* implementation must keep compiling. Absent reads as "no declaration in
|
|
103
|
+
* scope", which leaves a projected slot as its author wrote it.
|
|
104
|
+
*/
|
|
105
|
+
resolveDeclaredManifest?(name: string, alias?: string): ResourceManifest | undefined;
|
|
90
106
|
/** Looks up a registered resource definition by fully-qualified kind.
|
|
91
107
|
* Set by the kernel; used for declared-throw-union checks. */
|
|
92
108
|
getDefinition?: (kind: string) => ResourceDefinition | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"evaluation-context.d.ts","sourceRoot":"","sources":["../src/evaluation-context.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,QAAQ,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAClF,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,CACtB,KAAK,EAAE,MAAM,EACb,OAAO,CAAC,EAAE,GAAG,EACb,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,KAC3B,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;AAE1B;;;;GAIG;AACH,MAAM,WAAW,MAAM;IACrB,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B,4EAA4E;IAC5E,IAAI,IAAI,MAAM,CAAC;IACf;iEAC6D;IAC7D,UAAU,IAAI,MAAM,CAAC;CACtB;AAED,qEAAqE;AACrE,MAAM,MAAM,cAAc,GAAG,SAAS,GAAG,WAAW,GAAG,aAAa,GAAG,UAAU,GAAG,UAAU,CAAC;AAE/F;;;GAGG;AACH,MAAM,MAAM,eAAe,GAAG;IAC5B,QAAQ,EAAE,gBAAgB,CAAC;IAC3B,GAAG,EAAE,GAAG,CAAC;IAKT,QAAQ,EAAE,gBAAgB,CAAC;CAC5B,CAAC;AAEF;;;;;;GAMG;AACH,MAAM,MAAM,eAAe,GAAG,CAC5B,OAAO,EAAE,iBAAiB,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AC5B"}
|
package/dist/index.d.ts
CHANGED
|
@@ -5,6 +5,7 @@ export * from "./capabilities/invokable.js";
|
|
|
5
5
|
export * from "./ref.js";
|
|
6
6
|
export * from "./type-schema-ref.js";
|
|
7
7
|
export * from "./invoke-step.js";
|
|
8
|
+
export * from "./step-engine.js";
|
|
8
9
|
export * from "./dispatch-invoke-ref.js";
|
|
9
10
|
export * from "./capabilities/provider.js";
|
|
10
11
|
export * from "./capabilities/runnable.js";
|
|
@@ -34,5 +35,9 @@ export * from "./runtime-event.js";
|
|
|
34
35
|
export * from "./runtime-resource.js";
|
|
35
36
|
export * from "./stream.js";
|
|
36
37
|
export * from "./types.js";
|
|
38
|
+
export * from "./durable-run.js";
|
|
39
|
+
export * from "./durable-suspension.js";
|
|
40
|
+
export * from "./durable-target-encoding.js";
|
|
37
41
|
export * from "./value-type.js";
|
|
42
|
+
export * from "./zone-attribute.js";
|
|
38
43
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC;AACpC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,UAAU,CAAC;AACzB,cAAc,sBAAsB,CAAC;AACrC,cAAc,kBAAkB,CAAC;AACjC,cAAc,0BAA0B,CAAC;AACzC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,uBAAuB,CAAC;AACtC,cAAc,eAAe,CAAC;AAC9B,cAAc,iBAAiB,CAAC;AAChC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,yBAAyB,CAAC;AACxC,cAAc,wBAAwB,CAAC;AACvC,cAAc,yBAAyB,CAAC;AACxC,cAAc,qBAAqB,CAAC;AACpC,cAAc,uBAAuB,CAAC;AACtC,cAAc,wB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oBAAoB,CAAC;AACnC,cAAc,mBAAmB,CAAC;AAClC,cAAc,mBAAmB,CAAC;AAClC,cAAc,aAAa,CAAC;AAC5B,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC;AACpC,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC;AACnC,cAAc,uBAAuB,CAAC;AACtC,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,cAAc,kBAAkB,CAAC;AACjC,cAAc,yBAAyB,CAAC;AACxC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,iBAAiB,CAAC;AAChC,cAAc,qBAAqB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -5,6 +5,7 @@ export * from "./capabilities/invokable.js";
|
|
|
5
5
|
export * from "./ref.js";
|
|
6
6
|
export * from "./type-schema-ref.js";
|
|
7
7
|
export * from "./invoke-step.js";
|
|
8
|
+
export * from "./step-engine.js";
|
|
8
9
|
export * from "./dispatch-invoke-ref.js";
|
|
9
10
|
export * from "./capabilities/provider.js";
|
|
10
11
|
export * from "./capabilities/runnable.js";
|
|
@@ -34,4 +35,8 @@ export * from "./runtime-event.js";
|
|
|
34
35
|
export * from "./runtime-resource.js";
|
|
35
36
|
export * from "./stream.js";
|
|
36
37
|
export * from "./types.js";
|
|
38
|
+
export * from "./durable-run.js";
|
|
39
|
+
export * from "./durable-suspension.js";
|
|
40
|
+
export * from "./durable-target-encoding.js";
|
|
37
41
|
export * from "./value-type.js";
|
|
42
|
+
export * from "./zone-attribute.js";
|
package/dist/invoke-step.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { Invocable } from "./capabilities/invokable.js";
|
|
2
2
|
import { type InvokeContext } from "./cancellation.js";
|
|
3
|
+
import type { OpenZoneAttributes } from "./zone-attribute.js";
|
|
3
4
|
import type { KindRef, ScopeContext } from "./ref.js";
|
|
4
5
|
import { type ResourceInstance } from "./resource-instance.js";
|
|
5
6
|
/**
|
|
@@ -31,6 +32,26 @@ export interface InvokeStepRetry {
|
|
|
31
32
|
jitter?: "none" | "full";
|
|
32
33
|
/** DEPRECATED duration string (`"250ms"`, `"1s"`) — read as `initialDelay`. */
|
|
33
34
|
delay?: string;
|
|
35
|
+
/**
|
|
36
|
+
* Error codes that end the loop immediately instead of consuming the budget.
|
|
37
|
+
*
|
|
38
|
+
* The leaf's built-in exclusions are the ones decidable WITHOUT judgement —
|
|
39
|
+
* cancellation, and the kernel's verdicts on the shape of the call. Whether a
|
|
40
|
+
* DOMAIN failure is worth re-attempting is not decidable here at all: an
|
|
41
|
+
* `ERR_PAYMENT_DECLINED` and an `ERR_UPSTREAM_TIMEOUT` are the same shape to
|
|
42
|
+
* this loop, and only the author knows that re-presenting a declined card
|
|
43
|
+
* changes nothing. Without this, every terminal domain failure is retried to
|
|
44
|
+
* exhaustion — which is not merely wasted time but, for a non-idempotent
|
|
45
|
+
* target, N extra attempts at a side effect.
|
|
46
|
+
*
|
|
47
|
+
* Named by CODE rather than by a predicate because a code is what crosses
|
|
48
|
+
* every boundary this has to survive: a manifest declares it, `catches:`
|
|
49
|
+
* already matches on it, and a relocating backend ships it as data. Both
|
|
50
|
+
* hosted engines express the same knob — Temporal's non-retryable error types,
|
|
51
|
+
* Restate's terminal-versus-retryable split — so a policy written here means
|
|
52
|
+
* the same thing wherever the step ends up executing.
|
|
53
|
+
*/
|
|
54
|
+
nonRetryable?: string[];
|
|
34
55
|
}
|
|
35
56
|
/**
|
|
36
57
|
* The canonical leaf step shared by the kernel's boot `targets` runner and the
|
|
@@ -43,6 +64,29 @@ export interface InvokeStep {
|
|
|
43
64
|
invoke: KindRef<Invocable> | Invocable;
|
|
44
65
|
inputs?: Record<string, unknown>;
|
|
45
66
|
retry?: InvokeStepRetry;
|
|
67
|
+
/**
|
|
68
|
+
* How long ONE attempt may take, in milliseconds. On elapse the dispatch is
|
|
69
|
+
* cancelled and the step fails `ERR_STEP_TIMEOUT`.
|
|
70
|
+
*
|
|
71
|
+
* Per attempt rather than for the whole loop, matching Temporal's
|
|
72
|
+
* start-to-close: a budget spanning the retries would make the last attempt's
|
|
73
|
+
* allowance depend on how slow the earlier ones were, so an author could not
|
|
74
|
+
* state what any single call is allowed to take. A whole-operation bound is a
|
|
75
|
+
* different thing and belongs to whatever owns the operation.
|
|
76
|
+
*
|
|
77
|
+
* It bounds the step rather than the target because the target does not know
|
|
78
|
+
* who is waiting: the same `Http.Request` is a 30-second batch call from one
|
|
79
|
+
* step and a 500ms call on a request path from another. It is also what a
|
|
80
|
+
* backend that chooses WHERE a step executes needs in order to choose —
|
|
81
|
+
* Temporal runs a short step as a local activity and a long one as an
|
|
82
|
+
* activity, which is not a decision a manifest should have to make.
|
|
83
|
+
*
|
|
84
|
+
* Enforced by cancellation, never by abandoning the call: the timeout source
|
|
85
|
+
* is linked to the caller's token and threaded into the dispatch, so a target
|
|
86
|
+
* that honours cancellation stops working rather than continuing unobserved
|
|
87
|
+
* past a deadline nobody is waiting on any more.
|
|
88
|
+
*/
|
|
89
|
+
timeout?: number;
|
|
46
90
|
}
|
|
47
91
|
/** An inline flat invoke step on an Application's `targets`. Same as an
|
|
48
92
|
* {@link InvokeStep} but `name` is optional — it is only needed for
|
|
@@ -79,11 +123,25 @@ export type BootTarget = string | {
|
|
|
79
123
|
export interface InvokeStepContext {
|
|
80
124
|
expandValue(value: any, context: Record<string, any>): any;
|
|
81
125
|
invoke<TInputs>(kind: string, name: string, inputs: TInputs, options?: any): Promise<any>;
|
|
82
|
-
|
|
126
|
+
/** Open zones with what each declares about its contents — how the leaf and
|
|
127
|
+
* the engine read the collapse rule. Optional so the structural context stays
|
|
128
|
+
* satisfiable by a host with no zone machinery; ABSENT MEANS "no zone is
|
|
129
|
+
* open", which is the direction that journals MORE rather than less, and so
|
|
130
|
+
* the safe one. */
|
|
131
|
+
zoneAttributes?(ctx?: InvokeContext): readonly OpenZoneAttributes[];
|
|
132
|
+
invokeResolved<TInputs>(kind: string, name: string, instance: ResourceInstance, inputs: TInputs,
|
|
133
|
+
/** Seeds the dispatch's invocation context, replacing the ambient — how a
|
|
134
|
+
* step `timeout:` reaches the target it bounds. Optional so a leaf caller
|
|
135
|
+
* that never sets one is unchanged. */
|
|
136
|
+
ctx?: InvokeContext): Promise<any>;
|
|
83
137
|
/** Resolve a cross-module exported instance (`!ref Alias.name`) to its live instance.
|
|
84
138
|
* Optional — providers that pre-resolve cross-module refs before reaching the leaf
|
|
85
139
|
* (e.g. the boot-target runner) may omit it. */
|
|
86
140
|
resolveImportedInstance?(alias: string, name: string): ResourceInstance | undefined;
|
|
141
|
+
/** Resolve a module-level sibling by name. Optional for the same reason the
|
|
142
|
+
* one above is, and read here ONLY to recover a target's declaration site —
|
|
143
|
+
* the dispatch itself still goes by name through the chokepoint. */
|
|
144
|
+
resolveLocalInstance?(name: string): ResourceInstance | undefined;
|
|
87
145
|
}
|
|
88
146
|
/**
|
|
89
147
|
* Per-run state threaded through the leaf. `steps` is the result accumulator
|
|
@@ -113,6 +171,16 @@ export interface InvokeStepState {
|
|
|
113
171
|
* invocation to forward.
|
|
114
172
|
*/
|
|
115
173
|
invokeCtx?: InvokeContext;
|
|
174
|
+
/**
|
|
175
|
+
* This step's journal key, when the composer tracks one — see
|
|
176
|
+
* {@link stepPath}. Absent for a caller that assembled a step in code, and for
|
|
177
|
+
* the boot runner, whose targets are not a durable body.
|
|
178
|
+
*
|
|
179
|
+
* Supplied by the composer rather than derived here because a path is a
|
|
180
|
+
* property of the enclosing STRUCTURE (which branch, which loop turn, which
|
|
181
|
+
* fan-out element), and the leaf sees one step.
|
|
182
|
+
*/
|
|
183
|
+
journalPath?: string;
|
|
116
184
|
}
|
|
117
185
|
/**
|
|
118
186
|
* Execute one invoke step: evaluate the `when` guard, expand `inputs`, resolve
|
|
@@ -121,4 +189,21 @@ export interface InvokeStepState {
|
|
|
121
189
|
* concern.
|
|
122
190
|
*/
|
|
123
191
|
export declare function executeInvokeStep(step: InvokeStep, ctx: InvokeStepContext, state: InvokeStepState): Promise<void>;
|
|
192
|
+
/**
|
|
193
|
+
* The backoff before attempt `resend + 1`, before jitter.
|
|
194
|
+
*
|
|
195
|
+
* ONE formula, exported because the analyzer needs the same number: it decides
|
|
196
|
+
* statically whether a step's declared policy would park inside a region that
|
|
197
|
+
* cannot be held open, and a second copy of exponential-backoff arithmetic in
|
|
198
|
+
* the analyzer would be a rule that drifts from the behaviour it describes the
|
|
199
|
+
* first time either side gains a knob.
|
|
200
|
+
*
|
|
201
|
+
* Jitter is deliberately NOT applied here. It belongs to the duration, not to
|
|
202
|
+
* the shape of the policy, and the two consumers want the shape: the runtime
|
|
203
|
+
* branches on it (see `withStepRetry`) and the analyzer reports on it.
|
|
204
|
+
*
|
|
205
|
+
* The `??` fallbacks are the floor for a caller that assembled a policy in code;
|
|
206
|
+
* a manifest gets its defaults from the schema.
|
|
207
|
+
*/
|
|
208
|
+
export declare function retryBackoffMs(policy: InvokeStepRetry, resend: number): number;
|
|
124
209
|
//# sourceMappingURL=invoke-step.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"invoke-step.d.ts","sourceRoot":"","sources":["../src/invoke-step.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAC;AAC7D,OAAO,EAGL,KAAK,aAAa,
|
|
1
|
+
{"version":3,"file":"invoke-step.d.ts","sourceRoot":"","sources":["../src/invoke-step.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAC;AAC7D,OAAO,EAGL,KAAK,aAAa,EAKnB,MAAM,mBAAmB,CAAC;AAe3B,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAG9D,OAAO,KAAK,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AACtD,OAAO,EAAkB,KAAK,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAE/E;;;;;;;;;;;;;;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