stroid 0.0.3 → 0.1.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 +97 -1
- package/README.md +436 -884
- package/dist/async-cache-DFHwcBQL.d.cts +52 -0
- package/dist/async-cache-DFHwcBQL.d.ts +52 -0
- package/dist/async.cjs +29 -0
- package/dist/async.d.cts +40 -0
- package/dist/async.d.ts +30 -20
- package/dist/async.js +29 -1
- package/dist/computed-BbAZm1Dq.d.cts +17 -0
- package/dist/computed-CccdgY5j.d.ts +17 -0
- package/dist/computed.cjs +11 -0
- package/dist/computed.d.cts +29 -0
- package/dist/computed.d.ts +29 -0
- package/dist/computed.js +11 -0
- package/dist/core.cjs +30 -0
- package/dist/core.d.cts +5 -0
- package/dist/core.d.ts +5 -1
- package/dist/core.js +30 -1
- package/dist/devtools.cjs +1 -0
- package/dist/devtools.d.cts +19 -0
- package/dist/devtools.d.ts +19 -0
- package/dist/devtools.js +1 -0
- package/dist/helpers.cjs +20 -0
- package/dist/helpers.d.cts +29 -0
- package/dist/helpers.d.ts +29 -0
- package/dist/helpers.js +20 -0
- package/dist/index.cjs +30 -0
- package/dist/index.d.cts +130 -0
- package/dist/index.d.ts +125 -13
- package/dist/index.js +30 -1
- package/dist/options-CB35e3Xo.d.cts +245 -0
- package/dist/options-CB35e3Xo.d.ts +245 -0
- package/dist/persist.cjs +1 -0
- package/dist/persist.d.cts +2 -0
- package/dist/persist.d.ts +2 -0
- package/dist/persist.js +1 -0
- package/dist/react.cjs +31 -0
- package/dist/react.d.cts +52 -0
- package/dist/react.d.ts +51 -6
- package/dist/react.js +31 -1
- package/dist/runtime-admin.cjs +1 -0
- package/dist/runtime-admin.d.cts +4 -0
- package/dist/runtime-admin.d.ts +4 -0
- package/dist/runtime-admin.js +1 -0
- package/dist/runtime-tools.cjs +3 -0
- package/dist/runtime-tools.d.cts +39 -0
- package/dist/runtime-tools.d.ts +39 -0
- package/dist/runtime-tools.js +3 -0
- package/dist/selectors.cjs +1 -0
- package/dist/selectors.d.cts +4 -0
- package/dist/selectors.d.ts +4 -0
- package/dist/selectors.js +1 -0
- package/dist/server.cjs +10 -0
- package/dist/server.d.cts +14 -0
- package/dist/server.d.ts +14 -0
- package/dist/server.js +10 -0
- package/dist/sync.cjs +1 -0
- package/dist/sync.d.cts +2 -0
- package/dist/sync.d.ts +2 -0
- package/dist/sync.js +1 -0
- package/dist/testing.cjs +20 -0
- package/dist/testing.d.cts +16 -0
- package/dist/testing.d.ts +7 -7
- package/dist/testing.js +20 -1
- package/dist/types/adapters/options.d.ts +247 -0
- package/dist/types/async/clone.d.ts +2 -0
- package/dist/types/async/errors.d.ts +3 -0
- package/dist/types/async/inflight.d.ts +13 -0
- package/dist/types/async/rate.d.ts +5 -0
- package/dist/types/async/request.d.ts +3 -0
- package/dist/types/async-cache.d.ts +57 -0
- package/dist/types/async-fetch.d.ts +37 -0
- package/dist/types/async-registry.d.ts +96 -0
- package/dist/types/async-retry.d.ts +10 -0
- package/dist/types/async.d.ts +2 -0
- package/dist/types/computed-graph.d.ts +31 -0
- package/dist/types/computed.d.ts +15 -0
- package/dist/types/config.d.ts +2 -0
- package/dist/types/core.d.ts +1 -0
- package/dist/types/devfreeze.d.ts +1 -0
- package/dist/types/feature-registry.d.ts +69 -0
- package/dist/types/features/lifecycle.d.ts +28 -0
- package/dist/types/index.d.ts +6 -0
- package/dist/types/integrations/query.d.ts +8 -0
- package/dist/types/internals/config.d.ts +62 -0
- package/dist/types/internals/diagnostics.d.ts +21 -0
- package/dist/types/internals/hooks-warnings.d.ts +6 -0
- package/dist/types/internals/reporting.d.ts +8 -0
- package/dist/types/internals/store-admin.d.ts +7 -0
- package/dist/types/internals/store-ops.d.ts +3 -0
- package/dist/types/runtime-admin.d.ts +2 -0
- package/dist/types/store-lifecycle/bind.d.ts +3 -0
- package/dist/types/store-lifecycle/hooks.d.ts +44 -0
- package/dist/types/store-lifecycle/identity.d.ts +23 -0
- package/dist/types/store-lifecycle/registry.d.ts +39 -0
- package/dist/types/store-lifecycle/types.d.ts +39 -0
- package/dist/types/store-lifecycle/validation.d.ts +45 -0
- package/dist/types/store-lifecycle.d.ts +20 -0
- package/dist/types/store-name.d.ts +19 -0
- package/dist/types/store-notify.d.ts +12 -0
- package/dist/types/store-read.d.ts +12 -0
- package/dist/types/store-registry.d.ts +74 -0
- package/dist/types/store-transaction.d.ts +12 -0
- package/dist/types/store-write.d.ts +45 -0
- package/dist/types/store.d.ts +7 -0
- package/dist/types/utils/clone.d.ts +4 -0
- package/dist/types/utils/hash.d.ts +8 -0
- package/dist/types/utils/path.d.ts +5 -0
- package/dist/types/utils/validation.d.ts +14 -0
- package/dist/types/utils.d.ts +5 -0
- package/dist/types-grvlY4BX.d.cts +37 -0
- package/dist/types-grvlY4BX.d.ts +37 -0
- package/package.json +77 -6
- package/dist/chunk-3CAQKMKY.js +0 -5
- package/dist/chunk-KYAUSC7J.js +0 -1
- package/dist/chunk-VNLWP332.js +0 -17
- package/dist/chunk-Y52AULFH.js +0 -3
- package/dist/core-CLIi-SLm.d.ts +0 -205
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module computed-graph
|
|
3
|
+
*
|
|
4
|
+
* LAYER: Internal graph engine
|
|
5
|
+
* OWNS: Dependency tracking, cycle detection, topological ordering,
|
|
6
|
+
* computed entry CRUD. Zero React. Zero async.
|
|
7
|
+
*
|
|
8
|
+
* Consumers: computed.ts (public API), store-notify.ts (flush ordering),
|
|
9
|
+
* store-admin.ts (cleanup on delete), runtime-tools.ts (diagnostics)
|
|
10
|
+
*/
|
|
11
|
+
import { type ComputedEntry } from "./store-registry.js";
|
|
12
|
+
export declare const detectCycle: (name: string, deps: string[]) => string | null;
|
|
13
|
+
export declare const registerComputed: (name: string, deps: string[], compute: (...args: unknown[]) => unknown) => boolean;
|
|
14
|
+
export declare const unregisterComputed: (name: string) => void;
|
|
15
|
+
export declare const markStale: (name: string) => void;
|
|
16
|
+
export declare const isComputed: (name: string) => boolean;
|
|
17
|
+
export declare const getComputedEntry: (name: string) => ComputedEntry | undefined;
|
|
18
|
+
export declare const getTopoOrderedComputeds: (changedSources: string[]) => string[];
|
|
19
|
+
export declare const getFullComputedGraph: () => {
|
|
20
|
+
nodes: string[];
|
|
21
|
+
edges: Array<{
|
|
22
|
+
from: string;
|
|
23
|
+
to: string;
|
|
24
|
+
}>;
|
|
25
|
+
dependencies: Record<string, string[]>;
|
|
26
|
+
dependents: Record<string, string[]>;
|
|
27
|
+
};
|
|
28
|
+
export declare const getComputedDepsFor: (name: string) => {
|
|
29
|
+
deps: string[];
|
|
30
|
+
dependents: string[];
|
|
31
|
+
} | null;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { StoreDefinition, StoreKey, StoreName, StateFor, StoreValue } from "./store-lifecycle.js";
|
|
2
|
+
export type ComputedOptions = {
|
|
3
|
+
autoDispose?: boolean;
|
|
4
|
+
onError?: (err: unknown) => void;
|
|
5
|
+
};
|
|
6
|
+
type DepHandle = StoreDefinition<string, StoreValue> | StoreKey<string, StoreValue>;
|
|
7
|
+
type DepValue<T> = T extends StoreDefinition<string, infer S> ? Readonly<S> | null : T extends StoreKey<string, infer S> ? Readonly<S> | null : T extends StoreName ? Readonly<StateFor<T>> | null : StoreValue | null;
|
|
8
|
+
export declare function createComputed<TResult, Deps extends readonly (StoreName | DepHandle)[]>(name: string, deps: Deps, compute: (...args: {
|
|
9
|
+
[K in keyof Deps]: DepValue<Deps[K]>;
|
|
10
|
+
}) => TResult, options?: ComputedOptions): StoreDefinition<string, TResult> | undefined;
|
|
11
|
+
export declare const invalidateComputed: (name: string) => void;
|
|
12
|
+
export declare const deleteComputed: (name: string) => void;
|
|
13
|
+
export declare const isComputedStore: (name: string) => boolean;
|
|
14
|
+
export declare const _resetComputedForTests: () => void;
|
|
15
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./index.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const devDeepFreeze: <T>(value: T) => T;
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import type { NormalizedOptions, StoreValue } from "./adapters/options.js";
|
|
2
|
+
export type FeatureName = "persist" | "sync" | "devtools";
|
|
3
|
+
export interface FeatureMetrics {
|
|
4
|
+
notifyCount: number;
|
|
5
|
+
totalNotifyMs: number;
|
|
6
|
+
lastNotifyMs: number;
|
|
7
|
+
}
|
|
8
|
+
export interface StoreFeatureMeta {
|
|
9
|
+
createdAt: string;
|
|
10
|
+
updatedAt: string;
|
|
11
|
+
updatedAtMs: number;
|
|
12
|
+
updateCount: number;
|
|
13
|
+
version: number;
|
|
14
|
+
metrics: FeatureMetrics;
|
|
15
|
+
options: NormalizedOptions;
|
|
16
|
+
}
|
|
17
|
+
export interface BaseFeatureContext {
|
|
18
|
+
name: string;
|
|
19
|
+
options: NormalizedOptions;
|
|
20
|
+
getMeta: () => StoreFeatureMeta | undefined;
|
|
21
|
+
getStoreValue: () => StoreValue;
|
|
22
|
+
getAllStores: () => Record<string, StoreValue>;
|
|
23
|
+
getInitialState: () => StoreValue;
|
|
24
|
+
hasStore: () => boolean;
|
|
25
|
+
setStoreValue: (value: StoreValue) => void;
|
|
26
|
+
applyFeatureState: (value: StoreValue, updatedAtMs?: number) => void;
|
|
27
|
+
notify: () => void;
|
|
28
|
+
reportStoreError: (message: string) => void;
|
|
29
|
+
warn: (message: string) => void;
|
|
30
|
+
log: (message: string) => void;
|
|
31
|
+
hashState: (value: unknown) => number;
|
|
32
|
+
deepClone: <T>(value: T) => T;
|
|
33
|
+
sanitize: (value: unknown) => unknown;
|
|
34
|
+
validate: (next: StoreValue) => {
|
|
35
|
+
ok: boolean;
|
|
36
|
+
value?: StoreValue;
|
|
37
|
+
};
|
|
38
|
+
isDev: () => boolean;
|
|
39
|
+
}
|
|
40
|
+
export interface FeatureCreateContext extends BaseFeatureContext {
|
|
41
|
+
}
|
|
42
|
+
export interface FeatureWriteContext extends BaseFeatureContext {
|
|
43
|
+
action: string;
|
|
44
|
+
prev: StoreValue;
|
|
45
|
+
next: StoreValue;
|
|
46
|
+
}
|
|
47
|
+
export interface FeatureDeleteContext extends BaseFeatureContext {
|
|
48
|
+
prev: StoreValue;
|
|
49
|
+
}
|
|
50
|
+
export interface DevtoolsFeatureApi {
|
|
51
|
+
getHistory?: (name: string, limit?: number) => unknown[];
|
|
52
|
+
clearHistory?: (name?: string) => void;
|
|
53
|
+
getPersistQueueDepth?: (name: string) => number;
|
|
54
|
+
}
|
|
55
|
+
export interface StoreFeatureRuntime {
|
|
56
|
+
onStoreCreate?: (ctx: FeatureCreateContext) => void;
|
|
57
|
+
onStoreWrite?: (ctx: FeatureWriteContext) => void;
|
|
58
|
+
beforeStoreDelete?: (ctx: FeatureDeleteContext) => void;
|
|
59
|
+
afterStoreDelete?: (ctx: FeatureDeleteContext) => void;
|
|
60
|
+
resetAll?: () => void;
|
|
61
|
+
api?: DevtoolsFeatureApi;
|
|
62
|
+
}
|
|
63
|
+
export type StoreFeatureFactory = () => StoreFeatureRuntime;
|
|
64
|
+
export declare const registerStoreFeature: (name: FeatureName, factory: StoreFeatureFactory) => void;
|
|
65
|
+
export declare const hasRegisteredStoreFeature: (name: FeatureName) => boolean;
|
|
66
|
+
export declare const getStoreFeatureFactory: (name: FeatureName) => StoreFeatureFactory | undefined;
|
|
67
|
+
export declare const getRegisteredFeatureNames: () => FeatureName[];
|
|
68
|
+
export declare const setFeatureRegistrationHook: (hook: ((name: FeatureName, factory: StoreFeatureFactory) => void) | null) => void;
|
|
69
|
+
export declare const resetRegisteredStoreFeaturesForTests: () => void;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { StoreValue } from "../adapters/options.js";
|
|
2
|
+
export declare const MIDDLEWARE_ABORT: unique symbol;
|
|
3
|
+
export type LifecycleIssueReporter = (message: string, visibility?: "dev" | "always") => void;
|
|
4
|
+
export declare const runMiddleware: ({ name, payload, middlewares, reportIssue, warn, }: {
|
|
5
|
+
name: string;
|
|
6
|
+
payload: {
|
|
7
|
+
action: string;
|
|
8
|
+
prev: StoreValue;
|
|
9
|
+
next: StoreValue;
|
|
10
|
+
path: unknown;
|
|
11
|
+
};
|
|
12
|
+
middlewares: Array<(ctx: {
|
|
13
|
+
action: string;
|
|
14
|
+
name: string;
|
|
15
|
+
prev: StoreValue;
|
|
16
|
+
next: StoreValue;
|
|
17
|
+
path: unknown;
|
|
18
|
+
}) => StoreValue | void>;
|
|
19
|
+
reportIssue: LifecycleIssueReporter;
|
|
20
|
+
warn: (message: string) => void;
|
|
21
|
+
}) => StoreValue | typeof MIDDLEWARE_ABORT;
|
|
22
|
+
export declare const runStoreHook: ({ name, label, fn, args, reportIssue, }: {
|
|
23
|
+
name: string;
|
|
24
|
+
label: "onCreate" | "onSet" | "onReset" | "onDelete";
|
|
25
|
+
fn: ((...args: any[]) => void) | undefined;
|
|
26
|
+
args: any[];
|
|
27
|
+
reportIssue: LifecycleIssueReporter;
|
|
28
|
+
}) => void;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { createStore, createStoreStrict, setStore, setStoreBatch, getStore, deleteStore, resetStore, hasStore, hydrateStores, } from "./store.js";
|
|
2
|
+
export { createComputed, invalidateComputed, deleteComputed, isComputedStore, } from "./computed.js";
|
|
3
|
+
export { namespace, store } from "./store.js";
|
|
4
|
+
export type { Path, PathValue, PartialDeep, StoreDefinition, StoreValue, StoreKey, StoreName, StateFor, StoreStateMap, StrictStoreMap, WriteResult, PersistOptions, StoreOptions, SyncOptions, } from "./store.js";
|
|
5
|
+
export { configureStroid } from "./config.js";
|
|
6
|
+
export * as queryIntegrations from "./integrations/query.js";
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { FetchInput, FetchOptions } from "../async-cache.js";
|
|
2
|
+
import type { StoreDefinition, StoreKey, StoreName } from "../store-lifecycle.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 {};
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import type { SnapshotMode, MiddlewareCtx, StoreValue } from "../adapters/options.js";
|
|
2
|
+
export type LogSink = {
|
|
3
|
+
log?: (msg: string, meta?: Record<string, unknown>) => void;
|
|
4
|
+
warn?: (msg: string, meta?: Record<string, unknown>) => void;
|
|
5
|
+
critical?: (msg: string, meta?: Record<string, unknown>) => void;
|
|
6
|
+
};
|
|
7
|
+
export type AsyncCloneMode = "none" | "shallow" | "deep";
|
|
8
|
+
export type FlushConfig = {
|
|
9
|
+
chunkSize?: number;
|
|
10
|
+
chunkDelayMs?: number;
|
|
11
|
+
priorityStores?: string[];
|
|
12
|
+
};
|
|
13
|
+
export type RevalidateOnFocusConfig = {
|
|
14
|
+
debounceMs?: number;
|
|
15
|
+
maxConcurrent?: number;
|
|
16
|
+
staggerMs?: number;
|
|
17
|
+
};
|
|
18
|
+
export type StroidConfig = {
|
|
19
|
+
logSink?: LogSink;
|
|
20
|
+
flush?: FlushConfig;
|
|
21
|
+
revalidateOnFocus?: RevalidateOnFocusConfig;
|
|
22
|
+
namespace?: string;
|
|
23
|
+
strictMissingFeatures?: boolean;
|
|
24
|
+
strictFeatures?: boolean;
|
|
25
|
+
assertRuntime?: boolean;
|
|
26
|
+
strictMutatorReturns?: boolean;
|
|
27
|
+
asyncAutoCreate?: boolean;
|
|
28
|
+
asyncCloneResult?: AsyncCloneMode;
|
|
29
|
+
defaultSnapshotMode?: SnapshotMode;
|
|
30
|
+
middleware?: Array<(ctx: MiddlewareCtx) => StoreValue | void>;
|
|
31
|
+
/**
|
|
32
|
+
* Allow hydrateStores to accept untrusted snapshots without explicit opt-in.
|
|
33
|
+
* Default: false (hydration requires an explicit trust opt-in).
|
|
34
|
+
*/
|
|
35
|
+
allowUntrustedHydration?: boolean;
|
|
36
|
+
/**
|
|
37
|
+
* Optional custom mutator engine (e.g. Immer's produce) to enable structural sharing.
|
|
38
|
+
*/
|
|
39
|
+
mutatorProduce?: <T>(base: T, recipe: (draft: T) => void) => T;
|
|
40
|
+
};
|
|
41
|
+
type ResolvedConfig = {
|
|
42
|
+
logSink: LogSink;
|
|
43
|
+
flush: Required<FlushConfig>;
|
|
44
|
+
revalidateOnFocus: Required<RevalidateOnFocusConfig>;
|
|
45
|
+
namespace: string;
|
|
46
|
+
strictMissingFeatures: boolean;
|
|
47
|
+
assertRuntime: boolean;
|
|
48
|
+
strictMutatorReturns: boolean;
|
|
49
|
+
asyncAutoCreate: boolean;
|
|
50
|
+
asyncCloneResult: AsyncCloneMode;
|
|
51
|
+
defaultSnapshotMode: SnapshotMode;
|
|
52
|
+
middleware: Array<(ctx: MiddlewareCtx) => StoreValue | void>;
|
|
53
|
+
allowUntrustedHydration: boolean;
|
|
54
|
+
mutatorProduce?: <T>(base: T, recipe: (draft: T) => void) => T;
|
|
55
|
+
};
|
|
56
|
+
export declare const getConfig: () => ResolvedConfig;
|
|
57
|
+
export declare const configureStroid: (next?: StroidConfig) => void;
|
|
58
|
+
export declare const resetConfig: () => void;
|
|
59
|
+
export declare const _resetConfigForTests: () => void;
|
|
60
|
+
export declare const getNamespace: () => string;
|
|
61
|
+
export declare const setNamespace: (ns: string) => void;
|
|
62
|
+
export {};
|
|
@@ -0,0 +1,21 @@
|
|
|
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;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export declare const hasBroadUseStoreWarning: (name: string) => boolean;
|
|
2
|
+
export declare const markBroadUseStoreWarning: (name: string) => void;
|
|
3
|
+
export declare const hasMissingUseStoreWarning: (name: string) => boolean;
|
|
4
|
+
export declare const markMissingUseStoreWarning: (name: string) => void;
|
|
5
|
+
export declare const resetBroadUseStoreWarnings: () => void;
|
|
6
|
+
export declare const resetMissingUseStoreWarnings: () => void;
|
|
@@ -0,0 +1,8 @@
|
|
|
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 reportIssue: (message: string, options?: IssueOptions) => void;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { type StoreRegistry } from "../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
|
+
};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { warn, log, hashState, deepClone, sanitize, isDev } from "../utils.js";
|
|
2
|
+
import { MIDDLEWARE_ABORT } from "../features/lifecycle.js";
|
|
3
|
+
import { type StoreFeatureMeta } from "../feature-registry.js";
|
|
4
|
+
import type { NormalizedOptions } from "../adapters/options.js";
|
|
5
|
+
import type { StoreValue } from "./types.js";
|
|
6
|
+
type BaseFeatureContext = {
|
|
7
|
+
name: string;
|
|
8
|
+
options: StoreFeatureMeta["options"];
|
|
9
|
+
getMeta: () => StoreFeatureMeta | undefined;
|
|
10
|
+
getStoreValue: () => StoreValue;
|
|
11
|
+
getAllStores: () => Record<string, StoreValue>;
|
|
12
|
+
getInitialState: () => StoreValue | undefined;
|
|
13
|
+
hasStore: () => boolean;
|
|
14
|
+
setStoreValue: (value: StoreValue) => void;
|
|
15
|
+
applyFeatureState: (value: StoreValue, updatedAtMs?: number) => void;
|
|
16
|
+
notify: () => void;
|
|
17
|
+
reportStoreError: (message: string) => void;
|
|
18
|
+
warn: typeof warn;
|
|
19
|
+
log: typeof log;
|
|
20
|
+
hashState: typeof hashState;
|
|
21
|
+
deepClone: typeof deepClone;
|
|
22
|
+
sanitize: typeof sanitize;
|
|
23
|
+
validate: (next: StoreValue) => {
|
|
24
|
+
ok: true;
|
|
25
|
+
value: StoreValue;
|
|
26
|
+
} | {
|
|
27
|
+
ok: false;
|
|
28
|
+
};
|
|
29
|
+
isDev: typeof isDev;
|
|
30
|
+
};
|
|
31
|
+
export declare const clearFeatureContexts: () => void;
|
|
32
|
+
export declare const createBaseFeatureContext: (name: string) => BaseFeatureContext | null;
|
|
33
|
+
export declare const runFeatureCreateHooks: (name: string, notify: (name: string) => void) => void;
|
|
34
|
+
export declare const runFeatureWriteHooks: (name: string, action: string, prev: StoreValue, next: StoreValue, notify: (name: string) => void) => void;
|
|
35
|
+
export declare const runFeatureDeleteHooks: (name: string, prev: StoreValue, notify: (name: string) => void) => void;
|
|
36
|
+
export declare const runMiddlewareForStore: (name: string, payload: {
|
|
37
|
+
action: string;
|
|
38
|
+
prev: StoreValue;
|
|
39
|
+
next: StoreValue;
|
|
40
|
+
path: unknown;
|
|
41
|
+
}) => StoreValue | typeof MIDDLEWARE_ABORT;
|
|
42
|
+
export declare const runStoreHookSafe: (name: string, label: "onCreate" | "onSet" | "onReset" | "onDelete", fn: ((...args: any[]) => void) | undefined, args: any[]) => void;
|
|
43
|
+
export declare const resolveFeatureAvailability: (name: string, options: NormalizedOptions) => NormalizedOptions;
|
|
44
|
+
export {};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { type IssueSeverity, type IssueVisibility } from "../internals/reporting.js";
|
|
2
|
+
import type { FeatureName } from "../feature-registry.js";
|
|
3
|
+
import type { StoreDefinition } from "./types.js";
|
|
4
|
+
export declare const getSsrWarningIssued: (name?: string) => boolean;
|
|
5
|
+
export declare const markSsrWarningIssued: (name: string) => void;
|
|
6
|
+
export declare const resetSsrWarningFlag: () => void;
|
|
7
|
+
export declare const qualifyName: (raw: string) => string;
|
|
8
|
+
export declare const nameOf: (name: string | StoreDefinition<string, unknown>) => string;
|
|
9
|
+
export declare const exists: (name: string) => boolean;
|
|
10
|
+
export declare const reportStoreIssue: (name: string, message: string, options?: {
|
|
11
|
+
severity?: IssueSeverity;
|
|
12
|
+
visibility?: IssueVisibility;
|
|
13
|
+
}) => void;
|
|
14
|
+
export declare const reportStoreCreationIssue: (message: string, onError?: (message: string) => void, options?: {
|
|
15
|
+
severity?: IssueSeverity;
|
|
16
|
+
visibility?: IssueVisibility;
|
|
17
|
+
}) => void;
|
|
18
|
+
export declare const reportStoreWarning: (name: string, message: string, visibility?: IssueVisibility) => void;
|
|
19
|
+
export declare const reportStoreCreationWarning: (message: string, onError?: (message: string) => void, visibility?: IssueVisibility) => void;
|
|
20
|
+
export declare const reportStoreError: (name: string, message: string) => void;
|
|
21
|
+
export declare const reportStoreCreationError: (message: string, onError?: (message: string) => void) => void;
|
|
22
|
+
export declare const warnMissingFeature: (storeName: string, featureName: FeatureName, onError?: (message: string) => void) => void;
|
|
23
|
+
export declare const getFeatureApi: (name: FeatureName) => import("../feature-registry.js").DevtoolsFeatureApi | undefined;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { getStoreRegistry, type StoreRegistry } from "../store-registry.js";
|
|
2
|
+
import { type FeatureName, type StoreFeatureRuntime, type StoreFeatureMeta } from "../feature-registry.js";
|
|
3
|
+
import { createStoreAdmin } from "../internals/store-admin.js";
|
|
4
|
+
import type { StoreValue, Subscriber } from "./types.js";
|
|
5
|
+
export { defaultRegistryScope } from "../store-registry.js";
|
|
6
|
+
export declare const setRegistryContext: (scope: string, registry: StoreRegistry) => void;
|
|
7
|
+
export declare const getRegistry: () => StoreRegistry;
|
|
8
|
+
export declare const setPathCacheInvalidator: (fn: (name: string) => void) => void;
|
|
9
|
+
export declare const stores: Record<string, unknown>;
|
|
10
|
+
export declare const subscribers: Record<string, Set<Subscriber>>;
|
|
11
|
+
export declare const initialStates: Record<string, unknown>;
|
|
12
|
+
export declare const initialFactories: Record<string, (() => StoreValue) | undefined>;
|
|
13
|
+
export declare const meta: Record<string, StoreFeatureMeta>;
|
|
14
|
+
export declare const snapshotCache: Record<string, {
|
|
15
|
+
version: number;
|
|
16
|
+
snapshot: StoreValue | null;
|
|
17
|
+
}>;
|
|
18
|
+
export declare const featureRuntimes: Map<FeatureName, StoreFeatureRuntime>;
|
|
19
|
+
export declare const storeAdmin: {
|
|
20
|
+
deleteExistingStore: (name: string) => void;
|
|
21
|
+
clearAllStores: () => string[];
|
|
22
|
+
clearStores: (pattern?: string) => string[];
|
|
23
|
+
reportStoreError: (name: string, message: string) => void;
|
|
24
|
+
};
|
|
25
|
+
export declare const getStoreAdmin: () => ReturnType<typeof createStoreAdmin>;
|
|
26
|
+
export declare const getFeatureRuntime: (name: FeatureName) => StoreFeatureRuntime | undefined;
|
|
27
|
+
export declare const initializeRegisteredFeatureRuntimes: () => void;
|
|
28
|
+
export declare const hasStoreEntryInternal: (name: string) => boolean;
|
|
29
|
+
export declare const getStoreValueRef: (name: string) => StoreValue | undefined;
|
|
30
|
+
export declare const setStoreValueInternal: (name: string, value: StoreValue) => void;
|
|
31
|
+
export declare const applyFeatureState: (name: string, value: StoreValue, updatedAtMs?: number) => void;
|
|
32
|
+
export declare const clearAllRegistries: () => void;
|
|
33
|
+
export declare const resetFeaturesForTests: () => void;
|
|
34
|
+
export declare const getMetaEntry: (name: string) => StoreFeatureMeta | undefined;
|
|
35
|
+
export declare const isDeleting: (name: string) => boolean;
|
|
36
|
+
export declare const resolveScope: (scopeOrRegistry?: string | ReturnType<typeof getStoreRegistry>) => {
|
|
37
|
+
scope: string;
|
|
38
|
+
registry: StoreRegistry;
|
|
39
|
+
};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
type Primitive = string | number | boolean | bigint | symbol | null | undefined;
|
|
2
|
+
type PrevDepth = [never, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
|
|
3
|
+
type PathInternal<T, Depth extends number> = Depth extends 0 ? never : T extends Primitive ? never : {
|
|
4
|
+
[K in keyof T & (string | number)]: T[K] extends Primitive | Array<unknown> ? `${K}` : `${K}` | `${K}.${PathInternal<T[K], PrevDepth[Depth]>}`;
|
|
5
|
+
}[keyof T & (string | number)];
|
|
6
|
+
export type PathDepth<T, Depth extends number> = PathInternal<T, Depth>;
|
|
7
|
+
export type Path<T, Depth extends number = 10> = PathInternal<T, Depth>;
|
|
8
|
+
export 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;
|
|
9
|
+
export type PartialDeep<T> = T extends Primitive ? T : unknown extends T ? T : {
|
|
10
|
+
[K in keyof T]?: PartialDeep<T[K]>;
|
|
11
|
+
};
|
|
12
|
+
export type StoreValue = unknown;
|
|
13
|
+
export interface StoreStateMap {
|
|
14
|
+
}
|
|
15
|
+
export interface StrictStoreMap {
|
|
16
|
+
}
|
|
17
|
+
type RegisteredStoreMap = StoreStateMap & StrictStoreMap;
|
|
18
|
+
declare const storeNameBrand: unique symbol;
|
|
19
|
+
type BrandedStoreName = string & {
|
|
20
|
+
readonly [storeNameBrand]: true;
|
|
21
|
+
};
|
|
22
|
+
export type StoreName = (keyof RegisteredStoreMap & string) | BrandedStoreName;
|
|
23
|
+
export type StateFor<Name extends string> = Name extends keyof RegisteredStoreMap ? RegisteredStoreMap[Name] : StoreValue;
|
|
24
|
+
export type UnregisteredStoreName<Name extends string> = never;
|
|
25
|
+
export type StoreKey<Name extends string = string, State = StoreValue> = StoreDefinition<Name, State> & {
|
|
26
|
+
__store?: true;
|
|
27
|
+
};
|
|
28
|
+
export interface StoreDefinition<Name extends string = string, State = StoreValue> {
|
|
29
|
+
name: Name;
|
|
30
|
+
state?: State;
|
|
31
|
+
}
|
|
32
|
+
export type WriteResult = {
|
|
33
|
+
ok: true;
|
|
34
|
+
} | {
|
|
35
|
+
ok: false;
|
|
36
|
+
reason: "not-found" | "validate" | "path" | "middleware" | "ssr" | "invalid-args";
|
|
37
|
+
};
|
|
38
|
+
export type Subscriber = (value: StoreValue | null) => void;
|
|
39
|
+
export {};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { type SupportedType, PathInput } from "../utils.js";
|
|
2
|
+
import { type ValidateOption } from "../adapters/options.js";
|
|
3
|
+
import type { StoreValue } from "./types.js";
|
|
4
|
+
type PathSafetyVerdict = {
|
|
5
|
+
ok: true;
|
|
6
|
+
} | {
|
|
7
|
+
ok: false;
|
|
8
|
+
reason: string;
|
|
9
|
+
};
|
|
10
|
+
type PathValidationCacheNode = {
|
|
11
|
+
children: Map<string, PathValidationCacheNode>;
|
|
12
|
+
verdicts?: Map<SupportedType, PathSafetyVerdict>;
|
|
13
|
+
};
|
|
14
|
+
export declare const pathValidationCache: Map<string, PathValidationCacheNode>;
|
|
15
|
+
export declare const resetPathValidationCache: (registry: object) => void;
|
|
16
|
+
export declare const validatePathSafety: (storeName: string, base: StoreValue, path: PathInput, nextValue: unknown) => {
|
|
17
|
+
ok: boolean;
|
|
18
|
+
reason?: string;
|
|
19
|
+
};
|
|
20
|
+
export declare const sanitizeValue: (name: string, value: unknown, onError?: (message: string) => void, options?: {
|
|
21
|
+
reuseInput?: boolean;
|
|
22
|
+
}) => {
|
|
23
|
+
ok: true;
|
|
24
|
+
value: StoreValue;
|
|
25
|
+
} | {
|
|
26
|
+
ok: false;
|
|
27
|
+
};
|
|
28
|
+
export declare const runValidation: (name: string, value: StoreValue, validate: ValidateOption | undefined, onError?: (message: string) => void) => {
|
|
29
|
+
ok: true;
|
|
30
|
+
value: StoreValue;
|
|
31
|
+
} | {
|
|
32
|
+
ok: false;
|
|
33
|
+
};
|
|
34
|
+
export declare const normalizeCommittedState: (name: string, value: unknown, validate: ValidateOption | undefined, onError?: (message: string) => void, options?: {
|
|
35
|
+
reuseInput?: boolean;
|
|
36
|
+
}) => {
|
|
37
|
+
ok: true;
|
|
38
|
+
value: StoreValue;
|
|
39
|
+
} | {
|
|
40
|
+
ok: false;
|
|
41
|
+
};
|
|
42
|
+
export declare const invalidatePathCache: (name: string) => void;
|
|
43
|
+
export declare const clearPathValidationCache: () => void;
|
|
44
|
+
export declare const materializeInitial: (name: string) => boolean;
|
|
45
|
+
export {};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module store-lifecycle
|
|
3
|
+
*
|
|
4
|
+
* LAYER: Core Engine
|
|
5
|
+
* OWNS: Registry state variables (stores, meta, subscribers, ...) and all
|
|
6
|
+
* pure primitives that operate on them (sanitize, validate, path-safety,
|
|
7
|
+
* feature hook dispatch).
|
|
8
|
+
*
|
|
9
|
+
* DOES NOT KNOW about: createStore(), setStore(), React hooks,
|
|
10
|
+
* or any specific feature plugin by name.
|
|
11
|
+
*
|
|
12
|
+
* Consumers: store-write (write API), store-read, store-notify,
|
|
13
|
+
* hooks-core.
|
|
14
|
+
*/
|
|
15
|
+
export type { Path, PathDepth, PathValue, PartialDeep, StoreValue, StoreKey, StoreDefinition, StoreName, StateFor, WriteResult, Subscriber, StoreStateMap, StrictStoreMap, UnregisteredStoreName, } from "./store-lifecycle/types.js";
|
|
16
|
+
export { stores, meta, subscribers, initialStates, initialFactories, snapshotCache, featureRuntimes, storeAdmin, getStoreAdmin, getFeatureRuntime, hasStoreEntryInternal, getStoreValueRef, setStoreValueInternal, applyFeatureState, clearAllRegistries, resetFeaturesForTests, getMetaEntry, getRegistry, defaultRegistryScope, } from "./store-lifecycle/registry.js";
|
|
17
|
+
export { sanitizeValue, normalizeCommittedState, runValidation, validatePathSafety, invalidatePathCache, clearPathValidationCache, materializeInitial, pathValidationCache, } from "./store-lifecycle/validation.js";
|
|
18
|
+
export { runFeatureCreateHooks, runFeatureWriteHooks, runFeatureDeleteHooks, runMiddlewareForStore, runStoreHookSafe, resolveFeatureAvailability, clearFeatureContexts, createBaseFeatureContext, } from "./store-lifecycle/hooks.js";
|
|
19
|
+
export { nameOf, qualifyName, exists, getFeatureApi, reportStoreCreationError, reportStoreError, reportStoreWarning, reportStoreCreationWarning, getSsrWarningIssued, markSsrWarningIssued, resetSsrWarningFlag, warnMissingFeature, } from "./store-lifecycle/identity.js";
|
|
20
|
+
export { bindRegistry, useRegistry } from "./store-lifecycle/bind.js";
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { StoreKey, StoreValue } from "./store-lifecycle.js";
|
|
2
|
+
import { createStore } from "./store-write.js";
|
|
3
|
+
/**
|
|
4
|
+
* Helper to get an auto-completable, literal-typed store handle without creating it.
|
|
5
|
+
*
|
|
6
|
+
* Example:
|
|
7
|
+
* const user = store("user");
|
|
8
|
+
* setStore(user, "name", "Alex");
|
|
9
|
+
*/
|
|
10
|
+
export declare const store: <Name extends string, State = StoreValue>(name: Name) => StoreKey<Name, State>;
|
|
11
|
+
export declare const namespace: (ns: string) => {
|
|
12
|
+
store: <Name extends string, State = unknown>(name: Name) => StoreKey<Name, State>;
|
|
13
|
+
create: <Name extends string, State>(name: Name, data: State, options?: Parameters<typeof createStore>[2]) => import("./store-lifecycle.js").StoreDefinition<string, unknown> | undefined;
|
|
14
|
+
createStrict: <Name extends string, State>(name: Name, data: State, options?: Parameters<typeof createStore>[2]) => import("./store-lifecycle.js").StoreDefinition<string, unknown>;
|
|
15
|
+
set: (name: any, ...rest: any[]) => any;
|
|
16
|
+
get: (name: any, ...rest: any[]) => any;
|
|
17
|
+
delete: (name: string) => void;
|
|
18
|
+
reset: (name: string) => import("./store-lifecycle.js").WriteResult;
|
|
19
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { type StoreValue, type Subscriber } from "./store-lifecycle.js";
|
|
2
|
+
export declare const notify: (name: string) => void;
|
|
3
|
+
export declare const setStoreBatch: (fn: () => unknown) => void;
|
|
4
|
+
export declare const subscribeStore: (name: string, fn: Subscriber) => (() => void);
|
|
5
|
+
/** @deprecated Use subscribeStore instead. */
|
|
6
|
+
export declare const subscribeInternal: (name: string, fn: Subscriber) => (() => void);
|
|
7
|
+
/** @deprecated Use subscribeStore instead. */
|
|
8
|
+
export declare const subscribe: (name: string, fn: Subscriber) => (() => void);
|
|
9
|
+
export declare const getStoreSnapshot: (name: string) => StoreValue | null;
|
|
10
|
+
/** @deprecated Use getStoreSnapshot instead. */
|
|
11
|
+
export declare const getSnapshot: (name: string) => StoreValue | null;
|
|
12
|
+
export declare const resetNotifyStateForTests: () => void;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { meta, hasStoreEntryInternal, getStoreValueRef, getFeatureApi, type Path, type PathValue, type StoreDefinition, type StoreValue, type StoreKey, type StoreName, type StateFor } from "./store-lifecycle.js";
|
|
2
|
+
type StoreSnapshot<T> = T extends object ? Readonly<T> : T;
|
|
3
|
+
export declare function getStore<Name extends string, State, P extends Path<State>>(name: StoreDefinition<Name, State>, path: P): StoreSnapshot<PathValue<State, P>> | null;
|
|
4
|
+
export declare function getStore<Name extends string, State>(name: StoreDefinition<Name, State>, path?: undefined): StoreSnapshot<State> | null;
|
|
5
|
+
export declare function getStore<Name extends string, State, P extends Path<State>>(name: StoreKey<Name, State>, path: P): StoreSnapshot<PathValue<State, P>> | null;
|
|
6
|
+
export declare function getStore<Name extends string, State>(name: StoreKey<Name, State>, path?: undefined): StoreSnapshot<State> | null;
|
|
7
|
+
export declare function getStore<Name extends StoreName, P extends Path<StateFor<Name>>>(name: Name, path: P): StoreSnapshot<PathValue<StateFor<Name>, P>> | null;
|
|
8
|
+
export declare function getStore<Name extends StoreName>(name: Name, path?: undefined): StoreSnapshot<StateFor<Name>> | null;
|
|
9
|
+
export declare const hasStore: (name: string) => boolean;
|
|
10
|
+
export { hasStoreEntryInternal as _hasStoreEntryInternal, getStoreValueRef as _getStoreValueRef, getFeatureApi as _getFeatureApi };
|
|
11
|
+
export declare const getInitialState: () => Record<string, StoreValue>;
|
|
12
|
+
export declare const getMetrics: (name: string) => (typeof meta)[string]["metrics"] | null;
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module store-registry
|
|
3
|
+
*
|
|
4
|
+
* LAYER: Dumb Data Container
|
|
5
|
+
* OWNS: The shape of a StoreRegistry, the global map of all scoped registries,
|
|
6
|
+
* and the SSR carrier-context injection point.
|
|
7
|
+
*
|
|
8
|
+
* DOES NOT KNOW about: validation, features, hooks, React, or any write logic.
|
|
9
|
+
* It is a plain key-value store factory — nothing more.
|
|
10
|
+
*
|
|
11
|
+
* Consumers: store-lifecycle (binds a registry scope on startup / SSR switch).
|
|
12
|
+
*/
|
|
13
|
+
import type { FeatureName, StoreFeatureMeta, StoreFeatureRuntime } from "./feature-registry.js";
|
|
14
|
+
import type { AsyncRegistry } from "./async-registry.js";
|
|
15
|
+
export type RegistryStoreValue = unknown;
|
|
16
|
+
export type RegistrySubscriber = (value: RegistryStoreValue | null) => void;
|
|
17
|
+
export type RegistrySnapshotEntry = {
|
|
18
|
+
version: number;
|
|
19
|
+
snapshot: RegistryStoreValue | null;
|
|
20
|
+
};
|
|
21
|
+
export type TransactionState = {
|
|
22
|
+
depth: number;
|
|
23
|
+
pending: Array<() => void>;
|
|
24
|
+
stagedValues: Map<string, RegistryStoreValue>;
|
|
25
|
+
failed: boolean;
|
|
26
|
+
error?: Error;
|
|
27
|
+
};
|
|
28
|
+
export type ComputedEntry = {
|
|
29
|
+
deps: string[];
|
|
30
|
+
compute: (...args: unknown[]) => unknown;
|
|
31
|
+
stale: boolean;
|
|
32
|
+
};
|
|
33
|
+
export type StoreRegistry = {
|
|
34
|
+
stores: Record<string, RegistryStoreValue>;
|
|
35
|
+
subscribers: Record<string, Set<RegistrySubscriber>>;
|
|
36
|
+
initialStates: Record<string, RegistryStoreValue>;
|
|
37
|
+
initialFactories: Record<string, (() => RegistryStoreValue) | undefined>;
|
|
38
|
+
metaEntries: Record<string, StoreFeatureMeta>;
|
|
39
|
+
snapshotCache: Record<string, RegistrySnapshotEntry>;
|
|
40
|
+
featureRuntimes: Map<FeatureName, StoreFeatureRuntime>;
|
|
41
|
+
deletingStores: Set<string>;
|
|
42
|
+
computedEntries: Record<string, ComputedEntry>;
|
|
43
|
+
computedDependents: Record<string, Set<string>>;
|
|
44
|
+
computedCleanups: Map<string, () => void>;
|
|
45
|
+
transaction: TransactionState;
|
|
46
|
+
async: AsyncRegistry;
|
|
47
|
+
};
|
|
48
|
+
export declare const normalizeStoreRegistryScope: (scope: string) => string;
|
|
49
|
+
export declare const defaultRegistryScope: string;
|
|
50
|
+
export declare const getDefaultStoreRegistry: () => StoreRegistry;
|
|
51
|
+
export declare const setRegistryScope: (scope: string) => void;
|
|
52
|
+
export declare const clearRegistryScopeOverrideForTests: () => void;
|
|
53
|
+
export declare const createStoreRegistry: () => StoreRegistry;
|
|
54
|
+
export declare const getStoreRegistry: (scope: string) => StoreRegistry;
|
|
55
|
+
export declare const hasStoreEntry: (registry: StoreRegistry, name: string) => boolean;
|
|
56
|
+
export declare const isStoreDeleting: (registry: StoreRegistry, name: string) => boolean;
|
|
57
|
+
export declare const clearStoreRegistries: (registry: StoreRegistry) => void;
|
|
58
|
+
export declare const resetAllStoreRegistriesForTests: () => void;
|
|
59
|
+
export type CarrierContext = Record<string, unknown>;
|
|
60
|
+
export interface CarrierRunner {
|
|
61
|
+
run<T>(carrier: CarrierContext, fn: () => T): T;
|
|
62
|
+
get(): CarrierContext | null;
|
|
63
|
+
}
|
|
64
|
+
export declare const injectCarrierRunner: (runner: CarrierRunner) => void;
|
|
65
|
+
export declare const getRequestCarrier: () => CarrierContext | null;
|
|
66
|
+
export interface RegistryRunner {
|
|
67
|
+
run<T>(registry: StoreRegistry, fn: () => T): T;
|
|
68
|
+
get(): StoreRegistry | null;
|
|
69
|
+
enterWith?: (registry: StoreRegistry) => void;
|
|
70
|
+
}
|
|
71
|
+
export declare const injectRegistryRunner: (runner: RegistryRunner) => void;
|
|
72
|
+
export declare const runWithRegistry: <T>(registry: StoreRegistry, fn: () => T) => T;
|
|
73
|
+
export declare const getActiveStoreRegistry: (fallback?: StoreRegistry) => StoreRegistry;
|
|
74
|
+
export declare const enterRegistry: (registry: StoreRegistry) => void;
|