@effect-gql/core 1.4.1 → 1.4.2
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 +70 -0
- package/builder/index.cjs.map +1 -1
- package/builder/index.js +70 -0
- package/builder/index.js.map +1 -1
- package/index.cjs +70 -0
- package/index.cjs.map +1 -1
- package/index.js +70 -0
- package/index.js.map +1 -1
- package/package.json +1 -1
package/index.cjs
CHANGED
|
@@ -431,7 +431,27 @@ function getOptionInnerType2(ast) {
|
|
|
431
431
|
}
|
|
432
432
|
function handleTransformationAST(ast, ctx) {
|
|
433
433
|
const toAst = ast.to;
|
|
434
|
+
const fromAst = ast.from;
|
|
434
435
|
if (isOptionDeclaration2(toAst)) {
|
|
436
|
+
if (fromAst && fromAst._tag === "Union") {
|
|
437
|
+
for (const memberAst of fromAst.types) {
|
|
438
|
+
if (memberAst._tag === "Literal") continue;
|
|
439
|
+
if (memberAst._tag === "UndefinedKeyword") continue;
|
|
440
|
+
const typeName = ctx.astToTypeName?.get(memberAst);
|
|
441
|
+
if (typeName) {
|
|
442
|
+
const result = ctx.typeRegistry.get(typeName);
|
|
443
|
+
if (result) return result;
|
|
444
|
+
}
|
|
445
|
+
if (memberAst._tag === "Transformation") {
|
|
446
|
+
const innerToAst = memberAst.to;
|
|
447
|
+
const transformedTypeName = ctx.astToTypeName?.get(innerToAst);
|
|
448
|
+
if (transformedTypeName) {
|
|
449
|
+
const result = ctx.typeRegistry.get(transformedTypeName);
|
|
450
|
+
if (result) return result;
|
|
451
|
+
}
|
|
452
|
+
}
|
|
453
|
+
}
|
|
454
|
+
}
|
|
435
455
|
const innerType = getOptionInnerType2(toAst);
|
|
436
456
|
if (innerType) {
|
|
437
457
|
return toGraphQLTypeWithRegistry(S__namespace.make(innerType), ctx);
|
|
@@ -459,6 +479,21 @@ function handleUnionAST(ast, ctx) {
|
|
|
459
479
|
const unionType2 = findRegisteredUnion(ast.types, ctx);
|
|
460
480
|
if (unionType2) return unionType2;
|
|
461
481
|
}
|
|
482
|
+
for (const memberAst of ast.types) {
|
|
483
|
+
const typeName = ctx.astToTypeName?.get(memberAst);
|
|
484
|
+
if (typeName) {
|
|
485
|
+
const result = ctx.typeRegistry.get(typeName);
|
|
486
|
+
if (result) return result;
|
|
487
|
+
}
|
|
488
|
+
if (memberAst._tag === "Transformation") {
|
|
489
|
+
const toAst = memberAst.to;
|
|
490
|
+
const transformedTypeName = ctx.astToTypeName?.get(toAst);
|
|
491
|
+
if (transformedTypeName) {
|
|
492
|
+
const result = ctx.typeRegistry.get(transformedTypeName);
|
|
493
|
+
if (result) return result;
|
|
494
|
+
}
|
|
495
|
+
}
|
|
496
|
+
}
|
|
462
497
|
if (ast.types.length > 0) {
|
|
463
498
|
return toGraphQLTypeWithRegistry(S__namespace.make(ast.types[0]), ctx);
|
|
464
499
|
}
|
|
@@ -613,6 +648,26 @@ function toGraphQLInputTypeWithRegistry(schema, enumRegistry, inputRegistry, inp
|
|
|
613
648
|
}
|
|
614
649
|
if (ast._tag === "Transformation") {
|
|
615
650
|
const toAst = ast.to;
|
|
651
|
+
const fromAst = ast.from;
|
|
652
|
+
if (isOptionDeclaration2(toAst) && fromAst && fromAst._tag === "Union") {
|
|
653
|
+
for (const memberAst of fromAst.types) {
|
|
654
|
+
if (memberAst._tag === "Literal") continue;
|
|
655
|
+
if (memberAst._tag === "UndefinedKeyword") continue;
|
|
656
|
+
const inputName = cache?.astToInputName?.get(memberAst);
|
|
657
|
+
if (inputName) {
|
|
658
|
+
const result = inputRegistry.get(inputName);
|
|
659
|
+
if (result) return result;
|
|
660
|
+
}
|
|
661
|
+
if (memberAst._tag === "Transformation") {
|
|
662
|
+
const innerToAst = memberAst.to;
|
|
663
|
+
const transformedInputName = cache?.astToInputName?.get(innerToAst);
|
|
664
|
+
if (transformedInputName) {
|
|
665
|
+
const result = inputRegistry.get(transformedInputName);
|
|
666
|
+
if (result) return result;
|
|
667
|
+
}
|
|
668
|
+
}
|
|
669
|
+
}
|
|
670
|
+
}
|
|
616
671
|
return toGraphQLInputTypeWithRegistry(
|
|
617
672
|
S__namespace.make(toAst),
|
|
618
673
|
enumRegistry,
|
|
@@ -645,6 +700,21 @@ function toGraphQLInputTypeWithRegistry(schema, enumRegistry, inputRegistry, inp
|
|
|
645
700
|
cache
|
|
646
701
|
);
|
|
647
702
|
}
|
|
703
|
+
for (const memberAst of unionAst.types) {
|
|
704
|
+
const inputName = cache?.astToInputName?.get(memberAst);
|
|
705
|
+
if (inputName) {
|
|
706
|
+
const result = inputRegistry.get(inputName);
|
|
707
|
+
if (result) return result;
|
|
708
|
+
}
|
|
709
|
+
if (memberAst._tag === "Transformation") {
|
|
710
|
+
const toAst = memberAst.to;
|
|
711
|
+
const transformedInputName = cache?.astToInputName?.get(toAst);
|
|
712
|
+
if (transformedInputName) {
|
|
713
|
+
const result = inputRegistry.get(transformedInputName);
|
|
714
|
+
if (result) return result;
|
|
715
|
+
}
|
|
716
|
+
}
|
|
717
|
+
}
|
|
648
718
|
const allLiterals = unionAst.types.every((t) => t._tag === "Literal");
|
|
649
719
|
if (allLiterals) {
|
|
650
720
|
const literalValues = unionAst.types.map((t) => String(t.literal)).sort();
|