@effect-gql/core 1.4.2 → 1.4.3

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 CHANGED
@@ -262,6 +262,14 @@ function buildReverseLookups(ctx) {
262
262
  for (const [typeName, typeReg] of ctx.types) {
263
263
  ctx.schemaToTypeName.set(typeReg.schema, typeName);
264
264
  ctx.astToTypeName.set(typeReg.schema.ast, typeName);
265
+ let ast = typeReg.schema.ast;
266
+ while (ast._tag === "Transformation") {
267
+ ast = ast.to;
268
+ ctx.astToTypeName.set(ast, typeName);
269
+ }
270
+ if (ast._tag === "Declaration" && ast.typeParameters?.[0]) {
271
+ ctx.astToTypeName.set(ast.typeParameters[0], typeName);
272
+ }
265
273
  }
266
274
  }
267
275
  if (!ctx.schemaToInterfaceName) {
@@ -270,6 +278,14 @@ function buildReverseLookups(ctx) {
270
278
  for (const [interfaceName, interfaceReg] of ctx.interfaces) {
271
279
  ctx.schemaToInterfaceName.set(interfaceReg.schema, interfaceName);
272
280
  ctx.astToInterfaceName.set(interfaceReg.schema.ast, interfaceName);
281
+ let ast = interfaceReg.schema.ast;
282
+ while (ast._tag === "Transformation") {
283
+ ast = ast.to;
284
+ ctx.astToInterfaceName.set(ast, interfaceName);
285
+ }
286
+ if (ast._tag === "Declaration" && ast.typeParameters?.[0]) {
287
+ ctx.astToInterfaceName.set(ast.typeParameters[0], interfaceName);
288
+ }
273
289
  }
274
290
  }
275
291
  if (!ctx.schemaToInputName) {
@@ -278,6 +294,14 @@ function buildReverseLookups(ctx) {
278
294
  for (const [inputName, inputReg] of ctx.inputs) {
279
295
  ctx.schemaToInputName.set(inputReg.schema, inputName);
280
296
  ctx.astToInputName.set(inputReg.schema.ast, inputName);
297
+ let ast = inputReg.schema.ast;
298
+ while (ast._tag === "Transformation") {
299
+ ast = ast.to;
300
+ ctx.astToInputName.set(ast, inputName);
301
+ }
302
+ if (ast._tag === "Declaration" && ast.typeParameters?.[0]) {
303
+ ctx.astToInputName.set(ast.typeParameters[0], inputName);
304
+ }
281
305
  }
282
306
  }
283
307
  if (!ctx.enumSortedValues) {
@@ -572,6 +596,14 @@ function buildInputTypeLookupCache(inputs, enums) {
572
596
  for (const [inputName, inputReg] of inputs) {
573
597
  cache.schemaToInputName.set(inputReg.schema, inputName);
574
598
  cache.astToInputName.set(inputReg.schema.ast, inputName);
599
+ let ast = inputReg.schema.ast;
600
+ while (ast._tag === "Transformation") {
601
+ ast = ast.to;
602
+ cache.astToInputName.set(ast, inputName);
603
+ }
604
+ if (ast._tag === "Declaration" && ast.typeParameters?.[0]) {
605
+ cache.astToInputName.set(ast.typeParameters[0], inputName);
606
+ }
575
607
  }
576
608
  for (const [enumName, enumReg] of enums) {
577
609
  cache.enumSortedValues.set(enumName, [...enumReg.values].sort());