@basis-theory-labs/cli 1.7.0 → 1.9.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.9.0 linux-x64 node-v18.18.2
23
23
  $ bt --help [COMMAND]
24
24
  USAGE
25
25
  $ bt COMMAND
@@ -28,6 +28,10 @@ USAGE
28
28
  <!-- usagestop -->
29
29
  # Commands
30
30
  <!-- commands -->
31
+ * [`bt applications`](#bt-applications)
32
+ * [`bt applications create`](#bt-applications-create)
33
+ * [`bt applications delete ID`](#bt-applications-delete-id)
34
+ * [`bt applications update ID`](#bt-applications-update-id)
31
35
  * [`bt proxies`](#bt-proxies)
32
36
  * [`bt proxies create`](#bt-proxies-create)
33
37
  * [`bt proxies delete ID`](#bt-proxies-delete-id)
@@ -36,7 +40,98 @@ USAGE
36
40
  * [`bt reactorFormulas`](#bt-reactorformulas)
37
41
  * [`bt reactorFormulas update ID`](#bt-reactorformulas-update-id)
38
42
  * [`bt reactors`](#bt-reactors)
43
+ * [`bt reactors create`](#bt-reactors-create)
44
+ * [`bt reactors delete ID`](#bt-reactors-delete-id)
39
45
  * [`bt reactors logs [ID]`](#bt-reactors-logs-id)
46
+ * [`bt reactors update ID`](#bt-reactors-update-id)
47
+
48
+ ## `bt applications`
49
+
50
+ List Applications. Requires `application:read` Management Application permission
51
+
52
+ ```
53
+ USAGE
54
+ $ bt applications -x <value> [-p <value>]
55
+
56
+ FLAGS
57
+ -p, --page=<value> [default: 1] Applications list page to fetch
58
+ -x, --management-key=<value> (required) management key used for connecting with the reactor / proxy
59
+
60
+ DESCRIPTION
61
+ List Applications. Requires `application:read` Management Application permission
62
+
63
+ EXAMPLES
64
+ $ bt applications
65
+ ```
66
+
67
+ _See code: [dist/commands/applications/index.ts](https://github.com/Basis-Theory-Labs/basistheory-cli/blob/v1.9.0/dist/commands/applications/index.ts)_
68
+
69
+ ## `bt applications create`
70
+
71
+ Creates a new Application. Requires `application:create` Management Application permission
72
+
73
+ ```
74
+ USAGE
75
+ $ bt applications create -x <value> [-n <value>] [-p <value>] [-t private|public|management]
76
+
77
+ FLAGS
78
+ -n, --name=<value> name of the Application
79
+ -p, --permission=<value>... permission(s) to use in the Application
80
+ -t, --type=<option> type of the Application
81
+ <options: private|public|management>
82
+ -x, --management-key=<value> (required) management key used for connecting with the reactor / proxy
83
+
84
+ DESCRIPTION
85
+ Creates a new Application. Requires `application:create` Management Application permission
86
+
87
+ EXAMPLES
88
+ $ bt applications create
89
+ ```
90
+
91
+ ## `bt applications delete ID`
92
+
93
+ Deletes a Application. Requires `application:delete` Management Application permissions
94
+
95
+ ```
96
+ USAGE
97
+ $ bt applications delete ID -x <value> [-y]
98
+
99
+ ARGUMENTS
100
+ ID Application id to delete
101
+
102
+ FLAGS
103
+ -x, --management-key=<value> (required) management key used for connecting with the reactor / proxy
104
+ -y, --yes auto confirm the operation
105
+
106
+ DESCRIPTION
107
+ Deletes a Application. Requires `application:delete` Management Application permissions
108
+
109
+ EXAMPLES
110
+ $ bt applications delete 03858bf5-32d3-4a2e-b74b-daeea0883bca
111
+ ```
112
+
113
+ ## `bt applications update ID`
114
+
115
+ Updates a new Application. Requires `application:update` Management Application permission
116
+
117
+ ```
118
+ USAGE
119
+ $ bt applications update ID -x <value> [-n <value>] [-p <value>]
120
+
121
+ ARGUMENTS
122
+ ID Application id to update
123
+
124
+ FLAGS
125
+ -n, --name=<value> name of the Application
126
+ -p, --permission=<value>... permission(s) to use in the Application
127
+ -x, --management-key=<value> (required) management key used for connecting with the reactor / proxy
128
+
129
+ DESCRIPTION
130
+ Updates a new Application. Requires `application:update` Management Application permission
131
+
132
+ EXAMPLES
133
+ $ bt applications update
134
+ ```
40
135
 
41
136
  ## `bt proxies`
42
137
 
@@ -47,7 +142,7 @@ USAGE
47
142
  $ bt proxies -x <value> [-p <value>]
48
143
 
49
144
  FLAGS
50
- -p, --page=<value> [default: 1] proxies list page to fetch
145
+ -p, --page=<value> [default: 1] Proxies list page to fetch
51
146
  -x, --management-key=<value> (required) management key used for connecting with the reactor / proxy
52
147
 
53
148
  DESCRIPTION
@@ -57,7 +152,7 @@ EXAMPLES
57
152
  $ bt proxies
58
153
  ```
59
154
 
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)_
155
+ _See code: [dist/commands/proxies/index.ts](https://github.com/Basis-Theory-Labs/basistheory-cli/blob/v1.9.0/dist/commands/proxies/index.ts)_
61
156
 
62
157
  ## `bt proxies create`
63
158
 
@@ -87,7 +182,7 @@ EXAMPLES
87
182
 
88
183
  ## `bt proxies delete ID`
89
184
 
90
- Deletes a Proxy. Requires `proxy:delete` and `proxy:read` Management Application permissions
185
+ Deletes a Proxy. Requires `proxy:delete` Management Application permissions
91
186
 
92
187
  ```
93
188
  USAGE
@@ -101,7 +196,7 @@ FLAGS
101
196
  -y, --yes auto confirm the operation
102
197
 
103
198
  DESCRIPTION
104
- Deletes a Proxy. Requires `proxy:delete` and `proxy:read` Management Application permissions
199
+ Deletes a Proxy. Requires `proxy:delete` Management Application permissions
105
200
 
106
201
  EXAMPLES
107
202
  $ bt proxies delete 03858bf5-32d3-4a2e-b74b-daeea0883bca
@@ -173,28 +268,28 @@ EXAMPLES
173
268
 
174
269
  ## `bt reactorFormulas`
175
270
 
176
- List Reactor Formulas. Requires `reactor:read` Management Application permission
271
+ [Deprecated] List Reactor Formulas. Requires `reactor:read` Management Application permission
177
272
 
178
273
  ```
179
274
  USAGE
180
275
  $ bt reactorFormulas -x <value> [-p <value>]
181
276
 
182
277
  FLAGS
183
- -p, --page=<value> [default: 1] reactors formulas list page to fetch
278
+ -p, --page=<value> [default: 1] Reactors formulas list page to fetch
184
279
  -x, --management-key=<value> (required) management key used for connecting with the reactor / proxy
185
280
 
186
281
  DESCRIPTION
187
- List Reactor Formulas. Requires `reactor:read` Management Application permission
282
+ [Deprecated] List Reactor Formulas. Requires `reactor:read` Management Application permission
188
283
 
189
284
  EXAMPLES
190
285
  $ bt reactorFormulas
191
286
  ```
192
287
 
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)_
288
+ _See code: [dist/commands/reactorFormulas/index.ts](https://github.com/Basis-Theory-Labs/basistheory-cli/blob/v1.9.0/dist/commands/reactorFormulas/index.ts)_
194
289
 
195
290
  ## `bt reactorFormulas update ID`
196
291
 
197
- Updates an existing Reactor Formula. Requires `reactor:update` Management Application permission
292
+ [Deprecated] Updates an existing Reactor Formula. Requires `reactor:update` Management Application permission
198
293
 
199
294
  ```
200
295
  USAGE
@@ -214,7 +309,7 @@ FLAGS
214
309
  -x, --management-key=<value> (required) management key used for connecting with the reactor / proxy
215
310
 
216
311
  DESCRIPTION
217
- Updates an existing Reactor Formula. Requires `reactor:update` Management Application permission
312
+ [Deprecated] Updates an existing Reactor Formula. Requires `reactor:update` Management Application permission
218
313
 
219
314
  EXAMPLES
220
315
  $ bt reactorFormulas update 03858bf5-32d3-4a2e-b74b-daeea0883bca
@@ -233,7 +328,7 @@ USAGE
233
328
  $ bt reactors -x <value> [-p <value>]
234
329
 
235
330
  FLAGS
236
- -p, --page=<value> [default: 1] reactors list page to fetch
331
+ -p, --page=<value> [default: 1] Reactors list page to fetch
237
332
  -x, --management-key=<value> (required) management key used for connecting with the reactor / proxy
238
333
 
239
334
  DESCRIPTION
@@ -243,7 +338,51 @@ EXAMPLES
243
338
  $ bt reactors
244
339
  ```
245
340
 
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)_
341
+ _See code: [dist/commands/reactors/index.ts](https://github.com/Basis-Theory-Labs/basistheory-cli/blob/v1.9.0/dist/commands/reactors/index.ts)_
342
+
343
+ ## `bt reactors create`
344
+
345
+ Creates a new Reactor. Requires `reactor:create` Management Application permission
346
+
347
+ ```
348
+ USAGE
349
+ $ bt reactors create -x <value> [-n <value>] [-c <value>] [-i <value>] [-r <value>]
350
+
351
+ FLAGS
352
+ -c, --configuration=<value> path to configuration file (.env format) to use in the Reactor
353
+ -i, --application-id=<value> application ID to use in the Reactor
354
+ -n, --name=<value> name of the Reactor
355
+ -r, --code=<value> path to JavaScript file containing the Reactor code
356
+ -x, --management-key=<value> (required) management key used for connecting with the reactor / proxy
357
+
358
+ DESCRIPTION
359
+ Creates a new Reactor. Requires `reactor:create` Management Application permission
360
+
361
+ EXAMPLES
362
+ $ bt reactors create
363
+ ```
364
+
365
+ ## `bt reactors delete ID`
366
+
367
+ Deletes a Reactor. Requires `reactor:delete` Management Application permissions
368
+
369
+ ```
370
+ USAGE
371
+ $ bt reactors delete ID -x <value> [-y]
372
+
373
+ ARGUMENTS
374
+ ID Reactor id to delete
375
+
376
+ FLAGS
377
+ -x, --management-key=<value> (required) management key used for connecting with the reactor / proxy
378
+ -y, --yes auto confirm the operation
379
+
380
+ DESCRIPTION
381
+ Deletes a Reactor. Requires `reactor:delete` Management Application permissions
382
+
383
+ EXAMPLES
384
+ $ bt reactors delete 03858bf5-32d3-4a2e-b74b-daeea0883bca
385
+ ```
247
386
 
248
387
  ## `bt reactors logs [ID]`
249
388
 
@@ -270,4 +409,35 @@ EXAMPLES
270
409
 
271
410
  $ bt reactors logs 03858bf5-32d3-4a2e-b74b-daeea0883bca -p 3000
272
411
  ```
412
+
413
+ ## `bt reactors update ID`
414
+
415
+ Updates an existing Reactor. Requires `reactor:update` Management Application permission
416
+
417
+ ```
418
+ USAGE
419
+ $ bt reactors update ID -x <value> [-n <value>] [-c <value>] [-i <value>] [-r <value>] [-w] [-l]
420
+
421
+ ARGUMENTS
422
+ ID Reactor id to update
423
+
424
+ FLAGS
425
+ -c, --configuration=<value> path to configuration file (.env format) to use in the Reactor
426
+ -i, --application-id=<value> application ID to use in the Reactor
427
+ -l, --logs Start logs server after update
428
+ -n, --name=<value> name of the Reactor
429
+ -r, --code=<value> path to JavaScript file containing the Reactor code
430
+ -w, --watch Watch for changes in informed files
431
+ -x, --management-key=<value> (required) management key used for connecting with the reactor / proxy
432
+
433
+ DESCRIPTION
434
+ Updates an existing Reactor. Requires `reactor:update` Management Application permission
435
+
436
+ EXAMPLES
437
+ $ bt reactors update 03858bf5-32d3-4a2e-b74b-daeea0883bca
438
+
439
+ $ bt reactors update 03858bf5-32d3-4a2e-b74b-daeea0883bca --code ./reactor.js
440
+
441
+ $ bt reactors update 03858bf5-32d3-4a2e-b74b-daeea0883bca --configuration ./.env.reactor
442
+ ```
273
443
  <!-- commandsstop -->
@@ -0,0 +1,8 @@
1
+ import type { Application, ApplicationType, CreateApplication, Permission, UpdateApplication } 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 listPermissions: (bt: IBasisTheory, type: ApplicationType) => Promise<Permission[]>;
4
+ declare const selectApplication: (bt: IBasisTheory, page: number) => Promise<Application | undefined>;
5
+ declare const createApplication: (bt: IBasisTheory, model: CreateApplication) => Promise<Application>;
6
+ declare const updateApplication: (bt: IBasisTheory, id: string, model: UpdateApplication) => Promise<Application>;
7
+ declare const deleteApplication: (bt: IBasisTheory, id: string, force?: boolean) => Promise<boolean>;
8
+ export { listPermissions, createApplication, updateApplication, selectApplication, deleteApplication, };
@@ -0,0 +1,92 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.deleteApplication = exports.selectApplication = exports.updateApplication = exports.createApplication = exports.listPermissions = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const confirm_1 = tslib_1.__importDefault(require("@inquirer/confirm"));
6
+ const core_1 = require("@oclif/core");
7
+ const utils_1 = require("../utils");
8
+ const debug = require('debug')('applications:management');
9
+ const listPermissions = (bt, type) => bt.permissions
10
+ .list({
11
+ applicationType: type,
12
+ })
13
+ .then((permissions) => permissions.sort((p1, p2) => p1.type.localeCompare(p2.type)));
14
+ exports.listPermissions = listPermissions;
15
+ const listApplications = async (bt, page) => {
16
+ const size = 5;
17
+ debug('Listing applications', `page: ${page}`, `size: ${size}`);
18
+ const applications = await bt.applications.list({
19
+ size,
20
+ page,
21
+ });
22
+ let data = [];
23
+ if (applications.pagination.totalItems > 0) {
24
+ const last = (applications.pagination.pageNumber - 1) * size;
25
+ data = applications.data.map((application, index) => ({
26
+ '#': last + (index + 1),
27
+ ...application,
28
+ }));
29
+ core_1.ux.table(data, {
30
+ '#': {},
31
+ id: {},
32
+ name: {},
33
+ type: {},
34
+ });
35
+ }
36
+ else {
37
+ core_1.ux.log('No applications found.');
38
+ }
39
+ return {
40
+ data,
41
+ pagination: applications.pagination,
42
+ };
43
+ };
44
+ const retrieveApplication = (bt, id) => {
45
+ debug(`Retrieving Application ${id}`);
46
+ return bt.applications.retrieve(id);
47
+ };
48
+ const selectApplication = async (bt, page) => {
49
+ const applications = await listApplications(bt, page);
50
+ if (applications.pagination.totalItems === 0) {
51
+ return undefined;
52
+ }
53
+ const selection = await (0, utils_1.selectOrNavigate)(applications, '#');
54
+ if (selection === 'previous') {
55
+ return selectApplication(bt, page - 1);
56
+ }
57
+ if (selection === 'next') {
58
+ return selectApplication(bt, page + 1);
59
+ }
60
+ return selection;
61
+ };
62
+ exports.selectApplication = selectApplication;
63
+ const createApplication = (bt, model) => {
64
+ debug('Creating Application', JSON.stringify(model, undefined, 2));
65
+ return bt.applications.create(model);
66
+ };
67
+ exports.createApplication = createApplication;
68
+ const updateApplication = async (bt, id, model) => {
69
+ const application = await retrieveApplication(bt, id);
70
+ debug(`Updating Application ${id}`, JSON.stringify(model, undefined, 2));
71
+ return bt.applications.update(id, {
72
+ name: model.name || application.name,
73
+ permissions: model.permissions || application.permissions,
74
+ rules: model.permissions ? undefined : application.rules, // if permissions were passed, overwrite rules
75
+ });
76
+ };
77
+ exports.updateApplication = updateApplication;
78
+ const deleteApplication = async (bt, id, force = false) => {
79
+ if (!force) {
80
+ const proceed = await (0, confirm_1.default)({
81
+ message: `Are you sure you want to delete this Application (${id})?`,
82
+ default: false,
83
+ });
84
+ if (!proceed) {
85
+ return false;
86
+ }
87
+ }
88
+ debug(`Deleting Application`, id);
89
+ await bt.applications.delete(id);
90
+ return true;
91
+ };
92
+ exports.deleteApplication = deleteApplication;
@@ -0,0 +1,5 @@
1
+ declare const APPLICATION_FLAGS: {
2
+ name: import("@oclif/core/lib/interfaces/parser").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
3
+ permission: import("@oclif/core/lib/interfaces/parser").OptionFlag<string[] | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
4
+ };
5
+ export { APPLICATION_FLAGS };
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.APPLICATION_FLAGS = void 0;
4
+ const core_1 = require("@oclif/core");
5
+ const APPLICATION_FLAGS = {
6
+ name: core_1.Flags.string({
7
+ char: 'n',
8
+ description: 'name of the Application',
9
+ }),
10
+ permission: core_1.Flags.string({
11
+ char: 'p',
12
+ description: 'permission(s) to use in the Application',
13
+ multiple: true,
14
+ }),
15
+ };
16
+ exports.APPLICATION_FLAGS = APPLICATION_FLAGS;
@@ -0,0 +1,11 @@
1
+ import { BaseCommand } from '../../base';
2
+ export default class Create extends BaseCommand {
3
+ static description: string;
4
+ static examples: string[];
5
+ static flags: {
6
+ type: import("@oclif/core/lib/interfaces/parser").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
7
+ name: import("@oclif/core/lib/interfaces/parser").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
8
+ permission: import("@oclif/core/lib/interfaces/parser").OptionFlag<string[] | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
9
+ };
10
+ run(): Promise<void>;
11
+ }
@@ -0,0 +1,48 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const models_1 = require("@basis-theory/basis-theory-js/types/models");
4
+ const core_1 = require("@oclif/core");
5
+ const management_1 = require("../../applications/management");
6
+ const utils_1 = require("../../applications/utils");
7
+ const base_1 = require("../../base");
8
+ const utils_2 = require("../../utils");
9
+ class Create extends base_1.BaseCommand {
10
+ async run() {
11
+ const { flags, bt } = await this.parse(Create);
12
+ const name = await (0, utils_2.promptStringIfUndefined)(flags.name, {
13
+ message: 'What is the Application name?',
14
+ validate: (value) => Boolean(value),
15
+ });
16
+ const type = (await (0, utils_2.promptSelectIfUndefined)(flags.type, {
17
+ message: 'What is the Application type?',
18
+ choices: models_1.APPLICATION_TYPES.map((t) => ({ value: t })),
19
+ }));
20
+ const available = await (0, management_1.listPermissions)(bt, type);
21
+ const permissions = await (0, utils_2.promptCheckboxIfUndefined)(flags.permission, {
22
+ message: 'Select the permissions for the Application',
23
+ choices: available.map((p) => ({
24
+ value: p.type,
25
+ })),
26
+ loop: false,
27
+ });
28
+ const { id, key } = await (0, management_1.createApplication)(bt, {
29
+ name,
30
+ type,
31
+ permissions,
32
+ });
33
+ this.log('Application created successfully!');
34
+ this.log(`id: ${id}`);
35
+ this.log(`key: ${key}`);
36
+ }
37
+ }
38
+ exports.default = Create;
39
+ Create.description = 'Creates a new Application. Requires `application:create` Management Application permission';
40
+ Create.examples = ['<%= config.bin %> <%= command.id %> '];
41
+ Create.flags = {
42
+ ...utils_1.APPLICATION_FLAGS,
43
+ type: core_1.Flags.string({
44
+ char: 't',
45
+ description: 'type of the Application',
46
+ options: [...models_1.APPLICATION_TYPES],
47
+ }),
48
+ };
@@ -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 management_1 = require("../../applications/management");
5
+ const base_1 = require("../../base");
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.deleteApplication)(bt, id, yes)) {
10
+ this.log('Application deleted successfully!');
11
+ }
12
+ }
13
+ }
14
+ exports.default = Delete;
15
+ Delete.description = 'Deletes a Application. Requires `application:delete` 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: 'Application 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
+ };
@@ -0,0 +1,9 @@
1
+ import { BaseCommand } from '../../base';
2
+ export default class Applications 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
+ run(): Promise<void>;
9
+ }
@@ -0,0 +1,47 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ const select_1 = tslib_1.__importDefault(require("@inquirer/select"));
5
+ const core_1 = require("@oclif/core");
6
+ const management_1 = require("../../applications/management");
7
+ const base_1 = require("../../base");
8
+ class Applications extends base_1.BaseCommand {
9
+ async run() {
10
+ const { bt, flags: { page }, } = await this.parse(Applications);
11
+ const application = await (0, management_1.selectApplication)(bt, page);
12
+ if (!application) {
13
+ return undefined;
14
+ }
15
+ const action = await (0, select_1.default)({
16
+ message: 'Select action to perform',
17
+ choices: [
18
+ {
19
+ name: 'See details',
20
+ value: 'details',
21
+ },
22
+ {
23
+ name: 'Delete',
24
+ value: 'delete',
25
+ },
26
+ ],
27
+ });
28
+ if (action === 'details') {
29
+ this.logJson(application);
30
+ return undefined;
31
+ }
32
+ if (action === 'delete' && (await (0, management_1.deleteApplication)(bt, application.id))) {
33
+ return this.log('Application deleted successfully!');
34
+ }
35
+ return undefined;
36
+ }
37
+ }
38
+ exports.default = Applications;
39
+ Applications.description = 'List Applications. Requires `application:read` Management Application permission';
40
+ Applications.examples = ['<%= config.bin %> <%= command.id %>'];
41
+ Applications.flags = {
42
+ page: core_1.Flags.integer({
43
+ char: 'p',
44
+ description: 'Applications list page to fetch',
45
+ default: 1,
46
+ }),
47
+ };
@@ -0,0 +1,13 @@
1
+ import { BaseCommand } from '../../base';
2
+ export default class Update 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
+ permission: import("@oclif/core/lib/interfaces/parser").OptionFlag<string[] | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
8
+ };
9
+ static args: {
10
+ id: import("@oclif/core/lib/interfaces/parser").Arg<string, Record<string, unknown>>;
11
+ };
12
+ run(): Promise<void>;
13
+ }
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const core_1 = require("@oclif/core");
4
+ const management_1 = require("../../applications/management");
5
+ const utils_1 = require("../../applications/utils");
6
+ const base_1 = require("../../base");
7
+ class Update extends base_1.BaseCommand {
8
+ async run() {
9
+ const { bt, args: { id }, flags: { name, permission: permissions }, } = await this.parse(Update);
10
+ await (0, management_1.updateApplication)(bt, id, {
11
+ name,
12
+ permissions,
13
+ });
14
+ this.log('Application updated successfully!');
15
+ }
16
+ }
17
+ exports.default = Update;
18
+ Update.description = 'Updates a new Application. Requires `application:update` Management Application permission';
19
+ Update.examples = ['<%= config.bin %> <%= command.id %> '];
20
+ Update.flags = {
21
+ ...utils_1.APPLICATION_FLAGS,
22
+ };
23
+ Update.args = {
24
+ id: core_1.Args.string({
25
+ description: 'Application id to update',
26
+ required: true,
27
+ }),
28
+ };
@@ -12,7 +12,7 @@ class Delete extends base_1.BaseCommand {
12
12
  }
13
13
  }
14
14
  exports.default = Delete;
15
- Delete.description = 'Deletes a Proxy. Requires `proxy:delete` and `proxy:read` Management Application permissions';
15
+ Delete.description = 'Deletes a Proxy. Requires `proxy:delete` Management Application permissions';
16
16
  Delete.examples = [
17
17
  '<%= config.bin %> <%= command.id %> 03858bf5-32d3-4a2e-b74b-daeea0883bca',
18
18
  ];
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- const prompts_1 = require("@inquirer/prompts");
3
+ const tslib_1 = require("tslib");
4
+ const select_1 = tslib_1.__importDefault(require("@inquirer/select"));
4
5
  const core_1 = require("@oclif/core");
5
6
  const base_1 = require("../../base");
6
7
  const logs_1 = require("../../logs");
@@ -12,7 +13,7 @@ class Proxies extends base_1.BaseCommand {
12
13
  if (!proxy) {
13
14
  return undefined;
14
15
  }
15
- const action = await (0, prompts_1.select)({
16
+ const action = await (0, select_1.default)({
16
17
  message: 'Select action to perform',
17
18
  choices: [
18
19
  {
@@ -49,7 +50,7 @@ Proxies.examples = ['<%= config.bin %> <%= command.id %>'];
49
50
  Proxies.flags = {
50
51
  page: core_1.Flags.integer({
51
52
  char: 'p',
52
- description: 'proxies list page to fetch',
53
+ description: 'Proxies list page to fetch',
53
54
  default: 1,
54
55
  }),
55
56
  };