houdini 0.17.9 → 0.17.11

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 (121) hide show
  1. package/README.md +33 -0
  2. package/build/cmd-cjs/index.js +2 -2
  3. package/build/cmd-esm/index.js +2 -2
  4. package/package.json +16 -1
  5. package/.turbo/turbo-compile.log +0 -5
  6. package/.turbo/turbo-typedefs.log +0 -5
  7. package/CHANGELOG.md +0 -377
  8. package/src/cmd/generate.ts +0 -54
  9. package/src/cmd/index.ts +0 -60
  10. package/src/cmd/init.ts +0 -637
  11. package/src/cmd/pullSchema.ts +0 -40
  12. package/src/codegen/generators/artifacts/artifacts.test.ts +0 -3246
  13. package/src/codegen/generators/artifacts/fieldKey.ts +0 -60
  14. package/src/codegen/generators/artifacts/index.ts +0 -330
  15. package/src/codegen/generators/artifacts/indexFile.ts +0 -24
  16. package/src/codegen/generators/artifacts/inputs.ts +0 -81
  17. package/src/codegen/generators/artifacts/operations.ts +0 -281
  18. package/src/codegen/generators/artifacts/pagination.test.ts +0 -664
  19. package/src/codegen/generators/artifacts/policy.test.ts +0 -298
  20. package/src/codegen/generators/artifacts/selection.ts +0 -208
  21. package/src/codegen/generators/artifacts/utils.test.ts +0 -118
  22. package/src/codegen/generators/artifacts/utils.ts +0 -108
  23. package/src/codegen/generators/definitions/enums.test.ts +0 -61
  24. package/src/codegen/generators/definitions/enums.ts +0 -68
  25. package/src/codegen/generators/definitions/index.ts +0 -11
  26. package/src/codegen/generators/definitions/schema.test.ts +0 -236
  27. package/src/codegen/generators/index.ts +0 -6
  28. package/src/codegen/generators/indexFile/index.ts +0 -63
  29. package/src/codegen/generators/indexFile/indexFile.test.ts +0 -72
  30. package/src/codegen/generators/persistedQueries/index.ts +0 -55
  31. package/src/codegen/generators/persistedQueries/persistedQuery.test.ts +0 -26
  32. package/src/codegen/generators/runtime/index.test.ts +0 -74
  33. package/src/codegen/generators/runtime/index.ts +0 -64
  34. package/src/codegen/generators/runtime/runtime.test.ts +0 -25
  35. package/src/codegen/generators/typescript/addReferencedInputTypes.ts +0 -77
  36. package/src/codegen/generators/typescript/index.ts +0 -412
  37. package/src/codegen/generators/typescript/inlineType.ts +0 -409
  38. package/src/codegen/generators/typescript/typeReference.ts +0 -44
  39. package/src/codegen/generators/typescript/types.ts +0 -81
  40. package/src/codegen/generators/typescript/typescript.test.ts +0 -1434
  41. package/src/codegen/index.ts +0 -406
  42. package/src/codegen/transforms/addID.test.ts +0 -93
  43. package/src/codegen/transforms/addID.ts +0 -86
  44. package/src/codegen/transforms/composeQueries.test.ts +0 -50
  45. package/src/codegen/transforms/composeQueries.ts +0 -154
  46. package/src/codegen/transforms/fragmentVariables.test.ts +0 -636
  47. package/src/codegen/transforms/fragmentVariables.ts +0 -417
  48. package/src/codegen/transforms/index.ts +0 -7
  49. package/src/codegen/transforms/list.ts +0 -484
  50. package/src/codegen/transforms/lists.test.ts +0 -530
  51. package/src/codegen/transforms/paginate.test.ts +0 -1528
  52. package/src/codegen/transforms/paginate.ts +0 -770
  53. package/src/codegen/transforms/schema.test.ts +0 -136
  54. package/src/codegen/transforms/schema.ts +0 -109
  55. package/src/codegen/transforms/typename.test.ts +0 -125
  56. package/src/codegen/transforms/typename.ts +0 -55
  57. package/src/codegen/utils/commonjs.ts +0 -26
  58. package/src/codegen/utils/flattenSelections.ts +0 -179
  59. package/src/codegen/utils/graphql.test.ts +0 -35
  60. package/src/codegen/utils/graphql.ts +0 -79
  61. package/src/codegen/utils/index.ts +0 -5
  62. package/src/codegen/utils/moduleExport.ts +0 -27
  63. package/src/codegen/utils/murmur.ts +0 -79
  64. package/src/codegen/validators/index.ts +0 -4
  65. package/src/codegen/validators/noIDAlias.test.ts +0 -71
  66. package/src/codegen/validators/noIDAlias.ts +0 -39
  67. package/src/codegen/validators/plugins.ts +0 -25
  68. package/src/codegen/validators/typeCheck.test.ts +0 -960
  69. package/src/codegen/validators/typeCheck.ts +0 -1086
  70. package/src/codegen/validators/uniqueNames.test.ts +0 -59
  71. package/src/codegen/validators/uniqueNames.ts +0 -39
  72. package/src/lib/cleanupFiles.ts +0 -20
  73. package/src/lib/config.test.ts +0 -13
  74. package/src/lib/config.ts +0 -954
  75. package/src/lib/constants.ts +0 -11
  76. package/src/lib/error.ts +0 -24
  77. package/src/lib/fs.ts +0 -285
  78. package/src/lib/graphql.test.ts +0 -211
  79. package/src/lib/graphql.ts +0 -200
  80. package/src/lib/imports.ts +0 -82
  81. package/src/lib/index.ts +0 -17
  82. package/src/lib/introspection.ts +0 -39
  83. package/src/lib/parse.test.ts +0 -75
  84. package/src/lib/parse.ts +0 -23
  85. package/src/lib/path.ts +0 -49
  86. package/src/lib/pipeline.ts +0 -17
  87. package/src/lib/types.ts +0 -34
  88. package/src/lib/walk.ts +0 -104
  89. package/src/runtime/cache/cache.ts +0 -1026
  90. package/src/runtime/cache/gc.ts +0 -56
  91. package/src/runtime/cache/index.ts +0 -3
  92. package/src/runtime/cache/lists.ts +0 -516
  93. package/src/runtime/cache/storage.ts +0 -574
  94. package/src/runtime/cache/stuff.ts +0 -77
  95. package/src/runtime/cache/subscription.ts +0 -329
  96. package/src/runtime/cache/tests/availability.test.ts +0 -408
  97. package/src/runtime/cache/tests/gc.test.ts +0 -319
  98. package/src/runtime/cache/tests/keys.test.ts +0 -36
  99. package/src/runtime/cache/tests/list.test.ts +0 -3854
  100. package/src/runtime/cache/tests/readwrite.test.ts +0 -1201
  101. package/src/runtime/cache/tests/scalars.test.ts +0 -218
  102. package/src/runtime/cache/tests/storage.test.ts +0 -426
  103. package/src/runtime/cache/tests/subscriptions.test.ts +0 -1757
  104. package/src/runtime/index.ts +0 -29
  105. package/src/runtime/lib/config.ts +0 -211
  106. package/src/runtime/lib/constants.ts +0 -17
  107. package/src/runtime/lib/deepEquals.ts +0 -32
  108. package/src/runtime/lib/errors.ts +0 -8
  109. package/src/runtime/lib/index.ts +0 -8
  110. package/src/runtime/lib/log.ts +0 -69
  111. package/src/runtime/lib/network.ts +0 -303
  112. package/src/runtime/lib/networkUtils.ts +0 -151
  113. package/src/runtime/lib/scalars.test.ts +0 -877
  114. package/src/runtime/lib/scalars.ts +0 -195
  115. package/src/runtime/lib/types.ts +0 -195
  116. package/src/test/index.ts +0 -294
  117. package/src/vite/ast.ts +0 -107
  118. package/src/vite/houdini.ts +0 -113
  119. package/src/vite/imports.ts +0 -129
  120. package/src/vite/index.ts +0 -55
  121. package/src/vite/schema.ts +0 -80
@@ -1,530 +0,0 @@
1
- import { test, expect } from 'vitest'
2
-
3
- import { runPipeline } from '../../codegen'
4
- import { mockCollectedDoc, testConfig } from '../../test'
5
-
6
- test('insert fragments on query selection set', async function () {
7
- const docs = [
8
- mockCollectedDoc(
9
- `
10
- mutation UpdateUser {
11
- updateUser {
12
- ...User_Friends_insert
13
- }
14
- }
15
- `
16
- ),
17
- mockCollectedDoc(
18
- `
19
- query AllUsers {
20
- user {
21
- friends @list(name:"User_Friends") {
22
- firstName
23
- id
24
- }
25
- }
26
- }
27
- `
28
- ),
29
- ]
30
-
31
- // run the pipeline
32
- const config = testConfig()
33
- await runPipeline(config, docs)
34
-
35
- expect(docs[0].document).toMatchInlineSnapshot(`
36
- mutation UpdateUser {
37
- updateUser {
38
- ...User_Friends_insert
39
- id
40
- }
41
- }
42
-
43
- fragment User_Friends_insert on User {
44
- firstName
45
- id
46
- }
47
-
48
- `)
49
- })
50
-
51
- test('delete fragments on query selection set', async function () {
52
- const docs = [
53
- mockCollectedDoc(
54
- `
55
- mutation UpdateUser {
56
- updateUser {
57
- ...User_Friends_remove
58
- }
59
- }
60
- `
61
- ),
62
- mockCollectedDoc(
63
- `
64
- query AllUsers {
65
- user {
66
- friends @list(name:"User_Friends") {
67
- firstName
68
- id
69
- }
70
- }
71
- }
72
- `
73
- ),
74
- ]
75
-
76
- // run the pipeline
77
- const config = testConfig()
78
- await runPipeline(config, docs)
79
-
80
- expect(docs[0].document).toMatchInlineSnapshot(`
81
- mutation UpdateUser {
82
- updateUser {
83
- ...User_Friends_remove
84
- id
85
- }
86
- }
87
-
88
- fragment User_Friends_remove on User {
89
- id
90
- }
91
-
92
- `)
93
- })
94
-
95
- test('list fragments on fragment selection set', async function () {
96
- const docs = [
97
- mockCollectedDoc(
98
- `
99
- mutation UpdateUser {
100
- updateUser {
101
- ...User_Friends_insert @prepend(parentID: "1234")
102
- }
103
- }
104
- `
105
- ),
106
- mockCollectedDoc(
107
- `
108
- fragment AllUsers on User{
109
- friends @list(name:"User_Friends") {
110
- firstName
111
- id
112
- }
113
- }
114
- `
115
- ),
116
- ]
117
-
118
- // run the pipeline
119
- const config = testConfig()
120
- await runPipeline(config, docs)
121
-
122
- expect(docs[0].document).toMatchInlineSnapshot(`
123
- mutation UpdateUser {
124
- updateUser {
125
- ...User_Friends_insert @prepend(parentID: "1234")
126
- id
127
- }
128
- }
129
-
130
- fragment User_Friends_insert on User {
131
- firstName
132
- id
133
- }
134
-
135
- `)
136
- })
137
-
138
- test('delete node', async function () {
139
- const docs = [
140
- mockCollectedDoc(
141
- `
142
- mutation DeleteUser {
143
- deleteUser(id: "1234") {
144
- userID @User_delete
145
- }
146
- }
147
- `
148
- ),
149
- mockCollectedDoc(
150
- `
151
- fragment AllUsers on User{
152
- friends @list(name:"User_Friends") {
153
- firstName
154
- id
155
- }
156
- }
157
- `
158
- ),
159
- ]
160
-
161
- // the document should validate
162
- await expect(runPipeline(testConfig(), docs)).resolves.toBeUndefined()
163
- })
164
-
165
- test('delete node from connection', async function () {
166
- const docs = [
167
- mockCollectedDoc(
168
- `
169
- mutation DeleteUser {
170
- deleteUser(id: "1234") {
171
- userID @User_delete
172
- }
173
- }
174
- `
175
- ),
176
- mockCollectedDoc(
177
- `
178
- fragment AllUsers on User{
179
- friendsByCursor @list(name:"User_Friends") {
180
- edges {
181
- node {
182
- firstName
183
- id
184
- }
185
- }
186
- }
187
- }
188
- `
189
- ),
190
- ]
191
-
192
- expect(docs[0].document).toMatchInlineSnapshot(`
193
- mutation DeleteUser {
194
- deleteUser(id: "1234") {
195
- userID @User_delete
196
- }
197
- }
198
-
199
- `)
200
- })
201
-
202
- test('list fragments must be unique', async function () {
203
- const docs = [
204
- mockCollectedDoc(
205
- `
206
- query AllUsers {
207
- user {
208
- friends @list(name:"User_Friends") {
209
- firstName
210
- id
211
- }
212
- otherFriends: friends @list(name:"User_Friends") {
213
- firstName
214
- id
215
- }
216
- }
217
- }
218
- `
219
- ),
220
- ]
221
-
222
- // run the pipeline and make sure it fails
223
- await expect(runPipeline(testConfig(), docs)).rejects.toBeTruthy()
224
- })
225
-
226
- test("fragment with list doesn't clutter its definition", async function () {
227
- const docs = [
228
- mockCollectedDoc(`fragment Friends on User {
229
- friends @list(name:"Friends") {
230
- id
231
- }
232
- }`),
233
- ]
234
-
235
- // run the pipeline
236
- const config = testConfig()
237
- await runPipeline(config, docs)
238
-
239
- expect(docs[0].document).toMatchInlineSnapshot(`
240
- fragment Friends on User {
241
- friends @list(name: "Friends") {
242
- id
243
- }
244
- }
245
-
246
- `)
247
- })
248
-
249
- test('includes `id` in list fragment', async function () {
250
- const docs = [
251
- mockCollectedDoc(
252
- `
253
- mutation UpdateUser {
254
- updateUser {
255
- ...User_Friends_insert @prepend(parentID: "1234")
256
- }
257
- }
258
- `
259
- ),
260
- mockCollectedDoc(
261
- `
262
- fragment AllUsers on User{
263
- friends @list(name:"User_Friends") {
264
- id
265
- firstName
266
- }
267
- }
268
- `
269
- ),
270
- ]
271
-
272
- // run the pipeline
273
- const config = testConfig()
274
- await runPipeline(config, docs)
275
-
276
- expect(docs[0].document).toMatchInlineSnapshot(`
277
- mutation UpdateUser {
278
- updateUser {
279
- ...User_Friends_insert @prepend(parentID: "1234")
280
- id
281
- }
282
- }
283
-
284
- fragment User_Friends_insert on User {
285
- id
286
- firstName
287
- }
288
-
289
- `)
290
- })
291
-
292
- test('connections marked with list directive get cursor information', async function () {
293
- const docs = [
294
- mockCollectedDoc(
295
- `
296
- fragment AllUsers on User{
297
- friendsByCursor @list(name:"User_Friends") {
298
- edges {
299
- node {
300
- id
301
- firstName
302
- friends {
303
- id
304
- }
305
- }
306
- }
307
- }
308
- }
309
- `
310
- ),
311
- ]
312
-
313
- // run the pipeline
314
- const config = testConfig()
315
- await runPipeline(config, docs)
316
-
317
- expect(docs[0].document).toMatchInlineSnapshot(`
318
- fragment AllUsers on User {
319
- friendsByCursor @list(name: "User_Friends", connection: true) {
320
- edges {
321
- node {
322
- id
323
- firstName
324
- friends {
325
- id
326
- }
327
- }
328
- }
329
- edges {
330
- cursor
331
- node {
332
- __typename
333
- }
334
- }
335
- pageInfo {
336
- hasPreviousPage
337
- hasNextPage
338
- startCursor
339
- endCursor
340
- }
341
- }
342
- }
343
-
344
- `)
345
- })
346
-
347
- test('includes node selection on connection', async function () {
348
- const docs = [
349
- mockCollectedDoc(
350
- `
351
- mutation UpdateUser {
352
- updateUser {
353
- ...User_Friends_insert @prepend(parentID: "1234")
354
- }
355
- }
356
- `
357
- ),
358
- mockCollectedDoc(
359
- `
360
- fragment AllUsers on User{
361
- friendsByCursor @list(name:"User_Friends") {
362
- edges {
363
- node {
364
- id
365
- firstName
366
- friends {
367
- id
368
- }
369
- }
370
- }
371
- }
372
- }
373
- `
374
- ),
375
- ]
376
-
377
- // run the pipeline
378
- const config = testConfig()
379
- await runPipeline(config, docs)
380
-
381
- expect(docs[0].document).toMatchInlineSnapshot(`
382
- mutation UpdateUser {
383
- updateUser {
384
- ...User_Friends_insert @prepend(parentID: "1234")
385
- id
386
- }
387
- }
388
-
389
- fragment User_Friends_insert on User {
390
- id
391
- firstName
392
- friends {
393
- id
394
- }
395
- }
396
-
397
- `)
398
- })
399
-
400
- test('list flags connections', async function () {
401
- const docs = [
402
- mockCollectedDoc(
403
- `
404
- fragment AllUsers on User {
405
- friendsByCursor @list(name:"User_Friends") {
406
- edges {
407
- node {
408
- id
409
- firstName
410
- friends {
411
- id
412
- }
413
- }
414
- }
415
- }
416
- }
417
- `
418
- ),
419
- ]
420
-
421
- // run the pipeline
422
- const config = testConfig()
423
- await runPipeline(config, docs)
424
-
425
- expect(docs[0].document).toMatchInlineSnapshot(`
426
- fragment AllUsers on User {
427
- friendsByCursor @list(name: "User_Friends", connection: true) {
428
- edges {
429
- node {
430
- id
431
- firstName
432
- friends {
433
- id
434
- }
435
- }
436
- }
437
- edges {
438
- cursor
439
- node {
440
- __typename
441
- }
442
- }
443
- pageInfo {
444
- hasPreviousPage
445
- hasNextPage
446
- startCursor
447
- endCursor
448
- }
449
- }
450
- }
451
-
452
- `)
453
- })
454
-
455
- test('cannot use list directive if id is not a valid field', async function () {
456
- const docs = [
457
- mockCollectedDoc(
458
- `
459
- query AllGhosts {
460
- ghost {
461
- friends {
462
- legends @list(name: "Ghost_Friends"){
463
- name
464
- }
465
- }
466
- }
467
- }
468
- `
469
- ),
470
- ]
471
-
472
- // run the pipeline
473
- const config = testConfig()
474
- await expect(runPipeline(config, docs)).rejects.toBeTruthy()
475
- })
476
-
477
- test('paginate with name also gets treated as a list', async function () {
478
- const docs = [
479
- mockCollectedDoc(
480
- `
481
- mutation UpdateUser {
482
- updateUser {
483
- ...User_Friends_insert @prepend(parentID: "1234")
484
- }
485
- }
486
- `
487
- ),
488
- mockCollectedDoc(
489
- `
490
- fragment AllUsers on User{
491
- friendsByCursor(first: 10) @paginate(name:"User_Friends") {
492
- edges {
493
- node {
494
- id
495
- firstName
496
- friends {
497
- id
498
- }
499
- }
500
- }
501
- }
502
- }
503
- `
504
- ),
505
- ]
506
-
507
- // run the pipeline
508
- const config = testConfig()
509
- await runPipeline(config, docs)
510
-
511
- expect(docs[0].document).toMatchInlineSnapshot(`
512
- mutation UpdateUser {
513
- updateUser {
514
- ...User_Friends_insert @prepend(parentID: "1234")
515
- id
516
- }
517
- }
518
-
519
- fragment User_Friends_insert on User {
520
- id
521
- firstName
522
- friends {
523
- id
524
- }
525
- }
526
-
527
- `)
528
- })
529
-
530
- test.todo('cursor could be a Cursor scalar, not as string')