@trayio/cdk-cli 0.0.5 → 0.0.6

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
@@ -24,7 +24,7 @@ $ npm install -g @trayio/cdk-cli
24
24
  $ tray-cdk COMMAND
25
25
  running command...
26
26
  $ tray-cdk (--version|-v)
27
- @trayio/cdk-cli/0.0.5 darwin-x64 node-v18.16.0
27
+ @trayio/cdk-cli/0.0.6 linux-x64 node-v18.16.1
28
28
  $ tray-cdk --help [COMMAND]
29
29
  USAGE
30
30
  $ tray-cdk COMMAND
@@ -0,0 +1,11 @@
1
+ import { Command } from '@oclif/core';
2
+ export declare const titleCase: (value: string) => string;
3
+ export declare const pascalCase: (value: string) => string;
4
+ export default class ConnectorInit extends Command {
5
+ static description: string;
6
+ static args: {
7
+ connectorName: import("@oclif/core/lib/interfaces/parser").Arg<string | undefined, Record<string, unknown>>;
8
+ };
9
+ run(): Promise<void>;
10
+ }
11
+ //# sourceMappingURL=init.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../src/connector/init.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAQ,MAAM,aAAa,CAAC;AAc5C,eAAO,MAAM,SAAS,UAAW,MAAM,KAAG,MACQ,CAAC;AAEnD,eAAO,MAAM,UAAU,UAAW,MAAM,KAAG,MACd,CAAC;AAE9B,MAAM,CAAC,OAAO,OAAO,aAAc,SAAQ,OAAO;IACjD,MAAM,CAAC,WAAW,SAAoC;IAEtD,MAAM,CAAC,IAAI;;MAMT;IAEI,GAAG;CAyBT"}
@@ -0,0 +1,61 @@
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
+ exports.pascalCase = exports.titleCase = void 0;
16
+ const core_1 = require("@oclif/core");
17
+ const inquirer_1 = __importDefault(require("inquirer"));
18
+ const chalk_1 = __importDefault(require("chalk"));
19
+ const NodeFsGenerator_1 = require("@trayio/tray-generator/generator/NodeFsGenerator");
20
+ const path_1 = require("path");
21
+ const lodash_1 = require("lodash");
22
+ // TODO add to try-common in ts-modules
23
+ const titleCase = (value) => (0, lodash_1.capitalize)((0, lodash_1.startCase)(value).replace(/_|-/g, ' '));
24
+ exports.titleCase = titleCase;
25
+ const pascalCase = (value) => (0, lodash_1.upperFirst)((0, lodash_1.camelCase)(value));
26
+ exports.pascalCase = pascalCase;
27
+ class ConnectorInit extends core_1.Command {
28
+ run() {
29
+ return __awaiter(this, void 0, void 0, function* () {
30
+ const { args } = yield this.parse(ConnectorInit);
31
+ const promptRes = yield inquirer_1.default.prompt([
32
+ {
33
+ name: 'connectorName',
34
+ message: 'Connector directory name to generate template files',
35
+ type: 'input',
36
+ when: !args.connectorName,
37
+ default: 'my-connector',
38
+ },
39
+ ]);
40
+ const connectorName = (0, lodash_1.kebabCase)(args.connectorName || promptRes.connectorName);
41
+ const connectorTitle = (0, exports.titleCase)(connectorName);
42
+ const rootDir = __dirname;
43
+ const templatePath = (0, path_1.join)(rootDir, 'connector-template.zip');
44
+ const generator = new NodeFsGenerator_1.NodeFsGenerator();
45
+ yield generator.generate(templatePath, process.cwd(), {
46
+ connectorName,
47
+ connectorTitle,
48
+ })();
49
+ this.log(chalk_1.default.bold(chalk_1.default.green(`Success! Added ${connectorName}`)));
50
+ });
51
+ }
52
+ }
53
+ ConnectorInit.description = 'Initialize a connector project';
54
+ ConnectorInit.args = {
55
+ connectorName: core_1.Args.string({
56
+ name: 'Connector directory name',
57
+ required: false,
58
+ description: 'Connector directory name to generate template files',
59
+ }),
60
+ };
61
+ exports.default = ConnectorInit;
@@ -0,0 +1,12 @@
1
+ import { Command } from '@oclif/core';
2
+ export declare const titleCase: (value: string) => string;
3
+ export declare const pascalCase: (value: string) => string;
4
+ export default class ConnectorOperationAdd extends Command {
5
+ static description: string;
6
+ static args: {
7
+ operationName: import("@oclif/core/lib/interfaces/parser").Arg<string | undefined, Record<string, unknown>>;
8
+ operationType: import("@oclif/core/lib/interfaces/parser").Arg<string | undefined, Record<string, unknown>>;
9
+ };
10
+ run(): Promise<void>;
11
+ }
12
+ //# sourceMappingURL=add.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"add.d.ts","sourceRoot":"","sources":["../../../src/connector/operation/add.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAQ,MAAM,aAAa,CAAC;AAc5C,eAAO,MAAM,SAAS,UAAW,MAAM,KAAG,MACQ,CAAC;AAEnD,eAAO,MAAM,UAAU,UAAW,MAAM,KAAG,MACd,CAAC;AAE9B,MAAM,CAAC,OAAO,OAAO,qBAAsB,SAAQ,OAAO;IACzD,MAAM,CAAC,WAAW,SAA2C;IAE7D,MAAM,CAAC,IAAI;;;MAYT;IAEI,GAAG;CA6CT"}
@@ -0,0 +1,84 @@
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
+ exports.pascalCase = exports.titleCase = void 0;
16
+ const core_1 = require("@oclif/core");
17
+ const inquirer_1 = __importDefault(require("inquirer"));
18
+ const chalk_1 = __importDefault(require("chalk"));
19
+ const NodeFsGenerator_1 = require("@trayio/tray-generator/generator/NodeFsGenerator");
20
+ const path_1 = require("path");
21
+ const lodash_1 = require("lodash");
22
+ // TODO add to try-common in ts-modules
23
+ const titleCase = (value) => (0, lodash_1.capitalize)((0, lodash_1.startCase)(value).replace(/_|-/g, ' '));
24
+ exports.titleCase = titleCase;
25
+ const pascalCase = (value) => (0, lodash_1.upperFirst)((0, lodash_1.camelCase)(value));
26
+ exports.pascalCase = pascalCase;
27
+ class ConnectorOperationAdd extends core_1.Command {
28
+ run() {
29
+ return __awaiter(this, void 0, void 0, function* () {
30
+ const { args } = yield this.parse(ConnectorOperationAdd);
31
+ const promptRes = yield inquirer_1.default.prompt([
32
+ {
33
+ name: 'operationName',
34
+ message: 'Operation name',
35
+ type: 'input',
36
+ when: !args.operationName,
37
+ default: 'MyOperation',
38
+ },
39
+ {
40
+ name: 'operationType',
41
+ message: 'Operation type',
42
+ type: 'list',
43
+ choices: [
44
+ { name: 'HTTP', value: 'http' },
45
+ { name: 'Composite', value: 'composite' },
46
+ ],
47
+ when: !args.operationType,
48
+ default: 'http',
49
+ },
50
+ ]);
51
+ const operationName = (0, exports.pascalCase)(args.operationName || promptRes.operationName);
52
+ const operationDirectory = (0, lodash_1.kebabCase)(operationName);
53
+ const operationTitle = (0, exports.titleCase)(operationName);
54
+ const operationType = args.operationType || promptRes.operationType;
55
+ const rootDir = __dirname;
56
+ const templatePath = operationType === 'http'
57
+ ? (0, path_1.join)(rootDir, 'http-operation-template.zip')
58
+ : (0, path_1.join)(rootDir, 'composite-operation-template.zip');
59
+ const generator = new NodeFsGenerator_1.NodeFsGenerator();
60
+ // TODO should we check if we are inside the src dir?
61
+ yield generator.generate(templatePath, process.cwd(), {
62
+ operationName,
63
+ operationTitle,
64
+ operationDirectory,
65
+ })();
66
+ this.log(chalk_1.default.bold(chalk_1.default.green(`Success! Added operation: ${operationName}`)));
67
+ });
68
+ }
69
+ }
70
+ ConnectorOperationAdd.description = 'Add an operation to connector project';
71
+ ConnectorOperationAdd.args = {
72
+ operationName: core_1.Args.string({
73
+ name: 'Operation name',
74
+ required: false,
75
+ description: 'Operation name',
76
+ }),
77
+ operationType: core_1.Args.string({
78
+ name: 'Operation type',
79
+ required: false,
80
+ description: 'Operation type',
81
+ options: ['http', 'composite'],
82
+ }),
83
+ };
84
+ exports.default = ConnectorOperationAdd;
@@ -0,0 +1,2 @@
1
+ export { run } from '@oclif/core';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,aAAa,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.run = void 0;
4
+ var core_1 = require("@oclif/core");
5
+ Object.defineProperty(exports, "run", { enumerable: true, get: function () { return core_1.run; } });
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "0.0.5",
2
+ "version": "0.0.6",
3
3
  "commands": {
4
4
  ".": {
5
5
  "id": ".",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trayio/cdk-cli",
3
- "version": "0.0.5",
3
+ "version": "0.0.6",
4
4
  "description": "A collection of CLI commands for connector development.",
5
5
  "exports": {
6
6
  "./*": "./dist/*.js"