@effect-gql/core 1.4.11 → 1.4.13
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 +30 -12
- package/builder/index.cjs.map +1 -1
- package/builder/index.js +30 -12
- package/builder/index.js.map +1 -1
- package/index.cjs +30 -12
- package/index.cjs.map +1 -1
- package/index.js +30 -12
- package/index.js.map +1 -1
- package/package.json +1 -1
package/builder/index.cjs
CHANGED
|
@@ -186,10 +186,7 @@ var toGraphQLInputType = (schema) => {
|
|
|
186
186
|
const tupleResult = handleTupleTypeAST(ast, toGraphQLInputType);
|
|
187
187
|
if (tupleResult) return tupleResult;
|
|
188
188
|
if (ast._tag === "TypeLiteral") {
|
|
189
|
-
const fields = buildFieldsFromPropertySignatures(
|
|
190
|
-
ast.propertySignatures,
|
|
191
|
-
toGraphQLInputType
|
|
192
|
-
);
|
|
189
|
+
const fields = buildFieldsFromPropertySignatures(ast.propertySignatures, toGraphQLInputType);
|
|
193
190
|
const typeName = schema.annotations?.identifier || `Input_${Math.random().toString(36).slice(2, 11)}`;
|
|
194
191
|
return new graphql.GraphQLInputObjectType({
|
|
195
192
|
name: typeName,
|
|
@@ -421,9 +418,7 @@ function findRegisteredTypeForTransformation(memberAst, ctx) {
|
|
|
421
418
|
}
|
|
422
419
|
function findRegisteredTypeForOptionSome(memberAst, ctx) {
|
|
423
420
|
if (memberAst._tag !== "TypeLiteral") return void 0;
|
|
424
|
-
const valueField = memberAst.propertySignatures?.find(
|
|
425
|
-
(p) => String(p.name) === "value"
|
|
426
|
-
);
|
|
421
|
+
const valueField = memberAst.propertySignatures?.find((p) => String(p.name) === "value");
|
|
427
422
|
if (!valueField) return void 0;
|
|
428
423
|
const valueType = valueField.type;
|
|
429
424
|
const valueTypeName = ctx.astToTypeName?.get(valueType);
|
|
@@ -799,7 +794,14 @@ function handleOptionTransformationForInput(fromAst, toAst, inputs, inputRegistr
|
|
|
799
794
|
for (const memberAst of fromAst.types) {
|
|
800
795
|
if (memberAst._tag === "Literal") continue;
|
|
801
796
|
if (memberAst._tag === "UndefinedKeyword") continue;
|
|
802
|
-
const registeredInput = findRegisteredInputForAST(memberAst, inputs, inputRegistry, enumRegistry, enums, cache) || findRegisteredInputForTransformation(
|
|
797
|
+
const registeredInput = findRegisteredInputForAST(memberAst, inputs, inputRegistry, enumRegistry, enums, cache) || findRegisteredInputForTransformation(
|
|
798
|
+
memberAst,
|
|
799
|
+
inputs,
|
|
800
|
+
inputRegistry,
|
|
801
|
+
enumRegistry,
|
|
802
|
+
enums,
|
|
803
|
+
cache
|
|
804
|
+
) || findRegisteredInputForOptionSome(memberAst, inputs, inputRegistry, enumRegistry, enums, cache);
|
|
803
805
|
if (registeredInput) return registeredInput;
|
|
804
806
|
}
|
|
805
807
|
return void 0;
|
|
@@ -830,7 +832,14 @@ function handleTransformationForInput(ast, inputs, inputRegistry, enumRegistry,
|
|
|
830
832
|
}
|
|
831
833
|
function findRegisteredInputInUnionMembers(types, inputs, inputRegistry, enumRegistry, enums, cache) {
|
|
832
834
|
for (const memberAst of types) {
|
|
833
|
-
const registeredInput = findRegisteredInputForAST(memberAst, inputs, inputRegistry, enumRegistry, enums, cache) || findRegisteredInputForTransformation(
|
|
835
|
+
const registeredInput = findRegisteredInputForAST(memberAst, inputs, inputRegistry, enumRegistry, enums, cache) || findRegisteredInputForTransformation(
|
|
836
|
+
memberAst,
|
|
837
|
+
inputs,
|
|
838
|
+
inputRegistry,
|
|
839
|
+
enumRegistry,
|
|
840
|
+
enums,
|
|
841
|
+
cache
|
|
842
|
+
) || findRegisteredInputForOptionSome(memberAst, inputs, inputRegistry, enumRegistry, enums, cache);
|
|
834
843
|
if (registeredInput) return registeredInput;
|
|
835
844
|
}
|
|
836
845
|
return void 0;
|
|
@@ -935,7 +944,8 @@ function toGraphQLArgsWithRegistry(schema, enumRegistry, inputRegistry, inputs,
|
|
|
935
944
|
enums,
|
|
936
945
|
cache
|
|
937
946
|
);
|
|
938
|
-
|
|
947
|
+
const isOptionField = isOptionTransformation(field2.type) || isOptionDeclaration(field2.type);
|
|
948
|
+
if (!field2.isOptional && !isOptionField) {
|
|
939
949
|
fieldType = getNonNull(fieldType);
|
|
940
950
|
}
|
|
941
951
|
args[fieldName] = { type: fieldType };
|
|
@@ -1487,8 +1497,16 @@ var GraphQLSchemaBuilder = class _GraphQLSchemaBuilder {
|
|
|
1487
1497
|
const enumRegistry = this.buildEnumRegistry();
|
|
1488
1498
|
const inputRegistry = this.buildInputRegistry(enumRegistry);
|
|
1489
1499
|
const inputTypeLookupCache = buildInputTypeLookupCache(this.state.inputs, this.state.enums);
|
|
1490
|
-
const directiveRegistry = this.buildDirectiveRegistry(
|
|
1491
|
-
|
|
1500
|
+
const directiveRegistry = this.buildDirectiveRegistry(
|
|
1501
|
+
enumRegistry,
|
|
1502
|
+
inputRegistry,
|
|
1503
|
+
inputTypeLookupCache
|
|
1504
|
+
);
|
|
1505
|
+
const interfaceRegistry = this.buildInterfaceRegistry(
|
|
1506
|
+
enumRegistry,
|
|
1507
|
+
inputRegistry,
|
|
1508
|
+
inputTypeLookupCache
|
|
1509
|
+
);
|
|
1492
1510
|
const { typeRegistry, unionRegistry } = this.buildTypeAndUnionRegistries(
|
|
1493
1511
|
enumRegistry,
|
|
1494
1512
|
interfaceRegistry,
|