@trayio/cdk-cli 0.0.3-beta → 0.0.4-beta
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 +18 -1
- package/dist/commands/add-operation.d.ts +1 -0
- package/dist/commands/add-operation.d.ts.map +1 -1
- package/dist/commands/add-operation.js +10 -6
- package/dist/commands/add-operation.unit.test.d.ts +2 -0
- package/dist/commands/add-operation.unit.test.d.ts.map +1 -0
- package/dist/commands/add-operation.unit.test.js +119 -0
- package/dist/commands/deploy.d.ts.map +1 -1
- package/dist/commands/deploy.js +7 -4
- package/dist/commands/deployment-status.unit.test.d.ts +2 -0
- package/dist/commands/deployment-status.unit.test.d.ts.map +1 -0
- package/dist/commands/import-openapi-spec-tst.d.ts +10 -0
- package/dist/commands/import-openapi-spec-tst.d.ts.map +1 -0
- package/dist/commands/import-openapi-spec-tst.js +101 -0
- package/dist/commands/init.d.ts +1 -0
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +11 -6
- package/dist/commands/init.unit.test.d.ts +2 -0
- package/dist/commands/init.unit.test.d.ts.map +1 -0
- package/dist/commands/init.unit.test.js +127 -0
- package/dist/utils/check-env.d.ts +2 -0
- package/dist/utils/check-env.d.ts.map +1 -0
- package/dist/utils/check-env.js +35 -0
- package/dist/utils/check-env.unit.test.d.ts +2 -0
- package/dist/utils/check-env.unit.test.d.ts.map +1 -0
- package/dist/utils/check-env.unit.test.js +46 -0
- package/dist/utils/colorizeString.d.ts +4 -4
- package/dist/utils/colorizeString.d.ts.map +1 -1
- package/dist/utils/colorizeString.js +8 -6
- package/oclif.manifest.json +32 -1
- package/package.json +7 -7
- package/dist/commands/deployment-status.test.d.ts +0 -2
- package/dist/commands/deployment-status.test.d.ts.map +0 -1
- /package/dist/commands/{deployment-status.test.js → deployment-status.unit.test.js} +0 -0
- /package/dist/{commands → templates}/composite-operation-template.zip +0 -0
- /package/dist/{commands → templates}/connector-template.zip +0 -0
- /package/dist/{commands → templates}/http-operation-template.zip +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/0.0.
|
|
22
|
+
@trayio/cdk-cli/0.0.4-beta linux-x64 node-v18.19.0
|
|
23
23
|
$ tray-cdk --help [COMMAND]
|
|
24
24
|
USAGE
|
|
25
25
|
$ tray-cdk COMMAND
|
|
@@ -38,6 +38,7 @@ USAGE
|
|
|
38
38
|
* [`tray-cdk deployment-status CONNECTORNAME CONNECTORVERSION UUID`](#tray-cdk-deployment-status-connectorname-connectorversion-uuid)
|
|
39
39
|
* [`tray-cdk help [COMMANDS]`](#tray-cdk-help-commands)
|
|
40
40
|
* [`tray-cdk import-openapi-spec [OPENAPISPEC] [CONNECTORNAME]`](#tray-cdk-import-openapi-spec-openapispec-connectorname)
|
|
41
|
+
* [`tray-cdk import-openapi-spec-tst [OPENAPISPEC] [CONNECTORNAME]`](#tray-cdk-import-openapi-spec-tst-openapispec-connectorname)
|
|
41
42
|
* [`tray-cdk init [CONNECTORNAME]`](#tray-cdk-init-connectorname)
|
|
42
43
|
* [`tray-cdk test [OPERATIONNAME]`](#tray-cdk-test-operationname)
|
|
43
44
|
* [`tray-cdk version`](#tray-cdk-version)
|
|
@@ -173,6 +174,22 @@ DESCRIPTION
|
|
|
173
174
|
Create a connector from an OpenAPI specification: Command is still in BETA
|
|
174
175
|
```
|
|
175
176
|
|
|
177
|
+
## `tray-cdk import-openapi-spec-tst [OPENAPISPEC] [CONNECTORNAME]`
|
|
178
|
+
|
|
179
|
+
Create a connector from an OpenAPI specification: Command is still in BETA
|
|
180
|
+
|
|
181
|
+
```
|
|
182
|
+
USAGE
|
|
183
|
+
$ tray-cdk import-openapi-spec-tst [OPENAPISPEC] [CONNECTORNAME]
|
|
184
|
+
|
|
185
|
+
ARGUMENTS
|
|
186
|
+
OPENAPISPEC Location of the OpenAPI specification file
|
|
187
|
+
CONNECTORNAME The name of the connector
|
|
188
|
+
|
|
189
|
+
DESCRIPTION
|
|
190
|
+
Create a connector from an OpenAPI specification: Command is still in BETA
|
|
191
|
+
```
|
|
192
|
+
|
|
176
193
|
## `tray-cdk init [CONNECTORNAME]`
|
|
177
194
|
|
|
178
195
|
Initialize a connector project
|
|
@@ -5,6 +5,7 @@ export default class AddOperation extends Command {
|
|
|
5
5
|
operationName: import("@oclif/core/lib/interfaces").Arg<string | undefined, Record<string, unknown>>;
|
|
6
6
|
operationType: import("@oclif/core/lib/interfaces").Arg<string | undefined, Record<string, unknown>>;
|
|
7
7
|
};
|
|
8
|
+
private generator;
|
|
8
9
|
run(): Promise<void>;
|
|
9
10
|
}
|
|
10
11
|
//# sourceMappingURL=add-operation.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"add-operation.d.ts","sourceRoot":"","sources":["../../src/commands/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;
|
|
1
|
+
{"version":3,"file":"add-operation.d.ts","sourceRoot":"","sources":["../../src/commands/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"}
|
|
@@ -14,11 +14,11 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
15
|
const core_1 = require("@oclif/core");
|
|
16
16
|
const inquirer_1 = __importDefault(require("inquirer"));
|
|
17
|
-
const chalk_1 = __importDefault(require("chalk"));
|
|
18
17
|
const NodeFsGenerator_1 = require("@trayio/generator/generator/NodeFsGenerator");
|
|
19
18
|
const StringExtensions_1 = require("@trayio/commons/string/StringExtensions");
|
|
20
19
|
const path_1 = __importDefault(require("path"));
|
|
21
20
|
const lodash_1 = require("lodash");
|
|
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';
|
|
@@ -31,6 +31,10 @@ const getConnectorName = (currentDirectory) => {
|
|
|
31
31
|
return base;
|
|
32
32
|
};
|
|
33
33
|
class AddOperation extends core_1.Command {
|
|
34
|
+
constructor() {
|
|
35
|
+
super(...arguments);
|
|
36
|
+
this.generator = new NodeFsGenerator_1.NodeFsGenerator();
|
|
37
|
+
}
|
|
34
38
|
run() {
|
|
35
39
|
return __awaiter(this, void 0, void 0, function* () {
|
|
36
40
|
const { args } = yield this.parse(AddOperation);
|
|
@@ -63,21 +67,21 @@ class AddOperation extends core_1.Command {
|
|
|
63
67
|
const connectorNamePascalCase = StringExtensions_1.StringExtensions.pascalCase(getConnectorName(currentDirectory));
|
|
64
68
|
const operationType = args.operationType || promptRes.operationType;
|
|
65
69
|
const rootDir = __dirname;
|
|
70
|
+
const templateDir = path_1.default.join(rootDir, '..', 'templates');
|
|
66
71
|
const templatePath = operationType === 'http'
|
|
67
|
-
? path_1.default.join(
|
|
68
|
-
: path_1.default.join(
|
|
69
|
-
const generator = new NodeFsGenerator_1.NodeFsGenerator();
|
|
72
|
+
? path_1.default.join(templateDir, 'http-operation-template.zip')
|
|
73
|
+
: path_1.default.join(templateDir, 'composite-operation-template.zip');
|
|
70
74
|
const targetPath = isInSrcFolder(currentDirectory)
|
|
71
75
|
? currentDirectory
|
|
72
76
|
: path_1.default.join(currentDirectory, 'src');
|
|
73
|
-
yield generator.generate(templatePath, targetPath, {
|
|
77
|
+
yield this.generator.generate(templatePath, targetPath, {
|
|
74
78
|
operationNameKebabCase,
|
|
75
79
|
operationNamePascalCase,
|
|
76
80
|
operationNameCamelCase,
|
|
77
81
|
operationNameSnakeCase,
|
|
78
82
|
connectorNamePascalCase,
|
|
79
83
|
})();
|
|
80
|
-
this.log(
|
|
84
|
+
this.log((0, colorizeString_1.success)(`Success! Added operation: ${operationNameKebabCase}`));
|
|
81
85
|
});
|
|
82
86
|
}
|
|
83
87
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"add-operation.unit.test.d.ts","sourceRoot":"","sources":["../../src/commands/add-operation.unit.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,119 @@
|
|
|
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 inquirer_1 = __importDefault(require("inquirer"));
|
|
17
|
+
const add_operation_1 = __importDefault(require("./add-operation"));
|
|
18
|
+
jest.mock('inquirer', () => ({
|
|
19
|
+
prompt: jest.fn(),
|
|
20
|
+
registerPrompt: jest.requireActual('inquirer').registerPrompt,
|
|
21
|
+
}));
|
|
22
|
+
describe('AddOperation', () => {
|
|
23
|
+
let operationName = 'my-operation';
|
|
24
|
+
let operationType = 'http';
|
|
25
|
+
const mockInquirer = inquirer_1.default;
|
|
26
|
+
beforeAll(() => {
|
|
27
|
+
mockInquirer.prompt.mockResolvedValue({
|
|
28
|
+
shouldContinue: true,
|
|
29
|
+
operationName,
|
|
30
|
+
operationType,
|
|
31
|
+
});
|
|
32
|
+
});
|
|
33
|
+
beforeEach(() => { });
|
|
34
|
+
afterAll(() => {
|
|
35
|
+
jest.restoreAllMocks();
|
|
36
|
+
});
|
|
37
|
+
it('should prompt for operation name and type if not provided', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
38
|
+
const addOperation = new add_operation_1.default([], {});
|
|
39
|
+
const mockGenerate = jest
|
|
40
|
+
.fn()
|
|
41
|
+
.mockImplementation(() => jest.fn().mockResolvedValue(true));
|
|
42
|
+
addOperation['generator'] = {
|
|
43
|
+
generate: mockGenerate,
|
|
44
|
+
};
|
|
45
|
+
stdout_stderr_1.stdout.start();
|
|
46
|
+
yield addOperation.run();
|
|
47
|
+
stdout_stderr_1.stdout.stop();
|
|
48
|
+
expect(stdout_stderr_1.stdout.output).toContain('Success! Added operation: my-operation');
|
|
49
|
+
expect(mockInquirer.prompt).toBeCalledWith([
|
|
50
|
+
{
|
|
51
|
+
name: 'operationName',
|
|
52
|
+
message: 'Operation name',
|
|
53
|
+
type: 'input',
|
|
54
|
+
when: true,
|
|
55
|
+
default: 'my-operation',
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
name: 'operationType',
|
|
59
|
+
message: 'Operation type',
|
|
60
|
+
type: 'list',
|
|
61
|
+
choices: [
|
|
62
|
+
{ name: 'HTTP', value: 'http' },
|
|
63
|
+
{ name: 'Composite', value: 'composite' },
|
|
64
|
+
],
|
|
65
|
+
when: true,
|
|
66
|
+
default: 'http',
|
|
67
|
+
},
|
|
68
|
+
]);
|
|
69
|
+
expect(mockGenerate).toBeCalledWith(expect.stringContaining('modules/cdk-cli/src/templates/http-operation-template.zip'), expect.stringContaining('/src'), {
|
|
70
|
+
connectorNamePascalCase: 'TrayTypescriptSdk',
|
|
71
|
+
operationNameCamelCase: 'myOperation',
|
|
72
|
+
operationNameKebabCase: 'my-operation',
|
|
73
|
+
operationNamePascalCase: 'MyOperation',
|
|
74
|
+
operationNameSnakeCase: 'my_operation',
|
|
75
|
+
});
|
|
76
|
+
}));
|
|
77
|
+
it('should not prompt for operation name and type if provided', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
78
|
+
operationName = 'some-val';
|
|
79
|
+
operationType = 'http';
|
|
80
|
+
const addOperation = new add_operation_1.default([operationName, operationType], {});
|
|
81
|
+
const mockGenerate = jest
|
|
82
|
+
.fn()
|
|
83
|
+
.mockImplementation(() => jest.fn().mockResolvedValue(true));
|
|
84
|
+
addOperation['generator'] = {
|
|
85
|
+
generate: mockGenerate,
|
|
86
|
+
};
|
|
87
|
+
stdout_stderr_1.stdout.start();
|
|
88
|
+
yield addOperation.run();
|
|
89
|
+
stdout_stderr_1.stdout.stop();
|
|
90
|
+
expect(stdout_stderr_1.stdout.output).toContain('Success! Added operation: some-val');
|
|
91
|
+
expect(mockInquirer.prompt).toBeCalledWith([
|
|
92
|
+
{
|
|
93
|
+
name: 'operationName',
|
|
94
|
+
message: 'Operation name',
|
|
95
|
+
type: 'input',
|
|
96
|
+
when: false,
|
|
97
|
+
default: 'my-operation',
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
name: 'operationType',
|
|
101
|
+
message: 'Operation type',
|
|
102
|
+
type: 'list',
|
|
103
|
+
choices: [
|
|
104
|
+
{ name: 'HTTP', value: 'http' },
|
|
105
|
+
{ name: 'Composite', value: 'composite' },
|
|
106
|
+
],
|
|
107
|
+
when: false,
|
|
108
|
+
default: 'http',
|
|
109
|
+
},
|
|
110
|
+
]);
|
|
111
|
+
expect(mockGenerate).toBeCalledWith(expect.stringContaining('modules/cdk-cli/src/templates/http-operation-template.zip'), expect.stringContaining('/src'), {
|
|
112
|
+
connectorNamePascalCase: 'TrayTypescriptSdk',
|
|
113
|
+
operationNameCamelCase: 'someVal',
|
|
114
|
+
operationNameKebabCase: 'some-val',
|
|
115
|
+
operationNamePascalCase: 'SomeVal',
|
|
116
|
+
operationNameSnakeCase: 'some_val',
|
|
117
|
+
});
|
|
118
|
+
}));
|
|
119
|
+
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deploy.d.ts","sourceRoot":"","sources":["../../src/commands/deploy.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,
|
|
1
|
+
{"version":3,"file":"deploy.d.ts","sourceRoot":"","sources":["../../src/commands/deploy.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAM,MAAM,aAAa,CAAC;AAW1C,MAAM,CAAC,OAAO,OAAO,eAAgB,SAAQ,OAAO;IACnD,MAAM,CAAC,WAAW,SAAiC;IAEnD,MAAM,CAAC,IAAI,KAAM;IAEjB,OAAO,CAAC,mBAAmB,CAKzB;IAEI,GAAG;CA+CT"}
|
package/dist/commands/deploy.js
CHANGED
|
@@ -36,13 +36,14 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
36
36
|
};
|
|
37
37
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
38
38
|
const core_1 = require("@oclif/core");
|
|
39
|
-
const chalk_1 = __importDefault(require("chalk"));
|
|
40
39
|
const pathLib = __importStar(require("path"));
|
|
41
40
|
const fse = __importStar(require("fs-extra"));
|
|
42
41
|
const AxiosHttpClient_1 = require("@trayio/axios/http/AxiosHttpClient");
|
|
43
42
|
const ConnectorDeploymentHttpClient_1 = require("@trayio/tray-client/connector/deployment/ConnectorDeploymentHttpClient");
|
|
44
43
|
const test_1 = __importDefault(require("./test"));
|
|
45
44
|
const build_1 = __importDefault(require("./build"));
|
|
45
|
+
const colorizeString_1 = require("../utils/colorizeString");
|
|
46
|
+
const check_env_1 = require("../utils/check-env");
|
|
46
47
|
class DeployConnector extends core_1.Command {
|
|
47
48
|
constructor() {
|
|
48
49
|
super(...arguments);
|
|
@@ -52,6 +53,7 @@ class DeployConnector extends core_1.Command {
|
|
|
52
53
|
}
|
|
53
54
|
run() {
|
|
54
55
|
return __awaiter(this, void 0, void 0, function* () {
|
|
56
|
+
(0, check_env_1.checkEnv)();
|
|
55
57
|
yield test_1.default.run([]);
|
|
56
58
|
yield build_1.default.run([]);
|
|
57
59
|
const currentDirectory = process.cwd();
|
|
@@ -69,14 +71,15 @@ class DeployConnector extends core_1.Command {
|
|
|
69
71
|
connectorSourceCode: sourceCode,
|
|
70
72
|
token: TRAY_API_TOKEN,
|
|
71
73
|
};
|
|
72
|
-
|
|
74
|
+
core_1.ux.action.start('Starting Connector Deployment');
|
|
73
75
|
const response = yield this.connectorDeployment.deployFromSourceCode(input);
|
|
76
|
+
core_1.ux.action.stop();
|
|
74
77
|
if (response.isSuccess) {
|
|
75
|
-
this.log(
|
|
78
|
+
this.log((0, colorizeString_1.success)(`Connector Deploy Request Sent`));
|
|
76
79
|
this.log(`Deployment [${response.value.id}] is in progress`);
|
|
77
80
|
}
|
|
78
81
|
if (response.isFailure) {
|
|
79
|
-
this.log(
|
|
82
|
+
this.log((0, colorizeString_1.error)(`Connector Deploy Failed`));
|
|
80
83
|
this.log(response.error.message);
|
|
81
84
|
}
|
|
82
85
|
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deployment-status.unit.test.d.ts","sourceRoot":"","sources":["../../src/commands/deployment-status.unit.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Command } from '@oclif/core';
|
|
2
|
+
export default class ImportOpenApiSpecTst extends Command {
|
|
3
|
+
static description: string;
|
|
4
|
+
static args: {
|
|
5
|
+
openApiSpec: import("@oclif/core/lib/interfaces").Arg<string | undefined, Record<string, unknown>>;
|
|
6
|
+
connectorName: import("@oclif/core/lib/interfaces").Arg<string | undefined, Record<string, unknown>>;
|
|
7
|
+
};
|
|
8
|
+
run(): Promise<void>;
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=import-openapi-spec-tst.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"import-openapi-spec-tst.d.ts","sourceRoot":"","sources":["../../src/commands/import-openapi-spec-tst.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAQ,MAAM,aAAa,CAAC;AAS5C,MAAM,CAAC,OAAO,OAAO,oBAAqB,SAAQ,OAAO;IACxD,MAAM,CAAC,WAAW,SAC4D;IAE9E,MAAM,CAAC,IAAI;;;MAWT;IAEI,GAAG;CAiET"}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
26
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
27
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
28
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
29
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
30
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
31
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
32
|
+
});
|
|
33
|
+
};
|
|
34
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
35
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
36
|
+
};
|
|
37
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
38
|
+
const core_1 = require("@oclif/core");
|
|
39
|
+
const OpenApiSchemaImporter_1 = require("@trayio/tray-openapi/OpenApiSchemaImporter");
|
|
40
|
+
const inquirer_1 = __importDefault(require("inquirer"));
|
|
41
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
42
|
+
const NodeFsGenerator_1 = require("@trayio/generator/generator/NodeFsGenerator");
|
|
43
|
+
const NodeFsFileStorage_1 = require("@trayio/commons/file/NodeFsFileStorage");
|
|
44
|
+
const E = __importStar(require("fp-ts/Either"));
|
|
45
|
+
const stream_1 = require("stream");
|
|
46
|
+
class ImportOpenApiSpecTst extends core_1.Command {
|
|
47
|
+
run() {
|
|
48
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
49
|
+
const { args } = yield this.parse(ImportOpenApiSpecTst);
|
|
50
|
+
const promptRes = yield inquirer_1.default.prompt([
|
|
51
|
+
{
|
|
52
|
+
name: 'openApiSpec',
|
|
53
|
+
message: 'OpenAPI specification file path',
|
|
54
|
+
type: 'input',
|
|
55
|
+
when: !args.openApiSpec,
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
name: 'connectorName',
|
|
59
|
+
message: 'Connector name',
|
|
60
|
+
type: 'input',
|
|
61
|
+
when: !args.connectorName,
|
|
62
|
+
},
|
|
63
|
+
]);
|
|
64
|
+
const generator = new NodeFsGenerator_1.NodeFsGenerator();
|
|
65
|
+
const fileStorage = new NodeFsFileStorage_1.NodeFsFileStorage(process.cwd());
|
|
66
|
+
const openApiSchemaImporter = new OpenApiSchemaImporter_1.OpenApiSchemaImporter(generator, fileStorage);
|
|
67
|
+
const openApiSpec = promptRes.openApiSpec || args.openApiSpec;
|
|
68
|
+
const connectorName = promptRes.connectorName || args.connectorName;
|
|
69
|
+
const result = yield openApiSchemaImporter.buildConnector(openApiSpec, connectorName)();
|
|
70
|
+
if (E.isLeft(result)) {
|
|
71
|
+
this.log(chalk_1.default.red(`Error occurred while importing connector: ${result.left.message}`));
|
|
72
|
+
}
|
|
73
|
+
else {
|
|
74
|
+
this.log(chalk_1.default.bold(chalk_1.default.green(`Success! Added connector: ${connectorName}`)));
|
|
75
|
+
this.log(chalk_1.default.bold.green(`Generated ${result.right.successes.length} Connector Operations`));
|
|
76
|
+
if (result.right.errors.length) {
|
|
77
|
+
this.log(chalk_1.default.bold.red(`Failed to generate ${result.right.errors.length} Connector Operations, errors can be found in the errors.json file`));
|
|
78
|
+
yield fileStorage.write({
|
|
79
|
+
key: 'errors.json',
|
|
80
|
+
content: stream_1.Readable.from(JSON.stringify(result.right.errors)),
|
|
81
|
+
metadata: { name: 'errors.json', size: 0 },
|
|
82
|
+
})();
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
ImportOpenApiSpecTst.description = 'Create a connector from an OpenAPI specification: Command is still in BETA';
|
|
89
|
+
ImportOpenApiSpecTst.args = {
|
|
90
|
+
openApiSpec: core_1.Args.string({
|
|
91
|
+
name: 'OpenAPI specification file path',
|
|
92
|
+
required: false,
|
|
93
|
+
description: 'Location of the OpenAPI specification file',
|
|
94
|
+
}),
|
|
95
|
+
connectorName: core_1.Args.string({
|
|
96
|
+
name: 'Connector name',
|
|
97
|
+
required: false,
|
|
98
|
+
description: 'The name of the connector',
|
|
99
|
+
}),
|
|
100
|
+
};
|
|
101
|
+
exports.default = ImportOpenApiSpecTst;
|
package/dist/commands/init.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../src/commands/init.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,
|
|
1
|
+
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../src/commands/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"}
|
package/dist/commands/init.js
CHANGED
|
@@ -14,13 +14,17 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
15
|
const core_1 = require("@oclif/core");
|
|
16
16
|
const inquirer_1 = __importDefault(require("inquirer"));
|
|
17
|
-
const chalk_1 = __importDefault(require("chalk"));
|
|
18
17
|
const NodeFsGenerator_1 = require("@trayio/generator/generator/NodeFsGenerator");
|
|
19
18
|
const StringExtensions_1 = require("@trayio/commons/string/StringExtensions");
|
|
20
19
|
const path_1 = require("path");
|
|
21
20
|
const lodash_1 = require("lodash");
|
|
22
21
|
const child_process_1 = require("child_process");
|
|
22
|
+
const colorizeString_1 = require("../utils/colorizeString");
|
|
23
23
|
class Init extends core_1.Command {
|
|
24
|
+
constructor() {
|
|
25
|
+
super(...arguments);
|
|
26
|
+
this.generator = new NodeFsGenerator_1.NodeFsGenerator();
|
|
27
|
+
}
|
|
24
28
|
run() {
|
|
25
29
|
return __awaiter(this, void 0, void 0, function* () {
|
|
26
30
|
const { args, flags } = yield this.parse(Init);
|
|
@@ -38,21 +42,22 @@ class Init extends core_1.Command {
|
|
|
38
42
|
const connectorNamePascalCase = StringExtensions_1.StringExtensions.pascalCase(connectorNameKebabCase);
|
|
39
43
|
const connectorNameCamelCase = (0, lodash_1.camelCase)(connectorNameKebabCase);
|
|
40
44
|
const rootDir = __dirname;
|
|
41
|
-
const
|
|
42
|
-
const
|
|
43
|
-
yield generator.generate(templatePath, process.cwd(), {
|
|
45
|
+
const templateDir = (0, path_1.join)(rootDir, '..', 'templates');
|
|
46
|
+
const templatePath = (0, path_1.join)(templateDir, 'connector-template.zip');
|
|
47
|
+
yield this.generator.generate(templatePath, process.cwd(), {
|
|
44
48
|
connectorNameKebabCase,
|
|
45
49
|
connectorNameTitleCase,
|
|
46
50
|
connectorNamePascalCase,
|
|
47
51
|
connectorNameCamelCase,
|
|
48
52
|
})();
|
|
49
|
-
this.log(
|
|
53
|
+
this.log((0, colorizeString_1.success)(`Success! Added ${connectorNameKebabCase}`));
|
|
50
54
|
if (flags.install) {
|
|
51
55
|
try {
|
|
52
|
-
|
|
56
|
+
core_1.ux.action.start('Installing dependencies');
|
|
53
57
|
(0, child_process_1.execSync)(`cd ${connectorNameKebabCase} && npm install`, {
|
|
54
58
|
stdio: 'inherit',
|
|
55
59
|
});
|
|
60
|
+
core_1.ux.action.stop();
|
|
56
61
|
}
|
|
57
62
|
catch (error) {
|
|
58
63
|
if (error instanceof Error) {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"init.unit.test.d.ts","sourceRoot":"","sources":["../../src/commands/init.unit.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,127 @@
|
|
|
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 inquirer_1 = __importDefault(require("inquirer"));
|
|
17
|
+
const child_process_1 = require("child_process");
|
|
18
|
+
const init_1 = __importDefault(require("./init"));
|
|
19
|
+
jest.mock('inquirer', () => ({
|
|
20
|
+
prompt: jest.fn(),
|
|
21
|
+
registerPrompt: jest.requireActual('inquirer').registerPrompt,
|
|
22
|
+
}));
|
|
23
|
+
jest.mock('child_process', () => (Object.assign(Object.assign({}, jest.requireActual('child_process')), { execSync: jest.fn() })));
|
|
24
|
+
describe('Init', () => {
|
|
25
|
+
let connectorName = 'my-test-connector';
|
|
26
|
+
const mockInquirer = inquirer_1.default;
|
|
27
|
+
beforeAll(() => {
|
|
28
|
+
mockInquirer.prompt.mockResolvedValue({
|
|
29
|
+
shouldContinue: true,
|
|
30
|
+
connectorName,
|
|
31
|
+
});
|
|
32
|
+
});
|
|
33
|
+
afterAll(() => {
|
|
34
|
+
jest.restoreAllMocks();
|
|
35
|
+
});
|
|
36
|
+
it('should prompt for connector name if not provided', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
37
|
+
const init = new init_1.default([], {});
|
|
38
|
+
const mockGenerate = jest
|
|
39
|
+
.fn()
|
|
40
|
+
.mockImplementation(() => jest.fn().mockResolvedValue(true));
|
|
41
|
+
init['generator'] = {
|
|
42
|
+
generate: mockGenerate,
|
|
43
|
+
};
|
|
44
|
+
stdout_stderr_1.stdout.start();
|
|
45
|
+
yield init.run();
|
|
46
|
+
stdout_stderr_1.stdout.stop();
|
|
47
|
+
expect(stdout_stderr_1.stdout.output).toContain('Success! Added my-test-connector');
|
|
48
|
+
expect(mockInquirer.prompt).toBeCalledWith([
|
|
49
|
+
{
|
|
50
|
+
name: 'connectorName',
|
|
51
|
+
message: 'Connector directory name to generate template files',
|
|
52
|
+
type: 'input',
|
|
53
|
+
when: true,
|
|
54
|
+
default: 'my-connector',
|
|
55
|
+
},
|
|
56
|
+
]);
|
|
57
|
+
expect(mockGenerate).toBeCalledWith(expect.stringContaining('modules/cdk-cli/src/templates/connector-template.zip'), process.cwd(), {
|
|
58
|
+
connectorNameCamelCase: 'myTestConnector',
|
|
59
|
+
connectorNameKebabCase: 'my-test-connector',
|
|
60
|
+
connectorNamePascalCase: 'MyTestConnector',
|
|
61
|
+
connectorNameTitleCase: 'My test connector',
|
|
62
|
+
});
|
|
63
|
+
expect(child_process_1.execSync).not.toBeCalled();
|
|
64
|
+
}));
|
|
65
|
+
it('should not prompt for connector name if provided', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
66
|
+
connectorName = 'my-new-connector';
|
|
67
|
+
const init = new init_1.default([connectorName], {});
|
|
68
|
+
const mockGenerate = jest
|
|
69
|
+
.fn()
|
|
70
|
+
.mockImplementation(() => jest.fn().mockResolvedValue(true));
|
|
71
|
+
init['generator'] = {
|
|
72
|
+
generate: mockGenerate,
|
|
73
|
+
};
|
|
74
|
+
stdout_stderr_1.stdout.start();
|
|
75
|
+
yield init.run();
|
|
76
|
+
stdout_stderr_1.stdout.stop();
|
|
77
|
+
expect(stdout_stderr_1.stdout.output).toContain('Success! Added my-new-connector');
|
|
78
|
+
expect(mockInquirer.prompt).toBeCalledWith([
|
|
79
|
+
{
|
|
80
|
+
name: 'connectorName',
|
|
81
|
+
message: 'Connector directory name to generate template files',
|
|
82
|
+
type: 'input',
|
|
83
|
+
when: false,
|
|
84
|
+
default: 'my-connector',
|
|
85
|
+
},
|
|
86
|
+
]);
|
|
87
|
+
expect(mockGenerate).toBeCalledWith(expect.stringContaining('modules/cdk-cli/src/templates/connector-template.zip'), process.cwd(), {
|
|
88
|
+
connectorNameCamelCase: 'myNewConnector',
|
|
89
|
+
connectorNameKebabCase: 'my-new-connector',
|
|
90
|
+
connectorNamePascalCase: 'MyNewConnector',
|
|
91
|
+
connectorNameTitleCase: 'My new connector',
|
|
92
|
+
});
|
|
93
|
+
expect(child_process_1.execSync).not.toBeCalled();
|
|
94
|
+
}));
|
|
95
|
+
it('should run npm install if "-i" install flag is passed', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
96
|
+
connectorName = 'my-install-connector';
|
|
97
|
+
const init = new init_1.default([connectorName, '-i'], {});
|
|
98
|
+
const mockGenerate = jest
|
|
99
|
+
.fn()
|
|
100
|
+
.mockImplementation(() => jest.fn().mockResolvedValue(true));
|
|
101
|
+
init['generator'] = {
|
|
102
|
+
generate: mockGenerate,
|
|
103
|
+
};
|
|
104
|
+
stdout_stderr_1.stdout.start();
|
|
105
|
+
yield init.run();
|
|
106
|
+
stdout_stderr_1.stdout.stop();
|
|
107
|
+
expect(stdout_stderr_1.stdout.output).toContain('Success! Added my-install-connector');
|
|
108
|
+
expect(mockInquirer.prompt).toBeCalledWith([
|
|
109
|
+
{
|
|
110
|
+
name: 'connectorName',
|
|
111
|
+
message: 'Connector directory name to generate template files',
|
|
112
|
+
type: 'input',
|
|
113
|
+
when: false,
|
|
114
|
+
default: 'my-connector',
|
|
115
|
+
},
|
|
116
|
+
]);
|
|
117
|
+
expect(mockGenerate).toBeCalledWith(expect.stringContaining('modules/cdk-cli/src/templates/connector-template.zip'), process.cwd(), {
|
|
118
|
+
connectorNameCamelCase: 'myInstallConnector',
|
|
119
|
+
connectorNameKebabCase: 'my-install-connector',
|
|
120
|
+
connectorNamePascalCase: 'MyInstallConnector',
|
|
121
|
+
connectorNameTitleCase: 'My install connector',
|
|
122
|
+
});
|
|
123
|
+
expect(child_process_1.execSync).toBeCalledWith(`cd ${connectorName} && npm install`, {
|
|
124
|
+
stdio: 'inherit',
|
|
125
|
+
});
|
|
126
|
+
}));
|
|
127
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"check-env.d.ts","sourceRoot":"","sources":["../../src/utils/check-env.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,QAAQ,YAIpB,CAAC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.checkEnv = void 0;
|
|
4
|
+
const checkEnv = () => {
|
|
5
|
+
checkMissingEnv();
|
|
6
|
+
isApiUrlValid();
|
|
7
|
+
isValidApiToken();
|
|
8
|
+
};
|
|
9
|
+
exports.checkEnv = checkEnv;
|
|
10
|
+
const checkMissingEnv = () => {
|
|
11
|
+
if (!process.env.TRAY_API_URL) {
|
|
12
|
+
throw new Error('required env TRAY_API_URL is not set');
|
|
13
|
+
}
|
|
14
|
+
if (!process.env.TRAY_API_TOKEN) {
|
|
15
|
+
throw new Error('required env TRAY_API_TOKEN is not set');
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
const isApiUrlValid = () => {
|
|
19
|
+
const apiUrl = process.env.TRAY_API_URL;
|
|
20
|
+
const validApiUrlRegex = /^https:\/\/api\.(?:ap1\.|eu1\.|staging\.)?tray\.io$/;
|
|
21
|
+
if (!validApiUrlRegex.test(apiUrl)) {
|
|
22
|
+
throw new Error(`TRAY_API_URL is invalid. It should be one of the following: https://api.tray.io, https://api.ap1.tray.io, https://api.eu1.tray.io`);
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
const isValidApiToken = () => {
|
|
26
|
+
let apiToken = process.env.TRAY_API_TOKEN;
|
|
27
|
+
if (apiToken.includes('Bearer ') || apiToken.includes('bearer ')) {
|
|
28
|
+
apiToken = apiToken.replace(/Bearer |bearer /, '');
|
|
29
|
+
process.env.TRAY_API_TOKEN = apiToken;
|
|
30
|
+
}
|
|
31
|
+
const validApiTokenRegex = /^.{36,}$/; // Token length is atleast 36 characters
|
|
32
|
+
if (!validApiTokenRegex.test(apiToken)) {
|
|
33
|
+
throw new Error(`TRAY_API_TOKEN is in a invalid format.`);
|
|
34
|
+
}
|
|
35
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"check-env.unit.test.d.ts","sourceRoot":"","sources":["../../src/utils/check-env.unit.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const check_env_1 = require("./check-env");
|
|
4
|
+
describe('checkEnv', () => {
|
|
5
|
+
const subject = check_env_1.checkEnv;
|
|
6
|
+
const { env } = process;
|
|
7
|
+
afterEach(() => {
|
|
8
|
+
process.env = env;
|
|
9
|
+
});
|
|
10
|
+
it('should throw an error if TRAY_API_URL is not set', () => {
|
|
11
|
+
expect(() => subject()).toThrowError('required env TRAY_API_URL is not set');
|
|
12
|
+
});
|
|
13
|
+
it('should throw an error if TRAY_API_TOKEN is not set', () => {
|
|
14
|
+
process.env = { TRAY_API_URL: 'https://api.tray.io' };
|
|
15
|
+
expect(() => subject()).toThrowError('required env TRAY_API_TOKEN is not set');
|
|
16
|
+
});
|
|
17
|
+
it('should throw an error if TRAY_API_URL is invalid', () => {
|
|
18
|
+
process.env = {
|
|
19
|
+
TRAY_API_URL: 'https://api.tray.io/invalid',
|
|
20
|
+
TRAY_API_TOKEN: 'random',
|
|
21
|
+
};
|
|
22
|
+
expect(() => subject()).toThrowError('TRAY_API_URL is invalid. It should be one of the following: https://api.tray.io, https://api.ap1.tray.io, https://api.eu1.tray.io');
|
|
23
|
+
});
|
|
24
|
+
it('should remove bearer prefix if TRAY_API_TOKEN contains Bearer prefix', () => {
|
|
25
|
+
process.env = {
|
|
26
|
+
TRAY_API_URL: 'https://api.tray.io',
|
|
27
|
+
TRAY_API_TOKEN: 'Bearer 1234567890123456789012345678901234567890123456789012345678901234',
|
|
28
|
+
};
|
|
29
|
+
subject();
|
|
30
|
+
expect(process.env.TRAY_API_TOKEN).toEqual('1234567890123456789012345678901234567890123456789012345678901234');
|
|
31
|
+
});
|
|
32
|
+
it('should throw an error if TRAY_API_TOKEN is in an invalid format', () => {
|
|
33
|
+
process.env = {
|
|
34
|
+
TRAY_API_URL: 'https://api.tray.io',
|
|
35
|
+
TRAY_API_TOKEN: '123',
|
|
36
|
+
};
|
|
37
|
+
expect(() => subject()).toThrowError('TRAY_API_TOKEN is in a invalid format.');
|
|
38
|
+
});
|
|
39
|
+
it('should not throw an error if TRAY_API_URL and TRAY_API_TOKEN are valid', () => {
|
|
40
|
+
process.env = {
|
|
41
|
+
TRAY_API_URL: 'https://api.tray.io',
|
|
42
|
+
TRAY_API_TOKEN: '1234567890123456789012345678901234567890123456789012345678901234',
|
|
43
|
+
};
|
|
44
|
+
expect(() => subject()).not.toThrowError();
|
|
45
|
+
});
|
|
46
|
+
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export declare const success: (message: string) =>
|
|
2
|
-
export declare const error: (message: string) =>
|
|
3
|
-
export declare const warning: (message: string) =>
|
|
4
|
-
export declare const info: (message: string) =>
|
|
1
|
+
export declare const success: (message: string) => string;
|
|
2
|
+
export declare const error: (message: string) => string;
|
|
3
|
+
export declare const warning: (message: string) => string;
|
|
4
|
+
export declare const info: (message: string) => string;
|
|
5
5
|
//# sourceMappingURL=colorizeString.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"colorizeString.d.ts","sourceRoot":"","sources":["../../src/utils/colorizeString.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"colorizeString.d.ts","sourceRoot":"","sources":["../../src/utils/colorizeString.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,OAAO,YAAa,MAAM,WAAqC,CAAC;AAE7E,eAAO,MAAM,KAAK,YAAa,MAAM,WAAmC,CAAC;AAEzE,eAAO,MAAM,OAAO,YAAa,MAAM,WAAsC,CAAC;AAE9E,eAAO,MAAM,IAAI,YAAa,MAAM,WAAoC,CAAC"}
|
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
6
|
exports.info = exports.warning = exports.error = exports.success = void 0;
|
|
4
|
-
|
|
5
|
-
const
|
|
6
|
-
const success = (message) => chalk.bold(chalk.green(message));
|
|
7
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
8
|
+
const success = (message) => chalk_1.default.bold(chalk_1.default.green(message));
|
|
7
9
|
exports.success = success;
|
|
8
|
-
const error = (message) =>
|
|
10
|
+
const error = (message) => chalk_1.default.bold(chalk_1.default.red(message));
|
|
9
11
|
exports.error = error;
|
|
10
|
-
const warning = (message) =>
|
|
12
|
+
const warning = (message) => chalk_1.default.bold(chalk_1.default.yellow(message));
|
|
11
13
|
exports.warning = warning;
|
|
12
|
-
const info = (message) =>
|
|
14
|
+
const info = (message) => chalk_1.default.bold(chalk_1.default.blue(message));
|
|
13
15
|
exports.info = info;
|
package/oclif.manifest.json
CHANGED
|
@@ -111,6 +111,37 @@
|
|
|
111
111
|
"deployment-status.js"
|
|
112
112
|
]
|
|
113
113
|
},
|
|
114
|
+
"import-openapi-spec-tst": {
|
|
115
|
+
"aliases": [],
|
|
116
|
+
"args": {
|
|
117
|
+
"openApiSpec": {
|
|
118
|
+
"description": "Location of the OpenAPI specification file",
|
|
119
|
+
"name": "openApiSpec",
|
|
120
|
+
"required": false
|
|
121
|
+
},
|
|
122
|
+
"connectorName": {
|
|
123
|
+
"description": "The name of the connector",
|
|
124
|
+
"name": "connectorName",
|
|
125
|
+
"required": false
|
|
126
|
+
}
|
|
127
|
+
},
|
|
128
|
+
"description": "Create a connector from an OpenAPI specification: Command is still in BETA",
|
|
129
|
+
"flags": {},
|
|
130
|
+
"hasDynamicHelp": false,
|
|
131
|
+
"hiddenAliases": [],
|
|
132
|
+
"id": "import-openapi-spec-tst",
|
|
133
|
+
"pluginAlias": "@trayio/cdk-cli",
|
|
134
|
+
"pluginName": "@trayio/cdk-cli",
|
|
135
|
+
"pluginType": "core",
|
|
136
|
+
"strict": true,
|
|
137
|
+
"enableJsonFlag": false,
|
|
138
|
+
"isESM": false,
|
|
139
|
+
"relativePath": [
|
|
140
|
+
"dist",
|
|
141
|
+
"commands",
|
|
142
|
+
"import-openapi-spec-tst.js"
|
|
143
|
+
]
|
|
144
|
+
},
|
|
114
145
|
"import-openapi-spec": {
|
|
115
146
|
"aliases": [],
|
|
116
147
|
"args": {
|
|
@@ -228,5 +259,5 @@
|
|
|
228
259
|
]
|
|
229
260
|
}
|
|
230
261
|
},
|
|
231
|
-
"version": "0.0.
|
|
262
|
+
"version": "0.0.4-beta"
|
|
232
263
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@trayio/cdk-cli",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.4-beta",
|
|
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": "0.0.
|
|
23
|
-
"@trayio/cdk-build": "0.0.
|
|
24
|
-
"@trayio/commons": "0.0.
|
|
25
|
-
"@trayio/generator": "0.0.
|
|
26
|
-
"@trayio/tray-client": "0.0.
|
|
27
|
-
"@trayio/tray-openapi": "0.0.
|
|
22
|
+
"@trayio/axios": "0.0.4-beta",
|
|
23
|
+
"@trayio/cdk-build": "0.0.4-beta",
|
|
24
|
+
"@trayio/commons": "0.0.4-beta",
|
|
25
|
+
"@trayio/generator": "0.0.4-beta",
|
|
26
|
+
"@trayio/tray-client": "0.0.4-beta",
|
|
27
|
+
"@trayio/tray-openapi": "0.0.4-beta",
|
|
28
28
|
"@types/inquirer": "8.2.6",
|
|
29
29
|
"chalk": "4.1.2",
|
|
30
30
|
"inquirer": "8.2.5"
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"deployment-status.test.d.ts","sourceRoot":"","sources":["../../src/commands/deployment-status.test.ts"],"names":[],"mappings":""}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|