@lyxa.ai/core 1.0.9 → 1.0.11
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/libraries/auth/index.d.ts +65 -2
- package/dist/libraries/auth/index.js +208 -7
- package/dist/libraries/auth/index.js.map +1 -1
- package/dist/libraries/auth/refreshtoken.d.ts +15 -0
- package/dist/libraries/auth/refreshtoken.js +96 -0
- package/dist/libraries/auth/refreshtoken.js.map +1 -0
- package/dist/libraries/auth/repository.d.ts +18 -0
- package/dist/libraries/auth/repository.js +47 -0
- package/dist/libraries/auth/repository.js.map +1 -0
- package/dist/libraries/index.d.ts +2 -0
- package/dist/libraries/index.js +4 -0
- package/dist/libraries/index.js.map +1 -1
- package/dist/libraries/mongo/models/address.model.d.ts +19 -0
- package/dist/libraries/mongo/models/address.model.js +91 -0
- package/dist/libraries/mongo/models/address.model.js.map +1 -0
- package/dist/libraries/mongo/models/duration.model.d.ts +4 -0
- package/dist/libraries/mongo/models/duration.model.js +27 -0
- package/dist/libraries/mongo/models/duration.model.js.map +1 -0
- package/dist/libraries/mongo/models/work-hour.model.d.ts +4 -5
- package/dist/libraries/mongo/models/work-hour.model.js +9 -5
- package/dist/libraries/mongo/models/work-hour.model.js.map +1 -1
- package/dist/libraries/trpc/context.d.ts +4 -0
- package/dist/libraries/trpc/context.js +4 -1
- package/dist/libraries/trpc/context.js.map +1 -1
- package/dist/libraries/trpc/middlewares/auth.d.ts +11 -2
- package/dist/libraries/trpc/middlewares/auth.js +54 -9
- package/dist/libraries/trpc/middlewares/auth.js.map +1 -1
- package/dist/utilities/enum.d.ts +8 -0
- package/dist/utilities/enum.js +11 -1
- package/dist/utilities/enum.js.map +1 -1
- package/dist/utilities/validation/common-validation.d.ts +233 -36
- package/dist/utilities/validation/common-validation.js +44 -16
- package/dist/utilities/validation/common-validation.js.map +1 -1
- package/dist/utilities/validation/global-validation.d.ts +3 -4
- package/dist/utilities/validation/global-validation.js +48 -42
- package/dist/utilities/validation/global-validation.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
+
import { GeoLocationType, HolidayWorkStatus, WeekDay, WorkStatus } from "../enum";
|
|
2
3
|
export declare const FilterSchema: z.ZodOptional<z.ZodObject<{
|
|
3
4
|
limit: z.ZodDefault<z.ZodNumber>;
|
|
4
5
|
skip: z.ZodDefault<z.ZodNumber>;
|
|
@@ -24,42 +25,238 @@ export declare const FilterSchema: z.ZodOptional<z.ZodObject<{
|
|
|
24
25
|
export type FilterDTO = z.infer<typeof FilterSchema>;
|
|
25
26
|
export declare const StringSchema: z.ZodString;
|
|
26
27
|
export declare const AddressSchema: z.ZodObject<{
|
|
27
|
-
address: z.
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
postCode: z.ZodOptional<z.ZodString>;
|
|
37
|
-
note: z.ZodOptional<z.ZodString>;
|
|
38
|
-
placeId: z.ZodOptional<z.ZodString>;
|
|
28
|
+
address: z.ZodString;
|
|
29
|
+
description: z.ZodOptional<z.ZodString>;
|
|
30
|
+
city: z.ZodString;
|
|
31
|
+
state: z.ZodString;
|
|
32
|
+
country: z.ZodString;
|
|
33
|
+
geoLocationType: z.ZodDefault<z.ZodNativeEnum<typeof GeoLocationType>>;
|
|
34
|
+
coordinates: z.ZodArray<z.ZodNumber, "many">;
|
|
35
|
+
latitude: z.ZodNumber;
|
|
36
|
+
longitude: z.ZodNumber;
|
|
39
37
|
}, "strip", z.ZodTypeAny, {
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
latitude
|
|
47
|
-
longitude
|
|
48
|
-
|
|
49
|
-
postCode?: string | undefined;
|
|
50
|
-
note?: string | undefined;
|
|
51
|
-
placeId?: string | undefined;
|
|
38
|
+
state: string;
|
|
39
|
+
address: string;
|
|
40
|
+
country: string;
|
|
41
|
+
city: string;
|
|
42
|
+
geoLocationType: GeoLocationType;
|
|
43
|
+
coordinates: number[];
|
|
44
|
+
latitude: number;
|
|
45
|
+
longitude: number;
|
|
46
|
+
description?: string | undefined;
|
|
52
47
|
}, {
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
48
|
+
state: string;
|
|
49
|
+
address: string;
|
|
50
|
+
country: string;
|
|
51
|
+
city: string;
|
|
52
|
+
coordinates: number[];
|
|
53
|
+
latitude: number;
|
|
54
|
+
longitude: number;
|
|
55
|
+
description?: string | undefined;
|
|
56
|
+
geoLocationType?: GeoLocationType | undefined;
|
|
57
|
+
}>;
|
|
58
|
+
export declare const UserAddressSchema: z.ZodObject<z.objectUtil.extendShape<{
|
|
59
|
+
address: z.ZodString;
|
|
60
|
+
description: z.ZodOptional<z.ZodString>;
|
|
61
|
+
city: z.ZodString;
|
|
62
|
+
state: z.ZodString;
|
|
63
|
+
country: z.ZodString;
|
|
64
|
+
geoLocationType: z.ZodDefault<z.ZodNativeEnum<typeof GeoLocationType>>;
|
|
65
|
+
coordinates: z.ZodArray<z.ZodNumber, "many">;
|
|
66
|
+
latitude: z.ZodNumber;
|
|
67
|
+
longitude: z.ZodNumber;
|
|
68
|
+
}, {
|
|
69
|
+
addressLabel: z.ZodString;
|
|
70
|
+
apartment: z.ZodString;
|
|
71
|
+
buildingName: z.ZodString;
|
|
72
|
+
deliveryOption: z.ZodOptional<z.ZodString>;
|
|
73
|
+
instructions: z.ZodOptional<z.ZodString>;
|
|
74
|
+
}>, "strip", z.ZodTypeAny, {
|
|
75
|
+
state: string;
|
|
76
|
+
address: string;
|
|
77
|
+
country: string;
|
|
78
|
+
city: string;
|
|
79
|
+
geoLocationType: GeoLocationType;
|
|
80
|
+
coordinates: number[];
|
|
81
|
+
latitude: number;
|
|
82
|
+
longitude: number;
|
|
83
|
+
addressLabel: string;
|
|
84
|
+
apartment: string;
|
|
85
|
+
buildingName: string;
|
|
86
|
+
description?: string | undefined;
|
|
87
|
+
deliveryOption?: string | undefined;
|
|
88
|
+
instructions?: string | undefined;
|
|
89
|
+
}, {
|
|
90
|
+
state: string;
|
|
91
|
+
address: string;
|
|
92
|
+
country: string;
|
|
93
|
+
city: string;
|
|
94
|
+
coordinates: number[];
|
|
95
|
+
latitude: number;
|
|
96
|
+
longitude: number;
|
|
97
|
+
addressLabel: string;
|
|
98
|
+
apartment: string;
|
|
99
|
+
buildingName: string;
|
|
100
|
+
description?: string | undefined;
|
|
101
|
+
geoLocationType?: GeoLocationType | undefined;
|
|
102
|
+
deliveryOption?: string | undefined;
|
|
103
|
+
instructions?: string | undefined;
|
|
104
|
+
}>;
|
|
105
|
+
export declare const DurationSchema: z.ZodObject<{
|
|
106
|
+
start: z.ZodEffects<z.ZodEffects<z.ZodUnion<[z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, Date, string>, z.ZodDate]>, Date, string | Date>, Date, string | Date>;
|
|
107
|
+
end: z.ZodOptional<z.ZodEffects<z.ZodEffects<z.ZodUnion<[z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, Date, string>, z.ZodDate]>, Date, string | Date>, Date, string | Date>>;
|
|
108
|
+
}, "strip", z.ZodTypeAny, {
|
|
109
|
+
start: Date;
|
|
110
|
+
end?: Date | undefined;
|
|
111
|
+
}, {
|
|
112
|
+
start: string | Date;
|
|
113
|
+
end?: string | Date | undefined;
|
|
114
|
+
}>;
|
|
115
|
+
export declare const NormalHourSchema: z.ZodObject<{
|
|
116
|
+
day: z.ZodNativeEnum<typeof WeekDay>;
|
|
117
|
+
status: z.ZodNativeEnum<typeof WorkStatus>;
|
|
118
|
+
openingHours: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
119
|
+
start: z.ZodString;
|
|
120
|
+
end: z.ZodString;
|
|
121
|
+
}, "strip", z.ZodTypeAny, {
|
|
122
|
+
end: string;
|
|
123
|
+
start: string;
|
|
124
|
+
}, {
|
|
125
|
+
end: string;
|
|
126
|
+
start: string;
|
|
127
|
+
}>, "many">>;
|
|
128
|
+
}, "strip", z.ZodTypeAny, {
|
|
129
|
+
status: WorkStatus;
|
|
130
|
+
day: WeekDay;
|
|
131
|
+
openingHours: {
|
|
132
|
+
end: string;
|
|
133
|
+
start: string;
|
|
134
|
+
}[];
|
|
135
|
+
}, {
|
|
136
|
+
status: WorkStatus;
|
|
137
|
+
day: WeekDay;
|
|
138
|
+
openingHours?: {
|
|
139
|
+
end: string;
|
|
140
|
+
start: string;
|
|
141
|
+
}[] | undefined;
|
|
142
|
+
}>;
|
|
143
|
+
export declare const HolidayHourSchema: z.ZodObject<{
|
|
144
|
+
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>;
|
|
145
|
+
status: z.ZodNativeEnum<typeof HolidayWorkStatus>;
|
|
146
|
+
closingHour: z.ZodObject<{
|
|
147
|
+
start: z.ZodString;
|
|
148
|
+
end: z.ZodString;
|
|
149
|
+
}, "strip", z.ZodTypeAny, {
|
|
150
|
+
end: string;
|
|
151
|
+
start: string;
|
|
152
|
+
}, {
|
|
153
|
+
end: string;
|
|
154
|
+
start: string;
|
|
155
|
+
}>;
|
|
156
|
+
}, "strip", z.ZodTypeAny, {
|
|
157
|
+
status: HolidayWorkStatus;
|
|
158
|
+
date: Date;
|
|
159
|
+
closingHour: {
|
|
160
|
+
end: string;
|
|
161
|
+
start: string;
|
|
162
|
+
};
|
|
163
|
+
}, {
|
|
164
|
+
status: HolidayWorkStatus;
|
|
165
|
+
date: string | Date;
|
|
166
|
+
closingHour: {
|
|
167
|
+
end: string;
|
|
168
|
+
start: string;
|
|
169
|
+
};
|
|
170
|
+
}>;
|
|
171
|
+
export declare const WrokHourSettingSchema: z.ZodObject<{
|
|
172
|
+
normalHours: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
173
|
+
day: z.ZodNativeEnum<typeof WeekDay>;
|
|
174
|
+
status: z.ZodNativeEnum<typeof WorkStatus>;
|
|
175
|
+
openingHours: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
176
|
+
start: z.ZodString;
|
|
177
|
+
end: z.ZodString;
|
|
178
|
+
}, "strip", z.ZodTypeAny, {
|
|
179
|
+
end: string;
|
|
180
|
+
start: string;
|
|
181
|
+
}, {
|
|
182
|
+
end: string;
|
|
183
|
+
start: string;
|
|
184
|
+
}>, "many">>;
|
|
185
|
+
}, "strip", z.ZodTypeAny, {
|
|
186
|
+
status: WorkStatus;
|
|
187
|
+
day: WeekDay;
|
|
188
|
+
openingHours: {
|
|
189
|
+
end: string;
|
|
190
|
+
start: string;
|
|
191
|
+
}[];
|
|
192
|
+
}, {
|
|
193
|
+
status: WorkStatus;
|
|
194
|
+
day: WeekDay;
|
|
195
|
+
openingHours?: {
|
|
196
|
+
end: string;
|
|
197
|
+
start: string;
|
|
198
|
+
}[] | undefined;
|
|
199
|
+
}>, "many">>;
|
|
200
|
+
holidayHours: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
201
|
+
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>;
|
|
202
|
+
status: z.ZodNativeEnum<typeof HolidayWorkStatus>;
|
|
203
|
+
closingHour: z.ZodObject<{
|
|
204
|
+
start: z.ZodString;
|
|
205
|
+
end: z.ZodString;
|
|
206
|
+
}, "strip", z.ZodTypeAny, {
|
|
207
|
+
end: string;
|
|
208
|
+
start: string;
|
|
209
|
+
}, {
|
|
210
|
+
end: string;
|
|
211
|
+
start: string;
|
|
212
|
+
}>;
|
|
213
|
+
}, "strip", z.ZodTypeAny, {
|
|
214
|
+
status: HolidayWorkStatus;
|
|
215
|
+
date: Date;
|
|
216
|
+
closingHour: {
|
|
217
|
+
end: string;
|
|
218
|
+
start: string;
|
|
219
|
+
};
|
|
220
|
+
}, {
|
|
221
|
+
status: HolidayWorkStatus;
|
|
222
|
+
date: string | Date;
|
|
223
|
+
closingHour: {
|
|
224
|
+
end: string;
|
|
225
|
+
start: string;
|
|
226
|
+
};
|
|
227
|
+
}>, "many">>;
|
|
228
|
+
}, "strip", z.ZodTypeAny, {
|
|
229
|
+
normalHours: {
|
|
230
|
+
status: WorkStatus;
|
|
231
|
+
day: WeekDay;
|
|
232
|
+
openingHours: {
|
|
233
|
+
end: string;
|
|
234
|
+
start: string;
|
|
235
|
+
}[];
|
|
236
|
+
}[];
|
|
237
|
+
holidayHours: {
|
|
238
|
+
status: HolidayWorkStatus;
|
|
239
|
+
date: Date;
|
|
240
|
+
closingHour: {
|
|
241
|
+
end: string;
|
|
242
|
+
start: string;
|
|
243
|
+
};
|
|
244
|
+
}[];
|
|
245
|
+
}, {
|
|
246
|
+
normalHours?: {
|
|
247
|
+
status: WorkStatus;
|
|
248
|
+
day: WeekDay;
|
|
249
|
+
openingHours?: {
|
|
250
|
+
end: string;
|
|
251
|
+
start: string;
|
|
252
|
+
}[] | undefined;
|
|
253
|
+
}[] | undefined;
|
|
254
|
+
holidayHours?: {
|
|
255
|
+
status: HolidayWorkStatus;
|
|
256
|
+
date: string | Date;
|
|
257
|
+
closingHour: {
|
|
258
|
+
end: string;
|
|
259
|
+
start: string;
|
|
260
|
+
};
|
|
261
|
+
}[] | undefined;
|
|
65
262
|
}>;
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.AddressSchema = exports.StringSchema = exports.FilterSchema = void 0;
|
|
3
|
+
exports.WrokHourSettingSchema = exports.HolidayHourSchema = exports.NormalHourSchema = exports.DurationSchema = exports.UserAddressSchema = exports.AddressSchema = exports.StringSchema = exports.FilterSchema = void 0;
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
|
+
const global_validation_1 = require("./global-validation");
|
|
6
|
+
const enum_1 = require("../enum");
|
|
5
7
|
const SortOrderSchema = zod_1.z.union([
|
|
6
8
|
zod_1.z.literal(1),
|
|
7
9
|
zod_1.z.literal(-1),
|
|
8
10
|
zod_1.z.literal("asc"),
|
|
9
|
-
zod_1.z.literal("desc")
|
|
11
|
+
zod_1.z.literal("desc")
|
|
10
12
|
]);
|
|
11
13
|
const MongoQuerySchema = zod_1.z.lazy(() => zod_1.z.record(zod_1.z.union([zod_1.z.any(), MongoOperatorsSchema])));
|
|
12
14
|
const MongoOperatorsSchema = zod_1.z.object({
|
|
@@ -23,7 +25,7 @@ const MongoOperatorsSchema = zod_1.z.object({
|
|
|
23
25
|
$and: zod_1.z.array(MongoQuerySchema).optional(),
|
|
24
26
|
$or: zod_1.z.array(MongoQuerySchema).optional(),
|
|
25
27
|
$not: MongoQuerySchema.optional(),
|
|
26
|
-
$nor: zod_1.z.array(MongoQuerySchema).optional()
|
|
28
|
+
$nor: zod_1.z.array(MongoQuerySchema).optional()
|
|
27
29
|
});
|
|
28
30
|
exports.FilterSchema = zod_1.z
|
|
29
31
|
.object({
|
|
@@ -36,7 +38,7 @@ exports.FilterSchema = zod_1.z
|
|
|
36
38
|
sort: zod_1.z.record(zod_1.z.string(), SortOrderSchema).optional(),
|
|
37
39
|
query: MongoQuerySchema.optional(),
|
|
38
40
|
select: zod_1.z.array(zod_1.z.string()).optional(),
|
|
39
|
-
populate: zod_1.z.array(zod_1.z.string()).optional()
|
|
41
|
+
populate: zod_1.z.array(zod_1.z.string()).optional()
|
|
40
42
|
})
|
|
41
43
|
.optional();
|
|
42
44
|
exports.StringSchema = zod_1.z
|
|
@@ -44,17 +46,43 @@ exports.StringSchema = zod_1.z
|
|
|
44
46
|
.min(1, "String cannot be empty")
|
|
45
47
|
.max(255, "String is too long");
|
|
46
48
|
exports.AddressSchema = zod_1.z.object({
|
|
47
|
-
address:
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
49
|
+
address: global_validation_1.ZodValidation.string("Address"),
|
|
50
|
+
description: global_validation_1.ZodValidation.string("Description").optional(),
|
|
51
|
+
city: global_validation_1.ZodValidation.string("City"),
|
|
52
|
+
state: global_validation_1.ZodValidation.string("State"),
|
|
53
|
+
country: global_validation_1.ZodValidation.string("Country"),
|
|
54
|
+
geoLocationType: global_validation_1.ZodValidation.enumType(enum_1.GeoLocationType, "GeoLocationType").default(enum_1.GeoLocationType.POINT),
|
|
55
|
+
coordinates: global_validation_1.ZodValidation.array(global_validation_1.ZodValidation.number("Coordinate"), "Coordinates", 2, 2),
|
|
56
|
+
latitude: global_validation_1.ZodValidation.number("Latitude"),
|
|
57
|
+
longitude: global_validation_1.ZodValidation.number("Longitude")
|
|
58
|
+
});
|
|
59
|
+
exports.UserAddressSchema = exports.AddressSchema.extend({
|
|
60
|
+
addressLabel: global_validation_1.ZodValidation.string("Address Label"),
|
|
61
|
+
apartment: global_validation_1.ZodValidation.string("Apartment"),
|
|
62
|
+
buildingName: global_validation_1.ZodValidation.string("Building Name"),
|
|
63
|
+
deliveryOption: global_validation_1.ZodValidation.string("Delivery Option").optional(),
|
|
64
|
+
instructions: global_validation_1.ZodValidation.string("Instructions").optional()
|
|
65
|
+
});
|
|
66
|
+
exports.DurationSchema = zod_1.z.object({
|
|
67
|
+
start: global_validation_1.ZodValidation.date("Start"),
|
|
68
|
+
end: global_validation_1.ZodValidation.date("End").optional()
|
|
69
|
+
});
|
|
70
|
+
const StartEndTimeSchema = zod_1.z.object({
|
|
71
|
+
start: global_validation_1.ZodValidation.string("Start"),
|
|
72
|
+
end: global_validation_1.ZodValidation.string("End")
|
|
73
|
+
});
|
|
74
|
+
exports.NormalHourSchema = zod_1.z.object({
|
|
75
|
+
day: global_validation_1.ZodValidation.enumType(enum_1.WeekDay, "Day"),
|
|
76
|
+
status: global_validation_1.ZodValidation.enumType(enum_1.WorkStatus, "Status"),
|
|
77
|
+
openingHours: global_validation_1.ZodValidation.array(StartEndTimeSchema).default([])
|
|
78
|
+
});
|
|
79
|
+
exports.HolidayHourSchema = zod_1.z.object({
|
|
80
|
+
date: global_validation_1.ZodValidation.date("Date"),
|
|
81
|
+
status: global_validation_1.ZodValidation.enumType(enum_1.HolidayWorkStatus, "Status"),
|
|
82
|
+
closingHour: StartEndTimeSchema
|
|
83
|
+
});
|
|
84
|
+
exports.WrokHourSettingSchema = zod_1.z.object({
|
|
85
|
+
normalHours: global_validation_1.ZodValidation.array(exports.NormalHourSchema).default([]),
|
|
86
|
+
holidayHours: global_validation_1.ZodValidation.array(exports.HolidayHourSchema).default([])
|
|
59
87
|
});
|
|
60
88
|
//# sourceMappingURL=common-validation.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"common-validation.js","sourceRoot":"/","sources":["utilities/validation/common-validation.ts"],"names":[],"mappings":";;;AAAA,6BAAwB;
|
|
1
|
+
{"version":3,"file":"common-validation.js","sourceRoot":"/","sources":["utilities/validation/common-validation.ts"],"names":[],"mappings":";;;AAAA,6BAAwB;AACxB,2DAAoD;AACpD,kCAKiB;AAKjB,MAAM,eAAe,GAAG,OAAC,CAAC,KAAK,CAAC;IAC9B,OAAC,CAAC,OAAO,CAAC,CAAC,CAAC;IACZ,OAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;IACb,OAAC,CAAC,OAAO,CAAC,KAAK,CAAC;IAChB,OAAC,CAAC,OAAO,CAAC,MAAM,CAAC;CAClB,CAAC,CAAC;AAKH,MAAM,gBAAgB,GAAmC,OAAC,CAAC,IAAI,CAAC,GAAG,EAAE,CACnE,OAAC,CAAC,MAAM,CAAC,OAAC,CAAC,KAAK,CAAC,CAAC,OAAC,CAAC,GAAG,EAAE,EAAE,oBAAoB,CAAC,CAAC,CA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CAAC;CAClE,CAAC,CAAC;AAEU,QAAA,iBAAiB,GAAG,OAAC,CAAC,MAAM,CAAC;IACxC,IAAI,EAAE,iCAAa,CAAC,IAAI,CAAC,MAAM,CAAC;IAChC,MAAM,EAAE,iCAAa,CAAC,QAAQ,CAAC,wBAAiB,EAAE,QAAQ,CAAC;IAC3D,WAAW,EAAE,kBAAkB;CAChC,CAAC,CAAC;AAEU,QAAA,qBAAqB,GAAG,OAAC,CAAC,MAAM,CAAC;IAC5C,WAAW,EAAE,iCAAa,CAAC,KAAK,CAAC,wBAAgB,CAAC,CAAC,OAAO,CAAC,EAAE,CAAC;IAC9D,YAAY,EAAE,iCAAa,CAAC,KAAK,CAAC,yBAAiB,CAAC,CAAC,OAAO,CAAC,EAAE,CAAC;CACjE,CAAC,CAAC","sourcesContent":["import { z } from \"zod\";\r\nimport { ZodValidation } from \"./global-validation\";\r\nimport {\r\n GeoLocationType,\r\n HolidayWorkStatus,\r\n WeekDay,\r\n WorkStatus\r\n} from \"../enum\";\r\n\r\n/**\r\n * Define allowed MongoDB sort orders\r\n */\r\nconst SortOrderSchema = z.union([\r\n z.literal(1),\r\n z.literal(-1),\r\n z.literal(\"asc\"),\r\n z.literal(\"desc\")\r\n]);\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 z.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 $eq: z.any().optional(),\r\n $ne: z.any().optional(),\r\n $gt: z.any().optional(),\r\n $gte: z.any().optional(),\r\n $lt: z.any().optional(),\r\n $lte: z.any().optional(),\r\n $in: z.array(z.any()).optional(),\r\n $nin: z.array(z.any()).optional(),\r\n $exists: z.boolean().optional(),\r\n $regex: z.string().optional(),\r\n $and: z.array(MongoQuerySchema).optional(),\r\n $or: z.array(MongoQuerySchema).optional(),\r\n $not: MongoQuerySchema.optional(),\r\n $nor: z.array(MongoQuerySchema).optional()\r\n});\r\n\r\n/**\r\n * Define the filter schema using MongoQuerySchema\r\n */\r\nexport const FilterSchema = z\r\n .object({\r\n limit: z\r\n .number()\r\n .min(1, { message: \"Limit must be greater than 0.\" })\r\n .max(100, { message: \"Limit cannot exceed 100.\" })\r\n .default(10),\r\n skip: z.number().min(0, { message: \"Skip cannot be negative.\" }).default(0),\r\n sort: z.record(z.string(), SortOrderSchema).optional(),\r\n query: MongoQuerySchema.optional(),\r\n select: z.array(z.string()).optional(),\r\n populate: z.array(z.string()).optional()\r\n })\r\n .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\r\n .string()\r\n .min(1, \"String cannot be empty\")\r\n .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 address: ZodValidation.string(\"Address\"),\r\n description: ZodValidation.string(\"Description\").optional(),\r\n city: ZodValidation.string(\"City\"),\r\n state: ZodValidation.string(\"State\"),\r\n country: ZodValidation.string(\"Country\"),\r\n geoLocationType: ZodValidation.enumType(\r\n GeoLocationType,\r\n \"GeoLocationType\"\r\n ).default(GeoLocationType.POINT),\r\n coordinates: ZodValidation.array(\r\n ZodValidation.number(\"Coordinate\"),\r\n \"Coordinates\",\r\n 2,\r\n 2\r\n ),\r\n latitude: ZodValidation.number(\"Latitude\"),\r\n longitude: 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 addressLabel: ZodValidation.string(\"Address Label\"),\r\n apartment: ZodValidation.string(\"Apartment\"),\r\n buildingName: ZodValidation.string(\"Building Name\"),\r\n deliveryOption: ZodValidation.string(\"Delivery Option\").optional(),\r\n instructions: 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 start: ZodValidation.date(\"Start\"),\r\n end: 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 wrokHourSetting fields.\r\n *\r\n * @example\r\n * ```typescript\r\n * const settingSchema = z.object({\r\n * vat: z.number(),\r\n * wrokHourSetting: WrokHourSettingSchema\r\n * });\r\n * ```\r\n */\r\nconst StartEndTimeSchema = z.object({\r\n start: ZodValidation.string(\"Start\"),\r\n end: ZodValidation.string(\"End\")\r\n});\r\n\r\nexport const NormalHourSchema = z.object({\r\n day: ZodValidation.enumType(WeekDay, \"Day\"),\r\n status: ZodValidation.enumType(WorkStatus, \"Status\"),\r\n openingHours: ZodValidation.array(StartEndTimeSchema).default([])\r\n});\r\n\r\nexport const HolidayHourSchema = z.object({\r\n date: ZodValidation.date(\"Date\"),\r\n status: ZodValidation.enumType(HolidayWorkStatus, \"Status\"),\r\n closingHour: StartEndTimeSchema\r\n});\r\n\r\nexport const WrokHourSettingSchema = z.object({\r\n normalHours: ZodValidation.array(NormalHourSchema).default([]),\r\n holidayHours: ZodValidation.array(HolidayHourSchema).default([])\r\n});\r\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { z } from
|
|
2
|
-
import { mongoose } from
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { mongoose } from "@typegoose/typegoose";
|
|
3
3
|
export declare class ZodValidation {
|
|
4
4
|
static objectId(field?: string): z.ZodUnion<[z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, mongoose.Types.ObjectId, string>, z.ZodType<mongoose.Types.ObjectId, z.ZodTypeDef, mongoose.Types.ObjectId>]>;
|
|
5
5
|
static enumType<T extends z.EnumLike>(enumObj: T, field?: string): z.ZodNativeEnum<T>;
|
|
@@ -17,8 +17,7 @@ export declare class ZodValidation {
|
|
|
17
17
|
static email(field?: string): z.ZodString;
|
|
18
18
|
static url(field?: string): z.ZodString;
|
|
19
19
|
static phoneNumber(field?: string): z.ZodString;
|
|
20
|
-
static
|
|
21
|
-
static date(field?: string, minDate?: Date, maxDate?: Date): z.ZodDate;
|
|
20
|
+
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>;
|
|
22
21
|
static boolean(field?: string): z.ZodBoolean;
|
|
23
22
|
static array<T extends z.ZodTypeAny>(schema: T, field?: string, minItems?: number, maxItems?: number): z.ZodArray<T, "many">;
|
|
24
23
|
static timestamps(): {
|
|
@@ -5,26 +5,28 @@ exports.createSchemaBuilder = createSchemaBuilder;
|
|
|
5
5
|
const zod_1 = require("zod");
|
|
6
6
|
const typegoose_1 = require("@typegoose/typegoose");
|
|
7
7
|
class ZodValidation {
|
|
8
|
-
static objectId(field =
|
|
8
|
+
static objectId(field = "Field") {
|
|
9
9
|
return zod_1.z.union([
|
|
10
10
|
zod_1.z
|
|
11
11
|
.string({ required_error: `${field} is required` })
|
|
12
|
-
.refine(val => typegoose_1.mongoose.Types.ObjectId.isValid(val), {
|
|
13
|
-
message: `${field} must be a valid ObjectID
|
|
12
|
+
.refine((val) => typegoose_1.mongoose.Types.ObjectId.isValid(val), {
|
|
13
|
+
message: `${field} must be a valid ObjectID`
|
|
14
|
+
})
|
|
15
|
+
.transform((val) => new typegoose_1.mongoose.Types.ObjectId(val)),
|
|
16
|
+
zod_1.z.instanceof(typegoose_1.mongoose.Types.ObjectId, {
|
|
17
|
+
message: `${field} must be a valid ObjectID`
|
|
14
18
|
})
|
|
15
|
-
.transform(val => new typegoose_1.mongoose.Types.ObjectId(val)),
|
|
16
|
-
zod_1.z.instanceof(typegoose_1.mongoose.Types.ObjectId, { message: `${field} must be a valid ObjectID` }),
|
|
17
19
|
], { message: `${field} is required` });
|
|
18
20
|
}
|
|
19
|
-
static enumType(enumObj, field =
|
|
21
|
+
static enumType(enumObj, field = "Field") {
|
|
20
22
|
return zod_1.z.nativeEnum(enumObj, {
|
|
21
|
-
message: `${field} must be one of: ${Object.values(enumObj).join(
|
|
23
|
+
message: `${field} must be one of: ${Object.values(enumObj).join(", ")}`
|
|
22
24
|
});
|
|
23
25
|
}
|
|
24
|
-
static number(field =
|
|
26
|
+
static number(field = "Field", min, max, options) {
|
|
25
27
|
let schema = zod_1.z.number({
|
|
26
28
|
required_error: `${field} is required`,
|
|
27
|
-
invalid_type_error: `${field} must be a number
|
|
29
|
+
invalid_type_error: `${field} must be a number`
|
|
28
30
|
});
|
|
29
31
|
if (min !== undefined) {
|
|
30
32
|
schema = schema.gte(min, { message: `${field} must be at least ${min}` });
|
|
@@ -49,10 +51,10 @@ class ZodValidation {
|
|
|
49
51
|
}
|
|
50
52
|
return schema;
|
|
51
53
|
}
|
|
52
|
-
static string(field =
|
|
54
|
+
static string(field = "Field", minLength, maxLength, regex) {
|
|
53
55
|
let schema = zod_1.z.string({
|
|
54
56
|
required_error: `${field} is required`,
|
|
55
|
-
invalid_type_error: `${field} must be a string
|
|
57
|
+
invalid_type_error: `${field} must be a string`
|
|
56
58
|
});
|
|
57
59
|
if (minLength !== undefined) {
|
|
58
60
|
schema = schema.min(minLength, `${field} value length must be greater than or equal to ${minLength}`);
|
|
@@ -65,45 +67,49 @@ class ZodValidation {
|
|
|
65
67
|
}
|
|
66
68
|
return schema;
|
|
67
69
|
}
|
|
68
|
-
static email(field =
|
|
70
|
+
static email(field = "Field") {
|
|
69
71
|
return zod_1.z
|
|
70
72
|
.string({ required_error: `${field} is required` })
|
|
71
73
|
.email(`${field} must be a valid email address`);
|
|
72
74
|
}
|
|
73
|
-
static url(field =
|
|
74
|
-
return zod_1.z
|
|
75
|
+
static url(field = "Field") {
|
|
76
|
+
return zod_1.z
|
|
77
|
+
.string({ required_error: `${field} is required` })
|
|
78
|
+
.url(`${field} must be a valid URL`);
|
|
75
79
|
}
|
|
76
|
-
static phoneNumber(field =
|
|
80
|
+
static phoneNumber(field = "Field") {
|
|
77
81
|
return zod_1.z
|
|
78
82
|
.string({ required_error: `${field} is required` })
|
|
79
83
|
.regex(/^[+]{1}(?:[0-9\-\\(\\)\\/.]\s?){6,15}[0-9]{1}$/, `${field} must be a valid phone number`);
|
|
80
84
|
}
|
|
81
|
-
static
|
|
82
|
-
return zod_1.z
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
85
|
+
static date(field = "Field", minDate, maxDate) {
|
|
86
|
+
return zod_1.z
|
|
87
|
+
.union([
|
|
88
|
+
zod_1.z
|
|
89
|
+
.string({ required_error: `${field} is required` })
|
|
90
|
+
.refine((val) => {
|
|
91
|
+
const date = new Date(val);
|
|
92
|
+
return !isNaN(date.getTime());
|
|
93
|
+
}, `${field} must be a valid date`)
|
|
94
|
+
.transform((val) => new Date(val)),
|
|
95
|
+
zod_1.z.date({
|
|
96
|
+
required_error: `${field} is required`,
|
|
97
|
+
invalid_type_error: `${field} must be a valid date`
|
|
98
|
+
})
|
|
99
|
+
], { message: `${field} is required` })
|
|
100
|
+
.refine((val) => minDate === undefined || val >= minDate, `${field} must be on or after ${minDate?.toISOString()}`)
|
|
101
|
+
.refine((val) => maxDate === undefined || val <= maxDate, `${field} must be on or before ${maxDate?.toISOString()}`);
|
|
98
102
|
}
|
|
99
|
-
static boolean(field =
|
|
103
|
+
static boolean(field = "Field") {
|
|
100
104
|
return zod_1.z.boolean({
|
|
101
105
|
required_error: `${field} is required`,
|
|
102
|
-
invalid_type_error: `${field} must be a boolean
|
|
106
|
+
invalid_type_error: `${field} must be a boolean`
|
|
103
107
|
});
|
|
104
108
|
}
|
|
105
|
-
static array(schema, field =
|
|
106
|
-
let arraySchema = zod_1.z.array(schema, {
|
|
109
|
+
static array(schema, field = "Array", minItems, maxItems) {
|
|
110
|
+
let arraySchema = zod_1.z.array(schema, {
|
|
111
|
+
required_error: `${field} is required`
|
|
112
|
+
});
|
|
107
113
|
if (minItems === 1) {
|
|
108
114
|
arraySchema = arraySchema.min(1, `${field} cannot be empty`);
|
|
109
115
|
}
|
|
@@ -119,7 +125,7 @@ class ZodValidation {
|
|
|
119
125
|
return {
|
|
120
126
|
createdAt: zod_1.z.date().nullable().optional(),
|
|
121
127
|
updatedAt: zod_1.z.date().nullable().optional(),
|
|
122
|
-
deletedAt: zod_1.z.date().nullable().optional()
|
|
128
|
+
deletedAt: zod_1.z.date().nullable().optional()
|
|
123
129
|
};
|
|
124
130
|
}
|
|
125
131
|
static trackingFields() {
|
|
@@ -127,7 +133,7 @@ class ZodValidation {
|
|
|
127
133
|
createdBy: ZodValidation.objectId().optional(),
|
|
128
134
|
updatedBy: ZodValidation.objectId().optional(),
|
|
129
135
|
deletedBy: ZodValidation.objectId().optional(),
|
|
130
|
-
...ZodValidation.timestamps()
|
|
136
|
+
...ZodValidation.timestamps()
|
|
131
137
|
};
|
|
132
138
|
}
|
|
133
139
|
}
|
|
@@ -142,13 +148,13 @@ class SchemaBuilder {
|
|
|
142
148
|
if (includeTracking) {
|
|
143
149
|
this.baseSchema = zod_1.z.object({
|
|
144
150
|
...baseFields,
|
|
145
|
-
...ZodValidation.trackingFields()
|
|
151
|
+
...ZodValidation.trackingFields()
|
|
146
152
|
});
|
|
147
153
|
}
|
|
148
154
|
else if (includeTimestamps) {
|
|
149
155
|
this.baseSchema = zod_1.z.object({
|
|
150
156
|
...baseFields,
|
|
151
|
-
...ZodValidation.timestamps()
|
|
157
|
+
...ZodValidation.timestamps()
|
|
152
158
|
});
|
|
153
159
|
}
|
|
154
160
|
else {
|
|
@@ -160,7 +166,7 @@ class SchemaBuilder {
|
|
|
160
166
|
}
|
|
161
167
|
getEntitySchema() {
|
|
162
168
|
return this.baseSchema.extend({
|
|
163
|
-
_id: ZodValidation.objectId()
|
|
169
|
+
_id: ZodValidation.objectId()
|
|
164
170
|
});
|
|
165
171
|
}
|
|
166
172
|
getIdSchema() {
|
|
@@ -185,7 +191,7 @@ class SchemaBuilder {
|
|
|
185
191
|
BaseSchema: this.getBaseSchema(),
|
|
186
192
|
EntitySchema: this.getEntitySchema(),
|
|
187
193
|
IdSchema: this.getIdSchema(),
|
|
188
|
-
UpdateSchema: this.getUpdateSchema(excludeFromUpdate)
|
|
194
|
+
UpdateSchema: this.getUpdateSchema(excludeFromUpdate)
|
|
189
195
|
};
|
|
190
196
|
}
|
|
191
197
|
}
|