@beautinique/be-zod 1.0.11 → 1.0.13
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/constants/index.d.ts +2 -2
- package/dist/constants/index.js +71 -76
- package/dist/constants/index.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/schemas/address.schema.d.ts +1 -1
- package/dist/schemas/address.schema.js +12 -12
- package/dist/schemas/blog.schema.d.ts +1 -1
- package/dist/schemas/blog.schema.js +19 -19
- package/dist/schemas/blog.schema.js.map +1 -1
- package/dist/schemas/cart.schema.js +2 -2
- package/dist/schemas/index.d.ts +8 -7
- package/dist/schemas/index.js +1 -0
- package/dist/schemas/index.js.map +1 -1
- package/dist/schemas/mail-service/index.d.ts +6 -0
- package/dist/schemas/mail-service/index.js +10 -0
- package/dist/schemas/mail-service/index.js.map +1 -0
- package/dist/schemas/media.schema.js +9 -9
- package/dist/schemas/media.schema.js.map +1 -1
- package/dist/schemas/product.schema.d.ts +1 -1
- package/dist/schemas/product.schema.js +85 -105
- package/dist/schemas/product.schema.js.map +1 -1
- package/dist/schemas/review.schema.js +17 -17
- package/dist/schemas/review.schema.js.map +1 -1
- package/dist/schemas/user.schema.d.ts +1 -1
- package/dist/schemas/user.schema.js +52 -52
- package/dist/schemas/user.schema.js.map +1 -1
- package/dist/types/index.d.ts +3 -3
- package/dist/utils/index.d.ts +2 -2
- package/dist/utils/index.js +13 -17
- package/dist/utils/index.js.map +1 -1
- package/package.json +2 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { IZodEnumsConfigs, IZodNumberConfigs, IZodStringConfigs } from
|
|
2
|
-
import { ADDRESS_TYPES, COUNTRIES, STATES_AND_UTS } from
|
|
1
|
+
import { IZodEnumsConfigs, IZodNumberConfigs, IZodStringConfigs } from '../types';
|
|
2
|
+
import { ADDRESS_TYPES, COUNTRIES, STATES_AND_UTS } from '@beautinique/be-constants';
|
|
3
3
|
export declare const EMAIL_OPTIONS: IZodStringConfigs;
|
|
4
4
|
export declare const PHONE_OPTIONS: IZodStringConfigs;
|
|
5
5
|
export declare const PASSWORD_OPTIONS: IZodStringConfigs;
|
package/dist/constants/index.js
CHANGED
|
@@ -3,168 +3,163 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.STOCK_OPTIONS = exports.COLOR_CODE_OPTIONS = exports.SHADE_NAME_OPTIONS = exports.MONGO_ID_OPTIONS = exports.PRICE_OPTIONS = exports.DESCRIPTION_OPTIONS = exports.TITLE_OPTIONS = exports.ADDRESS_TYPE_OPTIONS = exports.COUNTRY_OPTIONS = exports.STATE_AND_UTS_OPTIONS = exports.PIN_CODE_OPTIONS = exports.GST_OPTIONS = exports.CITY_OPTIONS = exports.LANDMARK_OPTIONS = exports.ADDRESS_OPTIONS = exports.OTP_OPTIONS = exports.NAME_OPTIONS = exports.PASSWORD_OPTIONS = exports.PHONE_OPTIONS = exports.EMAIL_OPTIONS = void 0;
|
|
4
4
|
const be_constants_1 = require("@beautinique/be-constants");
|
|
5
5
|
exports.EMAIL_OPTIONS = {
|
|
6
|
-
allowSpace:
|
|
7
|
-
field:
|
|
8
|
-
label:
|
|
9
|
-
lowerOrUpper:
|
|
10
|
-
customRegex: { regex: be_constants_1.REGEX.EMAIL, message:
|
|
6
|
+
allowSpace: 'noSpace',
|
|
7
|
+
field: 'email',
|
|
8
|
+
label: 'Email',
|
|
9
|
+
lowerOrUpper: 'lower',
|
|
10
|
+
customRegex: { regex: be_constants_1.REGEX.EMAIL, message: 'must be valid' },
|
|
11
11
|
};
|
|
12
12
|
exports.PHONE_OPTIONS = {
|
|
13
|
-
field:
|
|
14
|
-
label:
|
|
15
|
-
allowSpace:
|
|
13
|
+
field: 'phoneNumber',
|
|
14
|
+
label: 'Phone number',
|
|
15
|
+
allowSpace: 'noSpace',
|
|
16
16
|
customRegexes: [
|
|
17
|
-
{ regex: be_constants_1.REGEX.PHONE_START, message:
|
|
18
|
-
{ regex: be_constants_1.REGEX.PHONE_EXACT_LENGTH, message:
|
|
17
|
+
{ regex: be_constants_1.REGEX.PHONE_START, message: 'must be start with 6, 7, 8, or 9' },
|
|
18
|
+
{ regex: be_constants_1.REGEX.PHONE_EXACT_LENGTH, message: 'must be exactly 10 digits' },
|
|
19
19
|
{
|
|
20
20
|
regex: be_constants_1.REGEX.PHONE,
|
|
21
|
-
message:
|
|
21
|
+
message: 'must be exactly 10 digits and must start with 6, 7, 8, or 9',
|
|
22
22
|
},
|
|
23
23
|
],
|
|
24
24
|
};
|
|
25
25
|
exports.PASSWORD_OPTIONS = {
|
|
26
|
-
field:
|
|
27
|
-
label:
|
|
28
|
-
allowSpace:
|
|
26
|
+
field: 'password',
|
|
27
|
+
label: 'Password',
|
|
28
|
+
allowSpace: 'noSpace',
|
|
29
29
|
min: 6,
|
|
30
30
|
max: 20,
|
|
31
31
|
customRegexes: [
|
|
32
32
|
{
|
|
33
33
|
regex: be_constants_1.REGEX.AT_LEAST_ONE_UPPERCASE_LETTER,
|
|
34
|
-
message:
|
|
34
|
+
message: 'must contain at least one uppercase letter',
|
|
35
35
|
},
|
|
36
36
|
{
|
|
37
37
|
regex: be_constants_1.REGEX.AT_LEAST_ONE_LOWERCASE_LETTER,
|
|
38
|
-
message:
|
|
39
|
-
},
|
|
40
|
-
{
|
|
41
|
-
regex: be_constants_1.REGEX.AT_LEAST_ONE_DIGIT,
|
|
42
|
-
message: "must contain at least one number",
|
|
38
|
+
message: 'must contain at least one lowercase letter',
|
|
43
39
|
},
|
|
40
|
+
{ regex: be_constants_1.REGEX.AT_LEAST_ONE_DIGIT, message: 'must contain at least one number' },
|
|
44
41
|
{
|
|
45
42
|
regex: be_constants_1.REGEX.AT_LEAST_ONE_SPECIAL_CHARACTER,
|
|
46
|
-
message:
|
|
43
|
+
message: 'must contain at least one special character e.g. @$!%*?&#',
|
|
47
44
|
},
|
|
48
45
|
{
|
|
49
46
|
regex: be_constants_1.REGEX.PASSWORD,
|
|
50
|
-
message:
|
|
47
|
+
message: 'must contain at least one uppercase letter, one lowercase letter, one number, and one special character',
|
|
51
48
|
},
|
|
52
49
|
],
|
|
53
50
|
};
|
|
54
51
|
exports.NAME_OPTIONS = {
|
|
55
|
-
field:
|
|
56
|
-
label:
|
|
52
|
+
field: 'name',
|
|
53
|
+
label: 'Name',
|
|
57
54
|
min: 2,
|
|
58
55
|
max: 50,
|
|
59
|
-
allowSpace:
|
|
60
|
-
customRegex: { regex: be_constants_1.REGEX.NAME, message:
|
|
56
|
+
allowSpace: 'singleSpace',
|
|
57
|
+
customRegex: { regex: be_constants_1.REGEX.NAME, message: 'can only contain letters' },
|
|
61
58
|
};
|
|
62
59
|
exports.OTP_OPTIONS = {
|
|
63
|
-
field:
|
|
64
|
-
label:
|
|
60
|
+
field: 'otp',
|
|
61
|
+
label: 'OTP',
|
|
65
62
|
min: 6,
|
|
66
63
|
max: 6,
|
|
67
|
-
allowSpace:
|
|
68
|
-
customRegex: { regex: be_constants_1.REGEX.OTP, message:
|
|
64
|
+
allowSpace: 'noSpace',
|
|
65
|
+
customRegex: { regex: be_constants_1.REGEX.OTP, message: 'must be 6 digits' },
|
|
69
66
|
};
|
|
70
67
|
exports.ADDRESS_OPTIONS = {
|
|
71
|
-
field:
|
|
72
|
-
label:
|
|
68
|
+
field: 'address',
|
|
69
|
+
label: 'Address',
|
|
73
70
|
min: 3,
|
|
74
71
|
max: 100,
|
|
75
|
-
allowSpace:
|
|
72
|
+
allowSpace: 'singleSpace',
|
|
76
73
|
};
|
|
77
74
|
exports.LANDMARK_OPTIONS = {
|
|
78
|
-
field:
|
|
79
|
-
label:
|
|
80
|
-
allowSpace:
|
|
75
|
+
field: 'landmark',
|
|
76
|
+
label: 'Landmark',
|
|
77
|
+
allowSpace: 'singleSpace',
|
|
81
78
|
min: 2,
|
|
82
79
|
nonEmpty: false,
|
|
83
80
|
};
|
|
84
81
|
exports.CITY_OPTIONS = {
|
|
85
|
-
field:
|
|
86
|
-
label:
|
|
87
|
-
allowSpace:
|
|
82
|
+
field: 'city',
|
|
83
|
+
label: 'City',
|
|
84
|
+
allowSpace: 'singleSpace',
|
|
88
85
|
min: 2,
|
|
89
86
|
};
|
|
90
87
|
exports.GST_OPTIONS = {
|
|
91
|
-
field:
|
|
92
|
-
label:
|
|
93
|
-
allowSpace:
|
|
88
|
+
field: 'gst',
|
|
89
|
+
label: 'GST Number',
|
|
90
|
+
allowSpace: 'noSpace',
|
|
94
91
|
min: 15,
|
|
95
92
|
max: 15,
|
|
96
|
-
customRegex: { regex: be_constants_1.REGEX.GST, message:
|
|
93
|
+
customRegex: { regex: be_constants_1.REGEX.GST, message: 'must be valid' },
|
|
97
94
|
nonEmpty: false,
|
|
98
95
|
};
|
|
99
96
|
exports.PIN_CODE_OPTIONS = {
|
|
100
|
-
field:
|
|
101
|
-
label:
|
|
97
|
+
field: 'pinCode',
|
|
98
|
+
label: 'Pin Code',
|
|
102
99
|
min: 6,
|
|
103
100
|
max: 6,
|
|
104
|
-
allowSpace:
|
|
105
|
-
customRegex: { regex: be_constants_1.REGEX.PIN_CODE, message:
|
|
101
|
+
allowSpace: 'noSpace',
|
|
102
|
+
customRegex: { regex: be_constants_1.REGEX.PIN_CODE, message: 'must be valid' },
|
|
106
103
|
};
|
|
107
104
|
exports.STATE_AND_UTS_OPTIONS = {
|
|
108
|
-
field:
|
|
109
|
-
label:
|
|
105
|
+
field: 'state',
|
|
106
|
+
label: 'State',
|
|
110
107
|
enumValues: be_constants_1.STATES_AND_UTS,
|
|
111
108
|
};
|
|
112
109
|
exports.COUNTRY_OPTIONS = {
|
|
113
|
-
field:
|
|
114
|
-
label:
|
|
110
|
+
field: 'country',
|
|
111
|
+
label: 'Country',
|
|
115
112
|
enumValues: be_constants_1.COUNTRIES,
|
|
116
113
|
};
|
|
117
114
|
exports.ADDRESS_TYPE_OPTIONS = {
|
|
118
|
-
field:
|
|
119
|
-
label:
|
|
115
|
+
field: 'type',
|
|
116
|
+
label: 'Address Type',
|
|
120
117
|
enumValues: be_constants_1.ADDRESS_TYPES,
|
|
121
118
|
};
|
|
122
119
|
exports.TITLE_OPTIONS = {
|
|
123
|
-
field:
|
|
124
|
-
label:
|
|
120
|
+
field: 'title',
|
|
121
|
+
label: 'Title',
|
|
125
122
|
min: 2,
|
|
126
123
|
max: 100,
|
|
127
|
-
allowSpace:
|
|
124
|
+
allowSpace: 'singleSpace',
|
|
128
125
|
};
|
|
129
126
|
exports.DESCRIPTION_OPTIONS = {
|
|
130
|
-
field:
|
|
131
|
-
label:
|
|
127
|
+
field: 'description',
|
|
128
|
+
label: 'Description',
|
|
132
129
|
min: 10,
|
|
133
130
|
max: 300,
|
|
134
|
-
allowSpace:
|
|
131
|
+
allowSpace: 'singleSpace',
|
|
135
132
|
};
|
|
136
133
|
exports.PRICE_OPTIONS = {
|
|
137
|
-
field:
|
|
138
|
-
label:
|
|
134
|
+
field: 'price',
|
|
135
|
+
label: 'Price',
|
|
139
136
|
min: 1,
|
|
140
137
|
};
|
|
141
138
|
exports.MONGO_ID_OPTIONS = {
|
|
142
|
-
field:
|
|
143
|
-
label:
|
|
144
|
-
allowSpace:
|
|
139
|
+
field: '_id',
|
|
140
|
+
label: 'Id',
|
|
141
|
+
allowSpace: 'noSpace',
|
|
145
142
|
min: 24,
|
|
146
143
|
max: 24,
|
|
147
|
-
customRegex: { regex: be_constants_1.REGEX.MONGODB_ID, message:
|
|
144
|
+
customRegex: { regex: be_constants_1.REGEX.MONGODB_ID, message: 'must be valid' },
|
|
148
145
|
};
|
|
149
146
|
exports.SHADE_NAME_OPTIONS = {
|
|
150
|
-
field:
|
|
151
|
-
label:
|
|
152
|
-
allowSpace:
|
|
147
|
+
field: 'shadeName',
|
|
148
|
+
label: 'Shade name',
|
|
149
|
+
allowSpace: 'singleSpace',
|
|
153
150
|
min: 2,
|
|
154
151
|
};
|
|
155
152
|
exports.COLOR_CODE_OPTIONS = {
|
|
156
|
-
field:
|
|
157
|
-
label:
|
|
158
|
-
allowSpace:
|
|
153
|
+
field: 'colorCode',
|
|
154
|
+
label: 'Color code',
|
|
155
|
+
allowSpace: 'noSpace',
|
|
159
156
|
min: 4,
|
|
160
157
|
max: 9,
|
|
161
|
-
customRegexes: [
|
|
162
|
-
{ regex: be_constants_1.REGEX.HEX_CODE, message: "must be a valid hex color code." },
|
|
163
|
-
],
|
|
158
|
+
customRegexes: [{ regex: be_constants_1.REGEX.HEX_CODE, message: 'must be a valid hex color code.' }],
|
|
164
159
|
};
|
|
165
160
|
exports.STOCK_OPTIONS = {
|
|
166
|
-
field:
|
|
167
|
-
label:
|
|
161
|
+
field: 'stock',
|
|
162
|
+
label: 'Stock',
|
|
168
163
|
min: 5,
|
|
169
164
|
isInt: true,
|
|
170
165
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/constants/index.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/constants/index.ts"],"names":[],"mappings":";;;AACA,4DAA4F;AAE/E,QAAA,aAAa,GAAsB;IAC9C,UAAU,EAAE,SAAS;IACrB,KAAK,EAAE,OAAO;IACd,KAAK,EAAE,OAAO;IACd,YAAY,EAAE,OAAO;IACrB,WAAW,EAAE,EAAE,KAAK,EAAE,oBAAK,CAAC,KAAK,EAAE,OAAO,EAAE,eAAe,EAAE;CAC9D,CAAC;AAEW,QAAA,aAAa,GAAsB;IAC9C,KAAK,EAAE,aAAa;IACpB,KAAK,EAAE,cAAc;IACrB,UAAU,EAAE,SAAS;IACrB,aAAa,EAAE;QACb,EAAE,KAAK,EAAE,oBAAK,CAAC,WAAW,EAAE,OAAO,EAAE,kCAAkC,EAAE;QACzE,EAAE,KAAK,EAAE,oBAAK,CAAC,kBAAkB,EAAE,OAAO,EAAE,2BAA2B,EAAE;QACzE;YACE,KAAK,EAAE,oBAAK,CAAC,KAAK;YAClB,OAAO,EAAE,6DAA6D;SACvE;KACF;CACF,CAAC;AAEW,QAAA,gBAAgB,GA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Aa;CAC1B,CAAC;AAEW,QAAA,mBAAmB,GAAsB;IACpD,KAAK,EAAE,aAAa;IACpB,KAAK,EAAE,aAAa;IACpB,GAAG,EAAE,EAAE;IACP,GAAG,EAAE,GAAG;IACR,UAAU,EAAE,aAAa;CAC1B,CAAC;AAEW,QAAA,aAAa,GAAsB;IAC9C,KAAK,EAAE,OAAO;IACd,KAAK,EAAE,OAAO;IACd,GAAG,EAAE,CAAC;CACP,CAAC;AAEW,QAAA,gBAAgB,GAAsB;IACjD,KAAK,EAAE,KAAK;IACZ,KAAK,EAAE,IAAI;IACX,UAAU,EAAE,SAAS;IACrB,GAAG,EAAE,EAAE;IACP,GAAG,EAAE,EAAE;IACP,WAAW,EAAE,EAAE,KAAK,EAAE,oBAAK,CAAC,UAAU,EAAE,OAAO,EAAE,eAAe,EAAE;CACnE,CAAC;AAEW,QAAA,kBAAkB,GAAsB;IACnD,KAAK,EAAE,WAAW;IAClB,KAAK,EAAE,YAAY;IACnB,UAAU,EAAE,aAAa;IACzB,GAAG,EAAE,CAAC;CACP,CAAC;AAEW,QAAA,kBAAkB,GAAsB;IACnD,KAAK,EAAE,WAAW;IAClB,KAAK,EAAE,YAAY;IACnB,UAAU,EAAE,SAAS;IACrB,GAAG,EAAE,CAAC;IACN,GAAG,EAAE,CAAC;IACN,aAAa,EAAE,CAAC,EAAE,KAAK,EAAE,oBAAK,CAAC,QAAQ,EAAE,OAAO,EAAE,iCAAiC,EAAE,CAAC;CACvF,CAAC;AAEW,QAAA,aAAa,GAAsB;IAC9C,KAAK,EAAE,OAAO;IACd,KAAK,EAAE,OAAO;IACd,GAAG,EAAE,CAAC;IACN,KAAK,EAAE,IAAI;CACZ,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from
|
|
2
|
-
export * from
|
|
1
|
+
export * from './schemas';
|
|
2
|
+
export * from './utils';
|
|
@@ -16,37 +16,37 @@ const addressBaseSchema = (0, zod_1.object)({
|
|
|
16
16
|
gst: (0, utils_1.validateString)(constants_1.GST_OPTIONS).optional(),
|
|
17
17
|
pinCode: (0, utils_1.validateString)(constants_1.PIN_CODE_OPTIONS),
|
|
18
18
|
state: (0, utils_1.validateEnum)(constants_1.STATE_AND_UTS_OPTIONS),
|
|
19
|
-
country: (0, utils_1.validateEnum)(constants_1.COUNTRY_OPTIONS).default(
|
|
20
|
-
type: (0, utils_1.validateEnum)(constants_1.ADDRESS_TYPE_OPTIONS).default(
|
|
19
|
+
country: (0, utils_1.validateEnum)(constants_1.COUNTRY_OPTIONS).default('India'),
|
|
20
|
+
type: (0, utils_1.validateEnum)(constants_1.ADDRESS_TYPE_OPTIONS).default('both'),
|
|
21
21
|
altPhoneNumber: (0, utils_1.validateString)({
|
|
22
22
|
...constants_1.PHONE_OPTIONS,
|
|
23
|
-
field:
|
|
24
|
-
label:
|
|
23
|
+
field: 'altPhoneNumber',
|
|
24
|
+
label: 'Alternate Phone Number',
|
|
25
25
|
nonEmpty: false,
|
|
26
26
|
}).optional(),
|
|
27
|
-
isDefaultAddress: (0, zod_1.boolean)({ error:
|
|
27
|
+
isDefaultAddress: (0, zod_1.boolean)({ error: 'isDefaultAddress must be a boolean' })
|
|
28
28
|
.default(false)
|
|
29
29
|
.optional(),
|
|
30
30
|
});
|
|
31
31
|
exports.addAddressSchema = addressBaseSchema.superRefine(({ altPhoneNumber, phoneNumber }, ctx) => {
|
|
32
32
|
if (altPhoneNumber && phoneNumber === altPhoneNumber) {
|
|
33
|
-
(0, utils_1.appendCustomIssue)(ctx,
|
|
33
|
+
(0, utils_1.appendCustomIssue)(ctx, 'Alternate phone number cannot be the same as phone number', 'altPhoneNumber');
|
|
34
34
|
}
|
|
35
35
|
});
|
|
36
36
|
exports.updateAddressSchema = addressBaseSchema
|
|
37
37
|
.extend({
|
|
38
38
|
removedOptionalFields: (0, zod_1.array)((0, utils_1.validateEnum)({
|
|
39
|
-
field:
|
|
40
|
-
label:
|
|
41
|
-
parentLabel:
|
|
42
|
-
parentField:
|
|
43
|
-
enumValues: [
|
|
39
|
+
field: '[some_index]',
|
|
40
|
+
label: '[some_index]',
|
|
41
|
+
parentLabel: 'Removed Optional Fields',
|
|
42
|
+
parentField: 'removedOptionalFields',
|
|
43
|
+
enumValues: ['altPhoneNumber', 'gst', 'landmark'],
|
|
44
44
|
})),
|
|
45
45
|
})
|
|
46
46
|
.partial()
|
|
47
47
|
.superRefine(({ altPhoneNumber, phoneNumber }, ctx) => {
|
|
48
48
|
if (altPhoneNumber && phoneNumber === altPhoneNumber) {
|
|
49
|
-
(0, utils_1.appendCustomIssue)(ctx,
|
|
49
|
+
(0, utils_1.appendCustomIssue)(ctx, 'Alternate phone number cannot be the same as phone number', 'altPhoneNumber');
|
|
50
50
|
}
|
|
51
51
|
});
|
|
52
52
|
//# sourceMappingURL=address.schema.js.map
|
|
@@ -7,46 +7,46 @@ const zod_1 = require("zod");
|
|
|
7
7
|
exports.blogSchema = (0, zod_1.object)({
|
|
8
8
|
mainTitle: (0, utils_1.validateString)({
|
|
9
9
|
...constants_1.TITLE_OPTIONS,
|
|
10
|
-
field:
|
|
11
|
-
label:
|
|
10
|
+
field: 'mainTitle',
|
|
11
|
+
label: 'Main Title',
|
|
12
12
|
}),
|
|
13
13
|
subTitle: (0, utils_1.validateString)({
|
|
14
14
|
...constants_1.TITLE_OPTIONS,
|
|
15
|
-
field:
|
|
16
|
-
label:
|
|
15
|
+
field: 'subTitle',
|
|
16
|
+
label: 'Sub Title',
|
|
17
17
|
}),
|
|
18
|
-
author: (0, utils_1.validateString)({ ...constants_1.NAME_OPTIONS, field:
|
|
18
|
+
author: (0, utils_1.validateString)({ ...constants_1.NAME_OPTIONS, field: 'author', label: 'Author' }),
|
|
19
19
|
description: (0, utils_1.validateString)({
|
|
20
20
|
...constants_1.DESCRIPTION_OPTIONS,
|
|
21
|
-
allowSpace:
|
|
21
|
+
allowSpace: 'anySpace',
|
|
22
22
|
}),
|
|
23
23
|
content: (0, utils_1.validateString)({
|
|
24
|
-
field:
|
|
25
|
-
label:
|
|
24
|
+
field: 'content',
|
|
25
|
+
label: 'Content',
|
|
26
26
|
min: 10,
|
|
27
|
-
allowSpace:
|
|
27
|
+
allowSpace: 'anySpace',
|
|
28
28
|
}),
|
|
29
29
|
tags: (0, utils_1.validateArray)({
|
|
30
30
|
schema: (0, utils_1.validateString)({
|
|
31
|
-
field:
|
|
32
|
-
parentField:
|
|
33
|
-
label:
|
|
34
|
-
parentLabel:
|
|
31
|
+
field: '[some_index]',
|
|
32
|
+
parentField: 'tags',
|
|
33
|
+
label: '[some_index]',
|
|
34
|
+
parentLabel: 'Tags',
|
|
35
35
|
min: 2,
|
|
36
36
|
max: 15,
|
|
37
|
-
allowSpace:
|
|
37
|
+
allowSpace: 'singleSpace',
|
|
38
38
|
}),
|
|
39
|
-
field:
|
|
40
|
-
label:
|
|
39
|
+
field: 'tags',
|
|
40
|
+
label: 'Tags',
|
|
41
41
|
min: 1,
|
|
42
42
|
max: 5,
|
|
43
43
|
}).refine((tags) => {
|
|
44
|
-
const trimmedTags = tags.map((tag) => typeof tag ===
|
|
44
|
+
const trimmedTags = tags.map((tag) => typeof tag === 'string' && tag?.trim().toLowerCase());
|
|
45
45
|
return new Set(trimmedTags).size === trimmedTags.length;
|
|
46
46
|
}, { message: `Duplicate tags are not allowed.` }),
|
|
47
47
|
publishedDate: (0, utils_1.validateDate)({
|
|
48
|
-
field:
|
|
49
|
-
label:
|
|
48
|
+
field: 'publishedDate',
|
|
49
|
+
label: 'Published Date',
|
|
50
50
|
maxDate: new Date(),
|
|
51
51
|
}),
|
|
52
52
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"blog.schema.js","sourceRoot":"","sources":["../../src/schemas/blog.schema.ts"],"names":[],"mappings":";;;AAAA,4CAAgF;AAChF,oCAAuE;AACvE,6BAAgD;AAEnC,QAAA,UAAU,GAAG,IAAA,YAAM,EAAC;IAC/B,SAAS,EAAE,IAAA,sBAAc,EAAC;QAC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a,EAAE,IAAA,oBAAY,EAAC;QAC1B,KAAK,EAAE,eAAe;QACtB,KAAK,EAAE,gBAAgB;QACvB,OAAO,EAAE,IAAI,IAAI,EAAE;KACpB,CAAC;CACH,CAAC,CAAC"}
|
|
@@ -5,8 +5,8 @@ const utils_1 = require("../utils");
|
|
|
5
5
|
const zod_1 = require("zod");
|
|
6
6
|
exports.updateCartProductQuantitySchema = (0, zod_1.object)({
|
|
7
7
|
quantity: (0, utils_1.validateNumber)({
|
|
8
|
-
field:
|
|
9
|
-
label:
|
|
8
|
+
field: 'quantity',
|
|
9
|
+
label: 'Quantity',
|
|
10
10
|
isInt: true,
|
|
11
11
|
max: 5,
|
|
12
12
|
min: 1,
|
package/dist/schemas/index.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
export * from
|
|
2
|
-
export * from
|
|
3
|
-
export * from
|
|
4
|
-
export * from
|
|
5
|
-
export * from
|
|
6
|
-
export * from
|
|
7
|
-
export * from
|
|
1
|
+
export * from './address.schema';
|
|
2
|
+
export * from './blog.schema';
|
|
3
|
+
export * from './cart.schema';
|
|
4
|
+
export * from './mail-service';
|
|
5
|
+
export * from './media.schema';
|
|
6
|
+
export * from './product.schema';
|
|
7
|
+
export * from './review.schema';
|
|
8
|
+
export * from './user.schema';
|
package/dist/schemas/index.js
CHANGED
|
@@ -17,6 +17,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
17
17
|
__exportStar(require("./address.schema"), exports);
|
|
18
18
|
__exportStar(require("./blog.schema"), exports);
|
|
19
19
|
__exportStar(require("./cart.schema"), exports);
|
|
20
|
+
__exportStar(require("./mail-service"), exports);
|
|
20
21
|
__exportStar(require("./media.schema"), exports);
|
|
21
22
|
__exportStar(require("./product.schema"), exports);
|
|
22
23
|
__exportStar(require("./review.schema"), exports);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/schemas/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,mDAAiC;AACjC,gDAA8B;AAC9B,gDAA8B;AAC9B,iDAA+B;AAC/B,mDAAiC;AACjC,kDAAgC;AAChC,gDAA8B"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/schemas/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,mDAAiC;AACjC,gDAA8B;AAC9B,gDAA8B;AAC9B,iDAA+B;AAC/B,iDAA+B;AAC/B,mDAAiC;AACjC,kDAAgC;AAChC,gDAA8B"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { infer as zodInfer } from 'zod';
|
|
2
|
+
export declare const sendOtpMailSchema: import("zod").ZodObject<{
|
|
3
|
+
email: import("zod").ZodString;
|
|
4
|
+
otp: import("zod").ZodString;
|
|
5
|
+
}, import("zod/v4/core").$strip>;
|
|
6
|
+
export type TSendOtpMail = zodInfer<typeof sendOtpMailSchema>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.sendOtpMailSchema = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const user_schema_1 = require("../user.schema");
|
|
6
|
+
exports.sendOtpMailSchema = (0, zod_1.object)({
|
|
7
|
+
email: user_schema_1.registerEmailSchema.shape.email,
|
|
8
|
+
otp: user_schema_1.registerOtpSchema.shape.otp,
|
|
9
|
+
});
|
|
10
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/schemas/mail-service/index.ts"],"names":[],"mappings":";;;AAAA,6BAAgD;AAChD,gDAAwE;AAE3D,QAAA,iBAAiB,GAAG,IAAA,YAAM,EAAC;IACtC,KAAK,EAAE,iCAAmB,CAAC,KAAK,CAAC,KAAK;IACtC,GAAG,EAAE,+BAAiB,CAAC,KAAK,CAAC,GAAG;CACjC,CAAC,CAAC"}
|
|
@@ -6,18 +6,18 @@ const utils_1 = require("../utils");
|
|
|
6
6
|
const be_constants_1 = require("@beautinique/be-constants");
|
|
7
7
|
const zod_1 = require("zod");
|
|
8
8
|
exports.removeSingleImageSchema = (0, zod_1.object)({
|
|
9
|
-
cloudUrl: (0, utils_1.validateUrl)({ field:
|
|
9
|
+
cloudUrl: (0, utils_1.validateUrl)({ field: 'cloudUrl', label: 'Cloud URL' }),
|
|
10
10
|
cloudinaryOption: (0, utils_1.validateEnum)({
|
|
11
|
-
field:
|
|
12
|
-
label:
|
|
11
|
+
field: 'cloudinaryOption',
|
|
12
|
+
label: 'Cloudinary Option',
|
|
13
13
|
enumValues: be_constants_1.CLOUDINARY_OPTIONS,
|
|
14
14
|
}),
|
|
15
15
|
});
|
|
16
16
|
exports.removeMultipleImagesSchema = (0, zod_1.object)({
|
|
17
17
|
cloudUrls: (0, utils_1.validateArray)({
|
|
18
|
-
schema: (0, utils_1.validateUrl)({ field:
|
|
19
|
-
field:
|
|
20
|
-
label:
|
|
18
|
+
schema: (0, utils_1.validateUrl)({ field: '[some_index]', label: 'Cloud URL' }),
|
|
19
|
+
field: 'cloudUrls',
|
|
20
|
+
label: 'Cloud URLs',
|
|
21
21
|
min: 1,
|
|
22
22
|
}),
|
|
23
23
|
cloudinaryOption: exports.removeSingleImageSchema.shape.cloudinaryOption,
|
|
@@ -28,9 +28,9 @@ exports.uploadHomeVideoSchema = (0, zod_1.object)({
|
|
|
28
28
|
});
|
|
29
29
|
exports.uploadImageSchema = (0, zod_1.object)({
|
|
30
30
|
folderName: (0, utils_1.validateString)({
|
|
31
|
-
field:
|
|
32
|
-
label:
|
|
33
|
-
allowSpace:
|
|
31
|
+
field: 'folderName',
|
|
32
|
+
label: 'Folder Name',
|
|
33
|
+
allowSpace: 'singleSpace',
|
|
34
34
|
}),
|
|
35
35
|
cloudinaryOption: exports.removeSingleImageSchema.shape.cloudinaryOption,
|
|
36
36
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"media.schema.js","sourceRoot":"","sources":["../../src/schemas/media.schema.ts"],"names":[],"mappings":";;;AAAA,4CAA6C;AAC7C,
|
|
1
|
+
{"version":3,"file":"media.schema.js","sourceRoot":"","sources":["../../src/schemas/media.schema.ts"],"names":[],"mappings":";;;AAAA,4CAA6C;AAC7C,oCAAoF;AACpF,4DAA+D;AAC/D,6BAA6B;AAEhB,QAAA,uBAAuB,GAAG,IAAA,YAAM,EAAC;IAC5C,QAAQ,EAAE,IAAA,mBAAW,EAAC,EAAE,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,WAAW,EAAE,CAAC;IAChE,gBAAgB,EAAE,IAAA,oBAAY,EAAC;QAC7B,KAAK,EAAE,kBAAkB;QACzB,KAAK,EAAE,mBAAmB;QAC1B,UAAU,EAAE,iCAAkB;KAC/B,CAAC;CACH,CAAC,CAAC;AAEU,QAAA,0BAA0B,GAAG,IAAA,YAAM,EAAC;IAC/C,SAAS,EAAE,IAAA,qBAAa,EAAC;QACvB,MAAM,EAAE,IAAA,mBAAW,EAAC,EAAE,KAAK,EAAE,cAAc,EAAE,KAAK,EAAE,WAAW,EAAE,CAAC;QAClE,KAAK,EAAE,WAAW;QAClB,KAAK,EAAE,YAAY;QACnB,GAAG,EAAE,CAAC;KACP,CAAC;IACF,gBAAgB,EAAE,+BAAuB,CAAC,KAAK,CAAC,gBAAgB;CACjE,CAAC,CAAC;AAEU,QAAA,qBAAqB,GAAG,IAAA,YAAM,EAAC;IAC1C,KAAK,EAAE,IAAA,sBAAc,EAAC,yBAAa,CAAC;IACpC,gBAAgB,EAAE,+BAAuB,CAAC,KAAK,CAAC,gBAAgB;CACjE,CAAC,CAAC;AAEU,QAAA,iBAAiB,GAAG,IAAA,YAAM,EAAC;IACtC,UAAU,EAAE,IAAA,sBAAc,EAAC;QACzB,KAAK,EAAE,YAAY;QACnB,KAAK,EAAE,aAAa;QACpB,UAAU,EAAE,aAAa;KAC1B,CAAC;IACF,gBAA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