@temporal-contract/worker 2.3.0 → 2.4.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.
@@ -1,6 +1,6 @@
1
1
  import { summarizeIssues } from "@temporal-contract/contract";
2
+ import { ApplicationFailure, ChildWorkflowFailure } from "@temporalio/common";
2
3
  import { isCancellation, makeContinueAsNewFunc, proxyActivities } from "@temporalio/workflow";
3
- import { ChildWorkflowFailure } from "@temporalio/common";
4
4
  import { _internal_makeResultAsync as makeResultAsync } from "@temporal-contract/contract/result-async";
5
5
  //#region src/errors.ts
6
6
  /**
@@ -14,6 +14,48 @@ var WorkerError = class extends Error {
14
14
  }
15
15
  };
16
16
  /**
17
+ * Base class for the contract's runtime validation failures — workflow and
18
+ * activity input/output, plus signal/query/update payloads.
19
+ *
20
+ * These extend Temporal's {@link ApplicationFailure} with `nonRetryable: true`
21
+ * rather than a plain `Error`, and that distinction is load-bearing. The
22
+ * TypeScript SDK classifies a non-`TemporalFailure` thrown from *workflow* code
23
+ * as a Workflow Task failure — presumed to be a transient code bug or
24
+ * non-determinism — and retries the task indefinitely, leaving the execution
25
+ * silently `Running` forever (it looks like the worker "hung"). Only a
26
+ * `TemporalFailure` such as `ApplicationFailure` fails the Workflow Execution
27
+ * terminally. The same logic applies at the activity boundary, where Temporal's
28
+ * default retry policy has unlimited attempts: a plain `Error` would retry
29
+ * forever too.
30
+ *
31
+ * Contract validation failures are deterministic — the schema is static, so bad
32
+ * input/output never becomes valid on replay or retry — so they are surfaced as
33
+ * non-retryable, failing fast with a clear error instead of an infinite retry
34
+ * loop.
35
+ *
36
+ * The concrete subclass name is passed through as the failure `type`, so it
37
+ * stays discriminable after crossing Temporal's serialization boundary (where
38
+ * the JS class identity is lost) via `failure.type`. The failing field path is
39
+ * carried in the human-readable `message` (see {@link summarizeIssues}). The
40
+ * raw `issues` remain available as a property for in-process inspection.
41
+ *
42
+ * See issue #251.
43
+ */
44
+ var ValidationError = class extends ApplicationFailure {
45
+ issues;
46
+ constructor(message, type, issues) {
47
+ super(message, type, true);
48
+ this.issues = issues;
49
+ Object.defineProperty(this, "name", {
50
+ value: type,
51
+ writable: true,
52
+ configurable: true,
53
+ enumerable: true
54
+ });
55
+ if (Error.captureStackTrace) Error.captureStackTrace(this, this.constructor);
56
+ }
57
+ };
58
+ /**
17
59
  * Error thrown when an activity definition is not found in the contract
18
60
  */
19
61
  var ActivityDefinitionNotFoundError = class extends WorkerError {
@@ -30,127 +72,100 @@ var ActivityDefinitionNotFoundError = class extends WorkerError {
30
72
  /**
31
73
  * Error thrown when activity input validation fails
32
74
  */
33
- var ActivityInputValidationError = class extends WorkerError {
75
+ var ActivityInputValidationError = class extends ValidationError {
34
76
  activityName;
35
- issues;
36
77
  constructor(activityName, issues) {
37
78
  const message = summarizeIssues(issues);
38
- super(`Activity "${activityName}" input validation failed: ${message}`);
79
+ super(`Activity "${activityName}" input validation failed: ${message}`, "ActivityInputValidationError", issues);
39
80
  this.activityName = activityName;
40
- this.issues = issues;
41
- this.name = "ActivityInputValidationError";
42
81
  }
43
82
  };
44
83
  /**
45
84
  * Error thrown when activity output validation fails
46
85
  */
47
- var ActivityOutputValidationError = class extends WorkerError {
86
+ var ActivityOutputValidationError = class extends ValidationError {
48
87
  activityName;
49
- issues;
50
88
  constructor(activityName, issues) {
51
89
  const message = summarizeIssues(issues);
52
- super(`Activity "${activityName}" output validation failed: ${message}`);
90
+ super(`Activity "${activityName}" output validation failed: ${message}`, "ActivityOutputValidationError", issues);
53
91
  this.activityName = activityName;
54
- this.issues = issues;
55
- this.name = "ActivityOutputValidationError";
56
92
  }
57
93
  };
58
94
  /**
59
95
  * Error thrown when workflow input validation fails
60
96
  */
61
- var WorkflowInputValidationError = class extends WorkerError {
97
+ var WorkflowInputValidationError = class extends ValidationError {
62
98
  workflowName;
63
- issues;
64
99
  constructor(workflowName, issues) {
65
100
  const message = summarizeIssues(issues);
66
- super(`Workflow "${workflowName}" input validation failed: ${message}`);
101
+ super(`Workflow "${workflowName}" input validation failed: ${message}`, "WorkflowInputValidationError", issues);
67
102
  this.workflowName = workflowName;
68
- this.issues = issues;
69
- this.name = "WorkflowInputValidationError";
70
103
  }
71
104
  };
72
105
  /**
73
106
  * Error thrown when workflow output validation fails
74
107
  */
75
- var WorkflowOutputValidationError = class extends WorkerError {
108
+ var WorkflowOutputValidationError = class extends ValidationError {
76
109
  workflowName;
77
- issues;
78
110
  constructor(workflowName, issues) {
79
111
  const message = summarizeIssues(issues);
80
- super(`Workflow "${workflowName}" output validation failed: ${message}`);
112
+ super(`Workflow "${workflowName}" output validation failed: ${message}`, "WorkflowOutputValidationError", issues);
81
113
  this.workflowName = workflowName;
82
- this.issues = issues;
83
- this.name = "WorkflowOutputValidationError";
84
114
  }
85
115
  };
86
116
  /**
87
117
  * Error thrown when signal input validation fails
88
118
  */
89
- var SignalInputValidationError = class extends WorkerError {
119
+ var SignalInputValidationError = class extends ValidationError {
90
120
  signalName;
91
- issues;
92
121
  constructor(signalName, issues) {
93
122
  const message = summarizeIssues(issues);
94
- super(`Signal "${signalName}" input validation failed: ${message}`);
123
+ super(`Signal "${signalName}" input validation failed: ${message}`, "SignalInputValidationError", issues);
95
124
  this.signalName = signalName;
96
- this.issues = issues;
97
- this.name = "SignalInputValidationError";
98
125
  }
99
126
  };
100
127
  /**
101
128
  * Error thrown when query input validation fails
102
129
  */
103
- var QueryInputValidationError = class extends WorkerError {
130
+ var QueryInputValidationError = class extends ValidationError {
104
131
  queryName;
105
- issues;
106
132
  constructor(queryName, issues) {
107
133
  const message = summarizeIssues(issues);
108
- super(`Query "${queryName}" input validation failed: ${message}`);
134
+ super(`Query "${queryName}" input validation failed: ${message}`, "QueryInputValidationError", issues);
109
135
  this.queryName = queryName;
110
- this.issues = issues;
111
- this.name = "QueryInputValidationError";
112
136
  }
113
137
  };
114
138
  /**
115
139
  * Error thrown when query output validation fails
116
140
  */
117
- var QueryOutputValidationError = class extends WorkerError {
141
+ var QueryOutputValidationError = class extends ValidationError {
118
142
  queryName;
119
- issues;
120
143
  constructor(queryName, issues) {
121
144
  const message = summarizeIssues(issues);
122
- super(`Query "${queryName}" output validation failed: ${message}`);
145
+ super(`Query "${queryName}" output validation failed: ${message}`, "QueryOutputValidationError", issues);
123
146
  this.queryName = queryName;
124
- this.issues = issues;
125
- this.name = "QueryOutputValidationError";
126
147
  }
127
148
  };
128
149
  /**
129
150
  * Error thrown when update input validation fails
130
151
  */
131
- var UpdateInputValidationError = class extends WorkerError {
152
+ var UpdateInputValidationError = class extends ValidationError {
132
153
  updateName;
133
- issues;
134
154
  constructor(updateName, issues) {
135
155
  const message = summarizeIssues(issues);
136
- super(`Update "${updateName}" input validation failed: ${message}`);
156
+ super(`Update "${updateName}" input validation failed: ${message}`, "UpdateInputValidationError", issues);
137
157
  this.updateName = updateName;
138
- this.issues = issues;
139
- this.name = "UpdateInputValidationError";
140
158
  }
141
159
  };
142
160
  /**
143
161
  * Error thrown when update output validation fails
144
162
  */
145
- var UpdateOutputValidationError = class extends WorkerError {
163
+ var UpdateOutputValidationError = class extends ValidationError {
146
164
  updateName;
147
- issues;
148
165
  constructor(updateName, issues) {
149
166
  const message = summarizeIssues(issues);
150
- super(`Update "${updateName}" output validation failed: ${message}`);
167
+ super(`Update "${updateName}" output validation failed: ${message}`, "UpdateOutputValidationError", issues);
151
168
  this.updateName = updateName;
152
- this.issues = issues;
153
- this.name = "UpdateOutputValidationError";
154
169
  }
155
170
  };
156
171
  /**
@@ -450,6 +465,6 @@ function describeChildWorkflowOperation(operation, childWorkflowName) {
450
465
  }
451
466
  }
452
467
  //#endregion
453
- export { UpdateOutputValidationError as _, formatChildWorkflowValidationMessage as a, WorkflowOutputValidationError as b, ActivityInputValidationError as c, ChildWorkflowError as d, ChildWorkflowNotFoundError as f, UpdateInputValidationError as g, SignalInputValidationError as h, extractHandlerInput as i, ActivityOutputValidationError as l, QueryOutputValidationError as m, classifyChildWorkflowError as n, makeResultAsync as o, QueryInputValidationError as p, createContinueAsNew as r, ActivityDefinitionNotFoundError as s, buildRawActivitiesProxy as t, ChildWorkflowCancelledError as u, WorkflowCancelledError as v, WorkflowScopeError as x, WorkflowInputValidationError as y };
468
+ export { WorkflowScopeError as S, UpdateOutputValidationError as _, formatChildWorkflowValidationMessage as a, WorkflowInputValidationError as b, ActivityInputValidationError as c, ChildWorkflowError as d, ChildWorkflowNotFoundError as f, UpdateInputValidationError as g, SignalInputValidationError as h, extractHandlerInput as i, ActivityOutputValidationError as l, QueryOutputValidationError as m, classifyChildWorkflowError as n, makeResultAsync as o, QueryInputValidationError as p, createContinueAsNew as r, ActivityDefinitionNotFoundError as s, buildRawActivitiesProxy as t, ChildWorkflowCancelledError as u, ValidationError as v, WorkflowOutputValidationError as x, WorkflowCancelledError as y };
454
469
 
455
- //# sourceMappingURL=internal-D8Dl9D43.mjs.map
470
+ //# sourceMappingURL=internal-D0wfFl0y.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"internal-D0wfFl0y.mjs","names":[],"sources":["../src/errors.ts","../src/internal.ts"],"sourcesContent":["import type { StandardSchemaV1 } from \"@standard-schema/spec\";\nimport { summarizeIssues } from \"@temporal-contract/contract\";\nimport { ApplicationFailure } from \"@temporalio/common\";\n\n/**\n * Base error class for worker errors\n */\nabstract class WorkerError extends Error {\n protected constructor(message: string, cause?: unknown) {\n super(message, { cause });\n this.name = \"WorkerError\";\n // Maintains proper stack trace for where our error was thrown (only available on V8)\n if (Error.captureStackTrace) {\n Error.captureStackTrace(this, this.constructor);\n }\n }\n}\n\n/**\n * Base class for the contract's runtime validation failures — workflow and\n * activity input/output, plus signal/query/update payloads.\n *\n * These extend Temporal's {@link ApplicationFailure} with `nonRetryable: true`\n * rather than a plain `Error`, and that distinction is load-bearing. The\n * TypeScript SDK classifies a non-`TemporalFailure` thrown from *workflow* code\n * as a Workflow Task failure — presumed to be a transient code bug or\n * non-determinism — and retries the task indefinitely, leaving the execution\n * silently `Running` forever (it looks like the worker \"hung\"). Only a\n * `TemporalFailure` such as `ApplicationFailure` fails the Workflow Execution\n * terminally. The same logic applies at the activity boundary, where Temporal's\n * default retry policy has unlimited attempts: a plain `Error` would retry\n * forever too.\n *\n * Contract validation failures are deterministic — the schema is static, so bad\n * input/output never becomes valid on replay or retry — so they are surfaced as\n * non-retryable, failing fast with a clear error instead of an infinite retry\n * loop.\n *\n * The concrete subclass name is passed through as the failure `type`, so it\n * stays discriminable after crossing Temporal's serialization boundary (where\n * the JS class identity is lost) via `failure.type`. The failing field path is\n * carried in the human-readable `message` (see {@link summarizeIssues}). The\n * raw `issues` remain available as a property for in-process inspection.\n *\n * See issue #251.\n */\nexport abstract class ValidationError extends ApplicationFailure {\n protected constructor(\n message: string,\n type: string,\n public readonly issues: ReadonlyArray<StandardSchemaV1.Issue>,\n ) {\n // (message, type, nonRetryable) — terminal, deterministic failure.\n super(message, type, true);\n // `ApplicationFailure`'s `SymbolBasedInstanceOfError` decorator installs a\n // read-only `name` (\"ApplicationFailure\") on the prototype, so a plain\n // `this.name = type` assignment throws. Define an own property to shadow it\n // and surface the concrete subclass name (matching `type`). `writable: true`\n // keeps the field reassignable, matching the previous `this.name = ...`\n // behaviour so consumers (e.g. error-wrapping code) can still adjust it.\n Object.defineProperty(this, \"name\", {\n value: type,\n writable: true,\n configurable: true,\n enumerable: true,\n });\n // Maintains proper stack trace for where our error was thrown (only available on V8)\n if (Error.captureStackTrace) {\n Error.captureStackTrace(this, this.constructor);\n }\n }\n}\n\n/**\n * Error thrown when an activity definition is not found in the contract\n */\nexport class ActivityDefinitionNotFoundError extends WorkerError {\n constructor(\n public readonly activityName: string,\n public readonly availableDefinitions: readonly string[] = [],\n ) {\n const available = availableDefinitions.length > 0 ? availableDefinitions.join(\", \") : \"none\";\n super(\n `Activity definition not found for: \"${activityName}\". Available activities: ${available}`,\n );\n this.name = \"ActivityDefinitionNotFoundError\";\n }\n}\n\n/**\n * Error thrown when activity input validation fails\n */\nexport class ActivityInputValidationError extends ValidationError {\n constructor(\n public readonly activityName: string,\n issues: ReadonlyArray<StandardSchemaV1.Issue>,\n ) {\n const message = summarizeIssues(issues);\n super(\n `Activity \"${activityName}\" input validation failed: ${message}`,\n \"ActivityInputValidationError\",\n issues,\n );\n }\n}\n\n/**\n * Error thrown when activity output validation fails\n */\nexport class ActivityOutputValidationError extends ValidationError {\n constructor(\n public readonly activityName: string,\n issues: ReadonlyArray<StandardSchemaV1.Issue>,\n ) {\n const message = summarizeIssues(issues);\n super(\n `Activity \"${activityName}\" output validation failed: ${message}`,\n \"ActivityOutputValidationError\",\n issues,\n );\n }\n}\n\n/**\n * Error thrown when workflow input validation fails\n */\nexport class WorkflowInputValidationError extends ValidationError {\n constructor(\n public readonly workflowName: string,\n issues: ReadonlyArray<StandardSchemaV1.Issue>,\n ) {\n const message = summarizeIssues(issues);\n super(\n `Workflow \"${workflowName}\" input validation failed: ${message}`,\n \"WorkflowInputValidationError\",\n issues,\n );\n }\n}\n\n/**\n * Error thrown when workflow output validation fails\n */\nexport class WorkflowOutputValidationError extends ValidationError {\n constructor(\n public readonly workflowName: string,\n issues: ReadonlyArray<StandardSchemaV1.Issue>,\n ) {\n const message = summarizeIssues(issues);\n super(\n `Workflow \"${workflowName}\" output validation failed: ${message}`,\n \"WorkflowOutputValidationError\",\n issues,\n );\n }\n}\n\n/**\n * Error thrown when signal input validation fails\n */\nexport class SignalInputValidationError extends ValidationError {\n constructor(\n public readonly signalName: string,\n issues: ReadonlyArray<StandardSchemaV1.Issue>,\n ) {\n const message = summarizeIssues(issues);\n super(\n `Signal \"${signalName}\" input validation failed: ${message}`,\n \"SignalInputValidationError\",\n issues,\n );\n }\n}\n\n/**\n * Error thrown when query input validation fails\n */\nexport class QueryInputValidationError extends ValidationError {\n constructor(\n public readonly queryName: string,\n issues: ReadonlyArray<StandardSchemaV1.Issue>,\n ) {\n const message = summarizeIssues(issues);\n super(\n `Query \"${queryName}\" input validation failed: ${message}`,\n \"QueryInputValidationError\",\n issues,\n );\n }\n}\n\n/**\n * Error thrown when query output validation fails\n */\nexport class QueryOutputValidationError extends ValidationError {\n constructor(\n public readonly queryName: string,\n issues: ReadonlyArray<StandardSchemaV1.Issue>,\n ) {\n const message = summarizeIssues(issues);\n super(\n `Query \"${queryName}\" output validation failed: ${message}`,\n \"QueryOutputValidationError\",\n issues,\n );\n }\n}\n\n/**\n * Error thrown when update input validation fails\n */\nexport class UpdateInputValidationError extends ValidationError {\n constructor(\n public readonly updateName: string,\n issues: ReadonlyArray<StandardSchemaV1.Issue>,\n ) {\n const message = summarizeIssues(issues);\n super(\n `Update \"${updateName}\" input validation failed: ${message}`,\n \"UpdateInputValidationError\",\n issues,\n );\n }\n}\n\n/**\n * Error thrown when update output validation fails\n */\nexport class UpdateOutputValidationError extends ValidationError {\n constructor(\n public readonly updateName: string,\n issues: ReadonlyArray<StandardSchemaV1.Issue>,\n ) {\n const message = summarizeIssues(issues);\n super(\n `Update \"${updateName}\" output validation failed: ${message}`,\n \"UpdateOutputValidationError\",\n issues,\n );\n }\n}\n\n/**\n * Error thrown when a child workflow is not found in the contract\n */\nexport class ChildWorkflowNotFoundError extends WorkerError {\n constructor(\n public readonly workflowName: string,\n public readonly availableWorkflows: readonly string[] = [],\n ) {\n const available = availableWorkflows.length > 0 ? availableWorkflows.join(\", \") : \"none\";\n super(`Child workflow not found: \"${workflowName}\". Available workflows: ${available}`);\n this.name = \"ChildWorkflowNotFoundError\";\n }\n}\n\n/**\n * Generic error for child workflow operations.\n *\n * When the child execution itself fails (Temporal's `ChildWorkflowFailure`),\n * `cause` is set to the *unwrapped* underlying failure (`ApplicationFailure`,\n * `TimeoutFailure`, `TerminatedFailure`, etc.) lifted from Temporal's wrapper —\n * mirroring the client-side `WorkflowFailedError.cause` behavior, so callers\n * can branch on the failure category in one step instead of unwrapping twice.\n */\nexport class ChildWorkflowError extends WorkerError {\n constructor(message: string, cause?: unknown) {\n super(message, cause);\n this.name = \"ChildWorkflowError\";\n }\n}\n\n/**\n * Discriminated variant of {@link ChildWorkflowError} surfaced when a child\n * workflow operation (start, execute, or wait-for-result) was cancelled —\n * either because the parent workflow itself was cancelled, the child was\n * explicitly cancelled, or its enclosing cancellation scope was. Detected via\n * `@temporalio/workflow`'s `isCancellation(...)`, which sees through nested\n * `ChildWorkflowFailure` / `CancelledFailure` chains.\n *\n * Extends {@link ChildWorkflowError} so existing `instanceof ChildWorkflowError`\n * checks still match cancellation, while `instanceof ChildWorkflowCancelledError`\n * lets call sites narrow further when they need to branch on cancellation\n * explicitly without inspecting `error.cause` against a Temporal SDK class —\n * the worker-side analogue of the client-side cause-forwarding pattern.\n */\nexport class ChildWorkflowCancelledError extends ChildWorkflowError {\n constructor(\n public readonly workflowName: string,\n cause?: unknown,\n ) {\n super(`Child workflow \"${workflowName}\" was cancelled`, cause);\n this.name = \"ChildWorkflowCancelledError\";\n }\n}\n\n/**\n * Error surfaced in the `err(...)` branch of a `ResultAsync` when a typed\n * cancellation scope is cancelled via Temporal's cancellation propagation.\n * Returned by both `context.cancellableScope` (when the workflow or an\n * ancestor scope cancels) and `context.nonCancellableScope` (when\n * cancellation is raised from inside the scope). Distinct from arbitrary\n * thrown errors so call sites can branch on cancellation explicitly.\n *\n * Non-cancellation errors thrown inside a scope surface as a sibling\n * {@link WorkflowScopeError} on the same `err(...)` channel, so callers can\n * use `instanceof` to discriminate without falling back to `try/catch`.\n */\nexport class WorkflowCancelledError extends WorkerError {\n constructor(cause?: unknown) {\n super(\"Workflow cancellation scope was cancelled\", cause);\n this.name = \"WorkflowCancelledError\";\n }\n}\n\n/**\n * Error surfaced in the `err(...)` branch of a `ResultAsync` when the\n * function passed to `cancellableScope` / `nonCancellableScope` throws a\n * non-cancellation error.\n *\n * The original error is preserved on `cause` so call sites can introspect\n * it without losing identity:\n *\n * @example\n * ```ts\n * const result = await context.cancellableScope(async () => {\n * return await context.activities.processStep(args);\n * });\n *\n * if (result.isErr()) {\n * if (result.error instanceof WorkflowCancelledError) {\n * // graceful cancellation\n * } else if (result.error instanceof WorkflowScopeError) {\n * // domain error — `result.error.cause` is the original throwable\n * }\n * }\n * ```\n *\n * Introduced so the scope helpers route every failure through neverthrow's\n * railway. Previously, non-cancellation errors were re-thrown out of the\n * helper, which became a `ResultAsync` rejection (`new ResultAsync(promise)`\n * does not catch) — they leaked as unhandled rejections rather than\n * surfacing on the typed error channel callers actually inspect.\n */\nexport class WorkflowScopeError extends WorkerError {\n constructor(cause: unknown) {\n const message =\n cause instanceof Error\n ? `Workflow cancellation scope caught a non-cancellation error: ${cause.message}`\n : \"Workflow cancellation scope caught a non-cancellation error\";\n super(message, cause);\n this.name = \"WorkflowScopeError\";\n }\n}\n","/**\n * Internal helpers shared across the worker package's entry points.\n *\n * Not part of the public API — this module is not listed in the package's\n * `exports` map, so consumers can't import from `@temporal-contract/worker/internal`.\n * In-package tests import it directly via relative path.\n */\nimport { isCancellation, makeContinueAsNewFunc, proxyActivities } from \"@temporalio/workflow\";\nimport type { ActivityOptions, ContinueAsNewOptions } from \"@temporalio/workflow\";\nimport { ChildWorkflowFailure } from \"@temporalio/common\";\nimport type { StandardSchemaV1 } from \"@standard-schema/spec\";\nimport {\n type ActivityDefinition,\n type ContractDefinition,\n summarizeIssues,\n} from \"@temporal-contract/contract\";\nimport {\n ChildWorkflowCancelledError,\n ChildWorkflowError,\n ChildWorkflowNotFoundError,\n WorkflowInputValidationError,\n} from \"./errors.js\";\n\n/**\n * Build the message attached to a `ChildWorkflowError` for input/output\n * validation failures. Centralized so the worker formats child-workflow\n * validation diagnostics identically across call sites. Composes the shared\n * `summarizeIssues` from `@temporal-contract/contract`.\n */\nexport function formatChildWorkflowValidationMessage(\n workflowName: string,\n direction: \"input\" | \"output\",\n issues: ReadonlyArray<StandardSchemaV1.Issue>,\n): string {\n return `Child workflow \"${workflowName}\" ${direction} validation failed: ${summarizeIssues(issues)}`;\n}\n\n// Re-export the shared `_internal_makeResultAsync` helper from the contract\n// package so worker call sites can wrap their `() => Promise<Result<T, E>>`\n// work functions identically to the client side. This closes the\n// `new ResultAsync(work())` gap — the bare constructor doesn't catch\n// rejections, so a synchronous throw or a rejected promise from `work()`\n// would otherwise escape neverthrow's railway as an unhandled rejection.\nexport { _internal_makeResultAsync as makeResultAsync } from \"@temporal-contract/contract/result-async\";\n\n/**\n * Extract the single payload from a Temporal handler's `...args` array.\n *\n * Temporal invokes handlers with whatever was passed via `args: [...]` at the\n * call site. The typed-contract layer always sends `args: [validatedInput]`,\n * so the common case is a one-element array containing the wrapped input.\n *\n * If a non-typed-contract caller passes multiple positional arguments\n * (`args: [a, b, c]`), we surface the whole array as the input — the schema\n * will then reject it unless the contract specifically modeled a tuple.\n */\nexport function extractHandlerInput(args: unknown[]): unknown {\n return args.length === 1 ? args[0] : args;\n}\n\ntype ActivityFn = (...args: unknown[]) => Promise<unknown>;\n\n/**\n * Build the raw `Record<name, fn>` proxy of activities for a workflow,\n * applying per-activity `ActivityOptions` overrides where requested.\n *\n * **Fast path (no overrides):** a single `proxyActivities(defaultOptions)`\n * call is made and returned directly. The proxy synthesizes a function for\n * any property access by name, so downstream code that looks up\n * `proxy[activityName]` works identically to before.\n *\n * **Override path:** one extra `proxyActivities(merged)` call is made *only*\n * for each activity that has an override. Activities without an entry keep\n * using the single default proxy. The result is a `Proxy` that returns the\n * override-bound function for named keys and falls back to the default proxy\n * for everything else — so the per-execution overhead scales with the number\n * of overrides, not the number of activities.\n *\n * Per-override merge is shallow: the override's properties replace the\n * default's, including the entire nested `retry` block. This matches\n * Temporal's \"one ActivityOptions per `proxyActivities` call\" semantics.\n */\nexport function buildRawActivitiesProxy(\n workflowActivities: Record<string, ActivityDefinition> | undefined,\n contractActivities: Record<string, ActivityDefinition> | undefined,\n defaultOptions: ActivityOptions,\n overrides: Partial<Record<string, ActivityOptions>> | undefined,\n): Record<string, ActivityFn> {\n const defaultProxy = proxyActivities<Record<string, ActivityFn>>(defaultOptions);\n\n // Fast path: no overrides → use the single default proxy directly.\n // (`createValidatedActivities` accesses by name, so the Proxy's get-trap\n // suffices; we don't need an enumerable map.)\n const overrideEntries = overrides\n ? Object.entries(overrides).filter(\n (entry): entry is [string, ActivityOptions] => entry[1] !== undefined,\n )\n : [];\n if (overrideEntries.length === 0) {\n return defaultProxy;\n }\n\n // Validate every override key corresponds to a declared activity.\n // Without this, a typo at runtime (or a stale options bag from a renamed\n // activity) silently builds a proxy for a non-existent activity.\n const declared = new Set<string>([\n ...Object.keys(workflowActivities ?? {}),\n ...Object.keys(contractActivities ?? {}),\n ]);\n for (const [name] of overrideEntries) {\n if (!declared.has(name)) {\n throw new Error(\n `activityOptionsByName entry \"${name}\" does not match any declared activity. Available: ${[...declared].join(\", \") || \"none\"}.`,\n );\n }\n }\n\n // Override path: build one proxy per override; combine with the default\n // proxy via a get-trap so unmatched keys still get the default options.\n const overriddenFns: Record<string, ActivityFn> = {};\n for (const [name, override] of overrideEntries) {\n const mergedOptions: ActivityOptions = { ...defaultOptions, ...override };\n const overrideProxy = proxyActivities<Record<string, ActivityFn>>(mergedOptions);\n const fn = overrideProxy[name];\n if (fn !== undefined) {\n overriddenFns[name] = fn;\n }\n }\n\n return new Proxy(overriddenFns, {\n get(target, prop) {\n if (typeof prop !== \"string\") return undefined;\n return target[prop] ?? defaultProxy[prop];\n },\n });\n}\n\n/**\n * Continue-as-new options the typed wrapper does not own. `workflowType` and\n * `taskQueue` are derived from the contract; everything else is forwarded to\n * Temporal's `makeContinueAsNewFunc`.\n */\nexport type TypedContinueAsNewOptions = Omit<ContinueAsNewOptions, \"workflowType\" | \"taskQueue\">;\n\n/**\n * Build the typed `continueAsNew` function bound to the running workflow's\n * contract. Two overloads — same-workflow and cross-contract — share one\n * implementation; the public type signature lives on `WorkflowContext` so\n * call sites are type-safe.\n *\n * Validation runs *before* Temporal's `makeContinueAsNewFunc(...)` is invoked.\n * On failure, throws a `WorkflowInputValidationError` (matching the behaviour\n * of `declareWorkflow`'s incoming-input validation), which surfaces back to\n * Temporal as a workflow failure rather than silently proceeding with an\n * invalid run.\n *\n * Temporal's `continueAsNew` never returns — it throws a `ContinueAsNew`\n * exception that the runtime intercepts. The returned function preserves\n * `Promise<never>` to encode that.\n *\n * @internal\n */\nexport function createContinueAsNew(\n currentContract: ContractDefinition,\n currentWorkflowName: string | number | symbol,\n) {\n return async function continueAsNew(\n arg1: unknown,\n arg2?: unknown,\n arg3?: unknown,\n arg4?: TypedContinueAsNewOptions,\n ): Promise<never> {\n // Cross-contract dispatch is only triggered when the call signature\n // unambiguously matches `(contract, workflowName, args, options?)`:\n //\n // 1. `arg1` is a non-null object that *looks like* a contract — it has a\n // string `taskQueue` and a non-null `workflows` object.\n // 2. `arg2` is a string — the destination workflow name.\n // 3. `arg2` resolves to a workflow definition on `arg1.workflows` with a\n // Standard Schema `input.~standard.validate` function.\n //\n // Without (2)+(3), a same-workflow input that happens to have `taskQueue`\n // and `workflows` keys (or `workflows = null`, where `typeof === \"object\"`)\n // would be silently misclassified. The full triple of structural checks\n // makes the false-positive surface vanishingly small.\n const isCrossContract = looksLikeCrossContractCall(arg1, arg2);\n\n let targetContract: ContractDefinition;\n let targetName: string;\n let rawArgs: unknown;\n let options: TypedContinueAsNewOptions | undefined;\n\n if (isCrossContract) {\n targetContract = arg1 as ContractDefinition;\n targetName = arg2 as string;\n rawArgs = arg3;\n options = arg4;\n } else {\n targetContract = currentContract;\n targetName = String(currentWorkflowName);\n rawArgs = arg1;\n options = arg2 as TypedContinueAsNewOptions | undefined;\n }\n\n const targetDef = targetContract.workflows[targetName];\n if (!targetDef) {\n throw new WorkflowInputValidationError(targetName, [\n {\n message: `continueAsNew target workflow \"${targetName}\" is not declared on the supplied contract.`,\n },\n ]);\n }\n\n const inputResult = await targetDef.input[\"~standard\"].validate(rawArgs);\n if (inputResult.issues) {\n throw new WorkflowInputValidationError(targetName, inputResult.issues);\n }\n\n // workflowType/taskQueue come from the destination contract; user\n // options are spread last so power users can override (e.g. retry,\n // memo). The public TypedContinueAsNewOptions type Omits workflowType\n // and taskQueue so this isn't a footgun on the typed call path.\n const fn = makeContinueAsNewFunc({\n workflowType: targetName,\n taskQueue: targetContract.taskQueue,\n ...options,\n });\n\n await fn(inputResult.value);\n // Unreachable — Temporal's continueAsNew throws to terminate the run.\n /* c8 ignore next */\n return undefined as never;\n };\n}\n\n/**\n * Structural check: does `(arg1, arg2)` look like the\n * `(contract, workflowName, ...)` cross-contract overload of `continueAsNew`?\n *\n * Returns `true` only when:\n * 1. `arg1` is a non-null object with a string `taskQueue` and a non-null\n * object `workflows` (handles `workflows: null`, where\n * `typeof null === \"object\"`).\n * 2. `arg2` is a string.\n *\n * Both halves matter. A same-workflow input that happens to contain\n * `taskQueue` and `workflows` keys would otherwise be misclassified — but\n * none of the same-workflow signatures (`continueAsNew(args)`,\n * `continueAsNew(args, options)`) accept a string as `arg2`, so the\n * second check makes the false-positive surface vanishingly small.\n *\n * We deliberately do *not* check that `arg1.workflows[arg2]` is a valid\n * workflow definition. If it isn't, the dispatcher falls through to the\n * `targetContract.workflows[targetName]` lookup which throws a clear\n * \"target workflow X is not declared\" error — better than silently\n * misrouting a typo back to the current workflow.\n */\nfunction looksLikeCrossContractCall(arg1: unknown, arg2: unknown): boolean {\n if (typeof arg1 !== \"object\" || arg1 === null) return false;\n if (typeof arg2 !== \"string\") return false;\n const candidate = arg1 as Record<string, unknown>;\n if (typeof candidate[\"taskQueue\"] !== \"string\") return false;\n const workflows = candidate[\"workflows\"];\n return typeof workflows === \"object\" && workflows !== null;\n}\n\n/**\n * Map a thrown error from `startChild` / `executeChild` / `handle.result()`\n * (the worker-side child-workflow API) into the discriminated union surfaced\n * by the typed worker. Mirrors the client's `classifyResultError`:\n *\n * - Cancellation (detected via `@temporalio/workflow`'s `isCancellation`,\n * which sees through nested `ChildWorkflowFailure → CancelledFailure`\n * chains) → {@link ChildWorkflowCancelledError}, with the original error\n * carried as `cause`.\n * - Temporal's `ChildWorkflowFailure` (a wrapper whose actionable failure —\n * `ApplicationFailure`, `TimeoutFailure`, `TerminatedFailure`, etc. — lives\n * on its `cause` field) → {@link ChildWorkflowError}, with that *inner*\n * cause forwarded so consumers can match `err.cause instanceof\n * ApplicationFailure` without unwrapping twice. (If the wrapper's `cause`\n * is `undefined`, the wrapper itself is forwarded so identity is\n * preserved.)\n * - Anything else → {@link ChildWorkflowError} carrying the raw thrown value\n * as `cause`.\n *\n * The `operation` discriminator drives the human-readable error message so\n * call sites don't have to format their own.\n *\n * Note: `ChildWorkflowNotFoundError` is *not* produced here — it's only\n * thrown from the input-validation path when the workflow definition is\n * missing on the contract, before any Temporal call happens.\n */\nexport function classifyChildWorkflowError(\n operation: \"startChild\" | \"executeChild\" | \"result\",\n error: unknown,\n childWorkflowName: string,\n): ChildWorkflowError | ChildWorkflowCancelledError | ChildWorkflowNotFoundError {\n // Cancellation takes priority: a cancelled child surfaces as a\n // `ChildWorkflowFailure` whose cause is a `CancelledFailure`, and we want\n // the cancellation discriminant rather than the generic wrapper.\n if (isCancellation(error)) {\n return new ChildWorkflowCancelledError(childWorkflowName, error);\n }\n\n // Temporal wraps the actionable failure (ApplicationFailure, TimeoutFailure,\n // TerminatedFailure, etc.) inside a ChildWorkflowFailure. Forward the\n // inner cause so consumers can branch on the failure category without\n // unwrapping twice. Fall back to the wrapper itself if `cause` is missing\n // so callers don't lose the error identity.\n if (error instanceof ChildWorkflowFailure) {\n const inner = error.cause ?? error;\n const innerMessage = inner instanceof Error ? inner.message : String(inner);\n return new ChildWorkflowError(\n `${describeChildWorkflowOperation(operation, childWorkflowName)}: ${innerMessage}`,\n inner,\n );\n }\n\n const message = error instanceof Error ? error.message : String(error);\n return new ChildWorkflowError(\n `${describeChildWorkflowOperation(operation, childWorkflowName)}: ${message}`,\n error,\n );\n}\n\nfunction describeChildWorkflowOperation(\n operation: \"startChild\" | \"executeChild\" | \"result\",\n childWorkflowName: string,\n): string {\n switch (operation) {\n case \"startChild\":\n return `Failed to start child workflow \"${childWorkflowName}\"`;\n case \"executeChild\":\n return `Failed to execute child workflow \"${childWorkflowName}\"`;\n case \"result\":\n return `Child workflow \"${childWorkflow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ANW,sBAAsB;GAC/B,cAAc;GACd,WAAW,eAAe;GAC1B,GAAG;EACL,CAEO,CAAC,CAAC,YAAY,KAAK;CAI5B;AACF;;;;;;;;;;;;;;;;;;;;;;;AAwBA,SAAS,2BAA2B,MAAe,MAAwB;CACzE,IAAI,OAAO,SAAS,YAAY,SAAS,MAAM,OAAO;CACtD,IAAI,OAAO,SAAS,UAAU,OAAO;CACrC,MAAM,YAAY;CAClB,IAAI,OAAO,UAAU,iBAAiB,UAAU,OAAO;CACvD,MAAM,YAAY,UAAU;CAC5B,OAAO,OAAO,cAAc,YAAY,cAAc;AACxD;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4BA,SAAgB,2BACd,WACA,OACA,mBAC+E;CAI/E,IAAI,eAAe,KAAK,GACtB,OAAO,IAAI,4BAA4B,mBAAmB,KAAK;CAQjE,IAAI,iBAAiB,sBAAsB;EACzC,MAAM,QAAQ,MAAM,SAAS;EAC7B,MAAM,eAAe,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK;EAC1E,OAAO,IAAI,mBACT,GAAG,+BAA+B,WAAW,iBAAiB,EAAE,IAAI,gBACpE,KACF;CACF;CAEA,MAAM,UAAU,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK;CACrE,OAAO,IAAI,mBACT,GAAG,+BAA+B,WAAW,iBAAiB,EAAE,IAAI,WACpE,KACF;AACF;AAEA,SAAS,+BACP,WACA,mBACQ;CACR,QAAQ,WAAR;EACE,KAAK,cACH,OAAO,mCAAmC,kBAAkB;EAC9D,KAAK,gBACH,OAAO,qCAAqC,kBAAkB;EAChE,KAAK,UACH,OAAO,mBAAmB,kBAAkB;CAChD;AACF"}
@@ -1,6 +1,6 @@
1
1
  let _temporal_contract_contract = require("@temporal-contract/contract");
2
- let _temporalio_workflow = require("@temporalio/workflow");
3
2
  let _temporalio_common = require("@temporalio/common");
3
+ let _temporalio_workflow = require("@temporalio/workflow");
4
4
  require("@temporal-contract/contract/result-async");
5
5
  //#region src/errors.ts
6
6
  /**
@@ -14,6 +14,48 @@ var WorkerError = class extends Error {
14
14
  }
15
15
  };
16
16
  /**
17
+ * Base class for the contract's runtime validation failures — workflow and
18
+ * activity input/output, plus signal/query/update payloads.
19
+ *
20
+ * These extend Temporal's {@link ApplicationFailure} with `nonRetryable: true`
21
+ * rather than a plain `Error`, and that distinction is load-bearing. The
22
+ * TypeScript SDK classifies a non-`TemporalFailure` thrown from *workflow* code
23
+ * as a Workflow Task failure — presumed to be a transient code bug or
24
+ * non-determinism — and retries the task indefinitely, leaving the execution
25
+ * silently `Running` forever (it looks like the worker "hung"). Only a
26
+ * `TemporalFailure` such as `ApplicationFailure` fails the Workflow Execution
27
+ * terminally. The same logic applies at the activity boundary, where Temporal's
28
+ * default retry policy has unlimited attempts: a plain `Error` would retry
29
+ * forever too.
30
+ *
31
+ * Contract validation failures are deterministic — the schema is static, so bad
32
+ * input/output never becomes valid on replay or retry — so they are surfaced as
33
+ * non-retryable, failing fast with a clear error instead of an infinite retry
34
+ * loop.
35
+ *
36
+ * The concrete subclass name is passed through as the failure `type`, so it
37
+ * stays discriminable after crossing Temporal's serialization boundary (where
38
+ * the JS class identity is lost) via `failure.type`. The failing field path is
39
+ * carried in the human-readable `message` (see {@link summarizeIssues}). The
40
+ * raw `issues` remain available as a property for in-process inspection.
41
+ *
42
+ * See issue #251.
43
+ */
44
+ var ValidationError = class extends _temporalio_common.ApplicationFailure {
45
+ issues;
46
+ constructor(message, type, issues) {
47
+ super(message, type, true);
48
+ this.issues = issues;
49
+ Object.defineProperty(this, "name", {
50
+ value: type,
51
+ writable: true,
52
+ configurable: true,
53
+ enumerable: true
54
+ });
55
+ if (Error.captureStackTrace) Error.captureStackTrace(this, this.constructor);
56
+ }
57
+ };
58
+ /**
17
59
  * Error thrown when an activity definition is not found in the contract
18
60
  */
19
61
  var ActivityDefinitionNotFoundError = class extends WorkerError {
@@ -30,127 +72,100 @@ var ActivityDefinitionNotFoundError = class extends WorkerError {
30
72
  /**
31
73
  * Error thrown when activity input validation fails
32
74
  */
33
- var ActivityInputValidationError = class extends WorkerError {
75
+ var ActivityInputValidationError = class extends ValidationError {
34
76
  activityName;
35
- issues;
36
77
  constructor(activityName, issues) {
37
78
  const message = (0, _temporal_contract_contract.summarizeIssues)(issues);
38
- super(`Activity "${activityName}" input validation failed: ${message}`);
79
+ super(`Activity "${activityName}" input validation failed: ${message}`, "ActivityInputValidationError", issues);
39
80
  this.activityName = activityName;
40
- this.issues = issues;
41
- this.name = "ActivityInputValidationError";
42
81
  }
43
82
  };
44
83
  /**
45
84
  * Error thrown when activity output validation fails
46
85
  */
47
- var ActivityOutputValidationError = class extends WorkerError {
86
+ var ActivityOutputValidationError = class extends ValidationError {
48
87
  activityName;
49
- issues;
50
88
  constructor(activityName, issues) {
51
89
  const message = (0, _temporal_contract_contract.summarizeIssues)(issues);
52
- super(`Activity "${activityName}" output validation failed: ${message}`);
90
+ super(`Activity "${activityName}" output validation failed: ${message}`, "ActivityOutputValidationError", issues);
53
91
  this.activityName = activityName;
54
- this.issues = issues;
55
- this.name = "ActivityOutputValidationError";
56
92
  }
57
93
  };
58
94
  /**
59
95
  * Error thrown when workflow input validation fails
60
96
  */
61
- var WorkflowInputValidationError = class extends WorkerError {
97
+ var WorkflowInputValidationError = class extends ValidationError {
62
98
  workflowName;
63
- issues;
64
99
  constructor(workflowName, issues) {
65
100
  const message = (0, _temporal_contract_contract.summarizeIssues)(issues);
66
- super(`Workflow "${workflowName}" input validation failed: ${message}`);
101
+ super(`Workflow "${workflowName}" input validation failed: ${message}`, "WorkflowInputValidationError", issues);
67
102
  this.workflowName = workflowName;
68
- this.issues = issues;
69
- this.name = "WorkflowInputValidationError";
70
103
  }
71
104
  };
72
105
  /**
73
106
  * Error thrown when workflow output validation fails
74
107
  */
75
- var WorkflowOutputValidationError = class extends WorkerError {
108
+ var WorkflowOutputValidationError = class extends ValidationError {
76
109
  workflowName;
77
- issues;
78
110
  constructor(workflowName, issues) {
79
111
  const message = (0, _temporal_contract_contract.summarizeIssues)(issues);
80
- super(`Workflow "${workflowName}" output validation failed: ${message}`);
112
+ super(`Workflow "${workflowName}" output validation failed: ${message}`, "WorkflowOutputValidationError", issues);
81
113
  this.workflowName = workflowName;
82
- this.issues = issues;
83
- this.name = "WorkflowOutputValidationError";
84
114
  }
85
115
  };
86
116
  /**
87
117
  * Error thrown when signal input validation fails
88
118
  */
89
- var SignalInputValidationError = class extends WorkerError {
119
+ var SignalInputValidationError = class extends ValidationError {
90
120
  signalName;
91
- issues;
92
121
  constructor(signalName, issues) {
93
122
  const message = (0, _temporal_contract_contract.summarizeIssues)(issues);
94
- super(`Signal "${signalName}" input validation failed: ${message}`);
123
+ super(`Signal "${signalName}" input validation failed: ${message}`, "SignalInputValidationError", issues);
95
124
  this.signalName = signalName;
96
- this.issues = issues;
97
- this.name = "SignalInputValidationError";
98
125
  }
99
126
  };
100
127
  /**
101
128
  * Error thrown when query input validation fails
102
129
  */
103
- var QueryInputValidationError = class extends WorkerError {
130
+ var QueryInputValidationError = class extends ValidationError {
104
131
  queryName;
105
- issues;
106
132
  constructor(queryName, issues) {
107
133
  const message = (0, _temporal_contract_contract.summarizeIssues)(issues);
108
- super(`Query "${queryName}" input validation failed: ${message}`);
134
+ super(`Query "${queryName}" input validation failed: ${message}`, "QueryInputValidationError", issues);
109
135
  this.queryName = queryName;
110
- this.issues = issues;
111
- this.name = "QueryInputValidationError";
112
136
  }
113
137
  };
114
138
  /**
115
139
  * Error thrown when query output validation fails
116
140
  */
117
- var QueryOutputValidationError = class extends WorkerError {
141
+ var QueryOutputValidationError = class extends ValidationError {
118
142
  queryName;
119
- issues;
120
143
  constructor(queryName, issues) {
121
144
  const message = (0, _temporal_contract_contract.summarizeIssues)(issues);
122
- super(`Query "${queryName}" output validation failed: ${message}`);
145
+ super(`Query "${queryName}" output validation failed: ${message}`, "QueryOutputValidationError", issues);
123
146
  this.queryName = queryName;
124
- this.issues = issues;
125
- this.name = "QueryOutputValidationError";
126
147
  }
127
148
  };
128
149
  /**
129
150
  * Error thrown when update input validation fails
130
151
  */
131
- var UpdateInputValidationError = class extends WorkerError {
152
+ var UpdateInputValidationError = class extends ValidationError {
132
153
  updateName;
133
- issues;
134
154
  constructor(updateName, issues) {
135
155
  const message = (0, _temporal_contract_contract.summarizeIssues)(issues);
136
- super(`Update "${updateName}" input validation failed: ${message}`);
156
+ super(`Update "${updateName}" input validation failed: ${message}`, "UpdateInputValidationError", issues);
137
157
  this.updateName = updateName;
138
- this.issues = issues;
139
- this.name = "UpdateInputValidationError";
140
158
  }
141
159
  };
142
160
  /**
143
161
  * Error thrown when update output validation fails
144
162
  */
145
- var UpdateOutputValidationError = class extends WorkerError {
163
+ var UpdateOutputValidationError = class extends ValidationError {
146
164
  updateName;
147
- issues;
148
165
  constructor(updateName, issues) {
149
166
  const message = (0, _temporal_contract_contract.summarizeIssues)(issues);
150
- super(`Update "${updateName}" output validation failed: ${message}`);
167
+ super(`Update "${updateName}" output validation failed: ${message}`, "UpdateOutputValidationError", issues);
151
168
  this.updateName = updateName;
152
- this.issues = issues;
153
- this.name = "UpdateOutputValidationError";
154
169
  }
155
170
  };
156
171
  /**
@@ -516,6 +531,12 @@ Object.defineProperty(exports, "UpdateOutputValidationError", {
516
531
  return UpdateOutputValidationError;
517
532
  }
518
533
  });
534
+ Object.defineProperty(exports, "ValidationError", {
535
+ enumerable: true,
536
+ get: function() {
537
+ return ValidationError;
538
+ }
539
+ });
519
540
  Object.defineProperty(exports, "WorkflowCancelledError", {
520
541
  enumerable: true,
521
542
  get: function() {
package/dist/workflow.cjs CHANGED
@@ -1,5 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_internal = require("./internal-DcM-YWYX.cjs");
2
+ const require_internal = require("./internal-o5vk6e1H.cjs");
3
3
  let _temporalio_workflow = require("@temporalio/workflow");
4
4
  let neverthrow = require("neverthrow");
5
5
  let _temporal_contract_contract_result_async = require("@temporal-contract/contract/result-async");
@@ -310,12 +310,16 @@ function createValidatedActivities(rawActivities, workflowActivitiesDefinition,
310
310
  * },
311
311
  * // Optional: override `activityOptions` for specific activities. Each
312
312
  * // entry shallow-merges over the workflow default — the override wins on
313
- * // every property it specifies, including the whole `retry` block.
313
+ * // every property it specifies, including the whole `retry` block. The
314
+ * // override is Temporal's full `ActivityOptions`, so `taskQueue` works too,
315
+ * // letting you route individual activities to a dedicated worker pool.
314
316
  * activityOptionsByName: {
315
317
  * chargePayment: {
316
318
  * startToCloseTimeout: '5 minutes',
317
319
  * retry: { maximumAttempts: 5 },
318
320
  * },
321
+ * // Route this activity to a dedicated, concurrency-capped queue.
322
+ * scoreRisk: { taskQueue: 'ml-inference' },
319
323
  * },
320
324
  * implementation: async (context, args) => {
321
325
  * // context.activities: typed activities (workflow + global)
@@ -403,6 +407,7 @@ exports.QueryOutputValidationError = require_internal.QueryOutputValidationError
403
407
  exports.SignalInputValidationError = require_internal.SignalInputValidationError;
404
408
  exports.UpdateInputValidationError = require_internal.UpdateInputValidationError;
405
409
  exports.UpdateOutputValidationError = require_internal.UpdateOutputValidationError;
410
+ exports.ValidationError = require_internal.ValidationError;
406
411
  exports.WorkflowCancelledError = require_internal.WorkflowCancelledError;
407
412
  exports.WorkflowInputValidationError = require_internal.WorkflowInputValidationError;
408
413
  exports.WorkflowOutputValidationError = require_internal.WorkflowOutputValidationError;
@@ -1,4 +1,4 @@
1
- import { _ as ClientInferOutput, a as ChildWorkflowError, c as QueryOutputValidationError, d as UpdateOutputValidationError, f as WorkflowCancelledError, g as ClientInferInput, h as WorkflowScopeError, i as ChildWorkflowCancelledError, l as SignalInputValidationError, m as WorkflowOutputValidationError, n as ActivityInputValidationError, o as ChildWorkflowNotFoundError, p as WorkflowInputValidationError, r as ActivityOutputValidationError, s as QueryInputValidationError, u as UpdateInputValidationError, v as WorkerInferInput, y as WorkerInferOutput } from "./errors-BP48RaOI.cjs";
1
+ import { _ as ClientInferInput, a as ChildWorkflowError, b as WorkerInferOutput, c as QueryOutputValidationError, d as UpdateOutputValidationError, f as ValidationError, g as WorkflowScopeError, h as WorkflowOutputValidationError, i as ChildWorkflowCancelledError, l as SignalInputValidationError, m as WorkflowInputValidationError, n as ActivityInputValidationError, o as ChildWorkflowNotFoundError, p as WorkflowCancelledError, r as ActivityOutputValidationError, s as QueryInputValidationError, u as UpdateInputValidationError, v as ClientInferOutput, y as WorkerInferInput } from "./errors-CE56feY1.cjs";
2
2
  import { ActivityDefinition, AnyWorkflowDefinition, ContractDefinition, QueryDefinition, QueryNamesOf, SignalDefinition, SignalNamesOf, UpdateDefinition, UpdateNamesOf } from "@temporal-contract/contract";
3
3
  import { ResultAsync } from "neverthrow";
4
4
  import { StandardSchemaV1 } from "@standard-schema/spec";
@@ -105,12 +105,16 @@ type WorkflowInferWorkflowContextActivities<TContract extends ContractDefinition
105
105
  * },
106
106
  * // Optional: override `activityOptions` for specific activities. Each
107
107
  * // entry shallow-merges over the workflow default — the override wins on
108
- * // every property it specifies, including the whole `retry` block.
108
+ * // every property it specifies, including the whole `retry` block. The
109
+ * // override is Temporal's full `ActivityOptions`, so `taskQueue` works too,
110
+ * // letting you route individual activities to a dedicated worker pool.
109
111
  * activityOptionsByName: {
110
112
  * chargePayment: {
111
113
  * startToCloseTimeout: '5 minutes',
112
114
  * retry: { maximumAttempts: 5 },
113
115
  * },
116
+ * // Route this activity to a dedicated, concurrency-capped queue.
117
+ * scoreRisk: { taskQueue: 'ml-inference' },
114
118
  * },
115
119
  * implementation: async (context, args) => {
116
120
  * // context.activities: typed activities (workflow + global)
@@ -199,10 +203,17 @@ type DeclareWorkflowOptions<TContract extends ContractDefinition, TWorkflowName
199
203
  * entire nested `retry` block when present, matching Temporal's
200
204
  * single-options-per-`proxyActivities`-call semantics).
201
205
  *
206
+ * The override value is Temporal's full `ActivityOptions`, so any field is
207
+ * fair game — including `taskQueue`, which lets you route individual
208
+ * activities to dedicated worker pools (e.g. concurrency-capped queues for
209
+ * LLM calls) while the rest of the workflow's activities stay on the default
210
+ * queue. This keeps the Zod-validated typed-activities boundary intact, where
211
+ * a raw `proxyActivities({ taskQueue })` would forfeit it.
212
+ *
202
213
  * Activity names are typed against the contract; typos surface as TypeScript
203
214
  * errors rather than running silently with the default options.
204
215
  *
205
- * @example
216
+ * @example Tune timeouts and retries per activity
206
217
  * ```ts
207
218
  * activityOptions: { startToCloseTimeout: '1 minute' }, // default
208
219
  * activityOptionsByName: {
@@ -213,6 +224,16 @@ type DeclareWorkflowOptions<TContract extends ContractDefinition, TWorkflowName
213
224
  * fastValidation: { startToCloseTimeout: '5 seconds' },
214
225
  * },
215
226
  * ```
227
+ *
228
+ * @example Route specific activities to a dedicated task queue
229
+ * ```ts
230
+ * activityOptions: { startToCloseTimeout: '10 minutes' }, // default queue
231
+ * activityOptionsByName: {
232
+ * // LLM call → dedicated, concurrency-capped queue.
233
+ * extractLayoutChunk: { taskQueue: 'gemini-pro' },
234
+ * // finalizeLayout, extractImages, … fall through to the default queue.
235
+ * },
236
+ * ```
216
237
  */
217
238
  activityOptionsByName?: Partial<Record<ActivityNamesFor<TContract, TWorkflowName>, ActivityOptions>>;
218
239
  };
@@ -431,5 +452,5 @@ type WorkflowContext<TContract extends ContractDefinition, TWorkflowName extends
431
452
  };
432
453
  }; //# sourceMappingURL=workflow.d.ts.map
433
454
  //#endregion
434
- export { ActivityInputValidationError, ActivityOutputValidationError, ChildWorkflowCancelledError, ChildWorkflowError, ChildWorkflowNotFoundError, QueryInputValidationError, QueryOutputValidationError, SignalInputValidationError, UpdateInputValidationError, UpdateOutputValidationError, WorkflowCancelledError, WorkflowInputValidationError, WorkflowOutputValidationError, WorkflowScopeError, declareWorkflow };
455
+ export { ActivityInputValidationError, ActivityOutputValidationError, ChildWorkflowCancelledError, ChildWorkflowError, ChildWorkflowNotFoundError, QueryInputValidationError, QueryOutputValidationError, SignalInputValidationError, UpdateInputValidationError, UpdateOutputValidationError, ValidationError, WorkflowCancelledError, WorkflowInputValidationError, WorkflowOutputValidationError, WorkflowScopeError, declareWorkflow };
435
456
  //# sourceMappingURL=workflow.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"workflow.d.cts","names":[],"sources":["../src/handlers.ts","../src/internal.ts","../src/child-workflow.ts","../src/activities-proxy.ts","../src/workflow.ts"],"mappings":";;;;;;;;;;;;KAkCY,2BAAA,iBAA4C,gBAAA,KACtD,IAAA,EAAM,gBAAA,CAAiB,OAAA,aACb,OAAA;;;;;;;KAQA,0BAAA,gBAA0C,eAAA,KACpD,IAAA,EAAM,gBAAA,CAAiB,MAAA,MACpB,iBAAA,CAAkB,MAAA;;;;;;;KAQX,2BAAA,iBAA4C,gBAAA,KACtD,IAAA,EAAM,gBAAA,CAAiB,OAAA,MACpB,OAAA,CAAQ,iBAAA,CAAkB,OAAA;;;;;;;;KCsFnB,yBAAA,GAA4B,IAAI,CAAC,oBAAA;;;;;;;;KChHjC,yBAAA,wBACa,kBAAA,mCACU,cAAA,0BAC/B,IAAA,CAAK,oBAAA;EACP,IAAA,EAAM,gBAAA,CAAiB,cAAA,cAA4B,kBAAA;AAAA;;;;KAMzC,wBAAA,mBAA2C,qBAAA;EFJ3C;;AAAO;EEQjB,MAAA,QAAc,WAAA,CACZ,iBAAA,CAAkB,SAAA,GAClB,kBAAA,GAAqB,2BAAA;EFFa;;;EEQpC,UAAA;AAAA;;;AFlBF;;;;;AAAA,KGfY,qBAAA,mBAAwC,kBAAA,KAClD,IAAA,EAAM,gBAAA,CAAiB,SAAA,MACpB,OAAA,CAAQ,iBAAA,CAAkB,SAAA;;;;KAKnB,uBAAA,mBAA0C,kBAAA,IACpD,SAAA,uBAAgC,MAAA,SAAe,kBAAA,kBAE7B,SAAA,iBAA0B,qBAAA,CAAsB,SAAA,eAAwB,CAAA;;;;KAOhF,+BAAA,WAA0C,qBAAA,IACpD,CAAA,uBAAwB,MAAA,SAAe,kBAAA,kBAErB,CAAA,iBAAkB,qBAAA,CAAsB,CAAA,eAAgB,CAAA;;;;;;KAShE,sCAAA,mBACQ,kBAAA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BAAA,CAAyB,cAAA,cAA4B,kBAAA,IACrD,kBAAA,GAAqB,2BAAA,GAA8B,0BAAA;EA9XrD;;;;;;;;;;;;;;;;;;;AAOiE;AA0IlE;;;;;;;EA2QC,oBAAA,0BACyB,kBAAA,mCACU,cAAA,wBAEjC,QAAA,EAAU,cAAA,EACV,YAAA,EAAc,kBAAA,EACd,OAAA,EAAS,yBAAA,CAA0B,cAAA,EAAgB,kBAAA,MAChD,WAAA,CACH,iBAAA,CAAkB,cAAA,cAA4B,kBAAA,IAC9C,kBAAA,GAAqB,2BAAA,GAA8B,0BAAA;EA1QU;;;;;;;;;;;;;;;;;;;;;;;;AAI1C;AAAA;;;;;;;;;;;EA6SrB,gBAAA,MACE,EAAA,QAAU,CAAA,GAAI,OAAA,CAAQ,CAAA,MACnB,WAAA,CAAY,CAAA,EAAG,sBAAA,GAAyB,kBAAA;EAvPR;;;;;;;;;;;EAoQrC,mBAAA,MACE,EAAA,QAAU,CAAA,GAAI,OAAA,CAAQ,CAAA,MACnB,WAAA,CAAY,CAAA,EAAG,sBAAA,GAAyB,kBAAA;EApT/B;;;;;;;;;;;;;;;;;AA8CsD;AAAA;;;;;;;;;EAmSpE,aAAA;IApRM,8EAuRF,IAAA,EAAM,gBAAA,CAAiB,SAAA,cAAuB,aAAA,IAC9C,OAAA,GAAU,yBAAA,GACT,OAAA,SAxR+C;IAAA,wBA2RzB,kBAAA,mCACU,cAAA,wBAEjC,QAAA,EAAU,cAAA,EACV,YAAA,EAAc,kBAAA,EACd,IAAA,EAAM,gBAAA,CAAiB,cAAA,cAA4B,kBAAA,IACnD,OAAA,GAAU,yBAAA,GACT,OAAA;EAAA;AAAA"}
1
+ {"version":3,"file":"workflow.d.cts","names":[],"sources":["../src/handlers.ts","../src/internal.ts","../src/child-workflow.ts","../src/activities-proxy.ts","../src/workflow.ts"],"mappings":";;;;;;;;;;;;KAkCY,2BAAA,iBAA4C,gBAAA,KACtD,IAAA,EAAM,gBAAA,CAAiB,OAAA,aAC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