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 @@
|
|
|
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"}
|
|
@@ -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/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"}
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|
|
@@ -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/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"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=store.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"store.d.ts","sourceRoot":"","sources":["../../../src/_examples/pokemons/store.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"store.js","sourceRoot":"","sources":["../../../src/_examples/pokemons/store.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,23 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|
|
@@ -0,0 +1,35 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|
|
@@ -0,0 +1,23 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { EffectsModule } from 'synapse';
|
|
2
|
+
import { pokemonEndpoints } from './api.md';
|
|
3
|
+
import { appConfig } from './app.config';
|
|
4
|
+
import { createPokemonDispatcher } from './pokemon.dispatcher';
|
|
5
|
+
import { createPokemonSelectors1 } from './selectors/pokemon1.selectors';
|
|
6
|
+
import { createPokemonStorage } from './storages/pokemon.storage';
|
|
7
|
+
// Асинхронная функция для инициализации хранилища
|
|
8
|
+
export async function initializeStore1() {
|
|
9
|
+
// 1. Создаем хранилище
|
|
10
|
+
const storage = await createPokemonStorage();
|
|
11
|
+
const selectors = createPokemonSelectors1(storage);
|
|
12
|
+
// 2. Создаем диспетчер
|
|
13
|
+
const dispatcher = createPokemonDispatcher(storage);
|
|
14
|
+
// 3. Создаем модуль эффектов
|
|
15
|
+
const effectsModule = new EffectsModule(storage, { pokemonDispatcher: dispatcher }, { pokemonApi: pokemonEndpoints }, appConfig);
|
|
16
|
+
// 4. Добавляем объединенные эффекты
|
|
17
|
+
// effectsModule.add(pokemonEffects)
|
|
18
|
+
// 5. Запускаем эффекты
|
|
19
|
+
effectsModule.start();
|
|
20
|
+
// 6. Возвращаем все, что нужно для работы с хранилищем
|
|
21
|
+
return {
|
|
22
|
+
storage,
|
|
23
|
+
selectors,
|
|
24
|
+
actions: dispatcher.dispatch,
|
|
25
|
+
state$: effectsModule.state$,
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
export const pokemonStore1 = await initializeStore1();
|
|
29
|
+
// Экспортируем отдельно хранилище и действия для удобства использования
|
|
30
|
+
export const pokemon1Storage = pokemonStore1.storage;
|
|
31
|
+
export const pokemon1State$ = pokemonStore1.state$;
|
|
32
|
+
export const pokemon1Actions = pokemonStore1.actions;
|
|
33
|
+
export const pokemon1Selectors = pokemonStore1.selectors;
|
|
34
|
+
//# sourceMappingURL=store2.js.map
|
|
@@ -0,0 +1 @@
|
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AClD,MAAM,CAAC,MAAM,eAAe,GAAG,aAAa,CAAC,OAAO,CAAA;AACpD,MAAM,CAAC,MAAM,iBAAiB,GAAG,aAAa,CAAC,SAAS,CAAA"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export interface Pokemon {
|
|
2
|
+
id: number;
|
|
3
|
+
name: string;
|
|
4
|
+
types: Array<{
|
|
5
|
+
type: {
|
|
6
|
+
name: string;
|
|
7
|
+
};
|
|
8
|
+
}>;
|
|
9
|
+
sprites: {
|
|
10
|
+
front_default: string;
|
|
11
|
+
other?: {
|
|
12
|
+
'official-artwork'?: {
|
|
13
|
+
front_default?: string;
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
};
|
|
17
|
+
height: number;
|
|
18
|
+
weight: number;
|
|
19
|
+
}
|
|
20
|
+
export interface PokemonState {
|
|
21
|
+
currentPokemon: Pokemon | null | undefined;
|
|
22
|
+
loading: boolean;
|
|
23
|
+
error: string | null;
|
|
24
|
+
currentId: number;
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/_examples/pokemons/types.ts"],"names":[],"mappings":"AACA,MAAM,WAAW,OAAO;IACtB,EAAE,EAAE,MAAM,CAAA;IACV,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE;YAAE,IAAI,EAAE,MAAM,CAAA;SAAE,CAAA;KAAE,CAAC,CAAA;IACxC,OAAO,EAAE;QACP,aAAa,EAAE,MAAM,CAAA;QACrB,KAAK,CAAC,EAAE;YACN,kBAAkB,CAAC,EAAE;gBACnB,aAAa,CAAC,EAAE,MAAM,CAAA;aACvB,CAAA;SACF,CAAA;KACF,CAAA;IACD,MAAM,EAAE,MAAM,CAAA;IACd,MAAM,EAAE,MAAM,CAAA;CACf;AAGD,MAAM,WAAW,YAAY;IAC3B,cAAc,EAAE,OAAO,GAAG,IAAI,GAAG,SAAS,CAAA;IAC1C,OAAO,EAAE,OAAO,CAAA;IAChB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAA;IACpB,SAAS,EAAE,MAAM,CAAA;CAClB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/_examples/pokemons/types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Разбивает массив на группы элементов указанного размера.
|
|
3
|
+
* @param array - Массив для разбиения
|
|
4
|
+
* @param size - Размер каждой группы
|
|
5
|
+
* @returns Массив групп элементов
|
|
6
|
+
*/
|
|
7
|
+
export declare function chunk<T>(array: T[], size?: number): T[][];
|
|
8
|
+
//# sourceMappingURL=chunk.util.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chunk.util.d.ts","sourceRoot":"","sources":["../../src/_utils/chunk.util.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,wBAAgB,KAAK,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE,IAAI,GAAE,MAAU,GAAG,CAAC,EAAE,EAAE,CAe5D"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Разбивает массив на группы элементов указанного размера.
|
|
3
|
+
* @param array - Массив для разбиения
|
|
4
|
+
* @param size - Размер каждой группы
|
|
5
|
+
* @returns Массив групп элементов
|
|
6
|
+
*/
|
|
7
|
+
export function chunk(array, size = 1) {
|
|
8
|
+
if (size <= 0)
|
|
9
|
+
throw new Error('Size must be greater than 0');
|
|
10
|
+
if (!array || !array.length)
|
|
11
|
+
return [];
|
|
12
|
+
const result = [];
|
|
13
|
+
const length = array.length;
|
|
14
|
+
let index = 0;
|
|
15
|
+
while (index < length) {
|
|
16
|
+
result.push(array.slice(index, index + size));
|
|
17
|
+
index += size;
|
|
18
|
+
}
|
|
19
|
+
return result;
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=chunk.util.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chunk.util.js","sourceRoot":"","sources":["../../src/_utils/chunk.util.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,MAAM,UAAU,KAAK,CAAI,KAAU,EAAE,OAAe,CAAC;IACnD,IAAI,IAAI,IAAI,CAAC;QAAE,MAAM,IAAI,KAAK,CAAC,6BAA6B,CAAC,CAAA;IAE7D,IAAI,CAAC,KAAK,IAAI,CAAC,KAAK,CAAC,MAAM;QAAE,OAAO,EAAE,CAAA;IAEtC,MAAM,MAAM,GAAU,EAAE,CAAA;IACxB,MAAM,MAAM,GAAG,KAAK,CAAC,MAAM,CAAA;IAC3B,IAAI,KAAK,GAAG,CAAC,CAAA;IAEb,OAAO,KAAK,GAAG,MAAM,EAAE,CAAC;QACtB,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,KAAK,EAAE,KAAK,GAAG,IAAI,CAAC,CAAC,CAAA;QAC7C,KAAK,IAAI,IAAI,CAAA;IACf,CAAC;IAED,OAAO,MAAM,CAAA;AACf,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deepMerge.util.d.ts","sourceRoot":"","sources":["../../src/_utils/deepMerge.util.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,SAAS,GAAI,QAAQ,GAAG,EAAE,QAAQ,GAAG,SAajD,CAAA"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export const deepMerge = (target, source) => {
|
|
2
|
+
for (const key in source) {
|
|
3
|
+
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
4
|
+
if (typeof source[key] === 'object' && source[key] !== null && !Array.isArray(source[key])) {
|
|
5
|
+
if (!target[key] || typeof target[key] !== 'object') {
|
|
6
|
+
target[key] = {};
|
|
7
|
+
}
|
|
8
|
+
deepMerge(target[key], source[key]);
|
|
9
|
+
}
|
|
10
|
+
else {
|
|
11
|
+
target[key] = source[key];
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
};
|
|
16
|
+
//# sourceMappingURL=deepMerge.util.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deepMerge.util.js","sourceRoot":"","sources":["../../src/_utils/deepMerge.util.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,MAAW,EAAE,MAAW,EAAE,EAAE;IACpD,KAAK,MAAM,GAAG,IAAI,MAAM,EAAE,CAAC;QACzB,IAAI,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,CAAC;YACtD,IAAI,OAAO,MAAM,CAAC,GAAG,CAAC,KAAK,QAAQ,IAAI,MAAM,CAAC,GAAG,CAAC,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC;gBAC3F,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,OAAO,MAAM,CAAC,GAAG,CAAC,KAAK,QAAQ,EAAE,CAAC;oBACpD,MAAM,CAAC,GAAG,CAAC,GAAG,EAAE,CAAA;gBAClB,CAAC;gBACD,SAAS,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC,GAAG,CAAC,CAAC,CAAA;YACrC,CAAC;iBAAM,CAAC;gBACN,MAAM,CAAC,GAAG,CAAC,GAAG,MAAM,CAAC,GAAG,CAAC,CAAA;YAC3B,CAAC;QACH,CAAC;IACH,CAAC;AACH,CAAC,CAAA"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Создает новый массив, применяя функцию к каждому элементу массива,
|
|
3
|
+
* а затем сглаживает результат на один уровень.
|
|
4
|
+
*
|
|
5
|
+
* @param array - Исходный массив
|
|
6
|
+
* @param iteratee - Функция, применяемая к каждому элементу
|
|
7
|
+
* @returns Новый сглаженный массив
|
|
8
|
+
*/
|
|
9
|
+
export declare function flatMap<T, R>(array: T[], iteratee: (value: T, index: number, array: T[]) => R | R[]): R[];
|
|
10
|
+
//# sourceMappingURL=flatMap.util.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"flatMap.util.d.ts","sourceRoot":"","sources":["../../src/_utils/flatMap.util.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,wBAAgB,OAAO,CAAC,CAAC,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE,QAAQ,EAAE,CAAC,KAAK,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,EAAE,GAAG,CAAC,EAAE,CAczG"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Создает новый массив, применяя функцию к каждому элементу массива,
|
|
3
|
+
* а затем сглаживает результат на один уровень.
|
|
4
|
+
*
|
|
5
|
+
* @param array - Исходный массив
|
|
6
|
+
* @param iteratee - Функция, применяемая к каждому элементу
|
|
7
|
+
* @returns Новый сглаженный массив
|
|
8
|
+
*/
|
|
9
|
+
export function flatMap(array, iteratee) {
|
|
10
|
+
if (!array || !array.length)
|
|
11
|
+
return [];
|
|
12
|
+
return array.reduce((acc, value, index) => {
|
|
13
|
+
const mapped = iteratee(value, index, array);
|
|
14
|
+
if (Array.isArray(mapped)) {
|
|
15
|
+
acc.push(...mapped);
|
|
16
|
+
}
|
|
17
|
+
else {
|
|
18
|
+
acc.push(mapped);
|
|
19
|
+
}
|
|
20
|
+
return acc;
|
|
21
|
+
}, []);
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=flatMap.util.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"flatMap.util.js","sourceRoot":"","sources":["../../src/_utils/flatMap.util.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,MAAM,UAAU,OAAO,CAAO,KAAU,EAAE,QAA0D;IAClG,IAAI,CAAC,KAAK,IAAI,CAAC,KAAK,CAAC,MAAM;QAAE,OAAO,EAAE,CAAA;IAEtC,OAAO,KAAK,CAAC,MAAM,CAAC,CAAC,GAAQ,EAAE,KAAQ,EAAE,KAAa,EAAE,EAAE;QACxD,MAAM,MAAM,GAAG,QAAQ,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,CAAC,CAAA;QAE5C,IAAI,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC;YAC1B,GAAG,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC,CAAA;QACrB,CAAC;aAAM,CAAC;YACN,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;QAClB,CAAC;QAED,OAAO,GAAG,CAAA;IACZ,CAAC,EAAE,EAAE,CAAC,CAAA;AACR,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/_utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAA;AAC5B,cAAc,kBAAkB,CAAA;AAChC,cAAc,gBAAgB,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/_utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAA;AAC5B,cAAc,kBAAkB,CAAA;AAChC,cAAc,gBAAgB,CAAA"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { CreateApiClientOptions, ExtractParamsType, ExtractResultType } from './types/api.interface';
|
|
2
|
+
import { CreateEndpoint, Endpoint as EndpointType, EndpointConfig } from './types/endpoint.interface';
|
|
3
|
+
import { QueryOptions, QueryResult } from './types/query.interface';
|
|
4
|
+
type EndpointsResult<F> = F extends (create: any) => Promise<infer R> ? R : never;
|
|
5
|
+
export declare class ApiClient<EndpointsFn extends (create: CreateEndpoint) => Promise<Record<string, EndpointConfig<any, any>>>> {
|
|
6
|
+
/** Хранилище запросов */
|
|
7
|
+
private queryStorage;
|
|
8
|
+
private readonly cacheableHeaderKeys;
|
|
9
|
+
private readonly globalCacheConfig;
|
|
10
|
+
private readonly baseQueryConfig;
|
|
11
|
+
private readonly storageExternal;
|
|
12
|
+
private readonly createEndpoints;
|
|
13
|
+
/** Реестр эндпоинтов */
|
|
14
|
+
private endpoints;
|
|
15
|
+
constructor(options: Omit<CreateApiClientOptions, 'endpoints'> & {
|
|
16
|
+
endpoints: EndpointsFn;
|
|
17
|
+
});
|
|
18
|
+
init(): Promise<this>;
|
|
19
|
+
private initializeEndpoints;
|
|
20
|
+
/**
|
|
21
|
+
* Получает все эндпоинты с улучшенной типизацией
|
|
22
|
+
* @returns Типизированный объект эндпоинтов
|
|
23
|
+
*/
|
|
24
|
+
getEndpoints(): {
|
|
25
|
+
[K in keyof EndpointsResult<EndpointsFn>]: EndpointType<ExtractParamsType<EndpointsResult<EndpointsFn>[K]>, ExtractResultType<EndpointsResult<EndpointsFn>[K]>>;
|
|
26
|
+
};
|
|
27
|
+
/**
|
|
28
|
+
* Выполняет запрос к API с типизацией и обработкой ошибок
|
|
29
|
+
* @param endpointName Имя эндпоинта (с подсказками TypeScript)
|
|
30
|
+
* @param params Параметры запроса (с типизацией)
|
|
31
|
+
* @param options Опции запроса
|
|
32
|
+
* @returns Promise с типизированным результатом запроса
|
|
33
|
+
*/
|
|
34
|
+
request<K extends keyof EndpointsResult<EndpointsFn> & string>(endpointName: K, params: ExtractParamsType<EndpointsResult<EndpointsFn>[K]>, options?: QueryOptions): Promise<QueryResult<ExtractResultType<EndpointsResult<EndpointsFn>[K]>, Error>>;
|
|
35
|
+
destroy(): Promise<void>;
|
|
36
|
+
}
|
|
37
|
+
export {};
|
|
38
|
+
//# sourceMappingURL=api.module.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+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,EAAE,iBAAiB,CAAC,eAAe,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;KAChK;IAID;;;;;;OAMG;IACU,OAAO,CAAC,CAAC,SAAS,MAAM,eAAe,CAAC,WAAW,CAAC,GAAG,MAAM,EACxE,YAAY,EAAE,CAAC,EACf,MAAM,EAAE,iBAAiB,CAAC,eAAe,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC,EAC1D,OAAO,CAAC,EAAE,YAAY,GACrB,OAAO,CAAC,WAAW,CAAC,iBAAiB,CAAC,eAAe,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC;IAiBrE,OAAO;CAcrB"}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { EndpointClass } from './components/endpoint';
|
|
2
|
+
import { QueryStorage } from './components/query-storage';
|
|
3
|
+
import { apiLogger } from './utils/api-helpers';
|
|
4
|
+
export class ApiClient {
|
|
5
|
+
/** Хранилище запросов */
|
|
6
|
+
// @ts-ignore
|
|
7
|
+
queryStorage;
|
|
8
|
+
cacheableHeaderKeys;
|
|
9
|
+
globalCacheConfig;
|
|
10
|
+
baseQueryConfig;
|
|
11
|
+
storageExternal;
|
|
12
|
+
createEndpoints;
|
|
13
|
+
/** Реестр эндпоинтов */
|
|
14
|
+
endpoints = {};
|
|
15
|
+
constructor(options) {
|
|
16
|
+
// Сохраняем переданные параметры
|
|
17
|
+
this.cacheableHeaderKeys = options.cacheableHeaderKeys;
|
|
18
|
+
this.globalCacheConfig = options.cache;
|
|
19
|
+
this.baseQueryConfig = options.baseQuery;
|
|
20
|
+
this.storageExternal = options.storage;
|
|
21
|
+
this.createEndpoints = options.endpoints;
|
|
22
|
+
}
|
|
23
|
+
async init() {
|
|
24
|
+
// 1. Создаем кэшированное хранилище запросов
|
|
25
|
+
this.queryStorage = await new QueryStorage(this.storageExternal, this.globalCacheConfig).initialize();
|
|
26
|
+
// 2. Создаем эндпоинты
|
|
27
|
+
await this.initializeEndpoints();
|
|
28
|
+
return this;
|
|
29
|
+
}
|
|
30
|
+
async initializeEndpoints() {
|
|
31
|
+
// Получаем конфигурацию будущих эндпоинтов
|
|
32
|
+
const create = (config) => config;
|
|
33
|
+
// Создаем объект с конфигурациями для эндпоинтов
|
|
34
|
+
const endpointsConfig = (await this.createEndpoints(create)) || {};
|
|
35
|
+
// Создаем эндпоинты
|
|
36
|
+
for (const [endpointKey, endpointConfig] of Object.entries(endpointsConfig)) {
|
|
37
|
+
const key = endpointKey;
|
|
38
|
+
this.endpoints[key] = new EndpointClass(endpointKey, this.queryStorage, endpointConfig, this.cacheableHeaderKeys, this.globalCacheConfig, this.baseQueryConfig);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Получает все эндпоинты с улучшенной типизацией
|
|
43
|
+
* @returns Типизированный объект эндпоинтов
|
|
44
|
+
*/
|
|
45
|
+
getEndpoints() {
|
|
46
|
+
return this.endpoints;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Выполняет запрос к API с типизацией и обработкой ошибок
|
|
50
|
+
* @param endpointName Имя эндпоинта (с подсказками TypeScript)
|
|
51
|
+
* @param params Параметры запроса (с типизацией)
|
|
52
|
+
* @param options Опции запроса
|
|
53
|
+
* @returns Promise с типизированным результатом запроса
|
|
54
|
+
*/
|
|
55
|
+
async request(endpointName, params, options) {
|
|
56
|
+
const endpoints = this.getEndpoints();
|
|
57
|
+
const endpoint = endpoints[endpointName];
|
|
58
|
+
if (!endpoint) {
|
|
59
|
+
throw new Error(`Эндпоинт ${String(endpointName)} не найден`);
|
|
60
|
+
}
|
|
61
|
+
try {
|
|
62
|
+
const stateRequest = endpoint.request(params, options);
|
|
63
|
+
return await stateRequest.wait();
|
|
64
|
+
}
|
|
65
|
+
catch (error) {
|
|
66
|
+
apiLogger.error(`Ошибка запроса к ${String(endpointName)}`, { error, params });
|
|
67
|
+
throw error;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
async destroy() {
|
|
71
|
+
// 1. Сначала уничтожаем каждый эндпоинт
|
|
72
|
+
await Promise.all(Object.values(this.endpoints).map(async (endpoint) => {
|
|
73
|
+
endpoint.destroy();
|
|
74
|
+
return Promise.resolve();
|
|
75
|
+
}));
|
|
76
|
+
// 2. Очищаем коллекцию эндпоинтов
|
|
77
|
+
this.endpoints = {};
|
|
78
|
+
// 3. Уничтожаем хранилище
|
|
79
|
+
await this.queryStorage.destroy();
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
//# sourceMappingURL=api.module.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api.module.js","sourceRoot":"","sources":["../../src/api/api.module.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAA;AACrD,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAA;AAIzD,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAA;AAK/C,MAAM,OAAO,SAAS;IACpB,yBAAyB;IACzB,aAAa;IACL,YAAY,CAAc;IAEjB,mBAAmB,CAA+C;IAElE,iBAAiB,CAAiC;IAElD,eAAe,CAAqC;IAEpD,eAAe,CAAmC;IAElD,eAAe,CAAa;IAE7C,wBAAwB;IAChB,SAAS,GAEb,EAAE,CAAA;IAEN,YAAY,OAA+E;QACzF,iCAAiC;QACjC,IAAI,CAAC,mBAAmB,GAAG,OAAO,CAAC,mBAAmB,CAAA;QACtD,IAAI,CAAC,iBAAiB,GAAG,OAAO,CAAC,KAAK,CAAA;QACtC,IAAI,CAAC,eAAe,GAAG,OAAO,CAAC,SAAS,CAAA;QACxC,IAAI,CAAC,eAAe,GAAG,OAAO,CAAC,OAAO,CAAA;QACtC,IAAI,CAAC,eAAe,GAAG,OAAO,CAAC,SAAS,CAAA;IAC1C,CAAC;IAEM,KAAK,CAAC,IAAI;QACf,6CAA6C;QAC7C,IAAI,CAAC,YAAY,GAAG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,CAAC,OAAO,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;YACtD,OAAO,MAAM,YAAY,CAAC,IAAI,EAAE,CAAA;QAClC,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,SAAS,CAAC,KAAK,CAAC,oBAAoB,MAAM,CAAC,YAAY,CAAC,EAAE,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC,CAAA;YAC9E,MAAM,KAAK,CAAA;QACb,CAAC;IACH,CAAC;IAEM,KAAK,CAAC,OAAO;QAClB,wCAAwC;QACxC,MAAM,OAAO,CAAC,GAAG,CACf,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,GAAG,CAAC,KAAK,EAAE,QAAQ,EAAE,EAAE;YACnD,QAAQ,CAAC,OAAO,EAAE,CAAA;YAClB,OAAO,OAAO,CAAC,OAAO,EAAE,CAAA;QAC1B,CAAC,CAAC,CACH,CAAA;QAED,kCAAkC;QAClC,IAAI,CAAC,SAAS,GAAG,EAAE,CAAA;QACnB,0BAA0B;QAC1B,MAAM,IAAI,CAAC,YAAY,CAAC,OAAO,EAAE,CAAA;IACnC,CAAC;CACF"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { CreateApiClientOptions } from '../types/api.interface';
|
|
2
|
+
import { Endpoint as EndpointType, EndpointConfig, EndpointState, RequestResponseModify } from '../types/endpoint.interface';
|
|
3
|
+
import { QueryOptions, Unsubscribe } from '../types/query.interface';
|
|
4
|
+
import { QueryStorage } from './query-storage';
|
|
5
|
+
export declare class EndpointClass<RequestParams extends Record<string, any>, RequestResponse> implements EndpointType<RequestParams, RequestResponse> {
|
|
6
|
+
private readonly name;
|
|
7
|
+
private readonly queryStorage;
|
|
8
|
+
private readonly configCurrentEndpoint;
|
|
9
|
+
private readonly cacheableHeaderKeys;
|
|
10
|
+
private readonly globalCacheConfig;
|
|
11
|
+
private readonly baseQueryConfig;
|
|
12
|
+
private readonly endpointSubscribers;
|
|
13
|
+
/** Сколько раз был вызван метод request */
|
|
14
|
+
fetchCounts: number;
|
|
15
|
+
meta: EndpointType['meta'];
|
|
16
|
+
private readonly queryFunction;
|
|
17
|
+
/** Массив заголовков, которые нужно включить в ключ кэширования */
|
|
18
|
+
private readonly cacheableHeaders;
|
|
19
|
+
private readonly prepareHeaders;
|
|
20
|
+
constructor(name: string, queryStorage: QueryStorage, configCurrentEndpoint: EndpointConfig<RequestParams, RequestResponse>, cacheableHeaderKeys: CreateApiClientOptions['cacheableHeaderKeys'], globalCacheConfig: CreateApiClientOptions['cache'], baseQueryConfig: CreateApiClientOptions['baseQuery']);
|
|
21
|
+
request(params: RequestParams, options?: QueryOptions): RequestResponseModify<RequestResponse>;
|
|
22
|
+
subscribe(cb: (state: EndpointState) => void): Unsubscribe;
|
|
23
|
+
reset(): Promise<void>;
|
|
24
|
+
destroy(): void;
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=endpoint.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"endpoint.d.ts","sourceRoot":"","sources":["../../../src/api/components/endpoint.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,wBAAwB,CAAA;AAC/D,OAAO,EAAE,QAAQ,IAAI,YAAY,EAAE,cAAc,EAAE,aAAa,EAAE,qBAAqB,EAAgB,MAAM,6BAA6B,CAAA;AAC1I,OAAO,EAAE,YAAY,EAAe,WAAW,EAAE,MAAM,0BAA0B,CAAA;AAMjF,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;AAE9C,qBAAa,aAAa,CAAC,aAAa,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,eAAe,CAAE,YAAW,YAAY,CAAC,aAAa,EAAE,eAAe,CAAC;IAqB1I,OAAO,CAAC,QAAQ,CAAC,IAAI;IACrB,OAAO,CAAC,QAAQ,CAAC,YAAY;IAC7B,OAAO,CAAC,QAAQ,CAAC,qBAAqB;IACt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