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