@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.js CHANGED
@@ -240,6 +240,14 @@ function buildReverseLookups(ctx) {
240
240
  for (const [typeName, typeReg] of ctx.types) {
241
241
  ctx.schemaToTypeName.set(typeReg.schema, typeName);
242
242
  ctx.astToTypeName.set(typeReg.schema.ast, typeName);
243
+ let ast = typeReg.schema.ast;
244
+ while (ast._tag === "Transformation") {
245
+ ast = ast.to;
246
+ ctx.astToTypeName.set(ast, typeName);
247
+ }
248
+ if (ast._tag === "Declaration" && ast.typeParameters?.[0]) {
249
+ ctx.astToTypeName.set(ast.typeParameters[0], typeName);
250
+ }
243
251
  }
244
252
  }
245
253
  if (!ctx.schemaToInterfaceName) {
@@ -248,6 +256,14 @@ function buildReverseLookups(ctx) {
248
256
  for (const [interfaceName, interfaceReg] of ctx.interfaces) {
249
257
  ctx.schemaToInterfaceName.set(interfaceReg.schema, interfaceName);
250
258
  ctx.astToInterfaceName.set(interfaceReg.schema.ast, interfaceName);
259
+ let ast = interfaceReg.schema.ast;
260
+ while (ast._tag === "Transformation") {
261
+ ast = ast.to;
262
+ ctx.astToInterfaceName.set(ast, interfaceName);
263
+ }
264
+ if (ast._tag === "Declaration" && ast.typeParameters?.[0]) {
265
+ ctx.astToInterfaceName.set(ast.typeParameters[0], interfaceName);
266
+ }
251
267
  }
252
268
  }
253
269
  if (!ctx.schemaToInputName) {
@@ -256,6 +272,14 @@ function buildReverseLookups(ctx) {
256
272
  for (const [inputName, inputReg] of ctx.inputs) {
257
273
  ctx.schemaToInputName.set(inputReg.schema, inputName);
258
274
  ctx.astToInputName.set(inputReg.schema.ast, inputName);
275
+ let ast = inputReg.schema.ast;
276
+ while (ast._tag === "Transformation") {
277
+ ast = ast.to;
278
+ ctx.astToInputName.set(ast, inputName);
279
+ }
280
+ if (ast._tag === "Declaration" && ast.typeParameters?.[0]) {
281
+ ctx.astToInputName.set(ast.typeParameters[0], inputName);
282
+ }
259
283
  }
260
284
  }
261
285
  if (!ctx.enumSortedValues) {
@@ -550,6 +574,14 @@ function buildInputTypeLookupCache(inputs, enums) {
550
574
  for (const [inputName, inputReg] of inputs) {
551
575
  cache.schemaToInputName.set(inputReg.schema, inputName);
552
576
  cache.astToInputName.set(inputReg.schema.ast, inputName);
577
+ let ast = inputReg.schema.ast;
578
+ while (ast._tag === "Transformation") {
579
+ ast = ast.to;
580
+ cache.astToInputName.set(ast, inputName);
581
+ }
582
+ if (ast._tag === "Declaration" && ast.typeParameters?.[0]) {
583
+ cache.astToInputName.set(ast.typeParameters[0], inputName);
584
+ }
553
585
  }
554
586
  for (const [enumName, enumReg] of enums) {
555
587
  cache.enumSortedValues.set(enumName, [...enumReg.values].sort());