@effect-gql/core 1.4.10 → 1.4.11
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 +7 -18
- package/builder/index.cjs.map +1 -1
- package/builder/index.js +7 -18
- package/builder/index.js.map +1 -1
- package/index.cjs +9 -18
- package/index.cjs.map +1 -1
- package/index.d.cts +12 -1
- package/index.d.ts +12 -1
- package/index.js +8 -19
- package/index.js.map +1 -1
- package/package.json +1 -1
package/builder/index.cjs
CHANGED
|
@@ -349,7 +349,7 @@ function toGraphQLTypeWithRegistry(schema, ctx) {
|
|
|
349
349
|
return handleTupleTypeAST2(ast, ctx);
|
|
350
350
|
}
|
|
351
351
|
if (ast._tag === "Declaration") {
|
|
352
|
-
if (
|
|
352
|
+
if (isOptionDeclaration(ast)) {
|
|
353
353
|
const innerType = getOptionInnerType2(ast);
|
|
354
354
|
if (innerType) {
|
|
355
355
|
return toGraphQLTypeWithRegistry(S2__namespace.make(innerType), ctx);
|
|
@@ -380,19 +380,6 @@ function findRegisteredInterface(schema, ast, ctx) {
|
|
|
380
380
|
}
|
|
381
381
|
return void 0;
|
|
382
382
|
}
|
|
383
|
-
function isOptionDeclaration2(ast) {
|
|
384
|
-
if (ast._tag === "Declaration") {
|
|
385
|
-
const annotations = ast.annotations;
|
|
386
|
-
if (annotations) {
|
|
387
|
-
const TypeConstructorSymbol = /* @__PURE__ */ Symbol.for("effect/annotation/TypeConstructor");
|
|
388
|
-
const typeConstructor = annotations[TypeConstructorSymbol];
|
|
389
|
-
if (typeConstructor && typeConstructor._tag === "effect/Option") {
|
|
390
|
-
return true;
|
|
391
|
-
}
|
|
392
|
-
}
|
|
393
|
-
}
|
|
394
|
-
return false;
|
|
395
|
-
}
|
|
396
383
|
function getOptionInnerType2(ast) {
|
|
397
384
|
if (ast._tag === "Declaration") {
|
|
398
385
|
const typeParams = ast.typeParameters;
|
|
@@ -493,7 +480,7 @@ function handleArrayTransformation(toAst, ctx) {
|
|
|
493
480
|
function handleTransformationAST(ast, ctx) {
|
|
494
481
|
const toAst = ast.to;
|
|
495
482
|
const fromAst = ast.from;
|
|
496
|
-
if (
|
|
483
|
+
if (isOptionDeclaration(toAst)) {
|
|
497
484
|
const optionResult = handleOptionTransformation(ast, fromAst, toAst, ctx);
|
|
498
485
|
if (optionResult) return optionResult;
|
|
499
486
|
}
|
|
@@ -599,7 +586,8 @@ function schemaToFields(schema, ctx) {
|
|
|
599
586
|
if (fieldName === "_tag") continue;
|
|
600
587
|
const fieldSchema = S2__namespace.make(field2.type);
|
|
601
588
|
let fieldType = toGraphQLTypeWithRegistry(fieldSchema, ctx);
|
|
602
|
-
|
|
589
|
+
const isOptionField = isOptionTransformation(field2.type) || isOptionDeclaration(field2.type);
|
|
590
|
+
if (!field2.isOptional && !isOptionField) {
|
|
603
591
|
fieldType = getNonNull(fieldType);
|
|
604
592
|
}
|
|
605
593
|
fields[fieldName] = { type: fieldType };
|
|
@@ -627,7 +615,8 @@ function schemaToInputFields(schema, enumRegistry, inputRegistry, inputs, enums,
|
|
|
627
615
|
enums,
|
|
628
616
|
cache
|
|
629
617
|
);
|
|
630
|
-
|
|
618
|
+
const isOptionField = isOptionTransformation(field2.type) || isOptionDeclaration(field2.type);
|
|
619
|
+
if (!field2.isOptional && !isOptionField) {
|
|
631
620
|
fieldType = getNonNull(fieldType);
|
|
632
621
|
}
|
|
633
622
|
fields[fieldName] = { type: fieldType };
|
|
@@ -818,7 +807,7 @@ function handleOptionTransformationForInput(fromAst, toAst, inputs, inputRegistr
|
|
|
818
807
|
function handleTransformationForInput(ast, inputs, inputRegistry, enumRegistry, enums, cache) {
|
|
819
808
|
const toAst = ast.to;
|
|
820
809
|
const fromAst = ast.from;
|
|
821
|
-
if (
|
|
810
|
+
if (isOptionDeclaration(toAst)) {
|
|
822
811
|
const optionResult = handleOptionTransformationForInput(
|
|
823
812
|
fromAst,
|
|
824
813
|
toAst,
|