@basis-theory-labs/cli 1.7.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 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.7.0 linux-x64 node-v18.17.0
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
@@ -36,7 +36,10 @@ USAGE
36
36
  * [`bt reactorFormulas`](#bt-reactorformulas)
37
37
  * [`bt reactorFormulas update ID`](#bt-reactorformulas-update-id)
38
38
  * [`bt reactors`](#bt-reactors)
39
+ * [`bt reactors create`](#bt-reactors-create)
40
+ * [`bt reactors delete ID`](#bt-reactors-delete-id)
39
41
  * [`bt reactors logs [ID]`](#bt-reactors-logs-id)
42
+ * [`bt reactors update ID`](#bt-reactors-update-id)
40
43
 
41
44
  ## `bt proxies`
42
45
 
@@ -57,7 +60,7 @@ EXAMPLES
57
60
  $ bt proxies
58
61
  ```
59
62
 
60
- _See code: [dist/commands/proxies/index.ts](https://github.com/Basis-Theory-Labs/basistheory-cli/blob/v1.7.0/dist/commands/proxies/index.ts)_
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)_
61
64
 
62
65
  ## `bt proxies create`
63
66
 
@@ -173,7 +176,7 @@ EXAMPLES
173
176
 
174
177
  ## `bt reactorFormulas`
175
178
 
176
- List Reactor Formulas. Requires `reactor:read` Management Application permission
179
+ [Deprecated] List Reactor Formulas. Requires `reactor:read` Management Application permission
177
180
 
178
181
  ```
179
182
  USAGE
@@ -184,17 +187,17 @@ FLAGS
184
187
  -x, --management-key=<value> (required) management key used for connecting with the reactor / proxy
185
188
 
186
189
  DESCRIPTION
187
- List Reactor Formulas. Requires `reactor:read` Management Application permission
190
+ [Deprecated] List Reactor Formulas. Requires `reactor:read` Management Application permission
188
191
 
189
192
  EXAMPLES
190
193
  $ bt reactorFormulas
191
194
  ```
192
195
 
193
- _See code: [dist/commands/reactorFormulas/index.ts](https://github.com/Basis-Theory-Labs/basistheory-cli/blob/v1.7.0/dist/commands/reactorFormulas/index.ts)_
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)_
194
197
 
195
198
  ## `bt reactorFormulas update ID`
196
199
 
197
- Updates an existing Reactor Formula. Requires `reactor:update` Management Application permission
200
+ [Deprecated] Updates an existing Reactor Formula. Requires `reactor:update` Management Application permission
198
201
 
199
202
  ```
200
203
  USAGE
@@ -214,7 +217,7 @@ FLAGS
214
217
  -x, --management-key=<value> (required) management key used for connecting with the reactor / proxy
215
218
 
216
219
  DESCRIPTION
217
- Updates an existing Reactor Formula. Requires `reactor:update` Management Application permission
220
+ [Deprecated] Updates an existing Reactor Formula. Requires `reactor:update` Management Application permission
218
221
 
219
222
  EXAMPLES
220
223
  $ bt reactorFormulas update 03858bf5-32d3-4a2e-b74b-daeea0883bca
@@ -243,7 +246,51 @@ EXAMPLES
243
246
  $ bt reactors
244
247
  ```
245
248
 
246
- _See code: [dist/commands/reactors/index.ts](https://github.com/Basis-Theory-Labs/basistheory-cli/blob/v1.7.0/dist/commands/reactors/index.ts)_
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
+ ```
247
294
 
248
295
  ## `bt reactors logs [ID]`
249
296
 
@@ -270,4 +317,35 @@ EXAMPLES
270
317
 
271
318
  $ bt reactors logs 03858bf5-32d3-4a2e-b74b-daeea0883bca -p 3000
272
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
+ ```
273
351
  <!-- commandsstop -->
@@ -5,16 +5,17 @@ const base_1 = require("../../base");
5
5
  const management_1 = require("../../reactorFormulas/management");
6
6
  class ReactorFormulas extends base_1.BaseCommand {
7
7
  async run() {
8
+ this.log('WARNING: Reactor Formulas are being deprecated and will be removed in a future release.');
8
9
  const { bt, flags: { page }, } = await this.parse(ReactorFormulas);
9
- const reactor = await (0, management_1.selectReactorFormula)(bt, page);
10
- if (!reactor) {
10
+ const formula = await (0, management_1.selectReactorFormula)(bt, page);
11
+ if (!formula) {
11
12
  return undefined;
12
13
  }
13
14
  return undefined;
14
15
  }
15
16
  }
16
17
  exports.default = ReactorFormulas;
17
- ReactorFormulas.description = 'List Reactor Formulas. Requires `reactor:read` Management Application permission';
18
+ ReactorFormulas.description = '[Deprecated] List Reactor Formulas. Requires `reactor:read` Management Application permission';
18
19
  ReactorFormulas.examples = ['<%= config.bin %> <%= command.id %>'];
19
20
  ReactorFormulas.flags = {
20
21
  page: core_1.Flags.integer({
@@ -7,6 +7,7 @@ const management_1 = require("../../reactorFormulas/management");
7
7
  const utils_1 = require("../../reactorFormulas/utils");
8
8
  class Update extends base_1.BaseCommand {
9
9
  async run() {
10
+ this.log('WARNING: Reactor Formulas are being deprecated and will be removed in a future release.');
10
11
  const { bt, args: { id }, flags: { name, description, code, configuration = '', 'request-parameters': requestParameters = '', watch, }, } = await this.parse(Update);
11
12
  const model = (0, utils_1.createModelFromFlags)({
12
13
  name,
@@ -47,7 +48,7 @@ class Update extends base_1.BaseCommand {
47
48
  }
48
49
  }
49
50
  exports.default = Update;
50
- Update.description = 'Updates an existing Reactor Formula. Requires `reactor:update` Management Application permission';
51
+ Update.description = '[Deprecated] Updates an existing Reactor Formula. Requires `reactor:update` Management Application permission';
51
52
  Update.examples = [
52
53
  '<%= config.bin %> <%= command.id %> 03858bf5-32d3-4a2e-b74b-daeea0883bca',
53
54
  '<%= config.bin %> <%= command.id %> 03858bf5-32d3-4a2e-b74b-daeea0883bca --code ./formula.js',
@@ -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
+ };
@@ -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;
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.7.0",
2
+ "version": "1.8.0",
3
3
  "commands": {
4
4
  "proxies:create": {
5
5
  "id": "proxies:create",
@@ -312,7 +312,7 @@
312
312
  },
313
313
  "reactorFormulas": {
314
314
  "id": "reactorFormulas",
315
- "description": "List Reactor Formulas. Requires `reactor:read` Management Application permission",
315
+ "description": "[Deprecated] List Reactor Formulas. Requires `reactor:read` Management Application permission",
316
316
  "strict": true,
317
317
  "pluginName": "@basis-theory-labs/cli",
318
318
  "pluginAlias": "@basis-theory-labs/cli",
@@ -350,7 +350,7 @@
350
350
  },
351
351
  "reactorFormulas:update": {
352
352
  "id": "reactorFormulas:update",
353
- "description": "Updates an existing Reactor Formula. Requires `reactor:update` Management Application permission",
353
+ "description": "[Deprecated] Updates an existing Reactor Formula. Requires `reactor:update` Management Application permission",
354
354
  "strict": true,
355
355
  "pluginName": "@basis-theory-labs/cli",
356
356
  "pluginAlias": "@basis-theory-labs/cli",
@@ -440,6 +440,107 @@
440
440
  }
441
441
  }
442
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
+ },
443
544
  "reactors": {
444
545
  "id": "reactors",
445
546
  "description": "List Reactors. Requires `reactor:read` Management Application permission",
@@ -522,6 +623,88 @@
522
623
  "description": "Reactor id to connect to"
523
624
  }
524
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
+ }
525
708
  }
526
709
  }
527
710
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@basis-theory-labs/cli",
3
- "version": "1.7.0",
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": "^1.79.2",
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",