typia 9.7.2 → 10.0.0-dev.20251107

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 (116) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +153 -153
  3. package/lib/factories/ProtobufFactory.js +1 -1
  4. package/lib/factories/ProtobufFactory.mjs +1 -1
  5. package/lib/programmers/internal/json_schema_station.d.mts +2 -2
  6. package/lib/programmers/internal/json_schema_station.d.ts +2 -2
  7. package/lib/programmers/llm/LlmApplicationProgrammer.js +5 -1
  8. package/lib/programmers/llm/LlmApplicationProgrammer.js.map +1 -1
  9. package/lib/programmers/llm/LlmApplicationProgrammer.mjs +5 -1
  10. package/lib/programmers/llm/LlmSchemaProgrammer.js +1 -4
  11. package/lib/programmers/llm/LlmSchemaProgrammer.js.map +1 -1
  12. package/lib/programmers/llm/LlmSchemaProgrammer.mjs +1 -35
  13. package/package.json +121 -121
  14. package/src/AssertionGuard.ts +41 -41
  15. package/src/CamelCase.ts +75 -75
  16. package/src/IRandomGenerator.ts +337 -337
  17. package/src/IReadableURLSearchParams.ts +9 -9
  18. package/src/PascalCase.ts +71 -71
  19. package/src/Primitive.ts +90 -90
  20. package/src/Resolved.ts +72 -72
  21. package/src/SnakeCase.ts +127 -127
  22. package/src/TypeGuardError.ts +216 -216
  23. package/src/factories/MetadataCollection.ts +270 -270
  24. package/src/factories/MetadataCommentTagFactory.ts +632 -632
  25. package/src/factories/MetadataFactory.ts +402 -402
  26. package/src/factories/ProtobufFactory.ts +873 -873
  27. package/src/functional.ts +705 -705
  28. package/src/http.ts +972 -972
  29. package/src/internal/_ProtobufReader.ts +188 -188
  30. package/src/internal/_ProtobufSizer.ts +137 -137
  31. package/src/internal/_ProtobufWriter.ts +135 -135
  32. package/src/internal/_jsonStringifyString.ts +42 -42
  33. package/src/json.ts +643 -643
  34. package/src/llm.ts +615 -615
  35. package/src/misc.ts +594 -594
  36. package/src/module.ts +889 -889
  37. package/src/notations.ts +751 -751
  38. package/src/programmers/FeatureProgrammer.ts +605 -605
  39. package/src/programmers/ImportProgrammer.ts +179 -179
  40. package/src/programmers/RandomProgrammer.ts +1195 -1195
  41. package/src/programmers/helpers/ProtobufWire.ts +34 -34
  42. package/src/programmers/internal/check_array_length.ts +43 -43
  43. package/src/programmers/internal/check_bigint.ts +46 -46
  44. package/src/programmers/internal/check_dynamic_key.ts +197 -197
  45. package/src/programmers/internal/check_dynamic_properties.ts +231 -231
  46. package/src/programmers/internal/check_everything.ts +21 -21
  47. package/src/programmers/internal/check_native.ts +23 -23
  48. package/src/programmers/internal/check_number.ts +108 -108
  49. package/src/programmers/internal/check_object.ts +72 -72
  50. package/src/programmers/internal/check_string.ts +46 -46
  51. package/src/programmers/internal/check_template.ts +46 -46
  52. package/src/programmers/internal/check_union_array_like.ts +331 -331
  53. package/src/programmers/internal/decode_union_object.ts +110 -110
  54. package/src/programmers/internal/feature_object_entries.ts +59 -59
  55. package/src/programmers/internal/json_schema_escaped.ts +78 -78
  56. package/src/programmers/internal/json_schema_object.ts +150 -150
  57. package/src/programmers/internal/json_schema_station.ts +2 -2
  58. package/src/programmers/internal/metadata_to_pattern.ts +40 -40
  59. package/src/programmers/internal/postfix_of_tuple.ts +3 -3
  60. package/src/programmers/internal/prune_object_properties.ts +69 -69
  61. package/src/programmers/internal/stringify_dynamic_properties.ts +158 -158
  62. package/src/programmers/internal/stringify_native.ts +5 -5
  63. package/src/programmers/internal/stringify_regular_properties.ts +77 -77
  64. package/src/programmers/internal/template_to_pattern.ts +21 -21
  65. package/src/programmers/internal/wrap_metadata_rest_tuple.ts +21 -21
  66. package/src/programmers/json/JsonStringifyProgrammer.ts +1124 -1124
  67. package/src/programmers/llm/LlmApplicationProgrammer.ts +10 -1
  68. package/src/programmers/llm/LlmSchemaProgrammer.ts +2 -7
  69. package/src/protobuf.ts +820 -820
  70. package/src/reflect.ts +46 -46
  71. package/src/schemas/json/IJsonApplication.ts +77 -77
  72. package/src/schemas/json/IJsonSchemaCollection.ts +212 -212
  73. package/src/schemas/json/IJsonSchemaUnit.ts +263 -263
  74. package/src/schemas/metadata/IMetadataTypeTag.ts +14 -14
  75. package/src/schemas/metadata/Metadata.ts +669 -669
  76. package/src/schemas/metadata/MetadataAliasType.ts +57 -57
  77. package/src/schemas/metadata/MetadataApplication.ts +40 -40
  78. package/src/schemas/metadata/MetadataArray.ts +47 -47
  79. package/src/schemas/metadata/MetadataArrayType.ts +51 -51
  80. package/src/schemas/metadata/MetadataAtomic.ts +85 -85
  81. package/src/schemas/metadata/MetadataEscaped.ts +45 -45
  82. package/src/schemas/metadata/MetadataFunction.ts +45 -45
  83. package/src/schemas/metadata/MetadataObject.ts +46 -46
  84. package/src/schemas/metadata/MetadataObjectType.ts +137 -137
  85. package/src/schemas/metadata/MetadataParameter.ts +52 -52
  86. package/src/schemas/metadata/MetadataProperty.ts +53 -53
  87. package/src/schemas/metadata/MetadataTemplate.ts +78 -78
  88. package/src/schemas/metadata/MetadataTuple.ts +28 -28
  89. package/src/schemas/metadata/MetadataTupleType.ts +61 -61
  90. package/src/tags/Constant.ts +47 -47
  91. package/src/tags/ContentMediaType.ts +27 -27
  92. package/src/tags/Default.ts +52 -52
  93. package/src/tags/Example.ts +56 -56
  94. package/src/tags/Examples.ts +56 -56
  95. package/src/tags/ExclusiveMaximum.ts +44 -44
  96. package/src/tags/ExclusiveMinimum.ts +44 -44
  97. package/src/tags/Format.ts +78 -78
  98. package/src/tags/JsonSchemaPlugin.ts +36 -36
  99. package/src/tags/MaxItems.ts +31 -31
  100. package/src/tags/MaxLength.ts +25 -25
  101. package/src/tags/Maximum.ts +39 -39
  102. package/src/tags/MinItems.ts +31 -31
  103. package/src/tags/MinLength.ts +25 -25
  104. package/src/tags/Minimum.ts +39 -39
  105. package/src/tags/MultipleOf.ts +42 -42
  106. package/src/tags/Pattern.ts +49 -49
  107. package/src/tags/Sequence.ts +37 -37
  108. package/src/tags/TagBase.ts +102 -102
  109. package/src/tags/Type.ts +64 -64
  110. package/src/tags/UniqueItems.ts +34 -34
  111. package/src/tags/internal/FormatCheatSheet.ts +71 -71
  112. package/src/transformers/ITransformOptions.ts +70 -70
  113. package/src/transformers/ImportTransformer.ts +253 -253
  114. package/src/transformers/NoTransformConfigurationError.ts +16 -16
  115. package/src/transformers/features/llm/LlmApplicationTransformer.ts +224 -224
  116. package/src/typings/Equal.ts +18 -18
@@ -1,158 +1,158 @@
1
- import ts from "typescript";
2
-
3
- import { IdentifierFactory } from "../../factories/IdentifierFactory";
4
- import { TemplateFactory } from "../../factories/TemplateFactory";
5
-
6
- import { IExpressionEntry } from "../helpers/IExpressionEntry";
7
- import { metadata_to_pattern } from "./metadata_to_pattern";
8
-
9
- /** @internal */
10
- export const stringify_dynamic_properties = (
11
- dynamic: IExpressionEntry<ts.Expression>[],
12
- regular: string[],
13
- ): ts.Expression => {
14
- // BASIC STATMEMENT, CHECK UNDEFINED
15
- const statements: ts.Statement[] = [
16
- ts.factory.createIfStatement(
17
- ts.factory.createStrictEquality(
18
- ts.factory.createIdentifier("undefined"),
19
- ts.factory.createIdentifier("value"),
20
- ),
21
- ts.factory.createReturnStatement(ts.factory.createStringLiteral("")),
22
- ),
23
- ];
24
-
25
- // PREPARE RETURN FUNCTION
26
- const output = () => {
27
- const mapped = ts.factory.createCallExpression(
28
- IdentifierFactory.access(
29
- ts.factory.createCallExpression(
30
- ts.factory.createIdentifier("Object.entries"),
31
- undefined,
32
- [ts.factory.createIdentifier("input")],
33
- ),
34
- "map",
35
- ),
36
- undefined,
37
- [
38
- ts.factory.createArrowFunction(
39
- undefined,
40
- undefined,
41
- [
42
- IdentifierFactory.parameter(
43
- ts.factory.createArrayBindingPattern([
44
- ts.factory.createBindingElement(undefined, undefined, "key"),
45
- ts.factory.createBindingElement(undefined, undefined, "value"),
46
- ]),
47
- ts.factory.createTypeReferenceNode("[string, any]"),
48
- ),
49
- ],
50
- undefined,
51
- undefined,
52
- ts.factory.createBlock(statements),
53
- ),
54
- ],
55
- );
56
- const filtered = ts.factory.createCallExpression(
57
- IdentifierFactory.access(mapped, "filter"),
58
- undefined,
59
- [
60
- ts.factory.createArrowFunction(
61
- undefined,
62
- undefined,
63
- [IdentifierFactory.parameter("str")],
64
- undefined,
65
- undefined,
66
- ts.factory.createStrictInequality(
67
- ts.factory.createStringLiteral(""),
68
- ts.factory.createIdentifier("str"),
69
- ),
70
- ),
71
- ],
72
- );
73
- return ts.factory.createCallExpression(
74
- IdentifierFactory.access(filtered, "join"),
75
- undefined,
76
- [ts.factory.createStringLiteral(",")],
77
- );
78
- };
79
-
80
- // WHEN REGULAR PROPERTY EXISTS
81
- if (regular.length)
82
- statements.push(
83
- ts.factory.createIfStatement(
84
- ts.factory.createCallExpression(
85
- IdentifierFactory.access(
86
- ts.factory.createArrayLiteralExpression(
87
- regular.map((key) => ts.factory.createStringLiteral(key)),
88
- ),
89
- "some",
90
- ),
91
- undefined,
92
- [
93
- ts.factory.createArrowFunction(
94
- undefined,
95
- undefined,
96
- [IdentifierFactory.parameter("regular")],
97
- undefined,
98
- undefined,
99
- ts.factory.createStrictEquality(
100
- ts.factory.createIdentifier("regular"),
101
- ts.factory.createIdentifier("key"),
102
- ),
103
- ),
104
- ],
105
- ),
106
- ts.factory.createReturnStatement(ts.factory.createStringLiteral("")),
107
- ),
108
- );
109
-
110
- // ONLY STRING TYPED KEY EXISTS
111
- const simple: boolean =
112
- dynamic.length === 1 &&
113
- dynamic[0]!.key.size() === 1 &&
114
- dynamic[0]!.key.atomics[0]?.type === "string";
115
- if (simple === true) {
116
- statements.push(stringify(dynamic[0]!));
117
- return output();
118
- }
119
-
120
- // COMPOSITE TEMPLATE LITERAL TYPES
121
- for (const entry of dynamic) {
122
- const condition: ts.IfStatement = ts.factory.createIfStatement(
123
- ts.factory.createCallExpression(
124
- ts.factory.createIdentifier(
125
- `RegExp(/${metadata_to_pattern({
126
- top: true,
127
- metadata: entry.key,
128
- })}/).test`,
129
- ),
130
- undefined,
131
- [ts.factory.createIdentifier("key")],
132
- ),
133
- stringify(entry),
134
- );
135
- statements.push(condition);
136
- }
137
- statements.push(
138
- ts.factory.createReturnStatement(ts.factory.createStringLiteral("")),
139
- );
140
-
141
- return output();
142
- };
143
-
144
- /** @internal */
145
- const stringify = (
146
- entry: IExpressionEntry<ts.Expression>,
147
- ): ts.ReturnStatement =>
148
- ts.factory.createReturnStatement(
149
- TemplateFactory.generate([
150
- ts.factory.createCallExpression(
151
- ts.factory.createIdentifier("JSON.stringify"),
152
- [],
153
- [ts.factory.createIdentifier("key")],
154
- ),
155
- ts.factory.createStringLiteral(":"),
156
- entry.expression,
157
- ]),
158
- );
1
+ import ts from "typescript";
2
+
3
+ import { IdentifierFactory } from "../../factories/IdentifierFactory";
4
+ import { TemplateFactory } from "../../factories/TemplateFactory";
5
+
6
+ import { IExpressionEntry } from "../helpers/IExpressionEntry";
7
+ import { metadata_to_pattern } from "./metadata_to_pattern";
8
+
9
+ /** @internal */
10
+ export const stringify_dynamic_properties = (
11
+ dynamic: IExpressionEntry<ts.Expression>[],
12
+ regular: string[],
13
+ ): ts.Expression => {
14
+ // BASIC STATMEMENT, CHECK UNDEFINED
15
+ const statements: ts.Statement[] = [
16
+ ts.factory.createIfStatement(
17
+ ts.factory.createStrictEquality(
18
+ ts.factory.createIdentifier("undefined"),
19
+ ts.factory.createIdentifier("value"),
20
+ ),
21
+ ts.factory.createReturnStatement(ts.factory.createStringLiteral("")),
22
+ ),
23
+ ];
24
+
25
+ // PREPARE RETURN FUNCTION
26
+ const output = () => {
27
+ const mapped = ts.factory.createCallExpression(
28
+ IdentifierFactory.access(
29
+ ts.factory.createCallExpression(
30
+ ts.factory.createIdentifier("Object.entries"),
31
+ undefined,
32
+ [ts.factory.createIdentifier("input")],
33
+ ),
34
+ "map",
35
+ ),
36
+ undefined,
37
+ [
38
+ ts.factory.createArrowFunction(
39
+ undefined,
40
+ undefined,
41
+ [
42
+ IdentifierFactory.parameter(
43
+ ts.factory.createArrayBindingPattern([
44
+ ts.factory.createBindingElement(undefined, undefined, "key"),
45
+ ts.factory.createBindingElement(undefined, undefined, "value"),
46
+ ]),
47
+ ts.factory.createTypeReferenceNode("[string, any]"),
48
+ ),
49
+ ],
50
+ undefined,
51
+ undefined,
52
+ ts.factory.createBlock(statements),
53
+ ),
54
+ ],
55
+ );
56
+ const filtered = ts.factory.createCallExpression(
57
+ IdentifierFactory.access(mapped, "filter"),
58
+ undefined,
59
+ [
60
+ ts.factory.createArrowFunction(
61
+ undefined,
62
+ undefined,
63
+ [IdentifierFactory.parameter("str")],
64
+ undefined,
65
+ undefined,
66
+ ts.factory.createStrictInequality(
67
+ ts.factory.createStringLiteral(""),
68
+ ts.factory.createIdentifier("str"),
69
+ ),
70
+ ),
71
+ ],
72
+ );
73
+ return ts.factory.createCallExpression(
74
+ IdentifierFactory.access(filtered, "join"),
75
+ undefined,
76
+ [ts.factory.createStringLiteral(",")],
77
+ );
78
+ };
79
+
80
+ // WHEN REGULAR PROPERTY EXISTS
81
+ if (regular.length)
82
+ statements.push(
83
+ ts.factory.createIfStatement(
84
+ ts.factory.createCallExpression(
85
+ IdentifierFactory.access(
86
+ ts.factory.createArrayLiteralExpression(
87
+ regular.map((key) => ts.factory.createStringLiteral(key)),
88
+ ),
89
+ "some",
90
+ ),
91
+ undefined,
92
+ [
93
+ ts.factory.createArrowFunction(
94
+ undefined,
95
+ undefined,
96
+ [IdentifierFactory.parameter("regular")],
97
+ undefined,
98
+ undefined,
99
+ ts.factory.createStrictEquality(
100
+ ts.factory.createIdentifier("regular"),
101
+ ts.factory.createIdentifier("key"),
102
+ ),
103
+ ),
104
+ ],
105
+ ),
106
+ ts.factory.createReturnStatement(ts.factory.createStringLiteral("")),
107
+ ),
108
+ );
109
+
110
+ // ONLY STRING TYPED KEY EXISTS
111
+ const simple: boolean =
112
+ dynamic.length === 1 &&
113
+ dynamic[0]!.key.size() === 1 &&
114
+ dynamic[0]!.key.atomics[0]?.type === "string";
115
+ if (simple === true) {
116
+ statements.push(stringify(dynamic[0]!));
117
+ return output();
118
+ }
119
+
120
+ // COMPOSITE TEMPLATE LITERAL TYPES
121
+ for (const entry of dynamic) {
122
+ const condition: ts.IfStatement = ts.factory.createIfStatement(
123
+ ts.factory.createCallExpression(
124
+ ts.factory.createIdentifier(
125
+ `RegExp(/${metadata_to_pattern({
126
+ top: true,
127
+ metadata: entry.key,
128
+ })}/).test`,
129
+ ),
130
+ undefined,
131
+ [ts.factory.createIdentifier("key")],
132
+ ),
133
+ stringify(entry),
134
+ );
135
+ statements.push(condition);
136
+ }
137
+ statements.push(
138
+ ts.factory.createReturnStatement(ts.factory.createStringLiteral("")),
139
+ );
140
+
141
+ return output();
142
+ };
143
+
144
+ /** @internal */
145
+ const stringify = (
146
+ entry: IExpressionEntry<ts.Expression>,
147
+ ): ts.ReturnStatement =>
148
+ ts.factory.createReturnStatement(
149
+ TemplateFactory.generate([
150
+ ts.factory.createCallExpression(
151
+ ts.factory.createIdentifier("JSON.stringify"),
152
+ [],
153
+ [ts.factory.createIdentifier("key")],
154
+ ),
155
+ ts.factory.createStringLiteral(":"),
156
+ entry.expression,
157
+ ]),
158
+ );
@@ -1,5 +1,5 @@
1
- import ts from "typescript";
2
-
3
- /** @internal */
4
- export const stringify_native = (): ts.Expression =>
5
- ts.factory.createStringLiteral("{}");
1
+ import ts from "typescript";
2
+
3
+ /** @internal */
4
+ export const stringify_native = (): ts.Expression =>
5
+ ts.factory.createStringLiteral("{}");
@@ -1,77 +1,77 @@
1
- import ts from "typescript";
2
-
3
- import { TemplateFactory } from "../../factories/TemplateFactory";
4
- import { ValueFactory } from "../../factories/ValueFactory";
5
-
6
- import { Metadata } from "../../schemas/metadata/Metadata";
7
-
8
- import { IExpressionEntry } from "../helpers/IExpressionEntry";
9
-
10
- /** @internal */
11
- export const stringify_regular_properties = (props: {
12
- regular: IExpressionEntry<ts.Expression>[];
13
- dynamic: IExpressionEntry<ts.Expression>[];
14
- }): ts.Expression[] => {
15
- const output: ts.Expression[] = [];
16
-
17
- props.regular.sort((x, y) => sequence(x.meta) - sequence(y.meta));
18
- props.regular.forEach((entry, index) => {
19
- // BASE ELEMENTS
20
- const key: string = entry.key.getSoleLiteral()!;
21
- const base: ts.Expression[] = [
22
- ts.factory.createStringLiteral(`${JSON.stringify(key)}:`),
23
- entry.expression,
24
- ];
25
- if (index !== props.regular.length - 1 || props.dynamic.length !== 0)
26
- base.push(ts.factory.createStringLiteral(`,`));
27
-
28
- const empty: boolean =
29
- (entry.meta.isRequired() === false &&
30
- entry.meta.nullable === false &&
31
- entry.meta.size() === 0) ||
32
- (!!entry.meta.functions.length &&
33
- entry.meta.nullable === false &&
34
- entry.meta.size() === 1);
35
-
36
- if (empty === true) return;
37
- else if (
38
- entry.meta.isRequired() === false ||
39
- entry.meta.functions.length ||
40
- entry.meta.any === true
41
- )
42
- output.push(
43
- ts.factory.createConditionalExpression(
44
- (() => {
45
- const conditions: ts.BinaryExpression[] = [];
46
- if (entry.meta.isRequired() === false || entry.meta.any)
47
- conditions.push(
48
- ts.factory.createStrictEquality(
49
- ts.factory.createIdentifier("undefined"),
50
- entry.input,
51
- ),
52
- );
53
- if (entry.meta.functions.length || entry.meta.any)
54
- conditions.push(
55
- ts.factory.createStrictEquality(
56
- ts.factory.createStringLiteral("function"),
57
- ValueFactory.TYPEOF(entry.input),
58
- ),
59
- );
60
- return conditions.length === 1
61
- ? conditions[0]!
62
- : conditions.reduce((x, y) => ts.factory.createLogicalOr(x, y));
63
- })(),
64
- undefined,
65
- ts.factory.createStringLiteral(""),
66
- undefined,
67
- TemplateFactory.generate(base),
68
- ),
69
- );
70
- else output.push(...base);
71
- });
72
- return output;
73
- };
74
-
75
- /** @internal */
76
- const sequence = (meta: Metadata): number =>
77
- meta.any || !meta.isRequired() || meta.functions.length ? 0 : 1;
1
+ import ts from "typescript";
2
+
3
+ import { TemplateFactory } from "../../factories/TemplateFactory";
4
+ import { ValueFactory } from "../../factories/ValueFactory";
5
+
6
+ import { Metadata } from "../../schemas/metadata/Metadata";
7
+
8
+ import { IExpressionEntry } from "../helpers/IExpressionEntry";
9
+
10
+ /** @internal */
11
+ export const stringify_regular_properties = (props: {
12
+ regular: IExpressionEntry<ts.Expression>[];
13
+ dynamic: IExpressionEntry<ts.Expression>[];
14
+ }): ts.Expression[] => {
15
+ const output: ts.Expression[] = [];
16
+
17
+ props.regular.sort((x, y) => sequence(x.meta) - sequence(y.meta));
18
+ props.regular.forEach((entry, index) => {
19
+ // BASE ELEMENTS
20
+ const key: string = entry.key.getSoleLiteral()!;
21
+ const base: ts.Expression[] = [
22
+ ts.factory.createStringLiteral(`${JSON.stringify(key)}:`),
23
+ entry.expression,
24
+ ];
25
+ if (index !== props.regular.length - 1 || props.dynamic.length !== 0)
26
+ base.push(ts.factory.createStringLiteral(`,`));
27
+
28
+ const empty: boolean =
29
+ (entry.meta.isRequired() === false &&
30
+ entry.meta.nullable === false &&
31
+ entry.meta.size() === 0) ||
32
+ (!!entry.meta.functions.length &&
33
+ entry.meta.nullable === false &&
34
+ entry.meta.size() === 1);
35
+
36
+ if (empty === true) return;
37
+ else if (
38
+ entry.meta.isRequired() === false ||
39
+ entry.meta.functions.length ||
40
+ entry.meta.any === true
41
+ )
42
+ output.push(
43
+ ts.factory.createConditionalExpression(
44
+ (() => {
45
+ const conditions: ts.BinaryExpression[] = [];
46
+ if (entry.meta.isRequired() === false || entry.meta.any)
47
+ conditions.push(
48
+ ts.factory.createStrictEquality(
49
+ ts.factory.createIdentifier("undefined"),
50
+ entry.input,
51
+ ),
52
+ );
53
+ if (entry.meta.functions.length || entry.meta.any)
54
+ conditions.push(
55
+ ts.factory.createStrictEquality(
56
+ ts.factory.createStringLiteral("function"),
57
+ ValueFactory.TYPEOF(entry.input),
58
+ ),
59
+ );
60
+ return conditions.length === 1
61
+ ? conditions[0]!
62
+ : conditions.reduce((x, y) => ts.factory.createLogicalOr(x, y));
63
+ })(),
64
+ undefined,
65
+ ts.factory.createStringLiteral(""),
66
+ undefined,
67
+ TemplateFactory.generate(base),
68
+ ),
69
+ );
70
+ else output.push(...base);
71
+ });
72
+ return output;
73
+ };
74
+
75
+ /** @internal */
76
+ const sequence = (meta: Metadata): number =>
77
+ meta.any || !meta.isRequired() || meta.functions.length ? 0 : 1;
@@ -1,21 +1,21 @@
1
- import { Metadata } from "../../schemas/metadata/Metadata";
2
-
3
- import { PatternUtil } from "../../utils/PatternUtil";
4
-
5
- import { metadata_to_pattern } from "./metadata_to_pattern";
6
-
7
- /** @internal */
8
- export const template_to_pattern = (props: {
9
- top: boolean;
10
- template: Metadata[];
11
- }) => {
12
- const pattern: string = props.template
13
- .map((meta) =>
14
- metadata_to_pattern({
15
- top: false,
16
- metadata: meta,
17
- }),
18
- )
19
- .join("");
20
- return props.top ? PatternUtil.fix(pattern) : pattern;
21
- };
1
+ import { Metadata } from "../../schemas/metadata/Metadata";
2
+
3
+ import { PatternUtil } from "../../utils/PatternUtil";
4
+
5
+ import { metadata_to_pattern } from "./metadata_to_pattern";
6
+
7
+ /** @internal */
8
+ export const template_to_pattern = (props: {
9
+ top: boolean;
10
+ template: Metadata[];
11
+ }) => {
12
+ const pattern: string = props.template
13
+ .map((meta) =>
14
+ metadata_to_pattern({
15
+ top: false,
16
+ metadata: meta,
17
+ }),
18
+ )
19
+ .join("");
20
+ return props.top ? PatternUtil.fix(pattern) : pattern;
21
+ };
@@ -1,21 +1,21 @@
1
- import { Metadata } from "../../schemas/metadata/Metadata";
2
- import { MetadataArray } from "../../schemas/metadata/MetadataArray";
3
- import { MetadataArrayType } from "../../schemas/metadata/MetadataArrayType";
4
-
5
- /** @internal */
6
- export const wrap_metadata_rest_tuple = (rest: Metadata) => {
7
- const wrapper: Metadata = Metadata.initialize();
8
- wrapper.arrays.push(
9
- MetadataArray.create({
10
- type: MetadataArrayType.create({
11
- name: `...${rest.getName()}`,
12
- value: rest,
13
- nullables: [],
14
- recursive: false,
15
- index: null,
16
- }),
17
- tags: [],
18
- }),
19
- );
20
- return wrapper;
21
- };
1
+ import { Metadata } from "../../schemas/metadata/Metadata";
2
+ import { MetadataArray } from "../../schemas/metadata/MetadataArray";
3
+ import { MetadataArrayType } from "../../schemas/metadata/MetadataArrayType";
4
+
5
+ /** @internal */
6
+ export const wrap_metadata_rest_tuple = (rest: Metadata) => {
7
+ const wrapper: Metadata = Metadata.initialize();
8
+ wrapper.arrays.push(
9
+ MetadataArray.create({
10
+ type: MetadataArrayType.create({
11
+ name: `...${rest.getName()}`,
12
+ value: rest,
13
+ nullables: [],
14
+ recursive: false,
15
+ index: null,
16
+ }),
17
+ tags: [],
18
+ }),
19
+ );
20
+ return wrapper;
21
+ };