@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/builder/index.cjs
CHANGED
|
@@ -417,6 +417,12 @@ function handleTransformationAST(ast, ctx) {
|
|
|
417
417
|
const result = ctx.typeRegistry.get(typeName);
|
|
418
418
|
if (result) return result;
|
|
419
419
|
}
|
|
420
|
+
for (const [regTypeName, typeReg] of ctx.types) {
|
|
421
|
+
if (typeReg.schema.ast === memberAst) {
|
|
422
|
+
const result = ctx.typeRegistry.get(regTypeName);
|
|
423
|
+
if (result) return result;
|
|
424
|
+
}
|
|
425
|
+
}
|
|
420
426
|
if (memberAst._tag === "Transformation") {
|
|
421
427
|
const innerToAst = memberAst.to;
|
|
422
428
|
const transformedTypeName = ctx.astToTypeName?.get(innerToAst);
|
|
@@ -424,6 +430,41 @@ function handleTransformationAST(ast, ctx) {
|
|
|
424
430
|
const result = ctx.typeRegistry.get(transformedTypeName);
|
|
425
431
|
if (result) return result;
|
|
426
432
|
}
|
|
433
|
+
for (const [regTypeName, typeReg] of ctx.types) {
|
|
434
|
+
if (typeReg.schema.ast === innerToAst) {
|
|
435
|
+
const result = ctx.typeRegistry.get(regTypeName);
|
|
436
|
+
if (result) return result;
|
|
437
|
+
}
|
|
438
|
+
}
|
|
439
|
+
}
|
|
440
|
+
if (memberAst._tag === "TypeLiteral") {
|
|
441
|
+
const valueField = memberAst.propertySignatures?.find(
|
|
442
|
+
(p) => String(p.name) === "value"
|
|
443
|
+
);
|
|
444
|
+
if (valueField) {
|
|
445
|
+
const valueType = valueField.type;
|
|
446
|
+
const valueTypeName = ctx.astToTypeName?.get(valueType);
|
|
447
|
+
if (valueTypeName) {
|
|
448
|
+
const result = ctx.typeRegistry.get(valueTypeName);
|
|
449
|
+
if (result) return result;
|
|
450
|
+
}
|
|
451
|
+
for (const [regTypeName, typeReg] of ctx.types) {
|
|
452
|
+
if (typeReg.schema.ast === valueType) {
|
|
453
|
+
const result = ctx.typeRegistry.get(regTypeName);
|
|
454
|
+
if (result) return result;
|
|
455
|
+
}
|
|
456
|
+
let regAst = typeReg.schema.ast;
|
|
457
|
+
while (regAst._tag === "Transformation") {
|
|
458
|
+
regAst = regAst.to;
|
|
459
|
+
if (regAst === valueType) {
|
|
460
|
+
const result = ctx.typeRegistry.get(regTypeName);
|
|
461
|
+
if (result) return result;
|
|
462
|
+
}
|
|
463
|
+
}
|
|
464
|
+
}
|
|
465
|
+
const innerResult = toGraphQLTypeWithRegistry(S2__namespace.make(valueType), ctx);
|
|
466
|
+
if (innerResult) return innerResult;
|
|
467
|
+
}
|
|
427
468
|
}
|
|
428
469
|
}
|
|
429
470
|
}
|
|
@@ -460,6 +501,12 @@ function handleUnionAST(ast, ctx) {
|
|
|
460
501
|
const result = ctx.typeRegistry.get(typeName);
|
|
461
502
|
if (result) return result;
|
|
462
503
|
}
|
|
504
|
+
for (const [regTypeName, typeReg] of ctx.types) {
|
|
505
|
+
if (typeReg.schema.ast === memberAst) {
|
|
506
|
+
const result = ctx.typeRegistry.get(regTypeName);
|
|
507
|
+
if (result) return result;
|
|
508
|
+
}
|
|
509
|
+
}
|
|
463
510
|
if (memberAst._tag === "Transformation") {
|
|
464
511
|
const toAst = memberAst.to;
|
|
465
512
|
const transformedTypeName = ctx.astToTypeName?.get(toAst);
|
|
@@ -467,13 +514,39 @@ function handleUnionAST(ast, ctx) {
|
|
|
467
514
|
const result = ctx.typeRegistry.get(transformedTypeName);
|
|
468
515
|
if (result) return result;
|
|
469
516
|
}
|
|
517
|
+
for (const [regTypeName, typeReg] of ctx.types) {
|
|
518
|
+
if (typeReg.schema.ast === toAst) {
|
|
519
|
+
const result = ctx.typeRegistry.get(regTypeName);
|
|
520
|
+
if (result) return result;
|
|
521
|
+
}
|
|
522
|
+
}
|
|
470
523
|
}
|
|
471
524
|
if (memberAst._tag === "TypeLiteral") {
|
|
472
525
|
const valueField = memberAst.propertySignatures?.find(
|
|
473
526
|
(p) => String(p.name) === "value"
|
|
474
527
|
);
|
|
475
528
|
if (valueField) {
|
|
476
|
-
const
|
|
529
|
+
const valueType = valueField.type;
|
|
530
|
+
const valueTypeName = ctx.astToTypeName?.get(valueType);
|
|
531
|
+
if (valueTypeName) {
|
|
532
|
+
const result = ctx.typeRegistry.get(valueTypeName);
|
|
533
|
+
if (result) return result;
|
|
534
|
+
}
|
|
535
|
+
for (const [regTypeName, typeReg] of ctx.types) {
|
|
536
|
+
if (typeReg.schema.ast === valueType) {
|
|
537
|
+
const result = ctx.typeRegistry.get(regTypeName);
|
|
538
|
+
if (result) return result;
|
|
539
|
+
}
|
|
540
|
+
let regAst = typeReg.schema.ast;
|
|
541
|
+
while (regAst._tag === "Transformation") {
|
|
542
|
+
regAst = regAst.to;
|
|
543
|
+
if (regAst === valueType) {
|
|
544
|
+
const result = ctx.typeRegistry.get(regTypeName);
|
|
545
|
+
if (result) return result;
|
|
546
|
+
}
|
|
547
|
+
}
|
|
548
|
+
}
|
|
549
|
+
const innerResult = toGraphQLTypeWithRegistry(S2__namespace.make(valueType), ctx);
|
|
477
550
|
if (innerResult) {
|
|
478
551
|
return innerResult;
|
|
479
552
|
}
|
|
@@ -652,6 +725,12 @@ function toGraphQLInputTypeWithRegistry(schema, enumRegistry, inputRegistry, inp
|
|
|
652
725
|
const result = inputRegistry.get(inputName);
|
|
653
726
|
if (result) return result;
|
|
654
727
|
}
|
|
728
|
+
for (const [regInputName, inputReg] of inputs) {
|
|
729
|
+
if (inputReg.schema.ast === memberAst) {
|
|
730
|
+
const result = inputRegistry.get(regInputName);
|
|
731
|
+
if (result) return result;
|
|
732
|
+
}
|
|
733
|
+
}
|
|
655
734
|
if (memberAst._tag === "Transformation") {
|
|
656
735
|
const innerToAst = memberAst.to;
|
|
657
736
|
const transformedInputName = cache?.astToInputName?.get(innerToAst);
|
|
@@ -659,14 +738,44 @@ function toGraphQLInputTypeWithRegistry(schema, enumRegistry, inputRegistry, inp
|
|
|
659
738
|
const result = inputRegistry.get(transformedInputName);
|
|
660
739
|
if (result) return result;
|
|
661
740
|
}
|
|
741
|
+
for (const [regInputName, inputReg] of inputs) {
|
|
742
|
+
if (inputReg.schema.ast === innerToAst) {
|
|
743
|
+
const result = inputRegistry.get(regInputName);
|
|
744
|
+
if (result) return result;
|
|
745
|
+
}
|
|
746
|
+
}
|
|
662
747
|
}
|
|
663
748
|
if (memberAst._tag === "TypeLiteral") {
|
|
664
749
|
const valueField = memberAst.propertySignatures?.find(
|
|
665
750
|
(p) => String(p.name) === "value"
|
|
666
751
|
);
|
|
667
752
|
if (valueField) {
|
|
753
|
+
const valueType = valueField.type;
|
|
754
|
+
const valueInputName = cache?.astToInputName?.get(valueType);
|
|
755
|
+
if (valueInputName) {
|
|
756
|
+
const result = inputRegistry.get(valueInputName);
|
|
757
|
+
if (result) return result;
|
|
758
|
+
}
|
|
759
|
+
for (const [regInputName, inputReg] of inputs) {
|
|
760
|
+
if (inputReg.schema.ast === valueType) {
|
|
761
|
+
const result = inputRegistry.get(regInputName);
|
|
762
|
+
if (result) return result;
|
|
763
|
+
}
|
|
764
|
+
let regAst = inputReg.schema.ast;
|
|
765
|
+
while (regAst._tag === "Transformation") {
|
|
766
|
+
regAst = regAst.to;
|
|
767
|
+
if (regAst === valueType) {
|
|
768
|
+
const result = inputRegistry.get(regInputName);
|
|
769
|
+
if (result) return result;
|
|
770
|
+
}
|
|
771
|
+
}
|
|
772
|
+
if (regAst._tag === "Declaration" && regAst.typeParameters?.[0] === valueType) {
|
|
773
|
+
const result = inputRegistry.get(regInputName);
|
|
774
|
+
if (result) return result;
|
|
775
|
+
}
|
|
776
|
+
}
|
|
668
777
|
const innerResult = toGraphQLInputTypeWithRegistry(
|
|
669
|
-
S2__namespace.make(
|
|
778
|
+
S2__namespace.make(valueType),
|
|
670
779
|
enumRegistry,
|
|
671
780
|
inputRegistry,
|
|
672
781
|
inputs,
|
|
@@ -718,6 +827,12 @@ function toGraphQLInputTypeWithRegistry(schema, enumRegistry, inputRegistry, inp
|
|
|
718
827
|
const result = inputRegistry.get(inputName);
|
|
719
828
|
if (result) return result;
|
|
720
829
|
}
|
|
830
|
+
for (const [regInputName, inputReg] of inputs) {
|
|
831
|
+
if (inputReg.schema.ast === memberAst) {
|
|
832
|
+
const result = inputRegistry.get(regInputName);
|
|
833
|
+
if (result) return result;
|
|
834
|
+
}
|
|
835
|
+
}
|
|
721
836
|
if (memberAst._tag === "Transformation") {
|
|
722
837
|
const toAst = memberAst.to;
|
|
723
838
|
const transformedInputName = cache?.astToInputName?.get(toAst);
|
|
@@ -725,14 +840,44 @@ function toGraphQLInputTypeWithRegistry(schema, enumRegistry, inputRegistry, inp
|
|
|
725
840
|
const result = inputRegistry.get(transformedInputName);
|
|
726
841
|
if (result) return result;
|
|
727
842
|
}
|
|
843
|
+
for (const [regInputName, inputReg] of inputs) {
|
|
844
|
+
if (inputReg.schema.ast === toAst) {
|
|
845
|
+
const result = inputRegistry.get(regInputName);
|
|
846
|
+
if (result) return result;
|
|
847
|
+
}
|
|
848
|
+
}
|
|
728
849
|
}
|
|
729
850
|
if (memberAst._tag === "TypeLiteral") {
|
|
730
851
|
const valueField = memberAst.propertySignatures?.find(
|
|
731
852
|
(p) => String(p.name) === "value"
|
|
732
853
|
);
|
|
733
854
|
if (valueField) {
|
|
855
|
+
const valueType = valueField.type;
|
|
856
|
+
const valueInputName = cache?.astToInputName?.get(valueType);
|
|
857
|
+
if (valueInputName) {
|
|
858
|
+
const result = inputRegistry.get(valueInputName);
|
|
859
|
+
if (result) return result;
|
|
860
|
+
}
|
|
861
|
+
for (const [regInputName, inputReg] of inputs) {
|
|
862
|
+
if (inputReg.schema.ast === valueType) {
|
|
863
|
+
const result = inputRegistry.get(regInputName);
|
|
864
|
+
if (result) return result;
|
|
865
|
+
}
|
|
866
|
+
let regAst = inputReg.schema.ast;
|
|
867
|
+
while (regAst._tag === "Transformation") {
|
|
868
|
+
regAst = regAst.to;
|
|
869
|
+
if (regAst === valueType) {
|
|
870
|
+
const result = inputRegistry.get(regInputName);
|
|
871
|
+
if (result) return result;
|
|
872
|
+
}
|
|
873
|
+
}
|
|
874
|
+
if (regAst._tag === "Declaration" && regAst.typeParameters?.[0] === valueType) {
|
|
875
|
+
const result = inputRegistry.get(regInputName);
|
|
876
|
+
if (result) return result;
|
|
877
|
+
}
|
|
878
|
+
}
|
|
734
879
|
const innerResult = toGraphQLInputTypeWithRegistry(
|
|
735
|
-
S2__namespace.make(
|
|
880
|
+
S2__namespace.make(valueType),
|
|
736
881
|
enumRegistry,
|
|
737
882
|
inputRegistry,
|
|
738
883
|
inputs,
|