@vulog/aima-vehicle 1.1.53 → 1.1.54

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
@@ -204,11 +204,32 @@ type VehicleRealTime = {
204
204
  firmwareBuildDate: string;
205
205
  [key: string]: any;
206
206
  };
207
+ type Assets = {
208
+ fleet_id: string;
209
+ model_id: number;
210
+ assets: {
211
+ aid: string;
212
+ type: string;
213
+ url: string | null;
214
+ value: number | null;
215
+ b_value: boolean | null;
216
+ text: string | null;
217
+ [key: string]: any;
218
+ }[];
219
+ [key: string]: any;
220
+ };
207
221
 
208
222
  declare const getModelsById: (client: Client, id: number) => Promise<Model>;
209
223
 
224
+ declare const getModelByIdAssets: (client: Client, id: number) => Promise<Assets>;
225
+
210
226
  declare const getModels: (client: Client) => Promise<Model[]>;
211
227
 
228
+ declare const getVehicleById: (client: Client, id: string) => Promise<Vehicle | null>;
229
+ declare const getVehicleRealTimeById: (client: Client, id: string) => Promise<VehicleRealTime | null>;
230
+
231
+ declare const getVehicleByIdAssets: (client: Client, id: string) => Promise<Assets>;
232
+
212
233
  /**
213
234
  * Fetches all vehicles from the API using pagination
214
235
  * @param client - The AIMA client instance
@@ -228,6 +249,4 @@ declare const getVehicles: (client: Client, pageSize?: number) => Promise<Vehicl
228
249
  */
229
250
  declare const getVehiclesRealTime: (client: Client, pageSize?: number, lastUpdatedMillis?: number) => Promise<VehicleRealTime[]>;
230
251
 
231
- declare const getVehicleById: (client: Client, id: string) => Promise<Vehicle | null>;
232
-
233
- export { type Model, type Vehicle, getModels, getModelsById, getVehicleById, getVehicles, getVehiclesRealTime };
252
+ export { type Assets, type Model, type Options, type Vehicle, type VehicleRealTime, type Zone, getModelByIdAssets, getModels, getModelsById, getVehicleById, getVehicleByIdAssets, getVehicleRealTimeById, getVehicles, getVehiclesRealTime };
package/dist/index.d.ts CHANGED
@@ -204,11 +204,32 @@ type VehicleRealTime = {
204
204
  firmwareBuildDate: string;
205
205
  [key: string]: any;
206
206
  };
207
+ type Assets = {
208
+ fleet_id: string;
209
+ model_id: number;
210
+ assets: {
211
+ aid: string;
212
+ type: string;
213
+ url: string | null;
214
+ value: number | null;
215
+ b_value: boolean | null;
216
+ text: string | null;
217
+ [key: string]: any;
218
+ }[];
219
+ [key: string]: any;
220
+ };
207
221
 
208
222
  declare const getModelsById: (client: Client, id: number) => Promise<Model>;
209
223
 
224
+ declare const getModelByIdAssets: (client: Client, id: number) => Promise<Assets>;
225
+
210
226
  declare const getModels: (client: Client) => Promise<Model[]>;
211
227
 
228
+ declare const getVehicleById: (client: Client, id: string) => Promise<Vehicle | null>;
229
+ declare const getVehicleRealTimeById: (client: Client, id: string) => Promise<VehicleRealTime | null>;
230
+
231
+ declare const getVehicleByIdAssets: (client: Client, id: string) => Promise<Assets>;
232
+
212
233
  /**
213
234
  * Fetches all vehicles from the API using pagination
214
235
  * @param client - The AIMA client instance
@@ -228,6 +249,4 @@ declare const getVehicles: (client: Client, pageSize?: number) => Promise<Vehicl
228
249
  */
229
250
  declare const getVehiclesRealTime: (client: Client, pageSize?: number, lastUpdatedMillis?: number) => Promise<VehicleRealTime[]>;
230
251
 
231
- declare const getVehicleById: (client: Client, id: string) => Promise<Vehicle | null>;
232
-
233
- export { type Model, type Vehicle, getModels, getModelsById, getVehicleById, getVehicles, getVehiclesRealTime };
252
+ export { type Assets, type Model, type Options, type Vehicle, type VehicleRealTime, type Zone, getModelByIdAssets, getModels, getModelsById, getVehicleById, getVehicleByIdAssets, getVehicleRealTimeById, getVehicles, getVehiclesRealTime };
package/dist/index.js CHANGED
@@ -20,9 +20,12 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
20
20
  // src/index.ts
21
21
  var index_exports = {};
22
22
  __export(index_exports, {
23
+ getModelByIdAssets: () => getModelByIdAssets,
23
24
  getModels: () => getModels,
24
25
  getModelsById: () => getModelsById,
25
26
  getVehicleById: () => getVehicleById,
27
+ getVehicleByIdAssets: () => getVehicleByIdAssets,
28
+ getVehicleRealTimeById: () => getVehicleRealTimeById,
26
29
  getVehicles: () => getVehicles,
27
30
  getVehiclesRealTime: () => getVehiclesRealTime
28
31
  });
@@ -33,13 +36,79 @@ var getModelsById = async (client, id) => {
33
36
  return client.get(`boapi/proxy/user/vehicle/fleets/${client.clientOptions.fleetId}/vehicles/models/${id}`).then(({ data }) => data);
34
37
  };
35
38
 
39
+ // src/getModelAssets.ts
40
+ var import_zod = require("zod");
41
+ var schema = import_zod.z.object({
42
+ id: import_zod.z.number().int().positive()
43
+ });
44
+ var getModelByIdAssets = 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(`boapi/proxy/eds/rest_pub/rest/fleets/${client.clientOptions.fleetId}/models/${id}/`).then(({ data }) => data);
52
+ };
53
+
36
54
  // src/getModels.ts
37
55
  var getModels = async (client) => {
38
56
  return client.get(`boapi/proxy/user/vehicle/fleets/${client.clientOptions.fleetId}/vehicles/models`).then(({ data }) => data);
39
57
  };
40
58
 
59
+ // src/getVehicle.ts
60
+ var import_zod2 = require("zod");
61
+ var schema2 = import_zod2.z.object({
62
+ id: import_zod2.z.string().trim().min(1).uuid()
63
+ });
64
+ var getVehicleById = async (client, id) => {
65
+ const result = schema2.safeParse({ id });
66
+ if (!result.success) {
67
+ throw new TypeError("Invalid args", {
68
+ cause: result.error.issues
69
+ });
70
+ }
71
+ return client.get(`boapi/proxy/user/vehicle/fleets/${client.clientOptions.fleetId}/vehicles/${result.data.id}`).then(({ data }) => data).catch((error) => {
72
+ if (error.formattedError?.status === 404) {
73
+ return null;
74
+ }
75
+ throw error;
76
+ });
77
+ };
78
+ var getVehicleRealTimeById = async (client, id) => {
79
+ const result = schema2.safeParse({ id });
80
+ if (!result.success) {
81
+ throw new TypeError("Invalid args", {
82
+ cause: result.error.issues
83
+ });
84
+ }
85
+ return client.get(
86
+ `boapi/proxy/fleetmanager/public/fleets/${client.clientOptions.fleetId}/vehicles/${result.data.id}`
87
+ ).then(({ data }) => data).catch((error) => {
88
+ if (error.formattedError?.status === 404) {
89
+ return null;
90
+ }
91
+ throw error;
92
+ });
93
+ };
94
+
95
+ // src/getVehicleAssets.ts
96
+ var import_zod3 = require("zod");
97
+ var schema3 = import_zod3.z.object({
98
+ id: import_zod3.z.string().uuid()
99
+ });
100
+ var getVehicleByIdAssets = async (client, id) => {
101
+ const result = schema3.safeParse({ id });
102
+ if (!result.success) {
103
+ throw new TypeError("Invalid args", {
104
+ cause: result.error.issues
105
+ });
106
+ }
107
+ return client.get(`boapi/proxy/eds/rest_pub/rest/fleets/${client.clientOptions.fleetId}/vehicles/${id}/`).then(({ data }) => data);
108
+ };
109
+
41
110
  // src/getVehicles.ts
42
- var import_zod = require("zod");
111
+ var import_zod4 = require("zod");
43
112
  var getVehiclesPage = async (client, page, pageSize) => {
44
113
  const response = await client.get(
45
114
  `boapi/proxy/user/vehicle/fleets/${client.clientOptions.fleetId}/vehicles?page=${page}&size=${pageSize}`
@@ -47,10 +116,10 @@ var getVehiclesPage = async (client, page, pageSize) => {
47
116
  return response.data;
48
117
  };
49
118
  var getVehicles = async (client, pageSize = 500) => {
50
- const schema2 = import_zod.z.object({
51
- pageSize: import_zod.z.number().min(1).default(500)
119
+ const schema4 = import_zod4.z.object({
120
+ pageSize: import_zod4.z.number().min(1).default(500)
52
121
  });
53
- const result = schema2.safeParse({ pageSize });
122
+ const result = schema4.safeParse({ pageSize });
54
123
  if (!result.success) {
55
124
  throw new TypeError("Invalid args", {
56
125
  cause: result.error.issues
@@ -87,11 +156,11 @@ var getVehiclesRealTimePage = async (client, page, pageSize, lastUpdatedMillis)
87
156
  return response.data;
88
157
  };
89
158
  var getVehiclesRealTime = async (client, pageSize = 500, lastUpdatedMillis) => {
90
- const schema2 = import_zod.z.object({
91
- pageSize: import_zod.z.number().min(1).default(500),
92
- lastUpdatedMillis: import_zod.z.number().positive().optional()
159
+ const schema4 = import_zod4.z.object({
160
+ pageSize: import_zod4.z.number().min(1).default(500),
161
+ lastUpdatedMillis: import_zod4.z.number().positive().optional()
93
162
  });
94
- const result = schema2.safeParse({ pageSize, lastUpdatedMillis });
163
+ const result = schema4.safeParse({ pageSize, lastUpdatedMillis });
95
164
  if (!result.success) {
96
165
  throw new TypeError("Invalid args", {
97
166
  cause: result.error.issues
@@ -125,31 +194,14 @@ var getVehiclesRealTime = async (client, pageSize = 500, lastUpdatedMillis) => {
125
194
  }
126
195
  return allVehicles;
127
196
  };
128
-
129
- // src/getVehicle.ts
130
- var import_zod2 = require("zod");
131
- var schema = import_zod2.z.object({
132
- id: import_zod2.z.string().trim().min(1).uuid()
133
- });
134
- var getVehicleById = async (client, id) => {
135
- const result = schema.safeParse({ id });
136
- if (!result.success) {
137
- throw new TypeError("Invalid args", {
138
- cause: result.error.issues
139
- });
140
- }
141
- return client.get(`boapi/proxy/user/vehicle/fleets/${client.clientOptions.fleetId}/vehicles/${result.data.id}`).then(({ data }) => data).catch((error) => {
142
- if (error.formattedError?.status === 404) {
143
- return null;
144
- }
145
- throw error;
146
- });
147
- };
148
197
  // Annotate the CommonJS export names for ESM import in node:
149
198
  0 && (module.exports = {
199
+ getModelByIdAssets,
150
200
  getModels,
151
201
  getModelsById,
152
202
  getVehicleById,
203
+ getVehicleByIdAssets,
204
+ getVehicleRealTimeById,
153
205
  getVehicles,
154
206
  getVehiclesRealTime
155
207
  });
package/dist/index.mjs CHANGED
@@ -3,13 +3,79 @@ var getModelsById = async (client, id) => {
3
3
  return client.get(`boapi/proxy/user/vehicle/fleets/${client.clientOptions.fleetId}/vehicles/models/${id}`).then(({ data }) => data);
4
4
  };
5
5
 
6
+ // src/getModelAssets.ts
7
+ import { z } from "zod";
8
+ var schema = z.object({
9
+ id: z.number().int().positive()
10
+ });
11
+ var getModelByIdAssets = async (client, id) => {
12
+ const result = schema.safeParse({ id });
13
+ if (!result.success) {
14
+ throw new TypeError("Invalid args", {
15
+ cause: result.error.issues
16
+ });
17
+ }
18
+ return client.get(`boapi/proxy/eds/rest_pub/rest/fleets/${client.clientOptions.fleetId}/models/${id}/`).then(({ data }) => data);
19
+ };
20
+
6
21
  // src/getModels.ts
7
22
  var getModels = async (client) => {
8
23
  return client.get(`boapi/proxy/user/vehicle/fleets/${client.clientOptions.fleetId}/vehicles/models`).then(({ data }) => data);
9
24
  };
10
25
 
26
+ // src/getVehicle.ts
27
+ import { z as z2 } from "zod";
28
+ var schema2 = z2.object({
29
+ id: z2.string().trim().min(1).uuid()
30
+ });
31
+ var getVehicleById = async (client, id) => {
32
+ const result = schema2.safeParse({ id });
33
+ if (!result.success) {
34
+ throw new TypeError("Invalid args", {
35
+ cause: result.error.issues
36
+ });
37
+ }
38
+ return client.get(`boapi/proxy/user/vehicle/fleets/${client.clientOptions.fleetId}/vehicles/${result.data.id}`).then(({ data }) => data).catch((error) => {
39
+ if (error.formattedError?.status === 404) {
40
+ return null;
41
+ }
42
+ throw error;
43
+ });
44
+ };
45
+ var getVehicleRealTimeById = async (client, id) => {
46
+ const result = schema2.safeParse({ id });
47
+ if (!result.success) {
48
+ throw new TypeError("Invalid args", {
49
+ cause: result.error.issues
50
+ });
51
+ }
52
+ return client.get(
53
+ `boapi/proxy/fleetmanager/public/fleets/${client.clientOptions.fleetId}/vehicles/${result.data.id}`
54
+ ).then(({ data }) => data).catch((error) => {
55
+ if (error.formattedError?.status === 404) {
56
+ return null;
57
+ }
58
+ throw error;
59
+ });
60
+ };
61
+
62
+ // src/getVehicleAssets.ts
63
+ import { z as z3 } from "zod";
64
+ var schema3 = z3.object({
65
+ id: z3.string().uuid()
66
+ });
67
+ var getVehicleByIdAssets = async (client, id) => {
68
+ const result = schema3.safeParse({ id });
69
+ if (!result.success) {
70
+ throw new TypeError("Invalid args", {
71
+ cause: result.error.issues
72
+ });
73
+ }
74
+ return client.get(`boapi/proxy/eds/rest_pub/rest/fleets/${client.clientOptions.fleetId}/vehicles/${id}/`).then(({ data }) => data);
75
+ };
76
+
11
77
  // src/getVehicles.ts
12
- import { z } from "zod";
78
+ import { z as z4 } from "zod";
13
79
  var getVehiclesPage = async (client, page, pageSize) => {
14
80
  const response = await client.get(
15
81
  `boapi/proxy/user/vehicle/fleets/${client.clientOptions.fleetId}/vehicles?page=${page}&size=${pageSize}`
@@ -17,10 +83,10 @@ var getVehiclesPage = async (client, page, pageSize) => {
17
83
  return response.data;
18
84
  };
19
85
  var getVehicles = async (client, pageSize = 500) => {
20
- const schema2 = z.object({
21
- pageSize: z.number().min(1).default(500)
86
+ const schema4 = z4.object({
87
+ pageSize: z4.number().min(1).default(500)
22
88
  });
23
- const result = schema2.safeParse({ pageSize });
89
+ const result = schema4.safeParse({ pageSize });
24
90
  if (!result.success) {
25
91
  throw new TypeError("Invalid args", {
26
92
  cause: result.error.issues
@@ -57,11 +123,11 @@ var getVehiclesRealTimePage = async (client, page, pageSize, lastUpdatedMillis)
57
123
  return response.data;
58
124
  };
59
125
  var getVehiclesRealTime = async (client, pageSize = 500, lastUpdatedMillis) => {
60
- const schema2 = z.object({
61
- pageSize: z.number().min(1).default(500),
62
- lastUpdatedMillis: z.number().positive().optional()
126
+ const schema4 = z4.object({
127
+ pageSize: z4.number().min(1).default(500),
128
+ lastUpdatedMillis: z4.number().positive().optional()
63
129
  });
64
- const result = schema2.safeParse({ pageSize, lastUpdatedMillis });
130
+ const result = schema4.safeParse({ pageSize, lastUpdatedMillis });
65
131
  if (!result.success) {
66
132
  throw new TypeError("Invalid args", {
67
133
  cause: result.error.issues
@@ -95,30 +161,13 @@ var getVehiclesRealTime = async (client, pageSize = 500, lastUpdatedMillis) => {
95
161
  }
96
162
  return allVehicles;
97
163
  };
98
-
99
- // src/getVehicle.ts
100
- import { z as z2 } from "zod";
101
- var schema = z2.object({
102
- id: z2.string().trim().min(1).uuid()
103
- });
104
- var getVehicleById = async (client, id) => {
105
- const result = schema.safeParse({ id });
106
- if (!result.success) {
107
- throw new TypeError("Invalid args", {
108
- cause: result.error.issues
109
- });
110
- }
111
- return client.get(`boapi/proxy/user/vehicle/fleets/${client.clientOptions.fleetId}/vehicles/${result.data.id}`).then(({ data }) => data).catch((error) => {
112
- if (error.formattedError?.status === 404) {
113
- return null;
114
- }
115
- throw error;
116
- });
117
- };
118
164
  export {
165
+ getModelByIdAssets,
119
166
  getModels,
120
167
  getModelsById,
121
168
  getVehicleById,
169
+ getVehicleByIdAssets,
170
+ getVehicleRealTimeById,
122
171
  getVehicles,
123
172
  getVehiclesRealTime
124
173
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vulog/aima-vehicle",
3
- "version": "1.1.53",
3
+ "version": "1.1.54",
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.53",
23
- "@vulog/aima-core": "1.1.53"
22
+ "@vulog/aima-client": "1.1.54",
23
+ "@vulog/aima-core": "1.1.54"
24
24
  },
25
25
  "peerDependencies": {
26
26
  "zod": "^3.24.2"
@@ -0,0 +1,21 @@
1
+ import { Client } from '@vulog/aima-client';
2
+ import { z } from 'zod';
3
+
4
+ import { Assets } from './types';
5
+
6
+ const schema = z.object({
7
+ id: z.number().int().positive(),
8
+ });
9
+
10
+ export const getModelByIdAssets = async (client: Client, id: number): Promise<Assets> => {
11
+ const result = schema.safeParse({ id });
12
+ if (!result.success) {
13
+ throw new TypeError('Invalid args', {
14
+ cause: result.error.issues,
15
+ });
16
+ }
17
+
18
+ return client
19
+ .get<Assets>(`boapi/proxy/eds/rest_pub/rest/fleets/${client.clientOptions.fleetId}/models/${id}/`)
20
+ .then(({ data }) => data);
21
+ };
@@ -0,0 +1,21 @@
1
+ import { Client } from '@vulog/aima-client';
2
+ import { z } from 'zod';
3
+
4
+ import { Assets } from './types';
5
+
6
+ const schema = z.object({
7
+ id: z.string().uuid(),
8
+ });
9
+
10
+ export const getVehicleByIdAssets = async (client: Client, id: string): Promise<Assets> => {
11
+ const result = schema.safeParse({ id });
12
+ if (!result.success) {
13
+ throw new TypeError('Invalid args', {
14
+ cause: result.error.issues,
15
+ });
16
+ }
17
+
18
+ return client
19
+ .get<Assets>(`boapi/proxy/eds/rest_pub/rest/fleets/${client.clientOptions.fleetId}/vehicles/${id}/`)
20
+ .then(({ data }) => data);
21
+ };
package/src/index.ts CHANGED
@@ -1,5 +1,7 @@
1
- export { getModelsById } from './getModel';
2
- export { getModels } from './getModels';
3
- export { getVehicles, getVehiclesRealTime } from './getVehicles';
4
- export { getVehicleById } from './getVehicle';
5
- export type { Model, Vehicle } from './types';
1
+ export * from './getModel';
2
+ export * from './getModelAssets';
3
+ export * from './getModels';
4
+ export * from './getVehicle';
5
+ export * from './getVehicleAssets';
6
+ export * from './getVehicles';
7
+ export * from './types';
package/src/types.ts CHANGED
@@ -206,3 +206,18 @@ export type VehicleRealTime = {
206
206
  firmwareBuildDate: string;
207
207
  [key: string]: any;
208
208
  };
209
+
210
+ export type Assets = {
211
+ fleet_id: string;
212
+ model_id: number;
213
+ assets: {
214
+ aid: string;
215
+ type: string;
216
+ url: string | null;
217
+ value: number | null;
218
+ b_value: boolean | null;
219
+ text: string | null;
220
+ [key: string]: any;
221
+ }[];
222
+ [key: string]: any;
223
+ };