@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
|
@@ -894,7 +894,7 @@ var _safeParseAsync = (_Err) => async (schema, value, _ctx) => {
|
|
|
894
894
|
};
|
|
895
895
|
var COMPILE_INVALID = /* @__PURE__ */ Symbol.for("zod.compile.invalid");
|
|
896
896
|
var COMPILE_FALLBACK = /* @__PURE__ */ Symbol.for("zod.compile.fallback");
|
|
897
|
-
var validate = ((schema, value, _ctx) => {
|
|
897
|
+
var validate$1 = ((schema, value, _ctx) => {
|
|
898
898
|
const validator = schema._zod.bag.validator;
|
|
899
899
|
if (validator !== void 0) {
|
|
900
900
|
if (validator(value) !== COMPILE_INVALID) return true;
|
|
@@ -1046,12 +1046,12 @@ var dateSource = `(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][
|
|
|
1046
1046
|
function anchor(source) {
|
|
1047
1047
|
return new RegExp(`^${source}$`);
|
|
1048
1048
|
}
|
|
1049
|
-
var date = /*@__PURE__*/ anchor(dateSource);
|
|
1049
|
+
var date$1 = /*@__PURE__*/ anchor(dateSource);
|
|
1050
1050
|
function timeSource(args) {
|
|
1051
1051
|
const hhmm = `(?:[01]\\d|2[0-3]):[0-5]\\d`;
|
|
1052
1052
|
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+)?)?`;
|
|
1053
1053
|
}
|
|
1054
|
-
function time(args) {
|
|
1054
|
+
function time$1(args) {
|
|
1055
1055
|
return new RegExp(`^${timeSource(args)}$`);
|
|
1056
1056
|
}
|
|
1057
1057
|
function datetime$1(args) {
|
|
@@ -1709,11 +1709,11 @@ var $ZodISODateTime = /*@__PURE__*/ $constructor("$ZodISODateTime", (inst, def)
|
|
|
1709
1709
|
$ZodStringFormat.init(inst, def);
|
|
1710
1710
|
});
|
|
1711
1711
|
var $ZodISODate = /*@__PURE__*/ $constructor("$ZodISODate", (inst, def) => {
|
|
1712
|
-
def.pattern ?? (def.pattern = date);
|
|
1712
|
+
def.pattern ?? (def.pattern = date$1);
|
|
1713
1713
|
$ZodStringFormat.init(inst, def);
|
|
1714
1714
|
});
|
|
1715
1715
|
var $ZodISOTime = /*@__PURE__*/ $constructor("$ZodISOTime", (inst, def) => {
|
|
1716
|
-
def.pattern ?? (def.pattern = time(def));
|
|
1716
|
+
def.pattern ?? (def.pattern = time$1(def));
|
|
1717
1717
|
$ZodStringFormat.init(inst, def);
|
|
1718
1718
|
});
|
|
1719
1719
|
var $ZodISODuration = /*@__PURE__*/ $constructor("$ZodISODuration", (inst, def) => {
|
|
@@ -4928,7 +4928,7 @@ var ZodType = /*@__PURE__*/ $constructor("ZodType", (inst, def) => {
|
|
|
4928
4928
|
own(this, "spa", value);
|
|
4929
4929
|
},
|
|
4930
4930
|
validate(data, params) {
|
|
4931
|
-
return validate(this, data, params);
|
|
4931
|
+
return validate$1(this, data, params);
|
|
4932
4932
|
},
|
|
4933
4933
|
validateAsync(data, params) {
|
|
4934
4934
|
return validateAsync$1(this, data, params);
|
|
@@ -5754,6 +5754,886 @@ var connectorProxyExecutorSchema = strictObject({
|
|
|
5754
5754
|
bodyFormat: _enum(["none", "json"]).default("none")
|
|
5755
5755
|
}).extend({ kind: literal("connector-proxy") });
|
|
5756
5756
|
//#endregion
|
|
5757
|
+
//#region ../../node_modules/.bun/@cfworker+json-schema@4.1.1/node_modules/@cfworker/json-schema/dist/esm/deep-compare-strict.js
|
|
5758
|
+
function deepCompareStrict(a, b) {
|
|
5759
|
+
const typeofa = typeof a;
|
|
5760
|
+
if (typeofa !== typeof b) return false;
|
|
5761
|
+
if (Array.isArray(a)) {
|
|
5762
|
+
if (!Array.isArray(b)) return false;
|
|
5763
|
+
const length = a.length;
|
|
5764
|
+
if (length !== b.length) return false;
|
|
5765
|
+
for (let i = 0; i < length; i++) if (!deepCompareStrict(a[i], b[i])) return false;
|
|
5766
|
+
return true;
|
|
5767
|
+
}
|
|
5768
|
+
if (typeofa === "object") {
|
|
5769
|
+
if (!a || !b) return a === b;
|
|
5770
|
+
const aKeys = Object.keys(a);
|
|
5771
|
+
const bKeys = Object.keys(b);
|
|
5772
|
+
if (aKeys.length !== bKeys.length) return false;
|
|
5773
|
+
for (const k of aKeys) if (!deepCompareStrict(a[k], b[k])) return false;
|
|
5774
|
+
return true;
|
|
5775
|
+
}
|
|
5776
|
+
return a === b;
|
|
5777
|
+
}
|
|
5778
|
+
//#endregion
|
|
5779
|
+
//#region ../../node_modules/.bun/@cfworker+json-schema@4.1.1/node_modules/@cfworker/json-schema/dist/esm/pointer.js
|
|
5780
|
+
function encodePointer(p) {
|
|
5781
|
+
return encodeURI(escapePointer(p));
|
|
5782
|
+
}
|
|
5783
|
+
function escapePointer(p) {
|
|
5784
|
+
return p.replace(/~/g, "~0").replace(/\//g, "~1");
|
|
5785
|
+
}
|
|
5786
|
+
//#endregion
|
|
5787
|
+
//#region ../../node_modules/.bun/@cfworker+json-schema@4.1.1/node_modules/@cfworker/json-schema/dist/esm/dereference.js
|
|
5788
|
+
var schemaArrayKeyword = {
|
|
5789
|
+
prefixItems: true,
|
|
5790
|
+
items: true,
|
|
5791
|
+
allOf: true,
|
|
5792
|
+
anyOf: true,
|
|
5793
|
+
oneOf: true
|
|
5794
|
+
};
|
|
5795
|
+
var schemaMapKeyword = {
|
|
5796
|
+
$defs: true,
|
|
5797
|
+
definitions: true,
|
|
5798
|
+
properties: true,
|
|
5799
|
+
patternProperties: true,
|
|
5800
|
+
dependentSchemas: true
|
|
5801
|
+
};
|
|
5802
|
+
var ignoredKeyword = {
|
|
5803
|
+
id: true,
|
|
5804
|
+
$id: true,
|
|
5805
|
+
$ref: true,
|
|
5806
|
+
$schema: true,
|
|
5807
|
+
$anchor: true,
|
|
5808
|
+
$vocabulary: true,
|
|
5809
|
+
$comment: true,
|
|
5810
|
+
default: true,
|
|
5811
|
+
enum: true,
|
|
5812
|
+
const: true,
|
|
5813
|
+
required: true,
|
|
5814
|
+
type: true,
|
|
5815
|
+
maximum: true,
|
|
5816
|
+
minimum: true,
|
|
5817
|
+
exclusiveMaximum: true,
|
|
5818
|
+
exclusiveMinimum: true,
|
|
5819
|
+
multipleOf: true,
|
|
5820
|
+
maxLength: true,
|
|
5821
|
+
minLength: true,
|
|
5822
|
+
pattern: true,
|
|
5823
|
+
format: true,
|
|
5824
|
+
maxItems: true,
|
|
5825
|
+
minItems: true,
|
|
5826
|
+
uniqueItems: true,
|
|
5827
|
+
maxProperties: true,
|
|
5828
|
+
minProperties: true
|
|
5829
|
+
};
|
|
5830
|
+
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");
|
|
5831
|
+
function dereference(schema, lookup = Object.create(null), baseURI = initialBaseURI, basePointer = "") {
|
|
5832
|
+
if (schema && typeof schema === "object" && !Array.isArray(schema)) {
|
|
5833
|
+
const id = schema.$id || schema.id;
|
|
5834
|
+
if (id) {
|
|
5835
|
+
const url = new URL(id, baseURI.href);
|
|
5836
|
+
if (url.hash.length > 1) lookup[url.href] = schema;
|
|
5837
|
+
else {
|
|
5838
|
+
url.hash = "";
|
|
5839
|
+
if (basePointer === "") baseURI = url;
|
|
5840
|
+
else dereference(schema, lookup, baseURI);
|
|
5841
|
+
}
|
|
5842
|
+
}
|
|
5843
|
+
} else if (schema !== true && schema !== false) return lookup;
|
|
5844
|
+
const schemaURI = baseURI.href + (basePointer ? "#" + basePointer : "");
|
|
5845
|
+
if (lookup[schemaURI] !== void 0) throw new Error(`Duplicate schema URI "${schemaURI}".`);
|
|
5846
|
+
lookup[schemaURI] = schema;
|
|
5847
|
+
if (schema === true || schema === false) return lookup;
|
|
5848
|
+
if (schema.__absolute_uri__ === void 0) Object.defineProperty(schema, "__absolute_uri__", {
|
|
5849
|
+
enumerable: false,
|
|
5850
|
+
value: schemaURI
|
|
5851
|
+
});
|
|
5852
|
+
if (schema.$ref && schema.__absolute_ref__ === void 0) {
|
|
5853
|
+
const url = new URL(schema.$ref, baseURI.href);
|
|
5854
|
+
url.hash = url.hash;
|
|
5855
|
+
Object.defineProperty(schema, "__absolute_ref__", {
|
|
5856
|
+
enumerable: false,
|
|
5857
|
+
value: url.href
|
|
5858
|
+
});
|
|
5859
|
+
}
|
|
5860
|
+
if (schema.$recursiveRef && schema.__absolute_recursive_ref__ === void 0) {
|
|
5861
|
+
const url = new URL(schema.$recursiveRef, baseURI.href);
|
|
5862
|
+
url.hash = url.hash;
|
|
5863
|
+
Object.defineProperty(schema, "__absolute_recursive_ref__", {
|
|
5864
|
+
enumerable: false,
|
|
5865
|
+
value: url.href
|
|
5866
|
+
});
|
|
5867
|
+
}
|
|
5868
|
+
if (schema.$anchor) {
|
|
5869
|
+
const url = new URL("#" + schema.$anchor, baseURI.href);
|
|
5870
|
+
lookup[url.href] = schema;
|
|
5871
|
+
}
|
|
5872
|
+
for (let key in schema) {
|
|
5873
|
+
if (ignoredKeyword[key]) continue;
|
|
5874
|
+
const keyBase = `${basePointer}/${encodePointer(key)}`;
|
|
5875
|
+
const subSchema = schema[key];
|
|
5876
|
+
if (Array.isArray(subSchema)) {
|
|
5877
|
+
if (schemaArrayKeyword[key]) {
|
|
5878
|
+
const length = subSchema.length;
|
|
5879
|
+
for (let i = 0; i < length; i++) dereference(subSchema[i], lookup, baseURI, `${keyBase}/${i}`);
|
|
5880
|
+
}
|
|
5881
|
+
} else if (schemaMapKeyword[key]) for (let subKey in subSchema) dereference(subSchema[subKey], lookup, baseURI, `${keyBase}/${encodePointer(subKey)}`);
|
|
5882
|
+
else dereference(subSchema, lookup, baseURI, keyBase);
|
|
5883
|
+
}
|
|
5884
|
+
return lookup;
|
|
5885
|
+
}
|
|
5886
|
+
//#endregion
|
|
5887
|
+
//#region ../../node_modules/.bun/@cfworker+json-schema@4.1.1/node_modules/@cfworker/json-schema/dist/esm/format.js
|
|
5888
|
+
var DATE = /^(\d\d\d\d)-(\d\d)-(\d\d)$/;
|
|
5889
|
+
var DAYS = [
|
|
5890
|
+
0,
|
|
5891
|
+
31,
|
|
5892
|
+
28,
|
|
5893
|
+
31,
|
|
5894
|
+
30,
|
|
5895
|
+
31,
|
|
5896
|
+
30,
|
|
5897
|
+
31,
|
|
5898
|
+
31,
|
|
5899
|
+
30,
|
|
5900
|
+
31,
|
|
5901
|
+
30,
|
|
5902
|
+
31
|
|
5903
|
+
];
|
|
5904
|
+
var TIME = /^(\d\d):(\d\d):(\d\d)(\.\d+)?(z|[+-]\d\d(?::?\d\d)?)?$/i;
|
|
5905
|
+
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;
|
|
5906
|
+
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;
|
|
5907
|
+
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;
|
|
5908
|
+
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;
|
|
5909
|
+
var UUID = /^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i;
|
|
5910
|
+
var JSON_POINTER = /^(?:\/(?:[^~/]|~0|~1)*)*$/;
|
|
5911
|
+
var JSON_POINTER_URI_FRAGMENT = /^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i;
|
|
5912
|
+
var RELATIVE_JSON_POINTER = /^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/;
|
|
5913
|
+
var EMAIL = (input) => {
|
|
5914
|
+
if (input[0] === "\"") return false;
|
|
5915
|
+
const [name, host, ...rest] = input.split("@");
|
|
5916
|
+
if (!name || !host || rest.length !== 0 || name.length > 64 || host.length > 253) return false;
|
|
5917
|
+
if (name[0] === "." || name.endsWith(".") || name.includes("..")) return false;
|
|
5918
|
+
if (!/^[a-z0-9.-]+$/i.test(host) || !/^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+$/i.test(name)) return false;
|
|
5919
|
+
return host.split(".").every((part) => /^[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?$/i.test(part));
|
|
5920
|
+
};
|
|
5921
|
+
var IPV4 = /^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/;
|
|
5922
|
+
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;
|
|
5923
|
+
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));
|
|
5924
|
+
function bind(r) {
|
|
5925
|
+
return r.test.bind(r);
|
|
5926
|
+
}
|
|
5927
|
+
var format = {
|
|
5928
|
+
date,
|
|
5929
|
+
time: time.bind(void 0, false),
|
|
5930
|
+
"date-time": date_time,
|
|
5931
|
+
duration: DURATION,
|
|
5932
|
+
uri,
|
|
5933
|
+
"uri-reference": bind(URIREF),
|
|
5934
|
+
"uri-template": bind(URITEMPLATE),
|
|
5935
|
+
url: bind(URL_),
|
|
5936
|
+
email: EMAIL,
|
|
5937
|
+
hostname: bind(HOSTNAME),
|
|
5938
|
+
ipv4: bind(IPV4),
|
|
5939
|
+
ipv6: bind(IPV6),
|
|
5940
|
+
regex,
|
|
5941
|
+
uuid: bind(UUID),
|
|
5942
|
+
"json-pointer": bind(JSON_POINTER),
|
|
5943
|
+
"json-pointer-uri-fragment": bind(JSON_POINTER_URI_FRAGMENT),
|
|
5944
|
+
"relative-json-pointer": bind(RELATIVE_JSON_POINTER)
|
|
5945
|
+
};
|
|
5946
|
+
function isLeapYear(year) {
|
|
5947
|
+
return year % 4 === 0 && (year % 100 !== 0 || year % 400 === 0);
|
|
5948
|
+
}
|
|
5949
|
+
function date(str) {
|
|
5950
|
+
const matches = str.match(DATE);
|
|
5951
|
+
if (!matches) return false;
|
|
5952
|
+
const year = +matches[1];
|
|
5953
|
+
const month = +matches[2];
|
|
5954
|
+
const day = +matches[3];
|
|
5955
|
+
return month >= 1 && month <= 12 && day >= 1 && day <= (month == 2 && isLeapYear(year) ? 29 : DAYS[month]);
|
|
5956
|
+
}
|
|
5957
|
+
function time(full, str) {
|
|
5958
|
+
const matches = str.match(TIME);
|
|
5959
|
+
if (!matches) return false;
|
|
5960
|
+
const hour = +matches[1];
|
|
5961
|
+
const minute = +matches[2];
|
|
5962
|
+
const second = +matches[3];
|
|
5963
|
+
const timeZone = !!matches[5];
|
|
5964
|
+
return (hour <= 23 && minute <= 59 && second <= 59 || hour == 23 && minute == 59 && second == 60) && (!full || timeZone);
|
|
5965
|
+
}
|
|
5966
|
+
var DATE_TIME_SEPARATOR = /t|\s/i;
|
|
5967
|
+
function date_time(str) {
|
|
5968
|
+
const dateTime = str.split(DATE_TIME_SEPARATOR);
|
|
5969
|
+
return dateTime.length == 2 && date(dateTime[0]) && time(true, dateTime[1]);
|
|
5970
|
+
}
|
|
5971
|
+
var NOT_URI_FRAGMENT = /\/|:/;
|
|
5972
|
+
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;
|
|
5973
|
+
function uri(str) {
|
|
5974
|
+
return NOT_URI_FRAGMENT.test(str) && URI_PATTERN.test(str);
|
|
5975
|
+
}
|
|
5976
|
+
var Z_ANCHOR = /[^\\]\\Z/;
|
|
5977
|
+
function regex(str) {
|
|
5978
|
+
if (Z_ANCHOR.test(str)) return false;
|
|
5979
|
+
try {
|
|
5980
|
+
new RegExp(str, "u");
|
|
5981
|
+
return true;
|
|
5982
|
+
} catch (e) {
|
|
5983
|
+
return false;
|
|
5984
|
+
}
|
|
5985
|
+
}
|
|
5986
|
+
//#endregion
|
|
5987
|
+
//#region ../../node_modules/.bun/@cfworker+json-schema@4.1.1/node_modules/@cfworker/json-schema/dist/esm/ucs2-length.js
|
|
5988
|
+
function ucs2length(s) {
|
|
5989
|
+
let result = 0;
|
|
5990
|
+
let length = s.length;
|
|
5991
|
+
let index = 0;
|
|
5992
|
+
let charCode;
|
|
5993
|
+
while (index < length) {
|
|
5994
|
+
result++;
|
|
5995
|
+
charCode = s.charCodeAt(index++);
|
|
5996
|
+
if (charCode >= 55296 && charCode <= 56319 && index < length) {
|
|
5997
|
+
charCode = s.charCodeAt(index);
|
|
5998
|
+
if ((charCode & 64512) == 56320) index++;
|
|
5999
|
+
}
|
|
6000
|
+
}
|
|
6001
|
+
return result;
|
|
6002
|
+
}
|
|
6003
|
+
//#endregion
|
|
6004
|
+
//#region ../../node_modules/.bun/@cfworker+json-schema@4.1.1/node_modules/@cfworker/json-schema/dist/esm/validate.js
|
|
6005
|
+
function validate(instance, schema, draft = "2019-09", lookup = dereference(schema), shortCircuit = true, recursiveAnchor = null, instanceLocation = "#", schemaLocation = "#", evaluated = Object.create(null)) {
|
|
6006
|
+
if (schema === true) return {
|
|
6007
|
+
valid: true,
|
|
6008
|
+
errors: []
|
|
6009
|
+
};
|
|
6010
|
+
if (schema === false) return {
|
|
6011
|
+
valid: false,
|
|
6012
|
+
errors: [{
|
|
6013
|
+
instanceLocation,
|
|
6014
|
+
keyword: "false",
|
|
6015
|
+
keywordLocation: instanceLocation,
|
|
6016
|
+
error: "False boolean schema."
|
|
6017
|
+
}]
|
|
6018
|
+
};
|
|
6019
|
+
const rawInstanceType = typeof instance;
|
|
6020
|
+
let instanceType;
|
|
6021
|
+
switch (rawInstanceType) {
|
|
6022
|
+
case "boolean":
|
|
6023
|
+
case "number":
|
|
6024
|
+
case "string":
|
|
6025
|
+
instanceType = rawInstanceType;
|
|
6026
|
+
break;
|
|
6027
|
+
case "object":
|
|
6028
|
+
if (instance === null) instanceType = "null";
|
|
6029
|
+
else if (Array.isArray(instance)) instanceType = "array";
|
|
6030
|
+
else instanceType = "object";
|
|
6031
|
+
break;
|
|
6032
|
+
default: throw new Error(`Instances of "${rawInstanceType}" type are not supported.`);
|
|
6033
|
+
}
|
|
6034
|
+
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;
|
|
6035
|
+
const errors = [];
|
|
6036
|
+
if ($recursiveAnchor === true && recursiveAnchor === null) recursiveAnchor = schema;
|
|
6037
|
+
if ($recursiveRef === "#") {
|
|
6038
|
+
const refSchema = recursiveAnchor === null ? lookup[__absolute_recursive_ref__] : recursiveAnchor;
|
|
6039
|
+
const keywordLocation = `${schemaLocation}/$recursiveRef`;
|
|
6040
|
+
const result = validate(instance, recursiveAnchor === null ? schema : recursiveAnchor, draft, lookup, shortCircuit, refSchema, instanceLocation, keywordLocation, evaluated);
|
|
6041
|
+
if (!result.valid) errors.push({
|
|
6042
|
+
instanceLocation,
|
|
6043
|
+
keyword: "$recursiveRef",
|
|
6044
|
+
keywordLocation,
|
|
6045
|
+
error: "A subschema had errors."
|
|
6046
|
+
}, ...result.errors);
|
|
6047
|
+
}
|
|
6048
|
+
if ($ref !== void 0) {
|
|
6049
|
+
const refSchema = lookup[__absolute_ref__ || $ref];
|
|
6050
|
+
if (refSchema === void 0) {
|
|
6051
|
+
let message = `Unresolved $ref "${$ref}".`;
|
|
6052
|
+
if (__absolute_ref__ && __absolute_ref__ !== $ref) message += ` Absolute URI "${__absolute_ref__}".`;
|
|
6053
|
+
message += `\nKnown schemas:\n- ${Object.keys(lookup).join("\n- ")}`;
|
|
6054
|
+
throw new Error(message);
|
|
6055
|
+
}
|
|
6056
|
+
const keywordLocation = `${schemaLocation}/$ref`;
|
|
6057
|
+
const result = validate(instance, refSchema, draft, lookup, shortCircuit, recursiveAnchor, instanceLocation, keywordLocation, evaluated);
|
|
6058
|
+
if (!result.valid) errors.push({
|
|
6059
|
+
instanceLocation,
|
|
6060
|
+
keyword: "$ref",
|
|
6061
|
+
keywordLocation,
|
|
6062
|
+
error: "A subschema had errors."
|
|
6063
|
+
}, ...result.errors);
|
|
6064
|
+
if (draft === "4" || draft === "7") return {
|
|
6065
|
+
valid: errors.length === 0,
|
|
6066
|
+
errors
|
|
6067
|
+
};
|
|
6068
|
+
}
|
|
6069
|
+
if (Array.isArray($type)) {
|
|
6070
|
+
let length = $type.length;
|
|
6071
|
+
let valid = false;
|
|
6072
|
+
for (let i = 0; i < length; i++) if (instanceType === $type[i] || $type[i] === "integer" && instanceType === "number" && instance % 1 === 0 && instance === instance) {
|
|
6073
|
+
valid = true;
|
|
6074
|
+
break;
|
|
6075
|
+
}
|
|
6076
|
+
if (!valid) errors.push({
|
|
6077
|
+
instanceLocation,
|
|
6078
|
+
keyword: "type",
|
|
6079
|
+
keywordLocation: `${schemaLocation}/type`,
|
|
6080
|
+
error: `Instance type "${instanceType}" is invalid. Expected "${$type.join("\", \"")}".`
|
|
6081
|
+
});
|
|
6082
|
+
} else if ($type === "integer") {
|
|
6083
|
+
if (instanceType !== "number" || instance % 1 || instance !== instance) errors.push({
|
|
6084
|
+
instanceLocation,
|
|
6085
|
+
keyword: "type",
|
|
6086
|
+
keywordLocation: `${schemaLocation}/type`,
|
|
6087
|
+
error: `Instance type "${instanceType}" is invalid. Expected "${$type}".`
|
|
6088
|
+
});
|
|
6089
|
+
} else if ($type !== void 0 && instanceType !== $type) errors.push({
|
|
6090
|
+
instanceLocation,
|
|
6091
|
+
keyword: "type",
|
|
6092
|
+
keywordLocation: `${schemaLocation}/type`,
|
|
6093
|
+
error: `Instance type "${instanceType}" is invalid. Expected "${$type}".`
|
|
6094
|
+
});
|
|
6095
|
+
if ($const !== void 0) {
|
|
6096
|
+
if (instanceType === "object" || instanceType === "array") {
|
|
6097
|
+
if (!deepCompareStrict(instance, $const)) errors.push({
|
|
6098
|
+
instanceLocation,
|
|
6099
|
+
keyword: "const",
|
|
6100
|
+
keywordLocation: `${schemaLocation}/const`,
|
|
6101
|
+
error: `Instance does not match ${JSON.stringify($const)}.`
|
|
6102
|
+
});
|
|
6103
|
+
} else if (instance !== $const) errors.push({
|
|
6104
|
+
instanceLocation,
|
|
6105
|
+
keyword: "const",
|
|
6106
|
+
keywordLocation: `${schemaLocation}/const`,
|
|
6107
|
+
error: `Instance does not match ${JSON.stringify($const)}.`
|
|
6108
|
+
});
|
|
6109
|
+
}
|
|
6110
|
+
if ($enum !== void 0) {
|
|
6111
|
+
if (instanceType === "object" || instanceType === "array") {
|
|
6112
|
+
if (!$enum.some((value) => deepCompareStrict(instance, value))) errors.push({
|
|
6113
|
+
instanceLocation,
|
|
6114
|
+
keyword: "enum",
|
|
6115
|
+
keywordLocation: `${schemaLocation}/enum`,
|
|
6116
|
+
error: `Instance does not match any of ${JSON.stringify($enum)}.`
|
|
6117
|
+
});
|
|
6118
|
+
} else if (!$enum.some((value) => instance === value)) errors.push({
|
|
6119
|
+
instanceLocation,
|
|
6120
|
+
keyword: "enum",
|
|
6121
|
+
keywordLocation: `${schemaLocation}/enum`,
|
|
6122
|
+
error: `Instance does not match any of ${JSON.stringify($enum)}.`
|
|
6123
|
+
});
|
|
6124
|
+
}
|
|
6125
|
+
if ($not !== void 0) {
|
|
6126
|
+
const keywordLocation = `${schemaLocation}/not`;
|
|
6127
|
+
if (validate(instance, $not, draft, lookup, shortCircuit, recursiveAnchor, instanceLocation, keywordLocation).valid) errors.push({
|
|
6128
|
+
instanceLocation,
|
|
6129
|
+
keyword: "not",
|
|
6130
|
+
keywordLocation,
|
|
6131
|
+
error: "Instance matched \"not\" schema."
|
|
6132
|
+
});
|
|
6133
|
+
}
|
|
6134
|
+
let subEvaluateds = [];
|
|
6135
|
+
if ($anyOf !== void 0) {
|
|
6136
|
+
const keywordLocation = `${schemaLocation}/anyOf`;
|
|
6137
|
+
const errorsLength = errors.length;
|
|
6138
|
+
let anyValid = false;
|
|
6139
|
+
for (let i = 0; i < $anyOf.length; i++) {
|
|
6140
|
+
const subSchema = $anyOf[i];
|
|
6141
|
+
const subEvaluated = Object.create(evaluated);
|
|
6142
|
+
const result = validate(instance, subSchema, draft, lookup, shortCircuit, $recursiveAnchor === true ? recursiveAnchor : null, instanceLocation, `${keywordLocation}/${i}`, subEvaluated);
|
|
6143
|
+
errors.push(...result.errors);
|
|
6144
|
+
anyValid = anyValid || result.valid;
|
|
6145
|
+
if (result.valid) subEvaluateds.push(subEvaluated);
|
|
6146
|
+
}
|
|
6147
|
+
if (anyValid) errors.length = errorsLength;
|
|
6148
|
+
else errors.splice(errorsLength, 0, {
|
|
6149
|
+
instanceLocation,
|
|
6150
|
+
keyword: "anyOf",
|
|
6151
|
+
keywordLocation,
|
|
6152
|
+
error: "Instance does not match any subschemas."
|
|
6153
|
+
});
|
|
6154
|
+
}
|
|
6155
|
+
if ($allOf !== void 0) {
|
|
6156
|
+
const keywordLocation = `${schemaLocation}/allOf`;
|
|
6157
|
+
const errorsLength = errors.length;
|
|
6158
|
+
let allValid = true;
|
|
6159
|
+
for (let i = 0; i < $allOf.length; i++) {
|
|
6160
|
+
const subSchema = $allOf[i];
|
|
6161
|
+
const subEvaluated = Object.create(evaluated);
|
|
6162
|
+
const result = validate(instance, subSchema, draft, lookup, shortCircuit, $recursiveAnchor === true ? recursiveAnchor : null, instanceLocation, `${keywordLocation}/${i}`, subEvaluated);
|
|
6163
|
+
errors.push(...result.errors);
|
|
6164
|
+
allValid = allValid && result.valid;
|
|
6165
|
+
if (result.valid) subEvaluateds.push(subEvaluated);
|
|
6166
|
+
}
|
|
6167
|
+
if (allValid) errors.length = errorsLength;
|
|
6168
|
+
else errors.splice(errorsLength, 0, {
|
|
6169
|
+
instanceLocation,
|
|
6170
|
+
keyword: "allOf",
|
|
6171
|
+
keywordLocation,
|
|
6172
|
+
error: `Instance does not match every subschema.`
|
|
6173
|
+
});
|
|
6174
|
+
}
|
|
6175
|
+
if ($oneOf !== void 0) {
|
|
6176
|
+
const keywordLocation = `${schemaLocation}/oneOf`;
|
|
6177
|
+
const errorsLength = errors.length;
|
|
6178
|
+
const matches = $oneOf.filter((subSchema, i) => {
|
|
6179
|
+
const subEvaluated = Object.create(evaluated);
|
|
6180
|
+
const result = validate(instance, subSchema, draft, lookup, shortCircuit, $recursiveAnchor === true ? recursiveAnchor : null, instanceLocation, `${keywordLocation}/${i}`, subEvaluated);
|
|
6181
|
+
errors.push(...result.errors);
|
|
6182
|
+
if (result.valid) subEvaluateds.push(subEvaluated);
|
|
6183
|
+
return result.valid;
|
|
6184
|
+
}).length;
|
|
6185
|
+
if (matches === 1) errors.length = errorsLength;
|
|
6186
|
+
else errors.splice(errorsLength, 0, {
|
|
6187
|
+
instanceLocation,
|
|
6188
|
+
keyword: "oneOf",
|
|
6189
|
+
keywordLocation,
|
|
6190
|
+
error: `Instance does not match exactly one subschema (${matches} matches).`
|
|
6191
|
+
});
|
|
6192
|
+
}
|
|
6193
|
+
if (instanceType === "object" || instanceType === "array") Object.assign(evaluated, ...subEvaluateds);
|
|
6194
|
+
if ($if !== void 0) {
|
|
6195
|
+
const keywordLocation = `${schemaLocation}/if`;
|
|
6196
|
+
if (validate(instance, $if, draft, lookup, shortCircuit, recursiveAnchor, instanceLocation, keywordLocation, evaluated).valid) {
|
|
6197
|
+
if ($then !== void 0) {
|
|
6198
|
+
const thenResult = validate(instance, $then, draft, lookup, shortCircuit, recursiveAnchor, instanceLocation, `${schemaLocation}/then`, evaluated);
|
|
6199
|
+
if (!thenResult.valid) errors.push({
|
|
6200
|
+
instanceLocation,
|
|
6201
|
+
keyword: "if",
|
|
6202
|
+
keywordLocation,
|
|
6203
|
+
error: `Instance does not match "then" schema.`
|
|
6204
|
+
}, ...thenResult.errors);
|
|
6205
|
+
}
|
|
6206
|
+
} else if ($else !== void 0) {
|
|
6207
|
+
const elseResult = validate(instance, $else, draft, lookup, shortCircuit, recursiveAnchor, instanceLocation, `${schemaLocation}/else`, evaluated);
|
|
6208
|
+
if (!elseResult.valid) errors.push({
|
|
6209
|
+
instanceLocation,
|
|
6210
|
+
keyword: "if",
|
|
6211
|
+
keywordLocation,
|
|
6212
|
+
error: `Instance does not match "else" schema.`
|
|
6213
|
+
}, ...elseResult.errors);
|
|
6214
|
+
}
|
|
6215
|
+
}
|
|
6216
|
+
if (instanceType === "object") {
|
|
6217
|
+
if ($required !== void 0) {
|
|
6218
|
+
for (const key of $required) if (!(key in instance)) errors.push({
|
|
6219
|
+
instanceLocation,
|
|
6220
|
+
keyword: "required",
|
|
6221
|
+
keywordLocation: `${schemaLocation}/required`,
|
|
6222
|
+
error: `Instance does not have required property "${key}".`
|
|
6223
|
+
});
|
|
6224
|
+
}
|
|
6225
|
+
const keys = Object.keys(instance);
|
|
6226
|
+
if ($minProperties !== void 0 && keys.length < $minProperties) errors.push({
|
|
6227
|
+
instanceLocation,
|
|
6228
|
+
keyword: "minProperties",
|
|
6229
|
+
keywordLocation: `${schemaLocation}/minProperties`,
|
|
6230
|
+
error: `Instance does not have at least ${$minProperties} properties.`
|
|
6231
|
+
});
|
|
6232
|
+
if ($maxProperties !== void 0 && keys.length > $maxProperties) errors.push({
|
|
6233
|
+
instanceLocation,
|
|
6234
|
+
keyword: "maxProperties",
|
|
6235
|
+
keywordLocation: `${schemaLocation}/maxProperties`,
|
|
6236
|
+
error: `Instance does not have at least ${$maxProperties} properties.`
|
|
6237
|
+
});
|
|
6238
|
+
if ($propertyNames !== void 0) {
|
|
6239
|
+
const keywordLocation = `${schemaLocation}/propertyNames`;
|
|
6240
|
+
for (const key in instance) {
|
|
6241
|
+
const subInstancePointer = `${instanceLocation}/${encodePointer(key)}`;
|
|
6242
|
+
const result = validate(key, $propertyNames, draft, lookup, shortCircuit, recursiveAnchor, subInstancePointer, keywordLocation);
|
|
6243
|
+
if (!result.valid) errors.push({
|
|
6244
|
+
instanceLocation,
|
|
6245
|
+
keyword: "propertyNames",
|
|
6246
|
+
keywordLocation,
|
|
6247
|
+
error: `Property name "${key}" does not match schema.`
|
|
6248
|
+
}, ...result.errors);
|
|
6249
|
+
}
|
|
6250
|
+
}
|
|
6251
|
+
if ($dependentRequired !== void 0) {
|
|
6252
|
+
const keywordLocation = `${schemaLocation}/dependantRequired`;
|
|
6253
|
+
for (const key in $dependentRequired) if (key in instance) {
|
|
6254
|
+
const required = $dependentRequired[key];
|
|
6255
|
+
for (const dependantKey of required) if (!(dependantKey in instance)) errors.push({
|
|
6256
|
+
instanceLocation,
|
|
6257
|
+
keyword: "dependentRequired",
|
|
6258
|
+
keywordLocation,
|
|
6259
|
+
error: `Instance has "${key}" but does not have "${dependantKey}".`
|
|
6260
|
+
});
|
|
6261
|
+
}
|
|
6262
|
+
}
|
|
6263
|
+
if ($dependentSchemas !== void 0) for (const key in $dependentSchemas) {
|
|
6264
|
+
const keywordLocation = `${schemaLocation}/dependentSchemas`;
|
|
6265
|
+
if (key in instance) {
|
|
6266
|
+
const result = validate(instance, $dependentSchemas[key], draft, lookup, shortCircuit, recursiveAnchor, instanceLocation, `${keywordLocation}/${encodePointer(key)}`, evaluated);
|
|
6267
|
+
if (!result.valid) errors.push({
|
|
6268
|
+
instanceLocation,
|
|
6269
|
+
keyword: "dependentSchemas",
|
|
6270
|
+
keywordLocation,
|
|
6271
|
+
error: `Instance has "${key}" but does not match dependant schema.`
|
|
6272
|
+
}, ...result.errors);
|
|
6273
|
+
}
|
|
6274
|
+
}
|
|
6275
|
+
if ($dependencies !== void 0) {
|
|
6276
|
+
const keywordLocation = `${schemaLocation}/dependencies`;
|
|
6277
|
+
for (const key in $dependencies) if (key in instance) {
|
|
6278
|
+
const propsOrSchema = $dependencies[key];
|
|
6279
|
+
if (Array.isArray(propsOrSchema)) {
|
|
6280
|
+
for (const dependantKey of propsOrSchema) if (!(dependantKey in instance)) errors.push({
|
|
6281
|
+
instanceLocation,
|
|
6282
|
+
keyword: "dependencies",
|
|
6283
|
+
keywordLocation,
|
|
6284
|
+
error: `Instance has "${key}" but does not have "${dependantKey}".`
|
|
6285
|
+
});
|
|
6286
|
+
} else {
|
|
6287
|
+
const result = validate(instance, propsOrSchema, draft, lookup, shortCircuit, recursiveAnchor, instanceLocation, `${keywordLocation}/${encodePointer(key)}`);
|
|
6288
|
+
if (!result.valid) errors.push({
|
|
6289
|
+
instanceLocation,
|
|
6290
|
+
keyword: "dependencies",
|
|
6291
|
+
keywordLocation,
|
|
6292
|
+
error: `Instance has "${key}" but does not match dependant schema.`
|
|
6293
|
+
}, ...result.errors);
|
|
6294
|
+
}
|
|
6295
|
+
}
|
|
6296
|
+
}
|
|
6297
|
+
const thisEvaluated = Object.create(null);
|
|
6298
|
+
let stop = false;
|
|
6299
|
+
if ($properties !== void 0) {
|
|
6300
|
+
const keywordLocation = `${schemaLocation}/properties`;
|
|
6301
|
+
for (const key in $properties) {
|
|
6302
|
+
if (!(key in instance)) continue;
|
|
6303
|
+
const subInstancePointer = `${instanceLocation}/${encodePointer(key)}`;
|
|
6304
|
+
const result = validate(instance[key], $properties[key], draft, lookup, shortCircuit, recursiveAnchor, subInstancePointer, `${keywordLocation}/${encodePointer(key)}`);
|
|
6305
|
+
if (result.valid) evaluated[key] = thisEvaluated[key] = true;
|
|
6306
|
+
else {
|
|
6307
|
+
stop = shortCircuit;
|
|
6308
|
+
errors.push({
|
|
6309
|
+
instanceLocation,
|
|
6310
|
+
keyword: "properties",
|
|
6311
|
+
keywordLocation,
|
|
6312
|
+
error: `Property "${key}" does not match schema.`
|
|
6313
|
+
}, ...result.errors);
|
|
6314
|
+
if (stop) break;
|
|
6315
|
+
}
|
|
6316
|
+
}
|
|
6317
|
+
}
|
|
6318
|
+
if (!stop && $patternProperties !== void 0) {
|
|
6319
|
+
const keywordLocation = `${schemaLocation}/patternProperties`;
|
|
6320
|
+
for (const pattern in $patternProperties) {
|
|
6321
|
+
const regex = new RegExp(pattern, "u");
|
|
6322
|
+
const subSchema = $patternProperties[pattern];
|
|
6323
|
+
for (const key in instance) {
|
|
6324
|
+
if (!regex.test(key)) continue;
|
|
6325
|
+
const subInstancePointer = `${instanceLocation}/${encodePointer(key)}`;
|
|
6326
|
+
const result = validate(instance[key], subSchema, draft, lookup, shortCircuit, recursiveAnchor, subInstancePointer, `${keywordLocation}/${encodePointer(pattern)}`);
|
|
6327
|
+
if (result.valid) evaluated[key] = thisEvaluated[key] = true;
|
|
6328
|
+
else {
|
|
6329
|
+
stop = shortCircuit;
|
|
6330
|
+
errors.push({
|
|
6331
|
+
instanceLocation,
|
|
6332
|
+
keyword: "patternProperties",
|
|
6333
|
+
keywordLocation,
|
|
6334
|
+
error: `Property "${key}" matches pattern "${pattern}" but does not match associated schema.`
|
|
6335
|
+
}, ...result.errors);
|
|
6336
|
+
}
|
|
6337
|
+
}
|
|
6338
|
+
}
|
|
6339
|
+
}
|
|
6340
|
+
if (!stop && $additionalProperties !== void 0) {
|
|
6341
|
+
const keywordLocation = `${schemaLocation}/additionalProperties`;
|
|
6342
|
+
for (const key in instance) {
|
|
6343
|
+
if (thisEvaluated[key]) continue;
|
|
6344
|
+
const subInstancePointer = `${instanceLocation}/${encodePointer(key)}`;
|
|
6345
|
+
const result = validate(instance[key], $additionalProperties, draft, lookup, shortCircuit, recursiveAnchor, subInstancePointer, keywordLocation);
|
|
6346
|
+
if (result.valid) evaluated[key] = true;
|
|
6347
|
+
else {
|
|
6348
|
+
stop = shortCircuit;
|
|
6349
|
+
errors.push({
|
|
6350
|
+
instanceLocation,
|
|
6351
|
+
keyword: "additionalProperties",
|
|
6352
|
+
keywordLocation,
|
|
6353
|
+
error: `Property "${key}" does not match additional properties schema.`
|
|
6354
|
+
}, ...result.errors);
|
|
6355
|
+
}
|
|
6356
|
+
}
|
|
6357
|
+
} else if (!stop && $unevaluatedProperties !== void 0) {
|
|
6358
|
+
const keywordLocation = `${schemaLocation}/unevaluatedProperties`;
|
|
6359
|
+
for (const key in instance) if (!evaluated[key]) {
|
|
6360
|
+
const subInstancePointer = `${instanceLocation}/${encodePointer(key)}`;
|
|
6361
|
+
const result = validate(instance[key], $unevaluatedProperties, draft, lookup, shortCircuit, recursiveAnchor, subInstancePointer, keywordLocation);
|
|
6362
|
+
if (result.valid) evaluated[key] = true;
|
|
6363
|
+
else errors.push({
|
|
6364
|
+
instanceLocation,
|
|
6365
|
+
keyword: "unevaluatedProperties",
|
|
6366
|
+
keywordLocation,
|
|
6367
|
+
error: `Property "${key}" does not match unevaluated properties schema.`
|
|
6368
|
+
}, ...result.errors);
|
|
6369
|
+
}
|
|
6370
|
+
}
|
|
6371
|
+
} else if (instanceType === "array") {
|
|
6372
|
+
if ($maxItems !== void 0 && instance.length > $maxItems) errors.push({
|
|
6373
|
+
instanceLocation,
|
|
6374
|
+
keyword: "maxItems",
|
|
6375
|
+
keywordLocation: `${schemaLocation}/maxItems`,
|
|
6376
|
+
error: `Array has too many items (${instance.length} > ${$maxItems}).`
|
|
6377
|
+
});
|
|
6378
|
+
if ($minItems !== void 0 && instance.length < $minItems) errors.push({
|
|
6379
|
+
instanceLocation,
|
|
6380
|
+
keyword: "minItems",
|
|
6381
|
+
keywordLocation: `${schemaLocation}/minItems`,
|
|
6382
|
+
error: `Array has too few items (${instance.length} < ${$minItems}).`
|
|
6383
|
+
});
|
|
6384
|
+
const length = instance.length;
|
|
6385
|
+
let i = 0;
|
|
6386
|
+
let stop = false;
|
|
6387
|
+
if ($prefixItems !== void 0) {
|
|
6388
|
+
const keywordLocation = `${schemaLocation}/prefixItems`;
|
|
6389
|
+
const length2 = Math.min($prefixItems.length, length);
|
|
6390
|
+
for (; i < length2; i++) {
|
|
6391
|
+
const result = validate(instance[i], $prefixItems[i], draft, lookup, shortCircuit, recursiveAnchor, `${instanceLocation}/${i}`, `${keywordLocation}/${i}`);
|
|
6392
|
+
evaluated[i] = true;
|
|
6393
|
+
if (!result.valid) {
|
|
6394
|
+
stop = shortCircuit;
|
|
6395
|
+
errors.push({
|
|
6396
|
+
instanceLocation,
|
|
6397
|
+
keyword: "prefixItems",
|
|
6398
|
+
keywordLocation,
|
|
6399
|
+
error: `Items did not match schema.`
|
|
6400
|
+
}, ...result.errors);
|
|
6401
|
+
if (stop) break;
|
|
6402
|
+
}
|
|
6403
|
+
}
|
|
6404
|
+
}
|
|
6405
|
+
if ($items !== void 0) {
|
|
6406
|
+
const keywordLocation = `${schemaLocation}/items`;
|
|
6407
|
+
if (Array.isArray($items)) {
|
|
6408
|
+
const length2 = Math.min($items.length, length);
|
|
6409
|
+
for (; i < length2; i++) {
|
|
6410
|
+
const result = validate(instance[i], $items[i], draft, lookup, shortCircuit, recursiveAnchor, `${instanceLocation}/${i}`, `${keywordLocation}/${i}`);
|
|
6411
|
+
evaluated[i] = true;
|
|
6412
|
+
if (!result.valid) {
|
|
6413
|
+
stop = shortCircuit;
|
|
6414
|
+
errors.push({
|
|
6415
|
+
instanceLocation,
|
|
6416
|
+
keyword: "items",
|
|
6417
|
+
keywordLocation,
|
|
6418
|
+
error: `Items did not match schema.`
|
|
6419
|
+
}, ...result.errors);
|
|
6420
|
+
if (stop) break;
|
|
6421
|
+
}
|
|
6422
|
+
}
|
|
6423
|
+
} else for (; i < length; i++) {
|
|
6424
|
+
const result = validate(instance[i], $items, draft, lookup, shortCircuit, recursiveAnchor, `${instanceLocation}/${i}`, keywordLocation);
|
|
6425
|
+
evaluated[i] = true;
|
|
6426
|
+
if (!result.valid) {
|
|
6427
|
+
stop = shortCircuit;
|
|
6428
|
+
errors.push({
|
|
6429
|
+
instanceLocation,
|
|
6430
|
+
keyword: "items",
|
|
6431
|
+
keywordLocation,
|
|
6432
|
+
error: `Items did not match schema.`
|
|
6433
|
+
}, ...result.errors);
|
|
6434
|
+
if (stop) break;
|
|
6435
|
+
}
|
|
6436
|
+
}
|
|
6437
|
+
if (!stop && $additionalItems !== void 0) {
|
|
6438
|
+
const keywordLocation = `${schemaLocation}/additionalItems`;
|
|
6439
|
+
for (; i < length; i++) {
|
|
6440
|
+
const result = validate(instance[i], $additionalItems, draft, lookup, shortCircuit, recursiveAnchor, `${instanceLocation}/${i}`, keywordLocation);
|
|
6441
|
+
evaluated[i] = true;
|
|
6442
|
+
if (!result.valid) {
|
|
6443
|
+
stop = shortCircuit;
|
|
6444
|
+
errors.push({
|
|
6445
|
+
instanceLocation,
|
|
6446
|
+
keyword: "additionalItems",
|
|
6447
|
+
keywordLocation,
|
|
6448
|
+
error: `Items did not match additional items schema.`
|
|
6449
|
+
}, ...result.errors);
|
|
6450
|
+
}
|
|
6451
|
+
}
|
|
6452
|
+
}
|
|
6453
|
+
}
|
|
6454
|
+
if ($contains !== void 0) {
|
|
6455
|
+
if (length === 0 && $minContains === void 0) errors.push({
|
|
6456
|
+
instanceLocation,
|
|
6457
|
+
keyword: "contains",
|
|
6458
|
+
keywordLocation: `${schemaLocation}/contains`,
|
|
6459
|
+
error: `Array is empty. It must contain at least one item matching the schema.`
|
|
6460
|
+
});
|
|
6461
|
+
else if ($minContains !== void 0 && length < $minContains) errors.push({
|
|
6462
|
+
instanceLocation,
|
|
6463
|
+
keyword: "minContains",
|
|
6464
|
+
keywordLocation: `${schemaLocation}/minContains`,
|
|
6465
|
+
error: `Array has less items (${length}) than minContains (${$minContains}).`
|
|
6466
|
+
});
|
|
6467
|
+
else {
|
|
6468
|
+
const keywordLocation = `${schemaLocation}/contains`;
|
|
6469
|
+
const errorsLength = errors.length;
|
|
6470
|
+
let contained = 0;
|
|
6471
|
+
for (let j = 0; j < length; j++) {
|
|
6472
|
+
const result = validate(instance[j], $contains, draft, lookup, shortCircuit, recursiveAnchor, `${instanceLocation}/${j}`, keywordLocation);
|
|
6473
|
+
if (result.valid) {
|
|
6474
|
+
evaluated[j] = true;
|
|
6475
|
+
contained++;
|
|
6476
|
+
} else errors.push(...result.errors);
|
|
6477
|
+
}
|
|
6478
|
+
if (contained >= ($minContains || 0)) errors.length = errorsLength;
|
|
6479
|
+
if ($minContains === void 0 && $maxContains === void 0 && contained === 0) errors.splice(errorsLength, 0, {
|
|
6480
|
+
instanceLocation,
|
|
6481
|
+
keyword: "contains",
|
|
6482
|
+
keywordLocation,
|
|
6483
|
+
error: `Array does not contain item matching schema.`
|
|
6484
|
+
});
|
|
6485
|
+
else if ($minContains !== void 0 && contained < $minContains) errors.push({
|
|
6486
|
+
instanceLocation,
|
|
6487
|
+
keyword: "minContains",
|
|
6488
|
+
keywordLocation: `${schemaLocation}/minContains`,
|
|
6489
|
+
error: `Array must contain at least ${$minContains} items matching schema. Only ${contained} items were found.`
|
|
6490
|
+
});
|
|
6491
|
+
else if ($maxContains !== void 0 && contained > $maxContains) errors.push({
|
|
6492
|
+
instanceLocation,
|
|
6493
|
+
keyword: "maxContains",
|
|
6494
|
+
keywordLocation: `${schemaLocation}/maxContains`,
|
|
6495
|
+
error: `Array may contain at most ${$maxContains} items matching schema. ${contained} items were found.`
|
|
6496
|
+
});
|
|
6497
|
+
}
|
|
6498
|
+
}
|
|
6499
|
+
if (!stop && $unevaluatedItems !== void 0) {
|
|
6500
|
+
const keywordLocation = `${schemaLocation}/unevaluatedItems`;
|
|
6501
|
+
for (; i < length; i++) {
|
|
6502
|
+
if (evaluated[i]) continue;
|
|
6503
|
+
const result = validate(instance[i], $unevaluatedItems, draft, lookup, shortCircuit, recursiveAnchor, `${instanceLocation}/${i}`, keywordLocation);
|
|
6504
|
+
evaluated[i] = true;
|
|
6505
|
+
if (!result.valid) errors.push({
|
|
6506
|
+
instanceLocation,
|
|
6507
|
+
keyword: "unevaluatedItems",
|
|
6508
|
+
keywordLocation,
|
|
6509
|
+
error: `Items did not match unevaluated items schema.`
|
|
6510
|
+
}, ...result.errors);
|
|
6511
|
+
}
|
|
6512
|
+
}
|
|
6513
|
+
if ($uniqueItems) for (let j = 0; j < length; j++) {
|
|
6514
|
+
const a = instance[j];
|
|
6515
|
+
const ao = typeof a === "object" && a !== null;
|
|
6516
|
+
for (let k = 0; k < length; k++) {
|
|
6517
|
+
if (j === k) continue;
|
|
6518
|
+
const b = instance[k];
|
|
6519
|
+
if (a === b || ao && typeof b === "object" && b !== null && deepCompareStrict(a, b)) {
|
|
6520
|
+
errors.push({
|
|
6521
|
+
instanceLocation,
|
|
6522
|
+
keyword: "uniqueItems",
|
|
6523
|
+
keywordLocation: `${schemaLocation}/uniqueItems`,
|
|
6524
|
+
error: `Duplicate items at indexes ${j} and ${k}.`
|
|
6525
|
+
});
|
|
6526
|
+
j = Number.MAX_SAFE_INTEGER;
|
|
6527
|
+
k = Number.MAX_SAFE_INTEGER;
|
|
6528
|
+
}
|
|
6529
|
+
}
|
|
6530
|
+
}
|
|
6531
|
+
} else if (instanceType === "number") {
|
|
6532
|
+
if (draft === "4") {
|
|
6533
|
+
if ($minimum !== void 0 && ($exclusiveMinimum === true && instance <= $minimum || instance < $minimum)) errors.push({
|
|
6534
|
+
instanceLocation,
|
|
6535
|
+
keyword: "minimum",
|
|
6536
|
+
keywordLocation: `${schemaLocation}/minimum`,
|
|
6537
|
+
error: `${instance} is less than ${$exclusiveMinimum ? "or equal to " : ""} ${$minimum}.`
|
|
6538
|
+
});
|
|
6539
|
+
if ($maximum !== void 0 && ($exclusiveMaximum === true && instance >= $maximum || instance > $maximum)) errors.push({
|
|
6540
|
+
instanceLocation,
|
|
6541
|
+
keyword: "maximum",
|
|
6542
|
+
keywordLocation: `${schemaLocation}/maximum`,
|
|
6543
|
+
error: `${instance} is greater than ${$exclusiveMaximum ? "or equal to " : ""} ${$maximum}.`
|
|
6544
|
+
});
|
|
6545
|
+
} else {
|
|
6546
|
+
if ($minimum !== void 0 && instance < $minimum) errors.push({
|
|
6547
|
+
instanceLocation,
|
|
6548
|
+
keyword: "minimum",
|
|
6549
|
+
keywordLocation: `${schemaLocation}/minimum`,
|
|
6550
|
+
error: `${instance} is less than ${$minimum}.`
|
|
6551
|
+
});
|
|
6552
|
+
if ($maximum !== void 0 && instance > $maximum) errors.push({
|
|
6553
|
+
instanceLocation,
|
|
6554
|
+
keyword: "maximum",
|
|
6555
|
+
keywordLocation: `${schemaLocation}/maximum`,
|
|
6556
|
+
error: `${instance} is greater than ${$maximum}.`
|
|
6557
|
+
});
|
|
6558
|
+
if ($exclusiveMinimum !== void 0 && instance <= $exclusiveMinimum) errors.push({
|
|
6559
|
+
instanceLocation,
|
|
6560
|
+
keyword: "exclusiveMinimum",
|
|
6561
|
+
keywordLocation: `${schemaLocation}/exclusiveMinimum`,
|
|
6562
|
+
error: `${instance} is less than ${$exclusiveMinimum}.`
|
|
6563
|
+
});
|
|
6564
|
+
if ($exclusiveMaximum !== void 0 && instance >= $exclusiveMaximum) errors.push({
|
|
6565
|
+
instanceLocation,
|
|
6566
|
+
keyword: "exclusiveMaximum",
|
|
6567
|
+
keywordLocation: `${schemaLocation}/exclusiveMaximum`,
|
|
6568
|
+
error: `${instance} is greater than or equal to ${$exclusiveMaximum}.`
|
|
6569
|
+
});
|
|
6570
|
+
}
|
|
6571
|
+
if ($multipleOf !== void 0) {
|
|
6572
|
+
const remainder = instance % $multipleOf;
|
|
6573
|
+
if (Math.abs(0 - remainder) >= 1.1920929e-7 && Math.abs($multipleOf - remainder) >= 1.1920929e-7) errors.push({
|
|
6574
|
+
instanceLocation,
|
|
6575
|
+
keyword: "multipleOf",
|
|
6576
|
+
keywordLocation: `${schemaLocation}/multipleOf`,
|
|
6577
|
+
error: `${instance} is not a multiple of ${$multipleOf}.`
|
|
6578
|
+
});
|
|
6579
|
+
}
|
|
6580
|
+
} else if (instanceType === "string") {
|
|
6581
|
+
const length = $minLength === void 0 && $maxLength === void 0 ? 0 : ucs2length(instance);
|
|
6582
|
+
if ($minLength !== void 0 && length < $minLength) errors.push({
|
|
6583
|
+
instanceLocation,
|
|
6584
|
+
keyword: "minLength",
|
|
6585
|
+
keywordLocation: `${schemaLocation}/minLength`,
|
|
6586
|
+
error: `String is too short (${length} < ${$minLength}).`
|
|
6587
|
+
});
|
|
6588
|
+
if ($maxLength !== void 0 && length > $maxLength) errors.push({
|
|
6589
|
+
instanceLocation,
|
|
6590
|
+
keyword: "maxLength",
|
|
6591
|
+
keywordLocation: `${schemaLocation}/maxLength`,
|
|
6592
|
+
error: `String is too long (${length} > ${$maxLength}).`
|
|
6593
|
+
});
|
|
6594
|
+
if ($pattern !== void 0 && !new RegExp($pattern, "u").test(instance)) errors.push({
|
|
6595
|
+
instanceLocation,
|
|
6596
|
+
keyword: "pattern",
|
|
6597
|
+
keywordLocation: `${schemaLocation}/pattern`,
|
|
6598
|
+
error: `String does not match pattern.`
|
|
6599
|
+
});
|
|
6600
|
+
if ($format !== void 0 && format[$format] && !format[$format](instance)) errors.push({
|
|
6601
|
+
instanceLocation,
|
|
6602
|
+
keyword: "format",
|
|
6603
|
+
keywordLocation: `${schemaLocation}/format`,
|
|
6604
|
+
error: `String does not match format "${$format}".`
|
|
6605
|
+
});
|
|
6606
|
+
}
|
|
6607
|
+
return {
|
|
6608
|
+
valid: errors.length === 0,
|
|
6609
|
+
errors
|
|
6610
|
+
};
|
|
6611
|
+
}
|
|
6612
|
+
//#endregion
|
|
6613
|
+
//#region ../../node_modules/.bun/@cfworker+json-schema@4.1.1/node_modules/@cfworker/json-schema/dist/esm/validator.js
|
|
6614
|
+
var Validator = class {
|
|
6615
|
+
schema;
|
|
6616
|
+
draft;
|
|
6617
|
+
shortCircuit;
|
|
6618
|
+
lookup;
|
|
6619
|
+
constructor(schema, draft = "2019-09", shortCircuit = true) {
|
|
6620
|
+
this.schema = schema;
|
|
6621
|
+
this.draft = draft;
|
|
6622
|
+
this.shortCircuit = shortCircuit;
|
|
6623
|
+
this.lookup = dereference(schema);
|
|
6624
|
+
}
|
|
6625
|
+
validate(instance) {
|
|
6626
|
+
return validate(instance, this.schema, this.draft, this.lookup, this.shortCircuit);
|
|
6627
|
+
}
|
|
6628
|
+
addSchema(schema, id) {
|
|
6629
|
+
if (id) schema = {
|
|
6630
|
+
...schema,
|
|
6631
|
+
$id: id
|
|
6632
|
+
};
|
|
6633
|
+
dereference(schema, this.lookup);
|
|
6634
|
+
}
|
|
6635
|
+
};
|
|
6636
|
+
//#endregion
|
|
5757
6637
|
//#region src/json-schema-subset/utils.ts
|
|
5758
6638
|
var nextId = 0;
|
|
5759
6639
|
function createId() {
|
|
@@ -7707,6 +8587,7 @@ function schemaEqualsChecker(extendsContext) {
|
|
|
7707
8587
|
if (value1 === null || value2 === null) return false;
|
|
7708
8588
|
if (typeof value1 !== "object") return false;
|
|
7709
8589
|
if (typeof value1 !== typeof value2) return false;
|
|
8590
|
+
if (extendsContext.isExtendsSchema(value1) || extendsContext.isExtendsSchema(value2)) return extendsContext.equals(value1, value2);
|
|
7710
8591
|
if (isCompiledSchema(value1) && isCompiledSchema(value2)) return isCompiledSchemaEquals(value1, value2);
|
|
7711
8592
|
return isObjectLikeEquals(value1, value2);
|
|
7712
8593
|
}
|
|
@@ -8436,10 +9317,17 @@ var SingleSelectSchema = class SingleSelectSchema extends SpecialSchema {
|
|
|
8436
9317
|
}
|
|
8437
9318
|
constructor(id, value, context) {
|
|
8438
9319
|
if (!SingleSelectSchema.isMatch(value)) throw new TypeError("Invalid single-select schema.");
|
|
8439
|
-
|
|
9320
|
+
const validator = new Validator(structuredClone(value), "7");
|
|
9321
|
+
super(id, { enum: value.enum.filter((item) => validator.validate(item).valid) }, context);
|
|
8440
9322
|
}
|
|
8441
9323
|
compareImpl(other) {
|
|
8442
|
-
if (
|
|
9324
|
+
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];
|
|
9325
|
+
if (isStringLikeSchema(other)) {
|
|
9326
|
+
const validator = new Validator(structuredClone(other), "7");
|
|
9327
|
+
const accepted = this.value.enum.filter((item) => validator.validate(item).valid).length;
|
|
9328
|
+
if (accepted == this.value.enum.length) return [ExpressionSingleResult.ContainedBy];
|
|
9329
|
+
return [accepted == 0 ? ExpressionSingleResult.Rejection : ExpressionSingleResult.Intersection];
|
|
9330
|
+
}
|
|
8443
9331
|
if (other instanceof SingleSelectSchema) {
|
|
8444
9332
|
const f = new Set(this.value.enum);
|
|
8445
9333
|
let result = ExpressionSingleResult.Equals;
|