@effect-gql/core 1.4.0 → 1.4.1
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 +29 -14
- package/builder/index.cjs.map +1 -1
- package/builder/index.js +29 -14
- package/builder/index.js.map +1 -1
- package/index.cjs +30 -14
- package/index.cjs.map +1 -1
- package/index.js +30 -14
- package/index.js.map +1 -1
- package/package.json +1 -1
package/builder/index.cjs
CHANGED
|
@@ -98,6 +98,7 @@ var toGraphQLType = (schema) => {
|
|
|
98
98
|
const fields = {};
|
|
99
99
|
for (const field2 of ast.propertySignatures) {
|
|
100
100
|
const fieldName = String(field2.name);
|
|
101
|
+
if (fieldName === "_tag") continue;
|
|
101
102
|
const fieldSchema = S__namespace.make(field2.type);
|
|
102
103
|
let fieldType = toGraphQLType(fieldSchema);
|
|
103
104
|
if (!field2.isOptional) {
|
|
@@ -173,6 +174,7 @@ var toGraphQLInputType = (schema) => {
|
|
|
173
174
|
const fields = {};
|
|
174
175
|
for (const field2 of ast.propertySignatures) {
|
|
175
176
|
const fieldName = String(field2.name);
|
|
177
|
+
if (fieldName === "_tag") continue;
|
|
176
178
|
const fieldSchema = S__namespace.make(field2.type);
|
|
177
179
|
let fieldType = toGraphQLInputType(fieldSchema);
|
|
178
180
|
if (!field2.isOptional) {
|
|
@@ -223,6 +225,7 @@ var toGraphQLArgs = (schema) => {
|
|
|
223
225
|
const args = {};
|
|
224
226
|
for (const field2 of ast.propertySignatures) {
|
|
225
227
|
const fieldName = String(field2.name);
|
|
228
|
+
if (fieldName === "_tag") continue;
|
|
226
229
|
const fieldSchema = S__namespace.make(field2.type);
|
|
227
230
|
let fieldType = toGraphQLInputType(fieldSchema);
|
|
228
231
|
if (!field2.isOptional) {
|
|
@@ -470,14 +473,21 @@ function schemaToFields(schema, ctx) {
|
|
|
470
473
|
}
|
|
471
474
|
if (ast._tag === "Declaration") {
|
|
472
475
|
const typeParams = ast.typeParameters;
|
|
473
|
-
if (typeParams && typeParams.length > 0
|
|
474
|
-
|
|
476
|
+
if (typeParams && typeParams.length > 0) {
|
|
477
|
+
let innerAst = typeParams[0];
|
|
478
|
+
while (innerAst._tag === "Transformation") {
|
|
479
|
+
innerAst = innerAst.to;
|
|
480
|
+
}
|
|
481
|
+
if (innerAst._tag === "TypeLiteral") {
|
|
482
|
+
ast = innerAst;
|
|
483
|
+
}
|
|
475
484
|
}
|
|
476
485
|
}
|
|
477
486
|
if (ast._tag === "TypeLiteral") {
|
|
478
487
|
const fields = {};
|
|
479
488
|
for (const field2 of ast.propertySignatures) {
|
|
480
489
|
const fieldName = String(field2.name);
|
|
490
|
+
if (fieldName === "_tag") continue;
|
|
481
491
|
const fieldSchema = S__namespace.make(field2.type);
|
|
482
492
|
let fieldType = toGraphQLTypeWithRegistry(fieldSchema, ctx);
|
|
483
493
|
if (!field2.isOptional) {
|
|
@@ -490,11 +500,15 @@ function schemaToFields(schema, ctx) {
|
|
|
490
500
|
return {};
|
|
491
501
|
}
|
|
492
502
|
function schemaToInputFields(schema, enumRegistry, inputRegistry, inputs, enums, cache) {
|
|
493
|
-
|
|
503
|
+
let ast = schema.ast;
|
|
504
|
+
while (ast._tag === "Transformation") {
|
|
505
|
+
ast = ast.to;
|
|
506
|
+
}
|
|
494
507
|
if (ast._tag === "TypeLiteral") {
|
|
495
508
|
const fields = {};
|
|
496
509
|
for (const field2 of ast.propertySignatures) {
|
|
497
510
|
const fieldName = String(field2.name);
|
|
511
|
+
if (fieldName === "_tag") continue;
|
|
498
512
|
const fieldSchema = S__namespace.make(field2.type);
|
|
499
513
|
let fieldType = toGraphQLInputTypeWithRegistry(
|
|
500
514
|
fieldSchema,
|
|
@@ -534,17 +548,6 @@ function buildInputTypeLookupCache(inputs, enums) {
|
|
|
534
548
|
}
|
|
535
549
|
function toGraphQLInputTypeWithRegistry(schema, enumRegistry, inputRegistry, inputs, enums, cache) {
|
|
536
550
|
const ast = schema.ast;
|
|
537
|
-
if (ast._tag === "Transformation") {
|
|
538
|
-
const toAst = ast.to;
|
|
539
|
-
return toGraphQLInputTypeWithRegistry(
|
|
540
|
-
S__namespace.make(toAst),
|
|
541
|
-
enumRegistry,
|
|
542
|
-
inputRegistry,
|
|
543
|
-
inputs,
|
|
544
|
-
enums,
|
|
545
|
-
cache
|
|
546
|
-
);
|
|
547
|
-
}
|
|
548
551
|
if (cache?.schemaToInputName || cache?.astToInputName) {
|
|
549
552
|
const inputName = cache.schemaToInputName?.get(schema) ?? cache.astToInputName?.get(ast);
|
|
550
553
|
if (inputName) {
|
|
@@ -559,6 +562,17 @@ function toGraphQLInputTypeWithRegistry(schema, enumRegistry, inputRegistry, inp
|
|
|
559
562
|
}
|
|
560
563
|
}
|
|
561
564
|
}
|
|
565
|
+
if (ast._tag === "Transformation") {
|
|
566
|
+
const toAst = ast.to;
|
|
567
|
+
return toGraphQLInputTypeWithRegistry(
|
|
568
|
+
S__namespace.make(toAst),
|
|
569
|
+
enumRegistry,
|
|
570
|
+
inputRegistry,
|
|
571
|
+
inputs,
|
|
572
|
+
enums,
|
|
573
|
+
cache
|
|
574
|
+
);
|
|
575
|
+
}
|
|
562
576
|
if (ast._tag === "Union") {
|
|
563
577
|
const unionAst = ast;
|
|
564
578
|
const nonUndefinedTypes = unionAst.types.filter((t) => t._tag !== "UndefinedKeyword");
|
|
@@ -630,6 +644,7 @@ function toGraphQLArgsWithRegistry(schema, enumRegistry, inputRegistry, inputs,
|
|
|
630
644
|
const args = {};
|
|
631
645
|
for (const field2 of ast.propertySignatures) {
|
|
632
646
|
const fieldName = String(field2.name);
|
|
647
|
+
if (fieldName === "_tag") continue;
|
|
633
648
|
const fieldSchema = S__namespace.make(field2.type);
|
|
634
649
|
let fieldType = toGraphQLInputTypeWithRegistry(
|
|
635
650
|
fieldSchema,
|