@cydm/pie 0.1.0 → 1.0.0
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/README.md +6 -3
- package/dist/builtin/extensions/ask-user/index.js +5 -5
- package/dist/builtin/extensions/document-attachments/index.js +144 -0
- package/dist/builtin/extensions/kimi-attachments/index.js +46 -0
- package/dist/builtin/extensions/questionnaire/index.js +5 -5
- package/dist/builtin/extensions/subagent/index.js +3850 -169
- package/dist/cli.js +59160 -54617
- package/package.json +4 -3
- package/dist/builtin/extensions/compact/index.js +0 -52
|
@@ -376,6 +376,36 @@ function CloneType(schema, options) {
|
|
|
376
376
|
}
|
|
377
377
|
|
|
378
378
|
// ../../node_modules/@sinclair/typebox/build/esm/value/guard/guard.mjs
|
|
379
|
+
function IsAsyncIterator2(value) {
|
|
380
|
+
return IsObject2(value) && globalThis.Symbol.asyncIterator in value;
|
|
381
|
+
}
|
|
382
|
+
function IsIterator2(value) {
|
|
383
|
+
return IsObject2(value) && globalThis.Symbol.iterator in value;
|
|
384
|
+
}
|
|
385
|
+
function IsStandardObject(value) {
|
|
386
|
+
return IsObject2(value) && (globalThis.Object.getPrototypeOf(value) === Object.prototype || globalThis.Object.getPrototypeOf(value) === null);
|
|
387
|
+
}
|
|
388
|
+
function IsPromise(value) {
|
|
389
|
+
return value instanceof globalThis.Promise;
|
|
390
|
+
}
|
|
391
|
+
function IsDate2(value) {
|
|
392
|
+
return value instanceof Date && globalThis.Number.isFinite(value.getTime());
|
|
393
|
+
}
|
|
394
|
+
function IsMap(value) {
|
|
395
|
+
return value instanceof globalThis.Map;
|
|
396
|
+
}
|
|
397
|
+
function IsSet(value) {
|
|
398
|
+
return value instanceof globalThis.Set;
|
|
399
|
+
}
|
|
400
|
+
function IsTypedArray(value) {
|
|
401
|
+
return globalThis.ArrayBuffer.isView(value);
|
|
402
|
+
}
|
|
403
|
+
function IsUint8Array2(value) {
|
|
404
|
+
return value instanceof globalThis.Uint8Array;
|
|
405
|
+
}
|
|
406
|
+
function HasPropertyKey2(value, key) {
|
|
407
|
+
return key in value;
|
|
408
|
+
}
|
|
379
409
|
function IsObject2(value) {
|
|
380
410
|
return value !== null && typeof value === "object";
|
|
381
411
|
}
|
|
@@ -385,9 +415,33 @@ function IsArray2(value) {
|
|
|
385
415
|
function IsUndefined2(value) {
|
|
386
416
|
return value === void 0;
|
|
387
417
|
}
|
|
418
|
+
function IsNull2(value) {
|
|
419
|
+
return value === null;
|
|
420
|
+
}
|
|
421
|
+
function IsBoolean2(value) {
|
|
422
|
+
return typeof value === "boolean";
|
|
423
|
+
}
|
|
388
424
|
function IsNumber2(value) {
|
|
389
425
|
return typeof value === "number";
|
|
390
426
|
}
|
|
427
|
+
function IsInteger(value) {
|
|
428
|
+
return globalThis.Number.isInteger(value);
|
|
429
|
+
}
|
|
430
|
+
function IsBigInt2(value) {
|
|
431
|
+
return typeof value === "bigint";
|
|
432
|
+
}
|
|
433
|
+
function IsString2(value) {
|
|
434
|
+
return typeof value === "string";
|
|
435
|
+
}
|
|
436
|
+
function IsFunction2(value) {
|
|
437
|
+
return typeof value === "function";
|
|
438
|
+
}
|
|
439
|
+
function IsSymbol2(value) {
|
|
440
|
+
return typeof value === "symbol";
|
|
441
|
+
}
|
|
442
|
+
function IsValueType(value) {
|
|
443
|
+
return IsBigInt2(value) || IsBoolean2(value) || IsNull2(value) || IsNumber2(value) || IsString2(value) || IsSymbol2(value) || IsUndefined2(value);
|
|
444
|
+
}
|
|
391
445
|
|
|
392
446
|
// ../../node_modules/@sinclair/typebox/build/esm/system/policy.mjs
|
|
393
447
|
var TypeSystemPolicy;
|
|
@@ -469,11 +523,11 @@ var TypeBoxError = class extends Error {
|
|
|
469
523
|
};
|
|
470
524
|
|
|
471
525
|
// ../../node_modules/@sinclair/typebox/build/esm/type/symbols/symbols.mjs
|
|
472
|
-
var TransformKind =
|
|
473
|
-
var ReadonlyKind =
|
|
474
|
-
var OptionalKind =
|
|
475
|
-
var Hint =
|
|
476
|
-
var Kind =
|
|
526
|
+
var TransformKind = Symbol.for("TypeBox.Transform");
|
|
527
|
+
var ReadonlyKind = Symbol.for("TypeBox.Readonly");
|
|
528
|
+
var OptionalKind = Symbol.for("TypeBox.Optional");
|
|
529
|
+
var Hint = Symbol.for("TypeBox.Hint");
|
|
530
|
+
var Kind = Symbol.for("TypeBox.Kind");
|
|
477
531
|
|
|
478
532
|
// ../../node_modules/@sinclair/typebox/build/esm/type/guard/kind.mjs
|
|
479
533
|
function IsReadonly(value) {
|
|
@@ -491,13 +545,13 @@ function IsArgument(value) {
|
|
|
491
545
|
function IsArray3(value) {
|
|
492
546
|
return IsKindOf(value, "Array");
|
|
493
547
|
}
|
|
494
|
-
function
|
|
548
|
+
function IsAsyncIterator3(value) {
|
|
495
549
|
return IsKindOf(value, "AsyncIterator");
|
|
496
550
|
}
|
|
497
|
-
function
|
|
551
|
+
function IsBigInt3(value) {
|
|
498
552
|
return IsKindOf(value, "BigInt");
|
|
499
553
|
}
|
|
500
|
-
function
|
|
554
|
+
function IsBoolean3(value) {
|
|
501
555
|
return IsKindOf(value, "Boolean");
|
|
502
556
|
}
|
|
503
557
|
function IsComputed(value) {
|
|
@@ -506,19 +560,19 @@ function IsComputed(value) {
|
|
|
506
560
|
function IsConstructor(value) {
|
|
507
561
|
return IsKindOf(value, "Constructor");
|
|
508
562
|
}
|
|
509
|
-
function
|
|
563
|
+
function IsDate3(value) {
|
|
510
564
|
return IsKindOf(value, "Date");
|
|
511
565
|
}
|
|
512
|
-
function
|
|
566
|
+
function IsFunction3(value) {
|
|
513
567
|
return IsKindOf(value, "Function");
|
|
514
568
|
}
|
|
515
|
-
function
|
|
569
|
+
function IsInteger2(value) {
|
|
516
570
|
return IsKindOf(value, "Integer");
|
|
517
571
|
}
|
|
518
572
|
function IsIntersect(value) {
|
|
519
573
|
return IsKindOf(value, "Intersect");
|
|
520
574
|
}
|
|
521
|
-
function
|
|
575
|
+
function IsIterator3(value) {
|
|
522
576
|
return IsKindOf(value, "Iterator");
|
|
523
577
|
}
|
|
524
578
|
function IsKindOf(value, kind) {
|
|
@@ -542,7 +596,7 @@ function IsNever(value) {
|
|
|
542
596
|
function IsNot(value) {
|
|
543
597
|
return IsKindOf(value, "Not");
|
|
544
598
|
}
|
|
545
|
-
function
|
|
599
|
+
function IsNull3(value) {
|
|
546
600
|
return IsKindOf(value, "Null");
|
|
547
601
|
}
|
|
548
602
|
function IsNumber3(value) {
|
|
@@ -551,7 +605,7 @@ function IsNumber3(value) {
|
|
|
551
605
|
function IsObject3(value) {
|
|
552
606
|
return IsKindOf(value, "Object");
|
|
553
607
|
}
|
|
554
|
-
function
|
|
608
|
+
function IsPromise2(value) {
|
|
555
609
|
return IsKindOf(value, "Promise");
|
|
556
610
|
}
|
|
557
611
|
function IsRecord(value) {
|
|
@@ -563,10 +617,10 @@ function IsRef(value) {
|
|
|
563
617
|
function IsRegExp2(value) {
|
|
564
618
|
return IsKindOf(value, "RegExp");
|
|
565
619
|
}
|
|
566
|
-
function
|
|
620
|
+
function IsString3(value) {
|
|
567
621
|
return IsKindOf(value, "String");
|
|
568
622
|
}
|
|
569
|
-
function
|
|
623
|
+
function IsSymbol3(value) {
|
|
570
624
|
return IsKindOf(value, "Symbol");
|
|
571
625
|
}
|
|
572
626
|
function IsTemplateLiteral(value) {
|
|
@@ -587,7 +641,7 @@ function IsUndefined3(value) {
|
|
|
587
641
|
function IsUnion(value) {
|
|
588
642
|
return IsKindOf(value, "Union");
|
|
589
643
|
}
|
|
590
|
-
function
|
|
644
|
+
function IsUint8Array3(value) {
|
|
591
645
|
return IsKindOf(value, "Uint8Array");
|
|
592
646
|
}
|
|
593
647
|
function IsUnknown(value) {
|
|
@@ -603,7 +657,7 @@ function IsKind(value) {
|
|
|
603
657
|
return IsObject(value) && Kind in value && IsString(value[Kind]);
|
|
604
658
|
}
|
|
605
659
|
function IsSchema(value) {
|
|
606
|
-
return IsAny(value) || IsArgument(value) || IsArray3(value) ||
|
|
660
|
+
return IsAny(value) || IsArgument(value) || IsArray3(value) || IsBoolean3(value) || IsBigInt3(value) || IsAsyncIterator3(value) || IsComputed(value) || IsConstructor(value) || IsDate3(value) || IsFunction3(value) || IsInteger2(value) || IsIntersect(value) || IsIterator3(value) || IsLiteral(value) || IsMappedKey(value) || IsMappedResult(value) || IsNever(value) || IsNot(value) || IsNull3(value) || IsNumber3(value) || IsObject3(value) || IsPromise2(value) || IsRecord(value) || IsRef(value) || IsRegExp2(value) || IsString3(value) || IsSymbol3(value) || IsTemplateLiteral(value) || IsThis(value) || IsTuple(value) || IsUndefined3(value) || IsUnion(value) || IsUint8Array3(value) || IsUnknown(value) || IsUnsafe(value) || IsVoid(value) || IsKind(value);
|
|
607
661
|
}
|
|
608
662
|
|
|
609
663
|
// ../../node_modules/@sinclair/typebox/build/esm/type/guard/type.mjs
|
|
@@ -612,17 +666,17 @@ __export(type_exports, {
|
|
|
612
666
|
IsAny: () => IsAny2,
|
|
613
667
|
IsArgument: () => IsArgument2,
|
|
614
668
|
IsArray: () => IsArray4,
|
|
615
|
-
IsAsyncIterator: () =>
|
|
616
|
-
IsBigInt: () =>
|
|
617
|
-
IsBoolean: () =>
|
|
669
|
+
IsAsyncIterator: () => IsAsyncIterator4,
|
|
670
|
+
IsBigInt: () => IsBigInt4,
|
|
671
|
+
IsBoolean: () => IsBoolean4,
|
|
618
672
|
IsComputed: () => IsComputed2,
|
|
619
673
|
IsConstructor: () => IsConstructor2,
|
|
620
|
-
IsDate: () =>
|
|
621
|
-
IsFunction: () =>
|
|
674
|
+
IsDate: () => IsDate4,
|
|
675
|
+
IsFunction: () => IsFunction4,
|
|
622
676
|
IsImport: () => IsImport,
|
|
623
|
-
IsInteger: () =>
|
|
677
|
+
IsInteger: () => IsInteger3,
|
|
624
678
|
IsIntersect: () => IsIntersect2,
|
|
625
|
-
IsIterator: () =>
|
|
679
|
+
IsIterator: () => IsIterator4,
|
|
626
680
|
IsKind: () => IsKind2,
|
|
627
681
|
IsKindOf: () => IsKindOf2,
|
|
628
682
|
IsLiteral: () => IsLiteral2,
|
|
@@ -634,11 +688,11 @@ __export(type_exports, {
|
|
|
634
688
|
IsMappedResult: () => IsMappedResult2,
|
|
635
689
|
IsNever: () => IsNever2,
|
|
636
690
|
IsNot: () => IsNot2,
|
|
637
|
-
IsNull: () =>
|
|
691
|
+
IsNull: () => IsNull4,
|
|
638
692
|
IsNumber: () => IsNumber4,
|
|
639
693
|
IsObject: () => IsObject4,
|
|
640
694
|
IsOptional: () => IsOptional2,
|
|
641
|
-
IsPromise: () =>
|
|
695
|
+
IsPromise: () => IsPromise3,
|
|
642
696
|
IsProperties: () => IsProperties,
|
|
643
697
|
IsReadonly: () => IsReadonly2,
|
|
644
698
|
IsRecord: () => IsRecord2,
|
|
@@ -646,13 +700,13 @@ __export(type_exports, {
|
|
|
646
700
|
IsRef: () => IsRef2,
|
|
647
701
|
IsRegExp: () => IsRegExp3,
|
|
648
702
|
IsSchema: () => IsSchema2,
|
|
649
|
-
IsString: () =>
|
|
650
|
-
IsSymbol: () =>
|
|
703
|
+
IsString: () => IsString4,
|
|
704
|
+
IsSymbol: () => IsSymbol4,
|
|
651
705
|
IsTemplateLiteral: () => IsTemplateLiteral2,
|
|
652
706
|
IsThis: () => IsThis2,
|
|
653
707
|
IsTransform: () => IsTransform2,
|
|
654
708
|
IsTuple: () => IsTuple2,
|
|
655
|
-
IsUint8Array: () =>
|
|
709
|
+
IsUint8Array: () => IsUint8Array4,
|
|
656
710
|
IsUndefined: () => IsUndefined4,
|
|
657
711
|
IsUnion: () => IsUnion2,
|
|
658
712
|
IsUnionLiteral: () => IsUnionLiteral,
|
|
@@ -758,13 +812,13 @@ function IsArgument2(value) {
|
|
|
758
812
|
function IsArray4(value) {
|
|
759
813
|
return IsKindOf2(value, "Array") && value.type === "array" && IsOptionalString(value.$id) && IsSchema2(value.items) && IsOptionalNumber(value.minItems) && IsOptionalNumber(value.maxItems) && IsOptionalBoolean(value.uniqueItems) && IsOptionalSchema(value.contains) && IsOptionalNumber(value.minContains) && IsOptionalNumber(value.maxContains);
|
|
760
814
|
}
|
|
761
|
-
function
|
|
815
|
+
function IsAsyncIterator4(value) {
|
|
762
816
|
return IsKindOf2(value, "AsyncIterator") && value.type === "AsyncIterator" && IsOptionalString(value.$id) && IsSchema2(value.items);
|
|
763
817
|
}
|
|
764
|
-
function
|
|
818
|
+
function IsBigInt4(value) {
|
|
765
819
|
return IsKindOf2(value, "BigInt") && value.type === "bigint" && IsOptionalString(value.$id) && IsOptionalBigInt(value.exclusiveMaximum) && IsOptionalBigInt(value.exclusiveMinimum) && IsOptionalBigInt(value.maximum) && IsOptionalBigInt(value.minimum) && IsOptionalBigInt(value.multipleOf);
|
|
766
820
|
}
|
|
767
|
-
function
|
|
821
|
+
function IsBoolean4(value) {
|
|
768
822
|
return IsKindOf2(value, "Boolean") && value.type === "boolean" && IsOptionalString(value.$id);
|
|
769
823
|
}
|
|
770
824
|
function IsComputed2(value) {
|
|
@@ -773,16 +827,16 @@ function IsComputed2(value) {
|
|
|
773
827
|
function IsConstructor2(value) {
|
|
774
828
|
return IsKindOf2(value, "Constructor") && value.type === "Constructor" && IsOptionalString(value.$id) && IsArray(value.parameters) && value.parameters.every((schema) => IsSchema2(schema)) && IsSchema2(value.returns);
|
|
775
829
|
}
|
|
776
|
-
function
|
|
830
|
+
function IsDate4(value) {
|
|
777
831
|
return IsKindOf2(value, "Date") && value.type === "Date" && IsOptionalString(value.$id) && IsOptionalNumber(value.exclusiveMaximumTimestamp) && IsOptionalNumber(value.exclusiveMinimumTimestamp) && IsOptionalNumber(value.maximumTimestamp) && IsOptionalNumber(value.minimumTimestamp) && IsOptionalNumber(value.multipleOfTimestamp);
|
|
778
832
|
}
|
|
779
|
-
function
|
|
833
|
+
function IsFunction4(value) {
|
|
780
834
|
return IsKindOf2(value, "Function") && value.type === "Function" && IsOptionalString(value.$id) && IsArray(value.parameters) && value.parameters.every((schema) => IsSchema2(schema)) && IsSchema2(value.returns);
|
|
781
835
|
}
|
|
782
836
|
function IsImport(value) {
|
|
783
837
|
return IsKindOf2(value, "Import") && HasPropertyKey(value, "$defs") && IsObject(value.$defs) && IsProperties(value.$defs) && HasPropertyKey(value, "$ref") && IsString(value.$ref) && value.$ref in value.$defs;
|
|
784
838
|
}
|
|
785
|
-
function
|
|
839
|
+
function IsInteger3(value) {
|
|
786
840
|
return IsKindOf2(value, "Integer") && value.type === "integer" && IsOptionalString(value.$id) && IsOptionalNumber(value.exclusiveMaximum) && IsOptionalNumber(value.exclusiveMinimum) && IsOptionalNumber(value.maximum) && IsOptionalNumber(value.minimum) && IsOptionalNumber(value.multipleOf);
|
|
787
841
|
}
|
|
788
842
|
function IsProperties(value) {
|
|
@@ -791,7 +845,7 @@ function IsProperties(value) {
|
|
|
791
845
|
function IsIntersect2(value) {
|
|
792
846
|
return IsKindOf2(value, "Intersect") && (IsString(value.type) && value.type !== "object" ? false : true) && IsArray(value.allOf) && value.allOf.every((schema) => IsSchema2(schema) && !IsTransform2(schema)) && IsOptionalString(value.type) && (IsOptionalBoolean(value.unevaluatedProperties) || IsOptionalSchema(value.unevaluatedProperties)) && IsOptionalString(value.$id);
|
|
793
847
|
}
|
|
794
|
-
function
|
|
848
|
+
function IsIterator4(value) {
|
|
795
849
|
return IsKindOf2(value, "Iterator") && value.type === "Iterator" && IsOptionalString(value.$id) && IsSchema2(value.items);
|
|
796
850
|
}
|
|
797
851
|
function IsKindOf2(value, kind) {
|
|
@@ -824,7 +878,7 @@ function IsNever2(value) {
|
|
|
824
878
|
function IsNot2(value) {
|
|
825
879
|
return IsKindOf2(value, "Not") && IsSchema2(value.not);
|
|
826
880
|
}
|
|
827
|
-
function
|
|
881
|
+
function IsNull4(value) {
|
|
828
882
|
return IsKindOf2(value, "Null") && value.type === "null" && IsOptionalString(value.$id);
|
|
829
883
|
}
|
|
830
884
|
function IsNumber4(value) {
|
|
@@ -833,7 +887,7 @@ function IsNumber4(value) {
|
|
|
833
887
|
function IsObject4(value) {
|
|
834
888
|
return IsKindOf2(value, "Object") && value.type === "object" && IsOptionalString(value.$id) && IsProperties(value.properties) && IsAdditionalProperties(value.additionalProperties) && IsOptionalNumber(value.minProperties) && IsOptionalNumber(value.maxProperties);
|
|
835
889
|
}
|
|
836
|
-
function
|
|
890
|
+
function IsPromise3(value) {
|
|
837
891
|
return IsKindOf2(value, "Promise") && value.type === "Promise" && IsOptionalString(value.$id) && IsSchema2(value.item);
|
|
838
892
|
}
|
|
839
893
|
function IsRecord2(value) {
|
|
@@ -851,10 +905,10 @@ function IsRef2(value) {
|
|
|
851
905
|
function IsRegExp3(value) {
|
|
852
906
|
return IsKindOf2(value, "RegExp") && IsOptionalString(value.$id) && IsString(value.source) && IsString(value.flags) && IsOptionalNumber(value.maxLength) && IsOptionalNumber(value.minLength);
|
|
853
907
|
}
|
|
854
|
-
function
|
|
908
|
+
function IsString4(value) {
|
|
855
909
|
return IsKindOf2(value, "String") && value.type === "string" && IsOptionalString(value.$id) && IsOptionalNumber(value.minLength) && IsOptionalNumber(value.maxLength) && IsOptionalPattern(value.pattern) && IsOptionalFormat(value.format);
|
|
856
910
|
}
|
|
857
|
-
function
|
|
911
|
+
function IsSymbol4(value) {
|
|
858
912
|
return IsKindOf2(value, "Symbol") && value.type === "symbol" && IsOptionalString(value.$id);
|
|
859
913
|
}
|
|
860
914
|
function IsTemplateLiteral2(value) {
|
|
@@ -879,7 +933,7 @@ function IsUnionLiteral(value) {
|
|
|
879
933
|
function IsUnion2(value) {
|
|
880
934
|
return IsKindOf2(value, "Union") && IsOptionalString(value.$id) && IsObject(value) && IsArray(value.anyOf) && value.anyOf.every((schema) => IsSchema2(schema));
|
|
881
935
|
}
|
|
882
|
-
function
|
|
936
|
+
function IsUint8Array4(value) {
|
|
883
937
|
return IsKindOf2(value, "Uint8Array") && value.type === "Uint8Array" && IsOptionalString(value.$id) && IsOptionalNumber(value.minByteLength) && IsOptionalNumber(value.maxByteLength);
|
|
884
938
|
}
|
|
885
939
|
function IsUnknown2(value) {
|
|
@@ -895,7 +949,7 @@ function IsKind2(value) {
|
|
|
895
949
|
return IsObject(value) && Kind in value && IsString(value[Kind]) && !KnownTypes.includes(value[Kind]);
|
|
896
950
|
}
|
|
897
951
|
function IsSchema2(value) {
|
|
898
|
-
return IsObject(value) && (IsAny2(value) || IsArgument2(value) || IsArray4(value) ||
|
|
952
|
+
return IsObject(value) && (IsAny2(value) || IsArgument2(value) || IsArray4(value) || IsBoolean4(value) || IsBigInt4(value) || IsAsyncIterator4(value) || IsComputed2(value) || IsConstructor2(value) || IsDate4(value) || IsFunction4(value) || IsInteger3(value) || IsIntersect2(value) || IsIterator4(value) || IsLiteral2(value) || IsMappedKey2(value) || IsMappedResult2(value) || IsNever2(value) || IsNot2(value) || IsNull4(value) || IsNumber4(value) || IsObject4(value) || IsPromise3(value) || IsRecord2(value) || IsRef2(value) || IsRegExp3(value) || IsString4(value) || IsSymbol4(value) || IsTemplateLiteral2(value) || IsThis2(value) || IsTuple2(value) || IsUndefined4(value) || IsUnion2(value) || IsUint8Array4(value) || IsUnknown2(value) || IsUnsafe2(value) || IsVoid2(value) || IsKind2(value));
|
|
899
953
|
}
|
|
900
954
|
|
|
901
955
|
// ../../node_modules/@sinclair/typebox/build/esm/type/patterns/patterns.mjs
|
|
@@ -908,6 +962,66 @@ var PatternNumberExact = `^${PatternNumber}$`;
|
|
|
908
962
|
var PatternStringExact = `^${PatternString}$`;
|
|
909
963
|
var PatternNeverExact = `^${PatternNever}$`;
|
|
910
964
|
|
|
965
|
+
// ../../node_modules/@sinclair/typebox/build/esm/type/registry/format.mjs
|
|
966
|
+
var format_exports = {};
|
|
967
|
+
__export(format_exports, {
|
|
968
|
+
Clear: () => Clear,
|
|
969
|
+
Delete: () => Delete,
|
|
970
|
+
Entries: () => Entries,
|
|
971
|
+
Get: () => Get,
|
|
972
|
+
Has: () => Has,
|
|
973
|
+
Set: () => Set2
|
|
974
|
+
});
|
|
975
|
+
var map = /* @__PURE__ */ new Map();
|
|
976
|
+
function Entries() {
|
|
977
|
+
return new Map(map);
|
|
978
|
+
}
|
|
979
|
+
function Clear() {
|
|
980
|
+
return map.clear();
|
|
981
|
+
}
|
|
982
|
+
function Delete(format) {
|
|
983
|
+
return map.delete(format);
|
|
984
|
+
}
|
|
985
|
+
function Has(format) {
|
|
986
|
+
return map.has(format);
|
|
987
|
+
}
|
|
988
|
+
function Set2(format, func) {
|
|
989
|
+
map.set(format, func);
|
|
990
|
+
}
|
|
991
|
+
function Get(format) {
|
|
992
|
+
return map.get(format);
|
|
993
|
+
}
|
|
994
|
+
|
|
995
|
+
// ../../node_modules/@sinclair/typebox/build/esm/type/registry/type.mjs
|
|
996
|
+
var type_exports2 = {};
|
|
997
|
+
__export(type_exports2, {
|
|
998
|
+
Clear: () => Clear2,
|
|
999
|
+
Delete: () => Delete2,
|
|
1000
|
+
Entries: () => Entries2,
|
|
1001
|
+
Get: () => Get2,
|
|
1002
|
+
Has: () => Has2,
|
|
1003
|
+
Set: () => Set3
|
|
1004
|
+
});
|
|
1005
|
+
var map2 = /* @__PURE__ */ new Map();
|
|
1006
|
+
function Entries2() {
|
|
1007
|
+
return new Map(map2);
|
|
1008
|
+
}
|
|
1009
|
+
function Clear2() {
|
|
1010
|
+
return map2.clear();
|
|
1011
|
+
}
|
|
1012
|
+
function Delete2(kind) {
|
|
1013
|
+
return map2.delete(kind);
|
|
1014
|
+
}
|
|
1015
|
+
function Has2(kind) {
|
|
1016
|
+
return map2.has(kind);
|
|
1017
|
+
}
|
|
1018
|
+
function Set3(kind, func) {
|
|
1019
|
+
map2.set(kind, func);
|
|
1020
|
+
}
|
|
1021
|
+
function Get2(kind) {
|
|
1022
|
+
return map2.get(kind);
|
|
1023
|
+
}
|
|
1024
|
+
|
|
911
1025
|
// ../../node_modules/@sinclair/typebox/build/esm/type/sets/set.mjs
|
|
912
1026
|
function SetIncludes(T, S) {
|
|
913
1027
|
return T.includes(S);
|
|
@@ -1211,7 +1325,7 @@ function Boolean(options) {
|
|
|
1211
1325
|
}
|
|
1212
1326
|
|
|
1213
1327
|
// ../../node_modules/@sinclair/typebox/build/esm/type/bigint/bigint.mjs
|
|
1214
|
-
function
|
|
1328
|
+
function BigInt2(options) {
|
|
1215
1329
|
return CreateType({ [Kind]: "BigInt", type: "bigint" }, options);
|
|
1216
1330
|
}
|
|
1217
1331
|
|
|
@@ -1228,7 +1342,7 @@ function String2(options) {
|
|
|
1228
1342
|
// ../../node_modules/@sinclair/typebox/build/esm/type/template-literal/syntax.mjs
|
|
1229
1343
|
function* FromUnion(syntax) {
|
|
1230
1344
|
const trim = syntax.trim().replace(/"|'/g, "");
|
|
1231
|
-
return trim === "boolean" ? yield Boolean() : trim === "number" ? yield Number2() : trim === "bigint" ? yield
|
|
1345
|
+
return trim === "boolean" ? yield Boolean() : trim === "number" ? yield Number2() : trim === "bigint" ? yield BigInt2() : trim === "string" ? yield String2() : yield (() => {
|
|
1232
1346
|
const literals = trim.split("|").map((literal) => Literal(literal.trim()));
|
|
1233
1347
|
return literals.length === 0 ? Never() : literals.length === 1 ? literals[0] : UnionEvaluated(literals);
|
|
1234
1348
|
})();
|
|
@@ -1269,7 +1383,7 @@ function Escape(value) {
|
|
|
1269
1383
|
return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
1270
1384
|
}
|
|
1271
1385
|
function Visit2(schema, acc) {
|
|
1272
|
-
return IsTemplateLiteral(schema) ? schema.pattern.slice(1, schema.pattern.length - 1) : IsUnion(schema) ? `(${schema.anyOf.map((schema2) => Visit2(schema2, acc)).join("|")})` : IsNumber3(schema) ? `${acc}${PatternNumber}` :
|
|
1386
|
+
return IsTemplateLiteral(schema) ? schema.pattern.slice(1, schema.pattern.length - 1) : IsUnion(schema) ? `(${schema.anyOf.map((schema2) => Visit2(schema2, acc)).join("|")})` : IsNumber3(schema) ? `${acc}${PatternNumber}` : IsInteger2(schema) ? `${acc}${PatternNumber}` : IsBigInt3(schema) ? `${acc}${PatternNumber}` : IsString3(schema) ? `${acc}${PatternString}` : IsLiteral(schema) ? `${acc}${Escape(schema.const.toString())}` : IsBoolean3(schema) ? `${acc}${PatternBoolean}` : (() => {
|
|
1273
1387
|
throw new TemplateLiteralPatternError(`Unexpected Kind '${schema[Kind]}'`);
|
|
1274
1388
|
})();
|
|
1275
1389
|
}
|
|
@@ -1305,7 +1419,7 @@ function FromLiteral(literalValue) {
|
|
|
1305
1419
|
return [literalValue.toString()];
|
|
1306
1420
|
}
|
|
1307
1421
|
function IndexPropertyKeys(type) {
|
|
1308
|
-
return [...new Set(IsTemplateLiteral(type) ? FromTemplateLiteral(type) : IsUnion(type) ? FromUnion2(type.anyOf) : IsLiteral(type) ? FromLiteral(type.const) : IsNumber3(type) ? ["[number]"] :
|
|
1422
|
+
return [...new Set(IsTemplateLiteral(type) ? FromTemplateLiteral(type) : IsUnion(type) ? FromUnion2(type.anyOf) : IsLiteral(type) ? FromLiteral(type.const) : IsNumber3(type) ? ["[number]"] : IsInteger2(type) ? ["[number]"] : [])];
|
|
1309
1423
|
}
|
|
1310
1424
|
|
|
1311
1425
|
// ../../node_modules/@sinclair/typebox/build/esm/type/indexed/indexed-from-mapped-result.mjs
|
|
@@ -1482,7 +1596,7 @@ function FromSchemaType(K, T) {
|
|
|
1482
1596
|
// unevaluated mapped types
|
|
1483
1597
|
IsMappedResult(T) ? FromMappedResult3(K, T.properties) : IsMappedKey(T) ? FromMappedKey(K, T.keys) : (
|
|
1484
1598
|
// unevaluated types
|
|
1485
|
-
IsConstructor(T) ? Constructor(FromRest2(K, T.parameters), FromSchemaType(K, T.returns), options) :
|
|
1599
|
+
IsConstructor(T) ? Constructor(FromRest2(K, T.parameters), FromSchemaType(K, T.returns), options) : IsFunction3(T) ? Function(FromRest2(K, T.parameters), FromSchemaType(K, T.returns), options) : IsAsyncIterator3(T) ? AsyncIterator(FromSchemaType(K, T.items), options) : IsIterator3(T) ? Iterator(FromSchemaType(K, T.items), options) : IsIntersect(T) ? Intersect(FromRest2(K, T.allOf), options) : IsUnion(T) ? Union(FromRest2(K, T.anyOf), options) : IsTuple(T) ? Tuple(FromRest2(K, T.items ?? []), options) : IsObject3(T) ? Object2(FromProperties3(K, T.properties), options) : IsArray3(T) ? Array2(FromSchemaType(K, T.items), options) : IsPromise2(T) ? Promise2(FromSchemaType(K, T.item), options) : T
|
|
1486
1600
|
)
|
|
1487
1601
|
)
|
|
1488
1602
|
);
|
|
@@ -1493,9 +1607,9 @@ function MappedFunctionReturnType(K, T) {
|
|
|
1493
1607
|
Acc[L] = FromSchemaType(L, T);
|
|
1494
1608
|
return Acc;
|
|
1495
1609
|
}
|
|
1496
|
-
function Mapped(key,
|
|
1610
|
+
function Mapped(key, map3, options) {
|
|
1497
1611
|
const K = IsSchema(key) ? IndexPropertyKeys(key) : key;
|
|
1498
|
-
const RT =
|
|
1612
|
+
const RT = map3({ [Kind]: "MappedKey", keys: K });
|
|
1499
1613
|
const R = MappedFunctionReturnType(K, RT);
|
|
1500
1614
|
return Object2(R, options);
|
|
1501
1615
|
}
|
|
@@ -1599,7 +1713,7 @@ function FromRest3(types) {
|
|
|
1599
1713
|
return types.map((type) => Awaited(type));
|
|
1600
1714
|
}
|
|
1601
1715
|
function Awaited(type, options) {
|
|
1602
|
-
return CreateType(IsComputed(type) ? FromComputed(type.target, type.parameters) : IsIntersect(type) ? FromIntersect2(type.allOf) : IsUnion(type) ? FromUnion4(type.anyOf) :
|
|
1716
|
+
return CreateType(IsComputed(type) ? FromComputed(type.target, type.parameters) : IsIntersect(type) ? FromIntersect2(type.allOf) : IsUnion(type) ? FromUnion4(type.anyOf) : IsPromise2(type) ? FromPromise(type.item) : IsRef(type) ? FromRef(type.$ref) : type, options);
|
|
1603
1717
|
}
|
|
1604
1718
|
|
|
1605
1719
|
// ../../node_modules/@sinclair/typebox/build/esm/type/keyof/keyof-property-keys.mjs
|
|
@@ -1640,6 +1754,13 @@ function KeyOfPropertyKeys(type) {
|
|
|
1640
1754
|
return IsIntersect(type) ? FromIntersect3(type.allOf) : IsUnion(type) ? FromUnion5(type.anyOf) : IsTuple(type) ? FromTuple2(type.items ?? []) : IsArray3(type) ? FromArray2(type.items) : IsObject3(type) ? FromProperties5(type.properties) : IsRecord(type) ? FromPatternProperties(type.patternProperties) : [];
|
|
1641
1755
|
}
|
|
1642
1756
|
var includePatternProperties = false;
|
|
1757
|
+
function KeyOfPattern(schema) {
|
|
1758
|
+
includePatternProperties = true;
|
|
1759
|
+
const keys = KeyOfPropertyKeys(schema);
|
|
1760
|
+
includePatternProperties = false;
|
|
1761
|
+
const pattern = keys.map((key) => `(${key})`);
|
|
1762
|
+
return `^(${pattern.join("|")})$`;
|
|
1763
|
+
}
|
|
1643
1764
|
|
|
1644
1765
|
// ../../node_modules/@sinclair/typebox/build/esm/type/keyof/keyof.mjs
|
|
1645
1766
|
function FromComputed2(target, parameters) {
|
|
@@ -1676,6 +1797,13 @@ function KeyOfFromMappedResult(mappedResult, options) {
|
|
|
1676
1797
|
return MappedResult(properties);
|
|
1677
1798
|
}
|
|
1678
1799
|
|
|
1800
|
+
// ../../node_modules/@sinclair/typebox/build/esm/type/keyof/keyof-property-entries.mjs
|
|
1801
|
+
function KeyOfPropertyEntries(schema) {
|
|
1802
|
+
const keys = KeyOfPropertyKeys(schema);
|
|
1803
|
+
const schemas = IndexFromPropertyKeys(schema, keys);
|
|
1804
|
+
return keys.map((_, index) => [keys[index], schemas[index]]);
|
|
1805
|
+
}
|
|
1806
|
+
|
|
1679
1807
|
// ../../node_modules/@sinclair/typebox/build/esm/type/composite/composite.mjs
|
|
1680
1808
|
function CompositeKeys(T) {
|
|
1681
1809
|
const Acc = [];
|
|
@@ -1750,7 +1878,7 @@ function ConditionalReadonly(T, root) {
|
|
|
1750
1878
|
return root === true ? T : Readonly(T);
|
|
1751
1879
|
}
|
|
1752
1880
|
function FromValue(value, root) {
|
|
1753
|
-
return IsAsyncIterator(value) ? ConditionalReadonly(Any(), root) : IsIterator(value) ? ConditionalReadonly(Any(), root) : IsArray(value) ? Readonly(Tuple(FromArray3(value))) : IsUint8Array(value) ? Uint8Array2() : IsDate(value) ? Date2() : IsObject(value) ? ConditionalReadonly(Object2(FromProperties7(value)), root) : IsFunction(value) ? ConditionalReadonly(Function([], Unknown()), root) : IsUndefined(value) ? Undefined() : IsNull(value) ? Null() : IsSymbol(value) ? Symbol2() : IsBigInt(value) ?
|
|
1881
|
+
return IsAsyncIterator(value) ? ConditionalReadonly(Any(), root) : IsIterator(value) ? ConditionalReadonly(Any(), root) : IsArray(value) ? Readonly(Tuple(FromArray3(value))) : IsUint8Array(value) ? Uint8Array2() : IsDate(value) ? Date2() : IsObject(value) ? ConditionalReadonly(Object2(FromProperties7(value)), root) : IsFunction(value) ? ConditionalReadonly(Function([], Unknown()), root) : IsUndefined(value) ? Undefined() : IsNull(value) ? Null() : IsSymbol(value) ? Symbol2() : IsBigInt(value) ? BigInt2() : IsNumber(value) ? Literal(value) : IsBoolean(value) ? Literal(value) : IsString(value) ? Literal(value) : Object2({});
|
|
1754
1882
|
}
|
|
1755
1883
|
function Const(T, options) {
|
|
1756
1884
|
return CreateType(FromValue(T, true), options);
|
|
@@ -2065,6 +2193,20 @@ function ExtendsFromMappedKey(T, U, L, R, options) {
|
|
|
2065
2193
|
return MappedResult(P);
|
|
2066
2194
|
}
|
|
2067
2195
|
|
|
2196
|
+
// ../../node_modules/@sinclair/typebox/build/esm/type/extends/extends-undefined.mjs
|
|
2197
|
+
function Intersect2(schema) {
|
|
2198
|
+
return schema.allOf.every((schema2) => ExtendsUndefinedCheck(schema2));
|
|
2199
|
+
}
|
|
2200
|
+
function Union2(schema) {
|
|
2201
|
+
return schema.anyOf.some((schema2) => ExtendsUndefinedCheck(schema2));
|
|
2202
|
+
}
|
|
2203
|
+
function Not(schema) {
|
|
2204
|
+
return !ExtendsUndefinedCheck(schema.not);
|
|
2205
|
+
}
|
|
2206
|
+
function ExtendsUndefinedCheck(schema) {
|
|
2207
|
+
return schema[Kind] === "Intersect" ? Intersect2(schema) : schema[Kind] === "Union" ? Union2(schema) : schema[Kind] === "Not" ? Not(schema) : schema[Kind] === "Undefined" ? true : false;
|
|
2208
|
+
}
|
|
2209
|
+
|
|
2068
2210
|
// ../../node_modules/@sinclair/typebox/build/esm/type/exclude/exclude-from-template-literal.mjs
|
|
2069
2211
|
function ExcludeFromTemplateLiteral(L, R) {
|
|
2070
2212
|
return Exclude(TemplateLiteralToUnion(L), R);
|
|
@@ -2183,7 +2325,7 @@ function FromNumberKey(_, type, options) {
|
|
|
2183
2325
|
return RecordCreateFromPattern(PatternNumberExact, type, options);
|
|
2184
2326
|
}
|
|
2185
2327
|
function Record(key, type, options = {}) {
|
|
2186
|
-
return IsUnion(key) ? FromUnionKey(key.anyOf, type, options) : IsTemplateLiteral(key) ? FromTemplateLiteralKey(key, type, options) : IsLiteral(key) ? FromLiteralKey(key.const, type, options) :
|
|
2328
|
+
return IsUnion(key) ? FromUnionKey(key.anyOf, type, options) : IsTemplateLiteral(key) ? FromTemplateLiteralKey(key, type, options) : IsLiteral(key) ? FromLiteralKey(key.const, type, options) : IsBoolean3(key) ? FromBooleanKey(key, type, options) : IsInteger2(key) ? FromIntegerKey(key, type, options) : IsNumber3(key) ? FromNumberKey(key, type, options) : IsRegExp2(key) ? FromRegExpKey(key, type, options) : IsString3(key) ? FromStringKey(key, type, options) : IsAny(key) ? FromAnyKey(key, type, options) : IsNever(key) ? FromNeverKey(key, type, options) : Never(options);
|
|
2187
2329
|
}
|
|
2188
2330
|
function RecordPattern(record) {
|
|
2189
2331
|
return globalThis.Object.getOwnPropertyNames(record.patternProperties)[0];
|
|
@@ -2265,7 +2407,7 @@ function FromTypes(args, types) {
|
|
|
2265
2407
|
return types.map((type) => FromType(args, type));
|
|
2266
2408
|
}
|
|
2267
2409
|
function FromType(args, type) {
|
|
2268
|
-
return IsConstructor(type) ? FromConstructor2(args, type) :
|
|
2410
|
+
return IsConstructor(type) ? FromConstructor2(args, type) : IsFunction3(type) ? FromFunction2(args, type) : IsIntersect(type) ? FromIntersect5(args, type) : IsUnion(type) ? FromUnion7(args, type) : IsTuple(type) ? FromTuple4(args, type) : IsArray3(type) ? FromArray5(args, type) : IsAsyncIterator3(type) ? FromAsyncIterator2(args, type) : IsIterator3(type) ? FromIterator2(args, type) : IsPromise2(type) ? FromPromise3(args, type) : IsObject3(type) ? FromObject2(args, type) : IsRecord(type) ? FromRecord2(args, type) : IsArgument(type) ? FromArgument(args, type) : type;
|
|
2269
2411
|
}
|
|
2270
2412
|
function Instantiate(type, args) {
|
|
2271
2413
|
return FromType(args, CloneType(type));
|
|
@@ -2521,7 +2663,7 @@ function PartialResolve(type) {
|
|
|
2521
2663
|
// Mappable
|
|
2522
2664
|
IsComputed(type) ? FromComputed3(type.target, type.parameters) : IsRef(type) ? FromRef3(type.$ref) : IsIntersect(type) ? Intersect(FromRest6(type.allOf)) : IsUnion(type) ? Union(FromRest6(type.anyOf)) : IsObject3(type) ? FromObject5(type, type.properties) : (
|
|
2523
2665
|
// Intrinsic
|
|
2524
|
-
|
|
2666
|
+
IsBigInt3(type) ? type : IsBoolean3(type) ? type : IsInteger2(type) ? type : IsLiteral(type) ? type : IsNull3(type) ? type : IsNumber3(type) ? type : IsString3(type) ? type : IsSymbol3(type) ? type : IsUndefined3(type) ? type : (
|
|
2525
2667
|
// Passthrough
|
|
2526
2668
|
Object2({})
|
|
2527
2669
|
)
|
|
@@ -2577,7 +2719,7 @@ function RequiredResolve(type) {
|
|
|
2577
2719
|
// Mappable
|
|
2578
2720
|
IsComputed(type) ? FromComputed4(type.target, type.parameters) : IsRef(type) ? FromRef4(type.$ref) : IsIntersect(type) ? Intersect(FromRest7(type.allOf)) : IsUnion(type) ? Union(FromRest7(type.anyOf)) : IsObject3(type) ? FromObject6(type, type.properties) : (
|
|
2579
2721
|
// Intrinsic
|
|
2580
|
-
|
|
2722
|
+
IsBigInt3(type) ? type : IsBoolean3(type) ? type : IsInteger2(type) ? type : IsLiteral(type) ? type : IsNull3(type) ? type : IsNumber3(type) ? type : IsString3(type) ? type : IsSymbol3(type) ? type : IsUndefined3(type) ? type : (
|
|
2581
2723
|
// Passthrough
|
|
2582
2724
|
Object2({})
|
|
2583
2725
|
)
|
|
@@ -2689,7 +2831,7 @@ function FromType2(moduleProperties, type) {
|
|
|
2689
2831
|
// Transform
|
|
2690
2832
|
IsTransform(type) ? CreateType(FromTransform(moduleProperties, type), type) : (
|
|
2691
2833
|
// Types
|
|
2692
|
-
IsArray3(type) ? CreateType(FromArray6(moduleProperties, type.items), type) :
|
|
2834
|
+
IsArray3(type) ? CreateType(FromArray6(moduleProperties, type.items), type) : IsAsyncIterator3(type) ? CreateType(FromAsyncIterator3(moduleProperties, type.items), type) : IsComputed(type) ? CreateType(FromComputed5(moduleProperties, type.target, type.parameters)) : IsConstructor(type) ? CreateType(FromConstructor3(moduleProperties, type.parameters, type.returns), type) : IsFunction3(type) ? CreateType(FromFunction3(moduleProperties, type.parameters, type.returns), type) : IsIntersect(type) ? CreateType(FromIntersect8(moduleProperties, type.allOf), type) : IsIterator3(type) ? CreateType(FromIterator3(moduleProperties, type.items), type) : IsObject3(type) ? CreateType(FromObject7(moduleProperties, type.properties), type) : IsRecord(type) ? CreateType(FromRecord3(moduleProperties, type)) : IsTuple(type) ? CreateType(FromTuple5(moduleProperties, type.items || []), type) : IsUnion(type) ? CreateType(FromUnion10(moduleProperties, type.anyOf), type) : type
|
|
2693
2835
|
)
|
|
2694
2836
|
)
|
|
2695
2837
|
);
|
|
@@ -2727,13 +2869,13 @@ function Module(properties) {
|
|
|
2727
2869
|
}
|
|
2728
2870
|
|
|
2729
2871
|
// ../../node_modules/@sinclair/typebox/build/esm/type/not/not.mjs
|
|
2730
|
-
function
|
|
2872
|
+
function Not2(type, options) {
|
|
2731
2873
|
return CreateType({ [Kind]: "Not", not: type }, options);
|
|
2732
2874
|
}
|
|
2733
2875
|
|
|
2734
2876
|
// ../../node_modules/@sinclair/typebox/build/esm/type/parameters/parameters.mjs
|
|
2735
2877
|
function Parameters(schema, options) {
|
|
2736
|
-
return
|
|
2878
|
+
return IsFunction3(schema) ? Tuple(schema.parameters, options) : Never();
|
|
2737
2879
|
}
|
|
2738
2880
|
|
|
2739
2881
|
// ../../node_modules/@sinclair/typebox/build/esm/type/recursive/recursive.mjs
|
|
@@ -2762,7 +2904,7 @@ function Rest(T) {
|
|
|
2762
2904
|
|
|
2763
2905
|
// ../../node_modules/@sinclair/typebox/build/esm/type/return-type/return-type.mjs
|
|
2764
2906
|
function ReturnType(schema, options) {
|
|
2765
|
-
return
|
|
2907
|
+
return IsFunction3(schema) ? CreateType(schema.returns, options) : Never(options);
|
|
2766
2908
|
}
|
|
2767
2909
|
|
|
2768
2910
|
// ../../node_modules/@sinclair/typebox/build/esm/type/transform/transform.mjs
|
|
@@ -2780,9 +2922,9 @@ var TransformEncodeBuilder = class {
|
|
|
2780
2922
|
this.decode = decode;
|
|
2781
2923
|
}
|
|
2782
2924
|
EncodeTransform(encode, schema) {
|
|
2783
|
-
const
|
|
2784
|
-
const
|
|
2785
|
-
const Codec = { Encode, Decode };
|
|
2925
|
+
const Encode2 = (value) => schema[TransformKind].Encode(encode(value));
|
|
2926
|
+
const Decode2 = (value) => this.decode(schema[TransformKind].Decode(value));
|
|
2927
|
+
const Codec = { Encode: Encode2, Decode: Decode2 };
|
|
2786
2928
|
return { ...schema, [TransformKind]: Codec };
|
|
2787
2929
|
}
|
|
2788
2930
|
EncodeSchema(encode, schema) {
|
|
@@ -2808,14 +2950,14 @@ function Void(options) {
|
|
|
2808
2950
|
}
|
|
2809
2951
|
|
|
2810
2952
|
// ../../node_modules/@sinclair/typebox/build/esm/type/type/type.mjs
|
|
2811
|
-
var
|
|
2812
|
-
__export(
|
|
2953
|
+
var type_exports3 = {};
|
|
2954
|
+
__export(type_exports3, {
|
|
2813
2955
|
Any: () => Any,
|
|
2814
2956
|
Argument: () => Argument,
|
|
2815
2957
|
Array: () => Array2,
|
|
2816
2958
|
AsyncIterator: () => AsyncIterator,
|
|
2817
2959
|
Awaited: () => Awaited,
|
|
2818
|
-
BigInt: () =>
|
|
2960
|
+
BigInt: () => BigInt2,
|
|
2819
2961
|
Boolean: () => Boolean,
|
|
2820
2962
|
Capitalize: () => Capitalize,
|
|
2821
2963
|
Composite: () => Composite,
|
|
@@ -2840,7 +2982,7 @@ __export(type_exports2, {
|
|
|
2840
2982
|
Mapped: () => Mapped,
|
|
2841
2983
|
Module: () => Module,
|
|
2842
2984
|
Never: () => Never,
|
|
2843
|
-
Not: () =>
|
|
2985
|
+
Not: () => Not2,
|
|
2844
2986
|
Null: () => Null,
|
|
2845
2987
|
Number: () => Number2,
|
|
2846
2988
|
Object: () => Object2,
|
|
@@ -2875,7 +3017,7 @@ __export(type_exports2, {
|
|
|
2875
3017
|
});
|
|
2876
3018
|
|
|
2877
3019
|
// ../../node_modules/@sinclair/typebox/build/esm/type/type/index.mjs
|
|
2878
|
-
var Type =
|
|
3020
|
+
var Type = type_exports3;
|
|
2879
3021
|
|
|
2880
3022
|
// ../../packages/ai/src/api-registry.ts
|
|
2881
3023
|
var apiProviderRegistry = /* @__PURE__ */ new Map();
|
|
@@ -2896,21 +3038,120 @@ var PROVIDER_ENV_MAP = {
|
|
|
2896
3038
|
"bigmodel": "BIGMODEL_API_KEY",
|
|
2897
3039
|
"openai": "OPENAI_API_KEY",
|
|
2898
3040
|
"anthropic": "ANTHROPIC_API_KEY",
|
|
2899
|
-
"openrouter": "OPENROUTER_API_KEY"
|
|
3041
|
+
"openrouter": "OPENROUTER_API_KEY",
|
|
3042
|
+
google: "GOOGLE_API_KEY",
|
|
3043
|
+
gemini: "GOOGLE_API_KEY",
|
|
3044
|
+
"cy-gpt": "CY_GPT_API_KEY",
|
|
3045
|
+
"cy-gpt2": "CY_GPT2_API_KEY",
|
|
3046
|
+
"kimi-api": "KIMI_API_KEY",
|
|
3047
|
+
"kimi-coding": "KIMI_API_KEY"
|
|
2900
3048
|
};
|
|
3049
|
+
function getProviderEnvVar(provider) {
|
|
3050
|
+
return PROVIDER_ENV_MAP[provider] || `${provider.toUpperCase().replace(/-/g, "_")}_API_KEY`;
|
|
3051
|
+
}
|
|
2901
3052
|
function getEnvApiKey(provider) {
|
|
2902
3053
|
const env = typeof process !== "undefined" ? process.env : {};
|
|
2903
|
-
const explicitEnv =
|
|
3054
|
+
const explicitEnv = getProviderEnvVar(provider);
|
|
2904
3055
|
if (explicitEnv) {
|
|
2905
3056
|
const value = env[explicitEnv];
|
|
2906
3057
|
if (value) return value;
|
|
2907
3058
|
}
|
|
2908
|
-
const autoEnvVar = provider.toUpperCase().replace(/-/g, "_") + "_API_KEY";
|
|
2909
|
-
const fromAuto = env[autoEnvVar];
|
|
2910
|
-
if (fromAuto) return fromAuto;
|
|
2911
3059
|
return void 0;
|
|
2912
3060
|
}
|
|
2913
3061
|
|
|
3062
|
+
// ../../packages/ai/src/models.builtins.ts
|
|
3063
|
+
var BUILTIN_MODEL_DEFINITIONS = {
|
|
3064
|
+
"kimi-cn": {
|
|
3065
|
+
"kimi-k2.5": {
|
|
3066
|
+
name: "Kimi K2.5",
|
|
3067
|
+
api: "openai-completions",
|
|
3068
|
+
provider: "kimi-cn",
|
|
3069
|
+
baseUrl: "https://api.moonshot.cn/v1",
|
|
3070
|
+
reasoning: true,
|
|
3071
|
+
input: ["text", "image"],
|
|
3072
|
+
cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 },
|
|
3073
|
+
contextWindow: 262144,
|
|
3074
|
+
maxTokens: 8192
|
|
3075
|
+
},
|
|
3076
|
+
"kimi-k2": {
|
|
3077
|
+
name: "Kimi K2",
|
|
3078
|
+
api: "openai-completions",
|
|
3079
|
+
provider: "kimi-cn",
|
|
3080
|
+
baseUrl: "https://api.moonshot.cn/v1",
|
|
3081
|
+
reasoning: false,
|
|
3082
|
+
input: ["text"],
|
|
3083
|
+
cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 },
|
|
3084
|
+
contextWindow: 131072,
|
|
3085
|
+
maxTokens: 8192
|
|
3086
|
+
},
|
|
3087
|
+
"moonshot-v1-128k": {
|
|
3088
|
+
name: "Moonshot V1 128K",
|
|
3089
|
+
api: "openai-completions",
|
|
3090
|
+
provider: "kimi-cn",
|
|
3091
|
+
baseUrl: "https://api.moonshot.cn/v1",
|
|
3092
|
+
reasoning: false,
|
|
3093
|
+
input: ["text"],
|
|
3094
|
+
cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 },
|
|
3095
|
+
contextWindow: 131072,
|
|
3096
|
+
maxTokens: 8192
|
|
3097
|
+
},
|
|
3098
|
+
"moonshot-v1-32k": {
|
|
3099
|
+
name: "Moonshot V1 32K",
|
|
3100
|
+
api: "openai-completions",
|
|
3101
|
+
provider: "kimi-cn",
|
|
3102
|
+
baseUrl: "https://api.moonshot.cn/v1",
|
|
3103
|
+
reasoning: false,
|
|
3104
|
+
input: ["text"],
|
|
3105
|
+
cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 },
|
|
3106
|
+
contextWindow: 32768,
|
|
3107
|
+
maxTokens: 8192
|
|
3108
|
+
}
|
|
3109
|
+
},
|
|
3110
|
+
bigmodel: {
|
|
3111
|
+
"glm-5": {
|
|
3112
|
+
name: "GLM-5",
|
|
3113
|
+
api: "openai-completions",
|
|
3114
|
+
provider: "bigmodel",
|
|
3115
|
+
baseUrl: "https://open.bigmodel.cn/api/paas/v4",
|
|
3116
|
+
reasoning: true,
|
|
3117
|
+
input: ["text"],
|
|
3118
|
+
cost: { input: 1, output: 3.2, cacheRead: 0, cacheWrite: 0 },
|
|
3119
|
+
contextWindow: 131072,
|
|
3120
|
+
maxTokens: 8192,
|
|
3121
|
+
compat: {
|
|
3122
|
+
supportsDeveloperRole: false
|
|
3123
|
+
}
|
|
3124
|
+
},
|
|
3125
|
+
"glm-5-flash": {
|
|
3126
|
+
name: "GLM-5 Flash",
|
|
3127
|
+
api: "openai-completions",
|
|
3128
|
+
provider: "bigmodel",
|
|
3129
|
+
baseUrl: "https://open.bigmodel.cn/api/paas/v4",
|
|
3130
|
+
reasoning: false,
|
|
3131
|
+
input: ["text"],
|
|
3132
|
+
cost: { input: 0.5, output: 1.5, cacheRead: 0, cacheWrite: 0 },
|
|
3133
|
+
contextWindow: 131072,
|
|
3134
|
+
maxTokens: 8192,
|
|
3135
|
+
compat: {
|
|
3136
|
+
supportsDeveloperRole: false
|
|
3137
|
+
}
|
|
3138
|
+
},
|
|
3139
|
+
"glm-4-plus": {
|
|
3140
|
+
name: "GLM-4 Plus",
|
|
3141
|
+
api: "openai-completions",
|
|
3142
|
+
provider: "bigmodel",
|
|
3143
|
+
baseUrl: "https://open.bigmodel.cn/api/paas/v4",
|
|
3144
|
+
reasoning: false,
|
|
3145
|
+
input: ["text", "image"],
|
|
3146
|
+
cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 },
|
|
3147
|
+
contextWindow: 128e3,
|
|
3148
|
+
maxTokens: 4096
|
|
3149
|
+
}
|
|
3150
|
+
}
|
|
3151
|
+
};
|
|
3152
|
+
var KIMI_MODEL_DEFINITIONS = BUILTIN_MODEL_DEFINITIONS["kimi-cn"];
|
|
3153
|
+
var GLM_MODEL_DEFINITIONS = BUILTIN_MODEL_DEFINITIONS.bigmodel;
|
|
3154
|
+
|
|
2914
3155
|
// ../../packages/ai/src/models.ts
|
|
2915
3156
|
function calculateCost(model, usage) {
|
|
2916
3157
|
const input = model.cost.input / 1e6 * usage.input;
|
|
@@ -3442,6 +3683,9 @@ var _procEnv = typeof process !== "undefined" ? process.env : {};
|
|
|
3442
3683
|
var DEBUG = _procEnv.PIE_DEBUG_HTTP === "1" || _procEnv.PIE_DEBUG_HTTP === "true";
|
|
3443
3684
|
var LOG_TO_FILE = _procEnv.PIE_DEBUG_HTTP_FILE === "1" || _procEnv.PIE_DEBUG_HTTP_FILE === "true";
|
|
3444
3685
|
var logFilePath = null;
|
|
3686
|
+
function isTuiSessionActive() {
|
|
3687
|
+
return _procEnv.PIE_TUI_ACTIVE === "1" || _procEnv.PIE_TUI_ACTIVE === "true";
|
|
3688
|
+
}
|
|
3445
3689
|
function initLogFile() {
|
|
3446
3690
|
if (!LOG_TO_FILE) return null;
|
|
3447
3691
|
try {
|
|
@@ -3460,7 +3704,7 @@ function logHttp(level, message, data) {
|
|
|
3460
3704
|
const timestamp = (/* @__PURE__ */ new Date()).toISOString();
|
|
3461
3705
|
const prefix = `[${timestamp}] [HTTP:${level}]`;
|
|
3462
3706
|
const logLine = data ? `${prefix} ${message} ${JSON.stringify(data)}` : `${prefix} ${message}`;
|
|
3463
|
-
if (level === "ERROR") {
|
|
3707
|
+
if (level === "ERROR" && !isTuiSessionActive()) {
|
|
3464
3708
|
console.error(logLine);
|
|
3465
3709
|
} else if (DEBUG) {
|
|
3466
3710
|
console.error(logLine);
|
|
@@ -4120,6 +4364,20 @@ function transformMessages(messages, model, normalizeToolCallId2) {
|
|
|
4120
4364
|
result.push(msg);
|
|
4121
4365
|
}
|
|
4122
4366
|
}
|
|
4367
|
+
if (pendingToolCalls.length > 0) {
|
|
4368
|
+
for (const tc of pendingToolCalls) {
|
|
4369
|
+
if (!existingToolResultIds.has(tc.id)) {
|
|
4370
|
+
result.push({
|
|
4371
|
+
role: "toolResult",
|
|
4372
|
+
toolCallId: tc.id,
|
|
4373
|
+
toolName: tc.name,
|
|
4374
|
+
content: [{ type: "text", text: "No result provided" }],
|
|
4375
|
+
isError: true,
|
|
4376
|
+
timestamp: Date.now()
|
|
4377
|
+
});
|
|
4378
|
+
}
|
|
4379
|
+
}
|
|
4380
|
+
}
|
|
4123
4381
|
return result;
|
|
4124
4382
|
}
|
|
4125
4383
|
|
|
@@ -4443,17 +4701,13 @@ function convertMessages(model, context, compat) {
|
|
|
4443
4701
|
if (typeof msg.content === "string") {
|
|
4444
4702
|
params.push({ role: "user", content: msg.content });
|
|
4445
4703
|
} else {
|
|
4446
|
-
const content = msg.content.
|
|
4447
|
-
|
|
4448
|
-
|
|
4449
|
-
|
|
4450
|
-
|
|
4451
|
-
|
|
4452
|
-
image_url: { url: `data:${item.mimeType};base64,${item.data}` }
|
|
4453
|
-
};
|
|
4454
|
-
}
|
|
4704
|
+
const content = msg.content.flatMap((item) => convertUserContentItem(item));
|
|
4705
|
+
const filteredContent = content.filter((c) => {
|
|
4706
|
+
if (c.type === "text") return true;
|
|
4707
|
+
if (c.type === "image_url") return model.input.includes("image");
|
|
4708
|
+
if (c.type === "video_url") return model.input.includes("video");
|
|
4709
|
+
return true;
|
|
4455
4710
|
});
|
|
4456
|
-
const filteredContent = !model.input.includes("image") ? content.filter((c) => c.type !== "image_url") : content;
|
|
4457
4711
|
if (filteredContent.length === 0) continue;
|
|
4458
4712
|
params.push({ role: "user", content: filteredContent });
|
|
4459
4713
|
}
|
|
@@ -4529,6 +4783,35 @@ function convertMessages(model, context, compat) {
|
|
|
4529
4783
|
}
|
|
4530
4784
|
return params;
|
|
4531
4785
|
}
|
|
4786
|
+
function convertUserContentItem(item) {
|
|
4787
|
+
if (item.type === "text") {
|
|
4788
|
+
return [{ type: "text", text: item.text }];
|
|
4789
|
+
}
|
|
4790
|
+
if (item.type === "image") {
|
|
4791
|
+
return [{
|
|
4792
|
+
type: "image_url",
|
|
4793
|
+
image_url: { url: `data:${item.mimeType};base64,${item.data}` }
|
|
4794
|
+
}];
|
|
4795
|
+
}
|
|
4796
|
+
if (item.type === "video") {
|
|
4797
|
+
const video = item;
|
|
4798
|
+
return [{
|
|
4799
|
+
type: "video_url",
|
|
4800
|
+
video_url: { url: `data:${video.mimeType};base64,${video.data}` }
|
|
4801
|
+
}];
|
|
4802
|
+
}
|
|
4803
|
+
if (item.type === "fileRef") {
|
|
4804
|
+
const ref = item;
|
|
4805
|
+
if (ref.modality === "image") {
|
|
4806
|
+
return [{ type: "image_url", image_url: { url: ref.url } }];
|
|
4807
|
+
}
|
|
4808
|
+
if (ref.modality === "video") {
|
|
4809
|
+
return [{ type: "video_url", video_url: { url: ref.url } }];
|
|
4810
|
+
}
|
|
4811
|
+
return [{ type: "file", file_url: { url: ref.url } }];
|
|
4812
|
+
}
|
|
4813
|
+
return [];
|
|
4814
|
+
}
|
|
4532
4815
|
function convertTools(tools, compat) {
|
|
4533
4816
|
return tools.map((tool) => ({
|
|
4534
4817
|
type: "function",
|
|
@@ -4609,11 +4892,13 @@ function mapStopReason2(reason) {
|
|
|
4609
4892
|
}
|
|
4610
4893
|
}
|
|
4611
4894
|
function convertContentBlocks(content) {
|
|
4612
|
-
const
|
|
4895
|
+
const supportedBlocks = content.filter((block) => block.type === "text" || block.type === "image");
|
|
4896
|
+
const hasImages = supportedBlocks.some((c) => c.type === "image");
|
|
4613
4897
|
if (!hasImages) {
|
|
4614
|
-
|
|
4898
|
+
const text = supportedBlocks.filter((c) => c.type === "text").map((c) => c.text).join("\n");
|
|
4899
|
+
return sanitizeSurrogates(text || "(unsupported tool result omitted)");
|
|
4615
4900
|
}
|
|
4616
|
-
const blocks =
|
|
4901
|
+
const blocks = supportedBlocks.map((block) => {
|
|
4617
4902
|
if (block.type === "text") {
|
|
4618
4903
|
return { type: "text", text: sanitizeSurrogates(block.text) };
|
|
4619
4904
|
}
|
|
@@ -4632,6 +4917,42 @@ function convertContentBlocks(content) {
|
|
|
4632
4917
|
}
|
|
4633
4918
|
return blocks;
|
|
4634
4919
|
}
|
|
4920
|
+
function convertUserContentBlocks(content) {
|
|
4921
|
+
const blocks = [];
|
|
4922
|
+
for (const item of content) {
|
|
4923
|
+
if (item.type === "text") {
|
|
4924
|
+
blocks.push({ type: "text", text: sanitizeSurrogates(item.text) });
|
|
4925
|
+
continue;
|
|
4926
|
+
}
|
|
4927
|
+
if (item.type === "image") {
|
|
4928
|
+
blocks.push({
|
|
4929
|
+
type: "image",
|
|
4930
|
+
source: {
|
|
4931
|
+
type: "base64",
|
|
4932
|
+
media_type: item.mimeType,
|
|
4933
|
+
data: item.data
|
|
4934
|
+
}
|
|
4935
|
+
});
|
|
4936
|
+
continue;
|
|
4937
|
+
}
|
|
4938
|
+
if (item.type === "video") {
|
|
4939
|
+
const video = item;
|
|
4940
|
+
blocks.push({
|
|
4941
|
+
type: "text",
|
|
4942
|
+
text: sanitizeSurrogates(`(video attachment omitted for anthropic provider: ${video.mimeType})`)
|
|
4943
|
+
});
|
|
4944
|
+
continue;
|
|
4945
|
+
}
|
|
4946
|
+
if (item.type === "fileRef") {
|
|
4947
|
+
const ref = item;
|
|
4948
|
+
blocks.push({
|
|
4949
|
+
type: "text",
|
|
4950
|
+
text: sanitizeSurrogates(`(file reference omitted for anthropic provider: ${ref.url})`)
|
|
4951
|
+
});
|
|
4952
|
+
}
|
|
4953
|
+
}
|
|
4954
|
+
return blocks;
|
|
4955
|
+
}
|
|
4635
4956
|
function convertMessages2(messages, model) {
|
|
4636
4957
|
const params = [];
|
|
4637
4958
|
const transformedMessages = transformMessages(messages, model, normalizeToolCallId);
|
|
@@ -4643,19 +4964,7 @@ function convertMessages2(messages, model) {
|
|
|
4643
4964
|
params.push({ role: "user", content: sanitizeSurrogates(msg.content) });
|
|
4644
4965
|
}
|
|
4645
4966
|
} else {
|
|
4646
|
-
const blocks = msg.content
|
|
4647
|
-
if (item.type === "text") {
|
|
4648
|
-
return { type: "text", text: sanitizeSurrogates(item.text) };
|
|
4649
|
-
}
|
|
4650
|
-
return {
|
|
4651
|
-
type: "image",
|
|
4652
|
-
source: {
|
|
4653
|
-
type: "base64",
|
|
4654
|
-
media_type: item.mimeType,
|
|
4655
|
-
data: item.data
|
|
4656
|
-
}
|
|
4657
|
-
};
|
|
4658
|
-
});
|
|
4967
|
+
const blocks = convertUserContentBlocks(msg.content);
|
|
4659
4968
|
let filteredBlocks = !model?.input.includes("image") ? blocks.filter((b) => b.type !== "image") : blocks;
|
|
4660
4969
|
filteredBlocks = filteredBlocks.filter((b) => b.type === "text" ? b.text.trim().length > 0 : true);
|
|
4661
4970
|
if (filteredBlocks.length === 0) continue;
|
|
@@ -4955,77 +5264,3420 @@ function streamSimple(model, context, options) {
|
|
|
4955
5264
|
return provider.streamSimple(model, context, options);
|
|
4956
5265
|
}
|
|
4957
5266
|
|
|
4958
|
-
// ../../
|
|
4959
|
-
function
|
|
4960
|
-
|
|
5267
|
+
// ../../node_modules/@sinclair/typebox/build/esm/errors/function.mjs
|
|
5268
|
+
function DefaultErrorFunction(error) {
|
|
5269
|
+
switch (error.errorType) {
|
|
5270
|
+
case ValueErrorType.ArrayContains:
|
|
5271
|
+
return "Expected array to contain at least one matching value";
|
|
5272
|
+
case ValueErrorType.ArrayMaxContains:
|
|
5273
|
+
return `Expected array to contain no more than ${error.schema.maxContains} matching values`;
|
|
5274
|
+
case ValueErrorType.ArrayMinContains:
|
|
5275
|
+
return `Expected array to contain at least ${error.schema.minContains} matching values`;
|
|
5276
|
+
case ValueErrorType.ArrayMaxItems:
|
|
5277
|
+
return `Expected array length to be less or equal to ${error.schema.maxItems}`;
|
|
5278
|
+
case ValueErrorType.ArrayMinItems:
|
|
5279
|
+
return `Expected array length to be greater or equal to ${error.schema.minItems}`;
|
|
5280
|
+
case ValueErrorType.ArrayUniqueItems:
|
|
5281
|
+
return "Expected array elements to be unique";
|
|
5282
|
+
case ValueErrorType.Array:
|
|
5283
|
+
return "Expected array";
|
|
5284
|
+
case ValueErrorType.AsyncIterator:
|
|
5285
|
+
return "Expected AsyncIterator";
|
|
5286
|
+
case ValueErrorType.BigIntExclusiveMaximum:
|
|
5287
|
+
return `Expected bigint to be less than ${error.schema.exclusiveMaximum}`;
|
|
5288
|
+
case ValueErrorType.BigIntExclusiveMinimum:
|
|
5289
|
+
return `Expected bigint to be greater than ${error.schema.exclusiveMinimum}`;
|
|
5290
|
+
case ValueErrorType.BigIntMaximum:
|
|
5291
|
+
return `Expected bigint to be less or equal to ${error.schema.maximum}`;
|
|
5292
|
+
case ValueErrorType.BigIntMinimum:
|
|
5293
|
+
return `Expected bigint to be greater or equal to ${error.schema.minimum}`;
|
|
5294
|
+
case ValueErrorType.BigIntMultipleOf:
|
|
5295
|
+
return `Expected bigint to be a multiple of ${error.schema.multipleOf}`;
|
|
5296
|
+
case ValueErrorType.BigInt:
|
|
5297
|
+
return "Expected bigint";
|
|
5298
|
+
case ValueErrorType.Boolean:
|
|
5299
|
+
return "Expected boolean";
|
|
5300
|
+
case ValueErrorType.DateExclusiveMinimumTimestamp:
|
|
5301
|
+
return `Expected Date timestamp to be greater than ${error.schema.exclusiveMinimumTimestamp}`;
|
|
5302
|
+
case ValueErrorType.DateExclusiveMaximumTimestamp:
|
|
5303
|
+
return `Expected Date timestamp to be less than ${error.schema.exclusiveMaximumTimestamp}`;
|
|
5304
|
+
case ValueErrorType.DateMinimumTimestamp:
|
|
5305
|
+
return `Expected Date timestamp to be greater or equal to ${error.schema.minimumTimestamp}`;
|
|
5306
|
+
case ValueErrorType.DateMaximumTimestamp:
|
|
5307
|
+
return `Expected Date timestamp to be less or equal to ${error.schema.maximumTimestamp}`;
|
|
5308
|
+
case ValueErrorType.DateMultipleOfTimestamp:
|
|
5309
|
+
return `Expected Date timestamp to be a multiple of ${error.schema.multipleOfTimestamp}`;
|
|
5310
|
+
case ValueErrorType.Date:
|
|
5311
|
+
return "Expected Date";
|
|
5312
|
+
case ValueErrorType.Function:
|
|
5313
|
+
return "Expected function";
|
|
5314
|
+
case ValueErrorType.IntegerExclusiveMaximum:
|
|
5315
|
+
return `Expected integer to be less than ${error.schema.exclusiveMaximum}`;
|
|
5316
|
+
case ValueErrorType.IntegerExclusiveMinimum:
|
|
5317
|
+
return `Expected integer to be greater than ${error.schema.exclusiveMinimum}`;
|
|
5318
|
+
case ValueErrorType.IntegerMaximum:
|
|
5319
|
+
return `Expected integer to be less or equal to ${error.schema.maximum}`;
|
|
5320
|
+
case ValueErrorType.IntegerMinimum:
|
|
5321
|
+
return `Expected integer to be greater or equal to ${error.schema.minimum}`;
|
|
5322
|
+
case ValueErrorType.IntegerMultipleOf:
|
|
5323
|
+
return `Expected integer to be a multiple of ${error.schema.multipleOf}`;
|
|
5324
|
+
case ValueErrorType.Integer:
|
|
5325
|
+
return "Expected integer";
|
|
5326
|
+
case ValueErrorType.IntersectUnevaluatedProperties:
|
|
5327
|
+
return "Unexpected property";
|
|
5328
|
+
case ValueErrorType.Intersect:
|
|
5329
|
+
return "Expected all values to match";
|
|
5330
|
+
case ValueErrorType.Iterator:
|
|
5331
|
+
return "Expected Iterator";
|
|
5332
|
+
case ValueErrorType.Literal:
|
|
5333
|
+
return `Expected ${typeof error.schema.const === "string" ? `'${error.schema.const}'` : error.schema.const}`;
|
|
5334
|
+
case ValueErrorType.Never:
|
|
5335
|
+
return "Never";
|
|
5336
|
+
case ValueErrorType.Not:
|
|
5337
|
+
return "Value should not match";
|
|
5338
|
+
case ValueErrorType.Null:
|
|
5339
|
+
return "Expected null";
|
|
5340
|
+
case ValueErrorType.NumberExclusiveMaximum:
|
|
5341
|
+
return `Expected number to be less than ${error.schema.exclusiveMaximum}`;
|
|
5342
|
+
case ValueErrorType.NumberExclusiveMinimum:
|
|
5343
|
+
return `Expected number to be greater than ${error.schema.exclusiveMinimum}`;
|
|
5344
|
+
case ValueErrorType.NumberMaximum:
|
|
5345
|
+
return `Expected number to be less or equal to ${error.schema.maximum}`;
|
|
5346
|
+
case ValueErrorType.NumberMinimum:
|
|
5347
|
+
return `Expected number to be greater or equal to ${error.schema.minimum}`;
|
|
5348
|
+
case ValueErrorType.NumberMultipleOf:
|
|
5349
|
+
return `Expected number to be a multiple of ${error.schema.multipleOf}`;
|
|
5350
|
+
case ValueErrorType.Number:
|
|
5351
|
+
return "Expected number";
|
|
5352
|
+
case ValueErrorType.Object:
|
|
5353
|
+
return "Expected object";
|
|
5354
|
+
case ValueErrorType.ObjectAdditionalProperties:
|
|
5355
|
+
return "Unexpected property";
|
|
5356
|
+
case ValueErrorType.ObjectMaxProperties:
|
|
5357
|
+
return `Expected object to have no more than ${error.schema.maxProperties} properties`;
|
|
5358
|
+
case ValueErrorType.ObjectMinProperties:
|
|
5359
|
+
return `Expected object to have at least ${error.schema.minProperties} properties`;
|
|
5360
|
+
case ValueErrorType.ObjectRequiredProperty:
|
|
5361
|
+
return "Expected required property";
|
|
5362
|
+
case ValueErrorType.Promise:
|
|
5363
|
+
return "Expected Promise";
|
|
5364
|
+
case ValueErrorType.RegExp:
|
|
5365
|
+
return "Expected string to match regular expression";
|
|
5366
|
+
case ValueErrorType.StringFormatUnknown:
|
|
5367
|
+
return `Unknown format '${error.schema.format}'`;
|
|
5368
|
+
case ValueErrorType.StringFormat:
|
|
5369
|
+
return `Expected string to match '${error.schema.format}' format`;
|
|
5370
|
+
case ValueErrorType.StringMaxLength:
|
|
5371
|
+
return `Expected string length less or equal to ${error.schema.maxLength}`;
|
|
5372
|
+
case ValueErrorType.StringMinLength:
|
|
5373
|
+
return `Expected string length greater or equal to ${error.schema.minLength}`;
|
|
5374
|
+
case ValueErrorType.StringPattern:
|
|
5375
|
+
return `Expected string to match '${error.schema.pattern}'`;
|
|
5376
|
+
case ValueErrorType.String:
|
|
5377
|
+
return "Expected string";
|
|
5378
|
+
case ValueErrorType.Symbol:
|
|
5379
|
+
return "Expected symbol";
|
|
5380
|
+
case ValueErrorType.TupleLength:
|
|
5381
|
+
return `Expected tuple to have ${error.schema.maxItems || 0} elements`;
|
|
5382
|
+
case ValueErrorType.Tuple:
|
|
5383
|
+
return "Expected tuple";
|
|
5384
|
+
case ValueErrorType.Uint8ArrayMaxByteLength:
|
|
5385
|
+
return `Expected byte length less or equal to ${error.schema.maxByteLength}`;
|
|
5386
|
+
case ValueErrorType.Uint8ArrayMinByteLength:
|
|
5387
|
+
return `Expected byte length greater or equal to ${error.schema.minByteLength}`;
|
|
5388
|
+
case ValueErrorType.Uint8Array:
|
|
5389
|
+
return "Expected Uint8Array";
|
|
5390
|
+
case ValueErrorType.Undefined:
|
|
5391
|
+
return "Expected undefined";
|
|
5392
|
+
case ValueErrorType.Union:
|
|
5393
|
+
return "Expected union value";
|
|
5394
|
+
case ValueErrorType.Void:
|
|
5395
|
+
return "Expected void";
|
|
5396
|
+
case ValueErrorType.Kind:
|
|
5397
|
+
return `Expected kind '${error.schema[Kind]}'`;
|
|
5398
|
+
default:
|
|
5399
|
+
return "Unknown error type";
|
|
5400
|
+
}
|
|
5401
|
+
}
|
|
5402
|
+
var errorFunction = DefaultErrorFunction;
|
|
5403
|
+
function GetErrorFunction() {
|
|
5404
|
+
return errorFunction;
|
|
4961
5405
|
}
|
|
4962
5406
|
|
|
4963
|
-
// ../../
|
|
4964
|
-
|
|
4965
|
-
|
|
4966
|
-
|
|
4967
|
-
|
|
4968
|
-
}
|
|
4969
|
-
|
|
4970
|
-
|
|
4971
|
-
|
|
4972
|
-
|
|
4973
|
-
|
|
5407
|
+
// ../../node_modules/@sinclair/typebox/build/esm/value/deref/deref.mjs
|
|
5408
|
+
var TypeDereferenceError = class extends TypeBoxError {
|
|
5409
|
+
constructor(schema) {
|
|
5410
|
+
super(`Unable to dereference schema with $id '${schema.$ref}'`);
|
|
5411
|
+
this.schema = schema;
|
|
5412
|
+
}
|
|
5413
|
+
};
|
|
5414
|
+
function Resolve(schema, references) {
|
|
5415
|
+
const target = references.find((target2) => target2.$id === schema.$ref);
|
|
5416
|
+
if (target === void 0)
|
|
5417
|
+
throw new TypeDereferenceError(schema);
|
|
5418
|
+
return Deref(target, references);
|
|
5419
|
+
}
|
|
5420
|
+
function Pushref(schema, references) {
|
|
5421
|
+
if (!IsString2(schema.$id) || references.some((target) => target.$id === schema.$id))
|
|
5422
|
+
return references;
|
|
5423
|
+
references.push(schema);
|
|
5424
|
+
return references;
|
|
5425
|
+
}
|
|
5426
|
+
function Deref(schema, references) {
|
|
5427
|
+
return schema[Kind] === "This" || schema[Kind] === "Ref" ? Resolve(schema, references) : schema;
|
|
5428
|
+
}
|
|
4974
5429
|
|
|
4975
|
-
// ../../
|
|
4976
|
-
|
|
4977
|
-
|
|
4978
|
-
|
|
4979
|
-
|
|
4980
|
-
|
|
4981
|
-
|
|
4982
|
-
|
|
4983
|
-
|
|
4984
|
-
|
|
4985
|
-
|
|
4986
|
-
|
|
4987
|
-
|
|
4988
|
-
|
|
4989
|
-
|
|
4990
|
-
|
|
4991
|
-
|
|
4992
|
-
|
|
4993
|
-
|
|
4994
|
-
|
|
4995
|
-
|
|
4996
|
-
|
|
4997
|
-
|
|
4998
|
-
|
|
4999
|
-
|
|
5000
|
-
|
|
5001
|
-
|
|
5002
|
-
|
|
5003
|
-
|
|
5004
|
-
|
|
5430
|
+
// ../../node_modules/@sinclair/typebox/build/esm/value/hash/hash.mjs
|
|
5431
|
+
var ValueHashError = class extends TypeBoxError {
|
|
5432
|
+
constructor(value) {
|
|
5433
|
+
super(`Unable to hash value`);
|
|
5434
|
+
this.value = value;
|
|
5435
|
+
}
|
|
5436
|
+
};
|
|
5437
|
+
var ByteMarker;
|
|
5438
|
+
(function(ByteMarker2) {
|
|
5439
|
+
ByteMarker2[ByteMarker2["Undefined"] = 0] = "Undefined";
|
|
5440
|
+
ByteMarker2[ByteMarker2["Null"] = 1] = "Null";
|
|
5441
|
+
ByteMarker2[ByteMarker2["Boolean"] = 2] = "Boolean";
|
|
5442
|
+
ByteMarker2[ByteMarker2["Number"] = 3] = "Number";
|
|
5443
|
+
ByteMarker2[ByteMarker2["String"] = 4] = "String";
|
|
5444
|
+
ByteMarker2[ByteMarker2["Object"] = 5] = "Object";
|
|
5445
|
+
ByteMarker2[ByteMarker2["Array"] = 6] = "Array";
|
|
5446
|
+
ByteMarker2[ByteMarker2["Date"] = 7] = "Date";
|
|
5447
|
+
ByteMarker2[ByteMarker2["Uint8Array"] = 8] = "Uint8Array";
|
|
5448
|
+
ByteMarker2[ByteMarker2["Symbol"] = 9] = "Symbol";
|
|
5449
|
+
ByteMarker2[ByteMarker2["BigInt"] = 10] = "BigInt";
|
|
5450
|
+
})(ByteMarker || (ByteMarker = {}));
|
|
5451
|
+
var Accumulator = BigInt("14695981039346656037");
|
|
5452
|
+
var [Prime, Size] = [BigInt("1099511628211"), BigInt(
|
|
5453
|
+
"18446744073709551616"
|
|
5454
|
+
/* 2 ^ 64 */
|
|
5455
|
+
)];
|
|
5456
|
+
var Bytes = Array.from({ length: 256 }).map((_, i) => BigInt(i));
|
|
5457
|
+
var F64 = new Float64Array(1);
|
|
5458
|
+
var F64In = new DataView(F64.buffer);
|
|
5459
|
+
var F64Out = new Uint8Array(F64.buffer);
|
|
5460
|
+
function* NumberToBytes(value) {
|
|
5461
|
+
const byteCount = value === 0 ? 1 : Math.ceil(Math.floor(Math.log2(value) + 1) / 8);
|
|
5462
|
+
for (let i = 0; i < byteCount; i++) {
|
|
5463
|
+
yield value >> 8 * (byteCount - 1 - i) & 255;
|
|
5464
|
+
}
|
|
5465
|
+
}
|
|
5466
|
+
function ArrayType2(value) {
|
|
5467
|
+
FNV1A64(ByteMarker.Array);
|
|
5468
|
+
for (const item of value) {
|
|
5469
|
+
Visit4(item);
|
|
5470
|
+
}
|
|
5471
|
+
}
|
|
5472
|
+
function BooleanType(value) {
|
|
5473
|
+
FNV1A64(ByteMarker.Boolean);
|
|
5474
|
+
FNV1A64(value ? 1 : 0);
|
|
5475
|
+
}
|
|
5476
|
+
function BigIntType(value) {
|
|
5477
|
+
FNV1A64(ByteMarker.BigInt);
|
|
5478
|
+
F64In.setBigInt64(0, value);
|
|
5479
|
+
for (const byte of F64Out) {
|
|
5480
|
+
FNV1A64(byte);
|
|
5481
|
+
}
|
|
5482
|
+
}
|
|
5483
|
+
function DateType2(value) {
|
|
5484
|
+
FNV1A64(ByteMarker.Date);
|
|
5485
|
+
Visit4(value.getTime());
|
|
5486
|
+
}
|
|
5487
|
+
function NullType(value) {
|
|
5488
|
+
FNV1A64(ByteMarker.Null);
|
|
5489
|
+
}
|
|
5490
|
+
function NumberType(value) {
|
|
5491
|
+
FNV1A64(ByteMarker.Number);
|
|
5492
|
+
F64In.setFloat64(0, value);
|
|
5493
|
+
for (const byte of F64Out) {
|
|
5494
|
+
FNV1A64(byte);
|
|
5495
|
+
}
|
|
5496
|
+
}
|
|
5497
|
+
function ObjectType2(value) {
|
|
5498
|
+
FNV1A64(ByteMarker.Object);
|
|
5499
|
+
for (const key of globalThis.Object.getOwnPropertyNames(value).sort()) {
|
|
5500
|
+
Visit4(key);
|
|
5501
|
+
Visit4(value[key]);
|
|
5502
|
+
}
|
|
5503
|
+
}
|
|
5504
|
+
function StringType(value) {
|
|
5505
|
+
FNV1A64(ByteMarker.String);
|
|
5506
|
+
for (let i = 0; i < value.length; i++) {
|
|
5507
|
+
for (const byte of NumberToBytes(value.charCodeAt(i))) {
|
|
5508
|
+
FNV1A64(byte);
|
|
5005
5509
|
}
|
|
5006
|
-
}
|
|
5007
|
-
return stream;
|
|
5510
|
+
}
|
|
5008
5511
|
}
|
|
5009
|
-
function
|
|
5010
|
-
|
|
5011
|
-
|
|
5512
|
+
function SymbolType(value) {
|
|
5513
|
+
FNV1A64(ByteMarker.Symbol);
|
|
5514
|
+
Visit4(value.description);
|
|
5515
|
+
}
|
|
5516
|
+
function Uint8ArrayType2(value) {
|
|
5517
|
+
FNV1A64(ByteMarker.Uint8Array);
|
|
5518
|
+
for (let i = 0; i < value.length; i++) {
|
|
5519
|
+
FNV1A64(value[i]);
|
|
5520
|
+
}
|
|
5521
|
+
}
|
|
5522
|
+
function UndefinedType(value) {
|
|
5523
|
+
return FNV1A64(ByteMarker.Undefined);
|
|
5524
|
+
}
|
|
5525
|
+
function Visit4(value) {
|
|
5526
|
+
if (IsArray2(value))
|
|
5527
|
+
return ArrayType2(value);
|
|
5528
|
+
if (IsBoolean2(value))
|
|
5529
|
+
return BooleanType(value);
|
|
5530
|
+
if (IsBigInt2(value))
|
|
5531
|
+
return BigIntType(value);
|
|
5532
|
+
if (IsDate2(value))
|
|
5533
|
+
return DateType2(value);
|
|
5534
|
+
if (IsNull2(value))
|
|
5535
|
+
return NullType(value);
|
|
5536
|
+
if (IsNumber2(value))
|
|
5537
|
+
return NumberType(value);
|
|
5538
|
+
if (IsObject2(value))
|
|
5539
|
+
return ObjectType2(value);
|
|
5540
|
+
if (IsString2(value))
|
|
5541
|
+
return StringType(value);
|
|
5542
|
+
if (IsSymbol2(value))
|
|
5543
|
+
return SymbolType(value);
|
|
5544
|
+
if (IsUint8Array2(value))
|
|
5545
|
+
return Uint8ArrayType2(value);
|
|
5546
|
+
if (IsUndefined2(value))
|
|
5547
|
+
return UndefinedType(value);
|
|
5548
|
+
throw new ValueHashError(value);
|
|
5549
|
+
}
|
|
5550
|
+
function FNV1A64(byte) {
|
|
5551
|
+
Accumulator = Accumulator ^ Bytes[byte];
|
|
5552
|
+
Accumulator = Accumulator * Prime % Size;
|
|
5553
|
+
}
|
|
5554
|
+
function Hash(value) {
|
|
5555
|
+
Accumulator = BigInt("14695981039346656037");
|
|
5556
|
+
Visit4(value);
|
|
5557
|
+
return Accumulator;
|
|
5558
|
+
}
|
|
5559
|
+
|
|
5560
|
+
// ../../node_modules/@sinclair/typebox/build/esm/value/check/check.mjs
|
|
5561
|
+
var ValueCheckUnknownTypeError = class extends TypeBoxError {
|
|
5562
|
+
constructor(schema) {
|
|
5563
|
+
super(`Unknown type`);
|
|
5564
|
+
this.schema = schema;
|
|
5012
5565
|
}
|
|
5013
|
-
|
|
5014
|
-
|
|
5566
|
+
};
|
|
5567
|
+
function IsAnyOrUnknown(schema) {
|
|
5568
|
+
return schema[Kind] === "Any" || schema[Kind] === "Unknown";
|
|
5569
|
+
}
|
|
5570
|
+
function IsDefined(value) {
|
|
5571
|
+
return value !== void 0;
|
|
5572
|
+
}
|
|
5573
|
+
function FromAny2(schema, references, value) {
|
|
5574
|
+
return true;
|
|
5575
|
+
}
|
|
5576
|
+
function FromArgument2(schema, references, value) {
|
|
5577
|
+
return true;
|
|
5578
|
+
}
|
|
5579
|
+
function FromArray7(schema, references, value) {
|
|
5580
|
+
if (!IsArray2(value))
|
|
5581
|
+
return false;
|
|
5582
|
+
if (IsDefined(schema.minItems) && !(value.length >= schema.minItems)) {
|
|
5583
|
+
return false;
|
|
5015
5584
|
}
|
|
5016
|
-
|
|
5017
|
-
|
|
5018
|
-
|
|
5019
|
-
|
|
5020
|
-
|
|
5021
|
-
|
|
5585
|
+
if (IsDefined(schema.maxItems) && !(value.length <= schema.maxItems)) {
|
|
5586
|
+
return false;
|
|
5587
|
+
}
|
|
5588
|
+
for (const element of value) {
|
|
5589
|
+
if (!Visit5(schema.items, references, element))
|
|
5590
|
+
return false;
|
|
5591
|
+
}
|
|
5592
|
+
if (schema.uniqueItems === true && !(function() {
|
|
5593
|
+
const set = /* @__PURE__ */ new Set();
|
|
5594
|
+
for (const element of value) {
|
|
5595
|
+
const hashed = Hash(element);
|
|
5596
|
+
if (set.has(hashed)) {
|
|
5597
|
+
return false;
|
|
5598
|
+
} else {
|
|
5599
|
+
set.add(hashed);
|
|
5600
|
+
}
|
|
5022
5601
|
}
|
|
5023
|
-
|
|
5024
|
-
|
|
5025
|
-
|
|
5026
|
-
|
|
5027
|
-
|
|
5028
|
-
|
|
5602
|
+
return true;
|
|
5603
|
+
})()) {
|
|
5604
|
+
return false;
|
|
5605
|
+
}
|
|
5606
|
+
if (!(IsDefined(schema.contains) || IsNumber2(schema.minContains) || IsNumber2(schema.maxContains))) {
|
|
5607
|
+
return true;
|
|
5608
|
+
}
|
|
5609
|
+
const containsSchema = IsDefined(schema.contains) ? schema.contains : Never();
|
|
5610
|
+
const containsCount = value.reduce((acc, value2) => Visit5(containsSchema, references, value2) ? acc + 1 : acc, 0);
|
|
5611
|
+
if (containsCount === 0) {
|
|
5612
|
+
return false;
|
|
5613
|
+
}
|
|
5614
|
+
if (IsNumber2(schema.minContains) && containsCount < schema.minContains) {
|
|
5615
|
+
return false;
|
|
5616
|
+
}
|
|
5617
|
+
if (IsNumber2(schema.maxContains) && containsCount > schema.maxContains) {
|
|
5618
|
+
return false;
|
|
5619
|
+
}
|
|
5620
|
+
return true;
|
|
5621
|
+
}
|
|
5622
|
+
function FromAsyncIterator4(schema, references, value) {
|
|
5623
|
+
return IsAsyncIterator2(value);
|
|
5624
|
+
}
|
|
5625
|
+
function FromBigInt2(schema, references, value) {
|
|
5626
|
+
if (!IsBigInt2(value))
|
|
5627
|
+
return false;
|
|
5628
|
+
if (IsDefined(schema.exclusiveMaximum) && !(value < schema.exclusiveMaximum)) {
|
|
5629
|
+
return false;
|
|
5630
|
+
}
|
|
5631
|
+
if (IsDefined(schema.exclusiveMinimum) && !(value > schema.exclusiveMinimum)) {
|
|
5632
|
+
return false;
|
|
5633
|
+
}
|
|
5634
|
+
if (IsDefined(schema.maximum) && !(value <= schema.maximum)) {
|
|
5635
|
+
return false;
|
|
5636
|
+
}
|
|
5637
|
+
if (IsDefined(schema.minimum) && !(value >= schema.minimum)) {
|
|
5638
|
+
return false;
|
|
5639
|
+
}
|
|
5640
|
+
if (IsDefined(schema.multipleOf) && !(value % schema.multipleOf === BigInt(0))) {
|
|
5641
|
+
return false;
|
|
5642
|
+
}
|
|
5643
|
+
return true;
|
|
5644
|
+
}
|
|
5645
|
+
function FromBoolean2(schema, references, value) {
|
|
5646
|
+
return IsBoolean2(value);
|
|
5647
|
+
}
|
|
5648
|
+
function FromConstructor4(schema, references, value) {
|
|
5649
|
+
return Visit5(schema.returns, references, value.prototype);
|
|
5650
|
+
}
|
|
5651
|
+
function FromDate2(schema, references, value) {
|
|
5652
|
+
if (!IsDate2(value))
|
|
5653
|
+
return false;
|
|
5654
|
+
if (IsDefined(schema.exclusiveMaximumTimestamp) && !(value.getTime() < schema.exclusiveMaximumTimestamp)) {
|
|
5655
|
+
return false;
|
|
5656
|
+
}
|
|
5657
|
+
if (IsDefined(schema.exclusiveMinimumTimestamp) && !(value.getTime() > schema.exclusiveMinimumTimestamp)) {
|
|
5658
|
+
return false;
|
|
5659
|
+
}
|
|
5660
|
+
if (IsDefined(schema.maximumTimestamp) && !(value.getTime() <= schema.maximumTimestamp)) {
|
|
5661
|
+
return false;
|
|
5662
|
+
}
|
|
5663
|
+
if (IsDefined(schema.minimumTimestamp) && !(value.getTime() >= schema.minimumTimestamp)) {
|
|
5664
|
+
return false;
|
|
5665
|
+
}
|
|
5666
|
+
if (IsDefined(schema.multipleOfTimestamp) && !(value.getTime() % schema.multipleOfTimestamp === 0)) {
|
|
5667
|
+
return false;
|
|
5668
|
+
}
|
|
5669
|
+
return true;
|
|
5670
|
+
}
|
|
5671
|
+
function FromFunction4(schema, references, value) {
|
|
5672
|
+
return IsFunction2(value);
|
|
5673
|
+
}
|
|
5674
|
+
function FromImport(schema, references, value) {
|
|
5675
|
+
const definitions = globalThis.Object.values(schema.$defs);
|
|
5676
|
+
const target = schema.$defs[schema.$ref];
|
|
5677
|
+
return Visit5(target, [...references, ...definitions], value);
|
|
5678
|
+
}
|
|
5679
|
+
function FromInteger2(schema, references, value) {
|
|
5680
|
+
if (!IsInteger(value)) {
|
|
5681
|
+
return false;
|
|
5682
|
+
}
|
|
5683
|
+
if (IsDefined(schema.exclusiveMaximum) && !(value < schema.exclusiveMaximum)) {
|
|
5684
|
+
return false;
|
|
5685
|
+
}
|
|
5686
|
+
if (IsDefined(schema.exclusiveMinimum) && !(value > schema.exclusiveMinimum)) {
|
|
5687
|
+
return false;
|
|
5688
|
+
}
|
|
5689
|
+
if (IsDefined(schema.maximum) && !(value <= schema.maximum)) {
|
|
5690
|
+
return false;
|
|
5691
|
+
}
|
|
5692
|
+
if (IsDefined(schema.minimum) && !(value >= schema.minimum)) {
|
|
5693
|
+
return false;
|
|
5694
|
+
}
|
|
5695
|
+
if (IsDefined(schema.multipleOf) && !(value % schema.multipleOf === 0)) {
|
|
5696
|
+
return false;
|
|
5697
|
+
}
|
|
5698
|
+
return true;
|
|
5699
|
+
}
|
|
5700
|
+
function FromIntersect9(schema, references, value) {
|
|
5701
|
+
const check1 = schema.allOf.every((schema2) => Visit5(schema2, references, value));
|
|
5702
|
+
if (schema.unevaluatedProperties === false) {
|
|
5703
|
+
const keyPattern = new RegExp(KeyOfPattern(schema));
|
|
5704
|
+
const check2 = Object.getOwnPropertyNames(value).every((key) => keyPattern.test(key));
|
|
5705
|
+
return check1 && check2;
|
|
5706
|
+
} else if (IsSchema(schema.unevaluatedProperties)) {
|
|
5707
|
+
const keyCheck = new RegExp(KeyOfPattern(schema));
|
|
5708
|
+
const check2 = Object.getOwnPropertyNames(value).every((key) => keyCheck.test(key) || Visit5(schema.unevaluatedProperties, references, value[key]));
|
|
5709
|
+
return check1 && check2;
|
|
5710
|
+
} else {
|
|
5711
|
+
return check1;
|
|
5712
|
+
}
|
|
5713
|
+
}
|
|
5714
|
+
function FromIterator4(schema, references, value) {
|
|
5715
|
+
return IsIterator2(value);
|
|
5716
|
+
}
|
|
5717
|
+
function FromLiteral3(schema, references, value) {
|
|
5718
|
+
return value === schema.const;
|
|
5719
|
+
}
|
|
5720
|
+
function FromNever2(schema, references, value) {
|
|
5721
|
+
return false;
|
|
5722
|
+
}
|
|
5723
|
+
function FromNot2(schema, references, value) {
|
|
5724
|
+
return !Visit5(schema.not, references, value);
|
|
5725
|
+
}
|
|
5726
|
+
function FromNull2(schema, references, value) {
|
|
5727
|
+
return IsNull2(value);
|
|
5728
|
+
}
|
|
5729
|
+
function FromNumber2(schema, references, value) {
|
|
5730
|
+
if (!TypeSystemPolicy.IsNumberLike(value))
|
|
5731
|
+
return false;
|
|
5732
|
+
if (IsDefined(schema.exclusiveMaximum) && !(value < schema.exclusiveMaximum)) {
|
|
5733
|
+
return false;
|
|
5734
|
+
}
|
|
5735
|
+
if (IsDefined(schema.exclusiveMinimum) && !(value > schema.exclusiveMinimum)) {
|
|
5736
|
+
return false;
|
|
5737
|
+
}
|
|
5738
|
+
if (IsDefined(schema.minimum) && !(value >= schema.minimum)) {
|
|
5739
|
+
return false;
|
|
5740
|
+
}
|
|
5741
|
+
if (IsDefined(schema.maximum) && !(value <= schema.maximum)) {
|
|
5742
|
+
return false;
|
|
5743
|
+
}
|
|
5744
|
+
if (IsDefined(schema.multipleOf) && !(value % schema.multipleOf === 0)) {
|
|
5745
|
+
return false;
|
|
5746
|
+
}
|
|
5747
|
+
return true;
|
|
5748
|
+
}
|
|
5749
|
+
function FromObject8(schema, references, value) {
|
|
5750
|
+
if (!TypeSystemPolicy.IsObjectLike(value))
|
|
5751
|
+
return false;
|
|
5752
|
+
if (IsDefined(schema.minProperties) && !(Object.getOwnPropertyNames(value).length >= schema.minProperties)) {
|
|
5753
|
+
return false;
|
|
5754
|
+
}
|
|
5755
|
+
if (IsDefined(schema.maxProperties) && !(Object.getOwnPropertyNames(value).length <= schema.maxProperties)) {
|
|
5756
|
+
return false;
|
|
5757
|
+
}
|
|
5758
|
+
const knownKeys = Object.getOwnPropertyNames(schema.properties);
|
|
5759
|
+
for (const knownKey of knownKeys) {
|
|
5760
|
+
const property = schema.properties[knownKey];
|
|
5761
|
+
if (schema.required && schema.required.includes(knownKey)) {
|
|
5762
|
+
if (!Visit5(property, references, value[knownKey])) {
|
|
5763
|
+
return false;
|
|
5764
|
+
}
|
|
5765
|
+
if ((ExtendsUndefinedCheck(property) || IsAnyOrUnknown(property)) && !(knownKey in value)) {
|
|
5766
|
+
return false;
|
|
5767
|
+
}
|
|
5768
|
+
} else {
|
|
5769
|
+
if (TypeSystemPolicy.IsExactOptionalProperty(value, knownKey) && !Visit5(property, references, value[knownKey])) {
|
|
5770
|
+
return false;
|
|
5771
|
+
}
|
|
5772
|
+
}
|
|
5773
|
+
}
|
|
5774
|
+
if (schema.additionalProperties === false) {
|
|
5775
|
+
const valueKeys = Object.getOwnPropertyNames(value);
|
|
5776
|
+
if (schema.required && schema.required.length === knownKeys.length && valueKeys.length === knownKeys.length) {
|
|
5777
|
+
return true;
|
|
5778
|
+
} else {
|
|
5779
|
+
return valueKeys.every((valueKey) => knownKeys.includes(valueKey));
|
|
5780
|
+
}
|
|
5781
|
+
} else if (typeof schema.additionalProperties === "object") {
|
|
5782
|
+
const valueKeys = Object.getOwnPropertyNames(value);
|
|
5783
|
+
return valueKeys.every((key) => knownKeys.includes(key) || Visit5(schema.additionalProperties, references, value[key]));
|
|
5784
|
+
} else {
|
|
5785
|
+
return true;
|
|
5786
|
+
}
|
|
5787
|
+
}
|
|
5788
|
+
function FromPromise4(schema, references, value) {
|
|
5789
|
+
return IsPromise(value);
|
|
5790
|
+
}
|
|
5791
|
+
function FromRecord4(schema, references, value) {
|
|
5792
|
+
if (!TypeSystemPolicy.IsRecordLike(value)) {
|
|
5793
|
+
return false;
|
|
5794
|
+
}
|
|
5795
|
+
if (IsDefined(schema.minProperties) && !(Object.getOwnPropertyNames(value).length >= schema.minProperties)) {
|
|
5796
|
+
return false;
|
|
5797
|
+
}
|
|
5798
|
+
if (IsDefined(schema.maxProperties) && !(Object.getOwnPropertyNames(value).length <= schema.maxProperties)) {
|
|
5799
|
+
return false;
|
|
5800
|
+
}
|
|
5801
|
+
const [patternKey, patternSchema] = Object.entries(schema.patternProperties)[0];
|
|
5802
|
+
const regex = new RegExp(patternKey);
|
|
5803
|
+
const check1 = Object.entries(value).every(([key, value2]) => {
|
|
5804
|
+
return regex.test(key) ? Visit5(patternSchema, references, value2) : true;
|
|
5805
|
+
});
|
|
5806
|
+
const check2 = typeof schema.additionalProperties === "object" ? Object.entries(value).every(([key, value2]) => {
|
|
5807
|
+
return !regex.test(key) ? Visit5(schema.additionalProperties, references, value2) : true;
|
|
5808
|
+
}) : true;
|
|
5809
|
+
const check3 = schema.additionalProperties === false ? Object.getOwnPropertyNames(value).every((key) => {
|
|
5810
|
+
return regex.test(key);
|
|
5811
|
+
}) : true;
|
|
5812
|
+
return check1 && check2 && check3;
|
|
5813
|
+
}
|
|
5814
|
+
function FromRef5(schema, references, value) {
|
|
5815
|
+
return Visit5(Deref(schema, references), references, value);
|
|
5816
|
+
}
|
|
5817
|
+
function FromRegExp2(schema, references, value) {
|
|
5818
|
+
const regex = new RegExp(schema.source, schema.flags);
|
|
5819
|
+
if (IsDefined(schema.minLength)) {
|
|
5820
|
+
if (!(value.length >= schema.minLength))
|
|
5821
|
+
return false;
|
|
5822
|
+
}
|
|
5823
|
+
if (IsDefined(schema.maxLength)) {
|
|
5824
|
+
if (!(value.length <= schema.maxLength))
|
|
5825
|
+
return false;
|
|
5826
|
+
}
|
|
5827
|
+
return regex.test(value);
|
|
5828
|
+
}
|
|
5829
|
+
function FromString2(schema, references, value) {
|
|
5830
|
+
if (!IsString2(value)) {
|
|
5831
|
+
return false;
|
|
5832
|
+
}
|
|
5833
|
+
if (IsDefined(schema.minLength)) {
|
|
5834
|
+
if (!(value.length >= schema.minLength))
|
|
5835
|
+
return false;
|
|
5836
|
+
}
|
|
5837
|
+
if (IsDefined(schema.maxLength)) {
|
|
5838
|
+
if (!(value.length <= schema.maxLength))
|
|
5839
|
+
return false;
|
|
5840
|
+
}
|
|
5841
|
+
if (IsDefined(schema.pattern)) {
|
|
5842
|
+
const regex = new RegExp(schema.pattern);
|
|
5843
|
+
if (!regex.test(value))
|
|
5844
|
+
return false;
|
|
5845
|
+
}
|
|
5846
|
+
if (IsDefined(schema.format)) {
|
|
5847
|
+
if (!format_exports.Has(schema.format))
|
|
5848
|
+
return false;
|
|
5849
|
+
const func = format_exports.Get(schema.format);
|
|
5850
|
+
return func(value);
|
|
5851
|
+
}
|
|
5852
|
+
return true;
|
|
5853
|
+
}
|
|
5854
|
+
function FromSymbol2(schema, references, value) {
|
|
5855
|
+
return IsSymbol2(value);
|
|
5856
|
+
}
|
|
5857
|
+
function FromTemplateLiteral4(schema, references, value) {
|
|
5858
|
+
return IsString2(value) && new RegExp(schema.pattern).test(value);
|
|
5859
|
+
}
|
|
5860
|
+
function FromThis(schema, references, value) {
|
|
5861
|
+
return Visit5(Deref(schema, references), references, value);
|
|
5862
|
+
}
|
|
5863
|
+
function FromTuple6(schema, references, value) {
|
|
5864
|
+
if (!IsArray2(value)) {
|
|
5865
|
+
return false;
|
|
5866
|
+
}
|
|
5867
|
+
if (schema.items === void 0 && !(value.length === 0)) {
|
|
5868
|
+
return false;
|
|
5869
|
+
}
|
|
5870
|
+
if (!(value.length === schema.maxItems)) {
|
|
5871
|
+
return false;
|
|
5872
|
+
}
|
|
5873
|
+
if (!schema.items) {
|
|
5874
|
+
return true;
|
|
5875
|
+
}
|
|
5876
|
+
for (let i = 0; i < schema.items.length; i++) {
|
|
5877
|
+
if (!Visit5(schema.items[i], references, value[i]))
|
|
5878
|
+
return false;
|
|
5879
|
+
}
|
|
5880
|
+
return true;
|
|
5881
|
+
}
|
|
5882
|
+
function FromUndefined2(schema, references, value) {
|
|
5883
|
+
return IsUndefined2(value);
|
|
5884
|
+
}
|
|
5885
|
+
function FromUnion11(schema, references, value) {
|
|
5886
|
+
return schema.anyOf.some((inner) => Visit5(inner, references, value));
|
|
5887
|
+
}
|
|
5888
|
+
function FromUint8Array2(schema, references, value) {
|
|
5889
|
+
if (!IsUint8Array2(value)) {
|
|
5890
|
+
return false;
|
|
5891
|
+
}
|
|
5892
|
+
if (IsDefined(schema.maxByteLength) && !(value.length <= schema.maxByteLength)) {
|
|
5893
|
+
return false;
|
|
5894
|
+
}
|
|
5895
|
+
if (IsDefined(schema.minByteLength) && !(value.length >= schema.minByteLength)) {
|
|
5896
|
+
return false;
|
|
5897
|
+
}
|
|
5898
|
+
return true;
|
|
5899
|
+
}
|
|
5900
|
+
function FromUnknown2(schema, references, value) {
|
|
5901
|
+
return true;
|
|
5902
|
+
}
|
|
5903
|
+
function FromVoid2(schema, references, value) {
|
|
5904
|
+
return TypeSystemPolicy.IsVoidLike(value);
|
|
5905
|
+
}
|
|
5906
|
+
function FromKind(schema, references, value) {
|
|
5907
|
+
if (!type_exports2.Has(schema[Kind]))
|
|
5908
|
+
return false;
|
|
5909
|
+
const func = type_exports2.Get(schema[Kind]);
|
|
5910
|
+
return func(schema, value);
|
|
5911
|
+
}
|
|
5912
|
+
function Visit5(schema, references, value) {
|
|
5913
|
+
const references_ = IsDefined(schema.$id) ? Pushref(schema, references) : references;
|
|
5914
|
+
const schema_ = schema;
|
|
5915
|
+
switch (schema_[Kind]) {
|
|
5916
|
+
case "Any":
|
|
5917
|
+
return FromAny2(schema_, references_, value);
|
|
5918
|
+
case "Argument":
|
|
5919
|
+
return FromArgument2(schema_, references_, value);
|
|
5920
|
+
case "Array":
|
|
5921
|
+
return FromArray7(schema_, references_, value);
|
|
5922
|
+
case "AsyncIterator":
|
|
5923
|
+
return FromAsyncIterator4(schema_, references_, value);
|
|
5924
|
+
case "BigInt":
|
|
5925
|
+
return FromBigInt2(schema_, references_, value);
|
|
5926
|
+
case "Boolean":
|
|
5927
|
+
return FromBoolean2(schema_, references_, value);
|
|
5928
|
+
case "Constructor":
|
|
5929
|
+
return FromConstructor4(schema_, references_, value);
|
|
5930
|
+
case "Date":
|
|
5931
|
+
return FromDate2(schema_, references_, value);
|
|
5932
|
+
case "Function":
|
|
5933
|
+
return FromFunction4(schema_, references_, value);
|
|
5934
|
+
case "Import":
|
|
5935
|
+
return FromImport(schema_, references_, value);
|
|
5936
|
+
case "Integer":
|
|
5937
|
+
return FromInteger2(schema_, references_, value);
|
|
5938
|
+
case "Intersect":
|
|
5939
|
+
return FromIntersect9(schema_, references_, value);
|
|
5940
|
+
case "Iterator":
|
|
5941
|
+
return FromIterator4(schema_, references_, value);
|
|
5942
|
+
case "Literal":
|
|
5943
|
+
return FromLiteral3(schema_, references_, value);
|
|
5944
|
+
case "Never":
|
|
5945
|
+
return FromNever2(schema_, references_, value);
|
|
5946
|
+
case "Not":
|
|
5947
|
+
return FromNot2(schema_, references_, value);
|
|
5948
|
+
case "Null":
|
|
5949
|
+
return FromNull2(schema_, references_, value);
|
|
5950
|
+
case "Number":
|
|
5951
|
+
return FromNumber2(schema_, references_, value);
|
|
5952
|
+
case "Object":
|
|
5953
|
+
return FromObject8(schema_, references_, value);
|
|
5954
|
+
case "Promise":
|
|
5955
|
+
return FromPromise4(schema_, references_, value);
|
|
5956
|
+
case "Record":
|
|
5957
|
+
return FromRecord4(schema_, references_, value);
|
|
5958
|
+
case "Ref":
|
|
5959
|
+
return FromRef5(schema_, references_, value);
|
|
5960
|
+
case "RegExp":
|
|
5961
|
+
return FromRegExp2(schema_, references_, value);
|
|
5962
|
+
case "String":
|
|
5963
|
+
return FromString2(schema_, references_, value);
|
|
5964
|
+
case "Symbol":
|
|
5965
|
+
return FromSymbol2(schema_, references_, value);
|
|
5966
|
+
case "TemplateLiteral":
|
|
5967
|
+
return FromTemplateLiteral4(schema_, references_, value);
|
|
5968
|
+
case "This":
|
|
5969
|
+
return FromThis(schema_, references_, value);
|
|
5970
|
+
case "Tuple":
|
|
5971
|
+
return FromTuple6(schema_, references_, value);
|
|
5972
|
+
case "Undefined":
|
|
5973
|
+
return FromUndefined2(schema_, references_, value);
|
|
5974
|
+
case "Union":
|
|
5975
|
+
return FromUnion11(schema_, references_, value);
|
|
5976
|
+
case "Uint8Array":
|
|
5977
|
+
return FromUint8Array2(schema_, references_, value);
|
|
5978
|
+
case "Unknown":
|
|
5979
|
+
return FromUnknown2(schema_, references_, value);
|
|
5980
|
+
case "Void":
|
|
5981
|
+
return FromVoid2(schema_, references_, value);
|
|
5982
|
+
default:
|
|
5983
|
+
if (!type_exports2.Has(schema_[Kind]))
|
|
5984
|
+
throw new ValueCheckUnknownTypeError(schema_);
|
|
5985
|
+
return FromKind(schema_, references_, value);
|
|
5986
|
+
}
|
|
5987
|
+
}
|
|
5988
|
+
function Check(...args) {
|
|
5989
|
+
return args.length === 3 ? Visit5(args[0], args[1], args[2]) : Visit5(args[0], [], args[1]);
|
|
5990
|
+
}
|
|
5991
|
+
|
|
5992
|
+
// ../../node_modules/@sinclair/typebox/build/esm/errors/errors.mjs
|
|
5993
|
+
var ValueErrorType;
|
|
5994
|
+
(function(ValueErrorType2) {
|
|
5995
|
+
ValueErrorType2[ValueErrorType2["ArrayContains"] = 0] = "ArrayContains";
|
|
5996
|
+
ValueErrorType2[ValueErrorType2["ArrayMaxContains"] = 1] = "ArrayMaxContains";
|
|
5997
|
+
ValueErrorType2[ValueErrorType2["ArrayMaxItems"] = 2] = "ArrayMaxItems";
|
|
5998
|
+
ValueErrorType2[ValueErrorType2["ArrayMinContains"] = 3] = "ArrayMinContains";
|
|
5999
|
+
ValueErrorType2[ValueErrorType2["ArrayMinItems"] = 4] = "ArrayMinItems";
|
|
6000
|
+
ValueErrorType2[ValueErrorType2["ArrayUniqueItems"] = 5] = "ArrayUniqueItems";
|
|
6001
|
+
ValueErrorType2[ValueErrorType2["Array"] = 6] = "Array";
|
|
6002
|
+
ValueErrorType2[ValueErrorType2["AsyncIterator"] = 7] = "AsyncIterator";
|
|
6003
|
+
ValueErrorType2[ValueErrorType2["BigIntExclusiveMaximum"] = 8] = "BigIntExclusiveMaximum";
|
|
6004
|
+
ValueErrorType2[ValueErrorType2["BigIntExclusiveMinimum"] = 9] = "BigIntExclusiveMinimum";
|
|
6005
|
+
ValueErrorType2[ValueErrorType2["BigIntMaximum"] = 10] = "BigIntMaximum";
|
|
6006
|
+
ValueErrorType2[ValueErrorType2["BigIntMinimum"] = 11] = "BigIntMinimum";
|
|
6007
|
+
ValueErrorType2[ValueErrorType2["BigIntMultipleOf"] = 12] = "BigIntMultipleOf";
|
|
6008
|
+
ValueErrorType2[ValueErrorType2["BigInt"] = 13] = "BigInt";
|
|
6009
|
+
ValueErrorType2[ValueErrorType2["Boolean"] = 14] = "Boolean";
|
|
6010
|
+
ValueErrorType2[ValueErrorType2["DateExclusiveMaximumTimestamp"] = 15] = "DateExclusiveMaximumTimestamp";
|
|
6011
|
+
ValueErrorType2[ValueErrorType2["DateExclusiveMinimumTimestamp"] = 16] = "DateExclusiveMinimumTimestamp";
|
|
6012
|
+
ValueErrorType2[ValueErrorType2["DateMaximumTimestamp"] = 17] = "DateMaximumTimestamp";
|
|
6013
|
+
ValueErrorType2[ValueErrorType2["DateMinimumTimestamp"] = 18] = "DateMinimumTimestamp";
|
|
6014
|
+
ValueErrorType2[ValueErrorType2["DateMultipleOfTimestamp"] = 19] = "DateMultipleOfTimestamp";
|
|
6015
|
+
ValueErrorType2[ValueErrorType2["Date"] = 20] = "Date";
|
|
6016
|
+
ValueErrorType2[ValueErrorType2["Function"] = 21] = "Function";
|
|
6017
|
+
ValueErrorType2[ValueErrorType2["IntegerExclusiveMaximum"] = 22] = "IntegerExclusiveMaximum";
|
|
6018
|
+
ValueErrorType2[ValueErrorType2["IntegerExclusiveMinimum"] = 23] = "IntegerExclusiveMinimum";
|
|
6019
|
+
ValueErrorType2[ValueErrorType2["IntegerMaximum"] = 24] = "IntegerMaximum";
|
|
6020
|
+
ValueErrorType2[ValueErrorType2["IntegerMinimum"] = 25] = "IntegerMinimum";
|
|
6021
|
+
ValueErrorType2[ValueErrorType2["IntegerMultipleOf"] = 26] = "IntegerMultipleOf";
|
|
6022
|
+
ValueErrorType2[ValueErrorType2["Integer"] = 27] = "Integer";
|
|
6023
|
+
ValueErrorType2[ValueErrorType2["IntersectUnevaluatedProperties"] = 28] = "IntersectUnevaluatedProperties";
|
|
6024
|
+
ValueErrorType2[ValueErrorType2["Intersect"] = 29] = "Intersect";
|
|
6025
|
+
ValueErrorType2[ValueErrorType2["Iterator"] = 30] = "Iterator";
|
|
6026
|
+
ValueErrorType2[ValueErrorType2["Kind"] = 31] = "Kind";
|
|
6027
|
+
ValueErrorType2[ValueErrorType2["Literal"] = 32] = "Literal";
|
|
6028
|
+
ValueErrorType2[ValueErrorType2["Never"] = 33] = "Never";
|
|
6029
|
+
ValueErrorType2[ValueErrorType2["Not"] = 34] = "Not";
|
|
6030
|
+
ValueErrorType2[ValueErrorType2["Null"] = 35] = "Null";
|
|
6031
|
+
ValueErrorType2[ValueErrorType2["NumberExclusiveMaximum"] = 36] = "NumberExclusiveMaximum";
|
|
6032
|
+
ValueErrorType2[ValueErrorType2["NumberExclusiveMinimum"] = 37] = "NumberExclusiveMinimum";
|
|
6033
|
+
ValueErrorType2[ValueErrorType2["NumberMaximum"] = 38] = "NumberMaximum";
|
|
6034
|
+
ValueErrorType2[ValueErrorType2["NumberMinimum"] = 39] = "NumberMinimum";
|
|
6035
|
+
ValueErrorType2[ValueErrorType2["NumberMultipleOf"] = 40] = "NumberMultipleOf";
|
|
6036
|
+
ValueErrorType2[ValueErrorType2["Number"] = 41] = "Number";
|
|
6037
|
+
ValueErrorType2[ValueErrorType2["ObjectAdditionalProperties"] = 42] = "ObjectAdditionalProperties";
|
|
6038
|
+
ValueErrorType2[ValueErrorType2["ObjectMaxProperties"] = 43] = "ObjectMaxProperties";
|
|
6039
|
+
ValueErrorType2[ValueErrorType2["ObjectMinProperties"] = 44] = "ObjectMinProperties";
|
|
6040
|
+
ValueErrorType2[ValueErrorType2["ObjectRequiredProperty"] = 45] = "ObjectRequiredProperty";
|
|
6041
|
+
ValueErrorType2[ValueErrorType2["Object"] = 46] = "Object";
|
|
6042
|
+
ValueErrorType2[ValueErrorType2["Promise"] = 47] = "Promise";
|
|
6043
|
+
ValueErrorType2[ValueErrorType2["RegExp"] = 48] = "RegExp";
|
|
6044
|
+
ValueErrorType2[ValueErrorType2["StringFormatUnknown"] = 49] = "StringFormatUnknown";
|
|
6045
|
+
ValueErrorType2[ValueErrorType2["StringFormat"] = 50] = "StringFormat";
|
|
6046
|
+
ValueErrorType2[ValueErrorType2["StringMaxLength"] = 51] = "StringMaxLength";
|
|
6047
|
+
ValueErrorType2[ValueErrorType2["StringMinLength"] = 52] = "StringMinLength";
|
|
6048
|
+
ValueErrorType2[ValueErrorType2["StringPattern"] = 53] = "StringPattern";
|
|
6049
|
+
ValueErrorType2[ValueErrorType2["String"] = 54] = "String";
|
|
6050
|
+
ValueErrorType2[ValueErrorType2["Symbol"] = 55] = "Symbol";
|
|
6051
|
+
ValueErrorType2[ValueErrorType2["TupleLength"] = 56] = "TupleLength";
|
|
6052
|
+
ValueErrorType2[ValueErrorType2["Tuple"] = 57] = "Tuple";
|
|
6053
|
+
ValueErrorType2[ValueErrorType2["Uint8ArrayMaxByteLength"] = 58] = "Uint8ArrayMaxByteLength";
|
|
6054
|
+
ValueErrorType2[ValueErrorType2["Uint8ArrayMinByteLength"] = 59] = "Uint8ArrayMinByteLength";
|
|
6055
|
+
ValueErrorType2[ValueErrorType2["Uint8Array"] = 60] = "Uint8Array";
|
|
6056
|
+
ValueErrorType2[ValueErrorType2["Undefined"] = 61] = "Undefined";
|
|
6057
|
+
ValueErrorType2[ValueErrorType2["Union"] = 62] = "Union";
|
|
6058
|
+
ValueErrorType2[ValueErrorType2["Void"] = 63] = "Void";
|
|
6059
|
+
})(ValueErrorType || (ValueErrorType = {}));
|
|
6060
|
+
var ValueErrorsUnknownTypeError = class extends TypeBoxError {
|
|
6061
|
+
constructor(schema) {
|
|
6062
|
+
super("Unknown type");
|
|
6063
|
+
this.schema = schema;
|
|
6064
|
+
}
|
|
6065
|
+
};
|
|
6066
|
+
function EscapeKey(key) {
|
|
6067
|
+
return key.replace(/~/g, "~0").replace(/\//g, "~1");
|
|
6068
|
+
}
|
|
6069
|
+
function IsDefined2(value) {
|
|
6070
|
+
return value !== void 0;
|
|
6071
|
+
}
|
|
6072
|
+
var ValueErrorIterator = class {
|
|
6073
|
+
constructor(iterator) {
|
|
6074
|
+
this.iterator = iterator;
|
|
6075
|
+
}
|
|
6076
|
+
[Symbol.iterator]() {
|
|
6077
|
+
return this.iterator;
|
|
6078
|
+
}
|
|
6079
|
+
/** Returns the first value error or undefined if no errors */
|
|
6080
|
+
First() {
|
|
6081
|
+
const next = this.iterator.next();
|
|
6082
|
+
return next.done ? void 0 : next.value;
|
|
6083
|
+
}
|
|
6084
|
+
};
|
|
6085
|
+
function Create(errorType, schema, path2, value, errors = []) {
|
|
6086
|
+
return {
|
|
6087
|
+
type: errorType,
|
|
6088
|
+
schema,
|
|
6089
|
+
path: path2,
|
|
6090
|
+
value,
|
|
6091
|
+
message: GetErrorFunction()({ errorType, path: path2, schema, value, errors }),
|
|
6092
|
+
errors
|
|
6093
|
+
};
|
|
6094
|
+
}
|
|
6095
|
+
function* FromAny3(schema, references, path2, value) {
|
|
6096
|
+
}
|
|
6097
|
+
function* FromArgument3(schema, references, path2, value) {
|
|
6098
|
+
}
|
|
6099
|
+
function* FromArray8(schema, references, path2, value) {
|
|
6100
|
+
if (!IsArray2(value)) {
|
|
6101
|
+
return yield Create(ValueErrorType.Array, schema, path2, value);
|
|
6102
|
+
}
|
|
6103
|
+
if (IsDefined2(schema.minItems) && !(value.length >= schema.minItems)) {
|
|
6104
|
+
yield Create(ValueErrorType.ArrayMinItems, schema, path2, value);
|
|
6105
|
+
}
|
|
6106
|
+
if (IsDefined2(schema.maxItems) && !(value.length <= schema.maxItems)) {
|
|
6107
|
+
yield Create(ValueErrorType.ArrayMaxItems, schema, path2, value);
|
|
6108
|
+
}
|
|
6109
|
+
for (let i = 0; i < value.length; i++) {
|
|
6110
|
+
yield* Visit6(schema.items, references, `${path2}/${i}`, value[i]);
|
|
6111
|
+
}
|
|
6112
|
+
if (schema.uniqueItems === true && !(function() {
|
|
6113
|
+
const set = /* @__PURE__ */ new Set();
|
|
6114
|
+
for (const element of value) {
|
|
6115
|
+
const hashed = Hash(element);
|
|
6116
|
+
if (set.has(hashed)) {
|
|
6117
|
+
return false;
|
|
6118
|
+
} else {
|
|
6119
|
+
set.add(hashed);
|
|
6120
|
+
}
|
|
6121
|
+
}
|
|
6122
|
+
return true;
|
|
6123
|
+
})()) {
|
|
6124
|
+
yield Create(ValueErrorType.ArrayUniqueItems, schema, path2, value);
|
|
6125
|
+
}
|
|
6126
|
+
if (!(IsDefined2(schema.contains) || IsDefined2(schema.minContains) || IsDefined2(schema.maxContains))) {
|
|
6127
|
+
return;
|
|
6128
|
+
}
|
|
6129
|
+
const containsSchema = IsDefined2(schema.contains) ? schema.contains : Never();
|
|
6130
|
+
const containsCount = value.reduce((acc, value2, index) => Visit6(containsSchema, references, `${path2}${index}`, value2).next().done === true ? acc + 1 : acc, 0);
|
|
6131
|
+
if (containsCount === 0) {
|
|
6132
|
+
yield Create(ValueErrorType.ArrayContains, schema, path2, value);
|
|
6133
|
+
}
|
|
6134
|
+
if (IsNumber2(schema.minContains) && containsCount < schema.minContains) {
|
|
6135
|
+
yield Create(ValueErrorType.ArrayMinContains, schema, path2, value);
|
|
6136
|
+
}
|
|
6137
|
+
if (IsNumber2(schema.maxContains) && containsCount > schema.maxContains) {
|
|
6138
|
+
yield Create(ValueErrorType.ArrayMaxContains, schema, path2, value);
|
|
6139
|
+
}
|
|
6140
|
+
}
|
|
6141
|
+
function* FromAsyncIterator5(schema, references, path2, value) {
|
|
6142
|
+
if (!IsAsyncIterator2(value))
|
|
6143
|
+
yield Create(ValueErrorType.AsyncIterator, schema, path2, value);
|
|
6144
|
+
}
|
|
6145
|
+
function* FromBigInt3(schema, references, path2, value) {
|
|
6146
|
+
if (!IsBigInt2(value))
|
|
6147
|
+
return yield Create(ValueErrorType.BigInt, schema, path2, value);
|
|
6148
|
+
if (IsDefined2(schema.exclusiveMaximum) && !(value < schema.exclusiveMaximum)) {
|
|
6149
|
+
yield Create(ValueErrorType.BigIntExclusiveMaximum, schema, path2, value);
|
|
6150
|
+
}
|
|
6151
|
+
if (IsDefined2(schema.exclusiveMinimum) && !(value > schema.exclusiveMinimum)) {
|
|
6152
|
+
yield Create(ValueErrorType.BigIntExclusiveMinimum, schema, path2, value);
|
|
6153
|
+
}
|
|
6154
|
+
if (IsDefined2(schema.maximum) && !(value <= schema.maximum)) {
|
|
6155
|
+
yield Create(ValueErrorType.BigIntMaximum, schema, path2, value);
|
|
6156
|
+
}
|
|
6157
|
+
if (IsDefined2(schema.minimum) && !(value >= schema.minimum)) {
|
|
6158
|
+
yield Create(ValueErrorType.BigIntMinimum, schema, path2, value);
|
|
6159
|
+
}
|
|
6160
|
+
if (IsDefined2(schema.multipleOf) && !(value % schema.multipleOf === BigInt(0))) {
|
|
6161
|
+
yield Create(ValueErrorType.BigIntMultipleOf, schema, path2, value);
|
|
6162
|
+
}
|
|
6163
|
+
}
|
|
6164
|
+
function* FromBoolean3(schema, references, path2, value) {
|
|
6165
|
+
if (!IsBoolean2(value))
|
|
6166
|
+
yield Create(ValueErrorType.Boolean, schema, path2, value);
|
|
6167
|
+
}
|
|
6168
|
+
function* FromConstructor5(schema, references, path2, value) {
|
|
6169
|
+
yield* Visit6(schema.returns, references, path2, value.prototype);
|
|
6170
|
+
}
|
|
6171
|
+
function* FromDate3(schema, references, path2, value) {
|
|
6172
|
+
if (!IsDate2(value))
|
|
6173
|
+
return yield Create(ValueErrorType.Date, schema, path2, value);
|
|
6174
|
+
if (IsDefined2(schema.exclusiveMaximumTimestamp) && !(value.getTime() < schema.exclusiveMaximumTimestamp)) {
|
|
6175
|
+
yield Create(ValueErrorType.DateExclusiveMaximumTimestamp, schema, path2, value);
|
|
6176
|
+
}
|
|
6177
|
+
if (IsDefined2(schema.exclusiveMinimumTimestamp) && !(value.getTime() > schema.exclusiveMinimumTimestamp)) {
|
|
6178
|
+
yield Create(ValueErrorType.DateExclusiveMinimumTimestamp, schema, path2, value);
|
|
6179
|
+
}
|
|
6180
|
+
if (IsDefined2(schema.maximumTimestamp) && !(value.getTime() <= schema.maximumTimestamp)) {
|
|
6181
|
+
yield Create(ValueErrorType.DateMaximumTimestamp, schema, path2, value);
|
|
6182
|
+
}
|
|
6183
|
+
if (IsDefined2(schema.minimumTimestamp) && !(value.getTime() >= schema.minimumTimestamp)) {
|
|
6184
|
+
yield Create(ValueErrorType.DateMinimumTimestamp, schema, path2, value);
|
|
6185
|
+
}
|
|
6186
|
+
if (IsDefined2(schema.multipleOfTimestamp) && !(value.getTime() % schema.multipleOfTimestamp === 0)) {
|
|
6187
|
+
yield Create(ValueErrorType.DateMultipleOfTimestamp, schema, path2, value);
|
|
6188
|
+
}
|
|
6189
|
+
}
|
|
6190
|
+
function* FromFunction5(schema, references, path2, value) {
|
|
6191
|
+
if (!IsFunction2(value))
|
|
6192
|
+
yield Create(ValueErrorType.Function, schema, path2, value);
|
|
6193
|
+
}
|
|
6194
|
+
function* FromImport2(schema, references, path2, value) {
|
|
6195
|
+
const definitions = globalThis.Object.values(schema.$defs);
|
|
6196
|
+
const target = schema.$defs[schema.$ref];
|
|
6197
|
+
yield* Visit6(target, [...references, ...definitions], path2, value);
|
|
6198
|
+
}
|
|
6199
|
+
function* FromInteger3(schema, references, path2, value) {
|
|
6200
|
+
if (!IsInteger(value))
|
|
6201
|
+
return yield Create(ValueErrorType.Integer, schema, path2, value);
|
|
6202
|
+
if (IsDefined2(schema.exclusiveMaximum) && !(value < schema.exclusiveMaximum)) {
|
|
6203
|
+
yield Create(ValueErrorType.IntegerExclusiveMaximum, schema, path2, value);
|
|
6204
|
+
}
|
|
6205
|
+
if (IsDefined2(schema.exclusiveMinimum) && !(value > schema.exclusiveMinimum)) {
|
|
6206
|
+
yield Create(ValueErrorType.IntegerExclusiveMinimum, schema, path2, value);
|
|
6207
|
+
}
|
|
6208
|
+
if (IsDefined2(schema.maximum) && !(value <= schema.maximum)) {
|
|
6209
|
+
yield Create(ValueErrorType.IntegerMaximum, schema, path2, value);
|
|
6210
|
+
}
|
|
6211
|
+
if (IsDefined2(schema.minimum) && !(value >= schema.minimum)) {
|
|
6212
|
+
yield Create(ValueErrorType.IntegerMinimum, schema, path2, value);
|
|
6213
|
+
}
|
|
6214
|
+
if (IsDefined2(schema.multipleOf) && !(value % schema.multipleOf === 0)) {
|
|
6215
|
+
yield Create(ValueErrorType.IntegerMultipleOf, schema, path2, value);
|
|
6216
|
+
}
|
|
6217
|
+
}
|
|
6218
|
+
function* FromIntersect10(schema, references, path2, value) {
|
|
6219
|
+
let hasError = false;
|
|
6220
|
+
for (const inner of schema.allOf) {
|
|
6221
|
+
for (const error of Visit6(inner, references, path2, value)) {
|
|
6222
|
+
hasError = true;
|
|
6223
|
+
yield error;
|
|
6224
|
+
}
|
|
6225
|
+
}
|
|
6226
|
+
if (hasError) {
|
|
6227
|
+
return yield Create(ValueErrorType.Intersect, schema, path2, value);
|
|
6228
|
+
}
|
|
6229
|
+
if (schema.unevaluatedProperties === false) {
|
|
6230
|
+
const keyCheck = new RegExp(KeyOfPattern(schema));
|
|
6231
|
+
for (const valueKey of Object.getOwnPropertyNames(value)) {
|
|
6232
|
+
if (!keyCheck.test(valueKey)) {
|
|
6233
|
+
yield Create(ValueErrorType.IntersectUnevaluatedProperties, schema, `${path2}/${valueKey}`, value);
|
|
6234
|
+
}
|
|
6235
|
+
}
|
|
6236
|
+
}
|
|
6237
|
+
if (typeof schema.unevaluatedProperties === "object") {
|
|
6238
|
+
const keyCheck = new RegExp(KeyOfPattern(schema));
|
|
6239
|
+
for (const valueKey of Object.getOwnPropertyNames(value)) {
|
|
6240
|
+
if (!keyCheck.test(valueKey)) {
|
|
6241
|
+
const next = Visit6(schema.unevaluatedProperties, references, `${path2}/${valueKey}`, value[valueKey]).next();
|
|
6242
|
+
if (!next.done)
|
|
6243
|
+
yield next.value;
|
|
6244
|
+
}
|
|
6245
|
+
}
|
|
6246
|
+
}
|
|
6247
|
+
}
|
|
6248
|
+
function* FromIterator5(schema, references, path2, value) {
|
|
6249
|
+
if (!IsIterator2(value))
|
|
6250
|
+
yield Create(ValueErrorType.Iterator, schema, path2, value);
|
|
6251
|
+
}
|
|
6252
|
+
function* FromLiteral4(schema, references, path2, value) {
|
|
6253
|
+
if (!(value === schema.const))
|
|
6254
|
+
yield Create(ValueErrorType.Literal, schema, path2, value);
|
|
6255
|
+
}
|
|
6256
|
+
function* FromNever3(schema, references, path2, value) {
|
|
6257
|
+
yield Create(ValueErrorType.Never, schema, path2, value);
|
|
6258
|
+
}
|
|
6259
|
+
function* FromNot3(schema, references, path2, value) {
|
|
6260
|
+
if (Visit6(schema.not, references, path2, value).next().done === true)
|
|
6261
|
+
yield Create(ValueErrorType.Not, schema, path2, value);
|
|
6262
|
+
}
|
|
6263
|
+
function* FromNull3(schema, references, path2, value) {
|
|
6264
|
+
if (!IsNull2(value))
|
|
6265
|
+
yield Create(ValueErrorType.Null, schema, path2, value);
|
|
6266
|
+
}
|
|
6267
|
+
function* FromNumber3(schema, references, path2, value) {
|
|
6268
|
+
if (!TypeSystemPolicy.IsNumberLike(value))
|
|
6269
|
+
return yield Create(ValueErrorType.Number, schema, path2, value);
|
|
6270
|
+
if (IsDefined2(schema.exclusiveMaximum) && !(value < schema.exclusiveMaximum)) {
|
|
6271
|
+
yield Create(ValueErrorType.NumberExclusiveMaximum, schema, path2, value);
|
|
6272
|
+
}
|
|
6273
|
+
if (IsDefined2(schema.exclusiveMinimum) && !(value > schema.exclusiveMinimum)) {
|
|
6274
|
+
yield Create(ValueErrorType.NumberExclusiveMinimum, schema, path2, value);
|
|
6275
|
+
}
|
|
6276
|
+
if (IsDefined2(schema.maximum) && !(value <= schema.maximum)) {
|
|
6277
|
+
yield Create(ValueErrorType.NumberMaximum, schema, path2, value);
|
|
6278
|
+
}
|
|
6279
|
+
if (IsDefined2(schema.minimum) && !(value >= schema.minimum)) {
|
|
6280
|
+
yield Create(ValueErrorType.NumberMinimum, schema, path2, value);
|
|
6281
|
+
}
|
|
6282
|
+
if (IsDefined2(schema.multipleOf) && !(value % schema.multipleOf === 0)) {
|
|
6283
|
+
yield Create(ValueErrorType.NumberMultipleOf, schema, path2, value);
|
|
6284
|
+
}
|
|
6285
|
+
}
|
|
6286
|
+
function* FromObject9(schema, references, path2, value) {
|
|
6287
|
+
if (!TypeSystemPolicy.IsObjectLike(value))
|
|
6288
|
+
return yield Create(ValueErrorType.Object, schema, path2, value);
|
|
6289
|
+
if (IsDefined2(schema.minProperties) && !(Object.getOwnPropertyNames(value).length >= schema.minProperties)) {
|
|
6290
|
+
yield Create(ValueErrorType.ObjectMinProperties, schema, path2, value);
|
|
6291
|
+
}
|
|
6292
|
+
if (IsDefined2(schema.maxProperties) && !(Object.getOwnPropertyNames(value).length <= schema.maxProperties)) {
|
|
6293
|
+
yield Create(ValueErrorType.ObjectMaxProperties, schema, path2, value);
|
|
6294
|
+
}
|
|
6295
|
+
const requiredKeys = Array.isArray(schema.required) ? schema.required : [];
|
|
6296
|
+
const knownKeys = Object.getOwnPropertyNames(schema.properties);
|
|
6297
|
+
const unknownKeys = Object.getOwnPropertyNames(value);
|
|
6298
|
+
for (const requiredKey of requiredKeys) {
|
|
6299
|
+
if (unknownKeys.includes(requiredKey))
|
|
6300
|
+
continue;
|
|
6301
|
+
yield Create(ValueErrorType.ObjectRequiredProperty, schema.properties[requiredKey], `${path2}/${EscapeKey(requiredKey)}`, void 0);
|
|
6302
|
+
}
|
|
6303
|
+
if (schema.additionalProperties === false) {
|
|
6304
|
+
for (const valueKey of unknownKeys) {
|
|
6305
|
+
if (!knownKeys.includes(valueKey)) {
|
|
6306
|
+
yield Create(ValueErrorType.ObjectAdditionalProperties, schema, `${path2}/${EscapeKey(valueKey)}`, value[valueKey]);
|
|
6307
|
+
}
|
|
6308
|
+
}
|
|
6309
|
+
}
|
|
6310
|
+
if (typeof schema.additionalProperties === "object") {
|
|
6311
|
+
for (const valueKey of unknownKeys) {
|
|
6312
|
+
if (knownKeys.includes(valueKey))
|
|
6313
|
+
continue;
|
|
6314
|
+
yield* Visit6(schema.additionalProperties, references, `${path2}/${EscapeKey(valueKey)}`, value[valueKey]);
|
|
6315
|
+
}
|
|
6316
|
+
}
|
|
6317
|
+
for (const knownKey of knownKeys) {
|
|
6318
|
+
const property = schema.properties[knownKey];
|
|
6319
|
+
if (schema.required && schema.required.includes(knownKey)) {
|
|
6320
|
+
yield* Visit6(property, references, `${path2}/${EscapeKey(knownKey)}`, value[knownKey]);
|
|
6321
|
+
if (ExtendsUndefinedCheck(schema) && !(knownKey in value)) {
|
|
6322
|
+
yield Create(ValueErrorType.ObjectRequiredProperty, property, `${path2}/${EscapeKey(knownKey)}`, void 0);
|
|
6323
|
+
}
|
|
6324
|
+
} else {
|
|
6325
|
+
if (TypeSystemPolicy.IsExactOptionalProperty(value, knownKey)) {
|
|
6326
|
+
yield* Visit6(property, references, `${path2}/${EscapeKey(knownKey)}`, value[knownKey]);
|
|
6327
|
+
}
|
|
6328
|
+
}
|
|
6329
|
+
}
|
|
6330
|
+
}
|
|
6331
|
+
function* FromPromise5(schema, references, path2, value) {
|
|
6332
|
+
if (!IsPromise(value))
|
|
6333
|
+
yield Create(ValueErrorType.Promise, schema, path2, value);
|
|
6334
|
+
}
|
|
6335
|
+
function* FromRecord5(schema, references, path2, value) {
|
|
6336
|
+
if (!TypeSystemPolicy.IsRecordLike(value))
|
|
6337
|
+
return yield Create(ValueErrorType.Object, schema, path2, value);
|
|
6338
|
+
if (IsDefined2(schema.minProperties) && !(Object.getOwnPropertyNames(value).length >= schema.minProperties)) {
|
|
6339
|
+
yield Create(ValueErrorType.ObjectMinProperties, schema, path2, value);
|
|
6340
|
+
}
|
|
6341
|
+
if (IsDefined2(schema.maxProperties) && !(Object.getOwnPropertyNames(value).length <= schema.maxProperties)) {
|
|
6342
|
+
yield Create(ValueErrorType.ObjectMaxProperties, schema, path2, value);
|
|
6343
|
+
}
|
|
6344
|
+
const [patternKey, patternSchema] = Object.entries(schema.patternProperties)[0];
|
|
6345
|
+
const regex = new RegExp(patternKey);
|
|
6346
|
+
for (const [propertyKey, propertyValue] of Object.entries(value)) {
|
|
6347
|
+
if (regex.test(propertyKey))
|
|
6348
|
+
yield* Visit6(patternSchema, references, `${path2}/${EscapeKey(propertyKey)}`, propertyValue);
|
|
6349
|
+
}
|
|
6350
|
+
if (typeof schema.additionalProperties === "object") {
|
|
6351
|
+
for (const [propertyKey, propertyValue] of Object.entries(value)) {
|
|
6352
|
+
if (!regex.test(propertyKey))
|
|
6353
|
+
yield* Visit6(schema.additionalProperties, references, `${path2}/${EscapeKey(propertyKey)}`, propertyValue);
|
|
6354
|
+
}
|
|
6355
|
+
}
|
|
6356
|
+
if (schema.additionalProperties === false) {
|
|
6357
|
+
for (const [propertyKey, propertyValue] of Object.entries(value)) {
|
|
6358
|
+
if (regex.test(propertyKey))
|
|
6359
|
+
continue;
|
|
6360
|
+
return yield Create(ValueErrorType.ObjectAdditionalProperties, schema, `${path2}/${EscapeKey(propertyKey)}`, propertyValue);
|
|
6361
|
+
}
|
|
6362
|
+
}
|
|
6363
|
+
}
|
|
6364
|
+
function* FromRef6(schema, references, path2, value) {
|
|
6365
|
+
yield* Visit6(Deref(schema, references), references, path2, value);
|
|
6366
|
+
}
|
|
6367
|
+
function* FromRegExp3(schema, references, path2, value) {
|
|
6368
|
+
if (!IsString2(value))
|
|
6369
|
+
return yield Create(ValueErrorType.String, schema, path2, value);
|
|
6370
|
+
if (IsDefined2(schema.minLength) && !(value.length >= schema.minLength)) {
|
|
6371
|
+
yield Create(ValueErrorType.StringMinLength, schema, path2, value);
|
|
6372
|
+
}
|
|
6373
|
+
if (IsDefined2(schema.maxLength) && !(value.length <= schema.maxLength)) {
|
|
6374
|
+
yield Create(ValueErrorType.StringMaxLength, schema, path2, value);
|
|
6375
|
+
}
|
|
6376
|
+
const regex = new RegExp(schema.source, schema.flags);
|
|
6377
|
+
if (!regex.test(value)) {
|
|
6378
|
+
return yield Create(ValueErrorType.RegExp, schema, path2, value);
|
|
6379
|
+
}
|
|
6380
|
+
}
|
|
6381
|
+
function* FromString3(schema, references, path2, value) {
|
|
6382
|
+
if (!IsString2(value))
|
|
6383
|
+
return yield Create(ValueErrorType.String, schema, path2, value);
|
|
6384
|
+
if (IsDefined2(schema.minLength) && !(value.length >= schema.minLength)) {
|
|
6385
|
+
yield Create(ValueErrorType.StringMinLength, schema, path2, value);
|
|
6386
|
+
}
|
|
6387
|
+
if (IsDefined2(schema.maxLength) && !(value.length <= schema.maxLength)) {
|
|
6388
|
+
yield Create(ValueErrorType.StringMaxLength, schema, path2, value);
|
|
6389
|
+
}
|
|
6390
|
+
if (IsString2(schema.pattern)) {
|
|
6391
|
+
const regex = new RegExp(schema.pattern);
|
|
6392
|
+
if (!regex.test(value)) {
|
|
6393
|
+
yield Create(ValueErrorType.StringPattern, schema, path2, value);
|
|
6394
|
+
}
|
|
6395
|
+
}
|
|
6396
|
+
if (IsString2(schema.format)) {
|
|
6397
|
+
if (!format_exports.Has(schema.format)) {
|
|
6398
|
+
yield Create(ValueErrorType.StringFormatUnknown, schema, path2, value);
|
|
6399
|
+
} else {
|
|
6400
|
+
const format = format_exports.Get(schema.format);
|
|
6401
|
+
if (!format(value)) {
|
|
6402
|
+
yield Create(ValueErrorType.StringFormat, schema, path2, value);
|
|
6403
|
+
}
|
|
6404
|
+
}
|
|
6405
|
+
}
|
|
6406
|
+
}
|
|
6407
|
+
function* FromSymbol3(schema, references, path2, value) {
|
|
6408
|
+
if (!IsSymbol2(value))
|
|
6409
|
+
yield Create(ValueErrorType.Symbol, schema, path2, value);
|
|
6410
|
+
}
|
|
6411
|
+
function* FromTemplateLiteral5(schema, references, path2, value) {
|
|
6412
|
+
if (!IsString2(value))
|
|
6413
|
+
return yield Create(ValueErrorType.String, schema, path2, value);
|
|
6414
|
+
const regex = new RegExp(schema.pattern);
|
|
6415
|
+
if (!regex.test(value)) {
|
|
6416
|
+
yield Create(ValueErrorType.StringPattern, schema, path2, value);
|
|
6417
|
+
}
|
|
6418
|
+
}
|
|
6419
|
+
function* FromThis2(schema, references, path2, value) {
|
|
6420
|
+
yield* Visit6(Deref(schema, references), references, path2, value);
|
|
6421
|
+
}
|
|
6422
|
+
function* FromTuple7(schema, references, path2, value) {
|
|
6423
|
+
if (!IsArray2(value))
|
|
6424
|
+
return yield Create(ValueErrorType.Tuple, schema, path2, value);
|
|
6425
|
+
if (schema.items === void 0 && !(value.length === 0)) {
|
|
6426
|
+
return yield Create(ValueErrorType.TupleLength, schema, path2, value);
|
|
6427
|
+
}
|
|
6428
|
+
if (!(value.length === schema.maxItems)) {
|
|
6429
|
+
return yield Create(ValueErrorType.TupleLength, schema, path2, value);
|
|
6430
|
+
}
|
|
6431
|
+
if (!schema.items) {
|
|
6432
|
+
return;
|
|
6433
|
+
}
|
|
6434
|
+
for (let i = 0; i < schema.items.length; i++) {
|
|
6435
|
+
yield* Visit6(schema.items[i], references, `${path2}/${i}`, value[i]);
|
|
6436
|
+
}
|
|
6437
|
+
}
|
|
6438
|
+
function* FromUndefined3(schema, references, path2, value) {
|
|
6439
|
+
if (!IsUndefined2(value))
|
|
6440
|
+
yield Create(ValueErrorType.Undefined, schema, path2, value);
|
|
6441
|
+
}
|
|
6442
|
+
function* FromUnion12(schema, references, path2, value) {
|
|
6443
|
+
if (Check(schema, references, value))
|
|
6444
|
+
return;
|
|
6445
|
+
const errors = schema.anyOf.map((variant) => new ValueErrorIterator(Visit6(variant, references, path2, value)));
|
|
6446
|
+
yield Create(ValueErrorType.Union, schema, path2, value, errors);
|
|
6447
|
+
}
|
|
6448
|
+
function* FromUint8Array3(schema, references, path2, value) {
|
|
6449
|
+
if (!IsUint8Array2(value))
|
|
6450
|
+
return yield Create(ValueErrorType.Uint8Array, schema, path2, value);
|
|
6451
|
+
if (IsDefined2(schema.maxByteLength) && !(value.length <= schema.maxByteLength)) {
|
|
6452
|
+
yield Create(ValueErrorType.Uint8ArrayMaxByteLength, schema, path2, value);
|
|
6453
|
+
}
|
|
6454
|
+
if (IsDefined2(schema.minByteLength) && !(value.length >= schema.minByteLength)) {
|
|
6455
|
+
yield Create(ValueErrorType.Uint8ArrayMinByteLength, schema, path2, value);
|
|
6456
|
+
}
|
|
6457
|
+
}
|
|
6458
|
+
function* FromUnknown3(schema, references, path2, value) {
|
|
6459
|
+
}
|
|
6460
|
+
function* FromVoid3(schema, references, path2, value) {
|
|
6461
|
+
if (!TypeSystemPolicy.IsVoidLike(value))
|
|
6462
|
+
yield Create(ValueErrorType.Void, schema, path2, value);
|
|
6463
|
+
}
|
|
6464
|
+
function* FromKind2(schema, references, path2, value) {
|
|
6465
|
+
const check = type_exports2.Get(schema[Kind]);
|
|
6466
|
+
if (!check(schema, value))
|
|
6467
|
+
yield Create(ValueErrorType.Kind, schema, path2, value);
|
|
6468
|
+
}
|
|
6469
|
+
function* Visit6(schema, references, path2, value) {
|
|
6470
|
+
const references_ = IsDefined2(schema.$id) ? [...references, schema] : references;
|
|
6471
|
+
const schema_ = schema;
|
|
6472
|
+
switch (schema_[Kind]) {
|
|
6473
|
+
case "Any":
|
|
6474
|
+
return yield* FromAny3(schema_, references_, path2, value);
|
|
6475
|
+
case "Argument":
|
|
6476
|
+
return yield* FromArgument3(schema_, references_, path2, value);
|
|
6477
|
+
case "Array":
|
|
6478
|
+
return yield* FromArray8(schema_, references_, path2, value);
|
|
6479
|
+
case "AsyncIterator":
|
|
6480
|
+
return yield* FromAsyncIterator5(schema_, references_, path2, value);
|
|
6481
|
+
case "BigInt":
|
|
6482
|
+
return yield* FromBigInt3(schema_, references_, path2, value);
|
|
6483
|
+
case "Boolean":
|
|
6484
|
+
return yield* FromBoolean3(schema_, references_, path2, value);
|
|
6485
|
+
case "Constructor":
|
|
6486
|
+
return yield* FromConstructor5(schema_, references_, path2, value);
|
|
6487
|
+
case "Date":
|
|
6488
|
+
return yield* FromDate3(schema_, references_, path2, value);
|
|
6489
|
+
case "Function":
|
|
6490
|
+
return yield* FromFunction5(schema_, references_, path2, value);
|
|
6491
|
+
case "Import":
|
|
6492
|
+
return yield* FromImport2(schema_, references_, path2, value);
|
|
6493
|
+
case "Integer":
|
|
6494
|
+
return yield* FromInteger3(schema_, references_, path2, value);
|
|
6495
|
+
case "Intersect":
|
|
6496
|
+
return yield* FromIntersect10(schema_, references_, path2, value);
|
|
6497
|
+
case "Iterator":
|
|
6498
|
+
return yield* FromIterator5(schema_, references_, path2, value);
|
|
6499
|
+
case "Literal":
|
|
6500
|
+
return yield* FromLiteral4(schema_, references_, path2, value);
|
|
6501
|
+
case "Never":
|
|
6502
|
+
return yield* FromNever3(schema_, references_, path2, value);
|
|
6503
|
+
case "Not":
|
|
6504
|
+
return yield* FromNot3(schema_, references_, path2, value);
|
|
6505
|
+
case "Null":
|
|
6506
|
+
return yield* FromNull3(schema_, references_, path2, value);
|
|
6507
|
+
case "Number":
|
|
6508
|
+
return yield* FromNumber3(schema_, references_, path2, value);
|
|
6509
|
+
case "Object":
|
|
6510
|
+
return yield* FromObject9(schema_, references_, path2, value);
|
|
6511
|
+
case "Promise":
|
|
6512
|
+
return yield* FromPromise5(schema_, references_, path2, value);
|
|
6513
|
+
case "Record":
|
|
6514
|
+
return yield* FromRecord5(schema_, references_, path2, value);
|
|
6515
|
+
case "Ref":
|
|
6516
|
+
return yield* FromRef6(schema_, references_, path2, value);
|
|
6517
|
+
case "RegExp":
|
|
6518
|
+
return yield* FromRegExp3(schema_, references_, path2, value);
|
|
6519
|
+
case "String":
|
|
6520
|
+
return yield* FromString3(schema_, references_, path2, value);
|
|
6521
|
+
case "Symbol":
|
|
6522
|
+
return yield* FromSymbol3(schema_, references_, path2, value);
|
|
6523
|
+
case "TemplateLiteral":
|
|
6524
|
+
return yield* FromTemplateLiteral5(schema_, references_, path2, value);
|
|
6525
|
+
case "This":
|
|
6526
|
+
return yield* FromThis2(schema_, references_, path2, value);
|
|
6527
|
+
case "Tuple":
|
|
6528
|
+
return yield* FromTuple7(schema_, references_, path2, value);
|
|
6529
|
+
case "Undefined":
|
|
6530
|
+
return yield* FromUndefined3(schema_, references_, path2, value);
|
|
6531
|
+
case "Union":
|
|
6532
|
+
return yield* FromUnion12(schema_, references_, path2, value);
|
|
6533
|
+
case "Uint8Array":
|
|
6534
|
+
return yield* FromUint8Array3(schema_, references_, path2, value);
|
|
6535
|
+
case "Unknown":
|
|
6536
|
+
return yield* FromUnknown3(schema_, references_, path2, value);
|
|
6537
|
+
case "Void":
|
|
6538
|
+
return yield* FromVoid3(schema_, references_, path2, value);
|
|
6539
|
+
default:
|
|
6540
|
+
if (!type_exports2.Has(schema_[Kind]))
|
|
6541
|
+
throw new ValueErrorsUnknownTypeError(schema);
|
|
6542
|
+
return yield* FromKind2(schema_, references_, path2, value);
|
|
6543
|
+
}
|
|
6544
|
+
}
|
|
6545
|
+
function Errors(...args) {
|
|
6546
|
+
const iterator = args.length === 3 ? Visit6(args[0], args[1], "", args[2]) : Visit6(args[0], [], "", args[1]);
|
|
6547
|
+
return new ValueErrorIterator(iterator);
|
|
6548
|
+
}
|
|
6549
|
+
|
|
6550
|
+
// ../../node_modules/@sinclair/typebox/build/esm/value/assert/assert.mjs
|
|
6551
|
+
var __classPrivateFieldSet = function(receiver, state, value, kind, f) {
|
|
6552
|
+
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
6553
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
6554
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
6555
|
+
return kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value), value;
|
|
6556
|
+
};
|
|
6557
|
+
var __classPrivateFieldGet = function(receiver, state, kind, f) {
|
|
6558
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
6559
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
6560
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
6561
|
+
};
|
|
6562
|
+
var _AssertError_instances;
|
|
6563
|
+
var _AssertError_iterator;
|
|
6564
|
+
var _AssertError_Iterator;
|
|
6565
|
+
var AssertError = class extends TypeBoxError {
|
|
6566
|
+
constructor(iterator) {
|
|
6567
|
+
const error = iterator.First();
|
|
6568
|
+
super(error === void 0 ? "Invalid Value" : error.message);
|
|
6569
|
+
_AssertError_instances.add(this);
|
|
6570
|
+
_AssertError_iterator.set(this, void 0);
|
|
6571
|
+
__classPrivateFieldSet(this, _AssertError_iterator, iterator, "f");
|
|
6572
|
+
this.error = error;
|
|
6573
|
+
}
|
|
6574
|
+
/** Returns an iterator for each error in this value. */
|
|
6575
|
+
Errors() {
|
|
6576
|
+
return new ValueErrorIterator(__classPrivateFieldGet(this, _AssertError_instances, "m", _AssertError_Iterator).call(this));
|
|
6577
|
+
}
|
|
6578
|
+
};
|
|
6579
|
+
_AssertError_iterator = /* @__PURE__ */ new WeakMap(), _AssertError_instances = /* @__PURE__ */ new WeakSet(), _AssertError_Iterator = function* _AssertError_Iterator2() {
|
|
6580
|
+
if (this.error)
|
|
6581
|
+
yield this.error;
|
|
6582
|
+
yield* __classPrivateFieldGet(this, _AssertError_iterator, "f");
|
|
6583
|
+
};
|
|
6584
|
+
function AssertValue(schema, references, value) {
|
|
6585
|
+
if (Check(schema, references, value))
|
|
6586
|
+
return;
|
|
6587
|
+
throw new AssertError(Errors(schema, references, value));
|
|
6588
|
+
}
|
|
6589
|
+
function Assert(...args) {
|
|
6590
|
+
return args.length === 3 ? AssertValue(args[0], args[1], args[2]) : AssertValue(args[0], [], args[1]);
|
|
6591
|
+
}
|
|
6592
|
+
|
|
6593
|
+
// ../../node_modules/@sinclair/typebox/build/esm/value/clone/clone.mjs
|
|
6594
|
+
function FromObject10(value) {
|
|
6595
|
+
const Acc = {};
|
|
6596
|
+
for (const key of Object.getOwnPropertyNames(value)) {
|
|
6597
|
+
Acc[key] = Clone2(value[key]);
|
|
6598
|
+
}
|
|
6599
|
+
for (const key of Object.getOwnPropertySymbols(value)) {
|
|
6600
|
+
Acc[key] = Clone2(value[key]);
|
|
6601
|
+
}
|
|
6602
|
+
return Acc;
|
|
6603
|
+
}
|
|
6604
|
+
function FromArray9(value) {
|
|
6605
|
+
return value.map((element) => Clone2(element));
|
|
6606
|
+
}
|
|
6607
|
+
function FromTypedArray(value) {
|
|
6608
|
+
return value.slice();
|
|
6609
|
+
}
|
|
6610
|
+
function FromMap(value) {
|
|
6611
|
+
return new Map(Clone2([...value.entries()]));
|
|
6612
|
+
}
|
|
6613
|
+
function FromSet(value) {
|
|
6614
|
+
return new Set(Clone2([...value.entries()]));
|
|
6615
|
+
}
|
|
6616
|
+
function FromDate4(value) {
|
|
6617
|
+
return new Date(value.toISOString());
|
|
6618
|
+
}
|
|
6619
|
+
function FromValue2(value) {
|
|
6620
|
+
return value;
|
|
6621
|
+
}
|
|
6622
|
+
function Clone2(value) {
|
|
6623
|
+
if (IsArray2(value))
|
|
6624
|
+
return FromArray9(value);
|
|
6625
|
+
if (IsDate2(value))
|
|
6626
|
+
return FromDate4(value);
|
|
6627
|
+
if (IsTypedArray(value))
|
|
6628
|
+
return FromTypedArray(value);
|
|
6629
|
+
if (IsMap(value))
|
|
6630
|
+
return FromMap(value);
|
|
6631
|
+
if (IsSet(value))
|
|
6632
|
+
return FromSet(value);
|
|
6633
|
+
if (IsObject2(value))
|
|
6634
|
+
return FromObject10(value);
|
|
6635
|
+
if (IsValueType(value))
|
|
6636
|
+
return FromValue2(value);
|
|
6637
|
+
throw new Error("ValueClone: Unable to clone value");
|
|
6638
|
+
}
|
|
6639
|
+
|
|
6640
|
+
// ../../node_modules/@sinclair/typebox/build/esm/value/create/create.mjs
|
|
6641
|
+
var ValueCreateError = class extends TypeBoxError {
|
|
6642
|
+
constructor(schema, message) {
|
|
6643
|
+
super(message);
|
|
6644
|
+
this.schema = schema;
|
|
6645
|
+
}
|
|
6646
|
+
};
|
|
6647
|
+
function FromDefault(value) {
|
|
6648
|
+
return IsFunction2(value) ? value() : Clone2(value);
|
|
6649
|
+
}
|
|
6650
|
+
function FromAny4(schema, references) {
|
|
6651
|
+
if (HasPropertyKey2(schema, "default")) {
|
|
6652
|
+
return FromDefault(schema.default);
|
|
6653
|
+
} else {
|
|
6654
|
+
return {};
|
|
6655
|
+
}
|
|
6656
|
+
}
|
|
6657
|
+
function FromArgument4(schema, references) {
|
|
6658
|
+
return {};
|
|
6659
|
+
}
|
|
6660
|
+
function FromArray10(schema, references) {
|
|
6661
|
+
if (schema.uniqueItems === true && !HasPropertyKey2(schema, "default")) {
|
|
6662
|
+
throw new ValueCreateError(schema, "Array with the uniqueItems constraint requires a default value");
|
|
6663
|
+
} else if ("contains" in schema && !HasPropertyKey2(schema, "default")) {
|
|
6664
|
+
throw new ValueCreateError(schema, "Array with the contains constraint requires a default value");
|
|
6665
|
+
} else if ("default" in schema) {
|
|
6666
|
+
return FromDefault(schema.default);
|
|
6667
|
+
} else if (schema.minItems !== void 0) {
|
|
6668
|
+
return Array.from({ length: schema.minItems }).map((item) => {
|
|
6669
|
+
return Visit7(schema.items, references);
|
|
6670
|
+
});
|
|
6671
|
+
} else {
|
|
6672
|
+
return [];
|
|
6673
|
+
}
|
|
6674
|
+
}
|
|
6675
|
+
function FromAsyncIterator6(schema, references) {
|
|
6676
|
+
if (HasPropertyKey2(schema, "default")) {
|
|
6677
|
+
return FromDefault(schema.default);
|
|
6678
|
+
} else {
|
|
6679
|
+
return (async function* () {
|
|
6680
|
+
})();
|
|
6681
|
+
}
|
|
6682
|
+
}
|
|
6683
|
+
function FromBigInt4(schema, references) {
|
|
6684
|
+
if (HasPropertyKey2(schema, "default")) {
|
|
6685
|
+
return FromDefault(schema.default);
|
|
6686
|
+
} else {
|
|
6687
|
+
return BigInt(0);
|
|
6688
|
+
}
|
|
6689
|
+
}
|
|
6690
|
+
function FromBoolean4(schema, references) {
|
|
6691
|
+
if (HasPropertyKey2(schema, "default")) {
|
|
6692
|
+
return FromDefault(schema.default);
|
|
6693
|
+
} else {
|
|
6694
|
+
return false;
|
|
6695
|
+
}
|
|
6696
|
+
}
|
|
6697
|
+
function FromConstructor6(schema, references) {
|
|
6698
|
+
if (HasPropertyKey2(schema, "default")) {
|
|
6699
|
+
return FromDefault(schema.default);
|
|
6700
|
+
} else {
|
|
6701
|
+
const value = Visit7(schema.returns, references);
|
|
6702
|
+
if (typeof value === "object" && !Array.isArray(value)) {
|
|
6703
|
+
return class {
|
|
6704
|
+
constructor() {
|
|
6705
|
+
for (const [key, val] of Object.entries(value)) {
|
|
6706
|
+
const self = this;
|
|
6707
|
+
self[key] = val;
|
|
6708
|
+
}
|
|
6709
|
+
}
|
|
6710
|
+
};
|
|
6711
|
+
} else {
|
|
6712
|
+
return class {
|
|
6713
|
+
};
|
|
6714
|
+
}
|
|
6715
|
+
}
|
|
6716
|
+
}
|
|
6717
|
+
function FromDate5(schema, references) {
|
|
6718
|
+
if (HasPropertyKey2(schema, "default")) {
|
|
6719
|
+
return FromDefault(schema.default);
|
|
6720
|
+
} else if (schema.minimumTimestamp !== void 0) {
|
|
6721
|
+
return new Date(schema.minimumTimestamp);
|
|
6722
|
+
} else {
|
|
6723
|
+
return /* @__PURE__ */ new Date();
|
|
6724
|
+
}
|
|
6725
|
+
}
|
|
6726
|
+
function FromFunction6(schema, references) {
|
|
6727
|
+
if (HasPropertyKey2(schema, "default")) {
|
|
6728
|
+
return FromDefault(schema.default);
|
|
6729
|
+
} else {
|
|
6730
|
+
return () => Visit7(schema.returns, references);
|
|
6731
|
+
}
|
|
6732
|
+
}
|
|
6733
|
+
function FromImport3(schema, references) {
|
|
6734
|
+
const definitions = globalThis.Object.values(schema.$defs);
|
|
6735
|
+
const target = schema.$defs[schema.$ref];
|
|
6736
|
+
return Visit7(target, [...references, ...definitions]);
|
|
6737
|
+
}
|
|
6738
|
+
function FromInteger4(schema, references) {
|
|
6739
|
+
if (HasPropertyKey2(schema, "default")) {
|
|
6740
|
+
return FromDefault(schema.default);
|
|
6741
|
+
} else if (schema.minimum !== void 0) {
|
|
6742
|
+
return schema.minimum;
|
|
6743
|
+
} else {
|
|
6744
|
+
return 0;
|
|
6745
|
+
}
|
|
6746
|
+
}
|
|
6747
|
+
function FromIntersect11(schema, references) {
|
|
6748
|
+
if (HasPropertyKey2(schema, "default")) {
|
|
6749
|
+
return FromDefault(schema.default);
|
|
6750
|
+
} else {
|
|
6751
|
+
const value = schema.allOf.reduce((acc, schema2) => {
|
|
6752
|
+
const next = Visit7(schema2, references);
|
|
6753
|
+
return typeof next === "object" ? { ...acc, ...next } : next;
|
|
6754
|
+
}, {});
|
|
6755
|
+
if (!Check(schema, references, value))
|
|
6756
|
+
throw new ValueCreateError(schema, "Intersect produced invalid value. Consider using a default value.");
|
|
6757
|
+
return value;
|
|
6758
|
+
}
|
|
6759
|
+
}
|
|
6760
|
+
function FromIterator6(schema, references) {
|
|
6761
|
+
if (HasPropertyKey2(schema, "default")) {
|
|
6762
|
+
return FromDefault(schema.default);
|
|
6763
|
+
} else {
|
|
6764
|
+
return (function* () {
|
|
6765
|
+
})();
|
|
6766
|
+
}
|
|
6767
|
+
}
|
|
6768
|
+
function FromLiteral5(schema, references) {
|
|
6769
|
+
if (HasPropertyKey2(schema, "default")) {
|
|
6770
|
+
return FromDefault(schema.default);
|
|
6771
|
+
} else {
|
|
6772
|
+
return schema.const;
|
|
6773
|
+
}
|
|
6774
|
+
}
|
|
6775
|
+
function FromNever4(schema, references) {
|
|
6776
|
+
if (HasPropertyKey2(schema, "default")) {
|
|
6777
|
+
return FromDefault(schema.default);
|
|
6778
|
+
} else {
|
|
6779
|
+
throw new ValueCreateError(schema, "Never types cannot be created. Consider using a default value.");
|
|
6780
|
+
}
|
|
6781
|
+
}
|
|
6782
|
+
function FromNot4(schema, references) {
|
|
6783
|
+
if (HasPropertyKey2(schema, "default")) {
|
|
6784
|
+
return FromDefault(schema.default);
|
|
6785
|
+
} else {
|
|
6786
|
+
throw new ValueCreateError(schema, "Not types must have a default value");
|
|
6787
|
+
}
|
|
6788
|
+
}
|
|
6789
|
+
function FromNull4(schema, references) {
|
|
6790
|
+
if (HasPropertyKey2(schema, "default")) {
|
|
6791
|
+
return FromDefault(schema.default);
|
|
6792
|
+
} else {
|
|
6793
|
+
return null;
|
|
6794
|
+
}
|
|
6795
|
+
}
|
|
6796
|
+
function FromNumber4(schema, references) {
|
|
6797
|
+
if (HasPropertyKey2(schema, "default")) {
|
|
6798
|
+
return FromDefault(schema.default);
|
|
6799
|
+
} else if (schema.minimum !== void 0) {
|
|
6800
|
+
return schema.minimum;
|
|
6801
|
+
} else {
|
|
6802
|
+
return 0;
|
|
6803
|
+
}
|
|
6804
|
+
}
|
|
6805
|
+
function FromObject11(schema, references) {
|
|
6806
|
+
if (HasPropertyKey2(schema, "default")) {
|
|
6807
|
+
return FromDefault(schema.default);
|
|
6808
|
+
} else {
|
|
6809
|
+
const required = new Set(schema.required);
|
|
6810
|
+
const Acc = {};
|
|
6811
|
+
for (const [key, subschema] of Object.entries(schema.properties)) {
|
|
6812
|
+
if (!required.has(key))
|
|
6813
|
+
continue;
|
|
6814
|
+
Acc[key] = Visit7(subschema, references);
|
|
6815
|
+
}
|
|
6816
|
+
return Acc;
|
|
6817
|
+
}
|
|
6818
|
+
}
|
|
6819
|
+
function FromPromise6(schema, references) {
|
|
6820
|
+
if (HasPropertyKey2(schema, "default")) {
|
|
6821
|
+
return FromDefault(schema.default);
|
|
6822
|
+
} else {
|
|
6823
|
+
return Promise.resolve(Visit7(schema.item, references));
|
|
6824
|
+
}
|
|
6825
|
+
}
|
|
6826
|
+
function FromRecord6(schema, references) {
|
|
6827
|
+
if (HasPropertyKey2(schema, "default")) {
|
|
6828
|
+
return FromDefault(schema.default);
|
|
6829
|
+
} else {
|
|
6830
|
+
return {};
|
|
6831
|
+
}
|
|
6832
|
+
}
|
|
6833
|
+
function FromRef7(schema, references) {
|
|
6834
|
+
if (HasPropertyKey2(schema, "default")) {
|
|
6835
|
+
return FromDefault(schema.default);
|
|
6836
|
+
} else {
|
|
6837
|
+
return Visit7(Deref(schema, references), references);
|
|
6838
|
+
}
|
|
6839
|
+
}
|
|
6840
|
+
function FromRegExp4(schema, references) {
|
|
6841
|
+
if (HasPropertyKey2(schema, "default")) {
|
|
6842
|
+
return FromDefault(schema.default);
|
|
6843
|
+
} else {
|
|
6844
|
+
throw new ValueCreateError(schema, "RegExp types cannot be created. Consider using a default value.");
|
|
6845
|
+
}
|
|
6846
|
+
}
|
|
6847
|
+
function FromString4(schema, references) {
|
|
6848
|
+
if (schema.pattern !== void 0) {
|
|
6849
|
+
if (!HasPropertyKey2(schema, "default")) {
|
|
6850
|
+
throw new ValueCreateError(schema, "String types with patterns must specify a default value");
|
|
6851
|
+
} else {
|
|
6852
|
+
return FromDefault(schema.default);
|
|
6853
|
+
}
|
|
6854
|
+
} else if (schema.format !== void 0) {
|
|
6855
|
+
if (!HasPropertyKey2(schema, "default")) {
|
|
6856
|
+
throw new ValueCreateError(schema, "String types with formats must specify a default value");
|
|
6857
|
+
} else {
|
|
6858
|
+
return FromDefault(schema.default);
|
|
6859
|
+
}
|
|
6860
|
+
} else {
|
|
6861
|
+
if (HasPropertyKey2(schema, "default")) {
|
|
6862
|
+
return FromDefault(schema.default);
|
|
6863
|
+
} else if (schema.minLength !== void 0) {
|
|
6864
|
+
return Array.from({ length: schema.minLength }).map(() => " ").join("");
|
|
6865
|
+
} else {
|
|
6866
|
+
return "";
|
|
6867
|
+
}
|
|
6868
|
+
}
|
|
6869
|
+
}
|
|
6870
|
+
function FromSymbol4(schema, references) {
|
|
6871
|
+
if (HasPropertyKey2(schema, "default")) {
|
|
6872
|
+
return FromDefault(schema.default);
|
|
6873
|
+
} else if ("value" in schema) {
|
|
6874
|
+
return Symbol.for(schema.value);
|
|
6875
|
+
} else {
|
|
6876
|
+
return Symbol();
|
|
6877
|
+
}
|
|
6878
|
+
}
|
|
6879
|
+
function FromTemplateLiteral6(schema, references) {
|
|
6880
|
+
if (HasPropertyKey2(schema, "default")) {
|
|
6881
|
+
return FromDefault(schema.default);
|
|
6882
|
+
}
|
|
6883
|
+
if (!IsTemplateLiteralFinite(schema))
|
|
6884
|
+
throw new ValueCreateError(schema, "Can only create template literals that produce a finite variants. Consider using a default value.");
|
|
6885
|
+
const generated = TemplateLiteralGenerate(schema);
|
|
6886
|
+
return generated[0];
|
|
6887
|
+
}
|
|
6888
|
+
function FromThis3(schema, references) {
|
|
6889
|
+
if (recursiveDepth++ > recursiveMaxDepth)
|
|
6890
|
+
throw new ValueCreateError(schema, "Cannot create recursive type as it appears possibly infinite. Consider using a default.");
|
|
6891
|
+
if (HasPropertyKey2(schema, "default")) {
|
|
6892
|
+
return FromDefault(schema.default);
|
|
6893
|
+
} else {
|
|
6894
|
+
return Visit7(Deref(schema, references), references);
|
|
6895
|
+
}
|
|
6896
|
+
}
|
|
6897
|
+
function FromTuple8(schema, references) {
|
|
6898
|
+
if (HasPropertyKey2(schema, "default")) {
|
|
6899
|
+
return FromDefault(schema.default);
|
|
6900
|
+
}
|
|
6901
|
+
if (schema.items === void 0) {
|
|
6902
|
+
return [];
|
|
6903
|
+
} else {
|
|
6904
|
+
return Array.from({ length: schema.minItems }).map((_, index) => Visit7(schema.items[index], references));
|
|
6905
|
+
}
|
|
6906
|
+
}
|
|
6907
|
+
function FromUndefined4(schema, references) {
|
|
6908
|
+
if (HasPropertyKey2(schema, "default")) {
|
|
6909
|
+
return FromDefault(schema.default);
|
|
6910
|
+
} else {
|
|
6911
|
+
return void 0;
|
|
6912
|
+
}
|
|
6913
|
+
}
|
|
6914
|
+
function FromUnion13(schema, references) {
|
|
6915
|
+
if (HasPropertyKey2(schema, "default")) {
|
|
6916
|
+
return FromDefault(schema.default);
|
|
6917
|
+
} else if (schema.anyOf.length === 0) {
|
|
6918
|
+
throw new Error("ValueCreate.Union: Cannot create Union with zero variants");
|
|
6919
|
+
} else {
|
|
6920
|
+
return Visit7(schema.anyOf[0], references);
|
|
6921
|
+
}
|
|
6922
|
+
}
|
|
6923
|
+
function FromUint8Array4(schema, references) {
|
|
6924
|
+
if (HasPropertyKey2(schema, "default")) {
|
|
6925
|
+
return FromDefault(schema.default);
|
|
6926
|
+
} else if (schema.minByteLength !== void 0) {
|
|
6927
|
+
return new Uint8Array(schema.minByteLength);
|
|
6928
|
+
} else {
|
|
6929
|
+
return new Uint8Array(0);
|
|
6930
|
+
}
|
|
6931
|
+
}
|
|
6932
|
+
function FromUnknown4(schema, references) {
|
|
6933
|
+
if (HasPropertyKey2(schema, "default")) {
|
|
6934
|
+
return FromDefault(schema.default);
|
|
6935
|
+
} else {
|
|
6936
|
+
return {};
|
|
6937
|
+
}
|
|
6938
|
+
}
|
|
6939
|
+
function FromVoid4(schema, references) {
|
|
6940
|
+
if (HasPropertyKey2(schema, "default")) {
|
|
6941
|
+
return FromDefault(schema.default);
|
|
6942
|
+
} else {
|
|
6943
|
+
return void 0;
|
|
6944
|
+
}
|
|
6945
|
+
}
|
|
6946
|
+
function FromKind3(schema, references) {
|
|
6947
|
+
if (HasPropertyKey2(schema, "default")) {
|
|
6948
|
+
return FromDefault(schema.default);
|
|
6949
|
+
} else {
|
|
6950
|
+
throw new Error("User defined types must specify a default value");
|
|
6951
|
+
}
|
|
6952
|
+
}
|
|
6953
|
+
function Visit7(schema, references) {
|
|
6954
|
+
const references_ = Pushref(schema, references);
|
|
6955
|
+
const schema_ = schema;
|
|
6956
|
+
switch (schema_[Kind]) {
|
|
6957
|
+
case "Any":
|
|
6958
|
+
return FromAny4(schema_, references_);
|
|
6959
|
+
case "Argument":
|
|
6960
|
+
return FromArgument4(schema_, references_);
|
|
6961
|
+
case "Array":
|
|
6962
|
+
return FromArray10(schema_, references_);
|
|
6963
|
+
case "AsyncIterator":
|
|
6964
|
+
return FromAsyncIterator6(schema_, references_);
|
|
6965
|
+
case "BigInt":
|
|
6966
|
+
return FromBigInt4(schema_, references_);
|
|
6967
|
+
case "Boolean":
|
|
6968
|
+
return FromBoolean4(schema_, references_);
|
|
6969
|
+
case "Constructor":
|
|
6970
|
+
return FromConstructor6(schema_, references_);
|
|
6971
|
+
case "Date":
|
|
6972
|
+
return FromDate5(schema_, references_);
|
|
6973
|
+
case "Function":
|
|
6974
|
+
return FromFunction6(schema_, references_);
|
|
6975
|
+
case "Import":
|
|
6976
|
+
return FromImport3(schema_, references_);
|
|
6977
|
+
case "Integer":
|
|
6978
|
+
return FromInteger4(schema_, references_);
|
|
6979
|
+
case "Intersect":
|
|
6980
|
+
return FromIntersect11(schema_, references_);
|
|
6981
|
+
case "Iterator":
|
|
6982
|
+
return FromIterator6(schema_, references_);
|
|
6983
|
+
case "Literal":
|
|
6984
|
+
return FromLiteral5(schema_, references_);
|
|
6985
|
+
case "Never":
|
|
6986
|
+
return FromNever4(schema_, references_);
|
|
6987
|
+
case "Not":
|
|
6988
|
+
return FromNot4(schema_, references_);
|
|
6989
|
+
case "Null":
|
|
6990
|
+
return FromNull4(schema_, references_);
|
|
6991
|
+
case "Number":
|
|
6992
|
+
return FromNumber4(schema_, references_);
|
|
6993
|
+
case "Object":
|
|
6994
|
+
return FromObject11(schema_, references_);
|
|
6995
|
+
case "Promise":
|
|
6996
|
+
return FromPromise6(schema_, references_);
|
|
6997
|
+
case "Record":
|
|
6998
|
+
return FromRecord6(schema_, references_);
|
|
6999
|
+
case "Ref":
|
|
7000
|
+
return FromRef7(schema_, references_);
|
|
7001
|
+
case "RegExp":
|
|
7002
|
+
return FromRegExp4(schema_, references_);
|
|
7003
|
+
case "String":
|
|
7004
|
+
return FromString4(schema_, references_);
|
|
7005
|
+
case "Symbol":
|
|
7006
|
+
return FromSymbol4(schema_, references_);
|
|
7007
|
+
case "TemplateLiteral":
|
|
7008
|
+
return FromTemplateLiteral6(schema_, references_);
|
|
7009
|
+
case "This":
|
|
7010
|
+
return FromThis3(schema_, references_);
|
|
7011
|
+
case "Tuple":
|
|
7012
|
+
return FromTuple8(schema_, references_);
|
|
7013
|
+
case "Undefined":
|
|
7014
|
+
return FromUndefined4(schema_, references_);
|
|
7015
|
+
case "Union":
|
|
7016
|
+
return FromUnion13(schema_, references_);
|
|
7017
|
+
case "Uint8Array":
|
|
7018
|
+
return FromUint8Array4(schema_, references_);
|
|
7019
|
+
case "Unknown":
|
|
7020
|
+
return FromUnknown4(schema_, references_);
|
|
7021
|
+
case "Void":
|
|
7022
|
+
return FromVoid4(schema_, references_);
|
|
7023
|
+
default:
|
|
7024
|
+
if (!type_exports2.Has(schema_[Kind]))
|
|
7025
|
+
throw new ValueCreateError(schema_, "Unknown type");
|
|
7026
|
+
return FromKind3(schema_, references_);
|
|
7027
|
+
}
|
|
7028
|
+
}
|
|
7029
|
+
var recursiveMaxDepth = 512;
|
|
7030
|
+
var recursiveDepth = 0;
|
|
7031
|
+
function Create2(...args) {
|
|
7032
|
+
recursiveDepth = 0;
|
|
7033
|
+
return args.length === 2 ? Visit7(args[0], args[1]) : Visit7(args[0], []);
|
|
7034
|
+
}
|
|
7035
|
+
|
|
7036
|
+
// ../../node_modules/@sinclair/typebox/build/esm/value/cast/cast.mjs
|
|
7037
|
+
var ValueCastError = class extends TypeBoxError {
|
|
7038
|
+
constructor(schema, message) {
|
|
7039
|
+
super(message);
|
|
7040
|
+
this.schema = schema;
|
|
7041
|
+
}
|
|
7042
|
+
};
|
|
7043
|
+
function ScoreUnion(schema, references, value) {
|
|
7044
|
+
if (schema[Kind] === "Object" && typeof value === "object" && !IsNull2(value)) {
|
|
7045
|
+
const object = schema;
|
|
7046
|
+
const keys = Object.getOwnPropertyNames(value);
|
|
7047
|
+
const entries = Object.entries(object.properties);
|
|
7048
|
+
return entries.reduce((acc, [key, schema2]) => {
|
|
7049
|
+
const literal = schema2[Kind] === "Literal" && schema2.const === value[key] ? 100 : 0;
|
|
7050
|
+
const checks = Check(schema2, references, value[key]) ? 10 : 0;
|
|
7051
|
+
const exists = keys.includes(key) ? 1 : 0;
|
|
7052
|
+
return acc + (literal + checks + exists);
|
|
7053
|
+
}, 0);
|
|
7054
|
+
} else if (schema[Kind] === "Union") {
|
|
7055
|
+
const schemas = schema.anyOf.map((schema2) => Deref(schema2, references));
|
|
7056
|
+
const scores = schemas.map((schema2) => ScoreUnion(schema2, references, value));
|
|
7057
|
+
return Math.max(...scores);
|
|
7058
|
+
} else {
|
|
7059
|
+
return Check(schema, references, value) ? 1 : 0;
|
|
7060
|
+
}
|
|
7061
|
+
}
|
|
7062
|
+
function SelectUnion(union, references, value) {
|
|
7063
|
+
const schemas = union.anyOf.map((schema) => Deref(schema, references));
|
|
7064
|
+
let [select, best] = [schemas[0], 0];
|
|
7065
|
+
for (const schema of schemas) {
|
|
7066
|
+
const score = ScoreUnion(schema, references, value);
|
|
7067
|
+
if (score > best) {
|
|
7068
|
+
select = schema;
|
|
7069
|
+
best = score;
|
|
7070
|
+
}
|
|
7071
|
+
}
|
|
7072
|
+
return select;
|
|
7073
|
+
}
|
|
7074
|
+
function CastUnion(union, references, value) {
|
|
7075
|
+
if ("default" in union) {
|
|
7076
|
+
return typeof value === "function" ? union.default : Clone2(union.default);
|
|
7077
|
+
} else {
|
|
7078
|
+
const schema = SelectUnion(union, references, value);
|
|
7079
|
+
return Cast(schema, references, value);
|
|
7080
|
+
}
|
|
7081
|
+
}
|
|
7082
|
+
function DefaultClone(schema, references, value) {
|
|
7083
|
+
return Check(schema, references, value) ? Clone2(value) : Create2(schema, references);
|
|
7084
|
+
}
|
|
7085
|
+
function Default(schema, references, value) {
|
|
7086
|
+
return Check(schema, references, value) ? value : Create2(schema, references);
|
|
7087
|
+
}
|
|
7088
|
+
function FromArray11(schema, references, value) {
|
|
7089
|
+
if (Check(schema, references, value))
|
|
7090
|
+
return Clone2(value);
|
|
7091
|
+
const created = IsArray2(value) ? Clone2(value) : Create2(schema, references);
|
|
7092
|
+
const minimum = IsNumber2(schema.minItems) && created.length < schema.minItems ? [...created, ...Array.from({ length: schema.minItems - created.length }, () => null)] : created;
|
|
7093
|
+
const maximum = IsNumber2(schema.maxItems) && minimum.length > schema.maxItems ? minimum.slice(0, schema.maxItems) : minimum;
|
|
7094
|
+
const casted = maximum.map((value2) => Visit8(schema.items, references, value2));
|
|
7095
|
+
if (schema.uniqueItems !== true)
|
|
7096
|
+
return casted;
|
|
7097
|
+
const unique = [...new Set(casted)];
|
|
7098
|
+
if (!Check(schema, references, unique))
|
|
7099
|
+
throw new ValueCastError(schema, "Array cast produced invalid data due to uniqueItems constraint");
|
|
7100
|
+
return unique;
|
|
7101
|
+
}
|
|
7102
|
+
function FromConstructor7(schema, references, value) {
|
|
7103
|
+
if (Check(schema, references, value))
|
|
7104
|
+
return Create2(schema, references);
|
|
7105
|
+
const required = new Set(schema.returns.required || []);
|
|
7106
|
+
const result = function() {
|
|
7107
|
+
};
|
|
7108
|
+
for (const [key, property] of Object.entries(schema.returns.properties)) {
|
|
7109
|
+
if (!required.has(key) && value.prototype[key] === void 0)
|
|
7110
|
+
continue;
|
|
7111
|
+
result.prototype[key] = Visit8(property, references, value.prototype[key]);
|
|
7112
|
+
}
|
|
7113
|
+
return result;
|
|
7114
|
+
}
|
|
7115
|
+
function FromImport4(schema, references, value) {
|
|
7116
|
+
const definitions = globalThis.Object.values(schema.$defs);
|
|
7117
|
+
const target = schema.$defs[schema.$ref];
|
|
7118
|
+
return Visit8(target, [...references, ...definitions], value);
|
|
7119
|
+
}
|
|
7120
|
+
function IntersectAssign(correct, value) {
|
|
7121
|
+
if (IsObject2(correct) && !IsObject2(value) || !IsObject2(correct) && IsObject2(value))
|
|
7122
|
+
return correct;
|
|
7123
|
+
if (!IsObject2(correct) || !IsObject2(value))
|
|
7124
|
+
return value;
|
|
7125
|
+
return globalThis.Object.getOwnPropertyNames(correct).reduce((result, key) => {
|
|
7126
|
+
const property = key in value ? IntersectAssign(correct[key], value[key]) : correct[key];
|
|
7127
|
+
return { ...result, [key]: property };
|
|
7128
|
+
}, {});
|
|
7129
|
+
}
|
|
7130
|
+
function FromIntersect12(schema, references, value) {
|
|
7131
|
+
if (Check(schema, references, value))
|
|
7132
|
+
return value;
|
|
7133
|
+
const correct = Create2(schema, references);
|
|
7134
|
+
const assigned = IntersectAssign(correct, value);
|
|
7135
|
+
return Check(schema, references, assigned) ? assigned : correct;
|
|
7136
|
+
}
|
|
7137
|
+
function FromNever5(schema, references, value) {
|
|
7138
|
+
throw new ValueCastError(schema, "Never types cannot be cast");
|
|
7139
|
+
}
|
|
7140
|
+
function FromObject12(schema, references, value) {
|
|
7141
|
+
if (Check(schema, references, value))
|
|
7142
|
+
return value;
|
|
7143
|
+
if (value === null || typeof value !== "object")
|
|
7144
|
+
return Create2(schema, references);
|
|
7145
|
+
const required = new Set(schema.required || []);
|
|
7146
|
+
const result = {};
|
|
7147
|
+
for (const [key, property] of Object.entries(schema.properties)) {
|
|
7148
|
+
if (!required.has(key) && value[key] === void 0)
|
|
7149
|
+
continue;
|
|
7150
|
+
result[key] = Visit8(property, references, value[key]);
|
|
7151
|
+
}
|
|
7152
|
+
if (typeof schema.additionalProperties === "object") {
|
|
7153
|
+
const propertyNames = Object.getOwnPropertyNames(schema.properties);
|
|
7154
|
+
for (const propertyName of Object.getOwnPropertyNames(value)) {
|
|
7155
|
+
if (propertyNames.includes(propertyName))
|
|
7156
|
+
continue;
|
|
7157
|
+
result[propertyName] = Visit8(schema.additionalProperties, references, value[propertyName]);
|
|
7158
|
+
}
|
|
7159
|
+
}
|
|
7160
|
+
return result;
|
|
7161
|
+
}
|
|
7162
|
+
function FromRecord7(schema, references, value) {
|
|
7163
|
+
if (Check(schema, references, value))
|
|
7164
|
+
return Clone2(value);
|
|
7165
|
+
if (value === null || typeof value !== "object" || Array.isArray(value) || value instanceof Date)
|
|
7166
|
+
return Create2(schema, references);
|
|
7167
|
+
const subschemaPropertyName = Object.getOwnPropertyNames(schema.patternProperties)[0];
|
|
7168
|
+
const subschema = schema.patternProperties[subschemaPropertyName];
|
|
7169
|
+
const result = {};
|
|
7170
|
+
for (const [propKey, propValue] of Object.entries(value)) {
|
|
7171
|
+
result[propKey] = Visit8(subschema, references, propValue);
|
|
7172
|
+
}
|
|
7173
|
+
return result;
|
|
7174
|
+
}
|
|
7175
|
+
function FromRef8(schema, references, value) {
|
|
7176
|
+
return Visit8(Deref(schema, references), references, value);
|
|
7177
|
+
}
|
|
7178
|
+
function FromThis4(schema, references, value) {
|
|
7179
|
+
return Visit8(Deref(schema, references), references, value);
|
|
7180
|
+
}
|
|
7181
|
+
function FromTuple9(schema, references, value) {
|
|
7182
|
+
if (Check(schema, references, value))
|
|
7183
|
+
return Clone2(value);
|
|
7184
|
+
if (!IsArray2(value))
|
|
7185
|
+
return Create2(schema, references);
|
|
7186
|
+
if (schema.items === void 0)
|
|
7187
|
+
return [];
|
|
7188
|
+
return schema.items.map((schema2, index) => Visit8(schema2, references, value[index]));
|
|
7189
|
+
}
|
|
7190
|
+
function FromUnion14(schema, references, value) {
|
|
7191
|
+
return Check(schema, references, value) ? Clone2(value) : CastUnion(schema, references, value);
|
|
7192
|
+
}
|
|
7193
|
+
function Visit8(schema, references, value) {
|
|
7194
|
+
const references_ = IsString2(schema.$id) ? Pushref(schema, references) : references;
|
|
7195
|
+
const schema_ = schema;
|
|
7196
|
+
switch (schema[Kind]) {
|
|
7197
|
+
// --------------------------------------------------------------
|
|
7198
|
+
// Structural
|
|
7199
|
+
// --------------------------------------------------------------
|
|
7200
|
+
case "Array":
|
|
7201
|
+
return FromArray11(schema_, references_, value);
|
|
7202
|
+
case "Constructor":
|
|
7203
|
+
return FromConstructor7(schema_, references_, value);
|
|
7204
|
+
case "Import":
|
|
7205
|
+
return FromImport4(schema_, references_, value);
|
|
7206
|
+
case "Intersect":
|
|
7207
|
+
return FromIntersect12(schema_, references_, value);
|
|
7208
|
+
case "Never":
|
|
7209
|
+
return FromNever5(schema_, references_, value);
|
|
7210
|
+
case "Object":
|
|
7211
|
+
return FromObject12(schema_, references_, value);
|
|
7212
|
+
case "Record":
|
|
7213
|
+
return FromRecord7(schema_, references_, value);
|
|
7214
|
+
case "Ref":
|
|
7215
|
+
return FromRef8(schema_, references_, value);
|
|
7216
|
+
case "This":
|
|
7217
|
+
return FromThis4(schema_, references_, value);
|
|
7218
|
+
case "Tuple":
|
|
7219
|
+
return FromTuple9(schema_, references_, value);
|
|
7220
|
+
case "Union":
|
|
7221
|
+
return FromUnion14(schema_, references_, value);
|
|
7222
|
+
// --------------------------------------------------------------
|
|
7223
|
+
// DefaultClone
|
|
7224
|
+
// --------------------------------------------------------------
|
|
7225
|
+
case "Date":
|
|
7226
|
+
case "Symbol":
|
|
7227
|
+
case "Uint8Array":
|
|
7228
|
+
return DefaultClone(schema, references, value);
|
|
7229
|
+
// --------------------------------------------------------------
|
|
7230
|
+
// Default
|
|
7231
|
+
// --------------------------------------------------------------
|
|
7232
|
+
default:
|
|
7233
|
+
return Default(schema_, references_, value);
|
|
7234
|
+
}
|
|
7235
|
+
}
|
|
7236
|
+
function Cast(...args) {
|
|
7237
|
+
return args.length === 3 ? Visit8(args[0], args[1], args[2]) : Visit8(args[0], [], args[1]);
|
|
7238
|
+
}
|
|
7239
|
+
|
|
7240
|
+
// ../../node_modules/@sinclair/typebox/build/esm/value/clean/clean.mjs
|
|
7241
|
+
function IsCheckable(schema) {
|
|
7242
|
+
return IsKind(schema) && schema[Kind] !== "Unsafe";
|
|
7243
|
+
}
|
|
7244
|
+
function FromArray12(schema, references, value) {
|
|
7245
|
+
if (!IsArray2(value))
|
|
7246
|
+
return value;
|
|
7247
|
+
return value.map((value2) => Visit9(schema.items, references, value2));
|
|
7248
|
+
}
|
|
7249
|
+
function FromImport5(schema, references, value) {
|
|
7250
|
+
const definitions = globalThis.Object.values(schema.$defs);
|
|
7251
|
+
const target = schema.$defs[schema.$ref];
|
|
7252
|
+
return Visit9(target, [...references, ...definitions], value);
|
|
7253
|
+
}
|
|
7254
|
+
function FromIntersect13(schema, references, value) {
|
|
7255
|
+
const unevaluatedProperties = schema.unevaluatedProperties;
|
|
7256
|
+
const intersections = schema.allOf.map((schema2) => Visit9(schema2, references, Clone2(value)));
|
|
7257
|
+
const composite = intersections.reduce((acc, value2) => IsObject2(value2) ? { ...acc, ...value2 } : value2, {});
|
|
7258
|
+
if (!IsObject2(value) || !IsObject2(composite) || !IsKind(unevaluatedProperties))
|
|
7259
|
+
return composite;
|
|
7260
|
+
const knownkeys = KeyOfPropertyKeys(schema);
|
|
7261
|
+
for (const key of Object.getOwnPropertyNames(value)) {
|
|
7262
|
+
if (knownkeys.includes(key))
|
|
7263
|
+
continue;
|
|
7264
|
+
if (Check(unevaluatedProperties, references, value[key])) {
|
|
7265
|
+
composite[key] = Visit9(unevaluatedProperties, references, value[key]);
|
|
7266
|
+
}
|
|
7267
|
+
}
|
|
7268
|
+
return composite;
|
|
7269
|
+
}
|
|
7270
|
+
function FromObject13(schema, references, value) {
|
|
7271
|
+
if (!IsObject2(value) || IsArray2(value))
|
|
7272
|
+
return value;
|
|
7273
|
+
const additionalProperties = schema.additionalProperties;
|
|
7274
|
+
for (const key of Object.getOwnPropertyNames(value)) {
|
|
7275
|
+
if (HasPropertyKey2(schema.properties, key)) {
|
|
7276
|
+
value[key] = Visit9(schema.properties[key], references, value[key]);
|
|
7277
|
+
continue;
|
|
7278
|
+
}
|
|
7279
|
+
if (IsKind(additionalProperties) && Check(additionalProperties, references, value[key])) {
|
|
7280
|
+
value[key] = Visit9(additionalProperties, references, value[key]);
|
|
7281
|
+
continue;
|
|
7282
|
+
}
|
|
7283
|
+
delete value[key];
|
|
7284
|
+
}
|
|
7285
|
+
return value;
|
|
7286
|
+
}
|
|
7287
|
+
function FromRecord8(schema, references, value) {
|
|
7288
|
+
if (!IsObject2(value))
|
|
7289
|
+
return value;
|
|
7290
|
+
const additionalProperties = schema.additionalProperties;
|
|
7291
|
+
const propertyKeys = Object.getOwnPropertyNames(value);
|
|
7292
|
+
const [propertyKey, propertySchema] = Object.entries(schema.patternProperties)[0];
|
|
7293
|
+
const propertyKeyTest = new RegExp(propertyKey);
|
|
7294
|
+
for (const key of propertyKeys) {
|
|
7295
|
+
if (propertyKeyTest.test(key)) {
|
|
7296
|
+
value[key] = Visit9(propertySchema, references, value[key]);
|
|
7297
|
+
continue;
|
|
7298
|
+
}
|
|
7299
|
+
if (IsKind(additionalProperties) && Check(additionalProperties, references, value[key])) {
|
|
7300
|
+
value[key] = Visit9(additionalProperties, references, value[key]);
|
|
7301
|
+
continue;
|
|
7302
|
+
}
|
|
7303
|
+
delete value[key];
|
|
7304
|
+
}
|
|
7305
|
+
return value;
|
|
7306
|
+
}
|
|
7307
|
+
function FromRef9(schema, references, value) {
|
|
7308
|
+
return Visit9(Deref(schema, references), references, value);
|
|
7309
|
+
}
|
|
7310
|
+
function FromThis5(schema, references, value) {
|
|
7311
|
+
return Visit9(Deref(schema, references), references, value);
|
|
7312
|
+
}
|
|
7313
|
+
function FromTuple10(schema, references, value) {
|
|
7314
|
+
if (!IsArray2(value))
|
|
7315
|
+
return value;
|
|
7316
|
+
if (IsUndefined2(schema.items))
|
|
7317
|
+
return [];
|
|
7318
|
+
const length = Math.min(value.length, schema.items.length);
|
|
7319
|
+
for (let i = 0; i < length; i++) {
|
|
7320
|
+
value[i] = Visit9(schema.items[i], references, value[i]);
|
|
7321
|
+
}
|
|
7322
|
+
return value.length > length ? value.slice(0, length) : value;
|
|
7323
|
+
}
|
|
7324
|
+
function FromUnion15(schema, references, value) {
|
|
7325
|
+
for (const inner of schema.anyOf) {
|
|
7326
|
+
if (IsCheckable(inner) && Check(inner, references, value)) {
|
|
7327
|
+
return Visit9(inner, references, value);
|
|
7328
|
+
}
|
|
7329
|
+
}
|
|
7330
|
+
return value;
|
|
7331
|
+
}
|
|
7332
|
+
function Visit9(schema, references, value) {
|
|
7333
|
+
const references_ = IsString2(schema.$id) ? Pushref(schema, references) : references;
|
|
7334
|
+
const schema_ = schema;
|
|
7335
|
+
switch (schema_[Kind]) {
|
|
7336
|
+
case "Array":
|
|
7337
|
+
return FromArray12(schema_, references_, value);
|
|
7338
|
+
case "Import":
|
|
7339
|
+
return FromImport5(schema_, references_, value);
|
|
7340
|
+
case "Intersect":
|
|
7341
|
+
return FromIntersect13(schema_, references_, value);
|
|
7342
|
+
case "Object":
|
|
7343
|
+
return FromObject13(schema_, references_, value);
|
|
7344
|
+
case "Record":
|
|
7345
|
+
return FromRecord8(schema_, references_, value);
|
|
7346
|
+
case "Ref":
|
|
7347
|
+
return FromRef9(schema_, references_, value);
|
|
7348
|
+
case "This":
|
|
7349
|
+
return FromThis5(schema_, references_, value);
|
|
7350
|
+
case "Tuple":
|
|
7351
|
+
return FromTuple10(schema_, references_, value);
|
|
7352
|
+
case "Union":
|
|
7353
|
+
return FromUnion15(schema_, references_, value);
|
|
7354
|
+
default:
|
|
7355
|
+
return value;
|
|
7356
|
+
}
|
|
7357
|
+
}
|
|
7358
|
+
function Clean(...args) {
|
|
7359
|
+
return args.length === 3 ? Visit9(args[0], args[1], args[2]) : Visit9(args[0], [], args[1]);
|
|
7360
|
+
}
|
|
7361
|
+
|
|
7362
|
+
// ../../node_modules/@sinclair/typebox/build/esm/value/convert/convert.mjs
|
|
7363
|
+
function IsStringNumeric(value) {
|
|
7364
|
+
return IsString2(value) && !isNaN(value) && !isNaN(parseFloat(value));
|
|
7365
|
+
}
|
|
7366
|
+
function IsValueToString(value) {
|
|
7367
|
+
return IsBigInt2(value) || IsBoolean2(value) || IsNumber2(value);
|
|
7368
|
+
}
|
|
7369
|
+
function IsValueTrue(value) {
|
|
7370
|
+
return value === true || IsNumber2(value) && value === 1 || IsBigInt2(value) && value === BigInt("1") || IsString2(value) && (value.toLowerCase() === "true" || value === "1");
|
|
7371
|
+
}
|
|
7372
|
+
function IsValueFalse(value) {
|
|
7373
|
+
return value === false || IsNumber2(value) && (value === 0 || Object.is(value, -0)) || IsBigInt2(value) && value === BigInt("0") || IsString2(value) && (value.toLowerCase() === "false" || value === "0" || value === "-0");
|
|
7374
|
+
}
|
|
7375
|
+
function IsTimeStringWithTimeZone(value) {
|
|
7376
|
+
return IsString2(value) && /^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i.test(value);
|
|
7377
|
+
}
|
|
7378
|
+
function IsTimeStringWithoutTimeZone(value) {
|
|
7379
|
+
return IsString2(value) && /^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)?$/i.test(value);
|
|
7380
|
+
}
|
|
7381
|
+
function IsDateTimeStringWithTimeZone(value) {
|
|
7382
|
+
return IsString2(value) && /^\d\d\d\d-[0-1]\d-[0-3]\dt(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i.test(value);
|
|
7383
|
+
}
|
|
7384
|
+
function IsDateTimeStringWithoutTimeZone(value) {
|
|
7385
|
+
return IsString2(value) && /^\d\d\d\d-[0-1]\d-[0-3]\dt(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)?$/i.test(value);
|
|
7386
|
+
}
|
|
7387
|
+
function IsDateString(value) {
|
|
7388
|
+
return IsString2(value) && /^\d\d\d\d-[0-1]\d-[0-3]\d$/i.test(value);
|
|
7389
|
+
}
|
|
7390
|
+
function TryConvertLiteralString(value, target) {
|
|
7391
|
+
const conversion = TryConvertString(value);
|
|
7392
|
+
return conversion === target ? conversion : value;
|
|
7393
|
+
}
|
|
7394
|
+
function TryConvertLiteralNumber(value, target) {
|
|
7395
|
+
const conversion = TryConvertNumber(value);
|
|
7396
|
+
return conversion === target ? conversion : value;
|
|
7397
|
+
}
|
|
7398
|
+
function TryConvertLiteralBoolean(value, target) {
|
|
7399
|
+
const conversion = TryConvertBoolean(value);
|
|
7400
|
+
return conversion === target ? conversion : value;
|
|
7401
|
+
}
|
|
7402
|
+
function TryConvertLiteral(schema, value) {
|
|
7403
|
+
return IsString2(schema.const) ? TryConvertLiteralString(value, schema.const) : IsNumber2(schema.const) ? TryConvertLiteralNumber(value, schema.const) : IsBoolean2(schema.const) ? TryConvertLiteralBoolean(value, schema.const) : value;
|
|
7404
|
+
}
|
|
7405
|
+
function TryConvertBoolean(value) {
|
|
7406
|
+
return IsValueTrue(value) ? true : IsValueFalse(value) ? false : value;
|
|
7407
|
+
}
|
|
7408
|
+
function TryConvertBigInt(value) {
|
|
7409
|
+
const truncateInteger = (value2) => value2.split(".")[0];
|
|
7410
|
+
return IsStringNumeric(value) ? BigInt(truncateInteger(value)) : IsNumber2(value) ? BigInt(Math.trunc(value)) : IsValueFalse(value) ? BigInt(0) : IsValueTrue(value) ? BigInt(1) : value;
|
|
7411
|
+
}
|
|
7412
|
+
function TryConvertString(value) {
|
|
7413
|
+
return IsSymbol2(value) && value.description !== void 0 ? value.description.toString() : IsValueToString(value) ? value.toString() : value;
|
|
7414
|
+
}
|
|
7415
|
+
function TryConvertNumber(value) {
|
|
7416
|
+
return IsStringNumeric(value) ? parseFloat(value) : IsValueTrue(value) ? 1 : IsValueFalse(value) ? 0 : value;
|
|
7417
|
+
}
|
|
7418
|
+
function TryConvertInteger(value) {
|
|
7419
|
+
return IsStringNumeric(value) ? parseInt(value) : IsNumber2(value) ? Math.trunc(value) : IsValueTrue(value) ? 1 : IsValueFalse(value) ? 0 : value;
|
|
7420
|
+
}
|
|
7421
|
+
function TryConvertNull(value) {
|
|
7422
|
+
return IsString2(value) && value.toLowerCase() === "null" ? null : value;
|
|
7423
|
+
}
|
|
7424
|
+
function TryConvertUndefined(value) {
|
|
7425
|
+
return IsString2(value) && value === "undefined" ? void 0 : value;
|
|
7426
|
+
}
|
|
7427
|
+
function TryConvertDate(value) {
|
|
7428
|
+
return IsDate2(value) ? value : IsNumber2(value) ? new Date(value) : IsValueTrue(value) ? /* @__PURE__ */ new Date(1) : IsValueFalse(value) ? /* @__PURE__ */ new Date(0) : IsStringNumeric(value) ? new Date(parseInt(value)) : IsTimeStringWithoutTimeZone(value) ? /* @__PURE__ */ new Date(`1970-01-01T${value}.000Z`) : IsTimeStringWithTimeZone(value) ? /* @__PURE__ */ new Date(`1970-01-01T${value}`) : IsDateTimeStringWithoutTimeZone(value) ? /* @__PURE__ */ new Date(`${value}.000Z`) : IsDateTimeStringWithTimeZone(value) ? new Date(value) : IsDateString(value) ? /* @__PURE__ */ new Date(`${value}T00:00:00.000Z`) : value;
|
|
7429
|
+
}
|
|
7430
|
+
function Default2(value) {
|
|
7431
|
+
return value;
|
|
7432
|
+
}
|
|
7433
|
+
function FromArray13(schema, references, value) {
|
|
7434
|
+
const elements = IsArray2(value) ? value : [value];
|
|
7435
|
+
return elements.map((element) => Visit10(schema.items, references, element));
|
|
7436
|
+
}
|
|
7437
|
+
function FromBigInt5(schema, references, value) {
|
|
7438
|
+
return TryConvertBigInt(value);
|
|
7439
|
+
}
|
|
7440
|
+
function FromBoolean5(schema, references, value) {
|
|
7441
|
+
return TryConvertBoolean(value);
|
|
7442
|
+
}
|
|
7443
|
+
function FromDate6(schema, references, value) {
|
|
7444
|
+
return TryConvertDate(value);
|
|
7445
|
+
}
|
|
7446
|
+
function FromImport6(schema, references, value) {
|
|
7447
|
+
const definitions = globalThis.Object.values(schema.$defs);
|
|
7448
|
+
const target = schema.$defs[schema.$ref];
|
|
7449
|
+
return Visit10(target, [...references, ...definitions], value);
|
|
7450
|
+
}
|
|
7451
|
+
function FromInteger5(schema, references, value) {
|
|
7452
|
+
return TryConvertInteger(value);
|
|
7453
|
+
}
|
|
7454
|
+
function FromIntersect14(schema, references, value) {
|
|
7455
|
+
return schema.allOf.reduce((value2, schema2) => Visit10(schema2, references, value2), value);
|
|
7456
|
+
}
|
|
7457
|
+
function FromLiteral6(schema, references, value) {
|
|
7458
|
+
return TryConvertLiteral(schema, value);
|
|
7459
|
+
}
|
|
7460
|
+
function FromNull5(schema, references, value) {
|
|
7461
|
+
return TryConvertNull(value);
|
|
7462
|
+
}
|
|
7463
|
+
function FromNumber5(schema, references, value) {
|
|
7464
|
+
return TryConvertNumber(value);
|
|
7465
|
+
}
|
|
7466
|
+
function FromObject14(schema, references, value) {
|
|
7467
|
+
if (!IsObject2(value) || IsArray2(value))
|
|
7468
|
+
return value;
|
|
7469
|
+
for (const propertyKey of Object.getOwnPropertyNames(schema.properties)) {
|
|
7470
|
+
if (!HasPropertyKey2(value, propertyKey))
|
|
7471
|
+
continue;
|
|
7472
|
+
value[propertyKey] = Visit10(schema.properties[propertyKey], references, value[propertyKey]);
|
|
7473
|
+
}
|
|
7474
|
+
return value;
|
|
7475
|
+
}
|
|
7476
|
+
function FromRecord9(schema, references, value) {
|
|
7477
|
+
const isConvertable = IsObject2(value) && !IsArray2(value);
|
|
7478
|
+
if (!isConvertable)
|
|
7479
|
+
return value;
|
|
7480
|
+
const propertyKey = Object.getOwnPropertyNames(schema.patternProperties)[0];
|
|
7481
|
+
const property = schema.patternProperties[propertyKey];
|
|
7482
|
+
for (const [propKey, propValue] of Object.entries(value)) {
|
|
7483
|
+
value[propKey] = Visit10(property, references, propValue);
|
|
7484
|
+
}
|
|
7485
|
+
return value;
|
|
7486
|
+
}
|
|
7487
|
+
function FromRef10(schema, references, value) {
|
|
7488
|
+
return Visit10(Deref(schema, references), references, value);
|
|
7489
|
+
}
|
|
7490
|
+
function FromString5(schema, references, value) {
|
|
7491
|
+
return TryConvertString(value);
|
|
7492
|
+
}
|
|
7493
|
+
function FromSymbol5(schema, references, value) {
|
|
7494
|
+
return IsString2(value) || IsNumber2(value) ? Symbol(value) : value;
|
|
7495
|
+
}
|
|
7496
|
+
function FromThis6(schema, references, value) {
|
|
7497
|
+
return Visit10(Deref(schema, references), references, value);
|
|
7498
|
+
}
|
|
7499
|
+
function FromTuple11(schema, references, value) {
|
|
7500
|
+
const isConvertable = IsArray2(value) && !IsUndefined2(schema.items);
|
|
7501
|
+
if (!isConvertable)
|
|
7502
|
+
return value;
|
|
7503
|
+
return value.map((value2, index) => {
|
|
7504
|
+
return index < schema.items.length ? Visit10(schema.items[index], references, value2) : value2;
|
|
7505
|
+
});
|
|
7506
|
+
}
|
|
7507
|
+
function FromUndefined5(schema, references, value) {
|
|
7508
|
+
return TryConvertUndefined(value);
|
|
7509
|
+
}
|
|
7510
|
+
function FromUnion16(schema, references, value) {
|
|
7511
|
+
for (const subschema of schema.anyOf) {
|
|
7512
|
+
if (Check(subschema, references, value)) {
|
|
7513
|
+
return value;
|
|
7514
|
+
}
|
|
7515
|
+
}
|
|
7516
|
+
for (const subschema of schema.anyOf) {
|
|
7517
|
+
const converted = Visit10(subschema, references, Clone2(value));
|
|
7518
|
+
if (!Check(subschema, references, converted))
|
|
7519
|
+
continue;
|
|
7520
|
+
return converted;
|
|
7521
|
+
}
|
|
7522
|
+
return value;
|
|
7523
|
+
}
|
|
7524
|
+
function Visit10(schema, references, value) {
|
|
7525
|
+
const references_ = Pushref(schema, references);
|
|
7526
|
+
const schema_ = schema;
|
|
7527
|
+
switch (schema[Kind]) {
|
|
7528
|
+
case "Array":
|
|
7529
|
+
return FromArray13(schema_, references_, value);
|
|
7530
|
+
case "BigInt":
|
|
7531
|
+
return FromBigInt5(schema_, references_, value);
|
|
7532
|
+
case "Boolean":
|
|
7533
|
+
return FromBoolean5(schema_, references_, value);
|
|
7534
|
+
case "Date":
|
|
7535
|
+
return FromDate6(schema_, references_, value);
|
|
7536
|
+
case "Import":
|
|
7537
|
+
return FromImport6(schema_, references_, value);
|
|
7538
|
+
case "Integer":
|
|
7539
|
+
return FromInteger5(schema_, references_, value);
|
|
7540
|
+
case "Intersect":
|
|
7541
|
+
return FromIntersect14(schema_, references_, value);
|
|
7542
|
+
case "Literal":
|
|
7543
|
+
return FromLiteral6(schema_, references_, value);
|
|
7544
|
+
case "Null":
|
|
7545
|
+
return FromNull5(schema_, references_, value);
|
|
7546
|
+
case "Number":
|
|
7547
|
+
return FromNumber5(schema_, references_, value);
|
|
7548
|
+
case "Object":
|
|
7549
|
+
return FromObject14(schema_, references_, value);
|
|
7550
|
+
case "Record":
|
|
7551
|
+
return FromRecord9(schema_, references_, value);
|
|
7552
|
+
case "Ref":
|
|
7553
|
+
return FromRef10(schema_, references_, value);
|
|
7554
|
+
case "String":
|
|
7555
|
+
return FromString5(schema_, references_, value);
|
|
7556
|
+
case "Symbol":
|
|
7557
|
+
return FromSymbol5(schema_, references_, value);
|
|
7558
|
+
case "This":
|
|
7559
|
+
return FromThis6(schema_, references_, value);
|
|
7560
|
+
case "Tuple":
|
|
7561
|
+
return FromTuple11(schema_, references_, value);
|
|
7562
|
+
case "Undefined":
|
|
7563
|
+
return FromUndefined5(schema_, references_, value);
|
|
7564
|
+
case "Union":
|
|
7565
|
+
return FromUnion16(schema_, references_, value);
|
|
7566
|
+
default:
|
|
7567
|
+
return Default2(value);
|
|
7568
|
+
}
|
|
7569
|
+
}
|
|
7570
|
+
function Convert(...args) {
|
|
7571
|
+
return args.length === 3 ? Visit10(args[0], args[1], args[2]) : Visit10(args[0], [], args[1]);
|
|
7572
|
+
}
|
|
7573
|
+
|
|
7574
|
+
// ../../node_modules/@sinclair/typebox/build/esm/value/transform/decode.mjs
|
|
7575
|
+
var TransformDecodeCheckError = class extends TypeBoxError {
|
|
7576
|
+
constructor(schema, value, error) {
|
|
7577
|
+
super(`Unable to decode value as it does not match the expected schema`);
|
|
7578
|
+
this.schema = schema;
|
|
7579
|
+
this.value = value;
|
|
7580
|
+
this.error = error;
|
|
7581
|
+
}
|
|
7582
|
+
};
|
|
7583
|
+
var TransformDecodeError = class extends TypeBoxError {
|
|
7584
|
+
constructor(schema, path2, value, error) {
|
|
7585
|
+
super(error instanceof Error ? error.message : "Unknown error");
|
|
7586
|
+
this.schema = schema;
|
|
7587
|
+
this.path = path2;
|
|
7588
|
+
this.value = value;
|
|
7589
|
+
this.error = error;
|
|
7590
|
+
}
|
|
7591
|
+
};
|
|
7592
|
+
function Default3(schema, path2, value) {
|
|
7593
|
+
try {
|
|
7594
|
+
return IsTransform(schema) ? schema[TransformKind].Decode(value) : value;
|
|
7595
|
+
} catch (error) {
|
|
7596
|
+
throw new TransformDecodeError(schema, path2, value, error);
|
|
7597
|
+
}
|
|
7598
|
+
}
|
|
7599
|
+
function FromArray14(schema, references, path2, value) {
|
|
7600
|
+
return IsArray2(value) ? Default3(schema, path2, value.map((value2, index) => Visit11(schema.items, references, `${path2}/${index}`, value2))) : Default3(schema, path2, value);
|
|
7601
|
+
}
|
|
7602
|
+
function FromIntersect15(schema, references, path2, value) {
|
|
7603
|
+
if (!IsObject2(value) || IsValueType(value))
|
|
7604
|
+
return Default3(schema, path2, value);
|
|
7605
|
+
const knownEntries = KeyOfPropertyEntries(schema);
|
|
7606
|
+
const knownKeys = knownEntries.map((entry) => entry[0]);
|
|
7607
|
+
const knownProperties = { ...value };
|
|
7608
|
+
for (const [knownKey, knownSchema] of knownEntries)
|
|
7609
|
+
if (knownKey in knownProperties) {
|
|
7610
|
+
knownProperties[knownKey] = Visit11(knownSchema, references, `${path2}/${knownKey}`, knownProperties[knownKey]);
|
|
7611
|
+
}
|
|
7612
|
+
if (!IsTransform(schema.unevaluatedProperties)) {
|
|
7613
|
+
return Default3(schema, path2, knownProperties);
|
|
7614
|
+
}
|
|
7615
|
+
const unknownKeys = Object.getOwnPropertyNames(knownProperties);
|
|
7616
|
+
const unevaluatedProperties = schema.unevaluatedProperties;
|
|
7617
|
+
const unknownProperties = { ...knownProperties };
|
|
7618
|
+
for (const key of unknownKeys)
|
|
7619
|
+
if (!knownKeys.includes(key)) {
|
|
7620
|
+
unknownProperties[key] = Default3(unevaluatedProperties, `${path2}/${key}`, unknownProperties[key]);
|
|
7621
|
+
}
|
|
7622
|
+
return Default3(schema, path2, unknownProperties);
|
|
7623
|
+
}
|
|
7624
|
+
function FromImport7(schema, references, path2, value) {
|
|
7625
|
+
const additional = globalThis.Object.values(schema.$defs);
|
|
7626
|
+
const target = schema.$defs[schema.$ref];
|
|
7627
|
+
const result = Visit11(target, [...references, ...additional], path2, value);
|
|
7628
|
+
return Default3(schema, path2, result);
|
|
7629
|
+
}
|
|
7630
|
+
function FromNot5(schema, references, path2, value) {
|
|
7631
|
+
return Default3(schema, path2, Visit11(schema.not, references, path2, value));
|
|
7632
|
+
}
|
|
7633
|
+
function FromObject15(schema, references, path2, value) {
|
|
7634
|
+
if (!IsObject2(value))
|
|
7635
|
+
return Default3(schema, path2, value);
|
|
7636
|
+
const knownKeys = KeyOfPropertyKeys(schema);
|
|
7637
|
+
const knownProperties = { ...value };
|
|
7638
|
+
for (const key of knownKeys) {
|
|
7639
|
+
if (!HasPropertyKey2(knownProperties, key))
|
|
7640
|
+
continue;
|
|
7641
|
+
if (IsUndefined2(knownProperties[key]) && (!IsUndefined3(schema.properties[key]) || TypeSystemPolicy.IsExactOptionalProperty(knownProperties, key)))
|
|
7642
|
+
continue;
|
|
7643
|
+
knownProperties[key] = Visit11(schema.properties[key], references, `${path2}/${key}`, knownProperties[key]);
|
|
7644
|
+
}
|
|
7645
|
+
if (!IsSchema(schema.additionalProperties)) {
|
|
7646
|
+
return Default3(schema, path2, knownProperties);
|
|
7647
|
+
}
|
|
7648
|
+
const unknownKeys = Object.getOwnPropertyNames(knownProperties);
|
|
7649
|
+
const additionalProperties = schema.additionalProperties;
|
|
7650
|
+
const unknownProperties = { ...knownProperties };
|
|
7651
|
+
for (const key of unknownKeys)
|
|
7652
|
+
if (!knownKeys.includes(key)) {
|
|
7653
|
+
unknownProperties[key] = Default3(additionalProperties, `${path2}/${key}`, unknownProperties[key]);
|
|
7654
|
+
}
|
|
7655
|
+
return Default3(schema, path2, unknownProperties);
|
|
7656
|
+
}
|
|
7657
|
+
function FromRecord10(schema, references, path2, value) {
|
|
7658
|
+
if (!IsObject2(value))
|
|
7659
|
+
return Default3(schema, path2, value);
|
|
7660
|
+
const pattern = Object.getOwnPropertyNames(schema.patternProperties)[0];
|
|
7661
|
+
const knownKeys = new RegExp(pattern);
|
|
7662
|
+
const knownProperties = { ...value };
|
|
7663
|
+
for (const key of Object.getOwnPropertyNames(value))
|
|
7664
|
+
if (knownKeys.test(key)) {
|
|
7665
|
+
knownProperties[key] = Visit11(schema.patternProperties[pattern], references, `${path2}/${key}`, knownProperties[key]);
|
|
7666
|
+
}
|
|
7667
|
+
if (!IsSchema(schema.additionalProperties)) {
|
|
7668
|
+
return Default3(schema, path2, knownProperties);
|
|
7669
|
+
}
|
|
7670
|
+
const unknownKeys = Object.getOwnPropertyNames(knownProperties);
|
|
7671
|
+
const additionalProperties = schema.additionalProperties;
|
|
7672
|
+
const unknownProperties = { ...knownProperties };
|
|
7673
|
+
for (const key of unknownKeys)
|
|
7674
|
+
if (!knownKeys.test(key)) {
|
|
7675
|
+
unknownProperties[key] = Default3(additionalProperties, `${path2}/${key}`, unknownProperties[key]);
|
|
7676
|
+
}
|
|
7677
|
+
return Default3(schema, path2, unknownProperties);
|
|
7678
|
+
}
|
|
7679
|
+
function FromRef11(schema, references, path2, value) {
|
|
7680
|
+
const target = Deref(schema, references);
|
|
7681
|
+
return Default3(schema, path2, Visit11(target, references, path2, value));
|
|
7682
|
+
}
|
|
7683
|
+
function FromThis7(schema, references, path2, value) {
|
|
7684
|
+
const target = Deref(schema, references);
|
|
7685
|
+
return Default3(schema, path2, Visit11(target, references, path2, value));
|
|
7686
|
+
}
|
|
7687
|
+
function FromTuple12(schema, references, path2, value) {
|
|
7688
|
+
return IsArray2(value) && IsArray2(schema.items) ? Default3(schema, path2, schema.items.map((schema2, index) => Visit11(schema2, references, `${path2}/${index}`, value[index]))) : Default3(schema, path2, value);
|
|
7689
|
+
}
|
|
7690
|
+
function FromUnion17(schema, references, path2, value) {
|
|
7691
|
+
for (const subschema of schema.anyOf) {
|
|
7692
|
+
if (!Check(subschema, references, value))
|
|
7693
|
+
continue;
|
|
7694
|
+
const decoded = Visit11(subschema, references, path2, value);
|
|
7695
|
+
return Default3(schema, path2, decoded);
|
|
7696
|
+
}
|
|
7697
|
+
return Default3(schema, path2, value);
|
|
7698
|
+
}
|
|
7699
|
+
function Visit11(schema, references, path2, value) {
|
|
7700
|
+
const references_ = Pushref(schema, references);
|
|
7701
|
+
const schema_ = schema;
|
|
7702
|
+
switch (schema[Kind]) {
|
|
7703
|
+
case "Array":
|
|
7704
|
+
return FromArray14(schema_, references_, path2, value);
|
|
7705
|
+
case "Import":
|
|
7706
|
+
return FromImport7(schema_, references_, path2, value);
|
|
7707
|
+
case "Intersect":
|
|
7708
|
+
return FromIntersect15(schema_, references_, path2, value);
|
|
7709
|
+
case "Not":
|
|
7710
|
+
return FromNot5(schema_, references_, path2, value);
|
|
7711
|
+
case "Object":
|
|
7712
|
+
return FromObject15(schema_, references_, path2, value);
|
|
7713
|
+
case "Record":
|
|
7714
|
+
return FromRecord10(schema_, references_, path2, value);
|
|
7715
|
+
case "Ref":
|
|
7716
|
+
return FromRef11(schema_, references_, path2, value);
|
|
7717
|
+
case "Symbol":
|
|
7718
|
+
return Default3(schema_, path2, value);
|
|
7719
|
+
case "This":
|
|
7720
|
+
return FromThis7(schema_, references_, path2, value);
|
|
7721
|
+
case "Tuple":
|
|
7722
|
+
return FromTuple12(schema_, references_, path2, value);
|
|
7723
|
+
case "Union":
|
|
7724
|
+
return FromUnion17(schema_, references_, path2, value);
|
|
7725
|
+
default:
|
|
7726
|
+
return Default3(schema_, path2, value);
|
|
7727
|
+
}
|
|
7728
|
+
}
|
|
7729
|
+
function TransformDecode(schema, references, value) {
|
|
7730
|
+
return Visit11(schema, references, "", value);
|
|
7731
|
+
}
|
|
7732
|
+
|
|
7733
|
+
// ../../node_modules/@sinclair/typebox/build/esm/value/transform/encode.mjs
|
|
7734
|
+
var TransformEncodeCheckError = class extends TypeBoxError {
|
|
7735
|
+
constructor(schema, value, error) {
|
|
7736
|
+
super(`The encoded value does not match the expected schema`);
|
|
7737
|
+
this.schema = schema;
|
|
7738
|
+
this.value = value;
|
|
7739
|
+
this.error = error;
|
|
7740
|
+
}
|
|
7741
|
+
};
|
|
7742
|
+
var TransformEncodeError = class extends TypeBoxError {
|
|
7743
|
+
constructor(schema, path2, value, error) {
|
|
7744
|
+
super(`${error instanceof Error ? error.message : "Unknown error"}`);
|
|
7745
|
+
this.schema = schema;
|
|
7746
|
+
this.path = path2;
|
|
7747
|
+
this.value = value;
|
|
7748
|
+
this.error = error;
|
|
7749
|
+
}
|
|
7750
|
+
};
|
|
7751
|
+
function Default4(schema, path2, value) {
|
|
7752
|
+
try {
|
|
7753
|
+
return IsTransform(schema) ? schema[TransformKind].Encode(value) : value;
|
|
7754
|
+
} catch (error) {
|
|
7755
|
+
throw new TransformEncodeError(schema, path2, value, error);
|
|
7756
|
+
}
|
|
7757
|
+
}
|
|
7758
|
+
function FromArray15(schema, references, path2, value) {
|
|
7759
|
+
const defaulted = Default4(schema, path2, value);
|
|
7760
|
+
return IsArray2(defaulted) ? defaulted.map((value2, index) => Visit12(schema.items, references, `${path2}/${index}`, value2)) : defaulted;
|
|
7761
|
+
}
|
|
7762
|
+
function FromImport8(schema, references, path2, value) {
|
|
7763
|
+
const additional = globalThis.Object.values(schema.$defs);
|
|
7764
|
+
const target = schema.$defs[schema.$ref];
|
|
7765
|
+
const result = Default4(schema, path2, value);
|
|
7766
|
+
return Visit12(target, [...references, ...additional], path2, result);
|
|
7767
|
+
}
|
|
7768
|
+
function FromIntersect16(schema, references, path2, value) {
|
|
7769
|
+
const defaulted = Default4(schema, path2, value);
|
|
7770
|
+
if (!IsObject2(value) || IsValueType(value))
|
|
7771
|
+
return defaulted;
|
|
7772
|
+
const knownEntries = KeyOfPropertyEntries(schema);
|
|
7773
|
+
const knownKeys = knownEntries.map((entry) => entry[0]);
|
|
7774
|
+
const knownProperties = { ...defaulted };
|
|
7775
|
+
for (const [knownKey, knownSchema] of knownEntries)
|
|
7776
|
+
if (knownKey in knownProperties) {
|
|
7777
|
+
knownProperties[knownKey] = Visit12(knownSchema, references, `${path2}/${knownKey}`, knownProperties[knownKey]);
|
|
7778
|
+
}
|
|
7779
|
+
if (!IsTransform(schema.unevaluatedProperties)) {
|
|
7780
|
+
return knownProperties;
|
|
7781
|
+
}
|
|
7782
|
+
const unknownKeys = Object.getOwnPropertyNames(knownProperties);
|
|
7783
|
+
const unevaluatedProperties = schema.unevaluatedProperties;
|
|
7784
|
+
const properties = { ...knownProperties };
|
|
7785
|
+
for (const key of unknownKeys)
|
|
7786
|
+
if (!knownKeys.includes(key)) {
|
|
7787
|
+
properties[key] = Default4(unevaluatedProperties, `${path2}/${key}`, properties[key]);
|
|
7788
|
+
}
|
|
7789
|
+
return properties;
|
|
7790
|
+
}
|
|
7791
|
+
function FromNot6(schema, references, path2, value) {
|
|
7792
|
+
return Default4(schema.not, path2, Default4(schema, path2, value));
|
|
7793
|
+
}
|
|
7794
|
+
function FromObject16(schema, references, path2, value) {
|
|
7795
|
+
const defaulted = Default4(schema, path2, value);
|
|
7796
|
+
if (!IsObject2(defaulted))
|
|
7797
|
+
return defaulted;
|
|
7798
|
+
const knownKeys = KeyOfPropertyKeys(schema);
|
|
7799
|
+
const knownProperties = { ...defaulted };
|
|
7800
|
+
for (const key of knownKeys) {
|
|
7801
|
+
if (!HasPropertyKey2(knownProperties, key))
|
|
7802
|
+
continue;
|
|
7803
|
+
if (IsUndefined2(knownProperties[key]) && (!IsUndefined3(schema.properties[key]) || TypeSystemPolicy.IsExactOptionalProperty(knownProperties, key)))
|
|
7804
|
+
continue;
|
|
7805
|
+
knownProperties[key] = Visit12(schema.properties[key], references, `${path2}/${key}`, knownProperties[key]);
|
|
7806
|
+
}
|
|
7807
|
+
if (!IsSchema(schema.additionalProperties)) {
|
|
7808
|
+
return knownProperties;
|
|
7809
|
+
}
|
|
7810
|
+
const unknownKeys = Object.getOwnPropertyNames(knownProperties);
|
|
7811
|
+
const additionalProperties = schema.additionalProperties;
|
|
7812
|
+
const properties = { ...knownProperties };
|
|
7813
|
+
for (const key of unknownKeys)
|
|
7814
|
+
if (!knownKeys.includes(key)) {
|
|
7815
|
+
properties[key] = Default4(additionalProperties, `${path2}/${key}`, properties[key]);
|
|
7816
|
+
}
|
|
7817
|
+
return properties;
|
|
7818
|
+
}
|
|
7819
|
+
function FromRecord11(schema, references, path2, value) {
|
|
7820
|
+
const defaulted = Default4(schema, path2, value);
|
|
7821
|
+
if (!IsObject2(value))
|
|
7822
|
+
return defaulted;
|
|
7823
|
+
const pattern = Object.getOwnPropertyNames(schema.patternProperties)[0];
|
|
7824
|
+
const knownKeys = new RegExp(pattern);
|
|
7825
|
+
const knownProperties = { ...defaulted };
|
|
7826
|
+
for (const key of Object.getOwnPropertyNames(value))
|
|
7827
|
+
if (knownKeys.test(key)) {
|
|
7828
|
+
knownProperties[key] = Visit12(schema.patternProperties[pattern], references, `${path2}/${key}`, knownProperties[key]);
|
|
7829
|
+
}
|
|
7830
|
+
if (!IsSchema(schema.additionalProperties)) {
|
|
7831
|
+
return knownProperties;
|
|
7832
|
+
}
|
|
7833
|
+
const unknownKeys = Object.getOwnPropertyNames(knownProperties);
|
|
7834
|
+
const additionalProperties = schema.additionalProperties;
|
|
7835
|
+
const properties = { ...knownProperties };
|
|
7836
|
+
for (const key of unknownKeys)
|
|
7837
|
+
if (!knownKeys.test(key)) {
|
|
7838
|
+
properties[key] = Default4(additionalProperties, `${path2}/${key}`, properties[key]);
|
|
7839
|
+
}
|
|
7840
|
+
return properties;
|
|
7841
|
+
}
|
|
7842
|
+
function FromRef12(schema, references, path2, value) {
|
|
7843
|
+
const target = Deref(schema, references);
|
|
7844
|
+
const resolved = Visit12(target, references, path2, value);
|
|
7845
|
+
return Default4(schema, path2, resolved);
|
|
7846
|
+
}
|
|
7847
|
+
function FromThis8(schema, references, path2, value) {
|
|
7848
|
+
const target = Deref(schema, references);
|
|
7849
|
+
const resolved = Visit12(target, references, path2, value);
|
|
7850
|
+
return Default4(schema, path2, resolved);
|
|
7851
|
+
}
|
|
7852
|
+
function FromTuple13(schema, references, path2, value) {
|
|
7853
|
+
const value1 = Default4(schema, path2, value);
|
|
7854
|
+
return IsArray2(schema.items) ? schema.items.map((schema2, index) => Visit12(schema2, references, `${path2}/${index}`, value1[index])) : [];
|
|
7855
|
+
}
|
|
7856
|
+
function FromUnion18(schema, references, path2, value) {
|
|
7857
|
+
for (const subschema of schema.anyOf) {
|
|
7858
|
+
if (!Check(subschema, references, value))
|
|
7859
|
+
continue;
|
|
7860
|
+
const value1 = Visit12(subschema, references, path2, value);
|
|
7861
|
+
return Default4(schema, path2, value1);
|
|
7862
|
+
}
|
|
7863
|
+
for (const subschema of schema.anyOf) {
|
|
7864
|
+
const value1 = Visit12(subschema, references, path2, value);
|
|
7865
|
+
if (!Check(schema, references, value1))
|
|
7866
|
+
continue;
|
|
7867
|
+
return Default4(schema, path2, value1);
|
|
7868
|
+
}
|
|
7869
|
+
return Default4(schema, path2, value);
|
|
7870
|
+
}
|
|
7871
|
+
function Visit12(schema, references, path2, value) {
|
|
7872
|
+
const references_ = Pushref(schema, references);
|
|
7873
|
+
const schema_ = schema;
|
|
7874
|
+
switch (schema[Kind]) {
|
|
7875
|
+
case "Array":
|
|
7876
|
+
return FromArray15(schema_, references_, path2, value);
|
|
7877
|
+
case "Import":
|
|
7878
|
+
return FromImport8(schema_, references_, path2, value);
|
|
7879
|
+
case "Intersect":
|
|
7880
|
+
return FromIntersect16(schema_, references_, path2, value);
|
|
7881
|
+
case "Not":
|
|
7882
|
+
return FromNot6(schema_, references_, path2, value);
|
|
7883
|
+
case "Object":
|
|
7884
|
+
return FromObject16(schema_, references_, path2, value);
|
|
7885
|
+
case "Record":
|
|
7886
|
+
return FromRecord11(schema_, references_, path2, value);
|
|
7887
|
+
case "Ref":
|
|
7888
|
+
return FromRef12(schema_, references_, path2, value);
|
|
7889
|
+
case "This":
|
|
7890
|
+
return FromThis8(schema_, references_, path2, value);
|
|
7891
|
+
case "Tuple":
|
|
7892
|
+
return FromTuple13(schema_, references_, path2, value);
|
|
7893
|
+
case "Union":
|
|
7894
|
+
return FromUnion18(schema_, references_, path2, value);
|
|
7895
|
+
default:
|
|
7896
|
+
return Default4(schema_, path2, value);
|
|
7897
|
+
}
|
|
7898
|
+
}
|
|
7899
|
+
function TransformEncode(schema, references, value) {
|
|
7900
|
+
return Visit12(schema, references, "", value);
|
|
7901
|
+
}
|
|
7902
|
+
|
|
7903
|
+
// ../../node_modules/@sinclair/typebox/build/esm/value/transform/has.mjs
|
|
7904
|
+
function FromArray16(schema, references) {
|
|
7905
|
+
return IsTransform(schema) || Visit13(schema.items, references);
|
|
7906
|
+
}
|
|
7907
|
+
function FromAsyncIterator7(schema, references) {
|
|
7908
|
+
return IsTransform(schema) || Visit13(schema.items, references);
|
|
7909
|
+
}
|
|
7910
|
+
function FromConstructor8(schema, references) {
|
|
7911
|
+
return IsTransform(schema) || Visit13(schema.returns, references) || schema.parameters.some((schema2) => Visit13(schema2, references));
|
|
7912
|
+
}
|
|
7913
|
+
function FromFunction7(schema, references) {
|
|
7914
|
+
return IsTransform(schema) || Visit13(schema.returns, references) || schema.parameters.some((schema2) => Visit13(schema2, references));
|
|
7915
|
+
}
|
|
7916
|
+
function FromIntersect17(schema, references) {
|
|
7917
|
+
return IsTransform(schema) || IsTransform(schema.unevaluatedProperties) || schema.allOf.some((schema2) => Visit13(schema2, references));
|
|
7918
|
+
}
|
|
7919
|
+
function FromImport9(schema, references) {
|
|
7920
|
+
const additional = globalThis.Object.getOwnPropertyNames(schema.$defs).reduce((result, key) => [...result, schema.$defs[key]], []);
|
|
7921
|
+
const target = schema.$defs[schema.$ref];
|
|
7922
|
+
return IsTransform(schema) || Visit13(target, [...additional, ...references]);
|
|
7923
|
+
}
|
|
7924
|
+
function FromIterator7(schema, references) {
|
|
7925
|
+
return IsTransform(schema) || Visit13(schema.items, references);
|
|
7926
|
+
}
|
|
7927
|
+
function FromNot7(schema, references) {
|
|
7928
|
+
return IsTransform(schema) || Visit13(schema.not, references);
|
|
7929
|
+
}
|
|
7930
|
+
function FromObject17(schema, references) {
|
|
7931
|
+
return IsTransform(schema) || Object.values(schema.properties).some((schema2) => Visit13(schema2, references)) || IsSchema(schema.additionalProperties) && Visit13(schema.additionalProperties, references);
|
|
7932
|
+
}
|
|
7933
|
+
function FromPromise7(schema, references) {
|
|
7934
|
+
return IsTransform(schema) || Visit13(schema.item, references);
|
|
7935
|
+
}
|
|
7936
|
+
function FromRecord12(schema, references) {
|
|
7937
|
+
const pattern = Object.getOwnPropertyNames(schema.patternProperties)[0];
|
|
7938
|
+
const property = schema.patternProperties[pattern];
|
|
7939
|
+
return IsTransform(schema) || Visit13(property, references) || IsSchema(schema.additionalProperties) && IsTransform(schema.additionalProperties);
|
|
7940
|
+
}
|
|
7941
|
+
function FromRef13(schema, references) {
|
|
7942
|
+
if (IsTransform(schema))
|
|
7943
|
+
return true;
|
|
7944
|
+
return Visit13(Deref(schema, references), references);
|
|
7945
|
+
}
|
|
7946
|
+
function FromThis9(schema, references) {
|
|
7947
|
+
if (IsTransform(schema))
|
|
7948
|
+
return true;
|
|
7949
|
+
return Visit13(Deref(schema, references), references);
|
|
7950
|
+
}
|
|
7951
|
+
function FromTuple14(schema, references) {
|
|
7952
|
+
return IsTransform(schema) || !IsUndefined2(schema.items) && schema.items.some((schema2) => Visit13(schema2, references));
|
|
7953
|
+
}
|
|
7954
|
+
function FromUnion19(schema, references) {
|
|
7955
|
+
return IsTransform(schema) || schema.anyOf.some((schema2) => Visit13(schema2, references));
|
|
7956
|
+
}
|
|
7957
|
+
function Visit13(schema, references) {
|
|
7958
|
+
const references_ = Pushref(schema, references);
|
|
7959
|
+
const schema_ = schema;
|
|
7960
|
+
if (schema.$id && visited.has(schema.$id))
|
|
7961
|
+
return false;
|
|
7962
|
+
if (schema.$id)
|
|
7963
|
+
visited.add(schema.$id);
|
|
7964
|
+
switch (schema[Kind]) {
|
|
7965
|
+
case "Array":
|
|
7966
|
+
return FromArray16(schema_, references_);
|
|
7967
|
+
case "AsyncIterator":
|
|
7968
|
+
return FromAsyncIterator7(schema_, references_);
|
|
7969
|
+
case "Constructor":
|
|
7970
|
+
return FromConstructor8(schema_, references_);
|
|
7971
|
+
case "Function":
|
|
7972
|
+
return FromFunction7(schema_, references_);
|
|
7973
|
+
case "Import":
|
|
7974
|
+
return FromImport9(schema_, references_);
|
|
7975
|
+
case "Intersect":
|
|
7976
|
+
return FromIntersect17(schema_, references_);
|
|
7977
|
+
case "Iterator":
|
|
7978
|
+
return FromIterator7(schema_, references_);
|
|
7979
|
+
case "Not":
|
|
7980
|
+
return FromNot7(schema_, references_);
|
|
7981
|
+
case "Object":
|
|
7982
|
+
return FromObject17(schema_, references_);
|
|
7983
|
+
case "Promise":
|
|
7984
|
+
return FromPromise7(schema_, references_);
|
|
7985
|
+
case "Record":
|
|
7986
|
+
return FromRecord12(schema_, references_);
|
|
7987
|
+
case "Ref":
|
|
7988
|
+
return FromRef13(schema_, references_);
|
|
7989
|
+
case "This":
|
|
7990
|
+
return FromThis9(schema_, references_);
|
|
7991
|
+
case "Tuple":
|
|
7992
|
+
return FromTuple14(schema_, references_);
|
|
7993
|
+
case "Union":
|
|
7994
|
+
return FromUnion19(schema_, references_);
|
|
7995
|
+
default:
|
|
7996
|
+
return IsTransform(schema);
|
|
7997
|
+
}
|
|
7998
|
+
}
|
|
7999
|
+
var visited = /* @__PURE__ */ new Set();
|
|
8000
|
+
function HasTransform(schema, references) {
|
|
8001
|
+
visited.clear();
|
|
8002
|
+
return Visit13(schema, references);
|
|
8003
|
+
}
|
|
8004
|
+
|
|
8005
|
+
// ../../node_modules/@sinclair/typebox/build/esm/value/decode/decode.mjs
|
|
8006
|
+
function Decode(...args) {
|
|
8007
|
+
const [schema, references, value] = args.length === 3 ? [args[0], args[1], args[2]] : [args[0], [], args[1]];
|
|
8008
|
+
if (!Check(schema, references, value))
|
|
8009
|
+
throw new TransformDecodeCheckError(schema, value, Errors(schema, references, value).First());
|
|
8010
|
+
return HasTransform(schema, references) ? TransformDecode(schema, references, value) : value;
|
|
8011
|
+
}
|
|
8012
|
+
|
|
8013
|
+
// ../../node_modules/@sinclair/typebox/build/esm/value/default/default.mjs
|
|
8014
|
+
function ValueOrDefault(schema, value) {
|
|
8015
|
+
const defaultValue = HasPropertyKey2(schema, "default") ? schema.default : void 0;
|
|
8016
|
+
const clone = IsFunction2(defaultValue) ? defaultValue() : Clone2(defaultValue);
|
|
8017
|
+
return IsUndefined2(value) ? clone : IsObject2(value) && IsObject2(clone) ? Object.assign(clone, value) : value;
|
|
8018
|
+
}
|
|
8019
|
+
function HasDefaultProperty(schema) {
|
|
8020
|
+
return IsKind(schema) && "default" in schema;
|
|
8021
|
+
}
|
|
8022
|
+
function FromArray17(schema, references, value) {
|
|
8023
|
+
if (IsArray2(value)) {
|
|
8024
|
+
for (let i = 0; i < value.length; i++) {
|
|
8025
|
+
value[i] = Visit14(schema.items, references, value[i]);
|
|
8026
|
+
}
|
|
8027
|
+
return value;
|
|
8028
|
+
}
|
|
8029
|
+
const defaulted = ValueOrDefault(schema, value);
|
|
8030
|
+
if (!IsArray2(defaulted))
|
|
8031
|
+
return defaulted;
|
|
8032
|
+
for (let i = 0; i < defaulted.length; i++) {
|
|
8033
|
+
defaulted[i] = Visit14(schema.items, references, defaulted[i]);
|
|
8034
|
+
}
|
|
8035
|
+
return defaulted;
|
|
8036
|
+
}
|
|
8037
|
+
function FromDate7(schema, references, value) {
|
|
8038
|
+
return IsDate2(value) ? value : ValueOrDefault(schema, value);
|
|
8039
|
+
}
|
|
8040
|
+
function FromImport10(schema, references, value) {
|
|
8041
|
+
const definitions = globalThis.Object.values(schema.$defs);
|
|
8042
|
+
const target = schema.$defs[schema.$ref];
|
|
8043
|
+
return Visit14(target, [...references, ...definitions], value);
|
|
8044
|
+
}
|
|
8045
|
+
function FromIntersect18(schema, references, value) {
|
|
8046
|
+
const defaulted = ValueOrDefault(schema, value);
|
|
8047
|
+
return schema.allOf.reduce((acc, schema2) => {
|
|
8048
|
+
const next = Visit14(schema2, references, defaulted);
|
|
8049
|
+
return IsObject2(next) ? { ...acc, ...next } : next;
|
|
8050
|
+
}, {});
|
|
8051
|
+
}
|
|
8052
|
+
function FromObject18(schema, references, value) {
|
|
8053
|
+
const defaulted = ValueOrDefault(schema, value);
|
|
8054
|
+
if (!IsObject2(defaulted))
|
|
8055
|
+
return defaulted;
|
|
8056
|
+
const knownPropertyKeys = Object.getOwnPropertyNames(schema.properties);
|
|
8057
|
+
for (const key of knownPropertyKeys) {
|
|
8058
|
+
const propertyValue = Visit14(schema.properties[key], references, defaulted[key]);
|
|
8059
|
+
if (IsUndefined2(propertyValue))
|
|
8060
|
+
continue;
|
|
8061
|
+
defaulted[key] = Visit14(schema.properties[key], references, defaulted[key]);
|
|
8062
|
+
}
|
|
8063
|
+
if (!HasDefaultProperty(schema.additionalProperties))
|
|
8064
|
+
return defaulted;
|
|
8065
|
+
for (const key of Object.getOwnPropertyNames(defaulted)) {
|
|
8066
|
+
if (knownPropertyKeys.includes(key))
|
|
8067
|
+
continue;
|
|
8068
|
+
defaulted[key] = Visit14(schema.additionalProperties, references, defaulted[key]);
|
|
8069
|
+
}
|
|
8070
|
+
return defaulted;
|
|
8071
|
+
}
|
|
8072
|
+
function FromRecord13(schema, references, value) {
|
|
8073
|
+
const defaulted = ValueOrDefault(schema, value);
|
|
8074
|
+
if (!IsObject2(defaulted))
|
|
8075
|
+
return defaulted;
|
|
8076
|
+
const additionalPropertiesSchema = schema.additionalProperties;
|
|
8077
|
+
const [propertyKeyPattern, propertySchema] = Object.entries(schema.patternProperties)[0];
|
|
8078
|
+
const knownPropertyKey = new RegExp(propertyKeyPattern);
|
|
8079
|
+
for (const key of Object.getOwnPropertyNames(defaulted)) {
|
|
8080
|
+
if (!(knownPropertyKey.test(key) && HasDefaultProperty(propertySchema)))
|
|
8081
|
+
continue;
|
|
8082
|
+
defaulted[key] = Visit14(propertySchema, references, defaulted[key]);
|
|
8083
|
+
}
|
|
8084
|
+
if (!HasDefaultProperty(additionalPropertiesSchema))
|
|
8085
|
+
return defaulted;
|
|
8086
|
+
for (const key of Object.getOwnPropertyNames(defaulted)) {
|
|
8087
|
+
if (knownPropertyKey.test(key))
|
|
8088
|
+
continue;
|
|
8089
|
+
defaulted[key] = Visit14(additionalPropertiesSchema, references, defaulted[key]);
|
|
8090
|
+
}
|
|
8091
|
+
return defaulted;
|
|
8092
|
+
}
|
|
8093
|
+
function FromRef14(schema, references, value) {
|
|
8094
|
+
return Visit14(Deref(schema, references), references, ValueOrDefault(schema, value));
|
|
8095
|
+
}
|
|
8096
|
+
function FromThis10(schema, references, value) {
|
|
8097
|
+
return Visit14(Deref(schema, references), references, value);
|
|
8098
|
+
}
|
|
8099
|
+
function FromTuple15(schema, references, value) {
|
|
8100
|
+
const defaulted = ValueOrDefault(schema, value);
|
|
8101
|
+
if (!IsArray2(defaulted) || IsUndefined2(schema.items))
|
|
8102
|
+
return defaulted;
|
|
8103
|
+
const [items, max] = [schema.items, Math.max(schema.items.length, defaulted.length)];
|
|
8104
|
+
for (let i = 0; i < max; i++) {
|
|
8105
|
+
if (i < items.length)
|
|
8106
|
+
defaulted[i] = Visit14(items[i], references, defaulted[i]);
|
|
8107
|
+
}
|
|
8108
|
+
return defaulted;
|
|
8109
|
+
}
|
|
8110
|
+
function FromUnion20(schema, references, value) {
|
|
8111
|
+
const defaulted = ValueOrDefault(schema, value);
|
|
8112
|
+
for (const inner of schema.anyOf) {
|
|
8113
|
+
const result = Visit14(inner, references, Clone2(defaulted));
|
|
8114
|
+
if (Check(inner, references, result)) {
|
|
8115
|
+
return result;
|
|
8116
|
+
}
|
|
8117
|
+
}
|
|
8118
|
+
return defaulted;
|
|
8119
|
+
}
|
|
8120
|
+
function Visit14(schema, references, value) {
|
|
8121
|
+
const references_ = Pushref(schema, references);
|
|
8122
|
+
const schema_ = schema;
|
|
8123
|
+
switch (schema_[Kind]) {
|
|
8124
|
+
case "Array":
|
|
8125
|
+
return FromArray17(schema_, references_, value);
|
|
8126
|
+
case "Date":
|
|
8127
|
+
return FromDate7(schema_, references_, value);
|
|
8128
|
+
case "Import":
|
|
8129
|
+
return FromImport10(schema_, references_, value);
|
|
8130
|
+
case "Intersect":
|
|
8131
|
+
return FromIntersect18(schema_, references_, value);
|
|
8132
|
+
case "Object":
|
|
8133
|
+
return FromObject18(schema_, references_, value);
|
|
8134
|
+
case "Record":
|
|
8135
|
+
return FromRecord13(schema_, references_, value);
|
|
8136
|
+
case "Ref":
|
|
8137
|
+
return FromRef14(schema_, references_, value);
|
|
8138
|
+
case "This":
|
|
8139
|
+
return FromThis10(schema_, references_, value);
|
|
8140
|
+
case "Tuple":
|
|
8141
|
+
return FromTuple15(schema_, references_, value);
|
|
8142
|
+
case "Union":
|
|
8143
|
+
return FromUnion20(schema_, references_, value);
|
|
8144
|
+
default:
|
|
8145
|
+
return ValueOrDefault(schema_, value);
|
|
8146
|
+
}
|
|
8147
|
+
}
|
|
8148
|
+
function Default5(...args) {
|
|
8149
|
+
return args.length === 3 ? Visit14(args[0], args[1], args[2]) : Visit14(args[0], [], args[1]);
|
|
8150
|
+
}
|
|
8151
|
+
|
|
8152
|
+
// ../../node_modules/@sinclair/typebox/build/esm/value/pointer/pointer.mjs
|
|
8153
|
+
var pointer_exports = {};
|
|
8154
|
+
__export(pointer_exports, {
|
|
8155
|
+
Delete: () => Delete3,
|
|
8156
|
+
Format: () => Format,
|
|
8157
|
+
Get: () => Get3,
|
|
8158
|
+
Has: () => Has3,
|
|
8159
|
+
Set: () => Set4,
|
|
8160
|
+
ValuePointerRootDeleteError: () => ValuePointerRootDeleteError,
|
|
8161
|
+
ValuePointerRootSetError: () => ValuePointerRootSetError
|
|
8162
|
+
});
|
|
8163
|
+
var ValuePointerRootSetError = class extends TypeBoxError {
|
|
8164
|
+
constructor(value, path2, update) {
|
|
8165
|
+
super("Cannot set root value");
|
|
8166
|
+
this.value = value;
|
|
8167
|
+
this.path = path2;
|
|
8168
|
+
this.update = update;
|
|
8169
|
+
}
|
|
8170
|
+
};
|
|
8171
|
+
var ValuePointerRootDeleteError = class extends TypeBoxError {
|
|
8172
|
+
constructor(value, path2) {
|
|
8173
|
+
super("Cannot delete root value");
|
|
8174
|
+
this.value = value;
|
|
8175
|
+
this.path = path2;
|
|
8176
|
+
}
|
|
8177
|
+
};
|
|
8178
|
+
function Escape2(component) {
|
|
8179
|
+
return component.indexOf("~") === -1 ? component : component.replace(/~1/g, "/").replace(/~0/g, "~");
|
|
8180
|
+
}
|
|
8181
|
+
function* Format(pointer) {
|
|
8182
|
+
if (pointer === "")
|
|
8183
|
+
return;
|
|
8184
|
+
let [start, end] = [0, 0];
|
|
8185
|
+
for (let i = 0; i < pointer.length; i++) {
|
|
8186
|
+
const char = pointer.charAt(i);
|
|
8187
|
+
if (char === "/") {
|
|
8188
|
+
if (i === 0) {
|
|
8189
|
+
start = i + 1;
|
|
8190
|
+
} else {
|
|
8191
|
+
end = i;
|
|
8192
|
+
yield Escape2(pointer.slice(start, end));
|
|
8193
|
+
start = i + 1;
|
|
8194
|
+
}
|
|
8195
|
+
} else {
|
|
8196
|
+
end = i;
|
|
8197
|
+
}
|
|
8198
|
+
}
|
|
8199
|
+
yield Escape2(pointer.slice(start));
|
|
8200
|
+
}
|
|
8201
|
+
function Set4(value, pointer, update) {
|
|
8202
|
+
if (pointer === "")
|
|
8203
|
+
throw new ValuePointerRootSetError(value, pointer, update);
|
|
8204
|
+
let [owner, next, key] = [null, value, ""];
|
|
8205
|
+
for (const component of Format(pointer)) {
|
|
8206
|
+
if (next[component] === void 0)
|
|
8207
|
+
next[component] = {};
|
|
8208
|
+
owner = next;
|
|
8209
|
+
next = next[component];
|
|
8210
|
+
key = component;
|
|
8211
|
+
}
|
|
8212
|
+
owner[key] = update;
|
|
8213
|
+
}
|
|
8214
|
+
function Delete3(value, pointer) {
|
|
8215
|
+
if (pointer === "")
|
|
8216
|
+
throw new ValuePointerRootDeleteError(value, pointer);
|
|
8217
|
+
let [owner, next, key] = [null, value, ""];
|
|
8218
|
+
for (const component of Format(pointer)) {
|
|
8219
|
+
if (next[component] === void 0 || next[component] === null)
|
|
8220
|
+
return;
|
|
8221
|
+
owner = next;
|
|
8222
|
+
next = next[component];
|
|
8223
|
+
key = component;
|
|
8224
|
+
}
|
|
8225
|
+
if (Array.isArray(owner)) {
|
|
8226
|
+
const index = parseInt(key);
|
|
8227
|
+
owner.splice(index, 1);
|
|
8228
|
+
} else {
|
|
8229
|
+
delete owner[key];
|
|
8230
|
+
}
|
|
8231
|
+
}
|
|
8232
|
+
function Has3(value, pointer) {
|
|
8233
|
+
if (pointer === "")
|
|
8234
|
+
return true;
|
|
8235
|
+
let [owner, next, key] = [null, value, ""];
|
|
8236
|
+
for (const component of Format(pointer)) {
|
|
8237
|
+
if (next[component] === void 0)
|
|
8238
|
+
return false;
|
|
8239
|
+
owner = next;
|
|
8240
|
+
next = next[component];
|
|
8241
|
+
key = component;
|
|
8242
|
+
}
|
|
8243
|
+
return Object.getOwnPropertyNames(owner).includes(key);
|
|
8244
|
+
}
|
|
8245
|
+
function Get3(value, pointer) {
|
|
8246
|
+
if (pointer === "")
|
|
8247
|
+
return value;
|
|
8248
|
+
let current = value;
|
|
8249
|
+
for (const component of Format(pointer)) {
|
|
8250
|
+
if (current[component] === void 0)
|
|
8251
|
+
return void 0;
|
|
8252
|
+
current = current[component];
|
|
8253
|
+
}
|
|
8254
|
+
return current;
|
|
8255
|
+
}
|
|
8256
|
+
|
|
8257
|
+
// ../../node_modules/@sinclair/typebox/build/esm/value/equal/equal.mjs
|
|
8258
|
+
function ObjectType3(left, right) {
|
|
8259
|
+
if (!IsObject2(right))
|
|
8260
|
+
return false;
|
|
8261
|
+
const leftKeys = [...Object.keys(left), ...Object.getOwnPropertySymbols(left)];
|
|
8262
|
+
const rightKeys = [...Object.keys(right), ...Object.getOwnPropertySymbols(right)];
|
|
8263
|
+
if (leftKeys.length !== rightKeys.length)
|
|
8264
|
+
return false;
|
|
8265
|
+
return leftKeys.every((key) => Equal(left[key], right[key]));
|
|
8266
|
+
}
|
|
8267
|
+
function DateType3(left, right) {
|
|
8268
|
+
return IsDate2(right) && left.getTime() === right.getTime();
|
|
8269
|
+
}
|
|
8270
|
+
function ArrayType3(left, right) {
|
|
8271
|
+
if (!IsArray2(right) || left.length !== right.length)
|
|
8272
|
+
return false;
|
|
8273
|
+
return left.every((value, index) => Equal(value, right[index]));
|
|
8274
|
+
}
|
|
8275
|
+
function TypedArrayType(left, right) {
|
|
8276
|
+
if (!IsTypedArray(right) || left.length !== right.length || Object.getPrototypeOf(left).constructor.name !== Object.getPrototypeOf(right).constructor.name)
|
|
8277
|
+
return false;
|
|
8278
|
+
return left.every((value, index) => Equal(value, right[index]));
|
|
8279
|
+
}
|
|
8280
|
+
function ValueType(left, right) {
|
|
8281
|
+
return left === right;
|
|
8282
|
+
}
|
|
8283
|
+
function Equal(left, right) {
|
|
8284
|
+
if (IsDate2(left))
|
|
8285
|
+
return DateType3(left, right);
|
|
8286
|
+
if (IsTypedArray(left))
|
|
8287
|
+
return TypedArrayType(left, right);
|
|
8288
|
+
if (IsArray2(left))
|
|
8289
|
+
return ArrayType3(left, right);
|
|
8290
|
+
if (IsObject2(left))
|
|
8291
|
+
return ObjectType3(left, right);
|
|
8292
|
+
if (IsValueType(left))
|
|
8293
|
+
return ValueType(left, right);
|
|
8294
|
+
throw new Error("ValueEquals: Unable to compare value");
|
|
8295
|
+
}
|
|
8296
|
+
|
|
8297
|
+
// ../../node_modules/@sinclair/typebox/build/esm/value/delta/delta.mjs
|
|
8298
|
+
var Insert = Object2({
|
|
8299
|
+
type: Literal("insert"),
|
|
8300
|
+
path: String2(),
|
|
8301
|
+
value: Unknown()
|
|
8302
|
+
});
|
|
8303
|
+
var Update = Object2({
|
|
8304
|
+
type: Literal("update"),
|
|
8305
|
+
path: String2(),
|
|
8306
|
+
value: Unknown()
|
|
8307
|
+
});
|
|
8308
|
+
var Delete4 = Object2({
|
|
8309
|
+
type: Literal("delete"),
|
|
8310
|
+
path: String2()
|
|
8311
|
+
});
|
|
8312
|
+
var Edit = Union([Insert, Update, Delete4]);
|
|
8313
|
+
var ValueDiffError = class extends TypeBoxError {
|
|
8314
|
+
constructor(value, message) {
|
|
8315
|
+
super(message);
|
|
8316
|
+
this.value = value;
|
|
8317
|
+
}
|
|
8318
|
+
};
|
|
8319
|
+
function CreateUpdate(path2, value) {
|
|
8320
|
+
return { type: "update", path: path2, value };
|
|
8321
|
+
}
|
|
8322
|
+
function CreateInsert(path2, value) {
|
|
8323
|
+
return { type: "insert", path: path2, value };
|
|
8324
|
+
}
|
|
8325
|
+
function CreateDelete(path2) {
|
|
8326
|
+
return { type: "delete", path: path2 };
|
|
8327
|
+
}
|
|
8328
|
+
function AssertDiffable(value) {
|
|
8329
|
+
if (globalThis.Object.getOwnPropertySymbols(value).length > 0)
|
|
8330
|
+
throw new ValueDiffError(value, "Cannot diff objects with symbols");
|
|
8331
|
+
}
|
|
8332
|
+
function* ObjectType4(path2, current, next) {
|
|
8333
|
+
AssertDiffable(current);
|
|
8334
|
+
AssertDiffable(next);
|
|
8335
|
+
if (!IsStandardObject(next))
|
|
8336
|
+
return yield CreateUpdate(path2, next);
|
|
8337
|
+
const currentKeys = globalThis.Object.getOwnPropertyNames(current);
|
|
8338
|
+
const nextKeys = globalThis.Object.getOwnPropertyNames(next);
|
|
8339
|
+
for (const key of nextKeys) {
|
|
8340
|
+
if (HasPropertyKey2(current, key))
|
|
8341
|
+
continue;
|
|
8342
|
+
yield CreateInsert(`${path2}/${key}`, next[key]);
|
|
8343
|
+
}
|
|
8344
|
+
for (const key of currentKeys) {
|
|
8345
|
+
if (!HasPropertyKey2(next, key))
|
|
8346
|
+
continue;
|
|
8347
|
+
if (Equal(current, next))
|
|
8348
|
+
continue;
|
|
8349
|
+
yield* Visit15(`${path2}/${key}`, current[key], next[key]);
|
|
8350
|
+
}
|
|
8351
|
+
for (const key of currentKeys) {
|
|
8352
|
+
if (HasPropertyKey2(next, key))
|
|
8353
|
+
continue;
|
|
8354
|
+
yield CreateDelete(`${path2}/${key}`);
|
|
8355
|
+
}
|
|
8356
|
+
}
|
|
8357
|
+
function* ArrayType4(path2, current, next) {
|
|
8358
|
+
if (!IsArray2(next))
|
|
8359
|
+
return yield CreateUpdate(path2, next);
|
|
8360
|
+
for (let i = 0; i < Math.min(current.length, next.length); i++) {
|
|
8361
|
+
yield* Visit15(`${path2}/${i}`, current[i], next[i]);
|
|
8362
|
+
}
|
|
8363
|
+
for (let i = 0; i < next.length; i++) {
|
|
8364
|
+
if (i < current.length)
|
|
8365
|
+
continue;
|
|
8366
|
+
yield CreateInsert(`${path2}/${i}`, next[i]);
|
|
8367
|
+
}
|
|
8368
|
+
for (let i = current.length - 1; i >= 0; i--) {
|
|
8369
|
+
if (i < next.length)
|
|
8370
|
+
continue;
|
|
8371
|
+
yield CreateDelete(`${path2}/${i}`);
|
|
8372
|
+
}
|
|
8373
|
+
}
|
|
8374
|
+
function* TypedArrayType2(path2, current, next) {
|
|
8375
|
+
if (!IsTypedArray(next) || current.length !== next.length || globalThis.Object.getPrototypeOf(current).constructor.name !== globalThis.Object.getPrototypeOf(next).constructor.name)
|
|
8376
|
+
return yield CreateUpdate(path2, next);
|
|
8377
|
+
for (let i = 0; i < Math.min(current.length, next.length); i++) {
|
|
8378
|
+
yield* Visit15(`${path2}/${i}`, current[i], next[i]);
|
|
8379
|
+
}
|
|
8380
|
+
}
|
|
8381
|
+
function* ValueType2(path2, current, next) {
|
|
8382
|
+
if (current === next)
|
|
8383
|
+
return;
|
|
8384
|
+
yield CreateUpdate(path2, next);
|
|
8385
|
+
}
|
|
8386
|
+
function* Visit15(path2, current, next) {
|
|
8387
|
+
if (IsStandardObject(current))
|
|
8388
|
+
return yield* ObjectType4(path2, current, next);
|
|
8389
|
+
if (IsArray2(current))
|
|
8390
|
+
return yield* ArrayType4(path2, current, next);
|
|
8391
|
+
if (IsTypedArray(current))
|
|
8392
|
+
return yield* TypedArrayType2(path2, current, next);
|
|
8393
|
+
if (IsValueType(current))
|
|
8394
|
+
return yield* ValueType2(path2, current, next);
|
|
8395
|
+
throw new ValueDiffError(current, "Unable to diff value");
|
|
8396
|
+
}
|
|
8397
|
+
function Diff(current, next) {
|
|
8398
|
+
return [...Visit15("", current, next)];
|
|
8399
|
+
}
|
|
8400
|
+
function IsRootUpdate(edits) {
|
|
8401
|
+
return edits.length > 0 && edits[0].path === "" && edits[0].type === "update";
|
|
8402
|
+
}
|
|
8403
|
+
function IsIdentity(edits) {
|
|
8404
|
+
return edits.length === 0;
|
|
8405
|
+
}
|
|
8406
|
+
function Patch(current, edits) {
|
|
8407
|
+
if (IsRootUpdate(edits)) {
|
|
8408
|
+
return Clone2(edits[0].value);
|
|
8409
|
+
}
|
|
8410
|
+
if (IsIdentity(edits)) {
|
|
8411
|
+
return Clone2(current);
|
|
8412
|
+
}
|
|
8413
|
+
const clone = Clone2(current);
|
|
8414
|
+
for (const edit of edits) {
|
|
8415
|
+
switch (edit.type) {
|
|
8416
|
+
case "insert": {
|
|
8417
|
+
pointer_exports.Set(clone, edit.path, edit.value);
|
|
8418
|
+
break;
|
|
8419
|
+
}
|
|
8420
|
+
case "update": {
|
|
8421
|
+
pointer_exports.Set(clone, edit.path, edit.value);
|
|
8422
|
+
break;
|
|
8423
|
+
}
|
|
8424
|
+
case "delete": {
|
|
8425
|
+
pointer_exports.Delete(clone, edit.path);
|
|
8426
|
+
break;
|
|
8427
|
+
}
|
|
8428
|
+
}
|
|
8429
|
+
}
|
|
8430
|
+
return clone;
|
|
8431
|
+
}
|
|
8432
|
+
|
|
8433
|
+
// ../../node_modules/@sinclair/typebox/build/esm/value/encode/encode.mjs
|
|
8434
|
+
function Encode(...args) {
|
|
8435
|
+
const [schema, references, value] = args.length === 3 ? [args[0], args[1], args[2]] : [args[0], [], args[1]];
|
|
8436
|
+
const encoded = HasTransform(schema, references) ? TransformEncode(schema, references, value) : value;
|
|
8437
|
+
if (!Check(schema, references, encoded))
|
|
8438
|
+
throw new TransformEncodeCheckError(schema, encoded, Errors(schema, references, encoded).First());
|
|
8439
|
+
return encoded;
|
|
8440
|
+
}
|
|
8441
|
+
|
|
8442
|
+
// ../../node_modules/@sinclair/typebox/build/esm/value/mutate/mutate.mjs
|
|
8443
|
+
function IsStandardObject2(value) {
|
|
8444
|
+
return IsObject2(value) && !IsArray2(value);
|
|
8445
|
+
}
|
|
8446
|
+
var ValueMutateError = class extends TypeBoxError {
|
|
8447
|
+
constructor(message) {
|
|
8448
|
+
super(message);
|
|
8449
|
+
}
|
|
8450
|
+
};
|
|
8451
|
+
function ObjectType5(root, path2, current, next) {
|
|
8452
|
+
if (!IsStandardObject2(current)) {
|
|
8453
|
+
pointer_exports.Set(root, path2, Clone2(next));
|
|
8454
|
+
} else {
|
|
8455
|
+
const currentKeys = Object.getOwnPropertyNames(current);
|
|
8456
|
+
const nextKeys = Object.getOwnPropertyNames(next);
|
|
8457
|
+
for (const currentKey of currentKeys) {
|
|
8458
|
+
if (!nextKeys.includes(currentKey)) {
|
|
8459
|
+
delete current[currentKey];
|
|
8460
|
+
}
|
|
8461
|
+
}
|
|
8462
|
+
for (const nextKey of nextKeys) {
|
|
8463
|
+
if (!currentKeys.includes(nextKey)) {
|
|
8464
|
+
current[nextKey] = null;
|
|
8465
|
+
}
|
|
8466
|
+
}
|
|
8467
|
+
for (const nextKey of nextKeys) {
|
|
8468
|
+
Visit16(root, `${path2}/${nextKey}`, current[nextKey], next[nextKey]);
|
|
8469
|
+
}
|
|
8470
|
+
}
|
|
8471
|
+
}
|
|
8472
|
+
function ArrayType5(root, path2, current, next) {
|
|
8473
|
+
if (!IsArray2(current)) {
|
|
8474
|
+
pointer_exports.Set(root, path2, Clone2(next));
|
|
8475
|
+
} else {
|
|
8476
|
+
for (let index = 0; index < next.length; index++) {
|
|
8477
|
+
Visit16(root, `${path2}/${index}`, current[index], next[index]);
|
|
8478
|
+
}
|
|
8479
|
+
current.splice(next.length);
|
|
8480
|
+
}
|
|
8481
|
+
}
|
|
8482
|
+
function TypedArrayType3(root, path2, current, next) {
|
|
8483
|
+
if (IsTypedArray(current) && current.length === next.length) {
|
|
8484
|
+
for (let i = 0; i < current.length; i++) {
|
|
8485
|
+
current[i] = next[i];
|
|
8486
|
+
}
|
|
8487
|
+
} else {
|
|
8488
|
+
pointer_exports.Set(root, path2, Clone2(next));
|
|
8489
|
+
}
|
|
8490
|
+
}
|
|
8491
|
+
function ValueType3(root, path2, current, next) {
|
|
8492
|
+
if (current === next)
|
|
8493
|
+
return;
|
|
8494
|
+
pointer_exports.Set(root, path2, next);
|
|
8495
|
+
}
|
|
8496
|
+
function Visit16(root, path2, current, next) {
|
|
8497
|
+
if (IsArray2(next))
|
|
8498
|
+
return ArrayType5(root, path2, current, next);
|
|
8499
|
+
if (IsTypedArray(next))
|
|
8500
|
+
return TypedArrayType3(root, path2, current, next);
|
|
8501
|
+
if (IsStandardObject2(next))
|
|
8502
|
+
return ObjectType5(root, path2, current, next);
|
|
8503
|
+
if (IsValueType(next))
|
|
8504
|
+
return ValueType3(root, path2, current, next);
|
|
8505
|
+
}
|
|
8506
|
+
function IsNonMutableValue(value) {
|
|
8507
|
+
return IsTypedArray(value) || IsValueType(value);
|
|
8508
|
+
}
|
|
8509
|
+
function IsMismatchedValue(current, next) {
|
|
8510
|
+
return IsStandardObject2(current) && IsArray2(next) || IsArray2(current) && IsStandardObject2(next);
|
|
8511
|
+
}
|
|
8512
|
+
function Mutate(current, next) {
|
|
8513
|
+
if (IsNonMutableValue(current) || IsNonMutableValue(next))
|
|
8514
|
+
throw new ValueMutateError("Only object and array types can be mutated at the root level");
|
|
8515
|
+
if (IsMismatchedValue(current, next))
|
|
8516
|
+
throw new ValueMutateError("Cannot assign due type mismatch of assignable values");
|
|
8517
|
+
Visit16(current, "", current, next);
|
|
8518
|
+
}
|
|
8519
|
+
|
|
8520
|
+
// ../../node_modules/@sinclair/typebox/build/esm/value/parse/parse.mjs
|
|
8521
|
+
var ParseError = class extends TypeBoxError {
|
|
8522
|
+
constructor(message) {
|
|
8523
|
+
super(message);
|
|
8524
|
+
}
|
|
8525
|
+
};
|
|
8526
|
+
var ParseRegistry;
|
|
8527
|
+
(function(ParseRegistry2) {
|
|
8528
|
+
const registry = /* @__PURE__ */ new Map([
|
|
8529
|
+
["Assert", (type, references, value) => {
|
|
8530
|
+
Assert(type, references, value);
|
|
8531
|
+
return value;
|
|
8532
|
+
}],
|
|
8533
|
+
["Cast", (type, references, value) => Cast(type, references, value)],
|
|
8534
|
+
["Clean", (type, references, value) => Clean(type, references, value)],
|
|
8535
|
+
["Clone", (_type, _references, value) => Clone2(value)],
|
|
8536
|
+
["Convert", (type, references, value) => Convert(type, references, value)],
|
|
8537
|
+
["Decode", (type, references, value) => HasTransform(type, references) ? TransformDecode(type, references, value) : value],
|
|
8538
|
+
["Default", (type, references, value) => Default5(type, references, value)],
|
|
8539
|
+
["Encode", (type, references, value) => HasTransform(type, references) ? TransformEncode(type, references, value) : value]
|
|
8540
|
+
]);
|
|
8541
|
+
function Delete5(key) {
|
|
8542
|
+
registry.delete(key);
|
|
8543
|
+
}
|
|
8544
|
+
ParseRegistry2.Delete = Delete5;
|
|
8545
|
+
function Set5(key, callback) {
|
|
8546
|
+
registry.set(key, callback);
|
|
8547
|
+
}
|
|
8548
|
+
ParseRegistry2.Set = Set5;
|
|
8549
|
+
function Get4(key) {
|
|
8550
|
+
return registry.get(key);
|
|
8551
|
+
}
|
|
8552
|
+
ParseRegistry2.Get = Get4;
|
|
8553
|
+
})(ParseRegistry || (ParseRegistry = {}));
|
|
8554
|
+
var ParseDefault = [
|
|
8555
|
+
"Clone",
|
|
8556
|
+
"Clean",
|
|
8557
|
+
"Default",
|
|
8558
|
+
"Convert",
|
|
8559
|
+
"Assert",
|
|
8560
|
+
"Decode"
|
|
8561
|
+
];
|
|
8562
|
+
function ParseValue(operations, type, references, value) {
|
|
8563
|
+
return operations.reduce((value2, operationKey) => {
|
|
8564
|
+
const operation = ParseRegistry.Get(operationKey);
|
|
8565
|
+
if (IsUndefined2(operation))
|
|
8566
|
+
throw new ParseError(`Unable to find Parse operation '${operationKey}'`);
|
|
8567
|
+
return operation(type, references, value2);
|
|
8568
|
+
}, value);
|
|
8569
|
+
}
|
|
8570
|
+
function Parse(...args) {
|
|
8571
|
+
const [operations, schema, references, value] = args.length === 4 ? [args[0], args[1], args[2], args[3]] : args.length === 3 ? IsArray2(args[0]) ? [args[0], args[1], [], args[2]] : [ParseDefault, args[0], args[1], args[2]] : args.length === 2 ? [ParseDefault, args[0], [], args[1]] : (() => {
|
|
8572
|
+
throw new ParseError("Invalid Arguments");
|
|
8573
|
+
})();
|
|
8574
|
+
return ParseValue(operations, schema, references, value);
|
|
8575
|
+
}
|
|
8576
|
+
|
|
8577
|
+
// ../../node_modules/@sinclair/typebox/build/esm/value/value/value.mjs
|
|
8578
|
+
var value_exports2 = {};
|
|
8579
|
+
__export(value_exports2, {
|
|
8580
|
+
Assert: () => Assert,
|
|
8581
|
+
Cast: () => Cast,
|
|
8582
|
+
Check: () => Check,
|
|
8583
|
+
Clean: () => Clean,
|
|
8584
|
+
Clone: () => Clone2,
|
|
8585
|
+
Convert: () => Convert,
|
|
8586
|
+
Create: () => Create2,
|
|
8587
|
+
Decode: () => Decode,
|
|
8588
|
+
Default: () => Default5,
|
|
8589
|
+
Diff: () => Diff,
|
|
8590
|
+
Edit: () => Edit,
|
|
8591
|
+
Encode: () => Encode,
|
|
8592
|
+
Equal: () => Equal,
|
|
8593
|
+
Errors: () => Errors,
|
|
8594
|
+
Hash: () => Hash,
|
|
8595
|
+
Mutate: () => Mutate,
|
|
8596
|
+
Parse: () => Parse,
|
|
8597
|
+
Patch: () => Patch,
|
|
8598
|
+
ValueErrorIterator: () => ValueErrorIterator
|
|
8599
|
+
});
|
|
8600
|
+
|
|
8601
|
+
// ../../packages/ai/src/utils/validation.ts
|
|
8602
|
+
function validateToolArguments(tool, toolCall) {
|
|
8603
|
+
const args = toolCall.arguments ?? {};
|
|
8604
|
+
if (value_exports2.Check(tool.parameters, args)) {
|
|
8605
|
+
return args;
|
|
8606
|
+
}
|
|
8607
|
+
const firstError = Array.from(value_exports2.Errors(tool.parameters, args))[0];
|
|
8608
|
+
if (!firstError) {
|
|
8609
|
+
throw new Error(`Invalid arguments for tool "${tool.name}"`);
|
|
8610
|
+
}
|
|
8611
|
+
const path2 = firstError.path || "/";
|
|
8612
|
+
throw new Error(`Invalid arguments for tool "${tool.name}" at ${path2}: ${firstError.message}`);
|
|
8613
|
+
}
|
|
8614
|
+
|
|
8615
|
+
// ../../packages/ai/src/index.ts
|
|
8616
|
+
registerApiProvider({
|
|
8617
|
+
api: "openai-completions",
|
|
8618
|
+
stream: streamOpenAICompletions,
|
|
8619
|
+
streamSimple: streamSimpleOpenAICompletions
|
|
8620
|
+
});
|
|
8621
|
+
registerApiProvider({
|
|
8622
|
+
api: "anthropic-messages",
|
|
8623
|
+
stream: streamAnthropic,
|
|
8624
|
+
streamSimple: streamSimpleAnthropic
|
|
8625
|
+
});
|
|
8626
|
+
|
|
8627
|
+
// ../../packages/agent-core/src/agent-loop.ts
|
|
8628
|
+
function agentLoop(prompts, context, config, signal, streamFn) {
|
|
8629
|
+
const stream = createAgentStream();
|
|
8630
|
+
(async () => {
|
|
8631
|
+
try {
|
|
8632
|
+
await config.hooks?.beforeAgentStart?.();
|
|
8633
|
+
} catch (e) {
|
|
8634
|
+
console.warn("[AgentLoop] beforeAgentStart hook failed:", e);
|
|
8635
|
+
}
|
|
8636
|
+
const newMessages = [...prompts];
|
|
8637
|
+
const currentContext = {
|
|
8638
|
+
...context,
|
|
8639
|
+
messages: [...context.messages, ...prompts]
|
|
8640
|
+
};
|
|
8641
|
+
stream.push({ type: "agent_start" });
|
|
8642
|
+
stream.push({ type: "turn_start" });
|
|
8643
|
+
for (const prompt of prompts) {
|
|
8644
|
+
stream.push({ type: "message_start", message: prompt });
|
|
8645
|
+
stream.push({ type: "message_end", message: prompt });
|
|
8646
|
+
}
|
|
8647
|
+
try {
|
|
8648
|
+
await runLoop(currentContext, newMessages, config, signal, stream, streamFn);
|
|
8649
|
+
} catch (error) {
|
|
8650
|
+
config.hooks?.onError?.(error, { phase: "runLoop" });
|
|
8651
|
+
throw error;
|
|
8652
|
+
}
|
|
8653
|
+
try {
|
|
8654
|
+
await config.hooks?.afterAgentEnd?.(newMessages);
|
|
8655
|
+
} catch (e) {
|
|
8656
|
+
console.warn("[AgentLoop] afterAgentEnd hook failed:", e);
|
|
8657
|
+
}
|
|
8658
|
+
})();
|
|
8659
|
+
return stream;
|
|
8660
|
+
}
|
|
8661
|
+
function agentLoopContinue(context, config, signal, streamFn) {
|
|
8662
|
+
if (context.messages.length === 0) {
|
|
8663
|
+
throw new Error("Cannot continue: no messages in context");
|
|
8664
|
+
}
|
|
8665
|
+
if (context.messages[context.messages.length - 1].role === "assistant") {
|
|
8666
|
+
throw new Error("Cannot continue from message role: assistant");
|
|
8667
|
+
}
|
|
8668
|
+
const stream = createAgentStream();
|
|
8669
|
+
(async () => {
|
|
8670
|
+
try {
|
|
8671
|
+
await config.hooks?.beforeAgentStart?.();
|
|
8672
|
+
} catch (e) {
|
|
8673
|
+
console.warn("[AgentLoop] beforeAgentStart hook failed:", e);
|
|
8674
|
+
}
|
|
8675
|
+
const newMessages = [];
|
|
8676
|
+
const currentContext = { ...context };
|
|
8677
|
+
stream.push({ type: "agent_start" });
|
|
8678
|
+
stream.push({ type: "turn_start" });
|
|
8679
|
+
try {
|
|
8680
|
+
await runLoop(currentContext, newMessages, config, signal, stream, streamFn);
|
|
5029
8681
|
} catch (error) {
|
|
5030
8682
|
config.hooks?.onError?.(error, { phase: "runLoop" });
|
|
5031
8683
|
throw error;
|
|
@@ -5322,6 +8974,16 @@ function skipToolCall(toolCall, stream) {
|
|
|
5322
8974
|
function defaultConvertToLlm(messages) {
|
|
5323
8975
|
return messages.filter((m) => m.role === "user" || m.role === "assistant" || m.role === "toolResult");
|
|
5324
8976
|
}
|
|
8977
|
+
function isAgentMessage(value) {
|
|
8978
|
+
return !!value && typeof value === "object" && "role" in value;
|
|
8979
|
+
}
|
|
8980
|
+
function isUserContentBlock(value) {
|
|
8981
|
+
if (!value || typeof value !== "object" || !("type" in value)) {
|
|
8982
|
+
return false;
|
|
8983
|
+
}
|
|
8984
|
+
const type = value.type;
|
|
8985
|
+
return type === "text" || type === "image" || type === "audio" || type === "video" || type === "fileRef";
|
|
8986
|
+
}
|
|
5325
8987
|
var Agent = class {
|
|
5326
8988
|
_state;
|
|
5327
8989
|
listeners = /* @__PURE__ */ new Set();
|
|
@@ -5522,7 +9184,13 @@ var Agent = class {
|
|
|
5522
9184
|
if (!model) throw new Error("No model configured");
|
|
5523
9185
|
let msgs;
|
|
5524
9186
|
if (Array.isArray(input)) {
|
|
5525
|
-
|
|
9187
|
+
if (input.length > 0 && input.every((item) => isUserContentBlock(item))) {
|
|
9188
|
+
msgs = [{ role: "user", content: input, timestamp: Date.now() }];
|
|
9189
|
+
} else if (input.every((item) => isAgentMessage(item))) {
|
|
9190
|
+
msgs = input;
|
|
9191
|
+
} else {
|
|
9192
|
+
throw new Error("Invalid prompt array: expected user content blocks or agent messages.");
|
|
9193
|
+
}
|
|
5526
9194
|
} else if (typeof input === "string") {
|
|
5527
9195
|
const content = [{ type: "text", text: input }];
|
|
5528
9196
|
if (images && images.length > 0) {
|
|
@@ -5700,16 +9368,29 @@ var Agent = class {
|
|
|
5700
9368
|
|
|
5701
9369
|
// ../../packages/tools-fs/src/path-utils.ts
|
|
5702
9370
|
function isInAllowlist(path2, allowlistedDirs) {
|
|
5703
|
-
const normalized = path2
|
|
9371
|
+
const normalized = normalizeForComparison(path2);
|
|
5704
9372
|
for (const dir of allowlistedDirs) {
|
|
5705
|
-
const normalizedDir = dir
|
|
5706
|
-
const dirWithSlash = normalizedDir
|
|
9373
|
+
const normalizedDir = normalizeForComparison(dir);
|
|
9374
|
+
const dirWithSlash = withTrailingSep(normalizedDir);
|
|
5707
9375
|
if (normalized === normalizedDir || normalized.startsWith(dirWithSlash)) {
|
|
5708
9376
|
return true;
|
|
5709
9377
|
}
|
|
5710
9378
|
}
|
|
5711
9379
|
return false;
|
|
5712
9380
|
}
|
|
9381
|
+
function normalizeForComparison(path2) {
|
|
9382
|
+
const normalized = path2.replace(/\\/g, "/").replace(/\/+/g, "/");
|
|
9383
|
+
if (normalized === "/") return normalized;
|
|
9384
|
+
return normalized.replace(/\/+$/, "");
|
|
9385
|
+
}
|
|
9386
|
+
function withTrailingSep(path2) {
|
|
9387
|
+
return path2.endsWith("/") ? path2 : `${path2}/`;
|
|
9388
|
+
}
|
|
9389
|
+
function isWithinRoot(path2, root) {
|
|
9390
|
+
const normalizedPath = normalizeForComparison(path2);
|
|
9391
|
+
const normalizedRoot = normalizeForComparison(root);
|
|
9392
|
+
return normalizedPath === normalizedRoot || normalizedPath.startsWith(withTrailingSep(normalizedRoot));
|
|
9393
|
+
}
|
|
5713
9394
|
function resolveInSandbox(filePath, sandboxRoot, options) {
|
|
5714
9395
|
const fs2 = getFileSystem();
|
|
5715
9396
|
const allowlistedDirs = options?.allowlistedDirs ?? [];
|
|
@@ -5722,13 +9403,13 @@ function resolveInSandbox(filePath, sandboxRoot, options) {
|
|
|
5722
9403
|
if (isInAllowlist(normalized, allowlistedDirs)) {
|
|
5723
9404
|
return normalized;
|
|
5724
9405
|
}
|
|
5725
|
-
if (!normalized
|
|
9406
|
+
if (!isWithinRoot(normalized, sandboxRoot)) {
|
|
5726
9407
|
throw new Error(`Absolute path outside sandbox: ${filePath}`);
|
|
5727
9408
|
}
|
|
5728
9409
|
return normalized;
|
|
5729
9410
|
}
|
|
5730
9411
|
const resolved = fs2.resolve(sandboxRoot, cleaned);
|
|
5731
|
-
if (!resolved
|
|
9412
|
+
if (!isWithinRoot(resolved, sandboxRoot) && !isInAllowlist(resolved, allowlistedDirs)) {
|
|
5732
9413
|
throw new Error(`Path escapes sandbox: ${filePath}`);
|
|
5733
9414
|
}
|
|
5734
9415
|
return resolved;
|