houdini 1.2.35 → 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.
@@ -67628,11 +67628,10 @@ var InMemorySubscriptions = class {
67628
67628
  constructor(cache) {
67629
67629
  this.cache = cache;
67630
67630
  }
67631
- subscribers = {};
67632
- referenceCounts = {};
67631
+ subscribers = /* @__PURE__ */ new Map();
67633
67632
  keyVersions = {};
67634
67633
  activeFields(parent2) {
67635
- return Object.keys(this.subscribers[parent2] || {});
67634
+ return Object.keys(this.subscribers.get(parent2) || {});
67636
67635
  }
67637
67636
  add({
67638
67637
  parent: parent2,
@@ -67706,27 +67705,28 @@ var InMemorySubscriptions = class {
67706
67705
  type
67707
67706
  }) {
67708
67707
  const spec = selection[0];
67709
- if (!this.subscribers[id]) {
67710
- this.subscribers[id] = {};
67711
- }
67712
- if (!this.subscribers[id][key]) {
67713
- this.subscribers[id][key] = [];
67708
+ if (!this.subscribers.has(id)) {
67709
+ this.subscribers.set(id, /* @__PURE__ */ new Map());
67710
+ }
67711
+ const subscriber = this.subscribers.get(id);
67712
+ if (!subscriber.has(key)) {
67713
+ subscriber.set(key, {
67714
+ selections: [],
67715
+ referenceCounts: /* @__PURE__ */ new Map()
67716
+ });
67714
67717
  }
67718
+ const subscriberField = subscriber.get(key);
67715
67719
  if (!this.keyVersions[key]) {
67716
67720
  this.keyVersions[key] = /* @__PURE__ */ new Set();
67717
67721
  }
67718
67722
  this.keyVersions[key].add(key);
67719
- if (!this.subscribers[id][key].map(([{ set }]) => set).includes(spec.set)) {
67720
- this.subscribers[id][key].push([spec, selection[1]]);
67721
- }
67722
- if (!this.referenceCounts[id]) {
67723
- this.referenceCounts[id] = {};
67723
+ if (!subscriberField.selections.some(([{ set }]) => set === spec.set)) {
67724
+ subscriberField.selections.push([spec, selection[1]]);
67724
67725
  }
67725
- if (!this.referenceCounts[id][key]) {
67726
- this.referenceCounts[id][key] = /* @__PURE__ */ new Map();
67727
- }
67728
- const counts = this.referenceCounts[id][key];
67729
- counts.set(spec.set, (counts.get(spec.set) || 0) + 1);
67726
+ subscriberField.referenceCounts.set(
67727
+ spec.set,
67728
+ (subscriberField.referenceCounts.get(spec.set) || 0) + 1
67729
+ );
67730
67730
  this.cache._internal_unstable.lifetimes.resetLifetime(id, key);
67731
67731
  }
67732
67732
  registerList({
@@ -67813,7 +67813,7 @@ var InMemorySubscriptions = class {
67813
67813
  }
67814
67814
  }
67815
67815
  get(id, field) {
67816
- return this.subscribers[id]?.[field] || [];
67816
+ return this.subscribers.get(id)?.get(field)?.selections || [];
67817
67817
  }
67818
67818
  remove(id, selection, targets, variables, visited = []) {
67819
67819
  visited.push(id);
@@ -67839,24 +67839,24 @@ var InMemorySubscriptions = class {
67839
67839
  }
67840
67840
  }
67841
67841
  reset() {
67842
- const subscribers = Object.entries(this.subscribers).filter(
67843
- ([id]) => !id.startsWith(rootID)
67844
- );
67842
+ const subscribers = [...this.subscribers.entries()].filter(([id]) => !id.startsWith(rootID));
67845
67843
  for (const [id, _fields] of subscribers) {
67846
- delete this.subscribers[id];
67844
+ this.subscribers.delete(id);
67847
67845
  }
67848
67846
  const subscriptionSpecs = subscribers.flatMap(
67849
- ([_id, fields]) => Object.values(fields).flatMap((field) => field.map(([spec]) => spec))
67847
+ ([_id, fields]) => [...fields.values()].flatMap((field) => field.selections.map(([spec]) => spec))
67850
67848
  );
67851
67849
  return subscriptionSpecs;
67852
67850
  }
67853
67851
  removeSubscribers(id, fieldName, specs) {
67854
67852
  let targets = [];
67853
+ const subscriber = this.subscribers.get(id);
67854
+ const subscriberField = subscriber?.get(fieldName);
67855
67855
  for (const spec of specs) {
67856
- if (!this.referenceCounts[id]?.[fieldName]?.has(spec.set)) {
67856
+ const counts = subscriber?.get(fieldName)?.referenceCounts;
67857
+ if (!counts?.has(spec.set)) {
67857
67858
  continue;
67858
67859
  }
67859
- const counts = this.referenceCounts[id][fieldName];
67860
67860
  const newVal = (counts.get(spec.set) || 0) - 1;
67861
67861
  counts.set(spec.set, newVal);
67862
67862
  if (newVal <= 0) {
@@ -67864,18 +67864,19 @@ var InMemorySubscriptions = class {
67864
67864
  counts.delete(spec.set);
67865
67865
  }
67866
67866
  }
67867
- if (this.subscribers[id]) {
67868
- this.subscribers[id][fieldName] = this.get(id, fieldName).filter(
67867
+ if (subscriberField) {
67868
+ subscriberField.selections = this.get(id, fieldName).filter(
67869
67869
  ([{ set }]) => !targets.includes(set)
67870
67870
  );
67871
67871
  }
67872
67872
  }
67873
67873
  removeAllSubscribers(id, targets, visited = []) {
67874
67874
  visited.push(id);
67875
- for (const field of Object.keys(this.subscribers[id] || [])) {
67876
- const subscribers = targets || this.subscribers[id][field].map(([spec]) => spec);
67877
- this.removeSubscribers(id, field, subscribers);
67878
- const { value, kind } = this.cache._internal_unstable.storage.get(id, field);
67875
+ const subscriber = this.subscribers.get(id);
67876
+ for (const [key, val] of subscriber?.entries() ?? []) {
67877
+ const subscribers = targets || val.selections.map(([spec]) => spec);
67878
+ this.removeSubscribers(id, key, subscribers);
67879
+ const { value, kind } = this.cache._internal_unstable.storage.get(id, key);
67879
67880
  if (kind === "scalar") {
67880
67881
  continue;
67881
67882
  }
@@ -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
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "houdini",
3
- "version": "1.2.35",
3
+ "version": "1.2.36",
4
4
  "description": "The disappearing GraphQL clients",
5
5
  "keywords": [
6
6
  "typescript",