@talkpilot/core-db 1.1.7 → 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 (330) 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 +7 -7
  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.js +9 -8
  125. package/dist/talkpilot/mongodb-client.js.map +1 -1
  126. package/dist/talkpilot/phone_numbers/index.d.ts +2 -2
  127. package/dist/talkpilot/phone_numbers/phone_numbers.getter.d.ts +3 -3
  128. package/dist/talkpilot/phone_numbers/phone_numbers.getter.d.ts.map +1 -1
  129. package/dist/talkpilot/phone_numbers/phone_numbers.getter.js +13 -28
  130. package/dist/talkpilot/phone_numbers/phone_numbers.getter.js.map +1 -1
  131. package/dist/talkpilot/phone_numbers/phone_numbers.schema.js +9 -9
  132. package/dist/talkpilot/phone_numbers/phone_numbers.types.d.ts +1 -1
  133. package/dist/talkpilot/phone_numbers/phone_numbers.types.d.ts.map +1 -1
  134. package/dist/talkpilot/plans/index.d.ts +2 -2
  135. package/dist/talkpilot/plans/plans.getters.d.ts +2 -2
  136. package/dist/talkpilot/plans/plans.getters.d.ts.map +1 -1
  137. package/dist/talkpilot/plans/plans.getters.js +3 -3
  138. package/dist/talkpilot/plans/plans.getters.js.map +1 -1
  139. package/dist/talkpilot/plans/plans.types.d.ts +4 -4
  140. package/dist/talkpilot/plans/plans.types.d.ts.map +1 -1
  141. package/dist/talkpilot/plans/plans.types.js +19 -19
  142. package/dist/talkpilot/results/index.d.ts +2 -2
  143. package/dist/talkpilot/results/index.d.ts.map +1 -1
  144. package/dist/talkpilot/results/index.js.map +1 -1
  145. package/dist/talkpilot/results/results.getter.d.ts +3 -3
  146. package/dist/talkpilot/results/results.getter.d.ts.map +1 -1
  147. package/dist/talkpilot/results/results.getter.js +4 -4
  148. package/dist/talkpilot/results/results.getter.js.map +1 -1
  149. package/dist/talkpilot/results/results.schema.js +18 -18
  150. package/dist/talkpilot/results/results.types.d.ts +1 -1
  151. package/dist/talkpilot/sessions/index.d.ts +2 -2
  152. package/dist/talkpilot/sessions/sessions.getter.d.ts +3 -3
  153. package/dist/talkpilot/sessions/sessions.getter.d.ts.map +1 -1
  154. package/dist/talkpilot/sessions/sessions.getter.js +10 -13
  155. package/dist/talkpilot/sessions/sessions.getter.js.map +1 -1
  156. package/dist/talkpilot/sessions/sessions.schema.js +17 -17
  157. package/dist/talkpilot/sessions/sessions.types.d.ts +2 -2
  158. package/dist/talkpilot/subscriptions/index.d.ts +3 -3
  159. package/dist/talkpilot/subscriptions/subscriptions.getters.d.ts +2 -2
  160. package/dist/talkpilot/subscriptions/subscriptions.getters.d.ts.map +1 -1
  161. package/dist/talkpilot/subscriptions/subscriptions.getters.js +11 -11
  162. package/dist/talkpilot/subscriptions/subscriptions.getters.js.map +1 -1
  163. package/dist/talkpilot/subscriptions/subscriptions.getters.utils.d.ts +2 -2
  164. package/dist/talkpilot/subscriptions/subscriptions.getters.utils.d.ts.map +1 -1
  165. package/dist/talkpilot/subscriptions/subscriptions.getters.utils.js.map +1 -1
  166. package/dist/talkpilot/subscriptions/subscriptions.types.d.ts +2 -2
  167. package/dist/talkpilot/subscriptions/subscriptions.types.d.ts.map +1 -1
  168. package/dist/talkpilot/subscriptions/subscriptions.types.js +7 -7
  169. package/dist/talkpilot/utils/query.utils.d.ts +1 -1
  170. package/dist/test-utils/db-utils.d.ts +1 -1
  171. package/dist/test-utils/db-utils.js +2 -2
  172. package/dist/test-utils/factories/index.d.ts +12 -12
  173. package/dist/test-utils/factories/municipal/cities.d.ts +2 -2
  174. package/dist/test-utils/factories/municipal/cities.d.ts.map +1 -1
  175. package/dist/test-utils/factories/municipal/cities.js +1 -1
  176. package/dist/test-utils/factories/municipal/departmentsSubjects.d.ts +2 -2
  177. package/dist/test-utils/factories/municipal/departmentsSubjects.d.ts.map +1 -1
  178. package/dist/test-utils/factories/municipal/departmentsSubjects.js +1 -7
  179. package/dist/test-utils/factories/municipal/departmentsSubjects.js.map +1 -1
  180. package/dist/test-utils/factories/municipal/streets.d.ts +2 -2
  181. package/dist/test-utils/factories/municipal/streets.d.ts.map +1 -1
  182. package/dist/test-utils/factories/municipal/streets.js +1 -6
  183. package/dist/test-utils/factories/municipal/streets.js.map +1 -1
  184. package/dist/test-utils/factories/municipal/tickets.d.ts +2 -2
  185. package/dist/test-utils/factories/municipal/tickets.d.ts.map +1 -1
  186. package/dist/test-utils/factories/municipal/tickets.js +1 -7
  187. package/dist/test-utils/factories/municipal/tickets.js.map +1 -1
  188. package/dist/test-utils/factories/talkpilot/agents.d.ts +2 -2
  189. package/dist/test-utils/factories/talkpilot/agents.d.ts.map +1 -1
  190. package/dist/test-utils/factories/talkpilot/agents.js +4 -4
  191. package/dist/test-utils/factories/talkpilot/calls.d.ts +2 -2
  192. package/dist/test-utils/factories/talkpilot/calls.d.ts.map +1 -1
  193. package/dist/test-utils/factories/talkpilot/calls.js +1 -1
  194. package/dist/test-utils/factories/talkpilot/clientAudioBuffers.d.ts +2 -2
  195. package/dist/test-utils/factories/talkpilot/clientAudioBuffers.d.ts.map +1 -1
  196. package/dist/test-utils/factories/talkpilot/clientAudioBuffers.js +1 -1
  197. package/dist/test-utils/factories/talkpilot/clientAudioBuffers.js.map +1 -1
  198. package/dist/test-utils/factories/talkpilot/clientsConfig.d.ts +2 -2
  199. package/dist/test-utils/factories/talkpilot/clientsConfig.d.ts.map +1 -1
  200. package/dist/test-utils/factories/talkpilot/clientsConfig.js.map +1 -1
  201. package/dist/test-utils/factories/talkpilot/flows.d.ts +3 -3
  202. package/dist/test-utils/factories/talkpilot/flows.d.ts.map +1 -1
  203. package/dist/test-utils/factories/talkpilot/flows.js.map +1 -1
  204. package/dist/test-utils/factories/talkpilot/groups.d.ts +2 -2
  205. package/dist/test-utils/factories/talkpilot/groups.d.ts.map +1 -1
  206. package/dist/test-utils/factories/talkpilot/groups.js +9 -9
  207. package/dist/test-utils/factories/talkpilot/groups.js.map +1 -1
  208. package/dist/test-utils/factories/talkpilot/phone_numbers.d.ts +3 -3
  209. package/dist/test-utils/factories/talkpilot/phone_numbers.d.ts.map +1 -1
  210. package/dist/test-utils/factories/talkpilot/phone_numbers.js.map +1 -1
  211. package/dist/test-utils/factories/talkpilot/sessions.d.ts +2 -2
  212. package/dist/test-utils/factories/talkpilot/sessions.d.ts.map +1 -1
  213. package/dist/test-utils/factories/talkpilot/sessions.js +1 -1
  214. package/dist/utils/validation.js +2 -2
  215. package/dist/utils/validation.js.map +1 -1
  216. package/package.json +1 -3
  217. package/src/__tests__/setup.ts +3 -3
  218. package/src/connection.ts +25 -27
  219. package/src/index.ts +9 -9
  220. package/src/municipal/__tests__/validation.spec.ts +23 -35
  221. package/src/municipal/cities/cities.getters.ts +10 -16
  222. package/src/municipal/cities/cities.types.ts +1 -1
  223. package/src/municipal/cities/index.ts +2 -2
  224. package/src/municipal/departmentsSubjects/departmentsSubjects.getters.ts +44 -53
  225. package/src/municipal/departmentsSubjects/departmentsSubjects.types.ts +5 -5
  226. package/src/municipal/departmentsSubjects/index.ts +3 -2
  227. package/src/municipal/index.ts +10 -10
  228. package/src/municipal/mongodb-client.ts +10 -13
  229. package/src/municipal/streets/index.ts +2 -2
  230. package/src/municipal/streets/streets.getters.ts +23 -43
  231. package/src/municipal/streets/streets.types.ts +1 -1
  232. package/src/municipal/systemInstructions/__tests__/getters.spec.ts +52 -67
  233. package/src/municipal/systemInstructions/__tests__/setters.spec.ts +238 -271
  234. package/src/municipal/systemInstructions/index.ts +3 -7
  235. package/src/municipal/systemInstructions/instructions.getters.ts +18 -30
  236. package/src/municipal/systemInstructions/instructions.setters.ts +19 -43
  237. package/src/municipal/systemInstructions/instructions.types.ts +10 -10
  238. package/src/municipal/tickets/__tests__/tickets.getters.spec.ts +12 -12
  239. package/src/municipal/tickets/index.ts +2 -2
  240. package/src/municipal/tickets/tickets.getters.ts +42 -69
  241. package/src/municipal/tickets/tickets.types.ts +2 -2
  242. package/src/municipal/utils/types.ts +3 -8
  243. package/src/talkpilot/__tests__/db.spec.ts +12 -12
  244. package/src/talkpilot/__tests__/mongodb-client.spec.ts +8 -7
  245. package/src/talkpilot/__tests__/validation.spec.ts +24 -30
  246. package/src/talkpilot/agents/__tests__/agents.getters.spec.ts +10 -10
  247. package/src/talkpilot/agents/agents.getters.ts +3 -3
  248. package/src/talkpilot/agents/agents.types.ts +2 -2
  249. package/src/talkpilot/agents/index.ts +2 -2
  250. package/src/talkpilot/backgroundToolResults/__tests__/backgroundToolResults.getters.spec.ts +31 -42
  251. package/src/talkpilot/backgroundToolResults/backgroundToolResults.getters.ts +11 -11
  252. package/src/talkpilot/backgroundToolResults/backgroundToolResults.types.ts +3 -2
  253. package/src/talkpilot/backgroundToolResults/index.ts +2 -2
  254. package/src/talkpilot/calls/__tests__/callStats.utils.spec.ts +27 -27
  255. package/src/talkpilot/calls/__tests__/calls.spec.ts +39 -79
  256. package/src/talkpilot/calls/calls.getters.ts +28 -48
  257. package/src/talkpilot/calls/calls.types.ts +16 -16
  258. package/src/talkpilot/calls/index.ts +2 -2
  259. package/src/talkpilot/clientAudioBuffers/__tests__/clientAudioBuffer.getters.spec.ts +39 -73
  260. package/src/talkpilot/clientAudioBuffers/clientAudioBuffer.getters.ts +11 -18
  261. package/src/talkpilot/clientAudioBuffers/clientsAudioBuffers.types.ts +2 -2
  262. package/src/talkpilot/clientAudioBuffers/index.ts +2 -2
  263. package/src/talkpilot/clients/clients.getters.ts +5 -10
  264. package/src/talkpilot/clients/clients.types.ts +1 -1
  265. package/src/talkpilot/clients/index.ts +2 -2
  266. package/src/talkpilot/clientsConfig/__tests__/clientsConfig.spec.ts +18 -21
  267. package/src/talkpilot/clientsConfig/clientsConfig.getters.ts +4 -6
  268. package/src/talkpilot/clientsConfig/clientsConfig.types.ts +8 -10
  269. package/src/talkpilot/clientsConfig/index.ts +2 -2
  270. package/src/talkpilot/flows/__tests__/flows.schema.spec.ts +37 -38
  271. package/src/talkpilot/flows/flows.getter.ts +5 -8
  272. package/src/talkpilot/flows/flows.schema.ts +80 -87
  273. package/src/talkpilot/flows/flows.types.ts +24 -23
  274. package/src/talkpilot/flows/index.ts +2 -2
  275. package/src/talkpilot/groups/__tests__/groups.spec.ts +27 -34
  276. package/src/talkpilot/groups/__tests__/phone.utils.spec.ts +20 -20
  277. package/src/talkpilot/groups/groups.getters.ts +5 -8
  278. package/src/talkpilot/groups/groups.types.ts +1 -1
  279. package/src/talkpilot/groups/index.ts +3 -3
  280. package/src/talkpilot/groups/phone.utils.ts +6 -12
  281. package/src/talkpilot/index.ts +17 -17
  282. package/src/talkpilot/leads/index.ts +2 -2
  283. package/src/talkpilot/leads/leads.getter.ts +4 -5
  284. package/src/talkpilot/leads/leads.schema.ts +16 -16
  285. package/src/talkpilot/leads/leads.types.ts +1 -1
  286. package/src/talkpilot/mongodb-client.ts +12 -12
  287. package/src/talkpilot/phone_numbers/__tests__/phone_numbers.spec.ts +44 -84
  288. package/src/talkpilot/phone_numbers/index.ts +2 -2
  289. package/src/talkpilot/phone_numbers/phone_numbers.getter.ts +22 -44
  290. package/src/talkpilot/phone_numbers/phone_numbers.schema.ts +9 -9
  291. package/src/talkpilot/phone_numbers/phone_numbers.types.ts +1 -1
  292. package/src/talkpilot/plans/__tests__/plans.spec.ts +26 -30
  293. package/src/talkpilot/plans/index.ts +2 -2
  294. package/src/talkpilot/plans/plans.getters.ts +18 -25
  295. package/src/talkpilot/plans/plans.types.ts +23 -27
  296. package/src/talkpilot/results/index.ts +2 -5
  297. package/src/talkpilot/results/results.getter.ts +8 -9
  298. package/src/talkpilot/results/results.schema.ts +18 -18
  299. package/src/talkpilot/results/results.types.ts +1 -1
  300. package/src/talkpilot/sessions/__tests__/sessions.spec.ts +41 -65
  301. package/src/talkpilot/sessions/index.ts +2 -2
  302. package/src/talkpilot/sessions/sessions.getter.ts +16 -21
  303. package/src/talkpilot/sessions/sessions.schema.ts +17 -17
  304. package/src/talkpilot/sessions/sessions.types.ts +2 -2
  305. package/src/talkpilot/subscriptions/__tests__/subscriptions.getters.utils.spec.ts +15 -18
  306. package/src/talkpilot/subscriptions/index.ts +3 -3
  307. package/src/talkpilot/subscriptions/subscriptions.getters.ts +33 -36
  308. package/src/talkpilot/subscriptions/subscriptions.getters.utils.ts +3 -10
  309. package/src/talkpilot/subscriptions/subscriptions.types.ts +9 -9
  310. package/src/talkpilot/utils/__tests__/query.utils.spec.ts +8 -8
  311. package/src/talkpilot/utils/query.utils.ts +2 -2
  312. package/src/test-utils/db-utils.ts +5 -5
  313. package/src/test-utils/factories/index.ts +12 -12
  314. package/src/test-utils/factories/municipal/cities.ts +5 -5
  315. package/src/test-utils/factories/municipal/departmentsSubjects.ts +25 -32
  316. package/src/test-utils/factories/municipal/streets.ts +5 -10
  317. package/src/test-utils/factories/municipal/tickets.ts +6 -12
  318. package/src/test-utils/factories/talkpilot/agents.ts +8 -8
  319. package/src/test-utils/factories/talkpilot/calls.ts +5 -5
  320. package/src/test-utils/factories/talkpilot/clientAudioBuffers.ts +12 -14
  321. package/src/test-utils/factories/talkpilot/clientsConfig.ts +8 -7
  322. package/src/test-utils/factories/talkpilot/flows.ts +5 -7
  323. package/src/test-utils/factories/talkpilot/groups.ts +13 -13
  324. package/src/test-utils/factories/talkpilot/phone_numbers.ts +6 -8
  325. package/src/test-utils/factories/talkpilot/sessions.ts +5 -5
  326. package/src/utils/validation.ts +4 -4
  327. package/dist/talkpilot/subscriptions/subscriptions.utils.d.ts +0 -4
  328. package/dist/talkpilot/subscriptions/subscriptions.utils.d.ts.map +0 -1
  329. package/dist/talkpilot/subscriptions/subscriptions.utils.js +0 -20
  330. package/dist/talkpilot/subscriptions/subscriptions.utils.js.map +0 -1
@@ -1,34 +1,34 @@
1
1
  export const sessionMongoSchema = {
2
- bsonType: "object",
3
- required: ["session_name"],
2
+ bsonType: 'object',
3
+ required: ['session_name'],
4
4
  properties: {
5
- _id: { bsonType: "objectId" },
6
- session_name: { bsonType: "string" },
7
- company_name: { bsonType: ["string", "null"] },
8
- flow_id: { bsonType: ["objectId", "string", "null"] },
5
+ _id: { bsonType: 'objectId' },
6
+ session_name: { bsonType: 'string' },
7
+ company_name: { bsonType: ['string', 'null'] },
8
+ flow_id: { bsonType: ['objectId', 'string', 'null'] },
9
9
  metaKeys: {
10
- bsonType: ["array", "null"],
10
+ bsonType: ['array', 'null'],
11
11
  items: {
12
- bsonType: "object",
13
- required: ["key"],
12
+ bsonType: 'object',
13
+ required: ['key'],
14
14
  properties: {
15
- key: { bsonType: "string" },
16
- value: { bsonType: "string" },
15
+ key: { bsonType: 'string' },
16
+ value: { bsonType: 'string' },
17
17
  },
18
18
  },
19
19
  },
20
20
  phone_numbers: {
21
- bsonType: "array",
21
+ bsonType: 'array',
22
22
  items: {
23
- bsonType: "object",
24
- required: ["name", "phoneNumber"],
23
+ bsonType: 'object',
24
+ required: ['name', 'phoneNumber'],
25
25
  properties: {
26
- name: { bsonType: "string" },
27
- phoneNumber: { bsonType: "string" },
26
+ name: { bsonType: 'string' },
27
+ phoneNumber: { bsonType: 'string' },
28
28
  },
29
29
  },
30
30
  },
31
- voice: { bsonType: ["string", "null"] },
31
+ voice: { bsonType: ['string', 'null'] },
32
32
  },
33
33
  additionalProperties: false,
34
34
  } as const;
@@ -1,4 +1,4 @@
1
- import { ObjectId } from "mongodb";
1
+ import { ObjectId } from 'mongodb';
2
2
 
3
3
  export type Session = {
4
4
  _id?: ObjectId;
@@ -16,7 +16,7 @@ export type Session = {
16
16
  phone_numbers: Array<{
17
17
  name: string;
18
18
  phoneNumber: string;
19
- gender: "male" | "female";
19
+ gender: 'male' | 'female';
20
20
  }>;
21
21
 
22
22
  voice?: string | null;
@@ -1,40 +1,37 @@
1
- import { ObjectId } from "mongodb";
2
- import {
3
- buildSimpleQuery,
4
- buildDateRangeFilter,
5
- } from "../subscriptions.getters.utils";
6
- import { SimpleSubscriptionFilter } from "../subscriptions.types";
1
+ import { ObjectId } from 'mongodb';
2
+ import { buildSimpleQuery, buildDateRangeFilter } from '../subscriptions.getters.utils';
3
+ import { SimpleSubscriptionFilter } from '../subscriptions.types';
7
4
 
8
- describe("subscriptions.getters.utils", () => {
9
- describe("buildSimpleQuery", () => {
10
- it("returns empty query when filter is empty", () => {
5
+ describe('subscriptions.getters.utils', () => {
6
+ describe('buildSimpleQuery', () => {
7
+ it('returns empty query when filter is empty', () => {
11
8
  const filter: SimpleSubscriptionFilter = {};
12
9
  const result = buildSimpleQuery(filter);
13
10
  expect(result).toEqual({});
14
11
  });
15
12
 
16
- it("converts _id string to ObjectId", () => {
17
- const id = "507f1f77bcf86cd799439011";
13
+ it('converts _id string to ObjectId', () => {
14
+ const id = '507f1f77bcf86cd799439011';
18
15
  const filter: SimpleSubscriptionFilter = { _id: id };
19
16
  const result = buildSimpleQuery(filter);
20
17
  expect(result._id).toBeInstanceOf(ObjectId);
21
18
  expect((result._id as ObjectId).toHexString()).toBe(id);
22
19
  });
23
20
 
24
- it("includes valid simple fields", () => {
21
+ it('includes valid simple fields', () => {
25
22
  const filter: SimpleSubscriptionFilter = {
26
- clientId: "abc",
23
+ clientId: 'abc',
27
24
  isActive: true,
28
25
  };
29
26
  const result = buildSimpleQuery(filter);
30
- expect(result).toEqual({ clientId: "abc", isActive: true });
27
+ expect(result).toEqual({ clientId: 'abc', isActive: true });
31
28
  });
32
29
  });
33
30
 
34
- describe("buildDateRangeFilter", () => {
35
- it("returns a mongo date range filter", () => {
36
- const from = new Date("2023-01-01");
37
- const to = new Date("2023-01-02");
31
+ describe('buildDateRangeFilter', () => {
32
+ it('returns a mongo date range filter', () => {
33
+ const from = new Date('2023-01-01');
34
+ const to = new Date('2023-01-02');
38
35
  const result = buildDateRangeFilter(from, to);
39
36
  expect(result).toEqual({
40
37
  $gte: from,
@@ -1,3 +1,3 @@
1
- export * from "./subscriptions.types";
2
- export * from "./subscriptions.getters";
3
- export * from "./subscriptions.getters.utils";
1
+ export * from './subscriptions.types';
2
+ export * from './subscriptions.getters';
3
+ export * from './subscriptions.getters.utils';
@@ -1,17 +1,17 @@
1
- import { getDb } from "../index";
1
+ import {getDb} from '../index';
2
2
  import {
3
3
  SimpleSubscriptionFilter,
4
4
  Subscription,
5
5
  SubscriptionDoc,
6
6
  SubscriptionFilter,
7
7
  SubscriptionQueryOptions,
8
- } from "./subscriptions.types";
9
- import { Filter, ObjectId } from "mongodb";
10
- import { buildSimpleQuery } from "./subscriptions.getters.utils";
11
- import { applyQueryOptions } from "../utils/query.utils";
8
+ } from './subscriptions.types';
9
+ import {Filter, ObjectId} from 'mongodb';
10
+ import {buildSimpleQuery} from './subscriptions.getters.utils';
11
+ import {applyQueryOptions} from '../utils/query.utils';
12
12
 
13
13
  export const getSubscriptionsCollection = () => {
14
- return getDb().collection<Subscription>("subscriptions");
14
+ return getDb().collection<Subscription>('subscriptions');
15
15
  };
16
16
 
17
17
  /**
@@ -20,7 +20,7 @@ export const getSubscriptionsCollection = () => {
20
20
 
21
21
  export const findSubscriptions = async (
22
22
  filter?: SubscriptionFilter,
23
- options?: SubscriptionQueryOptions,
23
+ options?: SubscriptionQueryOptions
24
24
  ): Promise<SubscriptionDoc[]> => {
25
25
  let query: Filter<Subscription> = {};
26
26
 
@@ -51,14 +51,12 @@ export const findSubscriptions = async (
51
51
  return await applyQueryOptions(cursor, options).toArray();
52
52
  };
53
53
 
54
- export const countSubscriptions = async (
55
- query: Filter<Subscription>,
56
- ): Promise<number> => {
54
+ export const countSubscriptions = async (query: Filter<Subscription>): Promise<number> => {
57
55
  return getSubscriptionsCollection().countDocuments(query);
58
56
  };
59
57
 
60
58
  export const createSubscriptionDoc = async (
61
- subscriptionData: Omit<Subscription, "createdAt" | "updatedAt">,
59
+ subscriptionData: Omit<Subscription, 'createdAt' | 'updatedAt'>
62
60
  ): Promise<SubscriptionDoc> => {
63
61
  const now = new Date();
64
62
  const result = await getSubscriptionsCollection().insertOne({
@@ -68,14 +66,13 @@ export const createSubscriptionDoc = async (
68
66
  });
69
67
 
70
68
  const subscriptions = await findSubscriptions({ _id: result.insertedId });
71
- if (!subscriptions[0])
72
- throw new Error("Failed to retrieve created subscription");
69
+ if (!subscriptions[0]) throw new Error('Failed to retrieve created subscription');
73
70
  return subscriptions[0];
74
71
  };
75
72
 
76
73
  export const updateSubscriptionDoc = async (
77
74
  subscriptionId: ObjectId,
78
- updates: Partial<Subscription>,
75
+ updates: Partial<Subscription>
79
76
  ): Promise<SubscriptionDoc | null> => {
80
77
  return await getSubscriptionsCollection().findOneAndUpdate(
81
78
  { _id: subscriptionId },
@@ -86,61 +83,61 @@ export const updateSubscriptionDoc = async (
86
83
  },
87
84
  },
88
85
  {
89
- returnDocument: "after",
90
- },
86
+ returnDocument: 'after',
87
+ }
91
88
  );
92
89
  };
93
90
 
94
91
  export const incrementSubscriptionUsage = async (
95
92
  subscriptionId: ObjectId,
96
- amount: number = 1,
93
+ amount: number = 1
97
94
  ): Promise<SubscriptionDoc | null> => {
98
- const fieldToIncrement = "cycles.$[activeCycle].usage.usedCalls";
95
+ const fieldToIncrement = 'cycles.$[activeCycle].usage.usedCalls';
99
96
  return await getSubscriptionsCollection().findOneAndUpdate(
100
- { _id: subscriptionId, "cycles.isActive": true },
97
+ { _id: subscriptionId, 'cycles.isActive': true },
101
98
  {
102
99
  $inc: { [fieldToIncrement]: amount },
103
100
  $set: { updatedAt: new Date() },
104
101
  },
105
102
  {
106
- arrayFilters: [{ "activeCycle.isActive": true }],
107
- returnDocument: "after",
108
- },
103
+ arrayFilters: [{ 'activeCycle.isActive': true }],
104
+ returnDocument: 'after',
105
+ }
109
106
  );
110
107
  };
111
108
 
112
109
  export const deactivateCurrentSubscriptionCycle = async (
113
110
  subscriptionId: ObjectId,
114
- nextRenewalDate: Date,
111
+ nextRenewalDate: Date
115
112
  ): Promise<void> => {
116
113
  await getSubscriptionsCollection().updateOne(
117
- { _id: subscriptionId, "cycles.isActive": true },
114
+ { _id: subscriptionId, 'cycles.isActive': true },
118
115
  {
119
116
  $set: {
120
- "cycles.$[activeCycle].isActive": false,
117
+ 'cycles.$[activeCycle].isActive': false,
121
118
  nextRenewalDate: nextRenewalDate,
122
119
  updatedAt: new Date(),
123
120
  },
124
121
  },
125
122
  {
126
- arrayFilters: [{ "activeCycle.isActive": true }],
127
- },
123
+ arrayFilters: [{ 'activeCycle.isActive': true }],
124
+ }
128
125
  );
129
126
  };
130
127
 
131
128
  export const pushNewSubscriptionCycle = async (
132
129
  subscriptionId: ObjectId,
133
- newCycle: Subscription["cycles"][number],
130
+ newCycle: Subscription['cycles'][number]
134
131
  ): Promise<SubscriptionDoc | null> => {
135
132
  return await getSubscriptionsCollection().findOneAndUpdate(
136
- { _id: subscriptionId },
137
- {
138
- $push: {
139
- cycles: newCycle,
133
+ {_id: subscriptionId},
134
+ {
135
+ $push: {
136
+ cycles: newCycle,
137
+ },
140
138
  },
141
- },
142
- {
143
- returnDocument: "after",
144
- },
139
+ {
140
+ returnDocument: 'after',
141
+ }
145
142
  );
146
143
  };
@@ -1,14 +1,7 @@
1
- import { ObjectId, Filter } from "mongodb";
2
- import {
3
- Subscription,
4
- SimpleSubscriptionFilter,
5
- simpleFields,
6
- SimpleField,
7
- } from "../index";
1
+ import { ObjectId, Filter } from 'mongodb';
2
+ import { Subscription, SimpleSubscriptionFilter, simpleFields, SimpleField } from '../index';
8
3
 
9
- export const buildSimpleQuery = (
10
- filter: SimpleSubscriptionFilter,
11
- ): Filter<Subscription> => {
4
+ export const buildSimpleQuery = (filter: SimpleSubscriptionFilter): Filter<Subscription> => {
12
5
  const query: Filter<Subscription> = {};
13
6
 
14
7
  if (filter._id) {
@@ -1,5 +1,5 @@
1
- import { Filter, ObjectId, WithId, Sort } from "mongodb";
2
- import { PlanDoc } from "../plans";
1
+ import { Filter, ObjectId, WithId, Sort } from 'mongodb';
2
+ import { PlanDoc } from '../plans/plans.types';
3
3
 
4
4
  export type SubscriptionCycle = {
5
5
  usage: {
@@ -29,13 +29,13 @@ export type Subscriptions = SubscriptionDoc[];
29
29
 
30
30
  // Define which Subscription fields we allow in a simple filter
31
31
  export const simpleFields = [
32
- "clientId",
33
- "planId",
34
- "startDate",
35
- "endDate",
36
- "isActive",
37
- "createdAt",
38
- "nextRenewalDate",
32
+ 'clientId',
33
+ 'planId',
34
+ 'startDate',
35
+ 'endDate',
36
+ 'isActive',
37
+ 'createdAt',
38
+ 'nextRenewalDate',
39
39
  ] as const;
40
40
  export type SimpleField = (typeof simpleFields)[number];
41
41
 
@@ -1,7 +1,7 @@
1
- import { applyQueryOptions } from "../query.utils";
1
+ import { applyQueryOptions } from '../query.utils';
2
2
 
3
- describe("query.utils", () => {
4
- describe("applyQueryOptions()", () => {
3
+ describe('query.utils', () => {
4
+ describe('applyQueryOptions()', () => {
5
5
  let mockCursor: any;
6
6
 
7
7
  beforeEach(() => {
@@ -12,13 +12,13 @@ describe("query.utils", () => {
12
12
  };
13
13
  });
14
14
 
15
- it("should return cursor if no options provided", () => {
15
+ it('should return cursor if no options provided', () => {
16
16
  const result = applyQueryOptions(mockCursor);
17
17
  expect(result).toBe(mockCursor);
18
18
  expect(mockCursor.sort).not.toHaveBeenCalled();
19
19
  });
20
20
 
21
- it("should apply sort, skip, and limit", () => {
21
+ it('should apply sort, skip, and limit', () => {
22
22
  const options = {
23
23
  sort: { name: 1 },
24
24
  skip: 10,
@@ -26,20 +26,20 @@ describe("query.utils", () => {
26
26
  };
27
27
 
28
28
  const result = applyQueryOptions(mockCursor, options);
29
-
29
+
30
30
  expect(result).toBe(mockCursor);
31
31
  expect(mockCursor.sort).toHaveBeenCalledWith({ name: 1 });
32
32
  expect(mockCursor.skip).toHaveBeenCalledWith(10);
33
33
  expect(mockCursor.limit).toHaveBeenCalledWith(5);
34
34
  });
35
35
 
36
- it("should apply only sort if skip and limit are missing", () => {
36
+ it('should apply only sort if skip and limit are missing', () => {
37
37
  const options = {
38
38
  sort: { name: 1 },
39
39
  };
40
40
 
41
41
  const result = applyQueryOptions(mockCursor, options);
42
-
42
+
43
43
  expect(result).toBe(mockCursor);
44
44
  expect(mockCursor.sort).toHaveBeenCalledWith({ name: 1 });
45
45
  expect(mockCursor.skip).not.toHaveBeenCalled();
@@ -1,4 +1,4 @@
1
- import { FindCursor } from "mongodb";
1
+ import { FindCursor } from 'mongodb';
2
2
 
3
3
  export type QueryOptions = {
4
4
  sort?: any;
@@ -8,7 +8,7 @@ export type QueryOptions = {
8
8
 
9
9
  export const applyQueryOptions = <T>(
10
10
  cursor: FindCursor<T>,
11
- options?: QueryOptions,
11
+ options?: QueryOptions
12
12
  ): FindCursor<T> => {
13
13
  if (!options) return cursor;
14
14
 
@@ -1,18 +1,18 @@
1
- import { MongoMemoryServer } from "mongodb-memory-server";
2
- import { MongoClient, Db } from "mongodb";
3
- import { setDb, setMunicipalDataDb } from "../index";
1
+ import { MongoMemoryServer } from 'mongodb-memory-server';
2
+ import { MongoClient, Db } from 'mongodb';
3
+ import { setDb, setMunicipalDataDb } from '../index';
4
4
 
5
5
  let mongoServer: MongoMemoryServer;
6
6
  let client: MongoClient;
7
7
 
8
8
  export async function initTestDb(): Promise<Db> {
9
9
  mongoServer = await MongoMemoryServer.create({
10
- instance: { ip: "127.0.0.1" },
10
+ instance: { ip: '127.0.0.1' },
11
11
  });
12
12
  client = new MongoClient(mongoServer.getUri());
13
13
  await client.connect();
14
14
  const talkpilotDb = client.db();
15
- const municipalDb = client.db("municipal-data");
15
+ const municipalDb = client.db('municipal-data');
16
16
  setDb(talkpilotDb);
17
17
  setMunicipalDataDb(municipalDb);
18
18
  return talkpilotDb;
@@ -1,12 +1,12 @@
1
- export * from "./talkpilot/agents";
2
- export * from "./talkpilot/calls";
3
- export * from "./talkpilot/clientAudioBuffers";
4
- export * from "./talkpilot/clientsConfig";
5
- export * from "./talkpilot/flows";
6
- export * from "./talkpilot/groups";
7
- export * from "./talkpilot/phone_numbers";
8
- export * from "./talkpilot/sessions";
9
- export * from "./municipal/cities";
10
- export * from "./municipal/departmentsSubjects";
11
- export * from "./municipal/streets";
12
- export * from "./municipal/tickets";
1
+ export * from './talkpilot/agents';
2
+ export * from './talkpilot/calls';
3
+ export * from './talkpilot/clientAudioBuffers';
4
+ export * from './talkpilot/clientsConfig';
5
+ export * from './talkpilot/flows';
6
+ export * from './talkpilot/groups';
7
+ export * from './talkpilot/phone_numbers';
8
+ export * from './talkpilot/sessions';
9
+ export * from './municipal/cities';
10
+ export * from './municipal/departmentsSubjects';
11
+ export * from './municipal/streets';
12
+ export * from './municipal/tickets';
@@ -1,11 +1,11 @@
1
- import { Factory } from "fishery";
2
- import { ObjectId } from "mongodb";
3
- import { faker } from "@faker-js/faker";
4
- import type { City } from "../../../municipal";
1
+ import { Factory } from 'fishery';
2
+ import { ObjectId } from 'mongodb';
3
+ import { faker } from '@faker-js/faker';
4
+ import type { City } from '../../../municipal/cities/cities.types';
5
5
 
6
6
  export const cityFactory = Factory.define<City>(() => ({
7
7
  _id: new ObjectId(),
8
- name: faker.location.city().toLowerCase().replace(/\s/g, "_"),
8
+ name: faker.location.city().toLowerCase().replace(/\s/g, '_'),
9
9
  displayName: faker.location.city(),
10
10
  createdAt: new Date(),
11
11
  updatedAt: new Date(),
@@ -1,37 +1,30 @@
1
- import { Factory } from "fishery";
2
- import { ObjectId } from "mongodb";
3
- import { faker } from "@faker-js/faker";
4
- import type { DepartmentSubject } from "../../../municipal";
5
- import { CityName } from "../../../municipal";
1
+ import { Factory } from 'fishery';
2
+ import { ObjectId } from 'mongodb';
3
+ import { faker } from '@faker-js/faker';
4
+ import type {
5
+ DepartmentSubject,
6
6
 
7
- const VALID_CITIES: CityName[] = [
8
- "ashdod",
9
- "maltar",
10
- "billit",
11
- "hashkelon",
12
- "tests",
13
- ];
7
+ } from '../../../municipal/departmentsSubjects/departmentsSubjects.types';
8
+ import {CityName} from "../../../municipal";
14
9
 
15
- export const departmentSubjectFactory = Factory.define<DepartmentSubject>(
16
- () => ({
17
- _id: new ObjectId(),
18
- createdAt: new Date(),
19
- updatedAt: new Date(),
20
- subjectName: faker.lorem.words(2),
21
- subject_id: faker.string.numeric(4),
22
- sub_subject_name: faker.lorem.word(),
23
- sub_subject_id: faker.string.numeric(4),
24
- descriptions: [faker.lorem.sentence()],
25
- cityName: faker.helpers.arrayElement(VALID_CITIES),
26
- guidelines: null,
27
- instructions: [],
28
- communications: [],
29
- sla: faker.number.int({ min: 24, max: 720 }),
30
- }),
31
- );
10
+ const VALID_CITIES: CityName[] = ['ashdod', 'maltar', 'billit', 'hashkelon', 'tests'];
32
11
 
33
- export function createDepartmentSubject(
34
- overrides?: Partial<DepartmentSubject>,
35
- ): DepartmentSubject {
12
+ export const departmentSubjectFactory = Factory.define<DepartmentSubject>(() => ({
13
+ _id: new ObjectId(),
14
+ createdAt: new Date(),
15
+ updatedAt: new Date(),
16
+ subjectName: faker.lorem.words(2),
17
+ subject_id: faker.string.numeric(4),
18
+ sub_subject_name: faker.lorem.word(),
19
+ sub_subject_id: faker.string.numeric(4),
20
+ descriptions: [faker.lorem.sentence()],
21
+ cityName: faker.helpers.arrayElement(VALID_CITIES),
22
+ guidelines: null,
23
+ instructions: [],
24
+ communications: [],
25
+ sla: faker.number.int({ min: 24, max: 720 }),
26
+ }));
27
+
28
+ export function createDepartmentSubject(overrides?: Partial<DepartmentSubject>): DepartmentSubject {
36
29
  return departmentSubjectFactory.build(overrides);
37
30
  }
@@ -1,7 +1,7 @@
1
- import { Factory } from "fishery";
2
- import { ObjectId } from "mongodb";
3
- import { faker } from "@faker-js/faker";
4
- import type { Street } from "../../../municipal";
1
+ import { Factory } from 'fishery';
2
+ import { ObjectId } from 'mongodb';
3
+ import { faker } from '@faker-js/faker';
4
+ import type { Street } from '../../../municipal/streets/streets.types';
5
5
 
6
6
  export const streetFactory = Factory.define<Street>(() => ({
7
7
  _id: new ObjectId(),
@@ -9,12 +9,7 @@ export const streetFactory = Factory.define<Street>(() => ({
9
9
  updatedAt: new Date(),
10
10
  id: faker.string.uuid(),
11
11
  name: faker.location.street(),
12
- cityName: faker.helpers.arrayElement([
13
- "ashdod",
14
- "maltar",
15
- "billit",
16
- "hashkelon",
17
- ]),
12
+ cityName: faker.helpers.arrayElement(['ashdod', 'maltar', 'billit', 'hashkelon']),
18
13
  }));
19
14
 
20
15
  export function createStreet(overrides?: Partial<Street>): Street {
@@ -1,16 +1,10 @@
1
- import { Factory } from "fishery";
2
- import { ObjectId } from "mongodb";
3
- import { faker } from "@faker-js/faker";
4
- import type { Ticket } from "../../../municipal";
5
- import { CityName } from "../../../municipal";
1
+ import { Factory } from 'fishery';
2
+ import { ObjectId } from 'mongodb';
3
+ import { faker } from '@faker-js/faker';
4
+ import type { Ticket } from '../../../municipal/tickets/tickets.types';
5
+ import {CityName} from "../../../municipal";
6
6
 
7
- const VALID_CITIES: CityName[] = [
8
- "ashdod",
9
- "maltar",
10
- "billit",
11
- "hashkelon",
12
- "tests",
13
- ];
7
+ const VALID_CITIES: CityName[] = ['ashdod', 'maltar', 'billit', 'hashkelon', 'tests'];
14
8
 
15
9
  export const ticketFactory = Factory.define<Ticket>(() => ({
16
10
  _id: new ObjectId(),
@@ -1,17 +1,17 @@
1
- import { Factory } from "fishery";
2
- import { ObjectId } from "mongodb";
3
- import { faker } from "@faker-js/faker";
4
- import type { Agent } from "../../../talkpilot";
1
+ import { Factory } from 'fishery';
2
+ import { ObjectId } from 'mongodb';
3
+ import { faker } from '@faker-js/faker';
4
+ import type { Agent } from '../../../talkpilot/agents/agents.types';
5
5
 
6
6
  export const agentFactory = Factory.define<Agent>(() => ({
7
7
  name: faker.person.fullName(),
8
- language: "en",
9
- voice: "alloy",
8
+ language: 'en',
9
+ voice: 'alloy',
10
10
  instructions: faker.lorem.paragraph(),
11
11
  labels: [],
12
12
  clientId: new ObjectId().toString(),
13
- role: "assistant",
14
- gender: faker.helpers.arrayElement(["male", "female"]),
13
+ role: 'assistant',
14
+ gender: faker.helpers.arrayElement(['male', 'female']),
15
15
  }));
16
16
 
17
17
  export function createAgent(overrides?: Partial<Agent>): Agent {
@@ -1,7 +1,7 @@
1
- import { Factory } from "fishery";
2
- import { ObjectId } from "mongodb";
3
- import { faker } from "@faker-js/faker";
4
- import type { Call } from "../../../talkpilot";
1
+ import { Factory } from 'fishery';
2
+ import { ObjectId } from 'mongodb';
3
+ import { faker } from '@faker-js/faker';
4
+ import type { Call } from '../../../talkpilot/calls/calls.types';
5
5
 
6
6
  export const callFactory = Factory.define<Call>(() => ({
7
7
  callSid: faker.string.uuid(),
@@ -14,7 +14,7 @@ export const callFactory = Factory.define<Call>(() => ({
14
14
  isIncomingCall: false,
15
15
  isOutgoingCall: true,
16
16
  callLength: faker.number.int({ min: 0, max: 3600 }),
17
- env: "test",
17
+ env: 'test',
18
18
  updatedAt: new Date(),
19
19
  createdAt: new Date(),
20
20
  }));