@recursica/adapter-tester 2.1.0 → 2.2.0
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/README.md +12 -0
- package/dist/cli.cjs +2 -2
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.js +266 -259
- package/dist/cli.js.map +1 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -135,7 +135,7 @@ function Un(e, t, m = {}) {
|
|
|
135
135
|
function Ln(e) {
|
|
136
136
|
return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
|
|
137
137
|
}
|
|
138
|
-
var Te = { exports: {} }, Pt = {}, me = {}, $e = {},
|
|
138
|
+
var Te = { exports: {} }, Pt = {}, me = {}, $e = {}, Nt = {}, kt = {}, Rt = {}, Xt;
|
|
139
139
|
function yt() {
|
|
140
140
|
return Xt || (Xt = 1, (function(e) {
|
|
141
141
|
Object.defineProperty(e, "__esModule", { value: !0 }), e.regexpCode = e.getEsmExportName = e.getProperty = e.safeStringify = e.stringify = e.strConcat = e.addCodeArg = e.str = e._ = e.nil = e._Code = e.Name = e.IDENTIFIER = e._CodeOrName = void 0;
|
|
@@ -925,23 +925,23 @@ function H() {
|
|
|
925
925
|
return typeof O == "boolean" || typeof O == "number" || O === null ? !O : (0, t._)`!${C(O)}`;
|
|
926
926
|
}
|
|
927
927
|
e.not = fe;
|
|
928
|
-
const he =
|
|
928
|
+
const he = k(e.operators.AND);
|
|
929
929
|
function X(...O) {
|
|
930
930
|
return O.reduce(he);
|
|
931
931
|
}
|
|
932
932
|
e.and = X;
|
|
933
|
-
const ge =
|
|
933
|
+
const ge = k(e.operators.OR);
|
|
934
934
|
function A(...O) {
|
|
935
935
|
return O.reduce(ge);
|
|
936
936
|
}
|
|
937
937
|
e.or = A;
|
|
938
|
-
function
|
|
938
|
+
function k(O) {
|
|
939
939
|
return (d, E) => d === t.nil ? E : E === t.nil ? d : (0, t._)`${C(d)} ${O} ${C(E)}`;
|
|
940
940
|
}
|
|
941
941
|
function C(O) {
|
|
942
942
|
return O instanceof t.Name ? O : (0, t._)`(${O})`;
|
|
943
943
|
}
|
|
944
|
-
})(
|
|
944
|
+
})(kt)), kt;
|
|
945
945
|
}
|
|
946
946
|
var G = {}, rr;
|
|
947
947
|
function Y() {
|
|
@@ -1193,7 +1193,7 @@ function vt() {
|
|
|
1193
1193
|
const { keyword: p, data: n, schemaValue: f, it: S } = a, { opts: T, propertyName: j, topSchemaRef: D, schemaPath: z } = S;
|
|
1194
1194
|
o.push([v.keyword, p], [v.params, typeof i == "function" ? i(a) : i || (0, t._)`{}`]), T.messages && o.push([v.message, typeof r == "function" ? r(a) : r]), T.verbose && o.push([v.schema, f], [v.parentSchema, (0, t._)`${D}${z}`], [c.default.data, n]), j && o.push([v.propertyName, j]);
|
|
1195
1195
|
}
|
|
1196
|
-
})(
|
|
1196
|
+
})(Nt)), Nt;
|
|
1197
1197
|
}
|
|
1198
1198
|
var ar;
|
|
1199
1199
|
function Kn() {
|
|
@@ -1420,10 +1420,10 @@ function gt() {
|
|
|
1420
1420
|
}
|
|
1421
1421
|
return re;
|
|
1422
1422
|
}
|
|
1423
|
-
var
|
|
1423
|
+
var ke = {}, cr;
|
|
1424
1424
|
function Gn() {
|
|
1425
|
-
if (cr) return
|
|
1426
|
-
cr = 1, Object.defineProperty(
|
|
1425
|
+
if (cr) return ke;
|
|
1426
|
+
cr = 1, Object.defineProperty(ke, "__esModule", { value: !0 }), ke.assignDefaults = void 0;
|
|
1427
1427
|
const e = /* @__PURE__ */ H(), t = /* @__PURE__ */ Y();
|
|
1428
1428
|
function m(b, s) {
|
|
1429
1429
|
const { properties: l, items: u } = b.schema;
|
|
@@ -1432,7 +1432,7 @@ function Gn() {
|
|
|
1432
1432
|
c(b, h, l[h].default);
|
|
1433
1433
|
else s === "array" && Array.isArray(u) && u.forEach((h, $) => c(b, $, h.default));
|
|
1434
1434
|
}
|
|
1435
|
-
|
|
1435
|
+
ke.assignDefaults = m;
|
|
1436
1436
|
function c(b, s, l) {
|
|
1437
1437
|
const { gen: u, compositeRule: h, data: $, opts: v } = b;
|
|
1438
1438
|
if (l === void 0)
|
|
@@ -1445,7 +1445,7 @@ function Gn() {
|
|
|
1445
1445
|
let _ = (0, e._)`${P} === undefined`;
|
|
1446
1446
|
v.useDefaults === "empty" && (_ = (0, e._)`${_} || ${P} === null || ${P} === ""`), u.if(_, (0, e._)`${P} = ${(0, e.stringify)(l)}`);
|
|
1447
1447
|
}
|
|
1448
|
-
return
|
|
1448
|
+
return ke;
|
|
1449
1449
|
}
|
|
1450
1450
|
var ce = {}, Q = {}, dr;
|
|
1451
1451
|
function le() {
|
|
@@ -1918,172 +1918,172 @@ function $t() {
|
|
|
1918
1918
|
if (yr) return me;
|
|
1919
1919
|
yr = 1, Object.defineProperty(me, "__esModule", { value: !0 }), me.getData = me.KeywordCxt = me.validateFunctionCode = void 0;
|
|
1920
1920
|
const e = /* @__PURE__ */ Kn(), t = /* @__PURE__ */ gt(), m = /* @__PURE__ */ Sn(), c = /* @__PURE__ */ gt(), b = /* @__PURE__ */ Gn(), s = /* @__PURE__ */ Hn(), l = /* @__PURE__ */ Jn(), u = /* @__PURE__ */ H(), h = /* @__PURE__ */ _e(), $ = /* @__PURE__ */ _t(), v = /* @__PURE__ */ Y(), P = /* @__PURE__ */ vt();
|
|
1921
|
-
function _(
|
|
1922
|
-
if (n(
|
|
1923
|
-
a(
|
|
1921
|
+
function _(N) {
|
|
1922
|
+
if (n(N) && (S(N), p(N))) {
|
|
1923
|
+
a(N);
|
|
1924
1924
|
return;
|
|
1925
1925
|
}
|
|
1926
|
-
y(
|
|
1926
|
+
y(N, () => (0, e.topBoolOrEmptySchema)(N));
|
|
1927
1927
|
}
|
|
1928
1928
|
me.validateFunctionCode = _;
|
|
1929
|
-
function y({ gen:
|
|
1930
|
-
L.code.es5 ?
|
|
1931
|
-
|
|
1932
|
-
}) :
|
|
1929
|
+
function y({ gen: N, validateName: R, schema: q, schemaEnv: M, opts: L }, W) {
|
|
1930
|
+
L.code.es5 ? N.func(R, (0, u._)`${h.default.data}, ${h.default.valCxt}`, M.$async, () => {
|
|
1931
|
+
N.code((0, u._)`"use strict"; ${r(q, L)}`), w(N, L), N.code(W);
|
|
1932
|
+
}) : N.func(R, (0, u._)`${h.default.data}, ${g(L)}`, M.$async, () => N.code(r(q, L)).code(W));
|
|
1933
1933
|
}
|
|
1934
|
-
function g(
|
|
1935
|
-
return (0, u._)`{${h.default.instancePath}="", ${h.default.parentData}, ${h.default.parentDataProperty}, ${h.default.rootData}=${h.default.data}${
|
|
1934
|
+
function g(N) {
|
|
1935
|
+
return (0, u._)`{${h.default.instancePath}="", ${h.default.parentData}, ${h.default.parentDataProperty}, ${h.default.rootData}=${h.default.data}${N.dynamicRef ? (0, u._)`, ${h.default.dynamicAnchors}={}` : u.nil}}={}`;
|
|
1936
1936
|
}
|
|
1937
|
-
function w(
|
|
1938
|
-
|
|
1939
|
-
|
|
1937
|
+
function w(N, R) {
|
|
1938
|
+
N.if(h.default.valCxt, () => {
|
|
1939
|
+
N.var(h.default.instancePath, (0, u._)`${h.default.valCxt}.${h.default.instancePath}`), N.var(h.default.parentData, (0, u._)`${h.default.valCxt}.${h.default.parentData}`), N.var(h.default.parentDataProperty, (0, u._)`${h.default.valCxt}.${h.default.parentDataProperty}`), N.var(h.default.rootData, (0, u._)`${h.default.valCxt}.${h.default.rootData}`), R.dynamicRef && N.var(h.default.dynamicAnchors, (0, u._)`${h.default.valCxt}.${h.default.dynamicAnchors}`);
|
|
1940
1940
|
}, () => {
|
|
1941
|
-
|
|
1941
|
+
N.var(h.default.instancePath, (0, u._)`""`), N.var(h.default.parentData, (0, u._)`undefined`), N.var(h.default.parentDataProperty, (0, u._)`undefined`), N.var(h.default.rootData, h.default.data), R.dynamicRef && N.var(h.default.dynamicAnchors, (0, u._)`{}`);
|
|
1942
1942
|
});
|
|
1943
1943
|
}
|
|
1944
|
-
function a(
|
|
1945
|
-
const { schema: R, opts: q, gen: M } =
|
|
1946
|
-
y(
|
|
1947
|
-
q.$comment && R.$comment && U(
|
|
1944
|
+
function a(N) {
|
|
1945
|
+
const { schema: R, opts: q, gen: M } = N;
|
|
1946
|
+
y(N, () => {
|
|
1947
|
+
q.$comment && R.$comment && U(N), D(N), M.let(h.default.vErrors, null), M.let(h.default.errors, 0), q.unevaluated && i(N), T(N), J(N);
|
|
1948
1948
|
});
|
|
1949
1949
|
}
|
|
1950
|
-
function i(
|
|
1951
|
-
const { gen: R, validateName: q } =
|
|
1952
|
-
|
|
1950
|
+
function i(N) {
|
|
1951
|
+
const { gen: R, validateName: q } = N;
|
|
1952
|
+
N.evaluated = R.const("evaluated", (0, u._)`${q}.evaluated`), R.if((0, u._)`${N.evaluated}.dynamicProps`, () => R.assign((0, u._)`${N.evaluated}.props`, (0, u._)`undefined`)), R.if((0, u._)`${N.evaluated}.dynamicItems`, () => R.assign((0, u._)`${N.evaluated}.items`, (0, u._)`undefined`));
|
|
1953
1953
|
}
|
|
1954
|
-
function r(
|
|
1955
|
-
const q = typeof
|
|
1954
|
+
function r(N, R) {
|
|
1955
|
+
const q = typeof N == "object" && N[R.schemaId];
|
|
1956
1956
|
return q && (R.code.source || R.code.process) ? (0, u._)`/*# sourceURL=${q} */` : u.nil;
|
|
1957
1957
|
}
|
|
1958
|
-
function o(
|
|
1959
|
-
if (n(
|
|
1960
|
-
f(
|
|
1958
|
+
function o(N, R) {
|
|
1959
|
+
if (n(N) && (S(N), p(N))) {
|
|
1960
|
+
f(N, R);
|
|
1961
1961
|
return;
|
|
1962
1962
|
}
|
|
1963
|
-
(0, e.boolOrEmptySchema)(
|
|
1963
|
+
(0, e.boolOrEmptySchema)(N, R);
|
|
1964
1964
|
}
|
|
1965
|
-
function p({ schema:
|
|
1966
|
-
if (typeof
|
|
1967
|
-
return !
|
|
1968
|
-
for (const q in
|
|
1965
|
+
function p({ schema: N, self: R }) {
|
|
1966
|
+
if (typeof N == "boolean")
|
|
1967
|
+
return !N;
|
|
1968
|
+
for (const q in N)
|
|
1969
1969
|
if (R.RULES.all[q])
|
|
1970
1970
|
return !0;
|
|
1971
1971
|
return !1;
|
|
1972
1972
|
}
|
|
1973
|
-
function n(
|
|
1974
|
-
return typeof
|
|
1973
|
+
function n(N) {
|
|
1974
|
+
return typeof N.schema != "boolean";
|
|
1975
1975
|
}
|
|
1976
|
-
function f(
|
|
1977
|
-
const { schema: q, gen: M, opts: L } =
|
|
1978
|
-
L.$comment && q.$comment && U(
|
|
1976
|
+
function f(N, R) {
|
|
1977
|
+
const { schema: q, gen: M, opts: L } = N;
|
|
1978
|
+
L.$comment && q.$comment && U(N), z(N), V(N);
|
|
1979
1979
|
const W = M.const("_errs", h.default.errors);
|
|
1980
|
-
T(
|
|
1980
|
+
T(N, W), M.var(R, (0, u._)`${W} === ${h.default.errors}`);
|
|
1981
1981
|
}
|
|
1982
|
-
function S(
|
|
1983
|
-
(0, v.checkUnknownRules)(
|
|
1982
|
+
function S(N) {
|
|
1983
|
+
(0, v.checkUnknownRules)(N), j(N);
|
|
1984
1984
|
}
|
|
1985
|
-
function T(
|
|
1986
|
-
if (
|
|
1987
|
-
return fe(
|
|
1988
|
-
const q = (0, t.getSchemaTypes)(
|
|
1989
|
-
fe(
|
|
1985
|
+
function T(N, R) {
|
|
1986
|
+
if (N.opts.jtd)
|
|
1987
|
+
return fe(N, [], !1, R);
|
|
1988
|
+
const q = (0, t.getSchemaTypes)(N.schema), M = (0, t.coerceAndCheckDataType)(N, q);
|
|
1989
|
+
fe(N, q, !M, R);
|
|
1990
1990
|
}
|
|
1991
|
-
function j(
|
|
1992
|
-
const { schema: R, errSchemaPath: q, opts: M, self: L } =
|
|
1991
|
+
function j(N) {
|
|
1992
|
+
const { schema: R, errSchemaPath: q, opts: M, self: L } = N;
|
|
1993
1993
|
R.$ref && M.ignoreKeywordsWithRef && (0, v.schemaHasRulesButRef)(R, L.RULES) && L.logger.warn(`$ref: keywords ignored in schema at path "${q}"`);
|
|
1994
1994
|
}
|
|
1995
|
-
function D(
|
|
1996
|
-
const { schema: R, opts: q } =
|
|
1997
|
-
R.default !== void 0 && q.useDefaults && q.strictSchema && (0, v.checkStrictMode)(
|
|
1995
|
+
function D(N) {
|
|
1996
|
+
const { schema: R, opts: q } = N;
|
|
1997
|
+
R.default !== void 0 && q.useDefaults && q.strictSchema && (0, v.checkStrictMode)(N, "default is ignored in the schema root");
|
|
1998
1998
|
}
|
|
1999
|
-
function z(
|
|
2000
|
-
const R =
|
|
2001
|
-
R && (
|
|
1999
|
+
function z(N) {
|
|
2000
|
+
const R = N.schema[N.opts.schemaId];
|
|
2001
|
+
R && (N.baseId = (0, $.resolveUrl)(N.opts.uriResolver, N.baseId, R));
|
|
2002
2002
|
}
|
|
2003
|
-
function V(
|
|
2004
|
-
if (
|
|
2003
|
+
function V(N) {
|
|
2004
|
+
if (N.schema.$async && !N.schemaEnv.$async)
|
|
2005
2005
|
throw new Error("async schema in sync schema");
|
|
2006
2006
|
}
|
|
2007
|
-
function U({ gen:
|
|
2007
|
+
function U({ gen: N, schemaEnv: R, schema: q, errSchemaPath: M, opts: L }) {
|
|
2008
2008
|
const W = q.$comment;
|
|
2009
2009
|
if (L.$comment === !0)
|
|
2010
|
-
|
|
2010
|
+
N.code((0, u._)`${h.default.self}.logger.log(${W})`);
|
|
2011
2011
|
else if (typeof L.$comment == "function") {
|
|
2012
|
-
const ee = (0, u.str)`${M}/$comment`, ue =
|
|
2013
|
-
|
|
2012
|
+
const ee = (0, u.str)`${M}/$comment`, ue = N.scopeValue("root", { ref: R.root });
|
|
2013
|
+
N.code((0, u._)`${h.default.self}.opts.$comment(${W}, ${ee}, ${ue}.schema)`);
|
|
2014
2014
|
}
|
|
2015
2015
|
}
|
|
2016
|
-
function J(
|
|
2017
|
-
const { gen: R, schemaEnv: q, validateName: M, ValidationError: L, opts: W } =
|
|
2018
|
-
q.$async ? R.if((0, u._)`${h.default.errors} === 0`, () => R.return(h.default.data), () => R.throw((0, u._)`new ${L}(${h.default.vErrors})`)) : (R.assign((0, u._)`${M}.errors`, h.default.vErrors), W.unevaluated && x(
|
|
2016
|
+
function J(N) {
|
|
2017
|
+
const { gen: R, schemaEnv: q, validateName: M, ValidationError: L, opts: W } = N;
|
|
2018
|
+
q.$async ? R.if((0, u._)`${h.default.errors} === 0`, () => R.return(h.default.data), () => R.throw((0, u._)`new ${L}(${h.default.vErrors})`)) : (R.assign((0, u._)`${M}.errors`, h.default.vErrors), W.unevaluated && x(N), R.return((0, u._)`${h.default.errors} === 0`));
|
|
2019
2019
|
}
|
|
2020
|
-
function x({ gen:
|
|
2021
|
-
q instanceof u.Name &&
|
|
2020
|
+
function x({ gen: N, evaluated: R, props: q, items: M }) {
|
|
2021
|
+
q instanceof u.Name && N.assign((0, u._)`${R}.props`, q), M instanceof u.Name && N.assign((0, u._)`${R}.items`, M);
|
|
2022
2022
|
}
|
|
2023
|
-
function fe(
|
|
2024
|
-
const { gen: L, schema: W, data: ee, allErrors: ue, opts: se, self: ae } =
|
|
2023
|
+
function fe(N, R, q, M) {
|
|
2024
|
+
const { gen: L, schema: W, data: ee, allErrors: ue, opts: se, self: ae } = N, { RULES: te } = ae;
|
|
2025
2025
|
if (W.$ref && (se.ignoreKeywordsWithRef || !(0, v.schemaHasRulesButRef)(W, te))) {
|
|
2026
|
-
L.block(() => F(
|
|
2026
|
+
L.block(() => F(N, "$ref", te.all.$ref.definition));
|
|
2027
2027
|
return;
|
|
2028
2028
|
}
|
|
2029
|
-
se.jtd || X(
|
|
2029
|
+
se.jtd || X(N, R), L.block(() => {
|
|
2030
2030
|
for (const ie of te.rules)
|
|
2031
2031
|
Se(ie);
|
|
2032
2032
|
Se(te.post);
|
|
2033
2033
|
});
|
|
2034
2034
|
function Se(ie) {
|
|
2035
|
-
(0, m.shouldUseGroup)(W, ie) && (ie.type ? (L.if((0, c.checkDataType)(ie.type, ee, se.strictNumbers)), he(
|
|
2035
|
+
(0, m.shouldUseGroup)(W, ie) && (ie.type ? (L.if((0, c.checkDataType)(ie.type, ee, se.strictNumbers)), he(N, ie), R.length === 1 && R[0] === ie.type && q && (L.else(), (0, c.reportTypeError)(N)), L.endIf()) : he(N, ie), ue || L.if((0, u._)`${h.default.errors} === ${M || 0}`));
|
|
2036
2036
|
}
|
|
2037
2037
|
}
|
|
2038
|
-
function he(
|
|
2039
|
-
const { gen: q, schema: M, opts: { useDefaults: L } } =
|
|
2040
|
-
L && (0, b.assignDefaults)(
|
|
2038
|
+
function he(N, R) {
|
|
2039
|
+
const { gen: q, schema: M, opts: { useDefaults: L } } = N;
|
|
2040
|
+
L && (0, b.assignDefaults)(N, R.type), q.block(() => {
|
|
2041
2041
|
for (const W of R.rules)
|
|
2042
|
-
(0, m.shouldUseRule)(M, W) && F(
|
|
2042
|
+
(0, m.shouldUseRule)(M, W) && F(N, W.keyword, W.definition, R.type);
|
|
2043
2043
|
});
|
|
2044
2044
|
}
|
|
2045
|
-
function X(
|
|
2046
|
-
|
|
2045
|
+
function X(N, R) {
|
|
2046
|
+
N.schemaEnv.meta || !N.opts.strictTypes || (ge(N, R), N.opts.allowUnionTypes || A(N, R), k(N, N.dataTypes));
|
|
2047
2047
|
}
|
|
2048
|
-
function ge(
|
|
2048
|
+
function ge(N, R) {
|
|
2049
2049
|
if (R.length) {
|
|
2050
|
-
if (!
|
|
2051
|
-
|
|
2050
|
+
if (!N.dataTypes.length) {
|
|
2051
|
+
N.dataTypes = R;
|
|
2052
2052
|
return;
|
|
2053
2053
|
}
|
|
2054
2054
|
R.forEach((q) => {
|
|
2055
|
-
O(
|
|
2056
|
-
}), d(
|
|
2055
|
+
O(N.dataTypes, q) || E(N, `type "${q}" not allowed by context "${N.dataTypes.join(",")}"`);
|
|
2056
|
+
}), d(N, R);
|
|
2057
2057
|
}
|
|
2058
2058
|
}
|
|
2059
|
-
function A(
|
|
2060
|
-
R.length > 1 && !(R.length === 2 && R.includes("null")) && E(
|
|
2059
|
+
function A(N, R) {
|
|
2060
|
+
R.length > 1 && !(R.length === 2 && R.includes("null")) && E(N, "use allowUnionTypes to allow union type keyword");
|
|
2061
2061
|
}
|
|
2062
|
-
function N
|
|
2063
|
-
const q =
|
|
2062
|
+
function k(N, R) {
|
|
2063
|
+
const q = N.self.RULES.all;
|
|
2064
2064
|
for (const M in q) {
|
|
2065
2065
|
const L = q[M];
|
|
2066
|
-
if (typeof L == "object" && (0, m.shouldUseRule)(
|
|
2066
|
+
if (typeof L == "object" && (0, m.shouldUseRule)(N.schema, L)) {
|
|
2067
2067
|
const { type: W } = L.definition;
|
|
2068
|
-
W.length && !W.some((ee) => C(R, ee)) && E(
|
|
2068
|
+
W.length && !W.some((ee) => C(R, ee)) && E(N, `missing type "${W.join(",")}" for keyword "${M}"`);
|
|
2069
2069
|
}
|
|
2070
2070
|
}
|
|
2071
2071
|
}
|
|
2072
|
-
function C(
|
|
2073
|
-
return
|
|
2072
|
+
function C(N, R) {
|
|
2073
|
+
return N.includes(R) || R === "number" && N.includes("integer");
|
|
2074
2074
|
}
|
|
2075
|
-
function O(
|
|
2076
|
-
return
|
|
2075
|
+
function O(N, R) {
|
|
2076
|
+
return N.includes(R) || R === "integer" && N.includes("number");
|
|
2077
2077
|
}
|
|
2078
|
-
function d(
|
|
2078
|
+
function d(N, R) {
|
|
2079
2079
|
const q = [];
|
|
2080
|
-
for (const M of
|
|
2080
|
+
for (const M of N.dataTypes)
|
|
2081
2081
|
O(R, M) ? q.push(M) : R.includes("integer") && M === "number" && q.push("integer");
|
|
2082
|
-
|
|
2082
|
+
N.dataTypes = q;
|
|
2083
2083
|
}
|
|
2084
|
-
function E(
|
|
2085
|
-
const q =
|
|
2086
|
-
R += ` at "${q}" (strictTypes)`, (0, v.checkStrictMode)(
|
|
2084
|
+
function E(N, R) {
|
|
2085
|
+
const q = N.schemaEnv.baseId + N.errSchemaPath;
|
|
2086
|
+
R += ` at "${q}" (strictTypes)`, (0, v.checkStrictMode)(N, R, N.opts.strictTypes);
|
|
2087
2087
|
}
|
|
2088
2088
|
class I {
|
|
2089
2089
|
constructor(R, q, M) {
|
|
@@ -2187,23 +2187,23 @@ function $t() {
|
|
|
2187
2187
|
}
|
|
2188
2188
|
}
|
|
2189
2189
|
me.KeywordCxt = I;
|
|
2190
|
-
function F(
|
|
2191
|
-
const L = new I(
|
|
2190
|
+
function F(N, R, q, M) {
|
|
2191
|
+
const L = new I(N, q, R);
|
|
2192
2192
|
"code" in q ? q.code(L, M) : L.$data && q.validate ? (0, s.funcKeywordCode)(L, q) : "macro" in q ? (0, s.macroKeywordCode)(L, q) : (q.compile || q.validate) && (0, s.funcKeywordCode)(L, q);
|
|
2193
2193
|
}
|
|
2194
2194
|
const K = /^\/(?:[^~]|~0|~1)*$/, Z = /^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;
|
|
2195
|
-
function B(
|
|
2195
|
+
function B(N, { dataLevel: R, dataNames: q, dataPathArr: M }) {
|
|
2196
2196
|
let L, W;
|
|
2197
|
-
if (
|
|
2197
|
+
if (N === "")
|
|
2198
2198
|
return h.default.rootData;
|
|
2199
|
-
if (
|
|
2200
|
-
if (!K.test(
|
|
2201
|
-
throw new Error(`Invalid JSON-pointer: ${
|
|
2202
|
-
L =
|
|
2199
|
+
if (N[0] === "/") {
|
|
2200
|
+
if (!K.test(N))
|
|
2201
|
+
throw new Error(`Invalid JSON-pointer: ${N}`);
|
|
2202
|
+
L = N, W = h.default.rootData;
|
|
2203
2203
|
} else {
|
|
2204
|
-
const ae = Z.exec(
|
|
2204
|
+
const ae = Z.exec(N);
|
|
2205
2205
|
if (!ae)
|
|
2206
|
-
throw new Error(`Invalid JSON-pointer: ${
|
|
2206
|
+
throw new Error(`Invalid JSON-pointer: ${N}`);
|
|
2207
2207
|
const te = +ae[1];
|
|
2208
2208
|
if (L = ae[2], L === "#") {
|
|
2209
2209
|
if (te >= R)
|
|
@@ -2846,7 +2846,7 @@ function ss() {
|
|
|
2846
2846
|
} }), Object.defineProperty(e, "CodeGen", { enumerable: !0, get: function() {
|
|
2847
2847
|
return m.CodeGen;
|
|
2848
2848
|
} });
|
|
2849
|
-
const c = /* @__PURE__ */ Ut(), b = /* @__PURE__ */ wt(), s = /* @__PURE__ */ bn(), l = /* @__PURE__ */ Lt(), u = /* @__PURE__ */ H(), h = /* @__PURE__ */ _t(), $ = /* @__PURE__ */ gt(), v = /* @__PURE__ */ Y(), P = es, _ = /* @__PURE__ */ ns(), y = (A,
|
|
2849
|
+
const c = /* @__PURE__ */ Ut(), b = /* @__PURE__ */ wt(), s = /* @__PURE__ */ bn(), l = /* @__PURE__ */ Lt(), u = /* @__PURE__ */ H(), h = /* @__PURE__ */ _t(), $ = /* @__PURE__ */ gt(), v = /* @__PURE__ */ Y(), P = es, _ = /* @__PURE__ */ ns(), y = (A, k) => new RegExp(A, k);
|
|
2850
2850
|
y.code = "new RegExp";
|
|
2851
2851
|
const g = ["removeAdditional", "useDefaults", "coerceTypes"], w = /* @__PURE__ */ new Set([
|
|
2852
2852
|
"validate",
|
|
@@ -2884,14 +2884,14 @@ function ss() {
|
|
|
2884
2884
|
unicode: '"minLength"/"maxLength" account for unicode characters by default.'
|
|
2885
2885
|
}, r = 200;
|
|
2886
2886
|
function o(A) {
|
|
2887
|
-
var
|
|
2888
|
-
const
|
|
2887
|
+
var k, C, O, d, E, I, F, K, Z, B, N, R, q, M, L, W, ee, ue, se, ae, te, Se, ie, bt, St;
|
|
2888
|
+
const Ne = A.strict, Et = (k = A.code) === null || k === void 0 ? void 0 : k.optimize, Gt = Et === !0 || Et === void 0 ? 1 : Et || 0, Ht = (O = (C = A.code) === null || C === void 0 ? void 0 : C.regExp) !== null && O !== void 0 ? O : y, In = (d = A.uriResolver) !== null && d !== void 0 ? d : _.default;
|
|
2889
2889
|
return {
|
|
2890
|
-
strictSchema: (I = (E = A.strictSchema) !== null && E !== void 0 ? E :
|
|
2891
|
-
strictNumbers: (K = (F = A.strictNumbers) !== null && F !== void 0 ? F :
|
|
2892
|
-
strictTypes: (B = (Z = A.strictTypes) !== null && Z !== void 0 ? Z :
|
|
2893
|
-
strictTuples: (R = (
|
|
2894
|
-
strictRequired: (M = (q = A.strictRequired) !== null && q !== void 0 ? q :
|
|
2890
|
+
strictSchema: (I = (E = A.strictSchema) !== null && E !== void 0 ? E : Ne) !== null && I !== void 0 ? I : !0,
|
|
2891
|
+
strictNumbers: (K = (F = A.strictNumbers) !== null && F !== void 0 ? F : Ne) !== null && K !== void 0 ? K : !0,
|
|
2892
|
+
strictTypes: (B = (Z = A.strictTypes) !== null && Z !== void 0 ? Z : Ne) !== null && B !== void 0 ? B : "log",
|
|
2893
|
+
strictTuples: (R = (N = A.strictTuples) !== null && N !== void 0 ? N : Ne) !== null && R !== void 0 ? R : "log",
|
|
2894
|
+
strictRequired: (M = (q = A.strictRequired) !== null && q !== void 0 ? q : Ne) !== null && M !== void 0 ? M : !1,
|
|
2895
2895
|
code: A.code ? { ...A.code, optimize: Gt, regExp: Ht } : { optimize: Gt, regExp: Ht },
|
|
2896
2896
|
loopRequired: (L = A.loopRequired) !== null && L !== void 0 ? L : r,
|
|
2897
2897
|
loopEnum: (W = A.loopEnum) !== null && W !== void 0 ? W : r,
|
|
@@ -2908,47 +2908,47 @@ function ss() {
|
|
|
2908
2908
|
};
|
|
2909
2909
|
}
|
|
2910
2910
|
class p {
|
|
2911
|
-
constructor(
|
|
2912
|
-
this.schemas = {}, this.refs = {}, this.formats = {}, this._compilations = /* @__PURE__ */ new Set(), this._loading = {}, this._cache = /* @__PURE__ */ new Map(),
|
|
2911
|
+
constructor(k = {}) {
|
|
2912
|
+
this.schemas = {}, this.refs = {}, this.formats = {}, this._compilations = /* @__PURE__ */ new Set(), this._loading = {}, this._cache = /* @__PURE__ */ new Map(), k = this.opts = { ...k, ...o(k) };
|
|
2913
2913
|
const { es5: C, lines: O } = this.opts.code;
|
|
2914
|
-
this.scope = new u.ValueScope({ scope: {}, prefixes: w, es5: C, lines: O }), this.logger = V(
|
|
2915
|
-
const d =
|
|
2916
|
-
|
|
2914
|
+
this.scope = new u.ValueScope({ scope: {}, prefixes: w, es5: C, lines: O }), this.logger = V(k.logger);
|
|
2915
|
+
const d = k.validateFormats;
|
|
2916
|
+
k.validateFormats = !1, this.RULES = (0, s.getRules)(), n.call(this, a, k, "NOT SUPPORTED"), n.call(this, i, k, "DEPRECATED", "warn"), this._metaOpts = D.call(this), k.formats && T.call(this), this._addVocabularies(), this._addDefaultMetaSchema(), k.keywords && j.call(this, k.keywords), typeof k.meta == "object" && this.addMetaSchema(k.meta), S.call(this), k.validateFormats = d;
|
|
2917
2917
|
}
|
|
2918
2918
|
_addVocabularies() {
|
|
2919
2919
|
this.addKeyword("$async");
|
|
2920
2920
|
}
|
|
2921
2921
|
_addDefaultMetaSchema() {
|
|
2922
|
-
const { $data:
|
|
2922
|
+
const { $data: k, meta: C, schemaId: O } = this.opts;
|
|
2923
2923
|
let d = P;
|
|
2924
|
-
O === "id" && (d = { ...P }, d.id = d.$id, delete d.$id), C &&
|
|
2924
|
+
O === "id" && (d = { ...P }, d.id = d.$id, delete d.$id), C && k && this.addMetaSchema(d, d[O], !1);
|
|
2925
2925
|
}
|
|
2926
2926
|
defaultMeta() {
|
|
2927
|
-
const { meta:
|
|
2928
|
-
return this.opts.defaultMeta = typeof
|
|
2927
|
+
const { meta: k, schemaId: C } = this.opts;
|
|
2928
|
+
return this.opts.defaultMeta = typeof k == "object" ? k[C] || k : void 0;
|
|
2929
2929
|
}
|
|
2930
|
-
validate(
|
|
2930
|
+
validate(k, C) {
|
|
2931
2931
|
let O;
|
|
2932
|
-
if (typeof
|
|
2933
|
-
if (O = this.getSchema(
|
|
2934
|
-
throw new Error(`no schema with key or ref "${
|
|
2932
|
+
if (typeof k == "string") {
|
|
2933
|
+
if (O = this.getSchema(k), !O)
|
|
2934
|
+
throw new Error(`no schema with key or ref "${k}"`);
|
|
2935
2935
|
} else
|
|
2936
|
-
O = this.compile(
|
|
2936
|
+
O = this.compile(k);
|
|
2937
2937
|
const d = O(C);
|
|
2938
2938
|
return "$async" in O || (this.errors = O.errors), d;
|
|
2939
2939
|
}
|
|
2940
|
-
compile(
|
|
2941
|
-
const O = this._addSchema(
|
|
2940
|
+
compile(k, C) {
|
|
2941
|
+
const O = this._addSchema(k, C);
|
|
2942
2942
|
return O.validate || this._compileSchemaEnv(O);
|
|
2943
2943
|
}
|
|
2944
|
-
compileAsync(
|
|
2944
|
+
compileAsync(k, C) {
|
|
2945
2945
|
if (typeof this.opts.loadSchema != "function")
|
|
2946
2946
|
throw new Error("options.loadSchema should be a function");
|
|
2947
2947
|
const { loadSchema: O } = this.opts;
|
|
2948
|
-
return d.call(this,
|
|
2949
|
-
async function d(B,
|
|
2948
|
+
return d.call(this, k, C);
|
|
2949
|
+
async function d(B, N) {
|
|
2950
2950
|
await E.call(this, B.$schema);
|
|
2951
|
-
const R = this._addSchema(B,
|
|
2951
|
+
const R = this._addSchema(B, N);
|
|
2952
2952
|
return R.validate || I.call(this, R);
|
|
2953
2953
|
}
|
|
2954
2954
|
async function E(B) {
|
|
@@ -2957,24 +2957,24 @@ function ss() {
|
|
|
2957
2957
|
async function I(B) {
|
|
2958
2958
|
try {
|
|
2959
2959
|
return this._compileSchemaEnv(B);
|
|
2960
|
-
} catch (
|
|
2961
|
-
if (!(
|
|
2962
|
-
throw
|
|
2963
|
-
return F.call(this,
|
|
2960
|
+
} catch (N) {
|
|
2961
|
+
if (!(N instanceof b.default))
|
|
2962
|
+
throw N;
|
|
2963
|
+
return F.call(this, N), await K.call(this, N.missingSchema), I.call(this, B);
|
|
2964
2964
|
}
|
|
2965
2965
|
}
|
|
2966
|
-
function F({ missingSchema: B, missingRef:
|
|
2966
|
+
function F({ missingSchema: B, missingRef: N }) {
|
|
2967
2967
|
if (this.refs[B])
|
|
2968
|
-
throw new Error(`AnySchema ${B} is loaded but ${
|
|
2968
|
+
throw new Error(`AnySchema ${B} is loaded but ${N} cannot be resolved`);
|
|
2969
2969
|
}
|
|
2970
2970
|
async function K(B) {
|
|
2971
|
-
const
|
|
2972
|
-
this.refs[B] || await E.call(this,
|
|
2971
|
+
const N = await Z.call(this, B);
|
|
2972
|
+
this.refs[B] || await E.call(this, N.$schema), this.refs[B] || this.addSchema(N, B, C);
|
|
2973
2973
|
}
|
|
2974
2974
|
async function Z(B) {
|
|
2975
|
-
const
|
|
2976
|
-
if (
|
|
2977
|
-
return
|
|
2975
|
+
const N = this._loading[B];
|
|
2976
|
+
if (N)
|
|
2977
|
+
return N;
|
|
2978
2978
|
try {
|
|
2979
2979
|
return await (this._loading[B] = O(B));
|
|
2980
2980
|
} finally {
|
|
@@ -2983,35 +2983,35 @@ function ss() {
|
|
|
2983
2983
|
}
|
|
2984
2984
|
}
|
|
2985
2985
|
// Adds schema to the instance
|
|
2986
|
-
addSchema(
|
|
2987
|
-
if (Array.isArray(
|
|
2988
|
-
for (const I of
|
|
2986
|
+
addSchema(k, C, O, d = this.opts.validateSchema) {
|
|
2987
|
+
if (Array.isArray(k)) {
|
|
2988
|
+
for (const I of k)
|
|
2989
2989
|
this.addSchema(I, void 0, O, d);
|
|
2990
2990
|
return this;
|
|
2991
2991
|
}
|
|
2992
2992
|
let E;
|
|
2993
|
-
if (typeof
|
|
2993
|
+
if (typeof k == "object") {
|
|
2994
2994
|
const { schemaId: I } = this.opts;
|
|
2995
|
-
if (E =
|
|
2995
|
+
if (E = k[I], E !== void 0 && typeof E != "string")
|
|
2996
2996
|
throw new Error(`schema ${I} must be string`);
|
|
2997
2997
|
}
|
|
2998
|
-
return C = (0, h.normalizeId)(C || E), this._checkUnique(C), this.schemas[C] = this._addSchema(
|
|
2998
|
+
return C = (0, h.normalizeId)(C || E), this._checkUnique(C), this.schemas[C] = this._addSchema(k, O, C, d, !0), this;
|
|
2999
2999
|
}
|
|
3000
3000
|
// Add schema that will be used to validate other schemas
|
|
3001
3001
|
// options in META_IGNORE_OPTIONS are alway set to false
|
|
3002
|
-
addMetaSchema(
|
|
3003
|
-
return this.addSchema(
|
|
3002
|
+
addMetaSchema(k, C, O = this.opts.validateSchema) {
|
|
3003
|
+
return this.addSchema(k, C, !0, O), this;
|
|
3004
3004
|
}
|
|
3005
3005
|
// Validate schema against its meta-schema
|
|
3006
|
-
validateSchema(
|
|
3007
|
-
if (typeof
|
|
3006
|
+
validateSchema(k, C) {
|
|
3007
|
+
if (typeof k == "boolean")
|
|
3008
3008
|
return !0;
|
|
3009
3009
|
let O;
|
|
3010
|
-
if (O =
|
|
3010
|
+
if (O = k.$schema, O !== void 0 && typeof O != "string")
|
|
3011
3011
|
throw new Error("$schema must be a string");
|
|
3012
3012
|
if (O = O || this.opts.defaultMeta || this.defaultMeta(), !O)
|
|
3013
3013
|
return this.logger.warn("meta-schema not available"), this.errors = null, !0;
|
|
3014
|
-
const d = this.validate(O,
|
|
3014
|
+
const d = this.validate(O, k);
|
|
3015
3015
|
if (!d && C) {
|
|
3016
3016
|
const E = "schema is invalid: " + this.errorsText();
|
|
3017
3017
|
if (this.opts.validateSchema === "log")
|
|
@@ -3023,15 +3023,15 @@ function ss() {
|
|
|
3023
3023
|
}
|
|
3024
3024
|
// Get compiled schema by `key` or `ref`.
|
|
3025
3025
|
// (`key` that was passed to `addSchema` or full schema reference - `schema.$id` or resolved id)
|
|
3026
|
-
getSchema(
|
|
3026
|
+
getSchema(k) {
|
|
3027
3027
|
let C;
|
|
3028
|
-
for (; typeof (C = f.call(this,
|
|
3029
|
-
|
|
3028
|
+
for (; typeof (C = f.call(this, k)) == "string"; )
|
|
3029
|
+
k = C;
|
|
3030
3030
|
if (C === void 0) {
|
|
3031
3031
|
const { schemaId: O } = this.opts, d = new l.SchemaEnv({ schema: {}, schemaId: O });
|
|
3032
|
-
if (C = l.resolveSchema.call(this, d,
|
|
3032
|
+
if (C = l.resolveSchema.call(this, d, k), !C)
|
|
3033
3033
|
return;
|
|
3034
|
-
this.refs[
|
|
3034
|
+
this.refs[k] = C;
|
|
3035
3035
|
}
|
|
3036
3036
|
return C.validate || this._compileSchemaEnv(C);
|
|
3037
3037
|
}
|
|
@@ -3039,20 +3039,20 @@ function ss() {
|
|
|
3039
3039
|
// If no parameter is passed all schemas but meta-schemas are removed.
|
|
3040
3040
|
// If RegExp is passed all schemas with key/id matching pattern but meta-schemas are removed.
|
|
3041
3041
|
// Even if schema is referenced by other schemas it still can be removed as other schemas have local references.
|
|
3042
|
-
removeSchema(
|
|
3043
|
-
if (
|
|
3044
|
-
return this._removeAllSchemas(this.schemas,
|
|
3045
|
-
switch (typeof
|
|
3042
|
+
removeSchema(k) {
|
|
3043
|
+
if (k instanceof RegExp)
|
|
3044
|
+
return this._removeAllSchemas(this.schemas, k), this._removeAllSchemas(this.refs, k), this;
|
|
3045
|
+
switch (typeof k) {
|
|
3046
3046
|
case "undefined":
|
|
3047
3047
|
return this._removeAllSchemas(this.schemas), this._removeAllSchemas(this.refs), this._cache.clear(), this;
|
|
3048
3048
|
case "string": {
|
|
3049
|
-
const C = f.call(this,
|
|
3050
|
-
return typeof C == "object" && this._cache.delete(C.schema), delete this.schemas[
|
|
3049
|
+
const C = f.call(this, k);
|
|
3050
|
+
return typeof C == "object" && this._cache.delete(C.schema), delete this.schemas[k], delete this.refs[k], this;
|
|
3051
3051
|
}
|
|
3052
3052
|
case "object": {
|
|
3053
|
-
const C =
|
|
3053
|
+
const C = k;
|
|
3054
3054
|
this._cache.delete(C);
|
|
3055
|
-
let O =
|
|
3055
|
+
let O = k[this.opts.schemaId];
|
|
3056
3056
|
return O && (O = (0, h.normalizeId)(O), delete this.schemas[O], delete this.refs[O]), this;
|
|
3057
3057
|
}
|
|
3058
3058
|
default:
|
|
@@ -3060,17 +3060,17 @@ function ss() {
|
|
|
3060
3060
|
}
|
|
3061
3061
|
}
|
|
3062
3062
|
// add "vocabulary" - a collection of keywords
|
|
3063
|
-
addVocabulary(
|
|
3064
|
-
for (const C of
|
|
3063
|
+
addVocabulary(k) {
|
|
3064
|
+
for (const C of k)
|
|
3065
3065
|
this.addKeyword(C);
|
|
3066
3066
|
return this;
|
|
3067
3067
|
}
|
|
3068
|
-
addKeyword(
|
|
3068
|
+
addKeyword(k, C) {
|
|
3069
3069
|
let O;
|
|
3070
|
-
if (typeof
|
|
3071
|
-
O =
|
|
3072
|
-
else if (typeof
|
|
3073
|
-
if (C =
|
|
3070
|
+
if (typeof k == "string")
|
|
3071
|
+
O = k, typeof C == "object" && (this.logger.warn("these parameters are deprecated, see docs for addKeyword"), C.keyword = O);
|
|
3072
|
+
else if (typeof k == "object" && C === void 0) {
|
|
3073
|
+
if (C = k, O = C.keyword, Array.isArray(O) && !O.length)
|
|
3074
3074
|
throw new Error("addKeywords: keyword must be string or non-empty array");
|
|
3075
3075
|
} else
|
|
3076
3076
|
throw new Error("invalid addKeywords parameters");
|
|
@@ -3084,33 +3084,33 @@ function ss() {
|
|
|
3084
3084
|
};
|
|
3085
3085
|
return (0, v.eachItem)(O, d.type.length === 0 ? (E) => x.call(this, E, d) : (E) => d.type.forEach((I) => x.call(this, E, d, I))), this;
|
|
3086
3086
|
}
|
|
3087
|
-
getKeyword(
|
|
3088
|
-
const C = this.RULES.all[
|
|
3087
|
+
getKeyword(k) {
|
|
3088
|
+
const C = this.RULES.all[k];
|
|
3089
3089
|
return typeof C == "object" ? C.definition : !!C;
|
|
3090
3090
|
}
|
|
3091
3091
|
// Remove keyword
|
|
3092
|
-
removeKeyword(
|
|
3092
|
+
removeKeyword(k) {
|
|
3093
3093
|
const { RULES: C } = this;
|
|
3094
|
-
delete C.keywords[
|
|
3094
|
+
delete C.keywords[k], delete C.all[k];
|
|
3095
3095
|
for (const O of C.rules) {
|
|
3096
|
-
const d = O.rules.findIndex((E) => E.keyword ===
|
|
3096
|
+
const d = O.rules.findIndex((E) => E.keyword === k);
|
|
3097
3097
|
d >= 0 && O.rules.splice(d, 1);
|
|
3098
3098
|
}
|
|
3099
3099
|
return this;
|
|
3100
3100
|
}
|
|
3101
3101
|
// Add format
|
|
3102
|
-
addFormat(
|
|
3103
|
-
return typeof C == "string" && (C = new RegExp(C)), this.formats[
|
|
3102
|
+
addFormat(k, C) {
|
|
3103
|
+
return typeof C == "string" && (C = new RegExp(C)), this.formats[k] = C, this;
|
|
3104
3104
|
}
|
|
3105
|
-
errorsText(
|
|
3106
|
-
return !
|
|
3105
|
+
errorsText(k = this.errors, { separator: C = ", ", dataVar: O = "data" } = {}) {
|
|
3106
|
+
return !k || k.length === 0 ? "No errors" : k.map((d) => `${O}${d.instancePath} ${d.message}`).reduce((d, E) => d + C + E);
|
|
3107
3107
|
}
|
|
3108
|
-
$dataMetaSchema(
|
|
3108
|
+
$dataMetaSchema(k, C) {
|
|
3109
3109
|
const O = this.RULES.all;
|
|
3110
|
-
|
|
3110
|
+
k = JSON.parse(JSON.stringify(k));
|
|
3111
3111
|
for (const d of C) {
|
|
3112
3112
|
const E = d.split("/").slice(1);
|
|
3113
|
-
let I =
|
|
3113
|
+
let I = k;
|
|
3114
3114
|
for (const F of E)
|
|
3115
3115
|
I = I[F];
|
|
3116
3116
|
for (const F in O) {
|
|
@@ -3121,56 +3121,56 @@ function ss() {
|
|
|
3121
3121
|
Z && B && (I[F] = ge(B));
|
|
3122
3122
|
}
|
|
3123
3123
|
}
|
|
3124
|
-
return
|
|
3124
|
+
return k;
|
|
3125
3125
|
}
|
|
3126
|
-
_removeAllSchemas(
|
|
3127
|
-
for (const O in
|
|
3128
|
-
const d =
|
|
3129
|
-
(!C || C.test(O)) && (typeof d == "string" ? delete
|
|
3126
|
+
_removeAllSchemas(k, C) {
|
|
3127
|
+
for (const O in k) {
|
|
3128
|
+
const d = k[O];
|
|
3129
|
+
(!C || C.test(O)) && (typeof d == "string" ? delete k[O] : d && !d.meta && (this._cache.delete(d.schema), delete k[O]));
|
|
3130
3130
|
}
|
|
3131
3131
|
}
|
|
3132
|
-
_addSchema(
|
|
3132
|
+
_addSchema(k, C, O, d = this.opts.validateSchema, E = this.opts.addUsedSchema) {
|
|
3133
3133
|
let I;
|
|
3134
3134
|
const { schemaId: F } = this.opts;
|
|
3135
|
-
if (typeof
|
|
3136
|
-
I =
|
|
3135
|
+
if (typeof k == "object")
|
|
3136
|
+
I = k[F];
|
|
3137
3137
|
else {
|
|
3138
3138
|
if (this.opts.jtd)
|
|
3139
3139
|
throw new Error("schema must be object");
|
|
3140
|
-
if (typeof
|
|
3140
|
+
if (typeof k != "boolean")
|
|
3141
3141
|
throw new Error("schema must be object or boolean");
|
|
3142
3142
|
}
|
|
3143
|
-
let K = this._cache.get(
|
|
3143
|
+
let K = this._cache.get(k);
|
|
3144
3144
|
if (K !== void 0)
|
|
3145
3145
|
return K;
|
|
3146
3146
|
O = (0, h.normalizeId)(I || O);
|
|
3147
|
-
const Z = h.getSchemaRefs.call(this,
|
|
3148
|
-
return K = new l.SchemaEnv({ schema:
|
|
3147
|
+
const Z = h.getSchemaRefs.call(this, k, O);
|
|
3148
|
+
return K = new l.SchemaEnv({ schema: k, schemaId: F, meta: C, baseId: O, localRefs: Z }), this._cache.set(K.schema, K), E && !O.startsWith("#") && (O && this._checkUnique(O), this.refs[O] = K), d && this.validateSchema(k, !0), K;
|
|
3149
3149
|
}
|
|
3150
|
-
_checkUnique(
|
|
3151
|
-
if (this.schemas[
|
|
3152
|
-
throw new Error(`schema with key or id "${
|
|
3150
|
+
_checkUnique(k) {
|
|
3151
|
+
if (this.schemas[k] || this.refs[k])
|
|
3152
|
+
throw new Error(`schema with key or id "${k}" already exists`);
|
|
3153
3153
|
}
|
|
3154
|
-
_compileSchemaEnv(
|
|
3155
|
-
if (
|
|
3154
|
+
_compileSchemaEnv(k) {
|
|
3155
|
+
if (k.meta ? this._compileMetaSchema(k) : l.compileSchema.call(this, k), !k.validate)
|
|
3156
3156
|
throw new Error("ajv implementation error");
|
|
3157
|
-
return
|
|
3157
|
+
return k.validate;
|
|
3158
3158
|
}
|
|
3159
|
-
_compileMetaSchema(
|
|
3159
|
+
_compileMetaSchema(k) {
|
|
3160
3160
|
const C = this.opts;
|
|
3161
3161
|
this.opts = this._metaOpts;
|
|
3162
3162
|
try {
|
|
3163
|
-
l.compileSchema.call(this,
|
|
3163
|
+
l.compileSchema.call(this, k);
|
|
3164
3164
|
} finally {
|
|
3165
3165
|
this.opts = C;
|
|
3166
3166
|
}
|
|
3167
3167
|
}
|
|
3168
3168
|
}
|
|
3169
3169
|
p.ValidationError = c.default, p.MissingRefError = b.default, e.default = p;
|
|
3170
|
-
function n(A,
|
|
3170
|
+
function n(A, k, C, O = "error") {
|
|
3171
3171
|
for (const d in A) {
|
|
3172
3172
|
const E = d;
|
|
3173
|
-
E in
|
|
3173
|
+
E in k && this.logger[O](`${C}: option ${d}. ${A[E]}`);
|
|
3174
3174
|
}
|
|
3175
3175
|
}
|
|
3176
3176
|
function f(A) {
|
|
@@ -3182,13 +3182,13 @@ function ss() {
|
|
|
3182
3182
|
if (Array.isArray(A))
|
|
3183
3183
|
this.addSchema(A);
|
|
3184
3184
|
else
|
|
3185
|
-
for (const
|
|
3186
|
-
this.addSchema(A[
|
|
3185
|
+
for (const k in A)
|
|
3186
|
+
this.addSchema(A[k], k);
|
|
3187
3187
|
}
|
|
3188
3188
|
function T() {
|
|
3189
3189
|
for (const A in this.opts.formats) {
|
|
3190
|
-
const
|
|
3191
|
-
|
|
3190
|
+
const k = this.opts.formats[A];
|
|
3191
|
+
k && this.addFormat(A, k);
|
|
3192
3192
|
}
|
|
3193
3193
|
}
|
|
3194
3194
|
function j(A) {
|
|
@@ -3197,15 +3197,15 @@ function ss() {
|
|
|
3197
3197
|
return;
|
|
3198
3198
|
}
|
|
3199
3199
|
this.logger.warn("keywords option as map is deprecated, pass array");
|
|
3200
|
-
for (const
|
|
3201
|
-
const C = A[
|
|
3202
|
-
C.keyword || (C.keyword =
|
|
3200
|
+
for (const k in A) {
|
|
3201
|
+
const C = A[k];
|
|
3202
|
+
C.keyword || (C.keyword = k), this.addKeyword(C);
|
|
3203
3203
|
}
|
|
3204
3204
|
}
|
|
3205
3205
|
function D() {
|
|
3206
3206
|
const A = { ...this.opts };
|
|
3207
|
-
for (const
|
|
3208
|
-
delete A[
|
|
3207
|
+
for (const k of g)
|
|
3208
|
+
delete A[k];
|
|
3209
3209
|
return A;
|
|
3210
3210
|
}
|
|
3211
3211
|
const z = { log() {
|
|
@@ -3222,42 +3222,42 @@ function ss() {
|
|
|
3222
3222
|
throw new Error("logger must implement log, warn and error methods");
|
|
3223
3223
|
}
|
|
3224
3224
|
const U = /^[a-z_$][a-z0-9_$:-]*$/i;
|
|
3225
|
-
function J(A,
|
|
3225
|
+
function J(A, k) {
|
|
3226
3226
|
const { RULES: C } = this;
|
|
3227
3227
|
if ((0, v.eachItem)(A, (O) => {
|
|
3228
3228
|
if (C.keywords[O])
|
|
3229
3229
|
throw new Error(`Keyword ${O} is already defined`);
|
|
3230
3230
|
if (!U.test(O))
|
|
3231
3231
|
throw new Error(`Keyword ${O} has invalid name`);
|
|
3232
|
-
}), !!
|
|
3232
|
+
}), !!k && k.$data && !("code" in k || "validate" in k))
|
|
3233
3233
|
throw new Error('$data keyword must have "code" or "validate" function');
|
|
3234
3234
|
}
|
|
3235
|
-
function x(A,
|
|
3235
|
+
function x(A, k, C) {
|
|
3236
3236
|
var O;
|
|
3237
|
-
const d =
|
|
3237
|
+
const d = k == null ? void 0 : k.post;
|
|
3238
3238
|
if (C && d)
|
|
3239
3239
|
throw new Error('keyword with "post" flag cannot have "type"');
|
|
3240
3240
|
const { RULES: E } = this;
|
|
3241
3241
|
let I = d ? E.post : E.rules.find(({ type: K }) => K === C);
|
|
3242
|
-
if (I || (I = { type: C, rules: [] }, E.rules.push(I)), E.keywords[A] = !0, !
|
|
3242
|
+
if (I || (I = { type: C, rules: [] }, E.rules.push(I)), E.keywords[A] = !0, !k)
|
|
3243
3243
|
return;
|
|
3244
3244
|
const F = {
|
|
3245
3245
|
keyword: A,
|
|
3246
3246
|
definition: {
|
|
3247
|
-
...
|
|
3248
|
-
type: (0, $.getJSONTypes)(
|
|
3249
|
-
schemaType: (0, $.getJSONTypes)(
|
|
3247
|
+
...k,
|
|
3248
|
+
type: (0, $.getJSONTypes)(k.type),
|
|
3249
|
+
schemaType: (0, $.getJSONTypes)(k.schemaType)
|
|
3250
3250
|
}
|
|
3251
3251
|
};
|
|
3252
|
-
|
|
3252
|
+
k.before ? fe.call(this, I, F, k.before) : I.rules.push(F), E.all[A] = F, (O = k.implements) === null || O === void 0 || O.forEach((K) => this.addKeyword(K));
|
|
3253
3253
|
}
|
|
3254
|
-
function fe(A,
|
|
3254
|
+
function fe(A, k, C) {
|
|
3255
3255
|
const O = A.rules.findIndex((d) => d.keyword === C);
|
|
3256
|
-
O >= 0 ? A.rules.splice(O, 0,
|
|
3256
|
+
O >= 0 ? A.rules.splice(O, 0, k) : (A.rules.push(k), this.logger.warn(`rule ${C} is not defined`));
|
|
3257
3257
|
}
|
|
3258
3258
|
function he(A) {
|
|
3259
|
-
let { metaSchema:
|
|
3260
|
-
|
|
3259
|
+
let { metaSchema: k } = A;
|
|
3260
|
+
k !== void 0 && (A.$data && this.opts.$data && (k = ge(k)), A.validateSchema = this.compile(k, !0));
|
|
3261
3261
|
}
|
|
3262
3262
|
const X = {
|
|
3263
3263
|
$ref: "https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"
|
|
@@ -3279,10 +3279,10 @@ function as() {
|
|
|
3279
3279
|
};
|
|
3280
3280
|
return Me.default = e, Me;
|
|
3281
3281
|
}
|
|
3282
|
-
var ve = {},
|
|
3282
|
+
var ve = {}, Nr;
|
|
3283
3283
|
function os() {
|
|
3284
|
-
if (
|
|
3285
|
-
|
|
3284
|
+
if (Nr) return ve;
|
|
3285
|
+
Nr = 1, Object.defineProperty(ve, "__esModule", { value: !0 }), ve.callRef = ve.getValidate = void 0;
|
|
3286
3286
|
const e = /* @__PURE__ */ wt(), t = /* @__PURE__ */ le(), m = /* @__PURE__ */ H(), c = /* @__PURE__ */ _e(), b = /* @__PURE__ */ Lt(), s = /* @__PURE__ */ Y(), l = {
|
|
3287
3287
|
keyword: "$ref",
|
|
3288
3288
|
schemaType: "string",
|
|
@@ -3366,10 +3366,10 @@ function os() {
|
|
|
3366
3366
|
}
|
|
3367
3367
|
return ve.callRef = h, ve.default = l, ve;
|
|
3368
3368
|
}
|
|
3369
|
-
var
|
|
3369
|
+
var kr;
|
|
3370
3370
|
function is() {
|
|
3371
|
-
if (
|
|
3372
|
-
|
|
3371
|
+
if (kr) return Ae;
|
|
3372
|
+
kr = 1, Object.defineProperty(Ae, "__esModule", { value: !0 });
|
|
3373
3373
|
const e = /* @__PURE__ */ as(), t = /* @__PURE__ */ os(), m = [
|
|
3374
3374
|
"$schema",
|
|
3375
3375
|
"$id",
|
|
@@ -3727,7 +3727,7 @@ function _s() {
|
|
|
3727
3727
|
return ze.default = v, ze;
|
|
3728
3728
|
}
|
|
3729
3729
|
var Qe = {}, Ee = {}, Ur;
|
|
3730
|
-
function
|
|
3730
|
+
function Nn() {
|
|
3731
3731
|
if (Ur) return Ee;
|
|
3732
3732
|
Ur = 1, Object.defineProperty(Ee, "__esModule", { value: !0 }), Ee.validateAdditionalItems = void 0;
|
|
3733
3733
|
const e = /* @__PURE__ */ H(), t = /* @__PURE__ */ Y(), c = {
|
|
@@ -3767,7 +3767,7 @@ function kn() {
|
|
|
3767
3767
|
return Ee.validateAdditionalItems = b, Ee.default = c, Ee;
|
|
3768
3768
|
}
|
|
3769
3769
|
var Xe = {}, Pe = {}, Lr;
|
|
3770
|
-
function
|
|
3770
|
+
function kn() {
|
|
3771
3771
|
if (Lr) return Pe;
|
|
3772
3772
|
Lr = 1, Object.defineProperty(Pe, "__esModule", { value: !0 }), Pe.validateTuple = void 0;
|
|
3773
3773
|
const e = /* @__PURE__ */ H(), t = /* @__PURE__ */ Y(), m = /* @__PURE__ */ le(), c = {
|
|
@@ -3807,7 +3807,7 @@ var Kr;
|
|
|
3807
3807
|
function $s() {
|
|
3808
3808
|
if (Kr) return Xe;
|
|
3809
3809
|
Kr = 1, Object.defineProperty(Xe, "__esModule", { value: !0 });
|
|
3810
|
-
const e = /* @__PURE__ */
|
|
3810
|
+
const e = /* @__PURE__ */ kn(), t = {
|
|
3811
3811
|
keyword: "prefixItems",
|
|
3812
3812
|
type: "array",
|
|
3813
3813
|
schemaType: ["array"],
|
|
@@ -3820,7 +3820,7 @@ var xe = {}, Gr;
|
|
|
3820
3820
|
function ws() {
|
|
3821
3821
|
if (Gr) return xe;
|
|
3822
3822
|
Gr = 1, Object.defineProperty(xe, "__esModule", { value: !0 });
|
|
3823
|
-
const e = /* @__PURE__ */ H(), t = /* @__PURE__ */ Y(), m = /* @__PURE__ */ le(), c = /* @__PURE__ */
|
|
3823
|
+
const e = /* @__PURE__ */ H(), t = /* @__PURE__ */ Y(), m = /* @__PURE__ */ le(), c = /* @__PURE__ */ Nn(), s = {
|
|
3824
3824
|
keyword: "items",
|
|
3825
3825
|
type: "array",
|
|
3826
3826
|
schemaType: ["object", "boolean"],
|
|
@@ -4105,7 +4105,7 @@ function Ps() {
|
|
|
4105
4105
|
return nt.default = b, nt;
|
|
4106
4106
|
}
|
|
4107
4107
|
var st = {}, Zr;
|
|
4108
|
-
function
|
|
4108
|
+
function Ns() {
|
|
4109
4109
|
if (Zr) return st;
|
|
4110
4110
|
Zr = 1, Object.defineProperty(st, "__esModule", { value: !0 });
|
|
4111
4111
|
const e = /* @__PURE__ */ le(), t = /* @__PURE__ */ H(), m = /* @__PURE__ */ Y(), c = /* @__PURE__ */ Y(), b = {
|
|
@@ -4146,7 +4146,7 @@ function ks() {
|
|
|
4146
4146
|
return st.default = b, st;
|
|
4147
4147
|
}
|
|
4148
4148
|
var at = {}, Qr;
|
|
4149
|
-
function
|
|
4149
|
+
function ks() {
|
|
4150
4150
|
if (Qr) return at;
|
|
4151
4151
|
Qr = 1, Object.defineProperty(at, "__esModule", { value: !0 });
|
|
4152
4152
|
const e = /* @__PURE__ */ Y(), t = {
|
|
@@ -4306,7 +4306,7 @@ var nn;
|
|
|
4306
4306
|
function qs() {
|
|
4307
4307
|
if (nn) return Qe;
|
|
4308
4308
|
nn = 1, Object.defineProperty(Qe, "__esModule", { value: !0 });
|
|
4309
|
-
const e = /* @__PURE__ */
|
|
4309
|
+
const e = /* @__PURE__ */ Nn(), t = /* @__PURE__ */ $s(), m = /* @__PURE__ */ kn(), c = /* @__PURE__ */ ws(), b = /* @__PURE__ */ bs(), s = /* @__PURE__ */ Ss(), l = /* @__PURE__ */ Es(), u = /* @__PURE__ */ Rn(), h = /* @__PURE__ */ Ps(), $ = /* @__PURE__ */ Ns(), v = /* @__PURE__ */ ks(), P = /* @__PURE__ */ Rs(), _ = /* @__PURE__ */ Os(), y = /* @__PURE__ */ Ts(), g = /* @__PURE__ */ js(), w = /* @__PURE__ */ Is();
|
|
4310
4310
|
function a(i = !1) {
|
|
4311
4311
|
const r = [
|
|
4312
4312
|
// any
|
|
@@ -4885,8 +4885,9 @@ function ya(e) {
|
|
|
4885
4885
|
}
|
|
4886
4886
|
const ga = $n(wn(import.meta.url)), va = Dn(de(ga, "testing.js")).href, zt = process.cwd(), { engineConfig: Vt, webServers: Ft } = ya(zt);
|
|
4887
4887
|
process.argv.includes("--dry-run") && (console.log(JSON.stringify({ engineConfig: Vt, webServers: Ft }, null, 2)), process.exit(0));
|
|
4888
|
-
|
|
4889
|
-
|
|
4888
|
+
const _a = /* @__PURE__ */ new Set(["--dry-run", "--serve"]), $a = process.argv.slice(2).filter((e) => !_a.has(e));
|
|
4889
|
+
process.argv.includes("--serve") ? Un(Vt, Ft) : wa(Ft, Vt);
|
|
4890
|
+
function wa(e, t) {
|
|
4890
4891
|
const m = de(zt, ".adapter-tester/run");
|
|
4891
4892
|
Cn(m, { recursive: !0 }), Jt(
|
|
4892
4893
|
de(m, "playwright.config.js"),
|
|
@@ -4915,7 +4916,13 @@ await runVisualRegression(${JSON.stringify(t, null, 2)});
|
|
|
4915
4916
|
);
|
|
4916
4917
|
const c = qn(
|
|
4917
4918
|
"npx",
|
|
4918
|
-
[
|
|
4919
|
+
[
|
|
4920
|
+
"playwright",
|
|
4921
|
+
"test",
|
|
4922
|
+
"--config",
|
|
4923
|
+
de(m, "playwright.config.js"),
|
|
4924
|
+
...$a
|
|
4925
|
+
],
|
|
4919
4926
|
{ stdio: "inherit", cwd: zt, shell: process.platform === "win32" }
|
|
4920
4927
|
);
|
|
4921
4928
|
process.exit(c.status ?? 1);
|