@basis-theory-labs/cli 1.4.0 → 1.5.1
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 +30 -7
- package/dist/commands/proxies/delete.d.ts +12 -0
- package/dist/commands/proxies/delete.js +32 -0
- package/dist/commands/proxies/index.js +7 -0
- package/dist/commands/proxies/update.js +4 -4
- package/dist/proxies/management.d.ts +2 -1
- package/dist/proxies/management.js +19 -1
- package/oclif.manifest.json +48 -5
- package/package.json +1 -1
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.5.1 linux-x64 node-v18.16.1
|
|
23
23
|
$ bt --help [COMMAND]
|
|
24
24
|
USAGE
|
|
25
25
|
$ bt COMMAND
|
|
@@ -30,6 +30,7 @@ USAGE
|
|
|
30
30
|
<!-- commands -->
|
|
31
31
|
* [`bt proxies`](#bt-proxies)
|
|
32
32
|
* [`bt proxies create`](#bt-proxies-create)
|
|
33
|
+
* [`bt proxies delete ID`](#bt-proxies-delete-id)
|
|
33
34
|
* [`bt proxies logs [ID]`](#bt-proxies-logs-id)
|
|
34
35
|
* [`bt proxies update ID`](#bt-proxies-update-id)
|
|
35
36
|
* [`bt reactors`](#bt-reactors)
|
|
@@ -54,7 +55,7 @@ EXAMPLES
|
|
|
54
55
|
$ bt proxies
|
|
55
56
|
```
|
|
56
57
|
|
|
57
|
-
_See code: [dist/commands/proxies/index.ts](https://github.com/Basis-Theory-Labs/basistheory-cli/blob/v1.
|
|
58
|
+
_See code: [dist/commands/proxies/index.ts](https://github.com/Basis-Theory-Labs/basistheory-cli/blob/v1.5.1/dist/commands/proxies/index.ts)_
|
|
58
59
|
|
|
59
60
|
## `bt proxies create`
|
|
60
61
|
|
|
@@ -82,6 +83,28 @@ EXAMPLES
|
|
|
82
83
|
$ bt proxies create
|
|
83
84
|
```
|
|
84
85
|
|
|
86
|
+
## `bt proxies delete ID`
|
|
87
|
+
|
|
88
|
+
Deletes a Proxy. Requires `proxy:delete` and `proxy:read` Management Application permissions
|
|
89
|
+
|
|
90
|
+
```
|
|
91
|
+
USAGE
|
|
92
|
+
$ bt proxies delete ID -x <value> [-y]
|
|
93
|
+
|
|
94
|
+
ARGUMENTS
|
|
95
|
+
ID Proxy id to delete
|
|
96
|
+
|
|
97
|
+
FLAGS
|
|
98
|
+
-x, --management-key=<value> (required) management key used for connecting with the reactor / proxy
|
|
99
|
+
-y, --yes auto confirm the operation
|
|
100
|
+
|
|
101
|
+
DESCRIPTION
|
|
102
|
+
Deletes a Proxy. Requires `proxy:delete` and `proxy:read` Management Application permissions
|
|
103
|
+
|
|
104
|
+
EXAMPLES
|
|
105
|
+
$ bt proxies delete 03858bf5-32d3-4a2e-b74b-daeea0883bca
|
|
106
|
+
```
|
|
107
|
+
|
|
85
108
|
## `bt proxies logs [ID]`
|
|
86
109
|
|
|
87
110
|
Display live Proxy Transform logs output. Requires `proxy:update` Management Application permissions
|
|
@@ -136,13 +159,13 @@ DESCRIPTION
|
|
|
136
159
|
Updates an existing Pre-Configured Proxy. Requires `proxy:update` Management Application permission
|
|
137
160
|
|
|
138
161
|
EXAMPLES
|
|
139
|
-
$ bt proxies update
|
|
162
|
+
$ bt proxies update 03858bf5-32d3-4a2e-b74b-daeea0883bca
|
|
140
163
|
|
|
141
|
-
$ bt proxies update --destination-url https://echo.basistheory.com
|
|
164
|
+
$ bt proxies update 03858bf5-32d3-4a2e-b74b-daeea0883bca --destination-url https://echo.basistheory.com
|
|
142
165
|
|
|
143
|
-
$ bt proxies update --request-transform-code ./myRequestTransform.js
|
|
166
|
+
$ bt proxies update 03858bf5-32d3-4a2e-b74b-daeea0883bca --request-transform-code ./myRequestTransform.js
|
|
144
167
|
|
|
145
|
-
$ bt proxies update --configuration ./.env.proxy
|
|
168
|
+
$ bt proxies update 03858bf5-32d3-4a2e-b74b-daeea0883bca --configuration ./.env.proxy
|
|
146
169
|
```
|
|
147
170
|
|
|
148
171
|
## `bt reactors`
|
|
@@ -164,7 +187,7 @@ EXAMPLES
|
|
|
164
187
|
$ bt reactors
|
|
165
188
|
```
|
|
166
189
|
|
|
167
|
-
_See code: [dist/commands/reactors/index.ts](https://github.com/Basis-Theory-Labs/basistheory-cli/blob/v1.
|
|
190
|
+
_See code: [dist/commands/reactors/index.ts](https://github.com/Basis-Theory-Labs/basistheory-cli/blob/v1.5.1/dist/commands/reactors/index.ts)_
|
|
168
191
|
|
|
169
192
|
## `bt reactors logs [ID]`
|
|
170
193
|
|
|
@@ -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("../../proxies/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.deleteProxy)(bt, id, yes)) {
|
|
10
|
+
this.log('Proxy deleted successfully!');
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
exports.default = Delete;
|
|
15
|
+
Delete.description = 'Deletes a Proxy. Requires `proxy:delete` and `proxy: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: 'Proxy 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 Proxies extends base_1.BaseCommand {
|
|
|
24
24
|
value: 'logs',
|
|
25
25
|
description: 'See Proxy Transforms real-time logs',
|
|
26
26
|
},
|
|
27
|
+
{
|
|
28
|
+
name: 'Delete',
|
|
29
|
+
value: 'delete',
|
|
30
|
+
},
|
|
27
31
|
{
|
|
28
32
|
name: 'Exit',
|
|
29
33
|
value: 'exit',
|
|
@@ -37,6 +41,9 @@ class Proxies extends base_1.BaseCommand {
|
|
|
37
41
|
if (action === 'logs') {
|
|
38
42
|
return (0, logs_1.showProxyLogs)(bt, proxy.id);
|
|
39
43
|
}
|
|
44
|
+
if (action === 'delete' && (await (0, management_1.deleteProxy)(bt, proxy.id))) {
|
|
45
|
+
return this.log('Proxy deleted successfully!');
|
|
46
|
+
}
|
|
40
47
|
return undefined;
|
|
41
48
|
}
|
|
42
49
|
}
|
|
@@ -46,10 +46,10 @@ class Update extends base_1.BaseCommand {
|
|
|
46
46
|
exports.default = Update;
|
|
47
47
|
Update.description = 'Updates an existing Pre-Configured Proxy. Requires `proxy:update` Management Application permission';
|
|
48
48
|
Update.examples = [
|
|
49
|
-
'<%= config.bin %> <%= command.id %> ',
|
|
50
|
-
'<%= config.bin %> <%= command.id %> --destination-url https://echo.basistheory.com',
|
|
51
|
-
'<%= config.bin %> <%= command.id %> --request-transform-code ./myRequestTransform.js',
|
|
52
|
-
'<%= config.bin %> <%= command.id %> --configuration ./.env.proxy',
|
|
49
|
+
'<%= config.bin %> <%= command.id %> 03858bf5-32d3-4a2e-b74b-daeea0883bca',
|
|
50
|
+
'<%= config.bin %> <%= command.id %> 03858bf5-32d3-4a2e-b74b-daeea0883bca --destination-url https://echo.basistheory.com',
|
|
51
|
+
'<%= config.bin %> <%= command.id %> 03858bf5-32d3-4a2e-b74b-daeea0883bca --request-transform-code ./myRequestTransform.js',
|
|
52
|
+
'<%= config.bin %> <%= command.id %> 03858bf5-32d3-4a2e-b74b-daeea0883bca --configuration ./.env.proxy',
|
|
53
53
|
];
|
|
54
54
|
Update.flags = {
|
|
55
55
|
...utils_1.PROXY_FLAGS,
|
|
@@ -2,5 +2,6 @@ import type { CreateProxy, PatchProxy, Proxy } from '@basis-theory/basis-theory-
|
|
|
2
2
|
import type { BasisTheory as IBasisTheory } from '@basis-theory/basis-theory-js/types/sdk';
|
|
3
3
|
declare const selectProxy: (bt: IBasisTheory, page: number) => Promise<Proxy | undefined>;
|
|
4
4
|
declare const createProxy: (bt: IBasisTheory, model: CreateProxy) => Promise<Proxy>;
|
|
5
|
+
declare const deleteProxy: (bt: IBasisTheory, id: string, force?: boolean) => Promise<boolean>;
|
|
5
6
|
declare const patchProxy: (bt: IBasisTheory, id: string, model: PatchProxy) => Promise<void>;
|
|
6
|
-
export { selectProxy, createProxy, patchProxy };
|
|
7
|
+
export { selectProxy, createProxy, patchProxy, deleteProxy };
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.patchProxy = exports.createProxy = exports.selectProxy = void 0;
|
|
3
|
+
exports.deleteProxy = exports.patchProxy = exports.createProxy = exports.selectProxy = 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')('proxies:management');
|
|
@@ -42,6 +44,7 @@ const listProxies = async (bt, page) => {
|
|
|
42
44
|
},
|
|
43
45
|
application_id: {
|
|
44
46
|
header: 'Application Id',
|
|
47
|
+
get: (proxy) => proxy.applicationId || '',
|
|
45
48
|
},
|
|
46
49
|
/* eslint-enable camelcase */
|
|
47
50
|
});
|
|
@@ -74,6 +77,21 @@ const createProxy = (bt, model) => {
|
|
|
74
77
|
return bt.proxies.create(model);
|
|
75
78
|
};
|
|
76
79
|
exports.createProxy = createProxy;
|
|
80
|
+
const deleteProxy = async (bt, id, force = false) => {
|
|
81
|
+
if (!force) {
|
|
82
|
+
const proceed = await (0, confirm_1.default)({
|
|
83
|
+
message: `Are you sure you want to delete this Proxy (${id})?`,
|
|
84
|
+
default: false,
|
|
85
|
+
});
|
|
86
|
+
if (!proceed) {
|
|
87
|
+
return false;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
debug(`Deleting Proxy`, id);
|
|
91
|
+
await bt.proxies.delete(id);
|
|
92
|
+
return true;
|
|
93
|
+
};
|
|
94
|
+
exports.deleteProxy = deleteProxy;
|
|
77
95
|
const patchProxy = (bt, id, model) => {
|
|
78
96
|
debug(`Patching Proxy ${id}`, JSON.stringify(model, undefined, 2));
|
|
79
97
|
return bt.proxies.patch(id, model);
|
package/oclif.manifest.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "1.
|
|
2
|
+
"version": "1.5.1",
|
|
3
3
|
"commands": {
|
|
4
4
|
"proxies:create": {
|
|
5
5
|
"id": "proxies:create",
|
|
@@ -80,6 +80,49 @@
|
|
|
80
80
|
},
|
|
81
81
|
"args": {}
|
|
82
82
|
},
|
|
83
|
+
"proxies:delete": {
|
|
84
|
+
"id": "proxies:delete",
|
|
85
|
+
"description": "Deletes a Proxy. Requires `proxy:delete` and `proxy:read` Management Application permissions",
|
|
86
|
+
"strict": true,
|
|
87
|
+
"pluginName": "@basis-theory-labs/cli",
|
|
88
|
+
"pluginAlias": "@basis-theory-labs/cli",
|
|
89
|
+
"pluginType": "core",
|
|
90
|
+
"aliases": [],
|
|
91
|
+
"examples": [
|
|
92
|
+
"<%= config.bin %> <%= command.id %> 03858bf5-32d3-4a2e-b74b-daeea0883bca"
|
|
93
|
+
],
|
|
94
|
+
"flags": {
|
|
95
|
+
"management-key": {
|
|
96
|
+
"name": "management-key",
|
|
97
|
+
"type": "option",
|
|
98
|
+
"char": "x",
|
|
99
|
+
"description": "management key used for connecting with the reactor / proxy",
|
|
100
|
+
"required": true,
|
|
101
|
+
"multiple": false
|
|
102
|
+
},
|
|
103
|
+
"api-base-url": {
|
|
104
|
+
"name": "api-base-url",
|
|
105
|
+
"type": "option",
|
|
106
|
+
"description": "base API URL to use in Basis Theory SDK",
|
|
107
|
+
"hidden": true,
|
|
108
|
+
"multiple": false
|
|
109
|
+
},
|
|
110
|
+
"yes": {
|
|
111
|
+
"name": "yes",
|
|
112
|
+
"type": "boolean",
|
|
113
|
+
"char": "y",
|
|
114
|
+
"description": "auto confirm the operation",
|
|
115
|
+
"allowNo": false
|
|
116
|
+
}
|
|
117
|
+
},
|
|
118
|
+
"args": {
|
|
119
|
+
"id": {
|
|
120
|
+
"name": "id",
|
|
121
|
+
"description": "Proxy id to delete",
|
|
122
|
+
"required": true
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
},
|
|
83
126
|
"proxies": {
|
|
84
127
|
"id": "proxies",
|
|
85
128
|
"description": "List Proxies. Requires `proxy:read` Management Application permission",
|
|
@@ -172,10 +215,10 @@
|
|
|
172
215
|
"pluginType": "core",
|
|
173
216
|
"aliases": [],
|
|
174
217
|
"examples": [
|
|
175
|
-
"<%= config.bin %> <%= command.id %> ",
|
|
176
|
-
"<%= config.bin %> <%= command.id %> --destination-url https://echo.basistheory.com",
|
|
177
|
-
"<%= config.bin %> <%= command.id %> --request-transform-code ./myRequestTransform.js",
|
|
178
|
-
"<%= config.bin %> <%= command.id %> --configuration ./.env.proxy"
|
|
218
|
+
"<%= config.bin %> <%= command.id %> 03858bf5-32d3-4a2e-b74b-daeea0883bca",
|
|
219
|
+
"<%= config.bin %> <%= command.id %> 03858bf5-32d3-4a2e-b74b-daeea0883bca --destination-url https://echo.basistheory.com",
|
|
220
|
+
"<%= config.bin %> <%= command.id %> 03858bf5-32d3-4a2e-b74b-daeea0883bca --request-transform-code ./myRequestTransform.js",
|
|
221
|
+
"<%= config.bin %> <%= command.id %> 03858bf5-32d3-4a2e-b74b-daeea0883bca --configuration ./.env.proxy"
|
|
179
222
|
],
|
|
180
223
|
"flags": {
|
|
181
224
|
"management-key": {
|