@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.cjs
CHANGED
|
@@ -466,6 +466,12 @@ function handleTransformationAST(ast, ctx) {
|
|
|
466
466
|
const result = ctx.typeRegistry.get(typeName);
|
|
467
467
|
if (result) return result;
|
|
468
468
|
}
|
|
469
|
+
for (const [regTypeName, typeReg] of ctx.types) {
|
|
470
|
+
if (typeReg.schema.ast === memberAst) {
|
|
471
|
+
const result = ctx.typeRegistry.get(regTypeName);
|
|
472
|
+
if (result) return result;
|
|
473
|
+
}
|
|
474
|
+
}
|
|
469
475
|
if (memberAst._tag === "Transformation") {
|
|
470
476
|
const innerToAst = memberAst.to;
|
|
471
477
|
const transformedTypeName = ctx.astToTypeName?.get(innerToAst);
|
|
@@ -473,6 +479,41 @@ function handleTransformationAST(ast, ctx) {
|
|
|
473
479
|
const result = ctx.typeRegistry.get(transformedTypeName);
|
|
474
480
|
if (result) return result;
|
|
475
481
|
}
|
|
482
|
+
for (const [regTypeName, typeReg] of ctx.types) {
|
|
483
|
+
if (typeReg.schema.ast === innerToAst) {
|
|
484
|
+
const result = ctx.typeRegistry.get(regTypeName);
|
|
485
|
+
if (result) return result;
|
|
486
|
+
}
|
|
487
|
+
}
|
|
488
|
+
}
|
|
489
|
+
if (memberAst._tag === "TypeLiteral") {
|
|
490
|
+
const valueField = memberAst.propertySignatures?.find(
|
|
491
|
+
(p) => String(p.name) === "value"
|
|
492
|
+
);
|
|
493
|
+
if (valueField) {
|
|
494
|
+
const valueType = valueField.type;
|
|
495
|
+
const valueTypeName = ctx.astToTypeName?.get(valueType);
|
|
496
|
+
if (valueTypeName) {
|
|
497
|
+
const result = ctx.typeRegistry.get(valueTypeName);
|
|
498
|
+
if (result) return result;
|
|
499
|
+
}
|
|
500
|
+
for (const [regTypeName, typeReg] of ctx.types) {
|
|
501
|
+
if (typeReg.schema.ast === valueType) {
|
|
502
|
+
const result = ctx.typeRegistry.get(regTypeName);
|
|
503
|
+
if (result) return result;
|
|
504
|
+
}
|
|
505
|
+
let regAst = typeReg.schema.ast;
|
|
506
|
+
while (regAst._tag === "Transformation") {
|
|
507
|
+
regAst = regAst.to;
|
|
508
|
+
if (regAst === valueType) {
|
|
509
|
+
const result = ctx.typeRegistry.get(regTypeName);
|
|
510
|
+
if (result) return result;
|
|
511
|
+
}
|
|
512
|
+
}
|
|
513
|
+
}
|
|
514
|
+
const innerResult = toGraphQLTypeWithRegistry(S2__namespace.make(valueType), ctx);
|
|
515
|
+
if (innerResult) return innerResult;
|
|
516
|
+
}
|
|
476
517
|
}
|
|
477
518
|
}
|
|
478
519
|
}
|
|
@@ -509,6 +550,12 @@ function handleUnionAST(ast, ctx) {
|
|
|
509
550
|
const result = ctx.typeRegistry.get(typeName);
|
|
510
551
|
if (result) return result;
|
|
511
552
|
}
|
|
553
|
+
for (const [regTypeName, typeReg] of ctx.types) {
|
|
554
|
+
if (typeReg.schema.ast === memberAst) {
|
|
555
|
+
const result = ctx.typeRegistry.get(regTypeName);
|
|
556
|
+
if (result) return result;
|
|
557
|
+
}
|
|
558
|
+
}
|
|
512
559
|
if (memberAst._tag === "Transformation") {
|
|
513
560
|
const toAst = memberAst.to;
|
|
514
561
|
const transformedTypeName = ctx.astToTypeName?.get(toAst);
|
|
@@ -516,13 +563,39 @@ function handleUnionAST(ast, ctx) {
|
|
|
516
563
|
const result = ctx.typeRegistry.get(transformedTypeName);
|
|
517
564
|
if (result) return result;
|
|
518
565
|
}
|
|
566
|
+
for (const [regTypeName, typeReg] of ctx.types) {
|
|
567
|
+
if (typeReg.schema.ast === toAst) {
|
|
568
|
+
const result = ctx.typeRegistry.get(regTypeName);
|
|
569
|
+
if (result) return result;
|
|
570
|
+
}
|
|
571
|
+
}
|
|
519
572
|
}
|
|
520
573
|
if (memberAst._tag === "TypeLiteral") {
|
|
521
574
|
const valueField = memberAst.propertySignatures?.find(
|
|
522
575
|
(p) => String(p.name) === "value"
|
|
523
576
|
);
|
|
524
577
|
if (valueField) {
|
|
525
|
-
const
|
|
578
|
+
const valueType = valueField.type;
|
|
579
|
+
const valueTypeName = ctx.astToTypeName?.get(valueType);
|
|
580
|
+
if (valueTypeName) {
|
|
581
|
+
const result = ctx.typeRegistry.get(valueTypeName);
|
|
582
|
+
if (result) return result;
|
|
583
|
+
}
|
|
584
|
+
for (const [regTypeName, typeReg] of ctx.types) {
|
|
585
|
+
if (typeReg.schema.ast === valueType) {
|
|
586
|
+
const result = ctx.typeRegistry.get(regTypeName);
|
|
587
|
+
if (result) return result;
|
|
588
|
+
}
|
|
589
|
+
let regAst = typeReg.schema.ast;
|
|
590
|
+
while (regAst._tag === "Transformation") {
|
|
591
|
+
regAst = regAst.to;
|
|
592
|
+
if (regAst === valueType) {
|
|
593
|
+
const result = ctx.typeRegistry.get(regTypeName);
|
|
594
|
+
if (result) return result;
|
|
595
|
+
}
|
|
596
|
+
}
|
|
597
|
+
}
|
|
598
|
+
const innerResult = toGraphQLTypeWithRegistry(S2__namespace.make(valueType), ctx);
|
|
526
599
|
if (innerResult) {
|
|
527
600
|
return innerResult;
|
|
528
601
|
}
|
|
@@ -701,6 +774,12 @@ function toGraphQLInputTypeWithRegistry(schema, enumRegistry, inputRegistry, inp
|
|
|
701
774
|
const result = inputRegistry.get(inputName);
|
|
702
775
|
if (result) return result;
|
|
703
776
|
}
|
|
777
|
+
for (const [regInputName, inputReg] of inputs) {
|
|
778
|
+
if (inputReg.schema.ast === memberAst) {
|
|
779
|
+
const result = inputRegistry.get(regInputName);
|
|
780
|
+
if (result) return result;
|
|
781
|
+
}
|
|
782
|
+
}
|
|
704
783
|
if (memberAst._tag === "Transformation") {
|
|
705
784
|
const innerToAst = memberAst.to;
|
|
706
785
|
const transformedInputName = cache?.astToInputName?.get(innerToAst);
|
|
@@ -708,14 +787,44 @@ function toGraphQLInputTypeWithRegistry(schema, enumRegistry, inputRegistry, inp
|
|
|
708
787
|
const result = inputRegistry.get(transformedInputName);
|
|
709
788
|
if (result) return result;
|
|
710
789
|
}
|
|
790
|
+
for (const [regInputName, inputReg] of inputs) {
|
|
791
|
+
if (inputReg.schema.ast === innerToAst) {
|
|
792
|
+
const result = inputRegistry.get(regInputName);
|
|
793
|
+
if (result) return result;
|
|
794
|
+
}
|
|
795
|
+
}
|
|
711
796
|
}
|
|
712
797
|
if (memberAst._tag === "TypeLiteral") {
|
|
713
798
|
const valueField = memberAst.propertySignatures?.find(
|
|
714
799
|
(p) => String(p.name) === "value"
|
|
715
800
|
);
|
|
716
801
|
if (valueField) {
|
|
802
|
+
const valueType = valueField.type;
|
|
803
|
+
const valueInputName = cache?.astToInputName?.get(valueType);
|
|
804
|
+
if (valueInputName) {
|
|
805
|
+
const result = inputRegistry.get(valueInputName);
|
|
806
|
+
if (result) return result;
|
|
807
|
+
}
|
|
808
|
+
for (const [regInputName, inputReg] of inputs) {
|
|
809
|
+
if (inputReg.schema.ast === valueType) {
|
|
810
|
+
const result = inputRegistry.get(regInputName);
|
|
811
|
+
if (result) return result;
|
|
812
|
+
}
|
|
813
|
+
let regAst = inputReg.schema.ast;
|
|
814
|
+
while (regAst._tag === "Transformation") {
|
|
815
|
+
regAst = regAst.to;
|
|
816
|
+
if (regAst === valueType) {
|
|
817
|
+
const result = inputRegistry.get(regInputName);
|
|
818
|
+
if (result) return result;
|
|
819
|
+
}
|
|
820
|
+
}
|
|
821
|
+
if (regAst._tag === "Declaration" && regAst.typeParameters?.[0] === valueType) {
|
|
822
|
+
const result = inputRegistry.get(regInputName);
|
|
823
|
+
if (result) return result;
|
|
824
|
+
}
|
|
825
|
+
}
|
|
717
826
|
const innerResult = toGraphQLInputTypeWithRegistry(
|
|
718
|
-
S2__namespace.make(
|
|
827
|
+
S2__namespace.make(valueType),
|
|
719
828
|
enumRegistry,
|
|
720
829
|
inputRegistry,
|
|
721
830
|
inputs,
|
|
@@ -767,6 +876,12 @@ function toGraphQLInputTypeWithRegistry(schema, enumRegistry, inputRegistry, inp
|
|
|
767
876
|
const result = inputRegistry.get(inputName);
|
|
768
877
|
if (result) return result;
|
|
769
878
|
}
|
|
879
|
+
for (const [regInputName, inputReg] of inputs) {
|
|
880
|
+
if (inputReg.schema.ast === memberAst) {
|
|
881
|
+
const result = inputRegistry.get(regInputName);
|
|
882
|
+
if (result) return result;
|
|
883
|
+
}
|
|
884
|
+
}
|
|
770
885
|
if (memberAst._tag === "Transformation") {
|
|
771
886
|
const toAst = memberAst.to;
|
|
772
887
|
const transformedInputName = cache?.astToInputName?.get(toAst);
|
|
@@ -774,14 +889,44 @@ function toGraphQLInputTypeWithRegistry(schema, enumRegistry, inputRegistry, inp
|
|
|
774
889
|
const result = inputRegistry.get(transformedInputName);
|
|
775
890
|
if (result) return result;
|
|
776
891
|
}
|
|
892
|
+
for (const [regInputName, inputReg] of inputs) {
|
|
893
|
+
if (inputReg.schema.ast === toAst) {
|
|
894
|
+
const result = inputRegistry.get(regInputName);
|
|
895
|
+
if (result) return result;
|
|
896
|
+
}
|
|
897
|
+
}
|
|
777
898
|
}
|
|
778
899
|
if (memberAst._tag === "TypeLiteral") {
|
|
779
900
|
const valueField = memberAst.propertySignatures?.find(
|
|
780
901
|
(p) => String(p.name) === "value"
|
|
781
902
|
);
|
|
782
903
|
if (valueField) {
|
|
904
|
+
const valueType = valueField.type;
|
|
905
|
+
const valueInputName = cache?.astToInputName?.get(valueType);
|
|
906
|
+
if (valueInputName) {
|
|
907
|
+
const result = inputRegistry.get(valueInputName);
|
|
908
|
+
if (result) return result;
|
|
909
|
+
}
|
|
910
|
+
for (const [regInputName, inputReg] of inputs) {
|
|
911
|
+
if (inputReg.schema.ast === valueType) {
|
|
912
|
+
const result = inputRegistry.get(regInputName);
|
|
913
|
+
if (result) return result;
|
|
914
|
+
}
|
|
915
|
+
let regAst = inputReg.schema.ast;
|
|
916
|
+
while (regAst._tag === "Transformation") {
|
|
917
|
+
regAst = regAst.to;
|
|
918
|
+
if (regAst === valueType) {
|
|
919
|
+
const result = inputRegistry.get(regInputName);
|
|
920
|
+
if (result) return result;
|
|
921
|
+
}
|
|
922
|
+
}
|
|
923
|
+
if (regAst._tag === "Declaration" && regAst.typeParameters?.[0] === valueType) {
|
|
924
|
+
const result = inputRegistry.get(regInputName);
|
|
925
|
+
if (result) return result;
|
|
926
|
+
}
|
|
927
|
+
}
|
|
783
928
|
const innerResult = toGraphQLInputTypeWithRegistry(
|
|
784
|
-
S2__namespace.make(
|
|
929
|
+
S2__namespace.make(valueType),
|
|
785
930
|
enumRegistry,
|
|
786
931
|
inputRegistry,
|
|
787
932
|
inputs,
|