@vulog/aima-vehicle 1.1.93 → 1.1.94
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 +11 -1
- package/dist/index.d.ts +11 -1
- package/dist/index.js +54 -4
- package/dist/index.mjs +42 -4
- package/package.json +3 -3
- package/src/disableVehicle.ts +26 -0
- package/src/enableVehicle.ts +26 -0
- package/src/index.ts +2 -0
package/dist/index.d.mts
CHANGED
|
@@ -256,4 +256,14 @@ declare const getVehiclesRealTime: (client: Client, pageSize?: number, lastUpdat
|
|
|
256
256
|
*/
|
|
257
257
|
declare const pingVehicleById: (client: Client, id: string) => Promise<boolean>;
|
|
258
258
|
|
|
259
|
-
|
|
259
|
+
type EnableVehicleBody = {
|
|
260
|
+
subStatus: string;
|
|
261
|
+
};
|
|
262
|
+
declare const enableVehicle: (client: Client, vehicleId: number, payload: EnableVehicleBody) => Promise<void>;
|
|
263
|
+
|
|
264
|
+
type DisableVehicleBody = {
|
|
265
|
+
subStatus: string;
|
|
266
|
+
};
|
|
267
|
+
declare const disableVehicle: (client: Client, vehicleId: number, payload: DisableVehicleBody) => Promise<void>;
|
|
268
|
+
|
|
269
|
+
export { type Assets, type DisableVehicleBody, type EnableVehicleBody, type Model, type Options, type Vehicle, type VehicleRealTime, type Zone, disableVehicle, enableVehicle, getModelByIdAssets, getModels, getModelsById, getVehicleById, getVehicleByIdAssets, getVehicleRealTimeById, getVehicles, getVehiclesRealTime, pingVehicleById };
|
package/dist/index.d.ts
CHANGED
|
@@ -256,4 +256,14 @@ declare const getVehiclesRealTime: (client: Client, pageSize?: number, lastUpdat
|
|
|
256
256
|
*/
|
|
257
257
|
declare const pingVehicleById: (client: Client, id: string) => Promise<boolean>;
|
|
258
258
|
|
|
259
|
-
|
|
259
|
+
type EnableVehicleBody = {
|
|
260
|
+
subStatus: string;
|
|
261
|
+
};
|
|
262
|
+
declare const enableVehicle: (client: Client, vehicleId: number, payload: EnableVehicleBody) => Promise<void>;
|
|
263
|
+
|
|
264
|
+
type DisableVehicleBody = {
|
|
265
|
+
subStatus: string;
|
|
266
|
+
};
|
|
267
|
+
declare const disableVehicle: (client: Client, vehicleId: number, payload: DisableVehicleBody) => Promise<void>;
|
|
268
|
+
|
|
269
|
+
export { type Assets, type DisableVehicleBody, type EnableVehicleBody, type Model, type Options, type Vehicle, type VehicleRealTime, type Zone, disableVehicle, enableVehicle, getModelByIdAssets, getModels, getModelsById, getVehicleById, getVehicleByIdAssets, getVehicleRealTimeById, getVehicles, getVehiclesRealTime, pingVehicleById };
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
2
3
|
var __defProp = Object.defineProperty;
|
|
3
4
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
5
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
8
|
var __export = (target, all) => {
|
|
7
9
|
for (var name in all)
|
|
@@ -15,11 +17,21 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
15
17
|
}
|
|
16
18
|
return to;
|
|
17
19
|
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
18
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
29
|
|
|
20
30
|
// src/index.ts
|
|
21
31
|
var index_exports = {};
|
|
22
32
|
__export(index_exports, {
|
|
33
|
+
disableVehicle: () => disableVehicle,
|
|
34
|
+
enableVehicle: () => enableVehicle,
|
|
23
35
|
getModelByIdAssets: () => getModelByIdAssets,
|
|
24
36
|
getModels: () => getModels,
|
|
25
37
|
getModelsById: () => getModelsById,
|
|
@@ -117,10 +129,10 @@ var getVehiclesPage = async (client, page, pageSize) => {
|
|
|
117
129
|
return response.data;
|
|
118
130
|
};
|
|
119
131
|
var getVehicles = async (client, pageSize = 500) => {
|
|
120
|
-
const
|
|
132
|
+
const schema7 = import_zod4.z.object({
|
|
121
133
|
pageSize: import_zod4.z.number().min(1).default(500)
|
|
122
134
|
});
|
|
123
|
-
const result =
|
|
135
|
+
const result = schema7.safeParse({ pageSize });
|
|
124
136
|
if (!result.success) {
|
|
125
137
|
throw new TypeError("Invalid args", {
|
|
126
138
|
cause: result.error.issues
|
|
@@ -157,11 +169,11 @@ var getVehiclesRealTimePage = async (client, page, pageSize, lastUpdatedMillis)
|
|
|
157
169
|
return response.data;
|
|
158
170
|
};
|
|
159
171
|
var getVehiclesRealTime = async (client, pageSize = 500, lastUpdatedMillis) => {
|
|
160
|
-
const
|
|
172
|
+
const schema7 = import_zod4.z.object({
|
|
161
173
|
pageSize: import_zod4.z.number().min(1).default(500),
|
|
162
174
|
lastUpdatedMillis: import_zod4.z.number().positive().optional()
|
|
163
175
|
});
|
|
164
|
-
const result =
|
|
176
|
+
const result = schema7.safeParse({ pageSize, lastUpdatedMillis });
|
|
165
177
|
if (!result.success) {
|
|
166
178
|
throw new TypeError("Invalid args", {
|
|
167
179
|
cause: result.error.issues
|
|
@@ -220,8 +232,46 @@ var pingVehicleById = async (client, id) => {
|
|
|
220
232
|
throw error;
|
|
221
233
|
}
|
|
222
234
|
};
|
|
235
|
+
|
|
236
|
+
// src/enableVehicle.ts
|
|
237
|
+
var import_zod6 = __toESM(require("zod"));
|
|
238
|
+
var schema5 = import_zod6.default.object({
|
|
239
|
+
subStatus: import_zod6.default.string()
|
|
240
|
+
});
|
|
241
|
+
var enableVehicle = async (client, vehicleId, payload) => {
|
|
242
|
+
const result = schema5.safeParse(payload);
|
|
243
|
+
if (!result.success) {
|
|
244
|
+
throw new TypeError("Invalid args", {
|
|
245
|
+
cause: result.error.issues
|
|
246
|
+
});
|
|
247
|
+
}
|
|
248
|
+
return client.post(
|
|
249
|
+
`boapi/proxy/fleetmanager/public/fleets/${client.clientOptions.fleetId}/vehicles/${vehicleId}/enable`,
|
|
250
|
+
payload
|
|
251
|
+
).then(({ data }) => data);
|
|
252
|
+
};
|
|
253
|
+
|
|
254
|
+
// src/disableVehicle.ts
|
|
255
|
+
var import_zod7 = __toESM(require("zod"));
|
|
256
|
+
var schema6 = import_zod7.default.object({
|
|
257
|
+
subStatus: import_zod7.default.string()
|
|
258
|
+
});
|
|
259
|
+
var disableVehicle = async (client, vehicleId, payload) => {
|
|
260
|
+
const result = schema6.safeParse(payload);
|
|
261
|
+
if (!result.success) {
|
|
262
|
+
throw new TypeError("Invalid args", {
|
|
263
|
+
cause: result.error.issues
|
|
264
|
+
});
|
|
265
|
+
}
|
|
266
|
+
return client.post(
|
|
267
|
+
`boapi/proxy/fleetmanager/public/fleets/${client.clientOptions.fleetId}/vehicles/${vehicleId}/disable`,
|
|
268
|
+
payload
|
|
269
|
+
).then(({ data }) => data);
|
|
270
|
+
};
|
|
223
271
|
// Annotate the CommonJS export names for ESM import in node:
|
|
224
272
|
0 && (module.exports = {
|
|
273
|
+
disableVehicle,
|
|
274
|
+
enableVehicle,
|
|
225
275
|
getModelByIdAssets,
|
|
226
276
|
getModels,
|
|
227
277
|
getModelsById,
|
package/dist/index.mjs
CHANGED
|
@@ -83,10 +83,10 @@ var getVehiclesPage = async (client, page, pageSize) => {
|
|
|
83
83
|
return response.data;
|
|
84
84
|
};
|
|
85
85
|
var getVehicles = async (client, pageSize = 500) => {
|
|
86
|
-
const
|
|
86
|
+
const schema7 = z4.object({
|
|
87
87
|
pageSize: z4.number().min(1).default(500)
|
|
88
88
|
});
|
|
89
|
-
const result =
|
|
89
|
+
const result = schema7.safeParse({ pageSize });
|
|
90
90
|
if (!result.success) {
|
|
91
91
|
throw new TypeError("Invalid args", {
|
|
92
92
|
cause: result.error.issues
|
|
@@ -123,11 +123,11 @@ var getVehiclesRealTimePage = async (client, page, pageSize, lastUpdatedMillis)
|
|
|
123
123
|
return response.data;
|
|
124
124
|
};
|
|
125
125
|
var getVehiclesRealTime = async (client, pageSize = 500, lastUpdatedMillis) => {
|
|
126
|
-
const
|
|
126
|
+
const schema7 = z4.object({
|
|
127
127
|
pageSize: z4.number().min(1).default(500),
|
|
128
128
|
lastUpdatedMillis: z4.number().positive().optional()
|
|
129
129
|
});
|
|
130
|
-
const result =
|
|
130
|
+
const result = schema7.safeParse({ pageSize, lastUpdatedMillis });
|
|
131
131
|
if (!result.success) {
|
|
132
132
|
throw new TypeError("Invalid args", {
|
|
133
133
|
cause: result.error.issues
|
|
@@ -186,7 +186,45 @@ var pingVehicleById = async (client, id) => {
|
|
|
186
186
|
throw error;
|
|
187
187
|
}
|
|
188
188
|
};
|
|
189
|
+
|
|
190
|
+
// src/enableVehicle.ts
|
|
191
|
+
import z6 from "zod";
|
|
192
|
+
var schema5 = z6.object({
|
|
193
|
+
subStatus: z6.string()
|
|
194
|
+
});
|
|
195
|
+
var enableVehicle = async (client, vehicleId, payload) => {
|
|
196
|
+
const result = schema5.safeParse(payload);
|
|
197
|
+
if (!result.success) {
|
|
198
|
+
throw new TypeError("Invalid args", {
|
|
199
|
+
cause: result.error.issues
|
|
200
|
+
});
|
|
201
|
+
}
|
|
202
|
+
return client.post(
|
|
203
|
+
`boapi/proxy/fleetmanager/public/fleets/${client.clientOptions.fleetId}/vehicles/${vehicleId}/enable`,
|
|
204
|
+
payload
|
|
205
|
+
).then(({ data }) => data);
|
|
206
|
+
};
|
|
207
|
+
|
|
208
|
+
// src/disableVehicle.ts
|
|
209
|
+
import z7 from "zod";
|
|
210
|
+
var schema6 = z7.object({
|
|
211
|
+
subStatus: z7.string()
|
|
212
|
+
});
|
|
213
|
+
var disableVehicle = async (client, vehicleId, payload) => {
|
|
214
|
+
const result = schema6.safeParse(payload);
|
|
215
|
+
if (!result.success) {
|
|
216
|
+
throw new TypeError("Invalid args", {
|
|
217
|
+
cause: result.error.issues
|
|
218
|
+
});
|
|
219
|
+
}
|
|
220
|
+
return client.post(
|
|
221
|
+
`boapi/proxy/fleetmanager/public/fleets/${client.clientOptions.fleetId}/vehicles/${vehicleId}/disable`,
|
|
222
|
+
payload
|
|
223
|
+
).then(({ data }) => data);
|
|
224
|
+
};
|
|
189
225
|
export {
|
|
226
|
+
disableVehicle,
|
|
227
|
+
enableVehicle,
|
|
190
228
|
getModelByIdAssets,
|
|
191
229
|
getModels,
|
|
192
230
|
getModelsById,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vulog/aima-vehicle",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.94",
|
|
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.1.
|
|
23
|
-
"@vulog/aima-core": "1.1.
|
|
22
|
+
"@vulog/aima-client": "1.1.94",
|
|
23
|
+
"@vulog/aima-core": "1.1.94"
|
|
24
24
|
},
|
|
25
25
|
"peerDependencies": {
|
|
26
26
|
"zod": "^3.25.76"
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { Client } from '@vulog/aima-client';
|
|
2
|
+
|
|
3
|
+
import z from 'zod';
|
|
4
|
+
|
|
5
|
+
export type DisableVehicleBody = {
|
|
6
|
+
subStatus: string;
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
const schema = z.object({
|
|
10
|
+
subStatus: z.string(),
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
export const disableVehicle = async (client: Client, vehicleId: number, payload: DisableVehicleBody): Promise<void> => {
|
|
14
|
+
const result = schema.safeParse(payload);
|
|
15
|
+
if (!result.success) {
|
|
16
|
+
throw new TypeError('Invalid args', {
|
|
17
|
+
cause: result.error.issues,
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
return client
|
|
21
|
+
.post<void>(
|
|
22
|
+
`boapi/proxy/fleetmanager/public/fleets/${client.clientOptions.fleetId}/vehicles/${vehicleId}/disable`,
|
|
23
|
+
payload
|
|
24
|
+
)
|
|
25
|
+
.then(({ data }) => data);
|
|
26
|
+
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { Client } from '@vulog/aima-client';
|
|
2
|
+
|
|
3
|
+
import z from 'zod';
|
|
4
|
+
|
|
5
|
+
export type EnableVehicleBody = {
|
|
6
|
+
subStatus: string;
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
const schema = z.object({
|
|
10
|
+
subStatus: z.string(),
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
export const enableVehicle = async (client: Client, vehicleId: number, payload: EnableVehicleBody): Promise<void> => {
|
|
14
|
+
const result = schema.safeParse(payload);
|
|
15
|
+
if (!result.success) {
|
|
16
|
+
throw new TypeError('Invalid args', {
|
|
17
|
+
cause: result.error.issues,
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
return client
|
|
21
|
+
.post<void>(
|
|
22
|
+
`boapi/proxy/fleetmanager/public/fleets/${client.clientOptions.fleetId}/vehicles/${vehicleId}/enable`,
|
|
23
|
+
payload
|
|
24
|
+
)
|
|
25
|
+
.then(({ data }) => data);
|
|
26
|
+
};
|