@trayio/cdk-cli 2.22.0 → 3.0.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 +87 -87
- package/dist/commands/connector/add-operation.d.ts.map +1 -0
- package/dist/commands/{add-operation.js → connector/add-operation.js} +2 -2
- package/dist/commands/connector/add-operation.unit.test.d.ts.map +1 -0
- package/dist/commands/{build.d.ts → connector/build.d.ts} +1 -1
- package/dist/commands/connector/build.d.ts.map +1 -0
- package/dist/commands/{build.js → connector/build.js} +4 -4
- package/dist/commands/{import-openapi-spec.d.ts → connector/import.d.ts} +2 -2
- package/dist/commands/connector/import.d.ts.map +1 -0
- package/dist/commands/{import-openapi-spec.js → connector/import.js} +5 -5
- package/dist/commands/connector/init.d.ts.map +1 -0
- package/dist/commands/{init.js → connector/init.js} +2 -2
- package/dist/commands/connector/init.unit.test.d.ts.map +1 -0
- package/dist/commands/connector/test.d.ts.map +1 -0
- package/dist/commands/{deploy.d.ts → deployment/create.d.ts} +2 -2
- package/dist/commands/deployment/create.d.ts.map +1 -0
- package/dist/commands/{deploy.js → deployment/create.js} +12 -13
- package/dist/commands/deployment/create.unit.test.d.ts +2 -0
- package/dist/commands/deployment/create.unit.test.d.ts.map +1 -0
- package/dist/commands/deployment/create.unit.test.js +95 -0
- package/dist/commands/{deployment-status.d.ts → deployment/get.d.ts} +2 -2
- package/dist/commands/deployment/get.d.ts.map +1 -0
- package/dist/commands/{deployment-status.js → deployment/get.js} +7 -7
- package/dist/commands/deployment/get.unit.test.d.ts +2 -0
- package/dist/commands/deployment/get.unit.test.d.ts.map +1 -0
- package/dist/commands/{deployment-status.unit.test.js → deployment/get.unit.test.js} +5 -5
- package/dist/commands/{share.d.ts → permissions/add.d.ts} +2 -2
- package/dist/commands/permissions/add.d.ts.map +1 -0
- package/dist/commands/{share.js → permissions/add.js} +8 -8
- package/dist/commands/permissions/add.unit.test.d.ts +2 -0
- package/dist/commands/permissions/add.unit.test.d.ts.map +1 -0
- package/dist/commands/{share.unit.test.js → permissions/add.unit.test.js} +3 -3
- package/dist/templates/connector-template.zip +0 -0
- package/oclif.manifest.json +103 -95
- package/package.json +19 -8
- package/dist/commands/add-operation.d.ts.map +0 -1
- package/dist/commands/add-operation.unit.test.d.ts.map +0 -1
- package/dist/commands/build.d.ts.map +0 -1
- package/dist/commands/deploy.d.ts.map +0 -1
- package/dist/commands/deployment-status.d.ts.map +0 -1
- package/dist/commands/deployment-status.unit.test.d.ts +0 -2
- package/dist/commands/deployment-status.unit.test.d.ts.map +0 -1
- package/dist/commands/import-openapi-spec.d.ts.map +0 -1
- package/dist/commands/init.d.ts.map +0 -1
- package/dist/commands/init.unit.test.d.ts.map +0 -1
- package/dist/commands/share.d.ts.map +0 -1
- package/dist/commands/share.unit.test.d.ts +0 -2
- package/dist/commands/share.unit.test.d.ts.map +0 -1
- package/dist/commands/test.d.ts.map +0 -1
- /package/dist/commands/{add-operation.d.ts → connector/add-operation.d.ts} +0 -0
- /package/dist/commands/{add-operation.unit.test.d.ts → connector/add-operation.unit.test.d.ts} +0 -0
- /package/dist/commands/{add-operation.unit.test.js → connector/add-operation.unit.test.js} +0 -0
- /package/dist/commands/{init.d.ts → connector/init.d.ts} +0 -0
- /package/dist/commands/{init.unit.test.d.ts → connector/init.unit.test.d.ts} +0 -0
- /package/dist/commands/{init.unit.test.js → connector/init.unit.test.js} +0 -0
- /package/dist/commands/{test.d.ts → connector/test.d.ts} +0 -0
- /package/dist/commands/{test.js → connector/test.js} +0 -0
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/
|
|
22
|
+
@trayio/cdk-cli/3.0.0 linux-x64 node-v18.19.0
|
|
23
23
|
$ tray-cdk --help [COMMAND]
|
|
24
24
|
USAGE
|
|
25
25
|
$ tray-cdk COMMAND
|
|
@@ -31,17 +31,17 @@ USAGE
|
|
|
31
31
|
|
|
32
32
|
<!-- commands -->
|
|
33
33
|
* [`tray-cdk`](#tray-cdk)
|
|
34
|
-
* [`tray-cdk add-operation [OPERATIONNAME] [OPERATIONTYPE]`](#tray-cdk-add-operation-operationname-operationtype)
|
|
35
34
|
* [`tray-cdk autocomplete [SHELL]`](#tray-cdk-autocomplete-shell)
|
|
36
|
-
* [`tray-cdk
|
|
37
|
-
* [`tray-cdk
|
|
38
|
-
* [`tray-cdk
|
|
35
|
+
* [`tray-cdk connector add-operation [OPERATIONNAME] [OPERATIONTYPE]`](#tray-cdk-connector-add-operation-operationname-operationtype)
|
|
36
|
+
* [`tray-cdk connector build`](#tray-cdk-connector-build)
|
|
37
|
+
* [`tray-cdk connector import [OPENAPISPEC] [CONNECTORNAME]`](#tray-cdk-connector-import-openapispec-connectorname)
|
|
38
|
+
* [`tray-cdk connector init [CONNECTORNAME]`](#tray-cdk-connector-init-connectorname)
|
|
39
|
+
* [`tray-cdk connector test [OPERATIONNAME]`](#tray-cdk-connector-test-operationname)
|
|
40
|
+
* [`tray-cdk deployment create`](#tray-cdk-deployment-create)
|
|
41
|
+
* [`tray-cdk deployment get CONNECTORNAME CONNECTORVERSION UUID`](#tray-cdk-deployment-get-connectorname-connectorversion-uuid)
|
|
39
42
|
* [`tray-cdk help [COMMANDS]`](#tray-cdk-help-commands)
|
|
40
|
-
* [`tray-cdk
|
|
41
|
-
* [`tray-cdk init [CONNECTORNAME]`](#tray-cdk-init-connectorname)
|
|
43
|
+
* [`tray-cdk permissions add [CONNECTORNAME] [CONNECTORVERSION]`](#tray-cdk-permissions-add-connectorname-connectorversion)
|
|
42
44
|
* [`tray-cdk permissions list [CONNECTORNAME] [CONNECTORVERSION]`](#tray-cdk-permissions-list-connectorname-connectorversion)
|
|
43
|
-
* [`tray-cdk share [CONNECTORNAME] [CONNECTORVERSION]`](#tray-cdk-share-connectorname-connectorversion)
|
|
44
|
-
* [`tray-cdk test [OPERATIONNAME]`](#tray-cdk-test-operationname)
|
|
45
45
|
* [`tray-cdk version`](#tray-cdk-version)
|
|
46
46
|
|
|
47
47
|
## `tray-cdk`
|
|
@@ -51,22 +51,6 @@ USAGE
|
|
|
51
51
|
$ tray-cdk
|
|
52
52
|
```
|
|
53
53
|
|
|
54
|
-
## `tray-cdk add-operation [OPERATIONNAME] [OPERATIONTYPE]`
|
|
55
|
-
|
|
56
|
-
Add an operation to connector project
|
|
57
|
-
|
|
58
|
-
```
|
|
59
|
-
USAGE
|
|
60
|
-
$ tray-cdk add-operation [OPERATIONNAME] [OPERATIONTYPE]
|
|
61
|
-
|
|
62
|
-
ARGUMENTS
|
|
63
|
-
OPERATIONNAME Operation name
|
|
64
|
-
OPERATIONTYPE (http|composite) Operation type
|
|
65
|
-
|
|
66
|
-
DESCRIPTION
|
|
67
|
-
Add an operation to connector project
|
|
68
|
-
```
|
|
69
|
-
|
|
70
54
|
## `tray-cdk autocomplete [SHELL]`
|
|
71
55
|
|
|
72
56
|
Display autocomplete installation instructions.
|
|
@@ -98,131 +82,142 @@ EXAMPLES
|
|
|
98
82
|
|
|
99
83
|
_See code: [@oclif/plugin-autocomplete](https://github.com/oclif/plugin-autocomplete/blob/v3.0.5/src/commands/autocomplete/index.ts)_
|
|
100
84
|
|
|
101
|
-
## `tray-cdk
|
|
85
|
+
## `tray-cdk connector add-operation [OPERATIONNAME] [OPERATIONTYPE]`
|
|
102
86
|
|
|
103
|
-
|
|
87
|
+
Add an operation to connector project
|
|
104
88
|
|
|
105
89
|
```
|
|
106
90
|
USAGE
|
|
107
|
-
$ tray-cdk
|
|
91
|
+
$ tray-cdk connector add-operation [OPERATIONNAME] [OPERATIONTYPE]
|
|
92
|
+
|
|
93
|
+
ARGUMENTS
|
|
94
|
+
OPERATIONNAME Operation name
|
|
95
|
+
OPERATIONTYPE (http|composite) Operation type
|
|
108
96
|
|
|
109
97
|
DESCRIPTION
|
|
110
|
-
|
|
98
|
+
Add an operation to connector project
|
|
111
99
|
```
|
|
112
100
|
|
|
113
|
-
## `tray-cdk
|
|
101
|
+
## `tray-cdk connector build`
|
|
114
102
|
|
|
115
|
-
|
|
103
|
+
Builds a connector project
|
|
116
104
|
|
|
117
105
|
```
|
|
118
106
|
USAGE
|
|
119
|
-
$ tray-cdk
|
|
107
|
+
$ tray-cdk connector build
|
|
120
108
|
|
|
121
109
|
DESCRIPTION
|
|
122
|
-
|
|
110
|
+
Builds a connector project
|
|
123
111
|
```
|
|
124
112
|
|
|
125
|
-
## `tray-cdk
|
|
113
|
+
## `tray-cdk connector import [OPENAPISPEC] [CONNECTORNAME]`
|
|
126
114
|
|
|
127
|
-
|
|
115
|
+
Create a connector from an OpenAPI specification: Command is still in BETA
|
|
128
116
|
|
|
129
117
|
```
|
|
130
118
|
USAGE
|
|
131
|
-
$ tray-cdk
|
|
119
|
+
$ tray-cdk connector import [OPENAPISPEC] [CONNECTORNAME]
|
|
132
120
|
|
|
133
121
|
ARGUMENTS
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
UUID The UUID of the deployment, this is included in the tray-cdk deploy output
|
|
122
|
+
OPENAPISPEC Location of the OpenAPI specification file
|
|
123
|
+
CONNECTORNAME The name of the connector
|
|
137
124
|
|
|
138
125
|
DESCRIPTION
|
|
139
|
-
|
|
126
|
+
Create a connector from an OpenAPI specification: Command is still in BETA
|
|
140
127
|
```
|
|
141
128
|
|
|
142
|
-
## `tray-cdk
|
|
129
|
+
## `tray-cdk connector init [CONNECTORNAME]`
|
|
143
130
|
|
|
144
|
-
|
|
131
|
+
Initialize a connector project
|
|
145
132
|
|
|
146
133
|
```
|
|
147
134
|
USAGE
|
|
148
|
-
$ tray-cdk
|
|
135
|
+
$ tray-cdk connector init [CONNECTORNAME] [-i]
|
|
149
136
|
|
|
150
137
|
ARGUMENTS
|
|
151
|
-
|
|
138
|
+
CONNECTORNAME Connector directory name to generate template files
|
|
152
139
|
|
|
153
140
|
FLAGS
|
|
154
|
-
-
|
|
141
|
+
-i, --install Runs `npm install` after successful generation
|
|
155
142
|
|
|
156
143
|
DESCRIPTION
|
|
157
|
-
|
|
144
|
+
Initialize a connector project
|
|
158
145
|
```
|
|
159
146
|
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
## `tray-cdk import-openapi-spec [OPENAPISPEC] [CONNECTORNAME]`
|
|
147
|
+
## `tray-cdk connector test [OPERATIONNAME]`
|
|
163
148
|
|
|
164
|
-
|
|
149
|
+
Build and test connector project or an operation
|
|
165
150
|
|
|
166
151
|
```
|
|
167
152
|
USAGE
|
|
168
|
-
$ tray-cdk
|
|
153
|
+
$ tray-cdk connector test [OPERATIONNAME] [-v]
|
|
169
154
|
|
|
170
155
|
ARGUMENTS
|
|
171
|
-
|
|
172
|
-
|
|
156
|
+
OPERATIONNAME Operation name to run the test against
|
|
157
|
+
|
|
158
|
+
FLAGS
|
|
159
|
+
-v, --verbose Logs the input and output of an operation, requires operation name argument to be specified
|
|
173
160
|
|
|
174
161
|
DESCRIPTION
|
|
175
|
-
|
|
162
|
+
Build and test connector project or an operation
|
|
176
163
|
```
|
|
177
164
|
|
|
178
|
-
## `tray-cdk
|
|
165
|
+
## `tray-cdk deployment create`
|
|
179
166
|
|
|
180
|
-
|
|
167
|
+
Creates a new deployment for a connector project
|
|
181
168
|
|
|
182
169
|
```
|
|
183
170
|
USAGE
|
|
184
|
-
$ tray-cdk
|
|
185
|
-
|
|
186
|
-
ARGUMENTS
|
|
187
|
-
CONNECTORNAME Connector directory name to generate template files
|
|
188
|
-
|
|
189
|
-
FLAGS
|
|
190
|
-
-i, --install Runs `npm install` after successful generation
|
|
171
|
+
$ tray-cdk deployment create
|
|
191
172
|
|
|
192
173
|
DESCRIPTION
|
|
193
|
-
|
|
174
|
+
Creates a new deployment for a connector project
|
|
194
175
|
```
|
|
195
176
|
|
|
196
|
-
## `tray-cdk
|
|
177
|
+
## `tray-cdk deployment get CONNECTORNAME CONNECTORVERSION UUID`
|
|
197
178
|
|
|
198
|
-
Retrieves
|
|
179
|
+
Retrieves the status of a connector deployment
|
|
199
180
|
|
|
200
181
|
```
|
|
201
182
|
USAGE
|
|
202
|
-
$ tray-cdk
|
|
183
|
+
$ tray-cdk deployment get CONNECTORNAME CONNECTORVERSION UUID
|
|
203
184
|
|
|
204
185
|
ARGUMENTS
|
|
205
186
|
CONNECTORNAME The name of the connector
|
|
206
187
|
CONNECTORVERSION The version of the connector
|
|
188
|
+
UUID The UUID of the deployment, this is included in the tray-cdk deploy output
|
|
207
189
|
|
|
208
190
|
DESCRIPTION
|
|
209
|
-
Retrieves
|
|
191
|
+
Retrieves the status of a connector deployment
|
|
192
|
+
```
|
|
210
193
|
|
|
211
|
-
|
|
212
|
-
$ tray-cdk permissions list
|
|
194
|
+
## `tray-cdk help [COMMANDS]`
|
|
213
195
|
|
|
214
|
-
|
|
196
|
+
Display help for tray-cdk.
|
|
215
197
|
|
|
216
|
-
$ tray-cdk permissions list my-connector 1.0
|
|
217
198
|
```
|
|
199
|
+
USAGE
|
|
200
|
+
$ tray-cdk help [COMMANDS] [-n]
|
|
218
201
|
|
|
219
|
-
|
|
202
|
+
ARGUMENTS
|
|
203
|
+
COMMANDS Command to show help for.
|
|
204
|
+
|
|
205
|
+
FLAGS
|
|
206
|
+
-n, --nested-commands Include all nested commands in the output.
|
|
207
|
+
|
|
208
|
+
DESCRIPTION
|
|
209
|
+
Display help for tray-cdk.
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
_See code: [@oclif/plugin-help](https://github.com/oclif/plugin-help/blob/v6.0.12/src/commands/help.ts)_
|
|
213
|
+
|
|
214
|
+
## `tray-cdk permissions add [CONNECTORNAME] [CONNECTORVERSION]`
|
|
220
215
|
|
|
221
216
|
Share your connector version with other users in your organization
|
|
222
217
|
|
|
223
218
|
```
|
|
224
219
|
USAGE
|
|
225
|
-
$ tray-cdk
|
|
220
|
+
$ tray-cdk permissions add [CONNECTORNAME] [CONNECTORVERSION] [-e <value>]
|
|
226
221
|
|
|
227
222
|
ARGUMENTS
|
|
228
223
|
CONNECTORNAME The name of the connector
|
|
@@ -235,33 +230,38 @@ DESCRIPTION
|
|
|
235
230
|
Share your connector version with other users in your organization
|
|
236
231
|
|
|
237
232
|
EXAMPLES
|
|
238
|
-
$ tray-cdk
|
|
233
|
+
$ tray-cdk permissions add
|
|
239
234
|
|
|
240
|
-
$ tray-cdk
|
|
235
|
+
$ tray-cdk permissions add my-connector
|
|
241
236
|
|
|
242
|
-
$ tray-cdk
|
|
237
|
+
$ tray-cdk permissions add my-connector 1.0
|
|
243
238
|
|
|
244
|
-
$ tray-cdk
|
|
239
|
+
$ tray-cdk permissions add my-connector 1.0 --email="my.email@domain.com, your.email@domain.com"
|
|
245
240
|
|
|
246
|
-
$ tray-cdk
|
|
241
|
+
$ tray-cdk permissions add my-connector 1.0 -e="my.email@domain.com, your.email@domain.com"
|
|
247
242
|
```
|
|
248
243
|
|
|
249
|
-
## `tray-cdk
|
|
244
|
+
## `tray-cdk permissions list [CONNECTORNAME] [CONNECTORVERSION]`
|
|
250
245
|
|
|
251
|
-
|
|
246
|
+
Retrieves a list of emails that have access to a connector
|
|
252
247
|
|
|
253
248
|
```
|
|
254
249
|
USAGE
|
|
255
|
-
$ tray-cdk
|
|
250
|
+
$ tray-cdk permissions list [CONNECTORNAME] [CONNECTORVERSION]
|
|
256
251
|
|
|
257
252
|
ARGUMENTS
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
FLAGS
|
|
261
|
-
-v, --verbose Logs the input and output of an operation, requires operation name argument to be specified
|
|
253
|
+
CONNECTORNAME The name of the connector
|
|
254
|
+
CONNECTORVERSION The version of the connector
|
|
262
255
|
|
|
263
256
|
DESCRIPTION
|
|
264
|
-
|
|
257
|
+
Retrieves a list of emails that have access to a connector
|
|
258
|
+
|
|
259
|
+
EXAMPLES
|
|
260
|
+
$ tray-cdk permissions list
|
|
261
|
+
|
|
262
|
+
$ tray-cdk permissions list my-connector
|
|
263
|
+
|
|
264
|
+
$ tray-cdk permissions list my-connector 1.0
|
|
265
265
|
```
|
|
266
266
|
|
|
267
267
|
## `tray-cdk version`
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"add-operation.d.ts","sourceRoot":"","sources":["../../../src/commands/connector/add-operation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAQ,MAAM,aAAa,CAAC;AAqB5C,MAAM,CAAC,OAAO,OAAO,YAAa,SAAQ,OAAO;IAChD,MAAM,CAAC,WAAW,SAA2C;IAE7D,MAAM,CAAC,IAAI;;;MAYT;IAEF,OAAO,CAAC,SAAS,CAAyB;IAEpC,GAAG;CAqDT"}
|
|
@@ -18,7 +18,7 @@ const NodeFsGenerator_1 = require("@trayio/generator/generator/NodeFsGenerator")
|
|
|
18
18
|
const StringExtensions_1 = require("@trayio/commons/string/StringExtensions");
|
|
19
19
|
const path_1 = __importDefault(require("path"));
|
|
20
20
|
const lodash_1 = require("lodash");
|
|
21
|
-
const colorizeString_1 = require("
|
|
21
|
+
const colorizeString_1 = require("../../utils/colorizeString");
|
|
22
22
|
const isInSrcFolder = (currentDirectory) => {
|
|
23
23
|
const { base } = path_1.default.parse(currentDirectory);
|
|
24
24
|
return base === 'src';
|
|
@@ -67,7 +67,7 @@ class AddOperation extends core_1.Command {
|
|
|
67
67
|
const connectorNamePascalCase = StringExtensions_1.StringExtensions.pascalCase(getConnectorName(currentDirectory));
|
|
68
68
|
const operationType = args.operationType || promptRes.operationType;
|
|
69
69
|
const rootDir = __dirname;
|
|
70
|
-
const templateDir = path_1.default.join(rootDir, '..', 'templates');
|
|
70
|
+
const templateDir = path_1.default.join(rootDir, '..', '..', 'templates');
|
|
71
71
|
const templatePath = operationType === 'http'
|
|
72
72
|
? path_1.default.join(templateDir, 'http-operation-template.zip')
|
|
73
73
|
: path_1.default.join(templateDir, 'composite-operation-template.zip');
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"add-operation.unit.test.d.ts","sourceRoot":"","sources":["../../../src/commands/connector/add-operation.unit.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"build.d.ts","sourceRoot":"","sources":["../../../src/commands/connector/build.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAItC,MAAM,CAAC,OAAO,OAAO,KAAM,SAAQ,OAAO;IACzC,MAAM,CAAC,WAAW,SAAgC;IAElD,MAAM,CAAC,IAAI,KAAM;IAEjB,OAAO,CAAC,gBAAgB,CAA0B;IAE5C,GAAG;CAMT"}
|
|
@@ -15,7 +15,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
15
15
|
const core_1 = require("@oclif/core");
|
|
16
16
|
const chalk_1 = __importDefault(require("chalk"));
|
|
17
17
|
const ConnectorBuilder_1 = require("@trayio/cdk-build/connector/ConnectorBuilder");
|
|
18
|
-
class
|
|
18
|
+
class Build extends core_1.Command {
|
|
19
19
|
constructor() {
|
|
20
20
|
super(...arguments);
|
|
21
21
|
this.connectorBuilder = new ConnectorBuilder_1.ConnectorBuilder();
|
|
@@ -29,6 +29,6 @@ class BuildConnector extends core_1.Command {
|
|
|
29
29
|
});
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
exports.default =
|
|
32
|
+
Build.description = 'Builds a connector project';
|
|
33
|
+
Build.args = {};
|
|
34
|
+
exports.default = Build;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Command } from '@oclif/core';
|
|
2
|
-
export default class
|
|
2
|
+
export default class Import extends Command {
|
|
3
3
|
static description: string;
|
|
4
4
|
static args: {
|
|
5
5
|
openApiSpec: import("@oclif/core/lib/interfaces").Arg<string | undefined, Record<string, unknown>>;
|
|
@@ -7,4 +7,4 @@ export default class ImportOpenApiSpec extends Command {
|
|
|
7
7
|
};
|
|
8
8
|
run(): Promise<void>;
|
|
9
9
|
}
|
|
10
|
-
//# sourceMappingURL=import
|
|
10
|
+
//# sourceMappingURL=import.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"import.d.ts","sourceRoot":"","sources":["../../../src/commands/connector/import.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAQ,MAAM,aAAa,CAAC;AAS5C,MAAM,CAAC,OAAO,OAAO,MAAO,SAAQ,OAAO;IAC1C,MAAM,CAAC,WAAW,SAC4D;IAE9E,MAAM,CAAC,IAAI;;;MAWT;IAEI,GAAG;CAiET"}
|
|
@@ -43,10 +43,10 @@ const NodeFsGenerator_1 = require("@trayio/generator/generator/NodeFsGenerator")
|
|
|
43
43
|
const NodeFsFileStorage_1 = require("@trayio/commons/file/NodeFsFileStorage");
|
|
44
44
|
const E = __importStar(require("fp-ts/Either"));
|
|
45
45
|
const stream_1 = require("stream");
|
|
46
|
-
class
|
|
46
|
+
class Import extends core_1.Command {
|
|
47
47
|
run() {
|
|
48
48
|
return __awaiter(this, void 0, void 0, function* () {
|
|
49
|
-
const { args } = yield this.parse(
|
|
49
|
+
const { args } = yield this.parse(Import);
|
|
50
50
|
const promptRes = yield inquirer_1.default.prompt([
|
|
51
51
|
{
|
|
52
52
|
name: 'openApiSpec',
|
|
@@ -85,8 +85,8 @@ class ImportOpenApiSpec extends core_1.Command {
|
|
|
85
85
|
});
|
|
86
86
|
}
|
|
87
87
|
}
|
|
88
|
-
|
|
89
|
-
|
|
88
|
+
Import.description = 'Create a connector from an OpenAPI specification: Command is still in BETA';
|
|
89
|
+
Import.args = {
|
|
90
90
|
openApiSpec: core_1.Args.string({
|
|
91
91
|
name: 'OpenAPI specification file path',
|
|
92
92
|
required: false,
|
|
@@ -98,4 +98,4 @@ ImportOpenApiSpec.args = {
|
|
|
98
98
|
description: 'The name of the connector',
|
|
99
99
|
}),
|
|
100
100
|
};
|
|
101
|
-
exports.default =
|
|
101
|
+
exports.default = Import;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../../src/commands/connector/init.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAmB,MAAM,aAAa,CAAC;AAUvD,MAAM,CAAC,OAAO,OAAO,IAAK,SAAQ,OAAO;IACxC,MAAM,CAAC,WAAW,SAAoC;IAEtD,MAAM,CAAC,IAAI;;MAMT;IAEF,MAAM,CAAC,KAAK;;MAKV;IAEF,OAAO,CAAC,SAAS,CAAyB;IAEpC,GAAG;CAiDT"}
|
|
@@ -19,7 +19,7 @@ const StringExtensions_1 = require("@trayio/commons/string/StringExtensions");
|
|
|
19
19
|
const path_1 = require("path");
|
|
20
20
|
const lodash_1 = require("lodash");
|
|
21
21
|
const child_process_1 = require("child_process");
|
|
22
|
-
const colorizeString_1 = require("
|
|
22
|
+
const colorizeString_1 = require("../../utils/colorizeString");
|
|
23
23
|
class Init extends core_1.Command {
|
|
24
24
|
constructor() {
|
|
25
25
|
super(...arguments);
|
|
@@ -42,7 +42,7 @@ class Init extends core_1.Command {
|
|
|
42
42
|
const connectorNamePascalCase = StringExtensions_1.StringExtensions.pascalCase(connectorNameKebabCase);
|
|
43
43
|
const connectorNameCamelCase = (0, lodash_1.camelCase)(connectorNameKebabCase);
|
|
44
44
|
const rootDir = __dirname;
|
|
45
|
-
const templateDir = (0, path_1.join)(rootDir, '..', 'templates');
|
|
45
|
+
const templateDir = (0, path_1.join)(rootDir, '..', '..', 'templates');
|
|
46
46
|
const templatePath = (0, path_1.join)(templateDir, 'connector-template.zip');
|
|
47
47
|
yield this.generator.generate(templatePath, process.cwd(), {
|
|
48
48
|
connectorNameKebabCase,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"init.unit.test.d.ts","sourceRoot":"","sources":["../../../src/commands/connector/init.unit.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"test.d.ts","sourceRoot":"","sources":["../../../src/commands/connector/test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAe,MAAM,aAAa,CAAC;AAMnD,MAAM,CAAC,OAAO,OAAO,IAAK,SAAQ,OAAO;IACxC,MAAM,CAAC,WAAW,SAAsD;IAExE,MAAM,CAAC,IAAI;;MAMT;IAEF,MAAM,CAAC,KAAK;;MAMV;IAEI,GAAG;CAwBT"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Command } from '@oclif/core';
|
|
2
|
-
export default class
|
|
2
|
+
export default class Create extends Command {
|
|
3
3
|
static description: string;
|
|
4
4
|
static args: {};
|
|
5
5
|
private connectorDeployment;
|
|
6
6
|
run(): Promise<void>;
|
|
7
7
|
}
|
|
8
|
-
//# sourceMappingURL=
|
|
8
|
+
//# sourceMappingURL=create.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create.d.ts","sourceRoot":"","sources":["../../../src/commands/deployment/create.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAM,MAAM,aAAa,CAAC;AAW1C,MAAM,CAAC,OAAO,OAAO,MAAO,SAAQ,OAAO;IAC1C,MAAM,CAAC,WAAW,SAAsD;IAExE,MAAM,CAAC,IAAI,KAAM;IAEjB,OAAO,CAAC,mBAAmB,CAKzB;IAEI,GAAG;CA6DT"}
|
|
@@ -40,11 +40,11 @@ const pathLib = __importStar(require("path"));
|
|
|
40
40
|
const fse = __importStar(require("fs-extra"));
|
|
41
41
|
const AxiosHttpClient_1 = require("@trayio/axios/http/AxiosHttpClient");
|
|
42
42
|
const ConnectorDeploymentHttpClient_1 = require("@trayio/tray-client/connector/deployment/ConnectorDeploymentHttpClient");
|
|
43
|
-
const test_1 = __importDefault(require("
|
|
44
|
-
const build_1 = __importDefault(require("
|
|
45
|
-
const colorizeString_1 = require("
|
|
46
|
-
const check_env_1 = require("
|
|
47
|
-
class
|
|
43
|
+
const test_1 = __importDefault(require("../connector/test"));
|
|
44
|
+
const build_1 = __importDefault(require("../connector/build"));
|
|
45
|
+
const colorizeString_1 = require("../../utils/colorizeString");
|
|
46
|
+
const check_env_1 = require("../../utils/check-env");
|
|
47
|
+
class Create extends core_1.Command {
|
|
48
48
|
constructor() {
|
|
49
49
|
super(...arguments);
|
|
50
50
|
this.connectorDeployment = new ConnectorDeploymentHttpClient_1.ConnectorDeploymentHttpClient({
|
|
@@ -71,26 +71,25 @@ class DeployConnector extends core_1.Command {
|
|
|
71
71
|
connectorSourceCode: sourceCode,
|
|
72
72
|
token: TRAY_API_TOKEN,
|
|
73
73
|
};
|
|
74
|
-
core_1.ux.action.start('
|
|
74
|
+
core_1.ux.action.start('Creating Connector Deployment');
|
|
75
75
|
const response = yield this.connectorDeployment.deployFromSourceCode(input);
|
|
76
|
-
core_1.ux.action.stop('Deployment started! This may take a few minutes. Use `tray-cdk deployment-status` to check the status.');
|
|
77
76
|
if (response.isSuccess) {
|
|
78
77
|
const { id } = response.value;
|
|
79
78
|
if (response.value.repeatDeployment === true) {
|
|
80
|
-
|
|
79
|
+
core_1.ux.action.stop((0, colorizeString_1.warning)(`Connector ${connectorName} - ${connectorVersion} deployment is already in progress. Deployment ID: ${id}. Please check for the status using 'tray-cdk deployment get' command.`));
|
|
81
80
|
}
|
|
82
81
|
else {
|
|
83
|
-
|
|
82
|
+
core_1.ux.action.stop((0, colorizeString_1.success)('Deployment created! The deployment may take a few minutes to complete. Use `tray-cdk deployment get` to check the status.'));
|
|
84
83
|
this.log(`Connector ${connectorName} - ${connectorVersion} deployment is in progress. Deployment ID: ${id}.`);
|
|
85
84
|
}
|
|
86
85
|
}
|
|
87
86
|
if (response.isFailure) {
|
|
88
|
-
|
|
87
|
+
core_1.ux.action.stop((0, colorizeString_1.error)('There was an error creating the deployment.'));
|
|
89
88
|
this.log(response.error.message);
|
|
90
89
|
}
|
|
91
90
|
});
|
|
92
91
|
}
|
|
93
92
|
}
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
exports.default =
|
|
93
|
+
Create.description = 'Creates a new deployment for a connector project';
|
|
94
|
+
Create.args = {};
|
|
95
|
+
exports.default = Create;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create.unit.test.d.ts","sourceRoot":"","sources":["../../../src/commands/deployment/create.unit.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
const stdout_stderr_1 = require("stdout-stderr");
|
|
16
|
+
const core_1 = require("@oclif/core");
|
|
17
|
+
const ConnectorDeploymentHttpClient_1 = require("@trayio/tray-client/connector/deployment/ConnectorDeploymentHttpClient");
|
|
18
|
+
const test_1 = __importDefault(require("../connector/test"));
|
|
19
|
+
const build_1 = __importDefault(require("../connector/build"));
|
|
20
|
+
const create_1 = __importDefault(require("./create"));
|
|
21
|
+
jest.mock('fs-extra');
|
|
22
|
+
jest.mock('path');
|
|
23
|
+
jest.mock('../connector/test');
|
|
24
|
+
jest.mock('../connector/build');
|
|
25
|
+
jest.mock('@trayio/tray-client/connector/deployment/ConnectorDeploymentHttpClient', () => ({
|
|
26
|
+
ConnectorDeploymentHttpClient: jest.fn(),
|
|
27
|
+
}));
|
|
28
|
+
jest.mock('fs-extra', () => ({
|
|
29
|
+
readFileSync: jest.fn().mockReturnValue(new ArrayBuffer(8)),
|
|
30
|
+
readJsonSync: jest.fn().mockReturnValue({
|
|
31
|
+
name: 'connectorName',
|
|
32
|
+
version: '1.0',
|
|
33
|
+
}),
|
|
34
|
+
}));
|
|
35
|
+
describe('Create', () => {
|
|
36
|
+
let success = true;
|
|
37
|
+
let failure = false;
|
|
38
|
+
let repeatDeployment = false;
|
|
39
|
+
beforeEach(() => {
|
|
40
|
+
ConnectorDeploymentHttpClient_1.ConnectorDeploymentHttpClient.mockImplementation(() => ({
|
|
41
|
+
deployFromSourceCode: jest.fn().mockReturnValue(Object.assign(Object.assign(Object.assign({ isSuccess: success }, (success && {
|
|
42
|
+
value: {
|
|
43
|
+
id: 'some-id',
|
|
44
|
+
repeatDeployment,
|
|
45
|
+
},
|
|
46
|
+
})), { isFailure: failure }), (failure && {
|
|
47
|
+
error: {
|
|
48
|
+
message: 'There was an error deploying the connector',
|
|
49
|
+
},
|
|
50
|
+
}))),
|
|
51
|
+
}));
|
|
52
|
+
});
|
|
53
|
+
afterAll(() => {
|
|
54
|
+
jest.clearAllMocks();
|
|
55
|
+
});
|
|
56
|
+
it('should create a deployment without errors', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
57
|
+
success = true;
|
|
58
|
+
failure = false;
|
|
59
|
+
repeatDeployment = false;
|
|
60
|
+
const startSpy = jest.spyOn(core_1.ux.action, 'start');
|
|
61
|
+
const stopSpy = jest.spyOn(core_1.ux.action, 'stop');
|
|
62
|
+
stdout_stderr_1.stdout.start();
|
|
63
|
+
yield create_1.default.run([]);
|
|
64
|
+
stdout_stderr_1.stdout.stop();
|
|
65
|
+
expect(test_1.default.run).toHaveBeenCalledWith([]);
|
|
66
|
+
expect(build_1.default.run).toHaveBeenCalledWith([]);
|
|
67
|
+
expect(startSpy).toHaveBeenCalledWith('Creating Connector Deployment');
|
|
68
|
+
expect(stopSpy).toHaveBeenCalledWith(expect.stringContaining('Deployment created! The deployment may take a few minutes to complete. Use `tray-cdk deployment get` to check the status.'));
|
|
69
|
+
expect(stdout_stderr_1.stdout.output).toEqual(expect.stringContaining('Connector connectorName - 1.0 deployment is in progress. Deployment ID: some-id.'));
|
|
70
|
+
}));
|
|
71
|
+
it('should inform user of repeatDeployment when deployment is already in progress', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
72
|
+
success = true;
|
|
73
|
+
failure = false;
|
|
74
|
+
repeatDeployment = true;
|
|
75
|
+
const startSpy = jest.spyOn(core_1.ux.action, 'start');
|
|
76
|
+
const stopSpy = jest.spyOn(core_1.ux.action, 'stop');
|
|
77
|
+
yield create_1.default.run([]);
|
|
78
|
+
expect(test_1.default.run).toHaveBeenCalledWith([]);
|
|
79
|
+
expect(build_1.default.run).toHaveBeenCalledWith([]);
|
|
80
|
+
expect(startSpy).toHaveBeenCalledWith('Creating Connector Deployment');
|
|
81
|
+
expect(stopSpy).toHaveBeenCalledWith(expect.stringContaining(`Connector connectorName - 1.0 deployment is already in progress. Deployment ID: some-id. Please check for the status using 'tray-cdk deployment get' command.`));
|
|
82
|
+
}));
|
|
83
|
+
it('should error when the deployment fails', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
84
|
+
success = false;
|
|
85
|
+
failure = true;
|
|
86
|
+
repeatDeployment = false;
|
|
87
|
+
const startSpy = jest.spyOn(core_1.ux.action, 'start');
|
|
88
|
+
const stopSpy = jest.spyOn(core_1.ux.action, 'stop');
|
|
89
|
+
yield create_1.default.run([]);
|
|
90
|
+
expect(test_1.default.run).toHaveBeenCalledWith([]);
|
|
91
|
+
expect(build_1.default.run).toHaveBeenCalledWith([]);
|
|
92
|
+
expect(startSpy).toHaveBeenCalledWith('Creating Connector Deployment');
|
|
93
|
+
expect(stopSpy).toHaveBeenCalledWith(expect.stringContaining('There was an error creating the deployment.'));
|
|
94
|
+
}));
|
|
95
|
+
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Command } from '@oclif/core';
|
|
2
|
-
export default class
|
|
2
|
+
export default class Get extends Command {
|
|
3
3
|
static description: string;
|
|
4
4
|
static args: {
|
|
5
5
|
connectorName: import("@oclif/core/lib/interfaces").Arg<string, Record<string, unknown>>;
|
|
@@ -9,4 +9,4 @@ export default class GetDeploymentStatus extends Command {
|
|
|
9
9
|
private connectorDeployment;
|
|
10
10
|
run(): Promise<void>;
|
|
11
11
|
}
|
|
12
|
-
//# sourceMappingURL=
|
|
12
|
+
//# sourceMappingURL=get.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get.d.ts","sourceRoot":"","sources":["../../../src/commands/deployment/get.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAY,MAAM,aAAa,CAAC;AAOhD,MAAM,CAAC,OAAO,OAAO,GAAI,SAAQ,OAAO;IACvC,MAAM,CAAC,WAAW,SAAoD;IAEtE,MAAM,CAAC,IAAI;;;;MAiBT;IAEF,OAAO,CAAC,mBAAmB,CAKzB;IAEI,GAAG;CAyDT"}
|