stroid 0.1.2 → 0.1.4-beta.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/CHANGELOG.md +57 -10
- package/README.md +12 -10
- package/dist/async.d.ts +1 -1
- package/dist/async.js +22 -22
- package/dist/computed-types.d.ts +42 -0
- package/dist/computed-types.js +2 -0
- package/dist/computed.d.ts +15 -2
- package/dist/computed.js +11 -11
- package/dist/core.js +14 -14
- package/dist/devtools.d.ts +1 -1
- package/dist/devtools.js +1 -1
- package/dist/helpers.js +13 -13
- package/dist/index-internal.d.ts +1 -1
- package/dist/index.d.cts +4 -1
- package/dist/index.d.ts +4 -1
- package/dist/index.js +24 -24
- package/dist/install.js +1 -1
- package/dist/persist.js +1 -1
- package/dist/psr.d.ts +38 -0
- package/dist/psr.js +19 -0
- package/dist/react/index.d.ts +3 -1
- package/dist/react/index.js +25 -25
- package/dist/runtime-admin.js +1 -1
- package/dist/runtime-patch.d.ts +29 -0
- package/dist/runtime-tools.d.ts +6 -1
- package/dist/runtime-tools.js +2 -2
- package/dist/selectors.js +1 -1
- package/dist/server.d.ts +3 -1
- package/dist/server.js +11 -11
- package/dist/store-registry.d.ts +5 -0
- package/dist/sync.js +1 -1
- package/dist/testing.js +17 -17
- package/dist/types.d.ts +1 -1
- package/package.json +40 -39
- package/dist/async.js.map +0 -1
- package/dist/computed.js.map +0 -1
- package/dist/core.js.map +0 -1
- package/dist/devtools.js.map +0 -1
- package/dist/feature.js.map +0 -1
- package/dist/helpers.js.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/install.js.map +0 -1
- package/dist/persist.js.map +0 -1
- package/dist/react/index.js.map +0 -1
- package/dist/runtime-admin.js.map +0 -1
- package/dist/runtime-tools.js.map +0 -1
- package/dist/selectors.js.map +0 -1
- package/dist/server.js.map +0 -1
- package/dist/sync.js.map +0 -1
- package/dist/testing.js.map +0 -1
- package/dist/types/adapters/options.d.ts +0 -335
- package/dist/types/async/cache.d.ts +0 -39
- 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 -13
- package/dist/types/async/rate.d.ts +0 -5
- package/dist/types/async/registry.d.ts +0 -116
- 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 -29
- package/dist/types/computed/index.d.ts +0 -16
- 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/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 -19
- package/dist/types/core/store-lifecycle/identity.d.ts +0 -23
- package/dist/types/core/store-lifecycle/registry.d.ts +0 -53
- 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 -12
- package/dist/types/core/store-read.d.ts +0 -18
- package/dist/types/core/store-registry.d.ts +0 -108
- 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 -26
- package/dist/types/core/store-write-shared.d.ts +0 -19
- 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 -15
- 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 -58
- 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
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @module store-write
|
|
3
|
-
*
|
|
4
|
-
* LAYER: Store runtime
|
|
5
|
-
* OWNS: Public write API surface (barrel).
|
|
6
|
-
*
|
|
7
|
-
* Consumers: Internal imports and public API.
|
|
8
|
-
*/
|
|
9
|
-
import "./store-notify.js";
|
|
10
|
-
export { setStore, setStoreWithContext } from "./store-set.js";
|
|
11
|
-
export { replaceStore } from "./store-replace.js";
|
|
12
|
-
export { hydrateStores } from "./store-hydrate.js";
|
|
13
|
-
export { deleteStore, resetStore, clearAllStores, _hardResetAllStoresForTest, } from "./store-admin.js";
|
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @module feature-registry
|
|
3
|
-
*
|
|
4
|
-
* LAYER: Module
|
|
5
|
-
* OWNS: Module-level behavior and exports for feature-registry.
|
|
6
|
-
*
|
|
7
|
-
* Consumers: Internal imports and public API.
|
|
8
|
-
*/
|
|
9
|
-
import type { NormalizedOptions, StoreValue } from "../adapters/options.js";
|
|
10
|
-
import type { TraceContext } from "../types/utility.js";
|
|
11
|
-
export type BuiltInFeatureName = "persist" | "sync" | "devtools";
|
|
12
|
-
export type FeatureName = BuiltInFeatureName | (string & {});
|
|
13
|
-
export interface FeatureMetrics {
|
|
14
|
-
notifyCount: number;
|
|
15
|
-
totalNotifyMs: number;
|
|
16
|
-
lastNotifyMs: number;
|
|
17
|
-
resetCount: number;
|
|
18
|
-
totalResetMs: number;
|
|
19
|
-
lastResetMs: number;
|
|
20
|
-
}
|
|
21
|
-
export interface StoreFeatureMeta {
|
|
22
|
-
createdAt: string;
|
|
23
|
-
updatedAt: string;
|
|
24
|
-
updatedAtMs: number;
|
|
25
|
-
updateCount: number;
|
|
26
|
-
version: number;
|
|
27
|
-
metrics: FeatureMetrics;
|
|
28
|
-
options: NormalizedOptions;
|
|
29
|
-
readCount: number;
|
|
30
|
-
lastReadAt: string | null;
|
|
31
|
-
lastReadAtMs: number | null;
|
|
32
|
-
lastCorrelationId: string | null;
|
|
33
|
-
lastCorrelationAt: string | null;
|
|
34
|
-
lastCorrelationAtMs: number | null;
|
|
35
|
-
lastTraceContext: TraceContext | null;
|
|
36
|
-
}
|
|
37
|
-
export interface FeatureHookContext {
|
|
38
|
-
name: string;
|
|
39
|
-
options: NormalizedOptions;
|
|
40
|
-
getMeta: () => StoreFeatureMeta | undefined;
|
|
41
|
-
getStoreValue: () => StoreValue;
|
|
42
|
-
getAllStores: () => Record<string, StoreValue>;
|
|
43
|
-
getInitialState: () => StoreValue;
|
|
44
|
-
hasStore: () => boolean;
|
|
45
|
-
setStoreValue: (value: StoreValue) => void;
|
|
46
|
-
applyFeatureState: (value: StoreValue, updatedAtMs?: number) => void;
|
|
47
|
-
notify: () => void;
|
|
48
|
-
reportStoreError: (message: string) => void;
|
|
49
|
-
warn: (message: string) => void;
|
|
50
|
-
warnAlways: (message: string) => void;
|
|
51
|
-
log: (message: string) => void;
|
|
52
|
-
hashState: (value: unknown) => number;
|
|
53
|
-
deepClone: <T>(value: T) => T;
|
|
54
|
-
sanitize: (value: unknown) => unknown;
|
|
55
|
-
validate: (next: StoreValue) => {
|
|
56
|
-
ok: boolean;
|
|
57
|
-
value?: StoreValue;
|
|
58
|
-
};
|
|
59
|
-
isDev: () => boolean;
|
|
60
|
-
}
|
|
61
|
-
/** @deprecated Use FeatureHookContext instead. */
|
|
62
|
-
export type BaseFeatureContext = FeatureHookContext;
|
|
63
|
-
export type FeatureCreateContext<Ext extends object = {}> = FeatureHookContext & Ext;
|
|
64
|
-
export type FeatureWriteContext<Ext extends object = {}> = FeatureHookContext & Ext & {
|
|
65
|
-
action: string;
|
|
66
|
-
prev: StoreValue;
|
|
67
|
-
next: StoreValue;
|
|
68
|
-
};
|
|
69
|
-
export type FeatureDeleteContext<Ext extends object = {}> = FeatureHookContext & Ext & {
|
|
70
|
-
prev: StoreValue;
|
|
71
|
-
};
|
|
72
|
-
export interface DevtoolsFeatureApi {
|
|
73
|
-
getHistory?: (name: string, limit?: number) => unknown[];
|
|
74
|
-
clearHistory?: (name?: string) => void;
|
|
75
|
-
getPersistQueueDepth?: (name: string) => number;
|
|
76
|
-
}
|
|
77
|
-
export interface StoreFeatureRuntime<Ext extends object = {}> {
|
|
78
|
-
onStoreCreate?: (ctx: FeatureCreateContext<Ext>) => void;
|
|
79
|
-
onStoreWrite?: (ctx: FeatureWriteContext<Ext>) => void;
|
|
80
|
-
beforeStoreDelete?: (ctx: FeatureDeleteContext<Ext>) => void;
|
|
81
|
-
afterStoreDelete?: (ctx: FeatureDeleteContext<Ext>) => void;
|
|
82
|
-
resetAll?: () => void;
|
|
83
|
-
api?: DevtoolsFeatureApi;
|
|
84
|
-
}
|
|
85
|
-
export type StoreFeatureFactory<Ext extends object = {}> = () => StoreFeatureRuntime<Ext>;
|
|
86
|
-
export declare const registerStoreFeature: <Ext extends object = {}>(name: FeatureName, factory: StoreFeatureFactory<Ext>) => void;
|
|
87
|
-
export declare const hasRegisteredStoreFeature: (name: FeatureName) => boolean;
|
|
88
|
-
export declare const getStoreFeatureFactory: (name: FeatureName) => StoreFeatureFactory<any> | undefined;
|
|
89
|
-
export declare const getRegisteredFeatureNames: () => FeatureName[];
|
|
90
|
-
export declare const setFeatureRegistrationHook: (hook: ((name: FeatureName, factory: StoreFeatureFactory<any>) => void) | null) => void;
|
|
91
|
-
export declare const resetRegisteredStoreFeaturesForTests: () => void;
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @module features/lifecycle
|
|
3
|
-
*
|
|
4
|
-
* LAYER: Feature runtime
|
|
5
|
-
* OWNS: Module-level behavior and exports for features/lifecycle.
|
|
6
|
-
*
|
|
7
|
-
* Consumers: Internal imports and public API.
|
|
8
|
-
*/
|
|
9
|
-
import type { StoreValue } from "../adapters/options.js";
|
|
10
|
-
export declare const MIDDLEWARE_ABORT: unique symbol;
|
|
11
|
-
export type LifecycleIssueReporter = (message: string, visibility?: "dev" | "always") => void;
|
|
12
|
-
export declare const runMiddleware: ({ name, payload, middlewares, reportIssue, warn, }: {
|
|
13
|
-
name: string;
|
|
14
|
-
payload: {
|
|
15
|
-
action: string;
|
|
16
|
-
prev: StoreValue;
|
|
17
|
-
next: StoreValue;
|
|
18
|
-
path: unknown;
|
|
19
|
-
correlationId?: string;
|
|
20
|
-
traceContext?: import("../types/utility.js").TraceContext;
|
|
21
|
-
};
|
|
22
|
-
middlewares: Array<(ctx: {
|
|
23
|
-
action: string;
|
|
24
|
-
name: string;
|
|
25
|
-
prev: StoreValue;
|
|
26
|
-
next: StoreValue;
|
|
27
|
-
path: unknown;
|
|
28
|
-
correlationId?: string;
|
|
29
|
-
traceContext?: import("../types/utility.js").TraceContext;
|
|
30
|
-
}) => StoreValue | void>;
|
|
31
|
-
reportIssue: LifecycleIssueReporter;
|
|
32
|
-
warn: (message: string) => void;
|
|
33
|
-
}) => StoreValue | typeof MIDDLEWARE_ABORT;
|
|
34
|
-
export declare const runStoreHook: ({ name, label, fn, args, reportIssue, }: {
|
|
35
|
-
name: string;
|
|
36
|
-
label: "onCreate" | "onSet" | "onReset" | "onDelete";
|
|
37
|
-
fn: ((...args: any[]) => void) | undefined;
|
|
38
|
-
args: any[];
|
|
39
|
-
reportIssue: LifecycleIssueReporter;
|
|
40
|
-
}) => void;
|
package/dist/types/index.d.ts
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @module index
|
|
3
|
-
*
|
|
4
|
-
* LAYER: Public API
|
|
5
|
-
* OWNS: Module-level behavior and exports for index.
|
|
6
|
-
*
|
|
7
|
-
* Consumers: Internal imports and public API.
|
|
8
|
-
*/
|
|
9
|
-
export { createStore, createStoreStrict, setStore, setStoreBatch, getStore, deleteStore, resetStore, hasStore, hydrateStores, } from "./store.js";
|
|
10
|
-
export { getMetrics } from "./core/store-read.js";
|
|
11
|
-
export { getAsyncMetrics } from "./async/fetch.js";
|
|
12
|
-
export { getStoreHealth, findColdStores } from "./runtime-tools/index.js";
|
|
13
|
-
export { createComputed, invalidateComputed, deleteComputed, isComputedStore, } from "./computed/index.js";
|
|
14
|
-
export { namespace, store } from "./store.js";
|
|
15
|
-
export type { Path, PathValue, PartialDeep, HydrateSnapshotFor, HydrationFailure, HydrationResult, StoreDefinition, StoreValue, StoreKey, StoreName, StateFor, StoreStateMap, StrictStoreMap, WriteResult, FeatureOptions, FeatureOptionsMap, PersistOptions, StoreOptions, SyncOptions, } from "./store.js";
|
|
16
|
-
export { configureStroid } from "./config.js";
|
|
17
|
-
export * as queryIntegrations from "./integrations/query.js";
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import type { FetchInput, FetchOptions } from "../async/cache.js";
|
|
2
|
-
import type { StoreDefinition, StoreKey, StoreName } from "../core/store-lifecycle/types.js";
|
|
3
|
-
type StoreTarget = StoreDefinition<string, unknown> | StoreKey<string, unknown> | StoreName;
|
|
4
|
-
export declare const reactQueryKey: (storeName: StoreTarget, cacheKey?: string | number) => (string | number)[];
|
|
5
|
-
export declare const createReactQueryFetcher: (storeName: StoreTarget, input: FetchInput, options?: FetchOptions) => () => Promise<unknown>;
|
|
6
|
-
export declare const swrKey: (storeName: StoreTarget, cacheKey?: string | number) => (string | number)[];
|
|
7
|
-
export declare const createSwrFetcher: (storeName: StoreTarget, input: FetchInput, options?: FetchOptions) => () => Promise<unknown>;
|
|
8
|
-
export {};
|
|
@@ -1,116 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @module internals/config
|
|
3
|
-
*
|
|
4
|
-
* LAYER: Internal subsystem
|
|
5
|
-
* OWNS: Module-level behavior and exports for internals/config.
|
|
6
|
-
*
|
|
7
|
-
* Consumers: Internal imports and public API.
|
|
8
|
-
*/
|
|
9
|
-
import type { SnapshotMode, MiddlewareCtx, StoreValue } from "../adapters/options.js";
|
|
10
|
-
export type LogSink = {
|
|
11
|
-
log?: (msg: string, meta?: Record<string, unknown>) => void;
|
|
12
|
-
warn?: (msg: string, meta?: Record<string, unknown>) => void;
|
|
13
|
-
critical?: (msg: string, meta?: Record<string, unknown>) => void;
|
|
14
|
-
};
|
|
15
|
-
export type AsyncCloneMode = "none" | "shallow" | "deep";
|
|
16
|
-
export type FlushConfig = {
|
|
17
|
-
chunkSize?: number;
|
|
18
|
-
chunkDelayMs?: number;
|
|
19
|
-
priorityStores?: string[];
|
|
20
|
-
};
|
|
21
|
-
export type RevalidateOnFocusConfig = {
|
|
22
|
-
debounceMs?: number;
|
|
23
|
-
maxConcurrent?: number;
|
|
24
|
-
staggerMs?: number;
|
|
25
|
-
};
|
|
26
|
-
export type StroidConfig = {
|
|
27
|
-
logSink?: LogSink;
|
|
28
|
-
flush?: FlushConfig;
|
|
29
|
-
revalidateOnFocus?: RevalidateOnFocusConfig;
|
|
30
|
-
namespace?: string;
|
|
31
|
-
strictMissingFeatures?: boolean;
|
|
32
|
-
strictFeatures?: boolean;
|
|
33
|
-
assertRuntime?: boolean;
|
|
34
|
-
strictMutatorReturns?: boolean;
|
|
35
|
-
asyncAutoCreate?: boolean;
|
|
36
|
-
asyncCloneResult?: AsyncCloneMode;
|
|
37
|
-
/**
|
|
38
|
-
* Automatically generate correlation IDs for async fetch writes.
|
|
39
|
-
* Default: false.
|
|
40
|
-
*/
|
|
41
|
-
autoCorrelationIds?: boolean;
|
|
42
|
-
/**
|
|
43
|
-
* Acknowledge loose store name typing and suppress dev warnings.
|
|
44
|
-
* Useful when you intentionally skip StoreStateMap augmentation.
|
|
45
|
-
*/
|
|
46
|
-
acknowledgeLooseTypes?: boolean;
|
|
47
|
-
/**
|
|
48
|
-
* Max number of cached path validation verdicts per store.
|
|
49
|
-
* Default: 500.
|
|
50
|
-
*/
|
|
51
|
-
pathCacheSize?: number;
|
|
52
|
-
defaultSnapshotMode?: SnapshotMode;
|
|
53
|
-
/**
|
|
54
|
-
* Alias for defaultSnapshotMode.
|
|
55
|
-
*/
|
|
56
|
-
snapshotStrategy?: SnapshotMode;
|
|
57
|
-
/**
|
|
58
|
-
* Throw on async usage errors instead of returning null.
|
|
59
|
-
* Default: false (usage errors return null and call onError).
|
|
60
|
-
*/
|
|
61
|
-
strictAsyncUsageErrors?: boolean;
|
|
62
|
-
middleware?: Array<(ctx: MiddlewareCtx) => StoreValue | void>;
|
|
63
|
-
/**
|
|
64
|
-
* Allow hydrateStores to accept trusted snapshots without explicit opt-in.
|
|
65
|
-
* Default: false (hydration requires an explicit trust opt-in).
|
|
66
|
-
*/
|
|
67
|
-
allowTrustedHydration?: boolean;
|
|
68
|
-
/**
|
|
69
|
-
* @deprecated Use allowTrustedHydration instead.
|
|
70
|
-
*/
|
|
71
|
-
allowUntrustedHydration?: boolean;
|
|
72
|
-
/**
|
|
73
|
-
* Alias for allowTrustedHydration.
|
|
74
|
-
*/
|
|
75
|
-
allowHydration?: boolean;
|
|
76
|
-
/**
|
|
77
|
-
* Optional custom mutator engine (e.g. Immer's produce) to enable structural sharing.
|
|
78
|
-
* You can pass the produce function directly or use "immer" after calling registerMutatorProduce().
|
|
79
|
-
*/
|
|
80
|
-
mutatorProduce?: (<T>(base: T, recipe: (draft: T) => void) => T) | "immer";
|
|
81
|
-
/**
|
|
82
|
-
* When true, createSelector clones frozen state before proxy tracking.
|
|
83
|
-
* Default: true (safer for mutation-prone selectors in dev).
|
|
84
|
-
*/
|
|
85
|
-
selectorCloneFrozen?: boolean;
|
|
86
|
-
};
|
|
87
|
-
type ResolvedConfig = {
|
|
88
|
-
logSink: LogSink;
|
|
89
|
-
flush: Required<FlushConfig>;
|
|
90
|
-
revalidateOnFocus: Required<RevalidateOnFocusConfig>;
|
|
91
|
-
namespace: string;
|
|
92
|
-
strictMissingFeatures: boolean;
|
|
93
|
-
assertRuntime: boolean;
|
|
94
|
-
strictMutatorReturns: boolean;
|
|
95
|
-
asyncAutoCreate: boolean;
|
|
96
|
-
asyncCloneResult: AsyncCloneMode;
|
|
97
|
-
autoCorrelationIds: boolean;
|
|
98
|
-
acknowledgeLooseTypes: boolean;
|
|
99
|
-
pathCacheSize: number;
|
|
100
|
-
defaultSnapshotMode: SnapshotMode;
|
|
101
|
-
strictAsyncUsageErrors: boolean;
|
|
102
|
-
middleware: Array<(ctx: MiddlewareCtx) => StoreValue | void>;
|
|
103
|
-
allowUntrustedHydration: boolean;
|
|
104
|
-
mutatorProduce?: <T>(base: T, recipe: (draft: T) => void) => T;
|
|
105
|
-
selectorCloneFrozen: boolean;
|
|
106
|
-
};
|
|
107
|
-
export declare const getConfig: () => ResolvedConfig;
|
|
108
|
-
export declare const registerMutatorProduce: (produce: (<T>(base: T, recipe: (draft: T) => void) => T), options?: {
|
|
109
|
-
force?: boolean;
|
|
110
|
-
}) => void;
|
|
111
|
-
export declare const configureStroid: (next?: StroidConfig) => void;
|
|
112
|
-
export declare const resetConfig: () => void;
|
|
113
|
-
export declare const _resetConfigForTests: () => void;
|
|
114
|
-
export declare const getNamespace: () => string;
|
|
115
|
-
export declare const setNamespace: (ns: string) => void;
|
|
116
|
-
export {};
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
export declare const __DEV__: boolean;
|
|
2
|
-
export declare const isDev: () => boolean;
|
|
3
|
-
export declare const critical: (msg: string, meta?: Record<string, unknown>) => void;
|
|
4
|
-
export declare const warn: (msg: string, meta?: Record<string, unknown>) => void;
|
|
5
|
-
export declare const warnAlways: (msg: string, meta?: Record<string, unknown>) => void;
|
|
6
|
-
export declare const error: (msg: string, meta?: Record<string, unknown>) => void;
|
|
7
|
-
export declare const log: (msg: string, meta?: Record<string, unknown>) => void;
|
|
8
|
-
export declare const getInvalidFunctionStoreValueMessage: () => string;
|
|
9
|
-
export declare const getMapSetStoreWarningMessage: () => string;
|
|
10
|
-
export declare const getDateStoreWarningMessage: () => string;
|
|
11
|
-
export declare const getSanitizeDateWarningMessage: () => string;
|
|
12
|
-
export declare const getSanitizeMapWarningMessage: () => string;
|
|
13
|
-
export declare const getSanitizeSetWarningMessage: () => string;
|
|
14
|
-
export declare const getPathDepthExceededMessage: (depth: number, maxDepth: number, parts: string[]) => string;
|
|
15
|
-
export declare const getDeepNestingWarningMessage: (depth: number, parts: string[]) => string;
|
|
16
|
-
export declare const getPathReachedNullMessage: (parts: string[], part: string) => string;
|
|
17
|
-
export declare const getPathNotObjectMessage: (part: string) => string;
|
|
18
|
-
export declare const getInvalidStoreNameMessage: (name: string) => string;
|
|
19
|
-
export declare const getStoreNameContainsSpacesMessage: (name: string) => string;
|
|
20
|
-
export declare const getForbiddenStoreNameMessage: (name: string) => string;
|
|
21
|
-
export declare const suggestStoreName: (name: string, existingNames: string[]) => void;
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
export type IssueSeverity = "warn" | "critical";
|
|
2
|
-
export type IssueVisibility = "dev" | "always";
|
|
3
|
-
export type IssueOptions = {
|
|
4
|
-
severity?: IssueSeverity;
|
|
5
|
-
visibility?: IssueVisibility;
|
|
6
|
-
onError?: (message: string) => void;
|
|
7
|
-
};
|
|
8
|
-
export declare const safeInvoke: <T extends unknown[]>(fn: ((...args: T) => void) | undefined, label: string, ...args: T) => void;
|
|
9
|
-
export declare const reportIssue: (message: string, options?: IssueOptions) => void;
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { type StoreRegistry } from "../core/store-registry.js";
|
|
2
|
-
export declare const createStoreAdmin: (registry: StoreRegistry) => {
|
|
3
|
-
deleteExistingStore: (name: string) => void;
|
|
4
|
-
clearAllStores: () => string[];
|
|
5
|
-
clearStores: (pattern?: string) => string[];
|
|
6
|
-
reportStoreError: (name: string, message: string) => void;
|
|
7
|
-
};
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @module internals/store-ops
|
|
3
|
-
*
|
|
4
|
-
* LAYER: Internal subsystem
|
|
5
|
-
* OWNS: Module-level behavior and exports for internals/store-ops.
|
|
6
|
-
*
|
|
7
|
-
* Consumers: Internal imports and public API.
|
|
8
|
-
*/
|
|
9
|
-
export { createStore } from "../core/store-create.js";
|
|
10
|
-
export { replaceStore } from "../core/store-replace.js";
|
|
11
|
-
export { setStore, setStoreWithContext } from "../core/store-set.js";
|
|
12
|
-
export { getStore, hasStore } from "../core/store-read.js";
|
|
13
|
-
export { subscribeStore } from "../core/store-notify.js";
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @module internals/write-context
|
|
3
|
-
*
|
|
4
|
-
* LAYER: Internal subsystem
|
|
5
|
-
* OWNS: Correlation/trace context for write chains.
|
|
6
|
-
*
|
|
7
|
-
* Consumers: store-write.ts, notification/delivery.ts, async-fetch.ts.
|
|
8
|
-
*/
|
|
9
|
-
import type { TraceContext } from "../types/utility.js";
|
|
10
|
-
export type WriteContext = {
|
|
11
|
-
correlationId?: string;
|
|
12
|
-
traceContext?: TraceContext;
|
|
13
|
-
};
|
|
14
|
-
export declare const getWriteContext: () => WriteContext | null;
|
|
15
|
-
export declare const runWithWriteContext: <T>(context: WriteContext | null | undefined, fn: () => T) => T;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @module notification/index
|
|
3
|
-
*
|
|
4
|
-
* LAYER: Notification pipeline
|
|
5
|
-
* OWNS: Orchestrating flush scheduling without owning sub-responsibilities.
|
|
6
|
-
*
|
|
7
|
-
* Consumers: store-notify.ts
|
|
8
|
-
*/
|
|
9
|
-
import type { StoreRegistry } from "../core/store-registry.js";
|
|
10
|
-
export declare const scheduleFlush: (registry: StoreRegistry) => void;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @module notification/metrics
|
|
3
|
-
*
|
|
4
|
-
* LAYER: Notification pipeline
|
|
5
|
-
* OWNS: Notify timing and metric aggregation.
|
|
6
|
-
*
|
|
7
|
-
* Consumers: notification/delivery.ts
|
|
8
|
-
*/
|
|
9
|
-
import type { FeatureMetrics, StoreFeatureMeta } from "../features/feature-registry.js";
|
|
10
|
-
export declare const createMetrics: (metrics?: FeatureMetrics) => FeatureMetrics;
|
|
11
|
-
export declare const recordMetrics: (metrics: FeatureMetrics, elapsedMs: number) => FeatureMetrics;
|
|
12
|
-
export declare const commitMetrics: (metaEntry: StoreFeatureMeta | undefined, metrics: FeatureMetrics) => void;
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import type { NotifyState } from "../core/store-registry.js";
|
|
2
|
-
export type FlushPlan = {
|
|
3
|
-
names: string[];
|
|
4
|
-
sliceSize: number;
|
|
5
|
-
chunkDelayMs: number;
|
|
6
|
-
runInline: boolean;
|
|
7
|
-
prioritySet: Set<string> | null;
|
|
8
|
-
};
|
|
9
|
-
export declare const buildFlushPlan: (state: NotifyState) => FlushPlan;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @module notification/scheduler
|
|
3
|
-
*
|
|
4
|
-
* LAYER: Notification pipeline
|
|
5
|
-
* OWNS: Flush scheduling and chunk timers.
|
|
6
|
-
*
|
|
7
|
-
* Consumers: notification/index.ts, notification/delivery.ts
|
|
8
|
-
*/
|
|
9
|
-
import { type StoreRegistry } from "../core/store-registry.js";
|
|
10
|
-
export declare const scheduleChunk: (fn: () => void, delayMs: number) => void;
|
|
11
|
-
export declare const scheduleFlush: (registry: StoreRegistry, flush: (registry: StoreRegistry) => void) => void;
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import type { SnapshotMode } from "../adapters/options.js";
|
|
2
|
-
import type { StoreValue } from "../core/store-lifecycle/types.js";
|
|
3
|
-
export declare const resolveSnapshotMode: (metaEntry: {
|
|
4
|
-
options?: {
|
|
5
|
-
snapshot?: SnapshotMode;
|
|
6
|
-
};
|
|
7
|
-
} | undefined, fallback: SnapshotMode) => SnapshotMode;
|
|
8
|
-
export declare const cloneSnapshot: (value: StoreValue, mode: SnapshotMode) => StoreValue;
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
import type { StoreFeatureMeta } from "../features/feature-registry.js";
|
|
2
|
-
import { getAsyncMetrics } from "../async/fetch.js";
|
|
3
|
-
export declare const listStores: (pattern?: string) => string[];
|
|
4
|
-
export declare const getStoreMeta: (name: string) => StoreFeatureMeta | null;
|
|
5
|
-
export declare const getInitialState: () => Record<string, unknown>;
|
|
6
|
-
export declare const getMetrics: (name: string) => StoreFeatureMeta["metrics"] | null;
|
|
7
|
-
export declare const getSubscriberCount: (name: string) => number;
|
|
8
|
-
export declare const getAsyncInflightCount: (name: string) => number;
|
|
9
|
-
export type ColdStoreReport = {
|
|
10
|
-
name: string;
|
|
11
|
-
createdAt: string;
|
|
12
|
-
lastReadAt: string | null;
|
|
13
|
-
updateCount: number;
|
|
14
|
-
readCount: number;
|
|
15
|
-
subscriberCount: number;
|
|
16
|
-
ageMs: number;
|
|
17
|
-
verdict: "cold" | "write-only" | "stale" | "active";
|
|
18
|
-
};
|
|
19
|
-
export declare const findColdStores: (options?: {
|
|
20
|
-
unreadThresholdMs?: number;
|
|
21
|
-
includeWriteOnly?: boolean;
|
|
22
|
-
}) => ColdStoreReport[];
|
|
23
|
-
export type StoreHealthEntry = {
|
|
24
|
-
name: string;
|
|
25
|
-
meta: StoreFeatureMeta | null;
|
|
26
|
-
metrics: StoreFeatureMeta["metrics"] | null;
|
|
27
|
-
async: {
|
|
28
|
-
inflight: number;
|
|
29
|
-
lastCorrelationId: string | null;
|
|
30
|
-
traceContext: StoreFeatureMeta["lastTraceContext"] | null;
|
|
31
|
-
};
|
|
32
|
-
persist: {
|
|
33
|
-
queueDepth: number;
|
|
34
|
-
};
|
|
35
|
-
};
|
|
36
|
-
export type StoreHealthReport = {
|
|
37
|
-
stores: StoreHealthEntry[];
|
|
38
|
-
async: ReturnType<typeof getAsyncMetrics>;
|
|
39
|
-
registry: {
|
|
40
|
-
totalStores: number;
|
|
41
|
-
coldStores: ColdStoreReport[];
|
|
42
|
-
};
|
|
43
|
-
};
|
|
44
|
-
export declare const getStoreHealth: (name?: string) => StoreHealthEntry | StoreHealthReport | null;
|
|
45
|
-
export declare const getPersistQueueDepth: (name: string) => number;
|
|
46
|
-
export declare const getComputedGraph: () => {
|
|
47
|
-
nodes: string[];
|
|
48
|
-
edges: Array<{
|
|
49
|
-
from: string;
|
|
50
|
-
to: string;
|
|
51
|
-
}>;
|
|
52
|
-
dependencies: Record<string, string[]>;
|
|
53
|
-
dependents: Record<string, string[]>;
|
|
54
|
-
};
|
|
55
|
-
export declare const getComputedDeps: (name: string) => {
|
|
56
|
-
deps: string[];
|
|
57
|
-
dependents: string[];
|
|
58
|
-
} | null;
|
package/dist/types/store.d.ts
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @module store
|
|
3
|
-
*
|
|
4
|
-
* LAYER: Store runtime
|
|
5
|
-
* OWNS: Module-level behavior and exports for store.
|
|
6
|
-
*
|
|
7
|
-
* Consumers: Internal imports and public API.
|
|
8
|
-
*/
|
|
9
|
-
export type { Path, PathDepth, PathValue, PartialDeep, HydrateSnapshotFor, HydrationFailure, HydrationResult, StoreDefinition, StoreValue, StoreKey, StoreName, StateFor, StoreStateMap, StrictStoreMap, WriteResult, } from "./core/store-lifecycle/types.js";
|
|
10
|
-
export type { FeatureOptions, FeatureOptionsMap, PersistConfig, PersistOptions, MiddlewareCtx, StoreOptions, SnapshotMode, SyncOptions, } from "./adapters/options.js";
|
|
11
|
-
export { setStore, replaceStore, deleteStore, resetStore, hydrateStores, } from "./core/store-write.js";
|
|
12
|
-
export { createStore, createStoreStrict } from "./core/store-create.js";
|
|
13
|
-
export { setStoreBatch, subscribeStore, subscribeInternal as _subscribe, subscribe, getStoreSnapshot, getSnapshot as _getSnapshot, } from "./core/store-notify.js";
|
|
14
|
-
export { getStore, hasStore, isLazyStore, isStoreMaterialized, isLazyPending, _hasStoreEntryInternal, _getStoreValueRef, _getFeatureApi, getInitialState, getMetrics, } from "./core/store-read.js";
|
|
15
|
-
export { clearAllStores, clearStores } from "./runtime-admin/index.js";
|
|
16
|
-
export { store, namespace } from "./core/store-name.js";
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @module types/utility
|
|
3
|
-
*
|
|
4
|
-
* LAYER: Types
|
|
5
|
-
* OWNS: Shared utility types for cross-module reuse.
|
|
6
|
-
*
|
|
7
|
-
* Consumers: store-create.ts, store-name.ts, computed.ts, testing.ts.
|
|
8
|
-
*/
|
|
9
|
-
export type NonFunction<T> = T extends Function ? never : T;
|
|
10
|
-
export type DeepReadonly<T> = {
|
|
11
|
-
readonly [K in keyof T]: DeepReadonly<T[K]>;
|
|
12
|
-
};
|
|
13
|
-
export type StoreId = string | symbol;
|
|
14
|
-
export type TraceContext = {
|
|
15
|
-
traceId: string;
|
|
16
|
-
spanId: string;
|
|
17
|
-
} & Record<string, unknown>;
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
export declare const crc32: (str: string) => number;
|
|
2
|
-
/**
|
|
3
|
-
* Non-cryptographic checksum for integrity (best-effort). Do not use for security.
|
|
4
|
-
* String inputs preserve the legacy CRC32(JSON.stringify(value)) behavior to keep
|
|
5
|
-
* persisted checksums stable across versions.
|
|
6
|
-
*/
|
|
7
|
-
export declare const hashState: (value: unknown) => number;
|
|
8
|
-
export declare const checksumState: (value: unknown) => number;
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
export type PathInput = string | readonly string[] | string[];
|
|
2
|
-
export declare const parsePath: (path: PathInput) => string[];
|
|
3
|
-
export declare const validateDepth: (path: PathInput) => boolean;
|
|
4
|
-
export declare const getByPath: (obj: unknown, path: PathInput) => unknown;
|
|
5
|
-
export declare const setByPath: <T extends Record<string, unknown> | unknown[]>(obj: T, path: PathInput, value: unknown) => T;
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
export declare const FORBIDDEN_OBJECT_KEYS: Set<string>;
|
|
2
|
-
export declare const runSchemaValidation: (schema: unknown, value: unknown) => {
|
|
3
|
-
ok: boolean;
|
|
4
|
-
data?: unknown;
|
|
5
|
-
error?: unknown;
|
|
6
|
-
};
|
|
7
|
-
declare const SUPPORTED_TYPES: readonly ["object", "array", "string", "number", "boolean", "null"];
|
|
8
|
-
export type SupportedType = typeof SUPPORTED_TYPES[number] | "function" | "map" | "set" | "date" | "undefined" | "bigint" | "symbol";
|
|
9
|
-
export declare const getType: (value: unknown) => SupportedType;
|
|
10
|
-
export declare const isValidData: (value: unknown) => boolean;
|
|
11
|
-
export declare const canReuseSanitized: (value: unknown) => boolean;
|
|
12
|
-
export declare const sanitize: (value: unknown) => unknown;
|
|
13
|
-
export declare const isValidStoreName: (name: string) => boolean;
|
|
14
|
-
export {};
|
package/dist/types/utils.d.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @module utils
|
|
3
|
-
*
|
|
4
|
-
* LAYER: Utilities
|
|
5
|
-
* OWNS: Module-level behavior and exports for utils.
|
|
6
|
-
*
|
|
7
|
-
* Consumers: Internal imports and public API.
|
|
8
|
-
*/
|
|
9
|
-
export { __DEV__, isDev, warn, warnAlways, error, log, critical, suggestStoreName, } from "./internals/diagnostics.js";
|
|
10
|
-
export { crc32, hashState, checksumState } from "./utils/hash.js";
|
|
11
|
-
export { shallowClone, deepClone, shallowEqual, produceClone } from "./utils/clone.js";
|
|
12
|
-
export { parsePath, validateDepth, getByPath, setByPath, type PathInput } from "./utils/path.js";
|
|
13
|
-
export { runSchemaValidation, getType, isValidData, canReuseSanitized, sanitize, isValidStoreName, type SupportedType, } from "./utils/validation.js";
|