synapse-storage 2.1.0 → 3.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (246) hide show
  1. package/README.md +32 -13
  2. package/dist/_utils/index.js +3 -3
  3. package/dist/api/api.module.js +3 -3
  4. package/dist/api/example.js +2 -2
  5. package/dist/api/index.js +5 -5
  6. package/dist/api/utils/endpoint-headers.js +1 -1
  7. package/dist/api/utils/fetch-base-query.js +1 -1
  8. package/dist/core/index.js +2 -2
  9. package/dist/core/selector/index.js +1 -1
  10. package/dist/core/storage/adapters/base-storage.service.js +1 -1
  11. package/dist/core/storage/adapters/indexed-DB.service.js +2 -2
  12. package/dist/core/storage/adapters/indexed-DB.service.old.js +2 -2
  13. package/dist/core/storage/adapters/local-storage.service.js +2 -2
  14. package/dist/core/storage/adapters/memory-storage.service.js +2 -2
  15. package/dist/core/storage/index.js +9 -9
  16. package/dist/core/storage/middlewares/index.js +1 -1
  17. package/dist/core/storage/utils/cache.util.js +1 -1
  18. package/dist/index.js +5 -9
  19. package/dist/index.js.map +1 -1
  20. package/dist/react/hooks/index.js +2 -2
  21. package/dist/react/index.js +2 -2
  22. package/dist/react/utils/createSynapseCtx.d.ts +23 -13
  23. package/dist/react/utils/createSynapseCtx.d.ts.map +1 -1
  24. package/dist/react/utils/createSynapseCtx.js +11 -10
  25. package/dist/react/utils/createSynapseCtx.js.map +1 -1
  26. package/dist/react/utils/index.js +1 -1
  27. package/dist/reactive/dispatcher/index.js +2 -2
  28. package/dist/reactive/dispatcher/middlewares/index.js +1 -1
  29. package/dist/reactive/effects/effects.module.d.ts +13 -3
  30. package/dist/reactive/effects/effects.module.d.ts.map +1 -1
  31. package/dist/reactive/effects/effects.module.js +22 -8
  32. package/dist/reactive/effects/effects.module.js.map +1 -1
  33. package/dist/reactive/effects/index.js +1 -1
  34. package/dist/reactive/effects/utils/index.js +2 -2
  35. package/dist/reactive/index.js +2 -2
  36. package/dist/utils/createSynapse.d.ts +58 -18
  37. package/dist/utils/createSynapse.d.ts.map +1 -1
  38. package/dist/utils/createSynapse.js +4 -12
  39. package/dist/utils/createSynapse.js.map +1 -1
  40. package/dist/utils/index.d.ts +1 -1
  41. package/dist/utils/index.d.ts.map +1 -1
  42. package/dist/utils/index.js +1 -1
  43. package/dist/utils/index.js.map +1 -1
  44. package/package.json +2 -2
  45. package/dist/_examples/_example5.d.ts +0 -1
  46. package/dist/_examples/_example5.d.ts.map +0 -1
  47. package/dist/_examples/_example5.js +0 -184
  48. package/dist/_examples/_example5.js.map +0 -1
  49. package/dist/_examples/_example6.d.ts +0 -1
  50. package/dist/_examples/_example6.d.ts.map +0 -1
  51. package/dist/_examples/_example6.js +0 -168
  52. package/dist/_examples/_example6.js.map +0 -1
  53. package/dist/_examples/example1.d.ts +0 -1
  54. package/dist/_examples/example1.d.ts.map +0 -1
  55. package/dist/_examples/example1.js +0 -240
  56. package/dist/_examples/example1.js.map +0 -1
  57. package/dist/_examples/example2.d.ts +0 -1
  58. package/dist/_examples/example2.d.ts.map +0 -1
  59. package/dist/_examples/example2.js +0 -81
  60. package/dist/_examples/example2.js.map +0 -1
  61. package/dist/_examples/example3.d.ts +0 -1
  62. package/dist/_examples/example3.d.ts.map +0 -1
  63. package/dist/_examples/example3.js +0 -99
  64. package/dist/_examples/example3.js.map +0 -1
  65. package/dist/_examples/example4.d.ts +0 -1
  66. package/dist/_examples/example4.d.ts.map +0 -1
  67. package/dist/_examples/example4.js +0 -172
  68. package/dist/_examples/example4.js.map +0 -1
  69. package/dist/_examples/example5.d.ts +0 -1
  70. package/dist/_examples/example5.d.ts.map +0 -1
  71. package/dist/_examples/example5.js +0 -184
  72. package/dist/_examples/example5.js.map +0 -1
  73. package/dist/_examples/example6.d.ts +0 -1
  74. package/dist/_examples/example6.d.ts.map +0 -1
  75. package/dist/_examples/example6.js +0 -168
  76. package/dist/_examples/example6.js.map +0 -1
  77. package/dist/_examples/plugins.d.ts +0 -1
  78. package/dist/_examples/plugins.d.ts.map +0 -1
  79. package/dist/_examples/plugins.js +0 -176
  80. package/dist/_examples/plugins.js.map +0 -1
  81. package/dist/_examples/pokemons/PokemonList.d.ts +0 -5
  82. package/dist/_examples/pokemons/PokemonList.d.ts.map +0 -1
  83. package/dist/_examples/pokemons/PokemonList.js +0 -166
  84. package/dist/_examples/pokemons/PokemonList.js.map +0 -1
  85. package/dist/_examples/pokemons/api.d.ts +0 -8
  86. package/dist/_examples/pokemons/api.d.ts.map +0 -1
  87. package/dist/_examples/pokemons/api.js +0 -45
  88. package/dist/_examples/pokemons/api.js.map +0 -1
  89. package/dist/_examples/pokemons/app.config.d.ts +0 -15
  90. package/dist/_examples/pokemons/app.config.d.ts.map +0 -1
  91. package/dist/_examples/pokemons/app.config.js +0 -15
  92. package/dist/_examples/pokemons/app.config.js.map +0 -1
  93. package/dist/_examples/pokemons/dispatchers/pokemon.dispatcher.d.ts +0 -9
  94. package/dist/_examples/pokemons/dispatchers/pokemon.dispatcher.d.ts.map +0 -1
  95. package/dist/_examples/pokemons/dispatchers/pokemon.dispatcher.js +0 -122
  96. package/dist/_examples/pokemons/dispatchers/pokemon.dispatcher.js.map +0 -1
  97. package/dist/_examples/pokemons/effects/pokemon.effects.d.ts +0 -16
  98. package/dist/_examples/pokemons/effects/pokemon.effects.d.ts.map +0 -1
  99. package/dist/_examples/pokemons/effects/pokemon.effects.js +0 -39
  100. package/dist/_examples/pokemons/effects/pokemon.effects.js.map +0 -1
  101. package/dist/_examples/pokemons/middlewares/pokenon.middlewares.d.ts +0 -4
  102. package/dist/_examples/pokemons/middlewares/pokenon.middlewares.d.ts.map +0 -1
  103. package/dist/_examples/pokemons/middlewares/pokenon.middlewares.js +0 -27
  104. package/dist/_examples/pokemons/middlewares/pokenon.middlewares.js.map +0 -1
  105. package/dist/_examples/pokemons/pokemon.dispatcher.d.ts +0 -9
  106. package/dist/_examples/pokemons/pokemon.dispatcher.d.ts.map +0 -1
  107. package/dist/_examples/pokemons/pokemon.dispatcher.js +0 -122
  108. package/dist/_examples/pokemons/pokemon.dispatcher.js.map +0 -1
  109. package/dist/_examples/pokemons/pokemon.effects.d.ts +0 -5
  110. package/dist/_examples/pokemons/pokemon.effects.d.ts.map +0 -1
  111. package/dist/_examples/pokemons/pokemon.effects.js +0 -39
  112. package/dist/_examples/pokemons/pokemon.effects.js.map +0 -1
  113. package/dist/_examples/pokemons/pokemon.selectors.d.ts +0 -5
  114. package/dist/_examples/pokemons/pokemon.selectors.d.ts.map +0 -1
  115. package/dist/_examples/pokemons/pokemon.selectors.js +0 -10
  116. package/dist/_examples/pokemons/pokemon.selectors.js.map +0 -1
  117. package/dist/_examples/pokemons/pokemon.storage.d.ts +0 -3
  118. package/dist/_examples/pokemons/pokemon.storage.d.ts.map +0 -1
  119. package/dist/_examples/pokemons/pokemon.storage.js +0 -14
  120. package/dist/_examples/pokemons/pokemon.storage.js.map +0 -1
  121. package/dist/_examples/pokemons/pokemon1.selectors.d.ts +0 -5
  122. package/dist/_examples/pokemons/pokemon1.selectors.d.ts.map +0 -1
  123. package/dist/_examples/pokemons/pokemon1.selectors.js +0 -8
  124. package/dist/_examples/pokemons/pokemon1.selectors.js.map +0 -1
  125. package/dist/_examples/pokemons/pokenon.middlewares.d.ts +0 -4
  126. package/dist/_examples/pokemons/pokenon.middlewares.d.ts.map +0 -1
  127. package/dist/_examples/pokemons/pokenon.middlewares.js +0 -27
  128. package/dist/_examples/pokemons/pokenon.middlewares.js.map +0 -1
  129. package/dist/_examples/pokemons/selectors/pokemon.selectors.d.ts +0 -5
  130. package/dist/_examples/pokemons/selectors/pokemon.selectors.d.ts.map +0 -1
  131. package/dist/_examples/pokemons/selectors/pokemon.selectors.js +0 -10
  132. package/dist/_examples/pokemons/selectors/pokemon.selectors.js.map +0 -1
  133. package/dist/_examples/pokemons/selectors/pokemon1.selectors.d.ts +0 -5
  134. package/dist/_examples/pokemons/selectors/pokemon1.selectors.d.ts.map +0 -1
  135. package/dist/_examples/pokemons/selectors/pokemon1.selectors.js +0 -8
  136. package/dist/_examples/pokemons/selectors/pokemon1.selectors.js.map +0 -1
  137. package/dist/_examples/pokemons/storages/pokemon.storage.d.ts +0 -3
  138. package/dist/_examples/pokemons/storages/pokemon.storage.d.ts.map +0 -1
  139. package/dist/_examples/pokemons/storages/pokemon.storage.js +0 -14
  140. package/dist/_examples/pokemons/storages/pokemon.storage.js.map +0 -1
  141. package/dist/_examples/pokemons/store.d.ts +0 -1
  142. package/dist/_examples/pokemons/store.d.ts.map +0 -1
  143. package/dist/_examples/pokemons/store.js +0 -2
  144. package/dist/_examples/pokemons/store.js.map +0 -1
  145. package/dist/_examples/pokemons/store1.d.ts +0 -23
  146. package/dist/_examples/pokemons/store1.d.ts.map +0 -1
  147. package/dist/_examples/pokemons/store1.js +0 -35
  148. package/dist/_examples/pokemons/store1.js.map +0 -1
  149. package/dist/_examples/pokemons/store2.d.ts +0 -23
  150. package/dist/_examples/pokemons/store2.d.ts.map +0 -1
  151. package/dist/_examples/pokemons/store2.js +0 -34
  152. package/dist/_examples/pokemons/store2.js.map +0 -1
  153. package/dist/_examples/pokemons/types.d.ts +0 -26
  154. package/dist/_examples/pokemons/types.d.ts.map +0 -1
  155. package/dist/_examples/pokemons/types.js +0 -2
  156. package/dist/_examples/pokemons/types.js.map +0 -1
  157. package/dist/core/storage/adapters/idb.d.ts +0 -52
  158. package/dist/core/storage/adapters/idb.d.ts.map +0 -1
  159. package/dist/core/storage/adapters/idb.js +0 -528
  160. package/dist/core/storage/adapters/idb.js.map +0 -1
  161. package/dist/core/storage/adapters/indexed-DB.service1.d.ts +0 -38
  162. package/dist/core/storage/adapters/indexed-DB.service1.d.ts.map +0 -1
  163. package/dist/core/storage/adapters/indexed-DB.service1.js +0 -318
  164. package/dist/core/storage/adapters/indexed-DB.service1.js.map +0 -1
  165. package/dist/core/storage/adapters/indexed-DB.service2.d.ts +0 -61
  166. package/dist/core/storage/adapters/indexed-DB.service2.d.ts.map +0 -1
  167. package/dist/core/storage/adapters/indexed-DB.service2.js +0 -596
  168. package/dist/core/storage/adapters/indexed-DB.service2.js.map +0 -1
  169. package/dist/core/storage/factory/createSynapseStorage.factory.d.ts +0 -1
  170. package/dist/core/storage/factory/createSynapseStorage.factory.d.ts.map +0 -1
  171. package/dist/core/storage/factory/createSynapseStorage.factory.js +0 -2
  172. package/dist/core/storage/factory/createSynapseStorage.factory.js.map +0 -1
  173. package/dist/core/storage/factory/index.d.ts +0 -2
  174. package/dist/core/storage/factory/index.d.ts.map +0 -1
  175. package/dist/core/storage/factory/index.js +0 -2
  176. package/dist/core/storage/factory/index.js.map +0 -1
  177. package/dist/examples/_example5.d.ts +0 -1
  178. package/dist/examples/_example5.d.ts.map +0 -1
  179. package/dist/examples/_example5.js +0 -184
  180. package/dist/examples/_example5.js.map +0 -1
  181. package/dist/examples/_example6.d.ts +0 -1
  182. package/dist/examples/_example6.d.ts.map +0 -1
  183. package/dist/examples/_example6.js +0 -168
  184. package/dist/examples/_example6.js.map +0 -1
  185. package/dist/examples/plugins.d.ts +0 -1
  186. package/dist/examples/plugins.d.ts.map +0 -1
  187. package/dist/examples/plugins.js +0 -176
  188. package/dist/examples/plugins.js.map +0 -1
  189. package/dist/examples/pokemons/PokemonList.d.ts +0 -2
  190. package/dist/examples/pokemons/PokemonList.d.ts.map +0 -1
  191. package/dist/examples/pokemons/PokemonList.js +0 -110
  192. package/dist/examples/pokemons/PokemonList.js.map +0 -1
  193. package/dist/examples/pokemons/api.d.ts +0 -22
  194. package/dist/examples/pokemons/api.d.ts.map +0 -1
  195. package/dist/examples/pokemons/api.js +0 -43
  196. package/dist/examples/pokemons/api.js.map +0 -1
  197. package/dist/examples/pokemons/app.config.d.ts +0 -15
  198. package/dist/examples/pokemons/app.config.d.ts.map +0 -1
  199. package/dist/examples/pokemons/app.config.js +0 -15
  200. package/dist/examples/pokemons/app.config.js.map +0 -1
  201. package/dist/examples/pokemons/dispatchers/pokemon.dispatcher.js +0 -128
  202. package/dist/examples/pokemons/dispatchers/pokemon.dispatcher.js.map +0 -1
  203. package/dist/examples/pokemons/effects/pokemon.effects.d.ts +0 -16
  204. package/dist/examples/pokemons/effects/pokemon.effects.d.ts.map +0 -1
  205. package/dist/examples/pokemons/effects/pokemon.effects.js +0 -51
  206. package/dist/examples/pokemons/effects/pokemon.effects.js.map +0 -1
  207. package/dist/examples/pokemons/middlewares/pokenon.middlewares.d.ts +0 -4
  208. package/dist/examples/pokemons/middlewares/pokenon.middlewares.d.ts.map +0 -1
  209. package/dist/examples/pokemons/middlewares/pokenon.middlewares.js +0 -28
  210. package/dist/examples/pokemons/middlewares/pokenon.middlewares.js.map +0 -1
  211. package/dist/examples/pokemons/selectors/pokemon.selectors.d.ts +0 -13
  212. package/dist/examples/pokemons/selectors/pokemon.selectors.d.ts.map +0 -1
  213. package/dist/examples/pokemons/selectors/pokemon.selectors.js +0 -7
  214. package/dist/examples/pokemons/selectors/pokemon.selectors.js.map +0 -1
  215. package/dist/examples/pokemons/storages/pokemon.storage.d.ts +0 -5
  216. package/dist/examples/pokemons/storages/pokemon.storage.d.ts.map +0 -1
  217. package/dist/examples/pokemons/storages/pokemon.storage.js +0 -13
  218. package/dist/examples/pokemons/storages/pokemon.storage.js.map +0 -1
  219. package/dist/examples/pokemons/store.d.ts +0 -35
  220. package/dist/examples/pokemons/store.d.ts.map +0 -1
  221. package/dist/examples/pokemons/store.js +0 -21
  222. package/dist/examples/pokemons/store.js.map +0 -1
  223. package/dist/examples/pokemons/types.d.ts +0 -26
  224. package/dist/examples/pokemons/types.d.ts.map +0 -1
  225. package/dist/examples/pokemons/types.js +0 -2
  226. package/dist/examples/pokemons/types.js.map +0 -1
  227. package/dist/react/utils/createSynapse.d.ts +0 -47
  228. package/dist/react/utils/createSynapse.d.ts.map +0 -1
  229. package/dist/react/utils/createSynapse.js +0 -83
  230. package/dist/react/utils/createSynapse.js.map +0 -1
  231. package/dist/react/utils/createSynapseContext.d.ts +0 -29
  232. package/dist/react/utils/createSynapseContext.d.ts.map +0 -1
  233. package/dist/react/utils/createSynapseContext.js +0 -112
  234. package/dist/react/utils/createSynapseContext.js.map +0 -1
  235. package/dist/utils/chunk.util.d.ts +0 -8
  236. package/dist/utils/chunk.util.d.ts.map +0 -1
  237. package/dist/utils/chunk.util.js +0 -21
  238. package/dist/utils/chunk.util.js.map +0 -1
  239. package/dist/utils/deepMerge.util.d.ts +0 -2
  240. package/dist/utils/deepMerge.util.d.ts.map +0 -1
  241. package/dist/utils/deepMerge.util.js +0 -16
  242. package/dist/utils/deepMerge.util.js.map +0 -1
  243. package/dist/utils/flatMap.util.d.ts +0 -10
  244. package/dist/utils/flatMap.util.d.ts.map +0 -1
  245. package/dist/utils/flatMap.util.js +0 -23
  246. package/dist/utils/flatMap.util.js.map +0 -1
@@ -1,110 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { useSelector, useStorageSubscribe } from '@vlad92msk/synapse/react';
3
- import { useEffect, useState } from 'react';
4
- import { distinctUntilChanged, filter, map } from 'rxjs/operators';
5
- import { pokemonActions, pokemonSelectors, pokemonState$, pokemonStorage } from './store';
6
- // Стили
7
- const btn = { background: '#c7c6c6', color: 'black', padding: '5px', borderRadius: '5px' };
8
- const flexColumn = { display: 'flex', flexDirection: 'column' };
9
- const img = { position: 'absolute', objectFit: 'contain' };
10
- const contentContainer = { ...flexColumn, position: 'relative', width: '400px', height: '400px', marginTop: '10px' };
11
- const actionContainer = { display: 'flex', justifyContent: 'space-between', alignItems: 'center' };
12
- export function SimplePokemonViewer() {
13
- const [state, setState] = useState({
14
- currentPokemon: null,
15
- loading: true,
16
- error: null,
17
- currentId: 1,
18
- });
19
- // Инициируем загрузку первого покемона через действия
20
- useEffect(() => {
21
- pokemonActions.loadPokemon(1);
22
- }, []);
23
- const handleNext = () => {
24
- pokemonActions.next().then((finalPayload) => {
25
- // finalPayload - то, что возвращает функция action в dispatcher-е
26
- // Именно это окажется в эффекте в качестве payload
27
- console.log('finalPayload:', finalPayload);
28
- });
29
- };
30
- const handlePrev = () => {
31
- pokemonActions.prev();
32
- };
33
- // ============ Варианты подписок ===============
34
- // ВАРИАНТ #1 (Прямая подписка на хранилище)
35
- // subscribeToAll - вызывается при срабатывании любого события связанного с обновлением данных
36
- useEffect(() => {
37
- const unsubscribe = pokemonStorage.subscribeToAll((event) => {
38
- console.log('event.type', event.type); // Тип события
39
- console.log('event.key', event.key); // Массив ключей, которые меняются (Корневые ключи хранилища)
40
- console.log('event.changedPaths', event.changedPaths); // Массив путей, которые менялись (Например: ['key1.key2.key3', enyKey1.enyKey2])
41
- console.log('event.value', event.value); // Текущее состояние
42
- if (event.key === 'currentId') {
43
- setState((prev) => ({
44
- ...prev,
45
- currentId: event.value,
46
- }));
47
- }
48
- if (Array.isArray(event.key)) {
49
- setState((prev) => ({
50
- ...prev,
51
- ...event.value,
52
- }));
53
- }
54
- });
55
- return () => unsubscribe();
56
- }, []);
57
- // ВАРИАНТ #1.1 (Прямая подписка на хранилище)
58
- // Прямая подписка на значение в хранилище с помощью хука
59
- const selectorValue2 = useStorageSubscribe(pokemonStorage, (s) => s.currentId);
60
- console.log('selectorValue2', selectorValue2);
61
- // ВАРИАНТ #1.2 (Прямая подписка на хранилище)
62
- // Второй колбэк вызывается только если изненилось значение полученное по ключу
63
- // Первый паратметр - либо селектор, либо строка
64
- // Этот подход можно использовать если нужна дополнительная логика обновления состояниея в компоненте
65
- // Или вне React
66
- useEffect(() => {
67
- const unsubscribe = pokemonStorage.subscribe((s) => s.currentId, (value) => {
68
- // Сработает только если изменится currentId
69
- console.log('currentId', value);
70
- });
71
- return () => {
72
- unsubscribe();
73
- };
74
- }, []);
75
- // ВАРИАНТ #2 (Использование селекторов в стиле Redux)
76
- // С помощью хука useSelector
77
- const selectorValue1 = useSelector(pokemonSelectors.sprites);
78
- console.log('selectorValue1', selectorValue1);
79
- // ВАРИАНТ #2.1
80
- // Нативным способом (единоразовое получение)
81
- useEffect(() => {
82
- pokemonSelectors.sprites.select().then((val) => {
83
- console.log('pokemonSelectors select', val);
84
- });
85
- }, []);
86
- // ВАРИАНТ #2.2
87
- // Нативным способом (подписка на вычисляемое значение)
88
- useEffect(() => {
89
- pokemonSelectors.sprites.subscribe({
90
- notify: (s) => {
91
- console.log('pokemonSelectors subscribe', s);
92
- },
93
- });
94
- }, []);
95
- // ВАРИАНТ #3 (Реактивный подход)
96
- // работает только совместно с использованием Dispatcher-а
97
- useEffect(() => {
98
- const subscription = pokemonState$
99
- .pipe(map((state) => state.currentId), distinctUntilChanged(), filter((pokemonId) => pokemonId > 3))
100
- .subscribe((state) => {
101
- console.log('Текущее состояние REACTIVE:', state);
102
- });
103
- return () => {
104
- subscription.unsubscribe();
105
- };
106
- }, []);
107
- // ============ Варианты подписок =============== КОНЕЦ
108
- return (_jsxs("div", { style: flexColumn, children: [state.error && _jsx("p", { children: `Error: ${state.error}` }), state.loading ? (_jsx("p", { children: "Loading Pok\u00E9mon..." })) : state.currentPokemon ? (_jsxs("div", { style: contentContainer, children: [_jsx("h2", { children: `Name: ${state.currentPokemon.name}` }), _jsxs("div", { style: { ...flexColumn, marginTop: '10px' }, children: [_jsx("p", { children: `Height: ${state.currentPokemon.height / 10}` }), _jsx("p", { children: `Weight: ${state.currentPokemon.weight / 10}` })] }), _jsx("img", { style: img, src: state.currentPokemon.sprites.other?.['official-artwork']?.front_default || state.currentPokemon.sprites.front_default, alt: state.currentPokemon.name })] })) : null, _jsxs("div", { style: actionContainer, children: [_jsx("button", { style: btn, onClick: handlePrev, children: '<--' }), _jsx("strong", { children: `#${state.currentId}` }), _jsx("button", { style: btn, onClick: handleNext, children: '-->' })] })] }));
109
- }
110
- //# sourceMappingURL=PokemonList.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"PokemonList.js","sourceRoot":"","sources":["../../../src/examples/pokemons/PokemonList.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,WAAW,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAA;AAC3E,OAAO,EAAiB,SAAS,EAA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E,KAAK,CAAC,cAAc,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC,kBAAkB,CAAC,EAAE,aAAa,IAAI,KAAK,CAAC,cAAc,CAAC,OAAO,CAAC,aAAa,EAC1H,GAAG,EAAE,KAAK,CAAC,cAAc,CAAC,IAAI,GAC9B,IACE,CACP,CAAC,CAAC,CAAC,IAAI,EAER,eAAK,KAAK,EAAE,eAAe,aACzB,iBAAQ,KAAK,EAAE,GAAG,EAAE,OAAO,EAAE,UAAU,YACpC,KAAK,GACC,EACT,2BAAS,IAAI,KAAK,CAAC,SAAS,EAAE,GAAU,EACxC,iBAAQ,KAAK,EAAE,GAAG,EAAE,OAAO,EAAE,UAAU,YACpC,KAAK,GACC,IACL,IACF,CACP,CAAA;AACH,CAAC"}
@@ -1,22 +0,0 @@
1
- import { ApiClient } from '@vlad92msk/synapse/api';
2
- import { Pokemon } from './types';
3
- export interface PokemonSearchParams {
4
- limit?: number;
5
- offset?: number;
6
- }
7
- export declare const api: ApiClient<(create: import("../../../dist/api/types/endpoint.interface").CreateEndpoint) => Promise<{
8
- fetchPokemonById: import("../../../dist/api/types/endpoint.interface").EndpointConfig<{
9
- id: number;
10
- }, Pokemon>;
11
- }>>;
12
- export declare const pokemonApi: ApiClient<(create: import("../../../dist/api/types/endpoint.interface").CreateEndpoint) => Promise<{
13
- fetchPokemonById: import("../../../dist/api/types/endpoint.interface").EndpointConfig<{
14
- id: number;
15
- }, Pokemon>;
16
- }>>;
17
- export declare const pokemonEndpoints: {
18
- fetchPokemonById: import("../../../dist/api/types/endpoint.interface").Endpoint<{
19
- id: number;
20
- }, Pokemon>;
21
- };
22
- //# sourceMappingURL=api.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../../../src/examples/pokemons/api.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAkB,MAAM,wBAAwB,CAAA;AAGlE,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAA;AAEjC,MAAM,WAAW,mBAAmB;IAClC,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB;AAMD,eAAO,MAAM,GAAG;;YAqBmB,MAAM;;GASvC,CAAA;AAEF,eAAO,MAAM,UAAU;;YAXY,MAAM;;GAWC,CAAA;AAK1C,eAAO,MAAM,gBAAgB;;YAhBM,MAAM;;CAgBgB,CAAA"}
@@ -1,43 +0,0 @@
1
- import { ApiClient, ResponseFormat } from '@vlad92msk/synapse/api';
2
- import { MemoryStorage } from '@vlad92msk/synapse/core';
3
- const storage = await new MemoryStorage({
4
- name: 'pokemon-api-cache',
5
- }).initialize();
6
- export const api = new ApiClient({
7
- storage,
8
- // Или boolean или объект с настройками
9
- cache: {
10
- // Время жизни кэша в миллисекундах
11
- ttl: 5 * 60 * 1000, // 5 минут
12
- // Инвалидировать кэш при ошибке
13
- invalidateOnError: true,
14
- cleanup: {
15
- // Включить периодическую очистку
16
- enabled: true,
17
- // Интервал очистки в миллисекундах
18
- interval: 10 * 60 * 1000, // 10 минут
19
- },
20
- },
21
- baseQuery: {
22
- baseUrl: 'https://pokeapi.co/api/v2',
23
- timeout: 10000,
24
- credentials: 'same-origin',
25
- },
26
- endpoints: async (create) => ({
27
- fetchPokemonById: create({
28
- request: (params) => ({
29
- path: `/pokemon/${params.id}`,
30
- method: 'GET',
31
- responseFormat: ResponseFormat.Json,
32
- }),
33
- tags: ['pokemon-details'],
34
- }),
35
- }),
36
- });
37
- // Инициализация
38
- export const pokemonApi = await api.init();
39
- // Демонтирование
40
- // await pokemonApi.destroy()
41
- // Получение эндпоинтов
42
- export const pokemonEndpoints = pokemonApi.getEndpoints();
43
- //# sourceMappingURL=api.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"api.js","sourceRoot":"","sources":["../../../src/examples/pokemons/api.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAA;AAClE,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TimeoutMs: number;
5
- features: {
6
- enableNotifications: boolean;
7
- enableCache: boolean;
8
- };
9
- themeSettings: {
10
- primaryColor: string;
11
- secondaryColor: string;
12
- };
13
- }
14
- export declare const appConfig: AppConfig;
15
- //# sourceMappingURL=app.config.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"app.config.d.ts","sourceRoot":"","sources":["../../../src/examples/pokemons/app.config.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,SAAS;IACxB,UAAU,EAAE,MAAM,CAAA;IAClB,MAAM,EAAE,MAAM,CAAA;IACd,gBAAgB,EAAE,MAAM,CAAA;IACxB,QAAQ,EAAE;QACR,mBAAmB,EAAE,OAAO,CAAA;QAC5B,WAAW,EAAE,OAAO,CAAA;KACrB,CAAA;IACD,aAAa,EAAE;QACb,YAAY,EAAE,MAAM,CAAA;QACpB,cAAc,EAAE,MAAM,CAAA;KACvB,CAAA;CACF;AAED,eAAO,MAAM,SAAS,EAAE,SAYvB,CAAA"}
@@ -1,15 +0,0 @@
1
- // Просто условный объект с конфигурацией, которую можно использовать в эффектах
2
- export const appConfig = {
3
- apiBaseUrl: 'https://pokeapi.co/api/v2',
4
- apiKey: 'your-api-key-here',
5
- requestTimeoutMs: 5000,
6
- features: {
7
- enableNotifications: true,
8
- enableCache: true,
9
- },
10
- themeSettings: {
11
- primaryColor: '#FF0000', // Pokemon Red!
12
- secondaryColor: '#FFFFFF',
13
- },
14
- };
15
- //# sourceMappingURL=app.config.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"app.config.js","sourceRoot":"","sources":["../../../src/examples/pokemons/app.config.ts"],"names":[],"mappings":"AAAA,gFAAgF;AAiBhF,MAAM,CAAC,MAAM,SAAS,GAAc;IAClC,UAAU,EAAE,2BAA2B;IACvC,MAAM,EAAE,mBAAmB;IAC3B,gBAAgB,EAAE,IAAI;IACtB,QAAQ,EAAE;QACR,mBAAmB,EAAE,IAAI;QACzB,WAAW,EAAE,IAAI;KAClB;IACD,aAAa,EAAE;QACb,YAAY,EAAE,SAAS,EAAE,eAAe;QACxC,cAAc,EAAE,SAAS;KAC1B;CACF,CAAA"}
@@ -1,128 +0,0 @@
1
- import { createDispatcher, loggerDispatcherMiddleware } from '@vlad92msk/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
- // Создаем middleware: alertM (просто для примера)
16
- const alertM = createPokemonAlertMiddleware();
17
- return createDispatcher({
18
- storage,
19
- middlewares: [loggerMiddleware, alertM],
20
- }, (storage, { createWatcher, createAction }) => ({
21
- // Добавляем watcher для отслеживания текущего ID
22
- watchCurrentId: createWatcher({
23
- type: 'pokemon/currentIdChanged',
24
- selector: (state) => state.currentId,
25
- shouldTrigger: (prev, curr) => prev !== curr,
26
- meta: {
27
- description: 'Следит за изменениями ID текущего покемона',
28
- },
29
- }),
30
- // Watcher для отслеживания состояния загрузки
31
- watchLoadingState: createWatcher({
32
- type: 'pokemon/loadingStateChanged',
33
- selector: (state) => state.loading,
34
- }),
35
- // Загрузка покемона по ID
36
- loadPokemon: createAction({
37
- type: 'pokemon/loadPokemonIdl',
38
- action: async (id) => ({ id }),
39
- }),
40
- loadPokemonRequest: createAction({
41
- type: 'pokemon/loadPokemonRequest',
42
- action: async (id) => {
43
- await storage.update((state) => {
44
- state.loading = true;
45
- state.error = null;
46
- state.currentId = id;
47
- });
48
- return { id };
49
- },
50
- }),
51
- // Успешное получение данных
52
- success: createAction({
53
- type: 'pokemon/success',
54
- action: async ({ data }) => {
55
- await storage.update((state) => {
56
- state.currentPokemon = data;
57
- state.loading = false;
58
- state.error = null;
59
- });
60
- // Возвращаем данные покемона как payload
61
- return { data };
62
- },
63
- }, {
64
- // Функция мемоизации (пока не тестировал)
65
- // memoize: (currentArgs: any[], previousArgs: any[], previousResult: any) => true,
66
- // Веб-воркер для выполнения действия (пока не тестировал)
67
- // worker: myWorker,
68
- }),
69
- // Ошибка при получении данных
70
- failure: createAction({
71
- type: 'pokemon/failure',
72
- action: async (err) => {
73
- const errorMessage = err instanceof Error ? err.message : 'Unknown error';
74
- await storage.update((state) => {
75
- state.loading = false;
76
- state.error = errorMessage;
77
- });
78
- // Возвращаем ошибку как payload
79
- return { err };
80
- },
81
- }),
82
- // Перейти к следующему покемону
83
- next: createAction({
84
- type: 'pokemon/next',
85
- action: async () => {
86
- let newId = 1;
87
- await storage.update((state) => {
88
- newId = state.currentId + 1;
89
- if (newId > 151)
90
- newId = 1; // Ограничиваем первым поколением (1-151)
91
- state.currentId = newId;
92
- });
93
- return { id: newId };
94
- },
95
- }),
96
- // Перейти к предыдущему покемону
97
- prev: createAction({
98
- type: 'pokemon/prev',
99
- action: async () => {
100
- let newId = 1;
101
- await storage.update((state) => {
102
- newId = state.currentId - 1;
103
- if (newId < 1)
104
- newId = 151; // Ограничиваем первым поколением (1-151)
105
- state.currentId = newId;
106
- });
107
- console.log(`Action: Previous pokemon (ID ${newId})`);
108
- return { id: newId };
109
- },
110
- }),
111
- showAlert: createAction({
112
- type: 'pokemon/showAlert',
113
- action: async (payload) => {
114
- // Используем глобальный alert для демонстрации
115
- alert(payload.message);
116
- // Здесь можно также обновить состояние для отображения alert в UI
117
- // например, добавить запись в массив alerts в state
118
- },
119
- meta: {
120
- description: 'Показывает оповещение пользователю',
121
- },
122
- }),
123
- }));
124
- // Альтернативный вариант добавления:
125
- // .use(logger)
126
- // .use(alertM)
127
- }
128
- //# sourceMappingURL=pokemon.dispatcher.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"pokemon.dispatcher.js","sourceRoot":"","sources":["../../../../src/examples/pokemons/dispatchers/pokemon.dispatcher.ts"],"names":[],"mappings":"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mBAAmB;YACzB,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE;gBACxB,+CAA+C;gBAC/C,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,CAAA;gBAEtB,kEAAkE;gBAClE,oDAAoD;YACtD,CAAC;YACD,IAAI,EAAE;gBACJ,WAAW,EAAE,oCAAoC;aAClD;SACF,CAAC;KACH,CAAC,CACH,CAAA;IACD,qCAAqC;IACrC,eAAe;IACf,eAAe;AACjB,CAAC"}
@@ -1,16 +0,0 @@
1
- import { pokemonEndpoints } from '../api';
2
- import { AppConfig } from '../app.config';
3
- import { PokemonDispatcher } from '../dispatchers/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("@vlad92msk/synapse/reactive").Effect<PokemonState, PokemonDispatcherType, PokemonApiType, AppConfig>;
12
- export declare const watchIdEffect: import("@vlad92msk/synapse/reactive").Effect<PokemonState, PokemonDispatcherType, PokemonApiType, AppConfig>;
13
- export declare const loadPokemonEffect: import("@vlad92msk/synapse/reactive").Effect<PokemonState, PokemonDispatcherType, PokemonApiType, AppConfig>;
14
- export declare const pokemonEffects: import("@vlad92msk/synapse/reactive").Effect<PokemonState, PokemonDispatcherType, PokemonApiType, AppConfig>;
15
- export {};
16
- //# sourceMappingURL=pokemon.effects.d.ts.map
@@ -1 +0,0 @@
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,QAAQ,CAAA;AACzC,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AACzC,OAAO,EAAE,iBAAiB,EAAE,MAAM,mCAAmC,CAAA;AACrE,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAA;AAGvC,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,8GAQ5B,CAAA;AAGD,eAAO,MAAM,aAAa,8GAezB,CAAA;AAGD,eAAO,MAAM,iBAAiB,8GA8C7B,CAAA;AAGD,eAAO,MAAM,cAAc,8GAAqE,CAAA"}
@@ -1,51 +0,0 @@
1
- import { combineEffects, createEffect, ofType, ofTypes, selectorMap, validateMap } from '@vlad92msk/synapse/reactive';
2
- import { from, mapTo, of, tap } from 'rxjs';
3
- import { catchError, switchMap } from 'rxjs/operators';
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$, // Поток событий
17
- state$, // Поток состояния
18
- { pokemonDispatcher }, // Диспетчеры которые мы передали
19
- { pokemonApi }, // различные API которые мы передали
20
- config) => action$.pipe(
21
- // Я использую отдельный action loadPokemon который уведомляет о намерении сделать запрос
22
- // Для того, чтобы не устанавливать loading сразу
23
- ofType(pokemonDispatcher.dispatch.loadPokemon), selectorMap(state$, (state) => state.currentId), validateMap({
24
- apiCall: ([action, [currentId]]) => {
25
- const { id } = action.payload;
26
- return from(
27
- // Использую waitWithCallbacks чтобы иметь доступ к методу loading
28
- pokemonApi.fetchPokemonById.request({ id }).waitWithCallbacks({
29
- // Вызывается только тогда, когда запрос реально отправляется, а не берется из кэша
30
- loading: (request) => {
31
- console.log('LOADING', request);
32
- // Именно в в этот момент установится loading и другая необходимая логика
33
- pokemonDispatcher.dispatch.loadPokemonRequest(id);
34
- },
35
- // Можно использовать так:
36
- // success: (data, request) => {
37
- // console.log('SUCCESS', request)
38
- // pokemonDispatcher.dispatch.success({ data })
39
- // },
40
- // error: (error, request) => {
41
- // console.log('ERROR', error, request)
42
- // pokemonDispatcher.dispatch.failure(error!)
43
- // },
44
- })).pipe(switchMap(({ data }) => {
45
- return of(pokemonDispatcher.dispatch.success({ data }));
46
- }), catchError((err) => of(pokemonDispatcher.dispatch.failure(err))));
47
- },
48
- })));
49
- // Объединяем все эффекты в один и экспортируем
50
- export const pokemonEffects = combineEffects(navigationEffect, watchIdEffect, loadPokemonEffect);
51
- //# sourceMappingURL=pokemon.effects.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"pokemon.effects.js","sourceRoot":"","sources":["../../../../src/examples/pokemons/effects/pokemon.effects.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,EAAE,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAA;AACrH,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,EAAE,EAAE,GAAG,EAAE,MAAM,MAAM,CAAA;AAC3C,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAWtD,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,CAA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2
- import { PokemonState } from '../types';
3
- export declare const createPokemonAlertMiddleware: () => EnhancedMiddleware<PokemonState>;
4
- //# sourceMappingURL=pokenon.middlewares.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"pokenon.middlewares.d.ts","sourceRoot":"","sources":["../../../../src/examples/pokemons/middlewares/pokenon.middlewares.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAA;AAEhE,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAA;AAIvC,eAAO,MAAM,4BAA4B,QAAO,kBAAkB,CAAC,YAAY,CA0B9E,CAAA"}
@@ -1,28 +0,0 @@
1
- // Создадим пользовательскую middleware для теста
2
- // Бдем слушать события определенных типов и вызывать другое
3
- export const createPokemonAlertMiddleware = () => (api) => (next) => async (action) => {
4
- const result = await next(action);
5
- // Проверяем тип после выполнения
6
- if (action.type.includes('pokemon/next') || action.type.includes('pokemon/prev')) {
7
- const state = await api.getState();
8
- // Пробуем найти действие напрямую
9
- const alertAction = api.findActionByType('pokemon/showAlert');
10
- if (alertAction) {
11
- await alertAction({
12
- message: `Покемон переключен на ID: ${state.currentId}`,
13
- type: 'info',
14
- });
15
- }
16
- else {
17
- await api.dispatch({
18
- type: 'pokemon/showAlert',
19
- payload: {
20
- message: `Покемон переключен на ID: ${state.currentId}`,
21
- type: 'info',
22
- },
23
- });
24
- }
25
- }
26
- return result;
27
- };
28
- //# sourceMappingURL=pokenon.middlewares.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"pokenon.middlewares.js","sourceRoot":"","sources":["../../../../src/examples/pokemons/middlewares/pokenon.middlewares.ts"],"names":[],"mappings":"AAIA,iDAAiD;AACjD,4DAA4D;AAC5D,MAAM,CAAC,MAAM,4BAA4B,GAAG,GAAqC,EAAE,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE;IACtH,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,CAAA;IACjC,iCAAiC;IACjC,IAAI,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,cAAc,CAAC,IAAI,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,cAAc,CAAC,EAAE,CAAC;QACjF,MAAM,KAAK,GAAG,MAAM,GAAG,CAAC,QAAQ,EAAE,CAAA;QAElC,kCAAkC;QAClC,MAAM,WAAW,GAAG,GAAG,CAAC,gBAAgB,CAAC,mBAAmB,CAAC,CAAA;QAE7D,IAAI,WAAW,EAAE,CAAC;YAChB,MAAM,WAAW,CAAC;gBAChB,OAAO,EAAE,6BAA6B,KAAK,CAAC,SAAS,EAAE;gBACvD,IAAI,EAAE,MAAM;aACb,CAAC,CAAA;QACJ,CAAC;aAAM,CAAC;YACN,MAAM,GAAG,CAAC,QAAQ,CAAC;gBACjB,IAAI,EAAE,mBAAmB;gBACzB,OAAO,EAAE;oBACP,OAAO,EAAE,6BAA6B,KAAK,CAAC,SAAS,EAAE;oBACvD,IAAI,EAAE,MAAM;iBACb;aACF,CAAC,CAAA;QACJ,CAAC;IACH,CAAC;IAED,OAAO,MAAM,CAAA;AACf,CAAC,CAAA"}
@@ -1,13 +0,0 @@
1
- import { ISelectorModule } from '@vlad92msk/synapse/core';
2
- import { PokemonState } from '../types';
3
- export declare const createPokemonSelectors: (selectorModule: ISelectorModule<PokemonState>) => {
4
- sprites: import("@vlad92msk/synapse/core").SelectorAPI<{
5
- front_default: string;
6
- other?: {
7
- "official-artwork"?: {
8
- front_default?: string;
9
- };
10
- };
11
- } | undefined>;
12
- };
13
- //# sourceMappingURL=pokemon.selectors.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"pokemon.selectors.d.ts","sourceRoot":"","sources":["../../../../src/examples/pokemons/selectors/pokemon.selectors.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAA;AAEzD,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAA;AAEvC,eAAO,MAAM,sBAAsB,GAAI,gBAAgB,eAAe,CAAC,YAAY,CAAC;;;;8BAC1E,CAAC;6BAAyB,CAAC;;;;CAKpC,CAAA"}
@@ -1,7 +0,0 @@
1
- export const createPokemonSelectors = (selectorModule) => {
2
- const sprites = selectorModule.createSelector((state) => state.currentPokemon?.sprites);
3
- return {
4
- sprites,
5
- };
6
- };
7
- //# sourceMappingURL=pokemon.selectors.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"pokemon.selectors.js","sourceRoot":"","sources":["../../../../src/examples/pokemons/selectors/pokemon.selectors.ts"],"names":[],"mappings":"AAIA,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,cAA6C,EAAE,EAAE;IACtF,MAAM,OAAO,GAAG,cAAc,CAAC,cAAc,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,cAAc,EAAE,OAAO,CAAC,CAAA;IAEvF,OAAO;QACL,OAAO;KACR,CAAA;AACH,CAAC,CAAA"}
@@ -1,5 +0,0 @@
1
- import { MemoryStorage } from '@vlad92msk/synapse/core';
2
- import { PokemonState } from '../types';
3
- export declare function createPokemonStorage(): Promise<MemoryStorage<PokemonState>>;
4
- export type PokemonStorage = Awaited<ReturnType<typeof createPokemonStorage>>;
5
- //# sourceMappingURL=pokemon.storage.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"pokemon.storage.d.ts","sourceRoot":"","sources":["../../../../src/examples/pokemons/storages/pokemon.storage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAA;AAEvD,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAA;AAEvC,wBAAsB,oBAAoB,yCAUzC;AAED,MAAM,MAAM,cAAc,GAAG,OAAO,CAAC,UAAU,CAAC,OAAO,oBAAoB,CAAC,CAAC,CAAA"}
@@ -1,13 +0,0 @@
1
- import { MemoryStorage } from '@vlad92msk/synapse/core';
2
- export async function createPokemonStorage() {
3
- return new MemoryStorage({
4
- name: 'pokemon-store',
5
- initialState: {
6
- currentPokemon: null,
7
- loading: true,
8
- error: null,
9
- currentId: 1,
10
- },
11
- }).initialize();
12
- }
13
- //# sourceMappingURL=pokemon.storage.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"pokemon.storage.js","sourceRoot":"","sources":["../../../../src/examples/pokemons/storages/pokemon.storage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAA;AAIvD,MAAM,CAAC,KAAK,UAAU,oBAAoB;IACxC,OAAO,IAAI,aAAa,CAAe;QACrC,IAAI,EAAE,eAAe;QACrB,YAAY,EAAE;YACZ,cAAc,EAAE,IAAI;YACpB,OAAO,EAAE,IAAI;YACb,KAAK,EAAE,IAAI;YACX,SAAS,EAAE,CAAC;SACb;KACF,CAAC,CAAC,UAAU,EAAE,CAAA;AACjB,CAAC"}
@@ -1,35 +0,0 @@
1
- export declare const pokemonStorage: import("../../../dist/core").IStorage<import("./types").PokemonState>, pokemonState$: import("rxjs").Observable<import("./types").PokemonState>, pokemonActions: Record<string, import("../../../dist/reactive").DispatchFunction<any, any>> & import("../../../dist/reactive").DispatchActions<{
2
- watchCurrentId: import("../../../dist/reactive").WatcherFunction<number>;
3
- watchLoadingState: import("../../../dist/reactive").WatcherFunction<boolean>;
4
- loadPokemon: import("../../../dist/reactive").DispatchFunction<number, {
5
- id: number;
6
- }>;
7
- loadPokemonRequest: import("../../../dist/reactive").DispatchFunction<number, {
8
- id: number;
9
- }>;
10
- success: import("../../../dist/reactive").DispatchFunction<{
11
- data?: import("./types").Pokemon;
12
- }, {
13
- data?: import("./types").Pokemon;
14
- }>;
15
- failure: import("../../../dist/reactive").DispatchFunction<Error, {
16
- err: Error;
17
- }>;
18
- next: import("../../../dist/reactive").DispatchFunction<void, {
19
- id: number;
20
- }>;
21
- prev: import("../../../dist/reactive").DispatchFunction<void, {
22
- id: number;
23
- }>;
24
- showAlert: import("../../../dist/reactive").DispatchFunction<import("./dispatchers/pokemon.dispatcher").AlertPayload, void>;
25
- }>, pokemonSelectors: {
26
- sprites: import("../../../dist/core").SelectorAPI<{
27
- front_default: string;
28
- other?: {
29
- "official-artwork"?: {
30
- front_default?: string;
31
- };
32
- };
33
- } | undefined>;
34
- };
35
- //# sourceMappingURL=store.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"store.d.ts","sourceRoot":"","sources":["../../../src/examples/pokemons/store.ts"],"names":[],"mappings":"AAQA,eAAO,MACI,cAAc,yEACf,aAAa,6DACZ,cAAc;;;;;;;;;;;;;;;;;;;;;;;;IACZ,gBAAgB;;;;8BARF,CAAC;6BAAyB,CAAC;;;;CAsBpD,CAAA"}
@@ -1,21 +0,0 @@
1
- import { createSynapse } from '@vlad92msk/synapse/utils';
2
- import { pokemonEndpoints } from './api';
3
- import { createPokemonDispatcher } from './dispatchers/pokemon.dispatcher';
4
- import { pokemonEffects } from './effects/pokemon.effects';
5
- import { createPokemonSelectors } from './selectors/pokemon.selectors';
6
- import { createPokemonStorage } from './storages/pokemon.storage';
7
- export const { storage: pokemonStorage, state$: pokemonState$, actions: pokemonActions, selectors: pokemonSelectors, } = await createSynapse({
8
- createStorageFn: createPokemonStorage,
9
- createDispatcherFn: createPokemonDispatcher,
10
- createSelectorsFn: createPokemonSelectors,
11
- createEffectConfig: (dispatcher) => ({
12
- dispatchers: {
13
- pokemonDispatcher: dispatcher,
14
- },
15
- api: {
16
- pokemonApi: pokemonEndpoints,
17
- },
18
- }),
19
- effects: [pokemonEffects],
20
- });
21
- //# sourceMappingURL=store.js.map