@oomol-lab/open-flow 0.1.0-beta.90 → 0.1.0-beta.91
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/browser/{FlowCanvas-C4iuvVKB.js → FlowCanvas-CZEphIhX.js} +169 -2324
- package/dist/browser/{createResourceDialog-BstGO0m4.js → createResourceDialog-CJbZa2gA.js} +2 -2
- package/dist/browser/{dialog-Bi-MVTGj.js → dialog-E1WkapJU.js} +10 -2
- package/dist/browser/{exportPng-DMsB9ku_.js → exportPng-c4or5th8.js} +2 -2
- package/dist/browser/{flowChanges-SKYJBr6X.js → flowChanges-DsLZdENA.js} +20 -37
- package/dist/browser/{flowWorkspace-4UHRaHcz.js → flowWorkspace-CxLQWUdj.js} +54 -19
- package/dist/browser/{markdownContent-B75ojl0E.js → markdownContent-BsdTdwBU.js} +1 -1
- package/dist/browser/preview.js +231 -68
- package/dist/browser/workbench.js +6 -6
- package/dist/browser/{workbenchSelect-CHOeceKA.js → workbenchSelect-BfQfMWuY.js} +1 -1
- package/dist/browser/{wrapLayout-DU5HG1qH.js → wrapLayout-ZOG4AikN.js} +2493 -200
- package/dist/command/index.js +58 -55
- package/dist/common/control-api-conformance.js +896 -8
- package/dist/common/control-api.js +896 -8
- package/dist/common/control-requests.js +17 -6
- package/dist/common/decision.js +10 -2
- package/dist/common/flow-authoring.js +896 -8
- package/dist/common/flow-change.js +896 -8
- package/dist/common/flow-encoding.js +896 -8
- package/dist/common/flow-semantics.js +10 -2
- package/dist/common/integration-trigger.js +10 -2
- package/dist/common/licenses.md +2 -0
- package/dist/common/mcp.js +896 -8
- package/dist/common/openapi.js +10 -2
- package/dist/common/poll-trigger.js +10 -2
- package/dist/common/provider-triggers.js +1 -1
- package/dist/common/scheduler.js +10 -2
- package/dist/common/webhook-trigger.js +890 -2
- package/dist/common/workflow.js +14 -3
- package/dist/render/browser/runtime.js +966 -59
- package/dist/render/node/index.js +792 -4
- package/package.json +1 -1
- package/src/control/common/authoringTools.ts +4 -2
- package/src/flow/common/schemaComparer.ts +12 -2
- package/src/json-schema-subset/checker/equals.ts +3 -0
- package/src/trigger/providers/catalog.generated.json +9 -1
- package/src/workflow/common/workflow.ts +4 -3
|
@@ -914,7 +914,7 @@ var _safeParseAsync = (_Err) => async (schema, value, _ctx) => {
|
|
|
914
914
|
};
|
|
915
915
|
var COMPILE_INVALID = /* @__PURE__ */ Symbol.for("zod.compile.invalid");
|
|
916
916
|
var COMPILE_FALLBACK = /* @__PURE__ */ Symbol.for("zod.compile.fallback");
|
|
917
|
-
var validate = ((schema, value, _ctx) => {
|
|
917
|
+
var validate$1 = ((schema, value, _ctx) => {
|
|
918
918
|
const validator = schema._zod.bag.validator;
|
|
919
919
|
if (validator !== void 0) {
|
|
920
920
|
if (validator(value) !== COMPILE_INVALID) return true;
|
|
@@ -1066,12 +1066,12 @@ var dateSource = `(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][
|
|
|
1066
1066
|
function anchor(source) {
|
|
1067
1067
|
return new RegExp(`^${source}$`);
|
|
1068
1068
|
}
|
|
1069
|
-
var date = /*@__PURE__*/ anchor(dateSource);
|
|
1069
|
+
var date$1 = /*@__PURE__*/ anchor(dateSource);
|
|
1070
1070
|
function timeSource(args) {
|
|
1071
1071
|
const hhmm = `(?:[01]\\d|2[0-3]):[0-5]\\d`;
|
|
1072
1072
|
return typeof args.precision === "number" ? args.precision === -1 ? `${hhmm}` : args.precision === 0 ? `${hhmm}:[0-5]\\d` : `${hhmm}:[0-5]\\d\\.\\d{${args.precision}}` : args.seconds ? `${hhmm}:[0-5]\\d(?:\\.\\d+)?` : `${hhmm}(?::[0-5]\\d(?:\\.\\d+)?)?`;
|
|
1073
1073
|
}
|
|
1074
|
-
function time(args) {
|
|
1074
|
+
function time$1(args) {
|
|
1075
1075
|
return new RegExp(`^${timeSource(args)}$`);
|
|
1076
1076
|
}
|
|
1077
1077
|
function datetime$1(args) {
|
|
@@ -1729,11 +1729,11 @@ var $ZodISODateTime = /*@__PURE__*/ $constructor("$ZodISODateTime", (inst, def)
|
|
|
1729
1729
|
$ZodStringFormat.init(inst, def);
|
|
1730
1730
|
});
|
|
1731
1731
|
var $ZodISODate = /*@__PURE__*/ $constructor("$ZodISODate", (inst, def) => {
|
|
1732
|
-
def.pattern ?? (def.pattern = date);
|
|
1732
|
+
def.pattern ?? (def.pattern = date$1);
|
|
1733
1733
|
$ZodStringFormat.init(inst, def);
|
|
1734
1734
|
});
|
|
1735
1735
|
var $ZodISOTime = /*@__PURE__*/ $constructor("$ZodISOTime", (inst, def) => {
|
|
1736
|
-
def.pattern ?? (def.pattern = time(def));
|
|
1736
|
+
def.pattern ?? (def.pattern = time$1(def));
|
|
1737
1737
|
$ZodStringFormat.init(inst, def);
|
|
1738
1738
|
});
|
|
1739
1739
|
var $ZodISODuration = /*@__PURE__*/ $constructor("$ZodISODuration", (inst, def) => {
|
|
@@ -5134,7 +5134,7 @@ var ZodType = /*@__PURE__*/ $constructor("ZodType", (inst, def) => {
|
|
|
5134
5134
|
own(this, "spa", value);
|
|
5135
5135
|
},
|
|
5136
5136
|
validate(data, params) {
|
|
5137
|
-
return validate(this, data, params);
|
|
5137
|
+
return validate$1(this, data, params);
|
|
5138
5138
|
},
|
|
5139
5139
|
validateAsync(data, params) {
|
|
5140
5140
|
return validateAsync$1(this, data, params);
|
|
@@ -5960,6 +5960,886 @@ var connectorProxyExecutorSchema = strictObject({
|
|
|
5960
5960
|
bodyFormat: _enum(["none", "json"]).default("none")
|
|
5961
5961
|
}).extend({ kind: literal("connector-proxy") });
|
|
5962
5962
|
//#endregion
|
|
5963
|
+
//#region ../../node_modules/.bun/@cfworker+json-schema@4.1.1/node_modules/@cfworker/json-schema/dist/esm/deep-compare-strict.js
|
|
5964
|
+
function deepCompareStrict(a, b) {
|
|
5965
|
+
const typeofa = typeof a;
|
|
5966
|
+
if (typeofa !== typeof b) return false;
|
|
5967
|
+
if (Array.isArray(a)) {
|
|
5968
|
+
if (!Array.isArray(b)) return false;
|
|
5969
|
+
const length = a.length;
|
|
5970
|
+
if (length !== b.length) return false;
|
|
5971
|
+
for (let i = 0; i < length; i++) if (!deepCompareStrict(a[i], b[i])) return false;
|
|
5972
|
+
return true;
|
|
5973
|
+
}
|
|
5974
|
+
if (typeofa === "object") {
|
|
5975
|
+
if (!a || !b) return a === b;
|
|
5976
|
+
const aKeys = Object.keys(a);
|
|
5977
|
+
const bKeys = Object.keys(b);
|
|
5978
|
+
if (aKeys.length !== bKeys.length) return false;
|
|
5979
|
+
for (const k of aKeys) if (!deepCompareStrict(a[k], b[k])) return false;
|
|
5980
|
+
return true;
|
|
5981
|
+
}
|
|
5982
|
+
return a === b;
|
|
5983
|
+
}
|
|
5984
|
+
//#endregion
|
|
5985
|
+
//#region ../../node_modules/.bun/@cfworker+json-schema@4.1.1/node_modules/@cfworker/json-schema/dist/esm/pointer.js
|
|
5986
|
+
function encodePointer(p) {
|
|
5987
|
+
return encodeURI(escapePointer(p));
|
|
5988
|
+
}
|
|
5989
|
+
function escapePointer(p) {
|
|
5990
|
+
return p.replace(/~/g, "~0").replace(/\//g, "~1");
|
|
5991
|
+
}
|
|
5992
|
+
//#endregion
|
|
5993
|
+
//#region ../../node_modules/.bun/@cfworker+json-schema@4.1.1/node_modules/@cfworker/json-schema/dist/esm/dereference.js
|
|
5994
|
+
var schemaArrayKeyword = {
|
|
5995
|
+
prefixItems: true,
|
|
5996
|
+
items: true,
|
|
5997
|
+
allOf: true,
|
|
5998
|
+
anyOf: true,
|
|
5999
|
+
oneOf: true
|
|
6000
|
+
};
|
|
6001
|
+
var schemaMapKeyword = {
|
|
6002
|
+
$defs: true,
|
|
6003
|
+
definitions: true,
|
|
6004
|
+
properties: true,
|
|
6005
|
+
patternProperties: true,
|
|
6006
|
+
dependentSchemas: true
|
|
6007
|
+
};
|
|
6008
|
+
var ignoredKeyword = {
|
|
6009
|
+
id: true,
|
|
6010
|
+
$id: true,
|
|
6011
|
+
$ref: true,
|
|
6012
|
+
$schema: true,
|
|
6013
|
+
$anchor: true,
|
|
6014
|
+
$vocabulary: true,
|
|
6015
|
+
$comment: true,
|
|
6016
|
+
default: true,
|
|
6017
|
+
enum: true,
|
|
6018
|
+
const: true,
|
|
6019
|
+
required: true,
|
|
6020
|
+
type: true,
|
|
6021
|
+
maximum: true,
|
|
6022
|
+
minimum: true,
|
|
6023
|
+
exclusiveMaximum: true,
|
|
6024
|
+
exclusiveMinimum: true,
|
|
6025
|
+
multipleOf: true,
|
|
6026
|
+
maxLength: true,
|
|
6027
|
+
minLength: true,
|
|
6028
|
+
pattern: true,
|
|
6029
|
+
format: true,
|
|
6030
|
+
maxItems: true,
|
|
6031
|
+
minItems: true,
|
|
6032
|
+
uniqueItems: true,
|
|
6033
|
+
maxProperties: true,
|
|
6034
|
+
minProperties: true
|
|
6035
|
+
};
|
|
6036
|
+
var initialBaseURI = typeof self !== "undefined" && self.location && self.location.origin !== "null" ? new URL(self.location.origin + self.location.pathname + location.search) : new URL("https://github.com/cfworker");
|
|
6037
|
+
function dereference(schema, lookup = Object.create(null), baseURI = initialBaseURI, basePointer = "") {
|
|
6038
|
+
if (schema && typeof schema === "object" && !Array.isArray(schema)) {
|
|
6039
|
+
const id = schema.$id || schema.id;
|
|
6040
|
+
if (id) {
|
|
6041
|
+
const url = new URL(id, baseURI.href);
|
|
6042
|
+
if (url.hash.length > 1) lookup[url.href] = schema;
|
|
6043
|
+
else {
|
|
6044
|
+
url.hash = "";
|
|
6045
|
+
if (basePointer === "") baseURI = url;
|
|
6046
|
+
else dereference(schema, lookup, baseURI);
|
|
6047
|
+
}
|
|
6048
|
+
}
|
|
6049
|
+
} else if (schema !== true && schema !== false) return lookup;
|
|
6050
|
+
const schemaURI = baseURI.href + (basePointer ? "#" + basePointer : "");
|
|
6051
|
+
if (lookup[schemaURI] !== void 0) throw new Error(`Duplicate schema URI "${schemaURI}".`);
|
|
6052
|
+
lookup[schemaURI] = schema;
|
|
6053
|
+
if (schema === true || schema === false) return lookup;
|
|
6054
|
+
if (schema.__absolute_uri__ === void 0) Object.defineProperty(schema, "__absolute_uri__", {
|
|
6055
|
+
enumerable: false,
|
|
6056
|
+
value: schemaURI
|
|
6057
|
+
});
|
|
6058
|
+
if (schema.$ref && schema.__absolute_ref__ === void 0) {
|
|
6059
|
+
const url = new URL(schema.$ref, baseURI.href);
|
|
6060
|
+
url.hash = url.hash;
|
|
6061
|
+
Object.defineProperty(schema, "__absolute_ref__", {
|
|
6062
|
+
enumerable: false,
|
|
6063
|
+
value: url.href
|
|
6064
|
+
});
|
|
6065
|
+
}
|
|
6066
|
+
if (schema.$recursiveRef && schema.__absolute_recursive_ref__ === void 0) {
|
|
6067
|
+
const url = new URL(schema.$recursiveRef, baseURI.href);
|
|
6068
|
+
url.hash = url.hash;
|
|
6069
|
+
Object.defineProperty(schema, "__absolute_recursive_ref__", {
|
|
6070
|
+
enumerable: false,
|
|
6071
|
+
value: url.href
|
|
6072
|
+
});
|
|
6073
|
+
}
|
|
6074
|
+
if (schema.$anchor) {
|
|
6075
|
+
const url = new URL("#" + schema.$anchor, baseURI.href);
|
|
6076
|
+
lookup[url.href] = schema;
|
|
6077
|
+
}
|
|
6078
|
+
for (let key in schema) {
|
|
6079
|
+
if (ignoredKeyword[key]) continue;
|
|
6080
|
+
const keyBase = `${basePointer}/${encodePointer(key)}`;
|
|
6081
|
+
const subSchema = schema[key];
|
|
6082
|
+
if (Array.isArray(subSchema)) {
|
|
6083
|
+
if (schemaArrayKeyword[key]) {
|
|
6084
|
+
const length = subSchema.length;
|
|
6085
|
+
for (let i = 0; i < length; i++) dereference(subSchema[i], lookup, baseURI, `${keyBase}/${i}`);
|
|
6086
|
+
}
|
|
6087
|
+
} else if (schemaMapKeyword[key]) for (let subKey in subSchema) dereference(subSchema[subKey], lookup, baseURI, `${keyBase}/${encodePointer(subKey)}`);
|
|
6088
|
+
else dereference(subSchema, lookup, baseURI, keyBase);
|
|
6089
|
+
}
|
|
6090
|
+
return lookup;
|
|
6091
|
+
}
|
|
6092
|
+
//#endregion
|
|
6093
|
+
//#region ../../node_modules/.bun/@cfworker+json-schema@4.1.1/node_modules/@cfworker/json-schema/dist/esm/format.js
|
|
6094
|
+
var DATE = /^(\d\d\d\d)-(\d\d)-(\d\d)$/;
|
|
6095
|
+
var DAYS = [
|
|
6096
|
+
0,
|
|
6097
|
+
31,
|
|
6098
|
+
28,
|
|
6099
|
+
31,
|
|
6100
|
+
30,
|
|
6101
|
+
31,
|
|
6102
|
+
30,
|
|
6103
|
+
31,
|
|
6104
|
+
31,
|
|
6105
|
+
30,
|
|
6106
|
+
31,
|
|
6107
|
+
30,
|
|
6108
|
+
31
|
|
6109
|
+
];
|
|
6110
|
+
var TIME = /^(\d\d):(\d\d):(\d\d)(\.\d+)?(z|[+-]\d\d(?::?\d\d)?)?$/i;
|
|
6111
|
+
var HOSTNAME = /^(?=.{1,253}\.?$)[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[-0-9a-z]{0,61}[0-9a-z])?)*\.?$/i;
|
|
6112
|
+
var URIREF = /^(?:[a-z][a-z0-9+\-.]*:)?(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'"()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?(?:\?(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i;
|
|
6113
|
+
var URITEMPLATE = /^(?:(?:[^\x00-\x20"'<>%\\^`{|}]|%[0-9a-f]{2})|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?)*\})*$/i;
|
|
6114
|
+
var URL_ = /^(?:(?:https?|ftp):\/\/)(?:\S+(?::\S*)?@)?(?:(?!10(?:\.\d{1,3}){3})(?!127(?:\.\d{1,3}){3})(?!169\.254(?:\.\d{1,3}){2})(?!192\.168(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z\u{00a1}-\u{ffff}0-9]+-?)*[a-z\u{00a1}-\u{ffff}0-9]+)(?:\.(?:[a-z\u{00a1}-\u{ffff}0-9]+-?)*[a-z\u{00a1}-\u{ffff}0-9]+)*(?:\.(?:[a-z\u{00a1}-\u{ffff}]{2,})))(?::\d{2,5})?(?:\/[^\s]*)?$/iu;
|
|
6115
|
+
var UUID = /^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i;
|
|
6116
|
+
var JSON_POINTER = /^(?:\/(?:[^~/]|~0|~1)*)*$/;
|
|
6117
|
+
var JSON_POINTER_URI_FRAGMENT = /^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i;
|
|
6118
|
+
var RELATIVE_JSON_POINTER = /^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/;
|
|
6119
|
+
var EMAIL = (input) => {
|
|
6120
|
+
if (input[0] === "\"") return false;
|
|
6121
|
+
const [name, host, ...rest] = input.split("@");
|
|
6122
|
+
if (!name || !host || rest.length !== 0 || name.length > 64 || host.length > 253) return false;
|
|
6123
|
+
if (name[0] === "." || name.endsWith(".") || name.includes("..")) return false;
|
|
6124
|
+
if (!/^[a-z0-9.-]+$/i.test(host) || !/^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+$/i.test(name)) return false;
|
|
6125
|
+
return host.split(".").every((part) => /^[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?$/i.test(part));
|
|
6126
|
+
};
|
|
6127
|
+
var IPV4 = /^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/;
|
|
6128
|
+
var IPV6 = /^((([0-9a-f]{1,4}:){7}([0-9a-f]{1,4}|:))|(([0-9a-f]{1,4}:){6}(:[0-9a-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){5}(((:[0-9a-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){4}(((:[0-9a-f]{1,4}){1,3})|((:[0-9a-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){3}(((:[0-9a-f]{1,4}){1,4})|((:[0-9a-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){2}(((:[0-9a-f]{1,4}){1,5})|((:[0-9a-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){1}(((:[0-9a-f]{1,4}){1,6})|((:[0-9a-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9a-f]{1,4}){1,7})|((:[0-9a-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))$/i;
|
|
6129
|
+
var DURATION = (input) => input.length > 1 && input.length < 80 && (/^P\d+([.,]\d+)?W$/.test(input) || /^P[\dYMDTHS]*(\d[.,]\d+)?[YMDHS]$/.test(input) && /^P([.,\d]+Y)?([.,\d]+M)?([.,\d]+D)?(T([.,\d]+H)?([.,\d]+M)?([.,\d]+S)?)?$/.test(input));
|
|
6130
|
+
function bind(r) {
|
|
6131
|
+
return r.test.bind(r);
|
|
6132
|
+
}
|
|
6133
|
+
var format = {
|
|
6134
|
+
date,
|
|
6135
|
+
time: time.bind(void 0, false),
|
|
6136
|
+
"date-time": date_time,
|
|
6137
|
+
duration: DURATION,
|
|
6138
|
+
uri,
|
|
6139
|
+
"uri-reference": bind(URIREF),
|
|
6140
|
+
"uri-template": bind(URITEMPLATE),
|
|
6141
|
+
url: bind(URL_),
|
|
6142
|
+
email: EMAIL,
|
|
6143
|
+
hostname: bind(HOSTNAME),
|
|
6144
|
+
ipv4: bind(IPV4),
|
|
6145
|
+
ipv6: bind(IPV6),
|
|
6146
|
+
regex,
|
|
6147
|
+
uuid: bind(UUID),
|
|
6148
|
+
"json-pointer": bind(JSON_POINTER),
|
|
6149
|
+
"json-pointer-uri-fragment": bind(JSON_POINTER_URI_FRAGMENT),
|
|
6150
|
+
"relative-json-pointer": bind(RELATIVE_JSON_POINTER)
|
|
6151
|
+
};
|
|
6152
|
+
function isLeapYear(year) {
|
|
6153
|
+
return year % 4 === 0 && (year % 100 !== 0 || year % 400 === 0);
|
|
6154
|
+
}
|
|
6155
|
+
function date(str) {
|
|
6156
|
+
const matches = str.match(DATE);
|
|
6157
|
+
if (!matches) return false;
|
|
6158
|
+
const year = +matches[1];
|
|
6159
|
+
const month = +matches[2];
|
|
6160
|
+
const day = +matches[3];
|
|
6161
|
+
return month >= 1 && month <= 12 && day >= 1 && day <= (month == 2 && isLeapYear(year) ? 29 : DAYS[month]);
|
|
6162
|
+
}
|
|
6163
|
+
function time(full, str) {
|
|
6164
|
+
const matches = str.match(TIME);
|
|
6165
|
+
if (!matches) return false;
|
|
6166
|
+
const hour = +matches[1];
|
|
6167
|
+
const minute = +matches[2];
|
|
6168
|
+
const second = +matches[3];
|
|
6169
|
+
const timeZone = !!matches[5];
|
|
6170
|
+
return (hour <= 23 && minute <= 59 && second <= 59 || hour == 23 && minute == 59 && second == 60) && (!full || timeZone);
|
|
6171
|
+
}
|
|
6172
|
+
var DATE_TIME_SEPARATOR = /t|\s/i;
|
|
6173
|
+
function date_time(str) {
|
|
6174
|
+
const dateTime = str.split(DATE_TIME_SEPARATOR);
|
|
6175
|
+
return dateTime.length == 2 && date(dateTime[0]) && time(true, dateTime[1]);
|
|
6176
|
+
}
|
|
6177
|
+
var NOT_URI_FRAGMENT = /\/|:/;
|
|
6178
|
+
var URI_PATTERN = /^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)(?:\?(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i;
|
|
6179
|
+
function uri(str) {
|
|
6180
|
+
return NOT_URI_FRAGMENT.test(str) && URI_PATTERN.test(str);
|
|
6181
|
+
}
|
|
6182
|
+
var Z_ANCHOR = /[^\\]\\Z/;
|
|
6183
|
+
function regex(str) {
|
|
6184
|
+
if (Z_ANCHOR.test(str)) return false;
|
|
6185
|
+
try {
|
|
6186
|
+
new RegExp(str, "u");
|
|
6187
|
+
return true;
|
|
6188
|
+
} catch (e) {
|
|
6189
|
+
return false;
|
|
6190
|
+
}
|
|
6191
|
+
}
|
|
6192
|
+
//#endregion
|
|
6193
|
+
//#region ../../node_modules/.bun/@cfworker+json-schema@4.1.1/node_modules/@cfworker/json-schema/dist/esm/ucs2-length.js
|
|
6194
|
+
function ucs2length(s) {
|
|
6195
|
+
let result = 0;
|
|
6196
|
+
let length = s.length;
|
|
6197
|
+
let index = 0;
|
|
6198
|
+
let charCode;
|
|
6199
|
+
while (index < length) {
|
|
6200
|
+
result++;
|
|
6201
|
+
charCode = s.charCodeAt(index++);
|
|
6202
|
+
if (charCode >= 55296 && charCode <= 56319 && index < length) {
|
|
6203
|
+
charCode = s.charCodeAt(index);
|
|
6204
|
+
if ((charCode & 64512) == 56320) index++;
|
|
6205
|
+
}
|
|
6206
|
+
}
|
|
6207
|
+
return result;
|
|
6208
|
+
}
|
|
6209
|
+
//#endregion
|
|
6210
|
+
//#region ../../node_modules/.bun/@cfworker+json-schema@4.1.1/node_modules/@cfworker/json-schema/dist/esm/validate.js
|
|
6211
|
+
function validate(instance, schema, draft = "2019-09", lookup = dereference(schema), shortCircuit = true, recursiveAnchor = null, instanceLocation = "#", schemaLocation = "#", evaluated = Object.create(null)) {
|
|
6212
|
+
if (schema === true) return {
|
|
6213
|
+
valid: true,
|
|
6214
|
+
errors: []
|
|
6215
|
+
};
|
|
6216
|
+
if (schema === false) return {
|
|
6217
|
+
valid: false,
|
|
6218
|
+
errors: [{
|
|
6219
|
+
instanceLocation,
|
|
6220
|
+
keyword: "false",
|
|
6221
|
+
keywordLocation: instanceLocation,
|
|
6222
|
+
error: "False boolean schema."
|
|
6223
|
+
}]
|
|
6224
|
+
};
|
|
6225
|
+
const rawInstanceType = typeof instance;
|
|
6226
|
+
let instanceType;
|
|
6227
|
+
switch (rawInstanceType) {
|
|
6228
|
+
case "boolean":
|
|
6229
|
+
case "number":
|
|
6230
|
+
case "string":
|
|
6231
|
+
instanceType = rawInstanceType;
|
|
6232
|
+
break;
|
|
6233
|
+
case "object":
|
|
6234
|
+
if (instance === null) instanceType = "null";
|
|
6235
|
+
else if (Array.isArray(instance)) instanceType = "array";
|
|
6236
|
+
else instanceType = "object";
|
|
6237
|
+
break;
|
|
6238
|
+
default: throw new Error(`Instances of "${rawInstanceType}" type are not supported.`);
|
|
6239
|
+
}
|
|
6240
|
+
const { $ref, $recursiveRef, $recursiveAnchor, type: $type, const: $const, enum: $enum, required: $required, not: $not, anyOf: $anyOf, allOf: $allOf, oneOf: $oneOf, if: $if, then: $then, else: $else, format: $format, properties: $properties, patternProperties: $patternProperties, additionalProperties: $additionalProperties, unevaluatedProperties: $unevaluatedProperties, minProperties: $minProperties, maxProperties: $maxProperties, propertyNames: $propertyNames, dependentRequired: $dependentRequired, dependentSchemas: $dependentSchemas, dependencies: $dependencies, prefixItems: $prefixItems, items: $items, additionalItems: $additionalItems, unevaluatedItems: $unevaluatedItems, contains: $contains, minContains: $minContains, maxContains: $maxContains, minItems: $minItems, maxItems: $maxItems, uniqueItems: $uniqueItems, minimum: $minimum, maximum: $maximum, exclusiveMinimum: $exclusiveMinimum, exclusiveMaximum: $exclusiveMaximum, multipleOf: $multipleOf, minLength: $minLength, maxLength: $maxLength, pattern: $pattern, __absolute_ref__, __absolute_recursive_ref__ } = schema;
|
|
6241
|
+
const errors = [];
|
|
6242
|
+
if ($recursiveAnchor === true && recursiveAnchor === null) recursiveAnchor = schema;
|
|
6243
|
+
if ($recursiveRef === "#") {
|
|
6244
|
+
const refSchema = recursiveAnchor === null ? lookup[__absolute_recursive_ref__] : recursiveAnchor;
|
|
6245
|
+
const keywordLocation = `${schemaLocation}/$recursiveRef`;
|
|
6246
|
+
const result = validate(instance, recursiveAnchor === null ? schema : recursiveAnchor, draft, lookup, shortCircuit, refSchema, instanceLocation, keywordLocation, evaluated);
|
|
6247
|
+
if (!result.valid) errors.push({
|
|
6248
|
+
instanceLocation,
|
|
6249
|
+
keyword: "$recursiveRef",
|
|
6250
|
+
keywordLocation,
|
|
6251
|
+
error: "A subschema had errors."
|
|
6252
|
+
}, ...result.errors);
|
|
6253
|
+
}
|
|
6254
|
+
if ($ref !== void 0) {
|
|
6255
|
+
const refSchema = lookup[__absolute_ref__ || $ref];
|
|
6256
|
+
if (refSchema === void 0) {
|
|
6257
|
+
let message = `Unresolved $ref "${$ref}".`;
|
|
6258
|
+
if (__absolute_ref__ && __absolute_ref__ !== $ref) message += ` Absolute URI "${__absolute_ref__}".`;
|
|
6259
|
+
message += `\nKnown schemas:\n- ${Object.keys(lookup).join("\n- ")}`;
|
|
6260
|
+
throw new Error(message);
|
|
6261
|
+
}
|
|
6262
|
+
const keywordLocation = `${schemaLocation}/$ref`;
|
|
6263
|
+
const result = validate(instance, refSchema, draft, lookup, shortCircuit, recursiveAnchor, instanceLocation, keywordLocation, evaluated);
|
|
6264
|
+
if (!result.valid) errors.push({
|
|
6265
|
+
instanceLocation,
|
|
6266
|
+
keyword: "$ref",
|
|
6267
|
+
keywordLocation,
|
|
6268
|
+
error: "A subschema had errors."
|
|
6269
|
+
}, ...result.errors);
|
|
6270
|
+
if (draft === "4" || draft === "7") return {
|
|
6271
|
+
valid: errors.length === 0,
|
|
6272
|
+
errors
|
|
6273
|
+
};
|
|
6274
|
+
}
|
|
6275
|
+
if (Array.isArray($type)) {
|
|
6276
|
+
let length = $type.length;
|
|
6277
|
+
let valid = false;
|
|
6278
|
+
for (let i = 0; i < length; i++) if (instanceType === $type[i] || $type[i] === "integer" && instanceType === "number" && instance % 1 === 0 && instance === instance) {
|
|
6279
|
+
valid = true;
|
|
6280
|
+
break;
|
|
6281
|
+
}
|
|
6282
|
+
if (!valid) errors.push({
|
|
6283
|
+
instanceLocation,
|
|
6284
|
+
keyword: "type",
|
|
6285
|
+
keywordLocation: `${schemaLocation}/type`,
|
|
6286
|
+
error: `Instance type "${instanceType}" is invalid. Expected "${$type.join("\", \"")}".`
|
|
6287
|
+
});
|
|
6288
|
+
} else if ($type === "integer") {
|
|
6289
|
+
if (instanceType !== "number" || instance % 1 || instance !== instance) errors.push({
|
|
6290
|
+
instanceLocation,
|
|
6291
|
+
keyword: "type",
|
|
6292
|
+
keywordLocation: `${schemaLocation}/type`,
|
|
6293
|
+
error: `Instance type "${instanceType}" is invalid. Expected "${$type}".`
|
|
6294
|
+
});
|
|
6295
|
+
} else if ($type !== void 0 && instanceType !== $type) errors.push({
|
|
6296
|
+
instanceLocation,
|
|
6297
|
+
keyword: "type",
|
|
6298
|
+
keywordLocation: `${schemaLocation}/type`,
|
|
6299
|
+
error: `Instance type "${instanceType}" is invalid. Expected "${$type}".`
|
|
6300
|
+
});
|
|
6301
|
+
if ($const !== void 0) {
|
|
6302
|
+
if (instanceType === "object" || instanceType === "array") {
|
|
6303
|
+
if (!deepCompareStrict(instance, $const)) errors.push({
|
|
6304
|
+
instanceLocation,
|
|
6305
|
+
keyword: "const",
|
|
6306
|
+
keywordLocation: `${schemaLocation}/const`,
|
|
6307
|
+
error: `Instance does not match ${JSON.stringify($const)}.`
|
|
6308
|
+
});
|
|
6309
|
+
} else if (instance !== $const) errors.push({
|
|
6310
|
+
instanceLocation,
|
|
6311
|
+
keyword: "const",
|
|
6312
|
+
keywordLocation: `${schemaLocation}/const`,
|
|
6313
|
+
error: `Instance does not match ${JSON.stringify($const)}.`
|
|
6314
|
+
});
|
|
6315
|
+
}
|
|
6316
|
+
if ($enum !== void 0) {
|
|
6317
|
+
if (instanceType === "object" || instanceType === "array") {
|
|
6318
|
+
if (!$enum.some((value) => deepCompareStrict(instance, value))) errors.push({
|
|
6319
|
+
instanceLocation,
|
|
6320
|
+
keyword: "enum",
|
|
6321
|
+
keywordLocation: `${schemaLocation}/enum`,
|
|
6322
|
+
error: `Instance does not match any of ${JSON.stringify($enum)}.`
|
|
6323
|
+
});
|
|
6324
|
+
} else if (!$enum.some((value) => instance === value)) errors.push({
|
|
6325
|
+
instanceLocation,
|
|
6326
|
+
keyword: "enum",
|
|
6327
|
+
keywordLocation: `${schemaLocation}/enum`,
|
|
6328
|
+
error: `Instance does not match any of ${JSON.stringify($enum)}.`
|
|
6329
|
+
});
|
|
6330
|
+
}
|
|
6331
|
+
if ($not !== void 0) {
|
|
6332
|
+
const keywordLocation = `${schemaLocation}/not`;
|
|
6333
|
+
if (validate(instance, $not, draft, lookup, shortCircuit, recursiveAnchor, instanceLocation, keywordLocation).valid) errors.push({
|
|
6334
|
+
instanceLocation,
|
|
6335
|
+
keyword: "not",
|
|
6336
|
+
keywordLocation,
|
|
6337
|
+
error: "Instance matched \"not\" schema."
|
|
6338
|
+
});
|
|
6339
|
+
}
|
|
6340
|
+
let subEvaluateds = [];
|
|
6341
|
+
if ($anyOf !== void 0) {
|
|
6342
|
+
const keywordLocation = `${schemaLocation}/anyOf`;
|
|
6343
|
+
const errorsLength = errors.length;
|
|
6344
|
+
let anyValid = false;
|
|
6345
|
+
for (let i = 0; i < $anyOf.length; i++) {
|
|
6346
|
+
const subSchema = $anyOf[i];
|
|
6347
|
+
const subEvaluated = Object.create(evaluated);
|
|
6348
|
+
const result = validate(instance, subSchema, draft, lookup, shortCircuit, $recursiveAnchor === true ? recursiveAnchor : null, instanceLocation, `${keywordLocation}/${i}`, subEvaluated);
|
|
6349
|
+
errors.push(...result.errors);
|
|
6350
|
+
anyValid = anyValid || result.valid;
|
|
6351
|
+
if (result.valid) subEvaluateds.push(subEvaluated);
|
|
6352
|
+
}
|
|
6353
|
+
if (anyValid) errors.length = errorsLength;
|
|
6354
|
+
else errors.splice(errorsLength, 0, {
|
|
6355
|
+
instanceLocation,
|
|
6356
|
+
keyword: "anyOf",
|
|
6357
|
+
keywordLocation,
|
|
6358
|
+
error: "Instance does not match any subschemas."
|
|
6359
|
+
});
|
|
6360
|
+
}
|
|
6361
|
+
if ($allOf !== void 0) {
|
|
6362
|
+
const keywordLocation = `${schemaLocation}/allOf`;
|
|
6363
|
+
const errorsLength = errors.length;
|
|
6364
|
+
let allValid = true;
|
|
6365
|
+
for (let i = 0; i < $allOf.length; i++) {
|
|
6366
|
+
const subSchema = $allOf[i];
|
|
6367
|
+
const subEvaluated = Object.create(evaluated);
|
|
6368
|
+
const result = validate(instance, subSchema, draft, lookup, shortCircuit, $recursiveAnchor === true ? recursiveAnchor : null, instanceLocation, `${keywordLocation}/${i}`, subEvaluated);
|
|
6369
|
+
errors.push(...result.errors);
|
|
6370
|
+
allValid = allValid && result.valid;
|
|
6371
|
+
if (result.valid) subEvaluateds.push(subEvaluated);
|
|
6372
|
+
}
|
|
6373
|
+
if (allValid) errors.length = errorsLength;
|
|
6374
|
+
else errors.splice(errorsLength, 0, {
|
|
6375
|
+
instanceLocation,
|
|
6376
|
+
keyword: "allOf",
|
|
6377
|
+
keywordLocation,
|
|
6378
|
+
error: `Instance does not match every subschema.`
|
|
6379
|
+
});
|
|
6380
|
+
}
|
|
6381
|
+
if ($oneOf !== void 0) {
|
|
6382
|
+
const keywordLocation = `${schemaLocation}/oneOf`;
|
|
6383
|
+
const errorsLength = errors.length;
|
|
6384
|
+
const matches = $oneOf.filter((subSchema, i) => {
|
|
6385
|
+
const subEvaluated = Object.create(evaluated);
|
|
6386
|
+
const result = validate(instance, subSchema, draft, lookup, shortCircuit, $recursiveAnchor === true ? recursiveAnchor : null, instanceLocation, `${keywordLocation}/${i}`, subEvaluated);
|
|
6387
|
+
errors.push(...result.errors);
|
|
6388
|
+
if (result.valid) subEvaluateds.push(subEvaluated);
|
|
6389
|
+
return result.valid;
|
|
6390
|
+
}).length;
|
|
6391
|
+
if (matches === 1) errors.length = errorsLength;
|
|
6392
|
+
else errors.splice(errorsLength, 0, {
|
|
6393
|
+
instanceLocation,
|
|
6394
|
+
keyword: "oneOf",
|
|
6395
|
+
keywordLocation,
|
|
6396
|
+
error: `Instance does not match exactly one subschema (${matches} matches).`
|
|
6397
|
+
});
|
|
6398
|
+
}
|
|
6399
|
+
if (instanceType === "object" || instanceType === "array") Object.assign(evaluated, ...subEvaluateds);
|
|
6400
|
+
if ($if !== void 0) {
|
|
6401
|
+
const keywordLocation = `${schemaLocation}/if`;
|
|
6402
|
+
if (validate(instance, $if, draft, lookup, shortCircuit, recursiveAnchor, instanceLocation, keywordLocation, evaluated).valid) {
|
|
6403
|
+
if ($then !== void 0) {
|
|
6404
|
+
const thenResult = validate(instance, $then, draft, lookup, shortCircuit, recursiveAnchor, instanceLocation, `${schemaLocation}/then`, evaluated);
|
|
6405
|
+
if (!thenResult.valid) errors.push({
|
|
6406
|
+
instanceLocation,
|
|
6407
|
+
keyword: "if",
|
|
6408
|
+
keywordLocation,
|
|
6409
|
+
error: `Instance does not match "then" schema.`
|
|
6410
|
+
}, ...thenResult.errors);
|
|
6411
|
+
}
|
|
6412
|
+
} else if ($else !== void 0) {
|
|
6413
|
+
const elseResult = validate(instance, $else, draft, lookup, shortCircuit, recursiveAnchor, instanceLocation, `${schemaLocation}/else`, evaluated);
|
|
6414
|
+
if (!elseResult.valid) errors.push({
|
|
6415
|
+
instanceLocation,
|
|
6416
|
+
keyword: "if",
|
|
6417
|
+
keywordLocation,
|
|
6418
|
+
error: `Instance does not match "else" schema.`
|
|
6419
|
+
}, ...elseResult.errors);
|
|
6420
|
+
}
|
|
6421
|
+
}
|
|
6422
|
+
if (instanceType === "object") {
|
|
6423
|
+
if ($required !== void 0) {
|
|
6424
|
+
for (const key of $required) if (!(key in instance)) errors.push({
|
|
6425
|
+
instanceLocation,
|
|
6426
|
+
keyword: "required",
|
|
6427
|
+
keywordLocation: `${schemaLocation}/required`,
|
|
6428
|
+
error: `Instance does not have required property "${key}".`
|
|
6429
|
+
});
|
|
6430
|
+
}
|
|
6431
|
+
const keys = Object.keys(instance);
|
|
6432
|
+
if ($minProperties !== void 0 && keys.length < $minProperties) errors.push({
|
|
6433
|
+
instanceLocation,
|
|
6434
|
+
keyword: "minProperties",
|
|
6435
|
+
keywordLocation: `${schemaLocation}/minProperties`,
|
|
6436
|
+
error: `Instance does not have at least ${$minProperties} properties.`
|
|
6437
|
+
});
|
|
6438
|
+
if ($maxProperties !== void 0 && keys.length > $maxProperties) errors.push({
|
|
6439
|
+
instanceLocation,
|
|
6440
|
+
keyword: "maxProperties",
|
|
6441
|
+
keywordLocation: `${schemaLocation}/maxProperties`,
|
|
6442
|
+
error: `Instance does not have at least ${$maxProperties} properties.`
|
|
6443
|
+
});
|
|
6444
|
+
if ($propertyNames !== void 0) {
|
|
6445
|
+
const keywordLocation = `${schemaLocation}/propertyNames`;
|
|
6446
|
+
for (const key in instance) {
|
|
6447
|
+
const subInstancePointer = `${instanceLocation}/${encodePointer(key)}`;
|
|
6448
|
+
const result = validate(key, $propertyNames, draft, lookup, shortCircuit, recursiveAnchor, subInstancePointer, keywordLocation);
|
|
6449
|
+
if (!result.valid) errors.push({
|
|
6450
|
+
instanceLocation,
|
|
6451
|
+
keyword: "propertyNames",
|
|
6452
|
+
keywordLocation,
|
|
6453
|
+
error: `Property name "${key}" does not match schema.`
|
|
6454
|
+
}, ...result.errors);
|
|
6455
|
+
}
|
|
6456
|
+
}
|
|
6457
|
+
if ($dependentRequired !== void 0) {
|
|
6458
|
+
const keywordLocation = `${schemaLocation}/dependantRequired`;
|
|
6459
|
+
for (const key in $dependentRequired) if (key in instance) {
|
|
6460
|
+
const required = $dependentRequired[key];
|
|
6461
|
+
for (const dependantKey of required) if (!(dependantKey in instance)) errors.push({
|
|
6462
|
+
instanceLocation,
|
|
6463
|
+
keyword: "dependentRequired",
|
|
6464
|
+
keywordLocation,
|
|
6465
|
+
error: `Instance has "${key}" but does not have "${dependantKey}".`
|
|
6466
|
+
});
|
|
6467
|
+
}
|
|
6468
|
+
}
|
|
6469
|
+
if ($dependentSchemas !== void 0) for (const key in $dependentSchemas) {
|
|
6470
|
+
const keywordLocation = `${schemaLocation}/dependentSchemas`;
|
|
6471
|
+
if (key in instance) {
|
|
6472
|
+
const result = validate(instance, $dependentSchemas[key], draft, lookup, shortCircuit, recursiveAnchor, instanceLocation, `${keywordLocation}/${encodePointer(key)}`, evaluated);
|
|
6473
|
+
if (!result.valid) errors.push({
|
|
6474
|
+
instanceLocation,
|
|
6475
|
+
keyword: "dependentSchemas",
|
|
6476
|
+
keywordLocation,
|
|
6477
|
+
error: `Instance has "${key}" but does not match dependant schema.`
|
|
6478
|
+
}, ...result.errors);
|
|
6479
|
+
}
|
|
6480
|
+
}
|
|
6481
|
+
if ($dependencies !== void 0) {
|
|
6482
|
+
const keywordLocation = `${schemaLocation}/dependencies`;
|
|
6483
|
+
for (const key in $dependencies) if (key in instance) {
|
|
6484
|
+
const propsOrSchema = $dependencies[key];
|
|
6485
|
+
if (Array.isArray(propsOrSchema)) {
|
|
6486
|
+
for (const dependantKey of propsOrSchema) if (!(dependantKey in instance)) errors.push({
|
|
6487
|
+
instanceLocation,
|
|
6488
|
+
keyword: "dependencies",
|
|
6489
|
+
keywordLocation,
|
|
6490
|
+
error: `Instance has "${key}" but does not have "${dependantKey}".`
|
|
6491
|
+
});
|
|
6492
|
+
} else {
|
|
6493
|
+
const result = validate(instance, propsOrSchema, draft, lookup, shortCircuit, recursiveAnchor, instanceLocation, `${keywordLocation}/${encodePointer(key)}`);
|
|
6494
|
+
if (!result.valid) errors.push({
|
|
6495
|
+
instanceLocation,
|
|
6496
|
+
keyword: "dependencies",
|
|
6497
|
+
keywordLocation,
|
|
6498
|
+
error: `Instance has "${key}" but does not match dependant schema.`
|
|
6499
|
+
}, ...result.errors);
|
|
6500
|
+
}
|
|
6501
|
+
}
|
|
6502
|
+
}
|
|
6503
|
+
const thisEvaluated = Object.create(null);
|
|
6504
|
+
let stop = false;
|
|
6505
|
+
if ($properties !== void 0) {
|
|
6506
|
+
const keywordLocation = `${schemaLocation}/properties`;
|
|
6507
|
+
for (const key in $properties) {
|
|
6508
|
+
if (!(key in instance)) continue;
|
|
6509
|
+
const subInstancePointer = `${instanceLocation}/${encodePointer(key)}`;
|
|
6510
|
+
const result = validate(instance[key], $properties[key], draft, lookup, shortCircuit, recursiveAnchor, subInstancePointer, `${keywordLocation}/${encodePointer(key)}`);
|
|
6511
|
+
if (result.valid) evaluated[key] = thisEvaluated[key] = true;
|
|
6512
|
+
else {
|
|
6513
|
+
stop = shortCircuit;
|
|
6514
|
+
errors.push({
|
|
6515
|
+
instanceLocation,
|
|
6516
|
+
keyword: "properties",
|
|
6517
|
+
keywordLocation,
|
|
6518
|
+
error: `Property "${key}" does not match schema.`
|
|
6519
|
+
}, ...result.errors);
|
|
6520
|
+
if (stop) break;
|
|
6521
|
+
}
|
|
6522
|
+
}
|
|
6523
|
+
}
|
|
6524
|
+
if (!stop && $patternProperties !== void 0) {
|
|
6525
|
+
const keywordLocation = `${schemaLocation}/patternProperties`;
|
|
6526
|
+
for (const pattern in $patternProperties) {
|
|
6527
|
+
const regex = new RegExp(pattern, "u");
|
|
6528
|
+
const subSchema = $patternProperties[pattern];
|
|
6529
|
+
for (const key in instance) {
|
|
6530
|
+
if (!regex.test(key)) continue;
|
|
6531
|
+
const subInstancePointer = `${instanceLocation}/${encodePointer(key)}`;
|
|
6532
|
+
const result = validate(instance[key], subSchema, draft, lookup, shortCircuit, recursiveAnchor, subInstancePointer, `${keywordLocation}/${encodePointer(pattern)}`);
|
|
6533
|
+
if (result.valid) evaluated[key] = thisEvaluated[key] = true;
|
|
6534
|
+
else {
|
|
6535
|
+
stop = shortCircuit;
|
|
6536
|
+
errors.push({
|
|
6537
|
+
instanceLocation,
|
|
6538
|
+
keyword: "patternProperties",
|
|
6539
|
+
keywordLocation,
|
|
6540
|
+
error: `Property "${key}" matches pattern "${pattern}" but does not match associated schema.`
|
|
6541
|
+
}, ...result.errors);
|
|
6542
|
+
}
|
|
6543
|
+
}
|
|
6544
|
+
}
|
|
6545
|
+
}
|
|
6546
|
+
if (!stop && $additionalProperties !== void 0) {
|
|
6547
|
+
const keywordLocation = `${schemaLocation}/additionalProperties`;
|
|
6548
|
+
for (const key in instance) {
|
|
6549
|
+
if (thisEvaluated[key]) continue;
|
|
6550
|
+
const subInstancePointer = `${instanceLocation}/${encodePointer(key)}`;
|
|
6551
|
+
const result = validate(instance[key], $additionalProperties, draft, lookup, shortCircuit, recursiveAnchor, subInstancePointer, keywordLocation);
|
|
6552
|
+
if (result.valid) evaluated[key] = true;
|
|
6553
|
+
else {
|
|
6554
|
+
stop = shortCircuit;
|
|
6555
|
+
errors.push({
|
|
6556
|
+
instanceLocation,
|
|
6557
|
+
keyword: "additionalProperties",
|
|
6558
|
+
keywordLocation,
|
|
6559
|
+
error: `Property "${key}" does not match additional properties schema.`
|
|
6560
|
+
}, ...result.errors);
|
|
6561
|
+
}
|
|
6562
|
+
}
|
|
6563
|
+
} else if (!stop && $unevaluatedProperties !== void 0) {
|
|
6564
|
+
const keywordLocation = `${schemaLocation}/unevaluatedProperties`;
|
|
6565
|
+
for (const key in instance) if (!evaluated[key]) {
|
|
6566
|
+
const subInstancePointer = `${instanceLocation}/${encodePointer(key)}`;
|
|
6567
|
+
const result = validate(instance[key], $unevaluatedProperties, draft, lookup, shortCircuit, recursiveAnchor, subInstancePointer, keywordLocation);
|
|
6568
|
+
if (result.valid) evaluated[key] = true;
|
|
6569
|
+
else errors.push({
|
|
6570
|
+
instanceLocation,
|
|
6571
|
+
keyword: "unevaluatedProperties",
|
|
6572
|
+
keywordLocation,
|
|
6573
|
+
error: `Property "${key}" does not match unevaluated properties schema.`
|
|
6574
|
+
}, ...result.errors);
|
|
6575
|
+
}
|
|
6576
|
+
}
|
|
6577
|
+
} else if (instanceType === "array") {
|
|
6578
|
+
if ($maxItems !== void 0 && instance.length > $maxItems) errors.push({
|
|
6579
|
+
instanceLocation,
|
|
6580
|
+
keyword: "maxItems",
|
|
6581
|
+
keywordLocation: `${schemaLocation}/maxItems`,
|
|
6582
|
+
error: `Array has too many items (${instance.length} > ${$maxItems}).`
|
|
6583
|
+
});
|
|
6584
|
+
if ($minItems !== void 0 && instance.length < $minItems) errors.push({
|
|
6585
|
+
instanceLocation,
|
|
6586
|
+
keyword: "minItems",
|
|
6587
|
+
keywordLocation: `${schemaLocation}/minItems`,
|
|
6588
|
+
error: `Array has too few items (${instance.length} < ${$minItems}).`
|
|
6589
|
+
});
|
|
6590
|
+
const length = instance.length;
|
|
6591
|
+
let i = 0;
|
|
6592
|
+
let stop = false;
|
|
6593
|
+
if ($prefixItems !== void 0) {
|
|
6594
|
+
const keywordLocation = `${schemaLocation}/prefixItems`;
|
|
6595
|
+
const length2 = Math.min($prefixItems.length, length);
|
|
6596
|
+
for (; i < length2; i++) {
|
|
6597
|
+
const result = validate(instance[i], $prefixItems[i], draft, lookup, shortCircuit, recursiveAnchor, `${instanceLocation}/${i}`, `${keywordLocation}/${i}`);
|
|
6598
|
+
evaluated[i] = true;
|
|
6599
|
+
if (!result.valid) {
|
|
6600
|
+
stop = shortCircuit;
|
|
6601
|
+
errors.push({
|
|
6602
|
+
instanceLocation,
|
|
6603
|
+
keyword: "prefixItems",
|
|
6604
|
+
keywordLocation,
|
|
6605
|
+
error: `Items did not match schema.`
|
|
6606
|
+
}, ...result.errors);
|
|
6607
|
+
if (stop) break;
|
|
6608
|
+
}
|
|
6609
|
+
}
|
|
6610
|
+
}
|
|
6611
|
+
if ($items !== void 0) {
|
|
6612
|
+
const keywordLocation = `${schemaLocation}/items`;
|
|
6613
|
+
if (Array.isArray($items)) {
|
|
6614
|
+
const length2 = Math.min($items.length, length);
|
|
6615
|
+
for (; i < length2; i++) {
|
|
6616
|
+
const result = validate(instance[i], $items[i], draft, lookup, shortCircuit, recursiveAnchor, `${instanceLocation}/${i}`, `${keywordLocation}/${i}`);
|
|
6617
|
+
evaluated[i] = true;
|
|
6618
|
+
if (!result.valid) {
|
|
6619
|
+
stop = shortCircuit;
|
|
6620
|
+
errors.push({
|
|
6621
|
+
instanceLocation,
|
|
6622
|
+
keyword: "items",
|
|
6623
|
+
keywordLocation,
|
|
6624
|
+
error: `Items did not match schema.`
|
|
6625
|
+
}, ...result.errors);
|
|
6626
|
+
if (stop) break;
|
|
6627
|
+
}
|
|
6628
|
+
}
|
|
6629
|
+
} else for (; i < length; i++) {
|
|
6630
|
+
const result = validate(instance[i], $items, draft, lookup, shortCircuit, recursiveAnchor, `${instanceLocation}/${i}`, keywordLocation);
|
|
6631
|
+
evaluated[i] = true;
|
|
6632
|
+
if (!result.valid) {
|
|
6633
|
+
stop = shortCircuit;
|
|
6634
|
+
errors.push({
|
|
6635
|
+
instanceLocation,
|
|
6636
|
+
keyword: "items",
|
|
6637
|
+
keywordLocation,
|
|
6638
|
+
error: `Items did not match schema.`
|
|
6639
|
+
}, ...result.errors);
|
|
6640
|
+
if (stop) break;
|
|
6641
|
+
}
|
|
6642
|
+
}
|
|
6643
|
+
if (!stop && $additionalItems !== void 0) {
|
|
6644
|
+
const keywordLocation = `${schemaLocation}/additionalItems`;
|
|
6645
|
+
for (; i < length; i++) {
|
|
6646
|
+
const result = validate(instance[i], $additionalItems, draft, lookup, shortCircuit, recursiveAnchor, `${instanceLocation}/${i}`, keywordLocation);
|
|
6647
|
+
evaluated[i] = true;
|
|
6648
|
+
if (!result.valid) {
|
|
6649
|
+
stop = shortCircuit;
|
|
6650
|
+
errors.push({
|
|
6651
|
+
instanceLocation,
|
|
6652
|
+
keyword: "additionalItems",
|
|
6653
|
+
keywordLocation,
|
|
6654
|
+
error: `Items did not match additional items schema.`
|
|
6655
|
+
}, ...result.errors);
|
|
6656
|
+
}
|
|
6657
|
+
}
|
|
6658
|
+
}
|
|
6659
|
+
}
|
|
6660
|
+
if ($contains !== void 0) {
|
|
6661
|
+
if (length === 0 && $minContains === void 0) errors.push({
|
|
6662
|
+
instanceLocation,
|
|
6663
|
+
keyword: "contains",
|
|
6664
|
+
keywordLocation: `${schemaLocation}/contains`,
|
|
6665
|
+
error: `Array is empty. It must contain at least one item matching the schema.`
|
|
6666
|
+
});
|
|
6667
|
+
else if ($minContains !== void 0 && length < $minContains) errors.push({
|
|
6668
|
+
instanceLocation,
|
|
6669
|
+
keyword: "minContains",
|
|
6670
|
+
keywordLocation: `${schemaLocation}/minContains`,
|
|
6671
|
+
error: `Array has less items (${length}) than minContains (${$minContains}).`
|
|
6672
|
+
});
|
|
6673
|
+
else {
|
|
6674
|
+
const keywordLocation = `${schemaLocation}/contains`;
|
|
6675
|
+
const errorsLength = errors.length;
|
|
6676
|
+
let contained = 0;
|
|
6677
|
+
for (let j = 0; j < length; j++) {
|
|
6678
|
+
const result = validate(instance[j], $contains, draft, lookup, shortCircuit, recursiveAnchor, `${instanceLocation}/${j}`, keywordLocation);
|
|
6679
|
+
if (result.valid) {
|
|
6680
|
+
evaluated[j] = true;
|
|
6681
|
+
contained++;
|
|
6682
|
+
} else errors.push(...result.errors);
|
|
6683
|
+
}
|
|
6684
|
+
if (contained >= ($minContains || 0)) errors.length = errorsLength;
|
|
6685
|
+
if ($minContains === void 0 && $maxContains === void 0 && contained === 0) errors.splice(errorsLength, 0, {
|
|
6686
|
+
instanceLocation,
|
|
6687
|
+
keyword: "contains",
|
|
6688
|
+
keywordLocation,
|
|
6689
|
+
error: `Array does not contain item matching schema.`
|
|
6690
|
+
});
|
|
6691
|
+
else if ($minContains !== void 0 && contained < $minContains) errors.push({
|
|
6692
|
+
instanceLocation,
|
|
6693
|
+
keyword: "minContains",
|
|
6694
|
+
keywordLocation: `${schemaLocation}/minContains`,
|
|
6695
|
+
error: `Array must contain at least ${$minContains} items matching schema. Only ${contained} items were found.`
|
|
6696
|
+
});
|
|
6697
|
+
else if ($maxContains !== void 0 && contained > $maxContains) errors.push({
|
|
6698
|
+
instanceLocation,
|
|
6699
|
+
keyword: "maxContains",
|
|
6700
|
+
keywordLocation: `${schemaLocation}/maxContains`,
|
|
6701
|
+
error: `Array may contain at most ${$maxContains} items matching schema. ${contained} items were found.`
|
|
6702
|
+
});
|
|
6703
|
+
}
|
|
6704
|
+
}
|
|
6705
|
+
if (!stop && $unevaluatedItems !== void 0) {
|
|
6706
|
+
const keywordLocation = `${schemaLocation}/unevaluatedItems`;
|
|
6707
|
+
for (; i < length; i++) {
|
|
6708
|
+
if (evaluated[i]) continue;
|
|
6709
|
+
const result = validate(instance[i], $unevaluatedItems, draft, lookup, shortCircuit, recursiveAnchor, `${instanceLocation}/${i}`, keywordLocation);
|
|
6710
|
+
evaluated[i] = true;
|
|
6711
|
+
if (!result.valid) errors.push({
|
|
6712
|
+
instanceLocation,
|
|
6713
|
+
keyword: "unevaluatedItems",
|
|
6714
|
+
keywordLocation,
|
|
6715
|
+
error: `Items did not match unevaluated items schema.`
|
|
6716
|
+
}, ...result.errors);
|
|
6717
|
+
}
|
|
6718
|
+
}
|
|
6719
|
+
if ($uniqueItems) for (let j = 0; j < length; j++) {
|
|
6720
|
+
const a = instance[j];
|
|
6721
|
+
const ao = typeof a === "object" && a !== null;
|
|
6722
|
+
for (let k = 0; k < length; k++) {
|
|
6723
|
+
if (j === k) continue;
|
|
6724
|
+
const b = instance[k];
|
|
6725
|
+
if (a === b || ao && typeof b === "object" && b !== null && deepCompareStrict(a, b)) {
|
|
6726
|
+
errors.push({
|
|
6727
|
+
instanceLocation,
|
|
6728
|
+
keyword: "uniqueItems",
|
|
6729
|
+
keywordLocation: `${schemaLocation}/uniqueItems`,
|
|
6730
|
+
error: `Duplicate items at indexes ${j} and ${k}.`
|
|
6731
|
+
});
|
|
6732
|
+
j = Number.MAX_SAFE_INTEGER;
|
|
6733
|
+
k = Number.MAX_SAFE_INTEGER;
|
|
6734
|
+
}
|
|
6735
|
+
}
|
|
6736
|
+
}
|
|
6737
|
+
} else if (instanceType === "number") {
|
|
6738
|
+
if (draft === "4") {
|
|
6739
|
+
if ($minimum !== void 0 && ($exclusiveMinimum === true && instance <= $minimum || instance < $minimum)) errors.push({
|
|
6740
|
+
instanceLocation,
|
|
6741
|
+
keyword: "minimum",
|
|
6742
|
+
keywordLocation: `${schemaLocation}/minimum`,
|
|
6743
|
+
error: `${instance} is less than ${$exclusiveMinimum ? "or equal to " : ""} ${$minimum}.`
|
|
6744
|
+
});
|
|
6745
|
+
if ($maximum !== void 0 && ($exclusiveMaximum === true && instance >= $maximum || instance > $maximum)) errors.push({
|
|
6746
|
+
instanceLocation,
|
|
6747
|
+
keyword: "maximum",
|
|
6748
|
+
keywordLocation: `${schemaLocation}/maximum`,
|
|
6749
|
+
error: `${instance} is greater than ${$exclusiveMaximum ? "or equal to " : ""} ${$maximum}.`
|
|
6750
|
+
});
|
|
6751
|
+
} else {
|
|
6752
|
+
if ($minimum !== void 0 && instance < $minimum) errors.push({
|
|
6753
|
+
instanceLocation,
|
|
6754
|
+
keyword: "minimum",
|
|
6755
|
+
keywordLocation: `${schemaLocation}/minimum`,
|
|
6756
|
+
error: `${instance} is less than ${$minimum}.`
|
|
6757
|
+
});
|
|
6758
|
+
if ($maximum !== void 0 && instance > $maximum) errors.push({
|
|
6759
|
+
instanceLocation,
|
|
6760
|
+
keyword: "maximum",
|
|
6761
|
+
keywordLocation: `${schemaLocation}/maximum`,
|
|
6762
|
+
error: `${instance} is greater than ${$maximum}.`
|
|
6763
|
+
});
|
|
6764
|
+
if ($exclusiveMinimum !== void 0 && instance <= $exclusiveMinimum) errors.push({
|
|
6765
|
+
instanceLocation,
|
|
6766
|
+
keyword: "exclusiveMinimum",
|
|
6767
|
+
keywordLocation: `${schemaLocation}/exclusiveMinimum`,
|
|
6768
|
+
error: `${instance} is less than ${$exclusiveMinimum}.`
|
|
6769
|
+
});
|
|
6770
|
+
if ($exclusiveMaximum !== void 0 && instance >= $exclusiveMaximum) errors.push({
|
|
6771
|
+
instanceLocation,
|
|
6772
|
+
keyword: "exclusiveMaximum",
|
|
6773
|
+
keywordLocation: `${schemaLocation}/exclusiveMaximum`,
|
|
6774
|
+
error: `${instance} is greater than or equal to ${$exclusiveMaximum}.`
|
|
6775
|
+
});
|
|
6776
|
+
}
|
|
6777
|
+
if ($multipleOf !== void 0) {
|
|
6778
|
+
const remainder = instance % $multipleOf;
|
|
6779
|
+
if (Math.abs(0 - remainder) >= 1.1920929e-7 && Math.abs($multipleOf - remainder) >= 1.1920929e-7) errors.push({
|
|
6780
|
+
instanceLocation,
|
|
6781
|
+
keyword: "multipleOf",
|
|
6782
|
+
keywordLocation: `${schemaLocation}/multipleOf`,
|
|
6783
|
+
error: `${instance} is not a multiple of ${$multipleOf}.`
|
|
6784
|
+
});
|
|
6785
|
+
}
|
|
6786
|
+
} else if (instanceType === "string") {
|
|
6787
|
+
const length = $minLength === void 0 && $maxLength === void 0 ? 0 : ucs2length(instance);
|
|
6788
|
+
if ($minLength !== void 0 && length < $minLength) errors.push({
|
|
6789
|
+
instanceLocation,
|
|
6790
|
+
keyword: "minLength",
|
|
6791
|
+
keywordLocation: `${schemaLocation}/minLength`,
|
|
6792
|
+
error: `String is too short (${length} < ${$minLength}).`
|
|
6793
|
+
});
|
|
6794
|
+
if ($maxLength !== void 0 && length > $maxLength) errors.push({
|
|
6795
|
+
instanceLocation,
|
|
6796
|
+
keyword: "maxLength",
|
|
6797
|
+
keywordLocation: `${schemaLocation}/maxLength`,
|
|
6798
|
+
error: `String is too long (${length} > ${$maxLength}).`
|
|
6799
|
+
});
|
|
6800
|
+
if ($pattern !== void 0 && !new RegExp($pattern, "u").test(instance)) errors.push({
|
|
6801
|
+
instanceLocation,
|
|
6802
|
+
keyword: "pattern",
|
|
6803
|
+
keywordLocation: `${schemaLocation}/pattern`,
|
|
6804
|
+
error: `String does not match pattern.`
|
|
6805
|
+
});
|
|
6806
|
+
if ($format !== void 0 && format[$format] && !format[$format](instance)) errors.push({
|
|
6807
|
+
instanceLocation,
|
|
6808
|
+
keyword: "format",
|
|
6809
|
+
keywordLocation: `${schemaLocation}/format`,
|
|
6810
|
+
error: `String does not match format "${$format}".`
|
|
6811
|
+
});
|
|
6812
|
+
}
|
|
6813
|
+
return {
|
|
6814
|
+
valid: errors.length === 0,
|
|
6815
|
+
errors
|
|
6816
|
+
};
|
|
6817
|
+
}
|
|
6818
|
+
//#endregion
|
|
6819
|
+
//#region ../../node_modules/.bun/@cfworker+json-schema@4.1.1/node_modules/@cfworker/json-schema/dist/esm/validator.js
|
|
6820
|
+
var Validator = class {
|
|
6821
|
+
schema;
|
|
6822
|
+
draft;
|
|
6823
|
+
shortCircuit;
|
|
6824
|
+
lookup;
|
|
6825
|
+
constructor(schema, draft = "2019-09", shortCircuit = true) {
|
|
6826
|
+
this.schema = schema;
|
|
6827
|
+
this.draft = draft;
|
|
6828
|
+
this.shortCircuit = shortCircuit;
|
|
6829
|
+
this.lookup = dereference(schema);
|
|
6830
|
+
}
|
|
6831
|
+
validate(instance) {
|
|
6832
|
+
return validate(instance, this.schema, this.draft, this.lookup, this.shortCircuit);
|
|
6833
|
+
}
|
|
6834
|
+
addSchema(schema, id) {
|
|
6835
|
+
if (id) schema = {
|
|
6836
|
+
...schema,
|
|
6837
|
+
$id: id
|
|
6838
|
+
};
|
|
6839
|
+
dereference(schema, this.lookup);
|
|
6840
|
+
}
|
|
6841
|
+
};
|
|
6842
|
+
//#endregion
|
|
5963
6843
|
//#region src/json-schema-subset/utils.ts
|
|
5964
6844
|
var nextId = 0;
|
|
5965
6845
|
function createId() {
|
|
@@ -7913,6 +8793,7 @@ function schemaEqualsChecker(extendsContext) {
|
|
|
7913
8793
|
if (value1 === null || value2 === null) return false;
|
|
7914
8794
|
if (typeof value1 !== "object") return false;
|
|
7915
8795
|
if (typeof value1 !== typeof value2) return false;
|
|
8796
|
+
if (extendsContext.isExtendsSchema(value1) || extendsContext.isExtendsSchema(value2)) return extendsContext.equals(value1, value2);
|
|
7916
8797
|
if (isCompiledSchema(value1) && isCompiledSchema(value2)) return isCompiledSchemaEquals(value1, value2);
|
|
7917
8798
|
return isObjectLikeEquals(value1, value2);
|
|
7918
8799
|
}
|
|
@@ -8642,10 +9523,17 @@ var SingleSelectSchema = class SingleSelectSchema extends SpecialSchema {
|
|
|
8642
9523
|
}
|
|
8643
9524
|
constructor(id, value, context) {
|
|
8644
9525
|
if (!SingleSelectSchema.isMatch(value)) throw new TypeError("Invalid single-select schema.");
|
|
8645
|
-
|
|
9526
|
+
const validator = new Validator(structuredClone(value), "7");
|
|
9527
|
+
super(id, { enum: value.enum.filter((item) => validator.validate(item).valid) }, context);
|
|
8646
9528
|
}
|
|
8647
9529
|
compareImpl(other) {
|
|
8648
|
-
if (
|
|
9530
|
+
if (this.value.enum.length == 0) return [(other instanceof SingleSelectSchema ? other.value.enum.length == 0 : isCompiledSchema(other) && getKind(other) === CompiledKind.Never) ? ExpressionSingleResult.Equals : ExpressionSingleResult.ContainedBy];
|
|
9531
|
+
if (isStringLikeSchema(other)) {
|
|
9532
|
+
const validator = new Validator(structuredClone(other), "7");
|
|
9533
|
+
const accepted = this.value.enum.filter((item) => validator.validate(item).valid).length;
|
|
9534
|
+
if (accepted == this.value.enum.length) return [ExpressionSingleResult.ContainedBy];
|
|
9535
|
+
return [accepted == 0 ? ExpressionSingleResult.Rejection : ExpressionSingleResult.Intersection];
|
|
9536
|
+
}
|
|
8649
9537
|
if (other instanceof SingleSelectSchema) {
|
|
8650
9538
|
const f = new Set(this.value.enum);
|
|
8651
9539
|
let result = ExpressionSingleResult.Equals;
|