stroid 0.0.4 → 0.1.1

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 (106) hide show
  1. package/CHANGELOG.md +136 -25
  2. package/README.md +514 -81
  3. package/dist/_tsup-dts-rollup.d.cts +2411 -0
  4. package/dist/_tsup-dts-rollup.d.ts +2411 -0
  5. package/dist/async.cjs +34 -0
  6. package/dist/async.cjs.map +1 -0
  7. package/dist/async.d.cts +9 -0
  8. package/dist/async.d.ts +9 -30
  9. package/dist/async.js +34 -1
  10. package/dist/async.js.map +1 -0
  11. package/dist/computed.cjs +13 -0
  12. package/dist/computed.cjs.map +1 -0
  13. package/dist/computed.d.cts +7 -0
  14. package/dist/computed.d.ts +7 -0
  15. package/dist/computed.js +13 -0
  16. package/dist/computed.js.map +1 -0
  17. package/dist/core.cjs +24 -0
  18. package/dist/core.cjs.map +1 -0
  19. package/dist/core.d.cts +15 -0
  20. package/dist/core.d.ts +15 -1
  21. package/dist/core.js +24 -1
  22. package/dist/core.js.map +1 -0
  23. package/dist/devtools.cjs +2 -0
  24. package/dist/devtools.cjs.map +1 -0
  25. package/dist/devtools.d.cts +5 -0
  26. package/dist/devtools.d.ts +5 -0
  27. package/dist/devtools.js +2 -0
  28. package/dist/devtools.js.map +1 -0
  29. package/dist/feature.cjs +2 -0
  30. package/dist/feature.cjs.map +1 -0
  31. package/dist/feature.d.cts +14 -0
  32. package/dist/feature.d.ts +14 -0
  33. package/dist/feature.js +2 -0
  34. package/dist/feature.js.map +1 -0
  35. package/dist/helpers.cjs +24 -0
  36. package/dist/helpers.cjs.map +1 -0
  37. package/dist/helpers.d.cts +3 -0
  38. package/dist/helpers.d.ts +3 -0
  39. package/dist/helpers.js +24 -0
  40. package/dist/helpers.js.map +1 -0
  41. package/dist/index.cjs +35 -0
  42. package/dist/index.cjs.map +1 -0
  43. package/dist/index.d.cts +33 -0
  44. package/dist/index.d.ts +33 -3
  45. package/dist/index.js +35 -1
  46. package/dist/index.js.map +1 -0
  47. package/dist/install.cjs +2 -0
  48. package/dist/install.cjs.map +1 -0
  49. package/dist/install.d.cts +4 -0
  50. package/dist/install.d.ts +4 -0
  51. package/dist/install.js +2 -0
  52. package/dist/install.js.map +1 -0
  53. package/dist/persist.cjs +2 -0
  54. package/dist/persist.cjs.map +1 -0
  55. package/dist/persist.d.cts +1 -0
  56. package/dist/persist.d.ts +1 -0
  57. package/dist/persist.js +2 -0
  58. package/dist/persist.js.map +1 -0
  59. package/dist/react.cjs +36 -0
  60. package/dist/react.cjs.map +1 -0
  61. package/dist/react.d.cts +7 -0
  62. package/dist/react.d.ts +7 -20
  63. package/dist/react.js +36 -1
  64. package/dist/react.js.map +1 -0
  65. package/dist/runtime-admin.cjs +2 -0
  66. package/dist/runtime-admin.cjs.map +1 -0
  67. package/dist/runtime-admin.d.cts +2 -0
  68. package/dist/runtime-admin.d.ts +2 -0
  69. package/dist/runtime-admin.js +2 -0
  70. package/dist/runtime-admin.js.map +1 -0
  71. package/dist/runtime-tools.cjs +4 -0
  72. package/dist/runtime-tools.cjs.map +1 -0
  73. package/dist/runtime-tools.d.cts +9 -0
  74. package/dist/runtime-tools.d.ts +9 -0
  75. package/dist/runtime-tools.js +4 -0
  76. package/dist/runtime-tools.js.map +1 -0
  77. package/dist/selectors.cjs +2 -0
  78. package/dist/selectors.cjs.map +1 -0
  79. package/dist/selectors.d.cts +2 -0
  80. package/dist/selectors.d.ts +2 -0
  81. package/dist/selectors.js +2 -0
  82. package/dist/selectors.js.map +1 -0
  83. package/dist/server.cjs +12 -0
  84. package/dist/server.cjs.map +1 -0
  85. package/dist/server.d.cts +2 -0
  86. package/dist/server.d.ts +2 -0
  87. package/dist/server.js +12 -0
  88. package/dist/server.js.map +1 -0
  89. package/dist/sync.cjs +2 -0
  90. package/dist/sync.cjs.map +1 -0
  91. package/dist/sync.d.cts +1 -0
  92. package/dist/sync.d.ts +1 -0
  93. package/dist/sync.js +2 -0
  94. package/dist/sync.js.map +1 -0
  95. package/dist/testing.cjs +24 -0
  96. package/dist/testing.cjs.map +1 -0
  97. package/dist/testing.d.cts +4 -0
  98. package/dist/testing.d.ts +4 -16
  99. package/dist/testing.js +24 -1
  100. package/dist/testing.js.map +1 -0
  101. package/package.json +86 -6
  102. package/dist/chunk-5F2FD6DX.js +0 -17
  103. package/dist/chunk-G6JMMJYH.js +0 -5
  104. package/dist/chunk-JBYLHJKN.js +0 -3
  105. package/dist/chunk-K6QIWMMW.js +0 -1
  106. package/dist/core-CKzRwVaY.d.ts +0 -213
@@ -0,0 +1,2411 @@
1
+ declare const __DEV__: boolean;
2
+ export { __DEV__ }
3
+ export { __DEV__ as __DEV___alias_1 }
4
+
5
+ export declare const absorbSyncClock: (name: string, incomingClock: number, syncClocks: SyncClocks) => number;
6
+
7
+ declare const applyFeatureState: (name: string, value: StoreValue, updatedAtMs?: number) => void;
8
+ export { applyFeatureState }
9
+ export { applyFeatureState as applyFeatureState_alias_1 }
10
+
11
+ export declare const applyRedactor: ({ data, redactor, deepClone, }: {
12
+ data: StoreValue_alias_4;
13
+ redactor?: (state: StoreValue_alias_4) => StoreValue_alias_4;
14
+ deepClone: <T>(value: T) => T;
15
+ }) => StoreValue_alias_4;
16
+
17
+ export declare type AsyncCloneMode = "none" | "shallow" | "deep";
18
+
19
+ export declare type AsyncDataFor<State> = State extends {
20
+ data: infer T;
21
+ } ? T : unknown;
22
+
23
+ export declare const asyncMetrics: {
24
+ cacheHits: number;
25
+ cacheMisses: number;
26
+ dedupes: number;
27
+ requests: number;
28
+ failures: number;
29
+ avgMs: number;
30
+ lastMs: number;
31
+ };
32
+
33
+ export declare type AsyncRegistry = {
34
+ fetchRegistry: Record<string, {
35
+ kind: "url";
36
+ url: string;
37
+ options: FetchOptions;
38
+ } | {
39
+ kind: "factory";
40
+ factory: () => string | Promise<unknown>;
41
+ options: FetchOptions;
42
+ }>;
43
+ inflight: Partial<Record<string, InflightEntry_2>>;
44
+ requestVersion: Record<string, number>;
45
+ cacheMeta: Record<string, {
46
+ timestamp: number;
47
+ expiresAt: number | null;
48
+ data: unknown;
49
+ }>;
50
+ rateWindowStart: Record<string, number>;
51
+ rateCount: Record<string, number>;
52
+ ratePruneState: {
53
+ lastAt: number;
54
+ };
55
+ ratePruneTimer: ReturnType<typeof setTimeout> | null;
56
+ noSignalWarned: Set<string>;
57
+ shapeWarned: Set<string>;
58
+ autoCreateWarned: Set<string>;
59
+ mutableResultWarned: Set<string>;
60
+ cleanupSubs: Record<string, () => void>;
61
+ storeCleanupFns: Record<string, Set<() => void>>;
62
+ revalidateKeys: Set<string>;
63
+ revalidateHandlers: Record<string, () => void>;
64
+ asyncMetrics: {
65
+ cacheHits: number;
66
+ cacheMisses: number;
67
+ dedupes: number;
68
+ requests: number;
69
+ failures: number;
70
+ avgMs: number;
71
+ lastMs: number;
72
+ };
73
+ };
74
+
75
+ declare type AsyncStateAdapter = (ctx: {
76
+ name: string;
77
+ prev: unknown;
78
+ next: AsyncStateSnapshot;
79
+ set: (value: unknown | ((draft: any) => void)) => void;
80
+ }) => void;
81
+ export { AsyncStateAdapter }
82
+ export { AsyncStateAdapter as AsyncStateAdapter_alias_1 }
83
+ export { AsyncStateAdapter as AsyncStateAdapter_alias_2 }
84
+
85
+ /**
86
+ * @module async-registry
87
+ *
88
+ * LAYER: Module
89
+ * OWNS: Module-level behavior and exports for async-registry.
90
+ *
91
+ * Consumers: Internal imports and public API.
92
+ */
93
+ declare type AsyncStateSnapshot = {
94
+ data?: unknown;
95
+ loading: boolean;
96
+ error: string | null;
97
+ status: "idle" | "loading" | "success" | "error" | "aborted";
98
+ cached?: boolean;
99
+ revalidating?: boolean;
100
+ };
101
+ export { AsyncStateSnapshot }
102
+ export { AsyncStateSnapshot as AsyncStateSnapshot_alias_1 }
103
+ export { AsyncStateSnapshot as AsyncStateSnapshot_alias_2 }
104
+
105
+ export declare type AsyncStoreSnapshot<T = unknown> = AsyncStoreState<T> & {
106
+ isEmpty: boolean;
107
+ };
108
+
109
+ export declare type AsyncStoreState<T = unknown> = {
110
+ data: T | null;
111
+ loading: boolean;
112
+ revalidating?: boolean;
113
+ error: string | null;
114
+ status: "idle" | "loading" | "success" | "error" | "aborted";
115
+ };
116
+
117
+ export declare const autoCreateWarned: Set<string>;
118
+
119
+ declare interface BaseFeatureContext {
120
+ name: string;
121
+ options: NormalizedOptions;
122
+ getMeta: () => StoreFeatureMeta | undefined;
123
+ getStoreValue: () => StoreValue_alias_4;
124
+ getAllStores: () => Record<string, StoreValue_alias_4>;
125
+ getInitialState: () => StoreValue_alias_4;
126
+ hasStore: () => boolean;
127
+ setStoreValue: (value: StoreValue_alias_4) => void;
128
+ applyFeatureState: (value: StoreValue_alias_4, updatedAtMs?: number) => void;
129
+ notify: () => void;
130
+ reportStoreError: (message: string) => void;
131
+ warn: (message: string) => void;
132
+ log: (message: string) => void;
133
+ hashState: (value: unknown) => number;
134
+ deepClone: <T>(value: T) => T;
135
+ sanitize: (value: unknown) => unknown;
136
+ validate: (next: StoreValue_alias_4) => {
137
+ ok: boolean;
138
+ value?: StoreValue_alias_4;
139
+ };
140
+ isDev: () => boolean;
141
+ }
142
+ export { BaseFeatureContext }
143
+ export { BaseFeatureContext as BaseFeatureContext_alias_1 }
144
+
145
+ declare type BaseFeatureContext_2 = {
146
+ name: string;
147
+ options: StoreFeatureMeta["options"];
148
+ getMeta: () => StoreFeatureMeta | undefined;
149
+ getStoreValue: () => StoreValue;
150
+ getAllStores: () => Record<string, StoreValue>;
151
+ getInitialState: () => StoreValue | undefined;
152
+ hasStore: () => boolean;
153
+ setStoreValue: (value: StoreValue) => void;
154
+ applyFeatureState: (value: StoreValue, updatedAtMs?: number) => void;
155
+ notify: () => void;
156
+ reportStoreError: (message: string) => void;
157
+ warn: typeof warn;
158
+ log: typeof log;
159
+ hashState: typeof hashState;
160
+ deepClone: typeof deepClone;
161
+ sanitize: typeof sanitize;
162
+ validate: (next: StoreValue) => {
163
+ ok: true;
164
+ value: StoreValue;
165
+ } | {
166
+ ok: false;
167
+ };
168
+ isDev: typeof isDev;
169
+ };
170
+
171
+ export declare const beginTransaction: (registry?: StoreRegistry) => StoreRegistry;
172
+
173
+ export declare const benchmarkStoreSet: <Name extends string, State extends Record<string, unknown>>(name: StoreDefinition<Name, State> | StoreKey<Name, State>, iterations?: number, makeUpdate?: (i: number) => PartialDeep<State>) => {
174
+ iterations: number;
175
+ totalMs: number;
176
+ avgMs: number;
177
+ };
178
+
179
+ declare const bindRegistry: (scopeOrRegistry?: string | StoreRegistry) => void;
180
+ export { bindRegistry }
181
+ export { bindRegistry as bindRegistry_alias_1 }
182
+
183
+ declare type BrandedStoreName = string & {
184
+ readonly [storeNameBrand]: true;
185
+ };
186
+
187
+ export declare const broadcastSync: ({ name, syncOption, syncChannels, syncClocks, instanceId, updatedAt, data, hashState, reportStoreError, }: {
188
+ name: string;
189
+ syncOption?: boolean | SyncOptions;
190
+ syncChannels: SyncChannels;
191
+ syncClocks: SyncClocks;
192
+ instanceId: string;
193
+ updatedAt: string | number;
194
+ data: StoreValue_alias_4;
195
+ hashState: (value: unknown) => number;
196
+ reportStoreError: (name: string, message: string) => void;
197
+ }) => void;
198
+
199
+ export declare const buildFetchOptions: (options: FetchOptions) => RequestInit;
200
+
201
+ declare type BuiltInFeatureName = "persist" | "sync" | "devtools";
202
+ export { BuiltInFeatureName }
203
+ export { BuiltInFeatureName as BuiltInFeatureName_alias_1 }
204
+
205
+ export declare const bumpSyncClock: (name: string, syncClocks: SyncClocks) => number;
206
+
207
+ declare const canReuseSanitized: (value: unknown) => boolean;
208
+ export { canReuseSanitized }
209
+ export { canReuseSanitized as canReuseSanitized_alias_1 }
210
+
211
+ export declare type CarrierContext = Record<string, unknown>;
212
+
213
+ export declare interface CarrierRunner {
214
+ run<T>(carrier: CarrierContext, fn: () => T): T;
215
+ get(): CarrierContext | null;
216
+ }
217
+
218
+ declare const checksumState: (value: unknown) => number;
219
+ export { checksumState }
220
+ export { checksumState as checksumState_alias_1 }
221
+
222
+ export declare const cleanupAllRevalidateHandlers: () => void;
223
+
224
+ export declare const cleanupAllSyncResources: ({ syncChannels, syncWindowCleanup, }: {
225
+ syncChannels: SyncChannels;
226
+ syncWindowCleanup: SyncWindowCleanup;
227
+ }) => void;
228
+
229
+ export declare const cleanupSubs: Record<string, () => void>;
230
+
231
+ declare const clearAllRegistries: () => void;
232
+ export { clearAllRegistries }
233
+ export { clearAllRegistries as clearAllRegistries_alias_1 }
234
+
235
+ declare const clearAllStores: () => void;
236
+ export { clearAllStores }
237
+ export { clearAllStores as clearAllStores_alias_2 }
238
+
239
+ export declare const clearAllStores_alias_1: () => void;
240
+
241
+ export declare const clearAsyncMeta: (name: string) => void;
242
+
243
+ declare const clearFeatureContexts: () => void;
244
+ export { clearFeatureContexts }
245
+ export { clearFeatureContexts as clearFeatureContexts_alias_1 }
246
+
247
+ declare const clearHistory: (name?: string) => void;
248
+ export { clearHistory }
249
+ export { clearHistory as clearHistory_alias_1 }
250
+
251
+ export declare const clearInflightEntry: (cacheSlot: string) => void;
252
+
253
+ declare const clearPathValidationCache: () => void;
254
+ export { clearPathValidationCache }
255
+ export { clearPathValidationCache as clearPathValidationCache_alias_1 }
256
+
257
+ export declare const clearRegistryScopeOverrideForTests: () => void;
258
+
259
+ export declare const clearRequestVersion: (cacheSlot: string, version: number) => void;
260
+
261
+ export declare const clearStoreRegistries: (registry: StoreRegistry) => void;
262
+
263
+ declare const clearStores: (pattern?: string) => void;
264
+ export { clearStores }
265
+ export { clearStores as clearStores_alias_1 }
266
+
267
+ export declare const cloneAsyncResult: (value: unknown, mode: FetchOptions["cloneResult"]) => unknown;
268
+
269
+ export declare const closeSyncResources: ({ name, syncChannels, syncWindowCleanup, syncClocks, syncVersions, }: {
270
+ name: string;
271
+ syncChannels: SyncChannels;
272
+ syncWindowCleanup: SyncWindowCleanup;
273
+ syncClocks: SyncClocks;
274
+ syncVersions: SyncVersions;
275
+ }) => void;
276
+
277
+ /**
278
+ * Collect deprecation warnings for a store options object.
279
+ *
280
+ * This function walks through the store options object and checks if any
281
+ * deprecated options are present. If a deprecated option is found, a
282
+ * warning message is added to the warnings array.
283
+ *
284
+ * The function returns an array of warning messages. If no deprecated
285
+ * options are found, an empty array is returned.
286
+ *
287
+ * @template State The type of the state stored in the store.
288
+ * @param option The store options object to check for deprecated options.
289
+ * @returns An array of warning messages for deprecated options. If no deprecated
290
+ * options are found, an empty array is returned.
291
+ */
292
+ export declare const collectLegacyOptionDeprecationWarnings: <State>(option: StoreOptions<State>) => string[];
293
+
294
+ export declare type ComputedEntry = {
295
+ deps: string[];
296
+ compute: (...args: unknown[]) => unknown;
297
+ stale: boolean;
298
+ };
299
+
300
+ export declare type ComputedOptions = {
301
+ autoDispose?: boolean;
302
+ onError?: (err: unknown) => void;
303
+ };
304
+
305
+ export declare type ComputedOrderResolver = (names: string[]) => string[];
306
+
307
+ export declare const computePersistChecksum: (mode: "hash" | "none" | "sha256", payload: string, hashFn?: (value: unknown) => number) => Promise<number | string | null>;
308
+
309
+ declare const configureStroid: (next?: StroidConfig) => void;
310
+ export { configureStroid }
311
+ export { configureStroid as configureStroid_alias_1 }
312
+ export { configureStroid as configureStroid_alias_2 }
313
+
314
+ export declare const countInflightSlots: (name: string) => number;
315
+
316
+ declare const crc32: (str: string) => number;
317
+ export { crc32 }
318
+ export { crc32 as crc32_alias_1 }
319
+
320
+ export declare const createAsyncRegistry: () => AsyncRegistry;
321
+
322
+ declare const createBaseFeatureContext: (name: string) => BaseFeatureContext_2 | null;
323
+ export { createBaseFeatureContext }
324
+ export { createBaseFeatureContext as createBaseFeatureContext_alias_1 }
325
+
326
+ declare function createComputed<TResult, Deps extends readonly (StoreName | DepHandle)[]>(name: string, deps: Deps, compute: (...args: {
327
+ [K in keyof Deps]: DepValue<Deps[K]>;
328
+ }) => TResult, options?: ComputedOptions): StoreDefinition<string, TResult> | undefined;
329
+ export { createComputed }
330
+ export { createComputed as createComputed_alias_1 }
331
+ export { createComputed as createComputed_alias_2 }
332
+
333
+ export declare const createCounterStore: (name: string, initial?: number, options?: StoreOptions) => {
334
+ inc: (n?: number) => WriteResult;
335
+ dec: (n?: number) => WriteResult;
336
+ set: (v: number) => WriteResult;
337
+ reset: () => WriteResult;
338
+ get: () => number | null;
339
+ };
340
+
341
+ export declare const createDevtoolsFeatureRuntime: () => StoreFeatureRuntime;
342
+
343
+ export declare const createEntityStore: <T extends {
344
+ id?: string;
345
+ _id?: string;
346
+ }>(name: string, options?: StoreOptions) => {
347
+ upsert: (entity: T) => WriteResult;
348
+ remove: (id: string) => WriteResult;
349
+ all: () => T[];
350
+ get: (id: string) => T | null;
351
+ clear: () => WriteResult;
352
+ };
353
+
354
+ export declare const createListStore: <T>(name: string, initial?: T[], options?: StoreOptions) => {
355
+ push: (item: T) => WriteResult;
356
+ removeAt: (index: number) => WriteResult;
357
+ clear: () => WriteResult;
358
+ replace: (items: T[]) => WriteResult;
359
+ all: () => T[];
360
+ };
361
+
362
+ export declare const createMockStore: <Name extends string, State extends Record<string, unknown> = Record<string, unknown>>(name?: Name, initial?: State) => {
363
+ set: (update: PartialDeep<State> | ((draft: State) => void)) => WriteResult;
364
+ reset: () => WriteResult;
365
+ use: () => StoreDefinition<Name, State>;
366
+ };
367
+
368
+ export declare const createPersistFeatureRuntime: () => StoreFeatureRuntime;
369
+
370
+ export declare const createReactQueryFetcher: (storeName: StoreTarget, input: FetchInput, options?: FetchOptions) => () => Promise<unknown>;
371
+
372
+ declare const createSelector: <TState, TResult>(storeName: string, selectorFn: (state: TState) => TResult) => () => NonNullable<TResult> | null;
373
+ export { createSelector }
374
+ export { createSelector as createSelector_alias_1 }
375
+
376
+ declare const createStore: <Name extends string, State>(name: Name, initialData: State, option?: StoreOptions<State>) => StoreDefinition<Name, State> | undefined;
377
+ export { createStore }
378
+ export { createStore as createStore_alias_1 }
379
+ export { createStore as createStore_alias_2 }
380
+ export { createStore as createStore_alias_3 }
381
+ export { createStore as createStore_alias_4 }
382
+
383
+ export declare const createStoreAdmin: (registry: StoreRegistry) => {
384
+ deleteExistingStore: (name: string) => void;
385
+ clearAllStores: () => string[];
386
+ clearStores: (pattern?: string) => string[];
387
+ reportStoreError: (name: string, message: string) => void;
388
+ };
389
+
390
+ export declare const createStoreForRequest: <StateMap extends StoreStateMap = StoreStateMap>(initializer?: (api: RequestStoreApi<StateMap>) => void) => RequestStoreContext<StateMap>;
391
+
392
+ export declare const createStoreRegistry: () => StoreRegistry;
393
+
394
+ declare const createStoreStrict: <Name extends string, State>(name: Name, initialData: State, option?: StoreOptions<State>) => StoreDefinition<Name, State>;
395
+ export { createStoreStrict }
396
+ export { createStoreStrict as createStoreStrict_alias_1 }
397
+ export { createStoreStrict as createStoreStrict_alias_2 }
398
+
399
+ export declare const createSwrFetcher: (storeName: StoreTarget, input: FetchInput, options?: FetchOptions) => () => Promise<unknown>;
400
+
401
+ export declare const createSyncFeatureRuntime: () => StoreFeatureRuntime;
402
+
403
+ declare const critical: (msg: string, meta?: Record<string, unknown>) => void;
404
+ export { critical }
405
+ export { critical as critical_alias_1 }
406
+
407
+ declare const deepClone: <T>(value: T) => T;
408
+ export { deepClone }
409
+ export { deepClone as deepClone_alias_1 }
410
+
411
+ declare const defaultRegistryScope: string;
412
+ export { defaultRegistryScope }
413
+ export { defaultRegistryScope as defaultRegistryScope_alias_1 }
414
+ export { defaultRegistryScope as defaultRegistryScope_alias_2 }
415
+
416
+ export declare const delay: (ms: number, signal?: AbortSignal) => Promise<void>;
417
+
418
+ declare const deleteComputed: (name: string) => void;
419
+ export { deleteComputed }
420
+ export { deleteComputed as deleteComputed_alias_1 }
421
+ export { deleteComputed as deleteComputed_alias_2 }
422
+
423
+ declare function deleteStore<Name extends string, State>(name: StoreDefinition<Name, State>): void;
424
+
425
+ declare function deleteStore<Name extends string, State>(name: StoreKey<Name, State>): void;
426
+
427
+ declare function deleteStore<Name extends StoreName>(name: Name): void;
428
+ export { deleteStore }
429
+ export { deleteStore as deleteStore_alias_1 }
430
+ export { deleteStore as deleteStore_alias_2 }
431
+ export { deleteStore as deleteStore_alias_3 }
432
+
433
+ declare type DepHandle = StoreDefinition<string, StoreValue> | StoreKey<string, StoreValue>;
434
+
435
+ declare type DepValue<T> = T extends StoreDefinition<string, infer S> ? Readonly<S> | null : T extends StoreKey<string, infer S> ? Readonly<S> | null : T extends StoreName ? Readonly<StateFor<T>> | null : StoreValue | null;
436
+
437
+ export declare const detectCycle: (name: string, deps: string[]) => string | null;
438
+
439
+ /**
440
+ * @module devfreeze
441
+ *
442
+ * LAYER: Module
443
+ * OWNS: Module-level behavior and exports for devfreeze.
444
+ *
445
+ * Consumers: Internal imports and public API.
446
+ */
447
+ export declare const devDeepFreeze: <T>(value: T) => T;
448
+
449
+ declare interface DevtoolsFeatureApi {
450
+ getHistory?: (name: string, limit?: number) => unknown[];
451
+ clearHistory?: (name?: string) => void;
452
+ getPersistQueueDepth?: (name: string) => number;
453
+ }
454
+ export { DevtoolsFeatureApi }
455
+ export { DevtoolsFeatureApi as DevtoolsFeatureApi_alias_1 }
456
+
457
+ export declare interface DevtoolsOptions<State = StoreValue_alias_4> {
458
+ enabled?: boolean;
459
+ historyLimit?: number;
460
+ redactor?: (state: State) => State;
461
+ }
462
+
463
+ export declare const diffShallow: (prev: StoreValue_alias_4, next: StoreValue_alias_4) => HistoryDiff;
464
+
465
+ declare function enableRevalidateOnFocus<Name extends string, State>(name: StoreDefinition<Name, State>, overrides?: Partial<FetchOptions> & {
466
+ debounceMs?: number;
467
+ maxConcurrent?: number;
468
+ staggerMs?: number;
469
+ priority?: "high" | "normal";
470
+ }): (() => void);
471
+
472
+ declare function enableRevalidateOnFocus<Name extends string, State>(name: StoreKey<Name, State>, overrides?: Partial<FetchOptions> & {
473
+ debounceMs?: number;
474
+ maxConcurrent?: number;
475
+ staggerMs?: number;
476
+ priority?: "high" | "normal";
477
+ }): (() => void);
478
+
479
+ declare function enableRevalidateOnFocus<Name extends StoreName>(name?: Name | "*", overrides?: Partial<FetchOptions> & {
480
+ debounceMs?: number;
481
+ maxConcurrent?: number;
482
+ staggerMs?: number;
483
+ priority?: "high" | "normal";
484
+ }): (() => void);
485
+ export { enableRevalidateOnFocus }
486
+ export { enableRevalidateOnFocus as enableRevalidateOnFocus_alias_1 }
487
+
488
+ export declare const endTransaction: (err?: unknown, registry?: StoreRegistry) => Error | null;
489
+
490
+ export declare const ensureCleanupSubscription: (name: string) => void;
491
+
492
+ export declare const enterRegistry: (registry: StoreRegistry) => void;
493
+
494
+ declare const error: (msg: string, meta?: Record<string, unknown>) => void;
495
+ export { error }
496
+ export { error as error_alias_1 }
497
+
498
+ declare const exists: (name: string) => boolean;
499
+ export { exists }
500
+ export { exists as exists_alias_1 }
501
+
502
+ declare interface FeatureCreateContext extends BaseFeatureContext {
503
+ }
504
+ export { FeatureCreateContext }
505
+ export { FeatureCreateContext as FeatureCreateContext_alias_1 }
506
+
507
+ declare interface FeatureDeleteContext extends BaseFeatureContext {
508
+ prev: StoreValue_alias_4;
509
+ }
510
+ export { FeatureDeleteContext }
511
+ export { FeatureDeleteContext as FeatureDeleteContext_alias_1 }
512
+
513
+ declare interface FeatureMetrics {
514
+ notifyCount: number;
515
+ totalNotifyMs: number;
516
+ lastNotifyMs: number;
517
+ }
518
+ export { FeatureMetrics }
519
+ export { FeatureMetrics as FeatureMetrics_alias_1 }
520
+
521
+ declare type FeatureName = BuiltInFeatureName | (string & {});
522
+ export { FeatureName }
523
+ export { FeatureName as FeatureName_alias_1 }
524
+
525
+ declare type FeatureOptions = Partial<FeatureOptionsMap> & Record<string, unknown>;
526
+ export { FeatureOptions }
527
+ export { FeatureOptions as FeatureOptions_alias_1 }
528
+ export { FeatureOptions as FeatureOptions_alias_2 }
529
+
530
+ declare interface FeatureOptionsMap {
531
+ }
532
+ export { FeatureOptionsMap }
533
+ export { FeatureOptionsMap as FeatureOptionsMap_alias_1 }
534
+ export { FeatureOptionsMap as FeatureOptionsMap_alias_2 }
535
+
536
+ declare const featureRuntimes: Map<FeatureName, StoreFeatureRuntime>;
537
+ export { featureRuntimes }
538
+ export { featureRuntimes as featureRuntimes_alias_1 }
539
+
540
+ export declare type FeatureValidation = (next: StoreValue_alias_4) => {
541
+ ok: boolean;
542
+ value?: StoreValue_alias_4;
543
+ };
544
+
545
+ declare interface FeatureWriteContext extends BaseFeatureContext {
546
+ action: string;
547
+ prev: StoreValue_alias_4;
548
+ next: StoreValue_alias_4;
549
+ }
550
+ export { FeatureWriteContext }
551
+ export { FeatureWriteContext as FeatureWriteContext_alias_1 }
552
+
553
+ declare type FetchInput = string | Promise<unknown> | (() => string | Promise<unknown>);
554
+ export { FetchInput }
555
+ export { FetchInput as FetchInput_alias_1 }
556
+
557
+ declare interface FetchOptions {
558
+ transform?: (result: unknown) => unknown;
559
+ onSuccess?: (data: unknown) => void;
560
+ onError?: (message: string) => void;
561
+ /**
562
+ * Optional adapter to write async state into a custom store shape.
563
+ * When provided, default AsyncState writes are skipped.
564
+ */
565
+ stateAdapter?: AsyncStateAdapter;
566
+ method?: string;
567
+ headers?: Record<string, string>;
568
+ body?: unknown;
569
+ ttl?: number;
570
+ staleWhileRevalidate?: boolean;
571
+ dedupe?: boolean;
572
+ retry?: number;
573
+ retryDelay?: number;
574
+ retryBackoff?: number;
575
+ signal?: AbortSignal;
576
+ cacheKey?: string;
577
+ responseType?: "auto" | "json" | "text" | "arrayBuffer" | "blob" | "formData";
578
+ /**
579
+ * Auto-create the backing store if missing.
580
+ * Defaults to the global config setting (true by default).
581
+ */
582
+ autoCreate?: boolean;
583
+ /**
584
+ * Clone strategy for transformed results.
585
+ * - "none" (default): store by reference.
586
+ * - "shallow": shallow clone objects/arrays.
587
+ * - "deep": deep clone objects/arrays.
588
+ */
589
+ cloneResult?: "none" | "shallow" | "deep";
590
+ }
591
+ export { FetchOptions }
592
+ export { FetchOptions as FetchOptions_alias_1 }
593
+ export { FetchOptions as FetchOptions_alias_2 }
594
+
595
+ declare function fetchStore<Name extends string, State>(name: StoreDefinition<Name, State>, urlOrRequest: FetchInput, options?: FetchOptions): Promise<unknown>;
596
+
597
+ declare function fetchStore<Name extends string, State>(name: StoreKey<Name, State>, urlOrRequest: FetchInput, options?: FetchOptions): Promise<unknown>;
598
+
599
+ declare function fetchStore<Name extends StoreName>(name: Name, urlOrRequest: FetchInput, options?: FetchOptions): Promise<unknown>;
600
+ export { fetchStore }
601
+ export { fetchStore as fetchStore_alias_1 }
602
+
603
+ declare type FlushConfig = {
604
+ chunkSize?: number;
605
+ chunkDelayMs?: number;
606
+ priorityStores?: string[];
607
+ };
608
+ export { FlushConfig }
609
+ export { FlushConfig as FlushConfig_alias_1 }
610
+
611
+ declare const flushPersistImmediately: (name: string, args: PersistSaveArgs) => void;
612
+ export { flushPersistImmediately }
613
+ export { flushPersistImmediately as flushPersistImmediately_alias_1 }
614
+
615
+ export declare const FORBIDDEN_OBJECT_KEYS: Set<string>;
616
+
617
+ export declare const getActiveAsyncRegistry: () => AsyncRegistry;
618
+
619
+ export declare const getActiveStoreRegistry: (fallback?: StoreRegistry) => StoreRegistry;
620
+
621
+ export declare const getAsyncInflightCount: (name: string) => number;
622
+
623
+ declare const getAsyncMetrics: () => {
624
+ cacheHits: number;
625
+ cacheMisses: number;
626
+ dedupes: number;
627
+ requests: number;
628
+ failures: number;
629
+ avgMs: number;
630
+ lastMs: number;
631
+ };
632
+ export { getAsyncMetrics }
633
+ export { getAsyncMetrics as getAsyncMetrics_alias_1 }
634
+
635
+ declare const getByPath: (obj: unknown, path: PathInput) => unknown;
636
+ export { getByPath }
637
+ export { getByPath as getByPath_alias_1 }
638
+
639
+ export declare const getCacheMeta: () => ReturnType<typeof getActiveAsyncRegistry>["cacheMeta"];
640
+
641
+ export declare const getComputedDeps: (name: string) => {
642
+ deps: string[];
643
+ dependents: string[];
644
+ } | null;
645
+
646
+ declare const getComputedDepsFor: (name: string) => {
647
+ deps: string[];
648
+ dependents: string[];
649
+ } | null;
650
+ export { getComputedDepsFor }
651
+ export { getComputedDepsFor as getComputedDepsFor_alias_1 }
652
+
653
+ export declare const getComputedEntry: (name: string) => ComputedEntry | undefined;
654
+
655
+ export declare const getComputedGraph: () => {
656
+ nodes: string[];
657
+ edges: Array<{
658
+ from: string;
659
+ to: string;
660
+ }>;
661
+ dependencies: Record<string, string[]>;
662
+ dependents: Record<string, string[]>;
663
+ };
664
+
665
+ export declare const getComputedOrder: (names: string[]) => string[];
666
+
667
+ export declare const getConfig: () => ResolvedConfig;
668
+
669
+ export declare const getDateStoreWarningMessage: () => string;
670
+
671
+ export declare const getDeepNestingWarningMessage: (depth: number, parts: string[]) => string;
672
+
673
+ export declare const getDefaultStoreRegistry: () => StoreRegistry;
674
+
675
+ declare const getFeatureApi: (name: FeatureName) => DevtoolsFeatureApi | undefined;
676
+ export { getFeatureApi as _getFeatureApi }
677
+ export { getFeatureApi as _getFeatureApi_alias_1 }
678
+ export { getFeatureApi }
679
+ export { getFeatureApi as getFeatureApi_alias_1 }
680
+
681
+ declare const getFeatureRuntime: (name: FeatureName) => StoreFeatureRuntime | undefined;
682
+ export { getFeatureRuntime }
683
+ export { getFeatureRuntime as getFeatureRuntime_alias_1 }
684
+
685
+ export declare const getFetchRegistry: () => ReturnType<typeof getActiveAsyncRegistry>["fetchRegistry"];
686
+
687
+ export declare const getForbiddenStoreNameMessage: (name: string) => string;
688
+
689
+ declare const getFullComputedGraph: () => {
690
+ nodes: string[];
691
+ edges: Array<{
692
+ from: string;
693
+ to: string;
694
+ }>;
695
+ dependencies: Record<string, string[]>;
696
+ dependents: Record<string, string[]>;
697
+ };
698
+ export { getFullComputedGraph }
699
+ export { getFullComputedGraph as getFullComputedGraph_alias_1 }
700
+
701
+ declare const getHistory: (name: string, limit?: number) => HistoryEntry[];
702
+ export { getHistory }
703
+ export { getHistory as getHistory_alias_1 }
704
+
705
+ export declare const getInitialState: () => Record<string, unknown>;
706
+
707
+ declare const getInitialState_2: () => Record<string, StoreValue>;
708
+ export { getInitialState_2 as getInitialState_alias_1 }
709
+ export { getInitialState_2 as getInitialState_alias_2 }
710
+
711
+ export declare const getInvalidFunctionStoreValueMessage: () => string;
712
+
713
+ export declare const getInvalidStoreNameMessage: (name: string) => string;
714
+
715
+ export declare const getMapSetStoreWarningMessage: () => string;
716
+
717
+ declare const getMetaEntry: (name: string) => StoreFeatureMeta | undefined;
718
+ export { getMetaEntry }
719
+ export { getMetaEntry as getMetaEntry_alias_1 }
720
+
721
+ export declare const getMetrics: (name: string) => StoreFeatureMeta["metrics"] | null;
722
+
723
+ declare const getMetrics_2: (name: string) => (typeof meta)[string]["metrics"] | null;
724
+ export { getMetrics_2 as getMetrics_alias_1 }
725
+ export { getMetrics_2 as getMetrics_alias_2 }
726
+
727
+ export declare const getNamespace: () => string;
728
+
729
+ export declare const getPathDepthExceededMessage: (depth: number, maxDepth: number, parts: string[]) => string;
730
+
731
+ export declare const getPathNotObjectMessage: (part: string) => string;
732
+
733
+ export declare const getPathReachedNullMessage: (parts: string[], part: string) => string;
734
+
735
+ export declare const getPersistQueueDepth: (name: string) => number;
736
+
737
+ declare const getRegisteredFeatureNames: () => FeatureName[];
738
+ export { getRegisteredFeatureNames }
739
+ export { getRegisteredFeatureNames as getRegisteredFeatureNames_alias_1 }
740
+
741
+ declare const getRegistry: () => StoreRegistry;
742
+ export { getRegistry }
743
+ export { getRegistry as getRegistry_alias_1 }
744
+
745
+ export declare const getRequestCarrier: () => CarrierContext | null;
746
+
747
+ export declare const getSanitizeDateWarningMessage: () => string;
748
+
749
+ export declare const getSanitizeMapWarningMessage: () => string;
750
+
751
+ export declare const getSanitizeSetWarningMessage: () => string;
752
+
753
+ export declare const getSelectorStoreValueRef: (name: string) => StoreValue | undefined;
754
+
755
+ /** @deprecated Use getStoreSnapshot instead. */
756
+ declare const getSnapshot: (name: string) => StoreValue | null;
757
+ export { getSnapshot as _getSnapshot }
758
+ export { getSnapshot }
759
+
760
+ declare const getSsrWarningIssued: (name?: string) => boolean;
761
+ export { getSsrWarningIssued }
762
+ export { getSsrWarningIssued as getSsrWarningIssued_alias_1 }
763
+
764
+ export declare const getStagedTransactionValue: (name: string) => {
765
+ has: boolean;
766
+ value: StoreValue | undefined;
767
+ };
768
+
769
+ declare function getStore<Name extends string, State, P extends Path<State>>(name: StoreDefinition<Name, State>, path: P): StoreSnapshot<PathValue<State, P>> | null;
770
+
771
+ declare function getStore<Name extends string, State>(name: StoreDefinition<Name, State>, path?: undefined): StoreSnapshot<State> | null;
772
+
773
+ declare function getStore<Name extends string, State, P extends Path<State>>(name: StoreKey<Name, State>, path: P): StoreSnapshot<PathValue<State, P>> | null;
774
+
775
+ declare function getStore<Name extends string, State>(name: StoreKey<Name, State>, path?: undefined): StoreSnapshot<State> | null;
776
+
777
+ declare function getStore<Name extends StoreName, P extends Path<StateFor<Name>>>(name: Name, path: P): StoreSnapshot<PathValue<StateFor<Name>, P>> | null;
778
+
779
+ declare function getStore<Name extends StoreName>(name: Name, path?: undefined): StoreSnapshot<StateFor<Name>> | null;
780
+ export { getStore }
781
+ export { getStore as getStore_alias_1 }
782
+ export { getStore as getStore_alias_2 }
783
+ export { getStore as getStore_alias_3 }
784
+ export { getStore as getStore_alias_4 }
785
+
786
+ declare const getStoreAdmin: () => ReturnType<typeof createStoreAdmin>;
787
+ export { getStoreAdmin }
788
+ export { getStoreAdmin as getStoreAdmin_alias_1 }
789
+
790
+ export declare const getStoreFeatureFactory: (name: FeatureName) => StoreFeatureFactory | undefined;
791
+
792
+ export declare const getStoreMeta: (name: string) => StoreFeatureMeta | null;
793
+
794
+ export declare const getStoreNameContainsSpacesMessage: (name: string) => string;
795
+
796
+ export declare const getStoreRegistry: (scope: string) => StoreRegistry;
797
+
798
+ declare const getStoreSnapshot: (name: string) => StoreValue | null;
799
+ export { getStoreSnapshot }
800
+ export { getStoreSnapshot as getStoreSnapshot_alias_1 }
801
+
802
+ declare const getStoreValueRef: (name: string) => StoreValue | undefined;
803
+ export { getStoreValueRef as _getStoreValueRef }
804
+ export { getStoreValueRef as _getStoreValueRef_alias_1 }
805
+ export { getStoreValueRef }
806
+ export { getStoreValueRef as getStoreValueRef_alias_1 }
807
+
808
+ export declare const getSubscriberCount: (name: string) => number;
809
+
810
+ export declare const getTopoOrderedComputeds: (changedSources: string[]) => string[];
811
+
812
+ declare const getType: (value: unknown) => SupportedType;
813
+ export { getType }
814
+ export { getType as getType_alias_1 }
815
+
816
+ export declare const _hardResetAllStoresForTest: () => void;
817
+
818
+ export declare const hasBroadUseStoreWarning: (name: string) => boolean;
819
+
820
+ /**
821
+ * Non-cryptographic checksum for integrity (best-effort). Do not use for security.
822
+ * String inputs preserve the legacy CRC32(JSON.stringify(value)) behavior to keep
823
+ * persisted checksums stable across versions.
824
+ */
825
+ declare const hashState: (value: unknown) => number;
826
+ export { hashState }
827
+ export { hashState as hashState_alias_1 }
828
+
829
+ export declare const hasInflightEntry: (cacheSlot: string) => boolean;
830
+
831
+ export declare const hasMissingUseStoreWarning: (name: string) => boolean;
832
+
833
+ declare const hasRegisteredStoreFeature: (name: FeatureName) => boolean;
834
+ export { hasRegisteredStoreFeature }
835
+ export { hasRegisteredStoreFeature as hasRegisteredStoreFeature_alias_1 }
836
+
837
+ export declare const hasSelectorStoreEntry: (name: string) => boolean;
838
+
839
+ declare const hasStore: (name: string) => boolean;
840
+ export { hasStore }
841
+ export { hasStore as hasStore_alias_1 }
842
+ export { hasStore as hasStore_alias_2 }
843
+ export { hasStore as hasStore_alias_3 }
844
+
845
+ export declare const hasStoreEntry: (registry: StoreRegistry, name: string) => boolean;
846
+
847
+ declare const hasStoreEntryInternal: (name: string) => boolean;
848
+ export { hasStoreEntryInternal as _hasStoreEntryInternal }
849
+ export { hasStoreEntryInternal as _hasStoreEntryInternal_alias_1 }
850
+ export { hasStoreEntryInternal }
851
+ export { hasStoreEntryInternal as hasStoreEntryInternal_alias_1 }
852
+
853
+ declare type HistoryDiff = {
854
+ added: string[];
855
+ removed: string[];
856
+ changed: string[];
857
+ } | null;
858
+ export { HistoryDiff }
859
+ export { HistoryDiff as HistoryDiff_alias_1 }
860
+
861
+ declare type HistoryEntry = {
862
+ ts: number;
863
+ action: string;
864
+ prev: StoreValue_alias_4;
865
+ next: StoreValue_alias_4;
866
+ diff: HistoryDiff;
867
+ };
868
+ export { HistoryEntry }
869
+ export { HistoryEntry as HistoryEntry_alias_1 }
870
+
871
+ declare type HydrateOptions<Snapshot extends Record<string, unknown>> = Partial<{
872
+ [K in keyof Snapshot]: StoreOptions<Snapshot[K]>;
873
+ }> & {
874
+ default?: StoreOptions;
875
+ };
876
+
877
+ declare type HydrateSnapshot = Partial<{
878
+ [K in StoreName]: StateFor<K>;
879
+ }>;
880
+
881
+ declare const hydrateStores: <Snapshot extends Record<string, unknown> = HydrateSnapshot>(snapshot: Snapshot, options?: HydrateOptions<Snapshot>, trust?: HydrationTrust<Snapshot>) => {
882
+ hydrated: string[];
883
+ created: string[];
884
+ failed: Record<string, string>;
885
+ };
886
+ export { hydrateStores }
887
+ export { hydrateStores as hydrateStores_alias_1 }
888
+ export { hydrateStores as hydrateStores_alias_2 }
889
+
890
+ declare type HydrationTrust<Snapshot extends Record<string, unknown>> = {
891
+ allowUntrusted?: boolean;
892
+ validate?: (snapshot: Snapshot) => boolean;
893
+ };
894
+
895
+ export declare const inflight: Partial<Record<string, {
896
+ promise: Promise<unknown>;
897
+ raw: Promise<unknown>;
898
+ transform?: FetchOptions["transform"];
899
+ }>>;
900
+
901
+ export declare type InflightEntry = {
902
+ promise: Promise<unknown>;
903
+ raw: Promise<unknown>;
904
+ transform?: FetchOptions["transform"];
905
+ };
906
+
907
+ declare type InflightEntry_2 = {
908
+ promise: Promise<unknown>;
909
+ raw: Promise<unknown>;
910
+ transform?: FetchOptions["transform"];
911
+ };
912
+
913
+ export declare const initDevtools: ({ name, useDevtools, existingDevtools, stores, warn, }: {
914
+ name: string;
915
+ useDevtools: boolean;
916
+ existingDevtools: any;
917
+ stores: Record<string, StoreValue_alias_4>;
918
+ warn: (message: string) => void;
919
+ }) => any;
920
+
921
+ declare const initialFactories: Record<string, (() => StoreValue) | undefined>;
922
+ export { initialFactories }
923
+ export { initialFactories as initialFactories_alias_1 }
924
+
925
+ export declare const initializeRegisteredFeatureRuntimes: () => void;
926
+
927
+ declare const initialStates: Record<string, unknown>;
928
+ export { initialStates }
929
+ export { initialStates as initialStates_alias_1 }
930
+
931
+ export declare const injectCarrierRunner: (runner: CarrierRunner) => void;
932
+
933
+ export declare const injectRegistryRunner: (runner: RegistryRunner) => void;
934
+
935
+ export declare const installAllFeatures: () => void;
936
+
937
+ declare const installDevtools: () => void;
938
+ export { installDevtools }
939
+ export { installDevtools as installDevtools_alias_1 }
940
+
941
+ declare const installPersist: () => void;
942
+ export { installPersist }
943
+ export { installPersist as installPersist_alias_1 }
944
+
945
+ declare const installSync: () => void;
946
+ export { installSync }
947
+ export { installSync as installSync_alias_1 }
948
+
949
+ declare const invalidateComputed: (name: string) => void;
950
+ export { invalidateComputed }
951
+ export { invalidateComputed as invalidateComputed_alias_1 }
952
+ export { invalidateComputed as invalidateComputed_alias_2 }
953
+
954
+ declare const invalidatePathCache: (name: string) => void;
955
+ export { invalidatePathCache }
956
+ export { invalidatePathCache as invalidatePathCache_alias_1 }
957
+
958
+ export declare const isComputed: (name: string) => boolean;
959
+
960
+ declare const isComputedStore: (name: string) => boolean;
961
+ export { isComputedStore }
962
+ export { isComputedStore as isComputedStore_alias_1 }
963
+ export { isComputedStore as isComputedStore_alias_2 }
964
+
965
+ export declare const isCurrentRequest: (cacheSlot: string, version: number) => boolean;
966
+
967
+ export declare const isDeleting: (name: string) => boolean;
968
+
969
+ declare const isDev: () => boolean;
970
+ export { isDev }
971
+ export { isDev as isDev_alias_1 }
972
+
973
+ export declare const isIdentityCrypto: (fn: (v: string) => string) => boolean;
974
+
975
+ export declare const isStoreDeleting: (registry: StoreRegistry, name: string) => boolean;
976
+
977
+ declare type IsStoreNameLoose = string extends StoreName ? true : false;
978
+
979
+ export declare type IssueOptions = {
980
+ severity?: IssueSeverity;
981
+ visibility?: IssueVisibility;
982
+ onError?: (message: string) => void;
983
+ };
984
+
985
+ export declare type IssueSeverity = "warn" | "critical";
986
+
987
+ export declare type IssueVisibility = "dev" | "always";
988
+
989
+ export declare const isTransactionActive: () => boolean;
990
+
991
+ declare const isValidData: (value: unknown) => boolean;
992
+ export { isValidData }
993
+ export { isValidData as isValidData_alias_1 }
994
+
995
+ declare const isValidStoreName: (name: string) => boolean;
996
+ export { isValidStoreName }
997
+ export { isValidStoreName as isValidStoreName_alias_1 }
998
+
999
+ export declare type LifecycleIssueReporter = (message: string, visibility?: "dev" | "always") => void;
1000
+
1001
+ export declare interface LifecycleOptions<State = StoreValue_alias_4> {
1002
+ middleware?: Array<(ctx: MiddlewareCtx) => StoreValue_alias_4 | void>;
1003
+ onSet?: (prev: State, next: State) => void;
1004
+ onReset?: (prev: State, next: State) => void;
1005
+ onDelete?: (prev: State) => void;
1006
+ onCreate?: (initial: State) => void;
1007
+ }
1008
+
1009
+ export declare const listStores: (pattern?: string) => string[];
1010
+
1011
+ declare const log: (msg: string, meta?: Record<string, unknown>) => void;
1012
+ export { log }
1013
+ export { log as log_alias_1 }
1014
+
1015
+ declare type LogSink = {
1016
+ log?: (msg: string, meta?: Record<string, unknown>) => void;
1017
+ warn?: (msg: string, meta?: Record<string, unknown>) => void;
1018
+ critical?: (msg: string, meta?: Record<string, unknown>) => void;
1019
+ };
1020
+ export { LogSink }
1021
+ export { LogSink as LogSink_alias_1 }
1022
+
1023
+ export declare const markBroadUseStoreWarning: (name: string) => void;
1024
+
1025
+ export declare const markMissingUseStoreWarning: (name: string) => void;
1026
+
1027
+ declare const markSsrWarningIssued: (name: string) => void;
1028
+ export { markSsrWarningIssued }
1029
+ export { markSsrWarningIssued as markSsrWarningIssued_alias_1 }
1030
+
1031
+ export declare const markStale: (name: string) => void;
1032
+
1033
+ export declare const markTransactionFailed: (err?: unknown, registry?: StoreRegistry) => void;
1034
+
1035
+ export declare const markWarned: (set: Set<string>, key: string) => void;
1036
+
1037
+ declare const materializeInitial: (name: string) => boolean;
1038
+ export { materializeInitial }
1039
+ export { materializeInitial as materializeInitial_alias_1 }
1040
+
1041
+ export declare const MAX_CACHE_SLOTS_PER_STORE = 100;
1042
+
1043
+ export declare const MAX_INFLIGHT_SLOTS_PER_STORE = 100;
1044
+
1045
+ export declare const MAX_RETRY_ATTEMPTS = 10;
1046
+
1047
+ export declare const MAX_RETRY_BACKOFF = 8;
1048
+
1049
+ export declare const MAX_RETRY_DELAY_MS = 30000;
1050
+
1051
+ export declare const MAX_WARNED_ENTRIES = 1000;
1052
+
1053
+ declare const meta: Record<string, StoreFeatureMeta>;
1054
+ export { meta }
1055
+ export { meta as meta_alias_1 }
1056
+
1057
+ export declare const MIDDLEWARE_ABORT: unique symbol;
1058
+
1059
+ declare interface MiddlewareCtx {
1060
+ action: string;
1061
+ name: string;
1062
+ prev: StoreValue_alias_4;
1063
+ next: StoreValue_alias_4;
1064
+ path: unknown;
1065
+ }
1066
+ export { MiddlewareCtx }
1067
+ export { MiddlewareCtx as MiddlewareCtx_alias_1 }
1068
+
1069
+ export declare const MIN_RETRY_DELAY_MS = 10;
1070
+
1071
+ export declare const mutableResultWarned: Set<string>;
1072
+
1073
+ declare const nameOf: (name: string | StoreDefinition<string, unknown>) => string;
1074
+ export { nameOf }
1075
+ export { nameOf as nameOf_alias_1 }
1076
+
1077
+ declare const namespace: (ns: string) => {
1078
+ store: <Name extends string, State = unknown>(name: Name) => StoreKey<Name, State>;
1079
+ create: <Name extends string, State>(name: Name, data: State, options?: Parameters<typeof createStore>[2]) => StoreDefinition<string, unknown> | undefined;
1080
+ createStrict: <Name extends string, State>(name: Name, data: State, options?: Parameters<typeof createStore>[2]) => StoreDefinition<string, unknown>;
1081
+ set: (name: any, ...rest: any[]) => any;
1082
+ get: (name: any, ...rest: any[]) => any;
1083
+ delete: (name: string) => void;
1084
+ reset: (name: string) => WriteResult;
1085
+ };
1086
+ export { namespace }
1087
+ export { namespace as namespace_alias_1 }
1088
+ export { namespace as namespace_alias_2 }
1089
+
1090
+ declare const normalizeCommittedState: (name: string, value: unknown, validate: ValidateOption | undefined, onError?: (message: string) => void, options?: {
1091
+ reuseInput?: boolean;
1092
+ }) => {
1093
+ ok: true;
1094
+ value: StoreValue;
1095
+ } | {
1096
+ ok: false;
1097
+ };
1098
+ export { normalizeCommittedState }
1099
+ export { normalizeCommittedState as normalizeCommittedState_alias_1 }
1100
+
1101
+ export declare type NormalizedFeatureState = {
1102
+ ok: true;
1103
+ value: StoreValue_alias_4;
1104
+ } | {
1105
+ ok: false;
1106
+ };
1107
+
1108
+ export declare interface NormalizedOptions {
1109
+ scope: StoreScope;
1110
+ lazy: boolean;
1111
+ pathCreate: boolean;
1112
+ persist: PersistConfig | null;
1113
+ devtools: boolean;
1114
+ middleware: Array<(ctx: MiddlewareCtx) => StoreValue_alias_4 | void>;
1115
+ onSet?: (prev: StoreValue_alias_4, next: StoreValue_alias_4) => void;
1116
+ onReset?: (prev: StoreValue_alias_4, next: StoreValue_alias_4) => void;
1117
+ onDelete?: (prev: StoreValue_alias_4) => void;
1118
+ onCreate?: (initial: StoreValue_alias_4) => void;
1119
+ onError?: (err: string) => void;
1120
+ validate?: ValidateOption;
1121
+ migrations: Record<number, (state: any) => any>;
1122
+ version: number;
1123
+ redactor?: (state: StoreValue_alias_4) => StoreValue_alias_4;
1124
+ historyLimit: number;
1125
+ allowSSRGlobalStore?: boolean;
1126
+ sync?: boolean | SyncOptions;
1127
+ features?: FeatureOptions;
1128
+ snapshot: SnapshotMode;
1129
+ explicitPersist: boolean;
1130
+ explicitSync: boolean;
1131
+ explicitDevtools: boolean;
1132
+ }
1133
+
1134
+ export declare const normalizeFeatureState: ({ value, sanitize, validate, onSanitizeError, }: {
1135
+ value: unknown;
1136
+ sanitize?: (value: unknown) => unknown;
1137
+ validate: FeatureValidation;
1138
+ onSanitizeError?: (error: unknown) => void;
1139
+ }) => NormalizedFeatureState;
1140
+
1141
+ /**
1142
+ * Normalize persist options for a store.
1143
+ *
1144
+ * This function takes the raw persist options from a store and returns
1145
+ * a normalized PersistConfig object. If the raw persist options are
1146
+ * invalid, this function returns null.
1147
+ *
1148
+ * @template State
1149
+ * @param {StoreOptions<State>["persist"]} persist - The raw persist options for the store.
1150
+ * @param {string} name - The name of the store.
1151
+ * @returns {PersistConfig | null} A normalized PersistConfig object, or null if the raw persist options are invalid.
1152
+ */
1153
+ export declare const normalizePersistOptions: <State>(persist: StoreOptions<State>["persist"], name: string) => PersistConfig | null;
1154
+
1155
+ export declare const normalizeRetryOptions: (name: string, retry: number, retryDelay: number, retryBackoff: number) => {
1156
+ retry: number;
1157
+ retryDelay: number;
1158
+ retryBackoff: number;
1159
+ };
1160
+
1161
+ /**
1162
+ * Normalize a store options object, merging default values and performing deprecation checks.
1163
+ * @param option The store options object to normalize.
1164
+ * @param name The name of the store.
1165
+ * @param defaultSnapshotMode The default snapshot mode to use if none is specified.
1166
+ * @returns A normalized store options object.
1167
+ */
1168
+ export declare const normalizeStoreOptions: <State>(option: StoreOptions<State> | undefined, name: string, defaultSnapshotMode?: SnapshotMode) => NormalizedOptions;
1169
+
1170
+ export declare const normalizeStoreRegistryScope: (scope: string) => string;
1171
+
1172
+ export declare const noSignalWarned: Set<string>;
1173
+
1174
+ export declare const notify: (name: string) => void;
1175
+
1176
+ export declare type NotifyState = {
1177
+ pendingNotifications: Set<string>;
1178
+ pendingBuffer: string[];
1179
+ orderedNames: string[];
1180
+ notifyScheduled: boolean;
1181
+ batchDepth: number;
1182
+ };
1183
+
1184
+ declare const parsePath: (path: PathInput) => string[];
1185
+ export { parsePath }
1186
+ export { parsePath as parsePath_alias_1 }
1187
+
1188
+ export declare const parseResponseBody: (response: Response, responseType: FetchOptions["responseType"]) => Promise<unknown>;
1189
+
1190
+ declare type PartialDeep<T> = T extends Primitive ? T : unknown extends T ? T : {
1191
+ [K in keyof T]?: PartialDeep<T[K]>;
1192
+ };
1193
+ export { PartialDeep }
1194
+ export { PartialDeep as PartialDeep_alias_1 }
1195
+ export { PartialDeep as PartialDeep_alias_2 }
1196
+ export { PartialDeep as PartialDeep_alias_3 }
1197
+ export { PartialDeep as PartialDeep_alias_4 }
1198
+
1199
+ declare type Path<T, Depth extends number = 10> = PathInternal<T, Depth>;
1200
+ export { Path }
1201
+ export { Path as Path_alias_1 }
1202
+ export { Path as Path_alias_2 }
1203
+ export { Path as Path_alias_3 }
1204
+ export { Path as Path_alias_4 }
1205
+
1206
+ declare type PathDepth<T, Depth extends number> = PathInternal<T, Depth>;
1207
+ export { PathDepth }
1208
+ export { PathDepth as PathDepth_alias_1 }
1209
+ export { PathDepth as PathDepth_alias_2 }
1210
+
1211
+ declare type PathInput = string | readonly string[] | string[];
1212
+ export { PathInput }
1213
+ export { PathInput as PathInput_alias_1 }
1214
+
1215
+ declare type PathInternal<T, Depth extends number> = Depth extends 0 ? never : T extends Primitive ? never : {
1216
+ [K in keyof T & (string | number)]: T[K] extends Primitive | Array<unknown> ? `${K}` : `${K}` | `${K}.${PathInternal<T[K], PrevDepth[Depth]>}`;
1217
+ }[keyof T & (string | number)];
1218
+
1219
+ declare type PathSafetyVerdict = {
1220
+ ok: true;
1221
+ } | {
1222
+ ok: false;
1223
+ reason: string;
1224
+ };
1225
+
1226
+ declare const pathValidationCache: Map<string, PathValidationCacheNode>;
1227
+ export { pathValidationCache }
1228
+ export { pathValidationCache as pathValidationCache_alias_1 }
1229
+
1230
+ declare type PathValidationCacheNode = {
1231
+ children: Map<string, PathValidationCacheNode>;
1232
+ verdicts?: Map<SupportedType, PathSafetyVerdict>;
1233
+ };
1234
+
1235
+ declare type PathValue<T, P extends Path<T>> = P extends `${infer K}.${infer Rest}` ? K extends keyof T ? Rest extends Path<T[K]> ? PathValue<T[K], Rest> : never : never : P extends keyof T ? T[P] : never;
1236
+ export { PathValue }
1237
+ export { PathValue as PathValue_alias_1 }
1238
+ export { PathValue as PathValue_alias_2 }
1239
+ export { PathValue as PathValue_alias_3 }
1240
+ export { PathValue as PathValue_alias_4 }
1241
+
1242
+ declare interface PersistConfig {
1243
+ driver: PersistDriver;
1244
+ key: string;
1245
+ serialize: (v: unknown) => string;
1246
+ deserialize: (v: string) => unknown;
1247
+ encrypt: (v: string) => string;
1248
+ decrypt: (v: string) => string;
1249
+ encryptAsync?: (v: string) => Promise<string>;
1250
+ decryptAsync?: (v: string) => Promise<string>;
1251
+ allowPlaintext?: boolean;
1252
+ sensitiveData?: boolean;
1253
+ checksum: "hash" | "none" | "sha256";
1254
+ onMigrationFail?: "reset" | "keep" | ((state: unknown) => unknown);
1255
+ onStorageCleared?: (info: {
1256
+ name: string;
1257
+ key: string;
1258
+ reason: "clear" | "remove" | "missing";
1259
+ }) => void;
1260
+ }
1261
+ export { PersistConfig }
1262
+ export { PersistConfig as PersistConfig_alias_1 }
1263
+
1264
+ export declare interface PersistDriver {
1265
+ getItem?: (k: string) => string | null | Promise<string | null>;
1266
+ setItem?: (k: string, v: string) => void | Promise<void>;
1267
+ removeItem?: (k: string) => void | Promise<void>;
1268
+ [key: string]: unknown;
1269
+ }
1270
+
1271
+ export declare type PersistInFlight = Record<string, Promise<void> | null>;
1272
+
1273
+ declare const persistLoad: (args: PersistLoadArgs) => boolean | Promise<boolean>;
1274
+ export { persistLoad }
1275
+ export { persistLoad as persistLoad_alias_1 }
1276
+
1277
+ export declare type PersistLoadArgs = {
1278
+ name: string;
1279
+ silent?: boolean;
1280
+ getMeta: () => PersistMeta | undefined;
1281
+ getInitialState: () => StoreValue_alias_4;
1282
+ applyFeatureState: (value: StoreValue_alias_4, updatedAtMs?: number) => void;
1283
+ shouldApply?: () => boolean;
1284
+ reportStoreError: (name: string, message: string) => void;
1285
+ validate: (next: StoreValue_alias_4) => {
1286
+ ok: boolean;
1287
+ value?: StoreValue_alias_4;
1288
+ };
1289
+ log: (message: string) => void;
1290
+ hashState: (value: unknown) => number;
1291
+ deepClone: <T>(value: T) => T;
1292
+ sanitize: (value: unknown) => unknown;
1293
+ };
1294
+
1295
+ export declare type PersistMeta = {
1296
+ version: number;
1297
+ updatedAt: string;
1298
+ updatedAtMs?: number;
1299
+ options: {
1300
+ persist: PersistConfig | null;
1301
+ migrations: Record<number, (state: any) => any>;
1302
+ onError?: (err: string) => void;
1303
+ };
1304
+ };
1305
+
1306
+ declare interface PersistOptions<State = StoreValue_alias_4> {
1307
+ driver?: PersistDriver;
1308
+ storage?: PersistDriver;
1309
+ key?: string;
1310
+ serialize?: (v: unknown) => string;
1311
+ deserialize?: (v: string) => unknown;
1312
+ /**
1313
+ * Optional encryption hook for persisted payloads.
1314
+ *
1315
+ * Default is identity (no encryption). Data is stored in plaintext.
1316
+ */
1317
+ encrypt?: (v: string) => string;
1318
+ /**
1319
+ * Optional async encryption hook for persisted payloads.
1320
+ *
1321
+ * When provided, persistence will encrypt in the background and hydrate asynchronously.
1322
+ */
1323
+ encryptAsync?: (v: string) => Promise<string>;
1324
+ /**
1325
+ * Optional decryption hook for persisted payloads.
1326
+ *
1327
+ * Default is identity (no encryption). Data is stored in plaintext.
1328
+ */
1329
+ decrypt?: (v: string) => string;
1330
+ /**
1331
+ * Optional async decryption hook for persisted payloads.
1332
+ *
1333
+ * When provided, persistence will hydrate asynchronously after store creation.
1334
+ */
1335
+ decryptAsync?: (v: string) => Promise<string>;
1336
+ /**
1337
+ * Explicitly allow plaintext persistence when encrypt/decrypt are identity.
1338
+ *
1339
+ * In production builds, plaintext persistence is blocked unless this is true.
1340
+ */
1341
+ allowPlaintext?: boolean;
1342
+ /**
1343
+ * Marks this store's persisted data as sensitive (secrets/PII).
1344
+ *
1345
+ * When `true`, stroid throws at store creation time unless a non-identity
1346
+ * `encrypt` hook is provided.
1347
+ */
1348
+ sensitiveData?: boolean;
1349
+ /**
1350
+ * Integrity check mode for persisted payloads.
1351
+ * - "hash" (default): store and validate a checksum.
1352
+ * - "none": skip checksum generation/validation.
1353
+ * - "sha256": store a SHA-256 hash for stronger tamper detection (may be async in browsers).
1354
+ */
1355
+ checksum?: "hash" | "none" | "sha256";
1356
+ version?: number;
1357
+ migrations?: Record<number, (state: State) => State>;
1358
+ onMigrationFail?: "reset" | "keep" | ((state: unknown) => unknown);
1359
+ onStorageCleared?: (info: {
1360
+ name: string;
1361
+ key: string;
1362
+ reason: "clear" | "remove" | "missing";
1363
+ }) => void;
1364
+ }
1365
+ export { PersistOptions }
1366
+ export { PersistOptions as PersistOptions_alias_1 }
1367
+ export { PersistOptions as PersistOptions_alias_2 }
1368
+
1369
+ declare const persistSave: (args: PersistSaveArgs) => void;
1370
+ export { persistSave }
1371
+ export { persistSave as persistSave_alias_1 }
1372
+
1373
+ export declare type PersistSaveArgs = {
1374
+ name: string;
1375
+ persistTimers: PersistTimers;
1376
+ persistInFlight: PersistInFlight;
1377
+ persistSequence: PersistSequence;
1378
+ persistWatchState: PersistWatchState;
1379
+ plaintextWarningsIssued: Set<string>;
1380
+ exists: () => boolean;
1381
+ getMeta: () => PersistMeta | undefined;
1382
+ getStoreValue: () => StoreValue_alias_4;
1383
+ reportStoreError: (name: string, message: string) => void;
1384
+ hashState: (value: unknown) => number;
1385
+ };
1386
+
1387
+ export declare type PersistSequence = Record<string, number>;
1388
+
1389
+ declare type PersistTimers = Record<string, ReturnType<typeof setTimeout>>;
1390
+ export { PersistTimers }
1391
+ export { PersistTimers as PersistTimers_alias_1 }
1392
+
1393
+ declare type PersistWatchEntry = {
1394
+ lastPresent: boolean;
1395
+ dispose: () => void;
1396
+ };
1397
+ export { PersistWatchEntry }
1398
+ export { PersistWatchEntry as PersistWatchEntry_alias_1 }
1399
+
1400
+ declare type PersistWatchState = Record<string, PersistWatchEntry>;
1401
+ export { PersistWatchState }
1402
+ export { PersistWatchState as PersistWatchState_alias_1 }
1403
+
1404
+ declare type PrevDepth = [never, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
1405
+
1406
+ /**
1407
+ * @module store-lifecycle/types
1408
+ *
1409
+ * LAYER: Store lifecycle
1410
+ * OWNS: Module-level behavior and exports for store-lifecycle/types.
1411
+ *
1412
+ * Consumers: Internal imports and public API.
1413
+ */
1414
+ declare type Primitive = string | number | boolean | bigint | symbol | null | undefined;
1415
+
1416
+ declare const produceClone: <T>(base: T, recipe: (draft: T) => void) => T;
1417
+ export { produceClone }
1418
+ export { produceClone as produceClone_alias_1 }
1419
+
1420
+ export declare const pruneAsyncCache: (name: string) => void;
1421
+
1422
+ export declare const pruneRateCounters: (nowTs: number) => void;
1423
+
1424
+ export declare const pushHistory: ({ name, action, prev, next, history, historyLimit, applyRedactor, deepClone, }: {
1425
+ name: string;
1426
+ action: string;
1427
+ prev: StoreValue_alias_4;
1428
+ next: StoreValue_alias_4;
1429
+ history: Record<string, HistoryEntry[]>;
1430
+ historyLimit: number;
1431
+ applyRedactor: (value: StoreValue_alias_4) => StoreValue_alias_4;
1432
+ deepClone: <T>(value: T) => T;
1433
+ }) => void;
1434
+
1435
+ declare const qualifyName: (raw: string) => string;
1436
+ export { qualifyName }
1437
+ export { qualifyName as qualifyName_alias_1 }
1438
+
1439
+ export declare namespace queryIntegrations {
1440
+ export {
1441
+ reactQueryKey,
1442
+ createReactQueryFetcher,
1443
+ swrKey,
1444
+ createSwrFetcher
1445
+ }
1446
+ }
1447
+
1448
+ export declare const RATE_MAX = 100;
1449
+
1450
+ export declare const RATE_WINDOW_MS = 1000;
1451
+
1452
+ export declare const rateCount: Record<string, number>;
1453
+
1454
+ export declare const ratePruneState: {
1455
+ lastAt: number;
1456
+ };
1457
+
1458
+ export declare const rateWindowStart: Record<string, number>;
1459
+
1460
+ export declare const reactQueryKey: (storeName: StoreTarget, cacheKey?: string | number) => (string | number)[];
1461
+
1462
+ declare function refetchStore<Name extends string, State>(name: StoreDefinition<Name, State>): Promise<unknown>;
1463
+
1464
+ declare function refetchStore<Name extends string, State>(name: StoreKey<Name, State>): Promise<unknown>;
1465
+
1466
+ declare function refetchStore<Name extends StoreName>(name: Name): Promise<unknown>;
1467
+ export { refetchStore }
1468
+ export { refetchStore as refetchStore_alias_1 }
1469
+
1470
+ export declare const registerComputed: (name: string, deps: string[], compute: (...args: unknown[]) => unknown) => boolean;
1471
+
1472
+ export declare const registerDevtoolsFeature: () => void;
1473
+
1474
+ declare type RegisteredStoreMap = StoreStateMap & StrictStoreMap;
1475
+
1476
+ export declare const registerPersistFeature: () => void;
1477
+
1478
+ export declare const registerRateHit: (cacheSlot: string, nowTs: number) => boolean;
1479
+
1480
+ export declare const registerStoreCleanup: (name: string, fn: () => void) => void;
1481
+
1482
+ declare const registerStoreFeature: (name: FeatureName, factory: StoreFeatureFactory) => void;
1483
+ export { registerStoreFeature }
1484
+ export { registerStoreFeature as registerStoreFeature_alias_1 }
1485
+
1486
+ export declare const registerSyncFeature: () => void;
1487
+
1488
+ export declare const registerTestResetHook: (name: string, fn: () => void, order?: number) => void;
1489
+
1490
+ export declare const registerTransactionCommit: (fn: () => void) => void;
1491
+
1492
+ export declare interface RegistryRunner {
1493
+ run<T>(registry: StoreRegistry, fn: () => T): T;
1494
+ get(): StoreRegistry | null;
1495
+ enterWith?: (registry: StoreRegistry) => void;
1496
+ }
1497
+
1498
+ export declare type RegistrySnapshotEntry = {
1499
+ version: number;
1500
+ snapshot: RegistryStoreValue | null;
1501
+ };
1502
+
1503
+ export declare type RegistryStoreValue = unknown;
1504
+
1505
+ export declare type RegistrySubscriber = (value: RegistryStoreValue | null) => void;
1506
+
1507
+ declare function replaceStore<Name extends string, State>(name: StoreDefinition<Name, State>, value: State): WriteResult;
1508
+
1509
+ declare function replaceStore<Name extends string, State>(name: StoreKey<Name, State>, value: State): WriteResult;
1510
+
1511
+ declare function replaceStore<Name extends StoreName>(name: Name, value: StateFor<Name>): WriteResult;
1512
+ export { replaceStore }
1513
+ export { replaceStore as replaceStore_alias_1 }
1514
+ export { replaceStore as replaceStore_alias_2 }
1515
+
1516
+ export declare const reportAsyncUsageError: (name: string, message: string, onError?: (message: string) => void) => null;
1517
+
1518
+ export declare const reportIssue: (message: string, options?: IssueOptions) => void;
1519
+
1520
+ declare const reportStoreCreationError: (message: string, onError?: (message: string) => void) => void;
1521
+ export { reportStoreCreationError }
1522
+ export { reportStoreCreationError as reportStoreCreationError_alias_1 }
1523
+
1524
+ export declare const reportStoreCreationIssue: (message: string, onError?: (message: string) => void, options?: {
1525
+ severity?: IssueSeverity;
1526
+ visibility?: IssueVisibility;
1527
+ }) => void;
1528
+
1529
+ declare const reportStoreCreationWarning: (message: string, onError?: (message: string) => void, visibility?: IssueVisibility) => void;
1530
+ export { reportStoreCreationWarning }
1531
+ export { reportStoreCreationWarning as reportStoreCreationWarning_alias_1 }
1532
+
1533
+ declare const reportStoreError: (name: string, message: string) => void;
1534
+ export { reportStoreError }
1535
+ export { reportStoreError as reportStoreError_alias_1 }
1536
+
1537
+ export declare const reportStoreIssue: (name: string, message: string, options?: {
1538
+ severity?: IssueSeverity;
1539
+ visibility?: IssueVisibility;
1540
+ }) => void;
1541
+
1542
+ declare const reportStoreWarning: (name: string, message: string, visibility?: IssueVisibility) => void;
1543
+ export { reportStoreWarning }
1544
+ export { reportStoreWarning as reportStoreWarning_alias_1 }
1545
+
1546
+ declare type RequestHydrateOptions<StateMap> = Partial<{
1547
+ [K in RequestStoreName<StateMap>]: StoreOptions<RequestStoreValue<StateMap, K>>;
1548
+ }> & {
1549
+ default?: StoreOptions;
1550
+ };
1551
+
1552
+ declare type RequestSnapshot<StateMap> = Partial<{
1553
+ [K in RequestStoreName<StateMap>]: RequestStoreValue<StateMap, K>;
1554
+ }>;
1555
+
1556
+ export declare type RequestStoreApi<StateMap extends StoreStateMap = StoreStateMap> = {
1557
+ create: <Name extends RequestStoreName<StateMap>>(name: Name, data: RequestStoreValue<StateMap, Name>, options?: StoreOptions<RequestStoreValue<StateMap, Name>>) => RequestStoreValue<StateMap, Name>;
1558
+ set: <Name extends RequestStoreName<StateMap>>(name: Name, updater: RequestStoreValue<StateMap, Name> | ((draft: RequestStoreValue<StateMap, Name>) => void)) => RequestStoreValue<StateMap, Name>;
1559
+ get: <Name extends RequestStoreName<StateMap>>(name: Name) => RequestStoreValue<StateMap, Name> | undefined;
1560
+ };
1561
+
1562
+ declare type RequestStoreContext<StateMap extends StoreStateMap> = {
1563
+ snapshot: () => RequestSnapshot<StateMap>;
1564
+ hydrate: <T>(renderFn: () => T, options?: RequestHydrateOptions<StateMap>) => T;
1565
+ };
1566
+
1567
+ declare type RequestStoreName<StateMap> = keyof StateMap extends never ? string : keyof StateMap & string;
1568
+
1569
+ declare type RequestStoreValue<StateMap, Name extends RequestStoreName<StateMap>> = Name extends keyof StateMap ? StateMap[Name] : unknown;
1570
+
1571
+ export declare const requestVersion: Record<string, number>;
1572
+
1573
+ export declare const reserveRequestVersion: (cacheSlot: string) => number;
1574
+
1575
+ export declare const resetAllStoreRegistriesForTests: () => void;
1576
+
1577
+ export declare const resetAllStoresForTest: () => void;
1578
+
1579
+ export declare const resetAsyncRegistry: (registry: AsyncRegistry) => void;
1580
+
1581
+ export declare const resetAsyncState: () => void;
1582
+
1583
+ declare const _resetAsyncStateForTests: () => void;
1584
+ export { _resetAsyncStateForTests }
1585
+ export { _resetAsyncStateForTests as _resetAsyncStateForTests_alias_1 }
1586
+
1587
+ export declare const resetBroadUseStoreWarnings: () => void;
1588
+
1589
+ declare const _resetComputedForTests: () => void;
1590
+ export { _resetComputedForTests }
1591
+ export { _resetComputedForTests as _resetComputedForTests_alias_1 }
1592
+
1593
+ declare const resetConfig: () => void;
1594
+ export { resetConfig }
1595
+ export { resetConfig as resetConfig_alias_1 }
1596
+
1597
+ export declare const _resetConfigForTests: () => void;
1598
+
1599
+ declare const resetFeaturesForTests: () => void;
1600
+ export { resetFeaturesForTests }
1601
+ export { resetFeaturesForTests as resetFeaturesForTests_alias_1 }
1602
+
1603
+ /**
1604
+ * Resets the internal set of legacy options that have been warned
1605
+ * about. Used for testing purposes to prevent warnings from leaking
1606
+ * between tests.
1607
+ */
1608
+ export declare const resetLegacyOptionDeprecationWarningsForTests: () => void;
1609
+
1610
+ export declare const resetMissingUseStoreWarnings: () => void;
1611
+
1612
+ export declare const resetNotifyStateForTests: () => void;
1613
+
1614
+ export declare const resetPathValidationCache: (registry: object) => void;
1615
+
1616
+ export declare const resetRegisteredStoreFeaturesForTests: () => void;
1617
+
1618
+ declare const resetSsrWarningFlag: () => void;
1619
+ export { resetSsrWarningFlag }
1620
+ export { resetSsrWarningFlag as resetSsrWarningFlag_alias_1 }
1621
+
1622
+ declare function resetStore<Name extends string, State>(name: StoreDefinition<Name, State>): WriteResult;
1623
+
1624
+ declare function resetStore<Name extends string, State>(name: StoreKey<Name, State>): WriteResult;
1625
+
1626
+ declare function resetStore<Name extends StoreName>(name: Name): WriteResult;
1627
+ export { resetStore }
1628
+ export { resetStore as resetStore_alias_1 }
1629
+ export { resetStore as resetStore_alias_2 }
1630
+
1631
+ declare type ResolvedConfig = {
1632
+ logSink: LogSink;
1633
+ flush: Required<FlushConfig>;
1634
+ revalidateOnFocus: Required<RevalidateOnFocusConfig>;
1635
+ namespace: string;
1636
+ strictMissingFeatures: boolean;
1637
+ assertRuntime: boolean;
1638
+ strictMutatorReturns: boolean;
1639
+ asyncAutoCreate: boolean;
1640
+ asyncCloneResult: AsyncCloneMode;
1641
+ defaultSnapshotMode: SnapshotMode;
1642
+ strictAsyncUsageErrors: boolean;
1643
+ middleware: Array<(ctx: MiddlewareCtx) => StoreValue_alias_4 | void>;
1644
+ allowUntrustedHydration: boolean;
1645
+ mutatorProduce?: <T>(base: T, recipe: (draft: T) => void) => T;
1646
+ };
1647
+
1648
+ declare const resolveFeatureAvailability: (name: string, options: NormalizedOptions) => NormalizedOptions;
1649
+ export { resolveFeatureAvailability }
1650
+ export { resolveFeatureAvailability as resolveFeatureAvailability_alias_1 }
1651
+
1652
+ export declare const resolveScope: (scopeOrRegistry?: string | ReturnType<typeof getStoreRegistry>) => {
1653
+ scope: string;
1654
+ registry: StoreRegistry;
1655
+ };
1656
+
1657
+ export declare const resolveUpdatedAtMs: ({ value, fallbackMs, onInvalid, }: {
1658
+ value: unknown;
1659
+ fallbackMs?: number;
1660
+ onInvalid?: () => void;
1661
+ }) => number;
1662
+
1663
+ export declare const revalidateHandlers: Record<string, () => void>;
1664
+
1665
+ export declare const revalidateKeys: Set<string>;
1666
+
1667
+ declare type RevalidateOnFocusConfig = {
1668
+ debounceMs?: number;
1669
+ maxConcurrent?: number;
1670
+ staggerMs?: number;
1671
+ };
1672
+ export { RevalidateOnFocusConfig }
1673
+ export { RevalidateOnFocusConfig as RevalidateOnFocusConfig_alias_1 }
1674
+
1675
+ export declare const runAsyncHook: (name: string, label: "onSuccess" | "onError", fn: ((value: any) => void) | undefined, value: unknown) => void;
1676
+
1677
+ declare const runFeatureCreateHooks: (name: string, notify: (name: string) => void) => void;
1678
+ export { runFeatureCreateHooks }
1679
+ export { runFeatureCreateHooks as runFeatureCreateHooks_alias_1 }
1680
+
1681
+ declare const runFeatureDeleteHooks: (name: string, prev: StoreValue, notify: (name: string) => void) => void;
1682
+ export { runFeatureDeleteHooks }
1683
+ export { runFeatureDeleteHooks as runFeatureDeleteHooks_alias_1 }
1684
+
1685
+ declare const runFeatureWriteHooks: (name: string, action: string, prev: StoreValue, next: StoreValue, notify: (name: string) => void) => void;
1686
+ export { runFeatureWriteHooks }
1687
+ export { runFeatureWriteHooks as runFeatureWriteHooks_alias_1 }
1688
+
1689
+ export declare const runMiddleware: ({ name, payload, middlewares, reportIssue, warn, }: {
1690
+ name: string;
1691
+ payload: {
1692
+ action: string;
1693
+ prev: StoreValue_alias_4;
1694
+ next: StoreValue_alias_4;
1695
+ path: unknown;
1696
+ };
1697
+ middlewares: Array<(ctx: {
1698
+ action: string;
1699
+ name: string;
1700
+ prev: StoreValue_alias_4;
1701
+ next: StoreValue_alias_4;
1702
+ path: unknown;
1703
+ }) => StoreValue_alias_4 | void>;
1704
+ reportIssue: LifecycleIssueReporter;
1705
+ warn: (message: string) => void;
1706
+ }) => StoreValue_alias_4 | typeof MIDDLEWARE_ABORT;
1707
+
1708
+ declare const runMiddlewareForStore: (name: string, payload: {
1709
+ action: string;
1710
+ prev: StoreValue;
1711
+ next: StoreValue;
1712
+ path: unknown;
1713
+ }) => StoreValue | typeof MIDDLEWARE_ABORT;
1714
+ export { runMiddlewareForStore }
1715
+ export { runMiddlewareForStore as runMiddlewareForStore_alias_1 }
1716
+
1717
+ declare const runSchemaValidation: (schema: unknown, value: unknown) => {
1718
+ ok: boolean;
1719
+ data?: unknown;
1720
+ error?: unknown;
1721
+ };
1722
+ export { runSchemaValidation }
1723
+ export { runSchemaValidation as runSchemaValidation_alias_1 }
1724
+
1725
+ export declare const runStoreHook: ({ name, label, fn, args, reportIssue, }: {
1726
+ name: string;
1727
+ label: "onCreate" | "onSet" | "onReset" | "onDelete";
1728
+ fn: ((...args: any[]) => void) | undefined;
1729
+ args: any[];
1730
+ reportIssue: LifecycleIssueReporter;
1731
+ }) => void;
1732
+
1733
+ declare const runStoreHookSafe: (name: string, label: "onCreate" | "onSet" | "onReset" | "onDelete", fn: ((...args: any[]) => void) | undefined, args: any[]) => void;
1734
+ export { runStoreHookSafe }
1735
+ export { runStoreHookSafe as runStoreHookSafe_alias_1 }
1736
+
1737
+ export declare const runTestResets: () => void;
1738
+
1739
+ declare const runValidation: (name: string, value: StoreValue, validate: ValidateOption | undefined, onError?: (message: string) => void) => {
1740
+ ok: true;
1741
+ value: StoreValue;
1742
+ } | {
1743
+ ok: false;
1744
+ };
1745
+ export { runValidation }
1746
+ export { runValidation as runValidation_alias_1 }
1747
+
1748
+ export declare const runWithRegistry: <T>(registry: StoreRegistry, fn: () => T) => T;
1749
+
1750
+ declare const sanitize: (value: unknown) => unknown;
1751
+ export { sanitize }
1752
+ export { sanitize as sanitize_alias_1 }
1753
+
1754
+ declare const sanitizeValue: (name: string, value: unknown, onError?: (message: string) => void, options?: {
1755
+ reuseInput?: boolean;
1756
+ }) => {
1757
+ ok: true;
1758
+ value: StoreValue;
1759
+ } | {
1760
+ ok: false;
1761
+ };
1762
+ export { sanitizeValue }
1763
+ export { sanitizeValue as sanitizeValue_alias_1 }
1764
+
1765
+ export declare const scheduleRatePrune: (delayMs?: number) => void;
1766
+
1767
+ export declare type SchemaValidateOption = {
1768
+ safeParse: (value: unknown) => {
1769
+ success: true;
1770
+ data: unknown;
1771
+ } | {
1772
+ success: false;
1773
+ error?: unknown;
1774
+ };
1775
+ } | {
1776
+ parse: (value: unknown) => unknown;
1777
+ } | {
1778
+ validateSync: (value: unknown) => unknown;
1779
+ } | {
1780
+ isValidSync: (value: unknown) => boolean;
1781
+ } | {
1782
+ validate: (value: unknown) => unknown;
1783
+ };
1784
+
1785
+ declare type SelectorSubscriber = (value: StoreValue | null) => void;
1786
+
1787
+ export declare const sendDevtools: ({ name, action, force, devtools, enabled, stores, applyRedactor, }: {
1788
+ name: string;
1789
+ action: string;
1790
+ force?: boolean;
1791
+ devtools: any;
1792
+ enabled: boolean;
1793
+ stores: Record<string, StoreValue_alias_4>;
1794
+ applyRedactor: (value: StoreValue_alias_4) => StoreValue_alias_4;
1795
+ }) => void;
1796
+
1797
+ declare const setByPath: <T extends Record<string, unknown> | unknown[]>(obj: T, path: PathInput, value: unknown) => T;
1798
+ export { setByPath }
1799
+ export { setByPath as setByPath_alias_1 }
1800
+
1801
+ export declare const setComputedOrderResolver: (next: ComputedOrderResolver | null) => void;
1802
+
1803
+ export declare const setFeatureRegistrationHook: (hook: ((name: FeatureName, factory: StoreFeatureFactory) => void) | null) => void;
1804
+
1805
+ export declare const setInflightEntry: (cacheSlot: string, entry: InflightEntry) => void;
1806
+
1807
+ export declare const setNamespace: (ns: string) => void;
1808
+
1809
+ export declare function setPathCacheInvalidator(fn: (name: string) => void): void;
1810
+
1811
+ export declare const setPersistPresence: (persistWatchState: PersistWatchState, name: string, present: boolean) => void;
1812
+
1813
+ export declare const setRegistryContext: (scope: string, registry: StoreRegistry) => void;
1814
+
1815
+ export declare const setRegistryScope: (scope: string) => void;
1816
+
1817
+ declare function setStore<Name extends string, State, P extends Path<State>>(name: StoreDefinition<Name, State>, path: P, value: PathValue<State, P>): WriteResult;
1818
+
1819
+ declare function setStore<Name extends string, State>(name: StoreDefinition<Name, State>, mutator: (draft: State) => void): WriteResult;
1820
+
1821
+ declare function setStore<Name extends string, State>(name: StoreDefinition<Name, State>, data: PartialDeep<State>): WriteResult;
1822
+
1823
+ declare function setStore<Name extends string, State, P extends Path<State>>(name: StoreKey<Name, State>, path: P, value: PathValue<State, P>): WriteResult;
1824
+
1825
+ declare function setStore<Name extends string, State>(name: StoreKey<Name, State>, mutator: (draft: State) => void): WriteResult;
1826
+
1827
+ declare function setStore<Name extends string, State>(name: StoreKey<Name, State>, data: PartialDeep<State>): WriteResult;
1828
+
1829
+ declare function setStore<Name extends StoreName, P extends StorePathFor<Name>>(name: Name, path: P, value: StorePathValueFor<Name, P>): WriteResult;
1830
+
1831
+ declare function setStore<Name extends StoreName>(name: Name, mutator: (draft: StateFor<Name>) => void): WriteResult;
1832
+
1833
+ declare function setStore<Name extends StoreName>(name: Name, data: PartialDeep<StateFor<Name>>): WriteResult;
1834
+ export { setStore }
1835
+ export { setStore as setStore_alias_1 }
1836
+ export { setStore as setStore_alias_2 }
1837
+ export { setStore as setStore_alias_3 }
1838
+ export { setStore as setStore_alias_4 }
1839
+
1840
+ declare const setStoreBatch: (fn: () => unknown) => void;
1841
+ export { setStoreBatch }
1842
+ export { setStoreBatch as setStoreBatch_alias_1 }
1843
+ export { setStoreBatch as setStoreBatch_alias_2 }
1844
+
1845
+ declare const setStoreValueInternal: (name: string, value: StoreValue) => void;
1846
+ export { setStoreValueInternal }
1847
+ export { setStoreValueInternal as setStoreValueInternal_alias_1 }
1848
+
1849
+ declare const setupPersistWatch: ({ name, persistConfig, persistWatchState, }: {
1850
+ name: string;
1851
+ persistConfig: PersistConfig | null | undefined;
1852
+ persistWatchState: PersistWatchState;
1853
+ }) => void;
1854
+ export { setupPersistWatch }
1855
+ export { setupPersistWatch as setupPersistWatch_alias_1 }
1856
+
1857
+ export declare const setupSync: ({ name, syncOption, syncChannels, syncClocks, syncVersions, syncWindowCleanup, instanceId, getMeta, getAcceptedSyncVersion, getStoreValue, hasStoreEntry, notify, validate, reportStoreError, warn, setStoreValue, normalizeIncomingState, acceptIncomingSyncVersion, resolveSyncVersion, broadcastSync, }: {
1858
+ name: string;
1859
+ syncOption?: boolean | SyncOptions;
1860
+ syncChannels: SyncChannels;
1861
+ syncClocks: SyncClocks;
1862
+ syncVersions: SyncVersions;
1863
+ syncWindowCleanup: SyncWindowCleanup;
1864
+ instanceId: string;
1865
+ getMeta: (name: string) => SyncMeta | undefined;
1866
+ getAcceptedSyncVersion: (name: string) => SyncVersion | undefined;
1867
+ getStoreValue: (name: string) => StoreValue_alias_4;
1868
+ hasStoreEntry: (name: string) => boolean;
1869
+ notify: (name: string) => void;
1870
+ validate: (name: string, next: StoreValue_alias_4) => {
1871
+ ok: boolean;
1872
+ value?: StoreValue_alias_4;
1873
+ };
1874
+ reportStoreError: (name: string, message: string) => void;
1875
+ warn: (message: string) => void;
1876
+ setStoreValue: (name: string, value: StoreValue_alias_4) => void;
1877
+ normalizeIncomingState: (name: string, value: StoreValue_alias_4) => StoreValue_alias_4 | null;
1878
+ acceptIncomingSyncVersion: (name: string, updatedAtMs: number, incomingClock: number, source: string) => void;
1879
+ resolveSyncVersion: (name: string, updatedAtMs: number, incomingClock: number) => number;
1880
+ broadcastSync: (name: string) => void;
1881
+ }) => void;
1882
+
1883
+ declare const shallowClone: <T>(value: T) => T;
1884
+ export { shallowClone }
1885
+ export { shallowClone as shallowClone_alias_1 }
1886
+
1887
+ declare const shallowEqual: (a: unknown, b: unknown) => boolean;
1888
+ export { shallowEqual }
1889
+ export { shallowEqual as shallowEqual_alias_1 }
1890
+
1891
+ export declare const shapeWarned: Set<string>;
1892
+
1893
+ export declare const shouldUseCache: (cacheSlot: string, ttl?: number) => boolean;
1894
+
1895
+ declare const snapshotCache: Record<string, {
1896
+ version: number;
1897
+ snapshot: StoreValue | null;
1898
+ }>;
1899
+ export { snapshotCache }
1900
+ export { snapshotCache as snapshotCache_alias_1 }
1901
+
1902
+ declare type SnapshotMode = "deep" | "shallow" | "ref";
1903
+ export { SnapshotMode }
1904
+ export { SnapshotMode as SnapshotMode_alias_1 }
1905
+
1906
+ export declare const stageTransactionValue: (name: string, value: StoreValue) => void;
1907
+
1908
+ declare type StateFor<Name extends string> = Name extends keyof RegisteredStoreMap ? RegisteredStoreMap[Name] : StoreValue;
1909
+ export { StateFor }
1910
+ export { StateFor as StateFor_alias_1 }
1911
+ export { StateFor as StateFor_alias_2 }
1912
+ export { StateFor as StateFor_alias_3 }
1913
+ export { StateFor as StateFor_alias_4 }
1914
+
1915
+ /**
1916
+ * Helper to get an auto-completable, literal-typed store handle without creating it.
1917
+ *
1918
+ * Example:
1919
+ * const user = store("user");
1920
+ * setStore(user, "name", "Alex");
1921
+ */
1922
+ declare const store: <Name extends string, State = StoreValue>(name: Name) => StoreKey<Name, State>;
1923
+ export { store }
1924
+ export { store as store_alias_1 }
1925
+ export { store as store_alias_2 }
1926
+
1927
+ declare const storeAdmin: {
1928
+ deleteExistingStore: (name: string) => void;
1929
+ clearAllStores: () => string[];
1930
+ clearStores: (pattern?: string) => string[];
1931
+ reportStoreError: (name: string, message: string) => void;
1932
+ };
1933
+ export { storeAdmin }
1934
+ export { storeAdmin as storeAdmin_alias_1 }
1935
+
1936
+ export declare const storeCleanupFns: Record<string, Set<() => void>>;
1937
+
1938
+ declare interface StoreDefinition<Name extends string = string, State = StoreValue> {
1939
+ name: Name;
1940
+ state?: State;
1941
+ }
1942
+ export { StoreDefinition }
1943
+ export { StoreDefinition as StoreDefinition_alias_1 }
1944
+ export { StoreDefinition as StoreDefinition_alias_2 }
1945
+ export { StoreDefinition as StoreDefinition_alias_3 }
1946
+ export { StoreDefinition as StoreDefinition_alias_4 }
1947
+
1948
+ declare type StoreFeatureFactory = () => StoreFeatureRuntime;
1949
+ export { StoreFeatureFactory }
1950
+ export { StoreFeatureFactory as StoreFeatureFactory_alias_1 }
1951
+
1952
+ declare interface StoreFeatureMeta {
1953
+ createdAt: string;
1954
+ updatedAt: string;
1955
+ updatedAtMs: number;
1956
+ updateCount: number;
1957
+ version: number;
1958
+ metrics: FeatureMetrics;
1959
+ options: NormalizedOptions;
1960
+ }
1961
+ export { StoreFeatureMeta }
1962
+ export { StoreFeatureMeta as StoreFeatureMeta_alias_1 }
1963
+
1964
+ declare interface StoreFeatureRuntime {
1965
+ onStoreCreate?: (ctx: FeatureCreateContext) => void;
1966
+ onStoreWrite?: (ctx: FeatureWriteContext) => void;
1967
+ beforeStoreDelete?: (ctx: FeatureDeleteContext) => void;
1968
+ afterStoreDelete?: (ctx: FeatureDeleteContext) => void;
1969
+ resetAll?: () => void;
1970
+ api?: DevtoolsFeatureApi;
1971
+ }
1972
+ export { StoreFeatureRuntime }
1973
+ export { StoreFeatureRuntime as StoreFeatureRuntime_alias_1 }
1974
+
1975
+ declare type StoreKey<Name extends string = string, State = StoreValue> = StoreDefinition<Name, State> & {
1976
+ __store?: true;
1977
+ };
1978
+ export { StoreKey }
1979
+ export { StoreKey as StoreKey_alias_1 }
1980
+ export { StoreKey as StoreKey_alias_2 }
1981
+ export { StoreKey as StoreKey_alias_3 }
1982
+ export { StoreKey as StoreKey_alias_4 }
1983
+
1984
+ declare type StoreName = (keyof RegisteredStoreMap & string) | BrandedStoreName;
1985
+ export { StoreName }
1986
+ export { StoreName as StoreName_alias_1 }
1987
+ export { StoreName as StoreName_alias_2 }
1988
+ export { StoreName as StoreName_alias_3 }
1989
+ export { StoreName as StoreName_alias_4 }
1990
+
1991
+ declare const storeNameBrand: unique symbol;
1992
+
1993
+ declare interface StoreOptions<State = StoreValue_alias_4> {
1994
+ scope?: StoreScope;
1995
+ lazy?: boolean;
1996
+ /**
1997
+ * Allow `setStore(name, path, value)` to create missing **leaf** keys on object nodes.
1998
+ *
1999
+ * Default: `false` (strict path writes).
2000
+ *
2001
+ * Notes:
2002
+ * - Does not expand arrays (out-of-bounds indices are still rejected).
2003
+ * - Does not create missing intermediate objects for deep paths; define the shape up-front.
2004
+ */
2005
+ pathCreate?: boolean;
2006
+ validate?: ValidateOption<State>;
2007
+ persist?: boolean | string | PersistOptions<State>;
2008
+ devtools?: boolean | DevtoolsOptions<State>;
2009
+ lifecycle?: LifecycleOptions<State>;
2010
+ middleware?: Array<(ctx: MiddlewareCtx) => StoreValue_alias_4 | void>;
2011
+ onSet?: (prev: State, next: State) => void;
2012
+ onReset?: (prev: State, next: State) => void;
2013
+ onDelete?: (prev: State) => void;
2014
+ onCreate?: (initial: State) => void;
2015
+ onError?: (err: string) => void;
2016
+ /** @deprecated use validate instead */
2017
+ validator?: (next: State) => boolean;
2018
+ /** @deprecated use validate instead */
2019
+ schema?: unknown;
2020
+ migrations?: Record<number, (state: State) => State>;
2021
+ version?: number;
2022
+ redactor?: (state: State) => State;
2023
+ historyLimit?: number;
2024
+ allowSSRGlobalStore?: boolean;
2025
+ sync?: boolean | SyncOptions;
2026
+ /**
2027
+ * Optional feature option bag for third-party plugins.
2028
+ * Keys are plugin names, values are plugin-specific options.
2029
+ */
2030
+ features?: FeatureOptions;
2031
+ /**
2032
+ * Snapshot cloning strategy used by subscriptions and selector snapshots.
2033
+ *
2034
+ * - "deep" (default): deep clone and dev-freeze snapshot values.
2035
+ * - "shallow": shallow clone (top-level) only; nested references are shared.
2036
+ * - "ref": return the live store reference (no cloning).
2037
+ */
2038
+ snapshot?: SnapshotMode;
2039
+ }
2040
+ export { StoreOptions }
2041
+ export { StoreOptions as StoreOptions_alias_1 }
2042
+ export { StoreOptions as StoreOptions_alias_2 }
2043
+
2044
+ declare type StorePathFor<Name extends StoreName> = IsStoreNameLoose extends true ? string | string[] : Path<StateFor<Name>>;
2045
+
2046
+ declare type StorePathValueFor<Name extends StoreName, P extends StorePathFor<Name>> = IsStoreNameLoose extends true ? unknown : (P extends Path<StateFor<Name>> ? PathValue<StateFor<Name>, P> : never);
2047
+
2048
+ export declare type StoreRegistry = {
2049
+ stores: Record<string, RegistryStoreValue>;
2050
+ subscribers: Record<string, Set<RegistrySubscriber>>;
2051
+ initialStates: Record<string, RegistryStoreValue>;
2052
+ initialFactories: Record<string, (() => RegistryStoreValue) | undefined>;
2053
+ metaEntries: Record<string, StoreFeatureMeta>;
2054
+ snapshotCache: Record<string, RegistrySnapshotEntry>;
2055
+ featureRuntimes: Map<FeatureName, StoreFeatureRuntime>;
2056
+ deletingStores: Set<string>;
2057
+ computedEntries: Record<string, ComputedEntry>;
2058
+ computedDependents: Record<string, Set<string>>;
2059
+ computedCleanups: Map<string, () => void>;
2060
+ transaction: TransactionState;
2061
+ async: AsyncRegistry;
2062
+ notify: NotifyState;
2063
+ };
2064
+
2065
+ declare const stores: Record<string, unknown>;
2066
+ export { stores }
2067
+ export { stores as stores_alias_1 }
2068
+
2069
+ export declare type StoreScope = "request" | "global" | "temp";
2070
+
2071
+ declare type StoreSnapshot<T> = T extends object ? Readonly<T> : T;
2072
+
2073
+ declare type StoreSnapshot_2<T> = T extends object ? Readonly<T> : T;
2074
+
2075
+ declare type StoreSnapshot_3<T> = T extends object ? Readonly<T> : T;
2076
+
2077
+ declare interface StoreStateMap {
2078
+ }
2079
+ export { StoreStateMap }
2080
+ export { StoreStateMap as StoreStateMap_alias_1 }
2081
+ export { StoreStateMap as StoreStateMap_alias_2 }
2082
+ export { StoreStateMap as StoreStateMap_alias_3 }
2083
+ export { StoreStateMap as StoreStateMap_alias_4 }
2084
+
2085
+ declare type StoreTarget = StoreDefinition<string, unknown> | StoreKey<string, unknown> | StoreName;
2086
+
2087
+ declare type StoreValue = unknown;
2088
+ export { StoreValue as SelectorStoreValue }
2089
+ export { StoreValue }
2090
+ export { StoreValue as StoreValue_alias_1 }
2091
+ export { StoreValue as StoreValue_alias_2 }
2092
+ export { StoreValue as StoreValue_alias_3 }
2093
+ export { StoreValue as StoreValue_alias_5 }
2094
+
2095
+ export declare type StoreValue_alias_4 = unknown;
2096
+
2097
+ declare interface StrictStoreMap {
2098
+ }
2099
+ export { StrictStoreMap }
2100
+ export { StrictStoreMap as StrictStoreMap_alias_1 }
2101
+ export { StrictStoreMap as StrictStoreMap_alias_2 }
2102
+ export { StrictStoreMap as StrictStoreMap_alias_3 }
2103
+ export { StrictStoreMap as StrictStoreMap_alias_4 }
2104
+
2105
+ declare type StroidConfig = {
2106
+ logSink?: LogSink;
2107
+ flush?: FlushConfig;
2108
+ revalidateOnFocus?: RevalidateOnFocusConfig;
2109
+ namespace?: string;
2110
+ strictMissingFeatures?: boolean;
2111
+ strictFeatures?: boolean;
2112
+ assertRuntime?: boolean;
2113
+ strictMutatorReturns?: boolean;
2114
+ asyncAutoCreate?: boolean;
2115
+ asyncCloneResult?: AsyncCloneMode;
2116
+ defaultSnapshotMode?: SnapshotMode;
2117
+ /**
2118
+ * Alias for defaultSnapshotMode.
2119
+ */
2120
+ snapshotStrategy?: SnapshotMode;
2121
+ /**
2122
+ * Throw on async usage errors instead of returning null.
2123
+ * Default: false (usage errors return null and call onError).
2124
+ */
2125
+ strictAsyncUsageErrors?: boolean;
2126
+ middleware?: Array<(ctx: MiddlewareCtx) => StoreValue_alias_4 | void>;
2127
+ /**
2128
+ * Allow hydrateStores to accept untrusted snapshots without explicit opt-in.
2129
+ * Default: false (hydration requires an explicit trust opt-in).
2130
+ */
2131
+ allowUntrustedHydration?: boolean;
2132
+ /**
2133
+ * Optional custom mutator engine (e.g. Immer's produce) to enable structural sharing.
2134
+ * You can pass the produce function directly or use "immer" with a global produce shim.
2135
+ */
2136
+ mutatorProduce?: (<T>(base: T, recipe: (draft: T) => void) => T) | "immer";
2137
+ };
2138
+ export { StroidConfig }
2139
+ export { StroidConfig as StroidConfig_alias_1 }
2140
+
2141
+ /** @deprecated Use subscribeStore instead. */
2142
+ declare const subscribe: (name: string, fn: Subscriber) => (() => void);
2143
+ export { subscribe }
2144
+ export { subscribe as subscribe_alias_1 }
2145
+
2146
+ /** @deprecated Use subscribeStore instead. */
2147
+ declare const subscribeInternal: (name: string, fn: Subscriber) => (() => void);
2148
+ export { subscribeInternal as _subscribe }
2149
+ export { subscribeInternal }
2150
+
2151
+ declare type Subscriber = (value: StoreValue | null) => void;
2152
+ export { Subscriber }
2153
+ export { Subscriber as Subscriber_alias_1 }
2154
+
2155
+ declare const subscribers: Record<string, Set<Subscriber>>;
2156
+ export { subscribers }
2157
+ export { subscribers as subscribers_alias_1 }
2158
+
2159
+ export declare const subscribeSelectorStore: (name: string, fn: SelectorSubscriber) => (() => void);
2160
+
2161
+ declare const subscribeStore: (name: string, fn: Subscriber) => (() => void);
2162
+ export { subscribeStore }
2163
+ export { subscribeStore as subscribeStore_alias_1 }
2164
+ export { subscribeStore as subscribeStore_alias_2 }
2165
+
2166
+ declare const subscribeWithSelector: <R>(name: string, selector: (state: any) => R, equality: ((a: R, b: R) => boolean) | undefined, listener: (next: R, prev: R) => void) => (() => void);
2167
+ export { subscribeWithSelector }
2168
+ export { subscribeWithSelector as subscribeWithSelector_alias_1 }
2169
+
2170
+ declare const suggestStoreName: (name: string, existingNames: string[]) => void;
2171
+ export { suggestStoreName }
2172
+ export { suggestStoreName as suggestStoreName_alias_1 }
2173
+
2174
+ declare const SUPPORTED_TYPES: readonly ["object", "array", "string", "number", "boolean", "null"];
2175
+
2176
+ declare type SupportedType = typeof SUPPORTED_TYPES[number] | "function" | "map" | "set" | "date" | "undefined" | "bigint" | "symbol";
2177
+ export { SupportedType }
2178
+ export { SupportedType as SupportedType_alias_1 }
2179
+
2180
+ export declare const swrKey: (storeName: StoreTarget, cacheKey?: string | number) => (string | number)[];
2181
+
2182
+ export declare type SyncChannels = Record<string, BroadcastChannel>;
2183
+
2184
+ export declare type SyncClocks = Record<string, number>;
2185
+
2186
+ export declare type SyncMessage = {
2187
+ v: number;
2188
+ protocol: number;
2189
+ type: "sync-request" | "sync-state";
2190
+ name: string;
2191
+ clock: number;
2192
+ source: string;
2193
+ updatedAt?: number;
2194
+ data?: StoreValue_alias_4;
2195
+ checksum?: number | null;
2196
+ auth?: unknown;
2197
+ token?: string;
2198
+ requestedAt?: number;
2199
+ };
2200
+
2201
+ declare type SyncMeta = {
2202
+ updatedAt: string;
2203
+ updatedAtMs?: number;
2204
+ updateCount: number;
2205
+ options: {
2206
+ sync?: boolean | SyncOptions;
2207
+ };
2208
+ };
2209
+
2210
+ declare interface SyncOptions {
2211
+ channel?: string;
2212
+ maxPayloadBytes?: number;
2213
+ /**
2214
+ * Optional shared token for lightweight cross-tab authentication.
2215
+ * When set, incoming sync messages without a matching token are rejected.
2216
+ */
2217
+ authToken?: string;
2218
+ conflictResolver?: (args: {
2219
+ local: StoreValue_alias_4;
2220
+ incoming: StoreValue_alias_4;
2221
+ localUpdated: number;
2222
+ incomingUpdated: number;
2223
+ }) => StoreValue_alias_4 | void;
2224
+ /**
2225
+ * Optional checksum mode for sync payloads.
2226
+ * - "hash" (default): include a checksum of the payload.
2227
+ * - "none": skip checksum generation.
2228
+ */
2229
+ checksum?: "hash" | "none";
2230
+ /**
2231
+ * Optional signer for sync payloads. The returned value is attached to the message as `auth`.
2232
+ */
2233
+ sign?: (payload: SyncMessage) => unknown;
2234
+ /**
2235
+ * Optional verifier for incoming sync payloads.
2236
+ * Return true to accept the message, false to reject it.
2237
+ */
2238
+ verify?: (payload: SyncMessage) => boolean;
2239
+ /**
2240
+ * Optional resolver for updatedAt timestamps when conflicts are resolved.
2241
+ */
2242
+ resolveUpdatedAt?: (args: {
2243
+ localUpdated: number;
2244
+ incomingUpdated: number | undefined;
2245
+ now: number;
2246
+ }) => number;
2247
+ }
2248
+ export { SyncOptions }
2249
+ export { SyncOptions as SyncOptions_alias_1 }
2250
+ export { SyncOptions as SyncOptions_alias_2 }
2251
+
2252
+ export declare type SyncVersion = {
2253
+ clock: number;
2254
+ updatedAt: number;
2255
+ source: string;
2256
+ };
2257
+
2258
+ export declare type SyncVersions = Record<string, SyncVersion>;
2259
+
2260
+ export declare type SyncWindowCleanup = Record<string, () => void>;
2261
+
2262
+ export declare const throwAsyncUsageError: (name: string, message: string, onError?: (message: string) => void) => never;
2263
+
2264
+ declare type TransactionSnapshotEntry = {
2265
+ source: RegistryStoreValue | null | undefined;
2266
+ snapshot: RegistryStoreValue | null;
2267
+ mode: TransactionSnapshotMode;
2268
+ };
2269
+
2270
+ declare type TransactionSnapshotMode = "deep" | "shallow" | "ref";
2271
+
2272
+ export declare type TransactionState = {
2273
+ depth: number;
2274
+ pending: Array<() => void>;
2275
+ stagedValues: Map<string, RegistryStoreValue>;
2276
+ snapshotCache: Map<string, TransactionSnapshotEntry>;
2277
+ failed: boolean;
2278
+ error?: Error;
2279
+ };
2280
+
2281
+ export declare const tryDedupeRequest: (name: string, cacheSlot: string, transform: FetchOptions["transform"] | undefined, onError?: (message: string) => void) => Promise<unknown> | null | undefined;
2282
+
2283
+ export declare const unregisterComputed: (name: string) => void;
2284
+
2285
+ declare type UnregisteredStoreName<Name extends string> = never;
2286
+ export { UnregisteredStoreName }
2287
+ export { UnregisteredStoreName as UnregisteredStoreName_alias_1 }
2288
+
2289
+ export declare const unregisterStoreCleanup: (name: string, fn: () => void) => void;
2290
+
2291
+ declare function useAsyncStore<Name extends string, State extends AsyncStoreState>(name: StoreDefinition<Name, State> | StoreKey<Name, State>): AsyncStoreSnapshot<AsyncDataFor<State>>;
2292
+
2293
+ declare function useAsyncStore<Name extends StoreName>(name: Name): AsyncStoreSnapshot<AsyncDataFor<StateFor<Name>>>;
2294
+ export { useAsyncStore }
2295
+ export { useAsyncStore as useAsyncStore_alias_1 }
2296
+
2297
+ declare function useAsyncStoreSuspense<Name extends string, State extends AsyncStoreState, T = AsyncDataFor<State>>(name: StoreDefinition<Name, State> | StoreKey<Name, State>, input?: FetchInput, options?: FetchOptions): T;
2298
+
2299
+ declare function useAsyncStoreSuspense<Name extends StoreName, T = AsyncDataFor<StateFor<Name>>>(name: Name, input?: FetchInput, options?: FetchOptions): T;
2300
+ export { useAsyncStoreSuspense }
2301
+ export { useAsyncStoreSuspense as useAsyncStoreSuspense_alias_1 }
2302
+
2303
+ declare function useFormStore<Name extends string, State, P extends Path<State>>(storeName: StoreDefinition<Name, State> | StoreKey<Name, State>, field: P): {
2304
+ value: StoreSnapshot_3<PathValue<State, P>> | null;
2305
+ onChange: (eOrValue: any) => void;
2306
+ };
2307
+
2308
+ declare function useFormStore<Name extends StoreName, P extends Path<StateFor<Name>>>(storeName: Name, field: P): {
2309
+ value: StoreSnapshot_3<PathValue<StateFor<Name>, P>> | null;
2310
+ onChange: (eOrValue: any) => void;
2311
+ };
2312
+ export { useFormStore }
2313
+ export { useFormStore as useFormStore_alias_1 }
2314
+
2315
+ declare const useRegistry: (scopeId: string) => void;
2316
+ export { useRegistry }
2317
+ export { useRegistry as useRegistry_alias_1 }
2318
+ export { useRegistry as useRegistry_alias_2 }
2319
+ export { useRegistry as useRegistry_alias_3 }
2320
+
2321
+ export declare const usesDefaultPersistCrypto: (fn: (v: string) => string) => boolean;
2322
+
2323
+ declare function useSelector<Name extends string, State, R>(storeName: StoreDefinition<Name, State> | StoreKey<Name, State>, selectorFn: (state: StoreSnapshot_2<State>) => R, equalityFn?: (a: R, b: R) => boolean): R | null;
2324
+
2325
+ declare function useSelector<Name extends StoreName, R>(storeName: Name, selectorFn: (state: StoreSnapshot_2<StateFor<Name>>) => R, equalityFn?: (a: R, b: R) => boolean): R | null;
2326
+ export { useSelector }
2327
+ export { useSelector as useSelector_alias_1 }
2328
+
2329
+ declare function useStore<Name extends string, State, P extends Path<State>>(name: StoreDefinition<Name, State>, path: P): StoreSnapshot_2<PathValue<State, P>> | null;
2330
+
2331
+ declare function useStore<Name extends string, State>(name: StoreDefinition<Name, State>, path?: undefined): StoreSnapshot_2<State> | null;
2332
+
2333
+ declare function useStore<Name extends string, State, R>(name: StoreDefinition<Name, State>, selector: (state: StoreSnapshot_2<State>) => R, equalityFn?: (a: R, b: R) => boolean): R | null;
2334
+
2335
+ declare function useStore<Name extends string, State, P extends Path<State>>(name: StoreKey<Name, State>, path: P): StoreSnapshot_2<PathValue<State, P>> | null;
2336
+
2337
+ declare function useStore<Name extends string, State>(name: StoreKey<Name, State>, path?: undefined): StoreSnapshot_2<State> | null;
2338
+
2339
+ declare function useStore<Name extends string, State, R>(name: StoreKey<Name, State>, selector: (state: StoreSnapshot_2<State>) => R, equalityFn?: (a: R, b: R) => boolean): R | null;
2340
+
2341
+ declare function useStore<Name extends StoreName, P extends Path<StateFor<Name>>>(name: Name, path: P): StoreSnapshot_2<PathValue<StateFor<Name>, P>> | null;
2342
+
2343
+ declare function useStore<Name extends StoreName>(name: Name, path?: undefined): StoreSnapshot_2<StateFor<Name>> | null;
2344
+
2345
+ declare function useStore<Name extends StoreName, R>(name: Name, selector: (state: StoreSnapshot_2<StateFor<Name>>) => R, equalityFn?: (a: R, b: R) => boolean): R | null;
2346
+ export { useStore }
2347
+ export { useStore as useStore_alias_1 }
2348
+
2349
+ declare function useStoreField<Name extends string, State, P extends Path<State>>(storeName: StoreDefinition<Name, State> | StoreKey<Name, State>, field: P): StoreSnapshot_2<PathValue<State, P>> | null;
2350
+
2351
+ declare function useStoreField<Name extends StoreName, P extends Path<StateFor<Name>>>(storeName: Name, field: P): StoreSnapshot_2<PathValue<StateFor<Name>, P>> | null;
2352
+ export { useStoreField }
2353
+ export { useStoreField as useStoreField_alias_1 }
2354
+
2355
+ declare function useStoreStatic<Name extends string, State, P extends Path<State>>(name: StoreDefinition<Name, State> | StoreKey<Name, State>, path: P): StoreSnapshot_2<PathValue<State, P>> | null;
2356
+
2357
+ declare function useStoreStatic<Name extends string, State>(name: StoreDefinition<Name, State> | StoreKey<Name, State>, path?: undefined): StoreSnapshot_2<State> | null;
2358
+
2359
+ declare function useStoreStatic<Name extends StoreName, P extends Path<StateFor<Name>>>(name: Name, path: P): StoreSnapshot_2<PathValue<StateFor<Name>, P>> | null;
2360
+
2361
+ declare function useStoreStatic<Name extends StoreName>(name: Name, path?: undefined): StoreSnapshot_2<StateFor<Name>> | null;
2362
+ export { useStoreStatic }
2363
+ export { useStoreStatic as useStoreStatic_alias_1 }
2364
+
2365
+ export declare const validateCryptoPair: (name: string, encrypt: (v: string) => string, decrypt: (v: string) => string) => {
2366
+ ok: boolean;
2367
+ reason?: string;
2368
+ };
2369
+
2370
+ declare const validateDepth: (path: PathInput) => boolean;
2371
+ export { validateDepth }
2372
+ export { validateDepth as validateDepth_alias_1 }
2373
+
2374
+ export declare type ValidateFn<State = StoreValue_alias_4> = (next: State) => boolean | State;
2375
+
2376
+ export declare type ValidateOption<State = StoreValue_alias_4> = ValidateFn<State> | SchemaValidateOption;
2377
+
2378
+ declare const validatePathSafety: (storeName: string, base: StoreValue, path: PathInput, nextValue: unknown) => {
2379
+ ok: boolean;
2380
+ reason?: string;
2381
+ };
2382
+ export { validatePathSafety }
2383
+ export { validatePathSafety as validatePathSafety_alias_1 }
2384
+
2385
+ declare const warn: (msg: string, meta?: Record<string, unknown>) => void;
2386
+ export { warn }
2387
+ export { warn as warn_alias_1 }
2388
+
2389
+ declare const warnAlways: (msg: string, meta?: Record<string, unknown>) => void;
2390
+ export { warnAlways }
2391
+ export { warnAlways as warnAlways_alias_1 }
2392
+
2393
+ declare const warnMissingFeature: (storeName: string, featureName: FeatureName, onError?: (message: string) => void) => void;
2394
+ export { warnMissingFeature }
2395
+ export { warnMissingFeature as warnMissingFeature_alias_1 }
2396
+
2397
+ export declare const withMockedTime: <T>(nowMs: number, fn: () => T) => T;
2398
+
2399
+ declare type WriteResult = {
2400
+ ok: true;
2401
+ } | {
2402
+ ok: false;
2403
+ reason: "not-found" | "validate" | "path" | "middleware" | "ssr" | "invalid-args";
2404
+ };
2405
+ export { WriteResult }
2406
+ export { WriteResult as WriteResult_alias_1 }
2407
+ export { WriteResult as WriteResult_alias_2 }
2408
+ export { WriteResult as WriteResult_alias_3 }
2409
+ export { WriteResult as WriteResult_alias_4 }
2410
+
2411
+ export { }