@nestia/migrate 14.0.0 → 14.0.2
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 +1 -1
- package/lib/NestiaMigrateApplication.d.ts +111 -0
- package/lib/NestiaMigrateApplication.js +148 -9
- package/lib/NestiaMigrateApplication.js.map +1 -1
- package/lib/NestiaMigrateApplication.mjs +147 -5
- package/lib/analyzers/NestiaMigrateControllerAnalyzer.d.ts +58 -0
- package/lib/analyzers/NestiaMigrateControllerAnalyzer.js +88 -2
- package/lib/analyzers/NestiaMigrateControllerAnalyzer.js.map +1 -1
- package/lib/analyzers/NestiaMigrateControllerAnalyzer.mjs +20 -2
- package/lib/archivers/NestiaMigrateFileArchiver.d.ts +34 -0
- package/lib/archivers/NestiaMigrateFileArchiver.js +34 -0
- package/lib/archivers/NestiaMigrateFileArchiver.js.map +1 -1
- package/lib/bundles/NEST_TEMPLATE.js +1 -1
- package/lib/bundles/NEST_TEMPLATE.js.map +1 -1
- package/lib/bundles/NEST_TEMPLATE.mjs +1 -1
- package/lib/bundles/SDK_TEMPLATE.js +1 -1
- package/lib/bundles/SDK_TEMPLATE.js.map +1 -1
- package/lib/bundles/SDK_TEMPLATE.mjs +1 -1
- package/lib/executable/NestiaMigrateCommander.d.ts +36 -0
- package/lib/executable/NestiaMigrateCommander.js +43 -1
- package/lib/executable/NestiaMigrateCommander.js.map +1 -1
- package/lib/executable/NestiaMigrateCommander.mjs +4 -2
- package/lib/executable/NestiaMigrateInquirer.d.ts +29 -0
- package/lib/executable/NestiaMigrateInquirer.js +27 -25
- package/lib/executable/NestiaMigrateInquirer.js.map +1 -1
- package/lib/executable/NestiaMigrateInquirer.mjs +5 -7
- package/lib/factories/ExpressionFactory.d.ts +14 -0
- package/lib/factories/ExpressionFactory.js +14 -0
- package/lib/factories/ExpressionFactory.js.map +1 -1
- package/lib/factories/IdentifierFactory.d.ts +20 -0
- package/lib/factories/IdentifierFactory.js +20 -0
- package/lib/factories/IdentifierFactory.js.map +1 -1
- package/lib/factories/LiteralFactory.d.ts +18 -2
- package/lib/factories/LiteralFactory.js +18 -2
- package/lib/factories/LiteralFactory.js.map +1 -1
- package/lib/factories/StatementFactory.d.ts +26 -1
- package/lib/factories/StatementFactory.js +26 -1
- package/lib/factories/StatementFactory.js.map +1 -1
- package/lib/factories/SupportedStringFormats.d.ts +6 -0
- package/lib/factories/SupportedStringFormats.js +33 -0
- package/lib/factories/SupportedStringFormats.js.map +1 -0
- package/lib/factories/SupportedStringFormats.mjs +34 -0
- package/lib/factories/SupportedStringFormats.mjs.map +1 -0
- package/lib/factories/TypeFactory.d.ts +21 -0
- package/lib/factories/TypeFactory.js +13 -0
- package/lib/factories/TypeFactory.js.map +1 -1
- package/lib/factories/TypeLiteralFactory.d.ts +18 -0
- package/lib/factories/TypeLiteralFactory.js +18 -0
- package/lib/factories/TypeLiteralFactory.js.map +1 -1
- package/lib/internal/ts.d.ts +153 -0
- package/lib/internal/ts.js.map +1 -1
- package/lib/programmers/NestiaMigrateApiFileProgrammer.d.ts +31 -0
- package/lib/programmers/NestiaMigrateApiFileProgrammer.js +17 -0
- package/lib/programmers/NestiaMigrateApiFileProgrammer.js.map +1 -1
- package/lib/programmers/NestiaMigrateApiFunctionProgrammer.d.ts +40 -0
- package/lib/programmers/NestiaMigrateApiFunctionProgrammer.js +34 -5
- package/lib/programmers/NestiaMigrateApiFunctionProgrammer.js.map +1 -1
- package/lib/programmers/NestiaMigrateApiFunctionProgrammer.mjs +4 -2
- package/lib/programmers/NestiaMigrateApiNamespaceProgrammer.d.ts +39 -0
- package/lib/programmers/NestiaMigrateApiNamespaceProgrammer.js +57 -13
- package/lib/programmers/NestiaMigrateApiNamespaceProgrammer.js.map +1 -1
- package/lib/programmers/NestiaMigrateApiNamespaceProgrammer.mjs +17 -8
- package/lib/programmers/NestiaMigrateApiProgrammer.d.ts +18 -0
- package/lib/programmers/NestiaMigrateApiProgrammer.js +18 -0
- package/lib/programmers/NestiaMigrateApiProgrammer.js.map +1 -1
- package/lib/programmers/NestiaMigrateApiProgrammer.mjs +1 -1
- package/lib/programmers/NestiaMigrateApiSimulationProgrammer.d.ts +40 -0
- package/lib/programmers/NestiaMigrateApiSimulationProgrammer.js +51 -22
- package/lib/programmers/NestiaMigrateApiSimulationProgrammer.js.map +1 -1
- package/lib/programmers/NestiaMigrateApiSimulationProgrammer.mjs +13 -20
- package/lib/programmers/NestiaMigrateApiStartProgrammer.d.ts +17 -0
- package/lib/programmers/NestiaMigrateApiStartProgrammer.js +19 -8
- package/lib/programmers/NestiaMigrateApiStartProgrammer.js.map +1 -1
- package/lib/programmers/NestiaMigrateApiStartProgrammer.mjs +1 -6
- package/lib/programmers/NestiaMigrateDtoProgrammer.d.ts +30 -0
- package/lib/programmers/NestiaMigrateDtoProgrammer.js +17 -0
- package/lib/programmers/NestiaMigrateDtoProgrammer.js.map +1 -1
- package/lib/programmers/NestiaMigrateE2eFileProgrammer.d.ts +39 -0
- package/lib/programmers/NestiaMigrateE2eFileProgrammer.js +46 -5
- package/lib/programmers/NestiaMigrateE2eFileProgrammer.js.map +1 -1
- package/lib/programmers/NestiaMigrateE2eFileProgrammer.mjs +6 -2
- package/lib/programmers/NestiaMigrateE2eProgrammer.d.ts +16 -0
- package/lib/programmers/NestiaMigrateE2eProgrammer.js +16 -0
- package/lib/programmers/NestiaMigrateE2eProgrammer.js.map +1 -1
- package/lib/programmers/NestiaMigrateImportProgrammer.d.ts +75 -0
- package/lib/programmers/NestiaMigrateImportProgrammer.js +58 -3
- package/lib/programmers/NestiaMigrateImportProgrammer.js.map +1 -1
- package/lib/programmers/NestiaMigrateImportProgrammer.mjs +58 -3
- package/lib/programmers/NestiaMigrateNestControllerProgrammer.d.ts +28 -0
- package/lib/programmers/NestiaMigrateNestControllerProgrammer.js +16 -0
- package/lib/programmers/NestiaMigrateNestControllerProgrammer.js.map +1 -1
- package/lib/programmers/NestiaMigrateNestMethodProgrammer.d.ts +30 -0
- package/lib/programmers/NestiaMigrateNestMethodProgrammer.js +85 -13
- package/lib/programmers/NestiaMigrateNestMethodProgrammer.js.map +1 -1
- package/lib/programmers/NestiaMigrateNestMethodProgrammer.mjs +46 -9
- package/lib/programmers/NestiaMigrateNestModuleProgrammer.d.ts +16 -0
- package/lib/programmers/NestiaMigrateNestModuleProgrammer.js +16 -0
- package/lib/programmers/NestiaMigrateNestModuleProgrammer.js.map +1 -1
- package/lib/programmers/NestiaMigrateNestProgrammer.d.ts +17 -0
- package/lib/programmers/NestiaMigrateNestProgrammer.js +17 -0
- package/lib/programmers/NestiaMigrateNestProgrammer.js.map +1 -1
- package/lib/programmers/NestiaMigrateSchemaProgrammer.d.ts +16 -0
- package/lib/programmers/NestiaMigrateSchemaProgrammer.js +45 -9
- package/lib/programmers/NestiaMigrateSchemaProgrammer.js.map +1 -1
- package/lib/programmers/NestiaMigrateSchemaProgrammer.mjs +19 -8
- package/lib/structures/INestiaMigrateConfig.d.ts +21 -0
- package/lib/structures/INestiaMigrateContext.d.ts +15 -0
- package/lib/structures/INestiaMigrateController.d.ts +13 -0
- package/lib/structures/INestiaMigrateFile.d.ts +11 -0
- package/lib/utils/FilePrinter.d.ts +33 -0
- package/lib/utils/FilePrinter.js +33 -0
- package/lib/utils/FilePrinter.js.map +1 -1
- package/lib/utils/MapUtil.d.ts +17 -0
- package/lib/utils/MapUtil.js +19 -3
- package/lib/utils/MapUtil.js.map +1 -1
- package/lib/utils/MapUtil.mjs +1 -2
- package/lib/utils/PathTemplate.d.ts +41 -0
- package/lib/utils/PathTemplate.js +56 -0
- package/lib/utils/PathTemplate.js.map +1 -0
- package/lib/utils/PathTemplate.mjs +34 -0
- package/lib/utils/PathTemplate.mjs.map +1 -0
- package/lib/utils/RequestBody.d.ts +22 -0
- package/lib/utils/RequestBody.js +29 -0
- package/lib/utils/RequestBody.js.map +1 -0
- package/lib/utils/RequestBody.mjs +9 -0
- package/lib/utils/RequestBody.mjs.map +1 -0
- package/lib/utils/StringUtil.d.ts +55 -0
- package/lib/utils/StringUtil.js +93 -8
- package/lib/utils/StringUtil.js.map +1 -1
- package/lib/utils/StringUtil.mjs +30 -8
- package/lib/utils/SuccessStatus.d.ts +34 -0
- package/lib/utils/SuccessStatus.js +48 -0
- package/lib/utils/SuccessStatus.js.map +1 -0
- package/lib/utils/SuccessStatus.mjs +14 -0
- package/lib/utils/SuccessStatus.mjs.map +1 -0
- package/package.json +5 -4
- package/src/NestiaMigrateApplication.ts +151 -13
- package/src/analyzers/NestiaMigrateControllerAnalyzer.ts +94 -2
- package/src/archivers/NestiaMigrateFileArchiver.ts +34 -0
- package/src/bundles/NEST_TEMPLATE.ts +1 -1
- package/src/bundles/SDK_TEMPLATE.ts +1 -1
- package/src/executable/NestiaMigrateCommander.ts +47 -1
- package/src/executable/NestiaMigrateInquirer.ts +41 -26
- package/src/factories/ExpressionFactory.ts +14 -0
- package/src/factories/IdentifierFactory.ts +20 -0
- package/src/factories/LiteralFactory.ts +18 -2
- package/src/factories/StatementFactory.ts +26 -1
- package/src/factories/SupportedStringFormats.ts +29 -0
- package/src/factories/TypeFactory.ts +21 -0
- package/src/factories/TypeLiteralFactory.ts +18 -0
- package/src/internal/ts.ts +153 -0
- package/src/programmers/NestiaMigrateApiFileProgrammer.ts +35 -0
- package/src/programmers/NestiaMigrateApiFunctionProgrammer.ts +53 -4
- package/src/programmers/NestiaMigrateApiNamespaceProgrammer.ts +83 -20
- package/src/programmers/NestiaMigrateApiProgrammer.ts +18 -0
- package/src/programmers/NestiaMigrateApiSimulationProgrammer.ts +66 -73
- package/src/programmers/NestiaMigrateApiStartProgrammer.ts +19 -10
- package/src/programmers/NestiaMigrateDtoProgrammer.ts +33 -0
- package/src/programmers/NestiaMigrateE2eFileProgrammer.ts +83 -8
- package/src/programmers/NestiaMigrateE2eProgrammer.ts +16 -0
- package/src/programmers/NestiaMigrateImportProgrammer.ts +86 -5
- package/src/programmers/NestiaMigrateNestControllerProgrammer.ts +30 -0
- package/src/programmers/NestiaMigrateNestMethodProgrammer.ts +122 -29
- package/src/programmers/NestiaMigrateNestModuleProgrammer.ts +16 -0
- package/src/programmers/NestiaMigrateNestProgrammer.ts +17 -0
- package/src/programmers/NestiaMigrateSchemaProgrammer.ts +53 -18
- package/src/structures/INestiaMigrateConfig.ts +26 -0
- package/src/structures/INestiaMigrateContext.ts +17 -0
- package/src/structures/INestiaMigrateController.ts +16 -0
- package/src/structures/INestiaMigrateFile.ts +13 -0
- package/src/utils/FilePrinter.ts +33 -0
- package/src/utils/MapUtil.ts +18 -2
- package/src/utils/PathTemplate.ts +61 -0
- package/src/utils/RequestBody.ts +27 -0
- package/src/utils/StringUtil.ts +101 -9
- package/src/utils/SuccessStatus.ts +49 -0
- package/lib/factories/FormatCheatSheet.d.ts +0 -25
- package/lib/factories/FormatCheatSheet.js +0 -34
- package/lib/factories/FormatCheatSheet.js.map +0 -1
- package/lib/factories/FormatCheatSheet.mjs +0 -31
- package/lib/factories/FormatCheatSheet.mjs.map +0 -1
- package/src/factories/FormatCheatSheet.ts +0 -71
|
@@ -3,14 +3,42 @@ import { TypeLiteralFactory } from "../factories/TypeLiteralFactory.mjs";
|
|
|
3
3
|
import { MapUtil } from "../utils/MapUtil.mjs";
|
|
4
4
|
import { SyntaxKind, factory } from "@ttsc/factory";
|
|
5
5
|
//#region src/programmers/NestiaMigrateImportProgrammer.ts
|
|
6
|
+
/**
|
|
7
|
+
* Collects the imports that generated code needs and turns them into import
|
|
8
|
+
* statements.
|
|
9
|
+
*
|
|
10
|
+
* @evidence contracts/common.md#principled-implementation External imports are grouped by library into one clause with an optional default and a set of named instances, DTO imports are grouped by module specifier and emitted type-only, and a DTO is never imported into its own file.
|
|
11
|
+
* @evidence contracts/common.md#clear-and-simple-design One class with two collections and one emitter; the tag helper builds `typia.tags` references.
|
|
12
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts The imports follow the code that asks for them.
|
|
13
|
+
* @evidence contracts/common.md#meaningful-documentation The comment states its purpose.
|
|
14
|
+
*/
|
|
6
15
|
var NestiaMigrateImportProgrammer = class {
|
|
7
16
|
constructor() {
|
|
8
17
|
this.external_ = /* @__PURE__ */ new Map();
|
|
9
18
|
this.dtos_ = /* @__PURE__ */ new Set();
|
|
10
19
|
}
|
|
20
|
+
/**
|
|
21
|
+
* Reports whether no import has been requested.
|
|
22
|
+
*
|
|
23
|
+
* @evidence contracts/common.md#principled-implementation The importer is empty exactly when both collections are empty.
|
|
24
|
+
* @evidence contracts/common.md#clear-and-simple-design One expression.
|
|
25
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts It reads the state.
|
|
26
|
+
* @evidence contracts/common.md#meaningful-documentation The comment states the meaning.
|
|
27
|
+
*/
|
|
11
28
|
empty() {
|
|
12
29
|
return this.external_.size === 0 && this.dtos_.size === 0;
|
|
13
30
|
}
|
|
31
|
+
/**
|
|
32
|
+
* Requests an import from a library and returns the local name to use.
|
|
33
|
+
*
|
|
34
|
+
* The returned name is the first segment of the requested name, so a nested
|
|
35
|
+
* name such as `tags.Type` imports `tags`.
|
|
36
|
+
*
|
|
37
|
+
* @evidence contracts/common.md#principled-implementation A default import replaces the clause's default and an instance import adds a named import, and the first segment of a dotted name is what the code refers to.
|
|
38
|
+
* @evidence contracts/common.md#clear-and-simple-design One function over one map.
|
|
39
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts The library and the name come from the caller.
|
|
40
|
+
* @evidence contracts/common.md#meaningful-documentation The comment states the returned name.
|
|
41
|
+
*/
|
|
14
42
|
external(props) {
|
|
15
43
|
const clause = MapUtil.take(this.external_)(props.library)(() => ({
|
|
16
44
|
default: null,
|
|
@@ -21,11 +49,29 @@ var NestiaMigrateImportProgrammer = class {
|
|
|
21
49
|
else clause.instances.add(name);
|
|
22
50
|
return name;
|
|
23
51
|
}
|
|
52
|
+
/**
|
|
53
|
+
* Requests a DTO import and returns a reference to it, qualified by a
|
|
54
|
+
* namespace when one is given.
|
|
55
|
+
*
|
|
56
|
+
* @evidence contracts/common.md#principled-implementation The DTO is recorded by the first segment of its dotted name, which is the file that exports it, and the returned reference keeps the full name, with the namespace prepended when one is given.
|
|
57
|
+
* @evidence contracts/common.md#clear-and-simple-design One function over one set.
|
|
58
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts The name comes from the caller.
|
|
59
|
+
* @evidence contracts/common.md#meaningful-documentation The comment states the reference.
|
|
60
|
+
*/
|
|
24
61
|
dto(name, namespace) {
|
|
25
|
-
const
|
|
26
|
-
this.dtos_.add(
|
|
27
|
-
return factory.createTypeReferenceNode(namespace?.length ? factory.createQualifiedName(factory.createIdentifier(
|
|
62
|
+
const segments = name.split(".");
|
|
63
|
+
this.dtos_.add(segments[0]);
|
|
64
|
+
return factory.createTypeReferenceNode(namespace?.length ? segments.reduce((left, segment) => factory.createQualifiedName(left, factory.createIdentifier(segment)), factory.createIdentifier(namespace)) : name);
|
|
28
65
|
}
|
|
66
|
+
/**
|
|
67
|
+
* Requests the `typia` tags import and returns a reference to a tag with an
|
|
68
|
+
* optional literal argument.
|
|
69
|
+
*
|
|
70
|
+
* @evidence contracts/common.md#principled-implementation The argument is converted to a literal type, so `Minimum<3>` is written as a type reference with the literal.
|
|
71
|
+
* @evidence contracts/common.md#clear-and-simple-design One function delegating the literal building.
|
|
72
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts The tag name and the argument come from the caller.
|
|
73
|
+
* @evidence contracts/common.md#meaningful-documentation The comment states the reference.
|
|
74
|
+
*/
|
|
29
75
|
tag(type, arg) {
|
|
30
76
|
const instance = this.external({
|
|
31
77
|
type: "instance",
|
|
@@ -34,6 +80,15 @@ var NestiaMigrateImportProgrammer = class {
|
|
|
34
80
|
});
|
|
35
81
|
return factory.createTypeReferenceNode(`${instance}.${type}`, arg === void 0 ? [] : [TypeLiteralFactory.generate(arg)]);
|
|
36
82
|
}
|
|
83
|
+
/**
|
|
84
|
+
* Returns the import statements: the external imports, a blank line when both
|
|
85
|
+
* kinds exist, and the type-only DTO imports.
|
|
86
|
+
*
|
|
87
|
+
* @evidence contracts/common.md#principled-implementation DTO names are grouped by the specifier that `dtoPath` returns, a name equal to the current file is skipped so a file never imports itself, and package specifiers merge into one clause.
|
|
88
|
+
* @evidence contracts/common.md#clear-and-simple-design One function with two emit sections.
|
|
89
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts The specifier rule is the caller's.
|
|
90
|
+
* @evidence contracts/common.md#meaningful-documentation The comment states the result and the self-import rule.
|
|
91
|
+
*/
|
|
37
92
|
toStatements(dtoPath, current) {
|
|
38
93
|
const modules = /* @__PURE__ */ new Map();
|
|
39
94
|
for (const name of this.dtos_) if (current === void 0 || name !== current.split(".")[0]) MapUtil.take(modules)(dtoPath(name))(() => []).push(name);
|
|
@@ -2,11 +2,39 @@ import { OpenApi } from "@typia/interface";
|
|
|
2
2
|
import ts from "../internal/ts";
|
|
3
3
|
import { INestiaMigrateConfig } from "../structures/INestiaMigrateConfig";
|
|
4
4
|
import { INestiaMigrateController } from "../structures/INestiaMigrateController";
|
|
5
|
+
/**
|
|
6
|
+
* Generates the source of one NestJS controller.
|
|
7
|
+
*
|
|
8
|
+
* @evidence contracts/common.md#principled-implementation The controller class is decorated with `@Controller` and its path, each route becomes a method written by the configured method programmer or the default one, and the DTO types are imported by package name because they live in the API package.
|
|
9
|
+
* @evidence contracts/common.md#clear-and-simple-design One function; the method programmer is replaceable through the configuration.
|
|
10
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts The replaceable programmer is a documented extension point.
|
|
11
|
+
* @evidence contracts/common.md#meaningful-documentation The comment states what is generated.
|
|
12
|
+
*/
|
|
5
13
|
export declare namespace NestiaMigrateNestControllerProgrammer {
|
|
14
|
+
/**
|
|
15
|
+
* The input of one controller: the configuration, the components, and the
|
|
16
|
+
* controller.
|
|
17
|
+
*
|
|
18
|
+
* @evidence contracts/common.md#principled-implementation The record holds exactly what the generation needs.
|
|
19
|
+
* @evidence contracts/common.md#clear-and-simple-design A flat record.
|
|
20
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts It is a type and adds no runtime behavior.
|
|
21
|
+
* @evidence contracts/common.md#meaningful-documentation The comment lists the fields.
|
|
22
|
+
*/
|
|
6
23
|
interface IProps {
|
|
24
|
+
/** Generation options and an optional controller-method writer. */
|
|
7
25
|
config: INestiaMigrateConfig;
|
|
26
|
+
/** Schemas needed by generated controller method types. */
|
|
8
27
|
components: OpenApi.IComponents;
|
|
28
|
+
/** Controller name, router prefix and grouped operations. */
|
|
9
29
|
controller: INestiaMigrateController;
|
|
10
30
|
}
|
|
31
|
+
/**
|
|
32
|
+
* Returns the statements of a controller file.
|
|
33
|
+
*
|
|
34
|
+
* @evidence contracts/common.md#principled-implementation Blank lines separate the methods, and the imports come first.
|
|
35
|
+
* @evidence contracts/common.md#clear-and-simple-design One function.
|
|
36
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts The content follows the controller.
|
|
37
|
+
* @evidence contracts/common.md#meaningful-documentation The comment states the result.
|
|
38
|
+
*/
|
|
11
39
|
const write: (props: IProps) => ts.Statement[];
|
|
12
40
|
}
|
|
@@ -5,8 +5,24 @@ const factory_1 = require("@ttsc/factory");
|
|
|
5
5
|
const FilePrinter_1 = require("../utils/FilePrinter");
|
|
6
6
|
const NestiaMigrateImportProgrammer_1 = require("./NestiaMigrateImportProgrammer");
|
|
7
7
|
const NestiaMigrateNestMethodProgrammer_1 = require("./NestiaMigrateNestMethodProgrammer");
|
|
8
|
+
/**
|
|
9
|
+
* Generates the source of one NestJS controller.
|
|
10
|
+
*
|
|
11
|
+
* @evidence contracts/common.md#principled-implementation The controller class is decorated with `@Controller` and its path, each route becomes a method written by the configured method programmer or the default one, and the DTO types are imported by package name because they live in the API package.
|
|
12
|
+
* @evidence contracts/common.md#clear-and-simple-design One function; the method programmer is replaceable through the configuration.
|
|
13
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts The replaceable programmer is a documented extension point.
|
|
14
|
+
* @evidence contracts/common.md#meaningful-documentation The comment states what is generated.
|
|
15
|
+
*/
|
|
8
16
|
var NestiaMigrateNestControllerProgrammer;
|
|
9
17
|
(function (NestiaMigrateNestControllerProgrammer) {
|
|
18
|
+
/**
|
|
19
|
+
* Returns the statements of a controller file.
|
|
20
|
+
*
|
|
21
|
+
* @evidence contracts/common.md#principled-implementation Blank lines separate the methods, and the imports come first.
|
|
22
|
+
* @evidence contracts/common.md#clear-and-simple-design One function.
|
|
23
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts The content follows the controller.
|
|
24
|
+
* @evidence contracts/common.md#meaningful-documentation The comment states the result.
|
|
25
|
+
*/
|
|
10
26
|
NestiaMigrateNestControllerProgrammer.write = (props) => {
|
|
11
27
|
const importer = new NestiaMigrateImportProgrammer_1.NestiaMigrateImportProgrammer();
|
|
12
28
|
const $class = factory_1.factory.createClassDeclaration([
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NestiaMigrateNestControllerProgrammer.js","sourceRoot":"","sources":["../../src/programmers/NestiaMigrateNestControllerProgrammer.ts"],"names":[],"mappings":";;;AAAA,2CAAoD;AAMpD,sDAAmD;AACnD,mFAAgF;AAChF,2FAAwF;AAExF,IAAiB,qCAAqC,
|
|
1
|
+
{"version":3,"file":"NestiaMigrateNestControllerProgrammer.js","sourceRoot":"","sources":["../../src/programmers/NestiaMigrateNestControllerProgrammer.ts"],"names":[],"mappings":";;;AAAA,2CAAoD;AAMpD,sDAAmD;AACnD,mFAAgF;AAChF,2FAAwF;AAExF;;;;;;;GAOG;AACH,IAAiB,qCAAqC,CA6ErD;AA7ED,WAAiB,qCAAqC;IAqBpD;;;;;;;OAOG;IACU,2CAAK,GAAG,CAAC,KAAa,EAAkB,EAAE;QACrD,MAAM,QAAQ,GACZ,IAAI,6DAA6B,EAAE,CAAC;QACtC,MAAM,MAAM,GAAG,iBAAO,CAAC,sBAAsB,CAC3C;YACE,iBAAO,CAAC,eAAe,CACrB,iBAAO,CAAC,oBAAoB,CAC1B,iBAAO,CAAC,gBAAgB,CACtB,QAAQ,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43 @@ import ts from "../internal/ts";
|
|
|
4
4
|
import { INestiaMigrateConfig } from "../structures/INestiaMigrateConfig";
|
|
5
5
|
import { INestiaMigrateController } from "../structures/INestiaMigrateController";
|
|
6
6
|
import { NestiaMigrateImportProgrammer } from "./NestiaMigrateImportProgrammer";
|
|
7
|
+
/**
|
|
8
|
+
* Generates the controller method of one route.
|
|
9
|
+
*
|
|
10
|
+
* @evidence contracts/common.md#principled-implementation The method carries `TypedRoute`, `TypedException`, `HumanRoute`, and example decorators as the route requires, one parameter per path, header, query, and body input with the matching typed decorator, and a body that mentions each parameter and returns `typia.random` of the response type.
|
|
11
|
+
* @evidence contracts/common.md#clear-and-simple-design One entry function and private writers for the description, the decorators, and the parameters.
|
|
12
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts The output derives from the route; the body is a stub that returns random data because the document does not define the behavior.
|
|
13
|
+
* @evidence contracts/common.md#meaningful-documentation The comment states what is generated.
|
|
14
|
+
*/
|
|
7
15
|
export declare namespace NestiaMigrateNestMethodProgrammer {
|
|
16
|
+
/**
|
|
17
|
+
* The input of one method: the configuration, the components, the importer,
|
|
18
|
+
* the controller, and the route.
|
|
19
|
+
*
|
|
20
|
+
* @evidence contracts/common.md#principled-implementation The record holds exactly what the generation needs.
|
|
21
|
+
* @evidence contracts/common.md#clear-and-simple-design A flat record.
|
|
22
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts It is a type and adds no runtime behavior.
|
|
23
|
+
* @evidence contracts/common.md#meaningful-documentation The comment lists the fields.
|
|
24
|
+
*/
|
|
8
25
|
interface IContext {
|
|
26
|
+
/** Generation options, including the author tag used on the handler. */
|
|
9
27
|
config: INestiaMigrateConfig;
|
|
28
|
+
/** Component schemas referenced by request and response types. */
|
|
10
29
|
components: OpenApi.IComponents;
|
|
30
|
+
/** Controller-file import collector shared by all its methods. */
|
|
11
31
|
importer: NestiaMigrateImportProgrammer;
|
|
32
|
+
/** Controller prefix removed from this operation's router path. */
|
|
12
33
|
controller: INestiaMigrateController;
|
|
34
|
+
/** Analyzed operation supplying method, schemas and examples. */
|
|
13
35
|
route: IHttpMigrateRoute;
|
|
14
36
|
}
|
|
37
|
+
/**
|
|
38
|
+
* Returns the method declaration of a route.
|
|
39
|
+
*
|
|
40
|
+
* @evidence contracts/common.md#principled-implementation The decorators and the parameters follow the route's HTTP method, path relative to the controller, and inputs.
|
|
41
|
+
* @evidence contracts/common.md#clear-and-simple-design One function composing the private writers.
|
|
42
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts The method follows the route.
|
|
43
|
+
* @evidence contracts/common.md#meaningful-documentation The comment states the result.
|
|
44
|
+
*/
|
|
15
45
|
const write: (ctx: IContext) => ts.MethodDeclaration;
|
|
16
46
|
}
|
|
@@ -2,15 +2,34 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.NestiaMigrateNestMethodProgrammer = void 0;
|
|
4
4
|
const factory_1 = require("@ttsc/factory");
|
|
5
|
+
const NestiaMigrateControllerAnalyzer_1 = require("../analyzers/NestiaMigrateControllerAnalyzer");
|
|
5
6
|
const ExpressionFactory_1 = require("../factories/ExpressionFactory");
|
|
6
7
|
const IdentifierFactory_1 = require("../factories/IdentifierFactory");
|
|
7
8
|
const LiteralFactory_1 = require("../factories/LiteralFactory");
|
|
8
9
|
const TypeFactory_1 = require("../factories/TypeFactory");
|
|
9
10
|
const FilePrinter_1 = require("../utils/FilePrinter");
|
|
11
|
+
const RequestBody_1 = require("../utils/RequestBody");
|
|
10
12
|
const StringUtil_1 = require("../utils/StringUtil");
|
|
13
|
+
const SuccessStatus_1 = require("../utils/SuccessStatus");
|
|
11
14
|
const NestiaMigrateSchemaProgrammer_1 = require("./NestiaMigrateSchemaProgrammer");
|
|
15
|
+
/**
|
|
16
|
+
* Generates the controller method of one route.
|
|
17
|
+
*
|
|
18
|
+
* @evidence contracts/common.md#principled-implementation The method carries `TypedRoute`, `TypedException`, `HumanRoute`, and example decorators as the route requires, one parameter per path, header, query, and body input with the matching typed decorator, and a body that mentions each parameter and returns `typia.random` of the response type.
|
|
19
|
+
* @evidence contracts/common.md#clear-and-simple-design One entry function and private writers for the description, the decorators, and the parameters.
|
|
20
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts The output derives from the route; the body is a stub that returns random data because the document does not define the behavior.
|
|
21
|
+
* @evidence contracts/common.md#meaningful-documentation The comment states what is generated.
|
|
22
|
+
*/
|
|
12
23
|
var NestiaMigrateNestMethodProgrammer;
|
|
13
24
|
(function (NestiaMigrateNestMethodProgrammer) {
|
|
25
|
+
/**
|
|
26
|
+
* Returns the method declaration of a route.
|
|
27
|
+
*
|
|
28
|
+
* @evidence contracts/common.md#principled-implementation The decorators and the parameters follow the route's HTTP method, path relative to the controller, and inputs.
|
|
29
|
+
* @evidence contracts/common.md#clear-and-simple-design One function composing the private writers.
|
|
30
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts The method follows the route.
|
|
31
|
+
* @evidence contracts/common.md#meaningful-documentation The comment states the result.
|
|
32
|
+
*/
|
|
14
33
|
NestiaMigrateNestMethodProgrammer.write = (ctx) => {
|
|
15
34
|
const output = ctx.route.success
|
|
16
35
|
? NestiaMigrateSchemaProgrammer_1.NestiaMigrateSchemaProgrammer.write({
|
|
@@ -58,7 +77,7 @@ var NestiaMigrateNestMethodProgrammer;
|
|
|
58
77
|
if (ctx.route.operation()["x-samchon-human"] === true)
|
|
59
78
|
decorators.push(factory_1.factory.createDecorator(factory_1.factory.createCallExpression(external("@nestia/core", "HumanRoute"), undefined, undefined)));
|
|
60
79
|
// ROUTER
|
|
61
|
-
const localPath = ctx.route
|
|
80
|
+
const localPath = NestiaMigrateControllerAnalyzer_1.NestiaMigrateControllerAnalyzer.routePath(ctx.route)
|
|
62
81
|
.slice(ctx.controller.path.length)
|
|
63
82
|
.split("/")
|
|
64
83
|
.filter((str) => !!str.length)
|
|
@@ -66,17 +85,27 @@ var NestiaMigrateNestMethodProgrammer;
|
|
|
66
85
|
const router = (instance) => factory_1.factory.createDecorator(factory_1.factory.createCallExpression(IdentifierFactory_1.IdentifierFactory.access(external("@nestia/core", instance), StringUtil_1.StringUtil.capitalize(ctx.route.method)), [], localPath.length
|
|
67
86
|
? [factory_1.factory.createStringLiteral(localPath)]
|
|
68
87
|
: undefined));
|
|
88
|
+
// a vanilla NestJS method decorator, relative to the controller like the
|
|
89
|
+
// nestia ones: the document's full path would be joined onto the
|
|
90
|
+
// controller's again
|
|
91
|
+
const nest = (method) => factory_1.factory.createDecorator(factory_1.factory.createCallExpression(external("@nestjs/common", method), [], localPath.length
|
|
92
|
+
? [factory_1.factory.createStringLiteral(localPath)]
|
|
93
|
+
: undefined));
|
|
69
94
|
if ((_a = ctx.route.success) === null || _a === void 0 ? void 0 : _a["x-nestia-encrypted"])
|
|
70
95
|
decorators.push(router("EncryptedRoute"));
|
|
71
96
|
else if (((_b = ctx.route.success) === null || _b === void 0 ? void 0 : _b.type) === "text/plain")
|
|
72
|
-
decorators.push(
|
|
97
|
+
decorators.push(nest(StringUtil_1.StringUtil.capitalize(ctx.route.method)));
|
|
73
98
|
else if (((_c = ctx.route.success) === null || _c === void 0 ? void 0 : _c.type) === "application/x-www-form-urlencoded")
|
|
74
99
|
decorators.push(router("TypedQuery"));
|
|
75
100
|
else if (ctx.route.method === "head")
|
|
76
|
-
decorators.push(
|
|
101
|
+
decorators.push(nest("Head"));
|
|
77
102
|
else if (ctx.route.success === null ||
|
|
78
103
|
((_d = ctx.route.success) === null || _d === void 0 ? void 0 : _d.type) === "application/json")
|
|
79
104
|
decorators.push(router("TypedRoute"));
|
|
105
|
+
// NestJS answers 201 for POST and 200 otherwise
|
|
106
|
+
const status = SuccessStatus_1.SuccessStatus.of(ctx.route);
|
|
107
|
+
if (status !== null && status !== SuccessStatus_1.SuccessStatus.nest(ctx.route))
|
|
108
|
+
decorators.push(factory_1.factory.createDecorator(factory_1.factory.createCallExpression(external("@nestjs/common", "HttpCode"), undefined, [ExpressionFactory_1.ExpressionFactory.number(status)])));
|
|
80
109
|
for (const [key, value] of Object.entries((_f = ctx.route.exceptions) !== null && _f !== void 0 ? _f : {}))
|
|
81
110
|
decorators.push(factory_1.factory.createDecorator(factory_1.factory.createCallExpression(external("@nestia/core", "TypedException"), [
|
|
82
111
|
NestiaMigrateSchemaProgrammer_1.NestiaMigrateSchemaProgrammer.write({
|
|
@@ -94,7 +123,7 @@ var NestiaMigrateNestMethodProgrammer;
|
|
|
94
123
|
])));
|
|
95
124
|
return decorators;
|
|
96
125
|
};
|
|
97
|
-
const writeParameters = (ctx) =>
|
|
126
|
+
const writeParameters = (ctx) => [
|
|
98
127
|
...ctx.route.parameters.map((p) => factory_1.factory.createParameterDeclaration([
|
|
99
128
|
...writeExampleDecorators("Parameter")(ctx.importer)(p.parameter()),
|
|
100
129
|
factory_1.factory.createDecorator(factory_1.factory.createCallExpression(factory_1.factory.createIdentifier(ctx.importer.external({
|
|
@@ -161,15 +190,13 @@ var NestiaMigrateNestMethodProgrammer;
|
|
|
161
190
|
: [],
|
|
162
191
|
})(ctx.components)(ctx.importer)({
|
|
163
192
|
schema: ctx.route.body.schema,
|
|
164
|
-
required:
|
|
165
|
-
ctx.route.body.type === "text/plain") &&
|
|
166
|
-
((_a = ctx.route.operation().requestBody) === null || _a === void 0 ? void 0 : _a.required) === false),
|
|
193
|
+
required: RequestBody_1.RequestBody.optional(ctx.route) === false,
|
|
167
194
|
example: ctx.route.body.media().example,
|
|
168
195
|
examples: ctx.route.body.media().examples,
|
|
169
196
|
}),
|
|
170
197
|
]
|
|
171
198
|
: []),
|
|
172
|
-
];
|
|
199
|
+
];
|
|
173
200
|
const writeDtoParameter = (accessor) => (components) => (importer) => (props) => {
|
|
174
201
|
const instance = factory_1.factory.createIdentifier(importer.external({
|
|
175
202
|
type: "instance",
|
|
@@ -201,11 +228,56 @@ var NestiaMigrateNestMethodProgrammer;
|
|
|
201
228
|
})), kind), [], [LiteralFactory_1.LiteralFactory.write(media.example)])),
|
|
202
229
|
]
|
|
203
230
|
: []),
|
|
204
|
-
...Object.entries((_a = media.examples) !== null && _a !== void 0 ? _a : {}).
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
231
|
+
...Object.entries((_a = media.examples) !== null && _a !== void 0 ? _a : {}).flatMap(([key, example]) => {
|
|
232
|
+
const value = exampleValue(example);
|
|
233
|
+
if (value === null)
|
|
234
|
+
return [];
|
|
235
|
+
return factory_1.factory.createDecorator(factory_1.factory.createCallExpression(IdentifierFactory_1.IdentifierFactory.access(factory_1.factory.createIdentifier(importer.external({
|
|
236
|
+
type: "instance",
|
|
237
|
+
library: "@nestia/core",
|
|
238
|
+
name: "SwaggerExample",
|
|
239
|
+
})), kind), [], [
|
|
240
|
+
factory_1.factory.createStringLiteral(key),
|
|
241
|
+
LiteralFactory_1.LiteralFactory.write(value.value),
|
|
242
|
+
]));
|
|
243
|
+
}),
|
|
209
244
|
]; };
|
|
210
245
|
})(NestiaMigrateNestMethodProgrammer || (exports.NestiaMigrateNestMethodProgrammer = NestiaMigrateNestMethodProgrammer = {}));
|
|
246
|
+
/**
|
|
247
|
+
* The value a named example stands for, or `null` when it names none.
|
|
248
|
+
*
|
|
249
|
+
* OpenAPI names examples with Example Objects, whose `value` (or, since 3.2,
|
|
250
|
+
* `dataValue`) holds the value, and a `$ref` to one arrives resolved. Documents
|
|
251
|
+
* from earlier nestia versions held the values themselves, so an object is read
|
|
252
|
+
* as an Example Object only when it is one: it has one of the value fields, and
|
|
253
|
+
* every other key is an Example Object field or an extension. A raw value of
|
|
254
|
+
* exactly that shape is ambiguous and is read as an Example Object, as a
|
|
255
|
+
* conforming document means it. An Example Object that only points at its value
|
|
256
|
+
* (`externalValue`) or only serializes it (`serializedValue`) gives
|
|
257
|
+
* `SwaggerExample` nothing to hold.
|
|
258
|
+
*/
|
|
259
|
+
const exampleValue = (example) => {
|
|
260
|
+
if (isExampleObject(example) === false)
|
|
261
|
+
return { value: example };
|
|
262
|
+
const record = example;
|
|
263
|
+
if (Object.prototype.hasOwnProperty.call(record, "value"))
|
|
264
|
+
return { value: record.value };
|
|
265
|
+
if (Object.prototype.hasOwnProperty.call(record, "dataValue"))
|
|
266
|
+
return { value: record.dataValue };
|
|
267
|
+
return null;
|
|
268
|
+
};
|
|
269
|
+
const isExampleObject = (example) => typeof example === "object" &&
|
|
270
|
+
example !== null &&
|
|
271
|
+
Array.isArray(example) === false &&
|
|
272
|
+
VALUE_KEYS.some((key) => Object.prototype.hasOwnProperty.call(example, key)) &&
|
|
273
|
+
Object.keys(example).every((key) => VALUE_KEYS.includes(key) ||
|
|
274
|
+
key === "summary" ||
|
|
275
|
+
key === "description" ||
|
|
276
|
+
key.startsWith("x-"));
|
|
277
|
+
const VALUE_KEYS = [
|
|
278
|
+
"value",
|
|
279
|
+
"dataValue",
|
|
280
|
+
"serializedValue",
|
|
281
|
+
"externalValue",
|
|
282
|
+
];
|
|
211
283
|
//# sourceMappingURL=NestiaMigrateNestMethodProgrammer.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NestiaMigrateNestMethodProgrammer.js","sourceRoot":"","sources":["../../src/programmers/NestiaMigrateNestMethodProgrammer.ts"],"names":[],"mappings":";;;AAAA,2CAAoD;AAIpD,sEAAmE;AACnE,sEAAmE;AACnE,gEAA6D;AAC7D,0DAAuD;AAIvD,sDAAmD;AACnD,oDAAiD;AAEjD,mFAAgF;AAEhF,IAAiB,iCAAiC,CAiYjD;AAjYD,WAAiB,iCAAiC;IASnC,uCAAK,GAAG,CAAC,GAAa,EAAwB,EAAE;QAC3D,MAAM,MAAM,GAAgB,GAAG,CAAC,KAAK,CAAC,OAAO;YAC3C,CAAC,CAAC,6DAA6B,CAAC,KAAK,CAAC;gBAClC,UAAU,EAAE,GAAG,CAAC,UAAU;gBAC1B,QAAQ,EAAE,GAAG,CAAC,QAAQ;gBACtB,MAAM,EAAE,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM;aACjC,CAAC;YACJ,CAA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BAAO,CAAC,mBAAmB,CAAC,GAAG,CAAC,EAAE,+BAAc,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAChE,CACF,CACF;KACF,GAAA,CAAC;AACN,CAAC,EAjYgB,iCAAiC,aAAjC,iCAAiC,GAAjC,iCAAiC,QAiYjD"}
|
|
1
|
+
{"version":3,"file":"NestiaMigrateNestMethodProgrammer.js","sourceRoot":"","sources":["../../src/programmers/NestiaMigrateNestMethodProgrammer.ts"],"names":[],"mappings":";;;AAAA,2CAAoD;AAIpD,kGAA+F;AAC/F,sEAAmE;AACnE,sEAAmE;AACnE,gEAA6D;AAC7D,0DAAuD;AAIvD,sDAAmD;AACnD,sDAAmD;AACnD,oDAAiD;AACjD,0DAAuD;AAEvD,mFAAgF;AAEhF;;;;;;;GAOG;AACH,IAAiB,iCAAiC,CAsajD;AAtaD,WAAiB,iCAAiC;IA2BhD;;;;;;;OAOG;IACU,uCAAK,GAAG,CAAC,GAAa,EAAwB,EAAE;QAC3D,MAAM,MAAM,GAAgB,GAAG,CAAC,KAAK,CAAC,OAAO;YAC3C,CAAC,CAAC,6DAA6B,CAAC,KAAK,CAAC;gBAClC,UAAU,EAAE,GAAG,CAAC,UAAU;gBAC1B,QAAQ,EAAE,GAAG,CAAC,QAAQ;gBACtB,MAAM,EAAE,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM;aACjC,CAAC;YACJ,CAAC,CAAC,yBAAW,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;QAEhC,MAAM,MAAM,GAAyB,iBAAO,CAAC,uBAAuB,CAClE;YACE,GAAG,qBAAqB,CAAC,GAAG,CAAC;YAC7B,iBAAO,CAAC,WAAW,CAAC,oBAAU,CAAC,aAAa,CAAC;YAC7C,iBAAO,CAAC,WAAW,CAAC,oBAAU,CAAC,YAAY,CAAC;SAC7C,EACD,SAAS,EACT,GAAG,CAAC,KAAK,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,CAAC,CAAE,EAC1B,SAA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GAAG,CAAC,UAAU,CAAC,IAAI,CAAC,CACvB,CAAC;AAEJ,MAAM,UAAU,GAAa;IAC3B,OAAO;IACP,WAAW;IACX,iBAAiB;IACjB,eAAe;CAChB,CAAC"}
|
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
import { FilePrinter } from "../utils/FilePrinter.mjs";
|
|
2
2
|
import { TypeFactory } from "../factories/TypeFactory.mjs";
|
|
3
3
|
import { IdentifierFactory } from "../factories/IdentifierFactory.mjs";
|
|
4
|
+
import { RequestBody } from "../utils/RequestBody.mjs";
|
|
5
|
+
import { SuccessStatus } from "../utils/SuccessStatus.mjs";
|
|
4
6
|
import { StringUtil } from "../utils/StringUtil.mjs";
|
|
5
7
|
import { NestiaMigrateSchemaProgrammer } from "./NestiaMigrateSchemaProgrammer.mjs";
|
|
6
8
|
import { ExpressionFactory } from "../factories/ExpressionFactory.mjs";
|
|
7
9
|
import { LiteralFactory } from "../factories/LiteralFactory.mjs";
|
|
10
|
+
import { NestiaMigrateControllerAnalyzer } from "../analyzers/NestiaMigrateControllerAnalyzer.mjs";
|
|
8
11
|
import { SyntaxKind, factory } from "@ttsc/factory";
|
|
9
12
|
//#region src/programmers/NestiaMigrateNestMethodProgrammer.ts
|
|
10
13
|
let NestiaMigrateNestMethodProgrammer;
|
|
@@ -41,13 +44,16 @@ let NestiaMigrateNestMethodProgrammer;
|
|
|
41
44
|
const decorators = [];
|
|
42
45
|
if (ctx.route.success) decorators.push(...writeExampleDecorators("Response")(ctx.importer)(ctx.route.success.media()));
|
|
43
46
|
if (ctx.route.operation()["x-samchon-human"] === true) decorators.push(factory.createDecorator(factory.createCallExpression(external("@nestia/core", "HumanRoute"), void 0, void 0)));
|
|
44
|
-
const localPath = ctx.route.
|
|
47
|
+
const localPath = NestiaMigrateControllerAnalyzer.routePath(ctx.route).slice(ctx.controller.path.length).split("/").filter((str) => !!str.length).join("/");
|
|
45
48
|
const router = (instance) => factory.createDecorator(factory.createCallExpression(IdentifierFactory.access(external("@nestia/core", instance), StringUtil.capitalize(ctx.route.method)), [], localPath.length ? [factory.createStringLiteral(localPath)] : void 0));
|
|
49
|
+
const nest = (method) => factory.createDecorator(factory.createCallExpression(external("@nestjs/common", method), [], localPath.length ? [factory.createStringLiteral(localPath)] : void 0));
|
|
46
50
|
if (ctx.route.success?.["x-nestia-encrypted"]) decorators.push(router("EncryptedRoute"));
|
|
47
|
-
else if (ctx.route.success?.type === "text/plain") decorators.push(
|
|
51
|
+
else if (ctx.route.success?.type === "text/plain") decorators.push(nest(StringUtil.capitalize(ctx.route.method)));
|
|
48
52
|
else if (ctx.route.success?.type === "application/x-www-form-urlencoded") decorators.push(router("TypedQuery"));
|
|
49
|
-
else if (ctx.route.method === "head") decorators.push(
|
|
53
|
+
else if (ctx.route.method === "head") decorators.push(nest("Head"));
|
|
50
54
|
else if (ctx.route.success === null || ctx.route.success?.type === "application/json") decorators.push(router("TypedRoute"));
|
|
55
|
+
const status = SuccessStatus.of(ctx.route);
|
|
56
|
+
if (status !== null && status !== SuccessStatus.nest(ctx.route)) decorators.push(factory.createDecorator(factory.createCallExpression(external("@nestjs/common", "HttpCode"), void 0, [ExpressionFactory.number(status)])));
|
|
51
57
|
for (const [key, value] of Object.entries(ctx.route.exceptions ?? {})) decorators.push(factory.createDecorator(factory.createCallExpression(external("@nestia/core", "TypedException"), [NestiaMigrateSchemaProgrammer.write({
|
|
52
58
|
components: ctx.components,
|
|
53
59
|
importer: ctx.importer,
|
|
@@ -95,7 +101,7 @@ let NestiaMigrateNestMethodProgrammer;
|
|
|
95
101
|
})), void 0, void 0))] : []
|
|
96
102
|
})(ctx.components)(ctx.importer)({
|
|
97
103
|
schema: ctx.route.body.schema,
|
|
98
|
-
required:
|
|
104
|
+
required: RequestBody.optional(ctx.route) === false,
|
|
99
105
|
example: ctx.route.body.media().example,
|
|
100
106
|
examples: ctx.route.body.media().examples
|
|
101
107
|
})] : []
|
|
@@ -116,12 +122,43 @@ let NestiaMigrateNestMethodProgrammer;
|
|
|
116
122
|
type: "instance",
|
|
117
123
|
library: "@nestia/core",
|
|
118
124
|
name: "SwaggerExample"
|
|
119
|
-
})), kind), [], [LiteralFactory.write(media.example)]))] : [], ...Object.entries(media.examples ?? {}).
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
125
|
+
})), kind), [], [LiteralFactory.write(media.example)]))] : [], ...Object.entries(media.examples ?? {}).flatMap(([key, example]) => {
|
|
126
|
+
const value = exampleValue(example);
|
|
127
|
+
if (value === null) return [];
|
|
128
|
+
return factory.createDecorator(factory.createCallExpression(IdentifierFactory.access(factory.createIdentifier(importer.external({
|
|
129
|
+
type: "instance",
|
|
130
|
+
library: "@nestia/core",
|
|
131
|
+
name: "SwaggerExample"
|
|
132
|
+
})), kind), [], [factory.createStringLiteral(key), LiteralFactory.write(value.value)]));
|
|
133
|
+
})];
|
|
124
134
|
})(NestiaMigrateNestMethodProgrammer || (NestiaMigrateNestMethodProgrammer = {}));
|
|
135
|
+
/**
|
|
136
|
+
* The value a named example stands for, or `null` when it names none.
|
|
137
|
+
*
|
|
138
|
+
* OpenAPI names examples with Example Objects, whose `value` (or, since 3.2,
|
|
139
|
+
* `dataValue`) holds the value, and a `$ref` to one arrives resolved. Documents
|
|
140
|
+
* from earlier nestia versions held the values themselves, so an object is read
|
|
141
|
+
* as an Example Object only when it is one: it has one of the value fields, and
|
|
142
|
+
* every other key is an Example Object field or an extension. A raw value of
|
|
143
|
+
* exactly that shape is ambiguous and is read as an Example Object, as a
|
|
144
|
+
* conforming document means it. An Example Object that only points at its value
|
|
145
|
+
* (`externalValue`) or only serializes it (`serializedValue`) gives
|
|
146
|
+
* `SwaggerExample` nothing to hold.
|
|
147
|
+
*/
|
|
148
|
+
const exampleValue = (example) => {
|
|
149
|
+
if (isExampleObject(example) === false) return { value: example };
|
|
150
|
+
const record = example;
|
|
151
|
+
if (Object.prototype.hasOwnProperty.call(record, "value")) return { value: record.value };
|
|
152
|
+
if (Object.prototype.hasOwnProperty.call(record, "dataValue")) return { value: record.dataValue };
|
|
153
|
+
return null;
|
|
154
|
+
};
|
|
155
|
+
const isExampleObject = (example) => typeof example === "object" && example !== null && Array.isArray(example) === false && VALUE_KEYS.some((key) => Object.prototype.hasOwnProperty.call(example, key)) && Object.keys(example).every((key) => VALUE_KEYS.includes(key) || key === "summary" || key === "description" || key.startsWith("x-"));
|
|
156
|
+
const VALUE_KEYS = [
|
|
157
|
+
"value",
|
|
158
|
+
"dataValue",
|
|
159
|
+
"serializedValue",
|
|
160
|
+
"externalValue"
|
|
161
|
+
];
|
|
125
162
|
//#endregion
|
|
126
163
|
export { NestiaMigrateNestMethodProgrammer };
|
|
127
164
|
|
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
import ts from "../internal/ts";
|
|
2
2
|
import { INestiaMigrateController } from "../structures/INestiaMigrateController";
|
|
3
|
+
/**
|
|
4
|
+
* Generates the NestJS module that lists the controllers.
|
|
5
|
+
*
|
|
6
|
+
* @evidence contracts/common.md#principled-implementation The module imports every controller from its location and lists them in the `controllers` array of a decorated class.
|
|
7
|
+
* @evidence contracts/common.md#clear-and-simple-design One function and one private import builder.
|
|
8
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts The controllers follow the analysis.
|
|
9
|
+
* @evidence contracts/common.md#meaningful-documentation The comment states what is generated.
|
|
10
|
+
*/
|
|
3
11
|
export declare namespace NestiaMigrateNestModuleProgrammer {
|
|
12
|
+
/**
|
|
13
|
+
* Returns the statements of the module file.
|
|
14
|
+
*
|
|
15
|
+
* @evidence contracts/common.md#principled-implementation The import paths turn the `src/` prefix of a controller location into `./`, so the module can import from its own directory.
|
|
16
|
+
* @evidence contracts/common.md#clear-and-simple-design One function.
|
|
17
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts The names follow the controllers.
|
|
18
|
+
* @evidence contracts/common.md#meaningful-documentation The comment states the result.
|
|
19
|
+
*/
|
|
4
20
|
const write: (controllers: INestiaMigrateController[]) => ts.Statement[];
|
|
5
21
|
}
|
|
@@ -3,8 +3,24 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.NestiaMigrateNestModuleProgrammer = void 0;
|
|
4
4
|
const factory_1 = require("@ttsc/factory");
|
|
5
5
|
const FilePrinter_1 = require("../utils/FilePrinter");
|
|
6
|
+
/**
|
|
7
|
+
* Generates the NestJS module that lists the controllers.
|
|
8
|
+
*
|
|
9
|
+
* @evidence contracts/common.md#principled-implementation The module imports every controller from its location and lists them in the `controllers` array of a decorated class.
|
|
10
|
+
* @evidence contracts/common.md#clear-and-simple-design One function and one private import builder.
|
|
11
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts The controllers follow the analysis.
|
|
12
|
+
* @evidence contracts/common.md#meaningful-documentation The comment states what is generated.
|
|
13
|
+
*/
|
|
6
14
|
var NestiaMigrateNestModuleProgrammer;
|
|
7
15
|
(function (NestiaMigrateNestModuleProgrammer) {
|
|
16
|
+
/**
|
|
17
|
+
* Returns the statements of the module file.
|
|
18
|
+
*
|
|
19
|
+
* @evidence contracts/common.md#principled-implementation The import paths turn the `src/` prefix of a controller location into `./`, so the module can import from its own directory.
|
|
20
|
+
* @evidence contracts/common.md#clear-and-simple-design One function.
|
|
21
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts The names follow the controllers.
|
|
22
|
+
* @evidence contracts/common.md#meaningful-documentation The comment states the result.
|
|
23
|
+
*/
|
|
8
24
|
NestiaMigrateNestModuleProgrammer.write = (controllers) => [
|
|
9
25
|
$import("@nestjs/common")("Module"),
|
|
10
26
|
...(controllers.length ? [FilePrinter_1.FilePrinter.newLine()] : []),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NestiaMigrateNestModuleProgrammer.js","sourceRoot":"","sources":["../../src/programmers/NestiaMigrateNestModuleProgrammer.ts"],"names":[],"mappings":";;;AAAA,2CAAoD;AAIpD,sDAAmD;AAEnD,IAAiB,iCAAiC,
|
|
1
|
+
{"version":3,"file":"NestiaMigrate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D,iBAAO,CAAC,WAAW,CAAC,oBAAU,CAAC,aAAa,CAAC;SAC9C,EACD,UAAU,EACV,SAAS,EACT,SAAS,EACT,EAAE,CACH;KACF,CAAC;AACJ,CAAC,EAhDgB,iCAAiC,aAAjC,iCAAiC,GAAjC,iCAAiC,QAgDjD;AAED,MAAM,OAAO,GAAG,CAAC,IAAY,EAAE,EAAE,CAAC,CAAC,QAAgB,EAAE,EAAE,CACrD,iBAAO,CAAC,uBAAuB,CAC7B,SAAS,EACT,iBAAO,CAAC,kBAAkB,CACxB,SAAS,EACT,SAAS,EACT,iBAAO,CAAC,kBAAkB,CAAC;IACzB,iBAAO,CAAC,qBAAqB,CAC3B,KAAK,EACL,SAAS,EACT,iBAAO,CAAC,gBAAgB,CAAC,QAAQ,CAAC,CACnC;CACF,CAAC,CACH,EACD,iBAAO,CAAC,mBAAmB,CAAC,IAAI,CAAC,CAClC,CAAC"}
|
|
@@ -1,4 +1,21 @@
|
|
|
1
1
|
import { INestiaMigrateContext } from "../structures/INestiaMigrateContext";
|
|
2
|
+
/**
|
|
3
|
+
* Generates the NestJS side of a monorepo project: the module, the controllers,
|
|
4
|
+
* and the DTO structures.
|
|
5
|
+
*
|
|
6
|
+
* @evidence contracts/common.md#principled-implementation The controllers come from the analyzer, each DTO tree becomes a structure file, and a barrel file re-exports every non-empty structure file so the template's module keeps working.
|
|
7
|
+
* @evidence contracts/common.md#clear-and-simple-design One public function and private helpers for the DTO files and the barrel.
|
|
8
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts The layout follows the analysis.
|
|
9
|
+
* @evidence contracts/common.md#meaningful-documentation The comment states what is generated.
|
|
10
|
+
*/
|
|
2
11
|
export declare namespace NestiaMigrateNestProgrammer {
|
|
12
|
+
/**
|
|
13
|
+
* Returns the map from file path to content of the NestJS files.
|
|
14
|
+
*
|
|
15
|
+
* @evidence contracts/common.md#principled-implementation The barrel is computed from the generated structure files, sorted by name, so its content is deterministic.
|
|
16
|
+
* @evidence contracts/common.md#clear-and-simple-design One function.
|
|
17
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts The names follow the document.
|
|
18
|
+
* @evidence contracts/common.md#meaningful-documentation The comment states the result.
|
|
19
|
+
*/
|
|
3
20
|
const write: (context: INestiaMigrateContext) => Record<string, string>;
|
|
4
21
|
}
|