@temporalio/workflow 1.4.4 → 1.5.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 +1 -2
- package/lib/cancellation-scope.js +6 -4
- package/lib/cancellation-scope.js.map +1 -1
- package/lib/errors.d.ts +0 -1
- package/lib/errors.js +1 -3
- package/lib/errors.js.map +1 -1
- package/lib/index.d.ts +4 -3
- package/lib/index.js +1 -3
- package/lib/index.js.map +1 -1
- package/lib/interceptors.d.ts +1 -1
- package/lib/interfaces.d.ts +13 -3
- package/lib/internals.d.ts +81 -72
- package/lib/internals.js +328 -305
- package/lib/internals.js.map +1 -1
- package/lib/stack-helpers.js +1 -1
- package/lib/stack-helpers.js.map +1 -1
- package/lib/worker-interface.d.ts +3 -27
- package/lib/worker-interface.js +57 -100
- package/lib/worker-interface.js.map +1 -1
- package/lib/workflow.js +92 -86
- package/lib/workflow.js.map +1 -1
- package/package.json +4 -4
- package/src/cancellation-scope.ts +7 -5
- package/src/errors.ts +0 -2
- package/src/index.ts +16 -5
- package/src/interceptors.ts +1 -1
- package/src/interfaces.ts +15 -3
- package/src/internals.ts +403 -347
- package/src/stack-helpers.ts +1 -1
- package/src/worker-interface.ts +59 -105
- package/src/workflow.ts +93 -88
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@temporalio/workflow",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.5.1",
|
|
4
4
|
"description": "Temporal.io SDK Workflow sub-package",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"temporal",
|
|
@@ -17,8 +17,8 @@
|
|
|
17
17
|
"types": "lib/index.d.ts",
|
|
18
18
|
"scripts": {},
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"@temporalio/common": "~1.
|
|
21
|
-
"@temporalio/proto": "~1.
|
|
20
|
+
"@temporalio/common": "~1.5.1",
|
|
21
|
+
"@temporalio/proto": "~1.5.1"
|
|
22
22
|
},
|
|
23
23
|
"devDependencies": {
|
|
24
24
|
"source-map": "^0.7.4"
|
|
@@ -30,5 +30,5 @@
|
|
|
30
30
|
"src",
|
|
31
31
|
"lib"
|
|
32
32
|
],
|
|
33
|
-
"gitHead": "
|
|
33
|
+
"gitHead": "4ac0ffa5d9ba9cc326027725997329c8493730f4"
|
|
34
34
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { CancelledFailure, IllegalStateError } from '@temporalio/common';
|
|
2
1
|
import type { AsyncLocalStorage as ALS } from 'async_hooks';
|
|
2
|
+
import { CancelledFailure, IllegalStateError } from '@temporalio/common';
|
|
3
3
|
import { untrackPromise } from './stack-helpers';
|
|
4
4
|
|
|
5
5
|
// AsyncLocalStorage is injected via vm module into global scope.
|
|
@@ -162,7 +162,8 @@ export class CancellationScope {
|
|
|
162
162
|
* Get the current "active" scope
|
|
163
163
|
*/
|
|
164
164
|
static current(): CancellationScope {
|
|
165
|
-
|
|
165
|
+
// Using globals directly instead of a helper function to avoid circular import
|
|
166
|
+
return storage.getStore() ?? (globalThis as any).__TEMPORAL__.activator.rootScope;
|
|
166
167
|
}
|
|
167
168
|
|
|
168
169
|
/** Alias to `new CancellationScope({ cancellable: true }).run(fn)` */
|
|
@@ -187,14 +188,15 @@ export class CancellationScope {
|
|
|
187
188
|
export const storage = new AsyncLocalStorage<CancellationScope>();
|
|
188
189
|
|
|
189
190
|
export class RootCancellationScope extends CancellationScope {
|
|
191
|
+
constructor() {
|
|
192
|
+
super({ cancellable: true, parent: NO_PARENT });
|
|
193
|
+
}
|
|
194
|
+
|
|
190
195
|
cancel(): void {
|
|
191
196
|
this.reject(new CancelledFailure('Workflow cancelled'));
|
|
192
197
|
}
|
|
193
198
|
}
|
|
194
199
|
|
|
195
|
-
/** There can only be one of these */
|
|
196
|
-
export const ROOT_SCOPE = new RootCancellationScope({ cancellable: true, parent: NO_PARENT });
|
|
197
|
-
|
|
198
200
|
/** This function is here to avoid a circular dependency between this module and workflow.ts */
|
|
199
201
|
let sleep = (_: number | string): Promise<void> => {
|
|
200
202
|
throw new IllegalStateError('Workflow has not been properly initialized');
|
package/src/errors.ts
CHANGED
package/src/index.ts
CHANGED
|
@@ -49,8 +49,6 @@
|
|
|
49
49
|
export {
|
|
50
50
|
ActivityCancellationType,
|
|
51
51
|
ActivityFailure,
|
|
52
|
-
ActivityFunction,
|
|
53
|
-
ActivityInterface,
|
|
54
52
|
ActivityOptions,
|
|
55
53
|
ApplicationFailure,
|
|
56
54
|
CancelledFailure,
|
|
@@ -63,13 +61,26 @@ export {
|
|
|
63
61
|
TemporalFailure,
|
|
64
62
|
TerminatedFailure,
|
|
65
63
|
TimeoutFailure,
|
|
66
|
-
UntypedActivities,
|
|
67
64
|
} from '@temporalio/common';
|
|
68
65
|
export * from '@temporalio/common/lib/errors';
|
|
69
|
-
export
|
|
66
|
+
export {
|
|
67
|
+
ActivityFunction,
|
|
68
|
+
ActivityInterface, // eslint-disable-line deprecation/deprecation
|
|
69
|
+
Payload,
|
|
70
|
+
QueryDefinition,
|
|
71
|
+
SearchAttributes,
|
|
72
|
+
SearchAttributeValue,
|
|
73
|
+
SignalDefinition,
|
|
74
|
+
UntypedActivities,
|
|
75
|
+
Workflow,
|
|
76
|
+
WorkflowQueryType,
|
|
77
|
+
WorkflowResultType,
|
|
78
|
+
WorkflowReturnType,
|
|
79
|
+
WorkflowSignalType,
|
|
80
|
+
} from '@temporalio/common/lib/interfaces';
|
|
70
81
|
export * from '@temporalio/common/lib/workflow-handle';
|
|
71
82
|
export * from '@temporalio/common/lib/workflow-options';
|
|
72
|
-
export { AsyncLocalStorage, CancellationScope, CancellationScopeOptions
|
|
83
|
+
export { AsyncLocalStorage, CancellationScope, CancellationScopeOptions } from './cancellation-scope';
|
|
73
84
|
export * from './errors';
|
|
74
85
|
export * from './interceptors';
|
|
75
86
|
export {
|
package/src/interceptors.ts
CHANGED
|
@@ -206,7 +206,7 @@ export interface WorkflowInternalsInterceptor {
|
|
|
206
206
|
*
|
|
207
207
|
* Implement this method to perform any resource cleanup.
|
|
208
208
|
*/
|
|
209
|
-
dispose?(input: DisposeInput, next: Next<this, 'dispose'>):
|
|
209
|
+
dispose?(input: DisposeInput, next: Next<this, 'dispose'>): void;
|
|
210
210
|
}
|
|
211
211
|
|
|
212
212
|
/**
|
package/src/interfaces.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { CommonWorkflowOptions, SearchAttributes } from '@temporalio/common';
|
|
1
|
+
import type { RawSourceMap } from 'source-map';
|
|
2
|
+
import { RetryPolicy, TemporalFailure, CommonWorkflowOptions, SearchAttributes } from '@temporalio/common';
|
|
3
3
|
import { checkExtends } from '@temporalio/common/lib/type-helpers';
|
|
4
4
|
import type { coresdk } from '@temporalio/proto';
|
|
5
5
|
|
|
@@ -189,7 +189,7 @@ export interface ContinueAsNewOptions {
|
|
|
189
189
|
/**
|
|
190
190
|
* Non-searchable attributes to attach to next Workflow run
|
|
191
191
|
*/
|
|
192
|
-
memo?: Record<string,
|
|
192
|
+
memo?: Record<string, unknown>;
|
|
193
193
|
/**
|
|
194
194
|
* Searchable attributes to attach to next Workflow run
|
|
195
195
|
*/
|
|
@@ -364,3 +364,15 @@ export interface EnhancedStackTrace {
|
|
|
364
364
|
sources: Record<string, FileSlice[]>;
|
|
365
365
|
stacks: StackTrace[];
|
|
366
366
|
}
|
|
367
|
+
|
|
368
|
+
export interface WorkflowCreateOptions {
|
|
369
|
+
info: WorkflowInfo;
|
|
370
|
+
randomnessSeed: number[];
|
|
371
|
+
now: number;
|
|
372
|
+
patches: string[];
|
|
373
|
+
showStackTraceSources: boolean;
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
export interface WorkflowCreateOptionsWithSourceMap extends WorkflowCreateOptions {
|
|
377
|
+
sourceMap: RawSourceMap;
|
|
378
|
+
}
|