@vulog/aima-event 1.2.45 → 1.2.47
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/README.md +117 -206
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -1,215 +1,126 @@
|
|
|
1
|
-
# @vulog/aima-
|
|
1
|
+
# @vulog/aima-event
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
Event tracking — query fleet events by type, trip, or time range.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```sh
|
|
8
|
+
npm install @vulog/aima-event @vulog/aima-client @vulog/aima-core
|
|
5
9
|
```
|
|
6
10
|
|
|
7
|
-
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
```ts
|
|
8
14
|
import { getClient } from '@vulog/aima-client';
|
|
9
|
-
import {
|
|
15
|
+
import { getEventsByType, getEvents, getEventsByTripId } from '@vulog/aima-event';
|
|
16
|
+
|
|
17
|
+
const client = getClient({ /* client options */ });
|
|
18
|
+
|
|
19
|
+
const events = await getEventsByType(client, 'TRIP_START');
|
|
20
|
+
const allEvents = await getEvents(client, { page: 0, size: 50 });
|
|
21
|
+
const tripEvents = await getEventsByTripId(client, 'trip-uuid');
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## API Reference
|
|
25
|
+
|
|
26
|
+
### getEventsByType
|
|
27
|
+
|
|
28
|
+
```ts
|
|
29
|
+
getEventsByType(
|
|
30
|
+
client: Client,
|
|
31
|
+
type: EventType,
|
|
32
|
+
options?: PaginableOptions<EventFilters, 'date'>
|
|
33
|
+
): Promise<PaginableResponse<Event>>
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
Returns events of the given type for the fleet. Default time window: last 2 months to now.
|
|
37
|
+
|
|
38
|
+
**Params:** `client` — Authenticated AIMA client; `type` — event type to filter on; `options` — optional pagination and date filters
|
|
39
|
+
**Returns:** `Promise<PaginableResponse<Event>>`
|
|
40
|
+
|
|
41
|
+
---
|
|
42
|
+
|
|
43
|
+
### getEvents
|
|
44
|
+
|
|
45
|
+
```ts
|
|
46
|
+
getEvents(
|
|
47
|
+
client: Client,
|
|
48
|
+
options?: PaginableOptions<EventFilters, 'date'>
|
|
49
|
+
): Promise<PaginableResponse<Event>>
|
|
50
|
+
```
|
|
10
51
|
|
|
11
|
-
|
|
12
|
-
apiKey: '...',
|
|
13
|
-
baseUrl: '...',
|
|
14
|
-
clientId: '...',
|
|
15
|
-
clientSecret: '...',
|
|
16
|
-
fleetId: '...',
|
|
17
|
-
});
|
|
52
|
+
Returns events of all types for the fleet. Default time window: last 2 months to now.
|
|
18
53
|
|
|
19
|
-
|
|
54
|
+
**Params:** `client` — Authenticated AIMA client; `options` — optional pagination and date filters
|
|
55
|
+
**Returns:** `Promise<PaginableResponse<Event>>`
|
|
20
56
|
|
|
57
|
+
---
|
|
58
|
+
|
|
59
|
+
### getEventsByTripId
|
|
60
|
+
|
|
61
|
+
```ts
|
|
62
|
+
getEventsByTripId(
|
|
63
|
+
client: Client,
|
|
64
|
+
tripId: string,
|
|
65
|
+
options?: PaginableOptions<EventFilters & { type?: EventType[] }, 'date'>
|
|
66
|
+
): Promise<PaginableResponse<Event>>
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
Returns events for a specific trip, optionally filtered by event type.
|
|
70
|
+
|
|
71
|
+
**Params:** `client` — Authenticated AIMA client; `tripId` — trip identifier; `options` — optional pagination, date filters, and type filter
|
|
72
|
+
**Returns:** `Promise<PaginableResponse<Event>>`
|
|
73
|
+
|
|
74
|
+
## Types
|
|
75
|
+
|
|
76
|
+
### EventFilters
|
|
77
|
+
|
|
78
|
+
```ts
|
|
79
|
+
interface EventFilters {
|
|
80
|
+
startDate?: string; // format: yyyy-MM-dd'T'HH:mm:ssZ
|
|
81
|
+
endDate?: string; // format: yyyy-MM-dd'T'HH:mm:ssZ
|
|
82
|
+
}
|
|
21
83
|
```
|
|
22
84
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
|
50
|
-
|
|
|
51
|
-
|
|
|
52
|
-
|
|
|
53
|
-
|
|
|
54
|
-
|
|
|
55
|
-
|
|
|
56
|
-
|
|
|
57
|
-
|
|
|
58
|
-
|
|
|
59
|
-
|
|
|
60
|
-
|
|
|
61
|
-
|
|
|
62
|
-
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
| VEHICLE_OUT_OF_SERVICE | Vehicle marked out of service |
|
|
66
|
-
| VEHICLE_SCHEDULED_OUT_OF_SERVICE | Vehicle scheduled out of service |
|
|
67
|
-
| VEHICLE_SCHEDULED_OUT_OF_SERVICE_CANCELED | Scheduled out of service canceled |
|
|
68
|
-
| VEHICLE_UNLOCK | Vehicle unlocked (API or BOX) |
|
|
69
|
-
| VEHICLE_LOCK | Vehicle locked (API or BOX) |
|
|
70
|
-
| VEHICLE_BATTERY_LOCK | Battery lock locked (micromobility) |
|
|
71
|
-
| VEHICLE_BATTERY_UNLOCK | Battery lock unlocked (micromobility) |
|
|
72
|
-
| VEHICLE_HELMET_LOCK | Helmet lock locked (micromobility) |
|
|
73
|
-
| VEHICLE_HELMET_UNLOCK | Helmet lock unlocked (micromobility) |
|
|
74
|
-
| VEHICLE_SPARE_LOCK | Spare/cable lock locked (micromobility) |
|
|
75
|
-
| VEHICLE_SPARE_UNLOCK | Spare/cable lock unlocked (micromobility) |
|
|
76
|
-
| VEHICLE_PILE_LOCK | Pile lock locked (micromobility) |
|
|
77
|
-
| VEHICLE_PILE_UNLOCK | Pile lock unlocked (micromobility) |
|
|
78
|
-
| VEHICLE_SPEED_LIMIT_CHANGED | Max speed setting changed |
|
|
79
|
-
| VEHICLE_WAKE_UP | Vehicle wake up (API or BOX) |
|
|
80
|
-
| VEHICLE_WAKE_UP_ACCEL | Vehicle awake by shock |
|
|
81
|
-
| VEHICLE_WAKE_UP_BLE | Vehicle awake by BLE command |
|
|
82
|
-
| VEHICLE_CONNECTIVITY_ONLINE | Vehicle awake and connected |
|
|
83
|
-
| VEHICLE_CONNECTIVITY_OFFLINE | Vehicle goes to sleep |
|
|
84
|
-
| VEHICLE_CONNECTIVITY_INTERRUPTED | Vehicle connectivity interrupted |
|
|
85
|
-
| VEHICLE_OUT_OF_COM | Vehicle connectivity lost |
|
|
86
|
-
| VEHICLE_BOOKING_STATUS_CHANGED | Booking request status changed |
|
|
87
|
-
| VEHICLE_GET_STATUS | Get status requested on vehicle |
|
|
88
|
-
| VEHICLE_SCHEDULED_REBOOT | Box rebooted after scheduled request |
|
|
89
|
-
| VEHICLE_WARNING | Warning raised by vehicle |
|
|
90
|
-
| VEHICLE_CRUISING_RANGE_LOW | Cruising range low |
|
|
91
|
-
| VEHICLE_CRUISING_RANGE_CRITICAL | Cruising range critical |
|
|
92
|
-
| VEHICLE_ACCEL_ALERT | Vehicle has fallen |
|
|
93
|
-
| VEHICLE_SPEED_ALERT | Vehicle speed above limit |
|
|
94
|
-
| VEHICLE_CKH_UPDATE | Key/card inserted/removed in holder |
|
|
95
|
-
| VEHICLE_RECOVERY | Recovery process initiated by box |
|
|
96
|
-
| VEHICLE_STANDBY | Vehicle in standby (see offline) |
|
|
97
|
-
| VEHICLE_AUTOCLOSE_ON | Auto close enabled |
|
|
98
|
-
| VEHICLE_AUTOCLOSE_OFF | Auto close disabled |
|
|
99
|
-
| VEHICLE_IGNITION_ON | Engine on |
|
|
100
|
-
| VEHICLE_IGNITION_OFF | Engine off |
|
|
101
|
-
| VEHICLE_REBOOT | Box rebooted |
|
|
102
|
-
| VEHICLE_MOBILIZE | Immobilizer disengaged |
|
|
103
|
-
| VEHICLE_IMMOBILIZE | Immobilizer engaged |
|
|
104
|
-
| VEHICLE_IMMOBILIZER_OOT | Immobilizer engaged out of trip |
|
|
105
|
-
| VEHICLE_ENABLE | Vehicle back in service |
|
|
106
|
-
| VEHICLE_MAGIC_CARD | Magic badge used on vehicle |
|
|
107
|
-
| VEHICLE_CLEANLINESS_RESET | Cleanliness countdown reset |
|
|
108
|
-
| VEHICLE_ADD_ZONE | Zone manually assigned to vehicle |
|
|
109
|
-
| VEHICLE_REMOVE_ZONE | Zone manually removed from vehicle |
|
|
110
|
-
| VEHICLE_RELEASE_TRIP | Trip released by operator |
|
|
111
|
-
| VEHICLE_START_TRIP | Trip started (API or BOX) |
|
|
112
|
-
| VEHICLE_END_TRIP | Trip ended (API or BOX) |
|
|
113
|
-
| VEHICLE_EDIT_TRIP | Trip modified |
|
|
114
|
-
| VEHICLE_MANUAL_END_TRIP | Trip manually ended (not implemented) |
|
|
115
|
-
| VEHICLE_TRACKING_ON | Location tracking enabled for trip |
|
|
116
|
-
| VEHICLE_TRACKING_OFF | Location tracking disabled for trip |
|
|
117
|
-
| VEHICLE_TRIP_TERMINATION | Trip ended by operator override |
|
|
118
|
-
| VEHICLE_PAUSE_TRIP | Trip paused (API or BOX) |
|
|
119
|
-
| VEHICLE_FORCED_PAUSE_TRIP | Trip paused due to inactivity |
|
|
120
|
-
| VEHICLE_RESUME_TRIP | Trip resumed (API or BOX) |
|
|
121
|
-
| VEHICLE_EXPERT | Expert command request on vehicle |
|
|
122
|
-
| VEHICLE_PASSTHROUGH | Deprecated passthrough event |
|
|
123
|
-
| VEHICLE_PING | Ping command to check box connectivity |
|
|
124
|
-
| VEHICLE_CANCEL_TRIP | Trip canceled |
|
|
125
|
-
| VEHICLE_REMOVE_PRODUCT_TRIP | Trip-related product removed |
|
|
126
|
-
| VEHICLE_BOOK | Beginning of trip |
|
|
127
|
-
| VEHICLE_ADD_PRODUCT_TRIP | Trip-related product added |
|
|
128
|
-
| VEHICLE_UPDATE_REASON | Out of service reason updated |
|
|
129
|
-
| VEHICLE_RESET_CLEAN_DATE | Cleanliness date reset |
|
|
130
|
-
| VEHICLE_RESET_REDISTRIB_DATE | Redistribution date reset |
|
|
131
|
-
| VEHICLE_RESET_MOVING_DATE | Moving date reset |
|
|
132
|
-
| VEHICLE_RESET_BOOKING_CONTEXT | Booking context reset manually |
|
|
133
|
-
| VEHICLE_ARCHIVED_FM | Vehicle archived in fleet manager |
|
|
134
|
-
| VEHICLE_CHARGING_ACTIVE | Vehicle charging (active) |
|
|
135
|
-
| VEHICLE_CHARGING_ENDED | Vehicle charging stopped |
|
|
136
|
-
| VEHICLE_CHARGING_PLUGGED | Charging cable plugged in |
|
|
137
|
-
| VEHICLE_CHARGING_UNPLUGGED | Charging cable unplugged |
|
|
138
|
-
| VEHICLE_BATTERY_OK | Auxiliary battery voltage normal |
|
|
139
|
-
| VEHICLE_BATTERY_LOW | Auxiliary battery voltage low |
|
|
140
|
-
| VEHICLE_BATTERY_CRITICAL | Auxiliary battery voltage critical |
|
|
141
|
-
| VEHICLE_DOORS_OPEN | Door opened |
|
|
142
|
-
| VEHICLE_DOORS_CLOSED | Door closed |
|
|
143
|
-
| VEHICLE_WINDOWS_OPEN | Window opened |
|
|
144
|
-
| VEHICLE_WINDOWS_CLOSED | Window closed |
|
|
145
|
-
| VEHICLE_ALERT | Vehicle alert (may generate ticket) |
|
|
146
|
-
| VEHICLE_FATAL | Critical vehicle alert (may put out of service) |
|
|
147
|
-
| VEHICLE_PRICING_CHANGED | Specific pricing applied to vehicle |
|
|
148
|
-
| VEHICLE_GROUP_CHANGED | Vehicle moved to a group |
|
|
149
|
-
| VEHICLE_UPDATE_ODOMETER | Odometer updated |
|
|
150
|
-
| VEHICLE_UPDATE_STATUS | Vehicle status updated |
|
|
151
|
-
| VEHICLE_UPDATE_GPS_MANUAL | Manual GPS update |
|
|
152
|
-
| VEHICLE_UPDATE_GPS_SIM | GPS update from SIM provider |
|
|
153
|
-
| VEHICLE_RFID_SYNC | Upload RFID list to box |
|
|
154
|
-
| VEHICLE_PREAUTH_CONFIRMED | Pre-authorization confirmed by bank |
|
|
155
|
-
| VEHICLE_PREAUTH_REJECTED | Pre-authorization rejected by bank |
|
|
156
|
-
| VEHICLE_PREAUTH_EXPIRED | Pre-authorization request expired |
|
|
157
|
-
| VEHICLE_PREAUTH_CANCELLED | Pre-authorization request canceled |
|
|
158
|
-
| USER_PRODUCT_INVOICE_CANCELLED | Product invoice canceled |
|
|
159
|
-
| USER_TRIP_INVOICE_CANCELLED | Trip invoice canceled |
|
|
160
|
-
| USER_PRODUCT_INVOICE_REFUSED | Product invoice refused |
|
|
161
|
-
| USER_TRIP_INVOICE_REFUSED | Trip invoice refused |
|
|
162
|
-
| USER_TRIP_INVOICE_PAID | Trip invoice paid |
|
|
163
|
-
| USER_PRODUCT_INVOICE_PAID | Product invoice paid |
|
|
164
|
-
| USER_TRIP_INVOICE_REFUNDED | Trip invoice refunded |
|
|
165
|
-
| USER_PRODUCT_INVOICE_REFUNDED | Product invoice refunded |
|
|
166
|
-
| USER_PLAN_SUBSCRIBED | Mobility plan subscribed |
|
|
167
|
-
| USER_PLAN_UNSUBSCRIBED | Mobility plan unsubscribed |
|
|
168
|
-
| USER_PLAN_EXPIRED | Mobility plan expired |
|
|
169
|
-
| USER_PLAN_RENEWED | Mobility plan renewed |
|
|
170
|
-
| USER_PLAN_RENEWAL | Mobility plan renewal attempted |
|
|
171
|
-
| USER_PLAN_CANCELED | Mobility plan canceled |
|
|
172
|
-
| USER_PLAN_UPDATED | Mobility plan updated |
|
|
173
|
-
| USER_PLAN_PERIODIC_TIME_WALLET_CHARGED | Periodic time wallet charged by plan |
|
|
174
|
-
| USER_PLAN_PERIODIC_TIME_WALLET_CONSUMED | Periodic time wallet consumed by plan |
|
|
175
|
-
| USER_REFERRAL_CREATED | User submitted a new report |
|
|
176
|
-
| USER_REFERRAL_CHECKED | User generated referral code |
|
|
177
|
-
| USER_REPORT_CREATED | User checked a friend's referral code |
|
|
178
|
-
| USER_REPORT_UPDATED | Existing report updated |
|
|
179
|
-
| USER_DOC_UPDATED | Document updated |
|
|
180
|
-
| USER_BILLING_GROUP_ADDED | User added to billing group |
|
|
181
|
-
| USER_BILLING_GROUP_REMOVED | User removed from billing group |
|
|
182
|
-
| VEHICLE_ADDED_TO_SERVICE | Vehicle added to service |
|
|
183
|
-
| VEHICLE_REMOVED_FROM_SERVICE | Vehicle removed from service |
|
|
184
|
-
| USER_RFIDPINCODE_REQUESTED | RFID pinCode requested to refuel vehicle |
|
|
185
|
-
| VEHICLE_REFILLED | Vehicle refilled |
|
|
186
|
-
| VEHICLE_DIAG_GPS | Vehicle GPS diagnostic |
|
|
187
|
-
| VEHICLE_DIAG_CAN | Vehicle CAN diagnostic |
|
|
188
|
-
| VEHICLE_DIAG_MOBILIZER | Vehicle mobilizer diagnostic |
|
|
189
|
-
| VEHICLE_DIAG_IMMOBILIZER | Vehicle immobilizer diagnostic |
|
|
190
|
-
| VEHICLE_DIAG_LOCK | Vehicle lock diagnostic |
|
|
191
|
-
| VEHICLE_DIAG_UNLOCK | Vehicle unlock diagnostic |
|
|
192
|
-
| VEHICLE_DIAG_ANALOG | Vehicle analog diagnostic |
|
|
193
|
-
| VEHICLE_DIAG_CKH | Vehicle ckh diagnostic |
|
|
194
|
-
| VEHICLE_DIAG_RFID | Vehicle RFID diagnostic |
|
|
195
|
-
| VEHICLE_DIAG_SPEAK | Vehicle speak diagnostic |
|
|
196
|
-
| VEHICLE_DIAG_HZ_LED | Vehicle home zone diagnostic |
|
|
197
|
-
| VEHICLE_BLE_AUTH | Invalid BLE token usage tracked |
|
|
198
|
-
| VEHICLE_BLE_START_FLOW | BLE token requested in start flow |
|
|
199
|
-
| VEHICLE_BLE_START_ISSUE | Issue during BLE token usage |
|
|
200
|
-
| VEHICLE_FIRMWARE_UPDATE | New firmware assigned to vehicle |
|
|
201
|
-
| USER_TRIP_EVENT_MAP_DISPLAY_GDPR | Hide trip user for GDPR compliance |
|
|
202
|
-
| USER_AUTOMATICALLY_REFUNDED | User automatically refunded |
|
|
203
|
-
| USER_TRIP_CREDIT_REFUNDED | Trip credit refunded |
|
|
204
|
-
| USER_PRODUCT_CREDIT_REFUNDED | Product credit refunded |
|
|
205
|
-
| USER_PRODUCT_TIME_WALLET_CHARGED | Product time wallet charged |
|
|
206
|
-
| USER_PRODUCT_TIME_WALLET_CONSUMED | Product time wallet consumed |
|
|
207
|
-
| USER_CREDIT_REFUNDED | User credit refunded |
|
|
208
|
-
| USER_ALL_CREDIT_REFUNDED | All user credit refunded |
|
|
209
|
-
| USER_PREPAYMENT_SUCCEEDED | Prepayment successful |
|
|
210
|
-
| USER_PREPAYMENT_FAILED | Prepayment failed |
|
|
211
|
-
| USER_CREATE_SUBSCRIPTION | New subscription created for user |
|
|
212
|
-
| USER_UPDATE_SUBSCRIPTION | Subscription updated for user |
|
|
213
|
-
| GRACE_PERIOD_APPLIED | Grace period applied to trip |
|
|
214
|
-
| USER_LABEL_CREATED | User label created |
|
|
215
|
-
| USER_LABEL_DELETED | User label deleted |
|
|
85
|
+
### Event
|
|
86
|
+
|
|
87
|
+
```ts
|
|
88
|
+
interface Event {
|
|
89
|
+
fleetId: string;
|
|
90
|
+
userId: string;
|
|
91
|
+
origin: string;
|
|
92
|
+
type: EventType;
|
|
93
|
+
date: string;
|
|
94
|
+
failed: boolean;
|
|
95
|
+
originId?: string;
|
|
96
|
+
insertionDate?: string;
|
|
97
|
+
deletionDate?: string;
|
|
98
|
+
doNotTrack: boolean;
|
|
99
|
+
extraInfo: ExtraInfo;
|
|
100
|
+
}
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
### ExtraInfo
|
|
104
|
+
|
|
105
|
+
An object with event-specific data; its shape depends on the event `type`.
|
|
106
|
+
|
|
107
|
+
### EventType
|
|
108
|
+
|
|
109
|
+
A string union of 160+ event types. Examples:
|
|
110
|
+
|
|
111
|
+
| Value | Description |
|
|
112
|
+
| ----- | ----------- |
|
|
113
|
+
| `BOOKING_CANCEL` | Booking canceled |
|
|
114
|
+
| `TRIP_START` | Trip started |
|
|
115
|
+
| `TRIP_END` | Trip ended |
|
|
116
|
+
| `VEHICLE_LOCK` | Vehicle locked |
|
|
117
|
+
| `VEHICLE_UNLOCK` | Vehicle unlocked |
|
|
118
|
+
| `PAYMENT_SUCCESS` | Payment succeeded |
|
|
119
|
+
| `USER_CREATED` | User account created |
|
|
120
|
+
| `USER_ARCHIVED` | User account archived |
|
|
121
|
+
| `USER_PLAN_SUBSCRIBED` | Mobility plan subscribed |
|
|
122
|
+
| `USER_PLAN_UNSUBSCRIBED` | Mobility plan unsubscribed |
|
|
123
|
+
| `VEHICLE_OUT_OF_SERVICE` | Vehicle marked out of service |
|
|
124
|
+
| `VEHICLE_ENABLE` | Vehicle back in service |
|
|
125
|
+
|
|
126
|
+
See the source for the full list of supported event types.
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vulog/aima-event",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.2.
|
|
4
|
+
"version": "1.2.47",
|
|
5
5
|
"main": "dist/index.cjs",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
7
7
|
"types": "dist/index.d.cts",
|
|
@@ -32,8 +32,8 @@
|
|
|
32
32
|
"author": "Vulog",
|
|
33
33
|
"license": "MIT",
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@vulog/aima-client": "1.2.
|
|
36
|
-
"@vulog/aima-core": "1.2.
|
|
35
|
+
"@vulog/aima-client": "1.2.47",
|
|
36
|
+
"@vulog/aima-core": "1.2.47"
|
|
37
37
|
},
|
|
38
38
|
"peerDependencies": {
|
|
39
39
|
"zod": "^4.3.6"
|