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.
Files changed (150) hide show
  1. package/CHANGELOG.md +148 -34
  2. package/README.md +124 -17
  3. package/dist/async-internal.d.ts +30 -0
  4. package/dist/async.d.ts +7 -12
  5. package/dist/async.js +1 -1
  6. package/dist/chunk-4C666HHU.js +2 -0
  7. package/dist/chunk-4D6OA3DD.js +2 -0
  8. package/dist/chunk-6IBJ7CIK.js +14 -0
  9. package/dist/chunk-BWNLQKTY.js +2 -0
  10. package/dist/chunk-E33L4MII.js +2 -0
  11. package/dist/chunk-FSNVSMAV.js +2 -0
  12. package/dist/chunk-GZQGU64H.js +2 -0
  13. package/dist/chunk-LWUT37FW.js +13 -0
  14. package/dist/chunk-NFT6AZXY.js +2 -0
  15. package/dist/chunk-PHE2BCFG.js +2 -0
  16. package/dist/chunk-SF6EP56S.js +2 -0
  17. package/dist/chunk-WE3ZR6OG.js +2 -0
  18. package/dist/chunk-WXJ3IREA.js +2 -0
  19. package/dist/chunk-X2MKRN7O.js +14 -0
  20. package/dist/chunk-Y54SMROI.js +2 -0
  21. package/dist/computed.d.ts +6 -5
  22. package/dist/computed.js +1 -1
  23. package/dist/core-internal.d.ts +23 -0
  24. package/dist/core.d.ts +3 -2
  25. package/dist/core.js +1 -1
  26. package/dist/devtools-internal.d.ts +26 -0
  27. package/dist/devtools.d.ts +4 -25
  28. package/dist/devtools.js +1 -1
  29. package/dist/feature.d.ts +9 -2
  30. package/dist/feature.js +1 -1
  31. package/dist/fetch-4RH6MPY3.js +2 -0
  32. package/dist/graph-D28.d.ts +20 -0
  33. package/dist/helpers.d.ts +2 -1
  34. package/dist/helpers.js +1 -1
  35. package/dist/index-internal.d.ts +19 -19
  36. package/dist/index.d.cts +40 -22
  37. package/dist/index.d.ts +40 -22
  38. package/dist/index.js +1 -1
  39. package/dist/install.d.ts +16 -4
  40. package/dist/install.js +1 -1
  41. package/dist/metrics.d.ts +13 -0
  42. package/dist/persist.d.ts +3 -1
  43. package/dist/persist.js +1 -1
  44. package/dist/psr.d.ts +7 -8
  45. package/dist/psr.js +1 -1
  46. package/dist/query.d.ts +17 -0
  47. package/dist/query.js +2 -0
  48. package/dist/react/index.d.ts +10 -3
  49. package/dist/react/index.js +5 -5
  50. package/dist/registry.d.ts +22 -14
  51. package/dist/runtime-admin.js +1 -1
  52. package/dist/runtime-tools.d.ts +38 -65
  53. package/dist/runtime-tools.js +1 -1
  54. package/dist/selectors.d.ts +1 -1
  55. package/dist/selectors.js +1 -1
  56. package/dist/server/portable.d.ts +27 -0
  57. package/dist/server/portable.js +2 -0
  58. package/dist/server.d.ts +9 -20
  59. package/dist/server.js +1 -1
  60. package/dist/shared.d.ts +36 -0
  61. package/dist/store-registry.d.ts +3 -1
  62. package/dist/sync.d.ts +10 -1
  63. package/dist/sync.js +1 -1
  64. package/dist/testing.d.ts +1 -0
  65. package/dist/testing.js +1 -1
  66. package/dist/tsdoc-metadata.json +11 -0
  67. package/dist/types-internal-2.d.ts +168 -0
  68. package/dist/{computed-types.d.ts → types-internal-3.d.ts} +1 -1
  69. package/dist/{options.d.ts → types-internal.d.ts} +25 -9
  70. package/dist/types.d.ts +12 -2
  71. package/package.json +80 -26
  72. package/dist/chunk-645IESIU.js +0 -2
  73. package/dist/chunk-6ELWGQ4Q.js +0 -2
  74. package/dist/chunk-BW32TJGE.js +0 -13
  75. package/dist/chunk-FOQKGHPS.js +0 -26
  76. package/dist/chunk-KQCSFGHJ.js +0 -2
  77. package/dist/chunk-M2NJVI36.js +0 -2
  78. package/dist/chunk-PVATWAY4.js +0 -2
  79. package/dist/chunk-X3JR32JD.js +0 -2
  80. package/dist/computed-types.js +0 -2
  81. package/dist/types/adapters/options.d.ts +0 -335
  82. package/dist/types/async/cache.d.ts +0 -40
  83. package/dist/types/async/clone.d.ts +0 -10
  84. package/dist/types/async/errors.d.ts +0 -3
  85. package/dist/types/async/fetch.d.ts +0 -37
  86. package/dist/types/async/inflight.d.ts +0 -30
  87. package/dist/types/async/rate.d.ts +0 -5
  88. package/dist/types/async/registry.d.ts +0 -117
  89. package/dist/types/async/request.d.ts +0 -11
  90. package/dist/types/async/retry.d.ts +0 -10
  91. package/dist/types/async.d.ts +0 -10
  92. package/dist/types/computed/computed-graph.d.ts +0 -33
  93. package/dist/types/computed/index.d.ts +0 -21
  94. package/dist/types/computed/types.d.ts +0 -40
  95. package/dist/types/config.d.ts +0 -10
  96. package/dist/types/core/index.d.ts +0 -11
  97. package/dist/types/core/lifecycle-hooks.d.ts +0 -16
  98. package/dist/types/core/runtime-patch.d.ts +0 -67
  99. package/dist/types/core/store-admin-impl.d.ts +0 -9
  100. package/dist/types/core/store-admin.d.ts +0 -9
  101. package/dist/types/core/store-core.d.ts +0 -13
  102. package/dist/types/core/store-create.d.ts +0 -16
  103. package/dist/types/core/store-hydrate-impl.d.ts +0 -35
  104. package/dist/types/core/store-hydrate.d.ts +0 -9
  105. package/dist/types/core/store-lifecycle/hooks.d.ts +0 -20
  106. package/dist/types/core/store-lifecycle/identity.d.ts +0 -23
  107. package/dist/types/core/store-lifecycle/registry.d.ts +0 -54
  108. package/dist/types/core/store-lifecycle/types.d.ts +0 -67
  109. package/dist/types/core/store-lifecycle/validation.d.ts +0 -53
  110. package/dist/types/core/store-name.d.ts +0 -28
  111. package/dist/types/core/store-notify.d.ts +0 -13
  112. package/dist/types/core/store-read.d.ts +0 -18
  113. package/dist/types/core/store-registry.d.ts +0 -115
  114. package/dist/types/core/store-replace-impl.d.ts +0 -11
  115. package/dist/types/core/store-replace.d.ts +0 -9
  116. package/dist/types/core/store-set-impl.d.ts +0 -13
  117. package/dist/types/core/store-set.d.ts +0 -9
  118. package/dist/types/core/store-shared/core.d.ts +0 -13
  119. package/dist/types/core/store-shared/notify.d.ts +0 -12
  120. package/dist/types/core/store-transaction.d.ts +0 -28
  121. package/dist/types/core/store-write-shared.d.ts +0 -25
  122. package/dist/types/core/store-write.d.ts +0 -13
  123. package/dist/types/features/feature-registry.d.ts +0 -91
  124. package/dist/types/features/lifecycle.d.ts +0 -40
  125. package/dist/types/index.d.ts +0 -17
  126. package/dist/types/integrations/query.d.ts +0 -8
  127. package/dist/types/internals/computed-order.d.ts +0 -3
  128. package/dist/types/internals/config.d.ts +0 -116
  129. package/dist/types/internals/diagnostics.d.ts +0 -21
  130. package/dist/types/internals/reporting.d.ts +0 -9
  131. package/dist/types/internals/store-admin.d.ts +0 -7
  132. package/dist/types/internals/store-ops.d.ts +0 -13
  133. package/dist/types/internals/test-reset.d.ts +0 -2
  134. package/dist/types/internals/write-context.d.ts +0 -20
  135. package/dist/types/notification/delivery.d.ts +0 -3
  136. package/dist/types/notification/index.d.ts +0 -10
  137. package/dist/types/notification/metrics.d.ts +0 -12
  138. package/dist/types/notification/priority.d.ts +0 -9
  139. package/dist/types/notification/scheduler.d.ts +0 -11
  140. package/dist/types/notification/snapshot.d.ts +0 -8
  141. package/dist/types/runtime-admin/index.d.ts +0 -2
  142. package/dist/types/runtime-tools/index.d.ts +0 -63
  143. package/dist/types/store.d.ts +0 -16
  144. package/dist/types/types/utility.d.ts +0 -17
  145. package/dist/types/utils/clone.d.ts +0 -4
  146. package/dist/types/utils/devfreeze.d.ts +0 -2
  147. package/dist/types/utils/hash.d.ts +0 -8
  148. package/dist/types/utils/path.d.ts +0 -5
  149. package/dist/types/utils/validation.d.ts +0 -14
  150. 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, W as WriteResult, S as StoreValue, d as StoreName } from './types.js';
2
- export { h as HydrationFailure, P as PartialDeep, i as Path, j as PathValue, e as StateFor } from './types.js';
3
- import { S as StoreOptions, b as SnapshotMode, M as MiddlewareCtx, a as StoreValue$1 } from './options.js';
4
- export { F as FeatureOptions, c as FeatureOptionsMap, P as PersistOptions, d as SyncOptions } from './options.js';
5
- export { c as createStore, a as createStoreStrict, d as deleteStore, g as getMetrics, b as getStore, h as hasStore, r as resetStore, s as setStore } from './index-internal.js';
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 { getAsyncMetrics } from './async.js';
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
- import './feature.js';
13
- import './computed-types.js';
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: any, ...rest: any[]) => any;
65
- get: (name: any, ...rest: any[]) => any;
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
- type StoreTarget = StoreDefinition<string, unknown> | StoreKey<string, unknown> | StoreName;
159
- declare const reactQueryKey: (storeName: StoreTarget, cacheKey?: string | number) => (string | number)[];
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, StoreName, StoreOptions, StoreStateMap, StoreValue, StrictStoreMap, WriteResult, configureStroid, hydrateStores, namespace, query as queryIntegrations, setStoreBatch, store };
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, W as WriteResult, S as StoreValue, d as StoreName } from './types.js';
2
- export { h as HydrationFailure, P as PartialDeep, i as Path, j as PathValue, e as StateFor } from './types.js';
3
- import { S as StoreOptions, b as SnapshotMode, M as MiddlewareCtx, a as StoreValue$1 } from './options.js';
4
- export { F as FeatureOptions, c as FeatureOptionsMap, P as PersistOptions, d as SyncOptions } from './options.js';
5
- export { c as createStore, a as createStoreStrict, d as deleteStore, g as getMetrics, b as getStore, h as hasStore, r as resetStore, s as setStore } from './index-internal.js';
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 { getAsyncMetrics } from './async.js';
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
- import './feature.js';
13
- import './computed-types.js';
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: any, ...rest: any[]) => any;
65
- get: (name: any, ...rest: any[]) => any;
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
- type StoreTarget = StoreDefinition<string, unknown> | StoreKey<string, unknown> | StoreName;
159
- declare const reactQueryKey: (storeName: StoreTarget, cacheKey?: string | number) => (string | number)[];
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, StoreName, StoreOptions, StoreStateMap, StoreValue, StrictStoreMap, WriteResult, configureStroid, hydrateStores, namespace, query as queryIntegrations, setStoreBatch, store };
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-YU5GMPCC.js';export{g as findColdStores,h as getStoreHealth}from'./chunk-M2NJVI36.js';import {a as a$1}from'./chunk-BW32TJGE.js';export{d as getAsyncMetrics}from'./chunk-BW32TJGE.js';import'./chunk-645IESIU.js';import'./chunk-6ELWGQ4Q.js';export{m as configureStroid,W as createComputed,K as createStore,L as createStoreStrict,Y as deleteComputed,ra as deleteStore,O as getMetrics,M as getStore,N as hasStore,qa as hydrateStores,X as invalidateComputed,Z as isComputedStore,Q as namespace,sa as resetStore,U as setStore,ma as setStoreBatch,P as store}from'./chunk-FOQKGHPS.js';import {a}from'./chunk-KQCSFGHJ.js';var h={};a(h,{createReactQueryFetcher:()=>I,createSwrFetcher:()=>j,reactQueryKey:()=>m,swrKey:()=>R});var H=e=>typeof e=="string"?e:e.name,m=(e,t)=>{let r=H(e);return t!==void 0?["stroid",r,t]:["stroid",r]},I=(e,t,r={})=>async()=>typeof e=="string"?a$1(e,t,r):a$1(e,t,r),R=m,j=(e,t,r={})=>async()=>typeof e=="string"?a$1(e,t,r):a$1(e,t,r);export{h as queryIntegrations};//# sourceMappingURL=index.js.map
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
- declare const installPersist: () => void;
2
- declare const installSync: () => void;
3
- declare const installDevtools: () => void;
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, installDevtools, installPersist, installSync };
18
+ export { installAllFeatures };
package/dist/install.js CHANGED
@@ -1,2 +1,2 @@
1
- export{d as installAllFeatures,c as installDevtools,a as installPersist,b as installSync}from'./chunk-PVATWAY4.js';import'./chunk-FOQKGHPS.js';import'./chunk-KQCSFGHJ.js';//# sourceMappingURL=install.js.map
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
@@ -1 +1,3 @@
1
- export { installPersist } from './install.js';
1
+ declare const installPersist: () => void;
2
+
3
+ export { installPersist };
package/dist/persist.js CHANGED
@@ -1,2 +1,2 @@
1
- export{a as installPersist}from'./chunk-PVATWAY4.js';import'./chunk-FOQKGHPS.js';import'./chunk-KQCSFGHJ.js';//# sourceMappingURL=persist.js.map
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 { evaluateComputed, getComputedDescriptor, getStoreMeta, listStores } from './runtime-tools.js';
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 { W as WriteResult, S as StoreValue, a as StoreDefinition, b as StoreKey } from './types.js';
5
- import { RuntimeGraph } from './computed-types.js';
6
- export { ComputedClassification, ComputedDescriptor, RuntimeEdgeType, RuntimeGraphEdge, RuntimeGraphGranularity, RuntimeGraphNode, RuntimeNodeId, RuntimeNodeType } from './computed-types.js';
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 './options.js';
9
+ import './types-internal.js';
9
10
  import './utility.js';
10
- import './async.js';
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-M2NJVI36.js';export{n as evaluateComputed,m as getComputedDescriptor,b as getStoreMeta,a as listStores}from'./chunk-M2NJVI36.js';import'./chunk-BW32TJGE.js';import'./chunk-6ELWGQ4Q.js';import {pa,na,N,ba,ja,ka,la,G,y as y$1,T as T$1,U as U$1,ga}from'./chunk-FOQKGHPS.js';import'./chunk-KQCSFGHJ.js';var T={ok:false,reason:"invalid-args"},J={reason:"unsupported-op"};var Q=["set","merge","delete","insert"],X=["setStore","replaceStore","resetStore","hydrateStores"],m=e=>G(e),j=e=>!!e?.options.persist?.encryptAsync||!!e?.options.persist?.decryptAsync||e?.options.persist?.checksum==="sha256",Y=e=>!!e?.options.sync||j(e),Z=e=>!!e?.options.persist||!!e?.options.sync||e?.options.devtools===true,ee=(e,t)=>JSON.stringify([e,t,[]]),te=e=>ee("leaf",e),U=(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},_=(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},y=e=>Array.from(new Set(e)).sort((t,r)=>t.localeCompare(r)),re=e=>{if(!e)return [];let t=m$1(e);return t?[t.id]:[te(e)]},ne=(e,t)=>{if(!e)return y(a());let r=m$1(e);if(!r)return [e];let n=new Map(t.nodes.map(u=>[u.id,u])),o=U(t,"reverse"),s=_([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?y(a$1):[e]},oe=(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 y(r);let n=re(e),o=U(t,"forward"),s=_(n,o);return y(Array.from(s).filter(a=>r.has(a)))},p=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),se=e=>typeof e=="string"&&Q.includes(e),ae=e=>typeof e=="string"&&X.includes(e),z=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},R=(e,t)=>e.ok?{ok:true}:c(e.reason,"failedPatchId"in e?e.failedPatchId??t:t),x=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),S=e=>typeof e=="number"?Number.isInteger(e)&&e>=0?e:null:/^(0|[1-9]\d*)$/.test(e)?Number(e):null,L=(e,t)=>{if(Array.isArray(e)){let n=S(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=S(t);if(n===null)return e;let o=[...e];return o[n]=r,o}return {...e,[String(t)]:r}},k=(e,t,r)=>{if(t.length===0)return {ok:false,reason:"unsupported-path-shape"};if(!Array.isArray(e)&&!x(e))return {ok:false,reason:"unsupported-path-shape"};let[n,...o]=t;if(o.length===0)return r(e,n);let s=L(e,n);if(!s.ok)return s;let a=k(s.value,o,r);return a.ok?{ok:true,value:H(e,n,a.value)}:a},ue=(e,t,r)=>x(r)?k(e,t,(n,o)=>{let s=L(n,o);return s.ok?x(s.value)?{ok:true,value:H(n,o,{...s.value,...r})}:{ok:false,reason:"unsupported-path-shape"}:s}):{ok:false,reason:"unsupported-path-shape"},ie=(e,t)=>k(e,t,(r,n)=>{if(Array.isArray(r)){let a=S(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}}),le=(e,t,r)=>k(e,t,(n,o)=>{if(!Array.isArray(n))return {ok:false,reason:"unsupported-path-shape"};let s=S(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}}),I=(e,t)=>{let r=e.id;if(!N(e.store))return c("not-found",r);let n=ba(),o=ga(e.store,n);if(o===void 0)return c("not-found",r);let s=t(o);return s.ok?R(T$1(e.store,s.value),r):c(s.reason,r)},W=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")||!se(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)||!ae(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 y$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},$=e=>e.op==="set"?e.path.length===0?R(T$1(e.store,e.value),e.id):R(U$1(e.store,e.path.map(t=>String(t)),e.value),e.id):e.op==="merge"?e.path.length===0?R(U$1(e.store,e.value),e.id):I(e,t=>ue(t,e.path,e.value)):e.op==="delete"?I(e,t=>ie(t,e.path)):e.op==="insert"?I(e,t=>le(t,e.path,e.value)):c(J.reason,e.id),de=e=>{let t=k$1(),n=ne(e,t).map(i=>({storeId:i,meta:b(i)})),o=oe(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`),j(f)&&u.add(`persist for "${i}" introduces async boundary work`);}),o.forEach(i=>{let f=s.get(i)?.storeId;if(!f)return;let q=a?.id===i||!e?"computed node":"downstream computed node";u.add(`${q} "${f}" is marked asyncBoundary`);});let l=n.some(({meta:i})=>!!i?.options.sync),d=o.length>0||n.some(({meta:i})=>Y(i)),B=n.some(({meta:i})=>Z(i))?"in-pipeline":"out-of-pipeline";return {simulationWindow:"pre-commit",executionModel:d?"async-boundary":"sync",effectScope:B,governanceMode:l?"observer":d?"bounded-governor":"full-governor",mutationAuthority:l?"shared":"exclusive",causalityBoundary:d?"async-boundary":"none",reasons:y(u)}},Pe=e=>pa(m(e)),ve=e=>pa(m(e)),Ae=(e,t)=>na(m(e),t),be=e=>N(m(e)),we=e=>{let t=W(e);return t?$(t):c(T.reason,z(e))},Ie=e=>{if(!Array.isArray(e))return T;if(e.length===0)return {ok:true};let t=[];for(let l of e){let d=W(l);if(!d)return c(T.reason,z(l));t.push(d);}let r=ba(),n=r.notify;n.batchDepth=Math.max(0,n.batchDepth+1),ja(r);let o=null,s=null,a=null,u;try{for(let l of t){u=l.id;let d=$(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=ka(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&&la(r);}return o||(s||a?c("validate",u):{ok:true})},Te=e=>de(e?m(e):void 0),xe=()=>k$1(),Be=()=>k$1();export{we as applyStorePatch,Ie as applyStorePatchesAtomic,xe as getComputedGraph,Be as getRuntimeGraph,Pe as getStoreSnapshot,ve as getStoreSnapshotNoTrack,Te as getTimingContract,be as hasStore,Ae as subscribeStore};//# sourceMappingURL=psr.js.map
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
@@ -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
@@ -0,0 +1,2 @@
1
+ export{a as reactQueryKey,b as swrKey}from'./chunk-FSNVSMAV.js';import'./chunk-4C666HHU.js';//# sourceMappingURL=query.js.map
2
+ //# sourceMappingURL=query.js.map
@@ -1,13 +1,14 @@
1
- import { a as StoreDefinition, b as StoreKey, d as StoreName, e as StateFor, i as Path, j as PathValue } from '../types.js';
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 '../options.js';
9
+ import '../types-internal.js';
9
10
  import '../runtime-patch.js';
10
- import '../computed-types.js';
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;
@@ -1,7 +1,7 @@
1
- import {a as a$1,b as b$1}from'../chunk-BW32TJGE.js';import {d as d$1,c}from'../chunk-6ELWGQ4Q.js';import {b}from'../chunk-X3JR32JD.js';import {a,w,k,d,j as j$1,na,oa,n,p,P,U as U$1,l,N,q,z}from'../chunk-FOQKGHPS.js';import'../chunk-KQCSFGHJ.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,j=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=()=>j,te=()=>{j=true;},ye=()=>{j=false;};a("hooks.broad-warning",de,70);a("hooks.missing-warning",ge,80);a("hooks.loose-warning",ye,90);var ne=(e,t)=>t?z(e,t)??null:e,se=()=>({hasValue:false,storeName:"",snapshot:void 0,selector:void 0,value:null}),ae=(e,t,n,r,s)=>{if(t==null||!n.current)return s.current={hasValue:true,storeName:e,snapshot:t,selector:n.current,value:null},null;let a=n.current,o=s.current;if(o.hasValue&&o.storeName===e&&o.snapshot===t&&o.selector===a)return o.value;let i=a(t);return o.hasValue&&o.storeName===e&&r.current(i,o.value)?(o.snapshot=t,o.selector=a,o.value):(o.hasValue=true,o.storeName=e,o.snapshot=t,o.selector=a,o.value=i,i)},M=e=>{N(e)||X(e)||(Z(e),p(`useStore("${e}") - store not found yet.
2
- Component will update automatically when createStore("${e}") is called.`));},he=(e,t,n)=>{t||n||J(e)||(Q(e),q(`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.`));},Re=(e,t)=>{n()&&(l().acknowledgeLooseTypes||ee()||typeof e=="string"&&(te(),p(`useStore("${t}") - store name is untyped.
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,n$1=Object.is){let r=typeof e=="string"?e:e.name,s=typeof t=="function",a=typeof t=="string"?t:void 0,o=s?t:void 0,i=h()??k(d()),S=useRef(o),c=useRef(n$1),d$1=useRef(se()),l=useRef(false),N=useRef(o);S.current=o,c.current=n$1;let b$1=useCallback(m=>ae(r,m,S,c,d$1),[r]),p$1=useCallback(m=>j$1(i,()=>s?b(r,V=>S.current(V),(V,ce)=>c.current(V,ce),m):na(r,()=>m())),[i,r,s]),R=useCallback(()=>j$1(i,()=>{let m=oa(r);return Re(e,r),M(r),he(r,s,a),s?b$1(m):ne(m,a)}),[i,r,s,a,b$1,e]),D=useSyncExternalStore(p$1,R,R);return useEffect(()=>{if(n()&&s){let m=N.current;m&&m!==o&&!l.current&&(l.current=true,p(`useStore("${r}") 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.`)),N.current=o;}},[r,s,a,o]),D}function A(e,t){return T(e,t)}function xe(e,t,n$1=w){let r=typeof e=="string"?e:e.name,s=h()??k(d()),a=useRef(t),o=useRef(n$1),i=useRef(se()),S=useRef(false),c=useRef(t);a.current=t,o.current=n$1;let d$1=useCallback(p=>ae(r,p,a,o,i),[r]),l=useCallback(()=>j$1(s,()=>{let p=oa(r);return M(r),d$1(p)}),[s,r,d$1]),N=useCallback(p=>j$1(s,()=>b(r,R=>a.current(R),(R,D)=>o.current(R,D),()=>p())),[s,r]),b$1=useSyncExternalStore(N,l,l);return useEffect(()=>{if(!n())return;let p$1=c.current;p$1&&p$1!==t&&!S.current&&(S.current=true,p(`useSelector("${r}") 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;},[r,t]),b$1}function Ne(e,t){let n=typeof e=="string"?e:e.name,r=h()??k(d()),s=j$1(r,()=>{let a=oa(n);return M(n),a});return s==null?null:ne(s,t)}function O(e){let t=typeof e=="string"?P(e):e,n=T(t);return {data:n?.data??null,loading:n?.loading??false,revalidating:n?.revalidating??false,error:n?.error??null,status:n?.status??"idle",isEmpty:n?.data==null&&!n?.loading&&!n?.error}}var ue=e=>{let t=e?.target;return t?t.type==="checkbox"?!!t.checked:t.value:e};function Pe(e,t){let n=h()??k(d());if(typeof e=="string"){let i=t,S=A(e,i),c=useCallback(d=>{let l=ue(d);j$1(n,()=>{U$1(e,i,l);});},[n,e,i]);return {value:S,onChange:c}}let r=t,s=e,a=A(s,r),o=useCallback(i=>{let S=ue(i);j$1(n,()=>{U$1(s,r,S);});},[n,s,r]);return {value:a,onChange:o}}var be={};function we(e,t,n){let r=h()??k(d()),s=n??be,a=typeof e=="string"?e:e.name,o=useMemo(()=>typeof e=="string"?P(e):e,[e]),i=O(o),S=i.loading||i.status==="idle",c$1=s.cacheKey?`${a}:${s.cacheKey}`:a,d$2=useMemo(()=>{if(!S)return null;let l=j$1(r,()=>d$1()[c$1]?.promise);return l||(t!==void 0?j$1(r,()=>a$1(o,t,s)):j$1(r,()=>c())[a]?j$1(r,()=>b$1(o)):null)},[r,c$1,t,o,a,s,S]);if(d$2)throw d$2;if(i.error)throw new Error(i.error);return i.data}
6
- export{fe as RegistryScope,O as useAsyncStore,we as useAsyncStoreSuspense,Pe as useFormStore,xe as useSelector,T as useStore,A as useStoreField,Ne as useStoreStatic};//# sourceMappingURL=index.js.map
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
@@ -23,11 +23,22 @@ type AsyncStateAdapter = (ctx: {
23
23
  name: string;
24
24
  prev: unknown;
25
25
  next: AsyncStateSnapshot;
26
- set: (value: unknown | ((draft: any) => void)) => void;
26
+ set: (value: unknown | ((draft: unknown) => void)) => void;
27
27
  }) => void;
28
28
  type WarnCategory = "noSignal" | "shape" | "autoCreate" | "mutableResult";
29
- type StoreCleanupKind = "store" | "revalidate";
30
- type StoreCleanupBucket = Partial<Record<StoreCleanupKind, Set<() => void>>>;
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: Record<string, StoreCleanupBucket>;
115
+ storeCleanups: Map<string, StoreCleanupBucket>;
105
116
  revalidateKeys: Set<string>;
106
117
  revalidateHandlers: Record<string, () => void>;
107
- asyncMetrics: {
108
- cacheHits: number;
109
- cacheMisses: number;
110
- dedupes: number;
111
- requests: number;
112
- failures: number;
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, AsyncStateAdapter as a, AsyncStateSnapshot as b };
126
+ export type { AsyncRegistry as A, FetchOptions as F, AsyncMetricsSnapshot as a, AsyncStateAdapter as b, AsyncStateSnapshot as c };
@@ -1,2 +1,2 @@
1
- export{a as clearAllStores,b as clearStores}from'./chunk-645IESIU.js';import'./chunk-6ELWGQ4Q.js';import'./chunk-FOQKGHPS.js';import'./chunk-KQCSFGHJ.js';//# sourceMappingURL=runtime-admin.js.map
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