@basis-theory-labs/cli 3.0.0 → 4.0.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/README.md CHANGED
@@ -19,7 +19,7 @@ $ npm install -g @basis-theory-labs/cli
19
19
  $ bt COMMAND
20
20
  running command...
21
21
  $ bt (--version)
22
- @basis-theory-labs/cli/3.0.0 linux-x64 node-v18.20.8
22
+ @basis-theory-labs/cli/4.0.0 linux-x64 node-v22.23.1
23
23
  $ bt --help [COMMAND]
24
24
  USAGE
25
25
  $ bt COMMAND
@@ -62,7 +62,7 @@ EXAMPLES
62
62
  $ bt applications
63
63
  ```
64
64
 
65
- _See code: [dist/commands/applications/index.ts](https://github.com/Basis-Theory-Labs/basistheory-cli/blob/v3.0.0/dist/commands/applications/index.ts)_
65
+ _See code: [dist/commands/applications/index.ts](https://github.com/Basis-Theory-Labs/basistheory-cli/blob/v4.0.0/dist/commands/applications/index.ts)_
66
66
 
67
67
  ## `bt applications create`
68
68
 
@@ -151,7 +151,7 @@ EXAMPLES
151
151
  $ bt proxies
152
152
  ```
153
153
 
154
- _See code: [dist/commands/proxies/index.ts](https://github.com/Basis-Theory-Labs/basistheory-cli/blob/v3.0.0/dist/commands/proxies/index.ts)_
154
+ _See code: [dist/commands/proxies/index.ts](https://github.com/Basis-Theory-Labs/basistheory-cli/blob/v4.0.0/dist/commands/proxies/index.ts)_
155
155
 
156
156
  ## `bt proxies create`
157
157
 
@@ -165,7 +165,7 @@ USAGE
165
165
  [--request-transform-permissions <value>] [--response-transform-image node-bt|node22]
166
166
  [--response-transform-package-json <value>] [--response-transform-timeout <value>]
167
167
  [--response-transform-warm-concurrency <value>] [--response-transform-resources standard|large|xlarge]
168
- [--response-transform-permissions <value>] [--async]
168
+ [--response-transform-permissions <value>] [--no-wait]
169
169
 
170
170
  FLAGS
171
171
  -a, --[no-]require-auth whether the Proxy requires Basis Theory authentication to be invoked.
@@ -177,7 +177,7 @@ FLAGS
177
177
  -s, --response-transform-code=<value> path to JavaScript file containing a Response Transform code
178
178
  -u, --destination-url=<value> URL to which requests will be proxied
179
179
  -x, --management-key=<value> (required) management key used for connecting with the reactor / proxy
180
- --async do not wait for proxy to be ready (requires at least one transform with
180
+ --no-wait do not wait for proxy to be ready (requires at least one transform with
181
181
  node22)
182
182
  --request-transform-image=<option> request-transform runtime image (node-bt|node22)
183
183
  <options: node-bt|node22>
@@ -187,7 +187,7 @@ FLAGS
187
187
  --request-transform-permissions=<value>... request-transform permission to grant, repeatable (node22 only)
188
188
  --request-transform-resources=<option> request-transform resource tier (node22 only)
189
189
  <options: standard|large|xlarge>
190
- --request-transform-timeout=<value> request-transform timeout in seconds, 1-30 (node22 only)
190
+ --request-transform-timeout=<value> request-transform timeout in seconds, 10-30 (node22 only)
191
191
  --request-transform-warm-concurrency=<value> request-transform warm concurrency, 0-1 (node22 only)
192
192
  --response-transform-image=<option> response-transform runtime image (node-bt|node22)
193
193
  <options: node-bt|node22>
@@ -197,7 +197,7 @@ FLAGS
197
197
  --response-transform-permissions=<value>... response-transform permission to grant, repeatable (node22 only)
198
198
  --response-transform-resources=<option> response-transform resource tier (node22 only)
199
199
  <options: standard|large|xlarge>
200
- --response-transform-timeout=<value> response-transform timeout in seconds, 1-30 (node22 only)
200
+ --response-transform-timeout=<value> response-transform timeout in seconds, 10-30 (node22 only)
201
201
  --response-transform-warm-concurrency=<value> response-transform warm concurrency, 0-1 (node22 only)
202
202
 
203
203
  DESCRIPTION
@@ -290,7 +290,7 @@ USAGE
290
290
  standard|large|xlarge] [--request-transform-permissions <value>] [--response-transform-image node-bt|node22]
291
291
  [--response-transform-package-json <value>] [--response-transform-timeout <value>]
292
292
  [--response-transform-warm-concurrency <value>] [--response-transform-resources standard|large|xlarge]
293
- [--response-transform-permissions <value>] [--async] [-w] [-l]
293
+ [--response-transform-permissions <value>] [--no-wait] [-w] [-l]
294
294
 
295
295
  ARGUMENTS
296
296
  ID Proxy id to update
@@ -307,7 +307,7 @@ FLAGS
307
307
  -u, --destination-url=<value> URL to which requests will be proxied
308
308
  -w, --watch Watch for changes in informed files
309
309
  -x, --management-key=<value> (required) management key used for connecting with the reactor / proxy
310
- --async do not wait for proxy to be ready (requires at least one transform with
310
+ --no-wait do not wait for proxy to be ready (requires at least one transform with
311
311
  node22)
312
312
  --request-transform-image=<option> request-transform runtime image (node-bt|node22)
313
313
  <options: node-bt|node22>
@@ -317,7 +317,7 @@ FLAGS
317
317
  --request-transform-permissions=<value>... request-transform permission to grant, repeatable (node22 only)
318
318
  --request-transform-resources=<option> request-transform resource tier (node22 only)
319
319
  <options: standard|large|xlarge>
320
- --request-transform-timeout=<value> request-transform timeout in seconds, 1-30 (node22 only)
320
+ --request-transform-timeout=<value> request-transform timeout in seconds, 10-30 (node22 only)
321
321
  --request-transform-warm-concurrency=<value> request-transform warm concurrency, 0-1 (node22 only)
322
322
  --response-transform-image=<option> response-transform runtime image (node-bt|node22)
323
323
  <options: node-bt|node22>
@@ -327,7 +327,7 @@ FLAGS
327
327
  --response-transform-permissions=<value>... response-transform permission to grant, repeatable (node22 only)
328
328
  --response-transform-resources=<option> response-transform resource tier (node22 only)
329
329
  <options: standard|large|xlarge>
330
- --response-transform-timeout=<value> response-transform timeout in seconds, 1-30 (node22 only)
330
+ --response-transform-timeout=<value> response-transform timeout in seconds, 10-30 (node22 only)
331
331
  --response-transform-warm-concurrency=<value> response-transform warm concurrency, 0-1 (node22 only)
332
332
 
333
333
  DESCRIPTION
@@ -378,7 +378,7 @@ EXAMPLES
378
378
  $ bt reactors
379
379
  ```
380
380
 
381
- _See code: [dist/commands/reactors/index.ts](https://github.com/Basis-Theory-Labs/basistheory-cli/blob/v3.0.0/dist/commands/reactors/index.ts)_
381
+ _See code: [dist/commands/reactors/index.ts](https://github.com/Basis-Theory-Labs/basistheory-cli/blob/v4.0.0/dist/commands/reactors/index.ts)_
382
382
 
383
383
  ## `bt reactors create`
384
384
 
@@ -388,7 +388,7 @@ Creates a new Reactor. Requires `reactor:create` Management Application permissi
388
388
  USAGE
389
389
  $ bt reactors create -x <value> [-n <value>] [-c <value>] [-i <value>] [-r <value>] [--image node-bt|node22]
390
390
  [--package-json <value>] [--timeout <value>] [--warm-concurrency <value>] [--resources standard|large|xlarge]
391
- [--permissions <value>] [--async]
391
+ [--permissions <value>] [--no-wait] [--async]
392
392
 
393
393
  FLAGS
394
394
  -c, --configuration=<value> path to configuration file (.env format) to use in the Reactor
@@ -396,15 +396,17 @@ FLAGS
396
396
  -n, --name=<value> name of the Reactor
397
397
  -r, --code=<value> path to JavaScript file containing the Reactor code
398
398
  -x, --management-key=<value> (required) management key used for connecting with the reactor / proxy
399
- --async do not wait for resource to be ready (node22 only)
399
+ --[no-]async execute Reactor invocations asynchronously (node22 only)
400
400
  --image=<option> runtime image (node-bt|node22)
401
401
  <options: node-bt|node22>
402
+ --no-wait do not wait for resource provisioning to complete
402
403
  --package-json=<value> path to runtime package.json JSON file (top-level dependencies required; supports
403
404
  resolutions or overrides fallback; pinned versions required) (node22 only)
404
405
  --permissions=<value>... permission to grant, repeatable (node22 only)
405
406
  --resources=<option> resource tier (node22 only, default: standard)
406
407
  <options: standard|large|xlarge>
407
- --timeout=<value> timeout in seconds, 1-30 (node22 only, default: 10)
408
+ --timeout=<value> timeout in seconds, 10-900 (node22 only; maximum 30 when runtime async is disabled;
409
+ default: 10)
408
410
  --warm-concurrency=<value> number of warm instances, 0-1 (node22 only, default: 0)
409
411
 
410
412
  DESCRIPTION
@@ -421,7 +423,7 @@ EXAMPLES
421
423
 
422
424
  Create a reactor with node22 and all runtime options
423
425
 
424
- $ bt reactors create --name "My Reactor" --code ./reactor.js --configuration ./config.env --image node22 \
426
+ $ bt reactors create --name "My Reactor" --code ./reactor.js --configuration ./config.env --image node22 --async \
425
427
  --timeout 10 --warm-concurrency 0 --resources standard --package-json ./package.json --permissions token:read \
426
428
  --permissions token:create
427
429
  ```
@@ -482,7 +484,7 @@ Updates an existing Reactor. Requires `reactor:update` Management Application pe
482
484
  USAGE
483
485
  $ bt reactors update ID -x <value> [-n <value>] [-c <value>] [-i <value>] [-r <value>] [--image node-bt|node22]
484
486
  [--package-json <value>] [--timeout <value>] [--warm-concurrency <value>] [--resources standard|large|xlarge]
485
- [--permissions <value>] [--async] [-w] [-l]
487
+ [--permissions <value>] [--no-wait] [--async] [-w] [-l]
486
488
 
487
489
  ARGUMENTS
488
490
  ID Reactor id to update
@@ -495,15 +497,17 @@ FLAGS
495
497
  -r, --code=<value> path to JavaScript file containing the Reactor code
496
498
  -w, --watch Watch for changes in informed files
497
499
  -x, --management-key=<value> (required) management key used for connecting with the reactor / proxy
498
- --async do not wait for resource to be ready (node22 only)
500
+ --[no-]async execute Reactor invocations asynchronously (node22 only)
499
501
  --image=<option> runtime image (node-bt|node22)
500
502
  <options: node-bt|node22>
503
+ --no-wait do not wait for resource provisioning to complete
501
504
  --package-json=<value> path to runtime package.json JSON file (top-level dependencies required; supports
502
505
  resolutions or overrides fallback; pinned versions required) (node22 only)
503
506
  --permissions=<value>... permission to grant, repeatable (node22 only)
504
507
  --resources=<option> resource tier (node22 only, default: standard)
505
508
  <options: standard|large|xlarge>
506
- --timeout=<value> timeout in seconds, 1-30 (node22 only, default: 10)
509
+ --timeout=<value> timeout in seconds, 10-900 (node22 only; maximum 30 when runtime async is disabled;
510
+ default: 10)
507
511
  --warm-concurrency=<value> number of warm instances, 0-1 (node22 only, default: 0)
508
512
 
509
513
  DESCRIPTION
@@ -521,7 +525,7 @@ EXAMPLES
521
525
  Update a reactor with node22 and all runtime options
522
526
 
523
527
  $ bt reactors update <reactor-id> --name "My Reactor" --code ./reactor.js --configuration ./config.env --image \
524
- node22 --timeout 10 --warm-concurrency 0 --resources standard --package-json ./package.json --permissions \
525
- token:read --permissions token:create
528
+ node22 --async --timeout 10 --warm-concurrency 0 --resources standard --package-json ./package.json \
529
+ --permissions token:read --permissions token:create
526
530
  ```
527
531
  <!-- commandsstop -->
@@ -26,7 +26,7 @@ export default class Create extends BaseCommand {
26
26
  'response-transform-warm-concurrency': import("@oclif/core/lib/interfaces/parser").OptionFlag<number | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
27
27
  'response-transform-resources': import("@oclif/core/lib/interfaces/parser").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
28
28
  'response-transform-permissions': import("@oclif/core/lib/interfaces/parser").OptionFlag<string[] | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
29
- async: import("@oclif/core/lib/interfaces/parser").BooleanFlag<boolean>;
29
+ 'no-wait': import("@oclif/core/lib/interfaces/parser").BooleanFlag<boolean>;
30
30
  };
31
31
  run(): Promise<void>;
32
32
  }
@@ -67,7 +67,7 @@ class Create extends base_1.BaseCommand {
67
67
  responseTransformRuntime,
68
68
  });
69
69
  const proxy = await (0, management_1.createProxy)(bt, model);
70
- if (!flags.async && proxy.id) {
70
+ if (!flags['no-wait'] && proxy.id) {
71
71
  try {
72
72
  await (0, runtime_2.waitForResourceState)(bt, 'proxy', proxy.id, proxy.state);
73
73
  this.log('Proxy created successfully!');
@@ -28,7 +28,7 @@ export default class Update extends BaseCommand {
28
28
  'response-transform-warm-concurrency': import("@oclif/core/lib/interfaces/parser").OptionFlag<number | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
29
29
  'response-transform-resources': import("@oclif/core/lib/interfaces/parser").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
30
30
  'response-transform-permissions': import("@oclif/core/lib/interfaces/parser").OptionFlag<string[] | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
31
- async: import("@oclif/core/lib/interfaces/parser").BooleanFlag<boolean>;
31
+ 'no-wait': import("@oclif/core/lib/interfaces/parser").BooleanFlag<boolean>;
32
32
  };
33
33
  static args: {
34
34
  id: import("@oclif/core/lib/interfaces/parser").Arg<string, Record<string, unknown>>;
@@ -12,7 +12,7 @@ class Update extends base_1.BaseCommand {
12
12
  async run() {
13
13
  var _a, _b;
14
14
  const { bt, args: { id }, flags, metadata, } = await this.parse(Update);
15
- const { name, 'destination-url': destinationUrl, 'response-transform-code': responseTransformCode, 'request-transform-code': requestTransformCode, 'application-id': applicationId, configuration, 'require-auth': requireAuth, 'request-transform-image': requestTransformImage, 'request-transform-package-json': requestTransformPackageJson, 'request-transform-timeout': requestTransformTimeout, 'request-transform-warm-concurrency': requestTransformWarmConcurrency, 'request-transform-resources': requestTransformResources, 'request-transform-permissions': requestTransformPermissions, 'response-transform-image': responseTransformImage, 'response-transform-package-json': responseTransformPackageJson, 'response-transform-timeout': responseTransformTimeout, 'response-transform-warm-concurrency': responseTransformWarmConcurrency, 'response-transform-resources': responseTransformResources, 'response-transform-permissions': responseTransformPermissions, async: asyncFlag, watch, logs, } = flags;
15
+ const { name, 'destination-url': destinationUrl, 'response-transform-code': responseTransformCode, 'request-transform-code': requestTransformCode, 'application-id': applicationId, configuration, 'require-auth': requireAuth, 'request-transform-image': requestTransformImage, 'request-transform-package-json': requestTransformPackageJson, 'request-transform-timeout': requestTransformTimeout, 'request-transform-warm-concurrency': requestTransformWarmConcurrency, 'request-transform-resources': requestTransformResources, 'request-transform-permissions': requestTransformPermissions, 'response-transform-image': responseTransformImage, 'response-transform-package-json': responseTransformPackageJson, 'response-transform-timeout': responseTransformTimeout, 'response-transform-warm-concurrency': responseTransformWarmConcurrency, 'response-transform-resources': responseTransformResources, 'response-transform-permissions': responseTransformPermissions, 'no-wait': noWait, watch, logs, } = flags;
16
16
  (0, runtime_1.validateProxyApplicationId)(applicationId, flags);
17
17
  const requestTransformRuntime = (0, runtime_2.buildRuntime)({
18
18
  image: requestTransformImage,
@@ -46,7 +46,7 @@ class Update extends base_1.BaseCommand {
46
46
  await (0, management_1.patchProxy)(bt, id, model);
47
47
  const proxy = await (0, management_1.getProxy)(bt, id);
48
48
  const isConfigurableRuntime = (0, runtime_2.needsPolling)(proxy.state);
49
- if (!asyncFlag) {
49
+ if (!noWait) {
50
50
  await (0, runtime_2.waitForResourceState)(bt, 'proxy', id, proxy.state);
51
51
  }
52
52
  this.log('Proxy updated successfully!');
@@ -6,13 +6,14 @@ export default class Create extends BaseCommand {
6
6
  command: string;
7
7
  }[];
8
8
  static flags: {
9
+ async: import("@oclif/core/lib/interfaces/parser").BooleanFlag<boolean>;
9
10
  image: import("@oclif/core/lib/interfaces/parser").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
10
11
  'package-json': import("@oclif/core/lib/interfaces/parser").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
11
12
  timeout: import("@oclif/core/lib/interfaces/parser").OptionFlag<number | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
12
13
  'warm-concurrency': import("@oclif/core/lib/interfaces/parser").OptionFlag<number | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
13
14
  resources: import("@oclif/core/lib/interfaces/parser").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
14
15
  permissions: import("@oclif/core/lib/interfaces/parser").OptionFlag<string[] | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
15
- async: import("@oclif/core/lib/interfaces/parser").BooleanFlag<boolean>;
16
+ 'no-wait': import("@oclif/core/lib/interfaces/parser").BooleanFlag<boolean>;
16
17
  name: import("@oclif/core/lib/interfaces/parser").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
17
18
  configuration: import("@oclif/core/lib/interfaces/parser").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
18
19
  'application-id': import("@oclif/core/lib/interfaces/parser").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
@@ -9,7 +9,7 @@ const utils_2 = require("../../utils");
9
9
  class Create extends base_1.BaseCommand {
10
10
  async run() {
11
11
  const { flags, bt } = await this.parse(Create);
12
- const { timeout, 'warm-concurrency': warmConcurrency, resources, 'package-json': packageJson, permissions, 'application-id': applicationId, async: asyncFlag, } = flags;
12
+ const { timeout, 'warm-concurrency': warmConcurrency, resources, 'package-json': packageJson, permissions, 'application-id': applicationId, 'no-wait': noWait, async: runtimeAsyncFlag, } = flags;
13
13
  const image = await (0, runtime_2.promptRuntimeImage)(flags.image);
14
14
  (0, runtime_1.validateReactorRuntimeFlags)(flags, image);
15
15
  (0, runtime_1.validateReactorApplicationId)(applicationId, image);
@@ -32,15 +32,22 @@ class Create extends base_1.BaseCommand {
32
32
  }
33
33
  let runtime;
34
34
  if (!(0, runtime_2.isLegacyRuntimeImage)(image)) {
35
+ const runtimeAsync = await (0, utils_2.promptBooleanIfUndefined)(runtimeAsyncFlag, {
36
+ message: 'Execute Reactor invocations asynchronously?',
37
+ default: false,
38
+ });
39
+ (0, runtime_2.validateRuntimeTimeout)(timeout, runtimeAsync);
35
40
  const runtimeOptions = await (0, runtime_2.promptRuntimeOptions)({
36
41
  timeout,
37
42
  'warm-concurrency': warmConcurrency,
38
43
  resources,
39
44
  'package-json': packageJson,
40
45
  permissions,
41
- });
42
- runtime = (0, runtime_2.buildRuntime)({
46
+ }, undefined, (0, runtime_2.getMaxRuntimeTimeout)(runtimeAsync));
47
+ (0, runtime_2.validateRuntimeTimeout)(runtimeOptions.timeout, runtimeAsync);
48
+ runtime = (0, runtime_2.buildReactorRuntime)({
43
49
  image,
50
+ async: runtimeAsync,
44
51
  ...runtimeOptions,
45
52
  });
46
53
  }
@@ -52,7 +59,7 @@ class Create extends base_1.BaseCommand {
52
59
  runtime,
53
60
  });
54
61
  const reactor = await (0, management_1.createReactor)(bt, model);
55
- if (!asyncFlag && reactor.id) {
62
+ if (!noWait && reactor.id) {
56
63
  try {
57
64
  await (0, runtime_2.waitForResourceState)(bt, 'reactor', reactor.id, reactor.state);
58
65
  this.log('Reactor created successfully!');
@@ -89,6 +96,7 @@ Create.examples = [
89
96
  '--code ./reactor.js ' +
90
97
  '--configuration ./config.env ' +
91
98
  '--image node22 ' +
99
+ '--async ' +
92
100
  '--timeout 10 ' +
93
101
  '--warm-concurrency 0 ' +
94
102
  '--resources standard ' +
@@ -8,13 +8,14 @@ export default class Update extends BaseCommand {
8
8
  static flags: {
9
9
  watch: import("@oclif/core/lib/interfaces/parser").BooleanFlag<boolean>;
10
10
  logs: import("@oclif/core/lib/interfaces/parser").BooleanFlag<boolean>;
11
+ async: import("@oclif/core/lib/interfaces/parser").BooleanFlag<boolean>;
11
12
  image: import("@oclif/core/lib/interfaces/parser").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
12
13
  'package-json': import("@oclif/core/lib/interfaces/parser").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
13
14
  timeout: import("@oclif/core/lib/interfaces/parser").OptionFlag<number | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
14
15
  'warm-concurrency': import("@oclif/core/lib/interfaces/parser").OptionFlag<number | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
15
16
  resources: import("@oclif/core/lib/interfaces/parser").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
16
17
  permissions: import("@oclif/core/lib/interfaces/parser").OptionFlag<string[] | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
17
- async: import("@oclif/core/lib/interfaces/parser").BooleanFlag<boolean>;
18
+ 'no-wait': import("@oclif/core/lib/interfaces/parser").BooleanFlag<boolean>;
18
19
  name: import("@oclif/core/lib/interfaces/parser").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
19
20
  configuration: import("@oclif/core/lib/interfaces/parser").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
20
21
  'application-id': import("@oclif/core/lib/interfaces/parser").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
@@ -10,16 +10,29 @@ const utils_1 = require("../../reactors/utils");
10
10
  const runtime_2 = require("../../runtime");
11
11
  class Update extends base_1.BaseCommand {
12
12
  async run() {
13
+ var _a, _b, _c, _d;
13
14
  const { bt, args: { id }, flags, } = await this.parse(Update);
14
- const { name, code, 'application-id': applicationId, configuration, image, 'package-json': packageJson, timeout, 'warm-concurrency': warmConcurrency, resources, permissions, async: asyncFlag, watch, logs, } = flags;
15
- (0, runtime_1.validateReactorApplicationId)(applicationId, image);
16
- const runtime = (0, runtime_2.buildRuntime)({
15
+ const { name, code, 'application-id': applicationId, configuration, image, 'package-json': packageJson, timeout, 'warm-concurrency': warmConcurrency, resources, permissions, 'no-wait': noWait, async: runtimeAsync, watch, logs, } = flags;
16
+ const existingReactor = (0, runtime_1.hasReactorRuntimeFlags)(flags) ||
17
+ (applicationId !== undefined && image === undefined)
18
+ ? await (0, management_1.getReactor)(bt, id)
19
+ : undefined;
20
+ const effectiveImage = image !== null && image !== void 0 ? image : (_a = existingReactor === null || existingReactor === void 0 ? void 0 : existingReactor.runtime) === null || _a === void 0 ? void 0 : _a.image;
21
+ const effectiveRuntimeAsync = (_c = runtimeAsync !== null && runtimeAsync !== void 0 ? runtimeAsync : (_b = existingReactor === null || existingReactor === void 0 ? void 0 : existingReactor.runtime) === null || _b === void 0 ? void 0 : _b.async) !== null && _c !== void 0 ? _c : false;
22
+ const effectiveTimeout = timeout !== null && timeout !== void 0 ? timeout : (_d = existingReactor === null || existingReactor === void 0 ? void 0 : existingReactor.runtime) === null || _d === void 0 ? void 0 : _d.timeout;
23
+ (0, runtime_1.validateReactorRuntimeFlags)(flags, effectiveImage);
24
+ (0, runtime_1.validateReactorApplicationId)(applicationId, effectiveImage);
25
+ if (timeout !== undefined || runtimeAsync !== undefined) {
26
+ (0, runtime_2.validateRuntimeTimeout)(effectiveTimeout, effectiveRuntimeAsync);
27
+ }
28
+ const runtime = (0, runtime_2.buildReactorRuntime)({
17
29
  image,
18
30
  packageJson,
19
31
  timeout,
20
32
  warmConcurrency,
21
33
  resources,
22
34
  permissions,
35
+ async: runtimeAsync,
23
36
  });
24
37
  const model = (0, utils_1.createModelFromFlags)({
25
38
  name,
@@ -31,7 +44,7 @@ class Update extends base_1.BaseCommand {
31
44
  await (0, management_1.patchReactor)(bt, id, model);
32
45
  const reactor = await (0, management_1.getReactor)(bt, id);
33
46
  const isConfigurableRuntime = (0, runtime_2.needsPolling)(reactor.state);
34
- if (!asyncFlag) {
47
+ if (!noWait) {
35
48
  await (0, runtime_2.waitForResourceState)(bt, 'reactor', id, reactor.state);
36
49
  }
37
50
  this.log('Reactor updated successfully!');
@@ -80,6 +93,7 @@ Update.examples = [
80
93
  '--code ./reactor.js ' +
81
94
  '--configuration ./config.env ' +
82
95
  '--image node22 ' +
96
+ '--async ' +
83
97
  '--timeout 10 ' +
84
98
  '--warm-concurrency 0 ' +
85
99
  '--resources standard ' +
@@ -7,8 +7,8 @@ const management_2 = require("../reactors/management");
7
7
  const BT_LOGGING_CONFIGURATION = 'BT_LOGGING_CONFIGURATION';
8
8
  /**
9
9
  * Creates configuration object to connect/disconnect to a resource
10
- * @param url - server url for the resource to connect to. If `undefined`,
11
- * the logging configuration is cleared.
10
+ * @param url - server url for the resource to connect to. An empty string
11
+ * removes the logging configuration when disconnecting.
12
12
  */
13
13
  const createConfiguration = (url) => ({
14
14
  [BT_LOGGING_CONFIGURATION]: url
@@ -16,7 +16,7 @@ const createConfiguration = (url) => ({
16
16
  destination: url,
17
17
  date: Date.now(),
18
18
  })
19
- : undefined,
19
+ : '',
20
20
  });
21
21
  const connectToReactor = async (bt, id, url) => {
22
22
  core_1.ux.action.start(`Connecting to Reactor (${id})`);
@@ -1,4 +1,4 @@
1
- import { FastifyInstance } from 'fastify';
1
+ import http from 'http';
2
2
  import type { Logger } from 'pino';
3
- declare const createHttpServer: (logger: Logger) => FastifyInstance;
3
+ declare const createHttpServer: (logger: Logger) => http.Server;
4
4
  export { createHttpServer };
package/dist/logs/http.js CHANGED
@@ -2,19 +2,29 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.createHttpServer = void 0;
4
4
  const tslib_1 = require("tslib");
5
- const fastify_1 = tslib_1.__importDefault(require("fastify"));
6
5
  const http_1 = tslib_1.__importDefault(require("http"));
7
6
  const parse_1 = require("./parse");
8
7
  const debug = require('debug')('logs:http');
9
- const createHttpServer = (logger) => {
10
- const fastify = (0, fastify_1.default)({
11
- serverFactory: (handler) => http_1.default.createServer(handler),
8
+ const createHttpServer = (logger) => http_1.default.createServer((request, response) => {
9
+ if (request.method !== 'POST' || request.url !== '/logs') {
10
+ response.writeHead(404).end();
11
+ return;
12
+ }
13
+ debug('received "log" request');
14
+ const chunks = [];
15
+ request.on('data', (chunk) => chunks.push(chunk));
16
+ request.on('end', () => {
17
+ response.writeHead(204).end();
18
+ try {
19
+ (0, parse_1.parseLogEvent)(logger, JSON.parse(Buffer.concat(chunks).toString('utf8')));
20
+ }
21
+ catch (error) {
22
+ debug('failed to parse log event', error);
23
+ }
12
24
  });
13
- fastify.post('/logs', (request, reply) => {
14
- debug('received "log" request');
15
- reply.code(204).send();
16
- (0, parse_1.parseLogEvent)(logger, request.body);
25
+ request.on('error', (error) => {
26
+ debug('request error', error);
27
+ response.writeHead(400).end();
17
28
  });
18
- return fastify;
19
- };
29
+ });
20
30
  exports.createHttpServer = createHttpServer;
@@ -40,11 +40,13 @@ const createLogServer = async (_port) => {
40
40
  },
41
41
  });
42
42
  debug('creating http server');
43
- const fastify = (0, http_1.createHttpServer)(logger);
43
+ const server = (0, http_1.createHttpServer)(logger);
44
44
  debug('creating socket server');
45
- (0, socket_1.createSocketServer)(fastify.server, logger);
45
+ (0, socket_1.createSocketServer)(server, logger);
46
46
  debug(`server listening on port ${port}`);
47
- await fastify.listen({ port });
47
+ await new Promise((resolve) => {
48
+ server.listen(port, resolve);
49
+ });
48
50
  core_1.ux.action.stop(`✅\tListening at http://localhost:${port}`);
49
51
  core_1.ux.action.start('Creating tunnel');
50
52
  const url = await runTunnel(port);
@@ -20,7 +20,7 @@ declare const PROXY_FLAGS: {
20
20
  'response-transform-warm-concurrency': import("@oclif/core/lib/interfaces/parser").OptionFlag<number | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
21
21
  'response-transform-resources': import("@oclif/core/lib/interfaces/parser").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
22
22
  'response-transform-permissions': import("@oclif/core/lib/interfaces/parser").OptionFlag<string[] | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
23
- async: import("@oclif/core/lib/interfaces/parser").BooleanFlag<boolean>;
23
+ 'no-wait': import("@oclif/core/lib/interfaces/parser").BooleanFlag<boolean>;
24
24
  };
25
25
  interface ProxyFlagProps {
26
26
  /**
@@ -44,8 +44,8 @@ const PROXY_FLAGS = {
44
44
  description: 'path to runtime package.json JSON file (top-level dependencies required; supports resolutions or overrides fallback; pinned versions required) (node22 only)',
45
45
  }),
46
46
  'request-transform-timeout': core_1.Flags.integer({
47
- description: 'request-transform timeout in seconds, 1-30 (node22 only)',
48
- min: 1,
47
+ description: 'request-transform timeout in seconds, 10-30 (node22 only)',
48
+ min: 10,
49
49
  max: 30,
50
50
  }),
51
51
  'request-transform-warm-concurrency': core_1.Flags.integer({
@@ -69,8 +69,8 @@ const PROXY_FLAGS = {
69
69
  description: 'path to runtime package.json JSON file (top-level dependencies required; supports resolutions or overrides fallback; pinned versions required) (node22 only)',
70
70
  }),
71
71
  'response-transform-timeout': core_1.Flags.integer({
72
- description: 'response-transform timeout in seconds, 1-30 (node22 only)',
73
- min: 1,
72
+ description: 'response-transform timeout in seconds, 10-30 (node22 only)',
73
+ min: 10,
74
74
  max: 30,
75
75
  }),
76
76
  'response-transform-warm-concurrency': core_1.Flags.integer({
@@ -86,7 +86,7 @@ const PROXY_FLAGS = {
86
86
  description: 'response-transform permission to grant, repeatable (node22 only)',
87
87
  multiple: true,
88
88
  }),
89
- async: core_1.Flags.boolean({
89
+ 'no-wait': core_1.Flags.boolean({
90
90
  description: 'do not wait for proxy to be ready (requires at least one transform with node22)',
91
91
  default: false,
92
92
  }),
@@ -1,3 +1,4 @@
1
+ declare const hasReactorRuntimeFlags: (flags: Record<string, unknown>) => boolean;
1
2
  declare const validateReactorRuntimeFlags: (flags: Record<string, unknown>, image: string | undefined) => void;
2
3
  declare const validateReactorApplicationId: (applicationId: string | undefined, image: string | undefined) => void;
3
- export { validateReactorRuntimeFlags, validateReactorApplicationId };
4
+ export { hasReactorRuntimeFlags, validateReactorRuntimeFlags, validateReactorApplicationId, };
@@ -1,14 +1,17 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.validateReactorApplicationId = exports.validateReactorRuntimeFlags = void 0;
3
+ exports.validateReactorApplicationId = exports.validateReactorRuntimeFlags = exports.hasReactorRuntimeFlags = void 0;
4
4
  const runtime_1 = require("../runtime");
5
+ const hasReactorRuntimeFlags = (flags) => runtime_1.REACTOR_CONFIGURABLE_RUNTIME_FLAGS.some((flag) => {
6
+ const value = flags[flag];
7
+ return value !== undefined && !(Array.isArray(value) && value.length === 0);
8
+ });
9
+ exports.hasReactorRuntimeFlags = hasReactorRuntimeFlags;
5
10
  const validateReactorRuntimeFlags = (flags, image) => {
6
11
  const setFlags = [];
7
- for (const flag of runtime_1.CONFIGURABLE_RUNTIME_FLAGS) {
12
+ for (const flag of runtime_1.REACTOR_CONFIGURABLE_RUNTIME_FLAGS) {
8
13
  const value = flags[flag];
9
- const isSet = value !== undefined &&
10
- value !== false &&
11
- !(Array.isArray(value) && value.length === 0);
14
+ const isSet = value !== undefined && !(Array.isArray(value) && value.length === 0);
12
15
  if (isSet) {
13
16
  setFlags.push(flag);
14
17
  }
@@ -1,12 +1,15 @@
1
1
  import type { BasisTheory } from '@basis-theory/node-sdk';
2
2
  declare const REACTOR_FLAGS: {
3
+ async: import("@oclif/core/lib/interfaces/parser").BooleanFlag<boolean>;
3
4
  image: import("@oclif/core/lib/interfaces/parser").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
4
5
  'package-json': import("@oclif/core/lib/interfaces/parser").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
5
6
  timeout: import("@oclif/core/lib/interfaces/parser").OptionFlag<number | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
6
7
  'warm-concurrency': import("@oclif/core/lib/interfaces/parser").OptionFlag<number | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
7
- resources: import("@oclif/core/lib/interfaces/parser").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
8
+ resources: import("@oclif/core/lib/interfaces/parser").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>; /**
9
+ * Path to code file
10
+ */
8
11
  permissions: import("@oclif/core/lib/interfaces/parser").OptionFlag<string[] | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
9
- async: import("@oclif/core/lib/interfaces/parser").BooleanFlag<boolean>;
12
+ 'no-wait': import("@oclif/core/lib/interfaces/parser").BooleanFlag<boolean>;
10
13
  name: import("@oclif/core/lib/interfaces/parser").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
11
14
  configuration: import("@oclif/core/lib/interfaces/parser").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
12
15
  'application-id': import("@oclif/core/lib/interfaces/parser").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
@@ -28,7 +31,7 @@ interface ReactorFlagProps {
28
31
  /**
29
32
  * Runtime configuration
30
33
  */
31
- runtime?: BasisTheory.Runtime;
34
+ runtime?: BasisTheory.ReactorRuntime;
32
35
  }
33
36
  type CreateReactor = ReactorFlagProps & Omit<BasisTheory.CreateReactorRequest, 'application' | 'configuration' | 'runtime'>;
34
37
  type PatchReactor = ReactorFlagProps & Omit<BasisTheory.PatchReactorRequest, 'application' | 'configuration' | 'runtime'>;
@@ -23,6 +23,10 @@ const REACTOR_FLAGS = {
23
23
  description: 'path to JavaScript file containing the Reactor code',
24
24
  }),
25
25
  ...runtime_1.RUNTIME_FLAGS,
26
+ async: core_1.Flags.boolean({
27
+ description: 'execute Reactor invocations asynchronously (node22 only)',
28
+ allowNo: true,
29
+ }),
26
30
  };
27
31
  exports.REACTOR_FLAGS = REACTOR_FLAGS;
28
32
  // eslint-disable-next-line get-off-my-lawn/prefer-arrow-functions
@@ -5,6 +5,6 @@ declare const RUNTIME_FLAGS: {
5
5
  'warm-concurrency': import("@oclif/core/lib/interfaces/parser").OptionFlag<number | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
6
6
  resources: import("@oclif/core/lib/interfaces/parser").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
7
7
  permissions: import("@oclif/core/lib/interfaces/parser").OptionFlag<string[] | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
8
- async: import("@oclif/core/lib/interfaces/parser").BooleanFlag<boolean>;
8
+ 'no-wait': import("@oclif/core/lib/interfaces/parser").BooleanFlag<boolean>;
9
9
  };
10
10
  export { RUNTIME_FLAGS };
@@ -12,9 +12,9 @@ const RUNTIME_FLAGS = {
12
12
  description: 'path to runtime package.json JSON file (top-level dependencies required; supports resolutions or overrides fallback; pinned versions required) (node22 only)',
13
13
  }),
14
14
  timeout: core_1.Flags.integer({
15
- description: 'timeout in seconds, 1-30 (node22 only, default: 10)',
16
- min: 1,
17
- max: 30,
15
+ description: 'timeout in seconds, 10-900 (node22 only; maximum 30 when runtime async is disabled; default: 10)',
16
+ min: 10,
17
+ max: 900,
18
18
  }),
19
19
  'warm-concurrency': core_1.Flags.integer({
20
20
  description: 'number of warm instances, 0-1 (node22 only, default: 0)',
@@ -29,8 +29,8 @@ const RUNTIME_FLAGS = {
29
29
  description: 'permission to grant, repeatable (node22 only)',
30
30
  multiple: true,
31
31
  }),
32
- async: core_1.Flags.boolean({
33
- description: 'do not wait for resource to be ready (node22 only)',
32
+ 'no-wait': core_1.Flags.boolean({
33
+ description: 'do not wait for resource provisioning to complete',
34
34
  default: false,
35
35
  }),
36
36
  };
@@ -1,3 +1,3 @@
1
- export { LEGACY_RUNTIME_IMAGE, CONFIGURABLE_RUNTIME_IMAGES, VALID_RUNTIME_IMAGES, CONFIGURABLE_RUNTIME_FLAGS, isLegacyRuntimeImage, validateRuntimeImage, parseRuntimePackageJsonFile, buildRuntime, promptRuntimeOptions, promptRuntimeImage, type ConfigurableRuntimeOptions, type RuntimeFlagProps, type RuntimeFlags, } from './utils';
1
+ export { LEGACY_RUNTIME_IMAGE, CONFIGURABLE_RUNTIME_IMAGES, VALID_RUNTIME_IMAGES, CONFIGURABLE_RUNTIME_FLAGS, REACTOR_CONFIGURABLE_RUNTIME_FLAGS, isLegacyRuntimeImage, validateRuntimeImage, parseRuntimePackageJsonFile, buildRuntime, buildReactorRuntime, getMaxRuntimeTimeout, validateRuntimeTimeout, promptRuntimeOptions, promptRuntimeImage, type ConfigurableRuntimeOptions, type RuntimeFlagProps, type RuntimeFlags, } from './utils';
2
2
  export { RUNTIME_FLAGS } from './flags';
3
3
  export { waitForResourceState, needsPolling, POLL_INTERVAL, POLL_TIMEOUT, } from './state';
@@ -1,15 +1,19 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.POLL_TIMEOUT = exports.POLL_INTERVAL = exports.needsPolling = exports.waitForResourceState = exports.RUNTIME_FLAGS = exports.promptRuntimeImage = exports.promptRuntimeOptions = exports.buildRuntime = exports.parseRuntimePackageJsonFile = exports.validateRuntimeImage = exports.isLegacyRuntimeImage = exports.CONFIGURABLE_RUNTIME_FLAGS = exports.VALID_RUNTIME_IMAGES = exports.CONFIGURABLE_RUNTIME_IMAGES = exports.LEGACY_RUNTIME_IMAGE = void 0;
3
+ exports.POLL_TIMEOUT = exports.POLL_INTERVAL = exports.needsPolling = exports.waitForResourceState = exports.RUNTIME_FLAGS = exports.promptRuntimeImage = exports.promptRuntimeOptions = exports.validateRuntimeTimeout = exports.getMaxRuntimeTimeout = exports.buildReactorRuntime = exports.buildRuntime = exports.parseRuntimePackageJsonFile = exports.validateRuntimeImage = exports.isLegacyRuntimeImage = exports.REACTOR_CONFIGURABLE_RUNTIME_FLAGS = exports.CONFIGURABLE_RUNTIME_FLAGS = exports.VALID_RUNTIME_IMAGES = exports.CONFIGURABLE_RUNTIME_IMAGES = exports.LEGACY_RUNTIME_IMAGE = void 0;
4
4
  var utils_1 = require("./utils");
5
5
  Object.defineProperty(exports, "LEGACY_RUNTIME_IMAGE", { enumerable: true, get: function () { return utils_1.LEGACY_RUNTIME_IMAGE; } });
6
6
  Object.defineProperty(exports, "CONFIGURABLE_RUNTIME_IMAGES", { enumerable: true, get: function () { return utils_1.CONFIGURABLE_RUNTIME_IMAGES; } });
7
7
  Object.defineProperty(exports, "VALID_RUNTIME_IMAGES", { enumerable: true, get: function () { return utils_1.VALID_RUNTIME_IMAGES; } });
8
8
  Object.defineProperty(exports, "CONFIGURABLE_RUNTIME_FLAGS", { enumerable: true, get: function () { return utils_1.CONFIGURABLE_RUNTIME_FLAGS; } });
9
+ Object.defineProperty(exports, "REACTOR_CONFIGURABLE_RUNTIME_FLAGS", { enumerable: true, get: function () { return utils_1.REACTOR_CONFIGURABLE_RUNTIME_FLAGS; } });
9
10
  Object.defineProperty(exports, "isLegacyRuntimeImage", { enumerable: true, get: function () { return utils_1.isLegacyRuntimeImage; } });
10
11
  Object.defineProperty(exports, "validateRuntimeImage", { enumerable: true, get: function () { return utils_1.validateRuntimeImage; } });
11
12
  Object.defineProperty(exports, "parseRuntimePackageJsonFile", { enumerable: true, get: function () { return utils_1.parseRuntimePackageJsonFile; } });
12
13
  Object.defineProperty(exports, "buildRuntime", { enumerable: true, get: function () { return utils_1.buildRuntime; } });
14
+ Object.defineProperty(exports, "buildReactorRuntime", { enumerable: true, get: function () { return utils_1.buildReactorRuntime; } });
15
+ Object.defineProperty(exports, "getMaxRuntimeTimeout", { enumerable: true, get: function () { return utils_1.getMaxRuntimeTimeout; } });
16
+ Object.defineProperty(exports, "validateRuntimeTimeout", { enumerable: true, get: function () { return utils_1.validateRuntimeTimeout; } });
13
17
  Object.defineProperty(exports, "promptRuntimeOptions", { enumerable: true, get: function () { return utils_1.promptRuntimeOptions; } });
14
18
  Object.defineProperty(exports, "promptRuntimeImage", { enumerable: true, get: function () { return utils_1.promptRuntimeImage; } });
15
19
  var flags_1 = require("./flags");
@@ -5,6 +5,7 @@ declare const VALID_RUNTIME_IMAGES: readonly ["node-bt", "node22"];
5
5
  declare const isLegacyRuntimeImage: (image: string | undefined) => boolean;
6
6
  declare const validateRuntimeImage: (image: string | undefined) => void;
7
7
  declare const CONFIGURABLE_RUNTIME_FLAGS: readonly ["timeout", "resources", "warm-concurrency", "permissions", "package-json"];
8
+ declare const REACTOR_CONFIGURABLE_RUNTIME_FLAGS: readonly ["timeout", "resources", "warm-concurrency", "permissions", "package-json", "async"];
8
9
  interface RuntimeFlagProps {
9
10
  image?: string;
10
11
  packageJson?: string;
@@ -13,6 +14,9 @@ interface RuntimeFlagProps {
13
14
  resources?: string;
14
15
  permissions?: string[];
15
16
  }
17
+ interface ReactorRuntimeFlagProps extends RuntimeFlagProps {
18
+ async?: boolean;
19
+ }
16
20
  interface RuntimeFlags {
17
21
  image?: string;
18
22
  timeout?: number;
@@ -34,6 +38,9 @@ interface ParsedRuntimePackageFile {
34
38
  }
35
39
  declare const parseRuntimePackageJsonFile: (packageJsonPath: string) => ParsedRuntimePackageFile;
36
40
  declare const buildRuntime: (props: RuntimeFlagProps) => BasisTheory.Runtime | undefined;
37
- declare const promptRuntimeOptions: (flags: RuntimeFlags, labelPrefix?: string) => Promise<ConfigurableRuntimeOptions>;
41
+ declare const buildReactorRuntime: (props: ReactorRuntimeFlagProps) => BasisTheory.ReactorRuntime | undefined;
42
+ declare const getMaxRuntimeTimeout: (runtimeAsync: boolean) => number;
43
+ declare const validateRuntimeTimeout: (timeout: number | undefined, runtimeAsync: boolean) => void;
44
+ declare const promptRuntimeOptions: (flags: RuntimeFlags, labelPrefix?: string, timeoutMax?: number) => Promise<ConfigurableRuntimeOptions>;
38
45
  declare const promptRuntimeImage: (image: string | undefined, message?: string) => Promise<string>;
39
- export { LEGACY_RUNTIME_IMAGE, CONFIGURABLE_RUNTIME_IMAGES, VALID_RUNTIME_IMAGES, CONFIGURABLE_RUNTIME_FLAGS, isLegacyRuntimeImage, validateRuntimeImage, parseRuntimePackageJsonFile, buildRuntime, promptRuntimeOptions, promptRuntimeImage, type RuntimeFlagProps, type RuntimeFlags, type ConfigurableRuntimeOptions, };
46
+ export { LEGACY_RUNTIME_IMAGE, CONFIGURABLE_RUNTIME_IMAGES, VALID_RUNTIME_IMAGES, CONFIGURABLE_RUNTIME_FLAGS, REACTOR_CONFIGURABLE_RUNTIME_FLAGS, isLegacyRuntimeImage, validateRuntimeImage, parseRuntimePackageJsonFile, buildRuntime, buildReactorRuntime, getMaxRuntimeTimeout, validateRuntimeTimeout, promptRuntimeOptions, promptRuntimeImage, type RuntimeFlagProps, type RuntimeFlags, type ConfigurableRuntimeOptions, };
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.promptRuntimeImage = exports.promptRuntimeOptions = exports.buildRuntime = exports.parseRuntimePackageJsonFile = exports.validateRuntimeImage = exports.isLegacyRuntimeImage = exports.CONFIGURABLE_RUNTIME_FLAGS = exports.VALID_RUNTIME_IMAGES = exports.CONFIGURABLE_RUNTIME_IMAGES = exports.LEGACY_RUNTIME_IMAGE = void 0;
3
+ exports.promptRuntimeImage = exports.promptRuntimeOptions = exports.validateRuntimeTimeout = exports.getMaxRuntimeTimeout = exports.buildReactorRuntime = exports.buildRuntime = exports.parseRuntimePackageJsonFile = exports.validateRuntimeImage = exports.isLegacyRuntimeImage = exports.REACTOR_CONFIGURABLE_RUNTIME_FLAGS = exports.CONFIGURABLE_RUNTIME_FLAGS = exports.VALID_RUNTIME_IMAGES = exports.CONFIGURABLE_RUNTIME_IMAGES = exports.LEGACY_RUNTIME_IMAGE = void 0;
4
4
  const files_1 = require("../files");
5
5
  const utils_1 = require("../utils");
6
6
  const LEGACY_RUNTIME_IMAGE = 'node-bt';
@@ -12,6 +12,9 @@ const VALID_RUNTIME_IMAGES = [
12
12
  ...CONFIGURABLE_RUNTIME_IMAGES,
13
13
  ];
14
14
  exports.VALID_RUNTIME_IMAGES = VALID_RUNTIME_IMAGES;
15
+ const MIN_RUNTIME_TIMEOUT = 10;
16
+ const MAX_SYNC_RUNTIME_TIMEOUT = 30;
17
+ const MAX_ASYNC_RUNTIME_TIMEOUT = 900;
15
18
  const isLegacyRuntimeImage = (image) => image === undefined || image === LEGACY_RUNTIME_IMAGE;
16
19
  exports.isLegacyRuntimeImage = isLegacyRuntimeImage;
17
20
  const validateRuntimeImage = (image) => {
@@ -31,6 +34,11 @@ const CONFIGURABLE_RUNTIME_FLAGS = [
31
34
  'package-json',
32
35
  ];
33
36
  exports.CONFIGURABLE_RUNTIME_FLAGS = CONFIGURABLE_RUNTIME_FLAGS;
37
+ const REACTOR_CONFIGURABLE_RUNTIME_FLAGS = [
38
+ ...CONFIGURABLE_RUNTIME_FLAGS,
39
+ 'async',
40
+ ];
41
+ exports.REACTOR_CONFIGURABLE_RUNTIME_FLAGS = REACTOR_CONFIGURABLE_RUNTIME_FLAGS;
34
42
  const isStringRecord = (value) => typeof value === 'object' &&
35
43
  Boolean(value) &&
36
44
  !Array.isArray(value) &&
@@ -77,7 +85,7 @@ const buildRuntime = (props) => {
77
85
  if (!image &&
78
86
  !packageJson &&
79
87
  !timeout &&
80
- !warmConcurrency &&
88
+ warmConcurrency === undefined &&
81
89
  !resources &&
82
90
  !(permissions === null || permissions === void 0 ? void 0 : permissions.length)) {
83
91
  return undefined;
@@ -111,12 +119,36 @@ const buildRuntime = (props) => {
111
119
  return runtime;
112
120
  };
113
121
  exports.buildRuntime = buildRuntime;
114
- const promptRuntimeOptions = async (flags, labelPrefix) => {
122
+ const buildReactorRuntime = (props) => {
123
+ const { async: runtimeAsync, ...runtimeProps } = props;
124
+ const runtime = buildRuntime(runtimeProps);
125
+ if (!runtime && runtimeAsync === undefined) {
126
+ return undefined;
127
+ }
128
+ return {
129
+ ...runtime,
130
+ ...(runtimeAsync !== undefined ? { async: runtimeAsync } : {}),
131
+ };
132
+ };
133
+ exports.buildReactorRuntime = buildReactorRuntime;
134
+ const getMaxRuntimeTimeout = (runtimeAsync) => runtimeAsync ? MAX_ASYNC_RUNTIME_TIMEOUT : MAX_SYNC_RUNTIME_TIMEOUT;
135
+ exports.getMaxRuntimeTimeout = getMaxRuntimeTimeout;
136
+ const validateRuntimeTimeout = (timeout, runtimeAsync) => {
137
+ if (timeout === undefined) {
138
+ return;
139
+ }
140
+ const max = getMaxRuntimeTimeout(runtimeAsync);
141
+ if (timeout < MIN_RUNTIME_TIMEOUT || timeout > max) {
142
+ throw new Error(`Runtime timeout must be between ${MIN_RUNTIME_TIMEOUT} and ${max} seconds when runtime async is ${runtimeAsync ? 'enabled' : 'disabled'}.`);
143
+ }
144
+ };
145
+ exports.validateRuntimeTimeout = validateRuntimeTimeout;
146
+ const promptRuntimeOptions = async (flags, labelPrefix, timeoutMax = MAX_SYNC_RUNTIME_TIMEOUT) => {
115
147
  const prefix = labelPrefix ? `${labelPrefix}: ` : '';
116
148
  const timeout = await (0, utils_1.promptIntegerIfUndefined)(flags.timeout, {
117
- message: `${prefix}Timeout in seconds (1-30, press Enter for default: 10):`,
118
- min: 1,
119
- max: 30,
149
+ message: `${prefix}Timeout in seconds (${MIN_RUNTIME_TIMEOUT}-${timeoutMax}, press Enter for default: 10):`,
150
+ min: MIN_RUNTIME_TIMEOUT,
151
+ max: timeoutMax,
120
152
  });
121
153
  const warmConcurrency = await (0, utils_1.promptIntegerIfUndefined)(flags['warm-concurrency'], {
122
154
  message: `${prefix}Warm concurrency (0-1, press Enter for default: 0):`,
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "3.0.0",
2
+ "version": "4.0.0",
3
3
  "commands": {
4
4
  "applications:create": {
5
5
  "id": "applications:create",
@@ -305,7 +305,7 @@
305
305
  "request-transform-timeout": {
306
306
  "name": "request-transform-timeout",
307
307
  "type": "option",
308
- "description": "request-transform timeout in seconds, 1-30 (node22 only)",
308
+ "description": "request-transform timeout in seconds, 10-30 (node22 only)",
309
309
  "multiple": false
310
310
  },
311
311
  "request-transform-warm-concurrency": {
@@ -350,7 +350,7 @@
350
350
  "response-transform-timeout": {
351
351
  "name": "response-transform-timeout",
352
352
  "type": "option",
353
- "description": "response-transform timeout in seconds, 1-30 (node22 only)",
353
+ "description": "response-transform timeout in seconds, 10-30 (node22 only)",
354
354
  "multiple": false
355
355
  },
356
356
  "response-transform-warm-concurrency": {
@@ -376,8 +376,8 @@
376
376
  "description": "response-transform permission to grant, repeatable (node22 only)",
377
377
  "multiple": true
378
378
  },
379
- "async": {
380
- "name": "async",
379
+ "no-wait": {
380
+ "name": "no-wait",
381
381
  "type": "boolean",
382
382
  "description": "do not wait for proxy to be ready (requires at least one transform with node22)",
383
383
  "allowNo": false
@@ -621,7 +621,7 @@
621
621
  "request-transform-timeout": {
622
622
  "name": "request-transform-timeout",
623
623
  "type": "option",
624
- "description": "request-transform timeout in seconds, 1-30 (node22 only)",
624
+ "description": "request-transform timeout in seconds, 10-30 (node22 only)",
625
625
  "multiple": false
626
626
  },
627
627
  "request-transform-warm-concurrency": {
@@ -666,7 +666,7 @@
666
666
  "response-transform-timeout": {
667
667
  "name": "response-transform-timeout",
668
668
  "type": "option",
669
- "description": "response-transform timeout in seconds, 1-30 (node22 only)",
669
+ "description": "response-transform timeout in seconds, 10-30 (node22 only)",
670
670
  "multiple": false
671
671
  },
672
672
  "response-transform-warm-concurrency": {
@@ -692,8 +692,8 @@
692
692
  "description": "response-transform permission to grant, repeatable (node22 only)",
693
693
  "multiple": true
694
694
  },
695
- "async": {
696
- "name": "async",
695
+ "no-wait": {
696
+ "name": "no-wait",
697
697
  "type": "boolean",
698
698
  "description": "do not wait for proxy to be ready (requires at least one transform with node22)",
699
699
  "allowNo": false
@@ -742,7 +742,7 @@
742
742
  },
743
743
  {
744
744
  "description": "Create a reactor with node22 and all runtime options",
745
- "command": "<%= config.bin %> <%= command.id %> --name \"My Reactor\" --code ./reactor.js --configuration ./config.env --image node22 --timeout 10 --warm-concurrency 0 --resources standard --package-json ./package.json --permissions token:read --permissions token:create"
745
+ "command": "<%= config.bin %> <%= command.id %> --name \"My Reactor\" --code ./reactor.js --configuration ./config.env --image node22 --async --timeout 10 --warm-concurrency 0 --resources standard --package-json ./package.json --permissions token:read --permissions token:create"
746
746
  }
747
747
  ],
748
748
  "flags": {
@@ -808,7 +808,7 @@
808
808
  "timeout": {
809
809
  "name": "timeout",
810
810
  "type": "option",
811
- "description": "timeout in seconds, 1-30 (node22 only, default: 10)",
811
+ "description": "timeout in seconds, 10-900 (node22 only; maximum 30 when runtime async is disabled; default: 10)",
812
812
  "multiple": false
813
813
  },
814
814
  "warm-concurrency": {
@@ -834,11 +834,17 @@
834
834
  "description": "permission to grant, repeatable (node22 only)",
835
835
  "multiple": true
836
836
  },
837
+ "no-wait": {
838
+ "name": "no-wait",
839
+ "type": "boolean",
840
+ "description": "do not wait for resource provisioning to complete",
841
+ "allowNo": false
842
+ },
837
843
  "async": {
838
844
  "name": "async",
839
845
  "type": "boolean",
840
- "description": "do not wait for resource to be ready (node22 only)",
841
- "allowNo": false
846
+ "description": "execute Reactor invocations asynchronously (node22 only)",
847
+ "allowNo": true
842
848
  }
843
849
  },
844
850
  "args": {}
@@ -988,7 +994,7 @@
988
994
  },
989
995
  {
990
996
  "description": "Update a reactor with node22 and all runtime options",
991
- "command": "<%= config.bin %> <%= command.id %> <reactor-id> --name \"My Reactor\" --code ./reactor.js --configuration ./config.env --image node22 --timeout 10 --warm-concurrency 0 --resources standard --package-json ./package.json --permissions token:read --permissions token:create"
997
+ "command": "<%= config.bin %> <%= command.id %> <reactor-id> --name \"My Reactor\" --code ./reactor.js --configuration ./config.env --image node22 --async --timeout 10 --warm-concurrency 0 --resources standard --package-json ./package.json --permissions token:read --permissions token:create"
992
998
  }
993
999
  ],
994
1000
  "flags": {
@@ -1054,7 +1060,7 @@
1054
1060
  "timeout": {
1055
1061
  "name": "timeout",
1056
1062
  "type": "option",
1057
- "description": "timeout in seconds, 1-30 (node22 only, default: 10)",
1063
+ "description": "timeout in seconds, 10-900 (node22 only; maximum 30 when runtime async is disabled; default: 10)",
1058
1064
  "multiple": false
1059
1065
  },
1060
1066
  "warm-concurrency": {
@@ -1080,11 +1086,17 @@
1080
1086
  "description": "permission to grant, repeatable (node22 only)",
1081
1087
  "multiple": true
1082
1088
  },
1089
+ "no-wait": {
1090
+ "name": "no-wait",
1091
+ "type": "boolean",
1092
+ "description": "do not wait for resource provisioning to complete",
1093
+ "allowNo": false
1094
+ },
1083
1095
  "async": {
1084
1096
  "name": "async",
1085
1097
  "type": "boolean",
1086
- "description": "do not wait for resource to be ready (node22 only)",
1087
- "allowNo": false
1098
+ "description": "execute Reactor invocations asynchronously (node22 only)",
1099
+ "allowNo": true
1088
1100
  },
1089
1101
  "watch": {
1090
1102
  "name": "watch",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@basis-theory-labs/cli",
3
- "version": "3.0.0",
3
+ "version": "4.0.0",
4
4
  "description": "Basis Theory CLI tool",
5
5
  "author": "Davi Aquino @djejaquino",
6
6
  "bin": {
@@ -17,7 +17,7 @@
17
17
  "/oclif.manifest.json"
18
18
  ],
19
19
  "dependencies": {
20
- "@basis-theory/node-sdk": "^5.2.0",
20
+ "@basis-theory/node-sdk": "^6.1.1",
21
21
  "@inquirer/checkbox": "^1.5.0",
22
22
  "@inquirer/confirm": "^2.0.15",
23
23
  "@inquirer/input": "^1.2.14",
@@ -29,7 +29,6 @@
29
29
  "debug": "^4.3.4",
30
30
  "detect-port": "^1.5.1",
31
31
  "dotenv": "^16.3.1",
32
- "fastify": "^4.19.2",
33
32
  "lodash.debounce": "^4.0.8",
34
33
  "lodash.groupby": "^4.6.0",
35
34
  "pino": "^8.14.1",
@@ -41,18 +40,18 @@
41
40
  "@basis-theory/eslint-config": "^1.2.0",
42
41
  "@oclif/test": "^2.3.22",
43
42
  "@semantic-release/changelog": "^6.0.3",
44
- "@semantic-release/commit-analyzer": "^10.0.1",
43
+ "@semantic-release/commit-analyzer": "^13.0.1",
45
44
  "@semantic-release/git": "^10.0.1",
46
- "@semantic-release/github": "^9.0.3",
47
- "@semantic-release/npm": "^10.0.4",
48
- "@semantic-release/release-notes-generator": "^11.0.3",
45
+ "@semantic-release/github": "^12.0.0",
46
+ "@semantic-release/npm": "^13.1.5",
47
+ "@semantic-release/release-notes-generator": "^14.1.0",
49
48
  "@types/chai": "^4",
50
49
  "@types/debug": "^4.1.8",
51
50
  "@types/detect-port": "^1.3.3",
52
51
  "@types/lodash.debounce": "^4.0.7",
53
52
  "@types/lodash.groupby": "^4.6.9",
54
53
  "@types/mocha": "^9.0.0",
55
- "@types/node": "^16.18.36",
54
+ "@types/node": "^18.19.0",
56
55
  "@types/sinon": "^21.0.0",
57
56
  "chai": "^4",
58
57
  "eslint": "^7.32.0",
@@ -61,7 +60,7 @@
61
60
  "mocha": "^9.2.2",
62
61
  "oclif": "^3",
63
62
  "prettier": "^2.8.8",
64
- "semantic-release": "^21.0.5",
63
+ "semantic-release": "^25.0.7",
65
64
  "shx": "^0.3.3",
66
65
  "sinon": "^21.0.1",
67
66
  "ts-node": "^10.9.1",
@@ -93,7 +92,7 @@
93
92
  "release": "semantic-release"
94
93
  },
95
94
  "engines": {
96
- "node": ">=12.0.0"
95
+ "node": ">=18.0.0"
97
96
  },
98
97
  "bugs": "https://github.com/Basis-Theory-Labs/basistheory-cli/issues",
99
98
  "keywords": [