@temporalio/nexus 1.14.1 → 1.15.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/context.d.ts +23 -0
- package/lib/context.js +15 -0
- package/lib/context.js.map +1 -1
- package/lib/index.d.ts +1 -1
- package/lib/index.js +2 -1
- package/lib/index.js.map +1 -1
- package/lib/token.d.ts +3 -4
- package/lib/token.js.map +1 -1
- package/package.json +8 -9
- package/src/context.ts +32 -0
- package/src/index.ts +2 -0
- package/src/token.ts +3 -5
package/lib/context.d.ts
CHANGED
|
@@ -16,6 +16,21 @@ export interface HandlerContext {
|
|
|
16
16
|
namespace: string;
|
|
17
17
|
taskQueue: string;
|
|
18
18
|
}
|
|
19
|
+
/**
|
|
20
|
+
* Holds information about the current Nexus Operation Execution.
|
|
21
|
+
*
|
|
22
|
+
* @experimental Nexus support in Temporal SDK is experimental.
|
|
23
|
+
*/
|
|
24
|
+
export interface OperationInfo {
|
|
25
|
+
/**
|
|
26
|
+
* Namespace this Nexus Operation is executing in
|
|
27
|
+
*/
|
|
28
|
+
readonly namespace: string;
|
|
29
|
+
/**
|
|
30
|
+
* Task Queue this Nexus Operation is executing on
|
|
31
|
+
*/
|
|
32
|
+
readonly taskQueue: string;
|
|
33
|
+
}
|
|
19
34
|
/**
|
|
20
35
|
* A logger for use in Nexus Handler scope.
|
|
21
36
|
*
|
|
@@ -46,3 +61,11 @@ export declare const metricMeter: MetricMeter;
|
|
|
46
61
|
* @experimental Nexus support in Temporal SDK is experimental.
|
|
47
62
|
*/
|
|
48
63
|
export declare function getClient(): Client;
|
|
64
|
+
/**
|
|
65
|
+
* Get information about the current Nexus Operation.
|
|
66
|
+
*
|
|
67
|
+
* @return OperationInfo for the current Nexus Operation being executed
|
|
68
|
+
*
|
|
69
|
+
* @experimental Nexus support in Temporal SDK is experimental.
|
|
70
|
+
*/
|
|
71
|
+
export declare function operationInfo(): OperationInfo;
|
package/lib/context.js
CHANGED
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.metricMeter = exports.log = exports.asyncLocalStorage = void 0;
|
|
4
4
|
exports.getHandlerContext = getHandlerContext;
|
|
5
5
|
exports.getClient = getClient;
|
|
6
|
+
exports.operationInfo = operationInfo;
|
|
6
7
|
const node_async_hooks_1 = require("node:async_hooks");
|
|
7
8
|
// Context Storage /////////////////////////////////////////////////////////////////////////////////
|
|
8
9
|
// Make it safe to use @temporalio/nexus with multiple versions installed.
|
|
@@ -83,4 +84,18 @@ exports.metricMeter = {
|
|
|
83
84
|
function getClient() {
|
|
84
85
|
return getHandlerContext().client;
|
|
85
86
|
}
|
|
87
|
+
/**
|
|
88
|
+
* Get information about the current Nexus Operation.
|
|
89
|
+
*
|
|
90
|
+
* @return OperationInfo for the current Nexus Operation being executed
|
|
91
|
+
*
|
|
92
|
+
* @experimental Nexus support in Temporal SDK is experimental.
|
|
93
|
+
*/
|
|
94
|
+
function operationInfo() {
|
|
95
|
+
const ctx = getHandlerContext();
|
|
96
|
+
return {
|
|
97
|
+
namespace: ctx.namespace,
|
|
98
|
+
taskQueue: ctx.taskQueue,
|
|
99
|
+
};
|
|
100
|
+
}
|
|
86
101
|
//# sourceMappingURL=context.js.map
|
package/lib/context.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context.js","sourceRoot":"","sources":["../src/context.ts"],"names":[],"mappings":";;;AAaA,8CAMC;
|
|
1
|
+
{"version":3,"file":"context.js","sourceRoot":"","sources":["../src/context.ts"],"names":[],"mappings":";;;AAaA,8CAMC;AAkGD,8BAEC;AASD,sCAMC;AAtID,uDAAqD;AAIrD,oGAAoG;AAEpG,0EAA0E;AAC1E,MAAM,uBAAuB,GAAG,MAAM,CAAC,GAAG,CAAC,oCAAoC,CAAC,CAAC;AACjF,IAAI,CAAE,UAAkB,CAAC,uBAAuB,CAAC,EAAE,CAAC;IACjD,UAAkB,CAAC,uBAAuB,CAAC,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CAAC;AAEF;;;;;;;GAOG;AACU,QAAA,WAAW,GAAgB;IACtC,aAAa,CAAC,IAAI,EAAE,IAAI,EAAE,WAAW;QACnC,OAAO,iBAAiB,EAAE,CAAC,OAAO,CAAC,aAAa,CAAC,IAAI,EAAE,IAAI,EAAE,WAAW,CAAC,CAAC;IAC5E,CAAC;IACD,eAAe,CAAC,IAAI,EAAE,SAAS,GAAG,KAAK,EAAE,IAAI,EAAE,WAAW;QACxD,OAAO,iBAAiB,EAAE,CAAC,OAAO,CAAC,eAAe,CAAC,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,WAAW,CAAC,CAAC;IACzF,CAAC;IACD,WAAW,CAAC,IAAI,EAAE,SAAS,GAAG,KAAK,EAAE,IAAI,EAAE,WAAW;QACpD,OAAO,iBAAiB,EAAE,CAAC,OAAO,CAAC,WAAW,CAAC,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,WAAW,CAAC,CAAC;IACrF,CAAC;IACD,QAAQ,CAAC,IAAI;QACX,OAAO,iBAAiB,EAAE,CAAC,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;IACpD,CAAC;CACF,CAAC;AAEF;;;;;GAKG;AACH,SAAgB,SAAS;IACvB,OAAO,iBAAiB,EAAE,CAAC,MAAM,CAAC;AACpC,CAAC;AAED;;;;;;GAMG;AACH,SAAgB,aAAa;IAC3B,MAAM,GAAG,GAAG,iBAAiB,EAAE,CAAC;IAChC,OAAO;QACL,SAAS,EAAE,GAAG,CAAC,SAAS;QACxB,SAAS,EAAE,GAAG,CAAC,SAAS;KACzB,CAAC;AACJ,CAAC"}
|
package/lib/index.d.ts
CHANGED
|
@@ -3,5 +3,5 @@
|
|
|
3
3
|
*
|
|
4
4
|
* @module
|
|
5
5
|
*/
|
|
6
|
-
export { log, getClient, metricMeter, } from './context';
|
|
6
|
+
export { log, getClient, metricMeter, operationInfo, type OperationInfo, } from './context';
|
|
7
7
|
export { startWorkflow, WorkflowHandle, WorkflowRunOperationHandler, WorkflowRunOperationStartHandler, WorkflowStartOptions, } from './workflow-helpers';
|
package/lib/index.js
CHANGED
|
@@ -5,12 +5,13 @@
|
|
|
5
5
|
* @module
|
|
6
6
|
*/
|
|
7
7
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
-
exports.WorkflowRunOperationHandler = exports.startWorkflow = exports.metricMeter = exports.getClient = exports.log = void 0;
|
|
8
|
+
exports.WorkflowRunOperationHandler = exports.startWorkflow = exports.operationInfo = exports.metricMeter = exports.getClient = exports.log = void 0;
|
|
9
9
|
var context_1 = require("./context");
|
|
10
10
|
//
|
|
11
11
|
Object.defineProperty(exports, "log", { enumerable: true, get: function () { return context_1.log; } });
|
|
12
12
|
Object.defineProperty(exports, "getClient", { enumerable: true, get: function () { return context_1.getClient; } });
|
|
13
13
|
Object.defineProperty(exports, "metricMeter", { enumerable: true, get: function () { return context_1.metricMeter; } });
|
|
14
|
+
Object.defineProperty(exports, "operationInfo", { enumerable: true, get: function () { return context_1.operationInfo; } });
|
|
14
15
|
var workflow_helpers_1 = require("./workflow-helpers");
|
|
15
16
|
Object.defineProperty(exports, "startWorkflow", { enumerable: true, get: function () { return workflow_helpers_1.startWorkflow; } });
|
|
16
17
|
Object.defineProperty(exports, "WorkflowRunOperationHandler", { enumerable: true, get: function () { return workflow_helpers_1.WorkflowRunOperationHandler; } });
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;AAEH,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;AAEH,qCAOmB;AANjB,EAAE;AACF,8FAAA,GAAG,OAAA;AACH,oGAAA,SAAS,OAAA;AACT,sGAAA,WAAW,OAAA;AACX,wGAAA,aAAa,OAAA;AAIf,uDAM4B;AAL1B,iHAAA,aAAa,OAAA;AAEb,+HAAA,2BAA2B,OAAA"}
|
package/lib/token.d.ts
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
|
+
* OperationTokenType is used to identify the type of Operation token.
|
|
3
|
+
* Currently, we only have one type of Operation token: WorkflowRun.
|
|
4
|
+
*
|
|
2
5
|
* @internal
|
|
3
6
|
* @hidden
|
|
4
7
|
*/
|
|
@@ -21,10 +24,6 @@ export interface WorkflowRunOperationToken {
|
|
|
21
24
|
*/
|
|
22
25
|
wid: string;
|
|
23
26
|
}
|
|
24
|
-
/**
|
|
25
|
-
* OperationTokenType is used to identify the type of Operation token.
|
|
26
|
-
* Currently, we only have one type of Operation token: WorkflowRun.
|
|
27
|
-
*/
|
|
28
27
|
type OperationTokenType = (typeof OperationTokenType)[keyof typeof OperationTokenType];
|
|
29
28
|
/**
|
|
30
29
|
* @internal
|
package/lib/token.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"token.js","sourceRoot":"","sources":["../src/token.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"token.js","sourceRoot":"","sources":["../src/token.ts"],"names":[],"mappings":";;AA0CA,8EAOC;AAKD,sEA8BC;AAGD,4DAGC;AA3DD;;;GAGG;AACH,MAAM,kBAAkB,GAAG;IACzB,YAAY,EAAE,CAAC;CACP,CAAC;AAEX;;GAEG;AACH,SAAgB,iCAAiC,CAAC,SAAiB,EAAE,UAAkB;IACrF,MAAM,KAAK,GAA8B;QACvC,CAAC,EAAE,kBAAkB,CAAC,YAAY;QAClC,EAAE,EAAE,SAAS;QACb,GAAG,EAAE,UAAU;KAChB,CAAC;IACF,OAAO,wBAAwB,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC;AACzD,CAAC;AAED;;GAEG;AACH,SAAgB,6BAA6B,CAAC,IAAY;IACxD,IAAI,CAAC,IAAI,EAAE,CAAC;QACV,MAAM,IAAI,SAAS,CAAC,4CAA4C,CAAC,CAAC;I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;IAC/D,IAAI,CAAC,kBAAkB,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC;QAClC,MAAM,IAAI,SAAS,CAAC,+DAA+D,CAAC,CAAC;IACvF,CAAC;IAED,MAAM,aAAa,GAAG,GAAG,CAAC,MAAM,GAAG,CAAC,CAAC;IACrC,IAAI,aAAa,GAAG,CAAC,EAAE,CAAC;QACtB,GAAG,IAAI,GAAG,CAAC,MAAM,CAAC,CAAC,GAAG,aAAa,CAAC,CAAC;IACvC,CAAC;IAED,OAAO,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE,WAAW,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;AACzD,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@temporalio/nexus",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.15.0",
|
|
4
4
|
"description": "Temporal.io SDK Nexus sub-package",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"types": "./lib/index.d.ts",
|
|
@@ -13,11 +13,11 @@
|
|
|
13
13
|
"author": "Temporal Technologies Inc. <sdk@temporal.io>",
|
|
14
14
|
"license": "MIT",
|
|
15
15
|
"dependencies": {
|
|
16
|
-
"@temporalio/client": "1.14.1",
|
|
17
|
-
"@temporalio/common": "1.14.1",
|
|
18
|
-
"@temporalio/proto": "1.14.1",
|
|
19
16
|
"long": "^5.2.3",
|
|
20
|
-
"nexus-rpc": "^0.0.1"
|
|
17
|
+
"nexus-rpc": "^0.0.1",
|
|
18
|
+
"@temporalio/client": "1.15.0",
|
|
19
|
+
"@temporalio/proto": "1.15.0",
|
|
20
|
+
"@temporalio/common": "1.15.0"
|
|
21
21
|
},
|
|
22
22
|
"bugs": {
|
|
23
23
|
"url": "https://github.com/temporalio/sdk-typescript/issues"
|
|
@@ -32,11 +32,10 @@
|
|
|
32
32
|
"access": "public"
|
|
33
33
|
},
|
|
34
34
|
"engines": {
|
|
35
|
-
"node": ">=
|
|
35
|
+
"node": ">= 20.0.0"
|
|
36
36
|
},
|
|
37
37
|
"files": [
|
|
38
38
|
"src",
|
|
39
39
|
"lib"
|
|
40
|
-
]
|
|
41
|
-
|
|
42
|
-
}
|
|
40
|
+
]
|
|
41
|
+
}
|
package/src/context.ts
CHANGED
|
@@ -33,6 +33,23 @@ export interface HandlerContext {
|
|
|
33
33
|
taskQueue: string;
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
+
/**
|
|
37
|
+
* Holds information about the current Nexus Operation Execution.
|
|
38
|
+
*
|
|
39
|
+
* @experimental Nexus support in Temporal SDK is experimental.
|
|
40
|
+
*/
|
|
41
|
+
export interface OperationInfo {
|
|
42
|
+
/**
|
|
43
|
+
* Namespace this Nexus Operation is executing in
|
|
44
|
+
*/
|
|
45
|
+
readonly namespace: string;
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Task Queue this Nexus Operation is executing on
|
|
49
|
+
*/
|
|
50
|
+
readonly taskQueue: string;
|
|
51
|
+
}
|
|
52
|
+
|
|
36
53
|
// Basic APIs //////////////////////////////////////////////////////////////////////////////////////
|
|
37
54
|
|
|
38
55
|
/**
|
|
@@ -101,3 +118,18 @@ export const metricMeter: MetricMeter = {
|
|
|
101
118
|
export function getClient(): Client {
|
|
102
119
|
return getHandlerContext().client;
|
|
103
120
|
}
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
* Get information about the current Nexus Operation.
|
|
124
|
+
*
|
|
125
|
+
* @return OperationInfo for the current Nexus Operation being executed
|
|
126
|
+
*
|
|
127
|
+
* @experimental Nexus support in Temporal SDK is experimental.
|
|
128
|
+
*/
|
|
129
|
+
export function operationInfo(): OperationInfo {
|
|
130
|
+
const ctx = getHandlerContext();
|
|
131
|
+
return {
|
|
132
|
+
namespace: ctx.namespace,
|
|
133
|
+
taskQueue: ctx.taskQueue,
|
|
134
|
+
};
|
|
135
|
+
}
|
package/src/index.ts
CHANGED
package/src/token.ts
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
|
+
* OperationTokenType is used to identify the type of Operation token.
|
|
3
|
+
* Currently, we only have one type of Operation token: WorkflowRun.
|
|
4
|
+
*
|
|
2
5
|
* @internal
|
|
3
6
|
* @hidden
|
|
4
7
|
*/
|
|
@@ -24,11 +27,6 @@ export interface WorkflowRunOperationToken {
|
|
|
24
27
|
*/
|
|
25
28
|
wid: string;
|
|
26
29
|
}
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* OperationTokenType is used to identify the type of Operation token.
|
|
30
|
-
* Currently, we only have one type of Operation token: WorkflowRun.
|
|
31
|
-
*/
|
|
32
30
|
type OperationTokenType = (typeof OperationTokenType)[keyof typeof OperationTokenType];
|
|
33
31
|
|
|
34
32
|
/**
|