@temporalio/client 1.2.0 → 1.3.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.
@@ -27,9 +27,9 @@ export declare class ActivityCancelledError extends Error {
27
27
  */
28
28
  export interface AsyncCompletionClientOptions {
29
29
  /**
30
- * {@link DataConverter} to use for serializing and deserializing payloads
30
+ * {@link DataConverter} or {@link LoadedDataConverter} to use for serializing and deserializing payloads
31
31
  */
32
- dataConverter?: DataConverter;
32
+ dataConverter?: DataConverter | LoadedDataConverter;
33
33
  /**
34
34
  * Identity to report to the server
35
35
  *
@@ -47,6 +47,9 @@ export interface AsyncCompletionClientOptions {
47
47
  export declare type AsyncCompletionClientOptionsWithDefaults = Replace<Required<AsyncCompletionClientOptions>, {
48
48
  connection?: ConnectionLike;
49
49
  }>;
50
+ export declare type LoadedAsyncCompletionClientOptions = AsyncCompletionClientOptionsWithDefaults & {
51
+ loadedDataConverter: LoadedDataConverter;
52
+ };
50
53
  export declare function defaultAsyncCompletionClientOptions(): AsyncCompletionClientOptionsWithDefaults;
51
54
  /**
52
55
  * A mostly unique Activity identifier including its scheduling workflow's ID
@@ -62,13 +65,22 @@ export interface FullActivityId {
62
65
  }
63
66
  /**
64
67
  * A client for asynchronous completion and heartbeating of Activities.
68
+ *
69
+ * Typically this client should not be instantiated directly, instead create the high level {@link Client} and use
70
+ * {@link Client.activity} to complete async activities.
65
71
  */
66
72
  export declare class AsyncCompletionClient {
67
- readonly options: AsyncCompletionClientOptionsWithDefaults;
68
- protected readonly dataConverter: LoadedDataConverter;
73
+ readonly options: LoadedAsyncCompletionClientOptions;
69
74
  readonly connection: ConnectionLike;
70
75
  constructor(options?: AsyncCompletionClientOptions);
76
+ /**
77
+ * Raw gRPC access to the Temporal service.
78
+ *
79
+ * **NOTE**: The namespace provided in {@link options} is **not** automatically set on requests made via this service
80
+ * object.
81
+ */
71
82
  get workflowService(): WorkflowService;
83
+ protected get dataConverter(): LoadedDataConverter;
72
84
  /**
73
85
  * Transforms grpc errors into well defined TS errors.
74
86
  */
@@ -53,16 +53,33 @@ function defaultAsyncCompletionClientOptions() {
53
53
  exports.defaultAsyncCompletionClientOptions = defaultAsyncCompletionClientOptions;
54
54
  /**
55
55
  * A client for asynchronous completion and heartbeating of Activities.
56
+ *
57
+ * Typically this client should not be instantiated directly, instead create the high level {@link Client} and use
58
+ * {@link Client.activity} to complete async activities.
56
59
  */
57
60
  class AsyncCompletionClient {
58
61
  constructor(options) {
59
62
  this.connection = options?.connection ?? connection_1.Connection.lazy();
60
- this.dataConverter = (0, internal_non_workflow_common_1.loadDataConverter)(options?.dataConverter);
61
- this.options = { ...defaultAsyncCompletionClientOptions(), ...(0, internal_non_workflow_common_1.filterNullAndUndefined)(options ?? {}) };
63
+ const dataConverter = options?.dataConverter;
64
+ const loadedDataConverter = (0, internal_non_workflow_common_1.isLoadedDataConverter)(dataConverter) ? dataConverter : (0, internal_non_workflow_common_1.loadDataConverter)(dataConverter);
65
+ this.options = {
66
+ ...defaultAsyncCompletionClientOptions(),
67
+ ...(0, internal_non_workflow_common_1.filterNullAndUndefined)(options ?? {}),
68
+ loadedDataConverter,
69
+ };
62
70
  }
71
+ /**
72
+ * Raw gRPC access to the Temporal service.
73
+ *
74
+ * **NOTE**: The namespace provided in {@link options} is **not** automatically set on requests made via this service
75
+ * object.
76
+ */
63
77
  get workflowService() {
64
78
  return this.connection.workflowService;
65
79
  }
80
+ get dataConverter() {
81
+ return this.options.loadedDataConverter;
82
+ }
66
83
  /**
67
84
  * Transforms grpc errors into well defined TS errors.
68
85
  */
@@ -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;AAElD,4CAAoB;AACpB,6CAA0C;AAC1C,qCAAiD;AAGjD;;;GAGG;AACH,MAAa,qBAAsB,SAAQ,KAAK;IAAhD;;QACkB,SA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E,QAAQ,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;AA9KD,sDA8KC"}
@@ -0,0 +1,92 @@
1
+ import { DataConverter, LoadedDataConverter } from '@temporalio/common';
2
+ import { Replace } from '@temporalio/internal-workflow-common';
3
+ import { temporal } from '@temporalio/proto';
4
+ import { AsyncCompletionClient } from './async-completion-client';
5
+ import { ClientInterceptors } from './interceptors';
6
+ import { ConnectionLike, Metadata, WorkflowService } from './types';
7
+ import { WorkflowClient } from './workflow-client';
8
+ export interface ClientOptions {
9
+ /**
10
+ * {@link DataConverter} to use for serializing and deserializing payloads
11
+ */
12
+ dataConverter?: DataConverter;
13
+ /**
14
+ * Used to override and extend default Connection functionality
15
+ *
16
+ * Useful for injecting auth headers and tracing Workflow executions
17
+ */
18
+ interceptors?: ClientInterceptors;
19
+ /**
20
+ * Identity to report to the server
21
+ *
22
+ * @default `${process.pid}@${os.hostname()}`
23
+ */
24
+ identity?: string;
25
+ /**
26
+ * Connection to use to communicate with the server.
27
+ *
28
+ * By default `WorkflowClient` connects to localhost.
29
+ *
30
+ * Connections are expensive to construct and should be reused.
31
+ */
32
+ connection?: ConnectionLike;
33
+ /**
34
+ * Server namespace
35
+ *
36
+ * @default default
37
+ */
38
+ namespace?: string;
39
+ workflow?: {
40
+ /**
41
+ * Should a query be rejected by closed and failed workflows
42
+ *
43
+ * @default QUERY_REJECT_CONDITION_UNSPECIFIED which means that closed and failed workflows are still queryable
44
+ */
45
+ queryRejectCondition?: temporal.api.enums.v1.QueryRejectCondition;
46
+ };
47
+ }
48
+ export declare type ClientOptionsWithDefaults = Replace<Required<ClientOptions>, {
49
+ connection?: ConnectionLike;
50
+ }>;
51
+ export declare type LoadedClientOptions = ClientOptionsWithDefaults & {
52
+ loadedDataConverter: LoadedDataConverter;
53
+ };
54
+ export declare function defaultClientOptions(): ClientOptionsWithDefaults;
55
+ /**
56
+ * High level SDK client.
57
+ */
58
+ export declare class Client {
59
+ /**
60
+ * Underlying gRPC connection to the Temporal service
61
+ */
62
+ readonly connection: ConnectionLike;
63
+ readonly options: LoadedClientOptions;
64
+ /**
65
+ * Workflow sub-client - use to start and interact with Workflows
66
+ */
67
+ readonly workflow: WorkflowClient;
68
+ /**
69
+ * (Async) Activity completion sub-client - use to manually manage Activities
70
+ */
71
+ readonly activity: AsyncCompletionClient;
72
+ constructor(options?: ClientOptions);
73
+ /**
74
+ * Raw gRPC access to the Temporal service.
75
+ *
76
+ * **NOTE**: The namespace provided in {@link options} is **not** automatically set on requests made via this service
77
+ * object.
78
+ */
79
+ get workflowService(): WorkflowService;
80
+ /**
81
+ * Set the deadline for any service requests executed in `fn`'s scope.
82
+ */
83
+ withDeadline<R>(deadline: number | Date, fn: () => Promise<R>): Promise<R>;
84
+ /**
85
+ * Set metadata for any service requests executed in `fn`'s scope.
86
+ *
87
+ * @returns returned value of `fn`
88
+ *
89
+ * @see {@link Connection.withMetadata}
90
+ */
91
+ withMetadata<R>(metadata: Metadata, fn: () => Promise<R>): Promise<R>;
92
+ }
package/lib/client.js ADDED
@@ -0,0 +1,77 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.Client = exports.defaultClientOptions = void 0;
7
+ const internal_non_workflow_common_1 = require("@temporalio/internal-non-workflow-common");
8
+ const proto_1 = require("@temporalio/proto");
9
+ const os_1 = __importDefault(require("os"));
10
+ const async_completion_client_1 = require("./async-completion-client");
11
+ const connection_1 = require("./connection");
12
+ const workflow_client_1 = require("./workflow-client");
13
+ function defaultClientOptions() {
14
+ return {
15
+ dataConverter: {},
16
+ identity: `${process.pid}@${os_1.default.hostname()}`,
17
+ interceptors: {},
18
+ namespace: 'default',
19
+ workflow: {
20
+ queryRejectCondition: proto_1.temporal.api.enums.v1.QueryRejectCondition.QUERY_REJECT_CONDITION_UNSPECIFIED,
21
+ },
22
+ };
23
+ }
24
+ exports.defaultClientOptions = defaultClientOptions;
25
+ /**
26
+ * High level SDK client.
27
+ */
28
+ class Client {
29
+ constructor(options) {
30
+ this.connection = options?.connection ?? connection_1.Connection.lazy();
31
+ this.options = {
32
+ ...defaultClientOptions(),
33
+ ...(0, internal_non_workflow_common_1.filterNullAndUndefined)(options ?? {}),
34
+ loadedDataConverter: (0, internal_non_workflow_common_1.loadDataConverter)(options?.dataConverter),
35
+ };
36
+ const { workflow, loadedDataConverter, interceptors, ...base } = this.options;
37
+ this.workflow = new workflow_client_1.WorkflowClient({
38
+ ...base,
39
+ ...workflow,
40
+ connection: this.connection,
41
+ dataConverter: loadedDataConverter,
42
+ interceptors: interceptors.workflow,
43
+ });
44
+ this.activity = new async_completion_client_1.AsyncCompletionClient({
45
+ ...base,
46
+ connection: this.connection,
47
+ dataConverter: loadedDataConverter,
48
+ });
49
+ }
50
+ /**
51
+ * Raw gRPC access to the Temporal service.
52
+ *
53
+ * **NOTE**: The namespace provided in {@link options} is **not** automatically set on requests made via this service
54
+ * object.
55
+ */
56
+ get workflowService() {
57
+ return this.connection.workflowService;
58
+ }
59
+ /**
60
+ * Set the deadline for any service requests executed in `fn`'s scope.
61
+ */
62
+ async withDeadline(deadline, fn) {
63
+ return await this.connection.withDeadline(deadline, fn);
64
+ }
65
+ /**
66
+ * Set metadata for any service requests executed in `fn`'s scope.
67
+ *
68
+ * @returns returned value of `fn`
69
+ *
70
+ * @see {@link Connection.withMetadata}
71
+ */
72
+ async withMetadata(metadata, fn) {
73
+ return await this.connection.withMetadata(metadata, fn);
74
+ }
75
+ }
76
+ exports.Client = Client;
77
+ //# sourceMappingURL=client.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":";;;;;;AACA,2FAAqG;AAErG,6CAA6C;AAC7C,4CAAoB;AACpB,uEAAkE;AAClE,6CAA0C;AAG1C,uDAAmD;AA2DnD,SAAgB,oBAAoB;IAClC,OAAO;QACL,aAAa,EAAE,EAAE;QACjB,QAAQ,EAAE,GAAG,OAAO,CAAC,GAAG,IAAI,YAAE,CAAC,QAAQ,EAAE,EAAE;QAC3C,YAAY,EAAE,EAAE;QAChB,SAAS,EAAE,SAAS;QACpB,QAAQ,EAAE;YACR,oBAAoB,EAAE,gBAAQ,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,oBAAoB,CAAC,kCAAkC;SACpG;KACF,CAAC;AACJ,CAAC;AAVD,oDAUC;AAED;;GAEG;AACH,MAAa,MAAM;IAejB,YAAY,OAAuB;QACjC,IAAI,CAAC,UAAU,GAAG,OAAO,EAAE,UAAU,IAAI,uBAAU,CAAC,IAAI,EAAE,CAAC;QAC3D,IAAI,CAAC,OAAO,GAAG;YACb,GAAG,oBAAoB,EAAE;YACzB,GAAG,IAAA,qDAAsB,EAAC,OAAO,IAAI,EAAE,CAAC;YACxC,mBAAmB,EAAE,IAAA,gDAAiB,EAAC,OAAO,EAAE,aAAa,CAAC;SAC/D,CAAC;QAEF,MAAM,EAAE,QAAQ,EAAE,mBAAmB,EAAE,YAAY,EAAE,GAAG,IAAI,EAAE,GAAG,IAAI,CAAC,OAAO,CAAC;QAE9E,IAAI,CAAC,QAAQ,GAAG,IAAI,gCAAc,CAAC;YACjC,GAAG,IAAI;YACP,GAAG,QAAQ;YACX,UAAU,EAAE,IAAI,CAAC,UAAU;YAC3B,aAAa,EAAE,mBAAmB;YAClC,YAAY,EAAE,YAAY,CAAC,QAAQ;SACpC,CAAC,CAAC;QAEH,IAAI,CAAC,QAAQ,GAAG,IAAI,+CAAqB,CAAC;YACxC,GAAG,IAAI;YACP,UAAU,EAAE,IAAI,CAAC,UAAU;YAC3B,aAAa,EAAE,mBAAmB;SACnC,CAAC,CAAC;IACL,CAAC;IAED;;;;;OAKG;IACH,IAAI,eAAe;QACjB,OAAO,IAAI,CAAC,UAAU,CAAC,eAAe,CAAC;IACzC,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,YAAY,CAAI,QAAuB,EAAE,EAAoB;QACjE,OAAO,MAAM,IAAI,CAAC,UAAU,CAAC,YAAY,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC;IAC1D,CAAC;IAED;;;;;;OAMG;IACH,KAAK,CAAC,YAAY,CAAI,QAAkB,EAAE,EAAoB;QAC5D,OAAO,MAAM,IAAI,CAAC,UAAU,CAAC,YAAY,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC;IAC1D,CAAC;CACF;AAnED,wBAmEC"}
@@ -3,7 +3,7 @@ import * as grpc from '@grpc/grpc-js';
3
3
  import { TLSConfig } from '@temporalio/internal-non-workflow-common';
4
4
  import { AsyncLocalStorage } from 'async_hooks';
5
5
  import type { RPCImpl } from 'protobufjs';
6
- import { CallContext, Metadata, OperatorService, WorkflowService } from './types';
6
+ import { CallContext, HealthService, Metadata, OperatorService, WorkflowService } from './types';
7
7
  /**
8
8
  * gRPC and Temporal Server connection options
9
9
  */
@@ -54,7 +54,7 @@ export interface ConnectionOptions {
54
54
  * Used either when connecting eagerly with {@link Connection.connect} or
55
55
  * calling {@link Connection.ensureConnected}.
56
56
  *
57
- * @format {@link https://www.npmjs.com/package/ms | ms} formatted string
57
+ * @format number of milliseconds or {@link https://www.npmjs.com/package/ms | ms-formatted string}
58
58
  * @default 10 seconds
59
59
  */
60
60
  connectTimeout?: number | string;
@@ -79,7 +79,14 @@ export interface ConnectionCtorOptions {
79
79
  * **NOTE**: The namespace provided in {@link options} is **not** automatically set on requests made to the service.
80
80
  */
81
81
  readonly workflowService: WorkflowService;
82
+ /**
83
+ * Raw gRPC access to the Temporal {@link https://github.com/temporalio/api/blob/ddf07ab9933e8230309850e3c579e1ff34b03f53/temporal/api/operatorservice/v1/service.proto | operator service}.
84
+ */
82
85
  readonly operatorService: OperatorService;
86
+ /**
87
+ * Raw gRPC access to the standard gRPC {@link https://github.com/grpc/grpc/blob/92f58c18a8da2728f571138c37760a721c8915a2/doc/health-checking.md | health service}.
88
+ */
89
+ readonly healthService: HealthService;
83
90
  readonly callContextStorage: AsyncLocalStorage<CallContext>;
84
91
  }
85
92
  /**
@@ -109,6 +116,7 @@ export declare class Connection {
109
116
  * {@link https://github.com/temporalio/api/blob/master/temporal/api/operatorservice/v1/service.proto | Operator service}
110
117
  */
111
118
  readonly operatorService: OperatorService;
119
+ readonly healthService: HealthService;
112
120
  readonly callContextStorage: AsyncLocalStorage<CallContext>;
113
121
  protected static createCtorOptions(options?: ConnectionOptions): ConnectionCtorOptions;
114
122
  /**
@@ -134,7 +142,7 @@ export declare class Connection {
134
142
  * {@link ensureConnected}.
135
143
  */
136
144
  static connect(options?: ConnectionOptions): Promise<Connection>;
137
- protected constructor({ options, client, workflowService, operatorService, callContextStorage, }: ConnectionCtorOptions);
145
+ protected constructor({ options, client, workflowService, operatorService, healthService, callContextStorage, }: ConnectionCtorOptions);
138
146
  protected static generateRPCImplementation({ serviceName, client, callContextStorage, interceptors, }: RPCImplOptions): RPCImpl;
139
147
  /**
140
148
  * Set the deadline for any service requests executed in `fn`'s scope.
package/lib/connection.js CHANGED
@@ -93,11 +93,12 @@ function normalizeGRPCConfig(options) {
93
93
  * avoid leaking resources.
94
94
  */
95
95
  class Connection {
96
- constructor({ options, client, workflowService, operatorService, callContextStorage, }) {
96
+ constructor({ options, client, workflowService, operatorService, healthService, callContextStorage, }) {
97
97
  this.options = options;
98
98
  this.client = client;
99
99
  this.workflowService = workflowService;
100
100
  this.operatorService = operatorService;
101
+ this.healthService = healthService;
101
102
  this.callContextStorage = callContextStorage;
102
103
  }
103
104
  static createCtorOptions(options) {
@@ -126,11 +127,19 @@ class Connection {
126
127
  interceptors: optionsWithDefaults?.interceptors,
127
128
  });
128
129
  const operatorService = types_1.OperatorService.create(operatorRpcImpl, false, false);
130
+ const healthRpcImpl = this.generateRPCImplementation({
131
+ serviceName: 'grpc.health.v1.Health',
132
+ client,
133
+ callContextStorage,
134
+ interceptors: optionsWithDefaults?.interceptors,
135
+ });
136
+ const healthService = types_1.HealthService.create(healthRpcImpl, false, false);
129
137
  return {
130
138
  client,
131
139
  callContextStorage,
132
140
  workflowService,
133
141
  operatorService,
142
+ healthService,
134
143
  options: optionsWithDefaults,
135
144
  };
136
145
  }
@@ -1 +1 @@
1
- {"version":3,"file":"connection.js","sourceRoot":"","sources":["../src/connection.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,oDAAsC;AACtC,2FAAiH;AACjH,6CAAgD;AAEhD,qCAA+D;AAC/D,6CAAiF;AACjF,gDAAwB;AACxB,mCAAkF;AAoErE,QAAA,YAAY,GAAG,gBAAgB,CAAC;AAE7C,SAAgB,qBAAqB;IACnC,OAAO;QACL,OAAO,EAAE,oBAAY;QACrB,WAAW,EAAE,IAAI,CAAC,WAAW,CAAC,cAAc,EAAE;QAC9C,WAAW,EAAE;YACX,qCAAqC,EAAE,CAAC;YACxC,wBAAwB,EAAE,KAAM;YAChC,2BAA2B,EAAE,KAAM;SACpC;QACD,YAAY,EAAE,CAAC,IAAA,qCAAwB,EAAC,IAAA,oCAAuB,GAAE,CAAC,CAAC;QACnE,QAAQ,EAAE,EAAE;QACZ,gBAAgB,EAAE,KAAM;KACzB,CAAC;AACJ,CAAC;AAbD,sDAaC;AAED;;;;GAIG;AACH,SAAS,mBAAmB,CAAC,OAA2B;IACtD,MAAM,EAAE,GAAG,EAAE,aAAa,EAAE,WAAW,EAAE,GAAG,IAAI,EAAE,GAAG,OAAO,IAAI,EAAE,CAAC;IACnE,IAAI,IA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M;oBACL,OAAO,EAAE,CAAC;iBACX;YACH,CAAC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC;IAED,+GAA+G;IAC/G;;;;OAIG;IACI,KAAK,CAAC,KAAK;QAChB,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC;IACtB,CAAC;;AArOH,gCAsOC;AArOC;;GAEG;AACoB,iBAAM,GAAG,IAAI,CAAC,4BAA4B,CAAC,EAAE,EAAE,iBAAiB,EAAE,EAAE,CAAC,CAAC"}
package/lib/index.d.ts CHANGED
@@ -15,6 +15,7 @@ export * from '@temporalio/internal-workflow-common/lib/errors';
15
15
  export * from '@temporalio/internal-workflow-common/lib/interfaces';
16
16
  export * from '@temporalio/internal-workflow-common/lib/workflow-handle';
17
17
  export * from './async-completion-client';
18
+ export * from './client';
18
19
  export { Connection, ConnectionOptions, ConnectionOptionsWithDefaults, LOCAL_TARGET } from './connection';
19
20
  export * from './errors';
20
21
  export * from './grpc-retry';
package/lib/index.js CHANGED
@@ -39,6 +39,7 @@ __exportStar(require("@temporalio/internal-workflow-common/lib/errors"), exports
39
39
  __exportStar(require("@temporalio/internal-workflow-common/lib/interfaces"), exports);
40
40
  __exportStar(require("@temporalio/internal-workflow-common/lib/workflow-handle"), exports);
41
41
  __exportStar(require("./async-completion-client"), exports);
42
+ __exportStar(require("./client"), exports);
42
43
  var connection_1 = require("./connection");
43
44
  Object.defineProperty(exports, "Connection", { enumerable: true, get: function () { return connection_1.Connection; } });
44
45
  Object.defineProperty(exports, "LOCAL_TARGET", { enumerable: true, get: function () { return connection_1.LOCAL_TARGET; } });
package/lib/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;GASG;;;;;;;;;;;;;;;;;AAEH,6CAY4B;AAX1B,yGAAA,eAAe,OAAA;AACf,4GAAA,kBAAkB,OAAA;AAClB,0GAAA,gBAAgB,OAAA;AAChB,8GAAA,oBAAoB,OAAA;AAEpB,iHAAA,uBAAuB,OAAA;AAEvB,uGAAA,aAAa,OAAA;AACb,yGAAA,eAAe,OAAA;AACf,2GAAA,iBAAiB,OAAA;AACjB,wGAAA,cAAc,OAAA;AAIhB,kFAAgE;AAChE,sFAAoE;AACpE,2FAAyE;AACzE,4DAA0C;AAC1C,2CAA0G;AAAjG,wGAAA,UAAU,OAAA;AAAoD,0GAAA,YAAY,OAAA;AACnF,2CAAyB;AACzB,+CAA6B;AAC7B,iDAA+B;AAC/B,0CAAwB;AACxB,oDAAkC;AAClC,qDAAmC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;GASG;;;;;;;;;;;;;;;;;AAEH,6CAY4B;AAX1B,yGAAA,eAAe,OAAA;AACf,4GAAA,kBAAkB,OAAA;AAClB,0GAAA,gBAAgB,OAAA;AAChB,8GAAA,oBAAoB,OAAA;AAEpB,iHAAA,uBAAuB,OAAA;AAEvB,uGAAA,aAAa,OAAA;AACb,yGAAA,eAAe,OAAA;AACf,2GAAA,iBAAiB,OAAA;AACjB,wGAAA,cAAc,OAAA;AAIhB,kFAAgE;AAChE,sFAAoE;AACpE,2FAAyE;AACzE,4DAA0C;AAC1C,2CAAyB;AACzB,2CAA0G;AAAjG,wGAAA,UAAU,OAAA;AAAoD,0GAAA,YAAY,OAAA;AACnF,2CAAyB;AACzB,+CAA6B;AAC7B,iDAA+B;AAC/B,0CAAwB;AACxB,oDAAkC;AAClC,qDAAmC"}
@@ -93,7 +93,7 @@ export interface WorkflowClientCallsInterceptor {
93
93
  */
94
94
  describe?: (input: WorkflowDescribeInput, next: Next<this, 'describe'>) => Promise<DescribeWorkflowExecutionResponse>;
95
95
  }
96
- interface WorkflowClientCallsInterceptorFactoryInput {
96
+ export interface WorkflowClientCallsInterceptorFactoryInput {
97
97
  workflowId: string;
98
98
  runId?: string;
99
99
  }
@@ -109,3 +109,11 @@ export interface WorkflowClientCallsInterceptorFactory {
109
109
  export interface WorkflowClientInterceptors {
110
110
  calls?: WorkflowClientCallsInterceptorFactory[];
111
111
  }
112
+ /**
113
+ * Interceptors for any high-level SDK client.
114
+ *
115
+ * NOTE: Currently only for {@link WorkflowClient}. More will be added later as needed.
116
+ */
117
+ export interface ClientInterceptors {
118
+ workflow?: WorkflowClientInterceptors;
119
+ }
package/lib/types.d.ts CHANGED
@@ -1,16 +1,15 @@
1
1
  import type { SearchAttributes } from '@temporalio/internal-workflow-common';
2
- import { temporal } from '@temporalio/proto';
2
+ import * as proto from '@temporalio/proto';
3
3
  import type * as grpc from '@grpc/grpc-js';
4
- import Long from 'long';
5
4
  export interface WorkflowExecution {
6
5
  workflowId: string;
7
6
  runId?: string;
8
7
  }
9
- export declare type StartWorkflowExecutionRequest = temporal.api.workflowservice.v1.IStartWorkflowExecutionRequest;
10
- export declare type GetWorkflowExecutionHistoryRequest = temporal.api.workflowservice.v1.IGetWorkflowExecutionHistoryRequest;
11
- export declare type DescribeWorkflowExecutionResponse = temporal.api.workflowservice.v1.IDescribeWorkflowExecutionResponse;
12
- export declare type TerminateWorkflowExecutionResponse = temporal.api.workflowservice.v1.ITerminateWorkflowExecutionResponse;
13
- export declare type RequestCancelWorkflowExecutionResponse = temporal.api.workflowservice.v1.IRequestCancelWorkflowExecutionResponse;
8
+ export declare type StartWorkflowExecutionRequest = proto.temporal.api.workflowservice.v1.IStartWorkflowExecutionRequest;
9
+ export declare type GetWorkflowExecutionHistoryRequest = proto.temporal.api.workflowservice.v1.IGetWorkflowExecutionHistoryRequest;
10
+ export declare type DescribeWorkflowExecutionResponse = proto.temporal.api.workflowservice.v1.IDescribeWorkflowExecutionResponse;
11
+ export declare type TerminateWorkflowExecutionResponse = proto.temporal.api.workflowservice.v1.ITerminateWorkflowExecutionResponse;
12
+ export declare type RequestCancelWorkflowExecutionResponse = proto.temporal.api.workflowservice.v1.IRequestCancelWorkflowExecutionResponse;
14
13
  export declare type WorkflowExecutionStatusName = 'UNSPECIFIED' | 'RUNNING' | 'COMPLETED' | 'FAILED' | 'CANCELLED' | 'TERMINATED' | 'CONTINUED_AS_NEW' | 'TIMED_OUT' | 'UNKNOWN';
15
14
  export interface WorkflowExecutionDescription {
16
15
  type: string;
@@ -18,22 +17,24 @@ export interface WorkflowExecutionDescription {
18
17
  runId: string;
19
18
  taskQueue: string;
20
19
  status: {
21
- code: temporal.api.enums.v1.WorkflowExecutionStatus;
20
+ code: proto.temporal.api.enums.v1.WorkflowExecutionStatus;
22
21
  name: WorkflowExecutionStatusName;
23
22
  };
24
- historyLength: Long;
23
+ historyLength: number;
25
24
  startTime: Date;
26
25
  executionTime?: Date;
27
26
  closeTime?: Date;
28
27
  memo?: Record<string, unknown>;
29
28
  searchAttributes: SearchAttributes;
30
- parentExecution?: Required<temporal.api.common.v1.IWorkflowExecution>;
29
+ parentExecution?: Required<proto.temporal.api.common.v1.IWorkflowExecution>;
31
30
  raw: DescribeWorkflowExecutionResponse;
32
31
  }
33
- export declare type WorkflowService = temporal.api.workflowservice.v1.WorkflowService;
34
- export declare const WorkflowService: typeof temporal.api.workflowservice.v1.WorkflowService;
35
- export declare type OperatorService = temporal.api.operatorservice.v1.OperatorService;
36
- export declare const OperatorService: typeof temporal.api.operatorservice.v1.OperatorService;
32
+ export declare type WorkflowService = proto.temporal.api.workflowservice.v1.WorkflowService;
33
+ export declare const WorkflowService: typeof proto.temporal.api.workflowservice.v1.WorkflowService;
34
+ export declare type OperatorService = proto.temporal.api.operatorservice.v1.OperatorService;
35
+ export declare const OperatorService: typeof proto.temporal.api.operatorservice.v1.OperatorService;
36
+ export declare type HealthService = proto.grpc.health.v1.Health;
37
+ export declare const HealthService: typeof proto.grpc.health.v1.Health;
37
38
  /**
38
39
  * Mapping of string to valid gRPC metadata value
39
40
  */
package/lib/types.js CHANGED
@@ -1,7 +1,31 @@
1
1
  "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
2
25
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.OperatorService = exports.WorkflowService = void 0;
4
- const proto_1 = require("@temporalio/proto");
5
- exports.WorkflowService = proto_1.temporal.api.workflowservice.v1.WorkflowService;
6
- exports.OperatorService = proto_1.temporal.api.operatorservice.v1.OperatorService;
26
+ exports.HealthService = exports.OperatorService = exports.WorkflowService = void 0;
27
+ const proto = __importStar(require("@temporalio/proto"));
28
+ exports.WorkflowService = proto.temporal.api.workflowservice.v1.WorkflowService;
29
+ exports.OperatorService = proto.temporal.api.operatorservice.v1.OperatorService;
30
+ exports.HealthService = proto.grpc.health.v1.Health;
7
31
  //# sourceMappingURL=types.js.map
package/lib/types.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":";;;AACA,6CAA6C;AA2C9B,uBAAe,GAAK,gBAAQ,CAAC,GAAG,CAAC,eAAe,CAAC,EAAE,iBAAC;AAEpD,uBAAe,GAAK,gBAAQ,CAAC,GAAG,CAAC,eAAe,CAAC,EAAE,iBAAC"}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AACA,yDAA2C;AA6C5B,uBAAe,GAAK,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,eAAe,CAAC,EAAE,iBAAC;AAE1D,uBAAe,GAAK,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,eAAe,CAAC,EAAE,iBAAC;AAElD,qBAAa,GAAK,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,QAAC"}
@@ -49,7 +49,17 @@ export interface WorkflowHandle<T extends Workflow = Workflow> extends BaseWorkf
49
49
  */
50
50
  terminate(reason?: string): Promise<TerminateWorkflowExecutionResponse>;
51
51
  /**
52
- * Cancel a running Workflow
52
+ * Cancel a running Workflow.
53
+ *
54
+ * When a Workflow is cancelled, the root scope throws {@link CancelledFailure} with `message: 'Workflow canceled'`.
55
+ * That means that all cancellable scopes will throw `CancelledFailure`.
56
+ *
57
+ * Cancellation may be propagated to Activities depending on {@link ActivityOptions#cancellationType}, after which
58
+ * Activity calls may throw an {@link ActivityFailure}, and `isCancellation(error)` will be true (see {@link isCancellation}).
59
+ *
60
+ * Cancellation may be propagated to Child Workflows depending on {@link ChildWorkflowOptions#cancellationType}, after
61
+ * which calls to {@link executeChild} and {@link ChildWorkflowHandle#result} will throw, and `isCancellation(error)`
62
+ * will be true (see {@link isCancellation}).
53
63
  */
54
64
  cancel(): Promise<RequestCancelWorkflowExecutionResponse>;
55
65
  /**
@@ -86,9 +96,9 @@ export interface WorkflowHandleWithSignaledRunId<T extends Workflow = Workflow>
86
96
  }
87
97
  export interface WorkflowClientOptions {
88
98
  /**
89
- * {@link DataConverter} to use for serializing and deserializing payloads
99
+ * {@link DataConverter} or {@link LoadedDataConverter} to use for serializing and deserializing payloads
90
100
  */
91
- dataConverter?: DataConverter;
101
+ dataConverter?: DataConverter | LoadedDataConverter;
92
102
  /**
93
103
  * Used to override and extend default Connection functionality
94
104
  *
@@ -171,7 +181,10 @@ interface WorkflowHandleOptions extends GetWorkflowHandleOptions {
171
181
  */
172
182
  export declare type WorkflowStartOptions<T extends Workflow = Workflow> = WithWorkflowArgs<T, WorkflowOptions>;
173
183
  /**
174
- * Client for starting Workflow executions and creating Workflow handles
184
+ * Client for starting Workflow executions and creating Workflow handles.
185
+ *
186
+ * Typically this client should not be instantiated directly, instead create the high level {@link Client} and use
187
+ * {@link Client.workflow} to interact with Workflows.
175
188
  */
176
189
  export declare class WorkflowClient {
177
190
  readonly options: LoadedWorkflowClientOptions;
@@ -180,9 +193,11 @@ export declare class WorkflowClient {
180
193
  /**
181
194
  * Raw gRPC access to the Temporal service.
182
195
  *
183
- * **NOTE**: The namespace provided in {@link options} is **not** automatically set on requests made to the service.
196
+ * **NOTE**: The namespace provided in {@link options} is **not** automatically set on requests made via this service
197
+ * object.
184
198
  */
185
199
  get workflowService(): WorkflowService;
200
+ protected get dataConverter(): LoadedDataConverter;
186
201
  /**
187
202
  * Set the deadline for any service requests executed in `fn`'s scope.
188
203
  */
@@ -215,12 +230,12 @@ export declare class WorkflowClient {
215
230
  */
216
231
  start<T extends Workflow>(workflowTypeOrFunc: string | T, options: WorkflowStartOptions<T>): Promise<WorkflowHandleWithFirstExecutionRunId<T>>;
217
232
  /**
218
- * Sends a signal to a running Workflow or starts a new one if not already running and immediately signals it.
219
- * Useful when you're unsure of the Workflows' run state.
233
+ * Sends a Signal to a running Workflow or starts a new one if not already running and immediately Signals it.
234
+ * Useful when you're unsure whether the Workflow has been started.
220
235
  *
221
- * @returns a WorkflowHandle to the started Workflow
236
+ * @returns a {@link WorkflowHandle} to the started Workflow
222
237
  */
223
- signalWithStart<T extends Workflow, SA extends any[] = []>(workflowTypeOrFunc: string | T, options: WithWorkflowArgs<T, WorkflowSignalWithStartOptions<SA>>): Promise<WorkflowHandleWithSignaledRunId<T>>;
238
+ signalWithStart<WorkflowFn extends Workflow, SignalArgs extends any[] = []>(workflowTypeOrFunc: string | WorkflowFn, options: WithWorkflowArgs<WorkflowFn, WorkflowSignalWithStartOptions<SignalArgs>>): Promise<WorkflowHandleWithSignaledRunId<WorkflowFn>>;
224
239
  /**
225
240
  * Starts a new Workflow execution and awaits its completion.
226
241
  *