what-core 0.14.0 → 0.15.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 +64 -38
- package/a11y.d.ts +128 -0
- package/data.d.ts +294 -0
- package/dist/a11y.js +510 -0
- package/dist/a11y.min.js +413 -0
- package/dist/actions.js +158 -0
- package/dist/actions.min.js +112 -0
- package/dist/animation.js +481 -0
- package/dist/animation.min.js +295 -0
- package/dist/async.js +180 -0
- package/dist/async.min.js +134 -0
- package/dist/components.js +577 -0
- package/dist/components.min.js +413 -0
- package/dist/data.js +1212 -0
- package/dist/data.min.js +918 -0
- package/dist/diagnostics.js +187 -0
- package/dist/diagnostics.min.js +134 -0
- package/dist/dom.js +796 -0
- package/dist/dom.min.js +603 -0
- package/dist/entries/a11y.js +43 -0
- package/dist/entries/a11y.min.js +43 -0
- package/dist/entries/data.js +29 -0
- package/dist/entries/data.min.js +29 -0
- package/dist/entries/dom.js +45 -0
- package/dist/entries/dom.min.js +45 -0
- package/dist/entries/form.js +31 -0
- package/dist/entries/form.min.js +31 -0
- package/dist/entries/internal.js +123 -0
- package/dist/entries/internal.min.js +123 -0
- package/dist/entries/motion.js +23 -0
- package/dist/entries/motion.min.js +23 -0
- package/dist/entries/ui.js +25 -0
- package/dist/entries/ui.min.js +25 -0
- package/dist/env.js +5 -0
- package/dist/env.min.js +5 -0
- package/dist/errors.js +1518 -0
- package/dist/errors.min.js +548 -0
- package/dist/form.js +936 -0
- package/dist/form.min.js +703 -0
- package/dist/guardrails.js +84 -0
- package/dist/guardrails.min.js +55 -0
- package/dist/h.js +232 -0
- package/dist/h.min.js +171 -0
- package/dist/head.js +241 -0
- package/dist/head.min.js +207 -0
- package/dist/helpers.js +126 -0
- package/dist/helpers.min.js +98 -0
- package/dist/hooks.js +255 -0
- package/dist/hooks.min.js +153 -0
- package/dist/hot.js +215 -0
- package/dist/hot.min.js +24 -0
- package/dist/hydration-data.js +495 -0
- package/dist/hydration-data.min.js +371 -0
- package/dist/import-changes.js +273 -0
- package/dist/import-changes.min.js +272 -0
- package/dist/index.js +95 -0
- package/dist/index.min.js +95 -227
- package/dist/jsx-dev-runtime.js +10 -0
- package/dist/jsx-dev-runtime.min.js +10 -1
- package/dist/jsx-runtime.js +27 -0
- package/dist/jsx-runtime.min.js +15 -1
- package/dist/live.js +54 -0
- package/dist/live.min.js +49 -0
- package/dist/markup-rules.js +250 -0
- package/dist/markup-rules.min.js +213 -0
- package/dist/reactive.js +3334 -0
- package/dist/reactive.min.js +2033 -0
- package/dist/render.js +4746 -0
- package/dist/render.min.js +2797 -1
- package/dist/scheduler.js +225 -0
- package/dist/scheduler.min.js +162 -0
- package/dist/selector.js +11 -0
- package/dist/selector.min.js +10 -0
- package/dist/server-context.js +148 -0
- package/dist/server-context.min.js +121 -0
- package/dist/skeleton.js +342 -0
- package/dist/skeleton.min.js +310 -0
- package/dist/store.js +72 -0
- package/dist/store.min.js +50 -0
- package/dist/testing.js +720 -0
- package/dist/testing.min.js +458 -1
- package/dist/vnode-adoption.js +19 -0
- package/dist/vnode-adoption.min.js +19 -0
- package/dist/vnode-renderer.js +61 -0
- package/dist/vnode-renderer.min.js +47 -0
- package/dom.d.ts +44 -0
- package/form.d.ts +218 -0
- package/hot.d.ts +35 -0
- package/index.d.ts +421 -736
- package/internal.d.ts +284 -0
- package/jsx-runtime.d.ts +160 -137
- package/markup-rules.d.ts +83 -0
- package/motion.d.ts +156 -0
- package/package.json +117 -3
- package/render.d.ts +278 -29
- package/src/a11y.js +64 -59
- package/src/actions.js +226 -0
- package/src/animation.js +105 -57
- package/src/async.js +259 -0
- package/src/components.js +495 -144
- package/src/data.js +1410 -1159
- package/src/diagnostics.js +263 -0
- package/src/dom.js +1159 -872
- package/src/entries/a11y.js +24 -0
- package/src/entries/data.js +17 -0
- package/src/entries/dom.js +29 -0
- package/src/entries/form.js +16 -0
- package/src/entries/internal.js +63 -0
- package/src/entries/motion.js +13 -0
- package/src/entries/ui.js +13 -0
- package/src/env-development.js +12 -0
- package/src/env.js +33 -0
- package/src/errors.js +1144 -168
- package/src/form.js +723 -225
- package/src/guardrails.js +38 -126
- package/src/h.js +227 -152
- package/src/head.js +189 -19
- package/src/helpers.js +47 -75
- package/src/hooks.js +233 -248
- package/src/hot.js +316 -0
- package/src/hydration-data.js +859 -16
- package/src/import-changes.js +156 -0
- package/src/index.js +38 -188
- package/src/jsx-dev-runtime.js +7 -14
- package/src/jsx-runtime.js +25 -9
- package/src/live.js +80 -0
- package/src/markup-rules.js +387 -0
- package/src/reactive.js +4400 -862
- package/src/render.js +6502 -2570
- package/src/scheduler.js +56 -21
- package/src/selector.js +31 -0
- package/src/server-context.js +252 -22
- package/src/skeleton.js +22 -12
- package/src/store.js +17 -31
- package/src/testing.js +389 -63
- package/src/vnode-adoption.js +48 -0
- package/src/vnode-renderer.js +114 -0
- package/testing.d.ts +81 -1
- package/ui.d.ts +20 -0
- package/dist/chunk-6YOUZ6T4.min.js +0 -1
- package/dist/chunk-FN6HXME3.min.js +0 -11
- package/dist/chunk-VKZY7JPN.min.js +0 -1
- package/src/agent-context.js +0 -127
- package/src/warnings.js +0 -193
package/dist/data.js
ADDED
|
@@ -0,0 +1,1212 @@
|
|
|
1
|
+
// src/data.js
|
|
2
|
+
import {
|
|
3
|
+
signal,
|
|
4
|
+
effect,
|
|
5
|
+
computed,
|
|
6
|
+
untrack,
|
|
7
|
+
onCleanup,
|
|
8
|
+
getOwner,
|
|
9
|
+
createRoot,
|
|
10
|
+
runWithOwner,
|
|
11
|
+
_detached,
|
|
12
|
+
_asyncComputed,
|
|
13
|
+
_refresh,
|
|
14
|
+
_asyncStatus,
|
|
15
|
+
_asyncError,
|
|
16
|
+
_setAsyncValue,
|
|
17
|
+
_installSeedOps,
|
|
18
|
+
_isNotReady
|
|
19
|
+
} from "./reactive.js";
|
|
20
|
+
import { _seedFor, getResource, getResourceError, _errorFromRecord, _loadedResource } from "./hydration-data.js";
|
|
21
|
+
import { getServerContext, _isServerProcess } from "./server-context.js";
|
|
22
|
+
import { report } from "./diagnostics.js";
|
|
23
|
+
import { _enableSuspense, isHydrating } from "./render.js";
|
|
24
|
+
var PLAIN = 0;
|
|
25
|
+
var INFINITE = 1;
|
|
26
|
+
var IDLE = /* @__PURE__ */ Object.freeze({ toString: () => "[what] no data" });
|
|
27
|
+
var FETCH = 1;
|
|
28
|
+
var ADOPT = 2;
|
|
29
|
+
var DEFAULT_GC_TIME = 5 * 60 * 1e3;
|
|
30
|
+
function noop() {
|
|
31
|
+
}
|
|
32
|
+
function unrefTimer(timer) {
|
|
33
|
+
if (timer && typeof timer.unref === "function") timer.unref();
|
|
34
|
+
return timer;
|
|
35
|
+
}
|
|
36
|
+
function keyParts(key) {
|
|
37
|
+
return Array.isArray(key) && key.some((part) => typeof part === "function") ? key.map((part) => typeof part === "function" ? part() : part) : key;
|
|
38
|
+
}
|
|
39
|
+
function normalizeQueryKey(key) {
|
|
40
|
+
key = keyParts(key);
|
|
41
|
+
if (!Array.isArray(key)) return String(key);
|
|
42
|
+
return key.map((part) => typeof part === "string" ? part : JSON.stringify(part) ?? String(part)).map((part) => part.replace(/([\\:])/g, "\\$1")).join(":");
|
|
43
|
+
}
|
|
44
|
+
var CHANNEL = "query:";
|
|
45
|
+
var clientCache = [/* @__PURE__ */ new Map(), /* @__PURE__ */ new Map()];
|
|
46
|
+
var serverCaches = /* @__PURE__ */ new WeakMap();
|
|
47
|
+
function cacheOf(kind) {
|
|
48
|
+
const ctx = getServerContext();
|
|
49
|
+
if (ctx === null) {
|
|
50
|
+
if (!_isServerProcess()) return clientCache[kind];
|
|
51
|
+
if ((process.env.NODE_ENV !== "production")) report("ERR_QUERY_OUTSIDE_RENDER");
|
|
52
|
+
return /* @__PURE__ */ new Map();
|
|
53
|
+
}
|
|
54
|
+
let caches = serverCaches.get(ctx);
|
|
55
|
+
if (caches === void 0) serverCaches.set(ctx, caches = [/* @__PURE__ */ new Map(), /* @__PURE__ */ new Map()]);
|
|
56
|
+
return caches[kind];
|
|
57
|
+
}
|
|
58
|
+
var adopted = /* @__PURE__ */ new Set();
|
|
59
|
+
var channelOpen = true;
|
|
60
|
+
function hydrationSeed(hash) {
|
|
61
|
+
if (!channelOpen || adopted.has(hash)) return null;
|
|
62
|
+
const value = getResource(CHANNEL + hash);
|
|
63
|
+
if (value !== void 0) {
|
|
64
|
+
adopted.add(hash);
|
|
65
|
+
return { value, track: false };
|
|
66
|
+
}
|
|
67
|
+
const record2 = getResourceError(CHANNEL + hash);
|
|
68
|
+
if (record2 === void 0) return null;
|
|
69
|
+
adopted.add(hash);
|
|
70
|
+
return { error: _errorFromRecord(record2), track: false };
|
|
71
|
+
}
|
|
72
|
+
function entryFor(kind, hash, key, observer) {
|
|
73
|
+
const cache = cacheOf(kind);
|
|
74
|
+
let e = cache.get(hash);
|
|
75
|
+
if (e === void 0) {
|
|
76
|
+
e = newEntry(kind, hash, key, cache, observer);
|
|
77
|
+
cache.set(hash, e);
|
|
78
|
+
}
|
|
79
|
+
return e;
|
|
80
|
+
}
|
|
81
|
+
function newEntry(kind, hash, key, cache, observer) {
|
|
82
|
+
const e = {
|
|
83
|
+
kind,
|
|
84
|
+
hash,
|
|
85
|
+
key,
|
|
86
|
+
cache,
|
|
87
|
+
/** @type {any} */
|
|
88
|
+
node: null,
|
|
89
|
+
dispose: noop,
|
|
90
|
+
/** @type {any} */
|
|
91
|
+
flight: null,
|
|
92
|
+
next: 0,
|
|
93
|
+
/** @type {any} */
|
|
94
|
+
error: void 0,
|
|
95
|
+
version: 0,
|
|
96
|
+
updatedAt: 0,
|
|
97
|
+
fetchedAt: 0,
|
|
98
|
+
fetches: 0,
|
|
99
|
+
/** @type {any} */
|
|
100
|
+
last: null,
|
|
101
|
+
hydrated: false,
|
|
102
|
+
/** @type {Set<any>} */
|
|
103
|
+
observers: /* @__PURE__ */ new Set(),
|
|
104
|
+
gcTime: DEFAULT_GC_TIME,
|
|
105
|
+
/** @type {any} */
|
|
106
|
+
timer: null,
|
|
107
|
+
/** @type {any} */
|
|
108
|
+
conf: observer !== null ? observer.conf : null,
|
|
109
|
+
/** @type {any} */
|
|
110
|
+
src: null,
|
|
111
|
+
/** @type {any} */
|
|
112
|
+
by: null,
|
|
113
|
+
/** @type {any} */
|
|
114
|
+
op: null,
|
|
115
|
+
/** @type {Set<string> | null} */
|
|
116
|
+
paths: null,
|
|
117
|
+
dir: kind === INFINITE ? signal(
|
|
118
|
+
/** @type {string | null} */
|
|
119
|
+
null
|
|
120
|
+
) : null,
|
|
121
|
+
// Moves at every landing: query() reads it, not the node, while the entry
|
|
122
|
+
// has no data, so the engine never sees "a value being refetched" there.
|
|
123
|
+
tick: signal(0),
|
|
124
|
+
/** @type {{ promise: Promise<any>, resolve: (v: any) => void, reject: (e: any) => void } | null} */
|
|
125
|
+
arrival: null,
|
|
126
|
+
dropped: false
|
|
127
|
+
};
|
|
128
|
+
const ctx = getServerContext();
|
|
129
|
+
let seed;
|
|
130
|
+
if (ctx !== null) {
|
|
131
|
+
seed = _seedFor(CHANNEL + hash, false);
|
|
132
|
+
} else {
|
|
133
|
+
seed = kind === PLAIN ? hydrationSeed(hash) : null;
|
|
134
|
+
if (seed !== null) {
|
|
135
|
+
e.hydrated = true;
|
|
136
|
+
e.updatedAt = Date.now();
|
|
137
|
+
if ("error" in seed) e.error = seed.error;
|
|
138
|
+
queueMicrotask(() => {
|
|
139
|
+
e.hydrated = false;
|
|
140
|
+
});
|
|
141
|
+
} else if (observer !== null && observer.initialData !== void 0) {
|
|
142
|
+
const initial = typeof observer.initialData === "function" ? observer.initialData() : observer.initialData;
|
|
143
|
+
seed = { value: initial === void 0 ? IDLE : initial, track: false };
|
|
144
|
+
if (initial !== void 0) e.updatedAt = observer.initialDataUpdatedAt ?? Date.now();
|
|
145
|
+
} else {
|
|
146
|
+
seed = { value: IDLE, track: false };
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
_installSeedOps();
|
|
150
|
+
const make = () => createRoot((dispose) => {
|
|
151
|
+
e.dispose = dispose;
|
|
152
|
+
e.node = _asyncComputed(run(e), seed);
|
|
153
|
+
});
|
|
154
|
+
if (ctx !== null && ctx.owner) runWithOwner(ctx.owner, make);
|
|
155
|
+
else _detached(make);
|
|
156
|
+
return e;
|
|
157
|
+
}
|
|
158
|
+
function run(e) {
|
|
159
|
+
return () => {
|
|
160
|
+
const op = e.next;
|
|
161
|
+
e.next = 0;
|
|
162
|
+
if (op === ADOPT && e.flight !== null) return e.flight.promise;
|
|
163
|
+
if (op === 0) {
|
|
164
|
+
if (!wanted(e)) {
|
|
165
|
+
if (e.error !== void 0) throw e.error;
|
|
166
|
+
return untrack(() => e.node.peek());
|
|
167
|
+
}
|
|
168
|
+
e.by = lastActive(e);
|
|
169
|
+
}
|
|
170
|
+
return startFlight(e).promise;
|
|
171
|
+
};
|
|
172
|
+
}
|
|
173
|
+
function isPlainObject(v) {
|
|
174
|
+
if (v === null || typeof v !== "object") return false;
|
|
175
|
+
const proto = Object.getPrototypeOf(v);
|
|
176
|
+
return proto === Object.prototype || proto === null;
|
|
177
|
+
}
|
|
178
|
+
function replaceEqualDeep(prev, next) {
|
|
179
|
+
if (prev === next) return prev;
|
|
180
|
+
const array = Array.isArray(prev) && Array.isArray(next);
|
|
181
|
+
if (!array && !(isPlainObject(prev) && isPlainObject(next))) return next;
|
|
182
|
+
const prevKeys = array ? null : Object.keys(prev);
|
|
183
|
+
const prevSize = prevKeys === null ? prev.length : prevKeys.length;
|
|
184
|
+
const nextKeys = array ? null : Object.keys(next);
|
|
185
|
+
const nextSize = nextKeys === null ? next.length : nextKeys.length;
|
|
186
|
+
const copy = array ? new Array(nextSize) : {};
|
|
187
|
+
let equal = 0;
|
|
188
|
+
for (let i = 0; i < nextSize; i++) {
|
|
189
|
+
const key = nextKeys === null ? i : nextKeys[i];
|
|
190
|
+
const was = prev[key];
|
|
191
|
+
const shared = array || Object.prototype.hasOwnProperty.call(prev, key) ? replaceEqualDeep(was, next[key]) : next[key];
|
|
192
|
+
copy[key] = shared;
|
|
193
|
+
if (shared === was && (array ? i < prevSize : Object.prototype.hasOwnProperty.call(prev, key))) equal++;
|
|
194
|
+
}
|
|
195
|
+
return prevSize === nextSize && equal === prevSize ? prev : copy;
|
|
196
|
+
}
|
|
197
|
+
function sharing(option) {
|
|
198
|
+
if (option === false || option == null) return null;
|
|
199
|
+
return typeof option === "function" ? option : replaceEqualDeep;
|
|
200
|
+
}
|
|
201
|
+
function wanted(e) {
|
|
202
|
+
if (getServerContext() !== null) return true;
|
|
203
|
+
for (const o of e.observers) if (o.active()) return true;
|
|
204
|
+
return false;
|
|
205
|
+
}
|
|
206
|
+
function valueOf(e) {
|
|
207
|
+
const v = untrack(() => e.node.peek());
|
|
208
|
+
return v === IDLE ? void 0 : v;
|
|
209
|
+
}
|
|
210
|
+
function startFlight(e) {
|
|
211
|
+
const prev = e.flight;
|
|
212
|
+
if (prev !== null) kill(e, prev, true);
|
|
213
|
+
const ac = new AbortController();
|
|
214
|
+
const op = e.op;
|
|
215
|
+
e.op = null;
|
|
216
|
+
const from = sourceOf(e);
|
|
217
|
+
const f = {
|
|
218
|
+
ac,
|
|
219
|
+
dead: false,
|
|
220
|
+
superseded: false,
|
|
221
|
+
by: e.by,
|
|
222
|
+
conf: from.conf,
|
|
223
|
+
key: from.key,
|
|
224
|
+
// A prefetchQuery waits on it (it started it, joined it, or a flight it
|
|
225
|
+
// waited on was superseded by this one): no reader unmounting cancels it.
|
|
226
|
+
keep: from.keep === true || prev !== null && prev.keep,
|
|
227
|
+
op,
|
|
228
|
+
/** @type {any} */
|
|
229
|
+
promise: null,
|
|
230
|
+
failed: false,
|
|
231
|
+
/** @type {any} */
|
|
232
|
+
result: void 0,
|
|
233
|
+
/** @type {any} */
|
|
234
|
+
page: void 0,
|
|
235
|
+
started: Date.now(),
|
|
236
|
+
/** @type {(() => void) | null} */
|
|
237
|
+
onKill: null,
|
|
238
|
+
/** @type {any} */
|
|
239
|
+
at: null
|
|
240
|
+
};
|
|
241
|
+
f.at = { e, f };
|
|
242
|
+
e.by = null;
|
|
243
|
+
e.flight = f;
|
|
244
|
+
e.fetchedAt = f.started;
|
|
245
|
+
e.fetches++;
|
|
246
|
+
let first;
|
|
247
|
+
try {
|
|
248
|
+
first = callFetcher(e, f);
|
|
249
|
+
} catch (err) {
|
|
250
|
+
e.flight = null;
|
|
251
|
+
f.dead = true;
|
|
252
|
+
if (_isNotReady(err)) e.version++;
|
|
253
|
+
else record(e, f, err, true);
|
|
254
|
+
throw err;
|
|
255
|
+
}
|
|
256
|
+
f.promise = retrying(f.at, first);
|
|
257
|
+
watch(f.at, f.promise);
|
|
258
|
+
return f;
|
|
259
|
+
}
|
|
260
|
+
function sourceOf(e) {
|
|
261
|
+
for (const o of [e.by, e.src]) {
|
|
262
|
+
if (o != null && (o.hash === void 0 || untrack(o.hash) === e.hash)) return o;
|
|
263
|
+
}
|
|
264
|
+
return e;
|
|
265
|
+
}
|
|
266
|
+
function watch(at, promise) {
|
|
267
|
+
promise.then((v) => {
|
|
268
|
+
if (at.f !== null) landed(at.e, at.f, v, false);
|
|
269
|
+
}, (err) => {
|
|
270
|
+
if (at.f !== null) landed(at.e, at.f, err, true);
|
|
271
|
+
});
|
|
272
|
+
promise.then(noop, noop).then(() => {
|
|
273
|
+
if (at.f !== null) deliver(at.e, at.f);
|
|
274
|
+
});
|
|
275
|
+
}
|
|
276
|
+
function shareResult(at, result) {
|
|
277
|
+
return result.then((next) => {
|
|
278
|
+
if (at.f === null) return next;
|
|
279
|
+
const share = at.f.conf.share;
|
|
280
|
+
return share(valueOf(at.e), next);
|
|
281
|
+
});
|
|
282
|
+
}
|
|
283
|
+
function callFetcher(e, f) {
|
|
284
|
+
const conf = f.conf;
|
|
285
|
+
if (e.kind === PLAIN) {
|
|
286
|
+
const result = conf.run(f.key, f.ac.signal);
|
|
287
|
+
const share = conf.share;
|
|
288
|
+
if (share == null) return result;
|
|
289
|
+
return result != null && typeof result.then === "function" ? shareResult(f.at, result) : share(valueOf(e), result);
|
|
290
|
+
}
|
|
291
|
+
const base = valueOf(e) ?? { pages: [], pageParams: [] };
|
|
292
|
+
const op = f.op || { param: conf.initialPageParam, place: "first" };
|
|
293
|
+
const at = f.at;
|
|
294
|
+
return Promise.resolve(conf.run(f.key, op.param, f.ac.signal)).then((page) => {
|
|
295
|
+
if (at.f !== null) at.f.page = page;
|
|
296
|
+
if (op.place === "next") return { pages: [...base.pages, page], pageParams: [...base.pageParams, op.param] };
|
|
297
|
+
if (op.place === "previous") return { pages: [page, ...base.pages], pageParams: [op.param, ...base.pageParams] };
|
|
298
|
+
return { pages: [page], pageParams: [op.param] };
|
|
299
|
+
});
|
|
300
|
+
}
|
|
301
|
+
async function retrying(at, first) {
|
|
302
|
+
let pending = first;
|
|
303
|
+
for (let tries = 1; ; tries++) {
|
|
304
|
+
try {
|
|
305
|
+
return await pending;
|
|
306
|
+
} catch (err) {
|
|
307
|
+
if (at.f === null || tries >= attemptsOf(at.f.conf.retry, tries, err)) throw err;
|
|
308
|
+
await wait(at.f.conf.retryDelay(tries), at.f.ac.signal);
|
|
309
|
+
if (at.f === null) throw err;
|
|
310
|
+
pending = callFetcher(at.e, at.f);
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
function attemptsOf(retry, tries, err) {
|
|
315
|
+
if (typeof retry === "function") return retry(tries - 1, err) ? tries + 1 : tries;
|
|
316
|
+
if (retry === true) return Infinity;
|
|
317
|
+
if (retry === false) return 1;
|
|
318
|
+
return Math.max(1, Number(retry) || 0);
|
|
319
|
+
}
|
|
320
|
+
function wait(ms, abortSignal) {
|
|
321
|
+
return new Promise((resolve, reject) => {
|
|
322
|
+
const id = unrefTimer(setTimeout(resolve, ms));
|
|
323
|
+
abortSignal.addEventListener("abort", () => {
|
|
324
|
+
clearTimeout(id);
|
|
325
|
+
reject(new DOMException("Aborted", "AbortError"));
|
|
326
|
+
}, { once: true });
|
|
327
|
+
});
|
|
328
|
+
}
|
|
329
|
+
function landed(e, f, result, failed) {
|
|
330
|
+
f.failed = failed;
|
|
331
|
+
f.result = result;
|
|
332
|
+
if (f.dead) return;
|
|
333
|
+
if (e.flight === f) e.flight = null;
|
|
334
|
+
record(e, f, result, failed);
|
|
335
|
+
if (f.keep) armGc(e);
|
|
336
|
+
e.tick((n) => n + 1);
|
|
337
|
+
}
|
|
338
|
+
function record(e, f, result, failed) {
|
|
339
|
+
e.version++;
|
|
340
|
+
const now = Date.now();
|
|
341
|
+
e.updatedAt = now;
|
|
342
|
+
e.error = failed ? result : void 0;
|
|
343
|
+
e.last = { at: now, ms: now - f.started, ok: !failed };
|
|
344
|
+
if (e.dir !== null) e.dir(null);
|
|
345
|
+
answer(e, result, failed);
|
|
346
|
+
}
|
|
347
|
+
function arrive(e, result, failed) {
|
|
348
|
+
answer(e, result, failed);
|
|
349
|
+
e.tick((n) => n + 1);
|
|
350
|
+
}
|
|
351
|
+
function answer(e, result, failed) {
|
|
352
|
+
const a = e.arrival;
|
|
353
|
+
if (a !== null) {
|
|
354
|
+
e.arrival = null;
|
|
355
|
+
(failed ? a.reject : a.resolve)(result);
|
|
356
|
+
}
|
|
357
|
+
}
|
|
358
|
+
function arrival(e) {
|
|
359
|
+
if (e.arrival === null) {
|
|
360
|
+
let resolve = noop;
|
|
361
|
+
let reject = noop;
|
|
362
|
+
const promise = new Promise((res, rej) => {
|
|
363
|
+
resolve = res;
|
|
364
|
+
reject = rej;
|
|
365
|
+
});
|
|
366
|
+
e.arrival = { promise, resolve, reject };
|
|
367
|
+
}
|
|
368
|
+
return e.arrival.promise;
|
|
369
|
+
}
|
|
370
|
+
function kill(e, f, superseded) {
|
|
371
|
+
if (f.dead) return;
|
|
372
|
+
f.dead = true;
|
|
373
|
+
f.superseded = superseded;
|
|
374
|
+
f.at.e = f.at.f = null;
|
|
375
|
+
f.ac.abort(droppedReason());
|
|
376
|
+
if (e.flight === f) e.flight = null;
|
|
377
|
+
if (f.onKill !== null) f.onKill();
|
|
378
|
+
}
|
|
379
|
+
function droppedReason() {
|
|
380
|
+
const reason = new DOMException("The query was dropped.", "AbortError");
|
|
381
|
+
void reason.stack;
|
|
382
|
+
return reason;
|
|
383
|
+
}
|
|
384
|
+
function deliver(e, f) {
|
|
385
|
+
if (f.dead) return;
|
|
386
|
+
const o = f.by;
|
|
387
|
+
if (o === null || !o.alive) return;
|
|
388
|
+
if (f.failed) {
|
|
389
|
+
if (o.onError) o.onError(f.result, f.key);
|
|
390
|
+
if (o.onSettled) o.onSettled(null, f.result);
|
|
391
|
+
} else {
|
|
392
|
+
const value = e.kind === INFINITE ? f.page : f.result;
|
|
393
|
+
if (o.onSuccess) o.onSuccess(value, f.key);
|
|
394
|
+
if (o.onSettled) o.onSettled(value, null);
|
|
395
|
+
}
|
|
396
|
+
}
|
|
397
|
+
function outcome(e, f) {
|
|
398
|
+
if (f.dead) return Promise.resolve(follow(e, f));
|
|
399
|
+
const settled = flightValue(f.at, f.promise);
|
|
400
|
+
const dropped = new Promise((resolve) => {
|
|
401
|
+
const prev = f.onKill;
|
|
402
|
+
f.onKill = () => {
|
|
403
|
+
if (prev !== null) prev();
|
|
404
|
+
resolve(void 0);
|
|
405
|
+
};
|
|
406
|
+
}).then(() => follow(e, f));
|
|
407
|
+
return Promise.race([settled, dropped]);
|
|
408
|
+
}
|
|
409
|
+
function follow(e, f) {
|
|
410
|
+
return f.superseded && e.flight !== null ? outcome(e, e.flight) : void 0;
|
|
411
|
+
}
|
|
412
|
+
function flightValue(at, promise) {
|
|
413
|
+
return promise.then(
|
|
414
|
+
(v) => at.f === null ? new Promise(noop) : at.e.kind === INFINITE ? at.f.page : v,
|
|
415
|
+
(err) => at.f === null ? new Promise(noop) : Promise.reject(err)
|
|
416
|
+
);
|
|
417
|
+
}
|
|
418
|
+
function fetchEntry(e, by, op) {
|
|
419
|
+
e.by = by;
|
|
420
|
+
e.op = op || null;
|
|
421
|
+
e.next = FETCH;
|
|
422
|
+
if (e.dir !== null) e.dir(op ? op.dir : "next");
|
|
423
|
+
const refreshed = refreshNode(e);
|
|
424
|
+
e.next = 0;
|
|
425
|
+
e.by = null;
|
|
426
|
+
e.op = null;
|
|
427
|
+
return refreshed;
|
|
428
|
+
}
|
|
429
|
+
function refreshNode(e) {
|
|
430
|
+
const refreshed = _refresh(e.node);
|
|
431
|
+
refreshed.then(noop, noop);
|
|
432
|
+
return refreshed;
|
|
433
|
+
}
|
|
434
|
+
function refetchOf(e, by, op) {
|
|
435
|
+
fetchEntry(e, by, op);
|
|
436
|
+
return e.flight !== null ? outcome(e, e.flight) : Promise.resolve(valueOf(e));
|
|
437
|
+
}
|
|
438
|
+
function commitValue(e, value) {
|
|
439
|
+
if (e.flight !== null) kill(e, e.flight, false);
|
|
440
|
+
if (e.dir !== null) e.dir(null);
|
|
441
|
+
e.version++;
|
|
442
|
+
_setAsyncValue(e.node, value);
|
|
443
|
+
if (value !== IDLE) arrive(e, value, false);
|
|
444
|
+
else e.tick((n) => n + 1);
|
|
445
|
+
}
|
|
446
|
+
function setEntry(e, value) {
|
|
447
|
+
e.updatedAt = Date.now();
|
|
448
|
+
e.error = void 0;
|
|
449
|
+
commitValue(e, value);
|
|
450
|
+
}
|
|
451
|
+
function dropEntry(e) {
|
|
452
|
+
if (e.dropped) return;
|
|
453
|
+
e.dropped = true;
|
|
454
|
+
if (e.timer !== null) clearTimeout(e.timer);
|
|
455
|
+
if (e.flight !== null) kill(e, e.flight, false);
|
|
456
|
+
if (e.cache.get(e.hash) === e) e.cache.delete(e.hash);
|
|
457
|
+
e.dispose();
|
|
458
|
+
}
|
|
459
|
+
var pathTag = (
|
|
460
|
+
/** @type {string | null} */
|
|
461
|
+
null
|
|
462
|
+
);
|
|
463
|
+
var PAGE_PATH = /* @__PURE__ */ Symbol.for("what.router.path.v1");
|
|
464
|
+
function _tagQueries(path, fn) {
|
|
465
|
+
const prev = pathTag;
|
|
466
|
+
pathTag = path;
|
|
467
|
+
try {
|
|
468
|
+
return fn();
|
|
469
|
+
} finally {
|
|
470
|
+
pathTag = prev;
|
|
471
|
+
}
|
|
472
|
+
}
|
|
473
|
+
function _pathLoaded(path) {
|
|
474
|
+
const waits = [];
|
|
475
|
+
for (const e of allEntries()) {
|
|
476
|
+
if (e.flight !== null && e.paths !== null && e.paths.has(path) && e.error === void 0 && valueOf(e) === void 0) {
|
|
477
|
+
waits.push(outcome(e, e.flight).then(noop, noop));
|
|
478
|
+
}
|
|
479
|
+
}
|
|
480
|
+
return waits.length === 0 ? Promise.resolve() : Promise.all(waits).then(() => _pathLoaded(path));
|
|
481
|
+
}
|
|
482
|
+
function acquire(e, o) {
|
|
483
|
+
if (e.dropped) {
|
|
484
|
+
e.dropped = false;
|
|
485
|
+
if (!e.cache.has(e.hash)) e.cache.set(e.hash, e);
|
|
486
|
+
}
|
|
487
|
+
if (e.timer !== null) {
|
|
488
|
+
clearTimeout(e.timer);
|
|
489
|
+
e.timer = null;
|
|
490
|
+
}
|
|
491
|
+
e.gcTime = e.observers.size === 0 ? o.gcTime : Math.max(e.gcTime, o.gcTime);
|
|
492
|
+
e.observers.add(o);
|
|
493
|
+
e.src = o;
|
|
494
|
+
e.conf = o.conf;
|
|
495
|
+
e.key = o.key;
|
|
496
|
+
const path = o.path ?? /** @type {any} */
|
|
497
|
+
globalThis[PAGE_PATH]?.() ?? (typeof location !== "undefined" ? location.pathname : null);
|
|
498
|
+
if (path != null) (e.paths || (e.paths = /* @__PURE__ */ new Set())).add(path);
|
|
499
|
+
}
|
|
500
|
+
function release(e, o) {
|
|
501
|
+
if (!e.observers.delete(o)) return;
|
|
502
|
+
if (e.src === o) e.src = null;
|
|
503
|
+
if (e.observers.size > 0) return;
|
|
504
|
+
if (e.flight !== null && !e.flight.keep) commitValue(e, untrack(() => e.node.peek()));
|
|
505
|
+
armGc(e);
|
|
506
|
+
}
|
|
507
|
+
function armGc(e) {
|
|
508
|
+
if (e.cache !== clientCache[e.kind] || e.observers.size > 0 || e.dropped) return;
|
|
509
|
+
if (e.timer !== null) clearTimeout(e.timer);
|
|
510
|
+
e.timer = !e.flight?.keep && Number.isFinite(e.gcTime) ? unrefTimer(setTimeout(() => {
|
|
511
|
+
e.timer = null;
|
|
512
|
+
if (e.observers.size === 0) dropEntry(e);
|
|
513
|
+
}, e.gcTime)) : null;
|
|
514
|
+
}
|
|
515
|
+
function settle(o, e) {
|
|
516
|
+
for (const x of o.entries) {
|
|
517
|
+
if (x !== e) {
|
|
518
|
+
o.entries.delete(x);
|
|
519
|
+
release(x, o);
|
|
520
|
+
}
|
|
521
|
+
}
|
|
522
|
+
if (e !== null) hold(o, e);
|
|
523
|
+
o.entry = e;
|
|
524
|
+
}
|
|
525
|
+
function hold(o, e) {
|
|
526
|
+
if (o.entries.has(e)) return;
|
|
527
|
+
o.entries.add(e);
|
|
528
|
+
acquire(e, o);
|
|
529
|
+
}
|
|
530
|
+
function holdFromRead(o, e) {
|
|
531
|
+
if (getServerContext() !== null || !o.alive) return;
|
|
532
|
+
hold(o, e);
|
|
533
|
+
if (o.entries.size > 1 && !o.sweeping) {
|
|
534
|
+
o.sweeping = true;
|
|
535
|
+
queueMicrotask(() => {
|
|
536
|
+
o.sweeping = false;
|
|
537
|
+
if (o.alive) settle(o, untrack(o.current));
|
|
538
|
+
});
|
|
539
|
+
}
|
|
540
|
+
}
|
|
541
|
+
function readKey(keyFn, lenient) {
|
|
542
|
+
if (!lenient) return keyParts(keyFn());
|
|
543
|
+
try {
|
|
544
|
+
return keyParts(keyFn());
|
|
545
|
+
} catch {
|
|
546
|
+
return null;
|
|
547
|
+
}
|
|
548
|
+
}
|
|
549
|
+
function observe(kind, key, conf, opts) {
|
|
550
|
+
const o = {
|
|
551
|
+
kind,
|
|
552
|
+
conf,
|
|
553
|
+
alive: true,
|
|
554
|
+
/** @type {any} */
|
|
555
|
+
entry: null,
|
|
556
|
+
/** @type {Set<any>} */
|
|
557
|
+
entries: /* @__PURE__ */ new Set(),
|
|
558
|
+
/** @type {any} */
|
|
559
|
+
previous: null,
|
|
560
|
+
sweeping: false,
|
|
561
|
+
gate: opts.gate || null,
|
|
562
|
+
staleTime: opts.staleTime ?? 0,
|
|
563
|
+
gcTime: opts.gcTime ?? DEFAULT_GC_TIME,
|
|
564
|
+
initialData: opts.initialData,
|
|
565
|
+
initialDataUpdatedAt: opts.initialDataUpdatedAt,
|
|
566
|
+
onSuccess: opts.onSuccess,
|
|
567
|
+
onError: opts.onError,
|
|
568
|
+
onSettled: opts.onSettled,
|
|
569
|
+
path: pathTag,
|
|
570
|
+
active: () => o.alive && (o.gate === null || o.gate.peek()),
|
|
571
|
+
/** @type {() => any} */
|
|
572
|
+
current: noop,
|
|
573
|
+
// The key as this observer wrote it last: a new spelling of the same
|
|
574
|
+
// entry ('q:a', then ['q', 'a']) moves it without moving the entry.
|
|
575
|
+
/** @type {any} */
|
|
576
|
+
key: null,
|
|
577
|
+
/** @type {() => string | null} */
|
|
578
|
+
hash: () => null
|
|
579
|
+
};
|
|
580
|
+
const keyFn = typeof key === "function" ? key : () => key;
|
|
581
|
+
const hash = computed(() => {
|
|
582
|
+
const k = readKey(keyFn, opts.lenient);
|
|
583
|
+
o.key = k;
|
|
584
|
+
return k == null || k === false ? null : normalizeQueryKey(k);
|
|
585
|
+
});
|
|
586
|
+
o.hash = hash;
|
|
587
|
+
let last = null;
|
|
588
|
+
o.current = computed(() => {
|
|
589
|
+
const h = hash();
|
|
590
|
+
const e = h === null ? null : entryFor(kind, h, o.key, o);
|
|
591
|
+
if (e !== last) {
|
|
592
|
+
if (last !== null) o.previous = last;
|
|
593
|
+
last = e;
|
|
594
|
+
}
|
|
595
|
+
return e;
|
|
596
|
+
});
|
|
597
|
+
if (getServerContext() !== null) return o;
|
|
598
|
+
let wasOpen = false;
|
|
599
|
+
effect(() => {
|
|
600
|
+
const e = o.current();
|
|
601
|
+
const open = o.gate === null || o.gate();
|
|
602
|
+
untrack(() => {
|
|
603
|
+
const attaching = e !== null && !o.entries.has(e);
|
|
604
|
+
const opening = open && !wasOpen;
|
|
605
|
+
wasOpen = open;
|
|
606
|
+
settle(o, e);
|
|
607
|
+
if (e !== null && open && (attaching || opening) && stale(e, o)) fetchEntry(e, o);
|
|
608
|
+
});
|
|
609
|
+
});
|
|
610
|
+
if (getOwner() !== null) {
|
|
611
|
+
onCleanup(() => {
|
|
612
|
+
o.alive = false;
|
|
613
|
+
settle(o, null);
|
|
614
|
+
});
|
|
615
|
+
}
|
|
616
|
+
return o;
|
|
617
|
+
}
|
|
618
|
+
function stale(e, o) {
|
|
619
|
+
if (e.flight !== null || e.hydrated) return false;
|
|
620
|
+
if (e.error !== void 0 || valueOf(e) === void 0) return true;
|
|
621
|
+
return Date.now() - e.updatedAt >= o.staleTime;
|
|
622
|
+
}
|
|
623
|
+
function stateOf(o) {
|
|
624
|
+
if (getServerContext() !== null || isHydrating()) return firstState(o);
|
|
625
|
+
const e = o.current();
|
|
626
|
+
if (e === null) return { value: void 0, error: null, fetching: false, first: false, e };
|
|
627
|
+
const n = e.node;
|
|
628
|
+
const status = _asyncStatus(n);
|
|
629
|
+
try {
|
|
630
|
+
n();
|
|
631
|
+
} catch {
|
|
632
|
+
}
|
|
633
|
+
const v = n.peek();
|
|
634
|
+
return {
|
|
635
|
+
value: v === IDLE ? void 0 : v,
|
|
636
|
+
error: status === "errored" ? _asyncError(n) : null,
|
|
637
|
+
fetching: status === "pending" || status === "unresolved",
|
|
638
|
+
first: false,
|
|
639
|
+
e
|
|
640
|
+
};
|
|
641
|
+
}
|
|
642
|
+
var walked = /* @__PURE__ */ signal(0);
|
|
643
|
+
var walkEnding = false;
|
|
644
|
+
var loadedBy = /* @__PURE__ */ new WeakMap();
|
|
645
|
+
function firstState(o) {
|
|
646
|
+
const ctx = getServerContext();
|
|
647
|
+
if (ctx === null) {
|
|
648
|
+
walked();
|
|
649
|
+
if (!walkEnding) {
|
|
650
|
+
walkEnding = true;
|
|
651
|
+
queueMicrotask(() => {
|
|
652
|
+
walkEnding = false;
|
|
653
|
+
walked((n) => n + 1);
|
|
654
|
+
});
|
|
655
|
+
}
|
|
656
|
+
}
|
|
657
|
+
const h = untrack(o.hash);
|
|
658
|
+
if (h !== null && (ctx !== null ? loadedBy.get(ctx)?.has(h) : _loadedResource(CHANNEL + h))) {
|
|
659
|
+
const value = ctx !== null ? valueOf(untrack(o.current)) : getResource(CHANNEL + h);
|
|
660
|
+
return { value, error: null, fetching: false, first: false, e: null };
|
|
661
|
+
}
|
|
662
|
+
const initial = o.initialData;
|
|
663
|
+
return { value: typeof initial === "function" ? untrack(initial) : initial, error: null, fetching: false, first: true, e: null };
|
|
664
|
+
}
|
|
665
|
+
function _loadedQueries(ctx) {
|
|
666
|
+
const done = /* @__PURE__ */ new Set();
|
|
667
|
+
for (const [hash, e] of serverCaches.get(ctx)?.[PLAIN] ?? []) {
|
|
668
|
+
if (e.flight === null && e.error === void 0 && valueOf(e) !== void 0) done.add(hash);
|
|
669
|
+
}
|
|
670
|
+
loadedBy.set(ctx, done);
|
|
671
|
+
return [...done].map((hash) => CHANNEL + hash);
|
|
672
|
+
}
|
|
673
|
+
function createGate(enabled) {
|
|
674
|
+
const read = typeof enabled === "function" ? enabled : () => enabled;
|
|
675
|
+
const gate = signal(untrack(() => !!read()));
|
|
676
|
+
if (getServerContext() === null) effect(() => {
|
|
677
|
+
gate(!!read());
|
|
678
|
+
});
|
|
679
|
+
return gate;
|
|
680
|
+
}
|
|
681
|
+
function onWindow(o, events, check) {
|
|
682
|
+
if (getServerContext() !== null || typeof window === "undefined") return;
|
|
683
|
+
effect(() => {
|
|
684
|
+
const handler = () => {
|
|
685
|
+
if (events[0] === "visibilitychange" && document.visibilityState !== "visible") return;
|
|
686
|
+
const e = o.entry;
|
|
687
|
+
if (e !== null && o.active() && check(e)) fetchEntry(e, o);
|
|
688
|
+
};
|
|
689
|
+
const target = events[0] === "visibilitychange" ? document : window;
|
|
690
|
+
target.addEventListener(events[0], handler);
|
|
691
|
+
return () => target.removeEventListener(events[0], handler);
|
|
692
|
+
});
|
|
693
|
+
}
|
|
694
|
+
function poll(o, interval) {
|
|
695
|
+
if (!interval || getServerContext() !== null) return;
|
|
696
|
+
effect(() => {
|
|
697
|
+
const id = unrefTimer(setInterval(() => {
|
|
698
|
+
const e = o.entry;
|
|
699
|
+
if (e !== null && o.active() && e.flight === null) fetchEntry(e, o);
|
|
700
|
+
}, interval));
|
|
701
|
+
return () => clearInterval(id);
|
|
702
|
+
});
|
|
703
|
+
}
|
|
704
|
+
function asArray(key) {
|
|
705
|
+
return Array.isArray(key) ? key : [key];
|
|
706
|
+
}
|
|
707
|
+
var defaultRetryDelay = (attempt2) => Math.min(1e3 * 2 ** attempt2, 3e4);
|
|
708
|
+
function query(key, fetcher, options = {}) {
|
|
709
|
+
_enableSuspense();
|
|
710
|
+
const o = observe(PLAIN, key, {
|
|
711
|
+
run: (k, abortSignal) => fetcher(k, { signal: abortSignal }),
|
|
712
|
+
retry: options.retry ?? 1,
|
|
713
|
+
retryDelay: options.retryDelay ?? defaultRetryDelay
|
|
714
|
+
}, {
|
|
715
|
+
staleTime: options.staleTime,
|
|
716
|
+
gcTime: options.gcTime,
|
|
717
|
+
initialData: options.initialData
|
|
718
|
+
});
|
|
719
|
+
if (getServerContext() !== null) {
|
|
720
|
+
const e = untrack(o.current);
|
|
721
|
+
if (e === null) return _asyncComputed(noop, { value: void 0, track: false });
|
|
722
|
+
untrack(() => _asyncStatus(e.node));
|
|
723
|
+
return e.node;
|
|
724
|
+
}
|
|
725
|
+
let seen = null;
|
|
726
|
+
return _asyncComputed(() => {
|
|
727
|
+
const e = o.current();
|
|
728
|
+
if (e === null) {
|
|
729
|
+
seen = null;
|
|
730
|
+
return void 0;
|
|
731
|
+
}
|
|
732
|
+
holdFromRead(o, e);
|
|
733
|
+
const again = seen !== null && seen.e === e && seen.version === e.version;
|
|
734
|
+
seen = { e, version: e.version };
|
|
735
|
+
if (untrack(() => e.node.peek()) === IDLE) {
|
|
736
|
+
e.tick();
|
|
737
|
+
if (again || e.flight === null && e.error === void 0) fetchEntry(e, o);
|
|
738
|
+
seen.version = e.version;
|
|
739
|
+
if (e.error !== void 0 && e.flight === null) throw e.error;
|
|
740
|
+
return arrival(e);
|
|
741
|
+
}
|
|
742
|
+
if (again) fetchEntry(e, o);
|
|
743
|
+
seen.version = e.version;
|
|
744
|
+
const read = attempt(e.node);
|
|
745
|
+
if (read.waiting !== null) return read.waiting.then(() => settledValue(e));
|
|
746
|
+
if (read.failed) throw read.value;
|
|
747
|
+
return read.value;
|
|
748
|
+
}, null);
|
|
749
|
+
}
|
|
750
|
+
function attempt(n) {
|
|
751
|
+
try {
|
|
752
|
+
return { value: n(), waiting: null, failed: false };
|
|
753
|
+
} catch (err) {
|
|
754
|
+
if (_isNotReady(err)) return { value: void 0, waiting: err, failed: false };
|
|
755
|
+
return { value: err, waiting: null, failed: true };
|
|
756
|
+
}
|
|
757
|
+
}
|
|
758
|
+
function settledValue(e) {
|
|
759
|
+
return untrack(() => {
|
|
760
|
+
const n = e.node;
|
|
761
|
+
if (_asyncStatus(n) === "errored") throw _asyncError(n);
|
|
762
|
+
const v = n.peek();
|
|
763
|
+
return v === IDLE ? void 0 : v;
|
|
764
|
+
});
|
|
765
|
+
}
|
|
766
|
+
function useQuery(options) {
|
|
767
|
+
const {
|
|
768
|
+
queryKey,
|
|
769
|
+
queryFn,
|
|
770
|
+
enabled = true,
|
|
771
|
+
staleTime = 0,
|
|
772
|
+
cacheTime,
|
|
773
|
+
gcTime = cacheTime ?? DEFAULT_GC_TIME,
|
|
774
|
+
refetchOnWindowFocus = true,
|
|
775
|
+
refetchOnReconnect = true,
|
|
776
|
+
refetchInterval = false,
|
|
777
|
+
retry = 3,
|
|
778
|
+
retryDelay = defaultRetryDelay,
|
|
779
|
+
onSuccess,
|
|
780
|
+
onError,
|
|
781
|
+
onSettled,
|
|
782
|
+
select,
|
|
783
|
+
placeholderData,
|
|
784
|
+
keepPreviousData = false,
|
|
785
|
+
initialData,
|
|
786
|
+
initialDataUpdatedAt,
|
|
787
|
+
structuralSharing = true
|
|
788
|
+
} = options;
|
|
789
|
+
const gate = createGate(enabled);
|
|
790
|
+
const o = observe(PLAIN, queryKey, {
|
|
791
|
+
run: (k, abortSignal) => queryFn({ queryKey: asArray(k), signal: abortSignal }),
|
|
792
|
+
share: sharing(structuralSharing),
|
|
793
|
+
retry,
|
|
794
|
+
retryDelay
|
|
795
|
+
}, { gate, staleTime, gcTime, initialData, initialDataUpdatedAt, onSuccess, onError, onSettled });
|
|
796
|
+
if (refetchOnWindowFocus) onWindow(o, ["visibilitychange"], (e) => stale(e, o));
|
|
797
|
+
if (refetchOnReconnect) onWindow(o, ["online"], (e) => stale(e, o));
|
|
798
|
+
poll(o, refetchInterval);
|
|
799
|
+
let selectedFrom = IDLE;
|
|
800
|
+
let selected;
|
|
801
|
+
const selectOf = (v) => {
|
|
802
|
+
if (!select) return v;
|
|
803
|
+
if (v !== selectedFrom) {
|
|
804
|
+
selectedFrom = v;
|
|
805
|
+
selected = select(v);
|
|
806
|
+
}
|
|
807
|
+
return selected;
|
|
808
|
+
};
|
|
809
|
+
const view = () => {
|
|
810
|
+
const s = stateOf(o);
|
|
811
|
+
if (s.value != null) return { data: selectOf(s.value), placeholder: false, s };
|
|
812
|
+
const before = o.previous !== null && o.previous !== s.e ? valueOf(o.previous) : void 0;
|
|
813
|
+
if (before != null && (keepPreviousData || typeof placeholderData === "function")) {
|
|
814
|
+
const previous = select ? select(before) : before;
|
|
815
|
+
return { data: typeof placeholderData === "function" ? placeholderData(previous) : previous, placeholder: true, s };
|
|
816
|
+
}
|
|
817
|
+
const data = typeof placeholderData === "function" ? placeholderData(void 0) : placeholderData;
|
|
818
|
+
return { data, placeholder: data !== void 0, s };
|
|
819
|
+
};
|
|
820
|
+
const status = () => {
|
|
821
|
+
const s = stateOf(o);
|
|
822
|
+
if (s.error != null) return "error";
|
|
823
|
+
if (s.value != null) return "success";
|
|
824
|
+
return s.fetching || s.first && gate.peek() ? "loading" : "idle";
|
|
825
|
+
};
|
|
826
|
+
const dataOf = computed(() => view().data);
|
|
827
|
+
const placeholderOf = computed(() => view().placeholder);
|
|
828
|
+
const statusOf2 = computed(status);
|
|
829
|
+
const errorOf = computed(() => stateOf(o).error);
|
|
830
|
+
const fetchingOf = computed(() => stateOf(o).fetching);
|
|
831
|
+
const updatedAtOf = computed(() => {
|
|
832
|
+
const e = stateOf(o).e;
|
|
833
|
+
return e !== null ? e.updatedAt : 0;
|
|
834
|
+
});
|
|
835
|
+
return {
|
|
836
|
+
data: () => dataOf(),
|
|
837
|
+
error: () => errorOf(),
|
|
838
|
+
status: () => statusOf2(),
|
|
839
|
+
fetchStatus: () => fetchingOf() ? "fetching" : "idle",
|
|
840
|
+
isLoading: () => statusOf2() === "loading",
|
|
841
|
+
isError: () => statusOf2() === "error",
|
|
842
|
+
isSuccess: () => statusOf2() === "success",
|
|
843
|
+
isIdle: () => statusOf2() === "idle",
|
|
844
|
+
isFetching: () => fetchingOf(),
|
|
845
|
+
isPlaceholderData: () => placeholderOf(),
|
|
846
|
+
isEnabled: () => gate(),
|
|
847
|
+
dataUpdatedAt: () => updatedAtOf(),
|
|
848
|
+
// An explicit request: never gated by `enabled`, never answered from the
|
|
849
|
+
// freshness window. Resolves with the data it fetched.
|
|
850
|
+
refetch: () => {
|
|
851
|
+
const e = untrack(o.current);
|
|
852
|
+
return e === null ? Promise.resolve(void 0) : refetchOf(e, o);
|
|
853
|
+
}
|
|
854
|
+
};
|
|
855
|
+
}
|
|
856
|
+
function useSWR(key, fetcher, options = {}) {
|
|
857
|
+
const {
|
|
858
|
+
revalidateOnFocus = true,
|
|
859
|
+
revalidateOnReconnect = true,
|
|
860
|
+
refreshInterval = 0,
|
|
861
|
+
dedupingInterval = 2e3,
|
|
862
|
+
fallbackData,
|
|
863
|
+
keepPreviousData = false,
|
|
864
|
+
onSuccess,
|
|
865
|
+
onError,
|
|
866
|
+
structuralSharing = true
|
|
867
|
+
} = options;
|
|
868
|
+
const o = observe(PLAIN, key, {
|
|
869
|
+
run: (k, abortSignal) => fetcher(k, { signal: abortSignal }),
|
|
870
|
+
share: sharing(structuralSharing),
|
|
871
|
+
retry: 1,
|
|
872
|
+
retryDelay: defaultRetryDelay
|
|
873
|
+
}, { staleTime: dedupingInterval, onSuccess, onError, lenient: true });
|
|
874
|
+
if (revalidateOnFocus) onWindow(o, ["visibilitychange"], (e) => stale(e, o));
|
|
875
|
+
if (revalidateOnReconnect) onWindow(o, ["online"], (e) => stale(e, o));
|
|
876
|
+
poll(o, refreshInterval);
|
|
877
|
+
const data = () => {
|
|
878
|
+
const s = stateOf(o);
|
|
879
|
+
if (s.value != null) return s.value;
|
|
880
|
+
if (keepPreviousData && o.previous !== null && o.previous !== s.e) {
|
|
881
|
+
const before = valueOf(o.previous);
|
|
882
|
+
if (before != null) return before;
|
|
883
|
+
}
|
|
884
|
+
return fallbackData ?? null;
|
|
885
|
+
};
|
|
886
|
+
const revalidate = () => {
|
|
887
|
+
const e = untrack(o.current);
|
|
888
|
+
if (e === null) return Promise.resolve(void 0);
|
|
889
|
+
return e.flight !== null ? outcome(e, e.flight) : refetchOf(e, o);
|
|
890
|
+
};
|
|
891
|
+
const dataOf = computed(data);
|
|
892
|
+
const errorOf = computed(() => stateOf(o).error);
|
|
893
|
+
const loadingOf = computed(() => {
|
|
894
|
+
const s = stateOf(o);
|
|
895
|
+
return s.value == null && s.fetching;
|
|
896
|
+
});
|
|
897
|
+
const validatingOf = computed(() => stateOf(o).fetching);
|
|
898
|
+
return {
|
|
899
|
+
data: () => dataOf(),
|
|
900
|
+
error: () => errorOf(),
|
|
901
|
+
isLoading: () => loadingOf(),
|
|
902
|
+
isValidating: () => validatingOf(),
|
|
903
|
+
// mutate(data, shouldRevalidate = true): put data in the cache for every
|
|
904
|
+
// reader of the key, then fetch it again. mutate() alone revalidates.
|
|
905
|
+
mutate: (...args) => {
|
|
906
|
+
if (args.length === 0) return revalidate();
|
|
907
|
+
const [next, shouldRevalidate = true] = args;
|
|
908
|
+
const e = untrack(o.current);
|
|
909
|
+
if (e === null) return Promise.resolve(void 0);
|
|
910
|
+
setEntry(e, typeof next === "function" ? next(valueOf(e) ?? null) : next);
|
|
911
|
+
return shouldRevalidate ? refetchOf(e, o) : Promise.resolve(valueOf(e));
|
|
912
|
+
},
|
|
913
|
+
revalidate
|
|
914
|
+
};
|
|
915
|
+
}
|
|
916
|
+
function useInfiniteQuery(options) {
|
|
917
|
+
const {
|
|
918
|
+
queryKey,
|
|
919
|
+
queryFn,
|
|
920
|
+
getNextPageParam,
|
|
921
|
+
getPreviousPageParam,
|
|
922
|
+
initialPageParam,
|
|
923
|
+
enabled = true,
|
|
924
|
+
staleTime = 0,
|
|
925
|
+
cacheTime,
|
|
926
|
+
gcTime = cacheTime ?? DEFAULT_GC_TIME,
|
|
927
|
+
refetchOnWindowFocus = false,
|
|
928
|
+
refetchInterval = false,
|
|
929
|
+
select,
|
|
930
|
+
retry = 3,
|
|
931
|
+
retryDelay = defaultRetryDelay,
|
|
932
|
+
onSuccess,
|
|
933
|
+
onError,
|
|
934
|
+
onSettled
|
|
935
|
+
} = options;
|
|
936
|
+
const gate = createGate(enabled);
|
|
937
|
+
const o = observe(INFINITE, queryKey, {
|
|
938
|
+
run: (k, pageParam, abortSignal) => queryFn({ queryKey: asArray(k), pageParam, signal: abortSignal }),
|
|
939
|
+
retry,
|
|
940
|
+
retryDelay,
|
|
941
|
+
initialPageParam
|
|
942
|
+
}, { gate, staleTime, gcTime, onSuccess, onError, onSettled });
|
|
943
|
+
if (refetchOnWindowFocus) onWindow(o, ["visibilitychange"], (e) => stale(e, o));
|
|
944
|
+
poll(o, refetchInterval);
|
|
945
|
+
const pagesOf = (s) => s.value != null ? s.value : { pages: [], pageParams: [] };
|
|
946
|
+
const status = () => {
|
|
947
|
+
const s = stateOf(o);
|
|
948
|
+
if (s.error != null) return "error";
|
|
949
|
+
if (s.value != null && s.value.pages.length > 0) return "success";
|
|
950
|
+
return s.fetching ? "loading" : "idle";
|
|
951
|
+
};
|
|
952
|
+
const direction = (dir) => {
|
|
953
|
+
const s = stateOf(o);
|
|
954
|
+
return s.fetching && s.e !== null && s.e.dir() === dir;
|
|
955
|
+
};
|
|
956
|
+
const page = (place, dir, param) => {
|
|
957
|
+
const e = untrack(o.current);
|
|
958
|
+
return e === null ? Promise.resolve(void 0) : refetchOf(e, o, { place, dir, param });
|
|
959
|
+
};
|
|
960
|
+
const first = (dir) => page("first", dir, initialPageParam);
|
|
961
|
+
return {
|
|
962
|
+
data: () => {
|
|
963
|
+
const data = pagesOf(stateOf(o));
|
|
964
|
+
return select ? select(data) : data;
|
|
965
|
+
},
|
|
966
|
+
error: () => stateOf(o).error,
|
|
967
|
+
status,
|
|
968
|
+
isLoading: () => status() === "loading",
|
|
969
|
+
isError: () => status() === "error",
|
|
970
|
+
isSuccess: () => status() === "success",
|
|
971
|
+
isIdle: () => status() === "idle",
|
|
972
|
+
isFetching: () => stateOf(o).fetching,
|
|
973
|
+
isEnabled: () => gate(),
|
|
974
|
+
hasNextPage: () => {
|
|
975
|
+
const { pages } = pagesOf(stateOf(o));
|
|
976
|
+
return pages.length === 0 || (getNextPageParam ? getNextPageParam(pages[pages.length - 1], pages) !== void 0 : false);
|
|
977
|
+
},
|
|
978
|
+
hasPreviousPage: () => {
|
|
979
|
+
const { pages } = pagesOf(stateOf(o));
|
|
980
|
+
return pages.length > 0 && getPreviousPageParam ? getPreviousPageParam(pages[0], pages) !== void 0 : false;
|
|
981
|
+
},
|
|
982
|
+
isFetchingNextPage: () => direction("next"),
|
|
983
|
+
isFetchingPreviousPage: () => direction("previous"),
|
|
984
|
+
// An empty list has no last page to ask getNextPageParam about: the next
|
|
985
|
+
// page of nothing is the first page.
|
|
986
|
+
fetchNextPage: async () => {
|
|
987
|
+
const { pages } = pagesOf(untrack(() => stateOf(o)));
|
|
988
|
+
if (pages.length === 0) return first("next");
|
|
989
|
+
const param = getNextPageParam?.(pages[pages.length - 1], pages);
|
|
990
|
+
if (param !== void 0) return page("next", "next", param);
|
|
991
|
+
},
|
|
992
|
+
fetchPreviousPage: async () => {
|
|
993
|
+
const { pages } = pagesOf(untrack(() => stateOf(o)));
|
|
994
|
+
if (pages.length === 0) return first("previous");
|
|
995
|
+
const param = getPreviousPageParam?.(pages[0], pages);
|
|
996
|
+
if (param !== void 0) return page("previous", "previous", param);
|
|
997
|
+
},
|
|
998
|
+
refetch: () => first("next")
|
|
999
|
+
};
|
|
1000
|
+
}
|
|
1001
|
+
function useFetch(url, options = {}) {
|
|
1002
|
+
const {
|
|
1003
|
+
method = "GET",
|
|
1004
|
+
body,
|
|
1005
|
+
headers = {},
|
|
1006
|
+
transform = (data) => data,
|
|
1007
|
+
initialData = null,
|
|
1008
|
+
fetch: request = globalThis.fetch
|
|
1009
|
+
} = options;
|
|
1010
|
+
const keyOf = (u) => u == null ? null : ["what:fetch", method, u, body ?? null];
|
|
1011
|
+
const key = typeof url === "function" ? () => keyOf(url()) : keyOf(url);
|
|
1012
|
+
const o = observe(PLAIN, key, {
|
|
1013
|
+
run: async (k, abortSignal) => {
|
|
1014
|
+
const response = await request(k[2], {
|
|
1015
|
+
method,
|
|
1016
|
+
headers: { "Content-Type": "application/json", ...headers },
|
|
1017
|
+
body: body ? JSON.stringify(body) : void 0,
|
|
1018
|
+
signal: abortSignal
|
|
1019
|
+
});
|
|
1020
|
+
if (!response.ok) throw new Error(`HTTP ${response.status}: ${response.statusText}`);
|
|
1021
|
+
return transform(await response.json());
|
|
1022
|
+
},
|
|
1023
|
+
retry: 1,
|
|
1024
|
+
retryDelay: defaultRetryDelay
|
|
1025
|
+
}, {});
|
|
1026
|
+
return {
|
|
1027
|
+
data: () => stateOf(o).value ?? initialData,
|
|
1028
|
+
error: () => stateOf(o).error,
|
|
1029
|
+
isLoading: () => {
|
|
1030
|
+
const s = stateOf(o);
|
|
1031
|
+
return s.fetching || s.e !== null && s.value === void 0 && s.error === null && s.e.fetches === 0;
|
|
1032
|
+
},
|
|
1033
|
+
// Never rejects: a failure shows in error().
|
|
1034
|
+
refetch: () => {
|
|
1035
|
+
const e = untrack(o.current);
|
|
1036
|
+
return e === null ? Promise.resolve() : refetchOf(e, o).then(noop, noop);
|
|
1037
|
+
},
|
|
1038
|
+
mutate: (next) => {
|
|
1039
|
+
const e = untrack(o.current);
|
|
1040
|
+
if (e !== null) setEntry(e, next);
|
|
1041
|
+
}
|
|
1042
|
+
};
|
|
1043
|
+
}
|
|
1044
|
+
function allEntries() {
|
|
1045
|
+
const ctx = getServerContext();
|
|
1046
|
+
const caches = ctx === null ? clientCache : serverCaches.get(ctx) || [];
|
|
1047
|
+
const out = [];
|
|
1048
|
+
for (const cache of caches) for (const e of cache.values()) out.push(e);
|
|
1049
|
+
return out;
|
|
1050
|
+
}
|
|
1051
|
+
function matching(target, exact) {
|
|
1052
|
+
const out = [];
|
|
1053
|
+
if (typeof target === "function") {
|
|
1054
|
+
for (const e of allEntries()) if (target(e.hash)) out.push(e);
|
|
1055
|
+
} else if (Array.isArray(target) && !exact) {
|
|
1056
|
+
const prefix = normalizeQueryKey(target);
|
|
1057
|
+
const scoped = prefix + ":";
|
|
1058
|
+
for (const e of allEntries()) if (e.hash === prefix || e.hash.startsWith(scoped)) out.push(e);
|
|
1059
|
+
} else {
|
|
1060
|
+
const exactKey = normalizeQueryKey(target);
|
|
1061
|
+
for (const e of allEntries()) if (e.hash === exactKey) out.push(e);
|
|
1062
|
+
}
|
|
1063
|
+
return out;
|
|
1064
|
+
}
|
|
1065
|
+
function lastActive(e) {
|
|
1066
|
+
let last = null;
|
|
1067
|
+
for (const o of e.observers) if (o.active() && untrack(o.hash) === e.hash) last = o;
|
|
1068
|
+
return last;
|
|
1069
|
+
}
|
|
1070
|
+
function invalidateEntry(e, hard) {
|
|
1071
|
+
e.updatedAt = 0;
|
|
1072
|
+
if (hard) {
|
|
1073
|
+
const f = e.flight;
|
|
1074
|
+
e.version++;
|
|
1075
|
+
e.error = void 0;
|
|
1076
|
+
_setAsyncValue(e.node, null);
|
|
1077
|
+
if (f !== null && !f.dead) {
|
|
1078
|
+
e.next = ADOPT;
|
|
1079
|
+
refreshNode(e);
|
|
1080
|
+
e.next = 0;
|
|
1081
|
+
}
|
|
1082
|
+
}
|
|
1083
|
+
const by = lastActive(e);
|
|
1084
|
+
if (by === null) return e.flight !== null ? outcome(e, e.flight).then(noop, noop) : Promise.resolve();
|
|
1085
|
+
if (hard && e.flight !== null) return outcome(e, e.flight).then(noop, noop);
|
|
1086
|
+
return refetchOf(e, by).then(noop, noop);
|
|
1087
|
+
}
|
|
1088
|
+
function invalidateQueries(keyOrPredicate, options = {}) {
|
|
1089
|
+
const { hard = false, exact = false } = options;
|
|
1090
|
+
const entries = matching(keyOrPredicate, exact);
|
|
1091
|
+
if ((process.env.NODE_ENV !== "production") && arguments[2]) {
|
|
1092
|
+
for (const e of entries) arguments[2].add(e.hash);
|
|
1093
|
+
}
|
|
1094
|
+
return Promise.all(entries.map((e) => invalidateEntry(e, hard))).then(noop);
|
|
1095
|
+
}
|
|
1096
|
+
var revalidationCallbacks = /* @__PURE__ */ new Map();
|
|
1097
|
+
function onRevalidate(path, callback) {
|
|
1098
|
+
if (!revalidationCallbacks.has(path)) revalidationCallbacks.set(path, /* @__PURE__ */ new Set());
|
|
1099
|
+
revalidationCallbacks.get(path).add(callback);
|
|
1100
|
+
return () => {
|
|
1101
|
+
revalidationCallbacks.get(path)?.delete(callback);
|
|
1102
|
+
};
|
|
1103
|
+
}
|
|
1104
|
+
function invalidatePath(path) {
|
|
1105
|
+
const callbacks = revalidationCallbacks.get(path);
|
|
1106
|
+
if (callbacks) {
|
|
1107
|
+
for (const cb of callbacks) {
|
|
1108
|
+
try {
|
|
1109
|
+
cb();
|
|
1110
|
+
} catch (e) {
|
|
1111
|
+
console.error("[what] Revalidation error:", e);
|
|
1112
|
+
}
|
|
1113
|
+
}
|
|
1114
|
+
}
|
|
1115
|
+
const waits = [];
|
|
1116
|
+
for (const e of allEntries()) if (e.paths !== null && e.paths.has(path)) waits.push(invalidateEntry(e, false));
|
|
1117
|
+
return Promise.all(waits).then(noop);
|
|
1118
|
+
}
|
|
1119
|
+
function prefetchQuery(key, fetcher, options = {}) {
|
|
1120
|
+
key = keyParts(key);
|
|
1121
|
+
const e = entryFor(PLAIN, normalizeQueryKey(key), key, null);
|
|
1122
|
+
const own = { conf: { run: (k, abortSignal) => fetcher(k, { signal: abortSignal }), share: sharing(options.structuralSharing ?? true), retry: options.retry ?? 1, retryDelay: defaultRetryDelay }, key, keep: true };
|
|
1123
|
+
if (e.observers.size === 0) {
|
|
1124
|
+
e.conf = own.conf;
|
|
1125
|
+
e.key = key;
|
|
1126
|
+
}
|
|
1127
|
+
const v = valueOf(e);
|
|
1128
|
+
let done;
|
|
1129
|
+
if (e.flight !== null) {
|
|
1130
|
+
e.flight.keep = true;
|
|
1131
|
+
done = outcome(e, e.flight);
|
|
1132
|
+
} else if (v !== void 0 && e.error === void 0 && Date.now() - e.updatedAt <= (options.staleTime ?? 0)) done = Promise.resolve(v);
|
|
1133
|
+
else {
|
|
1134
|
+
const refreshed = fetchEntry(e, own);
|
|
1135
|
+
done = e.flight !== null ? outcome(e, e.flight) : refreshed;
|
|
1136
|
+
}
|
|
1137
|
+
armGc(e);
|
|
1138
|
+
return done;
|
|
1139
|
+
}
|
|
1140
|
+
function setQueryData(key, updater) {
|
|
1141
|
+
key = keyParts(key);
|
|
1142
|
+
const e = entryFor(PLAIN, normalizeQueryKey(key), key, null);
|
|
1143
|
+
setEntry(e, typeof updater === "function" ? updater(valueOf(e)) : updater);
|
|
1144
|
+
armGc(e);
|
|
1145
|
+
}
|
|
1146
|
+
function getQueryData(key) {
|
|
1147
|
+
const e = cacheOf(PLAIN).get(normalizeQueryKey(key));
|
|
1148
|
+
return e === void 0 ? void 0 : valueOf(e);
|
|
1149
|
+
}
|
|
1150
|
+
function clearCache() {
|
|
1151
|
+
channelOpen = false;
|
|
1152
|
+
for (const e of allEntries()) {
|
|
1153
|
+
if (e.observers.size > 0) {
|
|
1154
|
+
e.error = void 0;
|
|
1155
|
+
e.updatedAt = 0;
|
|
1156
|
+
commitValue(e, IDLE);
|
|
1157
|
+
} else {
|
|
1158
|
+
dropEntry(e);
|
|
1159
|
+
}
|
|
1160
|
+
}
|
|
1161
|
+
}
|
|
1162
|
+
function messageOf(error) {
|
|
1163
|
+
return error == null ? null : String(error && error.message || error);
|
|
1164
|
+
}
|
|
1165
|
+
function statusOf(e) {
|
|
1166
|
+
const status = _asyncStatus(e.node);
|
|
1167
|
+
if (status === "errored") return "error";
|
|
1168
|
+
const value = valueOf(e);
|
|
1169
|
+
if (status === "pending" || status === "unresolved") return value === void 0 || value === null ? "loading" : "refreshing";
|
|
1170
|
+
return value === void 0 || value === null ? "idle" : "success";
|
|
1171
|
+
}
|
|
1172
|
+
function __getCacheSnapshot() {
|
|
1173
|
+
return untrack(() => allEntries().map((e) => ({
|
|
1174
|
+
key: e.hash,
|
|
1175
|
+
kind: e.kind === INFINITE ? "infinite" : "query",
|
|
1176
|
+
status: statusOf(e),
|
|
1177
|
+
data: valueOf(e),
|
|
1178
|
+
error: messageOf(e.error !== void 0 ? e.error : _asyncStatus(e.node) === "errored" ? _asyncError(e.node) : null),
|
|
1179
|
+
isValidating: e.flight !== null,
|
|
1180
|
+
observers: e.observers.size,
|
|
1181
|
+
updatedAt: e.updatedAt || null,
|
|
1182
|
+
fetches: e.fetches,
|
|
1183
|
+
lastFetch: e.last,
|
|
1184
|
+
version: e.version,
|
|
1185
|
+
paths: e.paths !== null ? [...e.paths] : []
|
|
1186
|
+
})));
|
|
1187
|
+
}
|
|
1188
|
+
function __invalidateFromDevtools(key) {
|
|
1189
|
+
const entries = key == null ? allEntries() : matching(key, false);
|
|
1190
|
+
for (const e of entries) invalidateEntry(e, false);
|
|
1191
|
+
return entries.map((e) => e.hash);
|
|
1192
|
+
}
|
|
1193
|
+
export {
|
|
1194
|
+
__getCacheSnapshot,
|
|
1195
|
+
__invalidateFromDevtools,
|
|
1196
|
+
_loadedQueries,
|
|
1197
|
+
_pathLoaded,
|
|
1198
|
+
_tagQueries,
|
|
1199
|
+
clearCache,
|
|
1200
|
+
getQueryData,
|
|
1201
|
+
invalidatePath,
|
|
1202
|
+
invalidateQueries,
|
|
1203
|
+
onRevalidate,
|
|
1204
|
+
prefetchQuery,
|
|
1205
|
+
query,
|
|
1206
|
+
replaceEqualDeep,
|
|
1207
|
+
setQueryData,
|
|
1208
|
+
useFetch,
|
|
1209
|
+
useInfiniteQuery,
|
|
1210
|
+
useQuery,
|
|
1211
|
+
useSWR
|
|
1212
|
+
};
|