@vulog/aima-vehicle 1.2.7 → 1.2.9
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 +10 -1
- package/dist/index.d.ts +10 -1
- package/dist/index.js +40 -0
- package/dist/index.mjs +39 -0
- package/package.json +3 -3
package/dist/index.d.mts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Client } from '@vulog/aima-client';
|
|
2
|
+
import { PaginableOptions, PaginableResponse } from '@vulog/aima-core';
|
|
2
3
|
|
|
3
4
|
/**
|
|
4
5
|
* Represents a vehicle model with its specifications and characteristics
|
|
@@ -218,6 +219,12 @@ type Assets = {
|
|
|
218
219
|
}[];
|
|
219
220
|
[key: string]: any;
|
|
220
221
|
};
|
|
222
|
+
type ModelVehicle = {
|
|
223
|
+
serviceId: string;
|
|
224
|
+
serviceVisibility: 'PUBLIC' | 'PRIVATE';
|
|
225
|
+
modelId: number;
|
|
226
|
+
vehicles: string[];
|
|
227
|
+
};
|
|
221
228
|
|
|
222
229
|
declare const getModelsById: (client: Client, id: number) => Promise<Model>;
|
|
223
230
|
|
|
@@ -266,4 +273,6 @@ type DisableVehicleBody = {
|
|
|
266
273
|
};
|
|
267
274
|
declare const disableVehicle: (client: Client, vehicleId: string, payload: DisableVehicleBody) => Promise<void>;
|
|
268
275
|
|
|
269
|
-
|
|
276
|
+
declare const getModelVehicles: (client: Client, options?: PaginableOptions) => Promise<PaginableResponse<ModelVehicle>>;
|
|
277
|
+
|
|
278
|
+
export { type Assets, type DisableVehicleBody, type EnableVehicleBody, type Model, type ModelVehicle, type Options, type Vehicle, type VehicleRealTime, type Zone, disableVehicle, enableVehicle, getModelByIdAssets, getModelVehicles, getModels, getModelsById, getVehicleById, getVehicleByIdAssets, getVehicleRealTimeById, getVehicles, getVehiclesRealTime, pingVehicleById };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Client } from '@vulog/aima-client';
|
|
2
|
+
import { PaginableOptions, PaginableResponse } from '@vulog/aima-core';
|
|
2
3
|
|
|
3
4
|
/**
|
|
4
5
|
* Represents a vehicle model with its specifications and characteristics
|
|
@@ -218,6 +219,12 @@ type Assets = {
|
|
|
218
219
|
}[];
|
|
219
220
|
[key: string]: any;
|
|
220
221
|
};
|
|
222
|
+
type ModelVehicle = {
|
|
223
|
+
serviceId: string;
|
|
224
|
+
serviceVisibility: 'PUBLIC' | 'PRIVATE';
|
|
225
|
+
modelId: number;
|
|
226
|
+
vehicles: string[];
|
|
227
|
+
};
|
|
221
228
|
|
|
222
229
|
declare const getModelsById: (client: Client, id: number) => Promise<Model>;
|
|
223
230
|
|
|
@@ -266,4 +273,6 @@ type DisableVehicleBody = {
|
|
|
266
273
|
};
|
|
267
274
|
declare const disableVehicle: (client: Client, vehicleId: string, payload: DisableVehicleBody) => Promise<void>;
|
|
268
275
|
|
|
269
|
-
|
|
276
|
+
declare const getModelVehicles: (client: Client, options?: PaginableOptions) => Promise<PaginableResponse<ModelVehicle>>;
|
|
277
|
+
|
|
278
|
+
export { type Assets, type DisableVehicleBody, type EnableVehicleBody, type Model, type ModelVehicle, type Options, type Vehicle, type VehicleRealTime, type Zone, disableVehicle, enableVehicle, getModelByIdAssets, getModelVehicles, getModels, getModelsById, getVehicleById, getVehicleByIdAssets, getVehicleRealTimeById, getVehicles, getVehiclesRealTime, pingVehicleById };
|
package/dist/index.js
CHANGED
|
@@ -33,6 +33,7 @@ __export(index_exports, {
|
|
|
33
33
|
disableVehicle: () => disableVehicle,
|
|
34
34
|
enableVehicle: () => enableVehicle,
|
|
35
35
|
getModelByIdAssets: () => getModelByIdAssets,
|
|
36
|
+
getModelVehicles: () => getModelVehicles,
|
|
36
37
|
getModels: () => getModels,
|
|
37
38
|
getModelsById: () => getModelsById,
|
|
38
39
|
getVehicleById: () => getVehicleById,
|
|
@@ -268,11 +269,50 @@ var disableVehicle = async (client, vehicleId, payload) => {
|
|
|
268
269
|
payload
|
|
269
270
|
).then(({ data }) => data);
|
|
270
271
|
};
|
|
272
|
+
|
|
273
|
+
// src/getModelVehicles.ts
|
|
274
|
+
var import_aima_core = require("@vulog/aima-core");
|
|
275
|
+
var getModelVehicles = async (client, options) => {
|
|
276
|
+
const PaginableOptionsSchema = (0, import_aima_core.createPaginableOptionsSchema)().default({});
|
|
277
|
+
const resultOptions = PaginableOptionsSchema.safeParse(options);
|
|
278
|
+
if (!resultOptions.success) {
|
|
279
|
+
throw new TypeError("Invalid options", {
|
|
280
|
+
cause: resultOptions.error.issues
|
|
281
|
+
});
|
|
282
|
+
}
|
|
283
|
+
const finalOptions = resultOptions.data;
|
|
284
|
+
const searchParams = new URLSearchParams();
|
|
285
|
+
searchParams.append("page", finalOptions.page.toString());
|
|
286
|
+
searchParams.append("pageSize", finalOptions.pageSize.toString());
|
|
287
|
+
if (finalOptions.sort) {
|
|
288
|
+
searchParams.append("sort", `${finalOptions.sort.toString()},${finalOptions.sortDirection.toString()}`);
|
|
289
|
+
}
|
|
290
|
+
if (finalOptions.filters) {
|
|
291
|
+
Object.entries(finalOptions.filters).forEach(([key, value]) => {
|
|
292
|
+
if (value === void 0) {
|
|
293
|
+
return;
|
|
294
|
+
}
|
|
295
|
+
searchParams.append(key, value);
|
|
296
|
+
});
|
|
297
|
+
}
|
|
298
|
+
const basePath = `boapi/proxy/user/vehicle/fleets/${client.clientOptions.fleetId}/vehicles/models/modelvehicles`;
|
|
299
|
+
const urlWithParams = `${basePath}?${searchParams.toString()}`;
|
|
300
|
+
return client.get(urlWithParams).then(({ data, headers }) => {
|
|
301
|
+
return {
|
|
302
|
+
data,
|
|
303
|
+
page: headers.number,
|
|
304
|
+
pageSize: headers.size,
|
|
305
|
+
total: headers.totalelements,
|
|
306
|
+
totalPages: headers.totalpages
|
|
307
|
+
};
|
|
308
|
+
});
|
|
309
|
+
};
|
|
271
310
|
// Annotate the CommonJS export names for ESM import in node:
|
|
272
311
|
0 && (module.exports = {
|
|
273
312
|
disableVehicle,
|
|
274
313
|
enableVehicle,
|
|
275
314
|
getModelByIdAssets,
|
|
315
|
+
getModelVehicles,
|
|
276
316
|
getModels,
|
|
277
317
|
getModelsById,
|
|
278
318
|
getVehicleById,
|
package/dist/index.mjs
CHANGED
|
@@ -222,10 +222,49 @@ var disableVehicle = async (client, vehicleId, payload) => {
|
|
|
222
222
|
payload
|
|
223
223
|
).then(({ data }) => data);
|
|
224
224
|
};
|
|
225
|
+
|
|
226
|
+
// src/getModelVehicles.ts
|
|
227
|
+
import { createPaginableOptionsSchema } from "@vulog/aima-core";
|
|
228
|
+
var getModelVehicles = async (client, options) => {
|
|
229
|
+
const PaginableOptionsSchema = createPaginableOptionsSchema().default({});
|
|
230
|
+
const resultOptions = PaginableOptionsSchema.safeParse(options);
|
|
231
|
+
if (!resultOptions.success) {
|
|
232
|
+
throw new TypeError("Invalid options", {
|
|
233
|
+
cause: resultOptions.error.issues
|
|
234
|
+
});
|
|
235
|
+
}
|
|
236
|
+
const finalOptions = resultOptions.data;
|
|
237
|
+
const searchParams = new URLSearchParams();
|
|
238
|
+
searchParams.append("page", finalOptions.page.toString());
|
|
239
|
+
searchParams.append("pageSize", finalOptions.pageSize.toString());
|
|
240
|
+
if (finalOptions.sort) {
|
|
241
|
+
searchParams.append("sort", `${finalOptions.sort.toString()},${finalOptions.sortDirection.toString()}`);
|
|
242
|
+
}
|
|
243
|
+
if (finalOptions.filters) {
|
|
244
|
+
Object.entries(finalOptions.filters).forEach(([key, value]) => {
|
|
245
|
+
if (value === void 0) {
|
|
246
|
+
return;
|
|
247
|
+
}
|
|
248
|
+
searchParams.append(key, value);
|
|
249
|
+
});
|
|
250
|
+
}
|
|
251
|
+
const basePath = `boapi/proxy/user/vehicle/fleets/${client.clientOptions.fleetId}/vehicles/models/modelvehicles`;
|
|
252
|
+
const urlWithParams = `${basePath}?${searchParams.toString()}`;
|
|
253
|
+
return client.get(urlWithParams).then(({ data, headers }) => {
|
|
254
|
+
return {
|
|
255
|
+
data,
|
|
256
|
+
page: headers.number,
|
|
257
|
+
pageSize: headers.size,
|
|
258
|
+
total: headers.totalelements,
|
|
259
|
+
totalPages: headers.totalpages
|
|
260
|
+
};
|
|
261
|
+
});
|
|
262
|
+
};
|
|
225
263
|
export {
|
|
226
264
|
disableVehicle,
|
|
227
265
|
enableVehicle,
|
|
228
266
|
getModelByIdAssets,
|
|
267
|
+
getModelVehicles,
|
|
229
268
|
getModels,
|
|
230
269
|
getModelsById,
|
|
231
270
|
getVehicleById,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vulog/aima-vehicle",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.9",
|
|
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": "MIT",
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@vulog/aima-client": "1.2.
|
|
23
|
-
"@vulog/aima-core": "1.2.
|
|
22
|
+
"@vulog/aima-client": "1.2.9",
|
|
23
|
+
"@vulog/aima-core": "1.2.9"
|
|
24
24
|
},
|
|
25
25
|
"peerDependencies": {
|
|
26
26
|
"zod": "^3.25.76"
|