synapse-storage 2.1.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/README.md +1038 -0
- package/dist/_examples/_example5.d.ts +1 -0
- package/dist/_examples/_example5.d.ts.map +1 -0
- package/dist/_examples/_example5.js +184 -0
- package/dist/_examples/_example5.js.map +1 -0
- package/dist/_examples/_example6.d.ts +1 -0
- package/dist/_examples/_example6.d.ts.map +1 -0
- package/dist/_examples/_example6.js +168 -0
- package/dist/_examples/_example6.js.map +1 -0
- package/dist/_examples/example1.d.ts +1 -0
- package/dist/_examples/example1.d.ts.map +1 -0
- package/dist/_examples/example1.js +240 -0
- package/dist/_examples/example1.js.map +1 -0
- package/dist/_examples/example2.d.ts +1 -0
- package/dist/_examples/example2.d.ts.map +1 -0
- package/dist/_examples/example2.js +81 -0
- package/dist/_examples/example2.js.map +1 -0
- package/dist/_examples/example3.d.ts +1 -0
- package/dist/_examples/example3.d.ts.map +1 -0
- package/dist/_examples/example3.js +99 -0
- package/dist/_examples/example3.js.map +1 -0
- package/dist/_examples/example4.d.ts +1 -0
- package/dist/_examples/example4.d.ts.map +1 -0
- package/dist/_examples/example4.js +172 -0
- package/dist/_examples/example4.js.map +1 -0
- package/dist/_examples/example5.d.ts +1 -0
- package/dist/_examples/example5.d.ts.map +1 -0
- package/dist/_examples/example5.js +184 -0
- package/dist/_examples/example5.js.map +1 -0
- package/dist/_examples/example6.d.ts +1 -0
- package/dist/_examples/example6.d.ts.map +1 -0
- package/dist/_examples/example6.js +168 -0
- package/dist/_examples/example6.js.map +1 -0
- package/dist/_examples/plugins.d.ts +1 -0
- package/dist/_examples/plugins.d.ts.map +1 -0
- package/dist/_examples/plugins.js +176 -0
- package/dist/_examples/plugins.js.map +1 -0
- package/dist/_examples/pokemons/PokemonList.d.ts +5 -0
- package/dist/_examples/pokemons/PokemonList.d.ts.map +1 -0
- package/dist/_examples/pokemons/PokemonList.js +166 -0
- package/dist/_examples/pokemons/PokemonList.js.map +1 -0
- package/dist/_examples/pokemons/api.d.ts +8 -0
- package/dist/_examples/pokemons/api.d.ts.map +1 -0
- package/dist/_examples/pokemons/api.js +45 -0
- package/dist/_examples/pokemons/api.js.map +1 -0
- package/dist/_examples/pokemons/app.config.d.ts +15 -0
- package/dist/_examples/pokemons/app.config.d.ts.map +1 -0
- package/dist/_examples/pokemons/app.config.js +15 -0
- package/dist/_examples/pokemons/app.config.js.map +1 -0
- package/dist/_examples/pokemons/dispatchers/pokemon.dispatcher.d.ts +9 -0
- package/dist/_examples/pokemons/dispatchers/pokemon.dispatcher.d.ts.map +1 -0
- package/dist/_examples/pokemons/dispatchers/pokemon.dispatcher.js +122 -0
- package/dist/_examples/pokemons/dispatchers/pokemon.dispatcher.js.map +1 -0
- package/dist/_examples/pokemons/effects/pokemon.effects.d.ts +16 -0
- package/dist/_examples/pokemons/effects/pokemon.effects.d.ts.map +1 -0
- package/dist/_examples/pokemons/effects/pokemon.effects.js +39 -0
- package/dist/_examples/pokemons/effects/pokemon.effects.js.map +1 -0
- package/dist/_examples/pokemons/middlewares/pokenon.middlewares.d.ts +4 -0
- package/dist/_examples/pokemons/middlewares/pokenon.middlewares.d.ts.map +1 -0
- package/dist/_examples/pokemons/middlewares/pokenon.middlewares.js +27 -0
- package/dist/_examples/pokemons/middlewares/pokenon.middlewares.js.map +1 -0
- package/dist/_examples/pokemons/pokemon.dispatcher.d.ts +9 -0
- package/dist/_examples/pokemons/pokemon.dispatcher.d.ts.map +1 -0
- package/dist/_examples/pokemons/pokemon.dispatcher.js +122 -0
- package/dist/_examples/pokemons/pokemon.dispatcher.js.map +1 -0
- package/dist/_examples/pokemons/pokemon.effects.d.ts +5 -0
- package/dist/_examples/pokemons/pokemon.effects.d.ts.map +1 -0
- package/dist/_examples/pokemons/pokemon.effects.js +39 -0
- package/dist/_examples/pokemons/pokemon.effects.js.map +1 -0
- package/dist/_examples/pokemons/pokemon.selectors.d.ts +5 -0
- package/dist/_examples/pokemons/pokemon.selectors.d.ts.map +1 -0
- package/dist/_examples/pokemons/pokemon.selectors.js +10 -0
- package/dist/_examples/pokemons/pokemon.selectors.js.map +1 -0
- package/dist/_examples/pokemons/pokemon.storage.d.ts +3 -0
- package/dist/_examples/pokemons/pokemon.storage.d.ts.map +1 -0
- package/dist/_examples/pokemons/pokemon.storage.js +14 -0
- package/dist/_examples/pokemons/pokemon.storage.js.map +1 -0
- package/dist/_examples/pokemons/pokemon1.selectors.d.ts +5 -0
- package/dist/_examples/pokemons/pokemon1.selectors.d.ts.map +1 -0
- package/dist/_examples/pokemons/pokemon1.selectors.js +8 -0
- package/dist/_examples/pokemons/pokemon1.selectors.js.map +1 -0
- package/dist/_examples/pokemons/pokenon.middlewares.d.ts +4 -0
- package/dist/_examples/pokemons/pokenon.middlewares.d.ts.map +1 -0
- package/dist/_examples/pokemons/pokenon.middlewares.js +27 -0
- package/dist/_examples/pokemons/pokenon.middlewares.js.map +1 -0
- package/dist/_examples/pokemons/selectors/pokemon.selectors.d.ts +5 -0
- package/dist/_examples/pokemons/selectors/pokemon.selectors.d.ts.map +1 -0
- package/dist/_examples/pokemons/selectors/pokemon.selectors.js +10 -0
- package/dist/_examples/pokemons/selectors/pokemon.selectors.js.map +1 -0
- package/dist/_examples/pokemons/selectors/pokemon1.selectors.d.ts +5 -0
- package/dist/_examples/pokemons/selectors/pokemon1.selectors.d.ts.map +1 -0
- package/dist/_examples/pokemons/selectors/pokemon1.selectors.js +8 -0
- package/dist/_examples/pokemons/selectors/pokemon1.selectors.js.map +1 -0
- package/dist/_examples/pokemons/storages/pokemon.storage.d.ts +3 -0
- package/dist/_examples/pokemons/storages/pokemon.storage.d.ts.map +1 -0
- package/dist/_examples/pokemons/storages/pokemon.storage.js +14 -0
- package/dist/_examples/pokemons/storages/pokemon.storage.js.map +1 -0
- package/dist/_examples/pokemons/store.d.ts +1 -0
- package/dist/_examples/pokemons/store.d.ts.map +1 -0
- package/dist/_examples/pokemons/store.js +2 -0
- package/dist/_examples/pokemons/store.js.map +1 -0
- package/dist/_examples/pokemons/store1.d.ts +23 -0
- package/dist/_examples/pokemons/store1.d.ts.map +1 -0
- package/dist/_examples/pokemons/store1.js +35 -0
- package/dist/_examples/pokemons/store1.js.map +1 -0
- package/dist/_examples/pokemons/store2.d.ts +23 -0
- package/dist/_examples/pokemons/store2.d.ts.map +1 -0
- package/dist/_examples/pokemons/store2.js +34 -0
- package/dist/_examples/pokemons/store2.js.map +1 -0
- package/dist/_examples/pokemons/types.d.ts +26 -0
- package/dist/_examples/pokemons/types.d.ts.map +1 -0
- package/dist/_examples/pokemons/types.js +2 -0
- package/dist/_examples/pokemons/types.js.map +1 -0
- package/dist/_utils/chunk.util.d.ts +8 -0
- package/dist/_utils/chunk.util.d.ts.map +1 -0
- package/dist/_utils/chunk.util.js +21 -0
- package/dist/_utils/chunk.util.js.map +1 -0
- package/dist/_utils/deepMerge.util.d.ts +2 -0
- package/dist/_utils/deepMerge.util.d.ts.map +1 -0
- package/dist/_utils/deepMerge.util.js +16 -0
- package/dist/_utils/deepMerge.util.js.map +1 -0
- package/dist/_utils/flatMap.util.d.ts +10 -0
- package/dist/_utils/flatMap.util.d.ts.map +1 -0
- package/dist/_utils/flatMap.util.js +23 -0
- package/dist/_utils/flatMap.util.js.map +1 -0
- package/dist/_utils/index.d.ts +4 -0
- package/dist/_utils/index.d.ts.map +1 -0
- package/dist/_utils/index.js +4 -0
- package/dist/_utils/index.js.map +1 -0
- package/dist/api/api.module.d.ts +38 -0
- package/dist/api/api.module.d.ts.map +1 -0
- package/dist/api/api.module.js +82 -0
- package/dist/api/api.module.js.map +1 -0
- package/dist/api/components/endpoint.d.ts +26 -0
- package/dist/api/components/endpoint.d.ts.map +1 -0
- package/dist/api/components/endpoint.js +253 -0
- package/dist/api/components/endpoint.js.map +1 -0
- package/dist/api/components/query-storage.d.ts +84 -0
- package/dist/api/components/query-storage.d.ts.map +1 -0
- package/dist/api/components/query-storage.js +221 -0
- package/dist/api/components/query-storage.js.map +1 -0
- package/dist/api/example.d.ts +83 -0
- package/dist/api/example.d.ts.map +1 -0
- package/dist/api/example.js +85 -0
- package/dist/api/example.js.map +1 -0
- package/dist/api/index.d.ts +4 -0
- package/dist/api/index.d.ts.map +1 -0
- package/dist/api/index.js +6 -0
- package/dist/api/index.js.map +1 -0
- package/dist/api/types/api.interface.d.ts +108 -0
- package/dist/api/types/api.interface.d.ts.map +1 -0
- package/dist/api/types/api.interface.js +19 -0
- package/dist/api/types/api.interface.js.map +1 -0
- package/dist/api/types/endpoint.interface.d.ts +116 -0
- package/dist/api/types/endpoint.interface.d.ts.map +1 -0
- package/dist/api/types/endpoint.interface.js +2 -0
- package/dist/api/types/endpoint.interface.js.map +1 -0
- package/dist/api/types/query.interface.d.ts +87 -0
- package/dist/api/types/query.interface.d.ts.map +1 -0
- package/dist/api/types/query.interface.js +2 -0
- package/dist/api/types/query.interface.js.map +1 -0
- package/dist/api/utils/api-helpers.d.ts +22 -0
- package/dist/api/utils/api-helpers.d.ts.map +1 -0
- package/dist/api/utils/api-helpers.js +44 -0
- package/dist/api/utils/api-helpers.js.map +1 -0
- package/dist/api/utils/create-header-context.d.ts +10 -0
- package/dist/api/utils/create-header-context.d.ts.map +1 -0
- package/dist/api/utils/create-header-context.js +36 -0
- package/dist/api/utils/create-header-context.js.map +1 -0
- package/dist/api/utils/endpoint-headers.d.ts +23 -0
- package/dist/api/utils/endpoint-headers.d.ts.map +1 -0
- package/dist/api/utils/endpoint-headers.js +57 -0
- package/dist/api/utils/endpoint-headers.js.map +1 -0
- package/dist/api/utils/fetch-base-query.d.ts +9 -0
- package/dist/api/utils/fetch-base-query.d.ts.map +1 -0
- package/dist/api/utils/fetch-base-query.js +181 -0
- package/dist/api/utils/fetch-base-query.js.map +1 -0
- package/dist/api/utils/file-utils.d.ts +43 -0
- package/dist/api/utils/file-utils.d.ts.map +1 -0
- package/dist/api/utils/file-utils.js +108 -0
- package/dist/api/utils/file-utils.js.map +1 -0
- package/dist/api/utils/get-cacheable-headers.d.ts +8 -0
- package/dist/api/utils/get-cacheable-headers.d.ts.map +1 -0
- package/dist/api/utils/get-cacheable-headers.js +21 -0
- package/dist/api/utils/get-cacheable-headers.js.map +1 -0
- package/dist/core/index.d.ts +3 -0
- package/dist/core/index.d.ts.map +1 -0
- package/dist/core/index.js +3 -0
- package/dist/core/index.js.map +1 -0
- package/dist/core/selector/index.d.ts +3 -0
- package/dist/core/selector/index.d.ts.map +1 -0
- package/dist/core/selector/index.js +2 -0
- package/dist/core/selector/index.js.map +1 -0
- package/dist/core/selector/selector.interface.d.ts +91 -0
- package/dist/core/selector/selector.interface.d.ts.map +1 -0
- package/dist/core/selector/selector.interface.js +2 -0
- package/dist/core/selector/selector.interface.js.map +1 -0
- package/dist/core/selector/selector.module.d.ts +29 -0
- package/dist/core/selector/selector.module.d.ts.map +1 -0
- package/dist/core/selector/selector.module.js +467 -0
- package/dist/core/selector/selector.module.js.map +1 -0
- package/dist/core/storage/adapters/base-storage.service.d.ts +65 -0
- package/dist/core/storage/adapters/base-storage.service.d.ts.map +1 -0
- package/dist/core/storage/adapters/base-storage.service.js +660 -0
- package/dist/core/storage/adapters/base-storage.service.js.map +1 -0
- package/dist/core/storage/adapters/idb.d.ts +52 -0
- package/dist/core/storage/adapters/idb.d.ts.map +1 -0
- package/dist/core/storage/adapters/idb.js +528 -0
- package/dist/core/storage/adapters/idb.js.map +1 -0
- package/dist/core/storage/adapters/indexed-DB.service.d.ts +63 -0
- package/dist/core/storage/adapters/indexed-DB.service.d.ts.map +1 -0
- package/dist/core/storage/adapters/indexed-DB.service.js +595 -0
- package/dist/core/storage/adapters/indexed-DB.service.js.map +1 -0
- package/dist/core/storage/adapters/indexed-DB.service.old.d.ts +38 -0
- package/dist/core/storage/adapters/indexed-DB.service.old.d.ts.map +1 -0
- package/dist/core/storage/adapters/indexed-DB.service.old.js +318 -0
- package/dist/core/storage/adapters/indexed-DB.service.old.js.map +1 -0
- package/dist/core/storage/adapters/indexed-DB.service1.d.ts +38 -0
- package/dist/core/storage/adapters/indexed-DB.service1.d.ts.map +1 -0
- package/dist/core/storage/adapters/indexed-DB.service1.js +318 -0
- package/dist/core/storage/adapters/indexed-DB.service1.js.map +1 -0
- package/dist/core/storage/adapters/indexed-DB.service2.d.ts +61 -0
- package/dist/core/storage/adapters/indexed-DB.service2.d.ts.map +1 -0
- package/dist/core/storage/adapters/indexed-DB.service2.js +596 -0
- package/dist/core/storage/adapters/indexed-DB.service2.js.map +1 -0
- package/dist/core/storage/adapters/local-storage.service.d.ts +21 -0
- package/dist/core/storage/adapters/local-storage.service.d.ts.map +1 -0
- package/dist/core/storage/adapters/local-storage.service.js +99 -0
- package/dist/core/storage/adapters/local-storage.service.js.map +1 -0
- package/dist/core/storage/adapters/memory-storage.service.d.ts +22 -0
- package/dist/core/storage/adapters/memory-storage.service.d.ts.map +1 -0
- package/dist/core/storage/adapters/memory-storage.service.js +99 -0
- package/dist/core/storage/adapters/memory-storage.service.js.map +1 -0
- package/dist/core/storage/adapters/path.utils.d.ts +5 -0
- package/dist/core/storage/adapters/path.utils.d.ts.map +1 -0
- package/dist/core/storage/adapters/path.utils.js +35 -0
- package/dist/core/storage/adapters/path.utils.js.map +1 -0
- package/dist/core/storage/factory/createSynapseStorage.factory.d.ts +1 -0
- package/dist/core/storage/factory/createSynapseStorage.factory.d.ts.map +1 -0
- package/dist/core/storage/factory/createSynapseStorage.factory.js +2 -0
- package/dist/core/storage/factory/createSynapseStorage.factory.js.map +1 -0
- package/dist/core/storage/factory/index.d.ts +2 -0
- package/dist/core/storage/factory/index.d.ts.map +1 -0
- package/dist/core/storage/factory/index.js +2 -0
- package/dist/core/storage/factory/index.js.map +1 -0
- package/dist/core/storage/index.d.ts +11 -0
- package/dist/core/storage/index.d.ts.map +1 -0
- package/dist/core/storage/index.js +12 -0
- package/dist/core/storage/index.js.map +1 -0
- package/dist/core/storage/middlewares/broadcast.middleware.d.ts +9 -0
- package/dist/core/storage/middlewares/broadcast.middleware.d.ts.map +1 -0
- package/dist/core/storage/middlewares/broadcast.middleware.js +115 -0
- package/dist/core/storage/middlewares/broadcast.middleware.js.map +1 -0
- package/dist/core/storage/middlewares/index.d.ts +4 -0
- package/dist/core/storage/middlewares/index.d.ts.map +1 -0
- package/dist/core/storage/middlewares/index.js +3 -0
- package/dist/core/storage/middlewares/index.js.map +1 -0
- package/dist/core/storage/middlewares/storage-batching.middleware.d.ts +7 -0
- package/dist/core/storage/middlewares/storage-batching.middleware.d.ts.map +1 -0
- package/dist/core/storage/middlewares/storage-batching.middleware.js +36 -0
- package/dist/core/storage/middlewares/storage-batching.middleware.js.map +1 -0
- package/dist/core/storage/middlewares/storage-shallow-compare.middleware.d.ts +7 -0
- package/dist/core/storage/middlewares/storage-shallow-compare.middleware.d.ts.map +1 -0
- package/dist/core/storage/middlewares/storage-shallow-compare.middleware.js +46 -0
- package/dist/core/storage/middlewares/storage-shallow-compare.middleware.js.map +1 -0
- package/dist/core/storage/modules/plugin/plugin.interface.d.ts +201 -0
- package/dist/core/storage/modules/plugin/plugin.interface.d.ts.map +1 -0
- package/dist/core/storage/modules/plugin/plugin.interface.js +2 -0
- package/dist/core/storage/modules/plugin/plugin.interface.js.map +1 -0
- package/dist/core/storage/modules/plugin/plugin.service.d.ts +25 -0
- package/dist/core/storage/modules/plugin/plugin.service.d.ts.map +1 -0
- package/dist/core/storage/modules/plugin/plugin.service.js +186 -0
- package/dist/core/storage/modules/plugin/plugin.service.js.map +1 -0
- package/dist/core/storage/storage.interface.d.ts +70 -0
- package/dist/core/storage/storage.interface.d.ts.map +1 -0
- package/dist/core/storage/storage.interface.js +10 -0
- package/dist/core/storage/storage.interface.js.map +1 -0
- package/dist/core/storage/utils/batch.utils.d.ts +33 -0
- package/dist/core/storage/utils/batch.utils.d.ts.map +1 -0
- package/dist/core/storage/utils/batch.utils.js +88 -0
- package/dist/core/storage/utils/batch.utils.js.map +1 -0
- package/dist/core/storage/utils/broadcast.util.d.ts +48 -0
- package/dist/core/storage/utils/broadcast.util.d.ts.map +1 -0
- package/dist/core/storage/utils/broadcast.util.js +162 -0
- package/dist/core/storage/utils/broadcast.util.js.map +1 -0
- package/dist/core/storage/utils/cache.util.d.ts +33 -0
- package/dist/core/storage/utils/cache.util.d.ts.map +1 -0
- package/dist/core/storage/utils/cache.util.js +47 -0
- package/dist/core/storage/utils/cache.util.js.map +1 -0
- package/dist/core/storage/utils/middleware-module.d.ts +46 -0
- package/dist/core/storage/utils/middleware-module.d.ts.map +1 -0
- package/dist/core/storage/utils/middleware-module.js +109 -0
- package/dist/core/storage/utils/middleware-module.js.map +1 -0
- package/dist/core/storage/utils/storage-key.d.ts +11 -0
- package/dist/core/storage/utils/storage-key.d.ts.map +1 -0
- package/dist/core/storage/utils/storage-key.js +21 -0
- package/dist/core/storage/utils/storage-key.js.map +1 -0
- package/dist/core/storage/utils/storage.utils.d.ts +17 -0
- package/dist/core/storage/utils/storage.utils.d.ts.map +1 -0
- package/dist/core/storage/utils/storage.utils.js +57 -0
- package/dist/core/storage/utils/storage.utils.js.map +1 -0
- package/dist/examples/_example5.d.ts +1 -0
- package/dist/examples/_example5.d.ts.map +1 -0
- package/dist/examples/_example5.js +184 -0
- package/dist/examples/_example5.js.map +1 -0
- package/dist/examples/_example6.d.ts +1 -0
- package/dist/examples/_example6.d.ts.map +1 -0
- package/dist/examples/_example6.js +168 -0
- package/dist/examples/_example6.js.map +1 -0
- package/dist/examples/plugins.d.ts +1 -0
- package/dist/examples/plugins.d.ts.map +1 -0
- package/dist/examples/plugins.js +176 -0
- package/dist/examples/plugins.js.map +1 -0
- package/dist/examples/pokemons/PokemonList.d.ts +2 -0
- package/dist/examples/pokemons/PokemonList.d.ts.map +1 -0
- package/dist/examples/pokemons/PokemonList.js +110 -0
- package/dist/examples/pokemons/PokemonList.js.map +1 -0
- package/dist/examples/pokemons/api.d.ts +22 -0
- package/dist/examples/pokemons/api.d.ts.map +1 -0
- package/dist/examples/pokemons/api.js +43 -0
- package/dist/examples/pokemons/api.js.map +1 -0
- package/dist/examples/pokemons/app.config.d.ts +15 -0
- package/dist/examples/pokemons/app.config.d.ts.map +1 -0
- package/dist/examples/pokemons/app.config.js +15 -0
- package/dist/examples/pokemons/app.config.js.map +1 -0
- package/dist/examples/pokemons/dispatchers/pokemon.dispatcher.js +128 -0
- package/dist/examples/pokemons/dispatchers/pokemon.dispatcher.js.map +1 -0
- package/dist/examples/pokemons/effects/pokemon.effects.d.ts +16 -0
- package/dist/examples/pokemons/effects/pokemon.effects.d.ts.map +1 -0
- package/dist/examples/pokemons/effects/pokemon.effects.js +51 -0
- package/dist/examples/pokemons/effects/pokemon.effects.js.map +1 -0
- package/dist/examples/pokemons/middlewares/pokenon.middlewares.d.ts +4 -0
- package/dist/examples/pokemons/middlewares/pokenon.middlewares.d.ts.map +1 -0
- package/dist/examples/pokemons/middlewares/pokenon.middlewares.js +28 -0
- package/dist/examples/pokemons/middlewares/pokenon.middlewares.js.map +1 -0
- package/dist/examples/pokemons/selectors/pokemon.selectors.d.ts +13 -0
- package/dist/examples/pokemons/selectors/pokemon.selectors.d.ts.map +1 -0
- package/dist/examples/pokemons/selectors/pokemon.selectors.js +7 -0
- package/dist/examples/pokemons/selectors/pokemon.selectors.js.map +1 -0
- package/dist/examples/pokemons/storages/pokemon.storage.d.ts +5 -0
- package/dist/examples/pokemons/storages/pokemon.storage.d.ts.map +1 -0
- package/dist/examples/pokemons/storages/pokemon.storage.js +13 -0
- package/dist/examples/pokemons/storages/pokemon.storage.js.map +1 -0
- package/dist/examples/pokemons/store.d.ts +35 -0
- package/dist/examples/pokemons/store.d.ts.map +1 -0
- package/dist/examples/pokemons/store.js +21 -0
- package/dist/examples/pokemons/store.js.map +1 -0
- package/dist/examples/pokemons/types.d.ts +26 -0
- package/dist/examples/pokemons/types.d.ts.map +1 -0
- package/dist/examples/pokemons/types.js +2 -0
- package/dist/examples/pokemons/types.js.map +1 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +18 -0
- package/dist/index.js.map +1 -0
- package/dist/react/hooks/index.d.ts +3 -0
- package/dist/react/hooks/index.d.ts.map +1 -0
- package/dist/react/hooks/index.js +3 -0
- package/dist/react/hooks/index.js.map +1 -0
- package/dist/react/hooks/useSelector.d.ts +22 -0
- package/dist/react/hooks/useSelector.d.ts.map +1 -0
- package/dist/react/hooks/useSelector.js +104 -0
- package/dist/react/hooks/useSelector.js.map +1 -0
- package/dist/react/hooks/useStorageSubscribe.d.ts +12 -0
- package/dist/react/hooks/useStorageSubscribe.d.ts.map +1 -0
- package/dist/react/hooks/useStorageSubscribe.js +49 -0
- package/dist/react/hooks/useStorageSubscribe.js.map +1 -0
- package/dist/react/index.d.ts +3 -0
- package/dist/react/index.d.ts.map +1 -0
- package/dist/react/index.js +3 -0
- package/dist/react/index.js.map +1 -0
- package/dist/react/utils/createSynapse.d.ts +47 -0
- package/dist/react/utils/createSynapse.d.ts.map +1 -0
- package/dist/react/utils/createSynapse.js +83 -0
- package/dist/react/utils/createSynapse.js.map +1 -0
- package/dist/react/utils/createSynapseContext.d.ts +29 -0
- package/dist/react/utils/createSynapseContext.d.ts.map +1 -0
- package/dist/react/utils/createSynapseContext.js +112 -0
- package/dist/react/utils/createSynapseContext.js.map +1 -0
- package/dist/react/utils/createSynapseCtx.d.ts +30 -0
- package/dist/react/utils/createSynapseCtx.d.ts.map +1 -0
- package/dist/react/utils/createSynapseCtx.js +124 -0
- package/dist/react/utils/createSynapseCtx.js.map +1 -0
- package/dist/react/utils/index.d.ts +2 -0
- package/dist/react/utils/index.d.ts.map +1 -0
- package/dist/react/utils/index.js +2 -0
- package/dist/react/utils/index.js.map +1 -0
- package/dist/reactive/dispatcher/dispatcher.module.d.ts +195 -0
- package/dist/reactive/dispatcher/dispatcher.module.d.ts.map +1 -0
- package/dist/reactive/dispatcher/dispatcher.module.js +288 -0
- package/dist/reactive/dispatcher/dispatcher.module.js.map +1 -0
- package/dist/reactive/dispatcher/index.d.ts +3 -0
- package/dist/reactive/dispatcher/index.d.ts.map +1 -0
- package/dist/reactive/dispatcher/index.js +3 -0
- package/dist/reactive/dispatcher/index.js.map +1 -0
- package/dist/reactive/dispatcher/middlewares/index.d.ts +2 -0
- package/dist/reactive/dispatcher/middlewares/index.d.ts.map +1 -0
- package/dist/reactive/dispatcher/middlewares/index.js +2 -0
- package/dist/reactive/dispatcher/middlewares/index.js.map +1 -0
- package/dist/reactive/dispatcher/middlewares/logger.middleware.d.ts +31 -0
- package/dist/reactive/dispatcher/middlewares/logger.middleware.d.ts.map +1 -0
- package/dist/reactive/dispatcher/middlewares/logger.middleware.js +126 -0
- package/dist/reactive/dispatcher/middlewares/logger.middleware.js.map +1 -0
- package/dist/reactive/effects/effects.module.d.ts +140 -0
- package/dist/reactive/effects/effects.module.d.ts.map +1 -0
- package/dist/reactive/effects/effects.module.js +263 -0
- package/dist/reactive/effects/effects.module.js.map +1 -0
- package/dist/reactive/effects/index.d.ts +2 -0
- package/dist/reactive/effects/index.d.ts.map +1 -0
- package/dist/reactive/effects/index.js +2 -0
- package/dist/reactive/effects/index.js.map +1 -0
- package/dist/reactive/effects/utils/chunkRequestConsistent.d.ts +12 -0
- package/dist/reactive/effects/utils/chunkRequestConsistent.d.ts.map +1 -0
- package/dist/reactive/effects/utils/chunkRequestConsistent.js +16 -0
- package/dist/reactive/effects/utils/chunkRequestConsistent.js.map +1 -0
- package/dist/reactive/effects/utils/chunkRequestParallel.d.ts +12 -0
- package/dist/reactive/effects/utils/chunkRequestParallel.d.ts.map +1 -0
- package/dist/reactive/effects/utils/chunkRequestParallel.js +13 -0
- package/dist/reactive/effects/utils/chunkRequestParallel.js.map +1 -0
- package/dist/reactive/effects/utils/index.d.ts +3 -0
- package/dist/reactive/effects/utils/index.d.ts.map +1 -0
- package/dist/reactive/effects/utils/index.js +3 -0
- package/dist/reactive/effects/utils/index.js.map +1 -0
- package/dist/reactive/index.d.ts +3 -0
- package/dist/reactive/index.d.ts.map +1 -0
- package/dist/reactive/index.js +3 -0
- package/dist/reactive/index.js.map +1 -0
- package/dist/utils/chunk.util.d.ts +8 -0
- package/dist/utils/chunk.util.d.ts.map +1 -0
- package/dist/utils/chunk.util.js +21 -0
- package/dist/utils/chunk.util.js.map +1 -0
- package/dist/utils/createSynapse.d.ts +52 -0
- package/dist/utils/createSynapse.d.ts.map +1 -0
- package/dist/utils/createSynapse.js +87 -0
- package/dist/utils/createSynapse.js.map +1 -0
- package/dist/utils/deepMerge.util.d.ts +2 -0
- package/dist/utils/deepMerge.util.d.ts.map +1 -0
- package/dist/utils/deepMerge.util.js +16 -0
- package/dist/utils/deepMerge.util.js.map +1 -0
- package/dist/utils/flatMap.util.d.ts +10 -0
- package/dist/utils/flatMap.util.d.ts.map +1 -0
- package/dist/utils/flatMap.util.js +23 -0
- package/dist/utils/flatMap.util.js.map +1 -0
- package/dist/utils/index.d.ts +2 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/index.js +2 -0
- package/dist/utils/index.js.map +1 -0
- package/package.json +111 -0
|
@@ -0,0 +1,9 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pokemon.dispatcher.d.ts","sourceRoot":"","sources":["../../../../src/_examples/pokemons/dispatchers/pokemon.dispatcher.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAA;AAK5D,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,OAmI9D;AAGD,MAAM,MAAM,iBAAiB,GAAG,UAAU,CAAC,OAAO,uBAAuB,CAAC,CAAC"}
|
|
@@ -0,0 +1,122 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pokemon.dispatcher.js","sourceRoot":"","sources":["../../../../src/_examples/pokemons/dispatchers/pokemon.dispatcher.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,0BAA0B,EAAE,MAAM,kBAAkB,CAAA;AAE/E,OAAO,EAAE,4BAA4B,EAAE,MAAM,oCAAoC,CAAA;AAUjF,kCAAkC;AAClC,MAAM,UAAU,uBAAuB,CAAC,OAAuB;IAC7D,4BAA4B;IAC5B,MAAM,gBAAgB,GAAG,0BAA0B,C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
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { pokemonEndpoints } from '../api.md';
|
|
2
|
+
import { AppConfig } from '../app.config';
|
|
3
|
+
import { PokemonDispatcher } from '../pokemon.dispatcher';
|
|
4
|
+
import { PokemonState } from '../types';
|
|
5
|
+
type PokemonDispatcherType = {
|
|
6
|
+
pokemonDispatcher: PokemonDispatcher;
|
|
7
|
+
};
|
|
8
|
+
type PokemonApiType = {
|
|
9
|
+
pokemonApi: typeof pokemonEndpoints;
|
|
10
|
+
};
|
|
11
|
+
export declare const navigationEffect: import("../../../../dist/reactive").Effect<PokemonState, PokemonDispatcherType, PokemonApiType, AppConfig>;
|
|
12
|
+
export declare const watchIdEffect: import("../../../../dist/reactive").Effect<PokemonState, PokemonDispatcherType, PokemonApiType, AppConfig>;
|
|
13
|
+
export declare const loadPokemonEffect: import("../../../../dist/reactive").Effect<PokemonState, PokemonDispatcherType, PokemonApiType, AppConfig>;
|
|
14
|
+
export declare const pokemonEffects: import("../../../../dist/reactive").Effect<PokemonState, PokemonDispatcherType, PokemonApiType, AppConfig>;
|
|
15
|
+
export {};
|
|
16
|
+
//# sourceMappingURL=pokemon.effects.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pokemon.effects.d.ts","sourceRoot":"","sources":["../../../../src/_examples/pokemons/effects/pokemon.effects.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAA;AAC5C,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AACzC,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAA;AACzD,OAAO,EAAW,YAAY,EAAE,MAAM,UAAU,CAAA;AAGhD,KAAK,qBAAqB,GAAG;IAAE,iBAAiB,EAAE,iBAAiB,CAAA;CAAE,CAAA;AACrE,KAAK,cAAc,GAAG;IAAE,UAAU,EAAE,OAAO,gBAAgB,CAAA;CAAE,CAAA;AAG7D,eAAO,MAAM,gBAAgB,4GAQ5B,CAAA;AAGD,eAAO,MAAM,aAAa,4GAezB,CAAA;AAGD,eAAO,MAAM,iBAAiB,4GAgC7B,CAAA;AAGD,eAAO,MAAM,cAAc,4GAAqE,CAAA"}
|
|
@@ -0,0 +1,39 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pokemon.effects.js","sourceRoot":"","sources":["../../../../src/_examples/pokemons/effects/pokemon.effects.ts"],"names":[],"mappings":"AAAA,OAAO,EAAS,IAAI,EAAE,KAAK,EAAE,EAAE,EAAE,GAAG,EAAE,MAAM,MAAM,CAAA;AAClD,OAAO,EAAE,UAAU,EAAO,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAE3D,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,EAAE,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAA;AAUhH,uBAAuB;AACvB,MAAM,CAAC,MAAM,gBAAgB,GAAG,YAAY,CAAiE,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE,iBAAiB,EAAE,EAAE,CAAC,EAAE,MAAM,EAAE,EAAE,CACjK,OAAO,CAAC,IAAI,CACV,OAAO,CAAC,CAAC,iBAAiB,CAAC,QAAQ,CAAC,IAAI,EAAE,iBAAiB,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,EAC3E,SAA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AE,GAAG,MAAM,CAAC,OAAO,CAAA;QAE7B,OAAO,IAAI,CACT,UAAU,CAAC,gBAAgB,CAAC,OAAO,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,iBAAiB,CAAC;YAC5D,OAAO,EAAE,CAAC,OAAO,EAAE,EAAE;gBACnB,OAAO,CAAC,GAAG,CAAC,SAAS,EAAE,OAAO,CAAC,CAAA;gBAC/B,iBAAiB,CAAC,QAAQ,CAAC,kBAAkB,CAAC,EAAE,CAAC,CAAA;YACnD,CAAC;YACD,gCAAgC;YAChC,oCAAoC;YACpC,iDAAiD;YACjD,KAAK;YACL,+BAA+B;YAC/B,yCAAyC;YACzC,+CAA+C;YAC/C,KAAK;SACN,CAAC,CACH,CAAC,IAAI,CACJ,SAAS,CAAC,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE;YACrB,OAAO,EAAE,CAAC,iBAAiB,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,CAAA;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,CACF,CAAA;AAED,+CAA+C;AAC/C,MAAM,CAAC,MAAM,cAAc,GAAG,cAAc,CAAC,gBAAgB,EAAE,aAAa,EAAE,iBAAiB,CAAC,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|
|
@@ -0,0 +1,27 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|
|
@@ -0,0 +1,9 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|
|
@@ -0,0 +1,122 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
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,SA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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"}
|
|
@@ -0,0 +1,39 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pokemon.effects.js","sourceRoot":"","sources":["../../../src/_examples/pokemons/pokemon.effects.ts"],"names":[],"mappings":"AAAA,OAAO,EAAS,IAAI,EAAE,KAAK,EAAE,EAAE,EAAE,GAAG,EAAE,MAAM,MAAM,CAAA;AAClD,OAAO,EAAE,UAAU,EAAO,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAC3D,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,EAAE,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,SAAS,CAAA;AAUjG,uBAAuB;AACvB,MAAM,CAAC,MAAM,gBAAgB,GAAG,YAAY,CAK1C,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE,iBAAiB,EAAE,EAAE,CAAC,EAAE,MAAM,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,CACnE,OAAO,CAAC,CAAC,iBAAiB,CAAC,QAAQ,CAAC,IAAI,EAAE,iBAAiB,CA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|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|
|
@@ -0,0 +1,14 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|
|
@@ -0,0 +1,8 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|
|
@@ -0,0 +1,27 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|
|
@@ -0,0 +1,10 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|