Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #864: exact @EncryptedRoute() tracing. #879

Merged
merged 3 commits into from
Apr 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion benchmark/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"@nestia/core": "^3.0.3",
"@nestjs/platform-express": "^10.3.7",
"@nestjs/platform-fastify": "^10.3.7",
"typia": "^6.0.2"
"typia": "^6.0.3"
},
"devDependencies": {
"@types/autocannon": "^7.9.0",
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"private": true,
"name": "@nestia/station",
"version": "3.0.3",
"version": "3.0.5",
"description": "Nestia station",
"scripts": {
"build": "node build/index.js",
Expand Down
16 changes: 8 additions & 8 deletions packages/core/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@nestia/core",
"version": "3.0.3",
"version": "3.0.5",
"description": "Super-fast validation decorators of NestJS",
"main": "lib/index.js",
"typings": "lib/index.d.ts",
Expand Down Expand Up @@ -36,25 +36,25 @@
},
"homepage": "https://nestia.io",
"dependencies": {
"@nestia/fetcher": "^3.0.3",
"@nestia/fetcher": "^3.0.5",
"@nestjs/common": ">=7.0.1",
"@nestjs/core": ">=7.0.1",
"@samchon/openapi": "^0.1.12",
"@samchon/openapi": "^0.1.18",
"detect-ts-node": "^1.0.5",
"glob": "^7.2.0",
"multer": "1.4.5-lts.1",
"raw-body": "^2.0.0",
"reflect-metadata": ">=0.1.12",
"rxjs": ">=6.0.2",
"typia": "^6.0.2"
"rxjs": ">=6.0.3",
"typia": "^6.0.3"
},
"peerDependencies": {
"@nestia/fetcher": ">=3.0.3",
"@nestia/fetcher": ">=3.0.5",
"@nestjs/common": ">=7.0.1",
"@nestjs/core": ">=7.0.1",
"reflect-metadata": ">=0.1.12",
"rxjs": ">=6.0.2",
"typia": ">=6.0.2 <7.0.0"
"rxjs": ">=6.0.3",
"typia": ">=6.0.3 <7.0.0"
},
"devDependencies": {
"@fastify/multipart": "^8.1.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/e2e/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
"ts-node": "^10.9.1",
"ts-patch": "^3.1.0",
"typescript": "^5.4.2",
"typia": "^6.0.2"
"typia": "^6.0.3"
},
"dependencies": {
"chalk": "^4.1.2",
Expand Down
2 changes: 1 addition & 1 deletion packages/fetcher/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@nestia/fetcher",
"version": "3.0.3",
"version": "3.0.5",
"description": "Fetcher library of Nestia SDK",
"main": "lib/index.js",
"typings": "lib/index.d.ts",
Expand Down
10 changes: 5 additions & 5 deletions packages/migrate/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@nestia/migrate",
"version": "0.13.5",
"version": "0.13.7",
"description": "Migration program from swagger to NestJS",
"main": "lib/index.js",
"typings": "lib/index.d.ts",
Expand Down Expand Up @@ -34,9 +34,9 @@
},
"homepage": "https://nestia.io",
"devDependencies": {
"@nestia/core": "^3.0.3",
"@nestia/core": "^3.0.4",
"@nestia/e2e": "^0.4.3",
"@nestia/fetcher": "^3.0.3",
"@nestia/fetcher": "^3.0.4",
"@nestjs/common": "^10.3.5",
"@nestjs/core": "^10.3.5",
"@nestjs/platform-express": "^10.3.5",
Expand All @@ -58,13 +58,13 @@
"typescript-transform-paths": "^3.4.6"
},
"dependencies": {
"@samchon/openapi": "^0.1.14",
"@samchon/openapi": "^0.1.18",
"commander": "10.0.0",
"inquirer": "8.2.5",
"prettier": "^3.2.5",
"tstl": "^3.0.0",
"typescript": "^5.4.3",
"typia": "^6.0.2"
"typia": "^6.0.3"
},
"files": [
"lib",
Expand Down
10 changes: 9 additions & 1 deletion packages/migrate/src/programmers/MigrateSchemaProgrammer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,15 @@ export namespace MigrateSchemaProgrammer {
write(components)(importer)(schema.additionalItems),
),
]
: []),
: schema.additionalItems === true
? [
ts.factory.createRestTypeNode(
ts.factory.createArrayTypeNode(
ts.factory.createKeywordTypeNode(ts.SyntaxKind.AnyKeyword),
),
),
]
: []),
]);
const intersection: ts.TypeNode[] = [tuple];
writePlugin({
Expand Down
12 changes: 6 additions & 6 deletions packages/sdk/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@nestia/sdk",
"version": "3.0.3",
"version": "3.0.5",
"description": "Nestia SDK and Swagger generator",
"main": "lib/index.js",
"typings": "lib/index.d.ts",
Expand Down Expand Up @@ -32,8 +32,8 @@
},
"homepage": "https://nestia.io",
"dependencies": {
"@nestia/fetcher": "^3.0.3",
"@samchon/openapi": "^0.1.12",
"@nestia/fetcher": "^3.0.5",
"@samchon/openapi": "^0.1.18",
"cli": "^1.0.1",
"get-function-location": "^2.0.0",
"glob": "^7.2.0",
Expand All @@ -43,15 +43,15 @@
"tsconfig-paths": "^4.1.1",
"ts-node": ">=10.6.0",
"tstl": "^3.0.0",
"typia": "^6.0.2"
"typia": "^6.0.3"
},
"peerDependencies": {
"@nestia/fetcher": ">=3.0.3",
"@nestia/fetcher": ">=3.0.5",
"@nestjs/common": ">=7.0.1",
"@nestjs/core": ">=7.0.1",
"reflect-metadata": ">=0.1.12",
"ts-node": ">=10.6.0",
"typia": ">=6.0.2 <7.0.0"
"typia": ">=6.0.3 <7.0.0"
},
"devDependencies": {
"@nestia/e2e": "^0.4.1",
Expand Down
20 changes: 14 additions & 6 deletions packages/sdk/src/analyses/ReflectAnalyzer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -219,12 +219,12 @@ export namespace ReflectAnalyzer {
// CONSTRUCTION
//----
// BASIC INFO
const encrypted: boolean =
Reflect.getMetadata(Constants.INTERCEPTORS_METADATA, proto)?.[0]
?.constructor?.name === "EncryptedRouteInterceptor";
const query: boolean =
Reflect.getMetadata(Constants.INTERCEPTORS_METADATA, proto)?.[0]
?.constructor?.name === "TypedQueryRouteInterceptor";
const encrypted: boolean = hasInterceptor("EncryptedRouteInterceptor")(
proto,
);
const query: boolean = hasInterceptor("TypedQueryRouteInterceptor")(
proto,
);
const method: string =
METHODS[Reflect.getMetadata(Constants.METHOD_METADATA, proto)];
if (method === undefined || method === "OPTIONS") return null;
Expand Down Expand Up @@ -461,3 +461,11 @@ const getNestParamType = (value: RouteParamtypes) => {
else if (value === RouteParamtypes.PARAM) return "param";
return undefined;
};

const hasInterceptor =
(name: string) =>
(proto: any): boolean => {
const meta = Reflect.getMetadata(Constants.INTERCEPTORS_METADATA, proto);
if (Array.isArray(meta) === false) return false;
return meta.some((elem) => elem?.constructor?.name === name);
};
5 changes: 3 additions & 2 deletions test/features/all/swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
}
],
"info": {
"version": "3.0.0-dev.20240412",
"version": "3.0.5-dev.20240418",
"title": "@nestia/test",
"description": "Test program of Nestia",
"license": {
Expand Down Expand Up @@ -315,5 +315,6 @@
}
}
},
"tags": []
"tags": [],
"x-samchon-emended": true
}

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion test/features/app-globalPrefix-versionUri/swagger.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion test/features/app-globalPrefix/swagger.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion test/features/app-routerModule/swagger.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion test/features/app-versionHeader/swagger.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion test/features/app-versionUri/swagger.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion test/features/app/swagger.json

Large diffs are not rendered by default.

5 changes: 3 additions & 2 deletions test/features/beautify-4/swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
}
],
"info": {
"version": "3.0.0-dev.20240412",
"version": "3.0.5-dev.20240418",
"title": "@nestia/test",
"description": "Test program of Nestia",
"license": {
Expand Down Expand Up @@ -387,5 +387,6 @@
{
"name": "performance"
}
]
],
"x-samchon-emended": true
}
2 changes: 1 addition & 1 deletion test/features/beautify-false/swagger.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"openapi":"3.1.0","servers":[{"url":"https://github.com/samchon/nestia","description":"insert your server url"}],"info":{"version":"3.0.0-dev.20240412","title":"@nestia/test","description":"Test program of Nestia","license":{"name":"MIT"}},"paths":{"/health":{"get":{"tags":["system","health"],"parameters":[],"responses":{"200":{"description":""}},"summary":"Health check API","description":"Health check API.\n\nJust for health checking API liveness."}},"/performance":{"get":{"tags":["system","performance"],"parameters":[],"responses":{"200":{"description":"Performance info","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IPerformance"}}}}},"summary":"Get server performance info","description":"Get server performance info."}},"/body":{"post":{"tags":[],"parameters":[],"requestBody":{"description":"Content to store","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IBbsArticle.IStore"}}},"required":true},"responses":{"201":{"description":"Newly archived article","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IBbsArticle"}}}}},"summary":"Store an article","description":"Store an article."}},"/body/{id}":{"put":{"tags":[],"parameters":[{"name":"id","in":"path","schema":{"type":"string","format":"uuid"},"description":"","required":true}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PartialIBbsArticle.IStore"}}},"required":true},"responses":{"200":{"description":""}}}}},"components":{"schemas":{"IPerformance":{"type":"object","properties":{"cpu":{"$ref":"#/components/schemas/process.global.NodeJS.CpuUsage"},"memory":{"$ref":"#/components/schemas/process.global.NodeJS.MemoryUsage"},"resource":{"$ref":"#/components/schemas/process.global.NodeJS.ResourceUsage"}},"required":["cpu","memory","resource"],"description":"Performance info."},"process.global.NodeJS.CpuUsage":{"type":"object","properties":{"user":{"type":"number"},"system":{"type":"number"}},"required":["user","system"]},"process.global.NodeJS.MemoryUsage":{"type":"object","properties":{"rss":{"type":"number"},"heapTotal":{"type":"number"},"heapUsed":{"type":"number"},"external":{"type":"number"},"arrayBuffers":{"type":"number"}},"required":["rss","heapTotal","heapUsed","external","arrayBuffers"]},"process.global.NodeJS.ResourceUsage":{"type":"object","properties":{"fsRead":{"type":"number"},"fsWrite":{"type":"number"},"involuntaryContextSwitches":{"type":"number"},"ipcReceived":{"type":"number"},"ipcSent":{"type":"number"},"majorPageFault":{"type":"number"},"maxRSS":{"type":"number"},"minorPageFault":{"type":"number"},"sharedMemorySize":{"type":"number"},"signalsCount":{"type":"number"},"swappedOut":{"type":"number"},"systemCPUTime":{"type":"number"},"unsharedDataSize":{"type":"number"},"unsharedStackSize":{"type":"number"},"userCPUTime":{"type":"number"},"voluntaryContextSwitches":{"type":"number"}},"required":["fsRead","fsWrite","involuntaryContextSwitches","ipcReceived","ipcSent","majorPageFault","maxRSS","minorPageFault","sharedMemorySize","signalsCount","swappedOut","systemCPUTime","unsharedDataSize","unsharedStackSize","userCPUTime","voluntaryContextSwitches"]},"IBbsArticle.IStore":{"type":"object","properties":{"title":{"type":"string","minLength":3,"maxLength":50},"body":{"type":"string"},"files":{"type":"array","items":{"$ref":"#/components/schemas/IAttachmentFile"}}},"required":["title","body","files"]},"IAttachmentFile":{"type":"object","properties":{"name":{"oneOf":[{"type":"null"},{"type":"string","maxLength":255}]},"extension":{"oneOf":[{"type":"null"},{"type":"string","minLength":1,"maxLength":8}]},"url":{"type":"string","format":"uri"}},"required":["name","extension","url"]},"IBbsArticle":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"created_at":{"type":"string","format":"date-time"},"title":{"type":"string","minLength":3,"maxLength":50},"body":{"type":"string"},"files":{"type":"array","items":{"$ref":"#/components/schemas/IAttachmentFile"}}},"required":["id","created_at","title","body","files"]},"PartialIBbsArticle.IStore":{"type":"object","properties":{"title":{"type":"string","minLength":3,"maxLength":50},"body":{"type":"string"},"files":{"type":"array","items":{"$ref":"#/components/schemas/IAttachmentFile"}}},"description":"Make all properties in T optional"}},"securitySchemes":{"bearer":{"type":"apiKey","in":"header","name":"Authorization"}}},"tags":[{"name":"system"},{"name":"health"},{"name":"performance"}]}
{"openapi":"3.1.0","servers":[{"url":"https://github.com/samchon/nestia","description":"insert your server url"}],"info":{"version":"3.0.5-dev.20240418","title":"@nestia/test","description":"Test program of Nestia","license":{"name":"MIT"}},"paths":{"/health":{"get":{"tags":["system","health"],"parameters":[],"responses":{"200":{"description":""}},"summary":"Health check API","description":"Health check API.\n\nJust for health checking API liveness."}},"/performance":{"get":{"tags":["system","performance"],"parameters":[],"responses":{"200":{"description":"Performance info","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IPerformance"}}}}},"summary":"Get server performance info","description":"Get server performance info."}},"/body":{"post":{"tags":[],"parameters":[],"requestBody":{"description":"Content to store","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IBbsArticle.IStore"}}},"required":true},"responses":{"201":{"description":"Newly archived article","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IBbsArticle"}}}}},"summary":"Store an article","description":"Store an article."}},"/body/{id}":{"put":{"tags":[],"parameters":[{"name":"id","in":"path","schema":{"type":"string","format":"uuid"},"description":"","required":true}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PartialIBbsArticle.IStore"}}},"required":true},"responses":{"200":{"description":""}}}}},"components":{"schemas":{"IPerformance":{"type":"object","properties":{"cpu":{"$ref":"#/components/schemas/process.global.NodeJS.CpuUsage"},"memory":{"$ref":"#/components/schemas/process.global.NodeJS.MemoryUsage"},"resource":{"$ref":"#/components/schemas/process.global.NodeJS.ResourceUsage"}},"required":["cpu","memory","resource"],"description":"Performance info."},"process.global.NodeJS.CpuUsage":{"type":"object","properties":{"user":{"type":"number"},"system":{"type":"number"}},"required":["user","system"]},"process.global.NodeJS.MemoryUsage":{"type":"object","properties":{"rss":{"type":"number"},"heapTotal":{"type":"number"},"heapUsed":{"type":"number"},"external":{"type":"number"},"arrayBuffers":{"type":"number"}},"required":["rss","heapTotal","heapUsed","external","arrayBuffers"]},"process.global.NodeJS.ResourceUsage":{"type":"object","properties":{"fsRead":{"type":"number"},"fsWrite":{"type":"number"},"involuntaryContextSwitches":{"type":"number"},"ipcReceived":{"type":"number"},"ipcSent":{"type":"number"},"majorPageFault":{"type":"number"},"maxRSS":{"type":"number"},"minorPageFault":{"type":"number"},"sharedMemorySize":{"type":"number"},"signalsCount":{"type":"number"},"swappedOut":{"type":"number"},"systemCPUTime":{"type":"number"},"unsharedDataSize":{"type":"number"},"unsharedStackSize":{"type":"number"},"userCPUTime":{"type":"number"},"voluntaryContextSwitches":{"type":"number"}},"required":["fsRead","fsWrite","involuntaryContextSwitches","ipcReceived","ipcSent","majorPageFault","maxRSS","minorPageFault","sharedMemorySize","signalsCount","swappedOut","systemCPUTime","unsharedDataSize","unsharedStackSize","userCPUTime","voluntaryContextSwitches"]},"IBbsArticle.IStore":{"type":"object","properties":{"title":{"type":"string","minLength":3,"maxLength":50},"body":{"type":"string"},"files":{"type":"array","items":{"$ref":"#/components/schemas/IAttachmentFile"}}},"required":["title","body","files"]},"IAttachmentFile":{"type":"object","properties":{"name":{"oneOf":[{"type":"null"},{"type":"string","maxLength":255}]},"extension":{"oneOf":[{"type":"null"},{"type":"string","minLength":1,"maxLength":8}]},"url":{"type":"string","format":"uri"}},"required":["name","extension","url"]},"IBbsArticle":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"created_at":{"type":"string","format":"date-time"},"title":{"type":"string","minLength":3,"maxLength":50},"body":{"type":"string"},"files":{"type":"array","items":{"$ref":"#/components/schemas/IAttachmentFile"}}},"required":["id","created_at","title","body","files"]},"PartialIBbsArticle.IStore":{"type":"object","properties":{"title":{"type":"string","minLength":3,"maxLength":50},"body":{"type":"string"},"files":{"type":"array","items":{"$ref":"#/components/schemas/IAttachmentFile"}}},"description":"Make all properties in T optional"}},"securitySchemes":{"bearer":{"type":"apiKey","in":"header","name":"Authorization"}}},"tags":[{"name":"system"},{"name":"health"},{"name":"performance"}],"x-samchon-emended":true}
5 changes: 3 additions & 2 deletions test/features/beautify/swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
}
],
"info": {
"version": "3.0.0-dev.20240412",
"version": "3.0.5-dev.20240418",
"title": "@nestia/test",
"description": "Test program of Nestia",
"license": {
Expand Down Expand Up @@ -387,5 +387,6 @@
{
"name": "performance"
}
]
],
"x-samchon-emended": true
}
Loading
Loading