fastapi-rtk 2.9.1 → 2.9.2
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/.bundled/jsonforms/cjs/_virtual/index10.cjs +2 -2
- package/dist/.bundled/jsonforms/cjs/_virtual/index6.cjs +2 -2
- package/dist/.bundled/jsonforms/cjs/_virtual/index7.cjs +2 -2
- package/dist/.bundled/jsonforms/cjs/_virtual/index8.cjs +2 -2
- package/dist/.bundled/jsonforms/cjs/_virtual/index9.cjs +2 -2
- package/dist/.bundled/jsonforms/esm/_virtual/index10.mjs +2 -2
- package/dist/.bundled/jsonforms/esm/_virtual/index6.mjs +2 -2
- package/dist/.bundled/jsonforms/esm/_virtual/index7.mjs +2 -2
- package/dist/.bundled/jsonforms/esm/_virtual/index8.mjs +2 -2
- package/dist/.bundled/jsonforms/esm/_virtual/index9.mjs +2 -2
- package/dist/.external/cjs/ajv@8.17.1/ajv/dist/compile/index.cjs +1 -1
- package/dist/.external/cjs/ajv@8.17.1/ajv/dist/vocabularies/applicator/index.cjs +1 -1
- package/dist/.external/cjs/ajv@8.17.1/ajv/dist/vocabularies/core/index.cjs +1 -1
- package/dist/.external/cjs/ajv@8.17.1/ajv/dist/vocabularies/format/index.cjs +1 -1
- package/dist/.external/cjs/ajv@8.17.1/ajv/dist/vocabularies/validation/index.cjs +1 -1
- package/dist/.external/cjs/html-parse-stringify@3.0.1/html-parse-stringify/dist/html-parse-stringify.module.cjs +1 -1
- package/dist/.external/cjs/toposort@2.0.2/toposort/index.cjs +1 -1
- package/dist/.external/cjs/yup@1.7.1/yup/index.esm.cjs +788 -1
- package/dist/.external/esm/ajv@8.17.1/ajv/dist/compile/index.mjs +1 -1
- package/dist/.external/esm/ajv@8.17.1/ajv/dist/vocabularies/applicator/index.mjs +1 -1
- package/dist/.external/esm/ajv@8.17.1/ajv/dist/vocabularies/core/index.mjs +1 -1
- package/dist/.external/esm/ajv@8.17.1/ajv/dist/vocabularies/format/index.mjs +1 -1
- package/dist/.external/esm/ajv@8.17.1/ajv/dist/vocabularies/validation/index.mjs +1 -1
- package/dist/.external/esm/html-parse-stringify@3.0.1/html-parse-stringify/dist/html-parse-stringify.module.mjs +1 -1
- package/dist/.external/esm/toposort@2.0.2/toposort/index.mjs +1 -1
- package/dist/.external/esm/yup@1.7.1/yup/index.esm.mjs +789 -2
- package/dist/api/cjs/ApiProvider/utils/getValidationSchema.cjs +3 -3
- package/dist/api/cjs/_virtual/_commonjsHelpers.cjs +6 -0
- package/dist/api/cjs/_virtual/index.cjs +5 -0
- package/dist/api/esm/ApiProvider/utils/getValidationSchema.mjs +4 -3
- package/dist/api/esm/_virtual/_commonjsHelpers.mjs +6 -0
- package/dist/api/esm/_virtual/index.mjs +5 -0
- package/dist/api/lib/ApiProvider/utils/getValidationSchema.d.ts +1 -1
- package/dist/contexts/cjs/_virtual/index.cjs +5 -4
- package/dist/contexts/cjs/index.cjs +0 -2
- package/dist/contexts/esm/_virtual/index.mjs +5 -3
- package/dist/contexts/esm/index.mjs +1 -3
- package/dist/contexts/lib/index.d.ts +0 -1
- package/dist/core/cjs/Tables/DataGrid/Toolbar/Filter/FilterMenu.cjs +9 -8
- package/dist/core/cjs/_virtual/_commonjsHelpers.cjs +6 -0
- package/dist/core/cjs/_virtual/index6.cjs +4 -2
- package/dist/core/cjs/_virtual/index7.cjs +5 -3
- package/dist/core/cjs/_virtual/index8.cjs +4 -0
- package/dist/core/esm/Tables/DataGrid/Toolbar/Filter/FilterMenu.mjs +9 -8
- package/dist/core/esm/_virtual/_commonjsHelpers.mjs +6 -0
- package/dist/core/esm/_virtual/index6.mjs +5 -2
- package/dist/core/esm/_virtual/index7.mjs +5 -2
- package/dist/core/esm/_virtual/index8.mjs +4 -0
- package/package.json +1 -1
- package/dist/contexts/cjs/_virtual/index5.cjs +0 -6
- package/dist/contexts/esm/_virtual/index5.mjs +0 -7
- /package/dist/{contexts → api}/cjs/_virtual/index2.cjs +0 -0
- /package/dist/{contexts → api}/cjs/_virtual/index3.cjs +0 -0
- /package/dist/{contexts → api}/cjs/_virtual/index4.cjs +0 -0
- /package/dist/{contexts → api}/esm/_virtual/index2.mjs +0 -0
- /package/dist/{contexts → api}/esm/_virtual/index3.mjs +0 -0
- /package/dist/{contexts → api}/esm/_virtual/index4.mjs +0 -0
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
const index = require("../../../../core/cjs/_virtual/index5.cjs");
|
|
4
|
-
require("../../../../core/cjs/_virtual/index6.cjs");
|
|
4
|
+
const index$1 = require("../../../../core/cjs/_virtual/index6.cjs");
|
|
5
|
+
const index$2 = require("../../../../core/cjs/_virtual/index7.cjs");
|
|
5
6
|
const toString = Object.prototype.toString;
|
|
6
7
|
const errorToString = Error.prototype.toString;
|
|
7
8
|
const regExpToString = RegExp.prototype.toString;
|
|
@@ -1138,6 +1139,22 @@ for (const method of ["validate", "validateSync"]) Schema.prototype[`${method}At
|
|
|
1138
1139
|
};
|
|
1139
1140
|
for (const alias of ["equals", "is"]) Schema.prototype[alias] = Schema.prototype.oneOf;
|
|
1140
1141
|
for (const alias of ["not", "nope"]) Schema.prototype[alias] = Schema.prototype.notOneOf;
|
|
1142
|
+
const returnsTrue = () => true;
|
|
1143
|
+
function create$8(spec) {
|
|
1144
|
+
return new MixedSchema(spec);
|
|
1145
|
+
}
|
|
1146
|
+
class MixedSchema extends Schema {
|
|
1147
|
+
constructor(spec) {
|
|
1148
|
+
super(typeof spec === "function" ? {
|
|
1149
|
+
type: "mixed",
|
|
1150
|
+
check: spec
|
|
1151
|
+
} : Object.assign({
|
|
1152
|
+
type: "mixed",
|
|
1153
|
+
check: returnsTrue
|
|
1154
|
+
}, spec));
|
|
1155
|
+
}
|
|
1156
|
+
}
|
|
1157
|
+
create$8.prototype = MixedSchema.prototype;
|
|
1141
1158
|
const isoReg = /^(\d{4}|[+-]\d{6})(?:-?(\d{2})(?:-?(\d{2}))?)?(?:[ T]?(\d{2}):?(\d{2})(?::?(\d{2})(?:[,.](\d{1,}))?)?(?:(Z)|([+-])(\d{2})(?::?(\d{2}))?)?)?$/;
|
|
1142
1159
|
function parseIsoDate(date2) {
|
|
1143
1160
|
const struct = parseDateStruct(date2);
|
|
@@ -1177,6 +1194,223 @@ function parseDateStruct(date2) {
|
|
|
1177
1194
|
function toNumber(str, defaultValue = 0) {
|
|
1178
1195
|
return Number(str) || defaultValue;
|
|
1179
1196
|
}
|
|
1197
|
+
let rEmail = (
|
|
1198
|
+
// eslint-disable-next-line
|
|
1199
|
+
/^[a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/
|
|
1200
|
+
);
|
|
1201
|
+
let rUrl = (
|
|
1202
|
+
// eslint-disable-next-line
|
|
1203
|
+
/^((https?|ftp):)?\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(\#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i
|
|
1204
|
+
);
|
|
1205
|
+
let rUUID = /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;
|
|
1206
|
+
let yearMonthDay = "^\\d{4}-\\d{2}-\\d{2}";
|
|
1207
|
+
let hourMinuteSecond = "\\d{2}:\\d{2}:\\d{2}";
|
|
1208
|
+
let zOrOffset = "(([+-]\\d{2}(:?\\d{2})?)|Z)";
|
|
1209
|
+
let rIsoDateTime = new RegExp(`${yearMonthDay}T${hourMinuteSecond}(\\.\\d+)?${zOrOffset}$`);
|
|
1210
|
+
let isTrimmed = (value) => isAbsent(value) || value === value.trim();
|
|
1211
|
+
let objStringTag = {}.toString();
|
|
1212
|
+
function create$6() {
|
|
1213
|
+
return new StringSchema();
|
|
1214
|
+
}
|
|
1215
|
+
class StringSchema extends Schema {
|
|
1216
|
+
constructor() {
|
|
1217
|
+
super({
|
|
1218
|
+
type: "string",
|
|
1219
|
+
check(value) {
|
|
1220
|
+
if (value instanceof String) value = value.valueOf();
|
|
1221
|
+
return typeof value === "string";
|
|
1222
|
+
}
|
|
1223
|
+
});
|
|
1224
|
+
this.withMutation(() => {
|
|
1225
|
+
this.transform((value, _raw) => {
|
|
1226
|
+
if (!this.spec.coerce || this.isType(value)) return value;
|
|
1227
|
+
if (Array.isArray(value)) return value;
|
|
1228
|
+
const strValue = value != null && value.toString ? value.toString() : value;
|
|
1229
|
+
if (strValue === objStringTag) return value;
|
|
1230
|
+
return strValue;
|
|
1231
|
+
});
|
|
1232
|
+
});
|
|
1233
|
+
}
|
|
1234
|
+
required(message) {
|
|
1235
|
+
return super.required(message).withMutation((schema) => schema.test({
|
|
1236
|
+
message: message || mixed.required,
|
|
1237
|
+
name: "required",
|
|
1238
|
+
skipAbsent: true,
|
|
1239
|
+
test: (value) => !!value.length
|
|
1240
|
+
}));
|
|
1241
|
+
}
|
|
1242
|
+
notRequired() {
|
|
1243
|
+
return super.notRequired().withMutation((schema) => {
|
|
1244
|
+
schema.tests = schema.tests.filter((t) => t.OPTIONS.name !== "required");
|
|
1245
|
+
return schema;
|
|
1246
|
+
});
|
|
1247
|
+
}
|
|
1248
|
+
length(length, message = string.length) {
|
|
1249
|
+
return this.test({
|
|
1250
|
+
message,
|
|
1251
|
+
name: "length",
|
|
1252
|
+
exclusive: true,
|
|
1253
|
+
params: {
|
|
1254
|
+
length
|
|
1255
|
+
},
|
|
1256
|
+
skipAbsent: true,
|
|
1257
|
+
test(value) {
|
|
1258
|
+
return value.length === this.resolve(length);
|
|
1259
|
+
}
|
|
1260
|
+
});
|
|
1261
|
+
}
|
|
1262
|
+
min(min, message = string.min) {
|
|
1263
|
+
return this.test({
|
|
1264
|
+
message,
|
|
1265
|
+
name: "min",
|
|
1266
|
+
exclusive: true,
|
|
1267
|
+
params: {
|
|
1268
|
+
min
|
|
1269
|
+
},
|
|
1270
|
+
skipAbsent: true,
|
|
1271
|
+
test(value) {
|
|
1272
|
+
return value.length >= this.resolve(min);
|
|
1273
|
+
}
|
|
1274
|
+
});
|
|
1275
|
+
}
|
|
1276
|
+
max(max, message = string.max) {
|
|
1277
|
+
return this.test({
|
|
1278
|
+
name: "max",
|
|
1279
|
+
exclusive: true,
|
|
1280
|
+
message,
|
|
1281
|
+
params: {
|
|
1282
|
+
max
|
|
1283
|
+
},
|
|
1284
|
+
skipAbsent: true,
|
|
1285
|
+
test(value) {
|
|
1286
|
+
return value.length <= this.resolve(max);
|
|
1287
|
+
}
|
|
1288
|
+
});
|
|
1289
|
+
}
|
|
1290
|
+
matches(regex, options) {
|
|
1291
|
+
let excludeEmptyString = false;
|
|
1292
|
+
let message;
|
|
1293
|
+
let name;
|
|
1294
|
+
if (options) {
|
|
1295
|
+
if (typeof options === "object") {
|
|
1296
|
+
({
|
|
1297
|
+
excludeEmptyString = false,
|
|
1298
|
+
message,
|
|
1299
|
+
name
|
|
1300
|
+
} = options);
|
|
1301
|
+
} else {
|
|
1302
|
+
message = options;
|
|
1303
|
+
}
|
|
1304
|
+
}
|
|
1305
|
+
return this.test({
|
|
1306
|
+
name: name || "matches",
|
|
1307
|
+
message: message || string.matches,
|
|
1308
|
+
params: {
|
|
1309
|
+
regex
|
|
1310
|
+
},
|
|
1311
|
+
skipAbsent: true,
|
|
1312
|
+
test: (value) => value === "" && excludeEmptyString || value.search(regex) !== -1
|
|
1313
|
+
});
|
|
1314
|
+
}
|
|
1315
|
+
email(message = string.email) {
|
|
1316
|
+
return this.matches(rEmail, {
|
|
1317
|
+
name: "email",
|
|
1318
|
+
message,
|
|
1319
|
+
excludeEmptyString: true
|
|
1320
|
+
});
|
|
1321
|
+
}
|
|
1322
|
+
url(message = string.url) {
|
|
1323
|
+
return this.matches(rUrl, {
|
|
1324
|
+
name: "url",
|
|
1325
|
+
message,
|
|
1326
|
+
excludeEmptyString: true
|
|
1327
|
+
});
|
|
1328
|
+
}
|
|
1329
|
+
uuid(message = string.uuid) {
|
|
1330
|
+
return this.matches(rUUID, {
|
|
1331
|
+
name: "uuid",
|
|
1332
|
+
message,
|
|
1333
|
+
excludeEmptyString: false
|
|
1334
|
+
});
|
|
1335
|
+
}
|
|
1336
|
+
datetime(options) {
|
|
1337
|
+
let message = "";
|
|
1338
|
+
let allowOffset;
|
|
1339
|
+
let precision;
|
|
1340
|
+
if (options) {
|
|
1341
|
+
if (typeof options === "object") {
|
|
1342
|
+
({
|
|
1343
|
+
message = "",
|
|
1344
|
+
allowOffset = false,
|
|
1345
|
+
precision = void 0
|
|
1346
|
+
} = options);
|
|
1347
|
+
} else {
|
|
1348
|
+
message = options;
|
|
1349
|
+
}
|
|
1350
|
+
}
|
|
1351
|
+
return this.matches(rIsoDateTime, {
|
|
1352
|
+
name: "datetime",
|
|
1353
|
+
message: message || string.datetime,
|
|
1354
|
+
excludeEmptyString: true
|
|
1355
|
+
}).test({
|
|
1356
|
+
name: "datetime_offset",
|
|
1357
|
+
message: message || string.datetime_offset,
|
|
1358
|
+
params: {
|
|
1359
|
+
allowOffset
|
|
1360
|
+
},
|
|
1361
|
+
skipAbsent: true,
|
|
1362
|
+
test: (value) => {
|
|
1363
|
+
if (!value || allowOffset) return true;
|
|
1364
|
+
const struct = parseDateStruct(value);
|
|
1365
|
+
if (!struct) return false;
|
|
1366
|
+
return !!struct.z;
|
|
1367
|
+
}
|
|
1368
|
+
}).test({
|
|
1369
|
+
name: "datetime_precision",
|
|
1370
|
+
message: message || string.datetime_precision,
|
|
1371
|
+
params: {
|
|
1372
|
+
precision
|
|
1373
|
+
},
|
|
1374
|
+
skipAbsent: true,
|
|
1375
|
+
test: (value) => {
|
|
1376
|
+
if (!value || precision == void 0) return true;
|
|
1377
|
+
const struct = parseDateStruct(value);
|
|
1378
|
+
if (!struct) return false;
|
|
1379
|
+
return struct.precision === precision;
|
|
1380
|
+
}
|
|
1381
|
+
});
|
|
1382
|
+
}
|
|
1383
|
+
//-- transforms --
|
|
1384
|
+
ensure() {
|
|
1385
|
+
return this.default("").transform((val) => val === null ? "" : val);
|
|
1386
|
+
}
|
|
1387
|
+
trim(message = string.trim) {
|
|
1388
|
+
return this.transform((val) => val != null ? val.trim() : val).test({
|
|
1389
|
+
message,
|
|
1390
|
+
name: "trim",
|
|
1391
|
+
test: isTrimmed
|
|
1392
|
+
});
|
|
1393
|
+
}
|
|
1394
|
+
lowercase(message = string.lowercase) {
|
|
1395
|
+
return this.transform((value) => !isAbsent(value) ? value.toLowerCase() : value).test({
|
|
1396
|
+
message,
|
|
1397
|
+
name: "string_case",
|
|
1398
|
+
exclusive: true,
|
|
1399
|
+
skipAbsent: true,
|
|
1400
|
+
test: (value) => isAbsent(value) || value === value.toLowerCase()
|
|
1401
|
+
});
|
|
1402
|
+
}
|
|
1403
|
+
uppercase(message = string.uppercase) {
|
|
1404
|
+
return this.transform((value) => !isAbsent(value) ? value.toUpperCase() : value).test({
|
|
1405
|
+
message,
|
|
1406
|
+
name: "string_case",
|
|
1407
|
+
exclusive: true,
|
|
1408
|
+
skipAbsent: true,
|
|
1409
|
+
test: (value) => isAbsent(value) || value === value.toUpperCase()
|
|
1410
|
+
});
|
|
1411
|
+
}
|
|
1412
|
+
}
|
|
1413
|
+
create$6.prototype = StringSchema.prototype;
|
|
1180
1414
|
let invalidDate = /* @__PURE__ */ new Date("");
|
|
1181
1415
|
let isDate = (obj) => Object.prototype.toString.call(obj) === "[object Date]";
|
|
1182
1416
|
class DateSchema extends Schema {
|
|
@@ -1238,9 +1472,562 @@ class DateSchema extends Schema {
|
|
|
1238
1472
|
}
|
|
1239
1473
|
}
|
|
1240
1474
|
DateSchema.INVALID_DATE = invalidDate;
|
|
1475
|
+
function sortFields(fields, excludedEdges = []) {
|
|
1476
|
+
let edges = [];
|
|
1477
|
+
let nodes = /* @__PURE__ */ new Set();
|
|
1478
|
+
let excludes = new Set(excludedEdges.map(([a, b]) => `${a}-${b}`));
|
|
1479
|
+
function addNode(depPath, key) {
|
|
1480
|
+
let node = index.propertyExprExports.split(depPath)[0];
|
|
1481
|
+
nodes.add(node);
|
|
1482
|
+
if (!excludes.has(`${key}-${node}`)) edges.push([key, node]);
|
|
1483
|
+
}
|
|
1484
|
+
for (const key of Object.keys(fields)) {
|
|
1485
|
+
let value = fields[key];
|
|
1486
|
+
nodes.add(key);
|
|
1487
|
+
if (Reference.isRef(value) && value.isSibling) addNode(value.path, key);
|
|
1488
|
+
else if (isSchema(value) && "deps" in value) value.deps.forEach((path) => addNode(path, key));
|
|
1489
|
+
}
|
|
1490
|
+
return index$2.array(Array.from(nodes), edges).reverse();
|
|
1491
|
+
}
|
|
1492
|
+
function findIndex(arr, err) {
|
|
1493
|
+
let idx = Infinity;
|
|
1494
|
+
arr.some((key, ii) => {
|
|
1495
|
+
var _err$path;
|
|
1496
|
+
if ((_err$path = err.path) != null && _err$path.includes(key)) {
|
|
1497
|
+
idx = ii;
|
|
1498
|
+
return true;
|
|
1499
|
+
}
|
|
1500
|
+
});
|
|
1501
|
+
return idx;
|
|
1502
|
+
}
|
|
1503
|
+
function sortByKeyOrder(keys) {
|
|
1504
|
+
return (a, b) => {
|
|
1505
|
+
return findIndex(keys, a) - findIndex(keys, b);
|
|
1506
|
+
};
|
|
1507
|
+
}
|
|
1508
|
+
const parseJson = (value, _, schema) => {
|
|
1509
|
+
if (typeof value !== "string") {
|
|
1510
|
+
return value;
|
|
1511
|
+
}
|
|
1512
|
+
let parsed = value;
|
|
1513
|
+
try {
|
|
1514
|
+
parsed = JSON.parse(value);
|
|
1515
|
+
} catch (err) {
|
|
1516
|
+
}
|
|
1517
|
+
return schema.isType(parsed) ? parsed : value;
|
|
1518
|
+
};
|
|
1519
|
+
function deepPartial(schema) {
|
|
1520
|
+
if ("fields" in schema) {
|
|
1521
|
+
const partial = {};
|
|
1522
|
+
for (const [key, fieldSchema] of Object.entries(schema.fields)) {
|
|
1523
|
+
partial[key] = deepPartial(fieldSchema);
|
|
1524
|
+
}
|
|
1525
|
+
return schema.setFields(partial);
|
|
1526
|
+
}
|
|
1527
|
+
if (schema.type === "array") {
|
|
1528
|
+
const nextArray = schema.optional();
|
|
1529
|
+
if (nextArray.innerType) nextArray.innerType = deepPartial(nextArray.innerType);
|
|
1530
|
+
return nextArray;
|
|
1531
|
+
}
|
|
1532
|
+
if (schema.type === "tuple") {
|
|
1533
|
+
return schema.optional().clone({
|
|
1534
|
+
types: schema.spec.types.map(deepPartial)
|
|
1535
|
+
});
|
|
1536
|
+
}
|
|
1537
|
+
if ("optional" in schema) {
|
|
1538
|
+
return schema.optional();
|
|
1539
|
+
}
|
|
1540
|
+
return schema;
|
|
1541
|
+
}
|
|
1542
|
+
const deepHas = (obj, p) => {
|
|
1543
|
+
const path = [...index.propertyExprExports.normalizePath(p)];
|
|
1544
|
+
if (path.length === 1) return path[0] in obj;
|
|
1545
|
+
let last = path.pop();
|
|
1546
|
+
let parent = index.propertyExprExports.getter(index.propertyExprExports.join(path), true)(obj);
|
|
1547
|
+
return !!(parent && last in parent);
|
|
1548
|
+
};
|
|
1549
|
+
let isObject = (obj) => Object.prototype.toString.call(obj) === "[object Object]";
|
|
1550
|
+
function unknown(ctx, value) {
|
|
1551
|
+
let known = Object.keys(ctx.fields);
|
|
1552
|
+
return Object.keys(value).filter((key) => known.indexOf(key) === -1);
|
|
1553
|
+
}
|
|
1554
|
+
const defaultSort = sortByKeyOrder([]);
|
|
1555
|
+
function create$3(spec) {
|
|
1556
|
+
return new ObjectSchema(spec);
|
|
1557
|
+
}
|
|
1558
|
+
class ObjectSchema extends Schema {
|
|
1559
|
+
constructor(spec) {
|
|
1560
|
+
super({
|
|
1561
|
+
type: "object",
|
|
1562
|
+
check(value) {
|
|
1563
|
+
return isObject(value) || typeof value === "function";
|
|
1564
|
+
}
|
|
1565
|
+
});
|
|
1566
|
+
this.fields = /* @__PURE__ */ Object.create(null);
|
|
1567
|
+
this._sortErrors = defaultSort;
|
|
1568
|
+
this._nodes = [];
|
|
1569
|
+
this._excludedEdges = [];
|
|
1570
|
+
this.withMutation(() => {
|
|
1571
|
+
if (spec) {
|
|
1572
|
+
this.shape(spec);
|
|
1573
|
+
}
|
|
1574
|
+
});
|
|
1575
|
+
}
|
|
1576
|
+
_cast(_value, options = {}) {
|
|
1577
|
+
var _options$stripUnknown;
|
|
1578
|
+
let value = super._cast(_value, options);
|
|
1579
|
+
if (value === void 0) return this.getDefault(options);
|
|
1580
|
+
if (!this._typeCheck(value)) return value;
|
|
1581
|
+
let fields = this.fields;
|
|
1582
|
+
let strip = (_options$stripUnknown = options.stripUnknown) != null ? _options$stripUnknown : this.spec.noUnknown;
|
|
1583
|
+
let props = [].concat(this._nodes, Object.keys(value).filter((v) => !this._nodes.includes(v)));
|
|
1584
|
+
let intermediateValue = {};
|
|
1585
|
+
let innerOptions = Object.assign({}, options, {
|
|
1586
|
+
parent: intermediateValue,
|
|
1587
|
+
__validating: options.__validating || false
|
|
1588
|
+
});
|
|
1589
|
+
let isChanged = false;
|
|
1590
|
+
for (const prop of props) {
|
|
1591
|
+
let field = fields[prop];
|
|
1592
|
+
let exists = prop in value;
|
|
1593
|
+
let inputValue = value[prop];
|
|
1594
|
+
if (field) {
|
|
1595
|
+
let fieldValue;
|
|
1596
|
+
innerOptions.path = (options.path ? `${options.path}.` : "") + prop;
|
|
1597
|
+
field = field.resolve({
|
|
1598
|
+
value: inputValue,
|
|
1599
|
+
context: options.context,
|
|
1600
|
+
parent: intermediateValue
|
|
1601
|
+
});
|
|
1602
|
+
let fieldSpec = field instanceof Schema ? field.spec : void 0;
|
|
1603
|
+
let strict = fieldSpec == null ? void 0 : fieldSpec.strict;
|
|
1604
|
+
if (fieldSpec != null && fieldSpec.strip) {
|
|
1605
|
+
isChanged = isChanged || prop in value;
|
|
1606
|
+
continue;
|
|
1607
|
+
}
|
|
1608
|
+
fieldValue = !options.__validating || !strict ? field.cast(inputValue, innerOptions) : inputValue;
|
|
1609
|
+
if (fieldValue !== void 0) {
|
|
1610
|
+
intermediateValue[prop] = fieldValue;
|
|
1611
|
+
}
|
|
1612
|
+
} else if (exists && !strip) {
|
|
1613
|
+
intermediateValue[prop] = inputValue;
|
|
1614
|
+
}
|
|
1615
|
+
if (exists !== prop in intermediateValue || intermediateValue[prop] !== inputValue) {
|
|
1616
|
+
isChanged = true;
|
|
1617
|
+
}
|
|
1618
|
+
}
|
|
1619
|
+
return isChanged ? intermediateValue : value;
|
|
1620
|
+
}
|
|
1621
|
+
_validate(_value, options = {}, panic, next) {
|
|
1622
|
+
let {
|
|
1623
|
+
from = [],
|
|
1624
|
+
originalValue = _value,
|
|
1625
|
+
recursive = this.spec.recursive
|
|
1626
|
+
} = options;
|
|
1627
|
+
options.from = [{
|
|
1628
|
+
schema: this,
|
|
1629
|
+
value: originalValue
|
|
1630
|
+
}, ...from];
|
|
1631
|
+
options.__validating = true;
|
|
1632
|
+
options.originalValue = originalValue;
|
|
1633
|
+
super._validate(_value, options, panic, (objectErrors, value) => {
|
|
1634
|
+
if (!recursive || !isObject(value)) {
|
|
1635
|
+
next(objectErrors, value);
|
|
1636
|
+
return;
|
|
1637
|
+
}
|
|
1638
|
+
originalValue = originalValue || value;
|
|
1639
|
+
let tests = [];
|
|
1640
|
+
for (let key of this._nodes) {
|
|
1641
|
+
let field = this.fields[key];
|
|
1642
|
+
if (!field || Reference.isRef(field)) {
|
|
1643
|
+
continue;
|
|
1644
|
+
}
|
|
1645
|
+
tests.push(field.asNestedTest({
|
|
1646
|
+
options,
|
|
1647
|
+
key,
|
|
1648
|
+
parent: value,
|
|
1649
|
+
parentPath: options.path,
|
|
1650
|
+
originalParent: originalValue
|
|
1651
|
+
}));
|
|
1652
|
+
}
|
|
1653
|
+
this.runTests({
|
|
1654
|
+
tests,
|
|
1655
|
+
value,
|
|
1656
|
+
originalValue,
|
|
1657
|
+
options
|
|
1658
|
+
}, panic, (fieldErrors) => {
|
|
1659
|
+
next(fieldErrors.sort(this._sortErrors).concat(objectErrors), value);
|
|
1660
|
+
});
|
|
1661
|
+
});
|
|
1662
|
+
}
|
|
1663
|
+
clone(spec) {
|
|
1664
|
+
const next = super.clone(spec);
|
|
1665
|
+
next.fields = Object.assign({}, this.fields);
|
|
1666
|
+
next._nodes = this._nodes;
|
|
1667
|
+
next._excludedEdges = this._excludedEdges;
|
|
1668
|
+
next._sortErrors = this._sortErrors;
|
|
1669
|
+
return next;
|
|
1670
|
+
}
|
|
1671
|
+
concat(schema) {
|
|
1672
|
+
let next = super.concat(schema);
|
|
1673
|
+
let nextFields = next.fields;
|
|
1674
|
+
for (let [field, schemaOrRef] of Object.entries(this.fields)) {
|
|
1675
|
+
const target = nextFields[field];
|
|
1676
|
+
nextFields[field] = target === void 0 ? schemaOrRef : target;
|
|
1677
|
+
}
|
|
1678
|
+
return next.withMutation((s) => (
|
|
1679
|
+
// XXX: excludes here is wrong
|
|
1680
|
+
s.setFields(nextFields, [...this._excludedEdges, ...schema._excludedEdges])
|
|
1681
|
+
));
|
|
1682
|
+
}
|
|
1683
|
+
_getDefault(options) {
|
|
1684
|
+
if ("default" in this.spec) {
|
|
1685
|
+
return super._getDefault(options);
|
|
1686
|
+
}
|
|
1687
|
+
if (!this._nodes.length) {
|
|
1688
|
+
return void 0;
|
|
1689
|
+
}
|
|
1690
|
+
let dft = {};
|
|
1691
|
+
this._nodes.forEach((key) => {
|
|
1692
|
+
var _innerOptions;
|
|
1693
|
+
const field = this.fields[key];
|
|
1694
|
+
let innerOptions = options;
|
|
1695
|
+
if ((_innerOptions = innerOptions) != null && _innerOptions.value) {
|
|
1696
|
+
innerOptions = Object.assign({}, innerOptions, {
|
|
1697
|
+
parent: innerOptions.value,
|
|
1698
|
+
value: innerOptions.value[key]
|
|
1699
|
+
});
|
|
1700
|
+
}
|
|
1701
|
+
dft[key] = field && "getDefault" in field ? field.getDefault(innerOptions) : void 0;
|
|
1702
|
+
});
|
|
1703
|
+
return dft;
|
|
1704
|
+
}
|
|
1705
|
+
setFields(shape, excludedEdges) {
|
|
1706
|
+
let next = this.clone();
|
|
1707
|
+
next.fields = shape;
|
|
1708
|
+
next._nodes = sortFields(shape, excludedEdges);
|
|
1709
|
+
next._sortErrors = sortByKeyOrder(Object.keys(shape));
|
|
1710
|
+
if (excludedEdges) next._excludedEdges = excludedEdges;
|
|
1711
|
+
return next;
|
|
1712
|
+
}
|
|
1713
|
+
shape(additions, excludes = []) {
|
|
1714
|
+
return this.clone().withMutation((next) => {
|
|
1715
|
+
let edges = next._excludedEdges;
|
|
1716
|
+
if (excludes.length) {
|
|
1717
|
+
if (!Array.isArray(excludes[0])) excludes = [excludes];
|
|
1718
|
+
edges = [...next._excludedEdges, ...excludes];
|
|
1719
|
+
}
|
|
1720
|
+
return next.setFields(Object.assign(next.fields, additions), edges);
|
|
1721
|
+
});
|
|
1722
|
+
}
|
|
1723
|
+
partial() {
|
|
1724
|
+
const partial = {};
|
|
1725
|
+
for (const [key, schema] of Object.entries(this.fields)) {
|
|
1726
|
+
partial[key] = "optional" in schema && schema.optional instanceof Function ? schema.optional() : schema;
|
|
1727
|
+
}
|
|
1728
|
+
return this.setFields(partial);
|
|
1729
|
+
}
|
|
1730
|
+
deepPartial() {
|
|
1731
|
+
const next = deepPartial(this);
|
|
1732
|
+
return next;
|
|
1733
|
+
}
|
|
1734
|
+
pick(keys) {
|
|
1735
|
+
const picked = {};
|
|
1736
|
+
for (const key of keys) {
|
|
1737
|
+
if (this.fields[key]) picked[key] = this.fields[key];
|
|
1738
|
+
}
|
|
1739
|
+
return this.setFields(picked, this._excludedEdges.filter(([a, b]) => keys.includes(a) && keys.includes(b)));
|
|
1740
|
+
}
|
|
1741
|
+
omit(keys) {
|
|
1742
|
+
const remaining = [];
|
|
1743
|
+
for (const key of Object.keys(this.fields)) {
|
|
1744
|
+
if (keys.includes(key)) continue;
|
|
1745
|
+
remaining.push(key);
|
|
1746
|
+
}
|
|
1747
|
+
return this.pick(remaining);
|
|
1748
|
+
}
|
|
1749
|
+
from(from, to, alias) {
|
|
1750
|
+
let fromGetter = index.propertyExprExports.getter(from, true);
|
|
1751
|
+
return this.transform((obj) => {
|
|
1752
|
+
if (!obj) return obj;
|
|
1753
|
+
let newObj = obj;
|
|
1754
|
+
if (deepHas(obj, from)) {
|
|
1755
|
+
newObj = Object.assign({}, obj);
|
|
1756
|
+
if (!alias) delete newObj[from];
|
|
1757
|
+
newObj[to] = fromGetter(obj);
|
|
1758
|
+
}
|
|
1759
|
+
return newObj;
|
|
1760
|
+
});
|
|
1761
|
+
}
|
|
1762
|
+
/** Parse an input JSON string to an object */
|
|
1763
|
+
json() {
|
|
1764
|
+
return this.transform(parseJson);
|
|
1765
|
+
}
|
|
1766
|
+
/**
|
|
1767
|
+
* Similar to `noUnknown` but only validates that an object is the right shape without stripping the unknown keys
|
|
1768
|
+
*/
|
|
1769
|
+
exact(message) {
|
|
1770
|
+
return this.test({
|
|
1771
|
+
name: "exact",
|
|
1772
|
+
exclusive: true,
|
|
1773
|
+
message: message || object.exact,
|
|
1774
|
+
test(value) {
|
|
1775
|
+
if (value == null) return true;
|
|
1776
|
+
const unknownKeys = unknown(this.schema, value);
|
|
1777
|
+
return unknownKeys.length === 0 || this.createError({
|
|
1778
|
+
params: {
|
|
1779
|
+
properties: unknownKeys.join(", ")
|
|
1780
|
+
}
|
|
1781
|
+
});
|
|
1782
|
+
}
|
|
1783
|
+
});
|
|
1784
|
+
}
|
|
1785
|
+
stripUnknown() {
|
|
1786
|
+
return this.clone({
|
|
1787
|
+
noUnknown: true
|
|
1788
|
+
});
|
|
1789
|
+
}
|
|
1790
|
+
noUnknown(noAllow = true, message = object.noUnknown) {
|
|
1791
|
+
if (typeof noAllow !== "boolean") {
|
|
1792
|
+
message = noAllow;
|
|
1793
|
+
noAllow = true;
|
|
1794
|
+
}
|
|
1795
|
+
let next = this.test({
|
|
1796
|
+
name: "noUnknown",
|
|
1797
|
+
exclusive: true,
|
|
1798
|
+
message,
|
|
1799
|
+
test(value) {
|
|
1800
|
+
if (value == null) return true;
|
|
1801
|
+
const unknownKeys = unknown(this.schema, value);
|
|
1802
|
+
return !noAllow || unknownKeys.length === 0 || this.createError({
|
|
1803
|
+
params: {
|
|
1804
|
+
unknown: unknownKeys.join(", ")
|
|
1805
|
+
}
|
|
1806
|
+
});
|
|
1807
|
+
}
|
|
1808
|
+
});
|
|
1809
|
+
next.spec.noUnknown = noAllow;
|
|
1810
|
+
return next;
|
|
1811
|
+
}
|
|
1812
|
+
unknown(allow = true, message = object.noUnknown) {
|
|
1813
|
+
return this.noUnknown(!allow, message);
|
|
1814
|
+
}
|
|
1815
|
+
transformKeys(fn) {
|
|
1816
|
+
return this.transform((obj) => {
|
|
1817
|
+
if (!obj) return obj;
|
|
1818
|
+
const result = {};
|
|
1819
|
+
for (const key of Object.keys(obj)) result[fn(key)] = obj[key];
|
|
1820
|
+
return result;
|
|
1821
|
+
});
|
|
1822
|
+
}
|
|
1823
|
+
camelCase() {
|
|
1824
|
+
return this.transformKeys(index$1.tinyCaseExports.camelCase);
|
|
1825
|
+
}
|
|
1826
|
+
snakeCase() {
|
|
1827
|
+
return this.transformKeys(index$1.tinyCaseExports.snakeCase);
|
|
1828
|
+
}
|
|
1829
|
+
constantCase() {
|
|
1830
|
+
return this.transformKeys((key) => index$1.tinyCaseExports.snakeCase(key).toUpperCase());
|
|
1831
|
+
}
|
|
1832
|
+
describe(options) {
|
|
1833
|
+
const next = (options ? this.resolve(options) : this).clone();
|
|
1834
|
+
const base = super.describe(options);
|
|
1835
|
+
base.fields = {};
|
|
1836
|
+
for (const [key, value] of Object.entries(next.fields)) {
|
|
1837
|
+
var _innerOptions2;
|
|
1838
|
+
let innerOptions = options;
|
|
1839
|
+
if ((_innerOptions2 = innerOptions) != null && _innerOptions2.value) {
|
|
1840
|
+
innerOptions = Object.assign({}, innerOptions, {
|
|
1841
|
+
parent: innerOptions.value,
|
|
1842
|
+
value: innerOptions.value[key]
|
|
1843
|
+
});
|
|
1844
|
+
}
|
|
1845
|
+
base.fields[key] = value.describe(innerOptions);
|
|
1846
|
+
}
|
|
1847
|
+
return base;
|
|
1848
|
+
}
|
|
1849
|
+
}
|
|
1850
|
+
create$3.prototype = ObjectSchema.prototype;
|
|
1851
|
+
function create$2(type) {
|
|
1852
|
+
return new ArraySchema(type);
|
|
1853
|
+
}
|
|
1854
|
+
class ArraySchema extends Schema {
|
|
1855
|
+
constructor(type) {
|
|
1856
|
+
super({
|
|
1857
|
+
type: "array",
|
|
1858
|
+
spec: {
|
|
1859
|
+
types: type
|
|
1860
|
+
},
|
|
1861
|
+
check(v) {
|
|
1862
|
+
return Array.isArray(v);
|
|
1863
|
+
}
|
|
1864
|
+
});
|
|
1865
|
+
this.innerType = void 0;
|
|
1866
|
+
this.innerType = type;
|
|
1867
|
+
}
|
|
1868
|
+
_cast(_value, _opts) {
|
|
1869
|
+
const value = super._cast(_value, _opts);
|
|
1870
|
+
if (!this._typeCheck(value) || !this.innerType) {
|
|
1871
|
+
return value;
|
|
1872
|
+
}
|
|
1873
|
+
let isChanged = false;
|
|
1874
|
+
const castArray = value.map((v, idx) => {
|
|
1875
|
+
const castElement = this.innerType.cast(v, Object.assign({}, _opts, {
|
|
1876
|
+
path: `${_opts.path || ""}[${idx}]`,
|
|
1877
|
+
parent: value,
|
|
1878
|
+
originalValue: v,
|
|
1879
|
+
value: v,
|
|
1880
|
+
index: idx
|
|
1881
|
+
}));
|
|
1882
|
+
if (castElement !== v) {
|
|
1883
|
+
isChanged = true;
|
|
1884
|
+
}
|
|
1885
|
+
return castElement;
|
|
1886
|
+
});
|
|
1887
|
+
return isChanged ? castArray : value;
|
|
1888
|
+
}
|
|
1889
|
+
_validate(_value, options = {}, panic, next) {
|
|
1890
|
+
var _options$recursive;
|
|
1891
|
+
let innerType = this.innerType;
|
|
1892
|
+
let recursive = (_options$recursive = options.recursive) != null ? _options$recursive : this.spec.recursive;
|
|
1893
|
+
options.originalValue != null ? options.originalValue : _value;
|
|
1894
|
+
super._validate(_value, options, panic, (arrayErrors, value) => {
|
|
1895
|
+
var _options$originalValu2;
|
|
1896
|
+
if (!recursive || !innerType || !this._typeCheck(value)) {
|
|
1897
|
+
next(arrayErrors, value);
|
|
1898
|
+
return;
|
|
1899
|
+
}
|
|
1900
|
+
let tests = new Array(value.length);
|
|
1901
|
+
for (let index2 = 0; index2 < value.length; index2++) {
|
|
1902
|
+
var _options$originalValu;
|
|
1903
|
+
tests[index2] = innerType.asNestedTest({
|
|
1904
|
+
options,
|
|
1905
|
+
index: index2,
|
|
1906
|
+
parent: value,
|
|
1907
|
+
parentPath: options.path,
|
|
1908
|
+
originalParent: (_options$originalValu = options.originalValue) != null ? _options$originalValu : _value
|
|
1909
|
+
});
|
|
1910
|
+
}
|
|
1911
|
+
this.runTests({
|
|
1912
|
+
value,
|
|
1913
|
+
tests,
|
|
1914
|
+
originalValue: (_options$originalValu2 = options.originalValue) != null ? _options$originalValu2 : _value,
|
|
1915
|
+
options
|
|
1916
|
+
}, panic, (innerTypeErrors) => next(innerTypeErrors.concat(arrayErrors), value));
|
|
1917
|
+
});
|
|
1918
|
+
}
|
|
1919
|
+
clone(spec) {
|
|
1920
|
+
const next = super.clone(spec);
|
|
1921
|
+
next.innerType = this.innerType;
|
|
1922
|
+
return next;
|
|
1923
|
+
}
|
|
1924
|
+
/** Parse an input JSON string to an object */
|
|
1925
|
+
json() {
|
|
1926
|
+
return this.transform(parseJson);
|
|
1927
|
+
}
|
|
1928
|
+
concat(schema) {
|
|
1929
|
+
let next = super.concat(schema);
|
|
1930
|
+
next.innerType = this.innerType;
|
|
1931
|
+
if (schema.innerType)
|
|
1932
|
+
next.innerType = next.innerType ? (
|
|
1933
|
+
// @ts-expect-error Lazy doesn't have concat and will break
|
|
1934
|
+
next.innerType.concat(schema.innerType)
|
|
1935
|
+
) : schema.innerType;
|
|
1936
|
+
return next;
|
|
1937
|
+
}
|
|
1938
|
+
of(schema) {
|
|
1939
|
+
let next = this.clone();
|
|
1940
|
+
if (!isSchema(schema)) throw new TypeError("`array.of()` sub-schema must be a valid yup schema not: " + printValue(schema));
|
|
1941
|
+
next.innerType = schema;
|
|
1942
|
+
next.spec = Object.assign({}, next.spec, {
|
|
1943
|
+
types: schema
|
|
1944
|
+
});
|
|
1945
|
+
return next;
|
|
1946
|
+
}
|
|
1947
|
+
length(length, message = array.length) {
|
|
1948
|
+
return this.test({
|
|
1949
|
+
message,
|
|
1950
|
+
name: "length",
|
|
1951
|
+
exclusive: true,
|
|
1952
|
+
params: {
|
|
1953
|
+
length
|
|
1954
|
+
},
|
|
1955
|
+
skipAbsent: true,
|
|
1956
|
+
test(value) {
|
|
1957
|
+
return value.length === this.resolve(length);
|
|
1958
|
+
}
|
|
1959
|
+
});
|
|
1960
|
+
}
|
|
1961
|
+
min(min, message) {
|
|
1962
|
+
message = message || array.min;
|
|
1963
|
+
return this.test({
|
|
1964
|
+
message,
|
|
1965
|
+
name: "min",
|
|
1966
|
+
exclusive: true,
|
|
1967
|
+
params: {
|
|
1968
|
+
min
|
|
1969
|
+
},
|
|
1970
|
+
skipAbsent: true,
|
|
1971
|
+
// FIXME(ts): Array<typeof T>
|
|
1972
|
+
test(value) {
|
|
1973
|
+
return value.length >= this.resolve(min);
|
|
1974
|
+
}
|
|
1975
|
+
});
|
|
1976
|
+
}
|
|
1977
|
+
max(max, message) {
|
|
1978
|
+
message = message || array.max;
|
|
1979
|
+
return this.test({
|
|
1980
|
+
message,
|
|
1981
|
+
name: "max",
|
|
1982
|
+
exclusive: true,
|
|
1983
|
+
params: {
|
|
1984
|
+
max
|
|
1985
|
+
},
|
|
1986
|
+
skipAbsent: true,
|
|
1987
|
+
test(value) {
|
|
1988
|
+
return value.length <= this.resolve(max);
|
|
1989
|
+
}
|
|
1990
|
+
});
|
|
1991
|
+
}
|
|
1992
|
+
ensure() {
|
|
1993
|
+
return this.default(() => []).transform((val, original) => {
|
|
1994
|
+
if (this._typeCheck(val)) return val;
|
|
1995
|
+
return original == null ? [] : [].concat(original);
|
|
1996
|
+
});
|
|
1997
|
+
}
|
|
1998
|
+
compact(rejector) {
|
|
1999
|
+
let reject = !rejector ? (v) => !!v : (v, i, a) => !rejector(v, i, a);
|
|
2000
|
+
return this.transform((values) => values != null ? values.filter(reject) : values);
|
|
2001
|
+
}
|
|
2002
|
+
describe(options) {
|
|
2003
|
+
const next = (options ? this.resolve(options) : this).clone();
|
|
2004
|
+
const base = super.describe(options);
|
|
2005
|
+
if (next.innerType) {
|
|
2006
|
+
var _innerOptions;
|
|
2007
|
+
let innerOptions = options;
|
|
2008
|
+
if ((_innerOptions = innerOptions) != null && _innerOptions.value) {
|
|
2009
|
+
innerOptions = Object.assign({}, innerOptions, {
|
|
2010
|
+
parent: innerOptions.value,
|
|
2011
|
+
value: innerOptions.value[0]
|
|
2012
|
+
});
|
|
2013
|
+
}
|
|
2014
|
+
base.innerType = next.innerType.describe(innerOptions);
|
|
2015
|
+
}
|
|
2016
|
+
return base;
|
|
2017
|
+
}
|
|
2018
|
+
}
|
|
2019
|
+
create$2.prototype = ArraySchema.prototype;
|
|
2020
|
+
exports.ArraySchema = ArraySchema;
|
|
1241
2021
|
exports.DateSchema = DateSchema;
|
|
2022
|
+
exports.MixedSchema = MixedSchema;
|
|
2023
|
+
exports.ObjectSchema = ObjectSchema;
|
|
1242
2024
|
exports.Schema = Schema;
|
|
2025
|
+
exports.StringSchema = StringSchema;
|
|
1243
2026
|
exports.ValidationError = ValidationError;
|
|
2027
|
+
exports.array = create$2;
|
|
1244
2028
|
exports.getIn = getIn;
|
|
1245
2029
|
exports.isSchema = isSchema;
|
|
2030
|
+
exports.mixed = create$8;
|
|
2031
|
+
exports.object = create$3;
|
|
1246
2032
|
exports.printValue = printValue;
|
|
2033
|
+
exports.string = create$6;
|