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.
@@ -64876,11 +64876,10 @@ var InMemorySubscriptions = class {
64876
64876
  constructor(cache) {
64877
64877
  this.cache = cache;
64878
64878
  }
64879
- subscribers = {};
64880
- referenceCounts = {};
64879
+ subscribers = /* @__PURE__ */ new Map();
64881
64880
  keyVersions = {};
64882
64881
  activeFields(parent) {
64883
- return Object.keys(this.subscribers[parent] || {});
64882
+ return Object.keys(this.subscribers.get(parent) || {});
64884
64883
  }
64885
64884
  add({
64886
64885
  parent,
@@ -64954,27 +64953,28 @@ var InMemorySubscriptions = class {
64954
64953
  type
64955
64954
  }) {
64956
64955
  const spec = selection[0];
64957
- if (!this.subscribers[id]) {
64958
- this.subscribers[id] = {};
64959
- }
64960
- if (!this.subscribers[id][key]) {
64961
- this.subscribers[id][key] = [];
64956
+ if (!this.subscribers.has(id)) {
64957
+ this.subscribers.set(id, /* @__PURE__ */ new Map());
64958
+ }
64959
+ const subscriber = this.subscribers.get(id);
64960
+ if (!subscriber.has(key)) {
64961
+ subscriber.set(key, {
64962
+ selections: [],
64963
+ referenceCounts: /* @__PURE__ */ new Map()
64964
+ });
64962
64965
  }
64966
+ const subscriberField = subscriber.get(key);
64963
64967
  if (!this.keyVersions[key]) {
64964
64968
  this.keyVersions[key] = /* @__PURE__ */ new Set();
64965
64969
  }
64966
64970
  this.keyVersions[key].add(key);
64967
- if (!this.subscribers[id][key].map(([{ set }]) => set).includes(spec.set)) {
64968
- this.subscribers[id][key].push([spec, selection[1]]);
64969
- }
64970
- if (!this.referenceCounts[id]) {
64971
- this.referenceCounts[id] = {};
64971
+ if (!subscriberField.selections.some(([{ set }]) => set === spec.set)) {
64972
+ subscriberField.selections.push([spec, selection[1]]);
64972
64973
  }
64973
- if (!this.referenceCounts[id][key]) {
64974
- this.referenceCounts[id][key] = /* @__PURE__ */ new Map();
64975
- }
64976
- const counts = this.referenceCounts[id][key];
64977
- counts.set(spec.set, (counts.get(spec.set) || 0) + 1);
64974
+ subscriberField.referenceCounts.set(
64975
+ spec.set,
64976
+ (subscriberField.referenceCounts.get(spec.set) || 0) + 1
64977
+ );
64978
64978
  this.cache._internal_unstable.lifetimes.resetLifetime(id, key);
64979
64979
  }
64980
64980
  registerList({
@@ -65061,7 +65061,7 @@ var InMemorySubscriptions = class {
65061
65061
  }
65062
65062
  }
65063
65063
  get(id, field) {
65064
- return this.subscribers[id]?.[field] || [];
65064
+ return this.subscribers.get(id)?.get(field)?.selections || [];
65065
65065
  }
65066
65066
  remove(id, selection, targets, variables, visited = []) {
65067
65067
  visited.push(id);
@@ -65087,24 +65087,24 @@ var InMemorySubscriptions = class {
65087
65087
  }
65088
65088
  }
65089
65089
  reset() {
65090
- const subscribers = Object.entries(this.subscribers).filter(
65091
- ([id]) => !id.startsWith(rootID)
65092
- );
65090
+ const subscribers = [...this.subscribers.entries()].filter(([id]) => !id.startsWith(rootID));
65093
65091
  for (const [id, _fields] of subscribers) {
65094
- delete this.subscribers[id];
65092
+ this.subscribers.delete(id);
65095
65093
  }
65096
65094
  const subscriptionSpecs = subscribers.flatMap(
65097
- ([_id, fields]) => Object.values(fields).flatMap((field) => field.map(([spec]) => spec))
65095
+ ([_id, fields]) => [...fields.values()].flatMap((field) => field.selections.map(([spec]) => spec))
65098
65096
  );
65099
65097
  return subscriptionSpecs;
65100
65098
  }
65101
65099
  removeSubscribers(id, fieldName, specs) {
65102
65100
  let targets = [];
65101
+ const subscriber = this.subscribers.get(id);
65102
+ const subscriberField = subscriber?.get(fieldName);
65103
65103
  for (const spec of specs) {
65104
- if (!this.referenceCounts[id]?.[fieldName]?.has(spec.set)) {
65104
+ const counts = subscriber?.get(fieldName)?.referenceCounts;
65105
+ if (!counts?.has(spec.set)) {
65105
65106
  continue;
65106
65107
  }
65107
- const counts = this.referenceCounts[id][fieldName];
65108
65108
  const newVal = (counts.get(spec.set) || 0) - 1;
65109
65109
  counts.set(spec.set, newVal);
65110
65110
  if (newVal <= 0) {
@@ -65112,18 +65112,19 @@ var InMemorySubscriptions = class {
65112
65112
  counts.delete(spec.set);
65113
65113
  }
65114
65114
  }
65115
- if (this.subscribers[id]) {
65116
- this.subscribers[id][fieldName] = this.get(id, fieldName).filter(
65115
+ if (subscriberField) {
65116
+ subscriberField.selections = this.get(id, fieldName).filter(
65117
65117
  ([{ set }]) => !targets.includes(set)
65118
65118
  );
65119
65119
  }
65120
65120
  }
65121
65121
  removeAllSubscribers(id, targets, visited = []) {
65122
65122
  visited.push(id);
65123
- for (const field of Object.keys(this.subscribers[id] || [])) {
65124
- const subscribers = targets || this.subscribers[id][field].map(([spec]) => spec);
65125
- this.removeSubscribers(id, field, subscribers);
65126
- const { value, kind } = this.cache._internal_unstable.storage.get(id, field);
65123
+ const subscriber = this.subscribers.get(id);
65124
+ for (const [key, val] of subscriber?.entries() ?? []) {
65125
+ const subscribers = targets || val.selections.map(([spec]) => spec);
65126
+ this.removeSubscribers(id, key, subscribers);
65127
+ const { value, kind } = this.cache._internal_unstable.storage.get(id, key);
65127
65128
  if (kind === "scalar") {
65128
65129
  continue;
65129
65130
  }
@@ -8,7 +8,6 @@ export declare class InMemorySubscriptions {
8
8
  private cache;
9
9
  constructor(cache: Cache);
10
10
  private subscribers;
11
- private referenceCounts;
12
11
  private keyVersions;
13
12
  activeFields(parent: string): string[];
14
13
  add({ parent, spec, selection, variables, parentType, }: {
@@ -8,7 +8,6 @@ export declare class InMemorySubscriptions {
8
8
  private cache;
9
9
  constructor(cache: Cache);
10
10
  private subscribers;
11
- private referenceCounts;
12
11
  private keyVersions;
13
12
  activeFields(parent: string): string[];
14
13
  add({ parent, spec, selection, variables, parentType, }: {
@@ -30,11 +30,10 @@ class InMemorySubscriptions {
30
30
  constructor(cache) {
31
31
  this.cache = cache;
32
32
  }
33
- subscribers = {};
34
- referenceCounts = {};
33
+ subscribers = /* @__PURE__ */ new Map();
35
34
  keyVersions = {};
36
35
  activeFields(parent) {
37
- return Object.keys(this.subscribers[parent] || {});
36
+ return Object.keys(this.subscribers.get(parent) || {});
38
37
  }
39
38
  add({
40
39
  parent,
@@ -108,27 +107,28 @@ class InMemorySubscriptions {
108
107
  type
109
108
  }) {
110
109
  const spec = selection[0];
111
- if (!this.subscribers[id]) {
112
- this.subscribers[id] = {};
110
+ if (!this.subscribers.has(id)) {
111
+ this.subscribers.set(id, /* @__PURE__ */ new Map());
113
112
  }
114
- if (!this.subscribers[id][key]) {
115
- this.subscribers[id][key] = [];
113
+ const subscriber = this.subscribers.get(id);
114
+ if (!subscriber.has(key)) {
115
+ subscriber.set(key, {
116
+ selections: [],
117
+ referenceCounts: /* @__PURE__ */ new Map()
118
+ });
116
119
  }
120
+ const subscriberField = subscriber.get(key);
117
121
  if (!this.keyVersions[key]) {
118
122
  this.keyVersions[key] = /* @__PURE__ */ new Set();
119
123
  }
120
124
  this.keyVersions[key].add(key);
121
- if (!this.subscribers[id][key].map(([{ set }]) => set).includes(spec.set)) {
122
- this.subscribers[id][key].push([spec, selection[1]]);
123
- }
124
- if (!this.referenceCounts[id]) {
125
- this.referenceCounts[id] = {};
126
- }
127
- if (!this.referenceCounts[id][key]) {
128
- this.referenceCounts[id][key] = /* @__PURE__ */ new Map();
125
+ if (!subscriberField.selections.some(([{ set }]) => set === spec.set)) {
126
+ subscriberField.selections.push([spec, selection[1]]);
129
127
  }
130
- const counts = this.referenceCounts[id][key];
131
- counts.set(spec.set, (counts.get(spec.set) || 0) + 1);
128
+ subscriberField.referenceCounts.set(
129
+ spec.set,
130
+ (subscriberField.referenceCounts.get(spec.set) || 0) + 1
131
+ );
132
132
  this.cache._internal_unstable.lifetimes.resetLifetime(id, key);
133
133
  }
134
134
  registerList({
@@ -215,7 +215,7 @@ class InMemorySubscriptions {
215
215
  }
216
216
  }
217
217
  get(id, field) {
218
- return this.subscribers[id]?.[field] || [];
218
+ return this.subscribers.get(id)?.get(field)?.selections || [];
219
219
  }
220
220
  remove(id, selection, targets, variables, visited = []) {
221
221
  visited.push(id);
@@ -241,24 +241,24 @@ class InMemorySubscriptions {
241
241
  }
242
242
  }
243
243
  reset() {
244
- const subscribers = Object.entries(this.subscribers).filter(
245
- ([id]) => !id.startsWith(import_cache.rootID)
246
- );
244
+ const subscribers = [...this.subscribers.entries()].filter(([id]) => !id.startsWith(import_cache.rootID));
247
245
  for (const [id, _fields] of subscribers) {
248
- delete this.subscribers[id];
246
+ this.subscribers.delete(id);
249
247
  }
250
248
  const subscriptionSpecs = subscribers.flatMap(
251
- ([_id, fields]) => Object.values(fields).flatMap((field) => field.map(([spec]) => spec))
249
+ ([_id, fields]) => [...fields.values()].flatMap((field) => field.selections.map(([spec]) => spec))
252
250
  );
253
251
  return subscriptionSpecs;
254
252
  }
255
253
  removeSubscribers(id, fieldName, specs) {
256
254
  let targets = [];
255
+ const subscriber = this.subscribers.get(id);
256
+ const subscriberField = subscriber?.get(fieldName);
257
257
  for (const spec of specs) {
258
- if (!this.referenceCounts[id]?.[fieldName]?.has(spec.set)) {
258
+ const counts = subscriber?.get(fieldName)?.referenceCounts;
259
+ if (!counts?.has(spec.set)) {
259
260
  continue;
260
261
  }
261
- const counts = this.referenceCounts[id][fieldName];
262
262
  const newVal = (counts.get(spec.set) || 0) - 1;
263
263
  counts.set(spec.set, newVal);
264
264
  if (newVal <= 0) {
@@ -266,18 +266,19 @@ class InMemorySubscriptions {
266
266
  counts.delete(spec.set);
267
267
  }
268
268
  }
269
- if (this.subscribers[id]) {
270
- this.subscribers[id][fieldName] = this.get(id, fieldName).filter(
269
+ if (subscriberField) {
270
+ subscriberField.selections = this.get(id, fieldName).filter(
271
271
  ([{ set }]) => !targets.includes(set)
272
272
  );
273
273
  }
274
274
  }
275
275
  removeAllSubscribers(id, targets, visited = []) {
276
276
  visited.push(id);
277
- for (const field of Object.keys(this.subscribers[id] || [])) {
278
- const subscribers = targets || this.subscribers[id][field].map(([spec]) => spec);
279
- this.removeSubscribers(id, field, subscribers);
280
- const { value, kind } = this.cache._internal_unstable.storage.get(id, field);
277
+ const subscriber = this.subscribers.get(id);
278
+ for (const [key, val] of subscriber?.entries() ?? []) {
279
+ const subscribers = targets || val.selections.map(([spec]) => spec);
280
+ this.removeSubscribers(id, key, subscribers);
281
+ const { value, kind } = this.cache._internal_unstable.storage.get(id, key);
281
282
  if (kind === "scalar") {
282
283
  continue;
283
284
  }
@@ -8,7 +8,6 @@ export declare class InMemorySubscriptions {
8
8
  private cache;
9
9
  constructor(cache: Cache);
10
10
  private subscribers;
11
- private referenceCounts;
12
11
  private keyVersions;
13
12
  activeFields(parent: string): string[];
14
13
  add({ parent, spec, selection, variables, parentType, }: {
@@ -7,11 +7,10 @@ class InMemorySubscriptions {
7
7
  constructor(cache) {
8
8
  this.cache = cache;
9
9
  }
10
- subscribers = {};
11
- referenceCounts = {};
10
+ subscribers = /* @__PURE__ */ new Map();
12
11
  keyVersions = {};
13
12
  activeFields(parent) {
14
- return Object.keys(this.subscribers[parent] || {});
13
+ return Object.keys(this.subscribers.get(parent) || {});
15
14
  }
16
15
  add({
17
16
  parent,
@@ -85,27 +84,28 @@ class InMemorySubscriptions {
85
84
  type
86
85
  }) {
87
86
  const spec = selection[0];
88
- if (!this.subscribers[id]) {
89
- this.subscribers[id] = {};
87
+ if (!this.subscribers.has(id)) {
88
+ this.subscribers.set(id, /* @__PURE__ */ new Map());
90
89
  }
91
- if (!this.subscribers[id][key]) {
92
- this.subscribers[id][key] = [];
90
+ const subscriber = this.subscribers.get(id);
91
+ if (!subscriber.has(key)) {
92
+ subscriber.set(key, {
93
+ selections: [],
94
+ referenceCounts: /* @__PURE__ */ new Map()
95
+ });
93
96
  }
97
+ const subscriberField = subscriber.get(key);
94
98
  if (!this.keyVersions[key]) {
95
99
  this.keyVersions[key] = /* @__PURE__ */ new Set();
96
100
  }
97
101
  this.keyVersions[key].add(key);
98
- if (!this.subscribers[id][key].map(([{ set }]) => set).includes(spec.set)) {
99
- this.subscribers[id][key].push([spec, selection[1]]);
100
- }
101
- if (!this.referenceCounts[id]) {
102
- this.referenceCounts[id] = {};
103
- }
104
- if (!this.referenceCounts[id][key]) {
105
- this.referenceCounts[id][key] = /* @__PURE__ */ new Map();
102
+ if (!subscriberField.selections.some(([{ set }]) => set === spec.set)) {
103
+ subscriberField.selections.push([spec, selection[1]]);
106
104
  }
107
- const counts = this.referenceCounts[id][key];
108
- counts.set(spec.set, (counts.get(spec.set) || 0) + 1);
105
+ subscriberField.referenceCounts.set(
106
+ spec.set,
107
+ (subscriberField.referenceCounts.get(spec.set) || 0) + 1
108
+ );
109
109
  this.cache._internal_unstable.lifetimes.resetLifetime(id, key);
110
110
  }
111
111
  registerList({
@@ -192,7 +192,7 @@ class InMemorySubscriptions {
192
192
  }
193
193
  }
194
194
  get(id, field) {
195
- return this.subscribers[id]?.[field] || [];
195
+ return this.subscribers.get(id)?.get(field)?.selections || [];
196
196
  }
197
197
  remove(id, selection, targets, variables, visited = []) {
198
198
  visited.push(id);
@@ -218,24 +218,24 @@ class InMemorySubscriptions {
218
218
  }
219
219
  }
220
220
  reset() {
221
- const subscribers = Object.entries(this.subscribers).filter(
222
- ([id]) => !id.startsWith(rootID)
223
- );
221
+ const subscribers = [...this.subscribers.entries()].filter(([id]) => !id.startsWith(rootID));
224
222
  for (const [id, _fields] of subscribers) {
225
- delete this.subscribers[id];
223
+ this.subscribers.delete(id);
226
224
  }
227
225
  const subscriptionSpecs = subscribers.flatMap(
228
- ([_id, fields]) => Object.values(fields).flatMap((field) => field.map(([spec]) => spec))
226
+ ([_id, fields]) => [...fields.values()].flatMap((field) => field.selections.map(([spec]) => spec))
229
227
  );
230
228
  return subscriptionSpecs;
231
229
  }
232
230
  removeSubscribers(id, fieldName, specs) {
233
231
  let targets = [];
232
+ const subscriber = this.subscribers.get(id);
233
+ const subscriberField = subscriber?.get(fieldName);
234
234
  for (const spec of specs) {
235
- if (!this.referenceCounts[id]?.[fieldName]?.has(spec.set)) {
235
+ const counts = subscriber?.get(fieldName)?.referenceCounts;
236
+ if (!counts?.has(spec.set)) {
236
237
  continue;
237
238
  }
238
- const counts = this.referenceCounts[id][fieldName];
239
239
  const newVal = (counts.get(spec.set) || 0) - 1;
240
240
  counts.set(spec.set, newVal);
241
241
  if (newVal <= 0) {
@@ -243,18 +243,19 @@ class InMemorySubscriptions {
243
243
  counts.delete(spec.set);
244
244
  }
245
245
  }
246
- if (this.subscribers[id]) {
247
- this.subscribers[id][fieldName] = this.get(id, fieldName).filter(
246
+ if (subscriberField) {
247
+ subscriberField.selections = this.get(id, fieldName).filter(
248
248
  ([{ set }]) => !targets.includes(set)
249
249
  );
250
250
  }
251
251
  }
252
252
  removeAllSubscribers(id, targets, visited = []) {
253
253
  visited.push(id);
254
- for (const field of Object.keys(this.subscribers[id] || [])) {
255
- const subscribers = targets || this.subscribers[id][field].map(([spec]) => spec);
256
- this.removeSubscribers(id, field, subscribers);
257
- const { value, kind } = this.cache._internal_unstable.storage.get(id, field);
254
+ const subscriber = this.subscribers.get(id);
255
+ for (const [key, val] of subscriber?.entries() ?? []) {
256
+ const subscribers = targets || val.selections.map(([spec]) => spec);
257
+ this.removeSubscribers(id, key, subscribers);
258
+ const { value, kind } = this.cache._internal_unstable.storage.get(id, key);
258
259
  if (kind === "scalar") {
259
260
  continue;
260
261
  }
@@ -55872,11 +55872,10 @@ var InMemorySubscriptions = class {
55872
55872
  constructor(cache) {
55873
55873
  this.cache = cache;
55874
55874
  }
55875
- subscribers = {};
55876
- referenceCounts = {};
55875
+ subscribers = /* @__PURE__ */ new Map();
55877
55876
  keyVersions = {};
55878
55877
  activeFields(parent2) {
55879
- return Object.keys(this.subscribers[parent2] || {});
55878
+ return Object.keys(this.subscribers.get(parent2) || {});
55880
55879
  }
55881
55880
  add({
55882
55881
  parent: parent2,
@@ -55950,27 +55949,28 @@ var InMemorySubscriptions = class {
55950
55949
  type
55951
55950
  }) {
55952
55951
  const spec = selection[0];
55953
- if (!this.subscribers[id]) {
55954
- this.subscribers[id] = {};
55955
- }
55956
- if (!this.subscribers[id][key]) {
55957
- this.subscribers[id][key] = [];
55952
+ if (!this.subscribers.has(id)) {
55953
+ this.subscribers.set(id, /* @__PURE__ */ new Map());
55954
+ }
55955
+ const subscriber = this.subscribers.get(id);
55956
+ if (!subscriber.has(key)) {
55957
+ subscriber.set(key, {
55958
+ selections: [],
55959
+ referenceCounts: /* @__PURE__ */ new Map()
55960
+ });
55958
55961
  }
55962
+ const subscriberField = subscriber.get(key);
55959
55963
  if (!this.keyVersions[key]) {
55960
55964
  this.keyVersions[key] = /* @__PURE__ */ new Set();
55961
55965
  }
55962
55966
  this.keyVersions[key].add(key);
55963
- if (!this.subscribers[id][key].map(([{ set }]) => set).includes(spec.set)) {
55964
- this.subscribers[id][key].push([spec, selection[1]]);
55965
- }
55966
- if (!this.referenceCounts[id]) {
55967
- this.referenceCounts[id] = {};
55967
+ if (!subscriberField.selections.some(([{ set }]) => set === spec.set)) {
55968
+ subscriberField.selections.push([spec, selection[1]]);
55968
55969
  }
55969
- if (!this.referenceCounts[id][key]) {
55970
- this.referenceCounts[id][key] = /* @__PURE__ */ new Map();
55971
- }
55972
- const counts = this.referenceCounts[id][key];
55973
- counts.set(spec.set, (counts.get(spec.set) || 0) + 1);
55970
+ subscriberField.referenceCounts.set(
55971
+ spec.set,
55972
+ (subscriberField.referenceCounts.get(spec.set) || 0) + 1
55973
+ );
55974
55974
  this.cache._internal_unstable.lifetimes.resetLifetime(id, key);
55975
55975
  }
55976
55976
  registerList({
@@ -56057,7 +56057,7 @@ var InMemorySubscriptions = class {
56057
56057
  }
56058
56058
  }
56059
56059
  get(id, field) {
56060
- return this.subscribers[id]?.[field] || [];
56060
+ return this.subscribers.get(id)?.get(field)?.selections || [];
56061
56061
  }
56062
56062
  remove(id, selection, targets, variables, visited = []) {
56063
56063
  visited.push(id);
@@ -56083,24 +56083,24 @@ var InMemorySubscriptions = class {
56083
56083
  }
56084
56084
  }
56085
56085
  reset() {
56086
- const subscribers = Object.entries(this.subscribers).filter(
56087
- ([id]) => !id.startsWith(rootID)
56088
- );
56086
+ const subscribers = [...this.subscribers.entries()].filter(([id]) => !id.startsWith(rootID));
56089
56087
  for (const [id, _fields] of subscribers) {
56090
- delete this.subscribers[id];
56088
+ this.subscribers.delete(id);
56091
56089
  }
56092
56090
  const subscriptionSpecs = subscribers.flatMap(
56093
- ([_id, fields]) => Object.values(fields).flatMap((field) => field.map(([spec]) => spec))
56091
+ ([_id, fields]) => [...fields.values()].flatMap((field) => field.selections.map(([spec]) => spec))
56094
56092
  );
56095
56093
  return subscriptionSpecs;
56096
56094
  }
56097
56095
  removeSubscribers(id, fieldName, specs) {
56098
56096
  let targets = [];
56097
+ const subscriber = this.subscribers.get(id);
56098
+ const subscriberField = subscriber?.get(fieldName);
56099
56099
  for (const spec of specs) {
56100
- if (!this.referenceCounts[id]?.[fieldName]?.has(spec.set)) {
56100
+ const counts = subscriber?.get(fieldName)?.referenceCounts;
56101
+ if (!counts?.has(spec.set)) {
56101
56102
  continue;
56102
56103
  }
56103
- const counts = this.referenceCounts[id][fieldName];
56104
56104
  const newVal = (counts.get(spec.set) || 0) - 1;
56105
56105
  counts.set(spec.set, newVal);
56106
56106
  if (newVal <= 0) {
@@ -56108,18 +56108,19 @@ var InMemorySubscriptions = class {
56108
56108
  counts.delete(spec.set);
56109
56109
  }
56110
56110
  }
56111
- if (this.subscribers[id]) {
56112
- this.subscribers[id][fieldName] = this.get(id, fieldName).filter(
56111
+ if (subscriberField) {
56112
+ subscriberField.selections = this.get(id, fieldName).filter(
56113
56113
  ([{ set }]) => !targets.includes(set)
56114
56114
  );
56115
56115
  }
56116
56116
  }
56117
56117
  removeAllSubscribers(id, targets, visited = []) {
56118
56118
  visited.push(id);
56119
- for (const field of Object.keys(this.subscribers[id] || [])) {
56120
- const subscribers = targets || this.subscribers[id][field].map(([spec]) => spec);
56121
- this.removeSubscribers(id, field, subscribers);
56122
- const { value, kind } = this.cache._internal_unstable.storage.get(id, field);
56119
+ const subscriber = this.subscribers.get(id);
56120
+ for (const [key, val] of subscriber?.entries() ?? []) {
56121
+ const subscribers = targets || val.selections.map(([spec]) => spec);
56122
+ this.removeSubscribers(id, key, subscribers);
56123
+ const { value, kind } = this.cache._internal_unstable.storage.get(id, key);
56123
56124
  if (kind === "scalar") {
56124
56125
  continue;
56125
56126
  }
@@ -55869,11 +55869,10 @@ var InMemorySubscriptions = class {
55869
55869
  constructor(cache) {
55870
55870
  this.cache = cache;
55871
55871
  }
55872
- subscribers = {};
55873
- referenceCounts = {};
55872
+ subscribers = /* @__PURE__ */ new Map();
55874
55873
  keyVersions = {};
55875
55874
  activeFields(parent2) {
55876
- return Object.keys(this.subscribers[parent2] || {});
55875
+ return Object.keys(this.subscribers.get(parent2) || {});
55877
55876
  }
55878
55877
  add({
55879
55878
  parent: parent2,
@@ -55947,27 +55946,28 @@ var InMemorySubscriptions = class {
55947
55946
  type
55948
55947
  }) {
55949
55948
  const spec = selection[0];
55950
- if (!this.subscribers[id]) {
55951
- this.subscribers[id] = {};
55952
- }
55953
- if (!this.subscribers[id][key]) {
55954
- this.subscribers[id][key] = [];
55949
+ if (!this.subscribers.has(id)) {
55950
+ this.subscribers.set(id, /* @__PURE__ */ new Map());
55951
+ }
55952
+ const subscriber = this.subscribers.get(id);
55953
+ if (!subscriber.has(key)) {
55954
+ subscriber.set(key, {
55955
+ selections: [],
55956
+ referenceCounts: /* @__PURE__ */ new Map()
55957
+ });
55955
55958
  }
55959
+ const subscriberField = subscriber.get(key);
55956
55960
  if (!this.keyVersions[key]) {
55957
55961
  this.keyVersions[key] = /* @__PURE__ */ new Set();
55958
55962
  }
55959
55963
  this.keyVersions[key].add(key);
55960
- if (!this.subscribers[id][key].map(([{ set }]) => set).includes(spec.set)) {
55961
- this.subscribers[id][key].push([spec, selection[1]]);
55962
- }
55963
- if (!this.referenceCounts[id]) {
55964
- this.referenceCounts[id] = {};
55964
+ if (!subscriberField.selections.some(([{ set }]) => set === spec.set)) {
55965
+ subscriberField.selections.push([spec, selection[1]]);
55965
55966
  }
55966
- if (!this.referenceCounts[id][key]) {
55967
- this.referenceCounts[id][key] = /* @__PURE__ */ new Map();
55968
- }
55969
- const counts = this.referenceCounts[id][key];
55970
- counts.set(spec.set, (counts.get(spec.set) || 0) + 1);
55967
+ subscriberField.referenceCounts.set(
55968
+ spec.set,
55969
+ (subscriberField.referenceCounts.get(spec.set) || 0) + 1
55970
+ );
55971
55971
  this.cache._internal_unstable.lifetimes.resetLifetime(id, key);
55972
55972
  }
55973
55973
  registerList({
@@ -56054,7 +56054,7 @@ var InMemorySubscriptions = class {
56054
56054
  }
56055
56055
  }
56056
56056
  get(id, field) {
56057
- return this.subscribers[id]?.[field] || [];
56057
+ return this.subscribers.get(id)?.get(field)?.selections || [];
56058
56058
  }
56059
56059
  remove(id, selection, targets, variables, visited = []) {
56060
56060
  visited.push(id);
@@ -56080,24 +56080,24 @@ var InMemorySubscriptions = class {
56080
56080
  }
56081
56081
  }
56082
56082
  reset() {
56083
- const subscribers = Object.entries(this.subscribers).filter(
56084
- ([id]) => !id.startsWith(rootID)
56085
- );
56083
+ const subscribers = [...this.subscribers.entries()].filter(([id]) => !id.startsWith(rootID));
56086
56084
  for (const [id, _fields] of subscribers) {
56087
- delete this.subscribers[id];
56085
+ this.subscribers.delete(id);
56088
56086
  }
56089
56087
  const subscriptionSpecs = subscribers.flatMap(
56090
- ([_id, fields]) => Object.values(fields).flatMap((field) => field.map(([spec]) => spec))
56088
+ ([_id, fields]) => [...fields.values()].flatMap((field) => field.selections.map(([spec]) => spec))
56091
56089
  );
56092
56090
  return subscriptionSpecs;
56093
56091
  }
56094
56092
  removeSubscribers(id, fieldName, specs) {
56095
56093
  let targets = [];
56094
+ const subscriber = this.subscribers.get(id);
56095
+ const subscriberField = subscriber?.get(fieldName);
56096
56096
  for (const spec of specs) {
56097
- if (!this.referenceCounts[id]?.[fieldName]?.has(spec.set)) {
56097
+ const counts = subscriber?.get(fieldName)?.referenceCounts;
56098
+ if (!counts?.has(spec.set)) {
56098
56099
  continue;
56099
56100
  }
56100
- const counts = this.referenceCounts[id][fieldName];
56101
56101
  const newVal = (counts.get(spec.set) || 0) - 1;
56102
56102
  counts.set(spec.set, newVal);
56103
56103
  if (newVal <= 0) {
@@ -56105,18 +56105,19 @@ var InMemorySubscriptions = class {
56105
56105
  counts.delete(spec.set);
56106
56106
  }
56107
56107
  }
56108
- if (this.subscribers[id]) {
56109
- this.subscribers[id][fieldName] = this.get(id, fieldName).filter(
56108
+ if (subscriberField) {
56109
+ subscriberField.selections = this.get(id, fieldName).filter(
56110
56110
  ([{ set }]) => !targets.includes(set)
56111
56111
  );
56112
56112
  }
56113
56113
  }
56114
56114
  removeAllSubscribers(id, targets, visited = []) {
56115
56115
  visited.push(id);
56116
- for (const field of Object.keys(this.subscribers[id] || [])) {
56117
- const subscribers = targets || this.subscribers[id][field].map(([spec]) => spec);
56118
- this.removeSubscribers(id, field, subscribers);
56119
- const { value, kind } = this.cache._internal_unstable.storage.get(id, field);
56116
+ const subscriber = this.subscribers.get(id);
56117
+ for (const [key, val] of subscriber?.entries() ?? []) {
56118
+ const subscribers = targets || val.selections.map(([spec]) => spec);
56119
+ this.removeSubscribers(id, key, subscribers);
56120
+ const { value, kind } = this.cache._internal_unstable.storage.get(id, key);
56120
56121
  if (kind === "scalar") {
56121
56122
  continue;
56122
56123
  }