quidproquo-web-react 0.1.12 → 0.1.13

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 (242) hide show
  1. package/lib/commonjs/hooks/index.d.ts +0 -1
  2. package/lib/commonjs/hooks/index.js +0 -1
  3. package/lib/commonjs/hooks/index.js.map +1 -1
  4. package/lib/commonjs/hooks/useQpq.js +2 -2
  5. package/lib/commonjs/hooks/useQpq.js.map +1 -1
  6. package/lib/commonjs/index.d.ts +3 -0
  7. package/lib/commonjs/index.js +3 -0
  8. package/lib/commonjs/index.js.map +1 -1
  9. package/lib/commonjs/{hooks/asmj → qpqContext}/QpqContextProvider.d.ts +3 -5
  10. package/lib/commonjs/qpqContext/QpqContextProvider.js +16 -0
  11. package/lib/commonjs/qpqContext/QpqContextProvider.js.map +1 -0
  12. package/lib/commonjs/qpqContext/index.d.ts +3 -0
  13. package/lib/commonjs/qpqContext/index.js +20 -0
  14. package/lib/commonjs/qpqContext/index.js.map +1 -0
  15. package/lib/commonjs/qpqContext/qpqReactContext.d.ts +2 -0
  16. package/lib/commonjs/qpqContext/qpqReactContext.js +6 -0
  17. package/lib/commonjs/qpqContext/qpqReactContext.js.map +1 -0
  18. package/lib/commonjs/qpqContext/useQpqContextValue.d.ts +2 -0
  19. package/lib/commonjs/qpqContext/useQpqContextValue.js +10 -0
  20. package/lib/commonjs/qpqContext/useQpqContextValue.js.map +1 -0
  21. package/lib/commonjs/qpqContext/useQpqContextValues.d.ts +2 -0
  22. package/lib/commonjs/qpqContext/useQpqContextValues.js +10 -0
  23. package/lib/commonjs/qpqContext/useQpqContextValues.js.map +1 -0
  24. package/lib/commonjs/runtime/ActionProcessorListResolverFactory.d.ts +3 -0
  25. package/lib/commonjs/runtime/ActionProcessorListResolverFactory.js +3 -0
  26. package/lib/commonjs/runtime/ActionProcessorListResolverFactory.js.map +1 -0
  27. package/lib/commonjs/runtime/BubbleReducerDispatchContext.d.ts +1 -0
  28. package/lib/commonjs/runtime/BubbleReducerDispatchContext.js +9 -0
  29. package/lib/commonjs/runtime/BubbleReducerDispatchContext.js.map +1 -0
  30. package/lib/commonjs/runtime/QpqBubbleReducer.d.ts +1 -0
  31. package/lib/commonjs/runtime/QpqBubbleReducer.js +3 -0
  32. package/lib/commonjs/runtime/QpqBubbleReducer.js.map +1 -0
  33. package/lib/commonjs/runtime/QpqMappedApi.js.map +1 -0
  34. package/lib/commonjs/runtime/QpqRuntimeEffectCatcher.d.ts +9 -0
  35. package/lib/commonjs/runtime/QpqRuntimeEffectCatcher.js +13 -0
  36. package/lib/commonjs/runtime/QpqRuntimeEffectCatcher.js.map +1 -0
  37. package/lib/commonjs/runtime/actionProcessor/getStateDispatchActionProcessor.js.map +1 -0
  38. package/lib/commonjs/runtime/actionProcessor/getStateReadActionProcessor.js.map +1 -0
  39. package/lib/commonjs/runtime/actionProcessor/index.js.map +1 -0
  40. package/lib/commonjs/runtime/createQpqRuntimeComputed.d.ts +7 -0
  41. package/lib/commonjs/runtime/createQpqRuntimeComputed.js +7 -0
  42. package/lib/commonjs/runtime/createQpqRuntimeComputed.js.map +1 -0
  43. package/lib/commonjs/runtime/createQpqRuntimeDefinition.d.ts +16 -0
  44. package/lib/commonjs/runtime/createQpqRuntimeDefinition.js +10 -0
  45. package/lib/commonjs/runtime/createQpqRuntimeDefinition.js.map +1 -0
  46. package/lib/commonjs/runtime/getQpqRuntimeAreaKey.d.ts +3 -0
  47. package/lib/commonjs/runtime/getQpqRuntimeAreaKey.js +6 -0
  48. package/lib/commonjs/runtime/getQpqRuntimeAreaKey.js.map +1 -0
  49. package/lib/commonjs/runtime/index.d.ts +12 -0
  50. package/lib/commonjs/{hooks/asmj → runtime}/index.js +6 -2
  51. package/lib/commonjs/runtime/index.js.map +1 -0
  52. package/lib/commonjs/{hooks/asmj → runtime}/useBubbleReducer.d.ts +1 -1
  53. package/lib/commonjs/{hooks/asmj → runtime}/useBubbleReducer.js +2 -2
  54. package/lib/commonjs/runtime/useBubbleReducer.js.map +1 -0
  55. package/lib/commonjs/runtime/useQpqAreaBinding.d.ts +11 -0
  56. package/lib/commonjs/runtime/useQpqAreaBinding.js +81 -0
  57. package/lib/commonjs/runtime/useQpqAreaBinding.js.map +1 -0
  58. package/lib/commonjs/runtime/useQpqRuntime.d.ts +4 -0
  59. package/lib/commonjs/runtime/useQpqRuntime.js +28 -0
  60. package/lib/commonjs/runtime/useQpqRuntime.js.map +1 -0
  61. package/lib/commonjs/runtime/useQpqRuntimeComputed.d.ts +2 -0
  62. package/lib/commonjs/runtime/useQpqRuntimeComputed.js +26 -0
  63. package/lib/commonjs/runtime/useQpqRuntimeComputed.js.map +1 -0
  64. package/lib/commonjs/store/QpqStoreProvider.d.ts +8 -0
  65. package/lib/commonjs/store/QpqStoreProvider.js +13 -0
  66. package/lib/commonjs/store/QpqStoreProvider.js.map +1 -0
  67. package/lib/commonjs/store/connectQpqStoreToReduxDevTools.d.ts +2 -0
  68. package/lib/commonjs/store/connectQpqStoreToReduxDevTools.js +144 -0
  69. package/lib/commonjs/store/connectQpqStoreToReduxDevTools.js.map +1 -0
  70. package/lib/commonjs/store/createQpqStore.d.ts +22 -0
  71. package/lib/commonjs/store/createQpqStore.js +160 -0
  72. package/lib/commonjs/store/createQpqStore.js.map +1 -0
  73. package/lib/commonjs/store/index.d.ts +5 -0
  74. package/lib/commonjs/store/index.js +22 -0
  75. package/lib/commonjs/store/index.js.map +1 -0
  76. package/lib/commonjs/store/qpqStoreContext.d.ts +3 -0
  77. package/lib/commonjs/store/qpqStoreContext.js +6 -0
  78. package/lib/commonjs/store/qpqStoreContext.js.map +1 -0
  79. package/lib/commonjs/store/useQpqStore.d.ts +2 -0
  80. package/lib/commonjs/store/useQpqStore.js +14 -0
  81. package/lib/commonjs/store/useQpqStore.js.map +1 -0
  82. package/lib/commonjs/useFieldBinding/useFieldBinding.d.ts +1 -1
  83. package/lib/commonjs/useFieldBinding/useFieldBinding.js +2 -2
  84. package/lib/commonjs/useFieldBinding/useFieldBinding.js.map +1 -1
  85. package/lib/commonjs/useSharedQueryParams/sharedQueryParamsRuntime.d.ts +1 -1
  86. package/lib/commonjs/useSharedQueryParams/sharedQueryParamsRuntime.js +7 -2
  87. package/lib/commonjs/useSharedQueryParams/sharedQueryParamsRuntime.js.map +1 -1
  88. package/lib/commonjs/webSocketQueue/hooks/useQpqWebsocketQueueRuntime.d.ts +4 -5
  89. package/lib/commonjs/webSocketQueue/hooks/useQpqWebsocketQueueRuntime.js +3 -3
  90. package/lib/commonjs/webSocketQueue/hooks/useQpqWebsocketQueueRuntime.js.map +1 -1
  91. package/lib/commonjs/webSocketQueue/hooks/useWebsocketQueueSendEvent.js +8 -1
  92. package/lib/commonjs/webSocketQueue/hooks/useWebsocketQueueSendEvent.js.map +1 -1
  93. package/lib/esm/hooks/index.d.ts +0 -1
  94. package/lib/esm/hooks/index.js +0 -1
  95. package/lib/esm/hooks/index.js.map +1 -1
  96. package/lib/esm/hooks/useQpq.js +1 -1
  97. package/lib/esm/hooks/useQpq.js.map +1 -1
  98. package/lib/esm/index.d.ts +3 -0
  99. package/lib/esm/index.js +3 -0
  100. package/lib/esm/index.js.map +1 -1
  101. package/lib/esm/{hooks/asmj → qpqContext}/QpqContextProvider.d.ts +3 -5
  102. package/lib/esm/{hooks/asmj → qpqContext}/QpqContextProvider.js +2 -10
  103. package/lib/esm/qpqContext/QpqContextProvider.js.map +1 -0
  104. package/lib/esm/qpqContext/index.d.ts +3 -0
  105. package/lib/esm/qpqContext/index.js +4 -0
  106. package/lib/esm/qpqContext/index.js.map +1 -0
  107. package/lib/esm/qpqContext/qpqReactContext.d.ts +2 -0
  108. package/lib/esm/qpqContext/qpqReactContext.js +3 -0
  109. package/lib/esm/qpqContext/qpqReactContext.js.map +1 -0
  110. package/lib/esm/qpqContext/useQpqContextValue.d.ts +2 -0
  111. package/lib/esm/qpqContext/useQpqContextValue.js +6 -0
  112. package/lib/esm/qpqContext/useQpqContextValue.js.map +1 -0
  113. package/lib/esm/qpqContext/useQpqContextValues.d.ts +2 -0
  114. package/lib/esm/qpqContext/useQpqContextValues.js +6 -0
  115. package/lib/esm/qpqContext/useQpqContextValues.js.map +1 -0
  116. package/lib/esm/runtime/ActionProcessorListResolverFactory.d.ts +3 -0
  117. package/lib/esm/runtime/ActionProcessorListResolverFactory.js +2 -0
  118. package/lib/esm/runtime/ActionProcessorListResolverFactory.js.map +1 -0
  119. package/lib/esm/runtime/BubbleReducerDispatchContext.d.ts +1 -0
  120. package/lib/esm/runtime/BubbleReducerDispatchContext.js +6 -0
  121. package/lib/esm/runtime/BubbleReducerDispatchContext.js.map +1 -0
  122. package/lib/esm/runtime/QpqBubbleReducer.d.ts +1 -0
  123. package/lib/esm/runtime/QpqBubbleReducer.js +2 -0
  124. package/lib/esm/runtime/QpqBubbleReducer.js.map +1 -0
  125. package/lib/esm/runtime/QpqMappedApi.js.map +1 -0
  126. package/lib/esm/runtime/QpqRuntimeEffectCatcher.d.ts +9 -0
  127. package/lib/esm/{hooks/asmj → runtime}/QpqRuntimeEffectCatcher.js +3 -3
  128. package/lib/esm/runtime/QpqRuntimeEffectCatcher.js.map +1 -0
  129. package/lib/esm/runtime/actionProcessor/getStateDispatchActionProcessor.js.map +1 -0
  130. package/lib/esm/runtime/actionProcessor/getStateReadActionProcessor.js.map +1 -0
  131. package/lib/esm/runtime/actionProcessor/index.js.map +1 -0
  132. package/lib/esm/runtime/createQpqRuntimeComputed.d.ts +7 -0
  133. package/lib/esm/runtime/createQpqRuntimeComputed.js +4 -0
  134. package/lib/esm/runtime/createQpqRuntimeComputed.js.map +1 -0
  135. package/lib/esm/runtime/createQpqRuntimeDefinition.d.ts +16 -0
  136. package/lib/esm/runtime/createQpqRuntimeDefinition.js +10 -0
  137. package/lib/esm/runtime/createQpqRuntimeDefinition.js.map +1 -0
  138. package/lib/esm/runtime/getQpqRuntimeAreaKey.d.ts +3 -0
  139. package/lib/esm/runtime/getQpqRuntimeAreaKey.js +2 -0
  140. package/lib/esm/runtime/getQpqRuntimeAreaKey.js.map +1 -0
  141. package/lib/esm/runtime/index.d.ts +12 -0
  142. package/lib/esm/runtime/index.js +13 -0
  143. package/lib/esm/runtime/index.js.map +1 -0
  144. package/lib/esm/{hooks/asmj → runtime}/useBubbleReducer.d.ts +1 -1
  145. package/lib/esm/{hooks/asmj → runtime}/useBubbleReducer.js +1 -1
  146. package/lib/esm/runtime/useBubbleReducer.js.map +1 -0
  147. package/lib/esm/runtime/useQpqAreaBinding.d.ts +11 -0
  148. package/lib/esm/runtime/useQpqAreaBinding.js +68 -0
  149. package/lib/esm/runtime/useQpqAreaBinding.js.map +1 -0
  150. package/lib/esm/runtime/useQpqRuntime.d.ts +4 -0
  151. package/lib/esm/runtime/useQpqRuntime.js +25 -0
  152. package/lib/esm/runtime/useQpqRuntime.js.map +1 -0
  153. package/lib/esm/runtime/useQpqRuntimeComputed.d.ts +2 -0
  154. package/lib/esm/runtime/useQpqRuntimeComputed.js +23 -0
  155. package/lib/esm/runtime/useQpqRuntimeComputed.js.map +1 -0
  156. package/lib/esm/store/QpqStoreProvider.d.ts +8 -0
  157. package/lib/esm/store/QpqStoreProvider.js +9 -0
  158. package/lib/esm/store/QpqStoreProvider.js.map +1 -0
  159. package/lib/esm/store/connectQpqStoreToReduxDevTools.d.ts +2 -0
  160. package/lib/esm/store/connectQpqStoreToReduxDevTools.js +137 -0
  161. package/lib/esm/store/connectQpqStoreToReduxDevTools.js.map +1 -0
  162. package/lib/esm/store/createQpqStore.d.ts +22 -0
  163. package/lib/esm/store/createQpqStore.js +156 -0
  164. package/lib/esm/store/createQpqStore.js.map +1 -0
  165. package/lib/esm/store/index.d.ts +5 -0
  166. package/lib/esm/store/index.js +6 -0
  167. package/lib/esm/store/index.js.map +1 -0
  168. package/lib/esm/store/qpqStoreContext.d.ts +3 -0
  169. package/lib/esm/store/qpqStoreContext.js +3 -0
  170. package/lib/esm/store/qpqStoreContext.js.map +1 -0
  171. package/lib/esm/store/useQpqStore.d.ts +2 -0
  172. package/lib/esm/store/useQpqStore.js +10 -0
  173. package/lib/esm/store/useQpqStore.js.map +1 -0
  174. package/lib/esm/useFieldBinding/useFieldBinding.d.ts +1 -1
  175. package/lib/esm/useFieldBinding/useFieldBinding.js +1 -1
  176. package/lib/esm/useFieldBinding/useFieldBinding.js.map +1 -1
  177. package/lib/esm/useSharedQueryParams/sharedQueryParamsRuntime.d.ts +1 -1
  178. package/lib/esm/useSharedQueryParams/sharedQueryParamsRuntime.js +7 -2
  179. package/lib/esm/useSharedQueryParams/sharedQueryParamsRuntime.js.map +1 -1
  180. package/lib/esm/webSocketQueue/hooks/useQpqWebsocketQueueRuntime.d.ts +4 -5
  181. package/lib/esm/webSocketQueue/hooks/useQpqWebsocketQueueRuntime.js +3 -3
  182. package/lib/esm/webSocketQueue/hooks/useQpqWebsocketQueueRuntime.js.map +1 -1
  183. package/lib/esm/webSocketQueue/hooks/useWebsocketQueueSendEvent.js +8 -1
  184. package/lib/esm/webSocketQueue/hooks/useWebsocketQueueSendEvent.js.map +1 -1
  185. package/package.json +8 -9
  186. package/lib/commonjs/hooks/asmj/QpqContextProvider.js +0 -26
  187. package/lib/commonjs/hooks/asmj/QpqContextProvider.js.map +0 -1
  188. package/lib/commonjs/hooks/asmj/QpqMappedApi.js.map +0 -1
  189. package/lib/commonjs/hooks/asmj/QpqRuntimeEffectCatcher.d.ts +0 -14
  190. package/lib/commonjs/hooks/asmj/QpqRuntimeEffectCatcher.js +0 -14
  191. package/lib/commonjs/hooks/asmj/QpqRuntimeEffectCatcher.js.map +0 -1
  192. package/lib/commonjs/hooks/asmj/actionProcessor/getStateDispatchActionProcessor.js.map +0 -1
  193. package/lib/commonjs/hooks/asmj/actionProcessor/getStateReadActionProcessor.js.map +0 -1
  194. package/lib/commonjs/hooks/asmj/actionProcessor/index.js.map +0 -1
  195. package/lib/commonjs/hooks/asmj/bubbleReducer.d.ts +0 -5
  196. package/lib/commonjs/hooks/asmj/bubbleReducer.js +0 -29
  197. package/lib/commonjs/hooks/asmj/bubbleReducer.js.map +0 -1
  198. package/lib/commonjs/hooks/asmj/createQpqRuntimeDefinition.d.ts +0 -22
  199. package/lib/commonjs/hooks/asmj/createQpqRuntimeDefinition.js +0 -53
  200. package/lib/commonjs/hooks/asmj/createQpqRuntimeDefinition.js.map +0 -1
  201. package/lib/commonjs/hooks/asmj/index.d.ts +0 -8
  202. package/lib/commonjs/hooks/asmj/index.js.map +0 -1
  203. package/lib/commonjs/hooks/asmj/useBubbleReducer.js.map +0 -1
  204. package/lib/commonjs/hooks/asmj/useQpqRuntime.d.ts +0 -6
  205. package/lib/commonjs/hooks/asmj/useQpqRuntime.js +0 -49
  206. package/lib/commonjs/hooks/asmj/useQpqRuntime.js.map +0 -1
  207. package/lib/esm/hooks/asmj/QpqContextProvider.js.map +0 -1
  208. package/lib/esm/hooks/asmj/QpqMappedApi.js.map +0 -1
  209. package/lib/esm/hooks/asmj/QpqRuntimeEffectCatcher.d.ts +0 -14
  210. package/lib/esm/hooks/asmj/QpqRuntimeEffectCatcher.js.map +0 -1
  211. package/lib/esm/hooks/asmj/actionProcessor/getStateDispatchActionProcessor.js.map +0 -1
  212. package/lib/esm/hooks/asmj/actionProcessor/getStateReadActionProcessor.js.map +0 -1
  213. package/lib/esm/hooks/asmj/actionProcessor/index.js.map +0 -1
  214. package/lib/esm/hooks/asmj/bubbleReducer.d.ts +0 -5
  215. package/lib/esm/hooks/asmj/bubbleReducer.js +0 -25
  216. package/lib/esm/hooks/asmj/bubbleReducer.js.map +0 -1
  217. package/lib/esm/hooks/asmj/createQpqRuntimeDefinition.d.ts +0 -22
  218. package/lib/esm/hooks/asmj/createQpqRuntimeDefinition.js +0 -47
  219. package/lib/esm/hooks/asmj/createQpqRuntimeDefinition.js.map +0 -1
  220. package/lib/esm/hooks/asmj/index.d.ts +0 -8
  221. package/lib/esm/hooks/asmj/index.js +0 -9
  222. package/lib/esm/hooks/asmj/index.js.map +0 -1
  223. package/lib/esm/hooks/asmj/useBubbleReducer.js.map +0 -1
  224. package/lib/esm/hooks/asmj/useQpqRuntime.d.ts +0 -6
  225. package/lib/esm/hooks/asmj/useQpqRuntime.js +0 -38
  226. package/lib/esm/hooks/asmj/useQpqRuntime.js.map +0 -1
  227. /package/lib/commonjs/{hooks/asmj → runtime}/QpqMappedApi.d.ts +0 -0
  228. /package/lib/commonjs/{hooks/asmj → runtime}/QpqMappedApi.js +0 -0
  229. /package/lib/commonjs/{hooks/asmj → runtime}/actionProcessor/getStateDispatchActionProcessor.d.ts +0 -0
  230. /package/lib/commonjs/{hooks/asmj → runtime}/actionProcessor/getStateDispatchActionProcessor.js +0 -0
  231. /package/lib/commonjs/{hooks/asmj → runtime}/actionProcessor/getStateReadActionProcessor.d.ts +0 -0
  232. /package/lib/commonjs/{hooks/asmj → runtime}/actionProcessor/getStateReadActionProcessor.js +0 -0
  233. /package/lib/commonjs/{hooks/asmj → runtime}/actionProcessor/index.d.ts +0 -0
  234. /package/lib/commonjs/{hooks/asmj → runtime}/actionProcessor/index.js +0 -0
  235. /package/lib/esm/{hooks/asmj → runtime}/QpqMappedApi.d.ts +0 -0
  236. /package/lib/esm/{hooks/asmj → runtime}/QpqMappedApi.js +0 -0
  237. /package/lib/esm/{hooks/asmj → runtime}/actionProcessor/getStateDispatchActionProcessor.d.ts +0 -0
  238. /package/lib/esm/{hooks/asmj → runtime}/actionProcessor/getStateDispatchActionProcessor.js +0 -0
  239. /package/lib/esm/{hooks/asmj → runtime}/actionProcessor/getStateReadActionProcessor.d.ts +0 -0
  240. /package/lib/esm/{hooks/asmj → runtime}/actionProcessor/getStateReadActionProcessor.js +0 -0
  241. /package/lib/esm/{hooks/asmj → runtime}/actionProcessor/index.d.ts +0 -0
  242. /package/lib/esm/{hooks/asmj → runtime}/actionProcessor/index.js +0 -0
@@ -1 +1 @@
1
- {"version":3,"file":"sharedQueryParamsRuntime.js","sourceRoot":"","sources":["../../../src/useSharedQueryParams/sharedQueryParamsRuntime.ts"],"names":[],"mappings":";;;AAAA,yFAAsF;AACtF,6CAAyD;AACzD,mCAAiF;AAEpE,QAAA,wBAAwB,GAAG,IAAA,uDAA0B,EAAC,gCAAsB,EAAE,oCAA4B,EAAE,gCAAwB,CAAC,CAAC","sourcesContent":["import { createQpqRuntimeDefinition } from '../hooks/asmj/createQpqRuntimeDefinition';\nimport { sharedQueryParamsLogic } from './logic/runtime';\nimport { sharedQueryParamsInitalState, sharedQueryParamsReducer } from './logic';\n\nexport const sharedQueryParamsRuntime = createQpqRuntimeDefinition(sharedQueryParamsLogic, sharedQueryParamsInitalState, sharedQueryParamsReducer);\n"]}
1
+ {"version":3,"file":"sharedQueryParamsRuntime.js","sourceRoot":"","sources":["../../../src/useSharedQueryParams/sharedQueryParamsRuntime.ts"],"names":[],"mappings":";;;AAAA,sFAAmF;AACnF,6CAAyD;AACzD,mCAAiF;AAEpE,QAAA,wBAAwB,GAAG,IAAA,uDAA0B,EAAC;IACjE,UAAU,EAAE,iCAAiC;IAC7C,GAAG,EAAE,gCAAsB;IAC3B,YAAY,EAAE,oCAA4B;IAC1C,OAAO,EAAE,gCAAwB;CAClC,CAAC,CAAC","sourcesContent":["import { createQpqRuntimeDefinition } from '../runtime/createQpqRuntimeDefinition';\nimport { sharedQueryParamsLogic } from './logic/runtime';\nimport { sharedQueryParamsInitalState, sharedQueryParamsReducer } from './logic';\n\nexport const sharedQueryParamsRuntime = createQpqRuntimeDefinition({\n uniqueName: 'qpq/web-react/sharedQueryParams',\n api: sharedQueryParamsLogic,\n initialState: sharedQueryParamsInitalState,\n reducer: sharedQueryParamsReducer,\n});\n"]}
@@ -1,6 +1,5 @@
1
- import { Story } from 'quidproquo-core';
2
1
  import { AnyWebSocketQueueEventMessageWithCorrelation } from 'quidproquo-features';
3
- import { QpqRuntimeDefinition } from '../../hooks/asmj/createQpqRuntimeDefinition';
4
- import { QpqApi, QpqMappedApi } from '../../hooks/asmj/QpqMappedApi';
5
- import { ActionProcessorListResolverFactory } from '../../hooks/asmj/useQpqRuntime';
6
- export declare function useQpqWebsocketQueueRuntime<TState, TAction, TApi extends QpqApi>(atom: QpqRuntimeDefinition<TState, TAction, TApi>, mainStory?: Story<any, any>, name?: string, getActionProcessors?: ActionProcessorListResolverFactory<TState>): [QpqMappedApi<TApi>, TState, (action: any) => void, (event: Omit<AnyWebSocketQueueEventMessageWithCorrelation, 'correlationId'>) => Promise<any>];
2
+ import { ActionProcessorListResolverFactory } from '../../runtime/ActionProcessorListResolverFactory';
3
+ import { QpqRuntimeDefinition } from '../../runtime/createQpqRuntimeDefinition';
4
+ import { QpqApi, QpqMappedApi } from '../../runtime/QpqMappedApi';
5
+ export declare function useQpqWebsocketQueueRuntime<TState, TAction, TApi extends QpqApi>(definition: QpqRuntimeDefinition<TState, TAction, TApi>, instanceName?: string, getActionProcessors?: ActionProcessorListResolverFactory<TState>): [QpqMappedApi<TApi>, TState, (action: any) => void, (event: Omit<AnyWebSocketQueueEventMessageWithCorrelation, 'correlationId'>) => Promise<any>];
@@ -12,10 +12,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.useQpqWebsocketQueueRuntime = useQpqWebsocketQueueRuntime;
13
13
  const quidproquo_features_1 = require("quidproquo-features");
14
14
  const react_1 = require("react");
15
- const useQpqRuntime_1 = require("../../hooks/asmj/useQpqRuntime");
15
+ const useQpqRuntime_1 = require("../../runtime/useQpqRuntime");
16
16
  const getServiceRequestActionProcessor_1 = require("./actionProcessor/getServiceRequestActionProcessor");
17
17
  const useWebsocketQueueSendEvent_1 = require("./useWebsocketQueueSendEvent");
18
- function useQpqWebsocketQueueRuntime(atom, mainStory, name, getActionProcessors) {
18
+ function useQpqWebsocketQueueRuntime(definition, instanceName, getActionProcessors) {
19
19
  const sendEventRef = (0, react_1.useRef)(null);
20
20
  const mergedFactory = (dispatch, getCurrentState) => {
21
21
  const serviceResolver = () => __awaiter(this, void 0, void 0, function* () { return (0, getServiceRequestActionProcessor_1.getServiceRequestActionProcessor)(sendEventRef); });
@@ -24,7 +24,7 @@ function useQpqWebsocketQueueRuntime(atom, mainStory, name, getActionProcessors)
24
24
  return (Object.assign(Object.assign({}, (yield serviceResolver())), (callerResolver ? yield callerResolver(qpqConfig, dynamicModuleLoader) : {})));
25
25
  });
26
26
  };
27
- const [api, state, dispatch] = (0, useQpqRuntime_1.useQpqRuntime)(atom, mainStory, name, mergedFactory);
27
+ const [api, state, dispatch] = (0, useQpqRuntime_1.useQpqRuntime)(definition, instanceName, mergedFactory);
28
28
  const sendEvent = (0, useWebsocketQueueSendEvent_1.useWebsocketQueueSendEvent)((event) => {
29
29
  if (event.type === quidproquo_features_1.WebSocketQueueServerMessageEventType.StateDispatch) {
30
30
  dispatch(event.payload);
@@ -1 +1 @@
1
- {"version":3,"file":"useQpqWebsocketQueueRuntime.js","sourceRoot":"","sources":["../../../../src/webSocketQueue/hooks/useQpqWebsocketQueueRuntime.ts"],"names":[],"mappings":";;;;;;;;;;;AAWA,kEA6BC;AAvCD,6DAAyH;AAEzH,iCAA+B;AAI/B,kEAAmG;AACnG,yGAAsG;AACtG,6EAA0E;AAE1E,SAAgB,2BAA2B,CACzC,IAAiD,EACjD,SAA2B,EAC3B,IAAa,EACb,mBAAgE;IAEhE,MAAM,YAAY,GAAG,IAAA,cAAM,EAAwG,IAAI,CAAC,CAAC;IAEzI,MAAM,aAAa,GAA+C,CAAC,QAAQ,EAAE,eAAe,EAAE,EAAE;QAC9F,MAAM,eAAe,GAAG,GAAS,EAAE,gDAAC,OAAA,IAAA,mEAAgC,EAAC,YAAY,CAAC,CAAA,GAAA,CAAC;QACnF,MAAM,cAAc,GAAG,mBAAmB,aAAnB,mBAAmB,uBAAnB,mBAAmB,CAAG,QAAQ,EAAE,eAAe,CAAC,CAAC;QAExE,OAAO,CAAO,SAAS,EAAE,mBAAmB,EAAE,EAAE;YAAC,OAAA,iCAC5C,CAAC,MAAM,eAAe,EAAE,CAAC,GACzB,CAAC,cAAc,CAAC,CAAC,CAAC,MAAM,cAAc,CAAC,SAAS,EAAE,mBAAmB,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,EAC/E,CAAA;UAAA,CAAC;IACL,CAAC,CAAC;IAEF,MAAM,CAAC,GAAG,EAAE,KAAK,EAAE,QAAQ,CAAC,GAAG,IAAA,6BAAa,EAAC,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,aAAa,CAAC,CAAC;IAEnF,MAAM,SAAS,GAAG,IAAA,uDAA0B,EAAC,CAAC,KAAK,EAAE,EAAE;QACrD,IAAI,KAAK,CAAC,IAAI,KAAK,0DAAoC,CAAC,aAAa,EAAE,CAAC;YACtE,QAAQ,CAAE,KAAa,CAAC,OAAO,CAAC,CAAC;QACnC,CAAC;IACH,CAAC,CAAC,CAAC;IAEH,YAAY,CAAC,OAAO,GAAG,SAAS,CAAC;IAEjC,OAAO,CAAC,GAAG,EAAE,KAAK,EAAE,QAAQ,EAAE,SAAS,CAAC,CAAC;AAC3C,CAAC","sourcesContent":["import { Story } from 'quidproquo-core';\nimport { AnyWebSocketQueueEventMessageWithCorrelation, WebSocketQueueServerMessageEventType } from 'quidproquo-features';\n\nimport { useRef } from 'react';\n\nimport { QpqRuntimeDefinition } from '../../hooks/asmj/createQpqRuntimeDefinition';\nimport { QpqApi, QpqMappedApi } from '../../hooks/asmj/QpqMappedApi';\nimport { ActionProcessorListResolverFactory, useQpqRuntime } from '../../hooks/asmj/useQpqRuntime';\nimport { getServiceRequestActionProcessor } from './actionProcessor/getServiceRequestActionProcessor';\nimport { useWebsocketQueueSendEvent } from './useWebsocketQueueSendEvent';\n\nexport function useQpqWebsocketQueueRuntime<TState, TAction, TApi extends QpqApi>(\n atom: QpqRuntimeDefinition<TState, TAction, TApi>,\n mainStory?: Story<any, any>,\n name?: string,\n getActionProcessors?: ActionProcessorListResolverFactory<TState>,\n): [QpqMappedApi<TApi>, TState, (action: any) => void, (event: Omit<AnyWebSocketQueueEventMessageWithCorrelation, 'correlationId'>) => Promise<any>] {\n const sendEventRef = useRef<((event: Omit<AnyWebSocketQueueEventMessageWithCorrelation, 'correlationId'>) => Promise<any>) | null>(null);\n\n const mergedFactory: ActionProcessorListResolverFactory<TState> = (dispatch, getCurrentState) => {\n const serviceResolver = async () => getServiceRequestActionProcessor(sendEventRef);\n const callerResolver = getActionProcessors?.(dispatch, getCurrentState);\n\n return async (qpqConfig, dynamicModuleLoader) => ({\n ...(await serviceResolver()),\n ...(callerResolver ? await callerResolver(qpqConfig, dynamicModuleLoader) : {}),\n });\n };\n\n const [api, state, dispatch] = useQpqRuntime(atom, mainStory, name, mergedFactory);\n\n const sendEvent = useWebsocketQueueSendEvent((event) => {\n if (event.type === WebSocketQueueServerMessageEventType.StateDispatch) {\n dispatch((event as any).payload);\n }\n });\n\n sendEventRef.current = sendEvent;\n\n return [api, state, dispatch, sendEvent];\n}\n"]}
1
+ {"version":3,"file":"useQpqWebsocketQueueRuntime.js","sourceRoot":"","sources":["../../../../src/webSocketQueue/hooks/useQpqWebsocketQueueRuntime.ts"],"names":[],"mappings":";;;;;;;;;;;AAWA,kEA4BC;AAvCD,6DAAyH;AAEzH,iCAA+B;AAK/B,+DAA4D;AAC5D,yGAAsG;AACtG,6EAA0E;AAE1E,SAAgB,2BAA2B,CACzC,UAAuD,EACvD,YAAqB,EACrB,mBAAgE;IAEhE,MAAM,YAAY,GAAG,IAAA,cAAM,EAAwG,IAAI,CAAC,CAAC;IAEzI,MAAM,aAAa,GAA+C,CAAC,QAAQ,EAAE,eAAe,EAAE,EAAE;QAC9F,MAAM,eAAe,GAAG,GAAS,EAAE,gDAAC,OAAA,IAAA,mEAAgC,EAAC,YAAY,CAAC,CAAA,GAAA,CAAC;QACnF,MAAM,cAAc,GAAG,mBAAmB,aAAnB,mBAAmB,uBAAnB,mBAAmB,CAAG,QAAQ,EAAE,eAAe,CAAC,CAAC;QAExE,OAAO,CAAO,SAAS,EAAE,mBAAmB,EAAE,EAAE;YAAC,OAAA,iCAC5C,CAAC,MAAM,eAAe,EAAE,CAAC,GACzB,CAAC,cAAc,CAAC,CAAC,CAAC,MAAM,cAAc,CAAC,SAAS,EAAE,mBAAmB,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,EAC/E,CAAA;UAAA,CAAC;IACL,CAAC,CAAC;IAEF,MAAM,CAAC,GAAG,EAAE,KAAK,EAAE,QAAQ,CAAC,GAAG,IAAA,6BAAa,EAAC,UAAU,EAAE,YAAY,EAAE,aAAa,CAAC,CAAC;IAEtF,MAAM,SAAS,GAAG,IAAA,uDAA0B,EAAC,CAAC,KAAK,EAAE,EAAE;QACrD,IAAI,KAAK,CAAC,IAAI,KAAK,0DAAoC,CAAC,aAAa,EAAE,CAAC;YACtE,QAAQ,CAAE,KAAa,CAAC,OAAO,CAAC,CAAC;QACnC,CAAC;IACH,CAAC,CAAC,CAAC;IAEH,YAAY,CAAC,OAAO,GAAG,SAAS,CAAC;IAEjC,OAAO,CAAC,GAAG,EAAE,KAAK,EAAE,QAAQ,EAAE,SAAS,CAAC,CAAC;AAC3C,CAAC","sourcesContent":["import { AnyWebSocketQueueEventMessageWithCorrelation, WebSocketQueueServerMessageEventType } from 'quidproquo-features';\n\nimport { useRef } from 'react';\n\nimport { ActionProcessorListResolverFactory } from '../../runtime/ActionProcessorListResolverFactory';\nimport { QpqRuntimeDefinition } from '../../runtime/createQpqRuntimeDefinition';\nimport { QpqApi, QpqMappedApi } from '../../runtime/QpqMappedApi';\nimport { useQpqRuntime } from '../../runtime/useQpqRuntime';\nimport { getServiceRequestActionProcessor } from './actionProcessor/getServiceRequestActionProcessor';\nimport { useWebsocketQueueSendEvent } from './useWebsocketQueueSendEvent';\n\nexport function useQpqWebsocketQueueRuntime<TState, TAction, TApi extends QpqApi>(\n definition: QpqRuntimeDefinition<TState, TAction, TApi>,\n instanceName?: string,\n getActionProcessors?: ActionProcessorListResolverFactory<TState>,\n): [QpqMappedApi<TApi>, TState, (action: any) => void, (event: Omit<AnyWebSocketQueueEventMessageWithCorrelation, 'correlationId'>) => Promise<any>] {\n const sendEventRef = useRef<((event: Omit<AnyWebSocketQueueEventMessageWithCorrelation, 'correlationId'>) => Promise<any>) | null>(null);\n\n const mergedFactory: ActionProcessorListResolverFactory<TState> = (dispatch, getCurrentState) => {\n const serviceResolver = async () => getServiceRequestActionProcessor(sendEventRef);\n const callerResolver = getActionProcessors?.(dispatch, getCurrentState);\n\n return async (qpqConfig, dynamicModuleLoader) => ({\n ...(await serviceResolver()),\n ...(callerResolver ? await callerResolver(qpqConfig, dynamicModuleLoader) : {}),\n });\n };\n\n const [api, state, dispatch] = useQpqRuntime(definition, instanceName, mergedFactory);\n\n const sendEvent = useWebsocketQueueSendEvent((event) => {\n if (event.type === WebSocketQueueServerMessageEventType.StateDispatch) {\n dispatch((event as any).payload);\n }\n });\n\n sendEventRef.current = sendEvent;\n\n return [api, state, dispatch, sendEvent];\n}\n"]}
@@ -23,8 +23,15 @@ const useWebsocketQueueSendEvent = (onCorrelatedMessage) => {
23
23
  const resolve = pendingResolversRef.current.get(parsed.correlationId);
24
24
  if (resolve) {
25
25
  resolve(parsed.payload);
26
+ // Only the resolver is retired: it has done its job, and a promise settles once.
27
+ //
28
+ // The CORRELATION deliberately stays active. It is a subscription, not a request,
29
+ // and it is live for as long as the component that opened it is mounted. Retiring
30
+ // it here used to be invisible because a response was always the last message sent,
31
+ // but a handler that responds first and keeps streaming (a batch that reports
32
+ // progress per record, say) would have every later message silently dropped by the
33
+ // guard above.
26
34
  pendingResolversRef.current.delete(parsed.correlationId);
27
- activeCorrelationsRef.current.delete(parsed.correlationId);
28
35
  }
29
36
  }
30
37
  else {
@@ -1 +1 @@
1
- {"version":3,"file":"useWebsocketQueueSendEvent.js","sourceRoot":"","sources":["../../../../src/webSocketQueue/hooks/useWebsocketQueueSendEvent.ts"],"names":[],"mappings":";;;AAAA,6DAI6B;AAC7B,mDAAyE;AAEzE,iCAA+B;AAE/B,uCAA8C;AAC9C,+CAA2E;AAEpE,MAAM,0BAA0B,GAAG,CACxC,mBAAmF,EACnF,EAAE;IACF,MAAM,YAAY,GAAG,IAAA,2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gE;IAChE,MAAM,SAAS,GAAG,IAAA,uBAAe,EAAC,CAAC,KAAmC,EAAgB,EAAE;QACtF,IAAI,CAAC,YAAY,EAAE,CAAC;YAClB,OAAO,OAAO,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;QACpC,CAAC;QAED,MAAM,aAAa,GAAG,MAAM,CAAC,UAAU,EAAE,CAAC;QAC1C,qBAAqB,CAAC,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC;QAEjD,MAAM,gBAAgB,GAAG,KAAK,CAAC,IAAI,CAAC,UAAU,CAAC,qBAAqB,CAAC,CAAC;QAEtE,IAAI,gBAAgB,EAAE,CAAC;YACrB,MAAM,OAAO,GAAG,IAAI,OAAO,CAAM,CAAC,OAAO,EAAE,EAAE;gBAC3C,mBAAmB,CAAC,OAAO,CAAC,GAAG,CAAC,aAAa,EAAE,OAAO,CAAC,CAAC;YAC1D,CAAC,CAAC,CAAC;YAEH,YAAY,CAAC,SAAS,CAAC,gCAAK,KAAK,KAAE,aAAa,GAAW,CAAC,CAAC;YAE7D,OAAO,OAAO,CAAC;QACjB,CAAC;QAED,YAAY,CAAC,SAAS,CAAC,gCAAK,KAAK,KAAE,aAAa,GAAW,CAAC,CAAC;QAE7D,OAAO,OAAO,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IACpC,CAAC,CAAC,CAAC;IAEH,OAAO,SAAS,CAAC;AACnB,CAAC,CAAC;AA9DW,QAAA,0BAA0B,8BA8DrC","sourcesContent":["import {\n AnyWebSocketQueueEventMessageWithCorrelation,\n WebSocketQueueServerEventMessageServiceRequestResponse,\n WebSocketQueueServerMessageEventType,\n} from 'quidproquo-features';\nimport { WebsocketService, WebsocketServiceEvent } from 'quidproquo-web';\n\nimport { useRef } from 'react';\n\nimport { useFastCallback } from '../../hooks';\nimport { useSubscribeToWebsocket, useWebsocketApi } from '../../websocket';\n\nexport const useWebsocketQueueSendEvent = <TSend extends AnyWebSocketQueueEventMessageWithCorrelation>(\n onCorrelatedMessage?: (event: AnyWebSocketQueueEventMessageWithCorrelation) => void,\n) => {\n const websocketApi = useWebsocketApi();\n const activeCorrelationsRef = useRef<Set<string>>(new Set());\n const pendingResolversRef = useRef<Map<string, (payload: any) => void>>(new Map());\n\n // Subscribe to ALL messages, filter by active correlationIds\n const handleMessage = useFastCallback((_ws: WebsocketService, rawEvent?: Event) => {\n if (!rawEvent) return;\n\n try {\n const parsed: AnyWebSocketQueueEventMessageWithCorrelation = JSON.parse((rawEvent as MessageEvent).data);\n if (!parsed.correlationId || !activeCorrelationsRef.current.has(parsed.correlationId)) {\n return;\n }\n\n if (parsed.type === WebSocketQueueServerMessageEventType.ServiceRequestResponse) {\n const resolve = pendingResolversRef.current.get(parsed.correlationId);\n if (resolve) {\n resolve((parsed as WebSocketQueueServerEventMessageServiceRequestResponse).payload);\n\n pendingResolversRef.current.delete(parsed.correlationId);\n activeCorrelationsRef.current.delete(parsed.correlationId);\n }\n } else {\n onCorrelatedMessage?.(parsed);\n }\n } catch {\n // Not JSON or not a queue message — ignore\n }\n });\n\n useSubscribeToWebsocket(WebsocketServiceEvent.MESSAGE, handleMessage);\n\n // Send with auto-generated correlationId, register it as active\n const sendEvent = useFastCallback((event: Omit<TSend, 'correlationId'>): Promise<any> => {\n if (!websocketApi) {\n return Promise.resolve(undefined);\n }\n\n const correlationId = crypto.randomUUID();\n activeCorrelationsRef.current.add(correlationId);\n\n const isServiceRequest = event.type.startsWith('qpq/serviceRequest/');\n\n if (isServiceRequest) {\n const promise = new Promise<any>((resolve) => {\n pendingResolversRef.current.set(correlationId, resolve);\n });\n\n websocketApi.sendEvent({ ...event, correlationId } as TSend);\n\n return promise;\n }\n\n websocketApi.sendEvent({ ...event, correlationId } as TSend);\n\n return Promise.resolve(undefined);\n });\n\n return sendEvent;\n};\n"]}
1
+ {"version":3,"file":"useWebsocketQueueSendEvent.js","sourceRoot":"","sources":["../../../../src/webSocketQueue/hooks/useWebsocketQueueSendEvent.ts"],"names":[],"mappings":";;;A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AAmB,CAAG,MAAM,CAAC,CAAC;YAChC,CAAC;QACH,CAAC;QAAC,WAAM,CAAC;YACP,2CAA2C;QAC7C,CAAC;IACH,CAAC,CAAC,CAAC;IAEH,IAAA,mCAAuB,EAAC,sCAAqB,CAAC,OAAO,EAAE,aAAa,CAAC,CAAC;IAEtE,gEAAgE;IAChE,MAAM,SAAS,GAAG,IAAA,uBAAe,EAAC,CAAC,KAAmC,EAAgB,EAAE;QACtF,IAAI,CAAC,YAAY,EAAE,CAAC;YAClB,OAAO,OAAO,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;QACpC,CAAC;QAED,MAAM,aAAa,GAAG,MAAM,CAAC,UAAU,EAAE,CAAC;QAC1C,qBAAqB,CAAC,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC;QAEjD,MAAM,gBAAgB,GAAG,KAAK,CAAC,IAAI,CAAC,UAAU,CAAC,qBAAqB,CAAC,CAAC;QAEtE,IAAI,gBAAgB,EAAE,CAAC;YACrB,MAAM,OAAO,GAAG,IAAI,OAAO,CAAM,CAAC,OAAO,EAAE,EAAE;gBAC3C,mBAAmB,CAAC,OAAO,CAAC,GAAG,CAAC,aAAa,EAAE,OAAO,CAAC,CAAC;YAC1D,CAAC,CAAC,CAAC;YAEH,YAAY,CAAC,SAAS,CAAC,gCAAK,KAAK,KAAE,aAAa,GAAW,CAAC,CAAC;YAE7D,OAAO,OAAO,CAAC;QACjB,CAAC;QAED,YAAY,CAAC,SAAS,CAAC,gCAAK,KAAK,KAAE,aAAa,GAAW,CAAC,CAAC;QAE7D,OAAO,OAAO,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IACpC,CAAC,CAAC,CAAC;IAEH,OAAO,SAAS,CAAC;AACnB,CAAC,CAAC;AArEW,QAAA,0BAA0B,8BAqErC","sourcesContent":["import {\n AnyWebSocketQueueEventMessageWithCorrelation,\n WebSocketQueueServerEventMessageServiceRequestResponse,\n WebSocketQueueServerMessageEventType,\n} from 'quidproquo-features';\nimport { WebsocketService, WebsocketServiceEvent } from 'quidproquo-web';\n\nimport { useRef } from 'react';\n\nimport { useFastCallback } from '../../hooks';\nimport { useSubscribeToWebsocket, useWebsocketApi } from '../../websocket';\n\nexport const useWebsocketQueueSendEvent = <TSend extends AnyWebSocketQueueEventMessageWithCorrelation>(\n onCorrelatedMessage?: (event: AnyWebSocketQueueEventMessageWithCorrelation) => void,\n) => {\n const websocketApi = useWebsocketApi();\n const activeCorrelationsRef = useRef<Set<string>>(new Set());\n const pendingResolversRef = useRef<Map<string, (payload: any) => void>>(new Map());\n\n // Subscribe to ALL messages, filter by active correlationIds\n const handleMessage = useFastCallback((_ws: WebsocketService, rawEvent?: Event) => {\n if (!rawEvent) return;\n\n try {\n const parsed: AnyWebSocketQueueEventMessageWithCorrelation = JSON.parse((rawEvent as MessageEvent).data);\n if (!parsed.correlationId || !activeCorrelationsRef.current.has(parsed.correlationId)) {\n return;\n }\n\n if (parsed.type === WebSocketQueueServerMessageEventType.ServiceRequestResponse) {\n const resolve = pendingResolversRef.current.get(parsed.correlationId);\n if (resolve) {\n resolve((parsed as WebSocketQueueServerEventMessageServiceRequestResponse).payload);\n\n // Only the resolver is retired: it has done its job, and a promise settles once.\n //\n // The CORRELATION deliberately stays active. It is a subscription, not a request,\n // and it is live for as long as the component that opened it is mounted. Retiring\n // it here used to be invisible because a response was always the last message sent,\n // but a handler that responds first and keeps streaming (a batch that reports\n // progress per record, say) would have every later message silently dropped by the\n // guard above.\n pendingResolversRef.current.delete(parsed.correlationId);\n }\n } else {\n onCorrelatedMessage?.(parsed);\n }\n } catch {\n // Not JSON or not a queue message — ignore\n }\n });\n\n useSubscribeToWebsocket(WebsocketServiceEvent.MESSAGE, handleMessage);\n\n // Send with auto-generated correlationId, register it as active\n const sendEvent = useFastCallback((event: Omit<TSend, 'correlationId'>): Promise<any> => {\n if (!websocketApi) {\n return Promise.resolve(undefined);\n }\n\n const correlationId = crypto.randomUUID();\n activeCorrelationsRef.current.add(correlationId);\n\n const isServiceRequest = event.type.startsWith('qpq/serviceRequest/');\n\n if (isServiceRequest) {\n const promise = new Promise<any>((resolve) => {\n pendingResolversRef.current.set(correlationId, resolve);\n });\n\n websocketApi.sendEvent({ ...event, correlationId } as TSend);\n\n return promise;\n }\n\n websocketApi.sendEvent({ ...event, correlationId } as TSend);\n\n return Promise.resolve(undefined);\n });\n\n return sendEvent;\n};\n"]}
@@ -1,4 +1,3 @@
1
- export * from './asmj';
2
1
  export * from './useAsyncEffect';
3
2
  export * from './useComputed';
4
3
  export * from './useEffectCallback';
@@ -1,4 +1,3 @@
1
- export * from './asmj';
2
1
  export * from './useAsyncEffect';
3
2
  export * from './useComputed';
4
3
  export * from './useEffectCallback';
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/hooks/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAC;AACvB,cAAc,kBAAkB,CAAC;AACjC,cAAc,eAAe,CAAC;AAC9B,cAAc,qBAAqB,CAAC;AACpC,cAAc,mBAAmB,CAAC;AAClC,cAAc,eAAe,CAAC;AAC9B,cAAc,sBAAsB,CAAC;AACrC,cAAc,UAAU,CAAC;AACzB,cAAc,eAAe,CAAC;AAC9B,cAAc,oBAAoB,CAAC;AACnC,cAAc,gBAAgB,CAAC","sourcesContent":["export * from './asmj';\nexport * from './useAsyncEffect';\nexport * from './useComputed';\nexport * from './useEffectCallback';\nexport * from './useFastCallback';\nexport * from './useMetadata';\nexport * from './useOnKeyDownEffect';\nexport * from './useQpq';\nexport * from './useRunEvery';\nexport * from './useThrottledMemo';\nexport * from './useZipArrays';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/hooks/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,eAAe,CAAC;AAC9B,cAAc,qBAAqB,CAAC;AACpC,cAAc,mBAAmB,CAAC;AAClC,cAAc,eAAe,CAAC;AAC9B,cAAc,sBAAsB,CAAC;AACrC,cAAc,UAAU,CAAC;AACzB,cAAc,eAAe,CAAC;AAC9B,cAAc,oBAAoB,CAAC;AACnC,cAAc,gBAAgB,CAAC","sourcesContent":["export * from './useAsyncEffect';\nexport * from './useComputed';\nexport * from './useEffectCallback';\nexport * from './useFastCallback';\nexport * from './useMetadata';\nexport * from './useOnKeyDownEffect';\nexport * from './useQpq';\nexport * from './useRunEvery';\nexport * from './useThrottledMemo';\nexport * from './useZipArrays';\n"]}
@@ -2,7 +2,7 @@ import { getWebActionProcessors } from 'quidproquo-actionprocessor-web';
2
2
  import { createRuntime, defineModule, QpqRuntimeType, } from 'quidproquo-core';
3
3
  import { useCallback, useEffect, useMemo, useRef } from 'react';
4
4
  import { useActionProcessors } from '../actionProcessor';
5
- import { useQpqContextValues } from './asmj/QpqContextProvider';
5
+ import { useQpqContextValues } from '../qpqContext/useQpqContextValues';
6
6
  import { useEffectCallback } from './useEffectCallback';
7
7
  function* withVersionCheck(story, versionRef, capturedVersion) {
8
8
  let nextValue = undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"useQpq.js","sourceRoot":"","sources":["../../../src/hooks/useQpq.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,gCAAgC,CAAC;AACxE,OAAO,EAIL,aAAa,EACb,YAAY,EAEZ,cAAc,GAGf,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAEhE,OAAO,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAChE,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAExD,QAAQ,CAAC,CAAC,gBAAgB,CAAI,KAAqB,EAAE,UAAmC,EAAE,eAAuB;IAC/G,IAAI,SAAS,GAAQ,SAAS,CAAC;IAE/B,OAAO,IAAI,EAAE,CA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AEF,OAAO,GAAG,CAAC;AACb,CAAC","sourcesContent":["import { getWebActionProcessors } from 'quidproquo-actionprocessor-web';\nimport {\n ActionProcessorListResolver,\n AskResponse,\n AskResponseReturnType,\n createRuntime,\n defineModule,\n QpqFunctionRuntime,\n QpqRuntimeType,\n Story,\n StoryResolver,\n} from 'quidproquo-core';\n\nimport { useCallback, useEffect, useMemo, useRef } from 'react';\n\nimport { useActionProcessors } from '../actionProcessor';\nimport { useQpqContextValues } from './asmj/QpqContextProvider';\nimport { useEffectCallback } from './useEffectCallback';\n\nfunction* withVersionCheck<R>(story: AskResponse<R>, versionRef: React.RefObject<number>, capturedVersion: number): AskResponse<R | undefined> {\n let nextValue: any = undefined;\n\n while (true) {\n if (versionRef.current !== capturedVersion) {\n return undefined;\n }\n\n const { value, done } = story.next(nextValue);\n\n if (done) {\n return value;\n }\n\n nextValue = yield value;\n }\n}\n\n// WIP ~ useFastCallback, wack things like loggers in a context, try to only make once instance of the runtime.\n// Also don't create every refresh.. useMemo / useCallback etc\n\nconst logger = {\n enableLogs: async () => {},\n log: async () => {},\n waitToFinishWriting: async () => {},\n moveToPermanentStorage: async () => {},\n};\n\nexport function useQpq(getActionProcessors: ActionProcessorListResolver = async () => ({})): StoryResolver {\n const qpqContextValues = useQpqContextValues();\n const contextGetActionProcessors = useActionProcessors();\n const versionRef = useRef(0);\n\n useEffect(() => {\n const capturedVersionRef = versionRef;\n return () => {\n capturedVersionRef.current++;\n };\n }, []);\n\n // Stable identities so the runtime memo can list them as dependencies\n // without being recreated every render — the runtime always calls the\n // latest processors through these wrappers.\n const stableContextGetActionProcessors = useEffectCallback(contextGetActionProcessors);\n const stableGetActionProcessors = useEffectCallback(getActionProcessors);\n\n const resolveStory = useMemo(\n () =>\n createRuntime(\n [defineModule('UI')],\n {\n depth: 0,\n context: qpqContextValues,\n },\n async (qpqConfig, dynamicModuleLoader) => ({\n ...(await getWebActionProcessors(qpqConfig, dynamicModuleLoader)),\n ...(await stableContextGetActionProcessors(qpqConfig, dynamicModuleLoader)),\n ...(await stableGetActionProcessors(qpqConfig, dynamicModuleLoader)),\n }),\n () => new Date().toISOString(),\n logger,\n `frontend::${'uuid'}`,\n QpqRuntimeType.UI,\n async (_runtime: QpqFunctionRuntime) => {\n // noop\n },\n ),\n [qpqContextValues, stableContextGetActionProcessors, stableGetActionProcessors],\n );\n\n const qpq = useCallback(\n function getStoryExecutor<S extends Story<any, any>>(story: S): (...args: Parameters<S>) => Promise<AskResponseReturnType<ReturnType<S>>> {\n return async (...args: Parameters<S>) => {\n const capturedVersion = versionRef.current;\n const wrappedStory = (...storyArgs: Parameters<S>) => withVersionCheck(story(...storyArgs), versionRef, capturedVersion);\n const result = await resolveStory(wrappedStory, args);\n\n if (result.error) {\n throw new Error(result.error.errorText);\n }\n\n return result.result;\n };\n },\n [resolveStory],\n );\n\n return qpq;\n}\n"]}
1
+ {"version":3,"file":"useQpq.js","sourceRoot":"","sources":["../../../src/hooks/useQpq.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,gCAAgC,CAAC;AACxE,OAAO,EAIL,aAAa,EACb,YAAY,EAEZ,cAAc,GAGf,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAEhE,OAAO,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,EAAE,mBAAmB,EAAE,MAAM,mCAAmC,CAAC;AACxE,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAExD,QAAQ,CAAC,CAAC,gBAAgB,CAAI,KAAqB,EAAE,UAAmC,EAAE,eAAuB;IAC/G,IAAI,SAAS,GAAQ,SAAS,CAAC;IAE/B,OAAO,IAAI,EAAE,CAAC;QACZ,IAAI,UAAU,CAAC,OAAO,KAAK,eAAe,EAAE,CAAC;YAC3C,OAAO,SAAS,CAAC;QACnB,CAAC;QAED,MAA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n AskResponse,\n AskResponseReturnType,\n createRuntime,\n defineModule,\n QpqFunctionRuntime,\n QpqRuntimeType,\n Story,\n StoryResolver,\n} from 'quidproquo-core';\n\nimport { useCallback, useEffect, useMemo, useRef } from 'react';\n\nimport { useActionProcessors } from '../actionProcessor';\nimport { useQpqContextValues } from '../qpqContext/useQpqContextValues';\nimport { useEffectCallback } from './useEffectCallback';\n\nfunction* withVersionCheck<R>(story: AskResponse<R>, versionRef: React.RefObject<number>, capturedVersion: number): AskResponse<R | undefined> {\n let nextValue: any = undefined;\n\n while (true) {\n if (versionRef.current !== capturedVersion) {\n return undefined;\n }\n\n const { value, done } = story.next(nextValue);\n\n if (done) {\n return value;\n }\n\n nextValue = yield value;\n }\n}\n\n// WIP ~ useFastCallback, wack things like loggers in a context, try to only make once instance of the runtime.\n// Also don't create every refresh.. useMemo / useCallback etc\n\nconst logger = {\n enableLogs: async () => {},\n log: async () => {},\n waitToFinishWriting: async () => {},\n moveToPermanentStorage: async () => {},\n};\n\nexport function useQpq(getActionProcessors: ActionProcessorListResolver = async () => ({})): StoryResolver {\n const qpqContextValues = useQpqContextValues();\n const contextGetActionProcessors = useActionProcessors();\n const versionRef = useRef(0);\n\n useEffect(() => {\n const capturedVersionRef = versionRef;\n return () => {\n capturedVersionRef.current++;\n };\n }, []);\n\n // Stable identities so the runtime memo can list them as dependencies\n // without being recreated every render — the runtime always calls the\n // latest processors through these wrappers.\n const stableContextGetActionProcessors = useEffectCallback(contextGetActionProcessors);\n const stableGetActionProcessors = useEffectCallback(getActionProcessors);\n\n const resolveStory = useMemo(\n () =>\n createRuntime(\n [defineModule('UI')],\n {\n depth: 0,\n context: qpqContextValues,\n },\n async (qpqConfig, dynamicModuleLoader) => ({\n ...(await getWebActionProcessors(qpqConfig, dynamicModuleLoader)),\n ...(await stableContextGetActionProcessors(qpqConfig, dynamicModuleLoader)),\n ...(await stableGetActionProcessors(qpqConfig, dynamicModuleLoader)),\n }),\n () => new Date().toISOString(),\n logger,\n `frontend::${'uuid'}`,\n QpqRuntimeType.UI,\n async (_runtime: QpqFunctionRuntime) => {\n // noop\n },\n ),\n [qpqContextValues, stableContextGetActionProcessors, stableGetActionProcessors],\n );\n\n const qpq = useCallback(\n function getStoryExecutor<S extends Story<any, any>>(story: S): (...args: Parameters<S>) => Promise<AskResponseReturnType<ReturnType<S>>> {\n return async (...args: Parameters<S>) => {\n const capturedVersion = versionRef.current;\n const wrappedStory = (...storyArgs: Parameters<S>) => withVersionCheck(story(...storyArgs), versionRef, capturedVersion);\n const result = await resolveStory(wrappedStory, args);\n\n if (result.error) {\n throw new Error(result.error.errorText);\n }\n\n return result.result;\n };\n },\n [resolveStory],\n );\n\n return qpq;\n}\n"]}
@@ -5,7 +5,10 @@ export * from './auth';
5
5
  export * from './baseUrl';
6
6
  export * from './dateTime';
7
7
  export * from './hooks';
8
+ export * from './qpqContext';
9
+ export * from './runtime';
8
10
  export * from './state';
11
+ export * from './store';
9
12
  export * from './useFieldBinding';
10
13
  export * from './useSharedQueryParams';
11
14
  export * from './websocket';
package/lib/esm/index.js CHANGED
@@ -5,7 +5,10 @@ export * from './auth';
5
5
  export * from './baseUrl';
6
6
  export * from './dateTime';
7
7
  export * from './hooks';
8
+ export * from './qpqContext';
9
+ export * from './runtime';
8
10
  export * from './state';
11
+ export * from './store';
9
12
  export * from './useFieldBinding';
10
13
  export * from './useSharedQueryParams';
11
14
  export * from './websocket';
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,mBAAmB,CAAC;AAE3B,cAAc,mBAAmB,CAAC;AAClC,cAAc,OAAO,CAAC;AACtB,cAAc,QAAQ,CAAC;AACvB,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,mBAAmB,CAAC;AAClC,cAAc,wBAAwB,CAAC;AACvC,cAAc,aAAa,CAAC;AAC5B,cAAc,kBAAkB,CAAC","sourcesContent":["import 'symbol-observable';\n\nexport * from './actionProcessor';\nexport * from './api';\nexport * from './auth';\nexport * from './baseUrl';\nexport * from './dateTime';\nexport * from './hooks';\nexport * from './state';\nexport * from './useFieldBinding';\nexport * from './useSharedQueryParams';\nexport * from './websocket';\nexport * from './webSocketQueue';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,mBAAmB,CAAC;AAE3B,cAAc,mBAAmB,CAAC;AAClC,cAAc,OAAO,CAAC;AACtB,cAAc,QAAQ,CAAC;AACvB,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,SAAS,CAAC;AACxB,cAAc,cAAc,CAAC;AAC7B,cAAc,WAAW,CAAC;AAC1B,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,mBAAmB,CAAC;AAClC,cAAc,wBAAwB,CAAC;AACvC,cAAc,aAAa,CAAC;AAC5B,cAAc,kBAAkB,CAAC","sourcesContent":["import 'symbol-observable';\n\nexport * from './actionProcessor';\nexport * from './api';\nexport * from './auth';\nexport * from './baseUrl';\nexport * from './dateTime';\nexport * from './hooks';\nexport * from './qpqContext';\nexport * from './runtime';\nexport * from './state';\nexport * from './store';\nexport * from './useFieldBinding';\nexport * from './useSharedQueryParams';\nexport * from './websocket';\nexport * from './webSocketQueue';\n"]}
@@ -1,11 +1,9 @@
1
- import { QpqContext, QpqContextIdentifier } from 'quidproquo-core';
1
+ import { QpqContextIdentifier } from 'quidproquo-core';
2
2
  import { ReactNode } from 'react';
3
- interface QpqContextProviderProps<T> {
3
+ type QpqContextProviderProps<T> = {
4
4
  contextIdentifier: QpqContextIdentifier<T>;
5
5
  value: T;
6
6
  children: ReactNode;
7
- }
8
- export declare const useQpqContextValues: () => QpqContext<any>;
9
- export declare const useQpqContextValue: <T>(contextIdentifier: QpqContextIdentifier<T>) => T;
7
+ };
10
8
  export declare const QpqContextProvider: <T>({ contextIdentifier, value, children }: QpqContextProviderProps<T>) => import("react").JSX.Element;
11
9
  export {};
@@ -1,14 +1,6 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
- import { createContext, useContext, useMemo } from 'react';
3
- // Define a generic type for the React Context
4
- const qpqReactContext = createContext({});
5
- export const useQpqContextValues = () => {
6
- return useContext(qpqReactContext);
7
- };
8
- export const useQpqContextValue = (contextIdentifier) => {
9
- const context = useQpqContextValues();
10
- return contextIdentifier.uniqueName in context ? context[contextIdentifier.uniqueName] : contextIdentifier.defaultValue;
11
- };
2
+ import { useContext, useMemo } from 'react';
3
+ import { qpqReactContext } from './qpqReactContext';
12
4
  export const QpqContextProvider = ({ contextIdentifier, value, children }) => {
13
5
  // Get the parent context value
14
6
  const parentContext = useContext(qpqReactContext);
@@ -0,0 +1 @@
1
+ {"version":3,"file":"QpqContextProvider.js","sourceRoot":"","sources":["../../../src/qpqContext/QpqContextProvider.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAa,UAAU,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAEvD,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAQpD,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAK,EAAE,iBAAiB,EAAE,KAAK,EAAE,QAAQ,EAA8B,EAAE,EAAE;IAC3G,+BAA+B;IAC/B,MAAM,aAAa,GAAG,UAAU,CAAC,eAAe,CAAC,CAAC;IAElD,iCAAiC;IACjC,MAAM,aAAa,GAAG,OAAO,CAC3B,GAAG,EAAE,CAAC,CAAC,EAAE,GAAG,aAAa,EAAE,CAAC,iBAAiB,CAAC,UAAU,CAAC,EAAE,KAAK,EAAE,CAAC,EACnE,CAAC,aAAa,EAAE,iBAAiB,CAAC,UAAU,EAAE,KAAK,CAAC,CACrD,CAAC;IAEF,kCAAkC;IAClC,OAAO,KAAC,eAAe,CAAC,QAAQ,IAAC,KAAK,EAAE,aAAa,YAAG,QAAQ,GAA4B,CAAC;AAC/F,CAAC,CAAC","sourcesContent":["import { QpqContextIdentifier } from 'quidproquo-core';\n\nimport { ReactNode, useContext, useMemo } from 'react';\n\nimport { qpqReactContext } from './qpqReactContext';\n\ntype QpqContextProviderProps<T> = {\n contextIdentifier: QpqContextIdentifier<T>; // Ensures the identifier carries the type of the value\n value: T; // The value must match the type expected by the identifier\n children: ReactNode;\n};\n\nexport const QpqContextProvider = <T,>({ contextIdentifier, value, children }: QpqContextProviderProps<T>) => {\n // Get the parent context value\n const parentContext = useContext(qpqReactContext);\n\n // Merge parent and current value\n const mergedContext = useMemo(\n () => ({ ...parentContext, [contextIdentifier.uniqueName]: value }),\n [parentContext, contextIdentifier.uniqueName, value],\n );\n\n // Provide the merged context down\n return <qpqReactContext.Provider value={mergedContext}>{children}</qpqReactContext.Provider>;\n};\n"]}
@@ -0,0 +1,3 @@
1
+ export * from './QpqContextProvider';
2
+ export * from './useQpqContextValue';
3
+ export * from './useQpqContextValues';
@@ -0,0 +1,4 @@
1
+ export * from './QpqContextProvider';
2
+ export * from './useQpqContextValue';
3
+ export * from './useQpqContextValues';
4
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/qpqContext/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAC;AACrC,cAAc,sBAAsB,CAAC;AACrC,cAAc,uBAAuB,CAAC","sourcesContent":["export * from './QpqContextProvider';\nexport * from './useQpqContextValue';\nexport * from './useQpqContextValues';\n"]}
@@ -0,0 +1,2 @@
1
+ import { QpqContext } from 'quidproquo-core';
2
+ export declare const qpqReactContext: import("react").Context<QpqContext<any>>;
@@ -0,0 +1,3 @@
1
+ import { createContext } from 'react';
2
+ export const qpqReactContext = createContext({});
3
+ //# sourceMappingURL=qpqReactContext.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"qpqReactContext.js","sourceRoot":"","sources":["../../../src/qpqContext/qpqReactContext.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAEtC,MAAM,CAAC,MAAM,eAAe,GAAG,aAAa,CAAkB,EAAE,CAAC,CAAC","sourcesContent":["import { QpqContext } from 'quidproquo-core';\n\nimport { createContext } from 'react';\n\nexport const qpqReactContext = createContext<QpqContext<any>>({});\n"]}
@@ -0,0 +1,2 @@
1
+ import { QpqContextIdentifier } from 'quidproquo-core';
2
+ export declare const useQpqContextValue: <T>(contextIdentifier: QpqContextIdentifier<T>) => T;
@@ -0,0 +1,6 @@
1
+ import { useQpqContextValues } from './useQpqContextValues';
2
+ export const useQpqContextValue = (contextIdentifier) => {
3
+ const context = useQpqContextValues();
4
+ return contextIdentifier.uniqueName in context ? context[contextIdentifier.uniqueName] : contextIdentifier.defaultValue;
5
+ };
6
+ //# sourceMappingURL=useQpqContextValue.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useQpqContextValue.js","sourceRoot":"","sources":["../../../src/qpqContext/useQpqContextValue.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAE5D,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAI,iBAA0C,EAAK,EAAE;IACrF,MAAM,OAAO,GAAG,mBAAmB,EAAE,CAAC;IAEtC,OAAO,iBAAiB,CAAC,UAAU,IAAI,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,iBAAiB,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,iBAAiB,CAAC,YAAY,CAAC;AAC1H,CAAC,CAAC","sourcesContent":["import { QpqContextIdentifier } from 'quidproquo-core';\n\nimport { useQpqContextValues } from './useQpqContextValues';\n\nexport const useQpqContextValue = <T>(contextIdentifier: QpqContextIdentifier<T>): T => {\n const context = useQpqContextValues();\n\n return contextIdentifier.uniqueName in context ? context[contextIdentifier.uniqueName] : contextIdentifier.defaultValue;\n};\n"]}
@@ -0,0 +1,2 @@
1
+ import { QpqContext } from 'quidproquo-core';
2
+ export declare const useQpqContextValues: () => QpqContext<any>;
@@ -0,0 +1,6 @@
1
+ import { useContext } from 'react';
2
+ import { qpqReactContext } from './qpqReactContext';
3
+ export const useQpqContextValues = () => {
4
+ return useContext(qpqReactContext);
5
+ };
6
+ //# sourceMappingURL=useQpqContextValues.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useQpqContextValues.js","sourceRoot":"","sources":["../../../src/qpqContext/useQpqContextValues.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAEnC,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEpD,MAAM,CAAC,MAAM,mBAAmB,GAAG,GAAoB,EAAE;IACvD,OAAO,UAAU,CAAC,eAAe,CAAC,CAAC;AACrC,CAAC,CAAC","sourcesContent":["import { QpqContext } from 'quidproquo-core';\n\nimport { useContext } from 'react';\n\nimport { qpqReactContext } from './qpqReactContext';\n\nexport const useQpqContextValues = (): QpqContext<any> => {\n return useContext(qpqReactContext);\n};\n"]}
@@ -0,0 +1,3 @@
1
+ import { ActionProcessorListResolver } from 'quidproquo-core';
2
+ import { Dispatch } from 'react';
3
+ export type ActionProcessorListResolverFactory<TState = any> = (dispatch: Dispatch<any>, getCurrentState: () => TState) => ActionProcessorListResolver;
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=ActionProcessorListResolverFactory.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ActionProcessorListResolverFactory.js","sourceRoot":"","sources":["../../../src/runtime/ActionProcessorListResolverFactory.ts"],"names":[],"mappings":"","sourcesContent":["import { ActionProcessorListResolver } from 'quidproquo-core';\n\nimport { Dispatch } from 'react';\n\nexport type ActionProcessorListResolverFactory<TState = any> = (\n dispatch: Dispatch<any>,\n getCurrentState: () => TState,\n) => ActionProcessorListResolver;\n"]}
@@ -0,0 +1 @@
1
+ export declare const BubbleReducerDispatchContext: import("react").Context<(action: any) => void>;
@@ -0,0 +1,6 @@
1
+ import { createContext } from 'react';
2
+ // Default NOOP dispatcher: an action that bubbles past the root is dropped.
3
+ export const BubbleReducerDispatchContext = createContext((_action) => {
4
+ // NOOP
5
+ });
6
+ //# sourceMappingURL=BubbleReducerDispatchContext.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BubbleReducerDispatchContext.js","sourceRoot":"","sources":["../../../src/runtime/BubbleReducerDispatchContext.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAEtC,4EAA4E;AAC5E,MAAM,CAAC,MAAM,4BAA4B,GAAG,aAAa,CAAwB,CAAC,OAAY,EAAQ,EAAE;IACtG,OAAO;AACT,CAAC,CAAC,CAAC","sourcesContent":["import { createContext } from 'react';\n\n// Default NOOP dispatcher: an action that bubbles past the root is dropped.\nexport const BubbleReducerDispatchContext = createContext<(action: any) => void>((_action: any): void => {\n // NOOP\n});\n"]}
@@ -0,0 +1 @@
1
+ export type QpqBubbleReducer<S, A> = (prevState: S, action: A) => [S, boolean];
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=QpqBubbleReducer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"QpqBubbleReducer.js","sourceRoot":"","sources":["../../../src/runtime/QpqBubbleReducer.ts"],"names":[],"mappings":"","sourcesContent":["// Reduces an action into [newState, handled]. Unhandled actions bubble up the\n// component tree to the nearest QpqRuntimeEffectCatcher.\nexport type QpqBubbleReducer<S, A> = (prevState: S, action: A) => [S, boolean];\n"]}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"QpqMappedApi.js","sourceRoot":"","sources":["../../../src/runtime/QpqMappedApi.ts"],"names":[],"mappings":"AAiBA,MAAM,CAAC,MAAM,cAAc,GAAG,CAA6C,IAAW,EAAE,IAAW,EAAiB,EAAE;IACpH,OAAO,EAAE,GAAG,IAAI,EAAE,GAAG,IAAI,EAAE,CAAC;AAC9B,CAAC,CAAC","sourcesContent":["import { AskResponse, AskResponseReturnType, Story } from 'quidproquo-core';\n\n// Helper type to remap keys from \"askXyz\" to \"xyz\" (with lowercase first letter)\nexport type RemoveQpqAskPrefix<K extends string> = K extends `ask${infer R}` ? Uncapitalize<R> : never;\n\nexport type QpqApi = Record<`ask${string}`, Story<any, any>>;\n\n// Define the mapped API type.\n// We extract only string keys and then use a conditional type to infer parameters and return type.\nexport type QpqMappedApi<TApi extends QpqApi> = {\n [K in Extract<keyof TApi, string> as RemoveQpqAskPrefix<K>]: TApi[K] extends (...args: infer P) => infer R\n ? R extends AskResponse<any>\n ? (...args: P) => Promise<AskResponseReturnType<R>>\n : never\n : never;\n};\n\nexport const combineQpqApis = <TApiA extends QpqApi, TApiB extends QpqApi>(apiA: TApiA, apiB: TApiB): TApiA & TApiB => {\n return { ...apiA, ...apiB };\n};\n"]}
@@ -0,0 +1,9 @@
1
+ import { ReactNode } from 'react';
2
+ import { QpqRuntimeDefinition } from './createQpqRuntimeDefinition';
3
+ type QpqRuntimeEffectCatcherProps = {
4
+ runtime: QpqRuntimeDefinition<any, any, any>;
5
+ name?: string;
6
+ children: ReactNode;
7
+ };
8
+ export declare const QpqRuntimeEffectCatcher: import("react").MemoExoticComponent<({ children, runtime, name }: QpqRuntimeEffectCatcherProps) => import("react").JSX.Element>;
9
+ export {};
@@ -1,9 +1,9 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { memo } from 'react';
3
- import { BubbleReducerDispatchContext } from './bubbleReducer';
3
+ import { BubbleReducerDispatchContext } from './BubbleReducerDispatchContext';
4
4
  import { useQpqRuntime } from './useQpqRuntime';
5
- export const QpqRuntimeEffectCatcherComponent = ({ children, runtime, name, }) => {
6
- const [api, state, dispatch] = useQpqRuntime(runtime, undefined, name);
5
+ const QpqRuntimeEffectCatcherComponent = ({ children, runtime, name }) => {
6
+ const [, , dispatch] = useQpqRuntime(runtime, name);
7
7
  return _jsx(BubbleReducerDispatchContext.Provider, { value: dispatch, children: children });
8
8
  };
9
9
  export const QpqRuntimeEffectCatcher = memo(QpqRuntimeEffectCatcherComponent);
@@ -0,0 +1 @@
1
+ {"version":3,"file":"QpqRuntimeEffectCatcher.js","sourceRoot":"","sources":["../../../src/runtime/QpqRuntimeEffectCatcher.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAa,MAAM,OAAO,CAAC;AAExC,OAAO,EAAE,4BAA4B,EAAE,MAAM,gCAAgC,CAAC;AAE9E,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAQhD,MAAM,gCAAgC,GAAG,CAAC,EAAE,QAAQ,EAAE,OAAO,EAAE,IAAI,EAAgC,EAAE,EAAE;IACrG,MAAM,CAAC,EAAE,AAAD,EAAG,QAAQ,CAAC,GAAG,aAAa,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;IAEpD,OAAO,KAAC,4BAA4B,CAAC,QAAQ,IAAC,KAAK,EAAE,QAAQ,YAAG,QAAQ,GAAyC,CAAC;AACpH,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,uBAAuB,GAAG,IAAI,CAAC,gCAAgC,CAAC,CAAC","sourcesContent":["import { memo, ReactNode } from 'react';\n\nimport { BubbleReducerDispatchContext } from './BubbleReducerDispatchContext';\nimport { QpqRuntimeDefinition } from './createQpqRuntimeDefinition';\nimport { useQpqRuntime } from './useQpqRuntime';\n\ntype QpqRuntimeEffectCatcherProps = {\n runtime: QpqRuntimeDefinition<any, any, any>;\n name?: string;\n children: ReactNode;\n};\n\nconst QpqRuntimeEffectCatcherComponent = ({ children, runtime, name }: QpqRuntimeEffectCatcherProps) => {\n const [, , dispatch] = useQpqRuntime(runtime, name);\n\n return <BubbleReducerDispatchContext.Provider value={dispatch}>{children}</BubbleReducerDispatchContext.Provider>;\n};\n\nexport const QpqRuntimeEffectCatcher = memo(QpqRuntimeEffectCatcherComponent);\n"]}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getStateDispatchActionProcessor.js","sourceRoot":"","sources":["../../../../src/runtime/actionProcessor/getStateDispatchActionProcessor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoD,YAAY,EAAE,eAAe,EAAgC,MAAM,iBAAiB,CAAC;AAIhJ,MAAM,uBAAuB,GAC3B,CAAC,QAAuB,EAAqC,EAAE,CAC/D,KAAK,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE;IACnB,QAAQ,CAAC,MAAM,CAAC,CAAC;IAEjB,OAAO,YAAY,CAAC,SAAS,CAAC,CAAC;AACjC,CAAC,CAAC;AAEJ,MAAM,CAAC,MAAM,kCAAkC,GAC7C,CAAC,QAAuB,EAA+B,EAAE,CACzD,KAAK,EAAE,UAAU,EAAE,oBAAoB,EAAgC,EAAE,CAAC,CAAC;IACzE,CAAC,eAAe,CAAC,QAAQ,CAAC,EAAE,uBAAuB,CAAC,QAAQ,CAAC;CAC9D,CAAC,CAAC","sourcesContent":["import { ActionProcessorList, ActionProcessorListResolver, actionResult, StateActionType, StateDispatchActionProcessor } from 'quidproquo-core';\n\nimport { Dispatch } from 'react';\n\nconst getProcessStateDispatch =\n (dispatch: Dispatch<any>): StateDispatchActionProcessor<any> =>\n async ({ action }) => {\n dispatch(action);\n\n return actionResult(undefined);\n };\n\nexport const getStateDispatchActionListResolver =\n (dispatch: Dispatch<any>): ActionProcessorListResolver =>\n async (_qpqConfig, _dynamicModuleLoader): Promise<ActionProcessorList> => ({\n [StateActionType.Dispatch]: getProcessStateDispatch(dispatch),\n });\n"]}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getStateReadActionProcessor.js","sourceRoot":"","sources":["../../../../src/runtime/actionProcessor/getStateReadActionProcessor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoD,YAAY,EAAE,eAAe,EAA4B,MAAM,iBAAiB,CAAC;AAE5I,MAAM,mBAAmB,GACvB,CAAQ,eAA4B,EAAiC,EAAE,CACvE,KAAK,IAAI,EAAE;IACT,OAAO,YAAY,CAAC,eAAe,EAAE,CAAC,CAAC;AACzC,CAAC,CAAC;AAEJ,MAAM,CAAC,MAAM,8BAA8B,GACzC,CAAQ,eAA4B,EAA+B,EAAE,CACrE,KAAK,EAAE,UAAU,EAAE,oBAAoB,EAAgC,EAAE,CAAC,CAAC;IACzE,CAAC,eAAe,CAAC,IAAI,CAAC,EAAE,mBAAmB,CAAC,eAAe,CAAC;CAC7D,CAAC,CAAC","sourcesContent":["import { ActionProcessorList, ActionProcessorListResolver, actionResult, StateActionType, StateReadActionProcessor } from 'quidproquo-core';\n\nconst getProcessStateRead =\n <State>(getCurrentState: () => State): StateReadActionProcessor<any> =>\n async () => {\n return actionResult(getCurrentState());\n };\n\nexport const getStateReadActionListResolver =\n <State>(getCurrentState: () => State): ActionProcessorListResolver =>\n async (_qpqConfig, _dynamicModuleLoader): Promise<ActionProcessorList> => ({\n [StateActionType.Read]: getProcessStateRead(getCurrentState),\n });\n"]}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/runtime/actionProcessor/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,kCAAkC,EAAE,MAAM,mCAAmC,CAAC;AACvF,OAAO,EAAE,8BAA8B,EAAE,MAAM,+BAA+B,CAAC;AAE/E,MAAM,CAAC,MAAM,uBAAuB,GAClC,CAAQ,QAAuB,EAAE,eAA4B,EAA+B,EAAE,CAC9F,KAAK,EAAE,SAAoB,EAAE,mBAAwC,EAAgC,EAAE,CAAC,CAAC;IACvG,GAAG,CAAC,MAAM,kCAAkC,CAAC,QAAQ,CAAC,CAAC,SAAS,EAAE,mBAAmB,CAAC,CAAC;IACvF,GAAG,CAAC,MAAM,8BAA8B,CAAC,eAAe,CAAC,CAAC,SAAS,EAAE,mBAAmB,CAAC,CAAC;CAC3F,CAAC,CAAC","sourcesContent":["import { ActionProcessorList, ActionProcessorListResolver, DynamicModuleLoader, QPQConfig } from 'quidproquo-core';\n\nimport { Dispatch } from 'react';\n\nimport { getStateDispatchActionListResolver } from './getStateDispatchActionProcessor';\nimport { getStateReadActionListResolver } from './getStateReadActionProcessor';\n\nexport const getStateActionProcessor =\n <State>(dispatch: Dispatch<any>, getCurrentState: () => State): ActionProcessorListResolver =>\n async (qpqConfig: QPQConfig, dynamicModuleLoader: DynamicModuleLoader): Promise<ActionProcessorList> => ({\n ...(await getStateDispatchActionListResolver(dispatch)(qpqConfig, dynamicModuleLoader)),\n ...(await getStateReadActionListResolver(getCurrentState)(qpqConfig, dynamicModuleLoader)),\n });\n"]}
@@ -0,0 +1,7 @@
1
+ import { QpqRuntimeDefinition } from './createQpqRuntimeDefinition';
2
+ import { QpqApi } from './QpqMappedApi';
3
+ export type QpqRuntimeComputed<TState, TSlice> = {
4
+ definition: QpqRuntimeDefinition<TState, any, any>;
5
+ compute: (state: TState) => TSlice;
6
+ };
7
+ export declare function createQpqRuntimeComputed<TState, TAction, TApi extends QpqApi, TSlice>(definition: QpqRuntimeDefinition<TState, TAction, TApi>, compute: (state: TState) => TSlice): QpqRuntimeComputed<TState, TSlice>;
@@ -0,0 +1,4 @@
1
+ export function createQpqRuntimeComputed(definition, compute) {
2
+ return { definition, compute };
3
+ }
4
+ //# sourceMappingURL=createQpqRuntimeComputed.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createQpqRuntimeComputed.js","sourceRoot":"","sources":["../../../src/runtime/createQpqRuntimeComputed.ts"],"names":[],"mappings":"AAQA,MAAM,UAAU,wBAAwB,CACtC,UAAuD,EACvD,OAAkC;IAElC,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,CAAC;AACjC,CAAC","sourcesContent":["import { QpqRuntimeDefinition } from './createQpqRuntimeDefinition';\nimport { QpqApi } from './QpqMappedApi';\n\nexport type QpqRuntimeComputed<TState, TSlice> = {\n definition: QpqRuntimeDefinition<TState, any, any>;\n compute: (state: TState) => TSlice;\n};\n\nexport function createQpqRuntimeComputed<TState, TAction, TApi extends QpqApi, TSlice>(\n definition: QpqRuntimeDefinition<TState, TAction, TApi>,\n compute: (state: TState) => TSlice,\n): QpqRuntimeComputed<TState, TSlice> {\n return { definition, compute };\n}\n"]}
@@ -0,0 +1,16 @@
1
+ import { Story } from 'quidproquo-core';
2
+ import { ActionProcessorListResolverFactory } from './ActionProcessorListResolverFactory';
3
+ import { QpqBubbleReducer } from './QpqBubbleReducer';
4
+ import { QpqApi } from './QpqMappedApi';
5
+ export type QpqRuntimeDefinition<TState, TAction, TApi extends QpqApi> = {
6
+ uniqueName: string;
7
+ api: TApi;
8
+ initialState: TState;
9
+ reducer: QpqBubbleReducer<TState, TAction>;
10
+ onInit?: Story<any, any>;
11
+ getActionProcessors?: ActionProcessorListResolverFactory<TState>;
12
+ };
13
+ export type QpqRuntimeDefinitionOptions<TState, TAction, TApi extends QpqApi> = Omit<QpqRuntimeDefinition<TState, TAction, TApi>, 'reducer'> & {
14
+ reducer?: QpqBubbleReducer<TState, TAction>;
15
+ };
16
+ export declare function createQpqRuntimeDefinition<TState, TAction, TApi extends QpqApi>(options: QpqRuntimeDefinitionOptions<TState, TAction, TApi>): QpqRuntimeDefinition<TState, TAction, TApi>;
@@ -0,0 +1,10 @@
1
+ // Everything bubbles when no reducer is given, so a definition can exist just
2
+ // to name an area and expose an api.
3
+ const bubbleEverythingReducer = (state, _action) => [state, false];
4
+ export function createQpqRuntimeDefinition(options) {
5
+ return {
6
+ reducer: bubbleEverythingReducer,
7
+ ...options,
8
+ };
9
+ }
10
+ //# sourceMappingURL=createQpqRuntimeDefinition.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createQpqRuntimeDefinition.js","sourceRoot":"","sources":["../../../src/runtime/createQpqRuntimeDefinition.ts"],"names":[],"mappings":"AA4BA,8EAA8E;AAC9E,qCAAqC;AACrC,MAAM,uBAAuB,GAAG,CAAkB,KAAa,EAAE,OAAgB,EAAqB,EAAE,CAAC,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;AAExH,MAAM,UAAU,0BAA0B,CACxC,OAA2D;IAE3D,OAAO;QACL,OAAO,EAAE,uBAAuB;QAChC,GAAG,OAAO;KACX,CAAC;AACJ,CAAC","sourcesContent":["import { Story } from 'quidproquo-core';\n\nimport { ActionProcessorListResolverFactory } from './ActionProcessorListResolverFactory';\nimport { QpqBubbleReducer } from './QpqBubbleReducer';\nimport { QpqApi } from './QpqMappedApi';\n\nexport type QpqRuntimeDefinition<TState, TAction, TApi extends QpqApi> = {\n // Area key prefix in the qpq store. Names are the sharing contract:\n // federated modules that bind the same name share the same state, so\n // namespace it to your app ('qpq/admin/auth', 'shell/tabLayout').\n uniqueName: string;\n api: TApi;\n initialState: TState;\n reducer: QpqBubbleReducer<TState, TAction>;\n\n // Runs once per area, on the first bind (count 0 -> 1), never on later binds.\n onInit?: Story<any, any>;\n\n // Extra processors every binder of this runtime gets. Processors the onInit\n // story needs belong here, not on the hook: React fires child effects before\n // parent ones, so any binder in the tree can be the one that runs onInit.\n getActionProcessors?: ActionProcessorListResolverFactory<TState>;\n};\n\nexport type QpqRuntimeDefinitionOptions<TState, TAction, TApi extends QpqApi> = Omit<QpqRuntimeDefinition<TState, TAction, TApi>, 'reducer'> & {\n reducer?: QpqBubbleReducer<TState, TAction>;\n};\n\n// Everything bubbles when no reducer is given, so a definition can exist just\n// to name an area and expose an api.\nconst bubbleEverythingReducer = <TState, TAction>(state: TState, _action: TAction): [TState, boolean] => [state, false];\n\nexport function createQpqRuntimeDefinition<TState, TAction, TApi extends QpqApi>(\n options: QpqRuntimeDefinitionOptions<TState, TAction, TApi>,\n): QpqRuntimeDefinition<TState, TAction, TApi> {\n return {\n reducer: bubbleEverythingReducer,\n ...options,\n };\n}\n"]}
@@ -0,0 +1,3 @@
1
+ import { QpqRuntimeDefinition } from './createQpqRuntimeDefinition';
2
+ import { QpqApi } from './QpqMappedApi';
3
+ export declare const getQpqRuntimeAreaKey: <TState, TAction, TApi extends QpqApi>(definition: QpqRuntimeDefinition<TState, TAction, TApi>, instanceName?: string) => string;
@@ -0,0 +1,2 @@
1
+ export const getQpqRuntimeAreaKey = (definition, instanceName) => (instanceName ? `${definition.uniqueName}:${instanceName}` : definition.uniqueName);
2
+ //# sourceMappingURL=getQpqRuntimeAreaKey.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getQpqRuntimeAreaKey.js","sourceRoot":"","sources":["../../../src/runtime/getQpqRuntimeAreaKey.ts"],"names":[],"mappings":"AAGA,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAClC,UAAuD,EACvD,YAAqB,EACb,EAAE,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,GAAG,UAAU,CAAC,UAAU,IAAI,YAAY,EAAE,CAAC,CAAC,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC","sourcesContent":["import { QpqRuntimeDefinition } from './createQpqRuntimeDefinition';\nimport { QpqApi } from './QpqMappedApi';\n\nexport const getQpqRuntimeAreaKey = <TState, TAction, TApi extends QpqApi>(\n definition: QpqRuntimeDefinition<TState, TAction, TApi>,\n instanceName?: string,\n): string => (instanceName ? `${definition.uniqueName}:${instanceName}` : definition.uniqueName);\n"]}
@@ -0,0 +1,12 @@
1
+ export * from './actionProcessor';
2
+ export * from './ActionProcessorListResolverFactory';
3
+ export * from './BubbleReducerDispatchContext';
4
+ export * from './createQpqRuntimeComputed';
5
+ export * from './createQpqRuntimeDefinition';
6
+ export * from './getQpqRuntimeAreaKey';
7
+ export * from './QpqBubbleReducer';
8
+ export * from './QpqMappedApi';
9
+ export * from './QpqRuntimeEffectCatcher';
10
+ export * from './useBubbleReducer';
11
+ export * from './useQpqRuntime';
12
+ export * from './useQpqRuntimeComputed';
@@ -0,0 +1,13 @@
1
+ export * from './actionProcessor';
2
+ export * from './ActionProcessorListResolverFactory';
3
+ export * from './BubbleReducerDispatchContext';
4
+ export * from './createQpqRuntimeComputed';
5
+ export * from './createQpqRuntimeDefinition';
6
+ export * from './getQpqRuntimeAreaKey';
7
+ export * from './QpqBubbleReducer';
8
+ export * from './QpqMappedApi';
9
+ export * from './QpqRuntimeEffectCatcher';
10
+ export * from './useBubbleReducer';
11
+ export * from './useQpqRuntime';
12
+ export * from './useQpqRuntimeComputed';
13
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/runtime/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,sCAAsC,CAAC;AACrD,cAAc,gCAAgC,CAAC;AAC/C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,wBAAwB,CAAC;AACvC,cAAc,oBAAoB,CAAC;AACnC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,2BAA2B,CAAC;AAC1C,cAAc,oBAAoB,CAAC;AACnC,cAAc,iBAAiB,CAAC;AAChC,cAAc,yBAAyB,CAAC","sourcesContent":["export * from './actionProcessor';\nexport * from './ActionProcessorListResolverFactory';\nexport * from './BubbleReducerDispatchContext';\nexport * from './createQpqRuntimeComputed';\nexport * from './createQpqRuntimeDefinition';\nexport * from './getQpqRuntimeAreaKey';\nexport * from './QpqBubbleReducer';\nexport * from './QpqMappedApi';\nexport * from './QpqRuntimeEffectCatcher';\nexport * from './useBubbleReducer';\nexport * from './useQpqRuntime';\nexport * from './useQpqRuntimeComputed';\n"]}
@@ -1,2 +1,2 @@
1
- import { QpqBubbleReducer } from './bubbleReducer';
1
+ import { QpqBubbleReducer } from './QpqBubbleReducer';
2
2
  export declare const useBubbleReducer: <TState>(reducer: QpqBubbleReducer<TState, any>, initialState: TState | (() => TState)) => [TState, (action: unknown) => void];
@@ -1,5 +1,5 @@
1
1
  import { useCallback, useContext, useRef, useState } from 'react';
2
- import { BubbleReducerDispatchContext } from './bubbleReducer';
2
+ import { BubbleReducerDispatchContext } from './BubbleReducerDispatchContext';
3
3
  export const useBubbleReducer = (reducer, initialState) => {
4
4
  const parentDispatch = useContext(BubbleReducerDispatchContext);
5
5
  const [state, setState] = useState(initialState);
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useBubbleReducer.js","sourceRoot":"","sources":["../../../src/runtime/useBubbleReducer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAElE,OAAO,EAAE,4BAA4B,EAAE,MAAM,gCAAgC,CAAC;AAG9E,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAC9B,OAAsC,EACtC,YAAqC,EACA,EAAE;IACvC,MAAM,cAAc,GAAG,UAAU,CAAC,4BAA4B,CAAC,CAAC;IAChE,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,CAAC,YAAY,CAAC,CAAC;IACjD,MAAM,QAAQ,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;IAC/B,QAAQ,CAAC,OAAO,GAAG,KAAK,CAAC;IAEzB,MAAM,QAAQ,GAAG,WAAW,CAC1B,CAAC,MAAe,EAAE,EAAE;QAClB,MAAM,CAAC,QAAQ,EAAE,aAAa,CAAC,GAAG,OAAO,CAAC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;QAEpE,IAAI,aAAa,EAAE,CAAC;YAClB,QAAQ,CAAC,QAAQ,CAAC,CAAC;QACrB,CAAC;aAAM,CAAC;YACN,cAAc,CAAC,MAAM,CAAC,CAAC;QACzB,CAAC;IACH,CAAC,EACD,CAAC,cAAc,EAAE,OAAO,CAAC,CAC1B,CAAC;IAEF,OAAO,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;AAC3B,CAAC,CAAC","sourcesContent":["import { useCallback, useContext, useRef, useState } from 'react';\n\nimport { BubbleReducerDispatchContext } from './BubbleReducerDispatchContext';\nimport { QpqBubbleReducer } from './QpqBubbleReducer';\n\nexport const useBubbleReducer = <TState>(\n reducer: QpqBubbleReducer<TState, any>,\n initialState: TState | (() => TState),\n): [TState, (action: unknown) => void] => {\n const parentDispatch = useContext(BubbleReducerDispatchContext);\n const [state, setState] = useState(initialState);\n const stateRef = useRef(state);\n stateRef.current = state;\n\n const dispatch = useCallback(\n (action: unknown) => {\n const [newState, preventBubble] = reducer(stateRef.current, action);\n\n if (preventBubble) {\n setState(newState);\n } else {\n parentDispatch(action);\n }\n },\n [parentDispatch, reducer],\n );\n\n return [state, dispatch];\n};\n"]}
@@ -0,0 +1,11 @@
1
+ import { StoryResolver } from 'quidproquo-core';
2
+ import { ActionProcessorListResolverFactory } from './ActionProcessorListResolverFactory';
3
+ import { QpqRuntimeDefinition } from './createQpqRuntimeDefinition';
4
+ import { QpqApi } from './QpqMappedApi';
5
+ export type QpqAreaBinding<TState, TAction> = {
6
+ subscribe: (listener: () => void) => () => void;
7
+ getCurrentState: () => TState;
8
+ dispatch: (action: TAction) => void;
9
+ resolver: StoryResolver;
10
+ };
11
+ export declare function useQpqAreaBinding<TState, TAction, TApi extends QpqApi>(definition: QpqRuntimeDefinition<TState, TAction, TApi>, instanceName?: string, getActionProcessors?: ActionProcessorListResolverFactory<TState>): QpqAreaBinding<TState, TAction>;