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/cmd-cjs/index.js
CHANGED
|
@@ -66488,11 +66488,10 @@ var InMemorySubscriptions = class {
|
|
|
66488
66488
|
constructor(cache) {
|
|
66489
66489
|
this.cache = cache;
|
|
66490
66490
|
}
|
|
66491
|
-
subscribers =
|
|
66492
|
-
referenceCounts = {};
|
|
66491
|
+
subscribers = /* @__PURE__ */ new Map();
|
|
66493
66492
|
keyVersions = {};
|
|
66494
66493
|
activeFields(parent2) {
|
|
66495
|
-
return Object.keys(this.subscribers
|
|
66494
|
+
return Object.keys(this.subscribers.get(parent2) || {});
|
|
66496
66495
|
}
|
|
66497
66496
|
add({
|
|
66498
66497
|
parent: parent2,
|
|
@@ -66566,27 +66565,28 @@ var InMemorySubscriptions = class {
|
|
|
66566
66565
|
type
|
|
66567
66566
|
}) {
|
|
66568
66567
|
const spec = selection[0];
|
|
66569
|
-
if (!this.subscribers
|
|
66570
|
-
this.subscribers
|
|
66571
|
-
}
|
|
66572
|
-
|
|
66573
|
-
|
|
66568
|
+
if (!this.subscribers.has(id)) {
|
|
66569
|
+
this.subscribers.set(id, /* @__PURE__ */ new Map());
|
|
66570
|
+
}
|
|
66571
|
+
const subscriber = this.subscribers.get(id);
|
|
66572
|
+
if (!subscriber.has(key)) {
|
|
66573
|
+
subscriber.set(key, {
|
|
66574
|
+
selections: [],
|
|
66575
|
+
referenceCounts: /* @__PURE__ */ new Map()
|
|
66576
|
+
});
|
|
66574
66577
|
}
|
|
66578
|
+
const subscriberField = subscriber.get(key);
|
|
66575
66579
|
if (!this.keyVersions[key]) {
|
|
66576
66580
|
this.keyVersions[key] = /* @__PURE__ */ new Set();
|
|
66577
66581
|
}
|
|
66578
66582
|
this.keyVersions[key].add(key);
|
|
66579
|
-
if (!
|
|
66580
|
-
|
|
66581
|
-
}
|
|
66582
|
-
if (!this.referenceCounts[id]) {
|
|
66583
|
-
this.referenceCounts[id] = {};
|
|
66583
|
+
if (!subscriberField.selections.some(([{ set }]) => set === spec.set)) {
|
|
66584
|
+
subscriberField.selections.push([spec, selection[1]]);
|
|
66584
66585
|
}
|
|
66585
|
-
|
|
66586
|
-
|
|
66587
|
-
|
|
66588
|
-
|
|
66589
|
-
counts.set(spec.set, (counts.get(spec.set) || 0) + 1);
|
|
66586
|
+
subscriberField.referenceCounts.set(
|
|
66587
|
+
spec.set,
|
|
66588
|
+
(subscriberField.referenceCounts.get(spec.set) || 0) + 1
|
|
66589
|
+
);
|
|
66590
66590
|
this.cache._internal_unstable.lifetimes.resetLifetime(id, key);
|
|
66591
66591
|
}
|
|
66592
66592
|
registerList({
|
|
@@ -66673,7 +66673,7 @@ var InMemorySubscriptions = class {
|
|
|
66673
66673
|
}
|
|
66674
66674
|
}
|
|
66675
66675
|
get(id, field) {
|
|
66676
|
-
return this.subscribers
|
|
66676
|
+
return this.subscribers.get(id)?.get(field)?.selections || [];
|
|
66677
66677
|
}
|
|
66678
66678
|
remove(id, selection, targets, variables, visited = []) {
|
|
66679
66679
|
visited.push(id);
|
|
@@ -66699,24 +66699,24 @@ var InMemorySubscriptions = class {
|
|
|
66699
66699
|
}
|
|
66700
66700
|
}
|
|
66701
66701
|
reset() {
|
|
66702
|
-
const subscribers =
|
|
66703
|
-
([id]) => !id.startsWith(rootID)
|
|
66704
|
-
);
|
|
66702
|
+
const subscribers = [...this.subscribers.entries()].filter(([id]) => !id.startsWith(rootID));
|
|
66705
66703
|
for (const [id, _fields] of subscribers) {
|
|
66706
|
-
|
|
66704
|
+
this.subscribers.delete(id);
|
|
66707
66705
|
}
|
|
66708
66706
|
const subscriptionSpecs = subscribers.flatMap(
|
|
66709
|
-
([_id, fields]) =>
|
|
66707
|
+
([_id, fields]) => [...fields.values()].flatMap((field) => field.selections.map(([spec]) => spec))
|
|
66710
66708
|
);
|
|
66711
66709
|
return subscriptionSpecs;
|
|
66712
66710
|
}
|
|
66713
66711
|
removeSubscribers(id, fieldName, specs) {
|
|
66714
66712
|
let targets = [];
|
|
66713
|
+
const subscriber = this.subscribers.get(id);
|
|
66714
|
+
const subscriberField = subscriber?.get(fieldName);
|
|
66715
66715
|
for (const spec of specs) {
|
|
66716
|
-
|
|
66716
|
+
const counts = subscriber?.get(fieldName)?.referenceCounts;
|
|
66717
|
+
if (!counts?.has(spec.set)) {
|
|
66717
66718
|
continue;
|
|
66718
66719
|
}
|
|
66719
|
-
const counts = this.referenceCounts[id][fieldName];
|
|
66720
66720
|
const newVal = (counts.get(spec.set) || 0) - 1;
|
|
66721
66721
|
counts.set(spec.set, newVal);
|
|
66722
66722
|
if (newVal <= 0) {
|
|
@@ -66724,18 +66724,19 @@ var InMemorySubscriptions = class {
|
|
|
66724
66724
|
counts.delete(spec.set);
|
|
66725
66725
|
}
|
|
66726
66726
|
}
|
|
66727
|
-
if (
|
|
66728
|
-
|
|
66727
|
+
if (subscriberField) {
|
|
66728
|
+
subscriberField.selections = this.get(id, fieldName).filter(
|
|
66729
66729
|
([{ set }]) => !targets.includes(set)
|
|
66730
66730
|
);
|
|
66731
66731
|
}
|
|
66732
66732
|
}
|
|
66733
66733
|
removeAllSubscribers(id, targets, visited = []) {
|
|
66734
66734
|
visited.push(id);
|
|
66735
|
-
|
|
66736
|
-
|
|
66737
|
-
|
|
66738
|
-
|
|
66735
|
+
const subscriber = this.subscribers.get(id);
|
|
66736
|
+
for (const [key, val] of subscriber?.entries() ?? []) {
|
|
66737
|
+
const subscribers = targets || val.selections.map(([spec]) => spec);
|
|
66738
|
+
this.removeSubscribers(id, key, subscribers);
|
|
66739
|
+
const { value, kind } = this.cache._internal_unstable.storage.get(id, key);
|
|
66739
66740
|
if (kind === "scalar") {
|
|
66740
66741
|
continue;
|
|
66741
66742
|
}
|
|
@@ -78523,12 +78524,12 @@ async function packageJSON(targetPath, frameworkInfo) {
|
|
|
78523
78524
|
}
|
|
78524
78525
|
packageJSON2.devDependencies = {
|
|
78525
78526
|
...packageJSON2.devDependencies,
|
|
78526
|
-
houdini: "^1.2.
|
|
78527
|
+
houdini: "^1.2.36"
|
|
78527
78528
|
};
|
|
78528
78529
|
if (frameworkInfo.framework === "svelte" || frameworkInfo.framework === "kit") {
|
|
78529
78530
|
packageJSON2.devDependencies = {
|
|
78530
78531
|
...packageJSON2.devDependencies,
|
|
78531
|
-
"houdini-svelte": "^1.2.
|
|
78532
|
+
"houdini-svelte": "^1.2.36"
|
|
78532
78533
|
};
|
|
78533
78534
|
} else {
|
|
78534
78535
|
throw new Error(`Unmanaged framework: "${JSON.stringify(frameworkInfo)}"`);
|
package/build/cmd-esm/index.js
CHANGED
|
@@ -66494,11 +66494,10 @@ var InMemorySubscriptions = class {
|
|
|
66494
66494
|
constructor(cache) {
|
|
66495
66495
|
this.cache = cache;
|
|
66496
66496
|
}
|
|
66497
|
-
subscribers =
|
|
66498
|
-
referenceCounts = {};
|
|
66497
|
+
subscribers = /* @__PURE__ */ new Map();
|
|
66499
66498
|
keyVersions = {};
|
|
66500
66499
|
activeFields(parent2) {
|
|
66501
|
-
return Object.keys(this.subscribers
|
|
66500
|
+
return Object.keys(this.subscribers.get(parent2) || {});
|
|
66502
66501
|
}
|
|
66503
66502
|
add({
|
|
66504
66503
|
parent: parent2,
|
|
@@ -66572,27 +66571,28 @@ var InMemorySubscriptions = class {
|
|
|
66572
66571
|
type
|
|
66573
66572
|
}) {
|
|
66574
66573
|
const spec = selection[0];
|
|
66575
|
-
if (!this.subscribers
|
|
66576
|
-
this.subscribers
|
|
66577
|
-
}
|
|
66578
|
-
|
|
66579
|
-
|
|
66574
|
+
if (!this.subscribers.has(id)) {
|
|
66575
|
+
this.subscribers.set(id, /* @__PURE__ */ new Map());
|
|
66576
|
+
}
|
|
66577
|
+
const subscriber = this.subscribers.get(id);
|
|
66578
|
+
if (!subscriber.has(key)) {
|
|
66579
|
+
subscriber.set(key, {
|
|
66580
|
+
selections: [],
|
|
66581
|
+
referenceCounts: /* @__PURE__ */ new Map()
|
|
66582
|
+
});
|
|
66580
66583
|
}
|
|
66584
|
+
const subscriberField = subscriber.get(key);
|
|
66581
66585
|
if (!this.keyVersions[key]) {
|
|
66582
66586
|
this.keyVersions[key] = /* @__PURE__ */ new Set();
|
|
66583
66587
|
}
|
|
66584
66588
|
this.keyVersions[key].add(key);
|
|
66585
|
-
if (!
|
|
66586
|
-
|
|
66587
|
-
}
|
|
66588
|
-
if (!this.referenceCounts[id]) {
|
|
66589
|
-
this.referenceCounts[id] = {};
|
|
66589
|
+
if (!subscriberField.selections.some(([{ set }]) => set === spec.set)) {
|
|
66590
|
+
subscriberField.selections.push([spec, selection[1]]);
|
|
66590
66591
|
}
|
|
66591
|
-
|
|
66592
|
-
|
|
66593
|
-
|
|
66594
|
-
|
|
66595
|
-
counts.set(spec.set, (counts.get(spec.set) || 0) + 1);
|
|
66592
|
+
subscriberField.referenceCounts.set(
|
|
66593
|
+
spec.set,
|
|
66594
|
+
(subscriberField.referenceCounts.get(spec.set) || 0) + 1
|
|
66595
|
+
);
|
|
66596
66596
|
this.cache._internal_unstable.lifetimes.resetLifetime(id, key);
|
|
66597
66597
|
}
|
|
66598
66598
|
registerList({
|
|
@@ -66679,7 +66679,7 @@ var InMemorySubscriptions = class {
|
|
|
66679
66679
|
}
|
|
66680
66680
|
}
|
|
66681
66681
|
get(id, field) {
|
|
66682
|
-
return this.subscribers
|
|
66682
|
+
return this.subscribers.get(id)?.get(field)?.selections || [];
|
|
66683
66683
|
}
|
|
66684
66684
|
remove(id, selection, targets, variables, visited = []) {
|
|
66685
66685
|
visited.push(id);
|
|
@@ -66705,24 +66705,24 @@ var InMemorySubscriptions = class {
|
|
|
66705
66705
|
}
|
|
66706
66706
|
}
|
|
66707
66707
|
reset() {
|
|
66708
|
-
const subscribers =
|
|
66709
|
-
([id]) => !id.startsWith(rootID)
|
|
66710
|
-
);
|
|
66708
|
+
const subscribers = [...this.subscribers.entries()].filter(([id]) => !id.startsWith(rootID));
|
|
66711
66709
|
for (const [id, _fields] of subscribers) {
|
|
66712
|
-
|
|
66710
|
+
this.subscribers.delete(id);
|
|
66713
66711
|
}
|
|
66714
66712
|
const subscriptionSpecs = subscribers.flatMap(
|
|
66715
|
-
([_id, fields]) =>
|
|
66713
|
+
([_id, fields]) => [...fields.values()].flatMap((field) => field.selections.map(([spec]) => spec))
|
|
66716
66714
|
);
|
|
66717
66715
|
return subscriptionSpecs;
|
|
66718
66716
|
}
|
|
66719
66717
|
removeSubscribers(id, fieldName, specs) {
|
|
66720
66718
|
let targets = [];
|
|
66719
|
+
const subscriber = this.subscribers.get(id);
|
|
66720
|
+
const subscriberField = subscriber?.get(fieldName);
|
|
66721
66721
|
for (const spec of specs) {
|
|
66722
|
-
|
|
66722
|
+
const counts = subscriber?.get(fieldName)?.referenceCounts;
|
|
66723
|
+
if (!counts?.has(spec.set)) {
|
|
66723
66724
|
continue;
|
|
66724
66725
|
}
|
|
66725
|
-
const counts = this.referenceCounts[id][fieldName];
|
|
66726
66726
|
const newVal = (counts.get(spec.set) || 0) - 1;
|
|
66727
66727
|
counts.set(spec.set, newVal);
|
|
66728
66728
|
if (newVal <= 0) {
|
|
@@ -66730,18 +66730,19 @@ var InMemorySubscriptions = class {
|
|
|
66730
66730
|
counts.delete(spec.set);
|
|
66731
66731
|
}
|
|
66732
66732
|
}
|
|
66733
|
-
if (
|
|
66734
|
-
|
|
66733
|
+
if (subscriberField) {
|
|
66734
|
+
subscriberField.selections = this.get(id, fieldName).filter(
|
|
66735
66735
|
([{ set }]) => !targets.includes(set)
|
|
66736
66736
|
);
|
|
66737
66737
|
}
|
|
66738
66738
|
}
|
|
66739
66739
|
removeAllSubscribers(id, targets, visited = []) {
|
|
66740
66740
|
visited.push(id);
|
|
66741
|
-
|
|
66742
|
-
|
|
66743
|
-
|
|
66744
|
-
|
|
66741
|
+
const subscriber = this.subscribers.get(id);
|
|
66742
|
+
for (const [key, val] of subscriber?.entries() ?? []) {
|
|
66743
|
+
const subscribers = targets || val.selections.map(([spec]) => spec);
|
|
66744
|
+
this.removeSubscribers(id, key, subscribers);
|
|
66745
|
+
const { value, kind } = this.cache._internal_unstable.storage.get(id, key);
|
|
66745
66746
|
if (kind === "scalar") {
|
|
66746
66747
|
continue;
|
|
66747
66748
|
}
|
|
@@ -78528,12 +78529,12 @@ async function packageJSON(targetPath, frameworkInfo) {
|
|
|
78528
78529
|
}
|
|
78529
78530
|
packageJSON2.devDependencies = {
|
|
78530
78531
|
...packageJSON2.devDependencies,
|
|
78531
|
-
houdini: "^1.2.
|
|
78532
|
+
houdini: "^1.2.36"
|
|
78532
78533
|
};
|
|
78533
78534
|
if (frameworkInfo.framework === "svelte" || frameworkInfo.framework === "kit") {
|
|
78534
78535
|
packageJSON2.devDependencies = {
|
|
78535
78536
|
...packageJSON2.devDependencies,
|
|
78536
|
-
"houdini-svelte": "^1.2.
|
|
78537
|
+
"houdini-svelte": "^1.2.36"
|
|
78537
78538
|
};
|
|
78538
78539
|
} else {
|
|
78539
78540
|
throw new Error(`Unmanaged framework: "${JSON.stringify(frameworkInfo)}"`);
|
|
@@ -55862,11 +55862,10 @@ var InMemorySubscriptions = class {
|
|
|
55862
55862
|
constructor(cache) {
|
|
55863
55863
|
this.cache = cache;
|
|
55864
55864
|
}
|
|
55865
|
-
subscribers =
|
|
55866
|
-
referenceCounts = {};
|
|
55865
|
+
subscribers = /* @__PURE__ */ new Map();
|
|
55867
55866
|
keyVersions = {};
|
|
55868
55867
|
activeFields(parent2) {
|
|
55869
|
-
return Object.keys(this.subscribers
|
|
55868
|
+
return Object.keys(this.subscribers.get(parent2) || {});
|
|
55870
55869
|
}
|
|
55871
55870
|
add({
|
|
55872
55871
|
parent: parent2,
|
|
@@ -55940,27 +55939,28 @@ var InMemorySubscriptions = class {
|
|
|
55940
55939
|
type
|
|
55941
55940
|
}) {
|
|
55942
55941
|
const spec = selection[0];
|
|
55943
|
-
if (!this.subscribers
|
|
55944
|
-
this.subscribers
|
|
55945
|
-
}
|
|
55946
|
-
|
|
55947
|
-
|
|
55942
|
+
if (!this.subscribers.has(id)) {
|
|
55943
|
+
this.subscribers.set(id, /* @__PURE__ */ new Map());
|
|
55944
|
+
}
|
|
55945
|
+
const subscriber = this.subscribers.get(id);
|
|
55946
|
+
if (!subscriber.has(key)) {
|
|
55947
|
+
subscriber.set(key, {
|
|
55948
|
+
selections: [],
|
|
55949
|
+
referenceCounts: /* @__PURE__ */ new Map()
|
|
55950
|
+
});
|
|
55948
55951
|
}
|
|
55952
|
+
const subscriberField = subscriber.get(key);
|
|
55949
55953
|
if (!this.keyVersions[key]) {
|
|
55950
55954
|
this.keyVersions[key] = /* @__PURE__ */ new Set();
|
|
55951
55955
|
}
|
|
55952
55956
|
this.keyVersions[key].add(key);
|
|
55953
|
-
if (!
|
|
55954
|
-
|
|
55955
|
-
}
|
|
55956
|
-
if (!this.referenceCounts[id]) {
|
|
55957
|
-
this.referenceCounts[id] = {};
|
|
55957
|
+
if (!subscriberField.selections.some(([{ set }]) => set === spec.set)) {
|
|
55958
|
+
subscriberField.selections.push([spec, selection[1]]);
|
|
55958
55959
|
}
|
|
55959
|
-
|
|
55960
|
-
|
|
55961
|
-
|
|
55962
|
-
|
|
55963
|
-
counts.set(spec.set, (counts.get(spec.set) || 0) + 1);
|
|
55960
|
+
subscriberField.referenceCounts.set(
|
|
55961
|
+
spec.set,
|
|
55962
|
+
(subscriberField.referenceCounts.get(spec.set) || 0) + 1
|
|
55963
|
+
);
|
|
55964
55964
|
this.cache._internal_unstable.lifetimes.resetLifetime(id, key);
|
|
55965
55965
|
}
|
|
55966
55966
|
registerList({
|
|
@@ -56047,7 +56047,7 @@ var InMemorySubscriptions = class {
|
|
|
56047
56047
|
}
|
|
56048
56048
|
}
|
|
56049
56049
|
get(id, field) {
|
|
56050
|
-
return this.subscribers
|
|
56050
|
+
return this.subscribers.get(id)?.get(field)?.selections || [];
|
|
56051
56051
|
}
|
|
56052
56052
|
remove(id, selection, targets, variables, visited = []) {
|
|
56053
56053
|
visited.push(id);
|
|
@@ -56073,24 +56073,24 @@ var InMemorySubscriptions = class {
|
|
|
56073
56073
|
}
|
|
56074
56074
|
}
|
|
56075
56075
|
reset() {
|
|
56076
|
-
const subscribers =
|
|
56077
|
-
([id]) => !id.startsWith(rootID)
|
|
56078
|
-
);
|
|
56076
|
+
const subscribers = [...this.subscribers.entries()].filter(([id]) => !id.startsWith(rootID));
|
|
56079
56077
|
for (const [id, _fields] of subscribers) {
|
|
56080
|
-
|
|
56078
|
+
this.subscribers.delete(id);
|
|
56081
56079
|
}
|
|
56082
56080
|
const subscriptionSpecs = subscribers.flatMap(
|
|
56083
|
-
([_id, fields]) =>
|
|
56081
|
+
([_id, fields]) => [...fields.values()].flatMap((field) => field.selections.map(([spec]) => spec))
|
|
56084
56082
|
);
|
|
56085
56083
|
return subscriptionSpecs;
|
|
56086
56084
|
}
|
|
56087
56085
|
removeSubscribers(id, fieldName, specs) {
|
|
56088
56086
|
let targets = [];
|
|
56087
|
+
const subscriber = this.subscribers.get(id);
|
|
56088
|
+
const subscriberField = subscriber?.get(fieldName);
|
|
56089
56089
|
for (const spec of specs) {
|
|
56090
|
-
|
|
56090
|
+
const counts = subscriber?.get(fieldName)?.referenceCounts;
|
|
56091
|
+
if (!counts?.has(spec.set)) {
|
|
56091
56092
|
continue;
|
|
56092
56093
|
}
|
|
56093
|
-
const counts = this.referenceCounts[id][fieldName];
|
|
56094
56094
|
const newVal = (counts.get(spec.set) || 0) - 1;
|
|
56095
56095
|
counts.set(spec.set, newVal);
|
|
56096
56096
|
if (newVal <= 0) {
|
|
@@ -56098,18 +56098,19 @@ var InMemorySubscriptions = class {
|
|
|
56098
56098
|
counts.delete(spec.set);
|
|
56099
56099
|
}
|
|
56100
56100
|
}
|
|
56101
|
-
if (
|
|
56102
|
-
|
|
56101
|
+
if (subscriberField) {
|
|
56102
|
+
subscriberField.selections = this.get(id, fieldName).filter(
|
|
56103
56103
|
([{ set }]) => !targets.includes(set)
|
|
56104
56104
|
);
|
|
56105
56105
|
}
|
|
56106
56106
|
}
|
|
56107
56107
|
removeAllSubscribers(id, targets, visited = []) {
|
|
56108
56108
|
visited.push(id);
|
|
56109
|
-
|
|
56110
|
-
|
|
56111
|
-
|
|
56112
|
-
|
|
56109
|
+
const subscriber = this.subscribers.get(id);
|
|
56110
|
+
for (const [key, val] of subscriber?.entries() ?? []) {
|
|
56111
|
+
const subscribers = targets || val.selections.map(([spec]) => spec);
|
|
56112
|
+
this.removeSubscribers(id, key, subscribers);
|
|
56113
|
+
const { value, kind } = this.cache._internal_unstable.storage.get(id, key);
|
|
56113
56114
|
if (kind === "scalar") {
|
|
56114
56115
|
continue;
|
|
56115
56116
|
}
|
|
@@ -55862,11 +55862,10 @@ var InMemorySubscriptions = class {
|
|
|
55862
55862
|
constructor(cache) {
|
|
55863
55863
|
this.cache = cache;
|
|
55864
55864
|
}
|
|
55865
|
-
subscribers =
|
|
55866
|
-
referenceCounts = {};
|
|
55865
|
+
subscribers = /* @__PURE__ */ new Map();
|
|
55867
55866
|
keyVersions = {};
|
|
55868
55867
|
activeFields(parent2) {
|
|
55869
|
-
return Object.keys(this.subscribers
|
|
55868
|
+
return Object.keys(this.subscribers.get(parent2) || {});
|
|
55870
55869
|
}
|
|
55871
55870
|
add({
|
|
55872
55871
|
parent: parent2,
|
|
@@ -55940,27 +55939,28 @@ var InMemorySubscriptions = class {
|
|
|
55940
55939
|
type
|
|
55941
55940
|
}) {
|
|
55942
55941
|
const spec = selection[0];
|
|
55943
|
-
if (!this.subscribers
|
|
55944
|
-
this.subscribers
|
|
55945
|
-
}
|
|
55946
|
-
|
|
55947
|
-
|
|
55942
|
+
if (!this.subscribers.has(id)) {
|
|
55943
|
+
this.subscribers.set(id, /* @__PURE__ */ new Map());
|
|
55944
|
+
}
|
|
55945
|
+
const subscriber = this.subscribers.get(id);
|
|
55946
|
+
if (!subscriber.has(key)) {
|
|
55947
|
+
subscriber.set(key, {
|
|
55948
|
+
selections: [],
|
|
55949
|
+
referenceCounts: /* @__PURE__ */ new Map()
|
|
55950
|
+
});
|
|
55948
55951
|
}
|
|
55952
|
+
const subscriberField = subscriber.get(key);
|
|
55949
55953
|
if (!this.keyVersions[key]) {
|
|
55950
55954
|
this.keyVersions[key] = /* @__PURE__ */ new Set();
|
|
55951
55955
|
}
|
|
55952
55956
|
this.keyVersions[key].add(key);
|
|
55953
|
-
if (!
|
|
55954
|
-
|
|
55955
|
-
}
|
|
55956
|
-
if (!this.referenceCounts[id]) {
|
|
55957
|
-
this.referenceCounts[id] = {};
|
|
55957
|
+
if (!subscriberField.selections.some(([{ set }]) => set === spec.set)) {
|
|
55958
|
+
subscriberField.selections.push([spec, selection[1]]);
|
|
55958
55959
|
}
|
|
55959
|
-
|
|
55960
|
-
|
|
55961
|
-
|
|
55962
|
-
|
|
55963
|
-
counts.set(spec.set, (counts.get(spec.set) || 0) + 1);
|
|
55960
|
+
subscriberField.referenceCounts.set(
|
|
55961
|
+
spec.set,
|
|
55962
|
+
(subscriberField.referenceCounts.get(spec.set) || 0) + 1
|
|
55963
|
+
);
|
|
55964
55964
|
this.cache._internal_unstable.lifetimes.resetLifetime(id, key);
|
|
55965
55965
|
}
|
|
55966
55966
|
registerList({
|
|
@@ -56047,7 +56047,7 @@ var InMemorySubscriptions = class {
|
|
|
56047
56047
|
}
|
|
56048
56048
|
}
|
|
56049
56049
|
get(id, field) {
|
|
56050
|
-
return this.subscribers
|
|
56050
|
+
return this.subscribers.get(id)?.get(field)?.selections || [];
|
|
56051
56051
|
}
|
|
56052
56052
|
remove(id, selection, targets, variables, visited = []) {
|
|
56053
56053
|
visited.push(id);
|
|
@@ -56073,24 +56073,24 @@ var InMemorySubscriptions = class {
|
|
|
56073
56073
|
}
|
|
56074
56074
|
}
|
|
56075
56075
|
reset() {
|
|
56076
|
-
const subscribers =
|
|
56077
|
-
([id]) => !id.startsWith(rootID)
|
|
56078
|
-
);
|
|
56076
|
+
const subscribers = [...this.subscribers.entries()].filter(([id]) => !id.startsWith(rootID));
|
|
56079
56077
|
for (const [id, _fields] of subscribers) {
|
|
56080
|
-
|
|
56078
|
+
this.subscribers.delete(id);
|
|
56081
56079
|
}
|
|
56082
56080
|
const subscriptionSpecs = subscribers.flatMap(
|
|
56083
|
-
([_id, fields]) =>
|
|
56081
|
+
([_id, fields]) => [...fields.values()].flatMap((field) => field.selections.map(([spec]) => spec))
|
|
56084
56082
|
);
|
|
56085
56083
|
return subscriptionSpecs;
|
|
56086
56084
|
}
|
|
56087
56085
|
removeSubscribers(id, fieldName, specs) {
|
|
56088
56086
|
let targets = [];
|
|
56087
|
+
const subscriber = this.subscribers.get(id);
|
|
56088
|
+
const subscriberField = subscriber?.get(fieldName);
|
|
56089
56089
|
for (const spec of specs) {
|
|
56090
|
-
|
|
56090
|
+
const counts = subscriber?.get(fieldName)?.referenceCounts;
|
|
56091
|
+
if (!counts?.has(spec.set)) {
|
|
56091
56092
|
continue;
|
|
56092
56093
|
}
|
|
56093
|
-
const counts = this.referenceCounts[id][fieldName];
|
|
56094
56094
|
const newVal = (counts.get(spec.set) || 0) - 1;
|
|
56095
56095
|
counts.set(spec.set, newVal);
|
|
56096
56096
|
if (newVal <= 0) {
|
|
@@ -56098,18 +56098,19 @@ var InMemorySubscriptions = class {
|
|
|
56098
56098
|
counts.delete(spec.set);
|
|
56099
56099
|
}
|
|
56100
56100
|
}
|
|
56101
|
-
if (
|
|
56102
|
-
|
|
56101
|
+
if (subscriberField) {
|
|
56102
|
+
subscriberField.selections = this.get(id, fieldName).filter(
|
|
56103
56103
|
([{ set }]) => !targets.includes(set)
|
|
56104
56104
|
);
|
|
56105
56105
|
}
|
|
56106
56106
|
}
|
|
56107
56107
|
removeAllSubscribers(id, targets, visited = []) {
|
|
56108
56108
|
visited.push(id);
|
|
56109
|
-
|
|
56110
|
-
|
|
56111
|
-
|
|
56112
|
-
|
|
56109
|
+
const subscriber = this.subscribers.get(id);
|
|
56110
|
+
for (const [key, val] of subscriber?.entries() ?? []) {
|
|
56111
|
+
const subscribers = targets || val.selections.map(([spec]) => spec);
|
|
56112
|
+
this.removeSubscribers(id, key, subscribers);
|
|
56113
|
+
const { value, kind } = this.cache._internal_unstable.storage.get(id, key);
|
|
56113
56114
|
if (kind === "scalar") {
|
|
56114
56115
|
continue;
|
|
56115
56116
|
}
|
package/build/lib-cjs/index.js
CHANGED
|
@@ -64954,11 +64954,10 @@ var InMemorySubscriptions = class {
|
|
|
64954
64954
|
constructor(cache) {
|
|
64955
64955
|
this.cache = cache;
|
|
64956
64956
|
}
|
|
64957
|
-
subscribers =
|
|
64958
|
-
referenceCounts = {};
|
|
64957
|
+
subscribers = /* @__PURE__ */ new Map();
|
|
64959
64958
|
keyVersions = {};
|
|
64960
64959
|
activeFields(parent) {
|
|
64961
|
-
return Object.keys(this.subscribers
|
|
64960
|
+
return Object.keys(this.subscribers.get(parent) || {});
|
|
64962
64961
|
}
|
|
64963
64962
|
add({
|
|
64964
64963
|
parent,
|
|
@@ -65032,27 +65031,28 @@ var InMemorySubscriptions = class {
|
|
|
65032
65031
|
type
|
|
65033
65032
|
}) {
|
|
65034
65033
|
const spec = selection[0];
|
|
65035
|
-
if (!this.subscribers
|
|
65036
|
-
this.subscribers
|
|
65037
|
-
}
|
|
65038
|
-
|
|
65039
|
-
|
|
65034
|
+
if (!this.subscribers.has(id)) {
|
|
65035
|
+
this.subscribers.set(id, /* @__PURE__ */ new Map());
|
|
65036
|
+
}
|
|
65037
|
+
const subscriber = this.subscribers.get(id);
|
|
65038
|
+
if (!subscriber.has(key)) {
|
|
65039
|
+
subscriber.set(key, {
|
|
65040
|
+
selections: [],
|
|
65041
|
+
referenceCounts: /* @__PURE__ */ new Map()
|
|
65042
|
+
});
|
|
65040
65043
|
}
|
|
65044
|
+
const subscriberField = subscriber.get(key);
|
|
65041
65045
|
if (!this.keyVersions[key]) {
|
|
65042
65046
|
this.keyVersions[key] = /* @__PURE__ */ new Set();
|
|
65043
65047
|
}
|
|
65044
65048
|
this.keyVersions[key].add(key);
|
|
65045
|
-
if (!
|
|
65046
|
-
|
|
65047
|
-
}
|
|
65048
|
-
if (!this.referenceCounts[id]) {
|
|
65049
|
-
this.referenceCounts[id] = {};
|
|
65049
|
+
if (!subscriberField.selections.some(([{ set }]) => set === spec.set)) {
|
|
65050
|
+
subscriberField.selections.push([spec, selection[1]]);
|
|
65050
65051
|
}
|
|
65051
|
-
|
|
65052
|
-
|
|
65053
|
-
|
|
65054
|
-
|
|
65055
|
-
counts.set(spec.set, (counts.get(spec.set) || 0) + 1);
|
|
65052
|
+
subscriberField.referenceCounts.set(
|
|
65053
|
+
spec.set,
|
|
65054
|
+
(subscriberField.referenceCounts.get(spec.set) || 0) + 1
|
|
65055
|
+
);
|
|
65056
65056
|
this.cache._internal_unstable.lifetimes.resetLifetime(id, key);
|
|
65057
65057
|
}
|
|
65058
65058
|
registerList({
|
|
@@ -65139,7 +65139,7 @@ var InMemorySubscriptions = class {
|
|
|
65139
65139
|
}
|
|
65140
65140
|
}
|
|
65141
65141
|
get(id, field) {
|
|
65142
|
-
return this.subscribers
|
|
65142
|
+
return this.subscribers.get(id)?.get(field)?.selections || [];
|
|
65143
65143
|
}
|
|
65144
65144
|
remove(id, selection, targets, variables, visited = []) {
|
|
65145
65145
|
visited.push(id);
|
|
@@ -65165,24 +65165,24 @@ var InMemorySubscriptions = class {
|
|
|
65165
65165
|
}
|
|
65166
65166
|
}
|
|
65167
65167
|
reset() {
|
|
65168
|
-
const subscribers =
|
|
65169
|
-
([id]) => !id.startsWith(rootID)
|
|
65170
|
-
);
|
|
65168
|
+
const subscribers = [...this.subscribers.entries()].filter(([id]) => !id.startsWith(rootID));
|
|
65171
65169
|
for (const [id, _fields] of subscribers) {
|
|
65172
|
-
|
|
65170
|
+
this.subscribers.delete(id);
|
|
65173
65171
|
}
|
|
65174
65172
|
const subscriptionSpecs = subscribers.flatMap(
|
|
65175
|
-
([_id, fields]) =>
|
|
65173
|
+
([_id, fields]) => [...fields.values()].flatMap((field) => field.selections.map(([spec]) => spec))
|
|
65176
65174
|
);
|
|
65177
65175
|
return subscriptionSpecs;
|
|
65178
65176
|
}
|
|
65179
65177
|
removeSubscribers(id, fieldName, specs) {
|
|
65180
65178
|
let targets = [];
|
|
65179
|
+
const subscriber = this.subscribers.get(id);
|
|
65180
|
+
const subscriberField = subscriber?.get(fieldName);
|
|
65181
65181
|
for (const spec of specs) {
|
|
65182
|
-
|
|
65182
|
+
const counts = subscriber?.get(fieldName)?.referenceCounts;
|
|
65183
|
+
if (!counts?.has(spec.set)) {
|
|
65183
65184
|
continue;
|
|
65184
65185
|
}
|
|
65185
|
-
const counts = this.referenceCounts[id][fieldName];
|
|
65186
65186
|
const newVal = (counts.get(spec.set) || 0) - 1;
|
|
65187
65187
|
counts.set(spec.set, newVal);
|
|
65188
65188
|
if (newVal <= 0) {
|
|
@@ -65190,18 +65190,19 @@ var InMemorySubscriptions = class {
|
|
|
65190
65190
|
counts.delete(spec.set);
|
|
65191
65191
|
}
|
|
65192
65192
|
}
|
|
65193
|
-
if (
|
|
65194
|
-
|
|
65193
|
+
if (subscriberField) {
|
|
65194
|
+
subscriberField.selections = this.get(id, fieldName).filter(
|
|
65195
65195
|
([{ set }]) => !targets.includes(set)
|
|
65196
65196
|
);
|
|
65197
65197
|
}
|
|
65198
65198
|
}
|
|
65199
65199
|
removeAllSubscribers(id, targets, visited = []) {
|
|
65200
65200
|
visited.push(id);
|
|
65201
|
-
|
|
65202
|
-
|
|
65203
|
-
|
|
65204
|
-
|
|
65201
|
+
const subscriber = this.subscribers.get(id);
|
|
65202
|
+
for (const [key, val] of subscriber?.entries() ?? []) {
|
|
65203
|
+
const subscribers = targets || val.selections.map(([spec]) => spec);
|
|
65204
|
+
this.removeSubscribers(id, key, subscribers);
|
|
65205
|
+
const { value, kind } = this.cache._internal_unstable.storage.get(id, key);
|
|
65205
65206
|
if (kind === "scalar") {
|
|
65206
65207
|
continue;
|
|
65207
65208
|
}
|