@graphql-hive/federation-gateway-audit 0.0.0 → 0.0.1

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.
Files changed (395) hide show
  1. package/.github/workflows/ci.yaml +4 -4
  2. package/.github/workflows/release.yml +3 -3
  3. package/CHANGELOG.md +10 -0
  4. package/dist/index.d.cts.map +1 -1
  5. package/dist/index.d.ts.map +1 -1
  6. package/package.json +8 -4
  7. package/src/cli.ts +700 -0
  8. package/src/env.ts +13 -0
  9. package/src/index.ts +262 -0
  10. package/src/subgraph.ts +113 -0
  11. package/src/summary.ts +237 -0
  12. package/src/supergraph.ts +195 -0
  13. package/src/test-suites/abstract-types/agency.subgraph.ts +43 -0
  14. package/src/test-suites/abstract-types/books.subgraph.ts +47 -0
  15. package/src/test-suites/abstract-types/data.ts +120 -0
  16. package/src/test-suites/abstract-types/index.ts +23 -0
  17. package/src/test-suites/abstract-types/inventory.subgraph.ts +142 -0
  18. package/src/test-suites/abstract-types/magazines.subgraph.ts +47 -0
  19. package/src/test-suites/abstract-types/products.subgraph.ts +204 -0
  20. package/src/test-suites/abstract-types/reviews.subgraph.ts +159 -0
  21. package/src/test-suites/abstract-types/test.ts +1084 -0
  22. package/src/test-suites/abstract-types/users.subgraph.ts +31 -0
  23. package/src/test-suites/child-type-mismatch/a.subgraph.ts +27 -0
  24. package/src/test-suites/child-type-mismatch/b.subgraph.ts +51 -0
  25. package/src/test-suites/child-type-mismatch/data.ts +6 -0
  26. package/src/test-suites/child-type-mismatch/index.ts +6 -0
  27. package/{dist/index-Ca0FeU7u.js → src/test-suites/child-type-mismatch/test.ts} +79 -178
  28. package/src/test-suites/circular-reference-interface/a.subgraph.ts +55 -0
  29. package/src/test-suites/circular-reference-interface/b.subgraph.ts +35 -0
  30. package/src/test-suites/circular-reference-interface/data.ts +17 -0
  31. package/src/test-suites/circular-reference-interface/index.ts +6 -0
  32. package/src/test-suites/circular-reference-interface/test.ts +78 -0
  33. package/src/test-suites/complex-entity-call/data.ts +27 -0
  34. package/src/test-suites/complex-entity-call/index.ts +12 -0
  35. package/src/test-suites/complex-entity-call/link.subgraph.ts +36 -0
  36. package/src/test-suites/complex-entity-call/list.subgraph.ts +44 -0
  37. package/src/test-suites/complex-entity-call/price.subgraph.ts +107 -0
  38. package/src/test-suites/complex-entity-call/products.subgraph.ts +65 -0
  39. package/src/test-suites/complex-entity-call/test.ts +74 -0
  40. package/src/test-suites/corrupted-supergraph-node-id/a.subgraph.ts +112 -0
  41. package/src/test-suites/corrupted-supergraph-node-id/b.subgraph.ts +113 -0
  42. package/src/test-suites/corrupted-supergraph-node-id/data.ts +16 -0
  43. package/src/test-suites/corrupted-supergraph-node-id/index.ts +6 -0
  44. package/src/test-suites/corrupted-supergraph-node-id/test.ts +223 -0
  45. package/src/test-suites/enum-intersection/a.subgraph.ts +46 -0
  46. package/src/test-suites/enum-intersection/b.subgraph.ts +51 -0
  47. package/src/test-suites/enum-intersection/data.ts +10 -0
  48. package/src/test-suites/enum-intersection/index.ts +6 -0
  49. package/src/test-suites/enum-intersection/test.ts +108 -0
  50. package/src/test-suites/fed1-external-extends/a.subgraph.ts +51 -0
  51. package/src/test-suites/fed1-external-extends/b.subgraph.ts +48 -0
  52. package/src/test-suites/fed1-external-extends/data.ts +14 -0
  53. package/src/test-suites/fed1-external-extends/index.ts +6 -0
  54. package/src/test-suites/fed1-external-extends/test.ts +90 -0
  55. package/src/test-suites/fed1-external-extends-resolvable/a.subgraph.ts +40 -0
  56. package/src/test-suites/fed1-external-extends-resolvable/b.subgraph.ts +52 -0
  57. package/src/test-suites/fed1-external-extends-resolvable/data.ts +9 -0
  58. package/src/test-suites/fed1-external-extends-resolvable/index.ts +6 -0
  59. package/src/test-suites/fed1-external-extends-resolvable/test.ts +28 -0
  60. package/src/test-suites/fed1-external-extension/a.subgraph.ts +51 -0
  61. package/src/test-suites/fed1-external-extension/b.subgraph.ts +48 -0
  62. package/src/test-suites/fed1-external-extension/data.ts +14 -0
  63. package/src/test-suites/fed1-external-extension/index.ts +6 -0
  64. package/src/test-suites/fed1-external-extension/test.ts +90 -0
  65. package/src/test-suites/fed2-external-extends/a.subgraph.ts +57 -0
  66. package/src/test-suites/fed2-external-extends/b.subgraph.ts +54 -0
  67. package/src/test-suites/fed2-external-extends/data.ts +14 -0
  68. package/src/test-suites/fed2-external-extends/index.ts +6 -0
  69. package/src/test-suites/fed2-external-extends/test.ts +90 -0
  70. package/src/test-suites/fed2-external-extension/a.subgraph.ts +57 -0
  71. package/src/test-suites/fed2-external-extension/b.subgraph.ts +54 -0
  72. package/src/test-suites/fed2-external-extension/data.ts +14 -0
  73. package/src/test-suites/fed2-external-extension/index.ts +6 -0
  74. package/src/test-suites/fed2-external-extension/test.ts +90 -0
  75. package/src/test-suites/include-skip/a.subgraph.ts +42 -0
  76. package/src/test-suites/include-skip/b.subgraph.ts +47 -0
  77. package/src/test-suites/include-skip/c.subgraph.ts +65 -0
  78. package/src/test-suites/include-skip/data.ts +6 -0
  79. package/src/test-suites/include-skip/index.ts +7 -0
  80. package/src/test-suites/include-skip/test.ts +74 -0
  81. package/src/test-suites/input-object-intersection/a.subgraph.ts +47 -0
  82. package/src/test-suites/input-object-intersection/b.subgraph.ts +51 -0
  83. package/src/test-suites/input-object-intersection/data.ts +10 -0
  84. package/src/test-suites/input-object-intersection/index.ts +6 -0
  85. package/src/test-suites/input-object-intersection/test.ts +49 -0
  86. package/src/test-suites/interface-object-indirect-extension/author.subgraph.ts +39 -0
  87. package/src/test-suites/interface-object-indirect-extension/index.ts +11 -0
  88. package/src/test-suites/interface-object-indirect-extension/media.subgraph.ts +63 -0
  89. package/src/test-suites/interface-object-indirect-extension/playlist.subgraph.ts +48 -0
  90. package/src/test-suites/interface-object-indirect-extension/test.ts +57 -0
  91. package/src/test-suites/interface-object-with-requires/a.subgraph.ts +68 -0
  92. package/src/test-suites/interface-object-with-requires/b.subgraph.ts +61 -0
  93. package/src/test-suites/interface-object-with-requires/data.ts +14 -0
  94. package/src/test-suites/interface-object-with-requires/index.ts +6 -0
  95. package/src/test-suites/interface-object-with-requires/test.ts +206 -0
  96. package/src/test-suites/keys-mashup/a.subgraph.ts +46 -0
  97. package/src/test-suites/keys-mashup/b.subgraph.ts +118 -0
  98. package/src/test-suites/keys-mashup/data.ts +43 -0
  99. package/src/test-suites/keys-mashup/index.ts +6 -0
  100. package/src/test-suites/keys-mashup/test.ts +32 -0
  101. package/src/test-suites/mutations/a.subgraph.ts +136 -0
  102. package/src/test-suites/mutations/b.subgraph.ts +107 -0
  103. package/src/test-suites/mutations/c.subgraph.ts +26 -0
  104. package/src/test-suites/mutations/data.ts +91 -0
  105. package/src/test-suites/mutations/index.ts +7 -0
  106. package/src/test-suites/mutations/test.ts +94 -0
  107. package/src/test-suites/mysterious-external/data.ts +12 -0
  108. package/src/test-suites/mysterious-external/index.ts +6 -0
  109. package/src/test-suites/mysterious-external/price.subgraph.ts +55 -0
  110. package/src/test-suites/mysterious-external/product.subgraph.ts +45 -0
  111. package/src/test-suites/mysterious-external/test.ts +51 -0
  112. package/src/test-suites/nested-provides/all-products.subgraph.ts +37 -0
  113. package/src/test-suites/nested-provides/category.subgraph.ts +104 -0
  114. package/src/test-suites/nested-provides/data.ts +28 -0
  115. package/src/test-suites/nested-provides/index.ts +11 -0
  116. package/src/test-suites/nested-provides/subcategories.subgraph.ts +89 -0
  117. package/src/test-suites/nested-provides/test.ts +122 -0
  118. package/src/test-suites/node/data.ts +23 -0
  119. package/src/test-suites/node/index.ts +7 -0
  120. package/src/test-suites/node/node-two.ts +49 -0
  121. package/src/test-suites/node/node.subgraph.ts +68 -0
  122. package/src/test-suites/node/test.ts +28 -0
  123. package/src/test-suites/node/types.subgraph.ts +58 -0
  124. package/src/test-suites/non-resolvable-interface-object/a.subgraph.ts +40 -0
  125. package/src/test-suites/non-resolvable-interface-object/b.subgraph.ts +55 -0
  126. package/src/test-suites/non-resolvable-interface-object/data.ts +7 -0
  127. package/src/test-suites/non-resolvable-interface-object/index.ts +6 -0
  128. package/src/test-suites/non-resolvable-interface-object/test.ts +113 -0
  129. package/src/test-suites/null-keys/a.subgraph.ts +40 -0
  130. package/src/test-suites/null-keys/b.subgraph.ts +42 -0
  131. package/src/test-suites/null-keys/c.subgraph.ts +48 -0
  132. package/src/test-suites/null-keys/data.ts +32 -0
  133. package/src/test-suites/null-keys/index.ts +7 -0
  134. package/src/test-suites/null-keys/test.ts +46 -0
  135. package/src/test-suites/override-type-interface/a.subgraph.ts +47 -0
  136. package/src/test-suites/override-type-interface/b.subgraph.ts +73 -0
  137. package/src/test-suites/override-type-interface/data.ts +27 -0
  138. package/src/test-suites/override-type-interface/index.ts +6 -0
  139. package/src/test-suites/override-type-interface/test.ts +94 -0
  140. package/src/test-suites/override-with-requires/a.subgraph.ts +55 -0
  141. package/src/test-suites/override-with-requires/b.subgraph.ts +42 -0
  142. package/src/test-suites/override-with-requires/c.subgraph.ts +55 -0
  143. package/src/test-suites/override-with-requires/data.ts +14 -0
  144. package/src/test-suites/override-with-requires/index.ts +7 -0
  145. package/src/test-suites/override-with-requires/test.ts +98 -0
  146. package/src/test-suites/parent-entity-call/a.subgraph.ts +90 -0
  147. package/src/test-suites/parent-entity-call/b.subgraph.ts +68 -0
  148. package/src/test-suites/parent-entity-call/c.subgraph.ts +56 -0
  149. package/src/test-suites/parent-entity-call/data.ts +34 -0
  150. package/src/test-suites/parent-entity-call/index.ts +7 -0
  151. package/src/test-suites/parent-entity-call/test.ts +52 -0
  152. package/src/test-suites/parent-entity-call-complex/a.subgraph.ts +29 -0
  153. package/src/test-suites/parent-entity-call-complex/b.subgraph.ts +32 -0
  154. package/src/test-suites/parent-entity-call-complex/c.subgraph.ts +22 -0
  155. package/src/test-suites/parent-entity-call-complex/d.subgraph.ts +35 -0
  156. package/src/test-suites/parent-entity-call-complex/index.ts +8 -0
  157. package/src/test-suites/parent-entity-call-complex/test.ts +32 -0
  158. package/src/test-suites/provides-on-interface/a.subgraph.ts +95 -0
  159. package/src/test-suites/provides-on-interface/b.subgraph.ts +65 -0
  160. package/src/test-suites/provides-on-interface/c.subgraph.ts +119 -0
  161. package/src/test-suites/provides-on-interface/data.ts +24 -0
  162. package/src/test-suites/provides-on-interface/index.ts +7 -0
  163. package/src/test-suites/provides-on-interface/test.ts +68 -0
  164. package/src/test-suites/provides-on-union/a.subgraph.ts +41 -0
  165. package/src/test-suites/provides-on-union/b.subgraph.ts +47 -0
  166. package/src/test-suites/provides-on-union/c.subgraph.ts +59 -0
  167. package/src/test-suites/provides-on-union/data.ts +12 -0
  168. package/src/test-suites/provides-on-union/index.ts +7 -0
  169. package/src/test-suites/provides-on-union/test.ts +62 -0
  170. package/src/test-suites/requires-circular/a.subgraph.ts +72 -0
  171. package/src/test-suites/requires-circular/b.subgraph.ts +46 -0
  172. package/src/test-suites/requires-circular/data.ts +25 -0
  173. package/src/test-suites/requires-circular/index.ts +6 -0
  174. package/src/test-suites/requires-circular/test.ts +46 -0
  175. package/src/test-suites/requires-interface/a.subgraph.ts +92 -0
  176. package/src/test-suites/requires-interface/b.subgraph.ts +82 -0
  177. package/src/test-suites/requires-interface/data.ts +27 -0
  178. package/src/test-suites/requires-interface/index.ts +6 -0
  179. package/src/test-suites/requires-interface/test.ts +96 -0
  180. package/src/test-suites/requires-requires/a.subgraph.ts +33 -0
  181. package/src/test-suites/requires-requires/b.subgraph.ts +42 -0
  182. package/src/test-suites/requires-requires/c.subgraph.ts +65 -0
  183. package/src/test-suites/requires-requires/d.subgraph.ts +71 -0
  184. package/src/test-suites/requires-requires/data.ts +7 -0
  185. package/src/test-suites/requires-requires/index.ts +8 -0
  186. package/src/test-suites/requires-requires/test.ts +88 -0
  187. package/src/test-suites/requires-with-argument/a.subgraph.ts +68 -0
  188. package/src/test-suites/requires-with-argument/b.subgraph.ts +55 -0
  189. package/src/test-suites/requires-with-argument/c.subgraph.ts +71 -0
  190. package/src/test-suites/requires-with-argument/d.subgraph.ts +97 -0
  191. package/src/test-suites/requires-with-argument/data.ts +81 -0
  192. package/src/test-suites/requires-with-argument/index.ts +8 -0
  193. package/src/test-suites/requires-with-argument/test.ts +192 -0
  194. package/src/test-suites/requires-with-argument-conflict/a.subgraph.ts +79 -0
  195. package/src/test-suites/requires-with-argument-conflict/b.subgraph.ts +60 -0
  196. package/src/test-suites/requires-with-argument-conflict/data.ts +20 -0
  197. package/src/test-suites/requires-with-argument-conflict/index.ts +6 -0
  198. package/src/test-suites/requires-with-argument-conflict/test.ts +37 -0
  199. package/src/test-suites/requires-with-fragments/a.subgraph.ts +81 -0
  200. package/src/test-suites/requires-with-fragments/b.subgraph.ts +151 -0
  201. package/src/test-suites/requires-with-fragments/data.ts +30 -0
  202. package/src/test-suites/requires-with-fragments/index.ts +6 -0
  203. package/src/test-suites/requires-with-fragments/test.ts +138 -0
  204. package/src/test-suites/shared-root/category.subgraph.ts +45 -0
  205. package/src/test-suites/shared-root/data.ts +22 -0
  206. package/src/test-suites/shared-root/index.ts +7 -0
  207. package/src/test-suites/shared-root/name.subgraph.ts +46 -0
  208. package/src/test-suites/shared-root/price.subgraph.ts +46 -0
  209. package/src/test-suites/shared-root/test.ts +94 -0
  210. package/src/test-suites/simple-entity-call/data.ts +12 -0
  211. package/src/test-suites/simple-entity-call/email.subgraph.ts +42 -0
  212. package/src/test-suites/simple-entity-call/index.ts +6 -0
  213. package/src/test-suites/simple-entity-call/nickname.subgraph.ts +32 -0
  214. package/src/test-suites/simple-entity-call/test.ts +23 -0
  215. package/src/test-suites/simple-inaccessible/age.subgraph.ts +45 -0
  216. package/src/test-suites/simple-inaccessible/data.ts +12 -0
  217. package/src/test-suites/simple-inaccessible/friends.subgraph.ts +68 -0
  218. package/src/test-suites/simple-inaccessible/index.ts +6 -0
  219. package/src/test-suites/simple-inaccessible/test.ts +124 -0
  220. package/src/test-suites/simple-interface-object/a.subgraph.ts +163 -0
  221. package/src/test-suites/simple-interface-object/b.subgraph.ts +89 -0
  222. package/src/test-suites/simple-interface-object/c.subgraph.ts +48 -0
  223. package/src/test-suites/simple-interface-object/data.ts +38 -0
  224. package/src/test-suites/simple-interface-object/index.ts +7 -0
  225. package/src/test-suites/simple-interface-object/test.ts +367 -0
  226. package/src/test-suites/simple-override/a.subgraph.ts +49 -0
  227. package/src/test-suites/simple-override/b.subgraph.ts +46 -0
  228. package/src/test-suites/simple-override/data.ts +10 -0
  229. package/src/test-suites/simple-override/index.ts +6 -0
  230. package/src/test-suites/simple-override/test.ts +51 -0
  231. package/src/test-suites/simple-requires-provides/accounts.subgraph.ts +48 -0
  232. package/src/test-suites/simple-requires-provides/data.ts +44 -0
  233. package/src/test-suites/simple-requires-provides/index.ts +12 -0
  234. package/src/test-suites/simple-requires-provides/inventory.subgraph.ts +59 -0
  235. package/src/test-suites/simple-requires-provides/products.subgraph.ts +48 -0
  236. package/src/test-suites/simple-requires-provides/reviews.subgraph.ts +106 -0
  237. package/src/test-suites/simple-requires-provides/test.ts +372 -0
  238. package/src/test-suites/typename/a.subgraph.ts +76 -0
  239. package/src/test-suites/typename/b.subgraph.ts +50 -0
  240. package/src/test-suites/typename/data.ts +14 -0
  241. package/src/test-suites/typename/index.ts +6 -0
  242. package/src/test-suites/typename/test.ts +132 -0
  243. package/src/test-suites/unavailable-override/a.subgraph.ts +46 -0
  244. package/src/test-suites/unavailable-override/b.subgraph.ts +46 -0
  245. package/src/test-suites/unavailable-override/data.ts +10 -0
  246. package/src/test-suites/unavailable-override/index.ts +6 -0
  247. package/src/test-suites/unavailable-override/test.ts +51 -0
  248. package/src/test-suites/union-interface-distributed/a.subgraph.ts +126 -0
  249. package/src/test-suites/union-interface-distributed/b.subgraph.ts +39 -0
  250. package/src/test-suites/union-interface-distributed/data.ts +26 -0
  251. package/src/test-suites/union-interface-distributed/index.ts +6 -0
  252. package/src/test-suites/union-interface-distributed/test.ts +244 -0
  253. package/src/test-suites/union-intersection/README.md +3 -0
  254. package/src/test-suites/union-intersection/a.subgraph.ts +83 -0
  255. package/src/test-suites/union-intersection/b.subgraph.ts +79 -0
  256. package/src/test-suites/union-intersection/data.ts +7 -0
  257. package/src/test-suites/union-intersection/index.ts +6 -0
  258. package/{dist/index-Ytb942t9.js → src/test-suites/union-intersection/test.ts} +74 -260
  259. package/src/test.ts +98 -0
  260. package/src/testkit.ts +31 -0
  261. package/.changeset/@graphql-hive_federation-gateway-audit-293-dependencies.md +0 -5
  262. package/.changeset/funky-times-cry.md +0 -5
  263. package/dist/index--3rcSZqA.js +0 -227
  264. package/dist/index-0MDIXUzP.cjs +0 -589
  265. package/dist/index-2oy7cA9A.js +0 -225
  266. package/dist/index-3BM15w2Y.mjs +0 -234
  267. package/dist/index-3CyAnc7j.js +0 -234
  268. package/dist/index-4swHVe9x.cjs +0 -507
  269. package/dist/index-6qNpP2wc.mjs +0 -238
  270. package/dist/index-A2YbwKzc.mjs +0 -288
  271. package/dist/index-B0coRevy.mjs +0 -337
  272. package/dist/index-B1NAc0TI.cjs +0 -215
  273. package/dist/index-B1WvIzTg.js +0 -371
  274. package/dist/index-B55AdoQy.js +0 -273
  275. package/dist/index-B7cr8XE-.js +0 -194
  276. package/dist/index-B7zN3YzE.cjs +0 -683
  277. package/dist/index-B9T896rB.mjs +0 -163
  278. package/dist/index-BEMScD_X.cjs +0 -173
  279. package/dist/index-BGC0_vWj.cjs +0 -335
  280. package/dist/index-BGUm947D.cjs +0 -229
  281. package/dist/index-BKcwbRZx.cjs +0 -339
  282. package/dist/index-BKpVb_h9.cjs +0 -236
  283. package/dist/index-BPFol6Ww.mjs +0 -129
  284. package/dist/index-BPza8i2Q.mjs +0 -213
  285. package/dist/index-BS7JyQSU.js +0 -250
  286. package/dist/index-BSWSgZCO.cjs +0 -252
  287. package/dist/index-BSwOAvti.js +0 -288
  288. package/dist/index-BWO8QbMB.mjs +0 -587
  289. package/dist/index-B_u5Boud.js +0 -333
  290. package/dist/index-BaH3FI9i.cjs +0 -361
  291. package/dist/index-BaluTf1I.cjs +0 -707
  292. package/dist/index-BcoW0aPo.cjs +0 -165
  293. package/dist/index-BdNZKlDU.js +0 -284
  294. package/dist/index-Bf81cAA1.mjs +0 -444
  295. package/dist/index-Bg3H3fgZ.js +0 -259
  296. package/dist/index-Bgl_1Y6Q.mjs +0 -681
  297. package/dist/index-BgryMCqm.mjs +0 -213
  298. package/dist/index-BiTzMTFn.js +0 -304
  299. package/dist/index-BjbmOyBP.cjs +0 -215
  300. package/dist/index-Bm8hqSRd.cjs +0 -168
  301. package/dist/index-BmQrhPXB.cjs +0 -131
  302. package/dist/index-BndUB2KV.mjs +0 -381
  303. package/dist/index-BpJZCoVH.mjs +0 -250
  304. package/dist/index-Br-Y1qC_.cjs +0 -446
  305. package/dist/index-BrFtcRgi.mjs +0 -194
  306. package/dist/index-Bu8SXnTf.mjs +0 -227
  307. package/dist/index-Bwh8HVkw.cjs +0 -384
  308. package/dist/index-BxK3Y72_.js +0 -227
  309. package/dist/index-BxPUzymh.cjs +0 -208
  310. package/dist/index-ByZa9qm8.mjs +0 -273
  311. package/dist/index-Bz_LTy1A.mjs +0 -222
  312. package/dist/index-C1GgHOiD.js +0 -228
  313. package/dist/index-C4Pk-zTm.mjs +0 -227
  314. package/dist/index-C6nkQ480.js +0 -225
  315. package/dist/index-C8Mu4K9Q.cjs +0 -383
  316. package/dist/index-CAJ9YPxc.js +0 -681
  317. package/dist/index-CD03pVUt.cjs +0 -373
  318. package/dist/index-CD8GiuIg.js +0 -227
  319. package/dist/index-CHB_0VqK.mjs +0 -333
  320. package/dist/index-CNvZCDZa.js +0 -166
  321. package/dist/index-COGhiFjk.mjs +0 -284
  322. package/dist/index-COIlelpZ.mjs +0 -262
  323. package/dist/index-CPu_XkjY.mjs +0 -304
  324. package/dist/index-CUFKuE64.js +0 -550
  325. package/dist/index-CW8h3l6M.js +0 -262
  326. package/dist/index-CWrng7Hd.mjs +0 -550
  327. package/dist/index-CXviN8qZ.cjs +0 -224
  328. package/dist/index-C_qaNb-X.mjs +0 -225
  329. package/dist/index-Cb3ImEjd.cjs +0 -165
  330. package/dist/index-Cc3vrs6_.mjs +0 -228
  331. package/dist/index-CcIXvx40.mjs +0 -171
  332. package/dist/index-CdaeeF3f.cjs +0 -306
  333. package/dist/index-Cj2ocjXI.cjs +0 -227
  334. package/dist/index-CkWEXzTN.js +0 -129
  335. package/dist/index-Ckhb9QAu.cjs +0 -264
  336. package/dist/index-CklJfQlf.cjs +0 -220
  337. package/dist/index-Cn0ZJkAv.mjs +0 -280
  338. package/dist/index-Cuw9ylL-.mjs +0 -371
  339. package/dist/index-CwOULUAt.mjs +0 -382
  340. package/dist/index-D-1dDKiZ.mjs +0 -227
  341. package/dist/index-D1Ip6ro6.js +0 -458
  342. package/dist/index-D5tEp8IU.js +0 -337
  343. package/dist/index-D7WuGKYY.cjs +0 -227
  344. package/dist/index-D8Dp6TnQ.cjs +0 -1837
  345. package/dist/index-D9OKpqgG.js +0 -381
  346. package/dist/index-DBMI2EcB.cjs +0 -170
  347. package/dist/index-DBRUKV0U.mjs +0 -225
  348. package/dist/index-DHRqE92a.cjs +0 -290
  349. package/dist/index-DJ3ndv3i.mjs +0 -705
  350. package/dist/index-DJXP-Gmp.js +0 -218
  351. package/dist/index-DJlXDQOY.cjs +0 -200
  352. package/dist/index-DLW4GEJl.cjs +0 -229
  353. package/dist/index-DM4ddIL6.js +0 -382
  354. package/dist/index-DN-ScBql.mjs +0 -458
  355. package/dist/index-DS86eFsI.mjs +0 -1835
  356. package/dist/index-DZws2w4w.cjs +0 -229
  357. package/dist/index-Dbb-jnWf.js +0 -206
  358. package/dist/index-DdXy_-T9.js +0 -444
  359. package/dist/index-DiDq1sL6.cjs +0 -240
  360. package/dist/index-DiuJQ9Mq.js +0 -198
  361. package/dist/index-Dk0q-ENv.mjs +0 -166
  362. package/dist/index-DlFElztE.mjs +0 -163
  363. package/dist/index-DlkxQ-B5.mjs +0 -359
  364. package/dist/index-Du5MxO_2.mjs +0 -505
  365. package/dist/index-DxHMqS-W.js +0 -117
  366. package/dist/index-DyTApTHI.cjs +0 -282
  367. package/dist/index-DzAewrkw.js +0 -238
  368. package/dist/index-EuKHpnHv.mjs +0 -117
  369. package/dist/index-FP6hvgSw.cjs +0 -552
  370. package/dist/index-GDSrKnPp.mjs +0 -198
  371. package/dist/index-GMCZo-KH.js +0 -222
  372. package/dist/index-IawHHRZX.mjs +0 -206
  373. package/dist/index-Jk7MG7tE.cjs +0 -286
  374. package/dist/index-KAC20a9r.js +0 -359
  375. package/dist/index-Ls2fI7y4.js +0 -163
  376. package/dist/index-NIEZaRYg.cjs +0 -261
  377. package/dist/index-PyaLRKuk.mjs +0 -168
  378. package/dist/index-QXYDkAsQ.cjs +0 -119
  379. package/dist/index-SmEIf5jz.mjs +0 -259
  380. package/dist/index-UVyXzNlG.js +0 -705
  381. package/dist/index-VvuhRvnC.mjs +0 -218
  382. package/dist/index-XZiO6uje.cjs +0 -275
  383. package/dist/index-YOlsBREZ.cjs +0 -230
  384. package/dist/index-_2dg_MWu.cjs +0 -460
  385. package/dist/index-eFEW10em.js +0 -213
  386. package/dist/index-f7FiDQMk.js +0 -171
  387. package/dist/index-fdDnq3vQ.js +0 -163
  388. package/dist/index-l8e8ip4U.js +0 -168
  389. package/dist/index-rn-_7-wp.cjs +0 -196
  390. package/dist/index-s27DHpTG.js +0 -1835
  391. package/dist/index-sbc7nDv3.js +0 -213
  392. package/dist/index-vHngHSlz.js +0 -280
  393. package/dist/testkit-C920qivh.js +0 -281
  394. package/dist/testkit-C920qivh.mjs +0 -281
  395. package/dist/testkit-D0rTQ6MD.cjs +0 -286
package/src/index.ts ADDED
@@ -0,0 +1,262 @@
1
+ import {
2
+ createRouter as createFetsRouter,
3
+ Response,
4
+ Router,
5
+ RouterComponentsBase,
6
+ RouterSDK,
7
+ } from "fets";
8
+ import { createServer } from "node:http";
9
+
10
+ async function getTestCases(router: ReturnType<typeof createRouter>) {
11
+ const testCases = await Promise.all(
12
+ [
13
+ import("./test-suites/union-intersection/index.js"),
14
+ import("./test-suites/simple-entity-call/index.js"),
15
+ import("./test-suites/complex-entity-call/index.js"),
16
+ import("./test-suites/mysterious-external/index.js"),
17
+ import("./test-suites/simple-requires-provides/index.js"),
18
+ import("./test-suites/override-type-interface/index.js"),
19
+ import("./test-suites/simple-interface-object/index.js"),
20
+ import("./test-suites/simple-override/index.js"),
21
+ import("./test-suites/unavailable-override/index.js"),
22
+ import("./test-suites/override-with-requires/index.js"),
23
+ import("./test-suites/node/index.js"),
24
+ import("./test-suites/simple-inaccessible/index.js"),
25
+ import("./test-suites/enum-intersection/index.js"),
26
+ import("./test-suites/input-object-intersection/index.js"),
27
+ import("./test-suites/requires-with-fragments/index.js"),
28
+ import("./test-suites/child-type-mismatch/index.js"),
29
+ import("./test-suites/non-resolvable-interface-object/index.js"),
30
+ import("./test-suites/interface-object-with-requires/index.js"),
31
+ import("./test-suites/interface-object-indirect-extension/index.js"),
32
+ import("./test-suites/requires-interface/index.js"),
33
+ import("./test-suites/fed1-external-extends/index.js"),
34
+ import("./test-suites/fed2-external-extends/index.js"),
35
+ import("./test-suites/fed1-external-extension/index.js"),
36
+ import("./test-suites/fed2-external-extension/index.js"),
37
+ import("./test-suites/parent-entity-call/index.js"),
38
+ import("./test-suites/corrupted-supergraph-node-id/index.js"),
39
+ import("./test-suites/parent-entity-call-complex/index.js"),
40
+ import("./test-suites/shared-root/index.js"),
41
+ import("./test-suites/nested-provides/index.js"),
42
+ import("./test-suites/provides-on-interface/index.js"),
43
+ import("./test-suites/provides-on-union/index.js"),
44
+ import("./test-suites/requires-requires/index.js"),
45
+ import("./test-suites/include-skip/index.js"),
46
+ import("./test-suites/circular-reference-interface/index.js"),
47
+ import("./test-suites/typename/index.js"),
48
+ import("./test-suites/union-interface-distributed/index.js"),
49
+ import("./test-suites/mutations/index.js"),
50
+ import("./test-suites/abstract-types/index.js"),
51
+ import("./test-suites/fed1-external-extends-resolvable/index.js"),
52
+ import("./test-suites/requires-with-argument/index.js"),
53
+ import("./test-suites/requires-with-argument-conflict/index.js"),
54
+ import("./test-suites/keys-mashup/index.js"),
55
+ import("./test-suites/null-keys/index.js"),
56
+ import("./test-suites/requires-circular/index.js"),
57
+ ].map((i) => i.then((e) => e.default)),
58
+ );
59
+
60
+ testCases.sort((a, b) => a.id.localeCompare(b.id));
61
+
62
+ const registeredNames = new Set<string>();
63
+
64
+ for (const testCase of testCases) {
65
+ if (registeredNames.has(testCase.id)) {
66
+ throw new Error(`Duplicate test case id: ${testCase.id}`);
67
+ }
68
+
69
+ registeredNames.add(testCase.id);
70
+ testCase.createRoutes(router);
71
+ }
72
+
73
+ return testCases;
74
+ }
75
+
76
+ export function serve(port: number) {
77
+ const router = createRouter();
78
+ const { resolve, reject, promise } = Promise.withResolvers<{
79
+ close: VoidFunction;
80
+ }>();
81
+
82
+ let started = false;
83
+ const server = createServer(router).listen(port, () => {
84
+ started = true;
85
+ resolve({
86
+ close,
87
+ });
88
+ });
89
+
90
+ server.once("error", (error) => {
91
+ if (!started) {
92
+ reject(error);
93
+ } else {
94
+ process.stderr.write("Server error: " + String(error));
95
+ }
96
+ });
97
+
98
+ function close() {
99
+ if (server.listening) {
100
+ return new Promise<void>((resolve, reject) => {
101
+ server.closeAllConnections();
102
+ server.close((error) => {
103
+ if (error) {
104
+ reject(error);
105
+ } else {
106
+ resolve();
107
+ }
108
+ });
109
+ });
110
+ }
111
+ }
112
+
113
+ server.once("close", () => {
114
+ console.log("Server closed");
115
+ });
116
+
117
+ process.once("exit", () => {
118
+ close();
119
+ });
120
+
121
+ process.once("SIGINT", () => {
122
+ close();
123
+ });
124
+
125
+ process.once("SIGTERM", () => {
126
+ close();
127
+ });
128
+
129
+ return promise;
130
+ }
131
+
132
+ export function createRouter<TServerContext>(): Router<
133
+ TServerContext,
134
+ RouterComponentsBase,
135
+ RouterSDK
136
+ > {
137
+ const router = createFetsRouter({
138
+ landingPage: false,
139
+ swaggerUI: {
140
+ endpoint: "/",
141
+ displayOperationId: false,
142
+ },
143
+ openAPI: {
144
+ info: {
145
+ title: "Federation Compatibility Test Suite",
146
+ description:
147
+ "A test suite for validating Apollo Federation v2 compatibility",
148
+ contact: {
149
+ name: "The Guild",
150
+ url: "https://the-guild.dev",
151
+ email: "contact@the-guild.dev",
152
+ },
153
+ },
154
+ },
155
+ })
156
+ .route({
157
+ method: "GET",
158
+ path: "/_health",
159
+ handler() {
160
+ return new Response("OK");
161
+ },
162
+ })
163
+ .route({
164
+ method: "GET",
165
+ path: "/ids",
166
+ operationId: "get_ids",
167
+ description: "A list of test cases",
168
+ tags: ["root"],
169
+ schemas: {
170
+ responses: {
171
+ 200: {
172
+ type: "array",
173
+ items: {
174
+ type: "string",
175
+ },
176
+ },
177
+ },
178
+ },
179
+ handler() {
180
+ return testCases$.then((testCases) =>
181
+ Response.json(testCases.map((t) => t.id)),
182
+ );
183
+ },
184
+ })
185
+ .route({
186
+ method: "GET",
187
+ path: "/supergraphs",
188
+ description: "A list of supergraph endpoints",
189
+ tags: ["root"],
190
+ schemas: {
191
+ responses: {
192
+ 200: {
193
+ type: "array",
194
+ items: {
195
+ type: "string",
196
+ },
197
+ },
198
+ },
199
+ },
200
+ handler(req) {
201
+ return testCases$.then((testCases) =>
202
+ Response.json(
203
+ testCases.map(
204
+ ({ id }) => `${req.parsedUrl.origin}/${id}/supergraph`,
205
+ ),
206
+ ),
207
+ );
208
+ },
209
+ })
210
+ .route({
211
+ method: "GET",
212
+ path: "/tests",
213
+ description: "A list of endpoints with tests",
214
+ tags: ["root"],
215
+ schemas: {
216
+ responses: {
217
+ 200: {
218
+ type: "array",
219
+ items: {
220
+ type: "string",
221
+ },
222
+ },
223
+ },
224
+ },
225
+ handler(req) {
226
+ return testCases$.then((testCases) =>
227
+ Response.json(
228
+ testCases.map(({ id }) => `${req.parsedUrl.origin}/${id}/tests`),
229
+ ),
230
+ );
231
+ },
232
+ })
233
+ .route({
234
+ method: "GET",
235
+ path: "/subgraphs",
236
+ description: "A list of endpoints with subgraphs",
237
+ tags: ["root"],
238
+ schemas: {
239
+ responses: {
240
+ 200: {
241
+ type: "array",
242
+ items: {
243
+ type: "string",
244
+ },
245
+ },
246
+ },
247
+ },
248
+ handler(req) {
249
+ return testCases$.then((testCases) =>
250
+ Response.json(
251
+ testCases.map(
252
+ ({ id }) => `${req.parsedUrl.origin}/${id}/subgraphs`,
253
+ ),
254
+ ),
255
+ );
256
+ },
257
+ });
258
+
259
+ const testCases$ = getTestCases(router);
260
+
261
+ return router;
262
+ }
@@ -0,0 +1,113 @@
1
+ import { createRouter, Response } from "fets";
2
+ import { parse } from "graphql";
3
+ import { buildSubgraphSchema } from "@apollo/subgraph";
4
+ import { createYoga } from "graphql-yoga";
5
+
6
+ export function createSubgraph(
7
+ name: string,
8
+ schemaParameters: {
9
+ typeDefs: string;
10
+ resolvers: any;
11
+ },
12
+ ) {
13
+ let schema: ReturnType<typeof buildSubgraphSchema>;
14
+
15
+ function lazySchema() {
16
+ if (!schema) {
17
+ schema = buildSubgraphSchema({
18
+ typeDefs: parse(schemaParameters.typeDefs),
19
+ resolvers: schemaParameters.resolvers,
20
+ });
21
+ }
22
+
23
+ return schema;
24
+ }
25
+
26
+ function lazyYoga() {
27
+ if (!yoga) {
28
+ yoga = createYoga({
29
+ schema: lazySchema(),
30
+ graphqlEndpoint: "*",
31
+ logging: false,
32
+ maskedErrors: false,
33
+ });
34
+ }
35
+
36
+ return yoga;
37
+ }
38
+
39
+ let yoga: ReturnType<typeof createYoga>;
40
+
41
+ return {
42
+ createRoutes(testCaseId: string, router: ReturnType<typeof createRouter>) {
43
+ router.route({
44
+ method: "GET",
45
+ path: `/${testCaseId}/${name}`,
46
+ tags: [testCaseId],
47
+ operationId: "GraphiQL",
48
+ schemas: {
49
+ request: {
50
+ query: {
51
+ type: "object",
52
+ properties: {
53
+ query: { type: "string" },
54
+ },
55
+ additionalProperties: true,
56
+ required: ["query"],
57
+ },
58
+ },
59
+ },
60
+ handler(req) {
61
+ return lazyYoga()(req) as Promise<Response>;
62
+ },
63
+ });
64
+
65
+ router.route({
66
+ method: "POST",
67
+ path: `/${testCaseId}/${name}`,
68
+ tags: [testCaseId],
69
+ operationId: `"${name}" subgraph`,
70
+ description: "GraphQL endpoint for the subgraph",
71
+ schemas: {
72
+ request: {
73
+ json: {
74
+ type: "object",
75
+ properties: {
76
+ query: { type: "string" },
77
+ variables: { type: "object" },
78
+ },
79
+ additionalProperties: true,
80
+ required: ["query"],
81
+ },
82
+ },
83
+ responses: {
84
+ 200: {
85
+ type: "object",
86
+ properties: {
87
+ data: { type: "object" },
88
+ errors: {
89
+ type: "array",
90
+ items: {
91
+ type: "object",
92
+ properties: {
93
+ message: { type: "string" },
94
+ },
95
+ required: ["message"],
96
+ additionalProperties: false,
97
+ },
98
+ },
99
+ },
100
+ required: ["data"],
101
+ additionalProperties: false,
102
+ },
103
+ },
104
+ },
105
+ handler(req) {
106
+ return lazyYoga()(req) as Promise<any>;
107
+ },
108
+ });
109
+ },
110
+ name,
111
+ typeDefs: schemaParameters.typeDefs,
112
+ };
113
+ }
package/src/summary.ts ADDED
@@ -0,0 +1,237 @@
1
+ import { readdirSync, readFileSync, statSync, writeFileSync } from "node:fs";
2
+ import { join } from "node:path";
3
+ import prettier from "prettier";
4
+
5
+ const gatewayResults = readdirSync("./gateways")
6
+ .filter((file) => statSync(join("./gateways", file)).isDirectory())
7
+ .map((id) => {
8
+ const gatewayDetails = JSON.parse(
9
+ readFileSync(join("./gateways", id, "gateway.json"), "utf-8"),
10
+ ) as { name: string; repository: string; website: string };
11
+
12
+ const lines = readFileSync(
13
+ join("./gateways", id, "results.txt"),
14
+ "utf-8",
15
+ ).split("\n");
16
+
17
+ const groups = {
18
+ total: 0,
19
+ passed: 0,
20
+ failed: 0,
21
+ };
22
+ const tests = {
23
+ total: 0,
24
+ passed: 0,
25
+ failed: 0,
26
+ };
27
+ const dot: Array<{
28
+ group: string;
29
+ results: string;
30
+ }> = [];
31
+
32
+ let collectingDetails = true;
33
+ let previousGroupName: string | null = null;
34
+ for (const line of lines) {
35
+ if (collectingDetails) {
36
+ if (line.charAt(0) === "." || line.charAt(0) === "X") {
37
+ groups.total++;
38
+
39
+ if (!line.includes("X")) {
40
+ groups.passed++;
41
+ }
42
+
43
+ if (!previousGroupName) {
44
+ throw new Error("No previous group found");
45
+ }
46
+
47
+ dot.push({
48
+ group: previousGroupName,
49
+ results: line.replaceAll(".", "🟢").replaceAll("X", "❌"),
50
+ });
51
+ } else if (line.trim() === "" || line === "---") {
52
+ collectingDetails = false;
53
+ } else {
54
+ previousGroupName = line;
55
+ }
56
+ } else if (line.startsWith("Passed:")) {
57
+ tests.passed = parseInt(line.replace("Passed:", "").trim());
58
+ } else if (line.startsWith("Failed:")) {
59
+ tests.failed = parseInt(line.replace("Failed:", "").trim());
60
+ } else if (line.startsWith("Total:")) {
61
+ tests.total = parseInt(line.replace("Total:", "").trim());
62
+ }
63
+ }
64
+
65
+ groups.failed = groups.total - groups.passed;
66
+
67
+ const name = gatewayDetails?.name ?? id;
68
+
69
+ return {
70
+ id,
71
+ name,
72
+ repository: gatewayDetails.repository,
73
+ website: gatewayDetails.website,
74
+ groups,
75
+ tests,
76
+ dot,
77
+ };
78
+ });
79
+
80
+ gatewayResults.sort((a, b) => {
81
+ const diff = b.tests.passed - a.tests.passed;
82
+
83
+ if (diff !== 0) {
84
+ // 9 -> 1
85
+ return diff;
86
+ }
87
+
88
+ // A -> Z
89
+ return a.name.localeCompare(b.name);
90
+ });
91
+
92
+ function printResult(
93
+ result: { passed: number; failed: number },
94
+ format: "md" | "html",
95
+ ) {
96
+ const scores: string[] = [];
97
+
98
+ if (result.passed) {
99
+ if (format === "md") {
100
+ scores.push(`🟢 ${result.passed}`);
101
+ } else {
102
+ scores.push(
103
+ `<span class="text-emerald-700 mr-2">✓ ${result.passed}</span>`,
104
+ );
105
+ }
106
+ }
107
+
108
+ if (result.failed) {
109
+ if (format === "md") {
110
+ scores.push(`❌ ${result.failed}`);
111
+ } else {
112
+ scores.push(`<span class="text-red-700">✗ ${result.failed}</span>`);
113
+ }
114
+ }
115
+
116
+ return scores.join(" ");
117
+ }
118
+
119
+ let tableMd = `| Gateway | Compatibility | Test Cases | Test Suites |
120
+ | :---------------------------: | :-----------: | :----------: | :---------: |`;
121
+ let rowsHtml = ``;
122
+ let testDetailsMd = "";
123
+
124
+ const jsonReport: Array<{
125
+ name: string;
126
+ cases: { passed: number; failed: number };
127
+ suites: { passed: number; failed: number };
128
+ }> = [];
129
+
130
+ for (const gateway of gatewayResults) {
131
+ jsonReport.push({
132
+ name: gateway.name,
133
+ cases: gateway.tests,
134
+ suites: gateway.groups,
135
+ });
136
+
137
+ const score = ((gateway.tests.passed * 100) / gateway.tests.total).toFixed(2);
138
+ const roundedScore = Math.round(
139
+ (gateway.tests.passed * 100) / gateway.tests.total,
140
+ );
141
+ tableMd += `\n| [${gateway.name}](${gateway.website}) | ${score}% | ${printResult(gateway.tests, "md")} | ${printResult(gateway.groups, "md")} |`;
142
+
143
+ rowsHtml += `
144
+ <tr class="border-b transition-colors hover:bg-gray-100/50">
145
+ <td class="p-4 align-middle font-medium border-l-2 border-${roundedScore === 100 ? "emerald" : roundedScore >= 75 ? "yellow" : "red"}-500">
146
+ <a href="${gateway.website}" class="hover:underline" title="Visit ${gateway.name} website">
147
+ ${gateway.name}
148
+ </a>
149
+ </td>
150
+ <td class="p-4 align-middle font-semibold">${score}%</td>
151
+ <td class="p-4 align-middle">
152
+ ${printResult(gateway.tests, "html")}
153
+ </td>
154
+ <td class="p-4 align-middle">
155
+ ${printResult(gateway.groups, "html")}
156
+ </td>
157
+ <td class="p-4 align-middle"><a href="https://github.com/the-guild-org/federation-compatibility/tree/main/REPORT.md#${gateway.id}" class="text-sky-700 hover:underline">View report</a></td>
158
+ </tr>
159
+ `;
160
+
161
+ testDetailsMd += `\n<a id="${gateway.id}"></a>
162
+ ### ${gateway.name}
163
+
164
+ - [Repository](${gateway.repository})
165
+ - [Website](${gateway.website})
166
+
167
+ <details>
168
+ <summary>Results</summary>\n`;
169
+
170
+ for (const { group, results } of gateway.dot) {
171
+ testDetailsMd += `<a href="./src/test-suites/${group}">${group}</a>\n<pre>${results}</pre>\n`;
172
+ }
173
+
174
+ testDetailsMd += `</details>\n`;
175
+ }
176
+
177
+ const reportMd = `# Compatibility Results
178
+
179
+ ## Summary
180
+
181
+ ${tableMd}
182
+
183
+ ## Detailed Results
184
+
185
+ Take a closer look at the results for each gateway.
186
+
187
+ You can look at the full list of tests [here](./src/test-suites/). Every test id corresponds to a directory in the \`src/test-suites\` folder.
188
+ ${testDetailsMd}`;
189
+
190
+ await writeFormatted("./REPORT.md", reportMd);
191
+
192
+ const readmeMd = readFileSync("./README.md", "utf-8");
193
+ const indexHtml = readFileSync("./website/index.html", "utf-8");
194
+
195
+ const startTag = "<!-- gateways:start -->";
196
+ const endTag = "<!-- gateways:end -->";
197
+ const mdStartAt = readmeMd.indexOf(startTag);
198
+ const mdEndAt = readmeMd.indexOf(endTag);
199
+ const htmlStartAt = indexHtml.indexOf(startTag);
200
+ const htmlEndAt = indexHtml.indexOf(endTag);
201
+
202
+ const newReadmeMd =
203
+ readmeMd.substring(0, mdStartAt) +
204
+ "\n\n" +
205
+ startTag +
206
+ "\n\n" +
207
+ tableMd +
208
+ "\n\n" +
209
+ readmeMd.substring(mdEndAt);
210
+
211
+ await writeFormatted("./README.md", newReadmeMd);
212
+
213
+ const newIndexHtml =
214
+ indexHtml.substring(0, htmlStartAt) +
215
+ "\n" +
216
+ startTag +
217
+ "\n" +
218
+ rowsHtml +
219
+ "\n" +
220
+ indexHtml.substring(htmlEndAt);
221
+
222
+ writeFormatted("./website/index.html", newIndexHtml);
223
+
224
+ writeFileSync(
225
+ "./website/data.json",
226
+ JSON.stringify(jsonReport, null, 2),
227
+ "utf-8",
228
+ );
229
+
230
+ async function writeFormatted(filename: string, content: string) {
231
+ writeFileSync(
232
+ filename,
233
+ await prettier.format(content, {
234
+ filepath: filename,
235
+ }),
236
+ );
237
+ }