@twin.org/core 0.0.1-next.9 → 0.0.2-next.3
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/cjs/index.cjs +1574 -833
- package/dist/esm/index.mjs +1571 -834
- package/dist/types/errors/baseError.d.ts +8 -1
- package/dist/types/factories/factory.d.ts +20 -1
- package/dist/types/helpers/arrayHelper.d.ts +13 -0
- package/dist/types/helpers/envHelper.d.ts +16 -0
- package/dist/types/helpers/errorHelper.d.ts +2 -1
- package/dist/types/helpers/jsonHelper.d.ts +30 -0
- package/dist/types/helpers/objectHelper.d.ts +25 -0
- package/dist/types/helpers/uint8ArrayHelper.d.ts +11 -0
- package/dist/types/index.d.ts +6 -0
- package/dist/types/models/IComponent.d.ts +12 -3
- package/dist/types/models/II18nShared.d.ts +29 -0
- package/dist/types/models/coerceType.d.ts +49 -0
- package/dist/types/models/compressionType.d.ts +1 -1
- package/dist/types/models/objectOrArray.d.ts +4 -0
- package/dist/types/utils/asyncCache.d.ts +10 -1
- package/dist/types/utils/coerce.d.ts +22 -0
- package/dist/types/utils/guards.d.ts +35 -0
- package/dist/types/utils/is.d.ts +12 -0
- package/dist/types/utils/sharedStore.d.ts +23 -0
- package/dist/types/utils/validation.d.ts +2 -0
- package/docs/changelog.md +323 -1
- package/docs/reference/classes/AlreadyExistsError.md +103 -27
- package/docs/reference/classes/ArrayHelper.md +71 -5
- package/docs/reference/classes/AsyncCache.md +75 -13
- package/docs/reference/classes/Base32.md +9 -5
- package/docs/reference/classes/Base58.md +9 -5
- package/docs/reference/classes/Base64.md +12 -6
- package/docs/reference/classes/Base64Url.md +9 -5
- package/docs/reference/classes/BaseError.md +101 -29
- package/docs/reference/classes/BitString.md +23 -11
- package/docs/reference/classes/Coerce.md +110 -12
- package/docs/reference/classes/Compression.md +19 -11
- package/docs/reference/classes/ConflictError.md +106 -28
- package/docs/reference/classes/Converter.md +72 -28
- package/docs/reference/classes/EnvHelper.md +45 -0
- package/docs/reference/classes/ErrorHelper.md +19 -7
- package/docs/reference/classes/Factory.md +95 -17
- package/docs/reference/classes/FilenameHelper.md +6 -4
- package/docs/reference/classes/GeneralError.md +101 -27
- package/docs/reference/classes/GuardError.md +106 -28
- package/docs/reference/classes/Guards.md +398 -80
- package/docs/reference/classes/HexHelper.md +18 -8
- package/docs/reference/classes/I18n.md +46 -20
- package/docs/reference/classes/Is.md +179 -51
- package/docs/reference/classes/JsonHelper.md +146 -10
- package/docs/reference/classes/NotFoundError.md +103 -27
- package/docs/reference/classes/NotImplementedError.md +97 -25
- package/docs/reference/classes/NotSupportedError.md +100 -26
- package/docs/reference/classes/ObjectHelper.md +197 -39
- package/docs/reference/classes/RandomHelper.md +6 -4
- package/docs/reference/classes/SharedStore.md +94 -0
- package/docs/reference/classes/StringHelper.md +54 -20
- package/docs/reference/classes/Uint8ArrayHelper.md +35 -0
- package/docs/reference/classes/UnauthorizedError.md +100 -26
- package/docs/reference/classes/UnprocessableError.md +101 -27
- package/docs/reference/classes/Url.md +37 -17
- package/docs/reference/classes/Urn.md +63 -27
- package/docs/reference/classes/Validation.md +349 -135
- package/docs/reference/classes/ValidationError.md +100 -26
- package/docs/reference/index.md +7 -0
- package/docs/reference/interfaces/IComponent.md +30 -8
- package/docs/reference/interfaces/IError.md +2 -2
- package/docs/reference/interfaces/II18nShared.md +47 -0
- package/docs/reference/interfaces/IKeyValue.md +3 -1
- package/docs/reference/interfaces/ILabelledValue.md +3 -1
- package/docs/reference/interfaces/ILocaleDictionary.md +1 -1
- package/docs/reference/interfaces/IPatchOperation.md +1 -1
- package/docs/reference/interfaces/IValidationFailure.md +1 -1
- package/docs/reference/type-aliases/CoerceType.md +5 -0
- package/docs/reference/type-aliases/CompressionType.md +1 -1
- package/docs/reference/type-aliases/ObjectOrArray.md +11 -0
- package/docs/reference/variables/CoerceType.md +67 -0
- package/docs/reference/variables/CompressionType.md +1 -1
- package/locales/en.json +14 -1
- package/package.json +7 -7
|
@@ -4,37 +4,45 @@ Class to handle validation operations.
|
|
|
4
4
|
|
|
5
5
|
## Constructors
|
|
6
6
|
|
|
7
|
-
###
|
|
7
|
+
### Constructor
|
|
8
8
|
|
|
9
|
-
> **new Validation**():
|
|
9
|
+
> **new Validation**(): `Validation`
|
|
10
10
|
|
|
11
11
|
#### Returns
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
`Validation`
|
|
14
14
|
|
|
15
15
|
## Methods
|
|
16
16
|
|
|
17
17
|
### empty()
|
|
18
18
|
|
|
19
|
-
> `static` **empty**(`property`, `value`, `failures`, `fieldNameResource
|
|
19
|
+
> `static` **empty**(`property`, `value`, `failures`, `fieldNameResource?`): value is undefined \| null
|
|
20
20
|
|
|
21
21
|
Is the property null or undefined.
|
|
22
22
|
|
|
23
23
|
#### Parameters
|
|
24
24
|
|
|
25
|
-
|
|
25
|
+
##### property
|
|
26
|
+
|
|
27
|
+
`string`
|
|
26
28
|
|
|
27
29
|
The name of the property.
|
|
28
30
|
|
|
29
|
-
|
|
31
|
+
##### value
|
|
32
|
+
|
|
33
|
+
`unknown`
|
|
30
34
|
|
|
31
35
|
The value to test.
|
|
32
36
|
|
|
33
|
-
|
|
37
|
+
##### failures
|
|
38
|
+
|
|
39
|
+
[`IValidationFailure`](../interfaces/IValidationFailure.md)[]
|
|
34
40
|
|
|
35
41
|
The list of failures to add to.
|
|
36
42
|
|
|
37
|
-
|
|
43
|
+
##### fieldNameResource?
|
|
44
|
+
|
|
45
|
+
`string`
|
|
38
46
|
|
|
39
47
|
Optional i18n resource of the field name to display in the message.
|
|
40
48
|
|
|
@@ -48,25 +56,33 @@ True if the value is a empty.
|
|
|
48
56
|
|
|
49
57
|
### notEmpty()
|
|
50
58
|
|
|
51
|
-
> `static` **notEmpty**(`property`, `value`, `failures`, `fieldNameResource
|
|
59
|
+
> `static` **notEmpty**(`property`, `value`, `failures`, `fieldNameResource?`): `boolean`
|
|
52
60
|
|
|
53
61
|
Is the property is not null or undefined.
|
|
54
62
|
|
|
55
63
|
#### Parameters
|
|
56
64
|
|
|
57
|
-
|
|
65
|
+
##### property
|
|
66
|
+
|
|
67
|
+
`string`
|
|
58
68
|
|
|
59
69
|
The name of the property.
|
|
60
70
|
|
|
61
|
-
|
|
71
|
+
##### value
|
|
72
|
+
|
|
73
|
+
`unknown`
|
|
62
74
|
|
|
63
75
|
The value to test.
|
|
64
76
|
|
|
65
|
-
|
|
77
|
+
##### failures
|
|
78
|
+
|
|
79
|
+
[`IValidationFailure`](../interfaces/IValidationFailure.md)[]
|
|
66
80
|
|
|
67
81
|
The list of failures to add to.
|
|
68
82
|
|
|
69
|
-
|
|
83
|
+
##### fieldNameResource?
|
|
84
|
+
|
|
85
|
+
`string`
|
|
70
86
|
|
|
71
87
|
Optional i18n resource of the field name to display in the message.
|
|
72
88
|
|
|
@@ -80,37 +96,55 @@ True if the value is a not empty.
|
|
|
80
96
|
|
|
81
97
|
### string()
|
|
82
98
|
|
|
83
|
-
> `static` **string**(`property`, `value`, `failures`, `fieldNameResource
|
|
99
|
+
> `static` **string**(`property`, `value`, `failures`, `fieldNameResource?`, `options?`): `value is string`
|
|
84
100
|
|
|
85
101
|
Is the property a string.
|
|
86
102
|
|
|
87
103
|
#### Parameters
|
|
88
104
|
|
|
89
|
-
|
|
105
|
+
##### property
|
|
106
|
+
|
|
107
|
+
`string`
|
|
90
108
|
|
|
91
109
|
The name of the property.
|
|
92
110
|
|
|
93
|
-
|
|
111
|
+
##### value
|
|
112
|
+
|
|
113
|
+
`unknown`
|
|
94
114
|
|
|
95
115
|
The value to test.
|
|
96
116
|
|
|
97
|
-
|
|
117
|
+
##### failures
|
|
118
|
+
|
|
119
|
+
[`IValidationFailure`](../interfaces/IValidationFailure.md)[]
|
|
98
120
|
|
|
99
121
|
The list of failures to add to.
|
|
100
122
|
|
|
101
|
-
|
|
123
|
+
##### fieldNameResource?
|
|
124
|
+
|
|
125
|
+
`string`
|
|
102
126
|
|
|
103
127
|
Optional i18n resource of the field name to display in the message.
|
|
104
128
|
|
|
105
|
-
|
|
129
|
+
##### options?
|
|
106
130
|
|
|
107
131
|
Additional options for the validation.
|
|
108
132
|
|
|
109
|
-
|
|
133
|
+
###### format?
|
|
134
|
+
|
|
135
|
+
`RegExp` \| `"base64"` \| `"base58"` \| `"hex"`
|
|
136
|
+
|
|
137
|
+
Specific format to check.
|
|
138
|
+
|
|
139
|
+
###### minLength?
|
|
140
|
+
|
|
141
|
+
`number`
|
|
110
142
|
|
|
111
143
|
The minimum length of the string.
|
|
112
144
|
|
|
113
|
-
|
|
145
|
+
###### maxLength?
|
|
146
|
+
|
|
147
|
+
`number`
|
|
114
148
|
|
|
115
149
|
The maximum length of the string.
|
|
116
150
|
|
|
@@ -124,37 +158,49 @@ True if the value is a valid string.
|
|
|
124
158
|
|
|
125
159
|
### stringValue()
|
|
126
160
|
|
|
127
|
-
> `static` **stringValue**(`property`, `value`, `failures`, `fieldNameResource
|
|
161
|
+
> `static` **stringValue**(`property`, `value`, `failures`, `fieldNameResource?`, `options?`): `value is string`
|
|
128
162
|
|
|
129
163
|
Is the property a string with a value.
|
|
130
164
|
|
|
131
165
|
#### Parameters
|
|
132
166
|
|
|
133
|
-
|
|
167
|
+
##### property
|
|
168
|
+
|
|
169
|
+
`string`
|
|
134
170
|
|
|
135
171
|
The name of the property.
|
|
136
172
|
|
|
137
|
-
|
|
173
|
+
##### value
|
|
174
|
+
|
|
175
|
+
`unknown`
|
|
138
176
|
|
|
139
177
|
The value to test.
|
|
140
178
|
|
|
141
|
-
|
|
179
|
+
##### failures
|
|
180
|
+
|
|
181
|
+
[`IValidationFailure`](../interfaces/IValidationFailure.md)[]
|
|
142
182
|
|
|
143
183
|
The list of failures to add to.
|
|
144
184
|
|
|
145
|
-
|
|
185
|
+
##### fieldNameResource?
|
|
186
|
+
|
|
187
|
+
`string`
|
|
146
188
|
|
|
147
189
|
Optional i18n resource of the field name to display in the message.
|
|
148
190
|
|
|
149
|
-
|
|
191
|
+
##### options?
|
|
150
192
|
|
|
151
193
|
Additional options for the validation.
|
|
152
194
|
|
|
153
|
-
|
|
195
|
+
###### minLength?
|
|
196
|
+
|
|
197
|
+
`number`
|
|
154
198
|
|
|
155
199
|
The minimum length of the string.
|
|
156
200
|
|
|
157
|
-
|
|
201
|
+
###### maxLength?
|
|
202
|
+
|
|
203
|
+
`number`
|
|
158
204
|
|
|
159
205
|
The maximum length of the string.
|
|
160
206
|
|
|
@@ -168,37 +214,49 @@ True if the value is a valid string.
|
|
|
168
214
|
|
|
169
215
|
### number()
|
|
170
216
|
|
|
171
|
-
> `static` **number**(`property`, `value`, `failures`, `fieldNameResource
|
|
217
|
+
> `static` **number**(`property`, `value`, `failures`, `fieldNameResource?`, `options?`): `value is number`
|
|
172
218
|
|
|
173
219
|
Is the property a number.
|
|
174
220
|
|
|
175
221
|
#### Parameters
|
|
176
222
|
|
|
177
|
-
|
|
223
|
+
##### property
|
|
224
|
+
|
|
225
|
+
`string`
|
|
178
226
|
|
|
179
227
|
The name of the property.
|
|
180
228
|
|
|
181
|
-
|
|
229
|
+
##### value
|
|
230
|
+
|
|
231
|
+
`unknown`
|
|
182
232
|
|
|
183
233
|
The value to test.
|
|
184
234
|
|
|
185
|
-
|
|
235
|
+
##### failures
|
|
236
|
+
|
|
237
|
+
[`IValidationFailure`](../interfaces/IValidationFailure.md)[]
|
|
186
238
|
|
|
187
239
|
The list of failures to add to.
|
|
188
240
|
|
|
189
|
-
|
|
241
|
+
##### fieldNameResource?
|
|
242
|
+
|
|
243
|
+
`string`
|
|
190
244
|
|
|
191
245
|
Optional i18n resource of the field name to display in the message.
|
|
192
246
|
|
|
193
|
-
|
|
247
|
+
##### options?
|
|
194
248
|
|
|
195
249
|
Additional options for the validation.
|
|
196
250
|
|
|
197
|
-
|
|
251
|
+
###### minValue?
|
|
252
|
+
|
|
253
|
+
`number`
|
|
198
254
|
|
|
199
255
|
The minimum value of the number.
|
|
200
256
|
|
|
201
|
-
|
|
257
|
+
###### maxValue?
|
|
258
|
+
|
|
259
|
+
`number`
|
|
202
260
|
|
|
203
261
|
The maximum value of the number.
|
|
204
262
|
|
|
@@ -212,37 +270,49 @@ True if the value is a valid number.
|
|
|
212
270
|
|
|
213
271
|
### integer()
|
|
214
272
|
|
|
215
|
-
> `static` **integer**(`property`, `value`, `failures`, `fieldNameResource
|
|
273
|
+
> `static` **integer**(`property`, `value`, `failures`, `fieldNameResource?`, `options?`): `value is number`
|
|
216
274
|
|
|
217
275
|
Is the property an integer.
|
|
218
276
|
|
|
219
277
|
#### Parameters
|
|
220
278
|
|
|
221
|
-
|
|
279
|
+
##### property
|
|
280
|
+
|
|
281
|
+
`string`
|
|
222
282
|
|
|
223
283
|
The name of the property.
|
|
224
284
|
|
|
225
|
-
|
|
285
|
+
##### value
|
|
286
|
+
|
|
287
|
+
`unknown`
|
|
226
288
|
|
|
227
289
|
The value to test.
|
|
228
290
|
|
|
229
|
-
|
|
291
|
+
##### failures
|
|
292
|
+
|
|
293
|
+
[`IValidationFailure`](../interfaces/IValidationFailure.md)[]
|
|
230
294
|
|
|
231
295
|
The list of failures to add to.
|
|
232
296
|
|
|
233
|
-
|
|
297
|
+
##### fieldNameResource?
|
|
298
|
+
|
|
299
|
+
`string`
|
|
234
300
|
|
|
235
301
|
Optional i18n resource of the field name to display in the message.
|
|
236
302
|
|
|
237
|
-
|
|
303
|
+
##### options?
|
|
238
304
|
|
|
239
305
|
Additional options for the validation.
|
|
240
306
|
|
|
241
|
-
|
|
307
|
+
###### minValue?
|
|
308
|
+
|
|
309
|
+
`number`
|
|
242
310
|
|
|
243
311
|
The minimum value of the integer.
|
|
244
312
|
|
|
245
|
-
|
|
313
|
+
###### maxValue?
|
|
314
|
+
|
|
315
|
+
`number`
|
|
246
316
|
|
|
247
317
|
The maximum value of the integer.
|
|
248
318
|
|
|
@@ -256,37 +326,49 @@ True if the value is a valid integer.
|
|
|
256
326
|
|
|
257
327
|
### bigint()
|
|
258
328
|
|
|
259
|
-
> `static` **bigint**(`property`, `value`, `failures`, `fieldNameResource
|
|
329
|
+
> `static` **bigint**(`property`, `value`, `failures`, `fieldNameResource?`, `options?`): `value is bigint`
|
|
260
330
|
|
|
261
331
|
Is the property a bigint.
|
|
262
332
|
|
|
263
333
|
#### Parameters
|
|
264
334
|
|
|
265
|
-
|
|
335
|
+
##### property
|
|
336
|
+
|
|
337
|
+
`string`
|
|
266
338
|
|
|
267
339
|
The name of the property.
|
|
268
340
|
|
|
269
|
-
|
|
341
|
+
##### value
|
|
342
|
+
|
|
343
|
+
`unknown`
|
|
270
344
|
|
|
271
345
|
The value to test.
|
|
272
346
|
|
|
273
|
-
|
|
347
|
+
##### failures
|
|
348
|
+
|
|
349
|
+
[`IValidationFailure`](../interfaces/IValidationFailure.md)[]
|
|
274
350
|
|
|
275
351
|
The list of failures to add to.
|
|
276
352
|
|
|
277
|
-
|
|
353
|
+
##### fieldNameResource?
|
|
354
|
+
|
|
355
|
+
`string`
|
|
278
356
|
|
|
279
357
|
Optional i18n resource of the field name to display in the message.
|
|
280
358
|
|
|
281
|
-
|
|
359
|
+
##### options?
|
|
282
360
|
|
|
283
361
|
Additional options for the validation.
|
|
284
362
|
|
|
285
|
-
|
|
363
|
+
###### minValue?
|
|
364
|
+
|
|
365
|
+
`bigint`
|
|
286
366
|
|
|
287
367
|
The minimum value of the bigint.
|
|
288
368
|
|
|
289
|
-
|
|
369
|
+
###### maxValue?
|
|
370
|
+
|
|
371
|
+
`bigint`
|
|
290
372
|
|
|
291
373
|
The maximum value of the bigint.
|
|
292
374
|
|
|
@@ -300,25 +382,33 @@ True if the value is a valid bigint.
|
|
|
300
382
|
|
|
301
383
|
### boolean()
|
|
302
384
|
|
|
303
|
-
> `static` **boolean**(`property`, `value`, `failures`, `fieldNameResource
|
|
385
|
+
> `static` **boolean**(`property`, `value`, `failures`, `fieldNameResource?`): `value is boolean`
|
|
304
386
|
|
|
305
387
|
Is the property a boolean.
|
|
306
388
|
|
|
307
389
|
#### Parameters
|
|
308
390
|
|
|
309
|
-
|
|
391
|
+
##### property
|
|
392
|
+
|
|
393
|
+
`string`
|
|
310
394
|
|
|
311
395
|
The name of the property.
|
|
312
396
|
|
|
313
|
-
|
|
397
|
+
##### value
|
|
398
|
+
|
|
399
|
+
`unknown`
|
|
314
400
|
|
|
315
401
|
The value to test.
|
|
316
402
|
|
|
317
|
-
|
|
403
|
+
##### failures
|
|
404
|
+
|
|
405
|
+
[`IValidationFailure`](../interfaces/IValidationFailure.md)[]
|
|
318
406
|
|
|
319
407
|
The list of failures to add to.
|
|
320
408
|
|
|
321
|
-
|
|
409
|
+
##### fieldNameResource?
|
|
410
|
+
|
|
411
|
+
`string`
|
|
322
412
|
|
|
323
413
|
Optional i18n resource of the field name to display in the message.
|
|
324
414
|
|
|
@@ -332,25 +422,33 @@ True if the value is a boolean.
|
|
|
332
422
|
|
|
333
423
|
### date()
|
|
334
424
|
|
|
335
|
-
> `static` **date**(`property`, `value`, `failures`, `fieldNameResource
|
|
425
|
+
> `static` **date**(`property`, `value`, `failures`, `fieldNameResource?`): `value is Date`
|
|
336
426
|
|
|
337
427
|
Is the property a date.
|
|
338
428
|
|
|
339
429
|
#### Parameters
|
|
340
430
|
|
|
341
|
-
|
|
431
|
+
##### property
|
|
432
|
+
|
|
433
|
+
`string`
|
|
342
434
|
|
|
343
435
|
The name of the property.
|
|
344
436
|
|
|
345
|
-
|
|
437
|
+
##### value
|
|
438
|
+
|
|
439
|
+
`unknown`
|
|
346
440
|
|
|
347
441
|
The value to test.
|
|
348
442
|
|
|
349
|
-
|
|
443
|
+
##### failures
|
|
444
|
+
|
|
445
|
+
[`IValidationFailure`](../interfaces/IValidationFailure.md)[]
|
|
350
446
|
|
|
351
447
|
The list of failures to add to.
|
|
352
448
|
|
|
353
|
-
|
|
449
|
+
##### fieldNameResource?
|
|
450
|
+
|
|
451
|
+
`string`
|
|
354
452
|
|
|
355
453
|
Optional i18n resource of the field name to display in the message.
|
|
356
454
|
|
|
@@ -364,25 +462,33 @@ True if the value is a date.
|
|
|
364
462
|
|
|
365
463
|
### dateString()
|
|
366
464
|
|
|
367
|
-
> `static` **dateString**(`property`, `value`, `failures`, `fieldNameResource
|
|
465
|
+
> `static` **dateString**(`property`, `value`, `failures`, `fieldNameResource?`): `value is string`
|
|
368
466
|
|
|
369
467
|
Is the property a date in ISO 8601 format.
|
|
370
468
|
|
|
371
469
|
#### Parameters
|
|
372
470
|
|
|
373
|
-
|
|
471
|
+
##### property
|
|
472
|
+
|
|
473
|
+
`string`
|
|
374
474
|
|
|
375
475
|
The name of the property.
|
|
376
476
|
|
|
377
|
-
|
|
477
|
+
##### value
|
|
478
|
+
|
|
479
|
+
`unknown`
|
|
378
480
|
|
|
379
481
|
The value to test.
|
|
380
482
|
|
|
381
|
-
|
|
483
|
+
##### failures
|
|
484
|
+
|
|
485
|
+
[`IValidationFailure`](../interfaces/IValidationFailure.md)[]
|
|
382
486
|
|
|
383
487
|
The list of failures to add to.
|
|
384
488
|
|
|
385
|
-
|
|
489
|
+
##### fieldNameResource?
|
|
490
|
+
|
|
491
|
+
`string`
|
|
386
492
|
|
|
387
493
|
Optional i18n resource of the field name to display in the message.
|
|
388
494
|
|
|
@@ -396,25 +502,33 @@ True if the value is a date.
|
|
|
396
502
|
|
|
397
503
|
### dateTimeString()
|
|
398
504
|
|
|
399
|
-
> `static` **dateTimeString**(`property`, `value`, `failures`, `fieldNameResource
|
|
505
|
+
> `static` **dateTimeString**(`property`, `value`, `failures`, `fieldNameResource?`): `value is string`
|
|
400
506
|
|
|
401
507
|
Is the property a date/time in ISO 8601 format.
|
|
402
508
|
|
|
403
509
|
#### Parameters
|
|
404
510
|
|
|
405
|
-
|
|
511
|
+
##### property
|
|
512
|
+
|
|
513
|
+
`string`
|
|
406
514
|
|
|
407
515
|
The name of the property.
|
|
408
516
|
|
|
409
|
-
|
|
517
|
+
##### value
|
|
518
|
+
|
|
519
|
+
`unknown`
|
|
410
520
|
|
|
411
521
|
The value to test.
|
|
412
522
|
|
|
413
|
-
|
|
523
|
+
##### failures
|
|
524
|
+
|
|
525
|
+
[`IValidationFailure`](../interfaces/IValidationFailure.md)[]
|
|
414
526
|
|
|
415
527
|
The list of failures to add to.
|
|
416
528
|
|
|
417
|
-
|
|
529
|
+
##### fieldNameResource?
|
|
530
|
+
|
|
531
|
+
`string`
|
|
418
532
|
|
|
419
533
|
Optional i18n resource of the field name to display in the message.
|
|
420
534
|
|
|
@@ -428,25 +542,33 @@ True if the value is a date/time.
|
|
|
428
542
|
|
|
429
543
|
### timeString()
|
|
430
544
|
|
|
431
|
-
> `static` **timeString**(`property`, `value`, `failures`, `fieldNameResource
|
|
545
|
+
> `static` **timeString**(`property`, `value`, `failures`, `fieldNameResource?`): `value is string`
|
|
432
546
|
|
|
433
547
|
Is the property a time in ISO 8601 format.
|
|
434
548
|
|
|
435
549
|
#### Parameters
|
|
436
550
|
|
|
437
|
-
|
|
551
|
+
##### property
|
|
552
|
+
|
|
553
|
+
`string`
|
|
438
554
|
|
|
439
555
|
The name of the property.
|
|
440
556
|
|
|
441
|
-
|
|
557
|
+
##### value
|
|
558
|
+
|
|
559
|
+
`unknown`
|
|
442
560
|
|
|
443
561
|
The value to test.
|
|
444
562
|
|
|
445
|
-
|
|
563
|
+
##### failures
|
|
564
|
+
|
|
565
|
+
[`IValidationFailure`](../interfaces/IValidationFailure.md)[]
|
|
446
566
|
|
|
447
567
|
The list of failures to add to.
|
|
448
568
|
|
|
449
|
-
|
|
569
|
+
##### fieldNameResource?
|
|
570
|
+
|
|
571
|
+
`string`
|
|
450
572
|
|
|
451
573
|
Optional i18n resource of the field name to display in the message.
|
|
452
574
|
|
|
@@ -460,25 +582,33 @@ True if the value is a time.
|
|
|
460
582
|
|
|
461
583
|
### timestampMilliseconds()
|
|
462
584
|
|
|
463
|
-
> `static` **timestampMilliseconds**(`property`, `value`, `failures`, `fieldNameResource
|
|
585
|
+
> `static` **timestampMilliseconds**(`property`, `value`, `failures`, `fieldNameResource?`): `value is number`
|
|
464
586
|
|
|
465
587
|
Is the property a timestamp in milliseconds.
|
|
466
588
|
|
|
467
589
|
#### Parameters
|
|
468
590
|
|
|
469
|
-
|
|
591
|
+
##### property
|
|
592
|
+
|
|
593
|
+
`string`
|
|
470
594
|
|
|
471
595
|
The name of the property.
|
|
472
596
|
|
|
473
|
-
|
|
597
|
+
##### value
|
|
598
|
+
|
|
599
|
+
`unknown`
|
|
474
600
|
|
|
475
601
|
The value to test.
|
|
476
602
|
|
|
477
|
-
|
|
603
|
+
##### failures
|
|
604
|
+
|
|
605
|
+
[`IValidationFailure`](../interfaces/IValidationFailure.md)[]
|
|
478
606
|
|
|
479
607
|
The list of failures to add to.
|
|
480
608
|
|
|
481
|
-
|
|
609
|
+
##### fieldNameResource?
|
|
610
|
+
|
|
611
|
+
`string`
|
|
482
612
|
|
|
483
613
|
Optional i18n resource of the field name to display in the message.
|
|
484
614
|
|
|
@@ -492,25 +622,33 @@ True if the value is a timestamp in milliseconds.
|
|
|
492
622
|
|
|
493
623
|
### timestampSeconds()
|
|
494
624
|
|
|
495
|
-
> `static` **timestampSeconds**(`property`, `value`, `failures`, `fieldNameResource
|
|
625
|
+
> `static` **timestampSeconds**(`property`, `value`, `failures`, `fieldNameResource?`): `value is number`
|
|
496
626
|
|
|
497
627
|
Is the property a timestamp in seconds.
|
|
498
628
|
|
|
499
629
|
#### Parameters
|
|
500
630
|
|
|
501
|
-
|
|
631
|
+
##### property
|
|
632
|
+
|
|
633
|
+
`string`
|
|
502
634
|
|
|
503
635
|
The name of the property.
|
|
504
636
|
|
|
505
|
-
|
|
637
|
+
##### value
|
|
638
|
+
|
|
639
|
+
`unknown`
|
|
506
640
|
|
|
507
641
|
The value to test.
|
|
508
642
|
|
|
509
|
-
|
|
643
|
+
##### failures
|
|
644
|
+
|
|
645
|
+
[`IValidationFailure`](../interfaces/IValidationFailure.md)[]
|
|
510
646
|
|
|
511
647
|
The list of failures to add to.
|
|
512
648
|
|
|
513
|
-
|
|
649
|
+
##### fieldNameResource?
|
|
650
|
+
|
|
651
|
+
`string`
|
|
514
652
|
|
|
515
653
|
Optional i18n resource of the field name to display in the message.
|
|
516
654
|
|
|
@@ -524,29 +662,39 @@ True if the value is a timestamp in seconds.
|
|
|
524
662
|
|
|
525
663
|
### object()
|
|
526
664
|
|
|
527
|
-
> `static` **object**\<`T`\>(`property`, `value`, `failures`, `fieldNameResource
|
|
665
|
+
> `static` **object**\<`T`\>(`property`, `value`, `failures`, `fieldNameResource?`): `value is T`
|
|
528
666
|
|
|
529
667
|
Is the property an object.
|
|
530
668
|
|
|
531
669
|
#### Type Parameters
|
|
532
670
|
|
|
533
|
-
|
|
671
|
+
##### T
|
|
672
|
+
|
|
673
|
+
`T` = \{[`id`: `string`]: `unknown`; \}
|
|
534
674
|
|
|
535
675
|
#### Parameters
|
|
536
676
|
|
|
537
|
-
|
|
677
|
+
##### property
|
|
678
|
+
|
|
679
|
+
`string`
|
|
538
680
|
|
|
539
681
|
The name of the property.
|
|
540
682
|
|
|
541
|
-
|
|
683
|
+
##### value
|
|
684
|
+
|
|
685
|
+
`unknown`
|
|
542
686
|
|
|
543
687
|
The value to test.
|
|
544
688
|
|
|
545
|
-
|
|
689
|
+
##### failures
|
|
690
|
+
|
|
691
|
+
[`IValidationFailure`](../interfaces/IValidationFailure.md)[]
|
|
546
692
|
|
|
547
693
|
The list of failures to add to.
|
|
548
694
|
|
|
549
|
-
|
|
695
|
+
##### fieldNameResource?
|
|
696
|
+
|
|
697
|
+
`string`
|
|
550
698
|
|
|
551
699
|
Optional i18n resource of the field name to display in the message.
|
|
552
700
|
|
|
@@ -560,29 +708,39 @@ True if the value is a object.
|
|
|
560
708
|
|
|
561
709
|
### array()
|
|
562
710
|
|
|
563
|
-
> `static` **array**\<`T`\>(`property`, `value`, `failures`, `fieldNameResource
|
|
711
|
+
> `static` **array**\<`T`\>(`property`, `value`, `failures`, `fieldNameResource?`): `value is T[]`
|
|
564
712
|
|
|
565
713
|
Is the property an array.
|
|
566
714
|
|
|
567
715
|
#### Type Parameters
|
|
568
716
|
|
|
569
|
-
|
|
717
|
+
##### T
|
|
718
|
+
|
|
719
|
+
`T`
|
|
570
720
|
|
|
571
721
|
#### Parameters
|
|
572
722
|
|
|
573
|
-
|
|
723
|
+
##### property
|
|
724
|
+
|
|
725
|
+
`string`
|
|
574
726
|
|
|
575
727
|
The name of the property.
|
|
576
728
|
|
|
577
|
-
|
|
729
|
+
##### value
|
|
730
|
+
|
|
731
|
+
`unknown`
|
|
578
732
|
|
|
579
733
|
The value to test.
|
|
580
734
|
|
|
581
|
-
|
|
735
|
+
##### failures
|
|
736
|
+
|
|
737
|
+
[`IValidationFailure`](../interfaces/IValidationFailure.md)[]
|
|
582
738
|
|
|
583
739
|
The list of failures to add to.
|
|
584
740
|
|
|
585
|
-
|
|
741
|
+
##### fieldNameResource?
|
|
742
|
+
|
|
743
|
+
`string`
|
|
586
744
|
|
|
587
745
|
Optional i18n resource of the field name to display in the message.
|
|
588
746
|
|
|
@@ -596,29 +754,39 @@ True if the value is an array.
|
|
|
596
754
|
|
|
597
755
|
### arrayValue()
|
|
598
756
|
|
|
599
|
-
> `static` **arrayValue**\<`T`\>(`property`, `value`, `failures`, `fieldNameResource
|
|
757
|
+
> `static` **arrayValue**\<`T`\>(`property`, `value`, `failures`, `fieldNameResource?`): `value is T[]`
|
|
600
758
|
|
|
601
759
|
Is the property an array with at least one item.
|
|
602
760
|
|
|
603
761
|
#### Type Parameters
|
|
604
762
|
|
|
605
|
-
|
|
763
|
+
##### T
|
|
764
|
+
|
|
765
|
+
`T`
|
|
606
766
|
|
|
607
767
|
#### Parameters
|
|
608
768
|
|
|
609
|
-
|
|
769
|
+
##### property
|
|
770
|
+
|
|
771
|
+
`string`
|
|
610
772
|
|
|
611
773
|
The name of the property.
|
|
612
774
|
|
|
613
|
-
|
|
775
|
+
##### value
|
|
776
|
+
|
|
777
|
+
`unknown`
|
|
614
778
|
|
|
615
779
|
The value to test.
|
|
616
780
|
|
|
617
|
-
|
|
781
|
+
##### failures
|
|
782
|
+
|
|
783
|
+
[`IValidationFailure`](../interfaces/IValidationFailure.md)[]
|
|
618
784
|
|
|
619
785
|
The list of failures to add to.
|
|
620
786
|
|
|
621
|
-
|
|
787
|
+
##### fieldNameResource?
|
|
788
|
+
|
|
789
|
+
`string`
|
|
622
790
|
|
|
623
791
|
Optional i18n resource of the field name to display in the message.
|
|
624
792
|
|
|
@@ -632,33 +800,45 @@ True if the value is an array with at least one element.
|
|
|
632
800
|
|
|
633
801
|
### arrayOneOf()
|
|
634
802
|
|
|
635
|
-
> `static` **arrayOneOf**\<`T`\>(`property`, `value`, `options`, `failures`, `fieldNameResource
|
|
803
|
+
> `static` **arrayOneOf**\<`T`\>(`property`, `value`, `options`, `failures`, `fieldNameResource?`): `value is T`
|
|
636
804
|
|
|
637
805
|
Is the property one of a list of items.
|
|
638
806
|
|
|
639
807
|
#### Type Parameters
|
|
640
808
|
|
|
641
|
-
|
|
809
|
+
##### T
|
|
810
|
+
|
|
811
|
+
`T`
|
|
642
812
|
|
|
643
813
|
#### Parameters
|
|
644
814
|
|
|
645
|
-
|
|
815
|
+
##### property
|
|
816
|
+
|
|
817
|
+
`string`
|
|
646
818
|
|
|
647
819
|
The name of the property.
|
|
648
820
|
|
|
649
|
-
|
|
821
|
+
##### value
|
|
822
|
+
|
|
823
|
+
`T`
|
|
650
824
|
|
|
651
825
|
The value to test.
|
|
652
826
|
|
|
653
|
-
|
|
827
|
+
##### options
|
|
828
|
+
|
|
829
|
+
`T`[]
|
|
654
830
|
|
|
655
831
|
The options the value must be one of.
|
|
656
832
|
|
|
657
|
-
|
|
833
|
+
##### failures
|
|
834
|
+
|
|
835
|
+
[`IValidationFailure`](../interfaces/IValidationFailure.md)[]
|
|
658
836
|
|
|
659
837
|
The list of failures to add to.
|
|
660
838
|
|
|
661
|
-
|
|
839
|
+
##### fieldNameResource?
|
|
840
|
+
|
|
841
|
+
`string`
|
|
662
842
|
|
|
663
843
|
Optional i18n resource of the field name to display in the message.
|
|
664
844
|
|
|
@@ -672,31 +852,39 @@ True if the value is one of the items in the options.
|
|
|
672
852
|
|
|
673
853
|
### uint8Array()
|
|
674
854
|
|
|
675
|
-
> `static` **uint8Array**(`property`, `value`, `failures`, `fieldNameResource
|
|
855
|
+
> `static` **uint8Array**(`property`, `value`, `failures`, `fieldNameResource?`): `value is Uint8Array<ArrayBufferLike>`
|
|
676
856
|
|
|
677
857
|
Is the property a Uint8Array.
|
|
678
858
|
|
|
679
859
|
#### Parameters
|
|
680
860
|
|
|
681
|
-
|
|
861
|
+
##### property
|
|
862
|
+
|
|
863
|
+
`string`
|
|
682
864
|
|
|
683
865
|
The name of the property.
|
|
684
866
|
|
|
685
|
-
|
|
867
|
+
##### value
|
|
868
|
+
|
|
869
|
+
`unknown`
|
|
686
870
|
|
|
687
871
|
The value to test.
|
|
688
872
|
|
|
689
|
-
|
|
873
|
+
##### failures
|
|
874
|
+
|
|
875
|
+
[`IValidationFailure`](../interfaces/IValidationFailure.md)[]
|
|
690
876
|
|
|
691
877
|
The list of failures to add to.
|
|
692
878
|
|
|
693
|
-
|
|
879
|
+
##### fieldNameResource?
|
|
880
|
+
|
|
881
|
+
`string`
|
|
694
882
|
|
|
695
883
|
Optional i18n resource of the field name to display in the message.
|
|
696
884
|
|
|
697
885
|
#### Returns
|
|
698
886
|
|
|
699
|
-
`value is Uint8Array
|
|
887
|
+
`value is Uint8Array<ArrayBufferLike>`
|
|
700
888
|
|
|
701
889
|
True if the value is a Uint8Array.
|
|
702
890
|
|
|
@@ -704,25 +892,33 @@ True if the value is a Uint8Array.
|
|
|
704
892
|
|
|
705
893
|
### json()
|
|
706
894
|
|
|
707
|
-
> `static` **json**(`property`, `value`, `failures`, `fieldNameResource
|
|
895
|
+
> `static` **json**(`property`, `value`, `failures`, `fieldNameResource?`): `value is string`
|
|
708
896
|
|
|
709
897
|
Is the property valid JSON.
|
|
710
898
|
|
|
711
899
|
#### Parameters
|
|
712
900
|
|
|
713
|
-
|
|
901
|
+
##### property
|
|
902
|
+
|
|
903
|
+
`string`
|
|
714
904
|
|
|
715
905
|
The name of the property.
|
|
716
906
|
|
|
717
|
-
|
|
907
|
+
##### value
|
|
908
|
+
|
|
909
|
+
`unknown`
|
|
718
910
|
|
|
719
911
|
The value to test.
|
|
720
912
|
|
|
721
|
-
|
|
913
|
+
##### failures
|
|
914
|
+
|
|
915
|
+
[`IValidationFailure`](../interfaces/IValidationFailure.md)[]
|
|
722
916
|
|
|
723
917
|
The list of failures to add to.
|
|
724
918
|
|
|
725
|
-
|
|
919
|
+
##### fieldNameResource?
|
|
920
|
+
|
|
921
|
+
`string`
|
|
726
922
|
|
|
727
923
|
Optional i18n resource of the field name to display in the message.
|
|
728
924
|
|
|
@@ -736,25 +932,33 @@ True if the value is valid JSON.
|
|
|
736
932
|
|
|
737
933
|
### email()
|
|
738
934
|
|
|
739
|
-
> `static` **email**(`property`, `value`, `failures`, `fieldNameResource
|
|
935
|
+
> `static` **email**(`property`, `value`, `failures`, `fieldNameResource?`): `value is string`
|
|
740
936
|
|
|
741
937
|
Is the property a string in e-mail format.
|
|
742
938
|
|
|
743
939
|
#### Parameters
|
|
744
940
|
|
|
745
|
-
|
|
941
|
+
##### property
|
|
942
|
+
|
|
943
|
+
`string`
|
|
746
944
|
|
|
747
945
|
The name of the property.
|
|
748
946
|
|
|
749
|
-
|
|
947
|
+
##### value
|
|
948
|
+
|
|
949
|
+
`unknown`
|
|
750
950
|
|
|
751
951
|
The value to test.
|
|
752
952
|
|
|
753
|
-
|
|
953
|
+
##### failures
|
|
954
|
+
|
|
955
|
+
[`IValidationFailure`](../interfaces/IValidationFailure.md)[]
|
|
754
956
|
|
|
755
957
|
The list of failures to add to.
|
|
756
958
|
|
|
757
|
-
|
|
959
|
+
##### fieldNameResource?
|
|
960
|
+
|
|
961
|
+
`string`
|
|
758
962
|
|
|
759
963
|
Optional i18n resource of the field name to display in the message.
|
|
760
964
|
|
|
@@ -774,15 +978,21 @@ Throw the validation failures as a ValidationError.
|
|
|
774
978
|
|
|
775
979
|
#### Parameters
|
|
776
980
|
|
|
777
|
-
|
|
981
|
+
##### source
|
|
982
|
+
|
|
983
|
+
`string`
|
|
778
984
|
|
|
779
985
|
The source of the error.
|
|
780
986
|
|
|
781
|
-
|
|
987
|
+
##### objectName
|
|
988
|
+
|
|
989
|
+
`string`
|
|
782
990
|
|
|
783
991
|
The object that was being validated.
|
|
784
992
|
|
|
785
|
-
|
|
993
|
+
##### failures
|
|
994
|
+
|
|
995
|
+
[`IValidationFailure`](../interfaces/IValidationFailure.md)[]
|
|
786
996
|
|
|
787
997
|
The validation failures.
|
|
788
998
|
|
|
@@ -804,15 +1014,19 @@ Map a list of failures to their properties in a map.
|
|
|
804
1014
|
|
|
805
1015
|
#### Parameters
|
|
806
1016
|
|
|
807
|
-
|
|
1017
|
+
##### failures
|
|
1018
|
+
|
|
1019
|
+
[`IValidationFailure`](../interfaces/IValidationFailure.md)[]
|
|
808
1020
|
|
|
809
1021
|
The validation failures to combine into the map for the properties.
|
|
810
1022
|
|
|
811
|
-
|
|
1023
|
+
##### propertyMap
|
|
812
1024
|
|
|
813
1025
|
The map to add the failures to.
|
|
814
1026
|
|
|
815
|
-
|
|
1027
|
+
##### clearMap
|
|
1028
|
+
|
|
1029
|
+
`boolean` = `true`
|
|
816
1030
|
|
|
817
1031
|
Should the map be cleared before adding the failures.
|
|
818
1032
|
|