tinybase 9.5.0-beta.0 → 9.5.0
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/@types/_internal/store/with-schemas/index.d.ts +43 -8
- package/@types/mergeable-store/with-schemas/index.d.ts +30 -11
- package/@types/queries/index.d.ts +11 -11
- package/@types/queries/with-schemas/index.d.ts +17 -3
- package/@types/schematizers/index.d.ts +6 -4
- package/@types/schematizers/schematizer-arktype/index.d.ts +6 -6
- package/@types/schematizers/schematizer-arktype/with-schemas/index.d.ts +112 -1
- package/@types/schematizers/schematizer-effect/index.d.ts +9 -11
- package/@types/schematizers/schematizer-effect/with-schemas/index.d.ts +114 -1
- package/@types/schematizers/schematizer-typebox/index.d.ts +7 -7
- package/@types/schematizers/schematizer-typebox/with-schemas/index.d.ts +114 -1
- package/@types/schematizers/schematizer-valibot/index.d.ts +6 -6
- package/@types/schematizers/schematizer-valibot/with-schemas/index.d.ts +112 -1
- package/@types/schematizers/schematizer-yup/index.d.ts +5 -4
- package/@types/schematizers/schematizer-yup/with-schemas/index.d.ts +112 -1
- package/@types/schematizers/schematizer-zod/index.d.ts +6 -6
- package/@types/schematizers/schematizer-zod/with-schemas/index.d.ts +112 -1
- package/@types/schematizers/with-schemas/index.d.ts +113 -4
- package/@types/store/index.d.ts +175 -16
- package/@types/store/with-schemas/index.d.ts +238 -55
- package/@types/synchronizers/with-schemas/index.d.ts +12 -2
- package/@types/ui-react/with-schemas/index.d.ts +576 -7
- package/@types/ui-react-dom/index.d.ts +10 -10
- package/@types/ui-react-dom/with-schemas/index.d.ts +94 -10
- package/@types/ui-react-dom-charts/index.d.ts +7 -7
- package/@types/ui-react-dom-charts/with-schemas/index.d.ts +7 -7
- package/@types/ui-react-inspector/index.d.ts +1 -1
- package/@types/ui-react-inspector/with-schemas/index.d.ts +1 -1
- package/@types/ui-solid/with-schemas/index.d.ts +340 -7
- package/@types/ui-solid-dom/index.d.ts +10 -10
- package/@types/ui-solid-dom/with-schemas/index.d.ts +94 -10
- package/@types/ui-solid-inspector/index.d.ts +1 -1
- package/@types/ui-solid-inspector/with-schemas/index.d.ts +1 -1
- package/@types/ui-svelte/with-schemas/index.d.ts +30 -0
- package/@types/ui-svelte-dom/index.d.ts +10 -10
- package/@types/ui-svelte-dom/with-schemas/index.d.ts +94 -10
- package/@types/ui-svelte-inspector/index.d.ts +1 -1
- package/@types/ui-svelte-inspector/with-schemas/index.d.ts +1 -1
- package/agents.md +4 -0
- package/index.js +76 -22
- package/mergeable-store/index.js +76 -22
- package/mergeable-store/with-schemas/index.js +76 -22
- package/min/index.js +1 -1
- package/min/index.js.gz +0 -0
- package/min/mergeable-store/index.js +1 -1
- package/min/mergeable-store/index.js.gz +0 -0
- package/min/mergeable-store/with-schemas/index.js +1 -1
- package/min/mergeable-store/with-schemas/index.js.gz +0 -0
- package/min/omni/index.js +1 -1
- package/min/omni/index.js.gz +0 -0
- package/min/omni/with-schemas/index.js +1 -1
- package/min/omni/with-schemas/index.js.gz +0 -0
- package/min/schematizers/index.js +1 -1
- package/min/schematizers/index.js.gz +0 -0
- package/min/schematizers/schematizer-arktype/index.js +1 -1
- package/min/schematizers/schematizer-arktype/index.js.gz +0 -0
- package/min/schematizers/schematizer-arktype/with-schemas/index.js +1 -1
- package/min/schematizers/schematizer-arktype/with-schemas/index.js.gz +0 -0
- package/min/schematizers/schematizer-effect/index.js +1 -1
- package/min/schematizers/schematizer-effect/index.js.gz +0 -0
- package/min/schematizers/schematizer-effect/with-schemas/index.js +1 -1
- package/min/schematizers/schematizer-effect/with-schemas/index.js.gz +0 -0
- package/min/schematizers/schematizer-typebox/index.js +1 -1
- package/min/schematizers/schematizer-typebox/index.js.gz +0 -0
- package/min/schematizers/schematizer-typebox/with-schemas/index.js +1 -1
- package/min/schematizers/schematizer-typebox/with-schemas/index.js.gz +0 -0
- package/min/schematizers/schematizer-valibot/index.js +1 -1
- package/min/schematizers/schematizer-valibot/index.js.gz +0 -0
- package/min/schematizers/schematizer-valibot/with-schemas/index.js +1 -1
- package/min/schematizers/schematizer-valibot/with-schemas/index.js.gz +0 -0
- package/min/schematizers/schematizer-yup/index.js +1 -1
- package/min/schematizers/schematizer-yup/index.js.gz +0 -0
- package/min/schematizers/schematizer-yup/with-schemas/index.js +1 -1
- package/min/schematizers/schematizer-yup/with-schemas/index.js.gz +0 -0
- package/min/schematizers/schematizer-zod/index.js +1 -1
- package/min/schematizers/schematizer-zod/index.js.gz +0 -0
- package/min/schematizers/schematizer-zod/with-schemas/index.js +1 -1
- package/min/schematizers/schematizer-zod/with-schemas/index.js.gz +0 -0
- package/min/schematizers/with-schemas/index.js +1 -1
- package/min/schematizers/with-schemas/index.js.gz +0 -0
- package/min/store/index.js +1 -1
- package/min/store/index.js.gz +0 -0
- package/min/store/with-schemas/index.js +1 -1
- package/min/store/with-schemas/index.js.gz +0 -0
- package/min/ui-react-inspector/index.js +1 -1
- package/min/ui-react-inspector/index.js.gz +0 -0
- package/min/ui-react-inspector/with-schemas/index.js +1 -1
- package/min/ui-react-inspector/with-schemas/index.js.gz +0 -0
- package/min/ui-solid-inspector/index.js +1 -1
- package/min/ui-solid-inspector/index.js.gz +0 -0
- package/min/ui-solid-inspector/with-schemas/index.js +1 -1
- package/min/ui-solid-inspector/with-schemas/index.js.gz +0 -0
- package/min/ui-svelte-inspector/index.js +1 -1
- package/min/ui-svelte-inspector/index.js.gz +0 -0
- package/min/ui-svelte-inspector/with-schemas/index.js +1 -1
- package/min/ui-svelte-inspector/with-schemas/index.js.gz +0 -0
- package/min/with-schemas/index.js +1 -1
- package/min/with-schemas/index.js.gz +0 -0
- package/omni/index.js +76 -22
- package/omni/with-schemas/index.js +76 -22
- package/package.json +5 -5
- package/readme.md +3 -3
- package/releases.md +32 -2
- package/schematizers/index.js +54 -6
- package/schematizers/schematizer-arktype/index.js +99 -19
- package/schematizers/schematizer-arktype/with-schemas/index.js +99 -19
- package/schematizers/schematizer-effect/index.js +101 -11
- package/schematizers/schematizer-effect/with-schemas/index.js +101 -11
- package/schematizers/schematizer-typebox/index.js +87 -11
- package/schematizers/schematizer-typebox/with-schemas/index.js +87 -11
- package/schematizers/schematizer-valibot/index.js +125 -21
- package/schematizers/schematizer-valibot/with-schemas/index.js +125 -21
- package/schematizers/schematizer-yup/index.js +58 -14
- package/schematizers/schematizer-yup/with-schemas/index.js +58 -14
- package/schematizers/schematizer-zod/index.js +131 -12
- package/schematizers/schematizer-zod/with-schemas/index.js +131 -12
- package/schematizers/with-schemas/index.js +54 -6
- package/store/index.js +76 -22
- package/store/with-schemas/index.js +76 -22
- package/ui-react-inspector/index.js +76 -22
- package/ui-react-inspector/with-schemas/index.js +76 -22
- package/ui-solid-inspector/index.js +76 -22
- package/ui-solid-inspector/with-schemas/index.js +76 -22
- package/ui-svelte/index.js +1 -1
- package/ui-svelte/with-schemas/index.js +1 -1
- package/ui-svelte-dom/index.js +2 -2
- package/ui-svelte-dom/with-schemas/index.js +2 -2
- package/ui-svelte-inspector/index.js +78 -24
- package/ui-svelte-inspector/with-schemas/index.js +78 -24
- package/with-schemas/index.js +76 -22
|
@@ -6,8 +6,10 @@ const NUMBER = getTypeOf(0);
|
|
|
6
6
|
const OBJECT = 'object';
|
|
7
7
|
const ARRAY = 'array';
|
|
8
8
|
const TYPE = 'type';
|
|
9
|
+
const ENUM = 'enum';
|
|
9
10
|
const DEFAULT = 'default';
|
|
10
11
|
const ALLOW_NULL = 'allowNull';
|
|
12
|
+
const NULL = 'null';
|
|
11
13
|
const _VALUE = 'value';
|
|
12
14
|
const DOMAIN = 'domain';
|
|
13
15
|
const KEY = 'key';
|
|
@@ -15,12 +17,15 @@ const OPTIONAL = 'optional';
|
|
|
15
17
|
const REQUIRED = 'required';
|
|
16
18
|
const UNIT = 'unit';
|
|
17
19
|
const SEQUENCE = 'sequence';
|
|
20
|
+
const UNDEFINED = '\uFFFC';
|
|
21
|
+
const JSON_PREFIX = '\uFFFD';
|
|
18
22
|
|
|
19
23
|
const getIfNotFunction = (predicate) => (value, then, otherwise) =>
|
|
20
24
|
predicate(value)
|
|
21
25
|
? /* istanbul ignore next */
|
|
22
26
|
otherwise?.()
|
|
23
27
|
: then(value);
|
|
28
|
+
const isFiniteNumber = isFinite;
|
|
24
29
|
const isNullish = (thing) => thing == null;
|
|
25
30
|
const isUndefined = (thing) => thing === void 0;
|
|
26
31
|
const isNull = (thing) => thing === null;
|
|
@@ -28,12 +33,16 @@ const isTrue = (thing) => thing === true;
|
|
|
28
33
|
const isFalse = (thing) => thing === false;
|
|
29
34
|
const ifNotNullish = getIfNotFunction(isNullish);
|
|
30
35
|
const ifNotUndefined = getIfNotFunction(isUndefined);
|
|
36
|
+
const isTypeStringOrBoolean = (type) => type == STRING || type == BOOLEAN;
|
|
31
37
|
const isString = (thing) => getTypeOf(thing) == STRING;
|
|
32
38
|
const isArray = (thing) => Array.isArray(thing);
|
|
33
39
|
const size = (thing) => thing.length;
|
|
34
40
|
|
|
41
|
+
const arrayIndexOf = (array, value) => array.indexOf(value);
|
|
35
42
|
const arrayEvery = (array, cb) => array.every(cb);
|
|
36
43
|
const arrayForEach = (array, cb) => array.forEach(cb);
|
|
44
|
+
const arrayMap = (array, cb) => array.map(cb);
|
|
45
|
+
const arrayFilter = (array, cb) => array.filter(cb);
|
|
37
46
|
const arrayFind = (array, cb) => array.find(cb);
|
|
38
47
|
|
|
39
48
|
const object = Object;
|
|
@@ -70,6 +79,44 @@ const objForEach = (obj, cb) =>
|
|
|
70
79
|
const objSize = (obj) => size(objIds(obj));
|
|
71
80
|
const objIsEmpty = (obj) => isObject(obj) && objSize(obj) == 0;
|
|
72
81
|
|
|
82
|
+
const getCellOrValueType = (cellOrValue) => {
|
|
83
|
+
if (isNull(cellOrValue)) {
|
|
84
|
+
return NULL;
|
|
85
|
+
}
|
|
86
|
+
if (isArray(cellOrValue)) {
|
|
87
|
+
return ARRAY;
|
|
88
|
+
}
|
|
89
|
+
if (isObject(cellOrValue)) {
|
|
90
|
+
return OBJECT;
|
|
91
|
+
}
|
|
92
|
+
const type = getTypeOf(cellOrValue);
|
|
93
|
+
return isTypeStringOrBoolean(type) ||
|
|
94
|
+
(type == NUMBER && isFiniteNumber(cellOrValue))
|
|
95
|
+
? type
|
|
96
|
+
: void 0;
|
|
97
|
+
};
|
|
98
|
+
const isJsonType = (type) => type == OBJECT || type == ARRAY;
|
|
99
|
+
const isCellOrValueSchemaType = (type) =>
|
|
100
|
+
isTypeStringOrBoolean(type) || type == NUMBER || isJsonType(type);
|
|
101
|
+
const isCellOrValueSchemaTypes = (types) =>
|
|
102
|
+
isArray(types)
|
|
103
|
+
? !isUndefined(types[0]) && arrayEvery(types, isCellOrValueSchemaType)
|
|
104
|
+
: isCellOrValueSchemaType(types);
|
|
105
|
+
const isEncodedJson = (value) => isString(value) && value[0] == JSON_PREFIX;
|
|
106
|
+
const isReservedString = (value, encoded = 0) =>
|
|
107
|
+
value === UNDEFINED || (!encoded && isEncodedJson(value));
|
|
108
|
+
|
|
109
|
+
const getTypeOrTypeUnion = (types) => {
|
|
110
|
+
if (!arrayEvery(types, isCellOrValueSchemaType)) {
|
|
111
|
+
return;
|
|
112
|
+
}
|
|
113
|
+
const uniqueTypes = arrayFilter(
|
|
114
|
+
types,
|
|
115
|
+
(type, index) => arrayIndexOf(types, type) == index,
|
|
116
|
+
);
|
|
117
|
+
return uniqueTypes[1] ? uniqueTypes : uniqueTypes[0];
|
|
118
|
+
};
|
|
119
|
+
|
|
73
120
|
const createCustomSchematizer = (
|
|
74
121
|
unwrapSchema,
|
|
75
122
|
getProperties,
|
|
@@ -79,16 +126,27 @@ const createCustomSchematizer = (
|
|
|
79
126
|
const [unwrapped, defaultValue, allowNull, unwrappedRequired = required] =
|
|
80
127
|
unwrapSchema(schema, void 0, void 0, required);
|
|
81
128
|
const type = unwrapped?.type;
|
|
129
|
+
const enumValues = unwrapped?.[ENUM];
|
|
130
|
+
const isEnum =
|
|
131
|
+
isUndefined(type) &&
|
|
132
|
+
isArray(enumValues) &&
|
|
133
|
+
!isUndefined(enumValues[0]) &&
|
|
134
|
+
arrayEvery(enumValues, (enumValue) => {
|
|
135
|
+
const enumType = getCellOrValueType(enumValue);
|
|
136
|
+
return (
|
|
137
|
+
!isNull(enumValue) &&
|
|
138
|
+
!isUndefined(enumType) &&
|
|
139
|
+
!isJsonType(enumType) &&
|
|
140
|
+
!isReservedString(enumValue)
|
|
141
|
+
);
|
|
142
|
+
});
|
|
82
143
|
if (
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
type !== BOOLEAN &&
|
|
86
|
-
type !== OBJECT &&
|
|
87
|
-
type !== ARRAY
|
|
144
|
+
!isEnum &&
|
|
145
|
+
(!isUndefined(enumValues) || !isCellOrValueSchemaTypes(type))
|
|
88
146
|
) {
|
|
89
147
|
return void 0;
|
|
90
148
|
}
|
|
91
|
-
const cellOrValueSchema = {[TYPE]: type};
|
|
149
|
+
const cellOrValueSchema = isEnum ? {[ENUM]: enumValues} : {[TYPE]: type};
|
|
92
150
|
ifNotUndefined(defaultValue, (defaultValue2) => {
|
|
93
151
|
cellOrValueSchema[DEFAULT] = defaultValue2;
|
|
94
152
|
});
|
|
@@ -138,6 +196,12 @@ const createCustomSchematizer = (
|
|
|
138
196
|
});
|
|
139
197
|
};
|
|
140
198
|
|
|
199
|
+
const getSimpleType = (schema) =>
|
|
200
|
+
!isUndefined(schema?.[UNIT])
|
|
201
|
+
? getCellOrValueType(schema[UNIT])
|
|
202
|
+
: !isUndefined(schema?.[SEQUENCE])
|
|
203
|
+
? ARRAY
|
|
204
|
+
: schema?.[DOMAIN] || schema;
|
|
141
205
|
const unwrapSchema = (schema, defaultValue, allowNull, required = true) => {
|
|
142
206
|
const schemaData = schema?.json ?? schema;
|
|
143
207
|
if (isArray(schemaData)) {
|
|
@@ -152,24 +216,40 @@ const unwrapSchema = (schema, defaultValue, allowNull, required = true) => {
|
|
|
152
216
|
) {
|
|
153
217
|
return [{[TYPE]: BOOLEAN}, defaultValue, allowNull ?? false, required];
|
|
154
218
|
}
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
219
|
+
const enumItems = arrayFilter(
|
|
220
|
+
schemaData,
|
|
221
|
+
(item) => !isNull(item?.[UNIT]) && !isNull(item) && item !== '=',
|
|
222
|
+
);
|
|
223
|
+
if (
|
|
224
|
+
size(enumItems) > 0 &&
|
|
225
|
+
arrayEvery(enumItems, (item) => !isUndefined(item?.[UNIT]))
|
|
226
|
+
) {
|
|
227
|
+
return [
|
|
228
|
+
{[ENUM]: arrayMap(enumItems, (item) => item[UNIT])},
|
|
229
|
+
defaultValue,
|
|
230
|
+
hasNull || allowNull || false,
|
|
231
|
+
required,
|
|
232
|
+
];
|
|
166
233
|
}
|
|
234
|
+
return [
|
|
235
|
+
{
|
|
236
|
+
[TYPE]: getTypeOrTypeUnion(arrayMap(enumItems, getSimpleType)),
|
|
237
|
+
},
|
|
238
|
+
defaultValue,
|
|
239
|
+
hasNull || allowNull || false,
|
|
240
|
+
required,
|
|
241
|
+
];
|
|
167
242
|
}
|
|
168
243
|
if (!isArray(schemaData) && !isUndefined(schemaData?.[SEQUENCE])) {
|
|
169
244
|
return [{[TYPE]: ARRAY}, defaultValue, allowNull ?? false, required];
|
|
170
245
|
}
|
|
171
|
-
if (!isArray(schemaData) &&
|
|
172
|
-
return [
|
|
246
|
+
if (!isArray(schemaData) && !isUndefined(schemaData?.[UNIT])) {
|
|
247
|
+
return [
|
|
248
|
+
{[ENUM]: [schemaData[UNIT]]},
|
|
249
|
+
defaultValue,
|
|
250
|
+
allowNull ?? false,
|
|
251
|
+
required,
|
|
252
|
+
];
|
|
173
253
|
}
|
|
174
254
|
return [
|
|
175
255
|
{[TYPE]: schemaData?.[DOMAIN] || schemaData},
|
|
@@ -6,8 +6,10 @@ const NUMBER = getTypeOf(0);
|
|
|
6
6
|
const OBJECT = 'object';
|
|
7
7
|
const ARRAY = 'array';
|
|
8
8
|
const TYPE = 'type';
|
|
9
|
+
const ENUM = 'enum';
|
|
9
10
|
const DEFAULT = 'default';
|
|
10
11
|
const ALLOW_NULL = 'allowNull';
|
|
12
|
+
const NULL = 'null';
|
|
11
13
|
const REQUIRED = 'required';
|
|
12
14
|
const LITERAL = 'Literal';
|
|
13
15
|
const PROPERTY_SIGNATURES = 'propertySignatures';
|
|
@@ -17,20 +19,30 @@ const BOOLEAN_KEYWORD = 'BooleanKeyword';
|
|
|
17
19
|
const TUPLE_TYPE = 'TupleType';
|
|
18
20
|
const TYPE_LITERAL = 'TypeLiteral';
|
|
19
21
|
const UNION = 'Union';
|
|
22
|
+
const UNDEFINED = '\uFFFC';
|
|
23
|
+
const JSON_PREFIX = '\uFFFD';
|
|
20
24
|
|
|
21
25
|
const getIfNotFunction = (predicate) => (value, then, otherwise) =>
|
|
22
26
|
predicate(value)
|
|
23
27
|
? /* istanbul ignore next */
|
|
24
28
|
otherwise?.()
|
|
25
29
|
: then(value);
|
|
30
|
+
const isFiniteNumber = isFinite;
|
|
26
31
|
const isNullish = (thing) => thing == null;
|
|
27
32
|
const isUndefined = (thing) => thing === void 0;
|
|
28
33
|
const isNull = (thing) => thing === null;
|
|
29
34
|
const ifNotNullish = getIfNotFunction(isNullish);
|
|
30
35
|
const ifNotUndefined = getIfNotFunction(isUndefined);
|
|
36
|
+
const isTypeStringOrBoolean = (type) => type == STRING || type == BOOLEAN;
|
|
37
|
+
const isString = (thing) => getTypeOf(thing) == STRING;
|
|
38
|
+
const isArray = (thing) => Array.isArray(thing);
|
|
31
39
|
const size = (thing) => thing.length;
|
|
32
40
|
|
|
41
|
+
const arrayIndexOf = (array, value) => array.indexOf(value);
|
|
42
|
+
const arrayEvery = (array, cb) => array.every(cb);
|
|
33
43
|
const arrayForEach = (array, cb) => array.forEach(cb);
|
|
44
|
+
const arrayMap = (array, cb) => array.map(cb);
|
|
45
|
+
const arrayFilter = (array, cb) => array.filter(cb);
|
|
34
46
|
const arrayFind = (array, cb) => array.find(cb);
|
|
35
47
|
|
|
36
48
|
const object = Object;
|
|
@@ -67,6 +79,44 @@ const objForEach = (obj, cb) =>
|
|
|
67
79
|
const objSize = (obj) => size(objIds(obj));
|
|
68
80
|
const objIsEmpty = (obj) => isObject(obj) && objSize(obj) == 0;
|
|
69
81
|
|
|
82
|
+
const getCellOrValueType = (cellOrValue) => {
|
|
83
|
+
if (isNull(cellOrValue)) {
|
|
84
|
+
return NULL;
|
|
85
|
+
}
|
|
86
|
+
if (isArray(cellOrValue)) {
|
|
87
|
+
return ARRAY;
|
|
88
|
+
}
|
|
89
|
+
if (isObject(cellOrValue)) {
|
|
90
|
+
return OBJECT;
|
|
91
|
+
}
|
|
92
|
+
const type = getTypeOf(cellOrValue);
|
|
93
|
+
return isTypeStringOrBoolean(type) ||
|
|
94
|
+
(type == NUMBER && isFiniteNumber(cellOrValue))
|
|
95
|
+
? type
|
|
96
|
+
: void 0;
|
|
97
|
+
};
|
|
98
|
+
const isJsonType = (type) => type == OBJECT || type == ARRAY;
|
|
99
|
+
const isCellOrValueSchemaType = (type) =>
|
|
100
|
+
isTypeStringOrBoolean(type) || type == NUMBER || isJsonType(type);
|
|
101
|
+
const isCellOrValueSchemaTypes = (types) =>
|
|
102
|
+
isArray(types)
|
|
103
|
+
? !isUndefined(types[0]) && arrayEvery(types, isCellOrValueSchemaType)
|
|
104
|
+
: isCellOrValueSchemaType(types);
|
|
105
|
+
const isEncodedJson = (value) => isString(value) && value[0] == JSON_PREFIX;
|
|
106
|
+
const isReservedString = (value, encoded = 0) =>
|
|
107
|
+
value === UNDEFINED || (!encoded && isEncodedJson(value));
|
|
108
|
+
|
|
109
|
+
const getTypeOrTypeUnion = (types) => {
|
|
110
|
+
if (!arrayEvery(types, isCellOrValueSchemaType)) {
|
|
111
|
+
return;
|
|
112
|
+
}
|
|
113
|
+
const uniqueTypes = arrayFilter(
|
|
114
|
+
types,
|
|
115
|
+
(type, index) => arrayIndexOf(types, type) == index,
|
|
116
|
+
);
|
|
117
|
+
return uniqueTypes[1] ? uniqueTypes : uniqueTypes[0];
|
|
118
|
+
};
|
|
119
|
+
|
|
70
120
|
const createCustomSchematizer = (
|
|
71
121
|
unwrapSchema,
|
|
72
122
|
getProperties,
|
|
@@ -76,16 +126,27 @@ const createCustomSchematizer = (
|
|
|
76
126
|
const [unwrapped, defaultValue, allowNull, unwrappedRequired = required] =
|
|
77
127
|
unwrapSchema(schema, void 0, void 0, required);
|
|
78
128
|
const type = unwrapped?.type;
|
|
129
|
+
const enumValues = unwrapped?.[ENUM];
|
|
130
|
+
const isEnum =
|
|
131
|
+
isUndefined(type) &&
|
|
132
|
+
isArray(enumValues) &&
|
|
133
|
+
!isUndefined(enumValues[0]) &&
|
|
134
|
+
arrayEvery(enumValues, (enumValue) => {
|
|
135
|
+
const enumType = getCellOrValueType(enumValue);
|
|
136
|
+
return (
|
|
137
|
+
!isNull(enumValue) &&
|
|
138
|
+
!isUndefined(enumType) &&
|
|
139
|
+
!isJsonType(enumType) &&
|
|
140
|
+
!isReservedString(enumValue)
|
|
141
|
+
);
|
|
142
|
+
});
|
|
79
143
|
if (
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
type !== BOOLEAN &&
|
|
83
|
-
type !== OBJECT &&
|
|
84
|
-
type !== ARRAY
|
|
144
|
+
!isEnum &&
|
|
145
|
+
(!isUndefined(enumValues) || !isCellOrValueSchemaTypes(type))
|
|
85
146
|
) {
|
|
86
147
|
return void 0;
|
|
87
148
|
}
|
|
88
|
-
const cellOrValueSchema = {[TYPE]: type};
|
|
149
|
+
const cellOrValueSchema = isEnum ? {[ENUM]: enumValues} : {[TYPE]: type};
|
|
89
150
|
ifNotUndefined(defaultValue, (defaultValue2) => {
|
|
90
151
|
cellOrValueSchema[DEFAULT] = defaultValue2;
|
|
91
152
|
});
|
|
@@ -135,6 +196,7 @@ const createCustomSchematizer = (
|
|
|
135
196
|
});
|
|
136
197
|
};
|
|
137
198
|
|
|
199
|
+
const UNDEFINED_KEYWORD = 'UndefinedKeyword';
|
|
138
200
|
const unwrapSchema = (schema, defaultValue, allowNull, required = true) => {
|
|
139
201
|
const ast = schema.ast || schema;
|
|
140
202
|
const typeAst = ast.type || ast;
|
|
@@ -142,15 +204,43 @@ const unwrapSchema = (schema, defaultValue, allowNull, required = true) => {
|
|
|
142
204
|
const type = typeAst._tag;
|
|
143
205
|
if (type === UNION) {
|
|
144
206
|
const types = typeAst.types;
|
|
145
|
-
const
|
|
207
|
+
const nonNullTypes = arrayFilter(
|
|
146
208
|
types,
|
|
147
|
-
(t) =>
|
|
209
|
+
(t) =>
|
|
210
|
+
!(t._tag === LITERAL && isNull(t.literal)) &&
|
|
211
|
+
t._tag !== UNDEFINED_KEYWORD,
|
|
148
212
|
);
|
|
213
|
+
const hasNull = !!arrayFind(
|
|
214
|
+
types,
|
|
215
|
+
(t) => t._tag === LITERAL && isNull(t.literal),
|
|
216
|
+
);
|
|
217
|
+
if (
|
|
218
|
+
arrayEvery(
|
|
219
|
+
nonNullTypes,
|
|
220
|
+
(t) => t._tag === LITERAL && getSimpleType(t) !== EMPTY_STRING,
|
|
221
|
+
)
|
|
222
|
+
) {
|
|
223
|
+
return [
|
|
224
|
+
{[ENUM]: arrayMap(nonNullTypes, (t) => t.literal)},
|
|
225
|
+
defaultValue,
|
|
226
|
+
allowNull || hasNull,
|
|
227
|
+
required,
|
|
228
|
+
];
|
|
229
|
+
}
|
|
230
|
+
return [
|
|
231
|
+
{
|
|
232
|
+
[TYPE]: getTypeOrTypeUnion(arrayMap(nonNullTypes, getSimpleType)),
|
|
233
|
+
},
|
|
234
|
+
defaultValue,
|
|
235
|
+
allowNull || hasNull,
|
|
236
|
+
required,
|
|
237
|
+
];
|
|
238
|
+
}
|
|
239
|
+
if (type === LITERAL && getSimpleType(typeAst) !== EMPTY_STRING) {
|
|
149
240
|
return [
|
|
150
|
-
{[
|
|
241
|
+
{[ENUM]: [typeAst.literal]},
|
|
151
242
|
defaultValue,
|
|
152
|
-
allowNull ||
|
|
153
|
-
!!arrayFind(types, (t) => t._tag === LITERAL && isNull(t.literal)),
|
|
243
|
+
allowNull || false,
|
|
154
244
|
required,
|
|
155
245
|
];
|
|
156
246
|
}
|
|
@@ -6,8 +6,10 @@ const NUMBER = getTypeOf(0);
|
|
|
6
6
|
const OBJECT = 'object';
|
|
7
7
|
const ARRAY = 'array';
|
|
8
8
|
const TYPE = 'type';
|
|
9
|
+
const ENUM = 'enum';
|
|
9
10
|
const DEFAULT = 'default';
|
|
10
11
|
const ALLOW_NULL = 'allowNull';
|
|
12
|
+
const NULL = 'null';
|
|
11
13
|
const REQUIRED = 'required';
|
|
12
14
|
const LITERAL = 'Literal';
|
|
13
15
|
const PROPERTY_SIGNATURES = 'propertySignatures';
|
|
@@ -17,20 +19,30 @@ const BOOLEAN_KEYWORD = 'BooleanKeyword';
|
|
|
17
19
|
const TUPLE_TYPE = 'TupleType';
|
|
18
20
|
const TYPE_LITERAL = 'TypeLiteral';
|
|
19
21
|
const UNION = 'Union';
|
|
22
|
+
const UNDEFINED = '\uFFFC';
|
|
23
|
+
const JSON_PREFIX = '\uFFFD';
|
|
20
24
|
|
|
21
25
|
const getIfNotFunction = (predicate) => (value, then, otherwise) =>
|
|
22
26
|
predicate(value)
|
|
23
27
|
? /* istanbul ignore next */
|
|
24
28
|
otherwise?.()
|
|
25
29
|
: then(value);
|
|
30
|
+
const isFiniteNumber = isFinite;
|
|
26
31
|
const isNullish = (thing) => thing == null;
|
|
27
32
|
const isUndefined = (thing) => thing === void 0;
|
|
28
33
|
const isNull = (thing) => thing === null;
|
|
29
34
|
const ifNotNullish = getIfNotFunction(isNullish);
|
|
30
35
|
const ifNotUndefined = getIfNotFunction(isUndefined);
|
|
36
|
+
const isTypeStringOrBoolean = (type) => type == STRING || type == BOOLEAN;
|
|
37
|
+
const isString = (thing) => getTypeOf(thing) == STRING;
|
|
38
|
+
const isArray = (thing) => Array.isArray(thing);
|
|
31
39
|
const size = (thing) => thing.length;
|
|
32
40
|
|
|
41
|
+
const arrayIndexOf = (array, value) => array.indexOf(value);
|
|
42
|
+
const arrayEvery = (array, cb) => array.every(cb);
|
|
33
43
|
const arrayForEach = (array, cb) => array.forEach(cb);
|
|
44
|
+
const arrayMap = (array, cb) => array.map(cb);
|
|
45
|
+
const arrayFilter = (array, cb) => array.filter(cb);
|
|
34
46
|
const arrayFind = (array, cb) => array.find(cb);
|
|
35
47
|
|
|
36
48
|
const object = Object;
|
|
@@ -67,6 +79,44 @@ const objForEach = (obj, cb) =>
|
|
|
67
79
|
const objSize = (obj) => size(objIds(obj));
|
|
68
80
|
const objIsEmpty = (obj) => isObject(obj) && objSize(obj) == 0;
|
|
69
81
|
|
|
82
|
+
const getCellOrValueType = (cellOrValue) => {
|
|
83
|
+
if (isNull(cellOrValue)) {
|
|
84
|
+
return NULL;
|
|
85
|
+
}
|
|
86
|
+
if (isArray(cellOrValue)) {
|
|
87
|
+
return ARRAY;
|
|
88
|
+
}
|
|
89
|
+
if (isObject(cellOrValue)) {
|
|
90
|
+
return OBJECT;
|
|
91
|
+
}
|
|
92
|
+
const type = getTypeOf(cellOrValue);
|
|
93
|
+
return isTypeStringOrBoolean(type) ||
|
|
94
|
+
(type == NUMBER && isFiniteNumber(cellOrValue))
|
|
95
|
+
? type
|
|
96
|
+
: void 0;
|
|
97
|
+
};
|
|
98
|
+
const isJsonType = (type) => type == OBJECT || type == ARRAY;
|
|
99
|
+
const isCellOrValueSchemaType = (type) =>
|
|
100
|
+
isTypeStringOrBoolean(type) || type == NUMBER || isJsonType(type);
|
|
101
|
+
const isCellOrValueSchemaTypes = (types) =>
|
|
102
|
+
isArray(types)
|
|
103
|
+
? !isUndefined(types[0]) && arrayEvery(types, isCellOrValueSchemaType)
|
|
104
|
+
: isCellOrValueSchemaType(types);
|
|
105
|
+
const isEncodedJson = (value) => isString(value) && value[0] == JSON_PREFIX;
|
|
106
|
+
const isReservedString = (value, encoded = 0) =>
|
|
107
|
+
value === UNDEFINED || (!encoded && isEncodedJson(value));
|
|
108
|
+
|
|
109
|
+
const getTypeOrTypeUnion = (types) => {
|
|
110
|
+
if (!arrayEvery(types, isCellOrValueSchemaType)) {
|
|
111
|
+
return;
|
|
112
|
+
}
|
|
113
|
+
const uniqueTypes = arrayFilter(
|
|
114
|
+
types,
|
|
115
|
+
(type, index) => arrayIndexOf(types, type) == index,
|
|
116
|
+
);
|
|
117
|
+
return uniqueTypes[1] ? uniqueTypes : uniqueTypes[0];
|
|
118
|
+
};
|
|
119
|
+
|
|
70
120
|
const createCustomSchematizer = (
|
|
71
121
|
unwrapSchema,
|
|
72
122
|
getProperties,
|
|
@@ -76,16 +126,27 @@ const createCustomSchematizer = (
|
|
|
76
126
|
const [unwrapped, defaultValue, allowNull, unwrappedRequired = required] =
|
|
77
127
|
unwrapSchema(schema, void 0, void 0, required);
|
|
78
128
|
const type = unwrapped?.type;
|
|
129
|
+
const enumValues = unwrapped?.[ENUM];
|
|
130
|
+
const isEnum =
|
|
131
|
+
isUndefined(type) &&
|
|
132
|
+
isArray(enumValues) &&
|
|
133
|
+
!isUndefined(enumValues[0]) &&
|
|
134
|
+
arrayEvery(enumValues, (enumValue) => {
|
|
135
|
+
const enumType = getCellOrValueType(enumValue);
|
|
136
|
+
return (
|
|
137
|
+
!isNull(enumValue) &&
|
|
138
|
+
!isUndefined(enumType) &&
|
|
139
|
+
!isJsonType(enumType) &&
|
|
140
|
+
!isReservedString(enumValue)
|
|
141
|
+
);
|
|
142
|
+
});
|
|
79
143
|
if (
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
type !== BOOLEAN &&
|
|
83
|
-
type !== OBJECT &&
|
|
84
|
-
type !== ARRAY
|
|
144
|
+
!isEnum &&
|
|
145
|
+
(!isUndefined(enumValues) || !isCellOrValueSchemaTypes(type))
|
|
85
146
|
) {
|
|
86
147
|
return void 0;
|
|
87
148
|
}
|
|
88
|
-
const cellOrValueSchema = {[TYPE]: type};
|
|
149
|
+
const cellOrValueSchema = isEnum ? {[ENUM]: enumValues} : {[TYPE]: type};
|
|
89
150
|
ifNotUndefined(defaultValue, (defaultValue2) => {
|
|
90
151
|
cellOrValueSchema[DEFAULT] = defaultValue2;
|
|
91
152
|
});
|
|
@@ -135,6 +196,7 @@ const createCustomSchematizer = (
|
|
|
135
196
|
});
|
|
136
197
|
};
|
|
137
198
|
|
|
199
|
+
const UNDEFINED_KEYWORD = 'UndefinedKeyword';
|
|
138
200
|
const unwrapSchema = (schema, defaultValue, allowNull, required = true) => {
|
|
139
201
|
const ast = schema.ast || schema;
|
|
140
202
|
const typeAst = ast.type || ast;
|
|
@@ -142,15 +204,43 @@ const unwrapSchema = (schema, defaultValue, allowNull, required = true) => {
|
|
|
142
204
|
const type = typeAst._tag;
|
|
143
205
|
if (type === UNION) {
|
|
144
206
|
const types = typeAst.types;
|
|
145
|
-
const
|
|
207
|
+
const nonNullTypes = arrayFilter(
|
|
146
208
|
types,
|
|
147
|
-
(t) =>
|
|
209
|
+
(t) =>
|
|
210
|
+
!(t._tag === LITERAL && isNull(t.literal)) &&
|
|
211
|
+
t._tag !== UNDEFINED_KEYWORD,
|
|
148
212
|
);
|
|
213
|
+
const hasNull = !!arrayFind(
|
|
214
|
+
types,
|
|
215
|
+
(t) => t._tag === LITERAL && isNull(t.literal),
|
|
216
|
+
);
|
|
217
|
+
if (
|
|
218
|
+
arrayEvery(
|
|
219
|
+
nonNullTypes,
|
|
220
|
+
(t) => t._tag === LITERAL && getSimpleType(t) !== EMPTY_STRING,
|
|
221
|
+
)
|
|
222
|
+
) {
|
|
223
|
+
return [
|
|
224
|
+
{[ENUM]: arrayMap(nonNullTypes, (t) => t.literal)},
|
|
225
|
+
defaultValue,
|
|
226
|
+
allowNull || hasNull,
|
|
227
|
+
required,
|
|
228
|
+
];
|
|
229
|
+
}
|
|
230
|
+
return [
|
|
231
|
+
{
|
|
232
|
+
[TYPE]: getTypeOrTypeUnion(arrayMap(nonNullTypes, getSimpleType)),
|
|
233
|
+
},
|
|
234
|
+
defaultValue,
|
|
235
|
+
allowNull || hasNull,
|
|
236
|
+
required,
|
|
237
|
+
];
|
|
238
|
+
}
|
|
239
|
+
if (type === LITERAL && getSimpleType(typeAst) !== EMPTY_STRING) {
|
|
149
240
|
return [
|
|
150
|
-
{[
|
|
241
|
+
{[ENUM]: [typeAst.literal]},
|
|
151
242
|
defaultValue,
|
|
152
|
-
allowNull ||
|
|
153
|
-
!!arrayFind(types, (t) => t._tag === LITERAL && isNull(t.literal)),
|
|
243
|
+
allowNull || false,
|
|
154
244
|
required,
|
|
155
245
|
];
|
|
156
246
|
}
|
|
@@ -6,26 +6,36 @@ const NUMBER = getTypeOf(0);
|
|
|
6
6
|
const OBJECT = 'object';
|
|
7
7
|
const ARRAY = 'array';
|
|
8
8
|
const TYPE = 'type';
|
|
9
|
+
const ENUM = 'enum';
|
|
9
10
|
const DEFAULT = 'default';
|
|
10
11
|
const ALLOW_NULL = 'allowNull';
|
|
11
12
|
const NULL = 'null';
|
|
12
13
|
const ANY_OF = 'anyOf';
|
|
13
14
|
const REQUIRED = 'required';
|
|
15
|
+
const UNDEFINED = '\uFFFC';
|
|
16
|
+
const JSON_PREFIX = '\uFFFD';
|
|
14
17
|
|
|
15
18
|
const getIfNotFunction = (predicate) => (value, then, otherwise) =>
|
|
16
19
|
predicate(value)
|
|
17
20
|
? /* istanbul ignore next */
|
|
18
21
|
otherwise?.()
|
|
19
22
|
: then(value);
|
|
23
|
+
const isFiniteNumber = isFinite;
|
|
20
24
|
const isNullish = (thing) => thing == null;
|
|
21
25
|
const isUndefined = (thing) => thing === void 0;
|
|
26
|
+
const isNull = (thing) => thing === null;
|
|
22
27
|
const ifNotNullish = getIfNotFunction(isNullish);
|
|
23
28
|
const ifNotUndefined = getIfNotFunction(isUndefined);
|
|
29
|
+
const isTypeStringOrBoolean = (type) => type == STRING || type == BOOLEAN;
|
|
30
|
+
const isString = (thing) => getTypeOf(thing) == STRING;
|
|
31
|
+
const isArray = (thing) => Array.isArray(thing);
|
|
24
32
|
const size = (thing) => thing.length;
|
|
25
33
|
|
|
26
34
|
const arrayHas = (array, value) => array.includes(value);
|
|
35
|
+
const arrayIndexOf = (array, value) => array.indexOf(value);
|
|
27
36
|
const arrayEvery = (array, cb) => array.every(cb);
|
|
28
37
|
const arrayForEach = (array, cb) => array.forEach(cb);
|
|
38
|
+
const arrayMap = (array, cb) => array.map(cb);
|
|
29
39
|
const arrayFilter = (array, cb) => array.filter(cb);
|
|
30
40
|
const arrayFind = (array, cb) => array.find(cb);
|
|
31
41
|
|
|
@@ -63,6 +73,44 @@ const objForEach = (obj, cb) =>
|
|
|
63
73
|
const objSize = (obj) => size(objIds(obj));
|
|
64
74
|
const objIsEmpty = (obj) => isObject(obj) && objSize(obj) == 0;
|
|
65
75
|
|
|
76
|
+
const getCellOrValueType = (cellOrValue) => {
|
|
77
|
+
if (isNull(cellOrValue)) {
|
|
78
|
+
return NULL;
|
|
79
|
+
}
|
|
80
|
+
if (isArray(cellOrValue)) {
|
|
81
|
+
return ARRAY;
|
|
82
|
+
}
|
|
83
|
+
if (isObject(cellOrValue)) {
|
|
84
|
+
return OBJECT;
|
|
85
|
+
}
|
|
86
|
+
const type = getTypeOf(cellOrValue);
|
|
87
|
+
return isTypeStringOrBoolean(type) ||
|
|
88
|
+
(type == NUMBER && isFiniteNumber(cellOrValue))
|
|
89
|
+
? type
|
|
90
|
+
: void 0;
|
|
91
|
+
};
|
|
92
|
+
const isJsonType = (type) => type == OBJECT || type == ARRAY;
|
|
93
|
+
const isCellOrValueSchemaType = (type) =>
|
|
94
|
+
isTypeStringOrBoolean(type) || type == NUMBER || isJsonType(type);
|
|
95
|
+
const isCellOrValueSchemaTypes = (types) =>
|
|
96
|
+
isArray(types)
|
|
97
|
+
? !isUndefined(types[0]) && arrayEvery(types, isCellOrValueSchemaType)
|
|
98
|
+
: isCellOrValueSchemaType(types);
|
|
99
|
+
const isEncodedJson = (value) => isString(value) && value[0] == JSON_PREFIX;
|
|
100
|
+
const isReservedString = (value, encoded = 0) =>
|
|
101
|
+
value === UNDEFINED || (!encoded && isEncodedJson(value));
|
|
102
|
+
|
|
103
|
+
const getTypeOrTypeUnion = (types) => {
|
|
104
|
+
if (!arrayEvery(types, isCellOrValueSchemaType)) {
|
|
105
|
+
return;
|
|
106
|
+
}
|
|
107
|
+
const uniqueTypes = arrayFilter(
|
|
108
|
+
types,
|
|
109
|
+
(type, index) => arrayIndexOf(types, type) == index,
|
|
110
|
+
);
|
|
111
|
+
return uniqueTypes[1] ? uniqueTypes : uniqueTypes[0];
|
|
112
|
+
};
|
|
113
|
+
|
|
66
114
|
const createCustomSchematizer = (
|
|
67
115
|
unwrapSchema,
|
|
68
116
|
getProperties,
|
|
@@ -72,16 +120,27 @@ const createCustomSchematizer = (
|
|
|
72
120
|
const [unwrapped, defaultValue, allowNull, unwrappedRequired = required] =
|
|
73
121
|
unwrapSchema(schema, void 0, void 0, required);
|
|
74
122
|
const type = unwrapped?.type;
|
|
123
|
+
const enumValues = unwrapped?.[ENUM];
|
|
124
|
+
const isEnum =
|
|
125
|
+
isUndefined(type) &&
|
|
126
|
+
isArray(enumValues) &&
|
|
127
|
+
!isUndefined(enumValues[0]) &&
|
|
128
|
+
arrayEvery(enumValues, (enumValue) => {
|
|
129
|
+
const enumType = getCellOrValueType(enumValue);
|
|
130
|
+
return (
|
|
131
|
+
!isNull(enumValue) &&
|
|
132
|
+
!isUndefined(enumType) &&
|
|
133
|
+
!isJsonType(enumType) &&
|
|
134
|
+
!isReservedString(enumValue)
|
|
135
|
+
);
|
|
136
|
+
});
|
|
75
137
|
if (
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
type !== BOOLEAN &&
|
|
79
|
-
type !== OBJECT &&
|
|
80
|
-
type !== ARRAY
|
|
138
|
+
!isEnum &&
|
|
139
|
+
(!isUndefined(enumValues) || !isCellOrValueSchemaTypes(type))
|
|
81
140
|
) {
|
|
82
141
|
return void 0;
|
|
83
142
|
}
|
|
84
|
-
const cellOrValueSchema = {[TYPE]: type};
|
|
143
|
+
const cellOrValueSchema = isEnum ? {[ENUM]: enumValues} : {[TYPE]: type};
|
|
85
144
|
ifNotUndefined(defaultValue, (defaultValue2) => {
|
|
86
145
|
cellOrValueSchema[DEFAULT] = defaultValue2;
|
|
87
146
|
});
|
|
@@ -132,6 +191,7 @@ const createCustomSchematizer = (
|
|
|
132
191
|
};
|
|
133
192
|
|
|
134
193
|
const TYPEBOX_OPTIONAL = 'Symbol(TypeBox.Optional)';
|
|
194
|
+
const CONST = 'const';
|
|
135
195
|
const isTypeBoxOptional = (schema) =>
|
|
136
196
|
!isUndefined(
|
|
137
197
|
arrayFind(
|
|
@@ -152,15 +212,31 @@ const unwrapSchema = (
|
|
|
152
212
|
const firstNonNullType = nonNullTypes[0];
|
|
153
213
|
if (
|
|
154
214
|
firstNonNullType &&
|
|
155
|
-
arrayEvery(nonNullTypes, (type) => type?.
|
|
215
|
+
arrayEvery(nonNullTypes, (type) => !isUndefined(type?.[CONST]))
|
|
156
216
|
) {
|
|
157
|
-
return
|
|
158
|
-
|
|
217
|
+
return [
|
|
218
|
+
{[ENUM]: arrayMap(nonNullTypes, (type) => type[CONST])},
|
|
159
219
|
defaultValue ?? schema?.[DEFAULT],
|
|
160
|
-
hasNull || allowNull,
|
|
220
|
+
hasNull || (allowNull ?? false),
|
|
161
221
|
required,
|
|
162
|
-
|
|
222
|
+
];
|
|
163
223
|
}
|
|
224
|
+
return [
|
|
225
|
+
{
|
|
226
|
+
type: getTypeOrTypeUnion(arrayMap(nonNullTypes, (type) => type?.type)),
|
|
227
|
+
},
|
|
228
|
+
defaultValue ?? schema?.[DEFAULT],
|
|
229
|
+
hasNull || (allowNull ?? false),
|
|
230
|
+
required,
|
|
231
|
+
];
|
|
232
|
+
}
|
|
233
|
+
if (!isUndefined(schema?.[CONST])) {
|
|
234
|
+
return [
|
|
235
|
+
{[ENUM]: [schema[CONST]]},
|
|
236
|
+
defaultValue ?? schema?.[DEFAULT],
|
|
237
|
+
allowNull ?? false,
|
|
238
|
+
required,
|
|
239
|
+
];
|
|
164
240
|
}
|
|
165
241
|
return [
|
|
166
242
|
schema,
|