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/index.d.cts
CHANGED
|
@@ -1,21 +1,25 @@
|
|
|
1
|
-
import { H as HydrateSnapshotFor, c as StoreStateMap, f as StrictStoreMap, g as HydrationResult, b as StoreKey, a as StoreDefinition,
|
|
2
|
-
export { h as HydrationFailure, P as PartialDeep,
|
|
3
|
-
import {
|
|
4
|
-
export {
|
|
5
|
-
export {
|
|
1
|
+
import { H as HydrateSnapshotFor, c as StoreStateMap, f as StrictStoreMap, g as HydrationResult, b as StoreKey, a as StoreDefinition, S as StoreValue, W as WriteResult } from './types.js';
|
|
2
|
+
export { B as BrandedStoreName, h as HydrationBlockReason, i as HydrationFailure, j as HydrationFailureReason, P as PartialDeep, k as Path, l as PathDepth, m as PathInternal, n as PathValue, o as PrevDepth, p as Primitive, R as RegisteredStoreMap, e as StateFor, d as StoreName } from './types.js';
|
|
3
|
+
import { j as HydrationConsistencyOptions } from './types-internal-2.js';
|
|
4
|
+
export { i as HydrationBootWindowControl, f as HydrationBootWindowMode, k as HydrationBootWindowOptions, a as HydrationConsistencyAuthority, l as HydrationConsistencyContract, b as HydrationConsistencyPolicy, c as HydrationConsistencyResolution, d as HydrationConsistencySource, m as HydrationConsistencyStoreContract, n as HydrationConsistencyStorePolicy, g as HydrationDriftEvent, o as HydrationInvalidateArgs, p as HydrationMergeArgs, H as HydrationSnapshotMetadata } from './types-internal-2.js';
|
|
5
|
+
export { FeatureMetrics, StoreFeatureMeta } from './feature.js';
|
|
6
6
|
import { N as NonFunction } from './utility.js';
|
|
7
|
-
export {
|
|
8
|
-
export { findColdStores, getStoreHealth } from './runtime-tools.js';
|
|
9
|
-
export { createComputed, deleteComputed, invalidateComputed, isComputedStore } from './computed.js';
|
|
10
|
-
import { F as FetchInput } from './cache.js';
|
|
7
|
+
export { T as TraceContext } from './utility.js';
|
|
11
8
|
import { F as FetchOptions } from './registry.js';
|
|
12
|
-
|
|
13
|
-
|
|
9
|
+
export { a as AsyncMetricsSnapshot } from './registry.js';
|
|
10
|
+
export { C as ComputedClassification } from './types-internal-3.js';
|
|
11
|
+
import { S as StoreOptions, R as ResetCloneMode, b as SnapshotMode, M as MiddlewareCtx, a as StoreValue$1 } from './types-internal.js';
|
|
12
|
+
export { D as DevtoolsOptions, F as FeatureOptions, c as FeatureOptionsMap, L as LifecycleOptions, N as NormalizedOptions, P as PersistConfig, d as PersistDriver, e as PersistOptions, f as SchemaValidateOption, g as StoreScope, h as SyncMessage, i as SyncOptions, V as ValidateFn, j as ValidateOption } from './types-internal.js';
|
|
13
|
+
export { I as IsStoreNameLoose, L as LazyDisallow, S as StorePathForTarget, a as StorePathValueForTarget, b as StoreSnapshot, c as StoreTarget, d as StoreUpdate, e as StoreUpdateForTarget, f as createStore, g as createStoreStrict, h as deleteStore, i as getMetrics, j as getStore, k as hasStore, r as resetStore, s as setStore } from './index-internal.js';
|
|
14
|
+
export { g as getAsyncMetrics } from './metrics.js';
|
|
15
|
+
export { C as ColdStoreReport, f as findColdStores } from './core-internal.js';
|
|
16
|
+
export { S as StoreHealthEntry, a as StoreHealthReport, c as getStoreHealth } from './async-internal.js';
|
|
17
|
+
export { ComputedOptions, DepHandle, DepValue, createComputed, deleteComputed, invalidateComputed, isComputedStore } from './computed.js';
|
|
18
|
+
import { F as FetchInput } from './cache.js';
|
|
19
|
+
import { QueryStoreTarget, reactQueryKey, swrKey } from './query.js';
|
|
14
20
|
import './store-registry.js';
|
|
15
21
|
import './runtime-patch.js';
|
|
16
22
|
|
|
17
|
-
declare const setStoreBatch: (fn: () => unknown) => void;
|
|
18
|
-
|
|
19
23
|
type HydrateSnapshot = HydrateSnapshotFor<StoreStateMap & StrictStoreMap>;
|
|
20
24
|
type HydrateOptions<Snapshot extends object> = Partial<{
|
|
21
25
|
[K in keyof Snapshot]: StoreOptions<Snapshot[K]>;
|
|
@@ -47,7 +51,9 @@ type HydrationTrust<Snapshot extends object> = (HydrationTrustBase<Snapshot> & {
|
|
|
47
51
|
}) | (HydrationTrustBase<Snapshot> & {
|
|
48
52
|
validate: (snapshot: Snapshot) => boolean;
|
|
49
53
|
});
|
|
50
|
-
declare const hydrateStores: <Snapshot extends object = HydrateSnapshot>(snapshot: Snapshot, options: HydrateOptions<Snapshot> | undefined, trust: HydrationTrust<Snapshot>) => HydrationResult;
|
|
54
|
+
declare const hydrateStores: <Snapshot extends object = HydrateSnapshot>(snapshot: Snapshot, options: HydrateOptions<Snapshot> | undefined, trust: HydrationTrust<Snapshot>, consistency?: HydrationConsistencyOptions<Snapshot>) => HydrationResult;
|
|
55
|
+
|
|
56
|
+
declare const setStoreBatch: (fn: () => unknown) => void;
|
|
51
57
|
|
|
52
58
|
/**
|
|
53
59
|
* Helper to get an auto-completable, literal-typed store handle without creating it.
|
|
@@ -61,8 +67,16 @@ declare const namespace: (ns: string) => {
|
|
|
61
67
|
store: <Name extends string, State = unknown>(name: Name) => StoreKey<Name, State>;
|
|
62
68
|
create: <Name extends string, State>(name: Name, data: NonFunction<State>, options?: StoreOptions<State>) => StoreDefinition<string, State> | undefined;
|
|
63
69
|
createStrict: <Name extends string, State>(name: Name, data: NonFunction<State>, options?: StoreOptions<State>) => StoreDefinition<string, State>;
|
|
64
|
-
set: (name:
|
|
65
|
-
|
|
70
|
+
set: (name: string | StoreKey<string, StoreValue>, ...rest: unknown[]) => {
|
|
71
|
+
ok: true;
|
|
72
|
+
} | {
|
|
73
|
+
ok: false;
|
|
74
|
+
reason: "not-found" | "no-initial-state" | "validate" | "path" | "middleware" | "ssr" | "invalid-args" | "lazy-uninitialized" | "unsupported-op" | "unsupported-path-shape";
|
|
75
|
+
} | {
|
|
76
|
+
readonly ok: false;
|
|
77
|
+
readonly reason: "invalid-args";
|
|
78
|
+
};
|
|
79
|
+
get: (name: string | StoreKey<string, StoreValue>, path?: string | readonly string[]) => unknown;
|
|
66
80
|
delete: (name: string) => void;
|
|
67
81
|
reset: (name: string) => WriteResult;
|
|
68
82
|
};
|
|
@@ -103,6 +117,13 @@ type StroidConfig = {
|
|
|
103
117
|
strictMutatorReturns?: boolean;
|
|
104
118
|
asyncAutoCreate?: boolean;
|
|
105
119
|
asyncCloneResult?: AsyncCloneMode;
|
|
120
|
+
/**
|
|
121
|
+
* Clone mode used by resetStore when restoring initial state.
|
|
122
|
+
* - "deep" (default): safest, isolates initial snapshots.
|
|
123
|
+
* - "shallow": clone top-level container only.
|
|
124
|
+
* - "none": reuse the initial snapshot reference.
|
|
125
|
+
*/
|
|
126
|
+
resetCloneMode?: ResetCloneMode;
|
|
106
127
|
/**
|
|
107
128
|
* Automatically generate correlation IDs for async fetch writes.
|
|
108
129
|
* Default: false.
|
|
@@ -155,11 +176,8 @@ type StroidConfig = {
|
|
|
155
176
|
};
|
|
156
177
|
declare const configureStroid: (next?: StroidConfig) => void;
|
|
157
178
|
|
|
158
|
-
|
|
159
|
-
declare const
|
|
160
|
-
declare const createReactQueryFetcher: (storeName: StoreTarget, input: FetchInput, options?: FetchOptions) => () => Promise<unknown>;
|
|
161
|
-
declare const swrKey: (storeName: StoreTarget, cacheKey?: string | number) => (string | number)[];
|
|
162
|
-
declare const createSwrFetcher: (storeName: StoreTarget, input: FetchInput, options?: FetchOptions) => () => Promise<unknown>;
|
|
179
|
+
declare const createReactQueryFetcher: (storeName: QueryStoreTarget, input: FetchInput, options?: FetchOptions) => () => Promise<unknown>;
|
|
180
|
+
declare const createSwrFetcher: (storeName: QueryStoreTarget, input: FetchInput, options?: FetchOptions) => () => Promise<unknown>;
|
|
163
181
|
|
|
164
182
|
declare const query_createReactQueryFetcher: typeof createReactQueryFetcher;
|
|
165
183
|
declare const query_createSwrFetcher: typeof createSwrFetcher;
|
|
@@ -169,4 +187,4 @@ declare namespace query {
|
|
|
169
187
|
export { query_createReactQueryFetcher as createReactQueryFetcher, query_createSwrFetcher as createSwrFetcher, query_reactQueryKey as reactQueryKey, query_swrKey as swrKey };
|
|
170
188
|
}
|
|
171
189
|
|
|
172
|
-
export { HydrateSnapshotFor, HydrationResult, StoreDefinition, StoreKey,
|
|
190
|
+
export { type AsyncCloneMode, type FlushConfig, type HydrateOptions, type HydrateSnapshot, HydrateSnapshotFor, HydrationConsistencyOptions, HydrationResult, type HydrationTrust, type HydrationTrustBase, type LogSink, MiddlewareCtx, NonFunction, StoreValue$1 as OptionStoreValue, ResetCloneMode, type RevalidateOnFocusConfig, SnapshotMode, StoreDefinition, StoreKey, StoreOptions, StoreStateMap, StoreValue, StrictStoreMap, type StroidConfig, WriteResult, configureStroid, hydrateStores, namespace, query as queryIntegrations, setStoreBatch, store };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,21 +1,25 @@
|
|
|
1
|
-
import { H as HydrateSnapshotFor, c as StoreStateMap, f as StrictStoreMap, g as HydrationResult, b as StoreKey, a as StoreDefinition,
|
|
2
|
-
export { h as HydrationFailure, P as PartialDeep,
|
|
3
|
-
import {
|
|
4
|
-
export {
|
|
5
|
-
export {
|
|
1
|
+
import { H as HydrateSnapshotFor, c as StoreStateMap, f as StrictStoreMap, g as HydrationResult, b as StoreKey, a as StoreDefinition, S as StoreValue, W as WriteResult } from './types.js';
|
|
2
|
+
export { B as BrandedStoreName, h as HydrationBlockReason, i as HydrationFailure, j as HydrationFailureReason, P as PartialDeep, k as Path, l as PathDepth, m as PathInternal, n as PathValue, o as PrevDepth, p as Primitive, R as RegisteredStoreMap, e as StateFor, d as StoreName } from './types.js';
|
|
3
|
+
import { j as HydrationConsistencyOptions } from './types-internal-2.js';
|
|
4
|
+
export { i as HydrationBootWindowControl, f as HydrationBootWindowMode, k as HydrationBootWindowOptions, a as HydrationConsistencyAuthority, l as HydrationConsistencyContract, b as HydrationConsistencyPolicy, c as HydrationConsistencyResolution, d as HydrationConsistencySource, m as HydrationConsistencyStoreContract, n as HydrationConsistencyStorePolicy, g as HydrationDriftEvent, o as HydrationInvalidateArgs, p as HydrationMergeArgs, H as HydrationSnapshotMetadata } from './types-internal-2.js';
|
|
5
|
+
export { FeatureMetrics, StoreFeatureMeta } from './feature.js';
|
|
6
6
|
import { N as NonFunction } from './utility.js';
|
|
7
|
-
export {
|
|
8
|
-
export { findColdStores, getStoreHealth } from './runtime-tools.js';
|
|
9
|
-
export { createComputed, deleteComputed, invalidateComputed, isComputedStore } from './computed.js';
|
|
10
|
-
import { F as FetchInput } from './cache.js';
|
|
7
|
+
export { T as TraceContext } from './utility.js';
|
|
11
8
|
import { F as FetchOptions } from './registry.js';
|
|
12
|
-
|
|
13
|
-
|
|
9
|
+
export { a as AsyncMetricsSnapshot } from './registry.js';
|
|
10
|
+
export { C as ComputedClassification } from './types-internal-3.js';
|
|
11
|
+
import { S as StoreOptions, R as ResetCloneMode, b as SnapshotMode, M as MiddlewareCtx, a as StoreValue$1 } from './types-internal.js';
|
|
12
|
+
export { D as DevtoolsOptions, F as FeatureOptions, c as FeatureOptionsMap, L as LifecycleOptions, N as NormalizedOptions, P as PersistConfig, d as PersistDriver, e as PersistOptions, f as SchemaValidateOption, g as StoreScope, h as SyncMessage, i as SyncOptions, V as ValidateFn, j as ValidateOption } from './types-internal.js';
|
|
13
|
+
export { I as IsStoreNameLoose, L as LazyDisallow, S as StorePathForTarget, a as StorePathValueForTarget, b as StoreSnapshot, c as StoreTarget, d as StoreUpdate, e as StoreUpdateForTarget, f as createStore, g as createStoreStrict, h as deleteStore, i as getMetrics, j as getStore, k as hasStore, r as resetStore, s as setStore } from './index-internal.js';
|
|
14
|
+
export { g as getAsyncMetrics } from './metrics.js';
|
|
15
|
+
export { C as ColdStoreReport, f as findColdStores } from './core-internal.js';
|
|
16
|
+
export { S as StoreHealthEntry, a as StoreHealthReport, c as getStoreHealth } from './async-internal.js';
|
|
17
|
+
export { ComputedOptions, DepHandle, DepValue, createComputed, deleteComputed, invalidateComputed, isComputedStore } from './computed.js';
|
|
18
|
+
import { F as FetchInput } from './cache.js';
|
|
19
|
+
import { QueryStoreTarget, reactQueryKey, swrKey } from './query.js';
|
|
14
20
|
import './store-registry.js';
|
|
15
21
|
import './runtime-patch.js';
|
|
16
22
|
|
|
17
|
-
declare const setStoreBatch: (fn: () => unknown) => void;
|
|
18
|
-
|
|
19
23
|
type HydrateSnapshot = HydrateSnapshotFor<StoreStateMap & StrictStoreMap>;
|
|
20
24
|
type HydrateOptions<Snapshot extends object> = Partial<{
|
|
21
25
|
[K in keyof Snapshot]: StoreOptions<Snapshot[K]>;
|
|
@@ -47,7 +51,9 @@ type HydrationTrust<Snapshot extends object> = (HydrationTrustBase<Snapshot> & {
|
|
|
47
51
|
}) | (HydrationTrustBase<Snapshot> & {
|
|
48
52
|
validate: (snapshot: Snapshot) => boolean;
|
|
49
53
|
});
|
|
50
|
-
declare const hydrateStores: <Snapshot extends object = HydrateSnapshot>(snapshot: Snapshot, options: HydrateOptions<Snapshot> | undefined, trust: HydrationTrust<Snapshot>) => HydrationResult;
|
|
54
|
+
declare const hydrateStores: <Snapshot extends object = HydrateSnapshot>(snapshot: Snapshot, options: HydrateOptions<Snapshot> | undefined, trust: HydrationTrust<Snapshot>, consistency?: HydrationConsistencyOptions<Snapshot>) => HydrationResult;
|
|
55
|
+
|
|
56
|
+
declare const setStoreBatch: (fn: () => unknown) => void;
|
|
51
57
|
|
|
52
58
|
/**
|
|
53
59
|
* Helper to get an auto-completable, literal-typed store handle without creating it.
|
|
@@ -61,8 +67,16 @@ declare const namespace: (ns: string) => {
|
|
|
61
67
|
store: <Name extends string, State = unknown>(name: Name) => StoreKey<Name, State>;
|
|
62
68
|
create: <Name extends string, State>(name: Name, data: NonFunction<State>, options?: StoreOptions<State>) => StoreDefinition<string, State> | undefined;
|
|
63
69
|
createStrict: <Name extends string, State>(name: Name, data: NonFunction<State>, options?: StoreOptions<State>) => StoreDefinition<string, State>;
|
|
64
|
-
set: (name:
|
|
65
|
-
|
|
70
|
+
set: (name: string | StoreKey<string, StoreValue>, ...rest: unknown[]) => {
|
|
71
|
+
ok: true;
|
|
72
|
+
} | {
|
|
73
|
+
ok: false;
|
|
74
|
+
reason: "not-found" | "no-initial-state" | "validate" | "path" | "middleware" | "ssr" | "invalid-args" | "lazy-uninitialized" | "unsupported-op" | "unsupported-path-shape";
|
|
75
|
+
} | {
|
|
76
|
+
readonly ok: false;
|
|
77
|
+
readonly reason: "invalid-args";
|
|
78
|
+
};
|
|
79
|
+
get: (name: string | StoreKey<string, StoreValue>, path?: string | readonly string[]) => unknown;
|
|
66
80
|
delete: (name: string) => void;
|
|
67
81
|
reset: (name: string) => WriteResult;
|
|
68
82
|
};
|
|
@@ -103,6 +117,13 @@ type StroidConfig = {
|
|
|
103
117
|
strictMutatorReturns?: boolean;
|
|
104
118
|
asyncAutoCreate?: boolean;
|
|
105
119
|
asyncCloneResult?: AsyncCloneMode;
|
|
120
|
+
/**
|
|
121
|
+
* Clone mode used by resetStore when restoring initial state.
|
|
122
|
+
* - "deep" (default): safest, isolates initial snapshots.
|
|
123
|
+
* - "shallow": clone top-level container only.
|
|
124
|
+
* - "none": reuse the initial snapshot reference.
|
|
125
|
+
*/
|
|
126
|
+
resetCloneMode?: ResetCloneMode;
|
|
106
127
|
/**
|
|
107
128
|
* Automatically generate correlation IDs for async fetch writes.
|
|
108
129
|
* Default: false.
|
|
@@ -155,11 +176,8 @@ type StroidConfig = {
|
|
|
155
176
|
};
|
|
156
177
|
declare const configureStroid: (next?: StroidConfig) => void;
|
|
157
178
|
|
|
158
|
-
|
|
159
|
-
declare const
|
|
160
|
-
declare const createReactQueryFetcher: (storeName: StoreTarget, input: FetchInput, options?: FetchOptions) => () => Promise<unknown>;
|
|
161
|
-
declare const swrKey: (storeName: StoreTarget, cacheKey?: string | number) => (string | number)[];
|
|
162
|
-
declare const createSwrFetcher: (storeName: StoreTarget, input: FetchInput, options?: FetchOptions) => () => Promise<unknown>;
|
|
179
|
+
declare const createReactQueryFetcher: (storeName: QueryStoreTarget, input: FetchInput, options?: FetchOptions) => () => Promise<unknown>;
|
|
180
|
+
declare const createSwrFetcher: (storeName: QueryStoreTarget, input: FetchInput, options?: FetchOptions) => () => Promise<unknown>;
|
|
163
181
|
|
|
164
182
|
declare const query_createReactQueryFetcher: typeof createReactQueryFetcher;
|
|
165
183
|
declare const query_createSwrFetcher: typeof createSwrFetcher;
|
|
@@ -169,4 +187,4 @@ declare namespace query {
|
|
|
169
187
|
export { query_createReactQueryFetcher as createReactQueryFetcher, query_createSwrFetcher as createSwrFetcher, query_reactQueryKey as reactQueryKey, query_swrKey as swrKey };
|
|
170
188
|
}
|
|
171
189
|
|
|
172
|
-
export { HydrateSnapshotFor, HydrationResult, StoreDefinition, StoreKey,
|
|
190
|
+
export { type AsyncCloneMode, type FlushConfig, type HydrateOptions, type HydrateSnapshot, HydrateSnapshotFor, HydrationConsistencyOptions, HydrationResult, type HydrationTrust, type HydrationTrustBase, type LogSink, MiddlewareCtx, NonFunction, StoreValue$1 as OptionStoreValue, ResetCloneMode, type RevalidateOnFocusConfig, SnapshotMode, StoreDefinition, StoreKey, StoreOptions, StoreStateMap, StoreValue, StrictStoreMap, type StroidConfig, WriteResult, configureStroid, hydrateStores, namespace, query as queryIntegrations, setStoreBatch, store };
|
package/dist/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import'./chunk-
|
|
1
|
+
import {b,a as a$1}from'./chunk-FSNVSMAV.js';export{f as findColdStores,i as getStoreHealth}from'./chunk-SF6EP56S.js';import {a as a$2}from'./chunk-LWUT37FW.js';export{e as getAsyncMetrics}from'./chunk-LWUT37FW.js';import'./chunk-WXJ3IREA.js';import'./chunk-E33L4MII.js';export{y as createComputed,l as createStore,m as createStoreStrict,A as deleteComputed,X as deleteStore,p as getMetrics,n as getStore,o as hasStore,W as hydrateStores,z as invalidateComputed,B as isComputedStore,r as namespace,Y as resetStore,w as setStore,S as setStoreBatch,q as store}from'./chunk-X2MKRN7O.js';export{K as configureStroid}from'./chunk-6IBJ7CIK.js';import'./chunk-PHE2BCFG.js';import {a}from'./chunk-4C666HHU.js';var H={};a(H,{createReactQueryFetcher:()=>T,createSwrFetcher:()=>V,reactQueryKey:()=>a$1,swrKey:()=>b});var T=(t,e,o={})=>async()=>typeof t=="string"?a$2(t,e,o):a$2(t,e,o),V=(t,e,o={})=>async()=>typeof t=="string"?a$2(t,e,o):a$2(t,e,o);export{H as queryIntegrations};//# sourceMappingURL=index.js.map
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
package/dist/install.d.ts
CHANGED
|
@@ -1,6 +1,18 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
export { installPersist } from './persist.js';
|
|
2
|
+
export { installSync } from './sync.js';
|
|
3
|
+
export { i as installDevtools } from './devtools-internal.js';
|
|
4
|
+
import './types-internal.js';
|
|
5
|
+
import './utility.js';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* @module install
|
|
9
|
+
*
|
|
10
|
+
* LAYER: Module
|
|
11
|
+
* OWNS: Module-level behavior and exports for install.
|
|
12
|
+
*
|
|
13
|
+
* Consumers: Internal imports and public API.
|
|
14
|
+
*/
|
|
15
|
+
|
|
4
16
|
declare const installAllFeatures: () => void;
|
|
5
17
|
|
|
6
|
-
export { installAllFeatures
|
|
18
|
+
export { installAllFeatures };
|
package/dist/install.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export{
|
|
1
|
+
import {a}from'./chunk-Y54SMROI.js';export{a as installPersist}from'./chunk-Y54SMROI.js';import {a as a$1}from'./chunk-GZQGU64H.js';export{a as installSync}from'./chunk-GZQGU64H.js';import'./chunk-4D6OA3DD.js';import {a as a$2}from'./chunk-NFT6AZXY.js';export{a as installDevtools}from'./chunk-NFT6AZXY.js';import'./chunk-X2MKRN7O.js';import'./chunk-6IBJ7CIK.js';import'./chunk-PHE2BCFG.js';import'./chunk-4C666HHU.js';var e=()=>{a(),a$1(),a$2();};export{e as installAllFeatures};//# sourceMappingURL=install.js.map
|
|
2
2
|
//# sourceMappingURL=install.js.map
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { a as AsyncMetricsSnapshot } from './registry.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @module async/fetch/metrics
|
|
5
|
+
*
|
|
6
|
+
* LAYER: Module
|
|
7
|
+
* OWNS: Async fetch metrics readers.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
declare function getAsyncMetrics(): AsyncMetricsSnapshot;
|
|
11
|
+
declare function getAsyncMetrics(name: string): AsyncMetricsSnapshot | null;
|
|
12
|
+
|
|
13
|
+
export { getAsyncMetrics as g };
|
package/dist/persist.d.ts
CHANGED
package/dist/persist.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export{a as installPersist}from'./chunk-
|
|
1
|
+
export{a as installPersist}from'./chunk-Y54SMROI.js';import'./chunk-4D6OA3DD.js';import'./chunk-6IBJ7CIK.js';import'./chunk-PHE2BCFG.js';import'./chunk-4C666HHU.js';//# sourceMappingURL=persist.js.map
|
|
2
2
|
//# sourceMappingURL=persist.js.map
|
package/dist/psr.d.ts
CHANGED
|
@@ -1,15 +1,14 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { g as getStoreMeta, l as listStores } from './core-internal.js';
|
|
2
|
+
import { W as WriteResult, S as StoreValue, a as StoreDefinition, b as StoreKey } from './types.js';
|
|
2
3
|
import { R as RuntimePatch } from './runtime-patch.js';
|
|
3
4
|
export { a as RuntimePatchMeta, b as RuntimePatchOp } from './runtime-patch.js';
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
export {
|
|
5
|
+
import { R as RuntimeGraph } from './types-internal-3.js';
|
|
6
|
+
export { C as ComputedClassification, a as ComputedDescriptor, b as RuntimeEdgeType, c as RuntimeGraphEdge, d as RuntimeGraphGranularity, e as RuntimeGraphNode, f as RuntimeNodeId, g as RuntimeNodeType } from './types-internal-3.js';
|
|
7
|
+
export { e as evaluateComputed, g as getComputedDescriptor } from './graph-D28.js';
|
|
7
8
|
import './feature.js';
|
|
8
|
-
import './
|
|
9
|
+
import './types-internal.js';
|
|
9
10
|
import './utility.js';
|
|
10
|
-
import './
|
|
11
|
-
import './cache.js';
|
|
12
|
-
import './registry.js';
|
|
11
|
+
import './types-internal-2.js';
|
|
13
12
|
|
|
14
13
|
type StoreTarget = StoreDefinition<string, StoreValue> | StoreKey<string, StoreValue> | string;
|
|
15
14
|
type StoreListener = (value: StoreValue | null) => void;
|
package/dist/psr.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {k as k$1,b,m as m$1,a}from'./chunk-
|
|
1
|
+
import {k as k$1,b,m as m$1,a}from'./chunk-SF6EP56S.js';export{n as evaluateComputed,m as getComputedDescriptor,b as getStoreMeta,a as listStores}from'./chunk-SF6EP56S.js';import'./chunk-LWUT37FW.js';import'./chunk-E33L4MII.js';import {V,T as T$1,o,E,M,O,P as P$1,c as c$1,v,q as q$1,x as x$1,J}from'./chunk-X2MKRN7O.js';import {Z as Z$1}from'./chunk-6IBJ7CIK.js';import'./chunk-PHE2BCFG.js';import'./chunk-4C666HHU.js';var x={ok:false,reason:"invalid-args"},Q={reason:"unsupported-op"};var X=["set","merge","delete","insert"],Y=["setStore","replaceStore","resetStore","hydrateStores"],h=e=>c$1(e),U=e=>!!e?.options.persist?.encryptAsync||!!e?.options.persist?.decryptAsync||e?.options.persist?.checksum==="sha256",Z=e=>!!e?.options.sync||U(e),ee=e=>!!e?.options.persist||!!e?.options.sync||e?.options.devtools===true,te=(e,t)=>JSON.stringify([e,t,[]]),re=e=>te("leaf",e),_=(e,t)=>{let r=new Map;return e.edges.forEach(n=>{let o=t==="forward"?n.from:n.to,s=t==="forward"?n.to:n.from,a=r.get(o);if(a){a.push(s);return}r.set(o,[s]);}),r},z=(e,t)=>{let r=new Set,n=[...e];for(;n.length>0;){let o=n.shift();if(r.has(o))continue;r.add(o);let s=t.get(o);s&&s.forEach(a=>{r.has(a)||n.push(a);});}return r},m=e=>Array.from(new Set(e)).sort((t,r)=>t.localeCompare(r)),ne=e=>{if(!e)return [];let t=m$1(e);return t?[t.id]:[re(e)]},oe=(e,t)=>{if(!e)return m(a());let r=m$1(e);if(!r)return [e];let n=new Map(t.nodes.map(u=>[u.id,u])),o=_(t,"reverse"),s=z([r.id],o),a$1=Array.from(s).map(u=>n.get(u)).filter(u=>!!u).filter(u=>u.type==="leaf").map(u=>u.storeId);return a$1.length>0?m(a$1):[e]},se=(e,t)=>{let r=new Set(t.nodes.filter(a=>a.type==="async-boundary").map(a=>a.id));if(r.size===0)return [];if(!e)return m(r);let n=ne(e),o=_(t,"forward"),s=z(n,o);return m(Array.from(s).filter(a=>r.has(a)))},p=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),ae=e=>typeof e=="string"&&X.includes(e),ue=e=>typeof e=="string"&&Y.includes(e),L=e=>typeof e?.id=="string"&&e.id.length>0?e.id:void 0,c=(e,t)=>t?{ok:false,reason:e,failedPatchId:t}:{ok:false,reason:e},S=(e,t)=>e.ok?{ok:true}:c(e.reason,"failedPatchId"in e?e.failedPatchId??t:t),B=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),k=e=>typeof e=="number"?Number.isInteger(e)&&e>=0?e:null:/^(0|[1-9]\d*)$/.test(e)?Number(e):null,W=(e,t)=>{if(Array.isArray(e)){let n=k(t);return n===null?{ok:false,reason:"unsupported-path-shape"}:n>=e.length?{ok:false,reason:"path"}:{ok:true,value:e[n]}}let r=String(t);return Object.prototype.hasOwnProperty.call(e,r)?{ok:true,value:e[r]}:{ok:false,reason:"path"}},H=(e,t,r)=>{if(Array.isArray(e)){let n=k(t);if(n===null)return e;let o=[...e];return o[n]=r,o}return {...e,[String(t)]:r}},P=(e,t,r)=>{if(t.length===0)return {ok:false,reason:"unsupported-path-shape"};if(!Array.isArray(e)&&!B(e))return {ok:false,reason:"unsupported-path-shape"};let[n,...o]=t;if(o.length===0)return r(e,n);let s=W(e,n);if(!s.ok)return s;let a=P(s.value,o,r);return a.ok?{ok:true,value:H(e,n,a.value)}:a},ie=(e,t,r)=>B(r)?P(e,t,(n,o)=>{let s=W(n,o);return s.ok?B(s.value)?{ok:true,value:H(n,o,{...s.value,...r})}:{ok:false,reason:"unsupported-path-shape"}:s}):{ok:false,reason:"unsupported-path-shape"},le=(e,t)=>P(e,t,(r,n)=>{if(Array.isArray(r)){let a=k(n);if(a===null)return {ok:false,reason:"unsupported-path-shape"};if(a>=r.length)return {ok:false,reason:"path"};let u=[...r];return u.splice(a,1),{ok:true,value:u}}let o=String(n);if(!Object.prototype.hasOwnProperty.call(r,o))return {ok:false,reason:"path"};let s={...r};return delete s[o],{ok:true,value:s}}),de=(e,t,r)=>P(e,t,(n,o)=>{if(!Array.isArray(n))return {ok:false,reason:"unsupported-path-shape"};let s=k(o);if(s===null)return {ok:false,reason:"unsupported-path-shape"};if(s>n.length)return {ok:false,reason:"path"};let a=[...n];return a.splice(s,0,r),{ok:true,value:a}}),T=(e,t)=>{let r=e.id;if(!o(e.store))return c("not-found",r);let n=E(),o$1=J(e.store,n);if(o$1===void 0)return c("not-found",r);let s=t(o$1);return s.ok?S(v(q$1(e.store),s.value),r):c(s.reason,r)},$=e=>{if(!e||typeof e!="object"||!p(e,"id")||typeof e.id!="string"||e.id.length===0||!p(e,"store")||typeof e.store!="string"||e.store.length===0||!p(e,"path")||!Array.isArray(e.path)||e.path.some(r=>typeof r!="string"&&typeof r!="number")||!ae(e.op)||(e.op==="set"||e.op==="merge"||e.op==="insert")&&!p(e,"value")||!p(e,"meta")||!e.meta||typeof e.meta!="object"||typeof e.meta.timestamp!="number"||!Number.isFinite(e.meta.timestamp)||!ue(e.meta.source)||e.meta.causedBy!==void 0&&(!Array.isArray(e.meta.causedBy)||e.meta.causedBy.some(r=>typeof r!="string"))||e.meta.isUnsafe!==void 0&&typeof e.meta.isUnsafe!="boolean"||e.meta.asyncBoundary!==void 0&&typeof e.meta.asyncBoundary!="boolean")return null;let t=e.path.map(r=>typeof r=="number"?r:String(r));return Z$1(t.map(r=>String(r)))?{id:e.id,store:e.store,path:t,op:e.op,...p(e,"value")?{value:e.value}:{},meta:{timestamp:e.meta.timestamp,source:e.meta.source,...e.meta.causedBy&&e.meta.causedBy.length>0?{causedBy:[...e.meta.causedBy]}:{},...e.meta.isUnsafe===true?{isUnsafe:true}:{},...e.meta.asyncBoundary===true?{asyncBoundary:true}:{}}}:null},q=e=>e.op==="set"?e.path.length===0?S(v(q$1(e.store),e.value),e.id):S(x$1(q$1(e.store),e.path.map(t=>String(t)),e.value,null),e.id):e.op==="merge"?e.path.length===0?S(x$1(q$1(e.store),e.value,void 0,null),e.id):T(e,t=>ie(t,e.path,e.value)):e.op==="delete"?T(e,t=>le(t,e.path)):e.op==="insert"?T(e,t=>de(t,e.path,e.value)):c(Q.reason,e.id),ce=e=>{let t=k$1(),n=oe(e,t).map(i=>({storeId:i,meta:b(i)})),o=se(e,t),s=new Map(t.nodes.map(i=>[i.id,i])),a=e?m$1(e):null,u=new Set;n.forEach(({storeId:i,meta:f})=>{f?.options.sync&&u.add(`sync for "${i}" can apply remote writes outside the local commit path`),U(f)&&u.add(`persist for "${i}" introduces async boundary work`);}),o.forEach(i=>{let f=s.get(i)?.storeId;if(!f)return;let K=a?.id===i||!e?"computed node":"downstream computed node";u.add(`${K} "${f}" is marked asyncBoundary`);});let l=n.some(({meta:i})=>!!i?.options.sync),d=o.length>0||n.some(({meta:i})=>Z(i)),M=n.some(({meta:i})=>ee(i))?"in-pipeline":"out-of-pipeline";return {simulationWindow:"pre-commit",executionModel:d?"async-boundary":"sync",effectScope:M,governanceMode:l?"observer":d?"bounded-governor":"full-governor",mutationAuthority:l?"shared":"exclusive",causalityBoundary:d?"async-boundary":"none",reasons:m(u)}},Ae=e=>V(h(e)),be=e=>V(h(e)),we=(e,t)=>T$1(h(e),t),Ie=e=>o(h(e)),Te=e=>{let t=$(e);return t?q(t):c(x.reason,L(e))},xe=e=>{if(!Array.isArray(e))return x;if(e.length===0)return {ok:true};let t=[];for(let l of e){let d=$(l);if(!d)return c(x.reason,L(l));t.push(d);}let r=E(),n=r.notify;n.batchDepth=Math.max(0,n.batchDepth+1),M(r);let o=null,s=null,a=null,u;try{for(let l of t){u=l.id;let d=q(l);if(!d.ok){o=d.failedPatchId?d:{ok:!1,reason:d.reason,failedPatchId:l.id};break}}}catch(l){s=l instanceof Error?l:new Error(String(l));}finally{let l=o?.reason;a=O(s??(l?new Error(`applyStorePatchesAtomic failed: ${l}`):void 0),r),n.batchDepth=Math.max(0,n.batchDepth-1),n.batchDepth===0&&n.pendingNotifications.size>0&&P$1(r);}return o||(s||a?c("validate",u):{ok:true})},Be=e=>ce(e?h(e):void 0),Me=()=>k$1(),Ne=()=>k$1();export{Te as applyStorePatch,xe as applyStorePatchesAtomic,Me as getComputedGraph,Ne as getRuntimeGraph,Ae as getStoreSnapshot,be as getStoreSnapshotNoTrack,Be as getTimingContract,Ie as hasStore,we as subscribeStore};//# sourceMappingURL=psr.js.map
|
|
2
2
|
//# sourceMappingURL=psr.js.map
|
package/dist/query.d.ts
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { a as StoreDefinition, b as StoreKey, d as StoreName } from './types.js';
|
|
2
|
+
import './types-internal-2.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* @module integrations/query-keys
|
|
6
|
+
*
|
|
7
|
+
* LAYER: Module
|
|
8
|
+
* OWNS: Lightweight query-key helpers with no async runtime dependency.
|
|
9
|
+
*
|
|
10
|
+
* Consumers: query entrypoint and query integration helpers.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
type QueryStoreTarget = StoreDefinition<string, unknown> | StoreKey<string, unknown> | StoreName;
|
|
14
|
+
declare const reactQueryKey: (storeName: QueryStoreTarget, cacheKey?: string | number) => (string | number)[];
|
|
15
|
+
declare const swrKey: (storeName: QueryStoreTarget, cacheKey?: string | number) => (string | number)[];
|
|
16
|
+
|
|
17
|
+
export { type QueryStoreTarget, reactQueryKey, swrKey };
|
package/dist/query.js
ADDED
package/dist/react/index.d.ts
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
|
-
import { a as StoreDefinition, b as StoreKey, d as StoreName, e as StateFor,
|
|
1
|
+
import { a as StoreDefinition, b as StoreKey, d as StoreName, e as StateFor, k as Path, n as PathValue } from '../types.js';
|
|
2
2
|
import { F as FetchInput } from '../cache.js';
|
|
3
3
|
import { F as FetchOptions } from '../registry.js';
|
|
4
4
|
import React, { ReactNode } from 'react';
|
|
5
5
|
import { S as StoreRegistry } from '../store-registry.js';
|
|
6
|
+
import '../types-internal-2.js';
|
|
6
7
|
import '../utility.js';
|
|
7
8
|
import '../feature.js';
|
|
8
|
-
import '../
|
|
9
|
+
import '../types-internal.js';
|
|
9
10
|
import '../runtime-patch.js';
|
|
10
|
-
import '../
|
|
11
|
+
import '../types-internal-3.js';
|
|
11
12
|
|
|
12
13
|
type StoreSnapshot$1<T> = T extends object ? Readonly<T> : T;
|
|
13
14
|
declare function useStore<Name extends string, State, P extends Path<State>>(name: StoreDefinition<Name, State>, path: P): StoreSnapshot$1<PathValue<State, P>> | null;
|
|
@@ -19,14 +20,20 @@ declare function useStore<Name extends string, State, R>(name: StoreKey<Name, St
|
|
|
19
20
|
declare function useStore<Name extends StoreName, P extends Path<StateFor<Name>>>(name: Name, path: P): StoreSnapshot$1<PathValue<StateFor<Name>, P>> | null;
|
|
20
21
|
declare function useStore<Name extends StoreName>(name: Name, path?: undefined): StoreSnapshot$1<StateFor<Name>> | null;
|
|
21
22
|
declare function useStore<Name extends StoreName, R>(name: Name, selector: (state: StoreSnapshot$1<StateFor<Name>>) => R, equalityFn?: (a: R, b: R) => boolean): R | null;
|
|
23
|
+
declare function useStore<Name extends string>(name: Exclude<Name, StoreName>, path: string): unknown;
|
|
24
|
+
declare function useStore<Name extends string>(name: Exclude<Name, StoreName>, path?: undefined): unknown;
|
|
25
|
+
declare function useStore<Name extends string, R>(name: Exclude<Name, StoreName>, selector: (state: unknown) => R, equalityFn?: (a: R, b: R) => boolean): R | null;
|
|
22
26
|
declare function useStoreField<Name extends string, State, P extends Path<State>>(storeName: StoreDefinition<Name, State> | StoreKey<Name, State>, field: P): StoreSnapshot$1<PathValue<State, P>> | null;
|
|
23
27
|
declare function useStoreField<Name extends StoreName, P extends Path<StateFor<Name>>>(storeName: Name, field: P): StoreSnapshot$1<PathValue<StateFor<Name>, P>> | null;
|
|
28
|
+
declare function useStoreField<Name extends string>(storeName: Exclude<Name, StoreName>, field: string): unknown;
|
|
24
29
|
declare function useSelector<Name extends string, State, R>(storeName: StoreDefinition<Name, State> | StoreKey<Name, State>, selectorFn: (state: StoreSnapshot$1<State>) => R, equalityFn?: (a: R, b: R) => boolean): R | null;
|
|
25
30
|
declare function useSelector<Name extends StoreName, R>(storeName: Name, selectorFn: (state: StoreSnapshot$1<StateFor<Name>>) => R, equalityFn?: (a: R, b: R) => boolean): R | null;
|
|
31
|
+
declare function useSelector<Name extends string, R>(storeName: Exclude<Name, StoreName>, selectorFn: (state: unknown) => R, equalityFn?: (a: R, b: R) => boolean): R | null;
|
|
26
32
|
declare function useStoreStatic<Name extends string, State, P extends Path<State>>(name: StoreDefinition<Name, State> | StoreKey<Name, State>, path: P): StoreSnapshot$1<PathValue<State, P>> | null;
|
|
27
33
|
declare function useStoreStatic<Name extends string, State>(name: StoreDefinition<Name, State> | StoreKey<Name, State>, path?: undefined): StoreSnapshot$1<State> | null;
|
|
28
34
|
declare function useStoreStatic<Name extends StoreName, P extends Path<StateFor<Name>>>(name: Name, path: P): StoreSnapshot$1<PathValue<StateFor<Name>, P>> | null;
|
|
29
35
|
declare function useStoreStatic<Name extends StoreName>(name: Name, path?: undefined): StoreSnapshot$1<StateFor<Name>> | null;
|
|
36
|
+
declare function useStoreStatic<Name extends string>(name: Exclude<Name, StoreName>, path?: string): unknown;
|
|
30
37
|
|
|
31
38
|
type AsyncStoreState<T = unknown> = {
|
|
32
39
|
data: T | null;
|
package/dist/react/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {a as a$1,b as b$1}from'../chunk-
|
|
2
|
-
Component will update automatically when createStore("${e}") is called.`));},he=(e,t,
|
|
3
|
-
Prefer useSelector/useStoreField for better performance.`));},
|
|
1
|
+
import {a as a$1,b as b$1}from'../chunk-LWUT37FW.js';import {d,c}from'../chunk-E33L4MII.js';import {b}from'../chunk-BWNLQKTY.js';import {T as T$1,U as U$1,q,w as w$1,o}from'../chunk-X2MKRN7O.js';import {a,W,I,w,H,M as M$1,O,J as J$1,P,_}from'../chunk-6IBJ7CIK.js';import'../chunk-PHE2BCFG.js';import'../chunk-4C666HHU.js';import le,{createContext,useRef,useCallback,useSyncExternalStore,useEffect,useMemo,useContext}from'react';var G=createContext(null),fe=({value:e,children:t})=>le.createElement(G.Provider,{value:e},t),h=()=>useContext(G);var K=new Set,U=new Set,E=false,J=e=>K.has(e),Q=e=>{e&&K.add(e);},X=e=>U.has(e),Z=e=>{e&&U.add(e);},de=()=>{K.clear();},ge=()=>{U.clear();},ee=()=>E,te=()=>{E=true;},ye=()=>{E=false;};a("hooks.broad-warning",de,70);a("hooks.missing-warning",ge,80);a("hooks.loose-warning",ye,90);var oe=(e,t)=>t?_(e,t)??null:e,se=()=>({hasValue:false,storeName:"",snapshot:void 0,selector:void 0,value:null}),ae=(e,t,o,n,s)=>{if(t==null||!o.current)return s.current={hasValue:true,storeName:e,snapshot:t,selector:o.current,value:null},null;let a=o.current,r=s.current;if(r.hasValue&&r.storeName===e&&r.snapshot===t&&r.selector===a)return r.value;let i=a(t);return r.hasValue&&r.storeName===e&&n.current(i,r.value)?(r.snapshot=t,r.selector=a,r.value):(r.hasValue=true,r.storeName=e,r.snapshot=t,r.selector=a,r.value=i,i)},j=e=>{o(e)||X(e)||(Z(e),O(`useStore("${e}") - store not found yet.
|
|
2
|
+
Component will update automatically when createStore("${e}") is called.`));},he=(e,t,o)=>{t||o||J(e)||(Q(e),P(`useStore("${e}") without a selector/path subscribes to the entire store and may re-render on every change.
|
|
3
|
+
Prefer useSelector/useStoreField for better performance.`));},xe=(e,t)=>{M$1()&&(J$1().acknowledgeLooseTypes||ee()||typeof e=="string"&&(te(),O(`useStore("${t}") - store name is untyped.
|
|
4
4
|
Extend StoreStateMap for full type safety and path inference.
|
|
5
|
-
See: https://stroid.dev/docs/strict-mode`)));};function T(e,t,
|
|
6
|
-
export{fe as RegistryScope,
|
|
5
|
+
See: https://stroid.dev/docs/strict-mode`)));};function T(e,t,o=Object.is){let n=typeof e=="string"?e:e.name,s=typeof t=="function",a=typeof t=="string"?t:void 0,r=s?t:void 0,i=h()??I(w()),S=useRef(r),c=useRef(o),d=useRef(se()),l=useRef(false),R=useRef(r);S.current=r,c.current=o;let w$1=useCallback(p=>ae(n,p,S,c,d),[n]),m=useCallback(p=>H(i,()=>s?b(n,V=>S.current(V),(V,ce)=>c.current(V,ce),p):T$1(n,()=>p())),[i,n,s]),x=useCallback(()=>H(i,()=>{let p=U$1(n);return xe(e,n),j(n),he(n,s,a),s?w$1(p):oe(p,a)}),[i,n,s,a,w$1,e]),D=useSyncExternalStore(m,x,x);return useEffect(()=>{if(M$1()&&s){let p=R.current;p&&p!==r&&!l.current&&(l.current=true,O(`useStore("${n}") selector was recreated between renders. This can cause extra selector work and reduce selector cache reuse. Wrap the selector in useCallback or define it outside the component.`)),R.current=r;}},[n,s,a,r]),D}function A(e,t){let o=typeof e=="string"?e:e.name;return T(o,t)}function Ne(e,t,o=W){let n=typeof e=="string"?e:e.name,s=h()??I(w()),a=useRef(t),r=useRef(o),i=useRef(se()),S=useRef(false),c=useRef(t);a.current=t,r.current=o;let d=useCallback(m=>ae(n,m,a,r,i),[n]),l=useCallback(()=>H(s,()=>{let m=U$1(n);return j(n),d(m)}),[s,n,d]),R=useCallback(m=>H(s,()=>b(n,x=>a.current(x),(x,D)=>r.current(x,D),()=>m())),[s,n]),w$1=useSyncExternalStore(R,l,l);return useEffect(()=>{if(!M$1())return;let m=c.current;m&&m!==t&&!S.current&&(S.current=true,O(`useSelector("${n}") selector was recreated between renders. Wrap it in useCallback or define it outside the component to reduce selector churn and preserve selector cache reuse.`)),c.current=t;},[n,t]),w$1}function Re(e,t){let o=typeof e=="string"?e:e.name,n=h()??I(w()),s=H(n,()=>{let a=U$1(o);return j(o),a});return s==null?null:oe(s,t)}function M(e){let t=typeof e=="string"?q(e):e,o=T(t);return {data:o?.data??null,loading:o?.loading??false,revalidating:o?.revalidating??false,error:o?.error??null,status:o?.status??"idle",isEmpty:o?.data==null&&!o?.loading&&!o?.error}}var ue=e=>{let t=e?.target;return t?t.type==="checkbox"?!!t.checked:t.value:e};function Pe(e,t){let o=h()??I(w());if(typeof e=="string"){let i=t,S=A(e,i),c=useCallback(d=>{let l=ue(d);H(o,()=>{w$1(e,i,l);});},[o,e,i]);return {value:S,onChange:c}}let n=t,s=e,a=A(s,n),r=useCallback(i=>{let S=ue(i);H(o,()=>{w$1(s,n,S);});},[o,s,n]);return {value:a,onChange:r}}var we={};function be(e,t,o){let n=h()??I(w()),s=o??we,a=typeof e=="string"?e:e.name,r=useMemo(()=>typeof e=="string"?q(e):e,[e]),i=M(r),S=i.loading||i.status==="idle",c$1=s.cacheKey?`${a}:${s.cacheKey}`:a,d$1=useMemo(()=>{if(!S)return null;let l=H(n,()=>d()[c$1]?.promise);return l||(t!==void 0?H(n,()=>a$1(r,t,s)):H(n,()=>c())[a]?H(n,()=>b$1(r)):null)},[n,c$1,t,r,a,s,S]);if(d$1)throw d$1;if(i.error)throw new Error(i.error);return i.data}
|
|
6
|
+
export{fe as RegistryScope,M as useAsyncStore,be as useAsyncStoreSuspense,Pe as useFormStore,Ne as useSelector,T as useStore,A as useStoreField,Re as useStoreStatic};//# sourceMappingURL=index.js.map
|
|
7
7
|
//# sourceMappingURL=index.js.map
|
package/dist/registry.d.ts
CHANGED
|
@@ -23,11 +23,22 @@ type AsyncStateAdapter = (ctx: {
|
|
|
23
23
|
name: string;
|
|
24
24
|
prev: unknown;
|
|
25
25
|
next: AsyncStateSnapshot;
|
|
26
|
-
set: (value: unknown | ((draft:
|
|
26
|
+
set: (value: unknown | ((draft: unknown) => void)) => void;
|
|
27
27
|
}) => void;
|
|
28
28
|
type WarnCategory = "noSignal" | "shape" | "autoCreate" | "mutableResult";
|
|
29
|
-
type
|
|
30
|
-
|
|
29
|
+
type StoreCleanupBucket = {
|
|
30
|
+
store?: Set<() => void>;
|
|
31
|
+
revalidate?: Set<() => void>;
|
|
32
|
+
};
|
|
33
|
+
type AsyncMetricsSnapshot = {
|
|
34
|
+
cacheHits: number;
|
|
35
|
+
cacheMisses: number;
|
|
36
|
+
dedupes: number;
|
|
37
|
+
requests: number;
|
|
38
|
+
failures: number;
|
|
39
|
+
avgMs: number;
|
|
40
|
+
lastMs: number;
|
|
41
|
+
};
|
|
31
42
|
interface FetchOptions {
|
|
32
43
|
transform?: (result: unknown) => unknown;
|
|
33
44
|
onSuccess?: (data: unknown) => void;
|
|
@@ -101,18 +112,15 @@ type AsyncRegistry = {
|
|
|
101
112
|
};
|
|
102
113
|
ratePruneTimer: ReturnType<typeof setTimeout> | null;
|
|
103
114
|
warnedOnce: Map<WarnCategory, Set<string>>;
|
|
104
|
-
storeCleanups:
|
|
115
|
+
storeCleanups: Map<string, StoreCleanupBucket>;
|
|
105
116
|
revalidateKeys: Set<string>;
|
|
106
117
|
revalidateHandlers: Record<string, () => void>;
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
avgMs: number;
|
|
114
|
-
lastMs: number;
|
|
115
|
-
};
|
|
118
|
+
slotOwners: Map<string, string>;
|
|
119
|
+
slotsByStore: Map<string, Set<string>>;
|
|
120
|
+
cachePruneCounters: Map<string, number>;
|
|
121
|
+
usageErrorEmissions: Map<string, number>;
|
|
122
|
+
asyncMetrics: AsyncMetricsSnapshot;
|
|
123
|
+
asyncMetricsByStore: Map<string, AsyncMetricsSnapshot>;
|
|
116
124
|
};
|
|
117
125
|
|
|
118
|
-
export type { AsyncRegistry as A, FetchOptions as F,
|
|
126
|
+
export type { AsyncRegistry as A, FetchOptions as F, AsyncMetricsSnapshot as a, AsyncStateAdapter as b, AsyncStateSnapshot as c };
|
package/dist/runtime-admin.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export{a as clearAllStores,b as clearStores}from'./chunk-
|
|
1
|
+
export{a as clearAllStores,b as clearStores}from'./chunk-WXJ3IREA.js';import'./chunk-E33L4MII.js';import'./chunk-X2MKRN7O.js';import'./chunk-6IBJ7CIK.js';import'./chunk-PHE2BCFG.js';import'./chunk-4C666HHU.js';//# sourceMappingURL=runtime-admin.js.map
|
|
2
2
|
//# sourceMappingURL=runtime-admin.js.map
|