create-ones-app 0.0.13 → 0.0.14

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/index.js CHANGED
@@ -1053,8 +1053,8 @@ var scope = {};
1053
1053
  var util = {};
1054
1054
  Object.defineProperty(util, "__esModule", { value: true });
1055
1055
  util.checkStrictMode = util.getErrorPath = util.Type = util.useFunc = util.setEvaluated = util.evaluatedPropsToName = util.mergeEvaluated = util.eachItem = util.unescapeJsonPointer = util.escapeJsonPointer = util.escapeFragment = util.unescapeFragment = util.schemaRefOrVal = util.schemaHasRulesButRef = util.schemaHasRules = util.checkUnknownRules = util.alwaysValidSchema = util.toHash = void 0;
1056
- const codegen_1$t = codegen;
1057
- const code_1$9 = code$1;
1056
+ const codegen_1$z = codegen;
1057
+ const code_1$a = code$1;
1058
1058
  function toHash(arr) {
1059
1059
  const hash = {};
1060
1060
  for (const item of arr)
@@ -1107,9 +1107,9 @@ function schemaRefOrVal({ topSchemaRef, schemaPath }, schema, keyword2, $data) {
1107
1107
  if (typeof schema == "number" || typeof schema == "boolean")
1108
1108
  return schema;
1109
1109
  if (typeof schema == "string")
1110
- return (0, codegen_1$t._)`${schema}`;
1110
+ return (0, codegen_1$z._)`${schema}`;
1111
1111
  }
1112
- return (0, codegen_1$t._)`${topSchemaRef}${schemaPath}${(0, codegen_1$t.getProperty)(keyword2)}`;
1112
+ return (0, codegen_1$z._)`${topSchemaRef}${schemaPath}${(0, codegen_1$z.getProperty)(keyword2)}`;
1113
1113
  }
1114
1114
  util.schemaRefOrVal = schemaRefOrVal;
1115
1115
  function unescapeFragment(str) {
@@ -1141,20 +1141,20 @@ function eachItem(xs, f) {
1141
1141
  util.eachItem = eachItem;
1142
1142
  function makeMergeEvaluated({ mergeNames, mergeToName, mergeValues, resultToName }) {
1143
1143
  return (gen, from, to, toName) => {
1144
- const res = to === void 0 ? from : to instanceof codegen_1$t.Name ? (from instanceof codegen_1$t.Name ? mergeNames(gen, from, to) : mergeToName(gen, from, to), to) : from instanceof codegen_1$t.Name ? (mergeToName(gen, to, from), from) : mergeValues(from, to);
1145
- return toName === codegen_1$t.Name && !(res instanceof codegen_1$t.Name) ? resultToName(gen, res) : res;
1144
+ const res = to === void 0 ? from : to instanceof codegen_1$z.Name ? (from instanceof codegen_1$z.Name ? mergeNames(gen, from, to) : mergeToName(gen, from, to), to) : from instanceof codegen_1$z.Name ? (mergeToName(gen, to, from), from) : mergeValues(from, to);
1145
+ return toName === codegen_1$z.Name && !(res instanceof codegen_1$z.Name) ? resultToName(gen, res) : res;
1146
1146
  };
1147
1147
  }
1148
1148
  util.mergeEvaluated = {
1149
1149
  props: makeMergeEvaluated({
1150
- mergeNames: (gen, from, to) => gen.if((0, codegen_1$t._)`${to} !== true && ${from} !== undefined`, () => {
1151
- gen.if((0, codegen_1$t._)`${from} === true`, () => gen.assign(to, true), () => gen.assign(to, (0, codegen_1$t._)`${to} || {}`).code((0, codegen_1$t._)`Object.assign(${to}, ${from})`));
1150
+ mergeNames: (gen, from, to) => gen.if((0, codegen_1$z._)`${to} !== true && ${from} !== undefined`, () => {
1151
+ gen.if((0, codegen_1$z._)`${from} === true`, () => gen.assign(to, true), () => gen.assign(to, (0, codegen_1$z._)`${to} || {}`).code((0, codegen_1$z._)`Object.assign(${to}, ${from})`));
1152
1152
  }),
1153
- mergeToName: (gen, from, to) => gen.if((0, codegen_1$t._)`${to} !== true`, () => {
1153
+ mergeToName: (gen, from, to) => gen.if((0, codegen_1$z._)`${to} !== true`, () => {
1154
1154
  if (from === true) {
1155
1155
  gen.assign(to, true);
1156
1156
  } else {
1157
- gen.assign(to, (0, codegen_1$t._)`${to} || {}`);
1157
+ gen.assign(to, (0, codegen_1$z._)`${to} || {}`);
1158
1158
  setEvaluated(gen, to, from);
1159
1159
  }
1160
1160
  }),
@@ -1162,8 +1162,8 @@ util.mergeEvaluated = {
1162
1162
  resultToName: evaluatedPropsToName
1163
1163
  }),
1164
1164
  items: makeMergeEvaluated({
1165
- mergeNames: (gen, from, to) => gen.if((0, codegen_1$t._)`${to} !== true && ${from} !== undefined`, () => gen.assign(to, (0, codegen_1$t._)`${from} === true ? true : ${to} > ${from} ? ${to} : ${from}`)),
1166
- mergeToName: (gen, from, to) => gen.if((0, codegen_1$t._)`${to} !== true`, () => gen.assign(to, from === true ? true : (0, codegen_1$t._)`${to} > ${from} ? ${to} : ${from}`)),
1165
+ mergeNames: (gen, from, to) => gen.if((0, codegen_1$z._)`${to} !== true && ${from} !== undefined`, () => gen.assign(to, (0, codegen_1$z._)`${from} === true ? true : ${to} > ${from} ? ${to} : ${from}`)),
1166
+ mergeToName: (gen, from, to) => gen.if((0, codegen_1$z._)`${to} !== true`, () => gen.assign(to, from === true ? true : (0, codegen_1$z._)`${to} > ${from} ? ${to} : ${from}`)),
1167
1167
  mergeValues: (from, to) => from === true ? true : Math.max(from, to),
1168
1168
  resultToName: (gen, items2) => gen.var("items", items2)
1169
1169
  })
@@ -1171,21 +1171,21 @@ util.mergeEvaluated = {
1171
1171
  function evaluatedPropsToName(gen, ps) {
1172
1172
  if (ps === true)
1173
1173
  return gen.var("props", true);
1174
- const props = gen.var("props", (0, codegen_1$t._)`{}`);
1174
+ const props = gen.var("props", (0, codegen_1$z._)`{}`);
1175
1175
  if (ps !== void 0)
1176
1176
  setEvaluated(gen, props, ps);
1177
1177
  return props;
1178
1178
  }
1179
1179
  util.evaluatedPropsToName = evaluatedPropsToName;
1180
1180
  function setEvaluated(gen, props, ps) {
1181
- Object.keys(ps).forEach((p) => gen.assign((0, codegen_1$t._)`${props}${(0, codegen_1$t.getProperty)(p)}`, true));
1181
+ Object.keys(ps).forEach((p) => gen.assign((0, codegen_1$z._)`${props}${(0, codegen_1$z.getProperty)(p)}`, true));
1182
1182
  }
1183
1183
  util.setEvaluated = setEvaluated;
1184
1184
  const snippets = {};
1185
1185
  function useFunc(gen, f) {
1186
1186
  return gen.scopeValue("func", {
1187
1187
  ref: f,
1188
- code: snippets[f.code] || (snippets[f.code] = new code_1$9._Code(f.code))
1188
+ code: snippets[f.code] || (snippets[f.code] = new code_1$a._Code(f.code))
1189
1189
  });
1190
1190
  }
1191
1191
  util.useFunc = useFunc;
@@ -1195,11 +1195,11 @@ var Type;
1195
1195
  Type2[Type2["Str"] = 1] = "Str";
1196
1196
  })(Type || (util.Type = Type = {}));
1197
1197
  function getErrorPath(dataProp, dataPropType, jsPropertySyntax) {
1198
- if (dataProp instanceof codegen_1$t.Name) {
1198
+ if (dataProp instanceof codegen_1$z.Name) {
1199
1199
  const isNumber = dataPropType === Type.Num;
1200
- return jsPropertySyntax ? isNumber ? (0, codegen_1$t._)`"[" + ${dataProp} + "]"` : (0, codegen_1$t._)`"['" + ${dataProp} + "']"` : isNumber ? (0, codegen_1$t._)`"/" + ${dataProp}` : (0, codegen_1$t._)`"/" + ${dataProp}.replace(/~/g, "~0").replace(/\\//g, "~1")`;
1200
+ return jsPropertySyntax ? isNumber ? (0, codegen_1$z._)`"[" + ${dataProp} + "]"` : (0, codegen_1$z._)`"['" + ${dataProp} + "']"` : isNumber ? (0, codegen_1$z._)`"/" + ${dataProp}` : (0, codegen_1$z._)`"/" + ${dataProp}.replace(/~/g, "~0").replace(/\\//g, "~1")`;
1201
1201
  }
1202
- return jsPropertySyntax ? (0, codegen_1$t.getProperty)(dataProp).toString() : "/" + escapeJsonPointer(dataProp);
1202
+ return jsPropertySyntax ? (0, codegen_1$z.getProperty)(dataProp).toString() : "/" + escapeJsonPointer(dataProp);
1203
1203
  }
1204
1204
  util.getErrorPath = getErrorPath;
1205
1205
  function checkStrictMode(it, msg, mode = it.opts.strictSchema) {
@@ -1211,52 +1211,45 @@ function checkStrictMode(it, msg, mode = it.opts.strictSchema) {
1211
1211
  it.self.logger.warn(msg);
1212
1212
  }
1213
1213
  util.checkStrictMode = checkStrictMode;
1214
- var names = {};
1215
- var hasRequiredNames;
1216
- function requireNames() {
1217
- if (hasRequiredNames)
1218
- return names;
1219
- hasRequiredNames = 1;
1220
- Object.defineProperty(names, "__esModule", { value: true });
1221
- const codegen_12 = codegen;
1222
- const names$1 = {
1223
- // validation function arguments
1224
- data: new codegen_12.Name("data"),
1225
- // data passed to validation function
1226
- // args passed from referencing schema
1227
- valCxt: new codegen_12.Name("valCxt"),
1228
- // validation/data context - should not be used directly, it is destructured to the names below
1229
- instancePath: new codegen_12.Name("instancePath"),
1230
- parentData: new codegen_12.Name("parentData"),
1231
- parentDataProperty: new codegen_12.Name("parentDataProperty"),
1232
- rootData: new codegen_12.Name("rootData"),
1233
- // root data - same as the data passed to the first/top validation function
1234
- dynamicAnchors: new codegen_12.Name("dynamicAnchors"),
1235
- // used to support recursiveRef and dynamicRef
1236
- // function scoped variables
1237
- vErrors: new codegen_12.Name("vErrors"),
1238
- // null or array of validation errors
1239
- errors: new codegen_12.Name("errors"),
1240
- // counter of validation errors
1241
- this: new codegen_12.Name("this"),
1242
- // "globals"
1243
- self: new codegen_12.Name("self"),
1244
- scope: new codegen_12.Name("scope"),
1245
- // JTD serialize/parse name for JSON string and position
1246
- json: new codegen_12.Name("json"),
1247
- jsonPos: new codegen_12.Name("jsonPos"),
1248
- jsonLen: new codegen_12.Name("jsonLen"),
1249
- jsonPart: new codegen_12.Name("jsonPart")
1250
- };
1251
- names.default = names$1;
1252
- return names;
1253
- }
1214
+ var names$1 = {};
1215
+ Object.defineProperty(names$1, "__esModule", { value: true });
1216
+ const codegen_1$y = codegen;
1217
+ const names = {
1218
+ // validation function arguments
1219
+ data: new codegen_1$y.Name("data"),
1220
+ // data passed to validation function
1221
+ // args passed from referencing schema
1222
+ valCxt: new codegen_1$y.Name("valCxt"),
1223
+ // validation/data context - should not be used directly, it is destructured to the names below
1224
+ instancePath: new codegen_1$y.Name("instancePath"),
1225
+ parentData: new codegen_1$y.Name("parentData"),
1226
+ parentDataProperty: new codegen_1$y.Name("parentDataProperty"),
1227
+ rootData: new codegen_1$y.Name("rootData"),
1228
+ // root data - same as the data passed to the first/top validation function
1229
+ dynamicAnchors: new codegen_1$y.Name("dynamicAnchors"),
1230
+ // used to support recursiveRef and dynamicRef
1231
+ // function scoped variables
1232
+ vErrors: new codegen_1$y.Name("vErrors"),
1233
+ // null or array of validation errors
1234
+ errors: new codegen_1$y.Name("errors"),
1235
+ // counter of validation errors
1236
+ this: new codegen_1$y.Name("this"),
1237
+ // "globals"
1238
+ self: new codegen_1$y.Name("self"),
1239
+ scope: new codegen_1$y.Name("scope"),
1240
+ // JTD serialize/parse name for JSON string and position
1241
+ json: new codegen_1$y.Name("json"),
1242
+ jsonPos: new codegen_1$y.Name("jsonPos"),
1243
+ jsonLen: new codegen_1$y.Name("jsonLen"),
1244
+ jsonPart: new codegen_1$y.Name("jsonPart")
1245
+ };
1246
+ names$1.default = names;
1254
1247
  (function(exports) {
1255
1248
  Object.defineProperty(exports, "__esModule", { value: true });
1256
1249
  exports.extendErrors = exports.resetErrorsCount = exports.reportExtraError = exports.reportError = exports.keyword$DataError = exports.keywordError = void 0;
1257
1250
  const codegen_12 = codegen;
1258
1251
  const util_12 = util;
1259
- const names_12 = requireNames();
1252
+ const names_12 = names$1;
1260
1253
  exports.keywordError = {
1261
1254
  message: ({ keyword: keyword2 }) => (0, codegen_12.str)`must pass "${keyword2}" keyword validation`
1262
1255
  };
@@ -1368,56 +1361,49 @@ function requireNames() {
1368
1361
  keyValues.push([E.propertyName, propertyName]);
1369
1362
  }
1370
1363
  })(errors);
1371
- var hasRequiredBoolSchema;
1372
- function requireBoolSchema() {
1373
- if (hasRequiredBoolSchema)
1374
- return boolSchema;
1375
- hasRequiredBoolSchema = 1;
1376
- Object.defineProperty(boolSchema, "__esModule", { value: true });
1377
- boolSchema.boolOrEmptySchema = boolSchema.topBoolOrEmptySchema = void 0;
1378
- const errors_12 = errors;
1379
- const codegen_12 = codegen;
1380
- const names_12 = requireNames();
1381
- const boolError = {
1382
- message: "boolean schema is false"
1383
- };
1384
- function topBoolOrEmptySchema(it) {
1385
- const { gen, schema, validateName } = it;
1386
- if (schema === false) {
1387
- falseSchemaError(it, false);
1388
- } else if (typeof schema == "object" && schema.$async === true) {
1389
- gen.return(names_12.default.data);
1390
- } else {
1391
- gen.assign((0, codegen_12._)`${validateName}.errors`, null);
1392
- gen.return(true);
1393
- }
1364
+ Object.defineProperty(boolSchema, "__esModule", { value: true });
1365
+ boolSchema.boolOrEmptySchema = boolSchema.topBoolOrEmptySchema = void 0;
1366
+ const errors_1$3 = errors;
1367
+ const codegen_1$x = codegen;
1368
+ const names_1$9 = names$1;
1369
+ const boolError = {
1370
+ message: "boolean schema is false"
1371
+ };
1372
+ function topBoolOrEmptySchema(it) {
1373
+ const { gen, schema, validateName } = it;
1374
+ if (schema === false) {
1375
+ falseSchemaError(it, false);
1376
+ } else if (typeof schema == "object" && schema.$async === true) {
1377
+ gen.return(names_1$9.default.data);
1378
+ } else {
1379
+ gen.assign((0, codegen_1$x._)`${validateName}.errors`, null);
1380
+ gen.return(true);
1394
1381
  }
1395
- boolSchema.topBoolOrEmptySchema = topBoolOrEmptySchema;
1396
- function boolOrEmptySchema(it, valid) {
1397
- const { gen, schema } = it;
1398
- if (schema === false) {
1399
- gen.var(valid, false);
1400
- falseSchemaError(it);
1401
- } else {
1402
- gen.var(valid, true);
1403
- }
1404
- }
1405
- boolSchema.boolOrEmptySchema = boolOrEmptySchema;
1406
- function falseSchemaError(it, overrideAllErrors) {
1407
- const { gen, data } = it;
1408
- const cxt = {
1409
- gen,
1410
- keyword: "false schema",
1411
- data,
1412
- schema: false,
1413
- schemaCode: false,
1414
- schemaValue: false,
1415
- params: {},
1416
- it
1417
- };
1418
- (0, errors_12.reportError)(cxt, boolError, void 0, overrideAllErrors);
1382
+ }
1383
+ boolSchema.topBoolOrEmptySchema = topBoolOrEmptySchema;
1384
+ function boolOrEmptySchema(it, valid) {
1385
+ const { gen, schema } = it;
1386
+ if (schema === false) {
1387
+ gen.var(valid, false);
1388
+ falseSchemaError(it);
1389
+ } else {
1390
+ gen.var(valid, true);
1419
1391
  }
1420
- return boolSchema;
1392
+ }
1393
+ boolSchema.boolOrEmptySchema = boolOrEmptySchema;
1394
+ function falseSchemaError(it, overrideAllErrors) {
1395
+ const { gen, data } = it;
1396
+ const cxt = {
1397
+ gen,
1398
+ keyword: "false schema",
1399
+ data,
1400
+ schema: false,
1401
+ schemaCode: false,
1402
+ schemaValue: false,
1403
+ params: {},
1404
+ it
1405
+ };
1406
+ (0, errors_1$3.reportError)(cxt, boolError, void 0, overrideAllErrors);
1421
1407
  }
1422
1408
  var dataType = {};
1423
1409
  var rules = {};
@@ -1446,36 +1432,29 @@ function getRules() {
1446
1432
  }
1447
1433
  rules.getRules = getRules;
1448
1434
  var applicability = {};
1449
- var hasRequiredApplicability;
1450
- function requireApplicability() {
1451
- if (hasRequiredApplicability)
1452
- return applicability;
1453
- hasRequiredApplicability = 1;
1454
- Object.defineProperty(applicability, "__esModule", { value: true });
1455
- applicability.shouldUseRule = applicability.shouldUseGroup = applicability.schemaHasRulesForType = void 0;
1456
- function schemaHasRulesForType({ schema, self }, type2) {
1457
- const group = self.RULES.types[type2];
1458
- return group && group !== true && shouldUseGroup(schema, group);
1459
- }
1460
- applicability.schemaHasRulesForType = schemaHasRulesForType;
1461
- function shouldUseGroup(schema, group) {
1462
- return group.rules.some((rule) => shouldUseRule(schema, rule));
1463
- }
1464
- applicability.shouldUseGroup = shouldUseGroup;
1465
- function shouldUseRule(schema, rule) {
1466
- var _a;
1467
- return schema[rule.keyword] !== void 0 || ((_a = rule.definition.implements) === null || _a === void 0 ? void 0 : _a.some((kwd) => schema[kwd] !== void 0));
1468
- }
1469
- applicability.shouldUseRule = shouldUseRule;
1470
- return applicability;
1435
+ Object.defineProperty(applicability, "__esModule", { value: true });
1436
+ applicability.shouldUseRule = applicability.shouldUseGroup = applicability.schemaHasRulesForType = void 0;
1437
+ function schemaHasRulesForType({ schema, self }, type2) {
1438
+ const group = self.RULES.types[type2];
1439
+ return group && group !== true && shouldUseGroup(schema, group);
1440
+ }
1441
+ applicability.schemaHasRulesForType = schemaHasRulesForType;
1442
+ function shouldUseGroup(schema, group) {
1443
+ return group.rules.some((rule) => shouldUseRule(schema, rule));
1444
+ }
1445
+ applicability.shouldUseGroup = shouldUseGroup;
1446
+ function shouldUseRule(schema, rule) {
1447
+ var _a;
1448
+ return schema[rule.keyword] !== void 0 || ((_a = rule.definition.implements) === null || _a === void 0 ? void 0 : _a.some((kwd) => schema[kwd] !== void 0));
1471
1449
  }
1450
+ applicability.shouldUseRule = shouldUseRule;
1472
1451
  Object.defineProperty(dataType, "__esModule", { value: true });
1473
1452
  dataType.reportTypeError = dataType.checkDataTypes = dataType.checkDataType = dataType.coerceAndCheckDataType = dataType.getJSONTypes = dataType.getSchemaTypes = dataType.DataType = void 0;
1474
1453
  const rules_1 = rules;
1475
- const applicability_1 = requireApplicability();
1476
- const errors_1 = errors;
1477
- const codegen_1$s = codegen;
1478
- const util_1$r = util;
1454
+ const applicability_1$1 = applicability;
1455
+ const errors_1$2 = errors;
1456
+ const codegen_1$w = codegen;
1457
+ const util_1$u = util;
1479
1458
  var DataType;
1480
1459
  (function(DataType2) {
1481
1460
  DataType2[DataType2["Correct"] = 0] = "Correct";
@@ -1507,7 +1486,7 @@ dataType.getJSONTypes = getJSONTypes;
1507
1486
  function coerceAndCheckDataType(it, types2) {
1508
1487
  const { gen, data, opts } = it;
1509
1488
  const coerceTo = coerceToTypes(types2, opts.coerceTypes);
1510
- const checkTypes = types2.length > 0 && !(coerceTo.length === 0 && types2.length === 1 && (0, applicability_1.schemaHasRulesForType)(it, types2[0]));
1489
+ const checkTypes = types2.length > 0 && !(coerceTo.length === 0 && types2.length === 1 && (0, applicability_1$1.schemaHasRulesForType)(it, types2[0]));
1511
1490
  if (checkTypes) {
1512
1491
  const wrongType = checkDataTypes(types2, data, opts.strictNumbers, DataType.Wrong);
1513
1492
  gen.if(wrongType, () => {
@@ -1526,12 +1505,12 @@ function coerceToTypes(types2, coerceTypes) {
1526
1505
  }
1527
1506
  function coerceData(it, types2, coerceTo) {
1528
1507
  const { gen, data, opts } = it;
1529
- const dataType2 = gen.let("dataType", (0, codegen_1$s._)`typeof ${data}`);
1530
- const coerced = gen.let("coerced", (0, codegen_1$s._)`undefined`);
1508
+ const dataType2 = gen.let("dataType", (0, codegen_1$w._)`typeof ${data}`);
1509
+ const coerced = gen.let("coerced", (0, codegen_1$w._)`undefined`);
1531
1510
  if (opts.coerceTypes === "array") {
1532
- gen.if((0, codegen_1$s._)`${dataType2} == 'object' && Array.isArray(${data}) && ${data}.length == 1`, () => gen.assign(data, (0, codegen_1$s._)`${data}[0]`).assign(dataType2, (0, codegen_1$s._)`typeof ${data}`).if(checkDataTypes(types2, data, opts.strictNumbers), () => gen.assign(coerced, data)));
1511
+ gen.if((0, codegen_1$w._)`${dataType2} == 'object' && Array.isArray(${data}) && ${data}.length == 1`, () => gen.assign(data, (0, codegen_1$w._)`${data}[0]`).assign(dataType2, (0, codegen_1$w._)`typeof ${data}`).if(checkDataTypes(types2, data, opts.strictNumbers), () => gen.assign(coerced, data)));
1533
1512
  }
1534
- gen.if((0, codegen_1$s._)`${coerced} !== undefined`);
1513
+ gen.if((0, codegen_1$w._)`${coerced} !== undefined`);
1535
1514
  for (const t of coerceTo) {
1536
1515
  if (COERCIBLE.has(t) || t === "array" && opts.coerceTypes === "array") {
1537
1516
  coerceSpecificType(t);
@@ -1540,63 +1519,63 @@ function coerceData(it, types2, coerceTo) {
1540
1519
  gen.else();
1541
1520
  reportTypeError(it);
1542
1521
  gen.endIf();
1543
- gen.if((0, codegen_1$s._)`${coerced} !== undefined`, () => {
1522
+ gen.if((0, codegen_1$w._)`${coerced} !== undefined`, () => {
1544
1523
  gen.assign(data, coerced);
1545
1524
  assignParentData(it, coerced);
1546
1525
  });
1547
1526
  function coerceSpecificType(t) {
1548
1527
  switch (t) {
1549
1528
  case "string":
1550
- gen.elseIf((0, codegen_1$s._)`${dataType2} == "number" || ${dataType2} == "boolean"`).assign(coerced, (0, codegen_1$s._)`"" + ${data}`).elseIf((0, codegen_1$s._)`${data} === null`).assign(coerced, (0, codegen_1$s._)`""`);
1529
+ gen.elseIf((0, codegen_1$w._)`${dataType2} == "number" || ${dataType2} == "boolean"`).assign(coerced, (0, codegen_1$w._)`"" + ${data}`).elseIf((0, codegen_1$w._)`${data} === null`).assign(coerced, (0, codegen_1$w._)`""`);
1551
1530
  return;
1552
1531
  case "number":
1553
- gen.elseIf((0, codegen_1$s._)`${dataType2} == "boolean" || ${data} === null
1554
- || (${dataType2} == "string" && ${data} && ${data} == +${data})`).assign(coerced, (0, codegen_1$s._)`+${data}`);
1532
+ gen.elseIf((0, codegen_1$w._)`${dataType2} == "boolean" || ${data} === null
1533
+ || (${dataType2} == "string" && ${data} && ${data} == +${data})`).assign(coerced, (0, codegen_1$w._)`+${data}`);
1555
1534
  return;
1556
1535
  case "integer":
1557
- gen.elseIf((0, codegen_1$s._)`${dataType2} === "boolean" || ${data} === null
1558
- || (${dataType2} === "string" && ${data} && ${data} == +${data} && !(${data} % 1))`).assign(coerced, (0, codegen_1$s._)`+${data}`);
1536
+ gen.elseIf((0, codegen_1$w._)`${dataType2} === "boolean" || ${data} === null
1537
+ || (${dataType2} === "string" && ${data} && ${data} == +${data} && !(${data} % 1))`).assign(coerced, (0, codegen_1$w._)`+${data}`);
1559
1538
  return;
1560
1539
  case "boolean":
1561
- gen.elseIf((0, codegen_1$s._)`${data} === "false" || ${data} === 0 || ${data} === null`).assign(coerced, false).elseIf((0, codegen_1$s._)`${data} === "true" || ${data} === 1`).assign(coerced, true);
1540
+ gen.elseIf((0, codegen_1$w._)`${data} === "false" || ${data} === 0 || ${data} === null`).assign(coerced, false).elseIf((0, codegen_1$w._)`${data} === "true" || ${data} === 1`).assign(coerced, true);
1562
1541
  return;
1563
1542
  case "null":
1564
- gen.elseIf((0, codegen_1$s._)`${data} === "" || ${data} === 0 || ${data} === false`);
1543
+ gen.elseIf((0, codegen_1$w._)`${data} === "" || ${data} === 0 || ${data} === false`);
1565
1544
  gen.assign(coerced, null);
1566
1545
  return;
1567
1546
  case "array":
1568
- gen.elseIf((0, codegen_1$s._)`${dataType2} === "string" || ${dataType2} === "number"
1569
- || ${dataType2} === "boolean" || ${data} === null`).assign(coerced, (0, codegen_1$s._)`[${data}]`);
1547
+ gen.elseIf((0, codegen_1$w._)`${dataType2} === "string" || ${dataType2} === "number"
1548
+ || ${dataType2} === "boolean" || ${data} === null`).assign(coerced, (0, codegen_1$w._)`[${data}]`);
1570
1549
  }
1571
1550
  }
1572
1551
  }
1573
1552
  function assignParentData({ gen, parentData, parentDataProperty }, expr) {
1574
- gen.if((0, codegen_1$s._)`${parentData} !== undefined`, () => gen.assign((0, codegen_1$s._)`${parentData}[${parentDataProperty}]`, expr));
1553
+ gen.if((0, codegen_1$w._)`${parentData} !== undefined`, () => gen.assign((0, codegen_1$w._)`${parentData}[${parentDataProperty}]`, expr));
1575
1554
  }
1576
1555
  function checkDataType(dataType2, data, strictNums, correct = DataType.Correct) {
1577
- const EQ = correct === DataType.Correct ? codegen_1$s.operators.EQ : codegen_1$s.operators.NEQ;
1556
+ const EQ = correct === DataType.Correct ? codegen_1$w.operators.EQ : codegen_1$w.operators.NEQ;
1578
1557
  let cond;
1579
1558
  switch (dataType2) {
1580
1559
  case "null":
1581
- return (0, codegen_1$s._)`${data} ${EQ} null`;
1560
+ return (0, codegen_1$w._)`${data} ${EQ} null`;
1582
1561
  case "array":
1583
- cond = (0, codegen_1$s._)`Array.isArray(${data})`;
1562
+ cond = (0, codegen_1$w._)`Array.isArray(${data})`;
1584
1563
  break;
1585
1564
  case "object":
1586
- cond = (0, codegen_1$s._)`${data} && typeof ${data} == "object" && !Array.isArray(${data})`;
1565
+ cond = (0, codegen_1$w._)`${data} && typeof ${data} == "object" && !Array.isArray(${data})`;
1587
1566
  break;
1588
1567
  case "integer":
1589
- cond = numCond((0, codegen_1$s._)`!(${data} % 1) && !isNaN(${data})`);
1568
+ cond = numCond((0, codegen_1$w._)`!(${data} % 1) && !isNaN(${data})`);
1590
1569
  break;
1591
1570
  case "number":
1592
1571
  cond = numCond();
1593
1572
  break;
1594
1573
  default:
1595
- return (0, codegen_1$s._)`typeof ${data} ${EQ} ${dataType2}`;
1574
+ return (0, codegen_1$w._)`typeof ${data} ${EQ} ${dataType2}`;
1596
1575
  }
1597
- return correct === DataType.Correct ? cond : (0, codegen_1$s.not)(cond);
1598
- function numCond(_cond = codegen_1$s.nil) {
1599
- return (0, codegen_1$s.and)((0, codegen_1$s._)`typeof ${data} == "number"`, _cond, strictNums ? (0, codegen_1$s._)`isFinite(${data})` : codegen_1$s.nil);
1576
+ return correct === DataType.Correct ? cond : (0, codegen_1$w.not)(cond);
1577
+ function numCond(_cond = codegen_1$w.nil) {
1578
+ return (0, codegen_1$w.and)((0, codegen_1$w._)`typeof ${data} == "number"`, _cond, strictNums ? (0, codegen_1$w._)`isFinite(${data})` : codegen_1$w.nil);
1600
1579
  }
1601
1580
  }
1602
1581
  dataType.checkDataType = checkDataType;
@@ -1605,35 +1584,35 @@ function checkDataTypes(dataTypes, data, strictNums, correct) {
1605
1584
  return checkDataType(dataTypes[0], data, strictNums, correct);
1606
1585
  }
1607
1586
  let cond;
1608
- const types2 = (0, util_1$r.toHash)(dataTypes);
1587
+ const types2 = (0, util_1$u.toHash)(dataTypes);
1609
1588
  if (types2.array && types2.object) {
1610
- const notObj = (0, codegen_1$s._)`typeof ${data} != "object"`;
1611
- cond = types2.null ? notObj : (0, codegen_1$s._)`!${data} || ${notObj}`;
1589
+ const notObj = (0, codegen_1$w._)`typeof ${data} != "object"`;
1590
+ cond = types2.null ? notObj : (0, codegen_1$w._)`!${data} || ${notObj}`;
1612
1591
  delete types2.null;
1613
1592
  delete types2.array;
1614
1593
  delete types2.object;
1615
1594
  } else {
1616
- cond = codegen_1$s.nil;
1595
+ cond = codegen_1$w.nil;
1617
1596
  }
1618
1597
  if (types2.number)
1619
1598
  delete types2.integer;
1620
1599
  for (const t in types2)
1621
- cond = (0, codegen_1$s.and)(cond, checkDataType(t, data, strictNums, correct));
1600
+ cond = (0, codegen_1$w.and)(cond, checkDataType(t, data, strictNums, correct));
1622
1601
  return cond;
1623
1602
  }
1624
1603
  dataType.checkDataTypes = checkDataTypes;
1625
1604
  const typeError = {
1626
1605
  message: ({ schema }) => `must be ${schema}`,
1627
- params: ({ schema, schemaValue }) => typeof schema == "string" ? (0, codegen_1$s._)`{type: ${schema}}` : (0, codegen_1$s._)`{type: ${schemaValue}}`
1606
+ params: ({ schema, schemaValue }) => typeof schema == "string" ? (0, codegen_1$w._)`{type: ${schema}}` : (0, codegen_1$w._)`{type: ${schemaValue}}`
1628
1607
  };
1629
1608
  function reportTypeError(it) {
1630
1609
  const cxt = getTypeErrorContext(it);
1631
- (0, errors_1.reportError)(cxt, typeError);
1610
+ (0, errors_1$2.reportError)(cxt, typeError);
1632
1611
  }
1633
1612
  dataType.reportTypeError = reportTypeError;
1634
1613
  function getTypeErrorContext(it) {
1635
1614
  const { gen, data, schema } = it;
1636
- const schemaCode = (0, util_1$r.schemaRefOrVal)(it, schema, "type");
1615
+ const schemaCode = (0, util_1$u.schemaRefOrVal)(it, schema, "type");
1637
1616
  return {
1638
1617
  gen,
1639
1618
  keyword: "type",
@@ -1647,61 +1626,54 @@ function getTypeErrorContext(it) {
1647
1626
  };
1648
1627
  }
1649
1628
  var defaults = {};
1650
- var hasRequiredDefaults;
1651
- function requireDefaults() {
1652
- if (hasRequiredDefaults)
1653
- return defaults;
1654
- hasRequiredDefaults = 1;
1655
- Object.defineProperty(defaults, "__esModule", { value: true });
1656
- defaults.assignDefaults = void 0;
1657
- const codegen_12 = codegen;
1658
- const util_12 = util;
1659
- function assignDefaults(it, ty) {
1660
- const { properties: properties2, items: items2 } = it.schema;
1661
- if (ty === "object" && properties2) {
1662
- for (const key in properties2) {
1663
- assignDefault(it, key, properties2[key].default);
1664
- }
1665
- } else if (ty === "array" && Array.isArray(items2)) {
1666
- items2.forEach((sch, i) => assignDefault(it, i, sch.default));
1667
- }
1629
+ Object.defineProperty(defaults, "__esModule", { value: true });
1630
+ defaults.assignDefaults = void 0;
1631
+ const codegen_1$v = codegen;
1632
+ const util_1$t = util;
1633
+ function assignDefaults(it, ty) {
1634
+ const { properties: properties2, items: items2 } = it.schema;
1635
+ if (ty === "object" && properties2) {
1636
+ for (const key in properties2) {
1637
+ assignDefault(it, key, properties2[key].default);
1638
+ }
1639
+ } else if (ty === "array" && Array.isArray(items2)) {
1640
+ items2.forEach((sch, i) => assignDefault(it, i, sch.default));
1668
1641
  }
1669
- defaults.assignDefaults = assignDefaults;
1670
- function assignDefault(it, prop, defaultValue) {
1671
- const { gen, compositeRule, data, opts } = it;
1672
- if (defaultValue === void 0)
1673
- return;
1674
- const childData = (0, codegen_12._)`${data}${(0, codegen_12.getProperty)(prop)}`;
1675
- if (compositeRule) {
1676
- (0, util_12.checkStrictMode)(it, `default is ignored for: ${childData}`);
1677
- return;
1678
- }
1679
- let condition = (0, codegen_12._)`${childData} === undefined`;
1680
- if (opts.useDefaults === "empty") {
1681
- condition = (0, codegen_12._)`${condition} || ${childData} === null || ${childData} === ""`;
1682
- }
1683
- gen.if(condition, (0, codegen_12._)`${childData} = ${(0, codegen_12.stringify)(defaultValue)}`);
1642
+ }
1643
+ defaults.assignDefaults = assignDefaults;
1644
+ function assignDefault(it, prop, defaultValue) {
1645
+ const { gen, compositeRule, data, opts } = it;
1646
+ if (defaultValue === void 0)
1647
+ return;
1648
+ const childData = (0, codegen_1$v._)`${data}${(0, codegen_1$v.getProperty)(prop)}`;
1649
+ if (compositeRule) {
1650
+ (0, util_1$t.checkStrictMode)(it, `default is ignored for: ${childData}`);
1651
+ return;
1652
+ }
1653
+ let condition = (0, codegen_1$v._)`${childData} === undefined`;
1654
+ if (opts.useDefaults === "empty") {
1655
+ condition = (0, codegen_1$v._)`${condition} || ${childData} === null || ${childData} === ""`;
1684
1656
  }
1685
- return defaults;
1657
+ gen.if(condition, (0, codegen_1$v._)`${childData} = ${(0, codegen_1$v.stringify)(defaultValue)}`);
1686
1658
  }
1687
1659
  var keyword = {};
1688
1660
  var code = {};
1689
1661
  Object.defineProperty(code, "__esModule", { value: true });
1690
1662
  code.validateUnion = code.validateArray = code.usePattern = code.callValidateCode = code.schemaProperties = code.allSchemaProperties = code.noPropertyInData = code.propertyInData = code.isOwnProperty = code.hasPropFunc = code.reportMissingProp = code.checkMissingProp = code.checkReportMissingProp = void 0;
1691
- const codegen_1$r = codegen;
1692
- const util_1$q = util;
1693
- const names_1$6 = requireNames();
1663
+ const codegen_1$u = codegen;
1664
+ const util_1$s = util;
1665
+ const names_1$8 = names$1;
1694
1666
  const util_2$1 = util;
1695
1667
  function checkReportMissingProp(cxt, prop) {
1696
1668
  const { gen, data, it } = cxt;
1697
1669
  gen.if(noPropertyInData(gen, data, prop, it.opts.ownProperties), () => {
1698
- cxt.setParams({ missingProperty: (0, codegen_1$r._)`${prop}` }, true);
1670
+ cxt.setParams({ missingProperty: (0, codegen_1$u._)`${prop}` }, true);
1699
1671
  cxt.error();
1700
1672
  });
1701
1673
  }
1702
1674
  code.checkReportMissingProp = checkReportMissingProp;
1703
1675
  function checkMissingProp({ gen, data, it: { opts } }, properties2, missing) {
1704
- return (0, codegen_1$r.or)(...properties2.map((prop) => (0, codegen_1$r.and)(noPropertyInData(gen, data, prop, opts.ownProperties), (0, codegen_1$r._)`${missing} = ${prop}`)));
1676
+ return (0, codegen_1$u.or)(...properties2.map((prop) => (0, codegen_1$u.and)(noPropertyInData(gen, data, prop, opts.ownProperties), (0, codegen_1$u._)`${missing} = ${prop}`)));
1705
1677
  }
1706
1678
  code.checkMissingProp = checkMissingProp;
1707
1679
  function reportMissingProp(cxt, missing) {
@@ -1713,22 +1685,22 @@ function hasPropFunc(gen) {
1713
1685
  return gen.scopeValue("func", {
1714
1686
  // eslint-disable-next-line @typescript-eslint/unbound-method
1715
1687
  ref: Object.prototype.hasOwnProperty,
1716
- code: (0, codegen_1$r._)`Object.prototype.hasOwnProperty`
1688
+ code: (0, codegen_1$u._)`Object.prototype.hasOwnProperty`
1717
1689
  });
1718
1690
  }
1719
1691
  code.hasPropFunc = hasPropFunc;
1720
1692
  function isOwnProperty(gen, data, property) {
1721
- return (0, codegen_1$r._)`${hasPropFunc(gen)}.call(${data}, ${property})`;
1693
+ return (0, codegen_1$u._)`${hasPropFunc(gen)}.call(${data}, ${property})`;
1722
1694
  }
1723
1695
  code.isOwnProperty = isOwnProperty;
1724
1696
  function propertyInData(gen, data, property, ownProperties) {
1725
- const cond = (0, codegen_1$r._)`${data}${(0, codegen_1$r.getProperty)(property)} !== undefined`;
1726
- return ownProperties ? (0, codegen_1$r._)`${cond} && ${isOwnProperty(gen, data, property)}` : cond;
1697
+ const cond = (0, codegen_1$u._)`${data}${(0, codegen_1$u.getProperty)(property)} !== undefined`;
1698
+ return ownProperties ? (0, codegen_1$u._)`${cond} && ${isOwnProperty(gen, data, property)}` : cond;
1727
1699
  }
1728
1700
  code.propertyInData = propertyInData;
1729
1701
  function noPropertyInData(gen, data, property, ownProperties) {
1730
- const cond = (0, codegen_1$r._)`${data}${(0, codegen_1$r.getProperty)(property)} === undefined`;
1731
- return ownProperties ? (0, codegen_1$r.or)(cond, (0, codegen_1$r.not)(isOwnProperty(gen, data, property))) : cond;
1702
+ const cond = (0, codegen_1$u._)`${data}${(0, codegen_1$u.getProperty)(property)} === undefined`;
1703
+ return ownProperties ? (0, codegen_1$u.or)(cond, (0, codegen_1$u.not)(isOwnProperty(gen, data, property))) : cond;
1732
1704
  }
1733
1705
  code.noPropertyInData = noPropertyInData;
1734
1706
  function allSchemaProperties(schemaMap) {
@@ -1736,24 +1708,24 @@ function allSchemaProperties(schemaMap) {
1736
1708
  }
1737
1709
  code.allSchemaProperties = allSchemaProperties;
1738
1710
  function schemaProperties(it, schemaMap) {
1739
- return allSchemaProperties(schemaMap).filter((p) => !(0, util_1$q.alwaysValidSchema)(it, schemaMap[p]));
1711
+ return allSchemaProperties(schemaMap).filter((p) => !(0, util_1$s.alwaysValidSchema)(it, schemaMap[p]));
1740
1712
  }
1741
1713
  code.schemaProperties = schemaProperties;
1742
1714
  function callValidateCode({ schemaCode, data, it: { gen, topSchemaRef, schemaPath, errorPath }, it }, func, context2, passSchema) {
1743
- const dataAndSchema = passSchema ? (0, codegen_1$r._)`${schemaCode}, ${data}, ${topSchemaRef}${schemaPath}` : data;
1715
+ const dataAndSchema = passSchema ? (0, codegen_1$u._)`${schemaCode}, ${data}, ${topSchemaRef}${schemaPath}` : data;
1744
1716
  const valCxt = [
1745
- [names_1$6.default.instancePath, (0, codegen_1$r.strConcat)(names_1$6.default.instancePath, errorPath)],
1746
- [names_1$6.default.parentData, it.parentData],
1747
- [names_1$6.default.parentDataProperty, it.parentDataProperty],
1748
- [names_1$6.default.rootData, names_1$6.default.rootData]
1717
+ [names_1$8.default.instancePath, (0, codegen_1$u.strConcat)(names_1$8.default.instancePath, errorPath)],
1718
+ [names_1$8.default.parentData, it.parentData],
1719
+ [names_1$8.default.parentDataProperty, it.parentDataProperty],
1720
+ [names_1$8.default.rootData, names_1$8.default.rootData]
1749
1721
  ];
1750
1722
  if (it.opts.dynamicRef)
1751
- valCxt.push([names_1$6.default.dynamicAnchors, names_1$6.default.dynamicAnchors]);
1752
- const args = (0, codegen_1$r._)`${dataAndSchema}, ${gen.object(...valCxt)}`;
1753
- return context2 !== codegen_1$r.nil ? (0, codegen_1$r._)`${func}.call(${context2}, ${args})` : (0, codegen_1$r._)`${func}(${args})`;
1723
+ valCxt.push([names_1$8.default.dynamicAnchors, names_1$8.default.dynamicAnchors]);
1724
+ const args = (0, codegen_1$u._)`${dataAndSchema}, ${gen.object(...valCxt)}`;
1725
+ return context2 !== codegen_1$u.nil ? (0, codegen_1$u._)`${func}.call(${context2}, ${args})` : (0, codegen_1$u._)`${func}(${args})`;
1754
1726
  }
1755
1727
  code.callValidateCode = callValidateCode;
1756
- const newRegExp = (0, codegen_1$r._)`new RegExp`;
1728
+ const newRegExp = (0, codegen_1$u._)`new RegExp`;
1757
1729
  function usePattern({ gen, it: { opts } }, pattern2) {
1758
1730
  const u = opts.unicodeRegExp ? "u" : "";
1759
1731
  const { regExp } = opts.code;
@@ -1761,7 +1733,7 @@ function usePattern({ gen, it: { opts } }, pattern2) {
1761
1733
  return gen.scopeValue("pattern", {
1762
1734
  key: rx.toString(),
1763
1735
  ref: rx,
1764
- code: (0, codegen_1$r._)`${regExp.code === "new RegExp" ? newRegExp : (0, util_2$1.useFunc)(gen, regExp)}(${pattern2}, ${u})`
1736
+ code: (0, codegen_1$u._)`${regExp.code === "new RegExp" ? newRegExp : (0, util_2$1.useFunc)(gen, regExp)}(${pattern2}, ${u})`
1765
1737
  });
1766
1738
  }
1767
1739
  code.usePattern = usePattern;
@@ -1777,14 +1749,14 @@ function validateArray(cxt) {
1777
1749
  validateItems(() => gen.break());
1778
1750
  return valid;
1779
1751
  function validateItems(notValid) {
1780
- const len = gen.const("len", (0, codegen_1$r._)`${data}.length`);
1752
+ const len = gen.const("len", (0, codegen_1$u._)`${data}.length`);
1781
1753
  gen.forRange("i", 0, len, (i) => {
1782
1754
  cxt.subschema({
1783
1755
  keyword: keyword2,
1784
1756
  dataProp: i,
1785
- dataPropType: util_1$q.Type.Num
1757
+ dataPropType: util_1$s.Type.Num
1786
1758
  }, valid);
1787
- gen.if((0, codegen_1$r.not)(valid), notValid);
1759
+ gen.if((0, codegen_1$u.not)(valid), notValid);
1788
1760
  });
1789
1761
  }
1790
1762
  }
@@ -1793,7 +1765,7 @@ function validateUnion(cxt) {
1793
1765
  const { gen, schema, keyword: keyword2, it } = cxt;
1794
1766
  if (!Array.isArray(schema))
1795
1767
  throw new Error("ajv implementation error");
1796
- const alwaysValid = schema.some((sch) => (0, util_1$q.alwaysValidSchema)(it, sch));
1768
+ const alwaysValid = schema.some((sch) => (0, util_1$s.alwaysValidSchema)(it, sch));
1797
1769
  if (alwaysValid && !it.opts.unevaluated)
1798
1770
  return;
1799
1771
  const valid = gen.let("valid", false);
@@ -1804,216 +1776,202 @@ function validateUnion(cxt) {
1804
1776
  schemaProp: i,
1805
1777
  compositeRule: true
1806
1778
  }, schValid);
1807
- gen.assign(valid, (0, codegen_1$r._)`${valid} || ${schValid}`);
1779
+ gen.assign(valid, (0, codegen_1$u._)`${valid} || ${schValid}`);
1808
1780
  const merged = cxt.mergeValidEvaluated(schCxt, schValid);
1809
1781
  if (!merged)
1810
- gen.if((0, codegen_1$r.not)(valid));
1782
+ gen.if((0, codegen_1$u.not)(valid));
1811
1783
  }));
1812
1784
  cxt.result(valid, () => cxt.reset(), () => cxt.error(true));
1813
1785
  }
1814
1786
  code.validateUnion = validateUnion;
1815
- var hasRequiredKeyword;
1816
- function requireKeyword() {
1817
- if (hasRequiredKeyword)
1818
- return keyword;
1819
- hasRequiredKeyword = 1;
1820
- Object.defineProperty(keyword, "__esModule", { value: true });
1821
- keyword.validateKeywordUsage = keyword.validSchemaType = keyword.funcKeywordCode = keyword.macroKeywordCode = void 0;
1822
- const codegen_12 = codegen;
1823
- const names_12 = requireNames();
1824
- const code_12 = code;
1825
- const errors_12 = errors;
1826
- function macroKeywordCode(cxt, def2) {
1827
- const { gen, keyword: keyword2, schema, parentSchema, it } = cxt;
1828
- const macroSchema = def2.macro.call(it.self, schema, parentSchema, it);
1829
- const schemaRef = useKeyword(gen, keyword2, macroSchema);
1830
- if (it.opts.validateSchema !== false)
1831
- it.self.validateSchema(macroSchema, true);
1832
- const valid = gen.name("valid");
1833
- cxt.subschema({
1834
- schema: macroSchema,
1835
- schemaPath: codegen_12.nil,
1836
- errSchemaPath: `${it.errSchemaPath}/${keyword2}`,
1837
- topSchemaRef: schemaRef,
1838
- compositeRule: true
1839
- }, valid);
1840
- cxt.pass(valid, () => cxt.error(true));
1841
- }
1842
- keyword.macroKeywordCode = macroKeywordCode;
1843
- function funcKeywordCode(cxt, def2) {
1844
- var _a;
1845
- const { gen, keyword: keyword2, schema, parentSchema, $data, it } = cxt;
1846
- checkAsyncKeyword(it, def2);
1847
- const validate2 = !$data && def2.compile ? def2.compile.call(it.self, schema, parentSchema, it) : def2.validate;
1848
- const validateRef = useKeyword(gen, keyword2, validate2);
1849
- const valid = gen.let("valid");
1850
- cxt.block$data(valid, validateKeyword);
1851
- cxt.ok((_a = def2.valid) !== null && _a !== void 0 ? _a : valid);
1852
- function validateKeyword() {
1853
- if (def2.errors === false) {
1854
- assignValid();
1855
- if (def2.modifying)
1856
- modifyData(cxt);
1857
- reportErrs(() => cxt.error());
1858
- } else {
1859
- const ruleErrs = def2.async ? validateAsync() : validateSync();
1860
- if (def2.modifying)
1861
- modifyData(cxt);
1862
- reportErrs(() => addErrs(cxt, ruleErrs));
1863
- }
1864
- }
1865
- function validateAsync() {
1866
- const ruleErrs = gen.let("ruleErrs", null);
1867
- gen.try(() => assignValid((0, codegen_12._)`await `), (e) => gen.assign(valid, false).if((0, codegen_12._)`${e} instanceof ${it.ValidationError}`, () => gen.assign(ruleErrs, (0, codegen_12._)`${e}.errors`), () => gen.throw(e)));
1868
- return ruleErrs;
1869
- }
1870
- function validateSync() {
1871
- const validateErrs = (0, codegen_12._)`${validateRef}.errors`;
1872
- gen.assign(validateErrs, null);
1873
- assignValid(codegen_12.nil);
1874
- return validateErrs;
1875
- }
1876
- function assignValid(_await = def2.async ? (0, codegen_12._)`await ` : codegen_12.nil) {
1877
- const passCxt = it.opts.passContext ? names_12.default.this : names_12.default.self;
1878
- const passSchema = !("compile" in def2 && !$data || def2.schema === false);
1879
- gen.assign(valid, (0, codegen_12._)`${_await}${(0, code_12.callValidateCode)(cxt, validateRef, passCxt, passSchema)}`, def2.modifying);
1880
- }
1881
- function reportErrs(errors2) {
1882
- var _a2;
1883
- gen.if((0, codegen_12.not)((_a2 = def2.valid) !== null && _a2 !== void 0 ? _a2 : valid), errors2);
1787
+ Object.defineProperty(keyword, "__esModule", { value: true });
1788
+ keyword.validateKeywordUsage = keyword.validSchemaType = keyword.funcKeywordCode = keyword.macroKeywordCode = void 0;
1789
+ const codegen_1$t = codegen;
1790
+ const names_1$7 = names$1;
1791
+ const code_1$9 = code;
1792
+ const errors_1$1 = errors;
1793
+ function macroKeywordCode(cxt, def2) {
1794
+ const { gen, keyword: keyword2, schema, parentSchema, it } = cxt;
1795
+ const macroSchema = def2.macro.call(it.self, schema, parentSchema, it);
1796
+ const schemaRef = useKeyword(gen, keyword2, macroSchema);
1797
+ if (it.opts.validateSchema !== false)
1798
+ it.self.validateSchema(macroSchema, true);
1799
+ const valid = gen.name("valid");
1800
+ cxt.subschema({
1801
+ schema: macroSchema,
1802
+ schemaPath: codegen_1$t.nil,
1803
+ errSchemaPath: `${it.errSchemaPath}/${keyword2}`,
1804
+ topSchemaRef: schemaRef,
1805
+ compositeRule: true
1806
+ }, valid);
1807
+ cxt.pass(valid, () => cxt.error(true));
1808
+ }
1809
+ keyword.macroKeywordCode = macroKeywordCode;
1810
+ function funcKeywordCode(cxt, def2) {
1811
+ var _a;
1812
+ const { gen, keyword: keyword2, schema, parentSchema, $data, it } = cxt;
1813
+ checkAsyncKeyword(it, def2);
1814
+ const validate2 = !$data && def2.compile ? def2.compile.call(it.self, schema, parentSchema, it) : def2.validate;
1815
+ const validateRef = useKeyword(gen, keyword2, validate2);
1816
+ const valid = gen.let("valid");
1817
+ cxt.block$data(valid, validateKeyword);
1818
+ cxt.ok((_a = def2.valid) !== null && _a !== void 0 ? _a : valid);
1819
+ function validateKeyword() {
1820
+ if (def2.errors === false) {
1821
+ assignValid();
1822
+ if (def2.modifying)
1823
+ modifyData(cxt);
1824
+ reportErrs(() => cxt.error());
1825
+ } else {
1826
+ const ruleErrs = def2.async ? validateAsync() : validateSync();
1827
+ if (def2.modifying)
1828
+ modifyData(cxt);
1829
+ reportErrs(() => addErrs(cxt, ruleErrs));
1884
1830
  }
1885
1831
  }
1886
- keyword.funcKeywordCode = funcKeywordCode;
1887
- function modifyData(cxt) {
1888
- const { gen, data, it } = cxt;
1889
- gen.if(it.parentData, () => gen.assign(data, (0, codegen_12._)`${it.parentData}[${it.parentDataProperty}]`));
1890
- }
1891
- function addErrs(cxt, errs) {
1892
- const { gen } = cxt;
1893
- gen.if((0, codegen_12._)`Array.isArray(${errs})`, () => {
1894
- gen.assign(names_12.default.vErrors, (0, codegen_12._)`${names_12.default.vErrors} === null ? ${errs} : ${names_12.default.vErrors}.concat(${errs})`).assign(names_12.default.errors, (0, codegen_12._)`${names_12.default.vErrors}.length`);
1895
- (0, errors_12.extendErrors)(cxt);
1896
- }, () => cxt.error());
1897
- }
1898
- function checkAsyncKeyword({ schemaEnv }, def2) {
1899
- if (def2.async && !schemaEnv.$async)
1900
- throw new Error("async keyword in sync schema");
1901
- }
1902
- function useKeyword(gen, keyword2, result) {
1903
- if (result === void 0)
1904
- throw new Error(`keyword "${keyword2}" failed to compile`);
1905
- return gen.scopeValue("keyword", typeof result == "function" ? { ref: result } : { ref: result, code: (0, codegen_12.stringify)(result) });
1906
- }
1907
- function validSchemaType(schema, schemaType, allowUndefined = false) {
1908
- return !schemaType.length || schemaType.some((st) => st === "array" ? Array.isArray(schema) : st === "object" ? schema && typeof schema == "object" && !Array.isArray(schema) : typeof schema == st || allowUndefined && typeof schema == "undefined");
1909
- }
1910
- keyword.validSchemaType = validSchemaType;
1911
- function validateKeywordUsage({ schema, opts, self, errSchemaPath }, def2, keyword2) {
1912
- if (Array.isArray(def2.keyword) ? !def2.keyword.includes(keyword2) : def2.keyword !== keyword2) {
1913
- throw new Error("ajv implementation error");
1914
- }
1915
- const deps = def2.dependencies;
1916
- if (deps === null || deps === void 0 ? void 0 : deps.some((kwd) => !Object.prototype.hasOwnProperty.call(schema, kwd))) {
1917
- throw new Error(`parent schema must have dependencies of ${keyword2}: ${deps.join(",")}`);
1918
- }
1919
- if (def2.validateSchema) {
1920
- const valid = def2.validateSchema(schema[keyword2]);
1921
- if (!valid) {
1922
- const msg = `keyword "${keyword2}" value is invalid at path "${errSchemaPath}": ` + self.errorsText(def2.validateSchema.errors);
1923
- if (opts.validateSchema === "log")
1924
- self.logger.error(msg);
1925
- else
1926
- throw new Error(msg);
1927
- }
1832
+ function validateAsync() {
1833
+ const ruleErrs = gen.let("ruleErrs", null);
1834
+ gen.try(() => assignValid((0, codegen_1$t._)`await `), (e) => gen.assign(valid, false).if((0, codegen_1$t._)`${e} instanceof ${it.ValidationError}`, () => gen.assign(ruleErrs, (0, codegen_1$t._)`${e}.errors`), () => gen.throw(e)));
1835
+ return ruleErrs;
1836
+ }
1837
+ function validateSync() {
1838
+ const validateErrs = (0, codegen_1$t._)`${validateRef}.errors`;
1839
+ gen.assign(validateErrs, null);
1840
+ assignValid(codegen_1$t.nil);
1841
+ return validateErrs;
1842
+ }
1843
+ function assignValid(_await = def2.async ? (0, codegen_1$t._)`await ` : codegen_1$t.nil) {
1844
+ const passCxt = it.opts.passContext ? names_1$7.default.this : names_1$7.default.self;
1845
+ const passSchema = !("compile" in def2 && !$data || def2.schema === false);
1846
+ gen.assign(valid, (0, codegen_1$t._)`${_await}${(0, code_1$9.callValidateCode)(cxt, validateRef, passCxt, passSchema)}`, def2.modifying);
1847
+ }
1848
+ function reportErrs(errors2) {
1849
+ var _a2;
1850
+ gen.if((0, codegen_1$t.not)((_a2 = def2.valid) !== null && _a2 !== void 0 ? _a2 : valid), errors2);
1851
+ }
1852
+ }
1853
+ keyword.funcKeywordCode = funcKeywordCode;
1854
+ function modifyData(cxt) {
1855
+ const { gen, data, it } = cxt;
1856
+ gen.if(it.parentData, () => gen.assign(data, (0, codegen_1$t._)`${it.parentData}[${it.parentDataProperty}]`));
1857
+ }
1858
+ function addErrs(cxt, errs) {
1859
+ const { gen } = cxt;
1860
+ gen.if((0, codegen_1$t._)`Array.isArray(${errs})`, () => {
1861
+ gen.assign(names_1$7.default.vErrors, (0, codegen_1$t._)`${names_1$7.default.vErrors} === null ? ${errs} : ${names_1$7.default.vErrors}.concat(${errs})`).assign(names_1$7.default.errors, (0, codegen_1$t._)`${names_1$7.default.vErrors}.length`);
1862
+ (0, errors_1$1.extendErrors)(cxt);
1863
+ }, () => cxt.error());
1864
+ }
1865
+ function checkAsyncKeyword({ schemaEnv }, def2) {
1866
+ if (def2.async && !schemaEnv.$async)
1867
+ throw new Error("async keyword in sync schema");
1868
+ }
1869
+ function useKeyword(gen, keyword2, result) {
1870
+ if (result === void 0)
1871
+ throw new Error(`keyword "${keyword2}" failed to compile`);
1872
+ return gen.scopeValue("keyword", typeof result == "function" ? { ref: result } : { ref: result, code: (0, codegen_1$t.stringify)(result) });
1873
+ }
1874
+ function validSchemaType(schema, schemaType, allowUndefined = false) {
1875
+ return !schemaType.length || schemaType.some((st) => st === "array" ? Array.isArray(schema) : st === "object" ? schema && typeof schema == "object" && !Array.isArray(schema) : typeof schema == st || allowUndefined && typeof schema == "undefined");
1876
+ }
1877
+ keyword.validSchemaType = validSchemaType;
1878
+ function validateKeywordUsage({ schema, opts, self, errSchemaPath }, def2, keyword2) {
1879
+ if (Array.isArray(def2.keyword) ? !def2.keyword.includes(keyword2) : def2.keyword !== keyword2) {
1880
+ throw new Error("ajv implementation error");
1881
+ }
1882
+ const deps = def2.dependencies;
1883
+ if (deps === null || deps === void 0 ? void 0 : deps.some((kwd) => !Object.prototype.hasOwnProperty.call(schema, kwd))) {
1884
+ throw new Error(`parent schema must have dependencies of ${keyword2}: ${deps.join(",")}`);
1885
+ }
1886
+ if (def2.validateSchema) {
1887
+ const valid = def2.validateSchema(schema[keyword2]);
1888
+ if (!valid) {
1889
+ const msg = `keyword "${keyword2}" value is invalid at path "${errSchemaPath}": ` + self.errorsText(def2.validateSchema.errors);
1890
+ if (opts.validateSchema === "log")
1891
+ self.logger.error(msg);
1892
+ else
1893
+ throw new Error(msg);
1928
1894
  }
1929
1895
  }
1930
- keyword.validateKeywordUsage = validateKeywordUsage;
1931
- return keyword;
1932
1896
  }
1897
+ keyword.validateKeywordUsage = validateKeywordUsage;
1933
1898
  var subschema = {};
1934
- var hasRequiredSubschema;
1935
- function requireSubschema() {
1936
- if (hasRequiredSubschema)
1937
- return subschema;
1938
- hasRequiredSubschema = 1;
1939
- Object.defineProperty(subschema, "__esModule", { value: true });
1940
- subschema.extendSubschemaMode = subschema.extendSubschemaData = subschema.getSubschema = void 0;
1941
- const codegen_12 = codegen;
1942
- const util_12 = util;
1943
- function getSubschema(it, { keyword: keyword2, schemaProp, schema, schemaPath, errSchemaPath, topSchemaRef }) {
1944
- if (keyword2 !== void 0 && schema !== void 0) {
1945
- throw new Error('both "keyword" and "schema" passed, only one allowed');
1946
- }
1947
- if (keyword2 !== void 0) {
1948
- const sch = it.schema[keyword2];
1949
- return schemaProp === void 0 ? {
1950
- schema: sch,
1951
- schemaPath: (0, codegen_12._)`${it.schemaPath}${(0, codegen_12.getProperty)(keyword2)}`,
1952
- errSchemaPath: `${it.errSchemaPath}/${keyword2}`
1953
- } : {
1954
- schema: sch[schemaProp],
1955
- schemaPath: (0, codegen_12._)`${it.schemaPath}${(0, codegen_12.getProperty)(keyword2)}${(0, codegen_12.getProperty)(schemaProp)}`,
1956
- errSchemaPath: `${it.errSchemaPath}/${keyword2}/${(0, util_12.escapeFragment)(schemaProp)}`
1957
- };
1958
- }
1959
- if (schema !== void 0) {
1960
- if (schemaPath === void 0 || errSchemaPath === void 0 || topSchemaRef === void 0) {
1961
- throw new Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');
1962
- }
1963
- return {
1964
- schema,
1965
- schemaPath,
1966
- topSchemaRef,
1967
- errSchemaPath
1968
- };
1899
+ Object.defineProperty(subschema, "__esModule", { value: true });
1900
+ subschema.extendSubschemaMode = subschema.extendSubschemaData = subschema.getSubschema = void 0;
1901
+ const codegen_1$s = codegen;
1902
+ const util_1$r = util;
1903
+ function getSubschema(it, { keyword: keyword2, schemaProp, schema, schemaPath, errSchemaPath, topSchemaRef }) {
1904
+ if (keyword2 !== void 0 && schema !== void 0) {
1905
+ throw new Error('both "keyword" and "schema" passed, only one allowed');
1906
+ }
1907
+ if (keyword2 !== void 0) {
1908
+ const sch = it.schema[keyword2];
1909
+ return schemaProp === void 0 ? {
1910
+ schema: sch,
1911
+ schemaPath: (0, codegen_1$s._)`${it.schemaPath}${(0, codegen_1$s.getProperty)(keyword2)}`,
1912
+ errSchemaPath: `${it.errSchemaPath}/${keyword2}`
1913
+ } : {
1914
+ schema: sch[schemaProp],
1915
+ schemaPath: (0, codegen_1$s._)`${it.schemaPath}${(0, codegen_1$s.getProperty)(keyword2)}${(0, codegen_1$s.getProperty)(schemaProp)}`,
1916
+ errSchemaPath: `${it.errSchemaPath}/${keyword2}/${(0, util_1$r.escapeFragment)(schemaProp)}`
1917
+ };
1918
+ }
1919
+ if (schema !== void 0) {
1920
+ if (schemaPath === void 0 || errSchemaPath === void 0 || topSchemaRef === void 0) {
1921
+ throw new Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');
1969
1922
  }
1970
- throw new Error('either "keyword" or "schema" must be passed');
1971
- }
1972
- subschema.getSubschema = getSubschema;
1973
- function extendSubschemaData(subschema2, it, { dataProp, dataPropType: dpType, data, dataTypes, propertyName }) {
1974
- if (data !== void 0 && dataProp !== void 0) {
1975
- throw new Error('both "data" and "dataProp" passed, only one allowed');
1976
- }
1977
- const { gen } = it;
1978
- if (dataProp !== void 0) {
1979
- const { errorPath, dataPathArr, opts } = it;
1980
- const nextData = gen.let("data", (0, codegen_12._)`${it.data}${(0, codegen_12.getProperty)(dataProp)}`, true);
1981
- dataContextProps(nextData);
1982
- subschema2.errorPath = (0, codegen_12.str)`${errorPath}${(0, util_12.getErrorPath)(dataProp, dpType, opts.jsPropertySyntax)}`;
1983
- subschema2.parentDataProperty = (0, codegen_12._)`${dataProp}`;
1984
- subschema2.dataPathArr = [...dataPathArr, subschema2.parentDataProperty];
1985
- }
1986
- if (data !== void 0) {
1987
- const nextData = data instanceof codegen_12.Name ? data : gen.let("data", data, true);
1988
- dataContextProps(nextData);
1989
- if (propertyName !== void 0)
1990
- subschema2.propertyName = propertyName;
1991
- }
1992
- if (dataTypes)
1993
- subschema2.dataTypes = dataTypes;
1994
- function dataContextProps(_nextData) {
1995
- subschema2.data = _nextData;
1996
- subschema2.dataLevel = it.dataLevel + 1;
1997
- subschema2.dataTypes = [];
1998
- it.definedProperties = /* @__PURE__ */ new Set();
1999
- subschema2.parentData = it.data;
2000
- subschema2.dataNames = [...it.dataNames, _nextData];
2001
- }
2002
- }
2003
- subschema.extendSubschemaData = extendSubschemaData;
2004
- function extendSubschemaMode(subschema2, { jtdDiscriminator, jtdMetadata, compositeRule, createErrors, allErrors }) {
2005
- if (compositeRule !== void 0)
2006
- subschema2.compositeRule = compositeRule;
2007
- if (createErrors !== void 0)
2008
- subschema2.createErrors = createErrors;
2009
- if (allErrors !== void 0)
2010
- subschema2.allErrors = allErrors;
2011
- subschema2.jtdDiscriminator = jtdDiscriminator;
2012
- subschema2.jtdMetadata = jtdMetadata;
2013
- }
2014
- subschema.extendSubschemaMode = extendSubschemaMode;
2015
- return subschema;
1923
+ return {
1924
+ schema,
1925
+ schemaPath,
1926
+ topSchemaRef,
1927
+ errSchemaPath
1928
+ };
1929
+ }
1930
+ throw new Error('either "keyword" or "schema" must be passed');
1931
+ }
1932
+ subschema.getSubschema = getSubschema;
1933
+ function extendSubschemaData(subschema2, it, { dataProp, dataPropType: dpType, data, dataTypes, propertyName }) {
1934
+ if (data !== void 0 && dataProp !== void 0) {
1935
+ throw new Error('both "data" and "dataProp" passed, only one allowed');
1936
+ }
1937
+ const { gen } = it;
1938
+ if (dataProp !== void 0) {
1939
+ const { errorPath, dataPathArr, opts } = it;
1940
+ const nextData = gen.let("data", (0, codegen_1$s._)`${it.data}${(0, codegen_1$s.getProperty)(dataProp)}`, true);
1941
+ dataContextProps(nextData);
1942
+ subschema2.errorPath = (0, codegen_1$s.str)`${errorPath}${(0, util_1$r.getErrorPath)(dataProp, dpType, opts.jsPropertySyntax)}`;
1943
+ subschema2.parentDataProperty = (0, codegen_1$s._)`${dataProp}`;
1944
+ subschema2.dataPathArr = [...dataPathArr, subschema2.parentDataProperty];
1945
+ }
1946
+ if (data !== void 0) {
1947
+ const nextData = data instanceof codegen_1$s.Name ? data : gen.let("data", data, true);
1948
+ dataContextProps(nextData);
1949
+ if (propertyName !== void 0)
1950
+ subschema2.propertyName = propertyName;
1951
+ }
1952
+ if (dataTypes)
1953
+ subschema2.dataTypes = dataTypes;
1954
+ function dataContextProps(_nextData) {
1955
+ subschema2.data = _nextData;
1956
+ subschema2.dataLevel = it.dataLevel + 1;
1957
+ subschema2.dataTypes = [];
1958
+ it.definedProperties = /* @__PURE__ */ new Set();
1959
+ subschema2.parentData = it.data;
1960
+ subschema2.dataNames = [...it.dataNames, _nextData];
1961
+ }
1962
+ }
1963
+ subschema.extendSubschemaData = extendSubschemaData;
1964
+ function extendSubschemaMode(subschema2, { jtdDiscriminator, jtdMetadata, compositeRule, createErrors, allErrors }) {
1965
+ if (compositeRule !== void 0)
1966
+ subschema2.compositeRule = compositeRule;
1967
+ if (createErrors !== void 0)
1968
+ subschema2.createErrors = createErrors;
1969
+ if (allErrors !== void 0)
1970
+ subschema2.allErrors = allErrors;
1971
+ subschema2.jtdDiscriminator = jtdDiscriminator;
1972
+ subschema2.jtdMetadata = jtdMetadata;
2016
1973
  }
1974
+ subschema.extendSubschemaMode = extendSubschemaMode;
2017
1975
  var resolve$2 = {};
2018
1976
  var fastDeepEqual = function equal(a, b) {
2019
1977
  if (a === b)
@@ -2138,7 +2096,7 @@ function escapeJsonPtr(str) {
2138
2096
  var jsonSchemaTraverseExports = jsonSchemaTraverse.exports;
2139
2097
  Object.defineProperty(resolve$2, "__esModule", { value: true });
2140
2098
  resolve$2.getSchemaRefs = resolve$2.resolveUrl = resolve$2.normalizeId = resolve$2._getFullPath = resolve$2.getFullPath = resolve$2.inlineRef = void 0;
2141
- const util_1$p = util;
2099
+ const util_1$q = util;
2142
2100
  const equal$3 = fastDeepEqual;
2143
2101
  const traverse = jsonSchemaTraverseExports;
2144
2102
  const SIMPLE_INLINED = /* @__PURE__ */ new Set([
@@ -2197,7 +2155,7 @@ function countKeys(schema) {
2197
2155
  if (SIMPLE_INLINED.has(key))
2198
2156
  continue;
2199
2157
  if (typeof schema[key] == "object") {
2200
- (0, util_1$p.eachItem)(schema[key], (sch) => count += countKeys(sch));
2158
+ (0, util_1$q.eachItem)(schema[key], (sch) => count += countKeys(sch));
2201
2159
  }
2202
2160
  if (count === Infinity)
2203
2161
  return Infinity;
@@ -2285,513 +2243,506 @@ function getSchemaRefs(schema, baseId) {
2285
2243
  }
2286
2244
  }
2287
2245
  resolve$2.getSchemaRefs = getSchemaRefs;
2288
- var hasRequiredValidate;
2289
- function requireValidate() {
2290
- if (hasRequiredValidate)
2291
- return validate;
2292
- hasRequiredValidate = 1;
2293
- Object.defineProperty(validate, "__esModule", { value: true });
2294
- validate.getData = validate.KeywordCxt = validate.validateFunctionCode = void 0;
2295
- const boolSchema_1 = requireBoolSchema();
2296
- const dataType_12 = dataType;
2297
- const applicability_12 = requireApplicability();
2298
- const dataType_2 = dataType;
2299
- const defaults_1 = requireDefaults();
2300
- const keyword_1 = requireKeyword();
2301
- const subschema_1 = requireSubschema();
2302
- const codegen_12 = codegen;
2303
- const names_12 = requireNames();
2304
- const resolve_12 = resolve$2;
2305
- const util_12 = util;
2306
- const errors_12 = errors;
2307
- function validateFunctionCode(it) {
2308
- if (isSchemaObj(it)) {
2309
- checkKeywords(it);
2310
- if (schemaCxtHasRules(it)) {
2311
- topSchemaObjCode(it);
2312
- return;
2313
- }
2246
+ Object.defineProperty(validate, "__esModule", { value: true });
2247
+ validate.getData = validate.KeywordCxt = validate.validateFunctionCode = void 0;
2248
+ const boolSchema_1 = boolSchema;
2249
+ const dataType_1$1 = dataType;
2250
+ const applicability_1 = applicability;
2251
+ const dataType_2 = dataType;
2252
+ const defaults_1 = defaults;
2253
+ const keyword_1 = keyword;
2254
+ const subschema_1 = subschema;
2255
+ const codegen_1$r = codegen;
2256
+ const names_1$6 = names$1;
2257
+ const resolve_1$2 = resolve$2;
2258
+ const util_1$p = util;
2259
+ const errors_1 = errors;
2260
+ function validateFunctionCode(it) {
2261
+ if (isSchemaObj(it)) {
2262
+ checkKeywords(it);
2263
+ if (schemaCxtHasRules(it)) {
2264
+ topSchemaObjCode(it);
2265
+ return;
2314
2266
  }
2315
- validateFunction(it, () => (0, boolSchema_1.topBoolOrEmptySchema)(it));
2316
2267
  }
2317
- validate.validateFunctionCode = validateFunctionCode;
2318
- function validateFunction({ gen, validateName, schema, schemaEnv, opts }, body) {
2319
- if (opts.code.es5) {
2320
- gen.func(validateName, (0, codegen_12._)`${names_12.default.data}, ${names_12.default.valCxt}`, schemaEnv.$async, () => {
2321
- gen.code((0, codegen_12._)`"use strict"; ${funcSourceUrl(schema, opts)}`);
2322
- destructureValCxtES5(gen, opts);
2323
- gen.code(body);
2324
- });
2325
- } else {
2326
- gen.func(validateName, (0, codegen_12._)`${names_12.default.data}, ${destructureValCxt(opts)}`, schemaEnv.$async, () => gen.code(funcSourceUrl(schema, opts)).code(body));
2327
- }
2328
- }
2329
- function destructureValCxt(opts) {
2330
- return (0, codegen_12._)`{${names_12.default.instancePath}="", ${names_12.default.parentData}, ${names_12.default.parentDataProperty}, ${names_12.default.rootData}=${names_12.default.data}${opts.dynamicRef ? (0, codegen_12._)`, ${names_12.default.dynamicAnchors}={}` : codegen_12.nil}}={}`;
2331
- }
2332
- function destructureValCxtES5(gen, opts) {
2333
- gen.if(names_12.default.valCxt, () => {
2334
- gen.var(names_12.default.instancePath, (0, codegen_12._)`${names_12.default.valCxt}.${names_12.default.instancePath}`);
2335
- gen.var(names_12.default.parentData, (0, codegen_12._)`${names_12.default.valCxt}.${names_12.default.parentData}`);
2336
- gen.var(names_12.default.parentDataProperty, (0, codegen_12._)`${names_12.default.valCxt}.${names_12.default.parentDataProperty}`);
2337
- gen.var(names_12.default.rootData, (0, codegen_12._)`${names_12.default.valCxt}.${names_12.default.rootData}`);
2338
- if (opts.dynamicRef)
2339
- gen.var(names_12.default.dynamicAnchors, (0, codegen_12._)`${names_12.default.valCxt}.${names_12.default.dynamicAnchors}`);
2340
- }, () => {
2341
- gen.var(names_12.default.instancePath, (0, codegen_12._)`""`);
2342
- gen.var(names_12.default.parentData, (0, codegen_12._)`undefined`);
2343
- gen.var(names_12.default.parentDataProperty, (0, codegen_12._)`undefined`);
2344
- gen.var(names_12.default.rootData, names_12.default.data);
2345
- if (opts.dynamicRef)
2346
- gen.var(names_12.default.dynamicAnchors, (0, codegen_12._)`{}`);
2347
- });
2348
- }
2349
- function topSchemaObjCode(it) {
2350
- const { schema, opts, gen } = it;
2351
- validateFunction(it, () => {
2352
- if (opts.$comment && schema.$comment)
2353
- commentKeyword(it);
2354
- checkNoDefault(it);
2355
- gen.let(names_12.default.vErrors, null);
2356
- gen.let(names_12.default.errors, 0);
2357
- if (opts.unevaluated)
2358
- resetEvaluated(it);
2359
- typeAndKeywords(it);
2360
- returnResults(it);
2268
+ validateFunction(it, () => (0, boolSchema_1.topBoolOrEmptySchema)(it));
2269
+ }
2270
+ validate.validateFunctionCode = validateFunctionCode;
2271
+ function validateFunction({ gen, validateName, schema, schemaEnv, opts }, body) {
2272
+ if (opts.code.es5) {
2273
+ gen.func(validateName, (0, codegen_1$r._)`${names_1$6.default.data}, ${names_1$6.default.valCxt}`, schemaEnv.$async, () => {
2274
+ gen.code((0, codegen_1$r._)`"use strict"; ${funcSourceUrl(schema, opts)}`);
2275
+ destructureValCxtES5(gen, opts);
2276
+ gen.code(body);
2361
2277
  });
2362
- return;
2363
- }
2364
- function resetEvaluated(it) {
2365
- const { gen, validateName } = it;
2366
- it.evaluated = gen.const("evaluated", (0, codegen_12._)`${validateName}.evaluated`);
2367
- gen.if((0, codegen_12._)`${it.evaluated}.dynamicProps`, () => gen.assign((0, codegen_12._)`${it.evaluated}.props`, (0, codegen_12._)`undefined`));
2368
- gen.if((0, codegen_12._)`${it.evaluated}.dynamicItems`, () => gen.assign((0, codegen_12._)`${it.evaluated}.items`, (0, codegen_12._)`undefined`));
2369
- }
2370
- function funcSourceUrl(schema, opts) {
2371
- const schId = typeof schema == "object" && schema[opts.schemaId];
2372
- return schId && (opts.code.source || opts.code.process) ? (0, codegen_12._)`/*# sourceURL=${schId} */` : codegen_12.nil;
2373
- }
2374
- function subschemaCode(it, valid) {
2375
- if (isSchemaObj(it)) {
2376
- checkKeywords(it);
2377
- if (schemaCxtHasRules(it)) {
2378
- subSchemaObjCode(it, valid);
2379
- return;
2380
- }
2381
- }
2382
- (0, boolSchema_1.boolOrEmptySchema)(it, valid);
2383
- }
2384
- function schemaCxtHasRules({ schema, self }) {
2385
- if (typeof schema == "boolean")
2386
- return !schema;
2387
- for (const key in schema)
2388
- if (self.RULES.all[key])
2389
- return true;
2390
- return false;
2391
- }
2392
- function isSchemaObj(it) {
2393
- return typeof it.schema != "boolean";
2278
+ } else {
2279
+ gen.func(validateName, (0, codegen_1$r._)`${names_1$6.default.data}, ${destructureValCxt(opts)}`, schemaEnv.$async, () => gen.code(funcSourceUrl(schema, opts)).code(body));
2394
2280
  }
2395
- function subSchemaObjCode(it, valid) {
2396
- const { schema, gen, opts } = it;
2281
+ }
2282
+ function destructureValCxt(opts) {
2283
+ return (0, codegen_1$r._)`{${names_1$6.default.instancePath}="", ${names_1$6.default.parentData}, ${names_1$6.default.parentDataProperty}, ${names_1$6.default.rootData}=${names_1$6.default.data}${opts.dynamicRef ? (0, codegen_1$r._)`, ${names_1$6.default.dynamicAnchors}={}` : codegen_1$r.nil}}={}`;
2284
+ }
2285
+ function destructureValCxtES5(gen, opts) {
2286
+ gen.if(names_1$6.default.valCxt, () => {
2287
+ gen.var(names_1$6.default.instancePath, (0, codegen_1$r._)`${names_1$6.default.valCxt}.${names_1$6.default.instancePath}`);
2288
+ gen.var(names_1$6.default.parentData, (0, codegen_1$r._)`${names_1$6.default.valCxt}.${names_1$6.default.parentData}`);
2289
+ gen.var(names_1$6.default.parentDataProperty, (0, codegen_1$r._)`${names_1$6.default.valCxt}.${names_1$6.default.parentDataProperty}`);
2290
+ gen.var(names_1$6.default.rootData, (0, codegen_1$r._)`${names_1$6.default.valCxt}.${names_1$6.default.rootData}`);
2291
+ if (opts.dynamicRef)
2292
+ gen.var(names_1$6.default.dynamicAnchors, (0, codegen_1$r._)`${names_1$6.default.valCxt}.${names_1$6.default.dynamicAnchors}`);
2293
+ }, () => {
2294
+ gen.var(names_1$6.default.instancePath, (0, codegen_1$r._)`""`);
2295
+ gen.var(names_1$6.default.parentData, (0, codegen_1$r._)`undefined`);
2296
+ gen.var(names_1$6.default.parentDataProperty, (0, codegen_1$r._)`undefined`);
2297
+ gen.var(names_1$6.default.rootData, names_1$6.default.data);
2298
+ if (opts.dynamicRef)
2299
+ gen.var(names_1$6.default.dynamicAnchors, (0, codegen_1$r._)`{}`);
2300
+ });
2301
+ }
2302
+ function topSchemaObjCode(it) {
2303
+ const { schema, opts, gen } = it;
2304
+ validateFunction(it, () => {
2397
2305
  if (opts.$comment && schema.$comment)
2398
2306
  commentKeyword(it);
2399
- updateContext(it);
2400
- checkAsyncSchema(it);
2401
- const errsCount = gen.const("_errs", names_12.default.errors);
2402
- typeAndKeywords(it, errsCount);
2403
- gen.var(valid, (0, codegen_12._)`${errsCount} === ${names_12.default.errors}`);
2404
- }
2405
- function checkKeywords(it) {
2406
- (0, util_12.checkUnknownRules)(it);
2407
- checkRefsAndKeywords(it);
2408
- }
2409
- function typeAndKeywords(it, errsCount) {
2410
- if (it.opts.jtd)
2411
- return schemaKeywords(it, [], false, errsCount);
2412
- const types2 = (0, dataType_12.getSchemaTypes)(it.schema);
2413
- const checkedTypes = (0, dataType_12.coerceAndCheckDataType)(it, types2);
2414
- schemaKeywords(it, types2, !checkedTypes, errsCount);
2415
- }
2416
- function checkRefsAndKeywords(it) {
2417
- const { schema, errSchemaPath, opts, self } = it;
2418
- if (schema.$ref && opts.ignoreKeywordsWithRef && (0, util_12.schemaHasRulesButRef)(schema, self.RULES)) {
2419
- self.logger.warn(`$ref: keywords ignored in schema at path "${errSchemaPath}"`);
2307
+ checkNoDefault(it);
2308
+ gen.let(names_1$6.default.vErrors, null);
2309
+ gen.let(names_1$6.default.errors, 0);
2310
+ if (opts.unevaluated)
2311
+ resetEvaluated(it);
2312
+ typeAndKeywords(it);
2313
+ returnResults(it);
2314
+ });
2315
+ return;
2316
+ }
2317
+ function resetEvaluated(it) {
2318
+ const { gen, validateName } = it;
2319
+ it.evaluated = gen.const("evaluated", (0, codegen_1$r._)`${validateName}.evaluated`);
2320
+ gen.if((0, codegen_1$r._)`${it.evaluated}.dynamicProps`, () => gen.assign((0, codegen_1$r._)`${it.evaluated}.props`, (0, codegen_1$r._)`undefined`));
2321
+ gen.if((0, codegen_1$r._)`${it.evaluated}.dynamicItems`, () => gen.assign((0, codegen_1$r._)`${it.evaluated}.items`, (0, codegen_1$r._)`undefined`));
2322
+ }
2323
+ function funcSourceUrl(schema, opts) {
2324
+ const schId = typeof schema == "object" && schema[opts.schemaId];
2325
+ return schId && (opts.code.source || opts.code.process) ? (0, codegen_1$r._)`/*# sourceURL=${schId} */` : codegen_1$r.nil;
2326
+ }
2327
+ function subschemaCode(it, valid) {
2328
+ if (isSchemaObj(it)) {
2329
+ checkKeywords(it);
2330
+ if (schemaCxtHasRules(it)) {
2331
+ subSchemaObjCode(it, valid);
2332
+ return;
2420
2333
  }
2421
2334
  }
2422
- function checkNoDefault(it) {
2423
- const { schema, opts } = it;
2424
- if (schema.default !== void 0 && opts.useDefaults && opts.strictSchema) {
2425
- (0, util_12.checkStrictMode)(it, "default is ignored in the schema root");
2426
- }
2335
+ (0, boolSchema_1.boolOrEmptySchema)(it, valid);
2336
+ }
2337
+ function schemaCxtHasRules({ schema, self }) {
2338
+ if (typeof schema == "boolean")
2339
+ return !schema;
2340
+ for (const key in schema)
2341
+ if (self.RULES.all[key])
2342
+ return true;
2343
+ return false;
2344
+ }
2345
+ function isSchemaObj(it) {
2346
+ return typeof it.schema != "boolean";
2347
+ }
2348
+ function subSchemaObjCode(it, valid) {
2349
+ const { schema, gen, opts } = it;
2350
+ if (opts.$comment && schema.$comment)
2351
+ commentKeyword(it);
2352
+ updateContext(it);
2353
+ checkAsyncSchema(it);
2354
+ const errsCount = gen.const("_errs", names_1$6.default.errors);
2355
+ typeAndKeywords(it, errsCount);
2356
+ gen.var(valid, (0, codegen_1$r._)`${errsCount} === ${names_1$6.default.errors}`);
2357
+ }
2358
+ function checkKeywords(it) {
2359
+ (0, util_1$p.checkUnknownRules)(it);
2360
+ checkRefsAndKeywords(it);
2361
+ }
2362
+ function typeAndKeywords(it, errsCount) {
2363
+ if (it.opts.jtd)
2364
+ return schemaKeywords(it, [], false, errsCount);
2365
+ const types2 = (0, dataType_1$1.getSchemaTypes)(it.schema);
2366
+ const checkedTypes = (0, dataType_1$1.coerceAndCheckDataType)(it, types2);
2367
+ schemaKeywords(it, types2, !checkedTypes, errsCount);
2368
+ }
2369
+ function checkRefsAndKeywords(it) {
2370
+ const { schema, errSchemaPath, opts, self } = it;
2371
+ if (schema.$ref && opts.ignoreKeywordsWithRef && (0, util_1$p.schemaHasRulesButRef)(schema, self.RULES)) {
2372
+ self.logger.warn(`$ref: keywords ignored in schema at path "${errSchemaPath}"`);
2427
2373
  }
2428
- function updateContext(it) {
2429
- const schId = it.schema[it.opts.schemaId];
2430
- if (schId)
2431
- it.baseId = (0, resolve_12.resolveUrl)(it.opts.uriResolver, it.baseId, schId);
2374
+ }
2375
+ function checkNoDefault(it) {
2376
+ const { schema, opts } = it;
2377
+ if (schema.default !== void 0 && opts.useDefaults && opts.strictSchema) {
2378
+ (0, util_1$p.checkStrictMode)(it, "default is ignored in the schema root");
2432
2379
  }
2433
- function checkAsyncSchema(it) {
2434
- if (it.schema.$async && !it.schemaEnv.$async)
2435
- throw new Error("async schema in sync schema");
2380
+ }
2381
+ function updateContext(it) {
2382
+ const schId = it.schema[it.opts.schemaId];
2383
+ if (schId)
2384
+ it.baseId = (0, resolve_1$2.resolveUrl)(it.opts.uriResolver, it.baseId, schId);
2385
+ }
2386
+ function checkAsyncSchema(it) {
2387
+ if (it.schema.$async && !it.schemaEnv.$async)
2388
+ throw new Error("async schema in sync schema");
2389
+ }
2390
+ function commentKeyword({ gen, schemaEnv, schema, errSchemaPath, opts }) {
2391
+ const msg = schema.$comment;
2392
+ if (opts.$comment === true) {
2393
+ gen.code((0, codegen_1$r._)`${names_1$6.default.self}.logger.log(${msg})`);
2394
+ } else if (typeof opts.$comment == "function") {
2395
+ const schemaPath = (0, codegen_1$r.str)`${errSchemaPath}/$comment`;
2396
+ const rootName = gen.scopeValue("root", { ref: schemaEnv.root });
2397
+ gen.code((0, codegen_1$r._)`${names_1$6.default.self}.opts.$comment(${msg}, ${schemaPath}, ${rootName}.schema)`);
2436
2398
  }
2437
- function commentKeyword({ gen, schemaEnv, schema, errSchemaPath, opts }) {
2438
- const msg = schema.$comment;
2439
- if (opts.$comment === true) {
2440
- gen.code((0, codegen_12._)`${names_12.default.self}.logger.log(${msg})`);
2441
- } else if (typeof opts.$comment == "function") {
2442
- const schemaPath = (0, codegen_12.str)`${errSchemaPath}/$comment`;
2443
- const rootName = gen.scopeValue("root", { ref: schemaEnv.root });
2444
- gen.code((0, codegen_12._)`${names_12.default.self}.opts.$comment(${msg}, ${schemaPath}, ${rootName}.schema)`);
2445
- }
2399
+ }
2400
+ function returnResults(it) {
2401
+ const { gen, schemaEnv, validateName, ValidationError: ValidationError2, opts } = it;
2402
+ if (schemaEnv.$async) {
2403
+ gen.if((0, codegen_1$r._)`${names_1$6.default.errors} === 0`, () => gen.return(names_1$6.default.data), () => gen.throw((0, codegen_1$r._)`new ${ValidationError2}(${names_1$6.default.vErrors})`));
2404
+ } else {
2405
+ gen.assign((0, codegen_1$r._)`${validateName}.errors`, names_1$6.default.vErrors);
2406
+ if (opts.unevaluated)
2407
+ assignEvaluated(it);
2408
+ gen.return((0, codegen_1$r._)`${names_1$6.default.errors} === 0`);
2446
2409
  }
2447
- function returnResults(it) {
2448
- const { gen, schemaEnv, validateName, ValidationError: ValidationError2, opts } = it;
2449
- if (schemaEnv.$async) {
2450
- gen.if((0, codegen_12._)`${names_12.default.errors} === 0`, () => gen.return(names_12.default.data), () => gen.throw((0, codegen_12._)`new ${ValidationError2}(${names_12.default.vErrors})`));
2451
- } else {
2452
- gen.assign((0, codegen_12._)`${validateName}.errors`, names_12.default.vErrors);
2453
- if (opts.unevaluated)
2454
- assignEvaluated(it);
2455
- gen.return((0, codegen_12._)`${names_12.default.errors} === 0`);
2456
- }
2457
- }
2458
- function assignEvaluated({ gen, evaluated, props, items: items2 }) {
2459
- if (props instanceof codegen_12.Name)
2460
- gen.assign((0, codegen_12._)`${evaluated}.props`, props);
2461
- if (items2 instanceof codegen_12.Name)
2462
- gen.assign((0, codegen_12._)`${evaluated}.items`, items2);
2463
- }
2464
- function schemaKeywords(it, types2, typeErrors, errsCount) {
2465
- const { gen, schema, data, allErrors, opts, self } = it;
2466
- const { RULES } = self;
2467
- if (schema.$ref && (opts.ignoreKeywordsWithRef || !(0, util_12.schemaHasRulesButRef)(schema, RULES))) {
2468
- gen.block(() => keywordCode(it, "$ref", RULES.all.$ref.definition));
2410
+ }
2411
+ function assignEvaluated({ gen, evaluated, props, items: items2 }) {
2412
+ if (props instanceof codegen_1$r.Name)
2413
+ gen.assign((0, codegen_1$r._)`${evaluated}.props`, props);
2414
+ if (items2 instanceof codegen_1$r.Name)
2415
+ gen.assign((0, codegen_1$r._)`${evaluated}.items`, items2);
2416
+ }
2417
+ function schemaKeywords(it, types2, typeErrors, errsCount) {
2418
+ const { gen, schema, data, allErrors, opts, self } = it;
2419
+ const { RULES } = self;
2420
+ if (schema.$ref && (opts.ignoreKeywordsWithRef || !(0, util_1$p.schemaHasRulesButRef)(schema, RULES))) {
2421
+ gen.block(() => keywordCode(it, "$ref", RULES.all.$ref.definition));
2422
+ return;
2423
+ }
2424
+ if (!opts.jtd)
2425
+ checkStrictTypes(it, types2);
2426
+ gen.block(() => {
2427
+ for (const group of RULES.rules)
2428
+ groupKeywords(group);
2429
+ groupKeywords(RULES.post);
2430
+ });
2431
+ function groupKeywords(group) {
2432
+ if (!(0, applicability_1.shouldUseGroup)(schema, group))
2469
2433
  return;
2470
- }
2471
- if (!opts.jtd)
2472
- checkStrictTypes(it, types2);
2473
- gen.block(() => {
2474
- for (const group of RULES.rules)
2475
- groupKeywords(group);
2476
- groupKeywords(RULES.post);
2477
- });
2478
- function groupKeywords(group) {
2479
- if (!(0, applicability_12.shouldUseGroup)(schema, group))
2480
- return;
2481
- if (group.type) {
2482
- gen.if((0, dataType_2.checkDataType)(group.type, data, opts.strictNumbers));
2483
- iterateKeywords(it, group);
2484
- if (types2.length === 1 && types2[0] === group.type && typeErrors) {
2485
- gen.else();
2486
- (0, dataType_2.reportTypeError)(it);
2487
- }
2488
- gen.endIf();
2489
- } else {
2490
- iterateKeywords(it, group);
2434
+ if (group.type) {
2435
+ gen.if((0, dataType_2.checkDataType)(group.type, data, opts.strictNumbers));
2436
+ iterateKeywords(it, group);
2437
+ if (types2.length === 1 && types2[0] === group.type && typeErrors) {
2438
+ gen.else();
2439
+ (0, dataType_2.reportTypeError)(it);
2491
2440
  }
2492
- if (!allErrors)
2493
- gen.if((0, codegen_12._)`${names_12.default.errors} === ${errsCount || 0}`);
2441
+ gen.endIf();
2442
+ } else {
2443
+ iterateKeywords(it, group);
2494
2444
  }
2445
+ if (!allErrors)
2446
+ gen.if((0, codegen_1$r._)`${names_1$6.default.errors} === ${errsCount || 0}`);
2495
2447
  }
2496
- function iterateKeywords(it, group) {
2497
- const { gen, schema, opts: { useDefaults } } = it;
2498
- if (useDefaults)
2499
- (0, defaults_1.assignDefaults)(it, group.type);
2500
- gen.block(() => {
2501
- for (const rule of group.rules) {
2502
- if ((0, applicability_12.shouldUseRule)(schema, rule)) {
2503
- keywordCode(it, rule.keyword, rule.definition, group.type);
2504
- }
2448
+ }
2449
+ function iterateKeywords(it, group) {
2450
+ const { gen, schema, opts: { useDefaults } } = it;
2451
+ if (useDefaults)
2452
+ (0, defaults_1.assignDefaults)(it, group.type);
2453
+ gen.block(() => {
2454
+ for (const rule of group.rules) {
2455
+ if ((0, applicability_1.shouldUseRule)(schema, rule)) {
2456
+ keywordCode(it, rule.keyword, rule.definition, group.type);
2505
2457
  }
2506
- });
2507
- }
2508
- function checkStrictTypes(it, types2) {
2509
- if (it.schemaEnv.meta || !it.opts.strictTypes)
2510
- return;
2511
- checkContextTypes(it, types2);
2512
- if (!it.opts.allowUnionTypes)
2513
- checkMultipleTypes(it, types2);
2514
- checkKeywordTypes(it, it.dataTypes);
2515
- }
2516
- function checkContextTypes(it, types2) {
2517
- if (!types2.length)
2518
- return;
2519
- if (!it.dataTypes.length) {
2520
- it.dataTypes = types2;
2521
- return;
2522
2458
  }
2523
- types2.forEach((t) => {
2524
- if (!includesType(it.dataTypes, t)) {
2525
- strictTypesError(it, `type "${t}" not allowed by context "${it.dataTypes.join(",")}"`);
2526
- }
2527
- });
2528
- narrowSchemaTypes(it, types2);
2459
+ });
2460
+ }
2461
+ function checkStrictTypes(it, types2) {
2462
+ if (it.schemaEnv.meta || !it.opts.strictTypes)
2463
+ return;
2464
+ checkContextTypes(it, types2);
2465
+ if (!it.opts.allowUnionTypes)
2466
+ checkMultipleTypes(it, types2);
2467
+ checkKeywordTypes(it, it.dataTypes);
2468
+ }
2469
+ function checkContextTypes(it, types2) {
2470
+ if (!types2.length)
2471
+ return;
2472
+ if (!it.dataTypes.length) {
2473
+ it.dataTypes = types2;
2474
+ return;
2529
2475
  }
2530
- function checkMultipleTypes(it, ts) {
2531
- if (ts.length > 1 && !(ts.length === 2 && ts.includes("null"))) {
2532
- strictTypesError(it, "use allowUnionTypes to allow union type keyword");
2476
+ types2.forEach((t) => {
2477
+ if (!includesType(it.dataTypes, t)) {
2478
+ strictTypesError(it, `type "${t}" not allowed by context "${it.dataTypes.join(",")}"`);
2533
2479
  }
2480
+ });
2481
+ narrowSchemaTypes(it, types2);
2482
+ }
2483
+ function checkMultipleTypes(it, ts) {
2484
+ if (ts.length > 1 && !(ts.length === 2 && ts.includes("null"))) {
2485
+ strictTypesError(it, "use allowUnionTypes to allow union type keyword");
2534
2486
  }
2535
- function checkKeywordTypes(it, ts) {
2536
- const rules2 = it.self.RULES.all;
2537
- for (const keyword2 in rules2) {
2538
- const rule = rules2[keyword2];
2539
- if (typeof rule == "object" && (0, applicability_12.shouldUseRule)(it.schema, rule)) {
2540
- const { type: type2 } = rule.definition;
2541
- if (type2.length && !type2.some((t) => hasApplicableType(ts, t))) {
2542
- strictTypesError(it, `missing type "${type2.join(",")}" for keyword "${keyword2}"`);
2543
- }
2487
+ }
2488
+ function checkKeywordTypes(it, ts) {
2489
+ const rules2 = it.self.RULES.all;
2490
+ for (const keyword2 in rules2) {
2491
+ const rule = rules2[keyword2];
2492
+ if (typeof rule == "object" && (0, applicability_1.shouldUseRule)(it.schema, rule)) {
2493
+ const { type: type2 } = rule.definition;
2494
+ if (type2.length && !type2.some((t) => hasApplicableType(ts, t))) {
2495
+ strictTypesError(it, `missing type "${type2.join(",")}" for keyword "${keyword2}"`);
2544
2496
  }
2545
2497
  }
2546
2498
  }
2547
- function hasApplicableType(schTs, kwdT) {
2548
- return schTs.includes(kwdT) || kwdT === "number" && schTs.includes("integer");
2549
- }
2550
- function includesType(ts, t) {
2551
- return ts.includes(t) || t === "integer" && ts.includes("number");
2552
- }
2553
- function narrowSchemaTypes(it, withTypes) {
2554
- const ts = [];
2555
- for (const t of it.dataTypes) {
2556
- if (includesType(withTypes, t))
2557
- ts.push(t);
2558
- else if (withTypes.includes("integer") && t === "number")
2559
- ts.push("integer");
2560
- }
2561
- it.dataTypes = ts;
2562
- }
2563
- function strictTypesError(it, msg) {
2564
- const schemaPath = it.schemaEnv.baseId + it.errSchemaPath;
2565
- msg += ` at "${schemaPath}" (strictTypes)`;
2566
- (0, util_12.checkStrictMode)(it, msg, it.opts.strictTypes);
2567
- }
2568
- class KeywordCxt {
2569
- constructor(it, def2, keyword2) {
2570
- (0, keyword_1.validateKeywordUsage)(it, def2, keyword2);
2571
- this.gen = it.gen;
2572
- this.allErrors = it.allErrors;
2573
- this.keyword = keyword2;
2574
- this.data = it.data;
2575
- this.schema = it.schema[keyword2];
2576
- this.$data = def2.$data && it.opts.$data && this.schema && this.schema.$data;
2577
- this.schemaValue = (0, util_12.schemaRefOrVal)(it, this.schema, keyword2, this.$data);
2578
- this.schemaType = def2.schemaType;
2579
- this.parentSchema = it.schema;
2580
- this.params = {};
2581
- this.it = it;
2582
- this.def = def2;
2583
- if (this.$data) {
2584
- this.schemaCode = it.gen.const("vSchema", getData(this.$data, it));
2585
- } else {
2586
- this.schemaCode = this.schemaValue;
2587
- if (!(0, keyword_1.validSchemaType)(this.schema, def2.schemaType, def2.allowUndefined)) {
2588
- throw new Error(`${keyword2} value must be ${JSON.stringify(def2.schemaType)}`);
2589
- }
2590
- }
2591
- if ("code" in def2 ? def2.trackErrors : def2.errors !== false) {
2592
- this.errsCount = it.gen.const("_errs", names_12.default.errors);
2593
- }
2594
- }
2595
- result(condition, successAction, failAction) {
2596
- this.failResult((0, codegen_12.not)(condition), successAction, failAction);
2597
- }
2598
- failResult(condition, successAction, failAction) {
2599
- this.gen.if(condition);
2600
- if (failAction)
2601
- failAction();
2602
- else
2603
- this.error();
2604
- if (successAction) {
2605
- this.gen.else();
2606
- successAction();
2607
- if (this.allErrors)
2608
- this.gen.endIf();
2609
- } else {
2610
- if (this.allErrors)
2611
- this.gen.endIf();
2612
- else
2613
- this.gen.else();
2499
+ }
2500
+ function hasApplicableType(schTs, kwdT) {
2501
+ return schTs.includes(kwdT) || kwdT === "number" && schTs.includes("integer");
2502
+ }
2503
+ function includesType(ts, t) {
2504
+ return ts.includes(t) || t === "integer" && ts.includes("number");
2505
+ }
2506
+ function narrowSchemaTypes(it, withTypes) {
2507
+ const ts = [];
2508
+ for (const t of it.dataTypes) {
2509
+ if (includesType(withTypes, t))
2510
+ ts.push(t);
2511
+ else if (withTypes.includes("integer") && t === "number")
2512
+ ts.push("integer");
2513
+ }
2514
+ it.dataTypes = ts;
2515
+ }
2516
+ function strictTypesError(it, msg) {
2517
+ const schemaPath = it.schemaEnv.baseId + it.errSchemaPath;
2518
+ msg += ` at "${schemaPath}" (strictTypes)`;
2519
+ (0, util_1$p.checkStrictMode)(it, msg, it.opts.strictTypes);
2520
+ }
2521
+ class KeywordCxt {
2522
+ constructor(it, def2, keyword2) {
2523
+ (0, keyword_1.validateKeywordUsage)(it, def2, keyword2);
2524
+ this.gen = it.gen;
2525
+ this.allErrors = it.allErrors;
2526
+ this.keyword = keyword2;
2527
+ this.data = it.data;
2528
+ this.schema = it.schema[keyword2];
2529
+ this.$data = def2.$data && it.opts.$data && this.schema && this.schema.$data;
2530
+ this.schemaValue = (0, util_1$p.schemaRefOrVal)(it, this.schema, keyword2, this.$data);
2531
+ this.schemaType = def2.schemaType;
2532
+ this.parentSchema = it.schema;
2533
+ this.params = {};
2534
+ this.it = it;
2535
+ this.def = def2;
2536
+ if (this.$data) {
2537
+ this.schemaCode = it.gen.const("vSchema", getData(this.$data, it));
2538
+ } else {
2539
+ this.schemaCode = this.schemaValue;
2540
+ if (!(0, keyword_1.validSchemaType)(this.schema, def2.schemaType, def2.allowUndefined)) {
2541
+ throw new Error(`${keyword2} value must be ${JSON.stringify(def2.schemaType)}`);
2614
2542
  }
2615
2543
  }
2616
- pass(condition, failAction) {
2617
- this.failResult((0, codegen_12.not)(condition), void 0, failAction);
2544
+ if ("code" in def2 ? def2.trackErrors : def2.errors !== false) {
2545
+ this.errsCount = it.gen.const("_errs", names_1$6.default.errors);
2618
2546
  }
2619
- fail(condition) {
2620
- if (condition === void 0) {
2621
- this.error();
2622
- if (!this.allErrors)
2623
- this.gen.if(false);
2624
- return;
2625
- }
2626
- this.gen.if(condition);
2547
+ }
2548
+ result(condition, successAction, failAction) {
2549
+ this.failResult((0, codegen_1$r.not)(condition), successAction, failAction);
2550
+ }
2551
+ failResult(condition, successAction, failAction) {
2552
+ this.gen.if(condition);
2553
+ if (failAction)
2554
+ failAction();
2555
+ else
2627
2556
  this.error();
2557
+ if (successAction) {
2558
+ this.gen.else();
2559
+ successAction();
2560
+ if (this.allErrors)
2561
+ this.gen.endIf();
2562
+ } else {
2628
2563
  if (this.allErrors)
2629
2564
  this.gen.endIf();
2630
2565
  else
2631
2566
  this.gen.else();
2632
2567
  }
2633
- fail$data(condition) {
2634
- if (!this.$data)
2635
- return this.fail(condition);
2636
- const { schemaCode } = this;
2637
- this.fail((0, codegen_12._)`${schemaCode} !== undefined && (${(0, codegen_12.or)(this.invalid$data(), condition)})`);
2638
- }
2639
- error(append, errorParams, errorPaths) {
2640
- if (errorParams) {
2641
- this.setParams(errorParams);
2642
- this._error(append, errorPaths);
2643
- this.setParams({});
2644
- return;
2645
- }
2646
- this._error(append, errorPaths);
2647
- }
2648
- _error(append, errorPaths) {
2649
- (append ? errors_12.reportExtraError : errors_12.reportError)(this, this.def.error, errorPaths);
2650
- }
2651
- $dataError() {
2652
- (0, errors_12.reportError)(this, this.def.$dataError || errors_12.keyword$DataError);
2653
- }
2654
- reset() {
2655
- if (this.errsCount === void 0)
2656
- throw new Error('add "trackErrors" to keyword definition');
2657
- (0, errors_12.resetErrorsCount)(this.gen, this.errsCount);
2658
- }
2659
- ok(cond) {
2568
+ }
2569
+ pass(condition, failAction) {
2570
+ this.failResult((0, codegen_1$r.not)(condition), void 0, failAction);
2571
+ }
2572
+ fail(condition) {
2573
+ if (condition === void 0) {
2574
+ this.error();
2660
2575
  if (!this.allErrors)
2661
- this.gen.if(cond);
2576
+ this.gen.if(false);
2577
+ return;
2662
2578
  }
2663
- setParams(obj, assign) {
2664
- if (assign)
2665
- Object.assign(this.params, obj);
2666
- else
2667
- this.params = obj;
2579
+ this.gen.if(condition);
2580
+ this.error();
2581
+ if (this.allErrors)
2582
+ this.gen.endIf();
2583
+ else
2584
+ this.gen.else();
2585
+ }
2586
+ fail$data(condition) {
2587
+ if (!this.$data)
2588
+ return this.fail(condition);
2589
+ const { schemaCode } = this;
2590
+ this.fail((0, codegen_1$r._)`${schemaCode} !== undefined && (${(0, codegen_1$r.or)(this.invalid$data(), condition)})`);
2591
+ }
2592
+ error(append, errorParams, errorPaths) {
2593
+ if (errorParams) {
2594
+ this.setParams(errorParams);
2595
+ this._error(append, errorPaths);
2596
+ this.setParams({});
2597
+ return;
2668
2598
  }
2669
- block$data(valid, codeBlock, $dataValid = codegen_12.nil) {
2670
- this.gen.block(() => {
2671
- this.check$data(valid, $dataValid);
2672
- codeBlock();
2673
- });
2599
+ this._error(append, errorPaths);
2600
+ }
2601
+ _error(append, errorPaths) {
2602
+ (append ? errors_1.reportExtraError : errors_1.reportError)(this, this.def.error, errorPaths);
2603
+ }
2604
+ $dataError() {
2605
+ (0, errors_1.reportError)(this, this.def.$dataError || errors_1.keyword$DataError);
2606
+ }
2607
+ reset() {
2608
+ if (this.errsCount === void 0)
2609
+ throw new Error('add "trackErrors" to keyword definition');
2610
+ (0, errors_1.resetErrorsCount)(this.gen, this.errsCount);
2611
+ }
2612
+ ok(cond) {
2613
+ if (!this.allErrors)
2614
+ this.gen.if(cond);
2615
+ }
2616
+ setParams(obj, assign) {
2617
+ if (assign)
2618
+ Object.assign(this.params, obj);
2619
+ else
2620
+ this.params = obj;
2621
+ }
2622
+ block$data(valid, codeBlock, $dataValid = codegen_1$r.nil) {
2623
+ this.gen.block(() => {
2624
+ this.check$data(valid, $dataValid);
2625
+ codeBlock();
2626
+ });
2627
+ }
2628
+ check$data(valid = codegen_1$r.nil, $dataValid = codegen_1$r.nil) {
2629
+ if (!this.$data)
2630
+ return;
2631
+ const { gen, schemaCode, schemaType, def: def2 } = this;
2632
+ gen.if((0, codegen_1$r.or)((0, codegen_1$r._)`${schemaCode} === undefined`, $dataValid));
2633
+ if (valid !== codegen_1$r.nil)
2634
+ gen.assign(valid, true);
2635
+ if (schemaType.length || def2.validateSchema) {
2636
+ gen.elseIf(this.invalid$data());
2637
+ this.$dataError();
2638
+ if (valid !== codegen_1$r.nil)
2639
+ gen.assign(valid, false);
2674
2640
  }
2675
- check$data(valid = codegen_12.nil, $dataValid = codegen_12.nil) {
2676
- if (!this.$data)
2677
- return;
2678
- const { gen, schemaCode, schemaType, def: def2 } = this;
2679
- gen.if((0, codegen_12.or)((0, codegen_12._)`${schemaCode} === undefined`, $dataValid));
2680
- if (valid !== codegen_12.nil)
2681
- gen.assign(valid, true);
2682
- if (schemaType.length || def2.validateSchema) {
2683
- gen.elseIf(this.invalid$data());
2684
- this.$dataError();
2685
- if (valid !== codegen_12.nil)
2686
- gen.assign(valid, false);
2641
+ gen.else();
2642
+ }
2643
+ invalid$data() {
2644
+ const { gen, schemaCode, schemaType, def: def2, it } = this;
2645
+ return (0, codegen_1$r.or)(wrong$DataType(), invalid$DataSchema());
2646
+ function wrong$DataType() {
2647
+ if (schemaType.length) {
2648
+ if (!(schemaCode instanceof codegen_1$r.Name))
2649
+ throw new Error("ajv implementation error");
2650
+ const st = Array.isArray(schemaType) ? schemaType : [schemaType];
2651
+ return (0, codegen_1$r._)`${(0, dataType_2.checkDataTypes)(st, schemaCode, it.opts.strictNumbers, dataType_2.DataType.Wrong)}`;
2687
2652
  }
2688
- gen.else();
2653
+ return codegen_1$r.nil;
2689
2654
  }
2690
- invalid$data() {
2691
- const { gen, schemaCode, schemaType, def: def2, it } = this;
2692
- return (0, codegen_12.or)(wrong$DataType(), invalid$DataSchema());
2693
- function wrong$DataType() {
2694
- if (schemaType.length) {
2695
- if (!(schemaCode instanceof codegen_12.Name))
2696
- throw new Error("ajv implementation error");
2697
- const st = Array.isArray(schemaType) ? schemaType : [schemaType];
2698
- return (0, codegen_12._)`${(0, dataType_2.checkDataTypes)(st, schemaCode, it.opts.strictNumbers, dataType_2.DataType.Wrong)}`;
2699
- }
2700
- return codegen_12.nil;
2701
- }
2702
- function invalid$DataSchema() {
2703
- if (def2.validateSchema) {
2704
- const validateSchemaRef = gen.scopeValue("validate$data", { ref: def2.validateSchema });
2705
- return (0, codegen_12._)`!${validateSchemaRef}(${schemaCode})`;
2706
- }
2707
- return codegen_12.nil;
2655
+ function invalid$DataSchema() {
2656
+ if (def2.validateSchema) {
2657
+ const validateSchemaRef = gen.scopeValue("validate$data", { ref: def2.validateSchema });
2658
+ return (0, codegen_1$r._)`!${validateSchemaRef}(${schemaCode})`;
2708
2659
  }
2660
+ return codegen_1$r.nil;
2709
2661
  }
2710
- subschema(appl, valid) {
2711
- const subschema2 = (0, subschema_1.getSubschema)(this.it, appl);
2712
- (0, subschema_1.extendSubschemaData)(subschema2, this.it, appl);
2713
- (0, subschema_1.extendSubschemaMode)(subschema2, appl);
2714
- const nextContext = { ...this.it, ...subschema2, items: void 0, props: void 0 };
2715
- subschemaCode(nextContext, valid);
2716
- return nextContext;
2717
- }
2718
- mergeEvaluated(schemaCxt, toName) {
2719
- const { it, gen } = this;
2720
- if (!it.opts.unevaluated)
2721
- return;
2722
- if (it.props !== true && schemaCxt.props !== void 0) {
2723
- it.props = util_12.mergeEvaluated.props(gen, schemaCxt.props, it.props, toName);
2724
- }
2725
- if (it.items !== true && schemaCxt.items !== void 0) {
2726
- it.items = util_12.mergeEvaluated.items(gen, schemaCxt.items, it.items, toName);
2727
- }
2662
+ }
2663
+ subschema(appl, valid) {
2664
+ const subschema2 = (0, subschema_1.getSubschema)(this.it, appl);
2665
+ (0, subschema_1.extendSubschemaData)(subschema2, this.it, appl);
2666
+ (0, subschema_1.extendSubschemaMode)(subschema2, appl);
2667
+ const nextContext = { ...this.it, ...subschema2, items: void 0, props: void 0 };
2668
+ subschemaCode(nextContext, valid);
2669
+ return nextContext;
2670
+ }
2671
+ mergeEvaluated(schemaCxt, toName) {
2672
+ const { it, gen } = this;
2673
+ if (!it.opts.unevaluated)
2674
+ return;
2675
+ if (it.props !== true && schemaCxt.props !== void 0) {
2676
+ it.props = util_1$p.mergeEvaluated.props(gen, schemaCxt.props, it.props, toName);
2728
2677
  }
2729
- mergeValidEvaluated(schemaCxt, valid) {
2730
- const { it, gen } = this;
2731
- if (it.opts.unevaluated && (it.props !== true || it.items !== true)) {
2732
- gen.if(valid, () => this.mergeEvaluated(schemaCxt, codegen_12.Name));
2733
- return true;
2734
- }
2678
+ if (it.items !== true && schemaCxt.items !== void 0) {
2679
+ it.items = util_1$p.mergeEvaluated.items(gen, schemaCxt.items, it.items, toName);
2735
2680
  }
2736
2681
  }
2737
- validate.KeywordCxt = KeywordCxt;
2738
- function keywordCode(it, keyword2, def2, ruleType) {
2739
- const cxt = new KeywordCxt(it, def2, keyword2);
2740
- if ("code" in def2) {
2741
- def2.code(cxt, ruleType);
2742
- } else if (cxt.$data && def2.validate) {
2743
- (0, keyword_1.funcKeywordCode)(cxt, def2);
2744
- } else if ("macro" in def2) {
2745
- (0, keyword_1.macroKeywordCode)(cxt, def2);
2746
- } else if (def2.compile || def2.validate) {
2747
- (0, keyword_1.funcKeywordCode)(cxt, def2);
2748
- }
2749
- }
2750
- const JSON_POINTER = /^\/(?:[^~]|~0|~1)*$/;
2751
- const RELATIVE_JSON_POINTER = /^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;
2752
- function getData($data, { dataLevel, dataNames, dataPathArr }) {
2753
- let jsonPointer;
2754
- let data;
2755
- if ($data === "")
2756
- return names_12.default.rootData;
2757
- if ($data[0] === "/") {
2758
- if (!JSON_POINTER.test($data))
2759
- throw new Error(`Invalid JSON-pointer: ${$data}`);
2760
- jsonPointer = $data;
2761
- data = names_12.default.rootData;
2762
- } else {
2763
- const matches = RELATIVE_JSON_POINTER.exec($data);
2764
- if (!matches)
2765
- throw new Error(`Invalid JSON-pointer: ${$data}`);
2766
- const up = +matches[1];
2767
- jsonPointer = matches[2];
2768
- if (jsonPointer === "#") {
2769
- if (up >= dataLevel)
2770
- throw new Error(errorMsg("property/index", up));
2771
- return dataPathArr[dataLevel - up];
2772
- }
2773
- if (up > dataLevel)
2774
- throw new Error(errorMsg("data", up));
2775
- data = dataNames[dataLevel - up];
2776
- if (!jsonPointer)
2777
- return data;
2778
- }
2779
- let expr = data;
2780
- const segments = jsonPointer.split("/");
2781
- for (const segment of segments) {
2782
- if (segment) {
2783
- data = (0, codegen_12._)`${data}${(0, codegen_12.getProperty)((0, util_12.unescapeJsonPointer)(segment))}`;
2784
- expr = (0, codegen_12._)`${expr} && ${data}`;
2785
- }
2786
- }
2787
- return expr;
2788
- function errorMsg(pointerType, up) {
2789
- return `Cannot access ${pointerType} ${up} levels up, current level is ${dataLevel}`;
2682
+ mergeValidEvaluated(schemaCxt, valid) {
2683
+ const { it, gen } = this;
2684
+ if (it.opts.unevaluated && (it.props !== true || it.items !== true)) {
2685
+ gen.if(valid, () => this.mergeEvaluated(schemaCxt, codegen_1$r.Name));
2686
+ return true;
2790
2687
  }
2791
2688
  }
2792
- validate.getData = getData;
2793
- return validate;
2794
2689
  }
2690
+ validate.KeywordCxt = KeywordCxt;
2691
+ function keywordCode(it, keyword2, def2, ruleType) {
2692
+ const cxt = new KeywordCxt(it, def2, keyword2);
2693
+ if ("code" in def2) {
2694
+ def2.code(cxt, ruleType);
2695
+ } else if (cxt.$data && def2.validate) {
2696
+ (0, keyword_1.funcKeywordCode)(cxt, def2);
2697
+ } else if ("macro" in def2) {
2698
+ (0, keyword_1.macroKeywordCode)(cxt, def2);
2699
+ } else if (def2.compile || def2.validate) {
2700
+ (0, keyword_1.funcKeywordCode)(cxt, def2);
2701
+ }
2702
+ }
2703
+ const JSON_POINTER = /^\/(?:[^~]|~0|~1)*$/;
2704
+ const RELATIVE_JSON_POINTER = /^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;
2705
+ function getData($data, { dataLevel, dataNames, dataPathArr }) {
2706
+ let jsonPointer;
2707
+ let data;
2708
+ if ($data === "")
2709
+ return names_1$6.default.rootData;
2710
+ if ($data[0] === "/") {
2711
+ if (!JSON_POINTER.test($data))
2712
+ throw new Error(`Invalid JSON-pointer: ${$data}`);
2713
+ jsonPointer = $data;
2714
+ data = names_1$6.default.rootData;
2715
+ } else {
2716
+ const matches = RELATIVE_JSON_POINTER.exec($data);
2717
+ if (!matches)
2718
+ throw new Error(`Invalid JSON-pointer: ${$data}`);
2719
+ const up = +matches[1];
2720
+ jsonPointer = matches[2];
2721
+ if (jsonPointer === "#") {
2722
+ if (up >= dataLevel)
2723
+ throw new Error(errorMsg("property/index", up));
2724
+ return dataPathArr[dataLevel - up];
2725
+ }
2726
+ if (up > dataLevel)
2727
+ throw new Error(errorMsg("data", up));
2728
+ data = dataNames[dataLevel - up];
2729
+ if (!jsonPointer)
2730
+ return data;
2731
+ }
2732
+ let expr = data;
2733
+ const segments = jsonPointer.split("/");
2734
+ for (const segment of segments) {
2735
+ if (segment) {
2736
+ data = (0, codegen_1$r._)`${data}${(0, codegen_1$r.getProperty)((0, util_1$p.unescapeJsonPointer)(segment))}`;
2737
+ expr = (0, codegen_1$r._)`${expr} && ${data}`;
2738
+ }
2739
+ }
2740
+ return expr;
2741
+ function errorMsg(pointerType, up) {
2742
+ return `Cannot access ${pointerType} ${up} levels up, current level is ${dataLevel}`;
2743
+ }
2744
+ }
2745
+ validate.getData = getData;
2795
2746
  var validation_error = {};
2796
2747
  Object.defineProperty(validation_error, "__esModule", { value: true });
2797
2748
  class ValidationError extends Error {
@@ -2818,10 +2769,10 @@ Object.defineProperty(compile, "__esModule", { value: true });
2818
2769
  compile.resolveSchema = compile.getCompilingSchema = compile.resolveRef = compile.compileSchema = compile.SchemaEnv = void 0;
2819
2770
  const codegen_1$q = codegen;
2820
2771
  const validation_error_1 = validation_error;
2821
- const names_1$5 = requireNames();
2772
+ const names_1$5 = names$1;
2822
2773
  const resolve_1 = resolve$2;
2823
2774
  const util_1$o = util;
2824
- const validate_1$1 = requireValidate();
2775
+ const validate_1$1 = validate;
2825
2776
  class SchemaEnv {
2826
2777
  constructor(env) {
2827
2778
  var _a;
@@ -3772,7 +3723,7 @@ uri$1.default = uri;
3772
3723
  (function(exports) {
3773
3724
  Object.defineProperty(exports, "__esModule", { value: true });
3774
3725
  exports.CodeGen = exports.Name = exports.nil = exports.stringify = exports.str = exports._ = exports.KeywordCxt = void 0;
3775
- var validate_12 = requireValidate();
3726
+ var validate_12 = validate;
3776
3727
  Object.defineProperty(exports, "KeywordCxt", { enumerable: true, get: function() {
3777
3728
  return validate_12.KeywordCxt;
3778
3729
  } });
@@ -4392,7 +4343,7 @@ ref.callRef = ref.getValidate = void 0;
4392
4343
  const ref_error_1$1 = ref_error;
4393
4344
  const code_1$8 = code;
4394
4345
  const codegen_1$p = codegen;
4395
- const names_1$4 = requireNames();
4346
+ const names_1$4 = names$1;
4396
4347
  const compile_1$2 = compile;
4397
4348
  const util_1$n = util;
4398
4349
  const def$A = {
@@ -5276,7 +5227,7 @@ var additionalProperties = {};
5276
5227
  Object.defineProperty(additionalProperties, "__esModule", { value: true });
5277
5228
  const code_1$3 = code;
5278
5229
  const codegen_1$9 = codegen;
5279
- const names_1$3 = requireNames();
5230
+ const names_1$3 = names$1;
5280
5231
  const util_1$c = util;
5281
5232
  const error$6 = {
5282
5233
  message: "must NOT have additional properties",
@@ -5374,7 +5325,7 @@ const def$j = {
5374
5325
  additionalProperties.default = def$j;
5375
5326
  var properties$8 = {};
5376
5327
  Object.defineProperty(properties$8, "__esModule", { value: true });
5377
- const validate_1 = requireValidate();
5328
+ const validate_1 = validate;
5378
5329
  const code_1$2 = code;
5379
5330
  const util_1$b = util;
5380
5331
  const additionalProperties_1$1 = additionalProperties;
@@ -5722,7 +5673,7 @@ var dynamicAnchor$1 = {};
5722
5673
  Object.defineProperty(dynamicAnchor$1, "__esModule", { value: true });
5723
5674
  dynamicAnchor$1.dynamicAnchor = void 0;
5724
5675
  const codegen_1$5 = codegen;
5725
- const names_1$2 = requireNames();
5676
+ const names_1$2 = names$1;
5726
5677
  const compile_1$1 = compile;
5727
5678
  const ref_1$1 = ref;
5728
5679
  const def$a = {
@@ -5751,7 +5702,7 @@ var dynamicRef$1 = {};
5751
5702
  Object.defineProperty(dynamicRef$1, "__esModule", { value: true });
5752
5703
  dynamicRef$1.dynamicRef = void 0;
5753
5704
  const codegen_1$4 = codegen;
5754
- const names_1$1 = requireNames();
5705
+ const names_1$1 = names$1;
5755
5706
  const ref_1 = ref;
5756
5707
  const def$9 = {
5757
5708
  keyword: "$dynamicRef",
@@ -5865,7 +5816,7 @@ var unevaluatedProperties = {};
5865
5816
  Object.defineProperty(unevaluatedProperties, "__esModule", { value: true });
5866
5817
  const codegen_1$3 = codegen;
5867
5818
  const util_1$2 = util;
5868
- const names_1 = requireNames();
5819
+ const names_1 = names$1;
5869
5820
  const error$3 = {
5870
5821
  message: "must NOT have unevaluated properties",
5871
5822
  params: ({ params }) => (0, codegen_1$3._)`{unevaluatedProperty: ${params.unevaluatedProperty}}`
@@ -6781,7 +6732,7 @@ jsonSchema202012.default = addMetaSchema2020;
6781
6732
  module.exports.Ajv2020 = Ajv20202;
6782
6733
  Object.defineProperty(exports, "__esModule", { value: true });
6783
6734
  exports.default = Ajv20202;
6784
- var validate_12 = requireValidate();
6735
+ var validate_12 = validate;
6785
6736
  Object.defineProperty(exports, "KeywordCxt", { enumerable: true, get: function() {
6786
6737
  return validate_12.KeywordCxt;
6787
6738
  } });
@@ -7159,12 +7110,12 @@ const create = async function() {
7159
7110
  const appPackageJSON = await readJSON(appPackageJSONPath);
7160
7111
  if (appPackageJSON.dependencies) {
7161
7112
  const packageJSON = getPackageJSON();
7162
- if (packageJSON.dependencies) {
7163
- const ONES_OPEN_NODE_SDK_VERSION = packageJSON.dependencies[ONES_OPEN_NODE_SDK];
7113
+ if (packageJSON.devDependencies) {
7114
+ const ONES_OPEN_NODE_SDK_VERSION = packageJSON.devDependencies[ONES_OPEN_NODE_SDK];
7164
7115
  if (ONES_OPEN_NODE_SDK_VERSION) {
7165
7116
  appPackageJSON.dependencies[ONES_OPEN_NODE_SDK] = ONES_OPEN_NODE_SDK_VERSION;
7166
7117
  }
7167
- const ONES_OPEN_WEB_SDK_VERSION = packageJSON.dependencies[ONES_OPEN_WEB_SDK];
7118
+ const ONES_OPEN_WEB_SDK_VERSION = packageJSON.devDependencies[ONES_OPEN_WEB_SDK];
7168
7119
  if (ONES_OPEN_WEB_SDK_VERSION) {
7169
7120
  appPackageJSON.dependencies[ONES_OPEN_WEB_SDK] = ONES_OPEN_WEB_SDK_VERSION;
7170
7121
  }