@basis-theory-labs/cli 1.6.0 → 1.8.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 +136 -3
- package/dist/commands/reactorFormulas/index.d.ts +10 -0
- package/dist/commands/reactorFormulas/index.js +27 -0
- package/dist/commands/reactorFormulas/update.d.ts +18 -0
- package/dist/commands/reactorFormulas/update.js +71 -0
- package/dist/commands/reactors/create.d.ts +12 -0
- package/dist/commands/reactors/create.js +40 -0
- package/dist/commands/reactors/delete.d.ts +12 -0
- package/dist/commands/reactors/delete.js +32 -0
- package/dist/commands/reactors/index.js +7 -0
- package/dist/commands/reactors/update.d.ts +17 -0
- package/dist/commands/reactors/update.js +71 -0
- package/dist/reactorFormulas/management.d.ts +5 -0
- package/dist/reactorFormulas/management.js +54 -0
- package/dist/reactorFormulas/utils.d.ts +26 -0
- package/dist/reactorFormulas/utils.js +49 -0
- package/dist/reactors/management.d.ts +4 -2
- package/dist/reactors/management.js +23 -1
- package/dist/reactors/utils.d.ts +26 -0
- package/dist/reactors/utils.js +37 -0
- package/oclif.manifest.json +314 -1
- package/package.json +2 -2
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/1.
|
|
22
|
+
@basis-theory-labs/cli/1.8.0 linux-x64 node-v18.18.0
|
|
23
23
|
$ bt --help [COMMAND]
|
|
24
24
|
USAGE
|
|
25
25
|
$ bt COMMAND
|
|
@@ -33,8 +33,13 @@ USAGE
|
|
|
33
33
|
* [`bt proxies delete ID`](#bt-proxies-delete-id)
|
|
34
34
|
* [`bt proxies logs [ID]`](#bt-proxies-logs-id)
|
|
35
35
|
* [`bt proxies update ID`](#bt-proxies-update-id)
|
|
36
|
+
* [`bt reactorFormulas`](#bt-reactorformulas)
|
|
37
|
+
* [`bt reactorFormulas update ID`](#bt-reactorformulas-update-id)
|
|
36
38
|
* [`bt reactors`](#bt-reactors)
|
|
39
|
+
* [`bt reactors create`](#bt-reactors-create)
|
|
40
|
+
* [`bt reactors delete ID`](#bt-reactors-delete-id)
|
|
37
41
|
* [`bt reactors logs [ID]`](#bt-reactors-logs-id)
|
|
42
|
+
* [`bt reactors update ID`](#bt-reactors-update-id)
|
|
38
43
|
|
|
39
44
|
## `bt proxies`
|
|
40
45
|
|
|
@@ -55,7 +60,7 @@ EXAMPLES
|
|
|
55
60
|
$ bt proxies
|
|
56
61
|
```
|
|
57
62
|
|
|
58
|
-
_See code: [dist/commands/proxies/index.ts](https://github.com/Basis-Theory-Labs/basistheory-cli/blob/v1.
|
|
63
|
+
_See code: [dist/commands/proxies/index.ts](https://github.com/Basis-Theory-Labs/basistheory-cli/blob/v1.8.0/dist/commands/proxies/index.ts)_
|
|
59
64
|
|
|
60
65
|
## `bt proxies create`
|
|
61
66
|
|
|
@@ -169,6 +174,59 @@ EXAMPLES
|
|
|
169
174
|
$ bt proxies update 03858bf5-32d3-4a2e-b74b-daeea0883bca --configuration ./.env.proxy
|
|
170
175
|
```
|
|
171
176
|
|
|
177
|
+
## `bt reactorFormulas`
|
|
178
|
+
|
|
179
|
+
[Deprecated] List Reactor Formulas. Requires `reactor:read` Management Application permission
|
|
180
|
+
|
|
181
|
+
```
|
|
182
|
+
USAGE
|
|
183
|
+
$ bt reactorFormulas -x <value> [-p <value>]
|
|
184
|
+
|
|
185
|
+
FLAGS
|
|
186
|
+
-p, --page=<value> [default: 1] reactors formulas list page to fetch
|
|
187
|
+
-x, --management-key=<value> (required) management key used for connecting with the reactor / proxy
|
|
188
|
+
|
|
189
|
+
DESCRIPTION
|
|
190
|
+
[Deprecated] List Reactor Formulas. Requires `reactor:read` Management Application permission
|
|
191
|
+
|
|
192
|
+
EXAMPLES
|
|
193
|
+
$ bt reactorFormulas
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
_See code: [dist/commands/reactorFormulas/index.ts](https://github.com/Basis-Theory-Labs/basistheory-cli/blob/v1.8.0/dist/commands/reactorFormulas/index.ts)_
|
|
197
|
+
|
|
198
|
+
## `bt reactorFormulas update ID`
|
|
199
|
+
|
|
200
|
+
[Deprecated] Updates an existing Reactor Formula. Requires `reactor:update` Management Application permission
|
|
201
|
+
|
|
202
|
+
```
|
|
203
|
+
USAGE
|
|
204
|
+
$ bt reactorFormulas update ID -x <value> -n <value> -s <value> -c <value> -p <value> [-d <value>] [-i <value>] [-w]
|
|
205
|
+
|
|
206
|
+
ARGUMENTS
|
|
207
|
+
ID Reactor Formula id to update
|
|
208
|
+
|
|
209
|
+
FLAGS
|
|
210
|
+
-c, --configuration=<value> (required) path to configuration definition to use in the Reactor Formula
|
|
211
|
+
-d, --description=<value> description of the Reactor Formula
|
|
212
|
+
-i, --icon=<value> icon of the Reactor Formula
|
|
213
|
+
-n, --name=<value> (required) name of the Reactor Formula
|
|
214
|
+
-p, --request-parameters=<value> (required) path to request params definition to use in the Reactor Formula
|
|
215
|
+
-s, --code=<value> (required) path to JavaScript file containing code
|
|
216
|
+
-w, --watch Watch for changes in informed files
|
|
217
|
+
-x, --management-key=<value> (required) management key used for connecting with the reactor / proxy
|
|
218
|
+
|
|
219
|
+
DESCRIPTION
|
|
220
|
+
[Deprecated] Updates an existing Reactor Formula. Requires `reactor:update` Management Application permission
|
|
221
|
+
|
|
222
|
+
EXAMPLES
|
|
223
|
+
$ bt reactorFormulas update 03858bf5-32d3-4a2e-b74b-daeea0883bca
|
|
224
|
+
|
|
225
|
+
$ bt reactorFormulas update 03858bf5-32d3-4a2e-b74b-daeea0883bca --code ./formula.js
|
|
226
|
+
|
|
227
|
+
$ bt reactorFormulas update 03858bf5-32d3-4a2e-b74b-daeea0883bca --code ./formula.js -w
|
|
228
|
+
```
|
|
229
|
+
|
|
172
230
|
## `bt reactors`
|
|
173
231
|
|
|
174
232
|
List Reactors. Requires `reactor:read` Management Application permission
|
|
@@ -188,7 +246,51 @@ EXAMPLES
|
|
|
188
246
|
$ bt reactors
|
|
189
247
|
```
|
|
190
248
|
|
|
191
|
-
_See code: [dist/commands/reactors/index.ts](https://github.com/Basis-Theory-Labs/basistheory-cli/blob/v1.
|
|
249
|
+
_See code: [dist/commands/reactors/index.ts](https://github.com/Basis-Theory-Labs/basistheory-cli/blob/v1.8.0/dist/commands/reactors/index.ts)_
|
|
250
|
+
|
|
251
|
+
## `bt reactors create`
|
|
252
|
+
|
|
253
|
+
Creates a new Reactor. Requires `reactor:create` Management Application permission
|
|
254
|
+
|
|
255
|
+
```
|
|
256
|
+
USAGE
|
|
257
|
+
$ bt reactors create -x <value> [-n <value>] [-c <value>] [-i <value>] [-r <value>]
|
|
258
|
+
|
|
259
|
+
FLAGS
|
|
260
|
+
-c, --configuration=<value> path to configuration file (.env format) to use in the Reactor
|
|
261
|
+
-i, --application-id=<value> application ID to use in the Reactor
|
|
262
|
+
-n, --name=<value> name of the Reactor
|
|
263
|
+
-r, --code=<value> path to JavaScript file containing the Reactor code
|
|
264
|
+
-x, --management-key=<value> (required) management key used for connecting with the reactor / proxy
|
|
265
|
+
|
|
266
|
+
DESCRIPTION
|
|
267
|
+
Creates a new Reactor. Requires `reactor:create` Management Application permission
|
|
268
|
+
|
|
269
|
+
EXAMPLES
|
|
270
|
+
$ bt reactors create
|
|
271
|
+
```
|
|
272
|
+
|
|
273
|
+
## `bt reactors delete ID`
|
|
274
|
+
|
|
275
|
+
Deletes a Reactor. Requires `reactor:delete` and `reactor:read` Management Application permissions
|
|
276
|
+
|
|
277
|
+
```
|
|
278
|
+
USAGE
|
|
279
|
+
$ bt reactors delete ID -x <value> [-y]
|
|
280
|
+
|
|
281
|
+
ARGUMENTS
|
|
282
|
+
ID Reactor id to delete
|
|
283
|
+
|
|
284
|
+
FLAGS
|
|
285
|
+
-x, --management-key=<value> (required) management key used for connecting with the reactor / proxy
|
|
286
|
+
-y, --yes auto confirm the operation
|
|
287
|
+
|
|
288
|
+
DESCRIPTION
|
|
289
|
+
Deletes a Reactor. Requires `reactor:delete` and `reactor:read` Management Application permissions
|
|
290
|
+
|
|
291
|
+
EXAMPLES
|
|
292
|
+
$ bt reactors delete 03858bf5-32d3-4a2e-b74b-daeea0883bca
|
|
293
|
+
```
|
|
192
294
|
|
|
193
295
|
## `bt reactors logs [ID]`
|
|
194
296
|
|
|
@@ -215,4 +317,35 @@ EXAMPLES
|
|
|
215
317
|
|
|
216
318
|
$ bt reactors logs 03858bf5-32d3-4a2e-b74b-daeea0883bca -p 3000
|
|
217
319
|
```
|
|
320
|
+
|
|
321
|
+
## `bt reactors update ID`
|
|
322
|
+
|
|
323
|
+
Updates an existing Reactor. Requires `reactor:update` Management Application permission
|
|
324
|
+
|
|
325
|
+
```
|
|
326
|
+
USAGE
|
|
327
|
+
$ bt reactors update ID -x <value> [-n <value>] [-c <value>] [-i <value>] [-r <value>] [-w] [-l]
|
|
328
|
+
|
|
329
|
+
ARGUMENTS
|
|
330
|
+
ID Reactor id to update
|
|
331
|
+
|
|
332
|
+
FLAGS
|
|
333
|
+
-c, --configuration=<value> path to configuration file (.env format) to use in the Reactor
|
|
334
|
+
-i, --application-id=<value> application ID to use in the Reactor
|
|
335
|
+
-l, --logs Start logs server after update
|
|
336
|
+
-n, --name=<value> name of the Reactor
|
|
337
|
+
-r, --code=<value> path to JavaScript file containing the Reactor code
|
|
338
|
+
-w, --watch Watch for changes in informed files
|
|
339
|
+
-x, --management-key=<value> (required) management key used for connecting with the reactor / proxy
|
|
340
|
+
|
|
341
|
+
DESCRIPTION
|
|
342
|
+
Updates an existing Reactor. Requires `reactor:update` Management Application permission
|
|
343
|
+
|
|
344
|
+
EXAMPLES
|
|
345
|
+
$ bt reactors update 03858bf5-32d3-4a2e-b74b-daeea0883bca
|
|
346
|
+
|
|
347
|
+
$ bt reactors update 03858bf5-32d3-4a2e-b74b-daeea0883bca --code ./reactor.js
|
|
348
|
+
|
|
349
|
+
$ bt reactors update 03858bf5-32d3-4a2e-b74b-daeea0883bca --configuration ./.env.reactor
|
|
350
|
+
```
|
|
218
351
|
<!-- commandsstop -->
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { BaseCommand } from '../../base';
|
|
2
|
+
export default class ReactorFormulas extends BaseCommand {
|
|
3
|
+
static description: string;
|
|
4
|
+
static examples: string[];
|
|
5
|
+
static flags: {
|
|
6
|
+
page: import("@oclif/core/lib/interfaces/parser").OptionFlag<number, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
|
|
7
|
+
};
|
|
8
|
+
static args: {};
|
|
9
|
+
run(): Promise<void>;
|
|
10
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const core_1 = require("@oclif/core");
|
|
4
|
+
const base_1 = require("../../base");
|
|
5
|
+
const management_1 = require("../../reactorFormulas/management");
|
|
6
|
+
class ReactorFormulas extends base_1.BaseCommand {
|
|
7
|
+
async run() {
|
|
8
|
+
this.log('WARNING: Reactor Formulas are being deprecated and will be removed in a future release.');
|
|
9
|
+
const { bt, flags: { page }, } = await this.parse(ReactorFormulas);
|
|
10
|
+
const formula = await (0, management_1.selectReactorFormula)(bt, page);
|
|
11
|
+
if (!formula) {
|
|
12
|
+
return undefined;
|
|
13
|
+
}
|
|
14
|
+
return undefined;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
exports.default = ReactorFormulas;
|
|
18
|
+
ReactorFormulas.description = '[Deprecated] List Reactor Formulas. Requires `reactor:read` Management Application permission';
|
|
19
|
+
ReactorFormulas.examples = ['<%= config.bin %> <%= command.id %>'];
|
|
20
|
+
ReactorFormulas.flags = {
|
|
21
|
+
page: core_1.Flags.integer({
|
|
22
|
+
char: 'p',
|
|
23
|
+
description: 'reactors formulas list page to fetch',
|
|
24
|
+
default: 1,
|
|
25
|
+
}),
|
|
26
|
+
};
|
|
27
|
+
ReactorFormulas.args = {};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { BaseCommand } from '../../base';
|
|
2
|
+
export default class Update extends BaseCommand {
|
|
3
|
+
static description: string;
|
|
4
|
+
static examples: string[];
|
|
5
|
+
static flags: {
|
|
6
|
+
watch: import("@oclif/core/lib/interfaces/parser").BooleanFlag<boolean>;
|
|
7
|
+
name: import("@oclif/core/lib/interfaces/parser").OptionFlag<string, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
|
|
8
|
+
description: import("@oclif/core/lib/interfaces/parser").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
|
|
9
|
+
icon: import("@oclif/core/lib/interfaces/parser").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
|
|
10
|
+
code: import("@oclif/core/lib/interfaces/parser").OptionFlag<string, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
|
|
11
|
+
configuration: import("@oclif/core/lib/interfaces/parser").OptionFlag<string, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
|
|
12
|
+
'request-parameters': import("@oclif/core/lib/interfaces/parser").OptionFlag<string, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
|
|
13
|
+
};
|
|
14
|
+
static args: {
|
|
15
|
+
id: import("@oclif/core/lib/interfaces/parser").Arg<string, Record<string, unknown>>;
|
|
16
|
+
};
|
|
17
|
+
run(): Promise<void>;
|
|
18
|
+
}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const core_1 = require("@oclif/core");
|
|
4
|
+
const base_1 = require("../../base");
|
|
5
|
+
const files_1 = require("../../files");
|
|
6
|
+
const management_1 = require("../../reactorFormulas/management");
|
|
7
|
+
const utils_1 = require("../../reactorFormulas/utils");
|
|
8
|
+
class Update extends base_1.BaseCommand {
|
|
9
|
+
async run() {
|
|
10
|
+
this.log('WARNING: Reactor Formulas are being deprecated and will be removed in a future release.');
|
|
11
|
+
const { bt, args: { id }, flags: { name, description, code, configuration = '', 'request-parameters': requestParameters = '', watch, }, } = await this.parse(Update);
|
|
12
|
+
const model = (0, utils_1.createModelFromFlags)({
|
|
13
|
+
name,
|
|
14
|
+
description,
|
|
15
|
+
type: 'private',
|
|
16
|
+
code,
|
|
17
|
+
configuration,
|
|
18
|
+
requestParameters,
|
|
19
|
+
});
|
|
20
|
+
await (0, management_1.updateReactorFormula)(bt, id, model);
|
|
21
|
+
this.log('Reactor Formula updated successfully!');
|
|
22
|
+
if (watch) {
|
|
23
|
+
const entries = Object.entries({
|
|
24
|
+
code,
|
|
25
|
+
configuration,
|
|
26
|
+
requestParameters,
|
|
27
|
+
}).filter(([, value]) => Boolean(value));
|
|
28
|
+
const files = entries.reduce((arr, [, file]) => [...arr, file], []);
|
|
29
|
+
if (files.length) {
|
|
30
|
+
this.log(`Watching files for changes: ${files.join(', ')} `);
|
|
31
|
+
}
|
|
32
|
+
entries.forEach(([prop, file]) => {
|
|
33
|
+
(0, files_1.watchForChanges)(file, async () => {
|
|
34
|
+
core_1.ux.action.start(`Detected change in ${file}. Pushing changes`);
|
|
35
|
+
await (0, management_1.updateReactorFormula)(bt, id, (0, utils_1.createModelFromFlags)({
|
|
36
|
+
name,
|
|
37
|
+
description,
|
|
38
|
+
type: 'private',
|
|
39
|
+
code,
|
|
40
|
+
configuration,
|
|
41
|
+
requestParameters,
|
|
42
|
+
[prop]: file,
|
|
43
|
+
}));
|
|
44
|
+
core_1.ux.action.stop('✅\t');
|
|
45
|
+
});
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
exports.default = Update;
|
|
51
|
+
Update.description = '[Deprecated] Updates an existing Reactor Formula. Requires `reactor:update` Management Application permission';
|
|
52
|
+
Update.examples = [
|
|
53
|
+
'<%= config.bin %> <%= command.id %> 03858bf5-32d3-4a2e-b74b-daeea0883bca',
|
|
54
|
+
'<%= config.bin %> <%= command.id %> 03858bf5-32d3-4a2e-b74b-daeea0883bca --code ./formula.js',
|
|
55
|
+
'<%= config.bin %> <%= command.id %> 03858bf5-32d3-4a2e-b74b-daeea0883bca --code ./formula.js -w',
|
|
56
|
+
];
|
|
57
|
+
Update.flags = {
|
|
58
|
+
...utils_1.REACTOR_FORMULA_FLAGS,
|
|
59
|
+
watch: core_1.Flags.boolean({
|
|
60
|
+
char: 'w',
|
|
61
|
+
description: 'Watch for changes in informed files',
|
|
62
|
+
default: false,
|
|
63
|
+
required: false,
|
|
64
|
+
}),
|
|
65
|
+
};
|
|
66
|
+
Update.args = {
|
|
67
|
+
id: core_1.Args.string({
|
|
68
|
+
description: 'Reactor Formula id to update',
|
|
69
|
+
required: true,
|
|
70
|
+
}),
|
|
71
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { BaseCommand } from '../../base';
|
|
2
|
+
export default class Create extends BaseCommand {
|
|
3
|
+
static description: string;
|
|
4
|
+
static examples: string[];
|
|
5
|
+
static flags: {
|
|
6
|
+
name: import("@oclif/core/lib/interfaces/parser").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
|
|
7
|
+
configuration: import("@oclif/core/lib/interfaces/parser").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
|
|
8
|
+
'application-id': import("@oclif/core/lib/interfaces/parser").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
|
|
9
|
+
code: import("@oclif/core/lib/interfaces/parser").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
|
|
10
|
+
};
|
|
11
|
+
run(): Promise<void>;
|
|
12
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const base_1 = require("../../base");
|
|
4
|
+
const management_1 = require("../../reactors/management");
|
|
5
|
+
const utils_1 = require("../../reactors/utils");
|
|
6
|
+
const utils_2 = require("../../utils");
|
|
7
|
+
class Create extends base_1.BaseCommand {
|
|
8
|
+
async run() {
|
|
9
|
+
const { flags, bt } = await this.parse(Create);
|
|
10
|
+
const name = await (0, utils_2.promptStringIfUndefined)(flags.name, {
|
|
11
|
+
message: 'What is the Reactor name?',
|
|
12
|
+
validate: (value) => Boolean(value),
|
|
13
|
+
});
|
|
14
|
+
const code = await (0, utils_2.promptStringIfUndefined)(flags['code'], {
|
|
15
|
+
message: 'Enter the Reactor code file path:',
|
|
16
|
+
validate: (value) => Boolean(value),
|
|
17
|
+
});
|
|
18
|
+
const applicationId = await (0, utils_2.promptStringIfUndefined)(flags['application-id'], {
|
|
19
|
+
message: '(Optional) Enter the Application ID to use in the Reactor:',
|
|
20
|
+
});
|
|
21
|
+
const configuration = await (0, utils_2.promptStringIfUndefined)(flags.configuration, {
|
|
22
|
+
message: '(Optional) Enter the configuration file path (.env format):',
|
|
23
|
+
});
|
|
24
|
+
const model = (0, utils_1.createModelFromFlags)({
|
|
25
|
+
name,
|
|
26
|
+
code,
|
|
27
|
+
applicationId,
|
|
28
|
+
configuration,
|
|
29
|
+
});
|
|
30
|
+
const { id } = await (0, management_1.createReactor)(bt, model);
|
|
31
|
+
this.log('Reactor created successfully!');
|
|
32
|
+
this.log(`id: ${id}`);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
exports.default = Create;
|
|
36
|
+
Create.description = 'Creates a new Reactor. Requires `reactor:create` Management Application permission';
|
|
37
|
+
Create.examples = ['<%= config.bin %> <%= command.id %> '];
|
|
38
|
+
Create.flags = {
|
|
39
|
+
...utils_1.REACTOR_FLAGS,
|
|
40
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { BaseCommand } from '../../base';
|
|
2
|
+
export default class Delete extends BaseCommand {
|
|
3
|
+
static description: string;
|
|
4
|
+
static examples: string[];
|
|
5
|
+
static args: {
|
|
6
|
+
id: import("@oclif/core/lib/interfaces/parser").Arg<string, Record<string, unknown>>;
|
|
7
|
+
};
|
|
8
|
+
static flags: {
|
|
9
|
+
yes: import("@oclif/core/lib/interfaces/parser").BooleanFlag<boolean>;
|
|
10
|
+
};
|
|
11
|
+
run(): Promise<void>;
|
|
12
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const core_1 = require("@oclif/core");
|
|
4
|
+
const base_1 = require("../../base");
|
|
5
|
+
const management_1 = require("../../reactors/management");
|
|
6
|
+
class Delete extends base_1.BaseCommand {
|
|
7
|
+
async run() {
|
|
8
|
+
const { bt, flags: { yes }, args: { id }, } = await this.parse(Delete);
|
|
9
|
+
if (await (0, management_1.deleteReactor)(bt, id, yes)) {
|
|
10
|
+
this.log('Reactor deleted successfully!');
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
exports.default = Delete;
|
|
15
|
+
Delete.description = 'Deletes a Reactor. Requires `reactor:delete` and `reactor:read` Management Application permissions';
|
|
16
|
+
Delete.examples = [
|
|
17
|
+
'<%= config.bin %> <%= command.id %> 03858bf5-32d3-4a2e-b74b-daeea0883bca',
|
|
18
|
+
];
|
|
19
|
+
Delete.args = {
|
|
20
|
+
id: core_1.Args.string({
|
|
21
|
+
description: 'Reactor id to delete',
|
|
22
|
+
required: true,
|
|
23
|
+
}),
|
|
24
|
+
};
|
|
25
|
+
Delete.flags = {
|
|
26
|
+
yes: core_1.Flags.boolean({
|
|
27
|
+
char: 'y',
|
|
28
|
+
description: 'auto confirm the operation',
|
|
29
|
+
default: false,
|
|
30
|
+
allowNo: false,
|
|
31
|
+
}),
|
|
32
|
+
};
|
|
@@ -24,6 +24,10 @@ class Reactors extends base_1.BaseCommand {
|
|
|
24
24
|
value: 'logs',
|
|
25
25
|
description: 'See Reactor real-time logs',
|
|
26
26
|
},
|
|
27
|
+
{
|
|
28
|
+
name: 'Delete',
|
|
29
|
+
value: 'delete',
|
|
30
|
+
},
|
|
27
31
|
],
|
|
28
32
|
});
|
|
29
33
|
if (action === 'details') {
|
|
@@ -33,6 +37,9 @@ class Reactors extends base_1.BaseCommand {
|
|
|
33
37
|
if (action === 'logs') {
|
|
34
38
|
return (0, logs_1.showReactorLogs)(bt, reactor.id);
|
|
35
39
|
}
|
|
40
|
+
if (action === 'delete' && (await (0, management_1.deleteReactor)(bt, reactor.id))) {
|
|
41
|
+
return this.log('Reactor deleted successfully!');
|
|
42
|
+
}
|
|
36
43
|
return undefined;
|
|
37
44
|
}
|
|
38
45
|
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { BaseCommand } from '../../base';
|
|
2
|
+
export default class Update extends BaseCommand {
|
|
3
|
+
static description: string;
|
|
4
|
+
static examples: string[];
|
|
5
|
+
static flags: {
|
|
6
|
+
watch: import("@oclif/core/lib/interfaces/parser").BooleanFlag<boolean>;
|
|
7
|
+
logs: import("@oclif/core/lib/interfaces/parser").BooleanFlag<boolean>;
|
|
8
|
+
name: import("@oclif/core/lib/interfaces/parser").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
|
|
9
|
+
configuration: import("@oclif/core/lib/interfaces/parser").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
|
|
10
|
+
'application-id': import("@oclif/core/lib/interfaces/parser").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
|
|
11
|
+
code: import("@oclif/core/lib/interfaces/parser").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
|
|
12
|
+
};
|
|
13
|
+
static args: {
|
|
14
|
+
id: import("@oclif/core/lib/interfaces/parser").Arg<string, Record<string, unknown>>;
|
|
15
|
+
};
|
|
16
|
+
run(): Promise<void>;
|
|
17
|
+
}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const core_1 = require("@oclif/core");
|
|
4
|
+
const base_1 = require("../../base");
|
|
5
|
+
const files_1 = require("../../files");
|
|
6
|
+
const logs_1 = require("../../logs");
|
|
7
|
+
const management_1 = require("../../reactors/management");
|
|
8
|
+
const utils_1 = require("../../reactors/utils");
|
|
9
|
+
class Update extends base_1.BaseCommand {
|
|
10
|
+
async run() {
|
|
11
|
+
const { bt, args: { id }, flags: { name, code, 'application-id': applicationId, configuration, watch, logs, }, } = await this.parse(Update);
|
|
12
|
+
const model = (0, utils_1.createModelFromFlags)({
|
|
13
|
+
name,
|
|
14
|
+
code,
|
|
15
|
+
applicationId,
|
|
16
|
+
configuration,
|
|
17
|
+
});
|
|
18
|
+
await (0, management_1.patchReactor)(bt, id, model);
|
|
19
|
+
this.log('Reactor updated successfully!');
|
|
20
|
+
if (logs) {
|
|
21
|
+
await (0, logs_1.showReactorLogs)(bt, id);
|
|
22
|
+
}
|
|
23
|
+
if (watch) {
|
|
24
|
+
const entries = Object.entries({
|
|
25
|
+
code,
|
|
26
|
+
configuration,
|
|
27
|
+
}).filter(([, value]) => Boolean(value));
|
|
28
|
+
const files = entries.reduce((arr, [, file]) => [...arr, file], []);
|
|
29
|
+
if (files.length) {
|
|
30
|
+
this.log(`Watching files for changes: ${files.join(', ')} `);
|
|
31
|
+
}
|
|
32
|
+
entries.forEach(([prop, file]) => {
|
|
33
|
+
(0, files_1.watchForChanges)(file, async () => {
|
|
34
|
+
core_1.ux.action.start(`Detected change in ${file}. Pushing changes`);
|
|
35
|
+
await (0, management_1.patchReactor)(bt, id, (0, utils_1.createModelFromFlags)({
|
|
36
|
+
[prop]: file,
|
|
37
|
+
}));
|
|
38
|
+
core_1.ux.action.stop('✅\t');
|
|
39
|
+
});
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
exports.default = Update;
|
|
45
|
+
Update.description = 'Updates an existing Reactor. Requires `reactor:update` Management Application permission';
|
|
46
|
+
Update.examples = [
|
|
47
|
+
'<%= config.bin %> <%= command.id %> 03858bf5-32d3-4a2e-b74b-daeea0883bca',
|
|
48
|
+
'<%= config.bin %> <%= command.id %> 03858bf5-32d3-4a2e-b74b-daeea0883bca --code ./reactor.js',
|
|
49
|
+
'<%= config.bin %> <%= command.id %> 03858bf5-32d3-4a2e-b74b-daeea0883bca --configuration ./.env.reactor',
|
|
50
|
+
];
|
|
51
|
+
Update.flags = {
|
|
52
|
+
...utils_1.REACTOR_FLAGS,
|
|
53
|
+
watch: core_1.Flags.boolean({
|
|
54
|
+
char: 'w',
|
|
55
|
+
description: 'Watch for changes in informed files',
|
|
56
|
+
default: false,
|
|
57
|
+
required: false,
|
|
58
|
+
}),
|
|
59
|
+
logs: core_1.Flags.boolean({
|
|
60
|
+
char: 'l',
|
|
61
|
+
description: 'Start logs server after update',
|
|
62
|
+
default: false,
|
|
63
|
+
required: false,
|
|
64
|
+
}),
|
|
65
|
+
};
|
|
66
|
+
Update.args = {
|
|
67
|
+
id: core_1.Args.string({
|
|
68
|
+
description: 'Reactor id to update',
|
|
69
|
+
required: true,
|
|
70
|
+
}),
|
|
71
|
+
};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { ReactorFormula, CreateReactorFormula } from '@basis-theory/basis-theory-js/types/models';
|
|
2
|
+
import type { BasisTheory as IBasisTheory } from '@basis-theory/basis-theory-js/types/sdk';
|
|
3
|
+
declare const selectReactorFormula: (bt: IBasisTheory, page: number) => Promise<ReactorFormula | undefined>;
|
|
4
|
+
declare const updateReactorFormula: (bt: IBasisTheory, id: string, model: CreateReactorFormula) => Promise<ReactorFormula>;
|
|
5
|
+
export { selectReactorFormula, updateReactorFormula };
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.updateReactorFormula = exports.selectReactorFormula = void 0;
|
|
4
|
+
const core_1 = require("@oclif/core");
|
|
5
|
+
const utils_1 = require("../utils");
|
|
6
|
+
const debug = require('debug')('reactor-formulas:management');
|
|
7
|
+
const listReactorFormulas = async (bt, page) => {
|
|
8
|
+
const size = 5;
|
|
9
|
+
debug('Listing reactor formulas', `page: ${page}`, `size: ${size}`);
|
|
10
|
+
const reactorFormulas = await bt.reactorFormulas.list({
|
|
11
|
+
size,
|
|
12
|
+
page,
|
|
13
|
+
});
|
|
14
|
+
let data = [];
|
|
15
|
+
if (reactorFormulas.pagination.totalItems > 0) {
|
|
16
|
+
const last = (reactorFormulas.pagination.pageNumber - 1) * size;
|
|
17
|
+
data = reactorFormulas.data.map((reactorFormula, index) => ({
|
|
18
|
+
'#': last + (index + 1),
|
|
19
|
+
...reactorFormula,
|
|
20
|
+
}));
|
|
21
|
+
core_1.ux.table(data, {
|
|
22
|
+
'#': {},
|
|
23
|
+
id: {},
|
|
24
|
+
name: {},
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
else {
|
|
28
|
+
core_1.ux.log('No reactor formulas found.');
|
|
29
|
+
}
|
|
30
|
+
return {
|
|
31
|
+
data,
|
|
32
|
+
pagination: reactorFormulas.pagination,
|
|
33
|
+
};
|
|
34
|
+
};
|
|
35
|
+
const selectReactorFormula = async (bt, page) => {
|
|
36
|
+
const reactors = await listReactorFormulas(bt, page);
|
|
37
|
+
if (reactors.pagination.totalItems === 0) {
|
|
38
|
+
return undefined;
|
|
39
|
+
}
|
|
40
|
+
const selection = await (0, utils_1.selectOrNavigate)(reactors, '#');
|
|
41
|
+
if (selection === 'previous') {
|
|
42
|
+
return selectReactorFormula(bt, page - 1);
|
|
43
|
+
}
|
|
44
|
+
if (selection === 'next') {
|
|
45
|
+
return selectReactorFormula(bt, page + 1);
|
|
46
|
+
}
|
|
47
|
+
return selection;
|
|
48
|
+
};
|
|
49
|
+
exports.selectReactorFormula = selectReactorFormula;
|
|
50
|
+
const updateReactorFormula = (bt, id, model) => {
|
|
51
|
+
debug(`Updating Reactor Formula ${id}`, JSON.stringify(model, undefined, 2));
|
|
52
|
+
return bt.reactorFormulas.update(id, model);
|
|
53
|
+
};
|
|
54
|
+
exports.updateReactorFormula = updateReactorFormula;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { CreateReactorFormula as CreateReactorFormulaModel } from '@basis-theory/basis-theory-js/types/models/reactor-formulas';
|
|
2
|
+
declare const REACTOR_FORMULA_FLAGS: {
|
|
3
|
+
name: import("@oclif/core/lib/interfaces/parser").OptionFlag<string, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
|
|
4
|
+
description: import("@oclif/core/lib/interfaces/parser").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
|
|
5
|
+
icon: import("@oclif/core/lib/interfaces/parser").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
|
|
6
|
+
code: import("@oclif/core/lib/interfaces/parser").OptionFlag<string, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
|
|
7
|
+
configuration: import("@oclif/core/lib/interfaces/parser").OptionFlag<string, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
|
|
8
|
+
'request-parameters': import("@oclif/core/lib/interfaces/parser").OptionFlag<string, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
|
|
9
|
+
};
|
|
10
|
+
interface ReactorFormulaFlagProps {
|
|
11
|
+
/**
|
|
12
|
+
* Path to code file
|
|
13
|
+
*/
|
|
14
|
+
code?: string;
|
|
15
|
+
/**
|
|
16
|
+
* Path to code file
|
|
17
|
+
*/
|
|
18
|
+
requestParameters: string;
|
|
19
|
+
/**
|
|
20
|
+
* Path to .env file
|
|
21
|
+
*/
|
|
22
|
+
configuration: string;
|
|
23
|
+
}
|
|
24
|
+
type CreateReactorFormula = ReactorFormulaFlagProps & Omit<CreateReactorFormulaModel, 'configuration' | 'requestParameters' | 'code'>;
|
|
25
|
+
declare function createModelFromFlags(payload: CreateReactorFormula): CreateReactorFormulaModel;
|
|
26
|
+
export { REACTOR_FORMULA_FLAGS, createModelFromFlags };
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createModelFromFlags = exports.REACTOR_FORMULA_FLAGS = void 0;
|
|
4
|
+
const core_1 = require("@oclif/core");
|
|
5
|
+
const files_1 = require("../files");
|
|
6
|
+
const REACTOR_FORMULA_FLAGS = {
|
|
7
|
+
name: core_1.Flags.string({
|
|
8
|
+
char: 'n',
|
|
9
|
+
description: 'name of the Reactor Formula',
|
|
10
|
+
required: true,
|
|
11
|
+
}),
|
|
12
|
+
description: core_1.Flags.string({
|
|
13
|
+
char: 'd',
|
|
14
|
+
description: 'description of the Reactor Formula',
|
|
15
|
+
}),
|
|
16
|
+
icon: core_1.Flags.string({
|
|
17
|
+
char: 'i',
|
|
18
|
+
description: 'icon of the Reactor Formula',
|
|
19
|
+
}),
|
|
20
|
+
code: core_1.Flags.file({
|
|
21
|
+
char: 's',
|
|
22
|
+
description: 'path to JavaScript file containing code',
|
|
23
|
+
required: true,
|
|
24
|
+
}),
|
|
25
|
+
configuration: core_1.Flags.file({
|
|
26
|
+
char: 'c',
|
|
27
|
+
description: 'path to configuration definition to use in the Reactor Formula',
|
|
28
|
+
required: true,
|
|
29
|
+
}),
|
|
30
|
+
'request-parameters': core_1.Flags.file({
|
|
31
|
+
char: 'p',
|
|
32
|
+
description: 'path to request params definition to use in the Reactor Formula',
|
|
33
|
+
required: true,
|
|
34
|
+
}),
|
|
35
|
+
};
|
|
36
|
+
exports.REACTOR_FORMULA_FLAGS = REACTOR_FORMULA_FLAGS;
|
|
37
|
+
// eslint-disable-next-line get-off-my-lawn/prefer-arrow-functions
|
|
38
|
+
function createModelFromFlags({ name, description, icon, code, type, configuration, requestParameters, }) {
|
|
39
|
+
return {
|
|
40
|
+
name,
|
|
41
|
+
description,
|
|
42
|
+
icon,
|
|
43
|
+
type,
|
|
44
|
+
code: code ? (0, files_1.readFileContents)(code) : '',
|
|
45
|
+
configuration: JSON.parse((0, files_1.readFileContents)(configuration)),
|
|
46
|
+
requestParameters: JSON.parse((0, files_1.readFileContents)(requestParameters)),
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
exports.createModelFromFlags = createModelFromFlags;
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import type { Reactor, PatchReactor } from '@basis-theory/basis-theory-js/types/models';
|
|
1
|
+
import type { Reactor, PatchReactor, CreateReactor } from '@basis-theory/basis-theory-js/types/models';
|
|
2
2
|
import type { BasisTheory as IBasisTheory } from '@basis-theory/basis-theory-js/types/sdk';
|
|
3
3
|
declare const selectReactor: (bt: IBasisTheory, page: number) => Promise<Reactor | undefined>;
|
|
4
|
+
declare const createReactor: (bt: IBasisTheory, model: CreateReactor) => Promise<Reactor>;
|
|
5
|
+
declare const deleteReactor: (bt: IBasisTheory, id: string, force?: boolean) => Promise<boolean>;
|
|
4
6
|
declare const patchReactor: (bt: IBasisTheory, id: string, model: PatchReactor) => Promise<void>;
|
|
5
|
-
export { selectReactor, patchReactor };
|
|
7
|
+
export { selectReactor, createReactor, patchReactor, deleteReactor };
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.patchReactor = exports.selectReactor = void 0;
|
|
3
|
+
exports.deleteReactor = exports.patchReactor = exports.createReactor = exports.selectReactor = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const confirm_1 = tslib_1.__importDefault(require("@inquirer/confirm"));
|
|
4
6
|
const core_1 = require("@oclif/core");
|
|
5
7
|
const utils_1 = require("../utils");
|
|
6
8
|
const debug = require('debug')('reactors:management');
|
|
@@ -47,6 +49,26 @@ const selectReactor = async (bt, page) => {
|
|
|
47
49
|
return selection;
|
|
48
50
|
};
|
|
49
51
|
exports.selectReactor = selectReactor;
|
|
52
|
+
const createReactor = (bt, model) => {
|
|
53
|
+
debug(`Creating Reactor`, JSON.stringify(model, undefined, 2));
|
|
54
|
+
return bt.reactors.create(model);
|
|
55
|
+
};
|
|
56
|
+
exports.createReactor = createReactor;
|
|
57
|
+
const deleteReactor = async (bt, id, force = false) => {
|
|
58
|
+
if (!force) {
|
|
59
|
+
const proceed = await (0, confirm_1.default)({
|
|
60
|
+
message: `Are you sure you want to delete this Reactor (${id})?`,
|
|
61
|
+
default: false,
|
|
62
|
+
});
|
|
63
|
+
if (!proceed) {
|
|
64
|
+
return false;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
debug(`Deleting Reactor`, id);
|
|
68
|
+
await bt.reactors.delete(id);
|
|
69
|
+
return true;
|
|
70
|
+
};
|
|
71
|
+
exports.deleteReactor = deleteReactor;
|
|
50
72
|
const patchReactor = (bt, id, model) => {
|
|
51
73
|
debug(`Patching Reactor ${id}`, JSON.stringify(model, undefined, 2));
|
|
52
74
|
return bt.reactors.patch(id, model);
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { CreateReactor as CreateReactorModel, PatchReactor as PatchReactorModel } from '@basis-theory/basis-theory-js/types/models/reactors';
|
|
2
|
+
declare const REACTOR_FLAGS: {
|
|
3
|
+
name: import("@oclif/core/lib/interfaces/parser").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
|
|
4
|
+
configuration: import("@oclif/core/lib/interfaces/parser").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
|
|
5
|
+
'application-id': import("@oclif/core/lib/interfaces/parser").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
|
|
6
|
+
code: import("@oclif/core/lib/interfaces/parser").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
|
|
7
|
+
};
|
|
8
|
+
interface ReactorFlagProps {
|
|
9
|
+
/**
|
|
10
|
+
* Reactor's application id
|
|
11
|
+
*/
|
|
12
|
+
applicationId?: string;
|
|
13
|
+
/**
|
|
14
|
+
* Path to code file
|
|
15
|
+
*/
|
|
16
|
+
code?: string;
|
|
17
|
+
/**
|
|
18
|
+
* Path to .env file
|
|
19
|
+
*/
|
|
20
|
+
configuration?: string;
|
|
21
|
+
}
|
|
22
|
+
type CreateReactor = ReactorFlagProps & Omit<CreateReactorModel, 'application' | 'configuration'>;
|
|
23
|
+
type PatchReactor = ReactorFlagProps & Omit<PatchReactorModel, 'application' | 'configuration'>;
|
|
24
|
+
declare function createModelFromFlags(payload: CreateReactor): CreateReactorModel;
|
|
25
|
+
declare function createModelFromFlags(payload: PatchReactor): PatchReactorModel;
|
|
26
|
+
export { REACTOR_FLAGS, createModelFromFlags };
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createModelFromFlags = exports.REACTOR_FLAGS = void 0;
|
|
4
|
+
const core_1 = require("@oclif/core");
|
|
5
|
+
const dotenv_1 = require("dotenv");
|
|
6
|
+
const files_1 = require("../files");
|
|
7
|
+
const REACTOR_FLAGS = {
|
|
8
|
+
name: core_1.Flags.string({
|
|
9
|
+
char: 'n',
|
|
10
|
+
description: 'name of the Reactor',
|
|
11
|
+
}),
|
|
12
|
+
configuration: core_1.Flags.file({
|
|
13
|
+
char: 'c',
|
|
14
|
+
description: 'path to configuration file (.env format) to use in the Reactor',
|
|
15
|
+
}),
|
|
16
|
+
'application-id': core_1.Flags.string({
|
|
17
|
+
char: 'i',
|
|
18
|
+
description: 'application ID to use in the Reactor',
|
|
19
|
+
}),
|
|
20
|
+
code: core_1.Flags.file({
|
|
21
|
+
char: 'r',
|
|
22
|
+
description: 'path to JavaScript file containing the Reactor code',
|
|
23
|
+
}),
|
|
24
|
+
};
|
|
25
|
+
exports.REACTOR_FLAGS = REACTOR_FLAGS;
|
|
26
|
+
// eslint-disable-next-line get-off-my-lawn/prefer-arrow-functions
|
|
27
|
+
function createModelFromFlags({ name, applicationId, code, configuration, }) {
|
|
28
|
+
return {
|
|
29
|
+
name,
|
|
30
|
+
code: code ? (0, files_1.readFileContents)(code) : undefined,
|
|
31
|
+
application: applicationId ? { id: applicationId } : undefined,
|
|
32
|
+
configuration: configuration
|
|
33
|
+
? (0, dotenv_1.parse)((0, files_1.readFileContents)(configuration))
|
|
34
|
+
: undefined,
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
exports.createModelFromFlags = createModelFromFlags;
|
package/oclif.manifest.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "1.
|
|
2
|
+
"version": "1.8.0",
|
|
3
3
|
"commands": {
|
|
4
4
|
"proxies:create": {
|
|
5
5
|
"id": "proxies:create",
|
|
@@ -310,6 +310,237 @@
|
|
|
310
310
|
}
|
|
311
311
|
}
|
|
312
312
|
},
|
|
313
|
+
"reactorFormulas": {
|
|
314
|
+
"id": "reactorFormulas",
|
|
315
|
+
"description": "[Deprecated] List Reactor Formulas. Requires `reactor:read` Management Application permission",
|
|
316
|
+
"strict": true,
|
|
317
|
+
"pluginName": "@basis-theory-labs/cli",
|
|
318
|
+
"pluginAlias": "@basis-theory-labs/cli",
|
|
319
|
+
"pluginType": "core",
|
|
320
|
+
"aliases": [],
|
|
321
|
+
"examples": [
|
|
322
|
+
"<%= config.bin %> <%= command.id %>"
|
|
323
|
+
],
|
|
324
|
+
"flags": {
|
|
325
|
+
"management-key": {
|
|
326
|
+
"name": "management-key",
|
|
327
|
+
"type": "option",
|
|
328
|
+
"char": "x",
|
|
329
|
+
"description": "management key used for connecting with the reactor / proxy",
|
|
330
|
+
"required": true,
|
|
331
|
+
"multiple": false
|
|
332
|
+
},
|
|
333
|
+
"api-base-url": {
|
|
334
|
+
"name": "api-base-url",
|
|
335
|
+
"type": "option",
|
|
336
|
+
"description": "base API URL to use in Basis Theory SDK",
|
|
337
|
+
"hidden": true,
|
|
338
|
+
"multiple": false
|
|
339
|
+
},
|
|
340
|
+
"page": {
|
|
341
|
+
"name": "page",
|
|
342
|
+
"type": "option",
|
|
343
|
+
"char": "p",
|
|
344
|
+
"description": "reactors formulas list page to fetch",
|
|
345
|
+
"multiple": false,
|
|
346
|
+
"default": 1
|
|
347
|
+
}
|
|
348
|
+
},
|
|
349
|
+
"args": {}
|
|
350
|
+
},
|
|
351
|
+
"reactorFormulas:update": {
|
|
352
|
+
"id": "reactorFormulas:update",
|
|
353
|
+
"description": "[Deprecated] Updates an existing Reactor Formula. Requires `reactor:update` Management Application permission",
|
|
354
|
+
"strict": true,
|
|
355
|
+
"pluginName": "@basis-theory-labs/cli",
|
|
356
|
+
"pluginAlias": "@basis-theory-labs/cli",
|
|
357
|
+
"pluginType": "core",
|
|
358
|
+
"aliases": [],
|
|
359
|
+
"examples": [
|
|
360
|
+
"<%= config.bin %> <%= command.id %> 03858bf5-32d3-4a2e-b74b-daeea0883bca",
|
|
361
|
+
"<%= config.bin %> <%= command.id %> 03858bf5-32d3-4a2e-b74b-daeea0883bca --code ./formula.js",
|
|
362
|
+
"<%= config.bin %> <%= command.id %> 03858bf5-32d3-4a2e-b74b-daeea0883bca --code ./formula.js -w"
|
|
363
|
+
],
|
|
364
|
+
"flags": {
|
|
365
|
+
"management-key": {
|
|
366
|
+
"name": "management-key",
|
|
367
|
+
"type": "option",
|
|
368
|
+
"char": "x",
|
|
369
|
+
"description": "management key used for connecting with the reactor / proxy",
|
|
370
|
+
"required": true,
|
|
371
|
+
"multiple": false
|
|
372
|
+
},
|
|
373
|
+
"api-base-url": {
|
|
374
|
+
"name": "api-base-url",
|
|
375
|
+
"type": "option",
|
|
376
|
+
"description": "base API URL to use in Basis Theory SDK",
|
|
377
|
+
"hidden": true,
|
|
378
|
+
"multiple": false
|
|
379
|
+
},
|
|
380
|
+
"name": {
|
|
381
|
+
"name": "name",
|
|
382
|
+
"type": "option",
|
|
383
|
+
"char": "n",
|
|
384
|
+
"description": "name of the Reactor Formula",
|
|
385
|
+
"required": true,
|
|
386
|
+
"multiple": false
|
|
387
|
+
},
|
|
388
|
+
"description": {
|
|
389
|
+
"name": "description",
|
|
390
|
+
"type": "option",
|
|
391
|
+
"char": "d",
|
|
392
|
+
"description": "description of the Reactor Formula",
|
|
393
|
+
"multiple": false
|
|
394
|
+
},
|
|
395
|
+
"icon": {
|
|
396
|
+
"name": "icon",
|
|
397
|
+
"type": "option",
|
|
398
|
+
"char": "i",
|
|
399
|
+
"description": "icon of the Reactor Formula",
|
|
400
|
+
"multiple": false
|
|
401
|
+
},
|
|
402
|
+
"code": {
|
|
403
|
+
"name": "code",
|
|
404
|
+
"type": "option",
|
|
405
|
+
"char": "s",
|
|
406
|
+
"description": "path to JavaScript file containing code",
|
|
407
|
+
"required": true,
|
|
408
|
+
"multiple": false
|
|
409
|
+
},
|
|
410
|
+
"configuration": {
|
|
411
|
+
"name": "configuration",
|
|
412
|
+
"type": "option",
|
|
413
|
+
"char": "c",
|
|
414
|
+
"description": "path to configuration definition to use in the Reactor Formula",
|
|
415
|
+
"required": true,
|
|
416
|
+
"multiple": false
|
|
417
|
+
},
|
|
418
|
+
"request-parameters": {
|
|
419
|
+
"name": "request-parameters",
|
|
420
|
+
"type": "option",
|
|
421
|
+
"char": "p",
|
|
422
|
+
"description": "path to request params definition to use in the Reactor Formula",
|
|
423
|
+
"required": true,
|
|
424
|
+
"multiple": false
|
|
425
|
+
},
|
|
426
|
+
"watch": {
|
|
427
|
+
"name": "watch",
|
|
428
|
+
"type": "boolean",
|
|
429
|
+
"char": "w",
|
|
430
|
+
"description": "Watch for changes in informed files",
|
|
431
|
+
"required": false,
|
|
432
|
+
"allowNo": false
|
|
433
|
+
}
|
|
434
|
+
},
|
|
435
|
+
"args": {
|
|
436
|
+
"id": {
|
|
437
|
+
"name": "id",
|
|
438
|
+
"description": "Reactor Formula id to update",
|
|
439
|
+
"required": true
|
|
440
|
+
}
|
|
441
|
+
}
|
|
442
|
+
},
|
|
443
|
+
"reactors:create": {
|
|
444
|
+
"id": "reactors:create",
|
|
445
|
+
"description": "Creates a new Reactor. Requires `reactor:create` Management Application permission",
|
|
446
|
+
"strict": true,
|
|
447
|
+
"pluginName": "@basis-theory-labs/cli",
|
|
448
|
+
"pluginAlias": "@basis-theory-labs/cli",
|
|
449
|
+
"pluginType": "core",
|
|
450
|
+
"aliases": [],
|
|
451
|
+
"examples": [
|
|
452
|
+
"<%= config.bin %> <%= command.id %> "
|
|
453
|
+
],
|
|
454
|
+
"flags": {
|
|
455
|
+
"management-key": {
|
|
456
|
+
"name": "management-key",
|
|
457
|
+
"type": "option",
|
|
458
|
+
"char": "x",
|
|
459
|
+
"description": "management key used for connecting with the reactor / proxy",
|
|
460
|
+
"required": true,
|
|
461
|
+
"multiple": false
|
|
462
|
+
},
|
|
463
|
+
"api-base-url": {
|
|
464
|
+
"name": "api-base-url",
|
|
465
|
+
"type": "option",
|
|
466
|
+
"description": "base API URL to use in Basis Theory SDK",
|
|
467
|
+
"hidden": true,
|
|
468
|
+
"multiple": false
|
|
469
|
+
},
|
|
470
|
+
"name": {
|
|
471
|
+
"name": "name",
|
|
472
|
+
"type": "option",
|
|
473
|
+
"char": "n",
|
|
474
|
+
"description": "name of the Reactor",
|
|
475
|
+
"multiple": false
|
|
476
|
+
},
|
|
477
|
+
"configuration": {
|
|
478
|
+
"name": "configuration",
|
|
479
|
+
"type": "option",
|
|
480
|
+
"char": "c",
|
|
481
|
+
"description": "path to configuration file (.env format) to use in the Reactor",
|
|
482
|
+
"multiple": false
|
|
483
|
+
},
|
|
484
|
+
"application-id": {
|
|
485
|
+
"name": "application-id",
|
|
486
|
+
"type": "option",
|
|
487
|
+
"char": "i",
|
|
488
|
+
"description": "application ID to use in the Reactor",
|
|
489
|
+
"multiple": false
|
|
490
|
+
},
|
|
491
|
+
"code": {
|
|
492
|
+
"name": "code",
|
|
493
|
+
"type": "option",
|
|
494
|
+
"char": "r",
|
|
495
|
+
"description": "path to JavaScript file containing the Reactor code",
|
|
496
|
+
"multiple": false
|
|
497
|
+
}
|
|
498
|
+
},
|
|
499
|
+
"args": {}
|
|
500
|
+
},
|
|
501
|
+
"reactors:delete": {
|
|
502
|
+
"id": "reactors:delete",
|
|
503
|
+
"description": "Deletes a Reactor. Requires `reactor:delete` and `reactor:read` Management Application permissions",
|
|
504
|
+
"strict": true,
|
|
505
|
+
"pluginName": "@basis-theory-labs/cli",
|
|
506
|
+
"pluginAlias": "@basis-theory-labs/cli",
|
|
507
|
+
"pluginType": "core",
|
|
508
|
+
"aliases": [],
|
|
509
|
+
"examples": [
|
|
510
|
+
"<%= config.bin %> <%= command.id %> 03858bf5-32d3-4a2e-b74b-daeea0883bca"
|
|
511
|
+
],
|
|
512
|
+
"flags": {
|
|
513
|
+
"management-key": {
|
|
514
|
+
"name": "management-key",
|
|
515
|
+
"type": "option",
|
|
516
|
+
"char": "x",
|
|
517
|
+
"description": "management key used for connecting with the reactor / proxy",
|
|
518
|
+
"required": true,
|
|
519
|
+
"multiple": false
|
|
520
|
+
},
|
|
521
|
+
"api-base-url": {
|
|
522
|
+
"name": "api-base-url",
|
|
523
|
+
"type": "option",
|
|
524
|
+
"description": "base API URL to use in Basis Theory SDK",
|
|
525
|
+
"hidden": true,
|
|
526
|
+
"multiple": false
|
|
527
|
+
},
|
|
528
|
+
"yes": {
|
|
529
|
+
"name": "yes",
|
|
530
|
+
"type": "boolean",
|
|
531
|
+
"char": "y",
|
|
532
|
+
"description": "auto confirm the operation",
|
|
533
|
+
"allowNo": false
|
|
534
|
+
}
|
|
535
|
+
},
|
|
536
|
+
"args": {
|
|
537
|
+
"id": {
|
|
538
|
+
"name": "id",
|
|
539
|
+
"description": "Reactor id to delete",
|
|
540
|
+
"required": true
|
|
541
|
+
}
|
|
542
|
+
}
|
|
543
|
+
},
|
|
313
544
|
"reactors": {
|
|
314
545
|
"id": "reactors",
|
|
315
546
|
"description": "List Reactors. Requires `reactor:read` Management Application permission",
|
|
@@ -392,6 +623,88 @@
|
|
|
392
623
|
"description": "Reactor id to connect to"
|
|
393
624
|
}
|
|
394
625
|
}
|
|
626
|
+
},
|
|
627
|
+
"reactors:update": {
|
|
628
|
+
"id": "reactors:update",
|
|
629
|
+
"description": "Updates an existing Reactor. Requires `reactor:update` Management Application permission",
|
|
630
|
+
"strict": true,
|
|
631
|
+
"pluginName": "@basis-theory-labs/cli",
|
|
632
|
+
"pluginAlias": "@basis-theory-labs/cli",
|
|
633
|
+
"pluginType": "core",
|
|
634
|
+
"aliases": [],
|
|
635
|
+
"examples": [
|
|
636
|
+
"<%= config.bin %> <%= command.id %> 03858bf5-32d3-4a2e-b74b-daeea0883bca",
|
|
637
|
+
"<%= config.bin %> <%= command.id %> 03858bf5-32d3-4a2e-b74b-daeea0883bca --code ./reactor.js",
|
|
638
|
+
"<%= config.bin %> <%= command.id %> 03858bf5-32d3-4a2e-b74b-daeea0883bca --configuration ./.env.reactor"
|
|
639
|
+
],
|
|
640
|
+
"flags": {
|
|
641
|
+
"management-key": {
|
|
642
|
+
"name": "management-key",
|
|
643
|
+
"type": "option",
|
|
644
|
+
"char": "x",
|
|
645
|
+
"description": "management key used for connecting with the reactor / proxy",
|
|
646
|
+
"required": true,
|
|
647
|
+
"multiple": false
|
|
648
|
+
},
|
|
649
|
+
"api-base-url": {
|
|
650
|
+
"name": "api-base-url",
|
|
651
|
+
"type": "option",
|
|
652
|
+
"description": "base API URL to use in Basis Theory SDK",
|
|
653
|
+
"hidden": true,
|
|
654
|
+
"multiple": false
|
|
655
|
+
},
|
|
656
|
+
"name": {
|
|
657
|
+
"name": "name",
|
|
658
|
+
"type": "option",
|
|
659
|
+
"char": "n",
|
|
660
|
+
"description": "name of the Reactor",
|
|
661
|
+
"multiple": false
|
|
662
|
+
},
|
|
663
|
+
"configuration": {
|
|
664
|
+
"name": "configuration",
|
|
665
|
+
"type": "option",
|
|
666
|
+
"char": "c",
|
|
667
|
+
"description": "path to configuration file (.env format) to use in the Reactor",
|
|
668
|
+
"multiple": false
|
|
669
|
+
},
|
|
670
|
+
"application-id": {
|
|
671
|
+
"name": "application-id",
|
|
672
|
+
"type": "option",
|
|
673
|
+
"char": "i",
|
|
674
|
+
"description": "application ID to use in the Reactor",
|
|
675
|
+
"multiple": false
|
|
676
|
+
},
|
|
677
|
+
"code": {
|
|
678
|
+
"name": "code",
|
|
679
|
+
"type": "option",
|
|
680
|
+
"char": "r",
|
|
681
|
+
"description": "path to JavaScript file containing the Reactor code",
|
|
682
|
+
"multiple": false
|
|
683
|
+
},
|
|
684
|
+
"watch": {
|
|
685
|
+
"name": "watch",
|
|
686
|
+
"type": "boolean",
|
|
687
|
+
"char": "w",
|
|
688
|
+
"description": "Watch for changes in informed files",
|
|
689
|
+
"required": false,
|
|
690
|
+
"allowNo": false
|
|
691
|
+
},
|
|
692
|
+
"logs": {
|
|
693
|
+
"name": "logs",
|
|
694
|
+
"type": "boolean",
|
|
695
|
+
"char": "l",
|
|
696
|
+
"description": "Start logs server after update",
|
|
697
|
+
"required": false,
|
|
698
|
+
"allowNo": false
|
|
699
|
+
}
|
|
700
|
+
},
|
|
701
|
+
"args": {
|
|
702
|
+
"id": {
|
|
703
|
+
"name": "id",
|
|
704
|
+
"description": "Reactor id to update",
|
|
705
|
+
"required": true
|
|
706
|
+
}
|
|
707
|
+
}
|
|
395
708
|
}
|
|
396
709
|
}
|
|
397
710
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@basis-theory-labs/cli",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.8.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/basis-theory-js": "^
|
|
20
|
+
"@basis-theory/basis-theory-js": "^2.3.1",
|
|
21
21
|
"@inquirer/confirm": "^2.0.3",
|
|
22
22
|
"@inquirer/input": "^1.2.1",
|
|
23
23
|
"@inquirer/prompts": "^2.1.1",
|