@freighttech/shipment-tracking 0.6.0

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 (456) hide show
  1. package/LICENSE +21 -0
  2. package/NOTICE +25 -0
  3. package/dist/generated/entities/bic_config/index.js +21 -0
  4. package/dist/generated/entities/bic_config/index.js.map +7 -0
  5. package/dist/generated/entities/carrier_config/index.js +27 -0
  6. package/dist/generated/entities/carrier_config/index.js.map +7 -0
  7. package/dist/generated/entities/location_override/index.js +33 -0
  8. package/dist/generated/entities/location_override/index.js.map +7 -0
  9. package/dist/generated/entities/shipment/index.js +73 -0
  10. package/dist/generated/entities/shipment/index.js.map +7 -0
  11. package/dist/generated/entities/ships_go_config/index.js +31 -0
  12. package/dist/generated/entities/ships_go_config/index.js.map +7 -0
  13. package/dist/generated/entities/tracking_event/index.js +101 -0
  14. package/dist/generated/entities/tracking_event/index.js.map +7 -0
  15. package/dist/generated/entities/tracking_job/index.js +47 -0
  16. package/dist/generated/entities/tracking_job/index.js.map +7 -0
  17. package/dist/generated/entities/webhook/index.js +25 -0
  18. package/dist/generated/entities/webhook/index.js.map +7 -0
  19. package/dist/generated/entities/webhook_delivery/index.js +25 -0
  20. package/dist/generated/entities/webhook_delivery/index.js.map +7 -0
  21. package/dist/generated/entities.ids.generated.js +21 -0
  22. package/dist/generated/entities.ids.generated.js.map +7 -0
  23. package/dist/index.js +41 -0
  24. package/dist/index.js.map +7 -0
  25. package/dist/modules/shipment_tracking/acl.js +22 -0
  26. package/dist/modules/shipment_tracking/acl.js.map +7 -0
  27. package/dist/modules/shipment_tracking/api/bic-configs/route.js +176 -0
  28. package/dist/modules/shipment_tracking/api/bic-configs/route.js.map +7 -0
  29. package/dist/modules/shipment_tracking/api/bic-configs/test/route.js +95 -0
  30. package/dist/modules/shipment_tracking/api/bic-configs/test/route.js.map +7 -0
  31. package/dist/modules/shipment_tracking/api/cargo-events/route.js +93 -0
  32. package/dist/modules/shipment_tracking/api/cargo-events/route.js.map +7 -0
  33. package/dist/modules/shipment_tracking/api/carrier-configs/route.js +139 -0
  34. package/dist/modules/shipment_tracking/api/carrier-configs/route.js.map +7 -0
  35. package/dist/modules/shipment_tracking/api/dashboard/ships-map/route.js +177 -0
  36. package/dist/modules/shipment_tracking/api/dashboard/ships-map/route.js.map +7 -0
  37. package/dist/modules/shipment_tracking/api/location-overrides/route.js +179 -0
  38. package/dist/modules/shipment_tracking/api/location-overrides/route.js.map +7 -0
  39. package/dist/modules/shipment_tracking/api/openapi.js +27 -0
  40. package/dist/modules/shipment_tracking/api/openapi.js.map +7 -0
  41. package/dist/modules/shipment_tracking/api/shipments/route.js +192 -0
  42. package/dist/modules/shipment_tracking/api/shipments/route.js.map +7 -0
  43. package/dist/modules/shipment_tracking/api/shipsgo-configs/route.js +185 -0
  44. package/dist/modules/shipment_tracking/api/shipsgo-configs/route.js.map +7 -0
  45. package/dist/modules/shipment_tracking/api/tracking-jobs/route.js +144 -0
  46. package/dist/modules/shipment_tracking/api/tracking-jobs/route.js.map +7 -0
  47. package/dist/modules/shipment_tracking/api/tracking-jobs/sync/route.js +107 -0
  48. package/dist/modules/shipment_tracking/api/tracking-jobs/sync/route.js.map +7 -0
  49. package/dist/modules/shipment_tracking/api/utils.js +12 -0
  50. package/dist/modules/shipment_tracking/api/utils.js.map +7 -0
  51. package/dist/modules/shipment_tracking/api/webhooks/deliveries/route.js +76 -0
  52. package/dist/modules/shipment_tracking/api/webhooks/deliveries/route.js.map +7 -0
  53. package/dist/modules/shipment_tracking/api/webhooks/route.js +135 -0
  54. package/dist/modules/shipment_tracking/api/webhooks/route.js.map +7 -0
  55. package/dist/modules/shipment_tracking/api/webhooks/test/route.js +71 -0
  56. package/dist/modules/shipment_tracking/api/webhooks/test/route.js.map +7 -0
  57. package/dist/modules/shipment_tracking/assets/carriers/cma_cgm.png +0 -0
  58. package/dist/modules/shipment_tracking/assets/carriers/cosco.png +0 -0
  59. package/dist/modules/shipment_tracking/assets/carriers/evergreen.png +0 -0
  60. package/dist/modules/shipment_tracking/assets/carriers/hapag_lloyd.png +0 -0
  61. package/dist/modules/shipment_tracking/assets/carriers/maersk.png +0 -0
  62. package/dist/modules/shipment_tracking/assets/carriers/msc.png +0 -0
  63. package/dist/modules/shipment_tracking/assets/carriers/one.png +0 -0
  64. package/dist/modules/shipment_tracking/assets/carriers/oocl.png +0 -0
  65. package/dist/modules/shipment_tracking/assets/carriers/yang_ming.png +0 -0
  66. package/dist/modules/shipment_tracking/assets/carriers/zim.png +0 -0
  67. package/dist/modules/shipment_tracking/assets/index.js +52 -0
  68. package/dist/modules/shipment_tracking/assets/index.js.map +7 -0
  69. package/dist/modules/shipment_tracking/backend/carrier-configs/page.js +621 -0
  70. package/dist/modules/shipment_tracking/backend/carrier-configs/page.js.map +7 -0
  71. package/dist/modules/shipment_tracking/backend/carrier-configs/page.meta.js +19 -0
  72. package/dist/modules/shipment_tracking/backend/carrier-configs/page.meta.js.map +7 -0
  73. package/dist/modules/shipment_tracking/backend/location-overrides/page.js +198 -0
  74. package/dist/modules/shipment_tracking/backend/location-overrides/page.js.map +7 -0
  75. package/dist/modules/shipment_tracking/backend/location-overrides/page.meta.js +19 -0
  76. package/dist/modules/shipment_tracking/backend/location-overrides/page.meta.js.map +7 -0
  77. package/dist/modules/shipment_tracking/backend/shipment-tracking/page.js +279 -0
  78. package/dist/modules/shipment_tracking/backend/shipment-tracking/page.js.map +7 -0
  79. package/dist/modules/shipment_tracking/backend/shipment-tracking/page.meta.js +19 -0
  80. package/dist/modules/shipment_tracking/backend/shipment-tracking/page.meta.js.map +7 -0
  81. package/dist/modules/shipment_tracking/backend/tracking-jobs/page.js +10 -0
  82. package/dist/modules/shipment_tracking/backend/tracking-jobs/page.js.map +7 -0
  83. package/dist/modules/shipment_tracking/backend/tracking-jobs/page.meta.js +19 -0
  84. package/dist/modules/shipment_tracking/backend/tracking-jobs/page.meta.js.map +7 -0
  85. package/dist/modules/shipment_tracking/backend/webhooks/page.js +198 -0
  86. package/dist/modules/shipment_tracking/backend/webhooks/page.js.map +7 -0
  87. package/dist/modules/shipment_tracking/backend/webhooks/page.meta.js +19 -0
  88. package/dist/modules/shipment_tracking/backend/webhooks/page.meta.js.map +7 -0
  89. package/dist/modules/shipment_tracking/ce.js +52 -0
  90. package/dist/modules/shipment_tracking/ce.js.map +7 -0
  91. package/dist/modules/shipment_tracking/cli.js +229 -0
  92. package/dist/modules/shipment_tracking/cli.js.map +7 -0
  93. package/dist/modules/shipment_tracking/commands/bic-configs.js +66 -0
  94. package/dist/modules/shipment_tracking/commands/bic-configs.js.map +7 -0
  95. package/dist/modules/shipment_tracking/commands/carrier-configs.js +65 -0
  96. package/dist/modules/shipment_tracking/commands/carrier-configs.js.map +7 -0
  97. package/dist/modules/shipment_tracking/commands/index.js +9 -0
  98. package/dist/modules/shipment_tracking/commands/index.js.map +7 -0
  99. package/dist/modules/shipment_tracking/commands/location-overrides.js +93 -0
  100. package/dist/modules/shipment_tracking/commands/location-overrides.js.map +7 -0
  101. package/dist/modules/shipment_tracking/commands/shipments.js +200 -0
  102. package/dist/modules/shipment_tracking/commands/shipments.js.map +7 -0
  103. package/dist/modules/shipment_tracking/commands/shipsgo-configs.js +75 -0
  104. package/dist/modules/shipment_tracking/commands/shipsgo-configs.js.map +7 -0
  105. package/dist/modules/shipment_tracking/commands/tracking-jobs.js +120 -0
  106. package/dist/modules/shipment_tracking/commands/tracking-jobs.js.map +7 -0
  107. package/dist/modules/shipment_tracking/commands/tracking.js +140 -0
  108. package/dist/modules/shipment_tracking/commands/tracking.js.map +7 -0
  109. package/dist/modules/shipment_tracking/commands/webhooks.js +115 -0
  110. package/dist/modules/shipment_tracking/commands/webhooks.js.map +7 -0
  111. package/dist/modules/shipment_tracking/components/CombinedTimestampCell.js +168 -0
  112. package/dist/modules/shipment_tracking/components/CombinedTimestampCell.js.map +7 -0
  113. package/dist/modules/shipment_tracking/components/FacilityLocationInput.js +202 -0
  114. package/dist/modules/shipment_tracking/components/FacilityLocationInput.js.map +7 -0
  115. package/dist/modules/shipment_tracking/components/LocationOverrideDrawer.js +501 -0
  116. package/dist/modules/shipment_tracking/components/LocationOverrideDrawer.js.map +7 -0
  117. package/dist/modules/shipment_tracking/components/ShipmentDetailsDrawer.js +818 -0
  118. package/dist/modules/shipment_tracking/components/ShipmentDetailsDrawer.js.map +7 -0
  119. package/dist/modules/shipment_tracking/components/ShipmentDrawer.js +404 -0
  120. package/dist/modules/shipment_tracking/components/ShipmentDrawer.js.map +7 -0
  121. package/dist/modules/shipment_tracking/components/ShipsGoConfigSection.js +200 -0
  122. package/dist/modules/shipment_tracking/components/ShipsGoConfigSection.js.map +7 -0
  123. package/dist/modules/shipment_tracking/components/TimestampCell.js +108 -0
  124. package/dist/modules/shipment_tracking/components/TimestampCell.js.map +7 -0
  125. package/dist/modules/shipment_tracking/components/TrackingJobDrawer.js +343 -0
  126. package/dist/modules/shipment_tracking/components/TrackingJobDrawer.js.map +7 -0
  127. package/dist/modules/shipment_tracking/components/VesselTrackingMap.js +496 -0
  128. package/dist/modules/shipment_tracking/components/VesselTrackingMap.js.map +7 -0
  129. package/dist/modules/shipment_tracking/components/WebhookDrawer.js +332 -0
  130. package/dist/modules/shipment_tracking/components/WebhookDrawer.js.map +7 -0
  131. package/dist/modules/shipment_tracking/data/entities.js +686 -0
  132. package/dist/modules/shipment_tracking/data/entities.js.map +7 -0
  133. package/dist/modules/shipment_tracking/data/validators.js +434 -0
  134. package/dist/modules/shipment_tracking/data/validators.js.map +7 -0
  135. package/dist/modules/shipment_tracking/di.js +60 -0
  136. package/dist/modules/shipment_tracking/di.js.map +7 -0
  137. package/dist/modules/shipment_tracking/encryption.js +12 -0
  138. package/dist/modules/shipment_tracking/encryption.js.map +7 -0
  139. package/dist/modules/shipment_tracking/events.js +87 -0
  140. package/dist/modules/shipment_tracking/events.js.map +7 -0
  141. package/dist/modules/shipment_tracking/hooks/useVesselTracking.js +137 -0
  142. package/dist/modules/shipment_tracking/hooks/useVesselTracking.js.map +7 -0
  143. package/dist/modules/shipment_tracking/i18n/de.json +327 -0
  144. package/dist/modules/shipment_tracking/i18n/en.json +327 -0
  145. package/dist/modules/shipment_tracking/i18n/es.json +327 -0
  146. package/dist/modules/shipment_tracking/i18n/pl.json +327 -0
  147. package/dist/modules/shipment_tracking/index.js +15 -0
  148. package/dist/modules/shipment_tracking/index.js.map +7 -0
  149. package/dist/modules/shipment_tracking/lib/adapters/cma-cgm.js +66 -0
  150. package/dist/modules/shipment_tracking/lib/adapters/cma-cgm.js.map +7 -0
  151. package/dist/modules/shipment_tracking/lib/adapters/cosco-types.js +1 -0
  152. package/dist/modules/shipment_tracking/lib/adapters/cosco-types.js.map +7 -0
  153. package/dist/modules/shipment_tracking/lib/adapters/cosco.js +236 -0
  154. package/dist/modules/shipment_tracking/lib/adapters/cosco.js.map +7 -0
  155. package/dist/modules/shipment_tracking/lib/adapters/evergreen.js +87 -0
  156. package/dist/modules/shipment_tracking/lib/adapters/evergreen.js.map +7 -0
  157. package/dist/modules/shipment_tracking/lib/adapters/hapag-lloyd.js +68 -0
  158. package/dist/modules/shipment_tracking/lib/adapters/hapag-lloyd.js.map +7 -0
  159. package/dist/modules/shipment_tracking/lib/adapters/index.js +20 -0
  160. package/dist/modules/shipment_tracking/lib/adapters/index.js.map +7 -0
  161. package/dist/modules/shipment_tracking/lib/adapters/maersk.js +84 -0
  162. package/dist/modules/shipment_tracking/lib/adapters/maersk.js.map +7 -0
  163. package/dist/modules/shipment_tracking/lib/adapters/msc.js +170 -0
  164. package/dist/modules/shipment_tracking/lib/adapters/msc.js.map +7 -0
  165. package/dist/modules/shipment_tracking/lib/adapters/zim.js +85 -0
  166. package/dist/modules/shipment_tracking/lib/adapters/zim.js.map +7 -0
  167. package/dist/modules/shipment_tracking/lib/audit-helpers.js +20 -0
  168. package/dist/modules/shipment_tracking/lib/audit-helpers.js.map +7 -0
  169. package/dist/modules/shipment_tracking/lib/auth/base64url.js +8 -0
  170. package/dist/modules/shipment_tracking/lib/auth/base64url.js.map +7 -0
  171. package/dist/modules/shipment_tracking/lib/auth/oauth-client.js +38 -0
  172. package/dist/modules/shipment_tracking/lib/auth/oauth-client.js.map +7 -0
  173. package/dist/modules/shipment_tracking/lib/background.js +15 -0
  174. package/dist/modules/shipment_tracking/lib/background.js.map +7 -0
  175. package/dist/modules/shipment_tracking/lib/bic-api-client.js +106 -0
  176. package/dist/modules/shipment_tracking/lib/bic-api-client.js.map +7 -0
  177. package/dist/modules/shipment_tracking/lib/carrier-adapter.js +17 -0
  178. package/dist/modules/shipment_tracking/lib/carrier-adapter.js.map +7 -0
  179. package/dist/modules/shipment_tracking/lib/current-vessel.js +149 -0
  180. package/dist/modules/shipment_tracking/lib/current-vessel.js.map +7 -0
  181. package/dist/modules/shipment_tracking/lib/dcsa-event-mapping.js +124 -0
  182. package/dist/modules/shipment_tracking/lib/dcsa-event-mapping.js.map +7 -0
  183. package/dist/modules/shipment_tracking/lib/dcsa-event-parser.js +112 -0
  184. package/dist/modules/shipment_tracking/lib/dcsa-event-parser.js.map +7 -0
  185. package/dist/modules/shipment_tracking/lib/dcsa-params.js +16 -0
  186. package/dist/modules/shipment_tracking/lib/dcsa-params.js.map +7 -0
  187. package/dist/modules/shipment_tracking/lib/empty-return.js +48 -0
  188. package/dist/modules/shipment_tracking/lib/empty-return.js.map +7 -0
  189. package/dist/modules/shipment_tracking/lib/location-overrides.js +85 -0
  190. package/dist/modules/shipment_tracking/lib/location-overrides.js.map +7 -0
  191. package/dist/modules/shipment_tracking/lib/location-types.js +59 -0
  192. package/dist/modules/shipment_tracking/lib/location-types.js.map +7 -0
  193. package/dist/modules/shipment_tracking/lib/logger.js +113 -0
  194. package/dist/modules/shipment_tracking/lib/logger.js.map +7 -0
  195. package/dist/modules/shipment_tracking/lib/poi-event-processor.js +183 -0
  196. package/dist/modules/shipment_tracking/lib/poi-event-processor.js.map +7 -0
  197. package/dist/modules/shipment_tracking/lib/poi-nats-config.js +52 -0
  198. package/dist/modules/shipment_tracking/lib/poi-nats-config.js.map +7 -0
  199. package/dist/modules/shipment_tracking/lib/poi-types.js +43 -0
  200. package/dist/modules/shipment_tracking/lib/poi-types.js.map +7 -0
  201. package/dist/modules/shipment_tracking/lib/rate-limiter.js +31 -0
  202. package/dist/modules/shipment_tracking/lib/rate-limiter.js.map +7 -0
  203. package/dist/modules/shipment_tracking/lib/route-extraction.js +187 -0
  204. package/dist/modules/shipment_tracking/lib/route-extraction.js.map +7 -0
  205. package/dist/modules/shipment_tracking/lib/route-inference.js +106 -0
  206. package/dist/modules/shipment_tracking/lib/route-inference.js.map +7 -0
  207. package/dist/modules/shipment_tracking/lib/schedule-generator.js +63 -0
  208. package/dist/modules/shipment_tracking/lib/schedule-generator.js.map +7 -0
  209. package/dist/modules/shipment_tracking/lib/shipsgo-client.js +143 -0
  210. package/dist/modules/shipment_tracking/lib/shipsgo-client.js.map +7 -0
  211. package/dist/modules/shipment_tracking/lib/shipsgo-mapper.js +204 -0
  212. package/dist/modules/shipment_tracking/lib/shipsgo-mapper.js.map +7 -0
  213. package/dist/modules/shipment_tracking/lib/status-machine.js +131 -0
  214. package/dist/modules/shipment_tracking/lib/status-machine.js.map +7 -0
  215. package/dist/modules/shipment_tracking/lib/time-extraction.js +41 -0
  216. package/dist/modules/shipment_tracking/lib/time-extraction.js.map +7 -0
  217. package/dist/modules/shipment_tracking/lib/timestamp-utils.js +100 -0
  218. package/dist/modules/shipment_tracking/lib/timestamp-utils.js.map +7 -0
  219. package/dist/modules/shipment_tracking/lib/vessel-api.js +111 -0
  220. package/dist/modules/shipment_tracking/lib/vessel-api.js.map +7 -0
  221. package/dist/modules/shipment_tracking/lib/vessel-cache.js +50 -0
  222. package/dist/modules/shipment_tracking/lib/vessel-cache.js.map +7 -0
  223. package/dist/modules/shipment_tracking/lib/vessel-extraction.js +13 -0
  224. package/dist/modules/shipment_tracking/lib/vessel-extraction.js.map +7 -0
  225. package/dist/modules/shipment_tracking/lib/webhook-dispatcher.js +62 -0
  226. package/dist/modules/shipment_tracking/lib/webhook-dispatcher.js.map +7 -0
  227. package/dist/modules/shipment_tracking/migrations/Migration20260422161208_shipment_tracking.js +48 -0
  228. package/dist/modules/shipment_tracking/migrations/Migration20260422161208_shipment_tracking.js.map +7 -0
  229. package/dist/modules/shipment_tracking/migrations/Migration20260529120000_shipment_tracking_poi_region_names.js +15 -0
  230. package/dist/modules/shipment_tracking/migrations/Migration20260529120000_shipment_tracking_poi_region_names.js.map +7 -0
  231. package/dist/modules/shipment_tracking/migrations/Migration20260821120000_shipment_tracking_shipsgo.js +47 -0
  232. package/dist/modules/shipment_tracking/migrations/Migration20260821120000_shipment_tracking_shipsgo.js.map +7 -0
  233. package/dist/modules/shipment_tracking/notifications.js +145 -0
  234. package/dist/modules/shipment_tracking/notifications.js.map +7 -0
  235. package/dist/modules/shipment_tracking/services/carrierRegistry.js +24 -0
  236. package/dist/modules/shipment_tracking/services/carrierRegistry.js.map +7 -0
  237. package/dist/modules/shipment_tracking/services/poiNatsService.js +397 -0
  238. package/dist/modules/shipment_tracking/services/poiNatsService.js.map +7 -0
  239. package/dist/modules/shipment_tracking/services/shipsGoProvider.js +163 -0
  240. package/dist/modules/shipment_tracking/services/shipsGoProvider.js.map +7 -0
  241. package/dist/modules/shipment_tracking/services/trackingService.js +1283 -0
  242. package/dist/modules/shipment_tracking/services/trackingService.js.map +7 -0
  243. package/dist/modules/shipment_tracking/services/webhookService.js +263 -0
  244. package/dist/modules/shipment_tracking/services/webhookService.js.map +7 -0
  245. package/dist/modules/shipment_tracking/setup.js +72 -0
  246. package/dist/modules/shipment_tracking/setup.js.map +7 -0
  247. package/dist/modules/shipment_tracking/subscribers/cargo-event-created.js +60 -0
  248. package/dist/modules/shipment_tracking/subscribers/cargo-event-created.js.map +7 -0
  249. package/dist/modules/shipment_tracking/subscribers/dcsa-event-webhook-dispatch.js +58 -0
  250. package/dist/modules/shipment_tracking/subscribers/dcsa-event-webhook-dispatch.js.map +7 -0
  251. package/dist/modules/shipment_tracking/subscribers/poi-event-notification.js +82 -0
  252. package/dist/modules/shipment_tracking/subscribers/poi-event-notification.js.map +7 -0
  253. package/dist/modules/shipment_tracking/subscribers/poi-event-webhook-dispatch.js +53 -0
  254. package/dist/modules/shipment_tracking/subscribers/poi-event-webhook-dispatch.js.map +7 -0
  255. package/dist/modules/shipment_tracking/subscribers/shipment-status-changed.js +28 -0
  256. package/dist/modules/shipment_tracking/subscribers/shipment-status-changed.js.map +7 -0
  257. package/dist/modules/shipment_tracking/subscribers/terminal-event-ingest.js +67 -0
  258. package/dist/modules/shipment_tracking/subscribers/terminal-event-ingest.js.map +7 -0
  259. package/dist/modules/shipment_tracking/subscribers/tracking-job-initial-poll.js +30 -0
  260. package/dist/modules/shipment_tracking/subscribers/tracking-job-initial-poll.js.map +7 -0
  261. package/dist/modules/shipment_tracking/subscribers/tracking-job-webhook-dispatch.js +19 -0
  262. package/dist/modules/shipment_tracking/subscribers/tracking-job-webhook-dispatch.js.map +7 -0
  263. package/dist/modules/shipment_tracking/tables/index.js +6 -0
  264. package/dist/modules/shipment_tracking/tables/index.js.map +7 -0
  265. package/dist/modules/shipment_tracking/tables/tracking_job/table.client.js +284 -0
  266. package/dist/modules/shipment_tracking/tables/tracking_job/table.client.js.map +7 -0
  267. package/dist/modules/shipment_tracking/tables/tracking_job/table.js +36 -0
  268. package/dist/modules/shipment_tracking/tables/tracking_job/table.js.map +7 -0
  269. package/dist/modules/shipment_tracking/widgets/dashboard/ships-map/config.js +25 -0
  270. package/dist/modules/shipment_tracking/widgets/dashboard/ships-map/config.js.map +7 -0
  271. package/dist/modules/shipment_tracking/widgets/dashboard/ships-map/widget.client.js +355 -0
  272. package/dist/modules/shipment_tracking/widgets/dashboard/ships-map/widget.client.js.map +7 -0
  273. package/dist/modules/shipment_tracking/widgets/dashboard/ships-map/widget.js +26 -0
  274. package/dist/modules/shipment_tracking/widgets/dashboard/ships-map/widget.js.map +7 -0
  275. package/dist/types/assets.d.js +1 -0
  276. package/dist/types/assets.d.js.map +7 -0
  277. package/generated/entities/bic_config/index.ts +20 -0
  278. package/generated/entities/carrier_config/index.ts +23 -0
  279. package/generated/entities/location_override/index.ts +26 -0
  280. package/generated/entities/shipment/index.ts +46 -0
  281. package/generated/entities/ships_go_config/index.ts +25 -0
  282. package/generated/entities/tracking_event/index.ts +60 -0
  283. package/generated/entities/tracking_job/index.ts +33 -0
  284. package/generated/entities/webhook/index.ts +22 -0
  285. package/generated/entities/webhook_delivery/index.ts +22 -0
  286. package/generated/entities.ids.generated.ts +47 -0
  287. package/package.json +81 -0
  288. package/src/index.ts +39 -0
  289. package/src/modules/shipment_tracking/__integration__/TC-TRACK-410-shipsgo-config-api.spec.ts +133 -0
  290. package/src/modules/shipment_tracking/__integration__/meta.ts +4 -0
  291. package/src/modules/shipment_tracking/__tests__/empty-return-stop.test.ts +231 -0
  292. package/src/modules/shipment_tracking/__tests__/fixtures/hapag-lloyd-transship-container.json +702 -0
  293. package/src/modules/shipment_tracking/__tests__/fixtures/index.ts +434 -0
  294. package/src/modules/shipment_tracking/__tests__/fixtures/maersk-multi-transship-completed.json +1518 -0
  295. package/src/modules/shipment_tracking/__tests__/fixtures/maersk-transship-intransit.json +558 -0
  296. package/src/modules/shipment_tracking/__tests__/fixtures/msc-direct.json +222 -0
  297. package/src/modules/shipment_tracking/__tests__/fixtures/msc-multi-transship-completed.json +974 -0
  298. package/src/modules/shipment_tracking/__tests__/fixtures/msc-multi.json +4846 -0
  299. package/src/modules/shipment_tracking/__tests__/fixtures/msc-transship.json +409 -0
  300. package/src/modules/shipment_tracking/__tests__/fixtures/poi-events.json +240 -0
  301. package/src/modules/shipment_tracking/__tests__/fixtures/synthetic/index.ts +138 -0
  302. package/src/modules/shipment_tracking/__tests__/fixtures/synthetic-eta-updates.json +288 -0
  303. package/src/modules/shipment_tracking/__tests__/fixtures/synthetic-route-inference.json +201 -0
  304. package/src/modules/shipment_tracking/__tests__/fixtures/synthetic-voyage-progression.json +410 -0
  305. package/src/modules/shipment_tracking/__tests__/shipsgo-air-mapper.test.ts +157 -0
  306. package/src/modules/shipment_tracking/__tests__/shipsgo-client.test.ts +155 -0
  307. package/src/modules/shipment_tracking/__tests__/shipsgo-mapper.test.ts +201 -0
  308. package/src/modules/shipment_tracking/__tests__/shipsgo-poll.test.ts +357 -0
  309. package/src/modules/shipment_tracking/__tests__/shipsgo-provider.test.ts +364 -0
  310. package/src/modules/shipment_tracking/__tests__/trackingService.integration.test.ts +2248 -0
  311. package/src/modules/shipment_tracking/__tests__/webhookPayload.test.ts +151 -0
  312. package/src/modules/shipment_tracking/acl.ts +18 -0
  313. package/src/modules/shipment_tracking/api/bic-configs/route.ts +206 -0
  314. package/src/modules/shipment_tracking/api/bic-configs/test/route.ts +108 -0
  315. package/src/modules/shipment_tracking/api/cargo-events/route.ts +101 -0
  316. package/src/modules/shipment_tracking/api/carrier-configs/route.ts +142 -0
  317. package/src/modules/shipment_tracking/api/dashboard/ships-map/route.ts +246 -0
  318. package/src/modules/shipment_tracking/api/location-overrides/route.ts +185 -0
  319. package/src/modules/shipment_tracking/api/openapi.ts +28 -0
  320. package/src/modules/shipment_tracking/api/shipments/route.ts +197 -0
  321. package/src/modules/shipment_tracking/api/shipsgo-configs/route.ts +215 -0
  322. package/src/modules/shipment_tracking/api/tracking-jobs/route.ts +149 -0
  323. package/src/modules/shipment_tracking/api/tracking-jobs/sync/route.ts +116 -0
  324. package/src/modules/shipment_tracking/api/utils.ts +10 -0
  325. package/src/modules/shipment_tracking/api/webhooks/deliveries/route.ts +82 -0
  326. package/src/modules/shipment_tracking/api/webhooks/route.ts +138 -0
  327. package/src/modules/shipment_tracking/api/webhooks/test/route.ts +84 -0
  328. package/src/modules/shipment_tracking/assets/carriers/cma_cgm.png +0 -0
  329. package/src/modules/shipment_tracking/assets/carriers/cosco.png +0 -0
  330. package/src/modules/shipment_tracking/assets/carriers/evergreen.png +0 -0
  331. package/src/modules/shipment_tracking/assets/carriers/hapag_lloyd.png +0 -0
  332. package/src/modules/shipment_tracking/assets/carriers/maersk.png +0 -0
  333. package/src/modules/shipment_tracking/assets/carriers/msc.png +0 -0
  334. package/src/modules/shipment_tracking/assets/carriers/one.png +0 -0
  335. package/src/modules/shipment_tracking/assets/carriers/oocl.png +0 -0
  336. package/src/modules/shipment_tracking/assets/carriers/yang_ming.png +0 -0
  337. package/src/modules/shipment_tracking/assets/carriers/zim.png +0 -0
  338. package/src/modules/shipment_tracking/assets/index.ts +66 -0
  339. package/src/modules/shipment_tracking/backend/carrier-configs/page.meta.ts +16 -0
  340. package/src/modules/shipment_tracking/backend/carrier-configs/page.tsx +782 -0
  341. package/src/modules/shipment_tracking/backend/location-overrides/page.meta.ts +16 -0
  342. package/src/modules/shipment_tracking/backend/location-overrides/page.tsx +241 -0
  343. package/src/modules/shipment_tracking/backend/shipment-tracking/page.meta.ts +16 -0
  344. package/src/modules/shipment_tracking/backend/shipment-tracking/page.tsx +340 -0
  345. package/src/modules/shipment_tracking/backend/tracking-jobs/page.meta.ts +16 -0
  346. package/src/modules/shipment_tracking/backend/tracking-jobs/page.tsx +16 -0
  347. package/src/modules/shipment_tracking/backend/webhooks/page.meta.ts +16 -0
  348. package/src/modules/shipment_tracking/backend/webhooks/page.tsx +228 -0
  349. package/src/modules/shipment_tracking/ce.ts +48 -0
  350. package/src/modules/shipment_tracking/cli.ts +321 -0
  351. package/src/modules/shipment_tracking/commands/bic-configs.ts +94 -0
  352. package/src/modules/shipment_tracking/commands/carrier-configs.ts +89 -0
  353. package/src/modules/shipment_tracking/commands/index.ts +8 -0
  354. package/src/modules/shipment_tracking/commands/location-overrides.ts +119 -0
  355. package/src/modules/shipment_tracking/commands/shipments.ts +247 -0
  356. package/src/modules/shipment_tracking/commands/shipsgo-configs.ts +101 -0
  357. package/src/modules/shipment_tracking/commands/tracking-jobs.ts +158 -0
  358. package/src/modules/shipment_tracking/commands/tracking.ts +230 -0
  359. package/src/modules/shipment_tracking/commands/webhooks.ts +159 -0
  360. package/src/modules/shipment_tracking/components/CombinedTimestampCell.tsx +236 -0
  361. package/src/modules/shipment_tracking/components/FacilityLocationInput.tsx +235 -0
  362. package/src/modules/shipment_tracking/components/LocationOverrideDrawer.tsx +586 -0
  363. package/src/modules/shipment_tracking/components/ShipmentDetailsDrawer.tsx +1364 -0
  364. package/src/modules/shipment_tracking/components/ShipmentDrawer.tsx +498 -0
  365. package/src/modules/shipment_tracking/components/ShipsGoConfigSection.tsx +266 -0
  366. package/src/modules/shipment_tracking/components/TimestampCell.tsx +146 -0
  367. package/src/modules/shipment_tracking/components/TrackingJobDrawer.tsx +467 -0
  368. package/src/modules/shipment_tracking/components/VesselTrackingMap.tsx +761 -0
  369. package/src/modules/shipment_tracking/components/WebhookDrawer.tsx +434 -0
  370. package/src/modules/shipment_tracking/data/entities.ts +748 -0
  371. package/src/modules/shipment_tracking/data/validators.ts +523 -0
  372. package/src/modules/shipment_tracking/di.ts +73 -0
  373. package/src/modules/shipment_tracking/encryption.ts +17 -0
  374. package/src/modules/shipment_tracking/events.ts +122 -0
  375. package/src/modules/shipment_tracking/hooks/useVesselTracking.ts +297 -0
  376. package/src/modules/shipment_tracking/i18n/de.json +327 -0
  377. package/src/modules/shipment_tracking/i18n/en.json +327 -0
  378. package/src/modules/shipment_tracking/i18n/es.json +327 -0
  379. package/src/modules/shipment_tracking/i18n/pl.json +327 -0
  380. package/src/modules/shipment_tracking/index.ts +13 -0
  381. package/src/modules/shipment_tracking/lib/__tests__/dcsa-event-mapping.test.ts +385 -0
  382. package/src/modules/shipment_tracking/lib/__tests__/dcsa-event-parser.test.ts +398 -0
  383. package/src/modules/shipment_tracking/lib/__tests__/empty-return.test.ts +174 -0
  384. package/src/modules/shipment_tracking/lib/__tests__/poi-event-processor.test.ts +699 -0
  385. package/src/modules/shipment_tracking/lib/__tests__/route-inference.test.ts +402 -0
  386. package/src/modules/shipment_tracking/lib/__tests__/status-machine.test.ts +447 -0
  387. package/src/modules/shipment_tracking/lib/__tests__/time-extraction.test.ts +331 -0
  388. package/src/modules/shipment_tracking/lib/__tests__/timestamp-utils.test.ts +260 -0
  389. package/src/modules/shipment_tracking/lib/__tests__/vessel-api.test.ts +125 -0
  390. package/src/modules/shipment_tracking/lib/__tests__/vessel-extraction.test.ts +108 -0
  391. package/src/modules/shipment_tracking/lib/adapters/cma-cgm.ts +84 -0
  392. package/src/modules/shipment_tracking/lib/adapters/cosco-types.ts +145 -0
  393. package/src/modules/shipment_tracking/lib/adapters/cosco.ts +314 -0
  394. package/src/modules/shipment_tracking/lib/adapters/evergreen.ts +107 -0
  395. package/src/modules/shipment_tracking/lib/adapters/hapag-lloyd.ts +88 -0
  396. package/src/modules/shipment_tracking/lib/adapters/index.ts +18 -0
  397. package/src/modules/shipment_tracking/lib/adapters/maersk.ts +104 -0
  398. package/src/modules/shipment_tracking/lib/adapters/msc.ts +223 -0
  399. package/src/modules/shipment_tracking/lib/adapters/zim.ts +106 -0
  400. package/src/modules/shipment_tracking/lib/audit-helpers.ts +29 -0
  401. package/src/modules/shipment_tracking/lib/auth/base64url.ts +4 -0
  402. package/src/modules/shipment_tracking/lib/auth/oauth-client.ts +53 -0
  403. package/src/modules/shipment_tracking/lib/background.ts +24 -0
  404. package/src/modules/shipment_tracking/lib/bic-api-client.ts +199 -0
  405. package/src/modules/shipment_tracking/lib/carrier-adapter.ts +136 -0
  406. package/src/modules/shipment_tracking/lib/current-vessel.ts +274 -0
  407. package/src/modules/shipment_tracking/lib/dcsa-event-mapping.ts +202 -0
  408. package/src/modules/shipment_tracking/lib/dcsa-event-parser.ts +163 -0
  409. package/src/modules/shipment_tracking/lib/dcsa-params.ts +14 -0
  410. package/src/modules/shipment_tracking/lib/empty-return.ts +122 -0
  411. package/src/modules/shipment_tracking/lib/location-overrides.ts +150 -0
  412. package/src/modules/shipment_tracking/lib/location-types.ts +154 -0
  413. package/src/modules/shipment_tracking/lib/logger.ts +195 -0
  414. package/src/modules/shipment_tracking/lib/poi-event-processor.ts +302 -0
  415. package/src/modules/shipment_tracking/lib/poi-nats-config.ts +134 -0
  416. package/src/modules/shipment_tracking/lib/poi-types.ts +198 -0
  417. package/src/modules/shipment_tracking/lib/rate-limiter.ts +58 -0
  418. package/src/modules/shipment_tracking/lib/route-extraction.ts +439 -0
  419. package/src/modules/shipment_tracking/lib/route-inference.ts +238 -0
  420. package/src/modules/shipment_tracking/lib/schedule-generator.ts +92 -0
  421. package/src/modules/shipment_tracking/lib/shipsgo-client.ts +350 -0
  422. package/src/modules/shipment_tracking/lib/shipsgo-mapper.ts +296 -0
  423. package/src/modules/shipment_tracking/lib/status-machine.ts +230 -0
  424. package/src/modules/shipment_tracking/lib/time-extraction.ts +85 -0
  425. package/src/modules/shipment_tracking/lib/timestamp-utils.ts +244 -0
  426. package/src/modules/shipment_tracking/lib/vessel-api.ts +299 -0
  427. package/src/modules/shipment_tracking/lib/vessel-cache.ts +102 -0
  428. package/src/modules/shipment_tracking/lib/vessel-extraction.ts +39 -0
  429. package/src/modules/shipment_tracking/lib/webhook-dispatcher.ts +93 -0
  430. package/src/modules/shipment_tracking/migrations/.snapshot-open-mercato.json +2914 -0
  431. package/src/modules/shipment_tracking/migrations/Migration20260422161208_shipment_tracking.ts +60 -0
  432. package/src/modules/shipment_tracking/migrations/Migration20260529120000_shipment_tracking_poi_region_names.ts +22 -0
  433. package/src/modules/shipment_tracking/migrations/Migration20260821120000_shipment_tracking_shipsgo.ts +65 -0
  434. package/src/modules/shipment_tracking/notifications.ts +151 -0
  435. package/src/modules/shipment_tracking/services/carrierRegistry.ts +29 -0
  436. package/src/modules/shipment_tracking/services/poiNatsService.ts +526 -0
  437. package/src/modules/shipment_tracking/services/shipsGoProvider.ts +231 -0
  438. package/src/modules/shipment_tracking/services/trackingService.ts +1777 -0
  439. package/src/modules/shipment_tracking/services/webhookService.ts +347 -0
  440. package/src/modules/shipment_tracking/setup.ts +99 -0
  441. package/src/modules/shipment_tracking/subscribers/__tests__/terminal-event-ingest.test.ts +141 -0
  442. package/src/modules/shipment_tracking/subscribers/cargo-event-created.ts +115 -0
  443. package/src/modules/shipment_tracking/subscribers/dcsa-event-webhook-dispatch.ts +115 -0
  444. package/src/modules/shipment_tracking/subscribers/poi-event-notification.ts +144 -0
  445. package/src/modules/shipment_tracking/subscribers/poi-event-webhook-dispatch.ts +94 -0
  446. package/src/modules/shipment_tracking/subscribers/shipment-status-changed.ts +41 -0
  447. package/src/modules/shipment_tracking/subscribers/terminal-event-ingest.ts +109 -0
  448. package/src/modules/shipment_tracking/subscribers/tracking-job-initial-poll.ts +53 -0
  449. package/src/modules/shipment_tracking/subscribers/tracking-job-webhook-dispatch.ts +50 -0
  450. package/src/modules/shipment_tracking/tables/index.ts +4 -0
  451. package/src/modules/shipment_tracking/tables/tracking_job/table.client.tsx +337 -0
  452. package/src/modules/shipment_tracking/tables/tracking_job/table.ts +34 -0
  453. package/src/modules/shipment_tracking/widgets/dashboard/ships-map/config.ts +32 -0
  454. package/src/modules/shipment_tracking/widgets/dashboard/ships-map/widget.client.tsx +448 -0
  455. package/src/modules/shipment_tracking/widgets/dashboard/ships-map/widget.ts +25 -0
  456. package/src/types/assets.d.ts +5 -0
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../src/modules/shipment_tracking/data/entities.ts"],
4
+ "sourcesContent": ["import { Collection, OptionalProps } from '@mikro-orm/core'\nimport { Entity, PrimaryKey, Property, Index, Unique, ManyToOne, OneToMany } from '@mikro-orm/decorators/legacy'\nimport type { ShipmentTimestampEntry } from '../lib/timestamp-utils'\nimport type { RouteStopEntry, CargoEventEntry, SealInfo } from '../lib/route-extraction'\nimport type { FacilityLocation } from '../lib/location-types'\n\n// Re-export timestamp types for convenience\nexport type { ShipmentTimestampEntry, TimestampSource, TimestampType } from '../lib/timestamp-utils'\n// Re-export route extraction types for convenience\nexport type { RouteStopEntry, CargoEventEntry, SealInfo } from '../lib/route-extraction'\n// Re-export location types for convenience\nexport type { FacilityLocation } from '../lib/location-types'\n\n// \u2500\u2500\u2500 Enums \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\nexport type ShipmentStatusEnum =\n | 'PENDING'\n | 'BOOKED'\n | 'DEPARTED'\n | 'IN_TRANSIT'\n | 'PRE_ARRIVAL'\n | 'ARRIVED'\n | 'DELIVERED'\n\nexport type TrackingJobStatusEnum = 'active' | 'paused' | 'deactivated' | 'failed' | 'completed'\n\nexport type TrackingEventType = 'EQUIPMENT' | 'TRANSPORT' | 'SHIPMENT'\n\nexport type TrackingEventClassifierCode = 'ACT' | 'PLN' | 'EST'\n\nexport type TrackingEventSource = 'dcsa' | 'ais' | 'port' | 'edi' | 'manual' | 'shipsgo'\n\nexport type WebhookDeliveryStatus = 'pending' | 'success' | 'failed'\n\nexport type TrackingReferenceType = 'container' | 'booking' | 'bol' | 'awb'\n\n// Which upstream source a tracking job is driven by:\n// 'carrier' \u2192 a direct DCSA carrier adapter (default, primary)\n// 'shipsgo' \u2192 the ShipsGo aggregator (fallback for unsupported ocean carriers + air)\nexport type TrackingProvider = 'carrier' | 'shipsgo'\n\n// Transport mode for a tracking job / shipment. Ocean is the historical default;\n// air arrives with the ShipsGo integration.\nexport type TrackingMode = 'ocean' | 'air'\n\n\n\n// Types for JSONB fields\nexport type DocumentReference = {\n type: string // BKG, TRD, SHI, CBR, ARN, VGM, etc.\n value: string\n}\n\n// SealInfo is now imported from route-extraction.ts and re-exported\n\nexport type ModeOfTransport = 'VESSEL' | 'RAIL' | 'TRUCK' | 'BARGE' | 'AIR'\nexport type EmptyIndicatorCode = 'EMPTY' | 'LADEN'\nexport type FacilityCodeListProvider = 'SMDG' | 'BIC'\n\n// \u2500\u2500\u2500 TrackingJob \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n// Declared first as it's referenced by Shipment and TrackingEvent\n\n@Entity({ tableName: 'shipment_tracking_jobs' })\n@Index({ name: 'st_jobs_org_tenant_idx', properties: ['organizationId', 'tenantId'] })\n@Index({ name: 'st_jobs_status_idx', properties: ['status'] })\n@Index({ name: 'st_jobs_next_poll_idx', properties: ['nextPollAt'] })\nexport class TrackingJob {\n [OptionalProps]?: 'createdAt' | 'updatedAt' | 'deletedAt' | 'status' | 'retryCount' | 'originUnlocode' | 'destinationUnlocode' | 'provider' | 'mode'\n\n @PrimaryKey({ type: 'uuid', defaultRaw: 'gen_random_uuid()' })\n id!: string\n\n @Property({ name: 'organization_id', type: 'uuid' })\n organizationId!: string\n\n @Property({ name: 'tenant_id', type: 'uuid' })\n tenantId!: string\n\n // Tracking source. 'carrier' = direct DCSA adapter (default); 'shipsgo' = aggregator fallback.\n @Property({ type: 'text', default: 'carrier' })\n provider: TrackingProvider = 'carrier'\n\n // Transport mode. 'ocean' (default) or 'air'.\n @Property({ type: 'text', default: 'ocean' })\n mode: TrackingMode = 'ocean'\n\n // For provider='shipsgo': the ShipsGo shipment id returned on registration,\n // used for subsequent GET polls. Null until the job has been registered.\n @Property({ name: 'provider_shipment_id', type: 'text', nullable: true })\n providerShipmentId?: string | null\n\n // For provider='carrier', the internal carrier code (SCAC-derived). For\n // provider='shipsgo' ocean this may be a SCAC hint (optional \u2014 ShipsGo\n // auto-detects) and for air it is unused (the AWB prefix identifies the airline).\n @Property({ name: 'carrier_code', type: 'text' })\n carrierCode!: string\n\n @Property({ name: 'reference_type', type: 'text' })\n referenceType!: TrackingReferenceType\n\n @Property({ name: 'reference_value', type: 'text' })\n referenceValue!: string\n\n // Origin/destination are optional - will be auto-inferred from tracking events if not provided\n @Property({ name: 'origin_unlocode', type: 'text', length: 5, nullable: true })\n originUnlocode?: string | null\n\n @Property({ name: 'destination_unlocode', type: 'text', length: 5, nullable: true })\n destinationUnlocode?: string | null\n\n @Property({ type: 'text', default: 'active' })\n status: TrackingJobStatusEnum = 'active'\n\n // JSON array of scheduled poll dates\n @Property({ type: 'jsonb', nullable: true })\n schedule?: string[] | null\n\n @Property({ name: 'next_poll_at', type: Date, nullable: true })\n nextPollAt?: Date | null\n\n @Property({ name: 'last_poll_at', type: Date, nullable: true })\n lastPollAt?: Date | null\n\n @Property({ name: 'retry_count', type: 'integer', default: 0 })\n retryCount: number = 0\n\n @Property({ name: 'error_history', type: 'jsonb', nullable: true })\n errorHistory?: Array<{ date: string; message: string }> | null\n\n @Property({ name: 'created_at', type: Date, defaultRaw: 'now()' })\n createdAt!: Date\n\n @Property({ name: 'updated_at', type: Date, defaultRaw: 'now()', onUpdate: () => new Date() })\n updatedAt!: Date\n\n @Property({ name: 'deleted_at', type: Date, nullable: true })\n deletedAt?: Date | null\n\n // One TrackingJob can track multiple shipments (containers)\n @OneToMany(() => Shipment, (s) => s.trackingJob)\n shipments = new Collection<Shipment>(this)\n\n // One TrackingJob has many TrackingEvents\n @OneToMany(() => TrackingEvent, (e) => e.trackingJob)\n events = new Collection<TrackingEvent>(this)\n}\n\n// \u2500\u2500\u2500 Shipment \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\n@Entity({ tableName: 'shipment_tracking_shipments' })\n@Index({ name: 'st_shipments_org_tenant_idx', properties: ['organizationId', 'tenantId'] })\n@Index({ name: 'st_shipments_status_idx', properties: ['status'] })\n@Index({ name: 'st_shipments_carrier_idx', properties: ['carrierCode'] })\n@Index({ name: 'st_shipments_tracking_job_idx', properties: ['trackingJob'] })\nexport class Shipment {\n [OptionalProps]?: 'isActive' | 'createdAt' | 'updatedAt' | 'deletedAt' | 'status' | 'eventCount' | 'trackingJob' | 'routeStops' | 'cargoEvents' | 'seals' | 'originLocation' | 'destinationLocation' | 'isoEquipmentCode' | 'mode'\n\n @PrimaryKey({ type: 'uuid', defaultRaw: 'gen_random_uuid()' })\n id!: string\n\n @Property({ name: 'organization_id', type: 'uuid' })\n organizationId!: string\n\n @Property({ name: 'tenant_id', type: 'uuid' })\n tenantId!: string\n\n @Property({ type: 'text', default: 'PENDING' })\n status: ShipmentStatusEnum = 'PENDING'\n\n // Transport mode. 'ocean' (default) or 'air'. Air shipments leave the\n // container/vessel fields null and populate awb/flight/airline instead.\n @Property({ type: 'text', default: 'ocean' })\n mode: TrackingMode = 'ocean'\n\n @Property({ name: 'carrier_code', type: 'text', nullable: true })\n carrierCode?: string | null\n\n @Property({ name: 'container_number', type: 'text', nullable: true })\n containerNumber?: string | null\n\n // \u2500\u2500\u2500 Air fields (mode='air') \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n @Property({ name: 'awb_number', type: 'text', nullable: true })\n awbNumber?: string | null\n\n @Property({ name: 'flight_number', type: 'text', nullable: true })\n flightNumber?: string | null\n\n @Property({ name: 'airline_code', type: 'text', nullable: true })\n airlineCode?: string | null\n\n @Property({ name: 'airline_name', type: 'text', nullable: true })\n airlineName?: string | null\n\n @Property({ name: 'iso_equipment_code', type: 'text', nullable: true })\n isoEquipmentCode?: string | null // Container type (22G1, 45R1, etc.)\n\n @Property({ name: 'booking_number', type: 'text', nullable: true })\n bookingNumber?: string | null\n\n @Property({ name: 'bol_number', type: 'text', nullable: true })\n bolNumber?: string | null\n\n // \u2500\u2500\u2500 Multi-source Timestamps (JSONB arrays) \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n // Each array tracks timestamps from multiple sources with full history (SCD pattern).\n // Primary value is computed using \"latest update wins\" strategy.\n // Use helpers from lib/timestamp-utils.ts: getLatestTimestamp(), getPrimaryTimestampValue()\n @Property({ name: 'etd_timestamps', type: 'jsonb', nullable: true })\n etdTimestamps?: ShipmentTimestampEntry[] | null\n\n @Property({ name: 'eta_timestamps', type: 'jsonb', nullable: true })\n etaTimestamps?: ShipmentTimestampEntry[] | null\n\n @Property({ name: 'atd_timestamps', type: 'jsonb', nullable: true })\n atdTimestamps?: ShipmentTimestampEntry[] | null\n\n @Property({ name: 'ata_timestamps', type: 'jsonb', nullable: true })\n ataTimestamps?: ShipmentTimestampEntry[] | null\n\n // \u2500\u2500\u2500 Location Data (JSONB) \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n // Full origin/destination details including facility, address, coordinates.\n // Populated from DCSA events, enriched with BIC API if needed.\n\n @Property({ name: 'origin_location', type: 'jsonb', nullable: true })\n originLocation?: FacilityLocation | null\n\n @Property({ name: 'destination_location', type: 'jsonb', nullable: true })\n destinationLocation?: FacilityLocation | null\n\n // Vessel\n @Property({ name: 'vessel_name', type: 'text', nullable: true })\n vesselName?: string | null\n\n @Property({ name: 'vessel_imo', type: 'text', nullable: true })\n vesselImo?: string | null\n\n @Property({ name: 'voyage_number', type: 'text', nullable: true })\n voyageNumber?: string | null\n\n @Property({ name: 'event_count', type: 'integer', default: 0 })\n eventCount: number = 0\n\n @Property({ name: 'last_event_at', type: Date, nullable: true })\n lastEventAt?: Date | null\n\n @Property({ type: 'jsonb', nullable: true })\n extra?: Record<string, unknown> | null\n\n // \u2500\u2500\u2500 Denormalized Route & Events (JSONB) \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n // Pre-computed route stops and filtered cargo events for this specific container.\n // Populated by TrackingService when processing events, eliminating extra API calls.\n\n @Property({ name: 'route_stops', type: 'jsonb', nullable: true })\n routeStops?: RouteStopEntry[] | null\n\n @Property({ name: 'cargo_events', type: 'jsonb', nullable: true })\n cargoEvents?: CargoEventEntry[] | null\n\n // \u2500\u2500\u2500 Aggregated Seals \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n // All unique seals seen across all cargo events for this container.\n // Deduplicated by seal number, keeping the most recent occurrence.\n @Property({ type: 'jsonb', nullable: true })\n seals?: SealInfo[] | null\n\n @Property({ name: 'is_active', type: 'boolean', default: true })\n isActive: boolean = true\n\n @Property({ name: 'created_at', type: Date, defaultRaw: 'now()' })\n createdAt!: Date\n\n @Property({ name: 'updated_at', type: Date, defaultRaw: 'now()', onUpdate: () => new Date() })\n updatedAt!: Date\n\n @Property({ name: 'deleted_at', type: Date, nullable: true })\n deletedAt?: Date | null\n\n @Property({ name: 'created_by_user_id', type: 'uuid', nullable: true })\n createdByUserId?: string | null\n\n // Shipment belongs to a TrackingJob (nullable - shipment can exist without active tracking)\n @ManyToOne(() => TrackingJob, { fieldName: 'tracking_job_id', nullable: true })\n trackingJob?: TrackingJob | null\n}\n\n// \u2500\u2500\u2500 TrackingEvent \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\n@Entity({ tableName: 'shipment_tracking_events' })\n@Index({ name: 'st_events_org_tenant_idx', properties: ['organizationId', 'tenantId'] })\n@Index({ name: 'st_events_tracking_job_idx', properties: ['trackingJob'] })\n@Index({ name: 'st_events_equipment_ref_idx', properties: ['equipmentReference'] })\n@Index({ name: 'st_events_event_date_time_idx', properties: ['eventDateTime'] })\n@Unique({ name: 'st_events_source_event_uniq', properties: ['trackingJob', 'source', 'sourceEventId'] })\nexport class TrackingEvent {\n [OptionalProps]?: 'createdAt' | 'source'\n\n @PrimaryKey({ type: 'uuid', defaultRaw: 'gen_random_uuid()' })\n id!: string\n\n @Property({ name: 'organization_id', type: 'uuid' })\n organizationId!: string\n\n @Property({ name: 'tenant_id', type: 'uuid' })\n tenantId!: string\n\n // Event belongs to a TrackingJob (not Shipment)\n @ManyToOne(() => TrackingJob, { fieldName: 'tracking_job_id' })\n trackingJob!: TrackingJob\n\n // \u2500\u2500\u2500 Event Source \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\n @Property({ type: 'text', default: 'dcsa' })\n source: TrackingEventSource = 'dcsa'\n\n @Property({ name: 'source_event_id', type: 'text', nullable: true })\n sourceEventId?: string | null // Original ID from the source system (e.g., DCSA eventId)\n\n // \u2500\u2500\u2500 Core Event Fields \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\n @Property({ name: 'event_type', type: 'text' })\n eventType!: TrackingEventType\n\n @Property({ name: 'event_code', type: 'text' })\n eventCode!: string\n\n @Property({ name: 'event_classifier_code', type: 'text', nullable: true })\n eventClassifierCode?: TrackingEventClassifierCode | null\n\n @Property({ name: 'event_date_time', type: Date })\n eventDateTime!: Date\n\n @Property({ name: 'event_date_time_offset', type: 'text', nullable: true })\n eventDateTimeOffset?: string | null\n\n @Property({ type: 'text', nullable: true })\n description?: string | null\n\n @Property({ name: 'raw_data', type: 'jsonb', nullable: true })\n rawData?: Record<string, unknown> | null\n\n // \u2500\u2500\u2500 Equipment Fields (DCSA EQUIPMENT events) \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\n @Property({ name: 'equipment_reference', type: 'text', nullable: true })\n equipmentReference?: string | null // Container number (BIC ISO)\n\n @Property({ name: 'iso_equipment_code', type: 'text', nullable: true })\n isoEquipmentCode?: string | null // Container type (22G1, 45R1, etc.)\n\n @Property({ name: 'empty_indicator_code', type: 'text', nullable: true })\n emptyIndicatorCode?: EmptyIndicatorCode | null\n\n @Property({ name: 'is_transshipment_move', type: 'boolean', nullable: true })\n isTransshipmentMove?: boolean | null\n\n // \u2500\u2500\u2500 Location Fields \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\n @Property({ name: 'location_name', type: 'text', nullable: true })\n locationName?: string | null\n\n @Property({ name: 'location_unlocode', type: 'text', nullable: true })\n locationUnlocode?: string | null\n\n @Property({ name: 'location_country', type: 'text', nullable: true })\n locationCountry?: string | null\n\n // Human-friendly region names for AIS POI events (e.g. waypoints in open water that have\n // no UN/LOCODE). Both locales are stored so the UI can localize at render; null for\n // carrier (DCSA) events and unnamed POIs.\n @Property({ name: 'region_name_pl', type: 'text', nullable: true })\n regionNamePl?: string | null\n\n @Property({ name: 'region_name_en', type: 'text', nullable: true })\n regionNameEn?: string | null\n\n @Property({ name: 'facility_code', type: 'text', nullable: true })\n facilityCode?: string | null // Terminal/depot code (SMDG/BIC)\n\n @Property({ name: 'facility_code_list_provider', type: 'text', nullable: true })\n facilityCodeListProvider?: FacilityCodeListProvider | null\n\n @Property({ name: 'facility_type_code', type: 'text', nullable: true })\n facilityTypeCode?: string | null // POTE, DEPO, CLOC, COFS, INTE, etc.\n\n @Property({ name: 'facility_address', type: 'text', nullable: true })\n facilityAddress?: string | null // Full address string from carrier (DCSA otherFacility)\n\n @Property({ type: 'float', nullable: true })\n latitude?: number | null\n\n @Property({ type: 'float', nullable: true })\n longitude?: number | null\n\n // \u2500\u2500\u2500 Transport Call Fields \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\n @Property({ name: 'transport_call_reference', type: 'text', nullable: true })\n transportCallReference?: string | null\n\n @Property({ name: 'mode_of_transport', type: 'text', nullable: true })\n modeOfTransport?: ModeOfTransport | null\n\n @Property({ name: 'vessel_name', type: 'text', nullable: true })\n vesselName?: string | null\n\n @Property({ name: 'vessel_imo', type: 'text', nullable: true })\n vesselImo?: string | null\n\n @Property({ name: 'voyage_number', type: 'text', nullable: true })\n voyageNumber?: string | null\n\n @Property({ name: 'carrier_service_code', type: 'text', nullable: true })\n carrierServiceCode?: string | null\n\n @Property({ name: 'carrier_export_voyage_number', type: 'text', nullable: true })\n carrierExportVoyageNumber?: string | null\n\n @Property({ name: 'carrier_import_voyage_number', type: 'text', nullable: true })\n carrierImportVoyageNumber?: string | null\n\n @Property({ name: 'universal_service_reference', type: 'text', nullable: true })\n universalServiceReference?: string | null\n\n @Property({ name: 'universal_export_voyage_reference', type: 'text', nullable: true })\n universalExportVoyageReference?: string | null\n\n @Property({ name: 'universal_import_voyage_reference', type: 'text', nullable: true })\n universalImportVoyageReference?: string | null\n\n @Property({ name: 'port_visit_reference', type: 'text', nullable: true })\n portVisitReference?: string | null\n\n // \u2500\u2500\u2500 Document References \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\n @Property({ name: 'related_document_references', type: 'jsonb', nullable: true })\n relatedDocumentReferences?: DocumentReference[] | null\n\n // \u2500\u2500\u2500 Metadata Fields \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\n @Property({ name: 'event_created_date_time', type: Date, nullable: true })\n eventCreatedDateTime?: Date | null\n\n @Property({ name: 'retracted_event_id', type: 'text', nullable: true })\n retractedEventId?: string | null\n\n @Property({ name: 'publisher_name', type: 'text', nullable: true })\n publisherName?: string | null\n\n @Property({ name: 'publisher_role', type: 'text', nullable: true })\n publisherRole?: string | null // CA, AG, VSL, TR, etc.\n\n // \u2500\u2500\u2500 Additional Event Fields \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\n @Property({ name: 'delay_reason_code', type: 'text', nullable: true })\n delayReasonCode?: string | null // SMDG delay reason code\n\n @Property({ name: 'change_remark', type: 'text', nullable: true })\n changeRemark?: string | null\n\n @Property({ type: 'jsonb', nullable: true })\n seals?: SealInfo[] | null\n\n // \u2500\u2500\u2500 Timestamps \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\n @Property({ name: 'created_at', type: Date, defaultRaw: 'now()' })\n createdAt!: Date\n}\n\n\n\n// \u2500\u2500\u2500 CarrierConfig \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\n@Entity({ tableName: 'shipment_tracking_carrier_configs' })\n@Index({ name: 'st_carrier_configs_org_tenant_idx', properties: ['organizationId', 'tenantId'] })\n@Unique({ name: 'st_carrier_configs_code_uniq', properties: ['organizationId', 'tenantId', 'carrierCode'] })\nexport class CarrierConfig {\n [OptionalProps]?: 'isActive' | 'createdAt' | 'updatedAt' | 'deletedAt' | 'rateLimitRequests' | 'rateLimitWindowSeconds'\n\n @PrimaryKey({ type: 'uuid', defaultRaw: 'gen_random_uuid()' })\n id!: string\n\n @Property({ name: 'organization_id', type: 'uuid' })\n organizationId!: string\n\n @Property({ name: 'tenant_id', type: 'uuid' })\n tenantId!: string\n\n @Property({ name: 'carrier_code', type: 'text' })\n carrierCode!: string\n\n @Property({ name: 'api_endpoint', type: 'text', nullable: true })\n apiEndpoint?: string | null\n\n @Property({ name: 'auth_config', type: 'jsonb', nullable: true })\n authConfig?: Record<string, unknown> | null\n\n @Property({ name: 'rate_limit_requests', type: 'integer', default: 60 })\n rateLimitRequests: number = 60\n\n @Property({ name: 'rate_limit_window_seconds', type: 'integer', default: 60 })\n rateLimitWindowSeconds: number = 60\n\n @Property({ name: 'is_active', type: 'boolean', default: true })\n isActive: boolean = true\n\n @Property({ name: 'created_at', type: Date, defaultRaw: 'now()' })\n createdAt!: Date\n\n @Property({ name: 'updated_at', type: Date, defaultRaw: 'now()', onUpdate: () => new Date() })\n updatedAt!: Date\n\n @Property({ name: 'deleted_at', type: Date, nullable: true })\n deletedAt?: Date | null\n}\n\n// \u2500\u2500\u2500 BicConfig \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n// Per-tenant configuration for BIC Facility API enrichment\n\n@Entity({ tableName: 'shipment_tracking_bic_configs' })\n@Index({ name: 'st_bic_configs_org_tenant_idx', properties: ['organizationId', 'tenantId'] })\n@Unique({ name: 'st_bic_configs_scope_unique', properties: ['organizationId', 'tenantId'] })\nexport class BicConfig {\n [OptionalProps]?: 'isEnabled' | 'createdAt' | 'updatedAt' | 'baseUrl'\n\n @PrimaryKey({ type: 'uuid', defaultRaw: 'gen_random_uuid()' })\n id!: string\n\n @Property({ name: 'organization_id', type: 'uuid' })\n organizationId!: string\n\n @Property({ name: 'tenant_id', type: 'uuid' })\n tenantId!: string\n\n @Property({ name: 'is_enabled', type: 'boolean', default: false })\n isEnabled: boolean = false\n\n @Property({ type: 'text' })\n username!: string\n\n @Property({ type: 'text' })\n password!: string // Encrypted via tenant data encryption\n\n @Property({ name: 'base_url', type: 'text', default: 'https://api.bic-code.org' })\n baseUrl: string = 'https://api.bic-code.org'\n\n @Property({ name: 'created_at', type: Date, defaultRaw: 'now()' })\n createdAt!: Date\n\n @Property({ name: 'updated_at', type: Date, defaultRaw: 'now()', onUpdate: () => new Date() })\n updatedAt!: Date\n}\n\n// \u2500\u2500\u2500 ShipsGoConfig \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n// Per-tenant configuration for the ShipsGo aggregator (fallback tracking for\n// unsupported ocean carriers + air). One row per organization/tenant. The API\n// token is encrypted at rest (see encryption.ts); a platform env var is the\n// fallback when no row exists.\n\n@Entity({ tableName: 'shipment_tracking_shipsgo_configs' })\n@Index({ name: 'st_shipsgo_configs_org_tenant_idx', properties: ['organizationId', 'tenantId'] })\n@Unique({ name: 'st_shipsgo_configs_scope_unique', properties: ['organizationId', 'tenantId'] })\nexport class ShipsGoConfig {\n [OptionalProps]?: 'isEnabled' | 'createdAt' | 'updatedAt' | 'deletedAt' | 'baseUrl' | 'oceanEnabled' | 'airEnabled' | 'isActive' | 'rateLimitRequests' | 'rateLimitWindowSeconds'\n\n @PrimaryKey({ type: 'uuid', defaultRaw: 'gen_random_uuid()' })\n id!: string\n\n @Property({ name: 'organization_id', type: 'uuid' })\n organizationId!: string\n\n @Property({ name: 'tenant_id', type: 'uuid' })\n tenantId!: string\n\n @Property({ name: 'is_enabled', type: 'boolean', default: false })\n isEnabled: boolean = false\n\n @Property({ name: 'api_token', type: 'text' })\n apiToken!: string // Encrypted via tenant data encryption (see encryption.ts)\n\n @Property({ name: 'base_url', type: 'text', default: 'https://api.shipsgo.com/v2' })\n baseUrl: string = 'https://api.shipsgo.com/v2'\n\n @Property({ name: 'ocean_enabled', type: 'boolean', default: true })\n oceanEnabled: boolean = true\n\n @Property({ name: 'air_enabled', type: 'boolean', default: true })\n airEnabled: boolean = true\n\n @Property({ name: 'rate_limit_requests', type: 'integer', default: 60 })\n rateLimitRequests: number = 60\n\n @Property({ name: 'rate_limit_window_seconds', type: 'integer', default: 60 })\n rateLimitWindowSeconds: number = 60\n\n @Property({ name: 'is_active', type: 'boolean', default: true })\n isActive: boolean = true\n\n @Property({ name: 'created_at', type: Date, defaultRaw: 'now()' })\n createdAt!: Date\n\n @Property({ name: 'updated_at', type: Date, defaultRaw: 'now()', onUpdate: () => new Date() })\n updatedAt!: Date\n\n @Property({ name: 'deleted_at', type: Date, nullable: true })\n deletedAt?: Date | null\n}\n\n// \u2500\u2500\u2500 Webhook \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\n@Entity({ tableName: 'shipment_tracking_webhooks' })\n@Index({ name: 'st_webhooks_org_tenant_idx', properties: ['organizationId', 'tenantId'] })\nexport class Webhook {\n [OptionalProps]?: 'isActive' | 'createdAt' | 'updatedAt' | 'deletedAt'\n\n @PrimaryKey({ type: 'uuid', defaultRaw: 'gen_random_uuid()' })\n id!: string\n\n @Property({ name: 'organization_id', type: 'uuid' })\n organizationId!: string\n\n @Property({ name: 'tenant_id', type: 'uuid' })\n tenantId!: string\n\n @Property({ type: 'text' })\n url!: string\n\n @Property({ name: 'events_subscribed', type: 'jsonb' })\n eventsSubscribed!: string[]\n\n @Property({ name: 'hmac_secret', type: 'text', nullable: true })\n hmacSecret?: string | null\n\n @Property({ name: 'is_active', type: 'boolean', default: true })\n isActive: boolean = true\n\n @Property({ name: 'created_at', type: Date, defaultRaw: 'now()' })\n createdAt!: Date\n\n @Property({ name: 'updated_at', type: Date, defaultRaw: 'now()', onUpdate: () => new Date() })\n updatedAt!: Date\n\n @Property({ name: 'deleted_at', type: Date, nullable: true })\n deletedAt?: Date | null\n\n @OneToMany(() => WebhookDelivery, (delivery) => delivery.webhook)\n deliveries = new Collection<WebhookDelivery>(this)\n}\n\n// \u2500\u2500\u2500 LocationOverride \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n// Per-tenant location data corrections for BIC/SMDG facilities\n\n@Entity({ tableName: 'shipment_tracking_location_overrides' })\n@Unique({\n name: 'st_location_overrides_match_uniq',\n properties: ['organizationId', 'tenantId', 'carrierCode', 'unlocode', 'facilityCode', 'facilityCodeListProvider'],\n})\n@Index({ name: 'st_location_overrides_org_tenant_idx', properties: ['organizationId', 'tenantId'] })\n@Index({ name: 'st_location_overrides_lookup_idx', properties: ['unlocode', 'facilityCode', 'facilityCodeListProvider'] })\nexport class LocationOverride {\n [OptionalProps]?: 'isActive' | 'createdAt' | 'updatedAt' | 'deletedAt' | 'carrierCode' | 'description'\n\n @PrimaryKey({ type: 'uuid', defaultRaw: 'gen_random_uuid()' })\n id!: string\n\n @Property({ name: 'organization_id', type: 'uuid' })\n organizationId!: string\n\n @Property({ name: 'tenant_id', type: 'uuid' })\n tenantId!: string\n\n // Match criteria\n @Property({ name: 'carrier_code', type: 'text', nullable: true })\n carrierCode?: string | null // null = applies to all carriers\n\n @Property({ name: 'unlocode', type: 'text', length: 5 })\n unlocode!: string // e.g., \"PLGDN\"\n\n @Property({ name: 'facility_code', type: 'text' })\n facilityCode!: string // e.g., \"PLGDA\"\n\n @Property({ name: 'facility_code_list_provider', type: 'text' })\n facilityCodeListProvider!: FacilityCodeListProvider // BIC or SMDG\n\n // Override data (partial FacilityLocation fields)\n @Property({ name: 'override_data', type: 'jsonb' })\n overrideData!: Partial<FacilityLocation>\n\n // Metadata\n @Property({ type: 'text', nullable: true })\n description?: string | null // Optional note about why override exists\n\n @Property({ name: 'is_active', type: 'boolean', default: true })\n isActive: boolean = true\n\n @Property({ name: 'created_at', type: Date, defaultRaw: 'now()' })\n createdAt!: Date\n\n @Property({ name: 'updated_at', type: Date, defaultRaw: 'now()', onUpdate: () => new Date() })\n updatedAt!: Date\n\n @Property({ name: 'deleted_at', type: Date, nullable: true })\n deletedAt?: Date | null\n\n @Property({ name: 'created_by_user_id', type: 'uuid', nullable: true })\n createdByUserId?: string | null\n\n @Property({ name: 'updated_by_user_id', type: 'uuid', nullable: true })\n updatedByUserId?: string | null\n}\n\n// \u2500\u2500\u2500 WebhookDelivery \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\n@Entity({ tableName: 'shipment_tracking_webhook_deliveries' })\n@Index({ name: 'st_webhook_deliveries_webhook_idx', properties: ['webhook'] })\n@Index({ name: 'st_webhook_deliveries_status_idx', properties: ['status'] })\n@Index({ name: 'st_webhook_deliveries_next_retry_idx', properties: ['nextRetryAt'] })\nexport class WebhookDelivery {\n [OptionalProps]?: 'createdAt' | 'status' | 'retryCount'\n\n @PrimaryKey({ type: 'uuid', defaultRaw: 'gen_random_uuid()' })\n id!: string\n\n @ManyToOne(() => Webhook, { fieldName: 'webhook_id' })\n webhook!: Webhook\n\n @Property({ name: 'event_type', type: 'text' })\n eventType!: string\n\n @Property({ type: 'text', default: 'pending' })\n status: WebhookDeliveryStatus = 'pending'\n\n @Property({ name: 'retry_count', type: 'integer', default: 0 })\n retryCount: number = 0\n\n @Property({ name: 'next_retry_at', type: Date, nullable: true })\n nextRetryAt?: Date | null\n\n @Property({ type: 'jsonb' })\n payload!: Record<string, unknown>\n\n @Property({ name: 'response_status', type: 'integer', nullable: true })\n responseStatus?: number | null\n\n @Property({ name: 'response_body', type: 'text', nullable: true })\n responseBody?: string | null\n\n @Property({ name: 'error_message', type: 'text', nullable: true })\n errorMessage?: string | null\n\n @Property({ name: 'created_at', type: Date, defaultRaw: 'now()' })\n createdAt!: Date\n}\n"],
5
+ "mappings": ";;;;;;;;;;AAAA,SAAS,YAAY,qBAAqB;AAC1C,SAAS,QAAQ,YAAY,UAAU,OAAO,QAAQ,WAAW,iBAAiB;AAkE/E;AADI,IAAM,cAAN,MAAkB;AAAA,EAAlB;AAcL,oBAA6B;AAI7B,gBAAqB;AA2BrB,kBAAgC;AAahC,sBAAqB;AAgBrB,qBAAY,IAAI,WAAqB,IAAI;AAIzC,kBAAS,IAAI,WAA0B,IAAI;AAAA;AAC7C;AA3EE;AAAA,EADC,WAAW,EAAE,MAAM,QAAQ,YAAY,oBAAoB,CAAC;AAAA,GAHlD,YAIX;AAGA;AAAA,EADC,SAAS,EAAE,MAAM,mBAAmB,MAAM,OAAO,CAAC;AAAA,GANxC,YAOX;AAGA;AAAA,EADC,SAAS,EAAE,MAAM,aAAa,MAAM,OAAO,CAAC;AAAA,GATlC,YAUX;AAIA;AAAA,EADC,SAAS,EAAE,MAAM,QAAQ,SAAS,UAAU,CAAC;AAAA,GAbnC,YAcX;AAIA;AAAA,EADC,SAAS,EAAE,MAAM,QAAQ,SAAS,QAAQ,CAAC;AAAA,GAjBjC,YAkBX;AAKA;AAAA,EADC,SAAS,EAAE,MAAM,wBAAwB,MAAM,QAAQ,UAAU,KAAK,CAAC;AAAA,GAtB7D,YAuBX;AAMA;AAAA,EADC,SAAS,EAAE,MAAM,gBAAgB,MAAM,OAAO,CAAC;AAAA,GA5BrC,YA6BX;AAGA;AAAA,EADC,SAAS,EAAE,MAAM,kBAAkB,MAAM,OAA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BAAiB,MAAM,QAAQ,UAAU,KAAK,CAAC;AAAA,GA9BtD,gBA+BX;AAGA;AAAA,EADC,SAAS,EAAE,MAAM,cAAc,MAAM,MAAM,YAAY,QAAQ,CAAC;AAAA,GAjCtD,gBAkCX;AAlCW,kBAAN;AAAA,EAJN,OAAO,EAAE,WAAW,uCAAuC,CAAC;AAAA,EAC5D,MAAM,EAAE,MAAM,qCAAqC,YAAY,CAAC,SAAS,EAAE,CAAC;AAAA,EAC5E,MAAM,EAAE,MAAM,oCAAoC,YAAY,CAAC,QAAQ,EAAE,CAAC;AAAA,EAC1E,MAAM,EAAE,MAAM,wCAAwC,YAAY,CAAC,aAAa,EAAE,CAAC;AAAA,GACvE;",
6
+ "names": []
7
+ }
@@ -0,0 +1,434 @@
1
+ import { z } from "zod";
2
+ const uuid = () => z.string().uuid();
3
+ const scopedSchema = z.object({
4
+ organizationId: uuid(),
5
+ tenantId: uuid()
6
+ });
7
+ const timestampSourceSchema = z.enum(["carrier_api", "manual", "ais", "port", "edi"]);
8
+ const shipmentTimestampEntrySchema = z.object({
9
+ value: z.string().datetime({ message: "Must be ISO 8601 datetime" }),
10
+ offset: z.string().regex(/^[+-]\d{2}:\d{2}$|^Z$/, "Must be timezone offset like +08:00 or Z").nullable(),
11
+ source: timestampSourceSchema,
12
+ updatedAt: z.string().datetime({ message: "Must be ISO 8601 datetime" }),
13
+ sourceEventId: z.string().nullable().optional()
14
+ });
15
+ const timestampEntryInputSchema = z.object({
16
+ value: z.string().datetime({ message: "Must be ISO 8601 datetime" }),
17
+ offset: z.string().regex(/^[+-]\d{2}:\d{2}$|^Z$/, "Must be timezone offset like +08:00 or Z").nullable().optional(),
18
+ source: timestampSourceSchema,
19
+ sourceEventId: z.string().nullable().optional()
20
+ });
21
+ const unLocodeSchema = z.string().trim().toUpperCase().length(5, "UN/LOCODE must be exactly 5 characters").regex(/^[A-Z]{2}[A-Z0-9]{3}$/, "Invalid UN/LOCODE format (expected: 2 letters + 3 alphanumeric)");
22
+ const optionalUnLocodeSchema = unLocodeSchema.optional();
23
+ const shipmentStatusSchema = z.enum(["PENDING", "BOOKED", "DEPARTED", "IN_TRANSIT", "PRE_ARRIVAL", "ARRIVED", "DELIVERED"]);
24
+ const trackingEventSourceSchema = z.enum(["dcsa", "ais", "port", "edi", "manual", "shipsgo"]);
25
+ const trackingReferenceTypeSchema = z.enum(["container", "booking", "bol", "awb"]);
26
+ const trackingProviderSchema = z.enum(["carrier", "shipsgo"]);
27
+ const trackingModeSchema = z.enum(["ocean", "air"]);
28
+ const facilityCodeListProviderSchema = z.enum(["BIC", "SMDG"]);
29
+ const facilityLocationSourceSchema = z.enum(["dcsa", "bic", "manual"]);
30
+ const coordsSchema = z.object({
31
+ latitude: z.number(),
32
+ longitude: z.number()
33
+ });
34
+ const facilityLocationSchema = z.object({
35
+ // Display name (terminal or port name)
36
+ name: z.string(),
37
+ // Port-level identifiers
38
+ unlocode: z.string().nullable(),
39
+ // UN/LOCODE (e.g., "PLGDN")
40
+ countryCode: z.string().nullable(),
41
+ // ISO 3166-1 alpha-2 (e.g., "PL")
42
+ // Facility/terminal identifiers (separate fields)
43
+ facilityCode: z.string().nullable(),
44
+ // SMDG/BIC code (e.g., "DCT")
45
+ facilityCodeListProvider: facilityCodeListProviderSchema.nullable(),
46
+ facilityTypeCode: z.string().nullable(),
47
+ // POTE (port terminal), DEPO (depot), etc.
48
+ // Address (from DCSA otherFacility or BIC API)
49
+ address: z.string().nullable(),
50
+ // Full address string
51
+ // Coordinates
52
+ coords: coordsSchema.nullable(),
53
+ // Operator (from BIC API enrichment only)
54
+ operatorName: z.string().nullable(),
55
+ // Source of the data
56
+ source: facilityLocationSourceSchema
57
+ });
58
+ const routeStopEntrySchema = z.object({
59
+ location: z.string(),
60
+ unlocode: z.string().nullable().optional(),
61
+ type: z.enum(["origin", "transshipment", "destination"]),
62
+ vesselName: z.string().nullable().optional(),
63
+ ata: z.string().nullable().optional(),
64
+ // Actual arrival
65
+ atd: z.string().nullable().optional(),
66
+ // Actual departure
67
+ eta: z.string().nullable().optional(),
68
+ // Estimated arrival (for delay calculation)
69
+ etd: z.string().nullable().optional(),
70
+ // Estimated departure (for delay calculation)
71
+ // Facility/terminal details
72
+ facilityCode: z.string().nullable().optional(),
73
+ facilityCodeListProvider: facilityCodeListProviderSchema.nullable().optional(),
74
+ facilityTypeCode: z.string().nullable().optional(),
75
+ facilityAddress: z.string().nullable().optional(),
76
+ coords: coordsSchema.nullable().optional()
77
+ });
78
+ const sealInfoSchema = z.object({
79
+ number: z.string(),
80
+ source: z.string().nullable().optional(),
81
+ // CAR, SHI, TER, CUS
82
+ type: z.string().nullable().optional()
83
+ });
84
+ const cargoEventEntrySchema = z.object({
85
+ id: z.string(),
86
+ eventType: z.string(),
87
+ eventCode: z.string(),
88
+ eventClassifierCode: z.enum(["ACT", "PLN", "EST"]).nullable().optional(),
89
+ eventDateTime: z.string(),
90
+ description: z.string().nullable().optional(),
91
+ locationName: z.string().nullable().optional(),
92
+ locationUnlocode: z.string().nullable().optional(),
93
+ vesselName: z.string().nullable().optional(),
94
+ vesselImo: z.string().nullable().optional(),
95
+ voyageNumber: z.string().nullable().optional(),
96
+ isTransshipmentMove: z.boolean().nullable().optional(),
97
+ // Facility/terminal details
98
+ facilityCode: z.string().nullable().optional(),
99
+ facilityCodeListProvider: facilityCodeListProviderSchema.nullable().optional(),
100
+ facilityTypeCode: z.string().nullable().optional(),
101
+ facilityAddress: z.string().nullable().optional(),
102
+ latitude: z.number().nullable().optional(),
103
+ longitude: z.number().nullable().optional(),
104
+ // Seal information
105
+ seals: z.array(sealInfoSchema).nullable().optional()
106
+ });
107
+ const shipmentCreateSchema = scopedSchema.extend({
108
+ // Optional: link to existing tracking job
109
+ trackingJobId: uuid().optional(),
110
+ carrierCode: z.string().trim().max(20).optional(),
111
+ containerNumber: z.string().trim().max(50).optional(),
112
+ bookingNumber: z.string().trim().max(100).optional(),
113
+ bolNumber: z.string().trim().max(100).optional(),
114
+ // Multi-source timestamps (JSONB arrays)
115
+ etdTimestamps: z.array(shipmentTimestampEntrySchema).optional(),
116
+ etaTimestamps: z.array(shipmentTimestampEntrySchema).optional(),
117
+ atdTimestamps: z.array(shipmentTimestampEntrySchema).optional(),
118
+ ataTimestamps: z.array(shipmentTimestampEntrySchema).optional(),
119
+ // Location data (JSONB)
120
+ originLocation: facilityLocationSchema.optional(),
121
+ destinationLocation: facilityLocationSchema.optional(),
122
+ vesselName: z.string().trim().max(200).optional(),
123
+ vesselImo: z.string().trim().max(20).optional(),
124
+ voyageNumber: z.string().trim().max(50).optional(),
125
+ extra: z.record(z.string(), z.unknown()).optional()
126
+ });
127
+ const shipmentUpdateSchema = z.object({
128
+ id: uuid()
129
+ }).merge(
130
+ scopedSchema.extend({
131
+ trackingJobId: uuid().optional().nullable(),
132
+ carrierCode: z.string().trim().max(20).optional().nullable(),
133
+ containerNumber: z.string().trim().max(50).optional().nullable(),
134
+ bookingNumber: z.string().trim().max(100).optional().nullable(),
135
+ bolNumber: z.string().trim().max(100).optional().nullable(),
136
+ status: shipmentStatusSchema.optional(),
137
+ // Multi-source timestamps - can replace entire arrays or add entries
138
+ etdTimestamps: z.array(shipmentTimestampEntrySchema).optional().nullable(),
139
+ etaTimestamps: z.array(shipmentTimestampEntrySchema).optional().nullable(),
140
+ atdTimestamps: z.array(shipmentTimestampEntrySchema).optional().nullable(),
141
+ ataTimestamps: z.array(shipmentTimestampEntrySchema).optional().nullable(),
142
+ // Add single timestamp entries (convenience for manual updates)
143
+ addEtdTimestamp: timestampEntryInputSchema.optional(),
144
+ addEtaTimestamp: timestampEntryInputSchema.optional(),
145
+ addAtdTimestamp: timestampEntryInputSchema.optional(),
146
+ addAtaTimestamp: timestampEntryInputSchema.optional(),
147
+ // Location data (JSONB)
148
+ originLocation: facilityLocationSchema.optional().nullable(),
149
+ destinationLocation: facilityLocationSchema.optional().nullable(),
150
+ vesselName: z.string().trim().max(200).optional().nullable(),
151
+ vesselImo: z.string().trim().max(20).optional().nullable(),
152
+ voyageNumber: z.string().trim().max(50).optional().nullable(),
153
+ extra: z.record(z.string(), z.unknown()).optional().nullable()
154
+ }).partial()
155
+ );
156
+ const shipmentListSchema = z.object({
157
+ id: z.string().uuid().optional(),
158
+ page: z.coerce.number().min(1).default(1),
159
+ pageSize: z.coerce.number().min(1).max(100).default(50),
160
+ search: z.string().optional(),
161
+ status: z.string().optional(),
162
+ carrierCode: z.string().optional(),
163
+ sortField: z.string().optional(),
164
+ sortDir: z.enum(["asc", "desc"]).optional()
165
+ }).passthrough();
166
+ const trackingJobCreateSchema = scopedSchema.extend({
167
+ carrierCode: z.string().trim().min(1).max(50),
168
+ referenceType: trackingReferenceTypeSchema,
169
+ referenceValue: z.string().trim().min(1).max(100),
170
+ // Origin/destination are optional - will be auto-inferred from tracking events if not provided
171
+ originUnlocode: optionalUnLocodeSchema,
172
+ destinationUnlocode: optionalUnLocodeSchema,
173
+ schedule: z.array(z.string()).optional()
174
+ });
175
+ const trackingJobUpdateSchema = z.object({
176
+ id: uuid()
177
+ }).merge(
178
+ scopedSchema.extend({
179
+ status: z.enum(["active", "paused", "deactivated", "failed", "completed"]).optional(),
180
+ schedule: z.array(z.string()).optional().nullable(),
181
+ nextPollAt: z.coerce.date().optional().nullable()
182
+ }).partial()
183
+ );
184
+ const trackingJobListSchema = z.object({
185
+ page: z.coerce.number().min(1).default(1),
186
+ pageSize: z.coerce.number().min(1).max(100).default(50),
187
+ status: z.string().optional(),
188
+ carrierCode: z.string().optional(),
189
+ referenceType: z.string().optional(),
190
+ referenceValue: z.string().optional(),
191
+ sortField: z.string().optional(),
192
+ sortDir: z.enum(["asc", "desc"]).optional()
193
+ }).passthrough();
194
+ const trackingEventListSchema = z.object({
195
+ page: z.coerce.number().min(1).default(1),
196
+ pageSize: z.coerce.number().min(1).max(100).default(50),
197
+ trackingJobId: uuid().optional(),
198
+ equipmentReference: z.string().optional(),
199
+ source: trackingEventSourceSchema.optional(),
200
+ eventType: z.string().optional(),
201
+ eventCode: z.string().optional(),
202
+ sortField: z.string().optional(),
203
+ sortDir: z.enum(["asc", "desc"]).optional()
204
+ }).passthrough();
205
+ const cargoEventListSchema = trackingEventListSchema;
206
+ const carrierConfigCreateSchema = scopedSchema.extend({
207
+ carrierCode: z.string().trim().min(1).max(50),
208
+ apiEndpoint: z.string().trim().url().max(500).optional(),
209
+ authConfig: z.record(z.string(), z.unknown()).optional(),
210
+ rateLimitRequests: z.coerce.number().int().min(1).max(1e4).default(60),
211
+ rateLimitWindowSeconds: z.coerce.number().int().min(1).max(86400).default(60),
212
+ isActive: z.boolean().default(true)
213
+ });
214
+ const carrierConfigUpdateSchema = z.object({
215
+ id: uuid()
216
+ }).merge(
217
+ scopedSchema.extend({
218
+ apiEndpoint: z.string().trim().url().max(500).optional().nullable(),
219
+ authConfig: z.record(z.string(), z.unknown()).optional().nullable(),
220
+ rateLimitRequests: z.coerce.number().int().min(1).max(1e4).optional(),
221
+ rateLimitWindowSeconds: z.coerce.number().int().min(1).max(86400).optional(),
222
+ isActive: z.boolean().optional()
223
+ }).partial()
224
+ );
225
+ const carrierConfigListSchema = z.object({
226
+ page: z.coerce.number().min(1).default(1),
227
+ pageSize: z.coerce.number().min(1).max(100).default(50),
228
+ carrierCode: z.string().optional(),
229
+ isActive: z.string().optional(),
230
+ sortField: z.string().optional(),
231
+ sortDir: z.enum(["asc", "desc"]).optional()
232
+ }).passthrough();
233
+ const bicConfigUpsertSchema = scopedSchema.extend({
234
+ isEnabled: z.boolean().default(false),
235
+ username: z.string().trim().min(1, "Username is required").max(200),
236
+ password: z.string().trim().min(1, "Password is required").max(500),
237
+ baseUrl: z.string().trim().url().max(500).default("https://api.bic-code.org")
238
+ });
239
+ const bicConfigResponseSchema = z.object({
240
+ id: uuid(),
241
+ organizationId: uuid(),
242
+ tenantId: uuid(),
243
+ isEnabled: z.boolean(),
244
+ username: z.string(),
245
+ // Password is NOT included in response for security
246
+ baseUrl: z.string(),
247
+ createdAt: z.string(),
248
+ updatedAt: z.string()
249
+ });
250
+ const bicConfigTestSchema = scopedSchema.extend({
251
+ username: z.string().trim().min(1),
252
+ password: z.string().trim().min(1),
253
+ baseUrl: z.string().trim().url().default("https://api.bic-code.org")
254
+ });
255
+ const shipsGoConfigUpsertSchema = scopedSchema.extend({
256
+ isEnabled: z.boolean().default(false),
257
+ apiToken: z.string().trim().min(1, "API token is required").max(500),
258
+ baseUrl: z.string().trim().url().max(500).default("https://api.shipsgo.com/v2"),
259
+ oceanEnabled: z.boolean().default(true),
260
+ airEnabled: z.boolean().default(true),
261
+ rateLimitRequests: z.coerce.number().int().min(1).max(1e4).default(60),
262
+ rateLimitWindowSeconds: z.coerce.number().int().min(1).max(86400).default(60)
263
+ });
264
+ const shipsGoConfigResponseSchema = z.object({
265
+ id: uuid(),
266
+ organizationId: uuid(),
267
+ tenantId: uuid(),
268
+ isEnabled: z.boolean(),
269
+ // apiToken is NOT included in responses for security
270
+ baseUrl: z.string(),
271
+ oceanEnabled: z.boolean(),
272
+ airEnabled: z.boolean(),
273
+ rateLimitRequests: z.number(),
274
+ rateLimitWindowSeconds: z.number(),
275
+ createdAt: z.string(),
276
+ updatedAt: z.string()
277
+ });
278
+ const webhookCreateSchema = scopedSchema.extend({
279
+ url: z.string().trim().url().max(500),
280
+ eventsSubscribed: z.array(z.string().trim().min(1)).min(1),
281
+ hmacSecret: z.string().trim().max(256).optional(),
282
+ isActive: z.boolean().default(true)
283
+ });
284
+ const webhookUpdateSchema = z.object({
285
+ id: uuid()
286
+ }).merge(
287
+ scopedSchema.extend({
288
+ url: z.string().trim().url().max(500).optional(),
289
+ eventsSubscribed: z.array(z.string().trim().min(1)).min(1).optional(),
290
+ hmacSecret: z.string().trim().max(256).optional().nullable(),
291
+ isActive: z.boolean().optional()
292
+ }).partial()
293
+ );
294
+ const webhookListSchema = z.object({
295
+ id: z.string().uuid().optional(),
296
+ page: z.coerce.number().min(1).default(1),
297
+ pageSize: z.coerce.number().min(1).max(100).default(50),
298
+ isActive: z.string().optional(),
299
+ sortField: z.string().optional(),
300
+ sortDir: z.enum(["asc", "desc"]).optional()
301
+ }).passthrough();
302
+ const webhookDeliveryListSchema = z.object({
303
+ page: z.coerce.number().min(1).default(1),
304
+ pageSize: z.coerce.number().min(1).max(100).default(50),
305
+ webhookId: uuid().optional(),
306
+ status: z.string().optional(),
307
+ eventType: z.string().optional(),
308
+ sortField: z.string().optional(),
309
+ sortDir: z.enum(["asc", "desc"]).optional()
310
+ }).passthrough();
311
+ const locationOverrideDataSchema = z.object({
312
+ name: z.string().trim().min(1, "Name is required").max(200),
313
+ address: z.string().trim().max(500).nullable().optional(),
314
+ operatorName: z.string().trim().max(200).nullable().optional(),
315
+ countryCode: z.string().trim().length(2, "Country code must be 2 characters").toUpperCase().nullable().optional(),
316
+ facilityTypeCode: z.string().trim().max(20).nullable().optional(),
317
+ coords: coordsSchema.nullable().optional()
318
+ });
319
+ const locationOverrideCreateSchema = scopedSchema.extend({
320
+ carrierCode: z.string().trim().max(20).nullable().optional(),
321
+ unlocode: unLocodeSchema,
322
+ facilityCode: z.string().trim().min(1, "Facility code is required").max(50),
323
+ facilityCodeListProvider: facilityCodeListProviderSchema,
324
+ overrideData: locationOverrideDataSchema,
325
+ description: z.string().trim().max(500).nullable().optional(),
326
+ isActive: z.boolean().default(true)
327
+ });
328
+ const locationOverrideUpdateSchema = z.object({
329
+ id: uuid()
330
+ }).merge(
331
+ scopedSchema.extend({
332
+ carrierCode: z.string().trim().max(20).nullable().optional(),
333
+ unlocode: unLocodeSchema.optional(),
334
+ facilityCode: z.string().trim().min(1).max(50).optional(),
335
+ facilityCodeListProvider: facilityCodeListProviderSchema.optional(),
336
+ overrideData: locationOverrideDataSchema.optional(),
337
+ description: z.string().trim().max(500).nullable().optional(),
338
+ isActive: z.boolean().optional()
339
+ }).partial()
340
+ );
341
+ const locationOverrideListSchema = z.object({
342
+ page: z.coerce.number().min(1).default(1),
343
+ pageSize: z.coerce.number().min(1).max(100).default(50),
344
+ carrierCode: z.string().optional(),
345
+ unlocode: z.string().optional(),
346
+ facilityCode: z.string().optional(),
347
+ isActive: z.string().optional(),
348
+ search: z.string().optional(),
349
+ sortField: z.string().optional(),
350
+ sortDir: z.enum(["asc", "desc"]).optional()
351
+ }).passthrough();
352
+ const shipsMapQuerySchema = z.object({
353
+ scope: z.enum(["in_transit", "at_port", "all"]).optional().default("all")
354
+ });
355
+ const shipsMapShipmentSchema = z.object({
356
+ id: z.string(),
357
+ containerNumber: z.string().nullable(),
358
+ status: z.string(),
359
+ eta: z.string().nullable(),
360
+ destinationLocation: z.string().nullable()
361
+ });
362
+ const shipsMapMarkerSchema = z.discriminatedUnion("kind", [
363
+ z.object({
364
+ kind: z.literal("vessel"),
365
+ imo: z.string(),
366
+ name: z.string().nullable(),
367
+ position: z.object({ lat: z.number(), lng: z.number() }),
368
+ heading: z.number().nullable(),
369
+ destination: z.string().nullable(),
370
+ updatedAt: z.string().nullable(),
371
+ shipments: z.array(shipsMapShipmentSchema)
372
+ }),
373
+ z.object({
374
+ kind: z.literal("port"),
375
+ portName: z.string().nullable(),
376
+ unlocode: z.string().nullable(),
377
+ position: z.object({ lat: z.number(), lng: z.number() }),
378
+ shipments: z.array(shipsMapShipmentSchema)
379
+ })
380
+ ]);
381
+ const shipsMapResponseSchema = z.object({
382
+ markers: z.array(shipsMapMarkerSchema),
383
+ /** Active shipments with no plottable position (no IMO/coords, or a vessel-api miss). */
384
+ unresolvedCount: z.number(),
385
+ generatedAt: z.string()
386
+ });
387
+ export {
388
+ bicConfigResponseSchema,
389
+ bicConfigTestSchema,
390
+ bicConfigUpsertSchema,
391
+ cargoEventEntrySchema,
392
+ cargoEventListSchema,
393
+ carrierConfigCreateSchema,
394
+ carrierConfigListSchema,
395
+ carrierConfigUpdateSchema,
396
+ coordsSchema,
397
+ facilityCodeListProviderSchema,
398
+ facilityLocationSchema,
399
+ facilityLocationSourceSchema,
400
+ locationOverrideCreateSchema,
401
+ locationOverrideDataSchema,
402
+ locationOverrideListSchema,
403
+ locationOverrideUpdateSchema,
404
+ optionalUnLocodeSchema,
405
+ routeStopEntrySchema,
406
+ sealInfoSchema,
407
+ shipmentCreateSchema,
408
+ shipmentListSchema,
409
+ shipmentStatusSchema,
410
+ shipmentTimestampEntrySchema,
411
+ shipmentUpdateSchema,
412
+ shipsGoConfigResponseSchema,
413
+ shipsGoConfigUpsertSchema,
414
+ shipsMapMarkerSchema,
415
+ shipsMapQuerySchema,
416
+ shipsMapResponseSchema,
417
+ shipsMapShipmentSchema,
418
+ timestampEntryInputSchema,
419
+ timestampSourceSchema,
420
+ trackingEventListSchema,
421
+ trackingEventSourceSchema,
422
+ trackingJobCreateSchema,
423
+ trackingJobListSchema,
424
+ trackingJobUpdateSchema,
425
+ trackingModeSchema,
426
+ trackingProviderSchema,
427
+ trackingReferenceTypeSchema,
428
+ unLocodeSchema,
429
+ webhookCreateSchema,
430
+ webhookDeliveryListSchema,
431
+ webhookListSchema,
432
+ webhookUpdateSchema
433
+ };
434
+ //# sourceMappingURL=validators.js.map