-
-
Notifications
You must be signed in to change notification settings - Fork 102
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1157 from samchon/feat/param
Close #914: `@TypedParam()` to consider `validate` option.
- Loading branch information
Showing
61 changed files
with
1,931 additions
and
183 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import { INestiaConfig } from "@nestia/sdk"; | ||
|
||
export const NESTIA_CONFIG: INestiaConfig = { | ||
input: ["src/controllers"], | ||
output: "src/api", | ||
swagger: { | ||
beautify: true, | ||
output: "swagger.json", | ||
security: { | ||
bearer: { | ||
type: "apiKey", | ||
}, | ||
}, | ||
}, | ||
}; | ||
export default NESTIA_CONFIG; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import core from "@nestia/core"; | ||
import { INestApplication } from "@nestjs/common"; | ||
import { NestFactory } from "@nestjs/core"; | ||
|
||
export class Backend { | ||
private application_?: INestApplication; | ||
|
||
public async open(): Promise<void> { | ||
this.application_ = await NestFactory.create( | ||
await core.EncryptedModule.dynamic(__dirname + "/controllers", { | ||
key: "A".repeat(32), | ||
iv: "B".repeat(16), | ||
}), | ||
{ logger: false }, | ||
); | ||
await core.WebSocketAdaptor.upgrade(this.application_); | ||
await this.application_.listen(37_000); | ||
} | ||
|
||
public async close(): Promise<void> { | ||
if (this.application_ === undefined) return; | ||
|
||
const app = this.application_; | ||
await app.close(); | ||
|
||
delete this.application_; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export { HttpError } from "@nestia/fetcher"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export type { IConnection } from "@nestia/fetcher"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export type { Primitive } from "typia"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export type { Resolved } from "typia"; |
51 changes: 51 additions & 0 deletions
51
test/features/param-validate/src/api/functional/calculate/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
/** | ||
* @packageDocumentation | ||
* @module api.functional.calculate | ||
* @nestia Generated by Nestia - https://github.com/samchon/nestia | ||
*/ | ||
//================================================================ | ||
import type { IConnection } from "@nestia/fetcher"; | ||
import { WebSocketConnector } from "tgrid"; | ||
import type { Driver } from "tgrid"; | ||
import type { Format } from "typia/lib/tags/Format"; | ||
|
||
import type { ICalculator } from "../../structures/ICalculator"; | ||
import type { IListener } from "../../structures/IListener"; | ||
import type { IPrecision } from "../../structures/IPrecision"; | ||
|
||
/** | ||
* @controller CalculateController.connect | ||
* @path /calculate/:id | ||
* @nestia Generated by Nestia - https://github.com/samchon/nestia | ||
*/ | ||
export async function connect( | ||
connection: IConnection<connect.Header>, | ||
id: string & Format<"uuid">, | ||
provider: connect.Provider, | ||
): Promise<connect.Output> { | ||
const connector: WebSocketConnector< | ||
connect.Header, | ||
connect.Provider, | ||
connect.Listener | ||
> = new WebSocketConnector(connection.headers ?? ({} as any), provider); | ||
await connector.connect( | ||
`${connection.host.endsWith("/") ? connection.host.substring(0, connection.host.length - 1) : connection.host}${connect.path(id)}`, | ||
); | ||
const driver: Driver<connect.Listener> = connector.getDriver(); | ||
return { | ||
connector, | ||
driver, | ||
}; | ||
} | ||
export namespace connect { | ||
export type Output = { | ||
connector: WebSocketConnector<Header, Provider, Listener>; | ||
driver: Driver<Listener>; | ||
}; | ||
export type Header = IPrecision; | ||
export type Provider = IListener; | ||
export type Listener = ICalculator; | ||
|
||
export const path = (id: string & Format<"uuid">) => | ||
`/calculate/${encodeURIComponent(id?.toString() ?? "null")}`; | ||
} |
35 changes: 35 additions & 0 deletions
35
test/features/param-validate/src/api/functional/health/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
/** | ||
* @packageDocumentation | ||
* @module api.functional.health | ||
* @nestia Generated by Nestia - https://github.com/samchon/nestia | ||
*/ | ||
//================================================================ | ||
import type { IConnection } from "@nestia/fetcher"; | ||
import { PlainFetcher } from "@nestia/fetcher/lib/PlainFetcher"; | ||
|
||
/** | ||
* @controller HealthController.get | ||
* @path GET /health | ||
* @nestia Generated by Nestia - https://github.com/samchon/nestia | ||
*/ | ||
export async function get(connection: IConnection): Promise<void> { | ||
return PlainFetcher.fetch(connection, { | ||
...get.METADATA, | ||
template: get.METADATA.path, | ||
path: get.path(), | ||
}); | ||
} | ||
export namespace get { | ||
export const METADATA = { | ||
method: "GET", | ||
path: "/health", | ||
request: null, | ||
response: { | ||
type: "application/json", | ||
encrypted: false, | ||
}, | ||
status: 200, | ||
} as const; | ||
|
||
export const path = () => "/health"; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
/** | ||
* @packageDocumentation | ||
* @module api.functional | ||
* @nestia Generated by Nestia - https://github.com/samchon/nestia | ||
*/ | ||
//================================================================ | ||
export * as calculate from "./calculate"; | ||
export * as health from "./health"; | ||
export * as performance from "./performance"; | ||
export * as param from "./param"; |
Oops, something went wrong.