Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: graphql-hive/federation-composition
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v0.18.0
Choose a base ref
...
head repository: graphql-hive/federation-composition
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v0.18.1
Choose a head ref
  • 6 commits
  • 266 files changed
  • 3 contributors

Commits on Mar 31, 2025

  1. Much prettier (#127)

    kamilkisiela authored Mar 31, 2025

    Verified

    This commit was signed with the committer’s verified signature.
    IvanGoncharov Ivan Goncharov
    Copy the full SHA
    9c69195 View commit details
  2. chore(deps): lock file maintenance (#126)

    This PR contains the following updates:
    
    | Update | Change |
    |---|---|
    | lockFileMaintenance | All locks refreshed |
    
    🔧 This Pull Request updates lock files to use the latest dependency
    versions.
    
    ---
    
    ### Configuration
    
    📅 **Schedule**: Branch creation - "before 4am on monday" (UTC),
    Automerge - At any time (no schedule defined).
    
    🚦 **Automerge**: Enabled.
    
    ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the
    rebase/retry checkbox.
    
    👻 **Immortal**: This PR will be recreated if closed unmerged. Get
    [config
    help](https://redirect.github.com/renovatebot/renovate/discussions) if
    that's undesired.
    
    ---
    
    - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
    this box
    
    ---
    
    This PR was generated by [Mend Renovate](https://mend.io/renovate/).
    View the [repository job
    log](https://developer.mend.io/github/graphql-hive/federation-composition).
    
    <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzOS4yMDcuMSIsInVwZGF0ZWRJblZlciI6IjM5LjIwNy4xIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJkZXBlbmRlbmNpZXMiXX0=-->
    
    Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
    renovate[bot] authored Mar 31, 2025
    Copy the full SHA
    f0fc088 View commit details
  3. Ensure nested key fields are marked as (#129)

    A big diff due to prettier changes
    kamilkisiela authored Mar 31, 2025
    Copy the full SHA
    9382277 View commit details
  4. Format (#131)

    kamilkisiela authored Mar 31, 2025
    Copy the full SHA
    a9d70ac View commit details

Commits on Apr 1, 2025

  1. Stop collecting paths when a leaf field was reached and fix an infini…

    …te loop (#132)
    kamilkisiela authored Apr 1, 2025
    Copy the full SHA
    ae3152c View commit details
  2. Upcoming Release Changes (#130)

    github-actions[bot] authored Apr 1, 2025
    Copy the full SHA
    79403f5 View commit details
Showing with 9,807 additions and 6,399 deletions.
  1. +4 −1 .changeset/config.json
  2. +1 −1 .github/workflows/main.yaml
  3. +2 −2 .github/workflows/pr.yaml
  4. +0 −1 .prettierrc.cjs
  5. +45 −0 CHANGELOG.md
  6. +21 −14 README.md
  7. +320 −309 __tests__/ast.spec.ts
  8. +783 −522 __tests__/composition.spec.ts
  9. +27 −26 __tests__/context.spec.ts
  10. +153 −126 __tests__/cost.spec.ts
  11. +2 −1 __tests__/fixtures/dgs/blink5ab.graphql
  12. +37 −11 __tests__/fixtures/dgs/cower3fc.graphql
  13. +6 −6 __tests__/fixtures/dgs/index.ts
  14. +16 −5 __tests__/fixtures/dgs/light7e6.graphql
  15. +81 −28 __tests__/fixtures/dgs/truly859.graphql
  16. +9 −1 __tests__/fixtures/dgs/yahoob90.graphql
  17. +22 −5 __tests__/fixtures/dgs/yowza9a2.graphql
  18. +2 −1 __tests__/fixtures/huge-schema/along863.graphql
  19. +8 −1 __tests__/fixtures/huge-schema/aside675.graphql
  20. +15 −3 __tests__/fixtures/huge-schema/barge35d.graphql
  21. +2 −1 __tests__/fixtures/huge-schema/blastcfe.graphql
  22. +3 −1 __tests__/fixtures/huge-schema/bumpy9b4.graphql
  23. +29 −5 __tests__/fixtures/huge-schema/cachec31.graphql
  24. +3 −1 __tests__/fixtures/huge-schema/chaincad.graphql
  25. +12 −2 __tests__/fixtures/huge-schema/dairyda2.graphql
  26. +6 −2 __tests__/fixtures/huge-schema/fooey461.graphql
  27. +3 −1 __tests__/fixtures/huge-schema/fooeyb9c.graphql
  28. +3 −1 __tests__/fixtures/huge-schema/fullya44.graphql
  29. +2 −1 __tests__/fixtures/huge-schema/given37c.graphql
  30. +3 −1 __tests__/fixtures/huge-schema/grand2ef.graphql
  31. +3 −1 __tests__/fixtures/huge-schema/hence3ff.graphql
  32. +6 −6 __tests__/fixtures/huge-schema/index.ts
  33. +3 −1 __tests__/fixtures/huge-schema/light4ff.graphql
  34. +12 −2 __tests__/fixtures/huge-schema/loyalb06.graphql
  35. +18 −3 __tests__/fixtures/huge-schema/oddly7d3.graphql
  36. +12 −2 __tests__/fixtures/huge-schema/pearlb19.graphql
  37. +12 −3 __tests__/fixtures/huge-schema/prangd95.graphql
  38. +9 −2 __tests__/fixtures/huge-schema/proudd53.graphql
  39. +6 −1 __tests__/fixtures/huge-schema/sadly5f8.graphql
  40. +6 −1 __tests__/fixtures/huge-schema/short4ee.graphql
  41. +12 −3 __tests__/fixtures/huge-schema/shortb6d.graphql
  42. +2 −1 __tests__/fixtures/huge-schema/sincec84.graphql
  43. +11 −4 __tests__/fixtures/huge-schema/sinced9c.graphql
  44. +42 −7 __tests__/fixtures/huge-schema/undera5c.graphql
  45. +5 −1 __tests__/fixtures/huge-schema/violaaf7.graphql
  46. +4 −1 __tests__/fixtures/huge-schema/wetly057.graphql
  47. +5 −1 __tests__/fixtures/huge-schema/wetly4cd.graphql
  48. +3 −1 __tests__/fixtures/huge-schema/whereaca.graphql
  49. +3 −1 __tests__/fixtures/huge-schema/while25f.graphql
  50. +8 −1 __tests__/fixtures/huge-schema/yahood2a.graphql
  51. +15 −8 __tests__/fixtures/stars-stuff.ts
  52. +60 −48 __tests__/graphql/sort-sdl.spec.ts
  53. +34 −25 __tests__/graphql/transform-supergraph-to-public-schema.spec.ts
  54. +75 −51 __tests__/interface-object-composition.spec.ts
  55. +183 −162 __tests__/override-with-label.spec.ts
  56. +16 −9 __tests__/shared/setup.ts
  57. +4 −2 __tests__/shared/test.d.ts
  58. +96 −70 __tests__/shared/testkit.ts
  59. +2 −2 __tests__/shared/utils.ts
  60. +20 −15 __tests__/subgraph-validation-and-compositon-root-query.spec.ts
  61. +12 −12 __tests__/subgraph/errors/DIRECTIVE_COMPOSITION_ERROR.spec.ts
  62. +98 −98 __tests__/subgraph/errors/DIRECTIVE_DEFINITION_INVALID.spec.ts
  63. +25 −21 __tests__/subgraph/errors/EXTERNAL_UNUSED.spec.ts
  64. +11 −7 __tests__/subgraph/errors/INTERFACE_KEY_NOT_ON_IMPLEMENTATION.spec.ts
  65. +65 −57 __tests__/subgraph/errors/INVALID_GRAPHQL.spec.ts
  66. +5 −5 __tests__/subgraph/errors/INVALID_SHAREABLE_USAGE.spec.ts
  67. +5 −5 __tests__/subgraph/errors/INVALID_SUBGRAPH_NAME.spec.ts
  68. +9 −8 __tests__/subgraph/errors/KEY_DIRECTIVE_IN_FIELDS_ARG.spec.ts
  69. +9 −9 __tests__/subgraph/errors/KEY_FIELDS_HAS_ARGS.spec.ts
  70. +6 −6 __tests__/subgraph/errors/KEY_FIELDS_SELECT_INVALID_TYPE.spec.ts
  71. +12 −12 __tests__/subgraph/errors/KEY_INVALID_FIELDS.spec.ts
  72. +10 −6 __tests__/subgraph/errors/KEY_INVALID_FIELDS_TYPE.spec.ts
  73. +10 −6 __tests__/subgraph/errors/KEY_UNSUPPORTED_ON_INTERFACE.spec.ts
  74. +14 −10 __tests__/subgraph/errors/MERGED_DIRECTIVE_APPLICATION_ON_EXTERNAL.spec.ts
  75. +5 −5 __tests__/subgraph/errors/OVERRIDE_FROM_SELF_ERROR.spec.ts
  76. +11 −7 __tests__/subgraph/errors/OVERRIDE_ON_INTERFACE.spec.ts
  77. +9 −8 __tests__/subgraph/errors/PROVIDES_DIRECTIVE_IN_FIELDS_ARG.spec.ts
  78. +6 −6 __tests__/subgraph/errors/PROVIDES_FIELDS_HAS_ARGS.spec.ts
  79. +16 −12 __tests__/subgraph/errors/PROVIDES_FIELDS_MISSING_EXTERNAL.spec.ts
  80. +17 −13 __tests__/subgraph/errors/PROVIDES_INVALID_FIELDS.spec.ts
  81. +5 −5 __tests__/subgraph/errors/PROVIDES_INVALID_FIELDS_TYPE.spec.ts
  82. +5 −5 __tests__/subgraph/errors/PROVIDES_ON_NON_OBJECT_FIELD.spec.ts
  83. +5 −5 __tests__/subgraph/errors/PROVIDES_UNSUPPORTED_ON_INTERFACE.spec.ts
  84. +7 −7 __tests__/subgraph/errors/QUERY_ROOT_TYPE_INACCESSIBLE.spec.ts
  85. +9 −8 __tests__/subgraph/errors/REQUIRES_DIRECTIVE_IN_FIELDS_ARG.spec.ts
  86. +10 −6 __tests__/subgraph/errors/REQUIRES_FIELDS_MISSING_EXTERNAL.spec.ts
  87. +9 −9 __tests__/subgraph/errors/REQUIRES_INVALID_FIELDS.spec.ts
  88. +14 −10 __tests__/subgraph/errors/REQUIRES_INVALID_FIELDS_TYPE.spec.ts
  89. +5 −5 __tests__/subgraph/errors/REQUIRES_UNSUPPORTED_ON_INTERFACE.spec.ts
  90. +5 −5 __tests__/subgraph/errors/ROOT_MUTATION_USED.spec.ts
  91. +5 −5 __tests__/subgraph/errors/ROOT_QUERY_USED.spec.ts
  92. +5 −5 __tests__/subgraph/errors/ROOT_SUBSCRIPTION_USED.spec.ts
  93. +5 −5 __tests__/subgraph/errors/TYPE_DEFINITION_INVALID.spec.ts
  94. +17 −15 __tests__/subgraph/federation-directives.spec.ts
  95. +13 −13 __tests__/subgraph/key-fields.spec.ts
  96. +44 −31 __tests__/subgraph/link-directive.spec.ts
  97. +12 −8 __tests__/subgraph/to-categorize.spec.ts
  98. +206 −102 __tests__/supergraph-composition.spec.ts
  99. +23 −17 __tests__/supergraph/base.spec.ts
  100. +8 −8 __tests__/supergraph/errors/DEFAULT_VALUE_USES_INACCESSIBLE.spec.ts
  101. +6 −6 __tests__/supergraph/errors/EMPTY_MERGED_ENUM_TYPE.spec.ts
  102. +6 −6 __tests__/supergraph/errors/EMPTY_MERGED_INPUT_TYPE.spec.ts
  103. +9 −9 __tests__/supergraph/errors/ENUM_VALUE_MISMATCH.spec.ts
  104. +31 −27 __tests__/supergraph/errors/EXTENSION_WITH_NO_BASE.spec.ts
  105. +9 −9 __tests__/supergraph/errors/EXTERNAL_ARGUMENT_MISSING.spec.ts
  106. +18 −14 __tests__/supergraph/errors/EXTERNAL_MISSING_ON_BASE.spec.ts
  107. +17 −13 __tests__/supergraph/errors/EXTERNAL_TYPE_MISMATCH.spec.ts
  108. +7 −7 __tests__/supergraph/errors/FIELD_ARGUMENT_DEFAULT_MISMATCH.spec.ts
  109. +6 −6 __tests__/supergraph/errors/FIELD_ARGUMENT_TYPE_MISMATCH.spec.ts
  110. +27 −21 __tests__/supergraph/errors/FIELD_TYPE_MISMATCH.spec.ts
  111. +6 −6 __tests__/supergraph/errors/IMPLEMENTED_BY_INACCESSIBLE.spec.ts
  112. +10 −10 __tests__/supergraph/errors/INPUT_FIELD_DEFAULT_MISMATCH.spec.ts
  113. +20 −16 __tests__/supergraph/errors/INTERFACE_FIELD_NO_IMPLEM.spec.ts
  114. +25 −25 __tests__/supergraph/errors/INTERFACE_KEY_MISSING_IMPLEMENTATION_TYPE.spec.ts
  115. +12 −8 __tests__/supergraph/errors/INTERFACE_OBJECT_USAGE_ERROR.spec.ts
  116. +21 −11 __tests__/supergraph/errors/INVALID-GRAPHQL.spec.ts
  117. +111 −38 __tests__/supergraph/errors/INVALID_FIELD_SHARING.spec.ts
  118. +11 −7 __tests__/supergraph/errors/NO_QUERIES.spec.ts
  119. +18 −14 __tests__/supergraph/errors/ONLY_INACCESSIBLE_CHILDREN.spec.ts
  120. +7 −7 __tests__/supergraph/errors/OVERRIDE_COLLISION_WITH_ANOTHER_DIRECTIVE.spec.ts
  121. +16 −12 __tests__/supergraph/errors/OVERRIDE_SOURCE_HAS_OVERRIDE.spec.ts
  122. +10 −10 __tests__/supergraph/errors/REFERENCED_INACCESSIBLE.spec.ts
  123. +6 −6 __tests__/supergraph/errors/REQUIRED_ARGUMENT_MISSING_IN_SOME_SUBGRAPH.spec.ts
  124. +9 −9 __tests__/supergraph/errors/REQUIRED_INACCESSIBLE.spec.ts
  125. +6 −6 __tests__/supergraph/errors/REQUIRED_INPUT_FIELD_MISSING_IN_SOME_SUBGRAPH.spec.ts
  126. +467 −382 __tests__/supergraph/errors/SATISFIABILITY_ERROR.spec.ts
  127. +7 −7 __tests__/supergraph/errors/TYPE_KIND_MISMATCH.spec.ts
  128. +8 −8 __tests__/supergraph/join.spec.ts
  129. +52 −52 __tests__/supergraph/link.spec.ts
  130. +251 −0 __tests__/todo.spec.ts
  131. +81 −45 __tests__/utils/extract-link.spec.ts
  132. +66 −41 __tests__/utils/link-url.spec.ts
  133. +34 −24 __tests__/utils/link.spec.ts
  134. +47 −20 benchmark.ts
  135. +48 −38 compose.ts
  136. +2 −3 package.json
  137. +207 −567 pnpm-lock.yaml
  138. +62 −56 src/compose.ts
  139. +5 −5 src/graphql/contains-supergraph-spec.ts
  140. +12 −3 src/graphql/helpers.ts
  141. +123 −94 src/graphql/printer.ts
  142. +55 −31 src/graphql/sort-sdl.ts
  143. +30 −23 src/graphql/supergraph-spec.ts
  144. +46 −25 src/graphql/transform-supergraph-to-public-schema.ts
  145. +12 −7 src/graphql/type-node-info.ts
  146. +7 −7 src/index.ts
  147. +4 −1 src/specifications/cost.ts
  148. +76 −53 src/specifications/federation.ts
  149. +2 −2 src/specifications/inaccessible.ts
  150. +12 −9 src/specifications/join.ts
  151. +25 −21 src/specifications/link.spec.ts
  152. +51 −39 src/specifications/link.ts
  153. +2 −2 src/specifications/tag.ts
  154. +104 −50 src/subgraph/helpers.ts
  155. +675 −195 src/subgraph/state.ts
  156. +20 −14 src/subgraph/validation/rules/elements/authenticated.ts
  157. +34 −19 src/subgraph/validation/rules/elements/compose-directive.ts
  158. +13 −7 src/subgraph/validation/rules/elements/context.ts
  159. +30 −18 src/subgraph/validation/rules/elements/cost.ts
  160. +15 −7 src/subgraph/validation/rules/elements/extends.ts
  161. +21 −13 src/subgraph/validation/rules/elements/external.ts
  162. +17 −11 src/subgraph/validation/rules/elements/field-set.ts
  163. +13 −7 src/subgraph/validation/rules/elements/from-context.ts
  164. +26 −19 src/subgraph/validation/rules/elements/inaccessible.ts
  165. +12 −10 src/subgraph/validation/rules/elements/interface-object.ts
  166. +55 −34 src/subgraph/validation/rules/elements/key.ts
  167. +109 −68 src/subgraph/validation/rules/elements/list-size.ts
  168. +41 −26 src/subgraph/validation/rules/elements/override.ts
  169. +37 −19 src/subgraph/validation/rules/elements/policy.ts
  170. +57 −33 src/subgraph/validation/rules/elements/provides.ts
  171. +26 −17 src/subgraph/validation/rules/elements/requires-scopes.ts
  172. +22 −16 src/subgraph/validation/rules/elements/requires.ts
  173. +6 −6 src/subgraph/validation/rules/elements/shareable.ts
  174. +33 −19 src/subgraph/validation/rules/elements/tag.ts
  175. +13 −7 src/subgraph/validation/rules/known-argument-names-on-directives-rule.ts
  176. +22 −14 src/subgraph/validation/rules/known-directives-rule.ts
  177. +9 −7 src/subgraph/validation/rules/known-federation-directive-rule.ts
  178. +10 −6 src/subgraph/validation/rules/known-root-type-rule.ts
  179. +16 −7 src/subgraph/validation/rules/known-type-names-rule.ts
  180. +3 −3 src/subgraph/validation/rules/lone-schema-definition-rule.ts
  181. +19 −12 src/subgraph/validation/rules/only-interface-implementation-rule.ts
  182. +44 −26 src/subgraph/validation/rules/provided-arguments-on-directives-rule.ts
  183. +14 −8 src/subgraph/validation/rules/provided-required-arguments-on-directives-rule.ts
  184. +16 −11 src/subgraph/validation/rules/query-root-type-inaccessible-rule.ts
  185. +7 −5 src/subgraph/validation/rules/reserved-subgraph-name-rule.ts
  186. +11 −9 src/subgraph/validation/rules/root-type-used-rule.ts
  187. +2 −2 src/subgraph/validation/rules/unique-argument-definition-names-rule.ts
  188. +11 −6 src/subgraph/validation/rules/unique-argument-names-rule.ts
  189. +8 −5 src/subgraph/validation/rules/unique-directive-names-rule.ts
  190. +7 −4 src/subgraph/validation/rules/unique-directives-per-location-rule.ts
  191. +16 −6 src/subgraph/validation/rules/unique-enum-value-names-rule.ts
  192. +11 −6 src/subgraph/validation/rules/unique-field-definition-names-rule.ts
  193. +9 −6 src/subgraph/validation/rules/unique-input-field-names-rule.ts
  194. +11 −6 src/subgraph/validation/rules/unique-operation-types-rule.ts
  195. +2 −2 src/subgraph/validation/rules/unique-type-names-rule.ts
  196. +112 −44 src/subgraph/validation/validate-state.ts
  197. +201 −123 src/subgraph/validation/validate-subgraph.ts
  198. +168 −69 src/subgraph/validation/validation-context.ts
  199. +174 −116 src/supergraph/composition/ast.ts
  200. +10 −5 src/supergraph/composition/common.ts
  201. +21 −13 src/supergraph/composition/directive.ts
  202. +38 −26 src/supergraph/composition/enum-type.ts
  203. +40 −23 src/supergraph/composition/input-object-type.ts
  204. +59 −35 src/supergraph/composition/interface-type.ts
  205. +159 −88 src/supergraph/composition/object-type.ts
  206. +21 −14 src/supergraph/composition/scalar-type.ts
  207. +18 −12 src/supergraph/composition/union-type.ts
  208. +25 −12 src/supergraph/composition/visitor.ts
  209. +121 −51 src/supergraph/state.ts
  210. +13 −10 src/supergraph/validation/rules/default-value-uses-inaccessible-rule.ts
  211. +40 −23 src/supergraph/validation/rules/directive-composition-rule.ts
  212. +19 −12 src/supergraph/validation/rules/enum-values-rule.ts
  213. +12 −10 src/supergraph/validation/rules/extension-with-base.ts
  214. +18 −10 src/supergraph/validation/rules/external-argument-missing-rule.ts
  215. +20 −14 src/supergraph/validation/rules/external-missing-on-base-rule.ts
  216. +26 −19 src/supergraph/validation/rules/external-type-mismatch-rule.ts
  217. +15 −13 src/supergraph/validation/rules/field-argument-default-mismatch-rule.ts
  218. +17 −15 src/supergraph/validation/rules/field-arguments-of-the-same-type-rule.ts
  219. +51 −39 src/supergraph/validation/rules/fields-of-the-same-type-rule.ts
  220. +15 −13 src/supergraph/validation/rules/input-field-default-mismatch-rule.ts
  221. +7 −5 src/supergraph/validation/rules/input-object-values-rule.ts
  222. +32 −14 src/supergraph/validation/rules/interface-field-no-implementation-rule.ts
  223. +12 −9 src/supergraph/validation/rules/interface-key-missing-implementation-type.ts
  224. +4 −4 src/supergraph/validation/rules/interface-object-usage-error.ts
  225. +34 −18 src/supergraph/validation/rules/interface-subtype-rule.ts
  226. +43 −24 src/supergraph/validation/rules/invalid-field-sharing-rule.ts
  227. +9 −7 src/supergraph/validation/rules/link-import-name-mismatch-rule.ts
  228. +11 −8 src/supergraph/validation/rules/no-inaccessible-on-implemented-interface-fields-rule.ts
  229. +20 −11 src/supergraph/validation/rules/only-inaccessible-children-rule.ts
  230. +10 −6 src/supergraph/validation/rules/override-source-has-override.ts
  231. +14 −10 src/supergraph/validation/rules/referenced-inaccessible-rule.ts
  232. +13 −10 src/supergraph/validation/rules/required-argument-missing-in-some-subgraph-rule.ts
  233. +11 −7 src/supergraph/validation/rules/required-argument-or-field-is-not-inaccessible-rule.ts
  234. +11 −11 src/supergraph/validation/rules/required-input-field-missing-in-some-subgraph-rule.ts
  235. +4 −4 src/supergraph/validation/rules/required-query-rule.ts
  236. +79 −52 src/supergraph/validation/rules/satisfiablity-rule.ts
  237. +2 −2 src/supergraph/validation/rules/satisfiablity/constants.ts
  238. +28 −12 src/supergraph/validation/rules/satisfiablity/edge.ts
  239. +28 −25 src/supergraph/validation/rules/satisfiablity/errors.ts
  240. +155 −92 src/supergraph/validation/rules/satisfiablity/finder.ts
  241. +268 −132 src/supergraph/validation/rules/satisfiablity/graph.ts
  242. +4 −4 src/supergraph/validation/rules/satisfiablity/helpers.ts
  243. +105 −57 src/supergraph/validation/rules/satisfiablity/move-validator.ts
  244. +8 −7 src/supergraph/validation/rules/satisfiablity/moves.ts
  245. +17 −12 src/supergraph/validation/rules/satisfiablity/node.ts
  246. +6 −6 src/supergraph/validation/rules/satisfiablity/operation-path.ts
  247. +61 −29 src/supergraph/validation/rules/satisfiablity/selection.ts
  248. +21 −15 src/supergraph/validation/rules/satisfiablity/supergraph.ts
  249. +136 −63 src/supergraph/validation/rules/satisfiablity/walker.ts
  250. +4 −4 src/supergraph/validation/rules/subgraph-name-rule.ts
  251. +28 −19 src/supergraph/validation/rules/types-of-the-same-kind-rule.ts
  252. +34 −34 src/supergraph/validation/validate-supergraph.ts
  253. +8 −4 src/supergraph/validation/validation-context.ts
  254. +1 −1 src/types.ts
  255. +41 −19 src/utils/dependency-graph.ts
  256. +15 −5 src/utils/format.ts
  257. +16 −7 src/utils/helpers.ts
  258. +11 −7 src/utils/link/index.ts
  259. +12 −8 src/utils/link/link-import.ts
  260. +17 −8 src/utils/link/link-url.ts
  261. +51 −24 src/utils/link/link.ts
  262. +17 −13 src/utils/logger.ts
  263. +5 −5 src/utils/state.ts
  264. +9 −9 src/utils/version.ts
  265. +50 −28 src/validate.ts
  266. +3 −3 vitest.config.js
5 changes: 4 additions & 1 deletion .changeset/config.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
{
"$schema": "https://unpkg.com/@changesets/config@2.1.0/schema.json",
"changelog": ["@changesets/changelog-github", { "repo": "graphql-hive/federation-composition" }],
"changelog": [
"@changesets/changelog-github",
{ "repo": "graphql-hive/federation-composition" }
],
"commit": false,
"linked": [],
"access": "restricted",
2 changes: 1 addition & 1 deletion .github/workflows/main.yaml
Original file line number Diff line number Diff line change
@@ -9,7 +9,7 @@ jobs:
with:
releaseScript: release
nodeVersion: 21
packageManager: 'pnpm'
packageManager: "pnpm"
secrets:
githubToken: ${{ secrets.GITHUB_TOKEN }}
npmToken: ${{ secrets.NPM_TOKEN }}
4 changes: 2 additions & 2 deletions .github/workflows/pr.yaml
Original file line number Diff line number Diff line change
@@ -13,7 +13,7 @@ jobs:
uses: actions/setup-node@cdca7365b2dadb8aad0a33bc7601856ffabcc48e # v4
with:
node-version: 21
cache: 'pnpm'
cache: "pnpm"
- name: install dependencies
run: pnpm install --frozen-lockfile
- name: typecheck
@@ -33,7 +33,7 @@ jobs:
uses: actions/setup-node@cdca7365b2dadb8aad0a33bc7601856ffabcc48e # v4
with:
node-version: 20
cache: 'pnpm'
cache: "pnpm"
- name: install dependencies
run: pnpm install --frozen-lockfile
- name: bench
1 change: 0 additions & 1 deletion .prettierrc.cjs

This file was deleted.

45 changes: 45 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,50 @@
# @theguild/federation-composition

## 0.18.1

### Patch Changes

- [#129](https://github.com/graphql-hive/federation-composition/pull/129) [`9382277`](https://github.com/graphql-hive/federation-composition/commit/9382277ae4077c6f3d9783df2664e68481618d65) Thanks [@kamilkisiela](https://github.com/kamilkisiela)! - Ensure nested key fields are marked as `@shareable`

- [#132](https://github.com/graphql-hive/federation-composition/pull/132) [`ae3152c`](https://github.com/graphql-hive/federation-composition/commit/ae3152c5e829a1278de9839f8bef3bbeb0472947) Thanks [@kamilkisiela](https://github.com/kamilkisiela)! - Stop collecting paths when a leaf field was reached

- [#132](https://github.com/graphql-hive/federation-composition/pull/132) [`ae3152c`](https://github.com/graphql-hive/federation-composition/commit/ae3152c5e829a1278de9839f8bef3bbeb0472947) Thanks [@kamilkisiela](https://github.com/kamilkisiela)! - Avoid infinite loop when entity field returns itself

## 0.18.0

### Minor Changes

- Support progressive overrides (`@override(label: "<value>")`)

## Patch Changes

- Performance improvements (lazy compute of errors), especially noticeable in large schemas (2s -> 600ms)

## 0.17.0

### Minor Changes

- Allow to use `@composeDirective` on a built-in scalar (like `@oneOf`)

## 0.16.0

### Minor Changes

- Allow to use v2.7, but not progressive `@override` labels
- Allow to use v2.8, but not `@context` and `@fromContext` directives
- Support `@cost` and `@listSize` directives
- Add `extractLinkImplementations` function to extract information about applied specs (`@link`)

### Patch Changes

- Reuse type and direcive definitions from the composition logic to detect a supergraph spec in an SDL or transform a supergraph to a public schema

## 0.15.0

### Minor Changes

- Implement rule for `IMPLEMENTED_BY_INACCESSIBLE` error code.

## 0.14.5

### Patch Changes
35 changes: 21 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
@@ -12,8 +12,8 @@ Supports all Federation versions. Drop-in replacement for `@apollo/composition`.
- produces Supergraph SDL (can be used with Apollo Router and every tool that supports Supergraph
SDL)
- does not support Hints
- 5x faster when composing and validating small to medium schemas (a bit slower for huge schemas)
- 2x less memory usage
- 3-4x faster
- up to 2x less memory usage

## Installation

@@ -29,14 +29,18 @@ yarn add @theguild/federation-composition
## Usage

```ts
import { parse } from 'graphql'
import { composeServices, compositionHasErrors } from '@theguild/federation-composition'
import { parse } from "graphql";
import {
composeServices,
compositionHasErrors,
} from "@theguild/federation-composition";

const result = composeServices([
{
name: 'users',
name: "users",
typeDefs: parse(/* GraphQL */ `
extend schema @link(url: "https://specs.apollo.dev/federation/v2.3", import: ["@key"])
extend schema
@link(url: "https://specs.apollo.dev/federation/v2.3", import: ["@key"])
type User @key(fields: "id") {
id: ID!
@@ -46,13 +50,16 @@ const result = composeServices([
type Query {
users: [User]
}
`)
`),
},
{
name: 'comments',
name: "comments",
typeDefs: parse(/* GraphQL */ `
extend schema
@link(url: "https://specs.apollo.dev/federation/v2.3", import: ["@key", "@external"])
@link(
url: "https://specs.apollo.dev/federation/v2.3"
import: ["@key", "@external"]
)
extend type User @key(fields: "id") {
id: ID! @external
@@ -64,14 +71,14 @@ const result = composeServices([
text: String!
author: User!
}
`)
}
])
`),
},
]);

if (compositionHasErrors(result)) {
console.error(result.errors)
console.error(result.errors);
} else {
console.log(result.supergraphSdl)
console.log(result.supergraphSdl);
}
```

Loading