@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.js
CHANGED
|
@@ -395,6 +395,12 @@ function handleTransformationAST(ast, ctx) {
|
|
|
395
395
|
const result = ctx.typeRegistry.get(typeName);
|
|
396
396
|
if (result) return result;
|
|
397
397
|
}
|
|
398
|
+
for (const [regTypeName, typeReg] of ctx.types) {
|
|
399
|
+
if (typeReg.schema.ast === memberAst) {
|
|
400
|
+
const result = ctx.typeRegistry.get(regTypeName);
|
|
401
|
+
if (result) return result;
|
|
402
|
+
}
|
|
403
|
+
}
|
|
398
404
|
if (memberAst._tag === "Transformation") {
|
|
399
405
|
const innerToAst = memberAst.to;
|
|
400
406
|
const transformedTypeName = ctx.astToTypeName?.get(innerToAst);
|
|
@@ -402,6 +408,41 @@ function handleTransformationAST(ast, ctx) {
|
|
|
402
408
|
const result = ctx.typeRegistry.get(transformedTypeName);
|
|
403
409
|
if (result) return result;
|
|
404
410
|
}
|
|
411
|
+
for (const [regTypeName, typeReg] of ctx.types) {
|
|
412
|
+
if (typeReg.schema.ast === innerToAst) {
|
|
413
|
+
const result = ctx.typeRegistry.get(regTypeName);
|
|
414
|
+
if (result) return result;
|
|
415
|
+
}
|
|
416
|
+
}
|
|
417
|
+
}
|
|
418
|
+
if (memberAst._tag === "TypeLiteral") {
|
|
419
|
+
const valueField = memberAst.propertySignatures?.find(
|
|
420
|
+
(p) => String(p.name) === "value"
|
|
421
|
+
);
|
|
422
|
+
if (valueField) {
|
|
423
|
+
const valueType = valueField.type;
|
|
424
|
+
const valueTypeName = ctx.astToTypeName?.get(valueType);
|
|
425
|
+
if (valueTypeName) {
|
|
426
|
+
const result = ctx.typeRegistry.get(valueTypeName);
|
|
427
|
+
if (result) return result;
|
|
428
|
+
}
|
|
429
|
+
for (const [regTypeName, typeReg] of ctx.types) {
|
|
430
|
+
if (typeReg.schema.ast === valueType) {
|
|
431
|
+
const result = ctx.typeRegistry.get(regTypeName);
|
|
432
|
+
if (result) return result;
|
|
433
|
+
}
|
|
434
|
+
let regAst = typeReg.schema.ast;
|
|
435
|
+
while (regAst._tag === "Transformation") {
|
|
436
|
+
regAst = regAst.to;
|
|
437
|
+
if (regAst === valueType) {
|
|
438
|
+
const result = ctx.typeRegistry.get(regTypeName);
|
|
439
|
+
if (result) return result;
|
|
440
|
+
}
|
|
441
|
+
}
|
|
442
|
+
}
|
|
443
|
+
const innerResult = toGraphQLTypeWithRegistry(S2.make(valueType), ctx);
|
|
444
|
+
if (innerResult) return innerResult;
|
|
445
|
+
}
|
|
405
446
|
}
|
|
406
447
|
}
|
|
407
448
|
}
|
|
@@ -438,6 +479,12 @@ function handleUnionAST(ast, ctx) {
|
|
|
438
479
|
const result = ctx.typeRegistry.get(typeName);
|
|
439
480
|
if (result) return result;
|
|
440
481
|
}
|
|
482
|
+
for (const [regTypeName, typeReg] of ctx.types) {
|
|
483
|
+
if (typeReg.schema.ast === memberAst) {
|
|
484
|
+
const result = ctx.typeRegistry.get(regTypeName);
|
|
485
|
+
if (result) return result;
|
|
486
|
+
}
|
|
487
|
+
}
|
|
441
488
|
if (memberAst._tag === "Transformation") {
|
|
442
489
|
const toAst = memberAst.to;
|
|
443
490
|
const transformedTypeName = ctx.astToTypeName?.get(toAst);
|
|
@@ -445,13 +492,39 @@ function handleUnionAST(ast, ctx) {
|
|
|
445
492
|
const result = ctx.typeRegistry.get(transformedTypeName);
|
|
446
493
|
if (result) return result;
|
|
447
494
|
}
|
|
495
|
+
for (const [regTypeName, typeReg] of ctx.types) {
|
|
496
|
+
if (typeReg.schema.ast === toAst) {
|
|
497
|
+
const result = ctx.typeRegistry.get(regTypeName);
|
|
498
|
+
if (result) return result;
|
|
499
|
+
}
|
|
500
|
+
}
|
|
448
501
|
}
|
|
449
502
|
if (memberAst._tag === "TypeLiteral") {
|
|
450
503
|
const valueField = memberAst.propertySignatures?.find(
|
|
451
504
|
(p) => String(p.name) === "value"
|
|
452
505
|
);
|
|
453
506
|
if (valueField) {
|
|
454
|
-
const
|
|
507
|
+
const valueType = valueField.type;
|
|
508
|
+
const valueTypeName = ctx.astToTypeName?.get(valueType);
|
|
509
|
+
if (valueTypeName) {
|
|
510
|
+
const result = ctx.typeRegistry.get(valueTypeName);
|
|
511
|
+
if (result) return result;
|
|
512
|
+
}
|
|
513
|
+
for (const [regTypeName, typeReg] of ctx.types) {
|
|
514
|
+
if (typeReg.schema.ast === valueType) {
|
|
515
|
+
const result = ctx.typeRegistry.get(regTypeName);
|
|
516
|
+
if (result) return result;
|
|
517
|
+
}
|
|
518
|
+
let regAst = typeReg.schema.ast;
|
|
519
|
+
while (regAst._tag === "Transformation") {
|
|
520
|
+
regAst = regAst.to;
|
|
521
|
+
if (regAst === valueType) {
|
|
522
|
+
const result = ctx.typeRegistry.get(regTypeName);
|
|
523
|
+
if (result) return result;
|
|
524
|
+
}
|
|
525
|
+
}
|
|
526
|
+
}
|
|
527
|
+
const innerResult = toGraphQLTypeWithRegistry(S2.make(valueType), ctx);
|
|
455
528
|
if (innerResult) {
|
|
456
529
|
return innerResult;
|
|
457
530
|
}
|
|
@@ -630,6 +703,12 @@ function toGraphQLInputTypeWithRegistry(schema, enumRegistry, inputRegistry, inp
|
|
|
630
703
|
const result = inputRegistry.get(inputName);
|
|
631
704
|
if (result) return result;
|
|
632
705
|
}
|
|
706
|
+
for (const [regInputName, inputReg] of inputs) {
|
|
707
|
+
if (inputReg.schema.ast === memberAst) {
|
|
708
|
+
const result = inputRegistry.get(regInputName);
|
|
709
|
+
if (result) return result;
|
|
710
|
+
}
|
|
711
|
+
}
|
|
633
712
|
if (memberAst._tag === "Transformation") {
|
|
634
713
|
const innerToAst = memberAst.to;
|
|
635
714
|
const transformedInputName = cache?.astToInputName?.get(innerToAst);
|
|
@@ -637,14 +716,44 @@ function toGraphQLInputTypeWithRegistry(schema, enumRegistry, inputRegistry, inp
|
|
|
637
716
|
const result = inputRegistry.get(transformedInputName);
|
|
638
717
|
if (result) return result;
|
|
639
718
|
}
|
|
719
|
+
for (const [regInputName, inputReg] of inputs) {
|
|
720
|
+
if (inputReg.schema.ast === innerToAst) {
|
|
721
|
+
const result = inputRegistry.get(regInputName);
|
|
722
|
+
if (result) return result;
|
|
723
|
+
}
|
|
724
|
+
}
|
|
640
725
|
}
|
|
641
726
|
if (memberAst._tag === "TypeLiteral") {
|
|
642
727
|
const valueField = memberAst.propertySignatures?.find(
|
|
643
728
|
(p) => String(p.name) === "value"
|
|
644
729
|
);
|
|
645
730
|
if (valueField) {
|
|
731
|
+
const valueType = valueField.type;
|
|
732
|
+
const valueInputName = cache?.astToInputName?.get(valueType);
|
|
733
|
+
if (valueInputName) {
|
|
734
|
+
const result = inputRegistry.get(valueInputName);
|
|
735
|
+
if (result) return result;
|
|
736
|
+
}
|
|
737
|
+
for (const [regInputName, inputReg] of inputs) {
|
|
738
|
+
if (inputReg.schema.ast === valueType) {
|
|
739
|
+
const result = inputRegistry.get(regInputName);
|
|
740
|
+
if (result) return result;
|
|
741
|
+
}
|
|
742
|
+
let regAst = inputReg.schema.ast;
|
|
743
|
+
while (regAst._tag === "Transformation") {
|
|
744
|
+
regAst = regAst.to;
|
|
745
|
+
if (regAst === valueType) {
|
|
746
|
+
const result = inputRegistry.get(regInputName);
|
|
747
|
+
if (result) return result;
|
|
748
|
+
}
|
|
749
|
+
}
|
|
750
|
+
if (regAst._tag === "Declaration" && regAst.typeParameters?.[0] === valueType) {
|
|
751
|
+
const result = inputRegistry.get(regInputName);
|
|
752
|
+
if (result) return result;
|
|
753
|
+
}
|
|
754
|
+
}
|
|
646
755
|
const innerResult = toGraphQLInputTypeWithRegistry(
|
|
647
|
-
S2.make(
|
|
756
|
+
S2.make(valueType),
|
|
648
757
|
enumRegistry,
|
|
649
758
|
inputRegistry,
|
|
650
759
|
inputs,
|
|
@@ -696,6 +805,12 @@ function toGraphQLInputTypeWithRegistry(schema, enumRegistry, inputRegistry, inp
|
|
|
696
805
|
const result = inputRegistry.get(inputName);
|
|
697
806
|
if (result) return result;
|
|
698
807
|
}
|
|
808
|
+
for (const [regInputName, inputReg] of inputs) {
|
|
809
|
+
if (inputReg.schema.ast === memberAst) {
|
|
810
|
+
const result = inputRegistry.get(regInputName);
|
|
811
|
+
if (result) return result;
|
|
812
|
+
}
|
|
813
|
+
}
|
|
699
814
|
if (memberAst._tag === "Transformation") {
|
|
700
815
|
const toAst = memberAst.to;
|
|
701
816
|
const transformedInputName = cache?.astToInputName?.get(toAst);
|
|
@@ -703,14 +818,44 @@ function toGraphQLInputTypeWithRegistry(schema, enumRegistry, inputRegistry, inp
|
|
|
703
818
|
const result = inputRegistry.get(transformedInputName);
|
|
704
819
|
if (result) return result;
|
|
705
820
|
}
|
|
821
|
+
for (const [regInputName, inputReg] of inputs) {
|
|
822
|
+
if (inputReg.schema.ast === toAst) {
|
|
823
|
+
const result = inputRegistry.get(regInputName);
|
|
824
|
+
if (result) return result;
|
|
825
|
+
}
|
|
826
|
+
}
|
|
706
827
|
}
|
|
707
828
|
if (memberAst._tag === "TypeLiteral") {
|
|
708
829
|
const valueField = memberAst.propertySignatures?.find(
|
|
709
830
|
(p) => String(p.name) === "value"
|
|
710
831
|
);
|
|
711
832
|
if (valueField) {
|
|
833
|
+
const valueType = valueField.type;
|
|
834
|
+
const valueInputName = cache?.astToInputName?.get(valueType);
|
|
835
|
+
if (valueInputName) {
|
|
836
|
+
const result = inputRegistry.get(valueInputName);
|
|
837
|
+
if (result) return result;
|
|
838
|
+
}
|
|
839
|
+
for (const [regInputName, inputReg] of inputs) {
|
|
840
|
+
if (inputReg.schema.ast === valueType) {
|
|
841
|
+
const result = inputRegistry.get(regInputName);
|
|
842
|
+
if (result) return result;
|
|
843
|
+
}
|
|
844
|
+
let regAst = inputReg.schema.ast;
|
|
845
|
+
while (regAst._tag === "Transformation") {
|
|
846
|
+
regAst = regAst.to;
|
|
847
|
+
if (regAst === valueType) {
|
|
848
|
+
const result = inputRegistry.get(regInputName);
|
|
849
|
+
if (result) return result;
|
|
850
|
+
}
|
|
851
|
+
}
|
|
852
|
+
if (regAst._tag === "Declaration" && regAst.typeParameters?.[0] === valueType) {
|
|
853
|
+
const result = inputRegistry.get(regInputName);
|
|
854
|
+
if (result) return result;
|
|
855
|
+
}
|
|
856
|
+
}
|
|
712
857
|
const innerResult = toGraphQLInputTypeWithRegistry(
|
|
713
|
-
S2.make(
|
|
858
|
+
S2.make(valueType),
|
|
714
859
|
enumRegistry,
|
|
715
860
|
inputRegistry,
|
|
716
861
|
inputs,
|