nestia 2.0.7 → 2.0.8-dev.20220414

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.
@@ -6,7 +6,7 @@ jobs:
6
6
  runs-on: ${{ matrix.os }}
7
7
  strategy:
8
8
  matrix:
9
- os: [ubuntu-latest, windows-latest, macos-latest]
9
+ os: [windows-latest, macos-latest, ubuntu-latest]
10
10
  steps:
11
11
  - uses: actions/checkout@v1
12
12
  - uses: actions/setup-node@v1
@@ -0,0 +1,4 @@
1
+ export declare namespace NestiaSdkCli {
2
+ function main(elements: string[]): Promise<void>;
3
+ }
4
+ //# sourceMappingURL=NestiaSdkCli.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"NestiaSdkCli.d.ts","sourceRoot":"","sources":["../../../src/executable/internal/NestiaSdkCli.ts"],"names":[],"mappings":"AAiBA,yBAAiB,YAAY,CAC7B;IACI,SAAsB,IAAI,CAAC,QAAQ,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAe5D;CAwDJ"}
@@ -0,0 +1,201 @@
1
+ "use strict";
2
+ var __assign = (this && this.__assign) || function () {
3
+ __assign = Object.assign || function(t) {
4
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
5
+ s = arguments[i];
6
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
+ t[p] = s[p];
8
+ }
9
+ return t;
10
+ };
11
+ return __assign.apply(this, arguments);
12
+ };
13
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
14
+ if (k2 === undefined) k2 = k;
15
+ var desc = Object.getOwnPropertyDescriptor(m, k);
16
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
17
+ desc = { enumerable: true, get: function() { return m[k]; } };
18
+ }
19
+ Object.defineProperty(o, k2, desc);
20
+ }) : (function(o, m, k, k2) {
21
+ if (k2 === undefined) k2 = k;
22
+ o[k2] = m[k];
23
+ }));
24
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
25
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
26
+ }) : function(o, v) {
27
+ o["default"] = v;
28
+ });
29
+ var __importStar = (this && this.__importStar) || function (mod) {
30
+ if (mod && mod.__esModule) return mod;
31
+ var result = {};
32
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
33
+ __setModuleDefault(result, mod);
34
+ return result;
35
+ };
36
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
37
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
38
+ return new (P || (P = Promise))(function (resolve, reject) {
39
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
40
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
41
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
42
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
43
+ });
44
+ };
45
+ var __generator = (this && this.__generator) || function (thisArg, body) {
46
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
47
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
48
+ function verb(n) { return function (v) { return step([n, v]); }; }
49
+ function step(op) {
50
+ if (f) throw new TypeError("Generator is already executing.");
51
+ while (_) try {
52
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
53
+ if (y = 0, t) op = [op[0] & 2, t.value];
54
+ switch (op[0]) {
55
+ case 0: case 1: t = op; break;
56
+ case 4: _.label++; return { value: op[1], done: false };
57
+ case 5: _.label++; y = op[1]; op = [0]; continue;
58
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
59
+ default:
60
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
61
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
62
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
63
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
64
+ if (t[2]) _.ops.pop();
65
+ _.trys.pop(); continue;
66
+ }
67
+ op = body.call(thisArg, _);
68
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
69
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
70
+ }
71
+ };
72
+ var __values = (this && this.__values) || function(o) {
73
+ var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
74
+ if (m) return m.call(o);
75
+ if (o && typeof o.length === "number") return {
76
+ next: function () {
77
+ if (o && i >= o.length) o = void 0;
78
+ return { value: o && o[i++], done: !o };
79
+ }
80
+ };
81
+ throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
82
+ };
83
+ var __importDefault = (this && this.__importDefault) || function (mod) {
84
+ return (mod && mod.__esModule) ? mod : { "default": mod };
85
+ };
86
+ Object.defineProperty(exports, "__esModule", { value: true });
87
+ exports.NestiaSdkCli = void 0;
88
+ var cli = __importStar(require("cli"));
89
+ var fs = __importStar(require("fs"));
90
+ var path = __importStar(require("path"));
91
+ var jsonc_simple_parser_1 = __importDefault(require("jsonc-simple-parser"));
92
+ var WorkerConnector_1 = require("tgrid/protocols/workers/WorkerConnector");
93
+ var NestiaApplication_1 = require("../../NestiaApplication");
94
+ var NestiaSdkCli;
95
+ (function (NestiaSdkCli) {
96
+ function main(elements) {
97
+ return __awaiter(this, void 0, void 0, function () {
98
+ var command, inputs, elements_1, elements_1_1, arg;
99
+ var e_1, _a;
100
+ return __generator(this, function (_b) {
101
+ switch (_b.label) {
102
+ case 0:
103
+ command = cli.parse({
104
+ exclude: ["e", "Something to exclude", "string", null],
105
+ out: ["o", "Output path of the SDK files", "string", null],
106
+ });
107
+ inputs = [];
108
+ try {
109
+ for (elements_1 = __values(elements), elements_1_1 = elements_1.next(); !elements_1_1.done; elements_1_1 = elements_1.next()) {
110
+ arg = elements_1_1.value;
111
+ if (arg[0] === "-")
112
+ break;
113
+ inputs.push(arg);
114
+ }
115
+ }
116
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
117
+ finally {
118
+ try {
119
+ if (elements_1_1 && !elements_1_1.done && (_a = elements_1.return)) _a.call(elements_1);
120
+ }
121
+ finally { if (e_1) throw e_1.error; }
122
+ }
123
+ return [4 /*yield*/, generate(inputs, command)];
124
+ case 1:
125
+ _b.sent();
126
+ return [2 /*return*/];
127
+ }
128
+ });
129
+ });
130
+ }
131
+ NestiaSdkCli.main = main;
132
+ function generate(include, command) {
133
+ return __awaiter(this, void 0, void 0, function () {
134
+ var config, parentPath, parentStats, content, options, app;
135
+ return __generator(this, function (_a) {
136
+ switch (_a.label) {
137
+ case 0: return [4 /*yield*/, get_nestia_config()];
138
+ case 1:
139
+ config = _a.sent();
140
+ if (config === null) {
141
+ if (command.out === null)
142
+ throw new Error("Output directory is not specified. Add the \"--out <output_directory>\" option.");
143
+ config = {
144
+ input: {
145
+ include: include,
146
+ exclude: command.exclude
147
+ ? [command.exclude]
148
+ : undefined
149
+ },
150
+ output: command.out
151
+ };
152
+ }
153
+ parentPath = path.resolve(config.output + "/..");
154
+ return [4 /*yield*/, fs.promises.stat(parentPath)];
155
+ case 2:
156
+ parentStats = _a.sent();
157
+ if (parentStats.isDirectory() === false)
158
+ throw new Error("Unable to find parent directory of the output path: \"".concat(parentPath, "\"."));
159
+ if (!(fs.existsSync("tsconfig.json") === true)) return [3 /*break*/, 4];
160
+ return [4 /*yield*/, fs.promises.readFile("tsconfig.json", "utf8")];
161
+ case 3:
162
+ content = _a.sent();
163
+ options = jsonc_simple_parser_1.default.parse(content).compilerOptions;
164
+ config.compilerOptions = __assign(__assign({}, options), (config.compilerOptions || {}));
165
+ _a.label = 4;
166
+ case 4:
167
+ app = new NestiaApplication_1.NestiaApplication(config);
168
+ return [4 /*yield*/, app.generate()];
169
+ case 5:
170
+ _a.sent();
171
+ return [2 /*return*/];
172
+ }
173
+ });
174
+ });
175
+ }
176
+ function get_nestia_config() {
177
+ return __awaiter(this, void 0, void 0, function () {
178
+ var connector, driver, config;
179
+ return __generator(this, function (_a) {
180
+ switch (_a.label) {
181
+ case 0:
182
+ connector = new WorkerConnector_1.WorkerConnector(null, null, "process");
183
+ return [4 /*yield*/, connector.connect("".concat(__dirname, "/nestia.config.getter.").concat(__filename.substr(-2)))];
184
+ case 1:
185
+ _a.sent();
186
+ return [4 /*yield*/, connector.getDriver()];
187
+ case 2:
188
+ driver = _a.sent();
189
+ return [4 /*yield*/, driver.get()];
190
+ case 3:
191
+ config = _a.sent();
192
+ return [4 /*yield*/, connector.close()];
193
+ case 4:
194
+ _a.sent();
195
+ return [2 /*return*/, config];
196
+ }
197
+ });
198
+ });
199
+ }
200
+ })(NestiaSdkCli = exports.NestiaSdkCli || (exports.NestiaSdkCli = {}));
201
+ //# sourceMappingURL=NestiaSdkCli.js.map
@@ -97,7 +97,7 @@ function sdk() {
97
97
  switch (_a.label) {
98
98
  case 0:
99
99
  // EXECUTE THE COMMAND, BUT IGNORE WARNINGS
100
- return [4 /*yield*/, Promise.resolve().then(function () { return __importStar(require("".concat(__dirname, "/sdk.js"))); })];
100
+ return [4 /*yield*/, Promise.resolve().then(function () { return __importStar(require("".concat(__dirname, "/sdk.").concat(__filename.substr(-2)))); })];
101
101
  case 1:
102
102
  // EXECUTE THE COMMAND, BUT IGNORE WARNINGS
103
103
  _a.sent();
@@ -1,206 +1,8 @@
1
1
  "use strict";
2
- var __assign = (this && this.__assign) || function () {
3
- __assign = Object.assign || function(t) {
4
- for (var s, i = 1, n = arguments.length; i < n; i++) {
5
- s = arguments[i];
6
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
- t[p] = s[p];
8
- }
9
- return t;
10
- };
11
- return __assign.apply(this, arguments);
12
- };
13
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
14
- if (k2 === undefined) k2 = k;
15
- var desc = Object.getOwnPropertyDescriptor(m, k);
16
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
17
- desc = { enumerable: true, get: function() { return m[k]; } };
18
- }
19
- Object.defineProperty(o, k2, desc);
20
- }) : (function(o, m, k, k2) {
21
- if (k2 === undefined) k2 = k;
22
- o[k2] = m[k];
23
- }));
24
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
25
- Object.defineProperty(o, "default", { enumerable: true, value: v });
26
- }) : function(o, v) {
27
- o["default"] = v;
28
- });
29
- var __importStar = (this && this.__importStar) || function (mod) {
30
- if (mod && mod.__esModule) return mod;
31
- var result = {};
32
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
33
- __setModuleDefault(result, mod);
34
- return result;
35
- };
36
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
37
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
38
- return new (P || (P = Promise))(function (resolve, reject) {
39
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
40
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
41
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
42
- step((generator = generator.apply(thisArg, _arguments || [])).next());
43
- });
44
- };
45
- var __generator = (this && this.__generator) || function (thisArg, body) {
46
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
47
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
48
- function verb(n) { return function (v) { return step([n, v]); }; }
49
- function step(op) {
50
- if (f) throw new TypeError("Generator is already executing.");
51
- while (_) try {
52
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
53
- if (y = 0, t) op = [op[0] & 2, t.value];
54
- switch (op[0]) {
55
- case 0: case 1: t = op; break;
56
- case 4: _.label++; return { value: op[1], done: false };
57
- case 5: _.label++; y = op[1]; op = [0]; continue;
58
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
59
- default:
60
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
61
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
62
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
63
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
64
- if (t[2]) _.ops.pop();
65
- _.trys.pop(); continue;
66
- }
67
- op = body.call(thisArg, _);
68
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
69
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
70
- }
71
- };
72
- var __values = (this && this.__values) || function(o) {
73
- var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
74
- if (m) return m.call(o);
75
- if (o && typeof o.length === "number") return {
76
- next: function () {
77
- if (o && i >= o.length) o = void 0;
78
- return { value: o && o[i++], done: !o };
79
- }
80
- };
81
- throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
82
- };
83
- var __importDefault = (this && this.__importDefault) || function (mod) {
84
- return (mod && mod.__esModule) ? mod : { "default": mod };
85
- };
86
2
  Object.defineProperty(exports, "__esModule", { value: true });
87
- var cli = __importStar(require("cli"));
88
- var fs = __importStar(require("fs"));
89
- var path = __importStar(require("path"));
90
- var jsonc_simple_parser_1 = __importDefault(require("jsonc-simple-parser"));
91
- var WorkerConnector_1 = require("tgrid/protocols/workers/WorkerConnector");
92
- var NestiaApplication_1 = require("../NestiaApplication");
93
- function get_nestia_config() {
94
- return __awaiter(this, void 0, void 0, function () {
95
- var connector, driver, config;
96
- return __generator(this, function (_a) {
97
- switch (_a.label) {
98
- case 0:
99
- connector = new WorkerConnector_1.WorkerConnector(null, null, "process");
100
- return [4 /*yield*/, connector.connect(__dirname + "/internal/nestia.config.getter.js")];
101
- case 1:
102
- _a.sent();
103
- return [4 /*yield*/, connector.getDriver()];
104
- case 2:
105
- driver = _a.sent();
106
- return [4 /*yield*/, driver.get()];
107
- case 3:
108
- config = _a.sent();
109
- return [4 /*yield*/, connector.close()];
110
- case 4:
111
- _a.sent();
112
- return [2 /*return*/, config];
113
- }
114
- });
115
- });
116
- }
117
- function generate(include, command) {
118
- return __awaiter(this, void 0, void 0, function () {
119
- var config, parentPath, parentStats, content, options, app;
120
- return __generator(this, function (_a) {
121
- switch (_a.label) {
122
- case 0: return [4 /*yield*/, get_nestia_config()];
123
- case 1:
124
- config = _a.sent();
125
- if (config === null) {
126
- if (command.out === null)
127
- throw new Error("Output directory is not specified. Add the \"--out <output_directory>\" option.");
128
- config = {
129
- input: {
130
- include: include,
131
- exclude: command.exclude
132
- ? [command.exclude]
133
- : undefined
134
- },
135
- output: command.out
136
- };
137
- }
138
- parentPath = path.resolve(config.output + "/..");
139
- return [4 /*yield*/, fs.promises.stat(parentPath)];
140
- case 2:
141
- parentStats = _a.sent();
142
- if (parentStats.isDirectory() === false)
143
- throw new Error("Unable to find parent directory of the output path: \"".concat(parentPath, "\"."));
144
- if (!(fs.existsSync("tsconfig.json") === true)) return [3 /*break*/, 4];
145
- return [4 /*yield*/, fs.promises.readFile("tsconfig.json", "utf8")];
146
- case 3:
147
- content = _a.sent();
148
- options = jsonc_simple_parser_1.default.parse(content).compilerOptions;
149
- config.compilerOptions = __assign(__assign({}, options), (config.compilerOptions || {}));
150
- _a.label = 4;
151
- case 4:
152
- app = new NestiaApplication_1.NestiaApplication(config);
153
- return [4 /*yield*/, app.generate()];
154
- case 5:
155
- _a.sent();
156
- return [2 /*return*/];
157
- }
158
- });
159
- });
160
- }
161
- function main() {
162
- return __awaiter(this, void 0, void 0, function () {
163
- var command, inputs, _a, _b, arg, exp_1;
164
- var e_1, _c;
165
- return __generator(this, function (_d) {
166
- switch (_d.label) {
167
- case 0:
168
- command = cli.parse({
169
- exclude: ["e", "Something to exclude", "string", null],
170
- out: ["o", "Output path of the SDK files", "string", null],
171
- });
172
- _d.label = 1;
173
- case 1:
174
- _d.trys.push([1, 3, , 4]);
175
- inputs = [];
176
- try {
177
- for (_a = __values(process.argv.slice(2)), _b = _a.next(); !_b.done; _b = _a.next()) {
178
- arg = _b.value;
179
- if (arg[0] === "-")
180
- break;
181
- inputs.push(arg);
182
- }
183
- }
184
- catch (e_1_1) { e_1 = { error: e_1_1 }; }
185
- finally {
186
- try {
187
- if (_b && !_b.done && (_c = _a.return)) _c.call(_a);
188
- }
189
- finally { if (e_1) throw e_1.error; }
190
- }
191
- return [4 /*yield*/, generate(inputs, command)];
192
- case 2:
193
- _d.sent();
194
- return [3 /*break*/, 4];
195
- case 3:
196
- exp_1 = _d.sent();
197
- console.log(exp_1);
198
- process.exit(-1);
199
- return [3 /*break*/, 4];
200
- case 4: return [2 /*return*/];
201
- }
202
- });
203
- });
204
- }
205
- main();
3
+ var NestiaSdkCli_1 = require("./internal/NestiaSdkCli");
4
+ NestiaSdkCli_1.NestiaSdkCli.main(process.argv.slice(3)).catch(function (exp) {
5
+ console.log(exp);
6
+ process.exit(-1);
7
+ });
206
8
  //# sourceMappingURL=sdk.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nestia",
3
- "version": "2.0.7",
3
+ "version": "2.0.8-dev.20220414",
4
4
  "description": "Automatic SDK and Document generator for the NestJS",
5
5
  "main": "lib/index.js",
6
6
  "typings": "lib/index.d.ts",