@wp-playground/client 0.6.7 → 0.6.9
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 +28 -28
- package/index.d.ts +53 -10
- package/index.js +964 -835
- package/package.json +2 -2
package/index.js
CHANGED
|
@@ -269,7 +269,6 @@ const activatePlugin = async (e, { pluginPath: t, pluginName: r }, n) => {
|
|
|
269
269
|
n == null || n.tracker.setCaption(`Activating ${r || t}`);
|
|
270
270
|
const s = await e.documentRoot;
|
|
271
271
|
await e.run({
|
|
272
|
-
throwOnError: !0,
|
|
273
272
|
code: `<?php
|
|
274
273
|
define( 'WP_ADMIN', true );
|
|
275
274
|
require_once( ${phpVar(s)}. "/wp-load.php" );
|
|
@@ -301,7 +300,6 @@ exit(1);
|
|
|
301
300
|
r == null || r.tracker.setCaption(`Activating ${t}`);
|
|
302
301
|
const n = await e.documentRoot;
|
|
303
302
|
await e.run({
|
|
304
|
-
throwOnError: !0,
|
|
305
303
|
code: `<?php
|
|
306
304
|
define( 'WP_ADMIN', true );
|
|
307
305
|
require_once( ${phpVar(n)}. "/wp-load.php" );
|
|
@@ -312,7 +310,7 @@ set_current_user( get_users(array('role' => 'Administrator') )[0] );
|
|
|
312
310
|
switch_theme( ${phpVar(t)} );
|
|
313
311
|
`
|
|
314
312
|
});
|
|
315
|
-
}, runPHP = async (e, { code: t }) => await e.run({ code: t
|
|
313
|
+
}, runPHP = async (e, { code: t }) => await e.run({ code: t }), runPHPWithOptions = async (e, { options: t }) => await e.run(t), rm = async (e, { path: t }) => {
|
|
316
314
|
await e.unlink(t);
|
|
317
315
|
}, runSql = async (e, { sql: t }, r) => {
|
|
318
316
|
r == null || r.tracker.setCaption("Executing SQL Queries");
|
|
@@ -712,7 +710,6 @@ async function rewriteDefineCalls(e, t, r) {
|
|
|
712
710
|
consts: r
|
|
713
711
|
});
|
|
714
712
|
return await e.run({
|
|
715
|
-
throwOnError: !0,
|
|
716
713
|
code: `${rewriteWpConfigToDefineConstants}
|
|
717
714
|
$wp_config_path = '/tmp/code.php';
|
|
718
715
|
$wp_config = file_get_contents($wp_config_path);
|
|
@@ -745,7 +742,6 @@ const login = async (e, { username: t = "admin", password: r = "password" } = {}
|
|
|
745
742
|
}, setSiteOptions = async (e, { options: t }) => {
|
|
746
743
|
const r = await e.documentRoot;
|
|
747
744
|
await e.run({
|
|
748
|
-
throwOnError: !0,
|
|
749
745
|
code: `<?php
|
|
750
746
|
include ${phpVar(r)} . '/wp-load.php';
|
|
751
747
|
$site_options = ${phpVar(t)};
|
|
@@ -758,7 +754,6 @@ const login = async (e, { username: t = "admin", password: r = "password" } = {}
|
|
|
758
754
|
}, updateUserMeta = async (e, { meta: t, userId: r }) => {
|
|
759
755
|
const n = await e.documentRoot;
|
|
760
756
|
await e.run({
|
|
761
|
-
throwOnError: !0,
|
|
762
757
|
code: `<?php
|
|
763
758
|
include ${phpVar(n)} . '/wp-load.php';
|
|
764
759
|
$meta = ${phpVar(t)};
|
|
@@ -794,7 +789,6 @@ const enableMultisite = async (e) => {
|
|
|
794
789
|
}
|
|
795
790
|
}), await login(e, {});
|
|
796
791
|
const s = await e.documentRoot, o = (await e.run({
|
|
797
|
-
throwOnError: !0,
|
|
798
792
|
code: `<?php
|
|
799
793
|
define( 'WP_ADMIN', true );
|
|
800
794
|
require_once(${phpVar(s)} . "/wp-load.php");
|
|
@@ -865,14 +859,14 @@ echo json_encode($deactivated_plugins);
|
|
|
865
859
|
PATH_CURRENT_SITE: r
|
|
866
860
|
}
|
|
867
861
|
});
|
|
868
|
-
const p = new URL(await e.absoluteUrl),
|
|
862
|
+
const p = new URL(await e.absoluteUrl), g = isURLScoped(p) ? "scope:" + getURLScope(p) : null;
|
|
869
863
|
await e.writeFile(
|
|
870
864
|
joinPaths(s, "/wp-content/sunrise.php"),
|
|
871
865
|
`<?php
|
|
872
866
|
if ( !defined( 'BLOG_ID_CURRENT_SITE' ) ) {
|
|
873
867
|
define( 'BLOG_ID_CURRENT_SITE', 1 );
|
|
874
868
|
}
|
|
875
|
-
$folder = ${phpVar(
|
|
869
|
+
$folder = ${phpVar(g)};
|
|
876
870
|
if ($folder && strpos($_SERVER['REQUEST_URI'],"/$folder") === false) {
|
|
877
871
|
$_SERVER['HTTP_HOST'] = ${phpVar(p.hostname)};
|
|
878
872
|
$_SERVER['REQUEST_URI'] = "/$folder/" . ltrim($_SERVER['REQUEST_URI'], '/');
|
|
@@ -927,9 +921,9 @@ const cp = async (e, { fromPath: t, toPath: r }) => {
|
|
|
927
921
|
);
|
|
928
922
|
const c = getFormData(o);
|
|
929
923
|
c.fetch_attachments = "1";
|
|
930
|
-
for (const
|
|
931
|
-
if (
|
|
932
|
-
const R = "user_new[" +
|
|
924
|
+
for (const g in c)
|
|
925
|
+
if (g.startsWith("user_map[")) {
|
|
926
|
+
const R = "user_new[" + g.slice(9, -1) + "]";
|
|
933
927
|
c[R] = "1";
|
|
934
928
|
}
|
|
935
929
|
const d = await e.request({
|
|
@@ -1035,7 +1029,6 @@ function delTree($dir)
|
|
|
1035
1029
|
`;
|
|
1036
1030
|
async function runPhpWithZipFunctions(e, t) {
|
|
1037
1031
|
return await e.run({
|
|
1038
|
-
throwOnError: !0,
|
|
1039
1032
|
code: zipFunctions + t
|
|
1040
1033
|
});
|
|
1041
1034
|
}
|
|
@@ -1071,13 +1064,13 @@ const tmpPath = "/tmp/file.zip", unzip = async (e, { zipFile: t, zipPath: r, ext
|
|
|
1071
1064
|
}), s = joinPaths(s, r);
|
|
1072
1065
|
const i = joinPaths(s, "wp-content"), o = joinPaths(n, "wp-content");
|
|
1073
1066
|
for (const p of wpContentFilesExcludedFromExport) {
|
|
1074
|
-
const
|
|
1067
|
+
const g = joinPaths(
|
|
1075
1068
|
i,
|
|
1076
1069
|
p
|
|
1077
1070
|
);
|
|
1078
|
-
await removePath(e,
|
|
1071
|
+
await removePath(e, g);
|
|
1079
1072
|
const R = joinPaths(o, p);
|
|
1080
|
-
await e.fileExists(R) && (await e.mkdir(dirname(
|
|
1073
|
+
await e.fileExists(R) && (await e.mkdir(dirname(g)), await e.mv(R, g));
|
|
1081
1074
|
}
|
|
1082
1075
|
const c = joinPaths(
|
|
1083
1076
|
s,
|
|
@@ -1101,7 +1094,6 @@ const tmpPath = "/tmp/file.zip", unzip = async (e, { zipFile: t, zipPath: r, ext
|
|
|
1101
1094
|
joinPaths(n, "wp-admin", "upgrade.php")
|
|
1102
1095
|
);
|
|
1103
1096
|
await e.run({
|
|
1104
|
-
throwOnError: !0,
|
|
1105
1097
|
code: `<?php
|
|
1106
1098
|
$_GET['step'] = 'upgrade_db';
|
|
1107
1099
|
require ${u};
|
|
@@ -1138,10 +1130,10 @@ async function installAsset(e, { targetPath: t, zipFile: r }) {
|
|
|
1138
1130
|
});
|
|
1139
1131
|
d = d.filter((O) => !O.endsWith("/__MACOSX"));
|
|
1140
1132
|
const u = d.length === 1 && await e.isDir(d[0]);
|
|
1141
|
-
let p,
|
|
1142
|
-
u ? (
|
|
1133
|
+
let p, g = "";
|
|
1134
|
+
u ? (g = d[0], p = d[0].split("/").pop()) : (g = c, p = s);
|
|
1143
1135
|
const R = `${t}/${p}`;
|
|
1144
|
-
return await e.mv(
|
|
1136
|
+
return await e.mv(g, R), {
|
|
1145
1137
|
assetFolderPath: R,
|
|
1146
1138
|
assetFolderName: p
|
|
1147
1139
|
};
|
|
@@ -1903,20 +1895,21 @@ class PHPRequestHandler {
|
|
|
1903
1895
|
te(this, Fe, new Semaphore({ concurrency: 1 }));
|
|
1904
1896
|
const {
|
|
1905
1897
|
documentRoot: n = "/www/",
|
|
1906
|
-
absoluteUrl: s = typeof location == "object" ? location == null ? void 0 : location.href : ""
|
|
1898
|
+
absoluteUrl: s = typeof location == "object" ? location == null ? void 0 : location.href : "",
|
|
1899
|
+
rewriteRules: i = []
|
|
1907
1900
|
} = r;
|
|
1908
1901
|
this.php = t, te(this, Pe, n);
|
|
1909
|
-
const
|
|
1910
|
-
te(this, dt,
|
|
1911
|
-
const
|
|
1902
|
+
const o = new URL(s);
|
|
1903
|
+
te(this, dt, o.hostname), te(this, De, o.port ? Number(o.port) : o.protocol === "https:" ? 443 : 80), te(this, Ke, (o.protocol || "").replace(":", ""));
|
|
1904
|
+
const c = H(this, De) !== 443 && H(this, De) !== 80;
|
|
1912
1905
|
te(this, Je, [
|
|
1913
1906
|
H(this, dt),
|
|
1914
|
-
|
|
1915
|
-
].join("")), te(this, ve,
|
|
1907
|
+
c ? `:${H(this, De)}` : ""
|
|
1908
|
+
].join("")), te(this, ve, o.pathname.replace(/\/+$/, "")), te(this, Qe, [
|
|
1916
1909
|
`${H(this, Ke)}://`,
|
|
1917
1910
|
H(this, Je),
|
|
1918
1911
|
H(this, ve)
|
|
1919
|
-
].join(""));
|
|
1912
|
+
].join("")), this.rewriteRules = i;
|
|
1920
1913
|
}
|
|
1921
1914
|
/** @inheritDoc */
|
|
1922
1915
|
pathToInternalUrl(t) {
|
|
@@ -1941,11 +1934,12 @@ class PHPRequestHandler {
|
|
|
1941
1934
|
/** @inheritDoc */
|
|
1942
1935
|
async request(t) {
|
|
1943
1936
|
const r = t.url.startsWith("http://") || t.url.startsWith("https://"), n = new URL(
|
|
1944
|
-
|
|
1937
|
+
// Remove the hash part of the URL as it's not meant for the server.
|
|
1938
|
+
t.url.split("#")[0],
|
|
1945
1939
|
r ? void 0 : DEFAULT_BASE_URL
|
|
1946
|
-
), s =
|
|
1947
|
-
n.pathname,
|
|
1948
|
-
|
|
1940
|
+
), s = applyRewriteRules(
|
|
1941
|
+
removePathPrefix(n.pathname, H(this, ve)),
|
|
1942
|
+
this.rewriteRules
|
|
1949
1943
|
), i = `${H(this, Pe)}${s}`;
|
|
1950
1944
|
return seemsLikeAPHPRequestHandlerPath(i) ? await ce(this, _t, Wt).call(this, t, n) : ce(this, mt, zt).call(this, i);
|
|
1951
1945
|
}
|
|
@@ -1976,7 +1970,7 @@ Pe = new WeakMap(), Ke = new WeakMap(), dt = new WeakMap(), De = new WeakMap(),
|
|
|
1976
1970
|
r
|
|
1977
1971
|
);
|
|
1978
1972
|
}, _t = new WeakSet(), Wt = async function(t, r) {
|
|
1979
|
-
var s
|
|
1973
|
+
var s;
|
|
1980
1974
|
if (H(this, Fe).running > 0 && ((s = t.headers) == null ? void 0 : s["x-request-issuer"]) === "php")
|
|
1981
1975
|
return console.warn(
|
|
1982
1976
|
"Possible deadlock: Called request() before the previous request() have finished. PHP likely issued an HTTP call to itself. Normally this would lead to infinite waiting as Request 1 holds the lock that the Request 2 is waiting to acquire. That's not useful, so PHPRequestHandler will return error 502 instead."
|
|
@@ -1991,28 +1985,20 @@ Pe = new WeakMap(), Ke = new WeakMap(), dt = new WeakMap(), De = new WeakMap(),
|
|
|
1991
1985
|
"HTTPS",
|
|
1992
1986
|
H(this, Qe).startsWith("https://") ? "on" : ""
|
|
1993
1987
|
);
|
|
1994
|
-
let
|
|
1995
|
-
const
|
|
1988
|
+
let i = "GET";
|
|
1989
|
+
const o = {
|
|
1996
1990
|
host: H(this, Je),
|
|
1997
1991
|
...normalizeHeaders(t.headers || {})
|
|
1998
1992
|
};
|
|
1999
|
-
let
|
|
2000
|
-
if (typeof
|
|
2001
|
-
|
|
2002
|
-
const { bytes:
|
|
2003
|
-
|
|
1993
|
+
let c = t.body;
|
|
1994
|
+
if (typeof c == "object" && !(c instanceof Uint8Array)) {
|
|
1995
|
+
i = "POST";
|
|
1996
|
+
const { bytes: u, contentType: p } = await encodeAsMultipart(c);
|
|
1997
|
+
c = u, o["content-type"] = p;
|
|
2004
1998
|
}
|
|
2005
|
-
let
|
|
1999
|
+
let d;
|
|
2006
2000
|
try {
|
|
2007
|
-
|
|
2008
|
-
if ((i = t.headers) != null && i["x-rewrite-url"])
|
|
2009
|
-
try {
|
|
2010
|
-
p = new URL(
|
|
2011
|
-
t.headers["x-rewrite-url"]
|
|
2012
|
-
).pathname;
|
|
2013
|
-
} catch {
|
|
2014
|
-
}
|
|
2015
|
-
u = ce(this, gt, Bt).call(this, p);
|
|
2001
|
+
d = ce(this, gt, Bt).call(this, r.pathname);
|
|
2016
2002
|
} catch {
|
|
2017
2003
|
return new PHPResponse(
|
|
2018
2004
|
404,
|
|
@@ -2026,17 +2012,17 @@ Pe = new WeakMap(), Ke = new WeakMap(), dt = new WeakMap(), De = new WeakMap(),
|
|
|
2026
2012
|
H(this, ve)
|
|
2027
2013
|
),
|
|
2028
2014
|
protocol: H(this, Ke),
|
|
2029
|
-
method: t.method ||
|
|
2030
|
-
body:
|
|
2031
|
-
scriptPath:
|
|
2032
|
-
headers:
|
|
2015
|
+
method: t.method || i,
|
|
2016
|
+
body: c,
|
|
2017
|
+
scriptPath: d,
|
|
2018
|
+
headers: o
|
|
2033
2019
|
});
|
|
2034
2020
|
} finally {
|
|
2035
2021
|
n();
|
|
2036
2022
|
}
|
|
2037
2023
|
}, gt = new WeakSet(), Bt = function(t) {
|
|
2038
2024
|
let r = removePathPrefix(t, H(this, ve));
|
|
2039
|
-
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";
|
|
2025
|
+
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";
|
|
2040
2026
|
const n = `${H(this, Pe)}${r}`;
|
|
2041
2027
|
if (this.php.fileExists(n))
|
|
2042
2028
|
return n;
|
|
@@ -2091,6 +2077,12 @@ function seemsLikeAPHPFile(e) {
|
|
|
2091
2077
|
function seemsLikeADirectoryRoot(e) {
|
|
2092
2078
|
return !e.split("/").pop().includes(".");
|
|
2093
2079
|
}
|
|
2080
|
+
function applyRewriteRules(e, t) {
|
|
2081
|
+
for (const r of t)
|
|
2082
|
+
if (new RegExp(r.match).test(e))
|
|
2083
|
+
return e.replace(r.match, r.replacement);
|
|
2084
|
+
return e;
|
|
2085
|
+
}
|
|
2094
2086
|
const FileErrorCodes = {
|
|
2095
2087
|
0: "No error occurred. System call completed successfully.",
|
|
2096
2088
|
1: "Argument list too long.",
|
|
@@ -2184,8 +2176,8 @@ function rethrowFileSystemError(e = "") {
|
|
|
2184
2176
|
} catch (c) {
|
|
2185
2177
|
const d = typeof c == "object" ? c == null ? void 0 : c.errno : null;
|
|
2186
2178
|
if (d in FileErrorCodes) {
|
|
2187
|
-
const u = FileErrorCodes[d], p = typeof o[0] == "string" ? o[0] : null,
|
|
2188
|
-
throw new Error(`${
|
|
2179
|
+
const u = FileErrorCodes[d], p = typeof o[0] == "string" ? o[0] : null, g = p !== null ? e.replaceAll("{path}", p) : e;
|
|
2180
|
+
throw new Error(`${g}: ${u}`, {
|
|
2189
2181
|
cause: c
|
|
2190
2182
|
});
|
|
2191
2183
|
}
|
|
@@ -2208,7 +2200,7 @@ var __defProp = Object.defineProperty, __getOwnPropDesc = Object.getOwnPropertyD
|
|
|
2208
2200
|
return n && s && __defProp(t, r, s), s;
|
|
2209
2201
|
};
|
|
2210
2202
|
const STRING = "string", NUMBER = "number", __private__dont__use = Symbol("__private__dont__use");
|
|
2211
|
-
var Me, Ze, Ye,
|
|
2203
|
+
var Me, Ze, Ye, be, Re, Te, Ee, Xe, yt, Gt, $t, Kt, vt, Jt, wt, Qt, Pt, Zt, bt, Yt, Et, Xt, St, er, Rt, tr, Tt, rr, kt, nr, Ct, sr;
|
|
2212
2204
|
class BasePHP {
|
|
2213
2205
|
/**
|
|
2214
2206
|
* Initializes a PHP runtime.
|
|
@@ -2218,13 +2210,13 @@ class BasePHP {
|
|
|
2218
2210
|
* @param serverOptions - Optional. Options for the PHPRequestHandler. If undefined, no request handler will be initialized.
|
|
2219
2211
|
*/
|
|
2220
2212
|
constructor(e, t) {
|
|
2221
|
-
Q(this, $t);
|
|
2222
2213
|
Q(this, yt);
|
|
2214
|
+
Q(this, $t);
|
|
2223
2215
|
Q(this, vt);
|
|
2224
2216
|
Q(this, wt);
|
|
2225
2217
|
Q(this, Pt);
|
|
2226
|
-
Q(this, Et);
|
|
2227
2218
|
Q(this, bt);
|
|
2219
|
+
Q(this, Et);
|
|
2228
2220
|
Q(this, St);
|
|
2229
2221
|
Q(this, Rt);
|
|
2230
2222
|
Q(this, Tt);
|
|
@@ -2233,24 +2225,24 @@ class BasePHP {
|
|
|
2233
2225
|
Q(this, Me, void 0);
|
|
2234
2226
|
Q(this, Ze, void 0);
|
|
2235
2227
|
Q(this, Ye, void 0);
|
|
2236
|
-
Q(this,
|
|
2228
|
+
Q(this, be, void 0);
|
|
2237
2229
|
Q(this, Re, void 0);
|
|
2238
2230
|
Q(this, Te, void 0);
|
|
2239
|
-
Q(this,
|
|
2231
|
+
Q(this, Ee, void 0);
|
|
2240
2232
|
Q(this, Xe, void 0);
|
|
2241
|
-
te(this, Me, []), te(this,
|
|
2233
|
+
te(this, Me, []), te(this, be, !1), te(this, Re, null), te(this, Te, {}), te(this, Ee, /* @__PURE__ */ new Map()), te(this, Xe, []), this.semaphore = new Semaphore({ concurrency: 1 }), e !== void 0 && this.initializeRuntime(e), t && (this.requestHandler = new PHPBrowser(
|
|
2242
2234
|
new PHPRequestHandler(this, t)
|
|
2243
2235
|
));
|
|
2244
2236
|
}
|
|
2245
2237
|
addEventListener(e, t) {
|
|
2246
|
-
H(this,
|
|
2238
|
+
H(this, Ee).has(e) || H(this, Ee).set(e, /* @__PURE__ */ new Set()), H(this, Ee).get(e).add(t);
|
|
2247
2239
|
}
|
|
2248
2240
|
removeEventListener(e, t) {
|
|
2249
2241
|
var r;
|
|
2250
|
-
(r = H(this,
|
|
2242
|
+
(r = H(this, Ee).get(e)) == null || r.delete(t);
|
|
2251
2243
|
}
|
|
2252
2244
|
dispatchEvent(e) {
|
|
2253
|
-
const t = H(this,
|
|
2245
|
+
const t = H(this, Ee).get(e.type);
|
|
2254
2246
|
if (t)
|
|
2255
2247
|
for (const r of t)
|
|
2256
2248
|
r(e);
|
|
@@ -2313,7 +2305,7 @@ class BasePHP {
|
|
|
2313
2305
|
}
|
|
2314
2306
|
/** @inheritDoc */
|
|
2315
2307
|
setPhpIniPath(e) {
|
|
2316
|
-
if (H(this,
|
|
2308
|
+
if (H(this, be))
|
|
2317
2309
|
throw new Error("Cannot set PHP ini path after calling run().");
|
|
2318
2310
|
te(this, Ze, e), this[__private__dont__use].ccall(
|
|
2319
2311
|
"wasm_set_phpini_path",
|
|
@@ -2324,7 +2316,7 @@ class BasePHP {
|
|
|
2324
2316
|
}
|
|
2325
2317
|
/** @inheritDoc */
|
|
2326
2318
|
setPhpIniEntry(e, t) {
|
|
2327
|
-
if (H(this,
|
|
2319
|
+
if (H(this, be))
|
|
2328
2320
|
throw new Error("Cannot set PHP ini entries after calling run().");
|
|
2329
2321
|
H(this, Me).push([e, t]);
|
|
2330
2322
|
}
|
|
@@ -2343,18 +2335,18 @@ class BasePHP {
|
|
|
2343
2335
|
const t = await this.semaphore.acquire();
|
|
2344
2336
|
let r;
|
|
2345
2337
|
try {
|
|
2346
|
-
if (H(this,
|
|
2338
|
+
if (H(this, be) || (ce(this, yt, Gt).call(this), te(this, be, !0)), e.scriptPath && !this.fileExists(e.scriptPath))
|
|
2347
2339
|
throw new Error(
|
|
2348
2340
|
`The script path "${e.scriptPath}" does not exist.`
|
|
2349
2341
|
);
|
|
2350
2342
|
ce(this, St, er).call(this, e.scriptPath || ""), ce(this, vt, Jt).call(this, e.relativeUri || ""), ce(this, Pt, Zt).call(this, e.method || "GET");
|
|
2351
2343
|
const n = normalizeHeaders(e.headers || {}), s = n.host || "example.com:443";
|
|
2352
|
-
ce(this, wt, Qt).call(this, s, e.protocol || "http"), ce(this,
|
|
2344
|
+
ce(this, wt, Qt).call(this, s, e.protocol || "http"), ce(this, bt, Yt).call(this, n), e.body && (r = ce(this, Et, Xt).call(this, e.body)), typeof e.code == "string" && ce(this, kt, nr).call(this, " ?>" + e.code), ce(this, Rt, tr).call(this);
|
|
2353
2345
|
const i = e.env || {};
|
|
2354
2346
|
for (const c in i)
|
|
2355
2347
|
ce(this, Tt, rr).call(this, c, i[c]);
|
|
2356
2348
|
const o = await ce(this, Ct, sr).call(this);
|
|
2357
|
-
if (
|
|
2349
|
+
if (o.exitCode !== 0) {
|
|
2358
2350
|
const c = {
|
|
2359
2351
|
stdout: o.text,
|
|
2360
2352
|
stderr: o.errors
|
|
@@ -2363,9 +2355,16 @@ class BasePHP {
|
|
|
2363
2355
|
const d = new Error(
|
|
2364
2356
|
`PHP.run() failed with exit code ${o.exitCode} and the following output: ` + o.errors
|
|
2365
2357
|
);
|
|
2366
|
-
throw d.output = c, console.error(d), d;
|
|
2358
|
+
throw d.output = c, d.source = "request", console.error(d), d;
|
|
2367
2359
|
}
|
|
2368
2360
|
return o;
|
|
2361
|
+
} catch (n) {
|
|
2362
|
+
throw this.dispatchEvent({
|
|
2363
|
+
type: "request.error",
|
|
2364
|
+
error: n,
|
|
2365
|
+
// Distinguish between PHP request and PHP-wasm errors
|
|
2366
|
+
source: n.source ?? "php-wasm"
|
|
2367
|
+
}), n;
|
|
2369
2368
|
} finally {
|
|
2370
2369
|
try {
|
|
2371
2370
|
r && this[__private__dont__use].free(r);
|
|
@@ -2486,10 +2485,10 @@ class BasePHP {
|
|
|
2486
2485
|
this[__private__dont__use]._exit(e);
|
|
2487
2486
|
} catch {
|
|
2488
2487
|
}
|
|
2489
|
-
te(this,
|
|
2488
|
+
te(this, be, !1), te(this, Re, null), delete this[__private__dont__use].onMessage, delete this[__private__dont__use];
|
|
2490
2489
|
}
|
|
2491
2490
|
}
|
|
2492
|
-
Me = new WeakMap(), Ze = new WeakMap(), Ye = new WeakMap(),
|
|
2491
|
+
Me = new WeakMap(), Ze = new WeakMap(), Ye = new WeakMap(), be = new WeakMap(), Re = new WeakMap(), Te = new WeakMap(), Ee = new WeakMap(), Xe = new WeakMap(), yt = new WeakSet(), Gt = function() {
|
|
2493
2492
|
if (this.setPhpIniEntry("auto_prepend_file", "/internal/consts.php"), this.fileExists("/internal/consts.php") || this.writeFile(
|
|
2494
2493
|
"/internal/consts.php",
|
|
2495
2494
|
`<?php
|
|
@@ -2514,7 +2513,7 @@ Me = new WeakMap(), Ze = new WeakMap(), Ye = new WeakMap(), Ee = new WeakMap(),
|
|
|
2514
2513
|
);
|
|
2515
2514
|
}
|
|
2516
2515
|
this[__private__dont__use].ccall("php_wasm_init", null, [], []);
|
|
2517
|
-
},
|
|
2516
|
+
}, $t = new WeakSet(), Kt = function() {
|
|
2518
2517
|
const e = "/internal/headers.json";
|
|
2519
2518
|
if (!this.fileExists(e))
|
|
2520
2519
|
throw new Error(
|
|
@@ -2571,7 +2570,7 @@ Me = new WeakMap(), Ze = new WeakMap(), Ye = new WeakMap(), Ee = new WeakMap(),
|
|
|
2571
2570
|
[STRING],
|
|
2572
2571
|
[e]
|
|
2573
2572
|
);
|
|
2574
|
-
},
|
|
2573
|
+
}, bt = new WeakSet(), Yt = function(e) {
|
|
2575
2574
|
e.cookie && this[__private__dont__use].ccall(
|
|
2576
2575
|
"wasm_set_cookies",
|
|
2577
2576
|
null,
|
|
@@ -2595,7 +2594,7 @@ Me = new WeakMap(), Ze = new WeakMap(), Ye = new WeakMap(), Ee = new WeakMap(),
|
|
|
2595
2594
|
e[t]
|
|
2596
2595
|
);
|
|
2597
2596
|
}
|
|
2598
|
-
},
|
|
2597
|
+
}, Et = new WeakSet(), Xt = function(e) {
|
|
2599
2598
|
let t, r;
|
|
2600
2599
|
typeof e == "string" ? (console.warn(
|
|
2601
2600
|
"Passing a string as the request body is deprecated. Please use a Uint8Array instead. See https://github.com/WordPress/wordpress-playground/issues/997 for more details"
|
|
@@ -2683,7 +2682,7 @@ Me = new WeakMap(), Ze = new WeakMap(), Ye = new WeakMap(), Ee = new WeakMap(),
|
|
|
2683
2682
|
} finally {
|
|
2684
2683
|
(s = H(this, Re)) == null || s.removeEventListener("error", t), te(this, Te, {});
|
|
2685
2684
|
}
|
|
2686
|
-
const { headers: r, httpStatusCode: n } = ce(this,
|
|
2685
|
+
const { headers: r, httpStatusCode: n } = ce(this, $t, Kt).call(this);
|
|
2687
2686
|
return new PHPResponse(
|
|
2688
2687
|
n,
|
|
2689
2688
|
r,
|
|
@@ -3037,7 +3036,7 @@ var ajv$1 = { exports: {} }, core$2 = {}, validate = {}, boolSchema = {}, errors
|
|
|
3037
3036
|
}
|
|
3038
3037
|
e.str = o;
|
|
3039
3038
|
function c(m, k) {
|
|
3040
|
-
k instanceof n ? m.push(...k._items) : k instanceof r ? m.push(k) : m.push(
|
|
3039
|
+
k instanceof n ? m.push(...k._items) : k instanceof r ? m.push(k) : m.push(g(k));
|
|
3041
3040
|
}
|
|
3042
3041
|
e.addCodeArg = c;
|
|
3043
3042
|
function d(m) {
|
|
@@ -3068,7 +3067,7 @@ var ajv$1 = { exports: {} }, core$2 = {}, validate = {}, boolSchema = {}, errors
|
|
|
3068
3067
|
return k.emptyStr() ? m : m.emptyStr() ? k : o`${m}${k}`;
|
|
3069
3068
|
}
|
|
3070
3069
|
e.strConcat = p;
|
|
3071
|
-
function
|
|
3070
|
+
function g(m) {
|
|
3072
3071
|
return typeof m == "number" || typeof m == "boolean" || m === null ? m : O(Array.isArray(m) ? m.join(",") : m);
|
|
3073
3072
|
}
|
|
3074
3073
|
function R(m) {
|
|
@@ -3089,10 +3088,10 @@ var ajv$1 = { exports: {} }, core$2 = {}, validate = {}, boolSchema = {}, errors
|
|
|
3089
3088
|
throw new Error(`CodeGen: invalid export name: ${m}, use explicit $id name mapping`);
|
|
3090
3089
|
}
|
|
3091
3090
|
e.getEsmExportName = v;
|
|
3092
|
-
function
|
|
3091
|
+
function y(m) {
|
|
3093
3092
|
return new n(m.toString());
|
|
3094
3093
|
}
|
|
3095
|
-
e.regexpCode =
|
|
3094
|
+
e.regexpCode = y;
|
|
3096
3095
|
})(code$1);
|
|
3097
3096
|
var scope = {};
|
|
3098
3097
|
(function(e) {
|
|
@@ -3126,8 +3125,8 @@ var scope = {};
|
|
|
3126
3125
|
return `${u}${p.index++}`;
|
|
3127
3126
|
}
|
|
3128
3127
|
_nameGroup(u) {
|
|
3129
|
-
var p,
|
|
3130
|
-
if (!((
|
|
3128
|
+
var p, g;
|
|
3129
|
+
if (!((g = (p = this._parent) === null || p === void 0 ? void 0 : p._prefixes) === null || g === void 0) && g.has(u) || this._prefixes && !this._prefixes.has(u))
|
|
3131
3130
|
throw new Error(`CodeGen: prefix "${u}" is not allowed in this scope`);
|
|
3132
3131
|
return this._names[u] = { prefix: u, index: 0 };
|
|
3133
3132
|
}
|
|
@@ -3137,8 +3136,8 @@ var scope = {};
|
|
|
3137
3136
|
constructor(u, p) {
|
|
3138
3137
|
super(p), this.prefix = u;
|
|
3139
3138
|
}
|
|
3140
|
-
setValue(u, { property: p, itemIndex:
|
|
3141
|
-
this.value = u, this.scopePath = (0, t._)`.${new t.Name(p)}[${
|
|
3139
|
+
setValue(u, { property: p, itemIndex: g }) {
|
|
3140
|
+
this.value = u, this.scopePath = (0, t._)`.${new t.Name(p)}[${g}]`;
|
|
3142
3141
|
}
|
|
3143
3142
|
}
|
|
3144
3143
|
e.ValueScopeName = i;
|
|
@@ -3154,10 +3153,10 @@ var scope = {};
|
|
|
3154
3153
|
return new i(u, this._newName(u));
|
|
3155
3154
|
}
|
|
3156
3155
|
value(u, p) {
|
|
3157
|
-
var
|
|
3156
|
+
var g;
|
|
3158
3157
|
if (p.ref === void 0)
|
|
3159
3158
|
throw new Error("CodeGen: ref must be passed in value");
|
|
3160
|
-
const R = this.toName(u), { prefix: O } = R, T = (
|
|
3159
|
+
const R = this.toName(u), { prefix: O } = R, T = (g = p.key) !== null && g !== void 0 ? g : p.ref;
|
|
3161
3160
|
let v = this._values[O];
|
|
3162
3161
|
if (v) {
|
|
3163
3162
|
const k = v.get(T);
|
|
@@ -3166,39 +3165,39 @@ var scope = {};
|
|
|
3166
3165
|
} else
|
|
3167
3166
|
v = this._values[O] = /* @__PURE__ */ new Map();
|
|
3168
3167
|
v.set(T, R);
|
|
3169
|
-
const
|
|
3170
|
-
return
|
|
3168
|
+
const y = this._scope[O] || (this._scope[O] = []), m = y.length;
|
|
3169
|
+
return y[m] = p.ref, R.setValue(p, { property: O, itemIndex: m }), R;
|
|
3171
3170
|
}
|
|
3172
3171
|
getValue(u, p) {
|
|
3173
|
-
const
|
|
3174
|
-
if (
|
|
3175
|
-
return
|
|
3172
|
+
const g = this._values[u];
|
|
3173
|
+
if (g)
|
|
3174
|
+
return g.get(p);
|
|
3176
3175
|
}
|
|
3177
3176
|
scopeRefs(u, p = this._values) {
|
|
3178
|
-
return this._reduceValues(p, (
|
|
3179
|
-
if (
|
|
3180
|
-
throw new Error(`CodeGen: name "${
|
|
3181
|
-
return (0, t._)`${u}${
|
|
3177
|
+
return this._reduceValues(p, (g) => {
|
|
3178
|
+
if (g.scopePath === void 0)
|
|
3179
|
+
throw new Error(`CodeGen: name "${g}" has no value`);
|
|
3180
|
+
return (0, t._)`${u}${g.scopePath}`;
|
|
3182
3181
|
});
|
|
3183
3182
|
}
|
|
3184
|
-
scopeCode(u = this._values, p,
|
|
3183
|
+
scopeCode(u = this._values, p, g) {
|
|
3185
3184
|
return this._reduceValues(u, (R) => {
|
|
3186
3185
|
if (R.value === void 0)
|
|
3187
3186
|
throw new Error(`CodeGen: name "${R}" has no value`);
|
|
3188
3187
|
return R.value.code;
|
|
3189
|
-
}, p,
|
|
3188
|
+
}, p, g);
|
|
3190
3189
|
}
|
|
3191
|
-
_reduceValues(u, p,
|
|
3190
|
+
_reduceValues(u, p, g = {}, R) {
|
|
3192
3191
|
let O = t.nil;
|
|
3193
3192
|
for (const T in u) {
|
|
3194
3193
|
const v = u[T];
|
|
3195
3194
|
if (!v)
|
|
3196
3195
|
continue;
|
|
3197
|
-
const
|
|
3196
|
+
const y = g[T] = g[T] || /* @__PURE__ */ new Map();
|
|
3198
3197
|
v.forEach((m) => {
|
|
3199
|
-
if (
|
|
3198
|
+
if (y.has(m))
|
|
3200
3199
|
return;
|
|
3201
|
-
|
|
3200
|
+
y.set(m, n.Started);
|
|
3202
3201
|
let k = p(m);
|
|
3203
3202
|
if (k) {
|
|
3204
3203
|
const S = this.opts.es5 ? e.varKinds.var : e.varKinds.const;
|
|
@@ -3207,7 +3206,7 @@ var scope = {};
|
|
|
3207
3206
|
O = (0, t._)`${O}${k}${this.opts._n}`;
|
|
3208
3207
|
else
|
|
3209
3208
|
throw new r(m);
|
|
3210
|
-
|
|
3209
|
+
y.set(m, n.Completed);
|
|
3211
3210
|
});
|
|
3212
3211
|
}
|
|
3213
3212
|
return O;
|
|
@@ -3321,7 +3320,7 @@ var scope = {};
|
|
|
3321
3320
|
return `break${this.label ? ` ${this.label}` : ""};` + a;
|
|
3322
3321
|
}
|
|
3323
3322
|
}
|
|
3324
|
-
class
|
|
3323
|
+
class g extends i {
|
|
3325
3324
|
constructor(a) {
|
|
3326
3325
|
super(), this.error = a;
|
|
3327
3326
|
}
|
|
@@ -3369,8 +3368,8 @@ var scope = {};
|
|
|
3369
3368
|
const { nodes: N } = this;
|
|
3370
3369
|
let M = N.length;
|
|
3371
3370
|
for (; M--; ) {
|
|
3372
|
-
const
|
|
3373
|
-
|
|
3371
|
+
const L = N[M];
|
|
3372
|
+
L.optimizeNames(a, h) || (ke(a, L.names), N.splice(M, 1));
|
|
3374
3373
|
}
|
|
3375
3374
|
return N.length > 0 ? this : void 0;
|
|
3376
3375
|
}
|
|
@@ -3385,9 +3384,9 @@ var scope = {};
|
|
|
3385
3384
|
}
|
|
3386
3385
|
class v extends O {
|
|
3387
3386
|
}
|
|
3388
|
-
class
|
|
3387
|
+
class y extends T {
|
|
3389
3388
|
}
|
|
3390
|
-
|
|
3389
|
+
y.kind = "else";
|
|
3391
3390
|
class m extends T {
|
|
3392
3391
|
constructor(a, h) {
|
|
3393
3392
|
super(h), this.condition = a;
|
|
@@ -3404,7 +3403,7 @@ var scope = {};
|
|
|
3404
3403
|
let h = this.else;
|
|
3405
3404
|
if (h) {
|
|
3406
3405
|
const N = h.optimizeNodes();
|
|
3407
|
-
h = this.else = Array.isArray(N) ? new
|
|
3406
|
+
h = this.else = Array.isArray(N) ? new y(N) : N;
|
|
3408
3407
|
}
|
|
3409
3408
|
if (h)
|
|
3410
3409
|
return a === !1 ? h instanceof m ? h : h.nodes : this.nodes.length ? this : new m(Ce(a), h instanceof m ? [h] : h.nodes);
|
|
@@ -3445,8 +3444,8 @@ var scope = {};
|
|
|
3445
3444
|
super(), this.varKind = a, this.name = h, this.from = N, this.to = M;
|
|
3446
3445
|
}
|
|
3447
3446
|
render(a) {
|
|
3448
|
-
const h = a.es5 ? r.varKinds.var : this.varKind, { name: N, from: M, to:
|
|
3449
|
-
return `for(${h} ${N}=${M}; ${N}<${
|
|
3447
|
+
const h = a.es5 ? r.varKinds.var : this.varKind, { name: N, from: M, to: L } = this;
|
|
3448
|
+
return `for(${h} ${N}=${M}; ${N}<${L}; ${N}++)` + super.render(a);
|
|
3450
3449
|
}
|
|
3451
3450
|
get names() {
|
|
3452
3451
|
const a = ue(super.names, this.from);
|
|
@@ -3549,8 +3548,8 @@ var scope = {};
|
|
|
3549
3548
|
return this._extScope.scopeCode(this._values);
|
|
3550
3549
|
}
|
|
3551
3550
|
_def(a, h, N, M) {
|
|
3552
|
-
const
|
|
3553
|
-
return N !== void 0 && M && (this._constants[
|
|
3551
|
+
const L = this._scope.toName(h);
|
|
3552
|
+
return N !== void 0 && M && (this._constants[L.str] = N), this._leafNode(new o(a, L, N)), L;
|
|
3554
3553
|
}
|
|
3555
3554
|
// `const` declaration (`var` in es5 mode)
|
|
3556
3555
|
const(a, h, N) {
|
|
@@ -3599,11 +3598,11 @@ var scope = {};
|
|
|
3599
3598
|
}
|
|
3600
3599
|
// `else` clause - only valid after `if` or `else if` clauses
|
|
3601
3600
|
else() {
|
|
3602
|
-
return this._elseNode(new
|
|
3601
|
+
return this._elseNode(new y());
|
|
3603
3602
|
}
|
|
3604
3603
|
// end `if` statement (needed if gen.if was used only with condition)
|
|
3605
3604
|
endIf() {
|
|
3606
|
-
return this._endBlockNode(m,
|
|
3605
|
+
return this._endBlockNode(m, y);
|
|
3607
3606
|
}
|
|
3608
3607
|
_for(a, h) {
|
|
3609
3608
|
return this._blockNode(a), h && this.code(h).endFor(), this;
|
|
@@ -3613,28 +3612,28 @@ var scope = {};
|
|
|
3613
3612
|
return this._for(new S(a), h);
|
|
3614
3613
|
}
|
|
3615
3614
|
// `for` statement for a range of values
|
|
3616
|
-
forRange(a, h, N, M,
|
|
3615
|
+
forRange(a, h, N, M, L = this.opts.es5 ? r.varKinds.var : r.varKinds.let) {
|
|
3617
3616
|
const W = this._scope.toName(a);
|
|
3618
|
-
return this._for(new I(
|
|
3617
|
+
return this._for(new I(L, W, h, N), () => M(W));
|
|
3619
3618
|
}
|
|
3620
3619
|
// `for-of` statement (in es5 mode replace with a normal for loop)
|
|
3621
3620
|
forOf(a, h, N, M = r.varKinds.const) {
|
|
3622
|
-
const
|
|
3621
|
+
const L = this._scope.toName(a);
|
|
3623
3622
|
if (this.opts.es5) {
|
|
3624
3623
|
const W = h instanceof t.Name ? h : this.var("_arr", h);
|
|
3625
3624
|
return this.forRange("_i", 0, (0, t._)`${W}.length`, (G) => {
|
|
3626
|
-
this.var(
|
|
3625
|
+
this.var(L, (0, t._)`${W}[${G}]`), N(L);
|
|
3627
3626
|
});
|
|
3628
3627
|
}
|
|
3629
|
-
return this._for(new D("of", M,
|
|
3628
|
+
return this._for(new D("of", M, L, h), () => N(L));
|
|
3630
3629
|
}
|
|
3631
3630
|
// `for-in` statement.
|
|
3632
3631
|
// With option `ownProperties` replaced with a `for-of` loop for object keys
|
|
3633
3632
|
forIn(a, h, N, M = this.opts.es5 ? r.varKinds.var : r.varKinds.const) {
|
|
3634
3633
|
if (this.opts.ownProperties)
|
|
3635
3634
|
return this.forOf(a, (0, t._)`Object.keys(${h})`, N);
|
|
3636
|
-
const
|
|
3637
|
-
return this._for(new D("in", M,
|
|
3635
|
+
const L = this._scope.toName(a);
|
|
3636
|
+
return this._for(new D("in", M, L, h), () => N(L));
|
|
3638
3637
|
}
|
|
3639
3638
|
// end `for` loop
|
|
3640
3639
|
endFor() {
|
|
@@ -3661,14 +3660,14 @@ var scope = {};
|
|
|
3661
3660
|
throw new Error('CodeGen: "try" without "catch" and "finally"');
|
|
3662
3661
|
const M = new A();
|
|
3663
3662
|
if (this._blockNode(M), this.code(a), h) {
|
|
3664
|
-
const
|
|
3665
|
-
this._currNode = M.catch = new V(
|
|
3663
|
+
const L = this.name("e");
|
|
3664
|
+
this._currNode = M.catch = new V(L), h(L);
|
|
3666
3665
|
}
|
|
3667
3666
|
return N && (this._currNode = M.finally = new z(), this.code(N)), this._endBlockNode(V, z);
|
|
3668
3667
|
}
|
|
3669
3668
|
// `throw` statement
|
|
3670
3669
|
throw(a) {
|
|
3671
|
-
return this._leafNode(new
|
|
3670
|
+
return this._leafNode(new g(a));
|
|
3672
3671
|
}
|
|
3673
3672
|
// start self-balancing block
|
|
3674
3673
|
block(a, h) {
|
|
@@ -3740,13 +3739,13 @@ var scope = {};
|
|
|
3740
3739
|
return N(P);
|
|
3741
3740
|
if (!M(P))
|
|
3742
3741
|
return P;
|
|
3743
|
-
return new t._Code(P._items.reduce((
|
|
3744
|
-
function N(
|
|
3745
|
-
const W = h[
|
|
3746
|
-
return W === void 0 || a[
|
|
3742
|
+
return new t._Code(P._items.reduce((L, W) => (W instanceof t.Name && (W = N(W)), W instanceof t._Code ? L.push(...W._items) : L.push(W), L), []));
|
|
3743
|
+
function N(L) {
|
|
3744
|
+
const W = h[L.str];
|
|
3745
|
+
return W === void 0 || a[L.str] !== 1 ? L : (delete a[L.str], W);
|
|
3747
3746
|
}
|
|
3748
|
-
function M(
|
|
3749
|
-
return
|
|
3747
|
+
function M(L) {
|
|
3748
|
+
return L instanceof t._Code && L._items.some((W) => W instanceof t.Name && a[W.str] === 1 && h[W.str] !== void 0);
|
|
3750
3749
|
}
|
|
3751
3750
|
}
|
|
3752
3751
|
function ke(P, a) {
|
|
@@ -3757,17 +3756,17 @@ var scope = {};
|
|
|
3757
3756
|
return typeof P == "boolean" || typeof P == "number" || P === null ? !P : (0, t._)`!${j(P)}`;
|
|
3758
3757
|
}
|
|
3759
3758
|
e.not = Ce;
|
|
3760
|
-
const
|
|
3759
|
+
const Le = $(e.operators.AND);
|
|
3761
3760
|
function et(...P) {
|
|
3762
|
-
return P.reduce(
|
|
3761
|
+
return P.reduce(Le);
|
|
3763
3762
|
}
|
|
3764
3763
|
e.and = et;
|
|
3765
|
-
const
|
|
3764
|
+
const qe = $(e.operators.OR);
|
|
3766
3765
|
function F(...P) {
|
|
3767
|
-
return P.reduce(
|
|
3766
|
+
return P.reduce(qe);
|
|
3768
3767
|
}
|
|
3769
3768
|
e.or = F;
|
|
3770
|
-
function
|
|
3769
|
+
function $(P) {
|
|
3771
3770
|
return (a, h) => a === t.nil ? h : h === t.nil ? a : (0, t._)`${j(a)} ${P} ${j(h)}`;
|
|
3772
3771
|
}
|
|
3773
3772
|
function j(P) {
|
|
@@ -3831,13 +3830,13 @@ var util = {};
|
|
|
3831
3830
|
}
|
|
3832
3831
|
e.unescapeFragment = u;
|
|
3833
3832
|
function p(w) {
|
|
3834
|
-
return encodeURIComponent(
|
|
3833
|
+
return encodeURIComponent(g(w));
|
|
3835
3834
|
}
|
|
3836
3835
|
e.escapeFragment = p;
|
|
3837
|
-
function
|
|
3836
|
+
function g(w) {
|
|
3838
3837
|
return typeof w == "number" ? `${w}` : w.replace(/~/g, "~0").replace(/\//g, "~1");
|
|
3839
3838
|
}
|
|
3840
|
-
e.escapeJsonPointer =
|
|
3839
|
+
e.escapeJsonPointer = g;
|
|
3841
3840
|
function R(w) {
|
|
3842
3841
|
return w.replace(/~1/g, "/").replace(/~0/g, "~");
|
|
3843
3842
|
}
|
|
@@ -3862,7 +3861,7 @@ var util = {};
|
|
|
3862
3861
|
w.if((0, t._)`${C} === true`, () => w.assign(A, !0), () => w.assign(A, (0, t._)`${A} || {}`).code((0, t._)`Object.assign(${A}, ${C})`));
|
|
3863
3862
|
}),
|
|
3864
3863
|
mergeToName: (w, C, A) => w.if((0, t._)`${A} !== true`, () => {
|
|
3865
|
-
C === !0 ? w.assign(A, !0) : (w.assign(A, (0, t._)`${A} || {}`),
|
|
3864
|
+
C === !0 ? w.assign(A, !0) : (w.assign(A, (0, t._)`${A} || {}`), y(w, A, C));
|
|
3866
3865
|
}),
|
|
3867
3866
|
mergeValues: (w, C) => w === !0 ? !0 : { ...w, ...C },
|
|
3868
3867
|
resultToName: v
|
|
@@ -3878,13 +3877,13 @@ var util = {};
|
|
|
3878
3877
|
if (C === !0)
|
|
3879
3878
|
return w.var("props", !0);
|
|
3880
3879
|
const A = w.var("props", (0, t._)`{}`);
|
|
3881
|
-
return C !== void 0 &&
|
|
3880
|
+
return C !== void 0 && y(w, A, C), A;
|
|
3882
3881
|
}
|
|
3883
3882
|
e.evaluatedPropsToName = v;
|
|
3884
|
-
function
|
|
3883
|
+
function y(w, C, A) {
|
|
3885
3884
|
Object.keys(A).forEach((V) => w.assign((0, t._)`${C}${(0, t.getProperty)(V)}`, !0));
|
|
3886
3885
|
}
|
|
3887
|
-
e.setEvaluated =
|
|
3886
|
+
e.setEvaluated = y;
|
|
3888
3887
|
const m = {};
|
|
3889
3888
|
function k(w, C) {
|
|
3890
3889
|
return w.scopeValue("func", {
|
|
@@ -3902,7 +3901,7 @@ var util = {};
|
|
|
3902
3901
|
const V = C === S.Num;
|
|
3903
3902
|
return A ? V ? (0, t._)`"[" + ${w} + "]"` : (0, t._)`"['" + ${w} + "']"` : V ? (0, t._)`"/" + ${w}` : (0, t._)`"/" + ${w}.replace(/~/g, "~0").replace(/\\//g, "~1")`;
|
|
3904
3903
|
}
|
|
3905
|
-
return A ? (0, t.getProperty)(w).toString() : "/" +
|
|
3904
|
+
return A ? (0, t.getProperty)(w).toString() : "/" + g(w);
|
|
3906
3905
|
}
|
|
3907
3906
|
e.getErrorPath = I;
|
|
3908
3907
|
function D(w, C, A = w.opts.strictSchema) {
|
|
@@ -3944,40 +3943,40 @@ names$1.default = names;
|
|
|
3944
3943
|
Object.defineProperty(e, "__esModule", { value: !0 }), e.extendErrors = e.resetErrorsCount = e.reportExtraError = e.reportError = e.keyword$DataError = e.keywordError = void 0;
|
|
3945
3944
|
const t = codegen, r = util, n = names$1;
|
|
3946
3945
|
e.keywordError = {
|
|
3947
|
-
message: ({ keyword:
|
|
3946
|
+
message: ({ keyword: y }) => (0, t.str)`must pass "${y}" keyword validation`
|
|
3948
3947
|
}, e.keyword$DataError = {
|
|
3949
|
-
message: ({ keyword:
|
|
3948
|
+
message: ({ keyword: y, schemaType: m }) => m ? (0, t.str)`"${y}" keyword must be ${m} ($data)` : (0, t.str)`"${y}" keyword is invalid ($data)`
|
|
3950
3949
|
};
|
|
3951
|
-
function s(
|
|
3952
|
-
const { it: I } =
|
|
3950
|
+
function s(y, m = e.keywordError, k, S) {
|
|
3951
|
+
const { it: I } = y, { gen: D, compositeRule: w, allErrors: C } = I, A = g(y, m, k);
|
|
3953
3952
|
S ?? (w || C) ? d(D, A) : u(I, (0, t._)`[${A}]`);
|
|
3954
3953
|
}
|
|
3955
3954
|
e.reportError = s;
|
|
3956
|
-
function i(
|
|
3957
|
-
const { it: S } =
|
|
3955
|
+
function i(y, m = e.keywordError, k) {
|
|
3956
|
+
const { it: S } = y, { gen: I, compositeRule: D, allErrors: w } = S, C = g(y, m, k);
|
|
3958
3957
|
d(I, C), D || w || u(S, n.default.vErrors);
|
|
3959
3958
|
}
|
|
3960
3959
|
e.reportExtraError = i;
|
|
3961
|
-
function o(
|
|
3962
|
-
|
|
3960
|
+
function o(y, m) {
|
|
3961
|
+
y.assign(n.default.errors, m), y.if((0, t._)`${n.default.vErrors} !== null`, () => y.if(m, () => y.assign((0, t._)`${n.default.vErrors}.length`, m), () => y.assign(n.default.vErrors, null)));
|
|
3963
3962
|
}
|
|
3964
3963
|
e.resetErrorsCount = o;
|
|
3965
|
-
function c({ gen:
|
|
3964
|
+
function c({ gen: y, keyword: m, schemaValue: k, data: S, errsCount: I, it: D }) {
|
|
3966
3965
|
if (I === void 0)
|
|
3967
3966
|
throw new Error("ajv implementation error");
|
|
3968
|
-
const w =
|
|
3969
|
-
|
|
3970
|
-
|
|
3967
|
+
const w = y.name("err");
|
|
3968
|
+
y.forRange("i", I, n.default.errors, (C) => {
|
|
3969
|
+
y.const(w, (0, t._)`${n.default.vErrors}[${C}]`), 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}/${m}`), D.opts.verbose && (y.assign((0, t._)`${w}.schema`, k), y.assign((0, t._)`${w}.data`, S));
|
|
3971
3970
|
});
|
|
3972
3971
|
}
|
|
3973
3972
|
e.extendErrors = c;
|
|
3974
|
-
function d(
|
|
3975
|
-
const k =
|
|
3976
|
-
|
|
3973
|
+
function d(y, m) {
|
|
3974
|
+
const k = y.const("err", m);
|
|
3975
|
+
y.if((0, t._)`${n.default.vErrors} === null`, () => y.assign(n.default.vErrors, (0, t._)`[${k}]`), (0, t._)`${n.default.vErrors}.push(${k})`), y.code((0, t._)`${n.default.errors}++`);
|
|
3977
3976
|
}
|
|
3978
|
-
function u(
|
|
3979
|
-
const { gen: k, validateName: S, schemaEnv: I } =
|
|
3980
|
-
I.$async ? k.throw((0, t._)`new ${
|
|
3977
|
+
function u(y, m) {
|
|
3978
|
+
const { gen: k, validateName: S, schemaEnv: I } = y;
|
|
3979
|
+
I.$async ? k.throw((0, t._)`new ${y.ValidationError}(${m})`) : (k.assign((0, t._)`${S}.errors`, m), k.return(!1));
|
|
3981
3980
|
}
|
|
3982
3981
|
const p = {
|
|
3983
3982
|
keyword: new t.Name("keyword"),
|
|
@@ -3988,28 +3987,28 @@ names$1.default = names;
|
|
|
3988
3987
|
schema: new t.Name("schema"),
|
|
3989
3988
|
parentSchema: new t.Name("parentSchema")
|
|
3990
3989
|
};
|
|
3991
|
-
function
|
|
3992
|
-
const { createErrors: S } =
|
|
3993
|
-
return S === !1 ? (0, t._)`{}` : R(
|
|
3990
|
+
function g(y, m, k) {
|
|
3991
|
+
const { createErrors: S } = y.it;
|
|
3992
|
+
return S === !1 ? (0, t._)`{}` : R(y, m, k);
|
|
3994
3993
|
}
|
|
3995
|
-
function R(
|
|
3996
|
-
const { gen: S, it: I } =
|
|
3994
|
+
function R(y, m, k = {}) {
|
|
3995
|
+
const { gen: S, it: I } = y, D = [
|
|
3997
3996
|
O(I, k),
|
|
3998
|
-
T(
|
|
3997
|
+
T(y, k)
|
|
3999
3998
|
];
|
|
4000
|
-
return v(
|
|
3999
|
+
return v(y, m, D), S.object(...D);
|
|
4001
4000
|
}
|
|
4002
|
-
function O({ errorPath:
|
|
4003
|
-
const k = m ? (0, t.str)`${
|
|
4001
|
+
function O({ errorPath: y }, { instancePath: m }) {
|
|
4002
|
+
const k = m ? (0, t.str)`${y}${(0, r.getErrorPath)(m, r.Type.Str)}` : y;
|
|
4004
4003
|
return [n.default.instancePath, (0, t.strConcat)(n.default.instancePath, k)];
|
|
4005
4004
|
}
|
|
4006
|
-
function T({ keyword:
|
|
4007
|
-
let I = S ? m : (0, t.str)`${m}/${
|
|
4005
|
+
function T({ keyword: y, it: { errSchemaPath: m } }, { schemaPath: k, parentSchema: S }) {
|
|
4006
|
+
let I = S ? m : (0, t.str)`${m}/${y}`;
|
|
4008
4007
|
return k && (I = (0, t.str)`${I}${(0, r.getErrorPath)(k, r.Type.Str)}`), [p.schemaPath, I];
|
|
4009
4008
|
}
|
|
4010
|
-
function v(
|
|
4011
|
-
const { keyword: I, data: D, schemaValue: w, it: C } =
|
|
4012
|
-
S.push([p.keyword, I], [p.params, typeof m == "function" ? m(
|
|
4009
|
+
function v(y, { params: m, message: k }, S) {
|
|
4010
|
+
const { keyword: I, data: D, schemaValue: w, it: C } = y, { opts: A, propertyName: V, topSchemaRef: z, schemaPath: re } = C;
|
|
4011
|
+
S.push([p.keyword, I], [p.params, typeof m == "function" ? m(y) : m || (0, t._)`{}`]), A.messages && S.push([p.message, typeof k == "function" ? k(y) : k]), A.verbose && S.push([p.schema, w], [p.parentSchema, (0, t._)`${z}${re}`], [n.default.data, D]), V && S.push([p.propertyName, V]);
|
|
4013
4012
|
}
|
|
4014
4013
|
})(errors);
|
|
4015
4014
|
Object.defineProperty(boolSchema, "__esModule", { value: !0 });
|
|
@@ -4109,7 +4108,7 @@ applicability.shouldUseRule = shouldUseRule;
|
|
|
4109
4108
|
}
|
|
4110
4109
|
e.getJSONTypes = d;
|
|
4111
4110
|
function u(S, I) {
|
|
4112
|
-
const { gen: D, data: w, opts: C } = S, A =
|
|
4111
|
+
const { gen: D, data: w, opts: C } = S, A = g(I, C.coerceTypes), V = I.length > 0 && !(A.length === 0 && I.length === 1 && (0, r.schemaHasRulesForType)(S, I[0]));
|
|
4113
4112
|
if (V) {
|
|
4114
4113
|
const z = v(I, w, C.strictNumbers, o.Wrong);
|
|
4115
4114
|
D.if(z, () => {
|
|
@@ -4120,7 +4119,7 @@ applicability.shouldUseRule = shouldUseRule;
|
|
|
4120
4119
|
}
|
|
4121
4120
|
e.coerceAndCheckDataType = u;
|
|
4122
4121
|
const p = /* @__PURE__ */ new Set(["string", "number", "integer", "boolean", "null"]);
|
|
4123
|
-
function
|
|
4122
|
+
function g(S, I) {
|
|
4124
4123
|
return I ? S.filter((D) => p.has(D) || I === "array" && D === "array") : [];
|
|
4125
4124
|
}
|
|
4126
4125
|
function R(S, I, D) {
|
|
@@ -4202,13 +4201,13 @@ applicability.shouldUseRule = shouldUseRule;
|
|
|
4202
4201
|
return C;
|
|
4203
4202
|
}
|
|
4204
4203
|
e.checkDataTypes = v;
|
|
4205
|
-
const
|
|
4204
|
+
const y = {
|
|
4206
4205
|
message: ({ schema: S }) => `must be ${S}`,
|
|
4207
4206
|
params: ({ schema: S, schemaValue: I }) => typeof S == "string" ? (0, s._)`{type: ${S}}` : (0, s._)`{type: ${I}}`
|
|
4208
4207
|
};
|
|
4209
4208
|
function m(S) {
|
|
4210
4209
|
const I = k(S);
|
|
4211
|
-
(0, n.reportError)(I,
|
|
4210
|
+
(0, n.reportError)(I, y);
|
|
4212
4211
|
}
|
|
4213
4212
|
e.reportTypeError = m;
|
|
4214
4213
|
function k(S) {
|
|
@@ -4301,14 +4300,14 @@ function schemaProperties(e, t) {
|
|
|
4301
4300
|
}
|
|
4302
4301
|
code.schemaProperties = schemaProperties;
|
|
4303
4302
|
function callValidateCode({ schemaCode: e, data: t, it: { gen: r, topSchemaRef: n, schemaPath: s, errorPath: i }, it: o }, c, d, u) {
|
|
4304
|
-
const p = u ? (0, codegen_1$q._)`${e}, ${t}, ${n}${s}` : t,
|
|
4303
|
+
const p = u ? (0, codegen_1$q._)`${e}, ${t}, ${n}${s}` : t, g = [
|
|
4305
4304
|
[names_1$5.default.instancePath, (0, codegen_1$q.strConcat)(names_1$5.default.instancePath, i)],
|
|
4306
4305
|
[names_1$5.default.parentData, o.parentData],
|
|
4307
4306
|
[names_1$5.default.parentDataProperty, o.parentDataProperty],
|
|
4308
4307
|
[names_1$5.default.rootData, names_1$5.default.rootData]
|
|
4309
4308
|
];
|
|
4310
|
-
o.opts.dynamicRef &&
|
|
4311
|
-
const R = (0, codegen_1$q._)`${p}, ${r.object(...
|
|
4309
|
+
o.opts.dynamicRef && g.push([names_1$5.default.dynamicAnchors, names_1$5.default.dynamicAnchors]);
|
|
4310
|
+
const R = (0, codegen_1$q._)`${p}, ${r.object(...g)}`;
|
|
4312
4311
|
return d !== codegen_1$q.nil ? (0, codegen_1$q._)`${c}.call(${d}, ${R})` : (0, codegen_1$q._)`${c}(${R})`;
|
|
4313
4312
|
}
|
|
4314
4313
|
code.callValidateCode = callValidateCode;
|
|
@@ -4378,19 +4377,19 @@ function funcKeywordCode(e, t) {
|
|
|
4378
4377
|
var r;
|
|
4379
4378
|
const { gen: n, keyword: s, schema: i, parentSchema: o, $data: c, it: d } = e;
|
|
4380
4379
|
checkAsyncKeyword(d, t);
|
|
4381
|
-
const u = !c && t.compile ? t.compile.call(d.self, i, o, d) : t.validate, p = useKeyword(n, s, u),
|
|
4382
|
-
e.block$data(
|
|
4380
|
+
const u = !c && t.compile ? t.compile.call(d.self, i, o, d) : t.validate, p = useKeyword(n, s, u), g = n.let("valid");
|
|
4381
|
+
e.block$data(g, R), e.ok((r = t.valid) !== null && r !== void 0 ? r : g);
|
|
4383
4382
|
function R() {
|
|
4384
4383
|
if (t.errors === !1)
|
|
4385
|
-
v(), t.modifying && modifyData(e),
|
|
4384
|
+
v(), t.modifying && modifyData(e), y(() => e.error());
|
|
4386
4385
|
else {
|
|
4387
4386
|
const m = t.async ? O() : T();
|
|
4388
|
-
t.modifying && modifyData(e),
|
|
4387
|
+
t.modifying && modifyData(e), y(() => addErrs(e, m));
|
|
4389
4388
|
}
|
|
4390
4389
|
}
|
|
4391
4390
|
function O() {
|
|
4392
4391
|
const m = n.let("ruleErrs", null);
|
|
4393
|
-
return n.try(() => v((0, codegen_1$p._)`await `), (k) => n.assign(
|
|
4392
|
+
return n.try(() => v((0, codegen_1$p._)`await `), (k) => n.assign(g, !1).if((0, codegen_1$p._)`${k} instanceof ${d.ValidationError}`, () => n.assign(m, (0, codegen_1$p._)`${k}.errors`), () => n.throw(k))), m;
|
|
4394
4393
|
}
|
|
4395
4394
|
function T() {
|
|
4396
4395
|
const m = (0, codegen_1$p._)`${p}.errors`;
|
|
@@ -4398,11 +4397,11 @@ function funcKeywordCode(e, t) {
|
|
|
4398
4397
|
}
|
|
4399
4398
|
function v(m = t.async ? (0, codegen_1$p._)`await ` : codegen_1$p.nil) {
|
|
4400
4399
|
const k = d.opts.passContext ? names_1$4.default.this : names_1$4.default.self, S = !("compile" in t && !c || t.schema === !1);
|
|
4401
|
-
n.assign(
|
|
4400
|
+
n.assign(g, (0, codegen_1$p._)`${m}${(0, code_1$9.callValidateCode)(e, p, k, S)}`, t.modifying);
|
|
4402
4401
|
}
|
|
4403
|
-
function
|
|
4402
|
+
function y(m) {
|
|
4404
4403
|
var k;
|
|
4405
|
-
n.if((0, codegen_1$p.not)((k = t.valid) !== null && k !== void 0 ? k :
|
|
4404
|
+
n.if((0, codegen_1$p.not)((k = t.valid) !== null && k !== void 0 ? k : g), m);
|
|
4406
4405
|
}
|
|
4407
4406
|
}
|
|
4408
4407
|
keyword.funcKeywordCode = funcKeywordCode;
|
|
@@ -4481,8 +4480,8 @@ function extendSubschemaData(e, t, { dataProp: r, dataPropType: n, data: s, data
|
|
|
4481
4480
|
throw new Error('both "data" and "dataProp" passed, only one allowed');
|
|
4482
4481
|
const { gen: c } = t;
|
|
4483
4482
|
if (r !== void 0) {
|
|
4484
|
-
const { errorPath: u, dataPathArr: p, opts:
|
|
4485
|
-
d(R), e.errorPath = (0, codegen_1$o.str)`${u}${(0, util_1$n.getErrorPath)(r, n,
|
|
4483
|
+
const { errorPath: u, dataPathArr: p, opts: g } = t, R = c.let("data", (0, codegen_1$o._)`${t.data}${(0, codegen_1$o.getProperty)(r)}`, !0);
|
|
4484
|
+
d(R), e.errorPath = (0, codegen_1$o.str)`${u}${(0, util_1$n.getErrorPath)(r, n, g.jsPropertySyntax)}`, e.parentDataProperty = (0, codegen_1$o._)`${r}`, e.dataPathArr = [...p, e.parentDataProperty];
|
|
4486
4485
|
}
|
|
4487
4486
|
if (s !== void 0) {
|
|
4488
4487
|
const u = s instanceof codegen_1$o.Name ? s : c.let("data", s, !0);
|
|
@@ -4587,17 +4586,17 @@ function _traverse(e, t, r, n, s, i, o, c, d, u) {
|
|
|
4587
4586
|
if (n && typeof n == "object" && !Array.isArray(n)) {
|
|
4588
4587
|
t(n, s, i, o, c, d, u);
|
|
4589
4588
|
for (var p in n) {
|
|
4590
|
-
var
|
|
4591
|
-
if (Array.isArray(
|
|
4589
|
+
var g = n[p];
|
|
4590
|
+
if (Array.isArray(g)) {
|
|
4592
4591
|
if (p in traverse$1.arrayKeywords)
|
|
4593
|
-
for (var R = 0; R <
|
|
4594
|
-
_traverse(e, t, r,
|
|
4592
|
+
for (var R = 0; R < g.length; R++)
|
|
4593
|
+
_traverse(e, t, r, g[R], s + "/" + p + "/" + R, i, s, p, n, R);
|
|
4595
4594
|
} else if (p in traverse$1.propsKeywords) {
|
|
4596
|
-
if (
|
|
4597
|
-
for (var O in
|
|
4598
|
-
_traverse(e, t, r,
|
|
4595
|
+
if (g && typeof g == "object")
|
|
4596
|
+
for (var O in g)
|
|
4597
|
+
_traverse(e, t, r, g[O], s + "/" + p + "/" + escapeJsonPtr(O), i, s, p, n, O);
|
|
4599
4598
|
} else
|
|
4600
|
-
(p in traverse$1.keywords || e.allKeys && !(p in traverse$1.skipKeywords)) && _traverse(e, t, r,
|
|
4599
|
+
(p in traverse$1.keywords || e.allKeys && !(p in traverse$1.skipKeywords)) && _traverse(e, t, r, g, s + "/" + p, i, s, p, n);
|
|
4601
4600
|
}
|
|
4602
4601
|
r(n, s, i, o, c, d, u);
|
|
4603
4602
|
}
|
|
@@ -4681,19 +4680,19 @@ function getSchemaRefs(e, t) {
|
|
|
4681
4680
|
if (typeof e == "boolean")
|
|
4682
4681
|
return {};
|
|
4683
4682
|
const { schemaId: r, uriResolver: n } = this.opts, s = normalizeId(e[r] || t), i = { "": s }, o = getFullPath(n, s, !1), c = {}, d = /* @__PURE__ */ new Set();
|
|
4684
|
-
return traverse(e, { allKeys: !0 }, (
|
|
4683
|
+
return traverse(e, { allKeys: !0 }, (g, R, O, T) => {
|
|
4685
4684
|
if (T === void 0)
|
|
4686
4685
|
return;
|
|
4687
4686
|
const v = o + R;
|
|
4688
|
-
let
|
|
4689
|
-
typeof
|
|
4687
|
+
let y = i[T];
|
|
4688
|
+
typeof g[r] == "string" && (y = m.call(this, g[r])), k.call(this, g.$anchor), k.call(this, g.$dynamicAnchor), i[R] = y;
|
|
4690
4689
|
function m(S) {
|
|
4691
4690
|
const I = this.opts.uriResolver.resolve;
|
|
4692
|
-
if (S = normalizeId(
|
|
4691
|
+
if (S = normalizeId(y ? I(y, S) : S), d.has(S))
|
|
4693
4692
|
throw p(S);
|
|
4694
4693
|
d.add(S);
|
|
4695
4694
|
let D = this.refs[S];
|
|
4696
|
-
return typeof D == "string" && (D = this.refs[D]), typeof D == "object" ? u(
|
|
4695
|
+
return typeof D == "string" && (D = this.refs[D]), typeof D == "object" ? u(g, D.schema, S) : S !== normalizeId(v) && (S[0] === "#" ? (u(g, c[S], S), c[S] = g) : this.refs[S] = v), S;
|
|
4697
4696
|
}
|
|
4698
4697
|
function k(S) {
|
|
4699
4698
|
if (typeof S == "string") {
|
|
@@ -4703,12 +4702,12 @@ function getSchemaRefs(e, t) {
|
|
|
4703
4702
|
}
|
|
4704
4703
|
}
|
|
4705
4704
|
}), c;
|
|
4706
|
-
function u(
|
|
4707
|
-
if (R !== void 0 && !equal$2(
|
|
4705
|
+
function u(g, R, O) {
|
|
4706
|
+
if (R !== void 0 && !equal$2(g, R))
|
|
4708
4707
|
throw p(O);
|
|
4709
4708
|
}
|
|
4710
|
-
function p(
|
|
4711
|
-
return new Error(`reference "${
|
|
4709
|
+
function p(g) {
|
|
4710
|
+
return new Error(`reference "${g}" resolves to more than one schema`);
|
|
4712
4711
|
}
|
|
4713
4712
|
}
|
|
4714
4713
|
resolve$1.getSchemaRefs = getSchemaRefs;
|
|
@@ -4825,10 +4824,10 @@ function schemaKeywords(e, t, r, n) {
|
|
|
4825
4824
|
}
|
|
4826
4825
|
d.jtd || checkStrictTypes(e, t), s.block(() => {
|
|
4827
4826
|
for (const R of p.rules)
|
|
4828
|
-
|
|
4829
|
-
|
|
4827
|
+
g(R);
|
|
4828
|
+
g(p.post);
|
|
4830
4829
|
});
|
|
4831
|
-
function
|
|
4830
|
+
function g(R) {
|
|
4832
4831
|
(0, applicability_1.shouldUseGroup)(i, R) && (R.type ? (s.if((0, dataType_2.checkDataType)(R.type, o, d.strictNumbers)), iterateKeywords(e, R), t.length === 1 && t[0] === R.type && r && (s.else(), (0, dataType_2.reportTypeError)(e)), s.endIf()) : iterateKeywords(e, R), c || s.if((0, codegen_1$n._)`${names_1$3.default.errors} === ${n || 0}`));
|
|
4833
4832
|
}
|
|
4834
4833
|
}
|
|
@@ -5091,10 +5090,10 @@ function compileSchema(e) {
|
|
|
5091
5090
|
let p;
|
|
5092
5091
|
try {
|
|
5093
5092
|
this._compilations.add(e), (0, validate_1$1.validateFunctionCode)(u), o.optimize(this.opts.code.optimize);
|
|
5094
|
-
const
|
|
5095
|
-
p = `${o.scopeRefs(names_1$2.default.scope)}return ${
|
|
5093
|
+
const g = o.toString();
|
|
5094
|
+
p = `${o.scopeRefs(names_1$2.default.scope)}return ${g}`, this.opts.code.process && (p = this.opts.code.process(p, e));
|
|
5096
5095
|
const O = new Function(`${names_1$2.default.self}`, `${names_1$2.default.scope}`, p)(this, this.scope.get());
|
|
5097
|
-
if (this.scope.value(d, { ref: O }), O.errors = null, O.schema = e.schema, O.schemaEnv = e, e.$async && (O.$async = !0), this.opts.code.source === !0 && (O.source = { validateName: d, validateCode:
|
|
5096
|
+
if (this.scope.value(d, { ref: O }), O.errors = null, O.schema = e.schema, O.schemaEnv = e, e.$async && (O.$async = !0), this.opts.code.source === !0 && (O.source = { validateName: d, validateCode: g, scopeValues: o._values }), this.opts.unevaluated) {
|
|
5098
5097
|
const { props: T, items: v } = u;
|
|
5099
5098
|
O.evaluated = {
|
|
5100
5099
|
props: T instanceof codegen_1$m.Name ? void 0 : T,
|
|
@@ -5104,8 +5103,8 @@ function compileSchema(e) {
|
|
|
5104
5103
|
}, O.source && (O.source.evaluated = (0, codegen_1$m.stringify)(O.evaluated));
|
|
5105
5104
|
}
|
|
5106
5105
|
return e.validate = O, e;
|
|
5107
|
-
} catch (
|
|
5108
|
-
throw delete e.validate, delete e.validateName, p && this.logger.error("Error compiling schema, function code:", p),
|
|
5106
|
+
} catch (g) {
|
|
5107
|
+
throw delete e.validate, delete e.validateName, p && this.logger.error("Error compiling schema, function code:", p), g;
|
|
5109
5108
|
} finally {
|
|
5110
5109
|
this._compilations.delete(e);
|
|
5111
5110
|
}
|
|
@@ -5222,13 +5221,13 @@ var uri$1 = {}, uri_all = { exports: {} };
|
|
|
5222
5221
|
n(t);
|
|
5223
5222
|
})(commonjsGlobal, function(r) {
|
|
5224
5223
|
function n() {
|
|
5225
|
-
for (var f = arguments.length, l = Array(f),
|
|
5226
|
-
l[
|
|
5224
|
+
for (var f = arguments.length, l = Array(f), _ = 0; _ < f; _++)
|
|
5225
|
+
l[_] = arguments[_];
|
|
5227
5226
|
if (l.length > 1) {
|
|
5228
5227
|
l[0] = l[0].slice(0, -1);
|
|
5229
|
-
for (var
|
|
5230
|
-
l[
|
|
5231
|
-
return l[
|
|
5228
|
+
for (var E = l.length - 1, b = 1; b < E; ++b)
|
|
5229
|
+
l[b] = l[b].slice(1, -1);
|
|
5230
|
+
return l[E] = l[E].slice(1), l.join("");
|
|
5232
5231
|
} else
|
|
5233
5232
|
return l[0];
|
|
5234
5233
|
}
|
|
@@ -5245,20 +5244,20 @@ var uri$1 = {}, uri_all = { exports: {} };
|
|
|
5245
5244
|
return f != null ? f instanceof Array ? f : typeof f.length != "number" || f.split || f.setInterval || f.call ? [f] : Array.prototype.slice.call(f) : [];
|
|
5246
5245
|
}
|
|
5247
5246
|
function d(f, l) {
|
|
5248
|
-
var
|
|
5247
|
+
var _ = f;
|
|
5249
5248
|
if (l)
|
|
5250
|
-
for (var
|
|
5251
|
-
|
|
5252
|
-
return
|
|
5249
|
+
for (var E in l)
|
|
5250
|
+
_[E] = l[E];
|
|
5251
|
+
return _;
|
|
5253
5252
|
}
|
|
5254
5253
|
function u(f) {
|
|
5255
|
-
var l = "[A-Za-z]",
|
|
5256
|
-
s(l + n(l,
|
|
5257
|
-
var Z = s(s("25[0-5]") + "|" + s("2[0-4]" +
|
|
5258
|
-
s("[vV]" +
|
|
5259
|
-
var ct = s(
|
|
5260
|
-
return s(s(
|
|
5261
|
-
NOT_SCHEME: new RegExp(n("[^]", l,
|
|
5254
|
+
var l = "[A-Za-z]", _ = "[0-9]", E = n(_, "[A-Fa-f]"), b = s(s("%[EFef]" + E + "%" + E + E + "%" + E + E) + "|" + s("%[89A-Fa-f]" + E + "%" + E + E) + "|" + s("%" + E + E)), q = "[\\:\\/\\?\\#\\[\\]\\@]", U = "[\\!\\$\\&\\'\\(\\)\\*\\+\\,\\;\\=]", J = n(q, U), Y = f ? "[\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]" : "[]", se = f ? "[\\uE000-\\uF8FF]" : "[]", B = n(l, _, "[\\-\\.\\_\\~]", Y);
|
|
5255
|
+
s(l + n(l, _, "[\\+\\-\\.]") + "*"), s(s(b + "|" + n(B, U, "[\\:]")) + "*");
|
|
5256
|
+
var Z = s(s("25[0-5]") + "|" + s("2[0-4]" + _) + "|" + s("1" + _ + _) + "|" + s("0?[1-9]" + _) + "|0?0?" + _), ie = s(Z + "\\." + Z + "\\." + Z + "\\." + Z), x = s(E + "{1,4}"), X = s(s(x + "\\:" + x) + "|" + ie), ae = s(s(x + "\\:") + "{6}" + X), ee = s("\\:\\:" + s(x + "\\:") + "{5}" + X), Se = s(s(x) + "?\\:\\:" + s(x + "\\:") + "{4}" + X), ge = s(s(s(x + "\\:") + "{0,1}" + x) + "?\\:\\:" + s(x + "\\:") + "{3}" + X), ye = s(s(s(x + "\\:") + "{0,2}" + x) + "?\\:\\:" + s(x + "\\:") + "{2}" + X), Be = s(s(s(x + "\\:") + "{0,3}" + x) + "?\\:\\:" + x + "\\:" + X), Ie = s(s(s(x + "\\:") + "{0,4}" + x) + "?\\:\\:" + X), fe = s(s(s(x + "\\:") + "{0,5}" + x) + "?\\:\\:" + x), $e = s(s(s(x + "\\:") + "{0,6}" + x) + "?\\:\\:"), je = s([ae, ee, Se, ge, ye, Be, Ie, fe, $e].join("|")), we = s(s(B + "|" + b) + "+");
|
|
5257
|
+
s("[vV]" + E + "+\\." + n(B, U, "[\\:]") + "+"), s(s(b + "|" + n(B, U)) + "*");
|
|
5258
|
+
var ct = s(b + "|" + n(B, U, "[\\:\\@]"));
|
|
5259
|
+
return s(s(b + "|" + n(B, U, "[\\@]")) + "+"), s(s(ct + "|" + n("[\\/\\?]", se)) + "*"), {
|
|
5260
|
+
NOT_SCHEME: new RegExp(n("[^]", l, _, "[\\+\\-\\.]"), "g"),
|
|
5262
5261
|
NOT_USERINFO: new RegExp(n("[^\\%\\:]", B, U), "g"),
|
|
5263
5262
|
NOT_HOST: new RegExp(n("[^\\%\\[\\]\\:]", B, U), "g"),
|
|
5264
5263
|
NOT_PATH: new RegExp(n("[^\\%\\/\\:\\@]", B, U), "g"),
|
|
@@ -5268,123 +5267,123 @@ var uri$1 = {}, uri_all = { exports: {} };
|
|
|
5268
5267
|
ESCAPE: new RegExp(n("[^]", B, U), "g"),
|
|
5269
5268
|
UNRESERVED: new RegExp(B, "g"),
|
|
5270
5269
|
OTHER_CHARS: new RegExp(n("[^\\%]", B, J), "g"),
|
|
5271
|
-
PCT_ENCODED: new RegExp(
|
|
5270
|
+
PCT_ENCODED: new RegExp(b, "g"),
|
|
5272
5271
|
IPV4ADDRESS: new RegExp("^(" + ie + ")$"),
|
|
5273
|
-
IPV6ADDRESS: new RegExp("^\\[?(" + je + ")" + s(s("\\%25|\\%(?!" +
|
|
5272
|
+
IPV6ADDRESS: new RegExp("^\\[?(" + je + ")" + s(s("\\%25|\\%(?!" + E + "{2})") + "(" + we + ")") + "?\\]?$")
|
|
5274
5273
|
//RFC 6874, with relaxed parsing rules
|
|
5275
5274
|
};
|
|
5276
5275
|
}
|
|
5277
|
-
var p = u(!1),
|
|
5278
|
-
function f(l,
|
|
5279
|
-
var
|
|
5276
|
+
var p = u(!1), g = u(!0), R = function() {
|
|
5277
|
+
function f(l, _) {
|
|
5278
|
+
var E = [], b = !0, q = !1, U = void 0;
|
|
5280
5279
|
try {
|
|
5281
|
-
for (var J = l[Symbol.iterator](), Y; !(
|
|
5280
|
+
for (var J = l[Symbol.iterator](), Y; !(b = (Y = J.next()).done) && (E.push(Y.value), !(_ && E.length === _)); b = !0)
|
|
5282
5281
|
;
|
|
5283
5282
|
} catch (se) {
|
|
5284
|
-
|
|
5283
|
+
q = !0, U = se;
|
|
5285
5284
|
} finally {
|
|
5286
5285
|
try {
|
|
5287
|
-
!
|
|
5286
|
+
!b && J.return && J.return();
|
|
5288
5287
|
} finally {
|
|
5289
|
-
if (
|
|
5288
|
+
if (q)
|
|
5290
5289
|
throw U;
|
|
5291
5290
|
}
|
|
5292
5291
|
}
|
|
5293
|
-
return
|
|
5292
|
+
return E;
|
|
5294
5293
|
}
|
|
5295
|
-
return function(l,
|
|
5294
|
+
return function(l, _) {
|
|
5296
5295
|
if (Array.isArray(l))
|
|
5297
5296
|
return l;
|
|
5298
5297
|
if (Symbol.iterator in Object(l))
|
|
5299
|
-
return f(l,
|
|
5298
|
+
return f(l, _);
|
|
5300
5299
|
throw new TypeError("Invalid attempt to destructure non-iterable instance");
|
|
5301
5300
|
};
|
|
5302
5301
|
}(), O = function(f) {
|
|
5303
5302
|
if (Array.isArray(f)) {
|
|
5304
|
-
for (var l = 0,
|
|
5305
|
-
|
|
5306
|
-
return
|
|
5303
|
+
for (var l = 0, _ = Array(f.length); l < f.length; l++)
|
|
5304
|
+
_[l] = f[l];
|
|
5305
|
+
return _;
|
|
5307
5306
|
} else
|
|
5308
5307
|
return Array.from(f);
|
|
5309
|
-
}, T = 2147483647, v = 36,
|
|
5308
|
+
}, T = 2147483647, v = 36, y = 1, m = 26, k = 38, S = 700, I = 72, D = 128, w = "-", C = /^xn--/, A = /[^\0-\x7E]/, V = /[\x2E\u3002\uFF0E\uFF61]/g, z = {
|
|
5310
5309
|
overflow: "Overflow: input needs wider integers to process",
|
|
5311
5310
|
"not-basic": "Illegal input >= 0x80 (not a basic code point)",
|
|
5312
5311
|
"invalid-input": "Invalid input"
|
|
5313
|
-
}, re = v -
|
|
5312
|
+
}, re = v - y, K = Math.floor, ue = String.fromCharCode;
|
|
5314
5313
|
function oe(f) {
|
|
5315
5314
|
throw new RangeError(z[f]);
|
|
5316
5315
|
}
|
|
5317
5316
|
function ke(f, l) {
|
|
5318
|
-
for (var
|
|
5319
|
-
|
|
5320
|
-
return
|
|
5317
|
+
for (var _ = [], E = f.length; E--; )
|
|
5318
|
+
_[E] = l(f[E]);
|
|
5319
|
+
return _;
|
|
5321
5320
|
}
|
|
5322
5321
|
function Ce(f, l) {
|
|
5323
|
-
var
|
|
5324
|
-
|
|
5325
|
-
var
|
|
5326
|
-
return
|
|
5327
|
-
}
|
|
5328
|
-
function
|
|
5329
|
-
for (var l = [],
|
|
5330
|
-
var
|
|
5331
|
-
if (
|
|
5332
|
-
var
|
|
5333
|
-
(
|
|
5322
|
+
var _ = f.split("@"), E = "";
|
|
5323
|
+
_.length > 1 && (E = _[0] + "@", f = _[1]), f = f.replace(V, ".");
|
|
5324
|
+
var b = f.split("."), q = ke(b, l).join(".");
|
|
5325
|
+
return E + q;
|
|
5326
|
+
}
|
|
5327
|
+
function Le(f) {
|
|
5328
|
+
for (var l = [], _ = 0, E = f.length; _ < E; ) {
|
|
5329
|
+
var b = f.charCodeAt(_++);
|
|
5330
|
+
if (b >= 55296 && b <= 56319 && _ < E) {
|
|
5331
|
+
var q = f.charCodeAt(_++);
|
|
5332
|
+
(q & 64512) == 56320 ? l.push(((b & 1023) << 10) + (q & 1023) + 65536) : (l.push(b), _--);
|
|
5334
5333
|
} else
|
|
5335
|
-
l.push(
|
|
5334
|
+
l.push(b);
|
|
5336
5335
|
}
|
|
5337
5336
|
return l;
|
|
5338
5337
|
}
|
|
5339
5338
|
var et = function(l) {
|
|
5340
5339
|
return String.fromCodePoint.apply(String, O(l));
|
|
5341
|
-
},
|
|
5340
|
+
}, qe = function(l) {
|
|
5342
5341
|
return l - 48 < 10 ? l - 22 : l - 65 < 26 ? l - 65 : l - 97 < 26 ? l - 97 : v;
|
|
5343
|
-
}, F = function(l,
|
|
5344
|
-
return l + 22 + 75 * (l < 26) - ((
|
|
5345
|
-
},
|
|
5346
|
-
var
|
|
5342
|
+
}, F = function(l, _) {
|
|
5343
|
+
return l + 22 + 75 * (l < 26) - ((_ != 0) << 5);
|
|
5344
|
+
}, $ = function(l, _, E) {
|
|
5345
|
+
var b = 0;
|
|
5347
5346
|
for (
|
|
5348
|
-
l =
|
|
5347
|
+
l = E ? K(l / S) : l >> 1, l += K(l / _);
|
|
5349
5348
|
/* no initialization */
|
|
5350
5349
|
l > re * m >> 1;
|
|
5351
|
-
|
|
5350
|
+
b += v
|
|
5352
5351
|
)
|
|
5353
5352
|
l = K(l / re);
|
|
5354
|
-
return K(
|
|
5353
|
+
return K(b + (re + 1) * l / (l + k));
|
|
5355
5354
|
}, j = function(l) {
|
|
5356
|
-
var
|
|
5355
|
+
var _ = [], E = l.length, b = 0, q = D, U = I, J = l.lastIndexOf(w);
|
|
5357
5356
|
J < 0 && (J = 0);
|
|
5358
5357
|
for (var Y = 0; Y < J; ++Y)
|
|
5359
|
-
l.charCodeAt(Y) >= 128 && oe("not-basic"),
|
|
5360
|
-
for (var se = J > 0 ? J + 1 : 0; se <
|
|
5358
|
+
l.charCodeAt(Y) >= 128 && oe("not-basic"), _.push(l.charCodeAt(Y));
|
|
5359
|
+
for (var se = J > 0 ? J + 1 : 0; se < E; ) {
|
|
5361
5360
|
for (
|
|
5362
|
-
var B =
|
|
5361
|
+
var B = b, Z = 1, ie = v;
|
|
5363
5362
|
;
|
|
5364
5363
|
/* no condition */
|
|
5365
5364
|
ie += v
|
|
5366
5365
|
) {
|
|
5367
|
-
se >=
|
|
5368
|
-
var x =
|
|
5369
|
-
(x >= v || x > K((T -
|
|
5370
|
-
var X = ie <= U ?
|
|
5366
|
+
se >= E && oe("invalid-input");
|
|
5367
|
+
var x = qe(l.charCodeAt(se++));
|
|
5368
|
+
(x >= v || x > K((T - b) / Z)) && oe("overflow"), b += x * Z;
|
|
5369
|
+
var X = ie <= U ? y : ie >= U + m ? m : ie - U;
|
|
5371
5370
|
if (x < X)
|
|
5372
5371
|
break;
|
|
5373
5372
|
var ae = v - X;
|
|
5374
5373
|
Z > K(T / ae) && oe("overflow"), Z *= ae;
|
|
5375
5374
|
}
|
|
5376
|
-
var ee =
|
|
5377
|
-
U =
|
|
5375
|
+
var ee = _.length + 1;
|
|
5376
|
+
U = $(b - B, ee, B == 0), K(b / ee) > T - q && oe("overflow"), q += K(b / ee), b %= ee, _.splice(b++, 0, q);
|
|
5378
5377
|
}
|
|
5379
|
-
return String.fromCodePoint.apply(String,
|
|
5378
|
+
return String.fromCodePoint.apply(String, _);
|
|
5380
5379
|
}, P = function(l) {
|
|
5381
|
-
var
|
|
5382
|
-
l =
|
|
5383
|
-
var
|
|
5380
|
+
var _ = [];
|
|
5381
|
+
l = Le(l);
|
|
5382
|
+
var E = l.length, b = D, q = 0, U = I, J = !0, Y = !1, se = void 0;
|
|
5384
5383
|
try {
|
|
5385
5384
|
for (var B = l[Symbol.iterator](), Z; !(J = (Z = B.next()).done); J = !0) {
|
|
5386
5385
|
var ie = Z.value;
|
|
5387
|
-
ie < 128 &&
|
|
5386
|
+
ie < 128 && _.push(ue(ie));
|
|
5388
5387
|
}
|
|
5389
5388
|
} catch (lt) {
|
|
5390
5389
|
Y = !0, se = lt;
|
|
@@ -5396,66 +5395,66 @@ var uri$1 = {}, uri_all = { exports: {} };
|
|
|
5396
5395
|
throw se;
|
|
5397
5396
|
}
|
|
5398
5397
|
}
|
|
5399
|
-
var x =
|
|
5400
|
-
for (x &&
|
|
5398
|
+
var x = _.length, X = x;
|
|
5399
|
+
for (x && _.push(w); X < E; ) {
|
|
5401
5400
|
var ae = T, ee = !0, Se = !1, ge = void 0;
|
|
5402
5401
|
try {
|
|
5403
|
-
for (var
|
|
5402
|
+
for (var ye = l[Symbol.iterator](), Be; !(ee = (Be = ye.next()).done); ee = !0) {
|
|
5404
5403
|
var Ie = Be.value;
|
|
5405
|
-
Ie >=
|
|
5404
|
+
Ie >= b && Ie < ae && (ae = Ie);
|
|
5406
5405
|
}
|
|
5407
5406
|
} catch (lt) {
|
|
5408
5407
|
Se = !0, ge = lt;
|
|
5409
5408
|
} finally {
|
|
5410
5409
|
try {
|
|
5411
|
-
!ee &&
|
|
5410
|
+
!ee && ye.return && ye.return();
|
|
5412
5411
|
} finally {
|
|
5413
5412
|
if (Se)
|
|
5414
5413
|
throw ge;
|
|
5415
5414
|
}
|
|
5416
5415
|
}
|
|
5417
5416
|
var fe = X + 1;
|
|
5418
|
-
ae -
|
|
5419
|
-
var
|
|
5417
|
+
ae - b > K((T - q) / fe) && oe("overflow"), q += (ae - b) * fe, b = ae;
|
|
5418
|
+
var $e = !0, je = !1, we = void 0;
|
|
5420
5419
|
try {
|
|
5421
|
-
for (var ct = l[Symbol.iterator](), Ut; !(
|
|
5420
|
+
for (var ct = l[Symbol.iterator](), Ut; !($e = (Ut = ct.next()).done); $e = !0) {
|
|
5422
5421
|
var Ht = Ut.value;
|
|
5423
|
-
if (Ht <
|
|
5422
|
+
if (Ht < b && ++q > T && oe("overflow"), Ht == b) {
|
|
5424
5423
|
for (
|
|
5425
|
-
var pt =
|
|
5424
|
+
var pt = q, ft = v;
|
|
5426
5425
|
;
|
|
5427
5426
|
/* no condition */
|
|
5428
5427
|
ft += v
|
|
5429
5428
|
) {
|
|
5430
|
-
var ht = ft <= U ?
|
|
5429
|
+
var ht = ft <= U ? y : ft >= U + m ? m : ft - U;
|
|
5431
5430
|
if (pt < ht)
|
|
5432
5431
|
break;
|
|
5433
5432
|
var Vt = pt - ht, xt = v - ht;
|
|
5434
|
-
|
|
5433
|
+
_.push(ue(F(ht + Vt % xt, 0))), pt = K(Vt / xt);
|
|
5435
5434
|
}
|
|
5436
|
-
|
|
5435
|
+
_.push(ue(F(pt, 0))), U = $(q, fe, X == x), q = 0, ++X;
|
|
5437
5436
|
}
|
|
5438
5437
|
}
|
|
5439
5438
|
} catch (lt) {
|
|
5440
5439
|
je = !0, we = lt;
|
|
5441
5440
|
} finally {
|
|
5442
5441
|
try {
|
|
5443
|
-
|
|
5442
|
+
!$e && ct.return && ct.return();
|
|
5444
5443
|
} finally {
|
|
5445
5444
|
if (je)
|
|
5446
5445
|
throw we;
|
|
5447
5446
|
}
|
|
5448
5447
|
}
|
|
5449
|
-
++
|
|
5448
|
+
++q, ++b;
|
|
5450
5449
|
}
|
|
5451
|
-
return
|
|
5450
|
+
return _.join("");
|
|
5452
5451
|
}, a = function(l) {
|
|
5453
|
-
return Ce(l, function(
|
|
5454
|
-
return C.test(
|
|
5452
|
+
return Ce(l, function(_) {
|
|
5453
|
+
return C.test(_) ? j(_.slice(4).toLowerCase()) : _;
|
|
5455
5454
|
});
|
|
5456
5455
|
}, h = function(l) {
|
|
5457
|
-
return Ce(l, function(
|
|
5458
|
-
return A.test(
|
|
5456
|
+
return Ce(l, function(_) {
|
|
5457
|
+
return A.test(_) ? "xn--" + P(_) : _;
|
|
5459
5458
|
});
|
|
5460
5459
|
}, N = {
|
|
5461
5460
|
/**
|
|
@@ -5472,7 +5471,7 @@ var uri$1 = {}, uri_all = { exports: {} };
|
|
|
5472
5471
|
* @type Object
|
|
5473
5472
|
*/
|
|
5474
5473
|
ucs2: {
|
|
5475
|
-
decode:
|
|
5474
|
+
decode: Le,
|
|
5476
5475
|
encode: et
|
|
5477
5476
|
},
|
|
5478
5477
|
decode: j,
|
|
@@ -5480,100 +5479,100 @@ var uri$1 = {}, uri_all = { exports: {} };
|
|
|
5480
5479
|
toASCII: h,
|
|
5481
5480
|
toUnicode: a
|
|
5482
5481
|
}, M = {};
|
|
5483
|
-
function
|
|
5484
|
-
var l = f.charCodeAt(0),
|
|
5485
|
-
return l < 16 ?
|
|
5482
|
+
function L(f) {
|
|
5483
|
+
var l = f.charCodeAt(0), _ = void 0;
|
|
5484
|
+
return l < 16 ? _ = "%0" + l.toString(16).toUpperCase() : l < 128 ? _ = "%" + l.toString(16).toUpperCase() : l < 2048 ? _ = "%" + (l >> 6 | 192).toString(16).toUpperCase() + "%" + (l & 63 | 128).toString(16).toUpperCase() : _ = "%" + (l >> 12 | 224).toString(16).toUpperCase() + "%" + (l >> 6 & 63 | 128).toString(16).toUpperCase() + "%" + (l & 63 | 128).toString(16).toUpperCase(), _;
|
|
5486
5485
|
}
|
|
5487
5486
|
function W(f) {
|
|
5488
|
-
for (var l = "",
|
|
5489
|
-
var
|
|
5490
|
-
if (
|
|
5491
|
-
l += String.fromCharCode(
|
|
5492
|
-
else if (
|
|
5493
|
-
if (
|
|
5494
|
-
var
|
|
5495
|
-
l += String.fromCharCode((
|
|
5487
|
+
for (var l = "", _ = 0, E = f.length; _ < E; ) {
|
|
5488
|
+
var b = parseInt(f.substr(_ + 1, 2), 16);
|
|
5489
|
+
if (b < 128)
|
|
5490
|
+
l += String.fromCharCode(b), _ += 3;
|
|
5491
|
+
else if (b >= 194 && b < 224) {
|
|
5492
|
+
if (E - _ >= 6) {
|
|
5493
|
+
var q = parseInt(f.substr(_ + 4, 2), 16);
|
|
5494
|
+
l += String.fromCharCode((b & 31) << 6 | q & 63);
|
|
5496
5495
|
} else
|
|
5497
|
-
l += f.substr(
|
|
5498
|
-
|
|
5499
|
-
} else if (
|
|
5500
|
-
if (
|
|
5501
|
-
var U = parseInt(f.substr(
|
|
5502
|
-
l += String.fromCharCode((
|
|
5496
|
+
l += f.substr(_, 6);
|
|
5497
|
+
_ += 6;
|
|
5498
|
+
} else if (b >= 224) {
|
|
5499
|
+
if (E - _ >= 9) {
|
|
5500
|
+
var U = parseInt(f.substr(_ + 4, 2), 16), J = parseInt(f.substr(_ + 7, 2), 16);
|
|
5501
|
+
l += String.fromCharCode((b & 15) << 12 | (U & 63) << 6 | J & 63);
|
|
5503
5502
|
} else
|
|
5504
|
-
l += f.substr(
|
|
5505
|
-
|
|
5503
|
+
l += f.substr(_, 9);
|
|
5504
|
+
_ += 9;
|
|
5506
5505
|
} else
|
|
5507
|
-
l += f.substr(
|
|
5506
|
+
l += f.substr(_, 3), _ += 3;
|
|
5508
5507
|
}
|
|
5509
5508
|
return l;
|
|
5510
5509
|
}
|
|
5511
5510
|
function G(f, l) {
|
|
5512
|
-
function
|
|
5513
|
-
var
|
|
5514
|
-
return
|
|
5511
|
+
function _(E) {
|
|
5512
|
+
var b = W(E);
|
|
5513
|
+
return b.match(l.UNRESERVED) ? b : E;
|
|
5515
5514
|
}
|
|
5516
|
-
return f.scheme && (f.scheme = String(f.scheme).replace(l.PCT_ENCODED,
|
|
5515
|
+
return f.scheme && (f.scheme = String(f.scheme).replace(l.PCT_ENCODED, _).toLowerCase().replace(l.NOT_SCHEME, "")), f.userinfo !== void 0 && (f.userinfo = String(f.userinfo).replace(l.PCT_ENCODED, _).replace(l.NOT_USERINFO, L).replace(l.PCT_ENCODED, o)), f.host !== void 0 && (f.host = String(f.host).replace(l.PCT_ENCODED, _).toLowerCase().replace(l.NOT_HOST, L).replace(l.PCT_ENCODED, o)), f.path !== void 0 && (f.path = String(f.path).replace(l.PCT_ENCODED, _).replace(f.scheme ? l.NOT_PATH : l.NOT_PATH_NOSCHEME, L).replace(l.PCT_ENCODED, o)), f.query !== void 0 && (f.query = String(f.query).replace(l.PCT_ENCODED, _).replace(l.NOT_QUERY, L).replace(l.PCT_ENCODED, o)), f.fragment !== void 0 && (f.fragment = String(f.fragment).replace(l.PCT_ENCODED, _).replace(l.NOT_FRAGMENT, L).replace(l.PCT_ENCODED, o)), f;
|
|
5517
5516
|
}
|
|
5518
5517
|
function ne(f) {
|
|
5519
5518
|
return f.replace(/^0*(.*)/, "$1") || "0";
|
|
5520
5519
|
}
|
|
5521
5520
|
function he(f, l) {
|
|
5522
|
-
var
|
|
5523
|
-
return
|
|
5521
|
+
var _ = f.match(l.IPV4ADDRESS) || [], E = R(_, 2), b = E[1];
|
|
5522
|
+
return b ? b.split(".").map(ne).join(".") : f;
|
|
5524
5523
|
}
|
|
5525
5524
|
function Ue(f, l) {
|
|
5526
|
-
var
|
|
5527
|
-
if (
|
|
5528
|
-
for (var U =
|
|
5525
|
+
var _ = f.match(l.IPV6ADDRESS) || [], E = R(_, 3), b = E[1], q = E[2];
|
|
5526
|
+
if (b) {
|
|
5527
|
+
for (var U = b.toLowerCase().split("::").reverse(), J = R(U, 2), Y = J[0], se = J[1], B = se ? se.split(":").map(ne) : [], Z = Y.split(":").map(ne), ie = l.IPV4ADDRESS.test(Z[Z.length - 1]), x = ie ? 7 : 8, X = Z.length - x, ae = Array(x), ee = 0; ee < x; ++ee)
|
|
5529
5528
|
ae[ee] = B[ee] || Z[X + ee] || "";
|
|
5530
5529
|
ie && (ae[x - 1] = he(ae[x - 1], l));
|
|
5531
|
-
var Se = ae.reduce(function(fe,
|
|
5532
|
-
if (
|
|
5530
|
+
var Se = ae.reduce(function(fe, $e, je) {
|
|
5531
|
+
if (!$e || $e === "0") {
|
|
5533
5532
|
var we = fe[fe.length - 1];
|
|
5534
5533
|
we && we.index + we.length === je ? we.length++ : fe.push({ index: je, length: 1 });
|
|
5535
5534
|
}
|
|
5536
5535
|
return fe;
|
|
5537
|
-
}, []), ge = Se.sort(function(fe,
|
|
5538
|
-
return
|
|
5539
|
-
})[0],
|
|
5536
|
+
}, []), ge = Se.sort(function(fe, $e) {
|
|
5537
|
+
return $e.length - fe.length;
|
|
5538
|
+
})[0], ye = void 0;
|
|
5540
5539
|
if (ge && ge.length > 1) {
|
|
5541
5540
|
var Be = ae.slice(0, ge.index), Ie = ae.slice(ge.index + ge.length);
|
|
5542
|
-
|
|
5541
|
+
ye = Be.join(":") + "::" + Ie.join(":");
|
|
5543
5542
|
} else
|
|
5544
|
-
|
|
5545
|
-
return
|
|
5543
|
+
ye = ae.join(":");
|
|
5544
|
+
return q && (ye += "%" + q), ye;
|
|
5546
5545
|
} else
|
|
5547
5546
|
return f;
|
|
5548
5547
|
}
|
|
5549
5548
|
var tt = /^(?:([^:\/?#]+):)?(?:\/\/((?:([^\/?#@]*)@)?(\[[^\/?#\]]+\]|[^\/?#:]*)(?:\:(\d*))?))?([^?#]*)(?:\?([^#]*))?(?:#((?:.|\n|\r)*))?/i, rt = "".match(/(){0}/)[1] === void 0;
|
|
5550
5549
|
function de(f) {
|
|
5551
|
-
var l = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {},
|
|
5550
|
+
var l = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, _ = {}, E = l.iri !== !1 ? g : p;
|
|
5552
5551
|
l.reference === "suffix" && (f = (l.scheme ? l.scheme + ":" : "") + "//" + f);
|
|
5553
|
-
var
|
|
5554
|
-
if (
|
|
5555
|
-
rt ? (
|
|
5556
|
-
var
|
|
5557
|
-
if (!l.unicodeSupport && (!
|
|
5558
|
-
if (
|
|
5552
|
+
var b = f.match(tt);
|
|
5553
|
+
if (b) {
|
|
5554
|
+
rt ? (_.scheme = b[1], _.userinfo = b[3], _.host = b[4], _.port = parseInt(b[5], 10), _.path = b[6] || "", _.query = b[7], _.fragment = b[8], isNaN(_.port) && (_.port = b[5])) : (_.scheme = b[1] || void 0, _.userinfo = f.indexOf("@") !== -1 ? b[3] : void 0, _.host = f.indexOf("//") !== -1 ? b[4] : void 0, _.port = parseInt(b[5], 10), _.path = b[6] || "", _.query = f.indexOf("?") !== -1 ? b[7] : void 0, _.fragment = f.indexOf("#") !== -1 ? b[8] : void 0, isNaN(_.port) && (_.port = f.match(/\/\/(?:.|\n)*\:(?:\/|\?|\#|$)/) ? b[4] : void 0)), _.host && (_.host = Ue(he(_.host, E), E)), _.scheme === void 0 && _.userinfo === void 0 && _.host === void 0 && _.port === void 0 && !_.path && _.query === void 0 ? _.reference = "same-document" : _.scheme === void 0 ? _.reference = "relative" : _.fragment === void 0 ? _.reference = "absolute" : _.reference = "uri", l.reference && l.reference !== "suffix" && l.reference !== _.reference && (_.error = _.error || "URI is not a " + l.reference + " reference.");
|
|
5555
|
+
var q = M[(l.scheme || _.scheme || "").toLowerCase()];
|
|
5556
|
+
if (!l.unicodeSupport && (!q || !q.unicodeSupport)) {
|
|
5557
|
+
if (_.host && (l.domainHost || q && q.domainHost))
|
|
5559
5558
|
try {
|
|
5560
|
-
|
|
5559
|
+
_.host = N.toASCII(_.host.replace(E.PCT_ENCODED, W).toLowerCase());
|
|
5561
5560
|
} catch (U) {
|
|
5562
|
-
|
|
5561
|
+
_.error = _.error || "Host's domain name can not be converted to ASCII via punycode: " + U;
|
|
5563
5562
|
}
|
|
5564
|
-
G(
|
|
5563
|
+
G(_, p);
|
|
5565
5564
|
} else
|
|
5566
|
-
G(
|
|
5567
|
-
|
|
5565
|
+
G(_, E);
|
|
5566
|
+
q && q.parse && q.parse(_, l);
|
|
5568
5567
|
} else
|
|
5569
|
-
|
|
5570
|
-
return
|
|
5568
|
+
_.error = _.error || "URI can not be parsed.";
|
|
5569
|
+
return _;
|
|
5571
5570
|
}
|
|
5572
5571
|
function nt(f, l) {
|
|
5573
|
-
var
|
|
5574
|
-
return f.userinfo !== void 0 && (
|
|
5575
|
-
return "[" +
|
|
5576
|
-
})), (typeof f.port == "number" || typeof f.port == "string") && (
|
|
5572
|
+
var _ = l.iri !== !1 ? g : p, E = [];
|
|
5573
|
+
return f.userinfo !== void 0 && (E.push(f.userinfo), E.push("@")), f.host !== void 0 && E.push(Ue(he(String(f.host), _), _).replace(_.IPV6ADDRESS, function(b, q, U) {
|
|
5574
|
+
return "[" + q + (U ? "%25" + U : "") + "]";
|
|
5575
|
+
})), (typeof f.port == "number" || typeof f.port == "string") && (E.push(":"), E.push(String(f.port))), E.length ? E.join("") : void 0;
|
|
5577
5576
|
}
|
|
5578
5577
|
var He = /^\.\.?\//, Ve = /^\/\.(\/|$)/, xe = /^\/\.\.(\/|$)/, st = /^\/?(?:.|\n)*?(?=\/|$)/;
|
|
5579
5578
|
function me(f) {
|
|
@@ -5587,62 +5586,62 @@ var uri$1 = {}, uri_all = { exports: {} };
|
|
|
5587
5586
|
else if (f === "." || f === "..")
|
|
5588
5587
|
f = "";
|
|
5589
5588
|
else {
|
|
5590
|
-
var
|
|
5591
|
-
if (
|
|
5592
|
-
var
|
|
5593
|
-
f = f.slice(
|
|
5589
|
+
var _ = f.match(st);
|
|
5590
|
+
if (_) {
|
|
5591
|
+
var E = _[0];
|
|
5592
|
+
f = f.slice(E.length), l.push(E);
|
|
5594
5593
|
} else
|
|
5595
5594
|
throw new Error("Unexpected dot segment condition");
|
|
5596
5595
|
}
|
|
5597
5596
|
return l.join("");
|
|
5598
5597
|
}
|
|
5599
5598
|
function le(f) {
|
|
5600
|
-
var l = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {},
|
|
5601
|
-
if (
|
|
5602
|
-
if (l.domainHost ||
|
|
5599
|
+
var l = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, _ = l.iri ? g : p, E = [], b = M[(l.scheme || f.scheme || "").toLowerCase()];
|
|
5600
|
+
if (b && b.serialize && b.serialize(f, l), f.host && !_.IPV6ADDRESS.test(f.host)) {
|
|
5601
|
+
if (l.domainHost || b && b.domainHost)
|
|
5603
5602
|
try {
|
|
5604
|
-
f.host = l.iri ? N.toUnicode(f.host) : N.toASCII(f.host.replace(
|
|
5603
|
+
f.host = l.iri ? N.toUnicode(f.host) : N.toASCII(f.host.replace(_.PCT_ENCODED, W).toLowerCase());
|
|
5605
5604
|
} catch (J) {
|
|
5606
5605
|
f.error = f.error || "Host's domain name can not be converted to " + (l.iri ? "Unicode" : "ASCII") + " via punycode: " + J;
|
|
5607
5606
|
}
|
|
5608
5607
|
}
|
|
5609
|
-
G(f,
|
|
5610
|
-
var
|
|
5611
|
-
if (
|
|
5608
|
+
G(f, _), l.reference !== "suffix" && f.scheme && (E.push(f.scheme), E.push(":"));
|
|
5609
|
+
var q = nt(f, l);
|
|
5610
|
+
if (q !== void 0 && (l.reference !== "suffix" && E.push("//"), E.push(q), f.path && f.path.charAt(0) !== "/" && E.push("/")), f.path !== void 0) {
|
|
5612
5611
|
var U = f.path;
|
|
5613
|
-
!l.absolutePath && (!
|
|
5612
|
+
!l.absolutePath && (!b || !b.absolutePath) && (U = me(U)), q === void 0 && (U = U.replace(/^\/\//, "/%2F")), E.push(U);
|
|
5614
5613
|
}
|
|
5615
|
-
return f.query !== void 0 && (
|
|
5614
|
+
return f.query !== void 0 && (E.push("?"), E.push(f.query)), f.fragment !== void 0 && (E.push("#"), E.push(f.fragment)), E.join("");
|
|
5616
5615
|
}
|
|
5617
5616
|
function ze(f, l) {
|
|
5618
|
-
var
|
|
5619
|
-
return
|
|
5617
|
+
var _ = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {}, E = arguments[3], b = {};
|
|
5618
|
+
return E || (f = de(le(f, _), _), l = de(le(l, _), _)), _ = _ || {}, !_.tolerant && l.scheme ? (b.scheme = l.scheme, b.userinfo = l.userinfo, b.host = l.host, b.port = l.port, b.path = me(l.path || ""), b.query = l.query) : (l.userinfo !== void 0 || l.host !== void 0 || l.port !== void 0 ? (b.userinfo = l.userinfo, b.host = l.host, b.port = l.port, b.path = me(l.path || ""), b.query = l.query) : (l.path ? (l.path.charAt(0) === "/" ? b.path = me(l.path) : ((f.userinfo !== void 0 || f.host !== void 0 || f.port !== void 0) && !f.path ? b.path = "/" + l.path : f.path ? b.path = f.path.slice(0, f.path.lastIndexOf("/") + 1) + l.path : b.path = l.path, b.path = me(b.path)), b.query = l.query) : (b.path = f.path, l.query !== void 0 ? b.query = l.query : b.query = f.query), b.userinfo = f.userinfo, b.host = f.host, b.port = f.port), b.scheme = f.scheme), b.fragment = l.fragment, b;
|
|
5620
5619
|
}
|
|
5621
|
-
function it(f, l,
|
|
5622
|
-
var
|
|
5623
|
-
return le(ze(de(f,
|
|
5620
|
+
function it(f, l, _) {
|
|
5621
|
+
var E = d({ scheme: "null" }, _);
|
|
5622
|
+
return le(ze(de(f, E), de(l, E), E, !0), E);
|
|
5624
5623
|
}
|
|
5625
5624
|
function Oe(f, l) {
|
|
5626
5625
|
return typeof f == "string" ? f = le(de(f, l), l) : i(f) === "object" && (f = de(le(f, l), l)), f;
|
|
5627
5626
|
}
|
|
5628
|
-
function ot(f, l,
|
|
5629
|
-
return typeof f == "string" ? f = le(de(f,
|
|
5627
|
+
function ot(f, l, _) {
|
|
5628
|
+
return typeof f == "string" ? f = le(de(f, _), _) : i(f) === "object" && (f = le(f, _)), typeof l == "string" ? l = le(de(l, _), _) : i(l) === "object" && (l = le(l, _)), f === l;
|
|
5630
5629
|
}
|
|
5631
5630
|
function ut(f, l) {
|
|
5632
|
-
return f && f.toString().replace(!l || !l.iri ? p.ESCAPE :
|
|
5631
|
+
return f && f.toString().replace(!l || !l.iri ? p.ESCAPE : g.ESCAPE, L);
|
|
5633
5632
|
}
|
|
5634
5633
|
function pe(f, l) {
|
|
5635
|
-
return f && f.toString().replace(!l || !l.iri ? p.PCT_ENCODED :
|
|
5634
|
+
return f && f.toString().replace(!l || !l.iri ? p.PCT_ENCODED : g.PCT_ENCODED, W);
|
|
5636
5635
|
}
|
|
5637
5636
|
var Ne = {
|
|
5638
5637
|
scheme: "http",
|
|
5639
5638
|
domainHost: !0,
|
|
5640
|
-
parse: function(l,
|
|
5639
|
+
parse: function(l, _) {
|
|
5641
5640
|
return l.host || (l.error = l.error || "HTTP URIs must have a host."), l;
|
|
5642
5641
|
},
|
|
5643
|
-
serialize: function(l,
|
|
5644
|
-
var
|
|
5645
|
-
return (l.port === (
|
|
5642
|
+
serialize: function(l, _) {
|
|
5643
|
+
var E = String(l.scheme).toLowerCase() === "https";
|
|
5644
|
+
return (l.port === (E ? 443 : 80) || l.port === "") && (l.port = void 0), l.path || (l.path = "/"), l;
|
|
5646
5645
|
}
|
|
5647
5646
|
}, It = {
|
|
5648
5647
|
scheme: "https",
|
|
@@ -5656,14 +5655,14 @@ var uri$1 = {}, uri_all = { exports: {} };
|
|
|
5656
5655
|
var at = {
|
|
5657
5656
|
scheme: "ws",
|
|
5658
5657
|
domainHost: !0,
|
|
5659
|
-
parse: function(l,
|
|
5660
|
-
var
|
|
5661
|
-
return
|
|
5658
|
+
parse: function(l, _) {
|
|
5659
|
+
var E = l;
|
|
5660
|
+
return E.secure = jt(E), E.resourceName = (E.path || "/") + (E.query ? "?" + E.query : ""), E.path = void 0, E.query = void 0, E;
|
|
5662
5661
|
},
|
|
5663
|
-
serialize: function(l,
|
|
5662
|
+
serialize: function(l, _) {
|
|
5664
5663
|
if ((l.port === (jt(l) ? 443 : 80) || l.port === "") && (l.port = void 0), typeof l.secure == "boolean" && (l.scheme = l.secure ? "wss" : "ws", l.secure = void 0), l.resourceName) {
|
|
5665
|
-
var
|
|
5666
|
-
l.path =
|
|
5664
|
+
var E = l.resourceName.split("?"), b = R(E, 2), q = b[0], U = b[1];
|
|
5665
|
+
l.path = q && q !== "/" ? q : void 0, l.query = U, l.resourceName = void 0;
|
|
5667
5666
|
}
|
|
5668
5667
|
return l.fragment = void 0, l;
|
|
5669
5668
|
}
|
|
@@ -5679,94 +5678,94 @@ var uri$1 = {}, uri_all = { exports: {} };
|
|
|
5679
5678
|
}
|
|
5680
5679
|
var Mt = {
|
|
5681
5680
|
scheme: "mailto",
|
|
5682
|
-
parse: function(l,
|
|
5683
|
-
var
|
|
5684
|
-
if (
|
|
5685
|
-
for (var
|
|
5681
|
+
parse: function(l, _) {
|
|
5682
|
+
var E = l, b = E.to = E.path ? E.path.split(",") : [];
|
|
5683
|
+
if (E.path = void 0, E.query) {
|
|
5684
|
+
for (var q = !1, U = {}, J = E.query.split("&"), Y = 0, se = J.length; Y < se; ++Y) {
|
|
5686
5685
|
var B = J[Y].split("=");
|
|
5687
5686
|
switch (B[0]) {
|
|
5688
5687
|
case "to":
|
|
5689
5688
|
for (var Z = B[1].split(","), ie = 0, x = Z.length; ie < x; ++ie)
|
|
5690
|
-
|
|
5689
|
+
b.push(Z[ie]);
|
|
5691
5690
|
break;
|
|
5692
5691
|
case "subject":
|
|
5693
|
-
|
|
5692
|
+
E.subject = pe(B[1], _);
|
|
5694
5693
|
break;
|
|
5695
5694
|
case "body":
|
|
5696
|
-
|
|
5695
|
+
E.body = pe(B[1], _);
|
|
5697
5696
|
break;
|
|
5698
5697
|
default:
|
|
5699
|
-
|
|
5698
|
+
q = !0, U[pe(B[0], _)] = pe(B[1], _);
|
|
5700
5699
|
break;
|
|
5701
5700
|
}
|
|
5702
5701
|
}
|
|
5703
|
-
|
|
5702
|
+
q && (E.headers = U);
|
|
5704
5703
|
}
|
|
5705
|
-
|
|
5706
|
-
for (var X = 0, ae =
|
|
5707
|
-
var ee =
|
|
5708
|
-
if (ee[0] = pe(ee[0]),
|
|
5709
|
-
ee[1] = pe(ee[1],
|
|
5704
|
+
E.query = void 0;
|
|
5705
|
+
for (var X = 0, ae = b.length; X < ae; ++X) {
|
|
5706
|
+
var ee = b[X].split("@");
|
|
5707
|
+
if (ee[0] = pe(ee[0]), _.unicodeSupport)
|
|
5708
|
+
ee[1] = pe(ee[1], _).toLowerCase();
|
|
5710
5709
|
else
|
|
5711
5710
|
try {
|
|
5712
|
-
ee[1] = N.toASCII(pe(ee[1],
|
|
5711
|
+
ee[1] = N.toASCII(pe(ee[1], _).toLowerCase());
|
|
5713
5712
|
} catch (Se) {
|
|
5714
|
-
|
|
5713
|
+
E.error = E.error || "Email address's domain name can not be converted to ASCII via punycode: " + Se;
|
|
5715
5714
|
}
|
|
5716
|
-
|
|
5715
|
+
b[X] = ee.join("@");
|
|
5717
5716
|
}
|
|
5718
|
-
return
|
|
5717
|
+
return E;
|
|
5719
5718
|
},
|
|
5720
|
-
serialize: function(l,
|
|
5721
|
-
var
|
|
5722
|
-
if (
|
|
5723
|
-
for (var
|
|
5724
|
-
var J = String(
|
|
5719
|
+
serialize: function(l, _) {
|
|
5720
|
+
var E = l, b = c(l.to);
|
|
5721
|
+
if (b) {
|
|
5722
|
+
for (var q = 0, U = b.length; q < U; ++q) {
|
|
5723
|
+
var J = String(b[q]), Y = J.lastIndexOf("@"), se = J.slice(0, Y).replace(We, Ot).replace(We, o).replace(pr, L), B = J.slice(Y + 1);
|
|
5725
5724
|
try {
|
|
5726
|
-
B =
|
|
5725
|
+
B = _.iri ? N.toUnicode(B) : N.toASCII(pe(B, _).toLowerCase());
|
|
5727
5726
|
} catch (X) {
|
|
5728
|
-
|
|
5727
|
+
E.error = E.error || "Email address's domain name can not be converted to " + (_.iri ? "Unicode" : "ASCII") + " via punycode: " + X;
|
|
5729
5728
|
}
|
|
5730
|
-
|
|
5729
|
+
b[q] = se + "@" + B;
|
|
5731
5730
|
}
|
|
5732
|
-
|
|
5731
|
+
E.path = b.join(",");
|
|
5733
5732
|
}
|
|
5734
5733
|
var Z = l.headers = l.headers || {};
|
|
5735
5734
|
l.subject && (Z.subject = l.subject), l.body && (Z.body = l.body);
|
|
5736
5735
|
var ie = [];
|
|
5737
5736
|
for (var x in Z)
|
|
5738
|
-
Z[x] !== ir[x] && ie.push(x.replace(We, Ot).replace(We, o).replace(Ft,
|
|
5739
|
-
return ie.length && (
|
|
5737
|
+
Z[x] !== ir[x] && ie.push(x.replace(We, Ot).replace(We, o).replace(Ft, L) + "=" + Z[x].replace(We, Ot).replace(We, o).replace(fr, L));
|
|
5738
|
+
return ie.length && (E.query = ie.join("&")), E;
|
|
5740
5739
|
}
|
|
5741
|
-
}, hr = /^([^\:]+)\:(.*)/,
|
|
5740
|
+
}, hr = /^([^\:]+)\:(.*)/, Lt = {
|
|
5742
5741
|
scheme: "urn",
|
|
5743
|
-
parse: function(l,
|
|
5744
|
-
var
|
|
5745
|
-
if (
|
|
5746
|
-
var
|
|
5747
|
-
|
|
5742
|
+
parse: function(l, _) {
|
|
5743
|
+
var E = l.path && l.path.match(hr), b = l;
|
|
5744
|
+
if (E) {
|
|
5745
|
+
var q = _.scheme || b.scheme || "urn", U = E[1].toLowerCase(), J = E[2], Y = q + ":" + (_.nid || U), se = M[Y];
|
|
5746
|
+
b.nid = U, b.nss = J, b.path = void 0, se && (b = se.parse(b, _));
|
|
5748
5747
|
} else
|
|
5749
|
-
|
|
5750
|
-
return
|
|
5748
|
+
b.error = b.error || "URN can not be parsed.";
|
|
5749
|
+
return b;
|
|
5751
5750
|
},
|
|
5752
|
-
serialize: function(l,
|
|
5753
|
-
var
|
|
5754
|
-
U && (l = U.serialize(l,
|
|
5751
|
+
serialize: function(l, _) {
|
|
5752
|
+
var E = _.scheme || l.scheme || "urn", b = l.nid, q = E + ":" + (_.nid || b), U = M[q];
|
|
5753
|
+
U && (l = U.serialize(l, _));
|
|
5755
5754
|
var J = l, Y = l.nss;
|
|
5756
|
-
return J.path = (
|
|
5755
|
+
return J.path = (b || _.nid) + ":" + Y, J;
|
|
5757
5756
|
}
|
|
5758
|
-
}, mr = /^[0-9A-Fa-f]{8}(?:\-[0-9A-Fa-f]{4}){3}\-[0-9A-Fa-f]{12}$/,
|
|
5757
|
+
}, mr = /^[0-9A-Fa-f]{8}(?:\-[0-9A-Fa-f]{4}){3}\-[0-9A-Fa-f]{12}$/, qt = {
|
|
5759
5758
|
scheme: "urn:uuid",
|
|
5760
|
-
parse: function(l,
|
|
5761
|
-
var
|
|
5762
|
-
return
|
|
5759
|
+
parse: function(l, _) {
|
|
5760
|
+
var E = l;
|
|
5761
|
+
return E.uuid = E.nss, E.nss = void 0, !_.tolerant && (!E.uuid || !E.uuid.match(mr)) && (E.error = E.error || "UUID is not valid."), E;
|
|
5763
5762
|
},
|
|
5764
|
-
serialize: function(l,
|
|
5765
|
-
var
|
|
5766
|
-
return
|
|
5763
|
+
serialize: function(l, _) {
|
|
5764
|
+
var E = l;
|
|
5765
|
+
return E.nss = (l.uuid || "").toLowerCase(), E;
|
|
5767
5766
|
}
|
|
5768
5767
|
};
|
|
5769
|
-
M[Ne.scheme] = Ne, M[It.scheme] = It, M[at.scheme] = at, M[At.scheme] = At, M[Mt.scheme] = Mt, M[
|
|
5768
|
+
M[Ne.scheme] = Ne, M[It.scheme] = It, M[at.scheme] = at, M[At.scheme] = At, M[Mt.scheme] = Mt, M[Lt.scheme] = Lt, M[qt.scheme] = qt, r.SCHEMES = M, r.pctEncChar = L, r.pctDecChars = W, r.parse = de, r.removeDotSegments = me, r.serialize = le, r.resolveComponents = ze, r.resolve = it, r.normalize = Oe, r.equal = ot, r.escapeComponent = ut, r.unescapeComponent = pe, Object.defineProperty(r, "__esModule", { value: !0 });
|
|
5770
5769
|
});
|
|
5771
5770
|
})(uri_all, uri_all.exports);
|
|
5772
5771
|
var uri_allExports = uri_all.exports;
|
|
@@ -5794,7 +5793,7 @@ uri$1.default = uri;
|
|
|
5794
5793
|
} }), Object.defineProperty(e, "CodeGen", { enumerable: !0, get: function() {
|
|
5795
5794
|
return r.CodeGen;
|
|
5796
5795
|
} });
|
|
5797
|
-
const n = validation_error, s = ref_error, i = rules, o = compile, c = codegen, d = resolve$1, u = dataType, p = util,
|
|
5796
|
+
const n = validation_error, s = ref_error, i = rules, o = compile, c = codegen, d = resolve$1, u = dataType, p = util, g = require$$9, R = uri$1, O = (F, $) => new RegExp(F, $);
|
|
5798
5797
|
O.code = "new RegExp";
|
|
5799
5798
|
const T = ["removeAdditional", "useDefaults", "coerceTypes"], v = /* @__PURE__ */ new Set([
|
|
5800
5799
|
"validate",
|
|
@@ -5810,7 +5809,7 @@ uri$1.default = uri;
|
|
|
5810
5809
|
"func",
|
|
5811
5810
|
"obj",
|
|
5812
5811
|
"Error"
|
|
5813
|
-
]),
|
|
5812
|
+
]), y = {
|
|
5814
5813
|
errorDataPath: "",
|
|
5815
5814
|
format: "`validateFormats: false` can be used instead.",
|
|
5816
5815
|
nullable: '"nullable" keyword is supported by default.',
|
|
@@ -5832,11 +5831,11 @@ uri$1.default = uri;
|
|
|
5832
5831
|
unicode: '"minLength"/"maxLength" account for unicode characters by default.'
|
|
5833
5832
|
}, k = 200;
|
|
5834
5833
|
function S(F) {
|
|
5835
|
-
var
|
|
5836
|
-
const Oe = F.strict, ot = (
|
|
5834
|
+
var $, j, P, a, h, N, M, L, W, G, ne, he, Ue, tt, rt, de, nt, He, Ve, xe, st, me, le, ze, it;
|
|
5835
|
+
const Oe = F.strict, ot = ($ = F.code) === null || $ === void 0 ? void 0 : $.optimize, ut = ot === !0 || ot === void 0 ? 1 : ot || 0, pe = (P = (j = F.code) === null || j === void 0 ? void 0 : j.regExp) !== null && P !== void 0 ? P : O, Ne = (a = F.uriResolver) !== null && a !== void 0 ? a : R.default;
|
|
5837
5836
|
return {
|
|
5838
5837
|
strictSchema: (N = (h = F.strictSchema) !== null && h !== void 0 ? h : Oe) !== null && N !== void 0 ? N : !0,
|
|
5839
|
-
strictNumbers: (
|
|
5838
|
+
strictNumbers: (L = (M = F.strictNumbers) !== null && M !== void 0 ? M : Oe) !== null && L !== void 0 ? L : !0,
|
|
5840
5839
|
strictTypes: (G = (W = F.strictTypes) !== null && W !== void 0 ? W : Oe) !== null && G !== void 0 ? G : "log",
|
|
5841
5840
|
strictTuples: (he = (ne = F.strictTuples) !== null && ne !== void 0 ? ne : Oe) !== null && he !== void 0 ? he : "log",
|
|
5842
5841
|
strictRequired: (tt = (Ue = F.strictRequired) !== null && Ue !== void 0 ? Ue : Oe) !== null && tt !== void 0 ? tt : !1,
|
|
@@ -5856,44 +5855,44 @@ uri$1.default = uri;
|
|
|
5856
5855
|
};
|
|
5857
5856
|
}
|
|
5858
5857
|
class I {
|
|
5859
|
-
constructor(
|
|
5860
|
-
this.schemas = {}, this.refs = {}, this.formats = {}, this._compilations = /* @__PURE__ */ new Set(), this._loading = {}, this._cache = /* @__PURE__ */ new Map(),
|
|
5858
|
+
constructor($ = {}) {
|
|
5859
|
+
this.schemas = {}, this.refs = {}, this.formats = {}, this._compilations = /* @__PURE__ */ new Set(), this._loading = {}, this._cache = /* @__PURE__ */ new Map(), $ = this.opts = { ...$, ...S($) };
|
|
5861
5860
|
const { es5: j, lines: P } = this.opts.code;
|
|
5862
|
-
this.scope = new c.ValueScope({ scope: {}, prefixes: v, es5: j, lines: P }), this.logger = K(
|
|
5863
|
-
const a =
|
|
5864
|
-
|
|
5861
|
+
this.scope = new c.ValueScope({ scope: {}, prefixes: v, es5: j, lines: P }), this.logger = K($.logger);
|
|
5862
|
+
const a = $.validateFormats;
|
|
5863
|
+
$.validateFormats = !1, this.RULES = (0, i.getRules)(), D.call(this, y, $, "NOT SUPPORTED"), D.call(this, m, $, "DEPRECATED", "warn"), this._metaOpts = z.call(this), $.formats && A.call(this), this._addVocabularies(), this._addDefaultMetaSchema(), $.keywords && V.call(this, $.keywords), typeof $.meta == "object" && this.addMetaSchema($.meta), C.call(this), $.validateFormats = a;
|
|
5865
5864
|
}
|
|
5866
5865
|
_addVocabularies() {
|
|
5867
5866
|
this.addKeyword("$async");
|
|
5868
5867
|
}
|
|
5869
5868
|
_addDefaultMetaSchema() {
|
|
5870
|
-
const { $data:
|
|
5871
|
-
let a =
|
|
5872
|
-
P === "id" && (a = { ...
|
|
5869
|
+
const { $data: $, meta: j, schemaId: P } = this.opts;
|
|
5870
|
+
let a = g;
|
|
5871
|
+
P === "id" && (a = { ...g }, a.id = a.$id, delete a.$id), j && $ && this.addMetaSchema(a, a[P], !1);
|
|
5873
5872
|
}
|
|
5874
5873
|
defaultMeta() {
|
|
5875
|
-
const { meta:
|
|
5876
|
-
return this.opts.defaultMeta = typeof
|
|
5874
|
+
const { meta: $, schemaId: j } = this.opts;
|
|
5875
|
+
return this.opts.defaultMeta = typeof $ == "object" ? $[j] || $ : void 0;
|
|
5877
5876
|
}
|
|
5878
|
-
validate(
|
|
5877
|
+
validate($, j) {
|
|
5879
5878
|
let P;
|
|
5880
|
-
if (typeof
|
|
5881
|
-
if (P = this.getSchema(
|
|
5882
|
-
throw new Error(`no schema with key or ref "${
|
|
5879
|
+
if (typeof $ == "string") {
|
|
5880
|
+
if (P = this.getSchema($), !P)
|
|
5881
|
+
throw new Error(`no schema with key or ref "${$}"`);
|
|
5883
5882
|
} else
|
|
5884
|
-
P = this.compile(
|
|
5883
|
+
P = this.compile($);
|
|
5885
5884
|
const a = P(j);
|
|
5886
5885
|
return "$async" in P || (this.errors = P.errors), a;
|
|
5887
5886
|
}
|
|
5888
|
-
compile(
|
|
5889
|
-
const P = this._addSchema(
|
|
5887
|
+
compile($, j) {
|
|
5888
|
+
const P = this._addSchema($, j);
|
|
5890
5889
|
return P.validate || this._compileSchemaEnv(P);
|
|
5891
5890
|
}
|
|
5892
|
-
compileAsync(
|
|
5891
|
+
compileAsync($, j) {
|
|
5893
5892
|
if (typeof this.opts.loadSchema != "function")
|
|
5894
5893
|
throw new Error("options.loadSchema should be a function");
|
|
5895
5894
|
const { loadSchema: P } = this.opts;
|
|
5896
|
-
return a.call(this,
|
|
5895
|
+
return a.call(this, $, j);
|
|
5897
5896
|
async function a(G, ne) {
|
|
5898
5897
|
await h.call(this, G.$schema);
|
|
5899
5898
|
const he = this._addSchema(G, ne);
|
|
@@ -5908,14 +5907,14 @@ uri$1.default = uri;
|
|
|
5908
5907
|
} catch (ne) {
|
|
5909
5908
|
if (!(ne instanceof s.default))
|
|
5910
5909
|
throw ne;
|
|
5911
|
-
return M.call(this, ne), await
|
|
5910
|
+
return M.call(this, ne), await L.call(this, ne.missingSchema), N.call(this, G);
|
|
5912
5911
|
}
|
|
5913
5912
|
}
|
|
5914
5913
|
function M({ missingSchema: G, missingRef: ne }) {
|
|
5915
5914
|
if (this.refs[G])
|
|
5916
5915
|
throw new Error(`AnySchema ${G} is loaded but ${ne} cannot be resolved`);
|
|
5917
5916
|
}
|
|
5918
|
-
async function
|
|
5917
|
+
async function L(G) {
|
|
5919
5918
|
const ne = await W.call(this, G);
|
|
5920
5919
|
this.refs[G] || await h.call(this, ne.$schema), this.refs[G] || this.addSchema(ne, G, j);
|
|
5921
5920
|
}
|
|
@@ -5931,35 +5930,35 @@ uri$1.default = uri;
|
|
|
5931
5930
|
}
|
|
5932
5931
|
}
|
|
5933
5932
|
// Adds schema to the instance
|
|
5934
|
-
addSchema(
|
|
5935
|
-
if (Array.isArray(
|
|
5936
|
-
for (const N of
|
|
5933
|
+
addSchema($, j, P, a = this.opts.validateSchema) {
|
|
5934
|
+
if (Array.isArray($)) {
|
|
5935
|
+
for (const N of $)
|
|
5937
5936
|
this.addSchema(N, void 0, P, a);
|
|
5938
5937
|
return this;
|
|
5939
5938
|
}
|
|
5940
5939
|
let h;
|
|
5941
|
-
if (typeof
|
|
5940
|
+
if (typeof $ == "object") {
|
|
5942
5941
|
const { schemaId: N } = this.opts;
|
|
5943
|
-
if (h =
|
|
5942
|
+
if (h = $[N], h !== void 0 && typeof h != "string")
|
|
5944
5943
|
throw new Error(`schema ${N} must be string`);
|
|
5945
5944
|
}
|
|
5946
|
-
return j = (0, d.normalizeId)(j || h), this._checkUnique(j), this.schemas[j] = this._addSchema(
|
|
5945
|
+
return j = (0, d.normalizeId)(j || h), this._checkUnique(j), this.schemas[j] = this._addSchema($, P, j, a, !0), this;
|
|
5947
5946
|
}
|
|
5948
5947
|
// Add schema that will be used to validate other schemas
|
|
5949
5948
|
// options in META_IGNORE_OPTIONS are alway set to false
|
|
5950
|
-
addMetaSchema(
|
|
5951
|
-
return this.addSchema(
|
|
5949
|
+
addMetaSchema($, j, P = this.opts.validateSchema) {
|
|
5950
|
+
return this.addSchema($, j, !0, P), this;
|
|
5952
5951
|
}
|
|
5953
5952
|
// Validate schema against its meta-schema
|
|
5954
|
-
validateSchema(
|
|
5955
|
-
if (typeof
|
|
5953
|
+
validateSchema($, j) {
|
|
5954
|
+
if (typeof $ == "boolean")
|
|
5956
5955
|
return !0;
|
|
5957
5956
|
let P;
|
|
5958
|
-
if (P =
|
|
5957
|
+
if (P = $.$schema, P !== void 0 && typeof P != "string")
|
|
5959
5958
|
throw new Error("$schema must be a string");
|
|
5960
5959
|
if (P = P || this.opts.defaultMeta || this.defaultMeta(), !P)
|
|
5961
5960
|
return this.logger.warn("meta-schema not available"), this.errors = null, !0;
|
|
5962
|
-
const a = this.validate(P,
|
|
5961
|
+
const a = this.validate(P, $);
|
|
5963
5962
|
if (!a && j) {
|
|
5964
5963
|
const h = "schema is invalid: " + this.errorsText();
|
|
5965
5964
|
if (this.opts.validateSchema === "log")
|
|
@@ -5971,15 +5970,15 @@ uri$1.default = uri;
|
|
|
5971
5970
|
}
|
|
5972
5971
|
// Get compiled schema by `key` or `ref`.
|
|
5973
5972
|
// (`key` that was passed to `addSchema` or full schema reference - `schema.$id` or resolved id)
|
|
5974
|
-
getSchema(
|
|
5973
|
+
getSchema($) {
|
|
5975
5974
|
let j;
|
|
5976
|
-
for (; typeof (j = w.call(this,
|
|
5977
|
-
|
|
5975
|
+
for (; typeof (j = w.call(this, $)) == "string"; )
|
|
5976
|
+
$ = j;
|
|
5978
5977
|
if (j === void 0) {
|
|
5979
5978
|
const { schemaId: P } = this.opts, a = new o.SchemaEnv({ schema: {}, schemaId: P });
|
|
5980
|
-
if (j = o.resolveSchema.call(this, a,
|
|
5979
|
+
if (j = o.resolveSchema.call(this, a, $), !j)
|
|
5981
5980
|
return;
|
|
5982
|
-
this.refs[
|
|
5981
|
+
this.refs[$] = j;
|
|
5983
5982
|
}
|
|
5984
5983
|
return j.validate || this._compileSchemaEnv(j);
|
|
5985
5984
|
}
|
|
@@ -5987,20 +5986,20 @@ uri$1.default = uri;
|
|
|
5987
5986
|
// If no parameter is passed all schemas but meta-schemas are removed.
|
|
5988
5987
|
// If RegExp is passed all schemas with key/id matching pattern but meta-schemas are removed.
|
|
5989
5988
|
// Even if schema is referenced by other schemas it still can be removed as other schemas have local references.
|
|
5990
|
-
removeSchema(
|
|
5991
|
-
if (
|
|
5992
|
-
return this._removeAllSchemas(this.schemas,
|
|
5993
|
-
switch (typeof
|
|
5989
|
+
removeSchema($) {
|
|
5990
|
+
if ($ instanceof RegExp)
|
|
5991
|
+
return this._removeAllSchemas(this.schemas, $), this._removeAllSchemas(this.refs, $), this;
|
|
5992
|
+
switch (typeof $) {
|
|
5994
5993
|
case "undefined":
|
|
5995
5994
|
return this._removeAllSchemas(this.schemas), this._removeAllSchemas(this.refs), this._cache.clear(), this;
|
|
5996
5995
|
case "string": {
|
|
5997
|
-
const j = w.call(this,
|
|
5998
|
-
return typeof j == "object" && this._cache.delete(j.schema), delete this.schemas[
|
|
5996
|
+
const j = w.call(this, $);
|
|
5997
|
+
return typeof j == "object" && this._cache.delete(j.schema), delete this.schemas[$], delete this.refs[$], this;
|
|
5999
5998
|
}
|
|
6000
5999
|
case "object": {
|
|
6001
|
-
const j =
|
|
6000
|
+
const j = $;
|
|
6002
6001
|
this._cache.delete(j);
|
|
6003
|
-
let P =
|
|
6002
|
+
let P = $[this.opts.schemaId];
|
|
6004
6003
|
return P && (P = (0, d.normalizeId)(P), delete this.schemas[P], delete this.refs[P]), this;
|
|
6005
6004
|
}
|
|
6006
6005
|
default:
|
|
@@ -6008,23 +6007,23 @@ uri$1.default = uri;
|
|
|
6008
6007
|
}
|
|
6009
6008
|
}
|
|
6010
6009
|
// add "vocabulary" - a collection of keywords
|
|
6011
|
-
addVocabulary(
|
|
6012
|
-
for (const j of
|
|
6010
|
+
addVocabulary($) {
|
|
6011
|
+
for (const j of $)
|
|
6013
6012
|
this.addKeyword(j);
|
|
6014
6013
|
return this;
|
|
6015
6014
|
}
|
|
6016
|
-
addKeyword(
|
|
6015
|
+
addKeyword($, j) {
|
|
6017
6016
|
let P;
|
|
6018
|
-
if (typeof
|
|
6019
|
-
P =
|
|
6020
|
-
else if (typeof
|
|
6021
|
-
if (j =
|
|
6017
|
+
if (typeof $ == "string")
|
|
6018
|
+
P = $, typeof j == "object" && (this.logger.warn("these parameters are deprecated, see docs for addKeyword"), j.keyword = P);
|
|
6019
|
+
else if (typeof $ == "object" && j === void 0) {
|
|
6020
|
+
if (j = $, P = j.keyword, Array.isArray(P) && !P.length)
|
|
6022
6021
|
throw new Error("addKeywords: keyword must be string or non-empty array");
|
|
6023
6022
|
} else
|
|
6024
6023
|
throw new Error("invalid addKeywords parameters");
|
|
6025
6024
|
if (oe.call(this, P, j), !j)
|
|
6026
6025
|
return (0, p.eachItem)(P, (h) => ke.call(this, h)), this;
|
|
6027
|
-
|
|
6026
|
+
Le.call(this, j);
|
|
6028
6027
|
const a = {
|
|
6029
6028
|
...j,
|
|
6030
6029
|
type: (0, u.getJSONTypes)(j.type),
|
|
@@ -6032,93 +6031,93 @@ uri$1.default = uri;
|
|
|
6032
6031
|
};
|
|
6033
6032
|
return (0, p.eachItem)(P, a.type.length === 0 ? (h) => ke.call(this, h, a) : (h) => a.type.forEach((N) => ke.call(this, h, a, N))), this;
|
|
6034
6033
|
}
|
|
6035
|
-
getKeyword(
|
|
6036
|
-
const j = this.RULES.all[
|
|
6034
|
+
getKeyword($) {
|
|
6035
|
+
const j = this.RULES.all[$];
|
|
6037
6036
|
return typeof j == "object" ? j.definition : !!j;
|
|
6038
6037
|
}
|
|
6039
6038
|
// Remove keyword
|
|
6040
|
-
removeKeyword(
|
|
6039
|
+
removeKeyword($) {
|
|
6041
6040
|
const { RULES: j } = this;
|
|
6042
|
-
delete j.keywords[
|
|
6041
|
+
delete j.keywords[$], delete j.all[$];
|
|
6043
6042
|
for (const P of j.rules) {
|
|
6044
|
-
const a = P.rules.findIndex((h) => h.keyword ===
|
|
6043
|
+
const a = P.rules.findIndex((h) => h.keyword === $);
|
|
6045
6044
|
a >= 0 && P.rules.splice(a, 1);
|
|
6046
6045
|
}
|
|
6047
6046
|
return this;
|
|
6048
6047
|
}
|
|
6049
6048
|
// Add format
|
|
6050
|
-
addFormat(
|
|
6051
|
-
return typeof j == "string" && (j = new RegExp(j)), this.formats[
|
|
6049
|
+
addFormat($, j) {
|
|
6050
|
+
return typeof j == "string" && (j = new RegExp(j)), this.formats[$] = j, this;
|
|
6052
6051
|
}
|
|
6053
|
-
errorsText(
|
|
6054
|
-
return
|
|
6052
|
+
errorsText($ = this.errors, { separator: j = ", ", dataVar: P = "data" } = {}) {
|
|
6053
|
+
return !$ || $.length === 0 ? "No errors" : $.map((a) => `${P}${a.instancePath} ${a.message}`).reduce((a, h) => a + j + h);
|
|
6055
6054
|
}
|
|
6056
|
-
$dataMetaSchema(
|
|
6055
|
+
$dataMetaSchema($, j) {
|
|
6057
6056
|
const P = this.RULES.all;
|
|
6058
|
-
|
|
6057
|
+
$ = JSON.parse(JSON.stringify($));
|
|
6059
6058
|
for (const a of j) {
|
|
6060
6059
|
const h = a.split("/").slice(1);
|
|
6061
|
-
let N =
|
|
6060
|
+
let N = $;
|
|
6062
6061
|
for (const M of h)
|
|
6063
6062
|
N = N[M];
|
|
6064
6063
|
for (const M in P) {
|
|
6065
|
-
const
|
|
6066
|
-
if (typeof
|
|
6064
|
+
const L = P[M];
|
|
6065
|
+
if (typeof L != "object")
|
|
6067
6066
|
continue;
|
|
6068
|
-
const { $data: W } =
|
|
6069
|
-
W && G && (N[M] =
|
|
6067
|
+
const { $data: W } = L.definition, G = N[M];
|
|
6068
|
+
W && G && (N[M] = qe(G));
|
|
6070
6069
|
}
|
|
6071
6070
|
}
|
|
6072
|
-
return
|
|
6071
|
+
return $;
|
|
6073
6072
|
}
|
|
6074
|
-
_removeAllSchemas(
|
|
6075
|
-
for (const P in
|
|
6076
|
-
const a =
|
|
6077
|
-
(!j || j.test(P)) && (typeof a == "string" ? delete
|
|
6073
|
+
_removeAllSchemas($, j) {
|
|
6074
|
+
for (const P in $) {
|
|
6075
|
+
const a = $[P];
|
|
6076
|
+
(!j || j.test(P)) && (typeof a == "string" ? delete $[P] : a && !a.meta && (this._cache.delete(a.schema), delete $[P]));
|
|
6078
6077
|
}
|
|
6079
6078
|
}
|
|
6080
|
-
_addSchema(
|
|
6079
|
+
_addSchema($, j, P, a = this.opts.validateSchema, h = this.opts.addUsedSchema) {
|
|
6081
6080
|
let N;
|
|
6082
6081
|
const { schemaId: M } = this.opts;
|
|
6083
|
-
if (typeof
|
|
6084
|
-
N =
|
|
6082
|
+
if (typeof $ == "object")
|
|
6083
|
+
N = $[M];
|
|
6085
6084
|
else {
|
|
6086
6085
|
if (this.opts.jtd)
|
|
6087
6086
|
throw new Error("schema must be object");
|
|
6088
|
-
if (typeof
|
|
6087
|
+
if (typeof $ != "boolean")
|
|
6089
6088
|
throw new Error("schema must be object or boolean");
|
|
6090
6089
|
}
|
|
6091
|
-
let
|
|
6092
|
-
if (
|
|
6093
|
-
return
|
|
6090
|
+
let L = this._cache.get($);
|
|
6091
|
+
if (L !== void 0)
|
|
6092
|
+
return L;
|
|
6094
6093
|
P = (0, d.normalizeId)(N || P);
|
|
6095
|
-
const W = d.getSchemaRefs.call(this,
|
|
6096
|
-
return
|
|
6094
|
+
const W = d.getSchemaRefs.call(this, $, P);
|
|
6095
|
+
return L = new o.SchemaEnv({ schema: $, schemaId: M, meta: j, baseId: P, localRefs: W }), this._cache.set(L.schema, L), h && !P.startsWith("#") && (P && this._checkUnique(P), this.refs[P] = L), a && this.validateSchema($, !0), L;
|
|
6097
6096
|
}
|
|
6098
|
-
_checkUnique(
|
|
6099
|
-
if (this.schemas[
|
|
6100
|
-
throw new Error(`schema with key or id "${
|
|
6097
|
+
_checkUnique($) {
|
|
6098
|
+
if (this.schemas[$] || this.refs[$])
|
|
6099
|
+
throw new Error(`schema with key or id "${$}" already exists`);
|
|
6101
6100
|
}
|
|
6102
|
-
_compileSchemaEnv(
|
|
6103
|
-
if (
|
|
6101
|
+
_compileSchemaEnv($) {
|
|
6102
|
+
if ($.meta ? this._compileMetaSchema($) : o.compileSchema.call(this, $), !$.validate)
|
|
6104
6103
|
throw new Error("ajv implementation error");
|
|
6105
|
-
return
|
|
6104
|
+
return $.validate;
|
|
6106
6105
|
}
|
|
6107
|
-
_compileMetaSchema(
|
|
6106
|
+
_compileMetaSchema($) {
|
|
6108
6107
|
const j = this.opts;
|
|
6109
6108
|
this.opts = this._metaOpts;
|
|
6110
6109
|
try {
|
|
6111
|
-
o.compileSchema.call(this,
|
|
6110
|
+
o.compileSchema.call(this, $);
|
|
6112
6111
|
} finally {
|
|
6113
6112
|
this.opts = j;
|
|
6114
6113
|
}
|
|
6115
6114
|
}
|
|
6116
6115
|
}
|
|
6117
6116
|
e.default = I, I.ValidationError = n.default, I.MissingRefError = s.default;
|
|
6118
|
-
function D(F,
|
|
6117
|
+
function D(F, $, j, P = "error") {
|
|
6119
6118
|
for (const a in F) {
|
|
6120
6119
|
const h = a;
|
|
6121
|
-
h in
|
|
6120
|
+
h in $ && this.logger[P](`${j}: option ${a}. ${F[h]}`);
|
|
6122
6121
|
}
|
|
6123
6122
|
}
|
|
6124
6123
|
function w(F) {
|
|
@@ -6130,13 +6129,13 @@ uri$1.default = uri;
|
|
|
6130
6129
|
if (Array.isArray(F))
|
|
6131
6130
|
this.addSchema(F);
|
|
6132
6131
|
else
|
|
6133
|
-
for (const
|
|
6134
|
-
this.addSchema(F[
|
|
6132
|
+
for (const $ in F)
|
|
6133
|
+
this.addSchema(F[$], $);
|
|
6135
6134
|
}
|
|
6136
6135
|
function A() {
|
|
6137
6136
|
for (const F in this.opts.formats) {
|
|
6138
|
-
const
|
|
6139
|
-
|
|
6137
|
+
const $ = this.opts.formats[F];
|
|
6138
|
+
$ && this.addFormat(F, $);
|
|
6140
6139
|
}
|
|
6141
6140
|
}
|
|
6142
6141
|
function V(F) {
|
|
@@ -6145,15 +6144,15 @@ uri$1.default = uri;
|
|
|
6145
6144
|
return;
|
|
6146
6145
|
}
|
|
6147
6146
|
this.logger.warn("keywords option as map is deprecated, pass array");
|
|
6148
|
-
for (const
|
|
6149
|
-
const j = F[
|
|
6150
|
-
j.keyword || (j.keyword =
|
|
6147
|
+
for (const $ in F) {
|
|
6148
|
+
const j = F[$];
|
|
6149
|
+
j.keyword || (j.keyword = $), this.addKeyword(j);
|
|
6151
6150
|
}
|
|
6152
6151
|
}
|
|
6153
6152
|
function z() {
|
|
6154
6153
|
const F = { ...this.opts };
|
|
6155
|
-
for (const
|
|
6156
|
-
delete F[
|
|
6154
|
+
for (const $ of T)
|
|
6155
|
+
delete F[$];
|
|
6157
6156
|
return F;
|
|
6158
6157
|
}
|
|
6159
6158
|
const re = { log() {
|
|
@@ -6170,47 +6169,47 @@ uri$1.default = uri;
|
|
|
6170
6169
|
throw new Error("logger must implement log, warn and error methods");
|
|
6171
6170
|
}
|
|
6172
6171
|
const ue = /^[a-z_$][a-z0-9_$:-]*$/i;
|
|
6173
|
-
function oe(F,
|
|
6172
|
+
function oe(F, $) {
|
|
6174
6173
|
const { RULES: j } = this;
|
|
6175
6174
|
if ((0, p.eachItem)(F, (P) => {
|
|
6176
6175
|
if (j.keywords[P])
|
|
6177
6176
|
throw new Error(`Keyword ${P} is already defined`);
|
|
6178
6177
|
if (!ue.test(P))
|
|
6179
6178
|
throw new Error(`Keyword ${P} has invalid name`);
|
|
6180
|
-
}),
|
|
6179
|
+
}), !!$ && $.$data && !("code" in $ || "validate" in $))
|
|
6181
6180
|
throw new Error('$data keyword must have "code" or "validate" function');
|
|
6182
6181
|
}
|
|
6183
|
-
function ke(F,
|
|
6182
|
+
function ke(F, $, j) {
|
|
6184
6183
|
var P;
|
|
6185
|
-
const a =
|
|
6184
|
+
const a = $ == null ? void 0 : $.post;
|
|
6186
6185
|
if (j && a)
|
|
6187
6186
|
throw new Error('keyword with "post" flag cannot have "type"');
|
|
6188
6187
|
const { RULES: h } = this;
|
|
6189
|
-
let N = a ? h.post : h.rules.find(({ type:
|
|
6190
|
-
if (N || (N = { type: j, rules: [] }, h.rules.push(N)), h.keywords[F] = !0,
|
|
6188
|
+
let N = a ? h.post : h.rules.find(({ type: L }) => L === j);
|
|
6189
|
+
if (N || (N = { type: j, rules: [] }, h.rules.push(N)), h.keywords[F] = !0, !$)
|
|
6191
6190
|
return;
|
|
6192
6191
|
const M = {
|
|
6193
6192
|
keyword: F,
|
|
6194
6193
|
definition: {
|
|
6195
|
-
|
|
6196
|
-
type: (0, u.getJSONTypes)(
|
|
6197
|
-
schemaType: (0, u.getJSONTypes)(
|
|
6194
|
+
...$,
|
|
6195
|
+
type: (0, u.getJSONTypes)($.type),
|
|
6196
|
+
schemaType: (0, u.getJSONTypes)($.schemaType)
|
|
6198
6197
|
}
|
|
6199
6198
|
};
|
|
6200
|
-
|
|
6199
|
+
$.before ? Ce.call(this, N, M, $.before) : N.rules.push(M), h.all[F] = M, (P = $.implements) === null || P === void 0 || P.forEach((L) => this.addKeyword(L));
|
|
6201
6200
|
}
|
|
6202
|
-
function Ce(F,
|
|
6201
|
+
function Ce(F, $, j) {
|
|
6203
6202
|
const P = F.rules.findIndex((a) => a.keyword === j);
|
|
6204
|
-
P >= 0 ? F.rules.splice(P, 0,
|
|
6203
|
+
P >= 0 ? F.rules.splice(P, 0, $) : (F.rules.push($), this.logger.warn(`rule ${j} is not defined`));
|
|
6205
6204
|
}
|
|
6206
|
-
function
|
|
6207
|
-
let { metaSchema:
|
|
6208
|
-
|
|
6205
|
+
function Le(F) {
|
|
6206
|
+
let { metaSchema: $ } = F;
|
|
6207
|
+
$ !== void 0 && (F.$data && this.opts.$data && ($ = qe($)), F.validateSchema = this.compile($, !0));
|
|
6209
6208
|
}
|
|
6210
6209
|
const et = {
|
|
6211
6210
|
$ref: "https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"
|
|
6212
6211
|
};
|
|
6213
|
-
function
|
|
6212
|
+
function qe(F) {
|
|
6214
6213
|
return { anyOf: [F, et] };
|
|
6215
6214
|
}
|
|
6216
6215
|
})(core$2);
|
|
@@ -6232,14 +6231,14 @@ const ref_error_1 = ref_error, code_1$8 = code, codegen_1$l = codegen, names_1$1
|
|
|
6232
6231
|
code(e) {
|
|
6233
6232
|
const { gen: t, schema: r, it: n } = e, { baseId: s, schemaEnv: i, validateName: o, opts: c, self: d } = n, { root: u } = i;
|
|
6234
6233
|
if ((r === "#" || r === "#/") && s === u.baseId)
|
|
6235
|
-
return
|
|
6234
|
+
return g();
|
|
6236
6235
|
const p = compile_1$1.resolveRef.call(d, u, s, r);
|
|
6237
6236
|
if (p === void 0)
|
|
6238
6237
|
throw new ref_error_1.default(n.opts.uriResolver, s, r);
|
|
6239
6238
|
if (p instanceof compile_1$1.SchemaEnv)
|
|
6240
6239
|
return R(p);
|
|
6241
6240
|
return O(p);
|
|
6242
|
-
function
|
|
6241
|
+
function g() {
|
|
6243
6242
|
if (i === u)
|
|
6244
6243
|
return callRef(e, o, i, i.$async);
|
|
6245
6244
|
const T = t.scopeValue("root", { ref: u });
|
|
@@ -6250,14 +6249,14 @@ const ref_error_1 = ref_error, code_1$8 = code, codegen_1$l = codegen, names_1$1
|
|
|
6250
6249
|
callRef(e, v, T, T.$async);
|
|
6251
6250
|
}
|
|
6252
6251
|
function O(T) {
|
|
6253
|
-
const v = t.scopeValue("schema", c.code.source === !0 ? { ref: T, code: (0, codegen_1$l.stringify)(T) } : { ref: T }),
|
|
6252
|
+
const v = t.scopeValue("schema", c.code.source === !0 ? { ref: T, code: (0, codegen_1$l.stringify)(T) } : { ref: T }), y = t.name("valid"), m = e.subschema({
|
|
6254
6253
|
schema: T,
|
|
6255
6254
|
dataTypes: [],
|
|
6256
6255
|
schemaPath: codegen_1$l.nil,
|
|
6257
6256
|
topSchemaRef: v,
|
|
6258
6257
|
errSchemaPath: r
|
|
6259
|
-
},
|
|
6260
|
-
e.mergeEvaluated(m), e.ok(
|
|
6258
|
+
}, y);
|
|
6259
|
+
e.mergeEvaluated(m), e.ok(y);
|
|
6261
6260
|
}
|
|
6262
6261
|
}
|
|
6263
6262
|
};
|
|
@@ -6268,7 +6267,7 @@ function getValidate(e, t) {
|
|
|
6268
6267
|
ref.getValidate = getValidate;
|
|
6269
6268
|
function callRef(e, t, r, n) {
|
|
6270
6269
|
const { gen: s, it: i } = e, { allErrors: o, schemaEnv: c, opts: d } = i, u = d.passContext ? names_1$1.default.this : codegen_1$l.nil;
|
|
6271
|
-
n ? p() :
|
|
6270
|
+
n ? p() : g();
|
|
6272
6271
|
function p() {
|
|
6273
6272
|
if (!c.$async)
|
|
6274
6273
|
throw new Error("async schema referenced by sync schema");
|
|
@@ -6279,7 +6278,7 @@ function callRef(e, t, r, n) {
|
|
|
6279
6278
|
s.if((0, codegen_1$l._)`!(${v} instanceof ${i.ValidationError})`, () => s.throw(v)), R(v), o || s.assign(T, !1);
|
|
6280
6279
|
}), e.ok(T);
|
|
6281
6280
|
}
|
|
6282
|
-
function
|
|
6281
|
+
function g() {
|
|
6283
6282
|
e.result((0, code_1$8.callValidateCode)(e, t, u), () => O(t), () => R(t));
|
|
6284
6283
|
}
|
|
6285
6284
|
function R(T) {
|
|
@@ -6290,17 +6289,17 @@ function callRef(e, t, r, n) {
|
|
|
6290
6289
|
var v;
|
|
6291
6290
|
if (!i.opts.unevaluated)
|
|
6292
6291
|
return;
|
|
6293
|
-
const
|
|
6292
|
+
const y = (v = r == null ? void 0 : r.validate) === null || v === void 0 ? void 0 : v.evaluated;
|
|
6294
6293
|
if (i.props !== !0)
|
|
6295
|
-
if (
|
|
6296
|
-
|
|
6294
|
+
if (y && !y.dynamicProps)
|
|
6295
|
+
y.props !== void 0 && (i.props = util_1$j.mergeEvaluated.props(s, y.props, i.props));
|
|
6297
6296
|
else {
|
|
6298
6297
|
const m = s.var("props", (0, codegen_1$l._)`${T}.evaluated.props`);
|
|
6299
6298
|
i.props = util_1$j.mergeEvaluated.props(s, m, i.props, codegen_1$l.Name);
|
|
6300
6299
|
}
|
|
6301
6300
|
if (i.items !== !0)
|
|
6302
|
-
if (
|
|
6303
|
-
|
|
6301
|
+
if (y && !y.dynamicItems)
|
|
6302
|
+
y.items !== void 0 && (i.items = util_1$j.mergeEvaluated.items(s, y.items, i.items));
|
|
6304
6303
|
else {
|
|
6305
6304
|
const m = s.var("items", (0, codegen_1$l._)`${T}.evaluated.items`);
|
|
6306
6305
|
i.items = util_1$j.mergeEvaluated.items(s, m, i.items, codegen_1$l.Name);
|
|
@@ -6447,13 +6446,13 @@ const code_1$6 = code, codegen_1$f = codegen, util_1$h = util, error$d = {
|
|
|
6447
6446
|
const O = e.parentSchema.properties, { definedProperties: T } = e.it;
|
|
6448
6447
|
for (const v of r)
|
|
6449
6448
|
if ((O == null ? void 0 : O[v]) === void 0 && !T.has(v)) {
|
|
6450
|
-
const
|
|
6449
|
+
const y = o.schemaEnv.baseId + o.errSchemaPath, m = `required property "${v}" is not defined at "${y}" (strictRequired)`;
|
|
6451
6450
|
(0, util_1$h.checkStrictMode)(o, m, o.opts.strictRequired);
|
|
6452
6451
|
}
|
|
6453
6452
|
}
|
|
6454
6453
|
function u() {
|
|
6455
6454
|
if (d || i)
|
|
6456
|
-
e.block$data(codegen_1$f.nil,
|
|
6455
|
+
e.block$data(codegen_1$f.nil, g);
|
|
6457
6456
|
else
|
|
6458
6457
|
for (const O of r)
|
|
6459
6458
|
(0, code_1$6.checkReportMissingProp)(e, O);
|
|
@@ -6466,7 +6465,7 @@ const code_1$6 = code, codegen_1$f = codegen, util_1$h = util, error$d = {
|
|
|
6466
6465
|
} else
|
|
6467
6466
|
t.if((0, code_1$6.checkMissingProp)(e, r, O)), (0, code_1$6.reportMissingProp)(e, O), t.else();
|
|
6468
6467
|
}
|
|
6469
|
-
function
|
|
6468
|
+
function g() {
|
|
6470
6469
|
t.forOf("prop", n, (O) => {
|
|
6471
6470
|
e.setParams({ missingProperty: O }), t.if((0, code_1$6.noPropertyInData)(t, s, O, c.ownProperties), () => e.error());
|
|
6472
6471
|
});
|
|
@@ -6524,22 +6523,22 @@ const dataType_1 = dataType, codegen_1$d = codegen, util_1$g = util, equal_1$2 =
|
|
|
6524
6523
|
e.block$data(d, p, (0, codegen_1$d._)`${o} === false`), e.ok(d);
|
|
6525
6524
|
function p() {
|
|
6526
6525
|
const T = t.let("i", (0, codegen_1$d._)`${r}.length`), v = t.let("j");
|
|
6527
|
-
e.setParams({ i: T, j: v }), t.assign(d, !0), t.if((0, codegen_1$d._)`${T} > 1`, () => (
|
|
6526
|
+
e.setParams({ i: T, j: v }), t.assign(d, !0), t.if((0, codegen_1$d._)`${T} > 1`, () => (g() ? R : O)(T, v));
|
|
6528
6527
|
}
|
|
6529
|
-
function
|
|
6528
|
+
function g() {
|
|
6530
6529
|
return u.length > 0 && !u.some((T) => T === "object" || T === "array");
|
|
6531
6530
|
}
|
|
6532
6531
|
function R(T, v) {
|
|
6533
|
-
const
|
|
6532
|
+
const y = t.name("item"), m = (0, dataType_1.checkDataTypes)(u, y, c.opts.strictNumbers, dataType_1.DataType.Wrong), k = t.const("indices", (0, codegen_1$d._)`{}`);
|
|
6534
6533
|
t.for((0, codegen_1$d._)`;${T}--;`, () => {
|
|
6535
|
-
t.let(
|
|
6536
|
-
t.assign(v, (0, codegen_1$d._)`${k}[${
|
|
6537
|
-
}).code((0, codegen_1$d._)`${k}[${
|
|
6534
|
+
t.let(y, (0, codegen_1$d._)`${r}[${T}]`), t.if(m, (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 ${k}[${y}] == "number"`, () => {
|
|
6535
|
+
t.assign(v, (0, codegen_1$d._)`${k}[${y}]`), e.error(), t.assign(d, !1).break();
|
|
6536
|
+
}).code((0, codegen_1$d._)`${k}[${y}] = ${T}`);
|
|
6538
6537
|
});
|
|
6539
6538
|
}
|
|
6540
6539
|
function O(T, v) {
|
|
6541
|
-
const
|
|
6542
|
-
t.label(m).for((0, codegen_1$d._)`;${T}--;`, () => t.for((0, codegen_1$d._)`${v} = ${T}; ${v}--;`, () => t.if((0, codegen_1$d._)`${
|
|
6540
|
+
const y = (0, util_1$g.useFunc)(t, equal_1$2.default), m = t.name("outer");
|
|
6541
|
+
t.label(m).for((0, codegen_1$d._)`;${T}--;`, () => t.for((0, codegen_1$d._)`${v} = ${T}; ${v}--;`, () => t.if((0, codegen_1$d._)`${y}(${r}[${T}], ${r}[${v}])`, () => {
|
|
6543
6542
|
e.error(), t.assign(d, !1).break(m);
|
|
6544
6543
|
})));
|
|
6545
6544
|
}
|
|
@@ -6580,7 +6579,7 @@ const codegen_1$b = codegen, util_1$e = util, equal_1 = equal$1, error$9 = {
|
|
|
6580
6579
|
const u = () => d ?? (d = (0, util_1$e.useFunc)(t, equal_1.default));
|
|
6581
6580
|
let p;
|
|
6582
6581
|
if (c || n)
|
|
6583
|
-
p = t.let("valid"), e.block$data(p,
|
|
6582
|
+
p = t.let("valid"), e.block$data(p, g);
|
|
6584
6583
|
else {
|
|
6585
6584
|
if (!Array.isArray(s))
|
|
6586
6585
|
throw new Error("ajv implementation error");
|
|
@@ -6588,7 +6587,7 @@ const codegen_1$b = codegen, util_1$e = util, equal_1 = equal$1, error$9 = {
|
|
|
6588
6587
|
p = (0, codegen_1$b.or)(...s.map((T, v) => R(O, v)));
|
|
6589
6588
|
}
|
|
6590
6589
|
e.pass(p);
|
|
6591
|
-
function
|
|
6590
|
+
function g() {
|
|
6592
6591
|
t.assign(p, !1), t.forOf("v", i, (O) => t.if((0, codegen_1$b._)`${u()}(${r}, ${O})`, () => t.assign(p, !0).break()));
|
|
6593
6592
|
}
|
|
6594
6593
|
function R(O, T) {
|
|
@@ -6677,18 +6676,18 @@ function validateTuple(e, t, r = e.schema) {
|
|
|
6677
6676
|
const { gen: n, parentSchema: s, data: i, keyword: o, it: c } = e;
|
|
6678
6677
|
p(s), c.opts.unevaluated && r.length && c.items !== !0 && (c.items = util_1$c.mergeEvaluated.items(n, r.length, c.items));
|
|
6679
6678
|
const d = n.name("valid"), u = n.const("len", (0, codegen_1$9._)`${i}.length`);
|
|
6680
|
-
r.forEach((
|
|
6681
|
-
(0, util_1$c.alwaysValidSchema)(c,
|
|
6679
|
+
r.forEach((g, R) => {
|
|
6680
|
+
(0, util_1$c.alwaysValidSchema)(c, g) || (n.if((0, codegen_1$9._)`${u} > ${R}`, () => e.subschema({
|
|
6682
6681
|
keyword: o,
|
|
6683
6682
|
schemaProp: R,
|
|
6684
6683
|
dataProp: R
|
|
6685
6684
|
}, d)), e.ok(d));
|
|
6686
6685
|
});
|
|
6687
|
-
function p(
|
|
6688
|
-
const { opts: R, errSchemaPath: O } = c, T = r.length, v = T ===
|
|
6686
|
+
function p(g) {
|
|
6687
|
+
const { opts: R, errSchemaPath: O } = c, T = r.length, v = T === g.minItems && (T === g.maxItems || g[t] === !1);
|
|
6689
6688
|
if (R.strictTuples && !v) {
|
|
6690
|
-
const
|
|
6691
|
-
(0, util_1$c.checkStrictMode)(c,
|
|
6689
|
+
const y = `"${o}" is ${T}-tuple, but minItems or maxItems/${t} are not specified or different at path "${O}"`;
|
|
6690
|
+
(0, util_1$c.checkStrictMode)(c, y, R.strictTuples);
|
|
6692
6691
|
}
|
|
6693
6692
|
}
|
|
6694
6693
|
}
|
|
@@ -6752,24 +6751,24 @@ const codegen_1$7 = codegen, util_1$a = util, error$6 = {
|
|
|
6752
6751
|
return;
|
|
6753
6752
|
}
|
|
6754
6753
|
i.items = !0;
|
|
6755
|
-
const
|
|
6756
|
-
c === void 0 && o === 1 ? O(
|
|
6754
|
+
const g = t.name("valid");
|
|
6755
|
+
c === void 0 && o === 1 ? O(g, () => t.if(g, () => t.break())) : o === 0 ? (t.let(g, !0), c !== void 0 && t.if((0, codegen_1$7._)`${s}.length > 0`, R)) : (t.let(g, !1), R()), e.result(g, () => e.reset());
|
|
6757
6756
|
function R() {
|
|
6758
|
-
const v = t.name("_valid"),
|
|
6759
|
-
O(v, () => t.if(v, () => T(
|
|
6757
|
+
const v = t.name("_valid"), y = t.let("count", 0);
|
|
6758
|
+
O(v, () => t.if(v, () => T(y)));
|
|
6760
6759
|
}
|
|
6761
|
-
function O(v,
|
|
6760
|
+
function O(v, y) {
|
|
6762
6761
|
t.forRange("i", 0, p, (m) => {
|
|
6763
6762
|
e.subschema({
|
|
6764
6763
|
keyword: "contains",
|
|
6765
6764
|
dataProp: m,
|
|
6766
6765
|
dataPropType: util_1$a.Type.Num,
|
|
6767
6766
|
compositeRule: !0
|
|
6768
|
-
}, v),
|
|
6767
|
+
}, v), y();
|
|
6769
6768
|
});
|
|
6770
6769
|
}
|
|
6771
6770
|
function T(v) {
|
|
6772
|
-
t.code((0, codegen_1$7._)`${v}++`), c === void 0 ? t.if((0, codegen_1$7._)`${v} >= ${o}`, () => t.assign(
|
|
6771
|
+
t.code((0, codegen_1$7._)`${v}++`), c === void 0 ? t.if((0, codegen_1$7._)`${v} >= ${o}`, () => t.assign(g, !0).break()) : (t.if((0, codegen_1$7._)`${v} > ${c}`, () => t.assign(g, !1).break()), o === 1 ? t.assign(g, !0) : t.if((0, codegen_1$7._)`${v} >= ${o}`, () => t.assign(g, !0)));
|
|
6773
6772
|
}
|
|
6774
6773
|
}
|
|
6775
6774
|
};
|
|
@@ -6780,11 +6779,11 @@ var dependencies = {};
|
|
|
6780
6779
|
const t = codegen, r = util, n = code;
|
|
6781
6780
|
e.error = {
|
|
6782
6781
|
message: ({ params: { property: d, depsCount: u, deps: p } }) => {
|
|
6783
|
-
const
|
|
6784
|
-
return (0, t.str)`must have ${
|
|
6782
|
+
const g = u === 1 ? "property" : "properties";
|
|
6783
|
+
return (0, t.str)`must have ${g} ${p} when property ${d} is present`;
|
|
6785
6784
|
},
|
|
6786
|
-
params: ({ params: { property: d, depsCount: u, deps: p, missingProperty:
|
|
6787
|
-
missingProperty: ${
|
|
6785
|
+
params: ({ params: { property: d, depsCount: u, deps: p, missingProperty: g } }) => (0, t._)`{property: ${d},
|
|
6786
|
+
missingProperty: ${g},
|
|
6788
6787
|
depsCount: ${u},
|
|
6789
6788
|
deps: ${p}}`
|
|
6790
6789
|
// TODO change to reference
|
|
@@ -6801,16 +6800,16 @@ var dependencies = {};
|
|
|
6801
6800
|
};
|
|
6802
6801
|
function i({ schema: d }) {
|
|
6803
6802
|
const u = {}, p = {};
|
|
6804
|
-
for (const
|
|
6805
|
-
if (
|
|
6803
|
+
for (const g in d) {
|
|
6804
|
+
if (g === "__proto__")
|
|
6806
6805
|
continue;
|
|
6807
|
-
const R = Array.isArray(d[
|
|
6808
|
-
R[
|
|
6806
|
+
const R = Array.isArray(d[g]) ? u : p;
|
|
6807
|
+
R[g] = d[g];
|
|
6809
6808
|
}
|
|
6810
6809
|
return [u, p];
|
|
6811
6810
|
}
|
|
6812
6811
|
function o(d, u = d.schema) {
|
|
6813
|
-
const { gen: p, data:
|
|
6812
|
+
const { gen: p, data: g, it: R } = d;
|
|
6814
6813
|
if (Object.keys(u).length === 0)
|
|
6815
6814
|
return;
|
|
6816
6815
|
const O = p.let("missing");
|
|
@@ -6818,26 +6817,26 @@ var dependencies = {};
|
|
|
6818
6817
|
const v = u[T];
|
|
6819
6818
|
if (v.length === 0)
|
|
6820
6819
|
continue;
|
|
6821
|
-
const
|
|
6820
|
+
const y = (0, n.propertyInData)(p, g, T, R.opts.ownProperties);
|
|
6822
6821
|
d.setParams({
|
|
6823
6822
|
property: T,
|
|
6824
6823
|
depsCount: v.length,
|
|
6825
6824
|
deps: v.join(", ")
|
|
6826
|
-
}), R.allErrors ? p.if(
|
|
6825
|
+
}), R.allErrors ? p.if(y, () => {
|
|
6827
6826
|
for (const m of v)
|
|
6828
6827
|
(0, n.checkReportMissingProp)(d, m);
|
|
6829
|
-
}) : (p.if((0, t._)`${
|
|
6828
|
+
}) : (p.if((0, t._)`${y} && (${(0, n.checkMissingProp)(d, v, O)})`), (0, n.reportMissingProp)(d, O), p.else());
|
|
6830
6829
|
}
|
|
6831
6830
|
}
|
|
6832
6831
|
e.validatePropertyDeps = o;
|
|
6833
6832
|
function c(d, u = d.schema) {
|
|
6834
|
-
const { gen: p, data:
|
|
6833
|
+
const { gen: p, data: g, keyword: R, it: O } = d, T = p.name("valid");
|
|
6835
6834
|
for (const v in u)
|
|
6836
6835
|
(0, r.alwaysValidSchema)(O, u[v]) || (p.if(
|
|
6837
|
-
(0, n.propertyInData)(p,
|
|
6836
|
+
(0, n.propertyInData)(p, g, v, O.opts.ownProperties),
|
|
6838
6837
|
() => {
|
|
6839
|
-
const
|
|
6840
|
-
d.mergeValidEvaluated(
|
|
6838
|
+
const y = d.subschema({ keyword: R, schemaProp: v }, T);
|
|
6839
|
+
d.mergeValidEvaluated(y, T);
|
|
6841
6840
|
},
|
|
6842
6841
|
() => p.var(T, !0)
|
|
6843
6842
|
// TODO var
|
|
@@ -6894,44 +6893,44 @@ const code_1$3 = code, codegen_1$5 = codegen, names_1 = names$1, util_1$8 = util
|
|
|
6894
6893
|
if (o.props = !0, d.removeAdditional !== "all" && (0, util_1$8.alwaysValidSchema)(o, r))
|
|
6895
6894
|
return;
|
|
6896
6895
|
const u = (0, code_1$3.allSchemaProperties)(n.properties), p = (0, code_1$3.allSchemaProperties)(n.patternProperties);
|
|
6897
|
-
|
|
6898
|
-
function
|
|
6899
|
-
t.forIn("key", s, (
|
|
6900
|
-
!u.length && !p.length ? T(
|
|
6896
|
+
g(), e.ok((0, codegen_1$5._)`${i} === ${names_1.default.errors}`);
|
|
6897
|
+
function g() {
|
|
6898
|
+
t.forIn("key", s, (y) => {
|
|
6899
|
+
!u.length && !p.length ? T(y) : t.if(R(y), () => T(y));
|
|
6901
6900
|
});
|
|
6902
6901
|
}
|
|
6903
|
-
function R(
|
|
6902
|
+
function R(y) {
|
|
6904
6903
|
let m;
|
|
6905
6904
|
if (u.length > 8) {
|
|
6906
6905
|
const k = (0, util_1$8.schemaRefOrVal)(o, n.properties, "properties");
|
|
6907
|
-
m = (0, code_1$3.isOwnProperty)(t, k,
|
|
6906
|
+
m = (0, code_1$3.isOwnProperty)(t, k, y);
|
|
6908
6907
|
} else
|
|
6909
|
-
u.length ? m = (0, codegen_1$5.or)(...u.map((k) => (0, codegen_1$5._)`${
|
|
6910
|
-
return p.length && (m = (0, codegen_1$5.or)(m, ...p.map((k) => (0, codegen_1$5._)`${(0, code_1$3.usePattern)(e, k)}.test(${
|
|
6908
|
+
u.length ? m = (0, codegen_1$5.or)(...u.map((k) => (0, codegen_1$5._)`${y} === ${k}`)) : m = codegen_1$5.nil;
|
|
6909
|
+
return p.length && (m = (0, codegen_1$5.or)(m, ...p.map((k) => (0, codegen_1$5._)`${(0, code_1$3.usePattern)(e, k)}.test(${y})`))), (0, codegen_1$5.not)(m);
|
|
6911
6910
|
}
|
|
6912
|
-
function O(
|
|
6913
|
-
t.code((0, codegen_1$5._)`delete ${s}[${
|
|
6911
|
+
function O(y) {
|
|
6912
|
+
t.code((0, codegen_1$5._)`delete ${s}[${y}]`);
|
|
6914
6913
|
}
|
|
6915
|
-
function T(
|
|
6914
|
+
function T(y) {
|
|
6916
6915
|
if (d.removeAdditional === "all" || d.removeAdditional && r === !1) {
|
|
6917
|
-
O(
|
|
6916
|
+
O(y);
|
|
6918
6917
|
return;
|
|
6919
6918
|
}
|
|
6920
6919
|
if (r === !1) {
|
|
6921
|
-
e.setParams({ additionalProperty:
|
|
6920
|
+
e.setParams({ additionalProperty: y }), e.error(), c || t.break();
|
|
6922
6921
|
return;
|
|
6923
6922
|
}
|
|
6924
6923
|
if (typeof r == "object" && !(0, util_1$8.alwaysValidSchema)(o, r)) {
|
|
6925
6924
|
const m = t.name("valid");
|
|
6926
|
-
d.removeAdditional === "failing" ? (v(
|
|
6927
|
-
e.reset(), O(
|
|
6928
|
-
})) : (v(
|
|
6925
|
+
d.removeAdditional === "failing" ? (v(y, m, !1), t.if((0, codegen_1$5.not)(m), () => {
|
|
6926
|
+
e.reset(), O(y);
|
|
6927
|
+
})) : (v(y, m), c || t.if((0, codegen_1$5.not)(m), () => t.break()));
|
|
6929
6928
|
}
|
|
6930
6929
|
}
|
|
6931
|
-
function v(
|
|
6930
|
+
function v(y, m, k) {
|
|
6932
6931
|
const S = {
|
|
6933
6932
|
keyword: "additionalProperties",
|
|
6934
|
-
dataProp:
|
|
6933
|
+
dataProp: y,
|
|
6935
6934
|
dataPropType: util_1$8.Type.Str
|
|
6936
6935
|
};
|
|
6937
6936
|
k === !1 && Object.assign(S, {
|
|
@@ -6953,23 +6952,23 @@ const validate_1 = validate, code_1$2 = code, util_1$7 = util, additionalPropert
|
|
|
6953
6952
|
const { gen: t, schema: r, parentSchema: n, data: s, it: i } = e;
|
|
6954
6953
|
i.opts.removeAdditional === "all" && n.additionalProperties === void 0 && additionalProperties_1$1.default.code(new validate_1.KeywordCxt(i, additionalProperties_1$1.default, "additionalProperties"));
|
|
6955
6954
|
const o = (0, code_1$2.allSchemaProperties)(r);
|
|
6956
|
-
for (const
|
|
6957
|
-
i.definedProperties.add(
|
|
6955
|
+
for (const g of o)
|
|
6956
|
+
i.definedProperties.add(g);
|
|
6958
6957
|
i.opts.unevaluated && o.length && i.props !== !0 && (i.props = util_1$7.mergeEvaluated.props(t, (0, util_1$7.toHash)(o), i.props));
|
|
6959
|
-
const c = o.filter((
|
|
6958
|
+
const c = o.filter((g) => !(0, util_1$7.alwaysValidSchema)(i, r[g]));
|
|
6960
6959
|
if (c.length === 0)
|
|
6961
6960
|
return;
|
|
6962
6961
|
const d = t.name("valid");
|
|
6963
|
-
for (const
|
|
6964
|
-
u(
|
|
6965
|
-
function u(
|
|
6966
|
-
return i.opts.useDefaults && !i.compositeRule && r[
|
|
6962
|
+
for (const g of c)
|
|
6963
|
+
u(g) ? p(g) : (t.if((0, code_1$2.propertyInData)(t, s, g, i.opts.ownProperties)), p(g), i.allErrors || t.else().var(d, !0), t.endIf()), e.it.definedProperties.add(g), e.ok(d);
|
|
6964
|
+
function u(g) {
|
|
6965
|
+
return i.opts.useDefaults && !i.compositeRule && r[g].default !== void 0;
|
|
6967
6966
|
}
|
|
6968
|
-
function p(
|
|
6967
|
+
function p(g) {
|
|
6969
6968
|
e.subschema({
|
|
6970
6969
|
keyword: "properties",
|
|
6971
|
-
schemaProp:
|
|
6972
|
-
dataProp:
|
|
6970
|
+
schemaProp: g,
|
|
6971
|
+
dataProp: g
|
|
6973
6972
|
}, d);
|
|
6974
6973
|
}
|
|
6975
6974
|
}
|
|
@@ -6987,26 +6986,26 @@ const code_1$1 = code, codegen_1$4 = codegen, util_1$6 = util, util_2 = util, de
|
|
|
6987
6986
|
return;
|
|
6988
6987
|
const u = o.strictSchema && !o.allowMatchingProperties && s.properties, p = t.name("valid");
|
|
6989
6988
|
i.props !== !0 && !(i.props instanceof codegen_1$4.Name) && (i.props = (0, util_2.evaluatedPropsToName)(t, i.props));
|
|
6990
|
-
const { props:
|
|
6989
|
+
const { props: g } = i;
|
|
6991
6990
|
R();
|
|
6992
6991
|
function R() {
|
|
6993
6992
|
for (const v of c)
|
|
6994
6993
|
u && O(v), i.allErrors ? T(v) : (t.var(p, !0), T(v), t.if(p));
|
|
6995
6994
|
}
|
|
6996
6995
|
function O(v) {
|
|
6997
|
-
for (const
|
|
6998
|
-
new RegExp(v).test(
|
|
6996
|
+
for (const y in u)
|
|
6997
|
+
new RegExp(v).test(y) && (0, util_1$6.checkStrictMode)(i, `property ${y} matches pattern ${v} (use allowMatchingProperties)`);
|
|
6999
6998
|
}
|
|
7000
6999
|
function T(v) {
|
|
7001
|
-
t.forIn("key", n, (
|
|
7002
|
-
t.if((0, codegen_1$4._)`${(0, code_1$1.usePattern)(e, v)}.test(${
|
|
7000
|
+
t.forIn("key", n, (y) => {
|
|
7001
|
+
t.if((0, codegen_1$4._)`${(0, code_1$1.usePattern)(e, v)}.test(${y})`, () => {
|
|
7003
7002
|
const m = d.includes(v);
|
|
7004
7003
|
m || e.subschema({
|
|
7005
7004
|
keyword: "patternProperties",
|
|
7006
7005
|
schemaProp: v,
|
|
7007
|
-
dataProp:
|
|
7006
|
+
dataProp: y,
|
|
7008
7007
|
dataPropType: util_2.Type.Str
|
|
7009
|
-
}, p), i.opts.unevaluated &&
|
|
7008
|
+
}, p), i.opts.unevaluated && g !== !0 ? t.assign((0, codegen_1$4._)`${g}[${y}]`, !0) : !m && !i.allErrors && t.if((0, codegen_1$4.not)(p), () => t.break());
|
|
7010
7009
|
});
|
|
7011
7010
|
});
|
|
7012
7011
|
}
|
|
@@ -7065,14 +7064,14 @@ const codegen_1$3 = codegen, util_1$4 = util, error$3 = {
|
|
|
7065
7064
|
const i = r, o = t.let("valid", !1), c = t.let("passing", null), d = t.name("_valid");
|
|
7066
7065
|
e.setParams({ passing: c }), t.block(u), e.result(o, () => e.reset(), () => e.error(!0));
|
|
7067
7066
|
function u() {
|
|
7068
|
-
i.forEach((p,
|
|
7067
|
+
i.forEach((p, g) => {
|
|
7069
7068
|
let R;
|
|
7070
7069
|
(0, util_1$4.alwaysValidSchema)(s, p) ? t.var(d, !0) : R = e.subschema({
|
|
7071
7070
|
keyword: "oneOf",
|
|
7072
|
-
schemaProp:
|
|
7071
|
+
schemaProp: g,
|
|
7073
7072
|
compositeRule: !0
|
|
7074
|
-
}, d),
|
|
7075
|
-
t.assign(o, !0), t.assign(c,
|
|
7073
|
+
}, d), g > 0 && t.if((0, codegen_1$3._)`${d} && ${o}`).assign(o, !1).assign(c, (0, codegen_1$3._)`[${c}, ${g}]`).else(), t.if(d, () => {
|
|
7074
|
+
t.assign(o, !0), t.assign(c, g), R && e.mergeEvaluated(R, codegen_1$3.Name);
|
|
7076
7075
|
});
|
|
7077
7076
|
});
|
|
7078
7077
|
}
|
|
@@ -7130,10 +7129,10 @@ const codegen_1$2 = codegen, util_1$2 = util, error$2 = {
|
|
|
7130
7129
|
}, c);
|
|
7131
7130
|
e.mergeEvaluated(p);
|
|
7132
7131
|
}
|
|
7133
|
-
function u(p,
|
|
7132
|
+
function u(p, g) {
|
|
7134
7133
|
return () => {
|
|
7135
7134
|
const R = e.subschema({ keyword: p }, c);
|
|
7136
|
-
t.assign(o, c), e.mergeValidEvaluated(R, o),
|
|
7135
|
+
t.assign(o, c), e.mergeValidEvaluated(R, o), g ? t.assign(g, (0, codegen_1$2._)`${p}`) : e.setParams({ ifClause: p });
|
|
7137
7136
|
};
|
|
7138
7137
|
}
|
|
7139
7138
|
}
|
|
@@ -7186,37 +7185,37 @@ const codegen_1$1 = codegen, error$1 = {
|
|
|
7186
7185
|
$data: !0,
|
|
7187
7186
|
error: error$1,
|
|
7188
7187
|
code(e, t) {
|
|
7189
|
-
const { gen: r, data: n, $data: s, schema: i, schemaCode: o, it: c } = e, { opts: d, errSchemaPath: u, schemaEnv: p, self:
|
|
7188
|
+
const { gen: r, data: n, $data: s, schema: i, schemaCode: o, it: c } = e, { opts: d, errSchemaPath: u, schemaEnv: p, self: g } = c;
|
|
7190
7189
|
if (!d.validateFormats)
|
|
7191
7190
|
return;
|
|
7192
7191
|
s ? R() : O();
|
|
7193
7192
|
function R() {
|
|
7194
7193
|
const T = r.scopeValue("formats", {
|
|
7195
|
-
ref:
|
|
7194
|
+
ref: g.formats,
|
|
7196
7195
|
code: d.code.formats
|
|
7197
|
-
}), v = r.const("fDef", (0, codegen_1$1._)`${T}[${o}]`),
|
|
7198
|
-
r.if((0, codegen_1$1._)`typeof ${v} == "object" && !(${v} instanceof RegExp)`, () => r.assign(
|
|
7196
|
+
}), v = r.const("fDef", (0, codegen_1$1._)`${T}[${o}]`), y = r.let("fType"), m = r.let("format");
|
|
7197
|
+
r.if((0, codegen_1$1._)`typeof ${v} == "object" && !(${v} instanceof RegExp)`, () => r.assign(y, (0, codegen_1$1._)`${v}.type || "string"`).assign(m, (0, codegen_1$1._)`${v}.validate`), () => r.assign(y, (0, codegen_1$1._)`"string"`).assign(m, v)), e.fail$data((0, codegen_1$1.or)(k(), S()));
|
|
7199
7198
|
function k() {
|
|
7200
7199
|
return d.strictSchema === !1 ? codegen_1$1.nil : (0, codegen_1$1._)`${o} && !${m}`;
|
|
7201
7200
|
}
|
|
7202
7201
|
function S() {
|
|
7203
7202
|
const I = p.$async ? (0, codegen_1$1._)`(${v}.async ? await ${m}(${n}) : ${m}(${n}))` : (0, codegen_1$1._)`${m}(${n})`, D = (0, codegen_1$1._)`(typeof ${m} == "function" ? ${I} : ${m}.test(${n}))`;
|
|
7204
|
-
return (0, codegen_1$1._)`${m} && ${m} !== true && ${
|
|
7203
|
+
return (0, codegen_1$1._)`${m} && ${m} !== true && ${y} === ${t} && !${D}`;
|
|
7205
7204
|
}
|
|
7206
7205
|
}
|
|
7207
7206
|
function O() {
|
|
7208
|
-
const T =
|
|
7207
|
+
const T = g.formats[i];
|
|
7209
7208
|
if (!T) {
|
|
7210
7209
|
k();
|
|
7211
7210
|
return;
|
|
7212
7211
|
}
|
|
7213
7212
|
if (T === !0)
|
|
7214
7213
|
return;
|
|
7215
|
-
const [v,
|
|
7214
|
+
const [v, y, m] = S(T);
|
|
7216
7215
|
v === t && e.pass(I());
|
|
7217
7216
|
function k() {
|
|
7218
7217
|
if (d.strictSchema === !1) {
|
|
7219
|
-
|
|
7218
|
+
g.logger.warn(D());
|
|
7220
7219
|
return;
|
|
7221
7220
|
}
|
|
7222
7221
|
throw new Error(D());
|
|
@@ -7234,7 +7233,7 @@ const codegen_1$1 = codegen, error$1 = {
|
|
|
7234
7233
|
throw new Error("async format in sync schema");
|
|
7235
7234
|
return (0, codegen_1$1._)`await ${m}(${n})`;
|
|
7236
7235
|
}
|
|
7237
|
-
return typeof
|
|
7236
|
+
return typeof y == "function" ? (0, codegen_1$1._)`${m}(${n})` : (0, codegen_1$1._)`${m}.test(${n})`;
|
|
7238
7237
|
}
|
|
7239
7238
|
}
|
|
7240
7239
|
}
|
|
@@ -7302,26 +7301,26 @@ const codegen_1 = codegen, types_1 = types, compile_1 = compile, util_1 = util,
|
|
|
7302
7301
|
const O = R();
|
|
7303
7302
|
t.if(!1);
|
|
7304
7303
|
for (const T in O)
|
|
7305
|
-
t.elseIf((0, codegen_1._)`${u} === ${T}`), t.assign(d,
|
|
7304
|
+
t.elseIf((0, codegen_1._)`${u} === ${T}`), t.assign(d, g(O[T]));
|
|
7306
7305
|
t.else(), e.error(!1, { discrError: types_1.DiscrError.Mapping, tag: u, tagName: c }), t.endIf();
|
|
7307
7306
|
}
|
|
7308
|
-
function
|
|
7307
|
+
function g(O) {
|
|
7309
7308
|
const T = t.name("valid"), v = e.subschema({ keyword: "oneOf", schemaProp: O }, T);
|
|
7310
7309
|
return e.mergeEvaluated(v, codegen_1.Name), T;
|
|
7311
7310
|
}
|
|
7312
7311
|
function R() {
|
|
7313
7312
|
var O;
|
|
7314
7313
|
const T = {}, v = m(s);
|
|
7315
|
-
let
|
|
7314
|
+
let y = !0;
|
|
7316
7315
|
for (let I = 0; I < o.length; I++) {
|
|
7317
7316
|
let D = o[I];
|
|
7318
7317
|
D != null && D.$ref && !(0, util_1.schemaHasRulesButRef)(D, i.self.RULES) && (D = compile_1.resolveRef.call(i.self, i.schemaEnv.root, i.baseId, D == null ? void 0 : D.$ref), D instanceof compile_1.SchemaEnv && (D = D.schema));
|
|
7319
7318
|
const w = (O = D == null ? void 0 : D.properties) === null || O === void 0 ? void 0 : O[c];
|
|
7320
7319
|
if (typeof w != "object")
|
|
7321
7320
|
throw new Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${c}"`);
|
|
7322
|
-
|
|
7321
|
+
y = y && (v || m(D)), k(w, I);
|
|
7323
7322
|
}
|
|
7324
|
-
if (
|
|
7323
|
+
if (!y)
|
|
7325
7324
|
throw new Error(`discriminator: "${c}" must be required`);
|
|
7326
7325
|
return T;
|
|
7327
7326
|
function m({ required: I }) {
|
|
@@ -7622,9 +7621,9 @@ const $schema$1 = "http://json-schema.org/draft-07/schema#", $id = "http://json-
|
|
|
7622
7621
|
} }), Object.defineProperty(t, "CodeGen", { enumerable: !0, get: function() {
|
|
7623
7622
|
return p.CodeGen;
|
|
7624
7623
|
} });
|
|
7625
|
-
var
|
|
7624
|
+
var g = validation_error;
|
|
7626
7625
|
Object.defineProperty(t, "ValidationError", { enumerable: !0, get: function() {
|
|
7627
|
-
return
|
|
7626
|
+
return g.default;
|
|
7628
7627
|
} });
|
|
7629
7628
|
var R = ref_error;
|
|
7630
7629
|
Object.defineProperty(t, "MissingRefError", { enumerable: !0, get: function() {
|
|
@@ -7642,7 +7641,38 @@ const Ajv = /* @__PURE__ */ getDefaultExportFromCjs(ajvExports), $schema = "http
|
|
|
7642
7641
|
},
|
|
7643
7642
|
description: {
|
|
7644
7643
|
type: "string",
|
|
7645
|
-
description: "Optional description. It doesn't do anything but is exposed as a courtesy to developers who may want to document which blueprint file does what."
|
|
7644
|
+
description: "Optional description. It doesn't do anything but is exposed as a courtesy to developers who may want to document which blueprint file does what.",
|
|
7645
|
+
deprecated: "Use meta.description instead."
|
|
7646
|
+
},
|
|
7647
|
+
meta: {
|
|
7648
|
+
type: "object",
|
|
7649
|
+
properties: {
|
|
7650
|
+
title: {
|
|
7651
|
+
type: "string",
|
|
7652
|
+
description: "A clear and concise name for your Blueprint."
|
|
7653
|
+
},
|
|
7654
|
+
description: {
|
|
7655
|
+
type: "string",
|
|
7656
|
+
description: "A brief explanation of what your Blueprint offers."
|
|
7657
|
+
},
|
|
7658
|
+
author: {
|
|
7659
|
+
type: "string",
|
|
7660
|
+
description: "A GitHub username of the author of this Blueprint."
|
|
7661
|
+
},
|
|
7662
|
+
categories: {
|
|
7663
|
+
type: "array",
|
|
7664
|
+
items: {
|
|
7665
|
+
type: "string"
|
|
7666
|
+
},
|
|
7667
|
+
description: "Relevant categories to help users find your Blueprint in the future Blueprints section on WordPress.org."
|
|
7668
|
+
}
|
|
7669
|
+
},
|
|
7670
|
+
required: [
|
|
7671
|
+
"title",
|
|
7672
|
+
"author"
|
|
7673
|
+
],
|
|
7674
|
+
additionalProperties: !1,
|
|
7675
|
+
description: "Optional metadata. Used by the Blueprints gallery at https://github.com/WordPress/blueprints"
|
|
7646
7676
|
},
|
|
7647
7677
|
preferredVersions: {
|
|
7648
7678
|
type: "object",
|
|
@@ -8919,46 +8949,129 @@ for existing apps using this option.`
|
|
|
8919
8949
|
$ref: "#/definitions/PHPRequestHeaders",
|
|
8920
8950
|
description: "Request headers."
|
|
8921
8951
|
},
|
|
8922
|
-
|
|
8923
|
-
|
|
8924
|
-
|
|
8925
|
-
|
|
8926
|
-
|
|
8927
|
-
|
|
8928
|
-
|
|
8929
|
-
|
|
8930
|
-
|
|
8931
|
-
|
|
8952
|
+
body: {
|
|
8953
|
+
anyOf: [
|
|
8954
|
+
{
|
|
8955
|
+
type: "string"
|
|
8956
|
+
},
|
|
8957
|
+
{
|
|
8958
|
+
type: "object",
|
|
8959
|
+
properties: {
|
|
8960
|
+
BYTES_PER_ELEMENT: {
|
|
8961
|
+
type: "number"
|
|
8962
|
+
},
|
|
8963
|
+
buffer: {
|
|
8964
|
+
type: "object",
|
|
8965
|
+
properties: {
|
|
8966
|
+
byteLength: {
|
|
8967
|
+
type: "number"
|
|
8968
|
+
}
|
|
8969
|
+
},
|
|
8970
|
+
required: [
|
|
8971
|
+
"byteLength"
|
|
8972
|
+
],
|
|
8973
|
+
additionalProperties: !1
|
|
8974
|
+
},
|
|
8975
|
+
byteLength: {
|
|
8976
|
+
type: "number"
|
|
8977
|
+
},
|
|
8978
|
+
byteOffset: {
|
|
8979
|
+
type: "number"
|
|
8980
|
+
},
|
|
8981
|
+
length: {
|
|
8982
|
+
type: "number"
|
|
8983
|
+
}
|
|
8932
8984
|
},
|
|
8933
|
-
|
|
8985
|
+
required: [
|
|
8986
|
+
"BYTES_PER_ELEMENT",
|
|
8987
|
+
"buffer",
|
|
8988
|
+
"byteLength",
|
|
8989
|
+
"byteOffset",
|
|
8990
|
+
"length"
|
|
8991
|
+
],
|
|
8992
|
+
additionalProperties: {
|
|
8934
8993
|
type: "number"
|
|
8935
|
-
},
|
|
8936
|
-
name: {
|
|
8937
|
-
type: "string"
|
|
8938
|
-
},
|
|
8939
|
-
webkitRelativePath: {
|
|
8940
|
-
type: "string"
|
|
8941
8994
|
}
|
|
8942
8995
|
},
|
|
8943
|
-
|
|
8944
|
-
"
|
|
8945
|
-
|
|
8946
|
-
|
|
8947
|
-
|
|
8948
|
-
|
|
8949
|
-
|
|
8950
|
-
|
|
8951
|
-
|
|
8952
|
-
|
|
8953
|
-
|
|
8954
|
-
|
|
8955
|
-
|
|
8956
|
-
|
|
8957
|
-
|
|
8958
|
-
|
|
8959
|
-
|
|
8960
|
-
|
|
8961
|
-
|
|
8996
|
+
{
|
|
8997
|
+
type: "object",
|
|
8998
|
+
additionalProperties: {
|
|
8999
|
+
anyOf: [
|
|
9000
|
+
{
|
|
9001
|
+
type: "string"
|
|
9002
|
+
},
|
|
9003
|
+
{
|
|
9004
|
+
type: "object",
|
|
9005
|
+
properties: {
|
|
9006
|
+
BYTES_PER_ELEMENT: {
|
|
9007
|
+
type: "number"
|
|
9008
|
+
},
|
|
9009
|
+
buffer: {
|
|
9010
|
+
type: "object",
|
|
9011
|
+
properties: {
|
|
9012
|
+
byteLength: {
|
|
9013
|
+
type: "number"
|
|
9014
|
+
}
|
|
9015
|
+
},
|
|
9016
|
+
required: [
|
|
9017
|
+
"byteLength"
|
|
9018
|
+
],
|
|
9019
|
+
additionalProperties: !1
|
|
9020
|
+
},
|
|
9021
|
+
byteLength: {
|
|
9022
|
+
type: "number"
|
|
9023
|
+
},
|
|
9024
|
+
byteOffset: {
|
|
9025
|
+
type: "number"
|
|
9026
|
+
},
|
|
9027
|
+
length: {
|
|
9028
|
+
type: "number"
|
|
9029
|
+
}
|
|
9030
|
+
},
|
|
9031
|
+
required: [
|
|
9032
|
+
"BYTES_PER_ELEMENT",
|
|
9033
|
+
"buffer",
|
|
9034
|
+
"byteLength",
|
|
9035
|
+
"byteOffset",
|
|
9036
|
+
"length"
|
|
9037
|
+
],
|
|
9038
|
+
additionalProperties: {
|
|
9039
|
+
type: "number"
|
|
9040
|
+
}
|
|
9041
|
+
},
|
|
9042
|
+
{
|
|
9043
|
+
type: "object",
|
|
9044
|
+
properties: {
|
|
9045
|
+
size: {
|
|
9046
|
+
type: "number"
|
|
9047
|
+
},
|
|
9048
|
+
type: {
|
|
9049
|
+
type: "string"
|
|
9050
|
+
},
|
|
9051
|
+
lastModified: {
|
|
9052
|
+
type: "number"
|
|
9053
|
+
},
|
|
9054
|
+
name: {
|
|
9055
|
+
type: "string"
|
|
9056
|
+
},
|
|
9057
|
+
webkitRelativePath: {
|
|
9058
|
+
type: "string"
|
|
9059
|
+
}
|
|
9060
|
+
},
|
|
9061
|
+
required: [
|
|
9062
|
+
"lastModified",
|
|
9063
|
+
"name",
|
|
9064
|
+
"size",
|
|
9065
|
+
"type",
|
|
9066
|
+
"webkitRelativePath"
|
|
9067
|
+
],
|
|
9068
|
+
additionalProperties: !1
|
|
9069
|
+
}
|
|
9070
|
+
]
|
|
9071
|
+
}
|
|
9072
|
+
}
|
|
9073
|
+
],
|
|
9074
|
+
description: "Request body. If an object is given, the request will be encoded as multipart and sent with a `multipart/form-data` header."
|
|
8962
9075
|
}
|
|
8963
9076
|
},
|
|
8964
9077
|
required: [
|
|
@@ -9008,85 +9121,64 @@ for existing apps using this option.`
|
|
|
9008
9121
|
description: "Request headers."
|
|
9009
9122
|
},
|
|
9010
9123
|
body: {
|
|
9011
|
-
|
|
9012
|
-
|
|
9013
|
-
|
|
9014
|
-
fileInfos: {
|
|
9015
|
-
type: "array",
|
|
9016
|
-
items: {
|
|
9017
|
-
$ref: "#/definitions/FileInfo"
|
|
9018
|
-
},
|
|
9019
|
-
description: "Uploaded files."
|
|
9020
|
-
},
|
|
9021
|
-
code: {
|
|
9022
|
-
type: "string",
|
|
9023
|
-
description: "The code snippet to eval instead of a php file."
|
|
9024
|
-
},
|
|
9025
|
-
throwOnError: {
|
|
9026
|
-
type: "boolean",
|
|
9027
|
-
description: "Whether to throw an error if the PHP process exits with a non-zero code or outputs to stderr."
|
|
9028
|
-
}
|
|
9029
|
-
},
|
|
9030
|
-
additionalProperties: !1
|
|
9031
|
-
},
|
|
9032
|
-
FileInfo: {
|
|
9033
|
-
type: "object",
|
|
9034
|
-
properties: {
|
|
9035
|
-
key: {
|
|
9036
|
-
type: "string"
|
|
9037
|
-
},
|
|
9038
|
-
name: {
|
|
9039
|
-
type: "string"
|
|
9040
|
-
},
|
|
9041
|
-
type: {
|
|
9042
|
-
type: "string"
|
|
9043
|
-
},
|
|
9044
|
-
data: {
|
|
9045
|
-
type: "object",
|
|
9046
|
-
properties: {
|
|
9047
|
-
BYTES_PER_ELEMENT: {
|
|
9048
|
-
type: "number"
|
|
9124
|
+
anyOf: [
|
|
9125
|
+
{
|
|
9126
|
+
type: "string"
|
|
9049
9127
|
},
|
|
9050
|
-
|
|
9128
|
+
{
|
|
9051
9129
|
type: "object",
|
|
9052
9130
|
properties: {
|
|
9131
|
+
BYTES_PER_ELEMENT: {
|
|
9132
|
+
type: "number"
|
|
9133
|
+
},
|
|
9134
|
+
buffer: {
|
|
9135
|
+
type: "object",
|
|
9136
|
+
properties: {
|
|
9137
|
+
byteLength: {
|
|
9138
|
+
type: "number"
|
|
9139
|
+
}
|
|
9140
|
+
},
|
|
9141
|
+
required: [
|
|
9142
|
+
"byteLength"
|
|
9143
|
+
],
|
|
9144
|
+
additionalProperties: !1
|
|
9145
|
+
},
|
|
9053
9146
|
byteLength: {
|
|
9054
9147
|
type: "number"
|
|
9148
|
+
},
|
|
9149
|
+
byteOffset: {
|
|
9150
|
+
type: "number"
|
|
9151
|
+
},
|
|
9152
|
+
length: {
|
|
9153
|
+
type: "number"
|
|
9055
9154
|
}
|
|
9056
9155
|
},
|
|
9057
9156
|
required: [
|
|
9058
|
-
"
|
|
9157
|
+
"BYTES_PER_ELEMENT",
|
|
9158
|
+
"buffer",
|
|
9159
|
+
"byteLength",
|
|
9160
|
+
"byteOffset",
|
|
9161
|
+
"length"
|
|
9059
9162
|
],
|
|
9060
|
-
additionalProperties:
|
|
9061
|
-
|
|
9062
|
-
|
|
9063
|
-
type: "number"
|
|
9064
|
-
},
|
|
9065
|
-
byteOffset: {
|
|
9066
|
-
type: "number"
|
|
9067
|
-
},
|
|
9068
|
-
length: {
|
|
9069
|
-
type: "number"
|
|
9163
|
+
additionalProperties: {
|
|
9164
|
+
type: "number"
|
|
9165
|
+
}
|
|
9070
9166
|
}
|
|
9071
|
-
},
|
|
9072
|
-
required: [
|
|
9073
|
-
"BYTES_PER_ELEMENT",
|
|
9074
|
-
"buffer",
|
|
9075
|
-
"byteLength",
|
|
9076
|
-
"byteOffset",
|
|
9077
|
-
"length"
|
|
9078
9167
|
],
|
|
9168
|
+
description: "Request body."
|
|
9169
|
+
},
|
|
9170
|
+
env: {
|
|
9171
|
+
type: "object",
|
|
9079
9172
|
additionalProperties: {
|
|
9080
|
-
type: "
|
|
9081
|
-
}
|
|
9173
|
+
type: "string"
|
|
9174
|
+
},
|
|
9175
|
+
description: "Environment variables to set for this run."
|
|
9176
|
+
},
|
|
9177
|
+
code: {
|
|
9178
|
+
type: "string",
|
|
9179
|
+
description: "The code snippet to eval instead of a php file."
|
|
9082
9180
|
}
|
|
9083
9181
|
},
|
|
9084
|
-
required: [
|
|
9085
|
-
"key",
|
|
9086
|
-
"name",
|
|
9087
|
-
"type",
|
|
9088
|
-
"data"
|
|
9089
|
-
],
|
|
9090
9182
|
additionalProperties: !1
|
|
9091
9183
|
},
|
|
9092
9184
|
WordPressInstallationOptions: {
|
|
@@ -9115,7 +9207,7 @@ function compileBlueprint(e, {
|
|
|
9115
9207
|
onStepCompleted: n = () => {
|
|
9116
9208
|
}
|
|
9117
9209
|
} = {}) {
|
|
9118
|
-
var p,
|
|
9210
|
+
var p, g, R, O, T;
|
|
9119
9211
|
if (e = {
|
|
9120
9212
|
...e,
|
|
9121
9213
|
steps: (e.steps || []).filter(isStepDefinition)
|
|
@@ -9126,15 +9218,15 @@ function compileBlueprint(e, {
|
|
|
9126
9218
|
step: "setSiteOptions",
|
|
9127
9219
|
options: e.siteOptions
|
|
9128
9220
|
}), e.plugins) {
|
|
9129
|
-
const v = e.plugins.map((
|
|
9221
|
+
const v = e.plugins.map((y) => typeof y == "string" ? y.startsWith("https://") ? {
|
|
9130
9222
|
resource: "url",
|
|
9131
|
-
url:
|
|
9223
|
+
url: y
|
|
9132
9224
|
} : {
|
|
9133
9225
|
resource: "wordpress.org/plugins",
|
|
9134
|
-
slug:
|
|
9135
|
-
} :
|
|
9226
|
+
slug: y
|
|
9227
|
+
} : y).map((y) => ({
|
|
9136
9228
|
step: "installPlugin",
|
|
9137
|
-
pluginZipFile:
|
|
9229
|
+
pluginZipFile: y
|
|
9138
9230
|
}));
|
|
9139
9231
|
e.steps.unshift(...v);
|
|
9140
9232
|
}
|
|
@@ -9147,7 +9239,7 @@ function compileBlueprint(e, {
|
|
|
9147
9239
|
);
|
|
9148
9240
|
s !== void 0 && s > -1 && (e.phpExtensionBundles || (e.phpExtensionBundles = []), e.phpExtensionBundles.includes("kitchen-sink") || (e.phpExtensionBundles.push("kitchen-sink"), console.warn(
|
|
9149
9241
|
"The WP-CLI 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. "
|
|
9150
|
-
)), (
|
|
9242
|
+
)), (g = e.steps) == null || g.splice(s, 0, {
|
|
9151
9243
|
step: "writeFile",
|
|
9152
9244
|
data: {
|
|
9153
9245
|
resource: "url",
|
|
@@ -9173,9 +9265,9 @@ function compileBlueprint(e, {
|
|
|
9173
9265
|
throw v.errors = o, v;
|
|
9174
9266
|
}
|
|
9175
9267
|
const c = e.steps || [], d = c.reduce(
|
|
9176
|
-
(v,
|
|
9268
|
+
(v, y) => {
|
|
9177
9269
|
var m;
|
|
9178
|
-
return v + (((m =
|
|
9270
|
+
return v + (((m = y.progress) == null ? void 0 : m.weight) || 1);
|
|
9179
9271
|
},
|
|
9180
9272
|
0
|
|
9181
9273
|
), u = c.map(
|
|
@@ -9204,16 +9296,16 @@ function compileBlueprint(e, {
|
|
|
9204
9296
|
},
|
|
9205
9297
|
run: async (v) => {
|
|
9206
9298
|
try {
|
|
9207
|
-
for (const { resources:
|
|
9208
|
-
for (const m of
|
|
9299
|
+
for (const { resources: y } of u)
|
|
9300
|
+
for (const m of y)
|
|
9209
9301
|
m.setPlayground(v), m.isAsync && m.resolve();
|
|
9210
|
-
for (const [
|
|
9302
|
+
for (const [y, { run: m, step: k }] of Object.entries(u))
|
|
9211
9303
|
try {
|
|
9212
9304
|
const S = await m(v);
|
|
9213
9305
|
n(S, k);
|
|
9214
9306
|
} catch (S) {
|
|
9215
9307
|
throw console.error(S), new Error(
|
|
9216
|
-
`Error when executing the blueprint step #${
|
|
9308
|
+
`Error when executing the blueprint step #${y} (${JSON.stringify(
|
|
9217
9309
|
k
|
|
9218
9310
|
)}) ${S instanceof Error ? `: ${S.message}` : S}`,
|
|
9219
9311
|
{ cause: S }
|
|
@@ -9273,17 +9365,17 @@ function compileStep(e, {
|
|
|
9273
9365
|
const s = r.stage(
|
|
9274
9366
|
(((p = e.progress) == null ? void 0 : p.weight) || 1) / n
|
|
9275
9367
|
), i = {};
|
|
9276
|
-
for (const
|
|
9277
|
-
let R = e[
|
|
9368
|
+
for (const g of Object.keys(e)) {
|
|
9369
|
+
let R = e[g];
|
|
9278
9370
|
isFileReference(R) && (R = Resource.create(R, {
|
|
9279
9371
|
semaphore: t
|
|
9280
|
-
})), i[
|
|
9372
|
+
})), i[g] = R;
|
|
9281
9373
|
}
|
|
9282
|
-
const o = async (
|
|
9374
|
+
const o = async (g) => {
|
|
9283
9375
|
var R;
|
|
9284
9376
|
try {
|
|
9285
9377
|
return s.fillSlowly(), await keyedStepHandlers[e.step](
|
|
9286
|
-
|
|
9378
|
+
g,
|
|
9287
9379
|
await resolveArguments(i),
|
|
9288
9380
|
{
|
|
9289
9381
|
tracker: s,
|
|
@@ -9294,10 +9386,10 @@ function compileStep(e, {
|
|
|
9294
9386
|
s.finish();
|
|
9295
9387
|
}
|
|
9296
9388
|
}, c = getResources(i), d = getResources(i).filter(
|
|
9297
|
-
(
|
|
9389
|
+
(g) => g.isAsync
|
|
9298
9390
|
), u = 1 / (d.length + 1);
|
|
9299
|
-
for (const
|
|
9300
|
-
|
|
9391
|
+
for (const g of d)
|
|
9392
|
+
g.progress = s.stage(u);
|
|
9301
9393
|
return { run: o, step: e, resources: c };
|
|
9302
9394
|
}
|
|
9303
9395
|
function getResources(e) {
|
|
@@ -9372,20 +9464,20 @@ function expose(e, t = globalThis, r = ["*"]) {
|
|
|
9372
9464
|
const { id: i, type: o, path: c } = Object.assign({ path: [] }, s.data), d = (s.data.argumentList || []).map(fromWireValue);
|
|
9373
9465
|
let u;
|
|
9374
9466
|
try {
|
|
9375
|
-
const p = c.slice(0, -1).reduce((R, O) => R[O], e),
|
|
9467
|
+
const p = c.slice(0, -1).reduce((R, O) => R[O], e), g = c.reduce((R, O) => R[O], e);
|
|
9376
9468
|
switch (o) {
|
|
9377
9469
|
case "GET":
|
|
9378
|
-
u =
|
|
9470
|
+
u = g;
|
|
9379
9471
|
break;
|
|
9380
9472
|
case "SET":
|
|
9381
9473
|
p[c.slice(-1)[0]] = fromWireValue(s.data.value), u = !0;
|
|
9382
9474
|
break;
|
|
9383
9475
|
case "APPLY":
|
|
9384
|
-
u =
|
|
9476
|
+
u = g.apply(p, d);
|
|
9385
9477
|
break;
|
|
9386
9478
|
case "CONSTRUCT":
|
|
9387
9479
|
{
|
|
9388
|
-
const R = new
|
|
9480
|
+
const R = new g(...d);
|
|
9389
9481
|
u = proxy(R);
|
|
9390
9482
|
}
|
|
9391
9483
|
break;
|
|
@@ -9405,14 +9497,14 @@ function expose(e, t = globalThis, r = ["*"]) {
|
|
|
9405
9497
|
u = { value: p, [throwMarker]: 0 };
|
|
9406
9498
|
}
|
|
9407
9499
|
Promise.resolve(u).catch((p) => ({ value: p, [throwMarker]: 0 })).then((p) => {
|
|
9408
|
-
const [
|
|
9409
|
-
t.postMessage(Object.assign(Object.assign({},
|
|
9500
|
+
const [g, R] = toWireValue(p);
|
|
9501
|
+
t.postMessage(Object.assign(Object.assign({}, g), { id: i }), R), o === "RELEASE" && (t.removeEventListener("message", n), closeEndPoint(t), finalizer in e && typeof e[finalizer] == "function" && e[finalizer]());
|
|
9410
9502
|
}).catch((p) => {
|
|
9411
|
-
const [
|
|
9503
|
+
const [g, R] = toWireValue({
|
|
9412
9504
|
value: new TypeError("Unserializable return value"),
|
|
9413
9505
|
[throwMarker]: 0
|
|
9414
9506
|
});
|
|
9415
|
-
t.postMessage(Object.assign(Object.assign({},
|
|
9507
|
+
t.postMessage(Object.assign(Object.assign({}, g), { id: i }), R);
|
|
9416
9508
|
});
|
|
9417
9509
|
}), t.start && t.start();
|
|
9418
9510
|
}
|
|
@@ -9488,7 +9580,7 @@ function createProxy(e, t = [], r = function() {
|
|
|
9488
9580
|
const [u, p] = processArguments(c);
|
|
9489
9581
|
return requestResponseMessage(e, {
|
|
9490
9582
|
type: "APPLY",
|
|
9491
|
-
path: t.map((
|
|
9583
|
+
path: t.map((g) => g.toString()),
|
|
9492
9584
|
argumentList: u
|
|
9493
9585
|
}, p).then(fromWireValue);
|
|
9494
9586
|
},
|
|
@@ -9633,9 +9725,9 @@ function proxyClone(e) {
|
|
|
9633
9725
|
}
|
|
9634
9726
|
});
|
|
9635
9727
|
}
|
|
9636
|
-
class Logger {
|
|
9728
|
+
class Logger extends EventTarget {
|
|
9637
9729
|
constructor(t) {
|
|
9638
|
-
this.
|
|
9730
|
+
super(), this.fatalErrorEvent = "playground-fatal-error", this.logs = [], this.windowConnected = !1, this.lastPHPLogLength = 0, this.errorLogPath = "/wordpress/wp-content/debug.log", t && (this.errorLogPath = t);
|
|
9639
9731
|
}
|
|
9640
9732
|
/**
|
|
9641
9733
|
* Read the WordPress debug.log file and return its content.
|
|
@@ -9654,7 +9746,7 @@ class Logger {
|
|
|
9654
9746
|
logWindowError(t) {
|
|
9655
9747
|
this.log(
|
|
9656
9748
|
`${t.message} in ${t.filename} on line ${t.lineno}:${t.colno}`,
|
|
9657
|
-
"
|
|
9749
|
+
"Error"
|
|
9658
9750
|
);
|
|
9659
9751
|
}
|
|
9660
9752
|
/**
|
|
@@ -9663,7 +9755,10 @@ class Logger {
|
|
|
9663
9755
|
* @param PromiseRejectionEvent event
|
|
9664
9756
|
*/
|
|
9665
9757
|
logUnhandledRejection(t) {
|
|
9666
|
-
|
|
9758
|
+
if (!(t != null && t.reason))
|
|
9759
|
+
return;
|
|
9760
|
+
const r = (t == null ? void 0 : t.reason.stack) ?? t.reason;
|
|
9761
|
+
this.log(r, "Error");
|
|
9667
9762
|
}
|
|
9668
9763
|
/**
|
|
9669
9764
|
* Register a listener for the window error events and log the data.
|
|
@@ -9685,6 +9780,19 @@ class Logger {
|
|
|
9685
9780
|
t.addEventListener("request.end", async () => {
|
|
9686
9781
|
const r = await this.getRequestPhpErrorLog(t);
|
|
9687
9782
|
r.length > this.lastPHPLogLength && (this.logRaw(r.substring(this.lastPHPLogLength)), this.lastPHPLogLength = r.length);
|
|
9783
|
+
}), t.addEventListener("request.error", (r) => {
|
|
9784
|
+
r = r, r.error && (this.log(
|
|
9785
|
+
`${r.error.message} ${r.error.stack}`,
|
|
9786
|
+
"Fatal",
|
|
9787
|
+
"PHP-WASM"
|
|
9788
|
+
), this.dispatchEvent(
|
|
9789
|
+
new CustomEvent(this.fatalErrorEvent, {
|
|
9790
|
+
detail: {
|
|
9791
|
+
logs: this.getLogs(),
|
|
9792
|
+
source: r.source
|
|
9793
|
+
}
|
|
9794
|
+
})
|
|
9795
|
+
));
|
|
9688
9796
|
});
|
|
9689
9797
|
}
|
|
9690
9798
|
/**
|
|
@@ -9713,26 +9821,39 @@ class Logger {
|
|
|
9713
9821
|
* Format log message and severity and log it.
|
|
9714
9822
|
* @param string message
|
|
9715
9823
|
* @param LogSeverity severity
|
|
9824
|
+
* @param string prefix
|
|
9716
9825
|
*/
|
|
9717
|
-
formatMessage(t, r) {
|
|
9718
|
-
return `[${this.formatLogDate(/* @__PURE__ */ new Date())}] ${
|
|
9826
|
+
formatMessage(t, r, n) {
|
|
9827
|
+
return `[${this.formatLogDate(/* @__PURE__ */ new Date())}] ${n} ${r}: ${t}`;
|
|
9719
9828
|
}
|
|
9720
9829
|
/**
|
|
9721
9830
|
* Log message with severity and timestamp.
|
|
9722
9831
|
* @param string message
|
|
9723
9832
|
* @param LogSeverity severity
|
|
9833
|
+
* @param string prefix
|
|
9724
9834
|
*/
|
|
9725
|
-
log(t, r) {
|
|
9726
|
-
r === void 0 && (r = "
|
|
9727
|
-
const
|
|
9728
|
-
|
|
9835
|
+
log(t, r, n) {
|
|
9836
|
+
r === void 0 && (r = "Info");
|
|
9837
|
+
const s = this.formatMessage(
|
|
9838
|
+
t,
|
|
9839
|
+
r,
|
|
9840
|
+
n ?? "Playground"
|
|
9841
|
+
);
|
|
9842
|
+
this.logRaw(s);
|
|
9729
9843
|
}
|
|
9730
9844
|
/**
|
|
9731
9845
|
* Log message without severity and timestamp.
|
|
9732
9846
|
* @param string log
|
|
9733
9847
|
*/
|
|
9734
9848
|
logRaw(t) {
|
|
9735
|
-
console.debug(t);
|
|
9849
|
+
this.logs.push(t), console.debug(t);
|
|
9850
|
+
}
|
|
9851
|
+
/**
|
|
9852
|
+
* Get all logs.
|
|
9853
|
+
* @returns string[]
|
|
9854
|
+
*/
|
|
9855
|
+
getLogs() {
|
|
9856
|
+
return this.logs;
|
|
9736
9857
|
}
|
|
9737
9858
|
}
|
|
9738
9859
|
const logger = new Logger();
|
|
@@ -9746,27 +9867,35 @@ async function startPlaygroundWeb({
|
|
|
9746
9867
|
progressTracker: n = new ProgressTracker(),
|
|
9747
9868
|
disableProgressBar: s,
|
|
9748
9869
|
onBlueprintStepCompleted: i,
|
|
9749
|
-
|
|
9870
|
+
onClientConnected: o = () => {
|
|
9871
|
+
},
|
|
9872
|
+
sapiName: c
|
|
9750
9873
|
}) {
|
|
9751
9874
|
if (assertValidRemote(r), allowStorageAccessByUserActivation(e), r = setQueryParams(r, {
|
|
9752
9875
|
progressbar: !s
|
|
9753
|
-
}), n.setCaption("Preparing WordPress"), !t)
|
|
9754
|
-
|
|
9755
|
-
|
|
9876
|
+
}), n.setCaption("Preparing WordPress"), !t) {
|
|
9877
|
+
const p = await doStartPlaygroundWeb(
|
|
9878
|
+
e,
|
|
9879
|
+
r,
|
|
9880
|
+
n
|
|
9881
|
+
);
|
|
9882
|
+
return o(p), p;
|
|
9883
|
+
}
|
|
9884
|
+
const d = compileBlueprint(t, {
|
|
9756
9885
|
progress: n.stage(0.5),
|
|
9757
9886
|
onStepCompleted: i
|
|
9758
|
-
}),
|
|
9887
|
+
}), u = await doStartPlaygroundWeb(
|
|
9759
9888
|
e,
|
|
9760
9889
|
setQueryParams(r, {
|
|
9761
|
-
php:
|
|
9762
|
-
wp:
|
|
9763
|
-
"sapi-name":
|
|
9764
|
-
"php-extension":
|
|
9765
|
-
networking:
|
|
9890
|
+
php: d.versions.php,
|
|
9891
|
+
wp: d.versions.wp,
|
|
9892
|
+
"sapi-name": c,
|
|
9893
|
+
"php-extension": d.phpExtensions,
|
|
9894
|
+
networking: d.features.networking ? "yes" : "no"
|
|
9766
9895
|
}),
|
|
9767
9896
|
n
|
|
9768
9897
|
);
|
|
9769
|
-
return collectPhpLogs(logger,
|
|
9898
|
+
return collectPhpLogs(logger, u), o(u), await runBlueprintSteps(d, u), n.finish(), u;
|
|
9770
9899
|
}
|
|
9771
9900
|
function allowStorageAccessByUserActivation(e) {
|
|
9772
9901
|
var t, r;
|