@terascope/core-utils 2.0.0-dev.7 → 2.0.0-dev.9
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/src/index.d.ts +1 -0
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +1 -0
- package/dist/src/index.js.map +1 -1
- package/dist/src/schemas.d.ts +69 -0
- package/dist/src/schemas.d.ts.map +1 -0
- package/dist/src/schemas.js +616 -0
- package/dist/src/schemas.js.map +1 -0
- package/package.json +7 -3
package/dist/src/index.d.ts
CHANGED
|
@@ -25,6 +25,7 @@ export * from './objects.js';
|
|
|
25
25
|
export * from './phone-number.js';
|
|
26
26
|
export * from './promises.js';
|
|
27
27
|
export * from './regex.js';
|
|
28
|
+
export * from './schemas.js';
|
|
28
29
|
export * from './strings.js';
|
|
29
30
|
export * from './iterators.js';
|
|
30
31
|
export * from './vector.js';
|
package/dist/src/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,YAAY,MAAM,mBAAmB,CAAC;AAE7C,cAAc,qBAAqB,CAAC;AACpC,cAAc,kBAAkB,CAAC;AACjC,cAAc,aAAa,CAAC;AAC5B,cAAc,kBAAkB,CAAC;AACjC,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC;AAC7B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,YAAY,CAAC;AAC3B,cAAc,iBAAiB,CAAC;AAChC,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,UAAU,CAAC;AACzB,cAAc,eAAe,CAAC;AAC9B,cAAc,aAAa,CAAC;AAC5B,cAAc,iBAAiB,CAAC;AAChC,cAAc,SAAS,CAAC;AACxB,cAAc,gBAAgB,CAAC;AAC/B,cAAc,W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-25,6 +25,7 @@ export * from './objects.js';
|
|
|
25
25
|
export * from './phone-number.js';
|
|
26
26
|
export * from './promises.js';
|
|
27
27
|
export * from './regex.js';
|
|
28
|
+
export * from './schemas.js';
|
|
28
29
|
export * from './strings.js';
|
|
29
30
|
export * from './iterators.js';
|
|
30
31
|
export * from './vector.js';
|
package/dist/src/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,YAAY,MAAM,mBAAmB,CAAC;AAE7C,cAAc,qBAAqB,CAAC;AACpC,cAAc,kBAAkB,CAAC;AACjC,cAAc,aAAa,CAAC;AAC5B,cAAc,kBAAkB,CAAC;AACjC,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC;AAC7B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,YAAY,CAAC;AAC3B,cAAc,iBAAiB,CAAC;AAChC,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,UAAU,CAAC;AACzB,cAAc,eAAe,CAAC;AAC9B,cAAc,aAAa,CAAC;AAC5B,cAAc,iBAAiB,CAAC;AAChC,cAAc,SAAS,CAAC;AACxB,cAAc,gBAAgB,CAAC;AAC/B,cAAc,WAAW,CAAC;AAC1B,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,mBAAmB,CAAC;AAClC,cAAc,eAAe,CAAC;AAC9B,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC;AAC7B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,aAAa,CAAC;AAE5B,OAAO,EAAE,YAAY,EAAE,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,YAAY,MAAM,mBAAmB,CAAC;AAE7C,cAAc,qBAAqB,CAAC;AACpC,cAAc,kBAAkB,CAAC;AACjC,cAAc,aAAa,CAAC;AAC5B,cAAc,kBAAkB,CAAC;AACjC,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC;AAC7B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,YAAY,CAAC;AAC3B,cAAc,iBAAiB,CAAC;AAChC,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,UAAU,CAAC;AACzB,cAAc,eAAe,CAAC;AAC9B,cAAc,aAAa,CAAC;AAC5B,cAAc,iBAAiB,CAAC;AAChC,cAAc,SAAS,CAAC;AACxB,cAAc,gBAAgB,CAAC;AAC/B,cAAc,WAAW,CAAC;AAC1B,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,mBAAmB,CAAC;AAClC,cAAc,eAAe,CAAC;AAC9B,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,aAAa,CAAC;AAE5B,OAAO,EAAE,YAAY,EAAE,CAAC"}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import bunyan from 'bunyan';
|
|
2
|
+
import moment from 'moment';
|
|
3
|
+
import { z, type ZodType } from 'zod';
|
|
4
|
+
import { AnyObject, Terafoundation as TF } from '@terascope/types';
|
|
5
|
+
export declare const formats: TF.Format[];
|
|
6
|
+
/**
|
|
7
|
+
* Facade class used to validate convict style schemas using the Zod library
|
|
8
|
+
*/
|
|
9
|
+
export declare class SchemaValidator<T = AnyObject> {
|
|
10
|
+
name: string;
|
|
11
|
+
inputSchema: TF.Schema<T>;
|
|
12
|
+
zodSchema: ZodType<T>;
|
|
13
|
+
checkUndeclaredKeys: CheckUndeclaredKeys;
|
|
14
|
+
envMap: Record<string, {
|
|
15
|
+
envName: string;
|
|
16
|
+
format: TF.ConvictFormat;
|
|
17
|
+
}>;
|
|
18
|
+
argsMap: Record<string, {
|
|
19
|
+
argName: string;
|
|
20
|
+
format: TF.ConvictFormat;
|
|
21
|
+
}>;
|
|
22
|
+
logger: bunyan;
|
|
23
|
+
constructor(schema: TF.Schema<T>, name: string, extraFormats?: TF.Format[], checkUndeclaredKeys?: CheckUndeclaredKeys);
|
|
24
|
+
/**
|
|
25
|
+
* Validate that a configuration conforms to the schema
|
|
26
|
+
*
|
|
27
|
+
* @param { any } config A configuration to validate
|
|
28
|
+
* @returns { T } A valid object of type T
|
|
29
|
+
*/
|
|
30
|
+
validate(config: any): T;
|
|
31
|
+
/**
|
|
32
|
+
* convert a convict style schema to zod schema
|
|
33
|
+
*
|
|
34
|
+
* @param { Schema<T> } schema A convict style schema
|
|
35
|
+
* @param { PropertyKey } parentKey Property name of a nested schema object
|
|
36
|
+
* or other identifier for the schema
|
|
37
|
+
* @param { Format[] } extraFormats User defined formats to be used for schema validation
|
|
38
|
+
* @returns { z.ZodType } A zod schema
|
|
39
|
+
*/
|
|
40
|
+
_convictStyleSchemaToZod(schema: TF.Schema<T>, parentKey: PropertyKey): z.ZodType<T, unknown, z.core.$ZodTypeInternals<T, unknown>> | z.ZodDefault<z.ZodAny>;
|
|
41
|
+
/**
|
|
42
|
+
* Converts a convict style schema object to a zod schema
|
|
43
|
+
* @param { TF.SchemaObj } schemaObj The schema object to convert
|
|
44
|
+
* @param { PropertyKey } key The name of the property that uses the schemaObj
|
|
45
|
+
* @returns { ZodType } A Zod schema object
|
|
46
|
+
*/
|
|
47
|
+
_convictSchemaObjToZod(schemaObj: TF.SchemaObj, key: PropertyKey): z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>> | z.ZodPipe<z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>, z.ZodTransform<any, unknown>>;
|
|
48
|
+
/**
|
|
49
|
+
* Determines the base type that a full schema will be built on
|
|
50
|
+
* @param { PropertyKey } key The name of the property that uses the schemaObj
|
|
51
|
+
* @param { TF.ConvictFormat } convictFormatValue A convict compatible format value
|
|
52
|
+
* @returns { ZodType } The base type
|
|
53
|
+
*/
|
|
54
|
+
_getBaseType(key: PropertyKey, convictFormatValue: TF.ConvictFormat): z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>;
|
|
55
|
+
/** Run the default value against the created schema to ensure it is valid */
|
|
56
|
+
_validateDefault(type: z.ZodType, defaultVal: any): void;
|
|
57
|
+
/** Unwrap the wrappers on base schema object and retrieve all keys */
|
|
58
|
+
getSchemaObjectKeys(schema: ZodType): string[] | undefined;
|
|
59
|
+
/** Look up a custom format by name and return the format object */
|
|
60
|
+
_getCustomFormatFromName(format: TF.ConvictFormat | undefined): TF.Format | null | undefined;
|
|
61
|
+
/** Determine if a format is the name of a custom format */
|
|
62
|
+
_isCustomFormatName(format: TF.ConvictFormat): boolean;
|
|
63
|
+
}
|
|
64
|
+
type CheckUndeclaredKeys = 'allow' | 'warn' | 'strict';
|
|
65
|
+
export declare function isSchemaObj<T>(value: unknown): value is TF.SchemaObj<T>;
|
|
66
|
+
export declare function isOfTypeFormat(value: unknown): value is TF.Format;
|
|
67
|
+
export declare function isMomentUnitOfTime(unitString: string): unitString is moment.unitOfTime.DurationConstructor;
|
|
68
|
+
export {};
|
|
69
|
+
//# sourceMappingURL=schemas.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../src/schemas.ts"],"names":[],"mappings":"AACA,OAAO,MAAM,MAAM,QAAQ,CAAC;AAE5B,OAAO,MAAM,MAAM,QAAQ,CAAC;AAC5B,OAAO,EAAE,CAAC,EAAE,KAAK,OAAO,EAAsB,MAAM,KAAK,CAAC;AAC1D,OAAO,EAAE,SAAS,EAAE,cAAc,IAAI,EAAE,EAAE,MAAM,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CAAC,MAAM,EAAE,OAAO,GAAG,MAAM,EAAE,GAAG,SAAS;IAmB1D,mEAAmE;IACnE,wBAAwB,CAAC,MAAM,EAAE,EAAE,CAAC,aAAa,GAAG,SAAS;IAO7D,2DAA2D;IAC3D,mBAAmB,CAAC,MAAM,EAAE,EAAE,CAAC,aAAa;CAQ/C;AAED,KAAK,mBAAmB,GAAG,OAAO,GAAG,MAAM,GAAG,QAAQ,CAAC;AAEvD,wBAAgB,WAAW,CAAC,CAAC,EAAE,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,EAAE,CAAC,SAAS,CAAC,CAAC,CAAC,CA2CvE;AAED,wBAAgB,cAAc,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,EAAE,CAAC,MAAM,CAwBjE;AAED,wBAAgB,kBAAkB,CAC9B,UAAU,EAAE,MAAM,GACnB,UAAU,IAAI,MAAM,CAAC,UAAU,CAAC,mBAAmB,CAqCrD"}
|
|
@@ -0,0 +1,616 @@
|
|
|
1
|
+
import assert from 'node:assert';
|
|
2
|
+
import bunyan from 'bunyan';
|
|
3
|
+
import dateMath from 'datemath-parser';
|
|
4
|
+
import moment from 'moment';
|
|
5
|
+
import { z } from 'zod';
|
|
6
|
+
import { isBoolean, toBoolean } from './booleans.js';
|
|
7
|
+
import { isValidDate } from './dates.js';
|
|
8
|
+
import { isFunction } from './functions.js';
|
|
9
|
+
import { isInteger, toInteger, toIntegerOrThrow, toNumber } from './numbers.js';
|
|
10
|
+
import { isSimpleObject } from './objects.js';
|
|
11
|
+
import { isString, startsWith } from './strings.js';
|
|
12
|
+
const convictCompatibleBooleanFn = (value) => {
|
|
13
|
+
if (value === 'true' || value === '1' || value === 1)
|
|
14
|
+
return true;
|
|
15
|
+
if (value === 'false' || value === '0' || value === 0)
|
|
16
|
+
return false;
|
|
17
|
+
return value;
|
|
18
|
+
};
|
|
19
|
+
export const formats = [
|
|
20
|
+
{
|
|
21
|
+
name: 'required_string',
|
|
22
|
+
validate(val) {
|
|
23
|
+
if (!val || !isString(val)) {
|
|
24
|
+
throw new Error('This field is required and must be of type string');
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
name: 'optional_string',
|
|
30
|
+
validate(val) {
|
|
31
|
+
if (!val) {
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
if (isString(val)) {
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
throw new Error('This field is optional but if specified it must be of type string');
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
name: 'optional_date',
|
|
42
|
+
validate(val) {
|
|
43
|
+
if (!val) {
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
if (isString(val) || isInteger(val)) {
|
|
47
|
+
if (isValidDate(val)) {
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
else {
|
|
52
|
+
throw new Error('parameter must be a string or number IF specified');
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
coerce(val) {
|
|
56
|
+
if (!val) {
|
|
57
|
+
return val;
|
|
58
|
+
}
|
|
59
|
+
try {
|
|
60
|
+
return dateMath.parse(`${val}`);
|
|
61
|
+
}
|
|
62
|
+
catch (err) {
|
|
63
|
+
throw new Error(`value: ${JSON.stringify(val)} cannot be coerced into a proper date
|
|
64
|
+
the error: ${err.stack}`);
|
|
65
|
+
}
|
|
66
|
+
},
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
name: 'elasticsearch_name',
|
|
70
|
+
validate(val) {
|
|
71
|
+
if (typeof val !== 'string') {
|
|
72
|
+
throw new Error(`value: ${val} must be a string`);
|
|
73
|
+
}
|
|
74
|
+
if (val.length > 255) {
|
|
75
|
+
throw new Error(`value: ${val} should not exceed 255 characters`);
|
|
76
|
+
}
|
|
77
|
+
if (startsWith(val, '_')
|
|
78
|
+
|| startsWith(val, '-')
|
|
79
|
+
|| startsWith(val, '+')) {
|
|
80
|
+
throw new Error(`value: ${val} should not start with _, -, or +`);
|
|
81
|
+
}
|
|
82
|
+
if (val === '.' || val === '..') {
|
|
83
|
+
throw new Error(`value: ${val} should not equal . or ..`);
|
|
84
|
+
}
|
|
85
|
+
// NOTE: the \\\\ is necessary to match a single \ in this case
|
|
86
|
+
const badChar = /[#*?"<>|/\\\\]/;
|
|
87
|
+
if (badChar.test(val)) {
|
|
88
|
+
throw new Error(`value: ${val} should not contain any invalid characters: #*?"<>|/\\`);
|
|
89
|
+
}
|
|
90
|
+
const upperRE = /[A-Z]/;
|
|
91
|
+
if (upperRE.test(val)) {
|
|
92
|
+
throw new Error(`value: ${val} should be lower case`);
|
|
93
|
+
}
|
|
94
|
+
},
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
name: 'positive_int',
|
|
98
|
+
validate(val) {
|
|
99
|
+
const int = toInteger(val);
|
|
100
|
+
if (int === false || int < 1) {
|
|
101
|
+
throw new Error('must be valid integer greater than zero');
|
|
102
|
+
}
|
|
103
|
+
},
|
|
104
|
+
coerce(val) {
|
|
105
|
+
return toInteger(val) || 0;
|
|
106
|
+
},
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
name: 'optional_bool',
|
|
110
|
+
validate(val) {
|
|
111
|
+
if (!val)
|
|
112
|
+
return;
|
|
113
|
+
if (!isBoolean(val)) {
|
|
114
|
+
throw new Error(`If specified, must be convertible to a boolean. Received: ${val}`);
|
|
115
|
+
}
|
|
116
|
+
},
|
|
117
|
+
coerce: convictCompatibleBooleanFn,
|
|
118
|
+
},
|
|
119
|
+
{
|
|
120
|
+
name: 'optional_int',
|
|
121
|
+
validate(val) {
|
|
122
|
+
if (!val)
|
|
123
|
+
return;
|
|
124
|
+
if (!isInteger(val)) {
|
|
125
|
+
throw new Error(`If specified, must be a boolean, 'true', or 'false'. Received: ${val}`);
|
|
126
|
+
}
|
|
127
|
+
},
|
|
128
|
+
coerce(val) {
|
|
129
|
+
try {
|
|
130
|
+
toIntegerOrThrow(val);
|
|
131
|
+
}
|
|
132
|
+
catch (err) {
|
|
133
|
+
return val;
|
|
134
|
+
}
|
|
135
|
+
},
|
|
136
|
+
},
|
|
137
|
+
{
|
|
138
|
+
name: 'duration',
|
|
139
|
+
coerce: (v) => {
|
|
140
|
+
if (typeof v === 'number') {
|
|
141
|
+
return v;
|
|
142
|
+
}
|
|
143
|
+
let val;
|
|
144
|
+
const split = v.split(' ');
|
|
145
|
+
if (split.length == 1) {
|
|
146
|
+
// It must be an integer in string form.
|
|
147
|
+
val = parseInt(v, 10);
|
|
148
|
+
}
|
|
149
|
+
else {
|
|
150
|
+
let unitString = split[1];
|
|
151
|
+
// Add an "s" as the unit of measurement used in Moment
|
|
152
|
+
if (!unitString.match(/s$/)) {
|
|
153
|
+
unitString += 's';
|
|
154
|
+
}
|
|
155
|
+
if (!isMomentUnitOfTime(unitString)) {
|
|
156
|
+
throw new Error(`Invalid duration unit: ${unitString}`);
|
|
157
|
+
}
|
|
158
|
+
val = moment.duration(parseInt(split[0], 10), unitString).valueOf();
|
|
159
|
+
}
|
|
160
|
+
return val;
|
|
161
|
+
},
|
|
162
|
+
validate: function (x) {
|
|
163
|
+
const err_msg = 'must be a positive integer or human readable string (e.g. 3000, "5 days")';
|
|
164
|
+
if (Number.isInteger(x)) {
|
|
165
|
+
assert(x >= 0, err_msg);
|
|
166
|
+
}
|
|
167
|
+
else {
|
|
168
|
+
assert(x.match(/^(\d)+ (.+)$/), err_msg);
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
},
|
|
172
|
+
{
|
|
173
|
+
name: 'timestamp',
|
|
174
|
+
coerce: (v) => moment(v).valueOf(),
|
|
175
|
+
validate: function (x) {
|
|
176
|
+
assert(Number.isInteger(x) && x >= 0, 'must be a positive integer');
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
];
|
|
180
|
+
/**
|
|
181
|
+
* Facade class used to validate convict style schemas using the Zod library
|
|
182
|
+
*/
|
|
183
|
+
export class SchemaValidator {
|
|
184
|
+
name;
|
|
185
|
+
inputSchema;
|
|
186
|
+
zodSchema;
|
|
187
|
+
checkUndeclaredKeys;
|
|
188
|
+
envMap = {};
|
|
189
|
+
argsMap = {};
|
|
190
|
+
logger;
|
|
191
|
+
constructor(schema, name, extraFormats = [], checkUndeclaredKeys = 'warn') {
|
|
192
|
+
extraFormats.forEach((newFormat) => {
|
|
193
|
+
let unique = true;
|
|
194
|
+
formats.forEach((existingFormat) => {
|
|
195
|
+
// find formats with same name
|
|
196
|
+
if (existingFormat.name === newFormat.name) {
|
|
197
|
+
// find format with different functions
|
|
198
|
+
if (existingFormat.coerce?.toString() !== newFormat.coerce?.toString()
|
|
199
|
+
|| existingFormat.validate?.toString() !== newFormat.validate?.toString()) {
|
|
200
|
+
throw new Error(`Custom formats library already contains a format named ${newFormat.name}`);
|
|
201
|
+
}
|
|
202
|
+
unique = false;
|
|
203
|
+
}
|
|
204
|
+
});
|
|
205
|
+
if (unique) {
|
|
206
|
+
formats.push(newFormat);
|
|
207
|
+
}
|
|
208
|
+
});
|
|
209
|
+
this.name = name;
|
|
210
|
+
this.logger = bunyan.createLogger({ name: 'SchemaValidator' });
|
|
211
|
+
this.inputSchema = schema;
|
|
212
|
+
this.zodSchema = this._convictStyleSchemaToZod(schema, name);
|
|
213
|
+
this.checkUndeclaredKeys = checkUndeclaredKeys;
|
|
214
|
+
}
|
|
215
|
+
/**
|
|
216
|
+
* Validate that a configuration conforms to the schema
|
|
217
|
+
*
|
|
218
|
+
* @param { any } config A configuration to validate
|
|
219
|
+
* @returns { T } A valid object of type T
|
|
220
|
+
*/
|
|
221
|
+
validate(config) {
|
|
222
|
+
const finalConfig = config;
|
|
223
|
+
// Node process arguments and environmental variables override
|
|
224
|
+
// values from a configuration
|
|
225
|
+
// precedence: args, env, loaded value from config, default
|
|
226
|
+
for (const key in this.envMap) {
|
|
227
|
+
const { envName, format } = this.envMap[key];
|
|
228
|
+
if (envName in process.env) {
|
|
229
|
+
let envVal;
|
|
230
|
+
if (format === Boolean || format === 'Boolean') {
|
|
231
|
+
envVal = toBoolean(process.env[envName]);
|
|
232
|
+
}
|
|
233
|
+
if (format === Number || format === 'Number') {
|
|
234
|
+
envVal = toNumber(process.env[envName]);
|
|
235
|
+
}
|
|
236
|
+
else {
|
|
237
|
+
envVal = process.env[envName];
|
|
238
|
+
}
|
|
239
|
+
finalConfig[key] = envVal;
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
for (const key in this.argsMap) {
|
|
243
|
+
const { argName, format } = this.argsMap[key];
|
|
244
|
+
// Find the arg either as exact match or with = syntax
|
|
245
|
+
let argIndex = process.argv.indexOf(`--${argName}`);
|
|
246
|
+
if (argIndex === -1) {
|
|
247
|
+
// Look for --argName=value syntax
|
|
248
|
+
argIndex = process.argv.findIndex((arg) => arg.startsWith(`--${argName}=`));
|
|
249
|
+
}
|
|
250
|
+
if (argIndex >= 2) { // argv flags start at index 2
|
|
251
|
+
const flag = process.argv[argIndex];
|
|
252
|
+
let argValue;
|
|
253
|
+
if (flag.includes('=')) {
|
|
254
|
+
argValue = flag.split('=')[1];
|
|
255
|
+
}
|
|
256
|
+
else {
|
|
257
|
+
argValue = process.argv[argIndex + 1];
|
|
258
|
+
}
|
|
259
|
+
if (format === Boolean || format === 'Boolean') {
|
|
260
|
+
argValue = toBoolean(argValue);
|
|
261
|
+
}
|
|
262
|
+
if (format === Number || format === 'Number') {
|
|
263
|
+
argValue = toNumber(argValue);
|
|
264
|
+
}
|
|
265
|
+
finalConfig[key] = argValue;
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
let validatedWithZod;
|
|
269
|
+
try {
|
|
270
|
+
validatedWithZod = this.zodSchema.parse(finalConfig);
|
|
271
|
+
}
|
|
272
|
+
catch (err) {
|
|
273
|
+
throw new Error(`Zod parse error: ${err}`);
|
|
274
|
+
}
|
|
275
|
+
if (this.checkUndeclaredKeys !== 'allow') {
|
|
276
|
+
const schemaKeys = this.getSchemaObjectKeys(this.zodSchema);
|
|
277
|
+
if (schemaKeys) {
|
|
278
|
+
for (const key in finalConfig) {
|
|
279
|
+
if (!schemaKeys.includes(key)) {
|
|
280
|
+
if (this.checkUndeclaredKeys === 'warn') {
|
|
281
|
+
this.logger.warn(`Key '${key}' is not declared in ${this.name} schema`);
|
|
282
|
+
}
|
|
283
|
+
else if (this.checkUndeclaredKeys === 'strict') {
|
|
284
|
+
throw new Error(`Key '${key}' is not declared in ${this.name} schema`);
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
return validatedWithZod;
|
|
291
|
+
}
|
|
292
|
+
/**
|
|
293
|
+
* convert a convict style schema to zod schema
|
|
294
|
+
*
|
|
295
|
+
* @param { Schema<T> } schema A convict style schema
|
|
296
|
+
* @param { PropertyKey } parentKey Property name of a nested schema object
|
|
297
|
+
* or other identifier for the schema
|
|
298
|
+
* @param { Format[] } extraFormats User defined formats to be used for schema validation
|
|
299
|
+
* @returns { z.ZodType } A zod schema
|
|
300
|
+
*/
|
|
301
|
+
_convictStyleSchemaToZod(schema, parentKey) {
|
|
302
|
+
const fields = {};
|
|
303
|
+
const defaults = {};
|
|
304
|
+
if (!isSimpleObject(schema)) {
|
|
305
|
+
return z.any().default(schema);
|
|
306
|
+
}
|
|
307
|
+
for (const key in schema) {
|
|
308
|
+
const value = schema[key];
|
|
309
|
+
if (isSchemaObj(value)) {
|
|
310
|
+
fields[key] = this._convictSchemaObjToZod(value, key);
|
|
311
|
+
defaults[key] = value.default;
|
|
312
|
+
}
|
|
313
|
+
else {
|
|
314
|
+
fields[key] = this._convictStyleSchemaToZod(value, `${parentKey.toString()}.${key}`);
|
|
315
|
+
defaults[key] = fields[key].parse({});
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
return z.looseObject(fields)
|
|
319
|
+
.default(defaults);
|
|
320
|
+
}
|
|
321
|
+
/**
|
|
322
|
+
* Converts a convict style schema object to a zod schema
|
|
323
|
+
* @param { TF.SchemaObj } schemaObj The schema object to convert
|
|
324
|
+
* @param { PropertyKey } key The name of the property that uses the schemaObj
|
|
325
|
+
* @returns { ZodType } A Zod schema object
|
|
326
|
+
*/
|
|
327
|
+
_convictSchemaObjToZod(schemaObj, key) {
|
|
328
|
+
let type;
|
|
329
|
+
let finalFormat;
|
|
330
|
+
if (schemaObj.format === undefined) {
|
|
331
|
+
// If no format is set assume the format is the typeof the default value
|
|
332
|
+
const defaultType = Object.prototype.toString.call(schemaObj.default);
|
|
333
|
+
finalFormat = function (x) {
|
|
334
|
+
assert(Object.prototype.toString.call(x) == defaultType, ' should be of type ' + defaultType.replace(/\[.* |]/g, ''));
|
|
335
|
+
};
|
|
336
|
+
type = this._getBaseType(key, finalFormat);
|
|
337
|
+
}
|
|
338
|
+
else {
|
|
339
|
+
type = this._getBaseType(key, schemaObj.format);
|
|
340
|
+
finalFormat = this._getCustomFormatFromName(schemaObj.format) || schemaObj.format;
|
|
341
|
+
}
|
|
342
|
+
if (Object.hasOwn(schemaObj, 'default')) {
|
|
343
|
+
try {
|
|
344
|
+
this._validateDefault(type, schemaObj.default);
|
|
345
|
+
}
|
|
346
|
+
catch (err) {
|
|
347
|
+
throw new Error(`Invalid default value for key ${key.toString()}: ${schemaObj.default}`);
|
|
348
|
+
}
|
|
349
|
+
type = type.default(schemaObj.default);
|
|
350
|
+
}
|
|
351
|
+
if (schemaObj.arg) {
|
|
352
|
+
this.argsMap[key.toString()] = { argName: schemaObj.arg, format: finalFormat };
|
|
353
|
+
}
|
|
354
|
+
if (schemaObj.env) {
|
|
355
|
+
this.envMap[key.toString()] = { envName: schemaObj.env, format: finalFormat };
|
|
356
|
+
}
|
|
357
|
+
if (isOfTypeFormat(finalFormat)) {
|
|
358
|
+
// custom formats
|
|
359
|
+
if (finalFormat.coerce && finalFormat.validate) {
|
|
360
|
+
return type.transform((val, ctx) => {
|
|
361
|
+
try {
|
|
362
|
+
// Both coerce and validate are guaranteed to exist from the check above
|
|
363
|
+
const finalVal = finalFormat.coerce(val);
|
|
364
|
+
finalFormat.validate(finalVal, schemaObj);
|
|
365
|
+
return finalVal;
|
|
366
|
+
}
|
|
367
|
+
catch (err) {
|
|
368
|
+
ctx.addIssue({
|
|
369
|
+
code: 'custom',
|
|
370
|
+
path: [key],
|
|
371
|
+
input: val,
|
|
372
|
+
message: err.message ? err.message : 'Validation failed',
|
|
373
|
+
});
|
|
374
|
+
return z.NEVER;
|
|
375
|
+
}
|
|
376
|
+
});
|
|
377
|
+
}
|
|
378
|
+
else {
|
|
379
|
+
return type.superRefine((val, ctx) => {
|
|
380
|
+
try {
|
|
381
|
+
if (finalFormat.validate) {
|
|
382
|
+
finalFormat.validate(val, schemaObj);
|
|
383
|
+
}
|
|
384
|
+
}
|
|
385
|
+
catch (err) {
|
|
386
|
+
ctx.addIssue({
|
|
387
|
+
code: 'custom',
|
|
388
|
+
path: [key],
|
|
389
|
+
input: val,
|
|
390
|
+
message: err instanceof Error ? err.message : 'Validation failed',
|
|
391
|
+
});
|
|
392
|
+
}
|
|
393
|
+
});
|
|
394
|
+
}
|
|
395
|
+
}
|
|
396
|
+
if (isFunction(finalFormat)) {
|
|
397
|
+
// formats defined in inline functions
|
|
398
|
+
return type.superRefine((args, ctx) => {
|
|
399
|
+
try {
|
|
400
|
+
let val;
|
|
401
|
+
if (args === null || args === undefined) {
|
|
402
|
+
val = schemaObj.default;
|
|
403
|
+
}
|
|
404
|
+
else {
|
|
405
|
+
val = args;
|
|
406
|
+
}
|
|
407
|
+
finalFormat(val);
|
|
408
|
+
}
|
|
409
|
+
catch (err) {
|
|
410
|
+
ctx.addIssue({
|
|
411
|
+
code: 'custom',
|
|
412
|
+
input: args,
|
|
413
|
+
message: err instanceof Error ? err.message : 'Validation failed',
|
|
414
|
+
});
|
|
415
|
+
}
|
|
416
|
+
});
|
|
417
|
+
}
|
|
418
|
+
return type;
|
|
419
|
+
}
|
|
420
|
+
/**
|
|
421
|
+
* Determines the base type that a full schema will be built on
|
|
422
|
+
* @param { PropertyKey } key The name of the property that uses the schemaObj
|
|
423
|
+
* @param { TF.ConvictFormat } convictFormatValue A convict compatible format value
|
|
424
|
+
* @returns { ZodType } The base type
|
|
425
|
+
*/
|
|
426
|
+
_getBaseType(key, convictFormatValue) {
|
|
427
|
+
let baseType;
|
|
428
|
+
switch (convictFormatValue) {
|
|
429
|
+
case '*':
|
|
430
|
+
baseType = z.any();
|
|
431
|
+
break;
|
|
432
|
+
case 'int':
|
|
433
|
+
baseType = z.number().int();
|
|
434
|
+
break;
|
|
435
|
+
case 'port':
|
|
436
|
+
baseType = z
|
|
437
|
+
.coerce.number()
|
|
438
|
+
.int()
|
|
439
|
+
.min(1)
|
|
440
|
+
.max(65535);
|
|
441
|
+
break;
|
|
442
|
+
case 'nat':
|
|
443
|
+
baseType = z
|
|
444
|
+
.number()
|
|
445
|
+
.int()
|
|
446
|
+
.min(0);
|
|
447
|
+
break;
|
|
448
|
+
case 'url':
|
|
449
|
+
baseType = z.url();
|
|
450
|
+
break;
|
|
451
|
+
case 'email':
|
|
452
|
+
baseType = z.email();
|
|
453
|
+
break;
|
|
454
|
+
case 'ipaddress':
|
|
455
|
+
baseType = z.union([z.ipv4(), z.ipv6()]);
|
|
456
|
+
break;
|
|
457
|
+
case 'String':
|
|
458
|
+
case String:
|
|
459
|
+
baseType = z.string();
|
|
460
|
+
break;
|
|
461
|
+
case 'Number':
|
|
462
|
+
case Number:
|
|
463
|
+
baseType = z.number();
|
|
464
|
+
break;
|
|
465
|
+
case 'Boolean':
|
|
466
|
+
case Boolean:
|
|
467
|
+
baseType = z.preprocess(convictCompatibleBooleanFn, z.boolean());
|
|
468
|
+
break;
|
|
469
|
+
case 'Object':
|
|
470
|
+
case Object:
|
|
471
|
+
baseType = z.record(z.string(), z.any());
|
|
472
|
+
break;
|
|
473
|
+
case 'Array':
|
|
474
|
+
case Array:
|
|
475
|
+
baseType = z.array(z.any());
|
|
476
|
+
break;
|
|
477
|
+
case 'RegExp':
|
|
478
|
+
case RegExp:
|
|
479
|
+
baseType = z.instanceof(RegExp);
|
|
480
|
+
break;
|
|
481
|
+
case (this._isCustomFormatName(convictFormatValue) ? convictFormatValue : undefined):
|
|
482
|
+
case (isFunction(convictFormatValue) ? convictFormatValue : undefined):
|
|
483
|
+
// let the format function do all validation
|
|
484
|
+
baseType = z.any();
|
|
485
|
+
break;
|
|
486
|
+
case (Array.isArray(convictFormatValue) ? convictFormatValue : undefined):
|
|
487
|
+
baseType = z.enum(convictFormatValue);
|
|
488
|
+
break;
|
|
489
|
+
default:
|
|
490
|
+
throw new Error(`Unrecognized convict format for key: ${key.toString()} cannot be converted to zod format: ${convictFormatValue}`);
|
|
491
|
+
}
|
|
492
|
+
return baseType;
|
|
493
|
+
}
|
|
494
|
+
/** Run the default value against the created schema to ensure it is valid */
|
|
495
|
+
_validateDefault(type, defaultVal) {
|
|
496
|
+
if (defaultVal !== undefined && defaultVal !== null) {
|
|
497
|
+
type.parse(defaultVal);
|
|
498
|
+
}
|
|
499
|
+
}
|
|
500
|
+
/** Unwrap the wrappers on base schema object and retrieve all keys */
|
|
501
|
+
getSchemaObjectKeys(schema) {
|
|
502
|
+
let s = schema;
|
|
503
|
+
// unwrap known wrappers
|
|
504
|
+
while (s instanceof z.ZodDefault
|
|
505
|
+
|| s instanceof z.ZodOptional
|
|
506
|
+
|| s instanceof z.ZodNullable) {
|
|
507
|
+
s = s.def.innerType;
|
|
508
|
+
}
|
|
509
|
+
if (s instanceof z.ZodObject) {
|
|
510
|
+
return Object.keys(s.shape);
|
|
511
|
+
}
|
|
512
|
+
return undefined;
|
|
513
|
+
}
|
|
514
|
+
/** Look up a custom format by name and return the format object */
|
|
515
|
+
_getCustomFormatFromName(format) {
|
|
516
|
+
if (typeof format !== 'string')
|
|
517
|
+
return null;
|
|
518
|
+
return formats.find((obj) => obj.name === format);
|
|
519
|
+
}
|
|
520
|
+
/** Determine if a format is the name of a custom format */
|
|
521
|
+
_isCustomFormatName(format) {
|
|
522
|
+
if (typeof format !== 'string')
|
|
523
|
+
return false;
|
|
524
|
+
const result = formats.filter((obj) => obj.name === format);
|
|
525
|
+
return result.length > 0;
|
|
526
|
+
}
|
|
527
|
+
}
|
|
528
|
+
export function isSchemaObj(value) {
|
|
529
|
+
if (typeof value !== 'object' || value === null) {
|
|
530
|
+
return false;
|
|
531
|
+
}
|
|
532
|
+
const obj = value;
|
|
533
|
+
if (!('default' in obj)) {
|
|
534
|
+
return false;
|
|
535
|
+
}
|
|
536
|
+
if ('format' in obj) {
|
|
537
|
+
const format = obj.format;
|
|
538
|
+
const validFormat = typeof format === 'string'
|
|
539
|
+
|| typeof format === 'function'
|
|
540
|
+
|| typeof format === 'object'
|
|
541
|
+
|| Array.isArray(format)
|
|
542
|
+
|| format === String
|
|
543
|
+
|| format === Number
|
|
544
|
+
|| format === Boolean
|
|
545
|
+
|| format === Object
|
|
546
|
+
|| format === Array
|
|
547
|
+
|| format === RegExp;
|
|
548
|
+
if (!validFormat) {
|
|
549
|
+
return false;
|
|
550
|
+
}
|
|
551
|
+
}
|
|
552
|
+
if ('doc' in obj && typeof obj.doc !== 'string') {
|
|
553
|
+
return false;
|
|
554
|
+
}
|
|
555
|
+
if ('env' in obj && typeof obj.env !== 'string') {
|
|
556
|
+
return false;
|
|
557
|
+
}
|
|
558
|
+
if ('arg' in obj && typeof obj.arg !== 'string') {
|
|
559
|
+
return false;
|
|
560
|
+
}
|
|
561
|
+
return true;
|
|
562
|
+
}
|
|
563
|
+
export function isOfTypeFormat(value) {
|
|
564
|
+
if (typeof value !== 'object' || value === null) {
|
|
565
|
+
return false;
|
|
566
|
+
}
|
|
567
|
+
const obj = value;
|
|
568
|
+
if ('name' in obj && typeof obj.name !== 'string' && obj.name !== undefined) {
|
|
569
|
+
return false;
|
|
570
|
+
}
|
|
571
|
+
if ('coerce' in obj && typeof obj.coerce !== 'function' && obj.coerce !== undefined) {
|
|
572
|
+
return false;
|
|
573
|
+
}
|
|
574
|
+
if ('validate' in obj && typeof obj.validate !== 'function' && obj.validate !== undefined) {
|
|
575
|
+
return false;
|
|
576
|
+
}
|
|
577
|
+
if (!('name' in obj) && !('validate' in obj) && !('coerce' in obj)) {
|
|
578
|
+
return false;
|
|
579
|
+
}
|
|
580
|
+
return true;
|
|
581
|
+
}
|
|
582
|
+
export function isMomentUnitOfTime(unitString) {
|
|
583
|
+
// Helper function to create a type-checked array of valid units
|
|
584
|
+
const units = (arr) => arr;
|
|
585
|
+
const validUnits = units([
|
|
586
|
+
'year',
|
|
587
|
+
'years',
|
|
588
|
+
'y',
|
|
589
|
+
'month',
|
|
590
|
+
'months',
|
|
591
|
+
'M',
|
|
592
|
+
'week',
|
|
593
|
+
'weeks',
|
|
594
|
+
'w',
|
|
595
|
+
'day',
|
|
596
|
+
'days',
|
|
597
|
+
'd',
|
|
598
|
+
'hour',
|
|
599
|
+
'hours',
|
|
600
|
+
'h',
|
|
601
|
+
'minute',
|
|
602
|
+
'minutes',
|
|
603
|
+
'm',
|
|
604
|
+
'second',
|
|
605
|
+
'seconds',
|
|
606
|
+
's',
|
|
607
|
+
'millisecond',
|
|
608
|
+
'milliseconds',
|
|
609
|
+
'ms',
|
|
610
|
+
'quarter',
|
|
611
|
+
'quarters',
|
|
612
|
+
'Q'
|
|
613
|
+
]);
|
|
614
|
+
return validUnits.includes(unitString);
|
|
615
|
+
}
|
|
616
|
+
//# sourceMappingURL=schemas.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schemas.js","sourceRoot":"","sources":["../../src/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,aAAa,CAAC;AACjC,OAAO,MAAM,MAAM,QAAQ,CAAC;AAC5B,OAAO,QAAQ,MAAM,iBAAiB,CAAC;AACvC,OAAO,MAAM,MAAM,QAAQ,CAAC;AAC5B,OAAO,EAAE,CAAC,EAAoC,MAAM,KAAK,CAAC;AAE1D,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AACrD,O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,CAAC,IAAI,CAAC,CAAC,QAAQ,IAAI,GAAG,CAAC,EAAE,CAAC;QACjE,OAAO,KAAK,CAAC;IACjB,CAAC;IAED,OAAO,IAAI,CAAC;AAChB,CAAC;AAED,MAAM,UAAU,kBAAkB,CAC9B,UAAkB;IAElB,gEAAgE;IAChE,MAAM,KAAK,GAAG,CACV,GAAM,EACL,EAAE,CAAC,GAAG,CAAC;IAEZ,MAAM,UAAU,GAAG,KAAK,CAAC;QACrB,MAAM;QACN,OAAO;QACP,GAAG;QACH,OAAO;QACP,QAAQ;QACR,GAAG;QACH,MAAM;QACN,OAAO;QACP,GAAG;QACH,KAAK;QACL,MAAM;QACN,GAAG;QACH,MAAM;QACN,OAAO;QACP,GAAG;QACH,QAAQ;QACR,SAAS;QACT,GAAG;QACH,QAAQ;QACR,SAAS;QACT,GAAG;QACH,aAAa;QACb,cAAc;QACd,IAAI;QACJ,SAAS;QACT,UAAU;QACV,GAAG;KACN,CAAC,CAAC;IAEH,OAAQ,UAAgC,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC;AAClE,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@terascope/core-utils",
|
|
3
3
|
"displayName": "Core Utils",
|
|
4
|
-
"version": "2.0.0-dev.
|
|
4
|
+
"version": "2.0.0-dev.9",
|
|
5
5
|
"description": "A collection of Teraslice Core Utilities",
|
|
6
6
|
"homepage": "https://github.com/terascope/teraslice/tree/master/packages/core-utils#readme",
|
|
7
7
|
"bugs": {
|
|
@@ -29,16 +29,20 @@
|
|
|
29
29
|
"debug": "~4.4.3"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@terascope/types": "~2.0.0-dev.
|
|
32
|
+
"@terascope/types": "~2.0.0-dev.8",
|
|
33
33
|
"awesome-phonenumber": "~7.5.0",
|
|
34
|
+
"bunyan": "~1.8.15",
|
|
35
|
+
"datemath-parser": "~1.0.6",
|
|
34
36
|
"debug": "~4.4.3",
|
|
35
37
|
"is-plain-object": "~5.0.0",
|
|
36
38
|
"js-string-escape": "~1.0.1",
|
|
37
39
|
"kind-of": "~6.0.3",
|
|
38
40
|
"lodash-es": "~4.17.21",
|
|
41
|
+
"moment": "~2.30.1",
|
|
39
42
|
"p-map": "~7.0.3",
|
|
40
43
|
"shallow-clone": "~3.0.1",
|
|
41
|
-
"validator": "~13.12.0"
|
|
44
|
+
"validator": "~13.12.0",
|
|
45
|
+
"zod": "~4.1.12"
|
|
42
46
|
},
|
|
43
47
|
"devDependencies": {
|
|
44
48
|
"@types/debug": "~4.1.12",
|