@trayio/cdk-cli 2.21.0 → 2.22.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 +3 -8
- package/dist/commands/share.d.ts +0 -1
- package/dist/commands/share.d.ts.map +1 -1
- package/dist/commands/share.js +45 -34
- package/dist/commands/share.unit.test.js +39 -29
- package/oclif.manifest.json +2 -16
- package/package.json +7 -7
package/README.md
CHANGED
|
@@ -19,7 +19,7 @@ $ npm install -g @trayio/cdk-cli
|
|
|
19
19
|
$ tray-cdk COMMAND
|
|
20
20
|
running command...
|
|
21
21
|
$ tray-cdk (--version|-v)
|
|
22
|
-
@trayio/cdk-cli/2.
|
|
22
|
+
@trayio/cdk-cli/2.22.0 linux-x64 node-v18.19.0
|
|
23
23
|
$ tray-cdk --help [COMMAND]
|
|
24
24
|
USAGE
|
|
25
25
|
$ tray-cdk COMMAND
|
|
@@ -222,15 +222,14 @@ Share your connector version with other users in your organization
|
|
|
222
222
|
|
|
223
223
|
```
|
|
224
224
|
USAGE
|
|
225
|
-
$ tray-cdk share [CONNECTORNAME] [CONNECTORVERSION] [-e <value>]
|
|
225
|
+
$ tray-cdk share [CONNECTORNAME] [CONNECTORVERSION] [-e <value>]
|
|
226
226
|
|
|
227
227
|
ARGUMENTS
|
|
228
228
|
CONNECTORNAME The name of the connector
|
|
229
229
|
CONNECTORVERSION The version of the connector
|
|
230
230
|
|
|
231
231
|
FLAGS
|
|
232
|
-
-e, --email=<value>
|
|
233
|
-
-w, --workspaces=<value> Share with the emails of users in a workspace by providing a list of workspace IDs
|
|
232
|
+
-e, --email=<value> Share with users by providing a list of emails
|
|
234
233
|
|
|
235
234
|
DESCRIPTION
|
|
236
235
|
Share your connector version with other users in your organization
|
|
@@ -245,10 +244,6 @@ EXAMPLES
|
|
|
245
244
|
$ tray-cdk share my-connector 1.0 --email="my.email@domain.com, your.email@domain.com"
|
|
246
245
|
|
|
247
246
|
$ tray-cdk share my-connector 1.0 -e="my.email@domain.com, your.email@domain.com"
|
|
248
|
-
|
|
249
|
-
$ tray-cdk share my-connector 1.0 --workspace="<workspace-id>, <another-workspace-id>"
|
|
250
|
-
|
|
251
|
-
$ tray-cdk share my-connector 1.0 -w="<workspace-id>, <another-workspace-id>"
|
|
252
247
|
```
|
|
253
248
|
|
|
254
249
|
## `tray-cdk test [OPERATIONNAME]`
|
package/dist/commands/share.d.ts
CHANGED
|
@@ -8,7 +8,6 @@ export default class Share extends Command {
|
|
|
8
8
|
};
|
|
9
9
|
static flags: {
|
|
10
10
|
email: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
11
|
-
workspaces: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
12
11
|
};
|
|
13
12
|
private connectorPermissions;
|
|
14
13
|
run(): Promise<void>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"share.d.ts","sourceRoot":"","sources":["../../src/commands/share.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,OAAO,EAAa,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"share.d.ts","sourceRoot":"","sources":["../../src/commands/share.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,OAAO,EAAa,MAAM,aAAa,CAAC;AAWvD,MAAM,CAAC,OAAO,OAAO,KAAM,SAAQ,OAAO;IACzC,MAAM,CAAC,WAAW,SACoD;IAEtE,MAAM,CAAC,QAAQ,WAQb;IAEF,MAAM,CAAC,IAAI;;;MAWT;IAEF,MAAM,CAAC,KAAK;;MAYV;IAEF,OAAO,CAAC,oBAAoB,CAK1B;IAEW,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;YA4EnB,kBAAkB;YA+BlB,sBAAsB;IAoCpC,OAAO,CAAC,SAAS;IAOjB,OAAO,CAAC,eAAe;CAGvB"}
|
package/dist/commands/share.js
CHANGED
|
@@ -17,6 +17,10 @@ const inquirer_1 = __importDefault(require("inquirer"));
|
|
|
17
17
|
const AxiosHttpClient_1 = require("@trayio/axios/http/AxiosHttpClient");
|
|
18
18
|
const ConnectorPermissionsHttpClient_1 = require("@trayio/tray-client/connector/permissions/ConnectorPermissionsHttpClient");
|
|
19
19
|
const colorizeString_1 = require("../utils/colorizeString");
|
|
20
|
+
/*
|
|
21
|
+
* Note: the workspaces feature is commented due to security concerns
|
|
22
|
+
* We might want to revisit this in the future to implement it
|
|
23
|
+
*/
|
|
20
24
|
class Share extends core_1.Command {
|
|
21
25
|
constructor() {
|
|
22
26
|
super(...arguments);
|
|
@@ -41,47 +45,53 @@ class Share extends core_1.Command {
|
|
|
41
45
|
type: 'input',
|
|
42
46
|
when: !args.connectorVersion,
|
|
43
47
|
},
|
|
44
|
-
{
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
},
|
|
48
|
+
// {
|
|
49
|
+
// name: 'shareMethod',
|
|
50
|
+
// message: 'How would you like to share the connector?',
|
|
51
|
+
// type: 'list',
|
|
52
|
+
// choices: [{ name: 'email' }, { name: 'workspace' }],
|
|
53
|
+
// when: !flags.email && !flags.workspaces,
|
|
54
|
+
// },
|
|
51
55
|
]);
|
|
52
56
|
const shareTargetPrompt = yield inquirer_1.default.prompt([
|
|
53
57
|
{
|
|
54
58
|
name: 'emails',
|
|
55
59
|
message: 'Enter a comma separated list of emails to share the connector version with',
|
|
56
60
|
type: 'input',
|
|
57
|
-
when: !flags.email
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
},
|
|
61
|
-
{
|
|
62
|
-
name: 'workspaceIds',
|
|
63
|
-
message: 'Enter the workspace IDs to share the connector version with',
|
|
64
|
-
type: 'input',
|
|
65
|
-
when: !flags.email &&
|
|
66
|
-
!flags.workspaces &&
|
|
67
|
-
promptRes.shareMethod === 'workspace',
|
|
61
|
+
when: !flags.email,
|
|
62
|
+
// !flags.workspaces &&
|
|
63
|
+
// promptRes.shareMethod === 'email',
|
|
68
64
|
},
|
|
65
|
+
// {
|
|
66
|
+
// name: 'workspaceIds',
|
|
67
|
+
// message: 'Enter the workspace IDs to share the connector version with',
|
|
68
|
+
// type: 'input',
|
|
69
|
+
// when:
|
|
70
|
+
// !flags.email &&
|
|
71
|
+
// !flags.workspaces &&
|
|
72
|
+
// promptRes.shareMethod === 'workspace',
|
|
73
|
+
// },
|
|
69
74
|
]);
|
|
70
75
|
const connectorName = args.connectorName || promptRes.connectorName;
|
|
71
76
|
const connectorVersion = this.truncateVersion(args.connectorVersion || promptRes.connectorVersion);
|
|
72
77
|
const emails = flags.email || shareTargetPrompt.emails;
|
|
73
|
-
const workspaceIds = flags.workspaces || shareTargetPrompt.workspaceIds;
|
|
74
|
-
if (emails && workspaceIds) {
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
+
// const workspaceIds = flags.workspaces || shareTargetPrompt.workspaceIds;
|
|
79
|
+
// if (emails && workspaceIds) {
|
|
80
|
+
// this.log(
|
|
81
|
+
// error('Please provide either emails or workspace IDs, not both')
|
|
82
|
+
// );
|
|
83
|
+
if (emails) {
|
|
78
84
|
this.handleShareByEmail(connectorName, connectorVersion, TRAY_API_TOKEN, emails);
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
85
|
+
// } else if (workspaceIds && !emails) {
|
|
86
|
+
// this.handleShareByWorkspace(
|
|
87
|
+
// connectorName,
|
|
88
|
+
// connectorVersion,
|
|
89
|
+
// TRAY_API_TOKEN,
|
|
90
|
+
// workspaceIds
|
|
91
|
+
// );
|
|
82
92
|
}
|
|
83
93
|
else {
|
|
84
|
-
this.log((0, colorizeString_1.error)('Please provide
|
|
94
|
+
this.log((0, colorizeString_1.error)('Please provide at least 1 email.'));
|
|
85
95
|
}
|
|
86
96
|
});
|
|
87
97
|
}
|
|
@@ -145,8 +155,8 @@ Share.examples = [
|
|
|
145
155
|
'<%= config.bin %> <%= command.id %> my-connector 1.0',
|
|
146
156
|
'<%= config.bin %> <%= command.id %> my-connector 1.0 --email="my.email@domain.com, your.email@domain.com"',
|
|
147
157
|
'<%= config.bin %> <%= command.id %> my-connector 1.0 -e="my.email@domain.com, your.email@domain.com"',
|
|
148
|
-
'<%= config.bin %> <%= command.id %> my-connector 1.0 --workspace="<workspace-id>, <another-workspace-id>"',
|
|
149
|
-
'<%= config.bin %> <%= command.id %> my-connector 1.0 -w="<workspace-id>, <another-workspace-id>"',
|
|
158
|
+
// '<%= config.bin %> <%= command.id %> my-connector 1.0 --workspace="<workspace-id>, <another-workspace-id>"',
|
|
159
|
+
// '<%= config.bin %> <%= command.id %> my-connector 1.0 -w="<workspace-id>, <another-workspace-id>"',
|
|
150
160
|
];
|
|
151
161
|
Share.args = {
|
|
152
162
|
connectorName: core_1.Args.string({
|
|
@@ -166,10 +176,11 @@ Share.flags = {
|
|
|
166
176
|
aliases: ['emails', 'email'],
|
|
167
177
|
description: 'Share with users by providing a list of emails',
|
|
168
178
|
}),
|
|
169
|
-
workspaces:
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
179
|
+
// workspaces: Flags.string({
|
|
180
|
+
// char: 'w',
|
|
181
|
+
// aliases: ['workspaces', 'workspace'],
|
|
182
|
+
// description:
|
|
183
|
+
// 'Share with the emails of users in a workspace by providing a list of workspace IDs',
|
|
184
|
+
// }),
|
|
174
185
|
};
|
|
175
186
|
exports.default = Share;
|
|
@@ -87,33 +87,43 @@ describe('Share', () => {
|
|
|
87
87
|
expect(stdout_stderr_1.stdout.output).toEqual(expect.stringContaining('Connector Share By Email Failed, please try again or contact support'));
|
|
88
88
|
expect(stdout_stderr_1.stdout.output).toEqual(expect.stringContaining(`The connector (Left(some-connector-name~1.1)) was not found or you don't have permission to access it`));
|
|
89
89
|
}));
|
|
90
|
-
it('should log success message when connector is shared by workspaces and warn of empty workspaces', () =>
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
90
|
+
// it('should log success message when connector is shared by workspaces and warn of empty workspaces', async () => {
|
|
91
|
+
// success = true;
|
|
92
|
+
// stdout.start();
|
|
93
|
+
// await Share.run([
|
|
94
|
+
// connectorName,
|
|
95
|
+
// connectorVersion,
|
|
96
|
+
// `--workspaces='${workspaceIds}'`,
|
|
97
|
+
// ]);
|
|
98
|
+
// stdout.stop();
|
|
99
|
+
// expect(mockedShareWithWorkspacesSuccess).toHaveBeenCalledWith({
|
|
100
|
+
// connectorName,
|
|
101
|
+
// connectorVersion,
|
|
102
|
+
// workspaceIds: ['workspace-id', 'another-workspace-id'],
|
|
103
|
+
// token: process.env.TRAY_API_TOKEN,
|
|
104
|
+
// });
|
|
105
|
+
// expect(stdout.output).toEqual(
|
|
106
|
+
// expect.stringContaining('5 permissions added')
|
|
107
|
+
// );
|
|
108
|
+
// expect(stdout.output).toEqual(
|
|
109
|
+
// expect.stringContaining(
|
|
110
|
+
// 'No permissions to add for workspace: 9b31dc75-3217-458b-923a-8a48ff5b5e'
|
|
111
|
+
// )
|
|
112
|
+
// );
|
|
113
|
+
// });
|
|
114
|
+
// it('should log error message when connector share by workspaces fails', async () => {
|
|
115
|
+
// success = false;
|
|
116
|
+
// stdout.start();
|
|
117
|
+
// await Share.run([
|
|
118
|
+
// connectorName,
|
|
119
|
+
// connectorVersion,
|
|
120
|
+
// `--workspaces='${workspaceIds}'`,
|
|
121
|
+
// ]);
|
|
122
|
+
// stdout.stop();
|
|
123
|
+
// expect(stdout.output).toEqual(
|
|
124
|
+
// expect.stringContaining(
|
|
125
|
+
// `The connector (Left(some-connector-name~1.1)) was not found or you don't have permission to access it`
|
|
126
|
+
// )
|
|
127
|
+
// );
|
|
128
|
+
// });
|
|
119
129
|
});
|
package/oclif.manifest.json
CHANGED
|
@@ -213,9 +213,7 @@
|
|
|
213
213
|
"<%= config.bin %> <%= command.id %> my-connector",
|
|
214
214
|
"<%= config.bin %> <%= command.id %> my-connector 1.0",
|
|
215
215
|
"<%= config.bin %> <%= command.id %> my-connector 1.0 --email=\"my.email@domain.com, your.email@domain.com\"",
|
|
216
|
-
"<%= config.bin %> <%= command.id %> my-connector 1.0 -e=\"my.email@domain.com, your.email@domain.com\""
|
|
217
|
-
"<%= config.bin %> <%= command.id %> my-connector 1.0 --workspace=\"<workspace-id>, <another-workspace-id>\"",
|
|
218
|
-
"<%= config.bin %> <%= command.id %> my-connector 1.0 -w=\"<workspace-id>, <another-workspace-id>\""
|
|
216
|
+
"<%= config.bin %> <%= command.id %> my-connector 1.0 -e=\"my.email@domain.com, your.email@domain.com\""
|
|
219
217
|
],
|
|
220
218
|
"flags": {
|
|
221
219
|
"email": {
|
|
@@ -229,18 +227,6 @@
|
|
|
229
227
|
"hasDynamicHelp": false,
|
|
230
228
|
"multiple": false,
|
|
231
229
|
"type": "option"
|
|
232
|
-
},
|
|
233
|
-
"workspaces": {
|
|
234
|
-
"aliases": [
|
|
235
|
-
"workspaces",
|
|
236
|
-
"workspace"
|
|
237
|
-
],
|
|
238
|
-
"char": "w",
|
|
239
|
-
"description": "Share with the emails of users in a workspace by providing a list of workspace IDs",
|
|
240
|
-
"name": "workspaces",
|
|
241
|
-
"hasDynamicHelp": false,
|
|
242
|
-
"multiple": false,
|
|
243
|
-
"type": "option"
|
|
244
230
|
}
|
|
245
231
|
},
|
|
246
232
|
"hasDynamicHelp": false,
|
|
@@ -330,5 +316,5 @@
|
|
|
330
316
|
]
|
|
331
317
|
}
|
|
332
318
|
},
|
|
333
|
-
"version": "2.
|
|
319
|
+
"version": "2.22.0"
|
|
334
320
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@trayio/cdk-cli",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.22.0",
|
|
4
4
|
"description": "A CLI for connector development",
|
|
5
5
|
"exports": {
|
|
6
6
|
"./*": "./dist/*.js"
|
|
@@ -19,12 +19,12 @@
|
|
|
19
19
|
"@oclif/plugin-help": "6.0.12",
|
|
20
20
|
"@oclif/plugin-version": "2.0.11",
|
|
21
21
|
"@oclif/test": "3.1.12",
|
|
22
|
-
"@trayio/axios": "2.
|
|
23
|
-
"@trayio/cdk-build": "2.
|
|
24
|
-
"@trayio/commons": "2.
|
|
25
|
-
"@trayio/generator": "2.
|
|
26
|
-
"@trayio/tray-client": "2.
|
|
27
|
-
"@trayio/tray-openapi": "2.
|
|
22
|
+
"@trayio/axios": "2.22.0",
|
|
23
|
+
"@trayio/cdk-build": "2.22.0",
|
|
24
|
+
"@trayio/commons": "2.22.0",
|
|
25
|
+
"@trayio/generator": "2.22.0",
|
|
26
|
+
"@trayio/tray-client": "2.22.0",
|
|
27
|
+
"@trayio/tray-openapi": "2.22.0",
|
|
28
28
|
"@types/inquirer": "8.2.6",
|
|
29
29
|
"chalk": "4.1.2",
|
|
30
30
|
"inquirer": "8.2.5"
|