@temporalio/client 0.22.0 → 1.0.0-rc.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/README.md +2 -2
- package/lib/async-completion-client.d.ts +12 -7
- package/lib/async-completion-client.js +16 -13
- package/lib/async-completion-client.js.map +1 -1
- package/lib/connection.d.ts +97 -47
- package/lib/connection.js +140 -25
- package/lib/connection.js.map +1 -1
- package/lib/index.d.ts +5 -3
- package/lib/index.js +8 -4
- package/lib/index.js.map +1 -1
- package/lib/pkg.d.ts +5 -0
- package/lib/pkg.js +12 -0
- package/lib/pkg.js.map +1 -0
- package/lib/types.d.ts +50 -2
- package/lib/types.js +4 -0
- package/lib/types.js.map +1 -1
- package/lib/workflow-client.d.ts +55 -15
- package/lib/workflow-client.js +73 -20
- package/lib/workflow-client.js.map +1 -1
- package/lib/workflow-options.d.ts +2 -2
- package/package.json +12 -11
- package/src/async-completion-client.ts +256 -0
- package/src/connection.ts +374 -0
- package/src/errors.ts +57 -0
- package/src/grpc-retry.ts +119 -0
- package/src/index.ts +37 -0
- package/src/interceptors.ts +132 -0
- package/src/pkg.ts +7 -0
- package/src/types.ts +88 -0
- package/src/workflow-client.ts +969 -0
- package/src/workflow-options.ts +76 -0
package/README.md
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
[](https://www.npmjs.com/package/@temporalio/client)
|
|
4
4
|
|
|
5
|
-
Part of [Temporal](https://temporal.io)'s [TypeScript SDK](https://docs.temporal.io/
|
|
5
|
+
Part of [Temporal](https://temporal.io)'s [TypeScript SDK](https://docs.temporal.io/typescript/introduction/).
|
|
6
6
|
|
|
7
|
-
- [Client docs](https://docs.temporal.io/
|
|
7
|
+
- [Client docs](https://docs.temporal.io/typescript/clients)
|
|
8
8
|
- [API reference](https://typescript.temporal.io/api/namespaces/client)
|
|
9
9
|
- [Sample projects](https://github.com/temporalio/samples-typescript)
|
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
import { DataConverter, LoadedDataConverter } from '@temporalio/common';
|
|
2
|
-
import {
|
|
2
|
+
import { Replace } from '@temporalio/internal-workflow-common';
|
|
3
|
+
import { ConnectionLike, WorkflowService } from './types';
|
|
3
4
|
/**
|
|
4
|
-
* Thrown by {@link AsyncCompletionClient} when trying to complete or heartbeat
|
|
5
|
-
*
|
|
5
|
+
* Thrown by {@link AsyncCompletionClient} when trying to complete or heartbeat an Activity that does not exist in the
|
|
6
|
+
* system.
|
|
6
7
|
*/
|
|
7
8
|
export declare class ActivityNotFoundError extends Error {
|
|
8
9
|
readonly name = "ActivityNotFoundError";
|
|
9
10
|
}
|
|
10
11
|
/**
|
|
11
12
|
* Thrown by {@link AsyncCompletionClient} when trying to complete or heartbeat
|
|
12
|
-
* an Activity for any reason apart from
|
|
13
|
+
* an Activity for any reason apart from {@link ActivityNotFoundError}.
|
|
13
14
|
*/
|
|
14
15
|
export declare class ActivityCompletionError extends Error {
|
|
15
16
|
readonly name = "ActivityCompletionError";
|
|
@@ -35,6 +36,7 @@ export interface AsyncCompletionClientOptions {
|
|
|
35
36
|
* @default `${process.pid}@${os.hostname()}`
|
|
36
37
|
*/
|
|
37
38
|
identity?: string;
|
|
39
|
+
connection?: ConnectionLike;
|
|
38
40
|
/**
|
|
39
41
|
* Server namespace
|
|
40
42
|
*
|
|
@@ -42,7 +44,9 @@ export interface AsyncCompletionClientOptions {
|
|
|
42
44
|
*/
|
|
43
45
|
namespace?: string;
|
|
44
46
|
}
|
|
45
|
-
export declare type AsyncCompletionClientOptionsWithDefaults = Required<AsyncCompletionClientOptions
|
|
47
|
+
export declare type AsyncCompletionClientOptionsWithDefaults = Replace<Required<AsyncCompletionClientOptions>, {
|
|
48
|
+
connection?: ConnectionLike;
|
|
49
|
+
}>;
|
|
46
50
|
export declare function defaultAsyncCompletionClientOptions(): AsyncCompletionClientOptionsWithDefaults;
|
|
47
51
|
/**
|
|
48
52
|
* A mostly unique Activity identifier including its scheduling workflow's ID
|
|
@@ -60,10 +64,11 @@ export interface FullActivityId {
|
|
|
60
64
|
* A client for asynchronous completion and heartbeating of Activities.
|
|
61
65
|
*/
|
|
62
66
|
export declare class AsyncCompletionClient {
|
|
63
|
-
readonly service: WorkflowService;
|
|
64
67
|
readonly options: AsyncCompletionClientOptionsWithDefaults;
|
|
65
68
|
protected readonly dataConverter: LoadedDataConverter;
|
|
66
|
-
|
|
69
|
+
readonly connection: ConnectionLike;
|
|
70
|
+
constructor(options?: AsyncCompletionClientOptions);
|
|
71
|
+
get workflowService(): WorkflowService;
|
|
67
72
|
/**
|
|
68
73
|
* Transforms grpc errors into well defined TS errors.
|
|
69
74
|
*/
|
|
@@ -11,8 +11,8 @@ const os_1 = __importDefault(require("os"));
|
|
|
11
11
|
const connection_1 = require("./connection");
|
|
12
12
|
const errors_1 = require("./errors");
|
|
13
13
|
/**
|
|
14
|
-
* Thrown by {@link AsyncCompletionClient} when trying to complete or heartbeat
|
|
15
|
-
*
|
|
14
|
+
* Thrown by {@link AsyncCompletionClient} when trying to complete or heartbeat an Activity that does not exist in the
|
|
15
|
+
* system.
|
|
16
16
|
*/
|
|
17
17
|
class ActivityNotFoundError extends Error {
|
|
18
18
|
constructor() {
|
|
@@ -23,7 +23,7 @@ class ActivityNotFoundError extends Error {
|
|
|
23
23
|
exports.ActivityNotFoundError = ActivityNotFoundError;
|
|
24
24
|
/**
|
|
25
25
|
* Thrown by {@link AsyncCompletionClient} when trying to complete or heartbeat
|
|
26
|
-
* an Activity for any reason apart from
|
|
26
|
+
* an Activity for any reason apart from {@link ActivityNotFoundError}.
|
|
27
27
|
*/
|
|
28
28
|
class ActivityCompletionError extends Error {
|
|
29
29
|
constructor() {
|
|
@@ -55,11 +55,14 @@ exports.defaultAsyncCompletionClientOptions = defaultAsyncCompletionClientOption
|
|
|
55
55
|
* A client for asynchronous completion and heartbeating of Activities.
|
|
56
56
|
*/
|
|
57
57
|
class AsyncCompletionClient {
|
|
58
|
-
constructor(
|
|
59
|
-
this.
|
|
58
|
+
constructor(options) {
|
|
59
|
+
this.connection = options?.connection ?? connection_1.Connection.lazy();
|
|
60
60
|
this.dataConverter = (0, internal_non_workflow_common_1.loadDataConverter)(options?.dataConverter);
|
|
61
61
|
this.options = { ...defaultAsyncCompletionClientOptions(), ...(0, internal_non_workflow_common_1.filterNullAndUndefined)(options ?? {}) };
|
|
62
62
|
}
|
|
63
|
+
get workflowService() {
|
|
64
|
+
return this.connection.workflowService;
|
|
65
|
+
}
|
|
63
66
|
/**
|
|
64
67
|
* Transforms grpc errors into well defined TS errors.
|
|
65
68
|
*/
|
|
@@ -75,7 +78,7 @@ class AsyncCompletionClient {
|
|
|
75
78
|
async complete(taskTokenOrFullActivityId, result) {
|
|
76
79
|
try {
|
|
77
80
|
if (taskTokenOrFullActivityId instanceof Uint8Array) {
|
|
78
|
-
await this.
|
|
81
|
+
await this.workflowService.respondActivityTaskCompleted({
|
|
79
82
|
identity: this.options.identity,
|
|
80
83
|
namespace: this.options.namespace,
|
|
81
84
|
taskToken: taskTokenOrFullActivityId,
|
|
@@ -83,7 +86,7 @@ class AsyncCompletionClient {
|
|
|
83
86
|
});
|
|
84
87
|
}
|
|
85
88
|
else {
|
|
86
|
-
await this.
|
|
89
|
+
await this.workflowService.respondActivityTaskCompletedById({
|
|
87
90
|
identity: this.options.identity,
|
|
88
91
|
namespace: this.options.namespace,
|
|
89
92
|
...taskTokenOrFullActivityId,
|
|
@@ -98,7 +101,7 @@ class AsyncCompletionClient {
|
|
|
98
101
|
async fail(taskTokenOrFullActivityId, err) {
|
|
99
102
|
try {
|
|
100
103
|
if (taskTokenOrFullActivityId instanceof Uint8Array) {
|
|
101
|
-
await this.
|
|
104
|
+
await this.workflowService.respondActivityTaskFailed({
|
|
102
105
|
identity: this.options.identity,
|
|
103
106
|
namespace: this.options.namespace,
|
|
104
107
|
taskToken: taskTokenOrFullActivityId,
|
|
@@ -106,7 +109,7 @@ class AsyncCompletionClient {
|
|
|
106
109
|
});
|
|
107
110
|
}
|
|
108
111
|
else {
|
|
109
|
-
await this.
|
|
112
|
+
await this.workflowService.respondActivityTaskFailedById({
|
|
110
113
|
identity: this.options.identity,
|
|
111
114
|
namespace: this.options.namespace,
|
|
112
115
|
...taskTokenOrFullActivityId,
|
|
@@ -121,7 +124,7 @@ class AsyncCompletionClient {
|
|
|
121
124
|
async reportCancellation(taskTokenOrFullActivityId, details) {
|
|
122
125
|
try {
|
|
123
126
|
if (taskTokenOrFullActivityId instanceof Uint8Array) {
|
|
124
|
-
await this.
|
|
127
|
+
await this.workflowService.respondActivityTaskCanceled({
|
|
125
128
|
identity: this.options.identity,
|
|
126
129
|
namespace: this.options.namespace,
|
|
127
130
|
taskToken: taskTokenOrFullActivityId,
|
|
@@ -129,7 +132,7 @@ class AsyncCompletionClient {
|
|
|
129
132
|
});
|
|
130
133
|
}
|
|
131
134
|
else {
|
|
132
|
-
await this.
|
|
135
|
+
await this.workflowService.respondActivityTaskCanceledById({
|
|
133
136
|
identity: this.options.identity,
|
|
134
137
|
namespace: this.options.namespace,
|
|
135
138
|
...taskTokenOrFullActivityId,
|
|
@@ -144,7 +147,7 @@ class AsyncCompletionClient {
|
|
|
144
147
|
async heartbeat(taskTokenOrFullActivityId, details) {
|
|
145
148
|
try {
|
|
146
149
|
if (taskTokenOrFullActivityId instanceof Uint8Array) {
|
|
147
|
-
const { cancelRequested } = await this.
|
|
150
|
+
const { cancelRequested } = await this.workflowService.recordActivityTaskHeartbeat({
|
|
148
151
|
identity: this.options.identity,
|
|
149
152
|
namespace: this.options.namespace,
|
|
150
153
|
taskToken: taskTokenOrFullActivityId,
|
|
@@ -155,7 +158,7 @@ class AsyncCompletionClient {
|
|
|
155
158
|
}
|
|
156
159
|
}
|
|
157
160
|
else {
|
|
158
|
-
const { cancelRequested } = await this.
|
|
161
|
+
const { cancelRequested } = await this.workflowService.recordActivityTaskHeartbeatById({
|
|
159
162
|
identity: this.options.identity,
|
|
160
163
|
namespace: this.options.namespace,
|
|
161
164
|
...taskTokenOrFullActivityId,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"async-completion-client.js","sourceRoot":"","sources":["../src/async-completion-client.ts"],"names":[],"mappings":";;;;;;AAAA,iEAA2D;AAC3D,+CAA+F;AAC/F,2FAKkD;
|
|
1
|
+
{"version":3,"file":"async-completion-client.js","sourceRoot":"","sources":["../src/async-completion-client.ts"],"names":[],"mappings":";;;;;;AAAA,iEAA2D;AAC3D,+CAA+F;AAC/F,2FAKkD;AAElD,4CAAoB;AACpB,6CAA0C;AAC1C,qCAAiD;AAGjD;;;GAGG;AACH,MAAa,qBAAsB,SAAQ,KAAK;IAAhD;;QACkB,SAAI,GAAG,uBAAuB,CAAC;IACjD,CAAC;CAAA;AAFD,sDAEC;AAED;;;GAGG;AACH,MAAa,uBAAwB,SAAQ,KAAK;IAAlD;;QACkB,SAAI,GAAG,yBAAyB,CAAC;IACnD,CAAC;CAAA;AAFD,0DAEC;AAED;;;GAGG;AACH,MAAa,sBAAuB,SAAQ,KAAK;IAAjD;;QACkB,SAAI,GAAG,wBAAwB,CAAC;IAClD,CAAC;CAAA;AAFD,wDAEC;AAmCD,SAAgB,mCAAmC;IACjD,OAAO;QACL,aAAa,EAAE,EAAE;QACjB,QAAQ,EAAE,GAAG,OAAO,CAAC,GAAG,IAAI,YAAE,CAAC,QAAQ,EAAE,EAAE;QAC3C,SAAS,EAAE,SAAS;KACrB,CAAC;AACJ,CAAC;AAND,kFAMC;AAeD;;GAEG;AACH,MAAa,qBAAqB;IAKhC,YAAY,OAAsC;QAChD,IAAI,CAAC,UAAU,GAAG,OAAO,EAAE,UAAU,IAAI,uBAAU,CAAC,IAAI,EAAE,CAAC;QAC3D,IAAI,CAAC,aAAa,GAAG,IAAA,gDAAiB,EAAC,OAAO,EAAE,aAAa,CAAC,CAAC;QAC/D,IAAI,CAAC,OAAO,GAAG,EAAE,GAAG,mCAAmC,EAAE,EAAE,GAAG,IAAA,qDAAsB,EAAC,OAAO,IAAI,EAAE,CA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Q,EAAE,MAAM,IAAA,+CAAgB,EAAC,IAAI,CAAC,aAAa,EAAE,OAAO,CAAC,EAAE;iBAC3E,CAAC,CAAC;gBACH,IAAI,eAAe,EAAE;oBACnB,MAAM,IAAI,sBAAsB,CAAC,WAAW,CAAC,CAAC;iBAC/C;aACF;SACF;QAAC,OAAO,GAAG,EAAE;YACZ,IAAI,GAAG,YAAY,sBAAsB,EAAE;gBACzC,MAAM,GAAG,CAAC;aACX;YACD,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;SACvB;IACH,CAAC;CACF;AAhKD,sDAgKC"}
|
package/lib/connection.d.ts
CHANGED
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
import * as grpc from '@grpc/grpc-js';
|
|
3
3
|
import { TLSConfig } from '@temporalio/internal-non-workflow-common';
|
|
4
|
-
import { temporal } from '@temporalio/proto';
|
|
5
4
|
import { AsyncLocalStorage } from 'async_hooks';
|
|
6
5
|
import type { RPCImpl } from 'protobufjs';
|
|
7
|
-
|
|
8
|
-
export declare const WorkflowService: typeof temporal.api.workflowservice.v1.WorkflowService;
|
|
6
|
+
import { CallContext, Metadata, OperatorService, WorkflowService } from './types';
|
|
9
7
|
/**
|
|
10
|
-
*
|
|
8
|
+
* gRPC and Temporal Server connection options
|
|
11
9
|
*/
|
|
12
10
|
export interface ConnectionOptions {
|
|
13
11
|
/**
|
|
@@ -44,32 +42,35 @@ export interface ConnectionOptions {
|
|
|
44
42
|
* interceptors).
|
|
45
43
|
*/
|
|
46
44
|
interceptors?: grpc.Interceptor[];
|
|
47
|
-
}
|
|
48
|
-
export declare type ConnectionOptionsWithDefaults = Required<Omit<ConnectionOptions, 'tls'>>;
|
|
49
|
-
export declare const LOCAL_DOCKER_TARGET = "127.0.0.1:7233";
|
|
50
|
-
export declare function defaultConnectionOpts(): ConnectionOptionsWithDefaults;
|
|
51
|
-
/**
|
|
52
|
-
* Mapping of string to valid gRPC metadata value
|
|
53
|
-
*/
|
|
54
|
-
export declare type Metadata = Record<string, grpc.MetadataValue>;
|
|
55
|
-
/**
|
|
56
|
-
* User defined context for gRPC client calls
|
|
57
|
-
*/
|
|
58
|
-
export interface CallContext {
|
|
59
45
|
/**
|
|
60
|
-
*
|
|
46
|
+
* Optional mapping of gRPC metadata (HTTP headers) to send with each request to the server.
|
|
47
|
+
*
|
|
48
|
+
* In order to dynamically set metadata, use {@link Connection.withMetadata}
|
|
61
49
|
*/
|
|
62
|
-
|
|
50
|
+
metadata?: Metadata;
|
|
63
51
|
/**
|
|
64
|
-
*
|
|
52
|
+
* Milliseconds to wait until establishing a connection with the server.
|
|
53
|
+
*
|
|
54
|
+
* Used either when connecting eagerly with {@link Connection.connect} or
|
|
55
|
+
* calling {@link Connection.ensureConnected}.
|
|
56
|
+
*
|
|
57
|
+
* @format {@link https://www.npmjs.com/package/ms | ms} formatted string
|
|
58
|
+
* @default 10 seconds
|
|
65
59
|
*/
|
|
66
|
-
|
|
60
|
+
connectTimeout?: number | string;
|
|
67
61
|
}
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
export declare
|
|
72
|
-
|
|
62
|
+
export declare type ConnectionOptionsWithDefaults = Required<Omit<ConnectionOptions, 'tls' | 'connectTimeout'>> & {
|
|
63
|
+
connectTimeoutMs: number;
|
|
64
|
+
};
|
|
65
|
+
export declare const LOCAL_TARGET = "127.0.0.1:7233";
|
|
66
|
+
export declare function defaultConnectionOpts(): ConnectionOptionsWithDefaults;
|
|
67
|
+
export interface RPCImplOptions {
|
|
68
|
+
serviceName: string;
|
|
69
|
+
client: grpc.Client;
|
|
70
|
+
callContextStorage: AsyncLocalStorage<CallContext>;
|
|
71
|
+
interceptors?: grpc.Interceptor[];
|
|
72
|
+
}
|
|
73
|
+
export interface ConnectionCtorOptions {
|
|
73
74
|
readonly options: ConnectionOptionsWithDefaults;
|
|
74
75
|
readonly client: grpc.Client;
|
|
75
76
|
/**
|
|
@@ -77,48 +78,97 @@ export declare class Connection {
|
|
|
77
78
|
*
|
|
78
79
|
* **NOTE**: The namespace provided in {@link options} is **not** automatically set on requests made to the service.
|
|
79
80
|
*/
|
|
80
|
-
readonly
|
|
81
|
+
readonly workflowService: WorkflowService;
|
|
82
|
+
readonly operatorService: OperatorService;
|
|
81
83
|
readonly callContextStorage: AsyncLocalStorage<CallContext>;
|
|
82
|
-
|
|
83
|
-
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Client connection to the Temporal Server
|
|
87
|
+
*
|
|
88
|
+
* ⚠️ Connections are expensive to construct and should be reused. Make sure to {@link close} any unused connections to
|
|
89
|
+
* avoid leaking resources.
|
|
90
|
+
*/
|
|
91
|
+
export declare class Connection {
|
|
84
92
|
/**
|
|
85
|
-
*
|
|
93
|
+
* @internal
|
|
86
94
|
*/
|
|
87
|
-
|
|
95
|
+
static readonly Client: grpc.ServiceClientConstructor;
|
|
96
|
+
readonly options: ConnectionOptionsWithDefaults;
|
|
97
|
+
protected readonly client: grpc.Client;
|
|
88
98
|
/**
|
|
89
|
-
*
|
|
99
|
+
* Used to ensure `ensureConnected` is called once.
|
|
100
|
+
*/
|
|
101
|
+
protected connectPromise?: Promise<void>;
|
|
102
|
+
/**
|
|
103
|
+
* Raw gRPC access to Temporal Server's {@link
|
|
104
|
+
* https://github.com/temporalio/api/blob/master/temporal/api/workflowservice/v1/service.proto | Workflow service}
|
|
105
|
+
*/
|
|
106
|
+
readonly workflowService: WorkflowService;
|
|
107
|
+
/**
|
|
108
|
+
* Raw gRPC access to Temporal Server's
|
|
109
|
+
* {@link https://github.com/temporalio/api/blob/master/temporal/api/operatorservice/v1/service.proto | Operator service}
|
|
110
|
+
*/
|
|
111
|
+
readonly operatorService: OperatorService;
|
|
112
|
+
readonly callContextStorage: AsyncLocalStorage<CallContext>;
|
|
113
|
+
protected static createCtorOptions(options?: ConnectionOptions): ConnectionCtorOptions;
|
|
114
|
+
/**
|
|
115
|
+
* Ensure connection can be established.
|
|
116
|
+
*
|
|
117
|
+
* Does not need to be called if you use {@link connect}.
|
|
118
|
+
*
|
|
119
|
+
* This method's result is memoized to ensure it runs only once.
|
|
90
120
|
*
|
|
91
|
-
* @
|
|
121
|
+
* Calls {@link proto.temporal.api.workflowservice.v1.WorkflowService.getSystemInfo} internally.
|
|
92
122
|
*/
|
|
93
|
-
|
|
123
|
+
ensureConnected(): Promise<void>;
|
|
94
124
|
/**
|
|
95
|
-
*
|
|
125
|
+
* Create a lazy `Connection` instance.
|
|
96
126
|
*
|
|
97
|
-
*
|
|
127
|
+
* This method does not verify connectivity with the server. We recommend using {@link connect} instead.
|
|
128
|
+
*/
|
|
129
|
+
static lazy(options?: ConnectionOptions): Connection;
|
|
130
|
+
/**
|
|
131
|
+
* Establish a connection with the server and return a `Connection` instance.
|
|
98
132
|
*
|
|
99
|
-
*
|
|
133
|
+
* This is the preferred method of creating connections as it verifies connectivity by calling
|
|
134
|
+
* {@link ensureConnected}.
|
|
100
135
|
*/
|
|
101
|
-
|
|
136
|
+
static connect(options?: ConnectionOptions): Promise<Connection>;
|
|
137
|
+
protected constructor({ options, client, workflowService, operatorService, callContextStorage, }: ConnectionCtorOptions);
|
|
138
|
+
protected static generateRPCImplementation({ serviceName, client, callContextStorage, interceptors, }: RPCImplOptions): RPCImpl;
|
|
102
139
|
/**
|
|
103
|
-
* Set the
|
|
140
|
+
* Set the deadline for any service requests executed in `fn`'s scope.
|
|
104
141
|
*
|
|
105
|
-
* @returns returned
|
|
142
|
+
* @returns value returned from `fn`
|
|
106
143
|
*/
|
|
107
|
-
|
|
144
|
+
withDeadline<ReturnType>(deadline: number | Date, fn: () => Promise<ReturnType>): Promise<ReturnType>;
|
|
108
145
|
/**
|
|
109
|
-
* Set
|
|
146
|
+
* Set metadata for any service requests executed in `fn`'s scope.
|
|
147
|
+
*
|
|
148
|
+
* The provided metadata is merged on top of any existing metadata in current scope, including metadata provided in
|
|
149
|
+
* {@link ConnectionOptions.metadata}.
|
|
110
150
|
*
|
|
111
|
-
* @
|
|
151
|
+
* @returns value returned from `fn`
|
|
112
152
|
*
|
|
113
|
-
* @
|
|
153
|
+
* @example
|
|
154
|
+
*
|
|
155
|
+
*```ts
|
|
156
|
+
*const workflowHandle = await conn.withMetadata({ apiKey: 'secret' }, () =>
|
|
157
|
+
* conn.withMetadata({ otherKey: 'set' }, () => client.start(options)))
|
|
158
|
+
*);
|
|
159
|
+
*```
|
|
114
160
|
*/
|
|
115
|
-
|
|
161
|
+
withMetadata<ReturnType>(metadata: Metadata, fn: () => Promise<ReturnType>): Promise<ReturnType>;
|
|
116
162
|
/**
|
|
117
163
|
* Wait for successful connection to the server.
|
|
118
164
|
*
|
|
119
|
-
* @param waitTimeMs milliseconds to wait before giving up.
|
|
120
|
-
*
|
|
121
165
|
* @see https://grpc.github.io/grpc/node/grpc.Client.html#waitForReady__anchor
|
|
122
166
|
*/
|
|
123
|
-
untilReady(
|
|
167
|
+
protected untilReady(deadline: number): Promise<void>;
|
|
168
|
+
/**
|
|
169
|
+
* Close the underlying gRPC client.
|
|
170
|
+
*
|
|
171
|
+
* Make sure to call this method to ensure proper resource cleanup.
|
|
172
|
+
*/
|
|
173
|
+
close(): Promise<void>;
|
|
124
174
|
}
|
package/lib/connection.js
CHANGED
|
@@ -22,21 +22,27 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
22
22
|
__setModuleDefault(result, mod);
|
|
23
23
|
return result;
|
|
24
24
|
};
|
|
25
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
+
};
|
|
25
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.Connection = exports.defaultConnectionOpts = exports.
|
|
29
|
+
exports.Connection = exports.defaultConnectionOpts = exports.LOCAL_TARGET = void 0;
|
|
27
30
|
const grpc = __importStar(require("@grpc/grpc-js"));
|
|
28
31
|
const internal_non_workflow_common_1 = require("@temporalio/internal-non-workflow-common");
|
|
29
|
-
const proto_1 = require("@temporalio/proto");
|
|
30
32
|
const async_hooks_1 = require("async_hooks");
|
|
33
|
+
const errors_1 = require("./errors");
|
|
31
34
|
const grpc_retry_1 = require("./grpc-retry");
|
|
32
|
-
|
|
33
|
-
|
|
35
|
+
const pkg_1 = __importDefault(require("./pkg"));
|
|
36
|
+
const types_1 = require("./types");
|
|
37
|
+
exports.LOCAL_TARGET = '127.0.0.1:7233';
|
|
34
38
|
function defaultConnectionOpts() {
|
|
35
39
|
return {
|
|
36
|
-
address: exports.
|
|
40
|
+
address: exports.LOCAL_TARGET,
|
|
37
41
|
credentials: grpc.credentials.createInsecure(),
|
|
38
42
|
channelArgs: {},
|
|
39
43
|
interceptors: [(0, grpc_retry_1.makeGrpcRetryInterceptor)((0, grpc_retry_1.defaultGrpcRetryOptions)())],
|
|
44
|
+
metadata: {},
|
|
45
|
+
connectTimeoutMs: 10000,
|
|
40
46
|
};
|
|
41
47
|
}
|
|
42
48
|
exports.defaultConnectionOpts = defaultConnectionOpts;
|
|
@@ -77,57 +83,154 @@ function normalizeGRPCConfig(options) {
|
|
|
77
83
|
}
|
|
78
84
|
}
|
|
79
85
|
/**
|
|
80
|
-
* Client connection to the Temporal
|
|
86
|
+
* Client connection to the Temporal Server
|
|
87
|
+
*
|
|
88
|
+
* ⚠️ Connections are expensive to construct and should be reused. Make sure to {@link close} any unused connections to
|
|
89
|
+
* avoid leaking resources.
|
|
81
90
|
*/
|
|
82
91
|
class Connection {
|
|
83
|
-
constructor(options) {
|
|
84
|
-
this.
|
|
85
|
-
this.
|
|
92
|
+
constructor({ options, client, workflowService, operatorService, callContextStorage, }) {
|
|
93
|
+
this.options = options;
|
|
94
|
+
this.client = client;
|
|
95
|
+
this.workflowService = workflowService;
|
|
96
|
+
this.operatorService = operatorService;
|
|
97
|
+
this.callContextStorage = callContextStorage;
|
|
98
|
+
}
|
|
99
|
+
static createCtorOptions(options) {
|
|
100
|
+
var _a, _b;
|
|
101
|
+
const optionsWithDefaults = {
|
|
86
102
|
...defaultConnectionOpts(),
|
|
87
|
-
...normalizeGRPCConfig(options),
|
|
103
|
+
...(0, internal_non_workflow_common_1.filterNullAndUndefined)(normalizeGRPCConfig(options)),
|
|
104
|
+
};
|
|
105
|
+
// Allow overriding this
|
|
106
|
+
(_a = optionsWithDefaults.metadata)['client-name'] ?? (_a['client-name'] = 'temporal-typescript');
|
|
107
|
+
(_b = optionsWithDefaults.metadata)['client-version'] ?? (_b['client-version'] = pkg_1.default.version);
|
|
108
|
+
const client = new this.Client(optionsWithDefaults.address, optionsWithDefaults.credentials, optionsWithDefaults.channelArgs);
|
|
109
|
+
const callContextStorage = new async_hooks_1.AsyncLocalStorage();
|
|
110
|
+
callContextStorage.enterWith({ metadata: optionsWithDefaults.metadata });
|
|
111
|
+
const workflowRpcImpl = this.generateRPCImplementation({
|
|
112
|
+
serviceName: 'temporal.api.workflowservice.v1.WorkflowService',
|
|
113
|
+
client,
|
|
114
|
+
callContextStorage,
|
|
115
|
+
interceptors: optionsWithDefaults?.interceptors,
|
|
116
|
+
});
|
|
117
|
+
const workflowService = types_1.WorkflowService.create(workflowRpcImpl, false, false);
|
|
118
|
+
const operatorRpcImpl = this.generateRPCImplementation({
|
|
119
|
+
serviceName: 'temporal.api.operatorservice.v1.OperatorService',
|
|
120
|
+
client,
|
|
121
|
+
callContextStorage,
|
|
122
|
+
interceptors: optionsWithDefaults?.interceptors,
|
|
123
|
+
});
|
|
124
|
+
const operatorService = types_1.OperatorService.create(operatorRpcImpl, false, false);
|
|
125
|
+
return {
|
|
126
|
+
client,
|
|
127
|
+
callContextStorage,
|
|
128
|
+
workflowService,
|
|
129
|
+
operatorService,
|
|
130
|
+
options: optionsWithDefaults,
|
|
88
131
|
};
|
|
89
|
-
this.client = new Connection.Client(this.options.address, this.options.credentials, this.options.channelArgs);
|
|
90
|
-
const rpcImpl = this.generateRPCImplementation('temporal.api.workflowservice.v1.WorkflowService');
|
|
91
|
-
this.service = exports.WorkflowService.create(rpcImpl, false, false);
|
|
92
132
|
}
|
|
93
|
-
|
|
133
|
+
/**
|
|
134
|
+
* Ensure connection can be established.
|
|
135
|
+
*
|
|
136
|
+
* Does not need to be called if you use {@link connect}.
|
|
137
|
+
*
|
|
138
|
+
* This method's result is memoized to ensure it runs only once.
|
|
139
|
+
*
|
|
140
|
+
* Calls {@link proto.temporal.api.workflowservice.v1.WorkflowService.getSystemInfo} internally.
|
|
141
|
+
*/
|
|
142
|
+
async ensureConnected() {
|
|
143
|
+
if (this.connectPromise == null) {
|
|
144
|
+
const deadline = Date.now() + this.options.connectTimeoutMs;
|
|
145
|
+
this.connectPromise = (async () => {
|
|
146
|
+
await this.untilReady(deadline);
|
|
147
|
+
try {
|
|
148
|
+
await this.withDeadline(deadline, () => this.workflowService.getSystemInfo({}));
|
|
149
|
+
}
|
|
150
|
+
catch (err) {
|
|
151
|
+
if ((0, errors_1.isServerErrorResponse)(err)) {
|
|
152
|
+
// Ignore old servers
|
|
153
|
+
if (err.code !== grpc.status.UNIMPLEMENTED) {
|
|
154
|
+
throw new errors_1.ServiceError('Failed to connect to Temporal server', { cause: err });
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
else {
|
|
158
|
+
throw err;
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
})();
|
|
162
|
+
}
|
|
163
|
+
return this.connectPromise;
|
|
164
|
+
}
|
|
165
|
+
/**
|
|
166
|
+
* Create a lazy `Connection` instance.
|
|
167
|
+
*
|
|
168
|
+
* This method does not verify connectivity with the server. We recommend using {@link connect} instead.
|
|
169
|
+
*/
|
|
170
|
+
static lazy(options) {
|
|
171
|
+
return new this(this.createCtorOptions(options));
|
|
172
|
+
}
|
|
173
|
+
/**
|
|
174
|
+
* Establish a connection with the server and return a `Connection` instance.
|
|
175
|
+
*
|
|
176
|
+
* This is the preferred method of creating connections as it verifies connectivity by calling
|
|
177
|
+
* {@link ensureConnected}.
|
|
178
|
+
*/
|
|
179
|
+
static async connect(options) {
|
|
180
|
+
const conn = this.lazy(options);
|
|
181
|
+
await conn.ensureConnected();
|
|
182
|
+
return conn;
|
|
183
|
+
}
|
|
184
|
+
static generateRPCImplementation({ serviceName, client, callContextStorage, interceptors, }) {
|
|
94
185
|
return (method, requestData, callback) => {
|
|
95
186
|
const metadataContainer = new grpc.Metadata();
|
|
96
|
-
const { metadata, deadline } =
|
|
187
|
+
const { metadata, deadline } = callContextStorage.getStore() ?? {};
|
|
97
188
|
if (metadata != null) {
|
|
98
189
|
for (const [k, v] of Object.entries(metadata)) {
|
|
99
190
|
metadataContainer.set(k, v);
|
|
100
191
|
}
|
|
101
192
|
}
|
|
102
|
-
return
|
|
193
|
+
return client.makeUnaryRequest(`/${serviceName}/${method.name}`, (arg) => arg, (arg) => arg, requestData, metadataContainer, { interceptors, deadline }, callback);
|
|
103
194
|
};
|
|
104
195
|
}
|
|
105
196
|
/**
|
|
106
197
|
* Set the deadline for any service requests executed in `fn`'s scope.
|
|
198
|
+
*
|
|
199
|
+
* @returns value returned from `fn`
|
|
107
200
|
*/
|
|
108
201
|
async withDeadline(deadline, fn) {
|
|
109
202
|
const cc = this.callContextStorage.getStore();
|
|
110
203
|
return await this.callContextStorage.run({ deadline, metadata: cc?.metadata }, fn);
|
|
111
204
|
}
|
|
205
|
+
/**
|
|
206
|
+
* Set metadata for any service requests executed in `fn`'s scope.
|
|
207
|
+
*
|
|
208
|
+
* The provided metadata is merged on top of any existing metadata in current scope, including metadata provided in
|
|
209
|
+
* {@link ConnectionOptions.metadata}.
|
|
210
|
+
*
|
|
211
|
+
* @returns value returned from `fn`
|
|
212
|
+
*
|
|
213
|
+
* @example
|
|
214
|
+
*
|
|
215
|
+
*```ts
|
|
216
|
+
*const workflowHandle = await conn.withMetadata({ apiKey: 'secret' }, () =>
|
|
217
|
+
* conn.withMetadata({ otherKey: 'set' }, () => client.start(options)))
|
|
218
|
+
*);
|
|
219
|
+
*```
|
|
220
|
+
*/
|
|
112
221
|
async withMetadata(metadata, fn) {
|
|
113
222
|
const cc = this.callContextStorage.getStore();
|
|
114
|
-
metadata =
|
|
223
|
+
metadata = { ...cc?.metadata, ...metadata };
|
|
115
224
|
return await this.callContextStorage.run({ metadata, deadline: cc?.deadline }, fn);
|
|
116
225
|
}
|
|
117
|
-
async withCallContext(cx, fn) {
|
|
118
|
-
cx = typeof cx === 'function' ? cx(this.callContextStorage.getStore()) : cx;
|
|
119
|
-
return await this.callContextStorage.run(cx, fn);
|
|
120
|
-
}
|
|
121
226
|
/**
|
|
122
227
|
* Wait for successful connection to the server.
|
|
123
228
|
*
|
|
124
|
-
* @param waitTimeMs milliseconds to wait before giving up.
|
|
125
|
-
*
|
|
126
229
|
* @see https://grpc.github.io/grpc/node/grpc.Client.html#waitForReady__anchor
|
|
127
230
|
*/
|
|
128
|
-
async untilReady(
|
|
231
|
+
async untilReady(deadline) {
|
|
129
232
|
return new Promise((resolve, reject) => {
|
|
130
|
-
this.client.waitForReady(
|
|
233
|
+
this.client.waitForReady(deadline, (err) => {
|
|
131
234
|
if (err) {
|
|
132
235
|
reject(err);
|
|
133
236
|
}
|
|
@@ -137,7 +240,19 @@ class Connection {
|
|
|
137
240
|
});
|
|
138
241
|
});
|
|
139
242
|
}
|
|
243
|
+
// This method is async for uniformity with NativeConnection which could be used in the future to power clients
|
|
244
|
+
/**
|
|
245
|
+
* Close the underlying gRPC client.
|
|
246
|
+
*
|
|
247
|
+
* Make sure to call this method to ensure proper resource cleanup.
|
|
248
|
+
*/
|
|
249
|
+
async close() {
|
|
250
|
+
this.client.close();
|
|
251
|
+
}
|
|
140
252
|
}
|
|
141
253
|
exports.Connection = Connection;
|
|
254
|
+
/**
|
|
255
|
+
* @internal
|
|
256
|
+
*/
|
|
142
257
|
Connection.Client = grpc.makeGenericClientConstructor({}, 'WorkflowService', {});
|
|
143
258
|
//# sourceMappingURL=connection.js.map
|
package/lib/connection.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"connection.js","sourceRoot":"","sources":["../src/connection.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