@vulog/aima-trip 1.2.38 → 1.2.40

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 CHANGED
@@ -1,33 +1,10 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- //#region \0rolldown/runtime.js
3
- var __create = Object.create;
4
- var __defProp = Object.defineProperty;
5
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
- var __getOwnPropNames = Object.getOwnPropertyNames;
7
- var __getProtoOf = Object.getPrototypeOf;
8
- var __hasOwnProp = Object.prototype.hasOwnProperty;
9
- var __copyProps = (to, from, except, desc) => {
10
- if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
11
- key = keys[i];
12
- if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
13
- get: ((k) => from[k]).bind(null, key),
14
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
15
- });
16
- }
17
- return to;
18
- };
19
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
20
- value: mod,
21
- enumerable: true
22
- }) : target, mod));
23
- //#endregion
24
2
  let zod = require("zod");
25
- zod = __toESM(zod);
26
3
  let _vulog_aima_core = require("@vulog/aima-core");
27
4
  //#region src/addRemoveTripRelatedProduct.ts
28
- const schema$1 = zod.default.object({
29
- vehicleId: zod.default.string().trim().min(1).uuid(),
30
- productId: zod.default.string().trim().min(1).uuid()
5
+ const schema$1 = zod.z.object({
6
+ vehicleId: zod.z.string().trim().min(1).uuid(),
7
+ productId: zod.z.string().trim().min(1).uuid()
31
8
  });
32
9
  const addRemoveTripRelatedProduct = async (client, action, vehicleId, productId) => {
33
10
  const result = schema$1.safeParse({
@@ -41,10 +18,10 @@ const addTripRelatedProduct = async (client, vehicleId, productId) => addRemoveT
41
18
  const removeTripRelatedProduct = async (client, vehicleId, productId) => addRemoveTripRelatedProduct(client, "REMOVE", vehicleId, productId);
42
19
  //#endregion
43
20
  //#region src/endTrip.ts
44
- const schema = zod.default.object({
45
- vehicleId: zod.default.string().trim().min(1).uuid(),
46
- userId: zod.default.string().trim().min(1).uuid(),
47
- orderId: zod.default.string().trim().min(1)
21
+ const schema = zod.z.object({
22
+ vehicleId: zod.z.string().trim().min(1).uuid(),
23
+ userId: zod.z.string().trim().min(1).uuid(),
24
+ orderId: zod.z.string().trim().min(1)
48
25
  });
49
26
  const endTrip = async (client, info) => {
50
27
  const result = schema.safeParse(info);
@@ -56,9 +33,9 @@ const endTrip = async (client, info) => {
56
33
  };
57
34
  //#endregion
58
35
  //#region src/getVehiclesBooked.ts
59
- const optionsSchema = zod.default.object({
60
- minDuration: zod.default.number().positive().optional(),
61
- boxStatus: zod.default.array(zod.default.number()).optional()
36
+ const optionsSchema = zod.z.object({
37
+ minDuration: zod.z.number().positive().optional(),
38
+ boxStatus: zod.z.array(zod.z.number()).optional()
62
39
  });
63
40
  const getVehiclesBooked = async (client, options = {}) => {
64
41
  const result = optionsSchema.safeParse(options);
@@ -76,7 +53,7 @@ const getVehiclesBooked = async (client, options = {}) => {
76
53
  return filterData;
77
54
  });
78
55
  };
79
- const schemaByUserId$1 = zod.default.object({ userId: zod.default.string().trim().min(1).uuid() });
56
+ const schemaByUserId$1 = zod.z.object({ userId: zod.z.string().trim().min(1).uuid() });
80
57
  const getVehiclesBookedByUserId = async (client, userId) => {
81
58
  const result = schemaByUserId$1.safeParse({ userId });
82
59
  if (!result.success) throw new TypeError("Invalid args", { cause: result.error.issues });
@@ -109,11 +86,11 @@ const getOngoingTripPaymentsByTripIds = async (client, tripIds) => {
109
86
  };
110
87
  //#endregion
111
88
  //#region src/getTrips.ts
112
- const schemaByUserId = zod.default.object({ userId: zod.default.string().trim().min(1).uuid() });
89
+ const schemaByUserId = zod.z.object({ userId: zod.z.string().trim().min(1).uuid() });
113
90
  const getTripsByUserId = async (client, userId, options) => {
114
91
  const result = schemaByUserId.safeParse({ userId });
115
92
  if (!result.success) throw new TypeError("Invalid userId", { cause: result.error.issues });
116
- const resultOptions = (0, _vulog_aima_core.createPaginableOptionsSchema)(void 0, zod.default.enum(["date"]).optional().default("date")).default({}).safeParse(options);
93
+ const resultOptions = (0, _vulog_aima_core.createPaginableOptionsSchema)(void 0, zod.z.enum(["date"]).optional().default("date")).safeParse(options ?? {});
117
94
  if (!resultOptions.success) throw new TypeError("Invalid options", { cause: resultOptions.error.issues });
118
95
  const finalOptions = resultOptions.data;
119
96
  const searchParams = new URLSearchParams();
package/dist/index.d.cts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { Client } from "@vulog/aima-client";
2
- import z from "zod";
2
+ import { z } from "zod";
3
3
  import { UUID } from "crypto";
4
4
  import { PaginableOptions, PaginableResponse } from "@vulog/aima-core";
5
5
 
@@ -197,14 +197,8 @@ declare const endTrip: (client: Client, info: EndTripInfo) => Promise<void>;
197
197
  //#region src/getVehiclesBooked.d.ts
198
198
  declare const optionsSchema: z.ZodObject<{
199
199
  minDuration: z.ZodOptional<z.ZodNumber>;
200
- boxStatus: z.ZodOptional<z.ZodArray<z.ZodNumber, "many">>;
201
- }, "strip", z.ZodTypeAny, {
202
- minDuration?: number | undefined;
203
- boxStatus?: number[] | undefined;
204
- }, {
205
- minDuration?: number | undefined;
206
- boxStatus?: number[] | undefined;
207
- }>;
200
+ boxStatus: z.ZodOptional<z.ZodArray<z.ZodNumber>>;
201
+ }, z.core.$strip>;
208
202
  declare const getVehiclesBooked: (client: Client, options?: z.infer<typeof optionsSchema>) => Promise<FleetManagerBook[]>;
209
203
  declare const getVehiclesBookedByUserId: (client: Client, userId: string) => Promise<FleetManagerBook[]>;
210
204
  declare const getVehicleBookedByTripId: (client: Client, tripId: string) => Promise<FleetManagerBook | null>;
package/dist/index.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- import z$1 from "zod";
1
+ import { z } from "zod";
2
2
  import { PaginableOptions, PaginableResponse } from "@vulog/aima-core";
3
3
  import { Client } from "@vulog/aima-client";
4
4
  import { UUID } from "crypto";
@@ -195,17 +195,11 @@ type Trip = {
195
195
  declare const endTrip: (client: Client, info: EndTripInfo) => Promise<void>;
196
196
  //#endregion
197
197
  //#region src/getVehiclesBooked.d.ts
198
- declare const optionsSchema: z$1.ZodObject<{
199
- minDuration: z$1.ZodOptional<z$1.ZodNumber>;
200
- boxStatus: z$1.ZodOptional<z$1.ZodArray<z$1.ZodNumber, "many">>;
201
- }, "strip", z$1.ZodTypeAny, {
202
- minDuration?: number | undefined;
203
- boxStatus?: number[] | undefined;
204
- }, {
205
- minDuration?: number | undefined;
206
- boxStatus?: number[] | undefined;
207
- }>;
208
- declare const getVehiclesBooked: (client: Client, options?: z$1.infer<typeof optionsSchema>) => Promise<FleetManagerBook[]>;
198
+ declare const optionsSchema: z.ZodObject<{
199
+ minDuration: z.ZodOptional<z.ZodNumber>;
200
+ boxStatus: z.ZodOptional<z.ZodArray<z.ZodNumber>>;
201
+ }, z.core.$strip>;
202
+ declare const getVehiclesBooked: (client: Client, options?: z.infer<typeof optionsSchema>) => Promise<FleetManagerBook[]>;
209
203
  declare const getVehiclesBookedByUserId: (client: Client, userId: string) => Promise<FleetManagerBook[]>;
210
204
  declare const getVehicleBookedByTripId: (client: Client, tripId: string) => Promise<FleetManagerBook | null>;
211
205
  //#endregion
package/dist/index.mjs CHANGED
@@ -1,9 +1,9 @@
1
- import z$1, { z } from "zod";
1
+ import { z } from "zod";
2
2
  import { createPaginableOptionsSchema } from "@vulog/aima-core";
3
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()
4
+ const schema$1 = z.object({
5
+ vehicleId: z.string().trim().min(1).uuid(),
6
+ productId: z.string().trim().min(1).uuid()
7
7
  });
8
8
  const addRemoveTripRelatedProduct = async (client, action, vehicleId, productId) => {
9
9
  const result = schema$1.safeParse({
@@ -17,10 +17,10 @@ const addTripRelatedProduct = async (client, vehicleId, productId) => addRemoveT
17
17
  const removeTripRelatedProduct = async (client, vehicleId, productId) => addRemoveTripRelatedProduct(client, "REMOVE", vehicleId, productId);
18
18
  //#endregion
19
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)
20
+ const schema = z.object({
21
+ vehicleId: z.string().trim().min(1).uuid(),
22
+ userId: z.string().trim().min(1).uuid(),
23
+ orderId: z.string().trim().min(1)
24
24
  });
25
25
  const endTrip = async (client, info) => {
26
26
  const result = schema.safeParse(info);
@@ -32,9 +32,9 @@ const endTrip = async (client, info) => {
32
32
  };
33
33
  //#endregion
34
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()
35
+ const optionsSchema = z.object({
36
+ minDuration: z.number().positive().optional(),
37
+ boxStatus: z.array(z.number()).optional()
38
38
  });
39
39
  const getVehiclesBooked = async (client, options = {}) => {
40
40
  const result = optionsSchema.safeParse(options);
@@ -52,7 +52,7 @@ const getVehiclesBooked = async (client, options = {}) => {
52
52
  return filterData;
53
53
  });
54
54
  };
55
- const schemaByUserId$1 = z$1.object({ userId: z$1.string().trim().min(1).uuid() });
55
+ const schemaByUserId$1 = z.object({ userId: z.string().trim().min(1).uuid() });
56
56
  const getVehiclesBookedByUserId = async (client, userId) => {
57
57
  const result = schemaByUserId$1.safeParse({ userId });
58
58
  if (!result.success) throw new TypeError("Invalid args", { cause: result.error.issues });
@@ -85,11 +85,11 @@ const getOngoingTripPaymentsByTripIds = async (client, tripIds) => {
85
85
  };
86
86
  //#endregion
87
87
  //#region src/getTrips.ts
88
- const schemaByUserId = z$1.object({ userId: z$1.string().trim().min(1).uuid() });
88
+ const schemaByUserId = z.object({ userId: z.string().trim().min(1).uuid() });
89
89
  const getTripsByUserId = async (client, userId, options) => {
90
90
  const result = schemaByUserId.safeParse({ userId });
91
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);
92
+ const resultOptions = createPaginableOptionsSchema(void 0, z.enum(["date"]).optional().default("date")).safeParse(options ?? {});
93
93
  if (!resultOptions.success) throw new TypeError("Invalid options", { cause: resultOptions.error.issues });
94
94
  const finalOptions = resultOptions.data;
95
95
  const searchParams = new URLSearchParams();
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@vulog/aima-trip",
3
3
  "type": "module",
4
- "version": "1.2.38",
4
+ "version": "1.2.40",
5
5
  "main": "dist/index.cjs",
6
6
  "module": "dist/index.mjs",
7
7
  "types": "dist/index.d.cts",
@@ -32,11 +32,11 @@
32
32
  "author": "Vulog",
33
33
  "license": "MIT",
34
34
  "dependencies": {
35
- "@vulog/aima-client": "1.2.38",
36
- "@vulog/aima-core": "1.2.38"
35
+ "@vulog/aima-client": "1.2.40",
36
+ "@vulog/aima-core": "1.2.40"
37
37
  },
38
38
  "peerDependencies": {
39
- "zod": "^3.25.76"
39
+ "zod": "^4.3.6"
40
40
  },
41
41
  "description": ""
42
- }
42
+ }
@@ -1,5 +1,5 @@
1
1
  import { Client } from '@vulog/aima-client';
2
- import z from 'zod';
2
+ import { z } from 'zod';
3
3
 
4
4
  const schema = z.object({
5
5
  vehicleId: z.string().trim().min(1).uuid(),
package/src/endTrip.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { Client } from '@vulog/aima-client';
2
- import z from 'zod';
2
+ import { z } from 'zod';
3
3
 
4
4
  import { EndTripInfo } from './types';
5
5
 
package/src/getTrips.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { Client } from '@vulog/aima-client';
2
2
  import { createPaginableOptionsSchema, PaginableOptions, PaginableResponse } from '@vulog/aima-core';
3
- import z from 'zod';
3
+ import { z } from 'zod';
4
4
 
5
5
  import { Trip } from './types';
6
6
 
@@ -20,12 +20,9 @@ export const getTripsByUserId = async (
20
20
  });
21
21
  }
22
22
 
23
- const PaginableOptionsSchema = createPaginableOptionsSchema(
24
- undefined,
25
- z.enum(['date']).optional().default('date')
26
- ).default({});
23
+ const PaginableOptionsSchema = createPaginableOptionsSchema(undefined, z.enum(['date']).optional().default('date'));
27
24
 
28
- const resultOptions = PaginableOptionsSchema.safeParse(options);
25
+ const resultOptions = PaginableOptionsSchema.safeParse(options ?? {});
29
26
  if (!resultOptions.success) {
30
27
  throw new TypeError('Invalid options', {
31
28
  cause: resultOptions.error.issues,
@@ -1,5 +1,5 @@
1
1
  import { Client } from '@vulog/aima-client';
2
- import z from 'zod';
2
+ import { z } from 'zod';
3
3
 
4
4
  import { FleetManagerBook } from './types';
5
5
 
package/tsconfig.json CHANGED
@@ -1,15 +1,8 @@
1
1
  {
2
+ "extends": "../../tsconfig.base.json",
2
3
  "include": ["src"],
3
4
  "exclude": ["**/*.test.ts"],
4
5
  "compilerOptions": {
5
- "module": "esnext",
6
- "target": "esnext",
7
- "lib": ["esnext"],
8
- "declaration": true,
9
- "strict": true,
10
- "moduleResolution": "node",
11
- "skipLibCheck": true,
12
- "esModuleInterop": true,
13
6
  "outDir": "dist",
14
7
  "rootDir": "src"
15
8
  }
package/vitest.config.ts CHANGED
@@ -1,8 +1 @@
1
- import { defineConfig } from 'vitest/config';
2
-
3
- export default defineConfig({
4
- test: {
5
- globals: true,
6
- environment: 'node',
7
- },
8
- });
1
+ export { default } from '../../vitest.config.base.ts';