@legendapp/state 3.0.0-alpha.0 → 3.0.0-alpha.2
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/.DS_Store +0 -0
- package/CHANGELOG.md +1 -827
- package/LICENSE +1 -21
- package/README.md +1 -141
- package/as/arrayAsRecord.d.mts +5 -0
- package/as/arrayAsRecord.d.ts +5 -0
- package/as/arrayAsRecord.js +28 -0
- package/as/arrayAsRecord.mjs +26 -0
- package/as/arrayAsSet.d.mts +5 -0
- package/as/arrayAsSet.d.ts +5 -0
- package/as/arrayAsSet.js +13 -0
- package/as/arrayAsSet.mjs +11 -0
- package/as/arrayAsString.d.mts +5 -0
- package/as/arrayAsString.d.ts +5 -0
- package/as/arrayAsString.js +13 -0
- package/as/arrayAsString.mjs +11 -0
- package/as/numberAsString.d.mts +5 -0
- package/as/numberAsString.d.ts +5 -0
- package/as/numberAsString.js +13 -0
- package/as/numberAsString.mjs +11 -0
- package/as/recordAsArray.d.mts +5 -0
- package/as/recordAsArray.d.ts +5 -0
- package/as/recordAsArray.js +25 -0
- package/as/recordAsArray.mjs +23 -0
- package/as/recordAsString.d.mts +5 -0
- package/as/recordAsString.d.ts +5 -0
- package/as/recordAsString.js +13 -0
- package/as/recordAsString.mjs +11 -0
- package/as/setAsArray.d.mts +5 -0
- package/as/setAsArray.d.ts +5 -0
- package/as/setAsArray.js +13 -0
- package/as/setAsArray.mjs +11 -0
- package/as/setAsString.d.mts +5 -0
- package/as/setAsString.d.ts +5 -0
- package/as/setAsString.js +13 -0
- package/as/setAsString.mjs +11 -0
- package/as/stringAsArray.d.mts +5 -0
- package/as/stringAsArray.d.ts +5 -0
- package/as/stringAsArray.js +13 -0
- package/as/stringAsArray.mjs +11 -0
- package/as/stringAsNumber.d.mts +5 -0
- package/as/stringAsNumber.d.ts +5 -0
- package/as/stringAsNumber.js +16 -0
- package/as/stringAsNumber.mjs +14 -0
- package/as/stringAsRecord.d.mts +5 -0
- package/as/stringAsRecord.d.ts +5 -0
- package/as/stringAsRecord.js +15 -0
- package/as/stringAsRecord.mjs +13 -0
- package/as/stringAsSet.d.mts +5 -0
- package/as/stringAsSet.d.ts +5 -0
- package/as/stringAsSet.js +13 -0
- package/as/stringAsSet.mjs +11 -0
- package/babel.d.mts +21 -0
- package/babel.d.ts +21 -2
- package/babel.js +57 -53
- package/babel.mjs +65 -0
- package/config/enable$GetSet.js +13 -14
- package/config/enable$GetSet.mjs +13 -14
- package/config/enableReactComponents.d.mts +9 -0
- package/config/enableReactComponents.d.ts +4 -2
- package/config/enableReactComponents.js +13 -10
- package/config/enableReactComponents.mjs +13 -10
- package/config/enableReactNativeComponents.d.mts +22 -0
- package/config/enableReactNativeComponents.d.ts +6 -4
- package/config/enableReactNativeComponents.js +43 -47
- package/config/enableReactNativeComponents.mjs +43 -47
- package/config/enableReactTracking.d.mts +7 -0
- package/config/enableReactTracking.d.ts +3 -2
- package/config/enableReactTracking.js +33 -38
- package/config/enableReactTracking.mjs +33 -38
- package/config/enableReactUse.d.mts +10 -0
- package/config/enableReactUse.d.ts +4 -1
- package/config/enableReactUse.js +15 -14
- package/config/enableReactUse.mjs +15 -14
- package/config/{enable$GetSet.d.ts → enable_GetSet.d.mts} +4 -2
- package/config/enable_GetSet.d.ts +10 -0
- package/config/enable_PeekAssign.d.mts +10 -0
- package/config/enable_PeekAssign.d.ts +4 -2
- package/config/enable_PeekAssign.js +13 -14
- package/config/enable_PeekAssign.mjs +13 -14
- package/helpers/pageHash.d.mts +9 -0
- package/helpers/pageHash.d.ts +2 -0
- package/helpers/pageHash.js +25 -30
- package/helpers/pageHash.mjs +25 -30
- package/helpers/pageHashParams.d.mts +9 -0
- package/helpers/pageHashParams.d.ts +2 -0
- package/helpers/pageHashParams.js +34 -37
- package/helpers/pageHashParams.mjs +34 -37
- package/helpers/time.d.mts +6 -0
- package/helpers/time.d.ts +6 -3
- package/helpers/time.js +17 -17
- package/helpers/time.mjs +17 -17
- package/helpers/trackHistory.d.mts +6 -0
- package/helpers/trackHistory.d.ts +6 -0
- package/helpers/trackHistory.js +21 -0
- package/helpers/trackHistory.mjs +19 -0
- package/helpers/undoRedo.d.mts +37 -0
- package/helpers/undoRedo.d.ts +37 -0
- package/helpers/undoRedo.js +68 -0
- package/helpers/undoRedo.mjs +66 -0
- package/index.d.mts +404 -0
- package/index.d.ts +371 -28
- package/index.js +2003 -2164
- package/index.mjs +2003 -2164
- package/package.json +254 -185
- package/persist-plugins/async-storage.d.mts +18 -0
- package/persist-plugins/async-storage.d.ts +6 -3
- package/persist-plugins/async-storage.js +79 -86
- package/persist-plugins/async-storage.mjs +79 -86
- package/persist-plugins/indexeddb.d.mts +29 -0
- package/persist-plugins/indexeddb.d.ts +6 -3
- package/persist-plugins/indexeddb.js +331 -348
- package/persist-plugins/indexeddb.mjs +331 -348
- package/persist-plugins/local-storage.d.mts +23 -0
- package/persist-plugins/local-storage.d.ts +8 -5
- package/persist-plugins/local-storage.js +74 -76
- package/persist-plugins/local-storage.mjs +74 -76
- package/persist-plugins/mmkv.d.mts +18 -0
- package/persist-plugins/mmkv.d.ts +6 -3
- package/persist-plugins/mmkv.js +82 -86
- package/persist-plugins/mmkv.mjs +82 -86
- package/react-hooks/createObservableHook.d.mts +5 -0
- package/react-hooks/createObservableHook.d.ts +4 -1
- package/react-hooks/createObservableHook.js +29 -30
- package/react-hooks/createObservableHook.mjs +25 -30
- package/react-hooks/useHover.d.mts +5 -0
- package/react-hooks/useHover.d.ts +5 -3
- package/react-hooks/useHover.js +29 -29
- package/react-hooks/useHover.mjs +29 -29
- package/react-hooks/useMeasure.d.mts +9 -0
- package/react-hooks/useMeasure.d.ts +5 -2
- package/react-hooks/useMeasure.js +30 -32
- package/react-hooks/useMeasure.mjs +30 -32
- package/react-hooks/useObservableNextRouter.d.mts +35 -0
- package/react-hooks/useObservableNextRouter.d.ts +9 -7
- package/react-hooks/useObservableNextRouter.js +64 -77
- package/react-hooks/useObservableNextRouter.mjs +60 -77
- package/react.d.mts +157 -0
- package/react.d.ts +157 -21
- package/react.js +458 -749
- package/react.mjs +457 -752
- package/sync-plugins/crud.d.mts +54 -0
- package/sync-plugins/crud.d.ts +12 -10
- package/sync-plugins/crud.js +253 -270
- package/sync-plugins/crud.mjs +253 -270
- package/sync-plugins/fetch.d.mts +21 -0
- package/sync-plugins/fetch.d.ts +7 -4
- package/sync-plugins/fetch.js +50 -37
- package/sync-plugins/fetch.mjs +50 -37
- package/sync-plugins/keel.d.mts +108 -0
- package/sync-plugins/keel.d.ts +17 -15
- package/sync-plugins/keel.js +229 -462
- package/sync-plugins/keel.mjs +227 -464
- package/sync-plugins/supabase.d.mts +39 -0
- package/sync-plugins/supabase.d.ts +16 -14
- package/sync-plugins/supabase.js +128 -128
- package/sync-plugins/supabase.mjs +128 -128
- package/sync-plugins/tanstack-query.d.mts +14 -0
- package/sync-plugins/tanstack-query.d.ts +7 -4
- package/sync-plugins/tanstack-query.js +51 -57
- package/sync-plugins/tanstack-query.mjs +51 -57
- package/sync-plugins/tanstack-react-query.d.mts +8 -0
- package/sync-plugins/tanstack-react-query.d.ts +6 -1
- package/sync-plugins/tanstack-react-query.js +2 -2
- package/sync-plugins/tanstack-react-query.mjs +2 -2
- package/sync.d.mts +351 -0
- package/sync.d.ts +349 -9
- package/sync.js +909 -962
- package/sync.mjs +919 -972
- package/trace.d.mts +9 -0
- package/trace.d.ts +9 -4
- package/trace.js +72 -62
- package/trace.mjs +72 -62
- package/types/babel.d.ts +1 -12
- package/babel.js.map +0 -1
- package/config/enable$GetSet.js.map +0 -1
- package/config/enable$GetSet.mjs.map +0 -1
- package/config/enableReactComponents.js.map +0 -1
- package/config/enableReactComponents.mjs.map +0 -1
- package/config/enableReactNativeComponents.js.map +0 -1
- package/config/enableReactNativeComponents.mjs.map +0 -1
- package/config/enableReactTracking.js.map +0 -1
- package/config/enableReactTracking.mjs.map +0 -1
- package/config/enableReactUse.js.map +0 -1
- package/config/enableReactUse.mjs.map +0 -1
- package/config/enable_PeekAssign.js.map +0 -1
- package/config/enable_PeekAssign.mjs.map +0 -1
- package/helpers/pageHash.js.map +0 -1
- package/helpers/pageHash.mjs.map +0 -1
- package/helpers/pageHashParams.js.map +0 -1
- package/helpers/pageHashParams.mjs.map +0 -1
- package/helpers/time.js.map +0 -1
- package/helpers/time.mjs.map +0 -1
- package/history.d.ts +0 -1
- package/history.js +0 -24
- package/history.js.map +0 -1
- package/history.mjs +0 -22
- package/history.mjs.map +0 -1
- package/index.js.map +0 -1
- package/index.mjs.map +0 -1
- package/persist-plugins/async-storage.js.map +0 -1
- package/persist-plugins/async-storage.mjs.map +0 -1
- package/persist-plugins/indexeddb.js.map +0 -1
- package/persist-plugins/indexeddb.mjs.map +0 -1
- package/persist-plugins/local-storage.js.map +0 -1
- package/persist-plugins/local-storage.mjs.map +0 -1
- package/persist-plugins/mmkv.js.map +0 -1
- package/persist-plugins/mmkv.mjs.map +0 -1
- package/react-hooks/createObservableHook.js.map +0 -1
- package/react-hooks/createObservableHook.mjs.map +0 -1
- package/react-hooks/useHover.js.map +0 -1
- package/react-hooks/useHover.mjs.map +0 -1
- package/react-hooks/useMeasure.js.map +0 -1
- package/react-hooks/useMeasure.mjs.map +0 -1
- package/react-hooks/useObservableNextRouter.js.map +0 -1
- package/react-hooks/useObservableNextRouter.mjs.map +0 -1
- package/react.js.map +0 -1
- package/react.mjs.map +0 -1
- package/src/ObservableObject.ts +0 -1350
- package/src/ObservablePrimitive.ts +0 -62
- package/src/babel/index.ts +0 -83
- package/src/batching.ts +0 -357
- package/src/computed.ts +0 -18
- package/src/config/enable$GetSet.ts +0 -30
- package/src/config/enableReactComponents.ts +0 -26
- package/src/config/enableReactNativeComponents.ts +0 -102
- package/src/config/enableReactTracking.ts +0 -62
- package/src/config/enableReactUse.ts +0 -32
- package/src/config/enable_PeekAssign.ts +0 -31
- package/src/config.ts +0 -47
- package/src/createObservable.ts +0 -47
- package/src/event.ts +0 -26
- package/src/globals.ts +0 -235
- package/src/helpers/pageHash.ts +0 -41
- package/src/helpers/pageHashParams.ts +0 -55
- package/src/helpers/time.ts +0 -30
- package/src/helpers.ts +0 -231
- package/src/history/trackHistory.ts +0 -29
- package/src/history/undoRedo.ts +0 -111
- package/src/is.ts +0 -63
- package/src/linked.ts +0 -17
- package/src/observable.ts +0 -32
- package/src/observableInterfaces.ts +0 -151
- package/src/observableTypes.ts +0 -232
- package/src/observe.ts +0 -89
- package/src/old-plugins/firebase.ts +0 -1053
- package/src/onChange.ts +0 -146
- package/src/persist/configureObservablePersistence.ts +0 -7
- package/src/persist/fieldTransformer.ts +0 -149
- package/src/persist/observablePersistRemoteFunctionsAdapter.ts +0 -39
- package/src/persist/persistObservable.ts +0 -1034
- package/src/persist-plugins/async-storage.ts +0 -99
- package/src/persist-plugins/indexeddb.ts +0 -432
- package/src/persist-plugins/local-storage.ts +0 -86
- package/src/persist-plugins/mmkv.ts +0 -91
- package/src/proxy.ts +0 -28
- package/src/react/Computed.tsx +0 -8
- package/src/react/For.tsx +0 -116
- package/src/react/Memo.tsx +0 -4
- package/src/react/Reactive.tsx +0 -53
- package/src/react/Show.tsx +0 -33
- package/src/react/Switch.tsx +0 -43
- package/src/react/react-globals.ts +0 -3
- package/src/react/reactInterfaces.ts +0 -32
- package/src/react/reactive-observer.tsx +0 -210
- package/src/react/useComputed.ts +0 -36
- package/src/react/useEffectOnce.ts +0 -41
- package/src/react/useIsMounted.ts +0 -16
- package/src/react/useMount.ts +0 -15
- package/src/react/useObservable.ts +0 -24
- package/src/react/useObservableReducer.ts +0 -52
- package/src/react/useObservableState.ts +0 -30
- package/src/react/useObserve.ts +0 -54
- package/src/react/useObserveEffect.ts +0 -40
- package/src/react/usePauseProvider.tsx +0 -16
- package/src/react/useSelector.ts +0 -167
- package/src/react/useUnmount.ts +0 -8
- package/src/react/useWhen.ts +0 -9
- package/src/react-hooks/createObservableHook.ts +0 -53
- package/src/react-hooks/useHover.ts +0 -40
- package/src/react-hooks/useMeasure.ts +0 -48
- package/src/react-hooks/useObservableNextRouter.ts +0 -137
- package/src/retry.ts +0 -71
- package/src/setupTracking.ts +0 -26
- package/src/sync/activateSyncedNode.ts +0 -128
- package/src/sync/configureObservableSync.ts +0 -7
- package/src/sync/persistTypes.ts +0 -216
- package/src/sync/syncHelpers.ts +0 -180
- package/src/sync/syncObservable.ts +0 -1056
- package/src/sync/syncObservableAdapter.ts +0 -31
- package/src/sync/syncTypes.ts +0 -189
- package/src/sync/synced.ts +0 -21
- package/src/sync-plugins/crud.ts +0 -412
- package/src/sync-plugins/fetch.ts +0 -80
- package/src/sync-plugins/keel.ts +0 -495
- package/src/sync-plugins/supabase.ts +0 -249
- package/src/sync-plugins/tanstack-query.ts +0 -113
- package/src/sync-plugins/tanstack-react-query.ts +0 -12
- package/src/trace/traceHelpers.ts +0 -11
- package/src/trace/useTraceListeners.ts +0 -34
- package/src/trace/useTraceUpdates.ts +0 -24
- package/src/trace/useVerifyNotTracking.ts +0 -33
- package/src/trace/useVerifyOneRender.ts +0 -10
- package/src/trackSelector.ts +0 -52
- package/src/tracking.ts +0 -43
- package/src/types/babel.d.ts +0 -12
- package/src/when.ts +0 -75
- package/sync-plugins/crud.js.map +0 -1
- package/sync-plugins/crud.mjs.map +0 -1
- package/sync-plugins/fetch.js.map +0 -1
- package/sync-plugins/fetch.mjs.map +0 -1
- package/sync-plugins/keel.js.map +0 -1
- package/sync-plugins/keel.mjs.map +0 -1
- package/sync-plugins/supabase.js.map +0 -1
- package/sync-plugins/supabase.mjs.map +0 -1
- package/sync-plugins/tanstack-query.js.map +0 -1
- package/sync-plugins/tanstack-query.mjs.map +0 -1
- package/sync-plugins/tanstack-react-query.js.map +0 -1
- package/sync-plugins/tanstack-react-query.mjs.map +0 -1
- package/sync.js.map +0 -1
- package/sync.mjs.map +0 -1
- package/trace.js.map +0 -1
- package/trace.mjs.map +0 -1
|
@@ -1,137 +0,0 @@
|
|
|
1
|
-
import { isEmpty, observable, Observable, setSilently } from '@legendapp/state';
|
|
2
|
-
import Router, { NextRouter, useRouter } from 'next/router';
|
|
3
|
-
|
|
4
|
-
type ParsedUrlQuery = { [key: string]: string | string[] | undefined };
|
|
5
|
-
|
|
6
|
-
interface TransitionOptions {
|
|
7
|
-
shallow?: boolean;
|
|
8
|
-
locale?: string | false;
|
|
9
|
-
scroll?: boolean;
|
|
10
|
-
unstable_skipClientCache?: boolean;
|
|
11
|
-
}
|
|
12
|
-
export interface ObservableNextRouterState {
|
|
13
|
-
pathname: string;
|
|
14
|
-
hash: string;
|
|
15
|
-
query: ParsedUrlQuery;
|
|
16
|
-
}
|
|
17
|
-
type RouteInfo = Partial<ObservableNextRouterState>;
|
|
18
|
-
export interface ParamsUseObservableNextRouterBase {
|
|
19
|
-
transitionOptions?: TransitionOptions;
|
|
20
|
-
method?: 'push' | 'replace';
|
|
21
|
-
subscribe?: boolean;
|
|
22
|
-
}
|
|
23
|
-
export interface ParamsUseObservableNextRouter<T extends object> extends ParamsUseObservableNextRouterBase {
|
|
24
|
-
compute: (value: ObservableNextRouterState) => T;
|
|
25
|
-
set: (
|
|
26
|
-
value: T,
|
|
27
|
-
previous: T,
|
|
28
|
-
router: NextRouter,
|
|
29
|
-
) => RouteInfo & {
|
|
30
|
-
transitionOptions?: TransitionOptions;
|
|
31
|
-
method?: 'push' | 'replace';
|
|
32
|
-
};
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
function isShallowEqual(query1: ParsedUrlQuery, query2: ParsedUrlQuery) {
|
|
36
|
-
if (!query1 !== !query2) {
|
|
37
|
-
return false;
|
|
38
|
-
}
|
|
39
|
-
const keys1 = Object.keys(query1);
|
|
40
|
-
const keys2 = Object.keys(query2);
|
|
41
|
-
|
|
42
|
-
if (keys1.length !== keys2.length) {
|
|
43
|
-
return false;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
for (const key of keys1) {
|
|
47
|
-
if (query1[key] !== query2[key]) {
|
|
48
|
-
return false;
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
return true;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
const routes$ = observable({});
|
|
56
|
-
let routeParams = {} as ParamsUseObservableNextRouter<any>;
|
|
57
|
-
let router: NextRouter;
|
|
58
|
-
|
|
59
|
-
routes$.onChange(({ value, getPrevious }) => {
|
|
60
|
-
// Only run this if being manually changed by the user
|
|
61
|
-
let setter = routeParams?.set;
|
|
62
|
-
if (!setter) {
|
|
63
|
-
if ((value as any).pathname) {
|
|
64
|
-
setter = () => value;
|
|
65
|
-
} else {
|
|
66
|
-
console.error('[legend-state]: Must provide a set method to useObservableNextRouter');
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
const setReturn = setter(value, getPrevious(), router);
|
|
70
|
-
const { pathname, hash, query } = setReturn;
|
|
71
|
-
let { transitionOptions, method } = setReturn;
|
|
72
|
-
|
|
73
|
-
method = method || routeParams?.method;
|
|
74
|
-
transitionOptions = transitionOptions || routeParams?.transitionOptions;
|
|
75
|
-
|
|
76
|
-
const prevHash = router.asPath.split('#')[1] || '';
|
|
77
|
-
|
|
78
|
-
const change: RouteInfo = {};
|
|
79
|
-
// Only include changes that were meant to be changed. For example the user may have
|
|
80
|
-
// only changed the hash so we don't need to push a pathname change.
|
|
81
|
-
if (pathname !== undefined && pathname !== router.pathname) {
|
|
82
|
-
change.pathname = pathname;
|
|
83
|
-
}
|
|
84
|
-
if (hash !== undefined && hash !== prevHash) {
|
|
85
|
-
change.hash = hash;
|
|
86
|
-
}
|
|
87
|
-
if (query !== undefined && !isShallowEqual(query, router.query)) {
|
|
88
|
-
change.query = query;
|
|
89
|
-
}
|
|
90
|
-
// Only push if there are changes
|
|
91
|
-
if (!isEmpty(change)) {
|
|
92
|
-
const fn = method === 'replace' ? 'replace' : 'push';
|
|
93
|
-
router[fn](change, undefined, transitionOptions).catch((e) => {
|
|
94
|
-
// workaround for https://github.com/vercel/next.js/issues/37362
|
|
95
|
-
if (!e.cancelled) throw e;
|
|
96
|
-
});
|
|
97
|
-
}
|
|
98
|
-
});
|
|
99
|
-
|
|
100
|
-
export function useObservableNextRouter(): Observable<ObservableNextRouterState>;
|
|
101
|
-
export function useObservableNextRouter<T extends object>(params: ParamsUseObservableNextRouter<T>): Observable<T>;
|
|
102
|
-
export function useObservableNextRouter(
|
|
103
|
-
params: ParamsUseObservableNextRouterBase,
|
|
104
|
-
): Observable<ObservableNextRouterState>;
|
|
105
|
-
export function useObservableNextRouter<T extends object>(
|
|
106
|
-
params?: ParamsUseObservableNextRouter<T> | ParamsUseObservableNextRouterBase,
|
|
107
|
-
): Observable<T> | Observable<ObservableNextRouterState> {
|
|
108
|
-
const { subscribe, compute } = (params as ParamsUseObservableNextRouter<T>) || {};
|
|
109
|
-
|
|
110
|
-
try {
|
|
111
|
-
// Use the useRouter hook if we're on the client side and want to subscribe to changes.
|
|
112
|
-
// Otherwise use the Router object so that this does not subscribe to router changes.
|
|
113
|
-
router = typeof window !== 'undefined' && !subscribe ? Router : useRouter();
|
|
114
|
-
} finally {
|
|
115
|
-
router = router || useRouter();
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
// Update the local state with the new functions and options. This can happen when being run
|
|
119
|
-
// on a new page or if the user just changes it on the current page.
|
|
120
|
-
// It's better for performance than creating new observables or hooks for every use, since there may be
|
|
121
|
-
// many uses of useObservableRouter in the lifecycle of a page.
|
|
122
|
-
routeParams = params as ParamsUseObservableNextRouter<T>;
|
|
123
|
-
|
|
124
|
-
// Get the pathname and hash
|
|
125
|
-
const { asPath, pathname, query } = router;
|
|
126
|
-
const hash = asPath.split('#')[1] || '';
|
|
127
|
-
|
|
128
|
-
// Run the compute function to get the value of the object
|
|
129
|
-
const computeParams = { pathname, hash, query };
|
|
130
|
-
const obj = compute ? compute(computeParams) : computeParams;
|
|
131
|
-
|
|
132
|
-
// Set the object without triggering router.push
|
|
133
|
-
setSilently(routes$, obj);
|
|
134
|
-
|
|
135
|
-
// Return the observable with the computed values
|
|
136
|
-
return routes$ as any;
|
|
137
|
-
}
|
package/src/retry.ts
DELETED
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
import { whenReady } from './when';
|
|
2
|
-
import type { NodeValue } from './observableInterfaces';
|
|
3
|
-
import type { RetryOptions } from './sync/syncTypes';
|
|
4
|
-
import { isPromise } from './is';
|
|
5
|
-
|
|
6
|
-
function calculateRetryDelay(retryOptions: RetryOptions, attemptNum: number): number | null {
|
|
7
|
-
const { backoff, delay = 1000, infinite, times = 3, maxDelay = 30000 } = retryOptions;
|
|
8
|
-
if (infinite || attemptNum < times) {
|
|
9
|
-
const delayTime = Math.min(delay * (backoff === 'constant' ? 1 : 2 ** attemptNum), maxDelay);
|
|
10
|
-
return delayTime;
|
|
11
|
-
}
|
|
12
|
-
return null;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
function createRetryTimeout(retryOptions: RetryOptions, attemptNum: number, fn: () => void) {
|
|
16
|
-
const delayTime = calculateRetryDelay(retryOptions, attemptNum);
|
|
17
|
-
if (delayTime) {
|
|
18
|
-
return setTimeout(fn, delayTime);
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
export function runWithRetry<T>(
|
|
23
|
-
node: NodeValue,
|
|
24
|
-
state: { attemptNum: number; retry: RetryOptions | undefined },
|
|
25
|
-
fn: (e: { cancel?: boolean }) => T | Promise<T>,
|
|
26
|
-
): T | Promise<T> {
|
|
27
|
-
const { waitFor } = node.activationState!;
|
|
28
|
-
const { retry } = state;
|
|
29
|
-
|
|
30
|
-
const e = { cancel: false };
|
|
31
|
-
let value: any = undefined;
|
|
32
|
-
if (waitFor) {
|
|
33
|
-
value = whenReady(waitFor, () => {
|
|
34
|
-
node.activationState!.waitFor = undefined;
|
|
35
|
-
return fn(e);
|
|
36
|
-
});
|
|
37
|
-
} else {
|
|
38
|
-
value = fn(e);
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
if (isPromise(value) && retry) {
|
|
42
|
-
let timeoutRetry: any;
|
|
43
|
-
return new Promise<any>((resolve) => {
|
|
44
|
-
const run = () => {
|
|
45
|
-
(value as Promise<any>)
|
|
46
|
-
.then((val: any) => {
|
|
47
|
-
node.activationState!.persistedRetry = false;
|
|
48
|
-
resolve(val);
|
|
49
|
-
})
|
|
50
|
-
.catch(() => {
|
|
51
|
-
state.attemptNum++;
|
|
52
|
-
if (timeoutRetry) {
|
|
53
|
-
clearTimeout(timeoutRetry);
|
|
54
|
-
}
|
|
55
|
-
if (!e.cancel) {
|
|
56
|
-
timeoutRetry = createRetryTimeout(retry, state.attemptNum, () => {
|
|
57
|
-
value = fn(e);
|
|
58
|
-
run();
|
|
59
|
-
});
|
|
60
|
-
}
|
|
61
|
-
})
|
|
62
|
-
.finally(() => {
|
|
63
|
-
node.activationState!.persistedRetry = false;
|
|
64
|
-
});
|
|
65
|
-
};
|
|
66
|
-
run();
|
|
67
|
-
});
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
return value;
|
|
71
|
-
}
|
package/src/setupTracking.ts
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import type { ListenerFn, NodeValue, TrackingNode } from './observableInterfaces';
|
|
2
|
-
import { onChange } from './onChange';
|
|
3
|
-
|
|
4
|
-
export function setupTracking(
|
|
5
|
-
nodes: Map<NodeValue, TrackingNode> | undefined,
|
|
6
|
-
update: ListenerFn,
|
|
7
|
-
noArgs?: boolean,
|
|
8
|
-
immediate?: boolean,
|
|
9
|
-
) {
|
|
10
|
-
let listeners: (() => void)[] | undefined = [];
|
|
11
|
-
|
|
12
|
-
// Listen to tracked nodes
|
|
13
|
-
nodes?.forEach((tracked) => {
|
|
14
|
-
const { node, track } = tracked;
|
|
15
|
-
listeners!.push(onChange(node, update, { trackingType: track, immediate, noArgs }));
|
|
16
|
-
});
|
|
17
|
-
|
|
18
|
-
return () => {
|
|
19
|
-
if (listeners) {
|
|
20
|
-
for (let i = 0; i < listeners.length; i++) {
|
|
21
|
-
listeners[i]();
|
|
22
|
-
}
|
|
23
|
-
listeners = undefined;
|
|
24
|
-
}
|
|
25
|
-
};
|
|
26
|
-
}
|
|
@@ -1,128 +0,0 @@
|
|
|
1
|
-
import type { NodeValue, Observable, UpdateFn } from '@legendapp/state';
|
|
2
|
-
import type {
|
|
3
|
-
ObservableSyncFunctions,
|
|
4
|
-
ObservableSyncGetParams,
|
|
5
|
-
ObservableSyncSetParams,
|
|
6
|
-
SyncedGetParams,
|
|
7
|
-
SyncedSetParams,
|
|
8
|
-
} from './syncTypes';
|
|
9
|
-
import type { ObservablePersistState } from './persistTypes';
|
|
10
|
-
import { internal, isFunction, isPromise, mergeIntoObservable, whenReady } from '@legendapp/state';
|
|
11
|
-
import { syncObservable } from './syncObservable';
|
|
12
|
-
const { getProxy, globalState, runWithRetry, symbolLinked, setNodeValue, getNodeValue } = internal;
|
|
13
|
-
|
|
14
|
-
export function enableActivateSyncedNode() {
|
|
15
|
-
globalState.activateSyncedNode = function activateSyncedNode(node: NodeValue, newValue: any) {
|
|
16
|
-
const obs$ = getProxy(node);
|
|
17
|
-
if (node.activationState) {
|
|
18
|
-
// If it is a Synced
|
|
19
|
-
const { get, initial, set, retry } = node.activationState!;
|
|
20
|
-
|
|
21
|
-
let onChange: UpdateFn | undefined = undefined;
|
|
22
|
-
const pluginRemote: ObservableSyncFunctions = {};
|
|
23
|
-
let promiseReturn: any = undefined;
|
|
24
|
-
|
|
25
|
-
// Not sure why this disable is needed, but it's needed to make the linter happy
|
|
26
|
-
// eslint-disable-next-line prefer-const
|
|
27
|
-
let syncState: Observable<ObservablePersistState>;
|
|
28
|
-
const refresh = () => syncState?.sync();
|
|
29
|
-
|
|
30
|
-
if (get) {
|
|
31
|
-
pluginRemote.get = (params: ObservableSyncGetParams<any>) => {
|
|
32
|
-
onChange = params.onChange;
|
|
33
|
-
const updateLastSync = (lastSync: number) => (params.lastSync = lastSync);
|
|
34
|
-
|
|
35
|
-
const existingValue = getNodeValue(node);
|
|
36
|
-
const value = runWithRetry(node, { attemptNum: 0, retry: retry || params.options?.retry }, () => {
|
|
37
|
-
const paramsToGet = {
|
|
38
|
-
value:
|
|
39
|
-
isFunction(existingValue) || existingValue?.[symbolLinked] ? undefined : existingValue,
|
|
40
|
-
lastSync: params.lastSync!,
|
|
41
|
-
updateLastSync,
|
|
42
|
-
mode: params.mode!,
|
|
43
|
-
refresh,
|
|
44
|
-
};
|
|
45
|
-
|
|
46
|
-
const ret = get!(paramsToGet);
|
|
47
|
-
params.mode = paramsToGet.mode;
|
|
48
|
-
return ret;
|
|
49
|
-
});
|
|
50
|
-
|
|
51
|
-
promiseReturn = value;
|
|
52
|
-
|
|
53
|
-
return value;
|
|
54
|
-
};
|
|
55
|
-
}
|
|
56
|
-
if (set) {
|
|
57
|
-
// TODO: Work out these types better
|
|
58
|
-
pluginRemote.set = async (params: ObservableSyncSetParams<any>) => {
|
|
59
|
-
if (node.state?.isLoaded.get()) {
|
|
60
|
-
const retryAttempts = { attemptNum: 0, retry: retry || params.options?.retry };
|
|
61
|
-
return runWithRetry(node, retryAttempts, async (retryEvent) => {
|
|
62
|
-
let changes = {};
|
|
63
|
-
let maxModified = 0;
|
|
64
|
-
if (!node.state!.isLoaded.peek()) {
|
|
65
|
-
await whenReady(node.state!.isLoaded);
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
const cancelRetry = () => {
|
|
69
|
-
retryEvent.cancel = true;
|
|
70
|
-
};
|
|
71
|
-
|
|
72
|
-
await set({
|
|
73
|
-
...(params as unknown as SyncedSetParams<any>),
|
|
74
|
-
node,
|
|
75
|
-
update: (params) => {
|
|
76
|
-
const { value, lastSync } = params;
|
|
77
|
-
maxModified = Math.max(lastSync || 0, maxModified);
|
|
78
|
-
changes = mergeIntoObservable(changes, value);
|
|
79
|
-
},
|
|
80
|
-
retryNum: retryAttempts.attemptNum,
|
|
81
|
-
cancelRetry,
|
|
82
|
-
refresh,
|
|
83
|
-
fromSubscribe: false,
|
|
84
|
-
});
|
|
85
|
-
return { changes, lastSync: maxModified || undefined };
|
|
86
|
-
});
|
|
87
|
-
}
|
|
88
|
-
};
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
const nodeVal = getNodeValue(node);
|
|
92
|
-
if (promiseReturn !== undefined) {
|
|
93
|
-
newValue = promiseReturn;
|
|
94
|
-
} else if (nodeVal !== undefined && !isFunction(nodeVal)) {
|
|
95
|
-
newValue = nodeVal;
|
|
96
|
-
} else {
|
|
97
|
-
newValue = initial;
|
|
98
|
-
}
|
|
99
|
-
setNodeValue(node, promiseReturn ? undefined : newValue);
|
|
100
|
-
|
|
101
|
-
// @ts-expect-error TODO fix these types
|
|
102
|
-
syncState = syncObservable(obs$, { ...node.activationState, ...pluginRemote });
|
|
103
|
-
|
|
104
|
-
return { update: onChange!, value: newValue };
|
|
105
|
-
} else {
|
|
106
|
-
// If it is not a Synced
|
|
107
|
-
|
|
108
|
-
let update: UpdateFn | undefined = undefined;
|
|
109
|
-
const get = async (params: SyncedGetParams) => {
|
|
110
|
-
update = params.refresh;
|
|
111
|
-
if (isPromise(newValue)) {
|
|
112
|
-
try {
|
|
113
|
-
newValue = await newValue;
|
|
114
|
-
} catch {
|
|
115
|
-
// TODO Once we have global retry settings this should retry
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
return newValue;
|
|
119
|
-
};
|
|
120
|
-
|
|
121
|
-
syncObservable(obs$, {
|
|
122
|
-
get,
|
|
123
|
-
});
|
|
124
|
-
|
|
125
|
-
return { update: update!, value: newValue };
|
|
126
|
-
}
|
|
127
|
-
};
|
|
128
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import type { SyncedOptionsGlobal } from '@legendapp/state/sync';
|
|
2
|
-
|
|
3
|
-
export const observableSyncConfiguration: SyncedOptionsGlobal = {};
|
|
4
|
-
|
|
5
|
-
export function configureObservableSync(options?: SyncedOptionsGlobal) {
|
|
6
|
-
Object.assign(observableSyncConfiguration, options);
|
|
7
|
-
}
|
package/src/sync/persistTypes.ts
DELETED
|
@@ -1,216 +0,0 @@
|
|
|
1
|
-
/* eslint-disable @typescript-eslint/ban-ts-comment */
|
|
2
|
-
// @ts-ignore
|
|
3
|
-
import type { MMKVConfiguration } from 'react-native-mmkv';
|
|
4
|
-
// @ts-ignore
|
|
5
|
-
import type { AsyncStorageStatic } from '@react-native-async-storage/async-storage';
|
|
6
|
-
// @ts-ignore
|
|
7
|
-
import type { DatabaseReference, Query } from 'firebase/database';
|
|
8
|
-
|
|
9
|
-
import type {
|
|
10
|
-
ArrayValue,
|
|
11
|
-
Change,
|
|
12
|
-
ClassConstructor,
|
|
13
|
-
GetMode,
|
|
14
|
-
LinkedOptions,
|
|
15
|
-
RecordValue,
|
|
16
|
-
Selector,
|
|
17
|
-
TypeAtPath,
|
|
18
|
-
} from '../observableInterfaces';
|
|
19
|
-
import type { Observable, ObservableParam, ObservableState } from '../observableTypes';
|
|
20
|
-
import type { ObservablePersistPlugin, RetryOptions } from './syncTypes';
|
|
21
|
-
|
|
22
|
-
export interface PersistTransform<TOrig = any, TSaved = TOrig> {
|
|
23
|
-
load?: (value: TSaved) => TOrig | Promise<TOrig>;
|
|
24
|
-
save?: (value: TOrig) => TSaved | Promise<TSaved>;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
export interface LegacyPersistOptionsLocal<T = any> {
|
|
28
|
-
name: string;
|
|
29
|
-
transform?: PersistTransform<T>;
|
|
30
|
-
fieldTransforms?: FieldTransforms<T>;
|
|
31
|
-
readonly?: boolean;
|
|
32
|
-
mmkv?: MMKVConfiguration;
|
|
33
|
-
indexedDB?: {
|
|
34
|
-
prefixID?: string;
|
|
35
|
-
itemID?: string;
|
|
36
|
-
};
|
|
37
|
-
options?: any;
|
|
38
|
-
}
|
|
39
|
-
export type LegacyPersistOptionsRemote<T = any> = ObservablePersistenceConfigRemoteGlobalOptions & {
|
|
40
|
-
readonly?: boolean;
|
|
41
|
-
waitForGet?: Selector<any>;
|
|
42
|
-
waitForSet?: LinkedOptions['waitForSet'];
|
|
43
|
-
manual?: boolean;
|
|
44
|
-
fieldTransforms?: FieldTransforms<T>;
|
|
45
|
-
allowSetIfError?: boolean;
|
|
46
|
-
transform?: PersistTransform<T>;
|
|
47
|
-
firebase?: {
|
|
48
|
-
refPath: (uid: string | undefined) => string;
|
|
49
|
-
query?: (ref: DatabaseReference) => DatabaseReference | Query;
|
|
50
|
-
queryByModified?: QueryByModified<T>;
|
|
51
|
-
ignoreKeys?: string[];
|
|
52
|
-
requireAuth?: boolean;
|
|
53
|
-
mode?: 'once' | 'realtime';
|
|
54
|
-
};
|
|
55
|
-
offlineBehavior?: false | 'retry';
|
|
56
|
-
changeTimeout?: number;
|
|
57
|
-
metadataTimeout?: number;
|
|
58
|
-
retry?: RetryOptions;
|
|
59
|
-
onGetError?: (error: Error) => void;
|
|
60
|
-
onSetError?: (error: Error) => void;
|
|
61
|
-
log?: (message?: any, ...optionalParams: any[]) => void;
|
|
62
|
-
onBeforeSet?: () => void;
|
|
63
|
-
onSet?: () => void;
|
|
64
|
-
};
|
|
65
|
-
export interface ObservablePersistenceConfigLocalGlobalOptions {
|
|
66
|
-
onGetError?: (error: Error) => void;
|
|
67
|
-
onSetError?: (error: Error) => void;
|
|
68
|
-
indexedDB?: {
|
|
69
|
-
databaseName: string;
|
|
70
|
-
version: number;
|
|
71
|
-
tableNames: string[];
|
|
72
|
-
};
|
|
73
|
-
asyncStorage?: {
|
|
74
|
-
AsyncStorage: AsyncStorageStatic;
|
|
75
|
-
preload?: boolean | string[];
|
|
76
|
-
};
|
|
77
|
-
}
|
|
78
|
-
export interface ObservablePersistenceConfigRemoteGlobalOptions {
|
|
79
|
-
debounceSet?: number;
|
|
80
|
-
dateModifiedKey?: string;
|
|
81
|
-
offlineBehavior?: false | 'retry';
|
|
82
|
-
retry?: RetryOptions;
|
|
83
|
-
onGetError?: (error: Error) => void;
|
|
84
|
-
onSetError?: (error: Error) => void;
|
|
85
|
-
log?: (logLevel: 'verbose' | 'warning' | 'error', message: any, ...optionalParams: any[]) => void;
|
|
86
|
-
onBeforeSet?: () => void;
|
|
87
|
-
onAfterSet?: () => void;
|
|
88
|
-
}
|
|
89
|
-
export interface ObservablePersistenceConfig {
|
|
90
|
-
pluginLocal?: ClassConstructor<ObservablePersistPlugin>;
|
|
91
|
-
pluginRemote?: ClassConstructor<ObservablePersistRemoteClass> | ObservablePersistRemoteFunctions;
|
|
92
|
-
localOptions?: ObservablePersistenceConfigLocalGlobalOptions;
|
|
93
|
-
remoteOptions?: ObservablePersistenceConfigRemoteGlobalOptions;
|
|
94
|
-
}
|
|
95
|
-
export interface LegacyPersistOptions<T = any> {
|
|
96
|
-
local?: string | LegacyPersistOptionsLocal<T>;
|
|
97
|
-
remote?: LegacyPersistOptionsRemote<T>;
|
|
98
|
-
pluginLocal?: ClassConstructor<ObservablePersistPlugin>;
|
|
99
|
-
pluginRemote?: ClassConstructor<ObservablePersistRemoteClass> | ObservablePersistRemoteFunctions<T>;
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
export interface ObservableOnChangeParams {
|
|
103
|
-
value: unknown;
|
|
104
|
-
path?: string[]; // TODOv4 remove
|
|
105
|
-
pathTypes?: TypeAtPath[]; // TODOv4 remove
|
|
106
|
-
mode?: GetMode;
|
|
107
|
-
dateModified?: number | undefined; // TODOv4 remove
|
|
108
|
-
lastSync?: number | undefined;
|
|
109
|
-
}
|
|
110
|
-
export interface ObservablePersistRemoteSetParams<T> {
|
|
111
|
-
syncState: Observable<ObservablePersistState>;
|
|
112
|
-
obs: ObservableParam<T>;
|
|
113
|
-
options: LegacyPersistOptions<T>;
|
|
114
|
-
changes: Change[];
|
|
115
|
-
value: T;
|
|
116
|
-
}
|
|
117
|
-
export interface ObservablePersistRemoteGetParams<T> {
|
|
118
|
-
state: Observable<ObservablePersistState>;
|
|
119
|
-
obs: ObservableParam<T>;
|
|
120
|
-
options: LegacyPersistOptions<T>;
|
|
121
|
-
dateModified?: number;
|
|
122
|
-
lastSync?: number;
|
|
123
|
-
mode?: GetMode;
|
|
124
|
-
onGet: () => void;
|
|
125
|
-
onError: (error: Error) => void;
|
|
126
|
-
onChange: (params: ObservableOnChangeParams) => void | Promise<void>;
|
|
127
|
-
}
|
|
128
|
-
export type ObservablePersistRemoteGetFnParams<T> = Omit<ObservablePersistRemoteGetParams<T>, 'onGet'>;
|
|
129
|
-
|
|
130
|
-
export interface ObservablePersistRemoteClass {
|
|
131
|
-
get?<T>(params: ObservablePersistRemoteGetParams<T>): void;
|
|
132
|
-
set?<T>(
|
|
133
|
-
params: ObservablePersistRemoteSetParams<T>,
|
|
134
|
-
): void | Promise<void | { changes?: object; dateModified?: number; lastSync?: number; pathStrs?: string[] }>;
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
export interface ObservablePersistRemoteFunctions<T = any> {
|
|
138
|
-
get?(params: ObservablePersistRemoteGetFnParams<T>): T | Promise<T>;
|
|
139
|
-
set?(
|
|
140
|
-
params: ObservablePersistRemoteSetParams<T>,
|
|
141
|
-
): void | Promise<void | { changes?: object | undefined; dateModified?: number; lastSync?: number }>;
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
export interface ObservablePersistStateBase {
|
|
145
|
-
isLoadedLocal: boolean;
|
|
146
|
-
isEnabledLocal: boolean;
|
|
147
|
-
isEnabledRemote: boolean;
|
|
148
|
-
dateModified?: number;
|
|
149
|
-
lastSync?: number;
|
|
150
|
-
syncCount?: number;
|
|
151
|
-
clearLocal: () => Promise<void>;
|
|
152
|
-
sync: () => Promise<void>;
|
|
153
|
-
getPendingChanges: () =>
|
|
154
|
-
| Record<
|
|
155
|
-
string,
|
|
156
|
-
{
|
|
157
|
-
p: any;
|
|
158
|
-
v?: any;
|
|
159
|
-
}
|
|
160
|
-
>
|
|
161
|
-
| undefined;
|
|
162
|
-
}
|
|
163
|
-
export type ObservablePersistState = ObservableState & ObservablePersistStateBase;
|
|
164
|
-
|
|
165
|
-
// This converts the state object's shape to the field transformer's shape
|
|
166
|
-
// TODO: FieldTransformer and this shape can likely be refactored to be simpler
|
|
167
|
-
declare type ObjectKeys<T> = Pick<
|
|
168
|
-
T,
|
|
169
|
-
{
|
|
170
|
-
[K in keyof T]-?: K extends string
|
|
171
|
-
? T[K] extends Record<string, any>
|
|
172
|
-
? T[K] extends any[]
|
|
173
|
-
? never
|
|
174
|
-
: K
|
|
175
|
-
: never
|
|
176
|
-
: never;
|
|
177
|
-
}[keyof T]
|
|
178
|
-
>;
|
|
179
|
-
declare type DictKeys<T> = Pick<
|
|
180
|
-
T,
|
|
181
|
-
{
|
|
182
|
-
[K in keyof T]-?: K extends string ? (T[K] extends Record<string, Record<string, any>> ? K : never) : never;
|
|
183
|
-
}[keyof T]
|
|
184
|
-
>;
|
|
185
|
-
declare type ArrayKeys<T> = Pick<
|
|
186
|
-
T,
|
|
187
|
-
{
|
|
188
|
-
[K in keyof T]-?: K extends string | number ? (T[K] extends any[] ? K : never) : never;
|
|
189
|
-
}[keyof T]
|
|
190
|
-
>;
|
|
191
|
-
export declare type FieldTransforms<T> =
|
|
192
|
-
| (T extends Record<string, Record<string, any>> ? { _dict: FieldTransformsInner<RecordValue<T>> } : never)
|
|
193
|
-
| FieldTransformsInner<T>;
|
|
194
|
-
export declare type FieldTransformsInner<T> = {
|
|
195
|
-
[K in keyof T]: string;
|
|
196
|
-
} & (
|
|
197
|
-
| {
|
|
198
|
-
[K in keyof ObjectKeys<T> as `${K}_obj`]?: FieldTransforms<T[K]>;
|
|
199
|
-
}
|
|
200
|
-
| {
|
|
201
|
-
[K in keyof DictKeys<T> as `${K}_dict`]?: FieldTransforms<RecordValue<T[K]>>;
|
|
202
|
-
}
|
|
203
|
-
) & {
|
|
204
|
-
[K in keyof ArrayKeys<T> as `${K}_arr`]?: FieldTransforms<ArrayValue<T[K]>>;
|
|
205
|
-
} & {
|
|
206
|
-
[K in keyof ArrayKeys<T> as `${K}_val`]?: FieldTransforms<ArrayValue<T[K]>>;
|
|
207
|
-
};
|
|
208
|
-
|
|
209
|
-
export type QueryByModified<T> =
|
|
210
|
-
| boolean
|
|
211
|
-
| {
|
|
212
|
-
[K in keyof T]?: QueryByModified<T[K]>;
|
|
213
|
-
}
|
|
214
|
-
| {
|
|
215
|
-
'*'?: boolean;
|
|
216
|
-
};
|