@temporalio/workflow 1.14.2 → 1.15.1
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 -6
- package/lib/cancellation-scope.js +2 -9
- package/lib/cancellation-scope.js.map +1 -1
- package/lib/flags.js +1 -1
- package/lib/flags.js.map +1 -1
- package/lib/global-attributes.d.ts +17 -5
- package/lib/global-attributes.js +9 -17
- 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 +4 -4
- package/lib/index.js +2 -1
- package/lib/index.js.map +1 -1
- package/lib/interceptors.d.ts +16 -1
- package/lib/interfaces.d.ts +73 -30
- package/lib/interfaces.js +54 -14
- package/lib/interfaces.js.map +1 -1
- package/lib/internals.d.ts +3 -1
- package/lib/internals.js +25 -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 +51 -0
- package/lib/nexus.js +68 -8
- package/lib/nexus.js.map +1 -1
- package/lib/stack-helpers.js +1 -1
- package/lib/stack-helpers.js.map +1 -1
- package/lib/update-scope.d.ts +0 -4
- package/lib/update-scope.js +0 -7
- package/lib/update-scope.js.map +1 -1
- package/lib/worker-interface.d.ts +2 -1
- package/lib/worker-interface.js +59 -10
- package/lib/worker-interface.js.map +1 -1
- package/lib/workflow.js +11 -11
- package/lib/workflow.js.map +1 -1
- package/package.json +4 -4
- package/src/cancellation-scope.ts +3 -10
- package/src/flags.ts +1 -1
- package/src/global-attributes.ts +34 -16
- package/src/global-overrides.ts +6 -6
- package/src/index.ts +11 -6
- package/src/interceptors.ts +18 -1
- package/src/interfaces.ts +84 -38
- package/src/internals.ts +30 -8
- package/src/metrics.ts +7 -0
- package/src/nexus.ts +84 -8
- package/src/stack-helpers.ts +2 -3
- package/src/update-scope.ts +1 -8
- package/src/worker-interface.ts +60 -13
- package/src/workflow.ts +11 -11
|
@@ -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
|
|
@@ -140,10 +140,6 @@ export declare class CancellationScope {
|
|
|
140
140
|
/** Alias to `new CancellationScope({ cancellable: true, timeout }).run(fn)` */
|
|
141
141
|
static withTimeout<T>(timeout: Duration, fn: () => Promise<T>): Promise<T>;
|
|
142
142
|
}
|
|
143
|
-
/**
|
|
144
|
-
* Avoid exposing the storage directly so it doesn't get frozen
|
|
145
|
-
*/
|
|
146
|
-
export declare function disableStorage(): void;
|
|
147
143
|
export declare class RootCancellationScope extends CancellationScope {
|
|
148
144
|
constructor();
|
|
149
145
|
cancel(): void;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.RootCancellationScope = exports.CancellationScope = exports.AsyncLocalStorage = void 0;
|
|
4
|
-
exports.disableStorage = disableStorage;
|
|
5
4
|
exports.registerSleepImplementation = registerSleepImplementation;
|
|
6
5
|
const common_1 = require("@temporalio/common");
|
|
7
6
|
const time_1 = require("@temporalio/common/lib/time");
|
|
@@ -16,7 +15,7 @@ exports.AsyncLocalStorage = globalThis.AsyncLocalStorage ?? class {
|
|
|
16
15
|
const NO_PARENT = Symbol('NO_PARENT');
|
|
17
16
|
/**
|
|
18
17
|
* Cancellation Scopes provide the mechanic by which a Workflow may gracefully handle incoming requests for cancellation
|
|
19
|
-
* (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
|
|
20
19
|
* cancellable operations it owns (e.g. Activities, Timers, Child Workflows, etc).
|
|
21
20
|
*
|
|
22
21
|
* Cancellation Scopes form a tree, with the Workflow's main function running in the root scope of that tree.
|
|
@@ -38,7 +37,7 @@ const NO_PARENT = Symbol('NO_PARENT');
|
|
|
38
37
|
* ```ts
|
|
39
38
|
* async function myWorkflow(...): Promise<void> {
|
|
40
39
|
* try {
|
|
41
|
-
* // This activity runs in the root cancellation scope. Therefore, a
|
|
40
|
+
* // This activity runs in the root cancellation scope. Therefore, a cancellation request on
|
|
42
41
|
* // the Workflow execution (e.g. through the UI or CLI) automatically propagates to this
|
|
43
42
|
* // activity. Assuming that the activity properly handle the cancellation request, then the
|
|
44
43
|
* // call below will throw an `ActivityFailure` exception, with `cause` sets to an
|
|
@@ -203,12 +202,6 @@ class CancellationScope {
|
|
|
203
202
|
}
|
|
204
203
|
exports.CancellationScope = CancellationScope;
|
|
205
204
|
const storage = new exports.AsyncLocalStorage();
|
|
206
|
-
/**
|
|
207
|
-
* Avoid exposing the storage directly so it doesn't get frozen
|
|
208
|
-
*/
|
|
209
|
-
function disableStorage() {
|
|
210
|
-
storage.disable();
|
|
211
|
-
}
|
|
212
205
|
class RootCancellationScope extends CancellationScope {
|
|
213
206
|
constructor() {
|
|
214
207
|
super({ cancellable: true, parent: NO_PARENT });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cancellation-scope.js","sourceRoot":"","sources":["../src/cancellation-scope.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"cancellation-scope.js","sourceRoot":"","sources":["../src/cancellation-scope.ts"],"names":[],"mappings":";;;AAyQA,kEAEC;AA1QD,+CAAmF;AACnF,sDAAiE;AACjE,mDAAiD;AACjD,2DAAmD;AACnD,mCAAmC;AAEnC,iEAAiE;AACjE,qFAAqF;AACxE,QAAA,iBAAiB,GAAyB,UAAkB,CAAC,iBAAiB,IAAI;CAAQ,CAAC;AAExG,8EAA8E;AAC9E,MAAM,SAAS,GAAG,MAAM,CAAC,WAAW,CAAC,CAAC;AAuBtC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoDG;AACH,MAAa,iBAAiB;IAC5B;;OAEG;IACgB,OAAO,CAAU;IAEpC;;;;;;;;OAQG;IACa,WAAW,CAAU;IAErC;;OAEG;IACa,MAAM,CAAqB;IAE3C;;;;;;;OAOG;IACa,eAAe,CAAiB;IAEhD,gBAAgB,GAAG,KAAK,CAAC;IAEzB,iGAAiG;IACjG,6DAA6D;IAC7D,aAAa;IACM,MAAM,CAAyB;IAElD,YAAY,OAAkC;QAC5C,IAAI,CAAC,OAAO,GAAG,IAAA,yBAAkB,EAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QACpD,IAAI,CAAC,WAAW,GAAG,OAAO,EAAE,WAAW,IAAI,IAAI,CAAC;QAChD,IAAI,CAAC,eAAe,GAAG,IAAI,OAAO,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,EAAE;YAC/C,uFAAuF;YACvF,IAAI,CAAC,MAAM,GAAG,CAAC,GAAG,EAAE,EAAE;gBACpB,IAAI,CAAC,gBAAgB,GAAG,IAAI,CAAC;gBAC7B,MAAM,CAAC,GAAG,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E,WAAW,EAAE,IAAI,EAAE,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;IACjD,CAAC;IAED,uEAAuE;IACvE,MAAM,CAAC,cAAc,CAAI,EAAoB;QAC3C,OAAO,IAAI,IAAI,CAAC,EAAE,WAAW,EAAE,KAAK,EAAE,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;IAClD,CAAC;IAED,+EAA+E;IAC/E,MAAM,CAAC,WAAW,CAAI,OAAiB,EAAE,EAAoB;QAC3D,OAAO,IAAI,IAAI,CAAC,EAAE,WAAW,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;IAC1D,CAAC;CACF;AA9JD,8CA8JC;AAED,MAAM,OAAO,GAA2B,IAAI,yBAAiB,EAAE,CAAC;AAEhE,MAAa,qBAAsB,SAAQ,iBAAiB;IAC1D;QACE,KAAK,CAAC,EAAE,WAAW,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,CAAC,CAAC;IAClD,CAAC;IAED,MAAM;QACJ,IAAI,CAAC,MAAM,CAAC,IAAI,yBAAgB,CAAC,oBAAoB,CAAC,CAAC,CAAC;IAC1D,CAAC;CACF;AARD,sDAQC;AAED,+FAA+F;AAC/F,IAAI,KAAK,GAAG,CAAC,CAAW,EAAiB,EAAE;IACzC,MAAM,IAAI,0BAAiB,CAAC,4CAA4C,CAAC,CAAC;AAC5E,CAAC,CAAC;AAEF,SAAgB,2BAA2B,CAAC,EAAgB;IAC1D,KAAK,GAAG,EAAE,CAAC;AACb,CAAC"}
|
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,EAAE,KAAK,EAAE,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;IAEnH;;;;;;;;;OASG;IACH,yCAAyC,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;IAE9G;;;;;;;OAOG;IACH,8CAA8C,EAAE,UAAU,CAA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AAI,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"}
|
|
@@ -1,6 +1,18 @@
|
|
|
1
|
-
import { type
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import { type Workflow } from '@temporalio/common';
|
|
2
|
+
import type { Activator } from './internals';
|
|
3
|
+
import type { WorkflowInterceptorsFactory } from './interceptors';
|
|
4
|
+
declare global {
|
|
5
|
+
var __TEMPORAL__: {
|
|
6
|
+
api: typeof import('./worker-interface.ts');
|
|
7
|
+
importWorkflows: () => Record<string, Workflow>;
|
|
8
|
+
importInterceptors: () => [{
|
|
9
|
+
interceptors: WorkflowInterceptorsFactory;
|
|
10
|
+
}];
|
|
11
|
+
};
|
|
12
|
+
var __temporal_globalSandboxDestructors: (() => void)[] | undefined;
|
|
13
|
+
var __TEMPORAL_ACTIVATOR__: Activator | undefined;
|
|
14
|
+
}
|
|
15
|
+
export declare function setActivator(activator: Activator | undefined): void;
|
|
4
16
|
export declare function maybeGetActivator(): Activator | undefined;
|
|
5
|
-
export declare function assertInWorkflowContext(
|
|
6
|
-
export declare
|
|
17
|
+
export declare function assertInWorkflowContext(uninitializedErrorMessage: string): Activator;
|
|
18
|
+
export declare const getActivator: () => Activator;
|
package/lib/global-attributes.js
CHANGED
|
@@ -1,31 +1,23 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
exports.
|
|
3
|
+
exports.getActivator = void 0;
|
|
4
|
+
exports.setActivator = setActivator;
|
|
5
5
|
exports.maybeGetActivator = maybeGetActivator;
|
|
6
6
|
exports.assertInWorkflowContext = assertInWorkflowContext;
|
|
7
|
-
exports.getActivator = getActivator;
|
|
8
7
|
const common_1 = require("@temporalio/common");
|
|
9
|
-
function
|
|
10
|
-
return globalThis.__TEMPORAL_ACTIVATOR__;
|
|
11
|
-
}
|
|
12
|
-
function setActivatorUntyped(activator) {
|
|
8
|
+
function setActivator(activator) {
|
|
13
9
|
globalThis.__TEMPORAL_ACTIVATOR__ = activator;
|
|
14
10
|
}
|
|
15
11
|
function maybeGetActivator() {
|
|
16
|
-
return
|
|
12
|
+
return globalThis.__TEMPORAL_ACTIVATOR__;
|
|
17
13
|
}
|
|
18
|
-
function assertInWorkflowContext(
|
|
14
|
+
function assertInWorkflowContext(uninitializedErrorMessage) {
|
|
19
15
|
const activator = maybeGetActivator();
|
|
20
16
|
if (activator == null)
|
|
21
|
-
throw new common_1.IllegalStateError(
|
|
22
|
-
return activator;
|
|
23
|
-
}
|
|
24
|
-
function getActivator() {
|
|
25
|
-
const activator = maybeGetActivator();
|
|
26
|
-
if (activator === undefined) {
|
|
27
|
-
throw new common_1.IllegalStateError('Workflow uninitialized');
|
|
28
|
-
}
|
|
17
|
+
throw new common_1.IllegalStateError(uninitializedErrorMessage);
|
|
29
18
|
return activator;
|
|
30
19
|
}
|
|
20
|
+
// This is really just an alias for `assertInWorkflowContext` with a default error message,
|
|
21
|
+
// because that name better conveys the intent in some very common use cases.
|
|
22
|
+
exports.getActivator = assertInWorkflowContext.bind(null, 'Workflow uninitialized');
|
|
31
23
|
//# sourceMappingURL=global-attributes.js.map
|
|
@@ -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":";;;AA6BA,oCAEC;AAED,8CAEC;AAED,0DAIC;AAzCD,+CAAsE;AA6BtE,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;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S,CAAC,WAAW,CAAC;gBACpB,WAAW,EAAE;oBACX,GAAG,EAAE,MAAM;iBACZ;aACF,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
|
@@ -48,11 +48,11 @@
|
|
|
48
48
|
*
|
|
49
49
|
* @module
|
|
50
50
|
*/
|
|
51
|
-
export { ActivityCancellationType, ActivityFailure, ActivityOptions, ApplicationFailure, CancelledFailure, ChildWorkflowFailure, defaultPayloadConverter, PayloadConverter, RetryPolicy, rootCause, SearchAttributes, // eslint-disable-line
|
|
52
|
-
SearchAttributeValue, // eslint-disable-line
|
|
51
|
+
export { ActivityCancellationType, ActivityFailure, ActivityOptions, ApplicationFailure, CancelledFailure, ChildWorkflowFailure, defaultPayloadConverter, PayloadConverter, RetryPolicy, rootCause, SearchAttributes, // eslint-disable-line @typescript-eslint/no-deprecated
|
|
52
|
+
SearchAttributeValue, // eslint-disable-line @typescript-eslint/no-deprecated
|
|
53
53
|
ServerFailure, TemporalFailure, TerminatedFailure, TimeoutFailure, } from '@temporalio/common';
|
|
54
54
|
export * from '@temporalio/common/lib/errors';
|
|
55
|
-
export { ActivityFunction, ActivityInterface, // eslint-disable-line
|
|
55
|
+
export { ActivityFunction, ActivityInterface, // eslint-disable-line @typescript-eslint/no-deprecated
|
|
56
56
|
Payload, QueryDefinition, SignalDefinition, UntypedActivities, Workflow, WorkflowQueryType, WorkflowResultType, WorkflowReturnType, WorkflowSignalType, } from '@temporalio/common/lib/interfaces';
|
|
57
57
|
export * from '@temporalio/common/lib/workflow-handle';
|
|
58
58
|
export * from '@temporalio/common/lib/workflow-options';
|
|
@@ -66,7 +66,7 @@ export { Trigger } from './trigger';
|
|
|
66
66
|
export * from './workflow';
|
|
67
67
|
export { ChildWorkflowHandle, ExternalWorkflowHandle } from './workflow-handle';
|
|
68
68
|
export { metricMeter } from './metrics';
|
|
69
|
-
export { createNexusClient, NexusClientOptions, NexusClient, NexusOperationHandle } from './nexus';
|
|
69
|
+
export { createNexusClient, NexusClientOptions, NexusClient, NexusOperationHandle, NexusOperationCancellationType, } from './nexus';
|
|
70
70
|
export {
|
|
71
71
|
/**
|
|
72
72
|
* @deprecated Do not use LoggerSinks directly. To log from Workflow code, use the `log` object
|
package/lib/index.js
CHANGED
|
@@ -64,7 +64,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
64
64
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
65
65
|
};
|
|
66
66
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
67
|
-
exports.createNexusClient = 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;
|
|
67
|
+
exports.NexusOperationCancellationType = exports.createNexusClient = 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
68
|
var common_1 = require("@temporalio/common");
|
|
69
69
|
Object.defineProperty(exports, "ActivityCancellationType", { enumerable: true, get: function () { return common_1.ActivityCancellationType; } });
|
|
70
70
|
Object.defineProperty(exports, "ActivityFailure", { enumerable: true, get: function () { return common_1.ActivityFailure; } });
|
|
@@ -100,4 +100,5 @@ var metrics_1 = require("./metrics");
|
|
|
100
100
|
Object.defineProperty(exports, "metricMeter", { enumerable: true, get: function () { return metrics_1.metricMeter; } });
|
|
101
101
|
var nexus_1 = require("./nexus");
|
|
102
102
|
Object.defineProperty(exports, "createNexusClient", { enumerable: true, get: function () { return nexus_1.createNexusClient; } });
|
|
103
|
+
Object.defineProperty(exports, "NexusOperationCancellationType", { enumerable: true, get: function () { return nexus_1.NexusOperationCancellationType; } });
|
|
103
104
|
//# 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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiDG;;;;;;;;;;;;;;;;;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;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiDG;;;;;;;;;;;;;;;;;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,0GAAA,iBAAiB,OAAA;AAIjB,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,20 @@ export interface StartNexusOperationOptions {
|
|
|
222
223
|
* Optional: defaults to the maximum allowed by the Temporal server.
|
|
223
224
|
*/
|
|
224
225
|
readonly scheduleToCloseTimeout?: Duration;
|
|
226
|
+
/**
|
|
227
|
+
* Determines:
|
|
228
|
+
* - whether cancellation requests should be propagated from the Workflow to the Nexus Operation
|
|
229
|
+
* - whether and when should the Operation's cancellation be reported back to the Workflow
|
|
230
|
+
* (i.e. at which moment should the operation's result promise fail with a `NexusOperationFailure`,
|
|
231
|
+
* with `cause` set to a `CancelledFailure`).
|
|
232
|
+
*
|
|
233
|
+
* Note that this setting only applies to cancellation originating from an external request for the
|
|
234
|
+
* Workflow itself, or from internal cancellation of the `CancellationScope` in which the
|
|
235
|
+
* Operation call was made.
|
|
236
|
+
*
|
|
237
|
+
* @default WAIT_CANCELLATION_COMPLETED
|
|
238
|
+
*/
|
|
239
|
+
readonly cancellationType?: NexusOperationCancellationType;
|
|
225
240
|
/**
|
|
226
241
|
* A fixed, single-line summary for this Nexus Operation that may appear in the UI/CLI.
|
|
227
242
|
* This can be in single-line Temporal markdown format.
|
package/lib/interfaces.d.ts
CHANGED
|
@@ -162,8 +162,6 @@ export interface WorkflowInfo {
|
|
|
162
162
|
* executing this task for the first time and has a Deployment Version set, then its ID will be
|
|
163
163
|
* used. This value may change over the lifetime of the workflow run, but is deterministic and
|
|
164
164
|
* safe to use for branching.
|
|
165
|
-
*
|
|
166
|
-
* @experimental Deployment based versioning is experimental and may change in the future.
|
|
167
165
|
*/
|
|
168
166
|
readonly currentDeploymentVersion?: WorkerDeploymentVersion;
|
|
169
167
|
readonly unsafe: UnsafeWorkflowInfo;
|
|
@@ -185,7 +183,21 @@ export interface UnsafeWorkflowInfo {
|
|
|
185
183
|
* Task and stay constant for the duration of the Task and during replay.
|
|
186
184
|
*/
|
|
187
185
|
readonly now: () => number;
|
|
186
|
+
/**
|
|
187
|
+
* Whether the workflow is currently replaying.
|
|
188
|
+
*/
|
|
188
189
|
readonly isReplaying: boolean;
|
|
190
|
+
/**
|
|
191
|
+
* Whether the workflow is currently replaying history events.
|
|
192
|
+
*
|
|
193
|
+
* This is similar to {@link isReplaying}, but returns `false` during query handlers and update
|
|
194
|
+
* validators, which are live read-only operations that should not be considered as replaying
|
|
195
|
+
* history events.
|
|
196
|
+
*
|
|
197
|
+
* When this property is true, workflow log messages are suppressed and sinks defined with
|
|
198
|
+
* callDuringReplay=false won't get processed.
|
|
199
|
+
*/
|
|
200
|
+
readonly isReplayingHistoryEvents: boolean;
|
|
189
201
|
}
|
|
190
202
|
/**
|
|
191
203
|
* Information about a workflow update.
|
|
@@ -264,50 +276,74 @@ export interface ContinueAsNewOptions {
|
|
|
264
276
|
*
|
|
265
277
|
* @default 'COMPATIBLE'
|
|
266
278
|
*
|
|
267
|
-
* @deprecated
|
|
268
|
-
* @experimental The Worker Versioning API is still being designed. Major changes are expected.
|
|
279
|
+
* @deprecated Worker Versioning is now deprecated. Please use the Worker Deployment API instead: https://docs.temporal.io/worker-deployments
|
|
269
280
|
*/
|
|
270
281
|
versioningIntent?: VersioningIntent;
|
|
271
282
|
}
|
|
272
283
|
/**
|
|
273
|
-
*
|
|
274
|
-
* - whether cancellation requests
|
|
275
|
-
* - whether and when
|
|
276
|
-
* {@link ChildWorkflowHandle.result}
|
|
284
|
+
* Determines:
|
|
285
|
+
* - whether cancellation requests should be propagated from the Parent Workflow to the Child, and
|
|
286
|
+
* - whether and when should the Child's cancellation be reported back to the Parent Workflow
|
|
287
|
+
* (i.e. at which moment should the {@link executeChild}'s or {@link ChildWorkflowHandle.result}'s
|
|
288
|
+
* promise fail with a `ChildWorkflowFailure`, with `cause` set to a `CancelledFailure`).
|
|
289
|
+
*
|
|
290
|
+
* Note that this setting only applies to cancellation originating from an external request for the
|
|
291
|
+
* Parent Workflow itself, or from internal cancellation of the `CancellationScope` in which the
|
|
292
|
+
* Child Workflow call was made. Eventual Cancellation of a Child Workflow on completion of the
|
|
293
|
+
* Parent Workflow is controlled by the {@link ParentClosePolicy} setting.
|
|
277
294
|
*
|
|
278
|
-
* @default
|
|
295
|
+
* @default ChildWorkflowCancellationType.WAIT_CANCELLATION_COMPLETED
|
|
279
296
|
*/
|
|
280
|
-
export type ChildWorkflowCancellationType = (typeof ChildWorkflowCancellationType)[keyof typeof ChildWorkflowCancellationType];
|
|
281
297
|
export declare const ChildWorkflowCancellationType: {
|
|
282
298
|
/**
|
|
283
|
-
*
|
|
299
|
+
* Do not propagate cancellation requests to the Child, and immediately report cancellation
|
|
300
|
+
* to the caller.
|
|
284
301
|
*/
|
|
285
302
|
readonly ABANDON: "ABANDON";
|
|
286
303
|
/**
|
|
287
|
-
*
|
|
304
|
+
* Propagate cancellation request from the Parent Workflow to the Child, yet _immediately_ report
|
|
305
|
+
* cancellation to the caller, i.e. without waiting for the server to confirm the cancellation
|
|
306
|
+
* request.
|
|
307
|
+
*
|
|
308
|
+
* Note that this cancellation type provides no guarantee, from the Parent-side, that the
|
|
309
|
+
* cancellation request will actually be atomically added to the Child workflow's history.
|
|
310
|
+
* In particular, the Child may complete (either successfully or uncessfully) before the
|
|
311
|
+
* cancellation is delivered, resulting in a situation where the Parent workflow thinks its child
|
|
312
|
+
* was cancelled, but the child actually completed successfully.
|
|
313
|
+
*
|
|
314
|
+
* To guarantee that the Child will eventually be notified of the cancellation request,
|
|
315
|
+
* use {@link WAIT_CANCELLATION_REQUESTED}.
|
|
288
316
|
*/
|
|
289
317
|
readonly TRY_CANCEL: "TRY_CANCEL";
|
|
290
318
|
/**
|
|
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.
|
|
319
|
+
* Propagate cancellation request from the Parent Workflow to the Child, then wait for the server
|
|
320
|
+
* to confirm that the Child Workflow cancellation request was recorded in its history.
|
|
295
321
|
*
|
|
296
|
-
*
|
|
322
|
+
* This cancellation type guarantees that the Child will eventually be notified of the
|
|
323
|
+
* cancellation request (that is, unless the Child terminates inbetween due to unexpected causes).
|
|
297
324
|
*/
|
|
298
|
-
readonly
|
|
325
|
+
readonly WAIT_CANCELLATION_REQUESTED: "WAIT_CANCELLATION_REQUESTED";
|
|
299
326
|
/**
|
|
300
|
-
*
|
|
327
|
+
* Propagate cancellation request from the Parent Workflow to the Child, then wait for completion
|
|
328
|
+
* of the Child Workflow.
|
|
329
|
+
*
|
|
330
|
+
* The Child may respect cancellation, in which case the Parent's `executeChild` or
|
|
331
|
+
* `ChildWorkflowHandle.result` promise will fail with a `ChildWorkflowFailure`, with `cause`
|
|
332
|
+
* set to a `CancelledFailure`. On the other hand, the Child may ignore the cancellation request,
|
|
333
|
+
* in which case the corresponding promise will either resolve with a result (if Child completed
|
|
334
|
+
* successfully) or reject with a different cause (if Child completed uncessfully).
|
|
335
|
+
*
|
|
336
|
+
* @default
|
|
301
337
|
*/
|
|
302
|
-
readonly
|
|
338
|
+
readonly WAIT_CANCELLATION_COMPLETED: "WAIT_CANCELLATION_COMPLETED";
|
|
303
339
|
};
|
|
304
|
-
export
|
|
340
|
+
export type ChildWorkflowCancellationType = (typeof ChildWorkflowCancellationType)[keyof typeof ChildWorkflowCancellationType];
|
|
341
|
+
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
342
|
/**
|
|
306
343
|
* How a Child Workflow reacts to the Parent Workflow reaching a Closed state.
|
|
307
344
|
*
|
|
308
345
|
* @see {@link https://docs.temporal.io/concepts/what-is-a-parent-close-policy/ | Parent Close Policy}
|
|
309
346
|
*/
|
|
310
|
-
export type ParentClosePolicy = (typeof ParentClosePolicy)[keyof typeof ParentClosePolicy];
|
|
311
347
|
export declare const ParentClosePolicy: {
|
|
312
348
|
/**
|
|
313
349
|
* When the Parent is Closed, the Child is Terminated.
|
|
@@ -348,6 +384,7 @@ export declare const ParentClosePolicy: {
|
|
|
348
384
|
*/
|
|
349
385
|
readonly PARENT_CLOSE_POLICY_REQUEST_CANCEL: "REQUEST_CANCEL";
|
|
350
386
|
};
|
|
387
|
+
export type ParentClosePolicy = (typeof ParentClosePolicy)[keyof typeof ParentClosePolicy];
|
|
351
388
|
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
389
|
export interface ChildWorkflowOptions extends Omit<CommonWorkflowOptions, 'workflowIdConflictPolicy'> {
|
|
353
390
|
/**
|
|
@@ -364,18 +401,24 @@ export interface ChildWorkflowOptions extends Omit<CommonWorkflowOptions, 'workf
|
|
|
364
401
|
*/
|
|
365
402
|
taskQueue?: string;
|
|
366
403
|
/**
|
|
367
|
-
*
|
|
368
|
-
* - whether cancellation requests
|
|
369
|
-
* - whether and when
|
|
370
|
-
* {@link ChildWorkflowHandle.result}
|
|
404
|
+
* Determines:
|
|
405
|
+
* - whether cancellation requests should be propagated from the Parent Workflow to the Child, and
|
|
406
|
+
* - whether and when should the Child's cancellation be reported back to the Parent Workflow
|
|
407
|
+
* (i.e. at which moment should the {@link executeChild}'s or {@link ChildWorkflowHandle.result}'s
|
|
408
|
+
* promise fail with a `ChildWorkflowFailure`, with `cause` set to a `CancelledFailure`).
|
|
409
|
+
*
|
|
410
|
+
* Note that this setting only applies to cancellation originating from an external request for the
|
|
411
|
+
* Parent Workflow itself, or from internal cancellation of the `CancellationScope` in which the
|
|
412
|
+
* Child Workflow call was made. Eventual Cancellation of a Child Workflow on completion of the
|
|
413
|
+
* Parent Workflow is controlled by the {@link ParentClosePolicy} setting.
|
|
371
414
|
*
|
|
372
|
-
* @default
|
|
415
|
+
* @default ChildWorkflowCancellationType.WAIT_CANCELLATION_COMPLETED
|
|
373
416
|
*/
|
|
374
417
|
cancellationType?: ChildWorkflowCancellationType;
|
|
375
418
|
/**
|
|
376
419
|
* Specifies how the Child reacts to the Parent Workflow reaching a Closed state.
|
|
377
420
|
*
|
|
378
|
-
* @default
|
|
421
|
+
* @default ParentClosePolicy.PARENT_CLOSE_POLICY_TERMINATE
|
|
379
422
|
*/
|
|
380
423
|
parentClosePolicy?: ParentClosePolicy;
|
|
381
424
|
/**
|
|
@@ -384,8 +427,7 @@ export interface ChildWorkflowOptions extends Omit<CommonWorkflowOptions, 'workf
|
|
|
384
427
|
*
|
|
385
428
|
* @default 'COMPATIBLE'
|
|
386
429
|
*
|
|
387
|
-
* @deprecated
|
|
388
|
-
* @experimental The Worker Versioning API is still being designed. Major changes are expected.
|
|
430
|
+
* @deprecated Worker Versioning is now deprecated. Please use the Worker Deployment API instead: https://docs.temporal.io/worker-deployments
|
|
389
431
|
*/
|
|
390
432
|
versioningIntent?: VersioningIntent;
|
|
391
433
|
}
|
|
@@ -463,6 +505,7 @@ export interface WorkflowCreateOptionsInternal extends WorkflowCreateOptions {
|
|
|
463
505
|
sourceMap: RawSourceMap;
|
|
464
506
|
registeredActivityNames: Set<string>;
|
|
465
507
|
getTimeOfDay(): bigint;
|
|
508
|
+
stackTracesEnabled: boolean;
|
|
466
509
|
}
|
|
467
510
|
/**
|
|
468
511
|
* A handler function capable of accepting the arguments for a given UpdateDefinition, SignalDefinition or QueryDefinition.
|