@achs/env 4.0.0 → 4.1.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.
- package/arguments.d.ts +25 -25
- package/arguments.js +125 -125
- package/commands/env.command.d.ts +7 -7
- package/commands/env.command.js +78 -78
- package/commands/export.command.d.ts +7 -7
- package/commands/export.command.js +53 -53
- package/commands/index.d.ts +5 -5
- package/commands/index.js +13 -13
- package/commands/pull.command.d.ts +6 -6
- package/commands/pull.command.js +38 -38
- package/commands/push.command.d.ts +6 -6
- package/commands/push.command.js +37 -37
- package/commands/schema.command.d.ts +3 -3
- package/commands/schema.command.js +18 -18
- package/exec.d.ts +2 -2
- package/exec.js +145 -146
- package/exec.js.map +1 -1
- package/index.d.ts +3 -3
- package/index.js +19 -19
- package/interfaces/index.d.ts +1 -1
- package/interfaces/index.js +17 -17
- package/interfaces/loader.interface.d.ts +20 -20
- package/interfaces/loader.interface.js +2 -2
- package/main.d.ts +2 -2
- package/main.js +5 -5
- package/package.json +12 -13
- package/providers/app-settings.provider.d.ts +7 -7
- package/providers/app-settings.provider.d.ts.map +1 -1
- package/providers/app-settings.provider.js +51 -47
- package/providers/app-settings.provider.js.map +1 -1
- package/providers/azure-key-vault.provider.d.ts +19 -19
- package/providers/azure-key-vault.provider.js +148 -148
- package/providers/index.d.ts +6 -6
- package/providers/index.js +29 -29
- package/providers/local.provider.d.ts +7 -7
- package/providers/local.provider.js +41 -41
- package/providers/package-json.provider.d.ts +7 -7
- package/providers/package-json.provider.js +29 -29
- package/tsconfig.build.tsbuildinfo +1 -1
- package/utils/command.util.d.ts +12 -12
- package/utils/command.util.js +134 -135
- package/utils/command.util.js.map +1 -1
- package/utils/index.d.ts +6 -6
- package/utils/index.js +22 -22
- package/utils/interpolate.util.d.ts +3 -3
- package/utils/interpolate.util.js +32 -32
- package/utils/json.util.d.ts +4 -4
- package/utils/json.util.js +47 -47
- package/utils/logger.d.ts +2 -2
- package/utils/logger.js +17 -17
- package/utils/normalize.util.d.ts +2 -2
- package/utils/normalize.util.js +60 -60
- package/utils/schema.util.d.ts +10 -10
- package/utils/schema.util.js +99 -99
package/utils/normalize.util.js
CHANGED
|
@@ -1,61 +1,61 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.normalize = exports.flatten = void 0;
|
|
4
|
-
function flatten(obj, nestingDelimiter = '__', pkey = '') {
|
|
5
|
-
const flattened = {};
|
|
6
|
-
for (let key in obj) {
|
|
7
|
-
const value = obj[key];
|
|
8
|
-
const type = typeof value;
|
|
9
|
-
if (value === undefined || type === 'function')
|
|
10
|
-
continue;
|
|
11
|
-
if (key[0] === '#')
|
|
12
|
-
continue;
|
|
13
|
-
key = pkey + key;
|
|
14
|
-
if (value === null || type !== 'object' || Array.isArray(value)) {
|
|
15
|
-
flattened[key] = value;
|
|
16
|
-
continue;
|
|
17
|
-
}
|
|
18
|
-
Object.assign(flattened, flatten(value, nestingDelimiter, `${key}${nestingDelimiter}`));
|
|
19
|
-
}
|
|
20
|
-
return flattened;
|
|
21
|
-
}
|
|
22
|
-
exports.flatten = flatten;
|
|
23
|
-
function normalize(obj, nestingDelimiter = '__', arrayDescomposition = false, pkey = '') {
|
|
24
|
-
const flattened = {};
|
|
25
|
-
for (let key in obj) {
|
|
26
|
-
const value = obj[key];
|
|
27
|
-
const type = typeof value;
|
|
28
|
-
if (value === null || value === undefined || type === 'function')
|
|
29
|
-
continue;
|
|
30
|
-
key = pkey + key.replace('$', '');
|
|
31
|
-
if (type !== 'object') {
|
|
32
|
-
flattened[key] = value;
|
|
33
|
-
continue;
|
|
34
|
-
}
|
|
35
|
-
if (Array.isArray(value)) {
|
|
36
|
-
normalizeArray(flattened, key, value, nestingDelimiter, arrayDescomposition);
|
|
37
|
-
}
|
|
38
|
-
else {
|
|
39
|
-
Object.assign(flattened, normalize(value, nestingDelimiter, arrayDescomposition, `${key}${nestingDelimiter}`));
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
return flattened;
|
|
43
|
-
}
|
|
44
|
-
exports.normalize = normalize;
|
|
45
|
-
function normalizeArray(flattened, key, value, nestingDelimiter = '__', arrayDescomposition = false) {
|
|
46
|
-
if (arrayDescomposition) {
|
|
47
|
-
key = `${key}${nestingDelimiter}`;
|
|
48
|
-
for (let i = 0; i < value.length; i++) {
|
|
49
|
-
if (typeof value[i] === 'object') {
|
|
50
|
-
Object.assign(flattened, normalize(value[i], nestingDelimiter, arrayDescomposition, `${key}${i}${nestingDelimiter}`));
|
|
51
|
-
}
|
|
52
|
-
else {
|
|
53
|
-
flattened[`${key}${i}`] = value[i];
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
else {
|
|
58
|
-
flattened[key] = value.filter((v) => typeof v !== 'object').join(',');
|
|
59
|
-
}
|
|
60
|
-
}
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.normalize = exports.flatten = void 0;
|
|
4
|
+
function flatten(obj, nestingDelimiter = '__', pkey = '') {
|
|
5
|
+
const flattened = {};
|
|
6
|
+
for (let key in obj) {
|
|
7
|
+
const value = obj[key];
|
|
8
|
+
const type = typeof value;
|
|
9
|
+
if (value === undefined || type === 'function')
|
|
10
|
+
continue;
|
|
11
|
+
if (key[0] === '#')
|
|
12
|
+
continue;
|
|
13
|
+
key = pkey + key;
|
|
14
|
+
if (value === null || type !== 'object' || Array.isArray(value)) {
|
|
15
|
+
flattened[key] = value;
|
|
16
|
+
continue;
|
|
17
|
+
}
|
|
18
|
+
Object.assign(flattened, flatten(value, nestingDelimiter, `${key}${nestingDelimiter}`));
|
|
19
|
+
}
|
|
20
|
+
return flattened;
|
|
21
|
+
}
|
|
22
|
+
exports.flatten = flatten;
|
|
23
|
+
function normalize(obj, nestingDelimiter = '__', arrayDescomposition = false, pkey = '') {
|
|
24
|
+
const flattened = {};
|
|
25
|
+
for (let key in obj) {
|
|
26
|
+
const value = obj[key];
|
|
27
|
+
const type = typeof value;
|
|
28
|
+
if (value === null || value === undefined || type === 'function')
|
|
29
|
+
continue;
|
|
30
|
+
key = pkey + key.replace('$', '');
|
|
31
|
+
if (type !== 'object') {
|
|
32
|
+
flattened[key] = value;
|
|
33
|
+
continue;
|
|
34
|
+
}
|
|
35
|
+
if (Array.isArray(value)) {
|
|
36
|
+
normalizeArray(flattened, key, value, nestingDelimiter, arrayDescomposition);
|
|
37
|
+
}
|
|
38
|
+
else {
|
|
39
|
+
Object.assign(flattened, normalize(value, nestingDelimiter, arrayDescomposition, `${key}${nestingDelimiter}`));
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
return flattened;
|
|
43
|
+
}
|
|
44
|
+
exports.normalize = normalize;
|
|
45
|
+
function normalizeArray(flattened, key, value, nestingDelimiter = '__', arrayDescomposition = false) {
|
|
46
|
+
if (arrayDescomposition) {
|
|
47
|
+
key = `${key}${nestingDelimiter}`;
|
|
48
|
+
for (let i = 0; i < value.length; i++) {
|
|
49
|
+
if (typeof value[i] === 'object') {
|
|
50
|
+
Object.assign(flattened, normalize(value[i], nestingDelimiter, arrayDescomposition, `${key}${i}${nestingDelimiter}`));
|
|
51
|
+
}
|
|
52
|
+
else {
|
|
53
|
+
flattened[`${key}${i}`] = value[i];
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
else {
|
|
58
|
+
flattened[key] = value.filter((v) => typeof v !== 'object').join(',');
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
61
|
//# sourceMappingURL=normalize.util.js.map
|
package/utils/schema.util.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { JSONSchemaType, ValidateFunction } from 'ajv';
|
|
2
|
-
import { Options } from 'to-json-schema';
|
|
3
|
-
export declare function schemaFrom(json: Record<string, unknown>, options?: Options & {
|
|
4
|
-
nullable?: boolean;
|
|
5
|
-
}): Record<string, unknown>;
|
|
6
|
-
export declare function isJsonSchemaObject(schema: Record<string, unknown>): schema is JSONSchemaType<object>;
|
|
7
|
-
export declare function schemaToJson(schema: Record<string, unknown>, container?: Record<string, any>): unknown;
|
|
8
|
-
export declare function flatSchema(schema: Record<string, unknown>, parentKey?: string, nestingDelimiter?: string, container?: Record<string, any>): Record<string, unknown>;
|
|
9
|
-
export declare function createValidator(schema: Record<string, unknown>, enableFormats?: boolean): ValidateFunction;
|
|
10
|
-
export declare function createValidators(schemaLookup: Record<string, object>, enableFormats?: boolean): Record<string, ValidateFunction>;
|
|
1
|
+
import { JSONSchemaType, ValidateFunction } from 'ajv';
|
|
2
|
+
import { Options } from 'to-json-schema';
|
|
3
|
+
export declare function schemaFrom(json: Record<string, unknown>, options?: Options & {
|
|
4
|
+
nullable?: boolean;
|
|
5
|
+
}): Record<string, unknown>;
|
|
6
|
+
export declare function isJsonSchemaObject(schema: Record<string, unknown>): schema is JSONSchemaType<object>;
|
|
7
|
+
export declare function schemaToJson(schema: Record<string, unknown>, container?: Record<string, any>): unknown;
|
|
8
|
+
export declare function flatSchema(schema: Record<string, unknown>, parentKey?: string, nestingDelimiter?: string, container?: Record<string, any>): Record<string, unknown>;
|
|
9
|
+
export declare function createValidator(schema: Record<string, unknown>, enableFormats?: boolean): ValidateFunction;
|
|
10
|
+
export declare function createValidators(schemaLookup: Record<string, object>, enableFormats?: boolean): Record<string, ValidateFunction>;
|
|
11
11
|
//# sourceMappingURL=schema.util.d.ts.map
|
package/utils/schema.util.js
CHANGED
|
@@ -1,100 +1,100 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.createValidators = exports.createValidator = exports.flatSchema = exports.schemaToJson = exports.isJsonSchemaObject = exports.schemaFrom = void 0;
|
|
7
|
-
const ajv_1 = __importDefault(require("ajv"));
|
|
8
|
-
const ajv_formats_1 = __importDefault(require("ajv-formats"));
|
|
9
|
-
const to_json_schema_1 = __importDefault(require("to-json-schema"));
|
|
10
|
-
const FORMAT_REGEXPS = {
|
|
11
|
-
'ip-address': /^(?:(?:25[0-5]|2[0-4]\d|[01]?\d{1,2})\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d{1,2})$/,
|
|
12
|
-
color: /^(#?([\dA-Fa-f]{3}){1,2}\b|aqua|black|blue|fuchsia|gray|green|lime|maroon|navy|olive|orange|purple|red|silver|teal|white|yellow|(rgb\(\s*\b(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\b\s*,\s*\b(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\b\s*,\s*\b(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\b\s*\))|(rgb\(\s*(\d?\d%|100%)+\s*,\s*(\d?\d%|100%)+\s*,\s*(\d?\d%|100%)+\s*\)))$/,
|
|
13
|
-
hostname: /^(?=.{1,255}$)[\dA-Za-z](?:(?:[\dA-Za-z]|-){0,61}[\dA-Za-z])?(?:\.[\dA-Za-z](?:(?:[\dA-Za-z]|-){0,61}[\dA-Za-z])?)*\.?$/,
|
|
14
|
-
alphanumeric: /^[\dA-Za-z]+$/,
|
|
15
|
-
'utc-millisec': (input) => !Number.isNaN(+input),
|
|
16
|
-
alpha: /^[A-Za-z]+$/,
|
|
17
|
-
style: /\s*(.+?):\s*([^;]+);?/g,
|
|
18
|
-
phone: /^\+(?:\d ?){6,14}\d$/
|
|
19
|
-
};
|
|
20
|
-
function schemaFrom(json, options) {
|
|
21
|
-
return (0, to_json_schema_1.default)(json, {
|
|
22
|
-
required: false,
|
|
23
|
-
...options,
|
|
24
|
-
postProcessFnc: (type, schema, value, defaultFunc) => {
|
|
25
|
-
var _a;
|
|
26
|
-
if (value !== json) {
|
|
27
|
-
schema.type = [type];
|
|
28
|
-
schema.nullable = (_a = options === null || options === void 0 ? void 0 : options.nullable) !== null && _a !== void 0 ? _a : false;
|
|
29
|
-
}
|
|
30
|
-
return defaultFunc(type, schema, value);
|
|
31
|
-
}
|
|
32
|
-
});
|
|
33
|
-
}
|
|
34
|
-
exports.schemaFrom = schemaFrom;
|
|
35
|
-
function isJsonSchemaObject(schema) {
|
|
36
|
-
if (schema.type === 'object')
|
|
37
|
-
return true;
|
|
38
|
-
return Array.isArray(schema.type) && schema.type.includes('object');
|
|
39
|
-
}
|
|
40
|
-
exports.isJsonSchemaObject = isJsonSchemaObject;
|
|
41
|
-
function schemaToJson(schema, container = {}) {
|
|
42
|
-
var _a;
|
|
43
|
-
if (isJsonSchemaObject(schema)) {
|
|
44
|
-
for (const key in schema.properties)
|
|
45
|
-
container[key] = schemaToJson(schema.properties[key]);
|
|
46
|
-
return container;
|
|
47
|
-
}
|
|
48
|
-
else {
|
|
49
|
-
return (_a = schema.default) !== null && _a !== void 0 ? _a : (schema.nullable ? null : undefined);
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
exports.schemaToJson = schemaToJson;
|
|
53
|
-
function flatSchema(schema, parentKey = '', nestingDelimiter = '__', container = {}) {
|
|
54
|
-
if (isJsonSchemaObject(schema)) {
|
|
55
|
-
for (const key in schema.properties) {
|
|
56
|
-
if (key[0] === '#')
|
|
57
|
-
continue;
|
|
58
|
-
const subKey = parentKey + (parentKey ? nestingDelimiter : '') + key;
|
|
59
|
-
container = {
|
|
60
|
-
...container,
|
|
61
|
-
...flatSchema(schema.properties[key], subKey, nestingDelimiter)
|
|
62
|
-
};
|
|
63
|
-
}
|
|
64
|
-
return container;
|
|
65
|
-
}
|
|
66
|
-
else {
|
|
67
|
-
return { [parentKey]: schema };
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
exports.flatSchema = flatSchema;
|
|
71
|
-
function createValidator(schema, enableFormats = true) {
|
|
72
|
-
const ajv = new ajv_1.default({
|
|
73
|
-
allErrors: true,
|
|
74
|
-
allowUnionTypes: true
|
|
75
|
-
});
|
|
76
|
-
if (enableFormats) {
|
|
77
|
-
(0, ajv_formats_1.default)(ajv, { mode: 'fast' });
|
|
78
|
-
for (const key in FORMAT_REGEXPS)
|
|
79
|
-
ajv.addFormat(key, FORMAT_REGEXPS[key]);
|
|
80
|
-
}
|
|
81
|
-
return ajv.compile(schema);
|
|
82
|
-
}
|
|
83
|
-
exports.createValidator = createValidator;
|
|
84
|
-
function createValidators(schemaLookup, enableFormats = true) {
|
|
85
|
-
const ajv = new ajv_1.default({
|
|
86
|
-
allErrors: true,
|
|
87
|
-
allowUnionTypes: true
|
|
88
|
-
});
|
|
89
|
-
if (enableFormats) {
|
|
90
|
-
(0, ajv_formats_1.default)(ajv, { mode: 'fast' });
|
|
91
|
-
for (const key in FORMAT_REGEXPS)
|
|
92
|
-
ajv.addFormat(key, FORMAT_REGEXPS[key]);
|
|
93
|
-
}
|
|
94
|
-
const validators = {};
|
|
95
|
-
for (const key in schemaLookup)
|
|
96
|
-
validators[key] = ajv.compile(schemaLookup[key]);
|
|
97
|
-
return validators;
|
|
98
|
-
}
|
|
99
|
-
exports.createValidators = createValidators;
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.createValidators = exports.createValidator = exports.flatSchema = exports.schemaToJson = exports.isJsonSchemaObject = exports.schemaFrom = void 0;
|
|
7
|
+
const ajv_1 = __importDefault(require("ajv"));
|
|
8
|
+
const ajv_formats_1 = __importDefault(require("ajv-formats"));
|
|
9
|
+
const to_json_schema_1 = __importDefault(require("to-json-schema"));
|
|
10
|
+
const FORMAT_REGEXPS = {
|
|
11
|
+
'ip-address': /^(?:(?:25[0-5]|2[0-4]\d|[01]?\d{1,2})\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d{1,2})$/,
|
|
12
|
+
color: /^(#?([\dA-Fa-f]{3}){1,2}\b|aqua|black|blue|fuchsia|gray|green|lime|maroon|navy|olive|orange|purple|red|silver|teal|white|yellow|(rgb\(\s*\b(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\b\s*,\s*\b(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\b\s*,\s*\b(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\b\s*\))|(rgb\(\s*(\d?\d%|100%)+\s*,\s*(\d?\d%|100%)+\s*,\s*(\d?\d%|100%)+\s*\)))$/,
|
|
13
|
+
hostname: /^(?=.{1,255}$)[\dA-Za-z](?:(?:[\dA-Za-z]|-){0,61}[\dA-Za-z])?(?:\.[\dA-Za-z](?:(?:[\dA-Za-z]|-){0,61}[\dA-Za-z])?)*\.?$/,
|
|
14
|
+
alphanumeric: /^[\dA-Za-z]+$/,
|
|
15
|
+
'utc-millisec': (input) => !Number.isNaN(+input),
|
|
16
|
+
alpha: /^[A-Za-z]+$/,
|
|
17
|
+
style: /\s*(.+?):\s*([^;]+);?/g,
|
|
18
|
+
phone: /^\+(?:\d ?){6,14}\d$/
|
|
19
|
+
};
|
|
20
|
+
function schemaFrom(json, options) {
|
|
21
|
+
return (0, to_json_schema_1.default)(json, {
|
|
22
|
+
required: false,
|
|
23
|
+
...options,
|
|
24
|
+
postProcessFnc: (type, schema, value, defaultFunc) => {
|
|
25
|
+
var _a;
|
|
26
|
+
if (value !== json) {
|
|
27
|
+
schema.type = [type];
|
|
28
|
+
schema.nullable = (_a = options === null || options === void 0 ? void 0 : options.nullable) !== null && _a !== void 0 ? _a : false;
|
|
29
|
+
}
|
|
30
|
+
return defaultFunc(type, schema, value);
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
exports.schemaFrom = schemaFrom;
|
|
35
|
+
function isJsonSchemaObject(schema) {
|
|
36
|
+
if (schema.type === 'object')
|
|
37
|
+
return true;
|
|
38
|
+
return Array.isArray(schema.type) && schema.type.includes('object');
|
|
39
|
+
}
|
|
40
|
+
exports.isJsonSchemaObject = isJsonSchemaObject;
|
|
41
|
+
function schemaToJson(schema, container = {}) {
|
|
42
|
+
var _a;
|
|
43
|
+
if (isJsonSchemaObject(schema)) {
|
|
44
|
+
for (const key in schema.properties)
|
|
45
|
+
container[key] = schemaToJson(schema.properties[key]);
|
|
46
|
+
return container;
|
|
47
|
+
}
|
|
48
|
+
else {
|
|
49
|
+
return (_a = schema.default) !== null && _a !== void 0 ? _a : (schema.nullable ? null : undefined);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
exports.schemaToJson = schemaToJson;
|
|
53
|
+
function flatSchema(schema, parentKey = '', nestingDelimiter = '__', container = {}) {
|
|
54
|
+
if (isJsonSchemaObject(schema)) {
|
|
55
|
+
for (const key in schema.properties) {
|
|
56
|
+
if (key[0] === '#')
|
|
57
|
+
continue;
|
|
58
|
+
const subKey = parentKey + (parentKey ? nestingDelimiter : '') + key;
|
|
59
|
+
container = {
|
|
60
|
+
...container,
|
|
61
|
+
...flatSchema(schema.properties[key], subKey, nestingDelimiter)
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
return container;
|
|
65
|
+
}
|
|
66
|
+
else {
|
|
67
|
+
return { [parentKey]: schema };
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
exports.flatSchema = flatSchema;
|
|
71
|
+
function createValidator(schema, enableFormats = true) {
|
|
72
|
+
const ajv = new ajv_1.default({
|
|
73
|
+
allErrors: true,
|
|
74
|
+
allowUnionTypes: true
|
|
75
|
+
});
|
|
76
|
+
if (enableFormats) {
|
|
77
|
+
(0, ajv_formats_1.default)(ajv, { mode: 'fast' });
|
|
78
|
+
for (const key in FORMAT_REGEXPS)
|
|
79
|
+
ajv.addFormat(key, FORMAT_REGEXPS[key]);
|
|
80
|
+
}
|
|
81
|
+
return ajv.compile(schema);
|
|
82
|
+
}
|
|
83
|
+
exports.createValidator = createValidator;
|
|
84
|
+
function createValidators(schemaLookup, enableFormats = true) {
|
|
85
|
+
const ajv = new ajv_1.default({
|
|
86
|
+
allErrors: true,
|
|
87
|
+
allowUnionTypes: true
|
|
88
|
+
});
|
|
89
|
+
if (enableFormats) {
|
|
90
|
+
(0, ajv_formats_1.default)(ajv, { mode: 'fast' });
|
|
91
|
+
for (const key in FORMAT_REGEXPS)
|
|
92
|
+
ajv.addFormat(key, FORMAT_REGEXPS[key]);
|
|
93
|
+
}
|
|
94
|
+
const validators = {};
|
|
95
|
+
for (const key in schemaLookup)
|
|
96
|
+
validators[key] = ajv.compile(schemaLookup[key]);
|
|
97
|
+
return validators;
|
|
98
|
+
}
|
|
99
|
+
exports.createValidators = createValidators;
|
|
100
100
|
//# sourceMappingURL=schema.util.js.map
|