houdini 1.0.11 → 1.1.1-next.0

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 (67) hide show
  1. package/build/cmd-cjs/index.js +659 -330
  2. package/build/cmd-esm/index.js +659 -330
  3. package/build/codegen/generators/artifacts/selection.d.ts +5 -2
  4. package/build/codegen/generators/typescript/inlineType.d.ts +1 -1
  5. package/build/codegen/transforms/{composeQueries.d.ts → collectDefinitions.d.ts} +1 -1
  6. package/build/codegen/transforms/fragmentVariables.d.ts +2 -4
  7. package/build/codegen/transforms/index.d.ts +1 -1
  8. package/build/codegen/utils/flattenSelections.d.ts +2 -2
  9. package/build/codegen-cjs/index.js +604 -326
  10. package/build/codegen-esm/index.js +604 -326
  11. package/build/lib/config.d.ts +10 -1
  12. package/build/lib/deepMerge.d.ts +1 -1
  13. package/build/lib/types.d.ts +1 -0
  14. package/build/lib-cjs/index.js +261 -115
  15. package/build/lib-esm/index.js +260 -115
  16. package/build/runtime/cache/cache.d.ts +17 -6
  17. package/build/runtime/client/documentStore.d.ts +1 -0
  18. package/build/runtime/client/plugins/cache.d.ts +3 -2
  19. package/build/runtime/client/plugins/fragment.d.ts +2 -0
  20. package/build/runtime/client/plugins/index.d.ts +1 -0
  21. package/build/runtime/lib/scalars.d.ts +0 -1
  22. package/build/runtime/lib/types.d.ts +55 -7
  23. package/build/runtime-cjs/cache/cache.d.ts +17 -6
  24. package/build/runtime-cjs/cache/cache.js +89 -21
  25. package/build/runtime-cjs/cache/lists.js +2 -1
  26. package/build/runtime-cjs/cache/subscription.js +11 -2
  27. package/build/runtime-cjs/client/documentStore.d.ts +1 -0
  28. package/build/runtime-cjs/client/documentStore.js +5 -14
  29. package/build/runtime-cjs/client/index.js +2 -1
  30. package/build/runtime-cjs/client/plugins/cache.d.ts +3 -2
  31. package/build/runtime-cjs/client/plugins/cache.js +19 -3
  32. package/build/runtime-cjs/client/plugins/fetch.js +4 -1
  33. package/build/runtime-cjs/client/plugins/fragment.d.ts +2 -0
  34. package/build/runtime-cjs/client/plugins/fragment.js +76 -0
  35. package/build/runtime-cjs/client/plugins/index.d.ts +1 -0
  36. package/build/runtime-cjs/client/plugins/index.js +1 -0
  37. package/build/runtime-cjs/client/plugins/query.js +3 -5
  38. package/build/runtime-cjs/lib/scalars.d.ts +0 -1
  39. package/build/runtime-cjs/lib/scalars.js +2 -43
  40. package/build/runtime-cjs/lib/types.d.ts +55 -7
  41. package/build/runtime-cjs/lib/types.js +5 -2
  42. package/build/runtime-cjs/public/tests/test.js +4 -2
  43. package/build/runtime-esm/cache/cache.d.ts +17 -6
  44. package/build/runtime-esm/cache/cache.js +89 -22
  45. package/build/runtime-esm/cache/lists.js +2 -1
  46. package/build/runtime-esm/cache/subscription.js +11 -2
  47. package/build/runtime-esm/client/documentStore.d.ts +1 -0
  48. package/build/runtime-esm/client/documentStore.js +6 -15
  49. package/build/runtime-esm/client/index.js +3 -1
  50. package/build/runtime-esm/client/plugins/cache.d.ts +3 -2
  51. package/build/runtime-esm/client/plugins/cache.js +19 -3
  52. package/build/runtime-esm/client/plugins/fetch.js +5 -2
  53. package/build/runtime-esm/client/plugins/fragment.d.ts +2 -0
  54. package/build/runtime-esm/client/plugins/fragment.js +46 -0
  55. package/build/runtime-esm/client/plugins/index.d.ts +1 -0
  56. package/build/runtime-esm/client/plugins/index.js +1 -0
  57. package/build/runtime-esm/client/plugins/query.js +3 -5
  58. package/build/runtime-esm/lib/scalars.d.ts +0 -1
  59. package/build/runtime-esm/lib/scalars.js +1 -41
  60. package/build/runtime-esm/lib/types.d.ts +55 -7
  61. package/build/runtime-esm/lib/types.js +3 -1
  62. package/build/runtime-esm/public/tests/test.js +4 -2
  63. package/build/test-cjs/index.js +658 -329
  64. package/build/test-esm/index.js +658 -329
  65. package/build/vite-cjs/index.js +657 -328
  66. package/build/vite-esm/index.js +657 -328
  67. package/package.json +2 -2
@@ -1,5 +1,5 @@
1
1
  import type { ConfigFile } from '../lib/config';
2
- import type { GraphQLObject, GraphQLValue, NestedList, SubscriptionSelection, SubscriptionSpec } from '../lib/types';
2
+ import type { GraphQLObject, GraphQLValue, NestedList, SubscriptionSelection, SubscriptionSpec, ValueMap } from '../lib/types';
3
3
  import { GarbageCollector } from './gc';
4
4
  import type { ListCollection } from './lists';
5
5
  import { ListManager } from './lists';
@@ -10,7 +10,9 @@ import { InMemoryStorage } from './storage';
10
10
  import { InMemorySubscriptions, type FieldSelection } from './subscription';
11
11
  export declare class Cache {
12
12
  _internal_unstable: CacheInternal;
13
- constructor(config?: ConfigFile);
13
+ constructor({ disabled, ...config }?: ConfigFile & {
14
+ disabled?: boolean;
15
+ });
14
16
  write({ layer: layerID, notifySubscribers, ...args }: {
15
17
  data: {
16
18
  [key: string]: GraphQLValue;
@@ -44,10 +46,11 @@ export declare class Cache {
44
46
  when?: {};
45
47
  }): void;
46
48
  getFieldTime(id: string, field: string): number | null | undefined;
49
+ config(): ConfigFile;
47
50
  }
48
51
  declare class CacheInternal {
49
52
  private _disabled;
50
- config: ConfigFile;
53
+ _config?: ConfigFile;
51
54
  storage: InMemoryStorage;
52
55
  subscriptions: InMemorySubscriptions;
53
56
  lists: ListManager;
@@ -55,7 +58,7 @@ declare class CacheInternal {
55
58
  lifetimes: GarbageCollector;
56
59
  staleManager: StaleManager;
57
60
  schema: SchemaManager;
58
- constructor({ storage, subscriptions, lists, cache, lifetimes, staleManager, schema, }: {
61
+ constructor({ storage, subscriptions, lists, cache, lifetimes, staleManager, schema, disabled, config, }: {
59
62
  storage: InMemoryStorage;
60
63
  subscriptions: InMemorySubscriptions;
61
64
  lists: ListManager;
@@ -63,7 +66,10 @@ declare class CacheInternal {
63
66
  lifetimes: GarbageCollector;
64
67
  staleManager: StaleManager;
65
68
  schema: SchemaManager;
69
+ disabled: boolean;
70
+ config?: ConfigFile;
66
71
  });
72
+ get config(): ConfigFile;
67
73
  setConfig(config: ConfigFile): void;
68
74
  writeSelection({ data, selection, variables, parent, applyUpdates, layer, toNotify, forceNotify, forceStale, }: {
69
75
  data: {
@@ -81,11 +87,12 @@ declare class CacheInternal {
81
87
  forceNotify?: boolean;
82
88
  forceStale?: boolean;
83
89
  }): FieldSelection[];
84
- getSelection({ selection, parent, variables, stepsFromConnection, }: {
90
+ getSelection({ selection, parent, variables, stepsFromConnection, ignoreMasking, }: {
85
91
  selection: SubscriptionSelection;
86
92
  parent?: string;
87
93
  variables?: {};
88
94
  stepsFromConnection?: number | null;
95
+ ignoreMasking?: boolean;
89
96
  }): {
90
97
  data: GraphQLObject | null;
91
98
  partial: boolean;
@@ -96,11 +103,12 @@ declare class CacheInternal {
96
103
  id(type: string, id: string): string | null;
97
104
  idFields(type: string): string[];
98
105
  computeID(type: string, data: any): string;
99
- hydrateNestedList({ fields, variables, linkedList, stepsFromConnection, }: {
106
+ hydrateNestedList({ fields, variables, linkedList, stepsFromConnection, ignoreMasking, }: {
100
107
  fields: SubscriptionSelection;
101
108
  variables?: {};
102
109
  linkedList: NestedList;
103
110
  stepsFromConnection: number | null;
111
+ ignoreMasking: boolean;
104
112
  }): {
105
113
  data: NestedList<GraphQLValue>;
106
114
  partial: boolean;
@@ -125,5 +133,8 @@ declare class CacheInternal {
125
133
  };
126
134
  collectGarbage(): void;
127
135
  }
136
+ export declare function evaluateFragmentVariables(variables: ValueMap, args: GraphQLObject): {
137
+ [k: string]: GraphQLValue;
138
+ };
128
139
  export declare const rootID = "_ROOT_";
129
140
  export {};
@@ -46,6 +46,7 @@ export type ClientPluginContext = {
46
46
  forceNotify?: boolean;
47
47
  disableWrite?: boolean;
48
48
  disableRead?: boolean;
49
+ disableSubscriptions?: boolean;
49
50
  applyUpdates?: string[];
50
51
  };
51
52
  stuff: App.Stuff;
@@ -1,8 +1,9 @@
1
1
  import cache from '../../cache';
2
- import type { Cache } from '../../cache/cache';
2
+ import { Cache } from '../../cache/cache';
3
3
  import type { ClientPlugin } from '../documentStore';
4
- export declare const cachePolicy: ({ enabled, setFetching, cache: localCache, }: {
4
+ export declare const cachePolicy: ({ enabled, setFetching, cache: localCache, serverSideFallback, }: {
5
5
  enabled: boolean;
6
6
  setFetching: (val: boolean) => void;
7
7
  cache?: Cache | undefined;
8
+ serverSideFallback?: boolean | undefined;
8
9
  }) => ClientPlugin;
@@ -0,0 +1,2 @@
1
+ import type { ClientPlugin } from '../documentStore';
2
+ export declare const fragment: ClientPlugin;
@@ -1,6 +1,7 @@
1
1
  export * from './fetch';
2
2
  export * from './cache';
3
3
  export * from './query';
4
+ export * from './fragment';
4
5
  export * from './mutation';
5
6
  export * from './subscription';
6
7
  export * from './throwOnError';
@@ -10,6 +10,5 @@ export declare function marshalInputs<T>({ artifact, input, config, rootType, }:
10
10
  rootType?: string;
11
11
  config: ConfigFile;
12
12
  }): {} | null | undefined;
13
- export declare function unmarshalSelection(config: ConfigFile, selection: SubscriptionSelection, data: any): {} | null | undefined;
14
13
  export declare function isScalar(config: ConfigFile, type: string): boolean;
15
14
  export declare function parseScalar(config: ConfigFile, type: string, value?: string): string | number | boolean | undefined;
@@ -24,6 +24,7 @@ declare global {
24
24
  changed: boolean;
25
25
  };
26
26
  optimisticResponse?: GraphQLObject;
27
+ parentID?: string;
27
28
  }
28
29
  }
29
30
  }
@@ -84,7 +85,7 @@ export type BaseCompiledDocument<_Kind extends ArtifactKinds> = {
84
85
  direction: 'forward' | 'backward' | 'both';
85
86
  mode: PaginateModes;
86
87
  };
87
- pluginData?: Record<string, any>;
88
+ pluginData: Record<string, any>;
88
89
  };
89
90
  export type HoudiniFetchContext = {
90
91
  variables: () => {};
@@ -128,6 +129,7 @@ export type GraphQLObject = {
128
129
  };
129
130
  export type GraphQLValue = number | string | boolean | null | GraphQLObject | GraphQLValue[] | undefined;
130
131
  export type SubscriptionSelection = {
132
+ fragments?: Record<string, ValueMap>;
131
133
  fields?: {
132
134
  [fieldName: string]: {
133
135
  type: string;
@@ -140,12 +142,11 @@ export type SubscriptionSelection = {
140
142
  type: string;
141
143
  };
142
144
  updates?: string[];
143
- filters?: {
144
- [key: string]: {
145
- kind: 'Boolean' | 'String' | 'Float' | 'Int' | 'Variable';
146
- value: string | number | boolean;
147
- };
148
- };
145
+ visible?: boolean;
146
+ filters?: Record<string, {
147
+ kind: 'Boolean' | 'String' | 'Float' | 'Int' | 'Variable';
148
+ value: string | number | boolean;
149
+ }>;
149
150
  selection?: SubscriptionSelection;
150
151
  abstract?: boolean;
151
152
  };
@@ -189,4 +190,51 @@ export type RequestPayload<GraphQLObject = any> = {
189
190
  };
190
191
  export type NestedList<_Result = string> = (_Result | null | NestedList<_Result>)[];
191
192
  export type ValueOf<Parent> = Parent[keyof Parent];
193
+ export declare const fragmentKey = " $fragments";
194
+ export type ValueNode = VariableNode | IntValueNode | FloatValueNode | StringValueNode | BooleanValueNode | NullValueNode | EnumValueNode | ListValueNode | ObjectValueNode;
195
+ export type ValueMap = Record<string, ValueNode>;
196
+ interface IntValueNode {
197
+ readonly kind: 'IntValue';
198
+ readonly value: string;
199
+ }
200
+ interface FloatValueNode {
201
+ readonly kind: 'FloatValue';
202
+ readonly value: string;
203
+ }
204
+ interface StringValueNode {
205
+ readonly kind: 'StringValue';
206
+ readonly value: string;
207
+ }
208
+ interface BooleanValueNode {
209
+ readonly kind: 'BooleanValue';
210
+ readonly value: boolean;
211
+ }
212
+ interface NullValueNode {
213
+ readonly kind: 'NullValue';
214
+ }
215
+ interface EnumValueNode {
216
+ readonly kind: 'EnumValue';
217
+ readonly value: string;
218
+ }
219
+ interface ListValueNode {
220
+ readonly kind: 'ListValue';
221
+ readonly values: ReadonlyArray<ValueNode>;
222
+ }
223
+ interface ObjectValueNode {
224
+ readonly kind: 'ObjectValue';
225
+ readonly fields: ReadonlyArray<ObjectFieldNode>;
226
+ }
227
+ interface ObjectFieldNode {
228
+ readonly kind: 'ObjectField';
229
+ readonly name: NameNode;
230
+ readonly value: ValueNode;
231
+ }
232
+ interface NameNode {
233
+ readonly kind: 'Name';
234
+ readonly value: string;
235
+ }
236
+ interface VariableNode {
237
+ readonly kind: 'Variable';
238
+ readonly name: NameNode;
239
+ }
192
240
  export {};
@@ -1,5 +1,5 @@
1
1
  import type { ConfigFile } from '../lib/config';
2
- import type { GraphQLObject, GraphQLValue, NestedList, SubscriptionSelection, SubscriptionSpec } from '../lib/types';
2
+ import type { GraphQLObject, GraphQLValue, NestedList, SubscriptionSelection, SubscriptionSpec, ValueMap } from '../lib/types';
3
3
  import { GarbageCollector } from './gc';
4
4
  import type { ListCollection } from './lists';
5
5
  import { ListManager } from './lists';
@@ -10,7 +10,9 @@ import { InMemoryStorage } from './storage';
10
10
  import { InMemorySubscriptions, type FieldSelection } from './subscription';
11
11
  export declare class Cache {
12
12
  _internal_unstable: CacheInternal;
13
- constructor(config?: ConfigFile);
13
+ constructor({ disabled, ...config }?: ConfigFile & {
14
+ disabled?: boolean;
15
+ });
14
16
  write({ layer: layerID, notifySubscribers, ...args }: {
15
17
  data: {
16
18
  [key: string]: GraphQLValue;
@@ -44,10 +46,11 @@ export declare class Cache {
44
46
  when?: {};
45
47
  }): void;
46
48
  getFieldTime(id: string, field: string): number | null | undefined;
49
+ config(): ConfigFile;
47
50
  }
48
51
  declare class CacheInternal {
49
52
  private _disabled;
50
- config: ConfigFile;
53
+ _config?: ConfigFile;
51
54
  storage: InMemoryStorage;
52
55
  subscriptions: InMemorySubscriptions;
53
56
  lists: ListManager;
@@ -55,7 +58,7 @@ declare class CacheInternal {
55
58
  lifetimes: GarbageCollector;
56
59
  staleManager: StaleManager;
57
60
  schema: SchemaManager;
58
- constructor({ storage, subscriptions, lists, cache, lifetimes, staleManager, schema, }: {
61
+ constructor({ storage, subscriptions, lists, cache, lifetimes, staleManager, schema, disabled, config, }: {
59
62
  storage: InMemoryStorage;
60
63
  subscriptions: InMemorySubscriptions;
61
64
  lists: ListManager;
@@ -63,7 +66,10 @@ declare class CacheInternal {
63
66
  lifetimes: GarbageCollector;
64
67
  staleManager: StaleManager;
65
68
  schema: SchemaManager;
69
+ disabled: boolean;
70
+ config?: ConfigFile;
66
71
  });
72
+ get config(): ConfigFile;
67
73
  setConfig(config: ConfigFile): void;
68
74
  writeSelection({ data, selection, variables, parent, applyUpdates, layer, toNotify, forceNotify, forceStale, }: {
69
75
  data: {
@@ -81,11 +87,12 @@ declare class CacheInternal {
81
87
  forceNotify?: boolean;
82
88
  forceStale?: boolean;
83
89
  }): FieldSelection[];
84
- getSelection({ selection, parent, variables, stepsFromConnection, }: {
90
+ getSelection({ selection, parent, variables, stepsFromConnection, ignoreMasking, }: {
85
91
  selection: SubscriptionSelection;
86
92
  parent?: string;
87
93
  variables?: {};
88
94
  stepsFromConnection?: number | null;
95
+ ignoreMasking?: boolean;
89
96
  }): {
90
97
  data: GraphQLObject | null;
91
98
  partial: boolean;
@@ -96,11 +103,12 @@ declare class CacheInternal {
96
103
  id(type: string, id: string): string | null;
97
104
  idFields(type: string): string[];
98
105
  computeID(type: string, data: any): string;
99
- hydrateNestedList({ fields, variables, linkedList, stepsFromConnection, }: {
106
+ hydrateNestedList({ fields, variables, linkedList, stepsFromConnection, ignoreMasking, }: {
100
107
  fields: SubscriptionSelection;
101
108
  variables?: {};
102
109
  linkedList: NestedList;
103
110
  stepsFromConnection: number | null;
111
+ ignoreMasking: boolean;
104
112
  }): {
105
113
  data: NestedList<GraphQLValue>;
106
114
  partial: boolean;
@@ -125,5 +133,8 @@ declare class CacheInternal {
125
133
  };
126
134
  collectGarbage(): void;
127
135
  }
136
+ export declare function evaluateFragmentVariables(variables: ValueMap, args: GraphQLObject): {
137
+ [k: string]: GraphQLValue;
138
+ };
128
139
  export declare const rootID = "_ROOT_";
129
140
  export {};
@@ -19,6 +19,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
19
19
  var cache_exports = {};
20
20
  __export(cache_exports, {
21
21
  Cache: () => Cache,
22
+ evaluateFragmentVariables: () => evaluateFragmentVariables,
22
23
  rootID: () => rootID
23
24
  });
24
25
  module.exports = __toCommonJS(cache_exports);
@@ -27,6 +28,7 @@ var import_config = require("../lib/config");
27
28
  var import_deepEquals = require("../lib/deepEquals");
28
29
  var import_flatten = require("../lib/flatten");
29
30
  var import_selection = require("../lib/selection");
31
+ var import_types = require("../lib/types");
30
32
  var import_gc = require("./gc");
31
33
  var import_lists = require("./lists");
32
34
  var import_schema = require("./schema");
@@ -36,7 +38,7 @@ var import_stuff = require("./stuff");
36
38
  var import_subscription = require("./subscription");
37
39
  class Cache {
38
40
  _internal_unstable;
39
- constructor(config) {
41
+ constructor({ disabled, ...config } = {}) {
40
42
  this._internal_unstable = new CacheInternal({
41
43
  cache: this,
42
44
  storage: new import_storage.InMemoryStorage(),
@@ -44,9 +46,10 @@ class Cache {
44
46
  lists: new import_lists.ListManager(this, rootID),
45
47
  lifetimes: new import_gc.GarbageCollector(this),
46
48
  staleManager: new import_staleManager.StaleManager(this),
47
- schema: new import_schema.SchemaManager(this)
49
+ schema: new import_schema.SchemaManager(this),
50
+ disabled: disabled ?? typeof globalThis.window === "undefined"
48
51
  });
49
- if (config) {
52
+ if (Object.keys(config).length > 0) {
50
53
  this.setConfig((0, import_config.defaultConfigValues)(config));
51
54
  }
52
55
  }
@@ -65,7 +68,8 @@ class Cache {
65
68
  this._internal_unstable.getSelection({
66
69
  parent: spec.parentID || rootID,
67
70
  selection: spec.selection,
68
- variables: spec.variables?.() || {}
71
+ variables: spec.variables?.() || {},
72
+ ignoreMasking: false
69
73
  }).data
70
74
  );
71
75
  }
@@ -140,16 +144,13 @@ class Cache {
140
144
  getFieldTime(id, field) {
141
145
  return this._internal_unstable.staleManager.getFieldTime(id, field);
142
146
  }
147
+ config() {
148
+ return this._internal_unstable.config;
149
+ }
143
150
  }
144
151
  class CacheInternal {
145
152
  _disabled = false;
146
- config = (0, import_config.defaultConfigValues)({
147
- plugins: {
148
- "houdini-svelte": {
149
- client: ""
150
- }
151
- }
152
- });
153
+ _config;
153
154
  storage;
154
155
  subscriptions;
155
156
  lists;
@@ -164,7 +165,9 @@ class CacheInternal {
164
165
  cache,
165
166
  lifetimes,
166
167
  staleManager,
167
- schema
168
+ schema,
169
+ disabled,
170
+ config
168
171
  }) {
169
172
  this.storage = storage;
170
173
  this.subscriptions = subscriptions;
@@ -173,7 +176,8 @@ class CacheInternal {
173
176
  this.lifetimes = lifetimes;
174
177
  this.staleManager = staleManager;
175
178
  this.schema = schema;
176
- this._disabled = typeof globalThis.window === "undefined";
179
+ this._config = config;
180
+ this._disabled = disabled;
177
181
  try {
178
182
  if (process.env.HOUDINI_TEST === "true") {
179
183
  this._disabled = false;
@@ -181,8 +185,11 @@ class CacheInternal {
181
185
  } catch {
182
186
  }
183
187
  }
188
+ get config() {
189
+ return this._config ?? (0, import_config.getCurrentConfig)();
190
+ }
184
191
  setConfig(config) {
185
- this.config = config;
192
+ this._config = config;
186
193
  }
187
194
  writeSelection({
188
195
  data,
@@ -459,12 +466,24 @@ class CacheInternal {
459
466
  selection,
460
467
  parent = rootID,
461
468
  variables,
462
- stepsFromConnection = null
469
+ stepsFromConnection = null,
470
+ ignoreMasking
463
471
  }) {
464
472
  if (parent === null) {
465
473
  return { data: null, partial: false, stale: false, hasData: true };
466
474
  }
467
475
  const target = {};
476
+ if (selection.fragments) {
477
+ target[import_types.fragmentKey] = Object.fromEntries(
478
+ Object.entries(selection.fragments).map(([key, value]) => [
479
+ key,
480
+ {
481
+ parent,
482
+ variables: evaluateFragmentVariables(value, variables ?? {})
483
+ }
484
+ ])
485
+ );
486
+ }
468
487
  let hasData = false;
469
488
  let partial = false;
470
489
  let cascadeNull = false;
@@ -473,8 +492,11 @@ class CacheInternal {
473
492
  let targetSelection = (0, import_selection.getFieldsForType)(selection, typename);
474
493
  for (const [
475
494
  attributeName,
476
- { type, keyRaw, selection: fieldSelection, nullable, list }
495
+ { type, keyRaw, selection: fieldSelection, nullable, list, visible }
477
496
  ] of Object.entries(targetSelection)) {
497
+ if (!visible && !ignoreMasking) {
498
+ continue;
499
+ }
478
500
  const key = (0, import_stuff.evaluateKey)(keyRaw, variables);
479
501
  const { value } = this.storage.get(parent, key);
480
502
  const dt_field = this.staleManager.getFieldTime(parent, key);
@@ -514,7 +536,8 @@ class CacheInternal {
514
536
  fields: fieldSelection,
515
537
  variables,
516
538
  linkedList: value,
517
- stepsFromConnection: nextStep
539
+ stepsFromConnection: nextStep,
540
+ ignoreMasking: !!ignoreMasking
518
541
  });
519
542
  target[attributeName] = listValue.data;
520
543
  if (listValue.partial) {
@@ -531,7 +554,8 @@ class CacheInternal {
531
554
  parent: value,
532
555
  selection: fieldSelection,
533
556
  variables,
534
- stepsFromConnection: nextStep
557
+ stepsFromConnection: nextStep,
558
+ ignoreMasking
535
559
  });
536
560
  target[attributeName] = objectFields.data;
537
561
  if (objectFields.partial) {
@@ -575,7 +599,8 @@ class CacheInternal {
575
599
  fields,
576
600
  variables,
577
601
  linkedList,
578
- stepsFromConnection
602
+ stepsFromConnection,
603
+ ignoreMasking
579
604
  }) {
580
605
  const result = [];
581
606
  let partialData = false;
@@ -587,7 +612,8 @@ class CacheInternal {
587
612
  fields,
588
613
  variables,
589
614
  linkedList: entry,
590
- stepsFromConnection
615
+ stepsFromConnection,
616
+ ignoreMasking
591
617
  });
592
618
  result.push(nestedValue.data);
593
619
  if (nestedValue.partial) {
@@ -608,7 +634,8 @@ class CacheInternal {
608
634
  parent: entry,
609
635
  selection: fields,
610
636
  variables,
611
- stepsFromConnection
637
+ stepsFromConnection,
638
+ ignoreMasking
612
639
  });
613
640
  result.push(data);
614
641
  if (partial) {
@@ -711,9 +738,50 @@ class CacheInternal {
711
738
  }
712
739
  }
713
740
  }
741
+ function evaluateFragmentVariables(variables, args) {
742
+ return Object.fromEntries(
743
+ Object.entries(variables).map(([key, value]) => [key, fragmentVariableValue(value, args)])
744
+ );
745
+ }
746
+ function fragmentVariableValue(value, args) {
747
+ if (value.kind === "StringValue") {
748
+ return value.value;
749
+ }
750
+ if (value.kind === "BooleanValue") {
751
+ return value.value;
752
+ }
753
+ if (value.kind === "EnumValue") {
754
+ return value.value;
755
+ }
756
+ if (value.kind === "FloatValue") {
757
+ return parseFloat(value.value);
758
+ }
759
+ if (value.kind === "IntValue") {
760
+ return parseInt(value.value, 10);
761
+ }
762
+ if (value.kind === "NullValue") {
763
+ return null;
764
+ }
765
+ if (value.kind === "Variable") {
766
+ return args[value.name.value];
767
+ }
768
+ if (value.kind === "ListValue") {
769
+ return value.values.map((value2) => fragmentVariableValue(value2, args));
770
+ }
771
+ if (value.kind === "ObjectValue") {
772
+ return value.fields.reduce(
773
+ (obj, field) => ({
774
+ ...obj,
775
+ [field.name.value]: fragmentVariableValue(field.value, args)
776
+ }),
777
+ {}
778
+ );
779
+ }
780
+ }
714
781
  const rootID = "_ROOT_";
715
782
  // Annotate the CommonJS export names for ESM import in node:
716
783
  0 && (module.exports = {
717
784
  Cache,
785
+ evaluateFragmentVariables,
718
786
  rootID
719
787
  });
@@ -291,7 +291,8 @@ class List {
291
291
  this.cache._internal_unstable.getSelection({
292
292
  parent: spec.parentID || this.manager.rootID,
293
293
  selection: spec.selection,
294
- variables: spec.variables?.() || {}
294
+ variables: spec.variables?.() || {},
295
+ ignoreMasking: false
295
296
  }).data
296
297
  );
297
298
  }
@@ -42,7 +42,17 @@ class InMemorySubscriptions {
42
42
  const __typename = this.cache._internal_unstable.storage.get(parent, "__typename").value;
43
43
  let targetSelection = (0, import_selection.getFieldsForType)(selection, __typename);
44
44
  for (const fieldSelection of Object.values(targetSelection || {})) {
45
- const { keyRaw, selection: innerSelection, type, list, filters } = fieldSelection;
45
+ const {
46
+ keyRaw,
47
+ selection: innerSelection,
48
+ type,
49
+ list,
50
+ filters,
51
+ visible
52
+ } = fieldSelection;
53
+ if (!visible) {
54
+ continue;
55
+ }
46
56
  const key = (0, import_stuff.evaluateKey)(keyRaw, variables);
47
57
  let targetSelection2;
48
58
  if (innerSelection) {
@@ -116,7 +126,6 @@ class InMemorySubscriptions {
116
126
  const counts = this.referenceCounts[id][key];
117
127
  counts.set(spec.set, (counts.get(spec.set) || 0) + 1);
118
128
  this.cache._internal_unstable.lifetimes.resetLifetime(id, key);
119
- const { selection: innerSelection } = selection[1]?.[key] ?? {};
120
129
  }
121
130
  registerList({
122
131
  list,
@@ -46,6 +46,7 @@ export type ClientPluginContext = {
46
46
  forceNotify?: boolean;
47
47
  disableWrite?: boolean;
48
48
  disableRead?: boolean;
49
+ disableSubscriptions?: boolean;
49
50
  applyUpdates?: string[];
50
51
  };
51
52
  stuff: App.Stuff;
@@ -182,8 +182,8 @@ class DocumentStore extends import_store.Writable {
182
182
  handlers = {
183
183
  ...common,
184
184
  value,
185
- resolve: (ctx2, data2) => {
186
- return common.resolve(ctx2, data2 ?? value);
185
+ resolve: (ctx2, data) => {
186
+ return common.resolve(ctx2, data ?? value);
187
187
  }
188
188
  };
189
189
  } else if (direction === "error") {
@@ -243,25 +243,16 @@ class DocumentStore extends import_store.Writable {
243
243
  value
244
244
  );
245
245
  }
246
- let data = value.data;
247
- try {
248
- data = (0, import_scalars.unmarshalSelection)(this.#configFile, this.#artifact.selection, data) ?? null;
249
- } catch {
250
- }
251
- const finalValue = {
252
- ...value,
253
- data
254
- };
255
246
  if (!ctx.promise.resolved) {
256
- ctx.promise.resolve(finalValue);
247
+ ctx.promise.resolve(value);
257
248
  ctx.promise.resolved = true;
258
249
  }
259
250
  this.#lastContext = ctx.context.draft();
260
251
  this.#lastVariables = this.#lastContext.stuff.inputs.marshaled;
261
- if (ctx.silenceEcho && finalValue.data === this.state.data) {
252
+ if (ctx.silenceEcho && value.data === this.state.data) {
262
253
  return;
263
254
  }
264
- this.set(finalValue);
255
+ this.set(value);
265
256
  }
266
257
  }
267
258
  class ClientPluginContextWrapper {
@@ -54,7 +54,8 @@ class HoudiniClient {
54
54
  (0, import_plugins.fetchParams)(fetchParams),
55
55
  pipeline ?? [
56
56
  import_plugins.query,
57
- import_plugins.mutation
57
+ import_plugins.mutation,
58
+ import_plugins.fragment
58
59
  ].concat(
59
60
  plugins ?? [],
60
61
  import_injectedPlugins.default,
@@ -1,8 +1,9 @@
1
1
  import cache from '../../cache';
2
- import type { Cache } from '../../cache/cache';
2
+ import { Cache } from '../../cache/cache';
3
3
  import type { ClientPlugin } from '../documentStore';
4
- export declare const cachePolicy: ({ enabled, setFetching, cache: localCache, }: {
4
+ export declare const cachePolicy: ({ enabled, setFetching, cache: localCache, serverSideFallback, }: {
5
5
  enabled: boolean;
6
6
  setFetching: (val: boolean) => void;
7
7
  cache?: Cache | undefined;
8
+ serverSideFallback?: boolean | undefined;
8
9
  }) => ClientPlugin;