@effect-gql/core 1.4.6 → 1.4.7

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.
@@ -1,5 +1,5 @@
1
- import { D as DirectiveApplication, C as CacheHint, o as FieldComplexity, i as GraphQLSchemaBuilder, M as MiddlewareContext, K as ExecutionArgs, G as GraphQLExtension, F as FieldComplexityMap } from '../schema-builder-DKvkzU_M.cjs';
2
- export { h as CacheControlScope, d as DirectiveRegistration, b as EnumRegistration, a as FieldRegistration, f as GraphQLEffectContext, c as InputTypeRegistration, I as InterfaceRegistration, e as MiddlewareRegistration, O as ObjectFieldRegistration, S as SubscriptionFieldRegistration, T as TypeRegistration, g as TypeRegistries, U as UnionRegistration } from '../schema-builder-DKvkzU_M.cjs';
1
+ import { D as DirectiveApplication, C as CacheHint, o as FieldComplexity, i as GraphQLSchemaBuilder, M as MiddlewareContext, K as ExecutionArgs, G as GraphQLExtension, F as FieldComplexityMap } from '../schema-builder-CAij36fD.cjs';
2
+ export { h as CacheControlScope, d as DirectiveRegistration, b as EnumRegistration, a as FieldRegistration, f as GraphQLEffectContext, c as InputTypeRegistration, I as InterfaceRegistration, e as MiddlewareRegistration, O as ObjectFieldRegistration, S as SubscriptionFieldRegistration, T as TypeRegistration, g as TypeRegistries, U as UnionRegistration } from '../schema-builder-CAij36fD.cjs';
3
3
  import { DirectiveLocation, GraphQLResolveInfo, DocumentNode, GraphQLError, ExecutionResult, GraphQLSchema } from 'graphql';
4
4
  export { DirectiveLocation } from 'graphql';
5
5
  import { Effect, Stream, Layer } from 'effect';
@@ -1,5 +1,5 @@
1
- import { D as DirectiveApplication, C as CacheHint, o as FieldComplexity, i as GraphQLSchemaBuilder, M as MiddlewareContext, K as ExecutionArgs, G as GraphQLExtension, F as FieldComplexityMap } from '../schema-builder-DKvkzU_M.js';
2
- export { h as CacheControlScope, d as DirectiveRegistration, b as EnumRegistration, a as FieldRegistration, f as GraphQLEffectContext, c as InputTypeRegistration, I as InterfaceRegistration, e as MiddlewareRegistration, O as ObjectFieldRegistration, S as SubscriptionFieldRegistration, T as TypeRegistration, g as TypeRegistries, U as UnionRegistration } from '../schema-builder-DKvkzU_M.js';
1
+ import { D as DirectiveApplication, C as CacheHint, o as FieldComplexity, i as GraphQLSchemaBuilder, M as MiddlewareContext, K as ExecutionArgs, G as GraphQLExtension, F as FieldComplexityMap } from '../schema-builder-CAij36fD.js';
2
+ export { h as CacheControlScope, d as DirectiveRegistration, b as EnumRegistration, a as FieldRegistration, f as GraphQLEffectContext, c as InputTypeRegistration, I as InterfaceRegistration, e as MiddlewareRegistration, O as ObjectFieldRegistration, S as SubscriptionFieldRegistration, T as TypeRegistration, g as TypeRegistries, U as UnionRegistration } from '../schema-builder-CAij36fD.js';
3
3
  import { DirectiveLocation, GraphQLResolveInfo, DocumentNode, GraphQLError, ExecutionResult, GraphQLSchema } from 'graphql';
4
4
  export { DirectiveLocation } from 'graphql';
5
5
  import { Effect, Stream, Layer } from 'effect';
package/builder/index.js CHANGED
@@ -1580,15 +1580,25 @@ var GraphQLSchemaBuilder = class _GraphQLSchemaBuilder {
1580
1580
  }
1581
1581
  /**
1582
1582
  * Build the GraphQL schema (no services required)
1583
+ *
1584
+ * Uses a two-phase approach:
1585
+ * 1. Phase 1: Build enum and input registries first (these may be referenced by other types)
1586
+ * 2. Phase 2: Build interface, object, and union types (which may reference inputs in args)
1587
+ *
1588
+ * This ensures that when object type fields with args are processed,
1589
+ * all registered input types are already available in the inputRegistry.
1583
1590
  */
1584
1591
  buildSchema() {
1585
- const directiveRegistry = this.buildDirectiveRegistry();
1586
1592
  const enumRegistry = this.buildEnumRegistry();
1587
1593
  const inputRegistry = this.buildInputRegistry(enumRegistry);
1588
- const interfaceRegistry = this.buildInterfaceRegistry(enumRegistry);
1594
+ const inputTypeLookupCache = buildInputTypeLookupCache(this.state.inputs, this.state.enums);
1595
+ const directiveRegistry = this.buildDirectiveRegistry(enumRegistry, inputRegistry, inputTypeLookupCache);
1596
+ const interfaceRegistry = this.buildInterfaceRegistry(enumRegistry, inputRegistry, inputTypeLookupCache);
1589
1597
  const { typeRegistry, unionRegistry } = this.buildTypeAndUnionRegistries(
1590
1598
  enumRegistry,
1591
- interfaceRegistry
1599
+ interfaceRegistry,
1600
+ inputRegistry,
1601
+ inputTypeLookupCache
1592
1602
  );
1593
1603
  const fieldCtx = this.createFieldBuilderContext(
1594
1604
  typeRegistry,
@@ -1612,9 +1622,8 @@ var GraphQLSchemaBuilder = class _GraphQLSchemaBuilder {
1612
1622
  subscriptionFields
1613
1623
  });
1614
1624
  }
1615
- buildDirectiveRegistry() {
1625
+ buildDirectiveRegistry(enumRegistry, inputRegistry, cache) {
1616
1626
  const registry = /* @__PURE__ */ new Map();
1617
- const cache = buildInputTypeLookupCache(this.state.inputs, this.state.enums);
1618
1627
  for (const [name, reg] of this.state.directives) {
1619
1628
  const graphqlDirective = new GraphQLDirective({
1620
1629
  name,
@@ -1622,8 +1631,8 @@ var GraphQLSchemaBuilder = class _GraphQLSchemaBuilder {
1622
1631
  locations: [...reg.locations],
1623
1632
  args: reg.args ? toGraphQLArgsWithRegistry(
1624
1633
  reg.args,
1625
- /* @__PURE__ */ new Map(),
1626
- /* @__PURE__ */ new Map(),
1634
+ enumRegistry,
1635
+ inputRegistry,
1627
1636
  this.state.inputs,
1628
1637
  this.state.enums,
1629
1638
  cache
@@ -1673,7 +1682,7 @@ var GraphQLSchemaBuilder = class _GraphQLSchemaBuilder {
1673
1682
  }
1674
1683
  return registry;
1675
1684
  }
1676
- buildInterfaceRegistry(enumRegistry) {
1685
+ buildInterfaceRegistry(enumRegistry, inputRegistry, _cache) {
1677
1686
  const registry = /* @__PURE__ */ new Map();
1678
1687
  const typeRegistry = /* @__PURE__ */ new Map();
1679
1688
  const unionRegistry = /* @__PURE__ */ new Map();
@@ -1699,7 +1708,7 @@ var GraphQLSchemaBuilder = class _GraphQLSchemaBuilder {
1699
1708
  }
1700
1709
  return registry;
1701
1710
  }
1702
- buildTypeAndUnionRegistries(enumRegistry, interfaceRegistry) {
1711
+ buildTypeAndUnionRegistries(enumRegistry, interfaceRegistry, inputRegistry, inputTypeLookupCache) {
1703
1712
  const typeRegistry = /* @__PURE__ */ new Map();
1704
1713
  const unionRegistry = /* @__PURE__ */ new Map();
1705
1714
  const sharedCtx = {
@@ -1708,18 +1717,19 @@ var GraphQLSchemaBuilder = class _GraphQLSchemaBuilder {
1708
1717
  enums: this.state.enums,
1709
1718
  unions: this.state.unions,
1710
1719
  inputs: this.state.inputs,
1711
- typeRegistry,
1712
- interfaceRegistry,
1713
- enumRegistry,
1714
- unionRegistry};
1715
- buildReverseLookups(sharedCtx);
1716
- const sharedFieldCtx = this.createFieldBuilderContext(
1717
1720
  typeRegistry,
1718
1721
  interfaceRegistry,
1719
1722
  enumRegistry,
1720
1723
  unionRegistry,
1721
- /* @__PURE__ */ new Map()
1722
- );
1724
+ inputRegistry
1725
+ };
1726
+ buildReverseLookups(sharedCtx);
1727
+ const sharedFieldCtx = {
1728
+ ...sharedCtx,
1729
+ directiveRegistrations: this.state.directives,
1730
+ middlewares: this.state.middlewares,
1731
+ inputTypeLookupCache
1732
+ };
1723
1733
  for (const [typeName, typeReg] of this.state.types) {
1724
1734
  const implementedInterfaces = typeReg.implements?.map((name) => interfaceRegistry.get(name)).filter(Boolean) ?? [];
1725
1735
  const graphqlType = new GraphQLObjectType({