typia 7.0.0-dev.20240923 → 7.0.0-dev.20240928
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.
- package/lib/index.mjs +1 -0
- package/lib/index.mjs.map +1 -1
- package/lib/programmers/AssertProgrammer.d.ts +1 -1
- package/lib/programmers/AssertProgrammer.js +169 -127
- package/lib/programmers/AssertProgrammer.js.map +1 -1
- package/lib/programmers/CheckerProgrammer.d.ts +70 -15
- package/lib/programmers/CheckerProgrammer.js +998 -638
- package/lib/programmers/CheckerProgrammer.js.map +1 -1
- package/lib/programmers/FeatureProgrammer.d.ts +7 -3
- package/lib/programmers/FeatureProgrammer.js +17 -17
- package/lib/programmers/FeatureProgrammer.js.map +1 -1
- package/lib/programmers/IsProgrammer.d.ts +25 -4
- package/lib/programmers/IsProgrammer.js +54 -39
- package/lib/programmers/IsProgrammer.js.map +1 -1
- package/lib/programmers/ValidateProgrammer.js +110 -97
- package/lib/programmers/ValidateProgrammer.js.map +1 -1
- package/lib/programmers/helpers/UnionExplorer.d.ts +1 -1
- package/lib/programmers/json/JsonStringifyProgrammer.js +71 -38
- package/lib/programmers/json/JsonStringifyProgrammer.js.map +1 -1
- package/lib/programmers/llm/LlmApplicationProgrammer.js +16 -2
- package/lib/programmers/llm/LlmApplicationProgrammer.js.map +1 -1
- package/lib/programmers/misc/MiscCloneProgrammer.js +504 -406
- package/lib/programmers/misc/MiscCloneProgrammer.js.map +1 -1
- package/lib/programmers/misc/MiscLiteralsProgrammer.js +3 -3
- package/lib/programmers/misc/MiscLiteralsProgrammer.js.map +1 -1
- package/lib/programmers/misc/MiscPruneProgrammer.js +365 -301
- package/lib/programmers/misc/MiscPruneProgrammer.js.map +1 -1
- package/lib/programmers/notations/NotationGeneralProgrammer.js +62 -15
- package/lib/programmers/notations/NotationGeneralProgrammer.js.map +1 -1
- package/lib/programmers/protobuf/ProtobufEncodeProgrammer.js +17 -3
- package/lib/programmers/protobuf/ProtobufEncodeProgrammer.js.map +1 -1
- package/lib/tags/Example.d.ts +14 -0
- package/lib/tags/Example.js +3 -0
- package/lib/tags/Example.js.map +1 -0
- package/lib/tags/Examples.d.ts +10 -0
- package/lib/tags/Examples.js +3 -0
- package/lib/tags/Examples.js.map +1 -0
- package/lib/tags/index.d.ts +2 -0
- package/lib/tags/index.js +2 -0
- package/lib/tags/index.js.map +1 -1
- package/package.json +2 -2
- package/src/programmers/AssertProgrammer.ts +185 -143
- package/src/programmers/CheckerProgrammer.ts +1380 -998
- package/src/programmers/FeatureProgrammer.ts +40 -34
- package/src/programmers/IsProgrammer.ts +94 -66
- package/src/programmers/ValidateProgrammer.ts +149 -137
- package/src/programmers/helpers/UnionExplorer.ts +1 -1
- package/src/programmers/json/JsonStringifyProgrammer.ts +60 -38
- package/src/programmers/llm/LlmApplicationProgrammer.ts +51 -32
- package/src/programmers/misc/MiscCloneProgrammer.ts +775 -600
- package/src/programmers/misc/MiscLiteralsProgrammer.ts +4 -4
- package/src/programmers/misc/MiscPruneProgrammer.ts +532 -415
- package/src/programmers/notations/NotationGeneralProgrammer.ts +64 -26
- package/src/programmers/protobuf/ProtobufEncodeProgrammer.ts +16 -9
- package/src/tags/Example.ts +17 -0
- package/src/tags/Examples.ts +16 -0
- package/src/tags/index.ts +20 -18
|
@@ -47,9 +47,11 @@ export namespace NotationGeneralProgrammer {
|
|
|
47
47
|
const config = configure(props);
|
|
48
48
|
if (props.validated === false)
|
|
49
49
|
config.addition = (collection) =>
|
|
50
|
-
IsProgrammer.write_function_statements(
|
|
50
|
+
IsProgrammer.write_function_statements({
|
|
51
|
+
context: props.context,
|
|
52
|
+
importer: props.importer,
|
|
51
53
|
collection,
|
|
52
|
-
);
|
|
54
|
+
});
|
|
53
55
|
const composed: FeatureProgrammer.IComposed = FeatureProgrammer.compose({
|
|
54
56
|
...props,
|
|
55
57
|
config,
|
|
@@ -213,15 +215,14 @@ export namespace NotationGeneralProgrammer {
|
|
|
213
215
|
unions.push({
|
|
214
216
|
type: "tuple",
|
|
215
217
|
is: () =>
|
|
216
|
-
IsProgrammer.decode(
|
|
217
|
-
props
|
|
218
|
-
(() => {
|
|
218
|
+
IsProgrammer.decode({
|
|
219
|
+
...props,
|
|
220
|
+
metadata: (() => {
|
|
219
221
|
const partial = Metadata.initialize();
|
|
220
222
|
partial.tuples.push(tuple);
|
|
221
223
|
return partial;
|
|
222
224
|
})(),
|
|
223
|
-
|
|
224
|
-
),
|
|
225
|
+
}),
|
|
225
226
|
value: () =>
|
|
226
227
|
decode_tuple({
|
|
227
228
|
...props,
|
|
@@ -484,7 +485,14 @@ export namespace NotationGeneralProgrammer {
|
|
|
484
485
|
}): ts.Expression =>
|
|
485
486
|
ts.factory.createCallExpression(
|
|
486
487
|
UnionExplorer.set({
|
|
487
|
-
checker:
|
|
488
|
+
checker: (input, metadata, explore) =>
|
|
489
|
+
IsProgrammer.decode({
|
|
490
|
+
context: props.context,
|
|
491
|
+
importer: props.importer,
|
|
492
|
+
input,
|
|
493
|
+
metadata,
|
|
494
|
+
explore,
|
|
495
|
+
}),
|
|
488
496
|
decoder: (input, array, explore) =>
|
|
489
497
|
ts.factory.createNewExpression(
|
|
490
498
|
ts.factory.createIdentifier("Set"),
|
|
@@ -522,19 +530,29 @@ export namespace NotationGeneralProgrammer {
|
|
|
522
530
|
}): ts.Expression =>
|
|
523
531
|
ts.factory.createCallExpression(
|
|
524
532
|
UnionExplorer.map({
|
|
525
|
-
checker: (top, entry, explore) =>
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
533
|
+
checker: (top, entry, explore) =>
|
|
534
|
+
ts.factory.createLogicalAnd(
|
|
535
|
+
IsProgrammer.decode({
|
|
536
|
+
context: props.context,
|
|
537
|
+
importer: props.importer,
|
|
538
|
+
input: ts.factory.createElementAccessExpression(top, 0),
|
|
539
|
+
metadata: entry[0],
|
|
540
|
+
explore: {
|
|
541
|
+
...props.explore,
|
|
542
|
+
postfix: `${explore.postfix}[0]`,
|
|
543
|
+
},
|
|
531
544
|
}),
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
545
|
+
IsProgrammer.decode({
|
|
546
|
+
context: props.context,
|
|
547
|
+
importer: props.importer,
|
|
548
|
+
input: ts.factory.createElementAccessExpression(top, 1),
|
|
549
|
+
metadata: entry[1],
|
|
550
|
+
explore: {
|
|
551
|
+
...props.explore,
|
|
552
|
+
postfix: `${props.explore.postfix}[1]`,
|
|
553
|
+
},
|
|
535
554
|
}),
|
|
536
|
-
)
|
|
537
|
-
},
|
|
555
|
+
),
|
|
538
556
|
decoder: (input, array, explore) =>
|
|
539
557
|
ts.factory.createNewExpression(
|
|
540
558
|
ts.factory.createIdentifier("Map"),
|
|
@@ -597,7 +615,14 @@ export namespace NotationGeneralProgrammer {
|
|
|
597
615
|
explore_array_like_union_types({
|
|
598
616
|
...props,
|
|
599
617
|
factory: UnionExplorer.array({
|
|
600
|
-
checker:
|
|
618
|
+
checker: (input, metadata, explore) =>
|
|
619
|
+
IsProgrammer.decode({
|
|
620
|
+
context: props.context,
|
|
621
|
+
importer: props.importer,
|
|
622
|
+
input,
|
|
623
|
+
metadata,
|
|
624
|
+
explore,
|
|
625
|
+
}),
|
|
601
626
|
decoder: (input, array, explore) =>
|
|
602
627
|
decode_array({
|
|
603
628
|
config: props.config,
|
|
@@ -645,7 +670,7 @@ export namespace NotationGeneralProgrammer {
|
|
|
645
670
|
[],
|
|
646
671
|
);
|
|
647
672
|
|
|
648
|
-
const
|
|
673
|
+
const arrayExplore: FeatureProgrammer.IExplore = {
|
|
649
674
|
...props.explore,
|
|
650
675
|
source: "function",
|
|
651
676
|
from: "array",
|
|
@@ -661,13 +686,13 @@ export namespace NotationGeneralProgrammer {
|
|
|
661
686
|
TypeFactory.keyword("any"),
|
|
662
687
|
)(ts.factory.createIdentifier("input")),
|
|
663
688
|
)({
|
|
664
|
-
...
|
|
689
|
+
...arrayExplore,
|
|
665
690
|
postfix: "",
|
|
666
691
|
})(ts.factory.createIdentifier("input")),
|
|
667
692
|
),
|
|
668
693
|
),
|
|
669
694
|
undefined,
|
|
670
|
-
FeatureProgrammer.argumentsArray(props.config)(
|
|
695
|
+
FeatureProgrammer.argumentsArray(props.config)(arrayExplore)(props.input),
|
|
671
696
|
);
|
|
672
697
|
};
|
|
673
698
|
|
|
@@ -708,11 +733,24 @@ export namespace NotationGeneralProgrammer {
|
|
|
708
733
|
input,
|
|
709
734
|
}),
|
|
710
735
|
objector: {
|
|
711
|
-
checker: () =>
|
|
736
|
+
checker: () => (input, metadata, explore) =>
|
|
737
|
+
IsProgrammer.decode({
|
|
738
|
+
context: props.context,
|
|
739
|
+
importer: props.importer,
|
|
740
|
+
input,
|
|
741
|
+
metadata,
|
|
742
|
+
explore,
|
|
743
|
+
}),
|
|
712
744
|
decoder: () => decode_object(props.importer),
|
|
713
745
|
joiner: NotationJoiner.object(props.rename),
|
|
714
|
-
unionizer: decode_union_object(
|
|
715
|
-
IsProgrammer.decode_object(
|
|
746
|
+
unionizer: decode_union_object((input, object, explore) =>
|
|
747
|
+
IsProgrammer.decode_object({
|
|
748
|
+
context: props.context,
|
|
749
|
+
importer: props.importer,
|
|
750
|
+
object,
|
|
751
|
+
input,
|
|
752
|
+
explore,
|
|
753
|
+
}),
|
|
716
754
|
)(decode_object(props.importer))((exp) => exp)((input, expected) =>
|
|
717
755
|
create_throw_error({
|
|
718
756
|
importer: props.importer,
|
|
@@ -179,9 +179,7 @@ export namespace ProtobufEncodeProgrammer {
|
|
|
179
179
|
[
|
|
180
180
|
...props.importer.declareUnions(),
|
|
181
181
|
...functors,
|
|
182
|
-
...IsProgrammer.write_function_statements(props
|
|
183
|
-
props.importer,
|
|
184
|
-
)(props.collection),
|
|
182
|
+
...IsProgrammer.write_function_statements(props),
|
|
185
183
|
...main.statements,
|
|
186
184
|
ts.factory.createReturnStatement(
|
|
187
185
|
ts.factory.createIdentifier("writer"),
|
|
@@ -861,7 +859,14 @@ export namespace ProtobufEncodeProgrammer {
|
|
|
861
859
|
|
|
862
860
|
if (specList.length === 0) {
|
|
863
861
|
const condition: ts.Expression = decode_union_object(
|
|
864
|
-
|
|
862
|
+
(input, object, explore) =>
|
|
863
|
+
IsProgrammer.decode_object({
|
|
864
|
+
context: props.context,
|
|
865
|
+
importer: props.importer,
|
|
866
|
+
object,
|
|
867
|
+
input,
|
|
868
|
+
explore,
|
|
869
|
+
}),
|
|
865
870
|
)((input, object, explore) =>
|
|
866
871
|
ExpressionFactory.selfCall(
|
|
867
872
|
decode_object({
|
|
@@ -895,15 +900,17 @@ export namespace ProtobufEncodeProgrammer {
|
|
|
895
900
|
key,
|
|
896
901
|
);
|
|
897
902
|
const pred: ts.Expression = spec.neighbour
|
|
898
|
-
? IsProgrammer.decode(
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
903
|
+
? IsProgrammer.decode({
|
|
904
|
+
context: props.context,
|
|
905
|
+
importer: props.importer,
|
|
906
|
+
input: accessor,
|
|
907
|
+
metadata: spec.property.value,
|
|
908
|
+
explore: {
|
|
902
909
|
...props.explore,
|
|
903
910
|
tracable: false,
|
|
904
911
|
postfix: IdentifierFactory.postfix(key),
|
|
905
912
|
},
|
|
906
|
-
)
|
|
913
|
+
})
|
|
907
914
|
: ExpressionFactory.isRequired(accessor);
|
|
908
915
|
return ts.factory.createIfStatement(
|
|
909
916
|
pred,
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { TagBase } from "./TagBase";
|
|
2
|
+
|
|
3
|
+
export type Example<
|
|
4
|
+
Value extends boolean | bigint | number | string | Array<unknown> | null,
|
|
5
|
+
> = TagBase<{
|
|
6
|
+
target: "boolean" | "bigint" | "number" | "string" | "array";
|
|
7
|
+
kind: "example";
|
|
8
|
+
value: Value;
|
|
9
|
+
exclusive: true;
|
|
10
|
+
schema: Value extends bigint
|
|
11
|
+
? { example: Numeric<Value> }
|
|
12
|
+
: { example: Value };
|
|
13
|
+
}>;
|
|
14
|
+
|
|
15
|
+
type Numeric<T extends bigint> = `${T}` extends `${infer N extends number}`
|
|
16
|
+
? N
|
|
17
|
+
: never;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { TagBase } from "./TagBase";
|
|
2
|
+
|
|
3
|
+
export type Examples<
|
|
4
|
+
Dict extends Record<
|
|
5
|
+
string,
|
|
6
|
+
boolean | bigint | number | string | Array<unknown> | null
|
|
7
|
+
>,
|
|
8
|
+
> = TagBase<{
|
|
9
|
+
target: "boolean" | "bigint" | "number" | "string" | "array";
|
|
10
|
+
kind: "examples";
|
|
11
|
+
value: Dict;
|
|
12
|
+
exclusive: true;
|
|
13
|
+
schema: {
|
|
14
|
+
examples: Dict;
|
|
15
|
+
};
|
|
16
|
+
}>;
|
package/src/tags/index.ts
CHANGED
|
@@ -1,18 +1,20 @@
|
|
|
1
|
-
export * from "./Constant";
|
|
2
|
-
export * from "./ContentMediaType";
|
|
3
|
-
export * from "./Default";
|
|
4
|
-
export * from "./
|
|
5
|
-
export * from "./
|
|
6
|
-
export * from "./
|
|
7
|
-
export * from "./
|
|
8
|
-
export * from "./
|
|
9
|
-
export * from "./
|
|
10
|
-
export * from "./
|
|
11
|
-
export * from "./
|
|
12
|
-
export * from "./
|
|
13
|
-
export * from "./
|
|
14
|
-
export * from "./
|
|
15
|
-
export * from "./
|
|
16
|
-
export * from "./
|
|
17
|
-
export * from "./
|
|
18
|
-
export * from "./
|
|
1
|
+
export * from "./Constant";
|
|
2
|
+
export * from "./ContentMediaType";
|
|
3
|
+
export * from "./Default";
|
|
4
|
+
export * from "./Example";
|
|
5
|
+
export * from "./Examples";
|
|
6
|
+
export * from "./ExclusiveMaximum";
|
|
7
|
+
export * from "./ExclusiveMinimum";
|
|
8
|
+
export * from "./Format";
|
|
9
|
+
export * from "./JsonSchemaPlugin";
|
|
10
|
+
export * from "./Maximum";
|
|
11
|
+
export * from "./MaxItems";
|
|
12
|
+
export * from "./MaxLength";
|
|
13
|
+
export * from "./Minimum";
|
|
14
|
+
export * from "./MinItems";
|
|
15
|
+
export * from "./MinLength";
|
|
16
|
+
export * from "./MultipleOf";
|
|
17
|
+
export * from "./Pattern";
|
|
18
|
+
export * from "./TagBase";
|
|
19
|
+
export * from "./Type";
|
|
20
|
+
export * from "./UniqueItems";
|