gemi 0.71.0 → 0.72.1
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/dist/ai/index.js +1 -1
- package/dist/{chunk-qb1x1r58.js → chunk-0j8v3dd3.js} +1 -1
- package/dist/{chunk-ybtwp81a.js → chunk-akbawnmg.js} +1 -1
- package/dist/{chunk-ksxes55e.js → chunk-ebdtwzzr.js} +1 -1
- package/dist/{chunk-ep1jte2d.js → chunk-t2t2qcj4.js} +2 -2
- package/dist/{chunk-ep1jte2d.js.map → chunk-t2t2qcj4.js.map} +1 -1
- package/dist/chunk-t48gchew.js +5 -0
- package/dist/{chunk-3zraw16t.js.map → chunk-t48gchew.js.map} +5 -5
- package/dist/{chunk-0x9a9yha.js → chunk-vqxpknyg.js} +1 -1
- package/dist/chunks/{ThemeProvider-Bz-y1g2i.js → ThemeProvider-D9v0VAbY.js} +53 -4
- package/dist/chunks/ThemeProvider-D9v0VAbY.js.map +1 -0
- package/dist/client/Mutation.d.ts +8 -1
- package/dist/client/Mutation.d.ts.map +1 -1
- package/dist/client/MutationError.d.ts +109 -0
- package/dist/client/MutationError.d.ts.map +1 -0
- package/dist/client/QueryResource.d.ts +24 -0
- package/dist/client/QueryResource.d.ts.map +1 -1
- package/dist/client/auth/useForgotPassword.d.ts +1 -1
- package/dist/client/auth/useResetPassword.d.ts +1 -1
- package/dist/client/auth/useSignIn.d.ts +1 -1
- package/dist/client/auth/useSignOut.d.ts +1 -1
- package/dist/client/auth/useSignUp.d.ts +1 -1
- package/dist/client/index.d.ts +4 -0
- package/dist/client/index.d.ts.map +1 -1
- package/dist/client/index.js +284 -16
- package/dist/client/index.js.map +1 -1
- package/dist/client/useInfiniteQuery.d.ts +59 -0
- package/dist/client/useInfiniteQuery.d.ts.map +1 -0
- package/dist/client/useMutate.d.ts +7 -1
- package/dist/client/useMutate.d.ts.map +1 -1
- package/dist/client/useMutation.d.ts +6 -21
- package/dist/client/useMutation.d.ts.map +1 -1
- package/dist/client/useQuery.d.ts +4 -4
- package/dist/client/useQuery.d.ts.map +1 -1
- package/dist/facades/Storage.d.ts +6 -2
- package/dist/facades/Storage.d.ts.map +1 -1
- package/dist/facades/index.js +1 -1
- package/dist/http/index.js +1 -1
- package/dist/i18n/index.js +1 -1
- package/dist/kernel/index.js +1 -1
- package/dist/server/index.js +1 -1
- package/dist/services/file-storage/drivers/AzureBlobDriver.d.ts +2 -2
- package/dist/services/file-storage/drivers/AzureBlobDriver.d.ts.map +1 -1
- package/dist/services/file-storage/drivers/FileStorageDriver.d.ts +11 -1
- package/dist/services/file-storage/drivers/FileStorageDriver.d.ts.map +1 -1
- package/dist/services/file-storage/drivers/FileSystemDriver.d.ts +2 -1
- package/dist/services/file-storage/drivers/FileSystemDriver.d.ts.map +1 -1
- package/dist/services/file-storage/drivers/S3Driver.d.ts +2 -1
- package/dist/services/file-storage/drivers/S3Driver.d.ts.map +1 -1
- package/dist/services/file-storage/drivers/types.d.ts +9 -0
- package/dist/services/file-storage/drivers/types.d.ts.map +1 -1
- package/dist/services/index.d.ts +1 -1
- package/dist/services/index.d.ts.map +1 -1
- package/dist/services/index.js +5 -5
- package/dist/services/index.js.map +4 -4
- package/dist/testing/index.js +1 -1
- package/package.json +1 -1
- package/skills/gemi-react-best-practices/rules/controller-throw-framework-errors.md +3 -3
- package/dist/chunk-3zraw16t.js +0 -5
- package/dist/chunks/ThemeProvider-Bz-y1g2i.js.map +0 -1
- /package/dist/{chunk-qb1x1r58.js.map → chunk-0j8v3dd3.js.map} +0 -0
- /package/dist/{chunk-ybtwp81a.js.map → chunk-akbawnmg.js.map} +0 -0
- /package/dist/{chunk-ksxes55e.js.map → chunk-ebdtwzzr.js.map} +0 -0
- /package/dist/{chunk-0x9a9yha.js.map → chunk-vqxpknyg.js.map} +0 -0
|
@@ -69,6 +69,14 @@ var QueryResource = class {
|
|
|
69
69
|
* without waiting on the wire.
|
|
70
70
|
*/
|
|
71
71
|
pending = /* @__PURE__ */ new Map();
|
|
72
|
+
/**
|
|
73
|
+
* How many mounted readers are rendering each variant. A mounted variant is
|
|
74
|
+
* on screen, so an invalidation refetches it now; one nobody renders is only
|
|
75
|
+
* marked stale and revalidates when something reads it next — invalidating
|
|
76
|
+
* every search variant a user browsed through must not put each of them on
|
|
77
|
+
* the wire at once.
|
|
78
|
+
*/
|
|
79
|
+
watchers = /* @__PURE__ */ new Map();
|
|
72
80
|
constructor(key, initialState) {
|
|
73
81
|
this.key = key;
|
|
74
82
|
this.store = new Subject(/* @__PURE__ */ new Map());
|
|
@@ -234,7 +242,45 @@ var QueryResource = class {
|
|
|
234
242
|
}
|
|
235
243
|
if (changed) this.store.next(store);
|
|
236
244
|
}
|
|
237
|
-
|
|
245
|
+
/**
|
|
246
|
+
* Mark a variant as rendered by a mounted reader until the returned release
|
|
247
|
+
* runs. `useQuery` and `useInfiniteQuery` hold one for every variant they
|
|
248
|
+
* put on screen.
|
|
249
|
+
*/
|
|
250
|
+
retain(variantKey) {
|
|
251
|
+
this.watchers.set(variantKey, (this.watchers.get(variantKey) ?? 0) + 1);
|
|
252
|
+
let released = false;
|
|
253
|
+
return () => {
|
|
254
|
+
if (released) return;
|
|
255
|
+
released = true;
|
|
256
|
+
const count = (this.watchers.get(variantKey) ?? 1) - 1;
|
|
257
|
+
if (count > 0) this.watchers.set(variantKey, count);
|
|
258
|
+
else this.watchers.delete(variantKey);
|
|
259
|
+
};
|
|
260
|
+
}
|
|
261
|
+
/** Every variant key this resource holds state for, in insertion order. */
|
|
262
|
+
variantKeys() {
|
|
263
|
+
return [...this.store.getValue().keys()];
|
|
264
|
+
}
|
|
265
|
+
/**
|
|
266
|
+
* The many-variant counterpart of `mutate`. The update (when given) is
|
|
267
|
+
* applied to the variant's cached data right away, but only a variant a
|
|
268
|
+
* mounted reader is rendering refetches now; any other one is marked stale
|
|
269
|
+
* and revalidates — bypassing the HTTP cache — the next time it is read.
|
|
270
|
+
*/
|
|
271
|
+
invalidate(variantKey, fn) {
|
|
272
|
+
this.dropHttpCache(variantKey);
|
|
273
|
+
const store = this.store.getValue();
|
|
274
|
+
const state = store.get(variantKey);
|
|
275
|
+
if (fn && state?.hasData) this.store.next(store.set(variantKey, {
|
|
276
|
+
...state,
|
|
277
|
+
data: fn(state.data),
|
|
278
|
+
error: null
|
|
279
|
+
}));
|
|
280
|
+
this.staleVariants.add(variantKey);
|
|
281
|
+
if (this.watchers.has(variantKey)) this.resolveVariant(variantKey, false, false);
|
|
282
|
+
}
|
|
283
|
+
dropHttpCache(variantKey) {
|
|
238
284
|
const cacheKey = [
|
|
239
285
|
typeof window !== "undefined" && window.location?.origin ? window.location.origin : "",
|
|
240
286
|
this.key,
|
|
@@ -242,7 +288,10 @@ var QueryResource = class {
|
|
|
242
288
|
].filter((s) => s.length > 0).join("?");
|
|
243
289
|
try {
|
|
244
290
|
if (caches) caches?.delete(cacheKey);
|
|
245
|
-
} catch
|
|
291
|
+
} catch {}
|
|
292
|
+
}
|
|
293
|
+
mutate(variantKey, fn = (data) => data) {
|
|
294
|
+
this.dropHttpCache(variantKey);
|
|
246
295
|
const store = this.store.getValue();
|
|
247
296
|
const state = store.get(variantKey);
|
|
248
297
|
if (!state || !state.hasData) {
|
|
@@ -280,7 +329,7 @@ var QueryResource = class {
|
|
|
280
329
|
let response = null;
|
|
281
330
|
const fullUrl = [this.key, variantKey].filter((s) => s.length).join("?");
|
|
282
331
|
try {
|
|
283
|
-
response = await fetch(`/api${fullUrl}`, { cache: cache ? "default" : "reload" });
|
|
332
|
+
response = await fetch(`/api${fullUrl}`, { cache: cache && !this.staleVariants.has(variantKey) ? "default" : "reload" });
|
|
284
333
|
data = await response.json();
|
|
285
334
|
} catch (error) {
|
|
286
335
|
console.error(`Error fetching url /api${fullUrl}`, error);
|
|
@@ -3062,4 +3111,4 @@ function useTheme() {
|
|
|
3062
3111
|
//#endregion
|
|
3063
3112
|
export { isAbsoluteUrl as A, QueryError as B, useNavigate as C, ServerDataProvider as D, ServerDataContext as E, applyParams as F, QueryConfigContext as I, QueryManagerContext as L, Action as M, createMemoryHistory as N, useLocation as O, toVariantKey as P, QueryManagerProvider as R, useSearchParams as S, I18nProvider as T, Subject as V, registerDictionary as _, m as a, routeDataUrl as b, ClientRouterContext as c, ComponentsProvider as d, initialViewModulesReady as f, loadDictionaryForRender as g, loadDictionary as h, WebSocketContextProvider as i, ProgressManager as j, domainUrl as k, ClientRouterProvider as l, subscribeViewModules as m, useTheme as n, RouteTransitionProvider as o, loadViewModule as p, WebSocketContext as r, useRouteTransition as s, ThemeProvider as t, ComponentsContext as u, setActiveLocale as v, I18nContext as w, useRoute as x, readRoutePayload as y, DEFAULT_STALE_TIME as z };
|
|
3064
3113
|
|
|
3065
|
-
//# sourceMappingURL=ThemeProvider-
|
|
3114
|
+
//# sourceMappingURL=ThemeProvider-D9v0VAbY.js.map
|