@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/builder/index.cjs
CHANGED
|
@@ -382,7 +382,27 @@ function getOptionInnerType2(ast) {
|
|
|
382
382
|
}
|
|
383
383
|
function handleTransformationAST(ast, ctx) {
|
|
384
384
|
const toAst = ast.to;
|
|
385
|
+
const fromAst = ast.from;
|
|
385
386
|
if (isOptionDeclaration2(toAst)) {
|
|
387
|
+
if (fromAst && fromAst._tag === "Union") {
|
|
388
|
+
for (const memberAst of fromAst.types) {
|
|
389
|
+
if (memberAst._tag === "Literal") continue;
|
|
390
|
+
if (memberAst._tag === "UndefinedKeyword") continue;
|
|
391
|
+
const typeName = ctx.astToTypeName?.get(memberAst);
|
|
392
|
+
if (typeName) {
|
|
393
|
+
const result = ctx.typeRegistry.get(typeName);
|
|
394
|
+
if (result) return result;
|
|
395
|
+
}
|
|
396
|
+
if (memberAst._tag === "Transformation") {
|
|
397
|
+
const innerToAst = memberAst.to;
|
|
398
|
+
const transformedTypeName = ctx.astToTypeName?.get(innerToAst);
|
|
399
|
+
if (transformedTypeName) {
|
|
400
|
+
const result = ctx.typeRegistry.get(transformedTypeName);
|
|
401
|
+
if (result) return result;
|
|
402
|
+
}
|
|
403
|
+
}
|
|
404
|
+
}
|
|
405
|
+
}
|
|
386
406
|
const innerType = getOptionInnerType2(toAst);
|
|
387
407
|
if (innerType) {
|
|
388
408
|
return toGraphQLTypeWithRegistry(S__namespace.make(innerType), ctx);
|
|
@@ -410,6 +430,21 @@ function handleUnionAST(ast, ctx) {
|
|
|
410
430
|
const unionType2 = findRegisteredUnion(ast.types, ctx);
|
|
411
431
|
if (unionType2) return unionType2;
|
|
412
432
|
}
|
|
433
|
+
for (const memberAst of ast.types) {
|
|
434
|
+
const typeName = ctx.astToTypeName?.get(memberAst);
|
|
435
|
+
if (typeName) {
|
|
436
|
+
const result = ctx.typeRegistry.get(typeName);
|
|
437
|
+
if (result) return result;
|
|
438
|
+
}
|
|
439
|
+
if (memberAst._tag === "Transformation") {
|
|
440
|
+
const toAst = memberAst.to;
|
|
441
|
+
const transformedTypeName = ctx.astToTypeName?.get(toAst);
|
|
442
|
+
if (transformedTypeName) {
|
|
443
|
+
const result = ctx.typeRegistry.get(transformedTypeName);
|
|
444
|
+
if (result) return result;
|
|
445
|
+
}
|
|
446
|
+
}
|
|
447
|
+
}
|
|
413
448
|
if (ast.types.length > 0) {
|
|
414
449
|
return toGraphQLTypeWithRegistry(S__namespace.make(ast.types[0]), ctx);
|
|
415
450
|
}
|
|
@@ -564,6 +599,26 @@ function toGraphQLInputTypeWithRegistry(schema, enumRegistry, inputRegistry, inp
|
|
|
564
599
|
}
|
|
565
600
|
if (ast._tag === "Transformation") {
|
|
566
601
|
const toAst = ast.to;
|
|
602
|
+
const fromAst = ast.from;
|
|
603
|
+
if (isOptionDeclaration2(toAst) && fromAst && fromAst._tag === "Union") {
|
|
604
|
+
for (const memberAst of fromAst.types) {
|
|
605
|
+
if (memberAst._tag === "Literal") continue;
|
|
606
|
+
if (memberAst._tag === "UndefinedKeyword") continue;
|
|
607
|
+
const inputName = cache?.astToInputName?.get(memberAst);
|
|
608
|
+
if (inputName) {
|
|
609
|
+
const result = inputRegistry.get(inputName);
|
|
610
|
+
if (result) return result;
|
|
611
|
+
}
|
|
612
|
+
if (memberAst._tag === "Transformation") {
|
|
613
|
+
const innerToAst = memberAst.to;
|
|
614
|
+
const transformedInputName = cache?.astToInputName?.get(innerToAst);
|
|
615
|
+
if (transformedInputName) {
|
|
616
|
+
const result = inputRegistry.get(transformedInputName);
|
|
617
|
+
if (result) return result;
|
|
618
|
+
}
|
|
619
|
+
}
|
|
620
|
+
}
|
|
621
|
+
}
|
|
567
622
|
return toGraphQLInputTypeWithRegistry(
|
|
568
623
|
S__namespace.make(toAst),
|
|
569
624
|
enumRegistry,
|
|
@@ -596,6 +651,21 @@ function toGraphQLInputTypeWithRegistry(schema, enumRegistry, inputRegistry, inp
|
|
|
596
651
|
cache
|
|
597
652
|
);
|
|
598
653
|
}
|
|
654
|
+
for (const memberAst of unionAst.types) {
|
|
655
|
+
const inputName = cache?.astToInputName?.get(memberAst);
|
|
656
|
+
if (inputName) {
|
|
657
|
+
const result = inputRegistry.get(inputName);
|
|
658
|
+
if (result) return result;
|
|
659
|
+
}
|
|
660
|
+
if (memberAst._tag === "Transformation") {
|
|
661
|
+
const toAst = memberAst.to;
|
|
662
|
+
const transformedInputName = cache?.astToInputName?.get(toAst);
|
|
663
|
+
if (transformedInputName) {
|
|
664
|
+
const result = inputRegistry.get(transformedInputName);
|
|
665
|
+
if (result) return result;
|
|
666
|
+
}
|
|
667
|
+
}
|
|
668
|
+
}
|
|
599
669
|
const allLiterals = unionAst.types.every((t) => t._tag === "Literal");
|
|
600
670
|
if (allLiterals) {
|
|
601
671
|
const literalValues = unionAst.types.map((t) => String(t.literal)).sort();
|