@vulog/aima-vehicle 1.1.47 → 1.1.49

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.mts CHANGED
@@ -20,9 +20,119 @@ type Model = {
20
20
  redistributeVehicleChargedEnoughRange: string;
21
21
  [key: string]: any;
22
22
  };
23
+ type Zone = {
24
+ type: string;
25
+ version: number;
26
+ zoneId: string;
27
+ sticky: boolean;
28
+ labels: {
29
+ labelId: string;
30
+ name: string;
31
+ publicName: string;
32
+ }[];
33
+ };
34
+ type VehicleRealTime = {
35
+ id: string;
36
+ name: string;
37
+ plate: string;
38
+ vin: string;
39
+ fleetid: string;
40
+ boxid: string;
41
+ vehicle_status: number;
42
+ zones: Zone[];
43
+ releasable: boolean;
44
+ box_status: number;
45
+ autonomy: number;
46
+ autonomy2: number;
47
+ isCharging: boolean;
48
+ battery: number;
49
+ km: number;
50
+ speed: number;
51
+ location: {
52
+ geohash: string;
53
+ cap: number;
54
+ latitude: number;
55
+ longitude: number;
56
+ gpsDate: string;
57
+ lastMovingDate: string;
58
+ };
59
+ endTripLocation: {
60
+ latitude: number;
61
+ longitude: number;
62
+ };
63
+ endZoneIds: [];
64
+ productIds: [];
65
+ isDoorClosed: boolean;
66
+ isDoorLocked: boolean;
67
+ engineOn: boolean;
68
+ immobilizerOn: boolean;
69
+ secureOn: boolean;
70
+ spareLockOn: boolean | null;
71
+ pileLockOn: boolean | null;
72
+ helmetPresent: boolean | null;
73
+ helmet2Present: boolean | null;
74
+ helmetBoxLockOn: boolean | null;
75
+ helmet2LockOn: boolean | null;
76
+ userId: string | null;
77
+ user_locale: string | null;
78
+ rfid: string | null;
79
+ orderId: string | null;
80
+ gatewayUrl: string | null;
81
+ booking_status: number;
82
+ booking_date: string | null;
83
+ expiresOn: boolean | null;
84
+ last_active_date: string;
85
+ last_wakeUp_date: string;
86
+ version: string;
87
+ pricingId: string | null;
88
+ start_date: string | null;
89
+ theorStartDate: string | null;
90
+ theorEndDate: string | null;
91
+ startZones: Zone[];
92
+ endZones: Zone[];
93
+ disabled: boolean;
94
+ outOfServiceReason: string;
95
+ ignitionOffGeohash: string | null;
96
+ geohashNeighbours: string[];
97
+ cleanlinessStatus: boolean;
98
+ needsRedistribution: boolean;
99
+ batteryUnderThreshold: boolean;
100
+ isBeingTowed: boolean;
101
+ automaticallyEnableVehicleAfterRangeRecovery: boolean;
102
+ key: {
103
+ deviceName: string;
104
+ };
105
+ doNotTrack: boolean;
106
+ energyLevel: number;
107
+ lastOosDate: string;
108
+ hasAlerts: boolean;
109
+ firmwareModel: string;
110
+ comeFromApp: string;
111
+ doors: {
112
+ frontLeftClosed: boolean;
113
+ frontRightClosed: boolean;
114
+ rearLeftClosed: boolean;
115
+ rearRightClosed: boolean;
116
+ trunkClosed: boolean;
117
+ hoodClosed: boolean;
118
+ };
119
+ windows: {
120
+ frontLeftClosed: boolean;
121
+ frontRightClosed: boolean;
122
+ rearLeftClosed: boolean;
123
+ rearRightClosed: boolean;
124
+ trunkClosed: boolean;
125
+ };
126
+ doorsAndWindowsClosed: boolean;
127
+ vpChecksum: string;
128
+ firmwareBuildDate: string;
129
+ [key: string]: any;
130
+ };
23
131
 
24
132
  declare const getModelsById: (client: Client, id: number) => Promise<Model>;
25
133
 
26
134
  declare const getModels: (client: Client) => Promise<Model[]>;
27
135
 
28
- export { type Model, getModels, getModelsById };
136
+ declare const getVehicleRealTimeById: (client: Client, id: string) => Promise<VehicleRealTime | null>;
137
+
138
+ export { type Model, getModels, getModelsById, getVehicleRealTimeById };
package/dist/index.d.ts CHANGED
@@ -20,9 +20,119 @@ type Model = {
20
20
  redistributeVehicleChargedEnoughRange: string;
21
21
  [key: string]: any;
22
22
  };
23
+ type Zone = {
24
+ type: string;
25
+ version: number;
26
+ zoneId: string;
27
+ sticky: boolean;
28
+ labels: {
29
+ labelId: string;
30
+ name: string;
31
+ publicName: string;
32
+ }[];
33
+ };
34
+ type VehicleRealTime = {
35
+ id: string;
36
+ name: string;
37
+ plate: string;
38
+ vin: string;
39
+ fleetid: string;
40
+ boxid: string;
41
+ vehicle_status: number;
42
+ zones: Zone[];
43
+ releasable: boolean;
44
+ box_status: number;
45
+ autonomy: number;
46
+ autonomy2: number;
47
+ isCharging: boolean;
48
+ battery: number;
49
+ km: number;
50
+ speed: number;
51
+ location: {
52
+ geohash: string;
53
+ cap: number;
54
+ latitude: number;
55
+ longitude: number;
56
+ gpsDate: string;
57
+ lastMovingDate: string;
58
+ };
59
+ endTripLocation: {
60
+ latitude: number;
61
+ longitude: number;
62
+ };
63
+ endZoneIds: [];
64
+ productIds: [];
65
+ isDoorClosed: boolean;
66
+ isDoorLocked: boolean;
67
+ engineOn: boolean;
68
+ immobilizerOn: boolean;
69
+ secureOn: boolean;
70
+ spareLockOn: boolean | null;
71
+ pileLockOn: boolean | null;
72
+ helmetPresent: boolean | null;
73
+ helmet2Present: boolean | null;
74
+ helmetBoxLockOn: boolean | null;
75
+ helmet2LockOn: boolean | null;
76
+ userId: string | null;
77
+ user_locale: string | null;
78
+ rfid: string | null;
79
+ orderId: string | null;
80
+ gatewayUrl: string | null;
81
+ booking_status: number;
82
+ booking_date: string | null;
83
+ expiresOn: boolean | null;
84
+ last_active_date: string;
85
+ last_wakeUp_date: string;
86
+ version: string;
87
+ pricingId: string | null;
88
+ start_date: string | null;
89
+ theorStartDate: string | null;
90
+ theorEndDate: string | null;
91
+ startZones: Zone[];
92
+ endZones: Zone[];
93
+ disabled: boolean;
94
+ outOfServiceReason: string;
95
+ ignitionOffGeohash: string | null;
96
+ geohashNeighbours: string[];
97
+ cleanlinessStatus: boolean;
98
+ needsRedistribution: boolean;
99
+ batteryUnderThreshold: boolean;
100
+ isBeingTowed: boolean;
101
+ automaticallyEnableVehicleAfterRangeRecovery: boolean;
102
+ key: {
103
+ deviceName: string;
104
+ };
105
+ doNotTrack: boolean;
106
+ energyLevel: number;
107
+ lastOosDate: string;
108
+ hasAlerts: boolean;
109
+ firmwareModel: string;
110
+ comeFromApp: string;
111
+ doors: {
112
+ frontLeftClosed: boolean;
113
+ frontRightClosed: boolean;
114
+ rearLeftClosed: boolean;
115
+ rearRightClosed: boolean;
116
+ trunkClosed: boolean;
117
+ hoodClosed: boolean;
118
+ };
119
+ windows: {
120
+ frontLeftClosed: boolean;
121
+ frontRightClosed: boolean;
122
+ rearLeftClosed: boolean;
123
+ rearRightClosed: boolean;
124
+ trunkClosed: boolean;
125
+ };
126
+ doorsAndWindowsClosed: boolean;
127
+ vpChecksum: string;
128
+ firmwareBuildDate: string;
129
+ [key: string]: any;
130
+ };
23
131
 
24
132
  declare const getModelsById: (client: Client, id: number) => Promise<Model>;
25
133
 
26
134
  declare const getModels: (client: Client) => Promise<Model[]>;
27
135
 
28
- export { type Model, getModels, getModelsById };
136
+ declare const getVehicleRealTimeById: (client: Client, id: string) => Promise<VehicleRealTime | null>;
137
+
138
+ export { type Model, getModels, getModelsById, getVehicleRealTimeById };
package/dist/index.js CHANGED
@@ -21,7 +21,8 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
21
21
  var index_exports = {};
22
22
  __export(index_exports, {
23
23
  getModels: () => getModels,
24
- getModelsById: () => getModelsById
24
+ getModelsById: () => getModelsById,
25
+ getVehicleRealTimeById: () => getVehicleRealTimeById
25
26
  });
26
27
  module.exports = __toCommonJS(index_exports);
27
28
 
@@ -34,8 +35,31 @@ var getModelsById = async (client, id) => {
34
35
  var getModels = async (client) => {
35
36
  return client.get(`boapi/proxy/user/vehicle/fleets/${client.clientOptions.fleetId}/vehicles/models`).then(({ data }) => data);
36
37
  };
38
+
39
+ // src/getVehicle.ts
40
+ var import_zod = require("zod");
41
+ var schema = import_zod.z.object({
42
+ id: import_zod.z.string().trim().min(1).uuid()
43
+ });
44
+ var getVehicleRealTimeById = async (client, id) => {
45
+ const result = schema.safeParse({ id });
46
+ if (!result.success) {
47
+ throw new TypeError("Invalid args", {
48
+ cause: result.error.issues
49
+ });
50
+ }
51
+ return client.get(
52
+ `boapi/proxy/fleetmanager/public/fleets/${client.clientOptions.fleetId}/vehicles/${result.data.id}`
53
+ ).then(({ data }) => data).catch((error) => {
54
+ if (error.formattedError?.status === 404) {
55
+ return null;
56
+ }
57
+ throw error;
58
+ });
59
+ };
37
60
  // Annotate the CommonJS export names for ESM import in node:
38
61
  0 && (module.exports = {
39
62
  getModels,
40
- getModelsById
63
+ getModelsById,
64
+ getVehicleRealTimeById
41
65
  });
package/dist/index.mjs CHANGED
@@ -7,7 +7,30 @@ var getModelsById = async (client, id) => {
7
7
  var getModels = async (client) => {
8
8
  return client.get(`boapi/proxy/user/vehicle/fleets/${client.clientOptions.fleetId}/vehicles/models`).then(({ data }) => data);
9
9
  };
10
+
11
+ // src/getVehicle.ts
12
+ import { z } from "zod";
13
+ var schema = z.object({
14
+ id: z.string().trim().min(1).uuid()
15
+ });
16
+ var getVehicleRealTimeById = async (client, id) => {
17
+ const result = schema.safeParse({ id });
18
+ if (!result.success) {
19
+ throw new TypeError("Invalid args", {
20
+ cause: result.error.issues
21
+ });
22
+ }
23
+ return client.get(
24
+ `boapi/proxy/fleetmanager/public/fleets/${client.clientOptions.fleetId}/vehicles/${result.data.id}`
25
+ ).then(({ data }) => data).catch((error) => {
26
+ if (error.formattedError?.status === 404) {
27
+ return null;
28
+ }
29
+ throw error;
30
+ });
31
+ };
10
32
  export {
11
33
  getModels,
12
- getModelsById
34
+ getModelsById,
35
+ getVehicleRealTimeById
13
36
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vulog/aima-vehicle",
3
- "version": "1.1.47",
3
+ "version": "1.1.49",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/index.mjs",
6
6
  "types": "dist/index.d.ts",
@@ -19,8 +19,8 @@
19
19
  "author": "Vulog",
20
20
  "license": "ISC",
21
21
  "dependencies": {
22
- "@vulog/aima-client": "1.1.47",
23
- "@vulog/aima-core": "1.1.47"
22
+ "@vulog/aima-client": "1.1.49",
23
+ "@vulog/aima-core": "1.1.49"
24
24
  },
25
25
  "peerDependencies": {
26
26
  "zod": "^3.24.2"
@@ -0,0 +1,28 @@
1
+ import { Client } from '@vulog/aima-client';
2
+ import { z } from 'zod';
3
+
4
+ import { VehicleRealTime } from './types';
5
+
6
+ const schema = z.object({
7
+ id: z.string().trim().min(1).uuid(),
8
+ });
9
+
10
+ export const getVehicleRealTimeById = async (client: Client, id: string) => {
11
+ const result = schema.safeParse({ id });
12
+ if (!result.success) {
13
+ throw new TypeError('Invalid args', {
14
+ cause: result.error.issues,
15
+ });
16
+ }
17
+ return client
18
+ .get<VehicleRealTime>(
19
+ `boapi/proxy/fleetmanager/public/fleets/${client.clientOptions.fleetId}/vehicles/${result.data.id}`
20
+ )
21
+ .then(({ data }) => data)
22
+ .catch((error) => {
23
+ if (error.formattedError?.status === 404) {
24
+ return null;
25
+ }
26
+ throw error;
27
+ });
28
+ };
package/src/index.ts CHANGED
@@ -1,3 +1,4 @@
1
- export { getModelsById } from './getModel';
2
- export { getModels } from './getModels';
1
+ export * from './getModel';
2
+ export * from './getModels';
3
+ export * from './getVehicle';
3
4
  export type { Model } from './types';
package/src/types.ts CHANGED
@@ -18,3 +18,113 @@ export type Model = {
18
18
  redistributeVehicleChargedEnoughRange: string;
19
19
  [key: string]: any;
20
20
  };
21
+
22
+ export type Zone = {
23
+ type: string;
24
+ version: number;
25
+ zoneId: string;
26
+ sticky: boolean;
27
+ labels: {
28
+ labelId: string;
29
+ name: string;
30
+ publicName: string;
31
+ }[];
32
+ };
33
+
34
+ export type VehicleRealTime = {
35
+ id: string;
36
+ name: string;
37
+ plate: string;
38
+ vin: string;
39
+ fleetid: string;
40
+ boxid: string;
41
+ vehicle_status: number;
42
+ zones: Zone[];
43
+ releasable: boolean;
44
+ box_status: number;
45
+ autonomy: number;
46
+ autonomy2: number;
47
+ isCharging: boolean;
48
+ battery: number;
49
+ km: number;
50
+ speed: number;
51
+ location: {
52
+ geohash: string;
53
+ cap: number;
54
+ latitude: number;
55
+ longitude: number;
56
+ gpsDate: string;
57
+ lastMovingDate: string;
58
+ };
59
+ endTripLocation: {
60
+ latitude: number;
61
+ longitude: number;
62
+ };
63
+ endZoneIds: [];
64
+ productIds: [];
65
+ isDoorClosed: boolean;
66
+ isDoorLocked: boolean;
67
+ engineOn: boolean;
68
+ immobilizerOn: boolean;
69
+ secureOn: boolean;
70
+ spareLockOn: boolean | null;
71
+ pileLockOn: boolean | null;
72
+ helmetPresent: boolean | null;
73
+ helmet2Present: boolean | null;
74
+ helmetBoxLockOn: boolean | null;
75
+ helmet2LockOn: boolean | null;
76
+ userId: string | null;
77
+ user_locale: string | null;
78
+ rfid: string | null;
79
+ orderId: string | null;
80
+ gatewayUrl: string | null;
81
+ booking_status: number;
82
+ booking_date: string | null;
83
+ expiresOn: boolean | null;
84
+ last_active_date: string;
85
+ last_wakeUp_date: string;
86
+ version: string;
87
+ pricingId: string | null;
88
+ start_date: string | null;
89
+ theorStartDate: string | null;
90
+ theorEndDate: string | null;
91
+ startZones: Zone[];
92
+ endZones: Zone[];
93
+ disabled: boolean;
94
+ outOfServiceReason: string;
95
+ ignitionOffGeohash: string | null;
96
+ geohashNeighbours: string[];
97
+ cleanlinessStatus: boolean;
98
+ needsRedistribution: boolean;
99
+ batteryUnderThreshold: boolean;
100
+ isBeingTowed: boolean;
101
+ automaticallyEnableVehicleAfterRangeRecovery: boolean;
102
+ key: {
103
+ deviceName: string;
104
+ };
105
+ doNotTrack: boolean;
106
+ energyLevel: number;
107
+ lastOosDate: string;
108
+ hasAlerts: boolean;
109
+ firmwareModel: string;
110
+ comeFromApp: string;
111
+ doors: {
112
+ frontLeftClosed: boolean;
113
+ frontRightClosed: boolean;
114
+ rearLeftClosed: boolean;
115
+ rearRightClosed: boolean;
116
+ trunkClosed: boolean;
117
+ hoodClosed: boolean;
118
+ };
119
+ windows: {
120
+ frontLeftClosed: boolean;
121
+ frontRightClosed: boolean;
122
+ rearLeftClosed: boolean;
123
+ rearRightClosed: boolean;
124
+ trunkClosed: boolean;
125
+ };
126
+ doorsAndWindowsClosed: boolean;
127
+ vpChecksum: string;
128
+ firmwareBuildDate: string;
129
+ [key: string]: any;
130
+ };