@vulog/aima-vehicle 1.2.30 → 1.2.31
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.cjs +252 -0
- package/dist/index.d.cts +273 -0
- package/dist/index.d.mts +211 -218
- package/dist/index.mjs +201 -261
- package/package.json +20 -7
- package/src/createVehicle.test.ts +88 -0
- package/src/createVehicle.ts +49 -0
- package/src/getModelVehicles.test.ts +4 -4
- package/src/index.ts +1 -0
- package/{tsup.config.ts → tsdown.config.ts} +1 -1
- package/dist/index.d.ts +0 -280
- package/dist/index.js +0 -324
- /package/{.eslintrc.js → .eslintrc.cjs} +0 -0
package/dist/index.d.mts
CHANGED
|
@@ -1,244 +1,212 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { PaginableOptions, PaginableResponse } from "@vulog/aima-core";
|
|
2
|
+
import { Client } from "@vulog/aima-client";
|
|
3
3
|
|
|
4
|
+
//#region src/types.d.ts
|
|
4
5
|
/**
|
|
5
6
|
* Represents a vehicle model with its specifications and characteristics
|
|
6
7
|
*/
|
|
7
8
|
type Model = {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
/** ID of the fleet this model belongs to */
|
|
27
|
-
fleetId: string;
|
|
28
|
-
/** Type of vehicle (e.g., "CAR") */
|
|
29
|
-
vehicleType: string;
|
|
30
|
-
/** Type of transmission (e.g., "UNDEFINED") */
|
|
31
|
-
transmission: string;
|
|
32
|
-
/** Range threshold for out of service status */
|
|
33
|
-
outOfServiceRange: string;
|
|
34
|
-
/** Range threshold for recovery */
|
|
35
|
-
recoveryRange: string;
|
|
36
|
-
/** Array of incentive thresholds */
|
|
37
|
-
incentiveThresholds: any[];
|
|
38
|
-
/** Range threshold for vehicle redistribution */
|
|
39
|
-
redistributeVehicleChargedEnoughRange: string;
|
|
40
|
-
/** Indicates if the odometer readings are reliable */
|
|
41
|
-
odometerReliable?: boolean;
|
|
42
|
-
[key: string]: any;
|
|
9
|
+
/** Unique identifier of the model */id: number; /** Name of the model (e.g., "C-Zero") */
|
|
10
|
+
name: string; /** Type of energy used by the vehicle (e.g., "ELECTRIC") */
|
|
11
|
+
energyType: string; /** Current status of the model (e.g., "ACTIVE") */
|
|
12
|
+
status: string; /** Number of seats in the vehicle */
|
|
13
|
+
nbOfSeats: number; /** Maximum range/autonomy of the vehicle in kilometers */
|
|
14
|
+
autonomy: number; /** Date when the model was created */
|
|
15
|
+
creationDate: string; /** Date when the model was last updated */
|
|
16
|
+
updateDate: string; /** Description of the model (e.g., brand name) */
|
|
17
|
+
description: string; /** ID of the fleet this model belongs to */
|
|
18
|
+
fleetId: string; /** Type of vehicle (e.g., "CAR") */
|
|
19
|
+
vehicleType: string; /** Type of transmission (e.g., "UNDEFINED") */
|
|
20
|
+
transmission: string; /** Range threshold for out of service status */
|
|
21
|
+
outOfServiceRange: string; /** Range threshold for recovery */
|
|
22
|
+
recoveryRange: string; /** Array of incentive thresholds */
|
|
23
|
+
incentiveThresholds: any[]; /** Range threshold for vehicle redistribution */
|
|
24
|
+
redistributeVehicleChargedEnoughRange: string; /** Indicates if the odometer readings are reliable */
|
|
25
|
+
odometerReliable?: boolean;
|
|
26
|
+
[key: string]: any;
|
|
43
27
|
};
|
|
44
28
|
/**
|
|
45
29
|
* Represents a vehicle in the system
|
|
46
30
|
*/
|
|
47
31
|
type Vehicle = {
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
/** External system identifier */
|
|
67
|
-
externalId: string;
|
|
68
|
-
/** Provider used for vehicle wakeup */
|
|
69
|
-
wakeupProvider?: string;
|
|
70
|
-
/** Mobile Subscriber Integrated Services Digital Network Number */
|
|
71
|
-
msisdn: string;
|
|
72
|
-
/** Integrated Circuit Card Identifier */
|
|
73
|
-
iccid: string;
|
|
74
|
-
/** International Mobile Subscriber Identity */
|
|
75
|
-
imsi?: string;
|
|
76
|
-
/** Whether the vehicle is published in the system */
|
|
77
|
-
published: boolean;
|
|
78
|
-
/** Whether the vehicle has no box installed */
|
|
79
|
-
noBox: boolean;
|
|
80
|
-
/** Whether the vehicle is archived */
|
|
81
|
-
archived: boolean;
|
|
82
|
-
[key: string]: any;
|
|
32
|
+
/** Unique identifier of the vehicle */id: string; /** Name of the vehicle */
|
|
33
|
+
name: string; /** License plate number */
|
|
34
|
+
plate: string; /** Vehicle Identification Number */
|
|
35
|
+
vin: string; /** Model information of the vehicle */
|
|
36
|
+
model: Model; /** List of options/features installed on the vehicle */
|
|
37
|
+
options: Options[]; /** Date when the vehicle was created */
|
|
38
|
+
createDate: string; /** Date when the vehicle was last updated */
|
|
39
|
+
updateDate: string; /** ID of the fleet this vehicle belongs to */
|
|
40
|
+
fleetId: string; /** External system identifier */
|
|
41
|
+
externalId: string; /** Provider used for vehicle wakeup */
|
|
42
|
+
wakeupProvider?: string; /** Mobile Subscriber Integrated Services Digital Network Number */
|
|
43
|
+
msisdn: string; /** Integrated Circuit Card Identifier */
|
|
44
|
+
iccid: string; /** International Mobile Subscriber Identity */
|
|
45
|
+
imsi?: string; /** Whether the vehicle is published in the system */
|
|
46
|
+
published: boolean; /** Whether the vehicle has no box installed */
|
|
47
|
+
noBox: boolean; /** Whether the vehicle is archived */
|
|
48
|
+
archived: boolean;
|
|
49
|
+
[key: string]: any;
|
|
83
50
|
};
|
|
84
51
|
/**
|
|
85
52
|
* Represents a vehicle option or feature
|
|
86
53
|
*/
|
|
87
54
|
type Options = {
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
/** Type of the option (e.g., "Color", "Gearbox") */
|
|
95
|
-
type: string;
|
|
96
|
-
/** Description of the option */
|
|
97
|
-
description: string;
|
|
98
|
-
[key: string]: any;
|
|
55
|
+
/** Unique identifier of the option */id: number; /** ID of the fleet this option belongs to */
|
|
56
|
+
fleetId: string; /** Name of the option */
|
|
57
|
+
name: string; /** Type of the option (e.g., "Color", "Gearbox") */
|
|
58
|
+
type: string; /** Description of the option */
|
|
59
|
+
description: string;
|
|
60
|
+
[key: string]: any;
|
|
99
61
|
};
|
|
100
62
|
type Zone = {
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
63
|
+
type: string;
|
|
64
|
+
version: number;
|
|
65
|
+
zoneId: string;
|
|
66
|
+
sticky: boolean;
|
|
67
|
+
labels: {
|
|
68
|
+
labelId: string;
|
|
69
|
+
name: string;
|
|
70
|
+
publicName: string;
|
|
71
|
+
}[];
|
|
110
72
|
};
|
|
111
73
|
type VehicleRealTime = {
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
74
|
+
id: string;
|
|
75
|
+
name: string;
|
|
76
|
+
plate: string;
|
|
77
|
+
vin: string;
|
|
78
|
+
fleetid: string;
|
|
79
|
+
currentFleetId: string;
|
|
80
|
+
ownerFleetId: string;
|
|
81
|
+
boxid: string;
|
|
82
|
+
vehicle_status: number;
|
|
83
|
+
zones: Zone[];
|
|
84
|
+
releasable: boolean;
|
|
85
|
+
box_status: number;
|
|
86
|
+
autonomy: number;
|
|
87
|
+
autonomy2: number;
|
|
88
|
+
isCharging: boolean;
|
|
89
|
+
battery: number;
|
|
90
|
+
km: number;
|
|
91
|
+
speed: number;
|
|
92
|
+
location: {
|
|
93
|
+
geohash: string;
|
|
94
|
+
cap: number;
|
|
95
|
+
latitude: number;
|
|
96
|
+
longitude: number;
|
|
97
|
+
gpsDate: string;
|
|
98
|
+
lastMovingDate: string;
|
|
99
|
+
};
|
|
100
|
+
endTripLocation: {
|
|
101
|
+
latitude: number;
|
|
102
|
+
longitude: number;
|
|
103
|
+
};
|
|
104
|
+
endZoneIds: [];
|
|
105
|
+
productIds: [];
|
|
106
|
+
isDoorClosed: boolean;
|
|
107
|
+
isDoorLocked: boolean;
|
|
108
|
+
engineOn: boolean;
|
|
109
|
+
immobilizerOn: boolean;
|
|
110
|
+
secureOn: boolean;
|
|
111
|
+
spareLockOn: boolean | null;
|
|
112
|
+
pileLockOn: boolean | null;
|
|
113
|
+
helmetPresent: boolean | null;
|
|
114
|
+
helmet2Present: boolean | null;
|
|
115
|
+
helmetBoxLockOn: boolean | null;
|
|
116
|
+
helmet2LockOn: boolean | null;
|
|
117
|
+
userId: string | null;
|
|
118
|
+
user_locale: string | null;
|
|
119
|
+
rfid: string | null;
|
|
120
|
+
orderId: string | null;
|
|
121
|
+
gatewayUrl: string | null;
|
|
122
|
+
booking_status: number;
|
|
123
|
+
booking_date: string | null;
|
|
124
|
+
expiresOn: boolean | null;
|
|
125
|
+
last_active_date: string;
|
|
126
|
+
last_wakeUp_date: string;
|
|
127
|
+
version: string;
|
|
128
|
+
pricingId: string | null;
|
|
129
|
+
start_date: string | null;
|
|
130
|
+
theorStartDate: string | null;
|
|
131
|
+
theorEndDate: string | null;
|
|
132
|
+
startZones: Zone[];
|
|
133
|
+
endZones: Zone[];
|
|
134
|
+
disabled: boolean;
|
|
135
|
+
outOfServiceReason: string;
|
|
136
|
+
ignitionOffGeohash: string | null;
|
|
137
|
+
geohashNeighbours: string[];
|
|
138
|
+
cleanlinessStatus: boolean;
|
|
139
|
+
needsRedistribution: boolean;
|
|
140
|
+
batteryUnderThreshold: boolean;
|
|
141
|
+
isBeingTowed: boolean;
|
|
142
|
+
automaticallyEnableVehicleAfterRangeRecovery: boolean;
|
|
143
|
+
key: {
|
|
144
|
+
deviceName: string;
|
|
145
|
+
};
|
|
146
|
+
doNotTrack: boolean;
|
|
147
|
+
energyLevel: number;
|
|
148
|
+
lastOosDate: string;
|
|
149
|
+
hasAlerts: boolean;
|
|
150
|
+
firmwareModel: string;
|
|
151
|
+
comeFromApp: string;
|
|
152
|
+
doors: {
|
|
153
|
+
frontLeftClosed: boolean;
|
|
154
|
+
frontRightClosed: boolean;
|
|
155
|
+
rearLeftClosed: boolean;
|
|
156
|
+
rearRightClosed: boolean;
|
|
157
|
+
trunkClosed: boolean;
|
|
158
|
+
hoodClosed: boolean;
|
|
159
|
+
};
|
|
160
|
+
windows: {
|
|
161
|
+
frontLeftClosed: boolean;
|
|
162
|
+
frontRightClosed: boolean;
|
|
163
|
+
rearLeftClosed: boolean;
|
|
164
|
+
rearRightClosed: boolean;
|
|
165
|
+
trunkClosed: boolean;
|
|
166
|
+
};
|
|
167
|
+
doorsAndWindowsClosed: boolean;
|
|
168
|
+
vpChecksum: string;
|
|
169
|
+
firmwareBuildDate: string;
|
|
170
|
+
[key: string]: any;
|
|
209
171
|
};
|
|
210
172
|
type Assets = {
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
[key: string]: any;
|
|
221
|
-
}[];
|
|
173
|
+
fleet_id: string;
|
|
174
|
+
model_id: number;
|
|
175
|
+
assets: {
|
|
176
|
+
aid: string;
|
|
177
|
+
type: string;
|
|
178
|
+
url: string | null;
|
|
179
|
+
value: number | null;
|
|
180
|
+
b_value: boolean | null;
|
|
181
|
+
text: string | null;
|
|
222
182
|
[key: string]: any;
|
|
183
|
+
}[];
|
|
184
|
+
[key: string]: any;
|
|
223
185
|
};
|
|
224
186
|
type ModelVehicle = {
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
187
|
+
serviceId: string;
|
|
188
|
+
serviceVisibility: 'PUBLIC' | 'PRIVATE';
|
|
189
|
+
modelId: number;
|
|
190
|
+
vehicles: string[];
|
|
229
191
|
};
|
|
230
|
-
|
|
192
|
+
//#endregion
|
|
193
|
+
//#region src/getModel.d.ts
|
|
231
194
|
declare const getModelsById: (client: Client, id: number) => Promise<Model>;
|
|
232
|
-
|
|
195
|
+
//#endregion
|
|
196
|
+
//#region src/getModelAssets.d.ts
|
|
233
197
|
declare const getModelByIdAssets: (client: Client, id: number) => Promise<Assets>;
|
|
234
|
-
|
|
198
|
+
//#endregion
|
|
199
|
+
//#region src/getModels.d.ts
|
|
235
200
|
declare const getModels: (client: Client) => Promise<Model[]>;
|
|
236
|
-
|
|
201
|
+
//#endregion
|
|
202
|
+
//#region src/getVehicle.d.ts
|
|
237
203
|
declare const getVehicleById: (client: Client, id: string) => Promise<Vehicle | null>;
|
|
238
204
|
declare const getVehicleRealTimeById: (client: Client, id: string) => Promise<VehicleRealTime | null>;
|
|
239
|
-
|
|
205
|
+
//#endregion
|
|
206
|
+
//#region src/getVehicleAssets.d.ts
|
|
240
207
|
declare const getVehicleByIdAssets: (client: Client, id: string) => Promise<Assets>;
|
|
241
|
-
|
|
208
|
+
//#endregion
|
|
209
|
+
//#region src/getVehicles.d.ts
|
|
242
210
|
/**
|
|
243
211
|
* Fetches all vehicles from the API using pagination
|
|
244
212
|
* @param client - The AIMA client instance
|
|
@@ -257,24 +225,49 @@ declare const getVehicles: (client: Client, pageSize?: number) => Promise<Vehicl
|
|
|
257
225
|
* @throws Error if lastUpdatedMillis is in the future
|
|
258
226
|
*/
|
|
259
227
|
declare const getVehiclesRealTime: (client: Client, pageSize?: number, lastUpdatedMillis?: number) => Promise<VehicleRealTime[]>;
|
|
260
|
-
|
|
228
|
+
//#endregion
|
|
229
|
+
//#region src/pingVehicle.d.ts
|
|
261
230
|
/**
|
|
262
231
|
* Pings a vehicle to check if it is alive (box connected).
|
|
263
232
|
* Returns true if alive (HTTP 200), false if box not connected (code 410, codeStr 'carConnectionProblem'),
|
|
264
233
|
* throws for other errors or invalid id.
|
|
265
234
|
*/
|
|
266
235
|
declare const pingVehicleById: (client: Client, id: string) => Promise<boolean>;
|
|
267
|
-
|
|
236
|
+
//#endregion
|
|
237
|
+
//#region src/enableVehicle.d.ts
|
|
268
238
|
type EnableVehicleBody = {
|
|
269
|
-
|
|
239
|
+
subStatus: string;
|
|
270
240
|
};
|
|
271
241
|
declare const enableVehicle: (client: Client, vehicleId: string, payload: EnableVehicleBody) => Promise<void>;
|
|
272
|
-
|
|
242
|
+
//#endregion
|
|
243
|
+
//#region src/disableVehicle.d.ts
|
|
273
244
|
type DisableVehicleBody = {
|
|
274
|
-
|
|
245
|
+
subStatus: string;
|
|
275
246
|
};
|
|
276
247
|
declare const disableVehicle: (client: Client, vehicleId: string, payload: DisableVehicleBody) => Promise<void>;
|
|
277
|
-
|
|
248
|
+
//#endregion
|
|
249
|
+
//#region src/getModelVehicles.d.ts
|
|
278
250
|
declare const getModelVehicles: (client: Client, options?: PaginableOptions) => Promise<PaginableResponse<ModelVehicle>>;
|
|
279
|
-
|
|
280
|
-
|
|
251
|
+
//#endregion
|
|
252
|
+
//#region src/createVehicle.d.ts
|
|
253
|
+
type CreateVehicleBody = {
|
|
254
|
+
vin: string;
|
|
255
|
+
plate: string;
|
|
256
|
+
name: string;
|
|
257
|
+
model: {
|
|
258
|
+
id: number;
|
|
259
|
+
};
|
|
260
|
+
vuboxId?: string;
|
|
261
|
+
externalId?: string;
|
|
262
|
+
wakeupProvider?: string;
|
|
263
|
+
noBox?: boolean;
|
|
264
|
+
published?: boolean;
|
|
265
|
+
archived?: boolean;
|
|
266
|
+
msisdn?: string;
|
|
267
|
+
iccid?: string;
|
|
268
|
+
imsi?: string;
|
|
269
|
+
residualValue?: number;
|
|
270
|
+
};
|
|
271
|
+
declare const createVehicle: (client: Client, body: CreateVehicleBody) => Promise<Vehicle>;
|
|
272
|
+
//#endregion
|
|
273
|
+
export { Assets, CreateVehicleBody, DisableVehicleBody, EnableVehicleBody, Model, ModelVehicle, Options, Vehicle, VehicleRealTime, Zone, createVehicle, disableVehicle, enableVehicle, getModelByIdAssets, getModelVehicles, getModels, getModelsById, getVehicleById, getVehicleByIdAssets, getVehicleRealTimeById, getVehicles, getVehiclesRealTime, pingVehicleById };
|