@basis-theory-labs/cli 1.5.2 → 1.7.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.5.2 linux-x64 node-v18.16.1
22
+ @basis-theory-labs/cli/1.7.0 linux-x64 node-v18.17.0
23
23
  $ bt --help [COMMAND]
24
24
  USAGE
25
25
  $ bt COMMAND
@@ -33,6 +33,8 @@ 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)
37
39
  * [`bt reactors logs [ID]`](#bt-reactors-logs-id)
38
40
 
@@ -55,7 +57,7 @@ EXAMPLES
55
57
  $ bt proxies
56
58
  ```
57
59
 
58
- _See code: [dist/commands/proxies/index.ts](https://github.com/Basis-Theory-Labs/basistheory-cli/blob/v1.5.2/dist/commands/proxies/index.ts)_
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)_
59
61
 
60
62
  ## `bt proxies create`
61
63
 
@@ -138,7 +140,7 @@ Updates an existing Pre-Configured Proxy. Requires `proxy:update` Management App
138
140
  ```
139
141
  USAGE
140
142
  $ bt proxies update ID -x <value> [-n <value>] [-u <value>] [-q <value>] [-s <value>] [-i <value>] [-c <value>]
141
- [-a] [-w]
143
+ [-a] [-w] [-l]
142
144
 
143
145
  ARGUMENTS
144
146
  ID Proxy id to update
@@ -148,6 +150,7 @@ FLAGS
148
150
  true
149
151
  -c, --configuration=<value> path to configuration file (.env format) to use in the Proxy
150
152
  -i, --application-id=<value> application ID to use in the Proxy
153
+ -l, --logs Start logs server after update
151
154
  -n, --name=<value> name of the Proxy
152
155
  -q, --request-transform-code=<value> path to JavaScript file containing a Request Transform code
153
156
  -s, --response-transform-code=<value> path to JavaScript file containing a Response Transform code
@@ -168,6 +171,59 @@ EXAMPLES
168
171
  $ bt proxies update 03858bf5-32d3-4a2e-b74b-daeea0883bca --configuration ./.env.proxy
169
172
  ```
170
173
 
174
+ ## `bt reactorFormulas`
175
+
176
+ List Reactor Formulas. Requires `reactor:read` Management Application permission
177
+
178
+ ```
179
+ USAGE
180
+ $ bt reactorFormulas -x <value> [-p <value>]
181
+
182
+ FLAGS
183
+ -p, --page=<value> [default: 1] reactors formulas list page to fetch
184
+ -x, --management-key=<value> (required) management key used for connecting with the reactor / proxy
185
+
186
+ DESCRIPTION
187
+ List Reactor Formulas. Requires `reactor:read` Management Application permission
188
+
189
+ EXAMPLES
190
+ $ bt reactorFormulas
191
+ ```
192
+
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)_
194
+
195
+ ## `bt reactorFormulas update ID`
196
+
197
+ Updates an existing Reactor Formula. Requires `reactor:update` Management Application permission
198
+
199
+ ```
200
+ USAGE
201
+ $ bt reactorFormulas update ID -x <value> -n <value> -s <value> -c <value> -p <value> [-d <value>] [-i <value>] [-w]
202
+
203
+ ARGUMENTS
204
+ ID Reactor Formula id to update
205
+
206
+ FLAGS
207
+ -c, --configuration=<value> (required) path to configuration definition to use in the Reactor Formula
208
+ -d, --description=<value> description of the Reactor Formula
209
+ -i, --icon=<value> icon of the Reactor Formula
210
+ -n, --name=<value> (required) name of the Reactor Formula
211
+ -p, --request-parameters=<value> (required) path to request params definition to use in the Reactor Formula
212
+ -s, --code=<value> (required) path to JavaScript file containing code
213
+ -w, --watch Watch for changes in informed files
214
+ -x, --management-key=<value> (required) management key used for connecting with the reactor / proxy
215
+
216
+ DESCRIPTION
217
+ Updates an existing Reactor Formula. Requires `reactor:update` Management Application permission
218
+
219
+ EXAMPLES
220
+ $ bt reactorFormulas update 03858bf5-32d3-4a2e-b74b-daeea0883bca
221
+
222
+ $ bt reactorFormulas update 03858bf5-32d3-4a2e-b74b-daeea0883bca --code ./formula.js
223
+
224
+ $ bt reactorFormulas update 03858bf5-32d3-4a2e-b74b-daeea0883bca --code ./formula.js -w
225
+ ```
226
+
171
227
  ## `bt reactors`
172
228
 
173
229
  List Reactors. Requires `reactor:read` Management Application permission
@@ -187,7 +243,7 @@ EXAMPLES
187
243
  $ bt reactors
188
244
  ```
189
245
 
190
- _See code: [dist/commands/reactors/index.ts](https://github.com/Basis-Theory-Labs/basistheory-cli/blob/v1.5.2/dist/commands/reactors/index.ts)_
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)_
191
247
 
192
248
  ## `bt reactors logs [ID]`
193
249
 
@@ -5,6 +5,7 @@ export default class Update extends BaseCommand {
5
5
  static examples: string[];
6
6
  static flags: {
7
7
  watch: import("@oclif/core/lib/interfaces/parser").BooleanFlag<boolean>;
8
+ logs: import("@oclif/core/lib/interfaces/parser").BooleanFlag<boolean>;
8
9
  name: import("@oclif/core/lib/interfaces/parser").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
9
10
  'destination-url': import("@oclif/core/lib/interfaces/parser").OptionFlag<import("url").URL | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
10
11
  'request-transform-code': import("@oclif/core/lib/interfaces/parser").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
@@ -3,12 +3,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const core_1 = require("@oclif/core");
4
4
  const base_1 = require("../../base");
5
5
  const files_1 = require("../../files");
6
+ const logs_1 = require("../../logs");
6
7
  const management_1 = require("../../proxies/management");
7
8
  const utils_1 = require("../../proxies/utils");
8
9
  class Update extends base_1.BaseCommand {
9
10
  async run() {
10
11
  var _a, _b;
11
- const { bt, args: { id }, flags: { name, 'destination-url': destinationUrl, 'response-transform-code': responseTransformCode, 'request-transform-code': requestTransformCode, 'application-id': applicationId, configuration, 'require-auth': requireAuth, watch, }, metadata, } = await this.parse(Update);
12
+ const { bt, args: { id }, flags: { name, 'destination-url': destinationUrl, 'response-transform-code': responseTransformCode, 'request-transform-code': requestTransformCode, 'application-id': applicationId, configuration, 'require-auth': requireAuth, watch, logs, }, metadata, } = await this.parse(Update);
12
13
  const model = (0, utils_1.createModelFromFlags)({
13
14
  name,
14
15
  destinationUrl: destinationUrl === null || destinationUrl === void 0 ? void 0 : destinationUrl.toString(),
@@ -22,20 +23,24 @@ class Update extends base_1.BaseCommand {
22
23
  });
23
24
  await (0, management_1.patchProxy)(bt, id, model);
24
25
  this.log('Proxy updated successfully!');
26
+ if (logs) {
27
+ await (0, logs_1.showProxyLogs)(bt, id);
28
+ }
25
29
  if (watch) {
26
- const files = [
30
+ const entries = Object.entries({
27
31
  requestTransformCode,
28
32
  responseTransformCode,
29
33
  configuration,
30
- ].filter((flag) => flag);
34
+ }).filter(([, value]) => Boolean(value));
35
+ const files = entries.reduce((arr, [, file]) => [...arr, file], []);
31
36
  if (files.length) {
32
37
  this.log(`Watching files for changes: ${files.join(', ')} `);
33
38
  }
34
- files.forEach((file) => {
39
+ entries.forEach(([prop, file]) => {
35
40
  (0, files_1.watchForChanges)(file, async () => {
36
41
  core_1.ux.action.start(`Detected change in ${file}. Pushing changes`);
37
42
  await (0, management_1.patchProxy)(bt, id, (0, utils_1.createModelFromFlags)({
38
- responseTransformCode,
43
+ [prop]: file,
39
44
  }));
40
45
  core_1.ux.action.stop('✅\t');
41
46
  });
@@ -59,6 +64,12 @@ Update.flags = {
59
64
  default: false,
60
65
  required: false,
61
66
  }),
67
+ logs: core_1.Flags.boolean({
68
+ char: 'l',
69
+ description: 'Start logs server after update',
70
+ default: false,
71
+ required: false,
72
+ }),
62
73
  };
63
74
  Update.args = {
64
75
  id: core_1.Args.string({
@@ -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,26 @@
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
+ const { bt, flags: { page }, } = await this.parse(ReactorFormulas);
9
+ const reactor = await (0, management_1.selectReactorFormula)(bt, page);
10
+ if (!reactor) {
11
+ return undefined;
12
+ }
13
+ return undefined;
14
+ }
15
+ }
16
+ exports.default = ReactorFormulas;
17
+ ReactorFormulas.description = 'List Reactor Formulas. Requires `reactor:read` Management Application permission';
18
+ ReactorFormulas.examples = ['<%= config.bin %> <%= command.id %>'];
19
+ ReactorFormulas.flags = {
20
+ page: core_1.Flags.integer({
21
+ char: 'p',
22
+ description: 'reactors formulas list page to fetch',
23
+ default: 1,
24
+ }),
25
+ };
26
+ 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,70 @@
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
+ const { bt, args: { id }, flags: { name, description, code, configuration = '', 'request-parameters': requestParameters = '', watch, }, } = await this.parse(Update);
11
+ const model = (0, utils_1.createModelFromFlags)({
12
+ name,
13
+ description,
14
+ type: 'private',
15
+ code,
16
+ configuration,
17
+ requestParameters,
18
+ });
19
+ await (0, management_1.updateReactorFormula)(bt, id, model);
20
+ this.log('Reactor Formula updated successfully!');
21
+ if (watch) {
22
+ const entries = Object.entries({
23
+ code,
24
+ configuration,
25
+ requestParameters,
26
+ }).filter(([, value]) => Boolean(value));
27
+ const files = entries.reduce((arr, [, file]) => [...arr, file], []);
28
+ if (files.length) {
29
+ this.log(`Watching files for changes: ${files.join(', ')} `);
30
+ }
31
+ entries.forEach(([prop, file]) => {
32
+ (0, files_1.watchForChanges)(file, async () => {
33
+ core_1.ux.action.start(`Detected change in ${file}. Pushing changes`);
34
+ await (0, management_1.updateReactorFormula)(bt, id, (0, utils_1.createModelFromFlags)({
35
+ name,
36
+ description,
37
+ type: 'private',
38
+ code,
39
+ configuration,
40
+ requestParameters,
41
+ [prop]: file,
42
+ }));
43
+ core_1.ux.action.stop('✅\t');
44
+ });
45
+ });
46
+ }
47
+ }
48
+ }
49
+ exports.default = Update;
50
+ Update.description = 'Updates an existing Reactor Formula. Requires `reactor:update` Management Application permission';
51
+ Update.examples = [
52
+ '<%= config.bin %> <%= command.id %> 03858bf5-32d3-4a2e-b74b-daeea0883bca',
53
+ '<%= config.bin %> <%= command.id %> 03858bf5-32d3-4a2e-b74b-daeea0883bca --code ./formula.js',
54
+ '<%= config.bin %> <%= command.id %> 03858bf5-32d3-4a2e-b74b-daeea0883bca --code ./formula.js -w',
55
+ ];
56
+ Update.flags = {
57
+ ...utils_1.REACTOR_FORMULA_FLAGS,
58
+ watch: core_1.Flags.boolean({
59
+ char: 'w',
60
+ description: 'Watch for changes in informed files',
61
+ default: false,
62
+ required: false,
63
+ }),
64
+ };
65
+ Update.args = {
66
+ id: core_1.Args.string({
67
+ description: 'Reactor Formula id to update',
68
+ required: true,
69
+ }),
70
+ };
@@ -1,2 +1,2 @@
1
- declare const createLogServer: (port: number) => Promise<string>;
1
+ declare const createLogServer: (_port: number) => Promise<string>;
2
2
  export { createLogServer };
@@ -4,6 +4,7 @@ exports.createLogServer = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const core_1 = require("@oclif/core");
6
6
  const cloudflared_1 = require("cloudflared");
7
+ const detect_port_1 = tslib_1.__importDefault(require("detect-port"));
7
8
  const fs = tslib_1.__importStar(require("node:fs"));
8
9
  const pino_1 = tslib_1.__importDefault(require("pino"));
9
10
  const http_1 = require("./http");
@@ -21,7 +22,11 @@ const runTunnel = async (port) => {
21
22
  debug(`tunnel started at ${url}`);
22
23
  return url;
23
24
  };
24
- const createLogServer = async (port) => {
25
+ const createLogServer = async (_port) => {
26
+ const port = await (0, detect_port_1.default)(_port);
27
+ if (port !== _port) {
28
+ core_1.ux.log(`Port ${_port} was occupied, using port ${port}.`);
29
+ }
25
30
  core_1.ux.action.start('Starting log server');
26
31
  const logger = (0, pino_1.default)({
27
32
  transport: {
@@ -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,5 @@
1
1
  {
2
- "version": "1.5.2",
2
+ "version": "1.7.0",
3
3
  "commands": {
4
4
  "proxies:create": {
5
5
  "id": "proxies:create",
@@ -292,6 +292,14 @@
292
292
  "description": "Watch for changes in informed files",
293
293
  "required": false,
294
294
  "allowNo": false
295
+ },
296
+ "logs": {
297
+ "name": "logs",
298
+ "type": "boolean",
299
+ "char": "l",
300
+ "description": "Start logs server after update",
301
+ "required": false,
302
+ "allowNo": false
295
303
  }
296
304
  },
297
305
  "args": {
@@ -302,6 +310,136 @@
302
310
  }
303
311
  }
304
312
  },
313
+ "reactorFormulas": {
314
+ "id": "reactorFormulas",
315
+ "description": "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": "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
+ },
305
443
  "reactors": {
306
444
  "id": "reactors",
307
445
  "description": "List Reactors. Requires `reactor:read` Management Application permission",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@basis-theory-labs/cli",
3
- "version": "1.5.2",
3
+ "version": "1.7.0",
4
4
  "description": "Basis Theory CLI tool",
5
5
  "author": "Davi Aquino @djejaquino",
6
6
  "bin": {
@@ -27,6 +27,7 @@
27
27
  "@oclif/plugin-plugins": "^2.4.7",
28
28
  "cloudflared": "^0.4.0",
29
29
  "debug": "^4.3.4",
30
+ "detect-port": "^1.5.1",
30
31
  "dotenv": "^16.3.1",
31
32
  "fastify": "^4.19.2",
32
33
  "lodash.debounce": "^4.0.8",
@@ -46,6 +47,7 @@
46
47
  "@semantic-release/release-notes-generator": "^11.0.3",
47
48
  "@types/chai": "^4",
48
49
  "@types/debug": "^4.1.8",
50
+ "@types/detect-port": "^1.3.3",
49
51
  "@types/lodash.debounce": "^4.0.7",
50
52
  "@types/mocha": "^9.0.0",
51
53
  "@types/node": "^16.18.36",