nestia 3.0.15 → 3.0.16-dev.20220930
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/lib/IConfiguration.d.ts +110 -110
- package/lib/IConfiguration.js +2 -2
- package/lib/NestiaApplication.d.ts +11 -11
- package/lib/NestiaApplication.js +155 -155
- package/lib/analyses/ControllerAnalyzer.d.ts +6 -6
- package/lib/analyses/ControllerAnalyzer.js +105 -105
- package/lib/analyses/GenericAnalyzer.d.ts +5 -5
- package/lib/analyses/GenericAnalyzer.js +40 -40
- package/lib/analyses/ImportAnalyzer.d.ts +13 -13
- package/lib/analyses/ImportAnalyzer.js +83 -83
- package/lib/analyses/PathAnalyzer.d.ts +5 -5
- package/lib/analyses/PathAnalyzer.js +50 -50
- package/lib/analyses/ReflectAnalyzer.d.ts +4 -4
- package/lib/analyses/ReflectAnalyzer.js +229 -229
- package/lib/analyses/SourceFinder.d.ts +4 -4
- package/lib/analyses/SourceFinder.js +69 -69
- package/lib/executable/internal/CompilerOptions.d.ts +11 -11
- package/lib/executable/internal/CompilerOptions.js +17 -17
- package/lib/executable/internal/NestiaCommand.d.ts +4 -4
- package/lib/executable/internal/NestiaCommand.js +127 -127
- package/lib/executable/internal/NestiaConfig.d.ts +4 -4
- package/lib/executable/internal/NestiaConfig.js +521 -521
- package/lib/executable/internal/nestia.config.getter.d.ts +1 -1
- package/lib/executable/internal/nestia.config.getter.js +23 -23
- package/lib/executable/nestia.d.ts +2 -2
- package/lib/executable/nestia.js +54 -54
- package/lib/generates/FileGenerator.d.ts +5 -5
- package/lib/generates/FileGenerator.js +136 -136
- package/lib/generates/FunctionGenerator.d.ts +5 -5
- package/lib/generates/FunctionGenerator.js +203 -203
- package/lib/generates/SdkGenerator.d.ts +7 -7
- package/lib/generates/SdkGenerator.js +46 -46
- package/lib/generates/SwaggerGenerator.d.ts +6 -6
- package/lib/generates/SwaggerGenerator.js +235 -235
- package/lib/index.d.ts +2 -2
- package/lib/index.js +27 -27
- package/lib/module.d.ts +2 -2
- package/lib/module.js +18 -18
- package/lib/structures/IController.d.ts +23 -23
- package/lib/structures/IController.js +2 -2
- package/lib/structures/IRoute.d.ts +24 -24
- package/lib/structures/IRoute.js +2 -2
- package/lib/structures/ISwagger.d.ts +48 -48
- package/lib/structures/ISwagger.js +2 -2
- package/lib/structures/ITypeTuple.d.ts +5 -5
- package/lib/structures/ITypeTuple.js +2 -2
- package/lib/structures/MethodType.d.ts +4 -4
- package/lib/structures/MethodType.js +13 -13
- package/lib/structures/ParamCategory.d.ts +1 -1
- package/lib/structures/ParamCategory.js +2 -2
- package/lib/structures/TypeEntry.d.ts +9 -9
- package/lib/structures/TypeEntry.js +20 -20
- package/lib/utils/ArrayUtil.d.ts +5 -5
- package/lib/utils/ArrayUtil.js +38 -38
- package/lib/utils/DirectoryUtil.d.ts +5 -5
- package/lib/utils/DirectoryUtil.js +61 -61
- package/lib/utils/ImportDictionary.d.ts +6 -6
- package/lib/utils/ImportDictionary.js +49 -49
- package/lib/utils/MapUtil.d.ts +3 -3
- package/lib/utils/MapUtil.js +15 -15
- package/lib/utils/StripEnums.d.ts +3 -3
- package/lib/utils/StripEnums.js +2 -2
- package/package.json +1 -1
- package/preliminaries/nestia.config.ts +70 -70
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.CompilerOptions = void 0;
|
|
4
|
-
var CompilerOptions;
|
|
5
|
-
(function (CompilerOptions) {
|
|
6
|
-
/* -----------------------------------------------------------
|
|
7
|
-
DEFAULT VALUES
|
|
8
|
-
----------------------------------------------------------- */
|
|
9
|
-
const ESSENTIAL_OPTIONS = {
|
|
10
|
-
types: ["node", "reflect-metadata"],
|
|
11
|
-
noEmit: true,
|
|
12
|
-
esModuleInterop: true,
|
|
13
|
-
experimentalDecorators: true,
|
|
14
|
-
emitDecoratorMetadata: true,
|
|
15
|
-
};
|
|
16
|
-
CompilerOptions.DEFAULT_OPTIONS = Object.assign(Object.assign({}, ESSENTIAL_OPTIONS), { target: "es5", module: "commonjs" });
|
|
17
|
-
})(CompilerOptions = exports.CompilerOptions || (exports.CompilerOptions = {}));
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CompilerOptions = void 0;
|
|
4
|
+
var CompilerOptions;
|
|
5
|
+
(function (CompilerOptions) {
|
|
6
|
+
/* -----------------------------------------------------------
|
|
7
|
+
DEFAULT VALUES
|
|
8
|
+
----------------------------------------------------------- */
|
|
9
|
+
const ESSENTIAL_OPTIONS = {
|
|
10
|
+
types: ["node", "reflect-metadata"],
|
|
11
|
+
noEmit: true,
|
|
12
|
+
esModuleInterop: true,
|
|
13
|
+
experimentalDecorators: true,
|
|
14
|
+
emitDecoratorMetadata: true,
|
|
15
|
+
};
|
|
16
|
+
CompilerOptions.DEFAULT_OPTIONS = Object.assign(Object.assign({}, ESSENTIAL_OPTIONS), { target: "es5", module: "commonjs" });
|
|
17
|
+
})(CompilerOptions = exports.CompilerOptions || (exports.CompilerOptions = {}));
|
|
18
18
|
//# sourceMappingURL=CompilerOptions.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare namespace NestiaCommand {
|
|
2
|
-
function sdk(elements: string[], pure?: boolean): Promise<void>;
|
|
3
|
-
function swagger(elements: string[], pure?: boolean): Promise<void>;
|
|
4
|
-
}
|
|
1
|
+
export declare namespace NestiaCommand {
|
|
2
|
+
function sdk(elements: string[], pure?: boolean): Promise<void>;
|
|
3
|
+
function swagger(elements: string[], pure?: boolean): Promise<void>;
|
|
4
|
+
}
|
|
@@ -1,128 +1,128 @@
|
|
|
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 __rest = (this && this.__rest) || function (s, e) {
|
|
12
|
-
var t = {};
|
|
13
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
14
|
-
t[p] = s[p];
|
|
15
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
16
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
17
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
18
|
-
t[p[i]] = s[p[i]];
|
|
19
|
-
}
|
|
20
|
-
return t;
|
|
21
|
-
};
|
|
22
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
23
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
24
|
-
};
|
|
25
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.NestiaCommand = void 0;
|
|
27
|
-
const cli_1 = __importDefault(require("cli"));
|
|
28
|
-
const path_1 = __importDefault(require("path"));
|
|
29
|
-
const tsconfck_1 = require("tsconfck");
|
|
30
|
-
const typescript_1 = __importDefault(require("typescript"));
|
|
31
|
-
const WorkerConnector_1 = require("tgrid/protocols/workers/WorkerConnector");
|
|
32
|
-
const NestiaApplication_1 = require("../../NestiaApplication");
|
|
33
|
-
var NestiaCommand;
|
|
34
|
-
(function (NestiaCommand) {
|
|
35
|
-
function sdk(elements, pure = true) {
|
|
36
|
-
return main((app) => app.sdk(), {
|
|
37
|
-
assign: (config, output) => (config.output = output),
|
|
38
|
-
validate: (config) => !!config.output,
|
|
39
|
-
location: (config) => config.output,
|
|
40
|
-
}, elements, pure);
|
|
41
|
-
}
|
|
42
|
-
NestiaCommand.sdk = sdk;
|
|
43
|
-
function swagger(elements, pure = true) {
|
|
44
|
-
return main((app) => app.swagger(), {
|
|
45
|
-
assign: (config, output) => {
|
|
46
|
-
if (!config.swagger)
|
|
47
|
-
config.swagger = { output };
|
|
48
|
-
else
|
|
49
|
-
config.swagger.output = output;
|
|
50
|
-
},
|
|
51
|
-
validate: (config) => !!config.swagger && !!config.swagger.output,
|
|
52
|
-
location: (config) => config.swagger.output,
|
|
53
|
-
}, elements, pure);
|
|
54
|
-
}
|
|
55
|
-
NestiaCommand.swagger = swagger;
|
|
56
|
-
function main(task, output, elements, pure) {
|
|
57
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
58
|
-
if (pure === false)
|
|
59
|
-
cli_1.default.setArgv([
|
|
60
|
-
process.argv[0],
|
|
61
|
-
process.argv[1],
|
|
62
|
-
"nestia",
|
|
63
|
-
...elements,
|
|
64
|
-
]);
|
|
65
|
-
const command = cli_1.default.parse({
|
|
66
|
-
exclude: ["e", "Something to exclude", "string", null],
|
|
67
|
-
out: ["o", "Output path of the SDK files", "string", null],
|
|
68
|
-
});
|
|
69
|
-
const inputs = [];
|
|
70
|
-
for (const arg of elements) {
|
|
71
|
-
if (arg[0] === "-")
|
|
72
|
-
break;
|
|
73
|
-
inputs.push(arg);
|
|
74
|
-
}
|
|
75
|
-
yield generate(task, inputs, command, output);
|
|
76
|
-
});
|
|
77
|
-
}
|
|
78
|
-
function generate(task, include, command, output) {
|
|
79
|
-
var _a;
|
|
80
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
81
|
-
// CONFIGURATION
|
|
82
|
-
const config = (_a = (yield get_nestia_config(output.validate))) !== null && _a !== void 0 ? _a : parse_cli(include, command, output);
|
|
83
|
-
const options = yield get_typescript_options();
|
|
84
|
-
config.compilerOptions = Object.assign(Object.assign({}, options), (config.compilerOptions || {}));
|
|
85
|
-
// CALL THE APP.GENERATE()
|
|
86
|
-
const app = new NestiaApplication_1.NestiaApplication(config);
|
|
87
|
-
yield task(app);
|
|
88
|
-
});
|
|
89
|
-
}
|
|
90
|
-
function get_typescript_options() {
|
|
91
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
92
|
-
const configFileName = typescript_1.default.findConfigFile(process.cwd(), typescript_1.default.sys.fileExists, "tsconfig.json");
|
|
93
|
-
if (!configFileName)
|
|
94
|
-
return null;
|
|
95
|
-
const { tsconfig } = yield (0, tsconfck_1.parseNative)(configFileName);
|
|
96
|
-
const configFileText = JSON.stringify(tsconfig);
|
|
97
|
-
const { config } = typescript_1.default.parseConfigFileTextToJson(configFileName, configFileText);
|
|
98
|
-
const configParseResult = typescript_1.default.parseJsonConfigFileContent(config, typescript_1.default.sys, path_1.default.dirname(configFileName));
|
|
99
|
-
const _a = configParseResult.raw.compilerOptions, { moduleResolution } = _a, result = __rest(_a, ["moduleResolution"]);
|
|
100
|
-
return result;
|
|
101
|
-
});
|
|
102
|
-
}
|
|
103
|
-
function get_nestia_config(validate) {
|
|
104
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
105
|
-
const connector = new WorkerConnector_1.WorkerConnector(null, null, "process");
|
|
106
|
-
yield connector.connect(`${__dirname}/nestia.config.getter.js`);
|
|
107
|
-
const driver = yield connector.getDriver();
|
|
108
|
-
const config = yield driver.get();
|
|
109
|
-
yield connector.close();
|
|
110
|
-
if (config !== null && validate(config) === false)
|
|
111
|
-
throw new Error(`Error on NestiaCommand.main(): output path is not specified in the "nestia.config.ts".`);
|
|
112
|
-
return config;
|
|
113
|
-
});
|
|
114
|
-
}
|
|
115
|
-
function parse_cli(include, command, output) {
|
|
116
|
-
if (command.out === null)
|
|
117
|
-
throw new Error(`Error on NestiaCommand.main(): output directory is not specified. Add the "--out <output_directory>" option.`);
|
|
118
|
-
const config = {
|
|
119
|
-
input: {
|
|
120
|
-
include,
|
|
121
|
-
exclude: command.exclude ? [command.exclude] : undefined,
|
|
122
|
-
},
|
|
123
|
-
};
|
|
124
|
-
output.assign(config, command.out);
|
|
125
|
-
return config;
|
|
126
|
-
}
|
|
127
|
-
})(NestiaCommand = exports.NestiaCommand || (exports.NestiaCommand = {}));
|
|
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 __rest = (this && this.__rest) || function (s, e) {
|
|
12
|
+
var t = {};
|
|
13
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
14
|
+
t[p] = s[p];
|
|
15
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
16
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
17
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
18
|
+
t[p[i]] = s[p[i]];
|
|
19
|
+
}
|
|
20
|
+
return t;
|
|
21
|
+
};
|
|
22
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
23
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.NestiaCommand = void 0;
|
|
27
|
+
const cli_1 = __importDefault(require("cli"));
|
|
28
|
+
const path_1 = __importDefault(require("path"));
|
|
29
|
+
const tsconfck_1 = require("tsconfck");
|
|
30
|
+
const typescript_1 = __importDefault(require("typescript"));
|
|
31
|
+
const WorkerConnector_1 = require("tgrid/protocols/workers/WorkerConnector");
|
|
32
|
+
const NestiaApplication_1 = require("../../NestiaApplication");
|
|
33
|
+
var NestiaCommand;
|
|
34
|
+
(function (NestiaCommand) {
|
|
35
|
+
function sdk(elements, pure = true) {
|
|
36
|
+
return main((app) => app.sdk(), {
|
|
37
|
+
assign: (config, output) => (config.output = output),
|
|
38
|
+
validate: (config) => !!config.output,
|
|
39
|
+
location: (config) => config.output,
|
|
40
|
+
}, elements, pure);
|
|
41
|
+
}
|
|
42
|
+
NestiaCommand.sdk = sdk;
|
|
43
|
+
function swagger(elements, pure = true) {
|
|
44
|
+
return main((app) => app.swagger(), {
|
|
45
|
+
assign: (config, output) => {
|
|
46
|
+
if (!config.swagger)
|
|
47
|
+
config.swagger = { output };
|
|
48
|
+
else
|
|
49
|
+
config.swagger.output = output;
|
|
50
|
+
},
|
|
51
|
+
validate: (config) => !!config.swagger && !!config.swagger.output,
|
|
52
|
+
location: (config) => config.swagger.output,
|
|
53
|
+
}, elements, pure);
|
|
54
|
+
}
|
|
55
|
+
NestiaCommand.swagger = swagger;
|
|
56
|
+
function main(task, output, elements, pure) {
|
|
57
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
58
|
+
if (pure === false)
|
|
59
|
+
cli_1.default.setArgv([
|
|
60
|
+
process.argv[0],
|
|
61
|
+
process.argv[1],
|
|
62
|
+
"nestia",
|
|
63
|
+
...elements,
|
|
64
|
+
]);
|
|
65
|
+
const command = cli_1.default.parse({
|
|
66
|
+
exclude: ["e", "Something to exclude", "string", null],
|
|
67
|
+
out: ["o", "Output path of the SDK files", "string", null],
|
|
68
|
+
});
|
|
69
|
+
const inputs = [];
|
|
70
|
+
for (const arg of elements) {
|
|
71
|
+
if (arg[0] === "-")
|
|
72
|
+
break;
|
|
73
|
+
inputs.push(arg);
|
|
74
|
+
}
|
|
75
|
+
yield generate(task, inputs, command, output);
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
function generate(task, include, command, output) {
|
|
79
|
+
var _a;
|
|
80
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
81
|
+
// CONFIGURATION
|
|
82
|
+
const config = (_a = (yield get_nestia_config(output.validate))) !== null && _a !== void 0 ? _a : parse_cli(include, command, output);
|
|
83
|
+
const options = yield get_typescript_options();
|
|
84
|
+
config.compilerOptions = Object.assign(Object.assign({}, options), (config.compilerOptions || {}));
|
|
85
|
+
// CALL THE APP.GENERATE()
|
|
86
|
+
const app = new NestiaApplication_1.NestiaApplication(config);
|
|
87
|
+
yield task(app);
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
function get_typescript_options() {
|
|
91
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
92
|
+
const configFileName = typescript_1.default.findConfigFile(process.cwd(), typescript_1.default.sys.fileExists, "tsconfig.json");
|
|
93
|
+
if (!configFileName)
|
|
94
|
+
return null;
|
|
95
|
+
const { tsconfig } = yield (0, tsconfck_1.parseNative)(configFileName);
|
|
96
|
+
const configFileText = JSON.stringify(tsconfig);
|
|
97
|
+
const { config } = typescript_1.default.parseConfigFileTextToJson(configFileName, configFileText);
|
|
98
|
+
const configParseResult = typescript_1.default.parseJsonConfigFileContent(config, typescript_1.default.sys, path_1.default.dirname(configFileName));
|
|
99
|
+
const _a = configParseResult.raw.compilerOptions, { moduleResolution } = _a, result = __rest(_a, ["moduleResolution"]);
|
|
100
|
+
return result;
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
function get_nestia_config(validate) {
|
|
104
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
105
|
+
const connector = new WorkerConnector_1.WorkerConnector(null, null, "process");
|
|
106
|
+
yield connector.connect(`${__dirname}/nestia.config.getter.js`);
|
|
107
|
+
const driver = yield connector.getDriver();
|
|
108
|
+
const config = yield driver.get();
|
|
109
|
+
yield connector.close();
|
|
110
|
+
if (config !== null && validate(config) === false)
|
|
111
|
+
throw new Error(`Error on NestiaCommand.main(): output path is not specified in the "nestia.config.ts".`);
|
|
112
|
+
return config;
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
function parse_cli(include, command, output) {
|
|
116
|
+
if (command.out === null)
|
|
117
|
+
throw new Error(`Error on NestiaCommand.main(): output directory is not specified. Add the "--out <output_directory>" option.`);
|
|
118
|
+
const config = {
|
|
119
|
+
input: {
|
|
120
|
+
include,
|
|
121
|
+
exclude: command.exclude ? [command.exclude] : undefined,
|
|
122
|
+
},
|
|
123
|
+
};
|
|
124
|
+
output.assign(config, command.out);
|
|
125
|
+
return config;
|
|
126
|
+
}
|
|
127
|
+
})(NestiaCommand = exports.NestiaCommand || (exports.NestiaCommand = {}));
|
|
128
128
|
//# sourceMappingURL=NestiaCommand.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IConfiguration } from "../../IConfiguration";
|
|
2
|
-
export declare namespace NestiaConfig {
|
|
3
|
-
function get(): Promise<IConfiguration | null>;
|
|
4
|
-
}
|
|
1
|
+
import { IConfiguration } from "../../IConfiguration";
|
|
2
|
+
export declare namespace NestiaConfig {
|
|
3
|
+
function get(): Promise<IConfiguration | null>;
|
|
4
|
+
}
|