@dapex-tech/elite-online-services 0.0.24 → 0.0.26

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.
@@ -7,4 +7,6 @@ export type DriverStatusResponseDto = {
7
7
  isOnline?: boolean;
8
8
  waitingTripIds?: Array<number>;
9
9
  activeTripId?: number;
10
+ onlineTimeoutWarningFirstSent?: boolean;
11
+ onlineTimeoutWarningSecondSent?: boolean;
10
12
  };
@@ -1,3 +1,4 @@
1
+ import type { TripStatuses } from './TripStatuses';
1
2
  export type TripLocationPointDto = {
2
3
  /**
3
4
  * Location point ID
@@ -18,7 +19,7 @@ export type TripLocationPointDto = {
18
19
  /**
19
20
  * Status
20
21
  */
21
- status?: Record<string, any> | null;
22
+ status?: TripStatuses | null;
22
23
  /**
23
24
  * Created at timestamp
24
25
  */
@@ -8,7 +8,7 @@ export declare enum TripStatuses {
8
8
  DRIVER_AT_PICKUP = "DRIVER_AT_PICKUP",
9
9
  IN_PROGRESS = "IN_PROGRESS",
10
10
  PAUSED = "PAUSED",
11
- PAUSED_TRAFFIC = "PAUSED_TRAFFIC",
11
+ TRAFFIC_DELAY = "TRAFFIC_DELAY",
12
12
  COMPLETED = "COMPLETED",
13
13
  CANCELED_PASSENGER = "CANCELED_PASSENGER",
14
14
  CANCELED_DRIVER = "CANCELED_DRIVER",
@@ -16,7 +16,7 @@ var TripStatuses;
16
16
  TripStatuses["DRIVER_AT_PICKUP"] = "DRIVER_AT_PICKUP";
17
17
  TripStatuses["IN_PROGRESS"] = "IN_PROGRESS";
18
18
  TripStatuses["PAUSED"] = "PAUSED";
19
- TripStatuses["PAUSED_TRAFFIC"] = "PAUSED_TRAFFIC";
19
+ TripStatuses["TRAFFIC_DELAY"] = "TRAFFIC_DELAY";
20
20
  TripStatuses["COMPLETED"] = "COMPLETED";
21
21
  TripStatuses["CANCELED_PASSENGER"] = "CANCELED_PASSENGER";
22
22
  TripStatuses["CANCELED_DRIVER"] = "CANCELED_DRIVER";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dapex-tech/elite-online-services",
3
- "version": "0.0.24",
3
+ "version": "0.0.26",
4
4
  "main": "./index.js",
5
5
  "types": "./index.d.ts",
6
6
  "private": false,
@@ -14,7 +14,7 @@ export declare class AdminTripsService {
14
14
  * @param page Page number
15
15
  * @param pageSize Items per page
16
16
  * @param q Text to search for in trip fields
17
- * @param status Comma-separated trip status values. Valid values: SCHEDULED, REQUESTED, DRIVER_SEARCHING, DRIVER_ASSIGNED, DRIVER_ASSIGNED_PENDING, DRIVER_ONWAY, DRIVER_AT_PICKUP, IN_PROGRESS, PAUSED, PAUSED_TRAFFIC, COMPLETED, CANCELED_PASSENGER, CANCELED_DRIVER, CANCELED_ADMIN.
17
+ * @param status Comma-separated trip status values. Valid values: SCHEDULED, REQUESTED, DRIVER_SEARCHING, DRIVER_ASSIGNED, DRIVER_ASSIGNED_PENDING, DRIVER_ONWAY, DRIVER_AT_PICKUP, IN_PROGRESS, PAUSED, TRAFFIC_DELAY, COMPLETED, CANCELED_PASSENGER, CANCELED_DRIVER, CANCELED_ADMIN.
18
18
  * @param order Sorting options
19
19
  * @param customerId Filter by customer ID (scope to customer)
20
20
  * @param driverId Filter by driver ID (scope to driver)
@@ -9,7 +9,7 @@ class AdminTripsService {
9
9
  * @param page Page number
10
10
  * @param pageSize Items per page
11
11
  * @param q Text to search for in trip fields
12
- * @param status Comma-separated trip status values. Valid values: SCHEDULED, REQUESTED, DRIVER_SEARCHING, DRIVER_ASSIGNED, DRIVER_ASSIGNED_PENDING, DRIVER_ONWAY, DRIVER_AT_PICKUP, IN_PROGRESS, PAUSED, PAUSED_TRAFFIC, COMPLETED, CANCELED_PASSENGER, CANCELED_DRIVER, CANCELED_ADMIN.
12
+ * @param status Comma-separated trip status values. Valid values: SCHEDULED, REQUESTED, DRIVER_SEARCHING, DRIVER_ASSIGNED, DRIVER_ASSIGNED_PENDING, DRIVER_ONWAY, DRIVER_AT_PICKUP, IN_PROGRESS, PAUSED, TRAFFIC_DELAY, COMPLETED, CANCELED_PASSENGER, CANCELED_DRIVER, CANCELED_ADMIN.
13
13
  * @param order Sorting options
14
14
  * @param customerId Filter by customer ID (scope to customer)
15
15
  * @param driverId Filter by driver ID (scope to driver)
@@ -20,7 +20,7 @@ export declare class CustomerTripsService {
20
20
  * @param page Page number
21
21
  * @param pageSize Items per page
22
22
  * @param q Text to search for in trip fields
23
- * @param status Comma-separated trip status values. Valid values: SCHEDULED, REQUESTED, DRIVER_SEARCHING, DRIVER_ASSIGNED, DRIVER_ASSIGNED_PENDING, DRIVER_ONWAY, DRIVER_AT_PICKUP, IN_PROGRESS, PAUSED, PAUSED_TRAFFIC, COMPLETED, CANCELED_PASSENGER, CANCELED_DRIVER, CANCELED_ADMIN.
23
+ * @param status Comma-separated trip status values. Valid values: SCHEDULED, REQUESTED, DRIVER_SEARCHING, DRIVER_ASSIGNED, DRIVER_ASSIGNED_PENDING, DRIVER_ONWAY, DRIVER_AT_PICKUP, IN_PROGRESS, PAUSED, TRAFFIC_DELAY, COMPLETED, CANCELED_PASSENGER, CANCELED_DRIVER, CANCELED_ADMIN.
24
24
  * @param order Sorting options
25
25
  * @param customerId Filter by customer ID (scope to customer)
26
26
  * @param driverId Filter by driver ID (scope to driver)
@@ -23,7 +23,7 @@ class CustomerTripsService {
23
23
  * @param page Page number
24
24
  * @param pageSize Items per page
25
25
  * @param q Text to search for in trip fields
26
- * @param status Comma-separated trip status values. Valid values: SCHEDULED, REQUESTED, DRIVER_SEARCHING, DRIVER_ASSIGNED, DRIVER_ASSIGNED_PENDING, DRIVER_ONWAY, DRIVER_AT_PICKUP, IN_PROGRESS, PAUSED, PAUSED_TRAFFIC, COMPLETED, CANCELED_PASSENGER, CANCELED_DRIVER, CANCELED_ADMIN.
26
+ * @param status Comma-separated trip status values. Valid values: SCHEDULED, REQUESTED, DRIVER_SEARCHING, DRIVER_ASSIGNED, DRIVER_ASSIGNED_PENDING, DRIVER_ONWAY, DRIVER_AT_PICKUP, IN_PROGRESS, PAUSED, TRAFFIC_DELAY, COMPLETED, CANCELED_PASSENGER, CANCELED_DRIVER, CANCELED_ADMIN.
27
27
  * @param order Sorting options
28
28
  * @param customerId Filter by customer ID (scope to customer)
29
29
  * @param driverId Filter by driver ID (scope to driver)
@@ -21,7 +21,7 @@ export declare class DriverTripsService {
21
21
  * @param page Page number
22
22
  * @param pageSize Items per page
23
23
  * @param q Text to search for in trip fields
24
- * @param status Comma-separated trip status values. Valid values: SCHEDULED, REQUESTED, DRIVER_SEARCHING, DRIVER_ASSIGNED, DRIVER_ASSIGNED_PENDING, DRIVER_ONWAY, DRIVER_AT_PICKUP, IN_PROGRESS, PAUSED, PAUSED_TRAFFIC, COMPLETED, CANCELED_PASSENGER, CANCELED_DRIVER, CANCELED_ADMIN.
24
+ * @param status Comma-separated trip status values. Valid values: SCHEDULED, REQUESTED, DRIVER_SEARCHING, DRIVER_ASSIGNED, DRIVER_ASSIGNED_PENDING, DRIVER_ONWAY, DRIVER_AT_PICKUP, IN_PROGRESS, PAUSED, TRAFFIC_DELAY, COMPLETED, CANCELED_PASSENGER, CANCELED_DRIVER, CANCELED_ADMIN.
25
25
  * @param order Sorting options
26
26
  * @param customerId Filter by customer ID (scope to customer)
27
27
  * @param driverId Filter by driver ID (scope to driver)
@@ -23,7 +23,7 @@ class DriverTripsService {
23
23
  * @param page Page number
24
24
  * @param pageSize Items per page
25
25
  * @param q Text to search for in trip fields
26
- * @param status Comma-separated trip status values. Valid values: SCHEDULED, REQUESTED, DRIVER_SEARCHING, DRIVER_ASSIGNED, DRIVER_ASSIGNED_PENDING, DRIVER_ONWAY, DRIVER_AT_PICKUP, IN_PROGRESS, PAUSED, PAUSED_TRAFFIC, COMPLETED, CANCELED_PASSENGER, CANCELED_DRIVER, CANCELED_ADMIN.
26
+ * @param status Comma-separated trip status values. Valid values: SCHEDULED, REQUESTED, DRIVER_SEARCHING, DRIVER_ASSIGNED, DRIVER_ASSIGNED_PENDING, DRIVER_ONWAY, DRIVER_AT_PICKUP, IN_PROGRESS, PAUSED, TRAFFIC_DELAY, COMPLETED, CANCELED_PASSENGER, CANCELED_DRIVER, CANCELED_ADMIN.
27
27
  * @param order Sorting options
28
28
  * @param customerId Filter by customer ID (scope to customer)
29
29
  * @param driverId Filter by driver ID (scope to driver)
@@ -13,6 +13,7 @@ export declare class SocketService {
13
13
  connect(): void;
14
14
  disconnect(): void;
15
15
  isConnected(): boolean;
16
+ isActive(): boolean;
16
17
  on<T = any>(event: string, cb: (data: T) => void): void;
17
18
  off(event: string, cb?: (...args: any[]) => void): void;
18
19
  emit<T = any>(event: string, data: T): void;
package/socketService.js CHANGED
@@ -57,8 +57,10 @@ class SocketService {
57
57
  this.token = token;
58
58
  this.socket.auth = { token };
59
59
  if (this.socket.connected) {
60
- this.socket.disconnect().connect();
60
+ this.socket.disconnect();
61
61
  }
62
+ if (!this.isActive())
63
+ this.socket.connect();
62
64
  }
63
65
  clearToken() {
64
66
  this.token = undefined;
@@ -76,6 +78,9 @@ class SocketService {
76
78
  isConnected() {
77
79
  return this.socket.connected;
78
80
  }
81
+ isActive() {
82
+ return this.socket.connected && this.socket.active;
83
+ }
79
84
  on(event, cb) {
80
85
  this.socket.on(event, cb);
81
86
  }
@@ -7,5 +7,9 @@ export interface DriverStatus {
7
7
  isOnline?: boolean;
8
8
  waitingTripIds?: number[];
9
9
  activeTripId?: number;
10
+ /** Set by scheduler after first stale-heartbeat warning; cleared on heartbeat. */
11
+ onlineTimeoutWarningFirstSent?: boolean;
12
+ /** Set by scheduler after second stale-heartbeat warning; cleared on heartbeat. */
13
+ onlineTimeoutWarningSecondSent?: boolean;
10
14
  }
11
15
  export declare function isValidDriverStatus(driverStatus: DriverStatus): boolean;