@trayio/cdk-cli 4.76.0 → 4.78.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 +54 -1
- package/dist/commands/namespace/create.d.ts +17 -0
- package/dist/commands/namespace/create.d.ts.map +1 -0
- package/dist/commands/namespace/create.js +56 -0
- package/dist/commands/namespace/create.unit.test.d.ts +2 -0
- package/dist/commands/namespace/create.unit.test.d.ts.map +1 -0
- package/dist/commands/namespace/create.unit.test.js +66 -0
- package/dist/commands/namespace/get.d.ts +16 -0
- package/dist/commands/namespace/get.d.ts.map +1 -0
- package/dist/commands/namespace/get.js +51 -0
- package/dist/commands/namespace/get.unit.test.d.ts +2 -0
- package/dist/commands/namespace/get.unit.test.d.ts.map +1 -0
- package/dist/commands/namespace/get.unit.test.js +86 -0
- package/oclif.manifest.json +106 -1
- 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/4.
|
|
22
|
+
@trayio/cdk-cli/4.78.0 linux-x64 node-v18.20.7
|
|
23
23
|
$ tray-cdk --help [COMMAND]
|
|
24
24
|
USAGE
|
|
25
25
|
$ tray-cdk COMMAND
|
|
@@ -40,6 +40,8 @@ USAGE
|
|
|
40
40
|
* [`tray-cdk deployment create`](#tray-cdk-deployment-create)
|
|
41
41
|
* [`tray-cdk deployment get [CONNECTORNAME] [CONNECTORVERSION] [UUID]`](#tray-cdk-deployment-get-connectorname-connectorversion-uuid)
|
|
42
42
|
* [`tray-cdk help [COMMAND]`](#tray-cdk-help-command)
|
|
43
|
+
* [`tray-cdk namespace create ORGID NAMESPACE`](#tray-cdk-namespace-create-orgid-namespace)
|
|
44
|
+
* [`tray-cdk namespace get ORGID`](#tray-cdk-namespace-get-orgid)
|
|
43
45
|
* [`tray-cdk permissions add [CONNECTORNAME] [CONNECTORVERSION]`](#tray-cdk-permissions-add-connectorname-connectorversion)
|
|
44
46
|
* [`tray-cdk permissions list [CONNECTORNAME] [CONNECTORVERSION]`](#tray-cdk-permissions-list-connectorname-connectorversion)
|
|
45
47
|
* [`tray-cdk plugins`](#tray-cdk-plugins)
|
|
@@ -256,6 +258,57 @@ DESCRIPTION
|
|
|
256
258
|
|
|
257
259
|
_See code: [@oclif/plugin-help](https://github.com/oclif/plugin-help/blob/v6.0.21/src/commands/help.ts)_
|
|
258
260
|
|
|
261
|
+
## `tray-cdk namespace create ORGID NAMESPACE`
|
|
262
|
+
|
|
263
|
+
Creates a new connector namespace for your organization
|
|
264
|
+
|
|
265
|
+
```
|
|
266
|
+
USAGE
|
|
267
|
+
$ tray-cdk namespace create ORGID NAMESPACE [--us] [--eu] [--ap]
|
|
268
|
+
|
|
269
|
+
ARGUMENTS
|
|
270
|
+
ORGID The ID of the organization for which to create the namespace
|
|
271
|
+
NAMESPACE The name of the namespace to create
|
|
272
|
+
|
|
273
|
+
FLAGS
|
|
274
|
+
--ap Use the Tray APAC region
|
|
275
|
+
--eu Use the Tray EU region
|
|
276
|
+
--us Use the Tray US region
|
|
277
|
+
|
|
278
|
+
DESCRIPTION
|
|
279
|
+
Creates a new connector namespace for your organization
|
|
280
|
+
|
|
281
|
+
EXAMPLES
|
|
282
|
+
$ tray-cdk namespace create org-id namespace
|
|
283
|
+
|
|
284
|
+
$ tray-cdk namespace create org-id namespace --us
|
|
285
|
+
```
|
|
286
|
+
|
|
287
|
+
## `tray-cdk namespace get ORGID`
|
|
288
|
+
|
|
289
|
+
Retrieves the connector namespace for your organization, if one exists
|
|
290
|
+
|
|
291
|
+
```
|
|
292
|
+
USAGE
|
|
293
|
+
$ tray-cdk namespace get ORGID [--us] [--eu] [--ap]
|
|
294
|
+
|
|
295
|
+
ARGUMENTS
|
|
296
|
+
ORGID The ID of the organization you want to retrieve the namespace for
|
|
297
|
+
|
|
298
|
+
FLAGS
|
|
299
|
+
--ap Use the Tray APAC region
|
|
300
|
+
--eu Use the Tray EU region
|
|
301
|
+
--us Use the Tray US region
|
|
302
|
+
|
|
303
|
+
DESCRIPTION
|
|
304
|
+
Retrieves the connector namespace for your organization, if one exists
|
|
305
|
+
|
|
306
|
+
EXAMPLES
|
|
307
|
+
$ tray-cdk namespace get some-org-id
|
|
308
|
+
|
|
309
|
+
$ tray-cdk namespace get some-org-id --us
|
|
310
|
+
```
|
|
311
|
+
|
|
259
312
|
## `tray-cdk permissions add [CONNECTORNAME] [CONNECTORVERSION]`
|
|
260
313
|
|
|
261
314
|
Share your connector version with other users in your organization
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Command } from '@oclif/core';
|
|
2
|
+
export default class Create extends Command {
|
|
3
|
+
static description: string;
|
|
4
|
+
static args: {
|
|
5
|
+
orgId: import("@oclif/core/lib/interfaces").Arg<string, Record<string, unknown>>;
|
|
6
|
+
namespace: import("@oclif/core/lib/interfaces").Arg<string, Record<string, unknown>>;
|
|
7
|
+
};
|
|
8
|
+
static flags: {
|
|
9
|
+
us: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
10
|
+
eu: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
11
|
+
ap: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
12
|
+
};
|
|
13
|
+
static examples: string[];
|
|
14
|
+
private regionHandler;
|
|
15
|
+
run(): Promise<void>;
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=create.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create.d.ts","sourceRoot":"","sources":["../../../src/commands/namespace/create.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAmB,MAAM,aAAa,CAAC;AAQvD,MAAM,CAAC,OAAO,OAAO,MAAO,SAAQ,OAAO;IAC1C,MAAM,CAAC,WAAW,SACyC;IAE3D,MAAM,CAAC,IAAI;;;MAYT;IAEF,MAAM,CAAC,KAAK;;;;MAEV;IAEF,MAAM,CAAC,QAAQ,WAGb;IAEF,OAAO,CAAC,aAAa,CAGnB;IAEI,GAAG;CAgDT"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const core_1 = require("@oclif/core");
|
|
4
|
+
const ConnectorNamespaceHttpClient_1 = require("@trayio/tray-client/connector/namespace/ConnectorNamespaceHttpClient");
|
|
5
|
+
const AxiosHttpClient_1 = require("@trayio/axios/http/AxiosHttpClient");
|
|
6
|
+
const region_1 = require("../../utils/region");
|
|
7
|
+
const colorizeString_1 = require("../../utils/colorizeString");
|
|
8
|
+
const check_env_1 = require("../../utils/check-env");
|
|
9
|
+
class Create extends core_1.Command {
|
|
10
|
+
static description = 'Creates a new connector namespace for your organization';
|
|
11
|
+
static args = {
|
|
12
|
+
orgId: core_1.Args.string({
|
|
13
|
+
name: 'Organization ID',
|
|
14
|
+
required: true,
|
|
15
|
+
description: 'The ID of the organization for which to create the namespace',
|
|
16
|
+
}),
|
|
17
|
+
namespace: core_1.Args.string({
|
|
18
|
+
name: 'Namespace',
|
|
19
|
+
required: true,
|
|
20
|
+
description: 'The name of the namespace to create',
|
|
21
|
+
}),
|
|
22
|
+
};
|
|
23
|
+
static flags = {
|
|
24
|
+
...region_1.regionFlags,
|
|
25
|
+
};
|
|
26
|
+
static examples = [
|
|
27
|
+
`<%= config.bin %> <%= command.id %> org-id namespace`,
|
|
28
|
+
`<%= config.bin %> <%= command.id %> org-id namespace --us`,
|
|
29
|
+
];
|
|
30
|
+
regionHandler = new region_1.RegionHandler(ConnectorNamespaceHttpClient_1.ConnectorNamespaceHttpClient, new AxiosHttpClient_1.AxiosHttpClient());
|
|
31
|
+
async run() {
|
|
32
|
+
const { args, flags } = await this.parse(Create);
|
|
33
|
+
const { orgId, namespace } = args;
|
|
34
|
+
(0, check_env_1.checkTokenEnv)();
|
|
35
|
+
const input = {
|
|
36
|
+
organizationId: orgId,
|
|
37
|
+
namespace,
|
|
38
|
+
token: process.env.TRAY_API_TOKEN,
|
|
39
|
+
};
|
|
40
|
+
core_1.ux.action.start(`Creating namespace...`);
|
|
41
|
+
const response = await this.regionHandler.invoke(flags).create(input);
|
|
42
|
+
core_1.ux.action.stop();
|
|
43
|
+
if (response.isSuccess) {
|
|
44
|
+
this.log((0, colorizeString_1.success)(`Namespace Added!\nOrganization: ${(0, colorizeString_1.info)(orgId)}\nNamespace: ${(0, colorizeString_1.info)(namespace)}`));
|
|
45
|
+
}
|
|
46
|
+
if (response.isFailure) {
|
|
47
|
+
if (response.error.message.includes('is already associated with a namespace')) {
|
|
48
|
+
this.log((0, colorizeString_1.error)(`A namespace already exists for organization '${orgId}', use the 'get' command to retrieve it.\n${(0, colorizeString_1.info)('If you would like to update your namespace, please contact Tray support.')}`));
|
|
49
|
+
}
|
|
50
|
+
else {
|
|
51
|
+
this.log((0, colorizeString_1.error)(`Failed to create namespace: ${response.error.message}`));
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
exports.default = Create;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create.unit.test.d.ts","sourceRoot":"","sources":["../../../src/commands/namespace/create.unit.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const stdout_stderr_1 = require("stdout-stderr");
|
|
7
|
+
const ConnectorNamespaceHttpClient_1 = require("@trayio/tray-client/connector/namespace/ConnectorNamespaceHttpClient");
|
|
8
|
+
const create_1 = __importDefault(require("./create"));
|
|
9
|
+
jest.mock('@trayio/tray-client/connector/namespace/ConnectorNamespaceHttpClient', () => ({
|
|
10
|
+
ConnectorNamespaceHttpClient: jest.fn(),
|
|
11
|
+
}));
|
|
12
|
+
describe('CreateNamespace', () => {
|
|
13
|
+
let success = true;
|
|
14
|
+
let failure = false;
|
|
15
|
+
let namespaceExists = false;
|
|
16
|
+
const orgId = 'some-org-id';
|
|
17
|
+
const namespace = 'some-namespace';
|
|
18
|
+
beforeEach(() => {
|
|
19
|
+
success = true;
|
|
20
|
+
failure = false;
|
|
21
|
+
ConnectorNamespaceHttpClient_1.ConnectorNamespaceHttpClient.mockImplementation(() => ({
|
|
22
|
+
create: jest.fn().mockReturnValue({
|
|
23
|
+
isSuccess: success,
|
|
24
|
+
...(success && {
|
|
25
|
+
value: {
|
|
26
|
+
namespace,
|
|
27
|
+
},
|
|
28
|
+
}),
|
|
29
|
+
isFailure: failure,
|
|
30
|
+
...(failure && {
|
|
31
|
+
error: {
|
|
32
|
+
message: namespaceExists
|
|
33
|
+
? 'Organization org-id is already associated with a namespace: namespace'
|
|
34
|
+
: 'There was an error creating the namespace',
|
|
35
|
+
},
|
|
36
|
+
}),
|
|
37
|
+
}),
|
|
38
|
+
}));
|
|
39
|
+
});
|
|
40
|
+
afterAll(() => {
|
|
41
|
+
jest.clearAllMocks();
|
|
42
|
+
});
|
|
43
|
+
it('should log success message when namespace is created', async () => {
|
|
44
|
+
stdout_stderr_1.stdout.start();
|
|
45
|
+
await create_1.default.run([orgId, namespace]);
|
|
46
|
+
stdout_stderr_1.stdout.stop();
|
|
47
|
+
expect(stdout_stderr_1.stdout.output).toEqual(expect.stringContaining(`Namespace Added!\nOrganization: ${orgId}\nNamespace: ${namespace}`));
|
|
48
|
+
});
|
|
49
|
+
it('should log error message when namespace creation fails', async () => {
|
|
50
|
+
success = false;
|
|
51
|
+
failure = true;
|
|
52
|
+
stdout_stderr_1.stdout.start();
|
|
53
|
+
await create_1.default.run([orgId, namespace]);
|
|
54
|
+
stdout_stderr_1.stdout.stop();
|
|
55
|
+
expect(stdout_stderr_1.stdout.output).toEqual(expect.stringContaining('Failed to create namespace: There was an error creating the namespace'));
|
|
56
|
+
});
|
|
57
|
+
it('should log error message when namespace already exists', async () => {
|
|
58
|
+
success = false;
|
|
59
|
+
failure = true;
|
|
60
|
+
namespaceExists = true;
|
|
61
|
+
stdout_stderr_1.stdout.start();
|
|
62
|
+
await create_1.default.run([orgId, namespace]);
|
|
63
|
+
stdout_stderr_1.stdout.stop();
|
|
64
|
+
expect(stdout_stderr_1.stdout.output).toEqual(expect.stringContaining(`A namespace already exists for organization '${orgId}', use the 'get' command to retrieve it.\nIf you would like to update your namespace, please contact Tray support.`));
|
|
65
|
+
});
|
|
66
|
+
});
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Command } from '@oclif/core';
|
|
2
|
+
export default class Get extends Command {
|
|
3
|
+
static description: string;
|
|
4
|
+
static args: {
|
|
5
|
+
orgId: import("@oclif/core/lib/interfaces").Arg<string, Record<string, unknown>>;
|
|
6
|
+
};
|
|
7
|
+
static flags: {
|
|
8
|
+
us: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
9
|
+
eu: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
10
|
+
ap: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
11
|
+
};
|
|
12
|
+
static examples: string[];
|
|
13
|
+
private regionHandler;
|
|
14
|
+
run(): Promise<void>;
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=get.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get.d.ts","sourceRoot":"","sources":["../../../src/commands/namespace/get.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAmB,MAAM,aAAa,CAAC;AASvD,MAAM,CAAC,OAAO,OAAO,GAAI,SAAQ,OAAO;IACvC,MAAM,CAAC,WAAW,SACwD;IAE1E,MAAM,CAAC,IAAI;;MAOT;IAEF,MAAM,CAAC,KAAK;;;;MAEV;IAEF,MAAM,CAAC,QAAQ,WAGb;IAEF,OAAO,CAAC,aAAa,CAGnB;IAEI,GAAG;CA6CT"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const core_1 = require("@oclif/core");
|
|
4
|
+
const AxiosHttpClient_1 = require("@trayio/axios/http/AxiosHttpClient");
|
|
5
|
+
const ConnectorNamespaceHttpClient_1 = require("@trayio/tray-client/connector/namespace/ConnectorNamespaceHttpClient");
|
|
6
|
+
const region_1 = require("../../utils/region");
|
|
7
|
+
const colorizeString_1 = require("../../utils/colorizeString");
|
|
8
|
+
const check_env_1 = require("../../utils/check-env");
|
|
9
|
+
class Get extends core_1.Command {
|
|
10
|
+
static description = 'Retrieves the connector namespace for your organization, if one exists';
|
|
11
|
+
static args = {
|
|
12
|
+
orgId: core_1.Args.string({
|
|
13
|
+
name: 'Organization ID',
|
|
14
|
+
required: true,
|
|
15
|
+
description: 'The ID of the organization you want to retrieve the namespace for',
|
|
16
|
+
}),
|
|
17
|
+
};
|
|
18
|
+
static flags = {
|
|
19
|
+
...region_1.regionFlags,
|
|
20
|
+
};
|
|
21
|
+
static examples = [
|
|
22
|
+
`<%= config.bin %> <%= command.id %> some-org-id`,
|
|
23
|
+
`<%= config.bin %> <%= command.id %> some-org-id --us`,
|
|
24
|
+
];
|
|
25
|
+
regionHandler = new region_1.RegionHandler(ConnectorNamespaceHttpClient_1.ConnectorNamespaceHttpClient, new AxiosHttpClient_1.AxiosHttpClient());
|
|
26
|
+
async run() {
|
|
27
|
+
(0, check_env_1.checkTokenEnv)();
|
|
28
|
+
const { args, flags } = await this.parse(Get);
|
|
29
|
+
const TRAY_API_TOKEN = process.env.TRAY_API_TOKEN;
|
|
30
|
+
const input = {
|
|
31
|
+
organizationId: args.orgId,
|
|
32
|
+
token: TRAY_API_TOKEN,
|
|
33
|
+
};
|
|
34
|
+
core_1.ux.action.start(`Fetching namespace...`);
|
|
35
|
+
const response = await this.regionHandler.invoke(flags).get(input);
|
|
36
|
+
core_1.ux.action.stop();
|
|
37
|
+
if (response.isSuccess) {
|
|
38
|
+
this.log((0, colorizeString_1.success)(`Organization: ${(0, colorizeString_1.info)(args.orgId)}\nNamespace: ${(0, colorizeString_1.info)(response.value.namespace)}`));
|
|
39
|
+
}
|
|
40
|
+
if (response.isFailure) {
|
|
41
|
+
if (response.error.message.includes('Could not find namespace')) {
|
|
42
|
+
this.log((0, colorizeString_1.error)(`Namespace could not be found for organization: ${(0, colorizeString_1.info)(args.orgId)}`));
|
|
43
|
+
}
|
|
44
|
+
else {
|
|
45
|
+
this.log((0, colorizeString_1.error)(`There was an error retrieving the namespace, please try again or contact support`));
|
|
46
|
+
this.log(response.error.message);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
exports.default = Get;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get.unit.test.d.ts","sourceRoot":"","sources":["../../../src/commands/namespace/get.unit.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const stdout_stderr_1 = require("stdout-stderr");
|
|
7
|
+
const ConnectorNamespaceHttpClient_1 = require("@trayio/tray-client/connector/namespace/ConnectorNamespaceHttpClient");
|
|
8
|
+
const get_1 = __importDefault(require("./get"));
|
|
9
|
+
jest.mock('@trayio/tray-client/connector/namespace/ConnectorNamespaceHttpClient', () => ({
|
|
10
|
+
ConnectorNamespaceHttpClient: jest.fn(),
|
|
11
|
+
}));
|
|
12
|
+
describe('GetNamespace', () => {
|
|
13
|
+
let success = true;
|
|
14
|
+
let failure = false;
|
|
15
|
+
let notFound = false;
|
|
16
|
+
const orgId = 'some-org-id';
|
|
17
|
+
const namespace = 'some-namespace';
|
|
18
|
+
beforeEach(() => {
|
|
19
|
+
success = true;
|
|
20
|
+
failure = false;
|
|
21
|
+
notFound = false;
|
|
22
|
+
ConnectorNamespaceHttpClient_1.ConnectorNamespaceHttpClient.mockImplementation(() => ({
|
|
23
|
+
get: jest.fn().mockReturnValue({
|
|
24
|
+
isSuccess: success,
|
|
25
|
+
...(success && {
|
|
26
|
+
value: {
|
|
27
|
+
namespace,
|
|
28
|
+
},
|
|
29
|
+
}),
|
|
30
|
+
isFailure: failure,
|
|
31
|
+
...(failure && {
|
|
32
|
+
error: {
|
|
33
|
+
message: notFound
|
|
34
|
+
? 'Could not find namespace'
|
|
35
|
+
: 'There was an error retrieving the namespace',
|
|
36
|
+
},
|
|
37
|
+
}),
|
|
38
|
+
}),
|
|
39
|
+
}));
|
|
40
|
+
});
|
|
41
|
+
afterAll(() => {
|
|
42
|
+
jest.clearAllMocks();
|
|
43
|
+
});
|
|
44
|
+
it('should log success message when namespace is retrieved', async () => {
|
|
45
|
+
stdout_stderr_1.stdout.start();
|
|
46
|
+
await get_1.default.run([orgId]);
|
|
47
|
+
stdout_stderr_1.stdout.stop();
|
|
48
|
+
expect(stdout_stderr_1.stdout.output).toEqual(expect.stringContaining(`Organization: ${orgId}\nNamespace: ${namespace}`));
|
|
49
|
+
});
|
|
50
|
+
it('should log error message when namespace retrieval fails', async () => {
|
|
51
|
+
success = false;
|
|
52
|
+
failure = true;
|
|
53
|
+
stdout_stderr_1.stdout.start();
|
|
54
|
+
await get_1.default.run([orgId]);
|
|
55
|
+
stdout_stderr_1.stdout.stop();
|
|
56
|
+
expect(stdout_stderr_1.stdout.output).toEqual(expect.stringContaining('There was an error retrieving the namespace, please try again or contact support'));
|
|
57
|
+
expect(stdout_stderr_1.stdout.output).toEqual(expect.stringContaining('There was an error retrieving the namespace'));
|
|
58
|
+
});
|
|
59
|
+
it('should log error message when namespace could not be found', async () => {
|
|
60
|
+
success = false;
|
|
61
|
+
failure = true;
|
|
62
|
+
notFound = true;
|
|
63
|
+
stdout_stderr_1.stdout.start();
|
|
64
|
+
await get_1.default.run([orgId]);
|
|
65
|
+
stdout_stderr_1.stdout.stop();
|
|
66
|
+
expect(stdout_stderr_1.stdout.output).toEqual(expect.stringContaining(`Namespace could not be found for organization: ${orgId}`));
|
|
67
|
+
});
|
|
68
|
+
it('should set baseUrl based on region flag', async () => {
|
|
69
|
+
await get_1.default.run([orgId]);
|
|
70
|
+
expect(ConnectorNamespaceHttpClient_1.ConnectorNamespaceHttpClient).toHaveBeenCalledWith({
|
|
71
|
+
baseUrl: 'https://api.tray.io',
|
|
72
|
+
}, expect.anything());
|
|
73
|
+
await get_1.default.run([orgId, '--us']);
|
|
74
|
+
expect(ConnectorNamespaceHttpClient_1.ConnectorNamespaceHttpClient).toHaveBeenCalledWith({
|
|
75
|
+
baseUrl: 'https://api.tray.io',
|
|
76
|
+
}, expect.anything());
|
|
77
|
+
await get_1.default.run([orgId, '--eu']);
|
|
78
|
+
expect(ConnectorNamespaceHttpClient_1.ConnectorNamespaceHttpClient).toHaveBeenCalledWith({
|
|
79
|
+
baseUrl: 'https://api.eu1.tray.io',
|
|
80
|
+
}, expect.anything());
|
|
81
|
+
await get_1.default.run([orgId, '--ap']);
|
|
82
|
+
expect(ConnectorNamespaceHttpClient_1.ConnectorNamespaceHttpClient).toHaveBeenCalledWith({
|
|
83
|
+
baseUrl: 'https://api.ap1.tray.io',
|
|
84
|
+
}, expect.anything());
|
|
85
|
+
});
|
|
86
|
+
});
|
package/oclif.manifest.json
CHANGED
|
@@ -303,6 +303,111 @@
|
|
|
303
303
|
"get.js"
|
|
304
304
|
]
|
|
305
305
|
},
|
|
306
|
+
"namespace:create": {
|
|
307
|
+
"aliases": [],
|
|
308
|
+
"args": {
|
|
309
|
+
"orgId": {
|
|
310
|
+
"description": "The ID of the organization for which to create the namespace",
|
|
311
|
+
"name": "orgId",
|
|
312
|
+
"required": true
|
|
313
|
+
},
|
|
314
|
+
"namespace": {
|
|
315
|
+
"description": "The name of the namespace to create",
|
|
316
|
+
"name": "namespace",
|
|
317
|
+
"required": true
|
|
318
|
+
}
|
|
319
|
+
},
|
|
320
|
+
"description": "Creates a new connector namespace for your organization",
|
|
321
|
+
"examples": [
|
|
322
|
+
"<%= config.bin %> <%= command.id %> org-id namespace",
|
|
323
|
+
"<%= config.bin %> <%= command.id %> org-id namespace --us"
|
|
324
|
+
],
|
|
325
|
+
"flags": {
|
|
326
|
+
"us": {
|
|
327
|
+
"description": "Use the Tray US region",
|
|
328
|
+
"name": "us",
|
|
329
|
+
"allowNo": false,
|
|
330
|
+
"type": "boolean"
|
|
331
|
+
},
|
|
332
|
+
"eu": {
|
|
333
|
+
"description": "Use the Tray EU region",
|
|
334
|
+
"name": "eu",
|
|
335
|
+
"allowNo": false,
|
|
336
|
+
"type": "boolean"
|
|
337
|
+
},
|
|
338
|
+
"ap": {
|
|
339
|
+
"description": "Use the Tray APAC region",
|
|
340
|
+
"name": "ap",
|
|
341
|
+
"allowNo": false,
|
|
342
|
+
"type": "boolean"
|
|
343
|
+
}
|
|
344
|
+
},
|
|
345
|
+
"hasDynamicHelp": false,
|
|
346
|
+
"hiddenAliases": [],
|
|
347
|
+
"id": "namespace:create",
|
|
348
|
+
"pluginAlias": "@trayio/cdk-cli",
|
|
349
|
+
"pluginName": "@trayio/cdk-cli",
|
|
350
|
+
"pluginType": "core",
|
|
351
|
+
"strict": true,
|
|
352
|
+
"enableJsonFlag": false,
|
|
353
|
+
"isESM": false,
|
|
354
|
+
"relativePath": [
|
|
355
|
+
"dist",
|
|
356
|
+
"commands",
|
|
357
|
+
"namespace",
|
|
358
|
+
"create.js"
|
|
359
|
+
]
|
|
360
|
+
},
|
|
361
|
+
"namespace:get": {
|
|
362
|
+
"aliases": [],
|
|
363
|
+
"args": {
|
|
364
|
+
"orgId": {
|
|
365
|
+
"description": "The ID of the organization you want to retrieve the namespace for",
|
|
366
|
+
"name": "orgId",
|
|
367
|
+
"required": true
|
|
368
|
+
}
|
|
369
|
+
},
|
|
370
|
+
"description": "Retrieves the connector namespace for your organization, if one exists",
|
|
371
|
+
"examples": [
|
|
372
|
+
"<%= config.bin %> <%= command.id %> some-org-id",
|
|
373
|
+
"<%= config.bin %> <%= command.id %> some-org-id --us"
|
|
374
|
+
],
|
|
375
|
+
"flags": {
|
|
376
|
+
"us": {
|
|
377
|
+
"description": "Use the Tray US region",
|
|
378
|
+
"name": "us",
|
|
379
|
+
"allowNo": false,
|
|
380
|
+
"type": "boolean"
|
|
381
|
+
},
|
|
382
|
+
"eu": {
|
|
383
|
+
"description": "Use the Tray EU region",
|
|
384
|
+
"name": "eu",
|
|
385
|
+
"allowNo": false,
|
|
386
|
+
"type": "boolean"
|
|
387
|
+
},
|
|
388
|
+
"ap": {
|
|
389
|
+
"description": "Use the Tray APAC region",
|
|
390
|
+
"name": "ap",
|
|
391
|
+
"allowNo": false,
|
|
392
|
+
"type": "boolean"
|
|
393
|
+
}
|
|
394
|
+
},
|
|
395
|
+
"hasDynamicHelp": false,
|
|
396
|
+
"hiddenAliases": [],
|
|
397
|
+
"id": "namespace:get",
|
|
398
|
+
"pluginAlias": "@trayio/cdk-cli",
|
|
399
|
+
"pluginName": "@trayio/cdk-cli",
|
|
400
|
+
"pluginType": "core",
|
|
401
|
+
"strict": true,
|
|
402
|
+
"enableJsonFlag": false,
|
|
403
|
+
"isESM": false,
|
|
404
|
+
"relativePath": [
|
|
405
|
+
"dist",
|
|
406
|
+
"commands",
|
|
407
|
+
"namespace",
|
|
408
|
+
"get.js"
|
|
409
|
+
]
|
|
410
|
+
},
|
|
306
411
|
"permissions:add": {
|
|
307
412
|
"aliases": [],
|
|
308
413
|
"args": {
|
|
@@ -430,5 +535,5 @@
|
|
|
430
535
|
]
|
|
431
536
|
}
|
|
432
537
|
},
|
|
433
|
-
"version": "4.
|
|
538
|
+
"version": "4.78.0"
|
|
434
539
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@trayio/cdk-cli",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.78.0",
|
|
4
4
|
"description": "A CLI for connector development",
|
|
5
5
|
"exports": {
|
|
6
6
|
"./*": "./dist/*.js"
|
|
@@ -22,12 +22,12 @@
|
|
|
22
22
|
"@oclif/plugin-version": "2.0.11",
|
|
23
23
|
"@oclif/plugin-warn-if-update-available": "^3.1.4",
|
|
24
24
|
"@oclif/test": "3.1.12",
|
|
25
|
-
"@trayio/axios": "4.
|
|
26
|
-
"@trayio/cdk-build": "4.
|
|
27
|
-
"@trayio/commons": "4.
|
|
28
|
-
"@trayio/generator": "4.
|
|
29
|
-
"@trayio/tray-client": "4.
|
|
30
|
-
"@trayio/tray-openapi": "4.
|
|
25
|
+
"@trayio/axios": "4.78.0",
|
|
26
|
+
"@trayio/cdk-build": "4.78.0",
|
|
27
|
+
"@trayio/commons": "4.78.0",
|
|
28
|
+
"@trayio/generator": "4.78.0",
|
|
29
|
+
"@trayio/tray-client": "4.78.0",
|
|
30
|
+
"@trayio/tray-openapi": "4.78.0",
|
|
31
31
|
"chalk": "4.1.2",
|
|
32
32
|
"inquirer": "8.2.6"
|
|
33
33
|
},
|