@basis-theory-labs/cli 2.1.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 +52 -44
- package/dist/commands/proxies/create.d.ts +3 -3
- package/dist/commands/proxies/create.js +3 -3
- package/dist/commands/proxies/update.d.ts +3 -3
- package/dist/commands/proxies/update.js +6 -6
- package/dist/commands/reactors/create.d.ts +3 -2
- package/dist/commands/reactors/create.js +14 -6
- package/dist/commands/reactors/update.d.ts +3 -2
- package/dist/commands/reactors/update.js +20 -6
- package/dist/logs/connect.js +3 -3
- package/dist/logs/http.d.ts +2 -2
- package/dist/logs/http.js +20 -10
- package/dist/logs/server.js +5 -3
- package/dist/proxies/runtime.js +1 -1
- package/dist/proxies/utils.d.ts +3 -3
- package/dist/proxies/utils.js +9 -9
- package/dist/reactors/runtime.d.ts +2 -1
- package/dist/reactors/runtime.js +8 -5
- package/dist/reactors/utils.d.ts +7 -4
- package/dist/reactors/utils.js +4 -0
- package/dist/runtime/flags.d.ts +2 -2
- package/dist/runtime/flags.js +7 -7
- package/dist/runtime/index.d.ts +1 -1
- package/dist/runtime/index.js +6 -1
- package/dist/runtime/state.js +20 -1
- package/dist/runtime/utils.d.ts +18 -6
- package/dist/runtime/utils.js +93 -22
- package/oclif.manifest.json +49 -37
- package/package.json +9 -10
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/
|
|
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/
|
|
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/
|
|
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
|
|
|
@@ -160,12 +160,12 @@ Creates a new Pre-Configured Proxy. Requires `proxy:create` Management Applicati
|
|
|
160
160
|
```
|
|
161
161
|
USAGE
|
|
162
162
|
$ bt proxies create -x <value> [-n <value>] [-u <value>] [-q <value>] [-s <value>] [-i <value>] [-c <value>] [-a]
|
|
163
|
-
[--request-transform-image node-bt|node22] [--request-transform-
|
|
163
|
+
[--request-transform-image node-bt|node22] [--request-transform-package-json <value>] [--request-transform-timeout
|
|
164
164
|
<value>] [--request-transform-warm-concurrency <value>] [--request-transform-resources standard|large|xlarge]
|
|
165
165
|
[--request-transform-permissions <value>] [--response-transform-image node-bt|node22]
|
|
166
|
-
[--response-transform-
|
|
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>] [--
|
|
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,25 +177,27 @@ 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
|
-
--
|
|
180
|
+
--no-wait do not wait for proxy to be ready (requires at least one transform with
|
|
181
181
|
node22)
|
|
182
|
-
--request-transform-dependencies=<value> path to JSON file with npm dependencies, e.g. {"axios": "1.7.9",
|
|
183
|
-
"lodash": "4.17.21"} (node22 only)
|
|
184
182
|
--request-transform-image=<option> request-transform runtime image (node-bt|node22)
|
|
185
183
|
<options: node-bt|node22>
|
|
184
|
+
--request-transform-package-json=<value> path to runtime package.json JSON file (top-level dependencies
|
|
185
|
+
required; supports resolutions or overrides fallback; pinned versions
|
|
186
|
+
required) (node22 only)
|
|
186
187
|
--request-transform-permissions=<value>... request-transform permission to grant, repeatable (node22 only)
|
|
187
188
|
--request-transform-resources=<option> request-transform resource tier (node22 only)
|
|
188
189
|
<options: standard|large|xlarge>
|
|
189
|
-
--request-transform-timeout=<value> request-transform timeout in seconds,
|
|
190
|
+
--request-transform-timeout=<value> request-transform timeout in seconds, 10-30 (node22 only)
|
|
190
191
|
--request-transform-warm-concurrency=<value> request-transform warm concurrency, 0-1 (node22 only)
|
|
191
|
-
--response-transform-dependencies=<value> path to JSON file with npm dependencies, e.g. {"axios": "1.7.9",
|
|
192
|
-
"lodash": "4.17.21"} (node22 only)
|
|
193
192
|
--response-transform-image=<option> response-transform runtime image (node-bt|node22)
|
|
194
193
|
<options: node-bt|node22>
|
|
194
|
+
--response-transform-package-json=<value> path to runtime package.json JSON file (top-level dependencies
|
|
195
|
+
required; supports resolutions or overrides fallback; pinned versions
|
|
196
|
+
required) (node22 only)
|
|
195
197
|
--response-transform-permissions=<value>... response-transform permission to grant, repeatable (node22 only)
|
|
196
198
|
--response-transform-resources=<option> response-transform resource tier (node22 only)
|
|
197
199
|
<options: standard|large|xlarge>
|
|
198
|
-
--response-transform-timeout=<value> response-transform timeout in seconds,
|
|
200
|
+
--response-transform-timeout=<value> response-transform timeout in seconds, 10-30 (node22 only)
|
|
199
201
|
--response-transform-warm-concurrency=<value> response-transform warm concurrency, 0-1 (node22 only)
|
|
200
202
|
|
|
201
203
|
DESCRIPTION
|
|
@@ -222,10 +224,10 @@ EXAMPLES
|
|
|
222
224
|
$ bt proxies create --name "My Proxy" --destination-url https://api.example.com --configuration ./config.env \
|
|
223
225
|
--require-auth --request-transform-code ./request.js --request-transform-image node22 \
|
|
224
226
|
--request-transform-timeout 10 --request-transform-warm-concurrency 0 --request-transform-resources standard \
|
|
225
|
-
--request-transform-
|
|
227
|
+
--request-transform-package-json ./request/package.json --request-transform-permissions token:read \
|
|
226
228
|
--response-transform-code ./response.js --response-transform-image node22 --response-transform-timeout 10 \
|
|
227
229
|
--response-transform-warm-concurrency 0 --response-transform-resources standard \
|
|
228
|
-
--response-transform-
|
|
230
|
+
--response-transform-package-json ./response/package.json --response-transform-permissions token:read
|
|
229
231
|
```
|
|
230
232
|
|
|
231
233
|
## `bt proxies delete ID`
|
|
@@ -283,12 +285,12 @@ Updates an existing Pre-Configured Proxy. Requires `proxy:update` Management App
|
|
|
283
285
|
```
|
|
284
286
|
USAGE
|
|
285
287
|
$ bt proxies update ID -x <value> [-n <value>] [-u <value>] [-q <value>] [-s <value>] [-i <value>] [-c <value>]
|
|
286
|
-
[-a] [--request-transform-image node-bt|node22] [--request-transform-
|
|
288
|
+
[-a] [--request-transform-image node-bt|node22] [--request-transform-package-json <value>]
|
|
287
289
|
[--request-transform-timeout <value>] [--request-transform-warm-concurrency <value>] [--request-transform-resources
|
|
288
290
|
standard|large|xlarge] [--request-transform-permissions <value>] [--response-transform-image node-bt|node22]
|
|
289
|
-
[--response-transform-
|
|
291
|
+
[--response-transform-package-json <value>] [--response-transform-timeout <value>]
|
|
290
292
|
[--response-transform-warm-concurrency <value>] [--response-transform-resources standard|large|xlarge]
|
|
291
|
-
[--response-transform-permissions <value>] [--
|
|
293
|
+
[--response-transform-permissions <value>] [--no-wait] [-w] [-l]
|
|
292
294
|
|
|
293
295
|
ARGUMENTS
|
|
294
296
|
ID Proxy id to update
|
|
@@ -305,25 +307,27 @@ FLAGS
|
|
|
305
307
|
-u, --destination-url=<value> URL to which requests will be proxied
|
|
306
308
|
-w, --watch Watch for changes in informed files
|
|
307
309
|
-x, --management-key=<value> (required) management key used for connecting with the reactor / proxy
|
|
308
|
-
--
|
|
310
|
+
--no-wait do not wait for proxy to be ready (requires at least one transform with
|
|
309
311
|
node22)
|
|
310
|
-
--request-transform-dependencies=<value> path to JSON file with npm dependencies, e.g. {"axios": "1.7.9",
|
|
311
|
-
"lodash": "4.17.21"} (node22 only)
|
|
312
312
|
--request-transform-image=<option> request-transform runtime image (node-bt|node22)
|
|
313
313
|
<options: node-bt|node22>
|
|
314
|
+
--request-transform-package-json=<value> path to runtime package.json JSON file (top-level dependencies
|
|
315
|
+
required; supports resolutions or overrides fallback; pinned versions
|
|
316
|
+
required) (node22 only)
|
|
314
317
|
--request-transform-permissions=<value>... request-transform permission to grant, repeatable (node22 only)
|
|
315
318
|
--request-transform-resources=<option> request-transform resource tier (node22 only)
|
|
316
319
|
<options: standard|large|xlarge>
|
|
317
|
-
--request-transform-timeout=<value> request-transform timeout in seconds,
|
|
320
|
+
--request-transform-timeout=<value> request-transform timeout in seconds, 10-30 (node22 only)
|
|
318
321
|
--request-transform-warm-concurrency=<value> request-transform warm concurrency, 0-1 (node22 only)
|
|
319
|
-
--response-transform-dependencies=<value> path to JSON file with npm dependencies, e.g. {"axios": "1.7.9",
|
|
320
|
-
"lodash": "4.17.21"} (node22 only)
|
|
321
322
|
--response-transform-image=<option> response-transform runtime image (node-bt|node22)
|
|
322
323
|
<options: node-bt|node22>
|
|
324
|
+
--response-transform-package-json=<value> path to runtime package.json JSON file (top-level dependencies
|
|
325
|
+
required; supports resolutions or overrides fallback; pinned versions
|
|
326
|
+
required) (node22 only)
|
|
323
327
|
--response-transform-permissions=<value>... response-transform permission to grant, repeatable (node22 only)
|
|
324
328
|
--response-transform-resources=<option> response-transform resource tier (node22 only)
|
|
325
329
|
<options: standard|large|xlarge>
|
|
326
|
-
--response-transform-timeout=<value> response-transform timeout in seconds,
|
|
330
|
+
--response-transform-timeout=<value> response-transform timeout in seconds, 10-30 (node22 only)
|
|
327
331
|
--response-transform-warm-concurrency=<value> response-transform warm concurrency, 0-1 (node22 only)
|
|
328
332
|
|
|
329
333
|
DESCRIPTION
|
|
@@ -349,10 +353,10 @@ EXAMPLES
|
|
|
349
353
|
$ bt proxies update <proxy-id> --name "My Proxy" --destination-url https://api.example.com --configuration \
|
|
350
354
|
./config.env --require-auth --request-transform-code ./request.js --request-transform-image node22 \
|
|
351
355
|
--request-transform-timeout 10 --request-transform-warm-concurrency 0 --request-transform-resources standard \
|
|
352
|
-
--request-transform-
|
|
356
|
+
--request-transform-package-json ./request/package.json --request-transform-permissions token:read \
|
|
353
357
|
--response-transform-code ./response.js --response-transform-image node22 --response-transform-timeout 10 \
|
|
354
358
|
--response-transform-warm-concurrency 0 --response-transform-resources standard \
|
|
355
|
-
--response-transform-
|
|
359
|
+
--response-transform-package-json ./response/package.json --response-transform-permissions token:read
|
|
356
360
|
```
|
|
357
361
|
|
|
358
362
|
## `bt reactors`
|
|
@@ -374,7 +378,7 @@ EXAMPLES
|
|
|
374
378
|
$ bt reactors
|
|
375
379
|
```
|
|
376
380
|
|
|
377
|
-
_See code: [dist/commands/reactors/index.ts](https://github.com/Basis-Theory-Labs/basistheory-cli/blob/
|
|
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)_
|
|
378
382
|
|
|
379
383
|
## `bt reactors create`
|
|
380
384
|
|
|
@@ -383,8 +387,8 @@ Creates a new Reactor. Requires `reactor:create` Management Application permissi
|
|
|
383
387
|
```
|
|
384
388
|
USAGE
|
|
385
389
|
$ bt reactors create -x <value> [-n <value>] [-c <value>] [-i <value>] [-r <value>] [--image node-bt|node22]
|
|
386
|
-
[--
|
|
387
|
-
[--permissions <value>] [--async]
|
|
390
|
+
[--package-json <value>] [--timeout <value>] [--warm-concurrency <value>] [--resources standard|large|xlarge]
|
|
391
|
+
[--permissions <value>] [--no-wait] [--async]
|
|
388
392
|
|
|
389
393
|
FLAGS
|
|
390
394
|
-c, --configuration=<value> path to configuration file (.env format) to use in the Reactor
|
|
@@ -392,15 +396,17 @@ FLAGS
|
|
|
392
396
|
-n, --name=<value> name of the Reactor
|
|
393
397
|
-r, --code=<value> path to JavaScript file containing the Reactor code
|
|
394
398
|
-x, --management-key=<value> (required) management key used for connecting with the reactor / proxy
|
|
395
|
-
--async
|
|
396
|
-
--dependencies=<value> path to JSON file with npm dependencies, e.g. {"axios": "1.7.9", "lodash": "4.17.21"}
|
|
397
|
-
(node22 only)
|
|
399
|
+
--[no-]async execute Reactor invocations asynchronously (node22 only)
|
|
398
400
|
--image=<option> runtime image (node-bt|node22)
|
|
399
401
|
<options: node-bt|node22>
|
|
402
|
+
--no-wait do not wait for resource provisioning to complete
|
|
403
|
+
--package-json=<value> path to runtime package.json JSON file (top-level dependencies required; supports
|
|
404
|
+
resolutions or overrides fallback; pinned versions required) (node22 only)
|
|
400
405
|
--permissions=<value>... permission to grant, repeatable (node22 only)
|
|
401
406
|
--resources=<option> resource tier (node22 only, default: standard)
|
|
402
407
|
<options: standard|large|xlarge>
|
|
403
|
-
--timeout=<value> timeout in seconds,
|
|
408
|
+
--timeout=<value> timeout in seconds, 10-900 (node22 only; maximum 30 when runtime async is disabled;
|
|
409
|
+
default: 10)
|
|
404
410
|
--warm-concurrency=<value> number of warm instances, 0-1 (node22 only, default: 0)
|
|
405
411
|
|
|
406
412
|
DESCRIPTION
|
|
@@ -417,8 +423,8 @@ EXAMPLES
|
|
|
417
423
|
|
|
418
424
|
Create a reactor with node22 and all runtime options
|
|
419
425
|
|
|
420
|
-
$ bt reactors create --name "My Reactor" --code ./reactor.js --configuration ./config.env --image node22 \
|
|
421
|
-
--timeout 10 --warm-concurrency 0 --resources standard --
|
|
426
|
+
$ bt reactors create --name "My Reactor" --code ./reactor.js --configuration ./config.env --image node22 --async \
|
|
427
|
+
--timeout 10 --warm-concurrency 0 --resources standard --package-json ./package.json --permissions token:read \
|
|
422
428
|
--permissions token:create
|
|
423
429
|
```
|
|
424
430
|
|
|
@@ -477,8 +483,8 @@ Updates an existing Reactor. Requires `reactor:update` Management Application pe
|
|
|
477
483
|
```
|
|
478
484
|
USAGE
|
|
479
485
|
$ bt reactors update ID -x <value> [-n <value>] [-c <value>] [-i <value>] [-r <value>] [--image node-bt|node22]
|
|
480
|
-
[--
|
|
481
|
-
[--permissions <value>] [--async] [-w] [-l]
|
|
486
|
+
[--package-json <value>] [--timeout <value>] [--warm-concurrency <value>] [--resources standard|large|xlarge]
|
|
487
|
+
[--permissions <value>] [--no-wait] [--async] [-w] [-l]
|
|
482
488
|
|
|
483
489
|
ARGUMENTS
|
|
484
490
|
ID Reactor id to update
|
|
@@ -491,15 +497,17 @@ FLAGS
|
|
|
491
497
|
-r, --code=<value> path to JavaScript file containing the Reactor code
|
|
492
498
|
-w, --watch Watch for changes in informed files
|
|
493
499
|
-x, --management-key=<value> (required) management key used for connecting with the reactor / proxy
|
|
494
|
-
--async
|
|
495
|
-
--dependencies=<value> path to JSON file with npm dependencies, e.g. {"axios": "1.7.9", "lodash": "4.17.21"}
|
|
496
|
-
(node22 only)
|
|
500
|
+
--[no-]async execute Reactor invocations asynchronously (node22 only)
|
|
497
501
|
--image=<option> runtime image (node-bt|node22)
|
|
498
502
|
<options: node-bt|node22>
|
|
503
|
+
--no-wait do not wait for resource provisioning to complete
|
|
504
|
+
--package-json=<value> path to runtime package.json JSON file (top-level dependencies required; supports
|
|
505
|
+
resolutions or overrides fallback; pinned versions required) (node22 only)
|
|
499
506
|
--permissions=<value>... permission to grant, repeatable (node22 only)
|
|
500
507
|
--resources=<option> resource tier (node22 only, default: standard)
|
|
501
508
|
<options: standard|large|xlarge>
|
|
502
|
-
--timeout=<value> timeout in seconds,
|
|
509
|
+
--timeout=<value> timeout in seconds, 10-900 (node22 only; maximum 30 when runtime async is disabled;
|
|
510
|
+
default: 10)
|
|
503
511
|
--warm-concurrency=<value> number of warm instances, 0-1 (node22 only, default: 0)
|
|
504
512
|
|
|
505
513
|
DESCRIPTION
|
|
@@ -517,7 +525,7 @@ EXAMPLES
|
|
|
517
525
|
Update a reactor with node22 and all runtime options
|
|
518
526
|
|
|
519
527
|
$ bt reactors update <reactor-id> --name "My Reactor" --code ./reactor.js --configuration ./config.env --image \
|
|
520
|
-
node22 --timeout 10 --warm-concurrency 0 --resources standard --
|
|
521
|
-
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
|
|
522
530
|
```
|
|
523
531
|
<!-- commandsstop -->
|
|
@@ -15,18 +15,18 @@ export default class Create extends BaseCommand {
|
|
|
15
15
|
configuration: import("@oclif/core/lib/interfaces/parser").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
|
|
16
16
|
'require-auth': import("@oclif/core/lib/interfaces/parser").BooleanFlag<boolean>;
|
|
17
17
|
'request-transform-image': import("@oclif/core/lib/interfaces/parser").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
|
|
18
|
-
'request-transform-
|
|
18
|
+
'request-transform-package-json': import("@oclif/core/lib/interfaces/parser").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
|
|
19
19
|
'request-transform-timeout': import("@oclif/core/lib/interfaces/parser").OptionFlag<number | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
|
|
20
20
|
'request-transform-warm-concurrency': import("@oclif/core/lib/interfaces/parser").OptionFlag<number | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
|
|
21
21
|
'request-transform-resources': import("@oclif/core/lib/interfaces/parser").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
|
|
22
22
|
'request-transform-permissions': import("@oclif/core/lib/interfaces/parser").OptionFlag<string[] | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
|
|
23
23
|
'response-transform-image': import("@oclif/core/lib/interfaces/parser").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
|
|
24
|
-
'response-transform-
|
|
24
|
+
'response-transform-package-json': import("@oclif/core/lib/interfaces/parser").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
|
|
25
25
|
'response-transform-timeout': import("@oclif/core/lib/interfaces/parser").OptionFlag<number | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
|
|
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
|
-
|
|
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
|
|
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!');
|
|
@@ -116,14 +116,14 @@ Create.examples = [
|
|
|
116
116
|
'--request-transform-timeout 10 ' +
|
|
117
117
|
'--request-transform-warm-concurrency 0 ' +
|
|
118
118
|
'--request-transform-resources standard ' +
|
|
119
|
-
'--request-transform-
|
|
119
|
+
'--request-transform-package-json ./request/package.json ' +
|
|
120
120
|
'--request-transform-permissions token:read ' +
|
|
121
121
|
'--response-transform-code ./response.js ' +
|
|
122
122
|
'--response-transform-image node22 ' +
|
|
123
123
|
'--response-transform-timeout 10 ' +
|
|
124
124
|
'--response-transform-warm-concurrency 0 ' +
|
|
125
125
|
'--response-transform-resources standard ' +
|
|
126
|
-
'--response-transform-
|
|
126
|
+
'--response-transform-package-json ./response/package.json ' +
|
|
127
127
|
'--response-transform-permissions token:read',
|
|
128
128
|
},
|
|
129
129
|
];
|
|
@@ -17,18 +17,18 @@ export default class Update extends BaseCommand {
|
|
|
17
17
|
configuration: import("@oclif/core/lib/interfaces/parser").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
|
|
18
18
|
'require-auth': import("@oclif/core/lib/interfaces/parser").BooleanFlag<boolean>;
|
|
19
19
|
'request-transform-image': import("@oclif/core/lib/interfaces/parser").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
|
|
20
|
-
'request-transform-
|
|
20
|
+
'request-transform-package-json': import("@oclif/core/lib/interfaces/parser").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
|
|
21
21
|
'request-transform-timeout': import("@oclif/core/lib/interfaces/parser").OptionFlag<number | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
|
|
22
22
|
'request-transform-warm-concurrency': import("@oclif/core/lib/interfaces/parser").OptionFlag<number | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
|
|
23
23
|
'request-transform-resources': import("@oclif/core/lib/interfaces/parser").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
|
|
24
24
|
'request-transform-permissions': import("@oclif/core/lib/interfaces/parser").OptionFlag<string[] | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
|
|
25
25
|
'response-transform-image': import("@oclif/core/lib/interfaces/parser").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
|
|
26
|
-
'response-transform-
|
|
26
|
+
'response-transform-package-json': import("@oclif/core/lib/interfaces/parser").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
|
|
27
27
|
'response-transform-timeout': import("@oclif/core/lib/interfaces/parser").OptionFlag<number | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
|
|
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
|
-
|
|
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,11 +12,11 @@ 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-
|
|
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,
|
|
19
|
-
|
|
19
|
+
packageJson: requestTransformPackageJson,
|
|
20
20
|
timeout: requestTransformTimeout,
|
|
21
21
|
warmConcurrency: requestTransformWarmConcurrency,
|
|
22
22
|
resources: requestTransformResources,
|
|
@@ -24,7 +24,7 @@ class Update extends base_1.BaseCommand {
|
|
|
24
24
|
});
|
|
25
25
|
const responseTransformRuntime = (0, runtime_2.buildRuntime)({
|
|
26
26
|
image: responseTransformImage,
|
|
27
|
-
|
|
27
|
+
packageJson: responseTransformPackageJson,
|
|
28
28
|
timeout: responseTransformTimeout,
|
|
29
29
|
warmConcurrency: responseTransformWarmConcurrency,
|
|
30
30
|
resources: responseTransformResources,
|
|
@@ -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 (!
|
|
49
|
+
if (!noWait) {
|
|
50
50
|
await (0, runtime_2.waitForResourceState)(bt, 'proxy', id, proxy.state);
|
|
51
51
|
}
|
|
52
52
|
this.log('Proxy updated successfully!');
|
|
@@ -105,14 +105,14 @@ Update.examples = [
|
|
|
105
105
|
'--request-transform-timeout 10 ' +
|
|
106
106
|
'--request-transform-warm-concurrency 0 ' +
|
|
107
107
|
'--request-transform-resources standard ' +
|
|
108
|
-
'--request-transform-
|
|
108
|
+
'--request-transform-package-json ./request/package.json ' +
|
|
109
109
|
'--request-transform-permissions token:read ' +
|
|
110
110
|
'--response-transform-code ./response.js ' +
|
|
111
111
|
'--response-transform-image node22 ' +
|
|
112
112
|
'--response-transform-timeout 10 ' +
|
|
113
113
|
'--response-transform-warm-concurrency 0 ' +
|
|
114
114
|
'--response-transform-resources standard ' +
|
|
115
|
-
'--response-transform-
|
|
115
|
+
'--response-transform-package-json ./response/package.json ' +
|
|
116
116
|
'--response-transform-permissions token:read',
|
|
117
117
|
},
|
|
118
118
|
];
|
|
@@ -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
|
-
|
|
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,
|
|
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
|
-
|
|
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 (!
|
|
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,10 +96,11 @@ 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 ' +
|
|
95
|
-
'--
|
|
103
|
+
'--package-json ./package.json ' +
|
|
96
104
|
'--permissions token:read ' +
|
|
97
105
|
'--permissions token:create',
|
|
98
106
|
},
|
|
@@ -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
|
-
|
|
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,
|
|
15
|
-
(0, runtime_1.
|
|
16
|
-
|
|
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 (!
|
|
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,10 +93,11 @@ 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 ' +
|
|
86
|
-
'--
|
|
100
|
+
'--package-json ./package.json ' +
|
|
87
101
|
'--permissions token:read ' +
|
|
88
102
|
'--permissions token:create',
|
|
89
103
|
},
|
package/dist/logs/connect.js
CHANGED
|
@@ -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.
|
|
11
|
-
* the logging configuration
|
|
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
|
-
:
|
|
19
|
+
: '',
|
|
20
20
|
});
|
|
21
21
|
const connectToReactor = async (bt, id, url) => {
|
|
22
22
|
core_1.ux.action.start(`Connecting to Reactor (${id})`);
|
package/dist/logs/http.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import http from 'http';
|
|
2
2
|
import type { Logger } from 'pino';
|
|
3
|
-
declare const createHttpServer: (logger: Logger) =>
|
|
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
|
-
|
|
11
|
-
|
|
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
|
-
|
|
14
|
-
debug('
|
|
15
|
-
|
|
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
|
-
|
|
19
|
-
};
|
|
29
|
+
});
|
|
20
30
|
exports.createHttpServer = createHttpServer;
|