@nestia/sdk 2.0.0-dev.20230991 → 2.0.1
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/assets/bundle/api/utils/NestiaSimulator.ts +5 -14
- package/lib/INestiaConfig.d.ts +60 -47
- package/lib/NestiaSdkApplication.d.ts +6 -5
- package/lib/NestiaSdkApplication.js +30 -87
- package/lib/NestiaSdkApplication.js.map +1 -1
- package/lib/analyses/ControllerAnalyzer.js +8 -5
- package/lib/analyses/ControllerAnalyzer.js.map +1 -1
- package/lib/analyses/ReflectAnalyzer.js +9 -1
- package/lib/analyses/ReflectAnalyzer.js.map +1 -1
- package/lib/executable/internal/NestiaConfigLoader.d.ts +7 -0
- package/lib/executable/internal/NestiaConfigLoader.js +582 -0
- package/lib/executable/internal/NestiaConfigLoader.js.map +1 -0
- package/lib/executable/internal/NestiaProjectGetter.d.ts +3 -0
- package/lib/executable/internal/NestiaProjectGetter.js +28 -0
- package/lib/executable/internal/NestiaProjectGetter.js.map +1 -0
- package/lib/executable/internal/NestiaSdkCommand.d.ts +3 -3
- package/lib/executable/internal/NestiaSdkCommand.js +13 -104
- package/lib/executable/internal/NestiaSdkCommand.js.map +1 -1
- package/lib/executable/internal/{nestia.config.getter.js → nestia.project.getter.js} +3 -3
- package/lib/executable/internal/nestia.project.getter.js.map +1 -0
- package/lib/executable/sdk.js +3 -3
- package/lib/executable/sdk.js.map +1 -1
- package/lib/generates/SdkGenerator.d.ts +2 -1
- package/lib/generates/SdkGenerator.js +7 -3
- package/lib/generates/SdkGenerator.js.map +1 -1
- package/lib/generates/SwaggerGenerator.js +26 -9
- package/lib/generates/SwaggerGenerator.js.map +1 -1
- package/lib/generates/internal/E2eFileProgrammer.js +21 -15
- package/lib/generates/internal/E2eFileProgrammer.js.map +1 -1
- package/lib/generates/internal/{DistributionComposer.d.ts → SdkDistributionComposer.d.ts} +1 -1
- package/lib/generates/internal/{DistributionComposer.js → SdkDistributionComposer.js} +8 -12
- package/lib/generates/internal/SdkDistributionComposer.js.map +1 -0
- package/lib/generates/internal/SdkDtoGenerator.d.ts +9 -0
- package/lib/generates/internal/SdkDtoGenerator.js +264 -0
- package/lib/generates/internal/SdkDtoGenerator.js.map +1 -0
- package/lib/generates/internal/SdkFileProgrammer.js +8 -7
- package/lib/generates/internal/SdkFileProgrammer.js.map +1 -1
- package/lib/generates/internal/SdkFunctionProgrammer.js +32 -22
- package/lib/generates/internal/SdkFunctionProgrammer.js.map +1 -1
- package/lib/generates/internal/SdkImportWizard.d.ts +2 -0
- package/lib/generates/internal/SdkImportWizard.js +10 -0
- package/lib/generates/internal/SdkImportWizard.js.map +1 -1
- package/lib/generates/internal/SdkSimulationProgrammer.js +61 -25
- package/lib/generates/internal/SdkSimulationProgrammer.js.map +1 -1
- package/lib/generates/internal/SdkTypeDefiner.d.ts +11 -0
- package/lib/generates/internal/SdkTypeDefiner.js +82 -0
- package/lib/generates/internal/SdkTypeDefiner.js.map +1 -0
- package/lib/generates/internal/SwaggerSchemaGenerator.d.ts +1 -1
- package/lib/generates/internal/SwaggerSchemaGenerator.js +67 -75
- package/lib/generates/internal/SwaggerSchemaGenerator.js.map +1 -1
- package/lib/generates/internal/SwaggerSchemaValidator.js +0 -8
- package/lib/generates/internal/SwaggerSchemaValidator.js.map +1 -1
- package/lib/structures/IController.d.ts +2 -0
- package/lib/structures/IRoute.d.ts +9 -2
- package/lib/utils/ImportDictionary.d.ts +1 -2
- package/lib/utils/ImportDictionary.js +28 -24
- package/lib/utils/ImportDictionary.js.map +1 -1
- package/package.json +8 -8
- package/src/INestiaConfig.ts +65 -50
- package/src/NestiaSdkApplication.ts +39 -84
- package/src/analyses/ControllerAnalyzer.ts +10 -8
- package/src/analyses/ReflectAnalyzer.ts +8 -0
- package/src/executable/internal/NestiaConfigLoader.ts +82 -0
- package/src/executable/internal/NestiaProjectGetter.ts +11 -0
- package/src/executable/internal/NestiaSdkCommand.ts +23 -146
- package/src/executable/internal/{nestia.config.getter.ts → nestia.project.getter.ts} +2 -2
- package/src/executable/sdk.ts +3 -3
- package/src/generates/SdkGenerator.ts +9 -2
- package/src/generates/SwaggerGenerator.ts +37 -9
- package/src/generates/internal/E2eFileProgrammer.ts +33 -20
- package/src/generates/internal/{DistributionComposer.ts → SdkDistributionComposer.ts} +3 -6
- package/src/generates/internal/SdkDtoGenerator.ts +384 -0
- package/src/generates/internal/SdkFileProgrammer.ts +8 -7
- package/src/generates/internal/SdkFunctionProgrammer.ts +71 -37
- package/src/generates/internal/SdkImportWizard.ts +14 -0
- package/src/generates/internal/SdkSimulationProgrammer.ts +71 -37
- package/src/generates/internal/SdkTypeDefiner.ts +120 -0
- package/src/generates/internal/SwaggerSchemaGenerator.ts +94 -92
- package/src/generates/internal/SwaggerSchemaValidator.ts +0 -12
- package/src/structures/IController.ts +2 -0
- package/src/structures/IRoute.ts +10 -2
- package/src/utils/ImportDictionary.ts +29 -26
- package/lib/executable/internal/NestiaConfigCompilerOptions.d.ts +0 -12
- package/lib/executable/internal/NestiaConfigCompilerOptions.js +0 -18
- package/lib/executable/internal/NestiaConfigCompilerOptions.js.map +0 -1
- package/lib/executable/internal/NestiaSdkConfig.d.ts +0 -4
- package/lib/executable/internal/NestiaSdkConfig.js +0 -1019
- package/lib/executable/internal/NestiaSdkConfig.js.map +0 -1
- package/lib/executable/internal/nestia.config.getter.js.map +0 -1
- package/lib/generates/internal/DistributionComposer.js.map +0 -1
- package/src/executable/internal/NestiaConfigCompilerOptions.ts +0 -19
- package/src/executable/internal/NestiaSdkConfig.ts +0 -36
- /package/lib/executable/internal/{nestia.config.getter.d.ts → nestia.project.getter.d.ts} +0 -0
|
@@ -4,20 +4,18 @@ import { HashSet } from "tstl/container/HashSet";
|
|
|
4
4
|
import { Pair } from "tstl/utility/Pair";
|
|
5
5
|
|
|
6
6
|
export class ImportDictionary {
|
|
7
|
-
private readonly
|
|
8
|
-
new HashMap();
|
|
9
|
-
private readonly internals_: HashMap<Pair<string, boolean>, IComposition> =
|
|
7
|
+
private readonly components_: HashMap<Pair<string, boolean>, IComposition> =
|
|
10
8
|
new HashMap();
|
|
11
9
|
|
|
12
10
|
public empty(): boolean {
|
|
13
|
-
return this.
|
|
11
|
+
return this.components_.empty();
|
|
14
12
|
}
|
|
15
13
|
|
|
16
14
|
public external(props: ImportDictionary.IExternalProps): string {
|
|
17
|
-
const composition: IComposition = this.
|
|
15
|
+
const composition: IComposition = this.components_.take(
|
|
18
16
|
new Pair(props.library, props.type),
|
|
19
17
|
() => ({
|
|
20
|
-
location: props.library
|
|
18
|
+
location: `node_modules/${props.library}`,
|
|
21
19
|
elements: new HashSet(),
|
|
22
20
|
default: false,
|
|
23
21
|
type: props.type,
|
|
@@ -36,7 +34,7 @@ export class ImportDictionary {
|
|
|
36
34
|
return props.file.substring(0, props.file.length - 3);
|
|
37
35
|
return props.file;
|
|
38
36
|
})();
|
|
39
|
-
const composition: IComposition = this.
|
|
37
|
+
const composition: IComposition = this.components_.take(
|
|
40
38
|
new Pair(file, props.type),
|
|
41
39
|
() => ({
|
|
42
40
|
location: file,
|
|
@@ -53,12 +51,26 @@ export class ImportDictionary {
|
|
|
53
51
|
}
|
|
54
52
|
|
|
55
53
|
public toScript(outDir: string): string {
|
|
56
|
-
const
|
|
54
|
+
const external: string[] = [];
|
|
55
|
+
const internal: string[] = [];
|
|
56
|
+
|
|
57
|
+
const locator = (str: string) => {
|
|
58
|
+
const location: string = path
|
|
59
|
+
.relative(outDir, str)
|
|
60
|
+
.split("\\")
|
|
61
|
+
.join("/");
|
|
62
|
+
const index: number = location.lastIndexOf(NODE_MODULES);
|
|
63
|
+
return index === -1
|
|
64
|
+
? location.startsWith("..")
|
|
65
|
+
? location
|
|
66
|
+
: `./${location}`
|
|
67
|
+
: location.substring(index + NODE_MODULES.length);
|
|
68
|
+
};
|
|
57
69
|
const enroll =
|
|
58
|
-
(
|
|
59
|
-
|
|
60
|
-
const compositions: IComposition[] = dict
|
|
70
|
+
(filter: (str: string) => boolean) => (container: string[]) => {
|
|
71
|
+
const compositions: IComposition[] = this.components_
|
|
61
72
|
.toJSON()
|
|
73
|
+
.filter((c) => filter(c.second.location))
|
|
62
74
|
.map((e) => ({
|
|
63
75
|
...e.second,
|
|
64
76
|
location: locator(e.second.location),
|
|
@@ -74,7 +86,7 @@ export class ImportDictionary {
|
|
|
74
86
|
.sort((a, b) => a.localeCompare(b))
|
|
75
87
|
.join(", ")} }`,
|
|
76
88
|
);
|
|
77
|
-
|
|
89
|
+
container.push(
|
|
78
90
|
`import ${c.type ? "type " : ""}${brackets.join(
|
|
79
91
|
", ",
|
|
80
92
|
)} from "${c.location}";`,
|
|
@@ -82,20 +94,11 @@ export class ImportDictionary {
|
|
|
82
94
|
}
|
|
83
95
|
};
|
|
84
96
|
|
|
85
|
-
enroll((str) => str)(
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
.relative(outDir, str)
|
|
91
|
-
.split("\\")
|
|
92
|
-
.join("/");
|
|
93
|
-
const index: number = location.lastIndexOf(NODE_MODULES);
|
|
94
|
-
return index === -1
|
|
95
|
-
? `./${location}`
|
|
96
|
-
: location.substring(index + NODE_MODULES.length);
|
|
97
|
-
})(this.internals_);
|
|
98
|
-
return statements.join("\n");
|
|
97
|
+
enroll((str) => str.indexOf(NODE_MODULES) !== -1)(external);
|
|
98
|
+
enroll((str) => str.indexOf(NODE_MODULES) === -1)(internal);
|
|
99
|
+
|
|
100
|
+
if (external.length && internal.length) external.push("");
|
|
101
|
+
return [...external, ...internal].join("\n");
|
|
99
102
|
}
|
|
100
103
|
}
|
|
101
104
|
export namespace ImportDictionary {
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
export declare namespace NestiaConfigCompilerOptions {
|
|
2
|
-
const DEFAULT_OPTIONS: {
|
|
3
|
-
target: string;
|
|
4
|
-
module: string;
|
|
5
|
-
strictNullChecks: boolean;
|
|
6
|
-
types: string[];
|
|
7
|
-
noEmit: boolean;
|
|
8
|
-
esModuleInterop: boolean;
|
|
9
|
-
experimentalDecorators: boolean;
|
|
10
|
-
emitDecoratorMetadata: boolean;
|
|
11
|
-
};
|
|
12
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.NestiaConfigCompilerOptions = void 0;
|
|
4
|
-
var NestiaConfigCompilerOptions;
|
|
5
|
-
(function (NestiaConfigCompilerOptions) {
|
|
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
|
-
NestiaConfigCompilerOptions.DEFAULT_OPTIONS = Object.assign(Object.assign({}, ESSENTIAL_OPTIONS), { target: "es5", module: "commonjs", strictNullChecks: true });
|
|
17
|
-
})(NestiaConfigCompilerOptions || (exports.NestiaConfigCompilerOptions = NestiaConfigCompilerOptions = {}));
|
|
18
|
-
//# sourceMappingURL=NestiaConfigCompilerOptions.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"NestiaConfigCompilerOptions.js","sourceRoot":"","sources":["../../../src/executable/internal/NestiaConfigCompilerOptions.ts"],"names":[],"mappings":";;;AAAA,IAAiB,2BAA2B,CAkB3C;AAlBD,WAAiB,2BAA2B;IACxC;;kEAE8D;IAC9D,MAAM,iBAAiB,GAAG;QACtB,KAAK,EAAE,CAAC,MAAM,EAAE,kBAAkB,CAAC;QACnC,MAAM,EAAE,IAAI;QACZ,eAAe,EAAE,IAAI;QACrB,sBAAsB,EAAE,IAAI;QAC5B,qBAAqB,EAAE,IAAI;KAC9B,CAAC;IAEW,2CAAe,mCACrB,iBAAiB,KACpB,MAAM,EAAE,KAAK,EACb,MAAM,EAAE,UAAU,EAClB,gBAAgB,EAAE,IAAI,GACzB,CAAC;AACN,CAAC,EAlBgB,2BAA2B,2CAA3B,2BAA2B,QAkB3C"}
|