houdini 0.10.7 → 0.11.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 (120) hide show
  1. package/README.md +81 -22
  2. package/build/cmd/generate.js +23 -0
  3. package/build/cmd/generators/artifacts/index.js +25 -33
  4. package/build/cmd/generators/artifacts/selection.d.ts +2 -2
  5. package/build/cmd/generators/artifacts/selection.js +7 -7
  6. package/build/cmd/generators/runtime/adapter.js +3 -3
  7. package/build/cmd/generators/typescript/index.js +80 -123
  8. package/build/cmd/generators/typescript/inlineType.js +1 -2
  9. package/build/cmd/init.d.ts +3 -1
  10. package/build/cmd/init.js +21 -5
  11. package/build/cmd/main.js +15 -4
  12. package/build/cmd/testUtils.js +22 -0
  13. package/build/cmd/transforms/fragmentVariables.js +2 -0
  14. package/build/cmd/transforms/list.js +2 -0
  15. package/build/cmd/transforms/paginate.js +7 -5
  16. package/build/cmd/transforms/schema.js +2 -1
  17. package/build/cmd/types.d.ts +2 -1
  18. package/build/cmd/utils/flattenSelections.d.ts +6 -0
  19. package/build/cmd/utils/flattenSelections.js +120 -0
  20. package/build/cmd/utils/index.d.ts +2 -0
  21. package/build/cmd/utils/index.js +2 -0
  22. package/build/cmd/utils/writeSchema.d.ts +1 -1
  23. package/build/cmd/utils/writeSchema.js +42 -9
  24. package/build/cmd.js +38700 -38544
  25. package/build/runtime/cache/cache.d.ts +10 -3
  26. package/build/runtime/cache/cache.js +124 -4
  27. package/build/runtime/cache/index.d.ts +2 -2
  28. package/build/runtime/cache/index.js +10 -2
  29. package/build/runtime/cache/list.d.ts +1 -1
  30. package/build/runtime/cache/list.js +1 -1
  31. package/build/runtime/cache/record.d.ts +3 -1
  32. package/build/runtime/cache/record.js +43 -1
  33. package/build/runtime/mutation.js +1 -1
  34. package/build/runtime/network.d.ts +10 -12
  35. package/build/runtime/network.js +96 -32
  36. package/build/runtime/pagination.d.ts +4 -3
  37. package/build/runtime/pagination.js +141 -46
  38. package/build/runtime/query.d.ts +8 -3
  39. package/build/runtime/query.js +70 -25
  40. package/build/runtime/types.d.ts +22 -4
  41. package/build/runtime/types.js +20 -1
  42. package/build/runtime/utils.d.ts +1 -0
  43. package/build/runtime/utils.js +40 -1
  44. package/build/runtime-cjs/cache/cache.d.ts +10 -3
  45. package/build/runtime-cjs/cache/cache.js +124 -4
  46. package/build/runtime-cjs/cache/index.d.ts +2 -2
  47. package/build/runtime-cjs/cache/index.js +10 -2
  48. package/build/runtime-cjs/cache/list.js +1 -1
  49. package/build/runtime-cjs/cache/record.d.ts +2 -0
  50. package/build/runtime-cjs/cache/record.js +43 -1
  51. package/build/runtime-cjs/mutation.js +1 -1
  52. package/build/runtime-cjs/network.d.ts +10 -12
  53. package/build/runtime-cjs/network.js +96 -32
  54. package/build/runtime-cjs/pagination.d.ts +4 -3
  55. package/build/runtime-cjs/pagination.js +141 -46
  56. package/build/runtime-cjs/query.d.ts +8 -3
  57. package/build/runtime-cjs/query.js +70 -25
  58. package/build/runtime-cjs/types.d.ts +22 -4
  59. package/build/runtime-cjs/types.js +20 -1
  60. package/build/runtime-cjs/utils.d.ts +1 -0
  61. package/build/runtime-cjs/utils.js +40 -1
  62. package/build/runtime-esm/cache/cache.d.ts +10 -3
  63. package/build/runtime-esm/cache/cache.js +91 -4
  64. package/build/runtime-esm/cache/index.d.ts +2 -2
  65. package/build/runtime-esm/cache/index.js +10 -2
  66. package/build/runtime-esm/cache/list.js +1 -1
  67. package/build/runtime-esm/cache/record.d.ts +2 -0
  68. package/build/runtime-esm/cache/record.js +32 -1
  69. package/build/runtime-esm/mutation.js +1 -1
  70. package/build/runtime-esm/network.d.ts +10 -12
  71. package/build/runtime-esm/network.js +60 -18
  72. package/build/runtime-esm/pagination.d.ts +4 -3
  73. package/build/runtime-esm/pagination.js +128 -43
  74. package/build/runtime-esm/query.d.ts +8 -3
  75. package/build/runtime-esm/query.js +70 -25
  76. package/build/runtime-esm/types.d.ts +22 -4
  77. package/build/runtime-esm/types.js +19 -0
  78. package/build/runtime-esm/utils.d.ts +1 -0
  79. package/build/runtime-esm/utils.js +16 -0
  80. package/cmd/generate.ts +30 -1
  81. package/cmd/generators/artifacts/artifacts.test.ts +42 -14
  82. package/cmd/generators/artifacts/index.ts +26 -38
  83. package/cmd/generators/artifacts/policy.test.ts +148 -0
  84. package/cmd/generators/artifacts/selection.ts +6 -6
  85. package/cmd/generators/runtime/adapter.ts +7 -0
  86. package/cmd/generators/runtime/copyRuntime.test.ts +20 -4
  87. package/cmd/generators/typescript/index.ts +97 -103
  88. package/cmd/generators/typescript/inlineType.ts +2 -2
  89. package/cmd/generators/typescript/typescript.test.ts +90 -48
  90. package/cmd/init.ts +14 -4
  91. package/cmd/main.ts +24 -4
  92. package/cmd/testUtils.ts +28 -0
  93. package/cmd/transforms/fragmentVariables.test.ts +24 -8
  94. package/cmd/transforms/fragmentVariables.ts +2 -0
  95. package/cmd/transforms/list.ts +2 -0
  96. package/cmd/transforms/paginate.test.ts +11 -7
  97. package/cmd/transforms/paginate.ts +4 -2
  98. package/cmd/transforms/schema.ts +12 -1
  99. package/cmd/types.ts +2 -1
  100. package/cmd/utils/flattenSelections.ts +100 -0
  101. package/cmd/utils/index.ts +2 -0
  102. package/cmd/utils/writeSchema.ts +12 -3
  103. package/package.json +3 -3
  104. package/runtime/cache/cache.ts +122 -11
  105. package/runtime/cache/index.ts +10 -2
  106. package/runtime/cache/list.ts +1 -1
  107. package/runtime/cache/record.ts +38 -1
  108. package/runtime/cache/tests/cache.test.ts +2047 -0
  109. package/runtime/cache/tests/gc.test.ts +187 -0
  110. package/runtime/cache/{cache.test.ts → tests/list.test.ts} +1056 -3314
  111. package/runtime/cache/tests/policy.test.ts +232 -0
  112. package/runtime/cache/tests/scalars.test.ts +218 -0
  113. package/runtime/mutation.ts +3 -2
  114. package/runtime/network.ts +98 -43
  115. package/runtime/pagination.ts +186 -55
  116. package/runtime/query.ts +110 -29
  117. package/runtime/scalars.test.ts +13 -9
  118. package/runtime/types.ts +25 -5
  119. package/runtime/{pagination.test.ts → utils.test.ts} +11 -1
  120. package/runtime/utils.ts +18 -0
package/README.md CHANGED
@@ -11,9 +11,6 @@
11
11
  <br />
12
12
  </div>
13
13
 
14
- NOTE: Houdini is in the early phases of development. Please create an issue or start a discussion if you run into problems. For more information on what's coming for this project, you can visit the
15
- [roadmap](https://github.com/AlecAivazis/houdini/projects/1).
16
-
17
14
  If you are interested in helping out, the [contributing guide](./CONTRIBUTING.md) should provide some guidance. If you need something more
18
15
  specific, feel free to reach out to @AlecAivazis on the Svelte discord. There's lots to do regardless of how deep you want to dive 🙂
19
16
 
@@ -45,8 +42,11 @@ for the generation of an incredibly lean GraphQL abstraction for your applicatio
45
42
  1. [Fetching Data](#fetching-data)
46
43
  1. [Query variables and page data](#query-variables-and-page-data)
47
44
  1. [Loading State](#loading-state)
48
- 1. [Refetching Data](#refetching-data)
49
45
  1. [Additional Logic](#additional-logic)
46
+ 1. [Refetching Data](#refetching-data)
47
+ 1. [Cache policy](#cache-policy)
48
+ 1. [Data Retention](#data-retention)
49
+ 1. [Changing default cache policy](#changing-default-cache-policy)
50
50
  1. [What about load?](#what-about-load)
51
51
  1. [Fragments](#fragments)
52
52
  1. [Fragment Arguments](#fragment-arguments)
@@ -90,18 +90,19 @@ npm install --save-dev houdini houdini-preprocess
90
90
 
91
91
  Adding houdini to an existing project can easily be done with the provided command-line tool.
92
92
  If you don't already have an existing app, visit [this link](https://kit.svelte.dev/docs)
93
- for help setting one up. Once you have a project and want to add houdini, execute the following command:
93
+ for help setting one up. Once you have a project and want to add houdini, execute the following command which will create a few necessary files, as well as pull down a json
94
+ representation of your API's schema.
94
95
 
95
96
  ```sh
96
97
  npx houdini init
97
98
  ```
98
99
 
99
- This will create a few necessary files, as well as pull down a json representation of
100
- your API's schema. Next, generate your runtime:
101
-
102
- ```sh
103
- npx houdini generate
104
- ```
100
+ > This will send a request to your API to download your schema definition. If you need
101
+ > headers to authenticate this request, you can pass them in with the `--pull-header`
102
+ > flag (abbreviated `-ph`). For example,
103
+ > `npx houdini init -ph Authorization="Bearer MyToken"`.
104
+ > You will also need to provide the same flag to `generate` when using the
105
+ > `--pull-schema` flag.
105
106
 
106
107
  Finally, follow the steps appropriate for your framework.
107
108
 
@@ -115,7 +116,7 @@ import houdini from 'houdini-preprocess'
115
116
 
116
117
  {
117
118
  preprocess: [houdini()],
118
-
119
+
119
120
  kit: {
120
121
  vite: {
121
122
  resolve: {
@@ -328,9 +329,9 @@ the result of query:
328
329
 
329
330
  ### Additional logic
330
331
 
331
- Sometimes you will need to add additional logic to a component's query. For example, you might want to
332
+ Sometimes you will need to add additional logic to a component's query. For example, you might want to
332
333
  check if the current session is valid before a query is sent to the server. In order to support this,
333
- houdini will look for a function called `onLoad` defined in the module context which can be used to perform
334
+ houdini will look for a function called `onLoad` defined in the module context which can be used to perform
334
335
  any logic you need. If you return a value from this function, it will be passed as props to your component:
335
336
 
336
337
  ```svelte
@@ -340,11 +341,11 @@ any logic you need. If you return a value from this function, it will be passed
340
341
  if(!session.authenticated){
341
342
  return this.redirect(302, '/login')
342
343
  }
343
-
344
+
344
345
  return {
345
346
  message: "There are this many items"
346
347
  }
347
- }
348
+ }
348
349
  </script>
349
350
 
350
351
  <script>
@@ -392,6 +393,64 @@ Refetching data is done with the `refetch` function provided from the result of
392
393
  <input type=checkbox bind:checked={completed}>
393
394
  ```
394
395
 
396
+ ### Cache policy
397
+
398
+ By default, houdini will only try to load queries against its local cache when you indicate it is safe to do so.
399
+ This can be done with the `@cache` directive:
400
+
401
+ ```graphql
402
+ query AllItems @cache(policy: CacheOrNetwork) {
403
+ items {
404
+ id
405
+ text
406
+ }
407
+ }
408
+ ```
409
+
410
+ There are 3 different policies that can be specified:
411
+
412
+ - **CacheOrNetwork** will first check if a query can be resolved from the cache. If it can, it will return the cached value and only send a network request if data was missing.
413
+ - **CacheAndNetwork** will use cached data if it exists and always send a network request after the component has mounted to retrieve the latest data from the server
414
+ - **NetworkOnly** will never check if the data exists in the cache and always send a network request
415
+
416
+ #### Data Retention
417
+
418
+ Houdini will retain a query's data for a configurable number of queries (default 10).
419
+ For a concrete example, consider an example app that has 3 routes. If you load one of the
420
+ routes and then click between the other two 5 times, the first route's data will still be
421
+ resolvable (and the counter will reset if you visit it).
422
+ If you then toggle between the other routes 10 times and then try to load the first
423
+ route, a network request will be sent. This number is configurable with the
424
+ `cacheBufferSize` value in your config file:
425
+
426
+ ```js
427
+ // houdini.config.js
428
+
429
+ export default {
430
+ // ...
431
+ cacheBufferSize: 5,
432
+ }
433
+ ```
434
+
435
+ #### Changing default cache policy
436
+
437
+ As previously mentioned, the default cache policy is `CacheOrNetwork`. This can be changed
438
+ by setting the `defaultCachePolicy` config value:
439
+
440
+ ```js
441
+ // houdini.config.js
442
+
443
+ import { CachePolicy } from '$houdini'
444
+
445
+ export default {
446
+ // ...
447
+
448
+ // note: if you are upgrading from a previous version of houdini, you might
449
+ // have to generate your runtime for this type to be defined.
450
+ defaultCachePolicy: CachePolicy.NetworkOnly,
451
+ }
452
+ ```
453
+
395
454
  ### What about `load`?
396
455
 
397
456
  Don't worry - that's where the preprocessor comes in. One of its responsibilities is moving the actual
@@ -975,7 +1034,7 @@ export default new Environment(async function ({ text, variables = {} }, session
975
1034
 
976
1035
  ## 🚦&nbsp;&nbsp;Persisted Queries
977
1036
 
978
- Sometimes you want to confine an API to only fire a set of pre-defined queries. This
1037
+ Sometimes you want to confine an API to only fire a set of pre-defined queries. This
979
1038
  can be useful to not only reduce the amount of information transferred over the write
980
1039
  but also act as a list of approved queries, providing additional security. Regardless of
981
1040
  your motivation, the approach involves associating a known string with a particular query
@@ -984,10 +1043,10 @@ houdini passes a queries hash to the fetch function for you to use.
984
1043
 
985
1044
  ### Automatic Persisted Queries
986
1045
 
987
- An approach to Persisted Queries, popularized by Apollo, is known as
988
- [Automatic Persisted Queries](https://www.apollographql.com/docs/apollo-server/performance/apq/).
1046
+ An approach to Persisted Queries, popularized by Apollo, is known as
1047
+ [Automatic Persisted Queries](https://www.apollographql.com/docs/apollo-server/performance/apq/).
989
1048
  This involves first sending a queries hash and if its unrecognized, sending the full
990
- query string. This might look something like:
1049
+ query string. This might look something like:
991
1050
 
992
1051
  ```typescript
993
1052
  /// src/environment.ts
@@ -1023,7 +1082,7 @@ export default new Environment(async function({ text, variables = {}, hash }){
1023
1082
  return response
1024
1083
  }
1025
1084
 
1026
- // there were errors, send the hash and the query to associate the two for
1085
+ // there were errors, send the hash and the query to associate the two for
1027
1086
  // future requests
1028
1087
  return await sendFetch.call(this, { variables, hash, text })
1029
1088
  })
@@ -1044,7 +1103,7 @@ npx houdini generate -po ./path/to/persisted-queries.json
1044
1103
 
1045
1104
  Once this map has been created, you will have to make it available to your server.
1046
1105
 
1047
- Now, instead of sending the full operation text with every request, you can now simply
1106
+ Now, instead of sending the full operation text with every request, you can now simply
1048
1107
  pass the hash under whatever field name you prefer:
1049
1108
 
1050
1109
  ```typescript
@@ -66,6 +66,8 @@ var promises_1 = __importDefault(require("fs/promises"));
66
66
  var graphql = __importStar(require("graphql"));
67
67
  var util_1 = require("util");
68
68
  var houdini_common_1 = require("houdini-common");
69
+ // locals
70
+ var types_1 = require("./types");
69
71
  var transforms = __importStar(require("./transforms"));
70
72
  var generators = __importStar(require("./generators"));
71
73
  var validators = __importStar(require("./validators"));
@@ -199,9 +201,30 @@ function collectDocuments(config) {
199
201
  throw new Error('Fragment documents can only have one fragment');
200
202
  }
201
203
  }
204
+ // figure out the document kind
205
+ var kind = types_1.ArtifactKind.Fragment;
206
+ if (operations.length === 1) {
207
+ // the document kind depends on the artifact
208
+ // query
209
+ if (operations[0].kind === 'OperationDefinition' &&
210
+ operations[0].operation === 'query') {
211
+ kind = types_1.ArtifactKind.Query;
212
+ }
213
+ // mutation
214
+ else if (operations[0].kind === 'OperationDefinition' &&
215
+ operations[0].operation === 'mutation') {
216
+ kind = types_1.ArtifactKind.Mutation;
217
+ }
218
+ // subscription
219
+ else if (operations[0].kind === 'OperationDefinition' &&
220
+ operations[0].operation === 'subscription') {
221
+ kind = types_1.ArtifactKind.Subcription;
222
+ }
223
+ }
202
224
  // add it to the list
203
225
  documents.push({
204
226
  name: config.documentName(parsedDoc),
227
+ kind: kind,
205
228
  document: parsedDoc,
206
229
  filename: filePath,
207
230
  originalDocument: parsedDoc,
@@ -103,7 +103,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
103
103
  // externals
104
104
  var houdini_common_1 = require("houdini-common");
105
105
  var graphql = __importStar(require("graphql"));
106
- var types_1 = require("../../types");
107
106
  var recast = __importStar(require("recast"));
108
107
  // locals
109
108
  var utils_1 = require("../../utils");
@@ -112,6 +111,7 @@ var operations_1 = require("./operations");
112
111
  var indexFile_1 = __importDefault(require("./indexFile"));
113
112
  var inputs_1 = require("./inputs");
114
113
  var utils_2 = require("./utils");
114
+ var types_1 = require("../../../runtime/types");
115
115
  var AST = recast.types.builders;
116
116
  // the artifact generator creates files in the runtime directory for each
117
117
  // document containing meta data that the preprocessor might use
@@ -185,10 +185,10 @@ function artifactGenerator(config, docs) {
185
185
  ].concat(
186
186
  // and an artifact for every document
187
187
  docs.map(function (doc) { return __awaiter(_this, void 0, void 0, function () {
188
- var document, name, generate, rawString, docKind, operations, fragments, operation, rootType, selectionSet, operation, matchingFragment, inputs, artifact, file;
189
- var _a, _b, _c, _d;
190
- return __generator(this, function (_e) {
191
- switch (_e.label) {
188
+ var document, name, generate, rawString, docKind, operations, fragments, rootType, selectionSet, operation, matchingFragment, inputs, artifact, cacheDirective, policy, file;
189
+ var _a, _b, _c, _d, _e, _f;
190
+ return __generator(this, function (_g) {
191
+ switch (_g.label) {
192
192
  case 0:
193
193
  document = doc.document, name = doc.name, generate = doc.generate;
194
194
  // if the document is generated, don't write it to disk - it's use is to provide definitions
@@ -204,7 +204,7 @@ function artifactGenerator(config, docs) {
204
204
  }
205
205
  },
206
206
  }));
207
- docKind = null;
207
+ docKind = doc.kind;
208
208
  operations = document.definitions.filter(function (_a) {
209
209
  var kind = _a.kind;
210
210
  return kind === graphql.Kind.OPERATION_DEFINITION;
@@ -213,33 +213,9 @@ function artifactGenerator(config, docs) {
213
213
  var kind = _a.kind;
214
214
  return kind === graphql.Kind.FRAGMENT_DEFINITION;
215
215
  });
216
- // if there are operations in the document
217
- if (operations.length > 0 && operations[0].kind === 'OperationDefinition') {
218
- operation = operations[0].operation;
219
- // figure out if its a query
220
- if (operation === 'query') {
221
- docKind = types_1.CompiledQueryKind;
222
- }
223
- // or a mutation
224
- else if (operation === 'mutation') {
225
- docKind = types_1.CompiledMutationKind;
226
- }
227
- // or a subscription
228
- else if (operation === 'subscription') {
229
- docKind = types_1.CompiledSubscriptionKind;
230
- }
231
- }
232
- // if there are operations in the document
233
- else if (fragments.length > 0) {
234
- docKind = types_1.CompiledFragmentKind;
235
- }
236
- // if we couldn't figure out the kind
237
- if (!docKind) {
238
- throw new Error('Could not figure out what kind of document we were given');
239
- }
240
216
  rootType = '';
241
217
  // if we are generating the artifact for an operation
242
- if (docKind !== 'HoudiniFragment') {
218
+ if (docKind !== types_1.ArtifactKind.Fragment) {
243
219
  operation = operations[0];
244
220
  if (operation.operation === 'query') {
245
221
  rootType = (_a = config.schema.getQueryType()) === null || _a === void 0 ? void 0 : _a.name;
@@ -278,7 +254,7 @@ function artifactGenerator(config, docs) {
278
254
  selection: selection_1.default({
279
255
  config: config,
280
256
  rootType: rootType,
281
- selectionSet: selectionSet,
257
+ selections: selectionSet.selections,
282
258
  operations: operations_1.operationsByPath(config, operations[0], filterTypes),
283
259
  // do not include used fragments if we are rendering the selection
284
260
  // for a fragment document
@@ -291,6 +267,22 @@ function artifactGenerator(config, docs) {
291
267
  if (inputs && inputs.length > 0) {
292
268
  artifact.input = inputs_1.inputObject(config, inputs);
293
269
  }
270
+ // add the cache policy to query documents
271
+ if (docKind === 'HoudiniQuery') {
272
+ cacheDirective = (_e = operations[0].directives) === null || _e === void 0 ? void 0 : _e.find(function (directive) { return directive.name.value === config.cacheDirective; });
273
+ if (cacheDirective) {
274
+ policy = (_f = cacheDirective.arguments) === null || _f === void 0 ? void 0 : _f.find(function (arg) { return arg.name.value === config.cachePolicyArg; });
275
+ if (policy && policy.value.kind === 'EnumValue') {
276
+ artifact.policy = policy.value.value;
277
+ }
278
+ else {
279
+ artifact.policy = config.defaultCachePolicy;
280
+ }
281
+ }
282
+ else {
283
+ artifact.policy = config.defaultCachePolicy;
284
+ }
285
+ }
294
286
  file = AST.program([
295
287
  utils_1.moduleExport(config, 'default', utils_2.serializeValue(artifact)),
296
288
  ]);
@@ -300,7 +292,7 @@ function artifactGenerator(config, docs) {
300
292
  ];
301
293
  case 1:
302
294
  // write the result to the artifact path we're configured to write to
303
- _e.sent();
295
+ _g.sent();
304
296
  // log the file location to confirm
305
297
  if (!config.quiet) {
306
298
  console.log(name);
@@ -2,10 +2,10 @@ import { Config } from 'houdini-common';
2
2
  import * as graphql from 'graphql';
3
3
  import { CollectedGraphQLDocument } from '../../types';
4
4
  import type { MutationOperation, SubscriptionSelection } from '../../../runtime';
5
- export default function selection({ config, rootType, selectionSet, operations, path, includeFragments, document, markEdges, }: {
5
+ export default function selection({ config, rootType, selections, operations, path, includeFragments, document, markEdges, }: {
6
6
  config: Config;
7
7
  rootType: string;
8
- selectionSet: graphql.SelectionSetNode;
8
+ selections: readonly graphql.SelectionNode[];
9
9
  operations: {
10
10
  [path: string]: MutationOperation[];
11
11
  };
@@ -56,7 +56,7 @@ var AST = recast.types.builders;
56
56
  function selection(_a) {
57
57
  var e_1, _b;
58
58
  var _c, _d, _e, _f, _g, _h, _j;
59
- var config = _a.config, rootType = _a.rootType, selectionSet = _a.selectionSet, operations = _a.operations, _k = _a.path, path = _k === void 0 ? [] : _k, includeFragments = _a.includeFragments, document = _a.document, markEdges = _a.markEdges;
59
+ var config = _a.config, rootType = _a.rootType, selections = _a.selections, operations = _a.operations, _k = _a.path, path = _k === void 0 ? [] : _k, includeFragments = _a.includeFragments, document = _a.document, markEdges = _a.markEdges;
60
60
  // we need to build up an object that contains every field in the selection
61
61
  var object = {};
62
62
  var _loop_1 = function (field) {
@@ -72,7 +72,7 @@ function selection(_a) {
72
72
  config: config,
73
73
  rootType: fragmentDefinition.typeCondition.name.value,
74
74
  operations: operations,
75
- selectionSet: fragmentDefinition.selectionSet,
75
+ selections: fragmentDefinition.selectionSet.selections,
76
76
  path: path,
77
77
  includeFragments: includeFragments,
78
78
  document: document,
@@ -84,7 +84,7 @@ function selection(_a) {
84
84
  config: config,
85
85
  rootType: ((_c = field.typeCondition) === null || _c === void 0 ? void 0 : _c.name.value) || rootType,
86
86
  operations: operations,
87
- selectionSet: field.selectionSet,
87
+ selections: field.selectionSet.selections,
88
88
  path: path,
89
89
  includeFragments: includeFragments,
90
90
  document: document,
@@ -156,7 +156,7 @@ function selection(_a) {
156
156
  fieldObj.fields = selection({
157
157
  config: config,
158
158
  rootType: typeName,
159
- selectionSet: field.selectionSet,
159
+ selections: field.selectionSet.selections,
160
160
  operations: operations,
161
161
  path: pathSoFar,
162
162
  includeFragments: includeFragments,
@@ -180,15 +180,15 @@ function selection(_a) {
180
180
  }
181
181
  };
182
182
  try {
183
- for (var _l = __values(selectionSet.selections), _m = _l.next(); !_m.done; _m = _l.next()) {
184
- var field = _m.value;
183
+ for (var selections_1 = __values(selections), selections_1_1 = selections_1.next(); !selections_1_1.done; selections_1_1 = selections_1.next()) {
184
+ var field = selections_1_1.value;
185
185
  _loop_1(field);
186
186
  }
187
187
  }
188
188
  catch (e_1_1) { e_1 = { error: e_1_1 }; }
189
189
  finally {
190
190
  try {
191
- if (_m && !_m.done && (_b = _l.return)) _b.call(_l);
191
+ if (selections_1_1 && !selections_1_1.done && (_b = selections_1.return)) _b.call(selections_1);
192
192
  }
193
193
  finally { if (e_1) throw e_1.error; }
194
194
  }
@@ -65,6 +65,6 @@ function generateAdapter(config) {
65
65
  });
66
66
  }
67
67
  exports.default = generateAdapter;
68
- var sapperAdapter = "import { stores, goto as go } from '@sapper/app'\n\nexport function getSession() {\n return stores().session\n}\n\nexport function goTo(location, options) {\n go(location, options)\n}\n";
69
- var sveltekitAdapter = "import { goto as go } from '$app/navigation'\nimport { getStores } from '$app/stores'\n\nexport function getSession() {\n return getStores().session\n}\n\nexport function goTo(location, options) {\n go(location, options)\n}\n";
70
- var svelteAdapter = "\nexport function getSession() {\n\treturn {}\n}\n\nexport function goTo(location, options) {\n\twindow.location = location\n}\n";
68
+ var sapperAdapter = "import { stores, goto as go } from '@sapper/app'\n\nexport function getSession() {\n return stores().session\n}\n\nexport function goTo(location, options) {\n go(location, options)\n}\n\nexport const isBrowser = process.browser\n";
69
+ var sveltekitAdapter = "import { goto as go } from '$app/navigation'\nimport { getStores } from '$app/stores'\nimport { browser } from '$app/env'\n\nexport function getSession() {\n return getStores().session\n}\n\nexport function goTo(location, options) {\n go(location, options)\n}\n\nexport const isBrowser = browser\n";
70
+ var svelteAdapter = "\nexport function getSession() {\n\treturn {}\n}\n\nexport function goTo(location, options) {\n\twindow.location = location\n}\n\nexport const isBrowser = true\n";