Skip to content

Commit

Permalink
Merge pull request #963 from samchon/features/primitive
Browse files Browse the repository at this point in the history
Bump up `typia` version and update `Primitive` type to be compatible.
  • Loading branch information
samchon authored Jul 19, 2024
2 parents 2853732 + 3576fb3 commit 28841b1
Show file tree
Hide file tree
Showing 18 changed files with 57 additions and 41 deletions.
2 changes: 1 addition & 1 deletion benchmark/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
"reflect-metadata": "^0.2.2",
"tgrid": "^1.0.2",
"tstl": "^3.0.0",
"typia": "^6.5.0"
"typia": "^6.5.2"
},
"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.7.1",
"version": "3.7.2-dev.20240720",
"description": "Nestia station",
"scripts": {
"build": "node build/index.js",
Expand Down
2 changes: 1 addition & 1 deletion packages/benchmark/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
"ts-patch": "^3.2.1",
"typescript": "^5.5.3",
"typescript-transform-paths": "^3.4.7",
"typia": "^6.5.0",
"typia": "^6.5.2",
"uuid": "^10.0.0"
},
"dependencies": {
Expand Down
12 changes: 6 additions & 6 deletions packages/core/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@nestia/core",
"version": "3.7.1",
"version": "3.7.2-dev.20240720",
"description": "Super-fast validation decorators of NestJS",
"main": "lib/index.js",
"typings": "lib/index.d.ts",
Expand Down Expand Up @@ -36,10 +36,10 @@
},
"homepage": "https://nestia.io",
"dependencies": {
"@nestia/fetcher": "^3.7.1",
"@nestia/fetcher": "../fetcher/nestia-fetcher-3.7.2-dev.20240720.tgz",
"@nestjs/common": ">=7.0.1",
"@nestjs/core": ">=7.0.1",
"@samchon/openapi": "^0.4.1",
"@samchon/openapi": "^0.4.2",
"detect-ts-node": "^1.0.5",
"get-function-location": "^2.0.0",
"glob": "^7.2.0",
Expand All @@ -49,16 +49,16 @@
"reflect-metadata": ">=0.1.12",
"rxjs": ">=6.0.3",
"tgrid": "^1.0.0",
"typia": "^6.5.0",
"typia": "^6.5.2",
"ws": "^7.5.3"
},
"peerDependencies": {
"@nestia/fetcher": ">=3.7.1",
"@nestia/fetcher": ">=3.7.2-dev.20240720",
"@nestjs/common": ">=7.0.1",
"@nestjs/core": ">=7.0.1",
"reflect-metadata": ">=0.1.12",
"rxjs": ">=6.0.3",
"typia": ">=6.5.0 <7.0.0"
"typia": ">=6.5.2 <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 @@ -41,7 +41,7 @@
"ts-patch": "^3.2.1",
"typescript": "^5.5.3",
"typescript-transform-paths": "^3.4.7",
"typia": "^6.5.0"
"typia": "^6.5.2"
},
"files": [
"lib",
Expand Down
4 changes: 2 additions & 2 deletions packages/fetcher/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@nestia/fetcher",
"version": "3.7.1",
"version": "3.7.2-dev.20240720",
"description": "Fetcher library of Nestia SDK",
"main": "lib/index.js",
"typings": "lib/index.d.ts",
Expand Down Expand Up @@ -43,6 +43,6 @@
"src"
],
"dependencies": {
"@samchon/openapi": "^0.4.1"
"@samchon/openapi": "^0.4.2"
}
}
26 changes: 22 additions & 4 deletions packages/fetcher/src/Primitive.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,15 +47,17 @@ type PrimitiveMain<Instance> = Instance extends [never]
? never
: ValueOf<Instance> extends object
? Instance extends object
? Instance extends NativeClass
? never
? Instance extends Date
? string & FormatDateTime
: Instance extends IJsonable<infer Raw>
? ValueOf<Raw> extends object
? Raw extends object
? PrimitiveObject<Raw> // object would be primitified
: never // cannot be
: ValueOf<Raw> // atomic value
: PrimitiveObject<Instance> // object would be primitified
: Instance extends NativeClass
? never
: PrimitiveObject<Instance> // object would be primitified
: never // cannot be
: ValueOf<Instance>;

Expand Down Expand Up @@ -107,7 +109,10 @@ type NativeClass =
| Float64Array
| ArrayBuffer
| SharedArrayBuffer
| DataView;
| DataView
| Blob
| File
| RegExp;

type IsTuple<T extends readonly any[] | { length: number }> = [T] extends [
never,
Expand All @@ -134,3 +139,16 @@ interface IValueOf<T> {
interface IJsonable<T> {
toJSON(): T;
}

type FormatDateTime = {
"typia.tag"?: {
target: "string";
kind: "format";
value: "date-time";
validate: `/^[0-9]{4}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])(T|\\s)([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9](?:\\.[0-9]{1,9})?(Z|[+-]([01][0-9]|2[0-3]):[0-5][0-9])$/i.test($input)`;
exclusive: ["format", "pattern"];
schema: {
format: "date-time";
};
};
};
1 change: 1 addition & 0 deletions packages/fetcher/src/Resolved.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ type ResolvedObject<T extends object> =
| DataView
| Blob
| File
| RegExp
? T
: {
[P in keyof T]: ResolvedMain<T[P]>;
Expand Down
2 changes: 1 addition & 1 deletion packages/migrate/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
"prettier": "^3.2.5",
"tstl": "^3.0.0",
"typescript": "^5.5.3",
"typia": "^6.5.0"
"typia": "^6.5.2"
},
"files": [
"lib",
Expand Down
16 changes: 8 additions & 8 deletions packages/sdk/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@nestia/sdk",
"version": "3.7.1",
"version": "3.7.2-dev.20240720",
"description": "Nestia SDK and Swagger generator",
"main": "lib/index.js",
"typings": "lib/index.d.ts",
Expand Down Expand Up @@ -32,9 +32,9 @@
},
"homepage": "https://nestia.io",
"dependencies": {
"@nestia/fetcher": "^3.7.1",
"@nestia/core": "^3.7.1",
"@samchon/openapi": "^0.4.1",
"@nestia/fetcher": "../fetcher/nestia-fetcher-3.7.2-dev.20240720.tgz",
"@nestia/core": "../core/nestia-core-3.7.2-dev.20240720.tgz",
"@samchon/openapi": "^0.4.2",
"cli": "^1.0.1",
"get-function-location": "^2.0.0",
"glob": "^7.2.0",
Expand All @@ -44,16 +44,16 @@
"tsconfck": "^2.0.1",
"tsconfig-paths": "^4.1.1",
"tstl": "^3.0.0",
"typia": "^6.5.0"
"typia": "^6.5.2"
},
"peerDependencies": {
"@nestia/fetcher": ">=3.7.1",
"@nestia/core": ">=3.7.1",
"@nestia/fetcher": ">=3.7.2-dev.20240720",
"@nestia/core": ">=3.7.2-dev.20240720",
"@nestjs/common": ">=7.0.1",
"@nestjs/core": ">=7.0.1",
"reflect-metadata": ">=0.1.12",
"ts-node": ">=10.6.0",
"typia": ">=6.5.0 <7.0.0"
"typia": ">=6.5.2 <7.0.0"
},
"devDependencies": {
"@trivago/prettier-plugin-sort-imports": "^4.3.0",
Expand Down
3 changes: 0 additions & 3 deletions test/features/date/src/api/structures/IDateDefined.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@ export interface IDateDefined {

date: Date;

/**
* @format date-time
*/
date_with_tag: Date;

date_but_union: Date | Buffer;
Expand Down
4 changes: 2 additions & 2 deletions test/features/date/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,9 @@
// "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */
// "sourceMap": true, /* Create source map files for emitted JavaScript files. */
// "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If 'declaration' is true, also designates a file that bundles all .d.ts output. */
// "outDir": "./", /* Specify an output folder for all emitted files. */
"outDir": "./bin", /* Specify an output folder for all emitted files. */
// "removeComments": true, /* Disable emitting comments. */
"noEmit": true, /* Disable emitting files from a compilation. */
// "noEmit": true, /* Disable emitting files from a compilation. */
// "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */
// "importsNotUsedAsValues": "remove", /* Specify emit/checking behavior for imports that are only used for types. */
// "downlevelIteration": true, /* Emit more compliant, but verbose and less performant JavaScript for iteration. */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,6 @@
},
"dependencies": {
"@nestia/fetcher": "^3.5.0",
"typia": "^6.5.0"
"typia": "^6.5.2"
}
}
2 changes: 1 addition & 1 deletion test/features/distribute-assert/packages/api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,6 @@
},
"dependencies": {
"@nestia/fetcher": "^3.5.0",
"typia": "^6.5.0"
"typia": "^6.5.2"
}
}
2 changes: 1 addition & 1 deletion test/features/distribute-json/packages/api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,6 @@
},
"dependencies": {
"@nestia/fetcher": "^3.5.0",
"typia": "^6.5.0"
"typia": "^6.5.2"
}
}
2 changes: 1 addition & 1 deletion test/features/distribute/packages/api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,6 @@
},
"dependencies": {
"@nestia/fetcher": "^3.5.0",
"typia": "^6.5.0"
"typia": "^6.5.2"
}
}
12 changes: 6 additions & 6 deletions test/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"private": true,
"name": "@samchon/nestia-test",
"version": "3.7.1",
"version": "3.7.2-dev.20240720",
"description": "Test program of Nestia",
"main": "index.js",
"scripts": {
Expand All @@ -26,9 +26,9 @@
},
"homepage": "https://nestia.io",
"devDependencies": {
"@nestia/sdk": "^3.7.1",
"@nestia/sdk": "../packages/sdk/nestia-sdk-3.7.2-dev.20240720.tgz",
"@nestjs/swagger": "^7.1.2",
"@samchon/openapi": "^0.4.1",
"@samchon/openapi": "^0.4.2",
"@types/express": "^4.17.17",
"@types/node": "20.11.16",
"@types/uuid": "^9.0.8",
Expand All @@ -40,16 +40,16 @@
},
"dependencies": {
"@fastify/multipart": "^8.1.0",
"@nestia/core": "^3.7.1",
"@nestia/core": "../packages/core/nestia-core-3.7.2-dev.20240720.tgz",
"@nestia/e2e": "^0.7.0",
"@nestia/fetcher": "^3.7.1",
"@nestia/fetcher": "../packages/fetcher/nestia-fetcher-3.7.2-dev.20240720.tgz",
"@nestjs/common": "^10.3.5",
"@nestjs/core": "^10.3.5",
"@nestjs/platform-express": "^10.3.5",
"@nestjs/platform-fastify": "^10.3.5",
"tgrid": "^1.0.2",
"tstl": "^3.0.0",
"typia": "^6.5.0",
"typia": "^6.5.2",
"uuid": "^9.0.1"
}
}
2 changes: 1 addition & 1 deletion website/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
"react": "18.2.0",
"react-dom": "18.2.0",
"react-mui-fileuploader": "^0.5.2",
"typia": "^6.5.0"
"typia": "^6.5.2"
},
"devDependencies": {
"@trivago/prettier-plugin-sort-imports": "^4.3.0",
Expand Down

0 comments on commit 28841b1

Please sign in to comment.