@lyxa.ai/core 1.0.22 → 1.0.23

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.
Files changed (90) hide show
  1. package/dist/libraries/mongo/models/base/base-coupon.model.js.map +1 -1
  2. package/dist/libraries/mongo/models/cart-lineitem.model.d.ts +29 -0
  3. package/dist/libraries/mongo/models/cart-lineitem.model.js +120 -0
  4. package/dist/libraries/mongo/models/cart-lineitem.model.js.map +1 -0
  5. package/dist/libraries/mongo/models/cart-perticipant.model.d.ts +22 -0
  6. package/dist/libraries/mongo/models/cart-perticipant.model.js +104 -0
  7. package/dist/libraries/mongo/models/cart-perticipant.model.js.map +1 -0
  8. package/dist/libraries/mongo/models/embedded/attribute-item.model.js.map +1 -1
  9. package/dist/libraries/mongo/models/embedded/attribute-map.model.js.map +1 -1
  10. package/dist/libraries/mongo/models/embedded/business-development-setting.model.js.map +1 -1
  11. package/dist/libraries/mongo/models/embedded/charge-setting.model.js.map +1 -1
  12. package/dist/libraries/mongo/models/embedded/charge.model.js.map +1 -1
  13. package/dist/libraries/mongo/models/embedded/courier-setting.model.js.map +1 -1
  14. package/dist/libraries/mongo/models/embedded/currency-setting.model.js.map +1 -1
  15. package/dist/libraries/mongo/models/embedded/currency.model.js.map +1 -1
  16. package/dist/libraries/mongo/models/embedded/featured-item.mode.js.map +1 -1
  17. package/dist/libraries/mongo/models/embedded/otp-fields.model.js.map +1 -1
  18. package/dist/libraries/mongo/models/embedded/package.model.js.map +1 -1
  19. package/dist/libraries/mongo/models/embedded/parent-document.model.js.map +1 -1
  20. package/dist/libraries/mongo/models/embedded/payment-details.model.d.ts +9 -0
  21. package/dist/libraries/mongo/models/embedded/payment-details.model.js +52 -0
  22. package/dist/libraries/mongo/models/embedded/payment-details.model.js.map +1 -0
  23. package/dist/libraries/mongo/models/embedded/payout-setting.model.js.map +1 -1
  24. package/dist/libraries/mongo/models/embedded/price-breakdown.model.js +1 -1
  25. package/dist/libraries/mongo/models/embedded/price-breakdown.model.js.map +1 -1
  26. package/dist/libraries/mongo/models/embedded/price.model.js.map +1 -1
  27. package/dist/libraries/mongo/models/embedded/product-nutrition.model.js.map +1 -1
  28. package/dist/libraries/mongo/models/embedded/referral-discount-config.model.js.map +1 -1
  29. package/dist/libraries/mongo/models/embedded/rider-setting.model.js.map +1 -1
  30. package/dist/libraries/mongo/models/embedded/service-fee-setting.model.js.map +1 -1
  31. package/dist/libraries/mongo/models/embedded/shop-document.model.js.map +1 -1
  32. package/dist/libraries/mongo/models/embedded/subscription-summary.model.js.map +1 -1
  33. package/dist/libraries/mongo/models/index.d.ts +0 -3
  34. package/dist/libraries/mongo/models/index.js +1 -4
  35. package/dist/libraries/mongo/models/index.js.map +1 -1
  36. package/dist/libraries/mongo/models/order-pricing.model.d.ts +18 -0
  37. package/dist/libraries/mongo/models/order-pricing.model.js +88 -0
  38. package/dist/libraries/mongo/models/order-pricing.model.js.map +1 -0
  39. package/dist/libraries/mongo/models/payout.model.js.map +1 -1
  40. package/dist/libraries/mongo/models/product.model.d.ts +21 -3
  41. package/dist/libraries/mongo/models/product.model.js +81 -11
  42. package/dist/libraries/mongo/models/product.model.js.map +1 -1
  43. package/dist/libraries/mongo/models/shared/duration.model.js.map +1 -1
  44. package/dist/libraries/mongo/models/transaction.model.js.map +1 -1
  45. package/dist/libraries/trpc/index.d.ts +99 -9
  46. package/dist/libraries/trpc/index.js +22 -1
  47. package/dist/libraries/trpc/index.js.map +1 -1
  48. package/dist/libraries/trpc/middlewares/auth.d.ts +11 -1
  49. package/dist/utilities/enum.d.ts +0 -1
  50. package/dist/utilities/enum.js +0 -1
  51. package/dist/utilities/enum.js.map +1 -1
  52. package/dist/utilities/error-handler.js +20 -5
  53. package/dist/utilities/error-handler.js.map +1 -1
  54. package/dist/utilities/validation/common-validation.d.ts +110 -110
  55. package/dist/utilities/validation/common-validation.js +5 -2
  56. package/dist/utilities/validation/common-validation.js.map +1 -1
  57. package/dist/utilities/validation/global-validation.d.ts +19 -5
  58. package/dist/utilities/validation/global-validation.js +33 -13
  59. package/dist/utilities/validation/global-validation.js.map +1 -1
  60. package/package.json +1 -1
  61. package/dist/libraries/mongo/models/areeba-card.model.d.ts +0 -17
  62. package/dist/libraries/mongo/models/areeba-card.model.js +0 -73
  63. package/dist/libraries/mongo/models/areeba-card.model.js.map +0 -1
  64. package/dist/libraries/mongo/models/auth-identity.model.d.ts +0 -8
  65. package/dist/libraries/mongo/models/auth-identity.model.js +0 -33
  66. package/dist/libraries/mongo/models/auth-identity.model.js.map +0 -1
  67. package/dist/libraries/mongo/models/providers/apple-auth-identity.model.d.ts +0 -6
  68. package/dist/libraries/mongo/models/providers/apple-auth-identity.model.js +0 -25
  69. package/dist/libraries/mongo/models/providers/apple-auth-identity.model.js.map +0 -1
  70. package/dist/libraries/mongo/models/providers/email-auth-identity.model.d.ts +0 -9
  71. package/dist/libraries/mongo/models/providers/email-auth-identity.model.js +0 -36
  72. package/dist/libraries/mongo/models/providers/email-auth-identity.model.js.map +0 -1
  73. package/dist/libraries/mongo/models/providers/google-auth-identity.model.d.ts +0 -6
  74. package/dist/libraries/mongo/models/providers/google-auth-identity.model.js +0 -25
  75. package/dist/libraries/mongo/models/providers/google-auth-identity.model.js.map +0 -1
  76. package/dist/libraries/mongo/models/providers/phone-auth-identity.model.d.ts +0 -8
  77. package/dist/libraries/mongo/models/providers/phone-auth-identity.model.js +0 -31
  78. package/dist/libraries/mongo/models/providers/phone-auth-identity.model.js.map +0 -1
  79. package/dist/libraries/mongo/models/providers/referral-code-coupon.mode.d.ts +0 -10
  80. package/dist/libraries/mongo/models/providers/referral-code-coupon.mode.js +0 -28
  81. package/dist/libraries/mongo/models/providers/referral-code-coupon.mode.js.map +0 -1
  82. package/dist/libraries/mongo/models/role.model.ts.d.ts +0 -8
  83. package/dist/libraries/mongo/models/role.model.ts.js +0 -37
  84. package/dist/libraries/mongo/models/role.model.ts.js.map +0 -1
  85. package/dist/libraries/mongo/models/shop-review.d.ts +0 -7
  86. package/dist/libraries/mongo/models/shop-review.js +0 -28
  87. package/dist/libraries/mongo/models/shop-review.js.map +0 -1
  88. package/dist/libraries/mongo/models/zone.model..d.ts +0 -15
  89. package/dist/libraries/mongo/models/zone.model..js +0 -64
  90. package/dist/libraries/mongo/models/zone.model..js.map +0 -1
@@ -132,81 +132,81 @@ export declare const FilterSchema: z.ZodOptional<z.ZodObject<{
132
132
  export type FilterDTO = z.infer<typeof FilterSchema>;
133
133
  export declare const StringSchema: z.ZodString;
134
134
  export declare const AddressSchema: z.ZodObject<{
135
- address: z.ZodString;
136
- description: z.ZodOptional<z.ZodString>;
137
- city: z.ZodString;
138
- state: z.ZodString;
139
- country: z.ZodString;
135
+ address: z.ZodString | z.ZodOptional<z.ZodString> | z.ZodNullable<z.ZodString> | z.ZodOptional<z.ZodNullable<z.ZodString>>;
136
+ description: z.ZodOptional<z.ZodString> | z.ZodOptional<z.ZodNullable<z.ZodString>> | z.ZodOptional<z.ZodOptional<z.ZodString>> | z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodString>>>;
137
+ city: z.ZodString | z.ZodOptional<z.ZodString> | z.ZodNullable<z.ZodString> | z.ZodOptional<z.ZodNullable<z.ZodString>>;
138
+ state: z.ZodString | z.ZodOptional<z.ZodString> | z.ZodNullable<z.ZodString> | z.ZodOptional<z.ZodNullable<z.ZodString>>;
139
+ country: z.ZodString | z.ZodOptional<z.ZodString> | z.ZodNullable<z.ZodString> | z.ZodOptional<z.ZodNullable<z.ZodString>>;
140
140
  geoLocationType: z.ZodDefault<z.ZodNativeEnum<typeof GeoLocationType>>;
141
141
  coordinates: z.ZodArray<z.ZodNumber, "many">;
142
142
  latitude: z.ZodNumber;
143
143
  longitude: z.ZodNumber;
144
144
  }, "strip", z.ZodTypeAny, {
145
- state: string;
146
- address: string;
147
- country: string;
148
145
  coordinates: number[];
149
- city: string;
150
146
  latitude: number;
151
147
  longitude: number;
152
148
  geoLocationType: GeoLocationType;
153
- description?: string | undefined;
149
+ state?: string | null | undefined;
150
+ address?: string | null | undefined;
151
+ country?: string | null | undefined;
152
+ description?: string | null | undefined;
153
+ city?: string | null | undefined;
154
154
  }, {
155
- state: string;
156
- address: string;
157
- country: string;
158
155
  coordinates: number[];
159
- city: string;
160
156
  latitude: number;
161
157
  longitude: number;
162
- description?: string | undefined;
158
+ state?: string | null | undefined;
159
+ address?: string | null | undefined;
160
+ country?: string | null | undefined;
161
+ description?: string | null | undefined;
162
+ city?: string | null | undefined;
163
163
  geoLocationType?: GeoLocationType | undefined;
164
164
  }>;
165
165
  export declare const UserAddressSchema: z.ZodObject<z.objectUtil.extendShape<{
166
- address: z.ZodString;
167
- description: z.ZodOptional<z.ZodString>;
168
- city: z.ZodString;
169
- state: z.ZodString;
170
- country: z.ZodString;
166
+ address: z.ZodString | z.ZodOptional<z.ZodString> | z.ZodNullable<z.ZodString> | z.ZodOptional<z.ZodNullable<z.ZodString>>;
167
+ description: z.ZodOptional<z.ZodString> | z.ZodOptional<z.ZodNullable<z.ZodString>> | z.ZodOptional<z.ZodOptional<z.ZodString>> | z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodString>>>;
168
+ city: z.ZodString | z.ZodOptional<z.ZodString> | z.ZodNullable<z.ZodString> | z.ZodOptional<z.ZodNullable<z.ZodString>>;
169
+ state: z.ZodString | z.ZodOptional<z.ZodString> | z.ZodNullable<z.ZodString> | z.ZodOptional<z.ZodNullable<z.ZodString>>;
170
+ country: z.ZodString | z.ZodOptional<z.ZodString> | z.ZodNullable<z.ZodString> | z.ZodOptional<z.ZodNullable<z.ZodString>>;
171
171
  geoLocationType: z.ZodDefault<z.ZodNativeEnum<typeof GeoLocationType>>;
172
172
  coordinates: z.ZodArray<z.ZodNumber, "many">;
173
173
  latitude: z.ZodNumber;
174
174
  longitude: z.ZodNumber;
175
175
  }, {
176
- addressLabel: z.ZodString;
177
- apartment: z.ZodString;
178
- buildingName: z.ZodString;
179
- deliveryOption: z.ZodOptional<z.ZodString>;
180
- instructions: z.ZodOptional<z.ZodString>;
176
+ addressLabel: z.ZodString | z.ZodOptional<z.ZodString> | z.ZodNullable<z.ZodString> | z.ZodOptional<z.ZodNullable<z.ZodString>>;
177
+ apartment: z.ZodString | z.ZodOptional<z.ZodString> | z.ZodNullable<z.ZodString> | z.ZodOptional<z.ZodNullable<z.ZodString>>;
178
+ buildingName: z.ZodString | z.ZodOptional<z.ZodString> | z.ZodNullable<z.ZodString> | z.ZodOptional<z.ZodNullable<z.ZodString>>;
179
+ deliveryOption: z.ZodOptional<z.ZodString> | z.ZodOptional<z.ZodNullable<z.ZodString>> | z.ZodOptional<z.ZodOptional<z.ZodString>> | z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodString>>>;
180
+ instructions: z.ZodOptional<z.ZodString> | z.ZodOptional<z.ZodNullable<z.ZodString>> | z.ZodOptional<z.ZodOptional<z.ZodString>> | z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodString>>>;
181
181
  }>, "strip", z.ZodTypeAny, {
182
- state: string;
183
- address: string;
184
- country: string;
185
182
  coordinates: number[];
186
- city: string;
187
183
  latitude: number;
188
184
  longitude: number;
189
- addressLabel: string;
190
- apartment: string;
191
- buildingName: string;
192
185
  geoLocationType: GeoLocationType;
193
- description?: string | undefined;
194
- deliveryOption?: string | undefined;
195
- instructions?: string | undefined;
186
+ state?: string | null | undefined;
187
+ address?: string | null | undefined;
188
+ country?: string | null | undefined;
189
+ description?: string | null | undefined;
190
+ city?: string | null | undefined;
191
+ addressLabel?: string | null | undefined;
192
+ apartment?: string | null | undefined;
193
+ buildingName?: string | null | undefined;
194
+ deliveryOption?: string | null | undefined;
195
+ instructions?: string | null | undefined;
196
196
  }, {
197
- state: string;
198
- address: string;
199
- country: string;
200
197
  coordinates: number[];
201
- city: string;
202
198
  latitude: number;
203
199
  longitude: number;
204
- addressLabel: string;
205
- apartment: string;
206
- buildingName: string;
207
- description?: string | undefined;
208
- deliveryOption?: string | undefined;
209
- instructions?: string | undefined;
200
+ state?: string | null | undefined;
201
+ address?: string | null | undefined;
202
+ country?: string | null | undefined;
203
+ description?: string | null | undefined;
204
+ city?: string | null | undefined;
205
+ addressLabel?: string | null | undefined;
206
+ apartment?: string | null | undefined;
207
+ buildingName?: string | null | undefined;
208
+ deliveryOption?: string | null | undefined;
209
+ instructions?: string | null | undefined;
210
210
  geoLocationType?: GeoLocationType | undefined;
211
211
  }>;
212
212
  export declare const DurationSchema: z.ZodObject<{
@@ -223,56 +223,56 @@ export declare const NormalHourSchema: z.ZodObject<{
223
223
  day: z.ZodNativeEnum<typeof WeekDay>;
224
224
  status: z.ZodNativeEnum<typeof WorkStatus>;
225
225
  openingHours: z.ZodDefault<z.ZodArray<z.ZodObject<{
226
- start: z.ZodString;
227
- end: z.ZodString;
226
+ start: z.ZodString | z.ZodOptional<z.ZodString> | z.ZodNullable<z.ZodString> | z.ZodOptional<z.ZodNullable<z.ZodString>>;
227
+ end: z.ZodString | z.ZodOptional<z.ZodString> | z.ZodNullable<z.ZodString> | z.ZodOptional<z.ZodNullable<z.ZodString>>;
228
228
  }, "strip", z.ZodTypeAny, {
229
- end: string;
230
- start: string;
229
+ end?: string | null | undefined;
230
+ start?: string | null | undefined;
231
231
  }, {
232
- end: string;
233
- start: string;
232
+ end?: string | null | undefined;
233
+ start?: string | null | undefined;
234
234
  }>, "many">>;
235
235
  }, "strip", z.ZodTypeAny, {
236
236
  status: WorkStatus;
237
237
  day: WeekDay;
238
238
  openingHours: {
239
- end: string;
240
- start: string;
239
+ end?: string | null | undefined;
240
+ start?: string | null | undefined;
241
241
  }[];
242
242
  }, {
243
243
  status: WorkStatus;
244
244
  day: WeekDay;
245
245
  openingHours?: {
246
- end: string;
247
- start: string;
246
+ end?: string | null | undefined;
247
+ start?: string | null | undefined;
248
248
  }[] | undefined;
249
249
  }>;
250
250
  export declare const HolidayHourSchema: z.ZodObject<{
251
251
  date: z.ZodEffects<z.ZodEffects<z.ZodUnion<[z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, Date, string>, z.ZodDate]>, Date, string | Date>, Date, string | Date>;
252
252
  status: z.ZodNativeEnum<typeof HolidayWorkStatus>;
253
253
  closingHour: z.ZodObject<{
254
- start: z.ZodString;
255
- end: z.ZodString;
254
+ start: z.ZodString | z.ZodOptional<z.ZodString> | z.ZodNullable<z.ZodString> | z.ZodOptional<z.ZodNullable<z.ZodString>>;
255
+ end: z.ZodString | z.ZodOptional<z.ZodString> | z.ZodNullable<z.ZodString> | z.ZodOptional<z.ZodNullable<z.ZodString>>;
256
256
  }, "strip", z.ZodTypeAny, {
257
- end: string;
258
- start: string;
257
+ end?: string | null | undefined;
258
+ start?: string | null | undefined;
259
259
  }, {
260
- end: string;
261
- start: string;
260
+ end?: string | null | undefined;
261
+ start?: string | null | undefined;
262
262
  }>;
263
263
  }, "strip", z.ZodTypeAny, {
264
264
  status: HolidayWorkStatus;
265
265
  date: Date;
266
266
  closingHour: {
267
- end: string;
268
- start: string;
267
+ end?: string | null | undefined;
268
+ start?: string | null | undefined;
269
269
  };
270
270
  }, {
271
271
  status: HolidayWorkStatus;
272
272
  date: string | Date;
273
273
  closingHour: {
274
- end: string;
275
- start: string;
274
+ end?: string | null | undefined;
275
+ start?: string | null | undefined;
276
276
  };
277
277
  }>;
278
278
  export declare const WorkHourSettingSchema: z.ZodObject<{
@@ -280,56 +280,56 @@ export declare const WorkHourSettingSchema: z.ZodObject<{
280
280
  day: z.ZodNativeEnum<typeof WeekDay>;
281
281
  status: z.ZodNativeEnum<typeof WorkStatus>;
282
282
  openingHours: z.ZodDefault<z.ZodArray<z.ZodObject<{
283
- start: z.ZodString;
284
- end: z.ZodString;
283
+ start: z.ZodString | z.ZodOptional<z.ZodString> | z.ZodNullable<z.ZodString> | z.ZodOptional<z.ZodNullable<z.ZodString>>;
284
+ end: z.ZodString | z.ZodOptional<z.ZodString> | z.ZodNullable<z.ZodString> | z.ZodOptional<z.ZodNullable<z.ZodString>>;
285
285
  }, "strip", z.ZodTypeAny, {
286
- end: string;
287
- start: string;
286
+ end?: string | null | undefined;
287
+ start?: string | null | undefined;
288
288
  }, {
289
- end: string;
290
- start: string;
289
+ end?: string | null | undefined;
290
+ start?: string | null | undefined;
291
291
  }>, "many">>;
292
292
  }, "strip", z.ZodTypeAny, {
293
293
  status: WorkStatus;
294
294
  day: WeekDay;
295
295
  openingHours: {
296
- end: string;
297
- start: string;
296
+ end?: string | null | undefined;
297
+ start?: string | null | undefined;
298
298
  }[];
299
299
  }, {
300
300
  status: WorkStatus;
301
301
  day: WeekDay;
302
302
  openingHours?: {
303
- end: string;
304
- start: string;
303
+ end?: string | null | undefined;
304
+ start?: string | null | undefined;
305
305
  }[] | undefined;
306
306
  }>, "many">>;
307
307
  holidayHours: z.ZodDefault<z.ZodArray<z.ZodObject<{
308
308
  date: z.ZodEffects<z.ZodEffects<z.ZodUnion<[z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, Date, string>, z.ZodDate]>, Date, string | Date>, Date, string | Date>;
309
309
  status: z.ZodNativeEnum<typeof HolidayWorkStatus>;
310
310
  closingHour: z.ZodObject<{
311
- start: z.ZodString;
312
- end: z.ZodString;
311
+ start: z.ZodString | z.ZodOptional<z.ZodString> | z.ZodNullable<z.ZodString> | z.ZodOptional<z.ZodNullable<z.ZodString>>;
312
+ end: z.ZodString | z.ZodOptional<z.ZodString> | z.ZodNullable<z.ZodString> | z.ZodOptional<z.ZodNullable<z.ZodString>>;
313
313
  }, "strip", z.ZodTypeAny, {
314
- end: string;
315
- start: string;
314
+ end?: string | null | undefined;
315
+ start?: string | null | undefined;
316
316
  }, {
317
- end: string;
318
- start: string;
317
+ end?: string | null | undefined;
318
+ start?: string | null | undefined;
319
319
  }>;
320
320
  }, "strip", z.ZodTypeAny, {
321
321
  status: HolidayWorkStatus;
322
322
  date: Date;
323
323
  closingHour: {
324
- end: string;
325
- start: string;
324
+ end?: string | null | undefined;
325
+ start?: string | null | undefined;
326
326
  };
327
327
  }, {
328
328
  status: HolidayWorkStatus;
329
329
  date: string | Date;
330
330
  closingHour: {
331
- end: string;
332
- start: string;
331
+ end?: string | null | undefined;
332
+ start?: string | null | undefined;
333
333
  };
334
334
  }>, "many">>;
335
335
  }, "strip", z.ZodTypeAny, {
@@ -337,16 +337,16 @@ export declare const WorkHourSettingSchema: z.ZodObject<{
337
337
  status: WorkStatus;
338
338
  day: WeekDay;
339
339
  openingHours: {
340
- end: string;
341
- start: string;
340
+ end?: string | null | undefined;
341
+ start?: string | null | undefined;
342
342
  }[];
343
343
  }[];
344
344
  holidayHours: {
345
345
  status: HolidayWorkStatus;
346
346
  date: Date;
347
347
  closingHour: {
348
- end: string;
349
- start: string;
348
+ end?: string | null | undefined;
349
+ start?: string | null | undefined;
350
350
  };
351
351
  }[];
352
352
  }, {
@@ -354,28 +354,28 @@ export declare const WorkHourSettingSchema: z.ZodObject<{
354
354
  status: WorkStatus;
355
355
  day: WeekDay;
356
356
  openingHours?: {
357
- end: string;
358
- start: string;
357
+ end?: string | null | undefined;
358
+ start?: string | null | undefined;
359
359
  }[] | undefined;
360
360
  }[] | undefined;
361
361
  holidayHours?: {
362
362
  status: HolidayWorkStatus;
363
363
  date: string | Date;
364
364
  closingHour: {
365
- end: string;
366
- start: string;
365
+ end?: string | null | undefined;
366
+ start?: string | null | undefined;
367
367
  };
368
368
  }[] | undefined;
369
369
  }>;
370
370
  export declare const LoginSchema: z.ZodObject<{
371
- email: z.ZodString;
372
- password: z.ZodString;
371
+ email: z.ZodString | z.ZodOptional<z.ZodString> | z.ZodNullable<z.ZodString> | z.ZodOptional<z.ZodNullable<z.ZodString>>;
372
+ password: z.ZodString | z.ZodOptional<z.ZodString> | z.ZodNullable<z.ZodString> | z.ZodOptional<z.ZodNullable<z.ZodString>>;
373
373
  }, "strip", z.ZodTypeAny, {
374
- email: string;
375
- password: string;
374
+ email?: string | null | undefined;
375
+ password?: string | null | undefined;
376
376
  }, {
377
- email: string;
378
- password: string;
377
+ email?: string | null | undefined;
378
+ password?: string | null | undefined;
379
379
  }>;
380
380
  export declare const createPaginatedSchema: <T>(documentSchema: z.ZodSchema<T>) => z.ZodObject<{
381
381
  metadata: z.ZodOptional<z.ZodObject<{
@@ -414,7 +414,7 @@ export declare const createPaginatedSchema: <T>(documentSchema: z.ZodSchema<T>)
414
414
  }>;
415
415
  export declare const createResponseSchema: <T>(schema: z.ZodSchema<T>) => z.ZodObject<{
416
416
  success: z.ZodBoolean;
417
- message: z.ZodString;
417
+ message: z.ZodString | z.ZodOptional<z.ZodString> | z.ZodNullable<z.ZodString> | z.ZodOptional<z.ZodNullable<z.ZodString>>;
418
418
  data: z.ZodOptional<z.ZodUnion<[z.ZodObject<{
419
419
  metadata: z.ZodOptional<z.ZodObject<{
420
420
  page: z.ZodNumber;
@@ -452,7 +452,7 @@ export declare const createResponseSchema: <T>(schema: z.ZodSchema<T>) => z.ZodO
452
452
  }>, z.ZodType<T, z.ZodTypeDef, T>]>>;
453
453
  }, "strip", z.ZodTypeAny, z.objectUtil.addQuestionMarks<z.baseObjectOutputType<{
454
454
  success: z.ZodBoolean;
455
- message: z.ZodString;
455
+ message: z.ZodString | z.ZodOptional<z.ZodString> | z.ZodNullable<z.ZodString> | z.ZodOptional<z.ZodNullable<z.ZodString>>;
456
456
  data: z.ZodOptional<z.ZodUnion<[z.ZodObject<{
457
457
  metadata: z.ZodOptional<z.ZodObject<{
458
458
  page: z.ZodNumber;
@@ -490,7 +490,7 @@ export declare const createResponseSchema: <T>(schema: z.ZodSchema<T>) => z.ZodO
490
490
  }>, z.ZodType<T, z.ZodTypeDef, T>]>>;
491
491
  }>, any> extends infer T_1 ? { [k in keyof T_1]: z.objectUtil.addQuestionMarks<z.baseObjectOutputType<{
492
492
  success: z.ZodBoolean;
493
- message: z.ZodString;
493
+ message: z.ZodString | z.ZodOptional<z.ZodString> | z.ZodNullable<z.ZodString> | z.ZodOptional<z.ZodNullable<z.ZodString>>;
494
494
  data: z.ZodOptional<z.ZodUnion<[z.ZodObject<{
495
495
  metadata: z.ZodOptional<z.ZodObject<{
496
496
  page: z.ZodNumber;
@@ -528,7 +528,7 @@ export declare const createResponseSchema: <T>(schema: z.ZodSchema<T>) => z.ZodO
528
528
  }>, z.ZodType<T, z.ZodTypeDef, T>]>>;
529
529
  }>, any>[k]; } : never, z.baseObjectInputType<{
530
530
  success: z.ZodBoolean;
531
- message: z.ZodString;
531
+ message: z.ZodString | z.ZodOptional<z.ZodString> | z.ZodNullable<z.ZodString> | z.ZodOptional<z.ZodNullable<z.ZodString>>;
532
532
  data: z.ZodOptional<z.ZodUnion<[z.ZodObject<{
533
533
  metadata: z.ZodOptional<z.ZodObject<{
534
534
  page: z.ZodNumber;
@@ -566,7 +566,7 @@ export declare const createResponseSchema: <T>(schema: z.ZodSchema<T>) => z.ZodO
566
566
  }>, z.ZodType<T, z.ZodTypeDef, T>]>>;
567
567
  }> extends infer T_2 ? { [k_1 in keyof T_2]: z.baseObjectInputType<{
568
568
  success: z.ZodBoolean;
569
- message: z.ZodString;
569
+ message: z.ZodString | z.ZodOptional<z.ZodString> | z.ZodNullable<z.ZodString> | z.ZodOptional<z.ZodNullable<z.ZodString>>;
570
570
  data: z.ZodOptional<z.ZodUnion<[z.ZodObject<{
571
571
  metadata: z.ZodOptional<z.ZodObject<{
572
572
  page: z.ZodNumber;
@@ -604,14 +604,14 @@ export declare const createResponseSchema: <T>(schema: z.ZodSchema<T>) => z.ZodO
604
604
  }>, z.ZodType<T, z.ZodTypeDef, T>]>>;
605
605
  }>[k_1]; } : never>;
606
606
  export declare const TokenSchema: z.ZodObject<{
607
- accessToken: z.ZodString;
608
- refreshToken: z.ZodString;
607
+ accessToken: z.ZodString | z.ZodOptional<z.ZodString> | z.ZodNullable<z.ZodString> | z.ZodOptional<z.ZodNullable<z.ZodString>>;
608
+ refreshToken: z.ZodString | z.ZodOptional<z.ZodString> | z.ZodNullable<z.ZodString> | z.ZodOptional<z.ZodNullable<z.ZodString>>;
609
609
  }, "strip", z.ZodTypeAny, {
610
- refreshToken: string;
611
- accessToken: string;
610
+ refreshToken?: string | null | undefined;
611
+ accessToken?: string | null | undefined;
612
612
  }, {
613
- refreshToken: string;
614
- accessToken: string;
613
+ refreshToken?: string | null | undefined;
614
+ accessToken?: string | null | undefined;
615
615
  }>;
616
616
  export declare const UpdateSortingOrderSchema: z.ZodObject<{
617
617
  startIndex: z.ZodDefault<z.ZodNumber>;
@@ -91,8 +91,11 @@ exports.WorkHourSettingSchema = zod_1.z.object({
91
91
  holidayHours: global_validation_1.ZodValidation.array(exports.HolidayHourSchema).default([]),
92
92
  });
93
93
  exports.LoginSchema = zod_1.z.object({
94
- email: global_validation_1.ZodValidation.email('Email'),
95
- password: global_validation_1.ZodValidation.string('Password'),
94
+ email: global_validation_1.ZodValidation.email('Email', {
95
+ requiredMessage: 'Please enter a valid email address.',
96
+ invalidMessage: 'Please enter a valid email address.',
97
+ }),
98
+ password: global_validation_1.ZodValidation.string('Password', { requiredMessage: 'Please enter password' }),
96
99
  });
97
100
  const metadataSchema = zod_1.z.object({
98
101
  page: global_validation_1.ZodValidation.number(),
@@ -1 +1 @@
1
- {"version":3,"file":"common-validation.js","sourceRoot":"/","sources":["utilities/validation/common-validation.ts"],"names":[],"mappings":";;;AAAA,6BAAmC;AACnC,2DAAyD;AACzD,kCAAkF;AAKlF,MAAM,gBAAgB,GAAmC,OAAC,CAAC,IAAI,CAAC,GAAG,EAAE,CACpE,OAAC,CAAC,MAAM,CAAC,OAAC,CAAC,KAAK,CAAC,CAAC,OAAC,CAAC,GAAG,EAAE,EAAE,oBAAoB,CAAC,CAAC,CAAC,CAClD,CAAC;AAKF,MAAM,oBAAoB,GAAG,OAAC,CAAC,MAAM,CAAC;IACrC,GAAG,EAAE,OAAC,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE;IACvB,GAAG,EAAE,OAAC,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE;IACvB,GAAG,EAAE,OAAC,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE;IACvB,IAAI,EAAE,OAAC,CAAC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,OAAC,CAAC,MAAM,CAAC;IAChD,UAAU,EAAE,iCAAa,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC;IACzD,IAAI,EAAE,iCAAa,CAAC,KAAK,CAAC,iCAAa,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC;CACnE,CAAC,CAAC;AAMU,QAAA,YAAY,GAAG,OAAC,CAAC,MAAM,CAAC;IACpC,GAAG,EAAE,iCAAa,CAAC,QAAQ,CAAC,KAAK,CAAC;IAClC,UAAU,EAAE,iCAAa,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC;CAC9D,CAAC,CAAC;AAMU,QAAA,QAAQ,GAAG,iCAAa,CAAC,QAAQ,EAAE,CAAC","sourcesContent":["import { z, ZodSchema } from 'zod';\r\nimport { DTO, ZodValidation } from './global-validation';\r\nimport { GeoLocationType, HolidayWorkStatus, WeekDay, WorkStatus } from '../enum';\r\n\r\n/**\r\n * Define MongoDB query schema (fields + operators) using lazy evaluation to avoid circular dependency\r\n */\r\nconst MongoQuerySchema: z.ZodType<Record<string, any>> = z.lazy(() =>\r\n\tz.record(z.union([z.any(), MongoOperatorsSchema]))\r\n);\r\n\r\n/**\r\n * Define allowed MongoDB query operators\r\n */\r\nconst MongoOperatorsSchema = z.object({\r\n\t$eq: z.any().optional(),\r\n\t$ne: z.any().optional(),\r\n\t$gt: z.any().optional(),\r\n\t$gte: z.any().optional(),\r\n\t$lt: z.any().optional(),\r\n\t$lte: z.any().optional(),\r\n\t$in: z.array(z.any()).optional(),\r\n\t$nin: z.array(z.any()).optional(),\r\n\t$exists: z.boolean().optional(),\r\n\t$regex: z.string().optional(),\r\n\t$and: z.array(MongoQuerySchema).optional(),\r\n\t$or: z.array(MongoQuerySchema).optional(),\r\n\t$not: MongoQuerySchema.optional(),\r\n\t$nor: z.array(MongoQuerySchema).optional(),\r\n});\r\n\r\nconst sortSchema = z.record(z.string(), z.union([z.literal(1), z.literal(-1)]));\r\n\r\nconst populateSchema = z.object({\r\n\tpath: z.string(), // required\r\n\tselect: z.record(z.string(), z.union([z.literal(0), z.literal(1)])).optional(),\r\n\tmatch: z.record(z.string(), z.any()).optional(),\r\n\toptions: z\r\n\t\t.object({\r\n\t\t\tsort: sortSchema.optional(),\r\n\t\t\tlimit: z.number().optional(),\r\n\t\t\tskip: z.number().optional(),\r\n\t\t})\r\n\t\t.optional(),\r\n});\r\n\r\n/**\r\n * Define the filter schema using MongoQuerySchema\r\n */\r\nexport const FilterSchema = z\r\n\t.object({\r\n\t\tsize: z\r\n\t\t\t.number()\r\n\t\t\t.min(1, { message: 'Size must be greater than 0.' })\r\n\t\t\t.max(100, { message: 'Size cannot exceed 100.' })\r\n\t\t\t.optional()\r\n\t\t\t.default(10),\r\n\t\tpage: z.number().min(1, { message: 'Page number must be at least 1.' }).optional().default(1),\r\n\t\tsort: sortSchema.optional(),\r\n\t\tquery: MongoQuerySchema.optional(),\r\n\t\tselect: z.record(z.string(), z.union([z.literal(0), z.literal(1)])).optional(),\r\n\t\tpopulate: z.union([populateSchema, z.array(populateSchema)]).optional(),\r\n\t})\r\n\t.optional();\r\n\r\n/**\r\n * Infer TypeScript type from Zod schema\r\n */\r\nexport type FilterDTO = z.infer<typeof FilterSchema>;\r\n\r\n/**\r\n * Define String schema\r\n */\r\nexport const StringSchema = z.string().min(1, 'String cannot be empty').max(255, 'String is too long');\r\n\r\n/**\r\n * Common address validation schema that can be reused across models.\r\n * Provides validation for address-related fields.\r\n *\r\n * @example\r\n * ```typescript\r\n * const userSchema = z.object({\r\n * name: z.string(),\r\n * address: AddressSchema\r\n * });\r\n * ```\r\n */\r\nexport const AddressSchema = z.object({\r\n\taddress: ZodValidation.string('Address'),\r\n\tdescription: ZodValidation.string('Description').optional(),\r\n\tcity: ZodValidation.string('City'),\r\n\tstate: ZodValidation.string('State'),\r\n\tcountry: ZodValidation.string('Country'),\r\n\tgeoLocationType: ZodValidation.enumType(GeoLocationType, 'GeoLocationType').default(GeoLocationType.POINT),\r\n\tcoordinates: ZodValidation.array(ZodValidation.number('Coordinate'), 'Coordinates', 2, 2),\r\n\tlatitude: ZodValidation.number('Latitude'),\r\n\tlongitude: ZodValidation.number('Longitude'),\r\n});\r\n\r\n/**\r\n * Common user address validation schema that can be reused across models.\r\n * Provides validation for address-related fields.\r\n *\r\n * @example\r\n * ```typescript\r\n * const userSchema = z.object({\r\n * name: z.string(),\r\n * address: UserAddressSchema\r\n * });\r\n * ```\r\n */\r\nexport const UserAddressSchema = AddressSchema.extend({\r\n\taddressLabel: ZodValidation.string('Address Label'),\r\n\tapartment: ZodValidation.string('Apartment'),\r\n\tbuildingName: ZodValidation.string('Building Name'),\r\n\tdeliveryOption: ZodValidation.string('Delivery Option').optional(),\r\n\tinstructions: ZodValidation.string('Instructions').optional(),\r\n});\r\n\r\n/**\r\n * Common duration validation schema that can be reused across models.\r\n * Provides validation for duration fields.\r\n *\r\n * @example\r\n * ```typescript\r\n * const subscriptionSchema = z.object({\r\n * fee: z.number(),\r\n * duration: DurationSchema\r\n * });\r\n * ```\r\n */\r\nexport const DurationSchema = z.object({\r\n\tstart: ZodValidation.date('Start'),\r\n\tend: ZodValidation.date('End').optional(),\r\n});\r\n\r\n/**\r\n * Common Work Hour validation schema that can be reused across models.\r\n * Provides validation for workHourSetting fields.\r\n *\r\n * @example\r\n * ```typescript\r\n * const settingSchema = z.object({\r\n * vat: z.number(),\r\n * workHourSetting: WorkHourSettingSchema\r\n * });\r\n * ```\r\n */\r\nconst StartEndTimeSchema = z.object({\r\n\tstart: ZodValidation.string('Start'),\r\n\tend: ZodValidation.string('End'),\r\n});\r\n\r\nexport const NormalHourSchema = z.object({\r\n\tday: ZodValidation.enumType(WeekDay, 'Day'),\r\n\tstatus: ZodValidation.enumType(WorkStatus, 'Status'),\r\n\topeningHours: ZodValidation.array(StartEndTimeSchema).default([]),\r\n});\r\n\r\nexport const HolidayHourSchema = z.object({\r\n\tdate: ZodValidation.date('Date'),\r\n\tstatus: ZodValidation.enumType(HolidayWorkStatus, 'Status'),\r\n\tclosingHour: StartEndTimeSchema,\r\n});\r\n\r\nexport const WorkHourSettingSchema = z.object({\r\n\tnormalHours: ZodValidation.array(NormalHourSchema).default([]),\r\n\tholidayHours: ZodValidation.array(HolidayHourSchema).default([]),\r\n});\r\n\r\n/**\r\n * Schema for validating user login credentials.\r\n * This schema ensures that the provided email and password meet the required validation rules.\r\n *\r\n * @example\r\n * ```typescript\r\n * const credentials = {\r\n * email: 'user@example.com',\r\n * password: 'securePassword123',\r\n * };\r\n * ```\r\n */\r\nexport const LoginSchema = z.object({\r\n\temail: ZodValidation.email('Email'),\r\n\tpassword: ZodValidation.string('Password'),\r\n});\r\n\r\nconst metadataSchema = z.object({\r\n\tpage: ZodValidation.number(),\r\n\tsize: ZodValidation.number(),\r\n\ttotalElements: ZodValidation.number(),\r\n\ttotalPages: ZodValidation.number(),\r\n});\r\n\r\nexport const createPaginatedSchema = <T>(documentSchema: z.ZodSchema<T>) =>\r\n\tz.object({\r\n\t\tmetadata: metadataSchema.optional(),\r\n\t\tdocuments: ZodValidation.array(documentSchema),\r\n\t});\r\n\r\nexport const createResponseSchema = <T>(schema: z.ZodSchema<T>) =>\r\n\tz.object({\r\n\t\tsuccess: ZodValidation.boolean(),\r\n\t\tmessage: ZodValidation.string(),\r\n\t\tdata: z.union([createPaginatedSchema(schema), schema]).optional(),\r\n\t});\r\n\r\n/**\r\n * Schema for validating token data, typically used for authentication.\r\n * This schema ensures that the provided access token and refresh token are valid strings.\r\n *\r\n * @example\r\n * ```typescript\r\n * const tokens = {\r\n * accessToken: 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...',\r\n * refreshToken: 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...',\r\n * };\r\n * ```\r\n */\r\nexport const TokenSchema = z.object({\r\n\taccessToken: ZodValidation.string('AccessToken'),\r\n\trefreshToken: ZodValidation.string('RefreshToken'),\r\n});\r\n\r\n/**\r\n * Schema validation for sorting order\r\n */\r\nexport const UpdateSortingOrderSchema = z.object({\r\n\tstartIndex: ZodValidation.number('StartIndex').default(1),\r\n\tlist: ZodValidation.array(ZodValidation.objectId('_id'), 'List', 1),\r\n});\r\nexport type UpdateSortingOrderDTO = DTO<typeof UpdateSortingOrderSchema>;\r\n\r\n/**\r\n * Schema validation for delete\r\n */\r\nexport const DeleteSchema = z.object({\r\n\t_id: ZodValidation.objectId('_id'),\r\n\tsoftDelete: ZodValidation.boolean('Soft Delete').default(true),\r\n});\r\nexport type DeleteDTO = DTO<typeof DeleteSchema>;\r\n\r\n/**\r\n * Schema validation for Id\r\n */\r\nexport const IdSchema = ZodValidation.objectId();\r\n"]}
1
+ {"version":3,"file":"common-validation.js","sourceRoot":"/","sources":["utilities/validation/common-validation.ts"],"names":[],"mappings":";;;AAAA,6BAAmC;AACnC,2DAAyD;AACzD,kCAAkF;AAKlF,MAAM,gBAAgB,GAAmC,OAAC,CAAC,IAAI,CAAC,GAAG,EAAE,CACpE,OAAC,CAAC,MAAM,CAAC,OAAC,CAAC,KAAK,CAAC,CAAC,OAAC,CAAC,GAAG,EAAE,EAAE,oBAAoB,CAAC,CAAC,CAAC,CAClD,CAAC;AAKF,MAAM,oBAAoB,GAAG,OAAC,CAAC,MAAM,CAAC;IACrC,GAAG,EAAE,OAAC,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE;IACvB,GAAG,EAAE,OAAC,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE;IACvB,GAAG,EAAE,OAAC,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE;IACvB,IAAI,EAAE,OAAC,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE;IACxB,GAAG,EAAE,OAAC,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE;IACvB,IAAI,EAAE,OAAC,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE;IACxB,GAAG,EAAE,OAAC,CAAC,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,OAAO,CAAC,CAAC,CAAC;IACzD,IAAI,EAAE,iCAAa,CAAC,KAAK,CAAC,iCAAa,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC;CACnE,CAAC,CAAC;AAMU,QAAA,YAAY,GAAG,OAAC,CAAC,MAAM,CAAC;IACpC,GAAG,EAAE,iCAAa,CAAC,QAAQ,CAAC,KAAK,CAAC;IAClC,UAAU,EAAE,iCAAa,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC;CAC9D,CAAC,CAAC;AAMU,QAAA,QAAQ,GAAG,iCAAa,CAAC,QAAQ,EAAE,CAAC","sourcesContent":["import { z, ZodSchema } from 'zod';\r\nimport { DTO, ZodValidation } from './global-validation';\r\nimport { GeoLocationType, HolidayWorkStatus, WeekDay, WorkStatus } from '../enum';\r\n\r\n/**\r\n * Define MongoDB query schema (fields + operators) using lazy evaluation to avoid circular dependency\r\n */\r\nconst MongoQuerySchema: z.ZodType<Record<string, any>> = z.lazy(() =>\r\n\tz.record(z.union([z.any(), MongoOperatorsSchema]))\r\n);\r\n\r\n/**\r\n * Define allowed MongoDB query operators\r\n */\r\nconst MongoOperatorsSchema = z.object({\r\n\t$eq: z.any().optional(),\r\n\t$ne: z.any().optional(),\r\n\t$gt: z.any().optional(),\r\n\t$gte: z.any().optional(),\r\n\t$lt: z.any().optional(),\r\n\t$lte: z.any().optional(),\r\n\t$in: z.array(z.any()).optional(),\r\n\t$nin: z.array(z.any()).optional(),\r\n\t$exists: z.boolean().optional(),\r\n\t$regex: z.string().optional(),\r\n\t$and: z.array(MongoQuerySchema).optional(),\r\n\t$or: z.array(MongoQuerySchema).optional(),\r\n\t$not: MongoQuerySchema.optional(),\r\n\t$nor: z.array(MongoQuerySchema).optional(),\r\n});\r\n\r\nconst sortSchema = z.record(z.string(), z.union([z.literal(1), z.literal(-1)]));\r\n\r\nconst populateSchema = z.object({\r\n\tpath: z.string(), // required\r\n\tselect: z.record(z.string(), z.union([z.literal(0), z.literal(1)])).optional(),\r\n\tmatch: z.record(z.string(), z.any()).optional(),\r\n\toptions: z\r\n\t\t.object({\r\n\t\t\tsort: sortSchema.optional(),\r\n\t\t\tlimit: z.number().optional(),\r\n\t\t\tskip: z.number().optional(),\r\n\t\t})\r\n\t\t.optional(),\r\n});\r\n\r\n/**\r\n * Define the filter schema using MongoQuerySchema\r\n */\r\nexport const FilterSchema = z\r\n\t.object({\r\n\t\tsize: z\r\n\t\t\t.number()\r\n\t\t\t.min(1, { message: 'Size must be greater than 0.' })\r\n\t\t\t.max(100, { message: 'Size cannot exceed 100.' })\r\n\t\t\t.optional()\r\n\t\t\t.default(10),\r\n\t\tpage: z.number().min(1, { message: 'Page number must be at least 1.' }).optional().default(1),\r\n\t\tsort: sortSchema.optional(),\r\n\t\tquery: MongoQuerySchema.optional(),\r\n\t\tselect: z.record(z.string(), z.union([z.literal(0), z.literal(1)])).optional(),\r\n\t\tpopulate: z.union([populateSchema, z.array(populateSchema)]).optional(),\r\n\t})\r\n\t.optional();\r\n\r\n/**\r\n * Infer TypeScript type from Zod schema\r\n */\r\nexport type FilterDTO = z.infer<typeof FilterSchema>;\r\n\r\n/**\r\n * Define String schema\r\n */\r\nexport const StringSchema = z.string().min(1, 'String cannot be empty').max(255, 'String is too long');\r\n\r\n/**\r\n * Common address validation schema that can be reused across models.\r\n * Provides validation for address-related fields.\r\n *\r\n * @example\r\n * ```typescript\r\n * const userSchema = z.object({\r\n * name: z.string(),\r\n * address: AddressSchema\r\n * });\r\n * ```\r\n */\r\nexport const AddressSchema = z.object({\r\n\taddress: ZodValidation.string('Address'),\r\n\tdescription: ZodValidation.string('Description').optional(),\r\n\tcity: ZodValidation.string('City'),\r\n\tstate: ZodValidation.string('State'),\r\n\tcountry: ZodValidation.string('Country'),\r\n\tgeoLocationType: ZodValidation.enumType(GeoLocationType, 'GeoLocationType').default(GeoLocationType.POINT),\r\n\tcoordinates: ZodValidation.array(ZodValidation.number('Coordinate'), 'Coordinates', 2, 2),\r\n\tlatitude: ZodValidation.number('Latitude'),\r\n\tlongitude: ZodValidation.number('Longitude'),\r\n});\r\n\r\n/**\r\n * Common user address validation schema that can be reused across models.\r\n * Provides validation for address-related fields.\r\n *\r\n * @example\r\n * ```typescript\r\n * const userSchema = z.object({\r\n * name: z.string(),\r\n * address: UserAddressSchema\r\n * });\r\n * ```\r\n */\r\nexport const UserAddressSchema = AddressSchema.extend({\r\n\taddressLabel: ZodValidation.string('Address Label'),\r\n\tapartment: ZodValidation.string('Apartment'),\r\n\tbuildingName: ZodValidation.string('Building Name'),\r\n\tdeliveryOption: ZodValidation.string('Delivery Option').optional(),\r\n\tinstructions: ZodValidation.string('Instructions').optional(),\r\n});\r\n\r\n/**\r\n * Common duration validation schema that can be reused across models.\r\n * Provides validation for duration fields.\r\n *\r\n * @example\r\n * ```typescript\r\n * const subscriptionSchema = z.object({\r\n * fee: z.number(),\r\n * duration: DurationSchema\r\n * });\r\n * ```\r\n */\r\nexport const DurationSchema = z.object({\r\n\tstart: ZodValidation.date('Start'),\r\n\tend: ZodValidation.date('End').optional(),\r\n});\r\n\r\n/**\r\n * Common Work Hour validation schema that can be reused across models.\r\n * Provides validation for workHourSetting fields.\r\n *\r\n * @example\r\n * ```typescript\r\n * const settingSchema = z.object({\r\n * vat: z.number(),\r\n * workHourSetting: WorkHourSettingSchema\r\n * });\r\n * ```\r\n */\r\nconst StartEndTimeSchema = z.object({\r\n\tstart: ZodValidation.string('Start'),\r\n\tend: ZodValidation.string('End'),\r\n});\r\n\r\nexport const NormalHourSchema = z.object({\r\n\tday: ZodValidation.enumType(WeekDay, 'Day'),\r\n\tstatus: ZodValidation.enumType(WorkStatus, 'Status'),\r\n\topeningHours: ZodValidation.array(StartEndTimeSchema).default([]),\r\n});\r\n\r\nexport const HolidayHourSchema = z.object({\r\n\tdate: ZodValidation.date('Date'),\r\n\tstatus: ZodValidation.enumType(HolidayWorkStatus, 'Status'),\r\n\tclosingHour: StartEndTimeSchema,\r\n});\r\n\r\nexport const WorkHourSettingSchema = z.object({\r\n\tnormalHours: ZodValidation.array(NormalHourSchema).default([]),\r\n\tholidayHours: ZodValidation.array(HolidayHourSchema).default([]),\r\n});\r\n\r\n/**\r\n * Schema for validating user login credentials.\r\n * This schema ensures that the provided email and password meet the required validation rules.\r\n *\r\n * @example\r\n * ```typescript\r\n * const credentials = {\r\n * email: 'user@example.com',\r\n * password: 'securePassword123',\r\n * };\r\n * ```\r\n */\r\nexport const LoginSchema = z.object({\r\n\temail: ZodValidation.email('Email', {\r\n\t\trequiredMessage: 'Please enter a valid email address.',\r\n\t\tinvalidMessage: 'Please enter a valid email address.',\r\n\t}),\r\n\tpassword: ZodValidation.string('Password', { requiredMessage: 'Please enter password' }),\r\n});\r\nconst metadataSchema = z.object({\r\n\tpage: ZodValidation.number(),\r\n\tsize: ZodValidation.number(),\r\n\ttotalElements: ZodValidation.number(),\r\n\ttotalPages: ZodValidation.number(),\r\n});\r\n\r\nexport const createPaginatedSchema = <T>(documentSchema: z.ZodSchema<T>) =>\r\n\tz.object({\r\n\t\tmetadata: metadataSchema.optional(),\r\n\t\tdocuments: ZodValidation.array(documentSchema),\r\n\t});\r\n\r\nexport const createResponseSchema = <T>(schema: z.ZodSchema<T>) =>\r\n\tz.object({\r\n\t\tsuccess: ZodValidation.boolean(),\r\n\t\tmessage: ZodValidation.string(),\r\n\t\tdata: z.union([createPaginatedSchema(schema), schema]).optional(),\r\n\t});\r\n\r\n/**\r\n * Schema for validating token data, typically used for authentication.\r\n * This schema ensures that the provided access token and refresh token are valid strings.\r\n *\r\n * @example\r\n * ```typescript\r\n * const tokens = {\r\n * accessToken: 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...',\r\n * refreshToken: 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...',\r\n * };\r\n * ```\r\n */\r\nexport const TokenSchema = z.object({\r\n\taccessToken: ZodValidation.string('AccessToken'),\r\n\trefreshToken: ZodValidation.string('RefreshToken'),\r\n});\r\n\r\n/**\r\n * Schema validation for sorting order\r\n */\r\nexport const UpdateSortingOrderSchema = z.object({\r\n\tstartIndex: ZodValidation.number('StartIndex').default(1),\r\n\tlist: ZodValidation.array(ZodValidation.objectId('_id'), 'List', 1),\r\n});\r\nexport type UpdateSortingOrderDTO = DTO<typeof UpdateSortingOrderSchema>;\r\n\r\n/**\r\n * Schema validation for delete\r\n */\r\nexport const DeleteSchema = z.object({\r\n\t_id: ZodValidation.objectId('_id'),\r\n\tsoftDelete: ZodValidation.boolean('Soft Delete').default(true),\r\n});\r\nexport type DeleteDTO = DTO<typeof DeleteSchema>;\r\n\r\n/**\r\n * Schema validation for Id\r\n */\r\nexport const IdSchema = ZodValidation.objectId();\r\n"]}
@@ -12,11 +12,25 @@ export declare class ZodValidation {
12
12
  isNegative?: boolean;
13
13
  isNonnegative?: boolean;
14
14
  }): z.ZodNumber;
15
- static string(field?: string, minLength?: number, maxLength?: number, regex?: {
16
- pattern: RegExp;
17
- message: string;
18
- }): z.ZodString;
19
- static email(field?: string): z.ZodString;
15
+ static string(field?: string, options?: {
16
+ minLength?: number;
17
+ maxLength?: number;
18
+ optional?: boolean;
19
+ nullable?: boolean;
20
+ minMessage?: string;
21
+ maxMessage?: string;
22
+ requiredMessage?: string;
23
+ regex?: {
24
+ pattern: RegExp;
25
+ message: string;
26
+ };
27
+ }): z.ZodString | z.ZodOptional<z.ZodString> | z.ZodNullable<z.ZodString> | z.ZodOptional<z.ZodNullable<z.ZodString>>;
28
+ static email(field?: string, options?: {
29
+ requiredMessage?: string;
30
+ invalidMessage?: string;
31
+ optional?: boolean;
32
+ nullable?: boolean;
33
+ }): z.ZodString | z.ZodOptional<z.ZodString> | z.ZodNullable<z.ZodString> | z.ZodOptional<z.ZodNullable<z.ZodString>>;
20
34
  static url(field?: string): z.ZodString;
21
35
  static phoneNumber(field?: string): z.ZodString;
22
36
  static date(field?: string, minDate?: Date, maxDate?: Date): z.ZodEffects<z.ZodEffects<z.ZodUnion<[z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, Date, string>, z.ZodDate]>, Date, string | Date>, Date, string | Date>;
@@ -55,26 +55,46 @@ class ZodValidation {
55
55
  }
56
56
  return schema;
57
57
  }
58
- static string(field = 'Field', minLength, maxLength, regex) {
58
+ static string(field = 'Field', options) {
59
59
  let schema = zod_1.z.string({
60
- required_error: `${field} is required`,
61
- invalid_type_error: `${field} must be a string`,
60
+ required_error: options?.requiredMessage || `${field} is required`,
62
61
  });
63
- if (minLength !== undefined) {
64
- schema = schema.min(minLength, `${field} value length must be greater than or equal to ${minLength}`);
62
+ if (options?.minLength) {
63
+ schema = schema.min(options.minLength, options.minMessage || `${field} must be at least ${options.minLength} characters`);
64
+ }
65
+ if (options?.maxLength) {
66
+ schema = schema.max(options.maxLength, options.maxMessage || `${field} must be at most ${options.maxLength} characters`);
67
+ }
68
+ if (options?.regex) {
69
+ schema = schema.regex(options.regex.pattern, options.regex.message);
65
70
  }
66
- if (maxLength !== undefined) {
67
- schema = schema.max(maxLength, `${field} value length must be less than or equal to ${maxLength}`);
71
+ if (options?.nullable && options?.optional) {
72
+ return schema.nullish();
68
73
  }
69
- if (regex !== undefined) {
70
- schema = schema.regex(regex.pattern, regex.message);
74
+ if (options?.nullable) {
75
+ return schema.nullable();
76
+ }
77
+ if (options?.optional) {
78
+ return schema.optional();
71
79
  }
72
80
  return schema;
73
81
  }
74
- static email(field = 'Field') {
75
- return zod_1.z
76
- .string({ required_error: `${field} is required` })
77
- .email(`${field} must be a valid email address`);
82
+ static email(field = 'Email', options) {
83
+ const schema = zod_1.z
84
+ .string({
85
+ required_error: options?.requiredMessage || `${field} is required`,
86
+ })
87
+ .email(options?.invalidMessage || `${field} must be a valid email address`);
88
+ if (options?.nullable && options?.optional) {
89
+ return schema.nullish();
90
+ }
91
+ if (options?.nullable) {
92
+ return schema.nullable();
93
+ }
94
+ if (options?.optional) {
95
+ return schema.optional();
96
+ }
97
+ return schema;
78
98
  }
79
99
  static url(field = 'Field') {
80
100
  return zod_1.z.string({ required_error: `${field} is required` }).url(`${field} must be a valid URL`);