synapse-storage 2.1.1 → 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_utils/index.js +3 -3
- package/dist/api/api.module.js +3 -3
- package/dist/api/example.js +2 -2
- package/dist/api/index.js +5 -5
- package/dist/api/utils/endpoint-headers.js +1 -1
- package/dist/api/utils/fetch-base-query.js +1 -1
- package/dist/core/index.js +2 -2
- package/dist/core/selector/index.js +1 -1
- package/dist/core/storage/adapters/base-storage.service.js +1 -1
- package/dist/core/storage/adapters/indexed-DB.service.js +2 -2
- package/dist/core/storage/adapters/indexed-DB.service.old.js +2 -2
- package/dist/core/storage/adapters/local-storage.service.js +2 -2
- package/dist/core/storage/adapters/memory-storage.service.js +2 -2
- package/dist/core/storage/index.js +9 -9
- package/dist/core/storage/middlewares/index.js +1 -1
- package/dist/core/storage/utils/cache.util.js +1 -1
- package/dist/index.js +5 -9
- package/dist/index.js.map +1 -1
- package/dist/react/hooks/index.js +2 -2
- package/dist/react/index.js +2 -2
- package/dist/react/utils/createSynapseCtx.d.ts.map +1 -1
- package/dist/react/utils/createSynapseCtx.js.map +1 -1
- package/dist/react/utils/index.js +1 -1
- package/dist/reactive/dispatcher/index.js +2 -2
- package/dist/reactive/dispatcher/middlewares/index.js +1 -1
- package/dist/reactive/effects/effects.module.js +1 -1
- package/dist/reactive/effects/index.js +1 -1
- package/dist/reactive/effects/utils/index.js +2 -2
- package/dist/reactive/index.js +2 -2
- package/dist/utils/index.js +1 -1
- package/package.json +2 -2
- package/dist/_examples/_example5.d.ts +0 -1
- package/dist/_examples/_example5.d.ts.map +0 -1
- package/dist/_examples/_example5.js +0 -184
- package/dist/_examples/_example5.js.map +0 -1
- package/dist/_examples/_example6.d.ts +0 -1
- package/dist/_examples/_example6.d.ts.map +0 -1
- package/dist/_examples/_example6.js +0 -168
- package/dist/_examples/_example6.js.map +0 -1
- package/dist/_examples/example1.d.ts +0 -1
- package/dist/_examples/example1.d.ts.map +0 -1
- package/dist/_examples/example1.js +0 -240
- package/dist/_examples/example1.js.map +0 -1
- package/dist/_examples/example2.d.ts +0 -1
- package/dist/_examples/example2.d.ts.map +0 -1
- package/dist/_examples/example2.js +0 -81
- package/dist/_examples/example2.js.map +0 -1
- package/dist/_examples/example3.d.ts +0 -1
- package/dist/_examples/example3.d.ts.map +0 -1
- package/dist/_examples/example3.js +0 -99
- package/dist/_examples/example3.js.map +0 -1
- package/dist/_examples/example4.d.ts +0 -1
- package/dist/_examples/example4.d.ts.map +0 -1
- package/dist/_examples/example4.js +0 -172
- package/dist/_examples/example4.js.map +0 -1
- package/dist/_examples/example5.d.ts +0 -1
- package/dist/_examples/example5.d.ts.map +0 -1
- package/dist/_examples/example5.js +0 -184
- package/dist/_examples/example5.js.map +0 -1
- package/dist/_examples/example6.d.ts +0 -1
- package/dist/_examples/example6.d.ts.map +0 -1
- package/dist/_examples/example6.js +0 -168
- package/dist/_examples/example6.js.map +0 -1
- package/dist/_examples/plugins.d.ts +0 -1
- package/dist/_examples/plugins.d.ts.map +0 -1
- package/dist/_examples/plugins.js +0 -176
- package/dist/_examples/plugins.js.map +0 -1
- package/dist/_examples/pokemons/PokemonList.d.ts +0 -5
- package/dist/_examples/pokemons/PokemonList.d.ts.map +0 -1
- package/dist/_examples/pokemons/PokemonList.js +0 -166
- package/dist/_examples/pokemons/PokemonList.js.map +0 -1
- package/dist/_examples/pokemons/api.d.ts +0 -8
- package/dist/_examples/pokemons/api.d.ts.map +0 -1
- package/dist/_examples/pokemons/api.js +0 -45
- package/dist/_examples/pokemons/api.js.map +0 -1
- package/dist/_examples/pokemons/app.config.d.ts +0 -15
- package/dist/_examples/pokemons/app.config.d.ts.map +0 -1
- package/dist/_examples/pokemons/app.config.js +0 -15
- package/dist/_examples/pokemons/app.config.js.map +0 -1
- package/dist/_examples/pokemons/dispatchers/pokemon.dispatcher.d.ts +0 -9
- package/dist/_examples/pokemons/dispatchers/pokemon.dispatcher.d.ts.map +0 -1
- package/dist/_examples/pokemons/dispatchers/pokemon.dispatcher.js +0 -122
- package/dist/_examples/pokemons/dispatchers/pokemon.dispatcher.js.map +0 -1
- package/dist/_examples/pokemons/effects/pokemon.effects.d.ts +0 -16
- package/dist/_examples/pokemons/effects/pokemon.effects.d.ts.map +0 -1
- package/dist/_examples/pokemons/effects/pokemon.effects.js +0 -39
- package/dist/_examples/pokemons/effects/pokemon.effects.js.map +0 -1
- package/dist/_examples/pokemons/middlewares/pokenon.middlewares.d.ts +0 -4
- package/dist/_examples/pokemons/middlewares/pokenon.middlewares.d.ts.map +0 -1
- package/dist/_examples/pokemons/middlewares/pokenon.middlewares.js +0 -27
- package/dist/_examples/pokemons/middlewares/pokenon.middlewares.js.map +0 -1
- package/dist/_examples/pokemons/pokemon.dispatcher.d.ts +0 -9
- package/dist/_examples/pokemons/pokemon.dispatcher.d.ts.map +0 -1
- package/dist/_examples/pokemons/pokemon.dispatcher.js +0 -122
- package/dist/_examples/pokemons/pokemon.dispatcher.js.map +0 -1
- package/dist/_examples/pokemons/pokemon.effects.d.ts +0 -5
- package/dist/_examples/pokemons/pokemon.effects.d.ts.map +0 -1
- package/dist/_examples/pokemons/pokemon.effects.js +0 -39
- package/dist/_examples/pokemons/pokemon.effects.js.map +0 -1
- package/dist/_examples/pokemons/pokemon.selectors.d.ts +0 -5
- package/dist/_examples/pokemons/pokemon.selectors.d.ts.map +0 -1
- package/dist/_examples/pokemons/pokemon.selectors.js +0 -10
- package/dist/_examples/pokemons/pokemon.selectors.js.map +0 -1
- package/dist/_examples/pokemons/pokemon.storage.d.ts +0 -3
- package/dist/_examples/pokemons/pokemon.storage.d.ts.map +0 -1
- package/dist/_examples/pokemons/pokemon.storage.js +0 -14
- package/dist/_examples/pokemons/pokemon.storage.js.map +0 -1
- package/dist/_examples/pokemons/pokemon1.selectors.d.ts +0 -5
- package/dist/_examples/pokemons/pokemon1.selectors.d.ts.map +0 -1
- package/dist/_examples/pokemons/pokemon1.selectors.js +0 -8
- package/dist/_examples/pokemons/pokemon1.selectors.js.map +0 -1
- package/dist/_examples/pokemons/pokenon.middlewares.d.ts +0 -4
- package/dist/_examples/pokemons/pokenon.middlewares.d.ts.map +0 -1
- package/dist/_examples/pokemons/pokenon.middlewares.js +0 -27
- package/dist/_examples/pokemons/pokenon.middlewares.js.map +0 -1
- package/dist/_examples/pokemons/selectors/pokemon.selectors.d.ts +0 -5
- package/dist/_examples/pokemons/selectors/pokemon.selectors.d.ts.map +0 -1
- package/dist/_examples/pokemons/selectors/pokemon.selectors.js +0 -10
- package/dist/_examples/pokemons/selectors/pokemon.selectors.js.map +0 -1
- package/dist/_examples/pokemons/selectors/pokemon1.selectors.d.ts +0 -5
- package/dist/_examples/pokemons/selectors/pokemon1.selectors.d.ts.map +0 -1
- package/dist/_examples/pokemons/selectors/pokemon1.selectors.js +0 -8
- package/dist/_examples/pokemons/selectors/pokemon1.selectors.js.map +0 -1
- package/dist/_examples/pokemons/storages/pokemon.storage.d.ts +0 -3
- package/dist/_examples/pokemons/storages/pokemon.storage.d.ts.map +0 -1
- package/dist/_examples/pokemons/storages/pokemon.storage.js +0 -14
- package/dist/_examples/pokemons/storages/pokemon.storage.js.map +0 -1
- package/dist/_examples/pokemons/store.d.ts +0 -1
- package/dist/_examples/pokemons/store.d.ts.map +0 -1
- package/dist/_examples/pokemons/store.js +0 -2
- package/dist/_examples/pokemons/store.js.map +0 -1
- package/dist/_examples/pokemons/store1.d.ts +0 -23
- package/dist/_examples/pokemons/store1.d.ts.map +0 -1
- package/dist/_examples/pokemons/store1.js +0 -35
- package/dist/_examples/pokemons/store1.js.map +0 -1
- package/dist/_examples/pokemons/store2.d.ts +0 -23
- package/dist/_examples/pokemons/store2.d.ts.map +0 -1
- package/dist/_examples/pokemons/store2.js +0 -34
- package/dist/_examples/pokemons/store2.js.map +0 -1
- package/dist/_examples/pokemons/types.d.ts +0 -26
- package/dist/_examples/pokemons/types.d.ts.map +0 -1
- package/dist/_examples/pokemons/types.js +0 -2
- package/dist/_examples/pokemons/types.js.map +0 -1
- package/dist/core/storage/adapters/idb.d.ts +0 -52
- package/dist/core/storage/adapters/idb.d.ts.map +0 -1
- package/dist/core/storage/adapters/idb.js +0 -528
- package/dist/core/storage/adapters/idb.js.map +0 -1
- package/dist/core/storage/adapters/indexed-DB.service1.d.ts +0 -38
- package/dist/core/storage/adapters/indexed-DB.service1.d.ts.map +0 -1
- package/dist/core/storage/adapters/indexed-DB.service1.js +0 -318
- package/dist/core/storage/adapters/indexed-DB.service1.js.map +0 -1
- package/dist/core/storage/adapters/indexed-DB.service2.d.ts +0 -61
- package/dist/core/storage/adapters/indexed-DB.service2.d.ts.map +0 -1
- package/dist/core/storage/adapters/indexed-DB.service2.js +0 -596
- package/dist/core/storage/adapters/indexed-DB.service2.js.map +0 -1
- package/dist/core/storage/factory/createSynapseStorage.factory.d.ts +0 -1
- package/dist/core/storage/factory/createSynapseStorage.factory.d.ts.map +0 -1
- package/dist/core/storage/factory/createSynapseStorage.factory.js +0 -2
- package/dist/core/storage/factory/createSynapseStorage.factory.js.map +0 -1
- package/dist/core/storage/factory/index.d.ts +0 -2
- package/dist/core/storage/factory/index.d.ts.map +0 -1
- package/dist/core/storage/factory/index.js +0 -2
- package/dist/core/storage/factory/index.js.map +0 -1
- package/dist/examples/_example5.d.ts +0 -1
- package/dist/examples/_example5.d.ts.map +0 -1
- package/dist/examples/_example5.js +0 -184
- package/dist/examples/_example5.js.map +0 -1
- package/dist/examples/_example6.d.ts +0 -1
- package/dist/examples/_example6.d.ts.map +0 -1
- package/dist/examples/_example6.js +0 -168
- package/dist/examples/_example6.js.map +0 -1
- package/dist/examples/plugins.d.ts +0 -1
- package/dist/examples/plugins.d.ts.map +0 -1
- package/dist/examples/plugins.js +0 -176
- package/dist/examples/plugins.js.map +0 -1
- package/dist/examples/pokemons/PokemonList.d.ts +0 -2
- package/dist/examples/pokemons/PokemonList.d.ts.map +0 -1
- package/dist/examples/pokemons/PokemonList.js +0 -110
- package/dist/examples/pokemons/PokemonList.js.map +0 -1
- package/dist/examples/pokemons/api.d.ts +0 -22
- package/dist/examples/pokemons/api.d.ts.map +0 -1
- package/dist/examples/pokemons/api.js +0 -43
- package/dist/examples/pokemons/api.js.map +0 -1
- package/dist/examples/pokemons/app.config.d.ts +0 -15
- package/dist/examples/pokemons/app.config.d.ts.map +0 -1
- package/dist/examples/pokemons/app.config.js +0 -15
- package/dist/examples/pokemons/app.config.js.map +0 -1
- package/dist/examples/pokemons/dispatchers/pokemon.dispatcher.js +0 -128
- package/dist/examples/pokemons/dispatchers/pokemon.dispatcher.js.map +0 -1
- package/dist/examples/pokemons/effects/pokemon.effects.d.ts +0 -16
- package/dist/examples/pokemons/effects/pokemon.effects.d.ts.map +0 -1
- package/dist/examples/pokemons/effects/pokemon.effects.js +0 -51
- package/dist/examples/pokemons/effects/pokemon.effects.js.map +0 -1
- package/dist/examples/pokemons/middlewares/pokenon.middlewares.d.ts +0 -4
- package/dist/examples/pokemons/middlewares/pokenon.middlewares.d.ts.map +0 -1
- package/dist/examples/pokemons/middlewares/pokenon.middlewares.js +0 -28
- package/dist/examples/pokemons/middlewares/pokenon.middlewares.js.map +0 -1
- package/dist/examples/pokemons/selectors/pokemon.selectors.d.ts +0 -13
- package/dist/examples/pokemons/selectors/pokemon.selectors.d.ts.map +0 -1
- package/dist/examples/pokemons/selectors/pokemon.selectors.js +0 -7
- package/dist/examples/pokemons/selectors/pokemon.selectors.js.map +0 -1
- package/dist/examples/pokemons/storages/pokemon.storage.d.ts +0 -5
- package/dist/examples/pokemons/storages/pokemon.storage.d.ts.map +0 -1
- package/dist/examples/pokemons/storages/pokemon.storage.js +0 -13
- package/dist/examples/pokemons/storages/pokemon.storage.js.map +0 -1
- package/dist/examples/pokemons/store.d.ts +0 -35
- package/dist/examples/pokemons/store.d.ts.map +0 -1
- package/dist/examples/pokemons/store.js +0 -21
- package/dist/examples/pokemons/store.js.map +0 -1
- package/dist/examples/pokemons/types.d.ts +0 -26
- package/dist/examples/pokemons/types.d.ts.map +0 -1
- package/dist/examples/pokemons/types.js +0 -2
- package/dist/examples/pokemons/types.js.map +0 -1
- package/dist/react/utils/createSynapse.d.ts +0 -47
- package/dist/react/utils/createSynapse.d.ts.map +0 -1
- package/dist/react/utils/createSynapse.js +0 -83
- package/dist/react/utils/createSynapse.js.map +0 -1
- package/dist/react/utils/createSynapseContext.d.ts +0 -29
- package/dist/react/utils/createSynapseContext.d.ts.map +0 -1
- package/dist/react/utils/createSynapseContext.js +0 -112
- package/dist/react/utils/createSynapseContext.js.map +0 -1
- package/dist/utils/chunk.util.d.ts +0 -8
- package/dist/utils/chunk.util.d.ts.map +0 -1
- package/dist/utils/chunk.util.js +0 -21
- package/dist/utils/chunk.util.js.map +0 -1
- package/dist/utils/deepMerge.util.d.ts +0 -2
- package/dist/utils/deepMerge.util.d.ts.map +0 -1
- package/dist/utils/deepMerge.util.js +0 -16
- package/dist/utils/deepMerge.util.js.map +0 -1
- package/dist/utils/flatMap.util.d.ts +0 -10
- package/dist/utils/flatMap.util.d.ts.map +0 -1
- package/dist/utils/flatMap.util.js +0 -23
- package/dist/utils/flatMap.util.js.map +0 -1
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import { from, mapTo, of, tap } from 'rxjs';
|
|
2
|
-
import { catchError, switchMap } from 'rxjs/operators';
|
|
3
|
-
import { combineEffects, createEffect, ofType, ofTypes, selectorMap, validateMap } from '../../../../../synapse';
|
|
4
|
-
// Эффект для навигации
|
|
5
|
-
export const navigationEffect = createEffect((action$, state$, { pokemonDispatcher }, _, config) => action$.pipe(ofTypes([pokemonDispatcher.dispatch.next, pokemonDispatcher.dispatch.prev]), switchMap((action) => {
|
|
6
|
-
const { id } = action.payload;
|
|
7
|
-
return of(() => pokemonDispatcher.dispatch.loadPokemon(id));
|
|
8
|
-
})));
|
|
9
|
-
// Эффект для отслеживания изменений ID
|
|
10
|
-
export const watchIdEffect = createEffect((action$, state$, { pokemonDispatcher }) => action$.pipe(ofType(pokemonDispatcher.watchers.watchCurrentId), selectorMap(state$, (state) => state.loading, (state) => state.currentId), tap(([action, [loading, currentId]]) => {
|
|
11
|
-
// console.log(`ID покемона изменился на ${action.payload}`)
|
|
12
|
-
// console.log('Статус загрузки:', loading)
|
|
13
|
-
// console.log('ID в хранилище:', currentId)
|
|
14
|
-
}), mapTo(null)));
|
|
15
|
-
// Эффект для загрузки данных покемона
|
|
16
|
-
export const loadPokemonEffect = createEffect((action$, state$, { pokemonDispatcher }, { pokemonApi }, config) => action$.pipe(ofType(pokemonDispatcher.dispatch.loadPokemon), selectorMap(state$, (state) => state.currentId), validateMap({
|
|
17
|
-
apiCall: ([action, [currentId]]) => {
|
|
18
|
-
const { id } = action.payload;
|
|
19
|
-
return from(pokemonApi.fetchPokemonById.request({ id }).waitWithCallbacks({
|
|
20
|
-
loading: (request) => {
|
|
21
|
-
console.log('LOADING', request);
|
|
22
|
-
pokemonDispatcher.dispatch.loadPokemonRequest(id);
|
|
23
|
-
},
|
|
24
|
-
// success: (data, request) => {
|
|
25
|
-
// console.log('SUCCESS', request)
|
|
26
|
-
// pokemonDispatcher.dispatch.success({ data })
|
|
27
|
-
// },
|
|
28
|
-
// error: (error, request) => {
|
|
29
|
-
// console.log('ERROR', error, request)
|
|
30
|
-
// pokemonDispatcher.dispatch.failure(error!)
|
|
31
|
-
// },
|
|
32
|
-
})).pipe(switchMap(({ data }) => {
|
|
33
|
-
return of(pokemonDispatcher.dispatch.success({ data }));
|
|
34
|
-
}), catchError((err) => of(pokemonDispatcher.dispatch.failure(err))));
|
|
35
|
-
},
|
|
36
|
-
})));
|
|
37
|
-
// Объединяем все эффекты в один и экспортируем
|
|
38
|
-
export const pokemonEffects = combineEffects(navigationEffect, watchIdEffect, loadPokemonEffect);
|
|
39
|
-
//# sourceMappingURL=pokemon.effects.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"pokemon.effects.js","sourceRoot":"","sources":["../../../../src/_examples/pokemons/effects/pokemon.effects.ts"],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G,EAAE,EAAE,CAAC,EAAE,CAAC,iBAAiB,CAAC,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CACjE,CAAA;IACH,CAAC;CACF,CAAC,CACH,CACF,CAAA;AAED,+CAA+C;AAC/C,MAAM,CAAC,MAAM,cAAc,GAAG,cAAc,CAAC,gBAAgB,EAAE,aAAa,EAAE,iBAAiB,CAAC,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"pokenon.middlewares.d.ts","sourceRoot":"","sources":["../../../../src/_examples/pokemons/middlewares/pokenon.middlewares.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAA;AACrD,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAA;AAIvC,eAAO,MAAM,4BAA4B,QAAO,kBAAkB,CAAC,YAAY,CA0B9E,CAAA"}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
// Создадим счетчик инициализаций
|
|
2
|
-
export const createPokemonAlertMiddleware = () => (api) => (next) => async (action) => {
|
|
3
|
-
const result = await next(action);
|
|
4
|
-
// Проверяем тип после выполнения
|
|
5
|
-
if (action.type.includes('pokemon/next') || action.type.includes('pokemon/prev')) {
|
|
6
|
-
const state = await api.getState();
|
|
7
|
-
// Пробуем найти действие напрямую
|
|
8
|
-
const alertAction = api.findActionByType('pokemon/showAlert');
|
|
9
|
-
if (alertAction) {
|
|
10
|
-
await alertAction({
|
|
11
|
-
message: `Покемон переключен на ID: ${state.currentId}`,
|
|
12
|
-
type: 'info',
|
|
13
|
-
});
|
|
14
|
-
}
|
|
15
|
-
else {
|
|
16
|
-
await api.dispatch({
|
|
17
|
-
type: 'pokemon/showAlert',
|
|
18
|
-
payload: {
|
|
19
|
-
message: `Покемон переключен на ID: ${state.currentId}`,
|
|
20
|
-
type: 'info',
|
|
21
|
-
},
|
|
22
|
-
});
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
return result;
|
|
26
|
-
};
|
|
27
|
-
//# sourceMappingURL=pokenon.middlewares.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"pokenon.middlewares.js","sourceRoot":"","sources":["../../../../src/_examples/pokemons/middlewares/pokenon.middlewares.ts"],"names":[],"mappings":"AAIA,iCAAiC;AACjC,MAAM,CAAC,MAAM,4BAA4B,GAAG,GAAqC,EAAE,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE;IACtH,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,CAAA;IACjC,iCAAiC;IACjC,IAAI,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,cAAc,CAAC,IAAI,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,cAAc,CAAC,EAAE,CAAC;QACjF,MAAM,KAAK,GAAG,MAAM,GAAG,CAAC,QAAQ,EAAE,CAAA;QAElC,kCAAkC;QAClC,MAAM,WAAW,GAAG,GAAG,CAAC,gBAAgB,CAAC,mBAAmB,CAAC,CAAA;QAE7D,IAAI,WAAW,EAAE,CAAC;YAChB,MAAM,WAAW,CAAC;gBAChB,OAAO,EAAE,6BAA6B,KAAK,CAAC,SAAS,EAAE;gBACvD,IAAI,EAAE,MAAM;aACb,CAAC,CAAA;QACJ,CAAC;aAAM,CAAC;YACN,MAAM,GAAG,CAAC,QAAQ,CAAC;gBACjB,IAAI,EAAE,mBAAmB;gBACzB,OAAO,EAAE;oBACP,OAAO,EAAE,6BAA6B,KAAK,CAAC,SAAS,EAAE;oBACvD,IAAI,EAAE,MAAM;iBACb;aACF,CAAC,CAAA;QACJ,CAAC;IACH,CAAC;IAED,OAAO,MAAM,CAAA;AACf,CAAC,CAAA"}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { PokemonStorage } from './storages/pokemon.storage';
|
|
2
|
-
export interface AlertPayload {
|
|
3
|
-
message: string;
|
|
4
|
-
type: 'info' | 'warning' | 'error' | 'success';
|
|
5
|
-
duration?: number;
|
|
6
|
-
}
|
|
7
|
-
export declare function createPokemonDispatcher(storage: PokemonStorage): any;
|
|
8
|
-
export type PokemonDispatcher = ReturnType<typeof createPokemonDispatcher>;
|
|
9
|
-
//# sourceMappingURL=pokemon.dispatcher.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"pokemon.dispatcher.d.ts","sourceRoot":"","sources":["../../../src/_examples/pokemons/pokemon.dispatcher.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAA;AAI3D,MAAM,WAAW,YAAY;IAC3B,OAAO,EAAE,MAAM,CAAA;IACf,IAAI,EAAE,MAAM,GAAG,SAAS,GAAG,OAAO,GAAG,SAAS,CAAA;IAC9C,QAAQ,CAAC,EAAE,MAAM,CAAA;CAClB;AAGD,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,cAAc,OAsI9D;AAGD,MAAM,MAAM,iBAAiB,GAAG,UAAU,CAAC,OAAO,uBAAuB,CAAC,CAAA"}
|
|
@@ -1,122 +0,0 @@
|
|
|
1
|
-
import { createDispatcher, loggerDispatcherMiddleware } from 'synapse/reactive';
|
|
2
|
-
import { createPokemonAlertMiddleware } from './middlewares/pokenon.middlewares';
|
|
3
|
-
// Функция для создания диспетчера
|
|
4
|
-
export function createPokemonDispatcher(storage) {
|
|
5
|
-
// Создаем логгер middleware
|
|
6
|
-
const loggerMiddleware = loggerDispatcherMiddleware({
|
|
7
|
-
collapsed: true, // Сворачиваем группы в консоли для компактности
|
|
8
|
-
colors: {
|
|
9
|
-
title: '#3498db', // Кастомный синий цвет для заголовка
|
|
10
|
-
},
|
|
11
|
-
duration: true,
|
|
12
|
-
diff: true,
|
|
13
|
-
showFullState: true,
|
|
14
|
-
});
|
|
15
|
-
const alertM = createPokemonAlertMiddleware();
|
|
16
|
-
return createDispatcher({
|
|
17
|
-
storage,
|
|
18
|
-
middlewares: [loggerMiddleware, alertM],
|
|
19
|
-
}, (storage, { createWatcher, createAction }) => ({
|
|
20
|
-
// Добавляем watcher для отслеживания текущего ID
|
|
21
|
-
watchCurrentId: createWatcher({
|
|
22
|
-
type: 'pokemon/currentIdChanged',
|
|
23
|
-
selector: (state) => state.currentId,
|
|
24
|
-
shouldTrigger: (prev, curr) => prev !== curr,
|
|
25
|
-
meta: {
|
|
26
|
-
description: 'Следит за изменениями ID текущего покемона',
|
|
27
|
-
},
|
|
28
|
-
}),
|
|
29
|
-
// Watcher для отслеживания состояния загрузки
|
|
30
|
-
watchLoadingState: createWatcher({
|
|
31
|
-
type: 'pokemon/loadingStateChanged',
|
|
32
|
-
selector: (state) => state.loading,
|
|
33
|
-
}),
|
|
34
|
-
// Загрузка покемона по ID
|
|
35
|
-
loadPokemon: createAction({
|
|
36
|
-
type: 'pokemon/loadPokemonIdl',
|
|
37
|
-
action: async (id) => ({ id }),
|
|
38
|
-
}),
|
|
39
|
-
loadPokemonRequest: createAction({
|
|
40
|
-
type: 'pokemon/loadPokemonRequest',
|
|
41
|
-
action: async (id) => {
|
|
42
|
-
await storage.update((state) => {
|
|
43
|
-
state.loading = true;
|
|
44
|
-
state.error = null;
|
|
45
|
-
state.currentId = id;
|
|
46
|
-
});
|
|
47
|
-
return { id };
|
|
48
|
-
},
|
|
49
|
-
}),
|
|
50
|
-
// Успешное получение данных
|
|
51
|
-
success: createAction({
|
|
52
|
-
type: 'pokemon/success',
|
|
53
|
-
action: async ({ data }) => {
|
|
54
|
-
await storage.update((state) => {
|
|
55
|
-
state.currentPokemon = data;
|
|
56
|
-
state.loading = false;
|
|
57
|
-
state.error = null;
|
|
58
|
-
});
|
|
59
|
-
// Возвращаем данные покемона как payload
|
|
60
|
-
return { data };
|
|
61
|
-
},
|
|
62
|
-
}),
|
|
63
|
-
// Ошибка при получении данных
|
|
64
|
-
failure: createAction({
|
|
65
|
-
type: 'pokemon/failure',
|
|
66
|
-
action: async (err) => {
|
|
67
|
-
const errorMessage = err instanceof Error ? err.message : 'Unknown error';
|
|
68
|
-
await storage.update((state) => {
|
|
69
|
-
state.loading = false;
|
|
70
|
-
state.error = errorMessage;
|
|
71
|
-
});
|
|
72
|
-
// Возвращаем ошибку как payload
|
|
73
|
-
return { err };
|
|
74
|
-
},
|
|
75
|
-
}),
|
|
76
|
-
// Перейти к следующему покемону
|
|
77
|
-
next: createAction({
|
|
78
|
-
type: 'pokemon/next',
|
|
79
|
-
action: async () => {
|
|
80
|
-
let newId = 1;
|
|
81
|
-
await storage.update((state) => {
|
|
82
|
-
newId = state.currentId + 1;
|
|
83
|
-
if (newId > 151)
|
|
84
|
-
newId = 1; // Ограничиваем первым поколением (1-151)
|
|
85
|
-
state.currentId = newId;
|
|
86
|
-
});
|
|
87
|
-
return { id: newId };
|
|
88
|
-
},
|
|
89
|
-
}),
|
|
90
|
-
// Перейти к предыдущему покемону
|
|
91
|
-
prev: createAction({
|
|
92
|
-
type: 'pokemon/prev',
|
|
93
|
-
action: async () => {
|
|
94
|
-
let newId = 1;
|
|
95
|
-
await storage.update((state) => {
|
|
96
|
-
newId = state.currentId - 1;
|
|
97
|
-
if (newId < 1)
|
|
98
|
-
newId = 151; // Ограничиваем первым поколением (1-151)
|
|
99
|
-
state.currentId = newId;
|
|
100
|
-
});
|
|
101
|
-
console.log(`Action: Previous pokemon (ID ${newId})`);
|
|
102
|
-
// Возвращаем новый id как payload
|
|
103
|
-
return { id: newId };
|
|
104
|
-
},
|
|
105
|
-
}),
|
|
106
|
-
showAlert: createAction({
|
|
107
|
-
type: 'pokemon/showAlert',
|
|
108
|
-
action: async (payload) => {
|
|
109
|
-
// Используем глобальный alert для демонстрации
|
|
110
|
-
alert(payload.message);
|
|
111
|
-
// Здесь можно также обновить состояние для отображения alert в UI
|
|
112
|
-
// например, добавить запись в массив alerts в state
|
|
113
|
-
},
|
|
114
|
-
meta: {
|
|
115
|
-
description: 'Показывает оповещение пользователю',
|
|
116
|
-
},
|
|
117
|
-
}),
|
|
118
|
-
}));
|
|
119
|
-
// .use(logger)
|
|
120
|
-
// .use(alertM)
|
|
121
|
-
}
|
|
122
|
-
//# sourceMappingURL=pokemon.dispatcher.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"pokemon.dispatcher.js","sourceRoot":"","sources":["../../../src/_examples/pokemons/pokemon.dispatcher.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,0BAA0B,EAAE,MAAM,kBAAkB,CAAA;AAE/E,OAAO,EAAE,4BAA4B,EAAE,MAAM,mCAAmC,CAAA;AAWhF,kCAAkC;AAClC,MAAM,UAAU,uBAAuB,CAAC,OAAuB;IAC7D,4BAA4B;IAC5B,MAAM,gBAAgB,GAAG,0BAA0B,CAAC;QAClD,SAAS,EAAE,IAAI,EAAE,gDAAgD;QACjE,MAAM,EAAE;YACN,KAAK,EAAE,SAAS,EAAE,qCAAqC;SACxD;QACD,QAAQ,EAAE,IAAI;QACd,IAAI,EAAE,IAAI;QACV,aAAa,EAAE,IAAI;KACpB,CAAC,CAAA;IAEF,MAAM,MAAM,GAAG,4BAA4B,EAAE,CAAA;IAE7C,OAAO,gBAAgB,CACrB;QACE,OAAO;QACP,WAAW,EAAE,CAAC,gBAAgB,EAAE,MAAM,CAAC;KACxC,EACD,CAAC,OAAO,EAAE,EAAE,aAAa,EAAE,YAAY,EAAE,EAAE,EAAE,CAAC,CAAC;QAC7C,iDAAiD;QACjD,cAAc,EAAE,aAAa,CAAC;YAC5B,IAAI,EAAE,0BAA0B;YAChC,QAAQ,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,SAAS;YACpC,aAAa,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,EAAE,CAAC,IAAI,KAAK,IAAI;YAC5C,IAAI,EAAE;gBACJ,WAAW,EAAE,4CAA4C;aAC1D;SACF,CAAC;QAEF,8CAA8C;QAC9C,iBAAiB,EAAE,aAAa,CAAU;YACx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,OAAO,CAAC,GAAG,CAAC,gCAAgC,KAAK,GAAG,CAAC,CAAA;gBACrD,kCAAkC;gBAClC,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,CAAA;YACtB,CAAC;SACF,CAAC;QAEF,SAAS,EAAE,YAAY,CAAqB;YAC1C,IAAI,EAAE,mBAAmB;YACzB,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE;gBACxB,+CAA+C;gBAC/C,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,CAAA;gBAEtB,kEAAkE;gBAClE,oDAAoD;YACtD,CAAC;YACD,IAAI,EAAE;gBACJ,WAAW,EAAE,oCAAoC;aAClD;SACF,CAAC;KACH,CAAC,CACH,CAAA;IACD,eAAe;IACf,eAAe;AACjB,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"pokemon.effects.d.ts","sourceRoot":"","sources":["../../../src/_examples/pokemons/pokemon.effects.ts"],"names":[],"mappings":"AAaA,eAAO,MAAM,gBAAgB,KAW3B,CAAA;AAGF,eAAO,MAAM,aAAa,KAkBxB,CAAA;AAGF,eAAO,MAAM,iBAAiB,KAoC5B,CAAA;AAGF,eAAO,MAAM,cAAc,KAI1B,CAAA"}
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import { from, mapTo, of, tap } from 'rxjs';
|
|
2
|
-
import { catchError, switchMap } from 'rxjs/operators';
|
|
3
|
-
import { combineEffects, createEffect, ofType, ofTypes, selectorMap, validateMap } from 'synapse';
|
|
4
|
-
// Эффект для навигации
|
|
5
|
-
export const navigationEffect = createEffect((action$, state$, { pokemonDispatcher }, _, config) => action$.pipe(ofTypes([pokemonDispatcher.dispatch.next, pokemonDispatcher.dispatch.prev]), switchMap((action) => {
|
|
6
|
-
const { id } = action.payload;
|
|
7
|
-
return of(() => pokemonDispatcher.dispatch.loadPokemon(id));
|
|
8
|
-
})));
|
|
9
|
-
// Эффект для отслеживания изменений ID
|
|
10
|
-
export const watchIdEffect = createEffect((action$, state$, { pokemonDispatcher }) => action$.pipe(ofType(pokemonDispatcher.watchers.watchCurrentId), selectorMap(state$, (state) => state.loading, (state) => state.currentId), tap(([action, [loading, currentId]]) => {
|
|
11
|
-
// console.log(`ID покемона изменился на ${action.payload}`)
|
|
12
|
-
// console.log('Статус загрузки:', loading)
|
|
13
|
-
// console.log('ID в хранилище:', currentId)
|
|
14
|
-
}), mapTo(null)));
|
|
15
|
-
// Эффект для загрузки данных покемона
|
|
16
|
-
export const loadPokemonEffect = createEffect((action$, state$, { pokemonDispatcher }, { pokemonApi }, config) => action$.pipe(ofType(pokemonDispatcher.dispatch.loadPokemon), selectorMap(state$, (state) => state.currentId), validateMap({
|
|
17
|
-
apiCall: ([action, [currentId]]) => {
|
|
18
|
-
const { id } = action.payload;
|
|
19
|
-
return from(pokemonApi.fetchPokemonById.request({ id }).waitWithCallbacks({
|
|
20
|
-
loading: (request) => {
|
|
21
|
-
console.log('LOADING', request);
|
|
22
|
-
pokemonDispatcher.dispatch.loadPokemonRequest(id);
|
|
23
|
-
},
|
|
24
|
-
// success: (data, request) => {
|
|
25
|
-
// console.log('SUCCESS', request)
|
|
26
|
-
// pokemonDispatcher.dispatch.success({ data })
|
|
27
|
-
// },
|
|
28
|
-
// error: (error, request) => {
|
|
29
|
-
// console.log('ERROR', error, request)
|
|
30
|
-
// pokemonDispatcher.dispatch.failure(error!)
|
|
31
|
-
// },
|
|
32
|
-
})).pipe(switchMap(({ data }) => {
|
|
33
|
-
return of(pokemonDispatcher.dispatch.success({ data }));
|
|
34
|
-
}), catchError((err) => of(pokemonDispatcher.dispatch.failure(err))));
|
|
35
|
-
},
|
|
36
|
-
})));
|
|
37
|
-
// Объединяем все эффекты в один и экспортируем
|
|
38
|
-
export const pokemonEffects = combineEffects(navigationEffect, watchIdEffect, loadPokemonEffect);
|
|
39
|
-
//# sourceMappingURL=pokemon.effects.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"pokemon.effects.js","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A;QACzD,CAAC,CAAC,EACF,UAAU,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,EAAE,CAAC,iBAAiB,CAAC,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CACjE,CAAA;IACH,CAAC;CACF,CAAC,CACH,CAAC,CAAA;AAEF,+CAA+C;AAC/C,MAAM,CAAC,MAAM,cAAc,GAAG,cAAc,CAC1C,gBAAgB,EAChB,aAAa,EACb,iBAAiB,CAClB,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"pokemon.selectors.d.ts","sourceRoot":"","sources":["../../../src/_examples/pokemons/pokemon.selectors.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAA;AAGlD,eAAO,MAAM,sBAAsB,GAAI,SAAS,cAAc;;CAa7D,CAAA"}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { SelectorModule } from 'synapse';
|
|
2
|
-
import { pokemon1Selectors } from './store2';
|
|
3
|
-
export const createPokemonSelectors = (storage) => {
|
|
4
|
-
const selectors = new SelectorModule(storage);
|
|
5
|
-
const sprites = selectors.createSelector((state) => state.currentPokemon?.sprites);
|
|
6
|
-
return ({
|
|
7
|
-
val1: selectors.createSelector([sprites, pokemon1Selectors.front_default], (sprites, front_default) => [sprites, front_default]),
|
|
8
|
-
});
|
|
9
|
-
};
|
|
10
|
-
//# sourceMappingURL=pokemon.selectors.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"pokemon.selectors.js","sourceRoot":"","sources":["../../../src/_examples/pokemons/pokemon.selectors.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;AAExC,OAAO,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAA;AAE5C,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,OAAuB,EAAE,EAAE;IAChE,MAAM,SAAS,GAAG,IAAI,cAAc,CAAC,OAAO,CAAC,CAAA;IAE7C,MAAM,OAAO,GAAG,SAAS,CAAC,cAAc,CACtC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,cAAc,EAAE,OAAO,CACzC,CAAA;IAED,OAAO,CAAC;QACN,IAAI,EAAE,SAAS,CAAC,cAAc,CAC5B,CAAC,OAAO,EAAE,iBAAiB,CAAC,aAAa,CAAC,EAC1C,CAAC,OAAO,EAAE,aAAa,EAAE,EAAE,CAAC,CAAC,OAAO,EAAE,aAAa,CAAC,CACrD;KACF,CAAC,CAAA;AACJ,CAAC,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"pokemon.storage.d.ts","sourceRoot":"","sources":["../../../src/_examples/pokemons/pokemon.storage.ts"],"names":[],"mappings":"AAKA,wBAAsB,oBAAoB,iBAUzC;AAGD,MAAM,MAAM,cAAc,GAAG,OAAO,CAAC,UAAU,CAAC,OAAO,oBAAoB,CAAC,CAAC,CAAC"}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { MemoryStorage } from 'synapse/core';
|
|
2
|
-
// Асинхронная функция для создания хранилища
|
|
3
|
-
export async function createPokemonStorage() {
|
|
4
|
-
return new MemoryStorage({
|
|
5
|
-
name: 'pokemon-store',
|
|
6
|
-
initialState: {
|
|
7
|
-
currentPokemon: null,
|
|
8
|
-
loading: true,
|
|
9
|
-
error: null,
|
|
10
|
-
currentId: 1,
|
|
11
|
-
},
|
|
12
|
-
}).initialize();
|
|
13
|
-
}
|
|
14
|
-
//# sourceMappingURL=pokemon.storage.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"pokemon.storage.js","sourceRoot":"","sources":["../../../src/_examples/pokemons/pokemon.storage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAA;AAI5C,6CAA6C;AAC7C,MAAM,CAAC,KAAK,UAAU,oBAAoB;IACxC,OAAO,IAAI,aAAa,CAAe;QACrC,IAAI,EAAE,eAAe;QACrB,YAAY,EAAE;YACZ,cAAc,EAAE,IAAI;YACpB,OAAO,EAAE,IAAI;YACb,KAAK,EAAE,IAAI;YACX,SAAS,EAAE,CAAC;SACb;KACF,CAAC,CAAC,UAAU,EAAE,CAAA;AACjB,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"pokemon1.selectors.d.ts","sourceRoot":"","sources":["../../../src/_examples/pokemons/pokemon1.selectors.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAA;AAElD,eAAO,MAAM,uBAAuB,GAAI,SAAS,cAAc;;CAQ9D,CAAA"}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { SelectorModule } from 'synapse/core';
|
|
2
|
-
export const createPokemonSelectors1 = (storage) => {
|
|
3
|
-
const selectors = new SelectorModule(storage);
|
|
4
|
-
return ({
|
|
5
|
-
front_default: selectors.createSelector((state) => state.currentId),
|
|
6
|
-
});
|
|
7
|
-
};
|
|
8
|
-
//# sourceMappingURL=pokemon1.selectors.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"pokemon1.selectors.js","sourceRoot":"","sources":["../../../src/_examples/pokemons/pokemon1.selectors.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAA;AAG7C,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,OAAuB,EAAE,EAAE;IACjE,MAAM,SAAS,GAAG,IAAI,cAAc,CAAC,OAAO,CAAC,CAAA;IAE7C,OAAO,CAAC;QACN,aAAa,EAAE,SAAS,CAAC,cAAc,CACrC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,SAAS,CAC3B;KACF,CAAC,CAAA;AACJ,CAAC,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"pokenon.middlewares.d.ts","sourceRoot":"","sources":["../../../src/_examples/pokemons/pokenon.middlewares.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAA;AACrD,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AAItC,eAAO,MAAM,4BAA4B,QAAO,kBAAkB,CAAC,YAAY,CA0B9E,CAAA"}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
// Создадим счетчик инициализаций
|
|
2
|
-
export const createPokemonAlertMiddleware = () => (api) => (next) => async (action) => {
|
|
3
|
-
const result = await next(action);
|
|
4
|
-
// Проверяем тип после выполнения
|
|
5
|
-
if (action.type.includes('pokemon/next') || action.type.includes('pokemon/prev')) {
|
|
6
|
-
const state = await api.getState();
|
|
7
|
-
// Пробуем найти действие напрямую
|
|
8
|
-
const alertAction = api.findActionByType('pokemon/showAlert');
|
|
9
|
-
if (alertAction) {
|
|
10
|
-
await alertAction({
|
|
11
|
-
message: `Покемон переключен на ID: ${state.currentId}`,
|
|
12
|
-
type: 'info',
|
|
13
|
-
});
|
|
14
|
-
}
|
|
15
|
-
else {
|
|
16
|
-
await api.dispatch({
|
|
17
|
-
type: 'pokemon/showAlert',
|
|
18
|
-
payload: {
|
|
19
|
-
message: `Покемон переключен на ID: ${state.currentId}`,
|
|
20
|
-
type: 'info',
|
|
21
|
-
},
|
|
22
|
-
});
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
return result;
|
|
26
|
-
};
|
|
27
|
-
//# sourceMappingURL=pokenon.middlewares.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"pokenon.middlewares.js","sourceRoot":"","sources":["../../../src/_examples/pokemons/pokenon.middlewares.ts"],"names":[],"mappings":"AAIA,iCAAiC;AACjC,MAAM,CAAC,MAAM,4BAA4B,GAAG,GAAqC,EAAE,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE;IACtH,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,CAAA;IACjC,iCAAiC;IACjC,IAAI,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,cAAc,CAAC,IAAI,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,cAAc,CAAC,EAAE,CAAC;QACjF,MAAM,KAAK,GAAG,MAAM,GAAG,CAAC,QAAQ,EAAE,CAAA;QAElC,kCAAkC;QAClC,MAAM,WAAW,GAAG,GAAG,CAAC,gBAAgB,CAAC,mBAAmB,CAAC,CAAA;QAE7D,IAAI,WAAW,EAAE,CAAC;YAChB,MAAM,WAAW,CAAC;gBAChB,OAAO,EAAE,6BAA6B,KAAK,CAAC,SAAS,EAAE;gBACvD,IAAI,EAAE,MAAM;aACb,CAAC,CAAA;QACJ,CAAC;aAAM,CAAC;YACN,MAAM,GAAG,CAAC,QAAQ,CAAC;gBACjB,IAAI,EAAE,mBAAmB;gBACzB,OAAO,EAAE;oBACP,OAAO,EAAE,6BAA6B,KAAK,CAAC,SAAS,EAAE;oBACvD,IAAI,EAAE,MAAM;iBACb;aACF,CAAC,CAAA;QACJ,CAAC;IACH,CAAC;IAED,OAAO,MAAM,CAAA;AACf,CAAC,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"pokemon.selectors.d.ts","sourceRoot":"","sources":["../../../../src/_examples/pokemons/selectors/pokemon.selectors.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAA;AAG5D,eAAO,MAAM,sBAAsB,GAAI,SAAS,cAAc;;CAa7D,CAAA"}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { SelectorModule } from '../../../../../synapse';
|
|
2
|
-
import { pokemon1Selectors } from '../store2';
|
|
3
|
-
export const createPokemonSelectors = (storage) => {
|
|
4
|
-
const selectors = new SelectorModule(storage);
|
|
5
|
-
const sprites = selectors.createSelector((state) => state.currentPokemon?.sprites);
|
|
6
|
-
return ({
|
|
7
|
-
val1: selectors.createSelector([sprites, pokemon1Selectors.front_default], (sprites, front_default) => [sprites, front_default]),
|
|
8
|
-
});
|
|
9
|
-
};
|
|
10
|
-
//# sourceMappingURL=pokemon.selectors.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"pokemon.selectors.js","sourceRoot":"","sources":["../../../../src/_examples/pokemons/selectors/pokemon.selectors.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAA;AAEvD,OAAO,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAA;AAE7C,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,OAAuB,EAAE,EAAE;IAChE,MAAM,SAAS,GAAG,IAAI,cAAc,CAAC,OAAO,CAAC,CAAA;IAE7C,MAAM,OAAO,GAAG,SAAS,CAAC,cAAc,CACtC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,cAAc,EAAE,OAAO,CACzC,CAAA;IAED,OAAO,CAAC;QACN,IAAI,EAAE,SAAS,CAAC,cAAc,CAC5B,CAAC,OAAO,EAAE,iBAAiB,CAAC,aAAa,CAAC,EAC1C,CAAC,OAAO,EAAE,aAAa,EAAE,EAAE,CAAC,CAAC,OAAO,EAAE,aAAa,CAAC,CACrD;KACF,CAAC,CAAA;AACJ,CAAC,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"pokemon1.selectors.d.ts","sourceRoot":"","sources":["../../../../src/_examples/pokemons/selectors/pokemon1.selectors.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAA;AAE5D,eAAO,MAAM,uBAAuB,GAAI,SAAS,cAAc;;CAQ9D,CAAA"}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { SelectorModule } from 'synapse/core';
|
|
2
|
-
export const createPokemonSelectors1 = (storage) => {
|
|
3
|
-
const selectors = new SelectorModule(storage);
|
|
4
|
-
return ({
|
|
5
|
-
front_default: selectors.createSelector((state) => state.currentId),
|
|
6
|
-
});
|
|
7
|
-
};
|
|
8
|
-
//# sourceMappingURL=pokemon1.selectors.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"pokemon1.selectors.js","sourceRoot":"","sources":["../../../../src/_examples/pokemons/selectors/pokemon1.selectors.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAA;AAG7C,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,OAAuB,EAAE,EAAE;IACjE,MAAM,SAAS,GAAG,IAAI,cAAc,CAAC,OAAO,CAAC,CAAA;IAE7C,OAAO,CAAC;QACN,aAAa,EAAE,SAAS,CAAC,cAAc,CACrC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,SAAS,CAC3B;KACF,CAAC,CAAA;AACJ,CAAC,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"pokemon.storage.d.ts","sourceRoot":"","sources":["../../../../src/_examples/pokemons/storages/pokemon.storage.ts"],"names":[],"mappings":"AAKA,wBAAsB,oBAAoB,iBAUzC;AAGD,MAAM,MAAM,cAAc,GAAG,OAAO,CAAC,UAAU,CAAC,OAAO,oBAAoB,CAAC,CAAC,CAAC"}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { MemoryStorage } from 'synapse/core';
|
|
2
|
-
// Асинхронная функция для создания хранилища
|
|
3
|
-
export async function createPokemonStorage() {
|
|
4
|
-
return new MemoryStorage({
|
|
5
|
-
name: 'pokemon-store',
|
|
6
|
-
initialState: {
|
|
7
|
-
currentPokemon: null,
|
|
8
|
-
loading: true,
|
|
9
|
-
error: null,
|
|
10
|
-
currentId: 1,
|
|
11
|
-
},
|
|
12
|
-
}).initialize();
|
|
13
|
-
}
|
|
14
|
-
//# sourceMappingURL=pokemon.storage.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"pokemon.storage.js","sourceRoot":"","sources":["../../../../src/_examples/pokemons/storages/pokemon.storage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAA;AAI5C,6CAA6C;AAC7C,MAAM,CAAC,KAAK,UAAU,oBAAoB;IACxC,OAAO,IAAI,aAAa,CAAe;QACrC,IAAI,EAAE,eAAe;QACrB,YAAY,EAAE;YACZ,cAAc,EAAE,IAAI;YACpB,OAAO,EAAE,IAAI;YACb,KAAK,EAAE,IAAI;YACX,SAAS,EAAE,CAAC;SACb;KACF,CAAC,CAAC,UAAU,EAAE,CAAA;AACjB,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
//# sourceMappingURL=store.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"store.d.ts","sourceRoot":"","sources":["../../../src/_examples/pokemons/store.ts"],"names":[],"mappings":""}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"store.js","sourceRoot":"","sources":["../../../src/_examples/pokemons/store.ts"],"names":[],"mappings":""}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
export declare function initializeStore(): Promise<{
|
|
2
|
-
storage: any;
|
|
3
|
-
selectors: {
|
|
4
|
-
val1: import("../../../dist").SelectorAPI<any[]>;
|
|
5
|
-
};
|
|
6
|
-
actions: any;
|
|
7
|
-
state$: any;
|
|
8
|
-
}>;
|
|
9
|
-
export declare const pokemonStore: {
|
|
10
|
-
storage: any;
|
|
11
|
-
selectors: {
|
|
12
|
-
val1: import("../../../dist").SelectorAPI<any[]>;
|
|
13
|
-
};
|
|
14
|
-
actions: any;
|
|
15
|
-
state$: any;
|
|
16
|
-
};
|
|
17
|
-
export declare const pokemonStorage: any;
|
|
18
|
-
export declare const pokemonState$: any;
|
|
19
|
-
export declare const pokemonActions: any;
|
|
20
|
-
export declare const pokemonSelectors: {
|
|
21
|
-
val1: import("../../../dist").SelectorAPI<any[]>;
|
|
22
|
-
};
|
|
23
|
-
//# sourceMappingURL=store1.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"store1.d.ts","sourceRoot":"","sources":["../../../src/_examples/pokemons/store1.ts"],"names":[],"mappings":"AAUA,wBAAsB,eAAe;;;;;;;GAyBpC;AAED,eAAO,MAAM,YAAY;;;;;;;CAA0B,CAAA;AAGnD,eAAO,MAAM,cAAc,KAAuB,CAAA;AAClD,eAAO,MAAM,aAAa,KAAsB,CAAA;AAChD,eAAO,MAAM,cAAc,KAAuB,CAAA;AAClD,eAAO,MAAM,gBAAgB;;CAAyB,CAAA"}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { EffectsModule } from 'synapse/reactive';
|
|
2
|
-
import { pokemonEndpoints } from './api.md';
|
|
3
|
-
import { appConfig } from './app.config';
|
|
4
|
-
import { createPokemonDispatcher } from './dispatchers/pokemon.dispatcher.md';
|
|
5
|
-
import { pokemonEffects } from './effects/pokemon.effects';
|
|
6
|
-
import { createPokemonSelectors } from './selectors/pokemon.selectors';
|
|
7
|
-
import { createPokemonStorage } from './storages/pokemon.storage';
|
|
8
|
-
// Асинхронная функция для инициализации хранилища
|
|
9
|
-
export async function initializeStore() {
|
|
10
|
-
// 1. Создаем хранилище
|
|
11
|
-
const storage = await createPokemonStorage();
|
|
12
|
-
const selectors = createPokemonSelectors(storage);
|
|
13
|
-
// 2. Создаем диспетчер
|
|
14
|
-
const dispatcher = createPokemonDispatcher(storage);
|
|
15
|
-
// 3. Создаем модуль эффектов
|
|
16
|
-
const effectsModule = new EffectsModule(storage, { pokemonDispatcher: dispatcher }, { pokemonApi: pokemonEndpoints }, appConfig);
|
|
17
|
-
// 4. Добавляем объединенные эффекты
|
|
18
|
-
effectsModule.add(pokemonEffects);
|
|
19
|
-
// 5. Запускаем эффекты
|
|
20
|
-
effectsModule.start();
|
|
21
|
-
// 6. Возвращаем все, что нужно для работы с хранилищем
|
|
22
|
-
return {
|
|
23
|
-
storage,
|
|
24
|
-
selectors,
|
|
25
|
-
actions: dispatcher.dispatch,
|
|
26
|
-
state$: effectsModule.state$,
|
|
27
|
-
};
|
|
28
|
-
}
|
|
29
|
-
export const pokemonStore = await initializeStore();
|
|
30
|
-
// Экспортируем отдельно хранилище и действия для удобства использования
|
|
31
|
-
export const pokemonStorage = pokemonStore.storage;
|
|
32
|
-
export const pokemonState$ = pokemonStore.state$;
|
|
33
|
-
export const pokemonActions = pokemonStore.actions;
|
|
34
|
-
export const pokemonSelectors = pokemonStore.selectors;
|
|
35
|
-
//# sourceMappingURL=store1.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"store1.js","sourceRoot":"","sources":["../../../src/_examples/pokemons/store1.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAA;AAEhD,OAAO,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAA;AAC3C,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AACxC,OAAO,EAAE,uBAAuB,EAAE,MAAM,qCAAqC,CAAA;AAC7E,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAA;AAC1D,OAAO,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,CAAA;AACtE,OAAO,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAA;AAEjE,kDAAkD;AAClD,MAAM,CAAC,KAAK,UAAU,eAAe;IACnC,uBAAuB;IACvB,MAAM,OAAO,GAAG,MAAM,oBAAoB,EAAE,CAAA;IAE5C,MAAM,SAAS,GAAG,sBAAsB,CAAC,OAAO,CAAC,CAAA;IAEjD,uBAAuB;IACvB,MAAM,UAAU,GAAG,uBAAuB,CAAC,OAAO,CAAC,CAAA;IAEnD,6BAA6B;IAC7B,MAAM,aAAa,GAAG,IAAI,aAAa,CAAC,OAAO,EAAE,EAAE,iBAAiB,EAAE,UAAU,EAAE,EAAE,EAAE,UAAU,EAAE,gBAAgB,EAAE,EAAE,SAAS,CAAC,CAAA;IAEhI,oCAAoC;IACpC,aAAa,CAAC,GAAG,CAAC,cAAc,CAAC,CAAA;IAEjC,uBAAuB;IACvB,aAAa,CAAC,KAAK,EAAE,CAAA;IAErB,uDAAuD;IACvD,OAAO;QACL,OAAO;QACP,SAAS;QACT,OAAO,EAAE,UAAU,CAAC,QAAQ;QAC5B,MAAM,EAAE,aAAa,CAAC,MAAM;KAC7B,CAAA;AACH,CAAC;AAED,MAAM,CAAC,MAAM,YAAY,GAAG,MAAM,eAAe,EAAE,CAAA;AAEnD,wEAAwE;AACxE,MAAM,CAAC,MAAM,cAAc,GAAG,YAAY,CAAC,OAAO,CAAA;AAClD,MAAM,CAAC,MAAM,aAAa,GAAG,YAAY,CAAC,MAAM,CAAA;AAChD,MAAM,CAAC,MAAM,cAAc,GAAG,YAAY,CAAC,OAAO,CAAA;AAClD,MAAM,CAAC,MAAM,gBAAgB,GAAG,YAAY,CAAC,SAAS,CAAA"}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
export declare function initializeStore1(): Promise<{
|
|
2
|
-
storage: any;
|
|
3
|
-
selectors: {
|
|
4
|
-
front_default: any;
|
|
5
|
-
};
|
|
6
|
-
actions: any;
|
|
7
|
-
state$: any;
|
|
8
|
-
}>;
|
|
9
|
-
export declare const pokemonStore1: {
|
|
10
|
-
storage: any;
|
|
11
|
-
selectors: {
|
|
12
|
-
front_default: any;
|
|
13
|
-
};
|
|
14
|
-
actions: any;
|
|
15
|
-
state$: any;
|
|
16
|
-
};
|
|
17
|
-
export declare const pokemon1Storage: any;
|
|
18
|
-
export declare const pokemon1State$: any;
|
|
19
|
-
export declare const pokemon1Actions: any;
|
|
20
|
-
export declare const pokemon1Selectors: {
|
|
21
|
-
front_default: any;
|
|
22
|
-
};
|
|
23
|
-
//# sourceMappingURL=store2.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"store2.d.ts","sourceRoot":"","sources":["../../../src/_examples/pokemons/store2.ts"],"names":[],"mappings":"AASA,wBAAsB,gBAAgB;;;;;;;GAyBrC;AAED,eAAO,MAAM,aAAa;;;;;;;CAA2B,CAAA;AAGrD,eAAO,MAAM,eAAe,KAAwB,CAAA;AACpD,eAAO,MAAM,cAAc,KAAuB,CAAA;AAClD,eAAO,MAAM,eAAe,KAAwB,CAAA;AACpD,eAAO,MAAM,iBAAiB;;CAA0B,CAAA"}
|