@talkpilot/core-db 1.1.15 → 1.1.16

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 (295) hide show
  1. package/.cursor/rules/development.mdc +65 -65
  2. package/DEVELOPMENT.md +141 -98
  3. package/README.md +297 -160
  4. package/README_OLD.md +160 -0
  5. package/dist/connection.d.ts.map +1 -1
  6. package/dist/connection.js +10 -0
  7. package/dist/connection.js.map +1 -1
  8. package/dist/index.d.ts +4 -0
  9. package/dist/index.d.ts.map +1 -1
  10. package/dist/index.js +8 -1
  11. package/dist/index.js.map +1 -1
  12. package/dist/municipal/index.d.ts +1 -0
  13. package/dist/municipal/index.d.ts.map +1 -1
  14. package/dist/municipal/index.js +1 -0
  15. package/dist/municipal/index.js.map +1 -1
  16. package/dist/municipal/muniIssues/index.d.ts +7 -0
  17. package/dist/municipal/muniIssues/index.d.ts.map +1 -0
  18. package/dist/municipal/muniIssues/index.js +29 -0
  19. package/dist/municipal/muniIssues/index.js.map +1 -0
  20. package/dist/municipal/muniIssues/muniIssues.constants.d.ts +14 -0
  21. package/dist/municipal/muniIssues/muniIssues.constants.d.ts.map +1 -0
  22. package/dist/municipal/muniIssues/muniIssues.constants.js +17 -0
  23. package/dist/municipal/muniIssues/muniIssues.constants.js.map +1 -0
  24. package/dist/municipal/muniIssues/muniIssues.getters.d.ts +7 -0
  25. package/dist/municipal/muniIssues/muniIssues.getters.d.ts.map +1 -0
  26. package/dist/municipal/muniIssues/muniIssues.getters.js +24 -0
  27. package/dist/municipal/muniIssues/muniIssues.getters.js.map +1 -0
  28. package/dist/municipal/muniIssues/muniIssues.schema.d.ts +4 -0
  29. package/dist/municipal/muniIssues/muniIssues.schema.d.ts.map +1 -0
  30. package/dist/municipal/muniIssues/muniIssues.schema.js +63 -0
  31. package/dist/municipal/muniIssues/muniIssues.schema.js.map +1 -0
  32. package/dist/municipal/muniIssues/muniIssues.setters.d.ts +4 -0
  33. package/dist/municipal/muniIssues/muniIssues.setters.d.ts.map +1 -0
  34. package/dist/municipal/muniIssues/muniIssues.setters.js +22 -0
  35. package/dist/municipal/muniIssues/muniIssues.setters.js.map +1 -0
  36. package/dist/municipal/muniIssues/muniIssues.setup.d.ts +3 -0
  37. package/dist/municipal/muniIssues/muniIssues.setup.d.ts.map +1 -0
  38. package/dist/municipal/muniIssues/muniIssues.setup.js +61 -0
  39. package/dist/municipal/muniIssues/muniIssues.setup.js.map +1 -0
  40. package/dist/municipal/muniIssues/muniIssues.types.d.ts +30 -0
  41. package/dist/municipal/muniIssues/muniIssues.types.d.ts.map +1 -0
  42. package/dist/municipal/muniIssues/muniIssues.types.js +3 -0
  43. package/dist/municipal/muniIssues/muniIssues.types.js.map +1 -0
  44. package/dist/municipal/tickets/index.d.ts +2 -1
  45. package/dist/municipal/tickets/index.d.ts.map +1 -1
  46. package/dist/municipal/tickets/index.js +1 -0
  47. package/dist/municipal/tickets/index.js.map +1 -1
  48. package/dist/municipal/tickets/tickets.constants.d.ts +7 -0
  49. package/dist/municipal/tickets/tickets.constants.d.ts.map +1 -0
  50. package/dist/municipal/tickets/tickets.constants.js +10 -0
  51. package/dist/municipal/tickets/tickets.constants.js.map +1 -0
  52. package/dist/municipal/tickets/tickets.getters.d.ts +0 -11
  53. package/dist/municipal/tickets/tickets.getters.d.ts.map +1 -1
  54. package/dist/municipal/tickets/tickets.getters.js +0 -128
  55. package/dist/municipal/tickets/tickets.getters.js.map +1 -1
  56. package/dist/municipal/tickets/tickets.statistics.aggregation.d.ts +69 -0
  57. package/dist/municipal/tickets/tickets.statistics.aggregation.d.ts.map +1 -0
  58. package/dist/municipal/tickets/tickets.statistics.aggregation.js +99 -0
  59. package/dist/municipal/tickets/tickets.statistics.aggregation.js.map +1 -0
  60. package/dist/municipal/tickets/tickets.statistics.getters.d.ts +12 -0
  61. package/dist/municipal/tickets/tickets.statistics.getters.d.ts.map +1 -0
  62. package/dist/municipal/tickets/tickets.statistics.getters.js +80 -0
  63. package/dist/municipal/tickets/tickets.statistics.getters.js.map +1 -0
  64. package/dist/municipal/tickets/tickets.types.d.ts +15 -5
  65. package/dist/municipal/tickets/tickets.types.d.ts.map +1 -1
  66. package/dist/talkpilot/calls/calls.constants.d.ts +17 -0
  67. package/dist/talkpilot/calls/calls.constants.d.ts.map +1 -0
  68. package/dist/talkpilot/calls/calls.constants.js +20 -0
  69. package/dist/talkpilot/calls/calls.constants.js.map +1 -0
  70. package/dist/talkpilot/calls/calls.dashboard.d.ts +3 -0
  71. package/dist/talkpilot/calls/calls.dashboard.d.ts.map +1 -0
  72. package/dist/talkpilot/calls/calls.dashboard.js +191 -0
  73. package/dist/talkpilot/calls/calls.dashboard.js.map +1 -0
  74. package/dist/talkpilot/calls/calls.getters.d.ts +3 -2
  75. package/dist/talkpilot/calls/calls.getters.d.ts.map +1 -1
  76. package/dist/talkpilot/calls/calls.getters.js +1 -2
  77. package/dist/talkpilot/calls/calls.getters.js.map +1 -1
  78. package/dist/talkpilot/calls/calls.statistics.getters.d.ts +28 -0
  79. package/dist/talkpilot/calls/calls.statistics.getters.d.ts.map +1 -0
  80. package/dist/talkpilot/calls/calls.statistics.getters.js +453 -0
  81. package/dist/talkpilot/calls/calls.statistics.getters.js.map +1 -0
  82. package/dist/talkpilot/calls/calls.statistics.types.d.ts +43 -0
  83. package/dist/talkpilot/calls/calls.statistics.types.d.ts.map +1 -0
  84. package/dist/talkpilot/calls/calls.statistics.types.js +3 -0
  85. package/dist/talkpilot/calls/calls.statistics.types.js.map +1 -0
  86. package/dist/talkpilot/calls/calls.types.d.ts +8 -7
  87. package/dist/talkpilot/calls/calls.types.d.ts.map +1 -1
  88. package/dist/talkpilot/calls/calls.types.js +0 -3
  89. package/dist/talkpilot/calls/calls.types.js.map +1 -1
  90. package/dist/talkpilot/calls/dashboard/calls.dashboard.d.ts +4 -0
  91. package/dist/talkpilot/calls/dashboard/calls.dashboard.d.ts.map +1 -0
  92. package/dist/talkpilot/calls/dashboard/calls.dashboard.js +223 -0
  93. package/dist/talkpilot/calls/dashboard/calls.dashboard.js.map +1 -0
  94. package/dist/talkpilot/calls/dashboard/calls.dashboard.types.d.ts +45 -0
  95. package/dist/talkpilot/calls/dashboard/calls.dashboard.types.d.ts.map +1 -0
  96. package/dist/talkpilot/calls/dashboard/calls.dashboard.types.js +3 -0
  97. package/dist/talkpilot/calls/dashboard/calls.dashboard.types.js.map +1 -0
  98. package/dist/talkpilot/calls/index.d.ts +4 -0
  99. package/dist/talkpilot/calls/index.d.ts.map +1 -1
  100. package/dist/talkpilot/calls/index.js +4 -0
  101. package/dist/talkpilot/calls/index.js.map +1 -1
  102. package/dist/talkpilot/clientsConfig/clientsConfig.getters.d.ts +2 -1
  103. package/dist/talkpilot/clientsConfig/clientsConfig.getters.d.ts.map +1 -1
  104. package/dist/talkpilot/clientsConfig/clientsConfig.getters.js +14 -0
  105. package/dist/talkpilot/clientsConfig/clientsConfig.getters.js.map +1 -1
  106. package/dist/talkpilot/clientsConfig/clientsConfig.types.d.ts +20 -7
  107. package/dist/talkpilot/clientsConfig/clientsConfig.types.d.ts.map +1 -1
  108. package/dist/talkpilot/clientsConfig/clientsConfig.types.js +6 -0
  109. package/dist/talkpilot/clientsConfig/clientsConfig.types.js.map +1 -1
  110. package/dist/talkpilot/contextNotes/contextNotes.getters.d.ts +19 -0
  111. package/dist/talkpilot/contextNotes/contextNotes.getters.d.ts.map +1 -0
  112. package/dist/talkpilot/contextNotes/contextNotes.getters.js +55 -0
  113. package/dist/talkpilot/contextNotes/contextNotes.getters.js.map +1 -0
  114. package/dist/talkpilot/contextNotes/contextNotes.types.d.ts +19 -0
  115. package/dist/talkpilot/contextNotes/contextNotes.types.d.ts.map +1 -0
  116. package/dist/talkpilot/contextNotes/contextNotes.types.js +3 -0
  117. package/dist/talkpilot/contextNotes/contextNotes.types.js.map +1 -0
  118. package/dist/talkpilot/contextNotes/index.d.ts +3 -0
  119. package/dist/talkpilot/contextNotes/index.d.ts.map +1 -0
  120. package/dist/talkpilot/contextNotes/index.js +19 -0
  121. package/dist/talkpilot/contextNotes/index.js.map +1 -0
  122. package/dist/talkpilot/flows/flows.schema.d.ts +3 -0
  123. package/dist/talkpilot/flows/flows.schema.d.ts.map +1 -1
  124. package/dist/talkpilot/flows/flows.schema.js +2 -1
  125. package/dist/talkpilot/flows/flows.schema.js.map +1 -1
  126. package/dist/talkpilot/flows/flows.types.d.ts +2 -0
  127. package/dist/talkpilot/flows/flows.types.d.ts.map +1 -1
  128. package/dist/talkpilot/index.d.ts +3 -0
  129. package/dist/talkpilot/index.d.ts.map +1 -1
  130. package/dist/talkpilot/index.js +3 -0
  131. package/dist/talkpilot/index.js.map +1 -1
  132. package/dist/talkpilot/phone_numbers/index.d.ts +2 -2
  133. package/dist/talkpilot/phone_numbers/phone_numbers.getter.d.ts +1 -1
  134. package/dist/talkpilot/phone_numbers/phone_numbers.getter.d.ts.map +1 -1
  135. package/dist/talkpilot/phone_numbers/phone_numbers.getter.js +5 -3
  136. package/dist/talkpilot/phone_numbers/phone_numbers.getter.js.map +1 -1
  137. package/dist/talkpilot/phone_numbers/phone_numbers.schema.js +12 -12
  138. package/dist/talkpilot/phone_numbers/phone_numbers.types.d.ts +4 -4
  139. package/dist/talkpilot/products/index.d.ts +3 -0
  140. package/dist/talkpilot/products/index.d.ts.map +1 -0
  141. package/dist/talkpilot/products/index.js +19 -0
  142. package/dist/talkpilot/products/index.js.map +1 -0
  143. package/dist/talkpilot/products/products.getters.d.ts +6 -0
  144. package/dist/talkpilot/products/products.getters.d.ts.map +1 -0
  145. package/dist/talkpilot/products/products.getters.js +14 -0
  146. package/dist/talkpilot/products/products.getters.js.map +1 -0
  147. package/dist/talkpilot/products/products.types.d.ts +9 -0
  148. package/dist/talkpilot/products/products.types.d.ts.map +1 -0
  149. package/dist/talkpilot/products/products.types.js +3 -0
  150. package/dist/talkpilot/products/products.types.js.map +1 -0
  151. package/dist/talkpilot/results/index.d.ts +1 -1
  152. package/dist/talkpilot/results/index.d.ts.map +1 -1
  153. package/dist/talkpilot/results/index.js +3 -1
  154. package/dist/talkpilot/results/index.js.map +1 -1
  155. package/dist/talkpilot/results/results.getter.d.ts +3 -1
  156. package/dist/talkpilot/results/results.getter.d.ts.map +1 -1
  157. package/dist/talkpilot/results/results.getter.js +11 -2
  158. package/dist/talkpilot/results/results.getter.js.map +1 -1
  159. package/dist/talkpilot/retry_analyze/index.d.ts +3 -0
  160. package/dist/talkpilot/retry_analyze/index.d.ts.map +1 -0
  161. package/dist/talkpilot/retry_analyze/index.js +19 -0
  162. package/dist/talkpilot/retry_analyze/index.js.map +1 -0
  163. package/dist/talkpilot/retry_analyze/retryAnalyze.getters.d.ts +10 -0
  164. package/dist/talkpilot/retry_analyze/retryAnalyze.getters.d.ts.map +1 -0
  165. package/dist/talkpilot/retry_analyze/retryAnalyze.getters.js +60 -0
  166. package/dist/talkpilot/retry_analyze/retryAnalyze.getters.js.map +1 -0
  167. package/dist/talkpilot/retry_analyze/retryAnalyze.types.d.ts +12 -0
  168. package/dist/talkpilot/retry_analyze/retryAnalyze.types.d.ts.map +1 -0
  169. package/dist/talkpilot/retry_analyze/retryAnalyze.types.js +3 -0
  170. package/dist/talkpilot/retry_analyze/retryAnalyze.types.js.map +1 -0
  171. package/dist/test-utils/db-utils.d.ts.map +1 -1
  172. package/dist/test-utils/db-utils.js +2 -0
  173. package/dist/test-utils/db-utils.js.map +1 -1
  174. package/dist/test-utils/factories/index.d.ts +3 -0
  175. package/dist/test-utils/factories/index.d.ts.map +1 -1
  176. package/dist/test-utils/factories/index.js +3 -0
  177. package/dist/test-utils/factories/index.js.map +1 -1
  178. package/dist/test-utils/factories/municipal/muniIssues.d.ts +10 -0
  179. package/dist/test-utils/factories/municipal/muniIssues.d.ts.map +1 -0
  180. package/dist/test-utils/factories/municipal/muniIssues.js +30 -0
  181. package/dist/test-utils/factories/municipal/muniIssues.js.map +1 -0
  182. package/dist/test-utils/factories/talkpilot/contextNotes.d.ts +16 -0
  183. package/dist/test-utils/factories/talkpilot/contextNotes.d.ts.map +1 -0
  184. package/dist/test-utils/factories/talkpilot/contextNotes.js +33 -0
  185. package/dist/test-utils/factories/talkpilot/contextNotes.js.map +1 -0
  186. package/dist/test-utils/factories/websitalk/scans.d.ts +5 -0
  187. package/dist/test-utils/factories/websitalk/scans.d.ts.map +1 -0
  188. package/dist/test-utils/factories/websitalk/scans.js +25 -0
  189. package/dist/test-utils/factories/websitalk/scans.js.map +1 -0
  190. package/dist/utils/date.utils.d.ts +49 -0
  191. package/dist/utils/date.utils.d.ts.map +1 -0
  192. package/dist/utils/date.utils.js +108 -0
  193. package/dist/utils/date.utils.js.map +1 -0
  194. package/dist/utils/shared.types.d.ts +5 -0
  195. package/dist/utils/shared.types.d.ts.map +1 -0
  196. package/dist/utils/shared.types.js +3 -0
  197. package/dist/utils/shared.types.js.map +1 -0
  198. package/dist/websitalk/index.d.ts +7 -0
  199. package/dist/websitalk/index.d.ts.map +1 -0
  200. package/dist/websitalk/index.js +34 -0
  201. package/dist/websitalk/index.js.map +1 -0
  202. package/dist/websitalk/mongodb-client.d.ts +13 -0
  203. package/dist/websitalk/mongodb-client.d.ts.map +1 -0
  204. package/dist/websitalk/mongodb-client.js +56 -0
  205. package/dist/websitalk/mongodb-client.js.map +1 -0
  206. package/dist/websitalk/scans/index.d.ts +3 -0
  207. package/dist/websitalk/scans/index.d.ts.map +1 -0
  208. package/dist/websitalk/scans/index.js +19 -0
  209. package/dist/websitalk/scans/index.js.map +1 -0
  210. package/dist/websitalk/scans/scans.getters.d.ts +12 -0
  211. package/dist/websitalk/scans/scans.getters.d.ts.map +1 -0
  212. package/dist/websitalk/scans/scans.getters.js +74 -0
  213. package/dist/websitalk/scans/scans.getters.js.map +1 -0
  214. package/dist/websitalk/scans/scans.types.d.ts +45 -0
  215. package/dist/websitalk/scans/scans.types.d.ts.map +1 -0
  216. package/dist/websitalk/scans/scans.types.js +3 -0
  217. package/dist/websitalk/scans/scans.types.js.map +1 -0
  218. package/jest.config.js +20 -19
  219. package/package.json +46 -45
  220. package/src/connection.ts +12 -0
  221. package/src/index.ts +10 -0
  222. package/src/municipal/index.ts +1 -0
  223. package/src/municipal/muniIssues/__tests__/muniIssues.setters.spec.ts +94 -0
  224. package/src/municipal/muniIssues/__tests__/muniIssues.setup.spec.ts +92 -0
  225. package/src/municipal/muniIssues/index.ts +17 -0
  226. package/src/municipal/muniIssues/muniIssues.constants.ts +18 -0
  227. package/src/municipal/muniIssues/muniIssues.getters.ts +24 -0
  228. package/src/municipal/muniIssues/muniIssues.schema.ts +66 -0
  229. package/src/municipal/muniIssues/muniIssues.setters.ts +24 -0
  230. package/src/municipal/muniIssues/muniIssues.setup.ts +65 -0
  231. package/src/municipal/muniIssues/muniIssues.types.ts +37 -0
  232. package/src/municipal/tickets/__tests__/tickets.getters.spec.ts +1 -37
  233. package/src/municipal/tickets/__tests__/tickets.statistics.spec.ts +99 -0
  234. package/src/municipal/tickets/index.ts +9 -2
  235. package/src/municipal/tickets/tickets.constants.ts +8 -0
  236. package/src/municipal/tickets/tickets.getters.ts +0 -140
  237. package/src/municipal/tickets/tickets.statistics.aggregation.ts +110 -0
  238. package/src/municipal/tickets/tickets.statistics.getters.ts +132 -0
  239. package/src/municipal/tickets/tickets.types.ts +54 -43
  240. package/src/talkpilot/calls/__tests__/calls.dashboard.spec.ts +149 -0
  241. package/src/talkpilot/calls/__tests__/calls.spec.ts +48 -30
  242. package/src/talkpilot/calls/__tests__/calls.statistics.spec.ts +481 -0
  243. package/src/talkpilot/calls/calls.constants.ts +20 -0
  244. package/src/talkpilot/calls/calls.getters.ts +6 -6
  245. package/src/talkpilot/calls/calls.statistics.getters.ts +668 -0
  246. package/src/talkpilot/calls/calls.statistics.types.ts +48 -0
  247. package/src/talkpilot/calls/calls.types.ts +18 -14
  248. package/src/talkpilot/calls/dashboard/calls.dashboard.ts +292 -0
  249. package/src/talkpilot/calls/dashboard/calls.dashboard.types.ts +57 -0
  250. package/src/talkpilot/calls/index.ts +4 -0
  251. package/src/talkpilot/clientsConfig/__tests__/clientsConfig.getters.spec.ts +53 -0
  252. package/src/talkpilot/clientsConfig/__tests__/clientsConfig.spec.ts +91 -7
  253. package/src/talkpilot/clientsConfig/clientsConfig.getters.ts +34 -1
  254. package/src/talkpilot/clientsConfig/clientsConfig.types.ts +127 -92
  255. package/src/talkpilot/contextNotes/__tests__/contextNotes.getters.spec.ts +217 -0
  256. package/src/talkpilot/contextNotes/contextNotes.getters.ts +85 -0
  257. package/src/talkpilot/contextNotes/contextNotes.types.ts +20 -0
  258. package/src/talkpilot/contextNotes/index.ts +2 -0
  259. package/src/talkpilot/flows/__tests__/flows.schema.spec.ts +31 -2
  260. package/src/talkpilot/flows/flows.schema.ts +2 -1
  261. package/src/talkpilot/flows/flows.types.ts +3 -0
  262. package/src/talkpilot/index.ts +3 -0
  263. package/src/talkpilot/phone_numbers/__tests__/phone_numbers.spec.ts +40 -35
  264. package/src/talkpilot/phone_numbers/index.ts +2 -2
  265. package/src/talkpilot/phone_numbers/phone_numbers.getter.ts +10 -6
  266. package/src/talkpilot/phone_numbers/phone_numbers.schema.ts +12 -12
  267. package/src/talkpilot/phone_numbers/phone_numbers.types.ts +4 -4
  268. package/src/talkpilot/products/__tests__/products.getters.spec.ts +44 -0
  269. package/src/talkpilot/products/index.ts +2 -0
  270. package/src/talkpilot/products/products.getters.ts +12 -0
  271. package/src/talkpilot/products/products.types.ts +9 -0
  272. package/src/talkpilot/results/index.ts +2 -0
  273. package/src/talkpilot/results/results.getter.ts +14 -2
  274. package/src/talkpilot/retry_analyze/__tests__/retryAnalyze.getters.spec.ts +156 -0
  275. package/src/talkpilot/retry_analyze/index.ts +2 -0
  276. package/src/talkpilot/retry_analyze/retryAnalyze.getters.ts +84 -0
  277. package/src/talkpilot/retry_analyze/retryAnalyze.types.ts +13 -0
  278. package/src/test-utils/db-utils.ts +3 -1
  279. package/src/test-utils/factories/index.ts +3 -0
  280. package/src/test-utils/factories/municipal/muniIssues.ts +32 -0
  281. package/src/test-utils/factories/talkpilot/contextNotes.ts +40 -0
  282. package/src/test-utils/factories/websitalk/scans.ts +23 -0
  283. package/src/utils/date.utils.ts +126 -0
  284. package/src/utils/shared.types.ts +4 -0
  285. package/src/websitalk/index.ts +15 -0
  286. package/src/websitalk/mongodb-client.ts +61 -0
  287. package/src/websitalk/scans/__tests__/scans.spec.ts +218 -0
  288. package/src/websitalk/scans/index.ts +2 -0
  289. package/src/websitalk/scans/scans.getters.ts +113 -0
  290. package/src/websitalk/scans/scans.types.ts +53 -0
  291. package/tsconfig.json +23 -23
  292. package/dist/talkpilot/subscriptions/subscriptions.utils.d.ts +0 -4
  293. package/dist/talkpilot/subscriptions/subscriptions.utils.d.ts.map +0 -1
  294. package/dist/talkpilot/subscriptions/subscriptions.utils.js +0 -20
  295. package/dist/talkpilot/subscriptions/subscriptions.utils.js.map +0 -1
@@ -15,8 +15,10 @@ async function initTestDb() {
15
15
  await client.connect();
16
16
  const talkpilotDb = client.db();
17
17
  const municipalDb = client.db("municipal-data");
18
+ const websitalkDb = client.db("website-talk");
18
19
  (0, index_1.setDb)(talkpilotDb);
19
20
  (0, index_1.setMunicipalDataDb)(municipalDb);
21
+ (0, index_1.setWebsitalkDb)(websitalkDb);
20
22
  return talkpilotDb;
21
23
  }
22
24
  async function closeTestDb() {
@@ -1 +1 @@
1
- {"version":3,"file":"db-utils.js","sourceRoot":"","sources":["../../src/test-utils/db-utils.ts"],"names":[],"mappings":";;AAOA,gCAWC;AAED,kCAGC;AAvBD,iEAA0D;AAC1D,qCAA0C;AAC1C,oCAAqD;AAErD,IAAI,WAA8B,CAAC;AACnC,IAAI,MAAmB,CAAC;AAEjB,KAAK,UAAU,UAAU;IAC9B,WAAW,GAAG,MAAM,yCAAiB,CAAC,MAAM,CAAC;QAC3C,QAAQ,EAAE,EAAE,EAAE,EAAE,WAAW,EAAE;KAC9B,CAAC,CAAC;IACH,MAAM,GAAG,IAAI,qBAAW,CAAC,WAAW,CAAC,MAAM,EAAE,CAAC,CAAC;IA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C5B,OAAO,WAAW,CAAC;AACrB,CAAC;AAEM,KAAK,UAAU,WAAW;IAC/B,IAAI,MAAM;QAAE,MAAM,MAAM,CAAC,KAAK,EAAE,CAAC;IACjC,IAAI,WAAW;QAAE,MAAM,WAAW,CAAC,IAAI,EAAE,CAAC;AAC5C,CAAC"}
@@ -3,11 +3,14 @@ export * from "./talkpilot/calls";
3
3
  export * from "./talkpilot/clientAudioBuffers";
4
4
  export * from "./talkpilot/clientsConfig";
5
5
  export * from "./talkpilot/flows";
6
+ export * from "./talkpilot/contextNotes";
6
7
  export * from "./talkpilot/groups";
7
8
  export * from "./talkpilot/phone_numbers";
8
9
  export * from "./talkpilot/sessions";
9
10
  export * from "./municipal/cities";
10
11
  export * from "./municipal/departmentsSubjects";
12
+ export * from "./municipal/muniIssues";
11
13
  export * from "./municipal/streets";
12
14
  export * from "./municipal/tickets";
15
+ export * from "./websitalk/scans";
13
16
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/test-utils/factories/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,cAAc,mBAAmB,CAAC;AAClC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC;AACnC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,sBAAsB,CAAC;AACrC,cAAc,oBAAoB,CAAC;AACnC,cAAc,iCAAiC,CAAC;AAChD,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/test-utils/factories/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,cAAc,mBAAmB,CAAC;AAClC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,mBAAmB,CAAC;AAClC,cAAc,0BAA0B,CAAC;AACzC,cAAc,oBAAoB,CAAC;AACnC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,sBAAsB,CAAC;AACrC,cAAc,oBAAoB,CAAC;AACnC,cAAc,iCAAiC,CAAC;AAChD,cAAc,wBAAwB,CAAC;AACvC,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,mBAAmB,CAAC"}
@@ -19,11 +19,14 @@ __exportStar(require("./talkpilot/calls"), exports);
19
19
  __exportStar(require("./talkpilot/clientAudioBuffers"), exports);
20
20
  __exportStar(require("./talkpilot/clientsConfig"), exports);
21
21
  __exportStar(require("./talkpilot/flows"), exports);
22
+ __exportStar(require("./talkpilot/contextNotes"), exports);
22
23
  __exportStar(require("./talkpilot/groups"), exports);
23
24
  __exportStar(require("./talkpilot/phone_numbers"), exports);
24
25
  __exportStar(require("./talkpilot/sessions"), exports);
25
26
  __exportStar(require("./municipal/cities"), exports);
26
27
  __exportStar(require("./municipal/departmentsSubjects"), exports);
28
+ __exportStar(require("./municipal/muniIssues"), exports);
27
29
  __exportStar(require("./municipal/streets"), exports);
28
30
  __exportStar(require("./municipal/tickets"), exports);
31
+ __exportStar(require("./websitalk/scans"), exports);
29
32
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/test-utils/factories/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,qDAAmC;AACnC,oDAAkC;AAClC,iEAA+C;AAC/C,4DAA0C;AAC1C,oDAAkC;AAClC,qDAAmC;AACnC,4DAA0C;AAC1C,uDAAqC;AACrC,qDAAmC;AACnC,kEAAgD;AAChD,sDAAoC;AACpC,sDAAoC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/test-utils/factories/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,qDAAmC;AACnC,oDAAkC;AAClC,iEAA+C;AAC/C,4DAA0C;AAC1C,oDAAkC;AAClC,2DAAyC;AACzC,qDAAmC;AACnC,4DAA0C;AAC1C,uDAAqC;AACrC,qDAAmC;AACnC,kEAAgD;AAChD,yDAAuC;AACvC,sDAAoC;AACpC,sDAAoC;AACpC,oDAAkC"}
@@ -0,0 +1,10 @@
1
+ import { Factory } from "fishery";
2
+ import type { CreateMuniIssueInput } from "../../../municipal";
3
+ /**
4
+ * Test factory for `createMuniIssue` input.
5
+ * `jira.key` uses `sequence` so each build gets a unique key (the real key
6
+ * comes from Jira in production).
7
+ */
8
+ export declare const muniIssueInputFactory: Factory<CreateMuniIssueInput, any, CreateMuniIssueInput, import("fishery").DeepPartialObject<CreateMuniIssueInput>>;
9
+ export declare function createMuniIssueInput(overrides?: Partial<CreateMuniIssueInput>): CreateMuniIssueInput;
10
+ //# sourceMappingURL=muniIssues.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"muniIssues.d.ts","sourceRoot":"","sources":["../../../../src/test-utils/factories/municipal/muniIssues.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAElC,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAE/D;;;;GAIG;AACH,eAAO,MAAM,qBAAqB,qHAgBjC,CAAC;AAEF,wBAAgB,oBAAoB,CAClC,SAAS,CAAC,EAAE,OAAO,CAAC,oBAAoB,CAAC,GACxC,oBAAoB,CAEtB"}
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.muniIssueInputFactory = void 0;
4
+ exports.createMuniIssueInput = createMuniIssueInput;
5
+ const fishery_1 = require("fishery");
6
+ const faker_1 = require("@faker-js/faker");
7
+ /**
8
+ * Test factory for `createMuniIssue` input.
9
+ * `jira.key` uses `sequence` so each build gets a unique key (the real key
10
+ * comes from Jira in production).
11
+ */
12
+ exports.muniIssueInputFactory = fishery_1.Factory.define(({ sequence }) => ({
13
+ callSid: `CA${faker_1.faker.string.alphanumeric(10)}`,
14
+ clientId: faker_1.faker.string.uuid(),
15
+ cityName: faker_1.faker.location.city(),
16
+ issueContent: {
17
+ issuerName: faker_1.faker.person.fullName(),
18
+ issuerRole: faker_1.faker.person.jobTitle(),
19
+ issueDescription: faker_1.faker.lorem.sentence(),
20
+ desiredBehavior: faker_1.faker.lorem.sentence(),
21
+ },
22
+ jira: {
23
+ key: `CP-${sequence}`,
24
+ syncStatus: "created",
25
+ },
26
+ }));
27
+ function createMuniIssueInput(overrides) {
28
+ return exports.muniIssueInputFactory.build(overrides);
29
+ }
30
+ //# sourceMappingURL=muniIssues.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"muniIssues.js","sourceRoot":"","sources":["../../../../src/test-utils/factories/municipal/muniIssues.ts"],"names":[],"mappings":";;;AA2BA,oDAIC;AA/BD,qCAAkC;AAClC,2CAAwC;AAGxC;;;;GAIG;AACU,QAAA,qBAAqB,GAAG,iBAAO,CAAC,MAAM,CACjD,CAAC,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAC,CAAC;IACjB,OAAO,EAAE,KAAK,aAAK,CAAC,MAAM,CAAC,YAAY,CAAC,EAAE,CAAC,EAAE;IAC7C,QAAQ,EAAE,aAAK,CAAC,MAAM,CAAC,IAAI,EAAE;IAC7B,QAAQ,EAAE,aAAK,CAAC,QAAQ,CAAC,IAAI,EAAE;IAC/B,YAAY,EAAE;QACZ,UAAU,EAAE,aAAK,CAAC,MAAM,CAAC,QAAQ,EAAE;QACnC,UAAU,EAAE,aAAK,CAAC,MAAM,CAAC,QAAQ,EAAE;QACnC,gBAAgB,EAAE,aAAK,CAAC,KAAK,CAAC,QAAQ,EAAE;QACxC,eAAe,EAAE,aAAK,CAAC,KAAK,CAAC,QAAQ,EAAE;KACxC;IACD,IAAI,EAAE;QACJ,GAAG,EAAE,MAAM,QAAQ,EAAE;QACrB,UAAU,EAAE,SAAS;KACtB;CACF,CAAC,CACH,CAAC;AAEF,SAAgB,oBAAoB,CAClC,SAAyC;IAEzC,OAAO,6BAAqB,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;AAChD,CAAC"}
@@ -0,0 +1,16 @@
1
+ import { Factory } from "fishery";
2
+ import { ObjectId } from "mongodb";
3
+ import type { ContextNote, ContextNoteEntry } from "../../../talkpilot";
4
+ export declare const contextNoteEntryFactory: Factory<ContextNoteEntry, any, ContextNoteEntry, import("fishery").DeepPartialObject<ContextNoteEntry>>;
5
+ export declare const contextNoteFactory: Factory<ContextNote & {
6
+ _id: ObjectId;
7
+ }, any, ContextNote & {
8
+ _id: ObjectId;
9
+ }, import("fishery").DeepPartialObject<ContextNote & {
10
+ _id: ObjectId;
11
+ }>>;
12
+ export declare function createContextNoteEntry(overrides?: Partial<ContextNoteEntry>): ContextNoteEntry;
13
+ export declare function createContextNote(overrides?: Partial<ContextNote>): ContextNote & {
14
+ _id: ObjectId;
15
+ };
16
+ //# sourceMappingURL=contextNotes.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"contextNotes.d.ts","sourceRoot":"","sources":["../../../../src/test-utils/factories/talkpilot/contextNotes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAEnC,OAAO,KAAK,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAExE,eAAO,MAAM,uBAAuB,yGAQjC,CAAC;AAEJ,eAAO,MAAM,kBAAkB;SACR,QAAQ;;SAAR,QAAQ;;SAAR,QAAQ;GAM5B,CAAC;AAEJ,wBAAgB,sBAAsB,CACpC,SAAS,CAAC,EAAE,OAAO,CAAC,gBAAgB,CAAC,GACpC,gBAAgB,CAKlB;AAED,wBAAgB,iBAAiB,CAC/B,SAAS,CAAC,EAAE,OAAO,CAAC,WAAW,CAAC,GAC/B,WAAW,GAAG;IAAE,GAAG,EAAE,QAAQ,CAAA;CAAE,CAIjC"}
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.contextNoteFactory = exports.contextNoteEntryFactory = void 0;
4
+ exports.createContextNoteEntry = createContextNoteEntry;
5
+ exports.createContextNote = createContextNote;
6
+ const fishery_1 = require("fishery");
7
+ const mongodb_1 = require("mongodb");
8
+ const faker_1 = require("@faker-js/faker");
9
+ exports.contextNoteEntryFactory = fishery_1.Factory.define(() => ({
10
+ _id: new mongodb_1.ObjectId(),
11
+ title: faker_1.faker.lorem.words(3),
12
+ content: faker_1.faker.lorem.sentences(2),
13
+ activeFrom: new Date(),
14
+ expiresAt: null,
15
+ createdAt: new Date(),
16
+ updatedAt: new Date(),
17
+ }));
18
+ exports.contextNoteFactory = fishery_1.Factory.define(() => ({
19
+ _id: new mongodb_1.ObjectId(),
20
+ clientId: faker_1.faker.string.uuid(),
21
+ product: "Municipal",
22
+ notes: [],
23
+ }));
24
+ function createContextNoteEntry(overrides) {
25
+ return {
26
+ ...exports.contextNoteEntryFactory.build(),
27
+ ...overrides,
28
+ };
29
+ }
30
+ function createContextNote(overrides) {
31
+ return { ...exports.contextNoteFactory.build(), ...overrides };
32
+ }
33
+ //# sourceMappingURL=contextNotes.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"contextNotes.js","sourceRoot":"","sources":["../../../../src/test-utils/factories/talkpilot/contextNotes.ts"],"names":[],"mappings":";;;AAwBA,wDAOC;AAED,8CAMC;AAvCD,qCAAkC;AAClC,qCAAmC;AACnC,2CAAwC;AAG3B,QAAA,uBAAuB,GAAG,iBAAO,CAAC,MAAM,CAAmB,GAAG,EAAE,CAAC,CAAC;IAC7E,GAAG,EAAE,IAAI,kBAAQ,EAAE;IACnB,KAAK,EAAE,aAAK,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC;IAC3B,OAAO,EAAE,aAAK,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC;IACjC,UAAU,EAAE,IAAI,IAAI,EAAE;IACtB,SAAS,EAAE,IAAI;IACf,SAAS,EAAE,IAAI,IAAI,EAAE;IACrB,SAAS,EAAE,IAAI,IAAI,EAAE;CACtB,CAAC,CAAC,CAAC;AAES,QAAA,kBAAkB,GAAG,iBAAO,CAAC,MAAM,CAE9C,GAAG,EAAE,CAAC,CAAC;IACP,GAAG,EAAE,IAAI,kBAAQ,EAAE;IACnB,QAAQ,EAAE,aAAK,CAAC,MAAM,CAAC,IAAI,EAAE;IAC7B,OAAO,EAAE,WAAW;IACpB,KAAK,EAAE,EAAE;CACV,CAAC,CAAC,CAAC;AAEJ,SAAgB,sBAAsB,CACpC,SAAqC;IAErC,OAAO;QACL,GAAG,+BAAuB,CAAC,KAAK,EAAE;QAClC,GAAG,SAAS;KACO,CAAC;AACxB,CAAC;AAED,SAAgB,iBAAiB,CAC/B,SAAgC;IAEhC,OAAO,EAAE,GAAG,0BAAkB,CAAC,KAAK,EAAE,EAAE,GAAG,SAAS,EAEnD,CAAC;AACJ,CAAC"}
@@ -0,0 +1,5 @@
1
+ import { Factory } from "fishery";
2
+ import type { Scan } from "../../../websitalk";
3
+ export declare const scanFactory: Factory<Scan, any, Scan, import("fishery").DeepPartialObject<Scan>>;
4
+ export declare function createScanFixture(overrides?: Partial<Scan>): Scan;
5
+ //# sourceMappingURL=scans.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"scans.d.ts","sourceRoot":"","sources":["../../../../src/test-utils/factories/websitalk/scans.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAElC,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAE/C,eAAO,MAAM,WAAW,qEAcrB,CAAC;AAEJ,wBAAgB,iBAAiB,CAAC,SAAS,CAAC,EAAE,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAEjE"}
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.scanFactory = void 0;
4
+ exports.createScanFixture = createScanFixture;
5
+ const fishery_1 = require("fishery");
6
+ const faker_1 = require("@faker-js/faker");
7
+ exports.scanFactory = fishery_1.Factory.define(() => ({
8
+ clientId: faker_1.faker.string.uuid(),
9
+ baseUrl: faker_1.faker.internet.url(),
10
+ status: "CHECKING",
11
+ activeTasksCount: 0,
12
+ pagesScanned: 0,
13
+ pagesSkipped: 0,
14
+ skipped: [],
15
+ siteChrome: {
16
+ url: faker_1.faker.internet.url(),
17
+ sourceType: "site_chrome",
18
+ },
19
+ createdAt: new Date(),
20
+ updatedAt: new Date(),
21
+ }));
22
+ function createScanFixture(overrides) {
23
+ return exports.scanFactory.build(overrides);
24
+ }
25
+ //# sourceMappingURL=scans.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"scans.js","sourceRoot":"","sources":["../../../../src/test-utils/factories/websitalk/scans.ts"],"names":[],"mappings":";;;AAoBA,8CAEC;AAtBD,qCAAkC;AAClC,2CAAwC;AAG3B,QAAA,WAAW,GAAG,iBAAO,CAAC,MAAM,CAAO,GAAG,EAAE,CAAC,CAAC;IACrD,QAAQ,EAAE,aAAK,CAAC,MAAM,CAAC,IAAI,EAAE;IAC7B,OAAO,EAAE,aAAK,CAAC,QAAQ,CAAC,GAAG,EAAE;IAC7B,MAAM,EAAE,UAAU;IAClB,gBAAgB,EAAE,CAAC;IACnB,YAAY,EAAE,CAAC;IACf,YAAY,EAAE,CAAC;IACf,OAAO,EAAE,EAAE;IACX,UAAU,EAAE;QACV,GAAG,EAAE,aAAK,CAAC,QAAQ,CAAC,GAAG,EAAE;QACzB,UAAU,EAAE,aAAa;KAC1B;IACD,SAAS,EAAE,IAAI,IAAI,EAAE;IACrB,SAAS,EAAE,IAAI,IAAI,EAAE;CACtB,CAAC,CAAC,CAAC;AAEJ,SAAgB,iBAAiB,CAAC,SAAyB;IACzD,OAAO,mBAAW,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;AACtC,CAAC"}
@@ -0,0 +1,49 @@
1
+ /**
2
+ * Shared timezone-aware date helpers for statistics aggregations.
3
+ */
4
+ /** Milliseconds in a single day. */
5
+ export declare const DAY_MS: number;
6
+ /** Maps a short weekday name (as produced by Intl) to its index (Sun = 0). */
7
+ export declare const WEEKDAY: Record<string, number>;
8
+ /** Parses a `YYYY-MM-DD` string into `[year, month, day]` numbers. */
9
+ export declare const parseYmd: (dateStr: string) => [number, number, number];
10
+ /** Builds a zero-padded `YYYY-MM-DD` string from numeric parts. */
11
+ export declare const ymdToStr: (y: number, m: number, d: number) => string;
12
+ /** Parses a `YYYY-MM-DD` string as midnight UTC. */
13
+ export declare const toUtcDate: (dateStr: string) => Date;
14
+ /** Formats a date as a `YYYY-MM-DD` string in UTC. */
15
+ export declare const formatDate: (date: Date) => string;
16
+ /** Adds `days` to a `YYYY-MM-DD` string, returning the resulting `YYYY-MM-DD`. */
17
+ export declare const addDaysToDateStr: (dateStr: string, days: number) => string;
18
+ /** Next civil calendar day (proleptic Gregorian). Avoids DST 24h steps that can stall iteration. */
19
+ export declare const incrementYmd: (y: number, m: number, d: number) => [number, number, number];
20
+ /**
21
+ * Formats a date as the calendar day in the given timezone.
22
+ * `en-CA` yields ISO-8601 `YYYY-MM-DD`, which is lexicographically sortable
23
+ * (string compare == chronological compare) and matches MongoDB's `%Y-%m-%d`.
24
+ */
25
+ export declare const formatYmdInTz: (date: Date, timezone: string) => string;
26
+ /**
27
+ * Returns the calendar day in the given timezone as numeric parts.
28
+ * Reads parts by `type` (not string order), so `en-US` is fine here.
29
+ */
30
+ export declare const getYmdInTz: (date: Date, timezone: string) => {
31
+ y: number;
32
+ m: number;
33
+ d: number;
34
+ };
35
+ /** Weekday index (Sun = 0) of a date in the given timezone. */
36
+ export declare const getWeekdayInTz: (date: Date, timezone: string) => number;
37
+ /**
38
+ * Returns the given `YYYY-MM-DD` day at noon UTC — a stable anchor inside the
39
+ * calendar day, far from midnight so timezone/DST shifts can't cross a date boundary.
40
+ */
41
+ export declare const dateAtNoonUtc: (dateStr: string) => Date;
42
+ /**
43
+ * UTC instant at the start of the given `YYYY-MM-DD` calendar day in `timezone`.
44
+ * Binary-searches the boundary so it stays correct across DST transitions.
45
+ */
46
+ export declare const startOfCalendarDayInTz: (dateStr: string, timezone: string) => Date;
47
+ /** UTC instant at the last millisecond of the given calendar day in `timezone`. */
48
+ export declare const endOfCalendarDayInTz: (dateStr: string, timezone: string) => Date;
49
+ //# sourceMappingURL=date.utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"date.utils.d.ts","sourceRoot":"","sources":["../../src/utils/date.utils.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,oCAAoC;AACpC,eAAO,MAAM,MAAM,QAAsB,CAAC;AAE1C,8EAA8E;AAC9E,eAAO,MAAM,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAQ1C,CAAC;AAEF,sEAAsE;AACtE,eAAO,MAAM,QAAQ,GAAI,SAAS,MAAM,KAAG,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAGjE,CAAC;AAEF,mEAAmE;AACnE,eAAO,MAAM,QAAQ,GAAI,GAAG,MAAM,EAAE,GAAG,MAAM,EAAE,GAAG,MAAM,KAAG,MACS,CAAC;AAErE,oDAAoD;AACpD,eAAO,MAAM,SAAS,GAAI,SAAS,MAAM,KAAG,IACN,CAAC;AAEvC,sDAAsD;AACtD,eAAO,MAAM,UAAU,GAAI,MAAM,IAAI,KAAG,MACP,CAAC;AAElC,kFAAkF;AAClF,eAAO,MAAM,gBAAgB,GAAI,SAAS,MAAM,EAAE,MAAM,MAAM,KAAG,MACG,CAAC;AAErE,oGAAoG;AACpG,eAAO,MAAM,YAAY,GACvB,GAAG,MAAM,EACT,GAAG,MAAM,EACT,GAAG,MAAM,KACR,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAGzB,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,aAAa,GAAI,MAAM,IAAI,EAAE,UAAU,MAAM,KAAG,MACU,CAAC;AAExE;;;GAGG;AACH,eAAO,MAAM,UAAU,GAAI,MAAM,IAAI,EAAE,UAAU,MAAM;;;;CAYtD,CAAC;AAEF,+DAA+D;AAC/D,eAAO,MAAM,cAAc,GAAI,MAAM,IAAI,EAAE,UAAU,MAAM,KAAG,MAMtD,CAAC;AAET;;;GAGG;AACH,eAAO,MAAM,aAAa,GAAI,SAAS,MAAM,KAAG,IAG/C,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,sBAAsB,GACjC,SAAS,MAAM,EACf,UAAU,MAAM,KACf,IAYF,CAAC;AAEF,mFAAmF;AACnF,eAAO,MAAM,oBAAoB,GAC/B,SAAS,MAAM,EACf,UAAU,MAAM,KACf,IAMF,CAAC"}
@@ -0,0 +1,108 @@
1
+ "use strict";
2
+ /**
3
+ * Shared timezone-aware date helpers for statistics aggregations.
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.endOfCalendarDayInTz = exports.startOfCalendarDayInTz = exports.dateAtNoonUtc = exports.getWeekdayInTz = exports.getYmdInTz = exports.formatYmdInTz = exports.incrementYmd = exports.addDaysToDateStr = exports.formatDate = exports.toUtcDate = exports.ymdToStr = exports.parseYmd = exports.WEEKDAY = exports.DAY_MS = void 0;
7
+ /** Milliseconds in a single day. */
8
+ exports.DAY_MS = 24 * 60 * 60 * 1000;
9
+ /** Maps a short weekday name (as produced by Intl) to its index (Sun = 0). */
10
+ exports.WEEKDAY = {
11
+ Sun: 0,
12
+ Mon: 1,
13
+ Tue: 2,
14
+ Wed: 3,
15
+ Thu: 4,
16
+ Fri: 5,
17
+ Sat: 6,
18
+ };
19
+ /** Parses a `YYYY-MM-DD` string into `[year, month, day]` numbers. */
20
+ const parseYmd = (dateStr) => {
21
+ const [y, m, d] = dateStr.split("-").map(Number);
22
+ return [y, m, d];
23
+ };
24
+ exports.parseYmd = parseYmd;
25
+ /** Builds a zero-padded `YYYY-MM-DD` string from numeric parts. */
26
+ const ymdToStr = (y, m, d) => `${y}-${String(m).padStart(2, "0")}-${String(d).padStart(2, "0")}`;
27
+ exports.ymdToStr = ymdToStr;
28
+ /** Parses a `YYYY-MM-DD` string as midnight UTC. */
29
+ const toUtcDate = (dateStr) => new Date(`${dateStr}T00:00:00.000Z`);
30
+ exports.toUtcDate = toUtcDate;
31
+ /** Formats a date as a `YYYY-MM-DD` string in UTC. */
32
+ const formatDate = (date) => date.toISOString().slice(0, 10);
33
+ exports.formatDate = formatDate;
34
+ /** Adds `days` to a `YYYY-MM-DD` string, returning the resulting `YYYY-MM-DD`. */
35
+ const addDaysToDateStr = (dateStr, days) => (0, exports.formatDate)(new Date((0, exports.toUtcDate)(dateStr).getTime() + days * exports.DAY_MS));
36
+ exports.addDaysToDateStr = addDaysToDateStr;
37
+ /** Next civil calendar day (proleptic Gregorian). Avoids DST 24h steps that can stall iteration. */
38
+ const incrementYmd = (y, m, d) => {
39
+ const next = new Date(Date.UTC(y, m - 1, d + 1));
40
+ return [next.getUTCFullYear(), next.getUTCMonth() + 1, next.getUTCDate()];
41
+ };
42
+ exports.incrementYmd = incrementYmd;
43
+ /**
44
+ * Formats a date as the calendar day in the given timezone.
45
+ * `en-CA` yields ISO-8601 `YYYY-MM-DD`, which is lexicographically sortable
46
+ * (string compare == chronological compare) and matches MongoDB's `%Y-%m-%d`.
47
+ */
48
+ const formatYmdInTz = (date, timezone) => new Intl.DateTimeFormat("en-CA", { timeZone: timezone }).format(date);
49
+ exports.formatYmdInTz = formatYmdInTz;
50
+ /**
51
+ * Returns the calendar day in the given timezone as numeric parts.
52
+ * Reads parts by `type` (not string order), so `en-US` is fine here.
53
+ */
54
+ const getYmdInTz = (date, timezone) => {
55
+ const parts = Object.fromEntries(new Intl.DateTimeFormat("en-US", {
56
+ timeZone: timezone,
57
+ year: "numeric",
58
+ month: "numeric",
59
+ day: "numeric",
60
+ })
61
+ .formatToParts(date)
62
+ .map((p) => [p.type, Number(p.value)]));
63
+ return { y: parts.year, m: parts.month, d: parts.day };
64
+ };
65
+ exports.getYmdInTz = getYmdInTz;
66
+ /** Weekday index (Sun = 0) of a date in the given timezone. */
67
+ const getWeekdayInTz = (date, timezone) => exports.WEEKDAY[new Intl.DateTimeFormat("en-US", {
68
+ timeZone: timezone,
69
+ weekday: "short",
70
+ }).format(date)] ?? 0;
71
+ exports.getWeekdayInTz = getWeekdayInTz;
72
+ /**
73
+ * Returns the given `YYYY-MM-DD` day at noon UTC — a stable anchor inside the
74
+ * calendar day, far from midnight so timezone/DST shifts can't cross a date boundary.
75
+ */
76
+ const dateAtNoonUtc = (dateStr) => {
77
+ const [y, m, d] = (0, exports.parseYmd)(dateStr);
78
+ return new Date(Date.UTC(y, m - 1, d, 12, 0, 0));
79
+ };
80
+ exports.dateAtNoonUtc = dateAtNoonUtc;
81
+ /**
82
+ * UTC instant at the start of the given `YYYY-MM-DD` calendar day in `timezone`.
83
+ * Binary-searches the boundary so it stays correct across DST transitions.
84
+ */
85
+ const startOfCalendarDayInTz = (dateStr, timezone) => {
86
+ const anchor = (0, exports.dateAtNoonUtc)(dateStr).getTime();
87
+ let low = anchor - 2 * exports.DAY_MS;
88
+ let high = anchor + exports.DAY_MS;
89
+ while (high - low > 1 /* ms */) {
90
+ const mid = Math.floor((low + high) / 2);
91
+ if ((0, exports.formatYmdInTz)(new Date(mid), timezone) >= dateStr)
92
+ high = mid;
93
+ else
94
+ low = mid;
95
+ }
96
+ return new Date(high);
97
+ };
98
+ exports.startOfCalendarDayInTz = startOfCalendarDayInTz;
99
+ /** UTC instant at the last millisecond of the given calendar day in `timezone`. */
100
+ const endOfCalendarDayInTz = (dateStr, timezone) => {
101
+ const [y, m, d] = (0, exports.parseYmd)(dateStr);
102
+ const nextDay = new Date(Date.UTC(y, m - 1, d + 1))
103
+ .toISOString()
104
+ .slice(0, 10);
105
+ return new Date((0, exports.startOfCalendarDayInTz)(nextDay, timezone).getTime() - 1);
106
+ };
107
+ exports.endOfCalendarDayInTz = endOfCalendarDayInTz;
108
+ //# sourceMappingUR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AM,CAAC;IAE3B,OAAO,IAAI,GAAG,GAAG,GAAG,CAAC,CAAC,QAAQ,EAAE,CAAC;QAC/B,MAAM,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;QACzC,IAAI,IAAA,qBAAa,EAAC,IAAI,IAAI,CAAC,GAAG,CAAC,EAAE,QAAQ,CAAC,IAAI,OAAO;YAAE,IAAI,GAAG,GAAG,CAAC;;YAC7D,GAAG,GAAG,GAAG,CAAC;IACjB,CAAC;IAED,OAAO,IAAI,IAAI,CAAC,IAAI,CAAC,CAAC;AACxB,CAAC,CAAC;AAfW,QAAA,sBAAsB,0BAejC;AAEF,mFAAmF;AAC5E,MAAM,oBAAoB,GAAG,CAClC,OAAe,EACf,QAAgB,EACV,EAAE;IACR,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,GAAG,IAAA,gBAAQ,EAAC,OAAO,CAAC,CAAC;IACpC,MAAM,OAAO,GAAG,IAAI,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;SAChD,WAAW,EAAE;SACb,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;IAChB,OAAO,IAAI,IAAI,CAAC,IAAA,8BAAsB,EAAC,OAAO,EAAE,QAAQ,CAAC,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC,CAAC;AAC3E,CAAC,CAAC;AATW,QAAA,oBAAoB,wBAS/B"}
@@ -0,0 +1,5 @@
1
+ export interface CallLengthThresholds {
2
+ shortThreshold: number;
3
+ mediumThreshold: number;
4
+ }
5
+ //# sourceMappingURL=shared.types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shared.types.d.ts","sourceRoot":"","sources":["../../src/utils/shared.types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,oBAAoB;IACnC,cAAc,EAAE,MAAM,CAAC;IACvB,eAAe,EAAE,MAAM,CAAC;CACzB"}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=shared.types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shared.types.js","sourceRoot":"","sources":["../../src/utils/shared.types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,7 @@
1
+ import { Db, ObjectId as MongoObjectId } from "mongodb";
2
+ export * from "./scans";
3
+ export { websitalkMongodbClient } from "./mongodb-client";
4
+ export declare const setDb: (d: Db) => void;
5
+ export declare const getDb: () => Db;
6
+ export declare const ObjectId: typeof MongoObjectId;
7
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/websitalk/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,QAAQ,IAAI,aAAa,EAAE,MAAM,SAAS,CAAC;AAExD,cAAc,SAAS,CAAC;AACxB,OAAO,EAAE,sBAAsB,EAAE,MAAM,kBAAkB,CAAC;AAG1D,eAAO,MAAM,KAAK,GAAI,GAAG,EAAE,SAE1B,CAAC;AAEF,eAAO,MAAM,KAAK,QAAO,EAGxB,CAAC;AACF,eAAO,MAAM,QAAQ,sBAAgB,CAAC"}
@@ -0,0 +1,34 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ exports.ObjectId = exports.getDb = exports.setDb = exports.websitalkMongodbClient = void 0;
18
+ const mongodb_1 = require("mongodb");
19
+ __exportStar(require("./scans"), exports);
20
+ var mongodb_client_1 = require("./mongodb-client");
21
+ Object.defineProperty(exports, "websitalkMongodbClient", { enumerable: true, get: function () { return mongodb_client_1.websitalkMongodbClient; } });
22
+ let db;
23
+ const setDb = (d) => {
24
+ db = d;
25
+ };
26
+ exports.setDb = setDb;
27
+ const getDb = () => {
28
+ if (!db)
29
+ throw new Error("Website Talk DB not initialised");
30
+ return db;
31
+ };
32
+ exports.getDb = getDb;
33
+ exports.ObjectId = mongodb_1.ObjectId;
34
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/websitalk/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,qCAAwD;AAExD,0CAAwB;AACxB,mDAA0D;AAAjD,wHAAA,sBAAsB,OAAA;AAE/B,IAAI,EAAM,CAAC;AACJ,MAAM,KAAK,GAAG,CAAC,CAAK,EAAE,EAAE;IAC7B,EAAE,GAAG,CAAC,CAAC;AACT,CAAC,CAAC;AAFW,QAAA,KAAK,SAEhB;AAEK,MAAM,KAAK,GAAG,GAAO,EAAE;IAC5B,IAAI,CAAC,EAAE;QAAE,MAAM,IAAI,KAAK,CAAC,iCAAiC,CAAC,CAAC;IAC5D,OAAO,EAAE,CAAC;AACZ,CAAC,CAAC;AAHW,QAAA,KAAK,SAGhB;AACW,QAAA,QAAQ,GAAG,kBAAa,CAAC"}
@@ -0,0 +1,13 @@
1
+ import { Db } from "mongodb";
2
+ declare class WebsitalkMongoDBClient {
3
+ private client;
4
+ private db;
5
+ private readonly defaultDbName;
6
+ connect(uri?: string, dbName?: string): Promise<void>;
7
+ disconnect(): Promise<void>;
8
+ getDb(): Db;
9
+ isConnected(): boolean;
10
+ }
11
+ export declare const websitalkMongodbClient: WebsitalkMongoDBClient;
12
+ export {};
13
+ //# sourceMappingURL=mongodb-client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mongodb-client.d.ts","sourceRoot":"","sources":["../../src/websitalk/mongodb-client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,EAAE,EAAE,MAAM,SAAS,CAAC;AAI1C,cAAM,sBAAsB;IAC1B,OAAO,CAAC,MAAM,CAA4B;IAC1C,OAAO,CAAC,EAAE,CAAmB;IAC7B,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAkB;IAE1C,OAAO,CAAC,GAAG,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAuBrD,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;IAcjC,KAAK,IAAI,EAAE;IASX,WAAW,IAAI,OAAO;CAGvB;AAED,eAAO,MAAM,sBAAsB,wBAA+B,CAAC"}
@@ -0,0 +1,56 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.websitalkMongodbClient = void 0;
4
+ const mongodb_1 = require("mongodb");
5
+ const index_1 = require("./index");
6
+ const validation_1 = require("../utils/validation");
7
+ class WebsitalkMongoDBClient {
8
+ client = null;
9
+ db = null;
10
+ defaultDbName = "website-talk";
11
+ async connect(uri, dbName) {
12
+ if (this.client) {
13
+ return;
14
+ }
15
+ const mongodbUri = uri || process.env.MONGO_URI || process.env.MONGODB_URI;
16
+ (0, validation_1.validateConfig)("MONGO_URI", mongodbUri);
17
+ (0, validation_1.validateMongoUri)(mongodbUri);
18
+ try {
19
+ this.client = new mongodb_1.MongoClient(mongodbUri);
20
+ await this.client.connect();
21
+ const targetDbName = dbName || process.env.WEBSITALK_DB_NAME || this.defaultDbName;
22
+ this.db = this.client.db(targetDbName);
23
+ (0, index_1.setDb)(this.db);
24
+ console.info(`[core-db] Website Talk MongoDB connected: ${targetDbName}`);
25
+ }
26
+ catch (error) {
27
+ console.error("[core-db] Website Talk connection failed", error);
28
+ throw error;
29
+ }
30
+ }
31
+ async disconnect() {
32
+ if (this.client) {
33
+ try {
34
+ await this.client.close();
35
+ this.client = null;
36
+ this.db = null;
37
+ console.info("Website Talk MongoDB disconnected successfully");
38
+ }
39
+ catch (error) {
40
+ console.error("[core-db] Website Talk disconnection failed", error);
41
+ throw error;
42
+ }
43
+ }
44
+ }
45
+ getDb() {
46
+ if (!this.db) {
47
+ throw new Error("Website Talk database not initialized. Call connect() first.");
48
+ }
49
+ return this.db;
50
+ }
51
+ isConnected() {
52
+ return this.client !== null && this.client !== undefined;
53
+ }
54
+ }
55
+ exports.websitalkMongodbClient = new WebsitalkMongoDBClient();
56
+ //# sourceMappingURL=mongodb-client.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mongodb-client.js","sourceRoot":"","sources":["../../src/websitalk/mongodb-client.ts"],"names":[],"mappings":";;;AAAA,qCAA0C;AAC1C,mCAAgC;AAChC,oDAAuE;AAEvE,MAAM,sBAAsB;IAClB,MAAM,GAAuB,IAAI,CAAC;IAClC,EAAE,GAAc,IAAI,CAAC;IACZ,aAAa,GAAG,cAAc,CAAC;IAEhD,KAAK,CAAC,OAAO,CAAC,GAAY,EAAE,MAAe;QACzC,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC;YAChB,OAAO;QACT,CAAC;QAED,MAAM,UAAU,GAAG,GAAG,IAAI,OAAO,CAAC,GAAG,CAAC,SAAS,IAAI,OAAO,CAAC,GAAG,CAAC,WAAW,CAAC;QAC3E,IAAA,2BAAc,EAAC,WAAW,EAAE,UAAU,CAAC,CAAC;QACxC,IAAA,6BAAgB,EAAC,UAAW,CAAC,CAAC;QAE9B,IAAI,CAAC;YACH,IAAI,CAAC,MAAM,GAAG,IAAI,qBAAW,CAAC,UAAW,CAAC,CAAC;YAC3C,MAAM,IAAI,CAAC,MAAM,CAAC,OAAO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
@@ -0,0 +1,3 @@
1
+ export * from "./scans.getters";
2
+ export * from "./scans.types";
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/websitalk/scans/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAChC,cAAc,eAAe,CAAC"}
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./scans.getters"), exports);
18
+ __exportStar(require("./scans.types"), exports);
19
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/websitalk/scans/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,kDAAgC;AAChC,gDAA8B"}
@@ -0,0 +1,12 @@
1
+ import { Collection, Filter, ObjectId } from "mongodb";
2
+ import { QueryOptions } from "../../talkpilot/utils/query.utils";
3
+ import type { ActiveScanStatus, Scan, ScanDoc } from "./scans.types";
4
+ export declare const getScansCollection: () => Collection<Scan>;
5
+ export declare const getScansByClientAndDateRange: (clientId: string, startDate: Date, endDate: Date) => Promise<ScanDoc[]>;
6
+ export declare const getScanFieldsByClientAndDateRange: <K extends keyof Scan>(clientId: string, startDate: Date, endDate: Date, fields: K[]) => Promise<Pick<ScanDoc, "_id" | K>[]>;
7
+ export declare const createScanDoc: (scan: Pick<Scan, "clientId" | "baseUrl" | "notifyPhoneNumber">) => Promise<import("mongodb").InsertOneResult<Scan>>;
8
+ export declare const getActiveScanStatus: (clientId: string) => Promise<ActiveScanStatus>;
9
+ export declare const updateScanDoc: (scanId: ObjectId, updates: Partial<Omit<Scan, "clientId" | "createdAt">>) => Promise<ScanDoc | null>;
10
+ export declare const findScansByQuery: (query: Filter<Scan>, options?: QueryOptions) => Promise<ScanDoc[]>;
11
+ export declare const countScans: (query: Filter<Scan>) => Promise<number>;
12
+ //# sourceMappingURL=scans.getters.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"scans.getters.d.ts","sourceRoot":"","sources":["../../../src/websitalk/scans/scans.getters.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAEvD,OAAO,EAEL,YAAY,EACb,MAAM,mCAAmC,CAAC;AAC3C,OAAO,KAAK,EACV,gBAAgB,EAChB,IAAI,EACJ,OAAO,EAER,MAAM,eAAe,CAAC;AAEvB,eAAO,MAAM,kBAAkB,QAAO,UAAU,CAAC,IAAI,CAEpD,CAAC;AAEF,eAAO,MAAM,4BAA4B,GACvC,UAAU,MAAM,EAChB,WAAW,IAAI,EACf,SAAS,IAAI,KACZ,OAAO,CAAC,OAAO,EAAE,CAUnB,CAAC;AAEF,eAAO,MAAM,iCAAiC,GAAI,CAAC,SAAS,MAAM,IAAI,EACpE,UAAU,MAAM,EAChB,WAAW,IAAI,EACf,SAAS,IAAI,EACb,QAAQ,CAAC,EAAE,KACV,OAAO,CAAC,IAAI,CAAC,OAAO,EAAE,KAAK,GAAG,CAAC,CAAC,EAAE,CAkBpC,CAAC;AAEF,eAAO,MAAM,aAAa,GACxB,MAAM,IAAI,CAAC,IAAI,EAAE,UAAU,GAAG,SAAS,GA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