@temporalio/workflow 1.11.8 → 1.12.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/alea.js +5 -3
- package/lib/alea.js.map +1 -1
- package/lib/cancellation-scope.js +36 -18
- package/lib/cancellation-scope.js.map +1 -1
- package/lib/errors.js +1 -0
- package/lib/errors.js.map +1 -1
- package/lib/flags.js +1 -1
- package/lib/flags.js.map +1 -1
- package/lib/index.d.ts +6 -3
- package/lib/index.js +3 -1
- package/lib/index.js.map +1 -1
- package/lib/interceptors.d.ts +11 -1
- package/lib/interfaces.d.ts +70 -5
- package/lib/interfaces.js +1 -0
- package/lib/interfaces.js.map +1 -1
- package/lib/internals.d.ts +55 -7
- package/lib/internals.js +323 -201
- package/lib/internals.js.map +1 -1
- package/lib/logs.js +11 -1
- package/lib/logs.js.map +1 -1
- package/lib/metrics.d.ts +32 -0
- package/lib/metrics.js +118 -0
- package/lib/metrics.js.map +1 -0
- package/lib/trigger.js +8 -0
- package/lib/trigger.js.map +1 -1
- package/lib/update-scope.js +8 -0
- package/lib/update-scope.js.map +1 -1
- package/lib/worker-interface.d.ts +6 -1
- package/lib/worker-interface.js +165 -103
- package/lib/worker-interface.js.map +1 -1
- package/lib/workflow.d.ts +75 -17
- package/lib/workflow.js +207 -34
- package/lib/workflow.js.map +1 -1
- package/package.json +7 -4
- package/src/flags.ts +1 -1
- package/src/index.ts +4 -2
- package/src/interceptors.ts +21 -1
- package/src/interfaces.ts +85 -9
- package/src/internals.ts +133 -33
- package/src/logs.ts +11 -1
- package/src/metrics.ts +191 -0
- package/src/worker-interface.ts +164 -107
- package/src/workflow.ts +232 -38
package/lib/alea.js
CHANGED
|
@@ -27,6 +27,10 @@ exports.alea = alea;
|
|
|
27
27
|
// THE SOFTWARE.
|
|
28
28
|
// Taken and modified from https://github.com/davidbau/seedrandom/blob/released/lib/alea.js
|
|
29
29
|
class Alea {
|
|
30
|
+
c;
|
|
31
|
+
s0;
|
|
32
|
+
s1;
|
|
33
|
+
s2;
|
|
30
34
|
constructor(seed) {
|
|
31
35
|
const mash = new Mash();
|
|
32
36
|
// Apply the seeding algorithm from Baagoe.
|
|
@@ -59,9 +63,7 @@ function alea(seed) {
|
|
|
59
63
|
return xg.next.bind(xg);
|
|
60
64
|
}
|
|
61
65
|
class Mash {
|
|
62
|
-
|
|
63
|
-
this.n = 0xefc8249d;
|
|
64
|
-
}
|
|
66
|
+
n = 0xefc8249d;
|
|
65
67
|
mash(data) {
|
|
66
68
|
let { n } = this;
|
|
67
69
|
for (let i = 0; i < data.length; i++) {
|
package/lib/alea.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"alea.js","sourceRoot":"","sources":["../src/alea.ts"],"names":[],"mappings":";AAAA,sEAAsE;AACtE,iDAAiD;AACjD,0EAA0E;AAC1E,uCAAuC;;;AA6DvC,oBAGC;AA9DD,4DAA4D;AAC5D,EAAE;AACF,+EAA+E;AAC/E,gFAAgF;AAChF,+EAA+E;AAC/E,4EAA4E;AAC5E,wEAAwE;AACxE,2DAA2D;AAC3D,EAAE;AACF,6EAA6E;AAC7E,sDAAsD;AACtD,EAAE;AACF,6EAA6E;AAC7E,2EAA2E;AAC3E,8EAA8E;AAC9E,yEAAyE;AACzE,gFAAgF;AAChF,4EAA4E;AAC5E,gBAAgB;AAEhB,2FAA2F;AAE3F,MAAM,IAAI;
|
|
1
|
+
{"version":3,"file":"alea.js","sourceRoot":"","sources":["../src/alea.ts"],"names":[],"mappings":";AAAA,sEAAsE;AACtE,iDAAiD;AACjD,0EAA0E;AAC1E,uCAAuC;;;AA6DvC,oBAGC;AA9DD,4DAA4D;AAC5D,EAAE;AACF,+EAA+E;AAC/E,gFAAgF;AAChF,+EAA+E;AAC/E,4EAA4E;AAC5E,wEAAwE;AACxE,2DAA2D;AAC3D,EAAE;AACF,6EAA6E;AAC7E,sDAAsD;AACtD,EAAE;AACF,6EAA6E;AAC7E,2EAA2E;A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f) {
|
|
3
|
-
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
4
|
-
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
5
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
6
|
-
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
7
|
-
};
|
|
8
|
-
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
9
|
-
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
10
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
11
|
-
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
12
|
-
};
|
|
13
|
-
var _CancellationScope_cancelRequested;
|
|
14
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
3
|
exports.RootCancellationScope = exports.CancellationScope = exports.AsyncLocalStorage = void 0;
|
|
16
4
|
exports.disableStorage = disableStorage;
|
|
@@ -80,14 +68,45 @@ const NO_PARENT = Symbol('NO_PARENT');
|
|
|
80
68
|
* ```
|
|
81
69
|
*/
|
|
82
70
|
class CancellationScope {
|
|
71
|
+
/**
|
|
72
|
+
* Time in milliseconds before the scope cancellation is automatically requested
|
|
73
|
+
*/
|
|
74
|
+
timeout;
|
|
75
|
+
/**
|
|
76
|
+
* If false, then this scope will never be considered cancelled, even if a cancellation request is received (either
|
|
77
|
+
* directly by calling `scope.cancel()` or indirectly by cancelling a cancellable parent scope). This effectively
|
|
78
|
+
* shields the scope's children and cancellable operations from propagation of cancellation requests made on the
|
|
79
|
+
* non-cancellable scope.
|
|
80
|
+
*
|
|
81
|
+
* Note that the Promise returned by the `run` function of non-cancellable scope may still throw a `CancelledFailure`
|
|
82
|
+
* if such an exception is thrown from within that scope (e.g. by directly cancelling a cancellable child scope).
|
|
83
|
+
*/
|
|
84
|
+
cancellable;
|
|
85
|
+
/**
|
|
86
|
+
* An optional CancellationScope (useful for running background tasks), defaults to {@link CancellationScope.current}()
|
|
87
|
+
*/
|
|
88
|
+
parent;
|
|
89
|
+
/**
|
|
90
|
+
* A Promise that throws when a cancellable scope receives a cancellation request, either directly
|
|
91
|
+
* (i.e. `scope.cancel()`), or indirectly (by cancelling a cancellable parent scope).
|
|
92
|
+
*
|
|
93
|
+
* Note that a non-cancellable scope may receive cancellation requests, resulting in the `cancelRequested` promise for
|
|
94
|
+
* that scope to throw, though the scope will not effectively get cancelled (i.e. `consideredCancelled` will still
|
|
95
|
+
* return `false`, and cancellation will not be propagated to child scopes and contained operations).
|
|
96
|
+
*/
|
|
97
|
+
cancelRequested;
|
|
98
|
+
#cancelRequested = false;
|
|
99
|
+
// Typescript does not understand that the Promise executor runs synchronously in the constructor
|
|
100
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
101
|
+
// @ts-ignore
|
|
102
|
+
reject;
|
|
83
103
|
constructor(options) {
|
|
84
|
-
_CancellationScope_cancelRequested.set(this, false);
|
|
85
104
|
this.timeout = (0, time_1.msOptionalToNumber)(options?.timeout);
|
|
86
105
|
this.cancellable = options?.cancellable ?? true;
|
|
87
106
|
this.cancelRequested = new Promise((_, reject) => {
|
|
88
107
|
// @ts-expect-error TSC doesn't understand that the Promise executor runs synchronously
|
|
89
108
|
this.reject = (err) => {
|
|
90
|
-
|
|
109
|
+
this.#cancelRequested = true;
|
|
91
110
|
reject(err);
|
|
92
111
|
};
|
|
93
112
|
});
|
|
@@ -97,9 +116,9 @@ class CancellationScope {
|
|
|
97
116
|
if (options?.parent !== NO_PARENT) {
|
|
98
117
|
this.parent = options?.parent || CancellationScope.current();
|
|
99
118
|
if (this.parent.cancellable ||
|
|
100
|
-
(
|
|
119
|
+
(this.parent.#cancelRequested &&
|
|
101
120
|
!(0, global_attributes_1.getActivator)().hasFlag(flags_1.SdkFlags.NonCancellableScopesAreShieldedFromPropagation))) {
|
|
102
|
-
|
|
121
|
+
this.#cancelRequested = this.parent.#cancelRequested;
|
|
103
122
|
(0, stack_helpers_1.untrackPromise)(this.parent.cancelRequested.catch((err) => {
|
|
104
123
|
this.reject(err);
|
|
105
124
|
}));
|
|
@@ -117,7 +136,7 @@ class CancellationScope {
|
|
|
117
136
|
* Whether the scope was effectively cancelled. A non-cancellable scope can never be considered cancelled.
|
|
118
137
|
*/
|
|
119
138
|
get consideredCancelled() {
|
|
120
|
-
return
|
|
139
|
+
return this.#cancelRequested && this.cancellable;
|
|
121
140
|
}
|
|
122
141
|
/**
|
|
123
142
|
* Activate the scope as current and run `fn`
|
|
@@ -183,7 +202,6 @@ class CancellationScope {
|
|
|
183
202
|
}
|
|
184
203
|
}
|
|
185
204
|
exports.CancellationScope = CancellationScope;
|
|
186
|
-
_CancellationScope_cancelRequested = new WeakMap();
|
|
187
205
|
const storage = new exports.AsyncLocalStorage();
|
|
188
206
|
/**
|
|
189
207
|
* Avoid exposing the storage directly so it doesn't get frozen
|
|
@@ -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":";;;AA6PA,wCAEC;AAiBD,kEAEC;AAjRD,+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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Q,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/errors.js
CHANGED
|
@@ -32,6 +32,7 @@ exports.DeterminismViolationError = DeterminismViolationError = __decorate([
|
|
|
32
32
|
* A class that acts as a marker for this special result type
|
|
33
33
|
*/
|
|
34
34
|
let LocalActivityDoBackoff = class LocalActivityDoBackoff extends Error {
|
|
35
|
+
backoff;
|
|
35
36
|
constructor(backoff) {
|
|
36
37
|
super();
|
|
37
38
|
this.backoff = backoff;
|
package/lib/errors.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":";;;;;;;;;AA6BA,wCAKC;AAlCD,+CAA6F;AAC7F,sEAAiF;AAGjF;;GAEG;AAEI,IAAM,aAAa,GAAnB,MAAM,aAAc,SAAQ,KAAK;CAAG,CAAA;AAA9B,sCAAa;wBAAb,aAAa;IADzB,IAAA,yCAA0B,EAAC,eAAe,CAAC;GAC/B,aAAa,CAAiB;AAE3C;;GAEG;AAEI,IAAM,yBAAyB,GAA/B,MAAM,yBAA0B,SAAQ,aAAa;CAAG,CAAA;AAAlD,8DAAyB;oCAAzB,yBAAyB;IADrC,IAAA,yCAA0B,EAAC,2BAA2B,CAAC;GAC3C,yBAAyB,CAAyB;AAE/D;;GAEG;AAEI,IAAM,sBAAsB,GAA5B,MAAM,sBAAuB,SAAQ,KAAK;
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":";;;;;;;;;AA6BA,wCAKC;AAlCD,+CAA6F;AAC7F,sEAAiF;AAGjF;;GAEG;AAEI,IAAM,aAAa,GAAnB,MAAM,aAAc,SAAQ,KAAK;CAAG,CAAA;AAA9B,sCAAa;wBAAb,aAAa;IADzB,IAAA,yCAA0B,EAAC,eAAe,CAAC;GAC/B,aAAa,CAAiB;AAE3C;;GAEG;AAEI,IAAM,yBAAyB,GAA/B,MAAM,yBAA0B,SAAQ,aAAa;CAAG,CAAA;AAAlD,8DAAyB;oCAAzB,yBAAyB;IADrC,IAAA,yCAA0B,EAAC,2BAA2B,CAAC;GAC3C,yBAAyB,CAAyB;AAE/D;;GAEG;AAEI,IAAM,sBAAsB,GAA5B,MAAM,sBAAuB,SAAQ,KAAK;IACnB;IAA5B,YAA4B,OAA2C;QACrE,KAAK,EAAE,CAAC;QADkB,YAAO,GAAP,OAAO,CAAoC;IAEvE,CAAC;CACF,CAAA;AAJY,wDAAsB;iCAAtB,sBAAsB;IADlC,IAAA,yCAA0B,EAAC,wBAAwB,CAAC;GACxC,sBAAsB,CAIlC;AAED;;GAEG;AACH,SAAgB,cAAc,CAAC,GAAY;IACzC,OAAO,CACL,GAAG,YAAY,yBAAgB;QAC/B,CAAC,CAAC,GAAG,YAAY,wBAAe,IAAI,GAAG,YAAY,6BAAoB,CAAC,IAAI,GAAG,CAAC,KAAK,YAAY,yBAAgB,CAAC,CACnH,CAAC;AACJ,CAAC"}
|
package/lib/flags.js
CHANGED
|
@@ -50,6 +50,6 @@ function assertValidFlag(id) {
|
|
|
50
50
|
}
|
|
51
51
|
function buildIdSdkVersionMatches(version) {
|
|
52
52
|
const regex = new RegExp(`^@temporalio/worker@(${version.source})[+]`);
|
|
53
|
-
return ({ info }) => info.currentBuildId != null && regex.test(info.currentBuildId);
|
|
53
|
+
return ({ info }) => info.currentBuildId != null && regex.test(info.currentBuildId); // eslint-disable-line deprecation/deprecation
|
|
54
54
|
}
|
|
55
55
|
//# sourceMappingURL=flags.js.map
|
package/lib/flags.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"flags.js","sourceRoot":"","sources":["../src/flags.ts"],"names":[],"mappings":";;;AAsDA,0CAEC;AAhDD,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;CAClG,CAAC;AAEX,SAAS,UAAU,CAAC,EAAU,EAAE,GAAY,EAAE,qBAAwC;IACpF,MAAM,IAAI,GAAG,EAAE,EAAE,EAAE,OAAO,EAAE,GAAG,EAAE,qBAAqB,EAAE,CAAC;IACzD,aAAa,CAAC,GAAG,CAAC,EAAE,EAAE,IAAI,CAAC,CAAC;IAC5B,OAAO,IAAI,CAAC;AACd,CAAC;AAED,SAAgB,eAAe,CAAC,EAAU;IACxC,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,EAAE,CAAC;QAAE,MAAM,IAAI,SAAS,CAAC,qBAAqB,EAAE,EAAE,CAAC,CAAC;AAC7E,CAAC;AAgBD,SAAS,wBAAwB,CAAC,OAAe;IAC/C,MAAM,KAAK,GAAG,IAAI,MAAM,CAAC,wBAAwB,OAAO,CAAC,MAAM,MAAM,CAAC,CAAC;IACvE,OAAO,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC,IAAI,CAAC,cAAc,IAAI,IAAI,IAAI,KAAK,CAAC,IA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*
|
|
49
49
|
* @module
|
|
50
50
|
*/
|
|
51
|
-
export { ActivityCancellationType, ActivityFailure, ActivityOptions, ApplicationFailure, CancelledFailure, ChildWorkflowFailure, defaultPayloadConverter, PayloadConverter, RetryPolicy, rootCause,
|
|
51
|
+
export { ActivityCancellationType, ActivityFailure, ActivityOptions, ApplicationFailure, CancelledFailure, ChildWorkflowFailure, defaultPayloadConverter, PayloadConverter, RetryPolicy, rootCause, SearchAttributes, // eslint-disable-line deprecation/deprecation
|
|
52
|
+
SearchAttributeValue, // eslint-disable-line deprecation/deprecation
|
|
53
|
+
ServerFailure, TemporalFailure, TerminatedFailure, TimeoutFailure, } from '@temporalio/common';
|
|
52
54
|
export * from '@temporalio/common/lib/errors';
|
|
53
55
|
export { ActivityFunction, ActivityInterface, // eslint-disable-line deprecation/deprecation
|
|
54
|
-
Payload, QueryDefinition,
|
|
56
|
+
Payload, QueryDefinition, SignalDefinition, UntypedActivities, Workflow, WorkflowQueryType, WorkflowResultType, WorkflowReturnType, WorkflowSignalType, } from '@temporalio/common/lib/interfaces';
|
|
55
57
|
export * from '@temporalio/common/lib/workflow-handle';
|
|
56
58
|
export * from '@temporalio/common/lib/workflow-options';
|
|
57
59
|
export { AsyncLocalStorage, CancellationScope, CancellationScopeOptions } from './cancellation-scope';
|
|
58
60
|
export * from './errors';
|
|
59
61
|
export * from './interceptors';
|
|
60
|
-
export { ChildWorkflowCancellationType, ChildWorkflowOptions, ContinueAsNew, ContinueAsNewOptions, EnhancedStackTrace, StackTraceFileLocation, StackTraceFileSlice, ParentClosePolicy, ParentWorkflowInfo, StackTraceSDKInfo, StackTrace, UnsafeWorkflowInfo, WorkflowInfo, } from './interfaces';
|
|
62
|
+
export { ChildWorkflowCancellationType, ChildWorkflowOptions, ContinueAsNew, ContinueAsNewOptions, EnhancedStackTrace, StackTraceFileLocation, StackTraceFileSlice, ParentClosePolicy, ParentWorkflowInfo, RootWorkflowInfo, StackTraceSDKInfo, StackTrace, UnsafeWorkflowInfo, WorkflowInfo, } from './interfaces';
|
|
61
63
|
export { proxySinks, Sink, SinkCall, SinkFunction, Sinks } from './sinks';
|
|
62
64
|
export { log } from './logs';
|
|
63
65
|
export { Trigger } from './trigger';
|
|
64
66
|
export * from './workflow';
|
|
65
67
|
export { ChildWorkflowHandle, ExternalWorkflowHandle } from './workflow-handle';
|
|
68
|
+
export { metricMeter } from './metrics';
|
|
66
69
|
export {
|
|
67
70
|
/**
|
|
68
71
|
* @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.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.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; } });
|
|
@@ -96,4 +96,6 @@ Object.defineProperty(exports, "log", { enumerable: true, get: function () { ret
|
|
|
96
96
|
var trigger_1 = require("./trigger");
|
|
97
97
|
Object.defineProperty(exports, "Trigger", { enumerable: true, get: function () { return trigger_1.Trigger; } });
|
|
98
98
|
__exportStar(require("./workflow"), exports);
|
|
99
|
+
var metrics_1 = require("./metrics");
|
|
100
|
+
Object.defineProperty(exports, "metricMeter", { enumerable: true, get: function () { return metrics_1.metricMeter; } });
|
|
99
101
|
//# 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,
|
|
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"}
|
package/lib/interceptors.d.ts
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
*
|
|
6
6
|
* @module
|
|
7
7
|
*/
|
|
8
|
-
import { ActivityOptions, Headers, LocalActivityOptions, Next, Timestamp, WorkflowExecution } from '@temporalio/common';
|
|
8
|
+
import { ActivityOptions, Headers, LocalActivityOptions, MetricTags, Next, Timestamp, WorkflowExecution } from '@temporalio/common';
|
|
9
9
|
import type { coresdk } from '@temporalio/proto';
|
|
10
10
|
import { ChildWorkflowOptionsWithDefaults, ContinueAsNewOptions } from './interfaces';
|
|
11
11
|
export { Next, Headers };
|
|
@@ -117,6 +117,8 @@ export interface SignalWorkflowInput {
|
|
|
117
117
|
}
|
|
118
118
|
/** Input for WorkflowOutboundCallsInterceptor.getLogAttributes */
|
|
119
119
|
export type GetLogAttributesInput = Record<string, unknown>;
|
|
120
|
+
/** Input for WorkflowOutboundCallsInterceptor.getMetricTags */
|
|
121
|
+
export type GetMetricTagsInput = MetricTags;
|
|
120
122
|
/**
|
|
121
123
|
* Implement any of these methods to intercept Workflow code calls to the Temporal APIs, like scheduling an activity and starting a timer
|
|
122
124
|
*/
|
|
@@ -158,6 +160,14 @@ export interface WorkflowOutboundCallsInterceptor {
|
|
|
158
160
|
* The attributes returned in this call are attached to every log message.
|
|
159
161
|
*/
|
|
160
162
|
getLogAttributes?: (input: GetLogAttributesInput, next: Next<this, 'getLogAttributes'>) => Record<string, unknown>;
|
|
163
|
+
/**
|
|
164
|
+
* Called once every time a metric is emitted from a Workflow metric (ie. a metric created
|
|
165
|
+
* from {@link workflow.metricMeter}).
|
|
166
|
+
*
|
|
167
|
+
* Tags returned by this hook are _prepended_ to tags defined at the metric level and tags
|
|
168
|
+
* defined on the emitter function itself.
|
|
169
|
+
*/
|
|
170
|
+
getMetricTags?: (input: GetMetricTagsInput, next: Next<this, 'getMetricTags'>) => MetricTags;
|
|
161
171
|
}
|
|
162
172
|
/** Input for WorkflowInternalsInterceptor.concludeActivation */
|
|
163
173
|
export interface ConcludeActivationInput {
|
package/lib/interfaces.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { RawSourceMap } from 'source-map';
|
|
2
|
-
import { RetryPolicy,
|
|
2
|
+
import { RetryPolicy, CommonWorkflowOptions, HandlerUnfinishedPolicy, SearchAttributes, SignalDefinition, UpdateDefinition, QueryDefinition, Duration, VersioningIntent, TypedSearchAttributes, SearchAttributePair, Priority, WorkerDeploymentVersion, VersioningBehavior } from '@temporalio/common';
|
|
3
3
|
import type { coresdk } from '@temporalio/proto';
|
|
4
4
|
/**
|
|
5
5
|
* Workflow Execution information
|
|
@@ -22,8 +22,15 @@ export interface WorkflowInfo {
|
|
|
22
22
|
* Indexed information attached to the Workflow Execution
|
|
23
23
|
*
|
|
24
24
|
* This value may change during the lifetime of an Execution.
|
|
25
|
+
* @deprecated Use {@link typedSearchAttributes} instead.
|
|
25
26
|
*/
|
|
26
27
|
readonly searchAttributes: SearchAttributes;
|
|
28
|
+
/**
|
|
29
|
+
* Indexed information attached to the Workflow Execution, exposed through an interface.
|
|
30
|
+
*
|
|
31
|
+
* This value may change during the lifetime of an Execution.
|
|
32
|
+
*/
|
|
33
|
+
readonly typedSearchAttributes: TypedSearchAttributes;
|
|
27
34
|
/**
|
|
28
35
|
* Non-indexed information attached to the Workflow Execution
|
|
29
36
|
*/
|
|
@@ -32,6 +39,21 @@ export interface WorkflowInfo {
|
|
|
32
39
|
* Parent Workflow info (present if this is a Child Workflow)
|
|
33
40
|
*/
|
|
34
41
|
readonly parent?: ParentWorkflowInfo;
|
|
42
|
+
/**
|
|
43
|
+
* The root workflow execution, defined as follows:
|
|
44
|
+
* 1. A workflow without a parent workflow is its own root workflow.
|
|
45
|
+
* 2. A workflow with a parent workflow has the same root workflow as
|
|
46
|
+
* its parent.
|
|
47
|
+
*
|
|
48
|
+
* When there is no parent workflow, i.e., the workflow is its own root workflow,
|
|
49
|
+
* this field is `undefined`.
|
|
50
|
+
*
|
|
51
|
+
* Note that Continue-as-New (or reset) propagates the workflow parentage relationship,
|
|
52
|
+
* and therefore, whether the new workflow has the same root workflow as the original one
|
|
53
|
+
* depends on whether it had a parent.
|
|
54
|
+
*
|
|
55
|
+
*/
|
|
56
|
+
readonly root?: RootWorkflowInfo;
|
|
35
57
|
/**
|
|
36
58
|
* Result from the previous Run (present if this is a Cron Workflow or was Continued As New).
|
|
37
59
|
*
|
|
@@ -41,7 +63,7 @@ export interface WorkflowInfo {
|
|
|
41
63
|
/**
|
|
42
64
|
* Failure from the previous Run (present when this Run is a retry, or the last Run of a Cron Workflow failed)
|
|
43
65
|
*/
|
|
44
|
-
readonly lastFailure?:
|
|
66
|
+
readonly lastFailure?: Error;
|
|
45
67
|
/**
|
|
46
68
|
* Length of Workflow history up until the current Workflow Task.
|
|
47
69
|
*
|
|
@@ -130,9 +152,25 @@ export interface WorkflowInfo {
|
|
|
130
152
|
* task was completed by a worker without a Build ID. If this worker is the one executing this
|
|
131
153
|
* task for the first time and has a Build ID set, then its ID will be used. This value may change
|
|
132
154
|
* over the lifetime of the workflow run, but is deterministic and safe to use for branching.
|
|
155
|
+
*
|
|
156
|
+
* @deprecated Use `currentDeploymentVersion` instead
|
|
133
157
|
*/
|
|
134
158
|
readonly currentBuildId?: string;
|
|
159
|
+
/**
|
|
160
|
+
* The Deployment Version of the worker which executed the current Workflow Task. May be undefined
|
|
161
|
+
* if the task was completed by a worker without a Deployment Version. If this worker is the one
|
|
162
|
+
* executing this task for the first time and has a Deployment Version set, then its ID will be
|
|
163
|
+
* used. This value may change over the lifetime of the workflow run, but is deterministic and
|
|
164
|
+
* safe to use for branching.
|
|
165
|
+
*
|
|
166
|
+
* @experimental Deployment based versioning is experimental and may change in the future.
|
|
167
|
+
*/
|
|
168
|
+
readonly currentDeploymentVersion?: WorkerDeploymentVersion;
|
|
135
169
|
readonly unsafe: UnsafeWorkflowInfo;
|
|
170
|
+
/**
|
|
171
|
+
* Priority of this workflow
|
|
172
|
+
*/
|
|
173
|
+
readonly priority?: Priority;
|
|
136
174
|
}
|
|
137
175
|
/**
|
|
138
176
|
* Unsafe information about the current Workflow Execution.
|
|
@@ -167,6 +205,10 @@ export interface ParentWorkflowInfo {
|
|
|
167
205
|
runId: string;
|
|
168
206
|
namespace: string;
|
|
169
207
|
}
|
|
208
|
+
export interface RootWorkflowInfo {
|
|
209
|
+
workflowId: string;
|
|
210
|
+
runId: string;
|
|
211
|
+
}
|
|
170
212
|
/**
|
|
171
213
|
* Not an actual error, used by the Workflow runtime to abort execution when {@link continueAsNew} is called
|
|
172
214
|
*/
|
|
@@ -202,15 +244,28 @@ export interface ContinueAsNewOptions {
|
|
|
202
244
|
memo?: Record<string, unknown>;
|
|
203
245
|
/**
|
|
204
246
|
* Searchable attributes to attach to next Workflow run
|
|
247
|
+
* @deprecated Use {@link typedSearchAttributes} instead.
|
|
205
248
|
*/
|
|
206
249
|
searchAttributes?: SearchAttributes;
|
|
250
|
+
/**
|
|
251
|
+
* Specifies additional indexed information to attach to the Workflow Execution. More info:
|
|
252
|
+
* https://docs.temporal.io/docs/typescript/search-attributes
|
|
253
|
+
*
|
|
254
|
+
* Values are always converted using {@link JsonPayloadConverter}, even when a custom data converter is provided.
|
|
255
|
+
* Note that search attributes are not encoded, as such, do not include any sensitive information.
|
|
256
|
+
*
|
|
257
|
+
* If both {@link searchAttributes} and {@link typedSearchAttributes} are provided, conflicting keys will be overwritten
|
|
258
|
+
* by {@link typedSearchAttributes}.
|
|
259
|
+
*/
|
|
260
|
+
typedSearchAttributes?: SearchAttributePair[] | TypedSearchAttributes;
|
|
207
261
|
/**
|
|
208
262
|
* When using the Worker Versioning feature, specifies whether this Workflow should
|
|
209
263
|
* Continue-as-New onto a worker with a compatible Build Id or not. See {@link VersioningIntent}.
|
|
210
264
|
*
|
|
211
265
|
* @default 'COMPATIBLE'
|
|
212
266
|
*
|
|
213
|
-
* @
|
|
267
|
+
* @deprecated In favor of the new Worker Deployment API.
|
|
268
|
+
* @experimental The Worker Versioning API is still being designed. Major changes are expected.
|
|
214
269
|
*/
|
|
215
270
|
versioningIntent?: VersioningIntent;
|
|
216
271
|
}
|
|
@@ -294,7 +349,7 @@ export declare const ParentClosePolicy: {
|
|
|
294
349
|
readonly PARENT_CLOSE_POLICY_REQUEST_CANCEL: "REQUEST_CANCEL";
|
|
295
350
|
};
|
|
296
351
|
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;
|
|
297
|
-
export interface ChildWorkflowOptions extends CommonWorkflowOptions {
|
|
352
|
+
export interface ChildWorkflowOptions extends Omit<CommonWorkflowOptions, 'workflowIdConflictPolicy'> {
|
|
298
353
|
/**
|
|
299
354
|
* Workflow id to use when starting. If not specified a UUID is generated. Note that it is
|
|
300
355
|
* dangerous as in case of client side retries no deduplication will happen based on the
|
|
@@ -329,7 +384,8 @@ export interface ChildWorkflowOptions extends CommonWorkflowOptions {
|
|
|
329
384
|
*
|
|
330
385
|
* @default 'COMPATIBLE'
|
|
331
386
|
*
|
|
332
|
-
* @
|
|
387
|
+
* @deprecated In favor of the new Worker Deployment API.
|
|
388
|
+
* @experimental The Worker Versioning API is still being designed. Major changes are expected.
|
|
333
389
|
*/
|
|
334
390
|
versioningIntent?: VersioningIntent;
|
|
335
391
|
}
|
|
@@ -416,6 +472,14 @@ export type Handler<Ret, Args extends any[], T extends UpdateDefinition<Ret, Arg
|
|
|
416
472
|
* A handler function accepting signal calls for non-registered signal names.
|
|
417
473
|
*/
|
|
418
474
|
export type DefaultSignalHandler = (signalName: string, ...args: unknown[]) => void | Promise<void>;
|
|
475
|
+
/**
|
|
476
|
+
* A handler function accepting update calls for non-registered update names.
|
|
477
|
+
*/
|
|
478
|
+
export type DefaultUpdateHandler = (updateName: string, ...args: unknown[]) => Promise<unknown> | unknown;
|
|
479
|
+
/**
|
|
480
|
+
* A handler function accepting query calls for non-registered query names.
|
|
481
|
+
*/
|
|
482
|
+
export type DefaultQueryHandler = (queryName: string, ...args: unknown[]) => unknown;
|
|
419
483
|
/**
|
|
420
484
|
* A validation function capable of accepting the arguments for a given UpdateDefinition.
|
|
421
485
|
*/
|
|
@@ -444,4 +508,5 @@ export type UpdateHandlerOptions<Args extends any[]> = {
|
|
|
444
508
|
export interface ActivationCompletion {
|
|
445
509
|
commands: coresdk.workflow_commands.IWorkflowCommand[];
|
|
446
510
|
usedInternalFlags: number[];
|
|
511
|
+
versioningBehavior?: VersioningBehavior;
|
|
447
512
|
}
|
package/lib/interfaces.js
CHANGED
|
@@ -14,6 +14,7 @@ const enums_helpers_1 = require("@temporalio/common/lib/internal-workflow/enums-
|
|
|
14
14
|
* Not an actual error, used by the Workflow runtime to abort execution when {@link continueAsNew} is called
|
|
15
15
|
*/
|
|
16
16
|
let ContinueAsNew = class ContinueAsNew extends Error {
|
|
17
|
+
command;
|
|
17
18
|
constructor(command) {
|
|
18
19
|
super('Workflow continued as new');
|
|
19
20
|
this.command = command;
|
package/lib/interfaces.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../src/interfaces.ts"],"names":[],"mappings":";;;;;;;;;;
|
|
1
|
+
{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IG;IACH,kCAAkC,EAAE,gBAAgB,EAAE,8CAA8C;CAC5F,CAAC;AAEX,uBAAuB;AACV,KAAqD,IAAA,uCAAuB,EAOvF;IACE,CAAC,yBAAiB,CAAC,SAAS,CAAC,EAAE,CAAC;IAChC,CAAC,yBAAiB,CAAC,OAAO,CAAC,EAAE,CAAC;IAC9B,CAAC,yBAAiB,CAAC,cAAc,CAAC,EAAE,CAAC;IACrC,WAAW,EAAE,CAAC;CACN,EACV,sBAAsB,CACvB,EAda,+BAAuB,UAAE,+BAAuB,SAc5D"}
|
package/lib/internals.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import type { RawSourceMap } from 'source-map';
|
|
2
|
-
import { FailureConverter, PayloadConverter, HandlerUnfinishedPolicy, Workflow, WorkflowQueryAnnotatedType, WorkflowSignalAnnotatedType, WorkflowUpdateAnnotatedType, ProtoFailure, WorkflowUpdateType, WorkflowUpdateValidatorType } from '@temporalio/common';
|
|
2
|
+
import { FailureConverter, PayloadConverter, HandlerUnfinishedPolicy, Workflow, WorkflowQueryAnnotatedType, WorkflowSignalAnnotatedType, WorkflowUpdateAnnotatedType, ProtoFailure, WorkflowUpdateType, WorkflowUpdateValidatorType, WorkflowFunctionWithOptions, VersioningBehavior, WorkflowDefinitionOptions } from '@temporalio/common';
|
|
3
3
|
import type { coresdk } from '@temporalio/proto';
|
|
4
4
|
import { RNG } from './alea';
|
|
5
5
|
import { RootCancellationScope } from './cancellation-scope';
|
|
6
6
|
import { QueryInput, SignalInput, UpdateInput, WorkflowExecuteInput, WorkflowInterceptors } from './interceptors';
|
|
7
|
-
import { DefaultSignalHandler, StackTraceFileLocation, WorkflowInfo, WorkflowCreateOptionsInternal, ActivationCompletion } from './interfaces';
|
|
7
|
+
import { DefaultSignalHandler, StackTraceFileLocation, WorkflowInfo, WorkflowCreateOptionsInternal, ActivationCompletion, DefaultUpdateHandler, DefaultQueryHandler } from './interfaces';
|
|
8
8
|
import { type SinkCall } from './sinks';
|
|
9
9
|
import { SdkFlag } from './flags';
|
|
10
10
|
export interface Stack {
|
|
@@ -107,6 +107,14 @@ export declare class Activator implements ActivationHandler {
|
|
|
107
107
|
* A signal handler that catches calls for non-registered signal names.
|
|
108
108
|
*/
|
|
109
109
|
defaultSignalHandler?: DefaultSignalHandler;
|
|
110
|
+
/**
|
|
111
|
+
* A update handler that catches calls for non-registered update names.
|
|
112
|
+
*/
|
|
113
|
+
defaultUpdateHandler?: DefaultUpdateHandler;
|
|
114
|
+
/**
|
|
115
|
+
* A query handler that catches calls for non-registered query names.
|
|
116
|
+
*/
|
|
117
|
+
defaultQueryHandler?: DefaultQueryHandler;
|
|
110
118
|
/**
|
|
111
119
|
* Source map file for looking up the source files in response to __enhanced_stack_trace
|
|
112
120
|
*/
|
|
@@ -116,6 +124,36 @@ export declare class Activator implements ActivationHandler {
|
|
|
116
124
|
*/
|
|
117
125
|
protected readonly showStackTraceSources: boolean;
|
|
118
126
|
readonly promiseStackStore: PromiseStackStore;
|
|
127
|
+
/**
|
|
128
|
+
* The error that caused the current Workflow Task to fail. Sets if a non-`TemporalFailure`
|
|
129
|
+
* error bubbles up out of the Workflow function, or out of a Signal or Update handler. We
|
|
130
|
+
* capture errors this way because those functions are not technically awaited when started,
|
|
131
|
+
* but left to run asynchronously. There is therefore no real "parent" function that can
|
|
132
|
+
* directly handle those errors, and not capturing it would result in an Unhandled Promise
|
|
133
|
+
* Rejection. So instead, we buffer the error here, to then be processed in the context
|
|
134
|
+
* of our own synchronous Activation handling event loop.
|
|
135
|
+
*
|
|
136
|
+
* Our code does a best effort to stop processing the current activation as soon as possible
|
|
137
|
+
* after this field is set:
|
|
138
|
+
* - If an error is thrown while executing code synchronously (e.g. anything before the
|
|
139
|
+
* first `await` statement in a Workflow function or a signal/update handler), the error
|
|
140
|
+
* will be _immediately_ rethrown, which will prevent execution of further jobs in the
|
|
141
|
+
* current activation. We know we're currently running code synchronously thanks to the
|
|
142
|
+
* `rethrowSynchronously` flag below.
|
|
143
|
+
* - It an error is thrown while executing microtasks, then the error will be rethrown on
|
|
144
|
+
* the next call to `tryUnblockConditions()`.
|
|
145
|
+
*
|
|
146
|
+
* Unfortunately, there's no way for us to prevent further execution of microtasks that have
|
|
147
|
+
* already been scheduled, nor those that will be recursively scheduled from those microtasks.
|
|
148
|
+
* Should more errors get thrown while settling microtasks, those will be ignored (i.e. only
|
|
149
|
+
* the first captured error is preserved).
|
|
150
|
+
*/
|
|
151
|
+
workflowTaskError: unknown;
|
|
152
|
+
/**
|
|
153
|
+
* Set to true when running synchronous code (e.g. while processing activation jobs and when calling
|
|
154
|
+
* `tryUnblockConditions()`). While this flag is set, it is safe to let errors bubble up.
|
|
155
|
+
*/
|
|
156
|
+
rethrowSynchronously: boolean;
|
|
119
157
|
readonly rootScope: RootCancellationScope;
|
|
120
158
|
/**
|
|
121
159
|
* Mapping of query name to handler
|
|
@@ -165,7 +203,7 @@ export declare class Activator implements ActivationHandler {
|
|
|
165
203
|
/**
|
|
166
204
|
* Reference to the current Workflow, initialized when a Workflow is started
|
|
167
205
|
*/
|
|
168
|
-
workflow?: Workflow
|
|
206
|
+
workflow?: Workflow | WorkflowFunctionWithOptions<any[], any>;
|
|
169
207
|
/**
|
|
170
208
|
* Information about the current Workflow
|
|
171
209
|
* May be accessed from outside the VM.
|
|
@@ -191,10 +229,14 @@ export declare class Activator implements ActivationHandler {
|
|
|
191
229
|
*/
|
|
192
230
|
sinkCalls: SinkCall[];
|
|
193
231
|
/**
|
|
194
|
-
* A nanosecond resolution time function, externally injected
|
|
232
|
+
* A nanosecond resolution time function, externally injected. This is used to
|
|
233
|
+
* precisely sort logs entries emitted from the Workflow Context vs those emitted
|
|
234
|
+
* from other sources (e.g. main thread, Core, etc).
|
|
195
235
|
*/
|
|
196
236
|
readonly getTimeOfDay: () => bigint;
|
|
197
237
|
readonly registeredActivityNames: Set<string>;
|
|
238
|
+
versioningBehavior?: VersioningBehavior;
|
|
239
|
+
workflowDefinitionOptionsGetter?: () => WorkflowDefinitionOptions;
|
|
198
240
|
constructor({ info, now, showStackTraceSources, sourceMap, getTimeOfDay, randomnessSeed, registeredActivityNames, }: WorkflowCreateOptionsInternal);
|
|
199
241
|
/**
|
|
200
242
|
* May be invoked from outside the VM.
|
|
@@ -218,10 +260,10 @@ export declare class Activator implements ActivationHandler {
|
|
|
218
260
|
cancelWorkflow(_activation: coresdk.workflow_activation.ICancelWorkflow): void;
|
|
219
261
|
fireTimer(activation: coresdk.workflow_activation.IFireTimer): void;
|
|
220
262
|
resolveActivity(activation: coresdk.workflow_activation.IResolveActivity): void;
|
|
221
|
-
resolveNexusOperationStart(_activation: coresdk.workflow_activation.IResolveNexusOperationStart): void;
|
|
222
|
-
resolveNexusOperation(_activation: coresdk.workflow_activation.IResolveNexusOperation): void;
|
|
223
263
|
resolveChildWorkflowExecutionStart(activation: coresdk.workflow_activation.IResolveChildWorkflowExecutionStart): void;
|
|
224
264
|
resolveChildWorkflowExecution(activation: coresdk.workflow_activation.IResolveChildWorkflowExecution): void;
|
|
265
|
+
resolveNexusOperationStart(_: coresdk.workflow_activation.IResolveNexusOperationStart): void;
|
|
266
|
+
resolveNexusOperation(_: coresdk.workflow_activation.IResolveNexusOperation): void;
|
|
225
267
|
protected queryWorkflowNextHandler({ queryName, args }: QueryInput): Promise<unknown>;
|
|
226
268
|
queryWorkflow(activation: coresdk.workflow_activation.IQueryWorkflow): void;
|
|
227
269
|
doUpdate(activation: coresdk.workflow_activation.IDoUpdate): void;
|
|
@@ -259,7 +301,13 @@ export declare class Activator implements ActivationHandler {
|
|
|
259
301
|
* Transforms failures into a command to be sent to the server.
|
|
260
302
|
* Used to handle any failure emitted by the Workflow.
|
|
261
303
|
*/
|
|
262
|
-
handleWorkflowFailure(error: unknown):
|
|
304
|
+
handleWorkflowFailure(error: unknown): void;
|
|
305
|
+
recordWorkflowTaskError(error: unknown): void;
|
|
306
|
+
/**
|
|
307
|
+
* If a Workflow Task error was captured, and we are running in synchronous mode,
|
|
308
|
+
* then bubble it up now. This is safe to call even if there is no error to rethrow.
|
|
309
|
+
*/
|
|
310
|
+
maybeRethrowWorkflowTaskError(): void;
|
|
263
311
|
private completeQuery;
|
|
264
312
|
private failQuery;
|
|
265
313
|
private acceptUpdate;
|