@nestia/core 12.0.0-rc.2 → 12.0.0-rc.3
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/LICENSE +21 -21
- package/MIGRATION.md +138 -169
- package/lib/decorators/NoTransformConfigurationError.js +5 -5
- package/lib/decorators/NoTransformConfigurationError.js.map +1 -1
- package/native/cmd/ttsc-nestia/main.go +11 -11
- package/native/go.mod +32 -32
- package/native/go.sum +54 -54
- package/native/plugin/plan.go +102 -102
- package/native/transform/ast.go +32 -32
- package/native/transform/build.go +388 -380
- package/native/transform/cleanup.go +408 -408
- package/native/transform/contributor.go +97 -97
- package/native/transform/core_querify.go +231 -231
- package/native/transform/core_transform.go +1996 -1996
- package/native/transform/core_websocket.go +115 -115
- package/native/transform/exports.go +13 -13
- package/native/transform/mcp_transform.go +414 -414
- package/native/transform/node_transform.go +357 -357
- package/native/transform/path_rewrite.go +285 -285
- package/native/transform/printer.go +244 -244
- package/native/transform/rewrite.go +668 -668
- package/native/transform/run.go +73 -73
- package/native/transform/transform.go +336 -336
- package/native/transform/typia_fast.go +375 -352
- package/native/transform/typia_replacement.go +24 -24
- package/native/transform.cjs +43 -43
- package/package.json +9 -9
- package/src/adaptors/McpAdaptor.ts +276 -276
- package/src/adaptors/WebSocketAdaptor.ts +429 -429
- package/src/decorators/DynamicModule.ts +44 -44
- package/src/decorators/EncryptedBody.ts +97 -97
- package/src/decorators/EncryptedController.ts +40 -40
- package/src/decorators/EncryptedModule.ts +98 -98
- package/src/decorators/EncryptedRoute.ts +213 -213
- package/src/decorators/HumanRoute.ts +21 -21
- package/src/decorators/McpRoute.ts +154 -154
- package/src/decorators/NoTransformConfigurationError.ts +40 -40
- package/src/decorators/PlainBody.ts +76 -76
- package/src/decorators/SwaggerCustomizer.ts +97 -97
- package/src/decorators/SwaggerExample.ts +180 -180
- package/src/decorators/TypedBody.ts +57 -57
- package/src/decorators/TypedException.ts +147 -147
- package/src/decorators/TypedFormData.ts +187 -187
- package/src/decorators/TypedHeaders.ts +66 -66
- package/src/decorators/TypedParam.ts +77 -77
- package/src/decorators/TypedQuery.ts +234 -234
- package/src/decorators/TypedRoute.ts +198 -198
- package/src/decorators/WebSocketRoute.ts +242 -242
- package/src/decorators/doNotThrowTransformError.ts +5 -5
- package/src/decorators/internal/EncryptedConstant.ts +2 -2
- package/src/decorators/internal/IMcpRouteReflect.ts +40 -40
- package/src/decorators/internal/IWebSocketRouteReflect.ts +23 -23
- package/src/decorators/internal/get_path_and_querify.ts +94 -94
- package/src/decorators/internal/get_path_and_stringify.ts +110 -110
- package/src/decorators/internal/get_text_body.ts +16 -16
- package/src/decorators/internal/headers_to_object.ts +11 -11
- package/src/decorators/internal/is_request_body_undefined.ts +12 -12
- package/src/decorators/internal/load_controller.ts +94 -94
- package/src/decorators/internal/route_error.ts +43 -43
- package/src/decorators/internal/validate_request_body.ts +64 -64
- package/src/decorators/internal/validate_request_form_data.ts +67 -67
- package/src/decorators/internal/validate_request_headers.ts +76 -76
- package/src/decorators/internal/validate_request_query.ts +83 -83
- package/src/index.ts +5 -5
- package/src/module.ts +25 -25
- package/src/options/IRequestBodyValidator.ts +20 -20
- package/src/options/IRequestFormDataProps.ts +27 -27
- package/src/options/IRequestHeadersValidator.ts +22 -22
- package/src/options/IRequestQueryValidator.ts +20 -20
- package/src/options/IResponseBodyQuerifier.ts +25 -25
- package/src/options/IResponseBodyStringifier.ts +30 -30
- package/src/transform.ts +26 -26
- package/src/typings/Creator.ts +3 -3
- package/src/typings/get-function-location.d.ts +7 -7
- package/src/utils/ArrayUtil.ts +7 -7
- package/src/utils/ExceptionManager.ts +115 -115
- package/src/utils/Singleton.ts +16 -16
- package/src/utils/SourceFinder.ts +54 -54
- package/src/utils/VersioningStrategy.ts +27 -27
- package/README.md +0 -93
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
package transform
|
|
2
|
-
|
|
3
|
-
import (
|
|
4
|
-
"strings"
|
|
5
|
-
|
|
6
|
-
shimast "github.com/microsoft/typescript-go/shim/ast"
|
|
7
|
-
typiaadapter "github.com/samchon/typia/packages/typia/native/adapter"
|
|
8
|
-
)
|
|
9
|
-
|
|
10
|
-
func parenthesizeTypiaReplacement(
|
|
11
|
-
site typiaadapter.CallSite,
|
|
12
|
-
expr string,
|
|
13
|
-
) string {
|
|
14
|
-
text := strings.TrimSpace(expr)
|
|
15
|
-
if strings.HasPrefix(text, "{") == false {
|
|
16
|
-
return expr
|
|
17
|
-
}
|
|
18
|
-
node := site.Call.AsNode()
|
|
19
|
-
if node == nil || node.Parent == nil ||
|
|
20
|
-
node.Parent.Kind != shimast.KindExpressionStatement {
|
|
21
|
-
return expr
|
|
22
|
-
}
|
|
23
|
-
return "(" + expr + ")"
|
|
24
|
-
}
|
|
1
|
+
package transform
|
|
2
|
+
|
|
3
|
+
import (
|
|
4
|
+
"strings"
|
|
5
|
+
|
|
6
|
+
shimast "github.com/microsoft/typescript-go/shim/ast"
|
|
7
|
+
typiaadapter "github.com/samchon/typia/packages/typia/native/adapter"
|
|
8
|
+
)
|
|
9
|
+
|
|
10
|
+
func parenthesizeTypiaReplacement(
|
|
11
|
+
site typiaadapter.CallSite,
|
|
12
|
+
expr string,
|
|
13
|
+
) string {
|
|
14
|
+
text := strings.TrimSpace(expr)
|
|
15
|
+
if strings.HasPrefix(text, "{") == false {
|
|
16
|
+
return expr
|
|
17
|
+
}
|
|
18
|
+
node := site.Call.AsNode()
|
|
19
|
+
if node == nil || node.Parent == nil ||
|
|
20
|
+
node.Parent.Kind != shimast.KindExpressionStatement {
|
|
21
|
+
return expr
|
|
22
|
+
}
|
|
23
|
+
return "(" + expr + ")"
|
|
24
|
+
}
|
package/native/transform.cjs
CHANGED
|
@@ -1,43 +1,43 @@
|
|
|
1
|
-
const fs = require("node:fs");
|
|
2
|
-
const path = require("node:path");
|
|
3
|
-
|
|
4
|
-
// `@nestia/core` ttsc plugin descriptor.
|
|
5
|
-
//
|
|
6
|
-
// `source` is the Go command package of the executable transform host
|
|
7
|
-
// (`cmd/ttsc-nestia`, package `main`).
|
|
8
|
-
//
|
|
9
|
-
// `@nestia/sdk` is NOT a standalone ttsc plugin: its Go transform is declared
|
|
10
|
-
// here as a `contributor`, discovered by resolving `@nestia/sdk` from the
|
|
11
|
-
// project. ttsc statically links a contributor's Go source into this host
|
|
12
|
-
// binary. Consequences:
|
|
13
|
-
//
|
|
14
|
-
// - A project that depends on `@nestia/core` but not `@nestia/sdk` never
|
|
15
|
-
// links, compiles, or ships any SDK transform code.
|
|
16
|
-
// - When the `@nestia/core` plugin itself is disabled, this descriptor is
|
|
17
|
-
// never evaluated, so the SDK contributor is never linked either.
|
|
18
|
-
function createTtscPlugin(context) {
|
|
19
|
-
const plugin = {
|
|
20
|
-
name: "@nestia/core",
|
|
21
|
-
source: path.resolve(__dirname, "cmd", "ttsc-nestia"),
|
|
22
|
-
composes: ["typia/lib/transform"],
|
|
23
|
-
};
|
|
24
|
-
const sdk = resolveSdkContributorSource(context);
|
|
25
|
-
if (sdk !== null) plugin.contributors = [{ name: "sdk", source: sdk }];
|
|
26
|
-
return plugin;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
function resolveSdkContributorSource(context) {
|
|
30
|
-
const paths = [__dirname];
|
|
31
|
-
if (context && typeof context.projectRoot === "string")
|
|
32
|
-
paths.push(context.projectRoot);
|
|
33
|
-
try {
|
|
34
|
-
const manifest = require.resolve("@nestia/sdk/package.json", { paths });
|
|
35
|
-
const source = path.resolve(path.dirname(manifest), "native", "sdk");
|
|
36
|
-
return fs.existsSync(source) ? source : null;
|
|
37
|
-
} catch {
|
|
38
|
-
return null;
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
module.exports = createTtscPlugin;
|
|
43
|
-
module.exports.createTtscPlugin = createTtscPlugin;
|
|
1
|
+
const fs = require("node:fs");
|
|
2
|
+
const path = require("node:path");
|
|
3
|
+
|
|
4
|
+
// `@nestia/core` ttsc plugin descriptor.
|
|
5
|
+
//
|
|
6
|
+
// `source` is the Go command package of the executable transform host
|
|
7
|
+
// (`cmd/ttsc-nestia`, package `main`).
|
|
8
|
+
//
|
|
9
|
+
// `@nestia/sdk` is NOT a standalone ttsc plugin: its Go transform is declared
|
|
10
|
+
// here as a `contributor`, discovered by resolving `@nestia/sdk` from the
|
|
11
|
+
// project. ttsc statically links a contributor's Go source into this host
|
|
12
|
+
// binary. Consequences:
|
|
13
|
+
//
|
|
14
|
+
// - A project that depends on `@nestia/core` but not `@nestia/sdk` never
|
|
15
|
+
// links, compiles, or ships any SDK transform code.
|
|
16
|
+
// - When the `@nestia/core` plugin itself is disabled, this descriptor is
|
|
17
|
+
// never evaluated, so the SDK contributor is never linked either.
|
|
18
|
+
function createTtscPlugin(context) {
|
|
19
|
+
const plugin = {
|
|
20
|
+
name: "@nestia/core",
|
|
21
|
+
source: path.resolve(__dirname, "cmd", "ttsc-nestia"),
|
|
22
|
+
composes: ["typia/lib/transform"],
|
|
23
|
+
};
|
|
24
|
+
const sdk = resolveSdkContributorSource(context);
|
|
25
|
+
if (sdk !== null) plugin.contributors = [{ name: "sdk", source: sdk }];
|
|
26
|
+
return plugin;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
function resolveSdkContributorSource(context) {
|
|
30
|
+
const paths = [__dirname];
|
|
31
|
+
if (context && typeof context.projectRoot === "string")
|
|
32
|
+
paths.push(context.projectRoot);
|
|
33
|
+
try {
|
|
34
|
+
const manifest = require.resolve("@nestia/sdk/package.json", { paths });
|
|
35
|
+
const source = path.resolve(path.dirname(manifest), "native", "sdk");
|
|
36
|
+
return fs.existsSync(source) ? source : null;
|
|
37
|
+
} catch {
|
|
38
|
+
return null;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
module.exports = createTtscPlugin;
|
|
43
|
+
module.exports.createTtscPlugin = createTtscPlugin;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nestia/core",
|
|
3
|
-
"version": "12.0.0-rc.
|
|
3
|
+
"version": "12.0.0-rc.3",
|
|
4
4
|
"description": "Super-fast validation decorators of NestJS",
|
|
5
5
|
"types": "lib/index.d.ts",
|
|
6
6
|
"main": "lib/index.js",
|
|
@@ -46,8 +46,8 @@
|
|
|
46
46
|
},
|
|
47
47
|
"homepage": "https://nestia.io",
|
|
48
48
|
"dependencies": {
|
|
49
|
-
"@typia/interface": "^13.0.0
|
|
50
|
-
"@typia/utils": "^13.0.0
|
|
49
|
+
"@typia/interface": "^13.0.0",
|
|
50
|
+
"@typia/utils": "^13.0.0",
|
|
51
51
|
"get-function-location": "^2.0.0",
|
|
52
52
|
"glob": "^11.0.3",
|
|
53
53
|
"path-parser": "^6.1.0",
|
|
@@ -55,9 +55,9 @@
|
|
|
55
55
|
"reflect-metadata": ">=0.1.12",
|
|
56
56
|
"rxjs": ">=6.0.3",
|
|
57
57
|
"tgrid": "^1.1.0",
|
|
58
|
-
"typia": "^13.0.0
|
|
58
|
+
"typia": "^13.0.0",
|
|
59
59
|
"ws": "^7.5.3",
|
|
60
|
-
"@nestia/fetcher": "^12.0.0-rc.
|
|
60
|
+
"@nestia/fetcher": "^12.0.0-rc.3"
|
|
61
61
|
},
|
|
62
62
|
"peerDependencies": {
|
|
63
63
|
"@modelcontextprotocol/sdk": "^1.18.0",
|
|
@@ -65,8 +65,8 @@
|
|
|
65
65
|
"@nestjs/core": ">=7.0.1",
|
|
66
66
|
"reflect-metadata": ">=0.1.12",
|
|
67
67
|
"rxjs": ">=6.0.3",
|
|
68
|
-
"typia": "^13.0.0
|
|
69
|
-
"@nestia/fetcher": "^12.0.0-rc.
|
|
68
|
+
"typia": "^13.0.0",
|
|
69
|
+
"@nestia/fetcher": "^12.0.0-rc.3"
|
|
70
70
|
},
|
|
71
71
|
"peerDependenciesMeta": {
|
|
72
72
|
"@modelcontextprotocol/sdk": {
|
|
@@ -83,9 +83,9 @@
|
|
|
83
83
|
"@types/ws": "^8.5.10",
|
|
84
84
|
"fastify": "^4.28.1",
|
|
85
85
|
"rimraf": "^6.1.3",
|
|
86
|
-
"ttsc": "^0.
|
|
86
|
+
"ttsc": "^0.18.0",
|
|
87
87
|
"tstl": "^3.0.0",
|
|
88
|
-
"typescript": "7.0.
|
|
88
|
+
"typescript": "^7.0.2"
|
|
89
89
|
},
|
|
90
90
|
"files": [
|
|
91
91
|
"README.md",
|