houdini 1.2.5 → 1.2.6
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 +613 -562
- package/build/cmd-esm/index.js +613 -562
- package/build/codegen/generators/artifacts/selection.d.ts +1 -3
- package/build/codegen-cjs/index.js +600 -549
- package/build/codegen-esm/index.js +600 -549
- package/build/lib-cjs/index.js +41 -10
- package/build/lib-esm/index.js +41 -10
- package/build/runtime/cache/cache.d.ts +2 -0
- package/build/runtime/cache/gc.d.ts +1 -0
- package/build/runtime/cache/lists.d.ts +1 -0
- package/build/runtime/cache/staleManager.d.ts +1 -0
- package/build/runtime/cache/storage.d.ts +1 -0
- package/build/runtime/cache/subscription.d.ts +2 -1
- package/build/runtime/public/cache.d.ts +4 -0
- package/build/runtime-cjs/cache/cache.d.ts +2 -0
- package/build/runtime-cjs/cache/cache.js +16 -10
- package/build/runtime-cjs/cache/gc.d.ts +1 -0
- package/build/runtime-cjs/cache/gc.js +3 -0
- package/build/runtime-cjs/cache/lists.d.ts +1 -0
- package/build/runtime-cjs/cache/lists.js +4 -0
- package/build/runtime-cjs/cache/staleManager.d.ts +1 -0
- package/build/runtime-cjs/cache/staleManager.js +3 -0
- package/build/runtime-cjs/cache/storage.d.ts +1 -0
- package/build/runtime-cjs/cache/storage.js +3 -0
- package/build/runtime-cjs/cache/subscription.d.ts +2 -1
- package/build/runtime-cjs/cache/subscription.js +13 -0
- package/build/runtime-cjs/public/cache.d.ts +4 -0
- package/build/runtime-cjs/public/cache.js +3 -0
- package/build/runtime-esm/cache/cache.d.ts +2 -0
- package/build/runtime-esm/cache/cache.js +16 -10
- package/build/runtime-esm/cache/gc.d.ts +1 -0
- package/build/runtime-esm/cache/gc.js +3 -0
- package/build/runtime-esm/cache/lists.d.ts +1 -0
- package/build/runtime-esm/cache/lists.js +4 -0
- package/build/runtime-esm/cache/staleManager.d.ts +1 -0
- package/build/runtime-esm/cache/staleManager.js +3 -0
- package/build/runtime-esm/cache/storage.d.ts +1 -0
- package/build/runtime-esm/cache/storage.js +3 -0
- package/build/runtime-esm/cache/subscription.d.ts +2 -1
- package/build/runtime-esm/cache/subscription.js +13 -0
- package/build/runtime-esm/public/cache.d.ts +4 -0
- package/build/runtime-esm/public/cache.js +3 -0
- package/build/test-cjs/index.js +603 -552
- package/build/test-esm/index.js +603 -552
- package/build/vite-cjs/index.js +618 -567
- package/build/vite-esm/index.js +618 -567
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { GraphQLValue, SubscriptionSelection, SubscriptionSpec } from '../lib/types';
|
|
2
|
-
import type
|
|
2
|
+
import { type Cache } from './cache';
|
|
3
3
|
export type FieldSelection = [
|
|
4
4
|
SubscriptionSpec,
|
|
5
5
|
Required<SubscriptionSelection>['fields'] | undefined
|
|
@@ -43,6 +43,7 @@ export declare class InMemorySubscriptions {
|
|
|
43
43
|
}): void;
|
|
44
44
|
get(id: string, field: string): FieldSelection[];
|
|
45
45
|
remove(id: string, selection: SubscriptionSelection, targets: SubscriptionSpec[], variables: {}, visited?: string[]): void;
|
|
46
|
+
reset(): SubscriptionSpec[];
|
|
46
47
|
private removeSubscribers;
|
|
47
48
|
removeAllSubscribers(id: string, targets?: SubscriptionSpec[], visited?: string[]): void;
|
|
48
49
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { flatten } from "../lib/flatten";
|
|
2
2
|
import { getFieldsForType } from "../lib/selection";
|
|
3
|
+
import { rootID } from "./cache";
|
|
3
4
|
import { evaluateKey } from "./stuff";
|
|
4
5
|
class InMemorySubscriptions {
|
|
5
6
|
cache;
|
|
@@ -216,6 +217,18 @@ class InMemorySubscriptions {
|
|
|
216
217
|
this.remove(linkedRecordID, linkFields, targets, visited);
|
|
217
218
|
}
|
|
218
219
|
}
|
|
220
|
+
reset() {
|
|
221
|
+
const subscribers = Object.entries(this.subscribers).filter(
|
|
222
|
+
([id]) => !id.startsWith(rootID)
|
|
223
|
+
);
|
|
224
|
+
for (const [id, _fields] of subscribers) {
|
|
225
|
+
delete this.subscribers[id];
|
|
226
|
+
}
|
|
227
|
+
const subscriptionSpecs = subscribers.flatMap(
|
|
228
|
+
([_id, fields]) => Object.values(fields).flatMap((field) => field.map(([spec]) => spec))
|
|
229
|
+
);
|
|
230
|
+
return subscriptionSpecs;
|
|
231
|
+
}
|
|
219
232
|
removeSubscribers(id, fieldName, specs) {
|
|
220
233
|
let targets = [];
|
|
221
234
|
for (const spec of specs) {
|
|
@@ -67,6 +67,9 @@ Please acknowledge this by setting acceptImperativeInstability to true in your c
|
|
|
67
67
|
markStale(type, options) {
|
|
68
68
|
return this._internal_unstable.markTypeStale(type ? { ...options, type } : void 0);
|
|
69
69
|
}
|
|
70
|
+
reset() {
|
|
71
|
+
return this._internal_unstable.reset();
|
|
72
|
+
}
|
|
70
73
|
}
|
|
71
74
|
export {
|
|
72
75
|
Cache
|