houdini 1.1.4-react.0 → 1.1.4

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 (47) hide show
  1. package/build/cmd-cjs/index.js +607 -444
  2. package/build/cmd-esm/index.js +607 -444
  3. package/build/codegen/transforms/fragmentVariables.d.ts +0 -11
  4. package/build/codegen-cjs/index.js +577 -403
  5. package/build/codegen-esm/index.js +577 -403
  6. package/build/lib/config.d.ts +1 -1
  7. package/build/lib/parse.d.ts +1 -2
  8. package/build/lib/types.d.ts +1 -4
  9. package/build/lib-cjs/index.js +187 -195
  10. package/build/lib-esm/index.js +187 -195
  11. package/build/runtime/cache/cache.d.ts +4 -2
  12. package/build/runtime/client/documentStore.d.ts +0 -3
  13. package/build/runtime/client/index.d.ts +1 -1
  14. package/build/runtime/lib/types.d.ts +4 -46
  15. package/build/runtime-cjs/cache/cache.d.ts +4 -2
  16. package/build/runtime-cjs/cache/cache.js +37 -14
  17. package/build/runtime-cjs/client/documentStore.d.ts +0 -3
  18. package/build/runtime-cjs/client/documentStore.js +6 -11
  19. package/build/runtime-cjs/client/index.d.ts +1 -1
  20. package/build/runtime-cjs/client/plugins/cache.js +3 -5
  21. package/build/runtime-cjs/client/plugins/fragment.js +1 -8
  22. package/build/runtime-cjs/client/plugins/query.js +1 -2
  23. package/build/runtime-cjs/lib/types.d.ts +4 -46
  24. package/build/runtime-esm/cache/cache.d.ts +4 -2
  25. package/build/runtime-esm/cache/cache.js +37 -14
  26. package/build/runtime-esm/client/documentStore.d.ts +0 -3
  27. package/build/runtime-esm/client/documentStore.js +6 -11
  28. package/build/runtime-esm/client/index.d.ts +1 -1
  29. package/build/runtime-esm/client/plugins/cache.js +3 -5
  30. package/build/runtime-esm/client/plugins/fragment.js +1 -8
  31. package/build/runtime-esm/client/plugins/query.js +1 -2
  32. package/build/runtime-esm/lib/types.d.ts +4 -46
  33. package/build/test-cjs/index.js +598 -428
  34. package/build/test-esm/index.js +598 -428
  35. package/build/vite-cjs/index.js +617 -454
  36. package/build/vite-esm/index.js +617 -454
  37. package/package.json +3 -1
  38. package/build/runtime/lib/pageInfo.d.ts +0 -7
  39. package/build/runtime/lib/pagination.d.ts +0 -29
  40. package/build/runtime-cjs/lib/pageInfo.d.ts +0 -7
  41. package/build/runtime-cjs/lib/pageInfo.js +0 -79
  42. package/build/runtime-cjs/lib/pagination.d.ts +0 -29
  43. package/build/runtime-cjs/lib/pagination.js +0 -231
  44. package/build/runtime-esm/lib/pageInfo.d.ts +0 -7
  45. package/build/runtime-esm/lib/pageInfo.js +0 -52
  46. package/build/runtime-esm/lib/pagination.d.ts +0 -29
  47. package/build/runtime-esm/lib/pagination.js +0 -206
@@ -12,12 +12,12 @@ const cachePolicy = ({
12
12
  network(ctx, { initialValue, next, resolve, marshalVariables }) {
13
13
  const { policy, artifact } = ctx;
14
14
  let useCache = false;
15
- if (enabled && (artifact.kind === ArtifactKind.Query || artifact.kind === ArtifactKind.Fragment) && !ctx.cacheParams?.disableRead) {
15
+ if (enabled && artifact.kind === ArtifactKind.Query && !ctx.cacheParams?.disableRead) {
16
16
  if (policy !== CachePolicy.NetworkOnly) {
17
17
  const value = localCache.read({
18
18
  selection: artifact.selection,
19
19
  variables: marshalVariables(ctx),
20
- parent: ctx.stuff?.parentID
20
+ fullCheck: true
21
21
  });
22
22
  const allowed = !value.partial || artifact.kind === ArtifactKind.Query && artifact.partial;
23
23
  if (policy === CachePolicy.CacheOnly) {
@@ -53,9 +53,7 @@ const cachePolicy = ({
53
53
  localCache._internal_unstable.collectGarbage();
54
54
  }, 0);
55
55
  }
56
- if (!ctx.stuff?.silenceLoading) {
57
- setFetching(!useCache);
58
- }
56
+ setFetching(!useCache);
59
57
  return next(ctx);
60
58
  },
61
59
  afterNetwork(ctx, { resolve, value, marshalVariables }) {
@@ -1,20 +1,14 @@
1
1
  import cache from "../../cache";
2
- import { deepEquals } from "../../lib/deepEquals";
3
2
  import { ArtifactKind, DataSource } from "../../lib/types";
4
3
  import { documentPlugin } from "../utils";
5
4
  const fragment = documentPlugin(ArtifactKind.Fragment, function() {
6
5
  let subscriptionSpec = null;
7
- let lastReference = null;
8
6
  return {
9
7
  start(ctx, { next, resolve, variablesChanged, marshalVariables }) {
10
8
  if (!ctx.stuff.parentID) {
11
9
  return next(ctx);
12
10
  }
13
- const currentReference = {
14
- parent: ctx.stuff.parentID,
15
- variables: marshalVariables(ctx)
16
- };
17
- if (!ctx.cacheParams?.disableSubscriptions && (!deepEquals(lastReference, currentReference) || variablesChanged(ctx))) {
11
+ if (variablesChanged(ctx) && !ctx.cacheParams?.disableSubscriptions) {
18
12
  if (subscriptionSpec) {
19
13
  cache.unsubscribe(subscriptionSpec, subscriptionSpec.variables?.() || {});
20
14
  }
@@ -37,7 +31,6 @@ const fragment = documentPlugin(ArtifactKind.Fragment, function() {
37
31
  }
38
32
  };
39
33
  cache.subscribe(subscriptionSpec, variables);
40
- lastReference = currentReference;
41
34
  }
42
35
  next(ctx);
43
36
  },
@@ -18,11 +18,10 @@ const query = documentPlugin(ArtifactKind.Query, function() {
18
18
  cache.unsubscribe(subscriptionSpec, subscriptionSpec.variables?.() || {});
19
19
  }
20
20
  lastVariables = { ...marshalVariables(ctx) };
21
- const variables = lastVariables;
22
21
  subscriptionSpec = {
23
22
  rootType: ctx.artifact.rootType,
24
23
  selection: ctx.artifact.selection,
25
- variables: () => variables,
24
+ variables: () => lastVariables,
26
25
  set: (newValue) => {
27
26
  resolve(ctx, {
28
27
  data: newValue,
@@ -25,7 +25,6 @@ declare global {
25
25
  };
26
26
  optimisticResponse?: GraphQLObject;
27
27
  parentID?: string;
28
- silenceLoading?: boolean;
29
28
  }
30
29
  }
31
30
  }
@@ -142,6 +141,10 @@ export type SubscriptionSelection = {
142
141
  connection: boolean;
143
142
  type: string;
144
143
  };
144
+ directives?: {
145
+ name: string;
146
+ arguments: ValueMap;
147
+ }[];
145
148
  updates?: string[];
146
149
  visible?: boolean;
147
150
  filters?: Record<string, {
@@ -194,51 +197,6 @@ export type ValueOf<Parent> = Parent[keyof Parent];
194
197
  export declare const fragmentKey = " $fragments";
195
198
  export type ValueNode = VariableNode | IntValueNode | FloatValueNode | StringValueNode | BooleanValueNode | NullValueNode | EnumValueNode | ListValueNode | ObjectValueNode;
196
199
  export type ValueMap = Record<string, ValueNode>;
197
- export type FetchParams<_Input> = {
198
- variables?: _Input;
199
- /**
200
- * The policy to use when performing the fetch. If set to CachePolicy.NetworkOnly,
201
- * a request will always be sent, even if the variables are the same as the last call
202
- * to fetch.
203
- */
204
- policy?: CachePolicies;
205
- /**
206
- * An object that will be passed to the fetch function.
207
- * You can do what you want with it!
208
- */
209
- metadata?: App.Metadata;
210
- };
211
- export type FetchFn<_Data extends GraphQLObject, _Input = any> = (params?: FetchParams<_Input>) => Promise<QueryResult<_Data, _Input>>;
212
- export type CursorHandlers<_Data extends GraphQLObject, _Input> = {
213
- loadNextPage: (args?: {
214
- first?: number;
215
- after?: string;
216
- fetch?: typeof globalThis.fetch;
217
- metadata?: {};
218
- }) => Promise<void>;
219
- loadPreviousPage: (args?: {
220
- last?: number;
221
- before?: string;
222
- fetch?: typeof globalThis.fetch;
223
- metadata?: {};
224
- }) => Promise<void>;
225
- fetch(args?: FetchParams<_Input> | undefined): Promise<QueryResult<_Data, _Input>>;
226
- };
227
- export type OffsetHandlers<_Data extends GraphQLObject, _Input> = {
228
- loadNextPage: (args?: {
229
- limit?: number;
230
- offset?: number;
231
- metadata?: {};
232
- fetch?: typeof globalThis.fetch;
233
- }) => Promise<void>;
234
- fetch(args?: FetchParams<_Input> | undefined): Promise<QueryResult<_Data, _Input>>;
235
- };
236
- export type PageInfo = {
237
- startCursor: string | null;
238
- endCursor: string | null;
239
- hasNextPage: boolean;
240
- hasPreviousPage: boolean;
241
- };
242
200
  interface IntValueNode {
243
201
  readonly kind: 'IntValue';
244
202
  readonly value: string;