houdini 0.14.8 → 0.15.0-next.2

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 (515) hide show
  1. package/.changeset/empty-socks-design.md +5 -0
  2. package/.changeset/few-donkeys-teach.md +5 -0
  3. package/.changeset/forty-geckos-grin.md +5 -0
  4. package/.changeset/pre.json +16 -0
  5. package/.changeset/thin-readers-matter.md +5 -0
  6. package/.changeset/wicked-lamps-smoke.md +5 -0
  7. package/.github/FUNDING.yml +3 -0
  8. package/.github/workflows/tests.yml +14 -4
  9. package/CHANGELOG.md +24 -0
  10. package/build/cmd/generate.d.ts +4 -0
  11. package/build/cmd/generate.js +441 -0
  12. package/build/cmd/generators/artifacts/fieldKey.d.ts +3 -0
  13. package/build/cmd/generators/artifacts/fieldKey.js +83 -0
  14. package/build/cmd/generators/artifacts/index.d.ts +7 -0
  15. package/build/cmd/generators/artifacts/index.js +371 -0
  16. package/build/cmd/generators/artifacts/indexFile.d.ts +3 -0
  17. package/build/cmd/generators/artifacts/indexFile.js +66 -0
  18. package/build/cmd/generators/artifacts/inputs.d.ts +4 -0
  19. package/build/cmd/generators/artifacts/inputs.js +111 -0
  20. package/build/cmd/generators/artifacts/operations.d.ts +11 -0
  21. package/build/cmd/generators/artifacts/operations.js +293 -0
  22. package/build/cmd/generators/artifacts/selection.d.ts +16 -0
  23. package/build/cmd/generators/artifacts/selection.js +207 -0
  24. package/build/cmd/generators/artifacts/utils.d.ts +8 -0
  25. package/build/cmd/generators/artifacts/utils.js +183 -0
  26. package/build/cmd/generators/index.d.ts +6 -0
  27. package/build/cmd/generators/index.js +18 -0
  28. package/build/cmd/generators/persistedQueries/index.d.ts +3 -0
  29. package/build/cmd/generators/persistedQueries/index.js +118 -0
  30. package/build/cmd/generators/runtime/adapter.d.ts +2 -0
  31. package/build/cmd/generators/runtime/adapter.js +85 -0
  32. package/build/cmd/generators/runtime/copyRuntime.d.ts +3 -0
  33. package/build/cmd/generators/runtime/copyRuntime.js +164 -0
  34. package/build/cmd/generators/runtime/index.d.ts +3 -0
  35. package/build/cmd/generators/runtime/index.js +68 -0
  36. package/build/cmd/generators/runtime/indexFile.d.ts +3 -0
  37. package/build/cmd/generators/runtime/indexFile.js +75 -0
  38. package/build/cmd/generators/runtime/meta.d.ts +2 -0
  39. package/build/cmd/generators/runtime/meta.js +57 -0
  40. package/build/cmd/generators/schema/index.d.ts +3 -0
  41. package/build/cmd/generators/schema/index.js +63 -0
  42. package/build/cmd/generators/stores/fragment.d.ts +3 -0
  43. package/build/cmd/generators/stores/fragment.js +79 -0
  44. package/build/cmd/generators/stores/index.d.ts +3 -0
  45. package/build/cmd/generators/stores/index.js +115 -0
  46. package/build/cmd/generators/stores/mutation.d.ts +3 -0
  47. package/build/cmd/generators/stores/mutation.js +67 -0
  48. package/build/cmd/generators/stores/pagination.d.ts +7 -0
  49. package/build/cmd/generators/stores/pagination.js +51 -0
  50. package/build/cmd/generators/stores/query.d.ts +3 -0
  51. package/build/cmd/generators/stores/query.js +101 -0
  52. package/build/cmd/generators/stores/subscription.d.ts +3 -0
  53. package/build/cmd/generators/stores/subscription.js +105 -0
  54. package/build/cmd/generators/typescript/addReferencedInputTypes.d.ts +4 -0
  55. package/build/cmd/generators/typescript/addReferencedInputTypes.js +95 -0
  56. package/build/cmd/generators/typescript/index.d.ts +3 -0
  57. package/build/cmd/generators/typescript/index.js +310 -0
  58. package/build/cmd/generators/typescript/inlineType.d.ts +13 -0
  59. package/build/cmd/generators/typescript/inlineType.js +310 -0
  60. package/build/cmd/generators/typescript/typeReference.d.ts +6 -0
  61. package/build/cmd/generators/typescript/typeReference.js +84 -0
  62. package/build/cmd/generators/typescript/types.d.ts +8 -0
  63. package/build/cmd/generators/typescript/types.js +88 -0
  64. package/build/cmd/index.d.ts +2 -0
  65. package/build/cmd/index.js +18 -0
  66. package/build/cmd/init.d.ts +4 -0
  67. package/build/cmd/init.js +162 -0
  68. package/build/cmd/main.d.ts +1 -0
  69. package/build/cmd/main.js +133 -0
  70. package/build/cmd/testUtils.d.ts +3 -0
  71. package/build/cmd/testUtils.js +150 -0
  72. package/build/cmd/transforms/addID.d.ts +3 -0
  73. package/build/cmd/transforms/addID.js +202 -0
  74. package/build/cmd/transforms/composeQueries.d.ts +10 -0
  75. package/build/cmd/transforms/composeQueries.js +214 -0
  76. package/build/cmd/transforms/fragmentVariables.d.ts +28 -0
  77. package/build/cmd/transforms/fragmentVariables.js +437 -0
  78. package/build/cmd/transforms/index.d.ts +7 -0
  79. package/build/cmd/transforms/index.js +20 -0
  80. package/build/cmd/transforms/list.d.ts +9 -0
  81. package/build/cmd/transforms/list.js +426 -0
  82. package/build/cmd/transforms/paginate.d.ts +37 -0
  83. package/build/cmd/transforms/paginate.js +747 -0
  84. package/build/cmd/transforms/schema.d.ts +3 -0
  85. package/build/cmd/transforms/schema.js +81 -0
  86. package/build/cmd/transforms/typename.d.ts +3 -0
  87. package/build/cmd/transforms/typename.js +165 -0
  88. package/build/cmd/types.d.ts +24 -0
  89. package/build/cmd/types.js +19 -0
  90. package/build/cmd/utils/commonjs.d.ts +3 -0
  91. package/build/cmd/utils/commonjs.js +14 -0
  92. package/build/cmd/utils/flattenSelections.d.ts +6 -0
  93. package/build/cmd/utils/flattenSelections.js +125 -0
  94. package/build/cmd/utils/graphql.d.ts +15 -0
  95. package/build/cmd/utils/graphql.js +114 -0
  96. package/build/cmd/utils/index.d.ts +7 -0
  97. package/build/cmd/utils/index.js +23 -0
  98. package/build/cmd/utils/moduleExport.d.ts +4 -0
  99. package/build/cmd/utils/moduleExport.js +46 -0
  100. package/build/cmd/utils/murmur.d.ts +9 -0
  101. package/build/cmd/utils/murmur.js +69 -0
  102. package/build/cmd/utils/writeFile.d.ts +1 -0
  103. package/build/cmd/utils/writeFile.js +69 -0
  104. package/build/cmd/utils/writeSchema.d.ts +2 -0
  105. package/build/cmd/utils/writeSchema.js +148 -0
  106. package/build/cmd/validators/index.d.ts +3 -0
  107. package/build/cmd/validators/index.js +12 -0
  108. package/build/cmd/validators/noIDAlias.d.ts +3 -0
  109. package/build/cmd/validators/noIDAlias.js +118 -0
  110. package/build/cmd/validators/typeCheck.d.ts +3 -0
  111. package/build/cmd/validators/typeCheck.js +813 -0
  112. package/build/cmd/validators/uniqueNames.d.ts +3 -0
  113. package/build/cmd/validators/uniqueNames.js +106 -0
  114. package/build/cmd.js +42170 -38877
  115. package/build/common/config.d.ts +99 -0
  116. package/build/common/config.js +659 -0
  117. package/build/common/graphql.d.ts +11 -0
  118. package/build/common/graphql.js +203 -0
  119. package/build/common/index.d.ts +5 -0
  120. package/build/common/index.js +21 -0
  121. package/build/common/log.d.ts +6 -0
  122. package/build/common/log.js +9 -0
  123. package/build/common/parse.d.ts +11 -0
  124. package/build/common/parse.js +192 -0
  125. package/build/common/pipeline.d.ts +3 -0
  126. package/build/common/pipeline.js +87 -0
  127. package/build/common/tests.d.ts +8 -0
  128. package/build/common/tests.js +36 -0
  129. package/build/common/types.d.ts +7 -0
  130. package/build/common/types.js +2 -0
  131. package/build/preprocess/index.d.ts +10 -0
  132. package/build/preprocess/index.js +69 -0
  133. package/build/preprocess/test.d.ts +1 -0
  134. package/build/preprocess/test.js +342 -0
  135. package/build/preprocess/transforms/fragment.d.ts +3 -0
  136. package/build/preprocess/transforms/fragment.js +175 -0
  137. package/build/preprocess/transforms/index.d.ts +9 -0
  138. package/build/preprocess/transforms/index.js +188 -0
  139. package/build/preprocess/transforms/mutation.d.ts +3 -0
  140. package/build/preprocess/transforms/mutation.js +109 -0
  141. package/build/preprocess/transforms/query.d.ts +3 -0
  142. package/build/preprocess/transforms/query.js +449 -0
  143. package/build/preprocess/transforms/subscription.d.ts +3 -0
  144. package/build/preprocess/transforms/subscription.js +121 -0
  145. package/build/preprocess/types.d.ts +8 -0
  146. package/build/preprocess/types.js +2 -0
  147. package/build/preprocess/utils/artifactIdentifier.d.ts +3 -0
  148. package/build/preprocess/utils/artifactIdentifier.js +6 -0
  149. package/build/preprocess/utils/identifiers.d.ts +4 -0
  150. package/build/preprocess/utils/identifiers.js +32 -0
  151. package/build/preprocess/utils/imports.d.ts +24 -0
  152. package/build/preprocess/utils/imports.js +85 -0
  153. package/build/preprocess/utils/index.d.ts +5 -0
  154. package/build/preprocess/utils/index.js +26 -0
  155. package/build/preprocess/utils/preprocessorTest.d.ts +8 -0
  156. package/build/preprocess/utils/preprocessorTest.js +117 -0
  157. package/build/preprocess/utils/walkTaggedDocuments.d.ts +25 -0
  158. package/build/preprocess/utils/walkTaggedDocuments.js +180 -0
  159. package/build/preprocess-cjs/index.js +10239 -569
  160. package/build/preprocess-esm/index.js +10250 -580
  161. package/build/runtime/adapter.d.ts +15 -0
  162. package/build/runtime/adapter.js +63 -0
  163. package/build/runtime/cache/cache.d.ts +106 -0
  164. package/build/runtime/cache/cache.js +930 -0
  165. package/build/runtime/cache/gc.d.ts +9 -0
  166. package/build/runtime/cache/gc.js +103 -0
  167. package/build/runtime/cache/index.d.ts +3 -0
  168. package/build/runtime/cache/index.js +13 -0
  169. package/build/runtime/cache/lists.d.ts +63 -0
  170. package/build/runtime/cache/lists.js +606 -0
  171. package/build/runtime/cache/storage.d.ts +98 -0
  172. package/build/runtime/cache/storage.js +645 -0
  173. package/build/runtime/cache/stuff.d.ts +6 -0
  174. package/build/runtime/cache/stuff.js +98 -0
  175. package/build/runtime/cache/subscription.d.ts +30 -0
  176. package/build/runtime/cache/subscription.js +380 -0
  177. package/build/runtime/index.d.ts +4 -0
  178. package/build/runtime/index.js +26 -0
  179. package/build/runtime/inline/fragment.d.ts +10 -0
  180. package/build/runtime/inline/fragment.js +107 -0
  181. package/build/runtime/inline/index.d.ts +4 -0
  182. package/build/runtime/inline/index.js +13 -0
  183. package/build/runtime/inline/mutation.d.ts +5 -0
  184. package/build/runtime/inline/mutation.js +72 -0
  185. package/build/runtime/inline/query.d.ts +18 -0
  186. package/build/runtime/inline/query.js +115 -0
  187. package/build/runtime/inline/subscription.d.ts +5 -0
  188. package/build/runtime/inline/subscription.js +22 -0
  189. package/build/runtime/lib/config.d.ts +43 -0
  190. package/build/runtime/lib/config.js +60 -0
  191. package/build/runtime/lib/context.d.ts +3 -0
  192. package/build/runtime/lib/context.js +26 -0
  193. package/build/runtime/lib/errors.d.ts +3 -0
  194. package/build/runtime/lib/errors.js +12 -0
  195. package/build/runtime/lib/index.d.ts +6 -0
  196. package/build/runtime/lib/index.js +25 -0
  197. package/build/runtime/lib/network.d.ts +120 -0
  198. package/build/runtime/lib/network.js +386 -0
  199. package/build/runtime/lib/pagination.d.ts +47 -0
  200. package/build/runtime/lib/pagination.js +541 -0
  201. package/build/runtime/lib/proxy.d.ts +6 -0
  202. package/build/runtime/lib/proxy.js +52 -0
  203. package/build/runtime/lib/scalars.d.ts +15 -0
  204. package/build/runtime/lib/scalars.js +157 -0
  205. package/build/runtime/lib/types.d.ts +236 -0
  206. package/build/runtime/lib/types.js +32 -0
  207. package/build/runtime/lib/utils.d.ts +9 -0
  208. package/build/runtime/lib/utils.js +97 -0
  209. package/build/runtime/stores/fragment.d.ts +15 -0
  210. package/build/runtime/stores/fragment.js +63 -0
  211. package/build/runtime/stores/index.d.ts +4 -0
  212. package/build/runtime/stores/index.js +11 -0
  213. package/build/runtime/stores/mutation.d.ts +6 -0
  214. package/build/runtime/stores/mutation.js +178 -0
  215. package/build/runtime/stores/query.d.ts +24 -0
  216. package/build/runtime/stores/query.js +304 -0
  217. package/build/runtime/stores/subscription.d.ts +8 -0
  218. package/build/runtime/stores/subscription.js +74 -0
  219. package/build/runtime-cjs/adapter.d.ts +15 -0
  220. package/build/runtime-cjs/adapter.js +63 -0
  221. package/build/runtime-cjs/cache/cache.d.ts +3 -5
  222. package/build/runtime-cjs/cache/cache.js +8 -7
  223. package/build/runtime-cjs/cache/lists.d.ts +8 -8
  224. package/build/runtime-cjs/cache/lists.js +51 -27
  225. package/build/runtime-cjs/cache/storage.d.ts +1 -1
  226. package/build/runtime-cjs/cache/subscription.d.ts +4 -3
  227. package/build/runtime-cjs/cache/subscription.js +10 -10
  228. package/build/runtime-cjs/index.d.ts +3 -10
  229. package/build/runtime-cjs/index.js +3 -18
  230. package/build/runtime-cjs/inline/fragment.d.ts +10 -0
  231. package/build/runtime-cjs/{fragment.js → inline/fragment.js} +33 -6
  232. package/build/runtime-cjs/inline/index.d.ts +4 -0
  233. package/build/runtime-cjs/inline/index.js +13 -0
  234. package/build/runtime-cjs/inline/mutation.d.ts +5 -0
  235. package/build/runtime-cjs/inline/mutation.js +72 -0
  236. package/build/runtime-cjs/inline/query.d.ts +18 -0
  237. package/build/runtime-cjs/inline/query.js +115 -0
  238. package/build/runtime-cjs/{subscription.d.ts → inline/subscription.d.ts} +1 -1
  239. package/build/runtime-cjs/inline/subscription.js +22 -0
  240. package/build/runtime-cjs/{config.d.ts → lib/config.d.ts} +3 -1
  241. package/build/runtime-cjs/{config.js → lib/config.js} +0 -0
  242. package/build/runtime-cjs/lib/context.d.ts +3 -0
  243. package/build/runtime-cjs/lib/context.js +26 -0
  244. package/build/runtime-cjs/lib/errors.d.ts +3 -0
  245. package/build/runtime-cjs/lib/errors.js +12 -0
  246. package/build/runtime-cjs/lib/index.d.ts +6 -0
  247. package/build/runtime-cjs/lib/index.js +25 -0
  248. package/build/runtime-cjs/{network.d.ts → lib/network.d.ts} +18 -18
  249. package/build/runtime-cjs/{network.js → lib/network.js} +87 -27
  250. package/build/runtime-cjs/lib/pagination.d.ts +47 -0
  251. package/build/runtime-cjs/{pagination.js → lib/pagination.js} +178 -144
  252. package/build/runtime-cjs/{proxy.d.ts → lib/proxy.d.ts} +0 -0
  253. package/build/runtime-cjs/{proxy.js → lib/proxy.js} +0 -0
  254. package/build/runtime-cjs/{scalars.d.ts → lib/scalars.d.ts} +0 -0
  255. package/build/runtime-cjs/{scalars.js → lib/scalars.js} +0 -0
  256. package/build/runtime-cjs/{types.d.ts → lib/types.d.ts} +95 -13
  257. package/build/runtime-cjs/{types.js → lib/types.js} +0 -0
  258. package/build/{runtime-esm → runtime-cjs/lib}/utils.d.ts +1 -1
  259. package/build/runtime-cjs/{utils.js → lib/utils.js} +3 -0
  260. package/build/runtime-cjs/stores/fragment.d.ts +15 -0
  261. package/build/runtime-cjs/stores/fragment.js +63 -0
  262. package/build/runtime-cjs/stores/index.d.ts +4 -0
  263. package/build/runtime-cjs/stores/index.js +11 -0
  264. package/build/runtime-cjs/stores/mutation.d.ts +6 -0
  265. package/build/runtime-cjs/{mutation.js → stores/mutation.js} +89 -40
  266. package/build/runtime-cjs/stores/query.d.ts +24 -0
  267. package/build/runtime-cjs/stores/query.js +304 -0
  268. package/build/runtime-cjs/stores/subscription.d.ts +8 -0
  269. package/build/runtime-cjs/stores/subscription.js +74 -0
  270. package/build/runtime-esm/adapter.d.ts +15 -0
  271. package/build/runtime-esm/adapter.js +17 -0
  272. package/build/runtime-esm/cache/cache.d.ts +3 -5
  273. package/build/runtime-esm/cache/cache.js +6 -5
  274. package/build/runtime-esm/cache/lists.d.ts +8 -8
  275. package/build/runtime-esm/cache/lists.js +40 -16
  276. package/build/runtime-esm/cache/storage.d.ts +1 -1
  277. package/build/runtime-esm/cache/subscription.d.ts +4 -3
  278. package/build/runtime-esm/cache/subscription.js +10 -10
  279. package/build/runtime-esm/index.d.ts +3 -10
  280. package/build/runtime-esm/index.js +2 -9
  281. package/build/runtime-esm/inline/fragment.d.ts +10 -0
  282. package/build/runtime-esm/{fragment.js → inline/fragment.js} +23 -5
  283. package/build/runtime-esm/inline/index.d.ts +4 -0
  284. package/build/runtime-esm/inline/index.js +4 -0
  285. package/build/runtime-esm/inline/mutation.d.ts +5 -0
  286. package/build/runtime-esm/inline/mutation.js +17 -0
  287. package/build/runtime-esm/inline/query.d.ts +18 -0
  288. package/build/runtime-esm/inline/query.js +94 -0
  289. package/build/runtime-esm/{subscription.d.ts → inline/subscription.d.ts} +1 -1
  290. package/build/runtime-esm/inline/subscription.js +18 -0
  291. package/build/runtime-esm/{config.d.ts → lib/config.d.ts} +3 -1
  292. package/build/runtime-esm/{config.js → lib/config.js} +0 -0
  293. package/build/runtime-esm/lib/context.d.ts +3 -0
  294. package/build/runtime-esm/lib/context.js +28 -0
  295. package/build/runtime-esm/lib/errors.d.ts +3 -0
  296. package/build/runtime-esm/lib/errors.js +8 -0
  297. package/build/runtime-esm/lib/index.d.ts +6 -0
  298. package/build/runtime-esm/lib/index.js +6 -0
  299. package/build/runtime-esm/{network.d.ts → lib/network.d.ts} +18 -18
  300. package/build/runtime-esm/{network.js → lib/network.js} +35 -18
  301. package/build/runtime-esm/lib/pagination.d.ts +47 -0
  302. package/build/runtime-esm/{pagination.js → lib/pagination.js} +126 -147
  303. package/build/runtime-esm/{proxy.d.ts → lib/proxy.d.ts} +0 -0
  304. package/build/runtime-esm/{proxy.js → lib/proxy.js} +0 -0
  305. package/build/runtime-esm/{scalars.d.ts → lib/scalars.d.ts} +0 -0
  306. package/build/runtime-esm/{scalars.js → lib/scalars.js} +0 -0
  307. package/build/runtime-esm/{types.d.ts → lib/types.d.ts} +95 -13
  308. package/build/runtime-esm/{types.js → lib/types.js} +0 -0
  309. package/build/{runtime-cjs → runtime-esm/lib}/utils.d.ts +1 -1
  310. package/build/runtime-esm/{utils.js → lib/utils.js} +3 -0
  311. package/build/runtime-esm/stores/fragment.d.ts +15 -0
  312. package/build/runtime-esm/stores/fragment.js +32 -0
  313. package/build/runtime-esm/stores/index.d.ts +4 -0
  314. package/build/runtime-esm/stores/index.js +4 -0
  315. package/build/runtime-esm/stores/mutation.d.ts +6 -0
  316. package/build/runtime-esm/{mutation.js → stores/mutation.js} +73 -29
  317. package/build/runtime-esm/stores/query.d.ts +24 -0
  318. package/build/runtime-esm/stores/query.js +228 -0
  319. package/build/runtime-esm/stores/subscription.d.ts +8 -0
  320. package/build/runtime-esm/stores/subscription.js +65 -0
  321. package/example/api.mjs +91 -0
  322. package/example/houdini.config.js +1 -1
  323. package/example/package.json +11 -8
  324. package/example/schema/{index.cjs → index.mjs} +26 -20
  325. package/example/src/app.html +2 -2
  326. package/example/src/client.ts +31 -0
  327. package/example/src/global.d.ts +14 -2
  328. package/example/src/lib/ItemEntry.svelte +27 -26
  329. package/example/src/routes/[filter].svelte +10 -9
  330. package/example/src/routes/__layout.svelte +3 -4
  331. package/example/src/routes/addItem.svelte +9 -0
  332. package/example/src/routes/index.svelte +2 -2
  333. package/example/svelte.config.js +19 -4
  334. package/example/tsconfig.json +6 -25
  335. package/integration/.eslintrc.cjs +20 -0
  336. package/integration/.prettierrc +6 -0
  337. package/integration/README.md +5 -0
  338. package/integration/api/graphql.mjs +125 -0
  339. package/integration/api/schema-hello.graphql +3 -0
  340. package/integration/api/schema.graphql +52 -0
  341. package/integration/api/server.mjs +83 -0
  342. package/integration/houdini.config.js +22 -0
  343. package/integration/package.json +49 -0
  344. package/integration/playwright.config.ts +14 -0
  345. package/integration/src/app.d.ts +10 -0
  346. package/integration/src/app.html +12 -0
  347. package/integration/src/lib/graphql/houdiniClient.ts +35 -0
  348. package/integration/src/lib/graphql/operations/FRAG.UserInfo.gql +5 -0
  349. package/integration/src/lib/graphql/operations/MUTATION.AddUser.gql +7 -0
  350. package/integration/src/lib/graphql/operations/MUTATION.UpdateUser.gql +7 -0
  351. package/integration/src/lib/graphql/operations/QUERY.Hello.gql +3 -0
  352. package/integration/src/lib/graphql/operations/QUERY.User.gql +6 -0
  353. package/integration/src/lib/graphql/operations/QUERY.UsersList.gql +7 -0
  354. package/integration/src/lib/utils/routes.ts +28 -0
  355. package/integration/src/lib/utils/testsHelper.ts +56 -0
  356. package/integration/src/routes/__error.svelte +17 -0
  357. package/integration/src/routes/__layout.svelte +27 -0
  358. package/integration/src/routes/index.spec.ts +7 -0
  359. package/integration/src/routes/index.svelte +3 -0
  360. package/integration/src/routes/pagination/fragment/backwards-cursor.spec.ts +51 -0
  361. package/integration/src/routes/pagination/fragment/backwards-cursor.svelte +46 -0
  362. package/integration/src/routes/pagination/fragment/forward-cursor.spec.ts +52 -0
  363. package/integration/src/routes/pagination/fragment/forward-cursor.svelte +46 -0
  364. package/integration/src/routes/pagination/fragment/offset.spec.ts +22 -0
  365. package/integration/src/routes/pagination/fragment/offset.svelte +34 -0
  366. package/integration/src/routes/pagination/query/backwards-cursor.spec.ts +65 -0
  367. package/integration/src/routes/pagination/query/backwards-cursor.svelte +28 -0
  368. package/integration/src/routes/pagination/query/forward-cursor.spec.ts +77 -0
  369. package/integration/src/routes/pagination/query/forward-cursor.svelte +31 -0
  370. package/integration/src/routes/pagination/query/offset.spec.ts +36 -0
  371. package/integration/src/routes/pagination/query/offset.svelte +19 -0
  372. package/integration/src/routes/preprocess/fragment/update.spec.ts +22 -0
  373. package/integration/src/routes/preprocess/fragment/update.svelte +40 -0
  374. package/integration/src/routes/preprocess/mutation/mutation.spec.ts +22 -0
  375. package/integration/src/routes/preprocess/mutation/mutation.svelte +35 -0
  376. package/integration/src/routes/preprocess/query/multiple.spec.ts +18 -0
  377. package/integration/src/routes/preprocess/query/multiple.svelte +31 -0
  378. package/integration/src/routes/preprocess/query/scalars.spec.ts +23 -0
  379. package/integration/src/routes/preprocess/query/scalars.svelte +16 -0
  380. package/integration/src/routes/preprocess/query/simple.spec.ts +33 -0
  381. package/integration/src/routes/preprocess/query/simple.svelte +15 -0
  382. package/integration/src/routes/preprocess/query/variable/[id].spec.ts +26 -0
  383. package/integration/src/routes/preprocess/query/variable/[id].svelte +23 -0
  384. package/integration/src/routes/preprocess/query/variable/__layout.svelte +11 -0
  385. package/integration/src/routes/stores/mutation-scalars.spec.ts +20 -0
  386. package/integration/src/routes/stores/mutation-scalars.svelte +27 -0
  387. package/integration/src/routes/stores/mutation-update.spec.ts +56 -0
  388. package/integration/src/routes/stores/mutation-update.svelte +42 -0
  389. package/integration/src/routes/stores/mutation.spec.ts +56 -0
  390. package/integration/src/routes/stores/mutation.svelte +25 -0
  391. package/integration/src/routes/stores/network.spec.ts +28 -0
  392. package/integration/src/routes/stores/network.svelte +18 -0
  393. package/integration/src/routes/stores/ssr-[userId].spec.ts +86 -0
  394. package/integration/src/routes/stores/ssr-[userId].svelte +49 -0
  395. package/integration/src/routes/stores/ssr.spec.ts +72 -0
  396. package/integration/src/routes/stores/ssr.svelte +24 -0
  397. package/integration/static/favicon.png +0 -0
  398. package/integration/svelte.config.js +31 -0
  399. package/integration/tsconfig.json +19 -0
  400. package/jest.config.js +4 -0
  401. package/jest.d.ts +1 -0
  402. package/jest.setup.js +1 -0
  403. package/package.json +19 -8
  404. package/rollup.config.js +5 -0
  405. package/src/cmd/generate.ts +212 -104
  406. package/src/cmd/generators/artifacts/artifacts.test.ts +69 -1
  407. package/src/cmd/generators/artifacts/index.ts +254 -226
  408. package/src/cmd/generators/artifacts/indexFile.ts +1 -1
  409. package/src/cmd/generators/artifacts/inputs.ts +1 -1
  410. package/src/cmd/generators/artifacts/pagination.test.ts +15 -3
  411. package/src/cmd/generators/artifacts/policy.test.ts +10 -1
  412. package/src/cmd/generators/index.ts +1 -0
  413. package/src/cmd/generators/persistedQueries/index.ts +2 -2
  414. package/src/cmd/generators/runtime/adapter.ts +26 -4
  415. package/src/cmd/generators/runtime/copyRuntime.ts +4 -0
  416. package/src/cmd/generators/runtime/index.ts +3 -2
  417. package/src/cmd/generators/runtime/indexFile.test.ts +1 -0
  418. package/src/cmd/generators/runtime/indexFile.ts +3 -0
  419. package/src/cmd/generators/runtime/meta.test.ts +19 -0
  420. package/src/cmd/generators/runtime/meta.ts +13 -0
  421. package/src/cmd/generators/stores/fragment.ts +63 -0
  422. package/src/cmd/generators/stores/index.ts +53 -0
  423. package/src/cmd/generators/stores/mutation.ts +43 -0
  424. package/src/cmd/generators/stores/pagination.ts +63 -0
  425. package/src/cmd/generators/stores/query.test.ts +228 -0
  426. package/src/cmd/generators/stores/query.ts +60 -0
  427. package/src/cmd/generators/stores/subscription.ts +52 -0
  428. package/src/cmd/generators/typescript/index.ts +12 -7
  429. package/src/cmd/generators/typescript/typescript.test.ts +2 -1
  430. package/src/cmd/index.ts +1 -1
  431. package/src/cmd/init.ts +13 -15
  432. package/src/cmd/main.ts +43 -14
  433. package/src/cmd/testUtils.ts +4 -2
  434. package/src/cmd/transforms/fragmentVariables.test.ts +16 -0
  435. package/src/cmd/transforms/fragmentVariables.ts +4 -2
  436. package/src/cmd/transforms/list.ts +4 -2
  437. package/src/cmd/transforms/paginate.test.ts +64 -8
  438. package/src/cmd/transforms/paginate.ts +22 -6
  439. package/src/cmd/transforms/schema.ts +1 -1
  440. package/src/cmd/types.ts +6 -4
  441. package/src/cmd/utils/writeSchema.ts +0 -1
  442. package/src/common/config.ts +120 -45
  443. package/src/common/log.ts +14 -0
  444. package/src/common/tests.ts +2 -1
  445. package/src/common/types.ts +0 -7
  446. package/src/preprocess/index.ts +3 -2
  447. package/src/preprocess/transforms/fragment.test.ts +9 -7
  448. package/src/preprocess/transforms/fragment.ts +43 -25
  449. package/src/preprocess/transforms/mutation.test.ts +2 -3
  450. package/src/preprocess/transforms/mutation.ts +9 -11
  451. package/src/preprocess/transforms/query.test.ts +221 -638
  452. package/src/preprocess/transforms/query.ts +119 -360
  453. package/src/preprocess/transforms/subscription.test.ts +2 -2
  454. package/src/preprocess/transforms/subscription.ts +8 -15
  455. package/src/preprocess/utils/identifiers.ts +7 -0
  456. package/src/preprocess/utils/imports.ts +96 -0
  457. package/src/preprocess/utils/index.ts +2 -3
  458. package/src/preprocess/utils/preprocessorTest.ts +1 -1
  459. package/src/preprocess/utils/walkTaggedDocuments.ts +7 -2
  460. package/src/runtime/adapter.ts +27 -0
  461. package/src/runtime/cache/cache.ts +10 -7
  462. package/src/runtime/cache/lists.ts +54 -23
  463. package/src/runtime/cache/storage.ts +1 -1
  464. package/src/runtime/cache/subscription.ts +14 -13
  465. package/src/runtime/cache/tests/gc.test.ts +1 -1
  466. package/src/runtime/cache/tests/list.test.ts +84 -2
  467. package/src/runtime/cache/tests/scalars.test.ts +1 -1
  468. package/src/runtime/index.ts +3 -11
  469. package/src/runtime/{fragment.ts → inline/fragment.ts} +36 -9
  470. package/src/runtime/inline/index.ts +4 -0
  471. package/src/runtime/inline/mutation.ts +28 -0
  472. package/src/runtime/inline/query.ts +142 -0
  473. package/src/runtime/inline/subscription.ts +31 -0
  474. package/src/runtime/{config.ts → lib/config.ts} +3 -1
  475. package/src/runtime/lib/context.ts +33 -0
  476. package/src/runtime/lib/errors.ts +8 -0
  477. package/src/runtime/lib/index.ts +7 -0
  478. package/src/runtime/{network.ts → lib/network.ts} +56 -43
  479. package/src/runtime/{pagination.ts → lib/pagination.ts} +209 -213
  480. package/src/runtime/{proxy.ts → lib/proxy.ts} +0 -0
  481. package/src/runtime/{scalars.test.ts → lib/scalars.test.ts} +5 -4
  482. package/src/runtime/{scalars.ts → lib/scalars.ts} +0 -0
  483. package/src/runtime/{types.ts → lib/types.ts} +110 -10
  484. package/src/runtime/{utils.test.ts → lib/utils.test.ts} +0 -0
  485. package/src/runtime/{utils.ts → lib/utils.ts} +6 -2
  486. package/src/runtime/stores/fragment.ts +49 -0
  487. package/src/runtime/stores/index.ts +4 -0
  488. package/src/runtime/stores/mutation.ts +163 -0
  489. package/src/runtime/stores/query.ts +290 -0
  490. package/src/runtime/stores/subscription.ts +88 -0
  491. package/tsconfig.root.json +10 -0
  492. package/build/runtime-cjs/context.d.ts +0 -2
  493. package/build/runtime-cjs/context.js +0 -8
  494. package/build/runtime-cjs/fragment.d.ts +0 -3
  495. package/build/runtime-cjs/mutation.d.ts +0 -5
  496. package/build/runtime-cjs/pagination.d.ts +0 -16
  497. package/build/runtime-cjs/query.d.ts +0 -29
  498. package/build/runtime-cjs/query.js +0 -314
  499. package/build/runtime-cjs/subscription.js +0 -88
  500. package/build/runtime-esm/context.d.ts +0 -2
  501. package/build/runtime-esm/context.js +0 -3
  502. package/build/runtime-esm/fragment.d.ts +0 -3
  503. package/build/runtime-esm/mutation.d.ts +0 -5
  504. package/build/runtime-esm/pagination.d.ts +0 -16
  505. package/build/runtime-esm/query.d.ts +0 -29
  506. package/build/runtime-esm/query.js +0 -249
  507. package/build/runtime-esm/subscription.js +0 -80
  508. package/example/api.cjs +0 -8
  509. package/example/src/environment.ts +0 -46
  510. package/src/preprocess/utils/artifactImport.ts +0 -21
  511. package/src/preprocess/utils/ensureImports.ts +0 -43
  512. package/src/runtime/context.ts +0 -4
  513. package/src/runtime/mutation.ts +0 -113
  514. package/src/runtime/query.ts +0 -356
  515. package/src/runtime/subscription.ts +0 -107
@@ -0,0 +1,5 @@
1
+ ---
2
+ 'houdini': minor
3
+ ---
4
+
5
+ parentID directive and arguments are now relative to object containing the decorated field
@@ -0,0 +1,5 @@
1
+ ---
2
+ 'houdini': minor
3
+ ---
4
+
5
+ Added store-based APIs :tada:
@@ -0,0 +1,5 @@
1
+ ---
2
+ 'houdini': patch
3
+ ---
4
+
5
+ Fixed return type of inline mutation
@@ -0,0 +1,16 @@
1
+ {
2
+ "mode": "pre",
3
+ "tag": "next",
4
+ "initialVersions": {
5
+ "houdini": "0.14.7",
6
+ "example-kit": "0.13.0",
7
+ "integration": "0.0.1"
8
+ },
9
+ "changesets": [
10
+ "empty-socks-design",
11
+ "few-donkeys-teach",
12
+ "forty-geckos-grin",
13
+ "thin-readers-matter",
14
+ "wicked-lamps-smoke"
15
+ ]
16
+ }
@@ -0,0 +1,5 @@
1
+ ---
2
+ 'houdini': patch
3
+ ---
4
+
5
+ config.schemaPath can be a glob pointing to multiple files
@@ -0,0 +1,5 @@
1
+ ---
2
+ 'houdini': patch
3
+ ---
4
+
5
+ Fixed type generated for mutation results
@@ -0,0 +1,3 @@
1
+ # These are supported funding model platforms
2
+
3
+ open_collective: houdini
@@ -62,8 +62,8 @@ jobs:
62
62
  - name: Tests
63
63
  run: yarn tests
64
64
 
65
- generate:
66
- name: Generate runtime for example application
65
+ integration:
66
+ name: Integration Tests
67
67
  runs-on: ubuntu-latest
68
68
 
69
69
  steps:
@@ -85,5 +85,15 @@ jobs:
85
85
  - name: Build packages
86
86
  run: yarn build
87
87
 
88
- - name: Generate runtime
89
- run: cd example && yarn generate
88
+ - name: Install Playwright
89
+ run: npx playwright install --with-deps
90
+
91
+ - name: Integration Tests
92
+ run: yarn tests:integration
93
+
94
+ - name: Upload test results
95
+ if: always()
96
+ uses: actions/upload-artifact@v2
97
+ with:
98
+ name: playwright-report
99
+ path: integration/playwright-report
package/CHANGELOG.md CHANGED
@@ -1,5 +1,29 @@
1
1
  # houdini
2
2
 
3
+ ## 0.15.0-next.2
4
+
5
+ ### Patch Changes
6
+
7
+ - [#331](https://github.com/HoudiniGraphql/houdini/pull/331) [`41cd95a`](https://github.com/HoudiniGraphql/houdini/commit/41cd95a577e418b6937039da963f82c95bd79854) Thanks [@AlecAivazis](https://github.com/AlecAivazis)! - Fixed return type of inline mutation
8
+
9
+ ## 0.15.0-next.1
10
+
11
+ ### Minor Changes
12
+
13
+ - [#291](https://github.com/HoudiniGraphql/houdini/pull/291) [`17cd57e`](https://github.com/HoudiniGraphql/houdini/commit/17cd57eac72596823d2a4dddec85b6ac1a1d09dd) Thanks [@jycouet](https://github.com/jycouet)! - Added store-based APIs :tada:
14
+
15
+ ### Patch Changes
16
+
17
+ - [#321](https://github.com/HoudiniGraphql/houdini/pull/321) [`47bb94e`](https://github.com/HoudiniGraphql/houdini/commit/47bb94ea4b6c36210f1d2b7812613287fbe82e61) Thanks [@AlecAivazis](https://github.com/AlecAivazis)! - config.schemaPath can be a glob pointing to multiple files
18
+
19
+ * [#326](https://github.com/HoudiniGraphql/houdini/pull/326) [`dc4bf44`](https://github.com/HoudiniGraphql/houdini/commit/dc4bf44ff7507f2a8c58b50c651e9ac155a3ad8c) Thanks [@AlecAivazis](https://github.com/AlecAivazis)! - Fixed type generated for mutation results
20
+
21
+ ## 0.15.0-next.0
22
+
23
+ ### Minor Changes
24
+
25
+ - [#315](https://github.com/HoudiniGraphql/houdini/pull/315) [`4cf4b7f`](https://github.com/HoudiniGraphql/houdini/commit/4cf4b7f93d893ede734c7a067f03b14499cc9773) Thanks [@AlecAivazis](https://github.com/AlecAivazis)! - parentID directive and arguments are now relative to object containing the decorated field
26
+
3
27
  ## 0.14.8
4
28
 
5
29
  ### Patch Changes
@@ -0,0 +1,4 @@
1
+ import { Config } from '../common';
2
+ import { CollectedGraphQLDocument } from './types';
3
+ export default function compile(config: Config): Promise<void>;
4
+ export declare function runPipeline(config: Config, docs: CollectedGraphQLDocument[]): Promise<void>;
@@ -0,0 +1,441 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
26
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
27
+ return new (P || (P = Promise))(function (resolve, reject) {
28
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
29
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
30
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
31
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
32
+ });
33
+ };
34
+ var __generator = (this && this.__generator) || function (thisArg, body) {
35
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
36
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
37
+ function verb(n) { return function (v) { return step([n, v]); }; }
38
+ function step(op) {
39
+ if (f) throw new TypeError("Generator is already executing.");
40
+ while (_) try {
41
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
42
+ if (y = 0, t) op = [op[0] & 2, t.value];
43
+ switch (op[0]) {
44
+ case 0: case 1: t = op; break;
45
+ case 4: _.label++; return { value: op[1], done: false };
46
+ case 5: _.label++; y = op[1]; op = [0]; continue;
47
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
48
+ default:
49
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
50
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
51
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
52
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
53
+ if (t[2]) _.ops.pop();
54
+ _.trys.pop(); continue;
55
+ }
56
+ op = body.call(thisArg, _);
57
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
58
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
59
+ }
60
+ };
61
+ var __values = (this && this.__values) || function(o) {
62
+ var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
63
+ if (m) return m.call(o);
64
+ if (o && typeof o.length === "number") return {
65
+ next: function () {
66
+ if (o && i >= o.length) o = void 0;
67
+ return { value: o && o[i++], done: !o };
68
+ }
69
+ };
70
+ throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
71
+ };
72
+ var __read = (this && this.__read) || function (o, n) {
73
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
74
+ if (!m) return o;
75
+ var i = m.call(o), r, ar = [], e;
76
+ try {
77
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
78
+ }
79
+ catch (error) { e = { error: error }; }
80
+ finally {
81
+ try {
82
+ if (r && !r.done && (m = i["return"])) m.call(i);
83
+ }
84
+ finally { if (e) throw e.error; }
85
+ }
86
+ return ar;
87
+ };
88
+ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
89
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
90
+ if (ar || !(i in from)) {
91
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
92
+ ar[i] = from[i];
93
+ }
94
+ }
95
+ return to.concat(ar || Array.prototype.slice.call(from));
96
+ };
97
+ var __importDefault = (this && this.__importDefault) || function (mod) {
98
+ return (mod && mod.__esModule) ? mod : { "default": mod };
99
+ };
100
+ Object.defineProperty(exports, "__esModule", { value: true });
101
+ exports.runPipeline = void 0;
102
+ // externals
103
+ var glob_1 = __importDefault(require("glob"));
104
+ var svelte = __importStar(require("svelte/compiler"));
105
+ var promises_1 = __importDefault(require("fs/promises"));
106
+ var graphql = __importStar(require("graphql"));
107
+ var util_1 = require("util");
108
+ // locals
109
+ var common_1 = require("../common");
110
+ var types_1 = require("./types");
111
+ var transforms = __importStar(require("./transforms"));
112
+ var generators = __importStar(require("./generators"));
113
+ var validators = __importStar(require("./validators"));
114
+ // the main entry point of the compile script
115
+ function compile(config) {
116
+ return __awaiter(this, void 0, void 0, function () {
117
+ var documents;
118
+ return __generator(this, function (_a) {
119
+ switch (_a.label) {
120
+ case 0: return [4 /*yield*/, collectDocuments(config)
121
+ // push the documents through the pipeline
122
+ ];
123
+ case 1:
124
+ documents = _a.sent();
125
+ // push the documents through the pipeline
126
+ return [4 /*yield*/, runPipeline(config, documents)];
127
+ case 2:
128
+ // push the documents through the pipeline
129
+ _a.sent();
130
+ return [2 /*return*/];
131
+ }
132
+ });
133
+ });
134
+ }
135
+ exports.default = compile;
136
+ // the compiler's job can be broken down into a few different tasks after the documents have been collected:
137
+ // - validate their structure
138
+ // - perform a series of transformations
139
+ // - write the corresponding artifacts to disk
140
+ function runPipeline(config, docs) {
141
+ return __awaiter(this, void 0, void 0, function () {
142
+ var artifactStats, previousVersion, content, _a, _b, _c, versionChanged, unchanged, _d, _e, artifact, emoji;
143
+ var e_1, _f;
144
+ return __generator(this, function (_g) {
145
+ switch (_g.label) {
146
+ case 0:
147
+ // we need to create the runtime folder structure
148
+ return [4 /*yield*/, config.createDirectories()
149
+ // reset the newSchema accumulator
150
+ ];
151
+ case 1:
152
+ // we need to create the runtime folder structure
153
+ _g.sent();
154
+ // reset the newSchema accumulator
155
+ config.newSchema = '';
156
+ artifactStats = {
157
+ total: [],
158
+ changed: [],
159
+ new: [],
160
+ };
161
+ // notify the user we are starting the generation process
162
+ if (config.logLevel !== common_1.LogLevel.Quiet) {
163
+ console.log('🎩 Generating runtime...');
164
+ }
165
+ previousVersion = '';
166
+ _g.label = 2;
167
+ case 2:
168
+ _g.trys.push([2, 4, , 5]);
169
+ _b = (_a = JSON).parse;
170
+ return [4 /*yield*/, promises_1.default.readFile(config.metaFilePath, 'utf-8')];
171
+ case 3:
172
+ content = _b.apply(_a, [_g.sent()]);
173
+ previousVersion = content.version;
174
+ return [3 /*break*/, 5];
175
+ case 4:
176
+ _c = _g.sent();
177
+ return [3 /*break*/, 5];
178
+ case 5:
179
+ versionChanged = previousVersion !== 'HOUDINI_VERSION';
180
+ return [4 /*yield*/, (0, common_1.runPipeline)(config, [
181
+ validators.typeCheck,
182
+ validators.uniqueNames,
183
+ validators.noIDAlias,
184
+ transforms.internalSchema,
185
+ transforms.addID,
186
+ transforms.typename,
187
+ // list transform must go before fragment variables
188
+ // so that the mutation fragments are defined before they get mixed in
189
+ transforms.list,
190
+ // paginate transform needs to go before fragmentVariables
191
+ // so that the variable definitions get hashed
192
+ transforms.paginate,
193
+ transforms.fragmentVariables,
194
+ transforms.composeQueries,
195
+ generators.artifacts(artifactStats),
196
+ generators.runtime,
197
+ generators.typescript,
198
+ generators.persistOutput,
199
+ generators.schema,
200
+ generators.stores,
201
+ ], docs)
202
+ // don't log anything if its quiet
203
+ ];
204
+ case 6:
205
+ _g.sent();
206
+ // don't log anything if its quiet
207
+ if (config.logLevel === common_1.LogLevel.Quiet) {
208
+ }
209
+ else if (versionChanged) {
210
+ console.log('ℹ️ Detected new version of Houdini. Regenerating all documents...');
211
+ console.log('ℹ️ Welcome to the pre-release version for 0.15.0! Documentation can be found here: https://docs-git-0150-aaivazis.vercel.app/.');
212
+ console.log("ℹ️ For a description of what's changed, visit this guide: https://docs-git-0150-aaivazis.vercel.app/guides/migrating-to-0.15.0");
213
+ }
214
+ else if ([common_1.LogLevel.Summary, common_1.LogLevel.ShortSummary].includes(config.logLevel)) {
215
+ unchanged = artifactStats.total.length - artifactStats.changed.length - artifactStats.new.length;
216
+ // if we have any unchanged artifacts
217
+ if (unchanged > 0) {
218
+ console.log("\uD83D\uDCC3 Unchanged: ".concat(unchanged));
219
+ }
220
+ if (artifactStats.changed.length > 0) {
221
+ console.log("\u270F\uFE0F Changed: ".concat(artifactStats.changed.length));
222
+ if (config.logLevel === common_1.LogLevel.Summary) {
223
+ logFirst5(artifactStats.changed);
224
+ }
225
+ }
226
+ if (artifactStats.new.length > 0) {
227
+ console.log("\u2728 New: ".concat(artifactStats.new.length));
228
+ if (config.logLevel === common_1.LogLevel.Summary) {
229
+ logFirst5(artifactStats.new);
230
+ }
231
+ }
232
+ }
233
+ else if (config.logLevel === common_1.LogLevel.Full) {
234
+ try {
235
+ for (_d = __values(artifactStats.total), _e = _d.next(); !_e.done; _e = _d.next()) {
236
+ artifact = _e.value;
237
+ emoji = '📃';
238
+ if (artifactStats.changed.includes(artifact)) {
239
+ emoji = '✏️ ';
240
+ }
241
+ else if (artifactStats.new.includes(artifact)) {
242
+ emoji = '✨';
243
+ }
244
+ // log the name
245
+ console.log("".concat(emoji, " ").concat(artifact));
246
+ }
247
+ }
248
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
249
+ finally {
250
+ try {
251
+ if (_e && !_e.done && (_f = _d.return)) _f.call(_d);
252
+ }
253
+ finally { if (e_1) throw e_1.error; }
254
+ }
255
+ }
256
+ return [2 /*return*/];
257
+ }
258
+ });
259
+ });
260
+ }
261
+ exports.runPipeline = runPipeline;
262
+ function collectDocuments(config) {
263
+ return __awaiter(this, void 0, void 0, function () {
264
+ var sourceFiles, documents;
265
+ var _this = this;
266
+ return __generator(this, function (_a) {
267
+ switch (_a.label) {
268
+ case 0: return [4 /*yield*/, (0, util_1.promisify)(glob_1.default)(config.sourceGlob)
269
+ // the list of documents we found
270
+ ];
271
+ case 1:
272
+ sourceFiles = _a.sent();
273
+ documents = [];
274
+ // wait for every file to be processed
275
+ return [4 /*yield*/, Promise.all(sourceFiles.map(function (filepath) { return __awaiter(_this, void 0, void 0, function () {
276
+ var contents, _a, _b, _c, _d;
277
+ return __generator(this, function (_e) {
278
+ switch (_e.label) {
279
+ case 0: return [4 /*yield*/, promises_1.default.readFile(filepath, 'utf-8')
280
+ // if the file ends with .svelte, we need to look for graphql template tags
281
+ ];
282
+ case 1:
283
+ contents = _e.sent();
284
+ if (!filepath.endsWith('.svelte')) return [3 /*break*/, 3];
285
+ _b = (_a = documents.push).apply;
286
+ _c = [documents];
287
+ _d = [[]];
288
+ return [4 /*yield*/, findGraphQLTemplates(filepath, contents)];
289
+ case 2:
290
+ _b.apply(_a, _c.concat([__spreadArray.apply(void 0, _d.concat([__read.apply(void 0, [(_e.sent())]), false]))]));
291
+ return [3 /*break*/, 4];
292
+ case 3:
293
+ documents.push({ filepath: filepath, document: contents });
294
+ _e.label = 4;
295
+ case 4: return [2 /*return*/];
296
+ }
297
+ });
298
+ }); }))];
299
+ case 2:
300
+ // wait for every file to be processed
301
+ _a.sent();
302
+ return [4 /*yield*/, Promise.all(documents.map(function (_a) {
303
+ var document = _a.document, filepath = _a.filepath;
304
+ return processGraphQLDocument(config, filepath, document);
305
+ }))];
306
+ case 3: return [2 /*return*/, _a.sent()];
307
+ }
308
+ });
309
+ });
310
+ }
311
+ function findGraphQLTemplates(filepath, contents) {
312
+ return __awaiter(this, void 0, void 0, function () {
313
+ var documents, parsedFile, e_2, err, scripts;
314
+ var _this = this;
315
+ return __generator(this, function (_a) {
316
+ switch (_a.label) {
317
+ case 0:
318
+ documents = [];
319
+ _a.label = 1;
320
+ case 1:
321
+ _a.trys.push([1, 3, , 4]);
322
+ return [4 /*yield*/, (0, common_1.parseFile)(contents)];
323
+ case 2:
324
+ parsedFile = _a.sent();
325
+ return [3 /*break*/, 4];
326
+ case 3:
327
+ e_2 = _a.sent();
328
+ err = e_2;
329
+ // add the filepath to the error message
330
+ throw new Error("Encountered error parsing ".concat(filepath, ": ") + err.message);
331
+ case 4:
332
+ scripts = [parsedFile.instance, parsedFile.module]
333
+ .map(function (script) { return (script ? script.content : null); })
334
+ .filter(Boolean);
335
+ return [4 /*yield*/, Promise.all(scripts.map(function (jsContent) { return __awaiter(_this, void 0, void 0, function () {
336
+ return __generator(this, function (_a) {
337
+ // @ts-ignore
338
+ // look for any template tag literals in the script body
339
+ svelte.walk(jsContent, {
340
+ enter: function (node) {
341
+ // if we are looking at the graphql template tag
342
+ if (node.type === 'TaggedTemplateExpression' &&
343
+ // @ts-ignore
344
+ node.tag.name === 'graphql') {
345
+ // @ts-ignore
346
+ // parse the tag contents to get the info we need
347
+ var printedDoc = node.quasi.quasis[0].value.raw;
348
+ documents.push({ document: printedDoc, filepath: filepath });
349
+ }
350
+ },
351
+ });
352
+ return [2 /*return*/];
353
+ });
354
+ }); }))
355
+ // we found every document in the file
356
+ ];
357
+ case 5:
358
+ _a.sent();
359
+ // we found every document in the file
360
+ return [2 /*return*/, documents];
361
+ }
362
+ });
363
+ });
364
+ }
365
+ function processGraphQLDocument(config, filepath, document) {
366
+ return __awaiter(this, void 0, void 0, function () {
367
+ var parsedDoc, operations, fragments, kind;
368
+ return __generator(this, function (_a) {
369
+ parsedDoc = graphql.parse(document);
370
+ operations = parsedDoc.definitions.filter(function (_a) {
371
+ var kind = _a.kind;
372
+ return kind === graphql.Kind.OPERATION_DEFINITION;
373
+ });
374
+ fragments = parsedDoc.definitions.filter(function (_a) {
375
+ var kind = _a.kind;
376
+ return kind === graphql.Kind.FRAGMENT_DEFINITION;
377
+ });
378
+ // if there is more than one operation, throw an error
379
+ if (operations.length > 1) {
380
+ throw new Error('Operation documents can only have one operation');
381
+ }
382
+ // we are looking at a fragment document
383
+ else {
384
+ // if there is more than one fragment, throw an error
385
+ if (fragments.length > 1) {
386
+ throw new Error('Fragment documents can only have one fragment');
387
+ }
388
+ }
389
+ kind = types_1.ArtifactKind.Fragment;
390
+ if (operations.length === 1) {
391
+ // the document kind depends on the artifact
392
+ // query
393
+ if (operations[0].kind === 'OperationDefinition' && operations[0].operation === 'query') {
394
+ kind = types_1.ArtifactKind.Query;
395
+ }
396
+ // mutation
397
+ else if (operations[0].kind === 'OperationDefinition' &&
398
+ operations[0].operation === 'mutation') {
399
+ kind = types_1.ArtifactKind.Mutation;
400
+ }
401
+ // subscription
402
+ else if (operations[0].kind === 'OperationDefinition' &&
403
+ operations[0].operation === 'subscription') {
404
+ kind = types_1.ArtifactKind.Subcription;
405
+ }
406
+ }
407
+ // add it to the list
408
+ return [2 /*return*/, {
409
+ name: config.documentName(parsedDoc),
410
+ kind: kind,
411
+ document: parsedDoc,
412
+ filename: filepath,
413
+ originalDocument: parsedDoc,
414
+ generateArtifact: true,
415
+ generateStore: true,
416
+ originalString: document,
417
+ }];
418
+ });
419
+ });
420
+ }
421
+ function logFirst5(values) {
422
+ var e_3, _a;
423
+ try {
424
+ // grab the first 5 changed documents
425
+ for (var _b = __values(values.slice(0, 5)), _c = _b.next(); !_c.done; _c = _b.next()) {
426
+ var artifact = _c.value;
427
+ console.log(" ".concat(artifact));
428
+ }
429
+ }
430
+ catch (e_3_1) { e_3 = { error: e_3_1 }; }
431
+ finally {
432
+ try {
433
+ if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
434
+ }
435
+ finally { if (e_3) throw e_3.error; }
436
+ }
437
+ // if there are more than 5 just tell them how many
438
+ if (values.length > 5) {
439
+ console.log(" ... ".concat(values.length - 5, " more"));
440
+ }
441
+ }
@@ -0,0 +1,3 @@
1
+ import * as graphql from 'graphql';
2
+ import { Config } from '../../../common';
3
+ export default function fieldKey(config: Config, field: graphql.FieldNode): string;
@@ -0,0 +1,83 @@
1
+ "use strict";
2
+ var __assign = (this && this.__assign) || function () {
3
+ __assign = Object.assign || function(t) {
4
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
5
+ s = arguments[i];
6
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
+ t[p] = s[p];
8
+ }
9
+ return t;
10
+ };
11
+ return __assign.apply(this, arguments);
12
+ };
13
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
14
+ if (k2 === undefined) k2 = k;
15
+ var desc = Object.getOwnPropertyDescriptor(m, k);
16
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
17
+ desc = { enumerable: true, get: function() { return m[k]; } };
18
+ }
19
+ Object.defineProperty(o, k2, desc);
20
+ }) : (function(o, m, k, k2) {
21
+ if (k2 === undefined) k2 = k;
22
+ o[k2] = m[k];
23
+ }));
24
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
25
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
26
+ }) : function(o, v) {
27
+ o["default"] = v;
28
+ });
29
+ var __importStar = (this && this.__importStar) || function (mod) {
30
+ if (mod && mod.__esModule) return mod;
31
+ var result = {};
32
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
33
+ __setModuleDefault(result, mod);
34
+ return result;
35
+ };
36
+ Object.defineProperty(exports, "__esModule", { value: true });
37
+ // external imports
38
+ var graphql = __importStar(require("graphql"));
39
+ // we need to generate a static key that we can use to index this field in the cache.
40
+ // this needs to be a unique hash driven by the field's attribute and arguments
41
+ // returns the key for a specific field
42
+ function fieldKey(config, field) {
43
+ var _a, _b;
44
+ // we're going to hash a field by creating a json object and adding it
45
+ // to the attribute name
46
+ var attributeName = ((_a = field.alias) === null || _a === void 0 ? void 0 : _a.value) || field.name.value;
47
+ // field might not have a location so print and re-parse before we look at serialized values
48
+ var printed = graphql.print(field);
49
+ var secondParse = graphql.parse("{".concat(printed, "}"))
50
+ .definitions[0].selectionSet
51
+ .selections[0];
52
+ // if the field is paginated, we need to strip away any args
53
+ var paginated = !!((_b = field.directives) === null || _b === void 0 ? void 0 : _b.find(function (directive) { return directive.name.value === config.paginateDirective; }));
54
+ var paginationArgs = ['first', 'after', 'last', 'before', 'limit', 'offset'];
55
+ var argObj = (secondParse.arguments || []).reduce(function (acc, arg) {
56
+ var _a;
57
+ var _b, _c;
58
+ // the query already contains a serialized version of the argument so just pull it out of the
59
+ // document string
60
+ var start = (_b = arg.value.loc) === null || _b === void 0 ? void 0 : _b.start;
61
+ var end = (_c = arg.value.loc) === null || _c === void 0 ? void 0 : _c.end;
62
+ // if the field is paginated, ignore the pagination args in the key
63
+ if (paginated && paginationArgs.includes(arg.name.value)) {
64
+ return acc;
65
+ }
66
+ // if the argument is not in the query, life doesn't make sense
67
+ if (!start || !end) {
68
+ return acc;
69
+ }
70
+ return __assign(__assign({}, acc), (_a = {}, _a[arg.name.value] = printed.substring(start - 1, end - 1), _a));
71
+ }, {});
72
+ var key = Object.values(argObj).length > 0
73
+ ? "".concat(attributeName, "(").concat(Object.entries(argObj)
74
+ .map(function (entries) { return entries.join(': '); })
75
+ .join(', '), ")")
76
+ : attributeName;
77
+ // if the field is paginated, key it differently so other documents can ask for the non paginated value without conflict
78
+ if (paginated) {
79
+ key = key + '::paginated';
80
+ }
81
+ return key;
82
+ }
83
+ exports.default = fieldKey;
@@ -0,0 +1,7 @@
1
+ import { CollectedGraphQLDocument } from '../../types';
2
+ import { Config } from '../../../common';
3
+ export default function artifactGenerator(stats: {
4
+ total: string[];
5
+ new: string[];
6
+ changed: string[];
7
+ }): (config: Config, docs: CollectedGraphQLDocument[]) => Promise<void>;