@lyxa.ai/types 1.3.179 → 1.3.180
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/README.md
CHANGED
package/package.json
CHANGED
|
@@ -26,8 +26,8 @@ export declare const FilterSchema: z.ZodOptional<z.ZodObject<{
|
|
|
26
26
|
searchFields?: string[] | undefined;
|
|
27
27
|
} | undefined;
|
|
28
28
|
sort?: Record<string, 1 | -1> | undefined;
|
|
29
|
-
select?: Record<string, 0 | 1> | undefined;
|
|
30
29
|
populate?: any;
|
|
30
|
+
select?: Record<string, 0 | 1> | undefined;
|
|
31
31
|
query?: Record<string, any> | undefined;
|
|
32
32
|
}, {
|
|
33
33
|
search?: {
|
|
@@ -36,8 +36,8 @@ export declare const FilterSchema: z.ZodOptional<z.ZodObject<{
|
|
|
36
36
|
} | undefined;
|
|
37
37
|
sort?: Record<string, 1 | -1> | undefined;
|
|
38
38
|
size?: number | undefined;
|
|
39
|
-
select?: Record<string, 0 | 1> | undefined;
|
|
40
39
|
populate?: any;
|
|
40
|
+
select?: Record<string, 0 | 1> | undefined;
|
|
41
41
|
query?: Record<string, any> | undefined;
|
|
42
42
|
page?: number | undefined;
|
|
43
43
|
}>>;
|
|
@@ -46,7 +46,7 @@ export declare const StringSchema: z.ZodString;
|
|
|
46
46
|
export declare const AddressSchema: z.ZodObject<{
|
|
47
47
|
address: z.ZodString | z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>;
|
|
48
48
|
description: z.ZodOptional<z.ZodString> | z.ZodOptional<z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>>;
|
|
49
|
-
city: z.ZodString | z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string
|
|
49
|
+
city: z.ZodOptional<z.ZodString> | z.ZodOptional<z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>>;
|
|
50
50
|
state: z.ZodOptional<z.ZodString> | z.ZodOptional<z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>>;
|
|
51
51
|
country: z.ZodString | z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>;
|
|
52
52
|
location: z.ZodObject<{
|
|
@@ -68,11 +68,11 @@ export declare const AddressSchema: z.ZodObject<{
|
|
|
68
68
|
coordinates: [number, number];
|
|
69
69
|
};
|
|
70
70
|
address: string;
|
|
71
|
-
city: string;
|
|
72
71
|
country: string;
|
|
73
72
|
latitude: number;
|
|
74
73
|
longitude: number;
|
|
75
74
|
description?: string | undefined;
|
|
75
|
+
city?: string | undefined;
|
|
76
76
|
state?: string | undefined;
|
|
77
77
|
zone?: import("mongoose").Types.ObjectId | undefined;
|
|
78
78
|
}, {
|
|
@@ -81,11 +81,11 @@ export declare const AddressSchema: z.ZodObject<{
|
|
|
81
81
|
type?: GeoLocationType | undefined;
|
|
82
82
|
};
|
|
83
83
|
address: string;
|
|
84
|
-
city: string;
|
|
85
84
|
country: string;
|
|
86
85
|
latitude: number;
|
|
87
86
|
longitude: number;
|
|
88
87
|
description?: string | undefined;
|
|
88
|
+
city?: string | undefined;
|
|
89
89
|
state?: string | undefined;
|
|
90
90
|
zone?: string | import("mongoose").Types.ObjectId | undefined;
|
|
91
91
|
}>;
|
|
@@ -93,7 +93,7 @@ export type AddressDTO = DTO<typeof AddressSchema>;
|
|
|
93
93
|
export declare const UserAddressSchema: z.ZodObject<{
|
|
94
94
|
address: z.ZodString | z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>;
|
|
95
95
|
description: z.ZodOptional<z.ZodString> | z.ZodOptional<z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>>;
|
|
96
|
-
city: z.ZodString | z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string
|
|
96
|
+
city: z.ZodOptional<z.ZodString> | z.ZodOptional<z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>>;
|
|
97
97
|
state: z.ZodOptional<z.ZodString> | z.ZodOptional<z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>>;
|
|
98
98
|
country: z.ZodString | z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>;
|
|
99
99
|
location: z.ZodObject<{
|
|
@@ -121,7 +121,6 @@ export declare const UserAddressSchema: z.ZodObject<{
|
|
|
121
121
|
coordinates: [number, number];
|
|
122
122
|
};
|
|
123
123
|
address: string;
|
|
124
|
-
city: string;
|
|
125
124
|
country: string;
|
|
126
125
|
latitude: number;
|
|
127
126
|
longitude: number;
|
|
@@ -129,6 +128,7 @@ export declare const UserAddressSchema: z.ZodObject<{
|
|
|
129
128
|
apartment: string;
|
|
130
129
|
buildingName: string;
|
|
131
130
|
description?: string | undefined;
|
|
131
|
+
city?: string | undefined;
|
|
132
132
|
state?: string | undefined;
|
|
133
133
|
zone?: import("mongoose").Types.ObjectId | undefined;
|
|
134
134
|
deliveryOption?: string | undefined;
|
|
@@ -139,7 +139,6 @@ export declare const UserAddressSchema: z.ZodObject<{
|
|
|
139
139
|
type?: GeoLocationType | undefined;
|
|
140
140
|
};
|
|
141
141
|
address: string;
|
|
142
|
-
city: string;
|
|
143
142
|
country: string;
|
|
144
143
|
latitude: number;
|
|
145
144
|
longitude: number;
|
|
@@ -147,6 +146,7 @@ export declare const UserAddressSchema: z.ZodObject<{
|
|
|
147
146
|
apartment: string;
|
|
148
147
|
buildingName: string;
|
|
149
148
|
description?: string | undefined;
|
|
149
|
+
city?: string | undefined;
|
|
150
150
|
state?: string | undefined;
|
|
151
151
|
zone?: string | import("mongoose").Types.ObjectId | undefined;
|
|
152
152
|
deliveryOption?: string | undefined;
|
|
@@ -156,7 +156,7 @@ export type UserAddressDTO = DTO<typeof UserAddressSchema>;
|
|
|
156
156
|
export declare const RegularOrderAddressSchema: z.ZodObject<{
|
|
157
157
|
address: z.ZodString | z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>;
|
|
158
158
|
description: z.ZodOptional<z.ZodString> | z.ZodOptional<z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>>;
|
|
159
|
-
city: z.ZodString | z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string
|
|
159
|
+
city: z.ZodOptional<z.ZodString> | z.ZodOptional<z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>>;
|
|
160
160
|
state: z.ZodOptional<z.ZodString> | z.ZodOptional<z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>>;
|
|
161
161
|
country: z.ZodString | z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>;
|
|
162
162
|
location: z.ZodObject<{
|
|
@@ -187,7 +187,6 @@ export declare const RegularOrderAddressSchema: z.ZodObject<{
|
|
|
187
187
|
coordinates: [number, number];
|
|
188
188
|
};
|
|
189
189
|
address: string;
|
|
190
|
-
city: string;
|
|
191
190
|
country: string;
|
|
192
191
|
latitude: number;
|
|
193
192
|
longitude: number;
|
|
@@ -195,6 +194,7 @@ export declare const RegularOrderAddressSchema: z.ZodObject<{
|
|
|
195
194
|
apartment: string;
|
|
196
195
|
buildingName: string;
|
|
197
196
|
description?: string | undefined;
|
|
197
|
+
city?: string | undefined;
|
|
198
198
|
state?: string | undefined;
|
|
199
199
|
zone?: import("mongoose").Types.ObjectId | undefined;
|
|
200
200
|
deliveryOption?: string | undefined;
|
|
@@ -206,7 +206,6 @@ export declare const RegularOrderAddressSchema: z.ZodObject<{
|
|
|
206
206
|
type?: GeoLocationType | undefined;
|
|
207
207
|
};
|
|
208
208
|
address: string;
|
|
209
|
-
city: string;
|
|
210
209
|
country: string;
|
|
211
210
|
latitude: number;
|
|
212
211
|
longitude: number;
|
|
@@ -214,6 +213,7 @@ export declare const RegularOrderAddressSchema: z.ZodObject<{
|
|
|
214
213
|
apartment: string;
|
|
215
214
|
buildingName: string;
|
|
216
215
|
description?: string | undefined;
|
|
216
|
+
city?: string | undefined;
|
|
217
217
|
state?: string | undefined;
|
|
218
218
|
zone?: string | import("mongoose").Types.ObjectId | undefined;
|
|
219
219
|
deliveryOption?: string | undefined;
|
|
@@ -223,7 +223,7 @@ export type RegularOrderAddressDTO = DTO<typeof RegularOrderAddressSchema>;
|
|
|
223
223
|
export declare const CourierAddressSchema: z.ZodObject<{
|
|
224
224
|
address: z.ZodString | z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>;
|
|
225
225
|
description: z.ZodOptional<z.ZodString> | z.ZodOptional<z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>>;
|
|
226
|
-
city: z.ZodString | z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string
|
|
226
|
+
city: z.ZodOptional<z.ZodString> | z.ZodOptional<z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>>;
|
|
227
227
|
state: z.ZodOptional<z.ZodString> | z.ZodOptional<z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>>;
|
|
228
228
|
country: z.ZodString | z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>;
|
|
229
229
|
location: z.ZodObject<{
|
|
@@ -255,7 +255,6 @@ export declare const CourierAddressSchema: z.ZodObject<{
|
|
|
255
255
|
coordinates: [number, number];
|
|
256
256
|
};
|
|
257
257
|
address: string;
|
|
258
|
-
city: string;
|
|
259
258
|
country: string;
|
|
260
259
|
latitude: number;
|
|
261
260
|
longitude: number;
|
|
@@ -264,6 +263,7 @@ export declare const CourierAddressSchema: z.ZodObject<{
|
|
|
264
263
|
buildingName: string;
|
|
265
264
|
phoneNumber: string;
|
|
266
265
|
description?: string | undefined;
|
|
266
|
+
city?: string | undefined;
|
|
267
267
|
state?: string | undefined;
|
|
268
268
|
zone?: import("mongoose").Types.ObjectId | undefined;
|
|
269
269
|
deliveryOption?: string | undefined;
|
|
@@ -275,7 +275,6 @@ export declare const CourierAddressSchema: z.ZodObject<{
|
|
|
275
275
|
type?: GeoLocationType | undefined;
|
|
276
276
|
};
|
|
277
277
|
address: string;
|
|
278
|
-
city: string;
|
|
279
278
|
country: string;
|
|
280
279
|
latitude: number;
|
|
281
280
|
longitude: number;
|
|
@@ -284,6 +283,7 @@ export declare const CourierAddressSchema: z.ZodObject<{
|
|
|
284
283
|
buildingName: string;
|
|
285
284
|
phoneNumber: string;
|
|
286
285
|
description?: string | undefined;
|
|
286
|
+
city?: string | undefined;
|
|
287
287
|
state?: string | undefined;
|
|
288
288
|
zone?: string | import("mongoose").Types.ObjectId | undefined;
|
|
289
289
|
deliveryOption?: string | undefined;
|
|
@@ -733,12 +733,12 @@ export declare const GetByIdInputSchema: z.ZodObject<{
|
|
|
733
733
|
populate: z.ZodOptional<z.ZodUnion<[z.ZodType<any, z.ZodTypeDef, any>, z.ZodArray<z.ZodType<any, z.ZodTypeDef, any>, "many">]>>;
|
|
734
734
|
}, "strip", z.ZodTypeAny, {
|
|
735
735
|
_id: import("mongoose").Types.ObjectId;
|
|
736
|
-
select?: Record<string, 0 | 1> | undefined;
|
|
737
736
|
populate?: any;
|
|
737
|
+
select?: Record<string, 0 | 1> | undefined;
|
|
738
738
|
}, {
|
|
739
739
|
_id: string | import("mongoose").Types.ObjectId;
|
|
740
|
-
select?: Record<string, 0 | 1> | undefined;
|
|
741
740
|
populate?: any;
|
|
741
|
+
select?: Record<string, 0 | 1> | undefined;
|
|
742
742
|
}>;
|
|
743
743
|
export type GetByIdInputDTO = DTO<typeof GetByIdInputSchema>;
|
|
744
744
|
export declare const GetProductByIdInputSchema: z.ZodObject<{
|
|
@@ -751,12 +751,12 @@ export declare const GetProductByIdInputSchema: z.ZodObject<{
|
|
|
751
751
|
_id: import("mongoose").Types.ObjectId;
|
|
752
752
|
withAttributeHiddenItems: boolean;
|
|
753
753
|
withAddonsHiddenItems: boolean;
|
|
754
|
-
select?: Record<string, 0 | 1> | undefined;
|
|
755
754
|
populate?: any;
|
|
755
|
+
select?: Record<string, 0 | 1> | undefined;
|
|
756
756
|
}, {
|
|
757
757
|
_id: string | import("mongoose").Types.ObjectId;
|
|
758
|
-
select?: Record<string, 0 | 1> | undefined;
|
|
759
758
|
populate?: any;
|
|
759
|
+
select?: Record<string, 0 | 1> | undefined;
|
|
760
760
|
withAttributeHiddenItems?: boolean | undefined;
|
|
761
761
|
withAddonsHiddenItems?: boolean | undefined;
|
|
762
762
|
}>;
|
|
@@ -768,13 +768,13 @@ export declare const GetOrderByIdInputSchema: z.ZodObject<{
|
|
|
768
768
|
userOrderCompletionScope: z.ZodOptional<z.ZodNativeEnum<typeof UserOrderCompletionScope>>;
|
|
769
769
|
}, "strip", z.ZodTypeAny, {
|
|
770
770
|
_id: import("mongoose").Types.ObjectId;
|
|
771
|
-
select?: Record<string, 0 | 1> | undefined;
|
|
772
771
|
populate?: any;
|
|
772
|
+
select?: Record<string, 0 | 1> | undefined;
|
|
773
773
|
userOrderCompletionScope?: UserOrderCompletionScope | undefined;
|
|
774
774
|
}, {
|
|
775
775
|
_id: string | import("mongoose").Types.ObjectId;
|
|
776
|
-
select?: Record<string, 0 | 1> | undefined;
|
|
777
776
|
populate?: any;
|
|
777
|
+
select?: Record<string, 0 | 1> | undefined;
|
|
778
778
|
userOrderCompletionScope?: UserOrderCompletionScope | undefined;
|
|
779
779
|
}>;
|
|
780
780
|
export type GetOrderByIdInputDTO = DTO<typeof GetOrderByIdInputSchema>;
|
|
@@ -782,11 +782,11 @@ export declare const GetByTokenInputSchema: z.ZodOptional<z.ZodObject<{
|
|
|
782
782
|
select: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodLiteral<0>, z.ZodLiteral<1>]>>>;
|
|
783
783
|
populate: z.ZodOptional<z.ZodUnion<[z.ZodType<any, z.ZodTypeDef, any>, z.ZodArray<z.ZodType<any, z.ZodTypeDef, any>, "many">]>>;
|
|
784
784
|
}, "strip", z.ZodTypeAny, {
|
|
785
|
-
select?: Record<string, 0 | 1> | undefined;
|
|
786
785
|
populate?: any;
|
|
787
|
-
}, {
|
|
788
786
|
select?: Record<string, 0 | 1> | undefined;
|
|
787
|
+
}, {
|
|
789
788
|
populate?: any;
|
|
789
|
+
select?: Record<string, 0 | 1> | undefined;
|
|
790
790
|
}>>;
|
|
791
791
|
export type GetByTokenInputDTO = DTO<typeof GetByTokenInputSchema>;
|
|
792
792
|
export declare const GetOneQuerySchema: z.ZodObject<{
|
|
@@ -794,12 +794,12 @@ export declare const GetOneQuerySchema: z.ZodObject<{
|
|
|
794
794
|
select: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodLiteral<0>, z.ZodLiteral<1>]>>>;
|
|
795
795
|
populate: z.ZodOptional<z.ZodUnion<[z.ZodType<any, z.ZodTypeDef, any>, z.ZodArray<z.ZodType<any, z.ZodTypeDef, any>, "many">]>>;
|
|
796
796
|
}, "strip", z.ZodTypeAny, {
|
|
797
|
-
select?: Record<string, 0 | 1> | undefined;
|
|
798
797
|
populate?: any;
|
|
798
|
+
select?: Record<string, 0 | 1> | undefined;
|
|
799
799
|
query?: Record<string, any> | undefined;
|
|
800
800
|
}, {
|
|
801
|
-
select?: Record<string, 0 | 1> | undefined;
|
|
802
801
|
populate?: any;
|
|
802
|
+
select?: Record<string, 0 | 1> | undefined;
|
|
803
803
|
query?: Record<string, any> | undefined;
|
|
804
804
|
}>;
|
|
805
805
|
export type GetOneQueryDTO = DTO<typeof GetOneQuerySchema>;
|
|
@@ -55,7 +55,7 @@ exports.StringSchema = zod_1.z.string().min(1, 'String cannot be empty').max(255
|
|
|
55
55
|
exports.AddressSchema = zod_1.z.object({
|
|
56
56
|
address: global_validation_1.ZodValidation.string('Address'),
|
|
57
57
|
description: global_validation_1.ZodValidation.string('Description').optional(),
|
|
58
|
-
city: global_validation_1.ZodValidation.string('City'),
|
|
58
|
+
city: global_validation_1.ZodValidation.string('City').optional(),
|
|
59
59
|
state: global_validation_1.ZodValidation.string('State').optional(),
|
|
60
60
|
country: global_validation_1.ZodValidation.string('Country'),
|
|
61
61
|
location: zod_1.z.object({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"common-validation.js","sourceRoot":"/","sources":["utilities/validation/common-validation.ts"],"names":[],"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serOrderCompletionScope,\n\tWeekDay,\n\tWorkStatus,\n} from '../enum';\n\n/**\n * Define MongoDB query schema (fields + operators) using lazy evaluation to avoid circular dependency\n */\nconst MongoQuerySchema: z.ZodType<Record<string, any>> = z.lazy(() =>\n\tz.record(z.union([z.any(), MongoOperatorsSchema]))\n);\n\n/**\n * Define allowed MongoDB query operators\n */\nconst MongoOperatorsSchema = z.object({\n\t$eq: z.any().optional(),\n\t$ne: z.any().optional(),\n\t$gt: z.any().optional(),\n\t$gte: z.any().optional(),\n\t$lt: z.any().optional(),\n\t$lte: z.any().optional(),\n\t$in: z.array(z.any()).optional(),\n\t$nin: z.array(z.any()).optional(),\n\t$exists: z.boolean().optional(),\n\t$regex: z.string().optional(),\n\t$and: z.array(MongoQuerySchema).optional(),\n\t$or: z.array(MongoQuerySchema).optional(),\n\t$not: MongoQuerySchema.optional(),\n\t$nor: z.array(MongoQuerySchema).optional(),\n});\n\nconst sortSchema = z.record(z.string(), z.union([z.literal(1), z.literal(-1)]));\n\nconst populateSchema: z.ZodType<any> = z.lazy(() =>\n\tz.object({\n\t\tpath: z.string(), // required\n\t\tselect: z.record(z.string(), z.union([z.literal(0), z.literal(1)])).optional(),\n\t\tmatch: z.record(z.string(), z.any()).optional(),\n\t\toptions: z\n\t\t\t.object({\n\t\t\t\tsort: sortSchema.optional(),\n\t\t\t\tlimit: z.number().optional(),\n\t\t\t\tskip: z.number().optional(),\n\t\t\t})\n\t\t\t.optional(),\n\t\tpopulate: z.union([populateSchema, z.array(populateSchema)]).optional(),\n\t})\n);\n\n/**\n * Define the filter schema using MongoQuerySchema\n */\nexport const FilterSchema = z\n\t.object({\n\t\tsize: z\n\t\t\t.number()\n\t\t\t.min(1, { message: 'Size must be greater than 0.' })\n\t\t\t.max(100, { message: 'Size cannot exceed 100.' })\n\t\t\t.optional()\n\t\t\t.default(10),\n\t\tpage: z.number().min(1, { message: 'Page number must be at least 1.' }).optional().default(1),\n\t\tsort: sortSchema.optional(),\n\t\tquery: MongoQuerySchema.optional(),\n\t\tselect: z.record(z.string(), z.union([z.literal(0), z.literal(1)])).optional(),\n\t\tpopulate: z.union([populateSchema, z.array(populateSchema)]).optional(),\n\t\tsearch: z.object({ searchKey: z.string(), searchFields: z.array(z.string()).optional() }).optional(),\n\t})\n\t.optional();\n\n/**\n * Infer TypeScript type from Zod schema\n */\nexport type FilterDTO = z.infer<typeof FilterSchema>;\n\n/**\n * Define String schema\n */\nexport const StringSchema = z.string().min(1, 'String cannot be empty').max(255, 'String is too long');\n\n/**\n * Common address validation schema that can be reused across models.\n * Provides validation for address-related fields.\n *\n * @example\n * ```typescript\n * const userSchema = z.object({\n * name: z.string(),\n * address: AddressSchema\n * });\n * ```\n */\nexport const AddressSchema = z.object({\n\taddress: ZodValidation.string('Address'),\n\tdescription: ZodValidation.string('Description').optional(),\n\tcity: ZodValidation.string('City'),\n\tstate: ZodValidation.string('State').optional(),\n\tcountry: ZodValidation.string('Country'),\n\tlocation: z.object({\n\t\ttype: ZodValidation.enumType(GeoLocationType, 'GeoLocationType').default(GeoLocationType.POINT),\n\t\tcoordinates: z.tuple([\n\t\t\tZodValidation.number('Longitude', { min: -180, max: 180 }),\n\t\t\tZodValidation.number('Latitude', { min: -90, max: 90 }),\n\t\t]),\n\t}),\n\tlatitude: ZodValidation.number('Latitude', { min: -90, max: 90 }),\n\tlongitude: ZodValidation.number('Longitude', { min: -180, max: 180 }),\n\tzone: ZodValidation.objectId('Zone').optional(),\n});\nexport type AddressDTO = DTO<typeof AddressSchema>;\n\n/**\n * Common user address validation schema that can be reused across models.\n * Provides validation for address-related fields.\n *\n * @example\n * ```typescript\n * const userSchema = z.object({\n * name: z.string(),\n * address: UserAddressSchema\n * });\n * ```\n */\nexport const UserAddressSchema = AddressSchema.extend({\n\taddressLabel: ZodValidation.string('Address Label'),\n\tapartment: ZodValidation.string('Apartment'),\n\tbuildingName: ZodValidation.string('Building Name'),\n\tdeliveryOption: ZodValidation.string('Delivery Option').optional(),\n\tinstructions: ZodValidation.string('Instructions').optional(),\n});\nexport type UserAddressDTO = DTO<typeof UserAddressSchema>;\n\n/**\n * Regular order address validation schema.\n * Provides validation for address-related fields.\n *\n */\nexport const RegularOrderAddressSchema = UserAddressSchema.extend({\n\t_id: ZodValidation.objectId('ID of the user address'),\n});\nexport type RegularOrderAddressDTO = DTO<typeof RegularOrderAddressSchema>;\n\n/**\n * Common courier address validation schema that can be reused across models.\n * Provides validation for address-related fields.\n *\n * @example\n * ```typescript\n * const courierAddressSchema = z.object({\n * name: z.string(),\n * address: courierAddressSchema\n * });\n * ```\n */\nexport const CourierAddressSchema = UserAddressSchema.extend({\n\tname: ZodValidation.string('Name'),\n\tphoneNumber: ZodValidation.string('Phone Number'),\n});\nexport type CourierAddressDTO = DTO<typeof CourierAddressSchema>;\n\n/**\n * Common duration validation schema that can be reused across models.\n * Provides validation for duration fields.\n *\n * @example\n * ```typescript\n * const subscriptionSchema = z.object({\n * fee: z.number(),\n * duration: DurationSchema\n * });\n * ```\n */\nexport const DurationSchema = z.object({\n\tstart: ZodValidation.date('Start'),\n\tend: ZodValidation.date('End').optional(),\n});\n\n/**\n * Common Work Hour validation schema that can be reused across models.\n * Provides validation for workHourSetting fields.\n *\n * @example\n * ```typescript\n * const settingSchema = z.object({\n * vat: z.number(),\n * workHourSetting: WorkHourSettingSchema\n * });\n * ```\n */\n\nconst TimeStringSchema = z\n\t.string()\n\t// Allow 1 or 2 digits for hour\n\t.regex(/^([0-9]|[01]\\d|2[0-3]):([0-5]\\d)$/, 'Time must be in HH:mm format (e.g., 09:30 or 9:30)')\n\t// Normalize to HH:mm → always two digits for hour\n\t.transform(time => {\n\t\tlet [h, m] = time.split(':');\n\t\th = h.padStart(2, '0'); // convert \"9:30\" → \"09:30\"\n\t\treturn `${h}:${m}`;\n\t})\n\t// Validate logical range\n\t.refine(\n\t\ttime => {\n\t\t\tconst [h, m] = time.split(':').map(Number);\n\t\t\treturn h >= 0 && h <= 23 && m >= 0 && m <= 59;\n\t\t},\n\t\t{ message: 'Invalid time range, must be between 00:00 and 23:59' }\n\t);\n\nconst StartEndTimeSchema = z\n\t.object({\n\t\tstart: TimeStringSchema,\n\t\tend: TimeStringSchema,\n\t})\n\t.refine(\n\t\tdata => {\n\t\t\tconst start = parseInt(data.start.replace(':', ''));\n\t\t\tconst end = parseInt(data.end.replace(':', ''));\n\t\t\treturn end > start;\n\t\t},\n\t\t{\n\t\t\tmessage: 'End time must be later than start time',\n\t\t\tpath: ['end'],\n\t\t}\n\t)\n\t.refine(\n\t\tdata => {\n\t\t\tconst end = parseInt(data.end.replace(':', ''));\n\t\t\treturn end <= 2359;\n\t\t},\n\t\t{\n\t\t\tmessage: 'End time cannot exceed 23:59',\n\t\t\tpath: ['end'],\n\t\t}\n\t);\n\nexport const NormalHourSchema = z.object({\n\tday: ZodValidation.enumType(WeekDay, 'Day'),\n\tstatus: ZodValidation.enumType(WorkStatus, 'Status'),\n\topeningHours: ZodValidation.array(StartEndTimeSchema)\n\t\t.default([])\n\t\t.refine(\n\t\t\tarr => {\n\t\t\t\tif (arr.length === 0) return true;\n\t\t\t\tfor (let i = 1; i < arr.length; i++) {\n\t\t\t\t\tconst prevEnd = parseInt(arr[i - 1].end.replace(':', ''));\n\t\t\t\t\tconst currStart = parseInt(arr[i].start.replace(':', ''));\n\t\t\t\t\tif (currStart < prevEnd) return false; // Overlap or out of order\n\t\t\t\t}\n\t\t\t\treturn true;\n\t\t\t},\n\t\t\t{\n\t\t\t\tmessage: 'Opening hours must be non-overlapping and in chronological order',\n\t\t\t}\n\t\t),\n});\n\nexport const HolidayHourSchema = z.object({\n\tdate: ZodValidation.date('Date'),\n\tstatus: ZodValidation.enumType(HolidayWorkStatus, 'Status'),\n\tclosingHour: StartEndTimeSchema,\n});\n\nexport const WorkHourSettingSchema = z.object({\n\tnormalHours: ZodValidation.array(NormalHourSchema).default([]),\n\tholidayHours: ZodValidation.array(HolidayHourSchema).default([]),\n});\n\n/**\n * Schema for validating user login credentials.\n * This schema ensures that the provided email and password meet the required validation rules.\n *\n * @example\n * ```typescript\n * const credentials = {\n * email: 'user@example.com',\n * password: 'securePassword123',\n * };\n * ```\n */\nexport const LoginSchema = z.object({\n\temail: ZodValidation.email('Email', {\n\t\trequiredMessage: 'Please enter a valid email address.',\n\t\tinvalidMessage: 'Please enter a valid email address.',\n\t}),\n\tpassword: ZodValidation.string('Password', { requiredMessage: 'Please enter password' }),\n});\nexport type LoginDTO = DTO<typeof LoginSchema>;\n\nconst metadataSchema = z.object({\n\tpage: ZodValidation.number(),\n\tsize: ZodValidation.number(),\n\ttotalElements: ZodValidation.number(),\n\ttotalPages: ZodValidation.number(),\n});\nexport const createPaginatedSchema = <T>(documentSchema: z.ZodSchema<T>) =>\n\tz.object({\n\t\tmetadata: metadataSchema.optional(),\n\t\tdocuments: ZodValidation.array(documentSchema),\n\t});\n\nexport const createResponseSchema = <T>(schema: z.ZodSchema<T>) =>\n\tz.object({\n\t\tsuccess: ZodValidation.boolean(),\n\t\tmessage: ZodValidation.string(),\n\t\tdata: z.union([createPaginatedSchema(schema), schema]).optional(),\n\t});\n\nexport type PaginatedDTO<T> = {\n\tmetadata: DTO<typeof metadataSchema>;\n\tdocuments: T[];\n};\n\nexport type ResponseDTO<T> = {\n\tsuccess: boolean;\n\tmessage: string;\n\tdata?: T;\n};\n\n/**\n * Schema for validating token data, typically used for authentication.\n * This schema ensures that the provided access token and refresh token are valid strings.\n *\n * @example\n * ```typescript\n * const tokens = {\n * accessToken: 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...',\n * refreshToken: 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...',\n * };\n * ```\n */\nexport const TokenSchema = z.object({\n\taccessToken: ZodValidation.string('AccessToken'),\n\trefreshToken: ZodValidation.string('RefreshToken'),\n});\n\n/**\n * Schema validation for sorting order\n */\nexport const UpdateSortingOrderSchema = z.object({\n\t_id: ZodValidation.objectId('_id'),\n\tnewPosition: ZodValidation.number('New position'),\n});\nexport type UpdateSortingOrderDTO = DTO<typeof UpdateSortingOrderSchema>;\n\n/**\n * Schema validation for delete\n */\nexport const DeleteSchema = z.object({\n\t_id: ZodValidation.objectId('_id'),\n\tsoftDelete: ZodValidation.boolean('Soft Delete').default(true),\n});\nexport type DeleteDTO = DTO<typeof DeleteSchema>;\n\n/**\n * Schema validation for Id\n */\nexport const IdSchema = ZodValidation.objectId();\n\n/**\n * Schema validation get by id\n */\nexport const GetByIdInputSchema = z.object({\n\t_id: ZodValidation.objectId('_id'),\n\tselect: z.record(z.string(), z.union([z.literal(0), z.literal(1)])).optional(),\n\tpopulate: z.union([populateSchema, z.array(populateSchema)]).optional(),\n});\nexport type GetByIdInputDTO = DTO<typeof GetByIdInputSchema>;\n\nexport const GetProductByIdInputSchema = z.object({\n\t_id: ZodValidation.objectId('_id'),\n\tselect: z.record(z.string(), z.union([z.literal(0), z.literal(1)])).optional(),\n\tpopulate: z.union([populateSchema, z.array(populateSchema)]).optional(),\n\twithAttributeHiddenItems: z.boolean().optional().default(true),\n\twithAddonsHiddenItems: z.boolean().optional().default(true),\n});\nexport type GetProductByIdInputDTO = DTO<typeof GetProductByIdInputSchema>;\n\nexport const GetOrderByIdInputSchema = z.object({\n\t_id: ZodValidation.objectId('_id'),\n\tselect: z.record(z.string(), z.union([z.literal(0), z.literal(1)])).optional(),\n\tpopulate: z.union([populateSchema, z.array(populateSchema)]).optional(),\n\tuserOrderCompletionScope: ZodValidation.enumType(UserOrderCompletionScope).optional(),\n});\nexport type GetOrderByIdInputDTO = DTO<typeof GetOrderByIdInputSchema>;\n\n/**\n * Schema validation get by token\n */\nexport const GetByTokenInputSchema = z\n\t.object({\n\t\tselect: z.record(z.string(), z.union([z.literal(0), z.literal(1)])).optional(),\n\t\tpopulate: z.union([populateSchema, z.array(populateSchema)]).optional(),\n\t})\n\t.optional();\nexport type GetByTokenInputDTO = DTO<typeof GetByTokenInputSchema>;\n\nexport const GetOneQuerySchema = z.object({\n\tquery: MongoQuerySchema.optional(),\n\tselect: z.record(z.string(), z.union([z.literal(0), z.literal(1)])).optional(),\n\tpopulate: z.union([populateSchema, z.array(populateSchema)]).optional(),\n});\n\nexport type GetOneQueryDTO = DTO<typeof GetOneQuerySchema>;\n\nconst ShareableLinkSchema = z.object({\n\tlink: ZodValidation.url('Link'),\n\tmessage: ZodValidation.string('Message'),\n});\n\nexport const ShareableLinkResponseSchema = createResponseSchema(ShareableLinkSchema);\nexport type ShareableLinkDTO = DTO<typeof ShareableLinkSchema>;\n\nexport const UpdateFcmTokenInputSchema = z.object({\n\tfcmToken: ZodValidation.string('Fcm token'),\n\taction: ZodValidation.enumType(ActionType, 'Action'),\n});\nexport type UpdateFcmTokenInputDTO = DTO<typeof UpdateFcmTokenInputSchema>;\n\nexport const AssignRiderSchema = z.object({\n\t_id: ZodValidation.objectId('Rider id'),\n\tlanguage: ZodValidation.enumType(Language, 'Rider language'),\n});\nexport type AssignRiderDTO = DTO<typeof AssignRiderSchema>;\n"]}
|
|
1
|
+
{"version":3,"file":"common-validation.js","sourceRoot":"/","sources":["utilities/validation/common-validation.ts"],"names":[],"mappings":";;;AAAA,6BAAwB;AACxB,2DAAyD;AACzD,kCAQiB;AAKjB,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,GAA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AI,EAAE,iCAAa,CAAC,GAAG,CAAC,MAAM,CAAC;IAC/B,OAAO,EAAE,iCAAa,CAAC,MAAM,CAAC,SAAS,CAAC;CACxC,CAAC,CAAC;AAEU,QAAA,2BAA2B,GAAG,IAAA,4BAAoB,EAAC,mBAAmB,CAAC,CAAC;AAGxE,QAAA,yBAAyB,GAAG,OAAC,CAAC,MAAM,CAAC;IACjD,QAAQ,EAAE,iCAAa,CAAC,MAAM,CAAC,WAAW,CAAC;IAC3C,MAAM,EAAE,iCAAa,CAAC,QAAQ,CAAC,iBAAU,EAAE,QAAQ,CAAC;CACpD,CAAC,CAAC;AAGU,QAAA,iBAAiB,GAAG,OAAC,CAAC,MAAM,CAAC;IACzC,GAAG,EAAE,iCAAa,CAAC,QAAQ,CAAC,UAAU,CAAC;IACvC,QAAQ,EAAE,iCAAa,CAAC,QAAQ,CAAC,eAAQ,EAAE,gBAAgB,CAAC;CAC5D,CAAC,CAAC","sourcesContent":["import { z } from 'zod';\nimport { DTO, ZodValidation } from './global-validation';\nimport {\n\tActionType,\n\tGeoLocationType,\n\tHolidayWorkStatus,\n\tLanguage,\n\tUserOrderCompletionScope,\n\tWeekDay,\n\tWorkStatus,\n} from '../enum';\n\n/**\n * Define MongoDB query schema (fields + operators) using lazy evaluation to avoid circular dependency\n */\nconst MongoQuerySchema: z.ZodType<Record<string, any>> = z.lazy(() =>\n\tz.record(z.union([z.any(), MongoOperatorsSchema]))\n);\n\n/**\n * Define allowed MongoDB query operators\n */\nconst MongoOperatorsSchema = z.object({\n\t$eq: z.any().optional(),\n\t$ne: z.any().optional(),\n\t$gt: z.any().optional(),\n\t$gte: z.any().optional(),\n\t$lt: z.any().optional(),\n\t$lte: z.any().optional(),\n\t$in: z.array(z.any()).optional(),\n\t$nin: z.array(z.any()).optional(),\n\t$exists: z.boolean().optional(),\n\t$regex: z.string().optional(),\n\t$and: z.array(MongoQuerySchema).optional(),\n\t$or: z.array(MongoQuerySchema).optional(),\n\t$not: MongoQuerySchema.optional(),\n\t$nor: z.array(MongoQuerySchema).optional(),\n});\n\nconst sortSchema = z.record(z.string(), z.union([z.literal(1), z.literal(-1)]));\n\nconst populateSchema: z.ZodType<any> = z.lazy(() =>\n\tz.object({\n\t\tpath: z.string(), // required\n\t\tselect: z.record(z.string(), z.union([z.literal(0), z.literal(1)])).optional(),\n\t\tmatch: z.record(z.string(), z.any()).optional(),\n\t\toptions: z\n\t\t\t.object({\n\t\t\t\tsort: sortSchema.optional(),\n\t\t\t\tlimit: z.number().optional(),\n\t\t\t\tskip: z.number().optional(),\n\t\t\t})\n\t\t\t.optional(),\n\t\tpopulate: z.union([populateSchema, z.array(populateSchema)]).optional(),\n\t})\n);\n\n/**\n * Define the filter schema using MongoQuerySchema\n */\nexport const FilterSchema = z\n\t.object({\n\t\tsize: z\n\t\t\t.number()\n\t\t\t.min(1, { message: 'Size must be greater than 0.' })\n\t\t\t.max(100, { message: 'Size cannot exceed 100.' })\n\t\t\t.optional()\n\t\t\t.default(10),\n\t\tpage: z.number().min(1, { message: 'Page number must be at least 1.' }).optional().default(1),\n\t\tsort: sortSchema.optional(),\n\t\tquery: MongoQuerySchema.optional(),\n\t\tselect: z.record(z.string(), z.union([z.literal(0), z.literal(1)])).optional(),\n\t\tpopulate: z.union([populateSchema, z.array(populateSchema)]).optional(),\n\t\tsearch: z.object({ searchKey: z.string(), searchFields: z.array(z.string()).optional() }).optional(),\n\t})\n\t.optional();\n\n/**\n * Infer TypeScript type from Zod schema\n */\nexport type FilterDTO = z.infer<typeof FilterSchema>;\n\n/**\n * Define String schema\n */\nexport const StringSchema = z.string().min(1, 'String cannot be empty').max(255, 'String is too long');\n\n/**\n * Common address validation schema that can be reused across models.\n * Provides validation for address-related fields.\n *\n * @example\n * ```typescript\n * const userSchema = z.object({\n * name: z.string(),\n * address: AddressSchema\n * });\n * ```\n */\nexport const AddressSchema = z.object({\n\taddress: ZodValidation.string('Address'),\n\tdescription: ZodValidation.string('Description').optional(),\n\tcity: ZodValidation.string('City').optional(),\n\tstate: ZodValidation.string('State').optional(),\n\tcountry: ZodValidation.string('Country'),\n\tlocation: z.object({\n\t\ttype: ZodValidation.enumType(GeoLocationType, 'GeoLocationType').default(GeoLocationType.POINT),\n\t\tcoordinates: z.tuple([\n\t\t\tZodValidation.number('Longitude', { min: -180, max: 180 }),\n\t\t\tZodValidation.number('Latitude', { min: -90, max: 90 }),\n\t\t]),\n\t}),\n\tlatitude: ZodValidation.number('Latitude', { min: -90, max: 90 }),\n\tlongitude: ZodValidation.number('Longitude', { min: -180, max: 180 }),\n\tzone: ZodValidation.objectId('Zone').optional(),\n});\nexport type AddressDTO = DTO<typeof AddressSchema>;\n\n/**\n * Common user address validation schema that can be reused across models.\n * Provides validation for address-related fields.\n *\n * @example\n * ```typescript\n * const userSchema = z.object({\n * name: z.string(),\n * address: UserAddressSchema\n * });\n * ```\n */\nexport const UserAddressSchema = AddressSchema.extend({\n\taddressLabel: ZodValidation.string('Address Label'),\n\tapartment: ZodValidation.string('Apartment'),\n\tbuildingName: ZodValidation.string('Building Name'),\n\tdeliveryOption: ZodValidation.string('Delivery Option').optional(),\n\tinstructions: ZodValidation.string('Instructions').optional(),\n});\nexport type UserAddressDTO = DTO<typeof UserAddressSchema>;\n\n/**\n * Regular order address validation schema.\n * Provides validation for address-related fields.\n *\n */\nexport const RegularOrderAddressSchema = UserAddressSchema.extend({\n\t_id: ZodValidation.objectId('ID of the user address'),\n});\nexport type RegularOrderAddressDTO = DTO<typeof RegularOrderAddressSchema>;\n\n/**\n * Common courier address validation schema that can be reused across models.\n * Provides validation for address-related fields.\n *\n * @example\n * ```typescript\n * const courierAddressSchema = z.object({\n * name: z.string(),\n * address: courierAddressSchema\n * });\n * ```\n */\nexport const CourierAddressSchema = UserAddressSchema.extend({\n\tname: ZodValidation.string('Name'),\n\tphoneNumber: ZodValidation.string('Phone Number'),\n});\nexport type CourierAddressDTO = DTO<typeof CourierAddressSchema>;\n\n/**\n * Common duration validation schema that can be reused across models.\n * Provides validation for duration fields.\n *\n * @example\n * ```typescript\n * const subscriptionSchema = z.object({\n * fee: z.number(),\n * duration: DurationSchema\n * });\n * ```\n */\nexport const DurationSchema = z.object({\n\tstart: ZodValidation.date('Start'),\n\tend: ZodValidation.date('End').optional(),\n});\n\n/**\n * Common Work Hour validation schema that can be reused across models.\n * Provides validation for workHourSetting fields.\n *\n * @example\n * ```typescript\n * const settingSchema = z.object({\n * vat: z.number(),\n * workHourSetting: WorkHourSettingSchema\n * });\n * ```\n */\n\nconst TimeStringSchema = z\n\t.string()\n\t// Allow 1 or 2 digits for hour\n\t.regex(/^([0-9]|[01]\\d|2[0-3]):([0-5]\\d)$/, 'Time must be in HH:mm format (e.g., 09:30 or 9:30)')\n\t// Normalize to HH:mm → always two digits for hour\n\t.transform(time => {\n\t\tlet [h, m] = time.split(':');\n\t\th = h.padStart(2, '0'); // convert \"9:30\" → \"09:30\"\n\t\treturn `${h}:${m}`;\n\t})\n\t// Validate logical range\n\t.refine(\n\t\ttime => {\n\t\t\tconst [h, m] = time.split(':').map(Number);\n\t\t\treturn h >= 0 && h <= 23 && m >= 0 && m <= 59;\n\t\t},\n\t\t{ message: 'Invalid time range, must be between 00:00 and 23:59' }\n\t);\n\nconst StartEndTimeSchema = z\n\t.object({\n\t\tstart: TimeStringSchema,\n\t\tend: TimeStringSchema,\n\t})\n\t.refine(\n\t\tdata => {\n\t\t\tconst start = parseInt(data.start.replace(':', ''));\n\t\t\tconst end = parseInt(data.end.replace(':', ''));\n\t\t\treturn end > start;\n\t\t},\n\t\t{\n\t\t\tmessage: 'End time must be later than start time',\n\t\t\tpath: ['end'],\n\t\t}\n\t)\n\t.refine(\n\t\tdata => {\n\t\t\tconst end = parseInt(data.end.replace(':', ''));\n\t\t\treturn end <= 2359;\n\t\t},\n\t\t{\n\t\t\tmessage: 'End time cannot exceed 23:59',\n\t\t\tpath: ['end'],\n\t\t}\n\t);\n\nexport const NormalHourSchema = z.object({\n\tday: ZodValidation.enumType(WeekDay, 'Day'),\n\tstatus: ZodValidation.enumType(WorkStatus, 'Status'),\n\topeningHours: ZodValidation.array(StartEndTimeSchema)\n\t\t.default([])\n\t\t.refine(\n\t\t\tarr => {\n\t\t\t\tif (arr.length === 0) return true;\n\t\t\t\tfor (let i = 1; i < arr.length; i++) {\n\t\t\t\t\tconst prevEnd = parseInt(arr[i - 1].end.replace(':', ''));\n\t\t\t\t\tconst currStart = parseInt(arr[i].start.replace(':', ''));\n\t\t\t\t\tif (currStart < prevEnd) return false; // Overlap or out of order\n\t\t\t\t}\n\t\t\t\treturn true;\n\t\t\t},\n\t\t\t{\n\t\t\t\tmessage: 'Opening hours must be non-overlapping and in chronological order',\n\t\t\t}\n\t\t),\n});\n\nexport const HolidayHourSchema = z.object({\n\tdate: ZodValidation.date('Date'),\n\tstatus: ZodValidation.enumType(HolidayWorkStatus, 'Status'),\n\tclosingHour: StartEndTimeSchema,\n});\n\nexport const WorkHourSettingSchema = z.object({\n\tnormalHours: ZodValidation.array(NormalHourSchema).default([]),\n\tholidayHours: ZodValidation.array(HolidayHourSchema).default([]),\n});\n\n/**\n * Schema for validating user login credentials.\n * This schema ensures that the provided email and password meet the required validation rules.\n *\n * @example\n * ```typescript\n * const credentials = {\n * email: 'user@example.com',\n * password: 'securePassword123',\n * };\n * ```\n */\nexport const LoginSchema = z.object({\n\temail: ZodValidation.email('Email', {\n\t\trequiredMessage: 'Please enter a valid email address.',\n\t\tinvalidMessage: 'Please enter a valid email address.',\n\t}),\n\tpassword: ZodValidation.string('Password', { requiredMessage: 'Please enter password' }),\n});\nexport type LoginDTO = DTO<typeof LoginSchema>;\n\nconst metadataSchema = z.object({\n\tpage: ZodValidation.number(),\n\tsize: ZodValidation.number(),\n\ttotalElements: ZodValidation.number(),\n\ttotalPages: ZodValidation.number(),\n});\nexport const createPaginatedSchema = <T>(documentSchema: z.ZodSchema<T>) =>\n\tz.object({\n\t\tmetadata: metadataSchema.optional(),\n\t\tdocuments: ZodValidation.array(documentSchema),\n\t});\n\nexport const createResponseSchema = <T>(schema: z.ZodSchema<T>) =>\n\tz.object({\n\t\tsuccess: ZodValidation.boolean(),\n\t\tmessage: ZodValidation.string(),\n\t\tdata: z.union([createPaginatedSchema(schema), schema]).optional(),\n\t});\n\nexport type PaginatedDTO<T> = {\n\tmetadata: DTO<typeof metadataSchema>;\n\tdocuments: T[];\n};\n\nexport type ResponseDTO<T> = {\n\tsuccess: boolean;\n\tmessage: string;\n\tdata?: T;\n};\n\n/**\n * Schema for validating token data, typically used for authentication.\n * This schema ensures that the provided access token and refresh token are valid strings.\n *\n * @example\n * ```typescript\n * const tokens = {\n * accessToken: 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...',\n * refreshToken: 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...',\n * };\n * ```\n */\nexport const TokenSchema = z.object({\n\taccessToken: ZodValidation.string('AccessToken'),\n\trefreshToken: ZodValidation.string('RefreshToken'),\n});\n\n/**\n * Schema validation for sorting order\n */\nexport const UpdateSortingOrderSchema = z.object({\n\t_id: ZodValidation.objectId('_id'),\n\tnewPosition: ZodValidation.number('New position'),\n});\nexport type UpdateSortingOrderDTO = DTO<typeof UpdateSortingOrderSchema>;\n\n/**\n * Schema validation for delete\n */\nexport const DeleteSchema = z.object({\n\t_id: ZodValidation.objectId('_id'),\n\tsoftDelete: ZodValidation.boolean('Soft Delete').default(true),\n});\nexport type DeleteDTO = DTO<typeof DeleteSchema>;\n\n/**\n * Schema validation for Id\n */\nexport const IdSchema = ZodValidation.objectId();\n\n/**\n * Schema validation get by id\n */\nexport const GetByIdInputSchema = z.object({\n\t_id: ZodValidation.objectId('_id'),\n\tselect: z.record(z.string(), z.union([z.literal(0), z.literal(1)])).optional(),\n\tpopulate: z.union([populateSchema, z.array(populateSchema)]).optional(),\n});\nexport type GetByIdInputDTO = DTO<typeof GetByIdInputSchema>;\n\nexport const GetProductByIdInputSchema = z.object({\n\t_id: ZodValidation.objectId('_id'),\n\tselect: z.record(z.string(), z.union([z.literal(0), z.literal(1)])).optional(),\n\tpopulate: z.union([populateSchema, z.array(populateSchema)]).optional(),\n\twithAttributeHiddenItems: z.boolean().optional().default(true),\n\twithAddonsHiddenItems: z.boolean().optional().default(true),\n});\nexport type GetProductByIdInputDTO = DTO<typeof GetProductByIdInputSchema>;\n\nexport const GetOrderByIdInputSchema = z.object({\n\t_id: ZodValidation.objectId('_id'),\n\tselect: z.record(z.string(), z.union([z.literal(0), z.literal(1)])).optional(),\n\tpopulate: z.union([populateSchema, z.array(populateSchema)]).optional(),\n\tuserOrderCompletionScope: ZodValidation.enumType(UserOrderCompletionScope).optional(),\n});\nexport type GetOrderByIdInputDTO = DTO<typeof GetOrderByIdInputSchema>;\n\n/**\n * Schema validation get by token\n */\nexport const GetByTokenInputSchema = z\n\t.object({\n\t\tselect: z.record(z.string(), z.union([z.literal(0), z.literal(1)])).optional(),\n\t\tpopulate: z.union([populateSchema, z.array(populateSchema)]).optional(),\n\t})\n\t.optional();\nexport type GetByTokenInputDTO = DTO<typeof GetByTokenInputSchema>;\n\nexport const GetOneQuerySchema = z.object({\n\tquery: MongoQuerySchema.optional(),\n\tselect: z.record(z.string(), z.union([z.literal(0), z.literal(1)])).optional(),\n\tpopulate: z.union([populateSchema, z.array(populateSchema)]).optional(),\n});\n\nexport type GetOneQueryDTO = DTO<typeof GetOneQuerySchema>;\n\nconst ShareableLinkSchema = z.object({\n\tlink: ZodValidation.url('Link'),\n\tmessage: ZodValidation.string('Message'),\n});\n\nexport const ShareableLinkResponseSchema = createResponseSchema(ShareableLinkSchema);\nexport type ShareableLinkDTO = DTO<typeof ShareableLinkSchema>;\n\nexport const UpdateFcmTokenInputSchema = z.object({\n\tfcmToken: ZodValidation.string('Fcm token'),\n\taction: ZodValidation.enumType(ActionType, 'Action'),\n});\nexport type UpdateFcmTokenInputDTO = DTO<typeof UpdateFcmTokenInputSchema>;\n\nexport const AssignRiderSchema = z.object({\n\t_id: ZodValidation.objectId('Rider id'),\n\tlanguage: ZodValidation.enumType(Language, 'Rider language'),\n});\nexport type AssignRiderDTO = DTO<typeof AssignRiderSchema>;\n"]}
|