stroid 0.1.4 → 0.1.5
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/CHANGELOG.md +148 -34
- package/README.md +124 -17
- package/dist/async-internal.d.ts +30 -0
- package/dist/async.d.ts +7 -12
- package/dist/async.js +1 -1
- package/dist/chunk-4C666HHU.js +2 -0
- package/dist/chunk-4D6OA3DD.js +2 -0
- package/dist/chunk-6IBJ7CIK.js +14 -0
- package/dist/chunk-BWNLQKTY.js +2 -0
- package/dist/chunk-E33L4MII.js +2 -0
- package/dist/chunk-FSNVSMAV.js +2 -0
- package/dist/chunk-GZQGU64H.js +2 -0
- package/dist/chunk-LWUT37FW.js +13 -0
- package/dist/chunk-NFT6AZXY.js +2 -0
- package/dist/chunk-PHE2BCFG.js +2 -0
- package/dist/chunk-SF6EP56S.js +2 -0
- package/dist/chunk-WE3ZR6OG.js +2 -0
- package/dist/chunk-WXJ3IREA.js +2 -0
- package/dist/chunk-X2MKRN7O.js +14 -0
- package/dist/chunk-Y54SMROI.js +2 -0
- package/dist/computed.d.ts +6 -5
- package/dist/computed.js +1 -1
- package/dist/core-internal.d.ts +23 -0
- package/dist/core.d.ts +3 -2
- package/dist/core.js +1 -1
- package/dist/devtools-internal.d.ts +26 -0
- package/dist/devtools.d.ts +4 -25
- package/dist/devtools.js +1 -1
- package/dist/feature.d.ts +9 -2
- package/dist/feature.js +1 -1
- package/dist/fetch-4RH6MPY3.js +2 -0
- package/dist/graph-D28.d.ts +20 -0
- package/dist/helpers.d.ts +2 -1
- package/dist/helpers.js +1 -1
- package/dist/index-internal.d.ts +19 -19
- package/dist/index.d.cts +40 -22
- package/dist/index.d.ts +40 -22
- package/dist/index.js +1 -1
- package/dist/install.d.ts +16 -4
- package/dist/install.js +1 -1
- package/dist/metrics.d.ts +13 -0
- package/dist/persist.d.ts +3 -1
- package/dist/persist.js +1 -1
- package/dist/psr.d.ts +7 -8
- package/dist/psr.js +1 -1
- package/dist/query.d.ts +17 -0
- package/dist/query.js +2 -0
- package/dist/react/index.d.ts +10 -3
- package/dist/react/index.js +5 -5
- package/dist/registry.d.ts +22 -14
- package/dist/runtime-admin.js +1 -1
- package/dist/runtime-tools.d.ts +38 -65
- package/dist/runtime-tools.js +1 -1
- package/dist/selectors.d.ts +1 -1
- package/dist/selectors.js +1 -1
- package/dist/server/portable.d.ts +27 -0
- package/dist/server/portable.js +2 -0
- package/dist/server.d.ts +9 -20
- package/dist/server.js +1 -1
- package/dist/shared.d.ts +36 -0
- package/dist/store-registry.d.ts +3 -1
- package/dist/sync.d.ts +10 -1
- package/dist/sync.js +1 -1
- package/dist/testing.d.ts +1 -0
- package/dist/testing.js +1 -1
- package/dist/tsdoc-metadata.json +11 -0
- package/dist/types-internal-2.d.ts +168 -0
- package/dist/{computed-types.d.ts → types-internal-3.d.ts} +1 -1
- package/dist/{options.d.ts → types-internal.d.ts} +25 -9
- package/dist/types.d.ts +12 -2
- package/package.json +80 -26
- package/dist/chunk-645IESIU.js +0 -2
- package/dist/chunk-6ELWGQ4Q.js +0 -2
- package/dist/chunk-BW32TJGE.js +0 -13
- package/dist/chunk-FOQKGHPS.js +0 -26
- package/dist/chunk-KQCSFGHJ.js +0 -2
- package/dist/chunk-M2NJVI36.js +0 -2
- package/dist/chunk-PVATWAY4.js +0 -2
- package/dist/chunk-X3JR32JD.js +0 -2
- package/dist/computed-types.js +0 -2
- package/dist/types/adapters/options.d.ts +0 -335
- package/dist/types/async/cache.d.ts +0 -40
- package/dist/types/async/clone.d.ts +0 -10
- package/dist/types/async/errors.d.ts +0 -3
- package/dist/types/async/fetch.d.ts +0 -37
- package/dist/types/async/inflight.d.ts +0 -30
- package/dist/types/async/rate.d.ts +0 -5
- package/dist/types/async/registry.d.ts +0 -117
- package/dist/types/async/request.d.ts +0 -11
- package/dist/types/async/retry.d.ts +0 -10
- package/dist/types/async.d.ts +0 -10
- package/dist/types/computed/computed-graph.d.ts +0 -33
- package/dist/types/computed/index.d.ts +0 -21
- package/dist/types/computed/types.d.ts +0 -40
- package/dist/types/config.d.ts +0 -10
- package/dist/types/core/index.d.ts +0 -11
- package/dist/types/core/lifecycle-hooks.d.ts +0 -16
- package/dist/types/core/runtime-patch.d.ts +0 -67
- package/dist/types/core/store-admin-impl.d.ts +0 -9
- package/dist/types/core/store-admin.d.ts +0 -9
- package/dist/types/core/store-core.d.ts +0 -13
- package/dist/types/core/store-create.d.ts +0 -16
- package/dist/types/core/store-hydrate-impl.d.ts +0 -35
- package/dist/types/core/store-hydrate.d.ts +0 -9
- package/dist/types/core/store-lifecycle/hooks.d.ts +0 -20
- package/dist/types/core/store-lifecycle/identity.d.ts +0 -23
- package/dist/types/core/store-lifecycle/registry.d.ts +0 -54
- package/dist/types/core/store-lifecycle/types.d.ts +0 -67
- package/dist/types/core/store-lifecycle/validation.d.ts +0 -53
- package/dist/types/core/store-name.d.ts +0 -28
- package/dist/types/core/store-notify.d.ts +0 -13
- package/dist/types/core/store-read.d.ts +0 -18
- package/dist/types/core/store-registry.d.ts +0 -115
- package/dist/types/core/store-replace-impl.d.ts +0 -11
- package/dist/types/core/store-replace.d.ts +0 -9
- package/dist/types/core/store-set-impl.d.ts +0 -13
- package/dist/types/core/store-set.d.ts +0 -9
- package/dist/types/core/store-shared/core.d.ts +0 -13
- package/dist/types/core/store-shared/notify.d.ts +0 -12
- package/dist/types/core/store-transaction.d.ts +0 -28
- package/dist/types/core/store-write-shared.d.ts +0 -25
- package/dist/types/core/store-write.d.ts +0 -13
- package/dist/types/features/feature-registry.d.ts +0 -91
- package/dist/types/features/lifecycle.d.ts +0 -40
- package/dist/types/index.d.ts +0 -17
- package/dist/types/integrations/query.d.ts +0 -8
- package/dist/types/internals/computed-order.d.ts +0 -3
- package/dist/types/internals/config.d.ts +0 -116
- package/dist/types/internals/diagnostics.d.ts +0 -21
- package/dist/types/internals/reporting.d.ts +0 -9
- package/dist/types/internals/store-admin.d.ts +0 -7
- package/dist/types/internals/store-ops.d.ts +0 -13
- package/dist/types/internals/test-reset.d.ts +0 -2
- package/dist/types/internals/write-context.d.ts +0 -20
- package/dist/types/notification/delivery.d.ts +0 -3
- package/dist/types/notification/index.d.ts +0 -10
- package/dist/types/notification/metrics.d.ts +0 -12
- package/dist/types/notification/priority.d.ts +0 -9
- package/dist/types/notification/scheduler.d.ts +0 -11
- package/dist/types/notification/snapshot.d.ts +0 -8
- package/dist/types/runtime-admin/index.d.ts +0 -2
- package/dist/types/runtime-tools/index.d.ts +0 -63
- package/dist/types/store.d.ts +0 -16
- package/dist/types/types/utility.d.ts +0 -17
- package/dist/types/utils/clone.d.ts +0 -4
- package/dist/types/utils/devfreeze.d.ts +0 -2
- package/dist/types/utils/hash.d.ts +0 -8
- package/dist/types/utils/path.d.ts +0 -5
- package/dist/types/utils/validation.d.ts +0 -14
- package/dist/types/utils.d.ts +0 -13
package/dist/runtime-tools.d.ts
CHANGED
|
@@ -1,71 +1,44 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
export { C as ColdStoreReport, f as findColdStores, a as getInitialState, b as getMetrics, g as getStoreMeta, c as getSubscriberCount, l as listStores } from './core-internal.js';
|
|
2
|
+
export { S as StoreHealthEntry, a as StoreHealthReport, g as getAsyncInflightCount, b as getPersistQueueDepth, c as getStoreHealth } from './async-internal.js';
|
|
3
|
+
export { e as evaluateComputed, a as getComputedDeps, g as getComputedDescriptor, b as getComputedGraph, c as getRuntimeGraph } from './graph-D28.js';
|
|
4
|
+
import { H as HydrationSnapshotMetadata, a as HydrationConsistencyAuthority, b as HydrationConsistencyPolicy, c as HydrationConsistencyResolution, d as HydrationConsistencySource, e as HydrationConsistencyMetrics, f as HydrationBootWindowMode, g as HydrationDriftEvent } from './types-internal-2.js';
|
|
5
|
+
export { C as ComputedClassification, a as ComputedDescriptor, b as RuntimeEdgeType, R as RuntimeGraph, c as RuntimeGraphEdge, d as RuntimeGraphGranularity, e as RuntimeGraphNode, f as RuntimeNodeId, g as RuntimeNodeType } from './types-internal-3.js';
|
|
6
|
+
import './feature.js';
|
|
7
|
+
import './types-internal.js';
|
|
6
8
|
import './utility.js';
|
|
7
|
-
import './
|
|
8
|
-
import './types.js';
|
|
9
|
+
import './metrics.js';
|
|
9
10
|
import './registry.js';
|
|
10
11
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
12
|
+
type HydrationConsistencyReport = HydrationSnapshotMetadata & {
|
|
13
|
+
store: string;
|
|
14
|
+
authority: HydrationConsistencyAuthority;
|
|
15
|
+
policy: HydrationConsistencyPolicy;
|
|
16
|
+
hydratedAt: string;
|
|
17
|
+
hydratedAtMs: number;
|
|
18
|
+
firstDivergedAt: string | null;
|
|
19
|
+
firstDivergedAtMs: number | null;
|
|
20
|
+
lastDivergedAt: string | null;
|
|
21
|
+
lastDivergedAtMs: number | null;
|
|
22
|
+
lastResolution: HydrationConsistencyResolution | null;
|
|
23
|
+
lastSource: HydrationConsistencySource | null;
|
|
24
|
+
driftCount: number;
|
|
25
|
+
queuedWrites: number;
|
|
26
|
+
replayedWrites: number;
|
|
27
|
+
invalidatedAt: string | null;
|
|
28
|
+
invalidatedAtMs: number | null;
|
|
29
|
+
baselineHash: number;
|
|
30
|
+
currentHash: number;
|
|
31
|
+
baseline: unknown;
|
|
26
32
|
};
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
meta: StoreFeatureMeta | null;
|
|
34
|
-
metrics: StoreFeatureMeta["metrics"] | null;
|
|
35
|
-
async: {
|
|
36
|
-
inflight: number;
|
|
37
|
-
lastCorrelationId: string | null;
|
|
38
|
-
traceContext: StoreFeatureMeta["lastTraceContext"] | null;
|
|
39
|
-
};
|
|
40
|
-
persist: {
|
|
41
|
-
queueDepth: number;
|
|
42
|
-
};
|
|
33
|
+
type HydrationDriftMetrics = HydrationConsistencyMetrics & {
|
|
34
|
+
pendingWrites: number;
|
|
35
|
+
bootWindowActive: boolean;
|
|
36
|
+
bootWindowMode: HydrationBootWindowMode | null;
|
|
37
|
+
bootWindowEndsAtMs: number | null;
|
|
38
|
+
manualCloseAvailable: boolean;
|
|
43
39
|
};
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
registry: {
|
|
48
|
-
totalStores: number;
|
|
49
|
-
coldStores: ColdStoreReport[];
|
|
50
|
-
};
|
|
51
|
-
};
|
|
52
|
-
declare const getStoreHealth: (name?: string) => StoreHealthEntry | StoreHealthReport | null;
|
|
53
|
-
declare const getPersistQueueDepth: (name: string) => number;
|
|
54
|
-
declare const getComputedGraph: () => {
|
|
55
|
-
nodes: string[];
|
|
56
|
-
edges: Array<{
|
|
57
|
-
from: string;
|
|
58
|
-
to: string;
|
|
59
|
-
}>;
|
|
60
|
-
dependencies: Record<string, string[]>;
|
|
61
|
-
dependents: Record<string, string[]>;
|
|
62
|
-
};
|
|
63
|
-
declare const getRuntimeGraph: () => RuntimeGraph;
|
|
64
|
-
declare const getComputedDeps: (name: string) => {
|
|
65
|
-
deps: string[];
|
|
66
|
-
dependents: string[];
|
|
67
|
-
} | null;
|
|
68
|
-
declare const getComputedDescriptor: (nodeId: RuntimeNodeId) => ComputedDescriptor | null;
|
|
69
|
-
declare const evaluateComputed: (nodeId: RuntimeNodeId, snapshot: Record<string, unknown>) => unknown;
|
|
40
|
+
declare const getHydrationConsistency: (name?: string) => HydrationConsistencyReport | HydrationConsistencyReport[] | null;
|
|
41
|
+
declare const getHydrationDriftEvents: (limit?: number) => HydrationDriftEvent[];
|
|
42
|
+
declare const getHydrationDriftMetrics: () => HydrationDriftMetrics;
|
|
70
43
|
|
|
71
|
-
export { type
|
|
44
|
+
export { type HydrationConsistencyReport, type HydrationDriftMetrics, getHydrationConsistency, getHydrationDriftEvents, getHydrationDriftMetrics };
|
package/dist/runtime-tools.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export{n as evaluateComputed,
|
|
1
|
+
export{n as evaluateComputed,f as findColdStores,g as getAsyncInflightCount,l as getComputedDeps,m as getComputedDescriptor,j as getComputedGraph,o as getHydrationConsistency,p as getHydrationDriftEvents,q as getHydrationDriftMetrics,c as getInitialState,d as getMetrics,h as getPersistQueueDepth,k as getRuntimeGraph,i as getStoreHealth,b as getStoreMeta,e as getSubscriberCount,a as listStores}from'./chunk-SF6EP56S.js';import'./chunk-LWUT37FW.js';import'./chunk-E33L4MII.js';import'./chunk-X2MKRN7O.js';import'./chunk-6IBJ7CIK.js';import'./chunk-PHE2BCFG.js';import'./chunk-4C666HHU.js';//# sourceMappingURL=runtime-tools.js.map
|
|
2
2
|
//# sourceMappingURL=runtime-tools.js.map
|
package/dist/selectors.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
declare const createSelector: <TState, TResult>(storeName: string, selectorFn: (state: TState) => TResult) => () => NonNullable<TResult> | null;
|
|
2
|
-
declare const subscribeWithSelector: <R>(name: string, selector: (state:
|
|
2
|
+
declare const subscribeWithSelector: <TState = unknown, R = unknown>(name: string, selector: (state: TState) => R, equality: ((a: R, b: R) => boolean) | undefined, listener: (next: R, prev: R | undefined) => void) => (() => void);
|
|
3
3
|
|
|
4
4
|
export { createSelector, subscribeWithSelector };
|
package/dist/selectors.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export{a as createSelector,b as subscribeWithSelector}from'./chunk-
|
|
1
|
+
export{a as createSelector,b as subscribeWithSelector}from'./chunk-BWNLQKTY.js';import'./chunk-X2MKRN7O.js';import'./chunk-6IBJ7CIK.js';import'./chunk-PHE2BCFG.js';import'./chunk-4C666HHU.js';//# sourceMappingURL=selectors.js.map
|
|
2
2
|
//# sourceMappingURL=selectors.js.map
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { S as StoreRegistry } from '../store-registry.js';
|
|
2
|
+
import { c as StoreStateMap } from '../types.js';
|
|
3
|
+
import { e as RequestStoreName, f as RequestStoreValue, a as RequestSnapshot, b as RequestScopeCapture } from '../shared.js';
|
|
4
|
+
export { c as RequestHydrateOptions, d as RequestScopeOptions } from '../shared.js';
|
|
5
|
+
import { S as StoreOptions } from '../types-internal.js';
|
|
6
|
+
import '../feature.js';
|
|
7
|
+
import '../utility.js';
|
|
8
|
+
import '../types-internal-2.js';
|
|
9
|
+
import '../runtime-patch.js';
|
|
10
|
+
import '../registry.js';
|
|
11
|
+
import '../types-internal-3.js';
|
|
12
|
+
|
|
13
|
+
type RequestScopeApi<StateMap extends StoreStateMap = StoreStateMap> = {
|
|
14
|
+
create: <Name extends RequestStoreName<StateMap>>(name: Name, data: RequestStoreValue<StateMap, Name>, options?: StoreOptions<RequestStoreValue<StateMap, Name>>) => RequestStoreValue<StateMap, Name> | null;
|
|
15
|
+
set: <Name extends RequestStoreName<StateMap>>(name: Name, updater: RequestStoreValue<StateMap, Name> | ((draft: RequestStoreValue<StateMap, Name>) => void)) => RequestStoreValue<StateMap, Name> | null;
|
|
16
|
+
get: <Name extends RequestStoreName<StateMap>>(name: Name) => RequestStoreValue<StateMap, Name> | null;
|
|
17
|
+
snapshot: () => RequestSnapshot<StateMap>;
|
|
18
|
+
capture: () => RequestScopeCapture<StateMap>;
|
|
19
|
+
bind: <Args extends unknown[], Result>(callback: (...args: Args) => Result) => (...args: Args) => Result;
|
|
20
|
+
};
|
|
21
|
+
type RequestScopeContext<StateMap extends StoreStateMap = StoreStateMap> = RequestScopeApi<StateMap> & {
|
|
22
|
+
registry: StoreRegistry;
|
|
23
|
+
run: <T>(fn: (api: RequestScopeApi<StateMap>) => T) => T;
|
|
24
|
+
};
|
|
25
|
+
declare const createRequestScope: <StateMap extends StoreStateMap = StoreStateMap>(initial?: RequestScopeCapture<StateMap>) => RequestScopeContext<StateMap>;
|
|
26
|
+
|
|
27
|
+
export { type RequestScopeApi, RequestScopeCapture, type RequestScopeContext, RequestSnapshot, RequestStoreName, RequestStoreValue, createRequestScope };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import {b,c,a}from'../chunk-WE3ZR6OG.js';import {W,n,w,l}from'../chunk-X2MKRN7O.js';import {y,H}from'../chunk-6IBJ7CIK.js';import'../chunk-PHE2BCFG.js';import'../chunk-4C666HHU.js';var d=l,u=n,g=w,f=s=>s!==null&&(typeof s=="object"||typeof s=="function")&&typeof s.then=="function",V=s=>{let a$1=y("request"),r=0;if(s){let e=b(s);H(a$1,()=>{W(e.snapshot,e.options,{allowTrusted:true});});}let S=()=>b(c(a$1)),i={create:(e,t,n={})=>H(a$1,()=>(d(e,t,a(n)),u(e))),set:(e,t)=>H(a$1,()=>(g(e,t),u(e))),get:e=>H(a$1,()=>u(e)),snapshot:()=>S().snapshot,capture:S,bind:e=>(...t)=>{if(r<=0)throw new Error("Bound request scope callback invoked outside scope.run().");return H(a$1,()=>e(...t))}};return {registry:a$1,...i,run:e=>{r+=1;let t;try{t=H(a$1,()=>e(i));}catch(n){throw r-=1,n}return f(t)?Promise.resolve(t).finally(()=>{r-=1;}):(r-=1,t)}}};export{V as createRequestScope};//# sourceMappingURL=portable.js.map
|
|
2
|
+
//# sourceMappingURL=portable.js.map
|
package/dist/server.d.ts
CHANGED
|
@@ -1,33 +1,22 @@
|
|
|
1
|
-
import { S as StoreOptions } from './options.js';
|
|
2
1
|
import { c as StoreStateMap } from './types.js';
|
|
3
2
|
import { S as StoreRegistry } from './store-registry.js';
|
|
4
|
-
import './
|
|
3
|
+
import { R as RequestStoreApi, a as RequestSnapshot, b as RequestScopeCapture, c as RequestHydrateOptions } from './shared.js';
|
|
4
|
+
export { d as RequestScopeOptions, e as RequestStoreName, f as RequestStoreValue } from './shared.js';
|
|
5
|
+
import './types-internal-2.js';
|
|
5
6
|
import './feature.js';
|
|
7
|
+
import './types-internal.js';
|
|
8
|
+
import './utility.js';
|
|
6
9
|
import './runtime-patch.js';
|
|
7
10
|
import './registry.js';
|
|
8
|
-
import './
|
|
11
|
+
import './types-internal-3.js';
|
|
9
12
|
|
|
10
|
-
type RequestStoreName<StateMap> = keyof StateMap extends never ? string : keyof StateMap & string;
|
|
11
|
-
type RequestStoreValue<StateMap, Name extends RequestStoreName<StateMap>> = Name extends keyof StateMap ? StateMap[Name] : unknown;
|
|
12
|
-
type RequestSnapshot<StateMap> = Partial<{
|
|
13
|
-
[K in RequestStoreName<StateMap>]: RequestStoreValue<StateMap, K>;
|
|
14
|
-
}>;
|
|
15
|
-
type RequestHydrateOptions<StateMap> = Partial<{
|
|
16
|
-
[K in RequestStoreName<StateMap>]: StoreOptions<RequestStoreValue<StateMap, K>>;
|
|
17
|
-
}> & {
|
|
18
|
-
default?: StoreOptions;
|
|
19
|
-
};
|
|
20
|
-
type RequestStoreApi<StateMap extends StoreStateMap = StoreStateMap> = {
|
|
21
|
-
create: <Name extends RequestStoreName<StateMap>>(name: Name, data: RequestStoreValue<StateMap, Name>, options?: StoreOptions<RequestStoreValue<StateMap, Name>>) => RequestStoreValue<StateMap, Name>;
|
|
22
|
-
set: <Name extends RequestStoreName<StateMap>>(name: Name, updater: RequestStoreValue<StateMap, Name> | ((draft: RequestStoreValue<StateMap, Name>) => void)) => RequestStoreValue<StateMap, Name>;
|
|
23
|
-
get: <Name extends RequestStoreName<StateMap>>(name: Name) => RequestStoreValue<StateMap, Name> | undefined;
|
|
24
|
-
snapshot: () => RequestSnapshot<StateMap>;
|
|
25
|
-
};
|
|
26
13
|
type RequestStoreContext<StateMap extends StoreStateMap> = {
|
|
27
14
|
registry: StoreRegistry;
|
|
28
15
|
snapshot: () => RequestSnapshot<StateMap>;
|
|
16
|
+
capture: () => RequestScopeCapture<StateMap>;
|
|
29
17
|
hydrate: <T>(renderFn: () => T, options?: RequestHydrateOptions<StateMap>) => T;
|
|
18
|
+
bind: <Args extends unknown[], Result>(callback: (...args: Args) => Result) => (...args: Args) => Result;
|
|
30
19
|
};
|
|
31
20
|
declare const createStoreForRequest: <StateMap extends StoreStateMap = StoreStateMap>(initializer?: (api: RequestStoreApi<StateMap>) => void) => RequestStoreContext<StateMap>;
|
|
32
21
|
|
|
33
|
-
export {
|
|
22
|
+
export { RequestHydrateOptions, RequestScopeCapture, RequestSnapshot, RequestStoreApi, StoreRegistry, createStoreForRequest };
|
package/dist/server.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {d,c as c$1,b}from'./chunk-WE3ZR6OG.js';import {L,s,W,R,Q}from'./chunk-X2MKRN7O.js';import {E as E$1,G,y as y$1,V,J}from'./chunk-6IBJ7CIK.js';import'./chunk-PHE2BCFG.js';import'./chunk-4C666HHU.js';import {AsyncLocalStorage}from'async_hooks';var f=new AsyncLocalStorage,y=new AsyncLocalStorage,C=new AsyncLocalStorage,A=new AsyncLocalStorage,c=new WeakMap,H=e=>e!==null&&(typeof e=="object"||typeof e=="function")&&typeof e.then=="function",h=(e,t,r)=>{if(!e)return r();let s=c.has(e),a=c.get(e);c.set(e,t);let n=()=>{if(s&&a){c.set(e,a);return}c.delete(e);};try{let p=r();return H(p)?Promise.resolve(p).finally(n):(n(),p)}catch(p){throw n(),p}};E$1({run:(e,t)=>h(y.getStore()??null,e,()=>f.run(e,t)),get:()=>{let e=y.getStore();return e?c.has(e)?c.get(e)??null:null:f.getStore()||null}});G({run:(e,t)=>y.run(e,t),get:()=>y.getStore()||null,enterWith:e=>y.enterWith(e)});L({run:(e,t)=>C.run(e,t),get:()=>C.getStore()||null,enterWith:e=>C.enterWith(e)});s({run:(e,t)=>A.run(e,t),get:()=>A.getStore()||null});var E=e=>{Object.keys(e).forEach(t=>{delete e[t];});},I=(e,t)=>{let r=J().flush.chunkDelayMs,s=n=>{if(r>0&&typeof setTimeout=="function"){setTimeout(n,r);return}if(typeof queueMicrotask=="function"){queueMicrotask(n);return}Promise.resolve().then(n);},a=()=>{let n=e.notify;if(!n.isFlushing&&!n.notifyScheduled&&n.pendingNotifications.size===0){E(t);return}s(a);};s(a);},N=(e,t,r)=>{Q(e),r(t),I(e,t);},B=async(e,t,r)=>{await R(e),r(t),I(e,t);},X=e=>{let t=y$1("request"),r={},s=Object.create(null),a=0,n=i=>{Object.keys(r).forEach(o=>{delete r[o];}),Object.keys(s).forEach(o=>{delete s[o];}),Object.entries(i.snapshot).forEach(([o,u])=>{r[o]=V(u);}),Object.entries(i.options).forEach(([o,u])=>{u!==void 0&&(s[o]=u);});},p=i=>{n(c$1(t,i));},P=d({buffer:r,bufferedOptions:s});return typeof e=="function"&&e(P),{registry:t,snapshot:()=>b({snapshot:r,options:s}).snapshot,capture:()=>{let i=c.get(t)??null;return i?c$1(t,i):b({snapshot:r,options:s})},hydrate:(i,o={})=>{let u={...o,default:o.default};return Object.keys(r).forEach(S=>{let l=S,W={...o.default||{},...o[l]||{},...s[S]||{}};u[l]=W;}),y.run(t,()=>f.run(V(r),()=>{a+=1;let S=f.getStore();if(!S)try{return W(r,u,{allowTrusted:!0}),i()}finally{a-=1;}return h(t,S,()=>{W(r,u,{allowTrusted:!0});try{let l=i();if(H(l))return Promise.resolve(l).finally(async()=>{try{await B(t,S,p);}finally{a-=1;}});try{return N(t,S,p),l}finally{a-=1;}}catch(l){try{throw N(t,S,p),l}finally{a-=1;}}})}))},bind:i=>(...o)=>{if(a<=0)throw new Error("Bound request callback invoked outside request lifecycle.");return y.run(t,()=>{let u=c.get(t);if(!u)throw new Error("Bound request callback missing active request carrier.");return h(t,u,()=>f.run(u,()=>i(...o)))})}}};export{X as createStoreForRequest};//# sourceMappingURL=server.js.map
|
|
2
2
|
//# sourceMappingURL=server.js.map
|
package/dist/shared.d.ts
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { S as StoreOptions } from './types-internal.js';
|
|
2
|
+
import { c as StoreStateMap } from './types.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* @module server/shared
|
|
6
|
+
*
|
|
7
|
+
* LAYER: SSR
|
|
8
|
+
* OWNS: Shared request-scope types and capture helpers.
|
|
9
|
+
*
|
|
10
|
+
* Consumers: Node SSR and explicit portable request-scope adapters.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
type RequestStoreName<StateMap> = keyof StateMap extends never ? string : keyof StateMap & string;
|
|
14
|
+
type RequestStoreValue<StateMap, Name extends RequestStoreName<StateMap>> = Name extends keyof StateMap ? StateMap[Name] : unknown;
|
|
15
|
+
|
|
16
|
+
type RequestSnapshot<StateMap extends StoreStateMap = StoreStateMap> = Partial<{
|
|
17
|
+
[K in RequestStoreName<StateMap>]: RequestStoreValue<StateMap, K>;
|
|
18
|
+
}>;
|
|
19
|
+
type RequestScopeOptions<StateMap extends StoreStateMap = StoreStateMap> = Partial<{
|
|
20
|
+
[K in RequestStoreName<StateMap>]: StoreOptions<RequestStoreValue<StateMap, K>>;
|
|
21
|
+
}>;
|
|
22
|
+
type RequestHydrateOptions<StateMap extends StoreStateMap = StoreStateMap> = RequestScopeOptions<StateMap> & {
|
|
23
|
+
default?: StoreOptions;
|
|
24
|
+
};
|
|
25
|
+
type RequestScopeCapture<StateMap extends StoreStateMap = StoreStateMap> = {
|
|
26
|
+
snapshot: RequestSnapshot<StateMap>;
|
|
27
|
+
options: RequestScopeOptions<StateMap>;
|
|
28
|
+
};
|
|
29
|
+
type RequestStoreApi<StateMap extends StoreStateMap = StoreStateMap> = {
|
|
30
|
+
create: <Name extends RequestStoreName<StateMap>>(name: Name, data: RequestStoreValue<StateMap, Name>, options?: StoreOptions<RequestStoreValue<StateMap, Name>>) => RequestStoreValue<StateMap, Name>;
|
|
31
|
+
set: <Name extends RequestStoreName<StateMap>>(name: Name, updater: RequestStoreValue<StateMap, Name> | ((draft: RequestStoreValue<StateMap, Name>) => void)) => RequestStoreValue<StateMap, Name>;
|
|
32
|
+
get: <Name extends RequestStoreName<StateMap>>(name: Name) => RequestStoreValue<StateMap, Name> | undefined;
|
|
33
|
+
snapshot: () => RequestSnapshot<StateMap>;
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
export type { RequestStoreApi as R, RequestSnapshot as a, RequestScopeCapture as b, RequestHydrateOptions as c, RequestScopeOptions as d, RequestStoreName as e, RequestStoreValue as f };
|
package/dist/store-registry.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { StoreFeatureMeta, FeatureName, StoreFeatureRuntime } from './feature.js';
|
|
2
2
|
import { R as RuntimePatch } from './runtime-patch.js';
|
|
3
3
|
import { A as AsyncRegistry } from './registry.js';
|
|
4
|
-
import { ComputedClassification } from './
|
|
4
|
+
import { C as ComputedClassification } from './types-internal-3.js';
|
|
5
|
+
import { h as HydrationRuntimeState } from './types-internal-2.js';
|
|
5
6
|
|
|
6
7
|
/**
|
|
7
8
|
* @module store-registry
|
|
@@ -80,6 +81,7 @@ type StoreRegistry = {
|
|
|
80
81
|
lastRuntimePatches: RuntimePatch[];
|
|
81
82
|
transaction: TransactionState;
|
|
82
83
|
async: AsyncRegistry;
|
|
84
|
+
hydration: HydrationRuntimeState;
|
|
83
85
|
notify: NotifyState;
|
|
84
86
|
lifecycleListener: StoreLifecycleListener | null;
|
|
85
87
|
};
|
package/dist/sync.d.ts
CHANGED
package/dist/sync.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export{
|
|
1
|
+
export{a as installSync}from'./chunk-GZQGU64H.js';import'./chunk-4D6OA3DD.js';import'./chunk-X2MKRN7O.js';import'./chunk-6IBJ7CIK.js';import'./chunk-PHE2BCFG.js';import'./chunk-4C666HHU.js';//# sourceMappingURL=sync.js.map
|
|
2
2
|
//# sourceMappingURL=sync.js.map
|
package/dist/testing.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { a as StoreDefinition, b as StoreKey, P as PartialDeep, W as WriteResult } from './types.js';
|
|
2
|
+
import './types-internal-2.js';
|
|
2
3
|
|
|
3
4
|
declare const createMockStore: <Name extends string, State extends Record<string, unknown> = Record<string, unknown>>(name?: Name, initial?: State) => {
|
|
4
5
|
set: (update: PartialDeep<State> | ((draft: State) => void)) => WriteResult;
|
package/dist/testing.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import'./chunk-YU5GMPCC.js';import {
|
|
1
|
+
import'./chunk-YU5GMPCC.js';import {f}from'./chunk-LWUT37FW.js';import'./chunk-E33L4MII.js';import {q,l,Y,w,_}from'./chunk-X2MKRN7O.js';import'./chunk-6IBJ7CIK.js';import'./chunk-PHE2BCFG.js';import'./chunk-4C666HHU.js';var D=(o="mock",t={})=>{let e=q(o);return l(o,t),{set:r=>typeof r=="function"?w(e,r):w(e,r),reset:()=>Y(e),use:()=>e}},N=(o,t)=>{let e=Date.now;Object.defineProperty(Date,"now",{value:()=>o,configurable:true});try{return t()}finally{Object.defineProperty(Date,"now",{value:e,configurable:true});}},g=()=>{_(),f();},x=(o,t=1e3,e=r=>({value:r}))=>{let r=typeof performance<"u"&&performance.now?performance.now():Date.now();for(let a=0;a<t;a++)w(o,e(a));let s=(typeof performance<"u"&&performance.now?performance.now():Date.now())-r;return {iterations:t,totalMs:s,avgMs:s/t}};export{x as benchmarkStoreSet,D as createMockStore,g as resetAllStoresForTest,N as withMockedTime};//# sourceMappingURL=testing.js.map
|
|
2
2
|
//# sourceMappingURL=testing.js.map
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
// This file is read by tools that parse documentation comments conforming to the TSDoc standard.
|
|
2
|
+
// It should be published with your NPM package. It should not be tracked by Git.
|
|
3
|
+
{
|
|
4
|
+
"tsdocVersion": "0.12",
|
|
5
|
+
"toolPackages": [
|
|
6
|
+
{
|
|
7
|
+
"packageName": "@microsoft/api-extractor",
|
|
8
|
+
"packageVersion": "7.58.0"
|
|
9
|
+
}
|
|
10
|
+
]
|
|
11
|
+
}
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module hydration-consistency/types
|
|
3
|
+
*
|
|
4
|
+
* LAYER: Store runtime
|
|
5
|
+
* OWNS: Public and internal types for post-hydration consistency handling.
|
|
6
|
+
*
|
|
7
|
+
* Consumers: hydration-consistency runtime modules and public barrels.
|
|
8
|
+
*/
|
|
9
|
+
type HydrationConsistencySource = "effect" | "storage" | "network" | "sync" | "hydrate" | "unknown";
|
|
10
|
+
type HydrationConsistencyAuthority = "server-authoritative" | "client-authoritative" | "mergeable";
|
|
11
|
+
/**
|
|
12
|
+
* How the post-hydration boot window is controlled.
|
|
13
|
+
* - `timer`: closes automatically after a configured duration.
|
|
14
|
+
* - `manual`: stays open until `close()` is called, optionally with a fallback timer.
|
|
15
|
+
*/
|
|
16
|
+
type HydrationBootWindowMode = "timer" | "manual";
|
|
17
|
+
/**
|
|
18
|
+
* Boot-window configuration for post-hydration write deferral.
|
|
19
|
+
*
|
|
20
|
+
* `timer` mode uses `ms` to guess when hydration should be considered settled.
|
|
21
|
+
* `manual` mode returns a `HydrationBootWindowControl` so the app can close the window explicitly.
|
|
22
|
+
* `fallbackMs` can be used as a safety timer while still preferring manual close.
|
|
23
|
+
*/
|
|
24
|
+
type HydrationBootWindowOptions = HydrationBootWindowMode | {
|
|
25
|
+
mode: HydrationBootWindowMode;
|
|
26
|
+
ms?: number;
|
|
27
|
+
fallbackMs?: number;
|
|
28
|
+
};
|
|
29
|
+
/**
|
|
30
|
+
* Runtime control returned from `hydrateStores(...)` when a boot window is active.
|
|
31
|
+
*/
|
|
32
|
+
type HydrationBootWindowControl = {
|
|
33
|
+
mode: HydrationBootWindowMode;
|
|
34
|
+
startedAtMs: number | null;
|
|
35
|
+
endsAtMs: number | null;
|
|
36
|
+
close: () => void;
|
|
37
|
+
isActive: () => boolean;
|
|
38
|
+
};
|
|
39
|
+
type HydrationConsistencyPolicy = "server_wins" | "client_wins" | "merge" | "invalidate_and_refetch";
|
|
40
|
+
type HydrationConsistencyResolution = "stable" | "server_reverted" | "client_kept" | "merged" | "invalidated";
|
|
41
|
+
type HydrationSnapshotMetadata = {
|
|
42
|
+
snapshotVersion?: string | number;
|
|
43
|
+
timestamp?: number;
|
|
44
|
+
checksum?: string | number;
|
|
45
|
+
schemaSignature?: string;
|
|
46
|
+
};
|
|
47
|
+
type HydrationConsistencyStoreContract = HydrationSnapshotMetadata & {
|
|
48
|
+
authority?: HydrationConsistencyAuthority;
|
|
49
|
+
};
|
|
50
|
+
type HydrationConsistencyContract<Snapshot extends object = Record<string, unknown>> = HydrationSnapshotMetadata & {
|
|
51
|
+
authority?: HydrationConsistencyAuthority;
|
|
52
|
+
stores?: Partial<{
|
|
53
|
+
[K in keyof Snapshot & string]: HydrationConsistencyStoreContract;
|
|
54
|
+
}>;
|
|
55
|
+
};
|
|
56
|
+
type HydrationInvalidateArgs<State = unknown> = {
|
|
57
|
+
store: string;
|
|
58
|
+
baseline: State;
|
|
59
|
+
live: State;
|
|
60
|
+
source: HydrationConsistencySource;
|
|
61
|
+
};
|
|
62
|
+
type HydrationMergeArgs<State = unknown> = {
|
|
63
|
+
store: string;
|
|
64
|
+
baseline: State;
|
|
65
|
+
live: State;
|
|
66
|
+
source: HydrationConsistencySource;
|
|
67
|
+
};
|
|
68
|
+
type HydrationConsistencyStorePolicy<State = unknown> = HydrationConsistencyPolicy | {
|
|
69
|
+
policy: HydrationConsistencyPolicy;
|
|
70
|
+
merge?: (args: HydrationMergeArgs<State>) => State;
|
|
71
|
+
onInvalidate?: (args: HydrationInvalidateArgs<State>) => void;
|
|
72
|
+
};
|
|
73
|
+
type HydrationDriftEvent<Snapshot extends object = Record<string, unknown>> = {
|
|
74
|
+
id: string;
|
|
75
|
+
store: keyof Snapshot & string | string;
|
|
76
|
+
source: HydrationConsistencySource;
|
|
77
|
+
authority: HydrationConsistencyAuthority;
|
|
78
|
+
policy: HydrationConsistencyPolicy;
|
|
79
|
+
resolution: HydrationConsistencyResolution;
|
|
80
|
+
detectedAt: string;
|
|
81
|
+
detectedAtMs: number;
|
|
82
|
+
firstDivergedAt: string;
|
|
83
|
+
firstDivergedAtMs: number;
|
|
84
|
+
hydratedAt: string;
|
|
85
|
+
hydratedAtMs: number;
|
|
86
|
+
baselineHash: number;
|
|
87
|
+
liveHash: number;
|
|
88
|
+
resolvedHash: number;
|
|
89
|
+
invalidated: boolean;
|
|
90
|
+
metadata: HydrationSnapshotMetadata;
|
|
91
|
+
baseline: unknown;
|
|
92
|
+
live: unknown;
|
|
93
|
+
resolved: unknown;
|
|
94
|
+
};
|
|
95
|
+
type HydrationConsistencyOptions<Snapshot extends object = Record<string, unknown>> = {
|
|
96
|
+
contract?: HydrationConsistencyContract<Snapshot>;
|
|
97
|
+
policyMap?: Partial<{
|
|
98
|
+
[K in keyof Snapshot & string]: HydrationConsistencyStorePolicy<Snapshot[K]>;
|
|
99
|
+
}>;
|
|
100
|
+
onDrift?: (event: HydrationDriftEvent<Snapshot>) => void;
|
|
101
|
+
/**
|
|
102
|
+
* Legacy timer shorthand for the hydration boot window.
|
|
103
|
+
* Prefer `bootWindow` for explicit timer or manual mode.
|
|
104
|
+
*/
|
|
105
|
+
bootWindowMs?: number;
|
|
106
|
+
/**
|
|
107
|
+
* Preferred boot-window configuration for post-hydration write deferral.
|
|
108
|
+
*/
|
|
109
|
+
bootWindow?: HydrationBootWindowOptions;
|
|
110
|
+
deferSources?: readonly HydrationConsistencySource[];
|
|
111
|
+
maxEvents?: number;
|
|
112
|
+
};
|
|
113
|
+
type HydrationConsistencyStoreState = HydrationSnapshotMetadata & {
|
|
114
|
+
store: string;
|
|
115
|
+
authority: HydrationConsistencyAuthority;
|
|
116
|
+
policy: HydrationConsistencyPolicy;
|
|
117
|
+
baseline: unknown;
|
|
118
|
+
baselineHash: number;
|
|
119
|
+
hydratedAt: string;
|
|
120
|
+
hydratedAtMs: number;
|
|
121
|
+
firstDivergedAt: string | null;
|
|
122
|
+
firstDivergedAtMs: number | null;
|
|
123
|
+
lastDivergedAt: string | null;
|
|
124
|
+
lastDivergedAtMs: number | null;
|
|
125
|
+
lastResolution: HydrationConsistencyResolution | null;
|
|
126
|
+
lastSource: HydrationConsistencySource | null;
|
|
127
|
+
driftCount: number;
|
|
128
|
+
queuedWrites: number;
|
|
129
|
+
replayedWrites: number;
|
|
130
|
+
invalidatedAt: string | null;
|
|
131
|
+
invalidatedAtMs: number | null;
|
|
132
|
+
currentHash: number;
|
|
133
|
+
merge?: (args: HydrationMergeArgs) => unknown;
|
|
134
|
+
onInvalidate?: (args: HydrationInvalidateArgs) => void;
|
|
135
|
+
};
|
|
136
|
+
type HydrationConsistencyMetrics = {
|
|
137
|
+
driftEvents: number;
|
|
138
|
+
queuedWrites: number;
|
|
139
|
+
replayedWrites: number;
|
|
140
|
+
reconciliations: number;
|
|
141
|
+
invalidations: number;
|
|
142
|
+
};
|
|
143
|
+
type HydrationDeferredWrite = {
|
|
144
|
+
id: number;
|
|
145
|
+
store: string;
|
|
146
|
+
source: HydrationConsistencySource;
|
|
147
|
+
enqueuedAtMs: number;
|
|
148
|
+
apply: () => void;
|
|
149
|
+
};
|
|
150
|
+
type HydrationRuntimeState = {
|
|
151
|
+
stores: Record<string, HydrationConsistencyStoreState>;
|
|
152
|
+
events: HydrationDriftEvent[];
|
|
153
|
+
metrics: HydrationConsistencyMetrics;
|
|
154
|
+
queue: HydrationDeferredWrite[];
|
|
155
|
+
onDrift: ((event: HydrationDriftEvent) => void) | null;
|
|
156
|
+
maxEvents: number;
|
|
157
|
+
deferSources: Set<HydrationConsistencySource>;
|
|
158
|
+
bootWindowMode: HydrationBootWindowMode | null;
|
|
159
|
+
bootWindowActive: boolean;
|
|
160
|
+
bootWindowStartedAtMs: number | null;
|
|
161
|
+
bootWindowEndsAtMs: number | null;
|
|
162
|
+
bootWindowTimer: ReturnType<typeof setTimeout> | null;
|
|
163
|
+
bootWindowToken: number | null;
|
|
164
|
+
replaying: boolean;
|
|
165
|
+
sequence: number;
|
|
166
|
+
};
|
|
167
|
+
|
|
168
|
+
export type { HydrationSnapshotMetadata as H, HydrationConsistencyAuthority as a, HydrationConsistencyPolicy as b, HydrationConsistencyResolution as c, HydrationConsistencySource as d, HydrationConsistencyMetrics as e, HydrationBootWindowMode as f, HydrationDriftEvent as g, HydrationRuntimeState as h, HydrationBootWindowControl as i, HydrationConsistencyOptions as j, HydrationBootWindowOptions as k, HydrationConsistencyContract as l, HydrationConsistencyStoreContract as m, HydrationConsistencyStorePolicy as n, HydrationInvalidateArgs as o, HydrationMergeArgs as p };
|
|
@@ -39,4 +39,4 @@ interface ComputedDescriptor {
|
|
|
39
39
|
asyncBoundary?: boolean;
|
|
40
40
|
}
|
|
41
41
|
|
|
42
|
-
export type { ComputedClassification, ComputedDescriptor, RuntimeEdgeType
|
|
42
|
+
export type { ComputedClassification as C, RuntimeGraph as R, ComputedDescriptor as a, RuntimeEdgeType as b, RuntimeGraphEdge as c, RuntimeGraphGranularity as d, RuntimeGraphNode as e, RuntimeNodeId as f, RuntimeNodeType as g };
|
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
import { T as TraceContext } from './utility.js';
|
|
2
2
|
|
|
3
|
+
/**
|
|
4
|
+
* @module adapters/options/types
|
|
5
|
+
*
|
|
6
|
+
* LAYER: Module
|
|
7
|
+
* OWNS: Shared option and config types for store adapters.
|
|
8
|
+
*/
|
|
9
|
+
|
|
3
10
|
type StoreValue = unknown;
|
|
4
11
|
interface FeatureOptionsMap {
|
|
5
12
|
}
|
|
@@ -12,6 +19,7 @@ interface PersistDriver {
|
|
|
12
19
|
}
|
|
13
20
|
type StoreScope = "request" | "global" | "temp";
|
|
14
21
|
type SnapshotMode = "deep" | "shallow" | "ref";
|
|
22
|
+
type ResetCloneMode = "deep" | "shallow" | "none";
|
|
15
23
|
type ValidateFn<State = StoreValue> = (next: State) => boolean | State;
|
|
16
24
|
type SchemaValidateOption = {
|
|
17
25
|
safeParse: (value: unknown) => {
|
|
@@ -251,18 +259,25 @@ interface StoreOptions<State = StoreValue> {
|
|
|
251
259
|
* Snapshot cloning strategy used by subscriptions and selector snapshots.
|
|
252
260
|
*
|
|
253
261
|
* - "deep" (default): deep clone and dev-freeze snapshot values.
|
|
254
|
-
* - "shallow": shallow clone (top-level) only
|
|
255
|
-
* - "ref": return the live store reference
|
|
262
|
+
* - "shallow": shallow clone (top-level) only, then shallow-freeze the snapshot envelope.
|
|
263
|
+
* - "ref": return the live store reference with a shallow-frozen snapshot envelope.
|
|
256
264
|
*/
|
|
257
265
|
snapshot?: SnapshotMode;
|
|
266
|
+
/**
|
|
267
|
+
* Clone strategy used by resetStore(...) when restoring the initial snapshot.
|
|
268
|
+
* - "deep" (default): deep clone initial snapshot (safest).
|
|
269
|
+
* - "shallow": clone top-level container only.
|
|
270
|
+
* - "none": reuse initial snapshot reference.
|
|
271
|
+
*/
|
|
272
|
+
resetClone?: ResetCloneMode;
|
|
258
273
|
/**
|
|
259
274
|
* Safety policy for snapshot deliveries when using "ref" or "shallow" modes.
|
|
260
|
-
* - "warn": (default) log a warning
|
|
261
|
-
* - "throw": throw an error
|
|
262
|
-
* - "auto-clone":
|
|
275
|
+
* - "warn": (default) log a warning when mutation is detected.
|
|
276
|
+
* - "throw": throw an error when mutation is detected.
|
|
277
|
+
* - "auto-clone": if a subscriber mutates a frozen snapshot, deliver a cloned
|
|
263
278
|
* snapshot to that subscriber so the mutation does not affect other subscribers or the store.
|
|
264
279
|
*/
|
|
265
|
-
snapshotSafety?:
|
|
280
|
+
snapshotSafety?: "warn" | "throw" | "auto-clone";
|
|
266
281
|
}
|
|
267
282
|
interface NormalizedOptions {
|
|
268
283
|
scope: StoreScope;
|
|
@@ -277,7 +292,7 @@ interface NormalizedOptions {
|
|
|
277
292
|
onCreate?: (initial: StoreValue) => void;
|
|
278
293
|
onError?: (err: string) => void;
|
|
279
294
|
validate?: ValidateOption;
|
|
280
|
-
migrations: Record<number, (state:
|
|
295
|
+
migrations: Record<number, (state: StoreValue) => StoreValue>;
|
|
281
296
|
version: number;
|
|
282
297
|
redactor?: (state: StoreValue) => StoreValue;
|
|
283
298
|
historyLimit: number;
|
|
@@ -285,11 +300,12 @@ interface NormalizedOptions {
|
|
|
285
300
|
sync?: boolean | SyncOptions;
|
|
286
301
|
features?: FeatureOptions;
|
|
287
302
|
snapshot: SnapshotMode;
|
|
303
|
+
resetClone: ResetCloneMode;
|
|
288
304
|
/** normalized snapshotSafety value */
|
|
289
|
-
snapshotSafety?:
|
|
305
|
+
snapshotSafety?: "warn" | "throw" | "auto-clone";
|
|
290
306
|
explicitPersist: boolean;
|
|
291
307
|
explicitSync: boolean;
|
|
292
308
|
explicitDevtools: boolean;
|
|
293
309
|
}
|
|
294
310
|
|
|
295
|
-
export type { FeatureOptions as F, MiddlewareCtx as M, NormalizedOptions as N,
|
|
311
|
+
export type { DevtoolsOptions as D, FeatureOptions as F, LifecycleOptions as L, MiddlewareCtx as M, NormalizedOptions as N, PersistConfig as P, ResetCloneMode as R, StoreOptions as S, ValidateFn as V, StoreValue as a, SnapshotMode as b, FeatureOptionsMap as c, PersistDriver as d, PersistOptions as e, SchemaValidateOption as f, StoreScope as g, SyncMessage as h, SyncOptions as i, ValidateOption as j };
|
package/dist/types.d.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { i as HydrationBootWindowControl } from './types-internal-2.js';
|
|
2
|
+
|
|
1
3
|
/**
|
|
2
4
|
* @module store-lifecycle/types
|
|
3
5
|
*
|
|
@@ -6,11 +8,13 @@
|
|
|
6
8
|
*
|
|
7
9
|
* Consumers: Internal imports and public API.
|
|
8
10
|
*/
|
|
11
|
+
|
|
9
12
|
type Primitive = string | number | boolean | bigint | symbol | null | undefined;
|
|
10
13
|
type PrevDepth = [never, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
|
|
11
14
|
type PathInternal<T, Depth extends number> = Depth extends 0 ? never : T extends Primitive ? never : {
|
|
12
15
|
[K in keyof T & (string | number)]: T[K] extends Primitive | Array<unknown> ? `${K}` : `${K}` | `${K}.${PathInternal<T[K], PrevDepth[Depth]>}`;
|
|
13
16
|
}[keyof T & (string | number)];
|
|
17
|
+
type PathDepth<T, Depth extends number> = PathInternal<T, Depth>;
|
|
14
18
|
type Path<T, Depth extends number = 10> = PathInternal<T, Depth>;
|
|
15
19
|
type PathValue<T, P extends Path<T>> = P extends `${infer K}.${infer Rest}` ? K extends keyof T ? Rest extends Path<T[K]> ? PathValue<T[K], Rest> : never : never : P extends keyof T ? T[P] : never;
|
|
16
20
|
type PartialDeep<T> = T extends Primitive ? T : unknown extends T ? T : {
|
|
@@ -36,7 +40,13 @@ type HydrationResult = {
|
|
|
36
40
|
reason: HydrationBlockReason;
|
|
37
41
|
cause?: unknown;
|
|
38
42
|
};
|
|
43
|
+
/**
|
|
44
|
+
* Present when post-hydration consistency enabled an active boot window.
|
|
45
|
+
* Use it to inspect or close timer/manual deferral after `hydrateStores(...)`.
|
|
46
|
+
*/
|
|
47
|
+
bootWindow?: HydrationBootWindowControl;
|
|
39
48
|
};
|
|
49
|
+
|
|
40
50
|
interface StoreStateMap {
|
|
41
51
|
}
|
|
42
52
|
interface StrictStoreMap {
|
|
@@ -59,7 +69,7 @@ type WriteResult = {
|
|
|
59
69
|
ok: true;
|
|
60
70
|
} | {
|
|
61
71
|
ok: false;
|
|
62
|
-
reason: "not-found" | "validate" | "path" | "middleware" | "ssr" | "invalid-args" | "lazy-uninitialized" | "unsupported-op" | "unsupported-path-shape";
|
|
72
|
+
reason: "not-found" | "no-initial-state" | "validate" | "path" | "middleware" | "ssr" | "invalid-args" | "lazy-uninitialized" | "unsupported-op" | "unsupported-path-shape";
|
|
63
73
|
};
|
|
64
74
|
|
|
65
|
-
export type { HydrateSnapshotFor as H, PartialDeep as P, StoreValue as S, WriteResult as W, StoreDefinition as a, StoreKey as b, StoreStateMap as c, StoreName as d, StateFor as e, StrictStoreMap as f, HydrationResult as g,
|
|
75
|
+
export type { BrandedStoreName as B, HydrateSnapshotFor as H, PartialDeep as P, RegisteredStoreMap as R, StoreValue as S, WriteResult as W, StoreDefinition as a, StoreKey as b, StoreStateMap as c, StoreName as d, StateFor as e, StrictStoreMap as f, HydrationResult as g, HydrationBlockReason as h, HydrationFailure as i, HydrationFailureReason as j, Path as k, PathDepth as l, PathInternal as m, PathValue as n, PrevDepth as o, Primitive as p };
|