houdini 1.2.6-next.0 → 1.2.7

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 (36) hide show
  1. package/build/cmd-cjs/index.js +110 -74
  2. package/build/cmd-esm/index.js +110 -74
  3. package/build/codegen/generators/artifacts/index.d.ts +2 -0
  4. package/build/codegen-cjs/index.js +101 -69
  5. package/build/codegen-esm/index.js +101 -69
  6. package/build/lib/config.d.ts +1 -1
  7. package/build/lib/graphql.d.ts +5 -3
  8. package/build/lib-cjs/index.js +48 -31
  9. package/build/lib-esm/index.js +46 -30
  10. package/build/runtime/cache/cache.d.ts +1 -0
  11. package/build/runtime/client/documentStore.d.ts +1 -0
  12. package/build/runtime/client/plugins/subscription.d.ts +3 -2
  13. package/build/runtime/lib/config.d.ts +4 -0
  14. package/build/runtime-cjs/cache/cache.d.ts +1 -0
  15. package/build/runtime-cjs/cache/cache.js +6 -8
  16. package/build/runtime-cjs/client/documentStore.d.ts +1 -0
  17. package/build/runtime-cjs/client/documentStore.js +1 -0
  18. package/build/runtime-cjs/client/plugins/fetch.js +14 -5
  19. package/build/runtime-cjs/client/plugins/fetchParams.js +2 -2
  20. package/build/runtime-cjs/client/plugins/subscription.d.ts +3 -2
  21. package/build/runtime-cjs/client/plugins/subscription.js +3 -3
  22. package/build/runtime-cjs/lib/config.d.ts +4 -0
  23. package/build/runtime-esm/cache/cache.d.ts +1 -0
  24. package/build/runtime-esm/cache/cache.js +6 -8
  25. package/build/runtime-esm/client/documentStore.d.ts +1 -0
  26. package/build/runtime-esm/client/documentStore.js +1 -0
  27. package/build/runtime-esm/client/plugins/fetch.js +14 -5
  28. package/build/runtime-esm/client/plugins/fetchParams.js +2 -2
  29. package/build/runtime-esm/client/plugins/subscription.d.ts +3 -2
  30. package/build/runtime-esm/client/plugins/subscription.js +3 -3
  31. package/build/runtime-esm/lib/config.d.ts +4 -0
  32. package/build/test-cjs/index.js +107 -71
  33. package/build/test-esm/index.js +107 -71
  34. package/build/vite-cjs/index.js +107 -71
  35. package/build/vite-esm/index.js +107 -71
  36. package/package.json +1 -1
@@ -53969,11 +53969,11 @@ var require_esprima2 = __commonJS({
53969
53969
  case "}":
53970
53970
  regex = false;
53971
53971
  if (this.values[this.curly - 3] === "function") {
53972
- var check2 = this.values[this.curly - 4];
53973
- regex = check2 ? !this.beforeFunctionExpression(check2) : false;
53972
+ var check = this.values[this.curly - 4];
53973
+ regex = check ? !this.beforeFunctionExpression(check) : false;
53974
53974
  } else if (this.values[this.curly - 4] === "function") {
53975
- var check2 = this.values[this.curly - 5];
53976
- regex = check2 ? !this.beforeFunctionExpression(check2) : true;
53975
+ var check = this.values[this.curly - 5];
53976
+ regex = check ? !this.beforeFunctionExpression(check) : true;
53977
53977
  }
53978
53978
  break;
53979
53979
  default:
@@ -63499,7 +63499,7 @@ var fetch2 = (target) => {
63499
63499
  }
63500
63500
  const fetch3 = ctx.fetch ?? globalThis.fetch;
63501
63501
  const fetchParams2 = {
63502
- name: ctx.artifact.name,
63502
+ name: ctx.name,
63503
63503
  text: ctx.text,
63504
63504
  hash: ctx.hash,
63505
63505
  variables: marshalVariables2(ctx)
@@ -63555,8 +63555,7 @@ var defaultFetch = (url, params) => {
63555
63555
  };
63556
63556
  };
63557
63557
  function handleMultipart(params, args) {
63558
- const { clone: clone2, files } = extractFiles({
63559
- query: params.text,
63558
+ const { files } = extractFiles({
63560
63559
  variables: params.variables
63561
63560
  });
63562
63561
  if (files.size) {
@@ -63569,8 +63568,18 @@ function handleMultipart(params, args) {
63569
63568
  headers = Object.fromEntries(filtered);
63570
63569
  }
63571
63570
  const form = new FormData();
63572
- const operationJSON = JSON.stringify(clone2);
63573
- form.set("operations", operationJSON);
63571
+ if (args && args?.body) {
63572
+ form.set("operations", args?.body);
63573
+ } else {
63574
+ form.set(
63575
+ "operations",
63576
+ JSON.stringify({
63577
+ operationName: params.name,
63578
+ query: params.text,
63579
+ variables: params.variables
63580
+ })
63581
+ );
63582
+ }
63574
63583
  const map = {};
63575
63584
  let i2 = 0;
63576
63585
  files.forEach((paths) => {
@@ -65148,12 +65157,9 @@ var CacheInternal = class {
65148
65157
  );
65149
65158
  }
65150
65159
  }
65151
- const embedded = this.idFields(linkedType)?.filter(
65152
- (field2) => typeof value[field2] === "undefined"
65153
- ).length > 0;
65154
65160
  let linkedID = null;
65155
65161
  if (value !== null) {
65156
- linkedID = !embedded ? this.id(linkedType, value) : `${parent}.${key}`;
65162
+ linkedID = !this.isEmbedded(linkedType, value) ? this.id(linkedType, value) : `${parent}.${key}`;
65157
65163
  }
65158
65164
  let linkChange = linkedID !== previousValue;
65159
65165
  layer.writeLink(parent, key, linkedID);
@@ -65525,6 +65531,10 @@ var CacheInternal = class {
65525
65531
  computeID(type, data) {
65526
65532
  return computeID(this.config, type, data);
65527
65533
  }
65534
+ isEmbedded(linkedType, value) {
65535
+ const idFields = this.idFields(linkedType);
65536
+ return idFields.length === 0 || idFields.filter((field) => typeof value[field] === "undefined").length > 0;
65537
+ }
65528
65538
  hydrateNestedList({
65529
65539
  fields,
65530
65540
  variables,
@@ -65632,9 +65642,6 @@ var CacheInternal = class {
65632
65642
  }
65633
65643
  const entryObj = entry;
65634
65644
  let linkedID = `${recordID}.${key}[${this.storage.nextRank}]`;
65635
- const embedded = this.idFields(linkedType)?.filter(
65636
- (field) => typeof entry[field] === "undefined"
65637
- ).length > 0;
65638
65645
  let innerType = linkedType;
65639
65646
  const typename = entryObj.__typename;
65640
65647
  if (typename) {
@@ -65642,7 +65649,7 @@ var CacheInternal = class {
65642
65649
  } else if (abstract) {
65643
65650
  throw new Error("Encountered interface type without __typename in the payload");
65644
65651
  }
65645
- if (!embedded) {
65652
+ if (!this.isEmbedded(linkedType, entry)) {
65646
65653
  const id = this.id(innerType, entry);
65647
65654
  if (id) {
65648
65655
  linkedID = id;
@@ -66004,10 +66011,10 @@ var mutation = documentPlugin(ArtifactKind.Mutation, () => {
66004
66011
  });
66005
66012
 
66006
66013
  // src/runtime/client/plugins/subscription.ts
66007
- var check = null;
66008
66014
  function subscription(factory) {
66009
66015
  return documentPlugin(ArtifactKind.Subscription, () => {
66010
66016
  let clearSubscription = null;
66017
+ let check = null;
66011
66018
  return {
66012
66019
  start(ctx, { resolve: resolve2, next, initialValue }) {
66013
66020
  if (typeof globalThis.window === "undefined") {
@@ -66035,8 +66042,8 @@ function subscription(factory) {
66035
66042
  clearSubscription?.();
66036
66043
  clearSubscription = client.subscribe(
66037
66044
  {
66038
- operationName: ctx.artifact.name,
66039
- query: ctx.artifact.raw,
66045
+ operationName: ctx.name,
66046
+ query: ctx.text,
66040
66047
  variables: marshalVariables2(ctx)
66041
66048
  },
66042
66049
  {
@@ -66123,8 +66130,8 @@ var fetchParams = (fn = () => ({})) => () => ({
66123
66130
  stuff: ctx.stuff,
66124
66131
  document: ctx.artifact,
66125
66132
  variables: marshalVariables2(ctx),
66126
- text: ctx.artifact.raw,
66127
- hash: ctx.artifact.hash
66133
+ text: ctx.text,
66134
+ hash: ctx.hash
66128
66135
  })
66129
66136
  });
66130
66137
  }
@@ -66205,6 +66212,7 @@ var DocumentStore = class extends Writable {
66205
66212
  } = {}) {
66206
66213
  let context = new ClientPluginContextWrapper({
66207
66214
  config: this.#configFile,
66215
+ name: this.artifact.name,
66208
66216
  text: this.artifact.raw,
66209
66217
  hash: this.artifact.hash,
66210
66218
  policy: policy ?? this.artifact.policy,
@@ -66568,7 +66576,7 @@ var Config = class {
66568
66576
  projectRoot;
66569
66577
  schema;
66570
66578
  schemaPath;
66571
- persistedQueryPath;
66579
+ persistedQueriesPath = "./$houdini/persisted_queries.json";
66572
66580
  exclude;
66573
66581
  scalars;
66574
66582
  module = "esm";
@@ -66620,7 +66628,8 @@ var Config = class {
66620
66628
  logLevel,
66621
66629
  defaultFragmentMasking = "enable",
66622
66630
  watchSchema,
66623
- projectDir
66631
+ projectDir,
66632
+ persistedQueriesPath
66624
66633
  } = this.configFile;
66625
66634
  if (typeof schema === "string") {
66626
66635
  this.schema = graphql2.buildSchema(schema);
@@ -66657,6 +66666,9 @@ var Config = class {
66657
66666
  this.schemaPollHeaders = watchSchema?.headers ?? {};
66658
66667
  this.rootDir = join2(this.projectRoot, "$houdini");
66659
66668
  this.#fragmentVariableMaps = {};
66669
+ if (persistedQueriesPath) {
66670
+ this.persistedQueriesPath = persistedQueriesPath;
66671
+ }
66660
66672
  if (defaultKeys) {
66661
66673
  this.defaultKeys = defaultKeys;
66662
66674
  }
@@ -67371,11 +67383,14 @@ function getRootType(type) {
67371
67383
  }
67372
67384
  return type;
67373
67385
  }
67374
- function hashDocument({
67375
- document
67376
- }) {
67377
- const docString = typeof document === "string" ? document : document.originalString;
67378
- return crypto.createHash("sha256").update(docString ?? "").digest("hex");
67386
+ function hashOriginal({ document }) {
67387
+ return hashDocument(document.originalString);
67388
+ }
67389
+ function hashRaw({ document }) {
67390
+ return hashDocument(document.artifact?.raw);
67391
+ }
67392
+ function hashDocument(str) {
67393
+ return crypto.createHash("sha256").update(str || "").digest("hex");
67379
67394
  }
67380
67395
  function parentField(ancestors) {
67381
67396
  return walkParentField([...ancestors].sort(() => -1));
@@ -67914,7 +67929,8 @@ export {
67914
67929
  getCurrentConfig,
67915
67930
  getMockConfig,
67916
67931
  getRootType,
67917
- hashDocument,
67932
+ hashOriginal,
67933
+ hashRaw,
67918
67934
  houdini_mode,
67919
67935
  isPending,
67920
67936
  keyFieldsForType,
@@ -107,6 +107,7 @@ declare class CacheInternal {
107
107
  id(type: string, id: string): string | null;
108
108
  idFields(type: string): string[];
109
109
  computeID(type: string, data: any): string;
110
+ isEmbedded(linkedType: string, value: GraphQLObject): boolean;
110
111
  hydrateNestedList({ fields, variables, linkedList, stepsFromConnection, ignoreMasking, fullCheck, loading, }: {
111
112
  fields: SubscriptionSelection;
112
113
  variables?: {} | null;
@@ -40,6 +40,7 @@ export type ClientHooks = {
40
40
  export type Fetch = typeof globalThis.fetch;
41
41
  export type ClientPluginContext = {
42
42
  config: ConfigFile;
43
+ name: string;
43
44
  text: string;
44
45
  hash: string;
45
46
  artifact: DocumentArtifact;
@@ -3,9 +3,10 @@ export declare function subscription(factory: SubscriptionHandler): import("../d
3
3
  export type SubscriptionHandler = (ctx: ClientPluginContext) => SubscriptionClient;
4
4
  export type SubscriptionClient = {
5
5
  subscribe: (payload: {
6
- operationName: string;
6
+ operationName?: string;
7
7
  query: string;
8
- variables?: {};
8
+ variables?: Record<string, unknown> | null;
9
+ extensions?: Record<'persistedQuery', string> | Record<string, unknown> | null;
9
10
  }, handlers: {
10
11
  next: (payload: {
11
12
  data?: {} | null;
@@ -92,6 +92,10 @@ export type ConfigFile = {
92
92
  * Configure the dev environment to watch a remote schema for changes
93
93
  */
94
94
  watchSchema?: WatchSchemaConfig;
95
+ /**
96
+ * Specifies the the persisted queries path and file. (default: `./$houdini/persisted_queries.json`)
97
+ */
98
+ persistedQueriesPath?: string;
95
99
  /**
96
100
  * An object describing the plugins enabled for the project
97
101
  */
@@ -107,6 +107,7 @@ declare class CacheInternal {
107
107
  id(type: string, id: string): string | null;
108
108
  idFields(type: string): string[];
109
109
  computeID(type: string, data: any): string;
110
+ isEmbedded(linkedType: string, value: GraphQLObject): boolean;
110
111
  hydrateNestedList({ fields, variables, linkedList, stepsFromConnection, ignoreMasking, fullCheck, loading, }: {
111
112
  fields: SubscriptionSelection;
112
113
  variables?: {} | null;
@@ -340,12 +340,9 @@ class CacheInternal {
340
340
  );
341
341
  }
342
342
  }
343
- const embedded = this.idFields(linkedType)?.filter(
344
- (field2) => typeof value[field2] === "undefined"
345
- ).length > 0;
346
343
  let linkedID = null;
347
344
  if (value !== null) {
348
- linkedID = !embedded ? this.id(linkedType, value) : `${parent}.${key}`;
345
+ linkedID = !this.isEmbedded(linkedType, value) ? this.id(linkedType, value) : `${parent}.${key}`;
349
346
  }
350
347
  let linkChange = linkedID !== previousValue;
351
348
  layer.writeLink(parent, key, linkedID);
@@ -717,6 +714,10 @@ class CacheInternal {
717
714
  computeID(type, data) {
718
715
  return (0, import_config.computeID)(this.config, type, data);
719
716
  }
717
+ isEmbedded(linkedType, value) {
718
+ const idFields = this.idFields(linkedType);
719
+ return idFields.length === 0 || idFields.filter((field) => typeof value[field] === "undefined").length > 0;
720
+ }
720
721
  hydrateNestedList({
721
722
  fields,
722
723
  variables,
@@ -824,9 +825,6 @@ class CacheInternal {
824
825
  }
825
826
  const entryObj = entry;
826
827
  let linkedID = `${recordID}.${key}[${this.storage.nextRank}]`;
827
- const embedded = this.idFields(linkedType)?.filter(
828
- (field) => typeof entry[field] === "undefined"
829
- ).length > 0;
830
828
  let innerType = linkedType;
831
829
  const typename = entryObj.__typename;
832
830
  if (typename) {
@@ -834,7 +832,7 @@ class CacheInternal {
834
832
  } else if (abstract) {
835
833
  throw new Error("Encountered interface type without __typename in the payload");
836
834
  }
837
- if (!embedded) {
835
+ if (!this.isEmbedded(linkedType, entry)) {
838
836
  const id = this.id(innerType, entry);
839
837
  if (id) {
840
838
  linkedID = id;
@@ -40,6 +40,7 @@ export type ClientHooks = {
40
40
  export type Fetch = typeof globalThis.fetch;
41
41
  export type ClientPluginContext = {
42
42
  config: ConfigFile;
43
+ name: string;
43
44
  text: string;
44
45
  hash: string;
45
46
  artifact: DocumentArtifact;
@@ -101,6 +101,7 @@ class DocumentStore extends import_store.Writable {
101
101
  } = {}) {
102
102
  let context = new ClientPluginContextWrapper({
103
103
  config: this.#configFile,
104
+ name: this.artifact.name,
104
105
  text: this.artifact.raw,
105
106
  hash: this.artifact.hash,
106
107
  policy: policy ?? this.artifact.policy,
@@ -33,7 +33,7 @@ const fetch = (target) => {
33
33
  }
34
34
  const fetch2 = ctx.fetch ?? globalThis.fetch;
35
35
  const fetchParams = {
36
- name: ctx.artifact.name,
36
+ name: ctx.name,
37
37
  text: ctx.text,
38
38
  hash: ctx.hash,
39
39
  variables: marshalVariables(ctx)
@@ -89,8 +89,7 @@ const defaultFetch = (url, params) => {
89
89
  };
90
90
  };
91
91
  function handleMultipart(params, args) {
92
- const { clone, files } = extractFiles({
93
- query: params.text,
92
+ const { files } = extractFiles({
94
93
  variables: params.variables
95
94
  });
96
95
  if (files.size) {
@@ -103,8 +102,18 @@ function handleMultipart(params, args) {
103
102
  headers = Object.fromEntries(filtered);
104
103
  }
105
104
  const form = new FormData();
106
- const operationJSON = JSON.stringify(clone);
107
- form.set("operations", operationJSON);
105
+ if (args && args?.body) {
106
+ form.set("operations", args?.body);
107
+ } else {
108
+ form.set(
109
+ "operations",
110
+ JSON.stringify({
111
+ operationName: params.name,
112
+ query: params.text,
113
+ variables: params.variables
114
+ })
115
+ );
116
+ }
108
117
  const map = {};
109
118
  let i = 0;
110
119
  files.forEach((paths) => {
@@ -33,8 +33,8 @@ const fetchParams = (fn = () => ({})) => () => ({
33
33
  stuff: ctx.stuff,
34
34
  document: ctx.artifact,
35
35
  variables: marshalVariables(ctx),
36
- text: ctx.artifact.raw,
37
- hash: ctx.artifact.hash
36
+ text: ctx.text,
37
+ hash: ctx.hash
38
38
  })
39
39
  });
40
40
  }
@@ -3,9 +3,10 @@ export declare function subscription(factory: SubscriptionHandler): import("../d
3
3
  export type SubscriptionHandler = (ctx: ClientPluginContext) => SubscriptionClient;
4
4
  export type SubscriptionClient = {
5
5
  subscribe: (payload: {
6
- operationName: string;
6
+ operationName?: string;
7
7
  query: string;
8
- variables?: {};
8
+ variables?: Record<string, unknown> | null;
9
+ extensions?: Record<'persistedQuery', string> | Record<string, unknown> | null;
9
10
  }, handlers: {
10
11
  next: (payload: {
11
12
  data?: {} | null;
@@ -24,10 +24,10 @@ module.exports = __toCommonJS(subscription_exports);
24
24
  var import_deepEquals = require("../../lib/deepEquals");
25
25
  var import_types = require("../../lib/types");
26
26
  var import_utils = require("../utils");
27
- let check = null;
28
27
  function subscription(factory) {
29
28
  return (0, import_utils.documentPlugin)(import_types.ArtifactKind.Subscription, () => {
30
29
  let clearSubscription = null;
30
+ let check = null;
31
31
  return {
32
32
  start(ctx, { resolve, next, initialValue }) {
33
33
  if (typeof globalThis.window === "undefined") {
@@ -55,8 +55,8 @@ function subscription(factory) {
55
55
  clearSubscription?.();
56
56
  clearSubscription = client.subscribe(
57
57
  {
58
- operationName: ctx.artifact.name,
59
- query: ctx.artifact.raw,
58
+ operationName: ctx.name,
59
+ query: ctx.text,
60
60
  variables: marshalVariables(ctx)
61
61
  },
62
62
  {
@@ -92,6 +92,10 @@ export type ConfigFile = {
92
92
  * Configure the dev environment to watch a remote schema for changes
93
93
  */
94
94
  watchSchema?: WatchSchemaConfig;
95
+ /**
96
+ * Specifies the the persisted queries path and file. (default: `./$houdini/persisted_queries.json`)
97
+ */
98
+ persistedQueriesPath?: string;
95
99
  /**
96
100
  * An object describing the plugins enabled for the project
97
101
  */
@@ -107,6 +107,7 @@ declare class CacheInternal {
107
107
  id(type: string, id: string): string | null;
108
108
  idFields(type: string): string[];
109
109
  computeID(type: string, data: any): string;
110
+ isEmbedded(linkedType: string, value: GraphQLObject): boolean;
110
111
  hydrateNestedList({ fields, variables, linkedList, stepsFromConnection, ignoreMasking, fullCheck, loading, }: {
111
112
  fields: SubscriptionSelection;
112
113
  variables?: {} | null;
@@ -315,12 +315,9 @@ class CacheInternal {
315
315
  );
316
316
  }
317
317
  }
318
- const embedded = this.idFields(linkedType)?.filter(
319
- (field2) => typeof value[field2] === "undefined"
320
- ).length > 0;
321
318
  let linkedID = null;
322
319
  if (value !== null) {
323
- linkedID = !embedded ? this.id(linkedType, value) : `${parent}.${key}`;
320
+ linkedID = !this.isEmbedded(linkedType, value) ? this.id(linkedType, value) : `${parent}.${key}`;
324
321
  }
325
322
  let linkChange = linkedID !== previousValue;
326
323
  layer.writeLink(parent, key, linkedID);
@@ -692,6 +689,10 @@ class CacheInternal {
692
689
  computeID(type, data) {
693
690
  return computeID(this.config, type, data);
694
691
  }
692
+ isEmbedded(linkedType, value) {
693
+ const idFields = this.idFields(linkedType);
694
+ return idFields.length === 0 || idFields.filter((field) => typeof value[field] === "undefined").length > 0;
695
+ }
695
696
  hydrateNestedList({
696
697
  fields,
697
698
  variables,
@@ -799,9 +800,6 @@ class CacheInternal {
799
800
  }
800
801
  const entryObj = entry;
801
802
  let linkedID = `${recordID}.${key}[${this.storage.nextRank}]`;
802
- const embedded = this.idFields(linkedType)?.filter(
803
- (field) => typeof entry[field] === "undefined"
804
- ).length > 0;
805
803
  let innerType = linkedType;
806
804
  const typename = entryObj.__typename;
807
805
  if (typename) {
@@ -809,7 +807,7 @@ class CacheInternal {
809
807
  } else if (abstract) {
810
808
  throw new Error("Encountered interface type without __typename in the payload");
811
809
  }
812
- if (!embedded) {
810
+ if (!this.isEmbedded(linkedType, entry)) {
813
811
  const id = this.id(innerType, entry);
814
812
  if (id) {
815
813
  linkedID = id;
@@ -40,6 +40,7 @@ export type ClientHooks = {
40
40
  export type Fetch = typeof globalThis.fetch;
41
41
  export type ClientPluginContext = {
42
42
  config: ConfigFile;
43
+ name: string;
43
44
  text: string;
44
45
  hash: string;
45
46
  artifact: DocumentArtifact;
@@ -78,6 +78,7 @@ class DocumentStore extends Writable {
78
78
  } = {}) {
79
79
  let context = new ClientPluginContextWrapper({
80
80
  config: this.#configFile,
81
+ name: this.artifact.name,
81
82
  text: this.artifact.raw,
82
83
  hash: this.artifact.hash,
83
84
  policy: policy ?? this.artifact.policy,
@@ -8,7 +8,7 @@ const fetch = (target) => {
8
8
  }
9
9
  const fetch2 = ctx.fetch ?? globalThis.fetch;
10
10
  const fetchParams = {
11
- name: ctx.artifact.name,
11
+ name: ctx.name,
12
12
  text: ctx.text,
13
13
  hash: ctx.hash,
14
14
  variables: marshalVariables(ctx)
@@ -64,8 +64,7 @@ const defaultFetch = (url, params) => {
64
64
  };
65
65
  };
66
66
  function handleMultipart(params, args) {
67
- const { clone, files } = extractFiles({
68
- query: params.text,
67
+ const { files } = extractFiles({
69
68
  variables: params.variables
70
69
  });
71
70
  if (files.size) {
@@ -78,8 +77,18 @@ function handleMultipart(params, args) {
78
77
  headers = Object.fromEntries(filtered);
79
78
  }
80
79
  const form = new FormData();
81
- const operationJSON = JSON.stringify(clone);
82
- form.set("operations", operationJSON);
80
+ if (args && args?.body) {
81
+ form.set("operations", args?.body);
82
+ } else {
83
+ form.set(
84
+ "operations",
85
+ JSON.stringify({
86
+ operationName: params.name,
87
+ query: params.text,
88
+ variables: params.variables
89
+ })
90
+ );
91
+ }
83
92
  const map = {};
84
93
  let i = 0;
85
94
  files.forEach((paths) => {
@@ -10,8 +10,8 @@ const fetchParams = (fn = () => ({})) => () => ({
10
10
  stuff: ctx.stuff,
11
11
  document: ctx.artifact,
12
12
  variables: marshalVariables(ctx),
13
- text: ctx.artifact.raw,
14
- hash: ctx.artifact.hash
13
+ text: ctx.text,
14
+ hash: ctx.hash
15
15
  })
16
16
  });
17
17
  }
@@ -3,9 +3,10 @@ export declare function subscription(factory: SubscriptionHandler): import("../d
3
3
  export type SubscriptionHandler = (ctx: ClientPluginContext) => SubscriptionClient;
4
4
  export type SubscriptionClient = {
5
5
  subscribe: (payload: {
6
- operationName: string;
6
+ operationName?: string;
7
7
  query: string;
8
- variables?: {};
8
+ variables?: Record<string, unknown> | null;
9
+ extensions?: Record<'persistedQuery', string> | Record<string, unknown> | null;
9
10
  }, handlers: {
10
11
  next: (payload: {
11
12
  data?: {} | null;
@@ -1,10 +1,10 @@
1
1
  import { deepEquals } from "../../lib/deepEquals";
2
2
  import { ArtifactKind, DataSource } from "../../lib/types";
3
3
  import { documentPlugin } from "../utils";
4
- let check = null;
5
4
  function subscription(factory) {
6
5
  return documentPlugin(ArtifactKind.Subscription, () => {
7
6
  let clearSubscription = null;
7
+ let check = null;
8
8
  return {
9
9
  start(ctx, { resolve, next, initialValue }) {
10
10
  if (typeof globalThis.window === "undefined") {
@@ -32,8 +32,8 @@ function subscription(factory) {
32
32
  clearSubscription?.();
33
33
  clearSubscription = client.subscribe(
34
34
  {
35
- operationName: ctx.artifact.name,
36
- query: ctx.artifact.raw,
35
+ operationName: ctx.name,
36
+ query: ctx.text,
37
37
  variables: marshalVariables(ctx)
38
38
  },
39
39
  {
@@ -92,6 +92,10 @@ export type ConfigFile = {
92
92
  * Configure the dev environment to watch a remote schema for changes
93
93
  */
94
94
  watchSchema?: WatchSchemaConfig;
95
+ /**
96
+ * Specifies the the persisted queries path and file. (default: `./$houdini/persisted_queries.json`)
97
+ */
98
+ persistedQueriesPath?: string;
95
99
  /**
96
100
  * An object describing the plugins enabled for the project
97
101
  */