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