synapse-storage 3.0.5 → 3.0.7

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.
@@ -1,363 +0,0 @@
1
- import { Observable, OperatorFunction } from 'rxjs';
2
- import { I as IStorage } from './storage.interface-Dl8SLUd1.cjs';
3
-
4
- /**
5
- * Разбиение запроса на порции
6
- * Отправляется ПОСЛЕДОВАТЕЛЬНО n-запросов и дожидается ответа от каждого
7
- * @param fn - функция в которую передается chunk и возвращается функция api
8
- * @param arr - массив который нужно поделить
9
- * @param size - размер порции
10
- * @param delayMs - задержка между запросами в миллисекундах
11
- */
12
- declare const chunkRequestConsistent: <T, R>(fn: (chunk: T[]) => Observable<R>, arr: T[], size: number, delayMs?: number) => Observable<R[]>;
13
- type ChunkRequestConsistent = typeof chunkRequestConsistent;
14
-
15
- /**
16
- * Разбиение запроса на порции
17
- * Отправляется ПАРАЛЛЕЛЬНО n-запросов и дожидается ответа от каждого
18
- * @param fn - функция в которую передается chunk и возвращается функция api
19
- * @param arr - массив который нужно поделить
20
- * @param size - размер порции
21
- * @param delayMs - задержка между запросами в миллисекундах
22
- */
23
- declare const chunkRequestParallel: <T, R>(fn: (chunk: T[]) => Observable<R>, arr: T[], size: number, delayMs?: number) => Observable<R[]>;
24
- type ChunkRequestParallel = typeof chunkRequestParallel;
25
-
26
- /**
27
- * Тип действия с типизированным payload
28
- */
29
- interface TypedAction<P> extends Action<P> {
30
- type: string;
31
- payload: P;
32
- }
33
- /**
34
- * Тип для внешних состояний
35
- */
36
- type ExternalStates = Record<string, Observable<any>>;
37
- /**
38
- * Тип для базового эффекта без доступа к состоянию
39
- */
40
- type EffectBase<TDispatchers extends Record<string, Dispatcher<any, any>> = Record<string, never>, TServices extends Record<string, any> = Record<string, never>> = (action$: Observable<Action>, dispatchers: TDispatchers, services: TServices) => Observable<unknown>;
41
- /**
42
- * Тип для эффекта с доступом к состоянию и конфигурации - это основной тип, который используется по умолчанию
43
- */
44
- type Effect<TState extends Record<string, any> = any, TDispatchers extends Record<string, Dispatcher<any, any>> = Record<string, never>, TServices extends Record<string, any> = Record<string, never>, TConfig extends Record<string, any> = Record<string, never>, TExternalStates extends ExternalStates = Record<string, never>> = (action$: Observable<Action>, state$: Observable<TState>, externalStates: TExternalStates, dispatchers: TDispatchers, services: TServices, config: TConfig) => Observable<unknown>;
45
- /**
46
- * Тип для получения типов действий диспетчера
47
- */
48
- type DispatcherActions<T> = T extends Dispatcher<any, infer A> ? ActionsResult<A> : Record<string, DispatchFunction<any, any>>;
49
- /**
50
- * Конфигурация для валидации в validateMap
51
- */
52
- interface ValidateConfig {
53
- conditions: boolean[];
54
- skipAction: (() => any) | any | ((() => any) | any)[];
55
- }
56
- /**
57
- * Утилиты для запросов в validateMap
58
- */
59
- interface ValidateMapRequestUtils {
60
- chunkRequest: ChunkRequestParallel;
61
- chunkRequestConsistent: ChunkRequestConsistent;
62
- }
63
- /**
64
- * Оператор для фильтрации действий по типу с сохранением типа payload
65
- */
66
- declare function ofType<T extends DispatchFunction<any, any> | WatcherFunction<any>>(actionFn: T): OperatorFunction<Action, TypedAction<T extends WatcherFunction<infer R> ? R : ExtractResultType<T>>>;
67
- /**
68
- * Оператор для фильтрации действий по нескольким типам с объединением типов payload
69
- * @param actionFns Массив функций действий
70
- */
71
- declare function ofTypes<T extends DispatchFunction<any, any>[]>(actionFns: [...T]): OperatorFunction<Action, TypedAction<ExtractResultType<T[number]>>>;
72
- /**
73
- * Оператор для ожидания выполнения всех указанных действий
74
- * @param actionFns Массив функций действий
75
- */
76
- declare function ofTypesWaitAll<T extends DispatchFunction<any, any>[]>(actionFns: [...T]): (source$: Observable<Action>) => Observable<{ [K in keyof T]: TypedAction<ExtractResultType<T[K]>>; }>;
77
- /**
78
- * Создает Observable с выбранными данными из состояния
79
- * @param state$ Поток состояния
80
- * @param selectors Селекторы для выбора частей состояния
81
- * @returns Observable с массивом выбранных значений
82
- */
83
- declare function selectorMap<TState, TResults extends any[]>(state$: Observable<TState>, ...selectors: {
84
- [K in keyof TResults]: (state: TState) => TResults[K];
85
- }): Observable<TResults>;
86
- /**
87
- * Создает именованный объект вместо массива
88
- * @param state$ Поток состояния
89
- * @param selectors Объект с селекторами
90
- * @returns Observable с объектом выбранных значений
91
- */
92
- declare function selectorObject<TState, TResult extends Record<string, any>>(state$: Observable<TState>, selectors: {
93
- [K in keyof TResult]: (state: TState) => TResult[K];
94
- }): Observable<TResult>;
95
- /**
96
- * Оператор validateMap для валидации данных и условного вызова API
97
- */
98
- declare function validateMap<T, TResult = any>({ validator, apiCall, }: {
99
- validator?: (value: T) => ValidateConfig;
100
- apiCall: (value: T, utils: ValidateMapRequestUtils) => Observable<TResult>;
101
- }): OperatorFunction<T, any>;
102
- /**
103
- * Класс для управления эффектами с поддержкой доступа к состоянию и конфигурации
104
- * Основной класс, который следует использовать
105
- */
106
- declare class EffectsModule<TState extends Record<string, any> = any, TDispatchers extends Record<string, Dispatcher<any, any>> = Record<string, never>, TServices extends Record<string, any> = Record<string, never>, TConfig extends Record<string, any> = Record<string, never>, TExternalStates extends ExternalStates = Record<string, never>> {
107
- private storage;
108
- private externalStates;
109
- private dispatchers;
110
- private services;
111
- private config;
112
- private effects;
113
- private subscriptions;
114
- private running;
115
- private action$;
116
- /**
117
- * Поток состояния
118
- */
119
- readonly state$: Observable<TState>;
120
- /**
121
- * Создает модуль эффектов с доступом к состоянию, внешним состояниям и конфигурации
122
- * @param storage Хранилище состояния
123
- * @param externalStates Внешние состояния
124
- * @param dispatchers Объект с диспетчерами
125
- * @param services Объект с сервисами
126
- * @param config Глобальная конфигурация для всех эффектов
127
- */
128
- constructor(storage: IStorage<TState>, externalStates: TExternalStates | undefined, dispatchers: TDispatchers, services?: TServices, config?: TConfig);
129
- /**
130
- * Подписывается на действия от всех диспетчеров
131
- */
132
- private subscribeToDispatchers;
133
- add(effect: Effect<TState, TDispatchers, TServices, TConfig, TExternalStates>): this;
134
- /**
135
- * Добавляет несколько эффектов
136
- * @param effects Эффекты для добавления
137
- * @returns Текущий модуль
138
- */
139
- addEffects(effects: Effect<TState, TDispatchers, TServices, TConfig, TExternalStates>[]): this;
140
- /**
141
- * Запускает все эффекты
142
- * @returns Текущий модуль
143
- */
144
- start(): this;
145
- /**
146
- * Останавливает все эффекты
147
- * @returns Текущий модуль
148
- */
149
- stop(): this;
150
- /**
151
- * Подписывается на конкретный эффект
152
- * @param effect Эффект для подписки
153
- */
154
- private subscribeToEffect;
155
- }
156
- /**
157
- * Вспомогательная функция для создания типизированного эффекта без состояния
158
- * @deprecated Используйте createEffect вместо этого
159
- */
160
- declare function createEffectBase<TDispatchers extends Record<string, Dispatcher<any, any>>, TServices extends Record<string, any>>(effect: EffectBase<TDispatchers, TServices>): EffectBase<TDispatchers, TServices>;
161
- /**
162
- * Вспомогательная функция для создания типизированного эффекта с состоянием и конфигурацией
163
- */
164
- declare function createEffect<TState extends Record<string, any>, TDispatchers extends Record<string, Dispatcher<any, any>>, TServices extends Record<string, any>, TConfig extends Record<string, any> = Record<string, never>, TExternalStates extends ExternalStates = Record<string, never>>(effect: Effect<TState, TDispatchers, TServices, TConfig, TExternalStates>): Effect<TState, TDispatchers, TServices, TConfig, TExternalStates>;
165
- /**
166
- * Объединяет несколько эффектов в один
167
- * @param effects Эффекты для объединения
168
- * @returns Объединенный эффект
169
- */
170
- declare function combineEffects<TState extends Record<string, any>, TDispatchers extends Record<string, Dispatcher<any, any>>, TServices extends Record<string, any>, TConfig extends Record<string, any> = Record<string, never>, TExternalStates extends ExternalStates = Record<string, never>>(...effects: Effect<TState, TDispatchers, TServices, TConfig, TExternalStates>[]): Effect<TState, TDispatchers, TServices, TConfig, TExternalStates>;
171
-
172
- /**
173
- * Расширенное API для middleware
174
- */
175
- interface EnhancedMiddlewareAPI<T extends Record<string, any>> {
176
- getState: () => Promise<T>;
177
- dispatch: (action: Action) => Promise<any>;
178
- storage: IStorage<T>;
179
- actions$: Observable<Action>;
180
- actions: Record<string, DispatchFunction<any, any>>;
181
- watchers: Record<string, WatcherFunction<any>>;
182
- findActionByType: (actionType: string) => DispatchFunction<any, any> | undefined;
183
- findWatcherByType: (actionType: string) => WatcherFunction<any> | undefined;
184
- }
185
- /**
186
- * Расширенное определение middleware
187
- */
188
- interface EnhancedMiddleware<T extends Record<string, any> = any> {
189
- (api: EnhancedMiddlewareAPI<T>): (next: (action: Action) => Promise<any>) => (action: Action) => Promise<any>;
190
- }
191
- /**
192
- * Базовая структура действия
193
- */
194
- interface Action<T = unknown> {
195
- type: string;
196
- payload?: T;
197
- meta?: Record<string, any>;
198
- }
199
- interface ActionExecutionOptions {
200
- worker?: Worker;
201
- memoize?: (currentArgs: any[], previousArgs: any[], previousResult: any) => boolean;
202
- }
203
- /**
204
- * Параметры для создания действия
205
- */
206
- interface ActionDefinition<TParams, TResult> {
207
- /** Тип действия для идентификации в потоке и эффектах */
208
- type: string;
209
- /** Функция, выполняющая действие и возвращающая результат (payload) */
210
- action: (params: TParams) => Promise<TResult> | TResult;
211
- /** Дополнительные метаданные (опционально) */
212
- meta?: Record<string, any>;
213
- }
214
- /**
215
- * Определение типа для watcher'а
216
- */
217
- interface WatcherDefinition<T, R> {
218
- type: string;
219
- selector: (state: T) => R;
220
- meta?: Record<string, any>;
221
- shouldTrigger?: (prev: R | undefined, current: R) => boolean;
222
- }
223
- /**
224
- * Тип для функции watcher
225
- */
226
- interface WatcherFunction<R> {
227
- (): Observable<TypedAction<R>>;
228
- actionType: string;
229
- meta?: Record<string, any>;
230
- unsubscribe: VoidFunction;
231
- }
232
- /**
233
- * Расширенный тип для функции настройки действий с поддержкой дополнительных утилит
234
- */
235
- type ActionsSetupWithUtils<T extends Record<string, unknown>> = (storage: IStorage<T>, utils: {
236
- createAction: ActionCreatorFactory;
237
- createWatcher: <R>(config: WatcherDefinition<T, R>) => WatcherFunction<R>;
238
- }) => Record<string, DispatchFunction<any, any> | WatcherFunction<any>>;
239
- /**
240
- * Расширенная функция диспетчеризации
241
- */
242
- interface DispatchFunction<TParams, TResult> {
243
- /** Функция для вызова действия с параметрами */
244
- (params: TParams): Promise<TResult>;
245
- /** Тип действия для использования в эффектах */
246
- actionType: string;
247
- /** Метаданные действия */
248
- meta?: Record<string, any>;
249
- /** Внутренний тип для идентификации */
250
- _type?: 'dispatch' | 'watchers';
251
- }
252
- /**
253
- * Тип для фабрики создателей действий
254
- */
255
- type ActionCreatorFactory = <TParams, TResult>(config: ActionDefinition<TParams, TResult>, executionOptions?: ActionExecutionOptions) => DispatchFunction<TParams, TResult>;
256
- /**
257
- * Тип для функции настройки действий
258
- */
259
- type ActionsSetup<T extends Record<string, unknown>> = (create: ActionCreatorFactory, storage: IStorage<T>) => Record<string, DispatchFunction<any, any>>;
260
- /**
261
- * Извлекает тип результата из функции диспетчера
262
- */
263
- type ExtractResultType<T> = T extends DispatchFunction<any, infer R> ? R : never;
264
- /**
265
- * Извлекает типы из функции настройки действий
266
- */
267
- type ActionsResult<F> = F extends (create: ActionCreatorFactory, storage: any, ...args: any[]) => infer R ? R : Record<string, DispatchFunction<any, any>>;
268
- /**
269
- * Типизированный объект действий
270
- */
271
- type DispatchActions<T> = {
272
- [K in keyof T]: T[K] extends DispatchFunction<any, any> ? T[K] : never;
273
- };
274
- /**
275
- * Типизированный объект watchers
276
- */
277
- type WatcherActions<T> = {
278
- [K in keyof T]: T[K] extends WatcherFunction<any> ? T[K] : never;
279
- };
280
- /**
281
- * Параметры для Dispatcher
282
- */
283
- interface DispatcherOptions<T extends Record<string, any>> {
284
- storage: IStorage<T>;
285
- worker?: Worker;
286
- middlewares?: EnhancedMiddleware<T>[];
287
- }
288
- /**
289
- * Интерфейс для API middleware
290
- */
291
- interface DispatcherMiddlewareAPI<T extends Record<string, any>> {
292
- getState: () => Promise<T>;
293
- dispatch: (action: Action) => Promise<any>;
294
- }
295
- /**
296
- * Интерфейс для middleware
297
- */
298
- interface DispatcherMiddleware<T extends Record<string, any> = any> {
299
- (api: DispatcherMiddlewareAPI<T>): (next: (action: Action) => Promise<any>) => (action: Action) => Promise<any>;
300
- }
301
- /**
302
- * Класс Dispatcher для интеграции хранилищ с реактивной системой
303
- */
304
- declare class Dispatcher<T extends Record<string, any>, TActionsFn extends ActionsSetupWithUtils<T> = ActionsSetupWithUtils<T>> {
305
- private options;
306
- private actions$;
307
- readonly actions: Observable<Action>;
308
- dispatch: Record<string, DispatchFunction<any, any>>;
309
- watchers: Record<string, WatcherFunction<any>>;
310
- private storage;
311
- private middlewareFunctions;
312
- private middlewareAPI;
313
- /**
314
- * Создает новый экземпляр Dispatcher
315
- */
316
- constructor(options: DispatcherOptions<T>);
317
- /**
318
- * Добавляет middleware в цепочку обработки
319
- */
320
- use(...middlewares: EnhancedMiddleware<T>[]): this;
321
- /**
322
- * Получает все действия с улучшенной типизацией
323
- */
324
- getActions(): ActionsResult<TActionsFn>;
325
- /**
326
- * Получает типизированные действия диспетчера
327
- */
328
- getTypedDispatch<A extends Record<string, any>>(): DispatchActions<A>;
329
- /**
330
- * Получает типизированные watcher'ы
331
- */
332
- getTypedWatchers<A extends Record<string, any>>(): WatcherActions<A>;
333
- /**
334
- * Находит действие по типу
335
- */
336
- findActionByType(actionType: string): DispatchFunction<any, any> | undefined;
337
- /**
338
- * Находит наблюдатель по типу
339
- */
340
- findWatcherByType(actionType: string): WatcherFunction<any> | undefined;
341
- /**
342
- * Создает действие
343
- */
344
- createAction<TParams, TResult>(actionConfig: ActionDefinition<TParams, TResult>, executionOptions?: ActionExecutionOptions): DispatchFunction<TParams, TResult>;
345
- /**
346
- * Создает watcher для отслеживания изменений в хранилище
347
- */
348
- createWatcher<R>(config: WatcherDefinition<T, R>): WatcherFunction<R>;
349
- /**
350
- * Выполняет действие в worker
351
- */
352
- private executeInWorker;
353
- }
354
- /**
355
- * Функция для создания типизированного диспетчера
356
- */
357
- declare function createDispatcher<TState extends Record<string, any>, TActions extends ActionsSetupWithUtils<TState>>(options: DispatcherOptions<TState>, actionsSetup: TActions): Dispatcher<TState, TActions> & {
358
- dispatch: DispatchActions<ReturnType<TActions>>;
359
- watchers: WatcherActions<ReturnType<TActions>>;
360
- };
361
- type CreateDispatcherType = ReturnType<typeof createDispatcher>;
362
-
363
- export { type Action as A, combineEffects as B, type CreateDispatcherType as C, type DispatchFunction as D, type EnhancedMiddlewareAPI as E, type TypedAction as T, type ValidateConfig as V, type WatcherFunction as W, type EnhancedMiddleware as a, type ActionDefinition as b, type ActionsSetupWithUtils as c, type ActionsSetup as d, type ExtractResultType as e, type ActionsResult as f, type DispatchActions as g, type WatcherActions as h, type DispatcherMiddlewareAPI as i, type DispatcherMiddleware as j, Dispatcher as k, createDispatcher as l, type ExternalStates as m, type EffectBase as n, type Effect as o, type DispatcherActions as p, type ValidateMapRequestUtils as q, ofType as r, ofTypes as s, ofTypesWaitAll as t, selectorMap as u, selectorObject as v, validateMap as w, EffectsModule as x, createEffectBase as y, createEffect as z };
package/dist/index.d.cts DELETED
@@ -1,10 +0,0 @@
1
- export { ApiClient, ResponseFormat, apiLogger, createUniqueId, headersToObject } from './api.cjs';
2
- export { I as ISelectorModule, S as SelectorAPI } from './selector.interface-CA5y-kD_.cjs';
3
- export { IPlugin, IPluginExecutor, IPluginManager, IStoragePlugin, IndexedDBStorage, LocalStorage, MemoryStorage, PluginContext, SelectorModule, StoragePluginModule, broadcastMiddleware } from './core.cjs';
4
- export { B as BatchingMiddlewareOptions, C as ConfigureMiddlewares, D as DefaultMiddlewares, G as GetDefaultMiddleware, f as IEventEmitter, g as ILogger, I as IStorage, k as IndexedDBStorageConfig, L as LocalStorageConfig, j as MemoryStorageConfig, M as Middleware, a as MiddlewareAPI, N as NextFunction, S as ShallowCompareMiddlewareOptions, b as StorageAction, h as StorageConfig, e as StorageEvent, d as StorageEvents, c as StorageKeyType, i as StorageType } from './storage.interface-Dl8SLUd1.cjs';
5
- export { A as Action, b as ActionDefinition, f as ActionsResult, d as ActionsSetup, c as ActionsSetupWithUtils, C as CreateDispatcherType, g as DispatchActions, D as DispatchFunction, k as Dispatcher, p as DispatcherActions, j as DispatcherMiddleware, i as DispatcherMiddlewareAPI, o as Effect, n as EffectBase, x as EffectsModule, a as EnhancedMiddleware, E as EnhancedMiddlewareAPI, m as ExternalStates, e as ExtractResultType, T as TypedAction, V as ValidateConfig, q as ValidateMapRequestUtils, h as WatcherActions, W as WatcherFunction, B as combineEffects, l as createDispatcher, z as createEffect, y as createEffectBase, r as ofType, s as ofTypes, t as ofTypesWaitAll, u as selectorMap, v as selectorObject, w as validateMap } from './dispatcher.module-CdpmkplA.cjs';
6
- export { loggerDispatcherMiddleware } from './reactive.cjs';
7
- export { AnySynapseStore, SynapseStoreBasic, SynapseStoreWithDispatcher, SynapseStoreWithEffects, createSynapse } from './utils.cjs';
8
- export { createSynapseCtx, useSelector, useStorageSubscribe } from './react.cjs';
9
- import 'rxjs';
10
- import 'react';
package/dist/react.d.cts DELETED
@@ -1,74 +0,0 @@
1
- import { S as SelectorAPI } from './selector.interface-CA5y-kD_.cjs';
2
- import { I as IStorage } from './storage.interface-Dl8SLUd1.cjs';
3
- import { ComponentType } from 'react';
4
- import { Observable } from 'rxjs';
5
- import { SynapseStoreWithEffects, SynapseStoreWithDispatcher, SynapseStoreBasic } from './utils.cjs';
6
- import './dispatcher.module-CdpmkplA.cjs';
7
-
8
- interface UseSelectorOptions<T> {
9
- /** Начальное значение до загрузки данных из селектора */
10
- initialValue?: T;
11
- /** Функция сравнения для предотвращения лишних ререндеров */
12
- equals?: (a: T, b: T) => boolean;
13
- /** Включать ли статус загрузки в возвращаемый результат */
14
- withLoading?: boolean;
15
- }
16
- /**
17
- * Хук для использования селекторов в компонентах React.
18
- * Обеспечивает согласованность значений между всеми экземплярами хука.
19
- */
20
- declare function useSelector<T>(selector: SelectorAPI<T>): T | undefined;
21
- declare function useSelector<T>(selector: SelectorAPI<T>, options: UseSelectorOptions<T> & {
22
- withLoading?: true;
23
- }): {
24
- data: T | undefined;
25
- isLoading: boolean;
26
- };
27
-
28
- /**
29
- * Хук для подписки на изменения в хранилище
30
- *
31
- * @template S - Тип состояния хранилища
32
- * @template R - Тип возвращаемого значения
33
- * @param storage - Экземпляр хранилища
34
- * @param selector - Функция-селектор для выбора данных
35
- * @returns Значение из хранилища
36
- */
37
- declare const useStorageSubscribe: <S extends Record<string, any>, R = any>(storage: IStorage<S>, selector: (state: S) => R) => R | undefined;
38
-
39
- interface Options<TStore extends Record<string, any>> {
40
- loadingComponent?: any;
41
- mergeFn?: (target: TStore, source: Record<string, any>) => void;
42
- }
43
- /**
44
- * Перегрузки для createSynapseCtx в зависимости от типа хранилища
45
- */
46
- declare function createSynapseCtx<TStore extends Record<string, any>, TStorage extends IStorage<TStore>, TSelectors, TActions>(synapseStorePromise: Promise<SynapseStoreWithEffects<TStore, TStorage, TSelectors, TActions>> | SynapseStoreWithEffects<TStore, TStorage, TSelectors, TActions>, options?: Options<TStore>): {
47
- contextSynapse: <SelfComponentProps, PublicContextProps = Record<string, any>>(Component: ComponentType<SelfComponentProps>) => ComponentType<SelfComponentProps & {
48
- contextProps?: PublicContextProps;
49
- }>;
50
- useSynapseStorage: () => TStorage;
51
- useSynapseSelectors: () => TSelectors;
52
- useSynapseActions: () => TActions;
53
- useSynapseState$: () => Observable<TStore>;
54
- cleanupSynapse: () => Promise<void>;
55
- };
56
- declare function createSynapseCtx<TStore extends Record<string, any>, TStorage extends IStorage<TStore>, TSelectors, TActions>(synapseStorePromise: Promise<SynapseStoreWithDispatcher<TStore, TStorage, TSelectors, TActions>> | SynapseStoreWithDispatcher<TStore, TStorage, TSelectors, TActions>, options?: Options<TStore>): {
57
- contextSynapse: <SelfComponentProps, PublicContextProps = Record<string, any>>(Component: ComponentType<SelfComponentProps>) => ComponentType<SelfComponentProps & {
58
- contextProps?: PublicContextProps;
59
- }>;
60
- useSynapseStorage: () => TStorage;
61
- useSynapseSelectors: () => TSelectors;
62
- useSynapseActions: () => TActions;
63
- cleanupSynapse: () => Promise<void>;
64
- };
65
- declare function createSynapseCtx<TStore extends Record<string, any>, TStorage extends IStorage<TStore>, TSelectors>(synapseStorePromise: Promise<SynapseStoreBasic<TStore, TStorage, TSelectors>> | SynapseStoreBasic<TStore, TStorage, TSelectors>, options?: Options<TStore>): {
66
- contextSynapse: <SelfComponentProps, PublicContextProps = Record<string, any>>(Component: ComponentType<SelfComponentProps>) => ComponentType<SelfComponentProps & {
67
- contextProps?: PublicContextProps;
68
- }>;
69
- useSynapseStorage: () => TStorage;
70
- useSynapseSelectors: () => TSelectors;
71
- cleanupSynapse: () => Promise<void>;
72
- };
73
-
74
- export { createSynapseCtx, useSelector, useStorageSubscribe };
@@ -1,35 +0,0 @@
1
- import { a as EnhancedMiddleware } from './dispatcher.module-CdpmkplA.cjs';
2
- export { A as Action, b as ActionDefinition, f as ActionsResult, d as ActionsSetup, c as ActionsSetupWithUtils, C as CreateDispatcherType, g as DispatchActions, D as DispatchFunction, k as Dispatcher, p as DispatcherActions, j as DispatcherMiddleware, i as DispatcherMiddlewareAPI, o as Effect, n as EffectBase, x as EffectsModule, E as EnhancedMiddlewareAPI, m as ExternalStates, e as ExtractResultType, T as TypedAction, V as ValidateConfig, q as ValidateMapRequestUtils, h as WatcherActions, W as WatcherFunction, B as combineEffects, l as createDispatcher, z as createEffect, y as createEffectBase, r as ofType, s as ofTypes, t as ofTypesWaitAll, u as selectorMap, v as selectorObject, w as validateMap } from './dispatcher.module-CdpmkplA.cjs';
3
- import 'rxjs';
4
- import './storage.interface-Dl8SLUd1.cjs';
5
-
6
- interface LoggerTranslations {
7
- action: string;
8
- prevState: string;
9
- nextState: string;
10
- duration: string;
11
- error: string;
12
- diff: string;
13
- changesCount: string;
14
- showFullState: string;
15
- }
16
- interface LoggerColors {
17
- title: string;
18
- prevState: string;
19
- fullState: string;
20
- action: string;
21
- nextState: string;
22
- error: string;
23
- diff: string;
24
- }
25
- interface LoggerOptions {
26
- collapsed?: boolean;
27
- duration?: boolean;
28
- diff?: boolean;
29
- showFullState?: boolean;
30
- translations?: Partial<LoggerTranslations>;
31
- colors?: Partial<LoggerColors>;
32
- }
33
- declare const loggerDispatcherMiddleware: <State extends Record<string, any>>(options?: LoggerOptions) => EnhancedMiddleware<State>;
34
-
35
- export { EnhancedMiddleware, loggerDispatcherMiddleware };
@@ -1,63 +0,0 @@
1
- interface Selector<T, R> {
2
- (state: T): R;
3
- }
4
- interface SelectorOptions<T> {
5
- equals?: (a: T, b: T) => boolean;
6
- name?: string;
7
- }
8
- interface Subscriber<T> {
9
- notify: (value: T) => void | Promise<void>;
10
- }
11
- interface SelectorAPI<T> {
12
- select: () => Promise<T>;
13
- subscribe: (subscriber: Subscriber<T>) => VoidFunction;
14
- getId: () => string;
15
- }
16
- /**
17
- * Интерфейс для модуля селекторов
18
- * Определяет контракт для работы с селекторами, который должен реализовывать SelectorModule
19
- */
20
- interface ISelectorModule<TStore extends Record<string, any>> {
21
- /**
22
- * Имя связанного хранилища
23
- */
24
- readonly storageName: string;
25
- /**
26
- * Создает простой селектор на основе функции выбора
27
- *
28
- * @param selector Функция, извлекающая данные из состояния
29
- * @param options Опции селектора
30
- * @returns API селектора
31
- *
32
- * @example
33
- * const isActive = selectorModule.createSelector(
34
- * (state) => state.user.isActive,
35
- * { name: 'userIsActive' }
36
- * );
37
- */
38
- createSelector<T>(selector: Selector<TStore, T>, options?: SelectorOptions<T>): SelectorAPI<T>;
39
- /**
40
- * Создает комбинированный селектор на основе других селекторов
41
- *
42
- * @param dependencies Массив селекторов, от которых зависит новый селектор
43
- * @param resultFn Функция, комбинирующая результаты зависимостей
44
- * @param options Опции селектора
45
- * @returns API селектора
46
- *
47
- * @example
48
- * const userWithStatus = selectorModule.createSelector(
49
- * [userSelector, statusSelector],
50
- * (user, status) => ({ ...user, status }),
51
- * { name: 'userWithStatus' }
52
- * );
53
- */
54
- createSelector<Deps extends unknown[], T>(dependencies: {
55
- [K in keyof Deps]: SelectorAPI<Deps[K]>;
56
- }, resultFn: (...args: Deps) => T, options?: SelectorOptions<T>): SelectorAPI<T>;
57
- /**
58
- * Освобождает ресурсы, связанные с модулем селекторов
59
- */
60
- destroy(): void;
61
- }
62
-
63
- export type { ISelectorModule as I, SelectorAPI as S, Selector as a, SelectorOptions as b };