@temporalio/workflow 1.14.2-canary-release-testing.0 → 1.16.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/lib/cancellation-scope.d.ts +2 -2
- package/lib/cancellation-scope.js +2 -2
- package/lib/flags.js +1 -1
- package/lib/flags.js.map +1 -1
- package/lib/global-attributes.d.ts +1 -0
- package/lib/global-attributes.js.map +1 -1
- package/lib/global-overrides.js +6 -6
- package/lib/global-overrides.js.map +1 -1
- package/lib/index.d.ts +43 -10
- package/lib/index.js +42 -8
- package/lib/index.js.map +1 -1
- package/lib/interceptors.d.ts +30 -1
- package/lib/interfaces.d.ts +96 -31
- package/lib/interfaces.js +54 -14
- package/lib/interfaces.js.map +1 -1
- package/lib/internals.d.ts +2 -1
- package/lib/internals.js +24 -7
- package/lib/internals.js.map +1 -1
- package/lib/metrics.js +4 -0
- package/lib/metrics.js.map +1 -1
- package/lib/nexus.d.ts +55 -4
- package/lib/nexus.js +74 -12
- package/lib/nexus.js.map +1 -1
- package/lib/trigger.d.ts +17 -2
- package/lib/trigger.js +17 -2
- package/lib/trigger.js.map +1 -1
- package/lib/workflow.js +18 -13
- package/lib/workflow.js.map +1 -1
- package/package.json +5 -5
- package/src/cancellation-scope.ts +2 -2
- package/src/flags.ts +1 -1
- package/src/global-attributes.ts +4 -3
- package/src/global-overrides.ts +6 -6
- package/src/index.ts +50 -12
- package/src/interceptors.ts +34 -1
- package/src/interfaces.ts +110 -38
- package/src/internals.ts +28 -8
- package/src/metrics.ts +7 -0
- package/src/nexus.ts +94 -14
- package/src/trigger.ts +17 -2
- package/src/workflow.ts +19 -13
|
@@ -24,7 +24,7 @@ export interface CancellationScopeOptions {
|
|
|
24
24
|
}
|
|
25
25
|
/**
|
|
26
26
|
* Cancellation Scopes provide the mechanic by which a Workflow may gracefully handle incoming requests for cancellation
|
|
27
|
-
* (e.g. in response to {@link WorkflowHandle.cancel} or through the UI or CLI), as well as request
|
|
27
|
+
* (e.g. in response to {@link WorkflowHandle.cancel} or through the UI or CLI), as well as request cancellation of
|
|
28
28
|
* cancellable operations it owns (e.g. Activities, Timers, Child Workflows, etc).
|
|
29
29
|
*
|
|
30
30
|
* Cancellation Scopes form a tree, with the Workflow's main function running in the root scope of that tree.
|
|
@@ -46,7 +46,7 @@ export interface CancellationScopeOptions {
|
|
|
46
46
|
* ```ts
|
|
47
47
|
* async function myWorkflow(...): Promise<void> {
|
|
48
48
|
* try {
|
|
49
|
-
* // This activity runs in the root cancellation scope. Therefore, a
|
|
49
|
+
* // This activity runs in the root cancellation scope. Therefore, a cancellation request on
|
|
50
50
|
* // the Workflow execution (e.g. through the UI or CLI) automatically propagates to this
|
|
51
51
|
* // activity. Assuming that the activity properly handle the cancellation request, then the
|
|
52
52
|
* // call below will throw an `ActivityFailure` exception, with `cause` sets to an
|
|
@@ -15,7 +15,7 @@ exports.AsyncLocalStorage = globalThis.AsyncLocalStorage ?? class {
|
|
|
15
15
|
const NO_PARENT = Symbol('NO_PARENT');
|
|
16
16
|
/**
|
|
17
17
|
* Cancellation Scopes provide the mechanic by which a Workflow may gracefully handle incoming requests for cancellation
|
|
18
|
-
* (e.g. in response to {@link WorkflowHandle.cancel} or through the UI or CLI), as well as request
|
|
18
|
+
* (e.g. in response to {@link WorkflowHandle.cancel} or through the UI or CLI), as well as request cancellation of
|
|
19
19
|
* cancellable operations it owns (e.g. Activities, Timers, Child Workflows, etc).
|
|
20
20
|
*
|
|
21
21
|
* Cancellation Scopes form a tree, with the Workflow's main function running in the root scope of that tree.
|
|
@@ -37,7 +37,7 @@ const NO_PARENT = Symbol('NO_PARENT');
|
|
|
37
37
|
* ```ts
|
|
38
38
|
* async function myWorkflow(...): Promise<void> {
|
|
39
39
|
* try {
|
|
40
|
-
* // This activity runs in the root cancellation scope. Therefore, a
|
|
40
|
+
* // This activity runs in the root cancellation scope. Therefore, a cancellation request on
|
|
41
41
|
* // the Workflow execution (e.g. through the UI or CLI) automatically propagates to this
|
|
42
42
|
* // activity. Assuming that the activity properly handle the cancellation request, then the
|
|
43
43
|
* // call below will throw an `ActivityFailure` exception, with `cause` sets to an
|
package/lib/flags.js
CHANGED
|
@@ -88,7 +88,7 @@ function assertValidFlag(id) {
|
|
|
88
88
|
}
|
|
89
89
|
function buildIdSdkVersionMatches(version) {
|
|
90
90
|
const regex = new RegExp(`^@temporalio/worker@(${version.source})[+]`);
|
|
91
|
-
return ({ info }) => info.currentBuildId != null && regex.test(info.currentBuildId); // eslint-disable-line
|
|
91
|
+
return ({ info }) => info.currentBuildId != null && regex.test(info.currentBuildId); // eslint-disable-line @typescript-eslint/no-deprecated
|
|
92
92
|
}
|
|
93
93
|
/**
|
|
94
94
|
* Creates an `AltConditionFn` that checks if the SDK version is equal to or after the provided version.
|
package/lib/flags.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"flags.js","sourceRoot":"","sources":["../src/flags.ts"],"names":[],"mappings":";;;AAgGA,0CAEC;AA1FD,MAAM,aAAa,GAAyB,IAAI,GAAG,EAAE,CAAC;AAEzC,QAAA,QAAQ,GAAG;IACtB;;;;;;;;;;;OAWG;IACH,8CAA8C,EAAE,UAAU,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,wBAAwB,CAAC,aAAa,CAAC,CAAC,CAAC;IAE9G;;;;;;;;;;;;;;;;;;;OAmBG;IACH,0CAA0C,EAAE,UAAU,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,wBAAwB,CAAC,aAAa,CAAC,CAAC,CAAC;IAE1G;;;;;;;;OAQG;IACH,6CAA6C,EAAE,UAAU,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,SAAS,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;IAElH;;;;;;OAMG;IACH,8CAA8C,EAAE,UAAU,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,SAAS,CAAC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AC;YAC9B,KAAK,EAAE,MAAM,CAAC,QAAQ,CAAC,KAAM,CAAC;YAC9B,KAAK,EAAE,MAAM,CAAC,QAAQ,CAAC,KAAM,CAAC;SAC/B,CAAC;IACJ,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,SAAS,CAAC;IACnB,CAAC;AACH,CAAC;AAED,SAAS,aAAa,CAAC,CAAS,EAAE,CAAS;IACzC,IAAI,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,KAAK;QAAE,OAAO,CAAC,CAAC,CAAC;IACjC,IAAI,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,KAAK;QAAE,OAAO,CAAC,CAAC,CAAC;IACjC,IAAI,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,KAAK;QAAE,OAAO,CAAC,CAAC,CAAC;IACjC,IAAI,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,KAAK;QAAE,OAAO,CAAC,CAAC,CAAC;IACjC,IAAI,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,KAAK;QAAE,OAAO,CAAC,CAAC,CAAC;IACjC,IAAI,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,KAAK;QAAE,OAAO,CAAC,CAAC,CAAC;IACjC,OAAO,CAAC,CAAC;AACX,CAAC"}
|
|
@@ -4,6 +4,7 @@ import type { WorkflowInterceptorsFactory } from './interceptors';
|
|
|
4
4
|
declare global {
|
|
5
5
|
var __TEMPORAL__: {
|
|
6
6
|
api: typeof import('./worker-interface.ts');
|
|
7
|
+
preloadModules?: () => void;
|
|
7
8
|
importWorkflows: () => Record<string, Workflow>;
|
|
8
9
|
importInterceptors: () => [{
|
|
9
10
|
interceptors: WorkflowInterceptorsFactory;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"global-attributes.js","sourceRoot":"","sources":["../src/global-attributes.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"global-attributes.js","sourceRoot":"","sources":["../src/global-attributes.ts"],"names":[],"mappings":";;;AA8BA,oCAEC;AAED,8CAEC;AAED,0DAIC;AA1CD,+CAAsE;AA8BtE,SAAgB,YAAY,CAAC,SAAgC;IAC3D,UAAU,CAAC,sBAAsB,GAAG,SAAS,CAAC;AAChD,CAAC;AAED,SAAgB,iBAAiB;IAC/B,OAAO,UAAU,CAAC,sBAAsB,CAAC;AAC3C,CAAC;AAED,SAAgB,uBAAuB,CAAC,yBAAiC;IACvE,MAAM,SAAS,GAAG,iBAAiB,EAAE,CAAC;IACtC,IAAI,SAAS,IAAI,IAAI;QAAE,MAAM,IAAI,0BAAiB,CAAC,yBAAyB,CAAC,CAAC;IAC9E,OAAO,SAAS,CAAC;AACnB,CAAC;AAED,2FAA2F;AAC3F,6EAA6E;AAChE,QAAA,YAAY,GAAG,uBAAuB,CAAC,IAAI,CAAC,IAAI,EAAE,wBAAwB,CAAC,CAAC"}
|
package/lib/global-overrides.js
CHANGED
|
@@ -36,7 +36,7 @@ function overrideGlobals() {
|
|
|
36
36
|
global.Date.parse = OriginalDate.parse.bind(OriginalDate);
|
|
37
37
|
global.Date.UTC = OriginalDate.UTC.bind(OriginalDate);
|
|
38
38
|
global.Date.prototype = OriginalDate.prototype;
|
|
39
|
-
const
|
|
39
|
+
const timeoutCancellationScopes = new Map();
|
|
40
40
|
/**
|
|
41
41
|
* @param ms sleep duration - number of milliseconds. If given a negative number, value will be set to 1.
|
|
42
42
|
*/
|
|
@@ -49,13 +49,13 @@ function overrideGlobals() {
|
|
|
49
49
|
const timerScope = new cancellation_scope_1.CancellationScope({ cancellable: true });
|
|
50
50
|
const sleepPromise = timerScope.run(() => (0, workflow_1.sleep)(ms));
|
|
51
51
|
sleepPromise.then(() => {
|
|
52
|
-
|
|
52
|
+
timeoutCancellationScopes.delete(seq);
|
|
53
53
|
cb(...args);
|
|
54
54
|
}, () => {
|
|
55
|
-
|
|
55
|
+
timeoutCancellationScopes.delete(seq);
|
|
56
56
|
});
|
|
57
57
|
(0, stack_helpers_1.untrackPromise)(sleepPromise);
|
|
58
|
-
|
|
58
|
+
timeoutCancellationScopes.set(seq, timerScope);
|
|
59
59
|
return seq;
|
|
60
60
|
}
|
|
61
61
|
else {
|
|
@@ -75,9 +75,9 @@ function overrideGlobals() {
|
|
|
75
75
|
};
|
|
76
76
|
global.clearTimeout = function (handle) {
|
|
77
77
|
const activator = (0, global_attributes_1.getActivator)();
|
|
78
|
-
const timerScope =
|
|
78
|
+
const timerScope = timeoutCancellationScopes.get(handle);
|
|
79
79
|
if (timerScope) {
|
|
80
|
-
|
|
80
|
+
timeoutCancellationScopes.delete(handle);
|
|
81
81
|
timerScope.cancel();
|
|
82
82
|
}
|
|
83
83
|
else {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"global-overrides.js","sourceRoot":"","sources":["../src/global-overrides.ts"],"names":[],"mappings":";;AAgBA,0CA2FC;AA3GD;;;;GAIG;AACH,sDAAqD;AACrD,6DAAyD;AACzD,qCAAqD;AACrD,2DAAmD;AACnD,mCAAmC;AACnC,yCAAmC;AACnC,mDAAiD;AAEjD,MAAM,MAAM,GAAG,UAAiB,CAAC;AACjC,MAAM,YAAY,GAAG,UAAU,CAAC,IAAI,CAAC;AAErC,SAAgB,eAAe;IAC7B,0GAA0G;IAC1G,+EAA+E;IAC/E,MAAM,CAAC,OAAO,GAAG;QACf,MAAM,IAAI,kCAAyB,CAAC,wEAAwE,CAAC,CAAC;IAChH,CAAC,CAAC;IACF,MAAM,CAAC,oBAAoB,GAAG;QAC5B,MAAM,IAAI,kCAAyB,CACjC,qFAAqF,CACtF,CAAC;IACJ,CAAC,CAAC;IAEF,MAAM,CAAC,IAAI,GAAG,UAAU,GAAG,IAAe;QACxC,IAAI,IAAI,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YACpB,OAAO,IAAK,YAAoB,CAAC,GAAG,IAAI,CAAC,CAAC;QAC5C,CAAC;QACD,OAAO,IAAI,YAAY,CAAC,IAAA,gCAAY,GAAE,CAAC,GAAG,CAAC,CAAC;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ACF,CAAC,CAAC;QACL,CAAC;IACH,CAAC,CAAC;IAEF,4DAA4D;IAC5D,IAAI,CAAC,MAAM,GAAG,GAAG,EAAE,CAAC,IAAA,gCAAY,GAAE,CAAC,MAAM,EAAE,CAAC;AAC9C,CAAC"}
|
package/lib/index.d.ts
CHANGED
|
@@ -10,15 +10,32 @@
|
|
|
10
10
|
* `clearTimeout` with deterministic versions so these are also usable but have a limitation that they don't play well
|
|
11
11
|
* with {@link https://docs.temporal.io/typescript/cancellation-scopes | cancellation scopes}.
|
|
12
12
|
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
13
|
+
* ```ts
|
|
14
|
+
* import { sleep } from '@temporalio/workflow';
|
|
15
|
+
*
|
|
16
|
+
* export async function sleeper(ms = 100): Promise<void> {
|
|
17
|
+
* await sleep(ms);
|
|
18
|
+
* console.log('slept');
|
|
19
|
+
* }
|
|
20
|
+
* ```
|
|
15
21
|
*
|
|
16
22
|
* ### Activities
|
|
17
23
|
*
|
|
18
24
|
* To schedule Activities, use {@link proxyActivities} to obtain an Activity function and call.
|
|
19
25
|
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
26
|
+
* ```ts
|
|
27
|
+
* import { proxyActivities } from '@temporalio/workflow';
|
|
28
|
+
* import type * as activities from './activities';
|
|
29
|
+
*
|
|
30
|
+
* const { sendEmail } = proxyActivities<typeof activities>({
|
|
31
|
+
* startToCloseTimeout: '1 minute',
|
|
32
|
+
* });
|
|
33
|
+
|
|
34
|
+
export async function sampleWorkflow(): Promise<string> {
|
|
35
|
+
await sendEmail("to@example.com","Hello, Temporal!");
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
* ```
|
|
22
39
|
*
|
|
23
40
|
* ### Updates, Signals and Queries
|
|
24
41
|
*
|
|
@@ -34,8 +51,24 @@
|
|
|
34
51
|
*
|
|
35
52
|
* #### Implementation
|
|
36
53
|
*
|
|
37
|
-
*
|
|
38
|
-
*
|
|
54
|
+
* ```ts
|
|
55
|
+
* export const incrementSignal = wf.defineSignal<[number]>('increment');
|
|
56
|
+
* export const getValueQuery = wf.defineQuery<number>('getValue');
|
|
57
|
+
* export const incrementAndGetValueUpdate = wf.defineUpdate<number, [number]>('incrementAndGetValue');
|
|
58
|
+
*
|
|
59
|
+
* export async function counterWorkflow(initialValue: number): Promise<void> {
|
|
60
|
+
* let count = initialValue;
|
|
61
|
+
* wf.setHandler(incrementSignal, (arg: number) => {
|
|
62
|
+
* count += arg;
|
|
63
|
+
* });
|
|
64
|
+
* wf.setHandler(getValueQuery, () => count);
|
|
65
|
+
* wf.setHandler(incrementAndGetValueUpdate, (arg: number): number => {
|
|
66
|
+
* count += arg;
|
|
67
|
+
* return count;
|
|
68
|
+
* });
|
|
69
|
+
* await wf.condition(() => false);
|
|
70
|
+
* }
|
|
71
|
+
* ```
|
|
39
72
|
*
|
|
40
73
|
* ### More
|
|
41
74
|
*
|
|
@@ -48,11 +81,11 @@
|
|
|
48
81
|
*
|
|
49
82
|
* @module
|
|
50
83
|
*/
|
|
51
|
-
export { ActivityCancellationType, ActivityFailure, ActivityOptions, ApplicationFailure, CancelledFailure, ChildWorkflowFailure, defaultPayloadConverter, PayloadConverter, RetryPolicy, rootCause, SearchAttributes, // eslint-disable-line
|
|
52
|
-
SearchAttributeValue, // eslint-disable-line
|
|
84
|
+
export { ActivityCancellationType, ActivityFailure, ActivityOptions, ApplicationFailure, CancelledFailure, ChildWorkflowFailure, defaultPayloadConverter, PayloadConverter, RetryPolicy, rootCause, SearchAttributes, // eslint-disable-line @typescript-eslint/no-deprecated
|
|
85
|
+
SearchAttributeValue, // eslint-disable-line @typescript-eslint/no-deprecated
|
|
53
86
|
ServerFailure, TemporalFailure, TerminatedFailure, TimeoutFailure, } from '@temporalio/common';
|
|
54
87
|
export * from '@temporalio/common/lib/errors';
|
|
55
|
-
export { ActivityFunction, ActivityInterface, // eslint-disable-line
|
|
88
|
+
export { ActivityFunction, ActivityInterface, // eslint-disable-line @typescript-eslint/no-deprecated
|
|
56
89
|
Payload, QueryDefinition, SignalDefinition, UntypedActivities, Workflow, WorkflowQueryType, WorkflowResultType, WorkflowReturnType, WorkflowSignalType, } from '@temporalio/common/lib/interfaces';
|
|
57
90
|
export * from '@temporalio/common/lib/workflow-handle';
|
|
58
91
|
export * from '@temporalio/common/lib/workflow-options';
|
|
@@ -66,7 +99,7 @@ export { Trigger } from './trigger';
|
|
|
66
99
|
export * from './workflow';
|
|
67
100
|
export { ChildWorkflowHandle, ExternalWorkflowHandle } from './workflow-handle';
|
|
68
101
|
export { metricMeter } from './metrics';
|
|
69
|
-
export {
|
|
102
|
+
export { createNexusServiceClient, NexusServiceClientOptions, NexusServiceClient, NexusOperationHandle, NexusOperationCancellationType, } from './nexus';
|
|
70
103
|
export {
|
|
71
104
|
/**
|
|
72
105
|
* @deprecated Do not use LoggerSinks directly. To log from Workflow code, use the `log` object
|
package/lib/index.js
CHANGED
|
@@ -11,15 +11,32 @@
|
|
|
11
11
|
* `clearTimeout` with deterministic versions so these are also usable but have a limitation that they don't play well
|
|
12
12
|
* with {@link https://docs.temporal.io/typescript/cancellation-scopes | cancellation scopes}.
|
|
13
13
|
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
14
|
+
* ```ts
|
|
15
|
+
* import { sleep } from '@temporalio/workflow';
|
|
16
|
+
*
|
|
17
|
+
* export async function sleeper(ms = 100): Promise<void> {
|
|
18
|
+
* await sleep(ms);
|
|
19
|
+
* console.log('slept');
|
|
20
|
+
* }
|
|
21
|
+
* ```
|
|
16
22
|
*
|
|
17
23
|
* ### Activities
|
|
18
24
|
*
|
|
19
25
|
* To schedule Activities, use {@link proxyActivities} to obtain an Activity function and call.
|
|
20
26
|
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
27
|
+
* ```ts
|
|
28
|
+
* import { proxyActivities } from '@temporalio/workflow';
|
|
29
|
+
* import type * as activities from './activities';
|
|
30
|
+
*
|
|
31
|
+
* const { sendEmail } = proxyActivities<typeof activities>({
|
|
32
|
+
* startToCloseTimeout: '1 minute',
|
|
33
|
+
* });
|
|
34
|
+
|
|
35
|
+
export async function sampleWorkflow(): Promise<string> {
|
|
36
|
+
await sendEmail("to@example.com","Hello, Temporal!");
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
* ```
|
|
23
40
|
*
|
|
24
41
|
* ### Updates, Signals and Queries
|
|
25
42
|
*
|
|
@@ -35,8 +52,24 @@
|
|
|
35
52
|
*
|
|
36
53
|
* #### Implementation
|
|
37
54
|
*
|
|
38
|
-
*
|
|
39
|
-
*
|
|
55
|
+
* ```ts
|
|
56
|
+
* export const incrementSignal = wf.defineSignal<[number]>('increment');
|
|
57
|
+
* export const getValueQuery = wf.defineQuery<number>('getValue');
|
|
58
|
+
* export const incrementAndGetValueUpdate = wf.defineUpdate<number, [number]>('incrementAndGetValue');
|
|
59
|
+
*
|
|
60
|
+
* export async function counterWorkflow(initialValue: number): Promise<void> {
|
|
61
|
+
* let count = initialValue;
|
|
62
|
+
* wf.setHandler(incrementSignal, (arg: number) => {
|
|
63
|
+
* count += arg;
|
|
64
|
+
* });
|
|
65
|
+
* wf.setHandler(getValueQuery, () => count);
|
|
66
|
+
* wf.setHandler(incrementAndGetValueUpdate, (arg: number): number => {
|
|
67
|
+
* count += arg;
|
|
68
|
+
* return count;
|
|
69
|
+
* });
|
|
70
|
+
* await wf.condition(() => false);
|
|
71
|
+
* }
|
|
72
|
+
* ```
|
|
40
73
|
*
|
|
41
74
|
* ### More
|
|
42
75
|
*
|
|
@@ -64,7 +97,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
64
97
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
65
98
|
};
|
|
66
99
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
67
|
-
exports.
|
|
100
|
+
exports.NexusOperationCancellationType = exports.createNexusServiceClient = exports.metricMeter = exports.Trigger = exports.log = exports.proxySinks = exports.ParentClosePolicy = exports.ContinueAsNew = exports.ChildWorkflowCancellationType = exports.CancellationScope = exports.AsyncLocalStorage = exports.TimeoutFailure = exports.TerminatedFailure = exports.TemporalFailure = exports.ServerFailure = exports.rootCause = exports.defaultPayloadConverter = exports.ChildWorkflowFailure = exports.CancelledFailure = exports.ApplicationFailure = exports.ActivityFailure = exports.ActivityCancellationType = void 0;
|
|
68
101
|
var common_1 = require("@temporalio/common");
|
|
69
102
|
Object.defineProperty(exports, "ActivityCancellationType", { enumerable: true, get: function () { return common_1.ActivityCancellationType; } });
|
|
70
103
|
Object.defineProperty(exports, "ActivityFailure", { enumerable: true, get: function () { return common_1.ActivityFailure; } });
|
|
@@ -99,5 +132,6 @@ __exportStar(require("./workflow"), exports);
|
|
|
99
132
|
var metrics_1 = require("./metrics");
|
|
100
133
|
Object.defineProperty(exports, "metricMeter", { enumerable: true, get: function () { return metrics_1.metricMeter; } });
|
|
101
134
|
var nexus_1 = require("./nexus");
|
|
102
|
-
Object.defineProperty(exports, "
|
|
135
|
+
Object.defineProperty(exports, "createNexusServiceClient", { enumerable: true, get: function () { return nexus_1.createNexusServiceClient; } });
|
|
136
|
+
Object.defineProperty(exports, "NexusOperationCancellationType", { enumerable: true, get: function () { return nexus_1.NexusOperationCancellationType; } });
|
|
103
137
|
//# sourceMappingURL=index.js.map
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkFG;;;;;;;;;;;;;;;;;AAEH,6CAiB4B;AAhB1B,kHAAA,wBAAwB,OAAA;AACxB,yGAAA,eAAe,OAAA;AAEf,4GAAA,kBAAkB,OAAA;AAClB,0GAAA,gBAAgB,OAAA;AAChB,8GAAA,oBAAoB,OAAA;AACpB,iHAAA,uBAAuB,OAAA;AAGvB,mGAAA,SAAS,OAAA;AAGT,uGAAA,aAAa,OAAA;AACb,yGAAA,eAAe,OAAA;AACf,2GAAA,iBAAiB,OAAA;AACjB,wGAAA,cAAc,OAAA;AAEhB,gEAA8C;AAc9C,yEAAuD;AACvD,0EAAwD;AACxD,2DAAsG;AAA7F,uHAAA,iBAAiB,OAAA;AAAE,uHAAA,iBAAiB,OAAA;AAC7C,2CAAyB;AACzB,iDAA+B;AAC/B,2CAesB;AAdpB,2HAAA,6BAA6B,OAAA;AAE7B,2GAAA,aAAa,OAAA;AAKb,+GAAA,iBAAiB,OAAA;AAQnB,iCAA0E;AAAjE,mGAAA,UAAU,OAAA;AACnB,+BAA6B;AAApB,2FAAA,GAAG,OAAA;AACZ,qCAAoC;AAA3B,kGAAA,OAAO,OAAA;AAChB,6CAA2B;AAE3B,qCAAwC;AAA/B,sGAAA,WAAW,OAAA;AACpB,iCAMiB;AALf,iHAAA,wBAAwB,OAAA;AAIxB,uHAAA,8BAA8B,OAAA"}
|
package/lib/interceptors.d.ts
CHANGED
|
@@ -5,7 +5,8 @@
|
|
|
5
5
|
*/
|
|
6
6
|
import { ActivityOptions, Duration, Headers, LocalActivityOptions, MetricTags, Next, Timestamp, WorkflowExecution } from '@temporalio/common';
|
|
7
7
|
import type { coresdk } from '@temporalio/proto';
|
|
8
|
-
import { ChildWorkflowOptionsWithDefaults, ContinueAsNewOptions } from './interfaces';
|
|
8
|
+
import type { ChildWorkflowOptionsWithDefaults, ContinueAsNewOptions } from './interfaces';
|
|
9
|
+
import type { NexusOperationCancellationType } from './nexus';
|
|
9
10
|
export { Next, Headers };
|
|
10
11
|
/**
|
|
11
12
|
* A function that instantiates {@link WorkflowInterceptors}.
|
|
@@ -222,6 +223,34 @@ export interface StartNexusOperationOptions {
|
|
|
222
223
|
* Optional: defaults to the maximum allowed by the Temporal server.
|
|
223
224
|
*/
|
|
224
225
|
readonly scheduleToCloseTimeout?: Duration;
|
|
226
|
+
/**
|
|
227
|
+
* How long the operation may wait before it begins executing. If the operation has not started
|
|
228
|
+
* within this window, a timeout error with type SCHEDULE_TO_START is raised.
|
|
229
|
+
*
|
|
230
|
+
* Optional: defaults to no timeout.
|
|
231
|
+
*/
|
|
232
|
+
readonly scheduleToStartTimeout?: Duration;
|
|
233
|
+
/**
|
|
234
|
+
* How long an async operation may take to complete after it has started. If the operation does
|
|
235
|
+
* not complete within this window, a timeout error with type START_TO_CLOSE is raised.
|
|
236
|
+
*
|
|
237
|
+
* Optional: defaults to no timeout.
|
|
238
|
+
*/
|
|
239
|
+
readonly startToCloseTimeout?: Duration;
|
|
240
|
+
/**
|
|
241
|
+
* Determines:
|
|
242
|
+
* - whether cancellation requests should be propagated from the Workflow to the Nexus Operation
|
|
243
|
+
* - whether and when should the Operation's cancellation be reported back to the Workflow
|
|
244
|
+
* (i.e. at which moment should the operation's result promise fail with a `NexusOperationFailure`,
|
|
245
|
+
* with `cause` set to a `CancelledFailure`).
|
|
246
|
+
*
|
|
247
|
+
* Note that this setting only applies to cancellation originating from an external request for the
|
|
248
|
+
* Workflow itself, or from internal cancellation of the `CancellationScope` in which the
|
|
249
|
+
* Operation call was made.
|
|
250
|
+
*
|
|
251
|
+
* @default WAIT_CANCELLATION_COMPLETED
|
|
252
|
+
*/
|
|
253
|
+
readonly cancellationType?: NexusOperationCancellationType;
|
|
225
254
|
/**
|
|
226
255
|
* A fixed, single-line summary for this Nexus Operation that may appear in the UI/CLI.
|
|
227
256
|
* This can be in single-line Temporal markdown format.
|
package/lib/interfaces.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { RawSourceMap } from 'source-map';
|
|
2
|
-
import { RetryPolicy, CommonWorkflowOptions, HandlerUnfinishedPolicy, SearchAttributes, SignalDefinition, UpdateDefinition, QueryDefinition, Duration, VersioningIntent, TypedSearchAttributes, SearchAttributePair, Priority, WorkerDeploymentVersion, VersioningBehavior } from '@temporalio/common';
|
|
2
|
+
import { RetryPolicy, CommonWorkflowOptions, HandlerUnfinishedPolicy, SearchAttributes, SignalDefinition, UpdateDefinition, QueryDefinition, Duration, VersioningIntent, TypedSearchAttributes, SearchAttributePair, Priority, WorkerDeploymentVersion, VersioningBehavior, InitialVersioningBehavior, SuggestContinueAsNewReason } from '@temporalio/common';
|
|
3
3
|
import type { coresdk } from '@temporalio/proto';
|
|
4
4
|
/**
|
|
5
5
|
* Workflow Execution information
|
|
@@ -91,6 +91,22 @@ export interface WorkflowInfo {
|
|
|
91
91
|
* Supported only on Temporal Server 1.20+, always `false` on older servers.
|
|
92
92
|
*/
|
|
93
93
|
readonly continueAsNewSuggested: boolean;
|
|
94
|
+
/**
|
|
95
|
+
* Whether the workflow's Target Worker Deployment Version has changed from its Pinned Version.
|
|
96
|
+
* When true, the workflow should consider continuing-as-new with
|
|
97
|
+
* `initialVersioningBehavior: 'AUTO_UPGRADE'` to move to the new version.
|
|
98
|
+
*
|
|
99
|
+
* This value changes during the lifetime of an Execution.
|
|
100
|
+
*
|
|
101
|
+
* @experimental Upgrade-on-Continue-as-New is experimental and may change.
|
|
102
|
+
*/
|
|
103
|
+
readonly targetWorkerDeploymentVersionChanged: boolean;
|
|
104
|
+
/**
|
|
105
|
+
* Reason(s) why continue as new is suggested. Can potentially be multiple reasons.
|
|
106
|
+
*
|
|
107
|
+
* @experimental May be removed or changed in the future.
|
|
108
|
+
*/
|
|
109
|
+
readonly suggestedContinueAsNewReasons?: SuggestContinueAsNewReason[];
|
|
94
110
|
/**
|
|
95
111
|
* Task queue this Workflow is executing on
|
|
96
112
|
*/
|
|
@@ -162,8 +178,6 @@ export interface WorkflowInfo {
|
|
|
162
178
|
* executing this task for the first time and has a Deployment Version set, then its ID will be
|
|
163
179
|
* used. This value may change over the lifetime of the workflow run, but is deterministic and
|
|
164
180
|
* safe to use for branching.
|
|
165
|
-
*
|
|
166
|
-
* @experimental Deployment based versioning is experimental and may change in the future.
|
|
167
181
|
*/
|
|
168
182
|
readonly currentDeploymentVersion?: WorkerDeploymentVersion;
|
|
169
183
|
readonly unsafe: UnsafeWorkflowInfo;
|
|
@@ -185,7 +199,21 @@ export interface UnsafeWorkflowInfo {
|
|
|
185
199
|
* Task and stay constant for the duration of the Task and during replay.
|
|
186
200
|
*/
|
|
187
201
|
readonly now: () => number;
|
|
202
|
+
/**
|
|
203
|
+
* Whether the workflow is currently replaying.
|
|
204
|
+
*/
|
|
188
205
|
readonly isReplaying: boolean;
|
|
206
|
+
/**
|
|
207
|
+
* Whether the workflow is currently replaying history events.
|
|
208
|
+
*
|
|
209
|
+
* This is similar to {@link isReplaying}, but returns `false` during query handlers and update
|
|
210
|
+
* validators, which are live read-only operations that should not be considered as replaying
|
|
211
|
+
* history events.
|
|
212
|
+
*
|
|
213
|
+
* When this property is true, workflow log messages are suppressed and sinks defined with
|
|
214
|
+
* callDuringReplay=false won't get processed.
|
|
215
|
+
*/
|
|
216
|
+
readonly isReplayingHistoryEvents: boolean;
|
|
189
217
|
}
|
|
190
218
|
/**
|
|
191
219
|
* Information about a workflow update.
|
|
@@ -264,50 +292,80 @@ export interface ContinueAsNewOptions {
|
|
|
264
292
|
*
|
|
265
293
|
* @default 'COMPATIBLE'
|
|
266
294
|
*
|
|
267
|
-
* @deprecated
|
|
268
|
-
* @experimental The Worker Versioning API is still being designed. Major changes are expected.
|
|
295
|
+
* @deprecated Worker Versioning is now deprecated. Please use the Worker Deployment API instead: https://docs.temporal.io/worker-deployments
|
|
269
296
|
*/
|
|
270
297
|
versioningIntent?: VersioningIntent;
|
|
298
|
+
/**
|
|
299
|
+
* Defines the versioning behavior to be used by the first task of a new workflow run in a continue-as-new chain.
|
|
300
|
+
*
|
|
301
|
+
* @experimental Versioning semantics with continue-as-new are experimental and may change in the future.
|
|
302
|
+
*/
|
|
303
|
+
initialVersioningBehavior?: InitialVersioningBehavior;
|
|
271
304
|
}
|
|
272
305
|
/**
|
|
273
|
-
*
|
|
274
|
-
* - whether cancellation requests
|
|
275
|
-
* - whether and when
|
|
276
|
-
* {@link ChildWorkflowHandle.result}
|
|
306
|
+
* Determines:
|
|
307
|
+
* - whether cancellation requests should be propagated from the Parent Workflow to the Child, and
|
|
308
|
+
* - whether and when should the Child's cancellation be reported back to the Parent Workflow
|
|
309
|
+
* (i.e. at which moment should the {@link executeChild}'s or {@link ChildWorkflowHandle.result}'s
|
|
310
|
+
* promise fail with a `ChildWorkflowFailure`, with `cause` set to a `CancelledFailure`).
|
|
311
|
+
*
|
|
312
|
+
* Note that this setting only applies to cancellation originating from an external request for the
|
|
313
|
+
* Parent Workflow itself, or from internal cancellation of the `CancellationScope` in which the
|
|
314
|
+
* Child Workflow call was made. Eventual Cancellation of a Child Workflow on completion of the
|
|
315
|
+
* Parent Workflow is controlled by the {@link ParentClosePolicy} setting.
|
|
277
316
|
*
|
|
278
|
-
* @default
|
|
317
|
+
* @default ChildWorkflowCancellationType.WAIT_CANCELLATION_COMPLETED
|
|
279
318
|
*/
|
|
280
|
-
export type ChildWorkflowCancellationType = (typeof ChildWorkflowCancellationType)[keyof typeof ChildWorkflowCancellationType];
|
|
281
319
|
export declare const ChildWorkflowCancellationType: {
|
|
282
320
|
/**
|
|
283
|
-
*
|
|
321
|
+
* Do not propagate cancellation requests to the Child, and immediately report cancellation
|
|
322
|
+
* to the caller.
|
|
284
323
|
*/
|
|
285
324
|
readonly ABANDON: "ABANDON";
|
|
286
325
|
/**
|
|
287
|
-
*
|
|
326
|
+
* Propagate cancellation request from the Parent Workflow to the Child, yet _immediately_ report
|
|
327
|
+
* cancellation to the caller, i.e. without waiting for the server to confirm the cancellation
|
|
328
|
+
* request.
|
|
329
|
+
*
|
|
330
|
+
* Note that this cancellation type provides no guarantee, from the Parent-side, that the
|
|
331
|
+
* cancellation request will actually be atomically added to the Child workflow's history.
|
|
332
|
+
* In particular, the Child may complete (either successfully or uncessfully) before the
|
|
333
|
+
* cancellation is delivered, resulting in a situation where the Parent workflow thinks its child
|
|
334
|
+
* was cancelled, but the child actually completed successfully.
|
|
335
|
+
*
|
|
336
|
+
* To guarantee that the Child will eventually be notified of the cancellation request,
|
|
337
|
+
* use {@link WAIT_CANCELLATION_REQUESTED}.
|
|
288
338
|
*/
|
|
289
339
|
readonly TRY_CANCEL: "TRY_CANCEL";
|
|
290
340
|
/**
|
|
291
|
-
*
|
|
292
|
-
*
|
|
293
|
-
* ignore the cancellation request, in which case an error might be thrown with a different cause, or the Child may
|
|
294
|
-
* complete successfully.
|
|
341
|
+
* Propagate cancellation request from the Parent Workflow to the Child, then wait for the server
|
|
342
|
+
* to confirm that the Child Workflow cancellation request was recorded in its history.
|
|
295
343
|
*
|
|
296
|
-
*
|
|
344
|
+
* This cancellation type guarantees that the Child will eventually be notified of the
|
|
345
|
+
* cancellation request (that is, unless the Child terminates inbetween due to unexpected causes).
|
|
297
346
|
*/
|
|
298
|
-
readonly
|
|
347
|
+
readonly WAIT_CANCELLATION_REQUESTED: "WAIT_CANCELLATION_REQUESTED";
|
|
299
348
|
/**
|
|
300
|
-
*
|
|
349
|
+
* Propagate cancellation request from the Parent Workflow to the Child, then wait for completion
|
|
350
|
+
* of the Child Workflow.
|
|
351
|
+
*
|
|
352
|
+
* The Child may respect cancellation, in which case the Parent's `executeChild` or
|
|
353
|
+
* `ChildWorkflowHandle.result` promise will fail with a `ChildWorkflowFailure`, with `cause`
|
|
354
|
+
* set to a `CancelledFailure`. On the other hand, the Child may ignore the cancellation request,
|
|
355
|
+
* in which case the corresponding promise will either resolve with a result (if Child completed
|
|
356
|
+
* successfully) or reject with a different cause (if Child completed uncessfully).
|
|
357
|
+
*
|
|
358
|
+
* @default
|
|
301
359
|
*/
|
|
302
|
-
readonly
|
|
360
|
+
readonly WAIT_CANCELLATION_COMPLETED: "WAIT_CANCELLATION_COMPLETED";
|
|
303
361
|
};
|
|
304
|
-
export
|
|
362
|
+
export type ChildWorkflowCancellationType = (typeof ChildWorkflowCancellationType)[keyof typeof ChildWorkflowCancellationType];
|
|
363
|
+
export declare const encodeChildWorkflowCancellationType: (input: coresdk.child_workflow.ChildWorkflowCancellationType | import("@temporalio/common/lib/type-helpers").RemovePrefix<"", "ABANDON" | "TRY_CANCEL" | "WAIT_CANCELLATION_REQUESTED" | "WAIT_CANCELLATION_COMPLETED"> | null | undefined) => coresdk.child_workflow.ChildWorkflowCancellationType | undefined, decodeChildWorkflowCancellationType: (input: coresdk.child_workflow.ChildWorkflowCancellationType | null | undefined) => import("@temporalio/common/lib/type-helpers").RemovePrefix<"", "ABANDON" | "TRY_CANCEL" | "WAIT_CANCELLATION_REQUESTED" | "WAIT_CANCELLATION_COMPLETED"> | undefined;
|
|
305
364
|
/**
|
|
306
365
|
* How a Child Workflow reacts to the Parent Workflow reaching a Closed state.
|
|
307
366
|
*
|
|
308
367
|
* @see {@link https://docs.temporal.io/concepts/what-is-a-parent-close-policy/ | Parent Close Policy}
|
|
309
368
|
*/
|
|
310
|
-
export type ParentClosePolicy = (typeof ParentClosePolicy)[keyof typeof ParentClosePolicy];
|
|
311
369
|
export declare const ParentClosePolicy: {
|
|
312
370
|
/**
|
|
313
371
|
* When the Parent is Closed, the Child is Terminated.
|
|
@@ -348,6 +406,7 @@ export declare const ParentClosePolicy: {
|
|
|
348
406
|
*/
|
|
349
407
|
readonly PARENT_CLOSE_POLICY_REQUEST_CANCEL: "REQUEST_CANCEL";
|
|
350
408
|
};
|
|
409
|
+
export type ParentClosePolicy = (typeof ParentClosePolicy)[keyof typeof ParentClosePolicy];
|
|
351
410
|
export declare const encodeParentClosePolicy: (input: "ABANDON" | "TERMINATE" | "REQUEST_CANCEL" | "PARENT_CLOSE_POLICY_TERMINATE" | "PARENT_CLOSE_POLICY_ABANDON" | "PARENT_CLOSE_POLICY_REQUEST_CANCEL" | coresdk.child_workflow.ParentClosePolicy | null | undefined) => coresdk.child_workflow.ParentClosePolicy | undefined, decodeParentClosePolicy: (input: coresdk.child_workflow.ParentClosePolicy | null | undefined) => "ABANDON" | "TERMINATE" | "REQUEST_CANCEL" | undefined;
|
|
352
411
|
export interface ChildWorkflowOptions extends Omit<CommonWorkflowOptions, 'workflowIdConflictPolicy'> {
|
|
353
412
|
/**
|
|
@@ -364,18 +423,24 @@ export interface ChildWorkflowOptions extends Omit<CommonWorkflowOptions, 'workf
|
|
|
364
423
|
*/
|
|
365
424
|
taskQueue?: string;
|
|
366
425
|
/**
|
|
367
|
-
*
|
|
368
|
-
* - whether cancellation requests
|
|
369
|
-
* - whether and when
|
|
370
|
-
* {@link ChildWorkflowHandle.result}
|
|
426
|
+
* Determines:
|
|
427
|
+
* - whether cancellation requests should be propagated from the Parent Workflow to the Child, and
|
|
428
|
+
* - whether and when should the Child's cancellation be reported back to the Parent Workflow
|
|
429
|
+
* (i.e. at which moment should the {@link executeChild}'s or {@link ChildWorkflowHandle.result}'s
|
|
430
|
+
* promise fail with a `ChildWorkflowFailure`, with `cause` set to a `CancelledFailure`).
|
|
431
|
+
*
|
|
432
|
+
* Note that this setting only applies to cancellation originating from an external request for the
|
|
433
|
+
* Parent Workflow itself, or from internal cancellation of the `CancellationScope` in which the
|
|
434
|
+
* Child Workflow call was made. Eventual Cancellation of a Child Workflow on completion of the
|
|
435
|
+
* Parent Workflow is controlled by the {@link ParentClosePolicy} setting.
|
|
371
436
|
*
|
|
372
|
-
* @default
|
|
437
|
+
* @default ChildWorkflowCancellationType.WAIT_CANCELLATION_COMPLETED
|
|
373
438
|
*/
|
|
374
439
|
cancellationType?: ChildWorkflowCancellationType;
|
|
375
440
|
/**
|
|
376
441
|
* Specifies how the Child reacts to the Parent Workflow reaching a Closed state.
|
|
377
442
|
*
|
|
378
|
-
* @default
|
|
443
|
+
* @default ParentClosePolicy.PARENT_CLOSE_POLICY_TERMINATE
|
|
379
444
|
*/
|
|
380
445
|
parentClosePolicy?: ParentClosePolicy;
|
|
381
446
|
/**
|
|
@@ -384,8 +449,7 @@ export interface ChildWorkflowOptions extends Omit<CommonWorkflowOptions, 'workf
|
|
|
384
449
|
*
|
|
385
450
|
* @default 'COMPATIBLE'
|
|
386
451
|
*
|
|
387
|
-
* @deprecated
|
|
388
|
-
* @experimental The Worker Versioning API is still being designed. Major changes are expected.
|
|
452
|
+
* @deprecated Worker Versioning is now deprecated. Please use the Worker Deployment API instead: https://docs.temporal.io/worker-deployments
|
|
389
453
|
*/
|
|
390
454
|
versioningIntent?: VersioningIntent;
|
|
391
455
|
}
|
|
@@ -463,6 +527,7 @@ export interface WorkflowCreateOptionsInternal extends WorkflowCreateOptions {
|
|
|
463
527
|
sourceMap: RawSourceMap;
|
|
464
528
|
registeredActivityNames: Set<string>;
|
|
465
529
|
getTimeOfDay(): bigint;
|
|
530
|
+
stackTracesEnabled: boolean;
|
|
466
531
|
}
|
|
467
532
|
/**
|
|
468
533
|
* A handler function capable of accepting the arguments for a given UpdateDefinition, SignalDefinition or QueryDefinition.
|