@trayio/cdk-cli 4.19.0 → 4.21.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/4.
|
|
22
|
+
@trayio/cdk-cli/4.21.0 linux-x64 node-v18.20.3
|
|
23
23
|
$ tray-cdk --help [COMMAND]
|
|
24
24
|
USAGE
|
|
25
25
|
$ tray-cdk COMMAND
|
|
@@ -52,6 +52,7 @@ USAGE
|
|
|
52
52
|
* [`tray-cdk plugins uninstall [PLUGIN]`](#tray-cdk-plugins-uninstall-plugin)
|
|
53
53
|
* [`tray-cdk plugins unlink [PLUGIN]`](#tray-cdk-plugins-unlink-plugin)
|
|
54
54
|
* [`tray-cdk plugins update`](#tray-cdk-plugins-update)
|
|
55
|
+
* [`tray-cdk update [CHANNEL]`](#tray-cdk-update-channel)
|
|
55
56
|
* [`tray-cdk version`](#tray-cdk-version)
|
|
56
57
|
|
|
57
58
|
## `tray-cdk .`
|
|
@@ -605,6 +606,43 @@ DESCRIPTION
|
|
|
605
606
|
|
|
606
607
|
_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.0.11/src/commands/plugins/update.ts)_
|
|
607
608
|
|
|
609
|
+
## `tray-cdk update [CHANNEL]`
|
|
610
|
+
|
|
611
|
+
update the tray-cdk CLI
|
|
612
|
+
|
|
613
|
+
```
|
|
614
|
+
USAGE
|
|
615
|
+
$ tray-cdk update [CHANNEL] [-a] [--force] [-i | -v <value>]
|
|
616
|
+
|
|
617
|
+
FLAGS
|
|
618
|
+
-a, --available See available versions.
|
|
619
|
+
-i, --interactive Interactively select version to install. This is ignored if a channel is provided.
|
|
620
|
+
-v, --version=<value> Install a specific version.
|
|
621
|
+
--force Force a re-download of the requested version.
|
|
622
|
+
|
|
623
|
+
DESCRIPTION
|
|
624
|
+
update the tray-cdk CLI
|
|
625
|
+
|
|
626
|
+
EXAMPLES
|
|
627
|
+
Update to the stable channel:
|
|
628
|
+
|
|
629
|
+
$ tray-cdk update stable
|
|
630
|
+
|
|
631
|
+
Update to a specific version:
|
|
632
|
+
|
|
633
|
+
$ tray-cdk update --version 1.0.0
|
|
634
|
+
|
|
635
|
+
Interactively select version:
|
|
636
|
+
|
|
637
|
+
$ tray-cdk update --interactive
|
|
638
|
+
|
|
639
|
+
See available versions:
|
|
640
|
+
|
|
641
|
+
$ tray-cdk update --available
|
|
642
|
+
```
|
|
643
|
+
|
|
644
|
+
_See code: [@oclif/plugin-update](https://github.com/oclif/plugin-update/blob/v4.3.3/src/commands/update.ts)_
|
|
645
|
+
|
|
608
646
|
## `tray-cdk version`
|
|
609
647
|
|
|
610
648
|
```
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get.d.ts","sourceRoot":"","sources":["../../../src/commands/deployment/get.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAmB,MAAM,aAAa,CAAC;AAiBvD,MAAM,CAAC,OAAO,OAAO,GAAI,SAAQ,OAAO;IACvC,MAAM,CAAC,WAAW,SAAoD;IAEtE,MAAM,CAAC,IAAI;;;;MAiBT;IAEF,MAAM,CAAC,KAAK;;;;;MAOV;IAEF,MAAM,CAAC,QAAQ,WAUb;IAEF,OAAO,CAAC,aAAa,CAGnB;IAEF,OAAO,CAAC,6BAA6B,
|
|
1
|
+
{"version":3,"file":"get.d.ts","sourceRoot":"","sources":["../../../src/commands/deployment/get.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAmB,MAAM,aAAa,CAAC;AAiBvD,MAAM,CAAC,OAAO,OAAO,GAAI,SAAQ,OAAO;IACvC,MAAM,CAAC,WAAW,SAAoD;IAEtE,MAAM,CAAC,IAAI;;;;MAiBT;IAEF,MAAM,CAAC,KAAK;;;;;MAOV;IAEF,MAAM,CAAC,QAAQ,WAUb;IAEF,OAAO,CAAC,aAAa,CAGnB;IAEF,OAAO,CAAC,6BAA6B,CAgCnC;IAEF,OAAO,CAAC,qBAAqB,CAe3B;IAEI,GAAG;CAiGT"}
|
|
@@ -29,7 +29,6 @@ const fse = __importStar(require("fs-extra"));
|
|
|
29
29
|
const AxiosHttpClient_1 = require("@trayio/axios/http/AxiosHttpClient");
|
|
30
30
|
const ConnectorDeploymentHttpClient_1 = require("@trayio/tray-client/connector/deployment/ConnectorDeploymentHttpClient");
|
|
31
31
|
const ConnectorDeploymentApi_1 = require("@trayio/tray-api/connector/deployment/ConnectorDeploymentApi");
|
|
32
|
-
const uuid_1 = require("uuid");
|
|
33
32
|
const region_1 = require("../../utils/region");
|
|
34
33
|
const colorizeString_1 = require("../../utils/colorizeString");
|
|
35
34
|
const check_env_1 = require("../../utils/check-env");
|
|
@@ -71,7 +70,6 @@ class Get extends core_1.Command {
|
|
|
71
70
|
`<%= config.bin %> <%= command.id %> my-connector 1.0 3f1de598-d405-4801-9eec-6fe79e8393d3 -t`,
|
|
72
71
|
];
|
|
73
72
|
regionHandler = new region_1.RegionHandler(ConnectorDeploymentHttpClient_1.ConnectorDeploymentHttpClient, new AxiosHttpClient_1.AxiosHttpClient());
|
|
74
|
-
generateConnectorDeploymentId = (connectorName, connectorVersion) => (0, uuid_1.v5)(`${connectorName}-${connectorVersion}`, uuid_1.v5.URL);
|
|
75
73
|
pollConnectorDeploymentStatus = async (connectorName, connectorVersion, id, token, flags) => {
|
|
76
74
|
const input = {
|
|
77
75
|
connectorName,
|
|
@@ -117,8 +115,8 @@ class Get extends core_1.Command {
|
|
|
117
115
|
const input = {
|
|
118
116
|
connectorName: args.connectorName,
|
|
119
117
|
connectorVersion: args.connectorVersion,
|
|
120
|
-
|
|
121
|
-
|
|
118
|
+
// TODO: we'll need to require the id once we enable queued deployments
|
|
119
|
+
id: args.uuid || '',
|
|
122
120
|
token: TRAY_API_TOKEN,
|
|
123
121
|
};
|
|
124
122
|
let response;
|
|
@@ -133,6 +131,12 @@ class Get extends core_1.Command {
|
|
|
133
131
|
core_1.ux.action.stop();
|
|
134
132
|
if (response.isSuccess) {
|
|
135
133
|
switch (response.value.deploymentStatus) {
|
|
134
|
+
case ConnectorDeploymentApi_1.ConnectorDeploymentStatus.Building:
|
|
135
|
+
this.log((0, colorizeString_1.info)(`Connector is currently being built, this could take a few minutes. Please check the connector status again later.`));
|
|
136
|
+
break;
|
|
137
|
+
case ConnectorDeploymentApi_1.ConnectorDeploymentStatus.BuildFailed:
|
|
138
|
+
this.log((0, colorizeString_1.error)(`Connector Build Failed, please try again or contact support`));
|
|
139
|
+
break;
|
|
136
140
|
case ConnectorDeploymentApi_1.ConnectorDeploymentStatus.Deploying:
|
|
137
141
|
this.log((0, colorizeString_1.info)(`Connector is currently being deployed, this could take a few minutes. Please check the connector status again later.`));
|
|
138
142
|
break;
|
|
@@ -148,7 +152,7 @@ class Get extends core_1.Command {
|
|
|
148
152
|
}
|
|
149
153
|
}
|
|
150
154
|
if (response.isFailure) {
|
|
151
|
-
this.log((0, colorizeString_1.error)(`
|
|
155
|
+
this.log((0, colorizeString_1.error)(`There was an error checking the deployment status, please try again or contact support`));
|
|
152
156
|
this.log(response.error.message);
|
|
153
157
|
}
|
|
154
158
|
}
|
|
@@ -47,6 +47,24 @@ describe('GetDeploymentStatus', () => {
|
|
|
47
47
|
afterAll(() => {
|
|
48
48
|
jest.clearAllMocks();
|
|
49
49
|
});
|
|
50
|
+
it('should log success message when connector is building', async () => {
|
|
51
|
+
status = ConnectorDeploymentApi_1.ConnectorDeploymentStatus.Building;
|
|
52
|
+
const uxStartSpy = jest.spyOn(core_1.ux.action, 'start');
|
|
53
|
+
stdout_stderr_1.stdout.start();
|
|
54
|
+
await get_1.default.run([connectorName, connectorVersion, uuid]);
|
|
55
|
+
stdout_stderr_1.stdout.stop();
|
|
56
|
+
expect(uxStartSpy).toHaveBeenCalledWith(`Checking the connector deployment status`);
|
|
57
|
+
expect(stdout_stderr_1.stdout.output).toEqual(expect.stringContaining('Connector is currently being built, this could take a few minutes. Please check the connector status again later.'));
|
|
58
|
+
});
|
|
59
|
+
it('should log failed message when connector fails to build', async () => {
|
|
60
|
+
status = ConnectorDeploymentApi_1.ConnectorDeploymentStatus.BuildFailed;
|
|
61
|
+
const uxStartSpy = jest.spyOn(core_1.ux.action, 'start');
|
|
62
|
+
stdout_stderr_1.stdout.start();
|
|
63
|
+
await get_1.default.run([connectorName, connectorVersion, uuid]);
|
|
64
|
+
stdout_stderr_1.stdout.stop();
|
|
65
|
+
expect(uxStartSpy).toHaveBeenCalledWith(`Checking the connector deployment status`);
|
|
66
|
+
expect(stdout_stderr_1.stdout.output).toEqual(expect.stringContaining('Connector Build Failed, please try again or contact support'));
|
|
67
|
+
});
|
|
50
68
|
it('should log success message when connector is deployed', async () => {
|
|
51
69
|
status = ConnectorDeploymentApi_1.ConnectorDeploymentStatus.Deployed;
|
|
52
70
|
const uxStartSpy = jest.spyOn(core_1.ux.action, 'start');
|
|
@@ -77,7 +95,7 @@ describe('GetDeploymentStatus', () => {
|
|
|
77
95
|
stdout_stderr_1.stdout.start();
|
|
78
96
|
await get_1.default.run([connectorName, connectorVersion, uuid]);
|
|
79
97
|
stdout_stderr_1.stdout.stop();
|
|
80
|
-
expect(stdout_stderr_1.stdout.output).toEqual(expect.stringContaining('
|
|
98
|
+
expect(stdout_stderr_1.stdout.output).toEqual(expect.stringContaining('There was an error checking the deployment status, please try again or contact support'));
|
|
81
99
|
expect(stdout_stderr_1.stdout.output).toEqual(expect.stringContaining('There was an error fetching deployment status'));
|
|
82
100
|
});
|
|
83
101
|
it('should run the polling function when tail flag is set', async () => {
|
package/oclif.manifest.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@trayio/cdk-cli",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.21.0",
|
|
4
4
|
"description": "A CLI for connector development",
|
|
5
5
|
"exports": {
|
|
6
6
|
"./*": "./dist/*.js"
|
|
@@ -18,14 +18,16 @@
|
|
|
18
18
|
"@oclif/plugin-autocomplete": "3.0.5",
|
|
19
19
|
"@oclif/plugin-help": "6.0.21",
|
|
20
20
|
"@oclif/plugin-plugins": "^5",
|
|
21
|
+
"@oclif/plugin-update": "^4.3.3",
|
|
21
22
|
"@oclif/plugin-version": "2.0.11",
|
|
23
|
+
"@oclif/plugin-warn-if-update-available": "^3.1.4",
|
|
22
24
|
"@oclif/test": "3.1.12",
|
|
23
|
-
"@trayio/axios": "4.
|
|
24
|
-
"@trayio/cdk-build": "4.
|
|
25
|
-
"@trayio/commons": "4.
|
|
26
|
-
"@trayio/generator": "4.
|
|
27
|
-
"@trayio/tray-client": "4.
|
|
28
|
-
"@trayio/tray-openapi": "4.
|
|
25
|
+
"@trayio/axios": "4.21.0",
|
|
26
|
+
"@trayio/cdk-build": "4.21.0",
|
|
27
|
+
"@trayio/commons": "4.21.0",
|
|
28
|
+
"@trayio/generator": "4.21.0",
|
|
29
|
+
"@trayio/tray-client": "4.21.0",
|
|
30
|
+
"@trayio/tray-openapi": "4.21.0",
|
|
29
31
|
"chalk": "4.1.2",
|
|
30
32
|
"inquirer": "8.2.6"
|
|
31
33
|
},
|
|
@@ -54,7 +56,9 @@
|
|
|
54
56
|
"@oclif/plugin-help",
|
|
55
57
|
"@oclif/plugin-autocomplete",
|
|
56
58
|
"@oclif/plugin-plugins",
|
|
57
|
-
"@oclif/plugin-version"
|
|
59
|
+
"@oclif/plugin-version",
|
|
60
|
+
"@oclif/plugin-warn-if-update-available",
|
|
61
|
+
"@oclif/plugin-update"
|
|
58
62
|
],
|
|
59
63
|
"additionalHelpFlags": [
|
|
60
64
|
"-h"
|
|
@@ -72,6 +76,10 @@
|
|
|
72
76
|
"permissions": {
|
|
73
77
|
"description": "Commands for managing connector permissions"
|
|
74
78
|
}
|
|
79
|
+
},
|
|
80
|
+
"warn-if-update-available": {
|
|
81
|
+
"timeoutInDays": 3,
|
|
82
|
+
"message": "<%= config.name %> update available from <%= chalk.greenBright(config.version) %> to <%= chalk.greenBright(latest) %>."
|
|
75
83
|
}
|
|
76
84
|
},
|
|
77
85
|
"scripts": {
|