@temporal-contract/worker 2.3.1 → 3.0.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 +46 -7
- package/dist/activity.cjs +22 -13
- package/dist/activity.d.cts +15 -13
- package/dist/activity.d.cts.map +1 -1
- package/dist/activity.d.mts +15 -13
- package/dist/activity.d.mts.map +1 -1
- package/dist/activity.mjs +22 -14
- package/dist/activity.mjs.map +1 -1
- package/dist/errors-BNnNzSwE.d.cts +213 -0
- package/dist/errors-BNnNzSwE.d.cts.map +1 -0
- package/dist/errors-BNnNzSwE.d.mts +213 -0
- package/dist/errors-BNnNzSwE.d.mts.map +1 -0
- package/dist/{internal-DcM-YWYX.cjs → internal-Clwokr1z.cjs} +108 -134
- package/dist/{internal-D8Dl9D43.mjs → internal-DqYK4YQK.mjs} +105 -131
- package/dist/internal-DqYK4YQK.mjs.map +1 -0
- package/dist/workflow.cjs +56 -51
- package/dist/workflow.d.cts +59 -40
- package/dist/workflow.d.cts.map +1 -1
- package/dist/workflow.d.mts +59 -40
- package/dist/workflow.d.mts.map +1 -1
- package/dist/workflow.mjs +39 -34
- package/dist/workflow.mjs.map +1 -1
- package/package.json +21 -17
- package/dist/errors-BP48RaOI.d.cts +0 -208
- package/dist/errors-BP48RaOI.d.cts.map +0 -1
- package/dist/errors-BP48RaOI.d.mts +0 -208
- package/dist/errors-BP48RaOI.d.mts.map +0 -1
- package/dist/internal-D8Dl9D43.mjs.map +0 -1
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
import { AnySchema } from "@temporal-contract/contract";
|
|
2
|
+
import { ApplicationFailure } from "@temporalio/common";
|
|
3
|
+
import { StandardSchemaV1 } from "@standard-schema/spec";
|
|
4
|
+
|
|
5
|
+
//#region src/types.d.ts
|
|
6
|
+
/**
|
|
7
|
+
* Infer input type from a definition (worker perspective)
|
|
8
|
+
* Worker receives the output type (after input schema parsing/transformation)
|
|
9
|
+
*/
|
|
10
|
+
type WorkerInferInput<T extends {
|
|
11
|
+
input: AnySchema;
|
|
12
|
+
}> = StandardSchemaV1.InferOutput<T["input"]>;
|
|
13
|
+
/**
|
|
14
|
+
* Infer output type from a definition (worker perspective)
|
|
15
|
+
* Worker returns the input type (before output schema parsing/transformation)
|
|
16
|
+
*/
|
|
17
|
+
type WorkerInferOutput<T extends {
|
|
18
|
+
output: AnySchema;
|
|
19
|
+
}> = StandardSchemaV1.InferInput<T["output"]>;
|
|
20
|
+
/**
|
|
21
|
+
* Infer input type from a definition (client perspective)
|
|
22
|
+
* Client sends the input type (before input schema parsing/transformation)
|
|
23
|
+
*/
|
|
24
|
+
type ClientInferInput<T extends {
|
|
25
|
+
input: AnySchema;
|
|
26
|
+
}> = StandardSchemaV1.InferInput<T["input"]>;
|
|
27
|
+
/**
|
|
28
|
+
* Infer output type from a definition (client perspective)
|
|
29
|
+
* Client receives the output type (after output schema parsing/transformation)
|
|
30
|
+
*/
|
|
31
|
+
type ClientInferOutput<T extends {
|
|
32
|
+
output: AnySchema;
|
|
33
|
+
}> = StandardSchemaV1.InferOutput<T["output"]>;
|
|
34
|
+
//#endregion
|
|
35
|
+
//#region src/errors.d.ts
|
|
36
|
+
/**
|
|
37
|
+
* Base class for the contract's runtime validation failures — workflow and
|
|
38
|
+
* activity input/output, plus signal/query/update payloads.
|
|
39
|
+
*
|
|
40
|
+
* These extend Temporal's {@link ApplicationFailure} with `nonRetryable: true`
|
|
41
|
+
* rather than a plain `Error`, and that distinction is load-bearing. The
|
|
42
|
+
* TypeScript SDK classifies a non-`TemporalFailure` thrown from *workflow* code
|
|
43
|
+
* as a Workflow Task failure — presumed to be a transient code bug or
|
|
44
|
+
* non-determinism — and retries the task indefinitely, leaving the execution
|
|
45
|
+
* silently `Running` forever (it looks like the worker "hung"). Only a
|
|
46
|
+
* `TemporalFailure` such as `ApplicationFailure` fails the Workflow Execution
|
|
47
|
+
* terminally. The same logic applies at the activity boundary, where Temporal's
|
|
48
|
+
* default retry policy has unlimited attempts: a plain `Error` would retry
|
|
49
|
+
* forever too.
|
|
50
|
+
*
|
|
51
|
+
* Contract validation failures are deterministic — the schema is static, so bad
|
|
52
|
+
* input/output never becomes valid on replay or retry — so they are surfaced as
|
|
53
|
+
* non-retryable, failing fast with a clear error instead of an infinite retry
|
|
54
|
+
* loop.
|
|
55
|
+
*
|
|
56
|
+
* The concrete subclass name is passed through as the failure `type`, so it
|
|
57
|
+
* stays discriminable after crossing Temporal's serialization boundary (where
|
|
58
|
+
* the JS class identity is lost) via `failure.type`. The failing field path is
|
|
59
|
+
* carried in the human-readable `message` (see {@link summarizeIssues}). The
|
|
60
|
+
* raw `issues` remain available as a property for in-process inspection.
|
|
61
|
+
*
|
|
62
|
+
* See issue #251.
|
|
63
|
+
*/
|
|
64
|
+
declare abstract class ValidationError extends ApplicationFailure {
|
|
65
|
+
readonly issues: ReadonlyArray<StandardSchemaV1.Issue>;
|
|
66
|
+
protected constructor(message: string, type: string, issues: ReadonlyArray<StandardSchemaV1.Issue>);
|
|
67
|
+
}
|
|
68
|
+
declare const ActivityDefinitionNotFoundError_base: import("unthrown").TaggedErrorConstructor<"@temporal-contract/ActivityDefinitionNotFoundError">;
|
|
69
|
+
/**
|
|
70
|
+
* Error thrown when an activity definition is not found in the contract
|
|
71
|
+
*/
|
|
72
|
+
declare class ActivityDefinitionNotFoundError extends ActivityDefinitionNotFoundError_base<{
|
|
73
|
+
activityName: string;
|
|
74
|
+
availableDefinitions: readonly string[];
|
|
75
|
+
message: string;
|
|
76
|
+
}> {
|
|
77
|
+
constructor(activityName: string, availableDefinitions?: readonly string[]);
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Error thrown when activity input validation fails
|
|
81
|
+
*/
|
|
82
|
+
declare class ActivityInputValidationError extends ValidationError {
|
|
83
|
+
readonly activityName: string;
|
|
84
|
+
constructor(activityName: string, issues: ReadonlyArray<StandardSchemaV1.Issue>);
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Error thrown when activity output validation fails
|
|
88
|
+
*/
|
|
89
|
+
declare class ActivityOutputValidationError extends ValidationError {
|
|
90
|
+
readonly activityName: string;
|
|
91
|
+
constructor(activityName: string, issues: ReadonlyArray<StandardSchemaV1.Issue>);
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Error thrown when workflow input validation fails
|
|
95
|
+
*/
|
|
96
|
+
declare class WorkflowInputValidationError extends ValidationError {
|
|
97
|
+
readonly workflowName: string;
|
|
98
|
+
constructor(workflowName: string, issues: ReadonlyArray<StandardSchemaV1.Issue>);
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Error thrown when workflow output validation fails
|
|
102
|
+
*/
|
|
103
|
+
declare class WorkflowOutputValidationError extends ValidationError {
|
|
104
|
+
readonly workflowName: string;
|
|
105
|
+
constructor(workflowName: string, issues: ReadonlyArray<StandardSchemaV1.Issue>);
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Error thrown when signal input validation fails
|
|
109
|
+
*/
|
|
110
|
+
declare class SignalInputValidationError extends ValidationError {
|
|
111
|
+
readonly signalName: string;
|
|
112
|
+
constructor(signalName: string, issues: ReadonlyArray<StandardSchemaV1.Issue>);
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Error thrown when query input validation fails
|
|
116
|
+
*/
|
|
117
|
+
declare class QueryInputValidationError extends ValidationError {
|
|
118
|
+
readonly queryName: string;
|
|
119
|
+
constructor(queryName: string, issues: ReadonlyArray<StandardSchemaV1.Issue>);
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* Error thrown when query output validation fails
|
|
123
|
+
*/
|
|
124
|
+
declare class QueryOutputValidationError extends ValidationError {
|
|
125
|
+
readonly queryName: string;
|
|
126
|
+
constructor(queryName: string, issues: ReadonlyArray<StandardSchemaV1.Issue>);
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* Error thrown when update input validation fails
|
|
130
|
+
*/
|
|
131
|
+
declare class UpdateInputValidationError extends ValidationError {
|
|
132
|
+
readonly updateName: string;
|
|
133
|
+
constructor(updateName: string, issues: ReadonlyArray<StandardSchemaV1.Issue>);
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* Error thrown when update output validation fails
|
|
137
|
+
*/
|
|
138
|
+
declare class UpdateOutputValidationError extends ValidationError {
|
|
139
|
+
readonly updateName: string;
|
|
140
|
+
constructor(updateName: string, issues: ReadonlyArray<StandardSchemaV1.Issue>);
|
|
141
|
+
}
|
|
142
|
+
declare const ChildWorkflowNotFoundError_base: import("unthrown").TaggedErrorConstructor<"@temporal-contract/ChildWorkflowNotFoundError">;
|
|
143
|
+
/**
|
|
144
|
+
* Error thrown when a child workflow is not found in the contract
|
|
145
|
+
*/
|
|
146
|
+
declare class ChildWorkflowNotFoundError extends ChildWorkflowNotFoundError_base<{
|
|
147
|
+
workflowName: string;
|
|
148
|
+
availableWorkflows: readonly string[];
|
|
149
|
+
message: string;
|
|
150
|
+
}> {
|
|
151
|
+
constructor(workflowName: string, availableWorkflows?: readonly string[]);
|
|
152
|
+
}
|
|
153
|
+
declare const ChildWorkflowError_base: import("unthrown").TaggedErrorConstructor<"@temporal-contract/ChildWorkflowError">;
|
|
154
|
+
/**
|
|
155
|
+
* Generic error for child workflow operations.
|
|
156
|
+
*
|
|
157
|
+
* When the child execution itself fails (Temporal's `ChildWorkflowFailure`),
|
|
158
|
+
* `cause` is set to the *unwrapped* underlying failure (`ApplicationFailure`,
|
|
159
|
+
* `TimeoutFailure`, `TerminatedFailure`, etc.) lifted from Temporal's wrapper —
|
|
160
|
+
* mirroring the client-side `WorkflowFailedError.cause` behavior, so callers
|
|
161
|
+
* can branch on the failure category in one step instead of unwrapping twice.
|
|
162
|
+
*/
|
|
163
|
+
declare class ChildWorkflowError extends ChildWorkflowError_base<{
|
|
164
|
+
message: string;
|
|
165
|
+
cause?: unknown;
|
|
166
|
+
}> {
|
|
167
|
+
constructor(message: string, cause?: unknown);
|
|
168
|
+
}
|
|
169
|
+
declare const ChildWorkflowCancelledError_base: import("unthrown").TaggedErrorConstructor<"@temporal-contract/ChildWorkflowCancelledError">;
|
|
170
|
+
/**
|
|
171
|
+
* Discriminated variant surfaced when a child workflow operation (start,
|
|
172
|
+
* execute, or wait-for-result) was cancelled — either because the parent
|
|
173
|
+
* workflow itself was cancelled, the child was explicitly cancelled, or its
|
|
174
|
+
* enclosing cancellation scope was. Detected via `@temporalio/workflow`'s
|
|
175
|
+
* `isCancellation(...)`, which sees through nested `ChildWorkflowFailure` /
|
|
176
|
+
* `CancelledFailure` chains.
|
|
177
|
+
*
|
|
178
|
+
* A sibling of {@link ChildWorkflowError} rather than a subclass: both are
|
|
179
|
+
* distinct {@link TaggedError}s, so call sites discriminate on the `_tag`
|
|
180
|
+
* (or `instanceof ChildWorkflowCancelledError`) instead of relying on an
|
|
181
|
+
* `instanceof ChildWorkflowError` that also matches cancellation. `matchTags`
|
|
182
|
+
* folds the `ChildWorkflowError | ChildWorkflowCancelledError` union
|
|
183
|
+
* exhaustively.
|
|
184
|
+
*/
|
|
185
|
+
declare class ChildWorkflowCancelledError extends ChildWorkflowCancelledError_base<{
|
|
186
|
+
workflowName: string;
|
|
187
|
+
cause?: unknown;
|
|
188
|
+
message: string;
|
|
189
|
+
}> {
|
|
190
|
+
constructor(workflowName: string, cause?: unknown);
|
|
191
|
+
}
|
|
192
|
+
declare const WorkflowCancelledError_base: import("unthrown").TaggedErrorConstructor<"@temporal-contract/WorkflowCancelledError">;
|
|
193
|
+
/**
|
|
194
|
+
* Error surfaced in the `err(...)` branch of an `AsyncResult` when a typed
|
|
195
|
+
* cancellation scope is cancelled via Temporal's cancellation propagation.
|
|
196
|
+
* Returned by both `context.cancellableScope` (when the workflow or an
|
|
197
|
+
* ancestor scope cancels) and `context.nonCancellableScope` (when
|
|
198
|
+
* cancellation is raised from inside the scope). Distinct from arbitrary
|
|
199
|
+
* thrown errors so call sites can branch on cancellation explicitly.
|
|
200
|
+
*
|
|
201
|
+
* Non-cancellation errors thrown inside a scope are *unmodeled* failures: they
|
|
202
|
+
* surface on the scope's `defect` channel (re-thrown at the edge / inspectable
|
|
203
|
+
* via `result.isDefect()` and `result.cause`), not as a typed `err(...)`.
|
|
204
|
+
*/
|
|
205
|
+
declare class WorkflowCancelledError extends WorkflowCancelledError_base<{
|
|
206
|
+
cause?: unknown;
|
|
207
|
+
message: string;
|
|
208
|
+
}> {
|
|
209
|
+
constructor(cause?: unknown);
|
|
210
|
+
}
|
|
211
|
+
//#endregion
|
|
212
|
+
export { ClientInferOutput as _, ChildWorkflowError as a, QueryOutputValidationError as c, UpdateOutputValidationError as d, ValidationError as f, ClientInferInput as g, WorkflowOutputValidationError as h, ChildWorkflowCancelledError as i, SignalInputValidationError as l, WorkflowInputValidationError as m, ActivityInputValidationError as n, ChildWorkflowNotFoundError as o, WorkflowCancelledError as p, ActivityOutputValidationError as r, QueryInputValidationError as s, ActivityDefinitionNotFoundError as t, UpdateInputValidationError as u, WorkerInferInput as v, WorkerInferOutput as y };
|
|
213
|
+
//# sourceMappingURL=errors-BNnNzSwE.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors-BNnNzSwE.d.cts","names":[],"sources":["../src/types.ts","../src/errors.ts"],"mappings":";;;;;;;;AAOA;KAAY,gBAAA;EAA6B,KAAA,EAAO,SAAA;AAAA,KAAe,gBAAA,CAAiB,WAAA,CAC9E,CAAA;;;;;KAOU,iBAAA;EAA8B,MAAA,EAAQ,SAAA;AAAA,KAAe,gBAAA,CAAiB,UAAA,CAChF,CAAA;;;;;KAOU,gBAAA;EAA6B,KAAA,EAAO,SAAA;AAAA,KAAe,gBAAA,CAAiB,UAAA,CAC9E,CAAA;;;;;KAOU,iBAAA;EAA8B,MAAA,EAAQ,SAAA;AAAA,KAAe,gBAAA,CAAiB,WAAA,CAChF,CAAA;;;;;;AAzBF;;;;;;;;;;;;;;;AACG;AAOH;;;;;;;;;uBCkBsB,eAAA,SAAwB,kBAAA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A,UAAA,UAChB,MAAA,EAAQ,aAAA,CAAc,gBAAA,CAAiB,KAAA;AAAA;AA/I3C;;;AAAA,cA6Ja,2BAAA,SAAoC,eAAA;EAAA,SAE7B,UAAA;cAAA,UAAA,UAChB,MAAA,EAAQ,aAAA,CAAc,gBAAA,CAAiB,KAAA;AAAA;AAAA,cAS1C,+BAAA;;;;cAKY,0BAAA,SAAmC,+BAAA;EAI9C,YAAA;EACA,kBAAA;EACA,OAAA;AAAA;cAEY,YAAA,UAAsB,kBAAA;AAAA;AAAA,cAQnC,uBAAA;;;;;;;;;;cAWY,kBAAA,SAA2B,uBAAA;EAGtC,OAAA;EACA,KAAA;AAAA;cAEY,OAAA,UAAiB,KAAA;AAAA;AAAA,cAG9B,gCAAA;;;;;;;;;;;;;;AAzKgD;AAcjD;cA4Ka,2BAAA,SAAoC,gCAAA;EAI/C,YAAA;EACA,KAAA;EACA,OAAA;AAAA;cAEY,YAAA,UAAsB,KAAA;AAAA;AAAA,cAGnC,2BAAA;;;;;;;;;AApLgD;AAcjD;;;cAoLa,sBAAA,SAA+B,2BAAA;EAI1C,KAAA;EACA,OAAA;AAAA;cAEY,KAAA;AAAA"}
|
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
import { AnySchema } from "@temporal-contract/contract";
|
|
2
|
+
import { ApplicationFailure } from "@temporalio/common";
|
|
3
|
+
import { StandardSchemaV1 } from "@standard-schema/spec";
|
|
4
|
+
|
|
5
|
+
//#region src/types.d.ts
|
|
6
|
+
/**
|
|
7
|
+
* Infer input type from a definition (worker perspective)
|
|
8
|
+
* Worker receives the output type (after input schema parsing/transformation)
|
|
9
|
+
*/
|
|
10
|
+
type WorkerInferInput<T extends {
|
|
11
|
+
input: AnySchema;
|
|
12
|
+
}> = StandardSchemaV1.InferOutput<T["input"]>;
|
|
13
|
+
/**
|
|
14
|
+
* Infer output type from a definition (worker perspective)
|
|
15
|
+
* Worker returns the input type (before output schema parsing/transformation)
|
|
16
|
+
*/
|
|
17
|
+
type WorkerInferOutput<T extends {
|
|
18
|
+
output: AnySchema;
|
|
19
|
+
}> = StandardSchemaV1.InferInput<T["output"]>;
|
|
20
|
+
/**
|
|
21
|
+
* Infer input type from a definition (client perspective)
|
|
22
|
+
* Client sends the input type (before input schema parsing/transformation)
|
|
23
|
+
*/
|
|
24
|
+
type ClientInferInput<T extends {
|
|
25
|
+
input: AnySchema;
|
|
26
|
+
}> = StandardSchemaV1.InferInput<T["input"]>;
|
|
27
|
+
/**
|
|
28
|
+
* Infer output type from a definition (client perspective)
|
|
29
|
+
* Client receives the output type (after output schema parsing/transformation)
|
|
30
|
+
*/
|
|
31
|
+
type ClientInferOutput<T extends {
|
|
32
|
+
output: AnySchema;
|
|
33
|
+
}> = StandardSchemaV1.InferOutput<T["output"]>;
|
|
34
|
+
//#endregion
|
|
35
|
+
//#region src/errors.d.ts
|
|
36
|
+
/**
|
|
37
|
+
* Base class for the contract's runtime validation failures — workflow and
|
|
38
|
+
* activity input/output, plus signal/query/update payloads.
|
|
39
|
+
*
|
|
40
|
+
* These extend Temporal's {@link ApplicationFailure} with `nonRetryable: true`
|
|
41
|
+
* rather than a plain `Error`, and that distinction is load-bearing. The
|
|
42
|
+
* TypeScript SDK classifies a non-`TemporalFailure` thrown from *workflow* code
|
|
43
|
+
* as a Workflow Task failure — presumed to be a transient code bug or
|
|
44
|
+
* non-determinism — and retries the task indefinitely, leaving the execution
|
|
45
|
+
* silently `Running` forever (it looks like the worker "hung"). Only a
|
|
46
|
+
* `TemporalFailure` such as `ApplicationFailure` fails the Workflow Execution
|
|
47
|
+
* terminally. The same logic applies at the activity boundary, where Temporal's
|
|
48
|
+
* default retry policy has unlimited attempts: a plain `Error` would retry
|
|
49
|
+
* forever too.
|
|
50
|
+
*
|
|
51
|
+
* Contract validation failures are deterministic — the schema is static, so bad
|
|
52
|
+
* input/output never becomes valid on replay or retry — so they are surfaced as
|
|
53
|
+
* non-retryable, failing fast with a clear error instead of an infinite retry
|
|
54
|
+
* loop.
|
|
55
|
+
*
|
|
56
|
+
* The concrete subclass name is passed through as the failure `type`, so it
|
|
57
|
+
* stays discriminable after crossing Temporal's serialization boundary (where
|
|
58
|
+
* the JS class identity is lost) via `failure.type`. The failing field path is
|
|
59
|
+
* carried in the human-readable `message` (see {@link summarizeIssues}). The
|
|
60
|
+
* raw `issues` remain available as a property for in-process inspection.
|
|
61
|
+
*
|
|
62
|
+
* See issue #251.
|
|
63
|
+
*/
|
|
64
|
+
declare abstract class ValidationError extends ApplicationFailure {
|
|
65
|
+
readonly issues: ReadonlyArray<StandardSchemaV1.Issue>;
|
|
66
|
+
protected constructor(message: string, type: string, issues: ReadonlyArray<StandardSchemaV1.Issue>);
|
|
67
|
+
}
|
|
68
|
+
declare const ActivityDefinitionNotFoundError_base: import("unthrown").TaggedErrorConstructor<"@temporal-contract/ActivityDefinitionNotFoundError">;
|
|
69
|
+
/**
|
|
70
|
+
* Error thrown when an activity definition is not found in the contract
|
|
71
|
+
*/
|
|
72
|
+
declare class ActivityDefinitionNotFoundError extends ActivityDefinitionNotFoundError_base<{
|
|
73
|
+
activityName: string;
|
|
74
|
+
availableDefinitions: readonly string[];
|
|
75
|
+
message: string;
|
|
76
|
+
}> {
|
|
77
|
+
constructor(activityName: string, availableDefinitions?: readonly string[]);
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Error thrown when activity input validation fails
|
|
81
|
+
*/
|
|
82
|
+
declare class ActivityInputValidationError extends ValidationError {
|
|
83
|
+
readonly activityName: string;
|
|
84
|
+
constructor(activityName: string, issues: ReadonlyArray<StandardSchemaV1.Issue>);
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Error thrown when activity output validation fails
|
|
88
|
+
*/
|
|
89
|
+
declare class ActivityOutputValidationError extends ValidationError {
|
|
90
|
+
readonly activityName: string;
|
|
91
|
+
constructor(activityName: string, issues: ReadonlyArray<StandardSchemaV1.Issue>);
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Error thrown when workflow input validation fails
|
|
95
|
+
*/
|
|
96
|
+
declare class WorkflowInputValidationError extends ValidationError {
|
|
97
|
+
readonly workflowName: string;
|
|
98
|
+
constructor(workflowName: string, issues: ReadonlyArray<StandardSchemaV1.Issue>);
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Error thrown when workflow output validation fails
|
|
102
|
+
*/
|
|
103
|
+
declare class WorkflowOutputValidationError extends ValidationError {
|
|
104
|
+
readonly workflowName: string;
|
|
105
|
+
constructor(workflowName: string, issues: ReadonlyArray<StandardSchemaV1.Issue>);
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Error thrown when signal input validation fails
|
|
109
|
+
*/
|
|
110
|
+
declare class SignalInputValidationError extends ValidationError {
|
|
111
|
+
readonly signalName: string;
|
|
112
|
+
constructor(signalName: string, issues: ReadonlyArray<StandardSchemaV1.Issue>);
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Error thrown when query input validation fails
|
|
116
|
+
*/
|
|
117
|
+
declare class QueryInputValidationError extends ValidationError {
|
|
118
|
+
readonly queryName: string;
|
|
119
|
+
constructor(queryName: string, issues: ReadonlyArray<StandardSchemaV1.Issue>);
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* Error thrown when query output validation fails
|
|
123
|
+
*/
|
|
124
|
+
declare class QueryOutputValidationError extends ValidationError {
|
|
125
|
+
readonly queryName: string;
|
|
126
|
+
constructor(queryName: string, issues: ReadonlyArray<StandardSchemaV1.Issue>);
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* Error thrown when update input validation fails
|
|
130
|
+
*/
|
|
131
|
+
declare class UpdateInputValidationError extends ValidationError {
|
|
132
|
+
readonly updateName: string;
|
|
133
|
+
constructor(updateName: string, issues: ReadonlyArray<StandardSchemaV1.Issue>);
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* Error thrown when update output validation fails
|
|
137
|
+
*/
|
|
138
|
+
declare class UpdateOutputValidationError extends ValidationError {
|
|
139
|
+
readonly updateName: string;
|
|
140
|
+
constructor(updateName: string, issues: ReadonlyArray<StandardSchemaV1.Issue>);
|
|
141
|
+
}
|
|
142
|
+
declare const ChildWorkflowNotFoundError_base: import("unthrown").TaggedErrorConstructor<"@temporal-contract/ChildWorkflowNotFoundError">;
|
|
143
|
+
/**
|
|
144
|
+
* Error thrown when a child workflow is not found in the contract
|
|
145
|
+
*/
|
|
146
|
+
declare class ChildWorkflowNotFoundError extends ChildWorkflowNotFoundError_base<{
|
|
147
|
+
workflowName: string;
|
|
148
|
+
availableWorkflows: readonly string[];
|
|
149
|
+
message: string;
|
|
150
|
+
}> {
|
|
151
|
+
constructor(workflowName: string, availableWorkflows?: readonly string[]);
|
|
152
|
+
}
|
|
153
|
+
declare const ChildWorkflowError_base: import("unthrown").TaggedErrorConstructor<"@temporal-contract/ChildWorkflowError">;
|
|
154
|
+
/**
|
|
155
|
+
* Generic error for child workflow operations.
|
|
156
|
+
*
|
|
157
|
+
* When the child execution itself fails (Temporal's `ChildWorkflowFailure`),
|
|
158
|
+
* `cause` is set to the *unwrapped* underlying failure (`ApplicationFailure`,
|
|
159
|
+
* `TimeoutFailure`, `TerminatedFailure`, etc.) lifted from Temporal's wrapper —
|
|
160
|
+
* mirroring the client-side `WorkflowFailedError.cause` behavior, so callers
|
|
161
|
+
* can branch on the failure category in one step instead of unwrapping twice.
|
|
162
|
+
*/
|
|
163
|
+
declare class ChildWorkflowError extends ChildWorkflowError_base<{
|
|
164
|
+
message: string;
|
|
165
|
+
cause?: unknown;
|
|
166
|
+
}> {
|
|
167
|
+
constructor(message: string, cause?: unknown);
|
|
168
|
+
}
|
|
169
|
+
declare const ChildWorkflowCancelledError_base: import("unthrown").TaggedErrorConstructor<"@temporal-contract/ChildWorkflowCancelledError">;
|
|
170
|
+
/**
|
|
171
|
+
* Discriminated variant surfaced when a child workflow operation (start,
|
|
172
|
+
* execute, or wait-for-result) was cancelled — either because the parent
|
|
173
|
+
* workflow itself was cancelled, the child was explicitly cancelled, or its
|
|
174
|
+
* enclosing cancellation scope was. Detected via `@temporalio/workflow`'s
|
|
175
|
+
* `isCancellation(...)`, which sees through nested `ChildWorkflowFailure` /
|
|
176
|
+
* `CancelledFailure` chains.
|
|
177
|
+
*
|
|
178
|
+
* A sibling of {@link ChildWorkflowError} rather than a subclass: both are
|
|
179
|
+
* distinct {@link TaggedError}s, so call sites discriminate on the `_tag`
|
|
180
|
+
* (or `instanceof ChildWorkflowCancelledError`) instead of relying on an
|
|
181
|
+
* `instanceof ChildWorkflowError` that also matches cancellation. `matchTags`
|
|
182
|
+
* folds the `ChildWorkflowError | ChildWorkflowCancelledError` union
|
|
183
|
+
* exhaustively.
|
|
184
|
+
*/
|
|
185
|
+
declare class ChildWorkflowCancelledError extends ChildWorkflowCancelledError_base<{
|
|
186
|
+
workflowName: string;
|
|
187
|
+
cause?: unknown;
|
|
188
|
+
message: string;
|
|
189
|
+
}> {
|
|
190
|
+
constructor(workflowName: string, cause?: unknown);
|
|
191
|
+
}
|
|
192
|
+
declare const WorkflowCancelledError_base: import("unthrown").TaggedErrorConstructor<"@temporal-contract/WorkflowCancelledError">;
|
|
193
|
+
/**
|
|
194
|
+
* Error surfaced in the `err(...)` branch of an `AsyncResult` when a typed
|
|
195
|
+
* cancellation scope is cancelled via Temporal's cancellation propagation.
|
|
196
|
+
* Returned by both `context.cancellableScope` (when the workflow or an
|
|
197
|
+
* ancestor scope cancels) and `context.nonCancellableScope` (when
|
|
198
|
+
* cancellation is raised from inside the scope). Distinct from arbitrary
|
|
199
|
+
* thrown errors so call sites can branch on cancellation explicitly.
|
|
200
|
+
*
|
|
201
|
+
* Non-cancellation errors thrown inside a scope are *unmodeled* failures: they
|
|
202
|
+
* surface on the scope's `defect` channel (re-thrown at the edge / inspectable
|
|
203
|
+
* via `result.isDefect()` and `result.cause`), not as a typed `err(...)`.
|
|
204
|
+
*/
|
|
205
|
+
declare class WorkflowCancelledError extends WorkflowCancelledError_base<{
|
|
206
|
+
cause?: unknown;
|
|
207
|
+
message: string;
|
|
208
|
+
}> {
|
|
209
|
+
constructor(cause?: unknown);
|
|
210
|
+
}
|
|
211
|
+
//#endregion
|
|
212
|
+
export { ClientInferOutput as _, ChildWorkflowError as a, QueryOutputValidationError as c, UpdateOutputValidationError as d, ValidationError as f, ClientInferInput as g, WorkflowOutputValidationError as h, ChildWorkflowCancelledError as i, SignalInputValidationError as l, WorkflowInputValidationError as m, ActivityInputValidationError as n, ChildWorkflowNotFoundError as o, WorkflowCancelledError as p, ActivityOutputValidationError as r, QueryInputValidationError as s, ActivityDefinitionNotFoundError as t, UpdateInputValidationError as u, WorkerInferInput as v, WorkerInferOutput as y };
|
|
213
|
+
//# sourceMappingURL=errors-BNnNzSwE.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors-BNnNzSwE.d.mts","names":[],"sources":["../src/types.ts","../src/errors.ts"],"mappings":";;;;;;;;AAOA;KAAY,gBAAA;EAA6B,KAAA,EAAO,SAAA;AAAA,KAAe,gBAAA,CAAiB,WAAA,CAC9E,CAAA;;;;;KAOU,iBAAA;EAA8B,MAAA,EAAQ,SAAA;AAAA,KAAe,gBAAA,CAAiB,UAAA,CAChF,CAAA;;;;;KAOU,gBAAA;EAA6B,KAAA,EAAO,SAAA;AAAA,KAAe,gBAAA,CAAiB,UAAA,CAC9E,CAAA;;;;;KAOU,iBAAA;EAA8B,MAAA,EAAQ,SAAA;AAAA,KAAe,gBAAA,CAAiB,WAAA,CAChF,CAAA;;;;;;AAzBF;;;;;;;;;;;;;;;AACG;AAOH;;;;;;;;;uBCkBsB,eAAA,SAAwB,kBAAA;EAAA,SAI1B,MAAA,EAAQ,aAAA,CAAc,gBAAA,CAAiB,KAAA;EAAA,UAHhD,WAAA,CACP,OAAA,UACA,IAAA,UACgB,MAAA,EAAQ,aAAA,CAAc,gBAAA,CAAiB,KAAA;AAAA;AAAA,cAqB1D,oCAAA;;AD1CE;AAOH;cCw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