@softistx/riva 0.0.0-stage → 0.1.0
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/LICENSE +21 -0
- package/README.md +168 -2
- package/dist/batch.d.ts +5 -0
- package/dist/batch.d.ts.map +1 -0
- package/dist/chunks/index-2g2s3y31.js +58 -0
- package/dist/chunks/index-2g2s3y31.js.map +10 -0
- package/dist/chunks/index-46sbdyt0.js +84 -0
- package/dist/chunks/index-46sbdyt0.js.map +12 -0
- package/dist/chunks/index-5xnfwj57.js +21 -0
- package/dist/chunks/index-5xnfwj57.js.map +10 -0
- package/dist/chunks/index-asz1gnp1.js +50 -0
- package/dist/chunks/index-asz1gnp1.js.map +10 -0
- package/dist/chunks/index-e4vzsfy1.js +253 -0
- package/dist/chunks/index-e4vzsfy1.js.map +11 -0
- package/dist/chunks/index-tn8ankny.js +137 -0
- package/dist/chunks/index-tn8ankny.js.map +10 -0
- package/dist/chunks/index-vz93xwnj.js +35 -0
- package/dist/chunks/index-vz93xwnj.js.map +10 -0
- package/dist/chunks/index-y6bzw104.js +53 -0
- package/dist/chunks/index-y6bzw104.js.map +11 -0
- package/dist/client.d.ts +48 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/computed.d.ts +21 -0
- package/dist/computed.d.ts.map +1 -0
- package/dist/data/index.d.ts +19 -0
- package/dist/data/index.d.ts.map +1 -0
- package/dist/data/index.js +60 -0
- package/dist/data/index.js.map +10 -0
- package/dist/data/types.d.ts +12 -0
- package/dist/data/types.d.ts.map +1 -0
- package/dist/duration.d.ts +5 -0
- package/dist/duration.d.ts.map +1 -0
- package/dist/effect.d.ts +5 -0
- package/dist/effect.d.ts.map +1 -0
- package/dist/entities/api.d.ts +18 -0
- package/dist/entities/api.d.ts.map +1 -0
- package/dist/entities/denormalize.d.ts +13 -0
- package/dist/entities/denormalize.d.ts.map +1 -0
- package/dist/entities/identity.d.ts +11 -0
- package/dist/entities/identity.d.ts.map +1 -0
- package/dist/entities/index.d.ts +6 -0
- package/dist/entities/index.d.ts.map +1 -0
- package/dist/entities/index.js +414 -0
- package/dist/entities/index.js.map +16 -0
- package/dist/entities/json.d.ts +15 -0
- package/dist/entities/json.d.ts.map +1 -0
- package/dist/entities/normalize.d.ts +11 -0
- package/dist/entities/normalize.d.ts.map +1 -0
- package/dist/entities/policy.d.ts +41 -0
- package/dist/entities/policy.d.ts.map +1 -0
- package/dist/entities/store.d.ts +47 -0
- package/dist/entities/store.d.ts.map +1 -0
- package/dist/env.d.ts +15 -0
- package/dist/env.d.ts.map +1 -0
- package/dist/errors.d.ts +38 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/flush.d.ts +11 -0
- package/dist/flush.d.ts.map +1 -0
- package/dist/graph.d.ts +47 -0
- package/dist/graph.d.ts.map +1 -0
- package/dist/index.d.ts +14 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +502 -0
- package/dist/index.js.map +18 -0
- package/dist/infinite/index.d.ts +3 -0
- package/dist/infinite/index.d.ts.map +1 -0
- package/dist/infinite/index.js +207 -0
- package/dist/infinite/index.js.map +13 -0
- package/dist/infinite/infinite.d.ts +8 -0
- package/dist/infinite/infinite.d.ts.map +1 -0
- package/dist/infinite/more.d.ts +19 -0
- package/dist/infinite/more.d.ts.map +1 -0
- package/dist/infinite/refetch.d.ts +16 -0
- package/dist/infinite/refetch.d.ts.map +1 -0
- package/dist/infinite/slots.d.ts +22 -0
- package/dist/infinite/slots.d.ts.map +1 -0
- package/dist/infinite/types.d.ts +68 -0
- package/dist/infinite/types.d.ts.map +1 -0
- package/dist/key.d.ts +3 -0
- package/dist/key.d.ts.map +1 -0
- package/dist/mutation-run.d.ts +5 -0
- package/dist/mutation-run.d.ts.map +1 -0
- package/dist/mutation.d.ts +53 -0
- package/dist/mutation.d.ts.map +1 -0
- package/dist/query-cache.d.ts +33 -0
- package/dist/query-cache.d.ts.map +1 -0
- package/dist/query-entry.d.ts +85 -0
- package/dist/query-entry.d.ts.map +1 -0
- package/dist/query-observe.d.ts +9 -0
- package/dist/query-observe.d.ts.map +1 -0
- package/dist/query-run.d.ts +12 -0
- package/dist/query-run.d.ts.map +1 -0
- package/dist/query.d.ts +100 -0
- package/dist/query.d.ts.map +1 -0
- package/dist/retry.d.ts +18 -0
- package/dist/retry.d.ts.map +1 -0
- package/dist/scope.d.ts +16 -0
- package/dist/scope.d.ts.map +1 -0
- package/dist/signal.d.ts +22 -0
- package/dist/signal.d.ts.map +1 -0
- package/dist/ssr/codec.d.ts +10 -0
- package/dist/ssr/codec.d.ts.map +1 -0
- package/dist/ssr/dehydrate.d.ts +37 -0
- package/dist/ssr/dehydrate.d.ts.map +1 -0
- package/dist/ssr/hydrate.d.ts +20 -0
- package/dist/ssr/hydrate.d.ts.map +1 -0
- package/dist/ssr/index.d.ts +5 -0
- package/dist/ssr/index.d.ts.map +1 -0
- package/dist/ssr/index.js +136 -0
- package/dist/ssr/index.js.map +11 -0
- package/dist/store/def.d.ts +31 -0
- package/dist/store/def.d.ts.map +1 -0
- package/dist/store/index.d.ts +3 -0
- package/dist/store/index.d.ts.map +1 -0
- package/dist/store/index.js +215 -0
- package/dist/store/index.js.map +14 -0
- package/dist/store/instance.d.ts +14 -0
- package/dist/store/instance.d.ts.map +1 -0
- package/dist/store/run.d.ts +12 -0
- package/dist/store/run.d.ts.map +1 -0
- package/dist/store/store.d.ts +10 -0
- package/dist/store/store.d.ts.map +1 -0
- package/dist/store/types.d.ts +70 -0
- package/dist/store/types.d.ts.map +1 -0
- package/dist/store/view.d.ts +10 -0
- package/dist/store/view.d.ts.map +1 -0
- package/docs/README.md +19 -0
- package/docs/guide/data.md +36 -0
- package/docs/guide/entities.md +90 -0
- package/docs/guide/errors.md +31 -0
- package/docs/guide/infinite.md +62 -0
- package/docs/guide/mutations.md +73 -0
- package/docs/guide/queries.md +93 -0
- package/docs/guide/signals.md +72 -0
- package/docs/guide/ssr.md +65 -0
- package/docs/guide/store.md +88 -0
- package/docs/troubleshooting.md +343 -0
- package/package.json +84 -5
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
import {
|
|
2
|
+
raceAbort,
|
|
3
|
+
withRetry,
|
|
4
|
+
query2
|
|
5
|
+
} from "../chunks/index-46sbdyt0.js";
|
|
6
|
+
import {
|
|
7
|
+
stableKey2
|
|
8
|
+
} from "../chunks/index-vz93xwnj.js";
|
|
9
|
+
import {
|
|
10
|
+
computed2
|
|
11
|
+
} from "../chunks/index-5xnfwj57.js";
|
|
12
|
+
import {
|
|
13
|
+
signal2
|
|
14
|
+
} from "../chunks/index-y6bzw104.js";
|
|
15
|
+
|
|
16
|
+
// src/infinite/refetch.ts
|
|
17
|
+
async function refetchAll({ page, connection }, vars, ctx, cur) {
|
|
18
|
+
const out = { pages: [], params: [] };
|
|
19
|
+
let p = cur?.params[0] ?? {};
|
|
20
|
+
for (let i = 0, n = cur?.pages.length || 1;i < n; i++) {
|
|
21
|
+
const next = await page(vars, p, ctx);
|
|
22
|
+
out.pages.push(next);
|
|
23
|
+
out.params.push(p);
|
|
24
|
+
const { hasNextPage, endCursor } = connection(next).pageInfo;
|
|
25
|
+
if (endCursor == null || !hasNextPage && p.before === undefined)
|
|
26
|
+
break;
|
|
27
|
+
p = { after: endCursor };
|
|
28
|
+
}
|
|
29
|
+
return out;
|
|
30
|
+
}
|
|
31
|
+
function cursorBeyond(connection, data, dir) {
|
|
32
|
+
const at = dir === "next" ? data?.pages.at(-1) : data?.pages[0];
|
|
33
|
+
if (at === undefined)
|
|
34
|
+
return;
|
|
35
|
+
const i = connection(at).pageInfo;
|
|
36
|
+
const cursor = dir === "next" ? i.endCursor : i.startCursor;
|
|
37
|
+
return (dir === "next" ? i.hasNextPage : i.hasPreviousPage) && cursor != null ? cursor : undefined;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
// src/infinite/more.ts
|
|
41
|
+
var noop = () => {};
|
|
42
|
+
var busyOf = (c, client, vars) => computed2(() => client.queries.state(c.q, vars).isFetching);
|
|
43
|
+
async function settled(client, busy, signal) {
|
|
44
|
+
while (client.get(busy))
|
|
45
|
+
await raceAbort(new Promise((done) => {
|
|
46
|
+
const off = client.subscribe(busy, (b) => {
|
|
47
|
+
if (b)
|
|
48
|
+
return;
|
|
49
|
+
off();
|
|
50
|
+
done();
|
|
51
|
+
});
|
|
52
|
+
}), signal);
|
|
53
|
+
}
|
|
54
|
+
async function load(c, dir, client, vars, key, signal) {
|
|
55
|
+
const data = () => client.untracked(() => client.queries.state(c.q, vars));
|
|
56
|
+
const busy = busyOf(c, client, vars);
|
|
57
|
+
for (;; ) {
|
|
58
|
+
await settled(client, busy, signal);
|
|
59
|
+
const at = cursorBeyond(c.connection, data().data, dir);
|
|
60
|
+
if (at === undefined)
|
|
61
|
+
return;
|
|
62
|
+
const param = dir === "next" ? { after: at } : { before: at };
|
|
63
|
+
let refetched = false;
|
|
64
|
+
const off = client.subscribe(busy, (b) => {
|
|
65
|
+
refetched ||= b;
|
|
66
|
+
});
|
|
67
|
+
const next = await withRetry(client.queries.sched, c, signal, () => c.page(vars, param, { signal, client })).finally(off);
|
|
68
|
+
await settled(client, busy, signal);
|
|
69
|
+
const now = data();
|
|
70
|
+
if (refetched || now.isFetching || cursorBeyond(c.connection, now.data, dir) !== at)
|
|
71
|
+
continue;
|
|
72
|
+
const invalid = client.queries.invalid(c.q, vars);
|
|
73
|
+
client.batch(() => {
|
|
74
|
+
c.q.setData(client, vars, (d) => {
|
|
75
|
+
const { pages, params } = d ?? now.data ?? { pages: [], params: [] };
|
|
76
|
+
return dir === "next" ? { pages: [...pages, next], params: [...params, param] } : { pages: [next, ...pages], params: [param, ...params] };
|
|
77
|
+
});
|
|
78
|
+
c.slots.setFlag(client, key, dir, false);
|
|
79
|
+
});
|
|
80
|
+
if (invalid)
|
|
81
|
+
c.q.invalidate(client, vars);
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
function fetchMore(c, dir, client, vars) {
|
|
86
|
+
const key = stableKey2(c.id, vars);
|
|
87
|
+
const s = c.slots.slot(client);
|
|
88
|
+
const id = `${dir}:${key}`;
|
|
89
|
+
const running = s.runs.get(id);
|
|
90
|
+
if (running)
|
|
91
|
+
return running;
|
|
92
|
+
const st = client.untracked(() => client.queries.state(c.q, vars));
|
|
93
|
+
if (!st.isFetching && cursorBeyond(c.connection, st.data, dir) === undefined)
|
|
94
|
+
return Promise.resolve();
|
|
95
|
+
const ctl = new AbortController;
|
|
96
|
+
c.slots.setFlag(client, key, dir, true);
|
|
97
|
+
s.ctls.set(id, ctl);
|
|
98
|
+
const run = load(c, dir, client, vars, key, ctl.signal).catch((error) => {
|
|
99
|
+
if (!ctl.signal.aborted)
|
|
100
|
+
client.queries.fail(c.q, vars, error);
|
|
101
|
+
throw error;
|
|
102
|
+
}).finally(() => {
|
|
103
|
+
s.runs.delete(id);
|
|
104
|
+
s.ctls.delete(id);
|
|
105
|
+
c.slots.setFlag(client, key, dir, false);
|
|
106
|
+
});
|
|
107
|
+
s.runs.set(id, run);
|
|
108
|
+
run.catch(noop);
|
|
109
|
+
return run;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
// src/infinite/slots.ts
|
|
113
|
+
var NONE = [false, false];
|
|
114
|
+
function createSlots() {
|
|
115
|
+
const flags = signal2({});
|
|
116
|
+
const slots = new WeakMap;
|
|
117
|
+
return {
|
|
118
|
+
flags,
|
|
119
|
+
slot(client) {
|
|
120
|
+
const s = slots.get(client) ?? { runs: new Map, ctls: new Map };
|
|
121
|
+
slots.set(client, s);
|
|
122
|
+
return s;
|
|
123
|
+
},
|
|
124
|
+
setFlag(client, key, dir, on) {
|
|
125
|
+
client.set(flags, (all) => {
|
|
126
|
+
const [n, p] = all[key] ?? NONE;
|
|
127
|
+
const next = dir === "next" ? [on, p] : [n, on];
|
|
128
|
+
if (next[0] === n && next[1] === p)
|
|
129
|
+
return all;
|
|
130
|
+
const { [key]: _, ...rest } = all;
|
|
131
|
+
return next[0] || next[1] ? { ...rest, [key]: next } : rest;
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
// src/infinite/infinite.ts
|
|
138
|
+
function infinite(o) {
|
|
139
|
+
const { fetch, connection, cursor, ...rest } = o;
|
|
140
|
+
const names = {
|
|
141
|
+
after: cursor?.after ?? "after",
|
|
142
|
+
before: cursor?.before ?? "before"
|
|
143
|
+
};
|
|
144
|
+
const slots = createSlots();
|
|
145
|
+
const lists = new WeakMap;
|
|
146
|
+
const page = (vars, p, ctx) => {
|
|
147
|
+
const base = { ...vars };
|
|
148
|
+
delete base[names.after];
|
|
149
|
+
delete base[names.before];
|
|
150
|
+
if (p.after !== undefined)
|
|
151
|
+
base[names.after] = p.after;
|
|
152
|
+
if (p.before !== undefined)
|
|
153
|
+
base[names.before] = p.before;
|
|
154
|
+
return fetch(base, ctx);
|
|
155
|
+
};
|
|
156
|
+
const withNodes = (d) => ({
|
|
157
|
+
...d,
|
|
158
|
+
nodes: d.pages.flatMap((p) => connection(p).edges.map((e) => e.node))
|
|
159
|
+
});
|
|
160
|
+
const read = (client, vars) => client.untracked(() => client.queries.state(q, vars).data);
|
|
161
|
+
const q = query2({
|
|
162
|
+
...rest,
|
|
163
|
+
fetch: (vars, ctx) => refetchAll({ page, connection }, vars, ctx, read(ctx.client, vars)),
|
|
164
|
+
derive: (client, s, vars) => {
|
|
165
|
+
const data = s.data;
|
|
166
|
+
const list = data && (lists.get(data) ?? withNodes(data));
|
|
167
|
+
if (data && list)
|
|
168
|
+
lists.set(data, list);
|
|
169
|
+
const [n, p] = client.get(slots.flags)[stableKey2(o.id, vars)] ?? NONE;
|
|
170
|
+
return {
|
|
171
|
+
...s,
|
|
172
|
+
data: list,
|
|
173
|
+
hasNext: cursorBeyond(connection, data, "next") !== undefined,
|
|
174
|
+
hasPrevious: cursorBeyond(connection, data, "previous") !== undefined,
|
|
175
|
+
isFetchingNext: n,
|
|
176
|
+
isFetchingPrevious: p
|
|
177
|
+
};
|
|
178
|
+
}
|
|
179
|
+
});
|
|
180
|
+
const more = {
|
|
181
|
+
id: o.id,
|
|
182
|
+
q,
|
|
183
|
+
slots,
|
|
184
|
+
connection,
|
|
185
|
+
page,
|
|
186
|
+
retry: rest.retry,
|
|
187
|
+
retryDelay: rest.retryDelay
|
|
188
|
+
};
|
|
189
|
+
return Object.freeze({
|
|
190
|
+
...q,
|
|
191
|
+
ensure: (client, ...args) => q.ensure(client, ...args).then(() => read(client, args[0])),
|
|
192
|
+
cancel(client, vars) {
|
|
193
|
+
const key = stableKey2(o.id, vars);
|
|
194
|
+
for (const d of ["next", "previous"])
|
|
195
|
+
slots.slot(client).ctls.get(`${d}:${key}`)?.abort();
|
|
196
|
+
client.queries.cancel(q, vars);
|
|
197
|
+
},
|
|
198
|
+
fetchNext: (client, vars) => fetchMore(more, "next", client, vars),
|
|
199
|
+
fetchPrevious: (client, vars) => fetchMore(more, "previous", client, vars)
|
|
200
|
+
});
|
|
201
|
+
}
|
|
202
|
+
export {
|
|
203
|
+
infinite
|
|
204
|
+
};
|
|
205
|
+
|
|
206
|
+
//# debugId=7454C5B87CAF9C4364756E2164756E21
|
|
207
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/infinite/refetch.ts", "../src/infinite/more.ts", "../src/infinite/slots.ts", "../src/infinite/infinite.ts"],
|
|
4
|
+
"sourcesContent": [
|
|
5
|
+
"import type { FetchContext } from '../query';\nimport type { Connection, InfiniteData, PageParam } from './types';\n\nexport interface Paging<Vars, Page, Node> {\n\tpage: (vars: Vars, p: PageParam, ctx: FetchContext) => Promise<Page>;\n\tconnection: (page: Page) => Connection<Node>;\n}\n\n/**\n * Re-runs the loaded pages in order from the first one's cursor, each next\n * cursor coming from the fresh page before it; stops when the list ends or\n * runs out of pages. Nothing is returned until every page has arrived.\n */\nexport async function refetchAll<Vars, Page, Node>(\n\t{ page, connection }: Paging<Vars, Page, Node>,\n\tvars: Vars,\n\tctx: FetchContext,\n\tcur: InfiniteData<Page> | undefined,\n): Promise<InfiniteData<Page>> {\n\tconst out: InfiniteData<Page> = { pages: [], params: [] };\n\tlet p: PageParam = cur?.params[0] ?? {};\n\tfor (let i = 0, n = cur?.pages.length || 1; i < n; i++) {\n\t\tconst next = await page(vars, p, ctx);\n\t\tout.pages.push(next);\n\t\tout.params.push(p);\n\t\tconst { hasNextPage, endCursor } = connection(next).pageInfo;\n\t\t// A page asked backwards does not say whether more follow it.\n\t\tif (endCursor == null || (!hasNextPage && p.before === undefined)) break;\n\t\tp = { after: endCursor };\n\t}\n\treturn out;\n}\n\nexport type Dir = 'next' | 'previous';\n\n/** The cursor to fetch beyond the loaded pages, or `undefined` at the end. */\nexport function cursorBeyond<Page, Node>(\n\tconnection: (page: Page) => Connection<Node>,\n\tdata: InfiniteData<Page> | undefined,\n\tdir: Dir,\n): string | undefined {\n\tconst at = dir === 'next' ? data?.pages.at(-1) : data?.pages[0];\n\tif (at === undefined) return;\n\tconst i = connection(at).pageInfo;\n\tconst cursor = dir === 'next' ? i.endCursor : i.startCursor;\n\treturn (dir === 'next' ? i.hasNextPage : i.hasPreviousPage) && cursor != null\n\t\t? cursor\n\t\t: undefined;\n}\n",
|
|
6
|
+
"import type { RivaClient } from '../client';\nimport { computed } from '../computed';\nimport { stableKey } from '../key';\nimport type { FetchContext, Query } from '../query';\nimport { raceAbort, withRetry } from '../retry';\nimport { cursorBeyond, type Dir } from './refetch';\nimport type { Slots } from './slots';\nimport type { Connection, InfiniteData, PageParam } from './types';\n\n/** What `fetchMore` needs of a feed definition. */\nexport interface More<Vars, Page, Node> {\n\tid: string;\n\tq: Query<Vars, InfiniteData<Page>>;\n\tslots: Slots;\n\tconnection: (page: Page) => Connection<Node>;\n\tpage: (vars: Vars, p: PageParam, ctx: FetchContext) => Promise<Page>;\n\tretry: Parameters<typeof withRetry>[1]['retry'];\n\tretryDelay: Parameters<typeof withRetry>[1]['retryDelay'];\n}\n\nconst noop = () => {};\n\n/** Whether the entry is fetching (a refetch of every loaded page, or its first load). */\nconst busyOf = <V, P, N>(c: More<V, P, N>, client: RivaClient, vars: V) =>\n\tcomputed(() => client.queries.state(c.q, vars).isFetching);\n\n/** Waits until the entry's refetch is no longer in flight. */\nasync function settled(\n\tclient: RivaClient,\n\tbusy: ReturnType<typeof computed<boolean>>,\n\tsignal: AbortSignal,\n): Promise<void> {\n\twhile (client.get(busy))\n\t\tawait raceAbort(\n\t\t\tnew Promise<void>((done) => {\n\t\t\t\tconst off = client.subscribe(busy, (b) => {\n\t\t\t\t\tif (b) return;\n\t\t\t\t\toff();\n\t\t\t\t\tdone();\n\t\t\t\t});\n\t\t\t}),\n\t\t\tsignal,\n\t\t);\n}\n\n/** The fetch loop: the page beyond the loaded ones, written only when no refetch runs and the list did not move. */\nasync function load<V, P, N>(\n\tc: More<V, P, N>,\n\tdir: Dir,\n\tclient: RivaClient,\n\tvars: V,\n\tkey: string,\n\tsignal: AbortSignal,\n): Promise<void> {\n\tconst data = () => client.untracked(() => client.queries.state(c.q, vars));\n\tconst busy = busyOf(c, client, vars);\n\tfor (;;) {\n\t\tawait settled(client, busy, signal);\n\t\tconst at = cursorBeyond(c.connection, data().data, dir);\n\t\tif (at === undefined) return;\n\t\tconst param: PageParam = dir === 'next' ? { after: at } : { before: at };\n\t\t// A refetch that ran meanwhile makes this page older than the list.\n\t\tlet refetched = false;\n\t\tconst off = client.subscribe(busy, (b) => {\n\t\t\trefetched ||= b;\n\t\t});\n\t\tconst next = await withRetry(client.queries.sched, c, signal, () =>\n\t\t\tc.page(vars, param, { signal, client }),\n\t\t).finally(off);\n\t\tawait settled(client, busy, signal);\n\t\tconst now = data();\n\t\tif (\n\t\t\trefetched ||\n\t\t\tnow.isFetching ||\n\t\t\tcursorBeyond(c.connection, now.data, dir) !== at\n\t\t)\n\t\t\tcontinue; // the list moved under the fetch: start again from its cursor\n\t\tconst invalid = client.queries.invalid(c.q, vars);\n\t\tclient.batch(() => {\n\t\t\tc.q.setData(client, vars, (d) => {\n\t\t\t\tconst { pages, params } = d ?? now.data ?? { pages: [], params: [] };\n\t\t\t\treturn dir === 'next'\n\t\t\t\t\t? { pages: [...pages, next], params: [...params, param] }\n\t\t\t\t\t: { pages: [next, ...pages], params: [param, ...params] };\n\t\t\t});\n\t\t\tc.slots.setFlag(client, key, dir, false);\n\t\t});\n\t\tif (invalid) c.q.invalidate(client, vars); // an invalidation is never lost\n\t\treturn;\n\t}\n}\n\n/** Appends or prepends one page. Deduped per client, entry and direction. */\nexport function fetchMore<V, P, N>(\n\tc: More<V, P, N>,\n\tdir: Dir,\n\tclient: RivaClient,\n\tvars: V,\n): Promise<void> {\n\tconst key = stableKey(c.id, vars);\n\tconst s = c.slots.slot(client);\n\tconst id = `${dir}:${key}`;\n\tconst running = s.runs.get(id);\n\tif (running) return running;\n\tconst st = client.untracked(() => client.queries.state(c.q, vars));\n\tif (!st.isFetching && cursorBeyond(c.connection, st.data, dir) === undefined)\n\t\treturn Promise.resolve();\n\tconst ctl = new AbortController();\n\tc.slots.setFlag(client, key, dir, true);\n\ts.ctls.set(id, ctl);\n\tconst run = load(c, dir, client, vars, key, ctl.signal)\n\t\t.catch((error) => {\n\t\t\tif (!ctl.signal.aborted) client.queries.fail(c.q, vars, error);\n\t\t\tthrow error;\n\t\t})\n\t\t.finally(() => {\n\t\t\ts.runs.delete(id);\n\t\t\ts.ctls.delete(id);\n\t\t\tc.slots.setFlag(client, key, dir, false);\n\t\t});\n\ts.runs.set(id, run);\n\trun.catch(noop);\n\treturn run;\n}\n",
|
|
7
|
+
"import type { RivaClient } from '../client';\nimport { type Signal, signal } from '../signal';\nimport type { Dir } from './refetch';\n\nexport type Flags = readonly [next: boolean, previous: boolean];\n\n/** What one client holds for a feed: its fetches in flight, by direction and entry. */\nexport interface Slot {\n\truns: Map<string, Promise<void>>;\n\tctls: Map<string, AbortController>;\n}\n\nexport const NONE: Flags = [false, false];\n\n/**\n * The per-client state of one feed definition. The fetching flags live in one\n * signal holding only the entries fetching now, so nothing outlives a fetch.\n */\nexport function createSlots() {\n\tconst flags: Signal<Readonly<Record<string, Flags>>> = signal({});\n\tconst slots = new WeakMap<RivaClient, Slot>();\n\treturn {\n\t\tflags,\n\t\tslot(client: RivaClient): Slot {\n\t\t\tconst s = slots.get(client) ?? { runs: new Map(), ctls: new Map() };\n\t\t\tslots.set(client, s);\n\t\t\treturn s;\n\t\t},\n\t\t/** Sets one direction's flag of an entry; the entry is dropped once both are false. */\n\t\tsetFlag(client: RivaClient, key: string, dir: Dir, on: boolean): void {\n\t\t\tclient.set(flags, (all) => {\n\t\t\t\tconst [n, p] = all[key] ?? NONE;\n\t\t\t\tconst next: Flags = dir === 'next' ? [on, p] : [n, on];\n\t\t\t\tif (next[0] === n && next[1] === p) return all;\n\t\t\t\tconst { [key]: _, ...rest } = all;\n\t\t\t\treturn next[0] || next[1] ? { ...rest, [key]: next } : rest;\n\t\t\t});\n\t\t},\n\t};\n}\n\nexport type Slots = ReturnType<typeof createSlots>;\n",
|
|
8
|
+
"import type { RivaClient } from '../client';\nimport { stableKey } from '../key';\nimport { type Query, query } from '../query';\nimport { fetchMore } from './more';\nimport { cursorBeyond, refetchAll } from './refetch';\nimport { createSlots, NONE } from './slots';\nimport type {\n\tFeedVars,\n\tInfinite,\n\tInfiniteData,\n\tInfiniteList,\n\tInfiniteOptions,\n\tPageParam,\n} from './types';\n\n/**\n * A cursor-paginated list: a query whose data is the loaded pages. A refetch\n * re-runs them all and swaps them in at once; `fetchNext` and `fetchPrevious`\n * add one page. Nodes flow through the `cache` policy like any query's data.\n */\nexport function infinite<\n\tV = void,\n\tPage = unknown,\n\tNode = unknown,\n\tA extends string = 'after',\n\tB extends string = 'before',\n>(\n\to: InfiniteOptions<V, Page, Node, A, B>,\n): Infinite<FeedVars<V, A | B>, Page, Node> {\n\ttype Vars = FeedVars<V, A | B>;\n\tconst { fetch, connection, cursor, ...rest } = o;\n\tconst names = {\n\t\tafter: cursor?.after ?? 'after',\n\t\tbefore: cursor?.before ?? 'before',\n\t};\n\tconst slots = createSlots();\n\tconst lists = new WeakMap<object, InfiniteList<Page, Node>>();\n\tconst page = (vars: Vars, p: PageParam, ctx: Parameters<typeof fetch>[1]) => {\n\t\t// The caller never owns the cursor variables: strip them before adding ours.\n\t\tconst base = { ...(vars as object) } as Record<string, unknown>;\n\t\tdelete base[names.after];\n\t\tdelete base[names.before];\n\t\tif (p.after !== undefined) base[names.after] = p.after;\n\t\tif (p.before !== undefined) base[names.before] = p.before;\n\t\treturn fetch(base as Parameters<typeof fetch>[0], ctx);\n\t};\n\tconst withNodes = (d: InfiniteData<Page>): InfiniteList<Page, Node> => ({\n\t\t...d,\n\t\tnodes: d.pages.flatMap((p) => connection(p).edges.map((e) => e.node)),\n\t});\n\tconst read = (client: RivaClient, vars: Vars) =>\n\t\tclient.untracked(() => client.queries.state(q, vars).data);\n\n\tconst q: Query<Vars, InfiniteData<Page>> = query<Vars, InfiniteData<Page>>({\n\t\t...rest,\n\t\tfetch: (vars, ctx) =>\n\t\t\trefetchAll({ page, connection }, vars, ctx, read(ctx.client, vars)),\n\t\tderive: (client, s, vars) => {\n\t\t\tconst data = s.data;\n\t\t\tconst list = data && (lists.get(data) ?? withNodes(data));\n\t\t\tif (data && list) lists.set(data, list);\n\t\t\tconst [n, p] = client.get(slots.flags)[stableKey(o.id, vars)] ?? NONE;\n\t\t\treturn {\n\t\t\t\t...s,\n\t\t\t\tdata: list,\n\t\t\t\thasNext: cursorBeyond(connection, data, 'next') !== undefined,\n\t\t\t\thasPrevious: cursorBeyond(connection, data, 'previous') !== undefined,\n\t\t\t\tisFetchingNext: n,\n\t\t\t\tisFetchingPrevious: p,\n\t\t\t};\n\t\t},\n\t});\n\tconst more = {\n\t\tid: o.id,\n\t\tq,\n\t\tslots,\n\t\tconnection,\n\t\tpage,\n\t\tretry: rest.retry,\n\t\tretryDelay: rest.retryDelay,\n\t};\n\n\treturn Object.freeze({\n\t\t...q,\n\t\tensure: (client: RivaClient, ...args: unknown[]) =>\n\t\t\t(q.ensure as (...a: unknown[]) => Promise<unknown>)(client, ...args).then(\n\t\t\t\t() => read(client, args[0] as Vars),\n\t\t\t),\n\t\tcancel(client: RivaClient, vars?: Vars) {\n\t\t\tconst key = stableKey(o.id, vars);\n\t\t\tfor (const d of ['next', 'previous'])\n\t\t\t\tslots.slot(client).ctls.get(`${d}:${key}`)?.abort();\n\t\t\tclient.queries.cancel(q, vars);\n\t\t},\n\t\tfetchNext: (client: RivaClient, vars?: Vars) =>\n\t\t\tfetchMore(more, 'next', client, vars as Vars),\n\t\tfetchPrevious: (client: RivaClient, vars?: Vars) =>\n\t\t\tfetchMore(more, 'previous', client, vars as Vars),\n\t}) as unknown as Infinite<Vars, Page, Node>;\n}\n"
|
|
9
|
+
],
|
|
10
|
+
"mappings": ";;;;;;;;;;;;;;;;AAaO,eAAe,UAA4B,GAC/C,MAAM,cACR,MACA,KACA,KAC8B;AAAA,EAC9B,MAAM,MAA0B,EAAE,OAAO,CAAC,GAAG,QAAQ,CAAC,EAAE;AAAA,EACxD,IAAI,IAAe,KAAK,OAAO,MAAM,CAAC;AAAA,EACtC,SAAS,IAAI,GAAG,IAAI,KAAK,MAAM,UAAU,EAAG,IAAI,GAAG,KAAK;AAAA,IACvD,MAAM,OAAO,MAAM,KAAK,MAAM,GAAG,GAAG;AAAA,IACpC,IAAI,MAAM,KAAK,IAAI;AAAA,IACnB,IAAI,OAAO,KAAK,CAAC;AAAA,IACjB,QAAQ,aAAa,cAAc,WAAW,IAAI,EAAE;AAAA,IAEpD,IAAI,aAAa,QAAS,CAAC,eAAe,EAAE,WAAW;AAAA,MAAY;AAAA,IACnE,IAAI,EAAE,OAAO,UAAU;AAAA,EACxB;AAAA,EACA,OAAO;AAAA;AAMD,SAAS,YAAwB,CACvC,YACA,MACA,KACqB;AAAA,EACrB,MAAM,KAAK,QAAQ,SAAS,MAAM,MAAM,GAAG,EAAE,IAAI,MAAM,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,IAAY;AAAA,EAClD,CAAC;AAAA;",
|
|
11
|
+
"debugId": "7454C5B87CAF9C4364756E2164756E21",
|
|
12
|
+
"names": []
|
|
13
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { FeedVars, Infinite, InfiniteOptions } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* A cursor-paginated list: a query whose data is the loaded pages. A refetch
|
|
4
|
+
* re-runs them all and swaps them in at once; `fetchNext` and `fetchPrevious`
|
|
5
|
+
* add one page. Nodes flow through the `cache` policy like any query's data.
|
|
6
|
+
*/
|
|
7
|
+
export declare function infinite<V = void, Page = unknown, Node = unknown, A extends string = 'after', B extends string = 'before'>(o: InfiniteOptions<V, Page, Node, A, B>): Infinite<FeedVars<V, A | B>, Page, Node>;
|
|
8
|
+
//# sourceMappingURL=infinite.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"infinite.d.ts","sourceRoot":"","sources":["../../src/infinite/infinite.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EACX,QAAQ,EACR,QAAQ,EAGR,eAAe,EAEf,MAAM,SAAS,CAAC;AAEjB;;;;GAIG;AACH,wBAAgB,QAAQ,CACvB,CAAC,GAAG,IAAI,EACR,IAAI,GAAG,OAAO,EACd,IAAI,GAAG,OAAO,EACd,CAAC,SAAS,MAAM,GAAG,OAAO,EAC1B,CAAC,SAAS,MAAM,GAAG,QAAQ,EAE3B,CAAC,EAAE,eAAe,CAAC,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,EAAE,CAAC,CAAC,GACrC,QAAQ,CAAC,QAAQ,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,CAuE1C"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { RivaClient } from '../client';
|
|
2
|
+
import type { FetchContext, Query } from '../query';
|
|
3
|
+
import { withRetry } from '../retry';
|
|
4
|
+
import { type Dir } from './refetch';
|
|
5
|
+
import type { Slots } from './slots';
|
|
6
|
+
import type { Connection, InfiniteData, PageParam } from './types';
|
|
7
|
+
/** What `fetchMore` needs of a feed definition. */
|
|
8
|
+
export interface More<Vars, Page, Node> {
|
|
9
|
+
id: string;
|
|
10
|
+
q: Query<Vars, InfiniteData<Page>>;
|
|
11
|
+
slots: Slots;
|
|
12
|
+
connection: (page: Page) => Connection<Node>;
|
|
13
|
+
page: (vars: Vars, p: PageParam, ctx: FetchContext) => Promise<Page>;
|
|
14
|
+
retry: Parameters<typeof withRetry>[1]['retry'];
|
|
15
|
+
retryDelay: Parameters<typeof withRetry>[1]['retryDelay'];
|
|
16
|
+
}
|
|
17
|
+
/** Appends or prepends one page. Deduped per client, entry and direction. */
|
|
18
|
+
export declare function fetchMore<V, P, N>(c: More<V, P, N>, dir: Dir, client: RivaClient, vars: V): Promise<void>;
|
|
19
|
+
//# sourceMappingURL=more.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"more.d.ts","sourceRoot":"","sources":["../../src/infinite/more.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAG5C,OAAO,KAAK,EAAE,YAAY,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AACpD,OAAO,EAAa,SAAS,EAAE,MAAM,UAAU,CAAC;AAChD,OAAO,EAAgB,KAAK,GAAG,EAAE,MAAM,WAAW,CAAC;AACnD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,KAAK,EAAE,UAAU,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAEnE,mDAAmD;AACnD,MAAM,WAAW,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI;IACrC,EAAE,EAAE,MAAM,CAAC;IACX,CAAC,EAAE,KAAK,CAAC,IAAI,EAAE,YAAY,CAAC,IAAI,CAAC,CAAC,CAAC;IACnC,KAAK,EAAE,KAAK,CAAC;IACb,UAAU,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,UAAU,CAAC,IAAI,CAAC,CAAC;IAC7C,IAAI,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,EAAE,SAAS,EAAE,GAAG,EAAE,YAAY,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACrE,KAAK,EAAE,UAAU,CAAC,OAAO,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC;IAChD,UAAU,EAAE,UAAU,CAAC,OAAO,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC;CAC1D;AA0ED,6EAA6E;AAC7E,wBAAgB,SAAS,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAChC,CAAC,EAAE,IAAI,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,EAChB,GAAG,EAAE,GAAG,EACR,MAAM,EAAE,UAAU,EAClB,IAAI,EAAE,CAAC,GACL,OAAO,CAAC,IAAI,CAAC,CAyBf"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { FetchContext } from '../query';
|
|
2
|
+
import type { Connection, InfiniteData, PageParam } from './types';
|
|
3
|
+
export interface Paging<Vars, Page, Node> {
|
|
4
|
+
page: (vars: Vars, p: PageParam, ctx: FetchContext) => Promise<Page>;
|
|
5
|
+
connection: (page: Page) => Connection<Node>;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Re-runs the loaded pages in order from the first one's cursor, each next
|
|
9
|
+
* cursor coming from the fresh page before it; stops when the list ends or
|
|
10
|
+
* runs out of pages. Nothing is returned until every page has arrived.
|
|
11
|
+
*/
|
|
12
|
+
export declare function refetchAll<Vars, Page, Node>({ page, connection }: Paging<Vars, Page, Node>, vars: Vars, ctx: FetchContext, cur: InfiniteData<Page> | undefined): Promise<InfiniteData<Page>>;
|
|
13
|
+
export type Dir = 'next' | 'previous';
|
|
14
|
+
/** The cursor to fetch beyond the loaded pages, or `undefined` at the end. */
|
|
15
|
+
export declare function cursorBeyond<Page, Node>(connection: (page: Page) => Connection<Node>, data: InfiniteData<Page> | undefined, dir: Dir): string | undefined;
|
|
16
|
+
//# sourceMappingURL=refetch.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"refetch.d.ts","sourceRoot":"","sources":["../../src/infinite/refetch.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAC7C,OAAO,KAAK,EAAE,UAAU,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAEnE,MAAM,WAAW,MAAM,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI;IACvC,IAAI,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,EAAE,SAAS,EAAE,GAAG,EAAE,YAAY,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACrE,UAAU,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,UAAU,CAAC,IAAI,CAAC,CAAC;CAC7C;AAED;;;;GAIG;AACH,wBAAsB,UAAU,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAChD,EAAE,IAAI,EAAE,UAAU,EAAE,EAAE,MAAM,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,EAC9C,IAAI,EAAE,IAAI,EACV,GAAG,EAAE,YAAY,EACjB,GAAG,EAAE,YAAY,CAAC,IAAI,CAAC,GAAG,SAAS,GACjC,OAAO,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC,CAa7B;AAED,MAAM,MAAM,GAAG,GAAG,MAAM,GAAG,UAAU,CAAC;AAEtC,8EAA8E;AAC9E,wBAAgB,YAAY,CAAC,IAAI,EAAE,IAAI,EACtC,UAAU,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,UAAU,CAAC,IAAI,CAAC,EAC5C,IAAI,EAAE,YAAY,CAAC,IAAI,CAAC,GAAG,SAAS,EACpC,GAAG,EAAE,GAAG,GACN,MAAM,GAAG,SAAS,CAQpB"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { RivaClient } from '../client';
|
|
2
|
+
import { type Signal } from '../signal';
|
|
3
|
+
import type { Dir } from './refetch';
|
|
4
|
+
export type Flags = readonly [next: boolean, previous: boolean];
|
|
5
|
+
/** What one client holds for a feed: its fetches in flight, by direction and entry. */
|
|
6
|
+
export interface Slot {
|
|
7
|
+
runs: Map<string, Promise<void>>;
|
|
8
|
+
ctls: Map<string, AbortController>;
|
|
9
|
+
}
|
|
10
|
+
export declare const NONE: Flags;
|
|
11
|
+
/**
|
|
12
|
+
* The per-client state of one feed definition. The fetching flags live in one
|
|
13
|
+
* signal holding only the entries fetching now, so nothing outlives a fetch.
|
|
14
|
+
*/
|
|
15
|
+
export declare function createSlots(): {
|
|
16
|
+
flags: Signal<Readonly<Record<string, Flags>>>;
|
|
17
|
+
slot(client: RivaClient): Slot;
|
|
18
|
+
/** Sets one direction's flag of an entry; the entry is dropped once both are false. */
|
|
19
|
+
setFlag(client: RivaClient, key: string, dir: Dir, on: boolean): void;
|
|
20
|
+
};
|
|
21
|
+
export type Slots = ReturnType<typeof createSlots>;
|
|
22
|
+
//# sourceMappingURL=slots.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"slots.d.ts","sourceRoot":"","sources":["../../src/infinite/slots.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAC5C,OAAO,EAAE,KAAK,MAAM,EAAU,MAAM,WAAW,CAAC;AAChD,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,WAAW,CAAC;AAErC,MAAM,MAAM,KAAK,GAAG,SAAS,CAAC,IAAI,EAAE,OAAO,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAC;AAEhE,uFAAuF;AACvF,MAAM,WAAW,IAAI;IACpB,IAAI,EAAE,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC;IACjC,IAAI,EAAE,GAAG,CAAC,MAAM,EAAE,eAAe,CAAC,CAAC;CACnC;AAED,eAAO,MAAM,IAAI,EAAE,KAAsB,CAAC;AAE1C;;;GAGG;AACH,wBAAgB,WAAW;;iBAKZ,UAAU,GAAG,IAAI;IAK9B,uFAAuF;oBACvE,UAAU,OAAO,MAAM,OAAO,GAAG,MAAM,OAAO,GAAG,IAAI;EAUtE;AAED,MAAM,MAAM,KAAK,GAAG,UAAU,CAAC,OAAO,WAAW,CAAC,CAAC"}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import type { RivaClient } from '../client';
|
|
2
|
+
import type { EnsureOptions, FetchContext, Query, QueryOptions, QueryState, VarsArgs } from '../query';
|
|
3
|
+
export interface Edge<Node> {
|
|
4
|
+
node: Node;
|
|
5
|
+
cursor?: string | null | undefined;
|
|
6
|
+
}
|
|
7
|
+
export interface PageInfo {
|
|
8
|
+
hasNextPage: boolean;
|
|
9
|
+
hasPreviousPage: boolean;
|
|
10
|
+
startCursor?: string | null | undefined;
|
|
11
|
+
endCursor?: string | null | undefined;
|
|
12
|
+
}
|
|
13
|
+
/** The Relay connection shape (edges and pageInfo) a page holds. */
|
|
14
|
+
export interface Connection<Node> {
|
|
15
|
+
edges: readonly Edge<Node>[];
|
|
16
|
+
pageInfo: PageInfo;
|
|
17
|
+
}
|
|
18
|
+
/** The cursor a page was fetched with: none for the first, `after` going forward, `before` going back. */
|
|
19
|
+
export interface PageParam {
|
|
20
|
+
after?: string;
|
|
21
|
+
before?: string;
|
|
22
|
+
}
|
|
23
|
+
/** What an infinite entry stores, and what `setData` and `tx.set` take: the pages and the cursor each was fetched with. */
|
|
24
|
+
export interface InfiniteData<Page> {
|
|
25
|
+
pages: Page[];
|
|
26
|
+
params: PageParam[];
|
|
27
|
+
}
|
|
28
|
+
/** What readers see: the stored data plus the flattened nodes (memoized per data). */
|
|
29
|
+
export interface InfiniteList<Page, Node> extends InfiniteData<Page> {
|
|
30
|
+
nodes: Node[];
|
|
31
|
+
}
|
|
32
|
+
export interface InfiniteState<Page, Node> extends QueryState<InfiniteList<Page, Node>> {
|
|
33
|
+
hasNext: boolean;
|
|
34
|
+
hasPrevious: boolean;
|
|
35
|
+
isFetchingNext: boolean;
|
|
36
|
+
isFetchingPrevious: boolean;
|
|
37
|
+
}
|
|
38
|
+
/** The variables a caller passes: those of `fetch` without the cursor variables `K`, `void` when none are left. */
|
|
39
|
+
export type FeedVars<V, K extends string = 'after' | 'before'> = [
|
|
40
|
+
keyof Omit<V, K>
|
|
41
|
+
] extends [never] ? void : Omit<V, K>;
|
|
42
|
+
/** The optional cursor variables `fetch` receives. */
|
|
43
|
+
export type Cursors<A extends string, B extends string> = {
|
|
44
|
+
[K in A]?: string;
|
|
45
|
+
} & {
|
|
46
|
+
[K in B]?: string;
|
|
47
|
+
};
|
|
48
|
+
export interface InfiniteOptions<V, Page, Node, A extends string = 'after', B extends string = 'before'> extends Omit<QueryOptions<FeedVars<V, A | B>, InfiniteData<Page>>, 'fetch' | 'derive'> {
|
|
49
|
+
/** Fetches one page; the cursor is merged into the variables. */
|
|
50
|
+
fetch: (vars: V & Cursors<NoInfer<A>, NoInfer<B>>, ctx: FetchContext) => Promise<Page>;
|
|
51
|
+
/** Reads the connection out of a page. */
|
|
52
|
+
connection: (page: Page) => Connection<Node>;
|
|
53
|
+
/** The variables the cursors travel under. Defaults `after` and `before`. */
|
|
54
|
+
cursor?: {
|
|
55
|
+
after?: A;
|
|
56
|
+
before?: B;
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
/** A stateless infinite list definition: a query over `{ pages, params }`. */
|
|
60
|
+
export interface Infinite<Vars, Page, Node> extends Omit<Query<Vars, InfiniteData<Page>, InfiniteState<Page, Node>>, 'ensure'> {
|
|
61
|
+
/** Loads the first page when missing or stale (every loaded page when stale). */
|
|
62
|
+
ensure(client: RivaClient, ...args: VarsArgs<Vars, [opts?: EnsureOptions]>): Promise<InfiniteList<Page, Node>>;
|
|
63
|
+
/** Appends the page after the last one. Deduped while in flight; a no-op without a next page. */
|
|
64
|
+
fetchNext(client: RivaClient, ...args: VarsArgs<Vars>): Promise<void>;
|
|
65
|
+
/** Prepends the page before the first one. Deduped while in flight; a no-op without a previous page. */
|
|
66
|
+
fetchPrevious(client: RivaClient, ...args: VarsArgs<Vars>): Promise<void>;
|
|
67
|
+
}
|
|
68
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/infinite/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAC5C,OAAO,KAAK,EACX,aAAa,EACb,YAAY,EACZ,KAAK,EACL,YAAY,EACZ,UAAU,EACV,QAAQ,EACR,MAAM,UAAU,CAAC;AAElB,MAAM,WAAW,IAAI,CAAC,IAAI;IACzB,IAAI,EAAE,IAAI,CAAC;IACX,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;CACnC;AAED,MAAM,WAAW,QAAQ;IACxB,WAAW,EAAE,OAAO,CAAC;IACrB,eAAe,EAAE,OAAO,CAAC;IACzB,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;IACxC,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;CACtC;AAED,oEAAoE;AACpE,MAAM,WAAW,UAAU,CAAC,IAAI;IAC/B,KAAK,EAAE,SAAS,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;IAC7B,QAAQ,EAAE,QAAQ,CAAC;CACnB;AAED,0GAA0G;AAC1G,MAAM,WAAW,SAAS;IACzB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,2HAA2H;AAC3H,MAAM,WAAW,YAAY,CAAC,I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G;AACpG,eAAO,MAAM,SAAS,OAAQ,MAAM,QAAQ,OAAO,KAAG,MACvB,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { RivaClient } from './client';
|
|
2
|
+
import type { MutationOptions, RunOptions } from './mutation';
|
|
3
|
+
/** The optimistic data and the server result, in the order mutations started. */
|
|
4
|
+
export declare function execute<Vars, Data>(client: RivaClient, o: MutationOptions<Vars, Data>, vars: Vars, opts?: RunOptions): Promise<Data>;
|
|
5
|
+
//# sourceMappingURL=mutation-run.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mutation-run.d.ts","sourceRoot":"","sources":["../src/mutation-run.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAE3C,OAAO,KAAK,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAM9D,iFAAiF;AACjF,wBAAsB,OAAO,CAAC,IAAI,EAAE,IAAI,EACvC,MAAM,EAAE,UAAU,EAClB,CAAC,EAAE,eAAe,CAAC,IAAI,EAAE,IAAI,CAAC,EAC9B,IAAI,EAAE,IAAI,EACV,IAAI,CAAC,EAAE,UAAU,GACf,OAAO,CAAC,IAAI,CAAC,CAkEf"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import type { RivaClient } from './client';
|
|
2
|
+
import type { CachePolicy, FetchContext, Query, VarsArgs } from './query';
|
|
3
|
+
import type { AnyQuery } from './query-entry';
|
|
4
|
+
/** What `optimistic` and `updates` write through. */
|
|
5
|
+
export interface Tx {
|
|
6
|
+
/**
|
|
7
|
+
* In `optimistic`: a layer over the query's data, dropped when the mutation
|
|
8
|
+
* settles (the updater gets the value below). In `updates`: the committed
|
|
9
|
+
* data (the updater gets the committed value).
|
|
10
|
+
*/
|
|
11
|
+
set<V, D>(query: Query<V, D>, vars: V, data: D | ((prev: D | undefined) => D)): void;
|
|
12
|
+
}
|
|
13
|
+
/** One entry of a query, built by `at`. */
|
|
14
|
+
export interface Target {
|
|
15
|
+
readonly query: AnyQuery;
|
|
16
|
+
readonly vars: unknown;
|
|
17
|
+
}
|
|
18
|
+
/** A query to invalidate (every entry), or `at(query, vars)` (one entry). */
|
|
19
|
+
export type Invalidation = AnyQuery | Target;
|
|
20
|
+
/** The entry of `query` with these variables, checked against the query's `Vars`. */
|
|
21
|
+
export declare const at: <V>(query: Query<V, any>, vars: V) => Target;
|
|
22
|
+
export interface MutationOptions<Vars, Data> {
|
|
23
|
+
/** Identifies the definition. */
|
|
24
|
+
id: string;
|
|
25
|
+
/** Sends the mutation. */
|
|
26
|
+
run: (vars: Vars, ctx: FetchContext) => Promise<Data>;
|
|
27
|
+
/** Normalizes the optimistic data and the server result (`entities()`). */
|
|
28
|
+
cache?: CachePolicy;
|
|
29
|
+
/** Shows the expected result at once: `tx.set` layers, and the returned data into the entities. */
|
|
30
|
+
optimistic?: (vars: Vars, tx: Tx) => Data | void;
|
|
31
|
+
/** Queries to mark stale (observed ones refetch) once the mutation succeeded. */
|
|
32
|
+
invalidates?: readonly Invalidation[] | ((data: Data, vars: Vars) => readonly Invalidation[]);
|
|
33
|
+
/** Writes the server result into committed query data. */
|
|
34
|
+
updates?: (tx: Tx, data: Data, vars: Vars) => void;
|
|
35
|
+
/** A count of retries, or a decision. Default 0. */
|
|
36
|
+
retry?: number | ((failures: number, error: unknown) => boolean);
|
|
37
|
+
/** Delay before a retry, in ms. Default `min(1000 * 2 ** failures, 30_000)`. */
|
|
38
|
+
retryDelay?: (failures: number) => number;
|
|
39
|
+
}
|
|
40
|
+
export interface RunOptions {
|
|
41
|
+
signal?: AbortSignal;
|
|
42
|
+
}
|
|
43
|
+
/** A stateless mutation definition. */
|
|
44
|
+
export interface Mutation<Vars, Data> {
|
|
45
|
+
readonly kind: 'mutation';
|
|
46
|
+
readonly id: string;
|
|
47
|
+
/** @internal */
|
|
48
|
+
readonly options: MutationOptions<Vars, Data>;
|
|
49
|
+
/** Resolves with the server data; rejects with the error, after the rollback. */
|
|
50
|
+
run(client: RivaClient, ...args: VarsArgs<Vars, [opts?: RunOptions]>): Promise<Data>;
|
|
51
|
+
}
|
|
52
|
+
export declare function mutation<Vars = void, Data = unknown>(options: MutationOptions<Vars, Data>): Mutation<Vars, Data>;
|
|
53
|
+
//# sourceMappingURL=mutation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mutation.d.ts","sourceRoot":"","sources":["../src/mutation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAE3C,OAAO,KAAK,EAAE,WAAW,EAAE,YAAY,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAC1E,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAE9C,qDAAqD;AACrD,MAAM,WAAW,EAAE;IAClB;;;;OAIG;IACH,GAAG,CAAC,CAAC,EAAE,CAAC,EACP,KAAK,EAAE,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,EAClB,IAAI,EAAE,CAAC,EACP,IAAI,EAAE,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC,GAAG,SAAS,KAAK,CAAC,CAAC,GACpC,IAAI,CAAC;CACR;AAED,2CAA2C;AAC3C,MAAM,WAAW,MAAM;IACtB,QAAQ,CAAC,KAAK,EAAE,QAAQ,CAAC;IACzB,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;CACvB;AAED,6EAA6E;AAC7E,MAAM,MAAM,YAAY,GAAG,QAAQ,GAAG,MAAM,CAAC;AAE7C,qFAAqF;AAErF,eAAO,MAAM,EAAE,GAAI,CAAC,SAAS,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC,QAAQ,CAAC,KAAG,MAGpD,CAAC;AAEH,MAAM,WAAW,eAAe,CAAC,IAAI,EAAE,IAAI;IAC1C,iCAAiC;IACjC,EAAE,EAAE,MAAM,CAAC;IAC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AC1C,OAAO,CAAC,IAAI,CAAC,CAAC;CACjB;AAED,wBAAgB,QAAQ,CAAC,IAAI,GAAG,IAAI,EAAE,IAAI,GAAG,OAAO,EACnD,OAAO,EAAE,eAAe,CAAC,IAAI,EAAE,IAAI,CAAC,GAClC,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAC,CAStB"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { RivaClient } from './client';
|
|
2
|
+
import type { ClientEvents, Scheduler } from './env';
|
|
3
|
+
import type { EnsureOptions, Query, QueryState } from './query';
|
|
4
|
+
import { type AnyQuery, type Ctx, type Lay } from './query-entry';
|
|
5
|
+
import { type ObserveOptions } from './query-observe';
|
|
6
|
+
import type { Listener } from './signal';
|
|
7
|
+
/** The query entries of one client: the operations the definitions and the client call. */
|
|
8
|
+
export declare function createQueryCache(client: RivaClient, sched: Scheduler, events: ClientEvents): {
|
|
9
|
+
sched: Scheduler;
|
|
10
|
+
/** The entries' shared context. @internal */
|
|
11
|
+
ctx: Ctx;
|
|
12
|
+
/** An optimistic layer over an entry; returns its drop. @internal */
|
|
13
|
+
lay(def: AnyQuery, vars: unknown, l: Lay): () => void;
|
|
14
|
+
/** A pure, tracked read: creates an idle entry, never fetches. */
|
|
15
|
+
state: <D>(def: Query<any, D>, vars: unknown) => QueryState<D>;
|
|
16
|
+
ensure<V, D>(def: Query<V, D>, vars: V, opts?: EnsureOptions): Promise<D>;
|
|
17
|
+
prefetch(def: AnyQuery, vars: unknown): void;
|
|
18
|
+
/** Starts a fetch only when the stored data cannot be read (an evicted entity); @internal */
|
|
19
|
+
missing(def: AnyQuery, vars: unknown): void;
|
|
20
|
+
/** One entry, or every entry of the definition when `vars` is undefined. */
|
|
21
|
+
invalidate(def: AnyQuery, vars?: unknown): void;
|
|
22
|
+
/** Invalidates every entry whose stored data the cache policy's test matches. @internal */
|
|
23
|
+
invalidateBy(test: (stored: unknown) => boolean): void;
|
|
24
|
+
setData<D>(def: Query<any, D>, vars: unknown, data: D | ((prev: D | undefined) => D)): void;
|
|
25
|
+
/** Whether the entry was invalidated and not refetched since. @internal */
|
|
26
|
+
invalid: (def: AnyQuery, vars: unknown) => boolean;
|
|
27
|
+
/** Sets an error on an entry and keeps its data (a failed side fetch). @internal */
|
|
28
|
+
fail(def: AnyQuery, vars: unknown, error: unknown): void;
|
|
29
|
+
cancel(def: AnyQuery, vars: unknown): void;
|
|
30
|
+
observe: <D>(def: Query<any, D>, vars: unknown, listener: Listener<QueryState<D>>, opts?: ObserveOptions) => import("./signal").Unsubscribe;
|
|
31
|
+
};
|
|
32
|
+
export type QueryCache = ReturnType<typeof createQueryCache>;
|
|
33
|
+
//# sourceMappingURL=query-cache.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"query-cache.d.ts","sourceRoot":"","sources":["../src/query-cache.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAC3C,OAAO,KAAK,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAGrD,OAAO,KAAK,EAAE,aAAa,EAAE,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAChE,OAAO,EACN,KAAK,QAAQ,EAEb,KAAK,GAAG,EAIR,KAAK,GAAG,EAQR,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,KAAK,cAAc,EAAW,MAAM,iBAAiB,CAAC;AAG/D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAQzC,2FAA2F;AAC3F,wBAAgB,gBAAgB,CAC/B,MAAM,EAAE,UAAU,EAClB,KAAK,EAAE,SAAS,EAChB,MAAM,EAAE,YAAY;;IAYnB,6CAA6C;;IAE7C,qEAAqE;aAC5D,QAAQ,QAAQ,OAAO,KAAK,GAAG,GAAG,MAAM,IAAI;IAKrD,kEAAkE;YAE1D,CAAC,OAAO,KAAK,CAAC,GAAG,EAAE,CAAC,CAAC,QAAQ,OAAO,KAAG,UAAU,CAAC,CAAC,CAAC;WAGrD,CAAC,EAAE,CAAC,OAAO,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,SAAS,aAAa,GAAG,OAAO,CAAC,CAAC,CAAC;kBAa3D,QAAQ,QAAQ,OAAO,GAAG,IAAI;IAK5C,6FAA6F;iBAChF,QAAQ,QAAQ,OAAO,GAAG,IAAI;IAK3C,4EAA4E;oBAC5D,QAAQ,SAAS,OAAO,GAAG,IAAI;IAO/C,2FAA2F;uBACxE,CAAC,MAAM,EAAE,OAAO,KAAK,OAAO,GAAG,IAAI;YAQ9C,CAAC,OAEH,KAAK,CAAC,GAAG,EAAE,CAAC,CAAC,QACZ,OAAO,QACP,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC,GAAG,SAAS,KAAK,CAAC,CAAC,GACpC,IAAI;IA2BP,2EAA2E;mBAC5D,QAAQ,QAAQ,OAAO,KAAG,OAAO;IAGhD,oFAAoF;cAC1E,QAAQ,QAAQ,OAAO,SAAS,OAAO,GAAG,IAAI;gBAI5C,QAAQ,QAAQ,OAAO,GAAG,IAAI;cAKhC,CAAC,OAEL,KAAK,CAAC,GAAG,EAAE,CAAC,CAAC,QACZ,OAAO,YACH,QAAQ,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,SAC1B,cAAc;EAGvB;AAED,MAAM,MAAM,UAAU,GAAG,UAAU,CAAC,OAAO,gBAAgB,CAAC,CAAC"}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import type { RivaClient } from './client';
|
|
2
|
+
import { type Readable } from './computed';
|
|
3
|
+
import type { ClientEvents, Scheduler } from './env';
|
|
4
|
+
import type { Query, QueryState } from './query';
|
|
5
|
+
import { type Signal } from './signal';
|
|
6
|
+
import type { SeedEntry } from './ssr/hydrate';
|
|
7
|
+
export type AnyQuery = Query<any, any>;
|
|
8
|
+
export type State = QueryState<unknown>;
|
|
9
|
+
export interface Inflight {
|
|
10
|
+
promise: Promise<unknown>;
|
|
11
|
+
/** Replaced on a restart (invalidate while in flight); aborted and kept on a cancel. */
|
|
12
|
+
ctl: AbortController;
|
|
13
|
+
waiters: number;
|
|
14
|
+
/** Started by a prefetch, a poll or a refetch: a caller abort never cancels it. */
|
|
15
|
+
pinned: boolean;
|
|
16
|
+
/** Set by `setData`: the waiters resolve with it instead of rejecting. */
|
|
17
|
+
set: {
|
|
18
|
+
v: unknown;
|
|
19
|
+
} | undefined;
|
|
20
|
+
/** The state to restore on cancel. */
|
|
21
|
+
prev: State;
|
|
22
|
+
}
|
|
23
|
+
/** An optimistic write: maps the value below it to the value readers see. */
|
|
24
|
+
export type Lay = (prev: unknown) => unknown;
|
|
25
|
+
export interface Entry {
|
|
26
|
+
key: string;
|
|
27
|
+
def: AnyQuery;
|
|
28
|
+
/** The definition a hot reload replaced: seen again, the id is shared. */
|
|
29
|
+
was?: AnyQuery['options'];
|
|
30
|
+
vars: unknown;
|
|
31
|
+
/** The graph signal holding the state: the one notification mechanism. */
|
|
32
|
+
signal: Signal<State>;
|
|
33
|
+
/** The optimistic layers over the signal's data, oldest first. */
|
|
34
|
+
lay: Signal<Lay[]>;
|
|
35
|
+
/** What readers see: the signal's data through the cache policy, under the layers. */
|
|
36
|
+
out: Readable<State>;
|
|
37
|
+
observers: number;
|
|
38
|
+
invalidated: boolean;
|
|
39
|
+
run: Inflight | undefined;
|
|
40
|
+
gc: unknown;
|
|
41
|
+
poll: unknown;
|
|
42
|
+
}
|
|
43
|
+
/** What one client's query cache shares between its files. */
|
|
44
|
+
export interface Ctx {
|
|
45
|
+
client: RivaClient;
|
|
46
|
+
sched: Scheduler;
|
|
47
|
+
events: ClientEvents;
|
|
48
|
+
entries: Map<string, Entry>;
|
|
49
|
+
/** Observers over every entry, to attach the window events once. */
|
|
50
|
+
observed: number;
|
|
51
|
+
detach: (() => void) | undefined;
|
|
52
|
+
/** Called on a new entry: `@softistx/riva/ssr` seeds it from a snapshot. @internal */
|
|
53
|
+
seed?: (c: Ctx, e: Entry) => void;
|
|
54
|
+
/** Snapshot entries waiting for their entry, by key. @internal */
|
|
55
|
+
pending?: Map<string, SeedEntry>;
|
|
56
|
+
}
|
|
57
|
+
/** The current state, untracked. */
|
|
58
|
+
export declare const peek: (c: Ctx, e: Entry) => State;
|
|
59
|
+
/** The state as readers see it (data read through the cache policy), untracked. */
|
|
60
|
+
export declare const view: (c: Ctx, e: Entry) => State;
|
|
61
|
+
/** The data without the entry's own layers, untracked. */
|
|
62
|
+
export declare const committed: (c: Ctx, e: Entry) => unknown;
|
|
63
|
+
/** Data is stored that the cache policy cannot read: an evicted entity, a field the server left out. */
|
|
64
|
+
export declare const unreadable: (c: Ctx, e: Entry) => boolean;
|
|
65
|
+
/** The message of the error of a fetch whose data the cache cannot read back. */
|
|
66
|
+
export declare const INCOMPLETE = "The cache cannot read the query's data after a fetch.";
|
|
67
|
+
/** The data as the entry stores it: through the cache policy, which may refuse it by throwing. */
|
|
68
|
+
export declare const toStored: (c: Ctx, e: Entry, data: unknown) => unknown;
|
|
69
|
+
/** Writes a patch whose `data` is already stored, then releases the data it replaced. */
|
|
70
|
+
export declare function putStored(c: Ctx, e: Entry, patch: Partial<State>): void;
|
|
71
|
+
/**
|
|
72
|
+
* Writes a patch that may carry new data, through the cache policy. A policy
|
|
73
|
+
* that refuses the data leaves the old data and sets the error state; the
|
|
74
|
+
* error is returned.
|
|
75
|
+
*/
|
|
76
|
+
export declare function putData(c: Ctx, e: Entry, patch: Partial<State>): unknown;
|
|
77
|
+
/** Writes a patch over the current state (one notification). */
|
|
78
|
+
export declare const put: (c: Ctx, e: Entry, patch: Partial<State>) => void;
|
|
79
|
+
/** Whether the entry must be fetched: not a success, invalidated, or older than `staleTime`. */
|
|
80
|
+
export declare const stale: (c: Ctx, e: Entry, staleTime?: number) => boolean;
|
|
81
|
+
/** Schedules the removal of an unobserved entry after `gcTime` (never on the server by default). */
|
|
82
|
+
export declare function armGc(c: Ctx, e: Entry): void;
|
|
83
|
+
export declare function entryOf(c: Ctx, def: AnyQuery, vars: unknown): Entry;
|
|
84
|
+
export type { QueryState };
|
|
85
|
+
//# sourceMappingURL=query-entry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"query-entry.d.ts","sourceRoot":"","sources":["../src/query-entry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAC3C,OAAO,EAAY,KAAK,QAAQ,EAAE,MAAM,YAAY,CAAC;AACrD,OAAO,KAAK,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAIrD,OAAO,KAAK,EAAE,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAEjD,OAAO,EAAE,KAAK,MAAM,EAAU,MAAM,UAAU,CAAC;AAC/C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAG/C,MAAM,MAAM,QAAQ,GAAG,KAAK,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;AACvC,MAAM,MAAM,KAAK,GAAG,UAAU,CAAC,OAAO,CAAC,CAAC;AAExC,MAAM,WAAW,QAAQ;IACxB,OAAO,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC;IAC1B,wFAAwF;IACxF,GAAG,EAAE,eAAe,CAAC;IACrB,OAAO,EAAE,MAAM,CAAC;IAChB,mFAAmF;IACnF,MAAM,EAAE,OAAO,CAAC;IAChB,0EAA0E;IAC1E,GAAG,EAAE;QAAE,CAAC,EAAE,OAAO,CAAA;KAAE,GAAG,SAAS,CAAC;IAChC,sCAAsC;IACtC,IAAI,EAAE,KAAK,CAAC;CACZ;AAED,6EAA6E;AAC7E,MAAM,MAAM,GAAG,GAAG,CAAC,IAAI,EAAE,OAAO,KAAK,OAAO,CAAC;AAE7C,MAAM,WAAW,KAAK;IACrB,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,QAAQ,CAAC;IACd,0EAA0E;IAC1E,GAAG,CAAC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