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.
- package/build/cmd-cjs/index.js +35 -34
- package/build/cmd-esm/index.js +35 -34
- package/build/codegen-cjs/index.js +33 -32
- package/build/codegen-esm/index.js +33 -32
- package/build/lib-cjs/index.js +33 -32
- package/build/lib-esm/index.js +33 -32
- package/build/runtime/cache/subscription.d.ts +0 -1
- package/build/runtime-cjs/cache/subscription.d.ts +0 -1
- package/build/runtime-cjs/cache/subscription.js +32 -31
- package/build/runtime-esm/cache/subscription.d.ts +0 -1
- package/build/runtime-esm/cache/subscription.js +32 -31
- package/build/test-cjs/index.js +33 -32
- package/build/test-esm/index.js +33 -32
- package/build/vite-cjs/index.js +33 -32
- package/build/vite-esm/index.js +33 -32
- package/package.json +1 -1
package/build/lib-esm/index.js
CHANGED
|
@@ -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
|
|
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
|
|
64958
|
-
this.subscribers
|
|
64959
|
-
}
|
|
64960
|
-
|
|
64961
|
-
|
|
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 (!
|
|
64968
|
-
|
|
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
|
-
|
|
64974
|
-
|
|
64975
|
-
|
|
64976
|
-
|
|
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
|
|
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 =
|
|
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
|
-
|
|
65092
|
+
this.subscribers.delete(id);
|
|
65095
65093
|
}
|
|
65096
65094
|
const subscriptionSpecs = subscribers.flatMap(
|
|
65097
|
-
([_id, fields]) =>
|
|
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
|
-
|
|
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 (
|
|
65116
|
-
|
|
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
|
-
|
|
65124
|
-
|
|
65125
|
-
|
|
65126
|
-
|
|
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
|
|
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
|
|
112
|
-
this.subscribers
|
|
110
|
+
if (!this.subscribers.has(id)) {
|
|
111
|
+
this.subscribers.set(id, /* @__PURE__ */ new Map());
|
|
113
112
|
}
|
|
114
|
-
|
|
115
|
-
|
|
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 (!
|
|
122
|
-
|
|
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
|
-
|
|
131
|
-
|
|
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
|
|
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 =
|
|
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
|
-
|
|
246
|
+
this.subscribers.delete(id);
|
|
249
247
|
}
|
|
250
248
|
const subscriptionSpecs = subscribers.flatMap(
|
|
251
|
-
([_id, fields]) =>
|
|
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
|
-
|
|
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 (
|
|
270
|
-
|
|
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
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
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
|
|
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
|
|
89
|
-
this.subscribers
|
|
87
|
+
if (!this.subscribers.has(id)) {
|
|
88
|
+
this.subscribers.set(id, /* @__PURE__ */ new Map());
|
|
90
89
|
}
|
|
91
|
-
|
|
92
|
-
|
|
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 (!
|
|
99
|
-
|
|
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
|
-
|
|
108
|
-
|
|
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
|
|
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 =
|
|
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
|
-
|
|
223
|
+
this.subscribers.delete(id);
|
|
226
224
|
}
|
|
227
225
|
const subscriptionSpecs = subscribers.flatMap(
|
|
228
|
-
([_id, fields]) =>
|
|
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
|
-
|
|
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 (
|
|
247
|
-
|
|
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
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
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
|
}
|
package/build/test-cjs/index.js
CHANGED
|
@@ -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
|
|
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
|
|
55954
|
-
this.subscribers
|
|
55955
|
-
}
|
|
55956
|
-
|
|
55957
|
-
|
|
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 (!
|
|
55964
|
-
|
|
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
|
-
|
|
55970
|
-
|
|
55971
|
-
|
|
55972
|
-
|
|
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
|
|
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 =
|
|
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
|
-
|
|
56088
|
+
this.subscribers.delete(id);
|
|
56091
56089
|
}
|
|
56092
56090
|
const subscriptionSpecs = subscribers.flatMap(
|
|
56093
|
-
([_id, fields]) =>
|
|
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
|
-
|
|
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 (
|
|
56112
|
-
|
|
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
|
-
|
|
56120
|
-
|
|
56121
|
-
|
|
56122
|
-
|
|
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
|
}
|
package/build/test-esm/index.js
CHANGED
|
@@ -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
|
|
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
|
|
55951
|
-
this.subscribers
|
|
55952
|
-
}
|
|
55953
|
-
|
|
55954
|
-
|
|
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 (!
|
|
55961
|
-
|
|
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
|
-
|
|
55967
|
-
|
|
55968
|
-
|
|
55969
|
-
|
|
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
|
|
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 =
|
|
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
|
-
|
|
56085
|
+
this.subscribers.delete(id);
|
|
56088
56086
|
}
|
|
56089
56087
|
const subscriptionSpecs = subscribers.flatMap(
|
|
56090
|
-
([_id, fields]) =>
|
|
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
|
-
|
|
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 (
|
|
56109
|
-
|
|
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
|
-
|
|
56117
|
-
|
|
56118
|
-
|
|
56119
|
-
|
|
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
|
}
|