grm-shared-library 1.1.236 → 1.1.237

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 (247) hide show
  1. package/README.md +24 -0
  2. package/dist/cjs/index.js +1 -0
  3. package/dist/cjs/index.js.map +1 -1
  4. package/dist/cjs/kafka/topics.js +10 -0
  5. package/dist/cjs/kafka/topics.js.map +1 -1
  6. package/dist/cjs/modules/dispatch/constants/response-unit-dispatch-defaults.const.js +55 -0
  7. package/dist/cjs/modules/dispatch/constants/response-unit-dispatch-defaults.const.js.map +1 -0
  8. package/dist/cjs/modules/dispatch/constants/response-unit-dispatch-kafka.const.js +21 -0
  9. package/dist/cjs/modules/dispatch/constants/response-unit-dispatch-kafka.const.js.map +1 -0
  10. package/dist/cjs/modules/dispatch/dtos/dispatch-response-unit.dto.js +58 -0
  11. package/dist/cjs/modules/dispatch/dtos/dispatch-response-unit.dto.js.map +1 -0
  12. package/dist/cjs/modules/dispatch/dtos/response-unit-dispatch-notification.dto.js +230 -0
  13. package/dist/cjs/modules/dispatch/dtos/response-unit-dispatch-notification.dto.js.map +1 -0
  14. package/dist/cjs/modules/dispatch/dtos/response-unit-dispatch-profile-query.dto.js +61 -0
  15. package/dist/cjs/modules/dispatch/dtos/response-unit-dispatch-profile-query.dto.js.map +1 -0
  16. package/dist/cjs/modules/dispatch/dtos/response-unit-nearby-query.dto.js +66 -0
  17. package/dist/cjs/modules/dispatch/dtos/response-unit-nearby-query.dto.js.map +1 -0
  18. package/dist/cjs/modules/dispatch/dtos/update-response-unit-dispatch-status.dto.js +41 -0
  19. package/dist/cjs/modules/dispatch/dtos/update-response-unit-dispatch-status.dto.js.map +1 -0
  20. package/dist/cjs/modules/dispatch/enums/incident-dispatch-blocker.enum.js +21 -0
  21. package/dist/cjs/modules/dispatch/enums/incident-dispatch-blocker.enum.js.map +1 -0
  22. package/dist/cjs/modules/dispatch/enums/response-capability-requirement-source.enum.js +12 -0
  23. package/dist/cjs/modules/dispatch/enums/response-capability-requirement-source.enum.js.map +1 -0
  24. package/dist/cjs/modules/dispatch/enums/response-unit-capability-match.enum.js +24 -0
  25. package/dist/cjs/modules/dispatch/enums/response-unit-capability-match.enum.js.map +1 -0
  26. package/dist/cjs/modules/dispatch/enums/response-unit-dispatch-constraint.enum.js +34 -0
  27. package/dist/cjs/modules/dispatch/enums/response-unit-dispatch-constraint.enum.js.map +1 -0
  28. package/dist/cjs/modules/dispatch/enums/response-unit-dispatch-error-code.enum.js +26 -0
  29. package/dist/cjs/modules/dispatch/enums/response-unit-dispatch-error-code.enum.js.map +1 -0
  30. package/dist/cjs/modules/dispatch/enums/response-unit-dispatch-notification-failure.enum.js +18 -0
  31. package/dist/cjs/modules/dispatch/enums/response-unit-dispatch-notification-failure.enum.js.map +1 -0
  32. package/dist/cjs/modules/dispatch/enums/response-unit-dispatch-notification-status.enum.js +16 -0
  33. package/dist/cjs/modules/dispatch/enums/response-unit-dispatch-notification-status.enum.js.map +1 -0
  34. package/dist/cjs/modules/dispatch/enums/response-unit-dispatch-status.enum.js +33 -0
  35. package/dist/cjs/modules/dispatch/enums/response-unit-dispatch-status.enum.js.map +1 -0
  36. package/dist/cjs/modules/dispatch/enums/response-unit-dispatch-transition-source.enum.js +16 -0
  37. package/dist/cjs/modules/dispatch/enums/response-unit-dispatch-transition-source.enum.js.map +1 -0
  38. package/dist/cjs/modules/dispatch/enums/response-unit-distance-basis.enum.js +12 -0
  39. package/dist/cjs/modules/dispatch/enums/response-unit-distance-basis.enum.js.map +1 -0
  40. package/dist/cjs/modules/dispatch/enums/response-unit-location-freshness.enum.js +21 -0
  41. package/dist/cjs/modules/dispatch/enums/response-unit-location-freshness.enum.js.map +1 -0
  42. package/dist/cjs/modules/dispatch/enums/response-unit-location-source.enum.js +17 -0
  43. package/dist/cjs/modules/dispatch/enums/response-unit-location-source.enum.js.map +1 -0
  44. package/dist/cjs/modules/dispatch/enums/response-unit-recommendation-reason.enum.js +25 -0
  45. package/dist/cjs/modules/dispatch/enums/response-unit-recommendation-reason.enum.js.map +1 -0
  46. package/dist/cjs/modules/dispatch/enums/response-unit-recommendation-status.enum.js +23 -0
  47. package/dist/cjs/modules/dispatch/enums/response-unit-recommendation-status.enum.js.map +1 -0
  48. package/dist/cjs/modules/dispatch/index.js +53 -0
  49. package/dist/cjs/modules/dispatch/index.js.map +1 -0
  50. package/dist/cjs/modules/dispatch/interfaces/incident-response-unit-dispatch.js +3 -0
  51. package/dist/cjs/modules/dispatch/interfaces/incident-response-unit-dispatch.js.map +1 -0
  52. package/dist/cjs/modules/dispatch/interfaces/response-unit-dispatch-events.js +3 -0
  53. package/dist/cjs/modules/dispatch/interfaces/response-unit-dispatch-events.js.map +1 -0
  54. package/dist/cjs/modules/dispatch/interfaces/response-unit-dispatch-profile.js +3 -0
  55. package/dist/cjs/modules/dispatch/interfaces/response-unit-dispatch-profile.js.map +1 -0
  56. package/dist/cjs/modules/dispatch/interfaces/response-unit-proximity.js +3 -0
  57. package/dist/cjs/modules/dispatch/interfaces/response-unit-proximity.js.map +1 -0
  58. package/dist/cjs/modules/dispatch/interfaces/response-unit-recommendation.js +3 -0
  59. package/dist/cjs/modules/dispatch/interfaces/response-unit-recommendation.js.map +1 -0
  60. package/dist/cjs/modules/dispatch/utils/dispatch-geo.util.js +44 -0
  61. package/dist/cjs/modules/dispatch/utils/dispatch-geo.util.js.map +1 -0
  62. package/dist/cjs/modules/dispatch/utils/incident-dispatchability.util.js +42 -0
  63. package/dist/cjs/modules/dispatch/utils/incident-dispatchability.util.js.map +1 -0
  64. package/dist/cjs/modules/dispatch/utils/response-capability-match.util.js +44 -0
  65. package/dist/cjs/modules/dispatch/utils/response-capability-match.util.js.map +1 -0
  66. package/dist/cjs/modules/dispatch/utils/response-unit-dispatch-event.util.js +19 -0
  67. package/dist/cjs/modules/dispatch/utils/response-unit-dispatch-event.util.js.map +1 -0
  68. package/dist/cjs/modules/dispatch/utils/response-unit-dispatch-status.util.js +49 -0
  69. package/dist/cjs/modules/dispatch/utils/response-unit-dispatch-status.util.js.map +1 -0
  70. package/dist/cjs/modules/incident/dtos/category/create-incident-category.dto.js +9 -0
  71. package/dist/cjs/modules/incident/dtos/category/create-incident-category.dto.js.map +1 -1
  72. package/dist/cjs/modules/incident/dtos/type/create-incident-type.dto.js +9 -0
  73. package/dist/cjs/modules/incident/dtos/type/create-incident-type.dto.js.map +1 -1
  74. package/dist/cjs/modules/incident/enums/incident-actions.enum.js +4 -0
  75. package/dist/cjs/modules/incident/enums/incident-actions.enum.js.map +1 -1
  76. package/dist/cjs/modules/permission/data/permissions.data.js +8 -0
  77. package/dist/cjs/modules/permission/data/permissions.data.js.map +1 -1
  78. package/dist/cjs/modules/permission/enums/permission-actions.enum.js +13 -0
  79. package/dist/cjs/modules/permission/enums/permission-actions.enum.js.map +1 -1
  80. package/dist/cjs/modules/permission/enums/permissions-module.enum.js +1 -0
  81. package/dist/cjs/modules/permission/enums/permissions-module.enum.js.map +1 -1
  82. package/dist/cjs/modules/response-unit/dtos/response-unit/base-response-unit.dto.js +9 -0
  83. package/dist/cjs/modules/response-unit/dtos/response-unit/base-response-unit.dto.js.map +1 -1
  84. package/dist/cjs/modules/response-unit/enums/response-unit/response-capability.enum.js +29 -0
  85. package/dist/cjs/modules/response-unit/enums/response-unit/response-capability.enum.js.map +1 -0
  86. package/dist/cjs/modules/response-unit/enums/response-unit/response-unit-availability.enum.js +27 -0
  87. package/dist/cjs/modules/response-unit/enums/response-unit/response-unit-availability.enum.js.map +1 -0
  88. package/dist/cjs/modules/response-unit/index.js +5 -0
  89. package/dist/cjs/modules/response-unit/index.js.map +1 -1
  90. package/dist/cjs/modules/response-unit/utils/response-capability.util.js +74 -0
  91. package/dist/cjs/modules/response-unit/utils/response-capability.util.js.map +1 -0
  92. package/dist/cjs/modules/response-unit/utils/response-unit-availability.util.js +46 -0
  93. package/dist/cjs/modules/response-unit/utils/response-unit-availability.util.js.map +1 -0
  94. package/dist/cjs/modules/role/data/roles.data.js +24 -0
  95. package/dist/cjs/modules/role/data/roles.data.js.map +1 -1
  96. package/dist/cjs/modules/sms/constants/sms-templates.config.js +18 -0
  97. package/dist/cjs/modules/sms/constants/sms-templates.config.js.map +1 -1
  98. package/dist/cjs/modules/sms/enums/sms-template.enum.js +1 -0
  99. package/dist/cjs/modules/sms/enums/sms-template.enum.js.map +1 -1
  100. package/dist/esm/index.js +1 -0
  101. package/dist/esm/index.js.map +1 -1
  102. package/dist/esm/kafka/topics.js +10 -0
  103. package/dist/esm/kafka/topics.js.map +1 -1
  104. package/dist/esm/modules/dispatch/constants/response-unit-dispatch-defaults.const.js +52 -0
  105. package/dist/esm/modules/dispatch/constants/response-unit-dispatch-defaults.const.js.map +1 -0
  106. package/dist/esm/modules/dispatch/constants/response-unit-dispatch-kafka.const.js +18 -0
  107. package/dist/esm/modules/dispatch/constants/response-unit-dispatch-kafka.const.js.map +1 -0
  108. package/dist/esm/modules/dispatch/dtos/dispatch-response-unit.dto.js +54 -0
  109. package/dist/esm/modules/dispatch/dtos/dispatch-response-unit.dto.js.map +1 -0
  110. package/dist/esm/modules/dispatch/dtos/response-unit-dispatch-notification.dto.js +223 -0
  111. package/dist/esm/modules/dispatch/dtos/response-unit-dispatch-notification.dto.js.map +1 -0
  112. package/dist/esm/modules/dispatch/dtos/response-unit-dispatch-profile-query.dto.js +57 -0
  113. package/dist/esm/modules/dispatch/dtos/response-unit-dispatch-profile-query.dto.js.map +1 -0
  114. package/dist/esm/modules/dispatch/dtos/response-unit-nearby-query.dto.js +62 -0
  115. package/dist/esm/modules/dispatch/dtos/response-unit-nearby-query.dto.js.map +1 -0
  116. package/dist/esm/modules/dispatch/dtos/update-response-unit-dispatch-status.dto.js +37 -0
  117. package/dist/esm/modules/dispatch/dtos/update-response-unit-dispatch-status.dto.js.map +1 -0
  118. package/dist/esm/modules/dispatch/enums/incident-dispatch-blocker.enum.js +18 -0
  119. package/dist/esm/modules/dispatch/enums/incident-dispatch-blocker.enum.js.map +1 -0
  120. package/dist/esm/modules/dispatch/enums/response-capability-requirement-source.enum.js +9 -0
  121. package/dist/esm/modules/dispatch/enums/response-capability-requirement-source.enum.js.map +1 -0
  122. package/dist/esm/modules/dispatch/enums/response-unit-capability-match.enum.js +21 -0
  123. package/dist/esm/modules/dispatch/enums/response-unit-capability-match.enum.js.map +1 -0
  124. package/dist/esm/modules/dispatch/enums/response-unit-dispatch-constraint.enum.js +31 -0
  125. package/dist/esm/modules/dispatch/enums/response-unit-dispatch-constraint.enum.js.map +1 -0
  126. package/dist/esm/modules/dispatch/enums/response-unit-dispatch-error-code.enum.js +23 -0
  127. package/dist/esm/modules/dispatch/enums/response-unit-dispatch-error-code.enum.js.map +1 -0
  128. package/dist/esm/modules/dispatch/enums/response-unit-dispatch-notification-failure.enum.js +15 -0
  129. package/dist/esm/modules/dispatch/enums/response-unit-dispatch-notification-failure.enum.js.map +1 -0
  130. package/dist/esm/modules/dispatch/enums/response-unit-dispatch-notification-status.enum.js +13 -0
  131. package/dist/esm/modules/dispatch/enums/response-unit-dispatch-notification-status.enum.js.map +1 -0
  132. package/dist/esm/modules/dispatch/enums/response-unit-dispatch-status.enum.js +30 -0
  133. package/dist/esm/modules/dispatch/enums/response-unit-dispatch-status.enum.js.map +1 -0
  134. package/dist/esm/modules/dispatch/enums/response-unit-dispatch-transition-source.enum.js +13 -0
  135. package/dist/esm/modules/dispatch/enums/response-unit-dispatch-transition-source.enum.js.map +1 -0
  136. package/dist/esm/modules/dispatch/enums/response-unit-distance-basis.enum.js +9 -0
  137. package/dist/esm/modules/dispatch/enums/response-unit-distance-basis.enum.js.map +1 -0
  138. package/dist/esm/modules/dispatch/enums/response-unit-location-freshness.enum.js +18 -0
  139. package/dist/esm/modules/dispatch/enums/response-unit-location-freshness.enum.js.map +1 -0
  140. package/dist/esm/modules/dispatch/enums/response-unit-location-source.enum.js +14 -0
  141. package/dist/esm/modules/dispatch/enums/response-unit-location-source.enum.js.map +1 -0
  142. package/dist/esm/modules/dispatch/enums/response-unit-recommendation-reason.enum.js +22 -0
  143. package/dist/esm/modules/dispatch/enums/response-unit-recommendation-reason.enum.js.map +1 -0
  144. package/dist/esm/modules/dispatch/enums/response-unit-recommendation-status.enum.js +20 -0
  145. package/dist/esm/modules/dispatch/enums/response-unit-recommendation-status.enum.js.map +1 -0
  146. package/dist/esm/modules/dispatch/index.js +37 -0
  147. package/dist/esm/modules/dispatch/index.js.map +1 -0
  148. package/dist/esm/modules/dispatch/interfaces/incident-response-unit-dispatch.js +2 -0
  149. package/dist/esm/modules/dispatch/interfaces/incident-response-unit-dispatch.js.map +1 -0
  150. package/dist/esm/modules/dispatch/interfaces/response-unit-dispatch-events.js +2 -0
  151. package/dist/esm/modules/dispatch/interfaces/response-unit-dispatch-events.js.map +1 -0
  152. package/dist/esm/modules/dispatch/interfaces/response-unit-dispatch-profile.js +2 -0
  153. package/dist/esm/modules/dispatch/interfaces/response-unit-dispatch-profile.js.map +1 -0
  154. package/dist/esm/modules/dispatch/interfaces/response-unit-proximity.js +2 -0
  155. package/dist/esm/modules/dispatch/interfaces/response-unit-proximity.js.map +1 -0
  156. package/dist/esm/modules/dispatch/interfaces/response-unit-recommendation.js +2 -0
  157. package/dist/esm/modules/dispatch/interfaces/response-unit-recommendation.js.map +1 -0
  158. package/dist/esm/modules/dispatch/utils/dispatch-geo.util.js +39 -0
  159. package/dist/esm/modules/dispatch/utils/dispatch-geo.util.js.map +1 -0
  160. package/dist/esm/modules/dispatch/utils/incident-dispatchability.util.js +37 -0
  161. package/dist/esm/modules/dispatch/utils/incident-dispatchability.util.js.map +1 -0
  162. package/dist/esm/modules/dispatch/utils/response-capability-match.util.js +40 -0
  163. package/dist/esm/modules/dispatch/utils/response-capability-match.util.js.map +1 -0
  164. package/dist/esm/modules/dispatch/utils/response-unit-dispatch-event.util.js +15 -0
  165. package/dist/esm/modules/dispatch/utils/response-unit-dispatch-event.util.js.map +1 -0
  166. package/dist/esm/modules/dispatch/utils/response-unit-dispatch-status.util.js +42 -0
  167. package/dist/esm/modules/dispatch/utils/response-unit-dispatch-status.util.js.map +1 -0
  168. package/dist/esm/modules/incident/dtos/category/create-incident-category.dto.js +10 -1
  169. package/dist/esm/modules/incident/dtos/category/create-incident-category.dto.js.map +1 -1
  170. package/dist/esm/modules/incident/dtos/type/create-incident-type.dto.js +10 -1
  171. package/dist/esm/modules/incident/dtos/type/create-incident-type.dto.js.map +1 -1
  172. package/dist/esm/modules/incident/enums/incident-actions.enum.js +4 -0
  173. package/dist/esm/modules/incident/enums/incident-actions.enum.js.map +1 -1
  174. package/dist/esm/modules/permission/data/permissions.data.js +8 -0
  175. package/dist/esm/modules/permission/data/permissions.data.js.map +1 -1
  176. package/dist/esm/modules/permission/enums/permission-actions.enum.js +13 -0
  177. package/dist/esm/modules/permission/enums/permission-actions.enum.js.map +1 -1
  178. package/dist/esm/modules/permission/enums/permissions-module.enum.js +1 -0
  179. package/dist/esm/modules/permission/enums/permissions-module.enum.js.map +1 -1
  180. package/dist/esm/modules/response-unit/dtos/response-unit/base-response-unit.dto.js +10 -1
  181. package/dist/esm/modules/response-unit/dtos/response-unit/base-response-unit.dto.js.map +1 -1
  182. package/dist/esm/modules/response-unit/enums/response-unit/response-capability.enum.js +26 -0
  183. package/dist/esm/modules/response-unit/enums/response-unit/response-capability.enum.js.map +1 -0
  184. package/dist/esm/modules/response-unit/enums/response-unit/response-unit-availability.enum.js +24 -0
  185. package/dist/esm/modules/response-unit/enums/response-unit/response-unit-availability.enum.js.map +1 -0
  186. package/dist/esm/modules/response-unit/index.js +5 -0
  187. package/dist/esm/modules/response-unit/index.js.map +1 -1
  188. package/dist/esm/modules/response-unit/utils/response-capability.util.js +68 -0
  189. package/dist/esm/modules/response-unit/utils/response-capability.util.js.map +1 -0
  190. package/dist/esm/modules/response-unit/utils/response-unit-availability.util.js +42 -0
  191. package/dist/esm/modules/response-unit/utils/response-unit-availability.util.js.map +1 -0
  192. package/dist/esm/modules/role/data/roles.data.js +24 -0
  193. package/dist/esm/modules/role/data/roles.data.js.map +1 -1
  194. package/dist/esm/modules/sms/constants/sms-templates.config.js +18 -0
  195. package/dist/esm/modules/sms/constants/sms-templates.config.js.map +1 -1
  196. package/dist/esm/modules/sms/enums/sms-template.enum.js +1 -0
  197. package/dist/esm/modules/sms/enums/sms-template.enum.js.map +1 -1
  198. package/dist/types/index.d.ts +1 -0
  199. package/dist/types/kafka/topics.d.ts +4 -0
  200. package/dist/types/modules/dispatch/constants/response-unit-dispatch-defaults.const.d.ts +43 -0
  201. package/dist/types/modules/dispatch/constants/response-unit-dispatch-kafka.const.d.ts +16 -0
  202. package/dist/types/modules/dispatch/dtos/dispatch-response-unit.dto.d.ts +20 -0
  203. package/dist/types/modules/dispatch/dtos/response-unit-dispatch-notification.dto.d.ts +47 -0
  204. package/dist/types/modules/dispatch/dtos/response-unit-dispatch-profile-query.dto.d.ts +13 -0
  205. package/dist/types/modules/dispatch/dtos/response-unit-nearby-query.dto.d.ts +15 -0
  206. package/dist/types/modules/dispatch/dtos/update-response-unit-dispatch-status.dto.d.ts +9 -0
  207. package/dist/types/modules/dispatch/enums/incident-dispatch-blocker.enum.d.ts +16 -0
  208. package/dist/types/modules/dispatch/enums/response-capability-requirement-source.enum.d.ts +7 -0
  209. package/dist/types/modules/dispatch/enums/response-unit-capability-match.enum.d.ts +19 -0
  210. package/dist/types/modules/dispatch/enums/response-unit-dispatch-constraint.enum.d.ts +27 -0
  211. package/dist/types/modules/dispatch/enums/response-unit-dispatch-error-code.enum.d.ts +21 -0
  212. package/dist/types/modules/dispatch/enums/response-unit-dispatch-notification-failure.enum.d.ts +13 -0
  213. package/dist/types/modules/dispatch/enums/response-unit-dispatch-notification-status.enum.d.ts +11 -0
  214. package/dist/types/modules/dispatch/enums/response-unit-dispatch-status.enum.d.ts +28 -0
  215. package/dist/types/modules/dispatch/enums/response-unit-dispatch-transition-source.enum.d.ts +11 -0
  216. package/dist/types/modules/dispatch/enums/response-unit-distance-basis.enum.d.ts +7 -0
  217. package/dist/types/modules/dispatch/enums/response-unit-location-freshness.enum.d.ts +16 -0
  218. package/dist/types/modules/dispatch/enums/response-unit-location-source.enum.d.ts +12 -0
  219. package/dist/types/modules/dispatch/enums/response-unit-recommendation-reason.enum.d.ts +20 -0
  220. package/dist/types/modules/dispatch/enums/response-unit-recommendation-status.enum.d.ts +18 -0
  221. package/dist/types/modules/dispatch/index.d.ts +31 -0
  222. package/dist/types/modules/dispatch/interfaces/incident-response-unit-dispatch.d.ts +121 -0
  223. package/dist/types/modules/dispatch/interfaces/response-unit-dispatch-events.d.ts +103 -0
  224. package/dist/types/modules/dispatch/interfaces/response-unit-dispatch-profile.d.ts +52 -0
  225. package/dist/types/modules/dispatch/interfaces/response-unit-proximity.d.ts +45 -0
  226. package/dist/types/modules/dispatch/interfaces/response-unit-recommendation.d.ts +130 -0
  227. package/dist/types/modules/dispatch/utils/dispatch-geo.util.d.ts +16 -0
  228. package/dist/types/modules/dispatch/utils/incident-dispatchability.util.d.ts +18 -0
  229. package/dist/types/modules/dispatch/utils/response-capability-match.util.d.ts +26 -0
  230. package/dist/types/modules/dispatch/utils/response-unit-dispatch-event.util.d.ts +9 -0
  231. package/dist/types/modules/dispatch/utils/response-unit-dispatch-status.util.d.ts +16 -0
  232. package/dist/types/modules/incident/dtos/category/create-incident-category.dto.d.ts +6 -0
  233. package/dist/types/modules/incident/dtos/type/create-incident-type.dto.d.ts +6 -0
  234. package/dist/types/modules/incident/enums/incident-actions.enum.d.ts +4 -0
  235. package/dist/types/modules/incident/intefaces/incident-category.d.ts +6 -0
  236. package/dist/types/modules/incident/intefaces/incident-type.d.ts +6 -0
  237. package/dist/types/modules/permission/enums/permission-actions.enum.d.ts +3 -0
  238. package/dist/types/modules/permission/enums/permissions-module.enum.d.ts +1 -0
  239. package/dist/types/modules/response-unit/dtos/response-unit/base-response-unit.dto.d.ts +7 -0
  240. package/dist/types/modules/response-unit/enums/response-unit/response-capability.enum.d.ts +24 -0
  241. package/dist/types/modules/response-unit/enums/response-unit/response-unit-availability.enum.d.ts +22 -0
  242. package/dist/types/modules/response-unit/index.d.ts +4 -0
  243. package/dist/types/modules/response-unit/interfaces/response-unit/response-unit.d.ts +3 -0
  244. package/dist/types/modules/response-unit/utils/response-capability.util.d.ts +31 -0
  245. package/dist/types/modules/response-unit/utils/response-unit-availability.util.d.ts +21 -0
  246. package/dist/types/modules/sms/enums/sms-template.enum.d.ts +1 -0
  247. package/package.json +1 -1
@@ -0,0 +1,47 @@
1
+ import { ResponseUnitDispatchNotificationFailure } from '../enums/response-unit-dispatch-notification-failure.enum';
2
+ import { ResponseUnitDispatchNotificationStatus } from '../enums/response-unit-dispatch-notification-status.enum';
3
+ import { ResponseUnitDispatchMessageIncident, ResponseUnitDispatchNotificationRequestedEventV1, ResponseUnitDispatchNotificationResultEventV1 } from '../interfaces/response-unit-dispatch-events';
4
+ export declare class ResponseUnitDispatchMessageIncidentDto implements ResponseUnitDispatchMessageIncident {
5
+ reference: string;
6
+ typeName: string | null;
7
+ categoryName: string | null;
8
+ priority: string | null;
9
+ summary: string | null;
10
+ address: string | null;
11
+ latitude: number | null;
12
+ longitude: number | null;
13
+ reporterName: string | null;
14
+ reporterPhoneNumber: string | null;
15
+ anonymous: boolean;
16
+ }
17
+ export declare class ResponseUnitDispatchRecipientDto {
18
+ phoneNumber: string;
19
+ responseUnitName: string;
20
+ }
21
+ export declare class ResponseUnitDispatchNotificationRequestedDto implements ResponseUnitDispatchNotificationRequestedEventV1 {
22
+ schemaVersion: 1;
23
+ eventId: string;
24
+ occurredAt: string;
25
+ dispatchId: number;
26
+ dispatchReference: string;
27
+ incidentId: number;
28
+ organizationId: number;
29
+ controlCentreId: number | null;
30
+ responseUnitId: number;
31
+ attempt: number;
32
+ appId: string | null;
33
+ recipient: ResponseUnitDispatchRecipientDto;
34
+ incident: ResponseUnitDispatchMessageIncidentDto;
35
+ }
36
+ export declare class ResponseUnitDispatchNotificationResultDto implements ResponseUnitDispatchNotificationResultEventV1 {
37
+ schemaVersion: 1;
38
+ eventId: string;
39
+ occurredAt: string;
40
+ dispatchId: number;
41
+ incidentId: number;
42
+ organizationId: number;
43
+ attempt: number;
44
+ status: ResponseUnitDispatchNotificationStatus;
45
+ failureReason: ResponseUnitDispatchNotificationFailure | null;
46
+ providerCode: string | null;
47
+ }
@@ -0,0 +1,13 @@
1
+ /**
2
+ * `GET /response-units/dispatch-profiles` (clarion-organization, internal).
3
+ *
4
+ * Scoped by the forwarded user context; `organizationId` is honoured for a
5
+ * Super-Admin only. `includeContact` adds the unit's phone number and is used by
6
+ * the dispatch command alone - a recommendation never carries one.
7
+ */
8
+ export declare class ResponseUnitDispatchProfileQueryDto {
9
+ organizationId?: number;
10
+ controlCentreId?: number;
11
+ ids?: number[];
12
+ includeContact?: boolean;
13
+ }
@@ -0,0 +1,15 @@
1
+ /**
2
+ * `GET /tracking/response-units/nearby` (clarion-response-tracking).
3
+ *
4
+ * Tenancy is NOT in the query: the tracking service takes it from the forwarded
5
+ * user context. `organizationId` is honoured for a Super-Admin only and a
6
+ * control-centre caller is pinned to their own centre whatever they pass.
7
+ */
8
+ export declare class ResponseUnitNearbyQueryDto {
9
+ latitude: number;
10
+ longitude: number;
11
+ organizationId?: number;
12
+ controlCentreId?: number;
13
+ radiusMetres?: number;
14
+ limit?: number;
15
+ }
@@ -0,0 +1,9 @@
1
+ import { ResponseUnitDispatchStatus } from '../enums/response-unit-dispatch-status.enum';
2
+ /** Every status a dispatch can be MOVED to (DISPATCHED is only ever its first). */
3
+ export declare const SETTABLE_RESPONSE_UNIT_DISPATCH_STATUSES: readonly ResponseUnitDispatchStatus[];
4
+ /** `POST /incidents/:id/response-unit-dispatches/:dispatchId/status`. */
5
+ export declare class UpdateResponseUnitDispatchStatusDto {
6
+ status: ResponseUnitDispatchStatus;
7
+ /** Why - e.g. why a unit was stood down. */
8
+ reason?: string;
9
+ }
@@ -0,0 +1,16 @@
1
+ /** Why an INCIDENT cannot take a response-unit dispatch, whatever unit is chosen. */
2
+ export declare enum IncidentDispatchBlocker {
3
+ /** Resolved, closed, unresolved or archived. */
4
+ INCIDENT_ENDED = "INCIDENT_ENDED",
5
+ /** A grievance, not an emergency. */
6
+ NOT_AN_EMERGENCY_INCIDENT = "NOT_AN_EMERGENCY_INCIDENT",
7
+ /**
8
+ * The incident does not reach the control room: the reporter was not
9
+ * entitled to a provider response, or declined one. Sending a unit IS the
10
+ * provider response, so the rule that keeps the alert off the control room's
11
+ * screens also keeps it from being dispatched - see `reachesControlRoom`.
12
+ */
13
+ PROVIDER_RESPONSE_NOT_REQUESTED = "PROVIDER_RESPONSE_NOT_REQUESTED",
14
+ /** Response-unit dispatch is switched off platform-wide. */
15
+ DISPATCH_DISABLED = "DISPATCH_DISABLED"
16
+ }
@@ -0,0 +1,7 @@
1
+ /** Where an incident's capability requirement came from. */
2
+ export declare enum ResponseCapabilityRequirementSource {
3
+ INCIDENT_TYPE = "INCIDENT_TYPE",
4
+ INCIDENT_CATEGORY = "INCIDENT_CATEGORY",
5
+ /** Neither the type nor the category names one. */
6
+ NONE = "NONE"
7
+ }
@@ -0,0 +1,19 @@
1
+ /**
2
+ * How a unit's capabilities compare with what the incident needs.
3
+ *
4
+ * UNKNOWN and NOT_SUITED are deliberately different answers: UNKNOWN means
5
+ * nobody said what the unit does (it ranks below a match but stays
6
+ * recommendable), NOT_SUITED means somebody did and it is not this. Treating
7
+ * missing configuration as "not suitable" would hide every unit of an
8
+ * organization that has not configured capabilities yet.
9
+ */
10
+ export declare enum ResponseUnitCapabilityMatch {
11
+ /** The incident needs a capability and the unit has one of them. */
12
+ MATCH = "MATCH",
13
+ /** The incident's type and category name no requirement - any unit fits. */
14
+ NOT_REQUIRED = "NOT_REQUIRED",
15
+ /** The incident needs a capability; the unit's capabilities are unknown. */
16
+ UNKNOWN = "UNKNOWN",
17
+ /** The unit's known capabilities do not include what the incident needs. */
18
+ NOT_SUITED = "NOT_SUITED"
19
+ }
@@ -0,0 +1,27 @@
1
+ /**
2
+ * Why a unit cannot be dispatched (a BLOCKER) or, while it can be dispatched by
3
+ * hand, is not recommended (a CAUTION). One vocabulary for both so the admin
4
+ * explains either with the same words.
5
+ */
6
+ export declare enum ResponseUnitDispatchConstraint {
7
+ /** Switched off in the organization. */
8
+ INACTIVE = "INACTIVE",
9
+ /** Non-operational, off duty, on leave or in training. */
10
+ OPERATIONALLY_UNAVAILABLE = "OPERATIONALLY_UNAVAILABLE",
11
+ /** Out on another job (an active dispatch, or a manual Engaged / On Mission status). */
12
+ ENGAGED = "ENGAGED",
13
+ /** Already has an active dispatch to THIS incident. */
14
+ ALREADY_DISPATCHED = "ALREADY_DISPATCHED",
15
+ /** Belongs to another control centre and cross-control-centre dispatch is off. */
16
+ OTHER_CONTROL_CENTRE = "OTHER_CONTROL_CENTRE",
17
+ /** Not suited, and the platform is configured to require a capability match. */
18
+ CAPABILITY_REQUIRED = "CAPABILITY_REQUIRED",
19
+ /** Its known capabilities do not include what the incident needs. */
20
+ NOT_SUITED = "NOT_SUITED",
21
+ /** No position at all, or the tracking service has it offline. */
22
+ NO_LOCATION = "NO_LOCATION",
23
+ /** A stale live fix, and stale positions are configured not to be recommended. */
24
+ LOCATION_STALE = "LOCATION_STALE",
25
+ /** Live-tracked, but outside the search radius. */
26
+ OUTSIDE_SEARCH_AREA = "OUTSIDE_SEARCH_AREA"
27
+ }
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Machine-readable codes on a refused recommend/dispatch request (the `code` of
3
+ * the error body), so a client can react without parsing a sentence. A 409 says
4
+ * "the world changed since you looked - refresh"; other 4xx say "this was never
5
+ * going to work".
6
+ */
7
+ export declare enum ResponseUnitDispatchErrorCode {
8
+ INCIDENT_NOT_DISPATCHABLE = "INCIDENT_NOT_DISPATCHABLE",
9
+ RESPONSE_UNIT_NOT_FOUND = "RESPONSE_UNIT_NOT_FOUND",
10
+ RESPONSE_UNIT_NOT_DISPATCHABLE = "RESPONSE_UNIT_NOT_DISPATCHABLE",
11
+ /** Another dispatcher got there first - the unit is out on a job. */
12
+ RESPONSE_UNIT_ENGAGED = "RESPONSE_UNIT_ENGAGED",
13
+ RESPONSE_UNIT_ALREADY_DISPATCHED = "RESPONSE_UNIT_ALREADY_DISPATCHED",
14
+ /** The same Idempotency-Key was used for a different unit. */
15
+ IDEMPOTENCY_KEY_REUSED = "IDEMPOTENCY_KEY_REUSED",
16
+ DISPATCH_NOT_FOUND = "DISPATCH_NOT_FOUND",
17
+ INVALID_STATUS_TRANSITION = "INVALID_STATUS_TRANSITION",
18
+ NOTIFICATION_NOT_RESENDABLE = "NOTIFICATION_NOT_RESENDABLE",
19
+ /** clarion-organization could not be reached: nothing can be verified, so nothing is sent. */
20
+ ORGANIZATION_UNAVAILABLE = "ORGANIZATION_UNAVAILABLE"
21
+ }
@@ -0,0 +1,13 @@
1
+ /** Why a dispatch message was not sent. */
2
+ export declare enum ResponseUnitDispatchNotificationFailure {
3
+ /** The unit has no phone number. */
4
+ NO_PHONE_NUMBER = "NO_PHONE_NUMBER",
5
+ /** The number on the unit is not one any provider can send to. */
6
+ INVALID_PHONE_NUMBER = "INVALID_PHONE_NUMBER",
7
+ /** Every provider in the country's chain failed. */
8
+ PROVIDER_FAILURE = "PROVIDER_FAILURE",
9
+ /** No SMS provider is configured for the number's country. */
10
+ NOT_CONFIGURED = "NOT_CONFIGURED",
11
+ /** clarion-notification never answered, so nobody knows. Sending again is the remedy. */
12
+ NO_RESPONSE = "NO_RESPONSE"
13
+ }
@@ -0,0 +1,11 @@
1
+ /** What happened to the message telling the unit it was dispatched. */
2
+ export declare enum ResponseUnitDispatchNotificationStatus {
3
+ /** Requested from clarion-notification; no answer yet. */
4
+ PENDING = "PENDING",
5
+ /** A provider accepted it. (Handset delivery is not tracked by the platform.) */
6
+ SENT = "SENT",
7
+ /** Every provider refused or failed; it can be sent again. */
8
+ FAILED = "FAILED",
9
+ /** Could never be sent - the unit has no usable phone number. The dispatch stands. */
10
+ NOT_POSSIBLE = "NOT_POSSIBLE"
11
+ }
@@ -0,0 +1,28 @@
1
+ /**
2
+ * Where one response unit is in answering one incident.
3
+ *
4
+ * Only DISPATCHED is set by the dispatch command itself. The middle states exist
5
+ * so the record can be advanced by whoever learns of progress - a dispatcher
6
+ * relaying a radio call today, the responder app or clarion-workflow later -
7
+ * without a schema change. Nothing in this platform advances them on a timer:
8
+ * escalation, reassignment and SLA belong to the workflow layer.
9
+ *
10
+ * ACTIVE = DISPATCHED, ACKNOWLEDGED, EN_ROUTE, ON_SCENE. A unit may hold at most
11
+ * ONE active dispatch across every incident - a partial unique index in
12
+ * clarion-incident enforces it, which is what stops two dispatchers sending the
13
+ * same unit to two emergencies.
14
+ */
15
+ export declare enum ResponseUnitDispatchStatus {
16
+ /** Sent: the command was accepted and the unit was asked to respond. */
17
+ DISPATCHED = "DISPATCHED",
18
+ /** The unit confirmed it received the job. */
19
+ ACKNOWLEDGED = "ACKNOWLEDGED",
20
+ /** On the way. */
21
+ EN_ROUTE = "EN_ROUTE",
22
+ /** Arrived at the incident. */
23
+ ON_SCENE = "ON_SCENE",
24
+ /** Finished - by the dispatcher, or because the incident itself ended. */
25
+ COMPLETED = "COMPLETED",
26
+ /** Stood down before finishing. Frees the unit. */
27
+ CANCELLED = "CANCELLED"
28
+ }
@@ -0,0 +1,11 @@
1
+ /** Who moved a dispatch to its current status. Recorded for the audit trail. */
2
+ export declare enum ResponseUnitDispatchTransitionSource {
3
+ /** A control-room user, through the admin or the API. */
4
+ DISPATCHER = "DISPATCHER",
5
+ /** The incident ended (resolved, closed...), so its active dispatches were completed. */
6
+ INCIDENT_LIFECYCLE = "INCIDENT_LIFECYCLE",
7
+ /** Reserved for the responder app. */
8
+ RESPONDER = "RESPONDER",
9
+ /** Reserved for clarion-workflow orchestration. */
10
+ WORKFLOW = "WORKFLOW"
11
+ }
@@ -0,0 +1,7 @@
1
+ /** What a candidate's distance (and duration, when present) measures. */
2
+ export declare enum ResponseUnitDistanceBasis {
3
+ /** Great-circle distance. Always available, never a duration. */
4
+ STRAIGHT_LINE = "STRAIGHT_LINE",
5
+ /** A road route from clarion-gis (Google Routes), with a travel time. */
6
+ ROAD_ROUTE = "ROAD_ROUTE"
7
+ }
@@ -0,0 +1,16 @@
1
+ /**
2
+ * How far a candidate's position can be trusted.
3
+ *
4
+ * Not a new set of thresholds: CURRENT and STALE are clarion-response-tracking's
5
+ * own ONLINE / STALE status, which it evaluates against each provider
6
+ * connection's configured staleAfterSeconds / offlineAfterSeconds. A unit the
7
+ * tracking service calls OFFLINE has no usable position here (UNKNOWN).
8
+ */
9
+ export declare enum ResponseUnitLocationFreshness {
10
+ /** A live fix within the provider's stale threshold. */
11
+ CURRENT = "CURRENT",
12
+ /** A live fix older than the stale threshold but not yet offline. */
13
+ STALE = "STALE",
14
+ /** No live fix that can be relied on: offline, never tracked, or base-only. */
15
+ UNKNOWN = "UNKNOWN"
16
+ }
@@ -0,0 +1,12 @@
1
+ /** Where a candidate's position came from. */
2
+ export declare enum ResponseUnitLocationSource {
3
+ /** A GPS fix from clarion-response-tracking. */
4
+ LIVE = "LIVE",
5
+ /**
6
+ * The unit's configured base location in clarion-organization - used only
7
+ * for a unit that is not live-tracked at all, and always labelled as such.
8
+ */
9
+ BASE = "BASE",
10
+ /** No usable position. */
11
+ NONE = "NONE"
12
+ }
@@ -0,0 +1,20 @@
1
+ /**
2
+ * The facts a recommendation rests on, in the order the ranking weighs them.
3
+ * The admin turns these into the "Recommended because:" lines; the numbers
4
+ * behind them (distance, age) travel on the candidate itself.
5
+ */
6
+ export declare enum ResponseUnitRecommendationReason {
7
+ AVAILABLE = "AVAILABLE",
8
+ CAPABILITY_MATCH = "CAPABILITY_MATCH",
9
+ NO_CAPABILITY_REQUIREMENT = "NO_CAPABILITY_REQUIREMENT",
10
+ CAPABILITY_UNKNOWN = "CAPABILITY_UNKNOWN",
11
+ SAME_CONTROL_CENTRE = "SAME_CONTROL_CENTRE",
12
+ OTHER_CONTROL_CENTRE = "OTHER_CONTROL_CENTRE",
13
+ LIVE_LOCATION_CURRENT = "LIVE_LOCATION_CURRENT",
14
+ LIVE_LOCATION_STALE = "LIVE_LOCATION_STALE",
15
+ BASE_LOCATION = "BASE_LOCATION",
16
+ /** Closest of the units that tie on everything above. */
17
+ NEAREST = "NEAREST",
18
+ /** Quickest by road of the units that tie on everything above. */
19
+ QUICKEST = "QUICKEST"
20
+ }
@@ -0,0 +1,18 @@
1
+ /**
2
+ * The overall answer. NO_UNITS_CONFIGURED and NO_ELIGIBLE_UNITS are different
3
+ * operational facts and the admin treats them differently: the first hides the
4
+ * whole dispatch panel (this control room simply has no units), the second is
5
+ * an alarm (it has units and none can go).
6
+ */
7
+ export declare enum ResponseUnitRecommendationStatus {
8
+ /** A unit is recommended. */
9
+ RECOMMENDED = "RECOMMENDED",
10
+ /** Some units can be dispatched by hand, but none qualifies for a recommendation. */
11
+ NO_RECOMMENDATION = "NO_RECOMMENDATION",
12
+ /** Units exist and none of them can be dispatched. */
13
+ NO_ELIGIBLE_UNITS = "NO_ELIGIBLE_UNITS",
14
+ /** The caller's scope holds no response units at all. */
15
+ NO_UNITS_CONFIGURED = "NO_UNITS_CONFIGURED",
16
+ /** The incident itself cannot take a dispatch (see the blockers). */
17
+ NOT_DISPATCHABLE = "NOT_DISPATCHABLE"
18
+ }
@@ -0,0 +1,31 @@
1
+ export * from './enums/response-unit-dispatch-status.enum';
2
+ export * from './enums/response-unit-dispatch-transition-source.enum';
3
+ export * from './enums/response-unit-capability-match.enum';
4
+ export * from './enums/response-capability-requirement-source.enum';
5
+ export * from './enums/response-unit-location-source.enum';
6
+ export * from './enums/response-unit-location-freshness.enum';
7
+ export * from './enums/response-unit-distance-basis.enum';
8
+ export * from './enums/response-unit-dispatch-constraint.enum';
9
+ export * from './enums/response-unit-recommendation-reason.enum';
10
+ export * from './enums/response-unit-recommendation-status.enum';
11
+ export * from './enums/incident-dispatch-blocker.enum';
12
+ export * from './enums/response-unit-dispatch-notification-status.enum';
13
+ export * from './enums/response-unit-dispatch-notification-failure.enum';
14
+ export * from './enums/response-unit-dispatch-error-code.enum';
15
+ export * from './interfaces/response-unit-dispatch-profile';
16
+ export * from './interfaces/response-unit-proximity';
17
+ export * from './interfaces/response-unit-recommendation';
18
+ export * from './interfaces/incident-response-unit-dispatch';
19
+ export * from './interfaces/response-unit-dispatch-events';
20
+ export * from './constants/response-unit-dispatch-kafka.const';
21
+ export * from './constants/response-unit-dispatch-defaults.const';
22
+ export * from './dtos/dispatch-response-unit.dto';
23
+ export * from './dtos/update-response-unit-dispatch-status.dto';
24
+ export * from './dtos/response-unit-nearby-query.dto';
25
+ export * from './dtos/response-unit-dispatch-profile-query.dto';
26
+ export * from './dtos/response-unit-dispatch-notification.dto';
27
+ export * from './utils/response-unit-dispatch-status.util';
28
+ export * from './utils/response-capability-match.util';
29
+ export * from './utils/incident-dispatchability.util';
30
+ export * from './utils/dispatch-geo.util';
31
+ export * from './utils/response-unit-dispatch-event.util';
@@ -0,0 +1,121 @@
1
+ import { ResponseCapability } from '../../response-unit/enums/response-unit/response-capability.enum';
2
+ import { ResponseUnitAvailability } from '../../response-unit/enums/response-unit/response-unit-availability.enum';
3
+ import { ResponseCapabilityRequirementSource } from '../enums/response-capability-requirement-source.enum';
4
+ import { ResponseUnitCapabilityMatch } from '../enums/response-unit-capability-match.enum';
5
+ import { ResponseUnitDispatchNotificationFailure } from '../enums/response-unit-dispatch-notification-failure.enum';
6
+ import { ResponseUnitDispatchNotificationStatus } from '../enums/response-unit-dispatch-notification-status.enum';
7
+ import { ResponseUnitDispatchStatus } from '../enums/response-unit-dispatch-status.enum';
8
+ import { ResponseUnitDispatchTransitionSource } from '../enums/response-unit-dispatch-transition-source.enum';
9
+ import { ResponseUnitLocationFreshness } from '../enums/response-unit-location-freshness.enum';
10
+ import { ResponseUnitLocationSource } from '../enums/response-unit-location-source.enum';
11
+ import { ResponseUnitRecommendationStatus } from '../enums/response-unit-recommendation-status.enum';
12
+ /** The selected unit as it stood when it was dispatched - frozen for the audit. */
13
+ export interface ResponseUnitDispatchUnitSnapshot {
14
+ availability: ResponseUnitAvailability;
15
+ operationalStatus: string | null;
16
+ capabilities: ResponseCapability[];
17
+ capabilityMatch: ResponseUnitCapabilityMatch;
18
+ sameControlCentre: boolean;
19
+ locationSource: ResponseUnitLocationSource;
20
+ locationFreshness: ResponseUnitLocationFreshness;
21
+ locationRecordedAt: string | null;
22
+ locationAgeSeconds: number | null;
23
+ distanceMetres: number | null;
24
+ hasPhoneNumber: boolean;
25
+ }
26
+ /** One ranked alternative, as it stood at dispatch time. */
27
+ export interface ResponseUnitDispatchSnapshotCandidate {
28
+ responseUnitId: number;
29
+ rank: number;
30
+ distanceMetres: number | null;
31
+ capabilityMatch: ResponseUnitCapabilityMatch;
32
+ locationFreshness: ResponseUnitLocationFreshness;
33
+ }
34
+ /**
35
+ * The recommendation the SERVER computed at the moment it accepted the
36
+ * dispatch. Recomputed rather than taken from the client, so "was the selected
37
+ * unit the recommended one?" is a fact, not a claim.
38
+ */
39
+ export interface ResponseUnitDispatchRecommendationSnapshot {
40
+ generatedAt: string;
41
+ status: ResponseUnitRecommendationStatus;
42
+ recommendedResponseUnitId: number | null;
43
+ /** The recommended unit first, then the alternatives, capped. */
44
+ ranked: ResponseUnitDispatchSnapshotCandidate[];
45
+ requiredCapabilities: ResponseCapability[];
46
+ requirementSource: ResponseCapabilityRequirementSource;
47
+ liveTrackingAvailable: boolean;
48
+ }
49
+ /** Where the dispatch message stands. */
50
+ export interface ResponseUnitDispatchNotificationState {
51
+ channel: 'SMS';
52
+ status: ResponseUnitDispatchNotificationStatus;
53
+ failureReason: ResponseUnitDispatchNotificationFailure | null;
54
+ /** Masked (+2547******78). The full number is never stored on the dispatch. */
55
+ recipient: string | null;
56
+ /** How many times it was requested (1 + resends). */
57
+ attempts: number;
58
+ requestedAt: string | null;
59
+ /** When clarion-notification last reported on it. */
60
+ resultAt: string | null;
61
+ providerCode: string | null;
62
+ }
63
+ /**
64
+ * One response unit sent to one incident. The authoritative dispatch record,
65
+ * owned by clarion-incident - and the engagement record: a unit is out on a job
66
+ * exactly while it has a dispatch in an ACTIVE status.
67
+ *
68
+ * Channel-neutral on purpose: the admin reads it today, the responder app and
69
+ * clarion-workflow can read the same record (and the events built from it)
70
+ * tomorrow.
71
+ */
72
+ export interface IncidentResponseUnitDispatch {
73
+ id: number;
74
+ /** Stable external identifier (uuid), safe to quote in a call or a ticket. */
75
+ reference: string;
76
+ incidentId: number;
77
+ organizationId: number;
78
+ /** The incident's control centre. */
79
+ controlCentreId: number | null;
80
+ responseUnitId: number;
81
+ /** Copied at dispatch time so the record survives the unit being renamed or deleted. */
82
+ responseUnitName: string;
83
+ responseUnitType: string | null;
84
+ responseUnitControlCentreId: number | null;
85
+ status: ResponseUnitDispatchStatus;
86
+ dispatchedByUserId: number;
87
+ dispatchedAt: string;
88
+ /** The server's recommendation at dispatch time named this unit. */
89
+ wasRecommended: boolean;
90
+ /** The unit the server would have recommended at dispatch time. */
91
+ recommendedResponseUnitId: number | null;
92
+ /** The unit the dispatcher's screen showed as recommended (as reported by the client). */
93
+ shownRecommendedResponseUnitId: number | null;
94
+ /** Optional words from a dispatcher who chose another unit. */
95
+ overrideReason: string | null;
96
+ notes: string | null;
97
+ distanceMetres: number | null;
98
+ unitSnapshot: ResponseUnitDispatchUnitSnapshot;
99
+ recommendationSnapshot: ResponseUnitDispatchRecommendationSnapshot | null;
100
+ statusChangedAt: string;
101
+ statusChangedByUserId: number | null;
102
+ statusSource: ResponseUnitDispatchTransitionSource;
103
+ statusReason: string | null;
104
+ acknowledgedAt: string | null;
105
+ enRouteAt: string | null;
106
+ onSceneAt: string | null;
107
+ completedAt: string | null;
108
+ cancelledAt: string | null;
109
+ notification: ResponseUnitDispatchNotificationState;
110
+ createdAt: string;
111
+ updatedAt: string;
112
+ }
113
+ /** `POST /incidents/:id/response-unit-dispatches`. */
114
+ export interface DispatchResponseUnitResult {
115
+ dispatch: IncidentResponseUnitDispatch;
116
+ /**
117
+ * True when this request repeated an earlier one (same Idempotency-Key) and
118
+ * the EXISTING dispatch is returned - nothing was dispatched or sent again.
119
+ */
120
+ replayed: boolean;
121
+ }
@@ -0,0 +1,103 @@
1
+ import { ResponseUnitDispatchNotificationFailure } from '../enums/response-unit-dispatch-notification-failure.enum';
2
+ import { ResponseUnitDispatchNotificationStatus } from '../enums/response-unit-dispatch-notification-status.enum';
3
+ import { ResponseUnitDispatchStatus } from '../enums/response-unit-dispatch-status.enum';
4
+ import { ResponseUnitDispatchTransitionSource } from '../enums/response-unit-dispatch-transition-source.enum';
5
+ /** Fields every dispatch event carries. */
6
+ export interface ResponseUnitDispatchEventBase {
7
+ schemaVersion: 1;
8
+ /** Deterministic per (dispatch, change) so a redelivery can be recognised. */
9
+ eventId: string;
10
+ occurredAt: string;
11
+ dispatchId: number;
12
+ dispatchReference: string;
13
+ incidentId: number;
14
+ organizationId: number;
15
+ controlCentreId: number | null;
16
+ responseUnitId: number;
17
+ }
18
+ /**
19
+ * `incident.response-unit-dispatch.created.v1` - a unit was sent to an incident.
20
+ *
21
+ * Identifiers and decisions only: no names, numbers or addresses. Every future
22
+ * consumer (clarion-workflow, the responder app's backend, analytics, audit)
23
+ * reads it; the few that need the incident's details look them up by id with
24
+ * their own authorization.
25
+ */
26
+ export interface IncidentResponseUnitDispatchedEventV1 extends ResponseUnitDispatchEventBase {
27
+ status: ResponseUnitDispatchStatus.DISPATCHED;
28
+ responseUnitControlCentreId: number | null;
29
+ dispatchedByUserId: number;
30
+ dispatchedAt: string;
31
+ wasRecommended: boolean;
32
+ recommendedResponseUnitId: number | null;
33
+ distanceMetres: number | null;
34
+ notificationStatus: ResponseUnitDispatchNotificationStatus;
35
+ }
36
+ /**
37
+ * `incident.response-unit-dispatch.status-changed.v1` - acknowledged, en route,
38
+ * on scene, completed or stood down. Ordered per incident (keyed by incident id).
39
+ */
40
+ export interface IncidentResponseUnitDispatchStatusChangedEventV1 extends ResponseUnitDispatchEventBase {
41
+ previousStatus: ResponseUnitDispatchStatus;
42
+ status: ResponseUnitDispatchStatus;
43
+ source: ResponseUnitDispatchTransitionSource;
44
+ changedByUserId: number | null;
45
+ reason: string | null;
46
+ }
47
+ /** The incident facts a dispatch message is written from. */
48
+ export interface ResponseUnitDispatchMessageIncident {
49
+ /** As the control room quotes it, e.g. `#1234`. */
50
+ reference: string;
51
+ typeName: string | null;
52
+ categoryName: string | null;
53
+ priority: string | null;
54
+ /** The description, clamped. */
55
+ summary: string | null;
56
+ address: string | null;
57
+ latitude: number | null;
58
+ longitude: number | null;
59
+ /** Null when the reporter is anonymous. */
60
+ reporterName: string | null;
61
+ /** Null when the reporter is anonymous or left none. */
62
+ reporterPhoneNumber: string | null;
63
+ anonymous: boolean;
64
+ }
65
+ /**
66
+ * `incident.response-unit-dispatch.notification-requested.v1` - a COMMAND to
67
+ * clarion-notification: tell this unit it has been dispatched.
68
+ *
69
+ * Kept apart from the domain event on purpose. It is the one message that needs
70
+ * the unit's phone number and the incident's details (an SMS cannot be written
71
+ * from identifiers), and it goes to one consumer; the domain event goes to
72
+ * everyone and carries neither. Self-contained so the message can be sent even
73
+ * when clarion-incident is down - an SMS that waits on a lookup is an SMS that
74
+ * arrives after the unit should have left.
75
+ */
76
+ export interface ResponseUnitDispatchNotificationRequestedEventV1 extends ResponseUnitDispatchEventBase {
77
+ /** 1 for the dispatch itself, then 2, 3... for each "send again". */
78
+ attempt: number;
79
+ /** For organization branding and sender resolution. */
80
+ appId: string | null;
81
+ recipient: {
82
+ /** E.164. */
83
+ phoneNumber: string;
84
+ responseUnitName: string;
85
+ };
86
+ incident: ResponseUnitDispatchMessageIncident;
87
+ }
88
+ /**
89
+ * `notification.response-unit-dispatch.notification-result.v1` - what became of
90
+ * one request. clarion-incident records it on the dispatch.
91
+ */
92
+ export interface ResponseUnitDispatchNotificationResultEventV1 {
93
+ schemaVersion: 1;
94
+ eventId: string;
95
+ occurredAt: string;
96
+ dispatchId: number;
97
+ incidentId: number;
98
+ organizationId: number;
99
+ attempt: number;
100
+ status: ResponseUnitDispatchNotificationStatus;
101
+ failureReason: ResponseUnitDispatchNotificationFailure | null;
102
+ providerCode: string | null;
103
+ }
@@ -0,0 +1,52 @@
1
+ import { ResponseCapability } from '../../response-unit/enums/response-unit/response-capability.enum';
2
+ import { ResponseUnitAvailability } from '../../response-unit/enums/response-unit/response-unit-availability.enum';
3
+ /**
4
+ * A response unit as dispatch sees it: the slim, authoritative row
5
+ * clarion-organization serves from `GET /response-units/dispatch-profiles`.
6
+ *
7
+ * Everything the recommendation engine needs to decide "could this unit go?"
8
+ * and nothing it does not - no crew, no device, no address book. The phone
9
+ * number is present ONLY when the caller asked for contact details (the
10
+ * dispatch command, never a recommendation), already in E.164 for the
11
+ * organization's country so clarion-notification can route it without
12
+ * guessing.
13
+ */
14
+ export interface ResponseUnitDispatchProfile {
15
+ responseUnitId: number;
16
+ organizationId: number;
17
+ controlCentreId: number | null;
18
+ name: string;
19
+ /** `Vehicle` / `Person` / `Team`. */
20
+ responseUnitType: string;
21
+ /** `Ambulance` / `Security` / `Fire` / `Road Rescue` for vehicles; null otherwise. */
22
+ vehicleType: string | null;
23
+ registrationNumber: string | null;
24
+ isActive: boolean;
25
+ /** The manual status, whichever subtype field holds it (`Operational`, `On Duty`...). */
26
+ operationalStatus: string | null;
27
+ /** From the manual status only - clarion-incident layers active dispatches on top. */
28
+ availability: ResponseUnitAvailability;
29
+ /** The capabilities the unit is treated as having (configured, else derived from its type). */
30
+ capabilities: ResponseCapability[];
31
+ /** True when `capabilities` was configured on the unit rather than derived. */
32
+ capabilitiesConfigured: boolean;
33
+ /** The unit's configured base position; null when unset or obviously invalid (0,0). */
34
+ baseLocation: {
35
+ latitude: number;
36
+ longitude: number;
37
+ } | null;
38
+ stationName: string | null;
39
+ /** Whether a dispatch SMS could be sent at all. */
40
+ hasPhoneNumber: boolean;
41
+ /** E.164. Present only with `includeContact=true`. */
42
+ phoneNumber?: string | null;
43
+ }
44
+ /** One page of dispatch profiles - in practice the whole scope, capped. */
45
+ export interface ResponseUnitDispatchProfileList {
46
+ organizationId: number;
47
+ /** Every unit in the caller's scope, before the cap. */
48
+ total: number;
49
+ units: ResponseUnitDispatchProfile[];
50
+ /** True when `total` exceeded the cap and `units` is the first slice. */
51
+ truncated: boolean;
52
+ }