@vulog/aima-trip 1.2.29 → 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 +142 -0
- package/dist/index.d.cts +248 -0
- package/dist/index.d.mts +215 -208
- package/dist/index.mjs +99 -171
- package/package.json +20 -7
- package/{tsup.config.ts → tsdown.config.ts} +1 -1
- package/dist/index.d.ts +0 -241
- package/dist/index.js +0 -227
- /package/{.eslintrc.js → .eslintrc.cjs} +0 -0
package/dist/index.mjs
CHANGED
|
@@ -1,182 +1,110 @@
|
|
|
1
|
-
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
var addRemoveTripRelatedProduct = async (client, action, vehicleId, productId) => {
|
|
8
|
-
const result = schema.safeParse({ vehicleId, productId });
|
|
9
|
-
if (!result.success) {
|
|
10
|
-
throw new TypeError("Invalid args", {
|
|
11
|
-
cause: result.error.issues
|
|
12
|
-
});
|
|
13
|
-
}
|
|
14
|
-
await client[action === "ADD" ? "put" : "delete"](
|
|
15
|
-
`/boapi/proxy/fleetmanager/public/fleets/${client.clientOptions.fleetId}/vehicles/${result.data.vehicleId}/products/${result.data.productId}`
|
|
16
|
-
);
|
|
17
|
-
};
|
|
18
|
-
var addTripRelatedProduct = async (client, vehicleId, productId) => addRemoveTripRelatedProduct(client, "ADD", vehicleId, productId);
|
|
19
|
-
var removeTripRelatedProduct = async (client, vehicleId, productId) => addRemoveTripRelatedProduct(client, "REMOVE", vehicleId, productId);
|
|
20
|
-
|
|
21
|
-
// src/endTrip.ts
|
|
22
|
-
import z2 from "zod";
|
|
23
|
-
var schema2 = z2.object({
|
|
24
|
-
vehicleId: z2.string().trim().min(1).uuid(),
|
|
25
|
-
userId: z2.string().trim().min(1).uuid(),
|
|
26
|
-
orderId: z2.string().trim().min(1)
|
|
1
|
+
import z$1, { z } from "zod";
|
|
2
|
+
import { createPaginableOptionsSchema } from "@vulog/aima-core";
|
|
3
|
+
//#region src/addRemoveTripRelatedProduct.ts
|
|
4
|
+
const schema$1 = z$1.object({
|
|
5
|
+
vehicleId: z$1.string().trim().min(1).uuid(),
|
|
6
|
+
productId: z$1.string().trim().min(1).uuid()
|
|
27
7
|
});
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
await client.post(
|
|
36
|
-
`/boapi/proxy/fleetmanager/public/fleets/${client.clientOptions.fleetId}/vehicles/${result.data.vehicleId}/trip/end`,
|
|
37
|
-
{
|
|
38
|
-
userId: result.data.userId,
|
|
39
|
-
orderId: result.data.orderId
|
|
40
|
-
}
|
|
41
|
-
);
|
|
8
|
+
const addRemoveTripRelatedProduct = async (client, action, vehicleId, productId) => {
|
|
9
|
+
const result = schema$1.safeParse({
|
|
10
|
+
vehicleId,
|
|
11
|
+
productId
|
|
12
|
+
});
|
|
13
|
+
if (!result.success) throw new TypeError("Invalid args", { cause: result.error.issues });
|
|
14
|
+
await client[action === "ADD" ? "put" : "delete"](`/boapi/proxy/fleetmanager/public/fleets/${client.clientOptions.fleetId}/vehicles/${result.data.vehicleId}/products/${result.data.productId}`);
|
|
42
15
|
};
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
16
|
+
const addTripRelatedProduct = async (client, vehicleId, productId) => addRemoveTripRelatedProduct(client, "ADD", vehicleId, productId);
|
|
17
|
+
const removeTripRelatedProduct = async (client, vehicleId, productId) => addRemoveTripRelatedProduct(client, "REMOVE", vehicleId, productId);
|
|
18
|
+
//#endregion
|
|
19
|
+
//#region src/endTrip.ts
|
|
20
|
+
const schema = z$1.object({
|
|
21
|
+
vehicleId: z$1.string().trim().min(1).uuid(),
|
|
22
|
+
userId: z$1.string().trim().min(1).uuid(),
|
|
23
|
+
orderId: z$1.string().trim().min(1)
|
|
49
24
|
});
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
return client.get(`/boapi/proxy/fleetmanager/public/fleets/${client.clientOptions.fleetId}/book`).then(({ data }) => {
|
|
58
|
-
let filterData = data;
|
|
59
|
-
if (result.data.minDuration) {
|
|
60
|
-
filterData = filterData.filter((book) => {
|
|
61
|
-
if (!book.start_date) {
|
|
62
|
-
return false;
|
|
63
|
-
}
|
|
64
|
-
const startDate = new Date(book.start_date);
|
|
65
|
-
const now = /* @__PURE__ */ new Date();
|
|
66
|
-
const duration = (now.getTime() - startDate.getTime()) / 1e3;
|
|
67
|
-
return duration >= result.data.minDuration * 60;
|
|
68
|
-
});
|
|
69
|
-
}
|
|
70
|
-
if (result.data.boxStatus && result.data.boxStatus.length > 0) {
|
|
71
|
-
filterData = filterData.filter((book) => {
|
|
72
|
-
return result.data.boxStatus?.includes(book.box_status);
|
|
73
|
-
});
|
|
74
|
-
}
|
|
75
|
-
return filterData;
|
|
76
|
-
});
|
|
25
|
+
const endTrip = async (client, info) => {
|
|
26
|
+
const result = schema.safeParse(info);
|
|
27
|
+
if (!result.success) throw new TypeError("Invalid args", { cause: result.error.issues });
|
|
28
|
+
await client.post(`/boapi/proxy/fleetmanager/public/fleets/${client.clientOptions.fleetId}/vehicles/${result.data.vehicleId}/trip/end`, {
|
|
29
|
+
userId: result.data.userId,
|
|
30
|
+
orderId: result.data.orderId
|
|
31
|
+
});
|
|
77
32
|
};
|
|
78
|
-
|
|
79
|
-
|
|
33
|
+
//#endregion
|
|
34
|
+
//#region src/getVehiclesBooked.ts
|
|
35
|
+
const optionsSchema = z$1.object({
|
|
36
|
+
minDuration: z$1.number().positive().optional(),
|
|
37
|
+
boxStatus: z$1.array(z$1.number()).optional()
|
|
80
38
|
});
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
39
|
+
const getVehiclesBooked = async (client, options = {}) => {
|
|
40
|
+
const result = optionsSchema.safeParse(options);
|
|
41
|
+
if (!result.success) throw new TypeError("Invalid options", { cause: result.error.issues });
|
|
42
|
+
return client.get(`/boapi/proxy/fleetmanager/public/fleets/${client.clientOptions.fleetId}/book`).then(({ data }) => {
|
|
43
|
+
let filterData = data;
|
|
44
|
+
if (result.data.minDuration) filterData = filterData.filter((book) => {
|
|
45
|
+
if (!book.start_date) return false;
|
|
46
|
+
const startDate = new Date(book.start_date);
|
|
47
|
+
return ((/* @__PURE__ */ new Date()).getTime() - startDate.getTime()) / 1e3 >= result.data.minDuration * 60;
|
|
48
|
+
});
|
|
49
|
+
if (result.data.boxStatus && result.data.boxStatus.length > 0) filterData = filterData.filter((book) => {
|
|
50
|
+
return result.data.boxStatus?.includes(book.box_status);
|
|
51
|
+
});
|
|
52
|
+
return filterData;
|
|
53
|
+
});
|
|
96
54
|
};
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
});
|
|
55
|
+
const schemaByUserId$1 = z$1.object({ userId: z$1.string().trim().min(1).uuid() });
|
|
56
|
+
const getVehiclesBookedByUserId = async (client, userId) => {
|
|
57
|
+
const result = schemaByUserId$1.safeParse({ userId });
|
|
58
|
+
if (!result.success) throw new TypeError("Invalid args", { cause: result.error.issues });
|
|
59
|
+
return client.get(`/boapi/proxy/fleetmanager/public/fleets/${client.clientOptions.fleetId}/users/${result.data.userId}/vehicles`).then(({ data }) => data).catch((error) => {
|
|
60
|
+
if (error.formattedError?.status === 404) return [];
|
|
61
|
+
throw error;
|
|
62
|
+
});
|
|
106
63
|
};
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
if (error.formattedError?.status === 404) {
|
|
113
|
-
return {};
|
|
114
|
-
}
|
|
115
|
-
throw error;
|
|
116
|
-
});
|
|
64
|
+
const getVehicleBookedByTripId = async (client, tripId) => {
|
|
65
|
+
return client.get(`/boapi/proxy/fleetmanager/public/fleets/${client.clientOptions.fleetId}/trips/${tripId}/vehicle`).then(({ data }) => data).catch((error) => {
|
|
66
|
+
if (error.formattedError?.status === 404) return null;
|
|
67
|
+
throw error;
|
|
68
|
+
});
|
|
117
69
|
};
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
if (!result.success) {
|
|
127
|
-
throw new TypeError("Invalid parameters", {
|
|
128
|
-
cause: result.error.issues
|
|
129
|
-
});
|
|
130
|
-
}
|
|
131
|
-
return client.post(`/boapi/proxy/trip/fleets/${client.clientOptions.fleetId}/trips/ongoing`, { ids: tripIds }).then(({ data }) => data);
|
|
70
|
+
//#endregion
|
|
71
|
+
//#region src/getTripById.ts
|
|
72
|
+
const getTripById = async (client, tripId) => {
|
|
73
|
+
const { fleetId } = client.clientOptions;
|
|
74
|
+
return client.get(`/boapi/proxy/trip/fleets/${fleetId}/trips/${tripId}`).then(({ data }) => data).catch((error) => {
|
|
75
|
+
if (error.formattedError?.status === 404) return {};
|
|
76
|
+
throw error;
|
|
77
|
+
});
|
|
132
78
|
};
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
});
|
|
140
|
-
var getTripsByUserId = async (client, userId, options) => {
|
|
141
|
-
const result = schemaByUserId2.safeParse({ userId });
|
|
142
|
-
if (!result.success) {
|
|
143
|
-
throw new TypeError("Invalid userId", {
|
|
144
|
-
cause: result.error.issues
|
|
145
|
-
});
|
|
146
|
-
}
|
|
147
|
-
const PaginableOptionsSchema = createPaginableOptionsSchema(
|
|
148
|
-
void 0,
|
|
149
|
-
z5.enum(["date"]).optional().default("date")
|
|
150
|
-
).default({});
|
|
151
|
-
const resultOptions = PaginableOptionsSchema.safeParse(options);
|
|
152
|
-
if (!resultOptions.success) {
|
|
153
|
-
throw new TypeError("Invalid options", {
|
|
154
|
-
cause: resultOptions.error.issues
|
|
155
|
-
});
|
|
156
|
-
}
|
|
157
|
-
const finalOptions = resultOptions.data;
|
|
158
|
-
const searchParams = new URLSearchParams();
|
|
159
|
-
searchParams.append("page", finalOptions.page.toString());
|
|
160
|
-
searchParams.append("size", finalOptions.pageSize.toString());
|
|
161
|
-
searchParams.append("sort", `${finalOptions.sort.toString()},${finalOptions.sortDirection.toString()}`);
|
|
162
|
-
return client.get(`/boapi/proxy/trip/fleets/${client.clientOptions.fleetId}/trips/users/${userId}?${searchParams.toString()}`).then(({ data, headers }) => {
|
|
163
|
-
return {
|
|
164
|
-
data,
|
|
165
|
-
page: headers.number,
|
|
166
|
-
pageSize: headers.size,
|
|
167
|
-
total: headers.totalelements,
|
|
168
|
-
totalPages: headers.totalpages
|
|
169
|
-
};
|
|
170
|
-
});
|
|
79
|
+
//#endregion
|
|
80
|
+
//#region src/getOngoingTripPaymentsByTripIds.ts
|
|
81
|
+
const getOngoingTripPaymentsByTripIds = async (client, tripIds) => {
|
|
82
|
+
const result = z.object({ tripIds: z.array(z.string()).nonempty() }).safeParse({ tripIds });
|
|
83
|
+
if (!result.success) throw new TypeError("Invalid parameters", { cause: result.error.issues });
|
|
84
|
+
return client.post(`/boapi/proxy/trip/fleets/${client.clientOptions.fleetId}/trips/ongoing`, { ids: tripIds }).then(({ data }) => data);
|
|
171
85
|
};
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
86
|
+
//#endregion
|
|
87
|
+
//#region src/getTrips.ts
|
|
88
|
+
const schemaByUserId = z$1.object({ userId: z$1.string().trim().min(1).uuid() });
|
|
89
|
+
const getTripsByUserId = async (client, userId, options) => {
|
|
90
|
+
const result = schemaByUserId.safeParse({ userId });
|
|
91
|
+
if (!result.success) throw new TypeError("Invalid userId", { cause: result.error.issues });
|
|
92
|
+
const resultOptions = createPaginableOptionsSchema(void 0, z$1.enum(["date"]).optional().default("date")).default({}).safeParse(options);
|
|
93
|
+
if (!resultOptions.success) throw new TypeError("Invalid options", { cause: resultOptions.error.issues });
|
|
94
|
+
const finalOptions = resultOptions.data;
|
|
95
|
+
const searchParams = new URLSearchParams();
|
|
96
|
+
searchParams.append("page", finalOptions.page.toString());
|
|
97
|
+
searchParams.append("size", finalOptions.pageSize.toString());
|
|
98
|
+
searchParams.append("sort", `${finalOptions.sort.toString()},${finalOptions.sortDirection.toString()}`);
|
|
99
|
+
return client.get(`/boapi/proxy/trip/fleets/${client.clientOptions.fleetId}/trips/users/${userId}?${searchParams.toString()}`).then(({ data, headers }) => {
|
|
100
|
+
return {
|
|
101
|
+
data,
|
|
102
|
+
page: headers.number,
|
|
103
|
+
pageSize: headers.size,
|
|
104
|
+
total: headers.totalelements,
|
|
105
|
+
totalPages: headers.totalpages
|
|
106
|
+
};
|
|
107
|
+
});
|
|
182
108
|
};
|
|
109
|
+
//#endregion
|
|
110
|
+
export { addTripRelatedProduct, endTrip, getOngoingTripPaymentsByTripIds, getTripById, getTripsByUserId, getVehicleBookedByTripId, getVehiclesBooked, getVehiclesBookedByUserId, removeTripRelatedProduct };
|
package/package.json
CHANGED
|
@@ -1,12 +1,25 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vulog/aima-trip",
|
|
3
|
-
"
|
|
4
|
-
"
|
|
3
|
+
"type": "module",
|
|
4
|
+
"version": "1.2.31",
|
|
5
|
+
"main": "dist/index.cjs",
|
|
5
6
|
"module": "dist/index.mjs",
|
|
6
|
-
"types": "dist/index.d.
|
|
7
|
+
"types": "dist/index.d.cts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"import": {
|
|
11
|
+
"types": "./dist/index.d.mts",
|
|
12
|
+
"default": "./dist/index.mjs"
|
|
13
|
+
},
|
|
14
|
+
"require": {
|
|
15
|
+
"types": "./dist/index.d.cts",
|
|
16
|
+
"default": "./dist/index.cjs"
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
},
|
|
7
20
|
"scripts": {
|
|
8
|
-
"build": "
|
|
9
|
-
"dev": "
|
|
21
|
+
"build": "tsdown",
|
|
22
|
+
"dev": "tsdown --watch",
|
|
10
23
|
"test": "vitest run",
|
|
11
24
|
"test:watch": "vitest",
|
|
12
25
|
"lint": "eslint src/**/* --ext .ts"
|
|
@@ -19,8 +32,8 @@
|
|
|
19
32
|
"author": "Vulog",
|
|
20
33
|
"license": "MIT",
|
|
21
34
|
"dependencies": {
|
|
22
|
-
"@vulog/aima-client": "1.2.
|
|
23
|
-
"@vulog/aima-core": "1.2.
|
|
35
|
+
"@vulog/aima-client": "1.2.31",
|
|
36
|
+
"@vulog/aima-core": "1.2.31"
|
|
24
37
|
},
|
|
25
38
|
"peerDependencies": {
|
|
26
39
|
"zod": "^3.25.76"
|
package/dist/index.d.ts
DELETED
|
@@ -1,241 +0,0 @@
|
|
|
1
|
-
import { Client } from '@vulog/aima-client';
|
|
2
|
-
import z from 'zod';
|
|
3
|
-
import { UUID } from 'crypto';
|
|
4
|
-
import { PaginableOptions, PaginableResponse } from '@vulog/aima-core';
|
|
5
|
-
|
|
6
|
-
declare const addTripRelatedProduct: (client: Client, vehicleId: string, productId: string) => Promise<void>;
|
|
7
|
-
declare const removeTripRelatedProduct: (client: Client, vehicleId: string, productId: string) => Promise<void>;
|
|
8
|
-
|
|
9
|
-
type Zone = {
|
|
10
|
-
type: 'allowed' | 'forbidden';
|
|
11
|
-
version: number;
|
|
12
|
-
zoneId: string;
|
|
13
|
-
sticky: boolean;
|
|
14
|
-
labels: string[];
|
|
15
|
-
};
|
|
16
|
-
type FleetManagerBook = {
|
|
17
|
-
id: string;
|
|
18
|
-
name: string;
|
|
19
|
-
plate: string;
|
|
20
|
-
vin: string;
|
|
21
|
-
fleetid: string;
|
|
22
|
-
boxid: string;
|
|
23
|
-
vehicle_status: number;
|
|
24
|
-
zones: Zone[];
|
|
25
|
-
releasable: boolean;
|
|
26
|
-
box_status: number;
|
|
27
|
-
autonomy: number;
|
|
28
|
-
autonomy2: number;
|
|
29
|
-
isCharging: boolean;
|
|
30
|
-
battery: number;
|
|
31
|
-
km: number;
|
|
32
|
-
speed: number;
|
|
33
|
-
location: {
|
|
34
|
-
geohash: string;
|
|
35
|
-
cap: number;
|
|
36
|
-
latitude: number;
|
|
37
|
-
longitude: number;
|
|
38
|
-
gpsDate: string;
|
|
39
|
-
lastMovingDate: string;
|
|
40
|
-
};
|
|
41
|
-
endZoneIds: string[];
|
|
42
|
-
productIds: string[];
|
|
43
|
-
isDoorClosed: boolean | null;
|
|
44
|
-
isDoorLocked: boolean | null;
|
|
45
|
-
engineOn: boolean | null;
|
|
46
|
-
immobilizerOn: boolean | null;
|
|
47
|
-
secureOn: boolean | null;
|
|
48
|
-
spareLockOn: boolean | null;
|
|
49
|
-
pileLockOn: boolean | null;
|
|
50
|
-
helmetPresent: boolean | null;
|
|
51
|
-
helmet2Present: boolean | null;
|
|
52
|
-
helmetBoxLockOn: boolean | null;
|
|
53
|
-
helmet2LockOn: boolean | null;
|
|
54
|
-
userId: string;
|
|
55
|
-
user_locale: string;
|
|
56
|
-
rfid: string;
|
|
57
|
-
orderId: string;
|
|
58
|
-
gatewayUrl: string | null;
|
|
59
|
-
booking_status: number;
|
|
60
|
-
booking_date: string;
|
|
61
|
-
expiresOn: string;
|
|
62
|
-
last_active_date: string;
|
|
63
|
-
last_wakeUp_date: string | null;
|
|
64
|
-
version: string;
|
|
65
|
-
pricingId: string;
|
|
66
|
-
start_date: string;
|
|
67
|
-
theorStartDate: string | null;
|
|
68
|
-
theorEndDate: string | null;
|
|
69
|
-
startZones: Zone[];
|
|
70
|
-
endZones: Zone[];
|
|
71
|
-
disabled: boolean;
|
|
72
|
-
outOfServiceReason: string | null;
|
|
73
|
-
ignitionOffGeohash: string;
|
|
74
|
-
geohashNeighbours: string[];
|
|
75
|
-
cleanlinessStatus: boolean;
|
|
76
|
-
needsRedistribution: boolean;
|
|
77
|
-
batteryUnderThreshold: boolean;
|
|
78
|
-
isBeingTowed: boolean;
|
|
79
|
-
automaticallyEnableVehicleAfterRangeRecovery: boolean;
|
|
80
|
-
key?: {
|
|
81
|
-
sessionKey?: string | null;
|
|
82
|
-
token?: string | null;
|
|
83
|
-
deviceName?: string | null;
|
|
84
|
-
expirationDate?: string | null;
|
|
85
|
-
};
|
|
86
|
-
startTripLocation?: {
|
|
87
|
-
latitude?: number;
|
|
88
|
-
longitude?: number;
|
|
89
|
-
};
|
|
90
|
-
doNotTrack: boolean;
|
|
91
|
-
start_mileage: number;
|
|
92
|
-
profileType: 'Single' | 'Business';
|
|
93
|
-
lastOosDate?: string | null;
|
|
94
|
-
entityId: string;
|
|
95
|
-
hasAlerts: boolean;
|
|
96
|
-
firmwareModel: string;
|
|
97
|
-
comeFromApp: string;
|
|
98
|
-
vpChecksum: string;
|
|
99
|
-
serviceType: string;
|
|
100
|
-
preAuthEnabled: boolean;
|
|
101
|
-
username: string;
|
|
102
|
-
preauth_status: string;
|
|
103
|
-
profileId: string;
|
|
104
|
-
energyLevel: number;
|
|
105
|
-
energyLevelStart: number;
|
|
106
|
-
serviceId: string;
|
|
107
|
-
doors?: {
|
|
108
|
-
frontLeftClosed?: boolean | null;
|
|
109
|
-
frontRightClosed?: boolean | null;
|
|
110
|
-
rearLeftClosed?: boolean | null;
|
|
111
|
-
rearRightClosed?: boolean | null;
|
|
112
|
-
trunkClosed?: boolean | null;
|
|
113
|
-
};
|
|
114
|
-
doorsAndWindowsClosed: boolean;
|
|
115
|
-
handDelivered: boolean;
|
|
116
|
-
deviceIds: string[];
|
|
117
|
-
start_pause_date?: string;
|
|
118
|
-
billingGroupId?: string;
|
|
119
|
-
};
|
|
120
|
-
type EndTripInfo = {
|
|
121
|
-
vehicleId: string;
|
|
122
|
-
userId: string;
|
|
123
|
-
orderId: string;
|
|
124
|
-
};
|
|
125
|
-
type TripZone = {
|
|
126
|
-
zoneId: string;
|
|
127
|
-
version: number;
|
|
128
|
-
type: string;
|
|
129
|
-
sticky: boolean;
|
|
130
|
-
};
|
|
131
|
-
type TripLocation = {
|
|
132
|
-
latitude: number;
|
|
133
|
-
longitude: number;
|
|
134
|
-
};
|
|
135
|
-
type TripEvent = {
|
|
136
|
-
eventType: string;
|
|
137
|
-
timestamp: string;
|
|
138
|
-
parameters: string | null;
|
|
139
|
-
};
|
|
140
|
-
type TripOverriddenInfo = {
|
|
141
|
-
duration: {
|
|
142
|
-
adjustedBookDuration: number;
|
|
143
|
-
adjustedPauseDuration: number;
|
|
144
|
-
adjustedDrivingDuration: number;
|
|
145
|
-
};
|
|
146
|
-
};
|
|
147
|
-
type TripAdditionalInfo = {
|
|
148
|
-
firstDriveDelayMinutes: number;
|
|
149
|
-
bookDuration: number;
|
|
150
|
-
startZones: TripZone[];
|
|
151
|
-
endZones: TripZone[];
|
|
152
|
-
isAutolock: boolean;
|
|
153
|
-
isCancel: boolean;
|
|
154
|
-
isReleaseOnServer: boolean;
|
|
155
|
-
isBilled: boolean;
|
|
156
|
-
suspicious: boolean;
|
|
157
|
-
startLocation: TripLocation;
|
|
158
|
-
endLocation: TripLocation;
|
|
159
|
-
overriddenTripInfo: TripOverriddenInfo;
|
|
160
|
-
bypassBookingRequestCompleted: boolean;
|
|
161
|
-
ignoreOdometer: boolean;
|
|
162
|
-
startTripEventDate: string;
|
|
163
|
-
};
|
|
164
|
-
type Trip = {
|
|
165
|
-
id: string;
|
|
166
|
-
tripId: string;
|
|
167
|
-
fleetId: string;
|
|
168
|
-
userId: string;
|
|
169
|
-
profileId: string;
|
|
170
|
-
profileType: string;
|
|
171
|
-
vehicleId: string;
|
|
172
|
-
length: number;
|
|
173
|
-
duration: number;
|
|
174
|
-
pauseDuration: number;
|
|
175
|
-
tripDuration: number;
|
|
176
|
-
bookingDuration: number;
|
|
177
|
-
drivingDuration: number;
|
|
178
|
-
date: string;
|
|
179
|
-
endDate: string;
|
|
180
|
-
additionalInfo: TripAdditionalInfo;
|
|
181
|
-
pricingId: string;
|
|
182
|
-
productIds: string[];
|
|
183
|
-
serviceId: string;
|
|
184
|
-
serviceType: string;
|
|
185
|
-
theorStartDate: string;
|
|
186
|
-
theorEndDate: string;
|
|
187
|
-
ticketInfo: any;
|
|
188
|
-
tripEvents: TripEvent[];
|
|
189
|
-
lastUpdateDate: string;
|
|
190
|
-
};
|
|
191
|
-
|
|
192
|
-
declare const endTrip: (client: Client, info: EndTripInfo) => Promise<void>;
|
|
193
|
-
|
|
194
|
-
declare const optionsSchema: z.ZodObject<{
|
|
195
|
-
minDuration: z.ZodOptional<z.ZodNumber>;
|
|
196
|
-
boxStatus: z.ZodOptional<z.ZodArray<z.ZodNumber, "many">>;
|
|
197
|
-
}, "strip", z.ZodTypeAny, {
|
|
198
|
-
minDuration?: number | undefined;
|
|
199
|
-
boxStatus?: number[] | undefined;
|
|
200
|
-
}, {
|
|
201
|
-
minDuration?: number | undefined;
|
|
202
|
-
boxStatus?: number[] | undefined;
|
|
203
|
-
}>;
|
|
204
|
-
declare const getVehiclesBooked: (client: Client, options?: z.infer<typeof optionsSchema>) => Promise<FleetManagerBook[]>;
|
|
205
|
-
declare const getVehiclesBookedByUserId: (client: Client, userId: string) => Promise<FleetManagerBook[]>;
|
|
206
|
-
declare const getVehicleBookedByTripId: (client: Client, tripId: string) => Promise<FleetManagerBook | null>;
|
|
207
|
-
|
|
208
|
-
declare const getTripById: (client: Client, tripId: string) => Promise<Trip | Record<string, never>>;
|
|
209
|
-
|
|
210
|
-
type PaymentReceipt = {
|
|
211
|
-
id: string;
|
|
212
|
-
pspName: string;
|
|
213
|
-
pspReference: string;
|
|
214
|
-
pspPublishableKey: string;
|
|
215
|
-
amount: number;
|
|
216
|
-
currency: string;
|
|
217
|
-
date: string;
|
|
218
|
-
status: 'PAID' | 'REFUNDED';
|
|
219
|
-
paymentMethodType: string;
|
|
220
|
-
paymentMethodPspReference: string;
|
|
221
|
-
paymentIntentPspReference: string;
|
|
222
|
-
number: number;
|
|
223
|
-
code: string;
|
|
224
|
-
declineCode: string;
|
|
225
|
-
pspClientSecret: string;
|
|
226
|
-
reason: string;
|
|
227
|
-
note: string;
|
|
228
|
-
};
|
|
229
|
-
type Payment = {
|
|
230
|
-
paymentReceipts?: PaymentReceipt[];
|
|
231
|
-
id: string;
|
|
232
|
-
fleetId: string;
|
|
233
|
-
profileId: UUID;
|
|
234
|
-
vehicleId: UUID;
|
|
235
|
-
serviceId: UUID;
|
|
236
|
-
};
|
|
237
|
-
declare const getOngoingTripPaymentsByTripIds: (client: Client, tripIds: string[]) => Promise<Payment[]>;
|
|
238
|
-
|
|
239
|
-
declare const getTripsByUserId: (client: Client, userId: string, options?: PaginableOptions<void, "date">) => Promise<PaginableResponse<Trip>>;
|
|
240
|
-
|
|
241
|
-
export { type EndTripInfo, type FleetManagerBook, type Payment, type PaymentReceipt, type Trip, type TripAdditionalInfo, type TripEvent, type TripLocation, type TripOverriddenInfo, type TripZone, type Zone, addTripRelatedProduct, endTrip, getOngoingTripPaymentsByTripIds, getTripById, getTripsByUserId, getVehicleBookedByTripId, getVehiclesBooked, getVehiclesBookedByUserId, removeTripRelatedProduct };
|