typia 7.6.0-dev.20241229 → 7.7.0-dev.20250130

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 (113) hide show
  1. package/lib/TypeGuardError.mjs +26 -0
  2. package/lib/TypeGuardError.mjs.map +1 -0
  3. package/lib/executable/setup/PluginConfigurator.js +3 -3
  4. package/lib/executable/typia.js +15 -15
  5. package/lib/functional.mjs +120 -0
  6. package/lib/functional.mjs.map +1 -0
  7. package/lib/http.d.ts +15 -15
  8. package/lib/http.mjs +165 -0
  9. package/lib/http.mjs.map +1 -0
  10. package/lib/index.mjs +27 -1142
  11. package/lib/index.mjs.map +1 -1
  12. package/lib/json.mjs +105 -0
  13. package/lib/json.mjs.map +1 -0
  14. package/lib/llm.mjs +33 -0
  15. package/lib/llm.mjs.map +1 -0
  16. package/lib/misc.mjs +111 -0
  17. package/lib/misc.mjs.map +1 -0
  18. package/lib/module.d.ts +4 -4
  19. package/lib/module.mjs +139 -0
  20. package/lib/module.mjs.map +1 -0
  21. package/lib/notations.mjs +153 -0
  22. package/lib/notations.mjs.map +1 -0
  23. package/lib/programmers/json/JsonApplicationProgrammer.d.ts +12 -0
  24. package/lib/programmers/json/JsonApplicationProgrammer.js +22 -22
  25. package/lib/programmers/json/JsonApplicationProgrammer.js.map +1 -1
  26. package/lib/programmers/llm/LlmApplicationOfValidateProgrammer.js +15 -7
  27. package/lib/programmers/llm/LlmApplicationOfValidateProgrammer.js.map +1 -1
  28. package/lib/programmers/llm/LlmApplicationProgrammer.js +39 -15
  29. package/lib/programmers/llm/LlmApplicationProgrammer.js.map +1 -1
  30. package/lib/protobuf.d.ts +9 -9
  31. package/lib/protobuf.mjs +111 -0
  32. package/lib/protobuf.mjs.map +1 -0
  33. package/lib/reflect.mjs +18 -0
  34. package/lib/reflect.mjs.map +1 -0
  35. package/lib/schemas/llm/ILlmApplicationOfValidate.mjs +6 -0
  36. package/lib/schemas/llm/ILlmApplicationOfValidate.mjs.map +1 -0
  37. package/lib/schemas/llm/ILlmFunctionOfValidate.mjs +6 -0
  38. package/lib/schemas/llm/ILlmFunctionOfValidate.mjs.map +1 -0
  39. package/lib/tags/TagBase.d.ts +1 -1
  40. package/lib/tags/Type.d.ts +0 -1
  41. package/lib/tags/index.mjs +2 -0
  42. package/lib/tags/index.mjs.map +1 -0
  43. package/package.json +10 -8
  44. package/src/AssertionGuard.ts +1 -1
  45. package/src/CamelCase.ts +75 -75
  46. package/src/PascalCase.ts +71 -71
  47. package/src/Primitive.ts +92 -92
  48. package/src/Resolved.ts +74 -74
  49. package/src/SnakeCase.ts +126 -126
  50. package/src/TypeGuardError.ts +37 -37
  51. package/src/executable/setup/CommandExecutor.ts +8 -8
  52. package/src/executable/setup/PluginConfigurator.ts +69 -69
  53. package/src/executable/typia.ts +55 -55
  54. package/src/factories/CommentFactory.ts +79 -79
  55. package/src/factories/ValueFactory.ts +12 -12
  56. package/src/factories/internal/metadata/emend_metadata_atomics.ts +45 -45
  57. package/src/http.ts +15 -15
  58. package/src/index.ts +4 -4
  59. package/src/module.ts +4 -4
  60. package/src/programmers/helpers/ICheckEntry.ts +13 -13
  61. package/src/programmers/helpers/IExpressionEntry.ts +12 -12
  62. package/src/programmers/helpers/ProtobufWire.ts +34 -34
  63. package/src/programmers/internal/stringify_native.ts +7 -7
  64. package/src/programmers/json/JsonApplicationProgrammer.ts +27 -27
  65. package/src/programmers/llm/LlmApplicationOfValidateProgrammer.ts +16 -2
  66. package/src/programmers/llm/LlmApplicationProgrammer.ts +50 -12
  67. package/src/protobuf.ts +9 -9
  68. package/src/schemas/metadata/IJsDocTagInfo.ts +10 -10
  69. package/src/schemas/metadata/IMetadataArrayType.ts +10 -10
  70. package/src/schemas/metadata/IMetadataAtomic.ts +6 -6
  71. package/src/schemas/metadata/IMetadataConstant.ts +18 -18
  72. package/src/schemas/metadata/IMetadataEscaped.ts +6 -6
  73. package/src/schemas/metadata/IMetadataFunction.ts +8 -8
  74. package/src/schemas/metadata/IMetadataParameter.ts +9 -9
  75. package/src/schemas/metadata/IMetadataProperty.ts +9 -9
  76. package/src/schemas/metadata/IMetadataTupleType.ts +10 -10
  77. package/src/schemas/metadata/MetadataArrayType.ts +57 -57
  78. package/src/schemas/metadata/MetadataConstant.ts +34 -34
  79. package/src/schemas/metadata/MetadataEscaped.ts +51 -51
  80. package/src/schemas/metadata/MetadataFunction.ts +49 -49
  81. package/src/schemas/metadata/MetadataTupleType.ts +67 -67
  82. package/src/tags/Constant.ts +15 -15
  83. package/src/tags/ContentMediaType.ts +10 -10
  84. package/src/tags/Default.ts +22 -22
  85. package/src/tags/ExclusiveMaximum.ts +25 -25
  86. package/src/tags/ExclusiveMinimum.ts +25 -25
  87. package/src/tags/MaxItems.ts +12 -12
  88. package/src/tags/MaxLength.ts +12 -12
  89. package/src/tags/Maximum.ts +19 -19
  90. package/src/tags/MinItems.ts +12 -12
  91. package/src/tags/MinLength.ts +12 -12
  92. package/src/tags/Minimum.ts +19 -19
  93. package/src/tags/MultipleOf.ts +21 -21
  94. package/src/tags/Pattern.ts +31 -31
  95. package/src/tags/TagBase.ts +1 -1
  96. package/src/tags/Type.ts +0 -1
  97. package/src/tags/internal/FormatCheatSheet.ts +73 -73
  98. package/src/typings/Atomic.ts +13 -13
  99. package/src/typings/ClassProperties.ts +5 -5
  100. package/src/typings/Customizable.ts +5 -5
  101. package/src/typings/Equal.ts +18 -18
  102. package/src/typings/IsTuple.ts +9 -9
  103. package/src/typings/NativeClass.ts +23 -23
  104. package/src/typings/OmitNever.ts +3 -3
  105. package/src/typings/ProtobufAtomic.ts +19 -19
  106. package/src/typings/SpecialFields.ts +3 -3
  107. package/src/typings/ValidationPipe.ts +9 -9
  108. package/src/typings/ValueOf.ts +20 -20
  109. package/src/typings/Writable.ts +11 -11
  110. package/src/utils/ArrayUtil.ts +41 -41
  111. package/src/utils/Escaper.ts +50 -50
  112. package/src/utils/PatternUtil.ts +29 -29
  113. package/src/utils/Singleton.ts +16 -16
@@ -1,6 +1,8 @@
1
1
  import { ILlmApplication, ILlmSchema } from "@samchon/openapi";
2
2
  import ts from "typescript";
3
3
 
4
+ import { TypeFactory } from "../../factories/TypeFactory";
5
+
4
6
  import { ILlmApplicationOfValidate } from "../../schemas/llm/ILlmApplicationOfValidate";
5
7
  import { Metadata } from "../../schemas/metadata/Metadata";
6
8
  import { MetadataParameter } from "../../schemas/metadata/MetadataParameter";
@@ -55,7 +57,7 @@ export namespace LlmApplicationOfValidateProgrammer {
55
57
  modulo: props.modulo,
56
58
  className: props.name,
57
59
  name: func.name,
58
- parameter: parameters[func.name]!,
60
+ parameter: parameters[func.name] ?? null,
59
61
  }),
60
62
  })),
61
63
  };
@@ -64,10 +66,22 @@ export namespace LlmApplicationOfValidateProgrammer {
64
66
  const writeValidadtor = (props: {
65
67
  context: ITypiaContext;
66
68
  modulo: ts.LeftHandSideExpression;
67
- parameter: MetadataParameter;
69
+ parameter: MetadataParameter | null;
68
70
  name: string;
69
71
  className?: string;
70
72
  }): ((props: object) => IValidation<unknown>) => {
73
+ if (props.parameter === null)
74
+ return ValidateProgrammer.write({
75
+ ...props,
76
+ type: props.context.checker.getTypeFromTypeNode(
77
+ TypeFactory.keyword("any"),
78
+ ),
79
+ config: {
80
+ equals: false,
81
+ },
82
+ name: undefined,
83
+ }) as any;
84
+
71
85
  const type = props.parameter.tsType;
72
86
  if (type === undefined)
73
87
  // unreachable
@@ -42,12 +42,12 @@ export namespace LlmApplicationProgrammer {
42
42
  else return LlmSchemaProgrammer.validate(props)(metadata);
43
43
 
44
44
  const output: string[] = [];
45
- const valid: boolean =
45
+ const validity: boolean =
46
46
  metadata.size() === 1 &&
47
47
  metadata.objects.length === 1 &&
48
48
  metadata.isRequired() === true &&
49
49
  metadata.nullable === false;
50
- if (valid === false)
50
+ if (validity === false)
51
51
  output.push(
52
52
  "LLM application's generic arugment must be a class/interface type.",
53
53
  );
@@ -60,23 +60,40 @@ export namespace LlmApplicationProgrammer {
60
60
  );
61
61
  let least: boolean = false;
62
62
  for (const p of object.properties) {
63
+ const name: string = JSON.stringify(p.key.getSoleLiteral()!);
63
64
  const value: Metadata = p.value;
64
65
  if (value.functions.length) {
65
66
  least ||= true;
66
- if (valid === false) {
67
+ if (validity === false) {
67
68
  if (value.functions.length !== 1 || value.size() !== 1)
68
69
  output.push(
69
- "LLM application's function type does not allow union type.",
70
+ `LLM application's function (${name}) type does not allow union type.`,
70
71
  );
71
72
  if (value.isRequired() === false)
72
73
  output.push(
73
- "LLM application's function type must be required.",
74
+ `LLM application's function (${name}) type must be required.`,
74
75
  );
75
76
  if (value.nullable === true)
76
77
  output.push(
77
- "LLM application's function type must not be nullable.",
78
+ `LLM application's function (${name}) type must not be nullable.`,
78
79
  );
79
80
  }
81
+
82
+ const description: string | undefined = concatDescription(
83
+ JsonApplicationProgrammer.writeDescription({
84
+ description:
85
+ p.description ??
86
+ p.jsDocTags.find((tag) => tag.name === "description")
87
+ ?.text?.[0]?.text ??
88
+ null,
89
+ jsDocTags: p.jsDocTags,
90
+ kind: "summary",
91
+ }),
92
+ );
93
+ if (description !== undefined && description.length > 1_024)
94
+ output.push(
95
+ `LLM application's function (${name}) description must not exceed 1,024 characters.`,
96
+ );
80
97
  }
81
98
  }
82
99
  if (least === false)
@@ -96,10 +113,14 @@ export namespace LlmApplicationProgrammer {
96
113
  `${prefix}'s return type must not be union type with undefined.`,
97
114
  );
98
115
  if (/^[0-9]/.test(name[0] ?? "") === true)
99
- output.push(`name must not start with a number.`);
116
+ output.push(`${prefix} name must not start with a number.`);
100
117
  if (/^[a-zA-Z0-9_-]+$/.test(name) === false)
101
- output.push(`name must be alphanumeric with underscore or hypen.`);
102
- if (func.parameters.length !== 1)
118
+ output.push(
119
+ `${prefix} name must be alphanumeric with underscore or hypen.`,
120
+ );
121
+ if (name.length > 64)
122
+ output.push(`${prefix} name must not exceed 64 characters.`);
123
+ if (func.parameters.length !== 0 && func.parameters.length !== 1)
103
124
  output.push(`${prefix} must have a single parameter.`);
104
125
  if (func.parameters.length !== 0) {
105
126
  const type: Metadata = func.parameters[0]!.type;
@@ -233,9 +254,12 @@ export namespace LlmApplicationProgrammer {
233
254
  errors: string[];
234
255
  accessor: string;
235
256
  }): ILlmSchema.ModelParameters[Model] | null => {
236
- const schema = props.function.parameters[0]?.schema;
237
- if (!schema) return null;
238
-
257
+ const schema = props.function.parameters[0]?.schema ?? {
258
+ type: "object",
259
+ properties: {},
260
+ additionalProperties: false,
261
+ required: [],
262
+ };
239
263
  const result: IResult<
240
264
  ILlmSchema.ModelParameters[Model],
241
265
  IOpenApiSchemaError
@@ -286,4 +310,18 @@ export namespace LlmApplicationProgrammer {
286
310
  }
287
311
  return result.value;
288
312
  };
313
+
314
+ const concatDescription = (p: {
315
+ summary?: string | undefined;
316
+ description?: string | undefined;
317
+ }): string | undefined => {
318
+ if (!p.summary?.length || !p.description?.length)
319
+ return p.summary ?? p.description;
320
+ const summary: string = p.summary.endsWith(".")
321
+ ? p.summary.slice(0, -1)
322
+ : p.summary;
323
+ return p.description.startsWith(summary)
324
+ ? p.description
325
+ : summary + ".\n\n" + p.description;
326
+ };
289
327
  }
package/src/protobuf.ts CHANGED
@@ -73,7 +73,7 @@ export function message(): never {
73
73
  *
74
74
  * For reference, as Protocol Buffer handles binary data directly, there's no way
75
75
  * when `input` binary data was not encoded from the `T` typed value. In that case,
76
- * unexpected behavior or internal error would be occured. Therefore, I recommend you
76
+ * unexpected behavior or internal error would be occurred. Therefore, I recommend you
77
77
  * to encode binary data of Protocol Buffer from type safe encode functions like below.
78
78
  * Use {@link encode} function only when you can ensure it.
79
79
  *
@@ -103,7 +103,7 @@ export function decode(input: Uint8Array): never;
103
103
  *
104
104
  * For reference, as Protocol Buffer handles binary data directly, there's no way
105
105
  * when `input` binary data was not encoded from the `T` typed value. In that case,
106
- * unexpected behavior or internal error would be occured. Therefore, I recommend you
106
+ * unexpected behavior or internal error would be occurred. Therefore, I recommend you
107
107
  * to encode binary data of Protocol Buffer from type safe encode functions like below.
108
108
  * Use {@link encode} function only when you can ensure it.
109
109
  *
@@ -354,7 +354,7 @@ export function validateDecode(): never {
354
354
  * For reference, this `typia.protobuf.encode()` does not validate the `input` value.
355
355
  * It just believes that the `input` value is valid and converts it to a binary data
356
356
  * directly. Therefore, if you can't ensure the `input` value type, it would better to
357
- * call one of below functions intead.
357
+ * call one of below functions instead.
358
358
  *
359
359
  * - {@link assertEncode}
360
360
  * - {@link isEncode}
@@ -394,7 +394,7 @@ export function encode(): never {
394
394
  * Protocol Buffer binary data would be returned.
395
395
  *
396
396
  * If you can trust `input` value, or want to perform other type of validation, use
397
- * below functions intead.
397
+ * below functions instead.
398
398
  *
399
399
  * - {@link encode}
400
400
  * - {@link isEncode}
@@ -431,7 +431,7 @@ export function assertEncode<T>(
431
431
  * Protocol Buffer binary data would be returned.
432
432
  *
433
433
  * If you can trust `input` value, or want to perform other type of validation, use
434
- * below functions intead.
434
+ * below functions instead.
435
435
  *
436
436
  * - {@link encode}
437
437
  * - {@link isEncode}
@@ -475,7 +475,7 @@ export function assertEncode(): never {
475
475
  * Buffer binary data would be returned.
476
476
  *
477
477
  * If you can trust `input` value, or want to perform other type of validation, use
478
- * below functions intead.
478
+ * below functions instead.
479
479
  *
480
480
  * - {@link encode}
481
481
  * - {@link assertEncode}
@@ -508,7 +508,7 @@ export function isEncode<T>(input: T): Uint8Array | null;
508
508
  * Buffer binary data would be returned.
509
509
  *
510
510
  * If you can trust `input` value, or want to perform other type of validation, use
511
- * below functions intead.
511
+ * below functions instead.
512
512
  *
513
513
  * - {@link encode}
514
514
  * - {@link assertEncode}
@@ -549,7 +549,7 @@ export function isEncode(): never {
549
549
  * `data` property of the output {@link IValidation.ISuccess} instance.
550
550
  *
551
551
  * If you can trust `input` value, or want to perform other type of validation, use
552
- * below functions intead.
552
+ * below functions instead.
553
553
  *
554
554
  * - {@link encode}
555
555
  * - {@link assertEncode}
@@ -583,7 +583,7 @@ export function validateEncode<T>(input: T): IValidation<Uint8Array>;
583
583
  * `data` property of the output {@link IValidation.ISuccess} instance.
584
584
  *
585
585
  * If you can trust `input` value, or want to perform other type of validation, use
586
- * below functions intead.
586
+ * below functions instead.
587
587
  *
588
588
  * - {@link encode}
589
589
  * - {@link assertEncode}
@@ -1,10 +1,10 @@
1
- export interface IJsDocTagInfo {
2
- name: string;
3
- text?: IJsDocTagInfo.IText[];
4
- }
5
- export namespace IJsDocTagInfo {
6
- export interface IText {
7
- text: string;
8
- kind: string;
9
- }
10
- }
1
+ export interface IJsDocTagInfo {
2
+ name: string;
3
+ text?: IJsDocTagInfo.IText[];
4
+ }
5
+ export namespace IJsDocTagInfo {
6
+ export interface IText {
7
+ text: string;
8
+ kind: string;
9
+ }
10
+ }
@@ -1,10 +1,10 @@
1
- import { IMetadata } from "./IMetadata";
2
-
3
- export interface IMetadataArrayType {
4
- name: string;
5
- value: IMetadata;
6
-
7
- nullables: boolean[];
8
- recursive: boolean;
9
- index: number | null;
10
- }
1
+ import { IMetadata } from "./IMetadata";
2
+
3
+ export interface IMetadataArrayType {
4
+ name: string;
5
+ value: IMetadata;
6
+
7
+ nullables: boolean[];
8
+ recursive: boolean;
9
+ index: number | null;
10
+ }
@@ -1,6 +1,6 @@
1
- import { IMetadataTypeTag } from "./IMetadataTypeTag";
2
-
3
- export interface IMetadataAtomic {
4
- type: "boolean" | "bigint" | "number" | "string";
5
- tags: IMetadataTypeTag[][];
6
- }
1
+ import { IMetadataTypeTag } from "./IMetadataTypeTag";
2
+
3
+ export interface IMetadataAtomic {
4
+ type: "boolean" | "bigint" | "number" | "string";
5
+ tags: IMetadataTypeTag[][];
6
+ }
@@ -1,18 +1,18 @@
1
- import { Atomic } from "../../typings/Atomic";
2
-
3
- import { IMetadataConstantValue } from "./IMetadataConstantValue";
4
-
5
- export type IMetadataConstant =
6
- | IMetadataConstant.IBase<"boolean", boolean>
7
- | IMetadataConstant.IBase<"number", number>
8
- | IMetadataConstant.IBase<"string", string>
9
- | IMetadataConstant.IBase<"bigint", string>;
10
- export namespace IMetadataConstant {
11
- export interface IBase<
12
- Type extends Atomic.Literal,
13
- Value extends Atomic.Type,
14
- > {
15
- type: Type;
16
- values: IMetadataConstantValue<Value>[];
17
- }
18
- }
1
+ import { Atomic } from "../../typings/Atomic";
2
+
3
+ import { IMetadataConstantValue } from "./IMetadataConstantValue";
4
+
5
+ export type IMetadataConstant =
6
+ | IMetadataConstant.IBase<"boolean", boolean>
7
+ | IMetadataConstant.IBase<"number", number>
8
+ | IMetadataConstant.IBase<"string", string>
9
+ | IMetadataConstant.IBase<"bigint", string>;
10
+ export namespace IMetadataConstant {
11
+ export interface IBase<
12
+ Type extends Atomic.Literal,
13
+ Value extends Atomic.Type,
14
+ > {
15
+ type: Type;
16
+ values: IMetadataConstantValue<Value>[];
17
+ }
18
+ }
@@ -1,6 +1,6 @@
1
- import { IMetadata } from "./IMetadata";
2
-
3
- export interface IMetadataEscaped {
4
- original: IMetadata;
5
- returns: IMetadata;
6
- }
1
+ import { IMetadata } from "./IMetadata";
2
+
3
+ export interface IMetadataEscaped {
4
+ original: IMetadata;
5
+ returns: IMetadata;
6
+ }
@@ -1,8 +1,8 @@
1
- import { IMetadata } from "./IMetadata";
2
- import { IMetadataParameter } from "./IMetadataParameter";
3
-
4
- export interface IMetadataFunction {
5
- parameters: IMetadataParameter[];
6
- output: IMetadata;
7
- async: boolean;
8
- }
1
+ import { IMetadata } from "./IMetadata";
2
+ import { IMetadataParameter } from "./IMetadataParameter";
3
+
4
+ export interface IMetadataFunction {
5
+ parameters: IMetadataParameter[];
6
+ output: IMetadata;
7
+ async: boolean;
8
+ }
@@ -1,9 +1,9 @@
1
- import { IJsDocTagInfo } from "./IJsDocTagInfo";
2
- import { IMetadata } from "./IMetadata";
3
-
4
- export interface IMetadataParameter {
5
- name: string;
6
- type: IMetadata;
7
- description: string | null;
8
- jsDocTags: IJsDocTagInfo[];
9
- }
1
+ import { IJsDocTagInfo } from "./IJsDocTagInfo";
2
+ import { IMetadata } from "./IMetadata";
3
+
4
+ export interface IMetadataParameter {
5
+ name: string;
6
+ type: IMetadata;
7
+ description: string | null;
8
+ jsDocTags: IJsDocTagInfo[];
9
+ }
@@ -1,9 +1,9 @@
1
- import { IJsDocTagInfo } from "./IJsDocTagInfo";
2
- import { IMetadata } from "./IMetadata";
3
-
4
- export interface IMetadataProperty {
5
- key: IMetadata;
6
- value: IMetadata;
7
- description: string | null;
8
- jsDocTags: IJsDocTagInfo[];
9
- }
1
+ import { IJsDocTagInfo } from "./IJsDocTagInfo";
2
+ import { IMetadata } from "./IMetadata";
3
+
4
+ export interface IMetadataProperty {
5
+ key: IMetadata;
6
+ value: IMetadata;
7
+ description: string | null;
8
+ jsDocTags: IJsDocTagInfo[];
9
+ }
@@ -1,10 +1,10 @@
1
- import { IMetadata } from "./IMetadata";
2
-
3
- export interface IMetadataTupleType {
4
- name: string;
5
- elements: IMetadata[];
6
-
7
- index: number | null;
8
- recursive: boolean;
9
- nullables: boolean[];
10
- }
1
+ import { IMetadata } from "./IMetadata";
2
+
3
+ export interface IMetadataTupleType {
4
+ name: string;
5
+ elements: IMetadata[];
6
+
7
+ index: number | null;
8
+ recursive: boolean;
9
+ nullables: boolean[];
10
+ }
@@ -1,57 +1,57 @@
1
- import { ClassProperties } from "../../typings/ClassProperties";
2
-
3
- import { IMetadataArrayType } from "./IMetadataArrayType";
4
- import { Metadata } from "./Metadata";
5
-
6
- export class MetadataArrayType {
7
- public readonly name: string;
8
- public readonly value: Metadata;
9
- public readonly nullables: boolean[];
10
- public readonly recursive: boolean;
11
- public readonly index: number | null;
12
-
13
- /**
14
- * @hidden
15
- */
16
- private constructor(props: ClassProperties<MetadataArrayType>) {
17
- this.name = props.name;
18
- this.value = props.value;
19
- this.index = props.index;
20
- this.recursive = props.recursive;
21
- this.nullables = props.nullables;
22
- }
23
-
24
- /**
25
- * @internal
26
- */
27
- public static _From_without_value(
28
- props: Omit<IMetadataArrayType, "value">,
29
- ): MetadataArrayType {
30
- return MetadataArrayType.create({
31
- name: props.name,
32
- value: null!,
33
- index: props.index,
34
- recursive: props.recursive,
35
- nullables: props.nullables,
36
- });
37
- }
38
-
39
- /**
40
- * @internal
41
- */
42
- public static create(
43
- props: ClassProperties<MetadataArrayType>,
44
- ): MetadataArrayType {
45
- return new MetadataArrayType(props);
46
- }
47
-
48
- public toJSON(): IMetadataArrayType {
49
- return {
50
- name: this.name,
51
- value: this.value.toJSON(),
52
- nullables: this.nullables,
53
- recursive: this.recursive,
54
- index: this.index,
55
- };
56
- }
57
- }
1
+ import { ClassProperties } from "../../typings/ClassProperties";
2
+
3
+ import { IMetadataArrayType } from "./IMetadataArrayType";
4
+ import { Metadata } from "./Metadata";
5
+
6
+ export class MetadataArrayType {
7
+ public readonly name: string;
8
+ public readonly value: Metadata;
9
+ public readonly nullables: boolean[];
10
+ public readonly recursive: boolean;
11
+ public readonly index: number | null;
12
+
13
+ /**
14
+ * @hidden
15
+ */
16
+ private constructor(props: ClassProperties<MetadataArrayType>) {
17
+ this.name = props.name;
18
+ this.value = props.value;
19
+ this.index = props.index;
20
+ this.recursive = props.recursive;
21
+ this.nullables = props.nullables;
22
+ }
23
+
24
+ /**
25
+ * @internal
26
+ */
27
+ public static _From_without_value(
28
+ props: Omit<IMetadataArrayType, "value">,
29
+ ): MetadataArrayType {
30
+ return MetadataArrayType.create({
31
+ name: props.name,
32
+ value: null!,
33
+ index: props.index,
34
+ recursive: props.recursive,
35
+ nullables: props.nullables,
36
+ });
37
+ }
38
+
39
+ /**
40
+ * @internal
41
+ */
42
+ public static create(
43
+ props: ClassProperties<MetadataArrayType>,
44
+ ): MetadataArrayType {
45
+ return new MetadataArrayType(props);
46
+ }
47
+
48
+ public toJSON(): IMetadataArrayType {
49
+ return {
50
+ name: this.name,
51
+ value: this.value.toJSON(),
52
+ nullables: this.nullables,
53
+ recursive: this.recursive,
54
+ index: this.index,
55
+ };
56
+ }
57
+ }
@@ -1,34 +1,34 @@
1
- import { ClassProperties } from "../../typings/ClassProperties";
2
-
3
- import { IMetadataConstant } from "./IMetadataConstant";
4
- import { MetadataConstantValue } from "./MetadataConstantValue";
5
-
6
- export class MetadataConstant {
7
- public readonly type: "boolean" | "bigint" | "number" | "string";
8
- public readonly values: MetadataConstantValue[];
9
-
10
- private constructor(props: ClassProperties<MetadataConstant>) {
11
- this.type = props.type;
12
- this.values = props.values.map(MetadataConstantValue.create);
13
- }
14
-
15
- public static create(
16
- props: ClassProperties<MetadataConstant>,
17
- ): MetadataConstant {
18
- return new MetadataConstant(props);
19
- }
20
-
21
- public static from(json: IMetadataConstant): MetadataConstant {
22
- return MetadataConstant.create({
23
- type: json.type,
24
- values: json.values.map(MetadataConstantValue.from),
25
- });
26
- }
27
-
28
- public toJSON(): IMetadataConstant {
29
- return {
30
- type: this.type,
31
- values: this.values.map((value) => value.toJSON()),
32
- };
33
- }
34
- }
1
+ import { ClassProperties } from "../../typings/ClassProperties";
2
+
3
+ import { IMetadataConstant } from "./IMetadataConstant";
4
+ import { MetadataConstantValue } from "./MetadataConstantValue";
5
+
6
+ export class MetadataConstant {
7
+ public readonly type: "boolean" | "bigint" | "number" | "string";
8
+ public readonly values: MetadataConstantValue[];
9
+
10
+ private constructor(props: ClassProperties<MetadataConstant>) {
11
+ this.type = props.type;
12
+ this.values = props.values.map(MetadataConstantValue.create);
13
+ }
14
+
15
+ public static create(
16
+ props: ClassProperties<MetadataConstant>,
17
+ ): MetadataConstant {
18
+ return new MetadataConstant(props);
19
+ }
20
+
21
+ public static from(json: IMetadataConstant): MetadataConstant {
22
+ return MetadataConstant.create({
23
+ type: json.type,
24
+ values: json.values.map(MetadataConstantValue.from),
25
+ });
26
+ }
27
+
28
+ public toJSON(): IMetadataConstant {
29
+ return {
30
+ type: this.type,
31
+ values: this.values.map((value) => value.toJSON()),
32
+ };
33
+ }
34
+ }