@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.js
CHANGED
|
@@ -76,6 +76,7 @@ var toGraphQLType = (schema) => {
|
|
|
76
76
|
const fields = {};
|
|
77
77
|
for (const field2 of ast.propertySignatures) {
|
|
78
78
|
const fieldName = String(field2.name);
|
|
79
|
+
if (fieldName === "_tag") continue;
|
|
79
80
|
const fieldSchema = S.make(field2.type);
|
|
80
81
|
let fieldType = toGraphQLType(fieldSchema);
|
|
81
82
|
if (!field2.isOptional) {
|
|
@@ -151,6 +152,7 @@ var toGraphQLInputType = (schema) => {
|
|
|
151
152
|
const fields = {};
|
|
152
153
|
for (const field2 of ast.propertySignatures) {
|
|
153
154
|
const fieldName = String(field2.name);
|
|
155
|
+
if (fieldName === "_tag") continue;
|
|
154
156
|
const fieldSchema = S.make(field2.type);
|
|
155
157
|
let fieldType = toGraphQLInputType(fieldSchema);
|
|
156
158
|
if (!field2.isOptional) {
|
|
@@ -201,6 +203,7 @@ var toGraphQLArgs = (schema) => {
|
|
|
201
203
|
const args = {};
|
|
202
204
|
for (const field2 of ast.propertySignatures) {
|
|
203
205
|
const fieldName = String(field2.name);
|
|
206
|
+
if (fieldName === "_tag") continue;
|
|
204
207
|
const fieldSchema = S.make(field2.type);
|
|
205
208
|
let fieldType = toGraphQLInputType(fieldSchema);
|
|
206
209
|
if (!field2.isOptional) {
|
|
@@ -448,14 +451,21 @@ function schemaToFields(schema, ctx) {
|
|
|
448
451
|
}
|
|
449
452
|
if (ast._tag === "Declaration") {
|
|
450
453
|
const typeParams = ast.typeParameters;
|
|
451
|
-
if (typeParams && typeParams.length > 0
|
|
452
|
-
|
|
454
|
+
if (typeParams && typeParams.length > 0) {
|
|
455
|
+
let innerAst = typeParams[0];
|
|
456
|
+
while (innerAst._tag === "Transformation") {
|
|
457
|
+
innerAst = innerAst.to;
|
|
458
|
+
}
|
|
459
|
+
if (innerAst._tag === "TypeLiteral") {
|
|
460
|
+
ast = innerAst;
|
|
461
|
+
}
|
|
453
462
|
}
|
|
454
463
|
}
|
|
455
464
|
if (ast._tag === "TypeLiteral") {
|
|
456
465
|
const fields = {};
|
|
457
466
|
for (const field2 of ast.propertySignatures) {
|
|
458
467
|
const fieldName = String(field2.name);
|
|
468
|
+
if (fieldName === "_tag") continue;
|
|
459
469
|
const fieldSchema = S.make(field2.type);
|
|
460
470
|
let fieldType = toGraphQLTypeWithRegistry(fieldSchema, ctx);
|
|
461
471
|
if (!field2.isOptional) {
|
|
@@ -468,11 +478,15 @@ function schemaToFields(schema, ctx) {
|
|
|
468
478
|
return {};
|
|
469
479
|
}
|
|
470
480
|
function schemaToInputFields(schema, enumRegistry, inputRegistry, inputs, enums, cache) {
|
|
471
|
-
|
|
481
|
+
let ast = schema.ast;
|
|
482
|
+
while (ast._tag === "Transformation") {
|
|
483
|
+
ast = ast.to;
|
|
484
|
+
}
|
|
472
485
|
if (ast._tag === "TypeLiteral") {
|
|
473
486
|
const fields = {};
|
|
474
487
|
for (const field2 of ast.propertySignatures) {
|
|
475
488
|
const fieldName = String(field2.name);
|
|
489
|
+
if (fieldName === "_tag") continue;
|
|
476
490
|
const fieldSchema = S.make(field2.type);
|
|
477
491
|
let fieldType = toGraphQLInputTypeWithRegistry(
|
|
478
492
|
fieldSchema,
|
|
@@ -512,17 +526,6 @@ function buildInputTypeLookupCache(inputs, enums) {
|
|
|
512
526
|
}
|
|
513
527
|
function toGraphQLInputTypeWithRegistry(schema, enumRegistry, inputRegistry, inputs, enums, cache) {
|
|
514
528
|
const ast = schema.ast;
|
|
515
|
-
if (ast._tag === "Transformation") {
|
|
516
|
-
const toAst = ast.to;
|
|
517
|
-
return toGraphQLInputTypeWithRegistry(
|
|
518
|
-
S.make(toAst),
|
|
519
|
-
enumRegistry,
|
|
520
|
-
inputRegistry,
|
|
521
|
-
inputs,
|
|
522
|
-
enums,
|
|
523
|
-
cache
|
|
524
|
-
);
|
|
525
|
-
}
|
|
526
529
|
if (cache?.schemaToInputName || cache?.astToInputName) {
|
|
527
530
|
const inputName = cache.schemaToInputName?.get(schema) ?? cache.astToInputName?.get(ast);
|
|
528
531
|
if (inputName) {
|
|
@@ -537,6 +540,17 @@ function toGraphQLInputTypeWithRegistry(schema, enumRegistry, inputRegistry, inp
|
|
|
537
540
|
}
|
|
538
541
|
}
|
|
539
542
|
}
|
|
543
|
+
if (ast._tag === "Transformation") {
|
|
544
|
+
const toAst = ast.to;
|
|
545
|
+
return toGraphQLInputTypeWithRegistry(
|
|
546
|
+
S.make(toAst),
|
|
547
|
+
enumRegistry,
|
|
548
|
+
inputRegistry,
|
|
549
|
+
inputs,
|
|
550
|
+
enums,
|
|
551
|
+
cache
|
|
552
|
+
);
|
|
553
|
+
}
|
|
540
554
|
if (ast._tag === "Union") {
|
|
541
555
|
const unionAst = ast;
|
|
542
556
|
const nonUndefinedTypes = unionAst.types.filter((t) => t._tag !== "UndefinedKeyword");
|
|
@@ -608,6 +622,7 @@ function toGraphQLArgsWithRegistry(schema, enumRegistry, inputRegistry, inputs,
|
|
|
608
622
|
const args = {};
|
|
609
623
|
for (const field2 of ast.propertySignatures) {
|
|
610
624
|
const fieldName = String(field2.name);
|
|
625
|
+
if (fieldName === "_tag") continue;
|
|
611
626
|
const fieldSchema = S.make(field2.type);
|
|
612
627
|
let fieldType = toGraphQLInputTypeWithRegistry(
|
|
613
628
|
fieldSchema,
|