houdini 1.0.0-next.11 → 1.0.0-next.12

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.
@@ -76507,8 +76507,8 @@ async function updatePackageJSON(targetPath) {
76507
76507
  }
76508
76508
  packageJSON.devDependencies = {
76509
76509
  ...packageJSON.devDependencies,
76510
- houdini: "^1.0.0-next.11",
76511
- "houdini-svelte": "^1.0.0-next.11"
76510
+ houdini: "^1.0.0-next.12",
76511
+ "houdini-svelte": "^1.0.0-next.12"
76512
76512
  };
76513
76513
  await fs_exports.writeFile(packagePath, JSON.stringify(packageJSON, null, 4));
76514
76514
  }
@@ -76512,8 +76512,8 @@ async function updatePackageJSON(targetPath) {
76512
76512
  }
76513
76513
  packageJSON.devDependencies = {
76514
76514
  ...packageJSON.devDependencies,
76515
- houdini: "^1.0.0-next.11",
76516
- "houdini-svelte": "^1.0.0-next.11"
76515
+ houdini: "^1.0.0-next.12",
76516
+ "houdini-svelte": "^1.0.0-next.12"
76517
76517
  };
76518
76518
  await fs_exports.writeFile(packagePath, JSON.stringify(packageJSON, null, 4));
76519
76519
  }
@@ -14,7 +14,7 @@ export declare class DocumentStore<_Data extends GraphQLObject, _Input extends R
14
14
  initialValue?: _Data | null;
15
15
  fetching?: boolean;
16
16
  });
17
- send({ metadata, session, fetch, variables, policy, stuff, cacheParams, setup, }?: {
17
+ send({ metadata, session, fetch, variables, policy, stuff, cacheParams, setup, silenceEcho, }?: {
18
18
  fetch?: Fetch;
19
19
  variables?: Record<string, any> | null;
20
20
  metadata?: App.Metadata | null;
@@ -23,6 +23,7 @@ export declare class DocumentStore<_Data extends GraphQLObject, _Input extends R
23
23
  stuff?: Partial<App.Stuff>;
24
24
  cacheParams?: ClientPluginContext['cacheParams'];
25
25
  setup?: boolean;
26
+ silenceEcho?: boolean;
26
27
  }): Promise<QueryResult<_Data, _Input>>;
27
28
  }
28
29
  declare function marshalVariables<_Data extends GraphQLObject, _Input extends {}>(ctx: ClientPluginContext): Record<string, any>;
@@ -14,7 +14,7 @@ export declare class DocumentStore<_Data extends GraphQLObject, _Input extends R
14
14
  initialValue?: _Data | null;
15
15
  fetching?: boolean;
16
16
  });
17
- send({ metadata, session, fetch, variables, policy, stuff, cacheParams, setup, }?: {
17
+ send({ metadata, session, fetch, variables, policy, stuff, cacheParams, setup, silenceEcho, }?: {
18
18
  fetch?: Fetch;
19
19
  variables?: Record<string, any> | null;
20
20
  metadata?: App.Metadata | null;
@@ -23,6 +23,7 @@ export declare class DocumentStore<_Data extends GraphQLObject, _Input extends R
23
23
  stuff?: Partial<App.Stuff>;
24
24
  cacheParams?: ClientPluginContext['cacheParams'];
25
25
  setup?: boolean;
26
+ silenceEcho?: boolean;
26
27
  }): Promise<QueryResult<_Data, _Input>>;
27
28
  }
28
29
  declare function marshalVariables<_Data extends GraphQLObject, _Input extends {}>(ctx: ClientPluginContext): Record<string, any>;
@@ -87,7 +87,8 @@ class DocumentStore extends import_store.Writable {
87
87
  policy,
88
88
  stuff,
89
89
  cacheParams,
90
- setup = false
90
+ setup = false,
91
+ silenceEcho = false
91
92
  } = {}) {
92
93
  let context = new ClientPluginContextWrapper({
93
94
  config: this.#configFile,
@@ -118,6 +119,7 @@ class DocumentStore extends import_store.Writable {
118
119
  setup,
119
120
  currentStep: 0,
120
121
  index: 0,
122
+ silenceEcho,
121
123
  promise: {
122
124
  resolved: false,
123
125
  resolve,
@@ -255,6 +257,9 @@ class DocumentStore extends import_store.Writable {
255
257
  }
256
258
  this.#lastContext = ctx.context.draft();
257
259
  this.#lastVariables = this.#lastContext.stuff.inputs.marshaled;
260
+ if (ctx.silenceEcho && finalValue.data === this.state.data) {
261
+ return;
262
+ }
258
263
  this.set(finalValue);
259
264
  }
260
265
  }
@@ -35,7 +35,7 @@ const cachePolicy = ({
35
35
  cache: localCache = import_cache.default
36
36
  }) => () => {
37
37
  return {
38
- network(ctx, { next, resolve, marshalVariables }) {
38
+ network(ctx, { initialValue, next, resolve, marshalVariables }) {
39
39
  const { policy, artifact } = ctx;
40
40
  let useCache = false;
41
41
  if (enabled && artifact.kind === import_types.ArtifactKind.Query && !ctx.cacheParams?.disableRead) {
@@ -49,10 +49,10 @@ const cachePolicy = ({
49
49
  return resolve(ctx, {
50
50
  fetching: false,
51
51
  variables: ctx.variables ?? null,
52
- data: value.data,
52
+ data: allowed ? value.data : initialValue.data,
53
53
  errors: null,
54
54
  source: import_types.DataSource.Cache,
55
- partial: value.partial,
55
+ partial: allowed ? value.partial : false,
56
56
  stale: value.stale
57
57
  });
58
58
  }
@@ -67,7 +67,7 @@ const fetch = (target) => {
67
67
  const defaultFetch = (url, params) => {
68
68
  if (!url) {
69
69
  throw new Error(
70
- "Could not find configured client url. Please specify one in your houdini.config.js file."
70
+ "Could not find configured client url. Please specify one in your HoudiniClient constructor."
71
71
  );
72
72
  }
73
73
  return async ({ fetch: fetch2, text, variables }) => {
@@ -14,7 +14,7 @@ export declare class DocumentStore<_Data extends GraphQLObject, _Input extends R
14
14
  initialValue?: _Data | null;
15
15
  fetching?: boolean;
16
16
  });
17
- send({ metadata, session, fetch, variables, policy, stuff, cacheParams, setup, }?: {
17
+ send({ metadata, session, fetch, variables, policy, stuff, cacheParams, setup, silenceEcho, }?: {
18
18
  fetch?: Fetch;
19
19
  variables?: Record<string, any> | null;
20
20
  metadata?: App.Metadata | null;
@@ -23,6 +23,7 @@ export declare class DocumentStore<_Data extends GraphQLObject, _Input extends R
23
23
  stuff?: Partial<App.Stuff>;
24
24
  cacheParams?: ClientPluginContext['cacheParams'];
25
25
  setup?: boolean;
26
+ silenceEcho?: boolean;
26
27
  }): Promise<QueryResult<_Data, _Input>>;
27
28
  }
28
29
  declare function marshalVariables<_Data extends GraphQLObject, _Input extends {}>(ctx: ClientPluginContext): Record<string, any>;
@@ -64,7 +64,8 @@ class DocumentStore extends Writable {
64
64
  policy,
65
65
  stuff,
66
66
  cacheParams,
67
- setup = false
67
+ setup = false,
68
+ silenceEcho = false
68
69
  } = {}) {
69
70
  let context = new ClientPluginContextWrapper({
70
71
  config: this.#configFile,
@@ -95,6 +96,7 @@ class DocumentStore extends Writable {
95
96
  setup,
96
97
  currentStep: 0,
97
98
  index: 0,
99
+ silenceEcho,
98
100
  promise: {
99
101
  resolved: false,
100
102
  resolve,
@@ -232,6 +234,9 @@ class DocumentStore extends Writable {
232
234
  }
233
235
  this.#lastContext = ctx.context.draft();
234
236
  this.#lastVariables = this.#lastContext.stuff.inputs.marshaled;
237
+ if (ctx.silenceEcho && finalValue.data === this.state.data) {
238
+ return;
239
+ }
235
240
  this.set(finalValue);
236
241
  }
237
242
  }
@@ -1,11 +1,11 @@
1
1
  import { flatten } from "../lib/flatten";
2
2
  import { DocumentStore } from "./documentStore";
3
3
  import {
4
- fetchParams as fetchParamsPlugin,
5
4
  fetch as fetchPlugin,
6
5
  mutation as mutationPlugin,
7
6
  query as queryPlugin,
8
- throwOnError as throwOnErrorPlugin
7
+ throwOnError as throwOnErrorPlugin,
8
+ fetchParams as fetchParamsPlugin
9
9
  } from "./plugins";
10
10
  import pluginsFromPlugins from "./plugins/injectedPlugins";
11
11
  import { DocumentStore as DocumentStore2 } from "./documentStore";
@@ -6,7 +6,7 @@ const cachePolicy = ({
6
6
  cache: localCache = cache
7
7
  }) => () => {
8
8
  return {
9
- network(ctx, { next, resolve, marshalVariables }) {
9
+ network(ctx, { initialValue, next, resolve, marshalVariables }) {
10
10
  const { policy, artifact } = ctx;
11
11
  let useCache = false;
12
12
  if (enabled && artifact.kind === ArtifactKind.Query && !ctx.cacheParams?.disableRead) {
@@ -20,10 +20,10 @@ const cachePolicy = ({
20
20
  return resolve(ctx, {
21
21
  fetching: false,
22
22
  variables: ctx.variables ?? null,
23
- data: value.data,
23
+ data: allowed ? value.data : initialValue.data,
24
24
  errors: null,
25
25
  source: DataSource.Cache,
26
- partial: value.partial,
26
+ partial: allowed ? value.partial : false,
27
27
  stale: value.stale
28
28
  });
29
29
  }
@@ -42,7 +42,7 @@ const fetch = (target) => {
42
42
  const defaultFetch = (url, params) => {
43
43
  if (!url) {
44
44
  throw new Error(
45
- "Could not find configured client url. Please specify one in your houdini.config.js file."
45
+ "Could not find configured client url. Please specify one in your HoudiniClient constructor."
46
46
  );
47
47
  }
48
48
  return async ({ fetch: fetch2, text, variables }) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "houdini",
3
- "version": "1.0.0-next.11",
3
+ "version": "1.0.0-next.12",
4
4
  "description": "The disappearing GraphQL clients",
5
5
  "keywords": [
6
6
  "typescript",