@temporalio/workflow 1.10.3 → 1.11.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/flags.d.ts +18 -0
- package/lib/flags.js +19 -1
- package/lib/flags.js.map +1 -1
- package/lib/index.d.ts +1 -1
- package/lib/interfaces.d.ts +35 -13
- package/lib/interfaces.js.map +1 -1
- package/lib/internals.d.ts +58 -20
- package/lib/internals.js +151 -83
- package/lib/internals.js.map +1 -1
- package/lib/update-scope.d.ts +43 -0
- package/lib/update-scope.js +41 -0
- package/lib/update-scope.js.map +1 -0
- package/lib/worker-interface.d.ts +1 -8
- package/lib/worker-interface.js +13 -58
- package/lib/worker-interface.js.map +1 -1
- package/lib/workflow.d.ts +67 -8
- package/lib/workflow.js +107 -12
- package/lib/workflow.js.map +1 -1
- package/package.json +4 -4
- package/src/flags.ts +20 -1
- package/src/index.ts +3 -3
- package/src/interfaces.ts +41 -14
- package/src/internals.ts +192 -88
- package/src/update-scope.ts +67 -0
- package/src/worker-interface.ts +15 -64
- package/src/workflow.ts +116 -11
package/lib/flags.d.ts
CHANGED
|
@@ -14,5 +14,23 @@ export declare const SdkFlags: {
|
|
|
14
14
|
* @since Introduced in 1.10.2/1.11.0.
|
|
15
15
|
*/
|
|
16
16
|
readonly NonCancellableScopesAreShieldedFromPropagation: SdkFlag;
|
|
17
|
+
/**
|
|
18
|
+
* Prior to 1.11.0, when processing a Workflow activation, the SDK would execute `notifyHasPatch`
|
|
19
|
+
* and `signalWorkflow` jobs in distinct phases, before other types of jobs. The primary reason
|
|
20
|
+
* behind that multi-phase algorithm was to avoid the possibility that a Workflow execution might
|
|
21
|
+
* complete before all incoming signals have been dispatched (at least to the point that the
|
|
22
|
+
* _synchronous_ part of the handler function has been executed).
|
|
23
|
+
*
|
|
24
|
+
* This flag replaces that multi-phase algorithm with a simpler one where jobs are simply sorted as
|
|
25
|
+
* `(signals and updates) -> others`, but without processing them as distinct batches (i.e. without
|
|
26
|
+
* leaving/reentering the VM context between each group, which automatically triggers the execution
|
|
27
|
+
* of all outstanding microtasks). That single-phase approach resolves a number of quirks of the
|
|
28
|
+
* former algorithm, and yet still satisfies to the original requirement of ensuring that every
|
|
29
|
+
* `signalWorkflow` jobs - and now `doUpdate` jobs as well - have been given a proper chance to
|
|
30
|
+
* execute before the Workflow main function might completes.
|
|
31
|
+
*
|
|
32
|
+
* @since Introduced in 1.11.0. This change is not rollback-safe.
|
|
33
|
+
*/
|
|
34
|
+
readonly ProcessWorkflowActivationJobsAsSingleBatch: SdkFlag;
|
|
17
35
|
};
|
|
18
36
|
export declare function assertValidFlag(id: number): void;
|
package/lib/flags.js
CHANGED
|
@@ -13,7 +13,25 @@ exports.SdkFlags = {
|
|
|
13
13
|
*
|
|
14
14
|
* @since Introduced in 1.10.2/1.11.0.
|
|
15
15
|
*/
|
|
16
|
-
NonCancellableScopesAreShieldedFromPropagation: defineFlag(1,
|
|
16
|
+
NonCancellableScopesAreShieldedFromPropagation: defineFlag(1, true),
|
|
17
|
+
/**
|
|
18
|
+
* Prior to 1.11.0, when processing a Workflow activation, the SDK would execute `notifyHasPatch`
|
|
19
|
+
* and `signalWorkflow` jobs in distinct phases, before other types of jobs. The primary reason
|
|
20
|
+
* behind that multi-phase algorithm was to avoid the possibility that a Workflow execution might
|
|
21
|
+
* complete before all incoming signals have been dispatched (at least to the point that the
|
|
22
|
+
* _synchronous_ part of the handler function has been executed).
|
|
23
|
+
*
|
|
24
|
+
* This flag replaces that multi-phase algorithm with a simpler one where jobs are simply sorted as
|
|
25
|
+
* `(signals and updates) -> others`, but without processing them as distinct batches (i.e. without
|
|
26
|
+
* leaving/reentering the VM context between each group, which automatically triggers the execution
|
|
27
|
+
* of all outstanding microtasks). That single-phase approach resolves a number of quirks of the
|
|
28
|
+
* former algorithm, and yet still satisfies to the original requirement of ensuring that every
|
|
29
|
+
* `signalWorkflow` jobs - and now `doUpdate` jobs as well - have been given a proper chance to
|
|
30
|
+
* execute before the Workflow main function might completes.
|
|
31
|
+
*
|
|
32
|
+
* @since Introduced in 1.11.0. This change is not rollback-safe.
|
|
33
|
+
*/
|
|
34
|
+
ProcessWorkflowActivationJobsAsSingleBatch: defineFlag(2, true),
|
|
17
35
|
};
|
|
18
36
|
function defineFlag(id, def) {
|
|
19
37
|
const flag = { id, default: def };
|
package/lib/flags.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"flags.js","sourceRoot":"","sources":["../src/flags.ts"],"names":[],"mappings":";;;AAKA,MAAM,aAAa,GAAyB,IAAI,GAAG,EAAE,CAAC;AAEzC,QAAA,QAAQ,GAAG;IACtB;;;;;;;;;OASG;IACH,8CAA8C,EAAE,UAAU,CAAC,CAAC,EAAE,
|
|
1
|
+
{"version":3,"file":"flags.js","sourceRoot":"","sources":["../src/flags.ts"],"names":[],"mappings":";;;AAKA,MAAM,aAAa,GAAyB,IAAI,GAAG,EAAE,CAAC;AAEzC,QAAA,QAAQ,GAAG;IACtB;;;;;;;;;OASG;IACH,8CAA8C,EAAE,UAAU,CAAC,CAAC,EAAE,IAAI,CAAC;IAEnE;;;;;;;;;;;;;;;;OAgBG;IACH,0CAA0C,EAAE,UAAU,CAAC,CAAC,EAAE,IAAI,CAAC;CACvD,CAAC;AAEX,SAAS,UAAU,CAAC,EAAU,EAAE,GAAY;IAC1C,MAAM,IAAI,GAAG,EAAE,EAAE,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC;IAClC,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;AAFD,0CAEC"}
|
package/lib/index.d.ts
CHANGED
|
@@ -57,7 +57,7 @@ export * from '@temporalio/common/lib/workflow-options';
|
|
|
57
57
|
export { AsyncLocalStorage, CancellationScope, CancellationScopeOptions } from './cancellation-scope';
|
|
58
58
|
export * from './errors';
|
|
59
59
|
export * from './interceptors';
|
|
60
|
-
export { ChildWorkflowCancellationType, ChildWorkflowOptions, ContinueAsNew, ContinueAsNewOptions, EnhancedStackTrace,
|
|
60
|
+
export { ChildWorkflowCancellationType, ChildWorkflowOptions, ContinueAsNew, ContinueAsNewOptions, EnhancedStackTrace, StackTraceFileLocation, StackTraceFileSlice, ParentClosePolicy, ParentWorkflowInfo, StackTraceSDKInfo, StackTrace, UnsafeWorkflowInfo, WorkflowInfo, } from './interfaces';
|
|
61
61
|
export { proxySinks, Sink, SinkCall, SinkFunction, Sinks } from './sinks';
|
|
62
62
|
export { log } from './logs';
|
|
63
63
|
export { Trigger } from './trigger';
|
package/lib/interfaces.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { RawSourceMap } from 'source-map';
|
|
2
|
-
import { RetryPolicy, TemporalFailure, CommonWorkflowOptions, SearchAttributes, SignalDefinition, UpdateDefinition, QueryDefinition, Duration, VersioningIntent } from '@temporalio/common';
|
|
2
|
+
import { RetryPolicy, TemporalFailure, CommonWorkflowOptions, HandlerUnfinishedPolicy, SearchAttributes, SignalDefinition, UpdateDefinition, QueryDefinition, Duration, VersioningIntent } from '@temporalio/common';
|
|
3
3
|
import type { coresdk } from '@temporalio/proto';
|
|
4
4
|
/**
|
|
5
5
|
* Workflow Execution information
|
|
@@ -149,6 +149,21 @@ export interface UnsafeWorkflowInfo {
|
|
|
149
149
|
readonly now: () => number;
|
|
150
150
|
readonly isReplaying: boolean;
|
|
151
151
|
}
|
|
152
|
+
/**
|
|
153
|
+
* Information about a workflow update.
|
|
154
|
+
*
|
|
155
|
+
* @experimental
|
|
156
|
+
*/
|
|
157
|
+
export interface UpdateInfo {
|
|
158
|
+
/**
|
|
159
|
+
* A workflow-unique identifier for this update.
|
|
160
|
+
*/
|
|
161
|
+
readonly id: string;
|
|
162
|
+
/**
|
|
163
|
+
* The update type name.
|
|
164
|
+
*/
|
|
165
|
+
readonly name: string;
|
|
166
|
+
}
|
|
152
167
|
export interface ParentWorkflowInfo {
|
|
153
168
|
workflowId: string;
|
|
154
169
|
runId: string;
|
|
@@ -298,32 +313,32 @@ export type RequiredChildWorkflowOptions = Required<Pick<ChildWorkflowOptions, '
|
|
|
298
313
|
args: unknown[];
|
|
299
314
|
};
|
|
300
315
|
export type ChildWorkflowOptionsWithDefaults = ChildWorkflowOptions & RequiredChildWorkflowOptions;
|
|
301
|
-
export interface
|
|
316
|
+
export interface StackTraceSDKInfo {
|
|
302
317
|
name: string;
|
|
303
318
|
version: string;
|
|
304
319
|
}
|
|
305
320
|
/**
|
|
306
321
|
* Represents a slice of a file starting at lineOffset
|
|
307
322
|
*/
|
|
308
|
-
export interface
|
|
323
|
+
export interface StackTraceFileSlice {
|
|
309
324
|
/**
|
|
310
|
-
*
|
|
325
|
+
* Only used possible to trim the file without breaking syntax highlighting.
|
|
311
326
|
*/
|
|
312
|
-
|
|
327
|
+
line_offset: number;
|
|
313
328
|
/**
|
|
314
|
-
*
|
|
329
|
+
* slice of a file with `\n` (newline) line terminator.
|
|
315
330
|
*/
|
|
316
|
-
|
|
331
|
+
content: string;
|
|
317
332
|
}
|
|
318
333
|
/**
|
|
319
334
|
* A pointer to a location in a file
|
|
320
335
|
*/
|
|
321
|
-
export interface
|
|
336
|
+
export interface StackTraceFileLocation {
|
|
322
337
|
/**
|
|
323
338
|
* Path to source file (absolute or relative).
|
|
324
339
|
* When using a relative path, make sure all paths are relative to the same root.
|
|
325
340
|
*/
|
|
326
|
-
|
|
341
|
+
file_path?: string;
|
|
327
342
|
/**
|
|
328
343
|
* If possible, SDK should send this, required for displaying the code location.
|
|
329
344
|
*/
|
|
@@ -336,22 +351,26 @@ export interface FileLocation {
|
|
|
336
351
|
* Function name this line belongs to (if applicable).
|
|
337
352
|
* Used for falling back to stack trace view.
|
|
338
353
|
*/
|
|
339
|
-
|
|
354
|
+
function_name?: string;
|
|
355
|
+
/**
|
|
356
|
+
* Flag to mark this as internal SDK code and hide by default in the UI.
|
|
357
|
+
*/
|
|
358
|
+
internal_code: boolean;
|
|
340
359
|
}
|
|
341
360
|
export interface StackTrace {
|
|
342
|
-
locations:
|
|
361
|
+
locations: StackTraceFileLocation[];
|
|
343
362
|
}
|
|
344
363
|
/**
|
|
345
364
|
* Used as the result for the enhanced stack trace query
|
|
346
365
|
*/
|
|
347
366
|
export interface EnhancedStackTrace {
|
|
348
|
-
sdk:
|
|
367
|
+
sdk: StackTraceSDKInfo;
|
|
349
368
|
/**
|
|
350
369
|
* Mapping of file path to file contents.
|
|
351
370
|
* SDK may choose to send no, some or all sources.
|
|
352
371
|
* Sources might be trimmed, and some time only the file(s) of the top element of the trace will be sent.
|
|
353
372
|
*/
|
|
354
|
-
sources: Record<string,
|
|
373
|
+
sources: Record<string, StackTraceFileSlice[]>;
|
|
355
374
|
stacks: StackTrace[];
|
|
356
375
|
}
|
|
357
376
|
export interface WorkflowCreateOptions {
|
|
@@ -359,6 +378,7 @@ export interface WorkflowCreateOptions {
|
|
|
359
378
|
randomnessSeed: number[];
|
|
360
379
|
now: number;
|
|
361
380
|
patches: string[];
|
|
381
|
+
sdkFlags: number[];
|
|
362
382
|
showStackTraceSources: boolean;
|
|
363
383
|
}
|
|
364
384
|
export interface WorkflowCreateOptionsInternal extends WorkflowCreateOptions {
|
|
@@ -389,6 +409,7 @@ export type QueryHandlerOptions = {
|
|
|
389
409
|
*/
|
|
390
410
|
export type SignalHandlerOptions = {
|
|
391
411
|
description?: string;
|
|
412
|
+
unfinishedPolicy?: HandlerUnfinishedPolicy;
|
|
392
413
|
};
|
|
393
414
|
/**
|
|
394
415
|
* A validator and description of an update handler.
|
|
@@ -396,6 +417,7 @@ export type SignalHandlerOptions = {
|
|
|
396
417
|
export type UpdateHandlerOptions<Args extends any[]> = {
|
|
397
418
|
validator?: UpdateValidator<Args>;
|
|
398
419
|
description?: string;
|
|
420
|
+
unfinishedPolicy?: HandlerUnfinishedPolicy;
|
|
399
421
|
};
|
|
400
422
|
export interface ActivationCompletion {
|
|
401
423
|
commands: coresdk.workflow_commands.IWorkflowCommand[];
|
package/lib/interfaces.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../src/interfaces.ts"],"names":[],"mappings":";;;;;;;;;
|
|
1
|
+
{"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../src/interfaces.ts"],"names":[],"mappings":";;;;;;;;;AAaA,sEAA+F;AA2M/F;;GAEG;AAEI,IAAM,aAAa,GAAnB,MAAM,aAAc,SAAQ,KAAK;IACtC,YAA4B,OAAkE;QAC5F,KAAK,CAAC,2BAA2B,CAAC,CAAC;QADT,YAAO,GAAP,OAAO,CAA2D;IAE9F,CAAC;CACF,CAAA;AAJY,sCAAa;wBAAb,aAAa;IADzB,IAAA,yCAA0B,EAAC,eAAe,CAAC;GAC/B,aAAa,CAIzB;AA2CD;;;;;;;GAOG;AACH,IAAY,6BAyBX;AAzBD,WAAY,6BAA6B;IACvC;;OAEG;IACH,uFAAW,CAAA;IAEX;;OAEG;IACH,6FAAc,CAAA;IAEd;;;;;;;OAOG;IACH,+HAA+B,CAAA;IAE/B;;OAEG;IACH,+HAA+B,CAAA;AACjC,CAAC,EAzBW,6BAA6B,6CAA7B,6BAA6B,QAyBxC;AAED,IAAA,2BAAY,GAAuF,CAAC;AACpG,IAAA,2BAAY,GAAuF,CAAC;AAEpG;;;;GAIG;AACH,IAAY,iBAsBX;AAtBD,WAAY,iBAAiB;IAC3B;;OAEG;IACH,+GAAmC,CAAA;IAEnC;;;;OAIG;IACH,2GAAiC,CAAA;IAEjC;;OAEG;IACH,uGAA+B,CAAA;IAE/B;;OAEG;IACH,qHAAsC,CAAA;AACxC,CAAC,EAtBW,iBAAiB,iCAAjB,iBAAiB,QAsB5B;AAED,IAAA,2BAAY,GAA+D,CAAC;AAC5E,IAAA,2BAAY,GAA+D,CAAC"}
|
package/lib/internals.d.ts
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import type { RawSourceMap } from 'source-map';
|
|
2
|
-
import { FailureConverter, PayloadConverter, Workflow, WorkflowQueryAnnotatedType, WorkflowSignalAnnotatedType, WorkflowUpdateAnnotatedType, ProtoFailure } from '@temporalio/common';
|
|
2
|
+
import { FailureConverter, PayloadConverter, HandlerUnfinishedPolicy, Workflow, WorkflowQueryAnnotatedType, WorkflowSignalAnnotatedType, WorkflowUpdateAnnotatedType, ProtoFailure, WorkflowUpdateType, WorkflowUpdateValidatorType } 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,
|
|
7
|
+
import { DefaultSignalHandler, StackTraceFileLocation, WorkflowInfo, WorkflowCreateOptionsInternal, ActivationCompletion } from './interfaces';
|
|
8
8
|
import { type SinkCall } from './sinks';
|
|
9
9
|
import { SdkFlag } from './flags';
|
|
10
10
|
export interface Stack {
|
|
11
11
|
formatted: string;
|
|
12
|
-
structured:
|
|
12
|
+
structured: StackTraceFileLocation[];
|
|
13
13
|
}
|
|
14
14
|
/**
|
|
15
15
|
* Global store to track promise stacks for stack trace query
|
|
@@ -33,10 +33,31 @@ export type ActivationHandlerFunction<K extends keyof coresdk.workflow_activatio
|
|
|
33
33
|
export type ActivationHandler = {
|
|
34
34
|
[P in keyof coresdk.workflow_activation.IWorkflowActivationJob]: ActivationHandlerFunction<P>;
|
|
35
35
|
};
|
|
36
|
+
/**
|
|
37
|
+
* Information about an update or signal handler execution.
|
|
38
|
+
*/
|
|
39
|
+
interface MessageHandlerExecution {
|
|
40
|
+
name: string;
|
|
41
|
+
unfinishedPolicy: HandlerUnfinishedPolicy;
|
|
42
|
+
id?: string;
|
|
43
|
+
}
|
|
36
44
|
/**
|
|
37
45
|
* Keeps all of the Workflow runtime state like pending completions for activities and timers.
|
|
38
46
|
*
|
|
39
47
|
* Implements handlers for all workflow activation jobs.
|
|
48
|
+
*
|
|
49
|
+
* Note that most methods in this class are meant to be called only from within the VM.
|
|
50
|
+
*
|
|
51
|
+
* However, a few methods may be called directly from outside the VM (essentially from `vm-shared.ts`).
|
|
52
|
+
* These methods are specifically marked with a comment and require careful consideration, as the
|
|
53
|
+
* execution context may not properly reflect that of the target workflow execution (e.g.: with Reusable
|
|
54
|
+
* VMs, the `global` may not have been swapped to those of that workflow execution; the active microtask
|
|
55
|
+
* queue may be that of the thread/process, rather than the queue of that VM context; etc). Consequently,
|
|
56
|
+
* methods that are meant to be called from outside of the VM must not do any of the following:
|
|
57
|
+
*
|
|
58
|
+
* - Access any global variable;
|
|
59
|
+
* - Create Promise objects, use async/await, or otherwise schedule microtasks;
|
|
60
|
+
* - Call user-defined functions, including any form of interceptor.
|
|
40
61
|
*/
|
|
41
62
|
export declare class Activator implements ActivationHandler {
|
|
42
63
|
/**
|
|
@@ -62,14 +83,6 @@ export declare class Activator implements ActivationHandler {
|
|
|
62
83
|
* Holds buffered signal calls until a handler is registered
|
|
63
84
|
*/
|
|
64
85
|
readonly bufferedSignals: coresdk.workflow_activation.ISignalWorkflow[];
|
|
65
|
-
/**
|
|
66
|
-
* Holds buffered query calls until a handler is registered.
|
|
67
|
-
*
|
|
68
|
-
* **IMPORTANT** queries are only buffered until workflow is started.
|
|
69
|
-
* This is required because async interceptors might block workflow function invocation
|
|
70
|
-
* which delays query handler registration.
|
|
71
|
-
*/
|
|
72
|
-
protected readonly bufferedQueries: coresdk.workflow_activation.IQueryWorkflow[];
|
|
73
86
|
/**
|
|
74
87
|
* Mapping of update name to handler and validator
|
|
75
88
|
*/
|
|
@@ -78,6 +91,18 @@ export declare class Activator implements ActivationHandler {
|
|
|
78
91
|
* Mapping of signal name to handler
|
|
79
92
|
*/
|
|
80
93
|
readonly signalHandlers: Map<string, WorkflowSignalAnnotatedType>;
|
|
94
|
+
/**
|
|
95
|
+
* Mapping of in-progress updates to handler execution information.
|
|
96
|
+
*/
|
|
97
|
+
readonly inProgressUpdates: Map<string, MessageHandlerExecution>;
|
|
98
|
+
/**
|
|
99
|
+
* Mapping of in-progress signals to handler execution information.
|
|
100
|
+
*/
|
|
101
|
+
readonly inProgressSignals: Map<number, MessageHandlerExecution>;
|
|
102
|
+
/**
|
|
103
|
+
* A sequence number providing unique identifiers for signal handler executions.
|
|
104
|
+
*/
|
|
105
|
+
protected signalHandlerExecutionSeq: number;
|
|
81
106
|
/**
|
|
82
107
|
* A signal handler that catches calls for non-registered signal names.
|
|
83
108
|
*/
|
|
@@ -120,12 +145,6 @@ export declare class Activator implements ActivationHandler {
|
|
|
120
145
|
* Was this Workflow cancelled?
|
|
121
146
|
*/
|
|
122
147
|
protected cancelled: boolean;
|
|
123
|
-
/**
|
|
124
|
-
* This is tracked to allow buffering queries until a workflow function is called.
|
|
125
|
-
* TODO(bergundy): I don't think this makes sense since queries run last in an activation and must be responded to in
|
|
126
|
-
* the same activation.
|
|
127
|
-
*/
|
|
128
|
-
protected workflowFunctionWasCalled: boolean;
|
|
129
148
|
/**
|
|
130
149
|
* The next (incremental) sequence to assign when generating completable commands
|
|
131
150
|
*/
|
|
@@ -140,6 +159,7 @@ export declare class Activator implements ActivationHandler {
|
|
|
140
159
|
};
|
|
141
160
|
/**
|
|
142
161
|
* This is set every time the workflow executes an activation
|
|
162
|
+
* May be accessed and modified from outside the VM.
|
|
143
163
|
*/
|
|
144
164
|
now: number;
|
|
145
165
|
/**
|
|
@@ -148,6 +168,7 @@ export declare class Activator implements ActivationHandler {
|
|
|
148
168
|
workflow?: Workflow;
|
|
149
169
|
/**
|
|
150
170
|
* Information about the current Workflow
|
|
171
|
+
* May be accessed from outside the VM.
|
|
151
172
|
*/
|
|
152
173
|
info: WorkflowInfo;
|
|
153
174
|
/**
|
|
@@ -174,9 +195,15 @@ export declare class Activator implements ActivationHandler {
|
|
|
174
195
|
*/
|
|
175
196
|
readonly getTimeOfDay: () => bigint;
|
|
176
197
|
readonly registeredActivityNames: Set<string>;
|
|
177
|
-
constructor({ info, now, showStackTraceSources, sourceMap, getTimeOfDay, randomnessSeed, patches, registeredActivityNames, }: WorkflowCreateOptionsInternal);
|
|
198
|
+
constructor({ info, now, showStackTraceSources, sourceMap, getTimeOfDay, sdkFlags, randomnessSeed, patches, registeredActivityNames, }: WorkflowCreateOptionsInternal);
|
|
199
|
+
/**
|
|
200
|
+
* May be invoked from outside the VM.
|
|
201
|
+
*/
|
|
178
202
|
mutateWorkflowInfo(fn: (info: WorkflowInfo) => WorkflowInfo): void;
|
|
179
203
|
protected getStackTraces(): Stack[];
|
|
204
|
+
/**
|
|
205
|
+
* May be invoked from outside the VM.
|
|
206
|
+
*/
|
|
180
207
|
getAndResetSinkCalls(): SinkCall[];
|
|
181
208
|
/**
|
|
182
209
|
* Buffer a Workflow command to be collected at the end of the current activation.
|
|
@@ -195,8 +222,8 @@ export declare class Activator implements ActivationHandler {
|
|
|
195
222
|
protected queryWorkflowNextHandler({ queryName, args }: QueryInput): Promise<unknown>;
|
|
196
223
|
queryWorkflow(activation: coresdk.workflow_activation.IQueryWorkflow): void;
|
|
197
224
|
doUpdate(activation: coresdk.workflow_activation.IDoUpdate): void;
|
|
198
|
-
protected updateNextHandler(
|
|
199
|
-
protected validateUpdateNextHandler(
|
|
225
|
+
protected updateNextHandler(handler: WorkflowUpdateType, { args }: UpdateInput): Promise<unknown>;
|
|
226
|
+
protected validateUpdateNextHandler(validator: WorkflowUpdateValidatorType | undefined, { args }: UpdateInput): void;
|
|
200
227
|
dispatchBufferedUpdates(): void;
|
|
201
228
|
rejectBufferedUpdates(): void;
|
|
202
229
|
signalWorkflowNextHandler({ signalName, args }: SignalInput): Promise<void>;
|
|
@@ -204,10 +231,20 @@ export declare class Activator implements ActivationHandler {
|
|
|
204
231
|
dispatchBufferedSignals(): void;
|
|
205
232
|
resolveSignalExternalWorkflow(activation: coresdk.workflow_activation.IResolveSignalExternalWorkflow): void;
|
|
206
233
|
resolveRequestCancelExternalWorkflow(activation: coresdk.workflow_activation.IResolveRequestCancelExternalWorkflow): void;
|
|
234
|
+
warnIfUnfinishedHandlers(): void;
|
|
207
235
|
updateRandomSeed(activation: coresdk.workflow_activation.IUpdateRandomSeed): void;
|
|
208
236
|
notifyHasPatch(activation: coresdk.workflow_activation.INotifyHasPatch): void;
|
|
209
237
|
patchInternal(patchId: string, deprecated: boolean): boolean;
|
|
238
|
+
/**
|
|
239
|
+
* Called early while handling an activation to register known flags.
|
|
240
|
+
* May be invoked from outside the VM.
|
|
241
|
+
*/
|
|
210
242
|
addKnownFlags(flags: number[]): void;
|
|
243
|
+
/**
|
|
244
|
+
* Check if a flag is known to the Workflow Execution; if not, enable the flag if workflow
|
|
245
|
+
* is not replaying and the flag is configured to be enabled by default.
|
|
246
|
+
* May be invoked from outside the VM.
|
|
247
|
+
*/
|
|
211
248
|
hasFlag(flag: SdkFlag): boolean;
|
|
212
249
|
removeFromCache(): void;
|
|
213
250
|
/**
|
|
@@ -228,3 +265,4 @@ export declare class Activator implements ActivationHandler {
|
|
|
228
265
|
errorToFailure(err: unknown): ProtoFailure;
|
|
229
266
|
failureToError(failure: ProtoFailure): Error;
|
|
230
267
|
}
|
|
268
|
+
export {};
|