@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 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.21.0 linux-x64 node-v18.19.0
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>] [-w <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> Share with users by providing a list of emails
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]`
@@ -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;AAMvD,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;YA6EnB,kBAAkB;YA+BlB,sBAAsB;IAoCpC,OAAO,CAAC,SAAS;IAOjB,OAAO,CAAC,eAAe;CAGvB"}
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"}
@@ -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
- name: 'shareMethod',
46
- message: 'How would you like to share the connector?',
47
- type: 'list',
48
- choices: [{ name: 'email' }, { name: 'workspace' }],
49
- when: !flags.email && !flags.workspaces,
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
- !flags.workspaces &&
59
- promptRes.shareMethod === 'email',
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
- this.log((0, colorizeString_1.error)('Please provide either emails or workspace IDs, not both'));
76
- }
77
- else if (emails && !workspaceIds) {
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
- else if (workspaceIds && !emails) {
81
- this.handleShareByWorkspace(connectorName, connectorVersion, TRAY_API_TOKEN, workspaceIds);
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 either emails or workspace IDs'));
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: core_1.Flags.string({
170
- char: 'w',
171
- aliases: ['workspaces', 'workspace'],
172
- description: 'Share with the emails of users in a workspace by providing a list of workspace IDs',
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', () => __awaiter(void 0, void 0, void 0, function* () {
91
- success = true;
92
- stdout_stderr_1.stdout.start();
93
- yield share_1.default.run([
94
- connectorName,
95
- connectorVersion,
96
- `--workspaces='${workspaceIds}'`,
97
- ]);
98
- stdout_stderr_1.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_stderr_1.stdout.output).toEqual(expect.stringContaining('5 permissions added'));
106
- expect(stdout_stderr_1.stdout.output).toEqual(expect.stringContaining('No permissions to add for workspace: 9b31dc75-3217-458b-923a-8a48ff5b5e'));
107
- }));
108
- it('should log error message when connector share by workspaces fails', () => __awaiter(void 0, void 0, void 0, function* () {
109
- success = false;
110
- stdout_stderr_1.stdout.start();
111
- yield share_1.default.run([
112
- connectorName,
113
- connectorVersion,
114
- `--workspaces='${workspaceIds}'`,
115
- ]);
116
- stdout_stderr_1.stdout.stop();
117
- 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`));
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
  });
@@ -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.21.0"
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.21.0",
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.21.0",
23
- "@trayio/cdk-build": "2.21.0",
24
- "@trayio/commons": "2.21.0",
25
- "@trayio/generator": "2.21.0",
26
- "@trayio/tray-client": "2.21.0",
27
- "@trayio/tray-openapi": "2.21.0",
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"