houdini 1.2.34 → 1.2.36

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.
@@ -67622,11 +67622,10 @@ var InMemorySubscriptions = class {
67622
67622
  constructor(cache) {
67623
67623
  this.cache = cache;
67624
67624
  }
67625
- subscribers = {};
67626
- referenceCounts = {};
67625
+ subscribers = /* @__PURE__ */ new Map();
67627
67626
  keyVersions = {};
67628
67627
  activeFields(parent2) {
67629
- return Object.keys(this.subscribers[parent2] || {});
67628
+ return Object.keys(this.subscribers.get(parent2) || {});
67630
67629
  }
67631
67630
  add({
67632
67631
  parent: parent2,
@@ -67700,27 +67699,28 @@ var InMemorySubscriptions = class {
67700
67699
  type
67701
67700
  }) {
67702
67701
  const spec = selection[0];
67703
- if (!this.subscribers[id]) {
67704
- this.subscribers[id] = {};
67705
- }
67706
- if (!this.subscribers[id][key]) {
67707
- this.subscribers[id][key] = [];
67702
+ if (!this.subscribers.has(id)) {
67703
+ this.subscribers.set(id, /* @__PURE__ */ new Map());
67704
+ }
67705
+ const subscriber = this.subscribers.get(id);
67706
+ if (!subscriber.has(key)) {
67707
+ subscriber.set(key, {
67708
+ selections: [],
67709
+ referenceCounts: /* @__PURE__ */ new Map()
67710
+ });
67708
67711
  }
67712
+ const subscriberField = subscriber.get(key);
67709
67713
  if (!this.keyVersions[key]) {
67710
67714
  this.keyVersions[key] = /* @__PURE__ */ new Set();
67711
67715
  }
67712
67716
  this.keyVersions[key].add(key);
67713
- if (!this.subscribers[id][key].map(([{ set }]) => set).includes(spec.set)) {
67714
- this.subscribers[id][key].push([spec, selection[1]]);
67715
- }
67716
- if (!this.referenceCounts[id]) {
67717
- this.referenceCounts[id] = {};
67717
+ if (!subscriberField.selections.some(([{ set }]) => set === spec.set)) {
67718
+ subscriberField.selections.push([spec, selection[1]]);
67718
67719
  }
67719
- if (!this.referenceCounts[id][key]) {
67720
- this.referenceCounts[id][key] = /* @__PURE__ */ new Map();
67721
- }
67722
- const counts = this.referenceCounts[id][key];
67723
- counts.set(spec.set, (counts.get(spec.set) || 0) + 1);
67720
+ subscriberField.referenceCounts.set(
67721
+ spec.set,
67722
+ (subscriberField.referenceCounts.get(spec.set) || 0) + 1
67723
+ );
67724
67724
  this.cache._internal_unstable.lifetimes.resetLifetime(id, key);
67725
67725
  }
67726
67726
  registerList({
@@ -67807,7 +67807,7 @@ var InMemorySubscriptions = class {
67807
67807
  }
67808
67808
  }
67809
67809
  get(id, field) {
67810
- return this.subscribers[id]?.[field] || [];
67810
+ return this.subscribers.get(id)?.get(field)?.selections || [];
67811
67811
  }
67812
67812
  remove(id, selection, targets, variables, visited = []) {
67813
67813
  visited.push(id);
@@ -67833,24 +67833,24 @@ var InMemorySubscriptions = class {
67833
67833
  }
67834
67834
  }
67835
67835
  reset() {
67836
- const subscribers = Object.entries(this.subscribers).filter(
67837
- ([id]) => !id.startsWith(rootID)
67838
- );
67836
+ const subscribers = [...this.subscribers.entries()].filter(([id]) => !id.startsWith(rootID));
67839
67837
  for (const [id, _fields] of subscribers) {
67840
- delete this.subscribers[id];
67838
+ this.subscribers.delete(id);
67841
67839
  }
67842
67840
  const subscriptionSpecs = subscribers.flatMap(
67843
- ([_id, fields]) => Object.values(fields).flatMap((field) => field.map(([spec]) => spec))
67841
+ ([_id, fields]) => [...fields.values()].flatMap((field) => field.selections.map(([spec]) => spec))
67844
67842
  );
67845
67843
  return subscriptionSpecs;
67846
67844
  }
67847
67845
  removeSubscribers(id, fieldName, specs) {
67848
67846
  let targets = [];
67847
+ const subscriber = this.subscribers.get(id);
67848
+ const subscriberField = subscriber?.get(fieldName);
67849
67849
  for (const spec of specs) {
67850
- if (!this.referenceCounts[id]?.[fieldName]?.has(spec.set)) {
67850
+ const counts = subscriber?.get(fieldName)?.referenceCounts;
67851
+ if (!counts?.has(spec.set)) {
67851
67852
  continue;
67852
67853
  }
67853
- const counts = this.referenceCounts[id][fieldName];
67854
67854
  const newVal = (counts.get(spec.set) || 0) - 1;
67855
67855
  counts.set(spec.set, newVal);
67856
67856
  if (newVal <= 0) {
@@ -67858,18 +67858,19 @@ var InMemorySubscriptions = class {
67858
67858
  counts.delete(spec.set);
67859
67859
  }
67860
67860
  }
67861
- if (this.subscribers[id]) {
67862
- this.subscribers[id][fieldName] = this.get(id, fieldName).filter(
67861
+ if (subscriberField) {
67862
+ subscriberField.selections = this.get(id, fieldName).filter(
67863
67863
  ([{ set }]) => !targets.includes(set)
67864
67864
  );
67865
67865
  }
67866
67866
  }
67867
67867
  removeAllSubscribers(id, targets, visited = []) {
67868
67868
  visited.push(id);
67869
- for (const field of Object.keys(this.subscribers[id] || [])) {
67870
- const subscribers = targets || this.subscribers[id][field].map(([spec]) => spec);
67871
- this.removeSubscribers(id, field, subscribers);
67872
- const { value, kind } = this.cache._internal_unstable.storage.get(id, field);
67869
+ const subscriber = this.subscribers.get(id);
67870
+ for (const [key, val] of subscriber?.entries() ?? []) {
67871
+ const subscribers = targets || val.selections.map(([spec]) => spec);
67872
+ this.removeSubscribers(id, key, subscribers);
67873
+ const { value, kind } = this.cache._internal_unstable.storage.get(id, key);
67873
67874
  if (kind === "scalar") {
67874
67875
  continue;
67875
67876
  }
@@ -70952,7 +70953,7 @@ var FieldCollection = class {
70952
70953
  return Object.keys(this.fields).length + Object.keys(this.inlineFragments).length + Object.keys(this.fragmentSpreads).length;
70953
70954
  }
70954
70955
  add({ selection, external }) {
70955
- let include = this.config.defaultFragmentMasking === "disable";
70956
+ let include = this.applyFragments || this.config.defaultFragmentMasking === "disable";
70956
70957
  const maskEnableDirective = selection.directives?.find(
70957
70958
  ({ name }) => name.value === this.config.maskEnableDirective
70958
70959
  );
@@ -73286,7 +73287,12 @@ function prepareSelection({
73286
73287
  object.fragments = {
73287
73288
  ...object.fragments,
73288
73289
  [fragment2]: {
73289
- arguments: args ?? {}
73290
+ arguments: args && Object.keys(args ?? {}).length > 0 ? args : Object.fromEntries(
73291
+ withArguments(config2, field).map((arg) => [
73292
+ arg.name.value,
73293
+ arg.value
73294
+ ])
73295
+ )
73290
73296
  }
73291
73297
  };
73292
73298
  if (globalLoading || field.directives?.find((d) => d.name.value === config2.loadingDirective)) {
@@ -73613,7 +73619,7 @@ function artifactGenerator(stats) {
73613
73619
  document: doc,
73614
73620
  rootType,
73615
73621
  globalLoading,
73616
- includeFragments: doc.kind !== ArtifactKind.Fragment,
73622
+ includeFragments: true,
73617
73623
  hasComponents: () => {
73618
73624
  hasComponents = true;
73619
73625
  },
@@ -73622,7 +73628,7 @@ function artifactGenerator(stats) {
73622
73628
  filepath: doc.filename,
73623
73629
  selections: selectionSet.selections,
73624
73630
  fragmentDefinitions,
73625
- applyFragments: doc.kind !== ArtifactKind.Fragment
73631
+ applyFragments: true
73626
73632
  }),
73627
73633
  operations: operationsByPath(
73628
73634
  config2,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "houdini",
3
- "version": "1.2.34",
3
+ "version": "1.2.36",
4
4
  "description": "The disappearing GraphQL clients",
5
5
  "keywords": [
6
6
  "typescript",