@azteam/express 1.2.293 → 1.2.295
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/package.json +2 -2
- package/lib/validate.js +0 -251
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@azteam/express",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.295",
|
|
4
4
|
"main": "./lib/index.js",
|
|
5
5
|
"module": "./src/index.js",
|
|
6
6
|
"scripts": {
|
|
7
|
-
"build": "babel src -d lib"
|
|
7
|
+
"build": "babel src --delete-dir-on-start -d lib"
|
|
8
8
|
},
|
|
9
9
|
"author": "toda <sp.azsolution.net@gmail.com>",
|
|
10
10
|
"license": "MIT",
|
package/lib/validate.js
DELETED
|
@@ -1,251 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.schemaVideo = exports.schemaVersion = exports.schemaUrl = exports.schemaString = exports.schemaSlug = exports.schemaPhoneNumber = exports.schemaPassword = exports.schemaObject = exports.schemaOTP = exports.schemaNumber = exports.schemaKey = exports.schemaJSON = exports.schemaInteger = exports.schemaImage = exports.schemaId = exports.schemaIPv4 = exports.schemaGallery = exports.schemaEnum = exports.schemaEmail = exports.schemaDate = exports.schemaBoolean = exports.schemaArray = exports.rulesSlug = exports.rulesMetadata = exports.rulesKey = exports.rulesId = void 0;
|
|
7
|
-
var schemaId = function schemaId() {
|
|
8
|
-
var optional = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
9
|
-
return {
|
|
10
|
-
type: 'string',
|
|
11
|
-
length: 24,
|
|
12
|
-
pattern: /^[A-Fa-f0-9]{24}$/,
|
|
13
|
-
optional: optional
|
|
14
|
-
};
|
|
15
|
-
};
|
|
16
|
-
exports.schemaId = schemaId;
|
|
17
|
-
var schemaEmail = function schemaEmail() {
|
|
18
|
-
var optional = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
19
|
-
return {
|
|
20
|
-
type: 'email',
|
|
21
|
-
optional: optional
|
|
22
|
-
};
|
|
23
|
-
};
|
|
24
|
-
exports.schemaEmail = schemaEmail;
|
|
25
|
-
var schemaUrl = function schemaUrl() {
|
|
26
|
-
var optional = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
27
|
-
return {
|
|
28
|
-
type: 'url',
|
|
29
|
-
optional: optional
|
|
30
|
-
};
|
|
31
|
-
};
|
|
32
|
-
exports.schemaUrl = schemaUrl;
|
|
33
|
-
var schemaBoolean = function schemaBoolean() {
|
|
34
|
-
var optional = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
35
|
-
return {
|
|
36
|
-
type: 'boolean',
|
|
37
|
-
convert: true,
|
|
38
|
-
optional: optional
|
|
39
|
-
};
|
|
40
|
-
};
|
|
41
|
-
exports.schemaBoolean = schemaBoolean;
|
|
42
|
-
var schemaDate = function schemaDate() {
|
|
43
|
-
var optional = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
44
|
-
return {
|
|
45
|
-
type: 'number',
|
|
46
|
-
convert: true,
|
|
47
|
-
integer: true,
|
|
48
|
-
optional: optional
|
|
49
|
-
};
|
|
50
|
-
};
|
|
51
|
-
exports.schemaDate = schemaDate;
|
|
52
|
-
var schemaNumber = function schemaNumber() {
|
|
53
|
-
var optional = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
54
|
-
return {
|
|
55
|
-
type: 'number',
|
|
56
|
-
convert: true,
|
|
57
|
-
optional: optional
|
|
58
|
-
};
|
|
59
|
-
};
|
|
60
|
-
exports.schemaNumber = schemaNumber;
|
|
61
|
-
var schemaInteger = function schemaInteger() {
|
|
62
|
-
var min = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
|
|
63
|
-
var max = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 999999999;
|
|
64
|
-
var optional = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
65
|
-
return {
|
|
66
|
-
type: 'number',
|
|
67
|
-
integer: true,
|
|
68
|
-
convert: true,
|
|
69
|
-
min: min,
|
|
70
|
-
max: max,
|
|
71
|
-
optional: optional
|
|
72
|
-
};
|
|
73
|
-
};
|
|
74
|
-
exports.schemaInteger = schemaInteger;
|
|
75
|
-
var schemaString = function schemaString() {
|
|
76
|
-
var min = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 1;
|
|
77
|
-
var max = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 255;
|
|
78
|
-
var optional = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
79
|
-
return {
|
|
80
|
-
type: 'string',
|
|
81
|
-
convert: true,
|
|
82
|
-
trim: true,
|
|
83
|
-
min: min,
|
|
84
|
-
max: max,
|
|
85
|
-
optional: optional
|
|
86
|
-
};
|
|
87
|
-
};
|
|
88
|
-
exports.schemaString = schemaString;
|
|
89
|
-
var schemaPassword = function schemaPassword() {
|
|
90
|
-
var optional = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
91
|
-
return {
|
|
92
|
-
type: 'string',
|
|
93
|
-
convert: true,
|
|
94
|
-
min: 6,
|
|
95
|
-
max: 32,
|
|
96
|
-
optional: optional
|
|
97
|
-
};
|
|
98
|
-
};
|
|
99
|
-
exports.schemaPassword = schemaPassword;
|
|
100
|
-
var schemaOTP = function schemaOTP() {
|
|
101
|
-
var optional = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
102
|
-
return {
|
|
103
|
-
type: 'string',
|
|
104
|
-
length: 6,
|
|
105
|
-
pattern: /\d+/,
|
|
106
|
-
optional: optional
|
|
107
|
-
};
|
|
108
|
-
};
|
|
109
|
-
exports.schemaOTP = schemaOTP;
|
|
110
|
-
var schemaIPv4 = function schemaIPv4() {
|
|
111
|
-
var optional = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
112
|
-
return {
|
|
113
|
-
type: 'string',
|
|
114
|
-
pattern: /^((25[0-5]|(2[0-4]|1\d|[1-9]|)\d)(\.(?!$)|$)){4}$/,
|
|
115
|
-
optional: optional
|
|
116
|
-
};
|
|
117
|
-
};
|
|
118
|
-
exports.schemaIPv4 = schemaIPv4;
|
|
119
|
-
var schemaImage = function schemaImage() {
|
|
120
|
-
var optional = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
121
|
-
return {
|
|
122
|
-
type: 'string',
|
|
123
|
-
max: 255,
|
|
124
|
-
optional: optional
|
|
125
|
-
};
|
|
126
|
-
};
|
|
127
|
-
exports.schemaImage = schemaImage;
|
|
128
|
-
var schemaVideo = function schemaVideo() {
|
|
129
|
-
var optional = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
130
|
-
return {
|
|
131
|
-
type: 'string',
|
|
132
|
-
max: 255,
|
|
133
|
-
optional: optional
|
|
134
|
-
};
|
|
135
|
-
};
|
|
136
|
-
exports.schemaVideo = schemaVideo;
|
|
137
|
-
var schemaPhoneNumber = function schemaPhoneNumber() {
|
|
138
|
-
var optional = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
139
|
-
return {
|
|
140
|
-
type: 'string',
|
|
141
|
-
length: 10,
|
|
142
|
-
pattern: /^((09|03|07|08|05)+([0-9]{8})\b)$/,
|
|
143
|
-
optional: optional
|
|
144
|
-
};
|
|
145
|
-
};
|
|
146
|
-
exports.schemaPhoneNumber = schemaPhoneNumber;
|
|
147
|
-
var schemaSlug = function schemaSlug() {
|
|
148
|
-
var optional = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
149
|
-
return {
|
|
150
|
-
type: 'string',
|
|
151
|
-
convert: true,
|
|
152
|
-
pattern: /[A-Za-z0-9_-]+/,
|
|
153
|
-
lowercase: true,
|
|
154
|
-
max: 300,
|
|
155
|
-
optional: optional
|
|
156
|
-
};
|
|
157
|
-
};
|
|
158
|
-
exports.schemaSlug = schemaSlug;
|
|
159
|
-
var schemaKey = function schemaKey() {
|
|
160
|
-
var optional = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
161
|
-
return {
|
|
162
|
-
type: 'string',
|
|
163
|
-
convert: true,
|
|
164
|
-
pattern: /[A-Za-z0-9_-]+/,
|
|
165
|
-
uppercase: true,
|
|
166
|
-
max: 300,
|
|
167
|
-
optional: optional
|
|
168
|
-
};
|
|
169
|
-
};
|
|
170
|
-
exports.schemaKey = schemaKey;
|
|
171
|
-
var schemaVersion = function schemaVersion() {
|
|
172
|
-
var optional = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
173
|
-
return {
|
|
174
|
-
type: 'string',
|
|
175
|
-
pattern: /^(\d+)\.(\d+)\.(\d+)$/,
|
|
176
|
-
max: 300,
|
|
177
|
-
optional: optional
|
|
178
|
-
};
|
|
179
|
-
};
|
|
180
|
-
exports.schemaVersion = schemaVersion;
|
|
181
|
-
var schemaArray = function schemaArray(items) {
|
|
182
|
-
var optional = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
183
|
-
return {
|
|
184
|
-
type: 'array',
|
|
185
|
-
items: items,
|
|
186
|
-
"default": [],
|
|
187
|
-
optional: optional
|
|
188
|
-
};
|
|
189
|
-
};
|
|
190
|
-
exports.schemaArray = schemaArray;
|
|
191
|
-
var schemaJSON = function schemaJSON() {
|
|
192
|
-
var optional = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
193
|
-
return {
|
|
194
|
-
type: 'json',
|
|
195
|
-
optional: optional
|
|
196
|
-
};
|
|
197
|
-
};
|
|
198
|
-
exports.schemaJSON = schemaJSON;
|
|
199
|
-
var schemaGallery = function schemaGallery() {
|
|
200
|
-
var optional = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
201
|
-
return {
|
|
202
|
-
type: 'array',
|
|
203
|
-
items: schemaImage(),
|
|
204
|
-
optional: optional
|
|
205
|
-
};
|
|
206
|
-
};
|
|
207
|
-
exports.schemaGallery = schemaGallery;
|
|
208
|
-
var schemaObject = function schemaObject() {
|
|
209
|
-
var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
210
|
-
var optional = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
211
|
-
return {
|
|
212
|
-
type: 'object',
|
|
213
|
-
strict: 'remove',
|
|
214
|
-
props: props,
|
|
215
|
-
optional: optional
|
|
216
|
-
};
|
|
217
|
-
};
|
|
218
|
-
exports.schemaObject = schemaObject;
|
|
219
|
-
var schemaEnum = function schemaEnum(values) {
|
|
220
|
-
var optional = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
221
|
-
return {
|
|
222
|
-
type: 'enum',
|
|
223
|
-
values: values,
|
|
224
|
-
optional: optional
|
|
225
|
-
};
|
|
226
|
-
};
|
|
227
|
-
|
|
228
|
-
/* rules */
|
|
229
|
-
exports.schemaEnum = schemaEnum;
|
|
230
|
-
var rulesId = {
|
|
231
|
-
id: schemaId()
|
|
232
|
-
};
|
|
233
|
-
exports.rulesId = rulesId;
|
|
234
|
-
var rulesSlug = {
|
|
235
|
-
slug: schemaSlug()
|
|
236
|
-
};
|
|
237
|
-
exports.rulesSlug = rulesSlug;
|
|
238
|
-
var rulesKey = {
|
|
239
|
-
key: schemaKey()
|
|
240
|
-
};
|
|
241
|
-
exports.rulesKey = rulesKey;
|
|
242
|
-
var rulesMetadata = {
|
|
243
|
-
metadata_disable: schemaBoolean(true),
|
|
244
|
-
metadata_title: schemaString(0, 255, true),
|
|
245
|
-
metadata_title_og: schemaString(0, 255, true),
|
|
246
|
-
metadata_description: schemaString(0, 255, true),
|
|
247
|
-
metadata_description_og: schemaString(0, 255, true),
|
|
248
|
-
metadata_keywords: schemaString(0, 255, true),
|
|
249
|
-
metadata_image_url: schemaImage(true)
|
|
250
|
-
};
|
|
251
|
-
exports.rulesMetadata = rulesMetadata;
|