sgerp-frontend-lib 0.1.4 → 0.1.5
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/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/locales/locale-server.d.ts +1 -1
- package/dist/locales/locale-server.d.ts.map +1 -1
- package/dist/locales/locale-server.js +5 -0
- package/dist/locales/locale.d.ts +1 -1
- package/dist/locales/locale.d.ts.map +1 -1
- package/dist/locales/locale.js +6 -2
- package/dist/locales/locale_en.d.ts.map +1 -1
- package/dist/locales/locale_en.js +77 -1
- package/dist/locales/locale_id.d.ts +2 -0
- package/dist/locales/locale_id.d.ts.map +1 -0
- package/dist/locales/locale_id.js +2473 -0
- package/dist/locales/locale_ja.d.ts.map +1 -1
- package/dist/locales/locale_ja.js +76 -1
- package/dist/locales/locale_ms.d.ts.map +1 -1
- package/dist/locales/locale_ms.js +60 -1
- package/dist/locales/locale_tl.d.ts +2 -0
- package/dist/locales/locale_tl.d.ts.map +1 -0
- package/dist/locales/locale_tl.js +1122 -0
- package/dist/sgerp/collection.d.ts.map +1 -1
- package/dist/sgerp/collection.js +18 -4
- package/dist/sgerp/domains.d.ts +16 -2
- package/dist/sgerp/domains.d.ts.map +1 -1
- package/dist/sgerp/domains.js +47 -1
- package/dist/sgerp/hooks/use-selection-state.d.ts +37 -0
- package/dist/sgerp/hooks/use-selection-state.d.ts.map +1 -0
- package/dist/sgerp/hooks/use-selection-state.js +121 -0
- package/dist/sgerp/hooks/use-simulation-data.d.ts +105 -0
- package/dist/sgerp/hooks/use-simulation-data.d.ts.map +1 -0
- package/dist/sgerp/hooks/use-simulation-data.js +146 -0
- package/dist/sgerp/hooks/use-simulation-state.d.ts +80 -0
- package/dist/sgerp/hooks/use-simulation-state.d.ts.map +1 -0
- package/dist/sgerp/hooks/use-simulation-state.js +161 -0
- package/dist/sgerp/index.d.ts +10 -3
- package/dist/sgerp/index.d.ts.map +1 -1
- package/dist/sgerp/index.js +24 -2
- package/dist/sgerp/simulation-logic/fetchUtils.d.ts.map +1 -1
- package/dist/sgerp/simulation-logic/fetchUtils.js +2 -0
- package/dist/sgerp/simulation-logic/index.d.ts +3 -1
- package/dist/sgerp/simulation-logic/index.d.ts.map +1 -1
- package/dist/sgerp/simulation-logic/index.js +10 -1
- package/dist/sgerp/simulation-logic/liveUpdates.d.ts +102 -0
- package/dist/sgerp/simulation-logic/liveUpdates.d.ts.map +1 -0
- package/dist/sgerp/simulation-logic/liveUpdates.js +87 -0
- package/dist/sgerp/simulation-logic/prepareSimulationData.d.ts +36 -0
- package/dist/sgerp/simulation-logic/prepareSimulationData.d.ts.map +1 -0
- package/dist/sgerp/simulation-logic/prepareSimulationData.js +34 -0
- package/dist/sgerp/simulation-logic/routeCalculationUtils.d.ts +7 -1
- package/dist/sgerp/simulation-logic/routeCalculationUtils.d.ts.map +1 -1
- package/dist/sgerp/simulation-logic/routeCalculationUtils.js +81 -0
- package/dist/vrptoolbox/collection.d.ts +16 -0
- package/dist/vrptoolbox/collection.d.ts.map +1 -0
- package/dist/vrptoolbox/collection.js +62 -0
- package/dist/vrptoolbox/index.d.ts +6 -0
- package/dist/vrptoolbox/index.d.ts.map +1 -0
- package/dist/vrptoolbox/index.js +8 -0
- package/dist/vrptoolbox/types/job.d.ts +46 -0
- package/dist/vrptoolbox/types/job.d.ts.map +1 -0
- package/dist/vrptoolbox/types/job.js +5 -0
- package/package.json +7 -4
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Hook for managing simulation page state and derived calculations
|
|
4
|
+
* Extracts business logic from simulation-detail-page component
|
|
5
|
+
*/
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.calculateStateDistribution = calculateStateDistribution;
|
|
8
|
+
exports.calculateVehicleStats = calculateVehicleStats;
|
|
9
|
+
exports.calculateShiftStats = calculateShiftStats;
|
|
10
|
+
exports.filterBookingsByState = filterBookingsByState;
|
|
11
|
+
exports.useSimulationState = useSimulationState;
|
|
12
|
+
const react_1 = require("react");
|
|
13
|
+
const booking_1 = require("../types/simulation/booking");
|
|
14
|
+
/**
|
|
15
|
+
* Calculate booking state distribution
|
|
16
|
+
*/
|
|
17
|
+
function calculateStateDistribution(bookings) {
|
|
18
|
+
const distribution = {
|
|
19
|
+
unassigned: 0,
|
|
20
|
+
calculating: 0,
|
|
21
|
+
assigned: 0,
|
|
22
|
+
rejected_by_system: 0,
|
|
23
|
+
sent_offer: 0,
|
|
24
|
+
enroute: 0,
|
|
25
|
+
completed: 0,
|
|
26
|
+
cancelled_by_user: 0,
|
|
27
|
+
cancelled_in_calc: 0,
|
|
28
|
+
fail_to_board: 0,
|
|
29
|
+
fail_to_deliver: 0,
|
|
30
|
+
};
|
|
31
|
+
bookings.forEach((booking) => {
|
|
32
|
+
const state = booking.state;
|
|
33
|
+
// Combine unassigned states (not in calculation)
|
|
34
|
+
if ([booking_1.BookingState.NEW, booking_1.BookingState.PREPARED].includes(state)) {
|
|
35
|
+
distribution.unassigned++;
|
|
36
|
+
}
|
|
37
|
+
else if ([booking_1.BookingState.QUEUED, booking_1.BookingState.CALCULATION].includes(state)) {
|
|
38
|
+
distribution.calculating++;
|
|
39
|
+
}
|
|
40
|
+
else if (state && state in distribution) {
|
|
41
|
+
distribution[state]++;
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
return distribution;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Calculate per-vehicle booking statistics
|
|
48
|
+
*/
|
|
49
|
+
function calculateVehicleStats(bookings) {
|
|
50
|
+
const stats = {};
|
|
51
|
+
bookings.forEach((booking) => {
|
|
52
|
+
if (!booking.vehicle_id)
|
|
53
|
+
return;
|
|
54
|
+
if (!stats[booking.vehicle_id]) {
|
|
55
|
+
stats[booking.vehicle_id] = {
|
|
56
|
+
total: 0,
|
|
57
|
+
completed: 0,
|
|
58
|
+
assigned: 0,
|
|
59
|
+
enroute: 0,
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
stats[booking.vehicle_id].total++;
|
|
63
|
+
if (booking.state === booking_1.BookingState.COMPLETED) {
|
|
64
|
+
stats[booking.vehicle_id].completed++;
|
|
65
|
+
}
|
|
66
|
+
else if (booking.state === booking_1.BookingState.ASSIGNED) {
|
|
67
|
+
stats[booking.vehicle_id].assigned++;
|
|
68
|
+
}
|
|
69
|
+
else if (booking.state === booking_1.BookingState.ENROUTE) {
|
|
70
|
+
stats[booking.vehicle_id].enroute++;
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
return stats;
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Calculate JIT shift statistics
|
|
77
|
+
*/
|
|
78
|
+
function calculateShiftStats(bookings, shifts) {
|
|
79
|
+
const stats = {};
|
|
80
|
+
// Group bookings by shift
|
|
81
|
+
const bookingsByShift = new Map();
|
|
82
|
+
bookings.forEach((booking) => {
|
|
83
|
+
const shiftId = booking.shift_id;
|
|
84
|
+
if (!shiftId)
|
|
85
|
+
return;
|
|
86
|
+
if (!bookingsByShift.has(shiftId)) {
|
|
87
|
+
bookingsByShift.set(shiftId, []);
|
|
88
|
+
}
|
|
89
|
+
bookingsByShift.get(shiftId).push(booking);
|
|
90
|
+
});
|
|
91
|
+
// Calculate stats for each shift
|
|
92
|
+
shifts.forEach((shift) => {
|
|
93
|
+
const shiftId = shift.shift_id || String(shift.id);
|
|
94
|
+
const shiftBookings = bookingsByShift.get(shiftId) || [];
|
|
95
|
+
const vehicleIds = new Set();
|
|
96
|
+
const assignedVehicleIds = new Set();
|
|
97
|
+
shiftBookings.forEach((booking) => {
|
|
98
|
+
if (booking.vehicle_id) {
|
|
99
|
+
vehicleIds.add(booking.vehicle_id);
|
|
100
|
+
if (booking.state === 'assigned' || booking.state === 'enroute' || booking.state === 'completed') {
|
|
101
|
+
assignedVehicleIds.add(booking.vehicle_id);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
});
|
|
105
|
+
const bookingCount = shiftBookings.length;
|
|
106
|
+
stats[shiftId] = {
|
|
107
|
+
bookings: bookingCount,
|
|
108
|
+
vehiclesAllocated: vehicleIds.size,
|
|
109
|
+
vehiclesAssigned: assignedVehicleIds.size,
|
|
110
|
+
};
|
|
111
|
+
});
|
|
112
|
+
return stats;
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Filter bookings by state
|
|
116
|
+
*/
|
|
117
|
+
function filterBookingsByState(bookings, stateFilters) {
|
|
118
|
+
if (stateFilters.length === 0)
|
|
119
|
+
return bookings;
|
|
120
|
+
return bookings.filter((booking) => {
|
|
121
|
+
// Handle "unassigned" as a combined filter (NEW, PREPARED only - not calculating states)
|
|
122
|
+
if (stateFilters.includes('unassigned')) {
|
|
123
|
+
return [booking_1.BookingState.NEW, booking_1.BookingState.PREPARED].includes(booking.state);
|
|
124
|
+
}
|
|
125
|
+
// Handle "calculating" as a combined filter (QUEUED, CALCULATION)
|
|
126
|
+
if (stateFilters.includes('calculating')) {
|
|
127
|
+
return [booking_1.BookingState.QUEUED, booking_1.BookingState.CALCULATION].includes(booking.state);
|
|
128
|
+
}
|
|
129
|
+
return stateFilters.includes(booking.state);
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* Hook for simulation state calculations
|
|
134
|
+
* Provides memoized state distribution, vehicle stats, and filtered bookings
|
|
135
|
+
*/
|
|
136
|
+
function useSimulationState(bookings, vehicles, stateFilters = [], shifts = []) {
|
|
137
|
+
// Calculate booking state distribution
|
|
138
|
+
const stateDistribution = (0, react_1.useMemo)(() => calculateStateDistribution(bookings), [bookings]);
|
|
139
|
+
// Calculate per-vehicle statistics
|
|
140
|
+
const vehicleStats = (0, react_1.useMemo)(() => calculateVehicleStats(bookings), [bookings]);
|
|
141
|
+
// Calculate JIT shift statistics
|
|
142
|
+
const shiftStats = (0, react_1.useMemo)(() => calculateShiftStats(bookings, shifts), [bookings, shifts]);
|
|
143
|
+
// Filter bookings by selected states
|
|
144
|
+
const filteredBookings = (0, react_1.useMemo)(() => filterBookingsByState(bookings, stateFilters), [bookings, stateFilters]);
|
|
145
|
+
// Calculate autoplan statistics
|
|
146
|
+
const autoplanStats = (0, react_1.useMemo)(() => {
|
|
147
|
+
const unassignedCount = stateDistribution.unassigned || 0;
|
|
148
|
+
const totalVehicleCount = vehicles.length;
|
|
149
|
+
return {
|
|
150
|
+
unassignedCount,
|
|
151
|
+
vehicleCount: totalVehicleCount,
|
|
152
|
+
};
|
|
153
|
+
}, [stateDistribution, vehicles]);
|
|
154
|
+
return {
|
|
155
|
+
stateDistribution,
|
|
156
|
+
vehicleStats,
|
|
157
|
+
shiftStats,
|
|
158
|
+
filteredBookings,
|
|
159
|
+
autoplanStats,
|
|
160
|
+
};
|
|
161
|
+
}
|
package/dist/sgerp/index.d.ts
CHANGED
|
@@ -31,6 +31,12 @@ export { BuildingCollection } from './collections/masstransit/building';
|
|
|
31
31
|
export { TransitStopSetCollection } from './collections/masstransit/transitstopset';
|
|
32
32
|
export { useCollection, useSGERP } from './hooks/use-collection';
|
|
33
33
|
export { useLiveUpdates } from './hooks/use-live-updates';
|
|
34
|
+
export { useSimulationData } from './hooks/use-simulation-data';
|
|
35
|
+
export type { SimulationDataState, UseSimulationDataOptions } from './hooks/use-simulation-data';
|
|
36
|
+
export { useSimulationState, calculateStateDistribution, calculateVehicleStats, calculateShiftStats, filterBookingsByState } from './hooks/use-simulation-state';
|
|
37
|
+
export type { StateDistribution, VehicleStats, ShiftStats } from './hooks/use-simulation-state';
|
|
38
|
+
export { useSelectionState, useRecentChanges } from './hooks/use-selection-state';
|
|
39
|
+
export type { SelectionState } from './hooks/use-selection-state';
|
|
34
40
|
export { SGERPProvider, useSGERPContext } from './context/sgerp-context';
|
|
35
41
|
export type { SGERPProviderProps } from './context/sgerp-context';
|
|
36
42
|
export * from './constants/scheduling-enums';
|
|
@@ -89,8 +95,8 @@ export { generateWaypointRouteFromNodes, createVehicleRoutesFromNodes, validateP
|
|
|
89
95
|
export type { RouteNode, Waypoint, Waypoint as RouteWaypoint, VehicleRouteData, VehicleRouteData as RouteVehicleRouteData } from './utils/routeUtils';
|
|
90
96
|
export { buildBookingPayload } from './utils/bookingPayload';
|
|
91
97
|
export type { BookingPayloadInput } from './utils/bookingPayload';
|
|
92
|
-
export { fetchVehicles, fetchBookings, fetchNodes, fetchDrivers, fetchDriversByProject, fetchOperationsLocationsByProject, fetchSimulationData, createIndexMaps, attachReferences, calculateBoundingBoxCenter, vehicleComplexRearrange, buildVehicleRouteMap, shiftNodeTimestamps, shiftWaypointTimestamps, calculateVehicleRoute, hasRouteChanged, processUnassignResponse, } from './simulation-logic';
|
|
93
|
-
export type { VehicleComplexRearrangeRequest, ManualEditResponse, ManualEditError, VehicleRouteMap, UnassignResponse, ProcessUnassignResult, } from './simulation-logic';
|
|
98
|
+
export { fetchVehicles, fetchBookings, fetchNodes, fetchDrivers, fetchDriversByProject, fetchOperationsLocationsByProject, fetchSimulationData, createIndexMaps, attachReferences, calculateBoundingBoxCenter, vehicleComplexRearrange, buildVehicleRouteMap, shiftNodeTimestamps, shiftWaypointTimestamps, calculateVehicleRoute, hasRouteChanged, recalculateVehicleRoute, processUnassignResponse, LIVE_UPDATE_INTERVALS, PROCESSOR_LIVE_UPDATE_PARAMS, getVehicleLiveUpdateConfig, getBookingLiveUpdateConfig, getNodeLiveUpdateConfig, getProcessorLiveUpdateConfig, triggerAllSimulationUpdates, } from './simulation-logic';
|
|
99
|
+
export type { VehicleComplexRearrangeRequest, ManualEditResponse, ManualEditError, VehicleRouteMap, UnassignResponse, ProcessUnassignResult, SimulationLiveUpdatesConfig, SimulationLiveUpdateTriggers, } from './simulation-logic';
|
|
94
100
|
export { localize, getLocale, setLocale } from '../locales/locale';
|
|
95
101
|
export type { Language } from '../locales/locale';
|
|
96
102
|
export { useLocalization } from '../locales/useLocalization';
|
|
@@ -99,7 +105,8 @@ export type { StoredConnection } from '../connection-manager';
|
|
|
99
105
|
export { getTimezoneOptions } from '../constants/timezones';
|
|
100
106
|
export { COUNTRIES, POPULAR_COUNTRIES, getLocalizedCountryName } from '../utils/countries';
|
|
101
107
|
export { cn } from '../utils';
|
|
102
|
-
export { SGERP_DOMAINS, DEFAULT_SERVERS } from './domains';
|
|
108
|
+
export { SGERP_DOMAINS, DEFAULT_SERVERS, BACKEND_DETECTION_RULES, detectBackendFromUrl } from './domains';
|
|
109
|
+
export type { BackendEnvironment, OSRMBackend } from './domains';
|
|
103
110
|
export { FIRST_SOLUTION_STRATEGIES } from './constants/solver-strategies';
|
|
104
111
|
export type { FirstSolutionStrategy } from './constants/solver-strategies';
|
|
105
112
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../sgerplib/sgerp/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AACxD,YAAY,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAG7C,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AACnD,YAAY,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAGhD,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAClE,OAAO,EAAE,uBAAuB,EAAE,MAAM,sCAAsC,CAAC;AAC/E,OAAO,EAAE,sBAAsB,EAAE,MAAM,oCAAoC,CAAC;AAC5E,OAAO,EAAE,6BAA6B,EAAE,MAAM,4CAA4C,CAAC;AAC3F,OAAO,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAClE,OAAO,EAAE,mBAAmB,EAAE,MAAM,wCAAwC,CAAC;AAC7E,OAAO,EAAE,gBAAgB,EAAE,MAAM,qCAAqC,CAAC;AACvE,OAAO,EAAE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) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.
|
|
18
|
-
exports.
|
|
17
|
+
exports.TransactionStatus = exports.PassengerGender = exports.isValidEnumValue = exports.getEnumValues = exports.getEnumLabel = exports.getEnumOptions = exports.useSGERPContext = exports.SGERPProvider = exports.useRecentChanges = exports.useSelectionState = exports.filterBookingsByState = exports.calculateShiftStats = exports.calculateVehicleStats = exports.calculateStateDistribution = exports.useSimulationState = exports.useSimulationData = exports.useLiveUpdates = exports.useSGERP = exports.useCollection = exports.TransitStopSetCollection = exports.BuildingCollection = exports.TransitStopCollection = exports.SMSScheduledCollection = exports.MapboxTokenCollection = exports.GeofenceCollection = exports.RoutingProfileCollection = exports.OperationsLocationGroupCollection = exports.OperationsLocationCollection = exports.SimulationProcessorCollection = exports.DatasetCollection = exports.NodeCollection = exports.BookingCollection = exports.VehicleTypeCollection = exports.VehicleCollection = exports.DriverCollection = exports.SimulationCollection = exports.UserCollection = exports.TransactionCollection = exports.TicketCollection = exports.PassengerCollection = exports.PricingCollection = exports.OrganizationProjectCollection = exports.OrganizationCollection = exports.ProjectMemberCollection = exports.ProjectCollection = exports.Collection = exports.APIError = exports.APIClient = exports.SGERPClient = exports.initializeSGERP = void 0;
|
|
18
|
+
exports.getBookingLiveUpdateConfig = exports.getVehicleLiveUpdateConfig = exports.PROCESSOR_LIVE_UPDATE_PARAMS = exports.LIVE_UPDATE_INTERVALS = exports.processUnassignResponse = exports.recalculateVehicleRoute = exports.hasRouteChanged = exports.calculateVehicleRoute = exports.shiftWaypointTimestamps = exports.shiftNodeTimestamps = exports.buildVehicleRouteMap = exports.vehicleComplexRearrange = exports.calculateBoundingBoxCenter = exports.attachReferences = exports.createIndexMaps = exports.fetchSimulationData = exports.fetchOperationsLocationsByProject = exports.fetchDriversByProject = exports.fetchDrivers = exports.fetchNodes = exports.fetchBookings = exports.fetchVehicles = exports.buildBookingPayload = exports.validatePickupDropoffConstraint = exports.createVehicleRoutesFromNodes = exports.generateWaypointRouteFromNodes = exports.getContrastTextColor = exports.normalizeVehicleColor = exports.getColorFromAgentId = exports.getHSLToRGB = exports.airLeg = exports.Route = exports.Leg = exports.Step = exports.RoutingEngine = exports.OperationsLocationByProjectMapState = exports.OperationsLocationMapState = exports.createVehicleUploadTask = exports.VehicleExportAttemptStatus = exports.VehicleUseOption = exports.VehicleStatus = exports.getDefaultLogisticsApiSettings = exports.routingProfileToEngineSettings = exports.getRoutingEngineLabel = exports.RoutingEngineName = exports.NodeType = exports.BookingState = exports.TransactionCurrency = exports.TransactionProvider = exports.TransactionType = void 0;
|
|
19
|
+
exports.FIRST_SOLUTION_STRATEGIES = exports.detectBackendFromUrl = exports.BACKEND_DETECTION_RULES = exports.DEFAULT_SERVERS = exports.SGERP_DOMAINS = exports.cn = exports.getLocalizedCountryName = exports.POPULAR_COUNTRIES = exports.COUNTRIES = exports.getTimezoneOptions = exports.ConnectionManager = exports.useLocalization = exports.setLocale = exports.getLocale = exports.localize = exports.triggerAllSimulationUpdates = exports.getProcessorLiveUpdateConfig = exports.getNodeLiveUpdateConfig = void 0;
|
|
19
20
|
// Main Client
|
|
20
21
|
var client_1 = require("./client");
|
|
21
22
|
Object.defineProperty(exports, "initializeSGERP", { enumerable: true, get: function () { return client_1.initializeSGERP; } });
|
|
@@ -85,6 +86,17 @@ Object.defineProperty(exports, "useCollection", { enumerable: true, get: functio
|
|
|
85
86
|
Object.defineProperty(exports, "useSGERP", { enumerable: true, get: function () { return use_collection_1.useSGERP; } });
|
|
86
87
|
var use_live_updates_1 = require("./hooks/use-live-updates");
|
|
87
88
|
Object.defineProperty(exports, "useLiveUpdates", { enumerable: true, get: function () { return use_live_updates_1.useLiveUpdates; } });
|
|
89
|
+
var use_simulation_data_1 = require("./hooks/use-simulation-data");
|
|
90
|
+
Object.defineProperty(exports, "useSimulationData", { enumerable: true, get: function () { return use_simulation_data_1.useSimulationData; } });
|
|
91
|
+
var use_simulation_state_1 = require("./hooks/use-simulation-state");
|
|
92
|
+
Object.defineProperty(exports, "useSimulationState", { enumerable: true, get: function () { return use_simulation_state_1.useSimulationState; } });
|
|
93
|
+
Object.defineProperty(exports, "calculateStateDistribution", { enumerable: true, get: function () { return use_simulation_state_1.calculateStateDistribution; } });
|
|
94
|
+
Object.defineProperty(exports, "calculateVehicleStats", { enumerable: true, get: function () { return use_simulation_state_1.calculateVehicleStats; } });
|
|
95
|
+
Object.defineProperty(exports, "calculateShiftStats", { enumerable: true, get: function () { return use_simulation_state_1.calculateShiftStats; } });
|
|
96
|
+
Object.defineProperty(exports, "filterBookingsByState", { enumerable: true, get: function () { return use_simulation_state_1.filterBookingsByState; } });
|
|
97
|
+
var use_selection_state_1 = require("./hooks/use-selection-state");
|
|
98
|
+
Object.defineProperty(exports, "useSelectionState", { enumerable: true, get: function () { return use_selection_state_1.useSelectionState; } });
|
|
99
|
+
Object.defineProperty(exports, "useRecentChanges", { enumerable: true, get: function () { return use_selection_state_1.useRecentChanges; } });
|
|
88
100
|
// React Context
|
|
89
101
|
var sgerp_context_1 = require("./context/sgerp-context");
|
|
90
102
|
Object.defineProperty(exports, "SGERPProvider", { enumerable: true, get: function () { return sgerp_context_1.SGERPProvider; } });
|
|
@@ -164,7 +176,15 @@ Object.defineProperty(exports, "shiftNodeTimestamps", { enumerable: true, get: f
|
|
|
164
176
|
Object.defineProperty(exports, "shiftWaypointTimestamps", { enumerable: true, get: function () { return simulation_logic_1.shiftWaypointTimestamps; } });
|
|
165
177
|
Object.defineProperty(exports, "calculateVehicleRoute", { enumerable: true, get: function () { return simulation_logic_1.calculateVehicleRoute; } });
|
|
166
178
|
Object.defineProperty(exports, "hasRouteChanged", { enumerable: true, get: function () { return simulation_logic_1.hasRouteChanged; } });
|
|
179
|
+
Object.defineProperty(exports, "recalculateVehicleRoute", { enumerable: true, get: function () { return simulation_logic_1.recalculateVehicleRoute; } });
|
|
167
180
|
Object.defineProperty(exports, "processUnassignResponse", { enumerable: true, get: function () { return simulation_logic_1.processUnassignResponse; } });
|
|
181
|
+
Object.defineProperty(exports, "LIVE_UPDATE_INTERVALS", { enumerable: true, get: function () { return simulation_logic_1.LIVE_UPDATE_INTERVALS; } });
|
|
182
|
+
Object.defineProperty(exports, "PROCESSOR_LIVE_UPDATE_PARAMS", { enumerable: true, get: function () { return simulation_logic_1.PROCESSOR_LIVE_UPDATE_PARAMS; } });
|
|
183
|
+
Object.defineProperty(exports, "getVehicleLiveUpdateConfig", { enumerable: true, get: function () { return simulation_logic_1.getVehicleLiveUpdateConfig; } });
|
|
184
|
+
Object.defineProperty(exports, "getBookingLiveUpdateConfig", { enumerable: true, get: function () { return simulation_logic_1.getBookingLiveUpdateConfig; } });
|
|
185
|
+
Object.defineProperty(exports, "getNodeLiveUpdateConfig", { enumerable: true, get: function () { return simulation_logic_1.getNodeLiveUpdateConfig; } });
|
|
186
|
+
Object.defineProperty(exports, "getProcessorLiveUpdateConfig", { enumerable: true, get: function () { return simulation_logic_1.getProcessorLiveUpdateConfig; } });
|
|
187
|
+
Object.defineProperty(exports, "triggerAllSimulationUpdates", { enumerable: true, get: function () { return simulation_logic_1.triggerAllSimulationUpdates; } });
|
|
168
188
|
// Localization
|
|
169
189
|
var locale_1 = require("../locales/locale");
|
|
170
190
|
Object.defineProperty(exports, "localize", { enumerable: true, get: function () { return locale_1.localize; } });
|
|
@@ -187,5 +207,7 @@ Object.defineProperty(exports, "cn", { enumerable: true, get: function () { retu
|
|
|
187
207
|
var domains_1 = require("./domains");
|
|
188
208
|
Object.defineProperty(exports, "SGERP_DOMAINS", { enumerable: true, get: function () { return domains_1.SGERP_DOMAINS; } });
|
|
189
209
|
Object.defineProperty(exports, "DEFAULT_SERVERS", { enumerable: true, get: function () { return domains_1.DEFAULT_SERVERS; } });
|
|
210
|
+
Object.defineProperty(exports, "BACKEND_DETECTION_RULES", { enumerable: true, get: function () { return domains_1.BACKEND_DETECTION_RULES; } });
|
|
211
|
+
Object.defineProperty(exports, "detectBackendFromUrl", { enumerable: true, get: function () { return domains_1.detectBackendFromUrl; } });
|
|
190
212
|
var solver_strategies_1 = require("./constants/solver-strategies");
|
|
191
213
|
Object.defineProperty(exports, "FIRST_SOLUTION_STRATEGIES", { enumerable: true, get: function () { return solver_strategies_1.FIRST_SOLUTION_STRATEGIES; } });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fetchUtils.d.ts","sourceRoot":"","sources":["../../../sgerplib/sgerp/simulation-logic/fetchUtils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gCAAgC,CAAC;AACjE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,6BAA6B,CAAC;AAC3D,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,6BAA6B,CAAC;AAC3D,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AACzD,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,0BAA0B,CAAC;AACrD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,8BAA8B,CAAC;AAC7D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,wCAAwC,CAAC;AAIjF;;;GAGG;AACH,wBAAsB,aAAa,CACjC,GAAG,EAAE,WAAW,EAChB,YAAY,EAAE,MAAM,GAAG,MAAM,GAC5B,OAAO,CAAC,OAAO,EAAE,CAAC,CASpB;AAED;;;;GAIG;AACH,wBAAsB,aAAa,CACjC,GAAG,EAAE,WAAW,EAChB,YAAY,EAAE,MAAM,GAAG,MAAM,GAC5B,OAAO,CAAC,OAAO,EAAE,CAAC,CAUpB;AAED;;;GAGG;AACH,wBAAsB,UAAU,CAC9B,GAAG,EAAE,WAAW,EAChB,YAAY,EAAE,MAAM,GAAG,MAAM,GA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AC7B,OAAO,CAAC,QAAQ,EAAE,CAAC,CA4CrB;AAED;;;;GAIG;AACH,wBAAsB,uBAAuB,CAC3C,GAAG,EAAE,WAAW,EAChB,UAAU,EAAE,UAAU,GAAG,IAAI,GAC5B,OAAO,CAAC,QAAQ,GAAG,IAAI,CAAC,CA0B1B;AAED;;GAEG;AACH,wBAAsB,mBAAmB,CACvC,GAAG,EAAE,WAAW,EAChB,YAAY,EAAE,MAAM,GAAG,MAAM,EAC7B,UAAU,GAAE,UAAU,GAAG,IAAW;;;;;;;GA8BrC"}
|
|
@@ -10,6 +10,7 @@ exports.fetchGeofences = fetchGeofences;
|
|
|
10
10
|
exports.fetchSimulationGeofence = fetchSimulationGeofence;
|
|
11
11
|
exports.fetchSimulationData = fetchSimulationData;
|
|
12
12
|
const client_1 = require("../api/client");
|
|
13
|
+
const referenceUtils_1 = require("./referenceUtils");
|
|
13
14
|
/**
|
|
14
15
|
* Fetch vehicles for a simulation
|
|
15
16
|
* Uses fetchAll() to get all vehicles regardless of count
|
|
@@ -215,6 +216,7 @@ async function fetchSimulationData(api, simulationId, simulation = null) {
|
|
|
215
216
|
fetchGeofences(api, vehicles, simulationId),
|
|
216
217
|
fetchSimulationGeofence(api, simulation)
|
|
217
218
|
]);
|
|
219
|
+
(0, referenceUtils_1.attachReferences)(bookings, vehicles, nodes);
|
|
218
220
|
return {
|
|
219
221
|
vehicles,
|
|
220
222
|
bookings,
|
|
@@ -8,7 +8,9 @@ export { calculateBoundingBoxCenter } from './mapUtils';
|
|
|
8
8
|
export { vehicleComplexRearrange, buildVehicleRouteMap } from './manualEditUtils';
|
|
9
9
|
export type { VehicleComplexRearrangeRequest, ManualEditResponse, ManualEditError, VehicleRouteMap } from './manualEditUtils';
|
|
10
10
|
export { shiftNodeTimestamps, shiftWaypointTimestamps } from './timeShiftUtils';
|
|
11
|
-
export { calculateVehicleRoute, hasRouteChanged } from './routeCalculationUtils';
|
|
11
|
+
export { calculateVehicleRoute, hasRouteChanged, recalculateVehicleRoute } from './routeCalculationUtils';
|
|
12
12
|
export { processUnassignResponse } from './optimisticUpdateUtils';
|
|
13
13
|
export type { UnassignResponse, ProcessUnassignResult } from './optimisticUpdateUtils';
|
|
14
|
+
export { LIVE_UPDATE_INTERVALS, PROCESSOR_LIVE_UPDATE_PARAMS, getVehicleLiveUpdateConfig, getBookingLiveUpdateConfig, getNodeLiveUpdateConfig, getProcessorLiveUpdateConfig, triggerAllSimulationUpdates } from './liveUpdates';
|
|
15
|
+
export type { SimulationLiveUpdatesConfig, SimulationLiveUpdateTriggers } from './liveUpdates';
|
|
14
16
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../sgerplib/sgerp/simulation-logic/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACL,aAAa,EACb,aAAa,EACb,UAAU,EACV,YAAY,EACZ,qBAAqB,EACrB,iCAAiC,EACjC,mBAAmB,EACpB,MAAM,cAAc,CAAC;AAEtB,OAAO,EACL,eAAe,EACf,gBAAgB,EACjB,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EACL,0BAA0B,EAC3B,MAAM,YAAY,CAAC;AAEpB,OAAO,EACL,uBAAuB,EACvB,oBAAoB,EACrB,MAAM,mBAAmB,CAAC;AAE3B,YAAY,EACV,8BAA8B,EAC9B,kBAAkB,EAClB,eAAe,EACf,eAAe,EAChB,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EACL,mBAAmB,EACnB,uBAAuB,EACxB,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EACL,qBAAqB,EACrB,eAAe,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../sgerplib/sgerp/simulation-logic/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACL,aAAa,EACb,aAAa,EACb,UAAU,EACV,YAAY,EACZ,qBAAqB,EACrB,iCAAiC,EACjC,mBAAmB,EACpB,MAAM,cAAc,CAAC;AAEtB,OAAO,EACL,eAAe,EACf,gBAAgB,EACjB,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EACL,0BAA0B,EAC3B,MAAM,YAAY,CAAC;AAEpB,OAAO,EACL,uBAAuB,EACvB,oBAAoB,EACrB,MAAM,mBAAmB,CAAC;AAE3B,YAAY,EACV,8BAA8B,EAC9B,kBAAkB,EAClB,eAAe,EACf,eAAe,EAChB,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EACL,mBAAmB,EACnB,uBAAuB,EACxB,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EACL,qBAAqB,EACrB,eAAe,EACf,uBAAuB,EACxB,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EACL,uBAAuB,EACxB,MAAM,yBAAyB,CAAC;AAEjC,YAAY,EACV,gBAAgB,EAChB,qBAAqB,EACtB,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EACL,qBAAqB,EACrB,4BAA4B,EAC5B,0BAA0B,EAC1B,0BAA0B,EAC1B,uBAAuB,EACvB,4BAA4B,EAC5B,2BAA2B,EAC5B,MAAM,eAAe,CAAC;AAEvB,YAAY,EACV,2BAA2B,EAC3B,4BAA4B,EAC7B,MAAM,eAAe,CAAC"}
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Inspired by dashviewer's SimulationPage/logic structure
|
|
5
5
|
*/
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.processUnassignResponse = exports.hasRouteChanged = exports.calculateVehicleRoute = exports.shiftWaypointTimestamps = exports.shiftNodeTimestamps = exports.buildVehicleRouteMap = exports.vehicleComplexRearrange = exports.calculateBoundingBoxCenter = exports.attachReferences = exports.createIndexMaps = exports.fetchSimulationData = exports.fetchOperationsLocationsByProject = exports.fetchDriversByProject = exports.fetchDrivers = exports.fetchNodes = exports.fetchBookings = exports.fetchVehicles = void 0;
|
|
7
|
+
exports.triggerAllSimulationUpdates = exports.getProcessorLiveUpdateConfig = exports.getNodeLiveUpdateConfig = exports.getBookingLiveUpdateConfig = exports.getVehicleLiveUpdateConfig = exports.PROCESSOR_LIVE_UPDATE_PARAMS = exports.LIVE_UPDATE_INTERVALS = exports.processUnassignResponse = exports.recalculateVehicleRoute = exports.hasRouteChanged = exports.calculateVehicleRoute = exports.shiftWaypointTimestamps = exports.shiftNodeTimestamps = exports.buildVehicleRouteMap = exports.vehicleComplexRearrange = exports.calculateBoundingBoxCenter = exports.attachReferences = exports.createIndexMaps = exports.fetchSimulationData = exports.fetchOperationsLocationsByProject = exports.fetchDriversByProject = exports.fetchDrivers = exports.fetchNodes = exports.fetchBookings = exports.fetchVehicles = void 0;
|
|
8
8
|
var fetchUtils_1 = require("./fetchUtils");
|
|
9
9
|
Object.defineProperty(exports, "fetchVehicles", { enumerable: true, get: function () { return fetchUtils_1.fetchVehicles; } });
|
|
10
10
|
Object.defineProperty(exports, "fetchBookings", { enumerable: true, get: function () { return fetchUtils_1.fetchBookings; } });
|
|
@@ -27,5 +27,14 @@ Object.defineProperty(exports, "shiftWaypointTimestamps", { enumerable: true, ge
|
|
|
27
27
|
var routeCalculationUtils_1 = require("./routeCalculationUtils");
|
|
28
28
|
Object.defineProperty(exports, "calculateVehicleRoute", { enumerable: true, get: function () { return routeCalculationUtils_1.calculateVehicleRoute; } });
|
|
29
29
|
Object.defineProperty(exports, "hasRouteChanged", { enumerable: true, get: function () { return routeCalculationUtils_1.hasRouteChanged; } });
|
|
30
|
+
Object.defineProperty(exports, "recalculateVehicleRoute", { enumerable: true, get: function () { return routeCalculationUtils_1.recalculateVehicleRoute; } });
|
|
30
31
|
var optimisticUpdateUtils_1 = require("./optimisticUpdateUtils");
|
|
31
32
|
Object.defineProperty(exports, "processUnassignResponse", { enumerable: true, get: function () { return optimisticUpdateUtils_1.processUnassignResponse; } });
|
|
33
|
+
var liveUpdates_1 = require("./liveUpdates");
|
|
34
|
+
Object.defineProperty(exports, "LIVE_UPDATE_INTERVALS", { enumerable: true, get: function () { return liveUpdates_1.LIVE_UPDATE_INTERVALS; } });
|
|
35
|
+
Object.defineProperty(exports, "PROCESSOR_LIVE_UPDATE_PARAMS", { enumerable: true, get: function () { return liveUpdates_1.PROCESSOR_LIVE_UPDATE_PARAMS; } });
|
|
36
|
+
Object.defineProperty(exports, "getVehicleLiveUpdateConfig", { enumerable: true, get: function () { return liveUpdates_1.getVehicleLiveUpdateConfig; } });
|
|
37
|
+
Object.defineProperty(exports, "getBookingLiveUpdateConfig", { enumerable: true, get: function () { return liveUpdates_1.getBookingLiveUpdateConfig; } });
|
|
38
|
+
Object.defineProperty(exports, "getNodeLiveUpdateConfig", { enumerable: true, get: function () { return liveUpdates_1.getNodeLiveUpdateConfig; } });
|
|
39
|
+
Object.defineProperty(exports, "getProcessorLiveUpdateConfig", { enumerable: true, get: function () { return liveUpdates_1.getProcessorLiveUpdateConfig; } });
|
|
40
|
+
Object.defineProperty(exports, "triggerAllSimulationUpdates", { enumerable: true, get: function () { return liveUpdates_1.triggerAllSimulationUpdates; } });
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Live updates configuration for simulation pages
|
|
3
|
+
* Encapsulates polling intervals and params for vehicle, booking, node, and processor updates
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Configuration for simulation live updates
|
|
7
|
+
*/
|
|
8
|
+
export interface SimulationLiveUpdatesConfig {
|
|
9
|
+
/**
|
|
10
|
+
* Simulation ID to poll updates for
|
|
11
|
+
*/
|
|
12
|
+
simulationId: number | string;
|
|
13
|
+
/**
|
|
14
|
+
* Whether live updates are enabled (typically disabled during initial loading)
|
|
15
|
+
*/
|
|
16
|
+
enabled: boolean;
|
|
17
|
+
/**
|
|
18
|
+
* Callback when any collection receives updates
|
|
19
|
+
*/
|
|
20
|
+
onUpdate?: (hasUpdates: boolean) => void;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Standard intervals for different collection types
|
|
24
|
+
*/
|
|
25
|
+
export declare const LIVE_UPDATE_INTERVALS: {
|
|
26
|
+
readonly VEHICLE: 5000;
|
|
27
|
+
readonly BOOKING: 5000;
|
|
28
|
+
readonly NODE: 5000;
|
|
29
|
+
readonly PROCESSOR: 3000;
|
|
30
|
+
};
|
|
31
|
+
/**
|
|
32
|
+
* Standard parameters for processor live updates
|
|
33
|
+
*/
|
|
34
|
+
export declare const PROCESSOR_LIVE_UPDATE_PARAMS: {
|
|
35
|
+
readonly processor_lifecycle_type: "one_shot";
|
|
36
|
+
readonly only_fields: "id,simulation_id,created_at,modified_at,start_time,state,processor_lifecycle_type,username";
|
|
37
|
+
readonly order_by: "-id";
|
|
38
|
+
readonly limit: 100;
|
|
39
|
+
};
|
|
40
|
+
/**
|
|
41
|
+
* Setup configuration for vehicle live updates
|
|
42
|
+
*/
|
|
43
|
+
export declare function getVehicleLiveUpdateConfig(config: SimulationLiveUpdatesConfig): {
|
|
44
|
+
enabled: boolean;
|
|
45
|
+
params: {
|
|
46
|
+
simulation_id: string | number;
|
|
47
|
+
};
|
|
48
|
+
interval: 5000;
|
|
49
|
+
onUpdate: ((hasUpdates: boolean) => void) | undefined;
|
|
50
|
+
};
|
|
51
|
+
/**
|
|
52
|
+
* Setup configuration for booking live updates
|
|
53
|
+
*/
|
|
54
|
+
export declare function getBookingLiveUpdateConfig(config: SimulationLiveUpdatesConfig): {
|
|
55
|
+
enabled: boolean;
|
|
56
|
+
params: {
|
|
57
|
+
simulation_id: string | number;
|
|
58
|
+
};
|
|
59
|
+
interval: 5000;
|
|
60
|
+
onUpdate: ((hasUpdates: boolean) => void) | undefined;
|
|
61
|
+
};
|
|
62
|
+
/**
|
|
63
|
+
* Setup configuration for node live updates
|
|
64
|
+
*/
|
|
65
|
+
export declare function getNodeLiveUpdateConfig(config: SimulationLiveUpdatesConfig): {
|
|
66
|
+
enabled: boolean;
|
|
67
|
+
params: {
|
|
68
|
+
simulation_id: string | number;
|
|
69
|
+
};
|
|
70
|
+
interval: 5000;
|
|
71
|
+
onUpdate: ((hasUpdates: boolean) => void) | undefined;
|
|
72
|
+
};
|
|
73
|
+
/**
|
|
74
|
+
* Setup configuration for processor live updates
|
|
75
|
+
*/
|
|
76
|
+
export declare function getProcessorLiveUpdateConfig(config: SimulationLiveUpdatesConfig): {
|
|
77
|
+
enabled: boolean;
|
|
78
|
+
params: {
|
|
79
|
+
processor_lifecycle_type: "one_shot";
|
|
80
|
+
only_fields: "id,simulation_id,created_at,modified_at,start_time,state,processor_lifecycle_type,username";
|
|
81
|
+
order_by: "-id";
|
|
82
|
+
limit: 100;
|
|
83
|
+
simulation_id: string | number;
|
|
84
|
+
};
|
|
85
|
+
interval: 3000;
|
|
86
|
+
onUpdate: ((hasUpdates: boolean) => void) | undefined;
|
|
87
|
+
};
|
|
88
|
+
/**
|
|
89
|
+
* Trigger functions for manual updates
|
|
90
|
+
*/
|
|
91
|
+
export interface SimulationLiveUpdateTriggers {
|
|
92
|
+
triggerVehicleUpdate?: () => Promise<void>;
|
|
93
|
+
triggerBookingUpdate?: () => Promise<void>;
|
|
94
|
+
triggerNodeUpdate?: () => Promise<void>;
|
|
95
|
+
triggerProcessorUpdate?: () => Promise<void>;
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Trigger all simulation live updates manually
|
|
99
|
+
* Useful after operations like autoplan, import, or bulk edits
|
|
100
|
+
*/
|
|
101
|
+
export declare function triggerAllSimulationUpdates(triggers: SimulationLiveUpdateTriggers): Promise<void>;
|
|
102
|
+
//# sourceMappingURL=liveUpdates.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"liveUpdates.d.ts","sourceRoot":"","sources":["../../../sgerplib/sgerp/simulation-logic/liveUpdates.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH;;GAEG;AACH,MAAM,WAAW,2BAA2B;IAC1C;;OAEG;IACH,YAAY,EAAE,MAAM,GAAG,MAAM,CAAC;IAC9B;;OAEG;IACH,OAAO,EAAE,OAAO,CAAC;IACjB;;OAEG;IACH,QAAQ,CAAC,EAAE,CAAC,UAAU,EAAE,OAAO,KAAK,IAAI,CAAC;CAC1C;AAED;;GAEG;AACH,eAAO,MAAM,qBAAqB;;;;;CAKxB,CAAC;AAEX;;GAEG;AACH,eAAO,MAAM,4BAA4B;;;;;CAK/B,CAAC;AAEX;;GAEG;AACH,wBAAgB,0BAA0B,CAAC,MAAM,EAAE,2BAA2B;;;;;;4BA1BpD,OAAO,KAAK,IAAI;EAiCzC;AAED;;GAEG;AACH,wBAAgB,0BAA0B,CAAC,MAAM,EAAE,2BAA2B;;;;;;4BAtCpD,OAAO,KAAK,IAAI;EA6CzC;AAED;;GAEG;AACH,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,2BAA2B;;;;;;4BAlDjD,OAAO,KAAK,IAAI;EAyDzC;AAED;;GAEG;AACH,wBAAgB,4BAA4B,CAAC,MAAM,EAAE,2BAA2B;;;;;;;;;;4BA9DtD,OAAO,KAAK,IAAI;EAwEzC;AAED;;GAEG;AACH,MAAM,WAAW,4BAA4B;IAC3C,oBAAoB,CAAC,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAC3C,oBAAoB,CAAC,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAC3C,iBAAiB,CAAC,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IACxC,sBAAsB,CAAC,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CAC9C;AAED;;;GAGG;AACH,wBAAsB,2BAA2B,CAAC,QAAQ,EAAE,4BAA4B,iBAOvF"}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Live updates configuration for simulation pages
|
|
4
|
+
* Encapsulates polling intervals and params for vehicle, booking, node, and processor updates
|
|
5
|
+
*/
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.PROCESSOR_LIVE_UPDATE_PARAMS = exports.LIVE_UPDATE_INTERVALS = void 0;
|
|
8
|
+
exports.getVehicleLiveUpdateConfig = getVehicleLiveUpdateConfig;
|
|
9
|
+
exports.getBookingLiveUpdateConfig = getBookingLiveUpdateConfig;
|
|
10
|
+
exports.getNodeLiveUpdateConfig = getNodeLiveUpdateConfig;
|
|
11
|
+
exports.getProcessorLiveUpdateConfig = getProcessorLiveUpdateConfig;
|
|
12
|
+
exports.triggerAllSimulationUpdates = triggerAllSimulationUpdates;
|
|
13
|
+
/**
|
|
14
|
+
* Standard intervals for different collection types
|
|
15
|
+
*/
|
|
16
|
+
exports.LIVE_UPDATE_INTERVALS = {
|
|
17
|
+
VEHICLE: 5000, // 5 seconds
|
|
18
|
+
BOOKING: 5000, // 5 seconds
|
|
19
|
+
NODE: 5000, // 5 seconds
|
|
20
|
+
PROCESSOR: 3000, // 3 seconds (more frequent to catch state changes quickly)
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
* Standard parameters for processor live updates
|
|
24
|
+
*/
|
|
25
|
+
exports.PROCESSOR_LIVE_UPDATE_PARAMS = {
|
|
26
|
+
processor_lifecycle_type: 'one_shot',
|
|
27
|
+
only_fields: 'id,simulation_id,created_at,modified_at,start_time,state,processor_lifecycle_type,username',
|
|
28
|
+
order_by: '-id',
|
|
29
|
+
limit: 100,
|
|
30
|
+
};
|
|
31
|
+
/**
|
|
32
|
+
* Setup configuration for vehicle live updates
|
|
33
|
+
*/
|
|
34
|
+
function getVehicleLiveUpdateConfig(config) {
|
|
35
|
+
return {
|
|
36
|
+
enabled: config.enabled,
|
|
37
|
+
params: { simulation_id: config.simulationId },
|
|
38
|
+
interval: exports.LIVE_UPDATE_INTERVALS.VEHICLE,
|
|
39
|
+
onUpdate: config.onUpdate,
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Setup configuration for booking live updates
|
|
44
|
+
*/
|
|
45
|
+
function getBookingLiveUpdateConfig(config) {
|
|
46
|
+
return {
|
|
47
|
+
enabled: config.enabled,
|
|
48
|
+
params: { simulation_id: config.simulationId },
|
|
49
|
+
interval: exports.LIVE_UPDATE_INTERVALS.BOOKING,
|
|
50
|
+
onUpdate: config.onUpdate,
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Setup configuration for node live updates
|
|
55
|
+
*/
|
|
56
|
+
function getNodeLiveUpdateConfig(config) {
|
|
57
|
+
return {
|
|
58
|
+
enabled: config.enabled,
|
|
59
|
+
params: { simulation_id: config.simulationId },
|
|
60
|
+
interval: exports.LIVE_UPDATE_INTERVALS.NODE,
|
|
61
|
+
onUpdate: config.onUpdate,
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Setup configuration for processor live updates
|
|
66
|
+
*/
|
|
67
|
+
function getProcessorLiveUpdateConfig(config) {
|
|
68
|
+
return {
|
|
69
|
+
enabled: config.enabled,
|
|
70
|
+
params: Object.assign({ simulation_id: config.simulationId }, exports.PROCESSOR_LIVE_UPDATE_PARAMS),
|
|
71
|
+
interval: exports.LIVE_UPDATE_INTERVALS.PROCESSOR,
|
|
72
|
+
onUpdate: config.onUpdate,
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Trigger all simulation live updates manually
|
|
77
|
+
* Useful after operations like autoplan, import, or bulk edits
|
|
78
|
+
*/
|
|
79
|
+
async function triggerAllSimulationUpdates(triggers) {
|
|
80
|
+
var _a, _b, _c, _d;
|
|
81
|
+
await Promise.all([
|
|
82
|
+
(_a = triggers.triggerVehicleUpdate) === null || _a === void 0 ? void 0 : _a.call(triggers),
|
|
83
|
+
(_b = triggers.triggerBookingUpdate) === null || _b === void 0 ? void 0 : _b.call(triggers),
|
|
84
|
+
(_c = triggers.triggerNodeUpdate) === null || _c === void 0 ? void 0 : _c.call(triggers),
|
|
85
|
+
(_d = triggers.triggerProcessorUpdate) === null || _d === void 0 ? void 0 : _d.call(triggers),
|
|
86
|
+
]);
|
|
87
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { SGERPClient } from '../client';
|
|
2
|
+
import type { Simulation } from '../types/simulation/simulation';
|
|
3
|
+
import type { Booking } from '../types/simulation/booking';
|
|
4
|
+
import type { Vehicle } from '../types/simulation/vehicle';
|
|
5
|
+
import type { Driver } from '../types/simulation/driver';
|
|
6
|
+
import type { Geofence } from '../types/simulation/geofence';
|
|
7
|
+
import type { RouteNode } from '../utils/routeUtils';
|
|
8
|
+
export interface SimulationDataResult {
|
|
9
|
+
vehicles: Vehicle[];
|
|
10
|
+
bookings: Booking[];
|
|
11
|
+
nodes: RouteNode[];
|
|
12
|
+
drivers: Driver[];
|
|
13
|
+
geofences: Geofence[];
|
|
14
|
+
mainGeofence: Geofence | null;
|
|
15
|
+
vehicleRoutes: Map<number, {
|
|
16
|
+
waypoints: any[];
|
|
17
|
+
polyline?: any;
|
|
18
|
+
}>;
|
|
19
|
+
vehicleData: Map<number, {
|
|
20
|
+
assigned_nodes: RouteNode[];
|
|
21
|
+
completed_nodes: RouteNode[];
|
|
22
|
+
assigned_booking_uids: Set<string>;
|
|
23
|
+
completed_booking_uids: Set<string>;
|
|
24
|
+
}>;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Prepare all simulation data: fetch, attach references, generate routes
|
|
28
|
+
* This is a comprehensive function that handles the entire data preparation pipeline
|
|
29
|
+
*
|
|
30
|
+
* @param api - SGERP client instance
|
|
31
|
+
* @param simulationId - Simulation ID to fetch data for
|
|
32
|
+
* @param simulation - Optional simulation object (for fetching main geofence)
|
|
33
|
+
* @returns Complete simulation data with references attached and routes generated
|
|
34
|
+
*/
|
|
35
|
+
export declare function prepareSimulationData(api: SGERPClient, simulationId: number | string, simulation?: Simulation | null): Promise<SimulationDataResult>;
|
|
36
|
+
//# sourceMappingURL=prepareSimulationData.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prepareSimulationData.d.ts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G,IAAW,GACnC,OAAO,CAAC,oBAAoB,CAAC,CAyB/B"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.prepareSimulationData = prepareSimulationData;
|
|
4
|
+
const fetchUtils_1 = require("./fetchUtils");
|
|
5
|
+
const referenceUtils_1 = require("./referenceUtils");
|
|
6
|
+
const routeUtils_1 = require("../utils/routeUtils");
|
|
7
|
+
/**
|
|
8
|
+
* Prepare all simulation data: fetch, attach references, generate routes
|
|
9
|
+
* This is a comprehensive function that handles the entire data preparation pipeline
|
|
10
|
+
*
|
|
11
|
+
* @param api - SGERP client instance
|
|
12
|
+
* @param simulationId - Simulation ID to fetch data for
|
|
13
|
+
* @param simulation - Optional simulation object (for fetching main geofence)
|
|
14
|
+
* @returns Complete simulation data with references attached and routes generated
|
|
15
|
+
*/
|
|
16
|
+
async function prepareSimulationData(api, simulationId, simulation = null) {
|
|
17
|
+
// Step 1: Fetch all data
|
|
18
|
+
const { vehicles, bookings, nodes, drivers, geofences, mainGeofence } = await (0, fetchUtils_1.fetchSimulationData)(api, simulationId, simulation);
|
|
19
|
+
// Step 2: Attach references between models
|
|
20
|
+
const { vehicleData } = (0, referenceUtils_1.attachReferences)(bookings, vehicles, nodes);
|
|
21
|
+
// Step 3: Generate vehicle routes from nodes
|
|
22
|
+
const vehicleIds = vehicles.map(v => v.id);
|
|
23
|
+
const vehicleRoutes = (0, routeUtils_1.createVehicleRoutesFromNodes)(nodes, vehicleIds);
|
|
24
|
+
return {
|
|
25
|
+
vehicles,
|
|
26
|
+
bookings,
|
|
27
|
+
nodes: nodes,
|
|
28
|
+
drivers,
|
|
29
|
+
geofences,
|
|
30
|
+
mainGeofence,
|
|
31
|
+
vehicleRoutes,
|
|
32
|
+
vehicleData
|
|
33
|
+
};
|
|
34
|
+
}
|