@temporal-contract/worker 2.4.0 → 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 CHANGED
@@ -15,13 +15,13 @@ pnpm add @temporal-contract/worker @temporal-contract/contract @temporalio/workf
15
15
  ```typescript
16
16
  // activities.ts
17
17
  import { declareActivitiesHandler, ApplicationFailure } from "@temporal-contract/worker/activity";
18
- import { ResultAsync } from "neverthrow";
18
+ import { fromPromise } from "unthrown";
19
19
 
20
20
  export const activities = declareActivitiesHandler({
21
21
  contract: myContract,
22
22
  activities: {
23
23
  sendEmail: ({ to, body }) =>
24
- ResultAsync.fromPromise(emailService.send({ to, body }), (error) =>
24
+ fromPromise(emailService.send({ to, body }), (error) =>
25
25
  ApplicationFailure.create({
26
26
  type: "EMAIL_FAILED",
27
27
  message: error instanceof Error ? error.message : "Failed to send email",
@@ -65,7 +65,7 @@ run().catch(console.error);
65
65
 
66
66
  ### Child Workflows
67
67
 
68
- Execute child workflows with type-safe `ResultAsync`. Supports both same-contract and cross-contract child workflows:
68
+ Execute child workflows with type-safe `AsyncResult`. Supports both same-contract and cross-contract child workflows:
69
69
 
70
70
  ```typescript
71
71
  // workflows.ts
@@ -158,11 +158,11 @@ typos surface as TypeScript errors rather than silently running with defaults.
158
158
 
159
159
  ## Documentation
160
160
 
161
- 📖 **[Read the full documentation →](https://btravers.github.io/temporal-contract)**
161
+ 📖 **[Read the full documentation →](https://btravstack.github.io/temporal-contract)**
162
162
 
163
- - [API Reference](https://btravers.github.io/temporal-contract/api/worker)
164
- - [Worker Implementation Guide](https://btravers.github.io/temporal-contract/guide/worker-implementation)
165
- - [Examples](https://btravers.github.io/temporal-contract/examples/)
163
+ - [API Reference](https://btravstack.github.io/temporal-contract/api/worker)
164
+ - [Worker Implementation Guide](https://btravstack.github.io/temporal-contract/guide/worker-implementation)
165
+ - [Examples](https://btravstack.github.io/temporal-contract/examples/)
166
166
 
167
167
  ## License
168
168
 
package/dist/activity.cjs CHANGED
@@ -1,5 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_internal = require("./internal-o5vk6e1H.cjs");
2
+ const require_internal = require("./internal-Clwokr1z.cjs");
3
3
  let _temporalio_common = require("@temporalio/common");
4
4
  //#region src/activity.ts
5
5
  /**
@@ -7,7 +7,7 @@ let _temporalio_common = require("@temporalio/common");
7
7
  *
8
8
  * This wraps all activity implementations with:
9
9
  * - Validation at network boundaries
10
- * - `ResultAsync<T, ApplicationFailure>` pattern for explicit error handling
10
+ * - `AsyncResult<T, ApplicationFailure>` pattern for explicit error handling
11
11
  * - Automatic conversion from Result to Promise (throwing on Error)
12
12
  *
13
13
  * TypeScript ensures ALL activities (global + workflow-specific) are implemented.
@@ -17,15 +17,15 @@ let _temporalio_common = require("@temporalio/common");
17
17
  * @example
18
18
  * ```ts
19
19
  * import { declareActivitiesHandler, ApplicationFailure } from '@temporal-contract/worker/activity';
20
- * import { ResultAsync, errAsync, okAsync } from 'neverthrow';
20
+ * import { fromPromise } from 'unthrown';
21
21
  * import myContract from './contract';
22
22
  *
23
23
  * export const activities = declareActivitiesHandler({
24
24
  * contract: myContract,
25
25
  * activities: {
26
- * // Activity returns ResultAsync instead of throwing.
26
+ * // Activity returns AsyncResult instead of throwing.
27
27
  * sendEmail: (args) =>
28
- * ResultAsync.fromPromise(
28
+ * fromPromise(
29
29
  * emailService.send(args),
30
30
  * (error) =>
31
31
  * // Wrap technical errors in ApplicationFailure. `nonRetryable`
@@ -53,10 +53,11 @@ let _temporalio_common = require("@temporalio/common");
53
53
  *
54
54
  * @remarks
55
55
  * The wrapper accepts implementations in the
56
- * `ResultAsync<T, ApplicationFailure>` shape and produces ordinary
56
+ * `AsyncResult<T, ApplicationFailure>` shape and produces ordinary
57
57
  * Promise-returning Temporal handlers (`err(...)` → thrown
58
58
  * `ApplicationFailure`; `ok(...)` → output validated against the
59
- * contract and resolved). It does **not** hide Temporal's
59
+ * contract and resolved; `defect` → original cause re-thrown). It does
60
+ * **not** hide Temporal's
60
61
  * `@temporalio/activity` runtime: inside the body you can still call
61
62
  * `Context.current()` from `@temporalio/activity` to access heartbeats
62
63
  * (`heartbeat(details)`, `heartbeatDetails`), activity info (attempt
@@ -72,12 +73,19 @@ function declareActivitiesHandler(options) {
72
73
  const input = require_internal.extractHandlerInput(args);
73
74
  const inputResult = await activityDef.input["~standard"].validate(input);
74
75
  if (inputResult.issues) throw new require_internal.ActivityInputValidationError(activityName, inputResult.issues);
75
- const result = await activityImpl(inputResult.value);
76
- if (result.isOk()) {
77
- const outputResult = await activityDef.output["~standard"].validate(result.value);
78
- if (outputResult.issues) throw new require_internal.ActivityOutputValidationError(activityName, outputResult.issues);
79
- return outputResult.value;
80
- } else throw result.error;
76
+ return (await activityImpl(inputResult.value)).match({
77
+ ok: async (value) => {
78
+ const outputResult = await activityDef.output["~standard"].validate(value);
79
+ if (outputResult.issues) throw new require_internal.ActivityOutputValidationError(activityName, outputResult.issues);
80
+ return outputResult.value;
81
+ },
82
+ err: (error) => {
83
+ throw error;
84
+ },
85
+ defect: (cause) => {
86
+ throw cause;
87
+ }
88
+ });
81
89
  };
82
90
  }
83
91
  if (contract.activities) for (const [activityName, impl] of Object.entries(activities)) {
@@ -1,19 +1,20 @@
1
- import { b as WorkerInferOutput, f as ValidationError, n as ActivityInputValidationError, r as ActivityOutputValidationError, t as ActivityDefinitionNotFoundError, y as WorkerInferInput } from "./errors-CE56feY1.cjs";
1
+ import { f as ValidationError, n as ActivityInputValidationError, r as ActivityOutputValidationError, t as ActivityDefinitionNotFoundError, v as WorkerInferInput, y as WorkerInferOutput } from "./errors-BNnNzSwE.cjs";
2
2
  import { ActivityDefinition, ContractDefinition } from "@temporal-contract/contract";
3
- import { ResultAsync } from "neverthrow";
3
+ import { AsyncResult } from "unthrown";
4
4
  import { ApplicationFailure, ApplicationFailure as ApplicationFailure$1 } from "@temporalio/common";
5
5
 
6
6
  //#region src/activity.d.ts
7
7
  /**
8
- * Activity implementation using neverthrow's `ResultAsync`.
8
+ * Activity implementation using unthrown's `AsyncResult`.
9
9
  *
10
- * Returns `ResultAsync<Output, ApplicationFailure>` for explicit error
10
+ * Returns `AsyncResult<Output, ApplicationFailure>` for explicit error
11
11
  * handling instead of throwing. The wrapper rethrows `err()` payloads at
12
12
  * the activity boundary; Temporal recognizes `ApplicationFailure` natively
13
13
  * and applies the configured retry policy (with `nonRetryable: true`
14
- * opting an instance out per-call).
14
+ * opting an instance out per-call). An unexpected throw surfaces as a
15
+ * `defect` and is re-thrown with its original cause.
15
16
  */
16
- type ResultActivityImplementation<TActivity extends ActivityDefinition> = (args: WorkerInferInput<TActivity>) => ResultAsync<WorkerInferOutput<TActivity>, ApplicationFailure$1>;
17
+ type ResultActivityImplementation<TActivity extends ActivityDefinition> = (args: WorkerInferInput<TActivity>) => AsyncResult<WorkerInferOutput<TActivity>, ApplicationFailure$1>;
17
18
  /**
18
19
  * Map of all activity implementations for a contract (global + all workflow-specific).
19
20
  *
@@ -63,7 +64,7 @@ type ActivitiesHandler<TContract extends ContractDefinition> = (TContract["activ
63
64
  *
64
65
  * This wraps all activity implementations with:
65
66
  * - Validation at network boundaries
66
- * - `ResultAsync<T, ApplicationFailure>` pattern for explicit error handling
67
+ * - `AsyncResult<T, ApplicationFailure>` pattern for explicit error handling
67
68
  * - Automatic conversion from Result to Promise (throwing on Error)
68
69
  *
69
70
  * TypeScript ensures ALL activities (global + workflow-specific) are implemented.
@@ -73,15 +74,15 @@ type ActivitiesHandler<TContract extends ContractDefinition> = (TContract["activ
73
74
  * @example
74
75
  * ```ts
75
76
  * import { declareActivitiesHandler, ApplicationFailure } from '@temporal-contract/worker/activity';
76
- * import { ResultAsync, errAsync, okAsync } from 'neverthrow';
77
+ * import { fromPromise } from 'unthrown';
77
78
  * import myContract from './contract';
78
79
  *
79
80
  * export const activities = declareActivitiesHandler({
80
81
  * contract: myContract,
81
82
  * activities: {
82
- * // Activity returns ResultAsync instead of throwing.
83
+ * // Activity returns AsyncResult instead of throwing.
83
84
  * sendEmail: (args) =>
84
- * ResultAsync.fromPromise(
85
+ * fromPromise(
85
86
  * emailService.send(args),
86
87
  * (error) =>
87
88
  * // Wrap technical errors in ApplicationFailure. `nonRetryable`
@@ -109,10 +110,11 @@ type ActivitiesHandler<TContract extends ContractDefinition> = (TContract["activ
109
110
  *
110
111
  * @remarks
111
112
  * The wrapper accepts implementations in the
112
- * `ResultAsync<T, ApplicationFailure>` shape and produces ordinary
113
+ * `AsyncResult<T, ApplicationFailure>` shape and produces ordinary
113
114
  * Promise-returning Temporal handlers (`err(...)` → thrown
114
115
  * `ApplicationFailure`; `ok(...)` → output validated against the
115
- * contract and resolved). It does **not** hide Temporal's
116
+ * contract and resolved; `defect` → original cause re-thrown). It does
117
+ * **not** hide Temporal's
116
118
  * `@temporalio/activity` runtime: inside the body you can still call
117
119
  * `Context.current()` from `@temporalio/activity` to access heartbeats
118
120
  * (`heartbeat(details)`, `heartbeatDetails`), activity info (attempt
@@ -1 +1 @@
1
- {"version":3,"file":"activity.d.cts","names":[],"sources":["../src/activity.ts"],"mappings":";;;;;;AAgCwD;;;;;;;;;AAAA,KAWnD,4BAAA,mBAA+C,kBAAA,KAClD,IAAA,EAAM,gBAAA,CAAiB,SAAA,MACpB,WAAA,CAAY,iBAAA,CAAkB,SAAA,GAAY,oBAAA;;;;;;;;;;;;;AAAkB;AAAA;;;;;;;;;;KAyB5D,uCAAA,mBAA0D,kBAAA,KAE5D,SAAA,uBAAgC,MAAA,SAAe,kBAAA,IAC5C,+BAAA,CAAgC,SAAA,8CAIZ,SAAA,gBAAyB,SAAA,cAAuB,SAAA,wBAAiC,MAAA,SAEnG,kBAAA,IAEE,+BAAA,CAAgC,SAAA,cAAuB,SAAA;AAAA,KAI5D,+BAAA,qBAAoD,MAAA,SAAe,kBAAA,mBAC1D,WAAA,GAAc,4BAAA,CAA6B,WAAA,CAAY,CAAA;;;;KAMhE,+BAAA,mBAAkD,kBAAA;EACrD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BAAA,IAEE,+BAAA,CAAgC,SAAA,cAAuB,SAAA;AAAA,KAI5D,+BAAA,qBAAoD,MAAA,SAAe,kBAAA,mBAC1D,WAAA,GAAc,4BAAA,CAA6B,WAAA,CAAY,CAAA;;;;KAMhE,+BAAA,mBAAkD,kBAAA;EACrD,QAAA,EAAU,SAAA;EACV,UAAA,EAAY,uCAAA,CAAwC,SAAA;AAAA;AAAA,KAGjD,sBAAA,mBAAyC,kBAAA,KAC5C,IAAA,EAAM,gBAAA,CAAiB,SAAA,MACpB,OAAA,CAAQ,iBAAA,CAAkB,SAAA;AAAA,KAE1B,yBAAA,qBAA8C,MAAA,SAAe,kBAAA,mBACpD,WAAA,GAAc,sBAAA,CAAuB,WAAA,CAAY,CAAA;AAAA,KAG1D,mBAAA,OAA0B,CAAA,oBAAqB,CAAA,EAAG,CAAC,6BACtD,CAAA,sBAEE,CAAA;;;;;;;;AA3BsE;KAsC9D,iBAAA,mBAAoC,kBAAA,KAE7C,SAAA,uBAAgC,MAAA,SAAe,kBAAA,IAC5C,yBAAA,CAA0B,SAAA,wBAG5B,mBAAA,uBAEwB,SAAA,gBAAyB,SAAA,cAAuB,SAAA,wBAAiC,MAAA,SAEnG,kBAAA,IAEE,yBAAA,CAA0B,SAAA,cAAuB,SAAA,8BAE/C,SAAA;;;;;;;;;;;;;;;;;;AA/CwD;AAAA;;;;;;;;;;;;;;;;;AAQP;AAAA;;;;;;;;;;;;;;;;;;;;AAKvB;AAAA;;;;;;iBAoGxB,wBAAA,mBAA2C,kBAAA,EACzD,OAAA,EAAS,+BAAA,CAAgC,SAAA,IACxC,iBAAA,CAAkB,SAAA"}
@@ -1,19 +1,20 @@
1
- import { b as WorkerInferOutput, f as ValidationError, n as ActivityInputValidationError, r as ActivityOutputValidationError, t as ActivityDefinitionNotFoundError, y as WorkerInferInput } from "./errors-CE56feY1.mjs";
1
+ import { f as ValidationError, n as ActivityInputValidationError, r as ActivityOutputValidationError, t as ActivityDefinitionNotFoundError, v as WorkerInferInput, y as WorkerInferOutput } from "./errors-BNnNzSwE.mjs";
2
2
  import { ActivityDefinition, ContractDefinition } from "@temporal-contract/contract";
3
3
  import { ApplicationFailure, ApplicationFailure as ApplicationFailure$1 } from "@temporalio/common";
4
- import { ResultAsync } from "neverthrow";
4
+ import { AsyncResult } from "unthrown";
5
5
 
6
6
  //#region src/activity.d.ts
7
7
  /**
8
- * Activity implementation using neverthrow's `ResultAsync`.
8
+ * Activity implementation using unthrown's `AsyncResult`.
9
9
  *
10
- * Returns `ResultAsync<Output, ApplicationFailure>` for explicit error
10
+ * Returns `AsyncResult<Output, ApplicationFailure>` for explicit error
11
11
  * handling instead of throwing. The wrapper rethrows `err()` payloads at
12
12
  * the activity boundary; Temporal recognizes `ApplicationFailure` natively
13
13
  * and applies the configured retry policy (with `nonRetryable: true`
14
- * opting an instance out per-call).
14
+ * opting an instance out per-call). An unexpected throw surfaces as a
15
+ * `defect` and is re-thrown with its original cause.
15
16
  */
16
- type ResultActivityImplementation<TActivity extends ActivityDefinition> = (args: WorkerInferInput<TActivity>) => ResultAsync<WorkerInferOutput<TActivity>, ApplicationFailure$1>;
17
+ type ResultActivityImplementation<TActivity extends ActivityDefinition> = (args: WorkerInferInput<TActivity>) => AsyncResult<WorkerInferOutput<TActivity>, ApplicationFailure$1>;
17
18
  /**
18
19
  * Map of all activity implementations for a contract (global + all workflow-specific).
19
20
  *
@@ -63,7 +64,7 @@ type ActivitiesHandler<TContract extends ContractDefinition> = (TContract["activ
63
64
  *
64
65
  * This wraps all activity implementations with:
65
66
  * - Validation at network boundaries
66
- * - `ResultAsync<T, ApplicationFailure>` pattern for explicit error handling
67
+ * - `AsyncResult<T, ApplicationFailure>` pattern for explicit error handling
67
68
  * - Automatic conversion from Result to Promise (throwing on Error)
68
69
  *
69
70
  * TypeScript ensures ALL activities (global + workflow-specific) are implemented.
@@ -73,15 +74,15 @@ type ActivitiesHandler<TContract extends ContractDefinition> = (TContract["activ
73
74
  * @example
74
75
  * ```ts
75
76
  * import { declareActivitiesHandler, ApplicationFailure } from '@temporal-contract/worker/activity';
76
- * import { ResultAsync, errAsync, okAsync } from 'neverthrow';
77
+ * import { fromPromise } from 'unthrown';
77
78
  * import myContract from './contract';
78
79
  *
79
80
  * export const activities = declareActivitiesHandler({
80
81
  * contract: myContract,
81
82
  * activities: {
82
- * // Activity returns ResultAsync instead of throwing.
83
+ * // Activity returns AsyncResult instead of throwing.
83
84
  * sendEmail: (args) =>
84
- * ResultAsync.fromPromise(
85
+ * fromPromise(
85
86
  * emailService.send(args),
86
87
  * (error) =>
87
88
  * // Wrap technical errors in ApplicationFailure. `nonRetryable`
@@ -109,10 +110,11 @@ type ActivitiesHandler<TContract extends ContractDefinition> = (TContract["activ
109
110
  *
110
111
  * @remarks
111
112
  * The wrapper accepts implementations in the
112
- * `ResultAsync<T, ApplicationFailure>` shape and produces ordinary
113
+ * `AsyncResult<T, ApplicationFailure>` shape and produces ordinary
113
114
  * Promise-returning Temporal handlers (`err(...)` → thrown
114
115
  * `ApplicationFailure`; `ok(...)` → output validated against the
115
- * contract and resolved). It does **not** hide Temporal's
116
+ * contract and resolved; `defect` → original cause re-thrown). It does
117
+ * **not** hide Temporal's
116
118
  * `@temporalio/activity` runtime: inside the body you can still call
117
119
  * `Context.current()` from `@temporalio/activity` to access heartbeats
118
120
  * (`heartbeat(details)`, `heartbeatDetails`), activity info (attempt
@@ -1 +1 @@
1
- {"version":3,"file":"activity.d.mts","names":[],"sources":["../src/activity.ts"],"mappings":";;;;;;AAgCwD;;;;;;;;;AAAA,KAWnD,4BAAA,mBAA+C,kBAAA,KAClD,IAAA,EAAM,gBAAA,CAAiB,SAAA,MACpB,WAAA,CAAY,iBAAA,CAAkB,SAAA,GAAY,oBAAA;;;;;;;;;;;;;AAAkB;AAAA;;;;;;;;;;KAyB5D,uCAAA,mBAA0D,kBAAA,KAE5D,SAAA,uBAAgC,MAAA,SAAe,kBAAA,IAC5C,+BAAA,CAAgC,SAAA,8CAIZ,SAAA,gB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,CAAkB,SAAA"}
package/dist/activity.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { c as ActivityInputValidationError, i as extractHandlerInput, l as ActivityOutputValidationError, s as ActivityDefinitionNotFoundError, v as ValidationError } from "./internal-D0wfFl0y.mjs";
1
+ import { a as extractHandlerInput, c as ActivityDefinitionNotFoundError, l as ActivityInputValidationError, u as ActivityOutputValidationError, y as ValidationError } from "./internal-DqYK4YQK.mjs";
2
2
  import { ApplicationFailure } from "@temporalio/common";
3
3
  //#region src/activity.ts
4
4
  /**
@@ -6,7 +6,7 @@ import { ApplicationFailure } from "@temporalio/common";
6
6
  *
7
7
  * This wraps all activity implementations with:
8
8
  * - Validation at network boundaries
9
- * - `ResultAsync<T, ApplicationFailure>` pattern for explicit error handling
9
+ * - `AsyncResult<T, ApplicationFailure>` pattern for explicit error handling
10
10
  * - Automatic conversion from Result to Promise (throwing on Error)
11
11
  *
12
12
  * TypeScript ensures ALL activities (global + workflow-specific) are implemented.
@@ -16,15 +16,15 @@ import { ApplicationFailure } from "@temporalio/common";
16
16
  * @example
17
17
  * ```ts
18
18
  * import { declareActivitiesHandler, ApplicationFailure } from '@temporal-contract/worker/activity';
19
- * import { ResultAsync, errAsync, okAsync } from 'neverthrow';
19
+ * import { fromPromise } from 'unthrown';
20
20
  * import myContract from './contract';
21
21
  *
22
22
  * export const activities = declareActivitiesHandler({
23
23
  * contract: myContract,
24
24
  * activities: {
25
- * // Activity returns ResultAsync instead of throwing.
25
+ * // Activity returns AsyncResult instead of throwing.
26
26
  * sendEmail: (args) =>
27
- * ResultAsync.fromPromise(
27
+ * fromPromise(
28
28
  * emailService.send(args),
29
29
  * (error) =>
30
30
  * // Wrap technical errors in ApplicationFailure. `nonRetryable`
@@ -52,10 +52,11 @@ import { ApplicationFailure } from "@temporalio/common";
52
52
  *
53
53
  * @remarks
54
54
  * The wrapper accepts implementations in the
55
- * `ResultAsync<T, ApplicationFailure>` shape and produces ordinary
55
+ * `AsyncResult<T, ApplicationFailure>` shape and produces ordinary
56
56
  * Promise-returning Temporal handlers (`err(...)` → thrown
57
57
  * `ApplicationFailure`; `ok(...)` → output validated against the
58
- * contract and resolved). It does **not** hide Temporal's
58
+ * contract and resolved; `defect` → original cause re-thrown). It does
59
+ * **not** hide Temporal's
59
60
  * `@temporalio/activity` runtime: inside the body you can still call
60
61
  * `Context.current()` from `@temporalio/activity` to access heartbeats
61
62
  * (`heartbeat(details)`, `heartbeatDetails`), activity info (attempt
@@ -71,12 +72,19 @@ function declareActivitiesHandler(options) {
71
72
  const input = extractHandlerInput(args);
72
73
  const inputResult = await activityDef.input["~standard"].validate(input);
73
74
  if (inputResult.issues) throw new ActivityInputValidationError(activityName, inputResult.issues);
74
- const result = await activityImpl(inputResult.value);
75
- if (result.isOk()) {
76
- const outputResult = await activityDef.output["~standard"].validate(result.value);
77
- if (outputResult.issues) throw new ActivityOutputValidationError(activityName, outputResult.issues);
78
- return outputResult.value;
79
- } else throw result.error;
75
+ return (await activityImpl(inputResult.value)).match({
76
+ ok: async (value) => {
77
+ const outputResult = await activityDef.output["~standard"].validate(value);
78
+ if (outputResult.issues) throw new ActivityOutputValidationError(activityName, outputResult.issues);
79
+ return outputResult.value;
80
+ },
81
+ err: (error) => {
82
+ throw error;
83
+ },
84
+ defect: (cause) => {
85
+ throw cause;
86
+ }
87
+ });
80
88
  };
81
89
  }
82
90
  if (contract.activities) for (const [activityName, impl] of Object.entries(activities)) {
@@ -1 +1 @@
1
- {"version":3,"file":"activity.mjs","names":[],"sources":["../src/activity.ts"],"sourcesContent":["// Entry point for activity implementations.\n//\n// Activities run *outside* the workflow sandbox, so they use neverthrow's\n// `ResultAsync` directly. Workflow code (see workflow.ts) uses the same\n// neverthrow API — neverthrow's evaluation is compatible with Temporal's\n// deterministic replay machinery.\n//\n// Errors flow through Temporal's `ApplicationFailure` (re-exported from\n// `@temporalio/common`) — it's the SDK's first-class failure shape, so we\n// don't wrap it in a custom class. `ApplicationFailure` exposes\n// `nonRetryable`, `type`, `details`, and `category` natively, and survives\n// the activity → workflow serialization boundary unchanged.\nimport { ActivityDefinition, ContractDefinition } from \"@temporal-contract/contract\";\nimport type { ResultAsync } from \"neverthrow\";\nimport { ApplicationFailure } from \"@temporalio/common\";\nimport { WorkerInferInput, WorkerInferOutput } from \"./types.js\";\nimport {\n ActivityDefinitionNotFoundError,\n ActivityInputValidationError,\n ActivityOutputValidationError,\n} from \"./errors.js\";\nimport { extractHandlerInput } from \"./internal.js\";\n\nexport {\n ActivityDefinitionNotFoundError,\n ActivityInputValidationError,\n ActivityOutputValidationError,\n ValidationError,\n} from \"./errors.js\";\n\n// Re-export the canonical activity-failure class so consumers don't need\n// a separate `@temporalio/common` import to construct one.\nexport { ApplicationFailure } from \"@temporalio/common\";\n\n/**\n * Activity implementation using neverthrow's `ResultAsync`.\n *\n * Returns `ResultAsync<Output, ApplicationFailure>` for explicit error\n * handling instead of throwing. The wrapper rethrows `err()` payloads at\n * the activity boundary; Temporal recognizes `ApplicationFailure` natively\n * and applies the configured retry policy (with `nonRetryable: true`\n * opting an instance out per-call).\n */\ntype ResultActivityImplementation<TActivity extends ActivityDefinition> = (\n args: WorkerInferInput<TActivity>,\n) => ResultAsync<WorkerInferOutput<TActivity>, ApplicationFailure>;\n\n/**\n * Map of all activity implementations for a contract (global + all workflow-specific).\n *\n * **Shape note — input is nested by workflow, output is flat.** This\n * asymmetry is deliberate:\n *\n * - The implementation map you write **mirrors the contract's structure**:\n * global activities sit at the root, workflow-local activities nest\n * under their owning workflow's name. Mirroring the contract gives\n * IDE autocomplete that matches `defineContract`, prevents typos that\n * put a workflow-local activity at the global level, and makes\n * ownership visible at definition time.\n * - The handler returned by {@link declareActivitiesHandler} (see\n * {@link ActivitiesHandler}) is **flat** because Temporal's worker\n * sees a single activity namespace at runtime —\n * `proxyActivities<...>()` resolves names from one map regardless of\n * which workflow consumes them. `defineContract` enforces no name\n * collisions across global + workflow-local scopes, so the flat\n * output has no ambiguity to resolve.\n *\n * In short: write nested (mirror the contract); the wrapper flattens\n * for Temporal.\n */\ntype ContractResultActivitiesImplementations<TContract extends ContractDefinition> =\n // Global activities\n (TContract[\"activities\"] extends Record<string, ActivityDefinition>\n ? ResultActivitiesImplementations<TContract[\"activities\"]>\n : {}) &\n // All workflow-specific activities merged\n {\n [TWorkflow in keyof TContract[\"workflows\"]]: TContract[\"workflows\"][TWorkflow][\"activities\"] extends Record<\n string,\n ActivityDefinition\n >\n ? ResultActivitiesImplementations<TContract[\"workflows\"][TWorkflow][\"activities\"]>\n : {};\n };\n\ntype ResultActivitiesImplementations<TActivities extends Record<string, ActivityDefinition>> = {\n [K in keyof TActivities]: ResultActivityImplementation<TActivities[K]>;\n};\n\n/**\n * Options for creating activities handler\n */\ntype DeclareActivitiesHandlerOptions<TContract extends ContractDefinition> = {\n contract: TContract;\n activities: ContractResultActivitiesImplementations<TContract>;\n};\n\ntype ActivityImplementation<TActivity extends ActivityDefinition> = (\n args: WorkerInferInput<TActivity>,\n) => Promise<WorkerInferOutput<TActivity>>;\n\ntype ActivitiesImplementations<TActivities extends Record<string, ActivityDefinition>> = {\n [K in keyof TActivities]: ActivityImplementation<TActivities[K]>;\n};\n\ntype UnionToIntersection<U> = (U extends unknown ? (k: U) => void : never) extends (\n k: infer I,\n) => void\n ? I\n : never;\n\n/**\n * Activities handler ready for Temporal's `Worker.create({ activities })`.\n *\n * Flat shape: every activity (global + all workflow-local) lives at the\n * root of the returned map. See the doc comment on\n * {@link ContractResultActivitiesImplementations} for why the input you\n * write is nested by workflow while this output is flat.\n */\nexport type ActivitiesHandler<TContract extends ContractDefinition> =\n // Global activities\n (TContract[\"activities\"] extends Record<string, ActivityDefinition>\n ? ActivitiesImplementations<TContract[\"activities\"]>\n : {}) &\n // All workflow-specific activities merged at root level (flat)\n UnionToIntersection<\n {\n [TWorkflow in keyof TContract[\"workflows\"]]: TContract[\"workflows\"][TWorkflow][\"activities\"] extends Record<\n string,\n ActivityDefinition\n >\n ? ActivitiesImplementations<TContract[\"workflows\"][TWorkflow][\"activities\"]>\n : {};\n }[keyof TContract[\"workflows\"]]\n >;\n\n/**\n * Create a typed activities handler with automatic validation and Result pattern.\n *\n * This wraps all activity implementations with:\n * - Validation at network boundaries\n * - `ResultAsync<T, ApplicationFailure>` pattern for explicit error handling\n * - Automatic conversion from Result to Promise (throwing on Error)\n *\n * TypeScript ensures ALL activities (global + workflow-specific) are implemented.\n *\n * Use this to create the activities object for the Temporal Worker.\n *\n * @example\n * ```ts\n * import { declareActivitiesHandler, ApplicationFailure } from '@temporal-contract/worker/activity';\n * import { ResultAsync, errAsync, okAsync } from 'neverthrow';\n * import myContract from './contract';\n *\n * export const activities = declareActivitiesHandler({\n * contract: myContract,\n * activities: {\n * // Activity returns ResultAsync instead of throwing.\n * sendEmail: (args) =>\n * ResultAsync.fromPromise(\n * emailService.send(args),\n * (error) =>\n * // Wrap technical errors in ApplicationFailure. `nonRetryable`\n * // is per-instance: set it to true on permanent failures so\n * // Temporal stops retrying immediately.\n * ApplicationFailure.create({\n * type: 'EMAIL_SEND_FAILED',\n * message: 'Failed to send email',\n * nonRetryable: false,\n * cause: error instanceof Error ? error : undefined,\n * }),\n * ).map(() => ({ sent: true })),\n * },\n * });\n *\n * // Use with Temporal Worker\n * import { Worker } from '@temporalio/worker';\n *\n * const worker = await Worker.create({\n * workflowsPath: require.resolve('./workflows'),\n * activities: activities,\n * taskQueue: contract.taskQueue,\n * });\n * ```\n *\n * @remarks\n * The wrapper accepts implementations in the\n * `ResultAsync<T, ApplicationFailure>` shape and produces ordinary\n * Promise-returning Temporal handlers (`err(...)` → thrown\n * `ApplicationFailure`; `ok(...)` → output validated against the\n * contract and resolved). It does **not** hide Temporal's\n * `@temporalio/activity` runtime: inside the body you can still call\n * `Context.current()` from `@temporalio/activity` to access heartbeats\n * (`heartbeat(details)`, `heartbeatDetails`), activity info (attempt\n * number, workflow IDs), and the async-completion task token. See the\n * \"Working with the Activity Context\" section of the worker\n * implementation guide for end-to-end examples.\n */\nexport function declareActivitiesHandler<TContract extends ContractDefinition>(\n options: DeclareActivitiesHandlerOptions<TContract>,\n): ActivitiesHandler<TContract> {\n const { contract, activities } = options;\n\n // Prepare Temporal-compatible activities with validation and Result unwrapping\n const wrappedActivities = {} as ActivitiesHandler<TContract>;\n\n // Helper to create a wrapped implementation from a definition and impl\n function makeWrapped(\n activityName: string,\n activityDef: ActivityDefinition,\n activityImpl: (args: unknown) => ResultAsync<unknown, ApplicationFailure>,\n ) {\n return async (...args: unknown[]) => {\n const input = extractHandlerInput(args);\n\n // Validate input\n const inputResult = await activityDef.input[\"~standard\"].validate(input);\n if (inputResult.issues) {\n throw new ActivityInputValidationError(activityName, inputResult.issues);\n }\n\n // Execute neverthrow activity (returns ResultAsync<T, ApplicationFailure>);\n // awaiting yields a Result<T, ApplicationFailure>.\n const result = await activityImpl(inputResult.value);\n\n // Process result: validate output or throw error\n if (result.isOk()) {\n // Validate output on success\n const outputResult = await activityDef.output[\"~standard\"].validate(result.value);\n if (outputResult.issues) {\n throw new ActivityOutputValidationError(activityName, outputResult.issues);\n }\n return outputResult.value;\n } else {\n // Convert err(...) payload to thrown ApplicationFailure for Temporal.\n // Temporal recognizes this class natively and applies the\n // configured retry policy (honoring `nonRetryable: true`).\n throw result.error;\n }\n };\n }\n\n // 1) Wrap global activities defined directly under contract.activities\n if (contract.activities) {\n for (const [activityName, impl] of Object.entries(activities)) {\n // Skip workflow namespaces if present at root\n if (contract.workflows && activityName in contract.workflows) {\n continue;\n }\n\n const activityDef = contract.activities[activityName];\n if (!activityDef) {\n throw new ActivityDefinitionNotFoundError(activityName, Object.keys(contract.activities));\n }\n\n // Assign wrapped global activity\n (wrappedActivities as Record<string, unknown>)[activityName] = makeWrapped(\n activityName,\n activityDef,\n impl as (args: unknown) => ResultAsync<unknown, ApplicationFailure>,\n );\n }\n }\n\n // 2) Wrap workflow-scoped activities at root level (flat)\n if (contract.workflows) {\n for (const [workflowName, workflowDef] of Object.entries(contract.workflows)) {\n const wfActivitiesImpl = (activities as Record<string, unknown>)[workflowName] as\n | Record<string, unknown>\n | undefined;\n if (!wfActivitiesImpl) {\n // If no implementations provided for this workflow, skip (TypeScript typing should enforce completeness for declared ones)\n continue;\n }\n\n const wfDefs = workflowDef.activities ?? {};\n\n for (const [activityName, impl] of Object.entries(wfActivitiesImpl)) {\n const activityDef = wfDefs[activityName];\n if (!activityDef) {\n throw new ActivityDefinitionNotFoundError(\n `${workflowName}.${activityName}`,\n Object.keys(wfDefs),\n );\n }\n\n // Assign workflow activity directly at root level (flat structure)\n (wrappedActivities as Record<string, unknown>)[activityName] = makeWrapped(\n `${workflowName}.${activityName}`,\n activityDef,\n impl as (args: unknown) => ResultAsync<unknown, ApplicationFailure>,\n );\n }\n }\n }\n\n return wrappedActivities;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsMA,SAAgB,yBACd,SAC8B;CAC9B,MAAM,EAAE,UAAU,eAAe;CAGjC,MAAM,oBAAoB,CAAC;CAG3B,SAAS,YACP,cACA,aACA,cACA;EACA,OAAO,OAAO,GAAG,SAAoB;GACnC,MAAM,QAAQ,oBAAoB,IAAI;GAGtC,MAAM,cAAc,MAAM,YAAY,MAAM,YAAY,CAAC,SAAS,KAAK;GACvE,IAAI,YAAY,QACd,MAAM,IAAI,6BAA6B,cAAc,YAAY,MAAM;GAKzE,MAAM,SAAS,MAAM,aAAa,YAAY,KAAK;GAGnD,IAAI,OAAO,KAAK,GAAG;IAEjB,MAAM,eAAe,MAAM,YAAY,OAAO,YAAY,CAAC,SAAS,OAAO,KAAK;IAChF,IAAI,aAAa,QACf,MAAM,IAAI,8BAA8B,cAAc,aAAa,MAAM;IAE3E,OAAO,aAAa;GACtB,OAIE,MAAM,OAAO;EAEjB;CACF;CAGA,IAAI,SAAS,YACX,KAAK,MAAM,CAAC,cAAc,SAAS,OAAO,QAAQ,UAAU,GAAG;EAE7D,IAAI,SAAS,aAAa,gBAAgB,SAAS,WACjD;EAGF,MAAM,cAAc,SAAS,WAAW;EACxC,IAAI,CAAC,aACH,MAAM,IAAI,gCAAgC,cAAc,OAAO,KAAK,SAAS,UAAU,CAAC;EAI1F,kBAA+C,gBAAgB,YAC7D,cACA,aACA,IACF;CACF;CAIF,IAAI,SAAS,WACX,KAAK,MAAM,CAAC,cAAc,gBAAgB,OAAO,QAAQ,SAAS,SAAS,GAAG;EAC5E,MAAM,mBAAoB,WAAuC;EAGjE,IAAI,CAAC,kBAEH;EAGF,MAAM,SAAS,YAAY,cAAc,CAAC;EAE1C,KAAK,MAAM,CAAC,cAAc,SAAS,OAAO,QAAQ,gBAAgB,GAAG;GACnE,MAAM,cAAc,OAAO;GAC3B,IAAI,CAAC,aACH,MAAM,IAAI,gCACR,GAAG,aAAa,GAAG,gBACnB,OAAO,KAAK,MAAM,CACpB;GAIF,kBAA+C,gBAAgB,YAC7D,GAAG,aAAa,GAAG,gBACnB,aACA,IACF;EACF;CACF;CAGF,OAAO;AACT"}
1
+ {"version":3,"file":"activity.mjs","names":[],"sources":["../src/activity.ts"],"sourcesContent":["// Entry point for activity implementations.\n//\n// Activities run *outside* the workflow sandbox, so they use unthrown's\n// `AsyncResult` directly. Workflow code (see workflow.ts) uses the same\n// unthrown API — unthrown's evaluation is compatible with Temporal's\n// deterministic replay machinery.\n//\n// Errors flow through Temporal's `ApplicationFailure` (re-exported from\n// `@temporalio/common`) — it's the SDK's first-class failure shape, so we\n// don't wrap it in a custom class. `ApplicationFailure` exposes\n// `nonRetryable`, `type`, `details`, and `category` natively, and survives\n// the activity → workflow serialization boundary unchanged.\nimport { ActivityDefinition, ContractDefinition } from \"@temporal-contract/contract\";\nimport type { AsyncResult } from \"unthrown\";\nimport { ApplicationFailure } from \"@temporalio/common\";\nimport { WorkerInferInput, WorkerInferOutput } from \"./types.js\";\nimport {\n ActivityDefinitionNotFoundError,\n ActivityInputValidationError,\n ActivityOutputValidationError,\n} from \"./errors.js\";\nimport { extractHandlerInput } from \"./internal.js\";\n\nexport {\n ActivityDefinitionNotFoundError,\n ActivityInputValidationError,\n ActivityOutputValidationError,\n ValidationError,\n} from \"./errors.js\";\n\n// Re-export the canonical activity-failure class so consumers don't need\n// a separate `@temporalio/common` import to construct one.\nexport { ApplicationFailure } from \"@temporalio/common\";\n\n/**\n * Activity implementation using unthrown's `AsyncResult`.\n *\n * Returns `AsyncResult<Output, ApplicationFailure>` for explicit error\n * handling instead of throwing. The wrapper rethrows `err()` payloads at\n * the activity boundary; Temporal recognizes `ApplicationFailure` natively\n * and applies the configured retry policy (with `nonRetryable: true`\n * opting an instance out per-call). An unexpected throw surfaces as a\n * `defect` and is re-thrown with its original cause.\n */\ntype ResultActivityImplementation<TActivity extends ActivityDefinition> = (\n args: WorkerInferInput<TActivity>,\n) => AsyncResult<WorkerInferOutput<TActivity>, ApplicationFailure>;\n\n/**\n * Map of all activity implementations for a contract (global + all workflow-specific).\n *\n * **Shape note — input is nested by workflow, output is flat.** This\n * asymmetry is deliberate:\n *\n * - The implementation map you write **mirrors the contract's structure**:\n * global activities sit at the root, workflow-local activities nest\n * under their owning workflow's name. Mirroring the contract gives\n * IDE autocomplete that matches `defineContract`, prevents typos that\n * put a workflow-local activity at the global level, and makes\n * ownership visible at definition time.\n * - The handler returned by {@link declareActivitiesHandler} (see\n * {@link ActivitiesHandler}) is **flat** because Temporal's worker\n * sees a single activity namespace at runtime —\n * `proxyActivities<...>()` resolves names from one map regardless of\n * which workflow consumes them. `defineContract` enforces no name\n * collisions across global + workflow-local scopes, so the flat\n * output has no ambiguity to resolve.\n *\n * In short: write nested (mirror the contract); the wrapper flattens\n * for Temporal.\n */\ntype ContractResultActivitiesImplementations<TContract extends ContractDefinition> =\n // Global activities\n (TContract[\"activities\"] extends Record<string, ActivityDefinition>\n ? ResultActivitiesImplementations<TContract[\"activities\"]>\n : {}) &\n // All workflow-specific activities merged\n {\n [TWorkflow in keyof TContract[\"workflows\"]]: TContract[\"workflows\"][TWorkflow][\"activities\"] extends Record<\n string,\n ActivityDefinition\n >\n ? ResultActivitiesImplementations<TContract[\"workflows\"][TWorkflow][\"activities\"]>\n : {};\n };\n\ntype ResultActivitiesImplementations<TActivities extends Record<string, ActivityDefinition>> = {\n [K in keyof TActivities]: ResultActivityImplementation<TActivities[K]>;\n};\n\n/**\n * Options for creating activities handler\n */\ntype DeclareActivitiesHandlerOptions<TContract extends ContractDefinition> = {\n contract: TContract;\n activities: ContractResultActivitiesImplementations<TContract>;\n};\n\ntype ActivityImplementation<TActivity extends ActivityDefinition> = (\n args: WorkerInferInput<TActivity>,\n) => Promise<WorkerInferOutput<TActivity>>;\n\ntype ActivitiesImplementations<TActivities extends Record<string, ActivityDefinition>> = {\n [K in keyof TActivities]: ActivityImplementation<TActivities[K]>;\n};\n\ntype UnionToIntersection<U> = (U extends unknown ? (k: U) => void : never) extends (\n k: infer I,\n) => void\n ? I\n : never;\n\n/**\n * Activities handler ready for Temporal's `Worker.create({ activities })`.\n *\n * Flat shape: every activity (global + all workflow-local) lives at the\n * root of the returned map. See the doc comment on\n * {@link ContractResultActivitiesImplementations} for why the input you\n * write is nested by workflow while this output is flat.\n */\nexport type ActivitiesHandler<TContract extends ContractDefinition> =\n // Global activities\n (TContract[\"activities\"] extends Record<string, ActivityDefinition>\n ? ActivitiesImplementations<TContract[\"activities\"]>\n : {}) &\n // All workflow-specific activities merged at root level (flat)\n UnionToIntersection<\n {\n [TWorkflow in keyof TContract[\"workflows\"]]: TContract[\"workflows\"][TWorkflow][\"activities\"] extends Record<\n string,\n ActivityDefinition\n >\n ? ActivitiesImplementations<TContract[\"workflows\"][TWorkflow][\"activities\"]>\n : {};\n }[keyof TContract[\"workflows\"]]\n >;\n\n/**\n * Create a typed activities handler with automatic validation and Result pattern.\n *\n * This wraps all activity implementations with:\n * - Validation at network boundaries\n * - `AsyncResult<T, ApplicationFailure>` pattern for explicit error handling\n * - Automatic conversion from Result to Promise (throwing on Error)\n *\n * TypeScript ensures ALL activities (global + workflow-specific) are implemented.\n *\n * Use this to create the activities object for the Temporal Worker.\n *\n * @example\n * ```ts\n * import { declareActivitiesHandler, ApplicationFailure } from '@temporal-contract/worker/activity';\n * import { fromPromise } from 'unthrown';\n * import myContract from './contract';\n *\n * export const activities = declareActivitiesHandler({\n * contract: myContract,\n * activities: {\n * // Activity returns AsyncResult instead of throwing.\n * sendEmail: (args) =>\n * fromPromise(\n * emailService.send(args),\n * (error) =>\n * // Wrap technical errors in ApplicationFailure. `nonRetryable`\n * // is per-instance: set it to true on permanent failures so\n * // Temporal stops retrying immediately.\n * ApplicationFailure.create({\n * type: 'EMAIL_SEND_FAILED',\n * message: 'Failed to send email',\n * nonRetryable: false,\n * cause: error instanceof Error ? error : undefined,\n * }),\n * ).map(() => ({ sent: true })),\n * },\n * });\n *\n * // Use with Temporal Worker\n * import { Worker } from '@temporalio/worker';\n *\n * const worker = await Worker.create({\n * workflowsPath: require.resolve('./workflows'),\n * activities: activities,\n * taskQueue: contract.taskQueue,\n * });\n * ```\n *\n * @remarks\n * The wrapper accepts implementations in the\n * `AsyncResult<T, ApplicationFailure>` shape and produces ordinary\n * Promise-returning Temporal handlers (`err(...)` → thrown\n * `ApplicationFailure`; `ok(...)` → output validated against the\n * contract and resolved; `defect` → original cause re-thrown). It does\n * **not** hide Temporal's\n * `@temporalio/activity` runtime: inside the body you can still call\n * `Context.current()` from `@temporalio/activity` to access heartbeats\n * (`heartbeat(details)`, `heartbeatDetails`), activity info (attempt\n * number, workflow IDs), and the async-completion task token. See the\n * \"Working with the Activity Context\" section of the worker\n * implementation guide for end-to-end examples.\n */\nexport function declareActivitiesHandler<TContract extends ContractDefinition>(\n options: DeclareActivitiesHandlerOptions<TContract>,\n): ActivitiesHandler<TContract> {\n const { contract, activities } = options;\n\n // Prepare Temporal-compatible activities with validation and Result unwrapping\n const wrappedActivities = {} as ActivitiesHandler<TContract>;\n\n // Helper to create a wrapped implementation from a definition and impl\n function makeWrapped(\n activityName: string,\n activityDef: ActivityDefinition,\n activityImpl: (args: unknown) => AsyncResult<unknown, ApplicationFailure>,\n ) {\n return async (...args: unknown[]) => {\n const input = extractHandlerInput(args);\n\n // Validate input\n const inputResult = await activityDef.input[\"~standard\"].validate(input);\n if (inputResult.issues) {\n throw new ActivityInputValidationError(activityName, inputResult.issues);\n }\n\n // Execute unthrown activity (returns AsyncResult<T, ApplicationFailure>);\n // awaiting yields a Result<T, ApplicationFailure>.\n const result = await activityImpl(inputResult.value);\n\n // Fold the three channels: validate output on `ok`, surface the modeled\n // `ApplicationFailure` on `err`, and re-throw a `defect`'s original cause\n // (an unexpected throw inside the activity is a bug, not a domain error).\n return result.match({\n ok: async (value) => {\n const outputResult = await activityDef.output[\"~standard\"].validate(value);\n if (outputResult.issues) {\n throw new ActivityOutputValidationError(activityName, outputResult.issues);\n }\n return outputResult.value;\n },\n // Convert err(...) payload to thrown ApplicationFailure for Temporal.\n // Temporal recognizes this class natively and applies the configured\n // retry policy (honoring `nonRetryable: true`).\n err: (error) => {\n throw error;\n },\n // A defect is an *unanticipated* throw inside the activity. Re-throw the\n // original cause unwrapped: Temporal wraps a non-`ApplicationFailure`\n // error as `ApplicationFailure(type: \"Error\")` and applies the default\n // (retryable) policy — preserving the pre-unthrown behaviour where an\n // uncaught activity throw was simply retried. We deliberately do NOT\n // coerce it to `nonRetryable`: not every unexpected throw is permanent\n // (a transient I/O fault is also \"unmodeled\"), and forcing fail-fast\n // here would silently change retry semantics. An activity that wants a\n // permanent failure should return `err(ApplicationFailure.create({\n // nonRetryable: true }))` explicitly.\n defect: (cause) => {\n throw cause;\n },\n });\n };\n }\n\n // 1) Wrap global activities defined directly under contract.activities\n if (contract.activities) {\n for (const [activityName, impl] of Object.entries(activities)) {\n // Skip workflow namespaces if present at root\n if (contract.workflows && activityName in contract.workflows) {\n continue;\n }\n\n const activityDef = contract.activities[activityName];\n if (!activityDef) {\n throw new ActivityDefinitionNotFoundError(activityName, Object.keys(contract.activities));\n }\n\n // Assign wrapped global activity\n (wrappedActivities as Record<string, unknown>)[activityName] = makeWrapped(\n activityName,\n activityDef,\n impl as (args: unknown) => AsyncResult<unknown, ApplicationFailure>,\n );\n }\n }\n\n // 2) Wrap workflow-scoped activities at root level (flat)\n if (contract.workflows) {\n for (const [workflowName, workflowDef] of Object.entries(contract.workflows)) {\n const wfActivitiesImpl = (activities as Record<string, unknown>)[workflowName] as\n | Record<string, unknown>\n | undefined;\n if (!wfActivitiesImpl) {\n // If no implementations provided for this workflow, skip (TypeScript typing should enforce completeness for declared ones)\n continue;\n }\n\n const wfDefs = workflowDef.activities ?? {};\n\n for (const [activityName, impl] of Object.entries(wfActivitiesImpl)) {\n const activityDef = wfDefs[activityName];\n if (!activityDef) {\n throw new ActivityDefinitionNotFoundError(\n `${workflowName}.${activityName}`,\n Object.keys(wfDefs),\n );\n }\n\n // Assign workflow activity directly at root level (flat structure)\n (wrappedActivities as Record<string, unknown>)[activityName] = makeWrapped(\n `${workflowName}.${activityName}`,\n activityDef,\n impl as (args: unknown) => AsyncResult<unknown, ApplicationFailure>,\n );\n }\n }\n }\n\n return wrappedActivities;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwMA,SAAgB,yBACd,SAC8B;CAC9B,MAAM,EAAE,UAAU,eAAe;CAGjC,MAAM,oBAAoB,CAAC;CAG3B,SAAS,YACP,cACA,aACA,cACA;EACA,OAAO,OAAO,GAAG,SAAoB;GACnC,MAAM,QAAQ,oBAAoB,IAAI;GAGtC,MAAM,cAAc,MAAM,YAAY,MAAM,YAAY,CAAC,SAAS,KAAK;GACvE,IAAI,YAAY,QACd,MAAM,IAAI,6BAA6B,cAAc,YAAY,MAAM;GAUzE,QAAO,MALc,aAAa,YAAY,KAAK,EAAA,CAKrC,MAAM;IAClB,IAAI,OAAO,UAAU;KACnB,MAAM,eAAe,MAAM,YAAY,OAAO,YAAY,CAAC,SAAS,KAAK;KACzE,IAAI,aAAa,QACf,MAAM,IAAI,8BAA8B,cAAc,aAAa,MAAM;KAE3E,OAAO,aAAa;IACtB;IAIA,MAAM,UAAU;KACd,MAAM;IACR;IAWA,SAAS,UAAU;KACjB,MAAM;IACR;GACF,CAAC;EACH;CACF;CAGA,IAAI,SAAS,YACX,KAAK,MAAM,CAAC,cAAc,SAAS,OAAO,QAAQ,UAAU,GAAG;EAE7D,IAAI,SAAS,aAAa,gBAAgB,SAAS,WACjD;EAGF,MAAM,cAAc,SAAS,WAAW;EACxC,IAAI,CAAC,aACH,MAAM,IAAI,gCAAgC,cAAc,OAAO,KAAK,SAAS,UAAU,CAAC;EAI1F,kBAA+C,gBAAgB,YAC7D,cACA,aACA,IACF;CACF;CAIF,IAAI,SAAS,WACX,KAAK,MAAM,CAAC,cAAc,gBAAgB,OAAO,QAAQ,SAAS,SAAS,GAAG;EAC5E,MAAM,mBAAoB,WAAuC;EAGjE,IAAI,CAAC,kBAEH;EAGF,MAAM,SAAS,YAAY,cAAc,CAAC;EAE1C,KAAK,MAAM,CAAC,cAAc,SAAS,OAAO,QAAQ,gBAAgB,GAAG;GACnE,MAAM,cAAc,OAAO;GAC3B,IAAI,CAAC,aACH,MAAM,IAAI,gCACR,GAAG,aAAa,GAAG,gBACnB,OAAO,KAAK,MAAM,CACpB;GAIF,kBAA+C,gBAAgB,YAC7D,GAAG,aAAa,GAAG,gBACnB,aACA,IACF;EACF;CACF;CAGF,OAAO;AACT"}
@@ -33,12 +33,6 @@ type ClientInferOutput<T extends {
33
33
  }> = StandardSchemaV1.InferOutput<T["output"]>;
34
34
  //#endregion
35
35
  //#region src/errors.d.ts
36
- /**
37
- * Base error class for worker errors
38
- */
39
- declare abstract class WorkerError extends Error {
40
- protected constructor(message: string, cause?: unknown);
41
- }
42
36
  /**
43
37
  * Base class for the contract's runtime validation failures — workflow and
44
38
  * activity input/output, plus signal/query/update payloads.
@@ -71,12 +65,15 @@ declare abstract class ValidationError extends ApplicationFailure {
71
65
  readonly issues: ReadonlyArray<StandardSchemaV1.Issue>;
72
66
  protected constructor(message: string, type: string, issues: ReadonlyArray<StandardSchemaV1.Issue>);
73
67
  }
68
+ declare const ActivityDefinitionNotFoundError_base: import("unthrown").TaggedErrorConstructor<"@temporal-contract/ActivityDefinitionNotFoundError">;
74
69
  /**
75
70
  * Error thrown when an activity definition is not found in the contract
76
71
  */
77
- declare class ActivityDefinitionNotFoundError extends WorkerError {
78
- readonly activityName: string;
79
- readonly availableDefinitions: readonly string[];
72
+ declare class ActivityDefinitionNotFoundError extends ActivityDefinitionNotFoundError_base<{
73
+ activityName: string;
74
+ availableDefinitions: readonly string[];
75
+ message: string;
76
+ }> {
80
77
  constructor(activityName: string, availableDefinitions?: readonly string[]);
81
78
  }
82
79
  /**
@@ -142,14 +139,18 @@ declare class UpdateOutputValidationError extends ValidationError {
142
139
  readonly updateName: string;
143
140
  constructor(updateName: string, issues: ReadonlyArray<StandardSchemaV1.Issue>);
144
141
  }
142
+ declare const ChildWorkflowNotFoundError_base: import("unthrown").TaggedErrorConstructor<"@temporal-contract/ChildWorkflowNotFoundError">;
145
143
  /**
146
144
  * Error thrown when a child workflow is not found in the contract
147
145
  */
148
- declare class ChildWorkflowNotFoundError extends WorkerError {
149
- readonly workflowName: string;
150
- readonly availableWorkflows: readonly string[];
146
+ declare class ChildWorkflowNotFoundError extends ChildWorkflowNotFoundError_base<{
147
+ workflowName: string;
148
+ availableWorkflows: readonly string[];
149
+ message: string;
150
+ }> {
151
151
  constructor(workflowName: string, availableWorkflows?: readonly string[]);
152
152
  }
153
+ declare const ChildWorkflowError_base: import("unthrown").TaggedErrorConstructor<"@temporal-contract/ChildWorkflowError">;
153
154
  /**
154
155
  * Generic error for child workflow operations.
155
156
  *
@@ -159,74 +160,54 @@ declare class ChildWorkflowNotFoundError extends WorkerError {
159
160
  * mirroring the client-side `WorkflowFailedError.cause` behavior, so callers
160
161
  * can branch on the failure category in one step instead of unwrapping twice.
161
162
  */
162
- declare class ChildWorkflowError extends WorkerError {
163
+ declare class ChildWorkflowError extends ChildWorkflowError_base<{
164
+ message: string;
165
+ cause?: unknown;
166
+ }> {
163
167
  constructor(message: string, cause?: unknown);
164
168
  }
169
+ declare const ChildWorkflowCancelledError_base: import("unthrown").TaggedErrorConstructor<"@temporal-contract/ChildWorkflowCancelledError">;
165
170
  /**
166
- * Discriminated variant of {@link ChildWorkflowError} surfaced when a child
167
- * workflow operation (start, execute, or wait-for-result) was cancelled —
168
- * either because the parent workflow itself was cancelled, the child was
169
- * explicitly cancelled, or its enclosing cancellation scope was. Detected via
170
- * `@temporalio/workflow`'s `isCancellation(...)`, which sees through nested
171
- * `ChildWorkflowFailure` / `CancelledFailure` chains.
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.
172
177
  *
173
- * Extends {@link ChildWorkflowError} so existing `instanceof ChildWorkflowError`
174
- * checks still match cancellation, while `instanceof ChildWorkflowCancelledError`
175
- * lets call sites narrow further when they need to branch on cancellation
176
- * explicitly without inspecting `error.cause` against a Temporal SDK class —
177
- * the worker-side analogue of the client-side cause-forwarding pattern.
178
- */
179
- declare class ChildWorkflowCancelledError extends ChildWorkflowError {
180
- readonly workflowName: string;
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
+ }> {
181
190
  constructor(workflowName: string, cause?: unknown);
182
191
  }
192
+ declare const WorkflowCancelledError_base: import("unthrown").TaggedErrorConstructor<"@temporal-contract/WorkflowCancelledError">;
183
193
  /**
184
- * Error surfaced in the `err(...)` branch of a `ResultAsync` when a typed
194
+ * Error surfaced in the `err(...)` branch of an `AsyncResult` when a typed
185
195
  * cancellation scope is cancelled via Temporal's cancellation propagation.
186
196
  * Returned by both `context.cancellableScope` (when the workflow or an
187
197
  * ancestor scope cancels) and `context.nonCancellableScope` (when
188
198
  * cancellation is raised from inside the scope). Distinct from arbitrary
189
199
  * thrown errors so call sites can branch on cancellation explicitly.
190
200
  *
191
- * Non-cancellation errors thrown inside a scope surface as a sibling
192
- * {@link WorkflowScopeError} on the same `err(...)` channel, so callers can
193
- * use `instanceof` to discriminate without falling back to `try/catch`.
194
- */
195
- declare class WorkflowCancelledError extends WorkerError {
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
+ }> {
196
209
  constructor(cause?: unknown);
197
210
  }
198
- /**
199
- * Error surfaced in the `err(...)` branch of a `ResultAsync` when the
200
- * function passed to `cancellableScope` / `nonCancellableScope` throws a
201
- * non-cancellation error.
202
- *
203
- * The original error is preserved on `cause` so call sites can introspect
204
- * it without losing identity:
205
- *
206
- * @example
207
- * ```ts
208
- * const result = await context.cancellableScope(async () => {
209
- * return await context.activities.processStep(args);
210
- * });
211
- *
212
- * if (result.isErr()) {
213
- * if (result.error instanceof WorkflowCancelledError) {
214
- * // graceful cancellation
215
- * } else if (result.error instanceof WorkflowScopeError) {
216
- * // domain error — `result.error.cause` is the original throwable
217
- * }
218
- * }
219
- * ```
220
- *
221
- * Introduced so the scope helpers route every failure through neverthrow's
222
- * railway. Previously, non-cancellation errors were re-thrown out of the
223
- * helper, which became a `ResultAsync` rejection (`new ResultAsync(promise)`
224
- * does not catch) — they leaked as unhandled rejections rather than
225
- * surfacing on the typed error channel callers actually inspect.
226
- */
227
- declare class WorkflowScopeError extends WorkerError {
228
- constructor(cause: unknown);
229
- }
230
211
  //#endregion
231
- export { ClientInferInput as _, ChildWorkflowError as a, WorkerInferOutput as b, QueryOutputValidationError as c, UpdateOutputValidationError as d, ValidationError as f, WorkflowScopeError 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, ClientInferOutput as v, WorkerInferInput as y };
232
- //# sourceMappingURL=errors-CE56feY1.d.cts.map
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,UA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