@temporalio/testing 1.13.1 → 1.13.2

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.
@@ -1,7 +1,7 @@
1
1
  import 'abort-controller/polyfill';
2
- import { AsyncCompletionClient, Client, Connection, WorkflowClient } from '@temporalio/client';
2
+ import { AsyncCompletionClient, Client, ClientPlugin, Connection, ConnectionPlugin, WorkflowClient } from '@temporalio/client';
3
3
  import { Duration } from '@temporalio/common';
4
- import { NativeConnection, Runtime } from '@temporalio/worker';
4
+ import { NativeConnection, NativeConnectionPlugin, Runtime } from '@temporalio/worker';
5
5
  import { native } from '@temporalio/core-bridge';
6
6
  import { DevServerConfig, TimeSkippingServerConfig } from './ephemeral-server';
7
7
  import { ClientOptionsForTestEnv } from './client';
@@ -11,6 +11,7 @@ import { ClientOptionsForTestEnv } from './client';
11
11
  export type LocalTestWorkflowEnvironmentOptions = {
12
12
  server?: Omit<DevServerConfig, 'type'>;
13
13
  client?: ClientOptionsForTestEnv;
14
+ plugins?: (ClientPlugin | ConnectionPlugin | NativeConnectionPlugin)[];
14
15
  };
15
16
  /**
16
17
  * Options for {@link TestWorkflowEnvironment.createTimeSkipping}
@@ -18,6 +19,7 @@ export type LocalTestWorkflowEnvironmentOptions = {
18
19
  export type TimeSkippingTestWorkflowEnvironmentOptions = {
19
20
  server?: Omit<TimeSkippingServerConfig, 'type'>;
20
21
  client?: ClientOptionsForTestEnv;
22
+ plugins?: (ClientPlugin | ConnectionPlugin | NativeConnectionPlugin)[];
21
23
  };
22
24
  /**
23
25
  * Options for {@link TestWorkflowEnvironment.createExistingServer}
@@ -28,6 +30,7 @@ export type ExistingServerTestWorkflowEnvironmentOptions = {
28
30
  /** If not set, defaults to default */
29
31
  namespace?: string;
30
32
  client?: ClientOptionsForTestEnv;
33
+ plugins?: (ClientPlugin | ConnectionPlugin | NativeConnectionPlugin)[];
31
34
  };
32
35
  /**
33
36
  * An execution environment for running Workflow integration tests.
@@ -40,6 +43,10 @@ export declare class TestWorkflowEnvironment {
40
43
  readonly options: TestWorkflowEnvironmentOptionsWithDefaults;
41
44
  readonly supportsTimeSkipping: boolean;
42
45
  protected readonly server: native.EphemeralServer | 'existing';
46
+ /**
47
+ * Address used when constructing `connection` and `nativeConnection`
48
+ */
49
+ readonly address: string;
43
50
  /**
44
51
  * Namespace used in this environment (taken from {@link TestWorkflowEnvironmentOptions})
45
52
  */
@@ -70,7 +77,11 @@ export declare class TestWorkflowEnvironment {
70
77
  * Use this connection when creating Workers for testing.
71
78
  */
72
79
  readonly nativeConnection: NativeConnection;
73
- protected constructor(runtime: Runtime, options: TestWorkflowEnvironmentOptionsWithDefaults, supportsTimeSkipping: boolean, server: native.EphemeralServer | 'existing', connection: Connection, nativeConnection: NativeConnection, namespace: string | undefined);
80
+ protected constructor(runtime: Runtime, options: TestWorkflowEnvironmentOptionsWithDefaults, supportsTimeSkipping: boolean, server: native.EphemeralServer | 'existing', connection: Connection, nativeConnection: NativeConnection, namespace: string | undefined,
81
+ /**
82
+ * Address used when constructing `connection` and `nativeConnection`
83
+ */
84
+ address: string);
74
85
  /**
75
86
  * Start a time skipping workflow environment.
76
87
  *
@@ -196,6 +207,7 @@ export declare class TestWorkflowEnvironment {
196
207
  type TestWorkflowEnvironmentOptions = {
197
208
  server: DevServerConfig | TimeSkippingServerConfig | ExistingServerConfig;
198
209
  client?: ClientOptionsForTestEnv;
210
+ plugins?: (ClientPlugin | ConnectionPlugin | NativeConnectionPlugin)[];
199
211
  };
200
212
  type ExistingServerConfig = {
201
213
  type: 'existing';
@@ -22,6 +22,7 @@ class TestWorkflowEnvironment {
22
22
  options;
23
23
  supportsTimeSkipping;
24
24
  server;
25
+ address;
25
26
  /**
26
27
  * Namespace used in this environment (taken from {@link TestWorkflowEnvironmentOptions})
27
28
  */
@@ -52,11 +53,16 @@ class TestWorkflowEnvironment {
52
53
  * Use this connection when creating Workers for testing.
53
54
  */
54
55
  nativeConnection;
55
- constructor(runtime, options, supportsTimeSkipping, server, connection, nativeConnection, namespace) {
56
+ constructor(runtime, options, supportsTimeSkipping, server, connection, nativeConnection, namespace,
57
+ /**
58
+ * Address used when constructing `connection` and `nativeConnection`
59
+ */
60
+ address) {
56
61
  this.runtime = runtime;
57
62
  this.options = options;
58
63
  this.supportsTimeSkipping = supportsTimeSkipping;
59
64
  this.server = server;
65
+ this.address = address;
60
66
  this.connection = connection;
61
67
  this.nativeConnection = nativeConnection;
62
68
  this.namespace = namespace;
@@ -64,11 +70,13 @@ class TestWorkflowEnvironment {
64
70
  ? new client_2.TimeSkippingClient({
65
71
  connection,
66
72
  namespace: this.namespace,
73
+ plugins: options.plugins,
67
74
  ...options.client,
68
75
  })
69
76
  : new client_1.Client({
70
77
  connection,
71
78
  namespace: this.namespace,
79
+ plugins: options.plugins,
72
80
  ...options.client,
73
81
  });
74
82
  this.asyncCompletionClient = this.client.activity; // eslint-disable-line deprecation/deprecation
@@ -108,6 +116,7 @@ class TestWorkflowEnvironment {
108
116
  return await this.create({
109
117
  server: { type: 'time-skipping', ...opts?.server },
110
118
  client: opts?.client,
119
+ plugins: opts?.plugins,
111
120
  supportsTimeSkipping: true,
112
121
  });
113
122
  }
@@ -136,6 +145,7 @@ class TestWorkflowEnvironment {
136
145
  return await this.create({
137
146
  server: { type: 'dev-server', ...opts?.server },
138
147
  client: opts?.client,
148
+ plugins: opts?.plugins,
139
149
  namespace: opts?.server?.namespace,
140
150
  supportsTimeSkipping: false,
141
151
  });
@@ -148,6 +158,7 @@ class TestWorkflowEnvironment {
148
158
  return await this.create({
149
159
  server: { type: 'existing' },
150
160
  client: opts?.client,
161
+ plugins: opts?.plugins,
151
162
  namespace: opts?.namespace ?? 'default',
152
163
  supportsTimeSkipping: false,
153
164
  address: opts?.address,
@@ -182,13 +193,15 @@ class TestWorkflowEnvironment {
182
193
  }
183
194
  const nativeConnection = await worker_1.NativeConnection.connect({
184
195
  address,
196
+ plugins: opts.plugins,
185
197
  [connection_1.InternalConnectionOptionsSymbol]: { supportsTestService: supportsTimeSkipping },
186
198
  });
187
199
  const connection = await client_1.Connection.connect({
188
200
  address,
201
+ plugins: opts.plugins,
189
202
  [connection_1.InternalConnectionOptionsSymbol]: { supportsTestService: supportsTimeSkipping },
190
203
  });
191
- return new this(runtime, optsWithDefaults, supportsTimeSkipping, server, connection, nativeConnection, namespace);
204
+ return new this(runtime, optsWithDefaults, supportsTimeSkipping, server, connection, nativeConnection, namespace, address);
192
205
  }
193
206
  /**
194
207
  * Kill the test server process and close the connection to it
@@ -285,6 +298,7 @@ function addDefaults(opts) {
285
298
  server: {
286
299
  ...opts.server,
287
300
  },
301
+ plugins: [],
288
302
  };
289
303
  }
290
304
  //# sourceMappingURL=testing-workflow-environment.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"testing-workflow-environment.js","sourceRoot":"","sources":["../src/testing-workflow-environment.ts"],"names":[],"mappings":";;;AAAA,qCAAmC,CAAC,kDAAkD;AACtF,+CAA+F;AAC/F,kEAI2C;AAC3C,+CAAqE;AACrE,sDAAyE;AACzE,+CAAwF;AACxF,yDAAiD;AACjD,gFAAkF;AAClF,yDAA8G;AAC9G,qCAAuE;AA6BvE;;;;;GAKG;AACH,MAAa,uBAAuB;IAsCf;IACD;IACA;IACG;IAxCrB;;OAEG;IACa,SAAS,CAAU;IAEnC;;OAEG;IACa,UAAU,CAAa;IAEvC;;OAEG;IACa,MAAM,CAAS;IAE/B;;;;OAIG;IACa,qBAAqB,CAAwB;IAE7D;;;;OAIG;IACa,cAAc,CAAiB;IAE/C;;;;OAIG;IACa,gBAAgB,CAAmB;IAEnD,YACmB,OAAgB,EACjB,OAAmD,EACnD,oBAA6B,EAC1B,MAA2C,EAC9D,UAAsB,EACtB,gBAAkC,EAClC,SAA6B;QANZ,YAAO,GAAP,OAAO,CAAS;QACjB,YAAO,GAAP,OAAO,CAA4C;QACnD,yBAAoB,GAApB,oBAAoB,CAAS;QAC1B,WAAM,GAAN,MAAM,CAAqC;QAK9D,IAAI,CAAC,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AAC,MAAM;SACf;KACF,CAAC;AACJ,CAAC"}
1
+ {"version":3,"file":"testing-workflow-environment.js","sourceRoot":"","sources":["../src/testing-workflow-environment.ts"],"names":[],"mappings":";;;AAAA,qCAAmC,CAAC,kDAAkD;AACtF,+CAO4B;AAC5B,kEAI2C;AAC3C,+CAAqE;AACrE,sDAAyE;AACzE,+CAAgH;AAChH,yDAAiD;AACjD,gFAAkF;AAClF,yDAA8G;AAC9G,qCAAuE;AAgCvE;;;;;GAKG;AACH,MAAa,uBAAuB;IAsCf;IACD;IACA;IACG;IAOH;IA/ClB;;OAEG;IACa,SAAS,CAAU;IAEnC;;OAEG;IACa,UAAU,CAAa;IAEvC;;OAEG;IACa,MAAM,CAAS;IAE/B;;;;OAIG;IACa,qBAAqB,CAAwB;IAE7D;;;;OAIG;IACa,cAAc,CAAiB;IAE/C;;;;OAIG;IACa,gBAAgB,CAAmB;IAEnD,YACmB,OAAgB,EACjB,OAAmD,EACnD,oBAA6B,EAC1B,MAA2C,EAC9D,UAAsB,EACtB,gBAAkC,EAClC,SAA6B;IAC7B;;OAEG;IACa,OAAe;QAVd,YAAO,GAAP,OAAO,CAAS;QACjB,YAAO,GAAP,OAAO,CAA4C;QACnD,yBAAoB,GAApB,oBAAoB,CAAS;QAC1B,WAAM,GAAN,MAAM,CAAqC;QAO9C,YAAO,GAAP,OAAO,CAAQ;QAE/B,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAC7B,IAAI,CAAC,gBAAgB,GAAG,gBAAgB,CAAC;QACzC,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAC3B,IAAI,CAAC,MAAM,GAAG,oBAAoB;YAChC,CAAC,CAAC,IAAI,2BAAkB,CAAC;gBACrB,UAAU;gBACV,SAAS,EAAE,IAAI,CAAC,SAAS;gBACzB,OAAO,EAAE,OAAO,CAAC,OAAO;gBACxB,GAAG,OAAO,CAAC,MAAM;aAClB,CAAC;YACJ,CAAC,CAAC,IAAI,eAAM,CAAC;gBACT,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
2
2
  "name": "@temporalio/testing",
3
- "version": "1.13.1",
3
+ "version": "1.13.2",
4
4
  "description": "Temporal.io SDK Testing sub-package",
5
5
  "main": "lib/index.js",
6
6
  "types": "./lib/index.d.ts",
@@ -12,13 +12,13 @@
12
12
  "author": "Temporal Technologies Inc. <sdk@temporal.io>",
13
13
  "license": "MIT",
14
14
  "dependencies": {
15
- "@temporalio/activity": "1.13.1",
16
- "@temporalio/client": "1.13.1",
17
- "@temporalio/common": "1.13.1",
18
- "@temporalio/core-bridge": "1.13.1",
19
- "@temporalio/proto": "1.13.1",
20
- "@temporalio/worker": "1.13.1",
21
- "@temporalio/workflow": "1.13.1",
15
+ "@temporalio/activity": "1.13.2",
16
+ "@temporalio/client": "1.13.2",
17
+ "@temporalio/common": "1.13.2",
18
+ "@temporalio/core-bridge": "1.13.2",
19
+ "@temporalio/proto": "1.13.2",
20
+ "@temporalio/worker": "1.13.2",
21
+ "@temporalio/workflow": "1.13.2",
22
22
  "abort-controller": "^3.0.0"
23
23
  },
24
24
  "bugs": {
@@ -40,5 +40,5 @@
40
40
  "publishConfig": {
41
41
  "access": "public"
42
42
  },
43
- "gitHead": "7904e19bc72dcdf9eb0275ecaa585a2ff2fec072"
43
+ "gitHead": "cccc54c72f85377ac520b5d6cdd9a9a847027c27"
44
44
  }
@@ -1,5 +1,12 @@
1
1
  import 'abort-controller/polyfill'; // eslint-disable-line import/no-unassigned-import
2
- import { AsyncCompletionClient, Client, Connection, WorkflowClient } from '@temporalio/client';
2
+ import {
3
+ AsyncCompletionClient,
4
+ Client,
5
+ ClientPlugin,
6
+ Connection,
7
+ ConnectionPlugin,
8
+ WorkflowClient,
9
+ } from '@temporalio/client';
3
10
  import {
4
11
  ConnectionOptions,
5
12
  InternalConnectionOptions,
@@ -7,7 +14,7 @@ import {
7
14
  } from '@temporalio/client/lib/connection';
8
15
  import { Duration, TypedSearchAttributes } from '@temporalio/common';
9
16
  import { msToNumber, msToTs, tsToMs } from '@temporalio/common/lib/time';
10
- import { NativeConnection, NativeConnectionOptions, Runtime } from '@temporalio/worker';
17
+ import { NativeConnection, NativeConnectionPlugin, NativeConnectionOptions, Runtime } from '@temporalio/worker';
11
18
  import { native } from '@temporalio/core-bridge';
12
19
  import { filterNullAndUndefined } from '@temporalio/common/lib/internal-workflow';
13
20
  import { toNativeEphemeralServerConfig, DevServerConfig, TimeSkippingServerConfig } from './ephemeral-server';
@@ -19,6 +26,7 @@ import { ClientOptionsForTestEnv, TimeSkippingClient } from './client';
19
26
  export type LocalTestWorkflowEnvironmentOptions = {
20
27
  server?: Omit<DevServerConfig, 'type'>;
21
28
  client?: ClientOptionsForTestEnv;
29
+ plugins?: (ClientPlugin | ConnectionPlugin | NativeConnectionPlugin)[];
22
30
  };
23
31
 
24
32
  /**
@@ -27,6 +35,7 @@ export type LocalTestWorkflowEnvironmentOptions = {
27
35
  export type TimeSkippingTestWorkflowEnvironmentOptions = {
28
36
  server?: Omit<TimeSkippingServerConfig, 'type'>;
29
37
  client?: ClientOptionsForTestEnv;
38
+ plugins?: (ClientPlugin | ConnectionPlugin | NativeConnectionPlugin)[];
30
39
  };
31
40
 
32
41
  /**
@@ -38,6 +47,7 @@ export type ExistingServerTestWorkflowEnvironmentOptions = {
38
47
  /** If not set, defaults to default */
39
48
  namespace?: string;
40
49
  client?: ClientOptionsForTestEnv;
50
+ plugins?: (ClientPlugin | ConnectionPlugin | NativeConnectionPlugin)[];
41
51
  };
42
52
 
43
53
  /**
@@ -90,7 +100,11 @@ export class TestWorkflowEnvironment {
90
100
  protected readonly server: native.EphemeralServer | 'existing',
91
101
  connection: Connection,
92
102
  nativeConnection: NativeConnection,
93
- namespace: string | undefined
103
+ namespace: string | undefined,
104
+ /**
105
+ * Address used when constructing `connection` and `nativeConnection`
106
+ */
107
+ public readonly address: string
94
108
  ) {
95
109
  this.connection = connection;
96
110
  this.nativeConnection = nativeConnection;
@@ -99,11 +113,13 @@ export class TestWorkflowEnvironment {
99
113
  ? new TimeSkippingClient({
100
114
  connection,
101
115
  namespace: this.namespace,
116
+ plugins: options.plugins,
102
117
  ...options.client,
103
118
  })
104
119
  : new Client({
105
120
  connection,
106
121
  namespace: this.namespace,
122
+ plugins: options.plugins,
107
123
  ...options.client,
108
124
  });
109
125
  this.asyncCompletionClient = this.client.activity; // eslint-disable-line deprecation/deprecation
@@ -144,6 +160,7 @@ export class TestWorkflowEnvironment {
144
160
  return await this.create({
145
161
  server: { type: 'time-skipping', ...opts?.server },
146
162
  client: opts?.client,
163
+ plugins: opts?.plugins,
147
164
  supportsTimeSkipping: true,
148
165
  });
149
166
  }
@@ -173,6 +190,7 @@ export class TestWorkflowEnvironment {
173
190
  return await this.create({
174
191
  server: { type: 'dev-server', ...opts?.server },
175
192
  client: opts?.client,
193
+ plugins: opts?.plugins,
176
194
  namespace: opts?.server?.namespace,
177
195
  supportsTimeSkipping: false,
178
196
  });
@@ -188,6 +206,7 @@ export class TestWorkflowEnvironment {
188
206
  return await this.create({
189
207
  server: { type: 'existing' },
190
208
  client: opts?.client,
209
+ plugins: opts?.plugins,
191
210
  namespace: opts?.namespace ?? 'default',
192
211
  supportsTimeSkipping: false,
193
212
  address: opts?.address,
@@ -231,14 +250,25 @@ export class TestWorkflowEnvironment {
231
250
 
232
251
  const nativeConnection = await NativeConnection.connect(<NativeConnectionOptions & InternalConnectionOptions>{
233
252
  address,
253
+ plugins: opts.plugins,
234
254
  [InternalConnectionOptionsSymbol]: { supportsTestService: supportsTimeSkipping },
235
255
  });
236
256
  const connection = await Connection.connect(<ConnectionOptions & InternalConnectionOptions>{
237
257
  address,
258
+ plugins: opts.plugins,
238
259
  [InternalConnectionOptionsSymbol]: { supportsTestService: supportsTimeSkipping },
239
260
  });
240
261
 
241
- return new this(runtime, optsWithDefaults, supportsTimeSkipping, server, connection, nativeConnection, namespace);
262
+ return new this(
263
+ runtime,
264
+ optsWithDefaults,
265
+ supportsTimeSkipping,
266
+ server,
267
+ connection,
268
+ nativeConnection,
269
+ namespace,
270
+ address
271
+ );
242
272
  }
243
273
 
244
274
  /**
@@ -335,6 +365,7 @@ export class TestWorkflowEnvironment {
335
365
  type TestWorkflowEnvironmentOptions = {
336
366
  server: DevServerConfig | TimeSkippingServerConfig | ExistingServerConfig;
337
367
  client?: ClientOptionsForTestEnv;
368
+ plugins?: (ClientPlugin | ConnectionPlugin | NativeConnectionPlugin)[];
338
369
  };
339
370
 
340
371
  type ExistingServerConfig = { type: 'existing' };
@@ -348,5 +379,6 @@ function addDefaults(opts: TestWorkflowEnvironmentOptions): TestWorkflowEnvironm
348
379
  server: {
349
380
  ...opts.server,
350
381
  },
382
+ plugins: [],
351
383
  };
352
384
  }