@temporal-contract/worker 0.0.7 → 0.2.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 +47 -34
- package/dist/activity-utils-B3vP03_P.d.mts +68 -0
- package/dist/activity-utils-B3vP03_P.d.mts.map +1 -0
- package/dist/activity-utils-RsXOceIH.d.cts +68 -0
- package/dist/activity-utils-RsXOceIH.d.cts.map +1 -0
- package/dist/activity.cjs +1 -0
- package/dist/activity.d.cts +99 -3
- package/dist/activity.d.cts.map +1 -0
- package/dist/activity.d.mts +99 -3
- package/dist/activity.d.mts.map +1 -0
- package/dist/activity.mjs +3 -2
- package/dist/activity.mjs.map +1 -0
- package/dist/{errors-C1RFkCuD.d.mts → errors-4jH78z8m.d.cts} +2 -2
- package/dist/errors-4jH78z8m.d.cts.map +1 -0
- package/dist/{errors-BqYWpdvd.d.cts → errors-CmTXZ3JW.d.mts} +2 -2
- package/dist/errors-CmTXZ3JW.d.mts.map +1 -0
- package/dist/{errors-BqVTpfcf.mjs → errors-Di6Ja4Rt.mjs} +2 -1
- package/dist/errors-Di6Ja4Rt.mjs.map +1 -0
- package/dist/worker.cjs +11 -5
- package/dist/worker.d.cts +14 -8
- package/dist/worker.d.cts.map +1 -0
- package/dist/worker.d.mts +14 -8
- package/dist/worker.d.mts.map +1 -0
- package/dist/worker.mjs +12 -6
- package/dist/worker.mjs.map +1 -0
- package/dist/workflow.cjs +92 -106
- package/dist/workflow.d.cts +35 -35
- package/dist/workflow.d.cts.map +1 -0
- package/dist/workflow.d.mts +35 -35
- package/dist/workflow.d.mts.map +1 -0
- package/dist/workflow.mjs +94 -108
- package/dist/workflow.mjs.map +1 -0
- package/package.json +18 -14
- package/dist/activity-Csptpwgf.d.cts +0 -162
- package/dist/activity-UOnp_bSX.d.mts +0 -162
package/README.md
CHANGED
|
@@ -14,43 +14,51 @@ pnpm add @temporal-contract/worker @temporal-contract/contract @temporalio/workf
|
|
|
14
14
|
|
|
15
15
|
```typescript
|
|
16
16
|
// activities.ts
|
|
17
|
-
import { declareActivitiesHandler } from
|
|
17
|
+
import { declareActivitiesHandler, ActivityError } from "@temporal-contract/worker/activity";
|
|
18
|
+
import { Future, Result } from "@swan-io/boxed";
|
|
18
19
|
|
|
19
20
|
export const activities = declareActivitiesHandler({
|
|
20
21
|
contract: myContract,
|
|
21
22
|
activities: {
|
|
22
|
-
sendEmail:
|
|
23
|
-
|
|
23
|
+
sendEmail: ({ to, body }) => {
|
|
24
|
+
return Future.fromPromise(emailService.send({ to, body }))
|
|
25
|
+
.mapError(
|
|
26
|
+
(error) =>
|
|
27
|
+
new ActivityError(
|
|
28
|
+
"EMAIL_FAILED",
|
|
29
|
+
error instanceof Error ? error.message : "Failed to send email",
|
|
30
|
+
error,
|
|
31
|
+
),
|
|
32
|
+
)
|
|
33
|
+
.mapOk(() => ({ sent: true }));
|
|
34
|
+
},
|
|
35
|
+
},
|
|
24
36
|
});
|
|
25
37
|
|
|
26
38
|
// workflows.ts
|
|
27
|
-
import { declareWorkflow } from
|
|
39
|
+
import { declareWorkflow } from "@temporal-contract/worker/workflow";
|
|
28
40
|
|
|
29
41
|
export const processOrder = declareWorkflow({
|
|
30
|
-
workflowName:
|
|
42
|
+
workflowName: "processOrder",
|
|
31
43
|
contract: myContract,
|
|
32
|
-
|
|
33
|
-
|
|
44
|
+
activityOptions: { startToCloseTimeout: "1 minute" },
|
|
45
|
+
implementation: async ({ activities }, input) => {
|
|
46
|
+
// Activities return plain values (Result is unwrapped internally)
|
|
47
|
+
await activities.sendEmail({ to: "user@example.com", body: "Done!" });
|
|
34
48
|
return { success: true };
|
|
35
|
-
}
|
|
49
|
+
},
|
|
36
50
|
});
|
|
37
51
|
|
|
38
52
|
// worker.ts
|
|
39
|
-
import {
|
|
40
|
-
import {
|
|
41
|
-
import
|
|
42
|
-
import myContract from './contract';
|
|
53
|
+
import { Worker } from "@temporalio/worker";
|
|
54
|
+
import { activities } from "./activities";
|
|
55
|
+
import myContract from "./contract";
|
|
43
56
|
|
|
44
57
|
async function run() {
|
|
45
|
-
const
|
|
46
|
-
|
|
47
|
-
});
|
|
48
|
-
|
|
49
|
-
const worker = await createWorker({
|
|
50
|
-
contract: myContract,
|
|
51
|
-
connection,
|
|
52
|
-
workflowsPath: require.resolve('./workflows'),
|
|
58
|
+
const worker = await Worker.create({
|
|
59
|
+
workflowsPath: require.resolve("./workflows"),
|
|
53
60
|
activities,
|
|
61
|
+
taskQueue: myContract.taskQueue,
|
|
54
62
|
});
|
|
55
63
|
|
|
56
64
|
await worker.run();
|
|
@@ -65,33 +73,38 @@ Execute child workflows with type-safe Future/Result pattern. Supports both same
|
|
|
65
73
|
|
|
66
74
|
```typescript
|
|
67
75
|
// workflows.ts
|
|
68
|
-
import { declareWorkflow } from
|
|
76
|
+
import { declareWorkflow } from "@temporal-contract/worker/workflow";
|
|
69
77
|
|
|
70
78
|
export const parentWorkflow = declareWorkflow({
|
|
71
|
-
workflowName:
|
|
79
|
+
workflowName: "parentWorkflow",
|
|
72
80
|
contract: myContract,
|
|
81
|
+
activityOptions: { startToCloseTimeout: "1 minute" },
|
|
73
82
|
implementation: async (context, input) => {
|
|
74
83
|
// Execute child workflow from same contract and wait for result
|
|
75
|
-
const childResult = await context.executeChildWorkflow(myContract,
|
|
84
|
+
const childResult = await context.executeChildWorkflow(myContract, "processPayment", {
|
|
76
85
|
workflowId: `payment-${input.orderId}`,
|
|
77
|
-
args: { amount: input.totalAmount }
|
|
86
|
+
args: { amount: input.totalAmount },
|
|
78
87
|
});
|
|
79
88
|
|
|
80
89
|
childResult.match({
|
|
81
|
-
Ok: (output) => console.log(
|
|
82
|
-
Error: (error) => console.error(
|
|
90
|
+
Ok: (output) => console.log("Payment processed:", output),
|
|
91
|
+
Error: (error) => console.error("Payment failed:", error),
|
|
83
92
|
});
|
|
84
93
|
|
|
85
94
|
// Execute child workflow from another contract (another worker)
|
|
86
|
-
const notificationResult = await context.executeChildWorkflow(
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
95
|
+
const notificationResult = await context.executeChildWorkflow(
|
|
96
|
+
notificationContract,
|
|
97
|
+
"sendNotification",
|
|
98
|
+
{
|
|
99
|
+
workflowId: `notification-${input.orderId}`,
|
|
100
|
+
args: { message: "Order received" },
|
|
101
|
+
},
|
|
102
|
+
);
|
|
90
103
|
|
|
91
104
|
// Or start child workflow without waiting
|
|
92
|
-
const handleResult = await context.startChildWorkflow(myContract,
|
|
105
|
+
const handleResult = await context.startChildWorkflow(myContract, "sendEmail", {
|
|
93
106
|
workflowId: `email-${input.orderId}`,
|
|
94
|
-
args: { to:
|
|
107
|
+
args: { to: "user@example.com", body: "Order received" },
|
|
95
108
|
});
|
|
96
109
|
|
|
97
110
|
handleResult.match({
|
|
@@ -100,11 +113,11 @@ export const parentWorkflow = declareWorkflow({
|
|
|
100
113
|
const result = await handle.result();
|
|
101
114
|
// ...
|
|
102
115
|
},
|
|
103
|
-
Error: (error) => console.error(
|
|
116
|
+
Error: (error) => console.error("Failed to start:", error),
|
|
104
117
|
});
|
|
105
118
|
|
|
106
119
|
return { success: true };
|
|
107
|
-
}
|
|
120
|
+
},
|
|
108
121
|
});
|
|
109
122
|
```
|
|
110
123
|
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { ActivityDefinition, ContractDefinition } from "@temporal-contract/contract";
|
|
2
|
+
|
|
3
|
+
//#region src/activity-utils.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* Extract activity definitions for a specific workflow from a contract
|
|
6
|
+
*
|
|
7
|
+
* This includes both:
|
|
8
|
+
* - Workflow-specific activities defined under workflow.activities
|
|
9
|
+
* - Global activities defined under contract.activities
|
|
10
|
+
*
|
|
11
|
+
* @param contract - The contract definition
|
|
12
|
+
* @param workflowName - The name of the workflow
|
|
13
|
+
* @returns Activity definitions for the workflow (workflow-specific + global activities merged)
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```ts
|
|
17
|
+
* const orderWorkflowActivities = getWorkflowActivities(myContract, 'processOrder');
|
|
18
|
+
* // Returns: { processPayment: ActivityDef, reserveInventory: ActivityDef, sendEmail: ActivityDef }
|
|
19
|
+
* // where sendEmail is a global activity
|
|
20
|
+
* ```
|
|
21
|
+
*/
|
|
22
|
+
declare function getWorkflowActivities<TContract extends ContractDefinition, TWorkflowName extends keyof TContract["workflows"]>(contract: TContract, workflowName: TWorkflowName): Record<string, ActivityDefinition>;
|
|
23
|
+
/**
|
|
24
|
+
* Extract all activity names for a specific workflow from a contract
|
|
25
|
+
*
|
|
26
|
+
* @param contract - The contract definition
|
|
27
|
+
* @param workflowName - The name of the workflow
|
|
28
|
+
* @returns Array of activity names (strings) available for the workflow
|
|
29
|
+
*
|
|
30
|
+
* @example
|
|
31
|
+
* ```ts
|
|
32
|
+
* const activityNames = getWorkflowActivityNames(myContract, 'processOrder');
|
|
33
|
+
* // Returns: ['processPayment', 'reserveInventory', 'sendEmail']
|
|
34
|
+
* ```
|
|
35
|
+
*/
|
|
36
|
+
declare function getWorkflowActivityNames<TContract extends ContractDefinition, TWorkflowName extends keyof TContract["workflows"]>(contract: TContract, workflowName: TWorkflowName): string[];
|
|
37
|
+
/**
|
|
38
|
+
* Check if an activity belongs to a specific workflow
|
|
39
|
+
*
|
|
40
|
+
* @param contract - The contract definition
|
|
41
|
+
* @param workflowName - The name of the workflow
|
|
42
|
+
* @param activityName - The name of the activity to check
|
|
43
|
+
* @returns True if the activity is available for the workflow, false otherwise
|
|
44
|
+
*
|
|
45
|
+
* @example
|
|
46
|
+
* ```ts
|
|
47
|
+
* if (isWorkflowActivity(myContract, 'processOrder', 'processPayment')) {
|
|
48
|
+
* // Activity is available for this workflow
|
|
49
|
+
* }
|
|
50
|
+
* ```
|
|
51
|
+
*/
|
|
52
|
+
declare function isWorkflowActivity<TContract extends ContractDefinition, TWorkflowName extends keyof TContract["workflows"]>(contract: TContract, workflowName: TWorkflowName, activityName: string): boolean;
|
|
53
|
+
/**
|
|
54
|
+
* Get all workflow names from a contract
|
|
55
|
+
*
|
|
56
|
+
* @param contract - The contract definition
|
|
57
|
+
* @returns Array of workflow names defined in the contract
|
|
58
|
+
*
|
|
59
|
+
* @example
|
|
60
|
+
* ```ts
|
|
61
|
+
* const workflows = getWorkflowNames(myContract);
|
|
62
|
+
* // Returns: ['processOrder', 'processRefund']
|
|
63
|
+
* ```
|
|
64
|
+
*/
|
|
65
|
+
declare function getWorkflowNames<TContract extends ContractDefinition>(contract: TContract): Array<keyof TContract["workflows"]>;
|
|
66
|
+
//#endregion
|
|
67
|
+
export { isWorkflowActivity as i, getWorkflowActivityNames as n, getWorkflowNames as r, getWorkflowActivities as t };
|
|
68
|
+
//# sourceMappingURL=activity-utils-B3vP03_P.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"activity-utils-B3vP03_P.d.mts","names":[],"sources":["../src/activity-utils.ts"],"mappings":";;;;;AAqBA;;;;;;;;;;;;;;;;iBAAgB,qBAAA,mBACI,kBAAA,8BACU,SAAA,cAAA,CAC5B,QAAA,EAAU,SAAA,EAAW,YAAA,EAAc,aAAA,GAAgB,MAAA,SAAe,kBAAA;;;;;;;AA2BpE;;;;;;;iBAAgB,wBAAA,mBACI,kBAAA,8BACU,SAAA,cAAA,CAC5B,QAAA,EAAU,SAAA,EAAW,YAAA,EAAc,aAAA;;;;;;;;;;;;AAoBrC;;;;iBAAgB,kBAAA,mBACI,kBAAA,8BACU,SAAA,cAAA,CAC5B,QAAA,EAAU,SAAA,EAAW,YAAA,EAAc,aAAA,EAAe,YAAA;;;;;;;;;;;;;iBAiBpC,gBAAA,mBAAmC,kBAAA,CAAA,CACjD,QAAA,EAAU,SAAA,GACT,KAAA,OAAY,SAAA"}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { ActivityDefinition, ContractDefinition } from "@temporal-contract/contract";
|
|
2
|
+
|
|
3
|
+
//#region src/activity-utils.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* Extract activity definitions for a specific workflow from a contract
|
|
6
|
+
*
|
|
7
|
+
* This includes both:
|
|
8
|
+
* - Workflow-specific activities defined under workflow.activities
|
|
9
|
+
* - Global activities defined under contract.activities
|
|
10
|
+
*
|
|
11
|
+
* @param contract - The contract definition
|
|
12
|
+
* @param workflowName - The name of the workflow
|
|
13
|
+
* @returns Activity definitions for the workflow (workflow-specific + global activities merged)
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```ts
|
|
17
|
+
* const orderWorkflowActivities = getWorkflowActivities(myContract, 'processOrder');
|
|
18
|
+
* // Returns: { processPayment: ActivityDef, reserveInventory: ActivityDef, sendEmail: ActivityDef }
|
|
19
|
+
* // where sendEmail is a global activity
|
|
20
|
+
* ```
|
|
21
|
+
*/
|
|
22
|
+
declare function getWorkflowActivities<TContract extends ContractDefinition, TWorkflowName extends keyof TContract["workflows"]>(contract: TContract, workflowName: TWorkflowName): Record<string, ActivityDefinition>;
|
|
23
|
+
/**
|
|
24
|
+
* Extract all activity names for a specific workflow from a contract
|
|
25
|
+
*
|
|
26
|
+
* @param contract - The contract definition
|
|
27
|
+
* @param workflowName - The name of the workflow
|
|
28
|
+
* @returns Array of activity names (strings) available for the workflow
|
|
29
|
+
*
|
|
30
|
+
* @example
|
|
31
|
+
* ```ts
|
|
32
|
+
* const activityNames = getWorkflowActivityNames(myContract, 'processOrder');
|
|
33
|
+
* // Returns: ['processPayment', 'reserveInventory', 'sendEmail']
|
|
34
|
+
* ```
|
|
35
|
+
*/
|
|
36
|
+
declare function getWorkflowActivityNames<TContract extends ContractDefinition, TWorkflowName extends keyof TContract["workflows"]>(contract: TContract, workflowName: TWorkflowName): string[];
|
|
37
|
+
/**
|
|
38
|
+
* Check if an activity belongs to a specific workflow
|
|
39
|
+
*
|
|
40
|
+
* @param contract - The contract definition
|
|
41
|
+
* @param workflowName - The name of the workflow
|
|
42
|
+
* @param activityName - The name of the activity to check
|
|
43
|
+
* @returns True if the activity is available for the workflow, false otherwise
|
|
44
|
+
*
|
|
45
|
+
* @example
|
|
46
|
+
* ```ts
|
|
47
|
+
* if (isWorkflowActivity(myContract, 'processOrder', 'processPayment')) {
|
|
48
|
+
* // Activity is available for this workflow
|
|
49
|
+
* }
|
|
50
|
+
* ```
|
|
51
|
+
*/
|
|
52
|
+
declare function isWorkflowActivity<TContract extends ContractDefinition, TWorkflowName extends keyof TContract["workflows"]>(contract: TContract, workflowName: TWorkflowName, activityName: string): boolean;
|
|
53
|
+
/**
|
|
54
|
+
* Get all workflow names from a contract
|
|
55
|
+
*
|
|
56
|
+
* @param contract - The contract definition
|
|
57
|
+
* @returns Array of workflow names defined in the contract
|
|
58
|
+
*
|
|
59
|
+
* @example
|
|
60
|
+
* ```ts
|
|
61
|
+
* const workflows = getWorkflowNames(myContract);
|
|
62
|
+
* // Returns: ['processOrder', 'processRefund']
|
|
63
|
+
* ```
|
|
64
|
+
*/
|
|
65
|
+
declare function getWorkflowNames<TContract extends ContractDefinition>(contract: TContract): Array<keyof TContract["workflows"]>;
|
|
66
|
+
//#endregion
|
|
67
|
+
export { isWorkflowActivity as i, getWorkflowActivityNames as n, getWorkflowNames as r, getWorkflowActivities as t };
|
|
68
|
+
//# sourceMappingURL=activity-utils-RsXOceIH.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"activity-utils-RsXOceIH.d.cts","names":[],"sources":["../src/activity-utils.ts"],"mappings":";;;;;AAqBA;;;;;;;;;;;;;;;;iBAAgB,qBAAA,mBACI,kBAAA,8BACU,SAAA,cAAA,CAC5B,QAAA,EAAU,SAAA,EAAW,YAAA,EAAc,aAAA,GAAgB,MAAA,SAAe,kBAAA;;;;;;;AA2BpE;;;;;;;iBAAgB,wBAAA,mBACI,kBAAA,8BACU,SAAA,cAAA,CAC5B,QAAA,EAAU,SAAA,EAAW,YAAA,EAAc,aAAA;;;;;;;;;;;;AAoBrC;;;;iBAAgB,kBAAA,mBACI,kBAAA,8BACU,SAAA,cAAA,CAC5B,QAAA,EAAU,SAAA,EAAW,YAAA,EAAc,aAAA,EAAe,YAAA;;;;;;;;;;;;;iBAiBpC,gBAAA,mBAAmC,kBAAA,CAAA,CACjD,QAAA,EAAU,SAAA,GACT,KAAA,OAAY,SAAA"}
|
package/dist/activity.cjs
CHANGED
package/dist/activity.d.cts
CHANGED
|
@@ -1,3 +1,99 @@
|
|
|
1
|
-
import { n as ActivityInputValidationError, r as ActivityOutputValidationError, t as ActivityDefinitionNotFoundError } from "./errors-
|
|
2
|
-
import {
|
|
3
|
-
|
|
1
|
+
import { g as WorkerInferOutput, h as WorkerInferInput, n as ActivityInputValidationError, r as ActivityOutputValidationError, t as ActivityDefinitionNotFoundError } from "./errors-4jH78z8m.cjs";
|
|
2
|
+
import { i as isWorkflowActivity, n as getWorkflowActivityNames, r as getWorkflowNames, t as getWorkflowActivities } from "./activity-utils-RsXOceIH.cjs";
|
|
3
|
+
import { ActivityDefinition, ContractDefinition } from "@temporal-contract/contract";
|
|
4
|
+
import { Future, Result } from "@swan-io/boxed";
|
|
5
|
+
|
|
6
|
+
//#region src/activity.d.ts
|
|
7
|
+
/**
|
|
8
|
+
* Activity error class that should be used to wrap all technical exceptions
|
|
9
|
+
* Forces proper error handling and enables retry policies
|
|
10
|
+
*/
|
|
11
|
+
declare class ActivityError extends Error {
|
|
12
|
+
readonly code: string;
|
|
13
|
+
constructor(code: string, message: string, cause?: unknown);
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Activity implementation using Future/Result pattern
|
|
17
|
+
*
|
|
18
|
+
* Returns Future<Result<Output, ActivityError>> for explicit error handling instead of throwing exceptions.
|
|
19
|
+
* All errors must be wrapped in ActivityError to enable proper retry policies.
|
|
20
|
+
*/
|
|
21
|
+
type BoxedActivityImplementation<TActivity extends ActivityDefinition> = (args: WorkerInferInput<TActivity>) => Future<Result<WorkerInferOutput<TActivity>, ActivityError>>;
|
|
22
|
+
/**
|
|
23
|
+
* Map of all activity implementations for a contract (global + all workflow-specific)
|
|
24
|
+
*/
|
|
25
|
+
type ContractBoxedActivitiesImplementations<TContract extends ContractDefinition> = (TContract["activities"] extends Record<string, ActivityDefinition> ? BoxedActivitiesImplementations<TContract["activities"]> : {}) & { [TWorkflow in keyof TContract["workflows"]]: TContract["workflows"][TWorkflow]["activities"] extends Record<string, ActivityDefinition> ? BoxedActivitiesImplementations<TContract["workflows"][TWorkflow]["activities"]> : {} };
|
|
26
|
+
type BoxedActivitiesImplementations<TActivities extends Record<string, ActivityDefinition>> = { [K in keyof TActivities]: BoxedActivityImplementation<TActivities[K]> };
|
|
27
|
+
/**
|
|
28
|
+
* Options for creating activities handler
|
|
29
|
+
*/
|
|
30
|
+
type DeclareActivitiesHandlerOptions<TContract extends ContractDefinition> = {
|
|
31
|
+
contract: TContract;
|
|
32
|
+
activities: ContractBoxedActivitiesImplementations<TContract>;
|
|
33
|
+
};
|
|
34
|
+
type ActivityImplementation<TActivity extends ActivityDefinition> = (args: WorkerInferInput<TActivity>) => Promise<WorkerInferOutput<TActivity>>;
|
|
35
|
+
type ActivitiesImplementations<TActivities extends Record<string, ActivityDefinition>> = { [K in keyof TActivities]: ActivityImplementation<TActivities[K]> };
|
|
36
|
+
type UnionToIntersection<U> = (U extends unknown ? (k: U) => void : never) extends ((k: infer I) => void) ? I : never;
|
|
37
|
+
/**
|
|
38
|
+
* Activities handler ready for Temporal Worker
|
|
39
|
+
*
|
|
40
|
+
* Flat structure: all activities (global + all workflow-specific) are at the root level
|
|
41
|
+
*/
|
|
42
|
+
type ActivitiesHandler<TContract extends ContractDefinition> = (TContract["activities"] extends Record<string, ActivityDefinition> ? ActivitiesImplementations<TContract["activities"]> : {}) & UnionToIntersection<{ [TWorkflow in keyof TContract["workflows"]]: TContract["workflows"][TWorkflow]["activities"] extends Record<string, ActivityDefinition> ? ActivitiesImplementations<TContract["workflows"][TWorkflow]["activities"]> : {} }[keyof TContract["workflows"]]>;
|
|
43
|
+
/**
|
|
44
|
+
* Create a typed activities handler with automatic validation and Result pattern
|
|
45
|
+
*
|
|
46
|
+
* This wraps all activity implementations with:
|
|
47
|
+
* - Validation at network boundaries
|
|
48
|
+
* - Result<T, ActivityError> pattern for explicit error handling
|
|
49
|
+
* - Automatic conversion from Result to Promise (throwing on Error)
|
|
50
|
+
*
|
|
51
|
+
* TypeScript ensures ALL activities (global + workflow-specific) are implemented.
|
|
52
|
+
*
|
|
53
|
+
* Use this to create the activities object for the Temporal Worker.
|
|
54
|
+
*
|
|
55
|
+
* @example
|
|
56
|
+
* ```ts
|
|
57
|
+
* import { declareActivitiesHandler, ActivityError } from '@temporal-contract/worker/activity';
|
|
58
|
+
* import { Result, Future } from '@swan-io/boxed';
|
|
59
|
+
* import myContract from './contract';
|
|
60
|
+
*
|
|
61
|
+
* export const activities = declareActivitiesHandler({
|
|
62
|
+
* contract: myContract,
|
|
63
|
+
* activities: {
|
|
64
|
+
* // Activity returns Result instead of throwing
|
|
65
|
+
* // All technical exceptions must be wrapped in ActivityError for retry policies
|
|
66
|
+
* sendEmail: (args) => {
|
|
67
|
+
* return Future.make(async resolve => {
|
|
68
|
+
* try {
|
|
69
|
+
* await emailService.send(args);
|
|
70
|
+
* resolve(Result.Ok({ sent: true }));
|
|
71
|
+
* } catch (error) {
|
|
72
|
+
* // Wrap technical errors in ActivityError to enable retries
|
|
73
|
+
* resolve(Result.Error(
|
|
74
|
+
* new ActivityError(
|
|
75
|
+
* 'EMAIL_SEND_FAILED',
|
|
76
|
+
* 'Failed to send email',
|
|
77
|
+
* error // Original error as cause for debugging
|
|
78
|
+
* )
|
|
79
|
+
* ));
|
|
80
|
+
* }
|
|
81
|
+
* });
|
|
82
|
+
* },
|
|
83
|
+
* },
|
|
84
|
+
* });
|
|
85
|
+
*
|
|
86
|
+
* // Use with Temporal Worker
|
|
87
|
+
* import { Worker } from '@temporalio/worker';
|
|
88
|
+
*
|
|
89
|
+
* const worker = await Worker.create({
|
|
90
|
+
* workflowsPath: require.resolve('./workflows'),
|
|
91
|
+
* activities: activities,
|
|
92
|
+
* taskQueue: contract.taskQueue,
|
|
93
|
+
* });
|
|
94
|
+
* ```
|
|
95
|
+
*/
|
|
96
|
+
declare function declareActivitiesHandler<TContract extends ContractDefinition>(options: DeclareActivitiesHandlerOptions<TContract>): ActivitiesHandler<TContract>;
|
|
97
|
+
//#endregion
|
|
98
|
+
export { ActivitiesHandler, ActivityDefinitionNotFoundError, ActivityError, ActivityInputValidationError, ActivityOutputValidationError, declareActivitiesHandler, getWorkflowActivities, getWorkflowActivityNames, getWorkflowNames, isWorkflowActivity };
|
|
99
|
+
//# sourceMappingURL=activity.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"activity.d.cts","names":[],"sources":["../src/activity.ts"],"mappings":";;;;;;;AA2BA;;;cAAa,aAAA,SAAsB,KAAA;EAAA,SAEf,IAAA;cAAA,IAAA,UAChB,OAAA,UACA,KAAA;AAAA;;;;;;AASH;KAQI,2BAAA,mBAA8C,kBAAA,KACjD,IAAA,EAAM,gBAAA,CAAiB,SAAA,MACpB,MAAA,CAAO,MAAA,CAAO,iBAAA,CAAkB,SAAA,GAAY,aAAA;;;;KAK5C,sCAAA,mBAAyD,kBAAA,KAE3D,SAAA,uBAAgC,MAAA,SAAe,kBAAA,IAC5C,8BAAA,CAA+B,SAAA,8CAIX,SAAA,gBAAyB,SAAA,cAAuB,SAAA,wBAAiC,MAAA,SAEnG,kBAAA,IAEE,8BAAA,CAA+B,SAAA,cAAuB,SAAA;AAAA,KAI3D,8BAAA,qBAAmD,MAAA,SAAe,kBAAA,mBACzD,WAAA,GAAc,2BAAA,CAA4B,WAAA,CAAY,CAAA;;;;KAM/D,+BAAA,mBAAkD,kBAAA;EACrD,QAAA,EAAU,SAAA;EACV,UAAA,EAAY,sCAAA,CAAuC,SAAA;AAAA;AAAA,KAGhD,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,CAAA,6BACrD,CAAA,sBAEE,CAAA;;;AA3C0D;;;KAmDlD,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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAjD2D;;;;;;;;;;;;;;;;;;;;;AAKJ;iBAoGrD,wBAAA,mBAA2C,kBAAA,CAAA,CACzD,OAAA,EAAS,+BAAA,CAAgC,SAAA,IACxC,iBAAA,CAAkB,SAAA"}
|
package/dist/activity.d.mts
CHANGED
|
@@ -1,3 +1,99 @@
|
|
|
1
|
-
import { n as ActivityInputValidationError, r as ActivityOutputValidationError, t as ActivityDefinitionNotFoundError } from "./errors-
|
|
2
|
-
import {
|
|
3
|
-
|
|
1
|
+
import { g as WorkerInferOutput, h as WorkerInferInput, n as ActivityInputValidationError, r as ActivityOutputValidationError, t as ActivityDefinitionNotFoundError } from "./errors-CmTXZ3JW.mjs";
|
|
2
|
+
import { i as isWorkflowActivity, n as getWorkflowActivityNames, r as getWorkflowNames, t as getWorkflowActivities } from "./activity-utils-B3vP03_P.mjs";
|
|
3
|
+
import { ActivityDefinition, ContractDefinition } from "@temporal-contract/contract";
|
|
4
|
+
import { Future, Result } from "@swan-io/boxed";
|
|
5
|
+
|
|
6
|
+
//#region src/activity.d.ts
|
|
7
|
+
/**
|
|
8
|
+
* Activity error class that should be used to wrap all technical exceptions
|
|
9
|
+
* Forces proper error handling and enables retry policies
|
|
10
|
+
*/
|
|
11
|
+
declare class ActivityError extends Error {
|
|
12
|
+
readonly code: string;
|
|
13
|
+
constructor(code: string, message: string, cause?: unknown);
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Activity implementation using Future/Result pattern
|
|
17
|
+
*
|
|
18
|
+
* Returns Future<Result<Output, ActivityError>> for explicit error handling instead of throwing exceptions.
|
|
19
|
+
* All errors must be wrapped in ActivityError to enable proper retry policies.
|
|
20
|
+
*/
|
|
21
|
+
type BoxedActivityImplementation<TActivity extends ActivityDefinition> = (args: WorkerInferInput<TActivity>) => Future<Result<WorkerInferOutput<TActivity>, ActivityError>>;
|
|
22
|
+
/**
|
|
23
|
+
* Map of all activity implementations for a contract (global + all workflow-specific)
|
|
24
|
+
*/
|
|
25
|
+
type ContractBoxedActivitiesImplementations<TContract extends ContractDefinition> = (TContract["activities"] extends Record<string, ActivityDefinition> ? BoxedActivitiesImplementations<TContract["activities"]> : {}) & { [TWorkflow in keyof TContract["workflows"]]: TContract["workflows"][TWorkflow]["activities"] extends Record<string, ActivityDefinition> ? BoxedActivitiesImplementations<TContract["workflows"][TWorkflow]["activities"]> : {} };
|
|
26
|
+
type BoxedActivitiesImplementations<TActivities extends Record<string, ActivityDefinition>> = { [K in keyof TActivities]: BoxedActivityImplementation<TActivities[K]> };
|
|
27
|
+
/**
|
|
28
|
+
* Options for creating activities handler
|
|
29
|
+
*/
|
|
30
|
+
type DeclareActivitiesHandlerOptions<TContract extends ContractDefinition> = {
|
|
31
|
+
contract: TContract;
|
|
32
|
+
activities: ContractBoxedActivitiesImplementations<TContract>;
|
|
33
|
+
};
|
|
34
|
+
type ActivityImplementation<TActivity extends ActivityDefinition> = (args: WorkerInferInput<TActivity>) => Promise<WorkerInferOutput<TActivity>>;
|
|
35
|
+
type ActivitiesImplementations<TActivities extends Record<string, ActivityDefinition>> = { [K in keyof TActivities]: ActivityImplementation<TActivities[K]> };
|
|
36
|
+
type UnionToIntersection<U> = (U extends unknown ? (k: U) => void : never) extends ((k: infer I) => void) ? I : never;
|
|
37
|
+
/**
|
|
38
|
+
* Activities handler ready for Temporal Worker
|
|
39
|
+
*
|
|
40
|
+
* Flat structure: all activities (global + all workflow-specific) are at the root level
|
|
41
|
+
*/
|
|
42
|
+
type ActivitiesHandler<TContract extends ContractDefinition> = (TContract["activities"] extends Record<string, ActivityDefinition> ? ActivitiesImplementations<TContract["activities"]> : {}) & UnionToIntersection<{ [TWorkflow in keyof TContract["workflows"]]: TContract["workflows"][TWorkflow]["activities"] extends Record<string, ActivityDefinition> ? ActivitiesImplementations<TContract["workflows"][TWorkflow]["activities"]> : {} }[keyof TContract["workflows"]]>;
|
|
43
|
+
/**
|
|
44
|
+
* Create a typed activities handler with automatic validation and Result pattern
|
|
45
|
+
*
|
|
46
|
+
* This wraps all activity implementations with:
|
|
47
|
+
* - Validation at network boundaries
|
|
48
|
+
* - Result<T, ActivityError> pattern for explicit error handling
|
|
49
|
+
* - Automatic conversion from Result to Promise (throwing on Error)
|
|
50
|
+
*
|
|
51
|
+
* TypeScript ensures ALL activities (global + workflow-specific) are implemented.
|
|
52
|
+
*
|
|
53
|
+
* Use this to create the activities object for the Temporal Worker.
|
|
54
|
+
*
|
|
55
|
+
* @example
|
|
56
|
+
* ```ts
|
|
57
|
+
* import { declareActivitiesHandler, ActivityError } from '@temporal-contract/worker/activity';
|
|
58
|
+
* import { Result, Future } from '@swan-io/boxed';
|
|
59
|
+
* import myContract from './contract';
|
|
60
|
+
*
|
|
61
|
+
* export const activities = declareActivitiesHandler({
|
|
62
|
+
* contract: myContract,
|
|
63
|
+
* activities: {
|
|
64
|
+
* // Activity returns Result instead of throwing
|
|
65
|
+
* // All technical exceptions must be wrapped in ActivityError for retry policies
|
|
66
|
+
* sendEmail: (args) => {
|
|
67
|
+
* return Future.make(async resolve => {
|
|
68
|
+
* try {
|
|
69
|
+
* await emailService.send(args);
|
|
70
|
+
* resolve(Result.Ok({ sent: true }));
|
|
71
|
+
* } catch (error) {
|
|
72
|
+
* // Wrap technical errors in ActivityError to enable retries
|
|
73
|
+
* resolve(Result.Error(
|
|
74
|
+
* new ActivityError(
|
|
75
|
+
* 'EMAIL_SEND_FAILED',
|
|
76
|
+
* 'Failed to send email',
|
|
77
|
+
* error // Original error as cause for debugging
|
|
78
|
+
* )
|
|
79
|
+
* ));
|
|
80
|
+
* }
|
|
81
|
+
* });
|
|
82
|
+
* },
|
|
83
|
+
* },
|
|
84
|
+
* });
|
|
85
|
+
*
|
|
86
|
+
* // Use with Temporal Worker
|
|
87
|
+
* import { Worker } from '@temporalio/worker';
|
|
88
|
+
*
|
|
89
|
+
* const worker = await Worker.create({
|
|
90
|
+
* workflowsPath: require.resolve('./workflows'),
|
|
91
|
+
* activities: activities,
|
|
92
|
+
* taskQueue: contract.taskQueue,
|
|
93
|
+
* });
|
|
94
|
+
* ```
|
|
95
|
+
*/
|
|
96
|
+
declare function declareActivitiesHandler<TContract extends ContractDefinition>(options: DeclareActivitiesHandlerOptions<TContract>): ActivitiesHandler<TContract>;
|
|
97
|
+
//#endregion
|
|
98
|
+
export { ActivitiesHandler, ActivityDefinitionNotFoundError, ActivityError, ActivityInputValidationError, ActivityOutputValidationError, declareActivitiesHandler, getWorkflowActivities, getWorkflowActivityNames, getWorkflowNames, isWorkflowActivity };
|
|
99
|
+
//# sourceMappingURL=activity.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"activity.d.mts","names":[],"sources":["../src/activity.ts"],"mappings":";;;;;;;AA2BA;;;cAAa,aAAA,SAAsB,KAAA;EAAA,SAEf,IAAA;cAAA,IAAA,UAChB,OAAA,UACA,KAAA;AAAA;;;;;;AASH;KAQI,2BAAA,mBAA8C,kBAAA,KACjD,IAAA,EAAM,gBAAA,CAAiB,SAAA,MACpB,MAAA,CAAO,MAAA,CAAO,iBAAA,CAAkB,SAAA,GAAY,aAAA;;;;KAK5C,sCAAA,mBAAyD,kBAAA,KAE3D,SAAA,uBAAgC,MAAA,SAAe,kBAAA,IAC5C,8BAAA,CAA+B,SAAA,8CAIX,SAAA,gBAAyB,SAAA,cAAuB,SAAA,wBAAiC,MAAA,SAEnG,kBAAA,IAEE,8BAAA,CAA+B,SAAA,cAAuB,SAAA;AAAA,KAI3D,8BAAA,qBAAmD,MAAA,SAAe,kBAAA,mBACzD,WAAA,GAAc,2BAAA,CAA4B,WAAA,CAAY,CAAA;;;;KAM/D,+BAAA,mBAAkD,kBAAA;EACrD,QAAA,EAAU,SAAA;EACV,UAAA,EAAY,sCAAA,CAAuC,SAAA;AAAA;AAAA,KAGhD,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,CAAA,6BACrD,CAAA,sBAEE,CAAA;;;AA3C0D;;;KAmDlD,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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAjD2D;;;;;;;;;;;;;;;;;;;;;AAKJ;iBAoGrD,wBAAA,mBAA2C,kBAAA,CAAA,CACzD,OAAA,EAAS,+BAAA,CAAgC,SAAA,IACxC,iBAAA,CAAkB,SAAA"}
|
package/dist/activity.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as ActivityInputValidationError, r as ActivityOutputValidationError, t as ActivityDefinitionNotFoundError } from "./errors-
|
|
1
|
+
import { n as ActivityInputValidationError, r as ActivityOutputValidationError, t as ActivityDefinitionNotFoundError } from "./errors-Di6Ja4Rt.mjs";
|
|
2
2
|
|
|
3
3
|
//#region src/activity-utils.ts
|
|
4
4
|
/**
|
|
@@ -180,4 +180,5 @@ function declareActivitiesHandler(options) {
|
|
|
180
180
|
}
|
|
181
181
|
|
|
182
182
|
//#endregion
|
|
183
|
-
export { ActivityDefinitionNotFoundError, ActivityError, ActivityInputValidationError, ActivityOutputValidationError, declareActivitiesHandler, getWorkflowActivities, getWorkflowActivityNames, getWorkflowNames, isWorkflowActivity };
|
|
183
|
+
export { ActivityDefinitionNotFoundError, ActivityError, ActivityInputValidationError, ActivityOutputValidationError, declareActivitiesHandler, getWorkflowActivities, getWorkflowActivityNames, getWorkflowNames, isWorkflowActivity };
|
|
184
|
+
//# sourceMappingURL=activity.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"activity.mjs","names":[],"sources":["../src/activity-utils.ts","../src/activity.ts"],"sourcesContent":["// Helper utilities for working with activities\nimport { ActivityDefinition, ContractDefinition } from \"@temporal-contract/contract\";\n\n/**\n * Extract activity definitions for a specific workflow from a contract\n *\n * This includes both:\n * - Workflow-specific activities defined under workflow.activities\n * - Global activities defined under contract.activities\n *\n * @param contract - The contract definition\n * @param workflowName - The name of the workflow\n * @returns Activity definitions for the workflow (workflow-specific + global activities merged)\n *\n * @example\n * ```ts\n * const orderWorkflowActivities = getWorkflowActivities(myContract, 'processOrder');\n * // Returns: { processPayment: ActivityDef, reserveInventory: ActivityDef, sendEmail: ActivityDef }\n * // where sendEmail is a global activity\n * ```\n */\nexport function getWorkflowActivities<\n TContract extends ContractDefinition,\n TWorkflowName extends keyof TContract[\"workflows\"],\n>(contract: TContract, workflowName: TWorkflowName): Record<string, ActivityDefinition> {\n const workflowDef = contract.workflows[workflowName as string];\n const workflowActivities =\n (workflowDef as { activities?: Record<string, ActivityDefinition> })?.activities || {};\n const globalActivities = contract.activities || {};\n\n // Merge global and workflow-specific activities\n // Workflow-specific activities take precedence over global ones with the same name\n return {\n ...globalActivities,\n ...workflowActivities,\n };\n}\n\n/**\n * Extract all activity names for a specific workflow from a contract\n *\n * @param contract - The contract definition\n * @param workflowName - The name of the workflow\n * @returns Array of activity names (strings) available for the workflow\n *\n * @example\n * ```ts\n * const activityNames = getWorkflowActivityNames(myContract, 'processOrder');\n * // Returns: ['processPayment', 'reserveInventory', 'sendEmail']\n * ```\n */\nexport function getWorkflowActivityNames<\n TContract extends ContractDefinition,\n TWorkflowName extends keyof TContract[\"workflows\"],\n>(contract: TContract, workflowName: TWorkflowName): string[] {\n const activities = getWorkflowActivities(contract, workflowName);\n return Object.keys(activities);\n}\n\n/**\n * Check if an activity belongs to a specific workflow\n *\n * @param contract - The contract definition\n * @param workflowName - The name of the workflow\n * @param activityName - The name of the activity to check\n * @returns True if the activity is available for the workflow, false otherwise\n *\n * @example\n * ```ts\n * if (isWorkflowActivity(myContract, 'processOrder', 'processPayment')) {\n * // Activity is available for this workflow\n * }\n * ```\n */\nexport function isWorkflowActivity<\n TContract extends ContractDefinition,\n TWorkflowName extends keyof TContract[\"workflows\"],\n>(contract: TContract, workflowName: TWorkflowName, activityName: string): boolean {\n const activities = getWorkflowActivities(contract, workflowName);\n return activityName in activities;\n}\n\n/**\n * Get all workflow names from a contract\n *\n * @param contract - The contract definition\n * @returns Array of workflow names defined in the contract\n *\n * @example\n * ```ts\n * const workflows = getWorkflowNames(myContract);\n * // Returns: ['processOrder', 'processRefund']\n * ```\n */\nexport function getWorkflowNames<TContract extends ContractDefinition>(\n contract: TContract,\n): Array<keyof TContract[\"workflows\"]> {\n return Object.keys(contract.workflows) as Array<keyof TContract[\"workflows\"]>;\n}\n","// Entry point for activities\nimport { ActivityDefinition, ContractDefinition } from \"@temporal-contract/contract\";\nimport { Future, Result } from \"@swan-io/boxed\";\nimport { WorkerInferInput, WorkerInferOutput } from \"./types.js\";\nimport {\n ActivityDefinitionNotFoundError,\n ActivityInputValidationError,\n ActivityOutputValidationError,\n} from \"./errors.js\";\n\nexport {\n ActivityDefinitionNotFoundError,\n ActivityInputValidationError,\n ActivityOutputValidationError,\n} from \"./errors.js\";\n\nexport {\n getWorkflowActivities,\n getWorkflowActivityNames,\n isWorkflowActivity,\n getWorkflowNames,\n} from \"./activity-utils.js\";\n\n/**\n * Activity error class that should be used to wrap all technical exceptions\n * Forces proper error handling and enables retry policies\n */\nexport class ActivityError extends Error {\n constructor(\n public readonly code: string,\n message: string,\n cause?: unknown,\n ) {\n super(message, { cause });\n this.name = \"ActivityError\";\n // Maintains proper stack trace for where our error was thrown (only available on V8)\n if (Error.captureStackTrace) {\n Error.captureStackTrace(this, ActivityError);\n }\n }\n}\n\n/**\n * Activity implementation using Future/Result pattern\n *\n * Returns Future<Result<Output, ActivityError>> for explicit error handling instead of throwing exceptions.\n * All errors must be wrapped in ActivityError to enable proper retry policies.\n */\ntype BoxedActivityImplementation<TActivity extends ActivityDefinition> = (\n args: WorkerInferInput<TActivity>,\n) => Future<Result<WorkerInferOutput<TActivity>, ActivityError>>;\n\n/**\n * Map of all activity implementations for a contract (global + all workflow-specific)\n */\ntype ContractBoxedActivitiesImplementations<TContract extends ContractDefinition> =\n // Global activities\n (TContract[\"activities\"] extends Record<string, ActivityDefinition>\n ? BoxedActivitiesImplementations<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 ? BoxedActivitiesImplementations<TContract[\"workflows\"][TWorkflow][\"activities\"]>\n : {};\n };\n\ntype BoxedActivitiesImplementations<TActivities extends Record<string, ActivityDefinition>> = {\n [K in keyof TActivities]: BoxedActivityImplementation<TActivities[K]>;\n};\n\n/**\n * Options for creating activities handler\n */\ntype DeclareActivitiesHandlerOptions<TContract extends ContractDefinition> = {\n contract: TContract;\n activities: ContractBoxedActivitiesImplementations<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 Worker\n *\n * Flat structure: all activities (global + all workflow-specific) are at the root level\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 * - Result<T, ActivityError> 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, ActivityError } from '@temporal-contract/worker/activity';\n * import { Result, Future } from '@swan-io/boxed';\n * import myContract from './contract';\n *\n * export const activities = declareActivitiesHandler({\n * contract: myContract,\n * activities: {\n * // Activity returns Result instead of throwing\n * // All technical exceptions must be wrapped in ActivityError for retry policies\n * sendEmail: (args) => {\n * return Future.make(async resolve => {\n * try {\n * await emailService.send(args);\n * resolve(Result.Ok({ sent: true }));\n * } catch (error) {\n * // Wrap technical errors in ActivityError to enable retries\n * resolve(Result.Error(\n * new ActivityError(\n * 'EMAIL_SEND_FAILED',\n * 'Failed to send email',\n * error // Original error as cause for debugging\n * )\n * ));\n * }\n * });\n * },\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 */\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) => Future<Result<unknown, ActivityError>>,\n ) {\n return async (...args: unknown[]) => {\n // Extract single parameter (Temporal passes arguments as an array)\n const input = args.length === 1 ? args[0] : 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 boxed activity (returns Future<Result<T, ActivityError>>)\n const futureResult = activityImpl(inputResult.value);\n\n // Await Future and unwrap Result\n const result = await futureResult;\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 Result.Error to thrown ActivityError for Temporal\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) => Future<Result<unknown, ActivityError>>,\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) => Future<Result<unknown, ActivityError>>,\n );\n }\n }\n }\n\n return wrappedActivities;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAqBA,SAAgB,sBAGd,UAAqB,cAAiE;CAEtF,MAAM,qBADc,SAAS,UAAU,eAEiC,cAAc,EAAE;AAKxF,QAAO;EACL,GALuB,SAAS,cAAc,EAAE;EAMhD,GAAG;EACJ;;;;;;;;;;;;;;;AAgBH,SAAgB,yBAGd,UAAqB,cAAuC;CAC5D,MAAM,aAAa,sBAAsB,UAAU,aAAa;AAChE,QAAO,OAAO,KAAK,WAAW;;;;;;;;;;;;;;;;;AAkBhC,SAAgB,mBAGd,UAAqB,cAA6B,cAA+B;AAEjF,QAAO,gBADY,sBAAsB,UAAU,aAAa;;;;;;;;;;;;;;AAgBlE,SAAgB,iBACd,UACqC;AACrC,QAAO,OAAO,KAAK,SAAS,UAAU;;;;;;;;;ACtExC,IAAa,gBAAb,MAAa,sBAAsB,MAAM;CACvC,YACE,AAAgB,MAChB,SACA,OACA;AACA,QAAM,SAAS,E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iBAAiB,EAAE;GACnE,MAAM,cAAc,OAAO;AAC3B,OAAI,CAAC,YACH,OAAM,IAAI,gCACR,GAAG,aAAa,GAAG,gBACnB,OAAO,KAAK,OAAO,CACpB;AAIH,GAAC,kBAA8C,gBAAgB,YAC7D,GAAG,aAAa,GAAG,gBACnB,aACA,KACD;;;AAKP,QAAO"}
|
|
@@ -2,7 +2,6 @@ import { AnySchema } from "@temporal-contract/contract";
|
|
|
2
2
|
import { StandardSchemaV1 } from "@standard-schema/spec";
|
|
3
3
|
|
|
4
4
|
//#region src/types.d.ts
|
|
5
|
-
|
|
6
5
|
/**
|
|
7
6
|
* Infer input type from a definition (worker perspective)
|
|
8
7
|
* Worker receives the output type (after input schema parsing/transformation)
|
|
@@ -134,4 +133,5 @@ declare class ChildWorkflowError extends WorkerError {
|
|
|
134
133
|
constructor(message: string, cause?: unknown);
|
|
135
134
|
}
|
|
136
135
|
//#endregion
|
|
137
|
-
export { ChildWorkflowNotFoundError as a, SignalInputValidationError as c, WorkflowInputValidationError as d, WorkflowOutputValidationError as f, WorkerInferOutput as g, WorkerInferInput as h, ChildWorkflowError as i, UpdateInputValidationError as l, ClientInferOutput as m, ActivityInputValidationError as n, QueryInputValidationError as o, ClientInferInput as p, ActivityOutputValidationError as r, QueryOutputValidationError as s, ActivityDefinitionNotFoundError as t, UpdateOutputValidationError as u };
|
|
136
|
+
export { ChildWorkflowNotFoundError as a, SignalInputValidationError as c, WorkflowInputValidationError as d, WorkflowOutputValidationError as f, WorkerInferOutput as g, WorkerInferInput as h, ChildWorkflowError as i, UpdateInputValidationError as l, ClientInferOutput as m, ActivityInputValidationError as n, QueryInputValidationError as o, ClientInferInput as p, ActivityOutputValidationError as r, QueryOutputValidationError as s, ActivityDefinitionNotFoundError as t, UpdateOutputValidationError as u };
|
|
137
|
+
//# sourceMappingURL=errors-4jH78z8m.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors-4jH78z8m.d.cts","names":[],"s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src/types.d.ts
|
|
5
|
-
|
|
6
5
|
/**
|
|
7
6
|
* Infer input type from a definition (worker perspective)
|
|
8
7
|
* Worker receives the output type (after input schema parsing/transformation)
|
|
@@ -134,4 +133,5 @@ declare class ChildWorkflowError extends WorkerError {
|
|
|
134
133
|
constructor(message: string, cause?: unknown);
|
|
135
134
|
}
|
|
136
135
|
//#endregion
|
|
137
|
-
export { ChildWorkflowNotFoundError as a, SignalInputValidationError as c, WorkflowInputValidationError as d, WorkflowOutputValidationError as f, WorkerInferOutput as g, WorkerInferInput as h, ChildWorkflowError as i, UpdateInputValidationError as l, ClientInferOutput as m, ActivityInputValidationError as n, QueryInputValidationError as o, ClientInferInput as p, ActivityOutputValidationError as r, QueryOutputValidationError as s, ActivityDefinitionNotFoundError as t, UpdateOutputValidationError as u };
|
|
136
|
+
export { ChildWorkflowNotFoundError as a, SignalInputValidationError as c, WorkflowInputValidationError as d, WorkflowOutputValidationError as f, WorkerInferOutput as g, WorkerInferInput as h, ChildWorkflowError as i, UpdateInputValidationError as l, ClientInferOutput as m, ActivityInputValidationError as n, QueryInputValidationError as o, ClientInferInput as p, ActivityOutputValidationError as r, QueryOutputValidationError as s, ActivityDefinitionNotFoundError as t, UpdateOutputValidationError as u };
|
|
137
|
+
//# sourceMappingURL=errors-CmTXZ3JW.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors-CmTXZ3JW.d.mts","names":[],"sources":["../src/types.ts","../src/errors.ts"],"mappings":";;;;;;AAOA;;KAAY,gBAAA;EAA6B,KAAA,EAAO,SAAA;AAAA,KAAe,gBAAA,CAAiB,WAAA,CAC9E,CAAA;;;;;KAOU,iBAAA;EAA8B,MAAA,EAAQ,SAAA;AAAA,KAAe,gBAAA,CAAiB,UAAA,CAChF,CAAA;;;;;KAOU,gBAAA;EAA6B,KAAA,EAAO,SAAA;AAAA,KAAe,gBAAA,CAAiB,UAAA,CAC9E,CAAA;;;;;KAOU,iBAAA;EAA8B,MAA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SAAA,UACA,MAAA,EAAQ,aAAA,CAAc,gBAAA,CAAiB,KAAA;AAAA;;;;cAW9C,0BAAA,SAAmC,WAAA;EAAA,SAE5B,SAAA;EAAA,SACA,MAAA,EAAQ,aAAA,CAAc,gBAAA,CAAiB,KAAA;cADvC,SAAA,UACA,MAAA,EAAQ,aAAA,CAAc,gBAAA,CAAiB,KAAA;AAAA;AA1HG;;;AAAA,cAqIjD,0BAAA,SAAmC,WAAA;EAAA,SAE5B,UAAA;EAAA,SACA,MAAA,EAAQ,aAAA,CAAc,gBAAA,CAAiB,KAAA;cADvC,UAAA,UACA,MAAA,EAAQ,aAAA,CAAc,gBAAA,CAAiB,KAAA;AAAA;;;AArH3D;cAgIa,2BAAA,SAAoC,WAAA;EAAA,SAE7B,UAAA;EAAA,SACA,MAAA,EAAQ,aAAA,CAAc,gBAAA,CAAiB,KAAA;cADvC,UAAA,UACA,MAAA,EAAQ,aAAA,CAAc,gBAAA,CAAiB,KAAA;AAAA;;;;cAW9C,0BAAA,SAAmC,WAAA;EAAA,SAE5B,YAAA;EAAA,SACA,kBAAA;cADA,YAAA,UACA,kBAAA;AAAA;;;;cAWP,kBAAA,SAA2B,WAAA;cAC1B,OAAA,UAAiB,KAAA;AAAA"}
|
|
@@ -152,4 +152,5 @@ var ChildWorkflowError = class extends WorkerError {
|
|
|
152
152
|
};
|
|
153
153
|
|
|
154
154
|
//#endregion
|
|
155
|
-
export { ChildWorkflowNotFoundError as a, SignalInputValidationError as c, WorkflowInputValidationError as d, WorkflowOutputValidationError as f, ChildWorkflowError as i, UpdateInputValidationError as l, ActivityInputValidationError as n, QueryInputValidationError as o, ActivityOutputValidationError as r, QueryOutputValidationError as s, ActivityDefinitionNotFoundError as t, UpdateOutputValidationError as u };
|
|
155
|
+
export { ChildWorkflowNotFoundError as a, SignalInputValidationError as c, WorkflowInputValidationError as d, WorkflowOutputValidationError as f, ChildWorkflowError as i, UpdateInputValidationError as l, ActivityInputValidationError as n, QueryInputValidationError as o, ActivityOutputValidationError as r, QueryOutputValidationError as s, ActivityDefinitionNotFoundError as t, UpdateOutputValidationError as u };
|
|
156
|
+
//# sourceMappingURL=errors-Di6Ja4Rt.mjs.map
|