@naturalcycles/nodejs-lib 12.103.0 → 12.103.1
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.
|
@@ -17,19 +17,19 @@ export declare const dateObjectSchema: ObjectSchema<any>;
|
|
|
17
17
|
/**
|
|
18
18
|
* Allows all values of a String Enum.
|
|
19
19
|
*/
|
|
20
|
-
export declare const
|
|
20
|
+
export declare const stringEnumValueSchema: <ENUM extends StringEnum>(en: ENUM) => StringSchema<ENUM[keyof ENUM]>;
|
|
21
21
|
/**
|
|
22
22
|
* Allows all keys of a String Enum.
|
|
23
23
|
*/
|
|
24
|
-
export declare const
|
|
24
|
+
export declare const stringEnumKeySchema: <ENUM extends StringEnum>(en: ENUM) => StringSchema;
|
|
25
25
|
/**
|
|
26
26
|
* Allows all values of a String Enum.
|
|
27
27
|
*/
|
|
28
|
-
export declare const
|
|
28
|
+
export declare const numberEnumValueSchema: <ENUM extends NumberEnum>(en: ENUM) => NumberSchema<ENUM[keyof ENUM]>;
|
|
29
29
|
/**
|
|
30
30
|
* Allows all keys of a Number Enum.
|
|
31
31
|
*/
|
|
32
|
-
export declare const
|
|
32
|
+
export declare const numberEnumKeySchema: <ENUM extends NumberEnum>(en: ENUM) => StringSchema;
|
|
33
33
|
export declare const urlSchema: (scheme?: string | string[]) => StringSchema;
|
|
34
34
|
export declare function arraySchema<T>(items?: AnySchema<T>): ArraySchema<T[]>;
|
|
35
35
|
export declare function objectSchema<T>(schema?: {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.savedDBEntitySchema = exports.baseDBEntitySchema = exports.ipAddressSchema = exports.utcOffsetSchema = exports.userAgentSchema = exports.semVerSchema = exports.SEM_VER_REGEX = exports.emailSchema = exports.verSchema = exports.unixTimestampMillis2000Schema = exports.unixTimestampMillisSchema = exports.unixTimestamp2000Schema = exports.unixTimestampSchema = exports.slugSchema = exports.SLUG_REGEX = exports.idBase64UrlSchema = exports.idBase64Schema = exports.idBase62Schema = exports.idSchema = exports.jwtSchema = exports.JWT_REGEX = exports.base64UrlSchema = exports.base64Schema = exports.base62Schema = exports.BASE64URL_REGEX = exports.BASE64_REGEX = exports.BASE62_REGEX = exports.anyObjectSchema = exports.anySchema = exports.oneOfSchema = exports.objectSchema = exports.arraySchema = exports.urlSchema = exports.
|
|
3
|
+
exports.savedDBEntitySchema = exports.baseDBEntitySchema = exports.ipAddressSchema = exports.utcOffsetSchema = exports.userAgentSchema = exports.semVerSchema = exports.SEM_VER_REGEX = exports.emailSchema = exports.verSchema = exports.unixTimestampMillis2000Schema = exports.unixTimestampMillisSchema = exports.unixTimestamp2000Schema = exports.unixTimestampSchema = exports.slugSchema = exports.SLUG_REGEX = exports.idBase64UrlSchema = exports.idBase64Schema = exports.idBase62Schema = exports.idSchema = exports.jwtSchema = exports.JWT_REGEX = exports.base64UrlSchema = exports.base64Schema = exports.base62Schema = exports.BASE64URL_REGEX = exports.BASE64_REGEX = exports.BASE62_REGEX = exports.anyObjectSchema = exports.anySchema = exports.oneOfSchema = exports.objectSchema = exports.arraySchema = exports.urlSchema = exports.numberEnumKeySchema = exports.numberEnumValueSchema = exports.stringEnumKeySchema = exports.stringEnumValueSchema = exports.dateObjectSchema = exports.binarySchema = exports.dateStringSchema = exports.percentageSchema = exports.integerSchema = exports.numberSchemaTyped = exports.numberSchema = exports.stringSchemaTyped = exports.stringSchema = exports.booleanDefaultToFalseSchema = exports.booleanSchema = void 0;
|
|
4
4
|
const js_lib_1 = require("@naturalcycles/js-lib");
|
|
5
5
|
const joi_extensions_1 = require("./joi.extensions");
|
|
6
6
|
exports.booleanSchema = joi_extensions_1.Joi.boolean();
|
|
@@ -19,23 +19,23 @@ exports.dateObjectSchema = joi_extensions_1.Joi.object().instance(Date);
|
|
|
19
19
|
/**
|
|
20
20
|
* Allows all values of a String Enum.
|
|
21
21
|
*/
|
|
22
|
-
const
|
|
23
|
-
exports.
|
|
22
|
+
const stringEnumValueSchema = (en) => joi_extensions_1.Joi.string().allow(...(0, js_lib_1._stringEnumValues)(en));
|
|
23
|
+
exports.stringEnumValueSchema = stringEnumValueSchema;
|
|
24
24
|
/**
|
|
25
25
|
* Allows all keys of a String Enum.
|
|
26
26
|
*/
|
|
27
|
-
const
|
|
28
|
-
exports.
|
|
27
|
+
const stringEnumKeySchema = (en) => joi_extensions_1.Joi.string().allow(...(0, js_lib_1._stringEnumKeys)(en));
|
|
28
|
+
exports.stringEnumKeySchema = stringEnumKeySchema;
|
|
29
29
|
/**
|
|
30
30
|
* Allows all values of a String Enum.
|
|
31
31
|
*/
|
|
32
|
-
const
|
|
33
|
-
exports.
|
|
32
|
+
const numberEnumValueSchema = (en) => joi_extensions_1.Joi.number().allow(...(0, js_lib_1._numberEnumValues)(en));
|
|
33
|
+
exports.numberEnumValueSchema = numberEnumValueSchema;
|
|
34
34
|
/**
|
|
35
35
|
* Allows all keys of a Number Enum.
|
|
36
36
|
*/
|
|
37
|
-
const
|
|
38
|
-
exports.
|
|
37
|
+
const numberEnumKeySchema = (en) => joi_extensions_1.Joi.string().allow(...(0, js_lib_1._numberEnumKeys)(en));
|
|
38
|
+
exports.numberEnumKeySchema = numberEnumKeySchema;
|
|
39
39
|
const urlSchema = (scheme = 'https') => joi_extensions_1.Joi.string().uri({ scheme });
|
|
40
40
|
exports.urlSchema = urlSchema;
|
|
41
41
|
function arraySchema(items) {
|
package/package.json
CHANGED
|
@@ -28,27 +28,27 @@ export const dateObjectSchema = Joi.object().instance(Date)
|
|
|
28
28
|
/**
|
|
29
29
|
* Allows all values of a String Enum.
|
|
30
30
|
*/
|
|
31
|
-
export const
|
|
31
|
+
export const stringEnumValueSchema = <ENUM extends StringEnum>(
|
|
32
32
|
en: ENUM,
|
|
33
33
|
): StringSchema<ENUM[keyof ENUM]> => Joi.string<ENUM[keyof ENUM]>().allow(..._stringEnumValues(en))
|
|
34
34
|
|
|
35
35
|
/**
|
|
36
36
|
* Allows all keys of a String Enum.
|
|
37
37
|
*/
|
|
38
|
-
export const
|
|
38
|
+
export const stringEnumKeySchema = <ENUM extends StringEnum>(en: ENUM): StringSchema =>
|
|
39
39
|
Joi.string().allow(..._stringEnumKeys(en))
|
|
40
40
|
|
|
41
41
|
/**
|
|
42
42
|
* Allows all values of a String Enum.
|
|
43
43
|
*/
|
|
44
|
-
export const
|
|
44
|
+
export const numberEnumValueSchema = <ENUM extends NumberEnum>(
|
|
45
45
|
en: ENUM,
|
|
46
46
|
): NumberSchema<ENUM[keyof ENUM]> => Joi.number<ENUM[keyof ENUM]>().allow(..._numberEnumValues(en))
|
|
47
47
|
|
|
48
48
|
/**
|
|
49
49
|
* Allows all keys of a Number Enum.
|
|
50
50
|
*/
|
|
51
|
-
export const
|
|
51
|
+
export const numberEnumKeySchema = <ENUM extends NumberEnum>(en: ENUM): StringSchema =>
|
|
52
52
|
Joi.string().allow(..._numberEnumKeys(en))
|
|
53
53
|
|
|
54
54
|
export const urlSchema = (scheme: string | string[] = 'https'): StringSchema =>
|