Skip to content

Commit

Permalink
Fix #900: add get-function-location dependency on @nestia/core.
Browse files Browse the repository at this point in the history
Have ommitted to adding `get-function-location` dependency in the `@nestia/core`.

This PR fixes the problem.
  • Loading branch information
samchon committed May 8, 2024
1 parent 6eb58aa commit d1934d0
Show file tree
Hide file tree
Showing 89 changed files with 140 additions and 116 deletions.
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.1.3",
"version": "3.1.4",
"description": "Nestia station",
"scripts": {
"build": "node build/index.js",
Expand Down
7 changes: 4 additions & 3 deletions packages/core/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@nestia/core",
"version": "3.1.3",
"version": "3.1.4",
"description": "Super-fast validation decorators of NestJS",
"main": "lib/index.js",
"typings": "lib/index.d.ts",
Expand Down Expand Up @@ -36,11 +36,12 @@
},
"homepage": "https://nestia.io",
"dependencies": {
"@nestia/fetcher": "^3.1.3",
"@nestia/fetcher": "^3.1.4",
"@nestjs/common": ">=7.0.1",
"@nestjs/core": ">=7.0.1",
"@samchon/openapi": "^0.1.21",
"detect-ts-node": "^1.0.5",
"get-function-location": "^2.0.0",
"glob": "^7.2.0",
"multer": "1.4.5-lts.1",
"path-parser": "^6.1.0",
Expand All @@ -52,7 +53,7 @@
"ws": "^7.5.3"
},
"peerDependencies": {
"@nestia/fetcher": ">=3.1.3",
"@nestia/fetcher": ">=3.1.4",
"@nestjs/common": ">=7.0.1",
"@nestjs/core": ">=7.0.1",
"reflect-metadata": ">=0.1.12",
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.1.3",
"version": "3.1.4",
"description": "Fetcher library of Nestia SDK",
"main": "lib/index.js",
"typings": "lib/index.d.ts",
Expand Down
6 changes: 3 additions & 3 deletions packages/sdk/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@nestia/sdk",
"version": "3.1.3",
"version": "3.1.4",
"description": "Nestia SDK and Swagger generator",
"main": "lib/index.js",
"typings": "lib/index.d.ts",
Expand Down Expand Up @@ -32,7 +32,7 @@
},
"homepage": "https://nestia.io",
"dependencies": {
"@nestia/fetcher": "^3.1.3",
"@nestia/fetcher": "^3.1.4",
"@samchon/openapi": "^0.1.21",
"cli": "^1.0.1",
"get-function-location": "^2.0.0",
Expand All @@ -46,7 +46,7 @@
"typia": "^6.0.3"
},
"peerDependencies": {
"@nestia/fetcher": ">=3.1.3",
"@nestia/fetcher": ">=3.1.4",
"@nestjs/common": ">=7.0.1",
"@nestjs/core": ">=7.0.1",
"reflect-metadata": ">=0.1.12",
Expand Down
4 changes: 3 additions & 1 deletion packages/sdk/src/analyses/ConfigAnalyzer.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
/// <reference path="../typings/get-function-location.d.ts" />
import { INestApplication, VersioningType } from "@nestjs/common";
import { MODULE_PATH } from "@nestjs/common/constants";
import { NestContainer } from "@nestjs/core";
import { Module } from "@nestjs/core/injector/module";
import fs from "fs";
import getFunctionLocation from "get-function-location";
import path from "path";
import { HashMap, Pair, Singleton } from "tstl";

Expand Down Expand Up @@ -47,7 +49,7 @@ export namespace ConfigAnalyzer {
"";
for (const controller of [...m.controllers.keys()]) {
const file: string | null =
(await require("get-function-location")(controller))?.source ?? null;
(await getFunctionLocation(controller))?.source ?? null;
if (file === null) continue;

const location: string = normalize_file(file);
Expand Down
7 changes: 7 additions & 0 deletions packages/sdk/src/typings/get-function-location.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
declare module "get-function-location" {
export default function (func: any): Promise<{
source: string;
line: number;
column: number;
}>;
}
2 changes: 1 addition & 1 deletion test/features/all/swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
}
],
"info": {
"version": "3.1.0-dev.20240426",
"version": "3.1.4-dev.20240508",
"title": "@nestia/test",
"description": "Test program of Nestia",
"license": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@ import type { ICalculator } from "../../../../../structures/ICalculator";
import type { IListener } from "../../../../../structures/IListener";
import type { IPrecision } from "../../../../../structures/IPrecision";

/**
* @controller CalculateController.connect
* @path /api/v3/websocket/calculate
* @nestia Generated by Nestia - https://github.com/samchon/nestia
*/
export async function connect(
connection: IConnection<connect.Header>,
provider: connect.Provider,
Expand All @@ -22,10 +27,7 @@ export async function connect(
connect.Listener
> = new WebConnector(connection.headers ?? ({} as any), provider);
await connector.connect(
`${connection.host}/${connect.path()}`
.split("/")
.filter((str) => !!str)
.join("/"),
`${connection.host.endsWith("/") ? connection.host.substring(0, connection.host.length - 1) : connection.host}${connect.path()}`,
);
const driver: Driver<connect.Listener> = connector.getDriver();
return {
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@ import type { ICalculator } from "../../../../../structures/ICalculator";
import type { IListener } from "../../../../../structures/IListener";
import type { IPrecision } from "../../../../../structures/IPrecision";

/**
* @controller CalculateController.connect
* @path /api/internal/v1/calculate
* @nestia Generated by Nestia - https://github.com/samchon/nestia
*/
export async function connect(
connection: IConnection<connect.Header>,
provider: connect.Provider,
Expand All @@ -22,10 +27,7 @@ export async function connect(
connect.Listener
> = new WebConnector(connection.headers ?? ({} as any), provider);
await connector.connect(
`${connection.host}/${connect.path()}`
.split("/")
.filter((str) => !!str)
.join("/"),
`${connection.host.endsWith("/") ? connection.host.substring(0, connection.host.length - 1) : connection.host}${connect.path()}`,
);
const driver: Driver<connect.Listener> = connector.getDriver();
return {
Expand Down
2 changes: 1 addition & 1 deletion test/features/app-globalPrefix-versionUri/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.1.0-dev.20240426","title":"@nestia/test","description":"Test program of Nestia","license":{"name":"MIT"}},"paths":{"/api/internal/v1/health":{"get":{"tags":[],"parameters":[],"responses":{"200":{"description":""}}}},"/api/internal/v1/performance":{"get":{"tags":[],"parameters":[],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IPerformance"}}}}}}},"/api/internal/v1/bbs/{section}/articles":{"get":{"tags":[],"parameters":[{"name":"section","in":"path","schema":{"type":"string"},"description":"","required":true},{"name":"query","in":"query","schema":{"$ref":"#/components/schemas/IPage.IRequest"},"description":"","required":true}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IPageIBbsArticle.ISummary"}}}}}}},"/api/internal/v2/bbs/{section}/articles":{"get":{"tags":[],"parameters":[{"name":"section","in":"path","schema":{"type":"string"},"description":"","required":true},{"name":"query","in":"query","schema":{"$ref":"#/components/schemas/IPage.IRequest"},"description":"","required":true}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IPageIBbsArticle.ISummary"}}}}}}},"/api/internal/bbs/{section}/articles":{"get":{"tags":[],"parameters":[{"name":"section","in":"path","schema":{"type":"string"},"description":"","required":true},{"name":"query","in":"query","schema":{"$ref":"#/components/schemas/IPage.IRequest"},"description":"","required":true}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IPageIBbsArticle.ISummary"}}}}}},"post":{"tags":[],"parameters":[{"name":"section","in":"path","schema":{"type":"string"},"description":"Section code","required":true}],"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 a new article","description":"Store a new article."}},"/api/internal/v1/bbs/{section}/articles/{id}":{"get":{"tags":[],"parameters":[{"name":"section","in":"path","schema":{"type":"string"},"description":"","required":true},{"name":"id","in":"path","schema":{"type":"string","format":"uuid"},"description":"","required":true}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IBbsArticle"}}}}}}},"/api/internal/v2/bbs/{section}/articles/{id}":{"put":{"tags":[],"parameters":[{"name":"section","in":"path","schema":{"type":"string"},"description":"Section code","required":true},{"name":"id","in":"path","schema":{"type":"string","format":"uuid"},"description":"Target article ID","required":true}],"requestBody":{"description":"Content to update","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IBbsArticle.IStore"}}},"required":true},"responses":{"200":{"description":"Updated content","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IBbsArticle"}}}}},"summary":"Update an article","description":"Update an article."}}},"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"]},"IPage.IRequest":{"type":"object","properties":{"page":{"oneOf":[{"type":"null"},{"type":"integer"}]},"limit":{"oneOf":[{"type":"null"},{"type":"integer"}]}},"description":"Page request data"},"IPageIBbsArticle.ISummary":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/IBbsArticle.ISummary"}},"pagination":{"$ref":"#/components/schemas/IPage.IPagination"}},"required":["data","pagination"]},"IBbsArticle.ISummary":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"section":{"type":"string"},"writer":{"type":"string"},"title":{"type":"string","minLength":3,"maxLength":50},"created_at":{"type":"string","format":"date-time"}},"required":["id","section","writer","title","created_at"]},"IPage.IPagination":{"type":"object","properties":{"current":{"type":"integer"},"limit":{"type":"integer"},"records":{"type":"integer"},"pages":{"type":"integer"}},"required":["current","limit","records","pages"],"description":"Page information."},"IBbsArticle":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"section":{"type":"string"},"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","section","created_at","title","body","files"]},"IAttachmentFile":{"type":"object","properties":{"name":{"oneOf":[{"type":"null"},{"type":"string","minLength":1,"maxLength":255}]},"extension":{"oneOf":[{"type":"null"},{"type":"string","minLength":1,"maxLength":8}]},"url":{"oneOf":[{"type":"null"},{"type":"string","format":"uri"}]}},"required":["name","extension","url"]},"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"]}},"securitySchemes":{"bearer":{"type":"apiKey","in":"header","name":"Authorization"}}},"tags":[],"x-samchon-emended":true}
{"openapi":"3.1.0","servers":[{"url":"https://github.com/samchon/nestia","description":"insert your server url"}],"info":{"version":"3.1.4-dev.20240508","title":"@nestia/test","description":"Test program of Nestia","license":{"name":"MIT"}},"paths":{"/api/internal/v1/health":{"get":{"tags":[],"parameters":[],"responses":{"200":{"description":""}}}},"/api/internal/v1/performance":{"get":{"tags":[],"parameters":[],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IPerformance"}}}}}}},"/api/internal/v1/bbs/{section}/articles":{"get":{"tags":[],"parameters":[{"name":"section","in":"path","schema":{"type":"string"},"description":"","required":true},{"name":"query","in":"query","schema":{"$ref":"#/components/schemas/IPage.IRequest"},"description":"","required":true}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IPageIBbsArticle.ISummary"}}}}}}},"/api/internal/v2/bbs/{section}/articles":{"get":{"tags":[],"parameters":[{"name":"section","in":"path","schema":{"type":"string"},"description":"","required":true},{"name":"query","in":"query","schema":{"$ref":"#/components/schemas/IPage.IRequest"},"description":"","required":true}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IPageIBbsArticle.ISummary"}}}}}}},"/api/internal/bbs/{section}/articles":{"get":{"tags":[],"parameters":[{"name":"section","in":"path","schema":{"type":"string"},"description":"","required":true},{"name":"query","in":"query","schema":{"$ref":"#/components/schemas/IPage.IRequest"},"description":"","required":true}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IPageIBbsArticle.ISummary"}}}}}},"post":{"tags":[],"parameters":[{"name":"section","in":"path","schema":{"type":"string"},"description":"Section code","required":true}],"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 a new article","description":"Store a new article."}},"/api/internal/v1/bbs/{section}/articles/{id}":{"get":{"tags":[],"parameters":[{"name":"section","in":"path","schema":{"type":"string"},"description":"","required":true},{"name":"id","in":"path","schema":{"type":"string","format":"uuid"},"description":"","required":true}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IBbsArticle"}}}}}}},"/api/internal/v2/bbs/{section}/articles/{id}":{"put":{"tags":[],"parameters":[{"name":"section","in":"path","schema":{"type":"string"},"description":"Section code","required":true},{"name":"id","in":"path","schema":{"type":"string","format":"uuid"},"description":"Target article ID","required":true}],"requestBody":{"description":"Content to update","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IBbsArticle.IStore"}}},"required":true},"responses":{"200":{"description":"Updated content","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IBbsArticle"}}}}},"summary":"Update an article","description":"Update an article."}}},"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"]},"IPage.IRequest":{"type":"object","properties":{"page":{"oneOf":[{"type":"null"},{"type":"integer"}]},"limit":{"oneOf":[{"type":"null"},{"type":"integer"}]}},"description":"Page request data"},"IPageIBbsArticle.ISummary":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/IBbsArticle.ISummary"}},"pagination":{"$ref":"#/components/schemas/IPage.IPagination"}},"required":["data","pagination"]},"IBbsArticle.ISummary":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"section":{"type":"string"},"writer":{"type":"string"},"title":{"type":"string","minLength":3,"maxLength":50},"created_at":{"type":"string","format":"date-time"}},"required":["id","section","writer","title","created_at"]},"IPage.IPagination":{"type":"object","properties":{"current":{"type":"integer"},"limit":{"type":"integer"},"records":{"type":"integer"},"pages":{"type":"integer"}},"required":["current","limit","records","pages"],"description":"Page information."},"IBbsArticle":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"section":{"type":"string"},"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","section","created_at","title","body","files"]},"IAttachmentFile":{"type":"object","properties":{"name":{"oneOf":[{"type":"null"},{"type":"string","minLength":1,"maxLength":255}]},"extension":{"oneOf":[{"type":"null"},{"type":"string","minLength":1,"maxLength":8}]},"url":{"oneOf":[{"type":"null"},{"type":"string","format":"uri"}]}},"required":["name","extension","url"]},"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"]}},"securitySchemes":{"bearer":{"type":"apiKey","in":"header","name":"Authorization"}}},"tags":[],"x-samchon-emended":true}
Loading

0 comments on commit d1934d0

Please sign in to comment.