@effect-gql/core 1.4.4 → 1.4.5
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/builder/index.cjs +148 -3
- package/builder/index.cjs.map +1 -1
- package/builder/index.js +148 -3
- package/builder/index.js.map +1 -1
- package/index.cjs +148 -3
- package/index.cjs.map +1 -1
- package/index.js +148 -3
- package/index.js.map +1 -1
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -441,6 +441,12 @@ function handleTransformationAST(ast, ctx) {
|
|
|
441
441
|
const result = ctx.typeRegistry.get(typeName);
|
|
442
442
|
if (result) return result;
|
|
443
443
|
}
|
|
444
|
+
for (const [regTypeName, typeReg] of ctx.types) {
|
|
445
|
+
if (typeReg.schema.ast === memberAst) {
|
|
446
|
+
const result = ctx.typeRegistry.get(regTypeName);
|
|
447
|
+
if (result) return result;
|
|
448
|
+
}
|
|
449
|
+
}
|
|
444
450
|
if (memberAst._tag === "Transformation") {
|
|
445
451
|
const innerToAst = memberAst.to;
|
|
446
452
|
const transformedTypeName = ctx.astToTypeName?.get(innerToAst);
|
|
@@ -448,6 +454,41 @@ function handleTransformationAST(ast, ctx) {
|
|
|
448
454
|
const result = ctx.typeRegistry.get(transformedTypeName);
|
|
449
455
|
if (result) return result;
|
|
450
456
|
}
|
|
457
|
+
for (const [regTypeName, typeReg] of ctx.types) {
|
|
458
|
+
if (typeReg.schema.ast === innerToAst) {
|
|
459
|
+
const result = ctx.typeRegistry.get(regTypeName);
|
|
460
|
+
if (result) return result;
|
|
461
|
+
}
|
|
462
|
+
}
|
|
463
|
+
}
|
|
464
|
+
if (memberAst._tag === "TypeLiteral") {
|
|
465
|
+
const valueField = memberAst.propertySignatures?.find(
|
|
466
|
+
(p) => String(p.name) === "value"
|
|
467
|
+
);
|
|
468
|
+
if (valueField) {
|
|
469
|
+
const valueType = valueField.type;
|
|
470
|
+
const valueTypeName = ctx.astToTypeName?.get(valueType);
|
|
471
|
+
if (valueTypeName) {
|
|
472
|
+
const result = ctx.typeRegistry.get(valueTypeName);
|
|
473
|
+
if (result) return result;
|
|
474
|
+
}
|
|
475
|
+
for (const [regTypeName, typeReg] of ctx.types) {
|
|
476
|
+
if (typeReg.schema.ast === valueType) {
|
|
477
|
+
const result = ctx.typeRegistry.get(regTypeName);
|
|
478
|
+
if (result) return result;
|
|
479
|
+
}
|
|
480
|
+
let regAst = typeReg.schema.ast;
|
|
481
|
+
while (regAst._tag === "Transformation") {
|
|
482
|
+
regAst = regAst.to;
|
|
483
|
+
if (regAst === valueType) {
|
|
484
|
+
const result = ctx.typeRegistry.get(regTypeName);
|
|
485
|
+
if (result) return result;
|
|
486
|
+
}
|
|
487
|
+
}
|
|
488
|
+
}
|
|
489
|
+
const innerResult = toGraphQLTypeWithRegistry(S2.make(valueType), ctx);
|
|
490
|
+
if (innerResult) return innerResult;
|
|
491
|
+
}
|
|
451
492
|
}
|
|
452
493
|
}
|
|
453
494
|
}
|
|
@@ -484,6 +525,12 @@ function handleUnionAST(ast, ctx) {
|
|
|
484
525
|
const result = ctx.typeRegistry.get(typeName);
|
|
485
526
|
if (result) return result;
|
|
486
527
|
}
|
|
528
|
+
for (const [regTypeName, typeReg] of ctx.types) {
|
|
529
|
+
if (typeReg.schema.ast === memberAst) {
|
|
530
|
+
const result = ctx.typeRegistry.get(regTypeName);
|
|
531
|
+
if (result) return result;
|
|
532
|
+
}
|
|
533
|
+
}
|
|
487
534
|
if (memberAst._tag === "Transformation") {
|
|
488
535
|
const toAst = memberAst.to;
|
|
489
536
|
const transformedTypeName = ctx.astToTypeName?.get(toAst);
|
|
@@ -491,13 +538,39 @@ function handleUnionAST(ast, ctx) {
|
|
|
491
538
|
const result = ctx.typeRegistry.get(transformedTypeName);
|
|
492
539
|
if (result) return result;
|
|
493
540
|
}
|
|
541
|
+
for (const [regTypeName, typeReg] of ctx.types) {
|
|
542
|
+
if (typeReg.schema.ast === toAst) {
|
|
543
|
+
const result = ctx.typeRegistry.get(regTypeName);
|
|
544
|
+
if (result) return result;
|
|
545
|
+
}
|
|
546
|
+
}
|
|
494
547
|
}
|
|
495
548
|
if (memberAst._tag === "TypeLiteral") {
|
|
496
549
|
const valueField = memberAst.propertySignatures?.find(
|
|
497
550
|
(p) => String(p.name) === "value"
|
|
498
551
|
);
|
|
499
552
|
if (valueField) {
|
|
500
|
-
const
|
|
553
|
+
const valueType = valueField.type;
|
|
554
|
+
const valueTypeName = ctx.astToTypeName?.get(valueType);
|
|
555
|
+
if (valueTypeName) {
|
|
556
|
+
const result = ctx.typeRegistry.get(valueTypeName);
|
|
557
|
+
if (result) return result;
|
|
558
|
+
}
|
|
559
|
+
for (const [regTypeName, typeReg] of ctx.types) {
|
|
560
|
+
if (typeReg.schema.ast === valueType) {
|
|
561
|
+
const result = ctx.typeRegistry.get(regTypeName);
|
|
562
|
+
if (result) return result;
|
|
563
|
+
}
|
|
564
|
+
let regAst = typeReg.schema.ast;
|
|
565
|
+
while (regAst._tag === "Transformation") {
|
|
566
|
+
regAst = regAst.to;
|
|
567
|
+
if (regAst === valueType) {
|
|
568
|
+
const result = ctx.typeRegistry.get(regTypeName);
|
|
569
|
+
if (result) return result;
|
|
570
|
+
}
|
|
571
|
+
}
|
|
572
|
+
}
|
|
573
|
+
const innerResult = toGraphQLTypeWithRegistry(S2.make(valueType), ctx);
|
|
501
574
|
if (innerResult) {
|
|
502
575
|
return innerResult;
|
|
503
576
|
}
|
|
@@ -676,6 +749,12 @@ function toGraphQLInputTypeWithRegistry(schema, enumRegistry, inputRegistry, inp
|
|
|
676
749
|
const result = inputRegistry.get(inputName);
|
|
677
750
|
if (result) return result;
|
|
678
751
|
}
|
|
752
|
+
for (const [regInputName, inputReg] of inputs) {
|
|
753
|
+
if (inputReg.schema.ast === memberAst) {
|
|
754
|
+
const result = inputRegistry.get(regInputName);
|
|
755
|
+
if (result) return result;
|
|
756
|
+
}
|
|
757
|
+
}
|
|
679
758
|
if (memberAst._tag === "Transformation") {
|
|
680
759
|
const innerToAst = memberAst.to;
|
|
681
760
|
const transformedInputName = cache?.astToInputName?.get(innerToAst);
|
|
@@ -683,14 +762,44 @@ function toGraphQLInputTypeWithRegistry(schema, enumRegistry, inputRegistry, inp
|
|
|
683
762
|
const result = inputRegistry.get(transformedInputName);
|
|
684
763
|
if (result) return result;
|
|
685
764
|
}
|
|
765
|
+
for (const [regInputName, inputReg] of inputs) {
|
|
766
|
+
if (inputReg.schema.ast === innerToAst) {
|
|
767
|
+
const result = inputRegistry.get(regInputName);
|
|
768
|
+
if (result) return result;
|
|
769
|
+
}
|
|
770
|
+
}
|
|
686
771
|
}
|
|
687
772
|
if (memberAst._tag === "TypeLiteral") {
|
|
688
773
|
const valueField = memberAst.propertySignatures?.find(
|
|
689
774
|
(p) => String(p.name) === "value"
|
|
690
775
|
);
|
|
691
776
|
if (valueField) {
|
|
777
|
+
const valueType = valueField.type;
|
|
778
|
+
const valueInputName = cache?.astToInputName?.get(valueType);
|
|
779
|
+
if (valueInputName) {
|
|
780
|
+
const result = inputRegistry.get(valueInputName);
|
|
781
|
+
if (result) return result;
|
|
782
|
+
}
|
|
783
|
+
for (const [regInputName, inputReg] of inputs) {
|
|
784
|
+
if (inputReg.schema.ast === valueType) {
|
|
785
|
+
const result = inputRegistry.get(regInputName);
|
|
786
|
+
if (result) return result;
|
|
787
|
+
}
|
|
788
|
+
let regAst = inputReg.schema.ast;
|
|
789
|
+
while (regAst._tag === "Transformation") {
|
|
790
|
+
regAst = regAst.to;
|
|
791
|
+
if (regAst === valueType) {
|
|
792
|
+
const result = inputRegistry.get(regInputName);
|
|
793
|
+
if (result) return result;
|
|
794
|
+
}
|
|
795
|
+
}
|
|
796
|
+
if (regAst._tag === "Declaration" && regAst.typeParameters?.[0] === valueType) {
|
|
797
|
+
const result = inputRegistry.get(regInputName);
|
|
798
|
+
if (result) return result;
|
|
799
|
+
}
|
|
800
|
+
}
|
|
692
801
|
const innerResult = toGraphQLInputTypeWithRegistry(
|
|
693
|
-
S2.make(
|
|
802
|
+
S2.make(valueType),
|
|
694
803
|
enumRegistry,
|
|
695
804
|
inputRegistry,
|
|
696
805
|
inputs,
|
|
@@ -742,6 +851,12 @@ function toGraphQLInputTypeWithRegistry(schema, enumRegistry, inputRegistry, inp
|
|
|
742
851
|
const result = inputRegistry.get(inputName);
|
|
743
852
|
if (result) return result;
|
|
744
853
|
}
|
|
854
|
+
for (const [regInputName, inputReg] of inputs) {
|
|
855
|
+
if (inputReg.schema.ast === memberAst) {
|
|
856
|
+
const result = inputRegistry.get(regInputName);
|
|
857
|
+
if (result) return result;
|
|
858
|
+
}
|
|
859
|
+
}
|
|
745
860
|
if (memberAst._tag === "Transformation") {
|
|
746
861
|
const toAst = memberAst.to;
|
|
747
862
|
const transformedInputName = cache?.astToInputName?.get(toAst);
|
|
@@ -749,14 +864,44 @@ function toGraphQLInputTypeWithRegistry(schema, enumRegistry, inputRegistry, inp
|
|
|
749
864
|
const result = inputRegistry.get(transformedInputName);
|
|
750
865
|
if (result) return result;
|
|
751
866
|
}
|
|
867
|
+
for (const [regInputName, inputReg] of inputs) {
|
|
868
|
+
if (inputReg.schema.ast === toAst) {
|
|
869
|
+
const result = inputRegistry.get(regInputName);
|
|
870
|
+
if (result) return result;
|
|
871
|
+
}
|
|
872
|
+
}
|
|
752
873
|
}
|
|
753
874
|
if (memberAst._tag === "TypeLiteral") {
|
|
754
875
|
const valueField = memberAst.propertySignatures?.find(
|
|
755
876
|
(p) => String(p.name) === "value"
|
|
756
877
|
);
|
|
757
878
|
if (valueField) {
|
|
879
|
+
const valueType = valueField.type;
|
|
880
|
+
const valueInputName = cache?.astToInputName?.get(valueType);
|
|
881
|
+
if (valueInputName) {
|
|
882
|
+
const result = inputRegistry.get(valueInputName);
|
|
883
|
+
if (result) return result;
|
|
884
|
+
}
|
|
885
|
+
for (const [regInputName, inputReg] of inputs) {
|
|
886
|
+
if (inputReg.schema.ast === valueType) {
|
|
887
|
+
const result = inputRegistry.get(regInputName);
|
|
888
|
+
if (result) return result;
|
|
889
|
+
}
|
|
890
|
+
let regAst = inputReg.schema.ast;
|
|
891
|
+
while (regAst._tag === "Transformation") {
|
|
892
|
+
regAst = regAst.to;
|
|
893
|
+
if (regAst === valueType) {
|
|
894
|
+
const result = inputRegistry.get(regInputName);
|
|
895
|
+
if (result) return result;
|
|
896
|
+
}
|
|
897
|
+
}
|
|
898
|
+
if (regAst._tag === "Declaration" && regAst.typeParameters?.[0] === valueType) {
|
|
899
|
+
const result = inputRegistry.get(regInputName);
|
|
900
|
+
if (result) return result;
|
|
901
|
+
}
|
|
902
|
+
}
|
|
758
903
|
const innerResult = toGraphQLInputTypeWithRegistry(
|
|
759
|
-
S2.make(
|
|
904
|
+
S2.make(valueType),
|
|
760
905
|
enumRegistry,
|
|
761
906
|
inputRegistry,
|
|
762
907
|
inputs,
|