sgerp-frontend-lib 0.1.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/README.md +70 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +8 -0
- package/dist/locales/locale_en.d.ts +2 -0
- package/dist/locales/locale_en.d.ts.map +1 -0
- package/dist/locales/locale_en.js +1933 -0
- package/dist/locales/locale_ja.d.ts +2 -0
- package/dist/locales/locale_ja.d.ts.map +1 -0
- package/dist/locales/locale_ja.js +1926 -0
- package/dist/locales/locale_ms.d.ts +2 -0
- package/dist/locales/locale_ms.d.ts.map +1 -0
- package/dist/locales/locale_ms.js +1916 -0
- package/dist/sgerp/client.d.ts +236 -0
- package/dist/sgerp/client.d.ts.map +1 -0
- package/dist/sgerp/collections/simulation/node.d.ts +11 -0
- package/dist/sgerp/collections/simulation/node.d.ts.map +1 -0
- package/dist/sgerp/collections/simulation/vehicle.d.ts +11 -0
- package/dist/sgerp/collections/simulation/vehicle.d.ts.map +1 -0
- package/dist/sgerp/context/sgerp-context.d.ts +54 -0
- package/dist/sgerp/context/sgerp-context.d.ts.map +1 -0
- package/dist/sgerp/hooks/use-collection.d.ts +83 -0
- package/dist/sgerp/hooks/use-collection.d.ts.map +1 -0
- package/dist/sgerp/hooks/use-live-updates.d.ts +35 -0
- package/dist/sgerp/hooks/use-live-updates.d.ts.map +1 -0
- package/dist/sgerp/hooks/use-live-updates.js +95 -0
- package/dist/sgerp/index.d.ts +90 -0
- package/dist/sgerp/index.d.ts.map +1 -0
- package/dist/sgerp/simulation-logic/fetchUtils.d.ts +69 -0
- package/dist/sgerp/simulation-logic/fetchUtils.d.ts.map +1 -0
- package/dist/sgerp/simulation-logic/index.d.ts +14 -0
- package/dist/sgerp/simulation-logic/index.d.ts.map +1 -0
- package/dist/sgerp/simulation-logic/index.js +11 -0
- package/dist/sgerp/simulation-logic/manualEditUtils.d.ts +70 -0
- package/dist/sgerp/simulation-logic/manualEditUtils.d.ts.map +1 -0
- package/dist/sgerp/simulation-logic/mapUtils.d.ts +11 -0
- package/dist/sgerp/simulation-logic/mapUtils.d.ts.map +1 -0
- package/dist/sgerp/simulation-logic/optimisticUpdateUtils.d.ts +28 -0
- package/dist/sgerp/simulation-logic/optimisticUpdateUtils.d.ts.map +1 -0
- package/dist/sgerp/simulation-logic/optimisticUpdateUtils.js +37 -0
- package/dist/sgerp/simulation-logic/referenceUtils.d.ts +28 -0
- package/dist/sgerp/simulation-logic/referenceUtils.d.ts.map +1 -0
- package/dist/sgerp/simulation-logic/routeCalculationUtils.d.ts +12 -0
- package/dist/sgerp/simulation-logic/routeCalculationUtils.d.ts.map +1 -0
- package/dist/sgerp/simulation-logic/timeShiftUtils.d.ts +27 -0
- package/dist/sgerp/simulation-logic/timeShiftUtils.d.ts.map +1 -0
- package/dist/sgerp/types/simulation/node.d.ts +102 -0
- package/dist/sgerp/types/simulation/node.d.ts.map +1 -0
- package/dist/sgerp/types/simulation/node.js +11 -0
- package/dist/sgerp/types/simulation/vehicle.d.ts +88 -0
- package/dist/sgerp/types/simulation/vehicle.d.ts.map +1 -0
- package/dist/sgerp/types/simulation/vehicle.js +1 -0
- package/dist/sgerp/utils/routeUtils.d.ts +47 -0
- package/dist/sgerp/utils/routeUtils.d.ts.map +1 -0
- package/package.json +126 -0
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
export { initializeSGERP, SGERPClient } from './client';
|
|
2
|
+
export type { ModelTypeMap } from './client';
|
|
3
|
+
export { APIClient, APIError } from './api/client';
|
|
4
|
+
export type { APIResponse } from './api/client';
|
|
5
|
+
export { Collection } from './collection';
|
|
6
|
+
export { ProjectCollection } from './collections/sharing/project';
|
|
7
|
+
export { ProjectMemberCollection } from './collections/sharing/project-member';
|
|
8
|
+
export { OrganizationCollection } from './collections/sharing/organization';
|
|
9
|
+
export { OrganizationProjectCollection } from './collections/sharing/organization-project';
|
|
10
|
+
export { PricingCollection } from './collections/sharing/pricing';
|
|
11
|
+
export { PassengerCollection } from './collections/transportation/passenger';
|
|
12
|
+
export { TicketCollection } from './collections/transportation/ticket';
|
|
13
|
+
export { TransactionCollection } from './collections/transportation/transaction';
|
|
14
|
+
export { UserCollection } from './collections/account/user';
|
|
15
|
+
export { SimulationCollection } from './collections/simulation/simulation';
|
|
16
|
+
export { DriverCollection } from './collections/simulation/driver';
|
|
17
|
+
export { VehicleCollection } from './collections/simulation/vehicle';
|
|
18
|
+
export { VehicleTypeCollection } from './collections/simulation/vehicletype';
|
|
19
|
+
export { BookingCollection } from './collections/simulation/booking';
|
|
20
|
+
export { NodeCollection } from './collections/simulation/node';
|
|
21
|
+
export { DatasetCollection } from './collections/simulation/dataset';
|
|
22
|
+
export { SimulationProcessorCollection } from './collections/simulation/simulationprocessor';
|
|
23
|
+
export { OperationsLocationCollection } from './collections/simulation/operationslocation';
|
|
24
|
+
export { OperationsLocationGroupCollection } from './collections/simulation/operationslocationgroup';
|
|
25
|
+
export { RoutingProfileCollection } from './collections/simulation/routingprofile';
|
|
26
|
+
export { GeofenceCollection } from './collections/simulation/geofence';
|
|
27
|
+
export { MapboxTokenCollection } from './collections/simulation/mapboxtoken';
|
|
28
|
+
export { SMSScheduledCollection } from './collections/sms_notify/smsscheduled';
|
|
29
|
+
export { TransitStopCollection } from './collections/masstransit/transitstop';
|
|
30
|
+
export { BuildingCollection } from './collections/masstransit/building';
|
|
31
|
+
export { TransitStopSetCollection } from './collections/masstransit/transitstopset';
|
|
32
|
+
export { useCollection, useSGERP } from './hooks/use-collection';
|
|
33
|
+
export { useLiveUpdates } from './hooks/use-live-updates';
|
|
34
|
+
export { SGERPProvider, useSGERPContext } from './context/sgerp-context';
|
|
35
|
+
export type { SGERPProviderProps } from './context/sgerp-context';
|
|
36
|
+
export * from './constants/scheduling-enums';
|
|
37
|
+
export * from './constants/messages-enums';
|
|
38
|
+
export * from './constants/simulation-enums';
|
|
39
|
+
export * from './constants/bulkoperations-enums';
|
|
40
|
+
export { getEnumOptions, getEnumLabel, getEnumValues, isValidEnumValue, } from './utils/enum-helpers';
|
|
41
|
+
export type { Environment, Connection, SGERPConfig, RequestConfig, } from './types/config';
|
|
42
|
+
export type { User, SGERPMeta, SGERPListResponse, } from './types/account/user';
|
|
43
|
+
export type { Project, } from './types/sharing/project';
|
|
44
|
+
export type { ProjectMember, } from './types/sharing/project-member';
|
|
45
|
+
export type { Organization, } from './types/sharing/organization';
|
|
46
|
+
export type { OrganizationProject, } from './types/sharing/organization-project';
|
|
47
|
+
export type { Pricing, PricingExtension, PricingDemandAdditionalPrice, PricingRule, PricingRules, PricingRoundingStrategy, PricingTerms, PricingTicketItem, PricingTicketSection, PricingDiscount, PricingPaymentMethod, PricingOptions, } from './types/sharing/pricing';
|
|
48
|
+
export type { Passenger, } from './types/transportation/passenger';
|
|
49
|
+
export { PassengerGender } from './types/transportation/passenger';
|
|
50
|
+
export type { Ticket, } from './types/transportation/ticket';
|
|
51
|
+
export type { Transaction, } from './types/transportation/transaction';
|
|
52
|
+
export { TransactionStatus, TransactionType, TransactionProvider, TransactionCurrency, } from './types/transportation/transaction';
|
|
53
|
+
export type { Driver, } from './types/simulation/driver';
|
|
54
|
+
export type { Simulation, } from './types/simulation/simulation';
|
|
55
|
+
export type { Vehicle, } from './types/simulation/vehicle';
|
|
56
|
+
export type { VehicleType, } from './types/simulation/vehicletype';
|
|
57
|
+
export type { Booking, } from './types/simulation/booking';
|
|
58
|
+
export { BookingState } from './types/simulation/booking';
|
|
59
|
+
export type { Node, } from './types/simulation/node';
|
|
60
|
+
export { NodeType } from './types/simulation/node';
|
|
61
|
+
export type { Dataset, } from './types/simulation/dataset';
|
|
62
|
+
export type { SimulationProcessor, } from './types/simulation/simulationprocessor';
|
|
63
|
+
export type { OperationsLocation, } from './types/simulation/operationslocation';
|
|
64
|
+
export type { OperationsLocationGroup, } from './types/simulation/operationslocationgroup';
|
|
65
|
+
export type { TransitStop, } from './types/masstransit/transitstop';
|
|
66
|
+
export type { RoutingProfile, } from './types/simulation/routingprofile';
|
|
67
|
+
export { RoutingEngineName, getRoutingEngineLabel } from './types/simulation/routingprofile';
|
|
68
|
+
export type { Geofence, } from './types/simulation/geofence';
|
|
69
|
+
export type { MapboxToken, } from './types/simulation/mapboxtoken';
|
|
70
|
+
export type { RoutingEngineSettings, } from './types/simulation/routing-engine-settings';
|
|
71
|
+
export { routingProfileToEngineSettings, } from './types/simulation/routing-engine-settings';
|
|
72
|
+
export type { CalculationParams, } from './types/simulation/calculation-params';
|
|
73
|
+
export type { VehicleUploadModel, VehicleUploadPayload, VehicleUploadResult, VehicleUploadResultVehicle, VehicleUploadCreatedNode, VehicleUploadOverlap, VehiclesInvalidUploadInfo, BulkTaskMessage, BulkTaskPayloadType, BulkTaskResultType, } from './types/bulkoperations';
|
|
74
|
+
export { VehicleStatus, VehicleUseOption, VehicleExportAttemptStatus, createVehicleUploadTask, } from './types/bulkoperations';
|
|
75
|
+
export type { VehicleStatusValue, VehicleUseOptionValue, VehicleExportAttemptStatusValue, } from './types/bulkoperations';
|
|
76
|
+
export type { SMSScheduled, MessageDeliveryType, RecipientType, NotificationStatus, TemplateType, } from './types/sms_notify/smsscheduled';
|
|
77
|
+
export type { Building, Point, Polygon, } from './types/masstransit/building';
|
|
78
|
+
export type { TransitStopSet, } from './types/masstransit/transitstopset';
|
|
79
|
+
export type { GeoJSONGeometryType, GeoJSONPoint, GeoJSONLineString, GeoJSONPolygon, GeoJSONMultiPoint, GeoJSONMultiLineString, GeoJSONMultiPolygon, GeoJSONGeometry, GeoJSONFeature, GeoJSONFeatureCollection, ToGeoJSONFeature, } from './types/geojson';
|
|
80
|
+
export type { MapLayerConfig, MapStateConfig, } from './types/map';
|
|
81
|
+
export { OperationsLocationMapState, OperationsLocationByProjectMapState, } from './map-states/operations-location-state';
|
|
82
|
+
export { RoutingEngine, Step, Leg, Route, airLeg, } from './routing';
|
|
83
|
+
export { getHSLToRGB, getColorFromAgentId, normalizeVehicleColor, getContrastTextColor, } from './utils/color';
|
|
84
|
+
export { generateWaypointRouteFromNodes, createVehicleRoutesFromNodes } from './utils/routeUtils';
|
|
85
|
+
export type { RouteNode, Waypoint as RouteWaypoint, VehicleRouteData as RouteVehicleRouteData } from './utils/routeUtils';
|
|
86
|
+
export { localize, getLocale, setLocale } from '../locales/locale';
|
|
87
|
+
export type { Language } from '../locales/locale';
|
|
88
|
+
export { useLocalization } from '../locales/useLocalization';
|
|
89
|
+
export { ConnectionManager } from '../connection-manager';
|
|
90
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +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,qBAAqB,EAAE,MAAM,0CAA0C,CAAC;AACjF,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAC5D,OAAO,EAAE,oBAAo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GACR,MAAM,8BAA8B,CAAC;AAEtC,YAAY,EACV,cAAc,GACf,MAAM,oCAAoC,CAAC;AAG5C,YAAY,EACV,mBAAmB,EACnB,YAAY,EACZ,iBAAiB,EACjB,cAAc,EACd,iBAAiB,EACjB,sBAAsB,EACtB,mBAAmB,EACnB,eAAe,EACf,cAAc,EACd,wBAAwB,EACxB,gBAAgB,GACjB,MAAM,iBAAiB,CAAC;AAGzB,YAAY,EACV,cAAc,EACd,cAAc,GACf,MAAM,aAAa,CAAC;AAGrB,OAAO,EACL,0BAA0B,EAC1B,mCAAmC,GACpC,MAAM,wCAAwC,CAAC;AAGhD,OAAO,EACL,aAAa,EACb,IAAI,EACJ,GAAG,EACH,KAAK,EACL,MAAM,GACP,MAAM,WAAW,CAAC;AAGnB,OAAO,EACL,WAAW,EACX,mBAAmB,EACnB,qBAAqB,EACrB,oBAAoB,GACrB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,8BAA8B,EAAE,4BAA4B,EAAE,MAAM,oBAAoB,CAAC;AAClG,YAAY,EAAE,SAAS,EAAE,QAAQ,IAAI,aAAa,EAAE,gBAAgB,IAAI,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAG1H,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AACnE,YAAY,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAG7D,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC"}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import type { SGERPClient } from '@/sgerplib/sgerp/client';
|
|
2
|
+
import type { Simulation } from '@/sgerplib/sgerp/types/simulation/simulation';
|
|
3
|
+
import type { Booking } from '@/sgerplib/sgerp/types/simulation/booking';
|
|
4
|
+
import type { Vehicle } from '@/sgerplib/sgerp/types/simulation/vehicle';
|
|
5
|
+
import type { Driver } from '@/sgerplib/sgerp/types/simulation/driver';
|
|
6
|
+
import type { Node } from '@/sgerplib/sgerp/types/simulation/node';
|
|
7
|
+
import type { Geofence } from '@/sgerplib/sgerp/types/simulation/geofence';
|
|
8
|
+
import type { OperationsLocation } from '@/sgerplib/sgerp/types/simulation/operationslocation';
|
|
9
|
+
/**
|
|
10
|
+
* Fetch vehicles for a simulation
|
|
11
|
+
* Uses fetchAll() to get all vehicles regardless of count
|
|
12
|
+
*/
|
|
13
|
+
export declare function fetchVehicles(api: SGERPClient, simulationId: number | string): Promise<Vehicle[]>;
|
|
14
|
+
/**
|
|
15
|
+
* Fetch bookings for a simulation using the microservices API
|
|
16
|
+
* Based on dashviewer approach: model=booking&booking_type=customer&simulation_id__in=...
|
|
17
|
+
* Uses fetchAll() to get all bookings regardless of count
|
|
18
|
+
*/
|
|
19
|
+
export declare function fetchBookings(api: SGERPClient, simulationId: number | string): Promise<Booking[]>;
|
|
20
|
+
/**
|
|
21
|
+
* Fetch nodes for a simulation
|
|
22
|
+
* Uses fetchAll() to get all nodes regardless of count
|
|
23
|
+
*/
|
|
24
|
+
export declare function fetchNodes(api: SGERPClient, simulationId: number | string): Promise<Node[]>;
|
|
25
|
+
/**
|
|
26
|
+
* Fetch drivers for vehicles from legacy Tastypie API
|
|
27
|
+
* Extracts driver_id values from vehicles and fetches them using id__in
|
|
28
|
+
* Uses legacy API because it includes username field
|
|
29
|
+
* Uses a separate collection context to avoid interfering with main drivers page
|
|
30
|
+
*/
|
|
31
|
+
export declare function fetchDrivers(api: SGERPClient, vehicles: Vehicle[]): Promise<Driver[]>;
|
|
32
|
+
/**
|
|
33
|
+
* Fetch all drivers for a project from microservices GET API
|
|
34
|
+
* Used for driver assignment page where we need all available drivers
|
|
35
|
+
* Uses first_name and id fields for display
|
|
36
|
+
* Uses a separate collection context to avoid interfering with main drivers page
|
|
37
|
+
*/
|
|
38
|
+
export declare function fetchDriversByProject(api: SGERPClient, projectId: number | string): Promise<Driver[]>;
|
|
39
|
+
/**
|
|
40
|
+
* Fetch operations locations (depots) for a project from microservices GET API
|
|
41
|
+
* Used for driver assignment page to show depot locations where buses can go (e.g., for lunch breaks)
|
|
42
|
+
* Uses a separate collection context to avoid interfering with main operations locations page
|
|
43
|
+
*/
|
|
44
|
+
export declare function fetchOperationsLocationsByProject(api: SGERPClient, projectId: number | string): Promise<OperationsLocation[]>;
|
|
45
|
+
/**
|
|
46
|
+
* Fetch geofences for vehicles and simulation
|
|
47
|
+
* Extracts geofence_ids from vehicles and geofences_zones from simulation
|
|
48
|
+
* Merges both sets and fetches all unique geofences
|
|
49
|
+
* Uses a separate collection context to avoid interfering with main geofences page
|
|
50
|
+
*/
|
|
51
|
+
export declare function fetchGeofences(api: SGERPClient, vehicles: Vehicle[], simulationId?: number | string): Promise<Geofence[]>;
|
|
52
|
+
/**
|
|
53
|
+
* Fetch main geofence for simulation
|
|
54
|
+
* Fetches the simulation's main geofence_id (UUID) using id filter
|
|
55
|
+
* Uses a separate collection context to avoid interfering with main geofences page
|
|
56
|
+
*/
|
|
57
|
+
export declare function fetchSimulationGeofence(api: SGERPClient, simulation: Simulation | null): Promise<Geofence | null>;
|
|
58
|
+
/**
|
|
59
|
+
* Fetch all data needed for simulation page
|
|
60
|
+
*/
|
|
61
|
+
export declare function fetchSimulationData(api: SGERPClient, simulationId: number | string, simulation?: Simulation | null): Promise<{
|
|
62
|
+
vehicles: Vehicle[];
|
|
63
|
+
bookings: Booking[];
|
|
64
|
+
nodes: Node[];
|
|
65
|
+
drivers: Driver[];
|
|
66
|
+
geofences: Geofence[];
|
|
67
|
+
mainGeofence: Geofence | null;
|
|
68
|
+
}>;
|
|
69
|
+
//# sourceMappingURL=fetchUtils.d.ts.map
|
|
@@ -0,0 +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,yBAA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CAAC,CAW/B;AAgCD;;;;;GAKG;AACH,wBAAsB,cAAc,CAClC,GAAG,EAAE,WAAW,EAChB,QAAQ,EAAE,OAAO,EAAE,EACnB,YAAY,CAAC,EAAE,MAAM,GAAG,MAAM,GAC7B,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;;;;;;;GAwBrC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Simulation page logic utilities
|
|
3
|
+
* Inspired by dashviewer's SimulationPage/logic structure
|
|
4
|
+
*/
|
|
5
|
+
export { fetchVehicles, fetchBookings, fetchNodes, fetchDrivers, fetchDriversByProject, fetchOperationsLocationsByProject, fetchSimulationData } from './fetchUtils';
|
|
6
|
+
export { createIndexMaps, attachReferences } from './referenceUtils';
|
|
7
|
+
export { calculateBoundingBoxCenter } from './mapUtils';
|
|
8
|
+
export { vehicleComplexRearrange, buildVehicleRouteMap } from './manualEditUtils';
|
|
9
|
+
export type { VehicleComplexRearrangeRequest, ManualEditResponse, ManualEditError, VehicleRouteMap } from './manualEditUtils';
|
|
10
|
+
export { shiftNodeTimestamps, shiftWaypointTimestamps } from './timeShiftUtils';
|
|
11
|
+
export { calculateVehicleRoute, hasRouteChanged } from './routeCalculationUtils';
|
|
12
|
+
export { processUnassignResponse } from './optimisticUpdateUtils';
|
|
13
|
+
export type { UnassignResponse, ProcessUnassignResult } from './optimisticUpdateUtils';
|
|
14
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +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,EAChB,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EACL,uBAAuB,EACxB,MAAM,yBAAyB,CAAC;AAEjC,YAAY,EACV,gBAAgB,EAChB,qBAAqB,EACtB,MAAM,yBAAyB,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Simulation page logic utilities
|
|
3
|
+
* Inspired by dashviewer's SimulationPage/logic structure
|
|
4
|
+
*/
|
|
5
|
+
export { fetchVehicles, fetchBookings, fetchNodes, fetchDrivers, fetchDriversByProject, fetchOperationsLocationsByProject, fetchSimulationData } from './fetchUtils';
|
|
6
|
+
export { createIndexMaps, attachReferences } from './referenceUtils';
|
|
7
|
+
export { calculateBoundingBoxCenter } from './mapUtils';
|
|
8
|
+
export { vehicleComplexRearrange, buildVehicleRouteMap } from './manualEditUtils';
|
|
9
|
+
export { shiftNodeTimestamps, shiftWaypointTimestamps } from './timeShiftUtils';
|
|
10
|
+
export { calculateVehicleRoute, hasRouteChanged } from './routeCalculationUtils';
|
|
11
|
+
export { processUnassignResponse } from './optimisticUpdateUtils';
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import type { Node } from '@/sgerplib/sgerp/types/simulation/node';
|
|
2
|
+
/**
|
|
3
|
+
* Manual Edit API request for vehicle_complex_rearrange action
|
|
4
|
+
*/
|
|
5
|
+
export interface VehicleComplexRearrangeRequest {
|
|
6
|
+
simulation_id: number | string;
|
|
7
|
+
current_time?: string;
|
|
8
|
+
dry_run?: boolean;
|
|
9
|
+
notify_assignment?: boolean;
|
|
10
|
+
action: {
|
|
11
|
+
action_type: 'vehicle_complex_rearrange';
|
|
12
|
+
vehicle_route_map: Record<string, {
|
|
13
|
+
route: string[];
|
|
14
|
+
}>;
|
|
15
|
+
strict_time_windows?: boolean;
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Manual Edit API response
|
|
20
|
+
*/
|
|
21
|
+
export interface ManualEditResponse {
|
|
22
|
+
simulation_id: number | string;
|
|
23
|
+
current_time: string;
|
|
24
|
+
committed: boolean;
|
|
25
|
+
feasible: boolean;
|
|
26
|
+
changed_nodes_uids: string[];
|
|
27
|
+
changed_bookings_uids: string[];
|
|
28
|
+
changed_vehicles_uids: string[];
|
|
29
|
+
deleted_nodes_uids?: string[];
|
|
30
|
+
deleted_vehicles_uids?: string[];
|
|
31
|
+
details?: Record<string, unknown>;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Manual Edit API error response
|
|
35
|
+
*/
|
|
36
|
+
export interface ManualEditError {
|
|
37
|
+
error: string;
|
|
38
|
+
error_code: string;
|
|
39
|
+
context: Record<string, unknown>;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Vehicle route map for complex rearrange
|
|
43
|
+
*/
|
|
44
|
+
export interface VehicleRouteMap {
|
|
45
|
+
[vehicleAgentId: string]: {
|
|
46
|
+
route: string[];
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Call the Manual Edit API to rearrange vehicle routes
|
|
51
|
+
*
|
|
52
|
+
* @param simulationId - The simulation ID
|
|
53
|
+
* @param vehicleRouteMap - Map of vehicle agent_id to array of node UIDs
|
|
54
|
+
* @param options - Optional settings
|
|
55
|
+
* @returns Promise with the API response
|
|
56
|
+
*/
|
|
57
|
+
export declare function vehicleComplexRearrange(simulationId: number | string, vehicleRouteMap: VehicleRouteMap, options?: {
|
|
58
|
+
dryRun?: boolean;
|
|
59
|
+
notifyAssignment?: boolean;
|
|
60
|
+
strictTimeWindows?: boolean;
|
|
61
|
+
currentTime?: string;
|
|
62
|
+
}): Promise<ManualEditResponse>;
|
|
63
|
+
/**
|
|
64
|
+
* Build a vehicle route map from nodes grouped by vehicle
|
|
65
|
+
*
|
|
66
|
+
* @param nodesByVehicle - Map of vehicle agent_id to array of nodes
|
|
67
|
+
* @returns Vehicle route map for Manual Edit API
|
|
68
|
+
*/
|
|
69
|
+
export declare function buildVehicleRouteMap(nodesByVehicle: Map<string, Node[]>): VehicleRouteMap;
|
|
70
|
+
//# sourceMappingURL=manualEditUtils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"manualEditUtils.d.ts","sourceRoot":"","sources":["../../../sgerplib/sgerp/simulation-logic/manualEditUtils.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,wCAAwC,CAAC;AAEnE;;GAEG;AACH,MAAM,WAAW,8BAA8B;IAC7C,aAAa,EAAE,MAAM,GAAG,MAAM,CAAC;IAC/B,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,MAAM,EAAE;QACN,WAAW,EAAE,2BAA2B,CAAC;QACzC,iBAAiB,EAAE,MAAM,CAAC,MAAM,EAAE;YAAE,KAAK,EAAE,MAAM,EAAE,CAAA;SAAE,CAAC,CAAC;QACvD,mBAAmB,CAA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@@
|
|
|
1
|
+
import type { Vehicle } from '../types/simulation/vehicle';
|
|
2
|
+
import type { Booking } from '../types/simulation/booking';
|
|
3
|
+
/**
|
|
4
|
+
* Calculate bounding box center from vehicles and bookings
|
|
5
|
+
* Filters out invalid coordinates (0,0) and calculates the average center point
|
|
6
|
+
*/
|
|
7
|
+
export declare function calculateBoundingBoxCenter(vehicles: Vehicle[], bookings: Booking[]): {
|
|
8
|
+
center: [number, number] | null;
|
|
9
|
+
zoom: number;
|
|
10
|
+
};
|
|
11
|
+
//# sourceMappingURL=mapUtils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mapUtils.d.ts","sourceRoot":"","sources":["../../../sgerplib/sgerp/simulation-logic/mapUtils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,6BAA6B,CAAC;AAC3D,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,6BAA6B,CAAC;AAE3D;;;GAGG;AACH,wBAAgB,0BAA0B,CACxC,QAAQ,EAAE,OAAO,EAAE,EACnB,QAAQ,EAAE,OAAO,EAAE,GAClB;IAAE,MAAM,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,IAAI,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAqDnD"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Optimistic update utilities for simulation data
|
|
3
|
+
* Apply client-side updates based on API responses before refetching
|
|
4
|
+
*/
|
|
5
|
+
import type { Node } from '../types/simulation/node';
|
|
6
|
+
import type { Booking } from '../types/simulation/booking';
|
|
7
|
+
import type { Vehicle } from '../types/simulation/vehicle';
|
|
8
|
+
export interface UnassignResponse {
|
|
9
|
+
changed_nodes_uids?: string[];
|
|
10
|
+
changed_bookings_uids?: string[];
|
|
11
|
+
changed_vehicles_uids?: string[];
|
|
12
|
+
}
|
|
13
|
+
export interface ProcessUnassignResult {
|
|
14
|
+
updatedNodes: Node[];
|
|
15
|
+
updatedBookings: Booking[];
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Process unassign response and update nodes/bookings optimistically
|
|
19
|
+
* Applies all necessary transformations in the correct sequence
|
|
20
|
+
*
|
|
21
|
+
* @param nodes - Current nodes
|
|
22
|
+
* @param bookings - Current bookings
|
|
23
|
+
* @param vehicles - Current vehicles (for reference attachment)
|
|
24
|
+
* @param response - API response containing changed UIDs
|
|
25
|
+
* @returns Updated nodes and bookings with references attached
|
|
26
|
+
*/
|
|
27
|
+
export declare function processUnassignResponse(nodes: Node[], bookings: Booking[], vehicles: Vehicle[], response: UnassignResponse): ProcessUnassignResult;
|
|
28
|
+
//# sourceMappingURL=optimisticUpdateUtils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"optimisticUpdateUtils.d.ts","sourceRoot":"","sources":["../../../sgerplib/sgerp/simulation-logic/optimisticUpdateUtils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,0BAA0B,CAAC;AACrD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,6BAA6B,CAAC;AAC3D,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,6BAA6B,CAAC;AAI3D,MAAM,WAAW,gBAAgB;IAC/B,kBAAkB,CAAC,EAAE,MAAM,EAAE,CAAC;IAC9B,qBAAqB,CAAC,EAAE,MAAM,EAAE,CAAC;IACjC,qBAAqB,CAAC,EAAE,MAAM,EAAE,CAAC;CAClC;AAED,MAAM,WAAW,qBAAqB;IACpC,YAAY,EAAE,IAAI,EAAE,CAAC;IACrB,eAAe,EAAE,OAAO,EAAE,CAAC;CAC5B;AAED;;;;;;;;;GASG;AACH,wBAAgB,uBAAuB,CACrC,KAAK,EAAE,IAAI,EAAE,EACb,QAAQ,EAAE,OAAO,EAAE,EACnB,QAAQ,EAAE,OAAO,EAAE,EACnB,QAAQ,EAAE,gBAAgB,GACzB,qBAAqB,CAgCvB"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Optimistic update utilities for simulation data
|
|
3
|
+
* Apply client-side updates based on API responses before refetching
|
|
4
|
+
*/
|
|
5
|
+
import { BookingState } from '../types/simulation/booking';
|
|
6
|
+
import { attachReferences } from './referenceUtils';
|
|
7
|
+
/**
|
|
8
|
+
* Process unassign response and update nodes/bookings optimistically
|
|
9
|
+
* Applies all necessary transformations in the correct sequence
|
|
10
|
+
*
|
|
11
|
+
* @param nodes - Current nodes
|
|
12
|
+
* @param bookings - Current bookings
|
|
13
|
+
* @param vehicles - Current vehicles (for reference attachment)
|
|
14
|
+
* @param response - API response containing changed UIDs
|
|
15
|
+
* @returns Updated nodes and bookings with references attached
|
|
16
|
+
*/
|
|
17
|
+
export function processUnassignResponse(nodes, bookings, vehicles, response) {
|
|
18
|
+
const changedNodeUids = new Set(response.changed_nodes_uids || []);
|
|
19
|
+
const changedBookingUids = new Set(response.changed_bookings_uids || []);
|
|
20
|
+
// Step 1: Update nodes - set status to 'new', clear assigned_vehicle_id and scheduled_ts
|
|
21
|
+
const updatedNodes = nodes.map(node => {
|
|
22
|
+
if (changedNodeUids.has(node.uid)) {
|
|
23
|
+
return Object.assign(Object.assign({}, node), { status: 'new', assigned_vehicle_id: null, scheduled_ts: null });
|
|
24
|
+
}
|
|
25
|
+
return node;
|
|
26
|
+
});
|
|
27
|
+
// Step 2: Update bookings - set state to 'prepared'
|
|
28
|
+
const updatedBookings = bookings.map(booking => {
|
|
29
|
+
if (changedBookingUids.has(booking.uid)) {
|
|
30
|
+
return Object.assign(Object.assign({}, booking), { state: BookingState.PREPARED });
|
|
31
|
+
}
|
|
32
|
+
return booking;
|
|
33
|
+
});
|
|
34
|
+
// Step 3: Re-attach references between models
|
|
35
|
+
attachReferences(updatedBookings, vehicles, updatedNodes);
|
|
36
|
+
return { updatedNodes, updatedBookings };
|
|
37
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { Booking } from '@/sgerplib/sgerp/types/simulation/booking';
|
|
2
|
+
import type { Vehicle } from '@/sgerplib/sgerp/types/simulation/vehicle';
|
|
3
|
+
import type { RouteNode } from '@/sgerplib/sgerp/utils/routeUtils';
|
|
4
|
+
/**
|
|
5
|
+
* Create index maps for fast lookups
|
|
6
|
+
* Similar to dashviewer's stateIndex
|
|
7
|
+
*/
|
|
8
|
+
export declare function createIndexMaps(bookings: Booking[], vehicles: Vehicle[], nodes: RouteNode[]): {
|
|
9
|
+
bookingMap: Map<number, Booking>;
|
|
10
|
+
vehicleMap: Map<number, Vehicle>;
|
|
11
|
+
nodeMap: Map<number, import("..").Node>;
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* Attach references between models
|
|
15
|
+
* Adapted from dashviewer's attachReferences function
|
|
16
|
+
*/
|
|
17
|
+
export declare function attachReferences(bookings: Booking[], vehicles: Vehicle[], nodes: RouteNode[]): {
|
|
18
|
+
bookingMap: Map<number, Booking>;
|
|
19
|
+
vehicleMap: Map<number, Vehicle>;
|
|
20
|
+
nodeMap: Map<number, import("..").Node>;
|
|
21
|
+
vehicleData: Map<number, {
|
|
22
|
+
assigned_nodes: RouteNode[];
|
|
23
|
+
completed_nodes: RouteNode[];
|
|
24
|
+
assigned_booking_uids: Set<string>;
|
|
25
|
+
completed_booking_uids: Set<string>;
|
|
26
|
+
}>;
|
|
27
|
+
};
|
|
28
|
+
//# sourceMappingURL=referenceUtils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"referenceUtils.d.ts","sourceRoot":"","sources":["../../../sgerplib/sgerp/simulation-logic/referenceUtils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,2CAA2C,CAAC;AACzE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,2CAA2C,CAAC;AACzE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mCAAmC,CAAC;AAEnE;;;GAGG;AACH,wBAAgB,eAAe,CAC7B,QAAQ,EAAE,OAAO,EAAE,EACnB,QAAQ,EAAE,OAAO,EAAE,EACnB,KAAK,EAAE,SAAS,EAAE;;;;EAuBnB;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAC9B,QAAQ,EAAE,OAAO,EAAE,EACnB,QAAQ,EAAE,OAAO,EAAE,EACnB,KAAK,EAAE,SAAS,EAAE;;;;;wBAYA,SAAS,EAAE;yBACV,SAAS,EAAE;+BACL,GAAG,CAAC,MAAM,CAAC;gCACV,GAAG,CAAC,MAAM,CAAC;;EA0EtC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { Vehicle } from '@/sgerplib/sgerp/types/simulation/vehicle';
|
|
2
|
+
import type { RouteNode } from '@/sgerplib/sgerp/utils/routeUtils';
|
|
3
|
+
import { Route } from '@/sgerplib/sgerp/routing';
|
|
4
|
+
/**
|
|
5
|
+
* Calculate OSRM route for a vehicle based on its assigned nodes
|
|
6
|
+
*/
|
|
7
|
+
export declare function calculateVehicleRoute(vehicle: Vehicle, sortedNodes: RouteNode[], defaultBackend: string): Promise<Route | null>;
|
|
8
|
+
/**
|
|
9
|
+
* Check if a vehicle's route has changed by comparing node IDs
|
|
10
|
+
*/
|
|
11
|
+
export declare function hasRouteChanged(existingNodes: RouteNode[] | undefined, newNodes: RouteNode[]): boolean;
|
|
12
|
+
//# sourceMappingURL=routeCalculationUtils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"routeCalculationUtils.d.ts","sourceRoot":"","sources":["../../../sgerplib/sgerp/simulation-logic/routeCalculationUtils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,2CAA2C,CAAC;AACzE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mCAAmC,CAAC;AACnE,OAAO,EAAiB,KAAK,EAAE,MAAM,0BAA0B,CAAC;AAEhE;;GAEG;AACH,wBAAsB,qBAAqB,CACzC,OAAO,EAAE,OAAO,EAChB,WAAW,EAAE,SAAS,EAAE,EACxB,cAAc,EAAE,MAAM,GACrB,OAAO,CAAC,KAAK,GAAG,IAAI,CAAC,CAuCvB;AAED;;GAEG;AACH,wBAAgB,eAAe,CAC7B,aAAa,EAAE,SAAS,EAAE,GAAG,SAAS,EACtC,QAAQ,EAAE,SAAS,EAAE,GACpB,OAAO,CAIT"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { Node } from '@/sgerplib/sgerp/types/simulation/node';
|
|
2
|
+
/**
|
|
3
|
+
* Shift all node scheduled timestamps by a time difference
|
|
4
|
+
* Note: open_time_ts and close_time_ts are NOT shifted as they represent
|
|
5
|
+
* fixed booking time window constraints, not planned arrival times
|
|
6
|
+
*
|
|
7
|
+
* @param nodes - Array of nodes to shift
|
|
8
|
+
* @param oldStartTime - Original start time (ISO string)
|
|
9
|
+
* @param newStartTime - New start time (ISO string)
|
|
10
|
+
* @returns New array of nodes with shifted scheduled_ts only
|
|
11
|
+
*/
|
|
12
|
+
export declare function shiftNodeTimestamps(nodes: Node[], oldStartTime: string, newStartTime: string): Node[];
|
|
13
|
+
/**
|
|
14
|
+
* Shift waypoint node timestamps
|
|
15
|
+
* This is a helper for RouteDetailsTable waypoints structure
|
|
16
|
+
* Note: open_time_ts and close_time_ts are NOT shifted as they represent
|
|
17
|
+
* fixed booking time window constraints, not planned arrival times
|
|
18
|
+
*
|
|
19
|
+
* @param waypoints - Array of waypoints with nested nodes
|
|
20
|
+
* @param oldStartTime - Original start time (ISO string)
|
|
21
|
+
* @param newStartTime - New start time (ISO string)
|
|
22
|
+
* @returns New array of waypoints with shifted scheduled_ts only
|
|
23
|
+
*/
|
|
24
|
+
export declare function shiftWaypointTimestamps<T extends {
|
|
25
|
+
nodes: Node[];
|
|
26
|
+
}>(waypoints: T[], oldStartTime: string, newStartTime: string): T[];
|
|
27
|
+
//# sourceMappingURL=timeShiftUtils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"timeShiftUtils.d.ts","sourceRoot":"","sources":["../../../sgerplib/sgerp/simulation-logic/timeShiftUtils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,wCAAwC,CAAC;AAmBnE;;;;;;;;;GASG;AACH,wBAAgB,mBAAmB,CACjC,KAAK,EAAE,IAAI,EAAE,EACb,YAAY,EAAE,MAAM,EACpB,YAAY,EAAE,MAAM,GACnB,IAAI,EAAE,CAaR;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,uBAAuB,CAAC,CAAC,SAAS;IAAE,KAAK,EAAE,IAAI,EAAE,CAAA;CAAE,EACjE,SAAS,EAAE,CAAC,EAAE,EACd,YAAY,EAAE,MAAM,EACpB,YAAY,EAAE,MAAM,GACnB,CAAC,EAAE,CAgBL"}
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Node type enum
|
|
3
|
+
*/
|
|
4
|
+
export declare enum NodeType {
|
|
5
|
+
PICKUP = "pickup",
|
|
6
|
+
DROPOFF = "dropoff",
|
|
7
|
+
POINT = "point",
|
|
8
|
+
VEHICLE_POSITION = "vehicle_position",
|
|
9
|
+
DEPOT = "depot"
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Node model from simulation app
|
|
13
|
+
*/
|
|
14
|
+
export interface Node {
|
|
15
|
+
id: number;
|
|
16
|
+
h3: string;
|
|
17
|
+
lat: number;
|
|
18
|
+
lon: number;
|
|
19
|
+
created_at: string;
|
|
20
|
+
modified_at: string;
|
|
21
|
+
uid: string;
|
|
22
|
+
booking_uid: string;
|
|
23
|
+
booking_group_uid: string;
|
|
24
|
+
booking_shipment_external_id: string | null;
|
|
25
|
+
data?: {
|
|
26
|
+
username?: string;
|
|
27
|
+
phone?: string;
|
|
28
|
+
} & Record<string, unknown>;
|
|
29
|
+
assigned_vehicle_id: number | null;
|
|
30
|
+
customer_id: string | null;
|
|
31
|
+
passenger_count: number;
|
|
32
|
+
node_type: string;
|
|
33
|
+
display_name: string;
|
|
34
|
+
location_name: string;
|
|
35
|
+
location_code: string;
|
|
36
|
+
estimated_arrival_time: string | null;
|
|
37
|
+
booking_id: number;
|
|
38
|
+
simulation_id: number;
|
|
39
|
+
project_id: number;
|
|
40
|
+
demand: Record<string, number>;
|
|
41
|
+
external_id: string | null;
|
|
42
|
+
open_time_ts: string;
|
|
43
|
+
open_time_ts_dynamic: string | null;
|
|
44
|
+
close_time_ts: string;
|
|
45
|
+
close_time_ts_dynamic: string;
|
|
46
|
+
service_time: number;
|
|
47
|
+
status: string;
|
|
48
|
+
assignment_order: number;
|
|
49
|
+
scheduled_ts: string | null;
|
|
50
|
+
arrived_to_location_ts: string | null;
|
|
51
|
+
visited_at_ts: string | null;
|
|
52
|
+
departed_at_ts: string | null;
|
|
53
|
+
started_service_at_ts: string | null;
|
|
54
|
+
completed_service_at: string | null;
|
|
55
|
+
ready_to_board_at: string | null;
|
|
56
|
+
walking_time_to_node: number;
|
|
57
|
+
walking_distance_to_node: number;
|
|
58
|
+
min_trip_duration: number | null;
|
|
59
|
+
max_trip_duration: number;
|
|
60
|
+
initial_max_trip_duration: number | null;
|
|
61
|
+
initial_open_time_ts: string | null;
|
|
62
|
+
initial_close_time_ts: string | null;
|
|
63
|
+
initial_close_time_ts_dynamic: string | null;
|
|
64
|
+
fixed_route_wait_time: number | null;
|
|
65
|
+
fixed_route_walk_time: number | null;
|
|
66
|
+
fixed_route_ride_time: number | null;
|
|
67
|
+
fixed_route_journey_time: number | null;
|
|
68
|
+
fixed_route_is_unreachable: boolean;
|
|
69
|
+
cancelled_at_ts: string | null;
|
|
70
|
+
penalty: number;
|
|
71
|
+
lifo_order_check: boolean;
|
|
72
|
+
lifo_order_penalty: number | null;
|
|
73
|
+
groups: unknown[];
|
|
74
|
+
geofence_id: number | null;
|
|
75
|
+
geofence_ids: number[];
|
|
76
|
+
transit_stop_id: number | null;
|
|
77
|
+
weight: number | null;
|
|
78
|
+
trip_cost: number;
|
|
79
|
+
transfer_type: string;
|
|
80
|
+
processing_order_timestamp: string | null;
|
|
81
|
+
max_slack: number | null;
|
|
82
|
+
slack: number;
|
|
83
|
+
partial_route_index: number | null;
|
|
84
|
+
allow_jump: boolean;
|
|
85
|
+
finalization_type: string;
|
|
86
|
+
matrix_timestamp: string | null;
|
|
87
|
+
estimated_earliest_arrival_ts: string | null;
|
|
88
|
+
estimated_scheduled_ts: string | null;
|
|
89
|
+
vehicle_characteristics: Record<string, unknown>;
|
|
90
|
+
failed_to_deliver_at_ts: string | null;
|
|
91
|
+
end_of_trip: unknown;
|
|
92
|
+
user_accepted_offer_at: string | null;
|
|
93
|
+
offer_should_be_auto_accepted: unknown;
|
|
94
|
+
vehicle_labels: Record<string, unknown>;
|
|
95
|
+
time_windows: unknown;
|
|
96
|
+
dynamic_break: unknown;
|
|
97
|
+
operations_location_id: number | null;
|
|
98
|
+
is_invalidated: unknown;
|
|
99
|
+
booking_failed_to_pay_at: string | null;
|
|
100
|
+
break_info: unknown;
|
|
101
|
+
}
|
|
102
|
+
//# sourceMappingURL=node.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"node.d.ts","sourceRoot":"","sources":["../../../../sgerplib/sgerp/types/simulation/node.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,oBAAY,QAAQ;IAClB,MAAM,WAAW;IACjB,OAAO,YAAY;IACnB,KAAK,UAAU;IACf,gBAAgB,qBAAqB;IACrC,KAAK,UAAU;CAChB;AAED;;GAEG;AACH,MAAM,WAAW,IAAI;IACnB,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;IACX,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;IACZ,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,GAAG,EAAE,MAAM,CAAC;IACZ,WAAW,EAAE,MAAM,CAAC;IACpB,i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AA6B,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7C,sBAAsB,EAAE,MAAM,GAAG,IAAI,CAAC;IACtC,uBAAuB,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACjD,uBAAuB,EAAE,MAAM,GAAG,IAAI,CAAC;IACvC,WAAW,EAAE,OAAO,CAAC;IACrB,sBAAsB,EAAE,MAAM,GAAG,IAAI,CAAC;IACtC,6BAA6B,EAAE,OAAO,CAAC;IACvC,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACxC,YAAY,EAAE,OAAO,CAAC;IACtB,aAAa,EAAE,OAAO,CAAC;IACvB,sBAAsB,EAAE,MAAM,GAAG,IAAI,CAAC;IACtC,cAAc,EAAE,OAAO,CAAC;IACxB,wBAAwB,EAAE,MAAM,GAAG,IAAI,CAAC;IACxC,UAAU,EAAE,OAAO,CAAC;CACrB"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Node type enum
|
|
3
|
+
*/
|
|
4
|
+
export var NodeType;
|
|
5
|
+
(function (NodeType) {
|
|
6
|
+
NodeType["PICKUP"] = "pickup";
|
|
7
|
+
NodeType["DROPOFF"] = "dropoff";
|
|
8
|
+
NodeType["POINT"] = "point";
|
|
9
|
+
NodeType["VEHICLE_POSITION"] = "vehicle_position";
|
|
10
|
+
NodeType["DEPOT"] = "depot";
|
|
11
|
+
})(NodeType || (NodeType = {}));
|