@temporalio/workflow 0.14.0 → 0.16.4
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 +7 -0
- package/lib/cancellation-scope.js +11 -5
- package/lib/cancellation-scope.js.map +1 -1
- package/lib/index.d.ts +4 -6
- package/lib/index.js +4 -6
- package/lib/index.js.map +1 -1
- package/lib/interceptors.d.ts +10 -1
- package/lib/interfaces.d.ts +26 -7
- package/lib/interfaces.js +17 -3
- package/lib/interfaces.js.map +1 -1
- package/lib/internals.d.ts +4 -5
- package/lib/internals.js +13 -35
- package/lib/internals.js.map +1 -1
- package/lib/sinks.d.ts +37 -0
- package/lib/sinks.js +18 -0
- package/lib/sinks.js.map +1 -0
- package/lib/worker-interface.d.ts +14 -7
- package/lib/worker-interface.js +24 -16
- package/lib/worker-interface.js.map +1 -1
- package/lib/workflow.d.ts +10 -7
- package/lib/workflow.js +27 -17
- package/lib/workflow.js.map +1 -1
- package/package.json +4 -4
- package/lib/async-local-storage.d.ts +0 -56
- package/lib/async-local-storage.js +0 -95
- package/lib/async-local-storage.js.map +0 -1
- package/lib/dependencies.d.ts +0 -32
- package/lib/dependencies.js +0 -14
- package/lib/dependencies.js.map +0 -1
- package/lib/promise-hooks.d.ts +0 -54
- package/lib/promise-hooks.js +0 -74
- package/lib/promise-hooks.js.map +0 -1
package/lib/promise-hooks.d.ts
DELETED
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
/** v8 hook types */
|
|
2
|
-
export declare type HookType = 'init' | 'resolve' | 'before' | 'after';
|
|
3
|
-
/** Type of the PromiseHook callback */
|
|
4
|
-
export declare type PromiseHook = (t: HookType, p: Promise<any>, pp?: Promise<any>) => void;
|
|
5
|
-
/**
|
|
6
|
-
* Interface for the native (c++) isolate extension, exposes method for working with the v8 Promise hook and custom Promise data
|
|
7
|
-
*/
|
|
8
|
-
export interface IsolateExtension {
|
|
9
|
-
registerPromiseHook(hook: PromiseHook): void;
|
|
10
|
-
/** Associate a Promise with each hook's custom data */
|
|
11
|
-
setPromiseData(p: Promise<any>, s: Map<PromiseHook, any>): void;
|
|
12
|
-
/** Get the custom hook data associated with a Promise */
|
|
13
|
-
getPromiseData(p: Promise<any>): Map<PromiseHook, any> | undefined;
|
|
14
|
-
}
|
|
15
|
-
/**
|
|
16
|
-
* Uses the v8 PromiseHook callback to track the current `CancellationScope`
|
|
17
|
-
*/
|
|
18
|
-
export declare class HookManager {
|
|
19
|
-
protected readonly registeredHooks: Set<PromiseHook>;
|
|
20
|
-
/**
|
|
21
|
-
* A reference to the native isolate extension, lazily initialized along with the Workflow
|
|
22
|
-
*/
|
|
23
|
-
protected isolateExtension?: IsolateExtension;
|
|
24
|
-
protected constructor();
|
|
25
|
-
static instance: HookManager;
|
|
26
|
-
/**
|
|
27
|
-
* To be called from the Workflow runtime library to set the native module reference
|
|
28
|
-
*/
|
|
29
|
-
setIsolateExtension(isolateExtension: IsolateExtension): void;
|
|
30
|
-
/**
|
|
31
|
-
* Helper that ensures isolateExtension has been set
|
|
32
|
-
*/
|
|
33
|
-
getIsolateExtension(): IsolateExtension;
|
|
34
|
-
/**
|
|
35
|
-
* Register a single promise hook callback
|
|
36
|
-
*/
|
|
37
|
-
register(hook: PromiseHook): void;
|
|
38
|
-
/**
|
|
39
|
-
* Deregister a single promise hook callback
|
|
40
|
-
*/
|
|
41
|
-
deregister(hook: PromiseHook): void;
|
|
42
|
-
/**
|
|
43
|
-
* The PromiseHook implementation, calls all registered hooks
|
|
44
|
-
*/
|
|
45
|
-
protected hook(t: HookType, p: Promise<any>, pp?: Promise<any>): void;
|
|
46
|
-
/**
|
|
47
|
-
* Get custom promise data for a promise hook
|
|
48
|
-
*/
|
|
49
|
-
getPromiseData(p: Promise<any>, hook: PromiseHook): unknown;
|
|
50
|
-
/**
|
|
51
|
-
* Set custom promise data for a promise hook
|
|
52
|
-
*/
|
|
53
|
-
setPromiseData(p: Promise<any>, hook: PromiseHook, data: unknown): void;
|
|
54
|
-
}
|
package/lib/promise-hooks.js
DELETED
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.HookManager = void 0;
|
|
4
|
-
const common_1 = require("@temporalio/common");
|
|
5
|
-
/**
|
|
6
|
-
* Uses the v8 PromiseHook callback to track the current `CancellationScope`
|
|
7
|
-
*/
|
|
8
|
-
class HookManager {
|
|
9
|
-
constructor() {
|
|
10
|
-
this.registeredHooks = new Set();
|
|
11
|
-
// Prevent construction other than the singleton
|
|
12
|
-
}
|
|
13
|
-
/**
|
|
14
|
-
* To be called from the Workflow runtime library to set the native module reference
|
|
15
|
-
*/
|
|
16
|
-
setIsolateExtension(isolateExtension) {
|
|
17
|
-
this.isolateExtension = isolateExtension;
|
|
18
|
-
isolateExtension.registerPromiseHook(this.hook.bind(this));
|
|
19
|
-
}
|
|
20
|
-
/**
|
|
21
|
-
* Helper that ensures isolateExtension has been set
|
|
22
|
-
*/
|
|
23
|
-
getIsolateExtension() {
|
|
24
|
-
if (this.isolateExtension === undefined) {
|
|
25
|
-
throw new common_1.IllegalStateError('HookManager has not been properly initialized');
|
|
26
|
-
}
|
|
27
|
-
return this.isolateExtension;
|
|
28
|
-
}
|
|
29
|
-
/**
|
|
30
|
-
* Register a single promise hook callback
|
|
31
|
-
*/
|
|
32
|
-
register(hook) {
|
|
33
|
-
this.registeredHooks.add(hook);
|
|
34
|
-
}
|
|
35
|
-
/**
|
|
36
|
-
* Deregister a single promise hook callback
|
|
37
|
-
*/
|
|
38
|
-
deregister(hook) {
|
|
39
|
-
this.registeredHooks.delete(hook);
|
|
40
|
-
}
|
|
41
|
-
/**
|
|
42
|
-
* The PromiseHook implementation, calls all registered hooks
|
|
43
|
-
*/
|
|
44
|
-
hook(t, p, pp) {
|
|
45
|
-
for (const hook of this.registeredHooks) {
|
|
46
|
-
hook(t, p, pp);
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
/**
|
|
50
|
-
* Get custom promise data for a promise hook
|
|
51
|
-
*/
|
|
52
|
-
getPromiseData(p, hook) {
|
|
53
|
-
const data = this.getIsolateExtension().getPromiseData(p);
|
|
54
|
-
if (data) {
|
|
55
|
-
return data.get(hook);
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
/**
|
|
59
|
-
* Set custom promise data for a promise hook
|
|
60
|
-
*/
|
|
61
|
-
setPromiseData(p, hook, data) {
|
|
62
|
-
const isolateExtension = this.getIsolateExtension();
|
|
63
|
-
let mapping = isolateExtension.getPromiseData(p);
|
|
64
|
-
if (!mapping) {
|
|
65
|
-
mapping = new Map();
|
|
66
|
-
isolateExtension.setPromiseData(p, mapping);
|
|
67
|
-
}
|
|
68
|
-
mapping.set(hook, data);
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
exports.HookManager = HookManager;
|
|
72
|
-
// Singleton instance
|
|
73
|
-
HookManager.instance = new HookManager();
|
|
74
|
-
//# sourceMappingURL=promise-hooks.js.map
|
package/lib/promise-hooks.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"promise-hooks.js","sourceRoot":"","sources":["../src/promise-hooks.ts"],"names":[],"mappings":";;;AAAA,+CAAuD;AAkBvD;;GAEG;AACH,MAAa,WAAW;IAOtB;QANmB,oBAAe,GAAG,IAAI,GAAG,EAAe,CAAC;QAO1D,gDAAgD;IAClD,CAAC;IAKD;;OAEG;IACH,mBAAmB,CAAC,gBAAkC;QACpD,IAAI,CAAC,gBAAgB,GAAG,gBAAgB,CAAC;QACzC,gBAAgB,CAAC,mBAAmB,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;IAC7D,CAAC;IAED;;OAEG;IACH,mBAAmB;QACjB,IAAI,IAAI,CAAC,gBAAgB,KAAK,SAAS,EAAE;YACvC,MAAM,IAAI,0BAAiB,CAAC,+CAA+C,CAAC,CAAC;SAC9E;Q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