Skip to content

Commit

Permalink
Merge pull request #1396 from samchon/v7.0
Browse files Browse the repository at this point in the history
Publish v7.0
  • Loading branch information
samchon authored Dec 2, 2024
2 parents 7bac37a + 17de7bc commit 9358cd1
Show file tree
Hide file tree
Showing 4,859 changed files with 692,514 additions and 43,350 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
2 changes: 2 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,15 @@ on:
paths:
- 'src/**'
- 'test/**'
- 'test-error/**'
- 'test-esm/**'
- 'package.json'
- '.github/workflows/build.yml'
pull_request:
paths:
- 'src/**'
- 'test/**'
- 'test-error/**'
- 'test-esm/**'
- 'package.json'
- '.github/workflows/build.yml'
Expand Down
31 changes: 31 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,37 @@ I always welcome your suggestion. When you publishing a suggestion, then please


## Contributing Code

### Project Structure
```
typia/
├── src/ # Source code
│ ├── executable/ # CLI commands
│ ├── factories/ # Factory classes
│ ├── functional/ # Functional utilities
│ ├── programmers/ # Code generators
│ ├── schemas/ # Schema definitions
│ ├── tags/ # Tag implementations
│ ├── transformers/ # Code transformers
│ ├── typings/ # Type definitions
│ └── utils/ # Utility functions
├── test/ # Test files
├── benchmark/ # Benchmarking code
├── website/ # Documentation website
└── packages/ # Sub-packages
```

### Naming Conventions
- **Files**: Use camelCase for regular files (e.g., `jsonMetadata.ts`)
- **Classes**: Use PascalCase (e.g., `TypeGuardError`, `MetadataFactory`)
- **Interfaces**: Prefix with 'I' (e.g., `IValidation`, `IRandomGenerator`)
- **Type aliases**: Use PascalCase (e.g., `Primitive`, `Resolved`)
- **Functions**: Use camelCase (e.g., `stringify`, `validate`)
- **Constants**: Use UPPER_SNAKE_CASE for global constants
- **Variables**: Use camelCase
- **Test files**: Prefix with `test_` (e.g., `test_stringify_object_recursive`)


### Test your code
Before sending a pull request, please test your new code. Please run the following commands:

Expand Down
15 changes: 9 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,13 @@ export namespace json {
export function assertStringify<T>(input: T): string; // safe and faster
}

// LLM FUNCTION CALLING APPLICATION
// LLM FUNCTION CALLING SCHEMA
export namespace llm {
// LLM function calling application from a class or interface type
export function application<App>(): ILlmApplication;
export function schema<T>(): ILlmSchema; // LLM type schema
// application schema from a class or interface type
export function application<App, Model>(): ILlmApplication<Model>;
// structured output
export function parameters<P, Moodel>(): ILlmSchema.IParameters<Model>;
export function schema<T, Model>(): ILlmSchema<Model>; // type schema
}

// PROTOCOL BUFFER
Expand All @@ -43,8 +45,8 @@ export function random<T>(g?: Partial<IRandomGenerator>): T;
Typia is a transformer library supporting below features:

- Super-fast Runtime Validators
- Enhanced JSON functions
- LLM function calling application composer
- Enhanced JSON schema and serde functions
- LLM function calling schema and structured output
- Protocol Buffer encoder and decoder
- Random data generator

Expand Down Expand Up @@ -101,6 +103,7 @@ Check out the document in the [website](https://typia.io/docs/):
- [`parse()` functions](https://typia.io/docs/json/parse/)
- LLM Function Calling
- [`application()` function](https://typia.io/docs/llm/application/)
- [`parameters()` function](https://typia.io/docs/llm/parameters/)
- [`schema()` function](https://typia.io/docs/llm/schema/)
- Protocol Buffer
- [Message Schema](https://typia.io/docs/protobuf/message)
Expand Down
4 changes: 2 additions & 2 deletions benchmark/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
"ts-node": "^10.9.1",
"ts-patch": "^3.2.0",
"tstl": "^3.0.0",
"typescript": "^5.3.2",
"typescript": "~5.6.3",
"uuid": "^8.3.2",
"zod": "^3.19.1"
},
Expand All @@ -72,6 +72,6 @@
"suppress-warnings": "^1.0.2",
"tstl": "^3.0.0",
"uuid": "^9.0.1",
"typia": "../typia-6.12.1.tgz"
"typia": "../"
}
}
23 changes: 12 additions & 11 deletions benchmark/src/internal/AjvFactory.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
import { OpenApiV3 } from "@samchon/openapi";
import Ajv, { Options } from "ajv";
import { IJsonApplication } from "typia";
import { IJsonSchemaCollection } from "typia";

export namespace AjvFactory {
export const create = (options: Options) => (app: IJsonApplication<"3.0">) =>
new Ajv({
schemas: Object.entries(app.components.schemas ?? {}).map(
([key, value]) => ({
...emendSchema(value),
$id: `#/components/schemas/${key}`,
}),
),
...options,
}).compile(emendSchema(app.schemas[0]));
export const create =
(options: Options) => (app: IJsonSchemaCollection<"3.0">) =>
new Ajv({
schemas: Object.entries(app.components.schemas ?? {}).map(
([key, value]) => ({
...emendSchema(value),
$id: `#/components/schemas/${key}`,
}),
),
...options,
}).compile(emendSchema(app.schemas[0]));

const emendSchema = (
schema: OpenApiV3.IJsonSchema,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,4 @@ import typia from "typia";
import { ArrayRecursive } from "../../../structures/pure/ArrayRecursive";
import { createAssertAjvBenchmarkProgram } from "./createAssertAjvBenchmarkProgram";

createAssertAjvBenchmarkProgram(
typia.json.application<[ArrayRecursive], "3.0">(),
);
createAssertAjvBenchmarkProgram(typia.json.schemas<[ArrayRecursive], "3.0">());
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ import { ArrayRecursiveUnionExplicit } from "../../../structures/pure/ArrayRecur
import { createAssertAjvBenchmarkProgram } from "./createAssertAjvBenchmarkProgram";

createAssertAjvBenchmarkProgram(
typia.json.application<[ArrayRecursiveUnionExplicit], "3.0">(),
typia.json.schemas<[ArrayRecursiveUnionExplicit], "3.0">(),
);
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ import { ArrayRecursiveUnionImplicit } from "../../../structures/pure/ArrayRecur
import { createAssertAjvBenchmarkProgram } from "./createAssertAjvBenchmarkProgram";

createAssertAjvBenchmarkProgram(
typia.json.application<[ArrayRecursiveUnionImplicit], "3.0">(),
typia.json.schemas<[ArrayRecursiveUnionImplicit], "3.0">(),
);
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ import { ObjectHierarchical } from "../../../structures/pure/ObjectHierarchical"
import { createAssertAjvBenchmarkProgram } from "./createAssertAjvBenchmarkProgram";

createAssertAjvBenchmarkProgram(
typia.json.application<[ObjectHierarchical], "3.0">(),
typia.json.schemas<[ObjectHierarchical], "3.0">(),
);
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,4 @@ import typia from "typia";
import { ObjectRecursive } from "../../../structures/pure/ObjectRecursive";
import { createAssertAjvBenchmarkProgram } from "./createAssertAjvBenchmarkProgram";

createAssertAjvBenchmarkProgram(
typia.json.application<[ObjectRecursive], "3.0">(),
);
createAssertAjvBenchmarkProgram(typia.json.schemas<[ObjectRecursive], "3.0">());
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,4 @@ import typia from "typia";
import { ObjectSimple } from "../../../structures/pure/ObjectSimple";
import { createAssertAjvBenchmarkProgram } from "./createAssertAjvBenchmarkProgram";

createAssertAjvBenchmarkProgram(
typia.json.application<[ObjectSimple], "3.0">(),
);
createAssertAjvBenchmarkProgram(typia.json.schemas<[ObjectSimple], "3.0">());
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ import { ObjectUnionExplicit } from "../../../structures/pure/ObjectUnionExplici
import { createAssertAjvBenchmarkProgram } from "./createAssertAjvBenchmarkProgram";

createAssertAjvBenchmarkProgram(
typia.json.application<[ObjectUnionExplicit], "3.0">(),
typia.json.schemas<[ObjectUnionExplicit], "3.0">(),
);
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ import { ObjectUnionImplicit } from "../../../structures/pure/ObjectUnionImplici
import { createAssertAjvBenchmarkProgram } from "./createAssertAjvBenchmarkProgram";

createAssertAjvBenchmarkProgram(
typia.json.application<[ObjectUnionImplicit], "3.0">(),
typia.json.schemas<[ObjectUnionImplicit], "3.0">(),
);
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,4 @@ import typia from "typia";
import { UltimateUnion } from "../../../structures/pure/UltimateUnion";
import { createAssertAjvBenchmarkProgram } from "./createAssertAjvBenchmarkProgram";

createAssertAjvBenchmarkProgram(
typia.json.application<[UltimateUnion], "3.0">(),
);
createAssertAjvBenchmarkProgram(typia.json.schemas<[UltimateUnion], "3.0">());
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { IJsonApplication } from "typia";
import { IJsonSchemaCollection } from "typia";

import { AjvFactory } from "../../../internal/AjvFactory";
import { createAssertBenchmarkProgram } from "../createAssertBenchmarkProgram";

export const createAssertAjvBenchmarkProgram = (
app: IJsonApplication<"3.0">,
app: IJsonSchemaCollection<"3.0">,
) => {
try {
const validate = AjvFactory.create({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ import typia from "typia";
import { ArrayRecursive } from "../../../structures/pure/ArrayRecursive";
import { createIsAjvBenchmarkProgram } from "./createIsAjvBenchmarkProgram";

createIsAjvBenchmarkProgram(typia.json.application<[ArrayRecursive], "3.0">());
createIsAjvBenchmarkProgram(typia.json.schemas<[ArrayRecursive], "3.0">());
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ import { ArrayRecursiveUnionExplicit } from "../../../structures/pure/ArrayRecur
import { createIsAjvBenchmarkProgram } from "./createIsAjvBenchmarkProgram";

createIsAjvBenchmarkProgram(
typia.json.application<[ArrayRecursiveUnionExplicit], "3.0">(),
typia.json.schemas<[ArrayRecursiveUnionExplicit], "3.0">(),
);
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ import { ArrayRecursiveUnionImplicit } from "../../../structures/pure/ArrayRecur
import { createIsAjvBenchmarkProgram } from "./createIsAjvBenchmarkProgram";

createIsAjvBenchmarkProgram(
typia.json.application<[ArrayRecursiveUnionImplicit], "3.0">(),
typia.json.schemas<[ArrayRecursiveUnionImplicit], "3.0">(),
);
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,4 @@ import typia from "typia";
import { ObjectHierarchical } from "../../../structures/pure/ObjectHierarchical";
import { createIsAjvBenchmarkProgram } from "./createIsAjvBenchmarkProgram";

createIsAjvBenchmarkProgram(
typia.json.application<[ObjectHierarchical], "3.0">(),
);
createIsAjvBenchmarkProgram(typia.json.schemas<[ObjectHierarchical], "3.0">());
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ import typia from "typia";
import { ObjectRecursive } from "../../../structures/pure/ObjectRecursive";
import { createIsAjvBenchmarkProgram } from "./createIsAjvBenchmarkProgram";

createIsAjvBenchmarkProgram(typia.json.application<[ObjectRecursive], "3.0">());
createIsAjvBenchmarkProgram(typia.json.schemas<[ObjectRecursive], "3.0">());
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ import typia from "typia";
import { ObjectSimple } from "../../../structures/pure/ObjectSimple";
import { createIsAjvBenchmarkProgram } from "./createIsAjvBenchmarkProgram";

createIsAjvBenchmarkProgram(typia.json.application<[ObjectSimple], "3.0">());
createIsAjvBenchmarkProgram(typia.json.schemas<[ObjectSimple], "3.0">());
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,4 @@ import typia from "typia";
import { ObjectUnionExplicit } from "../../../structures/pure/ObjectUnionExplicit";
import { createIsAjvBenchmarkProgram } from "./createIsAjvBenchmarkProgram";

createIsAjvBenchmarkProgram(
typia.json.application<[ObjectUnionExplicit], "3.0">(),
);
createIsAjvBenchmarkProgram(typia.json.schemas<[ObjectUnionExplicit], "3.0">());
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,4 @@ import typia from "typia";
import { ObjectUnionImplicit } from "../../../structures/pure/ObjectUnionImplicit";
import { createIsAjvBenchmarkProgram } from "./createIsAjvBenchmarkProgram";

createIsAjvBenchmarkProgram(
typia.json.application<[ObjectUnionImplicit], "3.0">(),
);
createIsAjvBenchmarkProgram(typia.json.schemas<[ObjectUnionImplicit], "3.0">());
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ import typia from "typia";
import { UltimateUnion } from "../../../structures/pure/UltimateUnion";
import { createIsAjvBenchmarkProgram } from "./createIsAjvBenchmarkProgram";

createIsAjvBenchmarkProgram(typia.json.application<[UltimateUnion], "3.0">());
createIsAjvBenchmarkProgram(typia.json.schemas<[UltimateUnion], "3.0">());
6 changes: 4 additions & 2 deletions benchmark/src/programs/is/ajv/createIsAjvBenchmarkProgram.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import { IJsonApplication } from "typia";
import { IJsonSchemaCollection } from "typia";

import { AjvFactory } from "../../../internal/AjvFactory";
import { createIsBenchmarkProgram } from "../createIsBenchmarkProgram";

export const createIsAjvBenchmarkProgram = (app: IJsonApplication<"3.0">) => {
export const createIsAjvBenchmarkProgram = (
app: IJsonSchemaCollection<"3.0">,
) => {
try {
const validate = AjvFactory.create({
strict: true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import typia from "typia";
import { IServerAssertProgram } from "./IServerAssertProgram";

export const createFastifyPureServerAssertBenchmarkProgram = async <T>(
app: typia.IJsonApplication<"3.0">,
app: typia.IJsonSchemaCollection<"3.0">,
) => {
// OPEN SERVER
const server = fastify({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ import { ArrayHierarchical } from "../../../../structures/pure/ArrayHierarchical
import { createFastifyPureServerAssertBenchmarkProgram } from "../createFastifyPureServerAssertBenchmarkProgram";

createFastifyPureServerAssertBenchmarkProgram(
typia.json.application<[ICollection<ArrayHierarchical>], "3.0">(),
typia.json.schemas<[ICollection<ArrayHierarchical>], "3.0">(),
);
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ import { ArrayRecursive } from "../../../../structures/pure/ArrayRecursive";
import { createFastifyPureServerAssertBenchmarkProgram } from "../createFastifyPureServerAssertBenchmarkProgram";

createFastifyPureServerAssertBenchmarkProgram(
typia.json.application<[ICollection<ArrayRecursive>], "3.0">(),
typia.json.schemas<[ICollection<ArrayRecursive>], "3.0">(),
);
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ import { ArrayRecursiveUnionExplicit } from "../../../../structures/pure/ArrayRe
import { createFastifyPureServerAssertBenchmarkProgram } from "../createFastifyPureServerAssertBenchmarkProgram";

createFastifyPureServerAssertBenchmarkProgram(
typia.json.application<[ICollection<ArrayRecursiveUnionExplicit>], "3.0">(),
typia.json.schemas<[ICollection<ArrayRecursiveUnionExplicit>], "3.0">(),
);
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ import { ArraySimple } from "../../../../structures/pure/ArraySimple";
import { createFastifyPureServerAssertBenchmarkProgram } from "../createFastifyPureServerAssertBenchmarkProgram";

createFastifyPureServerAssertBenchmarkProgram(
typia.json.application<[ICollection<ArraySimple>], "3.0">(),
typia.json.schemas<[ICollection<ArraySimple>], "3.0">(),
);
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ import { ObjectHierarchical } from "../../../../structures/pure/ObjectHierarchic
import { createFastifyPureServerAssertBenchmarkProgram } from "../createFastifyPureServerAssertBenchmarkProgram";

createFastifyPureServerAssertBenchmarkProgram(
typia.json.application<[ICollection<ObjectHierarchical>], "3.0">(),
typia.json.schemas<[ICollection<ObjectHierarchical>], "3.0">(),
);
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ import { ObjectRecursive } from "../../../../structures/pure/ObjectRecursive";
import { createFastifyPureServerAssertBenchmarkProgram } from "../createFastifyPureServerAssertBenchmarkProgram";

createFastifyPureServerAssertBenchmarkProgram(
typia.json.application<[ICollection<ObjectRecursive>], "3.0">(),
typia.json.schemas<[ICollection<ObjectRecursive>], "3.0">(),
);
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ import { ObjectSimple } from "../../../../structures/pure/ObjectSimple";
import { createFastifyPureServerAssertBenchmarkProgram } from "../createFastifyPureServerAssertBenchmarkProgram";

createFastifyPureServerAssertBenchmarkProgram(
typia.json.application<[ICollection<ObjectSimple>], "3.0">(),
typia.json.schemas<[ICollection<ObjectSimple>], "3.0">(),
);
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ import { ObjectUnionExplicit } from "../../../../structures/pure/ObjectUnionExpl
import { createFastifyPureServerAssertBenchmarkProgram } from "../createFastifyPureServerAssertBenchmarkProgram";

createFastifyPureServerAssertBenchmarkProgram(
typia.json.application<[ICollection<ObjectUnionExplicit>], "3.0">(),
typia.json.schemas<[ICollection<ObjectUnionExplicit>], "3.0">(),
);
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import typia from "typia";
import { IServerPerformanceProgram } from "./IServerPerformanceProgram";

export const createFastifyPureServerPerformanceBenchmarkProgram = async <T>(
app: typia.IJsonApplication<"3.0">,
app: typia.IJsonSchemaCollection<"3.0">,
) => {
// OPEN SERVER
const server = fastify({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ import { ArrayHierarchical } from "../../../../structures/pure/ArrayHierarchical
import { createFastifyPureServerPerformanceBenchmarkProgram } from "../createFastifyPureServerPerformanceBenchmarkProgram";

createFastifyPureServerPerformanceBenchmarkProgram(
typia.json.application<[ICollection<ArrayHierarchical>], "3.0">(),
typia.json.schemas<[ICollection<ArrayHierarchical>], "3.0">(),
);
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ import { ArrayRecursive } from "../../../../structures/pure/ArrayRecursive";
import { createFastifyPureServerPerformanceBenchmarkProgram } from "../createFastifyPureServerPerformanceBenchmarkProgram";

createFastifyPureServerPerformanceBenchmarkProgram(
typia.json.application<[ICollection<ArrayRecursive>], "3.0">(),
typia.json.schemas<[ICollection<ArrayRecursive>], "3.0">(),
);
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ import { ArrayRecursiveUnionExplicit } from "../../../../structures/pure/ArrayRe
import { createFastifyPureServerPerformanceBenchmarkProgram } from "../createFastifyPureServerPerformanceBenchmarkProgram";

createFastifyPureServerPerformanceBenchmarkProgram(
typia.json.application<[ICollection<ArrayRecursiveUnionExplicit>], "3.0">(),
typia.json.schemas<[ICollection<ArrayRecursiveUnionExplicit>], "3.0">(),
);
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ import { ArraySimple } from "../../../../structures/pure/ArraySimple";
import { createFastifyPureServerPerformanceBenchmarkProgram } from "../createFastifyPureServerPerformanceBenchmarkProgram";

createFastifyPureServerPerformanceBenchmarkProgram(
typia.json.application<[ICollection<ArraySimple>], "3.0">(),
typia.json.schemas<[ICollection<ArraySimple>], "3.0">(),
);
Loading

0 comments on commit 9358cd1

Please sign in to comment.