@plyaz/api 1.0.1 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (382) hide show
  1. package/README.md +632 -542
  2. package/dist/api/cache/index.d.ts +183 -0
  3. package/dist/api/cache/index.d.ts.map +1 -0
  4. package/dist/api/cache/patterns.d.ts +174 -0
  5. package/dist/api/cache/patterns.d.ts.map +1 -0
  6. package/dist/api/cache/strategies.d.ts +47 -0
  7. package/dist/api/cache/strategies.d.ts.map +1 -0
  8. package/dist/api/client/clientEventManager.d.ts +238 -0
  9. package/dist/api/client/clientEventManager.d.ts.map +1 -0
  10. package/dist/api/client/createApiClient.d.ts +5 -0
  11. package/dist/api/client/createApiClient.d.ts.map +1 -0
  12. package/dist/api/client/helpers/headers.d.ts +11 -0
  13. package/dist/api/client/helpers/headers.d.ts.map +1 -0
  14. package/dist/api/client/helpers/index.d.ts +9 -0
  15. package/dist/api/client/helpers/index.d.ts.map +1 -0
  16. package/dist/api/client/helpers/interceptors.d.ts +29 -0
  17. package/dist/api/client/helpers/interceptors.d.ts.map +1 -0
  18. package/dist/api/client/helpers/network.d.ts +21 -0
  19. package/dist/api/client/helpers/network.d.ts.map +1 -0
  20. package/dist/api/client/helpers/strategies.d.ts +30 -0
  21. package/dist/api/client/helpers/strategies.d.ts.map +1 -0
  22. package/dist/api/client/helpers/tracking.d.ts +15 -0
  23. package/dist/api/client/helpers/tracking.d.ts.map +1 -0
  24. package/dist/api/client/index.d.ts +7 -0
  25. package/dist/api/client/index.d.ts.map +1 -0
  26. package/dist/api/config/adapter.d.ts +25 -0
  27. package/dist/api/config/adapter.d.ts.map +1 -0
  28. package/dist/api/config/configBuilder.d.ts +62 -0
  29. package/dist/api/config/configBuilder.d.ts.map +1 -0
  30. package/dist/api/config/configManager.d.ts +67 -0
  31. package/dist/api/config/configManager.d.ts.map +1 -0
  32. package/dist/api/config/global.d.ts +106 -0
  33. package/dist/api/config/global.d.ts.map +1 -0
  34. package/dist/api/config/index.d.ts +11 -0
  35. package/dist/api/config/index.d.ts.map +1 -0
  36. package/dist/api/debugger/DebugReport.d.ts +71 -0
  37. package/dist/api/debugger/DebugReport.d.ts.map +1 -0
  38. package/dist/api/debugger/UnifiedDebugger.d.ts +444 -0
  39. package/dist/api/debugger/UnifiedDebugger.d.ts.map +1 -0
  40. package/dist/api/debugger/factories/conflict.d.ts +58 -0
  41. package/dist/api/debugger/factories/conflict.d.ts.map +1 -0
  42. package/dist/api/debugger/factories/eventTracking.d.ts +126 -0
  43. package/dist/api/debugger/factories/eventTracking.d.ts.map +1 -0
  44. package/dist/api/debugger/factories/history.d.ts +97 -0
  45. package/dist/api/debugger/factories/history.d.ts.map +1 -0
  46. package/dist/api/debugger/factories/index.d.ts +15 -0
  47. package/dist/api/debugger/factories/index.d.ts.map +1 -0
  48. package/dist/api/debugger/factories/issueAnalysis.d.ts +52 -0
  49. package/dist/api/debugger/factories/issueAnalysis.d.ts.map +1 -0
  50. package/dist/api/debugger/factories/performance.d.ts +53 -0
  51. package/dist/api/debugger/factories/performance.d.ts.map +1 -0
  52. package/dist/api/debugger/factories/report.d.ts +43 -0
  53. package/dist/api/debugger/factories/report.d.ts.map +1 -0
  54. package/dist/api/debugger/index.d.ts +99 -0
  55. package/dist/api/debugger/index.d.ts.map +1 -0
  56. package/dist/api/debugger/queue/DebuggerQueueManager.d.ts +61 -0
  57. package/dist/api/debugger/queue/DebuggerQueueManager.d.ts.map +1 -0
  58. package/dist/api/debugger/queue/OperationTracker.d.ts +86 -0
  59. package/dist/api/debugger/queue/OperationTracker.d.ts.map +1 -0
  60. package/dist/api/debugger/queue/index.d.ts +9 -0
  61. package/dist/api/debugger/queue/index.d.ts.map +1 -0
  62. package/dist/api/endpoints/builders.d.ts +109 -0
  63. package/dist/api/endpoints/builders.d.ts.map +1 -0
  64. package/dist/api/endpoints/campaigns.d.ts +43 -0
  65. package/dist/api/endpoints/campaigns.d.ts.map +1 -0
  66. package/dist/api/endpoints/index.d.ts +100 -0
  67. package/dist/api/endpoints/index.d.ts.map +1 -0
  68. package/dist/api/endpoints/polling.d.ts +83 -0
  69. package/dist/api/endpoints/polling.d.ts.map +1 -0
  70. package/dist/api/endpoints/utils.d.ts +128 -0
  71. package/dist/api/endpoints/utils.d.ts.map +1 -0
  72. package/dist/api/errors/ApiPackageError.d.ts +101 -0
  73. package/dist/api/errors/ApiPackageError.d.ts.map +1 -0
  74. package/dist/api/errors/definitions.d.ts +24 -0
  75. package/dist/api/errors/definitions.d.ts.map +1 -0
  76. package/dist/api/errors/error-codes.d.ts +116 -0
  77. package/dist/api/errors/error-codes.d.ts.map +1 -0
  78. package/dist/api/errors/error-events.d.ts +63 -0
  79. package/dist/api/errors/error-events.d.ts.map +1 -0
  80. package/dist/api/errors/index.d.ts +18 -0
  81. package/dist/api/errors/index.d.ts.map +1 -0
  82. package/dist/api/errors/types-constants.d.ts +64 -0
  83. package/dist/api/errors/types-constants.d.ts.map +1 -0
  84. package/dist/api/events/EventManager.d.ts +230 -0
  85. package/dist/api/events/EventManager.d.ts.map +1 -0
  86. package/dist/api/events/factories/base.d.ts +269 -0
  87. package/dist/api/events/factories/base.d.ts.map +1 -0
  88. package/dist/api/events/factories/cache.d.ts +31 -0
  89. package/dist/api/events/factories/cache.d.ts.map +1 -0
  90. package/dist/api/events/factories/client.d.ts +43 -0
  91. package/dist/api/events/factories/client.d.ts.map +1 -0
  92. package/dist/api/events/factories/config.d.ts +34 -0
  93. package/dist/api/events/factories/config.d.ts.map +1 -0
  94. package/dist/api/events/factories/debug.d.ts +74 -0
  95. package/dist/api/events/factories/debug.d.ts.map +1 -0
  96. package/dist/api/events/factories/errors.d.ts +91 -0
  97. package/dist/api/events/factories/errors.d.ts.map +1 -0
  98. package/dist/api/events/factories/headers.d.ts +54 -0
  99. package/dist/api/events/factories/headers.d.ts.map +1 -0
  100. package/dist/api/events/factories/index.d.ts +46 -0
  101. package/dist/api/events/factories/index.d.ts.map +1 -0
  102. package/dist/api/events/factories/network.d.ts +54 -0
  103. package/dist/api/events/factories/network.d.ts.map +1 -0
  104. package/dist/api/events/factories/performance.d.ts +43 -0
  105. package/dist/api/events/factories/performance.d.ts.map +1 -0
  106. package/dist/api/events/index.d.ts +34 -0
  107. package/dist/api/events/index.d.ts.map +1 -0
  108. package/dist/api/events/namespaces.d.ts +464 -0
  109. package/dist/api/events/namespaces.d.ts.map +1 -0
  110. package/dist/api/events/queue/ConfigUpdateQueueManager.d.ts +53 -0
  111. package/dist/api/events/queue/ConfigUpdateQueueManager.d.ts.map +1 -0
  112. package/dist/api/events/queue/EventQueueManager.d.ts +69 -0
  113. package/dist/api/events/queue/EventQueueManager.d.ts.map +1 -0
  114. package/dist/api/events/queue/index.d.ts +12 -0
  115. package/dist/api/events/queue/index.d.ts.map +1 -0
  116. package/dist/api/events/shared-emitter.d.ts +14 -0
  117. package/dist/api/events/shared-emitter.d.ts.map +1 -0
  118. package/dist/api/headers/cache.d.ts +17 -0
  119. package/dist/api/headers/cache.d.ts.map +1 -0
  120. package/dist/api/headers/enriched.d.ts +18 -0
  121. package/dist/api/headers/enriched.d.ts.map +1 -0
  122. package/dist/api/headers/events.d.ts +17 -0
  123. package/dist/api/headers/events.d.ts.map +1 -0
  124. package/dist/api/headers/extract.d.ts +73 -0
  125. package/dist/api/headers/extract.d.ts.map +1 -0
  126. package/dist/api/headers/headerBuilder.d.ts +308 -0
  127. package/dist/api/headers/headerBuilder.d.ts.map +1 -0
  128. package/dist/api/headers/index.d.ts +37 -0
  129. package/dist/api/headers/index.d.ts.map +1 -0
  130. package/dist/api/headers/merge.d.ts +32 -0
  131. package/dist/api/headers/merge.d.ts.map +1 -0
  132. package/dist/api/headers/presets.d.ts +24 -0
  133. package/dist/api/headers/presets.d.ts.map +1 -0
  134. package/dist/api/headers/utils.d.ts +38 -0
  135. package/dist/api/headers/utils.d.ts.map +1 -0
  136. package/dist/api/hooks/factories/createApiMutation.d.ts +57 -0
  137. package/dist/api/hooks/factories/createApiMutation.d.ts.map +1 -0
  138. package/dist/api/hooks/factories/createApiQuery.d.ts +55 -0
  139. package/dist/api/hooks/factories/createApiQuery.d.ts.map +1 -0
  140. package/dist/api/hooks/factories/defaults.d.ts +15 -0
  141. package/dist/api/hooks/factories/defaults.d.ts.map +1 -0
  142. package/dist/api/hooks/factories/index.d.ts +8 -0
  143. package/dist/api/hooks/factories/index.d.ts.map +1 -0
  144. package/dist/api/hooks/index.d.ts +11 -0
  145. package/dist/api/hooks/index.d.ts.map +1 -0
  146. package/dist/api/hooks/types.d.ts +82 -0
  147. package/dist/api/hooks/types.d.ts.map +1 -0
  148. package/dist/api/hooks/useApiConfigConflicts.d.ts +24 -0
  149. package/dist/api/hooks/useApiConfigConflicts.d.ts.map +1 -0
  150. package/dist/api/hooks/useApiDebugInfo.d.ts +24 -0
  151. package/dist/api/hooks/useApiDebugInfo.d.ts.map +1 -0
  152. package/dist/api/hooks/useApiMonitor.d.ts +25 -0
  153. package/dist/api/hooks/useApiMonitor.d.ts.map +1 -0
  154. package/dist/api/hooks/useApiNetworkQuality.d.ts +21 -0
  155. package/dist/api/hooks/useApiNetworkQuality.d.ts.map +1 -0
  156. package/dist/api/index.d.ts +26 -0
  157. package/dist/api/index.d.ts.map +1 -0
  158. package/dist/api/network/adaptive.d.ts +56 -0
  159. package/dist/api/network/adaptive.d.ts.map +1 -0
  160. package/dist/api/network/client-hints.d.ts +25 -0
  161. package/dist/api/network/client-hints.d.ts.map +1 -0
  162. package/dist/api/network/connection.d.ts +60 -0
  163. package/dist/api/network/connection.d.ts.map +1 -0
  164. package/dist/api/network/core.d.ts +26 -0
  165. package/dist/api/network/core.d.ts.map +1 -0
  166. package/dist/api/network/events.d.ts +18 -0
  167. package/dist/api/network/events.d.ts.map +1 -0
  168. package/dist/api/network/frameworks/express.d.ts +110 -0
  169. package/dist/api/network/frameworks/express.d.ts.map +1 -0
  170. package/dist/api/network/frameworks/index.d.ts +13 -0
  171. package/dist/api/network/frameworks/index.d.ts.map +1 -0
  172. package/dist/api/network/frameworks/nestjs/clientHintsInterceptor.d.ts +29 -0
  173. package/dist/api/network/frameworks/nestjs/clientHintsInterceptor.d.ts.map +1 -0
  174. package/dist/api/network/frameworks/nestjs/decorators.d.ts +48 -0
  175. package/dist/api/network/frameworks/nestjs/decorators.d.ts.map +1 -0
  176. package/dist/api/network/frameworks/nestjs/enrichedHeadersGuard.d.ts +80 -0
  177. package/dist/api/network/frameworks/nestjs/enrichedHeadersGuard.d.ts.map +1 -0
  178. package/dist/api/network/frameworks/nestjs/enrichedHeadersInterceptor.d.ts +83 -0
  179. package/dist/api/network/frameworks/nestjs/enrichedHeadersInterceptor.d.ts.map +1 -0
  180. package/dist/api/network/frameworks/nestjs/index.d.ts +13 -0
  181. package/dist/api/network/frameworks/nestjs/index.d.ts.map +1 -0
  182. package/dist/api/network/frameworks/nestjs/minimumConnectionGuard.d.ts +27 -0
  183. package/dist/api/network/frameworks/nestjs/minimumConnectionGuard.d.ts.map +1 -0
  184. package/dist/api/network/frameworks/nestjs/networkDetectionMiddleware.d.ts +31 -0
  185. package/dist/api/network/frameworks/nestjs/networkDetectionMiddleware.d.ts.map +1 -0
  186. package/dist/api/network/frameworks/nestjs/networkGuard.d.ts +33 -0
  187. package/dist/api/network/frameworks/nestjs/networkGuard.d.ts.map +1 -0
  188. package/dist/api/network/frameworks/nestjs/noDataSaverGuard.d.ts +25 -0
  189. package/dist/api/network/frameworks/nestjs/noDataSaverGuard.d.ts.map +1 -0
  190. package/dist/api/network/frameworks/nextjs.d.ts +86 -0
  191. package/dist/api/network/frameworks/nextjs.d.ts.map +1 -0
  192. package/dist/api/network/frameworks/shared.d.ts +45 -0
  193. package/dist/api/network/frameworks/shared.d.ts.map +1 -0
  194. package/dist/api/network/headers.d.ts +112 -0
  195. package/dist/api/network/headers.d.ts.map +1 -0
  196. package/dist/api/network/index.d.ts +17 -0
  197. package/dist/api/network/index.d.ts.map +1 -0
  198. package/dist/api/network/networkConfigurationManager.d.ts +225 -0
  199. package/dist/api/network/networkConfigurationManager.d.ts.map +1 -0
  200. package/dist/api/network/platform.d.ts +171 -0
  201. package/dist/api/network/platform.d.ts.map +1 -0
  202. package/dist/api/network/presets.d.ts +55 -0
  203. package/dist/api/network/presets.d.ts.map +1 -0
  204. package/dist/api/network/quality.d.ts +28 -0
  205. package/dist/api/network/quality.d.ts.map +1 -0
  206. package/dist/api/network/status.d.ts +74 -0
  207. package/dist/api/network/status.d.ts.map +1 -0
  208. package/dist/api/performance/adaptive.d.ts +35 -0
  209. package/dist/api/performance/adaptive.d.ts.map +1 -0
  210. package/dist/api/performance/index.d.ts +133 -0
  211. package/dist/api/performance/index.d.ts.map +1 -0
  212. package/dist/api/performance/patterns.d.ts +20 -0
  213. package/dist/api/performance/patterns.d.ts.map +1 -0
  214. package/dist/api/performance/performanceMonitor.d.ts +85 -0
  215. package/dist/api/performance/performanceMonitor.d.ts.map +1 -0
  216. package/dist/api/performance/presets.d.ts +18 -0
  217. package/dist/api/performance/presets.d.ts.map +1 -0
  218. package/dist/api/performance/utils.d.ts +98 -0
  219. package/dist/api/performance/utils.d.ts.map +1 -0
  220. package/dist/api/polling/index.d.ts +10 -0
  221. package/dist/api/polling/index.d.ts.map +1 -0
  222. package/dist/api/polling/strategies.d.ts +128 -0
  223. package/dist/api/polling/strategies.d.ts.map +1 -0
  224. package/dist/api/polling/utils.d.ts +133 -0
  225. package/dist/api/polling/utils.d.ts.map +1 -0
  226. package/dist/api/pubsub/index.d.ts +147 -0
  227. package/dist/api/pubsub/index.d.ts.map +1 -0
  228. package/dist/api/pubsub/react.d.ts +214 -0
  229. package/dist/api/pubsub/react.d.ts.map +1 -0
  230. package/dist/api/queue/BaseOperationTracker.d.ts +86 -0
  231. package/dist/api/queue/BaseOperationTracker.d.ts.map +1 -0
  232. package/dist/api/queue/BaseQueueManager.d.ts +54 -0
  233. package/dist/api/queue/BaseQueueManager.d.ts.map +1 -0
  234. package/dist/api/queue/BatchProcessor.d.ts +42 -0
  235. package/dist/api/queue/BatchProcessor.d.ts.map +1 -0
  236. package/dist/api/queue/EventQueueManager.d.ts +128 -0
  237. package/dist/api/queue/EventQueueManager.d.ts.map +1 -0
  238. package/dist/api/queue/PriorityQueue.d.ts +58 -0
  239. package/dist/api/queue/PriorityQueue.d.ts.map +1 -0
  240. package/dist/api/queue/QueueFactory.d.ts +57 -0
  241. package/dist/api/queue/QueueFactory.d.ts.map +1 -0
  242. package/dist/api/queue/QueueOrchestrator.d.ts +90 -0
  243. package/dist/api/queue/QueueOrchestrator.d.ts.map +1 -0
  244. package/dist/api/queue/QueueSystem.d.ts +102 -0
  245. package/dist/api/queue/QueueSystem.d.ts.map +1 -0
  246. package/dist/api/queue/index.d.ts +22 -0
  247. package/dist/api/queue/index.d.ts.map +1 -0
  248. package/dist/api/regional/constants.d.ts +76 -0
  249. package/dist/api/regional/constants.d.ts.map +1 -0
  250. package/dist/api/regional/core.d.ts +56 -0
  251. package/dist/api/regional/core.d.ts.map +1 -0
  252. package/dist/api/regional/helpers.d.ts +49 -0
  253. package/dist/api/regional/helpers.d.ts.map +1 -0
  254. package/dist/api/regional/index.d.ts +10 -0
  255. package/dist/api/regional/index.d.ts.map +1 -0
  256. package/dist/api/regional/presets.d.ts +16 -0
  257. package/dist/api/regional/presets.d.ts.map +1 -0
  258. package/dist/api/request/index.d.ts +18 -0
  259. package/dist/api/request/index.d.ts.map +1 -0
  260. package/dist/api/request/management.d.ts +46 -0
  261. package/dist/api/request/management.d.ts.map +1 -0
  262. package/dist/api/request/prepare.d.ts +34 -0
  263. package/dist/api/request/prepare.d.ts.map +1 -0
  264. package/dist/api/request/react.d.ts +98 -0
  265. package/dist/api/request/react.d.ts.map +1 -0
  266. package/dist/api/request/routing.d.ts +74 -0
  267. package/dist/api/request/routing.d.ts.map +1 -0
  268. package/dist/api/request/tracker.d.ts +76 -0
  269. package/dist/api/request/tracker.d.ts.map +1 -0
  270. package/dist/api/request/utils.d.ts +129 -0
  271. package/dist/api/request/utils.d.ts.map +1 -0
  272. package/dist/api/retry/conditions.d.ts +140 -0
  273. package/dist/api/retry/conditions.d.ts.map +1 -0
  274. package/dist/api/retry/index.d.ts +10 -0
  275. package/dist/api/retry/index.d.ts.map +1 -0
  276. package/dist/api/retry/strategies.d.ts +56 -0
  277. package/dist/api/retry/strategies.d.ts.map +1 -0
  278. package/dist/api/revalidation/index.d.ts +29 -0
  279. package/dist/api/revalidation/index.d.ts.map +1 -0
  280. package/dist/api/revalidation/presets.d.ts +71 -0
  281. package/dist/api/revalidation/presets.d.ts.map +1 -0
  282. package/dist/api/revalidation/strategies.d.ts +116 -0
  283. package/dist/api/revalidation/strategies.d.ts.map +1 -0
  284. package/dist/api/revalidation/utils.d.ts +78 -0
  285. package/dist/api/revalidation/utils.d.ts.map +1 -0
  286. package/dist/api/services/campaigns/DELETE/deleteCampaign.d.ts +30 -0
  287. package/dist/api/services/campaigns/DELETE/deleteCampaign.d.ts.map +1 -0
  288. package/dist/api/services/campaigns/DELETE/index.d.ts +7 -0
  289. package/dist/api/services/campaigns/DELETE/index.d.ts.map +1 -0
  290. package/dist/api/services/campaigns/DELETE/useDeleteCampaign.d.ts +24 -0
  291. package/dist/api/services/campaigns/DELETE/useDeleteCampaign.d.ts.map +1 -0
  292. package/dist/api/services/campaigns/GET/fetchCampaign.d.ts +36 -0
  293. package/dist/api/services/campaigns/GET/fetchCampaign.d.ts.map +1 -0
  294. package/dist/api/services/campaigns/GET/fetchCampaignParticipants.d.ts +40 -0
  295. package/dist/api/services/campaigns/GET/fetchCampaignParticipants.d.ts.map +1 -0
  296. package/dist/api/services/campaigns/GET/fetchCampaignStats.d.ts +31 -0
  297. package/dist/api/services/campaigns/GET/fetchCampaignStats.d.ts.map +1 -0
  298. package/dist/api/services/campaigns/GET/fetchCampaigns.d.ts +39 -0
  299. package/dist/api/services/campaigns/GET/fetchCampaigns.d.ts.map +1 -0
  300. package/dist/api/services/campaigns/GET/index.d.ts +13 -0
  301. package/dist/api/services/campaigns/GET/index.d.ts.map +1 -0
  302. package/dist/api/services/campaigns/GET/useCampaign.d.ts +47 -0
  303. package/dist/api/services/campaigns/GET/useCampaign.d.ts.map +1 -0
  304. package/dist/api/services/campaigns/GET/useCampaignParticipants.d.ts +43 -0
  305. package/dist/api/services/campaigns/GET/useCampaignParticipants.d.ts.map +1 -0
  306. package/dist/api/services/campaigns/GET/useCampaignStats.d.ts +33 -0
  307. package/dist/api/services/campaigns/GET/useCampaignStats.d.ts.map +1 -0
  308. package/dist/api/services/campaigns/GET/useCampaigns.d.ts +43 -0
  309. package/dist/api/services/campaigns/GET/useCampaigns.d.ts.map +1 -0
  310. package/dist/api/services/campaigns/POST/createCampaign.d.ts +37 -0
  311. package/dist/api/services/campaigns/POST/createCampaign.d.ts.map +1 -0
  312. package/dist/api/services/campaigns/POST/index.d.ts +11 -0
  313. package/dist/api/services/campaigns/POST/index.d.ts.map +1 -0
  314. package/dist/api/services/campaigns/POST/joinCampaign.d.ts +31 -0
  315. package/dist/api/services/campaigns/POST/joinCampaign.d.ts.map +1 -0
  316. package/dist/api/services/campaigns/POST/leaveCampaign.d.ts +31 -0
  317. package/dist/api/services/campaigns/POST/leaveCampaign.d.ts.map +1 -0
  318. package/dist/api/services/campaigns/POST/useCreateCampaign.d.ts +36 -0
  319. package/dist/api/services/campaigns/POST/useCreateCampaign.d.ts.map +1 -0
  320. package/dist/api/services/campaigns/POST/useJoinCampaign.d.ts +23 -0
  321. package/dist/api/services/campaigns/POST/useJoinCampaign.d.ts.map +1 -0
  322. package/dist/api/services/campaigns/POST/useLeaveCampaign.d.ts +23 -0
  323. package/dist/api/services/campaigns/POST/useLeaveCampaign.d.ts.map +1 -0
  324. package/dist/api/services/campaigns/PUT/index.d.ts +7 -0
  325. package/dist/api/services/campaigns/PUT/index.d.ts.map +1 -0
  326. package/dist/api/services/campaigns/PUT/updateCampaign.d.ts +37 -0
  327. package/dist/api/services/campaigns/PUT/updateCampaign.d.ts.map +1 -0
  328. package/dist/api/services/campaigns/PUT/useUpdateCampaign.d.ts +38 -0
  329. package/dist/api/services/campaigns/PUT/useUpdateCampaign.d.ts.map +1 -0
  330. package/dist/api/services/campaigns/index.d.ts +9 -0
  331. package/dist/api/services/campaigns/index.d.ts.map +1 -0
  332. package/dist/api/services/clients.d.ts +58 -0
  333. package/dist/api/services/clients.d.ts.map +1 -0
  334. package/dist/api/services/index.d.ts +8 -0
  335. package/dist/api/services/index.d.ts.map +1 -0
  336. package/dist/api/services/types.d.ts +65 -0
  337. package/dist/api/services/types.d.ts.map +1 -0
  338. package/dist/api/strategies/index.d.ts +8 -0
  339. package/dist/api/strategies/index.d.ts.map +1 -0
  340. package/dist/api/strategies/tracked.d.ts +15 -0
  341. package/dist/api/strategies/tracked.d.ts.map +1 -0
  342. package/dist/api/strategies/unified.d.ts +87 -0
  343. package/dist/api/strategies/unified.d.ts.map +1 -0
  344. package/dist/api/utils/async-control.d.ts +96 -0
  345. package/dist/api/utils/async-control.d.ts.map +1 -0
  346. package/dist/api/utils/colors.d.ts +88 -0
  347. package/dist/api/utils/colors.d.ts.map +1 -0
  348. package/dist/api/utils/environment.d.ts +595 -0
  349. package/dist/api/utils/environment.d.ts.map +1 -0
  350. package/dist/api/utils/generation/correlation-id.d.ts +206 -0
  351. package/dist/api/utils/generation/correlation-id.d.ts.map +1 -0
  352. package/dist/api/utils/generation/id-generator.d.ts +133 -0
  353. package/dist/api/utils/generation/id-generator.d.ts.map +1 -0
  354. package/dist/api/utils/generation/request-id.d.ts +106 -0
  355. package/dist/api/utils/generation/request-id.d.ts.map +1 -0
  356. package/dist/api/utils/index.d.ts +19 -0
  357. package/dist/api/utils/index.d.ts.map +1 -0
  358. package/dist/api/utils/interval-manager.d.ts +94 -0
  359. package/dist/api/utils/interval-manager.d.ts.map +1 -0
  360. package/dist/api/utils/json.d.ts +98 -0
  361. package/dist/api/utils/json.d.ts.map +1 -0
  362. package/dist/api/utils/math.d.ts +168 -0
  363. package/dist/api/utils/math.d.ts.map +1 -0
  364. package/dist/api/utils/object-merge.d.ts +34 -0
  365. package/dist/api/utils/object-merge.d.ts.map +1 -0
  366. package/dist/api/utils/object.d.ts +101 -0
  367. package/dist/api/utils/object.d.ts.map +1 -0
  368. package/dist/api/utils/string.d.ts +41 -0
  369. package/dist/api/utils/string.d.ts.map +1 -0
  370. package/dist/api/utils/time.d.ts +233 -0
  371. package/dist/api/utils/time.d.ts.map +1 -0
  372. package/dist/api/utils/type-guards.d.ts +59 -0
  373. package/dist/api/utils/type-guards.d.ts.map +1 -0
  374. package/dist/api/utils/validation.d.ts +21 -0
  375. package/dist/api/utils/validation.d.ts.map +1 -0
  376. package/dist/index.cjs +25594 -3
  377. package/dist/index.cjs.map +1 -1
  378. package/dist/index.d.ts +5 -1
  379. package/dist/index.d.ts.map +1 -1
  380. package/dist/index.mjs +25068 -3
  381. package/dist/index.mjs.map +1 -1
  382. package/package.json +18 -7
@@ -0,0 +1,128 @@
1
+ /**
2
+ * Polling Strategy Presets
3
+ * Pre-configured polling strategies for common use cases
4
+ */
5
+ import type { PollingConfig } from '@plyaz/types/api';
6
+ import type { FetchResponse } from 'fetchff';
7
+ /**
8
+ * Polling strategy names for type-safe access
9
+ */
10
+ export type PollingStrategyName = 'jobStatus' | 'healthCheck' | 'liveData' | 'notifications' | 'longProcess' | 'resourceWait' | 'dataSync';
11
+ /**
12
+ * Pre-configured polling strategies for common use cases
13
+ * These work with any response type - the actual types come from your endpoint definitions
14
+ */
15
+ export declare const pollingStrategies: {
16
+ /**
17
+ * Job Status Monitoring
18
+ * Use Case: Checking job completion, task progress, async operations
19
+ * Pattern: Frequent checks with timeout and completion detection
20
+ * Expected fields: data.status (completed/failed/cancelled), data.progress
21
+ */
22
+ readonly jobStatus: {
23
+ interval: number;
24
+ delay: number;
25
+ maxAttempts: number;
26
+ shouldStop: <T>(response: FetchResponse<T>, attempt: number) => boolean;
27
+ };
28
+ /**
29
+ * Health Monitoring
30
+ * Use Case: Server health checks, service availability monitoring
31
+ * Pattern: Regular intervals, continuous monitoring
32
+ */
33
+ readonly healthCheck: {
34
+ interval: number;
35
+ delay: number;
36
+ maxAttempts: number;
37
+ shouldStop: () => false;
38
+ };
39
+ /**
40
+ * Live Data Feed
41
+ * Use Case: Real-time dashboards, stock prices, metrics
42
+ * Pattern: Rapid updates with smart stopping
43
+ * Expected fields: data.noUpdates
44
+ */
45
+ readonly liveData: {
46
+ interval: number;
47
+ delay: number;
48
+ maxAttempts: number;
49
+ shouldStop: <T>(response: FetchResponse<T>) => boolean;
50
+ };
51
+ /**
52
+ * Notification Check
53
+ * Use Case: New messages, alerts, updates
54
+ * Pattern: Moderate frequency with backoff
55
+ */
56
+ readonly notifications: {
57
+ interval: number;
58
+ delay: number;
59
+ maxAttempts: number;
60
+ shouldStop: <T>(_response: FetchResponse<T>, attempt: number) => boolean;
61
+ };
62
+ /**
63
+ * Long-Running Process
64
+ * Use Case: File uploads, data processing, migrations
65
+ * Pattern: Adaptive intervals based on expected duration
66
+ * Expected fields: data.progress, data.status
67
+ */
68
+ readonly longProcess: {
69
+ interval: number;
70
+ delay: number;
71
+ maxAttempts: number;
72
+ shouldStop: <T>(response: FetchResponse<T>, attempt: number) => boolean;
73
+ };
74
+ /**
75
+ * Resource Availability
76
+ * Use Case: Waiting for resource to become available
77
+ * Pattern: Exponential backoff-like behavior
78
+ * Expected fields: data.available
79
+ */
80
+ readonly resourceWait: {
81
+ interval: number;
82
+ delay: number;
83
+ maxAttempts: number;
84
+ shouldStop: <T>(response: FetchResponse<T>, attempt: number) => boolean;
85
+ };
86
+ /**
87
+ * Data Sync
88
+ * Use Case: Syncing with external systems, data reconciliation
89
+ * Pattern: Periodic checks with conflict detection
90
+ * Expected fields: data.syncComplete, data.hasConflicts
91
+ */
92
+ readonly dataSync: {
93
+ interval: number;
94
+ delay: number;
95
+ maxAttempts: number;
96
+ shouldStop: <T>(response: FetchResponse<T>, attempt: number) => boolean;
97
+ };
98
+ };
99
+ /**
100
+ * Create custom polling strategy with defaults
101
+ *
102
+ * @param options - Partial polling configuration
103
+ * @returns Complete polling configuration with defaults
104
+ *
105
+ * @example
106
+ * ```typescript
107
+ * const customPolling = createPollingStrategy({
108
+ * interval: 3000,
109
+ * maxAttempts: 10
110
+ * });
111
+ * ```
112
+ */
113
+ export declare function createPollingStrategy<T = unknown>(options: Partial<PollingConfig<T>>): PollingConfig<T>;
114
+ /**
115
+ * Apply polling strategy by name or config
116
+ *
117
+ * @param strategy - Strategy name or config object
118
+ * @returns Polling configuration
119
+ *
120
+ * @example
121
+ * ```typescript
122
+ * const config = applyPollingStrategy('jobStatus');
123
+ * // or
124
+ * const config = applyPollingStrategy({ interval: 2000 });
125
+ * ```
126
+ */
127
+ export declare function applyPollingStrategy<T = unknown>(strategy: PollingStrategyName | PollingConfig<T>): PollingConfig<T>;
128
+ //# sourceMappingURL=strategies.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"strategies.d.ts","sourceRoot":"","sources":["../../../src/api/polling/strategies.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACtD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAuB7C;;GAEG;AACH,MAAM,MAAM,mBAAmB,GAC3B,WAAW,GACX,aAAa,GACb,UAAU,GACV,eAAe,GACf,aAAa,GACb,cAAc,GACd,UAAU,CAAC;AAEf;;;GAGG;AACH,eAAO,MAAM,iBAAiB;IAC5B;;;;;OAKG;;;;;qBAKY,CAAC,YAAY,aAAa,CAAC,CAAC,CAAC,WAAW,MAAM;;IAU7D;;;;OAIG;;;;;;;IAQH;;;;;OAKG;;;;;qBAKY,CAAC,YAAY,aAAa,CAAC,CAAC,CAAC;;IAM5C;;;;OAIG;;;;;qBAKY,CAAC,aAAa,aAAa,CAAC,CAAC,CAAC,WAAW,MAAM;;IAQ9D;;;;;OAKG;;;;;qBAKY,CAAC,YAAY,aAAa,CAAC,CAAC,CAAC,WAAW,MAAM;;IAW7D;;;;;OAKG;;;;;qBAKY,CAAC,YAAY,aAAa,CAAC,CAAC,CAAC,WAAW,MAAM;;IAM7D;;;;;OAKG;;;;;qBAKY,CAAC,YAAY,aAAa,CAAC,CAAC,CAAC,WAAW,MAAM;;CASrD,CAAC;AAEX;;;;;;;;;;;;;GAaG;AACH,wBAAgB,qBAAqB,CAAC,CAAC,GAAG,OAAO,EAC/C,OAAO,EAAE,OAAO,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,GACjC,aAAa,CAAC,CAAC,CAAC,CAQlB;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,oBAAoB,CAAC,CAAC,GAAG,OAAO,EAC9C,QAAQ,EAAE,mBAAmB,GAAG,aAAa,CAAC,CAAC,CAAC,GAC/C,aAAa,CAAC,CAAC,CAAC,CAKlB"}
@@ -0,0 +1,133 @@
1
+ import type { PollingConfig, ProgressivePollingOptions, ConditionalPollingOptions } from '@plyaz/types/api';
2
+ /**
3
+ * Check if polling is active based on configuration
4
+ *
5
+ * @param config - Polling configuration to check
6
+ * @returns True if polling is enabled
7
+ *
8
+ * @example
9
+ * ```typescript
10
+ * if (isPollingActive(config)) {
11
+ * console.log('Polling is enabled');
12
+ * }
13
+ * ```
14
+ */
15
+ export declare function isPollingActive<T>(config: PollingConfig<T>): boolean;
16
+ /**
17
+ * Calculate total polling duration based on configuration
18
+ *
19
+ * @param config - Polling configuration
20
+ * @returns Total duration in milliseconds, or null if infinite
21
+ *
22
+ * @example
23
+ * ```typescript
24
+ * const duration = calculatePollingDuration({
25
+ * interval: 2000,
26
+ * delay: 500,
27
+ * maxAttempts: 10
28
+ * });
29
+ * // Returns: 25000 (20s intervals + 5s delays)
30
+ * ```
31
+ */
32
+ export declare function calculatePollingDuration<T>(config: PollingConfig<T>): number | null;
33
+ /**
34
+ * Create SSR-safe polling configuration
35
+ * Disables polling on server-side rendering
36
+ *
37
+ * @param config - Original polling configuration
38
+ * @returns SSR-safe configuration
39
+ *
40
+ * @example
41
+ * ```typescript
42
+ * const safeConfig = getSSRSafePollingConfig({
43
+ * interval: 5000,
44
+ * maxAttempts: 10
45
+ * });
46
+ * // On server: { interval: 0, maxAttempts: 1 }
47
+ * // On client: unchanged
48
+ * ```
49
+ */
50
+ export declare function getSSRSafePollingConfig<T>(config: PollingConfig<T>): PollingConfig<T>;
51
+ /**
52
+ * Create progressive polling with increasing intervals
53
+ *
54
+ * @param options - Progressive polling options
55
+ * @returns Polling configuration with progressive intervals
56
+ *
57
+ * @example
58
+ * ```typescript
59
+ * const config = createProgressivePolling<MyResponse>({
60
+ * baseInterval: 1000,
61
+ * maxInterval: 30000,
62
+ * multiplier: 1.5
63
+ * });
64
+ * // Intervals: 1s, 1.5s, 2.25s, ... up to 30s
65
+ * ```
66
+ */
67
+ export declare function createProgressivePolling<T = unknown>(options?: ProgressivePollingOptions): PollingConfig<T>;
68
+ /**
69
+ * Create condition-based polling configuration
70
+ *
71
+ * @param options - Conditional polling options
72
+ * @returns Polling configuration with condition checking
73
+ *
74
+ * @example
75
+ * ```typescript
76
+ * const config = createConditionalPolling<MyResponse>({
77
+ * successCondition: (response) => response?.data?.ready === true,
78
+ * errorCondition: (response) => response?.data?.failed === true,
79
+ * timeoutMs: 60000
80
+ * });
81
+ * ```
82
+ */
83
+ export declare function createConditionalPolling<T = unknown>(options: ConditionalPollingOptions<T>): PollingConfig<T>;
84
+ /**
85
+ * Create visibility-aware polling configuration
86
+ * Stops polling when document is hidden (browser tab inactive)
87
+ *
88
+ * @param baseConfig - Base polling configuration
89
+ * @returns Polling configuration with visibility checking
90
+ *
91
+ * @example
92
+ * ```typescript
93
+ * const config = createVisibilityAwarePolling<MyResponse>({
94
+ * interval: 5000,
95
+ * maxAttempts: 100
96
+ * });
97
+ * // Stops polling when tab is hidden
98
+ * ```
99
+ */
100
+ export declare function createVisibilityAwarePolling<T>(baseConfig: PollingConfig<T>): PollingConfig<T>;
101
+ /**
102
+ * Merge polling configurations with priority
103
+ * Later configs override earlier ones
104
+ *
105
+ * @param configs - Polling configurations to merge
106
+ * @returns Merged polling configuration
107
+ *
108
+ * @example
109
+ * ```typescript
110
+ * const merged = mergePollingConfigs(
111
+ * { interval: 1000 },
112
+ * { maxAttempts: 10 },
113
+ * { delay: 500 }
114
+ * );
115
+ * // Result: { interval: 1000, maxAttempts: 10, delay: 500 }
116
+ * ```
117
+ */
118
+ export declare function mergePollingConfigs<T>(...configs: Array<PollingConfig<T> | undefined>): PollingConfig<T>;
119
+ /**
120
+ * Validate polling configuration
121
+ *
122
+ * @param config - Polling configuration to validate
123
+ * @returns True if configuration is valid
124
+ *
125
+ * @example
126
+ * ```typescript
127
+ * if (isValidPollingConfig(config)) {
128
+ * // Use config safely
129
+ * }
130
+ * ```
131
+ */
132
+ export declare function isValidPollingConfig<T = unknown>(config: unknown): config is PollingConfig<T>;
133
+ //# sourceMappingURL=utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/api/polling/utils.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EACV,aAAa,EACb,yBAAyB,EACzB,yBAAyB,EAC1B,MAAM,kBAAkB,CAAC;AAO1B;;;;;;;;;;;;GAYG;AACH,wBAAgB,eAAe,CAAC,CAAC,EAAE,MAAM,EAAE,aAAa,CAAC,CAAC,CAAC,GAAG,OAAO,CAEpE;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,wBAAwB,CAAC,CAAC,EAAE,MAAM,EAAE,aAAa,CAAC,CAAC,CAAC,GAAG,MAAM,GAAG,IAAI,CAQnF;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,uBAAuB,CAAC,CAAC,EAAE,MAAM,EAAE,aAAa,CAAC,CAAC,CAAC,GAAG,aAAa,CAAC,CAAC,CAAC,CAUrF;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,wBAAwB,CAAC,CAAC,GAAG,OAAO,EAClD,OAAO,GAAE,yBAA8B,GACtC,aAAa,CAAC,CAAC,CAAC,CAqBlB;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,wBAAwB,CAAC,CAAC,GAAG,OAAO,EAClD,OAAO,EAAE,yBAAyB,CAAC,CAAC,CAAC,GACpC,aAAa,CAAC,CAAC,CAAC,CA4DlB;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,4BAA4B,CAAC,CAAC,EAAE,UAAU,EAAE,aAAa,CAAC,CAAC,CAAC,GAAG,aAAa,CAAC,CAAC,CAAC,CAmB9F;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,mBAAmB,CAAC,CAAC,EACnC,GAAG,OAAO,EAAE,KAAK,CAAC,aAAa,CAAC,CAAC,CAAC,GAAG,SAAS,CAAC,GAC9C,aAAa,CAAC,CAAC,CAAC,CAqBlB;AA+BD;;;;;;;;;;;;GAYG;AACH,wBAAgB,oBAAoB,CAAC,CAAC,GAAG,OAAO,EAAE,MAAM,EAAE,OAAO,GAAG,MAAM,IAAI,aAAa,CAAC,CAAC,CAAC,CAa7F"}
@@ -0,0 +1,147 @@
1
+ /**
2
+ * Pub/Sub System - Lightweight wrapper for fetchff's subscribe functionality
3
+ *
4
+ * @module pubsub
5
+ */
6
+ import { subscribe as fetchffSubscribe, mutate, revalidate, type FetchResponse } from 'fetchff';
7
+ import type { DefaultResponse, EventEmitter, SubscriptionCallback } from '@plyaz/types/api';
8
+ import { PUB_SUB_EVENT } from '@plyaz/types/api';
9
+ export type { EventEmitter, SubscriptionCallback, DefaultResponse, PubSubEvent, Serializable, } from '@plyaz/types/api';
10
+ export { PUB_SUB_EVENT };
11
+ /**
12
+ * Subscribe to cache updates for a specific key or pattern
13
+ * Direct export from fetchff for vendor abstraction
14
+ *
15
+ * @param key - Cache key or URL pattern to subscribe to
16
+ * @param callback - Function called when cache updates
17
+ * @returns Unsubscribe function
18
+ *
19
+ * @example
20
+ * ```typescript
21
+ * const unsubscribe = subscribe('/api/users', (response) => {
22
+ * console.log('Cache updated:', response.data);
23
+ * });
24
+ *
25
+ * // Cleanup when done
26
+ * unsubscribe();
27
+ * ```
28
+ */
29
+ export declare const subscribe: typeof fetchffSubscribe;
30
+ /**
31
+ * Trigger cache update and notify subscribers
32
+ * Direct export from fetchff
33
+ *
34
+ * @param key - Cache key to update
35
+ * @param data - New data or updater function
36
+ * @param options - Optional configuration
37
+ *
38
+ * @example
39
+ * ```typescript
40
+ * // Update cache and notify subscribers
41
+ * mutate('/api/user', newUserData);
42
+ *
43
+ * // Optimistic update with rollback
44
+ * mutate('/api/user', updatedData, {
45
+ * optimistic: true,
46
+ * rollbackOnError: true
47
+ * });
48
+ * ```
49
+ */
50
+ export { mutate };
51
+ /**
52
+ * Revalidate cache and notify subscribers
53
+ * Direct export from fetchff
54
+ *
55
+ * @param key - Cache key(s) to revalidate
56
+ * @returns Promise that resolves when revalidation completes
57
+ *
58
+ * @example
59
+ * ```typescript
60
+ * // Revalidate specific endpoint
61
+ * await revalidate('/api/user');
62
+ *
63
+ * // Revalidate multiple endpoints
64
+ * await revalidate(['/api/user', '/api/posts']);
65
+ * ```
66
+ */
67
+ export { revalidate };
68
+ /**
69
+ * Create a typed subscription for better type safety
70
+ *
71
+ * @param key - Cache key to subscribe to
72
+ * @param callback - Typed callback function
73
+ * @returns Unsubscribe function
74
+ *
75
+ * @example
76
+ * ```typescript
77
+ * interface User {
78
+ * id: string;
79
+ * name: string;
80
+ * }
81
+ *
82
+ * const unsubscribe = createTypedSubscription<User>(
83
+ * '/api/user',
84
+ * (response) => {
85
+ * if (response.data) {
86
+ * console.log(response.data.name); // TypeScript knows this is a User
87
+ * }
88
+ * }
89
+ * );
90
+ * ```
91
+ */
92
+ export declare function createTypedSubscription<T = DefaultResponse>(key: string, callback: SubscriptionCallback<T>): () => void;
93
+ /**
94
+ * Subscribe to multiple cache keys with a single handler
95
+ *
96
+ * @param keys - Array of cache keys to subscribe to
97
+ * @param callback - Function called when any cache updates
98
+ * @returns Function to unsubscribe from all
99
+ *
100
+ * @example
101
+ * ```typescript
102
+ * const unsubscribe = subscribeMultiple(
103
+ * ['/api/users', '/api/posts', '/api/comments'],
104
+ * (key, response) => {
105
+ * console.log(`${key} updated:`, response.data);
106
+ * }
107
+ * );
108
+ * ```
109
+ */
110
+ export declare function subscribeMultiple<T = DefaultResponse>(keys: string[], callback: (key: string, response: FetchResponse<T>) => void): () => void;
111
+ /**
112
+ * Subscribe with automatic cleanup after timeout
113
+ *
114
+ * @param key - Cache key to subscribe to
115
+ * @param callback - Subscription callback
116
+ * @param timeout - Timeout in milliseconds
117
+ * @returns Unsubscribe function
118
+ *
119
+ * @example
120
+ * ```typescript
121
+ * // Subscribe for 30 seconds only
122
+ * const unsubscribe = subscribeWithTimeout(
123
+ * '/api/live-data',
124
+ * (response) => console.log('Update:', response),
125
+ * 30000
126
+ * );
127
+ * ```
128
+ */
129
+ export declare function subscribeWithTimeout<T = DefaultResponse>(key: string, callback: SubscriptionCallback<T>, timeout: number): () => void;
130
+ /**
131
+ * Subscribe once - automatically unsubscribes after first update
132
+ *
133
+ * @param key - Cache key to subscribe to
134
+ * @param callback - Subscription callback
135
+ * @returns Unsubscribe function
136
+ *
137
+ * @example
138
+ * ```typescript
139
+ * subscribeOnce('/api/user', (response) => {
140
+ * console.log('User updated once:', response.data);
141
+ * // Automatically unsubscribed after this
142
+ * });
143
+ * ```
144
+ */
145
+ export declare function subscribeOnce<T = DefaultResponse>(key: string, callback: SubscriptionCallback<T>): () => void;
146
+ export declare function createEventEmitter<T = DefaultResponse>(): EventEmitter<T>;
147
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/api/pubsub/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,SAAS,IAAI,gBAAgB,EAAE,MAAM,EAAE,UAAU,EAAE,KAAK,aAAa,EAAE,MAAM,SAAS,CAAC;AAEhG,OAAO,KAAK,EACV,eAAe,EACf,YAAY,EAGZ,oBAAoB,EAErB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAKjD,YAAY,EACV,YAAY,EACZ,oBAAoB,EACpB,eAAe,EACf,WAAW,EACX,YAAY,GACb,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,aAAa,EAAE,CAAC;AAYzB;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,SAAS,yBAAmB,CAAC;AAE1C;;;;;;;;;;;;;;;;;;;GAmBG;AACH,OAAO,EAAE,MAAM,EAAE,CAAC;AAElB;;;;;;;;;;;;;;;GAeG;AACH,OAAO,EAAE,UAAU,EAAE,CAAC;AAEtB;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,uBAAuB,CAAC,CAAC,GAAG,eAAe,EACzD,GAAG,EAAE,MAAM,EACX,QAAQ,EAAE,oBAAoB,CAAC,CAAC,CAAC,GAChC,MAAM,IAAI,CAEZ;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,iBAAiB,CAAC,CAAC,GAAG,eAAe,EACnD,IAAI,EAAE,MAAM,EAAE,EACd,QAAQ,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,QAAQ,EAAE,aAAa,CAAC,CAAC,CAAC,KAAK,IAAI,GAC1D,MAAM,IAAI,CAQZ;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,oBAAoB,CAAC,CAAC,GAAG,eAAe,EACtD,GAAG,EAAE,MAAM,EACX,QAAQ,EAAE,oBAAoB,CAAC,CAAC,CAAC,EACjC,OAAO,EAAE,MAAM,GACd,MAAM,IAAI,CAWZ;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,aAAa,CAAC,CAAC,GAAG,eAAe,EAC/C,GAAG,EAAE,MAAM,EACX,QAAQ,EAAE,oBAAoB,CAAC,CAAC,CAAC,GAChC,MAAM,IAAI,CAWZ;AA+PD,wBAAgB,kBAAkB,CAAC,CAAC,GAAG,eAAe,KAAK,YAAY,CAAC,CAAC,CAAC,CAqHzE"}
@@ -0,0 +1,214 @@
1
+ /**
2
+ * React hooks for Pub/Sub system
3
+ *
4
+ * @module pubsub/react
5
+ */
6
+ import type { FetchResponse, ResponseError } from 'fetchff';
7
+ import type { SubscriptionCallback, DefaultResponse } from './index';
8
+ /**
9
+ * Union type for API errors - can be ResponseError from fetchff or standard Error
10
+ */
11
+ type ApiError = ResponseError | Error;
12
+ /**
13
+ * Hook to subscribe to cache updates
14
+ * Handles cleanup automatically
15
+ *
16
+ * @param key - Cache key to subscribe to
17
+ * @param callback - Function called on cache updates
18
+ * @param enabled - Enable/disable subscription
19
+ *
20
+ * @example
21
+ * ```typescript
22
+ * function LiveData() {
23
+ * const [data, setData] = useState(null);
24
+ *
25
+ * useSubscription('/api/live-data', (response) => {
26
+ * if (response.data) {
27
+ * setData(response.data);
28
+ * }
29
+ * });
30
+ *
31
+ * return <Display data={data} />;
32
+ * }
33
+ * ```
34
+ */
35
+ export declare function useSubscription<T = DefaultResponse>(key: string | null, callback: SubscriptionCallback<T>, enabled?: boolean): void;
36
+ /**
37
+ * Subscribe to multiple cache keys at once
38
+ * Useful for dashboards or components that need multiple data sources
39
+ *
40
+ * @param keys - Array of cache keys to subscribe to
41
+ * @param callback - Function called on any cache update
42
+ * @param enabled - Enable/disable all subscriptions
43
+ *
44
+ * @example
45
+ * ```typescript
46
+ * function Dashboard() {
47
+ * const [metrics, setMetrics] = useState({});
48
+ *
49
+ * useMultipleSubscriptions(
50
+ * ['/api/metrics', '/api/alerts', '/api/status'],
51
+ * (key, response) => {
52
+ * const dataKey = key.split('/').pop();
53
+ * setMetrics(prev => ({
54
+ * ...prev,
55
+ * [dataKey]: response.data
56
+ * }));
57
+ * }
58
+ * );
59
+ *
60
+ * return <MetricsDisplay data={metrics} />;
61
+ * }
62
+ * ```
63
+ */
64
+ export declare function useMultipleSubscriptions<T = DefaultResponse>(keys: string[], callback: (key: string, response: FetchResponse<T>) => void, enabled?: boolean): void;
65
+ /**
66
+ * Hook for optimistic updates with subscription
67
+ * Provides mutate function and subscribes to updates
68
+ *
69
+ * @param key - Cache key
70
+ * @param initialData - Initial data value
71
+ *
72
+ * @example
73
+ * ```typescript
74
+ * function EditableUser({ userId }) {
75
+ * const { data, mutate, isValidating } = useOptimisticUpdate(
76
+ * `/api/user/${userId}`,
77
+ * null
78
+ * );
79
+ *
80
+ * const updateName = async (newName) => {
81
+ * // Optimistic update
82
+ * mutate({ ...data, name: newName });
83
+ *
84
+ * // Send to server
85
+ * await api.updateUser(userId, { name: newName });
86
+ * };
87
+ *
88
+ * return (
89
+ * <input
90
+ * value={data?.name || ''}
91
+ * onChange={(e) => updateName(e.target.value)}
92
+ * disabled={isValidating}
93
+ * />
94
+ * );
95
+ * }
96
+ * ```
97
+ */
98
+ export declare function useOptimisticUpdate<T = DefaultResponse>(key: string, initialData?: T): {
99
+ data: T | undefined;
100
+ mutate: (data: T | ((current: T | undefined) => T)) => void;
101
+ isValidating: boolean;
102
+ error: ApiError | undefined;
103
+ };
104
+ /**
105
+ * Hook for real-time data with automatic refresh
106
+ *
107
+ * @param key - Cache key
108
+ * @param refreshInterval - Refresh interval in milliseconds
109
+ * @param enabled - Enable/disable real-time updates
110
+ *
111
+ * @example
112
+ * ```typescript
113
+ * function LiveMetrics() {
114
+ * const { data, isLoading, error } = useRealTimeData(
115
+ * '/api/metrics/live',
116
+ * 5000 // Refresh every 5 seconds
117
+ * );
118
+ *
119
+ * if (isLoading) return <Spinner />;
120
+ * if (error) return <Error error={error} />;
121
+ *
122
+ * return <MetricsChart data={data} />;
123
+ * }
124
+ * ```
125
+ */
126
+ export declare function useRealTimeData<T = DefaultResponse>(key: string, refreshInterval?: number, enabled?: boolean): {
127
+ data: T | undefined;
128
+ isLoading: boolean;
129
+ error: ApiError | undefined;
130
+ refresh: () => void;
131
+ };
132
+ /**
133
+ * Hook for subscription with debounced callback
134
+ * Useful for reducing update frequency
135
+ *
136
+ * @param key - Cache key
137
+ * @param callback - Debounced callback
138
+ * @param delay - Debounce delay in milliseconds
139
+ *
140
+ * @example
141
+ * ```typescript
142
+ * function SearchResults() {
143
+ * const [results, setResults] = useState([]);
144
+ *
145
+ * // Only update UI after 300ms of no changes
146
+ * useDebouncedSubscription(
147
+ * '/api/search/results',
148
+ * (response) => {
149
+ * setResults(response.data || []);
150
+ * },
151
+ * 300
152
+ * );
153
+ *
154
+ * return <ResultsList results={results} />;
155
+ * }
156
+ * ```
157
+ */
158
+ export declare function useDebouncedSubscription<T = DefaultResponse>(key: string | null, callback: SubscriptionCallback<T>, delay?: number): void;
159
+ /**
160
+ * Hook for conditional subscription based on a condition
161
+ *
162
+ * @param key - Cache key
163
+ * @param callback - Subscription callback
164
+ * @param condition - Condition function or boolean
165
+ *
166
+ * @example
167
+ * ```typescript
168
+ * function ConditionalData({ shouldFetch }) {
169
+ * const [data, setData] = useState(null);
170
+ *
171
+ * useConditionalSubscription(
172
+ * '/api/conditional-data',
173
+ * (response) => setData(response.data),
174
+ * shouldFetch // Only subscribe when true
175
+ * );
176
+ *
177
+ * return data ? <DataView data={data} /> : <Empty />;
178
+ * }
179
+ * ```
180
+ */
181
+ export declare function useConditionalSubscription<T = DefaultResponse>(key: string | null, callback: SubscriptionCallback<T>, condition?: boolean | (() => boolean)): void;
182
+ /**
183
+ * Hook to track subscription state
184
+ *
185
+ * @param key - Cache key
186
+ * @returns Subscription state
187
+ *
188
+ * @example
189
+ * ```typescript
190
+ * function DataComponent() {
191
+ * const { data, error, isValidating, isSubscribed } = useSubscriptionState(
192
+ * '/api/data'
193
+ * );
194
+ *
195
+ * return (
196
+ * <div>
197
+ * {isSubscribed && <Badge>Live</Badge>}
198
+ * {isValidating && <Spinner />}
199
+ * {error && <Error error={error} />}
200
+ * {data && <DataView data={data} />}
201
+ * </div>
202
+ * );
203
+ * }
204
+ * ```
205
+ */
206
+ export declare function useSubscriptionState<T = DefaultResponse>(key: string | null): {
207
+ data: T | undefined;
208
+ error: ApiError | undefined;
209
+ isValidating: boolean;
210
+ isLoading: boolean;
211
+ isSubscribed: boolean;
212
+ };
213
+ export {};
214
+ //# sourceMappingURL=react.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"react.d.ts","sourceRoot":"","sources":["../../../src/api/pubsub/react.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,OAAO,KAAK,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAC5D,OAAO,KAAK,EAAE,oBAAoB,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAErE;;GAEG;AACH,KAAK,QAAQ,GAAG,aAAa,GAAG,KAAK,CAAC;AAEtC;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,eAAe,CAAC,CAAC,GAAG,eAAe,EACjD,GAAG,EAAE,MAAM,GAAG,IAAI,EAClB,QAAQ,EAAE,oBAAoB,CAAC,CAAC,CAAC,EACjC,OAAO,UAAO,GACb,IAAI,CAaN;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,wBAAgB,wBAAwB,CAAC,CAAC,GAAG,eAAe,EAC1D,IAAI,EAAE,MAAM,EAAE,EACd,QAAQ,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,QAAQ,EAAE,aAAa,CAAC,CAAC,CAAC,KAAK,IAAI,EAC3D,OAAO,UAAO,GACb,IAAI,CAeN;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,wBAAgB,mBAAmB,CAAC,CAAC,GAAG,eAAe,EACrD,GAAG,EAAE,MAAM,EACX,WAAW,CAAC,EAAE,CAAC,GACd;IACD,IAAI,EAAE,CAAC,GAAG,SAAS,CAAC;IACpB,MAAM,EAAE,CAAC,IAAI,EAAE,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,CAAC,GAAG,SAAS,KAAK,CAAC,CAAC,KAAK,IAAI,CAAC;IAC5D,YAAY,EAAE,OAAO,CAAC;IACtB,KAAK,EAAE,QAAQ,GAAG,SAAS,CAAC;CAC7B,CAuCA;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,eAAe,CAAC,CAAC,GAAG,eAAe,EACjD,GAAG,EAAE,MAAM,EACX,eAAe,CAAC,EAAE,MAAM,EACxB,OAAO,UAAO,GACb;IACD,IAAI,EAAE,CAAC,GAAG,SAAS,CAAC;IACpB,SAAS,EAAE,OAAO,CAAC;IACnB,KAAK,EAAE,QAAQ,GAAG,SAAS,CAAC;IAC5B,OAAO,EAAE,MAAM,IAAI,CAAC;CACrB,CA4CA;AAED;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAgB,wBAAwB,CAAC,CAAC,GAAG,eAAe,EAC1D,GAAG,EAAE,MAAM,GAAG,IAAI,EAClB,QAAQ,EAAE,oBAAoB,CAAC,CAAC,CAAC,EACjC,KAAK,SAAM,GACV,IAAI,CAsBN;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,0BAA0B,CAAC,CAAC,GAAG,eAAe,EAC5D,GAAG,EAAE,MAAM,GAAG,IAAI,EAClB,QAAQ,EAAE,oBAAoB,CAAC,CAAC,CAAC,EACjC,SAAS,GAAE,OAAO,GAAG,CAAC,MAAM,OAAO,CAAQ,GAC1C,IAAI,CAGN;AAED;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,oBAAoB,CAAC,CAAC,GAAG,eAAe,EACtD,GAAG,EAAE,MAAM,GAAG,IAAI,GACjB;IACD,IAAI,EAAE,CAAC,GAAG,SAAS,CAAC;IACpB,KAAK,EAAE,QAAQ,GAAG,SAAS,CAAC;IAC5B,YAAY,EAAE,OAAO,CAAC;IACtB,SAAS,EAAE,OAAO,CAAC;IACnB,YAAY,EAAE,OAAO,CAAC;CACvB,CA2CA"}