typia 7.0.0-dev.20241126 → 7.0.0-dev.20241126-2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (32) hide show
  1. package/README.md +1 -0
  2. package/lib/executable/TypiaSetupWizard.js +7 -3
  3. package/lib/executable/TypiaSetupWizard.js.map +1 -1
  4. package/lib/index.mjs +3 -3
  5. package/lib/index.mjs.map +1 -1
  6. package/lib/json.d.ts +31 -43
  7. package/lib/json.js +4 -4
  8. package/lib/json.js.map +1 -1
  9. package/lib/programmers/json/JsonApplicationProgrammer.d.ts +2 -2
  10. package/lib/programmers/json/JsonApplicationProgrammer.js.map +1 -1
  11. package/lib/schemas/json/IJsonApplication.d.ts +12 -35
  12. package/lib/schemas/json/IJsonApplication.js +55 -0
  13. package/lib/schemas/json/IJsonApplication.js.map +1 -1
  14. package/lib/schemas/json/IJsonSchemaCollection.d.ts +7 -0
  15. package/lib/schemas/json/__IJsonApplication.d.ts +35 -0
  16. package/lib/schemas/json/__IJsonApplication.js +3 -0
  17. package/lib/schemas/json/__IJsonApplication.js.map +1 -0
  18. package/lib/transformers/CallExpressionTransformer.js +3 -2
  19. package/lib/transformers/CallExpressionTransformer.js.map +1 -1
  20. package/lib/transformers/features/json/JsonApplicationTransformer.d.ts +0 -5
  21. package/lib/transformers/features/json/JsonApplicationTransformer.js +92 -85
  22. package/lib/transformers/features/json/JsonApplicationTransformer.js.map +1 -1
  23. package/package.json +5 -4
  24. package/src/executable/TypiaSetupWizard.ts +7 -2
  25. package/src/json.ts +82 -27
  26. package/src/programmers/json/JsonApplicationProgrammer.ts +13 -13
  27. package/src/programmers/llm/LlmApplicationProgrammer.ts +4 -4
  28. package/src/schemas/json/IJsonApplication.ts +68 -56
  29. package/src/schemas/json/IJsonSchemaCollection.ts +7 -0
  30. package/src/schemas/json/__IJsonApplication.ts +63 -0
  31. package/src/transformers/CallExpressionTransformer.ts +3 -2
  32. package/src/transformers/features/json/JsonApplicationTransformer.ts +92 -92
@@ -1,87 +1,94 @@
1
1
  "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.JsonApplicationTransformer = void 0;
7
- const typescript_1 = __importDefault(require("typescript"));
8
- const LiteralFactory_1 = require("../../../factories/LiteralFactory");
9
- const MetadataCollection_1 = require("../../../factories/MetadataCollection");
10
- const MetadataFactory_1 = require("../../../factories/MetadataFactory");
11
- const JsonApplicationProgrammer_1 = require("../../../programmers/json/JsonApplicationProgrammer");
12
- const TransformerError_1 = require("../../TransformerError");
13
- var JsonApplicationTransformer;
14
- (function (JsonApplicationTransformer) {
15
- JsonApplicationTransformer.transform = (props) => {
16
- var _a;
17
- // GET GENERIC ARGUMENT
18
- if (!((_a = props.expression.typeArguments) === null || _a === void 0 ? void 0 : _a.length))
19
- throw new TransformerError_1.TransformerError({
20
- code: "typia.json.application",
21
- message: "no generic argument.",
22
- });
23
- const top = props.expression.typeArguments[0];
24
- if (typescript_1.default.isTypeNode(top) === false)
25
- return props.expression;
26
- const version = get_parameter({
27
- checker: props.context.checker,
28
- name: "Version",
29
- is: (str) => str === "3.0" || str === "3.1",
30
- cast: (str) => str,
31
- default: () => "3.1",
32
- })(props.expression.typeArguments[1]);
33
- // GET TYPE
34
- const type = props.context.checker.getTypeFromTypeNode(top);
35
- const collection = new MetadataCollection_1.MetadataCollection({
36
- replace: MetadataCollection_1.MetadataCollection.replace,
37
- });
38
- const result = MetadataFactory_1.MetadataFactory.analyze({
39
- checker: props.context.checker,
40
- transformer: props.context.transformer,
41
- options: {
42
- escape: true,
43
- constant: true,
44
- absorb: false,
45
- functional: true,
46
- validate: JsonApplicationProgrammer_1.JsonApplicationProgrammer.validate,
47
- },
48
- collection,
49
- type,
50
- });
51
- if (result.success === false)
52
- throw TransformerError_1.TransformerError.from({
53
- code: "typia.json.application",
54
- errors: result.errors,
55
- });
56
- // GENERATE LLM APPLICATION
57
- const app = JsonApplicationProgrammer_1.JsonApplicationProgrammer.write({
58
- version,
59
- metadata: result.data,
60
- });
61
- const literal = LiteralFactory_1.LiteralFactory.write(app);
62
- return literal;
63
- };
64
- const get_parameter = (props) => (node) => {
65
- if (!node)
66
- return props.default();
67
- // CHECK LITERAL TYPE
68
- const type = props.checker.getTypeFromTypeNode(node);
69
- if (!type.isLiteral() &&
70
- (type.getFlags() & typescript_1.default.TypeFlags.BooleanLiteral) === 0)
71
- throw new TransformerError_1.TransformerError({
72
- code: "typia.json.application",
73
- message: `generic argument "${props.name}" must be constant.`,
74
- });
75
- // GET VALUE AND VALIDATE IT
76
- const value = type.isLiteral()
77
- ? type.value
78
- : props.checker.typeToString(type);
79
- if (typeof value !== "string" || props.is(value) === false)
80
- throw new TransformerError_1.TransformerError({
81
- code: "typia.json.application",
82
- message: `invalid value on generic argument "${props.name}".`,
83
- });
84
- return props.cast(value);
85
- };
86
- })(JsonApplicationTransformer || (exports.JsonApplicationTransformer = JsonApplicationTransformer = {}));
2
+ // import ts from "typescript";
3
+ // import { LiteralFactory } from "../../../factories/LiteralFactory";
4
+ // import { MetadataCollection } from "../../../factories/MetadataCollection";
5
+ // import { MetadataFactory } from "../../../factories/MetadataFactory";
6
+ // import { IJsonApplication } from "../../../schemas/json/IJsonApplication";
7
+ // import { Metadata } from "../../../schemas/metadata/Metadata";
8
+ // import { JsonApplicationProgrammer } from "../../../programmers/json/JsonApplicationProgrammer";
9
+ // import { ValidationPipe } from "../../../typings/ValidationPipe";
10
+ // import { ITransformProps } from "../../ITransformProps";
11
+ // import { TransformerError } from "../../TransformerError";
12
+ // export namespace JsonApplicationTransformer {
13
+ // export const transform = (props: ITransformProps): ts.Expression => {
14
+ // // GET GENERIC ARGUMENT
15
+ // if (!props.expression.typeArguments?.length)
16
+ // throw new TransformerError({
17
+ // code: "typia.json.application",
18
+ // message: "no generic argument.",
19
+ // });
20
+ // const top: ts.Node = props.expression.typeArguments[0]!;
21
+ // if (ts.isTypeNode(top) === false) return props.expression;
22
+ // const version: "3.0" | "3.1" = get_parameter<"3.0" | "3.1">({
23
+ // checker: props.context.checker,
24
+ // name: "Version",
25
+ // is: (str) => str === "3.0" || str === "3.1",
26
+ // cast: (str) => str as "3.0" | "3.1",
27
+ // default: () => "3.1",
28
+ // })(props.expression.typeArguments[1]);
29
+ // // GET TYPE
30
+ // const type: ts.Type = props.context.checker.getTypeFromTypeNode(top);
31
+ // const collection: MetadataCollection = new MetadataCollection({
32
+ // replace: MetadataCollection.replace,
33
+ // });
34
+ // const result: ValidationPipe<Metadata, MetadataFactory.IError> =
35
+ // MetadataFactory.analyze({
36
+ // checker: props.context.checker,
37
+ // transformer: props.context.transformer,
38
+ // options: {
39
+ // escape: true,
40
+ // constant: true,
41
+ // absorb: false,
42
+ // functional: true,
43
+ // validate: JsonApplicationProgrammer.validate,
44
+ // },
45
+ // collection,
46
+ // type,
47
+ // });
48
+ // if (result.success === false)
49
+ // throw TransformerError.from({
50
+ // code: "typia.json.application",
51
+ // errors: result.errors,
52
+ // });
53
+ // // GENERATE LLM APPLICATION
54
+ // const app: IJsonApplication<"3.0" | "3.1"> =
55
+ // JsonApplicationProgrammer.write({
56
+ // version,
57
+ // metadata: result.data,
58
+ // });
59
+ // const literal: ts.Expression = LiteralFactory.write(app);
60
+ // return literal;
61
+ // };
62
+ // const get_parameter =
63
+ // <Value>(props: {
64
+ // checker: ts.TypeChecker;
65
+ // name: string;
66
+ // is: (value: string) => boolean;
67
+ // cast: (value: string) => Value;
68
+ // default: () => Value;
69
+ // }) =>
70
+ // (node: ts.TypeNode | undefined): Value => {
71
+ // if (!node) return props.default();
72
+ // // CHECK LITERAL TYPE
73
+ // const type: ts.Type = props.checker.getTypeFromTypeNode(node);
74
+ // if (
75
+ // !type.isLiteral() &&
76
+ // (type.getFlags() & ts.TypeFlags.BooleanLiteral) === 0
77
+ // )
78
+ // throw new TransformerError({
79
+ // code: "typia.json.application",
80
+ // message: `generic argument "${props.name}" must be constant.`,
81
+ // });
82
+ // // GET VALUE AND VALIDATE IT
83
+ // const value = type.isLiteral()
84
+ // ? type.value
85
+ // : props.checker.typeToString(type);
86
+ // if (typeof value !== "string" || props.is(value) === false)
87
+ // throw new TransformerError({
88
+ // code: "typia.json.application",
89
+ // message: `invalid value on generic argument "${props.name}".`,
90
+ // });
91
+ // return props.cast(value);
92
+ // };
93
+ // }
87
94
  //# sourceMappingURL=JsonApplicationTransformer.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"JsonApplicationTransformer.js","sourceRoot":"","sources":["../../../../src/transformers/features/json/JsonApplicationTransformer.ts"],"names":[],"mappings":"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"}
1
+ {"version":3,"file":"JsonApplicationTransformer.js","sourceRoot":"","sources":["../../../../src/transformers/features/json/JsonApplicationTransformer.ts"],"names":[],"mappings":";AAAA,+BAA+B;AAE/B,sEAAsE;AACtE,8EAA8E;AAC9E,wEAAwE;AAExE,6EAA6E;AAC7E,iEAAiE;AAEjE,mGAAmG;AAEnG,oEAAoE;AAEpE,2DAA2D;AAC3D,6DAA6D;AAE7D,gDAAgD;AAChD,0EAA0E;AAC1E,8BAA8B;AAC9B,mDAAmD;AACnD,qCAAqC;AACrC,0CAA0C;AAC1C,2CAA2C;AAC3C,YAAY;AAEZ,+DAA+D;AAC/D,iEAAiE;AAEjE,oEAAoE;AACpE,wCAAwC;AACxC,yBAAyB;AACzB,qDAAqD;AACrD,6CAA6C;AAC7C,8BAA8B;AAC9B,6CAA6C;AAE7C,kBAAkB;AAClB,4EAA4E;AAC5E,sEAAsE;AACtE,6CAA6C;AAC7C,UAAU;AACV,uEAAuE;AACvE,kCAAkC;AAClC,0CAA0C;AAC1C,kDAAkD;AAClD,qBAAqB;AACrB,0BAA0B;AAC1B,4BAA4B;AAC5B,2BAA2B;AAC3B,8BAA8B;AAC9B,0DAA0D;AAC1D,aAAa;AACb,sBAAsB;AACtB,gBAAgB;AAChB,YAAY;AACZ,oCAAoC;AACpC,sCAAsC;AACtC,0CAA0C;AAC1C,iCAAiC;AACjC,YAAY;AAEZ,kCAAkC;AAClC,mDAAmD;AACnD,0CAA0C;AAC1C,mBAAmB;AACnB,iCAAiC;AACjC,YAAY;AACZ,gEAAgE;AAChE,sBAAsB;AACtB,OAAO;AAEP,0BAA0B;AAC1B,uBAAuB;AACvB,iCAAiC;AACjC,sBAAsB;AACtB,wCAAwC;AACxC,wCAAwC;AACxC,8BAA8B;AAC9B,YAAY;AACZ,kDAAkD;AAClD,2CAA2C;AAE3C,8BAA8B;AAC9B,uEAAuE;AACvE,aAAa;AACb,+BAA+B;AAC/B,gEAAgE;AAChE,UAAU;AACV,uCAAuC;AACvC,4CAA4C;AAC5C,2EAA2E;AAC3E,cAAc;AAEd,qCAAqC;AACrC,uCAAuC;AACvC,uBAAuB;AACvB,8CAA8C;AAC9C,oEAAoE;AACpE,uCAAuC;AACvC,4CAA4C;AAC5C,2EAA2E;AAC3E,cAAc;AACd,kCAAkC;AAClC,SAAS;AACT,IAAI"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "typia",
3
- "version": "7.0.0-dev.20241126",
3
+ "version": "7.0.0-dev.20241126-2",
4
4
  "description": "Superfast runtime validators with only one line",
5
5
  "main": "lib/index.js",
6
6
  "typings": "lib/index.d.ts",
@@ -41,7 +41,7 @@
41
41
  },
42
42
  "homepage": "https://typia.io",
43
43
  "dependencies": {
44
- "@samchon/openapi": "^2.0.0-dev.20241126",
44
+ "@samchon/openapi": "2.0.0-dev.20241126",
45
45
  "commander": "^10.0.0",
46
46
  "comment-json": "^4.2.3",
47
47
  "inquirer": "^8.2.5",
@@ -49,7 +49,8 @@
49
49
  "randexp": "^0.5.3"
50
50
  },
51
51
  "peerDependencies": {
52
- "typescript": ">=4.8.0 <5.7.0"
52
+ "typescript": ">=4.8.0 <5.7.0",
53
+ "@samchon/openapi": ">=1.2.4 <2.0.0"
53
54
  },
54
55
  "devDependencies": {
55
56
  "@rollup/plugin-commonjs": "^26.0.1",
@@ -67,7 +68,7 @@
67
68
  "rollup": "^4.18.0",
68
69
  "suppress-warnings": "^1.0.2",
69
70
  "ts-node": "^10.9.2",
70
- "typescript": "^5.6.2"
71
+ "typescript": "~5.6.3"
71
72
  },
72
73
  "stackblitz": {
73
74
  "startCommand": "npm install && npm run test"
@@ -158,8 +158,13 @@ export namespace TypiaSetupWizard {
158
158
  "npm" | "pnpm" | "yarn" | "bun" | null
159
159
  > => {
160
160
  const result: DetectResult | null = await detect({ cwd: process.cwd() });
161
- if (result?.name === "npm" || result?.name === "deno") return null; // NPM case is still selectable
162
- return result?.name ?? null;
161
+ switch (result?.name) {
162
+ case "npm":
163
+ case "deno":
164
+ return null; // NPM case is still selectable & Deno is not supported
165
+ default:
166
+ return result?.name ?? null;
167
+ }
163
168
  };
164
169
 
165
170
  const getTypeScriptVersion = async (): Promise<string> => {
package/src/json.ts CHANGED
@@ -1,4 +1,3 @@
1
- import { IJsonApplication } from "./schemas/json/IJsonApplication";
2
1
  import { IJsonSchemaCollection } from "./schemas/json/IJsonSchemaCollection";
3
2
 
4
3
  import { IValidation } from "./IValidation";
@@ -15,55 +14,59 @@ import { TypeGuardError } from "./TypeGuardError";
15
14
  METADATA
16
15
  ----------------------------------------------------------- */
17
16
  /**
18
- * > You must configure the generic argument `App`.
17
+ * > You must configure the generic argument `Types`.
19
18
  *
20
- * TypeScript functions to JSON schema based application schema.
19
+ * JSON Schemas generator.
21
20
  *
22
- * Creates an application schema collecting the functions' schema based on the
23
- * JSON schema specification.
21
+ * Creates a JSON schema list which contains both main JSON schemas
22
+ * and components. Note that, all of the named types are stored in the
23
+ * {@link IJsonSchemaCollection.components} property for the `$ref` referencing.
24
24
  *
25
- * The default version of the OpenAPI specification is `"3.1"`, but you can
26
- * specify the version by configuring the second generic argument `Version`.
25
+ * Also, you can specify the OpenAPI version by configuring the second generic
26
+ * argument `Version`. For reference, the default version is `"3.1"`, and key
27
+ * different of `"3.0"` and `"3.1"` is whether supporting the tuple type or not.
27
28
  *
28
- * @template App Target class or interface type collecting the functions
29
+ * @template Types Tuple of target types
29
30
  * @template Version Version of OpenAPI specification. Default is 3.1
30
- * @returns Application schema of JSON schema based
31
+ * @return JSON schema list
31
32
  *
32
33
  * @author Jeongho Nam - https://github.com/samchon
33
34
  */
34
- export function application(): never;
35
+ export function schemas(): never;
35
36
 
36
37
  /**
37
- * TypeScript functions to JSON schema based application schema.
38
+ * JSON Schemas generator.
38
39
  *
39
- * Creates an application schema collecting the functions' schema based on the
40
- * JSON schema specification.
40
+ * Creates a JSON schema list which contains both main JSON schemas
41
+ * and components. Note that, all of the named types are stored in the
42
+ * {@link IJsonSchemaCollection.components} property for the `$ref` referencing.
41
43
  *
42
- * The default version of the OpenAPI specification is `"3.1"`, but you can
43
- * specify the version by configuring the second generic argument `Version`.
44
+ * Also, you can specify the OpenAPI version by configuring the second generic
45
+ * argument `Version`. For reference, the default version is `"3.1"`, and key
46
+ * different of `"3.0"` and `"3.1"` is whether supporting the tuple type or not.
44
47
  *
45
- * @template App Target class or interface type collecting the functions
48
+ * @template Types Tuple of target types
46
49
  * @template Version Version of OpenAPI specification. Default is 3.1
47
- * @returns Application schema of JSON schema based
50
+ * @return JSON schema list
48
51
  *
49
52
  * @author Jeongho Nam - https://github.com/samchon
50
53
  */
51
- export function application<
52
- App extends object,
54
+ export function schemas<
55
+ Types extends unknown[],
53
56
  Version extends "3.0" | "3.1" = "3.1",
54
- >(): IJsonApplication<Version, App>;
57
+ >(): IJsonSchemaCollection<Version, Types>;
55
58
 
56
59
  /**
57
60
  * @internal
58
61
  */
59
- export function application(): never {
60
- halt("application");
62
+ export function schemas(): never {
63
+ halt("schemas");
61
64
  }
62
65
 
63
66
  /**
64
67
  * > You must configure the generic argument `Types`.
65
68
  *
66
- * JSON Schema List.
69
+ * JSON Schemas generator.
67
70
  *
68
71
  * Creates a JSON schema list which contains both main JSON schemas
69
72
  * and components. Note that, all of the named types are stored in the
@@ -77,12 +80,15 @@ export function application(): never {
77
80
  * @template Version Version of OpenAPI specification. Default is 3.1
78
81
  * @return JSON schema list
79
82
  *
83
+ * @deprcated Use {@link schemas} function instead please.
84
+ * This function would be changed to return {@linkk ILlmApplication} like
85
+ * structure in the future version (maybe next v8 major update).
80
86
  * @author Jeongho Nam - https://github.com/samchon
81
87
  */
82
- export function schemas(): never;
88
+ export function application(): never;
83
89
 
84
90
  /**
85
- * JSON Schema Application.
91
+ * JSON Schemas generator.
86
92
  *
87
93
  * Creates a JSON schema list which contains both main JSON schemas
88
94
  * and components. Note that, all of the named types are stored in the
@@ -96,9 +102,12 @@ export function schemas(): never;
96
102
  * @template Version Version of OpenAPI specification. Default is 3.1
97
103
  * @return JSON schema list
98
104
  *
105
+ * @deprcated Use {@link schemas} function instead please.
106
+ * This function would be changed to return {@linkk ILlmApplication} like
107
+ * structure in the future version (maybe next v8 major update).
99
108
  * @author Jeongho Nam - https://github.com/samchon
100
109
  */
101
- export function schemas<
110
+ export function application<
102
111
  Types extends unknown[],
103
112
  Version extends "3.0" | "3.1" = "3.1",
104
113
  >(): IJsonSchemaCollection<Version, Types>;
@@ -106,10 +115,56 @@ export function schemas<
106
115
  /**
107
116
  * @internal
108
117
  */
109
- export function schemas(): never {
118
+ export function application(): never {
110
119
  halt("application");
111
120
  }
112
121
 
122
+ // /**
123
+ // * > You must configure the generic argument `App`.
124
+ // *
125
+ // * TypeScript functions to JSON schema based application schema.
126
+ // *
127
+ // * Creates an application schema collecting the functions' schema based on the
128
+ // * JSON schema specification.
129
+ // *
130
+ // * The default version of the OpenAPI specification is `"3.1"`, but you can
131
+ // * specify the version by configuring the second generic argument `Version`.
132
+ // *
133
+ // * @template App Target class or interface type collecting the functions
134
+ // * @template Version Version of OpenAPI specification. Default is 3.1
135
+ // * @returns Application schema of JSON schema based
136
+ // *
137
+ // * @author Jeongho Nam - https://github.com/samchon
138
+ // */
139
+ // export function application(): never;
140
+
141
+ // /**
142
+ // * TypeScript functions to JSON schema based application schema.
143
+ // *
144
+ // * Creates an application schema collecting the functions' schema based on the
145
+ // * JSON schema specification.
146
+ // *
147
+ // * The default version of the OpenAPI specification is `"3.1"`, but you can
148
+ // * specify the version by configuring the second generic argument `Version`.
149
+ // *
150
+ // * @template App Target class or interface type collecting the functions
151
+ // * @template Version Version of OpenAPI specification. Default is 3.1
152
+ // * @returns Application schema of JSON schema based
153
+ // *
154
+ // * @author Jeongho Nam - https://github.com/samchon
155
+ // */
156
+ // export function application<
157
+ // App extends object,
158
+ // Version extends "3.0" | "3.1" = "3.1",
159
+ // >(): IJsonApplication<Version, App>;
160
+
161
+ // /**
162
+ // * @internal
163
+ // */
164
+ // export function application(): never {
165
+ // halt("application");
166
+ // }
167
+
113
168
  /* -----------------------------------------------------------
114
169
  PARSE
115
170
  ----------------------------------------------------------- */
@@ -1,6 +1,6 @@
1
1
  import { MetadataFactory } from "../../factories/MetadataFactory";
2
2
 
3
- import { IJsonApplication } from "../../schemas/json/IJsonApplication";
3
+ import { __IJsonApplication } from "../../schemas/json/__IJsonApplication";
4
4
  import { IJsDocTagInfo } from "../../schemas/metadata/IJsDocTagInfo";
5
5
  import { Metadata } from "../../schemas/metadata/Metadata";
6
6
  import { MetadataFunction } from "../../schemas/metadata/MetadataFunction";
@@ -60,7 +60,7 @@ export namespace JsonApplicationProgrammer {
60
60
  export const write = <Version extends "3.0" | "3.1">(props: {
61
61
  version: Version;
62
62
  metadata: Metadata;
63
- }): IJsonApplication<Version> => {
63
+ }): __IJsonApplication<Version> => {
64
64
  const errors: string[] = validate(props.metadata, {
65
65
  top: true,
66
66
  object: null,
@@ -76,18 +76,18 @@ export namespace JsonApplicationProgrammer {
76
76
 
77
77
  const object: MetadataObjectType = props.metadata.objects[0]!.type;
78
78
  const definitions: Metadata[] = [];
79
- const setters: Array<(schema: IJsonApplication.Schema<Version>) => void> =
79
+ const setters: Array<(schema: __IJsonApplication.Schema<Version>) => void> =
80
80
  [];
81
81
  const collect = (
82
82
  metadata: Metadata,
83
- setter: (schema: IJsonApplication.Schema<Version>) => void,
83
+ setter: (schema: __IJsonApplication.Schema<Version>) => void,
84
84
  ): void => {
85
85
  definitions.push(metadata);
86
86
  setters.push(setter);
87
87
  };
88
88
 
89
- const functions: IJsonApplication.IFunction<
90
- IJsonApplication.Schema<Version>
89
+ const functions: __IJsonApplication.IFunction<
90
+ __IJsonApplication.Schema<Version>
91
91
  >[] = object.properties
92
92
  .filter(
93
93
  (p) =>
@@ -112,7 +112,7 @@ export namespace JsonApplicationProgrammer {
112
112
  metadatas: definitions,
113
113
  });
114
114
  schemas.forEach((s, i) =>
115
- setters[i]?.(s as IJsonApplication.Schema<Version>),
115
+ setters[i]?.(s as __IJsonApplication.Schema<Version>),
116
116
  );
117
117
  return {
118
118
  version: props.version,
@@ -129,9 +129,9 @@ export namespace JsonApplicationProgrammer {
129
129
  jsDocTags: IJsDocTagInfo[];
130
130
  collect: (
131
131
  metadata: Metadata,
132
- setter: (schema: IJsonApplication.Schema<Version>) => void,
132
+ setter: (schema: __IJsonApplication.Schema<Version>) => void,
133
133
  ) => void;
134
- }): IJsonApplication.IFunction<IJsonApplication.Schema<Version>> => {
134
+ }): __IJsonApplication.IFunction<__IJsonApplication.Schema<Version>> => {
135
135
  const deprecated: boolean = props.jsDocTags.some(
136
136
  (tag) => tag.name === "deprecated",
137
137
  );
@@ -149,8 +149,8 @@ export namespace JsonApplicationProgrammer {
149
149
  name: props.name,
150
150
  async: props.function.async,
151
151
  parameters: props.function.parameters.map((param) => {
152
- const appParam: IJsonApplication.IParameter<
153
- IJsonApplication.Schema<Version>
152
+ const appParam: __IJsonApplication.IParameter<
153
+ __IJsonApplication.Schema<Version>
154
154
  > = {
155
155
  name: param.name,
156
156
  ...writeDescription({
@@ -178,8 +178,8 @@ export namespace JsonApplicationProgrammer {
178
178
  }),
179
179
  output: props.function.output.size()
180
180
  ? (() => {
181
- const appOutput: IJsonApplication.IOutput<
182
- IJsonApplication.Schema<Version>
181
+ const appOutput: __IJsonApplication.IOutput<
182
+ __IJsonApplication.Schema<Version>
183
183
  > = {
184
184
  schema: null!,
185
185
  required: props.function.output.isRequired(),
@@ -4,11 +4,11 @@ import { ILlmFunction } from "@samchon/openapi/lib/structures/ILlmFunction";
4
4
 
5
5
  import { MetadataFactory } from "../../factories/MetadataFactory";
6
6
 
7
+ import { __IJsonApplication } from "../../schemas/json/__IJsonApplication";
7
8
  import { Metadata } from "../../schemas/metadata/Metadata";
8
9
  import { MetadataFunction } from "../../schemas/metadata/MetadataFunction";
9
10
  import { MetadataObjectType } from "../../schemas/metadata/MetadataObjectType";
10
11
 
11
- import { IJsonApplication } from "../../module";
12
12
  import { JsonApplicationProgrammer } from "../json/JsonApplicationProgrammer";
13
13
  import { LlmSchemaProgrammer } from "./LlmSchemaProgrammer";
14
14
 
@@ -103,7 +103,7 @@ export namespace LlmApplicationProgrammer {
103
103
  if (errors.length)
104
104
  throw new Error("Failed to write LLM application: " + errors.join("\n"));
105
105
 
106
- const application: IJsonApplication<"3.1"> =
106
+ const application: __IJsonApplication<"3.1"> =
107
107
  JsonApplicationProgrammer.write({
108
108
  version: "3.1",
109
109
  metadata: props.metadata,
@@ -127,7 +127,7 @@ export namespace LlmApplicationProgrammer {
127
127
  const writeFunction = <Model extends ILlmApplication.Model>(props: {
128
128
  model: Model;
129
129
  components: OpenApi.IComponents;
130
- function: IJsonApplication.IFunction<OpenApi.IJsonSchema>;
130
+ function: __IJsonApplication.IFunction<OpenApi.IJsonSchema>;
131
131
  }): ILlmFunction<ILlmApplication.ModelParameters[Model]> => {
132
132
  const parameters: ILlmApplication.ModelParameters[Model] =
133
133
  writeParameters(props);
@@ -171,7 +171,7 @@ export namespace LlmApplicationProgrammer {
171
171
  const writeParameters = <Model extends ILlmApplication.Model>(props: {
172
172
  model: Model;
173
173
  components: OpenApi.IComponents;
174
- function: IJsonApplication.IFunction<OpenApi.IJsonSchema>;
174
+ function: __IJsonApplication.IFunction<OpenApi.IJsonSchema>;
175
175
  }): ILlmApplication.ModelParameters[Model] => {
176
176
  const schema: OpenApi.IJsonSchema.IObject = {
177
177
  type: "object",