@talkpilot/core-db 1.1.6 → 1.1.8

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/dist/connection.d.ts +1 -1
  2. package/dist/connection.d.ts.map +1 -1
  3. package/dist/connection.js +24 -21
  4. package/dist/connection.js.map +1 -1
  5. package/dist/index.d.ts +9 -9
  6. package/dist/index.d.ts.map +1 -1
  7. package/dist/index.js.map +1 -1
  8. package/dist/municipal/cities/cities.getters.d.ts +2 -2
  9. package/dist/municipal/cities/cities.getters.d.ts.map +1 -1
  10. package/dist/municipal/cities/cities.getters.js +4 -8
  11. package/dist/municipal/cities/cities.getters.js.map +1 -1
  12. package/dist/municipal/cities/cities.types.d.ts +1 -1
  13. package/dist/municipal/cities/index.d.ts +2 -2
  14. package/dist/municipal/departmentsSubjects/departmentsSubjects.getters.d.ts +3 -3
  15. package/dist/municipal/departmentsSubjects/departmentsSubjects.getters.d.ts.map +1 -1
  16. package/dist/municipal/departmentsSubjects/departmentsSubjects.getters.js +22 -30
  17. package/dist/municipal/departmentsSubjects/departmentsSubjects.getters.js.map +1 -1
  18. package/dist/municipal/departmentsSubjects/departmentsSubjects.types.d.ts +4 -4
  19. package/dist/municipal/departmentsSubjects/departmentsSubjects.types.d.ts.map +1 -1
  20. package/dist/municipal/departmentsSubjects/index.d.ts +2 -2
  21. package/dist/municipal/index.d.ts +8 -8
  22. package/dist/municipal/index.d.ts.map +1 -1
  23. package/dist/municipal/index.js +1 -1
  24. package/dist/municipal/mongodb-client.d.ts +1 -1
  25. package/dist/municipal/mongodb-client.d.ts.map +1 -1
  26. package/dist/municipal/mongodb-client.js +25 -13
  27. package/dist/municipal/mongodb-client.js.map +1 -1
  28. package/dist/municipal/streets/index.d.ts +2 -2
  29. package/dist/municipal/streets/streets.getters.d.ts +3 -3
  30. package/dist/municipal/streets/streets.getters.d.ts.map +1 -1
  31. package/dist/municipal/streets/streets.getters.js +9 -19
  32. package/dist/municipal/streets/streets.getters.js.map +1 -1
  33. package/dist/municipal/streets/streets.types.d.ts +1 -1
  34. package/dist/municipal/systemInstructions/index.d.ts +3 -3
  35. package/dist/municipal/systemInstructions/index.d.ts.map +1 -1
  36. package/dist/municipal/systemInstructions/instructions.getters.d.ts +3 -3
  37. package/dist/municipal/systemInstructions/instructions.getters.d.ts.map +1 -1
  38. package/dist/municipal/systemInstructions/instructions.getters.js +4 -10
  39. package/dist/municipal/systemInstructions/instructions.getters.js.map +1 -1
  40. package/dist/municipal/systemInstructions/instructions.setters.d.ts +2 -2
  41. package/dist/municipal/systemInstructions/instructions.setters.d.ts.map +1 -1
  42. package/dist/municipal/systemInstructions/instructions.setters.js +8 -13
  43. package/dist/municipal/systemInstructions/instructions.setters.js.map +1 -1
  44. package/dist/municipal/systemInstructions/instructions.types.d.ts +3 -3
  45. package/dist/municipal/systemInstructions/instructions.types.d.ts.map +1 -1
  46. package/dist/municipal/systemInstructions/instructions.types.js +6 -6
  47. package/dist/municipal/tickets/index.d.ts +2 -2
  48. package/dist/municipal/tickets/tickets.getters.d.ts +3 -3
  49. package/dist/municipal/tickets/tickets.getters.d.ts.map +1 -1
  50. package/dist/municipal/tickets/tickets.getters.js +29 -50
  51. package/dist/municipal/tickets/tickets.getters.js.map +1 -1
  52. package/dist/municipal/tickets/tickets.types.d.ts +1 -1
  53. package/dist/municipal/tickets/tickets.types.d.ts.map +1 -1
  54. package/dist/municipal/utils/types.d.ts +1 -1
  55. package/dist/municipal/utils/types.d.ts.map +1 -1
  56. package/dist/talkpilot/agents/agents.getters.d.ts +1 -1
  57. package/dist/talkpilot/agents/agents.getters.js +2 -2
  58. package/dist/talkpilot/agents/agents.types.d.ts +2 -2
  59. package/dist/talkpilot/agents/index.d.ts +2 -2
  60. package/dist/talkpilot/backgroundToolResults/backgroundToolResults.getters.d.ts +2 -2
  61. package/dist/talkpilot/backgroundToolResults/backgroundToolResults.getters.d.ts.map +1 -1
  62. package/dist/talkpilot/backgroundToolResults/backgroundToolResults.getters.js +1 -1
  63. package/dist/talkpilot/backgroundToolResults/backgroundToolResults.getters.js.map +1 -1
  64. package/dist/talkpilot/backgroundToolResults/backgroundToolResults.types.d.ts +2 -2
  65. package/dist/talkpilot/backgroundToolResults/index.d.ts +2 -2
  66. package/dist/talkpilot/calls/calls.getters.d.ts +3 -3
  67. package/dist/talkpilot/calls/calls.getters.d.ts.map +1 -1
  68. package/dist/talkpilot/calls/calls.getters.js +15 -19
  69. package/dist/talkpilot/calls/calls.getters.js.map +1 -1
  70. package/dist/talkpilot/calls/calls.types.d.ts +3 -3
  71. package/dist/talkpilot/calls/calls.types.d.ts.map +1 -1
  72. package/dist/talkpilot/calls/calls.types.js +2 -2
  73. package/dist/talkpilot/calls/index.d.ts +2 -2
  74. package/dist/talkpilot/clientAudioBuffers/clientAudioBuffer.getters.d.ts +2 -2
  75. package/dist/talkpilot/clientAudioBuffers/clientAudioBuffer.getters.d.ts.map +1 -1
  76. package/dist/talkpilot/clientAudioBuffers/clientAudioBuffer.getters.js +2 -2
  77. package/dist/talkpilot/clientAudioBuffers/clientAudioBuffer.getters.js.map +1 -1
  78. package/dist/talkpilot/clientAudioBuffers/clientsAudioBuffers.types.d.ts +2 -2
  79. package/dist/talkpilot/clientAudioBuffers/index.d.ts +2 -2
  80. package/dist/talkpilot/clients/clients.getters.d.ts +2 -2
  81. package/dist/talkpilot/clients/clients.getters.d.ts.map +1 -1
  82. package/dist/talkpilot/clients/clients.getters.js +2 -5
  83. package/dist/talkpilot/clients/clients.getters.js.map +1 -1
  84. package/dist/talkpilot/clients/clients.types.d.ts +1 -1
  85. package/dist/talkpilot/clients/index.d.ts +2 -2
  86. package/dist/talkpilot/clientsConfig/clientsConfig.getters.d.ts +2 -2
  87. package/dist/talkpilot/clientsConfig/clientsConfig.getters.d.ts.map +1 -1
  88. package/dist/talkpilot/clientsConfig/clientsConfig.getters.js +1 -1
  89. package/dist/talkpilot/clientsConfig/clientsConfig.getters.js.map +1 -1
  90. package/dist/talkpilot/clientsConfig/clientsConfig.types.d.ts +3 -3
  91. package/dist/talkpilot/clientsConfig/clientsConfig.types.d.ts.map +1 -1
  92. package/dist/talkpilot/clientsConfig/index.d.ts +2 -2
  93. package/dist/talkpilot/flows/flows.getter.d.ts +2 -2
  94. package/dist/talkpilot/flows/flows.getter.d.ts.map +1 -1
  95. package/dist/talkpilot/flows/flows.getter.js +1 -1
  96. package/dist/talkpilot/flows/flows.getter.js.map +1 -1
  97. package/dist/talkpilot/flows/flows.schema.d.ts +3 -0
  98. package/dist/talkpilot/flows/flows.schema.d.ts.map +1 -1
  99. package/dist/talkpilot/flows/flows.schema.js +80 -87
  100. package/dist/talkpilot/flows/flows.schema.js.map +1 -1
  101. package/dist/talkpilot/flows/flows.types.d.ts +17 -16
  102. package/dist/talkpilot/flows/flows.types.d.ts.map +1 -1
  103. package/dist/talkpilot/flows/index.d.ts +2 -2
  104. package/dist/talkpilot/groups/groups.getters.d.ts +2 -2
  105. package/dist/talkpilot/groups/groups.getters.d.ts.map +1 -1
  106. package/dist/talkpilot/groups/groups.getters.js +2 -2
  107. package/dist/talkpilot/groups/groups.getters.js.map +1 -1
  108. package/dist/talkpilot/groups/groups.types.d.ts +1 -1
  109. package/dist/talkpilot/groups/index.d.ts +3 -3
  110. package/dist/talkpilot/groups/phone.utils.d.ts +1 -1
  111. package/dist/talkpilot/groups/phone.utils.d.ts.map +1 -1
  112. package/dist/talkpilot/groups/phone.utils.js +2 -2
  113. package/dist/talkpilot/groups/phone.utils.js.map +1 -1
  114. package/dist/talkpilot/index.d.ts +16 -16
  115. package/dist/talkpilot/index.js +1 -1
  116. package/dist/talkpilot/leads/index.d.ts +2 -2
  117. package/dist/talkpilot/leads/leads.getter.d.ts +2 -2
  118. package/dist/talkpilot/leads/leads.getter.d.ts.map +1 -1
  119. package/dist/talkpilot/leads/leads.getter.js +1 -1
  120. package/dist/talkpilot/leads/leads.getter.js.map +1 -1
  121. package/dist/talkpilot/leads/leads.schema.js +16 -16
  122. package/dist/talkpilot/leads/leads.types.d.ts +1 -1
  123. package/dist/talkpilot/mongodb-client.d.ts +1 -1
  124. package/dist/talkpilot/mongodb-client.d.ts.map +1 -1
  125. package/dist/talkpilot/mongodb-client.js +29 -16
  126. package/dist/talkpilot/mongodb-client.js.map +1 -1
  127. package/dist/talkpilot/phone_numbers/index.d.ts +2 -2
  128. package/dist/talkpilot/phone_numbers/phone_numbers.getter.d.ts +3 -3
  129. package/dist/talkpilot/phone_numbers/phone_numbers.getter.d.ts.map +1 -1
  130. package/dist/talkpilot/phone_numbers/phone_numbers.getter.js +13 -28
  131. package/dist/talkpilot/phone_numbers/phone_numbers.getter.js.map +1 -1
  132. package/dist/talkpilot/phone_numbers/phone_numbers.schema.js +9 -9
  133. package/dist/talkpilot/phone_numbers/phone_numbers.types.d.ts +1 -1
  134. package/dist/talkpilot/phone_numbers/phone_numbers.types.d.ts.map +1 -1
  135. package/dist/talkpilot/plans/index.d.ts +2 -2
  136. package/dist/talkpilot/plans/plans.getters.d.ts +2 -2
  137. package/dist/talkpilot/plans/plans.getters.d.ts.map +1 -1
  138. package/dist/talkpilot/plans/plans.getters.js +3 -3
  139. package/dist/talkpilot/plans/plans.getters.js.map +1 -1
  140. package/dist/talkpilot/plans/plans.types.d.ts +4 -4
  141. package/dist/talkpilot/plans/plans.types.d.ts.map +1 -1
  142. package/dist/talkpilot/plans/plans.types.js +19 -19
  143. package/dist/talkpilot/results/index.d.ts +2 -2
  144. package/dist/talkpilot/results/index.d.ts.map +1 -1
  145. package/dist/talkpilot/results/index.js.map +1 -1
  146. package/dist/talkpilot/results/results.getter.d.ts +3 -3
  147. package/dist/talkpilot/results/results.getter.d.ts.map +1 -1
  148. package/dist/talkpilot/results/results.getter.js +4 -4
  149. package/dist/talkpilot/results/results.getter.js.map +1 -1
  150. package/dist/talkpilot/results/results.schema.js +18 -18
  151. package/dist/talkpilot/results/results.types.d.ts +1 -1
  152. package/dist/talkpilot/sessions/index.d.ts +2 -2
  153. package/dist/talkpilot/sessions/sessions.getter.d.ts +3 -3
  154. package/dist/talkpilot/sessions/sessions.getter.d.ts.map +1 -1
  155. package/dist/talkpilot/sessions/sessions.getter.js +10 -13
  156. package/dist/talkpilot/sessions/sessions.getter.js.map +1 -1
  157. package/dist/talkpilot/sessions/sessions.schema.js +17 -17
  158. package/dist/talkpilot/sessions/sessions.types.d.ts +2 -2
  159. package/dist/talkpilot/subscriptions/index.d.ts +3 -3
  160. package/dist/talkpilot/subscriptions/subscriptions.getters.d.ts +2 -2
  161. package/dist/talkpilot/subscriptions/subscriptions.getters.d.ts.map +1 -1
  162. package/dist/talkpilot/subscriptions/subscriptions.getters.js +11 -11
  163. package/dist/talkpilot/subscriptions/subscriptions.getters.js.map +1 -1
  164. package/dist/talkpilot/subscriptions/subscriptions.getters.utils.d.ts +2 -2
  165. package/dist/talkpilot/subscriptions/subscriptions.getters.utils.d.ts.map +1 -1
  166. package/dist/talkpilot/subscriptions/subscriptions.getters.utils.js.map +1 -1
  167. package/dist/talkpilot/subscriptions/subscriptions.types.d.ts +2 -2
  168. package/dist/talkpilot/subscriptions/subscriptions.types.d.ts.map +1 -1
  169. package/dist/talkpilot/subscriptions/subscriptions.types.js +7 -7
  170. package/dist/talkpilot/utils/query.utils.d.ts +1 -1
  171. package/dist/test-utils/db-utils.d.ts +1 -1
  172. package/dist/test-utils/db-utils.js +2 -2
  173. package/dist/test-utils/factories/index.d.ts +12 -12
  174. package/dist/test-utils/factories/municipal/cities.d.ts +2 -2
  175. package/dist/test-utils/factories/municipal/cities.d.ts.map +1 -1
  176. package/dist/test-utils/factories/municipal/cities.js +1 -1
  177. package/dist/test-utils/factories/municipal/departmentsSubjects.d.ts +2 -2
  178. package/dist/test-utils/factories/municipal/departmentsSubjects.d.ts.map +1 -1
  179. package/dist/test-utils/factories/municipal/departmentsSubjects.js +1 -7
  180. package/dist/test-utils/factories/municipal/departmentsSubjects.js.map +1 -1
  181. package/dist/test-utils/factories/municipal/streets.d.ts +2 -2
  182. package/dist/test-utils/factories/municipal/streets.d.ts.map +1 -1
  183. package/dist/test-utils/factories/municipal/streets.js +1 -6
  184. package/dist/test-utils/factories/municipal/streets.js.map +1 -1
  185. package/dist/test-utils/factories/municipal/tickets.d.ts +2 -2
  186. package/dist/test-utils/factories/municipal/tickets.d.ts.map +1 -1
  187. package/dist/test-utils/factories/municipal/tickets.js +1 -7
  188. package/dist/test-utils/factories/municipal/tickets.js.map +1 -1
  189. package/dist/test-utils/factories/talkpilot/agents.d.ts +2 -2
  190. package/dist/test-utils/factories/talkpilot/agents.d.ts.map +1 -1
  191. package/dist/test-utils/factories/talkpilot/agents.js +4 -4
  192. package/dist/test-utils/factories/talkpilot/calls.d.ts +2 -2
  193. package/dist/test-utils/factories/talkpilot/calls.d.ts.map +1 -1
  194. package/dist/test-utils/factories/talkpilot/calls.js +1 -1
  195. package/dist/test-utils/factories/talkpilot/clientAudioBuffers.d.ts +2 -2
  196. package/dist/test-utils/factories/talkpilot/clientAudioBuffers.d.ts.map +1 -1
  197. package/dist/test-utils/factories/talkpilot/clientAudioBuffers.js +1 -1
  198. package/dist/test-utils/factories/talkpilot/clientAudioBuffers.js.map +1 -1
  199. package/dist/test-utils/factories/talkpilot/clientsConfig.d.ts +2 -2
  200. package/dist/test-utils/factories/talkpilot/clientsConfig.d.ts.map +1 -1
  201. package/dist/test-utils/factories/talkpilot/clientsConfig.js.map +1 -1
  202. package/dist/test-utils/factories/talkpilot/flows.d.ts +3 -3
  203. package/dist/test-utils/factories/talkpilot/flows.d.ts.map +1 -1
  204. package/dist/test-utils/factories/talkpilot/flows.js.map +1 -1
  205. package/dist/test-utils/factories/talkpilot/groups.d.ts +2 -2
  206. package/dist/test-utils/factories/talkpilot/groups.d.ts.map +1 -1
  207. package/dist/test-utils/factories/talkpilot/groups.js +9 -9
  208. package/dist/test-utils/factories/talkpilot/groups.js.map +1 -1
  209. package/dist/test-utils/factories/talkpilot/phone_numbers.d.ts +3 -3
  210. package/dist/test-utils/factories/talkpilot/phone_numbers.d.ts.map +1 -1
  211. package/dist/test-utils/factories/talkpilot/phone_numbers.js.map +1 -1
  212. package/dist/test-utils/factories/talkpilot/sessions.d.ts +2 -2
  213. package/dist/test-utils/factories/talkpilot/sessions.d.ts.map +1 -1
  214. package/dist/test-utils/factories/talkpilot/sessions.js +1 -1
  215. package/dist/utils/validation.js +2 -2
  216. package/dist/utils/validation.js.map +1 -1
  217. package/package.json +1 -3
  218. package/src/__tests__/setup.ts +3 -3
  219. package/src/connection.ts +25 -27
  220. package/src/index.ts +9 -9
  221. package/src/municipal/__tests__/validation.spec.ts +23 -35
  222. package/src/municipal/cities/cities.getters.ts +10 -16
  223. package/src/municipal/cities/cities.types.ts +1 -1
  224. package/src/municipal/cities/index.ts +2 -2
  225. package/src/municipal/departmentsSubjects/departmentsSubjects.getters.ts +44 -53
  226. package/src/municipal/departmentsSubjects/departmentsSubjects.types.ts +5 -5
  227. package/src/municipal/departmentsSubjects/index.ts +3 -2
  228. package/src/municipal/index.ts +10 -10
  229. package/src/municipal/mongodb-client.ts +26 -19
  230. package/src/municipal/streets/index.ts +2 -2
  231. package/src/municipal/streets/streets.getters.ts +23 -43
  232. package/src/municipal/streets/streets.types.ts +1 -1
  233. package/src/municipal/systemInstructions/__tests__/getters.spec.ts +52 -67
  234. package/src/municipal/systemInstructions/__tests__/setters.spec.ts +238 -271
  235. package/src/municipal/systemInstructions/index.ts +3 -7
  236. package/src/municipal/systemInstructions/instructions.getters.ts +18 -30
  237. package/src/municipal/systemInstructions/instructions.setters.ts +19 -43
  238. package/src/municipal/systemInstructions/instructions.types.ts +10 -10
  239. package/src/municipal/tickets/__tests__/tickets.getters.spec.ts +12 -12
  240. package/src/municipal/tickets/index.ts +2 -2
  241. package/src/municipal/tickets/tickets.getters.ts +42 -69
  242. package/src/municipal/tickets/tickets.types.ts +2 -2
  243. package/src/municipal/utils/types.ts +3 -8
  244. package/src/talkpilot/__tests__/db.spec.ts +12 -12
  245. package/src/talkpilot/__tests__/mongodb-client.spec.ts +8 -7
  246. package/src/talkpilot/__tests__/validation.spec.ts +24 -30
  247. package/src/talkpilot/agents/__tests__/agents.getters.spec.ts +10 -10
  248. package/src/talkpilot/agents/agents.getters.ts +3 -3
  249. package/src/talkpilot/agents/agents.types.ts +2 -2
  250. package/src/talkpilot/agents/index.ts +2 -2
  251. package/src/talkpilot/backgroundToolResults/__tests__/backgroundToolResults.getters.spec.ts +31 -42
  252. package/src/talkpilot/backgroundToolResults/backgroundToolResults.getters.ts +11 -11
  253. package/src/talkpilot/backgroundToolResults/backgroundToolResults.types.ts +3 -2
  254. package/src/talkpilot/backgroundToolResults/index.ts +2 -2
  255. package/src/talkpilot/calls/__tests__/callStats.utils.spec.ts +27 -27
  256. package/src/talkpilot/calls/__tests__/calls.spec.ts +39 -79
  257. package/src/talkpilot/calls/calls.getters.ts +28 -48
  258. package/src/talkpilot/calls/calls.types.ts +16 -16
  259. package/src/talkpilot/calls/index.ts +2 -2
  260. package/src/talkpilot/clientAudioBuffers/__tests__/clientAudioBuffer.getters.spec.ts +39 -73
  261. package/src/talkpilot/clientAudioBuffers/clientAudioBuffer.getters.ts +11 -18
  262. package/src/talkpilot/clientAudioBuffers/clientsAudioBuffers.types.ts +2 -2
  263. package/src/talkpilot/clientAudioBuffers/index.ts +2 -2
  264. package/src/talkpilot/clients/clients.getters.ts +5 -10
  265. package/src/talkpilot/clients/clients.types.ts +1 -1
  266. package/src/talkpilot/clients/index.ts +2 -2
  267. package/src/talkpilot/clientsConfig/__tests__/clientsConfig.spec.ts +18 -21
  268. package/src/talkpilot/clientsConfig/clientsConfig.getters.ts +4 -6
  269. package/src/talkpilot/clientsConfig/clientsConfig.types.ts +8 -10
  270. package/src/talkpilot/clientsConfig/index.ts +2 -2
  271. package/src/talkpilot/flows/__tests__/flows.schema.spec.ts +37 -38
  272. package/src/talkpilot/flows/flows.getter.ts +5 -8
  273. package/src/talkpilot/flows/flows.schema.ts +80 -87
  274. package/src/talkpilot/flows/flows.types.ts +24 -23
  275. package/src/talkpilot/flows/index.ts +2 -2
  276. package/src/talkpilot/groups/__tests__/groups.spec.ts +27 -34
  277. package/src/talkpilot/groups/__tests__/phone.utils.spec.ts +20 -20
  278. package/src/talkpilot/groups/groups.getters.ts +5 -8
  279. package/src/talkpilot/groups/groups.types.ts +1 -1
  280. package/src/talkpilot/groups/index.ts +3 -3
  281. package/src/talkpilot/groups/phone.utils.ts +6 -12
  282. package/src/talkpilot/index.ts +17 -17
  283. package/src/talkpilot/leads/index.ts +2 -2
  284. package/src/talkpilot/leads/leads.getter.ts +4 -5
  285. package/src/talkpilot/leads/leads.schema.ts +16 -16
  286. package/src/talkpilot/leads/leads.types.ts +1 -1
  287. package/src/talkpilot/mongodb-client.ts +33 -23
  288. package/src/talkpilot/phone_numbers/__tests__/phone_numbers.spec.ts +44 -84
  289. package/src/talkpilot/phone_numbers/index.ts +2 -2
  290. package/src/talkpilot/phone_numbers/phone_numbers.getter.ts +22 -44
  291. package/src/talkpilot/phone_numbers/phone_numbers.schema.ts +9 -9
  292. package/src/talkpilot/phone_numbers/phone_numbers.types.ts +1 -1
  293. package/src/talkpilot/plans/__tests__/plans.spec.ts +26 -30
  294. package/src/talkpilot/plans/index.ts +2 -2
  295. package/src/talkpilot/plans/plans.getters.ts +18 -25
  296. package/src/talkpilot/plans/plans.types.ts +23 -27
  297. package/src/talkpilot/results/index.ts +2 -5
  298. package/src/talkpilot/results/results.getter.ts +8 -9
  299. package/src/talkpilot/results/results.schema.ts +18 -18
  300. package/src/talkpilot/results/results.types.ts +1 -1
  301. package/src/talkpilot/sessions/__tests__/sessions.spec.ts +41 -65
  302. package/src/talkpilot/sessions/index.ts +2 -2
  303. package/src/talkpilot/sessions/sessions.getter.ts +16 -21
  304. package/src/talkpilot/sessions/sessions.schema.ts +17 -17
  305. package/src/talkpilot/sessions/sessions.types.ts +2 -2
  306. package/src/talkpilot/subscriptions/__tests__/subscriptions.getters.utils.spec.ts +15 -18
  307. package/src/talkpilot/subscriptions/index.ts +3 -3
  308. package/src/talkpilot/subscriptions/subscriptions.getters.ts +33 -36
  309. package/src/talkpilot/subscriptions/subscriptions.getters.utils.ts +3 -10
  310. package/src/talkpilot/subscriptions/subscriptions.types.ts +9 -9
  311. package/src/talkpilot/utils/__tests__/query.utils.spec.ts +8 -8
  312. package/src/talkpilot/utils/query.utils.ts +2 -2
  313. package/src/test-utils/db-utils.ts +5 -5
  314. package/src/test-utils/factories/index.ts +12 -12
  315. package/src/test-utils/factories/municipal/cities.ts +5 -5
  316. package/src/test-utils/factories/municipal/departmentsSubjects.ts +25 -32
  317. package/src/test-utils/factories/municipal/streets.ts +5 -10
  318. package/src/test-utils/factories/municipal/tickets.ts +6 -12
  319. package/src/test-utils/factories/talkpilot/agents.ts +8 -8
  320. package/src/test-utils/factories/talkpilot/calls.ts +5 -5
  321. package/src/test-utils/factories/talkpilot/clientAudioBuffers.ts +12 -14
  322. package/src/test-utils/factories/talkpilot/clientsConfig.ts +8 -7
  323. package/src/test-utils/factories/talkpilot/flows.ts +5 -7
  324. package/src/test-utils/factories/talkpilot/groups.ts +13 -13
  325. package/src/test-utils/factories/talkpilot/phone_numbers.ts +6 -8
  326. package/src/test-utils/factories/talkpilot/sessions.ts +5 -5
  327. package/src/utils/validation.ts +4 -4
  328. package/dist/talkpilot/subscriptions/subscriptions.utils.d.ts +0 -4
  329. package/dist/talkpilot/subscriptions/subscriptions.utils.d.ts.map +0 -1
  330. package/dist/talkpilot/subscriptions/subscriptions.utils.js +0 -20
  331. package/dist/talkpilot/subscriptions/subscriptions.utils.js.map +0 -1
@@ -1,11 +1,10 @@
1
- import { CityName, DepartmentSubject, getDb } from "../index";
2
- import { Collection, Filter } from "mongodb";
3
- import { VectorSearchResult } from "./departmentsSubjects.types";
1
+ import { getDb, DepartmentSubject, CityName } from '../index';
2
+ import { Collection, Filter } from 'mongodb';
3
+ import { VectorSearchResult } from './departmentsSubjects.types';
4
4
 
5
- export const getDepartmentsSubjectsCollection =
6
- (): Collection<DepartmentSubject> => {
7
- return getDb().collection<DepartmentSubject>("departmentsSubjects");
8
- };
5
+ export const getDepartmentsSubjectsCollection = (): Collection<DepartmentSubject> => {
6
+ return getDb().collection<DepartmentSubject>('departmentsSubjects');
7
+ };
9
8
 
10
9
  /**
11
10
  * Get all departments subjects for a given city.
@@ -17,7 +16,7 @@ export const getDepartmentsSubjectsCollection =
17
16
  */
18
17
  export const getAllDepartmentsSubjectsByCity = async (
19
18
  cityName: CityName,
20
- withEmbeddings: boolean = false,
19
+ withEmbeddings: boolean = false
21
20
  ): Promise<DepartmentSubject[]> => {
22
21
  const collection = getDepartmentsSubjectsCollection();
23
22
  const query = collection.find({ cityName });
@@ -43,17 +42,17 @@ export const vectorSearchDepartmentsSubjects = async (
43
42
  queryVector: number[],
44
43
  cityName: CityName,
45
44
  limit: number = 5,
46
- numCandidates: number = 800,
45
+ numCandidates: number = 800
47
46
  ): Promise<VectorSearchResult[]> => {
48
47
  const collection = getDepartmentsSubjectsCollection();
49
- const indexName = "subjectTreesIndex";
48
+ const indexName = 'subjectTreesIndex';
50
49
 
51
- return await collection
50
+ const results = await collection
52
51
  .aggregate<VectorSearchResult>([
53
52
  {
54
53
  $vectorSearch: {
55
54
  index: indexName,
56
- path: "embedding",
55
+ path: 'embedding',
57
56
  queryVector,
58
57
  numCandidates,
59
58
  limit,
@@ -64,21 +63,23 @@ export const vectorSearchDepartmentsSubjects = async (
64
63
  $project: {
65
64
  _id: 0,
66
65
  subjectName: 1,
67
- subject_id: { $toInt: "$subject_id" }, // Convert string to number
66
+ subject_id: { $toInt: '$subject_id' }, // Convert string to number
68
67
  sub_subject_name: 1,
69
68
  sub_subject_id: 1,
70
69
  descriptions: 1,
71
70
  guidelines: 1,
72
- score: { $meta: "vectorSearchScore" },
71
+ score: { $meta: 'vectorSearchScore' },
73
72
  },
74
73
  },
75
74
  ])
76
75
  .toArray();
76
+
77
+ return results;
77
78
  };
78
79
 
79
80
  export const addDepartmentSubjectInstruction = async (
80
81
  filter: Filter<DepartmentSubject>,
81
- instructionText: string,
82
+ instructionText: string
82
83
  ): Promise<DepartmentSubject | null> => {
83
84
  const newInstruction = {
84
85
  id: Date.now(),
@@ -91,7 +92,7 @@ export const addDepartmentSubjectInstruction = async (
91
92
  $push: { instructions: newInstruction },
92
93
  $set: { updatedAt: new Date() },
93
94
  },
94
- { returnDocument: "after" },
95
+ { returnDocument: 'after' }
95
96
  );
96
97
 
97
98
  return result || null;
@@ -100,17 +101,12 @@ export const addDepartmentSubjectInstruction = async (
100
101
  export const updateDepartmentSubjectInstruction = async (
101
102
  filter: Filter<DepartmentSubject>,
102
103
  instructionId: number,
103
- newInstructionText: string,
104
+ newInstructionText: string
104
105
  ): Promise<DepartmentSubject | null> => {
105
106
  const result = await getDepartmentsSubjectsCollection().findOneAndUpdate(
106
- { ...filter, "instructions.id": instructionId },
107
- {
108
- $set: {
109
- "instructions.$.instruction": newInstructionText,
110
- updatedAt: new Date(),
111
- },
112
- },
113
- { returnDocument: "after" },
107
+ { ...filter, 'instructions.id': instructionId },
108
+ { $set: { 'instructions.$.instruction': newInstructionText, updatedAt: new Date() } },
109
+ { returnDocument: 'after' }
114
110
  );
115
111
 
116
112
  return result || null;
@@ -118,7 +114,7 @@ export const updateDepartmentSubjectInstruction = async (
118
114
 
119
115
  export const removeDepartmentSubjectInstruction = async (
120
116
  filter: Filter<DepartmentSubject>,
121
- instructionId: number,
117
+ instructionId: number
122
118
  ): Promise<DepartmentSubject | null> => {
123
119
  const result = await getDepartmentsSubjectsCollection().findOneAndUpdate(
124
120
  filter,
@@ -126,7 +122,7 @@ export const removeDepartmentSubjectInstruction = async (
126
122
  $pull: { instructions: { id: instructionId } },
127
123
  $set: { updatedAt: new Date() },
128
124
  },
129
- { returnDocument: "after" },
125
+ { returnDocument: 'after' }
130
126
  );
131
127
 
132
128
  return result || null;
@@ -135,22 +131,18 @@ export const removeDepartmentSubjectInstruction = async (
135
131
  export const addDepartmentSubjectCommunication = async (
136
132
  filter: Filter<DepartmentSubject>,
137
133
  communication: {
138
- type: "free_text_sms" | "upload_url_sms";
134
+ type: 'free_text_sms' | 'upload_url_sms';
139
135
  message_text?: string;
140
136
  template_id?: string;
141
137
  to?: string;
142
- },
138
+ }
143
139
  ): Promise<DepartmentSubject | null> => {
144
140
  const newCommunication = {
145
141
  id: Date.now(),
146
142
  type: communication.type,
147
- ...(communication.message_text !== undefined && {
148
- message_text: communication.message_text,
149
- }),
143
+ ...(communication.message_text !== undefined && { message_text: communication.message_text }),
150
144
  is_deleted: false,
151
- ...(communication.template_id !== undefined && {
152
- template_id: communication.template_id,
153
- }),
145
+ ...(communication.template_id !== undefined && { template_id: communication.template_id }),
154
146
  ...(communication.to !== undefined && { to: communication.to }),
155
147
  };
156
148
 
@@ -160,7 +152,7 @@ export const addDepartmentSubjectCommunication = async (
160
152
  $push: { communications: newCommunication },
161
153
  $set: { updatedAt: new Date() },
162
154
  },
163
- { returnDocument: "after" },
155
+ { returnDocument: 'after' }
164
156
  );
165
157
 
166
158
  return result || null;
@@ -170,28 +162,27 @@ export const updateDepartmentSubjectCommunication = async (
170
162
  filter: Filter<DepartmentSubject>,
171
163
  communicationId: number,
172
164
  updates: {
173
- type?: "free_text_sms" | "upload_url_sms";
165
+ type?: 'free_text_sms' | 'upload_url_sms';
174
166
  message_text?: string | null;
175
167
  template_id?: string | null;
176
168
  to?: string | null;
177
169
  is_deleted?: boolean | null;
178
- },
170
+ }
179
171
  ): Promise<DepartmentSubject | null> => {
180
172
  const setFields: Record<string, unknown> = { updatedAt: new Date() };
181
- if (updates.type !== undefined)
182
- setFields["communications.$.type"] = updates.type;
173
+ if (updates.type !== undefined) setFields['communications.$.type'] = updates.type;
183
174
  if (updates.message_text !== undefined)
184
- setFields["communications.$.message_text"] = updates.message_text;
175
+ setFields['communications.$.message_text'] = updates.message_text;
185
176
  if (updates.template_id !== undefined)
186
- setFields["communications.$.template_id"] = updates.template_id;
187
- if (updates.to !== undefined) setFields["communications.$.to"] = updates.to;
177
+ setFields['communications.$.template_id'] = updates.template_id;
178
+ if (updates.to !== undefined) setFields['communications.$.to'] = updates.to;
188
179
  if (updates.is_deleted !== undefined)
189
- setFields["communications.$.is_deleted"] = updates.is_deleted;
180
+ setFields['communications.$.is_deleted'] = updates.is_deleted;
190
181
 
191
182
  const result = await getDepartmentsSubjectsCollection().findOneAndUpdate(
192
- { ...filter, "communications.id": communicationId },
183
+ { ...filter, 'communications.id': communicationId },
193
184
  { $set: setFields },
194
- { returnDocument: "after" },
185
+ { returnDocument: 'after' }
195
186
  );
196
187
 
197
188
  return result || null;
@@ -199,7 +190,7 @@ export const updateDepartmentSubjectCommunication = async (
199
190
 
200
191
  export const removeDepartmentSubjectCommunication = async (
201
192
  filter: Filter<DepartmentSubject>,
202
- communicationId: number,
193
+ communicationId: number
203
194
  ): Promise<DepartmentSubject | null> => {
204
195
  const result = await getDepartmentsSubjectsCollection().findOneAndUpdate(
205
196
  filter,
@@ -207,7 +198,7 @@ export const removeDepartmentSubjectCommunication = async (
207
198
  $pull: { communications: { id: communicationId } },
208
199
  $set: { updatedAt: new Date() },
209
200
  },
210
- { returnDocument: "after" },
201
+ { returnDocument: 'after' }
211
202
  );
212
203
 
213
204
  return result || null;
@@ -223,7 +214,7 @@ export const removeDepartmentSubjectCommunication = async (
223
214
  export const getDepartmentSubjectBySubjectIds = async (
224
215
  subjectId: string,
225
216
  subSubjectId: string,
226
- cityName: CityName,
217
+ cityName: CityName
227
218
  ): Promise<DepartmentSubject | null> => {
228
219
  const collection = getDepartmentsSubjectsCollection();
229
220
 
@@ -249,13 +240,13 @@ export const getDepartmentSubjectBySubjectIds = async (
249
240
  */
250
241
  export const updateDepartmentSubjectGuidelines = async (
251
242
  filter: Filter<DepartmentSubject>,
252
- guidelines: string,
243
+ guidelines: string
253
244
  ): Promise<DepartmentSubject | null> => {
254
245
  // $set will create the field if it doesn't exist
255
246
  const result = await getDepartmentsSubjectsCollection().findOneAndUpdate(
256
247
  filter,
257
248
  { $set: { guidelines, updatedAt: new Date() } },
258
- { returnDocument: "after" },
249
+ { returnDocument: 'after' }
259
250
  );
260
251
  return result || null;
261
252
  };
@@ -266,13 +257,13 @@ export const updateDepartmentSubjectGuidelines = async (
266
257
  * @returns Updated DepartmentSubject document or null if not found
267
258
  */
268
259
  export const deleteDepartmentSubjectGuidelines = async (
269
- filter: Filter<DepartmentSubject>,
260
+ filter: Filter<DepartmentSubject>
270
261
  ): Promise<DepartmentSubject | null> => {
271
262
  // $set clears the field by setting it to null (keeps the field in the document)
272
263
  const result = await getDepartmentsSubjectsCollection().findOneAndUpdate(
273
264
  filter,
274
265
  { $set: { guidelines: null, updatedAt: new Date() } },
275
- { returnDocument: "after" },
266
+ { returnDocument: 'after' }
276
267
  );
277
268
  return result || null;
278
269
  };
@@ -1,7 +1,7 @@
1
- import { ObjectId, WithId } from "mongodb";
2
- import { Request } from "express";
3
- import { ClientConfigDoc, Products } from "../../talkpilot";
4
- import { CityName } from "../utils/types";
1
+ import {ObjectId, WithId} from 'mongodb';
2
+ import {Request} from 'express';
3
+ import {ClientConfigDoc, Products} from '../../talkpilot/clientsConfig/clientsConfig.types';
4
+ import {CityName} from "../utils/types";
5
5
 
6
6
  export type DepartmentSubject = {
7
7
  _id: ObjectId;
@@ -57,7 +57,7 @@ export type VectorSearchResult = {
57
57
  score?: number;
58
58
  };
59
59
 
60
- export type CommunicationType = "free_text_sms" | "upload_url_sms";
60
+ export type CommunicationType = 'free_text_sms' | 'upload_url_sms';
61
61
 
62
62
  /**
63
63
  * Extended Express Request type with client configuration
@@ -1,4 +1,4 @@
1
- export * from "./departmentsSubjects.getters";
1
+ export * from './departmentsSubjects.getters';
2
2
  export type {
3
3
  DepartmentSubject,
4
4
  DepartmentSubjectDoc,
@@ -6,4 +6,5 @@ export type {
6
6
  RequestWithClientConfig,
7
7
  Communication,
8
8
  Instruction,
9
- } from "./departmentsSubjects.types";
9
+ } from './departmentsSubjects.types';
10
+
@@ -1,13 +1,13 @@
1
- import { Db, ObjectId as MongoObjectId } from "mongodb";
1
+ import { Db, ObjectId as MongoObjectId } from 'mongodb';
2
2
 
3
- export * from "./cities";
4
- export * from "./streets";
5
- export * from "./departmentsSubjects";
6
- export * from "./tickets";
7
- export * from "./systemInstructions";
8
- export * from "./utils/types";
9
- export { CityName } from "./utils/types";
10
- export { municipalDataMongodbClient } from "./mongodb-client";
3
+ export * from './cities';
4
+ export * from './streets';
5
+ export * from './departmentsSubjects';
6
+ export * from './tickets';
7
+ export * from './systemInstructions';
8
+ export * from './utils/types';
9
+ export {CityName} from "./utils/types";
10
+ export { municipalDataMongodbClient } from './mongodb-client';
11
11
 
12
12
  let db: Db;
13
13
  export const setDb = (d: Db) => {
@@ -15,7 +15,7 @@ export const setDb = (d: Db) => {
15
15
  };
16
16
 
17
17
  export const getDb = (): Db => {
18
- if (!db) throw new Error("Municipal Data DB not initialised");
18
+ if (!db) throw new Error('Municipal Data DB not initialised');
19
19
  return db;
20
20
  };
21
21
  export const ObjectId = MongoObjectId;
@@ -1,11 +1,11 @@
1
- import { MongoClient, Db } from "mongodb";
2
- import { setDb } from "./index";
3
- import { validateConfig, validateMongoUri } from "../utils/validation";
1
+ import { MongoClient, Db } from 'mongodb';
2
+ import { setDb } from './index';
3
+ import { validateConfig, validateMongoUri } from '../utils/validation';
4
4
 
5
5
  class MunicipalDataMongoDBClient {
6
6
  private client: MongoClient | null = null;
7
7
  private db: Db | null = null;
8
- private readonly defaultDbName = "municipal-data";
8
+ private readonly defaultDbName = 'municipal-data';
9
9
 
10
10
  async connect(uri?: string, dbName?: string): Promise<void> {
11
11
  if (this.client) {
@@ -13,32 +13,39 @@ class MunicipalDataMongoDBClient {
13
13
  }
14
14
 
15
15
  const mongodbUri = uri || process.env.MONGO_URI || process.env.MONGODB_URI;
16
- validateConfig("MONGO_URI", mongodbUri);
16
+ validateConfig('MONGO_URI', mongodbUri);
17
17
  validateMongoUri(mongodbUri!);
18
18
 
19
- this.client = new MongoClient(mongodbUri!);
20
- await this.client.connect();
21
- const targetDbName =
22
- dbName || process.env.MUNICIPAL_DB_NAME || this.defaultDbName;
23
- this.db = this.client.db(targetDbName);
24
- setDb(this.db);
25
- console.info(`[core-db] Municipal MongoDB connected: ${targetDbName}`);
19
+ try {
20
+ this.client = new MongoClient(mongodbUri!);
21
+ await this.client.connect();
22
+ const targetDbName = dbName || this.defaultDbName;
23
+ this.db = this.client.db(targetDbName);
24
+ setDb(this.db);
25
+ console.info(`[core-db] Municipal MongoDB connected: ${targetDbName}`);
26
+ } catch (error) {
27
+ console.error('[core-db] Municipal connection failed', error as Error);
28
+ throw error;
29
+ }
26
30
  }
27
31
 
28
32
  async disconnect(): Promise<void> {
29
33
  if (this.client) {
30
- await this.client.close();
31
- this.client = null;
32
- this.db = null;
33
- console.info("Municipal Data MongoDB disconnected successfully");
34
+ try {
35
+ await this.client.close();
36
+ this.client = null;
37
+ this.db = null;
38
+ console.info('Municipal Data MongoDB disconnected successfully');
39
+ } catch (error) {
40
+ console.error('Error disconnecting from Municipal Data MongoDB', error as Error);
41
+ throw error;
42
+ }
34
43
  }
35
44
  }
36
45
 
37
46
  getDb(): Db {
38
47
  if (!this.db) {
39
- throw new Error(
40
- "Municipal Data database not initialized. Call connect() first.",
41
- );
48
+ throw new Error('Municipal Data database not initialized. Call connect() first.');
42
49
  }
43
50
  return this.db;
44
51
  }
@@ -1,2 +1,2 @@
1
- export * from "./streets.getters";
2
- export type { Street, StreetDoc, StreetHint } from "./streets.types";
1
+ export * from './streets.getters';
2
+ export type { Street, StreetDoc, StreetHint } from './streets.types';
@@ -1,38 +1,25 @@
1
- import { CityName, getDb, ObjectId, Street } from "../index";
2
- import type { StreetHint } from "./streets.types";
3
- import { Collection, Filter, ObjectId as MongoObjectId } from "mongodb";
1
+ import {CityName, getDb, ObjectId, Street} from '../index';
2
+ import type { StreetHint } from './streets.types';
3
+ import { Collection, Filter, ObjectId as MongoObjectId } from 'mongodb';
4
4
 
5
5
  export const getStreetsCollection = (): Collection<Street> => {
6
- return getDb().collection<Street>("streets");
6
+ return getDb().collection<Street>('streets');
7
7
  };
8
8
 
9
- export const findStreets = async (
10
- filter: Filter<Street> = {},
11
- ): Promise<Street[]> => {
9
+ export const findStreets = async (filter: Filter<Street> = {}): Promise<Street[]> => {
12
10
  return await getStreetsCollection().find(filter).toArray();
13
11
  };
14
12
 
15
- export const getStreetById = async (
16
- streetId: string,
17
- ): Promise<Street | null> => {
18
- const street = await getStreetsCollection().findOne({
19
- _id: new ObjectId(streetId),
20
- });
13
+ export const getStreetById = async (streetId: string): Promise<Street | null> => {
14
+ const street = await getStreetsCollection().findOne({ _id: new ObjectId(streetId) });
21
15
  return street ? street : null;
22
16
  };
23
17
 
24
- export const getStreetsByCityName = async (
25
- cityName: CityName,
26
- ): Promise<Street[]> => {
27
- return await getStreetsCollection()
28
- .find({ cityName })
29
- .sort({ name: 1 })
30
- .toArray();
18
+ export const getStreetsByCityName = async (cityName: CityName): Promise<Street[]> => {
19
+ return await getStreetsCollection().find({ cityName }).sort({ name: 1 }).toArray();
31
20
  };
32
21
 
33
- export const getStreetByStreetId = async (
34
- streetId: string,
35
- ): Promise<Street | null> => {
22
+ export const getStreetByStreetId = async (streetId: string): Promise<Street | null> => {
36
23
  const street = await getStreetsCollection().findOne({ id: streetId });
37
24
  return street ? street : null;
38
25
  };
@@ -40,37 +27,32 @@ export const getStreetByStreetId = async (
40
27
  /** Get street by business id and city. Use this when the client's city is known so the same id in another city is not returned. */
41
28
  export const getStreetByStreetIdAndCity = async (
42
29
  streetId: string,
43
- cityName: CityName,
30
+ cityName: CityName
44
31
  ): Promise<Street | null> => {
45
- const street = await getStreetsCollection().findOne({
46
- id: streetId,
47
- cityName,
48
- });
32
+ const street = await getStreetsCollection().findOne({ id: streetId, cityName });
49
33
  return street ? street : null;
50
34
  };
51
35
 
52
36
  export const createStreet = async (
53
- streetData: Omit<Street, "_id" | "createdAt" | "updatedAt">,
37
+ streetData: Omit<Street, '_id' | 'createdAt' | 'updatedAt'>
54
38
  ): Promise<MongoObjectId> => {
55
- const street: Omit<Street, "_id"> = {
39
+ const street: Omit<Street, '_id'> = {
56
40
  ...streetData,
57
41
  createdAt: new Date(),
58
42
  updatedAt: new Date(),
59
43
  };
60
- const { insertedId } = await getStreetsCollection().insertOne(
61
- street as Street,
62
- );
44
+ const { insertedId } = await getStreetsCollection().insertOne(street as Street);
63
45
  return insertedId;
64
46
  };
65
47
 
66
48
  export const updateStreet = async (
67
49
  streetId: string,
68
- data: Partial<Omit<Street, "_id" | "createdAt" | "updatedAt">>,
50
+ data: Partial<Omit<Street, '_id' | 'createdAt' | 'updatedAt'>>
69
51
  ): Promise<Street | null> => {
70
52
  const result = await getStreetsCollection().findOneAndUpdate(
71
53
  { _id: new ObjectId(streetId) },
72
54
  { $set: { ...data, updatedAt: new Date() } },
73
- { returnDocument: "after" },
55
+ { returnDocument: 'after' }
74
56
  );
75
57
  return result || null;
76
58
  };
@@ -81,7 +63,7 @@ export const updateStreet = async (
81
63
  */
82
64
  export const upsertStreetHintOnStreet = async (
83
65
  street: Street,
84
- hint: Partial<StreetHint> & Pick<StreetHint, "text">,
66
+ hint: Partial<StreetHint> & Pick<StreetHint, 'text'>
85
67
  ): Promise<Street | null> => {
86
68
  const text = hint.text.trim();
87
69
  if (!text) return null;
@@ -89,7 +71,7 @@ export const upsertStreetHintOnStreet = async (
89
71
  const hints = street.hints || [];
90
72
  let updatedHints: StreetHint[];
91
73
 
92
- if (hint.id != null && hint.id !== "") {
74
+ if (hint.id != null && hint.id !== '') {
93
75
  const hintIndex = hints.findIndex((h) => String(h.id) === String(hint.id));
94
76
  if (hintIndex === -1) return null;
95
77
  updatedHints = [...hints];
@@ -104,22 +86,20 @@ export const upsertStreetHintOnStreet = async (
104
86
  /** Remove a hint from a street. streetId is the street business id (e.g. "703"). Updates document updatedAt. */
105
87
  export const deleteStreetHint = async (
106
88
  streetId: string,
107
- hintId: string,
89
+ hintId: string
108
90
  ): Promise<Street | null> => {
109
91
  const result = await getStreetsCollection().findOneAndUpdate(
110
92
  { id: streetId },
111
93
  { $pull: { hints: { id: hintId } }, $set: { updatedAt: new Date() } },
112
- { returnDocument: "after" },
94
+ { returnDocument: 'after' }
113
95
  );
114
96
  if (result) {
115
- console.info("Street hint deleted", { streetId, hintId });
97
+ console.info('Street hint deleted', { streetId, hintId });
116
98
  }
117
99
  return result || null;
118
100
  };
119
101
 
120
102
  export const deleteStreet = async (streetId: string): Promise<boolean> => {
121
- const result = await getStreetsCollection().deleteOne({
122
- _id: new ObjectId(streetId),
123
- });
103
+ const result = await getStreetsCollection().deleteOne({ _id: new ObjectId(streetId) });
124
104
  return result.deletedCount > 0;
125
105
  };
@@ -1,4 +1,4 @@
1
- import { ObjectId, WithId } from "mongodb";
1
+ import { ObjectId, WithId } from 'mongodb';
2
2
 
3
3
  export type StreetHint = {
4
4
  id: string;