@temporalio/nexus 1.17.3 → 1.18.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 +1 -0
- package/lib/context.js.map +1 -1
- package/lib/index.d.ts +2 -2
- package/lib/index.js +3 -1
- package/lib/index.js.map +1 -1
- package/lib/link-converter.d.ts +5 -0
- package/lib/link-converter.js +62 -3
- package/lib/link-converter.js.map +1 -1
- package/lib/token.d.ts +32 -9
- package/lib/token.js +42 -11
- package/lib/token.js.map +1 -1
- package/lib/workflow-helpers.d.ts +78 -1
- package/lib/workflow-helpers.js +114 -9
- package/lib/workflow-helpers.js.map +1 -1
- package/package.json +4 -4
package/lib/context.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { AsyncLocalStorage } from 'node:async_hooks';
|
|
2
|
+
import type * as nexus from 'nexus-rpc';
|
|
2
3
|
import type { Logger, MetricMeter } from '@temporalio/common';
|
|
3
4
|
import type { Client } from '@temporalio/client';
|
|
4
5
|
export declare const asyncLocalStorage: AsyncLocalStorage<HandlerContext>;
|
|
@@ -15,6 +16,7 @@ export interface HandlerContext {
|
|
|
15
16
|
client: Client;
|
|
16
17
|
namespace: string;
|
|
17
18
|
taskQueue: string;
|
|
19
|
+
endpoint: string;
|
|
18
20
|
}
|
|
19
21
|
/**
|
|
20
22
|
* Holds information about the current Nexus Operation Execution.
|
|
@@ -30,6 +32,27 @@ export interface OperationInfo {
|
|
|
30
32
|
* Task Queue this Nexus Operation is executing on
|
|
31
33
|
*/
|
|
32
34
|
readonly taskQueue: string;
|
|
35
|
+
/**
|
|
36
|
+
* Nexus Endpoint this Operation was routed through.
|
|
37
|
+
* Only available with server version 1.30.0 or later.
|
|
38
|
+
*/
|
|
39
|
+
readonly endpoint: string;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Context received by a {@link TemporalOperationHandler}'s start handler when a Nexus Operation is
|
|
43
|
+
* started.
|
|
44
|
+
*
|
|
45
|
+
* @experimental Nexus support in Temporal SDK is experimental.
|
|
46
|
+
*/
|
|
47
|
+
export interface TemporalStartOperationContext extends nexus.StartOperationContext {
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Context received by a {@link TemporalOperationHandler}'s cancel handler when a Nexus Operation is
|
|
51
|
+
* canceled.
|
|
52
|
+
*
|
|
53
|
+
* @experimental Nexus support in Temporal SDK is experimental.
|
|
54
|
+
*/
|
|
55
|
+
export interface TemporalCancelOperationContext extends nexus.CancelOperationContext {
|
|
33
56
|
}
|
|
34
57
|
/**
|
|
35
58
|
* A logger for use in Nexus Handler scope.
|
package/lib/context.js
CHANGED
package/lib/context.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context.js","sourceRoot":"","sources":["../src/context.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"context.js","sourceRoot":"","sources":["../src/context.ts"],"names":[],"mappings":";;;AAcA,8CAMC;AA2HD,8BAEC;AASD,sCAOC;AAjKD,uDAAqD;AAKrD,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,GAAG,IAAI,oCAAiB,EAAkB,CAAC;AACzF,CAAC;AACY,QAAA,iBAAiB,GAAuC,UAAkB,CAAC,uBAAuB,CAAC,CAAC;AAEjH,SAAgB,iBAAiB;IAC/B,MAAM,GAAG,GAAG,yBAAiB,CAAC,QAAQ,EAAE,CAAC;IACzC,IAAI,GAAG,IAAI,IAAI,EAAE,CAAC;QAChB,MAAM,IAAI,cAAc,CAAC,gCAAgC,CAAC,CAAC;IAC7D,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC;AA0DD,oGAAoG;AAEpG;;;;;;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AAE,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;QACxB,QAAQ,EAAE,GAAG,CAAC,QAAQ;KACvB,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, operationInfo, type OperationInfo, } from './context';
|
|
7
|
-
export { startWorkflow, WorkflowHandle, WorkflowRunOperationHandler, WorkflowRunOperationStartHandler, WorkflowStartOptions, } from './workflow-helpers';
|
|
6
|
+
export { log, getClient, metricMeter, operationInfo, type OperationInfo, type TemporalCancelOperationContext, type TemporalStartOperationContext, } from './context';
|
|
7
|
+
export { startWorkflow, type CancelWorkflowRunOptions, type TemporalOperationHandlerOptions, TemporalOperationHandler, TemporalOperationResult, type TemporalNexusClient, type TemporalOperationStartHandler, WorkflowHandle, WorkflowRunOperationHandler, WorkflowRunOperationStartHandler, WorkflowStartOptions, } from './workflow-helpers';
|
package/lib/index.js
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* @module
|
|
6
6
|
*/
|
|
7
7
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
-
exports.WorkflowRunOperationHandler = exports.startWorkflow = exports.operationInfo = exports.metricMeter = exports.getClient = exports.log = void 0;
|
|
8
|
+
exports.WorkflowRunOperationHandler = exports.TemporalOperationResult = exports.TemporalOperationHandler = 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; } });
|
|
@@ -14,5 +14,7 @@ Object.defineProperty(exports, "metricMeter", { enumerable: true, get: function
|
|
|
14
14
|
Object.defineProperty(exports, "operationInfo", { enumerable: true, get: function () { return context_1.operationInfo; } });
|
|
15
15
|
var workflow_helpers_1 = require("./workflow-helpers");
|
|
16
16
|
Object.defineProperty(exports, "startWorkflow", { enumerable: true, get: function () { return workflow_helpers_1.startWorkflow; } });
|
|
17
|
+
Object.defineProperty(exports, "TemporalOperationHandler", { enumerable: true, get: function () { return workflow_helpers_1.TemporalOperationHandler; } });
|
|
18
|
+
Object.defineProperty(exports, "TemporalOperationResult", { enumerable: true, get: function () { return workflow_helpers_1.TemporalOperationResult; } });
|
|
17
19
|
Object.defineProperty(exports, "WorkflowRunOperationHandler", { enumerable: true, get: function () { return workflow_helpers_1.WorkflowRunOperationHandler; } });
|
|
18
20
|
//# 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;;;;GAIG;;;AAEH,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;AAEH,qCASmB;AARjB,EAAE;AACF,8FAAA,GAAG,OAAA;AACH,oGAAA,SAAS,OAAA;AACT,sGAAA,WAAW,OAAA;AACX,wGAAA,aAAa,OAAA;AAMf,uDAY4B;AAX1B,iHAAA,aAAa,OAAA;AAGb,4HAAA,wBAAwB,OAAA;AACxB,2HAAA,uBAAuB,OAAA;AAIvB,+HAAA,2BAA2B,OAAA"}
|
package/lib/link-converter.d.ts
CHANGED
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
import type { Link as NexusLink } from 'nexus-rpc';
|
|
2
2
|
import { temporal } from '@temporalio/proto';
|
|
3
|
+
type TemporalLink = temporal.api.common.v1.ILink;
|
|
3
4
|
type WorkflowEventLink = temporal.api.common.v1.Link.IWorkflowEvent;
|
|
5
|
+
type NexusOperationLink = temporal.api.common.v1.Link.INexusOperation;
|
|
6
|
+
export declare function convertTemporalLinkToNexusLink(link: TemporalLink): NexusLink;
|
|
7
|
+
export declare function convertNexusLinkToTemporalLink(link: NexusLink): TemporalLink;
|
|
4
8
|
export declare function convertWorkflowEventLinkToNexusLink(we: WorkflowEventLink): NexusLink;
|
|
9
|
+
export declare function convertNexusOperationLinkToNexusLink(opLink: NexusOperationLink): NexusLink;
|
|
5
10
|
export declare function convertNexusLinkToWorkflowEventLink(link: NexusLink): WorkflowEventLink;
|
|
6
11
|
export {};
|
package/lib/link-converter.js
CHANGED
|
@@ -3,7 +3,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.convertTemporalLinkToNexusLink = convertTemporalLinkToNexusLink;
|
|
7
|
+
exports.convertNexusLinkToTemporalLink = convertNexusLinkToTemporalLink;
|
|
6
8
|
exports.convertWorkflowEventLinkToNexusLink = convertWorkflowEventLinkToNexusLink;
|
|
9
|
+
exports.convertNexusOperationLinkToNexusLink = convertNexusOperationLinkToNexusLink;
|
|
7
10
|
exports.convertNexusLinkToWorkflowEventLink = convertNexusLinkToWorkflowEventLink;
|
|
8
11
|
const long_1 = __importDefault(require("long"));
|
|
9
12
|
const proto_1 = require("@temporalio/proto");
|
|
@@ -12,10 +15,38 @@ const LINK_EVENT_ID_PARAM = 'eventID';
|
|
|
12
15
|
const LINK_EVENT_TYPE_PARAM = 'eventType';
|
|
13
16
|
const LINK_REQUEST_ID_PARAM = 'requestID';
|
|
14
17
|
const LINK_REFERENCE_TYPE_KEY = 'referenceType';
|
|
18
|
+
const LINK_RUN_ID_KEY = 'runID';
|
|
15
19
|
const EVENT_REFERENCE_TYPE = 'EventReference';
|
|
16
20
|
const REQUEST_ID_REFERENCE_TYPE = 'RequestIdReference';
|
|
17
21
|
// fullName isn't part of the generated typed unfortunately.
|
|
18
22
|
const WORKFLOW_EVENT_TYPE = proto_1.temporal.api.common.v1.Link.WorkflowEvent.fullName.slice(1);
|
|
23
|
+
const NEXUS_OPERATION_TYPE = proto_1.temporal.api.common.v1.Link.NexusOperation.fullName.slice(1);
|
|
24
|
+
function convertTemporalLinkToNexusLink(link) {
|
|
25
|
+
if (link.workflowEvent != null) {
|
|
26
|
+
return convertWorkflowEventLinkToNexusLink(link.workflowEvent);
|
|
27
|
+
}
|
|
28
|
+
if (link.nexusOperation != null) {
|
|
29
|
+
return convertNexusOperationLinkToNexusLink(link.nexusOperation);
|
|
30
|
+
}
|
|
31
|
+
throw new TypeError('Invalid Temporal link: unknown variant');
|
|
32
|
+
}
|
|
33
|
+
function convertNexusLinkToTemporalLink(link) {
|
|
34
|
+
if (link.url.protocol !== 'temporal:') {
|
|
35
|
+
throw new TypeError(`Invalid URL scheme: ${link.url}, expected 'temporal:', got '${link.url.protocol}'`);
|
|
36
|
+
}
|
|
37
|
+
switch (link.type) {
|
|
38
|
+
case WORKFLOW_EVENT_TYPE:
|
|
39
|
+
return {
|
|
40
|
+
workflowEvent: convertNexusLinkToWorkflowEventLink(link),
|
|
41
|
+
};
|
|
42
|
+
case NEXUS_OPERATION_TYPE:
|
|
43
|
+
return {
|
|
44
|
+
nexusOperation: convertNexusLinkToNexusOperationLink(link),
|
|
45
|
+
};
|
|
46
|
+
default:
|
|
47
|
+
throw new TypeError(`Unknown link type: ${link.type}`);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
19
50
|
function convertWorkflowEventLinkToNexusLink(we) {
|
|
20
51
|
if (!we.namespace || !we.workflowId || !we.runId) {
|
|
21
52
|
throw new TypeError('Missing required fields: namespace, workflowId, or runId');
|
|
@@ -32,10 +63,22 @@ function convertWorkflowEventLinkToNexusLink(we) {
|
|
|
32
63
|
type: WORKFLOW_EVENT_TYPE,
|
|
33
64
|
};
|
|
34
65
|
}
|
|
35
|
-
function
|
|
36
|
-
if (
|
|
37
|
-
throw new TypeError(
|
|
66
|
+
function convertNexusOperationLinkToNexusLink(opLink) {
|
|
67
|
+
if (!opLink.namespace || !opLink.operationId) {
|
|
68
|
+
throw new TypeError('Missing required fields: namespace, or operationId');
|
|
69
|
+
}
|
|
70
|
+
const url = new URL(`temporal:///namespaces/${encodeURIComponent(opLink.namespace)}/nexus-operations/${encodeURIComponent(opLink.operationId)}`);
|
|
71
|
+
if (opLink.runId != null) {
|
|
72
|
+
const searchParams = new URLSearchParams();
|
|
73
|
+
searchParams.set(LINK_RUN_ID_KEY, opLink.runId);
|
|
74
|
+
url.search = searchParams.toString();
|
|
38
75
|
}
|
|
76
|
+
return {
|
|
77
|
+
url,
|
|
78
|
+
type: NEXUS_OPERATION_TYPE,
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
function convertNexusLinkToWorkflowEventLink(link) {
|
|
39
82
|
// /namespaces/:namespace/workflows/:workflowId/:runId/history
|
|
40
83
|
const parts = link.url.pathname.split('/');
|
|
41
84
|
if (parts.length !== 7 || parts[1] !== 'namespaces' || parts[3] !== 'workflows' || parts[6] !== 'history') {
|
|
@@ -63,6 +106,22 @@ function convertNexusLinkToWorkflowEventLink(link) {
|
|
|
63
106
|
}
|
|
64
107
|
return workflowEventLink;
|
|
65
108
|
}
|
|
109
|
+
function convertNexusLinkToNexusOperationLink(link) {
|
|
110
|
+
// /namespaces/:namespace/nexus-operations/:operationId?runId=:runId
|
|
111
|
+
const parts = link.url.pathname.split('/');
|
|
112
|
+
if (parts.length !== 5 || parts[1] !== 'namespaces' || parts[3] !== 'nexus-operations') {
|
|
113
|
+
throw new TypeError(`Invalid URL path: ${link.url}`);
|
|
114
|
+
}
|
|
115
|
+
const namespace = decodeURIComponent(parts[2]);
|
|
116
|
+
const operationId = decodeURIComponent(parts[4]);
|
|
117
|
+
const query = link.url.searchParams;
|
|
118
|
+
const runId = query.get(LINK_RUN_ID_KEY);
|
|
119
|
+
return {
|
|
120
|
+
namespace,
|
|
121
|
+
operationId,
|
|
122
|
+
runId,
|
|
123
|
+
};
|
|
124
|
+
}
|
|
66
125
|
function convertLinkWorkflowEventEventReferenceToURLQuery(eventRef) {
|
|
67
126
|
const params = new URLSearchParams();
|
|
68
127
|
params.set(LINK_REFERENCE_TYPE_KEY, EVENT_REFERENCE_TYPE);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"link-converter.js","sourceRoot":"","sources":["../src/link-converter.ts"],"names":[],"mappings":";;;;;
|
|
1
|
+
{"version":3,"file":"link-converter.js","sourceRoot":"","sources":["../src/link-converter.ts"],"names":[],"mappings":";;;;;AAwBA,wEAUC;AAED,wEAkBC;AAED,kFAoBC;AAED,oFAqBC;AAED,kFA8BC;AAnID,gDAAwB;AAExB,6CAA6C;AAE7C,MAAM,EAAE,SAAS,EAAE,GAAG,gBAAQ,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC;AAO5C,MAAM,mBAAmB,GAAG,SAAS,CAAC;AACtC,MAAM,qBAAqB,GAAG,WAAW,CAAC;AAC1C,MAAM,qBAAqB,GAAG,WAAW,CAAC;AAC1C,MAAM,uBAAuB,GAAG,eAAe,CAAC;AAChD,MAAM,eAAe,GAAG,OAAO,CAAC;AAEhC,MAAM,oBAAoB,GAAG,gBAAgB,CAAC;AAC9C,MAA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,OAAO,KAAK,CAAC;AACf,CAAC;AAED,SAAS,wBAAwB,CAAC,CAAS;IACzC,OAAO,CAAC,CAAC,OAAO,CAAC,aAAa,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,WAAW,EAAE,CAAC;AAC1E,CAAC;AAED,SAAS,wBAAwB,CAAC,CAAS;IACzC,OAAO,CAAC,CAAC,OAAO,CAAC,WAAW,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,iBAAiB,EAAE,EAAE,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,CAAC;AACpG,CAAC"}
|
package/lib/token.d.ts
CHANGED
|
@@ -1,44 +1,67 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
* Currently, we only have one type of Operation token: WorkflowRun.
|
|
2
|
+
* Serializable token identifying a Nexus operation target.
|
|
4
3
|
*
|
|
5
4
|
* @internal
|
|
6
5
|
* @hidden
|
|
7
6
|
*/
|
|
8
|
-
export interface
|
|
7
|
+
export interface OperationToken {
|
|
9
8
|
/**
|
|
10
|
-
* Version of the token, by default we assume we're on version
|
|
9
|
+
* Version of the token, by default we assume we're on version 0, this field is not emitted as part of the output,
|
|
11
10
|
* it's only used to reject newer token versions on load.
|
|
12
11
|
*/
|
|
13
12
|
v?: number;
|
|
14
13
|
/**
|
|
15
|
-
* Type of the Operation.
|
|
14
|
+
* Type of the Operation.
|
|
16
15
|
*/
|
|
17
16
|
t: OperationTokenType;
|
|
18
17
|
/**
|
|
19
|
-
* Namespace of the
|
|
18
|
+
* Namespace of the operation.
|
|
20
19
|
*/
|
|
21
20
|
ns: string;
|
|
22
21
|
/**
|
|
23
22
|
* ID of the workflow.
|
|
24
23
|
*/
|
|
24
|
+
wid?: string;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* An OperationToken that identifies a WorkflowRun operation.
|
|
28
|
+
*
|
|
29
|
+
* @internal
|
|
30
|
+
* @hidden
|
|
31
|
+
*/
|
|
32
|
+
export interface WorkflowRunOperationToken extends OperationToken {
|
|
33
|
+
t: typeof OperationTokenType.WORKFLOW_RUN;
|
|
25
34
|
wid: string;
|
|
26
35
|
}
|
|
27
|
-
|
|
36
|
+
/**
|
|
37
|
+
* OperationTokenType is used to identify the type of Operation token.
|
|
38
|
+
* Currently, we only have one type of Operation token: WorkflowRun.
|
|
39
|
+
*
|
|
40
|
+
* @internal
|
|
41
|
+
* @hidden
|
|
42
|
+
*/
|
|
43
|
+
export type OperationTokenType = (typeof OperationTokenType)[keyof typeof OperationTokenType];
|
|
28
44
|
/**
|
|
29
45
|
* @internal
|
|
30
46
|
* @hidden
|
|
31
47
|
*/
|
|
32
|
-
declare const OperationTokenType: {
|
|
48
|
+
export declare const OperationTokenType: {
|
|
33
49
|
readonly WORKFLOW_RUN: 1;
|
|
34
50
|
};
|
|
35
51
|
/**
|
|
36
52
|
* Generate a workflow run Operation token.
|
|
37
53
|
*/
|
|
38
54
|
export declare function generateWorkflowRunOperationToken(namespace: string, workflowId: string): string;
|
|
55
|
+
/**
|
|
56
|
+
* Load and validate the common fields of an Operation token.
|
|
57
|
+
*/
|
|
58
|
+
export declare function loadOperationToken(data: string): OperationToken;
|
|
39
59
|
/**
|
|
40
60
|
* Load and validate a workflow run Operation token.
|
|
41
61
|
*/
|
|
42
62
|
export declare function loadWorkflowRunOperationToken(data: string): WorkflowRunOperationToken;
|
|
63
|
+
/**
|
|
64
|
+
* Assert that an OperationToken identifies a workflow run.
|
|
65
|
+
*/
|
|
66
|
+
export declare function assertWorkflowRunOperationToken(token: OperationToken): asserts token is WorkflowRunOperationToken;
|
|
43
67
|
export declare function base64URLEncodeNoPadding(str: string): string;
|
|
44
|
-
export {};
|
package/lib/token.js
CHANGED
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.OperationTokenType = void 0;
|
|
3
4
|
exports.generateWorkflowRunOperationToken = generateWorkflowRunOperationToken;
|
|
5
|
+
exports.loadOperationToken = loadOperationToken;
|
|
4
6
|
exports.loadWorkflowRunOperationToken = loadWorkflowRunOperationToken;
|
|
7
|
+
exports.assertWorkflowRunOperationToken = assertWorkflowRunOperationToken;
|
|
5
8
|
exports.base64URLEncodeNoPadding = base64URLEncodeNoPadding;
|
|
6
9
|
/**
|
|
7
10
|
* @internal
|
|
8
11
|
* @hidden
|
|
9
12
|
*/
|
|
10
|
-
|
|
13
|
+
exports.OperationTokenType = {
|
|
11
14
|
WORKFLOW_RUN: 1,
|
|
12
15
|
};
|
|
13
16
|
/**
|
|
@@ -15,18 +18,18 @@ const OperationTokenType = {
|
|
|
15
18
|
*/
|
|
16
19
|
function generateWorkflowRunOperationToken(namespace, workflowId) {
|
|
17
20
|
const token = {
|
|
18
|
-
t: OperationTokenType.WORKFLOW_RUN,
|
|
21
|
+
t: exports.OperationTokenType.WORKFLOW_RUN,
|
|
19
22
|
ns: namespace,
|
|
20
23
|
wid: workflowId,
|
|
21
24
|
};
|
|
22
25
|
return base64URLEncodeNoPadding(JSON.stringify(token));
|
|
23
26
|
}
|
|
24
27
|
/**
|
|
25
|
-
* Load and validate
|
|
28
|
+
* Load and validate the common fields of an Operation token.
|
|
26
29
|
*/
|
|
27
|
-
function
|
|
30
|
+
function loadOperationToken(data) {
|
|
28
31
|
if (!data) {
|
|
29
|
-
throw new TypeError('invalid
|
|
32
|
+
throw new TypeError('invalid operation token: token is empty');
|
|
30
33
|
}
|
|
31
34
|
let decoded;
|
|
32
35
|
try {
|
|
@@ -40,19 +43,47 @@ function loadWorkflowRunOperationToken(data) {
|
|
|
40
43
|
token = JSON.parse(decoded);
|
|
41
44
|
}
|
|
42
45
|
catch (err) {
|
|
43
|
-
throw new TypeError('failed to unmarshal
|
|
46
|
+
throw new TypeError('failed to unmarshal Operation token', { cause: err });
|
|
44
47
|
}
|
|
45
|
-
if (token
|
|
46
|
-
throw new TypeError(`invalid
|
|
48
|
+
if (typeof token !== 'object' || token == null) {
|
|
49
|
+
throw new TypeError(`invalid operation token: expected object, got ${typeof token}`);
|
|
47
50
|
}
|
|
48
51
|
if (token.v !== undefined && token.v !== 0) {
|
|
49
|
-
throw new TypeError('invalid
|
|
52
|
+
throw new TypeError('invalid operation token: "v" field should not be present');
|
|
50
53
|
}
|
|
51
|
-
if (
|
|
52
|
-
throw new TypeError(
|
|
54
|
+
if (typeof token.t !== 'number') {
|
|
55
|
+
throw new TypeError(`invalid operation token: expected token type to be a number, got ${typeof token.t}`);
|
|
56
|
+
}
|
|
57
|
+
if (!isOperationTokenType(token.t)) {
|
|
58
|
+
throw new TypeError(`invalid operation token: unknown token type: ${token.t}`);
|
|
59
|
+
}
|
|
60
|
+
if (typeof token.ns !== 'string') {
|
|
61
|
+
throw new TypeError(`invalid operation token: expected namespace to be a string, got ${typeof token.ns}`);
|
|
53
62
|
}
|
|
54
63
|
return token;
|
|
55
64
|
}
|
|
65
|
+
/**
|
|
66
|
+
* Load and validate a workflow run Operation token.
|
|
67
|
+
*/
|
|
68
|
+
function loadWorkflowRunOperationToken(data) {
|
|
69
|
+
const token = loadOperationToken(data);
|
|
70
|
+
assertWorkflowRunOperationToken(token);
|
|
71
|
+
return token;
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Assert that an OperationToken identifies a workflow run.
|
|
75
|
+
*/
|
|
76
|
+
function assertWorkflowRunOperationToken(token) {
|
|
77
|
+
if (token.t !== exports.OperationTokenType.WORKFLOW_RUN) {
|
|
78
|
+
throw new TypeError(`invalid workflow token type: ${token.t}, expected: ${exports.OperationTokenType.WORKFLOW_RUN}`);
|
|
79
|
+
}
|
|
80
|
+
if (!token.wid || typeof token.wid !== 'string') {
|
|
81
|
+
throw new TypeError('invalid workflow run token: missing workflow ID (wid)');
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
function isOperationTokenType(value) {
|
|
85
|
+
return Object.values(exports.OperationTokenType).includes(value);
|
|
86
|
+
}
|
|
56
87
|
// Exported for use in tests.
|
|
57
88
|
function base64URLEncodeNoPadding(str) {
|
|
58
89
|
const base64 = Buffer.from(str).toString('base64url');
|
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":";;;AA4DA,8EAOC;AAKD,gDAoCC;AAKD,sEAIC;AAKD,0EAOC;AAOD,4DAGC;AA1FD;;;GAGG;AACU,QAAA,kBAAkB,GAAG;IAChC,YAAY,EAAE,CAAC;CACP,CAAC;AAEX;;GAEG;AACH,SAAgB,iCAAiC,CAAC,SAAiB,EAAE,UAAkB;IACrF,MAAM,KAAK,GAA8B;QACvC,CAAC,EAAE,0BAAkB,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,kBAAkB,CAAC,IAAY;IAC7C,IAAI,CAAC,IAAI,EAAE,CAAC;QACV,MAAM,IAAI,SAAS,CAAC,yCAAyC,CAAC,CAAC;IACjE,CAAC;IAED,IAAI,OAAe,CAAC;IACpB,IAAI,CAAC;QACH,OAAO,GAAG,wBAAwB,CAAC,IAAI,CAAC,CAAC;IAC3C,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,MAAM,IAAI,SAAS,CAAC,wBAAwB,EAAE,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC,CAAC;IAChE,CAAC;IAED,IAAI,KAAqB,CAAC;IAC1B,IAAI,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pc';
|
|
2
2
|
import type { Workflow, WorkflowResultType } from '@temporalio/common';
|
|
3
3
|
import type { Replace } from '@temporalio/common/lib/type-helpers';
|
|
4
|
-
import type { WorkflowStartOptions as ClientWorkflowStartOptions } from '@temporalio/client';
|
|
4
|
+
import type { Client, WorkflowStartOptions as ClientWorkflowStartOptions } from '@temporalio/client';
|
|
5
|
+
import { type TemporalCancelOperationContext, type TemporalStartOperationContext } from './context';
|
|
5
6
|
declare const isNexusWorkflowHandle: unique symbol;
|
|
6
7
|
declare const workflowResultType: unique symbol;
|
|
7
8
|
/**
|
|
@@ -75,4 +76,80 @@ export declare class WorkflowRunOperationHandler<I, O> implements nexus.Operatio
|
|
|
75
76
|
start(ctx: nexus.StartOperationContext, input: I): Promise<nexus.HandlerStartOperationResult<O>>;
|
|
76
77
|
cancel(_ctx: nexus.CancelOperationContext, token: string): Promise<void>;
|
|
77
78
|
}
|
|
79
|
+
/**
|
|
80
|
+
* Module-private brand and payload key for {@link TemporalOperationResult}.
|
|
81
|
+
*/
|
|
82
|
+
declare const operationResult: unique symbol;
|
|
83
|
+
/**
|
|
84
|
+
* A result produced by a {@link TemporalOperationHandler}. Construct via
|
|
85
|
+
* {@link TemporalOperationResult.sync} or {@link TemporalOperationResult.async}.
|
|
86
|
+
|
|
87
|
+
* @experimental Nexus support in Temporal SDK is experimental.
|
|
88
|
+
*/
|
|
89
|
+
export interface TemporalOperationResult<T> {
|
|
90
|
+
readonly [operationResult]: nexus.HandlerStartOperationResult<T>;
|
|
91
|
+
}
|
|
92
|
+
export declare const TemporalOperationResult: {
|
|
93
|
+
sync<T>(value: T): TemporalOperationResult<T>;
|
|
94
|
+
async<T = unknown>(token: string): TemporalOperationResult<T>;
|
|
95
|
+
};
|
|
96
|
+
/**
|
|
97
|
+
* A Nexus-aware Temporal Client for use inside {@link TemporalOperationHandler} implementations.
|
|
98
|
+
*
|
|
99
|
+
* @experimental Nexus support in Temporal SDK is experimental.
|
|
100
|
+
*/
|
|
101
|
+
export interface TemporalNexusClient {
|
|
102
|
+
/**
|
|
103
|
+
* The Temporal Client for the active Nexus Operation.
|
|
104
|
+
*
|
|
105
|
+
* @experimental Nexus support in Temporal SDK is experimental.
|
|
106
|
+
*/
|
|
107
|
+
readonly client: Client;
|
|
108
|
+
/**
|
|
109
|
+
* Starts a workflow run as the asynchronous backing operation for the current Nexus Operation.
|
|
110
|
+
*
|
|
111
|
+
* @experimental Nexus support in Temporal SDK is experimental.
|
|
112
|
+
*/
|
|
113
|
+
startWorkflow<T extends Workflow>(workflowTypeOrFunc: string | T, workflowOptions: WorkflowStartOptions<T>): Promise<TemporalOperationResult<WorkflowResultType<T>>>;
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* A handler function for the {@link TemporalOperationHandler} constructor.
|
|
117
|
+
*
|
|
118
|
+
* @experimental Nexus support in Temporal SDK is experimental.
|
|
119
|
+
*/
|
|
120
|
+
export type TemporalOperationStartHandler<I, O> = (ctx: TemporalStartOperationContext, client: TemporalNexusClient, input: I) => Promise<TemporalOperationResult<O>>;
|
|
121
|
+
/**
|
|
122
|
+
* Options passed to a {@link TemporalOperationHandlerOptions.cancelWorkflowRun} handler describing
|
|
123
|
+
* the workflow run to cancel.
|
|
124
|
+
*
|
|
125
|
+
* @experimental Nexus support in Temporal SDK is experimental.
|
|
126
|
+
*/
|
|
127
|
+
export interface CancelWorkflowRunOptions {
|
|
128
|
+
/**
|
|
129
|
+
* The ID of the workflow backing the Nexus Operation that is being canceled.
|
|
130
|
+
*/
|
|
131
|
+
readonly workflowId: string;
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* Options for customizing a {@link TemporalOperationHandler}.
|
|
135
|
+
*
|
|
136
|
+
* @experimental Nexus support in Temporal SDK is experimental.
|
|
137
|
+
*/
|
|
138
|
+
export interface TemporalOperationHandlerOptions {
|
|
139
|
+
cancelWorkflowRun?: (ctx: TemporalCancelOperationContext, options: CancelWorkflowRunOptions) => Promise<void>;
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* A Nexus Operation implementation for operations that interact with Temporal.
|
|
143
|
+
*
|
|
144
|
+
* @experimental Nexus support in Temporal SDK is experimental.
|
|
145
|
+
*/
|
|
146
|
+
export declare class TemporalOperationHandler<I, O> implements nexus.OperationHandler<I, O> {
|
|
147
|
+
private readonly startHandler;
|
|
148
|
+
private readonly cancelWorkflowRunHandler;
|
|
149
|
+
constructor(options: {
|
|
150
|
+
start: TemporalOperationStartHandler<I, O>;
|
|
151
|
+
} & TemporalOperationHandlerOptions);
|
|
152
|
+
start(ctx: nexus.StartOperationContext, input: I): Promise<nexus.HandlerStartOperationResult<O>>;
|
|
153
|
+
cancel(ctx: nexus.CancelOperationContext, token: string): Promise<void>;
|
|
154
|
+
}
|
|
78
155
|
export {};
|
package/lib/workflow-helpers.js
CHANGED
|
@@ -23,12 +23,12 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
23
23
|
return result;
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.WorkflowRunOperationHandler = void 0;
|
|
26
|
+
exports.TemporalOperationHandler = exports.TemporalOperationResult = exports.WorkflowRunOperationHandler = void 0;
|
|
27
27
|
exports.startWorkflow = startWorkflow;
|
|
28
28
|
const nexus = __importStar(require("nexus-rpc"));
|
|
29
29
|
const internal_1 = require("@temporalio/client/lib/internal");
|
|
30
|
-
const token_1 = require("./token");
|
|
31
30
|
const link_converter_1 = require("./link-converter");
|
|
31
|
+
const token_1 = require("./token");
|
|
32
32
|
const context_1 = require("./context");
|
|
33
33
|
/**
|
|
34
34
|
* Starts a workflow run for a {@link WorkflowRunOperationStartHandler}, linking the execution chain
|
|
@@ -44,9 +44,7 @@ async function startWorkflow(ctx, workflowTypeOrFunc, workflowOptions) {
|
|
|
44
44
|
if (ctx.inboundLinks?.length > 0) {
|
|
45
45
|
for (const l of ctx.inboundLinks) {
|
|
46
46
|
try {
|
|
47
|
-
links.push(
|
|
48
|
-
workflowEvent: (0, link_converter_1.convertNexusLinkToWorkflowEventLink)(l),
|
|
49
|
-
});
|
|
47
|
+
links.push((0, link_converter_1.convertNexusLinkToTemporalLink)(l));
|
|
50
48
|
}
|
|
51
49
|
catch (error) {
|
|
52
50
|
context_1.log.warn('failed to convert Nexus link to Workflow event link', { error });
|
|
@@ -62,10 +60,16 @@ async function startWorkflow(ctx, workflowTypeOrFunc, workflowOptions) {
|
|
|
62
60
|
attachCompletionCallbacks: true,
|
|
63
61
|
attachRequestId: true,
|
|
64
62
|
};
|
|
63
|
+
// Add nexus-operation-token header to solve for race between Workflow completion
|
|
64
|
+
// and Nexus Operation start recording
|
|
65
|
+
const callbackHeaders = {
|
|
66
|
+
...ctx.callbackHeaders,
|
|
67
|
+
'nexus-operation-token': (0, token_1.generateWorkflowRunOperationToken)(client.options.namespace, workflowOptions.workflowId),
|
|
68
|
+
};
|
|
65
69
|
if (ctx.callbackUrl) {
|
|
66
70
|
internalOptions.completionCallbacks = [
|
|
67
71
|
{
|
|
68
|
-
nexus: { url: ctx.callbackUrl, header:
|
|
72
|
+
nexus: { url: ctx.callbackUrl, header: callbackHeaders },
|
|
69
73
|
links, // pass in links here as well for older servers, newer servers dedupe them.
|
|
70
74
|
},
|
|
71
75
|
];
|
|
@@ -77,12 +81,12 @@ async function startWorkflow(ctx, workflowTypeOrFunc, workflowOptions) {
|
|
|
77
81
|
[internal_1.InternalWorkflowStartOptionsSymbol]: internalOptions,
|
|
78
82
|
};
|
|
79
83
|
const handle = await client.workflow.start(workflowTypeOrFunc, startOptions);
|
|
80
|
-
if (internalOptions.backLink
|
|
84
|
+
if (internalOptions.backLink != null) {
|
|
81
85
|
try {
|
|
82
|
-
ctx.outboundLinks.push((0, link_converter_1.
|
|
86
|
+
ctx.outboundLinks.push((0, link_converter_1.convertTemporalLinkToNexusLink)(internalOptions.backLink));
|
|
83
87
|
}
|
|
84
88
|
catch (error) {
|
|
85
|
-
context_1.log.warn('failed to convert
|
|
89
|
+
context_1.log.warn('failed to convert temporal link to Nexus link', { error });
|
|
86
90
|
}
|
|
87
91
|
}
|
|
88
92
|
return {
|
|
@@ -111,4 +115,105 @@ class WorkflowRunOperationHandler {
|
|
|
111
115
|
}
|
|
112
116
|
}
|
|
113
117
|
exports.WorkflowRunOperationHandler = WorkflowRunOperationHandler;
|
|
118
|
+
/**
|
|
119
|
+
* Module-private brand and payload key for {@link TemporalOperationResult}.
|
|
120
|
+
*/
|
|
121
|
+
const operationResult = Symbol('temporal_nexus_TemporalOperationResult');
|
|
122
|
+
exports.TemporalOperationResult = {
|
|
123
|
+
sync(value) {
|
|
124
|
+
return {
|
|
125
|
+
[operationResult]: nexus.HandlerStartOperationResult.sync(value),
|
|
126
|
+
};
|
|
127
|
+
},
|
|
128
|
+
async(token) {
|
|
129
|
+
return {
|
|
130
|
+
[operationResult]: nexus.HandlerStartOperationResult.async(token),
|
|
131
|
+
};
|
|
132
|
+
},
|
|
133
|
+
};
|
|
134
|
+
class TemporalNexusClientImpl {
|
|
135
|
+
startOperationContext;
|
|
136
|
+
asyncOperationStarted = false;
|
|
137
|
+
constructor(startOperationContext) {
|
|
138
|
+
this.startOperationContext = startOperationContext;
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* The Temporal Client for the active Nexus Operation.
|
|
142
|
+
*
|
|
143
|
+
* @experimental Nexus support in Temporal SDK is experimental.
|
|
144
|
+
*/
|
|
145
|
+
get client() {
|
|
146
|
+
return (0, context_1.getClient)();
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* Starts a workflow run as the asynchronous backing operation for the current Nexus Operation.
|
|
150
|
+
*
|
|
151
|
+
* @experimental Nexus support in Temporal SDK is experimental.
|
|
152
|
+
*/
|
|
153
|
+
async startWorkflow(workflowTypeOrFunc, workflowOptions) {
|
|
154
|
+
return await this.withAsyncOperationStartReservation(async () => {
|
|
155
|
+
const handle = await startWorkflow(this.startOperationContext, workflowTypeOrFunc, workflowOptions);
|
|
156
|
+
const { namespace } = (0, context_1.getHandlerContext)();
|
|
157
|
+
return exports.TemporalOperationResult.async((0, token_1.generateWorkflowRunOperationToken)(namespace, handle.workflowId));
|
|
158
|
+
});
|
|
159
|
+
}
|
|
160
|
+
async withAsyncOperationStartReservation(fn) {
|
|
161
|
+
if (this.asyncOperationStarted) {
|
|
162
|
+
throw new nexus.HandlerError('BAD_REQUEST', 'Only one async operation can be started per operation handler invocation. Use TemporalNexusClient.client for additional workflow interactions');
|
|
163
|
+
}
|
|
164
|
+
this.asyncOperationStarted = true;
|
|
165
|
+
try {
|
|
166
|
+
return await fn();
|
|
167
|
+
}
|
|
168
|
+
catch (err) {
|
|
169
|
+
this.asyncOperationStarted = false;
|
|
170
|
+
throw err;
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
/**
|
|
175
|
+
* A Nexus Operation implementation for operations that interact with Temporal.
|
|
176
|
+
*
|
|
177
|
+
* @experimental Nexus support in Temporal SDK is experimental.
|
|
178
|
+
*/
|
|
179
|
+
class TemporalOperationHandler {
|
|
180
|
+
startHandler;
|
|
181
|
+
cancelWorkflowRunHandler;
|
|
182
|
+
constructor(options) {
|
|
183
|
+
this.startHandler = options.start;
|
|
184
|
+
this.cancelWorkflowRunHandler = options.cancelWorkflowRun ?? defaultCancelWorkflowRun;
|
|
185
|
+
}
|
|
186
|
+
async start(ctx, input) {
|
|
187
|
+
const result = await this.startHandler(ctx, new TemporalNexusClientImpl(ctx), input);
|
|
188
|
+
return result[operationResult];
|
|
189
|
+
}
|
|
190
|
+
async cancel(ctx, token) {
|
|
191
|
+
let opToken;
|
|
192
|
+
try {
|
|
193
|
+
opToken = (0, token_1.loadOperationToken)(token);
|
|
194
|
+
}
|
|
195
|
+
catch (err) {
|
|
196
|
+
throw new nexus.HandlerError(nexus.HandlerErrorType.BAD_REQUEST, 'invalid operation token', { cause: err });
|
|
197
|
+
}
|
|
198
|
+
switch (opToken.t) {
|
|
199
|
+
case token_1.OperationTokenType.WORKFLOW_RUN:
|
|
200
|
+
try {
|
|
201
|
+
(0, token_1.assertWorkflowRunOperationToken)(opToken);
|
|
202
|
+
}
|
|
203
|
+
catch (err) {
|
|
204
|
+
throw new nexus.HandlerError(nexus.HandlerErrorType.BAD_REQUEST, 'invalid workflow run operation token', {
|
|
205
|
+
cause: err,
|
|
206
|
+
});
|
|
207
|
+
}
|
|
208
|
+
await this.cancelWorkflowRunHandler(ctx, { workflowId: opToken.wid });
|
|
209
|
+
return;
|
|
210
|
+
default:
|
|
211
|
+
throw new nexus.HandlerError(nexus.HandlerErrorType.BAD_REQUEST, `Unsupported operation token type: ${opToken.t}`);
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
exports.TemporalOperationHandler = TemporalOperationHandler;
|
|
216
|
+
async function defaultCancelWorkflowRun(_ctx, options) {
|
|
217
|
+
await (0, context_1.getClient)().workflow.getHandle(options.workflowId).cancel();
|
|
218
|
+
}
|
|
114
219
|
//# sourceMappingURL=workflow-helpers.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"workflow-helpers.js","sourceRoot":"","sources":["../src/workflow-helpers.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"workflow-helpers.js","sourceRoot":"","sources":["../src/workflow-helpers.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAiFA,sCA+DC;AAhJD,iDAAmC;AAMnC,8DAAqF;AACrF,qDAAkG;AAClG,mCAMiB;AACjB,uCAMmB;AAoDnB;;;;;;;GAOG;AACI,KAAK,UAAU,aAAa,CACjC,GAAgC,EAChC,kBAA8B,EAC9B,eAAwC;IAExC,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,GAAG,IAAA,2BAAiB,GAAE,CAAC;IAClD,MAAM,KAAK,GAAG,KAAK,EAAgC,CAAC;IACpD,IAAI,GAAG,CAAC,YAAY,EAAE,MAAM,GAAG,CAAC,EA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BACL,CAAC;gBACD,MAAM,IAAI,CAAC,wBAAwB,CAAC,GAAG,EAAE,EAAE,UAAU,EAAE,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC;gBACtE,OAAO;YACT;gBACE,MAAM,IAAI,KAAK,CAAC,YAAY,CAC1B,KAAK,CAAC,gBAAgB,CAAC,WAAW,EAClC,qCAAqC,OAAO,CAAC,CAAC,EAAE,CACjD,CAAC;QACN,CAAC;IACH,CAAC;CACF;AAxCD,4DAwCC;AAED,KAAK,UAAU,wBAAwB,CAAC,IAAoC,EAAE,OAAiC;IAC7G,MAAM,IAAA,mBAAS,GAAE,CAAC,QAAQ,CAAC,SAAS,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,MAAM,EAAE,CAAC;AACpE,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@temporalio/nexus",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.18.0",
|
|
4
4
|
"description": "Temporal.io SDK Nexus sub-package",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"types": "./lib/index.d.ts",
|
|
@@ -20,9 +20,9 @@
|
|
|
20
20
|
"dependencies": {
|
|
21
21
|
"long": "^5.2.3",
|
|
22
22
|
"nexus-rpc": "^0.0.2",
|
|
23
|
-
"@temporalio/
|
|
24
|
-
"@temporalio/common": "1.
|
|
25
|
-
"@temporalio/
|
|
23
|
+
"@temporalio/client": "1.18.0",
|
|
24
|
+
"@temporalio/common": "1.18.0",
|
|
25
|
+
"@temporalio/proto": "1.18.0"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
28
|
"ava": "^5.3.1"
|