@vulog/aima-event 1.1.74 → 1.1.76

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.js CHANGED
@@ -301,9 +301,13 @@ var getEvents = async (client, options) => {
301
301
  var getEventsByTripId = async (client, tripId, options) => {
302
302
  const EventFiltersSchema = import_zod.z.object({
303
303
  startDate: import_zod.z.string().datetime({ offset: false, precision: 0 }).optional(),
304
- endDate: import_zod.z.string().datetime({ offset: false, precision: 0 }).optional()
304
+ endDate: import_zod.z.string().datetime({ offset: false, precision: 0 }).optional(),
305
+ type: import_zod.z.array(EventTypeList).optional()
305
306
  });
306
- const PaginableOptionsSchema = (0, import_aima_core.createPaginableOptionsSchema)(EventFiltersSchema).default({});
307
+ const PaginableOptionsSchema = (0, import_aima_core.createPaginableOptionsSchema)(
308
+ EventFiltersSchema,
309
+ import_zod.z.enum(["date"]).optional()
310
+ ).default({});
307
311
  const resultOptions = PaginableOptionsSchema.safeParse(options);
308
312
  if (!resultOptions.success) {
309
313
  throw new TypeError("Invalid options", {
@@ -314,10 +318,16 @@ var getEventsByTripId = async (client, tripId, options) => {
314
318
  const searchParams = new URLSearchParams();
315
319
  searchParams.append("page", finalOptions.page.toString());
316
320
  searchParams.append("pageSize", finalOptions.pageSize.toString());
321
+ searchParams.append("sort", finalOptions.sort.toString());
322
+ searchParams.append("sortDirection", finalOptions.sortDirection.toString());
317
323
  Object.entries(finalOptions.filters).forEach(([key, value]) => {
318
324
  if (value === void 0) {
319
325
  return;
320
326
  }
327
+ if (Array.isArray(value)) {
328
+ searchParams.append(key, value.join(","));
329
+ return;
330
+ }
321
331
  searchParams.append(key, value);
322
332
  });
323
333
  return client.get(`/boapi/proxy/user/fleets/${client.clientOptions.fleetId}/events/trips/${tripId}?${searchParams.toString()}`).then(({ data, headers }) => {
package/dist/index.mjs CHANGED
@@ -273,9 +273,13 @@ var getEvents = async (client, options) => {
273
273
  var getEventsByTripId = async (client, tripId, options) => {
274
274
  const EventFiltersSchema = z.object({
275
275
  startDate: z.string().datetime({ offset: false, precision: 0 }).optional(),
276
- endDate: z.string().datetime({ offset: false, precision: 0 }).optional()
276
+ endDate: z.string().datetime({ offset: false, precision: 0 }).optional(),
277
+ type: z.array(EventTypeList).optional()
277
278
  });
278
- const PaginableOptionsSchema = createPaginableOptionsSchema(EventFiltersSchema).default({});
279
+ const PaginableOptionsSchema = createPaginableOptionsSchema(
280
+ EventFiltersSchema,
281
+ z.enum(["date"]).optional()
282
+ ).default({});
279
283
  const resultOptions = PaginableOptionsSchema.safeParse(options);
280
284
  if (!resultOptions.success) {
281
285
  throw new TypeError("Invalid options", {
@@ -286,10 +290,16 @@ var getEventsByTripId = async (client, tripId, options) => {
286
290
  const searchParams = new URLSearchParams();
287
291
  searchParams.append("page", finalOptions.page.toString());
288
292
  searchParams.append("pageSize", finalOptions.pageSize.toString());
293
+ searchParams.append("sort", finalOptions.sort.toString());
294
+ searchParams.append("sortDirection", finalOptions.sortDirection.toString());
289
295
  Object.entries(finalOptions.filters).forEach(([key, value]) => {
290
296
  if (value === void 0) {
291
297
  return;
292
298
  }
299
+ if (Array.isArray(value)) {
300
+ searchParams.append(key, value.join(","));
301
+ return;
302
+ }
293
303
  searchParams.append(key, value);
294
304
  });
295
305
  return client.get(`/boapi/proxy/user/fleets/${client.clientOptions.fleetId}/events/trips/${tripId}?${searchParams.toString()}`).then(({ data, headers }) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vulog/aima-event",
3
- "version": "1.1.74",
3
+ "version": "1.1.76",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/index.mjs",
6
6
  "types": "dist/index.d.ts",
@@ -17,10 +17,10 @@
17
17
  "EVENT"
18
18
  ],
19
19
  "author": "Vulog",
20
- "license": "ISC",
20
+ "license": "MIT",
21
21
  "dependencies": {
22
- "@vulog/aima-client": "1.1.74",
23
- "@vulog/aima-core": "1.1.74"
22
+ "@vulog/aima-client": "1.1.76",
23
+ "@vulog/aima-core": "1.1.76"
24
24
  },
25
25
  "peerDependencies": {
26
26
  "zod": "^3.24.2"
package/src/getEvents.ts CHANGED
@@ -323,8 +323,12 @@ export const getEventsByTripId = async (
323
323
  const EventFiltersSchema = z.object({
324
324
  startDate: z.string().datetime({ offset: false, precision: 0 }).optional(),
325
325
  endDate: z.string().datetime({ offset: false, precision: 0 }).optional(),
326
+ type: z.array(EventTypeList).optional(),
326
327
  });
327
- const PaginableOptionsSchema = createPaginableOptionsSchema(EventFiltersSchema).default({});
328
+ const PaginableOptionsSchema = createPaginableOptionsSchema(
329
+ EventFiltersSchema,
330
+ z.enum(['date']).optional()
331
+ ).default({});
328
332
 
329
333
  const resultOptions = PaginableOptionsSchema.safeParse(options);
330
334
  if (!resultOptions.success) {
@@ -338,11 +342,17 @@ export const getEventsByTripId = async (
338
342
  const searchParams = new URLSearchParams();
339
343
  searchParams.append('page', finalOptions.page!.toString());
340
344
  searchParams.append('pageSize', finalOptions.pageSize!.toString());
345
+ searchParams.append('sort', finalOptions.sort!.toString());
346
+ searchParams.append('sortDirection', finalOptions.sortDirection!.toString());
341
347
 
342
348
  Object.entries(finalOptions.filters!).forEach(([key, value]) => {
343
349
  if (value === undefined) {
344
350
  return;
345
351
  }
352
+ if (Array.isArray(value)) {
353
+ searchParams.append(key, value.join(','));
354
+ return;
355
+ }
346
356
  searchParams.append(key, value as string);
347
357
  });
348
358