@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
@@ -1,1837 +0,0 @@
1
- 'use strict';
2
-
3
- var testkit = require('./testkit-D0rTQ6MD.cjs');
4
- require('@apollo/composition');
5
- require('graphql');
6
- require('fets');
7
- require('@apollo/subgraph');
8
- require('graphql-yoga');
9
-
10
- const users = [
11
- {
12
- id: "u1",
13
- email: "u1@example.com",
14
- name: "u1-name"
15
- },
16
- {
17
- id: "u2",
18
- email: "u2@example.com",
19
- name: "u2-name"
20
- },
21
- {
22
- id: "u3",
23
- email: "u3@example.com",
24
- name: "u3-name"
25
- }
26
- ];
27
- const books = [
28
- {
29
- __typename: "Book",
30
- id: "p1",
31
- sku: "sku-1",
32
- title: "Book 1",
33
- createdBy: "u1",
34
- dimensions: {
35
- size: "small",
36
- weight: 0.5
37
- },
38
- publisher: {
39
- __typename: "Self",
40
- email: users[0].email
41
- },
42
- hidden: false
43
- },
44
- {
45
- __typename: "Book",
46
- id: "p3",
47
- sku: "sku-3",
48
- title: "Book 2",
49
- createdBy: "u2",
50
- dimensions: {
51
- size: "small",
52
- weight: 0.6
53
- },
54
- publisher: {
55
- __typename: "Agency",
56
- id: "a1"
57
- },
58
- hidden: false
59
- }
60
- ];
61
- const magazines = [
62
- {
63
- __typename: "Magazine",
64
- id: "p2",
65
- sku: "sku-2",
66
- title: "Magazine 1",
67
- createdBy: "u1",
68
- dimensions: {
69
- size: "small",
70
- weight: 0.2
71
- },
72
- publisher: {
73
- __typename: "Agency",
74
- id: "a1"
75
- },
76
- hidden: false
77
- },
78
- {
79
- __typename: "Magazine",
80
- id: "p4",
81
- sku: "sku-4",
82
- title: "Magazine 2",
83
- createdBy: "u2",
84
- dimensions: {
85
- size: "small",
86
- weight: 0.3
87
- },
88
- publisher: {
89
- __typename: "Self",
90
- email: users[0].email
91
- },
92
- hidden: true
93
- }
94
- ];
95
- const products = [...books, ...magazines];
96
- const reviews = [
97
- {
98
- id: 1,
99
- body: "review 1",
100
- productId: "p1",
101
- score: 3
102
- },
103
- {
104
- id: 2,
105
- body: "review 2",
106
- productId: "p1",
107
- score: 4
108
- },
109
- {
110
- id: 3,
111
- body: "review 3",
112
- productId: "p2",
113
- score: 5
114
- }
115
- ];
116
- const agencies = [
117
- {
118
- id: "a1",
119
- companyName: "Agency 1",
120
- email: {
121
- address: "a1@example.com"
122
- }
123
- }
124
- ];
125
-
126
- var inventorySubgraph = testkit.createSubgraph("inventory", {
127
- typeDefs: (
128
- /* GraphQL */
129
- `
130
- extend schema
131
- @link(
132
- url: "https://specs.apollo.dev/federation/v2.3"
133
- import: ["@key", "@shareable", "@external", "@requires"]
134
- )
135
-
136
- interface Product {
137
- id: ID!
138
- dimensions: ProductDimension
139
- delivery(zip: String): DeliveryEstimates
140
- }
141
-
142
- type Book implements Product @key(fields: "id") {
143
- id: ID!
144
- dimensions: ProductDimension @external
145
- delivery(zip: String): DeliveryEstimates
146
- @requires(fields: "dimensions { size weight }")
147
- }
148
-
149
- type Magazine implements Product @key(fields: "id") {
150
- id: ID!
151
- dimensions: ProductDimension @external
152
- delivery(zip: String): DeliveryEstimates
153
- @requires(fields: "dimensions { size weight }")
154
- }
155
-
156
- type ProductDimension @shareable {
157
- size: String
158
- weight: Float
159
- }
160
-
161
- type DeliveryEstimates {
162
- estimatedDelivery: String
163
- fastestDelivery: String
164
- }
165
- `
166
- ),
167
- resolvers: {
168
- Book: {
169
- __resolveReference(key) {
170
- const book = books.find((book2) => book2.id === key.id);
171
- if (!book) {
172
- return null;
173
- }
174
- return {
175
- __typename: book.__typename,
176
- id: book.id,
177
- dimensions: key.dimensions
178
- };
179
- },
180
- delivery({ dimensions }, { zip }) {
181
- if (!zip) {
182
- return null;
183
- }
184
- if (!dimensions) {
185
- return null;
186
- }
187
- if (dimensions.size === "small" && dimensions.weight < 1) {
188
- return {
189
- estimatedDelivery: "1 day",
190
- fastestDelivery: "same day"
191
- };
192
- }
193
- if (dimensions.size === "large" && dimensions.weight >= 1) {
194
- return {
195
- estimatedDelivery: "3 days",
196
- fastestDelivery: "2 days"
197
- };
198
- }
199
- return null;
200
- }
201
- },
202
- Magazine: {
203
- __resolveReference(key) {
204
- const magazine = magazines.find((magazine2) => magazine2.id === key.id);
205
- if (!magazine) {
206
- return null;
207
- }
208
- return {
209
- __typename: magazine.__typename,
210
- id: magazine.id,
211
- dimensions: key.dimensions
212
- };
213
- },
214
- delivery({ dimensions }, { zip }) {
215
- if (!zip) {
216
- return null;
217
- }
218
- if (!dimensions) {
219
- return null;
220
- }
221
- if (dimensions.size === "small" && dimensions.weight < 1) {
222
- return {
223
- estimatedDelivery: "1 day",
224
- fastestDelivery: "same day"
225
- };
226
- }
227
- if (dimensions.size === "large" && dimensions.weight >= 1) {
228
- return {
229
- estimatedDelivery: "3 days",
230
- fastestDelivery: "2 days"
231
- };
232
- }
233
- return null;
234
- }
235
- }
236
- }
237
- });
238
-
239
- var booksSubgraph = testkit.createSubgraph("books", {
240
- typeDefs: (
241
- /* GraphQL */
242
- `
243
- schema
244
- @link(
245
- url: "https://specs.apollo.dev/federation/v2.3"
246
- import: ["@key", "@shareable", "@external", "@requires"]
247
- ) {
248
- query: Query
249
- }
250
-
251
- type Book @key(fields: "id") {
252
- id: ID!
253
- title: String
254
- }
255
-
256
- type Query {
257
- books: [Book]
258
- }
259
- `
260
- ),
261
- resolvers: {
262
- Query: {
263
- books() {
264
- return books.map((book) => ({
265
- __typename: "Book",
266
- id: book.id,
267
- title: book.title
268
- }));
269
- }
270
- },
271
- Book: {
272
- __resolveReference(key) {
273
- const book = books.find((book2) => book2.id === key.id);
274
- return book ? {
275
- __typename: "Book",
276
- id: book.id,
277
- title: book.title
278
- } : null;
279
- }
280
- }
281
- }
282
- });
283
-
284
- var usersSubgraph = testkit.createSubgraph("users", {
285
- typeDefs: (
286
- /* GraphQL */
287
- `
288
- type User @key(fields: "email") {
289
- email: ID!
290
- name: String
291
- totalProductsCreated: Int
292
- }
293
- `
294
- ),
295
- resolvers: {
296
- User: {
297
- __resolveReference(key) {
298
- const user = users.find((user2) => user2.email === key.email);
299
- return user ? {
300
- __typename: "User",
301
- id: user.id,
302
- email: user.email,
303
- name: user.name
304
- } : null;
305
- },
306
- totalProductsCreated(user) {
307
- return products.filter((p) => p.createdBy === user.id).length;
308
- }
309
- }
310
- }
311
- });
312
-
313
- var productsSubgraph = testkit.createSubgraph("products", {
314
- typeDefs: (
315
- /* GraphQL */
316
- `
317
- schema
318
- @link(
319
- url: "https://specs.apollo.dev/federation/v2.3"
320
- import: ["@key", "@shareable", "@inaccessible", "@external"]
321
- ) {
322
- query: Query
323
- }
324
-
325
- type Query {
326
- products: [Product]
327
- similar(id: ID!): [Product]
328
- }
329
-
330
- interface Product {
331
- id: ID!
332
- sku: String
333
- dimensions: ProductDimension
334
- createdBy: User
335
- hidden: Boolean @inaccessible
336
- }
337
-
338
- interface Similar {
339
- similar: [Product]
340
- }
341
-
342
- type ProductDimension @shareable {
343
- size: String
344
- weight: Float
345
- }
346
-
347
- type Book implements Product & Similar @key(fields: "id") {
348
- id: ID!
349
- sku: String
350
- dimensions: ProductDimension @shareable
351
- createdBy: User
352
- similar: [Book]
353
- hidden: Boolean
354
- publisherType: PublisherType
355
- }
356
-
357
- type Magazine implements Product & Similar @key(fields: "id") {
358
- id: ID!
359
- sku: String
360
- dimensions: ProductDimension @shareable
361
- createdBy: User
362
- similar: [Magazine]
363
- hidden: Boolean
364
- publisherType: PublisherType
365
- }
366
-
367
- union PublisherType = Agency | Self
368
-
369
- type Agency {
370
- id: ID! @shareable
371
- }
372
-
373
- type Self {
374
- email: String
375
- }
376
-
377
- type User @key(fields: "email") {
378
- email: ID!
379
- totalProductsCreated: Int @shareable
380
- }
381
- `
382
- ),
383
- resolvers: {
384
- Query: {
385
- products() {
386
- return products.map((p) => ({
387
- __typename: p.__typename,
388
- id: p.id,
389
- sku: p.sku,
390
- dimensions: p.dimensions,
391
- createdBy: p.createdBy,
392
- hidden: p.hidden,
393
- publisherType: p.publisher
394
- }));
395
- },
396
- similar(_, { id }) {
397
- const product = products.find((product2) => product2.id === id);
398
- if (!product) {
399
- return [];
400
- }
401
- const similar = products.filter(
402
- (p) => p.id !== product.id && p.__typename === product.__typename
403
- );
404
- return similar.map((b) => ({
405
- __typename: b.__typename,
406
- id: b.id,
407
- sku: b.sku,
408
- dimensions: b.dimensions,
409
- createdBy: b.createdBy,
410
- hidden: b.hidden,
411
- publisherType: b.publisher
412
- }));
413
- }
414
- },
415
- Book: {
416
- __resolveReference(key) {
417
- const book = books.find((book2) => book2.id === key.id);
418
- return book ? {
419
- __typename: book.__typename,
420
- id: book.id,
421
- sku: book.sku,
422
- dimensions: book.dimensions,
423
- createdBy: book.createdBy,
424
- hidden: book.hidden,
425
- publisherType: book.publisher
426
- } : null;
427
- },
428
- similar(book) {
429
- return books.filter((b) => b.id !== book.id).map((b) => ({
430
- __typename: b.__typename,
431
- id: b.id,
432
- sku: b.sku,
433
- dimensions: b.dimensions,
434
- createdBy: b.createdBy,
435
- hidden: b.hidden,
436
- publisherType: b.publisher
437
- }));
438
- },
439
- createdBy(book) {
440
- const user = users.find((user2) => user2.id === book.createdBy);
441
- return user ? {
442
- __typename: "User",
443
- id: user.id,
444
- email: user.email
445
- } : null;
446
- }
447
- },
448
- Magazine: {
449
- __resolveReference(key) {
450
- const magazine = magazines.find((magazine2) => magazine2.id === key.id);
451
- return magazine ? {
452
- __typename: magazine.__typename,
453
- id: magazine.id,
454
- sku: magazine.sku,
455
- dimensions: magazine.dimensions,
456
- createdBy: magazine.createdBy,
457
- hidden: magazine.hidden,
458
- publisherType: magazine.publisher
459
- } : null;
460
- },
461
- similar(magazine) {
462
- return magazines.filter((m) => m.id !== magazine.id).map((m) => ({
463
- __typename: m.__typename,
464
- id: m.id,
465
- sku: m.sku,
466
- dimensions: m.dimensions,
467
- createdBy: m.createdBy,
468
- hidden: m.hidden,
469
- publisherType: m.publisher
470
- }));
471
- },
472
- createdBy(magazine) {
473
- const user = users.find((user2) => user2.id === magazine.createdBy);
474
- return user ? {
475
- __typename: "User",
476
- id: user.id,
477
- email: user.email
478
- } : null;
479
- }
480
- },
481
- User: {
482
- __resolveReference(key) {
483
- const user = users.find((user2) => user2.email === key.email);
484
- return user ? {
485
- __typename: "User",
486
- id: user.id,
487
- email: user.email
488
- } : null;
489
- },
490
- totalProductsCreated(user) {
491
- return products.filter((product) => product.createdBy === user.id).length;
492
- }
493
- }
494
- }
495
- });
496
-
497
- const Product = {
498
- __resolveReference(key) {
499
- const product = products.find((product2) => product2.id === key.id);
500
- return product ? {
501
- __typename: product.__typename,
502
- id: product.id,
503
- similar: key.similar
504
- } : null;
505
- },
506
- reviews(product) {
507
- return reviews.filter((review) => review.productId === product.id).map((review) => {
508
- const product2 = products.find(
509
- (product3) => product3.id === review.productId
510
- );
511
- return {
512
- __typename: "Review",
513
- id: review.id,
514
- body: review.body,
515
- product: product2 ? {
516
- __typename: product2.__typename,
517
- id: product2.id
518
- } : null
519
- };
520
- });
521
- },
522
- reviewsCount(product) {
523
- return reviews.filter((review) => review.productId === product.id).length;
524
- },
525
- reviewsScore(product) {
526
- const productReviews = reviews.filter(
527
- (review) => review.productId === product.id
528
- );
529
- if (productReviews.length === 0) {
530
- return 0;
531
- }
532
- const sum = productReviews.reduce((acc, review) => acc + review.score, 0);
533
- return sum / productReviews.length;
534
- },
535
- reviewsOfSimilar(product) {
536
- const similarProducts = products.filter(
537
- (p) => p.__typename === product.__typename && product.similar.id.includes(p.id)
538
- );
539
- return similarProducts.flatMap((p) => reviews.filter((review) => review.productId === p.id)).map((review) => {
540
- const product2 = products.find(
541
- (product3) => product3.id === review.productId
542
- );
543
- return {
544
- __typename: "Review",
545
- id: review.id,
546
- body: review.body,
547
- product: product2 ? {
548
- __typename: product2.__typename,
549
- id: product2.id
550
- } : null
551
- };
552
- });
553
- }
554
- };
555
- var reviewsSubgraph = testkit.createSubgraph("reviews", {
556
- typeDefs: (
557
- /* GraphQL */
558
- `
559
- schema
560
- @link(
561
- url: "https://specs.apollo.dev/federation/v2.3"
562
- import: ["@key", "@shareable", "@requires", "@external"]
563
- ) {
564
- query: Query
565
- }
566
-
567
- type Book implements Product & Similar @key(fields: "id") {
568
- id: ID!
569
- reviewsCount: Int!
570
- reviewsScore: Float! @shareable
571
- reviews: [Review!]!
572
- similar: [Book] @external
573
- reviewsOfSimilar: [Review!]! @requires(fields: "similar { id }")
574
- }
575
-
576
- type Magazine implements Product & Similar @key(fields: "id") {
577
- id: ID!
578
- reviewsCount: Int!
579
- reviewsScore: Float! @shareable
580
- reviews: [Review!]!
581
- similar: [Magazine] @external
582
- reviewsOfSimilar: [Review!]! @requires(fields: "similar { id }")
583
- }
584
-
585
- interface Product {
586
- id: ID!
587
- reviewsCount: Int!
588
- reviewsScore: Float!
589
- reviews: [Review!]!
590
- }
591
-
592
- interface Similar {
593
- similar: [Product]
594
- }
595
-
596
- type Query {
597
- review(id: Int!): Review
598
- }
599
-
600
- type Review {
601
- id: Int!
602
- body: String!
603
- product: Product
604
- }
605
- `
606
- ),
607
- resolvers: {
608
- Query: {
609
- review(_, { id }) {
610
- const review = reviews.find((review2) => review2.id === id);
611
- if (!review) {
612
- return null;
613
- }
614
- const product = products.find(
615
- (product2) => product2.id === review.productId
616
- );
617
- return {
618
- __typename: "Review",
619
- id: review.id,
620
- body: review.body,
621
- product: product ? {
622
- __typename: product.__typename,
623
- id: product.id
624
- } : null
625
- };
626
- }
627
- },
628
- Book: Product,
629
- Magazine: Product
630
- }
631
- });
632
-
633
- var magazinesSubgraph = testkit.createSubgraph("magazines", {
634
- typeDefs: (
635
- /* GraphQL */
636
- `
637
- schema
638
- @link(
639
- url: "https://specs.apollo.dev/federation/v2.3"
640
- import: ["@key", "@shareable"]
641
- ) {
642
- query: Query
643
- }
644
-
645
- type Magazine @key(fields: "id") {
646
- id: ID!
647
- title: String
648
- }
649
-
650
- type Query {
651
- magazines: [Magazine]
652
- }
653
- `
654
- ),
655
- resolvers: {
656
- Query: {
657
- magazines() {
658
- return magazines.map((magazine) => ({
659
- __typename: magazine.__typename,
660
- id: magazine.id,
661
- title: magazine.title
662
- }));
663
- }
664
- },
665
- Magazine: {
666
- __resolveReference(key) {
667
- const magazine = magazines.find((magazine2) => magazine2.id === key.id);
668
- return magazine ? {
669
- __typename: magazine.__typename,
670
- id: magazine.id,
671
- title: magazine.title
672
- } : null;
673
- }
674
- }
675
- }
676
- });
677
-
678
- var agencySubgraph = testkit.createSubgraph("agency", {
679
- typeDefs: (
680
- /* GraphQL */
681
- `
682
- extend schema
683
- @link(url: "https://specs.apollo.dev/federation/v2.3", import: ["@key"])
684
-
685
- type Agency @key(fields: "id") {
686
- id: ID!
687
- companyName: String
688
- email: Email
689
- }
690
-
691
- type Email {
692
- address: String
693
- }
694
-
695
- type Group @key(fields: "id") {
696
- id: ID!
697
- name: String
698
- email: String
699
- }
700
-
701
- extend union PublisherType = Agency | Group
702
- `
703
- ),
704
- resolvers: {
705
- Agency: {
706
- __resolveReference(key) {
707
- return agencies.find((a) => a.id === key.id);
708
- }
709
- },
710
- Group: {
711
- __resolveReference(key) {
712
- return {
713
- id: key.id,
714
- name: "Group " + key.id,
715
- email: "group" + key.id + "@example.com"
716
- };
717
- }
718
- }
719
- }
720
- });
721
-
722
- var test = [
723
- testkit.createTest(
724
- /* GraphQL */
725
- `
726
- query {
727
- products {
728
- id
729
- dimensions {
730
- size
731
- weight
732
- }
733
- }
734
- }
735
- `,
736
- {
737
- data: {
738
- products: [
739
- {
740
- id: "p1",
741
- dimensions: {
742
- size: "small",
743
- weight: 0.5
744
- }
745
- },
746
- {
747
- id: "p3",
748
- dimensions: {
749
- size: "small",
750
- weight: 0.6
751
- }
752
- },
753
- {
754
- id: "p2",
755
- dimensions: {
756
- size: "small",
757
- weight: 0.2
758
- }
759
- },
760
- {
761
- id: "p4",
762
- dimensions: {
763
- size: "small",
764
- weight: 0.3
765
- }
766
- }
767
- ]
768
- }
769
- }
770
- ),
771
- testkit.createTest(
772
- /* GraphQL */
773
- `
774
- query {
775
- similar(id: "p1") {
776
- id
777
- sku
778
- }
779
- }
780
- `,
781
- {
782
- data: {
783
- similar: [
784
- {
785
- id: "p3",
786
- sku: "sku-3"
787
- }
788
- ]
789
- }
790
- }
791
- ),
792
- testkit.createTest(
793
- /* GraphQL */
794
- `
795
- query {
796
- book: similar(id: "p1") {
797
- id
798
- sku
799
- delivery(zip: "1234") {
800
- fastestDelivery
801
- estimatedDelivery
802
- }
803
- }
804
- magazine: similar(id: "p2") {
805
- id
806
- sku
807
- delivery(zip: "1234") {
808
- fastestDelivery
809
- estimatedDelivery
810
- }
811
- }
812
- }
813
- `,
814
- {
815
- data: {
816
- book: [
817
- {
818
- id: "p3",
819
- sku: "sku-3",
820
- delivery: {
821
- fastestDelivery: "same day",
822
- estimatedDelivery: "1 day"
823
- }
824
- }
825
- ],
826
- magazine: [
827
- {
828
- id: "p4",
829
- sku: "sku-4",
830
- delivery: {
831
- fastestDelivery: "same day",
832
- estimatedDelivery: "1 day"
833
- }
834
- }
835
- ]
836
- }
837
- }
838
- ),
839
- testkit.createTest(
840
- /* GraphQL */
841
- `
842
- {
843
- products {
844
- sku
845
- ... on Product {
846
- sku
847
- }
848
- ... on Book {
849
- sku
850
- }
851
- ... on Magazine {
852
- sku
853
- }
854
- ... on Similar {
855
- __typename
856
- type: __typename
857
- }
858
- }
859
- }
860
- `,
861
- {
862
- data: {
863
- products: [
864
- {
865
- sku: "sku-1",
866
- __typename: "Book",
867
- type: "Book"
868
- },
869
- {
870
- sku: "sku-3",
871
- __typename: "Book",
872
- type: "Book"
873
- },
874
- {
875
- sku: "sku-2",
876
- __typename: "Magazine",
877
- type: "Magazine"
878
- },
879
- {
880
- sku: "sku-4",
881
- __typename: "Magazine",
882
- type: "Magazine"
883
- }
884
- ]
885
- }
886
- }
887
- ),
888
- testkit.createTest(
889
- /* GraphQL */
890
- `
891
- {
892
- products {
893
- author: createdBy {
894
- email
895
- totalProductsCreated
896
- }
897
- ... on Magazine {
898
- title
899
- }
900
- }
901
- }
902
- `,
903
- {
904
- data: {
905
- products: [
906
- {
907
- author: {
908
- email: "u1@example.com",
909
- totalProductsCreated: 2
910
- }
911
- },
912
- {
913
- author: {
914
- email: "u2@example.com",
915
- totalProductsCreated: 2
916
- }
917
- },
918
- {
919
- author: {
920
- email: "u1@example.com",
921
- totalProductsCreated: 2
922
- },
923
- title: "Magazine 1"
924
- },
925
- {
926
- author: {
927
- email: "u2@example.com",
928
- totalProductsCreated: 2
929
- },
930
- title: "Magazine 2"
931
- }
932
- ]
933
- }
934
- }
935
- ),
936
- testkit.createTest(
937
- /* GraphQL */
938
- `
939
- {
940
- products {
941
- id
942
- reviews {
943
- product {
944
- sku
945
- ... on Magazine {
946
- title
947
- }
948
- ... on Book {
949
- reviewsCount
950
- }
951
- }
952
- }
953
- }
954
- }
955
- `,
956
- {
957
- data: {
958
- products: [
959
- {
960
- id: "p1",
961
- reviews: [
962
- {
963
- product: {
964
- sku: "sku-1",
965
- reviewsCount: 2
966
- }
967
- },
968
- {
969
- product: {
970
- sku: "sku-1",
971
- reviewsCount: 2
972
- }
973
- }
974
- ]
975
- },
976
- {
977
- id: "p3",
978
- reviews: []
979
- },
980
- {
981
- id: "p2",
982
- reviews: [
983
- {
984
- product: {
985
- sku: "sku-2",
986
- title: "Magazine 1"
987
- }
988
- }
989
- ]
990
- },
991
- {
992
- id: "p4",
993
- reviews: []
994
- }
995
- ]
996
- }
997
- }
998
- ),
999
- testkit.createTest(
1000
- /* GraphQL */
1001
- `
1002
- {
1003
- products {
1004
- id
1005
- reviews {
1006
- id
1007
- }
1008
- }
1009
- }
1010
- `,
1011
- {
1012
- data: {
1013
- products: [
1014
- {
1015
- id: "p1",
1016
- reviews: [
1017
- {
1018
- id: 1
1019
- },
1020
- {
1021
- id: 2
1022
- }
1023
- ]
1024
- },
1025
- {
1026
- id: "p3",
1027
- reviews: []
1028
- },
1029
- {
1030
- id: "p2",
1031
- reviews: [
1032
- {
1033
- id: 3
1034
- }
1035
- ]
1036
- },
1037
- {
1038
- id: "p4",
1039
- reviews: []
1040
- }
1041
- ]
1042
- }
1043
- }
1044
- ),
1045
- testkit.createTest(
1046
- /* GraphQL */
1047
- `
1048
- query ($title: Boolean = true) {
1049
- products {
1050
- id
1051
- reviews {
1052
- product {
1053
- id
1054
- ... on Book @include(if: $title) {
1055
- title
1056
- }
1057
- ... on Magazine {
1058
- sku
1059
- }
1060
- }
1061
- }
1062
- }
1063
- }
1064
- `,
1065
- {
1066
- data: {
1067
- products: [
1068
- {
1069
- id: "p1",
1070
- reviews: [
1071
- {
1072
- product: {
1073
- id: "p1",
1074
- title: "Book 1"
1075
- }
1076
- },
1077
- {
1078
- product: {
1079
- id: "p1",
1080
- title: "Book 1"
1081
- }
1082
- }
1083
- ]
1084
- },
1085
- {
1086
- id: "p3",
1087
- reviews: []
1088
- },
1089
- {
1090
- id: "p2",
1091
- reviews: [
1092
- {
1093
- product: {
1094
- id: "p2",
1095
- sku: "sku-2"
1096
- }
1097
- }
1098
- ]
1099
- },
1100
- {
1101
- id: "p4",
1102
- reviews: []
1103
- }
1104
- ]
1105
- }
1106
- }
1107
- ),
1108
- testkit.createTest(
1109
- /* GraphQL */
1110
- `
1111
- query ($title: Boolean = false) {
1112
- products {
1113
- id
1114
- reviews {
1115
- product {
1116
- id
1117
- ... on Book @include(if: $title) {
1118
- title
1119
- }
1120
- ... on Magazine {
1121
- sku
1122
- }
1123
- }
1124
- }
1125
- }
1126
- }
1127
- `,
1128
- {
1129
- data: {
1130
- products: [
1131
- {
1132
- id: "p1",
1133
- reviews: [
1134
- {
1135
- product: {
1136
- id: "p1"
1137
- }
1138
- },
1139
- {
1140
- product: {
1141
- id: "p1"
1142
- }
1143
- }
1144
- ]
1145
- },
1146
- {
1147
- id: "p3",
1148
- reviews: []
1149
- },
1150
- {
1151
- id: "p2",
1152
- reviews: [
1153
- {
1154
- product: {
1155
- id: "p2",
1156
- sku: "sku-2"
1157
- }
1158
- }
1159
- ]
1160
- },
1161
- {
1162
- id: "p4",
1163
- reviews: []
1164
- }
1165
- ]
1166
- }
1167
- }
1168
- ),
1169
- testkit.createTest(
1170
- /* GraphQL */
1171
- `
1172
- query ($title: Boolean = false) {
1173
- products {
1174
- id
1175
- reviews {
1176
- product {
1177
- id
1178
- ... on Book @skip(if: $title) {
1179
- title
1180
- }
1181
- ... on Magazine {
1182
- sku
1183
- }
1184
- }
1185
- }
1186
- }
1187
- }
1188
- `,
1189
- {
1190
- data: {
1191
- products: [
1192
- {
1193
- id: "p1",
1194
- reviews: [
1195
- {
1196
- product: {
1197
- id: "p1",
1198
- title: "Book 1"
1199
- }
1200
- },
1201
- {
1202
- product: {
1203
- id: "p1",
1204
- title: "Book 1"
1205
- }
1206
- }
1207
- ]
1208
- },
1209
- {
1210
- id: "p3",
1211
- reviews: []
1212
- },
1213
- {
1214
- id: "p2",
1215
- reviews: [
1216
- {
1217
- product: {
1218
- id: "p2",
1219
- sku: "sku-2"
1220
- }
1221
- }
1222
- ]
1223
- },
1224
- {
1225
- id: "p4",
1226
- reviews: []
1227
- }
1228
- ]
1229
- }
1230
- }
1231
- ),
1232
- testkit.createTest(
1233
- /* GraphQL */
1234
- `
1235
- query ($title: Boolean = true) {
1236
- products {
1237
- id
1238
- reviews {
1239
- product {
1240
- id
1241
- ... on Book @skip(if: $title) {
1242
- title
1243
- }
1244
- ... on Magazine {
1245
- sku
1246
- }
1247
- }
1248
- }
1249
- }
1250
- }
1251
- `,
1252
- {
1253
- data: {
1254
- products: [
1255
- {
1256
- id: "p1",
1257
- reviews: [
1258
- {
1259
- product: {
1260
- id: "p1"
1261
- }
1262
- },
1263
- {
1264
- product: {
1265
- id: "p1"
1266
- }
1267
- }
1268
- ]
1269
- },
1270
- {
1271
- id: "p3",
1272
- reviews: []
1273
- },
1274
- {
1275
- id: "p2",
1276
- reviews: [
1277
- {
1278
- product: {
1279
- id: "p2",
1280
- sku: "sku-2"
1281
- }
1282
- }
1283
- ]
1284
- },
1285
- {
1286
- id: "p4",
1287
- reviews: []
1288
- }
1289
- ]
1290
- }
1291
- }
1292
- ),
1293
- testkit.createTest(
1294
- /* GraphQL */
1295
- `
1296
- query ($title: Boolean = true) {
1297
- products {
1298
- id
1299
- reviews {
1300
- product {
1301
- id
1302
- ... on Book @skip(if: $title) {
1303
- title
1304
- }
1305
- ... on Book {
1306
- sku
1307
- }
1308
- ... on Magazine {
1309
- sku
1310
- }
1311
- }
1312
- }
1313
- }
1314
- }
1315
- `,
1316
- {
1317
- data: {
1318
- products: [
1319
- {
1320
- id: "p1",
1321
- reviews: [
1322
- {
1323
- product: {
1324
- id: "p1",
1325
- sku: "sku-1"
1326
- }
1327
- },
1328
- {
1329
- product: {
1330
- id: "p1",
1331
- sku: "sku-1"
1332
- }
1333
- }
1334
- ]
1335
- },
1336
- {
1337
- id: "p3",
1338
- reviews: []
1339
- },
1340
- {
1341
- id: "p2",
1342
- reviews: [
1343
- {
1344
- product: {
1345
- id: "p2",
1346
- sku: "sku-2"
1347
- }
1348
- }
1349
- ]
1350
- },
1351
- {
1352
- id: "p4",
1353
- reviews: []
1354
- }
1355
- ]
1356
- }
1357
- }
1358
- ),
1359
- testkit.createTest(
1360
- /* GraphQL */
1361
- `
1362
- query ($title: Boolean = false) {
1363
- products {
1364
- id
1365
- reviews {
1366
- product {
1367
- id
1368
- ... on Book @skip(if: $title) {
1369
- title
1370
- }
1371
- ... on Book {
1372
- sku
1373
- }
1374
- ... on Magazine {
1375
- sku
1376
- }
1377
- }
1378
- }
1379
- }
1380
- }
1381
- `,
1382
- {
1383
- data: {
1384
- products: [
1385
- {
1386
- id: "p1",
1387
- reviews: [
1388
- {
1389
- product: {
1390
- id: "p1",
1391
- title: "Book 1",
1392
- sku: "sku-1"
1393
- }
1394
- },
1395
- {
1396
- product: {
1397
- id: "p1",
1398
- title: "Book 1",
1399
- sku: "sku-1"
1400
- }
1401
- }
1402
- ]
1403
- },
1404
- {
1405
- id: "p3",
1406
- reviews: []
1407
- },
1408
- {
1409
- id: "p2",
1410
- reviews: [
1411
- {
1412
- product: {
1413
- id: "p2",
1414
- sku: "sku-2"
1415
- }
1416
- }
1417
- ]
1418
- },
1419
- {
1420
- id: "p4",
1421
- reviews: []
1422
- }
1423
- ]
1424
- }
1425
- }
1426
- ),
1427
- testkit.createTest(
1428
- /* GraphQL */
1429
- `
1430
- query ($title: Boolean = true) {
1431
- products {
1432
- id
1433
- reviews {
1434
- product {
1435
- id
1436
- ... on Book @include(if: $title) {
1437
- title
1438
- ... on Book {
1439
- sku
1440
- }
1441
- }
1442
- ... on Magazine {
1443
- sku
1444
- }
1445
- }
1446
- }
1447
- }
1448
- }
1449
- `,
1450
- {
1451
- data: {
1452
- products: [
1453
- {
1454
- id: "p1",
1455
- reviews: [
1456
- {
1457
- product: {
1458
- id: "p1",
1459
- title: "Book 1",
1460
- sku: "sku-1"
1461
- }
1462
- },
1463
- {
1464
- product: {
1465
- id: "p1",
1466
- title: "Book 1",
1467
- sku: "sku-1"
1468
- }
1469
- }
1470
- ]
1471
- },
1472
- {
1473
- id: "p3",
1474
- reviews: []
1475
- },
1476
- {
1477
- id: "p2",
1478
- reviews: [
1479
- {
1480
- product: {
1481
- id: "p2",
1482
- sku: "sku-2"
1483
- }
1484
- }
1485
- ]
1486
- },
1487
- {
1488
- id: "p4",
1489
- reviews: []
1490
- }
1491
- ]
1492
- }
1493
- }
1494
- ),
1495
- testkit.createTest(
1496
- /* GraphQL */
1497
- `
1498
- query ($title: Boolean = true) {
1499
- products {
1500
- id
1501
- reviews {
1502
- product {
1503
- id
1504
- ... on Book @include(if: $title) {
1505
- title
1506
- ... on Book @skip(if: $title) {
1507
- sku
1508
- }
1509
- }
1510
- ... on Magazine {
1511
- sku
1512
- }
1513
- }
1514
- }
1515
- }
1516
- }
1517
- `,
1518
- {
1519
- data: {
1520
- products: [
1521
- {
1522
- id: "p1",
1523
- reviews: [
1524
- {
1525
- product: {
1526
- id: "p1",
1527
- title: "Book 1"
1528
- }
1529
- },
1530
- {
1531
- product: {
1532
- id: "p1",
1533
- title: "Book 1"
1534
- }
1535
- }
1536
- ]
1537
- },
1538
- {
1539
- id: "p3",
1540
- reviews: []
1541
- },
1542
- {
1543
- id: "p2",
1544
- reviews: [
1545
- {
1546
- product: {
1547
- id: "p2",
1548
- sku: "sku-2"
1549
- }
1550
- }
1551
- ]
1552
- },
1553
- {
1554
- id: "p4",
1555
- reviews: []
1556
- }
1557
- ]
1558
- }
1559
- }
1560
- ),
1561
- testkit.createTest(
1562
- /* GraphQL */
1563
- `
1564
- {
1565
- products {
1566
- id
1567
- reviews {
1568
- product {
1569
- id
1570
- ... on Magazine {
1571
- publisherType {
1572
- ...Publisher
1573
- }
1574
- }
1575
- ... on Book {
1576
- publisherType {
1577
- ...Publisher
1578
- }
1579
- }
1580
- }
1581
- }
1582
- }
1583
- }
1584
-
1585
- fragment Publisher on PublisherType {
1586
- ... on Agency {
1587
- id
1588
- companyName
1589
- }
1590
- ... on Self {
1591
- email
1592
- }
1593
- }
1594
- `,
1595
- {
1596
- data: {
1597
- products: [
1598
- {
1599
- id: "p1",
1600
- reviews: [
1601
- {
1602
- product: {
1603
- id: "p1",
1604
- publisherType: {
1605
- email: "u1@example.com"
1606
- }
1607
- }
1608
- },
1609
- {
1610
- product: {
1611
- id: "p1",
1612
- publisherType: {
1613
- email: "u1@example.com"
1614
- }
1615
- }
1616
- }
1617
- ]
1618
- },
1619
- {
1620
- id: "p3",
1621
- reviews: []
1622
- },
1623
- {
1624
- id: "p2",
1625
- reviews: [
1626
- {
1627
- product: {
1628
- id: "p2",
1629
- publisherType: {
1630
- id: "a1",
1631
- companyName: "Agency 1"
1632
- }
1633
- }
1634
- }
1635
- ]
1636
- },
1637
- {
1638
- id: "p4",
1639
- reviews: []
1640
- }
1641
- ]
1642
- }
1643
- }
1644
- ),
1645
- testkit.createTest(
1646
- /* GraphQL */
1647
- `
1648
- {
1649
- products {
1650
- id
1651
- reviews {
1652
- product {
1653
- id
1654
- ... on Magazine {
1655
- publisherType {
1656
- ...Publisher
1657
- }
1658
- }
1659
- ... on Book {
1660
- publisherType {
1661
- ...Publisher
1662
- }
1663
- }
1664
- }
1665
- }
1666
- }
1667
- }
1668
-
1669
- fragment Publisher on PublisherType {
1670
- ... on Agency {
1671
- id
1672
- companyName
1673
- }
1674
- ... on Self {
1675
- email
1676
- }
1677
- ... on Group {
1678
- name
1679
- }
1680
- }
1681
- `,
1682
- {
1683
- data: {
1684
- products: [
1685
- {
1686
- id: "p1",
1687
- reviews: [
1688
- {
1689
- product: {
1690
- id: "p1",
1691
- publisherType: {
1692
- email: "u1@example.com"
1693
- }
1694
- }
1695
- },
1696
- {
1697
- product: {
1698
- id: "p1",
1699
- publisherType: {
1700
- email: "u1@example.com"
1701
- }
1702
- }
1703
- }
1704
- ]
1705
- },
1706
- {
1707
- id: "p3",
1708
- reviews: []
1709
- },
1710
- {
1711
- id: "p2",
1712
- reviews: [
1713
- {
1714
- product: {
1715
- id: "p2",
1716
- publisherType: {
1717
- id: "a1",
1718
- companyName: "Agency 1"
1719
- }
1720
- }
1721
- }
1722
- ]
1723
- },
1724
- {
1725
- id: "p4",
1726
- reviews: []
1727
- }
1728
- ]
1729
- }
1730
- }
1731
- ),
1732
- testkit.createTest(
1733
- /* GraphQL */
1734
- `
1735
- {
1736
- products {
1737
- id
1738
- reviews {
1739
- product {
1740
- id
1741
- ... on Magazine {
1742
- publisherType {
1743
- ...Publisher
1744
- }
1745
- }
1746
- ... on Book {
1747
- publisherType {
1748
- ...Publisher
1749
- }
1750
- }
1751
- }
1752
- }
1753
- }
1754
- }
1755
-
1756
- fragment Publisher on PublisherType {
1757
- ... on Agency {
1758
- emailObj: email {
1759
- address
1760
- }
1761
- }
1762
- ... on Self {
1763
- emailStr: email
1764
- }
1765
- ... on Group {
1766
- emailStr: email
1767
- }
1768
- }
1769
- `,
1770
- {
1771
- data: {
1772
- products: [
1773
- {
1774
- id: "p1",
1775
- reviews: [
1776
- {
1777
- product: {
1778
- id: "p1",
1779
- publisherType: {
1780
- emailStr: "u1@example.com"
1781
- }
1782
- }
1783
- },
1784
- {
1785
- product: {
1786
- id: "p1",
1787
- publisherType: {
1788
- emailStr: "u1@example.com"
1789
- }
1790
- }
1791
- }
1792
- ]
1793
- },
1794
- {
1795
- id: "p3",
1796
- reviews: []
1797
- },
1798
- {
1799
- id: "p2",
1800
- reviews: [
1801
- {
1802
- product: {
1803
- id: "p2",
1804
- publisherType: {
1805
- emailObj: {
1806
- address: "a1@example.com"
1807
- }
1808
- }
1809
- }
1810
- }
1811
- ]
1812
- },
1813
- {
1814
- id: "p4",
1815
- reviews: []
1816
- }
1817
- ]
1818
- }
1819
- }
1820
- )
1821
- ];
1822
-
1823
- var index = testkit.serve(
1824
- "abstract-types",
1825
- [
1826
- agencySubgraph,
1827
- inventorySubgraph,
1828
- booksSubgraph,
1829
- usersSubgraph,
1830
- reviewsSubgraph,
1831
- productsSubgraph,
1832
- magazinesSubgraph
1833
- ],
1834
- test
1835
- );
1836
-
1837
- exports.default = index;