@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.
- package/LICENSE +21 -0
- package/NOTICE +25 -0
- package/dist/generated/entities/bic_config/index.js +21 -0
- package/dist/generated/entities/bic_config/index.js.map +7 -0
- package/dist/generated/entities/carrier_config/index.js +27 -0
- package/dist/generated/entities/carrier_config/index.js.map +7 -0
- package/dist/generated/entities/location_override/index.js +33 -0
- package/dist/generated/entities/location_override/index.js.map +7 -0
- package/dist/generated/entities/shipment/index.js +73 -0
- package/dist/generated/entities/shipment/index.js.map +7 -0
- package/dist/generated/entities/ships_go_config/index.js +31 -0
- package/dist/generated/entities/ships_go_config/index.js.map +7 -0
- package/dist/generated/entities/tracking_event/index.js +101 -0
- package/dist/generated/entities/tracking_event/index.js.map +7 -0
- package/dist/generated/entities/tracking_job/index.js +47 -0
- package/dist/generated/entities/tracking_job/index.js.map +7 -0
- package/dist/generated/entities/webhook/index.js +25 -0
- package/dist/generated/entities/webhook/index.js.map +7 -0
- package/dist/generated/entities/webhook_delivery/index.js +25 -0
- package/dist/generated/entities/webhook_delivery/index.js.map +7 -0
- package/dist/generated/entities.ids.generated.js +21 -0
- package/dist/generated/entities.ids.generated.js.map +7 -0
- package/dist/index.js +41 -0
- package/dist/index.js.map +7 -0
- package/dist/modules/shipment_tracking/acl.js +22 -0
- package/dist/modules/shipment_tracking/acl.js.map +7 -0
- package/dist/modules/shipment_tracking/api/bic-configs/route.js +176 -0
- package/dist/modules/shipment_tracking/api/bic-configs/route.js.map +7 -0
- package/dist/modules/shipment_tracking/api/bic-configs/test/route.js +95 -0
- package/dist/modules/shipment_tracking/api/bic-configs/test/route.js.map +7 -0
- package/dist/modules/shipment_tracking/api/cargo-events/route.js +93 -0
- package/dist/modules/shipment_tracking/api/cargo-events/route.js.map +7 -0
- package/dist/modules/shipment_tracking/api/carrier-configs/route.js +139 -0
- package/dist/modules/shipment_tracking/api/carrier-configs/route.js.map +7 -0
- package/dist/modules/shipment_tracking/api/dashboard/ships-map/route.js +177 -0
- package/dist/modules/shipment_tracking/api/dashboard/ships-map/route.js.map +7 -0
- package/dist/modules/shipment_tracking/api/location-overrides/route.js +179 -0
- package/dist/modules/shipment_tracking/api/location-overrides/route.js.map +7 -0
- package/dist/modules/shipment_tracking/api/openapi.js +27 -0
- package/dist/modules/shipment_tracking/api/openapi.js.map +7 -0
- package/dist/modules/shipment_tracking/api/shipments/route.js +192 -0
- package/dist/modules/shipment_tracking/api/shipments/route.js.map +7 -0
- package/dist/modules/shipment_tracking/api/shipsgo-configs/route.js +185 -0
- package/dist/modules/shipment_tracking/api/shipsgo-configs/route.js.map +7 -0
- package/dist/modules/shipment_tracking/api/tracking-jobs/route.js +144 -0
- package/dist/modules/shipment_tracking/api/tracking-jobs/route.js.map +7 -0
- package/dist/modules/shipment_tracking/api/tracking-jobs/sync/route.js +107 -0
- package/dist/modules/shipment_tracking/api/tracking-jobs/sync/route.js.map +7 -0
- package/dist/modules/shipment_tracking/api/utils.js +12 -0
- package/dist/modules/shipment_tracking/api/utils.js.map +7 -0
- package/dist/modules/shipment_tracking/api/webhooks/deliveries/route.js +76 -0
- package/dist/modules/shipment_tracking/api/webhooks/deliveries/route.js.map +7 -0
- package/dist/modules/shipment_tracking/api/webhooks/route.js +135 -0
- package/dist/modules/shipment_tracking/api/webhooks/route.js.map +7 -0
- package/dist/modules/shipment_tracking/api/webhooks/test/route.js +71 -0
- package/dist/modules/shipment_tracking/api/webhooks/test/route.js.map +7 -0
- package/dist/modules/shipment_tracking/assets/carriers/cma_cgm.png +0 -0
- package/dist/modules/shipment_tracking/assets/carriers/cosco.png +0 -0
- package/dist/modules/shipment_tracking/assets/carriers/evergreen.png +0 -0
- package/dist/modules/shipment_tracking/assets/carriers/hapag_lloyd.png +0 -0
- package/dist/modules/shipment_tracking/assets/carriers/maersk.png +0 -0
- package/dist/modules/shipment_tracking/assets/carriers/msc.png +0 -0
- package/dist/modules/shipment_tracking/assets/carriers/one.png +0 -0
- package/dist/modules/shipment_tracking/assets/carriers/oocl.png +0 -0
- package/dist/modules/shipment_tracking/assets/carriers/yang_ming.png +0 -0
- package/dist/modules/shipment_tracking/assets/carriers/zim.png +0 -0
- package/dist/modules/shipment_tracking/assets/index.js +52 -0
- package/dist/modules/shipment_tracking/assets/index.js.map +7 -0
- package/dist/modules/shipment_tracking/backend/carrier-configs/page.js +621 -0
- package/dist/modules/shipment_tracking/backend/carrier-configs/page.js.map +7 -0
- package/dist/modules/shipment_tracking/backend/carrier-configs/page.meta.js +19 -0
- package/dist/modules/shipment_tracking/backend/carrier-configs/page.meta.js.map +7 -0
- package/dist/modules/shipment_tracking/backend/location-overrides/page.js +198 -0
- package/dist/modules/shipment_tracking/backend/location-overrides/page.js.map +7 -0
- package/dist/modules/shipment_tracking/backend/location-overrides/page.meta.js +19 -0
- package/dist/modules/shipment_tracking/backend/location-overrides/page.meta.js.map +7 -0
- package/dist/modules/shipment_tracking/backend/shipment-tracking/page.js +279 -0
- package/dist/modules/shipment_tracking/backend/shipment-tracking/page.js.map +7 -0
- package/dist/modules/shipment_tracking/backend/shipment-tracking/page.meta.js +19 -0
- package/dist/modules/shipment_tracking/backend/shipment-tracking/page.meta.js.map +7 -0
- package/dist/modules/shipment_tracking/backend/tracking-jobs/page.js +10 -0
- package/dist/modules/shipment_tracking/backend/tracking-jobs/page.js.map +7 -0
- package/dist/modules/shipment_tracking/backend/tracking-jobs/page.meta.js +19 -0
- package/dist/modules/shipment_tracking/backend/tracking-jobs/page.meta.js.map +7 -0
- package/dist/modules/shipment_tracking/backend/webhooks/page.js +198 -0
- package/dist/modules/shipment_tracking/backend/webhooks/page.js.map +7 -0
- package/dist/modules/shipment_tracking/backend/webhooks/page.meta.js +19 -0
- package/dist/modules/shipment_tracking/backend/webhooks/page.meta.js.map +7 -0
- package/dist/modules/shipment_tracking/ce.js +52 -0
- package/dist/modules/shipment_tracking/ce.js.map +7 -0
- package/dist/modules/shipment_tracking/cli.js +229 -0
- package/dist/modules/shipment_tracking/cli.js.map +7 -0
- package/dist/modules/shipment_tracking/commands/bic-configs.js +66 -0
- package/dist/modules/shipment_tracking/commands/bic-configs.js.map +7 -0
- package/dist/modules/shipment_tracking/commands/carrier-configs.js +65 -0
- package/dist/modules/shipment_tracking/commands/carrier-configs.js.map +7 -0
- package/dist/modules/shipment_tracking/commands/index.js +9 -0
- package/dist/modules/shipment_tracking/commands/index.js.map +7 -0
- package/dist/modules/shipment_tracking/commands/location-overrides.js +93 -0
- package/dist/modules/shipment_tracking/commands/location-overrides.js.map +7 -0
- package/dist/modules/shipment_tracking/commands/shipments.js +200 -0
- package/dist/modules/shipment_tracking/commands/shipments.js.map +7 -0
- package/dist/modules/shipment_tracking/commands/shipsgo-configs.js +75 -0
- package/dist/modules/shipment_tracking/commands/shipsgo-configs.js.map +7 -0
- package/dist/modules/shipment_tracking/commands/tracking-jobs.js +120 -0
- package/dist/modules/shipment_tracking/commands/tracking-jobs.js.map +7 -0
- package/dist/modules/shipment_tracking/commands/tracking.js +140 -0
- package/dist/modules/shipment_tracking/commands/tracking.js.map +7 -0
- package/dist/modules/shipment_tracking/commands/webhooks.js +115 -0
- package/dist/modules/shipment_tracking/commands/webhooks.js.map +7 -0
- package/dist/modules/shipment_tracking/components/CombinedTimestampCell.js +168 -0
- package/dist/modules/shipment_tracking/components/CombinedTimestampCell.js.map +7 -0
- package/dist/modules/shipment_tracking/components/FacilityLocationInput.js +202 -0
- package/dist/modules/shipment_tracking/components/FacilityLocationInput.js.map +7 -0
- package/dist/modules/shipment_tracking/components/LocationOverrideDrawer.js +501 -0
- package/dist/modules/shipment_tracking/components/LocationOverrideDrawer.js.map +7 -0
- package/dist/modules/shipment_tracking/components/ShipmentDetailsDrawer.js +818 -0
- package/dist/modules/shipment_tracking/components/ShipmentDetailsDrawer.js.map +7 -0
- package/dist/modules/shipment_tracking/components/ShipmentDrawer.js +404 -0
- package/dist/modules/shipment_tracking/components/ShipmentDrawer.js.map +7 -0
- package/dist/modules/shipment_tracking/components/ShipsGoConfigSection.js +200 -0
- package/dist/modules/shipment_tracking/components/ShipsGoConfigSection.js.map +7 -0
- package/dist/modules/shipment_tracking/components/TimestampCell.js +108 -0
- package/dist/modules/shipment_tracking/components/TimestampCell.js.map +7 -0
- package/dist/modules/shipment_tracking/components/TrackingJobDrawer.js +343 -0
- package/dist/modules/shipment_tracking/components/TrackingJobDrawer.js.map +7 -0
- package/dist/modules/shipment_tracking/components/VesselTrackingMap.js +496 -0
- package/dist/modules/shipment_tracking/components/VesselTrackingMap.js.map +7 -0
- package/dist/modules/shipment_tracking/components/WebhookDrawer.js +332 -0
- package/dist/modules/shipment_tracking/components/WebhookDrawer.js.map +7 -0
- package/dist/modules/shipment_tracking/data/entities.js +686 -0
- package/dist/modules/shipment_tracking/data/entities.js.map +7 -0
- package/dist/modules/shipment_tracking/data/validators.js +434 -0
- package/dist/modules/shipment_tracking/data/validators.js.map +7 -0
- package/dist/modules/shipment_tracking/di.js +60 -0
- package/dist/modules/shipment_tracking/di.js.map +7 -0
- package/dist/modules/shipment_tracking/encryption.js +12 -0
- package/dist/modules/shipment_tracking/encryption.js.map +7 -0
- package/dist/modules/shipment_tracking/events.js +87 -0
- package/dist/modules/shipment_tracking/events.js.map +7 -0
- package/dist/modules/shipment_tracking/hooks/useVesselTracking.js +137 -0
- package/dist/modules/shipment_tracking/hooks/useVesselTracking.js.map +7 -0
- package/dist/modules/shipment_tracking/i18n/de.json +327 -0
- package/dist/modules/shipment_tracking/i18n/en.json +327 -0
- package/dist/modules/shipment_tracking/i18n/es.json +327 -0
- package/dist/modules/shipment_tracking/i18n/pl.json +327 -0
- package/dist/modules/shipment_tracking/index.js +15 -0
- package/dist/modules/shipment_tracking/index.js.map +7 -0
- package/dist/modules/shipment_tracking/lib/adapters/cma-cgm.js +66 -0
- package/dist/modules/shipment_tracking/lib/adapters/cma-cgm.js.map +7 -0
- package/dist/modules/shipment_tracking/lib/adapters/cosco-types.js +1 -0
- package/dist/modules/shipment_tracking/lib/adapters/cosco-types.js.map +7 -0
- package/dist/modules/shipment_tracking/lib/adapters/cosco.js +236 -0
- package/dist/modules/shipment_tracking/lib/adapters/cosco.js.map +7 -0
- package/dist/modules/shipment_tracking/lib/adapters/evergreen.js +87 -0
- package/dist/modules/shipment_tracking/lib/adapters/evergreen.js.map +7 -0
- package/dist/modules/shipment_tracking/lib/adapters/hapag-lloyd.js +68 -0
- package/dist/modules/shipment_tracking/lib/adapters/hapag-lloyd.js.map +7 -0
- package/dist/modules/shipment_tracking/lib/adapters/index.js +20 -0
- package/dist/modules/shipment_tracking/lib/adapters/index.js.map +7 -0
- package/dist/modules/shipment_tracking/lib/adapters/maersk.js +84 -0
- package/dist/modules/shipment_tracking/lib/adapters/maersk.js.map +7 -0
- package/dist/modules/shipment_tracking/lib/adapters/msc.js +170 -0
- package/dist/modules/shipment_tracking/lib/adapters/msc.js.map +7 -0
- package/dist/modules/shipment_tracking/lib/adapters/zim.js +85 -0
- package/dist/modules/shipment_tracking/lib/adapters/zim.js.map +7 -0
- package/dist/modules/shipment_tracking/lib/audit-helpers.js +20 -0
- package/dist/modules/shipment_tracking/lib/audit-helpers.js.map +7 -0
- package/dist/modules/shipment_tracking/lib/auth/base64url.js +8 -0
- package/dist/modules/shipment_tracking/lib/auth/base64url.js.map +7 -0
- package/dist/modules/shipment_tracking/lib/auth/oauth-client.js +38 -0
- package/dist/modules/shipment_tracking/lib/auth/oauth-client.js.map +7 -0
- package/dist/modules/shipment_tracking/lib/background.js +15 -0
- package/dist/modules/shipment_tracking/lib/background.js.map +7 -0
- package/dist/modules/shipment_tracking/lib/bic-api-client.js +106 -0
- package/dist/modules/shipment_tracking/lib/bic-api-client.js.map +7 -0
- package/dist/modules/shipment_tracking/lib/carrier-adapter.js +17 -0
- package/dist/modules/shipment_tracking/lib/carrier-adapter.js.map +7 -0
- package/dist/modules/shipment_tracking/lib/current-vessel.js +149 -0
- package/dist/modules/shipment_tracking/lib/current-vessel.js.map +7 -0
- package/dist/modules/shipment_tracking/lib/dcsa-event-mapping.js +124 -0
- package/dist/modules/shipment_tracking/lib/dcsa-event-mapping.js.map +7 -0
- package/dist/modules/shipment_tracking/lib/dcsa-event-parser.js +112 -0
- package/dist/modules/shipment_tracking/lib/dcsa-event-parser.js.map +7 -0
- package/dist/modules/shipment_tracking/lib/dcsa-params.js +16 -0
- package/dist/modules/shipment_tracking/lib/dcsa-params.js.map +7 -0
- package/dist/modules/shipment_tracking/lib/empty-return.js +48 -0
- package/dist/modules/shipment_tracking/lib/empty-return.js.map +7 -0
- package/dist/modules/shipment_tracking/lib/location-overrides.js +85 -0
- package/dist/modules/shipment_tracking/lib/location-overrides.js.map +7 -0
- package/dist/modules/shipment_tracking/lib/location-types.js +59 -0
- package/dist/modules/shipment_tracking/lib/location-types.js.map +7 -0
- package/dist/modules/shipment_tracking/lib/logger.js +113 -0
- package/dist/modules/shipment_tracking/lib/logger.js.map +7 -0
- package/dist/modules/shipment_tracking/lib/poi-event-processor.js +183 -0
- package/dist/modules/shipment_tracking/lib/poi-event-processor.js.map +7 -0
- package/dist/modules/shipment_tracking/lib/poi-nats-config.js +52 -0
- package/dist/modules/shipment_tracking/lib/poi-nats-config.js.map +7 -0
- package/dist/modules/shipment_tracking/lib/poi-types.js +43 -0
- package/dist/modules/shipment_tracking/lib/poi-types.js.map +7 -0
- package/dist/modules/shipment_tracking/lib/rate-limiter.js +31 -0
- package/dist/modules/shipment_tracking/lib/rate-limiter.js.map +7 -0
- package/dist/modules/shipment_tracking/lib/route-extraction.js +187 -0
- package/dist/modules/shipment_tracking/lib/route-extraction.js.map +7 -0
- package/dist/modules/shipment_tracking/lib/route-inference.js +106 -0
- package/dist/modules/shipment_tracking/lib/route-inference.js.map +7 -0
- package/dist/modules/shipment_tracking/lib/schedule-generator.js +63 -0
- package/dist/modules/shipment_tracking/lib/schedule-generator.js.map +7 -0
- package/dist/modules/shipment_tracking/lib/shipsgo-client.js +143 -0
- package/dist/modules/shipment_tracking/lib/shipsgo-client.js.map +7 -0
- package/dist/modules/shipment_tracking/lib/shipsgo-mapper.js +204 -0
- package/dist/modules/shipment_tracking/lib/shipsgo-mapper.js.map +7 -0
- package/dist/modules/shipment_tracking/lib/status-machine.js +131 -0
- package/dist/modules/shipment_tracking/lib/status-machine.js.map +7 -0
- package/dist/modules/shipment_tracking/lib/time-extraction.js +41 -0
- package/dist/modules/shipment_tracking/lib/time-extraction.js.map +7 -0
- package/dist/modules/shipment_tracking/lib/timestamp-utils.js +100 -0
- package/dist/modules/shipment_tracking/lib/timestamp-utils.js.map +7 -0
- package/dist/modules/shipment_tracking/lib/vessel-api.js +111 -0
- package/dist/modules/shipment_tracking/lib/vessel-api.js.map +7 -0
- package/dist/modules/shipment_tracking/lib/vessel-cache.js +50 -0
- package/dist/modules/shipment_tracking/lib/vessel-cache.js.map +7 -0
- package/dist/modules/shipment_tracking/lib/vessel-extraction.js +13 -0
- package/dist/modules/shipment_tracking/lib/vessel-extraction.js.map +7 -0
- package/dist/modules/shipment_tracking/lib/webhook-dispatcher.js +62 -0
- package/dist/modules/shipment_tracking/lib/webhook-dispatcher.js.map +7 -0
- package/dist/modules/shipment_tracking/migrations/Migration20260422161208_shipment_tracking.js +48 -0
- package/dist/modules/shipment_tracking/migrations/Migration20260422161208_shipment_tracking.js.map +7 -0
- package/dist/modules/shipment_tracking/migrations/Migration20260529120000_shipment_tracking_poi_region_names.js +15 -0
- package/dist/modules/shipment_tracking/migrations/Migration20260529120000_shipment_tracking_poi_region_names.js.map +7 -0
- package/dist/modules/shipment_tracking/migrations/Migration20260821120000_shipment_tracking_shipsgo.js +47 -0
- package/dist/modules/shipment_tracking/migrations/Migration20260821120000_shipment_tracking_shipsgo.js.map +7 -0
- package/dist/modules/shipment_tracking/notifications.js +145 -0
- package/dist/modules/shipment_tracking/notifications.js.map +7 -0
- package/dist/modules/shipment_tracking/services/carrierRegistry.js +24 -0
- package/dist/modules/shipment_tracking/services/carrierRegistry.js.map +7 -0
- package/dist/modules/shipment_tracking/services/poiNatsService.js +397 -0
- package/dist/modules/shipment_tracking/services/poiNatsService.js.map +7 -0
- package/dist/modules/shipment_tracking/services/shipsGoProvider.js +163 -0
- package/dist/modules/shipment_tracking/services/shipsGoProvider.js.map +7 -0
- package/dist/modules/shipment_tracking/services/trackingService.js +1283 -0
- package/dist/modules/shipment_tracking/services/trackingService.js.map +7 -0
- package/dist/modules/shipment_tracking/services/webhookService.js +263 -0
- package/dist/modules/shipment_tracking/services/webhookService.js.map +7 -0
- package/dist/modules/shipment_tracking/setup.js +72 -0
- package/dist/modules/shipment_tracking/setup.js.map +7 -0
- package/dist/modules/shipment_tracking/subscribers/cargo-event-created.js +60 -0
- package/dist/modules/shipment_tracking/subscribers/cargo-event-created.js.map +7 -0
- package/dist/modules/shipment_tracking/subscribers/dcsa-event-webhook-dispatch.js +58 -0
- package/dist/modules/shipment_tracking/subscribers/dcsa-event-webhook-dispatch.js.map +7 -0
- package/dist/modules/shipment_tracking/subscribers/poi-event-notification.js +82 -0
- package/dist/modules/shipment_tracking/subscribers/poi-event-notification.js.map +7 -0
- package/dist/modules/shipment_tracking/subscribers/poi-event-webhook-dispatch.js +53 -0
- package/dist/modules/shipment_tracking/subscribers/poi-event-webhook-dispatch.js.map +7 -0
- package/dist/modules/shipment_tracking/subscribers/shipment-status-changed.js +28 -0
- package/dist/modules/shipment_tracking/subscribers/shipment-status-changed.js.map +7 -0
- package/dist/modules/shipment_tracking/subscribers/terminal-event-ingest.js +67 -0
- package/dist/modules/shipment_tracking/subscribers/terminal-event-ingest.js.map +7 -0
- package/dist/modules/shipment_tracking/subscribers/tracking-job-initial-poll.js +30 -0
- package/dist/modules/shipment_tracking/subscribers/tracking-job-initial-poll.js.map +7 -0
- package/dist/modules/shipment_tracking/subscribers/tracking-job-webhook-dispatch.js +19 -0
- package/dist/modules/shipment_tracking/subscribers/tracking-job-webhook-dispatch.js.map +7 -0
- package/dist/modules/shipment_tracking/tables/index.js +6 -0
- package/dist/modules/shipment_tracking/tables/index.js.map +7 -0
- package/dist/modules/shipment_tracking/tables/tracking_job/table.client.js +284 -0
- package/dist/modules/shipment_tracking/tables/tracking_job/table.client.js.map +7 -0
- package/dist/modules/shipment_tracking/tables/tracking_job/table.js +36 -0
- package/dist/modules/shipment_tracking/tables/tracking_job/table.js.map +7 -0
- package/dist/modules/shipment_tracking/widgets/dashboard/ships-map/config.js +25 -0
- package/dist/modules/shipment_tracking/widgets/dashboard/ships-map/config.js.map +7 -0
- package/dist/modules/shipment_tracking/widgets/dashboard/ships-map/widget.client.js +355 -0
- package/dist/modules/shipment_tracking/widgets/dashboard/ships-map/widget.client.js.map +7 -0
- package/dist/modules/shipment_tracking/widgets/dashboard/ships-map/widget.js +26 -0
- package/dist/modules/shipment_tracking/widgets/dashboard/ships-map/widget.js.map +7 -0
- package/dist/types/assets.d.js +1 -0
- package/dist/types/assets.d.js.map +7 -0
- package/generated/entities/bic_config/index.ts +20 -0
- package/generated/entities/carrier_config/index.ts +23 -0
- package/generated/entities/location_override/index.ts +26 -0
- package/generated/entities/shipment/index.ts +46 -0
- package/generated/entities/ships_go_config/index.ts +25 -0
- package/generated/entities/tracking_event/index.ts +60 -0
- package/generated/entities/tracking_job/index.ts +33 -0
- package/generated/entities/webhook/index.ts +22 -0
- package/generated/entities/webhook_delivery/index.ts +22 -0
- package/generated/entities.ids.generated.ts +47 -0
- package/package.json +81 -0
- package/src/index.ts +39 -0
- package/src/modules/shipment_tracking/__integration__/TC-TRACK-410-shipsgo-config-api.spec.ts +133 -0
- package/src/modules/shipment_tracking/__integration__/meta.ts +4 -0
- package/src/modules/shipment_tracking/__tests__/empty-return-stop.test.ts +231 -0
- package/src/modules/shipment_tracking/__tests__/fixtures/hapag-lloyd-transship-container.json +702 -0
- package/src/modules/shipment_tracking/__tests__/fixtures/index.ts +434 -0
- package/src/modules/shipment_tracking/__tests__/fixtures/maersk-multi-transship-completed.json +1518 -0
- package/src/modules/shipment_tracking/__tests__/fixtures/maersk-transship-intransit.json +558 -0
- package/src/modules/shipment_tracking/__tests__/fixtures/msc-direct.json +222 -0
- package/src/modules/shipment_tracking/__tests__/fixtures/msc-multi-transship-completed.json +974 -0
- package/src/modules/shipment_tracking/__tests__/fixtures/msc-multi.json +4846 -0
- package/src/modules/shipment_tracking/__tests__/fixtures/msc-transship.json +409 -0
- package/src/modules/shipment_tracking/__tests__/fixtures/poi-events.json +240 -0
- package/src/modules/shipment_tracking/__tests__/fixtures/synthetic/index.ts +138 -0
- package/src/modules/shipment_tracking/__tests__/fixtures/synthetic-eta-updates.json +288 -0
- package/src/modules/shipment_tracking/__tests__/fixtures/synthetic-route-inference.json +201 -0
- package/src/modules/shipment_tracking/__tests__/fixtures/synthetic-voyage-progression.json +410 -0
- package/src/modules/shipment_tracking/__tests__/shipsgo-air-mapper.test.ts +157 -0
- package/src/modules/shipment_tracking/__tests__/shipsgo-client.test.ts +155 -0
- package/src/modules/shipment_tracking/__tests__/shipsgo-mapper.test.ts +201 -0
- package/src/modules/shipment_tracking/__tests__/shipsgo-poll.test.ts +357 -0
- package/src/modules/shipment_tracking/__tests__/shipsgo-provider.test.ts +364 -0
- package/src/modules/shipment_tracking/__tests__/trackingService.integration.test.ts +2248 -0
- package/src/modules/shipment_tracking/__tests__/webhookPayload.test.ts +151 -0
- package/src/modules/shipment_tracking/acl.ts +18 -0
- package/src/modules/shipment_tracking/api/bic-configs/route.ts +206 -0
- package/src/modules/shipment_tracking/api/bic-configs/test/route.ts +108 -0
- package/src/modules/shipment_tracking/api/cargo-events/route.ts +101 -0
- package/src/modules/shipment_tracking/api/carrier-configs/route.ts +142 -0
- package/src/modules/shipment_tracking/api/dashboard/ships-map/route.ts +246 -0
- package/src/modules/shipment_tracking/api/location-overrides/route.ts +185 -0
- package/src/modules/shipment_tracking/api/openapi.ts +28 -0
- package/src/modules/shipment_tracking/api/shipments/route.ts +197 -0
- package/src/modules/shipment_tracking/api/shipsgo-configs/route.ts +215 -0
- package/src/modules/shipment_tracking/api/tracking-jobs/route.ts +149 -0
- package/src/modules/shipment_tracking/api/tracking-jobs/sync/route.ts +116 -0
- package/src/modules/shipment_tracking/api/utils.ts +10 -0
- package/src/modules/shipment_tracking/api/webhooks/deliveries/route.ts +82 -0
- package/src/modules/shipment_tracking/api/webhooks/route.ts +138 -0
- package/src/modules/shipment_tracking/api/webhooks/test/route.ts +84 -0
- package/src/modules/shipment_tracking/assets/carriers/cma_cgm.png +0 -0
- package/src/modules/shipment_tracking/assets/carriers/cosco.png +0 -0
- package/src/modules/shipment_tracking/assets/carriers/evergreen.png +0 -0
- package/src/modules/shipment_tracking/assets/carriers/hapag_lloyd.png +0 -0
- package/src/modules/shipment_tracking/assets/carriers/maersk.png +0 -0
- package/src/modules/shipment_tracking/assets/carriers/msc.png +0 -0
- package/src/modules/shipment_tracking/assets/carriers/one.png +0 -0
- package/src/modules/shipment_tracking/assets/carriers/oocl.png +0 -0
- package/src/modules/shipment_tracking/assets/carriers/yang_ming.png +0 -0
- package/src/modules/shipment_tracking/assets/carriers/zim.png +0 -0
- package/src/modules/shipment_tracking/assets/index.ts +66 -0
- package/src/modules/shipment_tracking/backend/carrier-configs/page.meta.ts +16 -0
- package/src/modules/shipment_tracking/backend/carrier-configs/page.tsx +782 -0
- package/src/modules/shipment_tracking/backend/location-overrides/page.meta.ts +16 -0
- package/src/modules/shipment_tracking/backend/location-overrides/page.tsx +241 -0
- package/src/modules/shipment_tracking/backend/shipment-tracking/page.meta.ts +16 -0
- package/src/modules/shipment_tracking/backend/shipment-tracking/page.tsx +340 -0
- package/src/modules/shipment_tracking/backend/tracking-jobs/page.meta.ts +16 -0
- package/src/modules/shipment_tracking/backend/tracking-jobs/page.tsx +16 -0
- package/src/modules/shipment_tracking/backend/webhooks/page.meta.ts +16 -0
- package/src/modules/shipment_tracking/backend/webhooks/page.tsx +228 -0
- package/src/modules/shipment_tracking/ce.ts +48 -0
- package/src/modules/shipment_tracking/cli.ts +321 -0
- package/src/modules/shipment_tracking/commands/bic-configs.ts +94 -0
- package/src/modules/shipment_tracking/commands/carrier-configs.ts +89 -0
- package/src/modules/shipment_tracking/commands/index.ts +8 -0
- package/src/modules/shipment_tracking/commands/location-overrides.ts +119 -0
- package/src/modules/shipment_tracking/commands/shipments.ts +247 -0
- package/src/modules/shipment_tracking/commands/shipsgo-configs.ts +101 -0
- package/src/modules/shipment_tracking/commands/tracking-jobs.ts +158 -0
- package/src/modules/shipment_tracking/commands/tracking.ts +230 -0
- package/src/modules/shipment_tracking/commands/webhooks.ts +159 -0
- package/src/modules/shipment_tracking/components/CombinedTimestampCell.tsx +236 -0
- package/src/modules/shipment_tracking/components/FacilityLocationInput.tsx +235 -0
- package/src/modules/shipment_tracking/components/LocationOverrideDrawer.tsx +586 -0
- package/src/modules/shipment_tracking/components/ShipmentDetailsDrawer.tsx +1364 -0
- package/src/modules/shipment_tracking/components/ShipmentDrawer.tsx +498 -0
- package/src/modules/shipment_tracking/components/ShipsGoConfigSection.tsx +266 -0
- package/src/modules/shipment_tracking/components/TimestampCell.tsx +146 -0
- package/src/modules/shipment_tracking/components/TrackingJobDrawer.tsx +467 -0
- package/src/modules/shipment_tracking/components/VesselTrackingMap.tsx +761 -0
- package/src/modules/shipment_tracking/components/WebhookDrawer.tsx +434 -0
- package/src/modules/shipment_tracking/data/entities.ts +748 -0
- package/src/modules/shipment_tracking/data/validators.ts +523 -0
- package/src/modules/shipment_tracking/di.ts +73 -0
- package/src/modules/shipment_tracking/encryption.ts +17 -0
- package/src/modules/shipment_tracking/events.ts +122 -0
- package/src/modules/shipment_tracking/hooks/useVesselTracking.ts +297 -0
- package/src/modules/shipment_tracking/i18n/de.json +327 -0
- package/src/modules/shipment_tracking/i18n/en.json +327 -0
- package/src/modules/shipment_tracking/i18n/es.json +327 -0
- package/src/modules/shipment_tracking/i18n/pl.json +327 -0
- package/src/modules/shipment_tracking/index.ts +13 -0
- package/src/modules/shipment_tracking/lib/__tests__/dcsa-event-mapping.test.ts +385 -0
- package/src/modules/shipment_tracking/lib/__tests__/dcsa-event-parser.test.ts +398 -0
- package/src/modules/shipment_tracking/lib/__tests__/empty-return.test.ts +174 -0
- package/src/modules/shipment_tracking/lib/__tests__/poi-event-processor.test.ts +699 -0
- package/src/modules/shipment_tracking/lib/__tests__/route-inference.test.ts +402 -0
- package/src/modules/shipment_tracking/lib/__tests__/status-machine.test.ts +447 -0
- package/src/modules/shipment_tracking/lib/__tests__/time-extraction.test.ts +331 -0
- package/src/modules/shipment_tracking/lib/__tests__/timestamp-utils.test.ts +260 -0
- package/src/modules/shipment_tracking/lib/__tests__/vessel-api.test.ts +125 -0
- package/src/modules/shipment_tracking/lib/__tests__/vessel-extraction.test.ts +108 -0
- package/src/modules/shipment_tracking/lib/adapters/cma-cgm.ts +84 -0
- package/src/modules/shipment_tracking/lib/adapters/cosco-types.ts +145 -0
- package/src/modules/shipment_tracking/lib/adapters/cosco.ts +314 -0
- package/src/modules/shipment_tracking/lib/adapters/evergreen.ts +107 -0
- package/src/modules/shipment_tracking/lib/adapters/hapag-lloyd.ts +88 -0
- package/src/modules/shipment_tracking/lib/adapters/index.ts +18 -0
- package/src/modules/shipment_tracking/lib/adapters/maersk.ts +104 -0
- package/src/modules/shipment_tracking/lib/adapters/msc.ts +223 -0
- package/src/modules/shipment_tracking/lib/adapters/zim.ts +106 -0
- package/src/modules/shipment_tracking/lib/audit-helpers.ts +29 -0
- package/src/modules/shipment_tracking/lib/auth/base64url.ts +4 -0
- package/src/modules/shipment_tracking/lib/auth/oauth-client.ts +53 -0
- package/src/modules/shipment_tracking/lib/background.ts +24 -0
- package/src/modules/shipment_tracking/lib/bic-api-client.ts +199 -0
- package/src/modules/shipment_tracking/lib/carrier-adapter.ts +136 -0
- package/src/modules/shipment_tracking/lib/current-vessel.ts +274 -0
- package/src/modules/shipment_tracking/lib/dcsa-event-mapping.ts +202 -0
- package/src/modules/shipment_tracking/lib/dcsa-event-parser.ts +163 -0
- package/src/modules/shipment_tracking/lib/dcsa-params.ts +14 -0
- package/src/modules/shipment_tracking/lib/empty-return.ts +122 -0
- package/src/modules/shipment_tracking/lib/location-overrides.ts +150 -0
- package/src/modules/shipment_tracking/lib/location-types.ts +154 -0
- package/src/modules/shipment_tracking/lib/logger.ts +195 -0
- package/src/modules/shipment_tracking/lib/poi-event-processor.ts +302 -0
- package/src/modules/shipment_tracking/lib/poi-nats-config.ts +134 -0
- package/src/modules/shipment_tracking/lib/poi-types.ts +198 -0
- package/src/modules/shipment_tracking/lib/rate-limiter.ts +58 -0
- package/src/modules/shipment_tracking/lib/route-extraction.ts +439 -0
- package/src/modules/shipment_tracking/lib/route-inference.ts +238 -0
- package/src/modules/shipment_tracking/lib/schedule-generator.ts +92 -0
- package/src/modules/shipment_tracking/lib/shipsgo-client.ts +350 -0
- package/src/modules/shipment_tracking/lib/shipsgo-mapper.ts +296 -0
- package/src/modules/shipment_tracking/lib/status-machine.ts +230 -0
- package/src/modules/shipment_tracking/lib/time-extraction.ts +85 -0
- package/src/modules/shipment_tracking/lib/timestamp-utils.ts +244 -0
- package/src/modules/shipment_tracking/lib/vessel-api.ts +299 -0
- package/src/modules/shipment_tracking/lib/vessel-cache.ts +102 -0
- package/src/modules/shipment_tracking/lib/vessel-extraction.ts +39 -0
- package/src/modules/shipment_tracking/lib/webhook-dispatcher.ts +93 -0
- package/src/modules/shipment_tracking/migrations/.snapshot-open-mercato.json +2914 -0
- package/src/modules/shipment_tracking/migrations/Migration20260422161208_shipment_tracking.ts +60 -0
- package/src/modules/shipment_tracking/migrations/Migration20260529120000_shipment_tracking_poi_region_names.ts +22 -0
- package/src/modules/shipment_tracking/migrations/Migration20260821120000_shipment_tracking_shipsgo.ts +65 -0
- package/src/modules/shipment_tracking/notifications.ts +151 -0
- package/src/modules/shipment_tracking/services/carrierRegistry.ts +29 -0
- package/src/modules/shipment_tracking/services/poiNatsService.ts +526 -0
- package/src/modules/shipment_tracking/services/shipsGoProvider.ts +231 -0
- package/src/modules/shipment_tracking/services/trackingService.ts +1777 -0
- package/src/modules/shipment_tracking/services/webhookService.ts +347 -0
- package/src/modules/shipment_tracking/setup.ts +99 -0
- package/src/modules/shipment_tracking/subscribers/__tests__/terminal-event-ingest.test.ts +141 -0
- package/src/modules/shipment_tracking/subscribers/cargo-event-created.ts +115 -0
- package/src/modules/shipment_tracking/subscribers/dcsa-event-webhook-dispatch.ts +115 -0
- package/src/modules/shipment_tracking/subscribers/poi-event-notification.ts +144 -0
- package/src/modules/shipment_tracking/subscribers/poi-event-webhook-dispatch.ts +94 -0
- package/src/modules/shipment_tracking/subscribers/shipment-status-changed.ts +41 -0
- package/src/modules/shipment_tracking/subscribers/terminal-event-ingest.ts +109 -0
- package/src/modules/shipment_tracking/subscribers/tracking-job-initial-poll.ts +53 -0
- package/src/modules/shipment_tracking/subscribers/tracking-job-webhook-dispatch.ts +50 -0
- package/src/modules/shipment_tracking/tables/index.ts +4 -0
- package/src/modules/shipment_tracking/tables/tracking_job/table.client.tsx +337 -0
- package/src/modules/shipment_tracking/tables/tracking_job/table.ts +34 -0
- package/src/modules/shipment_tracking/widgets/dashboard/ships-map/config.ts +32 -0
- package/src/modules/shipment_tracking/widgets/dashboard/ships-map/widget.client.tsx +448 -0
- package/src/modules/shipment_tracking/widgets/dashboard/ships-map/widget.ts +25 -0
- package/src/types/assets.d.ts +5 -0
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
// AUTO-GENERATED by scripts/generate-entity-fields.mjs (HEDGE-168). Do not edit.
|
|
2
|
+
//
|
|
3
|
+
// One file per entity, named `toSnake(ClassName)` — NOT the table name. Each
|
|
4
|
+
// export is a database column name, mirroring what `mercato generate` writes
|
|
5
|
+
// for `@open-mercato/*` packages. `loadStandaloneGeneratedPackageEntities()`
|
|
6
|
+
// reads these back to build the host app's `entity-fields-registry.ts`, which
|
|
7
|
+
// is what the Encryption and Translation managers list fields from.
|
|
8
|
+
//
|
|
9
|
+
// Regenerate with `node scripts/generate-entity-fields.mjs --all`; the package
|
|
10
|
+
// build does it for you. Guarded by
|
|
11
|
+
// `apps/web/src/__tests__/entity-fields-registry-contract.test.ts`.
|
|
12
|
+
export const id = "id";
|
|
13
|
+
export const organization_id = "organization_id";
|
|
14
|
+
export const tenant_id = "tenant_id";
|
|
15
|
+
export const tracking_job = "tracking_job";
|
|
16
|
+
export const source = "source";
|
|
17
|
+
export const source_event_id = "source_event_id";
|
|
18
|
+
export const event_type = "event_type";
|
|
19
|
+
export const event_code = "event_code";
|
|
20
|
+
export const event_classifier_code = "event_classifier_code";
|
|
21
|
+
export const event_date_time = "event_date_time";
|
|
22
|
+
export const event_date_time_offset = "event_date_time_offset";
|
|
23
|
+
export const description = "description";
|
|
24
|
+
export const raw_data = "raw_data";
|
|
25
|
+
export const equipment_reference = "equipment_reference";
|
|
26
|
+
export const iso_equipment_code = "iso_equipment_code";
|
|
27
|
+
export const empty_indicator_code = "empty_indicator_code";
|
|
28
|
+
export const is_transshipment_move = "is_transshipment_move";
|
|
29
|
+
export const location_name = "location_name";
|
|
30
|
+
export const location_unlocode = "location_unlocode";
|
|
31
|
+
export const location_country = "location_country";
|
|
32
|
+
export const region_name_pl = "region_name_pl";
|
|
33
|
+
export const region_name_en = "region_name_en";
|
|
34
|
+
export const facility_code = "facility_code";
|
|
35
|
+
export const facility_code_list_provider = "facility_code_list_provider";
|
|
36
|
+
export const facility_type_code = "facility_type_code";
|
|
37
|
+
export const facility_address = "facility_address";
|
|
38
|
+
export const latitude = "latitude";
|
|
39
|
+
export const longitude = "longitude";
|
|
40
|
+
export const transport_call_reference = "transport_call_reference";
|
|
41
|
+
export const mode_of_transport = "mode_of_transport";
|
|
42
|
+
export const vessel_name = "vessel_name";
|
|
43
|
+
export const vessel_imo = "vessel_imo";
|
|
44
|
+
export const voyage_number = "voyage_number";
|
|
45
|
+
export const carrier_service_code = "carrier_service_code";
|
|
46
|
+
export const carrier_export_voyage_number = "carrier_export_voyage_number";
|
|
47
|
+
export const carrier_import_voyage_number = "carrier_import_voyage_number";
|
|
48
|
+
export const universal_service_reference = "universal_service_reference";
|
|
49
|
+
export const universal_export_voyage_reference = "universal_export_voyage_reference";
|
|
50
|
+
export const universal_import_voyage_reference = "universal_import_voyage_reference";
|
|
51
|
+
export const port_visit_reference = "port_visit_reference";
|
|
52
|
+
export const related_document_references = "related_document_references";
|
|
53
|
+
export const event_created_date_time = "event_created_date_time";
|
|
54
|
+
export const retracted_event_id = "retracted_event_id";
|
|
55
|
+
export const publisher_name = "publisher_name";
|
|
56
|
+
export const publisher_role = "publisher_role";
|
|
57
|
+
export const delay_reason_code = "delay_reason_code";
|
|
58
|
+
export const change_remark = "change_remark";
|
|
59
|
+
export const seals = "seals";
|
|
60
|
+
export const created_at = "created_at";
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
// AUTO-GENERATED by scripts/generate-entity-fields.mjs (HEDGE-168). Do not edit.
|
|
2
|
+
//
|
|
3
|
+
// One file per entity, named `toSnake(ClassName)` — NOT the table name. Each
|
|
4
|
+
// export is a database column name, mirroring what `mercato generate` writes
|
|
5
|
+
// for `@open-mercato/*` packages. `loadStandaloneGeneratedPackageEntities()`
|
|
6
|
+
// reads these back to build the host app's `entity-fields-registry.ts`, which
|
|
7
|
+
// is what the Encryption and Translation managers list fields from.
|
|
8
|
+
//
|
|
9
|
+
// Regenerate with `node scripts/generate-entity-fields.mjs --all`; the package
|
|
10
|
+
// build does it for you. Guarded by
|
|
11
|
+
// `apps/web/src/__tests__/entity-fields-registry-contract.test.ts`.
|
|
12
|
+
export const id = "id";
|
|
13
|
+
export const organization_id = "organization_id";
|
|
14
|
+
export const tenant_id = "tenant_id";
|
|
15
|
+
export const provider = "provider";
|
|
16
|
+
export const mode = "mode";
|
|
17
|
+
export const provider_shipment_id = "provider_shipment_id";
|
|
18
|
+
export const carrier_code = "carrier_code";
|
|
19
|
+
export const reference_type = "reference_type";
|
|
20
|
+
export const reference_value = "reference_value";
|
|
21
|
+
export const origin_unlocode = "origin_unlocode";
|
|
22
|
+
export const destination_unlocode = "destination_unlocode";
|
|
23
|
+
export const status = "status";
|
|
24
|
+
export const schedule = "schedule";
|
|
25
|
+
export const next_poll_at = "next_poll_at";
|
|
26
|
+
export const last_poll_at = "last_poll_at";
|
|
27
|
+
export const retry_count = "retry_count";
|
|
28
|
+
export const error_history = "error_history";
|
|
29
|
+
export const created_at = "created_at";
|
|
30
|
+
export const updated_at = "updated_at";
|
|
31
|
+
export const deleted_at = "deleted_at";
|
|
32
|
+
export const shipments = "shipments";
|
|
33
|
+
export const events = "events";
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
// AUTO-GENERATED by scripts/generate-entity-fields.mjs (HEDGE-168). Do not edit.
|
|
2
|
+
//
|
|
3
|
+
// One file per entity, named `toSnake(ClassName)` — NOT the table name. Each
|
|
4
|
+
// export is a database column name, mirroring what `mercato generate` writes
|
|
5
|
+
// for `@open-mercato/*` packages. `loadStandaloneGeneratedPackageEntities()`
|
|
6
|
+
// reads these back to build the host app's `entity-fields-registry.ts`, which
|
|
7
|
+
// is what the Encryption and Translation managers list fields from.
|
|
8
|
+
//
|
|
9
|
+
// Regenerate with `node scripts/generate-entity-fields.mjs --all`; the package
|
|
10
|
+
// build does it for you. Guarded by
|
|
11
|
+
// `apps/web/src/__tests__/entity-fields-registry-contract.test.ts`.
|
|
12
|
+
export const id = "id";
|
|
13
|
+
export const organization_id = "organization_id";
|
|
14
|
+
export const tenant_id = "tenant_id";
|
|
15
|
+
export const url = "url";
|
|
16
|
+
export const events_subscribed = "events_subscribed";
|
|
17
|
+
export const hmac_secret = "hmac_secret";
|
|
18
|
+
export const is_active = "is_active";
|
|
19
|
+
export const created_at = "created_at";
|
|
20
|
+
export const updated_at = "updated_at";
|
|
21
|
+
export const deleted_at = "deleted_at";
|
|
22
|
+
export const deliveries = "deliveries";
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
// AUTO-GENERATED by scripts/generate-entity-fields.mjs (HEDGE-168). Do not edit.
|
|
2
|
+
//
|
|
3
|
+
// One file per entity, named `toSnake(ClassName)` — NOT the table name. Each
|
|
4
|
+
// export is a database column name, mirroring what `mercato generate` writes
|
|
5
|
+
// for `@open-mercato/*` packages. `loadStandaloneGeneratedPackageEntities()`
|
|
6
|
+
// reads these back to build the host app's `entity-fields-registry.ts`, which
|
|
7
|
+
// is what the Encryption and Translation managers list fields from.
|
|
8
|
+
//
|
|
9
|
+
// Regenerate with `node scripts/generate-entity-fields.mjs --all`; the package
|
|
10
|
+
// build does it for you. Guarded by
|
|
11
|
+
// `apps/web/src/__tests__/entity-fields-registry-contract.test.ts`.
|
|
12
|
+
export const id = "id";
|
|
13
|
+
export const webhook = "webhook";
|
|
14
|
+
export const event_type = "event_type";
|
|
15
|
+
export const status = "status";
|
|
16
|
+
export const retry_count = "retry_count";
|
|
17
|
+
export const next_retry_at = "next_retry_at";
|
|
18
|
+
export const payload = "payload";
|
|
19
|
+
export const response_status = "response_status";
|
|
20
|
+
export const response_body = "response_body";
|
|
21
|
+
export const error_message = "error_message";
|
|
22
|
+
export const created_at = "created_at";
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
// Entity ids for `@freighttech/shipment-tracking` — HAND-MAINTAINED and AUTHORITATIVE.
|
|
2
|
+
//
|
|
3
|
+
// This header used to say "local typecheck stub", owned at runtime by apps/web.
|
|
4
|
+
// Both halves were false, and HEDGE-164 is what that cost. Nothing regenerates
|
|
5
|
+
// this file — `yarn generate` rewrites `generated/` only for modules declared
|
|
6
|
+
// `from: '@app'`. And it is not merely a typecheck aid: because
|
|
7
|
+
// `@open-mercato/core` installs as a real directory rather than a workspace
|
|
8
|
+
// symlink, `@open-mercato/cli` runs in STANDALONE mode, where
|
|
9
|
+
// `loadStandaloneGeneratedPackageEntities()` reads THIS file as the package's
|
|
10
|
+
// entity list and uses it INSTEAD of parsing `data/entities.ts`.
|
|
11
|
+
//
|
|
12
|
+
// An entity missing here is therefore missing from the host app's `E`, and `E`
|
|
13
|
+
// is a runtime registry rather than a bag of types: it backs the custom-field
|
|
14
|
+
// entity picker, query-index coverage and reindex, attachment assignment,
|
|
15
|
+
// dashboard widget sources and encryption field resolution. The entity's table,
|
|
16
|
+
// migrations and repositories keep working the whole time, which is why the
|
|
17
|
+
// failure reads as "the feature was never built" instead of as an error.
|
|
18
|
+
//
|
|
19
|
+
// One key per exported class in `data/entities.ts`, keyed `toSnake(ClassName)`
|
|
20
|
+
// with NO pluralisation — `InvoiceOrderLine` is `invoice_order_line`, never the
|
|
21
|
+
// `tableName`. Namespaces for OTHER modules are typecheck-only; the generator
|
|
22
|
+
// reads `E['<this module id>']` and ignores the rest.
|
|
23
|
+
//
|
|
24
|
+
// The mechanism in full, and the guard that fails the gate when this file and
|
|
25
|
+
// `data/entities.ts` drift apart:
|
|
26
|
+
// `apps/web/src/__tests__/entity-ids-registry-contract.test.ts`.
|
|
27
|
+
|
|
28
|
+
export const M = {
|
|
29
|
+
shipment_tracking: 'shipment_tracking',
|
|
30
|
+
} as const
|
|
31
|
+
|
|
32
|
+
export const E = {
|
|
33
|
+
shipment_tracking: {
|
|
34
|
+
tracking_job: 'shipment_tracking:tracking_job',
|
|
35
|
+
shipment: 'shipment_tracking:shipment',
|
|
36
|
+
tracking_event: 'shipment_tracking:tracking_event',
|
|
37
|
+
carrier_config: 'shipment_tracking:carrier_config',
|
|
38
|
+
bic_config: 'shipment_tracking:bic_config',
|
|
39
|
+
shipsgo_config: 'shipment_tracking:shipsgo_config',
|
|
40
|
+
webhook: 'shipment_tracking:webhook',
|
|
41
|
+
location_override: 'shipment_tracking:location_override',
|
|
42
|
+
webhook_delivery: 'shipment_tracking:webhook_delivery',
|
|
43
|
+
},
|
|
44
|
+
} as const
|
|
45
|
+
|
|
46
|
+
export type KnownModuleId = keyof typeof M
|
|
47
|
+
export type KnownEntities = typeof E
|
package/package.json
ADDED
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@freighttech/shipment-tracking",
|
|
3
|
+
"version": "0.6.0",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"publishConfig": {
|
|
7
|
+
"access": "public"
|
|
8
|
+
},
|
|
9
|
+
"files": [
|
|
10
|
+
"dist",
|
|
11
|
+
"src",
|
|
12
|
+
"generated",
|
|
13
|
+
"README.md",
|
|
14
|
+
"LICENSE",
|
|
15
|
+
"NOTICE"
|
|
16
|
+
],
|
|
17
|
+
"main": "./dist/index.js",
|
|
18
|
+
"types": "./src/index.ts",
|
|
19
|
+
"exports": {
|
|
20
|
+
".": {
|
|
21
|
+
"types": "./src/index.ts",
|
|
22
|
+
"default": "./dist/index.js"
|
|
23
|
+
},
|
|
24
|
+
"./modules/shipment_tracking/*": {
|
|
25
|
+
"types": [
|
|
26
|
+
"./src/modules/shipment_tracking/*.ts",
|
|
27
|
+
"./src/modules/shipment_tracking/*.tsx"
|
|
28
|
+
],
|
|
29
|
+
"default": "./dist/modules/shipment_tracking/*.js"
|
|
30
|
+
},
|
|
31
|
+
"./modules/shipment_tracking/*.json": "./src/modules/shipment_tracking/*.json"
|
|
32
|
+
},
|
|
33
|
+
"imports": {
|
|
34
|
+
"#generated/entities.ids.generated": {
|
|
35
|
+
"types": "./generated/entities.ids.generated.ts",
|
|
36
|
+
"default": "./generated/entities.ids.generated.ts"
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
"peerDependencies": {
|
|
40
|
+
"@freighttech/ui": "^0.13.0",
|
|
41
|
+
"@mikro-orm/core": "^7.0.17",
|
|
42
|
+
"@mikro-orm/decorators": "^7.0.17",
|
|
43
|
+
"@mikro-orm/migrations": "^7.0.17",
|
|
44
|
+
"@mikro-orm/postgresql": "^7.0.17",
|
|
45
|
+
"@open-mercato/cache": "0.6.2",
|
|
46
|
+
"@open-mercato/core": "0.6.2",
|
|
47
|
+
"@open-mercato/events": "0.6.2",
|
|
48
|
+
"@open-mercato/queue": "0.6.2",
|
|
49
|
+
"@open-mercato/scheduler": "0.6.2",
|
|
50
|
+
"@open-mercato/shared": "0.6.2",
|
|
51
|
+
"@opentelemetry/api": "^1.9.0",
|
|
52
|
+
"@react-google-maps/api": "^2.20.6",
|
|
53
|
+
"@tanstack/react-query": "^5.90.12",
|
|
54
|
+
"awilix": "^12.0.5",
|
|
55
|
+
"lucide-react": "^0.556.0",
|
|
56
|
+
"nats": "^2.28.2",
|
|
57
|
+
"next": "^16.2.3",
|
|
58
|
+
"react": "^19.0.0",
|
|
59
|
+
"react-dom": "^19.0.0",
|
|
60
|
+
"zod": "^4.0.0"
|
|
61
|
+
},
|
|
62
|
+
"peerDependenciesMeta": {
|
|
63
|
+
"@open-mercato/scheduler": {
|
|
64
|
+
"optional": true
|
|
65
|
+
}
|
|
66
|
+
},
|
|
67
|
+
"devDependencies": {
|
|
68
|
+
"@types/google.maps": "^3.58.1",
|
|
69
|
+
"@types/node": "^24.10.1",
|
|
70
|
+
"@types/react": "^19.2.7",
|
|
71
|
+
"@types/react-dom": "^19.2.3",
|
|
72
|
+
"typescript": "^5.9.3"
|
|
73
|
+
},
|
|
74
|
+
"scripts": {
|
|
75
|
+
"typecheck": "tsc --noEmit",
|
|
76
|
+
"test": "npx --no-install vitest run",
|
|
77
|
+
"test:watch": "npx --no-install vitest",
|
|
78
|
+
"build": "node ../../scripts/build-package.mjs",
|
|
79
|
+
"prepack": "node ../../scripts/build-package.mjs"
|
|
80
|
+
}
|
|
81
|
+
}
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @freighttech/shipment-tracking
|
|
3
|
+
*
|
|
4
|
+
* Ocean container shipment tracking with pluggable carrier adapters and webhooks
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
export {
|
|
8
|
+
Shipment,
|
|
9
|
+
TrackingJob,
|
|
10
|
+
TrackingEvent,
|
|
11
|
+
CarrierConfig,
|
|
12
|
+
Webhook,
|
|
13
|
+
WebhookDelivery,
|
|
14
|
+
} from './modules/shipment_tracking/data/entities'
|
|
15
|
+
|
|
16
|
+
export type {
|
|
17
|
+
ShipmentTimestampEntry,
|
|
18
|
+
TimestampSource,
|
|
19
|
+
TimestampType,
|
|
20
|
+
} from './modules/shipment_tracking/data/entities'
|
|
21
|
+
|
|
22
|
+
export type { CarrierAdapter, CarrierAdapterTestResult } from './modules/shipment_tracking/lib/carrier-adapter'
|
|
23
|
+
export type { ShipmentStatus } from './modules/shipment_tracking/lib/status-machine'
|
|
24
|
+
export { deriveShipmentStatus } from './modules/shipment_tracking/lib/status-machine'
|
|
25
|
+
export { extractShipmentTimes } from './modules/shipment_tracking/lib/time-extraction'
|
|
26
|
+
|
|
27
|
+
// Timestamp utilities for multi-source tracking
|
|
28
|
+
export {
|
|
29
|
+
getLatestTimestamp,
|
|
30
|
+
getPrimaryTimestampValue,
|
|
31
|
+
getPrimaryTimestampOffset,
|
|
32
|
+
createTimestampEntry,
|
|
33
|
+
addTimestampEntry,
|
|
34
|
+
mergeExtractedTimestamps,
|
|
35
|
+
hasTimestamps,
|
|
36
|
+
getTimestampsBySource,
|
|
37
|
+
getTimestampHistory,
|
|
38
|
+
} from './modules/shipment_tracking/lib/timestamp-utils'
|
|
39
|
+
export type { ComputedTimestamp } from './modules/shipment_tracking/lib/timestamp-utils'
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* TC-TRACK-410 — ShipsGo config API contract & token-hiding.
|
|
3
|
+
*
|
|
4
|
+
* Verifies the per-tenant ShipsGo configuration route
|
|
5
|
+
* packages/shipment-tracking/src/modules/shipment_tracking/api/shipsgo-configs/route.ts
|
|
6
|
+
*
|
|
7
|
+
* Acceptance:
|
|
8
|
+
* - Unauthenticated GET/PUT/DELETE → 401.
|
|
9
|
+
* - PUT upserts the config for the caller's org/tenant (200, returns id).
|
|
10
|
+
* - GET returns the stored config but NEVER echoes the apiToken (the token is
|
|
11
|
+
* encrypted at rest and must not leave the server) — the security invariant.
|
|
12
|
+
* - PUT with the "__UNCHANGED__" sentinel keeps the config without rotating
|
|
13
|
+
* the token (still 200, config still present + enabled).
|
|
14
|
+
* - DELETE removes it; a subsequent GET returns { config: null }.
|
|
15
|
+
*
|
|
16
|
+
* This is the only surface of the ShipsGo feature with a self-contained HTTP
|
|
17
|
+
* contract: a ShipsGo *tracking job* cannot be created from the public API
|
|
18
|
+
* (it is routed to internally on unsupported-carrier legs), and register→poll
|
|
19
|
+
* would require a live, credit-spending ShipsGo account — those behaviours are
|
|
20
|
+
* pinned by the unit/service tests (shipsgo-provider / shipsgo-poll /
|
|
21
|
+
* shipsgo-client / shipsgo-mapper), not here.
|
|
22
|
+
*
|
|
23
|
+
* Fully self-contained: no fixtures, no hardcoded IDs. The config is a singleton
|
|
24
|
+
* per org/tenant, so the test snapshots any pre-existing config and restores it
|
|
25
|
+
* in teardown to stay order-independent.
|
|
26
|
+
*/
|
|
27
|
+
|
|
28
|
+
import { expect, test, type APIRequestContext } from '@playwright/test'
|
|
29
|
+
import { login } from '@open-mercato/core/helpers/integration/auth'
|
|
30
|
+
|
|
31
|
+
const ENDPOINT = '/api/shipment_tracking/shipsgo-configs'
|
|
32
|
+
|
|
33
|
+
type ShipsGoConfig = {
|
|
34
|
+
id: string
|
|
35
|
+
isEnabled: boolean
|
|
36
|
+
baseUrl: string
|
|
37
|
+
oceanEnabled: boolean
|
|
38
|
+
airEnabled: boolean
|
|
39
|
+
apiToken?: string
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
async function getConfig(api: APIRequestContext): Promise<ShipsGoConfig | null> {
|
|
43
|
+
const res = await api.get(ENDPOINT)
|
|
44
|
+
if (!res.ok()) return null
|
|
45
|
+
const body = (await res.json().catch(() => null)) as { config?: ShipsGoConfig | null } | null
|
|
46
|
+
return body?.config ?? null
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
test.describe('TC-TRACK-410: ShipsGo config API', () => {
|
|
50
|
+
let snapshot: ShipsGoConfig | null = null
|
|
51
|
+
|
|
52
|
+
test.beforeEach(async ({ page }) => {
|
|
53
|
+
await login(page, 'superadmin')
|
|
54
|
+
// Snapshot any existing config so we can restore singleton state afterwards.
|
|
55
|
+
snapshot = await getConfig(page.request)
|
|
56
|
+
})
|
|
57
|
+
|
|
58
|
+
test.afterEach(async ({ page }) => {
|
|
59
|
+
// Restore: delete our test config, then re-apply the original if there was one.
|
|
60
|
+
await page.request.delete(ENDPOINT).catch(() => null)
|
|
61
|
+
if (snapshot) {
|
|
62
|
+
await page.request
|
|
63
|
+
.put(ENDPOINT, {
|
|
64
|
+
data: {
|
|
65
|
+
isEnabled: snapshot.isEnabled,
|
|
66
|
+
apiToken: '__UNCHANGED__', // original token was never exposed; keep whatever was there
|
|
67
|
+
baseUrl: snapshot.baseUrl,
|
|
68
|
+
oceanEnabled: snapshot.oceanEnabled,
|
|
69
|
+
airEnabled: snapshot.airEnabled,
|
|
70
|
+
},
|
|
71
|
+
})
|
|
72
|
+
.catch(() => null)
|
|
73
|
+
}
|
|
74
|
+
})
|
|
75
|
+
|
|
76
|
+
test('rejects unauthenticated access with 401', async ({ request }) => {
|
|
77
|
+
// `request` here is the bare context (no login/cookies).
|
|
78
|
+
const res = await request.get(ENDPOINT)
|
|
79
|
+
expect(res.status()).toBe(401)
|
|
80
|
+
})
|
|
81
|
+
|
|
82
|
+
test('upserts config and never returns the apiToken on GET', async ({ page }) => {
|
|
83
|
+
const put = await page.request.put(ENDPOINT, {
|
|
84
|
+
data: {
|
|
85
|
+
isEnabled: true,
|
|
86
|
+
apiToken: 'secret-token-value',
|
|
87
|
+
baseUrl: 'https://api.shipsgo.com/v2',
|
|
88
|
+
oceanEnabled: true,
|
|
89
|
+
airEnabled: false,
|
|
90
|
+
},
|
|
91
|
+
})
|
|
92
|
+
expect(put.ok()).toBeTruthy()
|
|
93
|
+
|
|
94
|
+
const config = await getConfig(page.request)
|
|
95
|
+
expect(config).not.toBeNull()
|
|
96
|
+
expect(config!.isEnabled).toBe(true)
|
|
97
|
+
expect(config!.oceanEnabled).toBe(true)
|
|
98
|
+
expect(config!.airEnabled).toBe(false)
|
|
99
|
+
expect(config!.baseUrl).toBe('https://api.shipsgo.com/v2')
|
|
100
|
+
|
|
101
|
+
// The security invariant: the token must never travel back to the client.
|
|
102
|
+
expect(config).not.toHaveProperty('apiToken')
|
|
103
|
+
expect(JSON.stringify(config)).not.toContain('secret-token-value')
|
|
104
|
+
})
|
|
105
|
+
|
|
106
|
+
test('keeps the config on an __UNCHANGED__ token update (no rotation required)', async ({ page }) => {
|
|
107
|
+
await page.request.put(ENDPOINT, {
|
|
108
|
+
data: { isEnabled: true, apiToken: 'secret-token-value', baseUrl: 'https://api.shipsgo.com/v2' },
|
|
109
|
+
})
|
|
110
|
+
|
|
111
|
+
const update = await page.request.put(ENDPOINT, {
|
|
112
|
+
data: { isEnabled: false, apiToken: '__UNCHANGED__', baseUrl: 'https://api.shipsgo.com/v2' },
|
|
113
|
+
})
|
|
114
|
+
expect(update.ok()).toBeTruthy()
|
|
115
|
+
|
|
116
|
+
const config = await getConfig(page.request)
|
|
117
|
+
expect(config).not.toBeNull()
|
|
118
|
+
expect(config!.isEnabled).toBe(false)
|
|
119
|
+
expect(config).not.toHaveProperty('apiToken')
|
|
120
|
+
})
|
|
121
|
+
|
|
122
|
+
test('deletes the config; a subsequent GET returns null', async ({ page }) => {
|
|
123
|
+
await page.request.put(ENDPOINT, {
|
|
124
|
+
data: { isEnabled: true, apiToken: 'secret-token-value', baseUrl: 'https://api.shipsgo.com/v2' },
|
|
125
|
+
})
|
|
126
|
+
expect(await getConfig(page.request)).not.toBeNull()
|
|
127
|
+
|
|
128
|
+
const del = await page.request.delete(ENDPOINT)
|
|
129
|
+
expect(del.ok()).toBeTruthy()
|
|
130
|
+
|
|
131
|
+
expect(await getConfig(page.request)).toBeNull()
|
|
132
|
+
})
|
|
133
|
+
})
|