@wp-playground/blueprints 0.6.10 → 0.6.14
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/index.cjs +7 -0
- package/index.d.ts +4 -4
- package/index.js +287 -280
- package/lib/steps/import-wordpress-files.d.ts +4 -4
- package/package.json +2 -2
package/index.js
CHANGED
|
@@ -858,14 +858,14 @@ echo json_encode($deactivated_plugins);
|
|
|
858
858
|
PATH_CURRENT_SITE: r
|
|
859
859
|
}
|
|
860
860
|
});
|
|
861
|
-
const p = new URL(await e.absoluteUrl),
|
|
861
|
+
const p = new URL(await e.absoluteUrl), $ = isURLScoped(p) ? "scope:" + getURLScope(p) : null;
|
|
862
862
|
await e.writeFile(
|
|
863
863
|
joinPaths(s, "/wp-content/sunrise.php"),
|
|
864
864
|
`<?php
|
|
865
865
|
if ( !defined( 'BLOG_ID_CURRENT_SITE' ) ) {
|
|
866
866
|
define( 'BLOG_ID_CURRENT_SITE', 1 );
|
|
867
867
|
}
|
|
868
|
-
$folder = ${phpVar(
|
|
868
|
+
$folder = ${phpVar($)};
|
|
869
869
|
if ($folder && strpos($_SERVER['REQUEST_URI'],"/$folder") === false) {
|
|
870
870
|
$_SERVER['HTTP_HOST'] = ${phpVar(p.hostname)};
|
|
871
871
|
$_SERVER['REQUEST_URI'] = "/$folder/" . ltrim($_SERVER['REQUEST_URI'], '/');
|
|
@@ -912,6 +912,7 @@ const cp = async (e, { fromPath: t, toPath: r }) => {
|
|
|
912
912
|
await e.run({
|
|
913
913
|
code: `<?php
|
|
914
914
|
require ${phpVar(n)} . '/wp-load.php';
|
|
915
|
+
kses_remove_filters();
|
|
915
916
|
$admin_id = get_users(array('role' => 'Administrator') )[0];
|
|
916
917
|
$importer = new WXR_Importer( array(
|
|
917
918
|
'fetch_attachments' => true,
|
|
@@ -919,6 +920,12 @@ const cp = async (e, { fromPath: t, toPath: r }) => {
|
|
|
919
920
|
) );
|
|
920
921
|
$logger = new WP_Importer_Logger_CLI();
|
|
921
922
|
$importer->set_logger( $logger );
|
|
923
|
+
|
|
924
|
+
// Slashes from the imported content are lost if we don't call wp_slash here.
|
|
925
|
+
add_action( 'wp_insert_post_data', function( $data ) {
|
|
926
|
+
return wp_slash($data);
|
|
927
|
+
});
|
|
928
|
+
|
|
922
929
|
$result = $importer->import( '/tmp/import.wxr' );
|
|
923
930
|
`
|
|
924
931
|
});
|
|
@@ -1043,13 +1050,13 @@ const tmpPath = "/tmp/file.zip", unzip = async (e, { zipFile: t, zipPath: r, ext
|
|
|
1043
1050
|
}), s = joinPaths(s, r);
|
|
1044
1051
|
const i = joinPaths(s, "wp-content"), o = joinPaths(n, "wp-content");
|
|
1045
1052
|
for (const p of wpContentFilesExcludedFromExport) {
|
|
1046
|
-
const
|
|
1053
|
+
const $ = joinPaths(
|
|
1047
1054
|
i,
|
|
1048
1055
|
p
|
|
1049
1056
|
);
|
|
1050
|
-
await removePath(e,
|
|
1057
|
+
await removePath(e, $);
|
|
1051
1058
|
const O = joinPaths(o, p);
|
|
1052
|
-
await e.fileExists(O) && (await e.mkdir(dirname(
|
|
1059
|
+
await e.fileExists(O) && (await e.mkdir(dirname($)), await e.mv(O, $));
|
|
1053
1060
|
}
|
|
1054
1061
|
const l = joinPaths(
|
|
1055
1062
|
s,
|
|
@@ -1103,10 +1110,10 @@ async function installAsset(e, { targetPath: t, zipFile: r }) {
|
|
|
1103
1110
|
});
|
|
1104
1111
|
d = d.filter((N) => !N.endsWith("/__MACOSX"));
|
|
1105
1112
|
const u = d.length === 1 && await e.isDir(d[0]);
|
|
1106
|
-
let p,
|
|
1107
|
-
u ? (
|
|
1113
|
+
let p, $ = "";
|
|
1114
|
+
u ? ($ = d[0], p = d[0].split("/").pop()) : ($ = l, p = s);
|
|
1108
1115
|
const O = `${t}/${p}`;
|
|
1109
|
-
return await e.mv(
|
|
1116
|
+
return await e.mv($, O), {
|
|
1110
1117
|
assetFolderPath: O,
|
|
1111
1118
|
assetFolderName: p
|
|
1112
1119
|
};
|
|
@@ -1825,7 +1832,7 @@ function fileToUint8Array(e) {
|
|
|
1825
1832
|
}, r.readAsArrayBuffer(e);
|
|
1826
1833
|
});
|
|
1827
1834
|
}
|
|
1828
|
-
var Pe, Ke, dt, De, Je, ve, Qe, Fe, mt, xt, _t, Wt,
|
|
1835
|
+
var Pe, Ke, dt, De, Je, ve, Qe, Fe, mt, xt, _t, Wt, $t, Bt;
|
|
1829
1836
|
class PHPRequestHandler {
|
|
1830
1837
|
/**
|
|
1831
1838
|
* @param php - The PHP instance.
|
|
@@ -1856,7 +1863,7 @@ class PHPRequestHandler {
|
|
|
1856
1863
|
* @throws {Error} If the requested path doesn't exist.
|
|
1857
1864
|
* @returns The resolved filesystem path.
|
|
1858
1865
|
*/
|
|
1859
|
-
Q(this,
|
|
1866
|
+
Q(this, $t);
|
|
1860
1867
|
Q(this, Pe, void 0);
|
|
1861
1868
|
Q(this, Ke, void 0);
|
|
1862
1869
|
Q(this, dt, void 0);
|
|
@@ -1971,7 +1978,7 @@ Pe = new WeakMap(), Ke = new WeakMap(), dt = new WeakMap(), De = new WeakMap(),
|
|
|
1971
1978
|
}
|
|
1972
1979
|
let d;
|
|
1973
1980
|
try {
|
|
1974
|
-
d = ce(this,
|
|
1981
|
+
d = ce(this, $t, Bt).call(this, r.pathname);
|
|
1975
1982
|
} catch {
|
|
1976
1983
|
return new PHPResponse(
|
|
1977
1984
|
404,
|
|
@@ -1993,7 +2000,7 @@ Pe = new WeakMap(), Ke = new WeakMap(), dt = new WeakMap(), De = new WeakMap(),
|
|
|
1993
2000
|
} finally {
|
|
1994
2001
|
n();
|
|
1995
2002
|
}
|
|
1996
|
-
},
|
|
2003
|
+
}, $t = new WeakSet(), Bt = function(t) {
|
|
1997
2004
|
let r = removePathPrefix(t, H(this, ve));
|
|
1998
2005
|
r = applyRewriteRules(r, this.rewriteRules), r.includes(".php") ? r = r.split(".php")[0] + ".php" : this.php.isDir(`${H(this, Pe)}${r}`) ? (r.endsWith("/") || (r = `${r}/`), r = `${r}index.php`) : r = "/index.php";
|
|
1999
2006
|
const n = `${H(this, Pe)}${r}`;
|
|
@@ -2149,8 +2156,8 @@ function rethrowFileSystemError(e = "") {
|
|
|
2149
2156
|
} catch (l) {
|
|
2150
2157
|
const d = typeof l == "object" ? l == null ? void 0 : l.errno : null;
|
|
2151
2158
|
if (d in FileErrorCodes) {
|
|
2152
|
-
const u = FileErrorCodes[d], p = typeof o[0] == "string" ? o[0] : null,
|
|
2153
|
-
throw new Error(`${
|
|
2159
|
+
const u = FileErrorCodes[d], p = typeof o[0] == "string" ? o[0] : null, $ = p !== null ? e.replaceAll("{path}", p) : e;
|
|
2160
|
+
throw new Error(`${$}: ${u}`, {
|
|
2154
2161
|
cause: l
|
|
2155
2162
|
});
|
|
2156
2163
|
}
|
|
@@ -2173,7 +2180,7 @@ var __defProp = Object.defineProperty, __getOwnPropDesc = Object.getOwnPropertyD
|
|
|
2173
2180
|
return n && s && __defProp(t, r, s), s;
|
|
2174
2181
|
};
|
|
2175
2182
|
const STRING = "string", NUMBER = "number", __private__dont__use = Symbol("__private__dont__use");
|
|
2176
|
-
var Me, Ze, Ye, be, Re, Te, Ee, Xe,
|
|
2183
|
+
var Me, Ze, Ye, be, Re, Te, Ee, Xe, gt, Gt, yt, Kt, vt, Jt, wt, Qt, Pt, Zt, bt, Yt, Et, Xt, St, er, Rt, tr, Tt, rr, kt, nr, Ct, sr;
|
|
2177
2184
|
class BasePHP {
|
|
2178
2185
|
/**
|
|
2179
2186
|
* Initializes a PHP runtime.
|
|
@@ -2183,7 +2190,7 @@ class BasePHP {
|
|
|
2183
2190
|
* @param serverOptions - Optional. Options for the PHPRequestHandler. If undefined, no request handler will be initialized.
|
|
2184
2191
|
*/
|
|
2185
2192
|
constructor(e, t) {
|
|
2186
|
-
Q(this,
|
|
2193
|
+
Q(this, gt);
|
|
2187
2194
|
Q(this, yt);
|
|
2188
2195
|
Q(this, vt);
|
|
2189
2196
|
Q(this, wt);
|
|
@@ -2308,7 +2315,7 @@ class BasePHP {
|
|
|
2308
2315
|
const t = await this.semaphore.acquire();
|
|
2309
2316
|
let r;
|
|
2310
2317
|
try {
|
|
2311
|
-
if (H(this, be) || (ce(this,
|
|
2318
|
+
if (H(this, be) || (ce(this, gt, Gt).call(this), te(this, be, !0)), e.scriptPath && !this.fileExists(e.scriptPath))
|
|
2312
2319
|
throw new Error(
|
|
2313
2320
|
`The script path "${e.scriptPath}" does not exist.`
|
|
2314
2321
|
);
|
|
@@ -2461,7 +2468,7 @@ class BasePHP {
|
|
|
2461
2468
|
te(this, be, !1), te(this, Re, null), delete this[__private__dont__use].onMessage, delete this[__private__dont__use];
|
|
2462
2469
|
}
|
|
2463
2470
|
}
|
|
2464
|
-
Me = new WeakMap(), Ze = new WeakMap(), Ye = new WeakMap(), be = new WeakMap(), Re = new WeakMap(), Te = new WeakMap(), Ee = new WeakMap(), Xe = new WeakMap(),
|
|
2471
|
+
Me = new WeakMap(), Ze = new WeakMap(), Ye = new WeakMap(), be = new WeakMap(), Re = new WeakMap(), Te = new WeakMap(), Ee = new WeakMap(), Xe = new WeakMap(), gt = new WeakSet(), Gt = function() {
|
|
2465
2472
|
if (this.setPhpIniEntry("auto_prepend_file", "/internal/consts.php"), this.fileExists("/internal/consts.php") || this.writeFile(
|
|
2466
2473
|
"/internal/consts.php",
|
|
2467
2474
|
`<?php
|
|
@@ -2952,10 +2959,10 @@ var ajv$1 = { exports: {} }, core$2 = {}, validate = {}, boolSchema = {}, errors
|
|
|
2952
2959
|
}
|
|
2953
2960
|
e._CodeOrName = t, e.IDENTIFIER = /^[a-z$_][a-z$_0-9]*$/i;
|
|
2954
2961
|
class r extends t {
|
|
2955
|
-
constructor(
|
|
2956
|
-
if (super(), !e.IDENTIFIER.test(
|
|
2962
|
+
constructor(g) {
|
|
2963
|
+
if (super(), !e.IDENTIFIER.test(g))
|
|
2957
2964
|
throw new Error("CodeGen: name must be a valid identifier");
|
|
2958
|
-
this.str =
|
|
2965
|
+
this.str = g;
|
|
2959
2966
|
}
|
|
2960
2967
|
toString() {
|
|
2961
2968
|
return this.str;
|
|
@@ -2969,8 +2976,8 @@ var ajv$1 = { exports: {} }, core$2 = {}, validate = {}, boolSchema = {}, errors
|
|
|
2969
2976
|
}
|
|
2970
2977
|
e.Name = r;
|
|
2971
2978
|
class n extends t {
|
|
2972
|
-
constructor(
|
|
2973
|
-
super(), this._items = typeof
|
|
2979
|
+
constructor(g) {
|
|
2980
|
+
super(), this._items = typeof g == "string" ? [g] : g;
|
|
2974
2981
|
}
|
|
2975
2982
|
toString() {
|
|
2976
2983
|
return this.str;
|
|
@@ -2978,69 +2985,69 @@ var ajv$1 = { exports: {} }, core$2 = {}, validate = {}, boolSchema = {}, errors
|
|
|
2978
2985
|
emptyStr() {
|
|
2979
2986
|
if (this._items.length > 1)
|
|
2980
2987
|
return !1;
|
|
2981
|
-
const
|
|
2982
|
-
return
|
|
2988
|
+
const g = this._items[0];
|
|
2989
|
+
return g === "" || g === '""';
|
|
2983
2990
|
}
|
|
2984
2991
|
get str() {
|
|
2985
|
-
var
|
|
2986
|
-
return (
|
|
2992
|
+
var g;
|
|
2993
|
+
return (g = this._str) !== null && g !== void 0 ? g : this._str = this._items.reduce((P, I) => `${P}${I}`, "");
|
|
2987
2994
|
}
|
|
2988
2995
|
get names() {
|
|
2989
|
-
var
|
|
2990
|
-
return (
|
|
2996
|
+
var g;
|
|
2997
|
+
return (g = this._names) !== null && g !== void 0 ? g : this._names = this._items.reduce((P, I) => (I instanceof r && (P[I.str] = (P[I.str] || 0) + 1), P), {});
|
|
2991
2998
|
}
|
|
2992
2999
|
}
|
|
2993
3000
|
e._Code = n, e.nil = new n("");
|
|
2994
|
-
function s(_,
|
|
3001
|
+
function s(_, ...g) {
|
|
2995
3002
|
const P = [_[0]];
|
|
2996
3003
|
let I = 0;
|
|
2997
|
-
for (; I <
|
|
2998
|
-
l(P,
|
|
3004
|
+
for (; I < g.length; )
|
|
3005
|
+
l(P, g[I]), P.push(_[++I]);
|
|
2999
3006
|
return new n(P);
|
|
3000
3007
|
}
|
|
3001
3008
|
e._ = s;
|
|
3002
3009
|
const i = new n("+");
|
|
3003
|
-
function o(_,
|
|
3010
|
+
function o(_, ...g) {
|
|
3004
3011
|
const P = [N(_[0])];
|
|
3005
3012
|
let I = 0;
|
|
3006
|
-
for (; I <
|
|
3007
|
-
P.push(i), l(P,
|
|
3013
|
+
for (; I < g.length; )
|
|
3014
|
+
P.push(i), l(P, g[I]), P.push(i, N(_[++I]));
|
|
3008
3015
|
return d(P), new n(P);
|
|
3009
3016
|
}
|
|
3010
3017
|
e.str = o;
|
|
3011
|
-
function l(_,
|
|
3012
|
-
|
|
3018
|
+
function l(_, g) {
|
|
3019
|
+
g instanceof n ? _.push(...g._items) : g instanceof r ? _.push(g) : _.push($(g));
|
|
3013
3020
|
}
|
|
3014
3021
|
e.addCodeArg = l;
|
|
3015
3022
|
function d(_) {
|
|
3016
|
-
let
|
|
3017
|
-
for (;
|
|
3018
|
-
if (_[
|
|
3019
|
-
const P = u(_[
|
|
3023
|
+
let g = 1;
|
|
3024
|
+
for (; g < _.length - 1; ) {
|
|
3025
|
+
if (_[g] === i) {
|
|
3026
|
+
const P = u(_[g - 1], _[g + 1]);
|
|
3020
3027
|
if (P !== void 0) {
|
|
3021
|
-
_.splice(
|
|
3028
|
+
_.splice(g - 1, 3, P);
|
|
3022
3029
|
continue;
|
|
3023
3030
|
}
|
|
3024
|
-
_[
|
|
3031
|
+
_[g++] = "+";
|
|
3025
3032
|
}
|
|
3026
|
-
|
|
3033
|
+
g++;
|
|
3027
3034
|
}
|
|
3028
3035
|
}
|
|
3029
|
-
function u(_,
|
|
3030
|
-
if (
|
|
3036
|
+
function u(_, g) {
|
|
3037
|
+
if (g === '""')
|
|
3031
3038
|
return _;
|
|
3032
3039
|
if (_ === '""')
|
|
3033
|
-
return
|
|
3040
|
+
return g;
|
|
3034
3041
|
if (typeof _ == "string")
|
|
3035
|
-
return
|
|
3036
|
-
if (typeof
|
|
3037
|
-
return `"${_}${
|
|
3042
|
+
return g instanceof r || _[_.length - 1] !== '"' ? void 0 : typeof g != "string" ? `${_.slice(0, -1)}${g}"` : g[0] === '"' ? _.slice(0, -1) + g.slice(1) : void 0;
|
|
3043
|
+
if (typeof g == "string" && g[0] === '"' && !(_ instanceof r))
|
|
3044
|
+
return `"${_}${g.slice(1)}`;
|
|
3038
3045
|
}
|
|
3039
|
-
function p(_,
|
|
3040
|
-
return
|
|
3046
|
+
function p(_, g) {
|
|
3047
|
+
return g.emptyStr() ? _ : _.emptyStr() ? g : o`${_}${g}`;
|
|
3041
3048
|
}
|
|
3042
3049
|
e.strConcat = p;
|
|
3043
|
-
function
|
|
3050
|
+
function $(_) {
|
|
3044
3051
|
return typeof _ == "number" || typeof _ == "boolean" || _ === null ? _ : N(Array.isArray(_) ? _.join(",") : _);
|
|
3045
3052
|
}
|
|
3046
3053
|
function O(_) {
|
|
@@ -3098,8 +3105,8 @@ var scope = {};
|
|
|
3098
3105
|
return `${u}${p.index++}`;
|
|
3099
3106
|
}
|
|
3100
3107
|
_nameGroup(u) {
|
|
3101
|
-
var p,
|
|
3102
|
-
if (!((
|
|
3108
|
+
var p, $;
|
|
3109
|
+
if (!(($ = (p = this._parent) === null || p === void 0 ? void 0 : p._prefixes) === null || $ === void 0) && $.has(u) || this._prefixes && !this._prefixes.has(u))
|
|
3103
3110
|
throw new Error(`CodeGen: prefix "${u}" is not allowed in this scope`);
|
|
3104
3111
|
return this._names[u] = { prefix: u, index: 0 };
|
|
3105
3112
|
}
|
|
@@ -3109,8 +3116,8 @@ var scope = {};
|
|
|
3109
3116
|
constructor(u, p) {
|
|
3110
3117
|
super(p), this.prefix = u;
|
|
3111
3118
|
}
|
|
3112
|
-
setValue(u, { property: p, itemIndex:
|
|
3113
|
-
this.value = u, this.scopePath = (0, t._)`.${new t.Name(p)}[${
|
|
3119
|
+
setValue(u, { property: p, itemIndex: $ }) {
|
|
3120
|
+
this.value = u, this.scopePath = (0, t._)`.${new t.Name(p)}[${$}]`;
|
|
3114
3121
|
}
|
|
3115
3122
|
}
|
|
3116
3123
|
e.ValueScopeName = i;
|
|
@@ -3126,15 +3133,15 @@ var scope = {};
|
|
|
3126
3133
|
return new i(u, this._newName(u));
|
|
3127
3134
|
}
|
|
3128
3135
|
value(u, p) {
|
|
3129
|
-
var
|
|
3136
|
+
var $;
|
|
3130
3137
|
if (p.ref === void 0)
|
|
3131
3138
|
throw new Error("CodeGen: ref must be passed in value");
|
|
3132
|
-
const O = this.toName(u), { prefix: N } = O, R = (
|
|
3139
|
+
const O = this.toName(u), { prefix: N } = O, R = ($ = p.key) !== null && $ !== void 0 ? $ : p.ref;
|
|
3133
3140
|
let T = this._values[N];
|
|
3134
3141
|
if (T) {
|
|
3135
|
-
const
|
|
3136
|
-
if (
|
|
3137
|
-
return
|
|
3142
|
+
const g = T.get(R);
|
|
3143
|
+
if (g)
|
|
3144
|
+
return g;
|
|
3138
3145
|
} else
|
|
3139
3146
|
T = this._values[N] = /* @__PURE__ */ new Map();
|
|
3140
3147
|
T.set(R, O);
|
|
@@ -3142,41 +3149,41 @@ var scope = {};
|
|
|
3142
3149
|
return y[_] = p.ref, O.setValue(p, { property: N, itemIndex: _ }), O;
|
|
3143
3150
|
}
|
|
3144
3151
|
getValue(u, p) {
|
|
3145
|
-
const
|
|
3146
|
-
if (
|
|
3147
|
-
return
|
|
3152
|
+
const $ = this._values[u];
|
|
3153
|
+
if ($)
|
|
3154
|
+
return $.get(p);
|
|
3148
3155
|
}
|
|
3149
3156
|
scopeRefs(u, p = this._values) {
|
|
3150
|
-
return this._reduceValues(p, (
|
|
3151
|
-
if (
|
|
3152
|
-
throw new Error(`CodeGen: name "${
|
|
3153
|
-
return (0, t._)`${u}${
|
|
3157
|
+
return this._reduceValues(p, ($) => {
|
|
3158
|
+
if ($.scopePath === void 0)
|
|
3159
|
+
throw new Error(`CodeGen: name "${$}" has no value`);
|
|
3160
|
+
return (0, t._)`${u}${$.scopePath}`;
|
|
3154
3161
|
});
|
|
3155
3162
|
}
|
|
3156
|
-
scopeCode(u = this._values, p,
|
|
3163
|
+
scopeCode(u = this._values, p, $) {
|
|
3157
3164
|
return this._reduceValues(u, (O) => {
|
|
3158
3165
|
if (O.value === void 0)
|
|
3159
3166
|
throw new Error(`CodeGen: name "${O}" has no value`);
|
|
3160
3167
|
return O.value.code;
|
|
3161
|
-
}, p,
|
|
3168
|
+
}, p, $);
|
|
3162
3169
|
}
|
|
3163
|
-
_reduceValues(u, p,
|
|
3170
|
+
_reduceValues(u, p, $ = {}, O) {
|
|
3164
3171
|
let N = t.nil;
|
|
3165
3172
|
for (const R in u) {
|
|
3166
3173
|
const T = u[R];
|
|
3167
3174
|
if (!T)
|
|
3168
3175
|
continue;
|
|
3169
|
-
const y =
|
|
3176
|
+
const y = $[R] = $[R] || /* @__PURE__ */ new Map();
|
|
3170
3177
|
T.forEach((_) => {
|
|
3171
3178
|
if (y.has(_))
|
|
3172
3179
|
return;
|
|
3173
3180
|
y.set(_, n.Started);
|
|
3174
|
-
let
|
|
3175
|
-
if (
|
|
3181
|
+
let g = p(_);
|
|
3182
|
+
if (g) {
|
|
3176
3183
|
const P = this.opts.es5 ? e.varKinds.var : e.varKinds.const;
|
|
3177
|
-
N = (0, t._)`${N}${P} ${_} = ${
|
|
3178
|
-
} else if (
|
|
3179
|
-
N = (0, t._)`${N}${
|
|
3184
|
+
N = (0, t._)`${N}${P} ${_} = ${g};${this.opts._n}`;
|
|
3185
|
+
} else if (g = O == null ? void 0 : O(_))
|
|
3186
|
+
N = (0, t._)`${N}${g}${this.opts._n}`;
|
|
3180
3187
|
else
|
|
3181
3188
|
throw new r(_);
|
|
3182
3189
|
y.set(_, n.Completed);
|
|
@@ -3293,7 +3300,7 @@ var scope = {};
|
|
|
3293
3300
|
return `break${this.label ? ` ${this.label}` : ""};` + a;
|
|
3294
3301
|
}
|
|
3295
3302
|
}
|
|
3296
|
-
class
|
|
3303
|
+
class $ extends i {
|
|
3297
3304
|
constructor(a) {
|
|
3298
3305
|
super(), this.error = a;
|
|
3299
3306
|
}
|
|
@@ -3394,10 +3401,10 @@ var scope = {};
|
|
|
3394
3401
|
}
|
|
3395
3402
|
}
|
|
3396
3403
|
_.kind = "if";
|
|
3397
|
-
class
|
|
3404
|
+
class g extends R {
|
|
3398
3405
|
}
|
|
3399
|
-
|
|
3400
|
-
class P extends
|
|
3406
|
+
g.kind = "for";
|
|
3407
|
+
class P extends g {
|
|
3401
3408
|
constructor(a) {
|
|
3402
3409
|
super(), this.iteration = a;
|
|
3403
3410
|
}
|
|
@@ -3412,7 +3419,7 @@ var scope = {};
|
|
|
3412
3419
|
return K(super.names, this.iteration.names);
|
|
3413
3420
|
}
|
|
3414
3421
|
}
|
|
3415
|
-
class I extends
|
|
3422
|
+
class I extends g {
|
|
3416
3423
|
constructor(a, h, C, M) {
|
|
3417
3424
|
super(), this.varKind = a, this.name = h, this.from = C, this.to = M;
|
|
3418
3425
|
}
|
|
@@ -3425,7 +3432,7 @@ var scope = {};
|
|
|
3425
3432
|
return ue(a, this.to);
|
|
3426
3433
|
}
|
|
3427
3434
|
}
|
|
3428
|
-
class D extends
|
|
3435
|
+
class D extends g {
|
|
3429
3436
|
constructor(a, h, C, M) {
|
|
3430
3437
|
super(), this.loop = a, this.varKind = h, this.name = C, this.iterable = M;
|
|
3431
3438
|
}
|
|
@@ -3610,7 +3617,7 @@ var scope = {};
|
|
|
3610
3617
|
}
|
|
3611
3618
|
// end `for` loop
|
|
3612
3619
|
endFor() {
|
|
3613
|
-
return this._endBlockNode(
|
|
3620
|
+
return this._endBlockNode(g);
|
|
3614
3621
|
}
|
|
3615
3622
|
// `label` statement
|
|
3616
3623
|
label(a) {
|
|
@@ -3640,7 +3647,7 @@ var scope = {};
|
|
|
3640
3647
|
}
|
|
3641
3648
|
// `throw` statement
|
|
3642
3649
|
throw(a) {
|
|
3643
|
-
return this._leafNode(new
|
|
3650
|
+
return this._leafNode(new $(a));
|
|
3644
3651
|
}
|
|
3645
3652
|
// start self-balancing block
|
|
3646
3653
|
block(a, h) {
|
|
@@ -3803,13 +3810,13 @@ var util = {};
|
|
|
3803
3810
|
}
|
|
3804
3811
|
e.unescapeFragment = u;
|
|
3805
3812
|
function p(w) {
|
|
3806
|
-
return encodeURIComponent(
|
|
3813
|
+
return encodeURIComponent($(w));
|
|
3807
3814
|
}
|
|
3808
3815
|
e.escapeFragment = p;
|
|
3809
|
-
function
|
|
3816
|
+
function $(w) {
|
|
3810
3817
|
return typeof w == "number" ? `${w}` : w.replace(/~/g, "~0").replace(/\//g, "~1");
|
|
3811
3818
|
}
|
|
3812
|
-
e.escapeJsonPointer =
|
|
3819
|
+
e.escapeJsonPointer = $;
|
|
3813
3820
|
function O(w) {
|
|
3814
3821
|
return w.replace(/~1/g, "/").replace(/~0/g, "~");
|
|
3815
3822
|
}
|
|
@@ -3858,13 +3865,13 @@ var util = {};
|
|
|
3858
3865
|
}
|
|
3859
3866
|
e.setEvaluated = y;
|
|
3860
3867
|
const _ = {};
|
|
3861
|
-
function
|
|
3868
|
+
function g(w, k) {
|
|
3862
3869
|
return w.scopeValue("func", {
|
|
3863
3870
|
ref: k,
|
|
3864
3871
|
code: _[k.code] || (_[k.code] = new r._Code(k.code))
|
|
3865
3872
|
});
|
|
3866
3873
|
}
|
|
3867
|
-
e.useFunc =
|
|
3874
|
+
e.useFunc = g;
|
|
3868
3875
|
var P;
|
|
3869
3876
|
(function(w) {
|
|
3870
3877
|
w[w.Num = 0] = "Num", w[w.Str = 1] = "Str";
|
|
@@ -3874,7 +3881,7 @@ var util = {};
|
|
|
3874
3881
|
const V = k === P.Num;
|
|
3875
3882
|
return A ? V ? (0, t._)`"[" + ${w} + "]"` : (0, t._)`"['" + ${w} + "']"` : V ? (0, t._)`"/" + ${w}` : (0, t._)`"/" + ${w}.replace(/~/g, "~0").replace(/\\//g, "~1")`;
|
|
3876
3883
|
}
|
|
3877
|
-
return A ? (0, t.getProperty)(w).toString() : "/" +
|
|
3884
|
+
return A ? (0, t.getProperty)(w).toString() : "/" + $(w);
|
|
3878
3885
|
}
|
|
3879
3886
|
e.getErrorPath = I;
|
|
3880
3887
|
function D(w, k, A = w.opts.strictSchema) {
|
|
@@ -3920,13 +3927,13 @@ names$1.default = names;
|
|
|
3920
3927
|
}, e.keyword$DataError = {
|
|
3921
3928
|
message: ({ keyword: y, schemaType: _ }) => _ ? (0, t.str)`"${y}" keyword must be ${_} ($data)` : (0, t.str)`"${y}" keyword is invalid ($data)`
|
|
3922
3929
|
};
|
|
3923
|
-
function s(y, _ = e.keywordError,
|
|
3924
|
-
const { it: I } = y, { gen: D, compositeRule: w, allErrors: k } = I, A =
|
|
3930
|
+
function s(y, _ = e.keywordError, g, P) {
|
|
3931
|
+
const { it: I } = y, { gen: D, compositeRule: w, allErrors: k } = I, A = $(y, _, g);
|
|
3925
3932
|
P ?? (w || k) ? d(D, A) : u(I, (0, t._)`[${A}]`);
|
|
3926
3933
|
}
|
|
3927
3934
|
e.reportError = s;
|
|
3928
|
-
function i(y, _ = e.keywordError,
|
|
3929
|
-
const { it: P } = y, { gen: I, compositeRule: D, allErrors: w } = P, k =
|
|
3935
|
+
function i(y, _ = e.keywordError, g) {
|
|
3936
|
+
const { it: P } = y, { gen: I, compositeRule: D, allErrors: w } = P, k = $(y, _, g);
|
|
3930
3937
|
d(I, k), D || w || u(P, n.default.vErrors);
|
|
3931
3938
|
}
|
|
3932
3939
|
e.reportExtraError = i;
|
|
@@ -3934,22 +3941,22 @@ names$1.default = names;
|
|
|
3934
3941
|
y.assign(n.default.errors, _), y.if((0, t._)`${n.default.vErrors} !== null`, () => y.if(_, () => y.assign((0, t._)`${n.default.vErrors}.length`, _), () => y.assign(n.default.vErrors, null)));
|
|
3935
3942
|
}
|
|
3936
3943
|
e.resetErrorsCount = o;
|
|
3937
|
-
function l({ gen: y, keyword: _, schemaValue:
|
|
3944
|
+
function l({ gen: y, keyword: _, schemaValue: g, data: P, errsCount: I, it: D }) {
|
|
3938
3945
|
if (I === void 0)
|
|
3939
3946
|
throw new Error("ajv implementation error");
|
|
3940
3947
|
const w = y.name("err");
|
|
3941
3948
|
y.forRange("i", I, n.default.errors, (k) => {
|
|
3942
|
-
y.const(w, (0, t._)`${n.default.vErrors}[${k}]`), y.if((0, t._)`${w}.instancePath === undefined`, () => y.assign((0, t._)`${w}.instancePath`, (0, t.strConcat)(n.default.instancePath, D.errorPath))), y.assign((0, t._)`${w}.schemaPath`, (0, t.str)`${D.errSchemaPath}/${_}`), D.opts.verbose && (y.assign((0, t._)`${w}.schema`,
|
|
3949
|
+
y.const(w, (0, t._)`${n.default.vErrors}[${k}]`), y.if((0, t._)`${w}.instancePath === undefined`, () => y.assign((0, t._)`${w}.instancePath`, (0, t.strConcat)(n.default.instancePath, D.errorPath))), y.assign((0, t._)`${w}.schemaPath`, (0, t.str)`${D.errSchemaPath}/${_}`), D.opts.verbose && (y.assign((0, t._)`${w}.schema`, g), y.assign((0, t._)`${w}.data`, P));
|
|
3943
3950
|
});
|
|
3944
3951
|
}
|
|
3945
3952
|
e.extendErrors = l;
|
|
3946
3953
|
function d(y, _) {
|
|
3947
|
-
const
|
|
3948
|
-
y.if((0, t._)`${n.default.vErrors} === null`, () => y.assign(n.default.vErrors, (0, t._)`[${
|
|
3954
|
+
const g = y.const("err", _);
|
|
3955
|
+
y.if((0, t._)`${n.default.vErrors} === null`, () => y.assign(n.default.vErrors, (0, t._)`[${g}]`), (0, t._)`${n.default.vErrors}.push(${g})`), y.code((0, t._)`${n.default.errors}++`);
|
|
3949
3956
|
}
|
|
3950
3957
|
function u(y, _) {
|
|
3951
|
-
const { gen:
|
|
3952
|
-
I.$async ?
|
|
3958
|
+
const { gen: g, validateName: P, schemaEnv: I } = y;
|
|
3959
|
+
I.$async ? g.throw((0, t._)`new ${y.ValidationError}(${_})`) : (g.assign((0, t._)`${P}.errors`, _), g.return(!1));
|
|
3953
3960
|
}
|
|
3954
3961
|
const p = {
|
|
3955
3962
|
keyword: new t.Name("keyword"),
|
|
@@ -3960,28 +3967,28 @@ names$1.default = names;
|
|
|
3960
3967
|
schema: new t.Name("schema"),
|
|
3961
3968
|
parentSchema: new t.Name("parentSchema")
|
|
3962
3969
|
};
|
|
3963
|
-
function
|
|
3970
|
+
function $(y, _, g) {
|
|
3964
3971
|
const { createErrors: P } = y.it;
|
|
3965
|
-
return P === !1 ? (0, t._)`{}` : O(y, _,
|
|
3972
|
+
return P === !1 ? (0, t._)`{}` : O(y, _, g);
|
|
3966
3973
|
}
|
|
3967
|
-
function O(y, _,
|
|
3974
|
+
function O(y, _, g = {}) {
|
|
3968
3975
|
const { gen: P, it: I } = y, D = [
|
|
3969
|
-
N(I,
|
|
3970
|
-
R(y,
|
|
3976
|
+
N(I, g),
|
|
3977
|
+
R(y, g)
|
|
3971
3978
|
];
|
|
3972
3979
|
return T(y, _, D), P.object(...D);
|
|
3973
3980
|
}
|
|
3974
3981
|
function N({ errorPath: y }, { instancePath: _ }) {
|
|
3975
|
-
const
|
|
3976
|
-
return [n.default.instancePath, (0, t.strConcat)(n.default.instancePath,
|
|
3982
|
+
const g = _ ? (0, t.str)`${y}${(0, r.getErrorPath)(_, r.Type.Str)}` : y;
|
|
3983
|
+
return [n.default.instancePath, (0, t.strConcat)(n.default.instancePath, g)];
|
|
3977
3984
|
}
|
|
3978
|
-
function R({ keyword: y, it: { errSchemaPath: _ } }, { schemaPath:
|
|
3985
|
+
function R({ keyword: y, it: { errSchemaPath: _ } }, { schemaPath: g, parentSchema: P }) {
|
|
3979
3986
|
let I = P ? _ : (0, t.str)`${_}/${y}`;
|
|
3980
|
-
return
|
|
3987
|
+
return g && (I = (0, t.str)`${I}${(0, r.getErrorPath)(g, r.Type.Str)}`), [p.schemaPath, I];
|
|
3981
3988
|
}
|
|
3982
|
-
function T(y, { params: _, message:
|
|
3989
|
+
function T(y, { params: _, message: g }, P) {
|
|
3983
3990
|
const { keyword: I, data: D, schemaValue: w, it: k } = y, { opts: A, propertyName: V, topSchemaRef: x, schemaPath: re } = k;
|
|
3984
|
-
P.push([p.keyword, I], [p.params, typeof _ == "function" ? _(y) : _ || (0, t._)`{}`]), A.messages && P.push([p.message, typeof
|
|
3991
|
+
P.push([p.keyword, I], [p.params, typeof _ == "function" ? _(y) : _ || (0, t._)`{}`]), A.messages && P.push([p.message, typeof g == "function" ? g(y) : g]), A.verbose && P.push([p.schema, w], [p.parentSchema, (0, t._)`${x}${re}`], [n.default.data, D]), V && P.push([p.propertyName, V]);
|
|
3985
3992
|
}
|
|
3986
3993
|
})(errors);
|
|
3987
3994
|
Object.defineProperty(boolSchema, "__esModule", { value: !0 });
|
|
@@ -4081,7 +4088,7 @@ applicability.shouldUseRule = shouldUseRule;
|
|
|
4081
4088
|
}
|
|
4082
4089
|
e.getJSONTypes = d;
|
|
4083
4090
|
function u(P, I) {
|
|
4084
|
-
const { gen: D, data: w, opts: k } = P, A =
|
|
4091
|
+
const { gen: D, data: w, opts: k } = P, A = $(I, k.coerceTypes), V = I.length > 0 && !(A.length === 0 && I.length === 1 && (0, r.schemaHasRulesForType)(P, I[0]));
|
|
4085
4092
|
if (V) {
|
|
4086
4093
|
const x = T(I, w, k.strictNumbers, o.Wrong);
|
|
4087
4094
|
D.if(x, () => {
|
|
@@ -4092,7 +4099,7 @@ applicability.shouldUseRule = shouldUseRule;
|
|
|
4092
4099
|
}
|
|
4093
4100
|
e.coerceAndCheckDataType = u;
|
|
4094
4101
|
const p = /* @__PURE__ */ new Set(["string", "number", "integer", "boolean", "null"]);
|
|
4095
|
-
function
|
|
4102
|
+
function $(P, I) {
|
|
4096
4103
|
return I ? P.filter((D) => p.has(D) || I === "array" && D === "array") : [];
|
|
4097
4104
|
}
|
|
4098
4105
|
function O(P, I, D) {
|
|
@@ -4179,11 +4186,11 @@ applicability.shouldUseRule = shouldUseRule;
|
|
|
4179
4186
|
params: ({ schema: P, schemaValue: I }) => typeof P == "string" ? (0, s._)`{type: ${P}}` : (0, s._)`{type: ${I}}`
|
|
4180
4187
|
};
|
|
4181
4188
|
function _(P) {
|
|
4182
|
-
const I =
|
|
4189
|
+
const I = g(P);
|
|
4183
4190
|
(0, n.reportError)(I, y);
|
|
4184
4191
|
}
|
|
4185
4192
|
e.reportTypeError = _;
|
|
4186
|
-
function
|
|
4193
|
+
function g(P) {
|
|
4187
4194
|
const { gen: I, data: D, schema: w } = P, k = (0, i.schemaRefOrVal)(P, w, "type");
|
|
4188
4195
|
return {
|
|
4189
4196
|
gen: I,
|
|
@@ -4273,14 +4280,14 @@ function schemaProperties(e, t) {
|
|
|
4273
4280
|
}
|
|
4274
4281
|
code.schemaProperties = schemaProperties;
|
|
4275
4282
|
function callValidateCode({ schemaCode: e, data: t, it: { gen: r, topSchemaRef: n, schemaPath: s, errorPath: i }, it: o }, l, d, u) {
|
|
4276
|
-
const p = u ? (0, codegen_1$q._)`${e}, ${t}, ${n}${s}` : t,
|
|
4283
|
+
const p = u ? (0, codegen_1$q._)`${e}, ${t}, ${n}${s}` : t, $ = [
|
|
4277
4284
|
[names_1$5.default.instancePath, (0, codegen_1$q.strConcat)(names_1$5.default.instancePath, i)],
|
|
4278
4285
|
[names_1$5.default.parentData, o.parentData],
|
|
4279
4286
|
[names_1$5.default.parentDataProperty, o.parentDataProperty],
|
|
4280
4287
|
[names_1$5.default.rootData, names_1$5.default.rootData]
|
|
4281
4288
|
];
|
|
4282
|
-
o.opts.dynamicRef &&
|
|
4283
|
-
const O = (0, codegen_1$q._)`${p}, ${r.object(
|
|
4289
|
+
o.opts.dynamicRef && $.push([names_1$5.default.dynamicAnchors, names_1$5.default.dynamicAnchors]);
|
|
4290
|
+
const O = (0, codegen_1$q._)`${p}, ${r.object(...$)}`;
|
|
4284
4291
|
return d !== codegen_1$q.nil ? (0, codegen_1$q._)`${l}.call(${d}, ${O})` : (0, codegen_1$q._)`${l}(${O})`;
|
|
4285
4292
|
}
|
|
4286
4293
|
code.callValidateCode = callValidateCode;
|
|
@@ -4350,8 +4357,8 @@ function funcKeywordCode(e, t) {
|
|
|
4350
4357
|
var r;
|
|
4351
4358
|
const { gen: n, keyword: s, schema: i, parentSchema: o, $data: l, it: d } = e;
|
|
4352
4359
|
checkAsyncKeyword(d, t);
|
|
4353
|
-
const u = !l && t.compile ? t.compile.call(d.self, i, o, d) : t.validate, p = useKeyword(n, s, u),
|
|
4354
|
-
e.block$data(
|
|
4360
|
+
const u = !l && t.compile ? t.compile.call(d.self, i, o, d) : t.validate, p = useKeyword(n, s, u), $ = n.let("valid");
|
|
4361
|
+
e.block$data($, O), e.ok((r = t.valid) !== null && r !== void 0 ? r : $);
|
|
4355
4362
|
function O() {
|
|
4356
4363
|
if (t.errors === !1)
|
|
4357
4364
|
T(), t.modifying && modifyData(e), y(() => e.error());
|
|
@@ -4362,19 +4369,19 @@ function funcKeywordCode(e, t) {
|
|
|
4362
4369
|
}
|
|
4363
4370
|
function N() {
|
|
4364
4371
|
const _ = n.let("ruleErrs", null);
|
|
4365
|
-
return n.try(() => T((0, codegen_1$p._)`await `), (
|
|
4372
|
+
return n.try(() => T((0, codegen_1$p._)`await `), (g) => n.assign($, !1).if((0, codegen_1$p._)`${g} instanceof ${d.ValidationError}`, () => n.assign(_, (0, codegen_1$p._)`${g}.errors`), () => n.throw(g))), _;
|
|
4366
4373
|
}
|
|
4367
4374
|
function R() {
|
|
4368
4375
|
const _ = (0, codegen_1$p._)`${p}.errors`;
|
|
4369
4376
|
return n.assign(_, null), T(codegen_1$p.nil), _;
|
|
4370
4377
|
}
|
|
4371
4378
|
function T(_ = t.async ? (0, codegen_1$p._)`await ` : codegen_1$p.nil) {
|
|
4372
|
-
const
|
|
4373
|
-
n.assign(
|
|
4379
|
+
const g = d.opts.passContext ? names_1$4.default.this : names_1$4.default.self, P = !("compile" in t && !l || t.schema === !1);
|
|
4380
|
+
n.assign($, (0, codegen_1$p._)`${_}${(0, code_1$9.callValidateCode)(e, p, g, P)}`, t.modifying);
|
|
4374
4381
|
}
|
|
4375
4382
|
function y(_) {
|
|
4376
|
-
var
|
|
4377
|
-
n.if((0, codegen_1$p.not)((
|
|
4383
|
+
var g;
|
|
4384
|
+
n.if((0, codegen_1$p.not)((g = t.valid) !== null && g !== void 0 ? g : $), _);
|
|
4378
4385
|
}
|
|
4379
4386
|
}
|
|
4380
4387
|
keyword.funcKeywordCode = funcKeywordCode;
|
|
@@ -4453,8 +4460,8 @@ function extendSubschemaData(e, t, { dataProp: r, dataPropType: n, data: s, data
|
|
|
4453
4460
|
throw new Error('both "data" and "dataProp" passed, only one allowed');
|
|
4454
4461
|
const { gen: l } = t;
|
|
4455
4462
|
if (r !== void 0) {
|
|
4456
|
-
const { errorPath: u, dataPathArr: p, opts:
|
|
4457
|
-
d(O), e.errorPath = (0, codegen_1$o.str)`${u}${(0, util_1$n.getErrorPath)(r, n,
|
|
4463
|
+
const { errorPath: u, dataPathArr: p, opts: $ } = t, O = l.let("data", (0, codegen_1$o._)`${t.data}${(0, codegen_1$o.getProperty)(r)}`, !0);
|
|
4464
|
+
d(O), e.errorPath = (0, codegen_1$o.str)`${u}${(0, util_1$n.getErrorPath)(r, n, $.jsPropertySyntax)}`, e.parentDataProperty = (0, codegen_1$o._)`${r}`, e.dataPathArr = [...p, e.parentDataProperty];
|
|
4458
4465
|
}
|
|
4459
4466
|
if (s !== void 0) {
|
|
4460
4467
|
const u = s instanceof codegen_1$o.Name ? s : l.let("data", s, !0);
|
|
@@ -4559,17 +4566,17 @@ function _traverse(e, t, r, n, s, i, o, l, d, u) {
|
|
|
4559
4566
|
if (n && typeof n == "object" && !Array.isArray(n)) {
|
|
4560
4567
|
t(n, s, i, o, l, d, u);
|
|
4561
4568
|
for (var p in n) {
|
|
4562
|
-
var
|
|
4563
|
-
if (Array.isArray(
|
|
4569
|
+
var $ = n[p];
|
|
4570
|
+
if (Array.isArray($)) {
|
|
4564
4571
|
if (p in traverse$1.arrayKeywords)
|
|
4565
|
-
for (var O = 0; O <
|
|
4566
|
-
_traverse(e, t, r,
|
|
4572
|
+
for (var O = 0; O < $.length; O++)
|
|
4573
|
+
_traverse(e, t, r, $[O], s + "/" + p + "/" + O, i, s, p, n, O);
|
|
4567
4574
|
} else if (p in traverse$1.propsKeywords) {
|
|
4568
|
-
if (
|
|
4569
|
-
for (var N in
|
|
4570
|
-
_traverse(e, t, r,
|
|
4575
|
+
if ($ && typeof $ == "object")
|
|
4576
|
+
for (var N in $)
|
|
4577
|
+
_traverse(e, t, r, $[N], s + "/" + p + "/" + escapeJsonPtr(N), i, s, p, n, N);
|
|
4571
4578
|
} else
|
|
4572
|
-
(p in traverse$1.keywords || e.allKeys && !(p in traverse$1.skipKeywords)) && _traverse(e, t, r,
|
|
4579
|
+
(p in traverse$1.keywords || e.allKeys && !(p in traverse$1.skipKeywords)) && _traverse(e, t, r, $, s + "/" + p, i, s, p, n);
|
|
4573
4580
|
}
|
|
4574
4581
|
r(n, s, i, o, l, d, u);
|
|
4575
4582
|
}
|
|
@@ -4653,21 +4660,21 @@ function getSchemaRefs(e, t) {
|
|
|
4653
4660
|
if (typeof e == "boolean")
|
|
4654
4661
|
return {};
|
|
4655
4662
|
const { schemaId: r, uriResolver: n } = this.opts, s = normalizeId(e[r] || t), i = { "": s }, o = getFullPath(n, s, !1), l = {}, d = /* @__PURE__ */ new Set();
|
|
4656
|
-
return traverse(e, { allKeys: !0 }, (
|
|
4663
|
+
return traverse(e, { allKeys: !0 }, ($, O, N, R) => {
|
|
4657
4664
|
if (R === void 0)
|
|
4658
4665
|
return;
|
|
4659
4666
|
const T = o + O;
|
|
4660
4667
|
let y = i[R];
|
|
4661
|
-
typeof
|
|
4668
|
+
typeof $[r] == "string" && (y = _.call(this, $[r])), g.call(this, $.$anchor), g.call(this, $.$dynamicAnchor), i[O] = y;
|
|
4662
4669
|
function _(P) {
|
|
4663
4670
|
const I = this.opts.uriResolver.resolve;
|
|
4664
4671
|
if (P = normalizeId(y ? I(y, P) : P), d.has(P))
|
|
4665
4672
|
throw p(P);
|
|
4666
4673
|
d.add(P);
|
|
4667
4674
|
let D = this.refs[P];
|
|
4668
|
-
return typeof D == "string" && (D = this.refs[D]), typeof D == "object" ? u(
|
|
4675
|
+
return typeof D == "string" && (D = this.refs[D]), typeof D == "object" ? u($, D.schema, P) : P !== normalizeId(T) && (P[0] === "#" ? (u($, l[P], P), l[P] = $) : this.refs[P] = T), P;
|
|
4669
4676
|
}
|
|
4670
|
-
function
|
|
4677
|
+
function g(P) {
|
|
4671
4678
|
if (typeof P == "string") {
|
|
4672
4679
|
if (!ANCHOR.test(P))
|
|
4673
4680
|
throw new Error(`invalid anchor "${P}"`);
|
|
@@ -4675,12 +4682,12 @@ function getSchemaRefs(e, t) {
|
|
|
4675
4682
|
}
|
|
4676
4683
|
}
|
|
4677
4684
|
}), l;
|
|
4678
|
-
function u(
|
|
4679
|
-
if (O !== void 0 && !equal$2(
|
|
4685
|
+
function u($, O, N) {
|
|
4686
|
+
if (O !== void 0 && !equal$2($, O))
|
|
4680
4687
|
throw p(N);
|
|
4681
4688
|
}
|
|
4682
|
-
function p(
|
|
4683
|
-
return new Error(`reference "${
|
|
4689
|
+
function p($) {
|
|
4690
|
+
return new Error(`reference "${$}" resolves to more than one schema`);
|
|
4684
4691
|
}
|
|
4685
4692
|
}
|
|
4686
4693
|
resolve$1.getSchemaRefs = getSchemaRefs;
|
|
@@ -4797,10 +4804,10 @@ function schemaKeywords(e, t, r, n) {
|
|
|
4797
4804
|
}
|
|
4798
4805
|
d.jtd || checkStrictTypes(e, t), s.block(() => {
|
|
4799
4806
|
for (const O of p.rules)
|
|
4800
|
-
|
|
4801
|
-
|
|
4807
|
+
$(O);
|
|
4808
|
+
$(p.post);
|
|
4802
4809
|
});
|
|
4803
|
-
function
|
|
4810
|
+
function $(O) {
|
|
4804
4811
|
(0, applicability_1.shouldUseGroup)(i, O) && (O.type ? (s.if((0, dataType_2.checkDataType)(O.type, o, d.strictNumbers)), iterateKeywords(e, O), t.length === 1 && t[0] === O.type && r && (s.else(), (0, dataType_2.reportTypeError)(e)), s.endIf()) : iterateKeywords(e, O), l || s.if((0, codegen_1$n._)`${names_1$3.default.errors} === ${n || 0}`));
|
|
4805
4812
|
}
|
|
4806
4813
|
}
|
|
@@ -5063,10 +5070,10 @@ function compileSchema(e) {
|
|
|
5063
5070
|
let p;
|
|
5064
5071
|
try {
|
|
5065
5072
|
this._compilations.add(e), (0, validate_1$1.validateFunctionCode)(u), o.optimize(this.opts.code.optimize);
|
|
5066
|
-
const
|
|
5067
|
-
p = `${o.scopeRefs(names_1$2.default.scope)}return ${
|
|
5073
|
+
const $ = o.toString();
|
|
5074
|
+
p = `${o.scopeRefs(names_1$2.default.scope)}return ${$}`, this.opts.code.process && (p = this.opts.code.process(p, e));
|
|
5068
5075
|
const N = new Function(`${names_1$2.default.self}`, `${names_1$2.default.scope}`, p)(this, this.scope.get());
|
|
5069
|
-
if (this.scope.value(d, { ref: N }), N.errors = null, N.schema = e.schema, N.schemaEnv = e, e.$async && (N.$async = !0), this.opts.code.source === !0 && (N.source = { validateName: d, validateCode:
|
|
5076
|
+
if (this.scope.value(d, { ref: N }), N.errors = null, N.schema = e.schema, N.schemaEnv = e, e.$async && (N.$async = !0), this.opts.code.source === !0 && (N.source = { validateName: d, validateCode: $, scopeValues: o._values }), this.opts.unevaluated) {
|
|
5070
5077
|
const { props: R, items: T } = u;
|
|
5071
5078
|
N.evaluated = {
|
|
5072
5079
|
props: R instanceof codegen_1$m.Name ? void 0 : R,
|
|
@@ -5076,8 +5083,8 @@ function compileSchema(e) {
|
|
|
5076
5083
|
}, N.source && (N.source.evaluated = (0, codegen_1$m.stringify)(N.evaluated));
|
|
5077
5084
|
}
|
|
5078
5085
|
return e.validate = N, e;
|
|
5079
|
-
} catch (
|
|
5080
|
-
throw delete e.validate, delete e.validateName, p && this.logger.error("Error compiling schema, function code:", p),
|
|
5086
|
+
} catch ($) {
|
|
5087
|
+
throw delete e.validate, delete e.validateName, p && this.logger.error("Error compiling schema, function code:", p), $;
|
|
5081
5088
|
} finally {
|
|
5082
5089
|
this._compilations.delete(e);
|
|
5083
5090
|
}
|
|
@@ -5226,7 +5233,7 @@ var uri$1 = {}, uri_all = { exports: {} };
|
|
|
5226
5233
|
function u(f) {
|
|
5227
5234
|
var c = "[A-Za-z]", m = "[0-9]", S = n(m, "[A-Fa-f]"), E = s(s("%[EFef]" + S + "%" + S + S + "%" + S + S) + "|" + s("%[89A-Fa-f]" + S + "%" + S + S) + "|" + s("%" + S + S)), U = "[\\:\\/\\?\\#\\[\\]\\@]", L = "[\\!\\$\\&\\'\\(\\)\\*\\+\\,\\;\\=]", J = n(U, L), Y = f ? "[\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]" : "[]", se = f ? "[\\uE000-\\uF8FF]" : "[]", B = n(c, m, "[\\-\\.\\_\\~]", Y);
|
|
5228
5235
|
s(c + n(c, m, "[\\+\\-\\.]") + "*"), s(s(E + "|" + n(B, L, "[\\:]")) + "*");
|
|
5229
|
-
var Z = s(s("25[0-5]") + "|" + s("2[0-4]" + m) + "|" + s("1" + m + m) + "|" + s("0?[1-9]" + m) + "|0?0?" + m), ie = s(Z + "\\." + Z + "\\." + Z + "\\." + Z), z = s(S + "{1,4}"), X = s(s(z + "\\:" + z) + "|" + ie), ae = s(s(z + "\\:") + "{6}" + X), ee = s("\\:\\:" + s(z + "\\:") + "{5}" + X), Se = s(s(z) + "?\\:\\:" + s(z + "\\:") + "{4}" + X),
|
|
5236
|
+
var Z = s(s("25[0-5]") + "|" + s("2[0-4]" + m) + "|" + s("1" + m + m) + "|" + s("0?[1-9]" + m) + "|0?0?" + m), ie = s(Z + "\\." + Z + "\\." + Z + "\\." + Z), z = s(S + "{1,4}"), X = s(s(z + "\\:" + z) + "|" + ie), ae = s(s(z + "\\:") + "{6}" + X), ee = s("\\:\\:" + s(z + "\\:") + "{5}" + X), Se = s(s(z) + "?\\:\\:" + s(z + "\\:") + "{4}" + X), $e = s(s(s(z + "\\:") + "{0,1}" + z) + "?\\:\\:" + s(z + "\\:") + "{3}" + X), ge = s(s(s(z + "\\:") + "{0,2}" + z) + "?\\:\\:" + s(z + "\\:") + "{2}" + X), Be = s(s(s(z + "\\:") + "{0,3}" + z) + "?\\:\\:" + z + "\\:" + X), Ie = s(s(s(z + "\\:") + "{0,4}" + z) + "?\\:\\:" + X), fe = s(s(s(z + "\\:") + "{0,5}" + z) + "?\\:\\:" + z), ye = s(s(s(z + "\\:") + "{0,6}" + z) + "?\\:\\:"), je = s([ae, ee, Se, $e, ge, Be, Ie, fe, ye].join("|")), we = s(s(B + "|" + E) + "+");
|
|
5230
5237
|
s("[vV]" + S + "+\\." + n(B, L, "[\\:]") + "+"), s(s(E + "|" + n(B, L)) + "*");
|
|
5231
5238
|
var ct = s(E + "|" + n(B, L, "[\\:\\@]"));
|
|
5232
5239
|
return s(s(E + "|" + n(B, L, "[\\@]")) + "+"), s(s(ct + "|" + n("[\\/\\?]", se)) + "*"), {
|
|
@@ -5246,7 +5253,7 @@ var uri$1 = {}, uri_all = { exports: {} };
|
|
|
5246
5253
|
//RFC 6874, with relaxed parsing rules
|
|
5247
5254
|
};
|
|
5248
5255
|
}
|
|
5249
|
-
var p = u(!1),
|
|
5256
|
+
var p = u(!1), $ = u(!0), O = function() {
|
|
5250
5257
|
function f(c, m) {
|
|
5251
5258
|
var S = [], E = !0, U = !1, L = void 0;
|
|
5252
5259
|
try {
|
|
@@ -5278,7 +5285,7 @@ var uri$1 = {}, uri_all = { exports: {} };
|
|
|
5278
5285
|
return m;
|
|
5279
5286
|
} else
|
|
5280
5287
|
return Array.from(f);
|
|
5281
|
-
}, R = 2147483647, T = 36, y = 1, _ = 26,
|
|
5288
|
+
}, R = 2147483647, T = 36, y = 1, _ = 26, g = 38, P = 700, I = 72, D = 128, w = "-", k = /^xn--/, A = /[^\0-\x7E]/, V = /[\x2E\u3002\uFF0E\uFF61]/g, x = {
|
|
5282
5289
|
overflow: "Overflow: input needs wider integers to process",
|
|
5283
5290
|
"not-basic": "Illegal input >= 0x80 (not a basic code point)",
|
|
5284
5291
|
"invalid-input": "Invalid input"
|
|
@@ -5323,7 +5330,7 @@ var uri$1 = {}, uri_all = { exports: {} };
|
|
|
5323
5330
|
E += T
|
|
5324
5331
|
)
|
|
5325
5332
|
c = K(c / re);
|
|
5326
|
-
return K(E + (re + 1) * c / (c +
|
|
5333
|
+
return K(E + (re + 1) * c / (c + g));
|
|
5327
5334
|
}, j = function(c) {
|
|
5328
5335
|
var m = [], S = c.length, E = 0, U = D, L = I, J = c.lastIndexOf(w);
|
|
5329
5336
|
J < 0 && (J = 0);
|
|
@@ -5370,20 +5377,20 @@ var uri$1 = {}, uri_all = { exports: {} };
|
|
|
5370
5377
|
}
|
|
5371
5378
|
var z = m.length, X = z;
|
|
5372
5379
|
for (z && m.push(w); X < S; ) {
|
|
5373
|
-
var ae = R, ee = !0, Se = !1,
|
|
5380
|
+
var ae = R, ee = !0, Se = !1, $e = void 0;
|
|
5374
5381
|
try {
|
|
5375
|
-
for (var
|
|
5382
|
+
for (var ge = c[Symbol.iterator](), Be; !(ee = (Be = ge.next()).done); ee = !0) {
|
|
5376
5383
|
var Ie = Be.value;
|
|
5377
5384
|
Ie >= E && Ie < ae && (ae = Ie);
|
|
5378
5385
|
}
|
|
5379
5386
|
} catch (lt) {
|
|
5380
|
-
Se = !0,
|
|
5387
|
+
Se = !0, $e = lt;
|
|
5381
5388
|
} finally {
|
|
5382
5389
|
try {
|
|
5383
|
-
!ee &&
|
|
5390
|
+
!ee && ge.return && ge.return();
|
|
5384
5391
|
} finally {
|
|
5385
5392
|
if (Se)
|
|
5386
|
-
throw
|
|
5393
|
+
throw $e;
|
|
5387
5394
|
}
|
|
5388
5395
|
}
|
|
5389
5396
|
var fe = X + 1;
|
|
@@ -5506,21 +5513,21 @@ var uri$1 = {}, uri_all = { exports: {} };
|
|
|
5506
5513
|
we && we.index + we.length === je ? we.length++ : fe.push({ index: je, length: 1 });
|
|
5507
5514
|
}
|
|
5508
5515
|
return fe;
|
|
5509
|
-
}, []),
|
|
5516
|
+
}, []), $e = Se.sort(function(fe, ye) {
|
|
5510
5517
|
return ye.length - fe.length;
|
|
5511
|
-
})[0],
|
|
5512
|
-
if (
|
|
5513
|
-
var Be = ae.slice(0,
|
|
5514
|
-
|
|
5518
|
+
})[0], ge = void 0;
|
|
5519
|
+
if ($e && $e.length > 1) {
|
|
5520
|
+
var Be = ae.slice(0, $e.index), Ie = ae.slice($e.index + $e.length);
|
|
5521
|
+
ge = Be.join(":") + "::" + Ie.join(":");
|
|
5515
5522
|
} else
|
|
5516
|
-
|
|
5517
|
-
return U && (
|
|
5523
|
+
ge = ae.join(":");
|
|
5524
|
+
return U && (ge += "%" + U), ge;
|
|
5518
5525
|
} else
|
|
5519
5526
|
return f;
|
|
5520
5527
|
}
|
|
5521
5528
|
var tt = /^(?:([^:\/?#]+):)?(?:\/\/((?:([^\/?#@]*)@)?(\[[^\/?#\]]+\]|[^\/?#:]*)(?:\:(\d*))?))?([^?#]*)(?:\?([^#]*))?(?:#((?:.|\n|\r)*))?/i, rt = "".match(/(){0}/)[1] === void 0;
|
|
5522
5529
|
function de(f) {
|
|
5523
|
-
var c = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, m = {}, S = c.iri !== !1 ?
|
|
5530
|
+
var c = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, m = {}, S = c.iri !== !1 ? $ : p;
|
|
5524
5531
|
c.reference === "suffix" && (f = (c.scheme ? c.scheme + ":" : "") + "//" + f);
|
|
5525
5532
|
var E = f.match(tt);
|
|
5526
5533
|
if (E) {
|
|
@@ -5542,7 +5549,7 @@ var uri$1 = {}, uri_all = { exports: {} };
|
|
|
5542
5549
|
return m;
|
|
5543
5550
|
}
|
|
5544
5551
|
function nt(f, c) {
|
|
5545
|
-
var m = c.iri !== !1 ?
|
|
5552
|
+
var m = c.iri !== !1 ? $ : p, S = [];
|
|
5546
5553
|
return f.userinfo !== void 0 && (S.push(f.userinfo), S.push("@")), f.host !== void 0 && S.push(Le(he(String(f.host), m), m).replace(m.IPV6ADDRESS, function(E, U, L) {
|
|
5547
5554
|
return "[" + U + (L ? "%25" + L : "") + "]";
|
|
5548
5555
|
})), (typeof f.port == "number" || typeof f.port == "string") && (S.push(":"), S.push(String(f.port))), S.length ? S.join("") : void 0;
|
|
@@ -5569,7 +5576,7 @@ var uri$1 = {}, uri_all = { exports: {} };
|
|
|
5569
5576
|
return c.join("");
|
|
5570
5577
|
}
|
|
5571
5578
|
function le(f) {
|
|
5572
|
-
var c = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, m = c.iri ?
|
|
5579
|
+
var c = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, m = c.iri ? $ : p, S = [], E = M[(c.scheme || f.scheme || "").toLowerCase()];
|
|
5573
5580
|
if (E && E.serialize && E.serialize(f, c), f.host && !m.IPV6ADDRESS.test(f.host)) {
|
|
5574
5581
|
if (c.domainHost || E && E.domainHost)
|
|
5575
5582
|
try {
|
|
@@ -5601,10 +5608,10 @@ var uri$1 = {}, uri_all = { exports: {} };
|
|
|
5601
5608
|
return typeof f == "string" ? f = le(de(f, m), m) : i(f) === "object" && (f = le(f, m)), typeof c == "string" ? c = le(de(c, m), m) : i(c) === "object" && (c = le(c, m)), f === c;
|
|
5602
5609
|
}
|
|
5603
5610
|
function ut(f, c) {
|
|
5604
|
-
return f && f.toString().replace(!c || !c.iri ? p.ESCAPE :
|
|
5611
|
+
return f && f.toString().replace(!c || !c.iri ? p.ESCAPE : $.ESCAPE, q);
|
|
5605
5612
|
}
|
|
5606
5613
|
function pe(f, c) {
|
|
5607
|
-
return f && f.toString().replace(!c || !c.iri ? p.PCT_ENCODED :
|
|
5614
|
+
return f && f.toString().replace(!c || !c.iri ? p.PCT_ENCODED : $.PCT_ENCODED, W);
|
|
5608
5615
|
}
|
|
5609
5616
|
var Ne = {
|
|
5610
5617
|
scheme: "http",
|
|
@@ -5766,7 +5773,7 @@ uri$1.default = uri;
|
|
|
5766
5773
|
} }), Object.defineProperty(e, "CodeGen", { enumerable: !0, get: function() {
|
|
5767
5774
|
return r.CodeGen;
|
|
5768
5775
|
} });
|
|
5769
|
-
const n = validation_error, s = ref_error, i = rules, o = compile, l = codegen, d = resolve$1, u = dataType, p = util,
|
|
5776
|
+
const n = validation_error, s = ref_error, i = rules, o = compile, l = codegen, d = resolve$1, u = dataType, p = util, $ = require$$9, O = uri$1, N = (F, v) => new RegExp(F, v);
|
|
5770
5777
|
N.code = "new RegExp";
|
|
5771
5778
|
const R = ["removeAdditional", "useDefaults", "coerceTypes"], T = /* @__PURE__ */ new Set([
|
|
5772
5779
|
"validate",
|
|
@@ -5802,7 +5809,7 @@ uri$1.default = uri;
|
|
|
5802
5809
|
ignoreKeywordsWithRef: "",
|
|
5803
5810
|
jsPropertySyntax: "",
|
|
5804
5811
|
unicode: '"minLength"/"maxLength" account for unicode characters by default.'
|
|
5805
|
-
},
|
|
5812
|
+
}, g = 200;
|
|
5806
5813
|
function P(F) {
|
|
5807
5814
|
var v, j, b, a, h, C, M, q, W, G, ne, he, Le, tt, rt, de, nt, He, Ve, ze, st, me, le, xe, it;
|
|
5808
5815
|
const Oe = F.strict, ot = (v = F.code) === null || v === void 0 ? void 0 : v.optimize, ut = ot === !0 || ot === void 0 ? 1 : ot || 0, pe = (b = (j = F.code) === null || j === void 0 ? void 0 : j.regExp) !== null && b !== void 0 ? b : N, Ne = (a = F.uriResolver) !== null && a !== void 0 ? a : O.default;
|
|
@@ -5813,8 +5820,8 @@ uri$1.default = uri;
|
|
|
5813
5820
|
strictTuples: (he = (ne = F.strictTuples) !== null && ne !== void 0 ? ne : Oe) !== null && he !== void 0 ? he : "log",
|
|
5814
5821
|
strictRequired: (tt = (Le = F.strictRequired) !== null && Le !== void 0 ? Le : Oe) !== null && tt !== void 0 ? tt : !1,
|
|
5815
5822
|
code: F.code ? { ...F.code, optimize: ut, regExp: pe } : { optimize: ut, regExp: pe },
|
|
5816
|
-
loopRequired: (rt = F.loopRequired) !== null && rt !== void 0 ? rt :
|
|
5817
|
-
loopEnum: (de = F.loopEnum) !== null && de !== void 0 ? de :
|
|
5823
|
+
loopRequired: (rt = F.loopRequired) !== null && rt !== void 0 ? rt : g,
|
|
5824
|
+
loopEnum: (de = F.loopEnum) !== null && de !== void 0 ? de : g,
|
|
5818
5825
|
meta: (nt = F.meta) !== null && nt !== void 0 ? nt : !0,
|
|
5819
5826
|
messages: (He = F.messages) !== null && He !== void 0 ? He : !0,
|
|
5820
5827
|
inlineRefs: (Ve = F.inlineRefs) !== null && Ve !== void 0 ? Ve : !0,
|
|
@@ -5840,8 +5847,8 @@ uri$1.default = uri;
|
|
|
5840
5847
|
}
|
|
5841
5848
|
_addDefaultMetaSchema() {
|
|
5842
5849
|
const { $data: v, meta: j, schemaId: b } = this.opts;
|
|
5843
|
-
let a =
|
|
5844
|
-
b === "id" && (a = {
|
|
5850
|
+
let a = $;
|
|
5851
|
+
b === "id" && (a = { ...$ }, a.id = a.$id, delete a.$id), j && v && this.addMetaSchema(a, a[b], !1);
|
|
5845
5852
|
}
|
|
5846
5853
|
defaultMeta() {
|
|
5847
5854
|
const { meta: v, schemaId: j } = this.opts;
|
|
@@ -6204,14 +6211,14 @@ const ref_error_1 = ref_error, code_1$8 = code, codegen_1$l = codegen, names_1$1
|
|
|
6204
6211
|
code(e) {
|
|
6205
6212
|
const { gen: t, schema: r, it: n } = e, { baseId: s, schemaEnv: i, validateName: o, opts: l, self: d } = n, { root: u } = i;
|
|
6206
6213
|
if ((r === "#" || r === "#/") && s === u.baseId)
|
|
6207
|
-
return
|
|
6214
|
+
return $();
|
|
6208
6215
|
const p = compile_1$1.resolveRef.call(d, u, s, r);
|
|
6209
6216
|
if (p === void 0)
|
|
6210
6217
|
throw new ref_error_1.default(n.opts.uriResolver, s, r);
|
|
6211
6218
|
if (p instanceof compile_1$1.SchemaEnv)
|
|
6212
6219
|
return O(p);
|
|
6213
6220
|
return N(p);
|
|
6214
|
-
function
|
|
6221
|
+
function $() {
|
|
6215
6222
|
if (i === u)
|
|
6216
6223
|
return callRef(e, o, i, i.$async);
|
|
6217
6224
|
const R = t.scopeValue("root", { ref: u });
|
|
@@ -6240,7 +6247,7 @@ function getValidate(e, t) {
|
|
|
6240
6247
|
ref.getValidate = getValidate;
|
|
6241
6248
|
function callRef(e, t, r, n) {
|
|
6242
6249
|
const { gen: s, it: i } = e, { allErrors: o, schemaEnv: l, opts: d } = i, u = d.passContext ? names_1$1.default.this : codegen_1$l.nil;
|
|
6243
|
-
n ? p() :
|
|
6250
|
+
n ? p() : $();
|
|
6244
6251
|
function p() {
|
|
6245
6252
|
if (!l.$async)
|
|
6246
6253
|
throw new Error("async schema referenced by sync schema");
|
|
@@ -6251,7 +6258,7 @@ function callRef(e, t, r, n) {
|
|
|
6251
6258
|
s.if((0, codegen_1$l._)`!(${T} instanceof ${i.ValidationError})`, () => s.throw(T)), O(T), o || s.assign(R, !1);
|
|
6252
6259
|
}), e.ok(R);
|
|
6253
6260
|
}
|
|
6254
|
-
function
|
|
6261
|
+
function $() {
|
|
6255
6262
|
e.result((0, code_1$8.callValidateCode)(e, t, u), () => N(t), () => O(t));
|
|
6256
6263
|
}
|
|
6257
6264
|
function O(R) {
|
|
@@ -6425,7 +6432,7 @@ const code_1$6 = code, codegen_1$f = codegen, util_1$h = util, error$d = {
|
|
|
6425
6432
|
}
|
|
6426
6433
|
function u() {
|
|
6427
6434
|
if (d || i)
|
|
6428
|
-
e.block$data(codegen_1$f.nil,
|
|
6435
|
+
e.block$data(codegen_1$f.nil, $);
|
|
6429
6436
|
else
|
|
6430
6437
|
for (const N of r)
|
|
6431
6438
|
(0, code_1$6.checkReportMissingProp)(e, N);
|
|
@@ -6438,7 +6445,7 @@ const code_1$6 = code, codegen_1$f = codegen, util_1$h = util, error$d = {
|
|
|
6438
6445
|
} else
|
|
6439
6446
|
t.if((0, code_1$6.checkMissingProp)(e, r, N)), (0, code_1$6.reportMissingProp)(e, N), t.else();
|
|
6440
6447
|
}
|
|
6441
|
-
function
|
|
6448
|
+
function $() {
|
|
6442
6449
|
t.forOf("prop", n, (N) => {
|
|
6443
6450
|
e.setParams({ missingProperty: N }), t.if((0, code_1$6.noPropertyInData)(t, s, N, l.ownProperties), () => e.error());
|
|
6444
6451
|
});
|
|
@@ -6496,17 +6503,17 @@ const dataType_1 = dataType, codegen_1$d = codegen, util_1$g = util, equal_1$2 =
|
|
|
6496
6503
|
e.block$data(d, p, (0, codegen_1$d._)`${o} === false`), e.ok(d);
|
|
6497
6504
|
function p() {
|
|
6498
6505
|
const R = t.let("i", (0, codegen_1$d._)`${r}.length`), T = t.let("j");
|
|
6499
|
-
e.setParams({ i: R, j: T }), t.assign(d, !0), t.if((0, codegen_1$d._)`${R} > 1`, () => (
|
|
6506
|
+
e.setParams({ i: R, j: T }), t.assign(d, !0), t.if((0, codegen_1$d._)`${R} > 1`, () => ($() ? O : N)(R, T));
|
|
6500
6507
|
}
|
|
6501
|
-
function
|
|
6508
|
+
function $() {
|
|
6502
6509
|
return u.length > 0 && !u.some((R) => R === "object" || R === "array");
|
|
6503
6510
|
}
|
|
6504
6511
|
function O(R, T) {
|
|
6505
|
-
const y = t.name("item"), _ = (0, dataType_1.checkDataTypes)(u, y, l.opts.strictNumbers, dataType_1.DataType.Wrong),
|
|
6512
|
+
const y = t.name("item"), _ = (0, dataType_1.checkDataTypes)(u, y, l.opts.strictNumbers, dataType_1.DataType.Wrong), g = t.const("indices", (0, codegen_1$d._)`{}`);
|
|
6506
6513
|
t.for((0, codegen_1$d._)`;${R}--;`, () => {
|
|
6507
|
-
t.let(y, (0, codegen_1$d._)`${r}[${R}]`), t.if(_, (0, codegen_1$d._)`continue`), u.length > 1 && t.if((0, codegen_1$d._)`typeof ${y} == "string"`, (0, codegen_1$d._)`${y} += "_"`), t.if((0, codegen_1$d._)`typeof ${
|
|
6508
|
-
t.assign(T, (0, codegen_1$d._)`${
|
|
6509
|
-
}).code((0, codegen_1$d._)`${
|
|
6514
|
+
t.let(y, (0, codegen_1$d._)`${r}[${R}]`), t.if(_, (0, codegen_1$d._)`continue`), u.length > 1 && t.if((0, codegen_1$d._)`typeof ${y} == "string"`, (0, codegen_1$d._)`${y} += "_"`), t.if((0, codegen_1$d._)`typeof ${g}[${y}] == "number"`, () => {
|
|
6515
|
+
t.assign(T, (0, codegen_1$d._)`${g}[${y}]`), e.error(), t.assign(d, !1).break();
|
|
6516
|
+
}).code((0, codegen_1$d._)`${g}[${y}] = ${R}`);
|
|
6510
6517
|
});
|
|
6511
6518
|
}
|
|
6512
6519
|
function N(R, T) {
|
|
@@ -6552,7 +6559,7 @@ const codegen_1$b = codegen, util_1$e = util, equal_1 = equal$1, error$9 = {
|
|
|
6552
6559
|
const u = () => d ?? (d = (0, util_1$e.useFunc)(t, equal_1.default));
|
|
6553
6560
|
let p;
|
|
6554
6561
|
if (l || n)
|
|
6555
|
-
p = t.let("valid"), e.block$data(p,
|
|
6562
|
+
p = t.let("valid"), e.block$data(p, $);
|
|
6556
6563
|
else {
|
|
6557
6564
|
if (!Array.isArray(s))
|
|
6558
6565
|
throw new Error("ajv implementation error");
|
|
@@ -6560,7 +6567,7 @@ const codegen_1$b = codegen, util_1$e = util, equal_1 = equal$1, error$9 = {
|
|
|
6560
6567
|
p = (0, codegen_1$b.or)(...s.map((R, T) => O(N, T)));
|
|
6561
6568
|
}
|
|
6562
6569
|
e.pass(p);
|
|
6563
|
-
function
|
|
6570
|
+
function $() {
|
|
6564
6571
|
t.assign(p, !1), t.forOf("v", i, (N) => t.if((0, codegen_1$b._)`${u()}(${r}, ${N})`, () => t.assign(p, !0).break()));
|
|
6565
6572
|
}
|
|
6566
6573
|
function O(N, R) {
|
|
@@ -6649,15 +6656,15 @@ function validateTuple(e, t, r = e.schema) {
|
|
|
6649
6656
|
const { gen: n, parentSchema: s, data: i, keyword: o, it: l } = e;
|
|
6650
6657
|
p(s), l.opts.unevaluated && r.length && l.items !== !0 && (l.items = util_1$c.mergeEvaluated.items(n, r.length, l.items));
|
|
6651
6658
|
const d = n.name("valid"), u = n.const("len", (0, codegen_1$9._)`${i}.length`);
|
|
6652
|
-
r.forEach((
|
|
6653
|
-
(0, util_1$c.alwaysValidSchema)(l,
|
|
6659
|
+
r.forEach(($, O) => {
|
|
6660
|
+
(0, util_1$c.alwaysValidSchema)(l, $) || (n.if((0, codegen_1$9._)`${u} > ${O}`, () => e.subschema({
|
|
6654
6661
|
keyword: o,
|
|
6655
6662
|
schemaProp: O,
|
|
6656
6663
|
dataProp: O
|
|
6657
6664
|
}, d)), e.ok(d));
|
|
6658
6665
|
});
|
|
6659
|
-
function p(
|
|
6660
|
-
const { opts: O, errSchemaPath: N } = l, R = r.length, T = R ===
|
|
6666
|
+
function p($) {
|
|
6667
|
+
const { opts: O, errSchemaPath: N } = l, R = r.length, T = R === $.minItems && (R === $.maxItems || $[t] === !1);
|
|
6661
6668
|
if (O.strictTuples && !T) {
|
|
6662
6669
|
const y = `"${o}" is ${R}-tuple, but minItems or maxItems/${t} are not specified or different at path "${N}"`;
|
|
6663
6670
|
(0, util_1$c.checkStrictMode)(l, y, O.strictTuples);
|
|
@@ -6724,8 +6731,8 @@ const codegen_1$7 = codegen, util_1$a = util, error$6 = {
|
|
|
6724
6731
|
return;
|
|
6725
6732
|
}
|
|
6726
6733
|
i.items = !0;
|
|
6727
|
-
const
|
|
6728
|
-
l === void 0 && o === 1 ? N(
|
|
6734
|
+
const $ = t.name("valid");
|
|
6735
|
+
l === void 0 && o === 1 ? N($, () => t.if($, () => t.break())) : o === 0 ? (t.let($, !0), l !== void 0 && t.if((0, codegen_1$7._)`${s}.length > 0`, O)) : (t.let($, !1), O()), e.result($, () => e.reset());
|
|
6729
6736
|
function O() {
|
|
6730
6737
|
const T = t.name("_valid"), y = t.let("count", 0);
|
|
6731
6738
|
N(T, () => t.if(T, () => R(y)));
|
|
@@ -6741,7 +6748,7 @@ const codegen_1$7 = codegen, util_1$a = util, error$6 = {
|
|
|
6741
6748
|
});
|
|
6742
6749
|
}
|
|
6743
6750
|
function R(T) {
|
|
6744
|
-
t.code((0, codegen_1$7._)`${T}++`), l === void 0 ? t.if((0, codegen_1$7._)`${T} >= ${o}`, () => t.assign(
|
|
6751
|
+
t.code((0, codegen_1$7._)`${T}++`), l === void 0 ? t.if((0, codegen_1$7._)`${T} >= ${o}`, () => t.assign($, !0).break()) : (t.if((0, codegen_1$7._)`${T} > ${l}`, () => t.assign($, !1).break()), o === 1 ? t.assign($, !0) : t.if((0, codegen_1$7._)`${T} >= ${o}`, () => t.assign($, !0)));
|
|
6745
6752
|
}
|
|
6746
6753
|
}
|
|
6747
6754
|
};
|
|
@@ -6752,11 +6759,11 @@ var dependencies = {};
|
|
|
6752
6759
|
const t = codegen, r = util, n = code;
|
|
6753
6760
|
e.error = {
|
|
6754
6761
|
message: ({ params: { property: d, depsCount: u, deps: p } }) => {
|
|
6755
|
-
const
|
|
6756
|
-
return (0, t.str)`must have ${
|
|
6762
|
+
const $ = u === 1 ? "property" : "properties";
|
|
6763
|
+
return (0, t.str)`must have ${$} ${p} when property ${d} is present`;
|
|
6757
6764
|
},
|
|
6758
|
-
params: ({ params: { property: d, depsCount: u, deps: p, missingProperty:
|
|
6759
|
-
missingProperty: ${
|
|
6765
|
+
params: ({ params: { property: d, depsCount: u, deps: p, missingProperty: $ } }) => (0, t._)`{property: ${d},
|
|
6766
|
+
missingProperty: ${$},
|
|
6760
6767
|
depsCount: ${u},
|
|
6761
6768
|
deps: ${p}}`
|
|
6762
6769
|
// TODO change to reference
|
|
@@ -6773,16 +6780,16 @@ var dependencies = {};
|
|
|
6773
6780
|
};
|
|
6774
6781
|
function i({ schema: d }) {
|
|
6775
6782
|
const u = {}, p = {};
|
|
6776
|
-
for (const
|
|
6777
|
-
if (
|
|
6783
|
+
for (const $ in d) {
|
|
6784
|
+
if ($ === "__proto__")
|
|
6778
6785
|
continue;
|
|
6779
|
-
const O = Array.isArray(d[
|
|
6780
|
-
O[
|
|
6786
|
+
const O = Array.isArray(d[$]) ? u : p;
|
|
6787
|
+
O[$] = d[$];
|
|
6781
6788
|
}
|
|
6782
6789
|
return [u, p];
|
|
6783
6790
|
}
|
|
6784
6791
|
function o(d, u = d.schema) {
|
|
6785
|
-
const { gen: p, data:
|
|
6792
|
+
const { gen: p, data: $, it: O } = d;
|
|
6786
6793
|
if (Object.keys(u).length === 0)
|
|
6787
6794
|
return;
|
|
6788
6795
|
const N = p.let("missing");
|
|
@@ -6790,7 +6797,7 @@ var dependencies = {};
|
|
|
6790
6797
|
const T = u[R];
|
|
6791
6798
|
if (T.length === 0)
|
|
6792
6799
|
continue;
|
|
6793
|
-
const y = (0, n.propertyInData)(p,
|
|
6800
|
+
const y = (0, n.propertyInData)(p, $, R, O.opts.ownProperties);
|
|
6794
6801
|
d.setParams({
|
|
6795
6802
|
property: R,
|
|
6796
6803
|
depsCount: T.length,
|
|
@@ -6803,10 +6810,10 @@ var dependencies = {};
|
|
|
6803
6810
|
}
|
|
6804
6811
|
e.validatePropertyDeps = o;
|
|
6805
6812
|
function l(d, u = d.schema) {
|
|
6806
|
-
const { gen: p, data:
|
|
6813
|
+
const { gen: p, data: $, keyword: O, it: N } = d, R = p.name("valid");
|
|
6807
6814
|
for (const T in u)
|
|
6808
6815
|
(0, r.alwaysValidSchema)(N, u[T]) || (p.if(
|
|
6809
|
-
(0, n.propertyInData)(p,
|
|
6816
|
+
(0, n.propertyInData)(p, $, T, N.opts.ownProperties),
|
|
6810
6817
|
() => {
|
|
6811
6818
|
const y = d.subschema({ keyword: O, schemaProp: T }, R);
|
|
6812
6819
|
d.mergeValidEvaluated(y, R);
|
|
@@ -6866,8 +6873,8 @@ const code_1$3 = code, codegen_1$5 = codegen, names_1 = names$1, util_1$8 = util
|
|
|
6866
6873
|
if (o.props = !0, d.removeAdditional !== "all" && (0, util_1$8.alwaysValidSchema)(o, r))
|
|
6867
6874
|
return;
|
|
6868
6875
|
const u = (0, code_1$3.allSchemaProperties)(n.properties), p = (0, code_1$3.allSchemaProperties)(n.patternProperties);
|
|
6869
|
-
|
|
6870
|
-
function
|
|
6876
|
+
$(), e.ok((0, codegen_1$5._)`${i} === ${names_1.default.errors}`);
|
|
6877
|
+
function $() {
|
|
6871
6878
|
t.forIn("key", s, (y) => {
|
|
6872
6879
|
!u.length && !p.length ? R(y) : t.if(O(y), () => R(y));
|
|
6873
6880
|
});
|
|
@@ -6875,11 +6882,11 @@ const code_1$3 = code, codegen_1$5 = codegen, names_1 = names$1, util_1$8 = util
|
|
|
6875
6882
|
function O(y) {
|
|
6876
6883
|
let _;
|
|
6877
6884
|
if (u.length > 8) {
|
|
6878
|
-
const
|
|
6879
|
-
_ = (0, code_1$3.isOwnProperty)(t,
|
|
6885
|
+
const g = (0, util_1$8.schemaRefOrVal)(o, n.properties, "properties");
|
|
6886
|
+
_ = (0, code_1$3.isOwnProperty)(t, g, y);
|
|
6880
6887
|
} else
|
|
6881
|
-
u.length ? _ = (0, codegen_1$5.or)(...u.map((
|
|
6882
|
-
return p.length && (_ = (0, codegen_1$5.or)(_, ...p.map((
|
|
6888
|
+
u.length ? _ = (0, codegen_1$5.or)(...u.map((g) => (0, codegen_1$5._)`${y} === ${g}`)) : _ = codegen_1$5.nil;
|
|
6889
|
+
return p.length && (_ = (0, codegen_1$5.or)(_, ...p.map((g) => (0, codegen_1$5._)`${(0, code_1$3.usePattern)(e, g)}.test(${y})`))), (0, codegen_1$5.not)(_);
|
|
6883
6890
|
}
|
|
6884
6891
|
function N(y) {
|
|
6885
6892
|
t.code((0, codegen_1$5._)`delete ${s}[${y}]`);
|
|
@@ -6900,13 +6907,13 @@ const code_1$3 = code, codegen_1$5 = codegen, names_1 = names$1, util_1$8 = util
|
|
|
6900
6907
|
})) : (T(y, _), l || t.if((0, codegen_1$5.not)(_), () => t.break()));
|
|
6901
6908
|
}
|
|
6902
6909
|
}
|
|
6903
|
-
function T(y, _,
|
|
6910
|
+
function T(y, _, g) {
|
|
6904
6911
|
const P = {
|
|
6905
6912
|
keyword: "additionalProperties",
|
|
6906
6913
|
dataProp: y,
|
|
6907
6914
|
dataPropType: util_1$8.Type.Str
|
|
6908
6915
|
};
|
|
6909
|
-
|
|
6916
|
+
g === !1 && Object.assign(P, {
|
|
6910
6917
|
compositeRule: !0,
|
|
6911
6918
|
createErrors: !1,
|
|
6912
6919
|
allErrors: !1
|
|
@@ -6925,23 +6932,23 @@ const validate_1 = validate, code_1$2 = code, util_1$7 = util, additionalPropert
|
|
|
6925
6932
|
const { gen: t, schema: r, parentSchema: n, data: s, it: i } = e;
|
|
6926
6933
|
i.opts.removeAdditional === "all" && n.additionalProperties === void 0 && additionalProperties_1$1.default.code(new validate_1.KeywordCxt(i, additionalProperties_1$1.default, "additionalProperties"));
|
|
6927
6934
|
const o = (0, code_1$2.allSchemaProperties)(r);
|
|
6928
|
-
for (const
|
|
6929
|
-
i.definedProperties.add(
|
|
6935
|
+
for (const $ of o)
|
|
6936
|
+
i.definedProperties.add($);
|
|
6930
6937
|
i.opts.unevaluated && o.length && i.props !== !0 && (i.props = util_1$7.mergeEvaluated.props(t, (0, util_1$7.toHash)(o), i.props));
|
|
6931
|
-
const l = o.filter((
|
|
6938
|
+
const l = o.filter(($) => !(0, util_1$7.alwaysValidSchema)(i, r[$]));
|
|
6932
6939
|
if (l.length === 0)
|
|
6933
6940
|
return;
|
|
6934
6941
|
const d = t.name("valid");
|
|
6935
|
-
for (const
|
|
6936
|
-
u(
|
|
6937
|
-
function u(
|
|
6938
|
-
return i.opts.useDefaults && !i.compositeRule && r[
|
|
6942
|
+
for (const $ of l)
|
|
6943
|
+
u($) ? p($) : (t.if((0, code_1$2.propertyInData)(t, s, $, i.opts.ownProperties)), p($), i.allErrors || t.else().var(d, !0), t.endIf()), e.it.definedProperties.add($), e.ok(d);
|
|
6944
|
+
function u($) {
|
|
6945
|
+
return i.opts.useDefaults && !i.compositeRule && r[$].default !== void 0;
|
|
6939
6946
|
}
|
|
6940
|
-
function p(
|
|
6947
|
+
function p($) {
|
|
6941
6948
|
e.subschema({
|
|
6942
6949
|
keyword: "properties",
|
|
6943
|
-
schemaProp:
|
|
6944
|
-
dataProp:
|
|
6950
|
+
schemaProp: $,
|
|
6951
|
+
dataProp: $
|
|
6945
6952
|
}, d);
|
|
6946
6953
|
}
|
|
6947
6954
|
}
|
|
@@ -6959,7 +6966,7 @@ const code_1$1 = code, codegen_1$4 = codegen, util_1$6 = util, util_2 = util, de
|
|
|
6959
6966
|
return;
|
|
6960
6967
|
const u = o.strictSchema && !o.allowMatchingProperties && s.properties, p = t.name("valid");
|
|
6961
6968
|
i.props !== !0 && !(i.props instanceof codegen_1$4.Name) && (i.props = (0, util_2.evaluatedPropsToName)(t, i.props));
|
|
6962
|
-
const { props:
|
|
6969
|
+
const { props: $ } = i;
|
|
6963
6970
|
O();
|
|
6964
6971
|
function O() {
|
|
6965
6972
|
for (const T of l)
|
|
@@ -6978,7 +6985,7 @@ const code_1$1 = code, codegen_1$4 = codegen, util_1$6 = util, util_2 = util, de
|
|
|
6978
6985
|
schemaProp: T,
|
|
6979
6986
|
dataProp: y,
|
|
6980
6987
|
dataPropType: util_2.Type.Str
|
|
6981
|
-
}, p), i.opts.unevaluated &&
|
|
6988
|
+
}, p), i.opts.unevaluated && $ !== !0 ? t.assign((0, codegen_1$4._)`${$}[${y}]`, !0) : !_ && !i.allErrors && t.if((0, codegen_1$4.not)(p), () => t.break());
|
|
6982
6989
|
});
|
|
6983
6990
|
});
|
|
6984
6991
|
}
|
|
@@ -7037,14 +7044,14 @@ const codegen_1$3 = codegen, util_1$4 = util, error$3 = {
|
|
|
7037
7044
|
const i = r, o = t.let("valid", !1), l = t.let("passing", null), d = t.name("_valid");
|
|
7038
7045
|
e.setParams({ passing: l }), t.block(u), e.result(o, () => e.reset(), () => e.error(!0));
|
|
7039
7046
|
function u() {
|
|
7040
|
-
i.forEach((p,
|
|
7047
|
+
i.forEach((p, $) => {
|
|
7041
7048
|
let O;
|
|
7042
7049
|
(0, util_1$4.alwaysValidSchema)(s, p) ? t.var(d, !0) : O = e.subschema({
|
|
7043
7050
|
keyword: "oneOf",
|
|
7044
|
-
schemaProp:
|
|
7051
|
+
schemaProp: $,
|
|
7045
7052
|
compositeRule: !0
|
|
7046
|
-
}, d),
|
|
7047
|
-
t.assign(o, !0), t.assign(l,
|
|
7053
|
+
}, d), $ > 0 && t.if((0, codegen_1$3._)`${d} && ${o}`).assign(o, !1).assign(l, (0, codegen_1$3._)`[${l}, ${$}]`).else(), t.if(d, () => {
|
|
7054
|
+
t.assign(o, !0), t.assign(l, $), O && e.mergeEvaluated(O, codegen_1$3.Name);
|
|
7048
7055
|
});
|
|
7049
7056
|
});
|
|
7050
7057
|
}
|
|
@@ -7102,10 +7109,10 @@ const codegen_1$2 = codegen, util_1$2 = util, error$2 = {
|
|
|
7102
7109
|
}, l);
|
|
7103
7110
|
e.mergeEvaluated(p);
|
|
7104
7111
|
}
|
|
7105
|
-
function u(p,
|
|
7112
|
+
function u(p, $) {
|
|
7106
7113
|
return () => {
|
|
7107
7114
|
const O = e.subschema({ keyword: p }, l);
|
|
7108
|
-
t.assign(o, l), e.mergeValidEvaluated(O, o),
|
|
7115
|
+
t.assign(o, l), e.mergeValidEvaluated(O, o), $ ? t.assign($, (0, codegen_1$2._)`${p}`) : e.setParams({ ifClause: p });
|
|
7109
7116
|
};
|
|
7110
7117
|
}
|
|
7111
7118
|
}
|
|
@@ -7158,17 +7165,17 @@ const codegen_1$1 = codegen, error$1 = {
|
|
|
7158
7165
|
$data: !0,
|
|
7159
7166
|
error: error$1,
|
|
7160
7167
|
code(e, t) {
|
|
7161
|
-
const { gen: r, data: n, $data: s, schema: i, schemaCode: o, it: l } = e, { opts: d, errSchemaPath: u, schemaEnv: p, self:
|
|
7168
|
+
const { gen: r, data: n, $data: s, schema: i, schemaCode: o, it: l } = e, { opts: d, errSchemaPath: u, schemaEnv: p, self: $ } = l;
|
|
7162
7169
|
if (!d.validateFormats)
|
|
7163
7170
|
return;
|
|
7164
7171
|
s ? O() : N();
|
|
7165
7172
|
function O() {
|
|
7166
7173
|
const R = r.scopeValue("formats", {
|
|
7167
|
-
ref:
|
|
7174
|
+
ref: $.formats,
|
|
7168
7175
|
code: d.code.formats
|
|
7169
7176
|
}), T = r.const("fDef", (0, codegen_1$1._)`${R}[${o}]`), y = r.let("fType"), _ = r.let("format");
|
|
7170
|
-
r.if((0, codegen_1$1._)`typeof ${T} == "object" && !(${T} instanceof RegExp)`, () => r.assign(y, (0, codegen_1$1._)`${T}.type || "string"`).assign(_, (0, codegen_1$1._)`${T}.validate`), () => r.assign(y, (0, codegen_1$1._)`"string"`).assign(_, T)), e.fail$data((0, codegen_1$1.or)(
|
|
7171
|
-
function
|
|
7177
|
+
r.if((0, codegen_1$1._)`typeof ${T} == "object" && !(${T} instanceof RegExp)`, () => r.assign(y, (0, codegen_1$1._)`${T}.type || "string"`).assign(_, (0, codegen_1$1._)`${T}.validate`), () => r.assign(y, (0, codegen_1$1._)`"string"`).assign(_, T)), e.fail$data((0, codegen_1$1.or)(g(), P()));
|
|
7178
|
+
function g() {
|
|
7172
7179
|
return d.strictSchema === !1 ? codegen_1$1.nil : (0, codegen_1$1._)`${o} && !${_}`;
|
|
7173
7180
|
}
|
|
7174
7181
|
function P() {
|
|
@@ -7177,18 +7184,18 @@ const codegen_1$1 = codegen, error$1 = {
|
|
|
7177
7184
|
}
|
|
7178
7185
|
}
|
|
7179
7186
|
function N() {
|
|
7180
|
-
const R =
|
|
7187
|
+
const R = $.formats[i];
|
|
7181
7188
|
if (!R) {
|
|
7182
|
-
|
|
7189
|
+
g();
|
|
7183
7190
|
return;
|
|
7184
7191
|
}
|
|
7185
7192
|
if (R === !0)
|
|
7186
7193
|
return;
|
|
7187
7194
|
const [T, y, _] = P(R);
|
|
7188
7195
|
T === t && e.pass(I());
|
|
7189
|
-
function
|
|
7196
|
+
function g() {
|
|
7190
7197
|
if (d.strictSchema === !1) {
|
|
7191
|
-
|
|
7198
|
+
$.logger.warn(D());
|
|
7192
7199
|
return;
|
|
7193
7200
|
}
|
|
7194
7201
|
throw new Error(D());
|
|
@@ -7274,10 +7281,10 @@ const codegen_1 = codegen, types_1 = types, compile_1 = compile, util_1 = util,
|
|
|
7274
7281
|
const N = O();
|
|
7275
7282
|
t.if(!1);
|
|
7276
7283
|
for (const R in N)
|
|
7277
|
-
t.elseIf((0, codegen_1._)`${u} === ${R}`), t.assign(d,
|
|
7284
|
+
t.elseIf((0, codegen_1._)`${u} === ${R}`), t.assign(d, $(N[R]));
|
|
7278
7285
|
t.else(), e.error(!1, { discrError: types_1.DiscrError.Mapping, tag: u, tagName: l }), t.endIf();
|
|
7279
7286
|
}
|
|
7280
|
-
function
|
|
7287
|
+
function $(N) {
|
|
7281
7288
|
const R = t.name("valid"), T = e.subschema({ keyword: "oneOf", schemaProp: N }, R);
|
|
7282
7289
|
return e.mergeEvaluated(T, codegen_1.Name), R;
|
|
7283
7290
|
}
|
|
@@ -7291,7 +7298,7 @@ const codegen_1 = codegen, types_1 = types, compile_1 = compile, util_1 = util,
|
|
|
7291
7298
|
const w = (N = D == null ? void 0 : D.properties) === null || N === void 0 ? void 0 : N[l];
|
|
7292
7299
|
if (typeof w != "object")
|
|
7293
7300
|
throw new Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${l}"`);
|
|
7294
|
-
y = y && (T || _(D)),
|
|
7301
|
+
y = y && (T || _(D)), g(w, I);
|
|
7295
7302
|
}
|
|
7296
7303
|
if (!y)
|
|
7297
7304
|
throw new Error(`discriminator: "${l}" must be required`);
|
|
@@ -7299,7 +7306,7 @@ const codegen_1 = codegen, types_1 = types, compile_1 = compile, util_1 = util,
|
|
|
7299
7306
|
function _({ required: I }) {
|
|
7300
7307
|
return Array.isArray(I) && I.includes(l);
|
|
7301
7308
|
}
|
|
7302
|
-
function
|
|
7309
|
+
function g(I, D) {
|
|
7303
7310
|
if (I.const)
|
|
7304
7311
|
P(I.const, D);
|
|
7305
7312
|
else if (I.enum)
|
|
@@ -7594,9 +7601,9 @@ const $schema$1 = "http://json-schema.org/draft-07/schema#", $id = "http://json-
|
|
|
7594
7601
|
} }), Object.defineProperty(t, "CodeGen", { enumerable: !0, get: function() {
|
|
7595
7602
|
return p.CodeGen;
|
|
7596
7603
|
} });
|
|
7597
|
-
var
|
|
7604
|
+
var $ = validation_error;
|
|
7598
7605
|
Object.defineProperty(t, "ValidationError", { enumerable: !0, get: function() {
|
|
7599
|
-
return
|
|
7606
|
+
return $.default;
|
|
7600
7607
|
} });
|
|
7601
7608
|
var O = ref_error;
|
|
7602
7609
|
Object.defineProperty(t, "MissingRefError", { enumerable: !0, get: function() {
|
|
@@ -9214,13 +9221,13 @@ function compileBlueprint(e, {
|
|
|
9214
9221
|
onStepCompleted: n = () => {
|
|
9215
9222
|
}
|
|
9216
9223
|
} = {}) {
|
|
9217
|
-
var
|
|
9224
|
+
var $, O, N, R, T, y, _;
|
|
9218
9225
|
e = {
|
|
9219
9226
|
...e,
|
|
9220
9227
|
steps: (e.steps || []).filter(isStepDefinition)
|
|
9221
9228
|
};
|
|
9222
|
-
for (const
|
|
9223
|
-
typeof
|
|
9229
|
+
for (const g of e.steps)
|
|
9230
|
+
typeof g == "object" && g.step === "importFile" && (g.step = "importWxr", console.warn(
|
|
9224
9231
|
'The "importFile" step is deprecated. Use "importWxr" instead.'
|
|
9225
9232
|
));
|
|
9226
9233
|
if (e.constants && e.steps.unshift({
|
|
@@ -9230,7 +9237,7 @@ function compileBlueprint(e, {
|
|
|
9230
9237
|
step: "setSiteOptions",
|
|
9231
9238
|
options: e.siteOptions
|
|
9232
9239
|
}), e.plugins) {
|
|
9233
|
-
const
|
|
9240
|
+
const g = e.plugins.map((P) => typeof P == "string" ? P.startsWith("https://") ? {
|
|
9234
9241
|
resource: "url",
|
|
9235
9242
|
url: P
|
|
9236
9243
|
} : {
|
|
@@ -9240,17 +9247,17 @@ function compileBlueprint(e, {
|
|
|
9240
9247
|
step: "installPlugin",
|
|
9241
9248
|
pluginZipFile: P
|
|
9242
9249
|
}));
|
|
9243
|
-
e.steps.unshift(
|
|
9250
|
+
e.steps.unshift(...g);
|
|
9244
9251
|
}
|
|
9245
9252
|
e.login && e.steps.push({
|
|
9246
9253
|
step: "login",
|
|
9247
9254
|
...e.login === !0 ? { username: "admin", password: "password" } : e.login
|
|
9248
9255
|
}), e.phpExtensionBundles || (e.phpExtensionBundles = []), e.phpExtensionBundles || (e.phpExtensionBundles = []), e.phpExtensionBundles.length === 0 && e.phpExtensionBundles.push("kitchen-sink");
|
|
9249
|
-
const s = (
|
|
9250
|
-
(
|
|
9256
|
+
const s = ($ = e.steps) == null ? void 0 : $.findIndex(
|
|
9257
|
+
(g) => typeof g == "object" && (g == null ? void 0 : g.step) === "wp-cli"
|
|
9251
9258
|
);
|
|
9252
9259
|
s !== void 0 && s > -1 && (e.phpExtensionBundles.includes("light") && (e.phpExtensionBundles = e.phpExtensionBundles.filter(
|
|
9253
|
-
(
|
|
9260
|
+
(g) => g !== "light"
|
|
9254
9261
|
), console.warn(
|
|
9255
9262
|
"The wpCli step used in your Blueprint requires the iconv and mbstring PHP extensions. However, you did not specify the kitchen-sink extension bundle. Playground will override your choice and load the kitchen-sink PHP extensions bundle to prevent the WP-CLI step from failing. "
|
|
9256
9263
|
)), (O = e.steps) == null || O.splice(s, 0, {
|
|
@@ -9272,10 +9279,10 @@ function compileBlueprint(e, {
|
|
|
9272
9279
|
path: "/tmp/wp-cli.phar"
|
|
9273
9280
|
}));
|
|
9274
9281
|
const i = (N = e.steps) == null ? void 0 : N.findIndex(
|
|
9275
|
-
(
|
|
9282
|
+
(g) => typeof g == "object" && (g == null ? void 0 : g.step) === "importWxr"
|
|
9276
9283
|
);
|
|
9277
9284
|
i !== void 0 && i > -1 && (e.phpExtensionBundles.includes("light") && (e.phpExtensionBundles = e.phpExtensionBundles.filter(
|
|
9278
|
-
(
|
|
9285
|
+
(g) => g !== "light"
|
|
9279
9286
|
), console.warn(
|
|
9280
9287
|
"The importWxr step used in your Blueprint requires the iconv and mbstring PHP extensions. However, you did not specify the kitchen-sink extension bundle. Playground will override your choice and load the kitchen-sink PHP extensions bundle to prevent the WP-CLI step from failing. "
|
|
9281
9288
|
)), (R = e.steps) == null || R.splice(i, 0, {
|
|
@@ -9288,19 +9295,19 @@ function compileBlueprint(e, {
|
|
|
9288
9295
|
}));
|
|
9289
9296
|
const { valid: o, errors: l } = validateBlueprint(e);
|
|
9290
9297
|
if (!o) {
|
|
9291
|
-
const
|
|
9298
|
+
const g = new Error(
|
|
9292
9299
|
`Invalid blueprint: ${l[0].message} at ${l[0].instancePath}`
|
|
9293
9300
|
);
|
|
9294
|
-
throw
|
|
9301
|
+
throw g.errors = l, g;
|
|
9295
9302
|
}
|
|
9296
9303
|
const d = e.steps || [], u = d.reduce(
|
|
9297
|
-
(
|
|
9304
|
+
(g, P) => {
|
|
9298
9305
|
var I;
|
|
9299
|
-
return
|
|
9306
|
+
return g + (((I = P.progress) == null ? void 0 : I.weight) || 1);
|
|
9300
9307
|
},
|
|
9301
9308
|
0
|
|
9302
9309
|
), p = d.map(
|
|
9303
|
-
(
|
|
9310
|
+
(g) => compileStep(g, {
|
|
9304
9311
|
semaphore: r,
|
|
9305
9312
|
rootProgressTracker: t,
|
|
9306
9313
|
totalProgressWeight: u
|
|
@@ -9323,14 +9330,14 @@ function compileBlueprint(e, {
|
|
|
9323
9330
|
// Disable networking by default
|
|
9324
9331
|
networking: ((_ = e.features) == null ? void 0 : _.networking) ?? !1
|
|
9325
9332
|
},
|
|
9326
|
-
run: async (
|
|
9333
|
+
run: async (g) => {
|
|
9327
9334
|
try {
|
|
9328
9335
|
for (const { resources: P } of p)
|
|
9329
9336
|
for (const I of P)
|
|
9330
|
-
I.setPlayground(
|
|
9337
|
+
I.setPlayground(g), I.isAsync && I.resolve();
|
|
9331
9338
|
for (const [P, { run: I, step: D }] of Object.entries(p))
|
|
9332
9339
|
try {
|
|
9333
|
-
const w = await I(
|
|
9340
|
+
const w = await I(g);
|
|
9334
9341
|
n(w, D);
|
|
9335
9342
|
} catch (w) {
|
|
9336
9343
|
throw console.error(w), new Error(
|
|
@@ -9342,7 +9349,7 @@ function compileBlueprint(e, {
|
|
|
9342
9349
|
}
|
|
9343
9350
|
} finally {
|
|
9344
9351
|
try {
|
|
9345
|
-
await
|
|
9352
|
+
await g.goTo(
|
|
9346
9353
|
e.landingPage || "/"
|
|
9347
9354
|
);
|
|
9348
9355
|
} catch {
|
|
@@ -9394,17 +9401,17 @@ function compileStep(e, {
|
|
|
9394
9401
|
const s = r.stage(
|
|
9395
9402
|
(((p = e.progress) == null ? void 0 : p.weight) || 1) / n
|
|
9396
9403
|
), i = {};
|
|
9397
|
-
for (const
|
|
9398
|
-
let O = e[
|
|
9404
|
+
for (const $ of Object.keys(e)) {
|
|
9405
|
+
let O = e[$];
|
|
9399
9406
|
isFileReference(O) && (O = Resource.create(O, {
|
|
9400
9407
|
semaphore: t
|
|
9401
|
-
})), i[
|
|
9408
|
+
})), i[$] = O;
|
|
9402
9409
|
}
|
|
9403
|
-
const o = async (
|
|
9410
|
+
const o = async ($) => {
|
|
9404
9411
|
var O;
|
|
9405
9412
|
try {
|
|
9406
9413
|
return s.fillSlowly(), await keyedStepHandlers[e.step](
|
|
9407
|
-
|
|
9414
|
+
$,
|
|
9408
9415
|
await resolveArguments(i),
|
|
9409
9416
|
{
|
|
9410
9417
|
tracker: s,
|
|
@@ -9415,10 +9422,10 @@ function compileStep(e, {
|
|
|
9415
9422
|
s.finish();
|
|
9416
9423
|
}
|
|
9417
9424
|
}, l = getResources(i), d = getResources(i).filter(
|
|
9418
|
-
(
|
|
9425
|
+
($) => $.isAsync
|
|
9419
9426
|
), u = 1 / (d.length + 1);
|
|
9420
|
-
for (const
|
|
9421
|
-
|
|
9427
|
+
for (const $ of d)
|
|
9428
|
+
$.progress = s.stage(u);
|
|
9422
9429
|
return { run: o, step: e, resources: l };
|
|
9423
9430
|
}
|
|
9424
9431
|
function getResources(e) {
|