@talkpilot/core-db 1.1.8 → 1.1.9

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 (331) hide show
  1. package/README.md +7 -0
  2. package/dist/connection.d.ts +1 -1
  3. package/dist/connection.d.ts.map +1 -1
  4. package/dist/connection.js +21 -24
  5. package/dist/connection.js.map +1 -1
  6. package/dist/index.d.ts +9 -9
  7. package/dist/index.d.ts.map +1 -1
  8. package/dist/index.js.map +1 -1
  9. package/dist/municipal/cities/cities.getters.d.ts +2 -2
  10. package/dist/municipal/cities/cities.getters.d.ts.map +1 -1
  11. package/dist/municipal/cities/cities.getters.js +8 -4
  12. package/dist/municipal/cities/cities.getters.js.map +1 -1
  13. package/dist/municipal/cities/cities.types.d.ts +1 -1
  14. package/dist/municipal/cities/index.d.ts +2 -2
  15. package/dist/municipal/departmentsSubjects/departmentsSubjects.getters.d.ts +3 -3
  16. package/dist/municipal/departmentsSubjects/departmentsSubjects.getters.d.ts.map +1 -1
  17. package/dist/municipal/departmentsSubjects/departmentsSubjects.getters.js +30 -22
  18. package/dist/municipal/departmentsSubjects/departmentsSubjects.getters.js.map +1 -1
  19. package/dist/municipal/departmentsSubjects/departmentsSubjects.types.d.ts +4 -4
  20. package/dist/municipal/departmentsSubjects/departmentsSubjects.types.d.ts.map +1 -1
  21. package/dist/municipal/departmentsSubjects/index.d.ts +2 -2
  22. package/dist/municipal/index.d.ts +8 -8
  23. package/dist/municipal/index.d.ts.map +1 -1
  24. package/dist/municipal/index.js +1 -1
  25. package/dist/municipal/mongodb-client.d.ts +1 -1
  26. package/dist/municipal/mongodb-client.d.ts.map +1 -1
  27. package/dist/municipal/mongodb-client.js +7 -7
  28. package/dist/municipal/mongodb-client.js.map +1 -1
  29. package/dist/municipal/streets/index.d.ts +2 -2
  30. package/dist/municipal/streets/streets.getters.d.ts +3 -3
  31. package/dist/municipal/streets/streets.getters.d.ts.map +1 -1
  32. package/dist/municipal/streets/streets.getters.js +19 -9
  33. package/dist/municipal/streets/streets.getters.js.map +1 -1
  34. package/dist/municipal/streets/streets.types.d.ts +1 -1
  35. package/dist/municipal/systemInstructions/index.d.ts +3 -3
  36. package/dist/municipal/systemInstructions/index.d.ts.map +1 -1
  37. package/dist/municipal/systemInstructions/instructions.getters.d.ts +3 -3
  38. package/dist/municipal/systemInstructions/instructions.getters.d.ts.map +1 -1
  39. package/dist/municipal/systemInstructions/instructions.getters.js +10 -4
  40. package/dist/municipal/systemInstructions/instructions.getters.js.map +1 -1
  41. package/dist/municipal/systemInstructions/instructions.setters.d.ts +2 -2
  42. package/dist/municipal/systemInstructions/instructions.setters.d.ts.map +1 -1
  43. package/dist/municipal/systemInstructions/instructions.setters.js +13 -8
  44. package/dist/municipal/systemInstructions/instructions.setters.js.map +1 -1
  45. package/dist/municipal/systemInstructions/instructions.types.d.ts +3 -3
  46. package/dist/municipal/systemInstructions/instructions.types.d.ts.map +1 -1
  47. package/dist/municipal/systemInstructions/instructions.types.js +6 -6
  48. package/dist/municipal/tickets/index.d.ts +2 -2
  49. package/dist/municipal/tickets/tickets.getters.d.ts +3 -3
  50. package/dist/municipal/tickets/tickets.getters.d.ts.map +1 -1
  51. package/dist/municipal/tickets/tickets.getters.js +50 -29
  52. package/dist/municipal/tickets/tickets.getters.js.map +1 -1
  53. package/dist/municipal/tickets/tickets.types.d.ts +1 -1
  54. package/dist/municipal/tickets/tickets.types.d.ts.map +1 -1
  55. package/dist/municipal/utils/types.d.ts +1 -1
  56. package/dist/municipal/utils/types.d.ts.map +1 -1
  57. package/dist/talkpilot/agents/agents.getters.d.ts +1 -1
  58. package/dist/talkpilot/agents/agents.getters.js +2 -2
  59. package/dist/talkpilot/agents/agents.types.d.ts +2 -2
  60. package/dist/talkpilot/agents/index.d.ts +2 -2
  61. package/dist/talkpilot/backgroundToolResults/backgroundToolResults.getters.d.ts +2 -2
  62. package/dist/talkpilot/backgroundToolResults/backgroundToolResults.getters.d.ts.map +1 -1
  63. package/dist/talkpilot/backgroundToolResults/backgroundToolResults.getters.js +1 -1
  64. package/dist/talkpilot/backgroundToolResults/backgroundToolResults.getters.js.map +1 -1
  65. package/dist/talkpilot/backgroundToolResults/backgroundToolResults.types.d.ts +2 -2
  66. package/dist/talkpilot/backgroundToolResults/index.d.ts +2 -2
  67. package/dist/talkpilot/calls/calls.getters.d.ts +3 -3
  68. package/dist/talkpilot/calls/calls.getters.d.ts.map +1 -1
  69. package/dist/talkpilot/calls/calls.getters.js +19 -15
  70. package/dist/talkpilot/calls/calls.getters.js.map +1 -1
  71. package/dist/talkpilot/calls/calls.types.d.ts +3 -3
  72. package/dist/talkpilot/calls/calls.types.d.ts.map +1 -1
  73. package/dist/talkpilot/calls/calls.types.js +2 -2
  74. package/dist/talkpilot/calls/index.d.ts +2 -2
  75. package/dist/talkpilot/clientAudioBuffers/clientAudioBuffer.getters.d.ts +2 -2
  76. package/dist/talkpilot/clientAudioBuffers/clientAudioBuffer.getters.d.ts.map +1 -1
  77. package/dist/talkpilot/clientAudioBuffers/clientAudioBuffer.getters.js +2 -2
  78. package/dist/talkpilot/clientAudioBuffers/clientAudioBuffer.getters.js.map +1 -1
  79. package/dist/talkpilot/clientAudioBuffers/clientsAudioBuffers.types.d.ts +2 -2
  80. package/dist/talkpilot/clientAudioBuffers/index.d.ts +2 -2
  81. package/dist/talkpilot/clients/clients.getters.d.ts +2 -2
  82. package/dist/talkpilot/clients/clients.getters.d.ts.map +1 -1
  83. package/dist/talkpilot/clients/clients.getters.js +5 -2
  84. package/dist/talkpilot/clients/clients.getters.js.map +1 -1
  85. package/dist/talkpilot/clients/clients.types.d.ts +1 -1
  86. package/dist/talkpilot/clients/index.d.ts +2 -2
  87. package/dist/talkpilot/clientsConfig/clientsConfig.getters.d.ts +2 -2
  88. package/dist/talkpilot/clientsConfig/clientsConfig.getters.d.ts.map +1 -1
  89. package/dist/talkpilot/clientsConfig/clientsConfig.getters.js +1 -1
  90. package/dist/talkpilot/clientsConfig/clientsConfig.getters.js.map +1 -1
  91. package/dist/talkpilot/clientsConfig/clientsConfig.types.d.ts +3 -3
  92. package/dist/talkpilot/clientsConfig/clientsConfig.types.d.ts.map +1 -1
  93. package/dist/talkpilot/clientsConfig/index.d.ts +2 -2
  94. package/dist/talkpilot/flows/flows.getter.d.ts +2 -2
  95. package/dist/talkpilot/flows/flows.getter.d.ts.map +1 -1
  96. package/dist/talkpilot/flows/flows.getter.js +1 -1
  97. package/dist/talkpilot/flows/flows.getter.js.map +1 -1
  98. package/dist/talkpilot/flows/flows.schema.d.ts +0 -3
  99. package/dist/talkpilot/flows/flows.schema.d.ts.map +1 -1
  100. package/dist/talkpilot/flows/flows.schema.js +87 -80
  101. package/dist/talkpilot/flows/flows.schema.js.map +1 -1
  102. package/dist/talkpilot/flows/flows.types.d.ts +16 -17
  103. package/dist/talkpilot/flows/flows.types.d.ts.map +1 -1
  104. package/dist/talkpilot/flows/index.d.ts +2 -2
  105. package/dist/talkpilot/groups/groups.getters.d.ts +2 -2
  106. package/dist/talkpilot/groups/groups.getters.d.ts.map +1 -1
  107. package/dist/talkpilot/groups/groups.getters.js +2 -2
  108. package/dist/talkpilot/groups/groups.getters.js.map +1 -1
  109. package/dist/talkpilot/groups/groups.types.d.ts +1 -1
  110. package/dist/talkpilot/groups/index.d.ts +3 -3
  111. package/dist/talkpilot/groups/phone.utils.d.ts +1 -1
  112. package/dist/talkpilot/groups/phone.utils.d.ts.map +1 -1
  113. package/dist/talkpilot/groups/phone.utils.js +2 -2
  114. package/dist/talkpilot/groups/phone.utils.js.map +1 -1
  115. package/dist/talkpilot/index.d.ts +16 -16
  116. package/dist/talkpilot/index.js +1 -1
  117. package/dist/talkpilot/leads/index.d.ts +2 -2
  118. package/dist/talkpilot/leads/leads.getter.d.ts +2 -2
  119. package/dist/talkpilot/leads/leads.getter.d.ts.map +1 -1
  120. package/dist/talkpilot/leads/leads.getter.js +1 -1
  121. package/dist/talkpilot/leads/leads.getter.js.map +1 -1
  122. package/dist/talkpilot/leads/leads.schema.js +16 -16
  123. package/dist/talkpilot/leads/leads.types.d.ts +1 -1
  124. package/dist/talkpilot/mongodb-client.d.ts +1 -1
  125. package/dist/talkpilot/mongodb-client.js +8 -9
  126. package/dist/talkpilot/mongodb-client.js.map +1 -1
  127. package/dist/talkpilot/phone_numbers/index.d.ts +1 -1
  128. package/dist/talkpilot/phone_numbers/index.d.ts.map +1 -1
  129. package/dist/talkpilot/phone_numbers/phone_numbers.getter.d.ts +5 -2
  130. package/dist/talkpilot/phone_numbers/phone_numbers.getter.d.ts.map +1 -1
  131. package/dist/talkpilot/phone_numbers/phone_numbers.getter.js +66 -12
  132. package/dist/talkpilot/phone_numbers/phone_numbers.getter.js.map +1 -1
  133. package/dist/talkpilot/phone_numbers/phone_numbers.schema.d.ts +11 -2
  134. package/dist/talkpilot/phone_numbers/phone_numbers.schema.d.ts.map +1 -1
  135. package/dist/talkpilot/phone_numbers/phone_numbers.schema.js +5 -2
  136. package/dist/talkpilot/phone_numbers/phone_numbers.schema.js.map +1 -1
  137. package/dist/talkpilot/phone_numbers/phone_numbers.types.d.ts +16 -3
  138. package/dist/talkpilot/phone_numbers/phone_numbers.types.d.ts.map +1 -1
  139. package/dist/talkpilot/plans/index.d.ts +2 -2
  140. package/dist/talkpilot/plans/plans.getters.d.ts +2 -2
  141. package/dist/talkpilot/plans/plans.getters.d.ts.map +1 -1
  142. package/dist/talkpilot/plans/plans.getters.js +3 -3
  143. package/dist/talkpilot/plans/plans.getters.js.map +1 -1
  144. package/dist/talkpilot/plans/plans.types.d.ts +4 -4
  145. package/dist/talkpilot/plans/plans.types.d.ts.map +1 -1
  146. package/dist/talkpilot/plans/plans.types.js +19 -19
  147. package/dist/talkpilot/results/index.d.ts +2 -2
  148. package/dist/talkpilot/results/index.d.ts.map +1 -1
  149. package/dist/talkpilot/results/index.js.map +1 -1
  150. package/dist/talkpilot/results/results.getter.d.ts +3 -3
  151. package/dist/talkpilot/results/results.getter.d.ts.map +1 -1
  152. package/dist/talkpilot/results/results.getter.js +4 -4
  153. package/dist/talkpilot/results/results.getter.js.map +1 -1
  154. package/dist/talkpilot/results/results.schema.js +18 -18
  155. package/dist/talkpilot/results/results.types.d.ts +1 -1
  156. package/dist/talkpilot/sessions/index.d.ts +2 -2
  157. package/dist/talkpilot/sessions/sessions.getter.d.ts +3 -3
  158. package/dist/talkpilot/sessions/sessions.getter.d.ts.map +1 -1
  159. package/dist/talkpilot/sessions/sessions.getter.js +13 -10
  160. package/dist/talkpilot/sessions/sessions.getter.js.map +1 -1
  161. package/dist/talkpilot/sessions/sessions.schema.js +17 -17
  162. package/dist/talkpilot/sessions/sessions.types.d.ts +2 -2
  163. package/dist/talkpilot/subscriptions/index.d.ts +3 -3
  164. package/dist/talkpilot/subscriptions/subscriptions.getters.d.ts +2 -2
  165. package/dist/talkpilot/subscriptions/subscriptions.getters.d.ts.map +1 -1
  166. package/dist/talkpilot/subscriptions/subscriptions.getters.js +11 -11
  167. package/dist/talkpilot/subscriptions/subscriptions.getters.js.map +1 -1
  168. package/dist/talkpilot/subscriptions/subscriptions.getters.utils.d.ts +2 -2
  169. package/dist/talkpilot/subscriptions/subscriptions.getters.utils.d.ts.map +1 -1
  170. package/dist/talkpilot/subscriptions/subscriptions.getters.utils.js.map +1 -1
  171. package/dist/talkpilot/subscriptions/subscriptions.types.d.ts +2 -2
  172. package/dist/talkpilot/subscriptions/subscriptions.types.d.ts.map +1 -1
  173. package/dist/talkpilot/subscriptions/subscriptions.types.js +7 -7
  174. package/dist/talkpilot/utils/query.utils.d.ts +1 -1
  175. package/dist/test-utils/db-utils.d.ts +1 -1
  176. package/dist/test-utils/db-utils.js +2 -2
  177. package/dist/test-utils/factories/index.d.ts +12 -12
  178. package/dist/test-utils/factories/municipal/cities.d.ts +2 -2
  179. package/dist/test-utils/factories/municipal/cities.d.ts.map +1 -1
  180. package/dist/test-utils/factories/municipal/cities.js +1 -1
  181. package/dist/test-utils/factories/municipal/departmentsSubjects.d.ts +2 -2
  182. package/dist/test-utils/factories/municipal/departmentsSubjects.d.ts.map +1 -1
  183. package/dist/test-utils/factories/municipal/departmentsSubjects.js +7 -1
  184. package/dist/test-utils/factories/municipal/departmentsSubjects.js.map +1 -1
  185. package/dist/test-utils/factories/municipal/streets.d.ts +2 -2
  186. package/dist/test-utils/factories/municipal/streets.d.ts.map +1 -1
  187. package/dist/test-utils/factories/municipal/streets.js +6 -1
  188. package/dist/test-utils/factories/municipal/streets.js.map +1 -1
  189. package/dist/test-utils/factories/municipal/tickets.d.ts +2 -2
  190. package/dist/test-utils/factories/municipal/tickets.d.ts.map +1 -1
  191. package/dist/test-utils/factories/municipal/tickets.js +7 -1
  192. package/dist/test-utils/factories/municipal/tickets.js.map +1 -1
  193. package/dist/test-utils/factories/talkpilot/agents.d.ts +2 -2
  194. package/dist/test-utils/factories/talkpilot/agents.d.ts.map +1 -1
  195. package/dist/test-utils/factories/talkpilot/agents.js +4 -4
  196. package/dist/test-utils/factories/talkpilot/calls.d.ts +2 -2
  197. package/dist/test-utils/factories/talkpilot/calls.d.ts.map +1 -1
  198. package/dist/test-utils/factories/talkpilot/calls.js +1 -1
  199. package/dist/test-utils/factories/talkpilot/clientAudioBuffers.d.ts +2 -2
  200. package/dist/test-utils/factories/talkpilot/clientAudioBuffers.d.ts.map +1 -1
  201. package/dist/test-utils/factories/talkpilot/clientAudioBuffers.js +1 -1
  202. package/dist/test-utils/factories/talkpilot/clientAudioBuffers.js.map +1 -1
  203. package/dist/test-utils/factories/talkpilot/clientsConfig.d.ts +2 -2
  204. package/dist/test-utils/factories/talkpilot/clientsConfig.d.ts.map +1 -1
  205. package/dist/test-utils/factories/talkpilot/clientsConfig.js.map +1 -1
  206. package/dist/test-utils/factories/talkpilot/flows.d.ts +3 -3
  207. package/dist/test-utils/factories/talkpilot/flows.d.ts.map +1 -1
  208. package/dist/test-utils/factories/talkpilot/flows.js.map +1 -1
  209. package/dist/test-utils/factories/talkpilot/groups.d.ts +2 -2
  210. package/dist/test-utils/factories/talkpilot/groups.d.ts.map +1 -1
  211. package/dist/test-utils/factories/talkpilot/groups.js +9 -9
  212. package/dist/test-utils/factories/talkpilot/groups.js.map +1 -1
  213. package/dist/test-utils/factories/talkpilot/phone_numbers.d.ts +3 -3
  214. package/dist/test-utils/factories/talkpilot/phone_numbers.d.ts.map +1 -1
  215. package/dist/test-utils/factories/talkpilot/phone_numbers.js.map +1 -1
  216. package/dist/test-utils/factories/talkpilot/sessions.d.ts +2 -2
  217. package/dist/test-utils/factories/talkpilot/sessions.d.ts.map +1 -1
  218. package/dist/test-utils/factories/talkpilot/sessions.js +1 -1
  219. package/dist/utils/validation.js +2 -2
  220. package/dist/utils/validation.js.map +1 -1
  221. package/package.json +3 -1
  222. package/src/__tests__/setup.ts +3 -3
  223. package/src/connection.ts +27 -25
  224. package/src/index.ts +9 -9
  225. package/src/municipal/__tests__/validation.spec.ts +35 -23
  226. package/src/municipal/cities/cities.getters.ts +16 -10
  227. package/src/municipal/cities/cities.types.ts +1 -1
  228. package/src/municipal/cities/index.ts +2 -2
  229. package/src/municipal/departmentsSubjects/departmentsSubjects.getters.ts +53 -44
  230. package/src/municipal/departmentsSubjects/departmentsSubjects.types.ts +5 -5
  231. package/src/municipal/departmentsSubjects/index.ts +2 -3
  232. package/src/municipal/index.ts +10 -10
  233. package/src/municipal/mongodb-client.ts +13 -10
  234. package/src/municipal/streets/index.ts +2 -2
  235. package/src/municipal/streets/streets.getters.ts +43 -23
  236. package/src/municipal/streets/streets.types.ts +1 -1
  237. package/src/municipal/systemInstructions/__tests__/getters.spec.ts +67 -52
  238. package/src/municipal/systemInstructions/__tests__/setters.spec.ts +271 -238
  239. package/src/municipal/systemInstructions/index.ts +7 -3
  240. package/src/municipal/systemInstructions/instructions.getters.ts +30 -18
  241. package/src/municipal/systemInstructions/instructions.setters.ts +43 -19
  242. package/src/municipal/systemInstructions/instructions.types.ts +10 -10
  243. package/src/municipal/tickets/__tests__/tickets.getters.spec.ts +12 -12
  244. package/src/municipal/tickets/index.ts +2 -2
  245. package/src/municipal/tickets/tickets.getters.ts +69 -42
  246. package/src/municipal/tickets/tickets.types.ts +2 -2
  247. package/src/municipal/utils/types.ts +8 -3
  248. package/src/talkpilot/__tests__/db.spec.ts +12 -12
  249. package/src/talkpilot/__tests__/mongodb-client.spec.ts +7 -8
  250. package/src/talkpilot/__tests__/validation.spec.ts +30 -24
  251. package/src/talkpilot/agents/__tests__/agents.getters.spec.ts +10 -10
  252. package/src/talkpilot/agents/agents.getters.ts +3 -3
  253. package/src/talkpilot/agents/agents.types.ts +2 -2
  254. package/src/talkpilot/agents/index.ts +2 -2
  255. package/src/talkpilot/backgroundToolResults/__tests__/backgroundToolResults.getters.spec.ts +42 -31
  256. package/src/talkpilot/backgroundToolResults/backgroundToolResults.getters.ts +11 -11
  257. package/src/talkpilot/backgroundToolResults/backgroundToolResults.types.ts +2 -3
  258. package/src/talkpilot/backgroundToolResults/index.ts +2 -2
  259. package/src/talkpilot/calls/__tests__/callStats.utils.spec.ts +27 -27
  260. package/src/talkpilot/calls/__tests__/calls.spec.ts +79 -39
  261. package/src/talkpilot/calls/calls.getters.ts +48 -28
  262. package/src/talkpilot/calls/calls.types.ts +16 -16
  263. package/src/talkpilot/calls/index.ts +2 -2
  264. package/src/talkpilot/clientAudioBuffers/__tests__/clientAudioBuffer.getters.spec.ts +73 -39
  265. package/src/talkpilot/clientAudioBuffers/clientAudioBuffer.getters.ts +18 -11
  266. package/src/talkpilot/clientAudioBuffers/clientsAudioBuffers.types.ts +2 -2
  267. package/src/talkpilot/clientAudioBuffers/index.ts +2 -2
  268. package/src/talkpilot/clients/clients.getters.ts +10 -5
  269. package/src/talkpilot/clients/clients.types.ts +1 -1
  270. package/src/talkpilot/clients/index.ts +2 -2
  271. package/src/talkpilot/clientsConfig/__tests__/clientsConfig.spec.ts +21 -18
  272. package/src/talkpilot/clientsConfig/clientsConfig.getters.ts +6 -4
  273. package/src/talkpilot/clientsConfig/clientsConfig.types.ts +10 -8
  274. package/src/talkpilot/clientsConfig/index.ts +2 -2
  275. package/src/talkpilot/flows/__tests__/flows.schema.spec.ts +38 -37
  276. package/src/talkpilot/flows/flows.getter.ts +8 -5
  277. package/src/talkpilot/flows/flows.schema.ts +87 -80
  278. package/src/talkpilot/flows/flows.types.ts +23 -24
  279. package/src/talkpilot/flows/index.ts +2 -2
  280. package/src/talkpilot/groups/__tests__/groups.spec.ts +34 -27
  281. package/src/talkpilot/groups/__tests__/phone.utils.spec.ts +20 -20
  282. package/src/talkpilot/groups/groups.getters.ts +8 -5
  283. package/src/talkpilot/groups/groups.types.ts +1 -1
  284. package/src/talkpilot/groups/index.ts +3 -3
  285. package/src/talkpilot/groups/phone.utils.ts +12 -6
  286. package/src/talkpilot/index.ts +17 -17
  287. package/src/talkpilot/leads/index.ts +2 -2
  288. package/src/talkpilot/leads/leads.getter.ts +5 -4
  289. package/src/talkpilot/leads/leads.schema.ts +16 -16
  290. package/src/talkpilot/leads/leads.types.ts +1 -1
  291. package/src/talkpilot/mongodb-client.ts +12 -12
  292. package/src/talkpilot/phone_numbers/__tests__/phone_numbers.spec.ts +162 -33
  293. package/src/talkpilot/phone_numbers/index.ts +1 -1
  294. package/src/talkpilot/phone_numbers/phone_numbers.getter.ts +94 -18
  295. package/src/talkpilot/phone_numbers/phone_numbers.schema.ts +5 -2
  296. package/src/talkpilot/phone_numbers/phone_numbers.types.ts +18 -3
  297. package/src/talkpilot/plans/__tests__/plans.spec.ts +30 -26
  298. package/src/talkpilot/plans/index.ts +2 -2
  299. package/src/talkpilot/plans/plans.getters.ts +25 -18
  300. package/src/talkpilot/plans/plans.types.ts +27 -23
  301. package/src/talkpilot/results/index.ts +5 -2
  302. package/src/talkpilot/results/results.getter.ts +9 -8
  303. package/src/talkpilot/results/results.schema.ts +18 -18
  304. package/src/talkpilot/results/results.types.ts +1 -1
  305. package/src/talkpilot/sessions/__tests__/sessions.spec.ts +65 -41
  306. package/src/talkpilot/sessions/index.ts +2 -2
  307. package/src/talkpilot/sessions/sessions.getter.ts +21 -16
  308. package/src/talkpilot/sessions/sessions.schema.ts +17 -17
  309. package/src/talkpilot/sessions/sessions.types.ts +2 -2
  310. package/src/talkpilot/subscriptions/__tests__/subscriptions.getters.utils.spec.ts +18 -15
  311. package/src/talkpilot/subscriptions/index.ts +3 -3
  312. package/src/talkpilot/subscriptions/subscriptions.getters.ts +36 -33
  313. package/src/talkpilot/subscriptions/subscriptions.getters.utils.ts +10 -3
  314. package/src/talkpilot/subscriptions/subscriptions.types.ts +9 -9
  315. package/src/talkpilot/utils/__tests__/query.utils.spec.ts +8 -8
  316. package/src/talkpilot/utils/query.utils.ts +2 -2
  317. package/src/test-utils/db-utils.ts +5 -5
  318. package/src/test-utils/factories/index.ts +12 -12
  319. package/src/test-utils/factories/municipal/cities.ts +5 -5
  320. package/src/test-utils/factories/municipal/departmentsSubjects.ts +32 -25
  321. package/src/test-utils/factories/municipal/streets.ts +10 -5
  322. package/src/test-utils/factories/municipal/tickets.ts +12 -6
  323. package/src/test-utils/factories/talkpilot/agents.ts +8 -8
  324. package/src/test-utils/factories/talkpilot/calls.ts +5 -5
  325. package/src/test-utils/factories/talkpilot/clientAudioBuffers.ts +14 -12
  326. package/src/test-utils/factories/talkpilot/clientsConfig.ts +7 -8
  327. package/src/test-utils/factories/talkpilot/flows.ts +7 -5
  328. package/src/test-utils/factories/talkpilot/groups.ts +13 -13
  329. package/src/test-utils/factories/talkpilot/phone_numbers.ts +8 -6
  330. package/src/test-utils/factories/talkpilot/sessions.ts +5 -5
  331. package/src/utils/validation.ts +4 -4
@@ -1,4 +1,4 @@
1
- import type { Collection } from 'mongodb';
1
+ import type { Collection } from "mongodb";
2
2
  import {
3
3
  Client,
4
4
  getClientsCollection,
@@ -7,32 +7,54 @@ import {
7
7
  ObjectId,
8
8
  findSubscriptions,
9
9
  } from '../index';
10
- import { PhoneNumber, PhoneNumberWithFlow } from './phone_numbers.types';
10
+ import {
11
+ ClientPhoneNumberForFlow,
12
+ PhoneNumber,
13
+ PhoneNumberWithFlow,
14
+ PurchasedPhoneProviderPayload
15
+ } from "./phone_numbers.types";
11
16
 
12
17
  export const getPhoneNumbersCollection = (): Collection<PhoneNumber> =>
13
- getDb().collection<PhoneNumber>('phone_numbers');
18
+ getDb().collection<PhoneNumber>("phone_numbers");
14
19
 
15
20
  export const getPhoneDataByPhoneNumber = async (
16
- phoneNumber: string
21
+ phoneNumber: string,
17
22
  ): Promise<PhoneNumberWithFlow | null> => {
18
- const phoneCallData = await getPhoneNumbersCollection().findOne({ phone_number: phoneNumber });
23
+ const phoneCallData = await getPhoneNumbersCollection().findOne({
24
+ phone_number: phoneNumber,
25
+ });
19
26
  if (!phoneCallData) {
20
- throw new Error('PhoneNumber not found');
27
+ throw new Error("PhoneNumber not found");
21
28
  }
22
- const flow = await getFlowsCollection().findOne({ _id: new ObjectId(phoneCallData.flow_id) });
29
+ const flow = await getFlowsCollection().findOne({
30
+ _id: new ObjectId(phoneCallData.flow_id),
31
+ });
23
32
  if (!flow) {
24
- throw new Error('Flow not found');
33
+ throw new Error("Flow not found");
25
34
  }
26
35
  const [subscription] =
27
- (await findSubscriptions({ clientId: phoneCallData.client_id, isActive: true })) || [];
36
+ (await findSubscriptions({
37
+ clientId: phoneCallData.client_id,
38
+ isActive: true,
39
+ })) || [];
28
40
 
29
- return { ...phoneCallData, flow, subscriptionId: subscription?._id?.toString() ?? undefined };
41
+ return {
42
+ ...phoneCallData,
43
+ flow,
44
+ subscriptionId: subscription?._id?.toString() ?? undefined,
45
+ };
30
46
  };
31
47
 
32
- export const getClientPrimaryPhoneNumber = async (clientId: string): Promise<string | null> => {
48
+ export const getClientPrimaryPhoneNumber = async (
49
+ clientId: string,
50
+ ): Promise<string | null> => {
33
51
  return (
34
- (await getPhoneNumbersCollection().findOne({ client_id: clientId, is_primary: true }))
35
- ?.phone_number ?? null
52
+ (
53
+ await getPhoneNumbersCollection().findOne({
54
+ client_id: clientId,
55
+ is_primary: true,
56
+ })
57
+ )?.phone_number ?? null
36
58
  );
37
59
  };
38
60
 
@@ -40,17 +62,37 @@ export const getClientPhoneNumber = getClientPrimaryPhoneNumber;
40
62
 
41
63
  export const getClientPhoneData = async (
42
64
  clientId: string,
43
- isPrimary?: boolean
65
+ isPrimary?: boolean,
44
66
  ): Promise<PhoneNumber | null> => {
45
67
  const filter = { client_id: clientId, is_primary: isPrimary !== false };
46
- const options = isPrimary === false ? { sort: { createdAt: -1 } as const } : {};
68
+ const options =
69
+ isPrimary === false ? { sort: { createdAt: -1 } as const } : {};
47
70
  return getPhoneNumbersCollection().findOne(filter, options);
48
71
  };
49
72
 
73
+ export const getPhoneNumbersForFlows = async (
74
+ clientId: string,
75
+ ): Promise<ClientPhoneNumberForFlow[]> => {
76
+ const docs = await getPhoneNumbersCollection()
77
+ .find({
78
+ client_id: clientId,
79
+ flow_id: { $exists: true, $type: "objectId" },
80
+ })
81
+ .project({ _id: 0, flow_id: 1, phone_number: 1, is_primary: 1 })
82
+ .sort({ createdAt: -1 })
83
+ .toArray();
84
+
85
+ return docs.map((doc) => ({
86
+ flowId: String(doc.flow_id),
87
+ phoneNumber: doc.phone_number,
88
+ isPrimary: doc.is_primary,
89
+ }));
90
+ };
91
+
50
92
  export const createPhoneNumberEntity = async (
51
93
  phoneNumber: string,
52
94
  flowId: string,
53
- clientId: string
95
+ clientId: string,
54
96
  ): Promise<PhoneNumber> => {
55
97
  const existing = await getClientPhoneData(clientId);
56
98
  const isPrimary = !existing;
@@ -64,15 +106,49 @@ export const createPhoneNumberEntity = async (
64
106
  updatedAt: new Date(),
65
107
  });
66
108
  const phoneNumberData = await getClientPhoneData(clientId, isPrimary);
67
- if (!phoneNumberData) throw new Error('Failed to create phoneNumber');
109
+ if (!phoneNumberData) throw new Error("Failed to create phoneNumber");
68
110
  return phoneNumberData;
69
111
  };
70
112
 
113
+ /** API-purchased number; `flowId` may be omitted until the number is bound to a flow. */
114
+ export const createPurchasedPhoneNumber = async (
115
+ phoneNumber: string,
116
+ providerPayload: PurchasedPhoneProviderPayload,
117
+ clientId: string,
118
+ flowId?: string | null,
119
+ ): Promise<PhoneNumber> => {
120
+ const existingPhoneForClient = await getClientPhoneData(clientId);
121
+ const isPrimary = !existingPhoneForClient;
122
+
123
+ const now = new Date();
124
+ const trimmedFlowId = flowId?.trim();
125
+ const flowObjectId = trimmedFlowId ? new ObjectId(trimmedFlowId) : undefined;
126
+
127
+ const doc: PhoneNumber = {
128
+ phone_number: phoneNumber,
129
+ client_id: clientId,
130
+ is_primary: isPrimary,
131
+ ...providerPayload,
132
+ createdAt: now,
133
+ updatedAt: now,
134
+ };
135
+
136
+ if (flowObjectId) {
137
+ doc.flow_id = flowObjectId;
138
+ }
139
+
140
+ await getPhoneNumbersCollection().insertOne(doc);
141
+
142
+ const created = await getClientPhoneData(clientId, isPrimary);
143
+ if (!created) throw new Error('Failed to create phoneNumber');
144
+ return created;
145
+ };
146
+
71
147
  export const findClientByPhoneNumber = async (phoneNumber: string): Promise<Client> => {
72
148
  const phoneData = await getPhoneNumbersCollection().findOne({ phone_number: phoneNumber });
73
149
  if (!phoneData) throw new Error('Failed to get phone data');
74
150
  const clientId = phoneData.client_id;
75
151
  const client = await getClientsCollection().findOne({ clientId });
76
- if (!client) throw new Error('Failed to get client');
152
+ if (!client) throw new Error("Failed to get client");
77
153
  return client;
78
154
  };
@@ -1,12 +1,15 @@
1
1
  export const phoneNumbersMongoSchema = {
2
2
  bsonType: 'object',
3
- required: ['client_id', 'flow_id', 'phone_number'],
3
+ required: ['client_id', 'phone_number'],
4
4
  properties: {
5
5
  _id: { bsonType: 'objectId' },
6
6
  client_id: { bsonType: 'string' },
7
- flow_id: { bsonType: 'string' },
7
+ flow_id: { bsonType: ['objectId', 'string'] },
8
8
  phone_number: { bsonType: 'string' },
9
9
  is_primary: { bsonType: 'bool' },
10
+ provider: { bsonType: 'string' },
11
+ provider_sid: { bsonType: 'string' },
12
+ friendly_name: { bsonType: 'string' },
10
13
  createdAt: { bsonType: 'date' },
11
14
  updatedAt: { bsonType: 'date' },
12
15
  },
@@ -1,15 +1,30 @@
1
- import { ObjectId, WithId } from "mongodb";
2
- import { Flow } from "../flows/flows.types";
1
+ import { ObjectId, WithId } from 'mongodb';
2
+ import { Flow } from '../flows/flows.types';
3
+
4
+ export type PurchasedPhoneProviderPayload = {
5
+ provider: 'twilio' | 'telnyx';
6
+ provider_sid: string;
7
+ friendly_name?: string;
8
+ };
3
9
 
4
10
  export type PhoneNumber = {
5
11
  _id?: ObjectId;
6
12
  client_id: string;
7
- flow_id: ObjectId;
13
+ flow_id?: ObjectId;
8
14
  phone_number: string;
9
15
  subscriptionId?: string;
10
16
  is_primary: boolean;
17
+ provider?: 'twilio' | 'telnyx';
18
+ provider_sid?: string;
19
+ friendly_name?: string;
11
20
  createdAt: Date;
12
21
  updatedAt: Date;
13
22
  };
14
23
 
15
24
  export type PhoneNumberWithFlow = WithId<PhoneNumber> & { flow: Flow };
25
+
26
+ export type ClientPhoneNumberForFlow = {
27
+ flowId: string;
28
+ phoneNumber: string;
29
+ isPrimary: boolean;
30
+ };
@@ -5,61 +5,65 @@ import {
5
5
  countPlans,
6
6
  updatePlanDoc,
7
7
  getPlansCollection,
8
- } from '../plans.getters';
9
- import { ObjectId } from 'mongodb';
10
- import { Plan } from '../plans.types';
8
+ } from "../plans.getters";
9
+ import { Plan } from "../plans.types";
11
10
 
12
- describe('db.plans', () => {
13
- const createTestPlan = (overrides?: Partial<Plan>): Omit<Plan, 'createdAt' | 'updatedAt'> => ({
14
- productKey: 'basic-500',
15
- name: 'Basic 500',
11
+ describe("db.plans", () => {
12
+ const createTestPlan = (
13
+ overrides?: Partial<Plan>,
14
+ ): Omit<Plan, "createdAt" | "updatedAt"> => ({
15
+ productKey: "basic-500",
16
+ name: "Basic 500",
16
17
  monthlyCallQuota: 500,
17
- currency: 'ILS',
18
+ currency: "ILS",
18
19
  priceMonthlyMinor: 10000,
19
20
  isActive: true,
20
21
  ...overrides,
21
22
  });
22
23
 
23
- it('should create and find a plan', async () => {
24
- const planData = createTestPlan({ name: 'CreateTest' });
24
+ it("should create and find a plan", async () => {
25
+ const planData = createTestPlan({ name: "CreateTest" });
25
26
  const created = await createPlanDoc(planData);
26
-
27
+
27
28
  expect(created._id).toBeDefined();
28
- expect(created.name).toBe('CreateTest');
29
+ expect(created.name).toBe("CreateTest");
29
30
 
30
31
  const found = await findPlans({ _id: created._id });
31
32
  expect(found.length).toBe(1);
32
- expect(found[0].name).toBe('CreateTest');
33
+ expect(found[0].name).toBe("CreateTest");
33
34
  });
34
35
 
35
- it('should find plans by query with limit', async () => {
36
+ it("should find plans by query with limit", async () => {
36
37
  await getPlansCollection().deleteMany({});
37
- await createPlanDoc(createTestPlan({ productKey: 'p1', isActive: true }));
38
- await createPlanDoc(createTestPlan({ productKey: 'p2', isActive: true }));
39
- await createPlanDoc(createTestPlan({ productKey: 'p3', isActive: false }));
38
+ await createPlanDoc(createTestPlan({ productKey: "p1", isActive: true }));
39
+ await createPlanDoc(createTestPlan({ productKey: "p2", isActive: true }));
40
+ await createPlanDoc(createTestPlan({ productKey: "p3", isActive: false }));
40
41
 
41
- const activePlans = await findPlansByQuery({ isActive: true }, { limit: 1 });
42
+ const activePlans = await findPlansByQuery(
43
+ { isActive: true },
44
+ { limit: 1 },
45
+ );
42
46
  expect(activePlans.length).toBe(1);
43
47
  expect(activePlans[0].isActive).toBe(true);
44
48
  });
45
49
 
46
- it('should count plans matching query', async () => {
50
+ it("should count plans matching query", async () => {
47
51
  await getPlansCollection().deleteMany({});
48
- await createPlanDoc(createTestPlan({ currency: 'USD' }));
49
- await createPlanDoc(createTestPlan({ currency: 'USD' }));
50
- await createPlanDoc(createTestPlan({ currency: 'ILS' }));
52
+ await createPlanDoc(createTestPlan({ currency: "USD" }));
53
+ await createPlanDoc(createTestPlan({ currency: "USD" }));
54
+ await createPlanDoc(createTestPlan({ currency: "ILS" }));
51
55
 
52
- const count = await countPlans({ currency: 'USD' });
56
+ const count = await countPlans({ currency: "USD" });
53
57
  expect(count).toBe(2);
54
58
  });
55
59
 
56
- it('should update a plan', async () => {
60
+ it("should update a plan", async () => {
57
61
  const plan = await createPlanDoc(createTestPlan({ isActive: true }));
58
62
  const updated = await updatePlanDoc(plan._id, { isActive: false });
59
-
63
+
60
64
  expect(updated).not.toBeNull();
61
65
  expect(updated?.isActive).toBe(false);
62
-
66
+
63
67
  const found = await findPlans({ _id: plan._id });
64
68
  expect(found[0].isActive).toBe(false);
65
69
  });
@@ -1,2 +1,2 @@
1
- export * from './plans.types';
2
- export * from './plans.getters';
1
+ export * from "./plans.types";
2
+ export * from "./plans.getters";
@@ -1,9 +1,16 @@
1
- import {getDb, Plan, PlanDoc, PlanFilter, PlanQueryOptions, SimplePlanFilter} from '../index';
2
- import {Filter, ObjectId} from 'mongodb';
3
- import {applyQueryOptions} from '../utils/query.utils';
1
+ import {
2
+ getDb,
3
+ Plan,
4
+ PlanDoc,
5
+ PlanFilter,
6
+ PlanQueryOptions,
7
+ SimplePlanFilter,
8
+ } from "../index";
9
+ import { Filter, ObjectId } from "mongodb";
10
+ import { applyQueryOptions } from "../utils/query.utils";
4
11
 
5
12
  export const getPlansCollection = () => {
6
- return getDb().collection<Plan>('plans');
13
+ return getDb().collection<Plan>("plans");
7
14
  };
8
15
 
9
16
  /**
@@ -42,7 +49,7 @@ const buildSimpleQuery = (filter: SimplePlanFilter): Filter<Plan> => {
42
49
  */
43
50
  export const findPlans = async (
44
51
  filter?: PlanFilter,
45
- options?: PlanQueryOptions
52
+ options?: PlanQueryOptions,
46
53
  ): Promise<PlanDoc[]> => {
47
54
  let query: Filter<Plan> = {};
48
55
 
@@ -81,7 +88,7 @@ export const findPlans = async (
81
88
 
82
89
  export const findPlansByQuery = async (
83
90
  query: Filter<Plan>,
84
- options?: PlanQueryOptions
91
+ options?: PlanQueryOptions,
85
92
  ): Promise<PlanDoc[]> => {
86
93
  const cursor = getPlansCollection().find(query);
87
94
  return await applyQueryOptions(cursor, options).toArray();
@@ -92,7 +99,7 @@ export const countPlans = async (query: Filter<Plan>): Promise<number> => {
92
99
  };
93
100
 
94
101
  export const createPlanDoc = async (
95
- planData: Omit<Plan, 'createdAt' | 'updatedAt'>
102
+ planData: Omit<Plan, "createdAt" | "updatedAt">,
96
103
  ): Promise<PlanDoc> => {
97
104
  const now = new Date();
98
105
  const result = await getPlansCollection().insertOne({
@@ -102,24 +109,24 @@ export const createPlanDoc = async (
102
109
  });
103
110
 
104
111
  const plans = await findPlans({ _id: result.insertedId });
105
- if (!plans[0]) throw new Error('Failed to retrieve created plan');
112
+ if (!plans[0]) throw new Error("Failed to retrieve created plan");
106
113
  return plans[0];
107
114
  };
108
115
 
109
116
  export const updatePlanDoc = async (
110
117
  planId: ObjectId,
111
- updates: Partial<Omit<Plan, 'createdAt' | 'updatedAt'>>
118
+ updates: Partial<Omit<Plan, "createdAt" | "updatedAt">>,
112
119
  ): Promise<PlanDoc | null> => {
113
120
  return await getPlansCollection().findOneAndUpdate(
114
- {_id: planId},
115
- {
116
- $set: {
117
- ...updates,
118
- updatedAt: new Date(),
119
- },
121
+ { _id: planId },
122
+ {
123
+ $set: {
124
+ ...updates,
125
+ updatedAt: new Date(),
120
126
  },
121
- {
122
- returnDocument: 'after',
123
- }
127
+ },
128
+ {
129
+ returnDocument: "after",
130
+ },
124
131
  );
125
132
  };
@@ -1,40 +1,44 @@
1
- import { Sort, ObjectId, WithId } from 'mongodb';
1
+ import { Sort, ObjectId, WithId } from "mongodb";
2
2
 
3
- export const CURRENCY_CODES = ['ILS', 'USD', 'EUR'] as const;
3
+ export const CURRENCY_CODES = ["ILS", "USD", "EUR"] as const;
4
4
  export type CurrencyCode = (typeof CURRENCY_CODES)[number];
5
5
 
6
6
  /** Required fields for creating a new plan */
7
7
  export const PLAN_REQUIRED_FIELDS = [
8
- 'productKey',
9
- 'name',
10
- 'monthlyCallQuota',
11
- 'currency',
12
- 'priceMonthlyMinor',
13
- 'isActive',
8
+ "productKey",
9
+ "name",
10
+ "monthlyCallQuota",
11
+ "currency",
12
+ "priceMonthlyMinor",
13
+ "isActive",
14
14
  ];
15
15
 
16
16
  /** All allowed fields that can be set/updated on a plan (excluding system fields) */
17
17
  export const PLAN_ALLOWED_FIELDS = [
18
- 'productKey',
19
- 'name',
20
- 'monthlyCallQuota',
21
- 'currency',
22
- 'priceMonthlyMinor',
23
- 'region',
24
- 'countryCode',
25
- 'isActive',
26
- 'originalPlanId',
27
- 'tax',
28
- 'metadata',
29
- 'updatedAt',
18
+ "productKey",
19
+ "name",
20
+ "monthlyCallQuota",
21
+ "currency",
22
+ "priceMonthlyMinor",
23
+ "region",
24
+ "countryCode",
25
+ "isActive",
26
+ "originalPlanId",
27
+ "tax",
28
+ "metadata",
29
+ "updatedAt",
30
30
  ];
31
31
 
32
32
  /** Logical product family, like "basic-500". Multiple regional variants can share it. */
33
- export type ProductKey = 'basic-500' | 'pro-1100' | 'scale-6000' | (string & {});
33
+ export type ProductKey =
34
+ | "basic-500"
35
+ | "pro-1100"
36
+ | "scale-6000"
37
+ | (string & {});
34
38
 
35
39
  /** Optional targeting to keep variants explicit */
36
- export type RegionCode = 'IL' | 'EU' | 'US' | (string & {});
37
- export type CountryCode = 'IL' | 'DE' | 'FR' | 'ES' | 'GB' | (string & {});
40
+ export type RegionCode = "IL" | "EU" | "US" | (string & {});
41
+ export type CountryCode = "IL" | "DE" | "FR" | "ES" | "GB" | (string & {});
38
42
 
39
43
  export type Tax = {
40
44
  vatIncluded: boolean;
@@ -1,2 +1,5 @@
1
- export { getResultsCollection, initializeResultDocument } from './results.getter';
2
- export type * from './results.types';
1
+ export {
2
+ getResultsCollection,
3
+ initializeResultDocument,
4
+ } from "./results.getter";
5
+ export type * from "./results.types";
@@ -1,8 +1,9 @@
1
- import type { Collection } from 'mongodb';
2
- import { getDb, ObjectId, Session } from '../index';
3
- import type { Result } from './results.types';
1
+ import type { Collection } from "mongodb";
2
+ import { getDb, ObjectId, Session } from "../index";
3
+ import type { Result } from "./results.types";
4
4
 
5
- export const getResultsCollection = (): Collection<Result> => getDb().collection<Result>('results');
5
+ export const getResultsCollection = (): Collection<Result> =>
6
+ getDb().collection<Result>("results");
6
7
 
7
8
  export const createRunId = (): string => {
8
9
  return `run_${new ObjectId().toString()}`;
@@ -10,17 +11,17 @@ export const createRunId = (): string => {
10
11
 
11
12
  export const initializeResultDocument = async (
12
13
  clientId: string,
13
- session?: Session
14
+ session?: Session,
14
15
  ): Promise<Result> => {
15
16
  const { insertedId } = await getResultsCollection().insertOne({
16
17
  runId: createRunId(),
17
18
  date: new Date(),
18
19
  calls: [],
19
- sessionId: session ? session._id!.toString() : 'incomingCall',
20
- sessionName: session ? session.session_name : 'incomingCall',
20
+ sessionId: session ? session._id!.toString() : "incomingCall",
21
+ sessionName: session ? session.session_name : "incomingCall",
21
22
  clientId,
22
23
  });
23
24
  const result = await getResultsCollection().findOne({ _id: insertedId });
24
- if (!result) throw new Error('Failed to initialized result');
25
+ if (!result) throw new Error("Failed to initialized result");
25
26
  return result;
26
27
  };
@@ -1,25 +1,25 @@
1
1
  export const resultMongoSchema = {
2
- bsonType: 'object',
2
+ bsonType: "object",
3
3
  required: [
4
- '_id',
5
- 'sessionId',
6
- 'status',
7
- 'callLength',
8
- 'date',
9
- 'userAnswer',
10
- 'systemSessionId',
11
- 'clientId',
4
+ "_id",
5
+ "sessionId",
6
+ "status",
7
+ "callLength",
8
+ "date",
9
+ "userAnswer",
10
+ "systemSessionId",
11
+ "clientId",
12
12
  ],
13
13
  properties: {
14
- _id: { bsonType: 'objectId' },
15
- sessionId: { bsonType: 'string' },
16
- status: { bsonType: 'string' },
17
- callLength: { bsonType: 'string' },
18
- date: { bsonType: 'date' },
19
- userAnswer: { bsonType: 'string' },
20
- recordingUrl: { bsonType: ['string', 'null'] },
21
- systemSessionId: { bsonType: 'string' },
22
- clientId: { bsonType: 'string' },
14
+ _id: { bsonType: "objectId" },
15
+ sessionId: { bsonType: "string" },
16
+ status: { bsonType: "string" },
17
+ callLength: { bsonType: "string" },
18
+ date: { bsonType: "date" },
19
+ userAnswer: { bsonType: "string" },
20
+ recordingUrl: { bsonType: ["string", "null"] },
21
+ systemSessionId: { bsonType: "string" },
22
+ clientId: { bsonType: "string" },
23
23
  },
24
24
  additionalProperties: false,
25
25
  } as const;
@@ -1,4 +1,4 @@
1
- import { ObjectId } from 'mongodb';
1
+ import { ObjectId } from "mongodb";
2
2
 
3
3
  export interface Result {
4
4
  _id?: ObjectId;