@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.
- package/builder/index.cjs +27 -17
- package/builder/index.cjs.map +1 -1
- package/builder/index.d.cts +2 -2
- package/builder/index.d.ts +2 -2
- package/builder/index.js +27 -17
- package/builder/index.js.map +1 -1
- package/index.cjs +27 -17
- package/index.cjs.map +1 -1
- package/index.d.cts +2 -2
- package/index.d.ts +2 -2
- package/index.js +27 -17
- package/index.js.map +1 -1
- package/package.json +1 -1
- package/{schema-builder-DKvkzU_M.d.cts → schema-builder-CAij36fD.d.cts} +7 -0
- package/{schema-builder-DKvkzU_M.d.ts → schema-builder-CAij36fD.d.ts} +7 -0
- package/server/index.d.cts +2 -2
- package/server/index.d.ts +2 -2
package/builder/index.cjs
CHANGED
|
@@ -1602,15 +1602,25 @@ var GraphQLSchemaBuilder = class _GraphQLSchemaBuilder {
|
|
|
1602
1602
|
}
|
|
1603
1603
|
/**
|
|
1604
1604
|
* Build the GraphQL schema (no services required)
|
|
1605
|
+
*
|
|
1606
|
+
* Uses a two-phase approach:
|
|
1607
|
+
* 1. Phase 1: Build enum and input registries first (these may be referenced by other types)
|
|
1608
|
+
* 2. Phase 2: Build interface, object, and union types (which may reference inputs in args)
|
|
1609
|
+
*
|
|
1610
|
+
* This ensures that when object type fields with args are processed,
|
|
1611
|
+
* all registered input types are already available in the inputRegistry.
|
|
1605
1612
|
*/
|
|
1606
1613
|
buildSchema() {
|
|
1607
|
-
const directiveRegistry = this.buildDirectiveRegistry();
|
|
1608
1614
|
const enumRegistry = this.buildEnumRegistry();
|
|
1609
1615
|
const inputRegistry = this.buildInputRegistry(enumRegistry);
|
|
1610
|
-
const
|
|
1616
|
+
const inputTypeLookupCache = buildInputTypeLookupCache(this.state.inputs, this.state.enums);
|
|
1617
|
+
const directiveRegistry = this.buildDirectiveRegistry(enumRegistry, inputRegistry, inputTypeLookupCache);
|
|
1618
|
+
const interfaceRegistry = this.buildInterfaceRegistry(enumRegistry, inputRegistry, inputTypeLookupCache);
|
|
1611
1619
|
const { typeRegistry, unionRegistry } = this.buildTypeAndUnionRegistries(
|
|
1612
1620
|
enumRegistry,
|
|
1613
|
-
interfaceRegistry
|
|
1621
|
+
interfaceRegistry,
|
|
1622
|
+
inputRegistry,
|
|
1623
|
+
inputTypeLookupCache
|
|
1614
1624
|
);
|
|
1615
1625
|
const fieldCtx = this.createFieldBuilderContext(
|
|
1616
1626
|
typeRegistry,
|
|
@@ -1634,9 +1644,8 @@ var GraphQLSchemaBuilder = class _GraphQLSchemaBuilder {
|
|
|
1634
1644
|
subscriptionFields
|
|
1635
1645
|
});
|
|
1636
1646
|
}
|
|
1637
|
-
buildDirectiveRegistry() {
|
|
1647
|
+
buildDirectiveRegistry(enumRegistry, inputRegistry, cache) {
|
|
1638
1648
|
const registry = /* @__PURE__ */ new Map();
|
|
1639
|
-
const cache = buildInputTypeLookupCache(this.state.inputs, this.state.enums);
|
|
1640
1649
|
for (const [name, reg] of this.state.directives) {
|
|
1641
1650
|
const graphqlDirective = new graphql.GraphQLDirective({
|
|
1642
1651
|
name,
|
|
@@ -1644,8 +1653,8 @@ var GraphQLSchemaBuilder = class _GraphQLSchemaBuilder {
|
|
|
1644
1653
|
locations: [...reg.locations],
|
|
1645
1654
|
args: reg.args ? toGraphQLArgsWithRegistry(
|
|
1646
1655
|
reg.args,
|
|
1647
|
-
|
|
1648
|
-
|
|
1656
|
+
enumRegistry,
|
|
1657
|
+
inputRegistry,
|
|
1649
1658
|
this.state.inputs,
|
|
1650
1659
|
this.state.enums,
|
|
1651
1660
|
cache
|
|
@@ -1695,7 +1704,7 @@ var GraphQLSchemaBuilder = class _GraphQLSchemaBuilder {
|
|
|
1695
1704
|
}
|
|
1696
1705
|
return registry;
|
|
1697
1706
|
}
|
|
1698
|
-
buildInterfaceRegistry(enumRegistry) {
|
|
1707
|
+
buildInterfaceRegistry(enumRegistry, inputRegistry, _cache) {
|
|
1699
1708
|
const registry = /* @__PURE__ */ new Map();
|
|
1700
1709
|
const typeRegistry = /* @__PURE__ */ new Map();
|
|
1701
1710
|
const unionRegistry = /* @__PURE__ */ new Map();
|
|
@@ -1721,7 +1730,7 @@ var GraphQLSchemaBuilder = class _GraphQLSchemaBuilder {
|
|
|
1721
1730
|
}
|
|
1722
1731
|
return registry;
|
|
1723
1732
|
}
|
|
1724
|
-
buildTypeAndUnionRegistries(enumRegistry, interfaceRegistry) {
|
|
1733
|
+
buildTypeAndUnionRegistries(enumRegistry, interfaceRegistry, inputRegistry, inputTypeLookupCache) {
|
|
1725
1734
|
const typeRegistry = /* @__PURE__ */ new Map();
|
|
1726
1735
|
const unionRegistry = /* @__PURE__ */ new Map();
|
|
1727
1736
|
const sharedCtx = {
|
|
@@ -1730,18 +1739,19 @@ var GraphQLSchemaBuilder = class _GraphQLSchemaBuilder {
|
|
|
1730
1739
|
enums: this.state.enums,
|
|
1731
1740
|
unions: this.state.unions,
|
|
1732
1741
|
inputs: this.state.inputs,
|
|
1733
|
-
typeRegistry,
|
|
1734
|
-
interfaceRegistry,
|
|
1735
|
-
enumRegistry,
|
|
1736
|
-
unionRegistry};
|
|
1737
|
-
buildReverseLookups(sharedCtx);
|
|
1738
|
-
const sharedFieldCtx = this.createFieldBuilderContext(
|
|
1739
1742
|
typeRegistry,
|
|
1740
1743
|
interfaceRegistry,
|
|
1741
1744
|
enumRegistry,
|
|
1742
1745
|
unionRegistry,
|
|
1743
|
-
|
|
1744
|
-
|
|
1746
|
+
inputRegistry
|
|
1747
|
+
};
|
|
1748
|
+
buildReverseLookups(sharedCtx);
|
|
1749
|
+
const sharedFieldCtx = {
|
|
1750
|
+
...sharedCtx,
|
|
1751
|
+
directiveRegistrations: this.state.directives,
|
|
1752
|
+
middlewares: this.state.middlewares,
|
|
1753
|
+
inputTypeLookupCache
|
|
1754
|
+
};
|
|
1745
1755
|
for (const [typeName, typeReg] of this.state.types) {
|
|
1746
1756
|
const implementedInterfaces = typeReg.implements?.map((name) => interfaceRegistry.get(name)).filter(Boolean) ?? [];
|
|
1747
1757
|
const graphqlType = new graphql.GraphQLObjectType({
|