@nestia/sdk 1.3.9 → 1.3.11
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/INestiaConfig.d.ts +15 -6
- package/lib/NestiaSdkApplication.d.ts +1 -1
- package/lib/NestiaSdkApplication.js +15 -9
- package/lib/NestiaSdkApplication.js.map +1 -1
- package/lib/analyses/ControllerAnalyzer.js +3 -3
- package/lib/analyses/ControllerAnalyzer.js.map +1 -1
- package/lib/analyses/ImportAnalyzer.js +2 -6
- package/lib/analyses/ImportAnalyzer.js.map +1 -1
- package/lib/executable/internal/NestiaConfigCompilerOptions.d.ts +1 -0
- package/lib/executable/internal/NestiaConfigCompilerOptions.js +1 -1
- package/lib/executable/internal/NestiaConfigCompilerOptions.js.map +1 -1
- package/lib/executable/internal/NestiaSdkCommand.js +2 -2
- package/lib/executable/internal/NestiaSdkCommand.js.map +1 -1
- package/lib/executable/internal/NestiaSdkConfig.js +5 -1
- package/lib/executable/internal/NestiaSdkConfig.js.map +1 -1
- package/lib/executable/sdk.js +11 -11
- package/lib/generates/SdkGenerator.js +33 -3
- package/lib/generates/SdkGenerator.js.map +1 -1
- package/lib/generates/SwaggerGenerator.js +9 -9
- package/lib/generates/internal/DistributionComposer.js +7 -4
- package/lib/generates/internal/DistributionComposer.js.map +1 -1
- package/lib/generates/internal/E2eFileProgrammer.js +12 -12
- package/lib/generates/internal/SdkFileProgrammer.js +4 -3
- package/lib/generates/internal/SdkFileProgrammer.js.map +1 -1
- package/lib/generates/internal/SdkFunctionProgrammer.js +7 -4
- package/lib/generates/internal/SdkFunctionProgrammer.js.map +1 -1
- package/lib/generates/internal/SdkSimulationProgrammer.js +4 -4
- package/lib/generates/internal/SdkSimulationProgrammer.js.map +1 -1
- package/lib/structures/IRoute.d.ts +1 -0
- package/package.json +4 -5
- package/src/INestiaConfig.ts +16 -6
- package/src/NestiaSdkApplication.ts +273 -262
- package/src/analyses/ControllerAnalyzer.ts +266 -261
- package/src/analyses/GenericAnalyzer.ts +53 -53
- package/src/analyses/ImportAnalyzer.ts +158 -164
- package/src/analyses/PathAnalyzer.ts +58 -58
- package/src/analyses/ReflectAnalyzer.ts +321 -321
- package/src/executable/internal/CommandParser.ts +15 -15
- package/src/executable/internal/NestiaConfigCompilerOptions.ts +19 -18
- package/src/executable/internal/NestiaSdkCommand.ts +157 -156
- package/src/executable/internal/NestiaSdkConfig.ts +36 -36
- package/src/executable/internal/nestia.config.getter.ts +12 -12
- package/src/executable/sdk.ts +70 -70
- package/src/generates/E2eGenerator.ts +67 -67
- package/src/generates/SdkGenerator.ts +97 -65
- package/src/generates/SwaggerGenerator.ts +504 -504
- package/src/generates/internal/DistributionComposer.ts +3 -1
- package/src/generates/internal/E2eFileProgrammer.ts +135 -135
- package/src/generates/internal/SdkFileProgrammer.ts +2 -2
- package/src/generates/internal/SdkFunctionProgrammer.ts +6 -4
- package/src/generates/internal/SdkRouteDirectory.ts +21 -21
- package/src/generates/internal/SdkSimulationProgrammer.ts +4 -4
- package/src/index.ts +4 -4
- package/src/module.ts +2 -2
- package/src/structures/IController.ts +31 -31
- package/src/structures/IRoute.ts +40 -39
- package/src/structures/ISwaggerDocument.ts +120 -120
- package/src/structures/ITypeTuple.ts +6 -6
- package/src/structures/MethodType.ts +11 -11
- package/src/structures/ParamCategory.ts +1 -1
- package/src/structures/TypeEntry.ts +22 -22
- package/src/utils/ArrayUtil.ts +26 -26
- package/src/utils/FileRetriever.ts +22 -22
- package/src/utils/ImportDictionary.ts +56 -56
- package/src/utils/MapUtil.ts +14 -14
- package/src/utils/NestiaConfigUtil.ts +21 -21
- package/src/utils/SourceFinder.ts +60 -60
- package/src/utils/StripEnums.ts +10 -10
|
@@ -18,7 +18,9 @@ export namespace DistributionComposer {
|
|
|
18
18
|
};
|
|
19
19
|
|
|
20
20
|
const typia: boolean =
|
|
21
|
-
!!config.assert ||
|
|
21
|
+
!!config.assert ||
|
|
22
|
+
!!config.json ||
|
|
23
|
+
!!(config.simulate ?? (config as any).random);
|
|
22
24
|
const done: boolean = await configured({
|
|
23
25
|
typia,
|
|
24
26
|
distribute: config.distribute!,
|
|
@@ -1,135 +1,135 @@
|
|
|
1
|
-
import fs from "fs";
|
|
2
|
-
import path from "path";
|
|
3
|
-
|
|
4
|
-
import { INestiaConfig } from "../../INestiaConfig";
|
|
5
|
-
import { IRoute } from "../../structures/IRoute";
|
|
6
|
-
import { ImportDictionary } from "../../utils/ImportDictionary";
|
|
7
|
-
|
|
8
|
-
export namespace E2eFileProgrammer {
|
|
9
|
-
export const generate =
|
|
10
|
-
(config: INestiaConfig) =>
|
|
11
|
-
(props: { api: string; current: string }) =>
|
|
12
|
-
async (route: IRoute): Promise<void> => {
|
|
13
|
-
const importDict: ImportDictionary = new ImportDictionary();
|
|
14
|
-
for (const tuple of route.imports)
|
|
15
|
-
for (const instance of tuple[1])
|
|
16
|
-
importDict.emplace(tuple[0], false, instance);
|
|
17
|
-
|
|
18
|
-
const additional: string[] = [];
|
|
19
|
-
for (const param of route.parameters)
|
|
20
|
-
if (param.category === "param")
|
|
21
|
-
if (param.meta?.type === "uuid") additional.push(UUID);
|
|
22
|
-
else if (param.meta?.type === "date") additional.push(DATE);
|
|
23
|
-
const content: string = [
|
|
24
|
-
...(route.parameters.length || route.output.name !== "void"
|
|
25
|
-
? [
|
|
26
|
-
config.primitive === false
|
|
27
|
-
? `import typia from "typia";`
|
|
28
|
-
: `import typia, { Primitive } from "typia";`,
|
|
29
|
-
"",
|
|
30
|
-
]
|
|
31
|
-
: []),
|
|
32
|
-
`import api from "./${path
|
|
33
|
-
.relative(props.current, props.api)
|
|
34
|
-
.split("\\")
|
|
35
|
-
.join("/")}";`,
|
|
36
|
-
...(importDict.empty()
|
|
37
|
-
? []
|
|
38
|
-
: [importDict.toScript(props.current)]),
|
|
39
|
-
"",
|
|
40
|
-
arrow(config)(route),
|
|
41
|
-
...(additional.length ? ["", ...additional] : []),
|
|
42
|
-
].join("\n");
|
|
43
|
-
|
|
44
|
-
await fs.promises.writeFile(
|
|
45
|
-
`${props.current}/${name(route)}.ts`,
|
|
46
|
-
content,
|
|
47
|
-
"utf8",
|
|
48
|
-
);
|
|
49
|
-
};
|
|
50
|
-
|
|
51
|
-
const arrow =
|
|
52
|
-
(config: INestiaConfig) =>
|
|
53
|
-
(route: IRoute): string => {
|
|
54
|
-
const tab: number = route.output.name === "void" ? 2 : 3;
|
|
55
|
-
const output = [
|
|
56
|
-
`await ${accessor(route)}(`,
|
|
57
|
-
`${" ".repeat(tab * 4)}connection,`,
|
|
58
|
-
...route.parameters.map(parameter(config)(tab)),
|
|
59
|
-
`${" ".repeat((tab - 1) * 4)});`,
|
|
60
|
-
].join("\n");
|
|
61
|
-
return [
|
|
62
|
-
`export const ${name(route)} = async (`,
|
|
63
|
-
` connection: api.IConnection`,
|
|
64
|
-
`): Promise<void> => {`,
|
|
65
|
-
...(route.output.name === "void"
|
|
66
|
-
? [` ${output}`]
|
|
67
|
-
: [
|
|
68
|
-
` const output: ${primitive(config)(
|
|
69
|
-
route.output.name,
|
|
70
|
-
)} = `,
|
|
71
|
-
` ${output}`,
|
|
72
|
-
` typia.assert(output);`,
|
|
73
|
-
]),
|
|
74
|
-
`};`,
|
|
75
|
-
].join("\n");
|
|
76
|
-
};
|
|
77
|
-
|
|
78
|
-
const parameter =
|
|
79
|
-
(config: INestiaConfig) =>
|
|
80
|
-
(tab: number) =>
|
|
81
|
-
(param: IRoute.IParameter): string => {
|
|
82
|
-
const middle: string =
|
|
83
|
-
param.category === "param" &&
|
|
84
|
-
(param.meta?.type === "uuid" || param.meta?.type === "date")
|
|
85
|
-
? param.meta.nullable
|
|
86
|
-
? `Math.random() < .2 ? null : ${param.meta.type}()`
|
|
87
|
-
: `${param.meta.type}()`
|
|
88
|
-
: `typia.random<${primitive(config)(param.type.name)}>()`;
|
|
89
|
-
return `${" ".repeat(4 * tab)}${middle},`;
|
|
90
|
-
};
|
|
91
|
-
|
|
92
|
-
const name = (route: IRoute): string =>
|
|
93
|
-
postfix([
|
|
94
|
-
"test_api",
|
|
95
|
-
...route.path
|
|
96
|
-
.split("/")
|
|
97
|
-
.filter((str) => str.length && str[0] !== ":")
|
|
98
|
-
.map(normalize),
|
|
99
|
-
])(route.name).join("_");
|
|
100
|
-
|
|
101
|
-
const accessor = (route: IRoute): string =>
|
|
102
|
-
postfix([
|
|
103
|
-
"api.functional",
|
|
104
|
-
...route.path
|
|
105
|
-
.split("/")
|
|
106
|
-
.filter((str) => str.length && str[0] !== ":")
|
|
107
|
-
.map(normalize),
|
|
108
|
-
])(route.name).join(".");
|
|
109
|
-
|
|
110
|
-
const normalize = (str: string) =>
|
|
111
|
-
str.split("-").join("_").split(".").join("_");
|
|
112
|
-
|
|
113
|
-
const postfix = (array: string[]) => (name: string) =>
|
|
114
|
-
array.at(-1) === name ? array : [...array, name];
|
|
115
|
-
|
|
116
|
-
const primitive =
|
|
117
|
-
(config: INestiaConfig) =>
|
|
118
|
-
(name: string): string =>
|
|
119
|
-
config.primitive !== false ? `Primitive<${name}>` : name;
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
const UUID = `const uuid = (): string =>
|
|
123
|
-
"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (c) => {
|
|
124
|
-
const r = (Math.random() * 16) | 0;
|
|
125
|
-
const v = c === "x" ? r : (r & 0x3) | 0x8;
|
|
126
|
-
return v.toString(16);
|
|
127
|
-
});`;
|
|
128
|
-
const DATE = `const date = (): string => {
|
|
129
|
-
const date: Date = new Date(Math.floor(Math.random() * Date.now() * 2));
|
|
130
|
-
return [
|
|
131
|
-
date.getFullYear(),
|
|
132
|
-
(date.getMonth() + 1).toString().padStart(2, "0"),
|
|
133
|
-
date.getDate().toString().padStart(2, "0"),
|
|
134
|
-
].join("-");
|
|
135
|
-
}`;
|
|
1
|
+
import fs from "fs";
|
|
2
|
+
import path from "path";
|
|
3
|
+
|
|
4
|
+
import { INestiaConfig } from "../../INestiaConfig";
|
|
5
|
+
import { IRoute } from "../../structures/IRoute";
|
|
6
|
+
import { ImportDictionary } from "../../utils/ImportDictionary";
|
|
7
|
+
|
|
8
|
+
export namespace E2eFileProgrammer {
|
|
9
|
+
export const generate =
|
|
10
|
+
(config: INestiaConfig) =>
|
|
11
|
+
(props: { api: string; current: string }) =>
|
|
12
|
+
async (route: IRoute): Promise<void> => {
|
|
13
|
+
const importDict: ImportDictionary = new ImportDictionary();
|
|
14
|
+
for (const tuple of route.imports)
|
|
15
|
+
for (const instance of tuple[1])
|
|
16
|
+
importDict.emplace(tuple[0], false, instance);
|
|
17
|
+
|
|
18
|
+
const additional: string[] = [];
|
|
19
|
+
for (const param of route.parameters)
|
|
20
|
+
if (param.category === "param")
|
|
21
|
+
if (param.meta?.type === "uuid") additional.push(UUID);
|
|
22
|
+
else if (param.meta?.type === "date") additional.push(DATE);
|
|
23
|
+
const content: string = [
|
|
24
|
+
...(route.parameters.length || route.output.name !== "void"
|
|
25
|
+
? [
|
|
26
|
+
config.primitive === false
|
|
27
|
+
? `import typia from "typia";`
|
|
28
|
+
: `import typia, { Primitive } from "typia";`,
|
|
29
|
+
"",
|
|
30
|
+
]
|
|
31
|
+
: []),
|
|
32
|
+
`import api from "./${path
|
|
33
|
+
.relative(props.current, props.api)
|
|
34
|
+
.split("\\")
|
|
35
|
+
.join("/")}";`,
|
|
36
|
+
...(importDict.empty()
|
|
37
|
+
? []
|
|
38
|
+
: [importDict.toScript(props.current)]),
|
|
39
|
+
"",
|
|
40
|
+
arrow(config)(route),
|
|
41
|
+
...(additional.length ? ["", ...additional] : []),
|
|
42
|
+
].join("\n");
|
|
43
|
+
|
|
44
|
+
await fs.promises.writeFile(
|
|
45
|
+
`${props.current}/${name(route)}.ts`,
|
|
46
|
+
content,
|
|
47
|
+
"utf8",
|
|
48
|
+
);
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
const arrow =
|
|
52
|
+
(config: INestiaConfig) =>
|
|
53
|
+
(route: IRoute): string => {
|
|
54
|
+
const tab: number = route.output.name === "void" ? 2 : 3;
|
|
55
|
+
const output = [
|
|
56
|
+
`await ${accessor(route)}(`,
|
|
57
|
+
`${" ".repeat(tab * 4)}connection,`,
|
|
58
|
+
...route.parameters.map(parameter(config)(tab)),
|
|
59
|
+
`${" ".repeat((tab - 1) * 4)});`,
|
|
60
|
+
].join("\n");
|
|
61
|
+
return [
|
|
62
|
+
`export const ${name(route)} = async (`,
|
|
63
|
+
` connection: api.IConnection`,
|
|
64
|
+
`): Promise<void> => {`,
|
|
65
|
+
...(route.output.name === "void"
|
|
66
|
+
? [` ${output}`]
|
|
67
|
+
: [
|
|
68
|
+
` const output: ${primitive(config)(
|
|
69
|
+
route.output.name,
|
|
70
|
+
)} = `,
|
|
71
|
+
` ${output}`,
|
|
72
|
+
` typia.assert(output);`,
|
|
73
|
+
]),
|
|
74
|
+
`};`,
|
|
75
|
+
].join("\n");
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
const parameter =
|
|
79
|
+
(config: INestiaConfig) =>
|
|
80
|
+
(tab: number) =>
|
|
81
|
+
(param: IRoute.IParameter): string => {
|
|
82
|
+
const middle: string =
|
|
83
|
+
param.category === "param" &&
|
|
84
|
+
(param.meta?.type === "uuid" || param.meta?.type === "date")
|
|
85
|
+
? param.meta.nullable
|
|
86
|
+
? `Math.random() < .2 ? null : ${param.meta.type}()`
|
|
87
|
+
: `${param.meta.type}()`
|
|
88
|
+
: `typia.random<${primitive(config)(param.type.name)}>()`;
|
|
89
|
+
return `${" ".repeat(4 * tab)}${middle},`;
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
const name = (route: IRoute): string =>
|
|
93
|
+
postfix([
|
|
94
|
+
"test_api",
|
|
95
|
+
...route.path
|
|
96
|
+
.split("/")
|
|
97
|
+
.filter((str) => str.length && str[0] !== ":")
|
|
98
|
+
.map(normalize),
|
|
99
|
+
])(route.name).join("_");
|
|
100
|
+
|
|
101
|
+
const accessor = (route: IRoute): string =>
|
|
102
|
+
postfix([
|
|
103
|
+
"api.functional",
|
|
104
|
+
...route.path
|
|
105
|
+
.split("/")
|
|
106
|
+
.filter((str) => str.length && str[0] !== ":")
|
|
107
|
+
.map(normalize),
|
|
108
|
+
])(route.name).join(".");
|
|
109
|
+
|
|
110
|
+
const normalize = (str: string) =>
|
|
111
|
+
str.split("-").join("_").split(".").join("_");
|
|
112
|
+
|
|
113
|
+
const postfix = (array: string[]) => (name: string) =>
|
|
114
|
+
array.at(-1) === name ? array : [...array, name];
|
|
115
|
+
|
|
116
|
+
const primitive =
|
|
117
|
+
(config: INestiaConfig) =>
|
|
118
|
+
(name: string): string =>
|
|
119
|
+
config.primitive !== false ? `Primitive<${name}>` : name;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
const UUID = `const uuid = (): string =>
|
|
123
|
+
"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (c) => {
|
|
124
|
+
const r = (Math.random() * 16) | 0;
|
|
125
|
+
const v = c === "x" ? r : (r & 0x3) | 0x8;
|
|
126
|
+
return v.toString(16);
|
|
127
|
+
});`;
|
|
128
|
+
const DATE = `const date = (): string => {
|
|
129
|
+
const date: Date = new Date(Math.floor(Math.random() * Date.now() * 2));
|
|
130
|
+
return [
|
|
131
|
+
date.getFullYear(),
|
|
132
|
+
(date.getMonth() + 1).toString().padStart(2, "0"),
|
|
133
|
+
date.getDate().toString().padStart(2, "0"),
|
|
134
|
+
].join("-");
|
|
135
|
+
}`;
|
|
@@ -84,7 +84,7 @@ export namespace SdkFileProgrammer {
|
|
|
84
84
|
// ITERATE ROUTES
|
|
85
85
|
const importDict: ImportDictionary = new ImportDictionary();
|
|
86
86
|
if (
|
|
87
|
-
config.random &&
|
|
87
|
+
(config.simulate ?? (config as any).random) === true &&
|
|
88
88
|
directory.routes.some((r) => !!r.parameters.length)
|
|
89
89
|
)
|
|
90
90
|
importDict.emplace(
|
|
@@ -127,7 +127,7 @@ export namespace SdkFileProgrammer {
|
|
|
127
127
|
route.method === "PATCH",
|
|
128
128
|
);
|
|
129
129
|
const random: boolean =
|
|
130
|
-
config.random === true &&
|
|
130
|
+
(config.simulate ?? (config as any).random) === true &&
|
|
131
131
|
directory.routes.some(
|
|
132
132
|
(s) =>
|
|
133
133
|
!!s.parameters.length || s.output.name !== "void",
|
|
@@ -81,9 +81,10 @@ export namespace SdkFunctionProgrammer {
|
|
|
81
81
|
.join("\n"),
|
|
82
82
|
`${tab})`,
|
|
83
83
|
].join("\n");
|
|
84
|
-
if (!config.
|
|
84
|
+
if (!(config.simulate ?? (config as any).random))
|
|
85
|
+
return fetch(space(4));
|
|
85
86
|
return (
|
|
86
|
-
`!!connection.random\n` +
|
|
87
|
+
`!!(connection.simulate ?? (connection as any).random)\n` +
|
|
87
88
|
` ? ${random()}\n` +
|
|
88
89
|
` : ${fetch(space(10))}`
|
|
89
90
|
);
|
|
@@ -264,11 +265,12 @@ export namespace SdkFunctionProgrammer {
|
|
|
264
265
|
.join(", ")}): string => {\n` +
|
|
265
266
|
`${path};\n` +
|
|
266
267
|
` }\n` +
|
|
267
|
-
(config.
|
|
268
|
+
((config.simulate ?? (config as any).random) === true &&
|
|
269
|
+
route.output.name !== "void"
|
|
268
270
|
? ` export const random = (g?: Partial<typia.IRandomGenerator>): Output =>\n` +
|
|
269
271
|
` typia.random<Output>(g);\n`
|
|
270
272
|
: "") +
|
|
271
|
-
(config.random
|
|
273
|
+
((config.simulate ?? (config as any).random) === true
|
|
272
274
|
? SdkSimulationProgrammer.generate(route) + "\n"
|
|
273
275
|
: "") +
|
|
274
276
|
(config.json === true &&
|
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
import { HashMap } from "tstl";
|
|
2
|
-
|
|
3
|
-
import { IRoute } from "../../structures/IRoute";
|
|
4
|
-
|
|
5
|
-
export class SdkRouteDirectory {
|
|
6
|
-
public readonly module: string;
|
|
7
|
-
public readonly directories: HashMap<string, SdkRouteDirectory>;
|
|
8
|
-
public readonly routes: IRoute[];
|
|
9
|
-
|
|
10
|
-
public constructor(
|
|
11
|
-
readonly parent: SdkRouteDirectory | null,
|
|
12
|
-
readonly name: string,
|
|
13
|
-
) {
|
|
14
|
-
this.directories = new HashMap();
|
|
15
|
-
this.routes = [];
|
|
16
|
-
this.module =
|
|
17
|
-
this.parent !== null
|
|
18
|
-
? `${this.parent.module}.${name}`
|
|
19
|
-
: `api.${name}`;
|
|
20
|
-
}
|
|
21
|
-
}
|
|
1
|
+
import { HashMap } from "tstl";
|
|
2
|
+
|
|
3
|
+
import { IRoute } from "../../structures/IRoute";
|
|
4
|
+
|
|
5
|
+
export class SdkRouteDirectory {
|
|
6
|
+
public readonly module: string;
|
|
7
|
+
public readonly directories: HashMap<string, SdkRouteDirectory>;
|
|
8
|
+
public readonly routes: IRoute[];
|
|
9
|
+
|
|
10
|
+
public constructor(
|
|
11
|
+
readonly parent: SdkRouteDirectory | null,
|
|
12
|
+
readonly name: string,
|
|
13
|
+
) {
|
|
14
|
+
this.directories = new HashMap();
|
|
15
|
+
this.routes = [];
|
|
16
|
+
this.module =
|
|
17
|
+
this.parent !== null
|
|
18
|
+
? `${this.parent.module}.${name}`
|
|
19
|
+
: `api.${name}`;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
@@ -4,10 +4,10 @@ export namespace SdkSimulationProgrammer {
|
|
|
4
4
|
export const generate = (route: IRoute): string => {
|
|
5
5
|
const output: boolean = route.output.name !== "void";
|
|
6
6
|
const returns = () => [
|
|
7
|
-
`return
|
|
8
|
-
` typeof connection.random === 'object'`,
|
|
9
|
-
` && connection.random !== null`,
|
|
10
|
-
` ? connection.random`,
|
|
7
|
+
`return random(`,
|
|
8
|
+
` typeof (connection.simulate ?? (connection as any).random) === 'object'`,
|
|
9
|
+
` && (connection.simulate ?? (connection as any).random) !== null`,
|
|
10
|
+
` ? (connection.simulate ?? (connection as any).random)`,
|
|
11
11
|
` : undefined`,
|
|
12
12
|
`);`,
|
|
13
13
|
];
|
package/src/index.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as nestia from "./module";
|
|
2
|
-
|
|
3
|
-
export * from "./module";
|
|
4
|
-
export default nestia;
|
|
1
|
+
import * as nestia from "./module";
|
|
2
|
+
|
|
3
|
+
export * from "./module";
|
|
4
|
+
export default nestia;
|
package/src/module.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from "./INestiaConfig";
|
|
2
|
-
export * from "./NestiaSdkApplication";
|
|
1
|
+
export * from "./INestiaConfig";
|
|
2
|
+
export * from "./NestiaSdkApplication";
|
|
@@ -1,31 +1,31 @@
|
|
|
1
|
-
import { ParamCategory } from "./ParamCategory";
|
|
2
|
-
|
|
3
|
-
export interface IController {
|
|
4
|
-
file: string;
|
|
5
|
-
name: string;
|
|
6
|
-
paths: string[];
|
|
7
|
-
functions: IController.IFunction[];
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
export namespace IController {
|
|
11
|
-
export interface IFunction {
|
|
12
|
-
name: string;
|
|
13
|
-
method: string;
|
|
14
|
-
paths: string[];
|
|
15
|
-
encrypted: boolean;
|
|
16
|
-
parameters: IParameter[];
|
|
17
|
-
status?: number;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
export interface IParameter {
|
|
21
|
-
name: string;
|
|
22
|
-
index: number;
|
|
23
|
-
field: string | undefined;
|
|
24
|
-
category: ParamCategory;
|
|
25
|
-
encrypted: boolean;
|
|
26
|
-
meta?: {
|
|
27
|
-
type: string;
|
|
28
|
-
nullable: boolean;
|
|
29
|
-
};
|
|
30
|
-
}
|
|
31
|
-
}
|
|
1
|
+
import { ParamCategory } from "./ParamCategory";
|
|
2
|
+
|
|
3
|
+
export interface IController {
|
|
4
|
+
file: string;
|
|
5
|
+
name: string;
|
|
6
|
+
paths: string[];
|
|
7
|
+
functions: IController.IFunction[];
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export namespace IController {
|
|
11
|
+
export interface IFunction {
|
|
12
|
+
name: string;
|
|
13
|
+
method: string;
|
|
14
|
+
paths: string[];
|
|
15
|
+
encrypted: boolean;
|
|
16
|
+
parameters: IParameter[];
|
|
17
|
+
status?: number;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export interface IParameter {
|
|
21
|
+
name: string;
|
|
22
|
+
index: number;
|
|
23
|
+
field: string | undefined;
|
|
24
|
+
category: ParamCategory;
|
|
25
|
+
encrypted: boolean;
|
|
26
|
+
meta?: {
|
|
27
|
+
type: string;
|
|
28
|
+
nullable: boolean;
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
}
|
package/src/structures/IRoute.ts
CHANGED
|
@@ -1,39 +1,40 @@
|
|
|
1
|
-
import ts from "typescript";
|
|
2
|
-
|
|
3
|
-
import { ITypeTuple } from "./ITypeTuple";
|
|
4
|
-
import { ParamCategory } from "./ParamCategory";
|
|
5
|
-
|
|
6
|
-
export interface IRoute {
|
|
7
|
-
name: string;
|
|
8
|
-
method: string;
|
|
9
|
-
path: string;
|
|
10
|
-
encrypted: boolean;
|
|
11
|
-
status?: number;
|
|
12
|
-
|
|
13
|
-
parameters: IRoute.IParameter[];
|
|
14
|
-
imports: [string, string[]][];
|
|
15
|
-
output: ITypeTuple;
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
| { type: "
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
}
|
|
1
|
+
import ts from "typescript";
|
|
2
|
+
|
|
3
|
+
import { ITypeTuple } from "./ITypeTuple";
|
|
4
|
+
import { ParamCategory } from "./ParamCategory";
|
|
5
|
+
|
|
6
|
+
export interface IRoute {
|
|
7
|
+
name: string;
|
|
8
|
+
method: string;
|
|
9
|
+
path: string;
|
|
10
|
+
encrypted: boolean;
|
|
11
|
+
status?: number;
|
|
12
|
+
|
|
13
|
+
parameters: IRoute.IParameter[];
|
|
14
|
+
imports: [string, string[]][];
|
|
15
|
+
output: ITypeTuple;
|
|
16
|
+
|
|
17
|
+
location: string;
|
|
18
|
+
symbol: string;
|
|
19
|
+
description?: string;
|
|
20
|
+
tags: ts.JSDocTagInfo[];
|
|
21
|
+
setHeaders: Array<
|
|
22
|
+
| { type: "setter"; source: string; target?: string }
|
|
23
|
+
| { type: "assigner"; source: string }
|
|
24
|
+
>;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export namespace IRoute {
|
|
28
|
+
export interface IParameter {
|
|
29
|
+
name: string;
|
|
30
|
+
field: string | undefined;
|
|
31
|
+
category: ParamCategory;
|
|
32
|
+
encrypted: boolean;
|
|
33
|
+
type: ITypeTuple;
|
|
34
|
+
optional: boolean;
|
|
35
|
+
meta?: {
|
|
36
|
+
type: string;
|
|
37
|
+
nullable: boolean;
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
}
|