@wp-playground/blueprints 0.6.3 → 0.6.5
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 +13 -13
- package/index.d.ts +4 -0
- package/index.js +442 -402
- package/package.json +2 -2
package/index.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
var
|
|
1
|
+
var Nt = (e, t, r) => {
|
|
2
2
|
if (!t.has(e))
|
|
3
3
|
throw TypeError("Cannot " + r);
|
|
4
4
|
};
|
|
5
|
-
var H = (e, t, r) => (
|
|
5
|
+
var H = (e, t, r) => (Nt(e, t, "read from private field"), r ? r.call(e) : t.get(e)), Q = (e, t, r) => {
|
|
6
6
|
if (t.has(e))
|
|
7
7
|
throw TypeError("Cannot add the same private member more than once");
|
|
8
8
|
t instanceof WeakSet ? t.add(e) : t.set(e, r);
|
|
9
|
-
}, te = (e, t, r, n) => (
|
|
10
|
-
var ce = (e, t, r) => (
|
|
9
|
+
}, te = (e, t, r, n) => (Nt(e, t, "write to private field"), n ? n.call(e, r) : t.set(e, r), r);
|
|
10
|
+
var ce = (e, t, r) => (Nt(e, t, "access private method"), r);
|
|
11
11
|
if (typeof File > "u") {
|
|
12
12
|
class e extends Blob {
|
|
13
13
|
constructor(r, n, s) {
|
|
@@ -147,12 +147,31 @@ function normalizePathsArray(e, t) {
|
|
|
147
147
|
e.unshift("..");
|
|
148
148
|
return e;
|
|
149
149
|
}
|
|
150
|
+
function splitShellCommand$1(e) {
|
|
151
|
+
let n = 0, s = "";
|
|
152
|
+
const i = [];
|
|
153
|
+
let o = "";
|
|
154
|
+
for (let l = 0; l < e.length; l++) {
|
|
155
|
+
const d = e[l];
|
|
156
|
+
d === "\\" ? ((e[l + 1] === '"' || e[l + 1] === "'") && l++, o += e[l]) : n === 0 ? d === '"' || d === "'" ? (n = 1, s = d) : d.match(/\s/) ? (o.trim().length && i.push(o.trim()), o = d) : i.length && !o ? o = i.pop() + d : o += d : n === 1 && (d === s ? (n = 0, s = "") : o += d);
|
|
157
|
+
}
|
|
158
|
+
return o && i.push(o.trim()), i;
|
|
159
|
+
}
|
|
150
160
|
function createSpawnHandler(e) {
|
|
151
|
-
return function(t) {
|
|
152
|
-
const
|
|
161
|
+
return function(t, r = [], n = {}) {
|
|
162
|
+
const s = new ChildProcess(), i = new ProcessApi(s);
|
|
153
163
|
return setTimeout(async () => {
|
|
154
|
-
|
|
155
|
-
|
|
164
|
+
let o = [];
|
|
165
|
+
if (r.length)
|
|
166
|
+
o = [t, ...r];
|
|
167
|
+
else if (typeof t == "string")
|
|
168
|
+
o = splitShellCommand$1(t);
|
|
169
|
+
else if (Array.isArray(t))
|
|
170
|
+
o = t;
|
|
171
|
+
else
|
|
172
|
+
throw new Error("Invalid command ", t);
|
|
173
|
+
await e(o, i, n), s.emit("spawn", !0);
|
|
174
|
+
}), s;
|
|
156
175
|
};
|
|
157
176
|
}
|
|
158
177
|
class EventEmitter {
|
|
@@ -177,9 +196,15 @@ class ProcessApi extends EventEmitter {
|
|
|
177
196
|
stdout(t) {
|
|
178
197
|
typeof t == "string" && (t = new TextEncoder().encode(t)), this.childProcess.stdout.emit("data", t);
|
|
179
198
|
}
|
|
199
|
+
stdoutEnd() {
|
|
200
|
+
this.childProcess.stdout.emit("end", {});
|
|
201
|
+
}
|
|
180
202
|
stderr(t) {
|
|
181
203
|
typeof t == "string" && (t = new TextEncoder().encode(t)), this.childProcess.stderr.emit("data", t);
|
|
182
204
|
}
|
|
205
|
+
stderrEnd() {
|
|
206
|
+
this.childProcess.stderr.emit("end", {});
|
|
207
|
+
}
|
|
183
208
|
exit(t) {
|
|
184
209
|
this.exited || (this.exited = !0, this.childProcess.emit("exit", t));
|
|
185
210
|
}
|
|
@@ -874,33 +899,39 @@ const cp = async (e, { fromPath: t, toPath: r }) => {
|
|
|
874
899
|
WP_SITEURL: t
|
|
875
900
|
}
|
|
876
901
|
});
|
|
877
|
-
}, importFile = async (e, { file: t }) => {
|
|
878
|
-
var
|
|
879
|
-
|
|
902
|
+
}, importFile = async (e, { file: t }, r) => {
|
|
903
|
+
var u, p;
|
|
904
|
+
(u = r == null ? void 0 : r.tracker) == null || u.setCaption("Importing content");
|
|
905
|
+
const n = await e.request({
|
|
880
906
|
url: "/wp-admin/admin.php?import=wordpress"
|
|
881
|
-
}),
|
|
882
|
-
url: `/wp-admin/${
|
|
907
|
+
}), s = (p = DOM(n).getElementById("import-upload-form")) == null ? void 0 : p.getAttribute("action"), i = await e.request({
|
|
908
|
+
url: `/wp-admin/${s}`,
|
|
883
909
|
method: "POST",
|
|
884
910
|
body: { import: t }
|
|
885
|
-
}),
|
|
911
|
+
}), o = DOM(i).querySelector(
|
|
886
912
|
"#wpbody-content form"
|
|
887
913
|
);
|
|
888
|
-
if (!
|
|
889
|
-
throw console.log(
|
|
914
|
+
if (!o)
|
|
915
|
+
throw console.log(i.text), new Error(
|
|
890
916
|
"Could not find an importer form in response. See the response text above for details."
|
|
891
917
|
);
|
|
892
|
-
const
|
|
893
|
-
|
|
894
|
-
for (const
|
|
895
|
-
if (
|
|
896
|
-
const
|
|
897
|
-
|
|
898
|
-
}
|
|
899
|
-
await e.request({
|
|
900
|
-
url:
|
|
918
|
+
const l = getFormData(o);
|
|
919
|
+
l.fetch_attachments = "1";
|
|
920
|
+
for (const $ in l)
|
|
921
|
+
if ($.startsWith("user_map[")) {
|
|
922
|
+
const O = "user_new[" + $.slice(9, -1) + "]";
|
|
923
|
+
l[O] = "1";
|
|
924
|
+
}
|
|
925
|
+
const d = await e.request({
|
|
926
|
+
url: o.action,
|
|
901
927
|
method: "POST",
|
|
902
|
-
body:
|
|
928
|
+
body: l
|
|
903
929
|
});
|
|
930
|
+
if (!d.text.includes("All done."))
|
|
931
|
+
throw console.warn("WordPress response was: ", {
|
|
932
|
+
text: d.text,
|
|
933
|
+
errors: d.errors
|
|
934
|
+
}), new Error("Import failed, see console for details.");
|
|
904
935
|
};
|
|
905
936
|
function DOM(e) {
|
|
906
937
|
return new DOMParser().parseFromString(e.text, "text/html");
|
|
@@ -1700,8 +1731,8 @@ class PHPBrowser {
|
|
|
1700
1731
|
* @param config - The browser configuration.
|
|
1701
1732
|
*/
|
|
1702
1733
|
constructor(t, r = {}) {
|
|
1703
|
-
|
|
1704
|
-
|
|
1734
|
+
Q(this, Ae, void 0);
|
|
1735
|
+
Q(this, Ge, void 0);
|
|
1705
1736
|
this.requestHandler = t, te(this, Ae, {}), te(this, Ge, {
|
|
1706
1737
|
handleRedirects: !1,
|
|
1707
1738
|
maxRedirects: 4,
|
|
@@ -1796,8 +1827,8 @@ async function encodeAsMultipart(e) {
|
|
|
1796
1827
|
for (const [d, u] of Object.entries(e))
|
|
1797
1828
|
s.push(`--${t}\r
|
|
1798
1829
|
`), s.push(`Content-Disposition: form-data; name="${d}"`), u instanceof File && s.push(`; filename="${u.name}"`), s.push(`\r
|
|
1799
|
-
`), u instanceof File && s.push("Content-Type: application/octet-stream"), s.push(`\r
|
|
1800
|
-
|
|
1830
|
+
`), u instanceof File && (s.push("Content-Type: application/octet-stream"), s.push(`\r
|
|
1831
|
+
`)), s.push(`\r
|
|
1801
1832
|
`), u instanceof File ? s.push(await fileToUint8Array(u)) : s.push(u), s.push(`\r
|
|
1802
1833
|
`);
|
|
1803
1834
|
s.push(`--${t}--\r
|
|
@@ -1819,7 +1850,7 @@ function fileToUint8Array(e) {
|
|
|
1819
1850
|
}, r.readAsArrayBuffer(e);
|
|
1820
1851
|
});
|
|
1821
1852
|
}
|
|
1822
|
-
var
|
|
1853
|
+
var Pe, Ke, dt, De, Je, ve, Qe, Fe, mt, xt, _t, Wt, $t, Bt;
|
|
1823
1854
|
class PHPRequestHandler {
|
|
1824
1855
|
/**
|
|
1825
1856
|
* @param php - The PHP instance.
|
|
@@ -1832,7 +1863,7 @@ class PHPRequestHandler {
|
|
|
1832
1863
|
* @param fsPath - Absolute path of the static file to serve.
|
|
1833
1864
|
* @returns The response.
|
|
1834
1865
|
*/
|
|
1835
|
-
|
|
1866
|
+
Q(this, mt);
|
|
1836
1867
|
/**
|
|
1837
1868
|
* Runs the requested PHP file with all the request and $_SERVER
|
|
1838
1869
|
* superglobals populated.
|
|
@@ -1840,7 +1871,7 @@ class PHPRequestHandler {
|
|
|
1840
1871
|
* @param request - The request.
|
|
1841
1872
|
* @returns The response.
|
|
1842
1873
|
*/
|
|
1843
|
-
|
|
1874
|
+
Q(this, _t);
|
|
1844
1875
|
/**
|
|
1845
1876
|
* Resolve the requested path to the filesystem path of the requested PHP file.
|
|
1846
1877
|
*
|
|
@@ -1850,28 +1881,28 @@ class PHPRequestHandler {
|
|
|
1850
1881
|
* @throws {Error} If the requested path doesn't exist.
|
|
1851
1882
|
* @returns The resolved filesystem path.
|
|
1852
1883
|
*/
|
|
1853
|
-
|
|
1854
|
-
|
|
1855
|
-
|
|
1856
|
-
|
|
1857
|
-
|
|
1858
|
-
|
|
1859
|
-
|
|
1860
|
-
|
|
1861
|
-
|
|
1884
|
+
Q(this, $t);
|
|
1885
|
+
Q(this, Pe, void 0);
|
|
1886
|
+
Q(this, Ke, void 0);
|
|
1887
|
+
Q(this, dt, void 0);
|
|
1888
|
+
Q(this, De, void 0);
|
|
1889
|
+
Q(this, Je, void 0);
|
|
1890
|
+
Q(this, ve, void 0);
|
|
1891
|
+
Q(this, Qe, void 0);
|
|
1892
|
+
Q(this, Fe, void 0);
|
|
1862
1893
|
te(this, Fe, new Semaphore({ concurrency: 1 }));
|
|
1863
1894
|
const {
|
|
1864
1895
|
documentRoot: n = "/www/",
|
|
1865
1896
|
absoluteUrl: s = typeof location == "object" ? location == null ? void 0 : location.href : ""
|
|
1866
1897
|
} = r;
|
|
1867
|
-
this.php = t, te(this,
|
|
1898
|
+
this.php = t, te(this, Pe, n);
|
|
1868
1899
|
const i = new URL(s);
|
|
1869
1900
|
te(this, dt, i.hostname), te(this, De, i.port ? Number(i.port) : i.protocol === "https:" ? 443 : 80), te(this, Ke, (i.protocol || "").replace(":", ""));
|
|
1870
1901
|
const o = H(this, De) !== 443 && H(this, De) !== 80;
|
|
1871
1902
|
te(this, Je, [
|
|
1872
1903
|
H(this, dt),
|
|
1873
1904
|
o ? `:${H(this, De)}` : ""
|
|
1874
|
-
].join("")), te(this, ve, i.pathname.replace(/\/+$/, "")), te(this,
|
|
1905
|
+
].join("")), te(this, ve, i.pathname.replace(/\/+$/, "")), te(this, Qe, [
|
|
1875
1906
|
`${H(this, Ke)}://`,
|
|
1876
1907
|
H(this, Je),
|
|
1877
1908
|
H(this, ve)
|
|
@@ -1891,11 +1922,11 @@ class PHPRequestHandler {
|
|
|
1891
1922
|
}
|
|
1892
1923
|
/** @inheritDoc */
|
|
1893
1924
|
get absoluteUrl() {
|
|
1894
|
-
return H(this,
|
|
1925
|
+
return H(this, Qe);
|
|
1895
1926
|
}
|
|
1896
1927
|
/** @inheritDoc */
|
|
1897
1928
|
get documentRoot() {
|
|
1898
|
-
return H(this,
|
|
1929
|
+
return H(this, Pe);
|
|
1899
1930
|
}
|
|
1900
1931
|
/** @inheritDoc */
|
|
1901
1932
|
async request(t) {
|
|
@@ -1905,11 +1936,11 @@ class PHPRequestHandler {
|
|
|
1905
1936
|
), s = removePathPrefix(
|
|
1906
1937
|
n.pathname,
|
|
1907
1938
|
H(this, ve)
|
|
1908
|
-
), i = `${H(this,
|
|
1909
|
-
return seemsLikeAPHPRequestHandlerPath(i) ? await ce(this, _t,
|
|
1939
|
+
), i = `${H(this, Pe)}${s}`;
|
|
1940
|
+
return seemsLikeAPHPRequestHandlerPath(i) ? await ce(this, _t, Wt).call(this, t, n) : ce(this, mt, xt).call(this, i);
|
|
1910
1941
|
}
|
|
1911
1942
|
}
|
|
1912
|
-
|
|
1943
|
+
Pe = new WeakMap(), Ke = new WeakMap(), dt = new WeakMap(), De = new WeakMap(), Je = new WeakMap(), ve = new WeakMap(), Qe = new WeakMap(), Fe = new WeakMap(), mt = new WeakSet(), xt = function(t) {
|
|
1913
1944
|
if (!this.php.fileExists(t))
|
|
1914
1945
|
return new PHPResponse(
|
|
1915
1946
|
404,
|
|
@@ -1934,7 +1965,7 @@ Se = new WeakMap(), Ke = new WeakMap(), dt = new WeakMap(), De = new WeakMap(),
|
|
|
1934
1965
|
},
|
|
1935
1966
|
r
|
|
1936
1967
|
);
|
|
1937
|
-
}, _t = new WeakSet(),
|
|
1968
|
+
}, _t = new WeakSet(), Wt = async function(t, r) {
|
|
1938
1969
|
var s, i;
|
|
1939
1970
|
if (H(this, Fe).running > 0 && ((s = t.headers) == null ? void 0 : s["x-request-issuer"]) === "php")
|
|
1940
1971
|
return console.warn(
|
|
@@ -1946,9 +1977,9 @@ Se = new WeakMap(), Ke = new WeakMap(), dt = new WeakMap(), De = new WeakMap(),
|
|
|
1946
1977
|
);
|
|
1947
1978
|
const n = await H(this, Fe).acquire();
|
|
1948
1979
|
try {
|
|
1949
|
-
this.php.addServerGlobalEntry("REMOTE_ADDR", "127.0.0.1"), this.php.addServerGlobalEntry("DOCUMENT_ROOT", H(this,
|
|
1980
|
+
this.php.addServerGlobalEntry("REMOTE_ADDR", "127.0.0.1"), this.php.addServerGlobalEntry("DOCUMENT_ROOT", H(this, Pe)), this.php.addServerGlobalEntry(
|
|
1950
1981
|
"HTTPS",
|
|
1951
|
-
H(this,
|
|
1982
|
+
H(this, Qe).startsWith("https://") ? "on" : ""
|
|
1952
1983
|
);
|
|
1953
1984
|
let o = "GET";
|
|
1954
1985
|
const l = {
|
|
@@ -1971,7 +2002,7 @@ Se = new WeakMap(), Ke = new WeakMap(), dt = new WeakMap(), De = new WeakMap(),
|
|
|
1971
2002
|
).pathname;
|
|
1972
2003
|
} catch {
|
|
1973
2004
|
}
|
|
1974
|
-
u = ce(this, $t,
|
|
2005
|
+
u = ce(this, $t, Bt).call(this, p);
|
|
1975
2006
|
} catch {
|
|
1976
2007
|
return new PHPResponse(
|
|
1977
2008
|
404,
|
|
@@ -1993,10 +2024,10 @@ Se = new WeakMap(), Ke = new WeakMap(), dt = new WeakMap(), De = new WeakMap(),
|
|
|
1993
2024
|
} finally {
|
|
1994
2025
|
n();
|
|
1995
2026
|
}
|
|
1996
|
-
}, $t = new WeakSet(),
|
|
2027
|
+
}, $t = new WeakSet(), Bt = function(t) {
|
|
1997
2028
|
let r = removePathPrefix(t, H(this, ve));
|
|
1998
|
-
r.includes(".php") ? r = r.split(".php")[0] + ".php" : (r.endsWith("/") || (r
|
|
1999
|
-
const n = `${H(this,
|
|
2029
|
+
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";
|
|
2030
|
+
const n = `${H(this, Pe)}${r}`;
|
|
2000
2031
|
if (this.php.fileExists(n))
|
|
2001
2032
|
return n;
|
|
2002
2033
|
throw new Error(`File not found: ${n}`);
|
|
@@ -2167,7 +2198,7 @@ var __defProp = Object.defineProperty, __getOwnPropDesc = Object.getOwnPropertyD
|
|
|
2167
2198
|
return n && s && __defProp(t, r, s), s;
|
|
2168
2199
|
};
|
|
2169
2200
|
const STRING = "string", NUMBER = "number", __private__dont__use = Symbol("__private__dont__use");
|
|
2170
|
-
var Me,
|
|
2201
|
+
var Me, Ze, Ye, be, Te, Re, Ee, Xe, gt, Gt, yt, Kt, vt, Jt, wt, Qt, Pt, Zt, bt, Yt, Et, Xt, St, er, Tt, tr, Rt, rr, kt, nr, Ot, sr;
|
|
2171
2202
|
class BasePHP {
|
|
2172
2203
|
/**
|
|
2173
2204
|
* Initializes a PHP runtime.
|
|
@@ -2177,38 +2208,39 @@ class BasePHP {
|
|
|
2177
2208
|
* @param serverOptions - Optional. Options for the PHPRequestHandler. If undefined, no request handler will be initialized.
|
|
2178
2209
|
*/
|
|
2179
2210
|
constructor(e, t) {
|
|
2180
|
-
|
|
2181
|
-
|
|
2182
|
-
|
|
2183
|
-
|
|
2184
|
-
|
|
2185
|
-
|
|
2186
|
-
|
|
2187
|
-
|
|
2188
|
-
|
|
2189
|
-
|
|
2190
|
-
|
|
2191
|
-
|
|
2192
|
-
|
|
2193
|
-
|
|
2194
|
-
|
|
2195
|
-
|
|
2196
|
-
|
|
2197
|
-
|
|
2198
|
-
|
|
2199
|
-
|
|
2211
|
+
Q(this, gt);
|
|
2212
|
+
Q(this, yt);
|
|
2213
|
+
Q(this, vt);
|
|
2214
|
+
Q(this, wt);
|
|
2215
|
+
Q(this, Pt);
|
|
2216
|
+
Q(this, bt);
|
|
2217
|
+
Q(this, Et);
|
|
2218
|
+
Q(this, St);
|
|
2219
|
+
Q(this, Tt);
|
|
2220
|
+
Q(this, Rt);
|
|
2221
|
+
Q(this, kt);
|
|
2222
|
+
Q(this, Ot);
|
|
2223
|
+
Q(this, Me, void 0);
|
|
2224
|
+
Q(this, Ze, void 0);
|
|
2225
|
+
Q(this, Ye, void 0);
|
|
2226
|
+
Q(this, be, void 0);
|
|
2227
|
+
Q(this, Te, void 0);
|
|
2228
|
+
Q(this, Re, void 0);
|
|
2229
|
+
Q(this, Ee, void 0);
|
|
2230
|
+
Q(this, Xe, void 0);
|
|
2231
|
+
te(this, Me, []), te(this, be, !1), te(this, Te, null), te(this, Re, {}), 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(
|
|
2200
2232
|
new PHPRequestHandler(this, t)
|
|
2201
2233
|
));
|
|
2202
2234
|
}
|
|
2203
2235
|
addEventListener(e, t) {
|
|
2204
|
-
H(this,
|
|
2236
|
+
H(this, Ee).has(e) || H(this, Ee).set(e, /* @__PURE__ */ new Set()), H(this, Ee).get(e).add(t);
|
|
2205
2237
|
}
|
|
2206
2238
|
removeEventListener(e, t) {
|
|
2207
2239
|
var r;
|
|
2208
|
-
(r = H(this,
|
|
2240
|
+
(r = H(this, Ee).get(e)) == null || r.delete(t);
|
|
2209
2241
|
}
|
|
2210
2242
|
dispatchEvent(e) {
|
|
2211
|
-
const t = H(this,
|
|
2243
|
+
const t = H(this, Ee).get(e.type);
|
|
2212
2244
|
if (t)
|
|
2213
2245
|
for (const r of t)
|
|
2214
2246
|
r(e);
|
|
@@ -2252,7 +2284,7 @@ class BasePHP {
|
|
|
2252
2284
|
return s;
|
|
2253
2285
|
}
|
|
2254
2286
|
return "";
|
|
2255
|
-
}, te(this,
|
|
2287
|
+
}, te(this, Te, improveWASMErrorReporting(t)), this.dispatchEvent({
|
|
2256
2288
|
type: "runtime.initialized"
|
|
2257
2289
|
});
|
|
2258
2290
|
}
|
|
@@ -2271,9 +2303,9 @@ class BasePHP {
|
|
|
2271
2303
|
}
|
|
2272
2304
|
/** @inheritDoc */
|
|
2273
2305
|
setPhpIniPath(e) {
|
|
2274
|
-
if (H(this,
|
|
2306
|
+
if (H(this, be))
|
|
2275
2307
|
throw new Error("Cannot set PHP ini path after calling run().");
|
|
2276
|
-
te(this,
|
|
2308
|
+
te(this, Ze, e), this[__private__dont__use].ccall(
|
|
2277
2309
|
"wasm_set_phpini_path",
|
|
2278
2310
|
null,
|
|
2279
2311
|
["string"],
|
|
@@ -2282,7 +2314,7 @@ class BasePHP {
|
|
|
2282
2314
|
}
|
|
2283
2315
|
/** @inheritDoc */
|
|
2284
2316
|
setPhpIniEntry(e, t) {
|
|
2285
|
-
if (H(this,
|
|
2317
|
+
if (H(this, be))
|
|
2286
2318
|
throw new Error("Cannot set PHP ini entries after calling run().");
|
|
2287
2319
|
H(this, Me).push([e, t]);
|
|
2288
2320
|
}
|
|
@@ -2301,22 +2333,29 @@ class BasePHP {
|
|
|
2301
2333
|
const t = await this.semaphore.acquire();
|
|
2302
2334
|
let r;
|
|
2303
2335
|
try {
|
|
2304
|
-
H(this,
|
|
2336
|
+
if (H(this, be) || (ce(this, gt, Gt).call(this), te(this, be, !0)), e.scriptPath && !this.fileExists(e.scriptPath))
|
|
2337
|
+
throw new Error(
|
|
2338
|
+
`The script path "${e.scriptPath}" does not exist.`
|
|
2339
|
+
);
|
|
2340
|
+
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");
|
|
2305
2341
|
const n = normalizeHeaders(e.headers || {}), s = n.host || "example.com:443";
|
|
2306
|
-
ce(this, wt,
|
|
2307
|
-
const i =
|
|
2308
|
-
|
|
2309
|
-
|
|
2310
|
-
|
|
2311
|
-
|
|
2342
|
+
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, Tt, tr).call(this);
|
|
2343
|
+
const i = e.env || {};
|
|
2344
|
+
for (const l in i)
|
|
2345
|
+
ce(this, Rt, rr).call(this, l, i[l]);
|
|
2346
|
+
const o = await ce(this, Ot, sr).call(this);
|
|
2347
|
+
if (e.throwOnError && o.exitCode !== 0) {
|
|
2348
|
+
const l = {
|
|
2349
|
+
stdout: o.text,
|
|
2350
|
+
stderr: o.errors
|
|
2312
2351
|
};
|
|
2313
|
-
console.warn("PHP.run() output was:",
|
|
2314
|
-
const
|
|
2315
|
-
`PHP.run() failed with exit code ${
|
|
2352
|
+
console.warn("PHP.run() output was:", l);
|
|
2353
|
+
const d = new Error(
|
|
2354
|
+
`PHP.run() failed with exit code ${o.exitCode} and the following output: ` + o.errors
|
|
2316
2355
|
);
|
|
2317
|
-
throw
|
|
2356
|
+
throw d.output = l, console.error(d), d;
|
|
2318
2357
|
}
|
|
2319
|
-
return
|
|
2358
|
+
return o;
|
|
2320
2359
|
} finally {
|
|
2321
2360
|
try {
|
|
2322
2361
|
r && this[__private__dont__use].free(r);
|
|
@@ -2328,18 +2367,18 @@ class BasePHP {
|
|
|
2328
2367
|
}
|
|
2329
2368
|
}
|
|
2330
2369
|
addServerGlobalEntry(e, t) {
|
|
2331
|
-
H(this,
|
|
2370
|
+
H(this, Re)[e] = t;
|
|
2332
2371
|
}
|
|
2333
2372
|
defineConstant(e, t) {
|
|
2334
2373
|
let r = {};
|
|
2335
2374
|
try {
|
|
2336
2375
|
r = JSON.parse(
|
|
2337
|
-
this.fileExists("/
|
|
2376
|
+
this.fileExists("/internal/consts.json") && this.readFileAsText("/internal/consts.json") || "{}"
|
|
2338
2377
|
);
|
|
2339
2378
|
} catch {
|
|
2340
2379
|
}
|
|
2341
2380
|
this.writeFile(
|
|
2342
|
-
"/
|
|
2381
|
+
"/internal/consts.json",
|
|
2343
2382
|
JSON.stringify({
|
|
2344
2383
|
...r,
|
|
2345
2384
|
[e]: t
|
|
@@ -2424,9 +2463,9 @@ class BasePHP {
|
|
|
2424
2463
|
this.exit();
|
|
2425
2464
|
} catch {
|
|
2426
2465
|
}
|
|
2427
|
-
if (this.initializeRuntime(e), H(this,
|
|
2466
|
+
if (this.initializeRuntime(e), H(this, Ze) && this.setPhpIniPath(H(this, Ze)), H(this, Ye) && this.setSapiName(H(this, Ye)), this.requestHandler) {
|
|
2428
2467
|
const r = this.documentRoot;
|
|
2429
|
-
|
|
2468
|
+
copyFS(t, this[__private__dont__use].FS, r);
|
|
2430
2469
|
}
|
|
2431
2470
|
}
|
|
2432
2471
|
exit(e = 0) {
|
|
@@ -2437,15 +2476,15 @@ class BasePHP {
|
|
|
2437
2476
|
this[__private__dont__use]._exit(e);
|
|
2438
2477
|
} catch {
|
|
2439
2478
|
}
|
|
2440
|
-
te(this,
|
|
2479
|
+
te(this, be, !1), te(this, Te, null), delete this[__private__dont__use].onMessage, delete this[__private__dont__use];
|
|
2441
2480
|
}
|
|
2442
2481
|
}
|
|
2443
|
-
Me = new WeakMap(),
|
|
2444
|
-
if (this.setPhpIniEntry("auto_prepend_file", "/
|
|
2445
|
-
"/
|
|
2482
|
+
Me = new WeakMap(), Ze = new WeakMap(), Ye = new WeakMap(), be = new WeakMap(), Te = new WeakMap(), Re = new WeakMap(), Ee = new WeakMap(), Xe = new WeakMap(), gt = new WeakSet(), Gt = function() {
|
|
2483
|
+
if (this.setPhpIniEntry("auto_prepend_file", "/internal/consts.php"), this.fileExists("/internal/consts.php") || this.writeFile(
|
|
2484
|
+
"/internal/consts.php",
|
|
2446
2485
|
`<?php
|
|
2447
|
-
if(file_exists('/
|
|
2448
|
-
$consts = json_decode(file_get_contents('/
|
|
2486
|
+
if(file_exists('/internal/consts.json')) {
|
|
2487
|
+
$consts = json_decode(file_get_contents('/internal/consts.json'), true);
|
|
2449
2488
|
foreach ($consts as $const => $value) {
|
|
2450
2489
|
if (!defined($const) && is_scalar($value)) {
|
|
2451
2490
|
define($const, $value);
|
|
@@ -2465,8 +2504,8 @@ Me = new WeakMap(), Qe = new WeakMap(), Ye = new WeakMap(), Pe = new WeakMap(),
|
|
|
2465
2504
|
);
|
|
2466
2505
|
}
|
|
2467
2506
|
this[__private__dont__use].ccall("php_wasm_init", null, [], []);
|
|
2468
|
-
}, yt = new WeakSet(),
|
|
2469
|
-
const e = "/
|
|
2507
|
+
}, yt = new WeakSet(), Kt = function() {
|
|
2508
|
+
const e = "/internal/headers.json";
|
|
2470
2509
|
if (!this.fileExists(e))
|
|
2471
2510
|
throw new Error(
|
|
2472
2511
|
"SAPI Error: Could not find response headers file."
|
|
@@ -2482,7 +2521,7 @@ Me = new WeakMap(), Qe = new WeakMap(), Ye = new WeakMap(), Pe = new WeakMap(),
|
|
|
2482
2521
|
headers: r,
|
|
2483
2522
|
httpStatusCode: t.status
|
|
2484
2523
|
};
|
|
2485
|
-
}, vt = new WeakSet(),
|
|
2524
|
+
}, vt = new WeakSet(), Jt = function(e) {
|
|
2486
2525
|
if (this[__private__dont__use].ccall(
|
|
2487
2526
|
"wasm_set_request_uri",
|
|
2488
2527
|
null,
|
|
@@ -2497,7 +2536,7 @@ Me = new WeakMap(), Qe = new WeakMap(), Ye = new WeakMap(), Pe = new WeakMap(),
|
|
|
2497
2536
|
[t]
|
|
2498
2537
|
);
|
|
2499
2538
|
}
|
|
2500
|
-
}, wt = new WeakSet(),
|
|
2539
|
+
}, wt = new WeakSet(), Qt = function(e, t) {
|
|
2501
2540
|
this[__private__dont__use].ccall(
|
|
2502
2541
|
"wasm_set_request_host",
|
|
2503
2542
|
null,
|
|
@@ -2522,7 +2561,7 @@ Me = new WeakMap(), Qe = new WeakMap(), Ye = new WeakMap(), Pe = new WeakMap(),
|
|
|
2522
2561
|
[STRING],
|
|
2523
2562
|
[e]
|
|
2524
2563
|
);
|
|
2525
|
-
}, bt = new WeakSet(),
|
|
2564
|
+
}, bt = new WeakSet(), Yt = function(e) {
|
|
2526
2565
|
e.cookie && this[__private__dont__use].ccall(
|
|
2527
2566
|
"wasm_set_cookies",
|
|
2528
2567
|
null,
|
|
@@ -2546,7 +2585,7 @@ Me = new WeakMap(), Qe = new WeakMap(), Ye = new WeakMap(), Pe = new WeakMap(),
|
|
|
2546
2585
|
e[t]
|
|
2547
2586
|
);
|
|
2548
2587
|
}
|
|
2549
|
-
}, Et = new WeakSet(),
|
|
2588
|
+
}, Et = new WeakSet(), Xt = function(e) {
|
|
2550
2589
|
let t, r;
|
|
2551
2590
|
typeof e == "string" ? (console.warn(
|
|
2552
2591
|
"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"
|
|
@@ -2569,38 +2608,46 @@ Me = new WeakMap(), Qe = new WeakMap(), Ye = new WeakMap(), Pe = new WeakMap(),
|
|
|
2569
2608
|
[NUMBER],
|
|
2570
2609
|
[r]
|
|
2571
2610
|
), n;
|
|
2572
|
-
}, St = new WeakSet(),
|
|
2611
|
+
}, St = new WeakSet(), er = function(e) {
|
|
2573
2612
|
this[__private__dont__use].ccall(
|
|
2574
2613
|
"wasm_set_path_translated",
|
|
2575
2614
|
null,
|
|
2576
2615
|
[STRING],
|
|
2577
2616
|
[e]
|
|
2578
2617
|
);
|
|
2579
|
-
},
|
|
2580
|
-
for (const e in H(this,
|
|
2618
|
+
}, Tt = new WeakSet(), tr = function() {
|
|
2619
|
+
for (const e in H(this, Re))
|
|
2581
2620
|
this[__private__dont__use].ccall(
|
|
2582
2621
|
"wasm_add_SERVER_entry",
|
|
2583
2622
|
null,
|
|
2584
2623
|
[STRING, STRING],
|
|
2585
|
-
[e, H(this,
|
|
2624
|
+
[e, H(this, Re)[e]]
|
|
2586
2625
|
);
|
|
2587
|
-
},
|
|
2626
|
+
}, Rt = new WeakSet(), rr = function(e, t) {
|
|
2627
|
+
this[__private__dont__use].ccall(
|
|
2628
|
+
"wasm_add_ENV_entry",
|
|
2629
|
+
null,
|
|
2630
|
+
[STRING, STRING],
|
|
2631
|
+
[e, t]
|
|
2632
|
+
);
|
|
2633
|
+
}, kt = new WeakSet(), nr = function(e) {
|
|
2588
2634
|
this[__private__dont__use].ccall(
|
|
2589
2635
|
"wasm_set_php_code",
|
|
2590
2636
|
null,
|
|
2591
2637
|
[STRING],
|
|
2592
2638
|
[e]
|
|
2593
2639
|
);
|
|
2594
|
-
},
|
|
2640
|
+
}, Ot = new WeakSet(), sr = async function() {
|
|
2595
2641
|
var s;
|
|
2596
2642
|
let e, t;
|
|
2597
2643
|
try {
|
|
2598
2644
|
e = await new Promise((i, o) => {
|
|
2599
2645
|
var d;
|
|
2600
2646
|
t = (u) => {
|
|
2647
|
+
console.error(u), console.error(u.error);
|
|
2601
2648
|
const p = new Error("Rethrown");
|
|
2602
2649
|
p.cause = u.error, p.betterMessage = u.message, o(p);
|
|
2603
|
-
}, (d = H(this,
|
|
2650
|
+
}, (d = H(this, Te)) == null || d.addEventListener(
|
|
2604
2651
|
"error",
|
|
2605
2652
|
t
|
|
2606
2653
|
);
|
|
@@ -2622,16 +2669,16 @@ Me = new WeakMap(), Qe = new WeakMap(), Ye = new WeakMap(), Pe = new WeakMap(),
|
|
|
2622
2669
|
});
|
|
2623
2670
|
this.functionsMaybeMissingFromAsyncify = getFunctionsMaybeMissingFromAsyncify();
|
|
2624
2671
|
const o = i, l = "betterMessage" in o ? o.betterMessage : o.message, d = new Error(l);
|
|
2625
|
-
throw d.cause = o, d;
|
|
2672
|
+
throw d.cause = o, console.error(d), d;
|
|
2626
2673
|
} finally {
|
|
2627
|
-
(s = H(this,
|
|
2674
|
+
(s = H(this, Te)) == null || s.removeEventListener("error", t), te(this, Re, {});
|
|
2628
2675
|
}
|
|
2629
|
-
const { headers: r, httpStatusCode: n } = ce(this, yt,
|
|
2676
|
+
const { headers: r, httpStatusCode: n } = ce(this, yt, Kt).call(this);
|
|
2630
2677
|
return new PHPResponse(
|
|
2631
2678
|
n,
|
|
2632
2679
|
r,
|
|
2633
|
-
this.readFileAsBuffer("/
|
|
2634
|
-
this.readFileAsText("/
|
|
2680
|
+
this.readFileAsBuffer("/internal/stdout"),
|
|
2681
|
+
this.readFileAsText("/internal/stderr"),
|
|
2635
2682
|
e
|
|
2636
2683
|
);
|
|
2637
2684
|
};
|
|
@@ -2671,28 +2718,23 @@ function normalizeHeaders(e) {
|
|
|
2671
2718
|
t[r.toLowerCase()] = e[r];
|
|
2672
2719
|
return t;
|
|
2673
2720
|
}
|
|
2674
|
-
function
|
|
2721
|
+
function copyFS(e, t, r) {
|
|
2675
2722
|
let n;
|
|
2676
2723
|
try {
|
|
2677
|
-
n =
|
|
2724
|
+
n = e.lookupPath(r);
|
|
2678
2725
|
} catch {
|
|
2679
2726
|
return;
|
|
2680
2727
|
}
|
|
2681
2728
|
if (!("contents" in n.node))
|
|
2682
2729
|
return;
|
|
2683
|
-
|
|
2684
|
-
|
|
2685
|
-
return;
|
|
2686
|
-
} catch {
|
|
2687
|
-
}
|
|
2688
|
-
if (!t.isDir(n.node.mode)) {
|
|
2689
|
-
e.writeFile(r, t.readFile(r));
|
|
2730
|
+
if (!e.isDir(n.node.mode)) {
|
|
2731
|
+
t.writeFile(r, e.readFile(r));
|
|
2690
2732
|
return;
|
|
2691
2733
|
}
|
|
2692
|
-
|
|
2693
|
-
const s =
|
|
2734
|
+
t.mkdirTree(r);
|
|
2735
|
+
const s = e.readdir(r).filter((i) => i !== "." && i !== "..");
|
|
2694
2736
|
for (const i of s)
|
|
2695
|
-
|
|
2737
|
+
copyFS(e, t, joinPaths(r, i));
|
|
2696
2738
|
}
|
|
2697
2739
|
const ResourceTypes = [
|
|
2698
2740
|
"vfs",
|
|
@@ -2959,29 +3001,29 @@ var ajv$1 = { exports: {} }, core$2 = {}, validate = {}, boolSchema = {}, errors
|
|
|
2959
3001
|
}
|
|
2960
3002
|
get str() {
|
|
2961
3003
|
var R;
|
|
2962
|
-
return (R = this._str) !== null && R !== void 0 ? R : this._str = this._items.reduce((
|
|
3004
|
+
return (R = this._str) !== null && R !== void 0 ? R : this._str = this._items.reduce((S, I) => `${S}${I}`, "");
|
|
2963
3005
|
}
|
|
2964
3006
|
get names() {
|
|
2965
3007
|
var R;
|
|
2966
|
-
return (R = this._names) !== null && R !== void 0 ? R : this._names = this._items.reduce((
|
|
3008
|
+
return (R = this._names) !== null && R !== void 0 ? R : this._names = this._items.reduce((S, I) => (I instanceof r && (S[I.str] = (S[I.str] || 0) + 1), S), {});
|
|
2967
3009
|
}
|
|
2968
3010
|
}
|
|
2969
3011
|
e._Code = n, e.nil = new n("");
|
|
2970
3012
|
function s(m, ...R) {
|
|
2971
|
-
const
|
|
3013
|
+
const S = [m[0]];
|
|
2972
3014
|
let I = 0;
|
|
2973
3015
|
for (; I < R.length; )
|
|
2974
|
-
l(
|
|
2975
|
-
return new n(
|
|
3016
|
+
l(S, R[I]), S.push(m[++I]);
|
|
3017
|
+
return new n(S);
|
|
2976
3018
|
}
|
|
2977
3019
|
e._ = s;
|
|
2978
3020
|
const i = new n("+");
|
|
2979
3021
|
function o(m, ...R) {
|
|
2980
|
-
const
|
|
3022
|
+
const S = [N(m[0])];
|
|
2981
3023
|
let I = 0;
|
|
2982
3024
|
for (; I < R.length; )
|
|
2983
|
-
|
|
2984
|
-
return d(
|
|
3025
|
+
S.push(i), l(S, R[I]), S.push(i, N(m[++I]));
|
|
3026
|
+
return d(S), new n(S);
|
|
2985
3027
|
}
|
|
2986
3028
|
e.str = o;
|
|
2987
3029
|
function l(m, R) {
|
|
@@ -2992,9 +3034,9 @@ var ajv$1 = { exports: {} }, core$2 = {}, validate = {}, boolSchema = {}, errors
|
|
|
2992
3034
|
let R = 1;
|
|
2993
3035
|
for (; R < m.length - 1; ) {
|
|
2994
3036
|
if (m[R] === i) {
|
|
2995
|
-
const
|
|
2996
|
-
if (
|
|
2997
|
-
m.splice(R - 1, 3,
|
|
3037
|
+
const S = u(m[R - 1], m[R + 1]);
|
|
3038
|
+
if (S !== void 0) {
|
|
3039
|
+
m.splice(R - 1, 3, S);
|
|
2998
3040
|
continue;
|
|
2999
3041
|
}
|
|
3000
3042
|
m[R++] = "+";
|
|
@@ -3027,10 +3069,10 @@ var ajv$1 = { exports: {} }, core$2 = {}, validate = {}, boolSchema = {}, errors
|
|
|
3027
3069
|
return JSON.stringify(m).replace(/\u2028/g, "\\u2028").replace(/\u2029/g, "\\u2029");
|
|
3028
3070
|
}
|
|
3029
3071
|
e.safeStringify = N;
|
|
3030
|
-
function
|
|
3072
|
+
function T(m) {
|
|
3031
3073
|
return typeof m == "string" && e.IDENTIFIER.test(m) ? new n(`.${m}`) : s`[${m}]`;
|
|
3032
3074
|
}
|
|
3033
|
-
e.getProperty =
|
|
3075
|
+
e.getProperty = T;
|
|
3034
3076
|
function v(m) {
|
|
3035
3077
|
if (typeof m == "string" && e.IDENTIFIER.test(m))
|
|
3036
3078
|
return new n(`${m}`);
|
|
@@ -3105,15 +3147,15 @@ var scope = {};
|
|
|
3105
3147
|
var $;
|
|
3106
3148
|
if (p.ref === void 0)
|
|
3107
3149
|
throw new Error("CodeGen: ref must be passed in value");
|
|
3108
|
-
const O = this.toName(u), { prefix: N } = O,
|
|
3150
|
+
const O = this.toName(u), { prefix: N } = O, T = ($ = p.key) !== null && $ !== void 0 ? $ : p.ref;
|
|
3109
3151
|
let v = this._values[N];
|
|
3110
3152
|
if (v) {
|
|
3111
|
-
const R = v.get(
|
|
3153
|
+
const R = v.get(T);
|
|
3112
3154
|
if (R)
|
|
3113
3155
|
return R;
|
|
3114
3156
|
} else
|
|
3115
3157
|
v = this._values[N] = /* @__PURE__ */ new Map();
|
|
3116
|
-
v.set(
|
|
3158
|
+
v.set(T, O);
|
|
3117
3159
|
const g = this._scope[N] || (this._scope[N] = []), m = g.length;
|
|
3118
3160
|
return g[m] = p.ref, O.setValue(p, { property: N, itemIndex: m }), O;
|
|
3119
3161
|
}
|
|
@@ -3138,19 +3180,19 @@ var scope = {};
|
|
|
3138
3180
|
}
|
|
3139
3181
|
_reduceValues(u, p, $ = {}, O) {
|
|
3140
3182
|
let N = t.nil;
|
|
3141
|
-
for (const
|
|
3142
|
-
const v = u[
|
|
3183
|
+
for (const T in u) {
|
|
3184
|
+
const v = u[T];
|
|
3143
3185
|
if (!v)
|
|
3144
3186
|
continue;
|
|
3145
|
-
const g = $[
|
|
3187
|
+
const g = $[T] = $[T] || /* @__PURE__ */ new Map();
|
|
3146
3188
|
v.forEach((m) => {
|
|
3147
3189
|
if (g.has(m))
|
|
3148
3190
|
return;
|
|
3149
3191
|
g.set(m, n.Started);
|
|
3150
3192
|
let R = p(m);
|
|
3151
3193
|
if (R) {
|
|
3152
|
-
const
|
|
3153
|
-
N = (0, t._)`${N}${
|
|
3194
|
+
const S = this.opts.es5 ? e.varKinds.var : e.varKinds.const;
|
|
3195
|
+
N = (0, t._)`${N}${S} ${m} = ${R};${this.opts._n}`;
|
|
3154
3196
|
} else if (R = O == null ? void 0 : O(m))
|
|
3155
3197
|
N = (0, t._)`${N}${R}${this.opts._n}`;
|
|
3156
3198
|
else
|
|
@@ -3326,17 +3368,17 @@ var scope = {};
|
|
|
3326
3368
|
return this.nodes.reduce((a, h) => K(a, h.names), {});
|
|
3327
3369
|
}
|
|
3328
3370
|
}
|
|
3329
|
-
class
|
|
3371
|
+
class T extends N {
|
|
3330
3372
|
render(a) {
|
|
3331
3373
|
return "{" + a._n + super.render(a) + "}" + a._n;
|
|
3332
3374
|
}
|
|
3333
3375
|
}
|
|
3334
3376
|
class v extends N {
|
|
3335
3377
|
}
|
|
3336
|
-
class g extends
|
|
3378
|
+
class g extends T {
|
|
3337
3379
|
}
|
|
3338
3380
|
g.kind = "else";
|
|
3339
|
-
class m extends
|
|
3381
|
+
class m extends T {
|
|
3340
3382
|
constructor(a, h) {
|
|
3341
3383
|
super(h), this.condition = a;
|
|
3342
3384
|
}
|
|
@@ -3355,7 +3397,7 @@ var scope = {};
|
|
|
3355
3397
|
h = this.else = Array.isArray(C) ? new g(C) : C;
|
|
3356
3398
|
}
|
|
3357
3399
|
if (h)
|
|
3358
|
-
return a === !1 ? h instanceof m ? h : h.nodes : this.nodes.length ? this : new m(
|
|
3400
|
+
return a === !1 ? h instanceof m ? h : h.nodes : this.nodes.length ? this : new m(Oe(a), h instanceof m ? [h] : h.nodes);
|
|
3359
3401
|
if (!(a === !1 || !this.nodes.length))
|
|
3360
3402
|
return this;
|
|
3361
3403
|
}
|
|
@@ -3370,10 +3412,10 @@ var scope = {};
|
|
|
3370
3412
|
}
|
|
3371
3413
|
}
|
|
3372
3414
|
m.kind = "if";
|
|
3373
|
-
class R extends
|
|
3415
|
+
class R extends T {
|
|
3374
3416
|
}
|
|
3375
3417
|
R.kind = "for";
|
|
3376
|
-
class
|
|
3418
|
+
class S extends R {
|
|
3377
3419
|
constructor(a) {
|
|
3378
3420
|
super(), this.iteration = a;
|
|
3379
3421
|
}
|
|
@@ -3416,7 +3458,7 @@ var scope = {};
|
|
|
3416
3458
|
return K(super.names, this.iterable.names);
|
|
3417
3459
|
}
|
|
3418
3460
|
}
|
|
3419
|
-
class w extends
|
|
3461
|
+
class w extends T {
|
|
3420
3462
|
constructor(a, h, C) {
|
|
3421
3463
|
super(), this.name = a, this.args = h, this.async = C;
|
|
3422
3464
|
}
|
|
@@ -3431,7 +3473,7 @@ var scope = {};
|
|
|
3431
3473
|
}
|
|
3432
3474
|
}
|
|
3433
3475
|
k.kind = "return";
|
|
3434
|
-
class A extends
|
|
3476
|
+
class A extends T {
|
|
3435
3477
|
render(a) {
|
|
3436
3478
|
let h = "try" + super.render(a);
|
|
3437
3479
|
return this.catch && (h += this.catch.render(a)), this.finally && (h += this.finally.render(a)), h;
|
|
@@ -3449,7 +3491,7 @@ var scope = {};
|
|
|
3449
3491
|
return this.catch && K(a, this.catch.names), this.finally && K(a, this.finally.names), a;
|
|
3450
3492
|
}
|
|
3451
3493
|
}
|
|
3452
|
-
class V extends
|
|
3494
|
+
class V extends T {
|
|
3453
3495
|
constructor(a) {
|
|
3454
3496
|
super(), this.error = a;
|
|
3455
3497
|
}
|
|
@@ -3458,7 +3500,7 @@ var scope = {};
|
|
|
3458
3500
|
}
|
|
3459
3501
|
}
|
|
3460
3502
|
V.kind = "catch";
|
|
3461
|
-
class x extends
|
|
3503
|
+
class x extends T {
|
|
3462
3504
|
render(a) {
|
|
3463
3505
|
return "finally" + super.render(a);
|
|
3464
3506
|
}
|
|
@@ -3558,7 +3600,7 @@ var scope = {};
|
|
|
3558
3600
|
}
|
|
3559
3601
|
// a generic `for` clause (or statement if `forBody` is passed)
|
|
3560
3602
|
for(a, h) {
|
|
3561
|
-
return this._for(new
|
|
3603
|
+
return this._for(new S(a), h);
|
|
3562
3604
|
}
|
|
3563
3605
|
// `for` statement for a range of values
|
|
3564
3606
|
forRange(a, h, C, M, q = this.opts.es5 ? r.varKinds.var : r.varKinds.let) {
|
|
@@ -3701,10 +3743,10 @@ var scope = {};
|
|
|
3701
3743
|
for (const h in a)
|
|
3702
3744
|
P[h] = (P[h] || 0) - (a[h] || 0);
|
|
3703
3745
|
}
|
|
3704
|
-
function
|
|
3746
|
+
function Oe(P) {
|
|
3705
3747
|
return typeof P == "boolean" || typeof P == "number" || P === null ? !P : (0, t._)`!${j(P)}`;
|
|
3706
3748
|
}
|
|
3707
|
-
e.not =
|
|
3749
|
+
e.not = Oe;
|
|
3708
3750
|
const qe = y(e.operators.AND);
|
|
3709
3751
|
function et(...P) {
|
|
3710
3752
|
return P.reduce(qe);
|
|
@@ -3798,14 +3840,14 @@ var util = {};
|
|
|
3798
3840
|
k(w);
|
|
3799
3841
|
}
|
|
3800
3842
|
e.eachItem = N;
|
|
3801
|
-
function
|
|
3843
|
+
function T({ mergeNames: w, mergeToName: k, mergeValues: A, resultToName: V }) {
|
|
3802
3844
|
return (x, re, K, ue) => {
|
|
3803
3845
|
const oe = K === void 0 ? re : K instanceof t.Name ? (re instanceof t.Name ? w(x, re, K) : k(x, re, K), K) : re instanceof t.Name ? (k(x, K, re), re) : A(re, K);
|
|
3804
3846
|
return ue === t.Name && !(oe instanceof t.Name) ? V(x, oe) : oe;
|
|
3805
3847
|
};
|
|
3806
3848
|
}
|
|
3807
3849
|
e.mergeEvaluated = {
|
|
3808
|
-
props:
|
|
3850
|
+
props: T({
|
|
3809
3851
|
mergeNames: (w, k, A) => w.if((0, t._)`${A} !== true && ${k} !== undefined`, () => {
|
|
3810
3852
|
w.if((0, t._)`${k} === true`, () => w.assign(A, !0), () => w.assign(A, (0, t._)`${A} || {}`).code((0, t._)`Object.assign(${A}, ${k})`));
|
|
3811
3853
|
}),
|
|
@@ -3815,7 +3857,7 @@ var util = {};
|
|
|
3815
3857
|
mergeValues: (w, k) => w === !0 ? !0 : { ...w, ...k },
|
|
3816
3858
|
resultToName: v
|
|
3817
3859
|
}),
|
|
3818
|
-
items:
|
|
3860
|
+
items: T({
|
|
3819
3861
|
mergeNames: (w, k, A) => w.if((0, t._)`${A} !== true && ${k} !== undefined`, () => w.assign(A, (0, t._)`${k} === true ? true : ${A} > ${k} ? ${A} : ${k}`)),
|
|
3820
3862
|
mergeToName: (w, k, A) => w.if((0, t._)`${A} !== true`, () => w.assign(A, k === !0 ? !0 : (0, t._)`${A} > ${k} ? ${A} : ${k}`)),
|
|
3821
3863
|
mergeValues: (w, k) => w === !0 ? !0 : Math.max(w, k),
|
|
@@ -3841,13 +3883,13 @@ var util = {};
|
|
|
3841
3883
|
});
|
|
3842
3884
|
}
|
|
3843
3885
|
e.useFunc = R;
|
|
3844
|
-
var
|
|
3886
|
+
var S;
|
|
3845
3887
|
(function(w) {
|
|
3846
3888
|
w[w.Num = 0] = "Num", w[w.Str = 1] = "Str";
|
|
3847
|
-
})(
|
|
3889
|
+
})(S = e.Type || (e.Type = {}));
|
|
3848
3890
|
function I(w, k, A) {
|
|
3849
3891
|
if (w instanceof t.Name) {
|
|
3850
|
-
const V = k ===
|
|
3892
|
+
const V = k === S.Num;
|
|
3851
3893
|
return A ? V ? (0, t._)`"[" + ${w} + "]"` : (0, t._)`"['" + ${w} + "']"` : V ? (0, t._)`"/" + ${w}` : (0, t._)`"/" + ${w}.replace(/~/g, "~0").replace(/\\//g, "~1")`;
|
|
3852
3894
|
}
|
|
3853
3895
|
return A ? (0, t.getProperty)(w).toString() : "/" + $(w);
|
|
@@ -3896,26 +3938,26 @@ names$1.default = names;
|
|
|
3896
3938
|
}, e.keyword$DataError = {
|
|
3897
3939
|
message: ({ keyword: g, schemaType: m }) => m ? (0, t.str)`"${g}" keyword must be ${m} ($data)` : (0, t.str)`"${g}" keyword is invalid ($data)`
|
|
3898
3940
|
};
|
|
3899
|
-
function s(g, m = e.keywordError, R,
|
|
3941
|
+
function s(g, m = e.keywordError, R, S) {
|
|
3900
3942
|
const { it: I } = g, { gen: D, compositeRule: w, allErrors: k } = I, A = $(g, m, R);
|
|
3901
|
-
|
|
3943
|
+
S ?? (w || k) ? d(D, A) : u(I, (0, t._)`[${A}]`);
|
|
3902
3944
|
}
|
|
3903
3945
|
e.reportError = s;
|
|
3904
3946
|
function i(g, m = e.keywordError, R) {
|
|
3905
|
-
const { it:
|
|
3906
|
-
d(I, k), D || w || u(
|
|
3947
|
+
const { it: S } = g, { gen: I, compositeRule: D, allErrors: w } = S, k = $(g, m, R);
|
|
3948
|
+
d(I, k), D || w || u(S, n.default.vErrors);
|
|
3907
3949
|
}
|
|
3908
3950
|
e.reportExtraError = i;
|
|
3909
3951
|
function o(g, m) {
|
|
3910
3952
|
g.assign(n.default.errors, m), g.if((0, t._)`${n.default.vErrors} !== null`, () => g.if(m, () => g.assign((0, t._)`${n.default.vErrors}.length`, m), () => g.assign(n.default.vErrors, null)));
|
|
3911
3953
|
}
|
|
3912
3954
|
e.resetErrorsCount = o;
|
|
3913
|
-
function l({ gen: g, keyword: m, schemaValue: R, data:
|
|
3955
|
+
function l({ gen: g, keyword: m, schemaValue: R, data: S, errsCount: I, it: D }) {
|
|
3914
3956
|
if (I === void 0)
|
|
3915
3957
|
throw new Error("ajv implementation error");
|
|
3916
3958
|
const w = g.name("err");
|
|
3917
3959
|
g.forRange("i", I, n.default.errors, (k) => {
|
|
3918
|
-
g.const(w, (0, t._)`${n.default.vErrors}[${k}]`), g.if((0, t._)`${w}.instancePath === undefined`, () => g.assign((0, t._)`${w}.instancePath`, (0, t.strConcat)(n.default.instancePath, D.errorPath))), g.assign((0, t._)`${w}.schemaPath`, (0, t.str)`${D.errSchemaPath}/${m}`), D.opts.verbose && (g.assign((0, t._)`${w}.schema`, R), g.assign((0, t._)`${w}.data`,
|
|
3960
|
+
g.const(w, (0, t._)`${n.default.vErrors}[${k}]`), g.if((0, t._)`${w}.instancePath === undefined`, () => g.assign((0, t._)`${w}.instancePath`, (0, t.strConcat)(n.default.instancePath, D.errorPath))), g.assign((0, t._)`${w}.schemaPath`, (0, t.str)`${D.errSchemaPath}/${m}`), D.opts.verbose && (g.assign((0, t._)`${w}.schema`, R), g.assign((0, t._)`${w}.data`, S));
|
|
3919
3961
|
});
|
|
3920
3962
|
}
|
|
3921
3963
|
e.extendErrors = l;
|
|
@@ -3924,8 +3966,8 @@ names$1.default = names;
|
|
|
3924
3966
|
g.if((0, t._)`${n.default.vErrors} === null`, () => g.assign(n.default.vErrors, (0, t._)`[${R}]`), (0, t._)`${n.default.vErrors}.push(${R})`), g.code((0, t._)`${n.default.errors}++`);
|
|
3925
3967
|
}
|
|
3926
3968
|
function u(g, m) {
|
|
3927
|
-
const { gen: R, validateName:
|
|
3928
|
-
I.$async ? R.throw((0, t._)`new ${g.ValidationError}(${m})`) : (R.assign((0, t._)`${
|
|
3969
|
+
const { gen: R, validateName: S, schemaEnv: I } = g;
|
|
3970
|
+
I.$async ? R.throw((0, t._)`new ${g.ValidationError}(${m})`) : (R.assign((0, t._)`${S}.errors`, m), R.return(!1));
|
|
3929
3971
|
}
|
|
3930
3972
|
const p = {
|
|
3931
3973
|
keyword: new t.Name("keyword"),
|
|
@@ -3937,27 +3979,27 @@ names$1.default = names;
|
|
|
3937
3979
|
parentSchema: new t.Name("parentSchema")
|
|
3938
3980
|
};
|
|
3939
3981
|
function $(g, m, R) {
|
|
3940
|
-
const { createErrors:
|
|
3941
|
-
return
|
|
3982
|
+
const { createErrors: S } = g.it;
|
|
3983
|
+
return S === !1 ? (0, t._)`{}` : O(g, m, R);
|
|
3942
3984
|
}
|
|
3943
3985
|
function O(g, m, R = {}) {
|
|
3944
|
-
const { gen:
|
|
3986
|
+
const { gen: S, it: I } = g, D = [
|
|
3945
3987
|
N(I, R),
|
|
3946
|
-
|
|
3988
|
+
T(g, R)
|
|
3947
3989
|
];
|
|
3948
|
-
return v(g, m, D),
|
|
3990
|
+
return v(g, m, D), S.object(...D);
|
|
3949
3991
|
}
|
|
3950
3992
|
function N({ errorPath: g }, { instancePath: m }) {
|
|
3951
3993
|
const R = m ? (0, t.str)`${g}${(0, r.getErrorPath)(m, r.Type.Str)}` : g;
|
|
3952
3994
|
return [n.default.instancePath, (0, t.strConcat)(n.default.instancePath, R)];
|
|
3953
3995
|
}
|
|
3954
|
-
function
|
|
3955
|
-
let I =
|
|
3996
|
+
function T({ keyword: g, it: { errSchemaPath: m } }, { schemaPath: R, parentSchema: S }) {
|
|
3997
|
+
let I = S ? m : (0, t.str)`${m}/${g}`;
|
|
3956
3998
|
return R && (I = (0, t.str)`${I}${(0, r.getErrorPath)(R, r.Type.Str)}`), [p.schemaPath, I];
|
|
3957
3999
|
}
|
|
3958
|
-
function v(g, { params: m, message: R },
|
|
4000
|
+
function v(g, { params: m, message: R }, S) {
|
|
3959
4001
|
const { keyword: I, data: D, schemaValue: w, it: k } = g, { opts: A, propertyName: V, topSchemaRef: x, schemaPath: re } = k;
|
|
3960
|
-
|
|
4002
|
+
S.push([p.keyword, I], [p.params, typeof m == "function" ? m(g) : m || (0, t._)`{}`]), A.messages && S.push([p.message, typeof R == "function" ? R(g) : R]), A.verbose && S.push([p.schema, w], [p.parentSchema, (0, t._)`${x}${re}`], [n.default.data, D]), V && S.push([p.propertyName, V]);
|
|
3961
4003
|
}
|
|
3962
4004
|
})(errors);
|
|
3963
4005
|
Object.defineProperty(boolSchema, "__esModule", { value: !0 });
|
|
@@ -4033,51 +4075,51 @@ applicability.shouldUseRule = shouldUseRule;
|
|
|
4033
4075
|
Object.defineProperty(e, "__esModule", { value: !0 }), e.reportTypeError = e.checkDataTypes = e.checkDataType = e.coerceAndCheckDataType = e.getJSONTypes = e.getSchemaTypes = e.DataType = void 0;
|
|
4034
4076
|
const t = rules, r = applicability, n = errors, s = codegen, i = util;
|
|
4035
4077
|
var o;
|
|
4036
|
-
(function(
|
|
4037
|
-
|
|
4078
|
+
(function(S) {
|
|
4079
|
+
S[S.Correct = 0] = "Correct", S[S.Wrong = 1] = "Wrong";
|
|
4038
4080
|
})(o = e.DataType || (e.DataType = {}));
|
|
4039
|
-
function l(
|
|
4040
|
-
const I = d(
|
|
4081
|
+
function l(S) {
|
|
4082
|
+
const I = d(S.type);
|
|
4041
4083
|
if (I.includes("null")) {
|
|
4042
|
-
if (
|
|
4084
|
+
if (S.nullable === !1)
|
|
4043
4085
|
throw new Error("type: null contradicts nullable: false");
|
|
4044
4086
|
} else {
|
|
4045
|
-
if (!I.length &&
|
|
4087
|
+
if (!I.length && S.nullable !== void 0)
|
|
4046
4088
|
throw new Error('"nullable" cannot be used without "type"');
|
|
4047
|
-
|
|
4089
|
+
S.nullable === !0 && I.push("null");
|
|
4048
4090
|
}
|
|
4049
4091
|
return I;
|
|
4050
4092
|
}
|
|
4051
4093
|
e.getSchemaTypes = l;
|
|
4052
|
-
function d(
|
|
4053
|
-
const I = Array.isArray(
|
|
4094
|
+
function d(S) {
|
|
4095
|
+
const I = Array.isArray(S) ? S : S ? [S] : [];
|
|
4054
4096
|
if (I.every(t.isJSONType))
|
|
4055
4097
|
return I;
|
|
4056
4098
|
throw new Error("type must be JSONType or JSONType[]: " + I.join(","));
|
|
4057
4099
|
}
|
|
4058
4100
|
e.getJSONTypes = d;
|
|
4059
|
-
function u(
|
|
4060
|
-
const { gen: D, data: w, opts: k } =
|
|
4101
|
+
function u(S, I) {
|
|
4102
|
+
const { gen: D, data: w, opts: k } = S, A = $(I, k.coerceTypes), V = I.length > 0 && !(A.length === 0 && I.length === 1 && (0, r.schemaHasRulesForType)(S, I[0]));
|
|
4061
4103
|
if (V) {
|
|
4062
4104
|
const x = v(I, w, k.strictNumbers, o.Wrong);
|
|
4063
4105
|
D.if(x, () => {
|
|
4064
|
-
A.length ? O(
|
|
4106
|
+
A.length ? O(S, I, A) : m(S);
|
|
4065
4107
|
});
|
|
4066
4108
|
}
|
|
4067
4109
|
return V;
|
|
4068
4110
|
}
|
|
4069
4111
|
e.coerceAndCheckDataType = u;
|
|
4070
4112
|
const p = /* @__PURE__ */ new Set(["string", "number", "integer", "boolean", "null"]);
|
|
4071
|
-
function $(
|
|
4072
|
-
return I ?
|
|
4113
|
+
function $(S, I) {
|
|
4114
|
+
return I ? S.filter((D) => p.has(D) || I === "array" && D === "array") : [];
|
|
4073
4115
|
}
|
|
4074
|
-
function O(
|
|
4075
|
-
const { gen: w, data: k, opts: A } =
|
|
4116
|
+
function O(S, I, D) {
|
|
4117
|
+
const { gen: w, data: k, opts: A } = S, V = w.let("dataType", (0, s._)`typeof ${k}`), x = w.let("coerced", (0, s._)`undefined`);
|
|
4076
4118
|
A.coerceTypes === "array" && w.if((0, s._)`${V} == 'object' && Array.isArray(${k}) && ${k}.length == 1`, () => w.assign(k, (0, s._)`${k}[0]`).assign(V, (0, s._)`typeof ${k}`).if(v(I, k, A.strictNumbers), () => w.assign(x, k))), w.if((0, s._)`${x} !== undefined`);
|
|
4077
4119
|
for (const K of D)
|
|
4078
4120
|
(p.has(K) || K === "array" && A.coerceTypes === "array") && re(K);
|
|
4079
|
-
w.else(), m(
|
|
4080
|
-
w.assign(k, x), N(
|
|
4121
|
+
w.else(), m(S), w.endIf(), w.if((0, s._)`${x} !== undefined`, () => {
|
|
4122
|
+
w.assign(k, x), N(S, x);
|
|
4081
4123
|
});
|
|
4082
4124
|
function re(K) {
|
|
4083
4125
|
switch (K) {
|
|
@@ -4104,13 +4146,13 @@ applicability.shouldUseRule = shouldUseRule;
|
|
|
4104
4146
|
}
|
|
4105
4147
|
}
|
|
4106
4148
|
}
|
|
4107
|
-
function N({ gen:
|
|
4108
|
-
|
|
4149
|
+
function N({ gen: S, parentData: I, parentDataProperty: D }, w) {
|
|
4150
|
+
S.if((0, s._)`${I} !== undefined`, () => S.assign((0, s._)`${I}[${D}]`, w));
|
|
4109
4151
|
}
|
|
4110
|
-
function S
|
|
4152
|
+
function T(S, I, D, w = o.Correct) {
|
|
4111
4153
|
const k = w === o.Correct ? s.operators.EQ : s.operators.NEQ;
|
|
4112
4154
|
let A;
|
|
4113
|
-
switch (
|
|
4155
|
+
switch (S) {
|
|
4114
4156
|
case "null":
|
|
4115
4157
|
return (0, s._)`${I} ${k} null`;
|
|
4116
4158
|
case "array":
|
|
@@ -4126,19 +4168,19 @@ applicability.shouldUseRule = shouldUseRule;
|
|
|
4126
4168
|
A = V();
|
|
4127
4169
|
break;
|
|
4128
4170
|
default:
|
|
4129
|
-
return (0, s._)`typeof ${I} ${k} ${
|
|
4171
|
+
return (0, s._)`typeof ${I} ${k} ${S}`;
|
|
4130
4172
|
}
|
|
4131
4173
|
return w === o.Correct ? A : (0, s.not)(A);
|
|
4132
4174
|
function V(x = s.nil) {
|
|
4133
4175
|
return (0, s.and)((0, s._)`typeof ${I} == "number"`, x, D ? (0, s._)`isFinite(${I})` : s.nil);
|
|
4134
4176
|
}
|
|
4135
4177
|
}
|
|
4136
|
-
e.checkDataType =
|
|
4137
|
-
function v(
|
|
4138
|
-
if (
|
|
4139
|
-
return S
|
|
4178
|
+
e.checkDataType = T;
|
|
4179
|
+
function v(S, I, D, w) {
|
|
4180
|
+
if (S.length === 1)
|
|
4181
|
+
return T(S[0], I, D, w);
|
|
4140
4182
|
let k;
|
|
4141
|
-
const A = (0, i.toHash)(
|
|
4183
|
+
const A = (0, i.toHash)(S);
|
|
4142
4184
|
if (A.array && A.object) {
|
|
4143
4185
|
const V = (0, s._)`typeof ${I} != "object"`;
|
|
4144
4186
|
k = A.null ? V : (0, s._)`!${I} || ${V}`, delete A.null, delete A.array, delete A.object;
|
|
@@ -4146,21 +4188,21 @@ applicability.shouldUseRule = shouldUseRule;
|
|
|
4146
4188
|
k = s.nil;
|
|
4147
4189
|
A.number && delete A.integer;
|
|
4148
4190
|
for (const V in A)
|
|
4149
|
-
k = (0, s.and)(k,
|
|
4191
|
+
k = (0, s.and)(k, T(V, I, D, w));
|
|
4150
4192
|
return k;
|
|
4151
4193
|
}
|
|
4152
4194
|
e.checkDataTypes = v;
|
|
4153
4195
|
const g = {
|
|
4154
|
-
message: ({ schema:
|
|
4155
|
-
params: ({ schema:
|
|
4196
|
+
message: ({ schema: S }) => `must be ${S}`,
|
|
4197
|
+
params: ({ schema: S, schemaValue: I }) => typeof S == "string" ? (0, s._)`{type: ${S}}` : (0, s._)`{type: ${I}}`
|
|
4156
4198
|
};
|
|
4157
|
-
function m(
|
|
4158
|
-
const I = R(
|
|
4199
|
+
function m(S) {
|
|
4200
|
+
const I = R(S);
|
|
4159
4201
|
(0, n.reportError)(I, g);
|
|
4160
4202
|
}
|
|
4161
4203
|
e.reportTypeError = m;
|
|
4162
|
-
function R(
|
|
4163
|
-
const { gen: I, data: D, schema: w } =
|
|
4204
|
+
function R(S) {
|
|
4205
|
+
const { gen: I, data: D, schema: w } = S, k = (0, i.schemaRefOrVal)(S, w, "type");
|
|
4164
4206
|
return {
|
|
4165
4207
|
gen: I,
|
|
4166
4208
|
keyword: "type",
|
|
@@ -4170,7 +4212,7 @@ applicability.shouldUseRule = shouldUseRule;
|
|
|
4170
4212
|
schemaValue: k,
|
|
4171
4213
|
parentSchema: w,
|
|
4172
4214
|
params: {},
|
|
4173
|
-
it:
|
|
4215
|
+
it: S
|
|
4174
4216
|
};
|
|
4175
4217
|
}
|
|
4176
4218
|
})(dataType);
|
|
@@ -4332,7 +4374,7 @@ function funcKeywordCode(e, t) {
|
|
|
4332
4374
|
if (t.errors === !1)
|
|
4333
4375
|
v(), t.modifying && modifyData(e), g(() => e.error());
|
|
4334
4376
|
else {
|
|
4335
|
-
const m = t.async ? N() :
|
|
4377
|
+
const m = t.async ? N() : T();
|
|
4336
4378
|
t.modifying && modifyData(e), g(() => addErrs(e, m));
|
|
4337
4379
|
}
|
|
4338
4380
|
}
|
|
@@ -4340,13 +4382,13 @@ function funcKeywordCode(e, t) {
|
|
|
4340
4382
|
const m = n.let("ruleErrs", null);
|
|
4341
4383
|
return n.try(() => v((0, codegen_1$p._)`await `), (R) => n.assign($, !1).if((0, codegen_1$p._)`${R} instanceof ${d.ValidationError}`, () => n.assign(m, (0, codegen_1$p._)`${R}.errors`), () => n.throw(R))), m;
|
|
4342
4384
|
}
|
|
4343
|
-
function
|
|
4385
|
+
function T() {
|
|
4344
4386
|
const m = (0, codegen_1$p._)`${p}.errors`;
|
|
4345
4387
|
return n.assign(m, null), v(codegen_1$p.nil), m;
|
|
4346
4388
|
}
|
|
4347
4389
|
function v(m = t.async ? (0, codegen_1$p._)`await ` : codegen_1$p.nil) {
|
|
4348
|
-
const R = d.opts.passContext ? names_1$4.default.this : names_1$4.default.self,
|
|
4349
|
-
n.assign($, (0, codegen_1$p._)`${m}${(0, code_1$9.callValidateCode)(e, p, R,
|
|
4390
|
+
const R = d.opts.passContext ? names_1$4.default.this : names_1$4.default.self, S = !("compile" in t && !l || t.schema === !1);
|
|
4391
|
+
n.assign($, (0, codegen_1$p._)`${m}${(0, code_1$9.callValidateCode)(e, p, R, S)}`, t.modifying);
|
|
4350
4392
|
}
|
|
4351
4393
|
function g(m) {
|
|
4352
4394
|
var R;
|
|
@@ -4629,25 +4671,25 @@ function getSchemaRefs(e, t) {
|
|
|
4629
4671
|
if (typeof e == "boolean")
|
|
4630
4672
|
return {};
|
|
4631
4673
|
const { schemaId: r, uriResolver: n } = this.opts, s = normalizeId(e[r] || t), i = { "": s }, o = getFullPath(n, s, !1), l = {}, d = /* @__PURE__ */ new Set();
|
|
4632
|
-
return traverse(e, { allKeys: !0 }, ($, O, N,
|
|
4633
|
-
if (
|
|
4674
|
+
return traverse(e, { allKeys: !0 }, ($, O, N, T) => {
|
|
4675
|
+
if (T === void 0)
|
|
4634
4676
|
return;
|
|
4635
4677
|
const v = o + O;
|
|
4636
|
-
let g = i[
|
|
4678
|
+
let g = i[T];
|
|
4637
4679
|
typeof $[r] == "string" && (g = m.call(this, $[r])), R.call(this, $.$anchor), R.call(this, $.$dynamicAnchor), i[O] = g;
|
|
4638
|
-
function m(
|
|
4680
|
+
function m(S) {
|
|
4639
4681
|
const I = this.opts.uriResolver.resolve;
|
|
4640
|
-
if (
|
|
4641
|
-
throw p(
|
|
4642
|
-
d.add(
|
|
4643
|
-
let D = this.refs[
|
|
4644
|
-
return typeof D == "string" && (D = this.refs[D]), typeof D == "object" ? u($, D.schema,
|
|
4645
|
-
}
|
|
4646
|
-
function R(
|
|
4647
|
-
if (typeof
|
|
4648
|
-
if (!ANCHOR.test(
|
|
4649
|
-
throw new Error(`invalid anchor "${
|
|
4650
|
-
m.call(this, `#${
|
|
4682
|
+
if (S = normalizeId(g ? I(g, S) : S), d.has(S))
|
|
4683
|
+
throw p(S);
|
|
4684
|
+
d.add(S);
|
|
4685
|
+
let D = this.refs[S];
|
|
4686
|
+
return typeof D == "string" && (D = this.refs[D]), typeof D == "object" ? u($, D.schema, S) : S !== normalizeId(v) && (S[0] === "#" ? (u($, l[S], S), l[S] = $) : this.refs[S] = v), S;
|
|
4687
|
+
}
|
|
4688
|
+
function R(S) {
|
|
4689
|
+
if (typeof S == "string") {
|
|
4690
|
+
if (!ANCHOR.test(S))
|
|
4691
|
+
throw new Error(`invalid anchor "${S}"`);
|
|
4692
|
+
m.call(this, `#${S}`);
|
|
4651
4693
|
}
|
|
4652
4694
|
}
|
|
4653
4695
|
}), l;
|
|
@@ -5043,11 +5085,11 @@ function compileSchema(e) {
|
|
|
5043
5085
|
p = `${o.scopeRefs(names_1$2.default.scope)}return ${$}`, this.opts.code.process && (p = this.opts.code.process(p, e));
|
|
5044
5086
|
const N = new Function(`${names_1$2.default.self}`, `${names_1$2.default.scope}`, p)(this, this.scope.get());
|
|
5045
5087
|
if (this.scope.value(d, { ref: N }), N.errors = null, N.schema = e.schema, N.schemaEnv = e, e.$async && (N.$async = !0), this.opts.code.source === !0 && (N.source = { validateName: d, validateCode: $, scopeValues: o._values }), this.opts.unevaluated) {
|
|
5046
|
-
const { props:
|
|
5088
|
+
const { props: T, items: v } = u;
|
|
5047
5089
|
N.evaluated = {
|
|
5048
|
-
props:
|
|
5090
|
+
props: T instanceof codegen_1$m.Name ? void 0 : T,
|
|
5049
5091
|
items: v instanceof codegen_1$m.Name ? void 0 : v,
|
|
5050
|
-
dynamicProps:
|
|
5092
|
+
dynamicProps: T instanceof codegen_1$m.Name,
|
|
5051
5093
|
dynamicItems: v instanceof codegen_1$m.Name
|
|
5052
5094
|
}, N.source && (N.source.evaluated = (0, codegen_1$m.stringify)(N.evaluated));
|
|
5053
5095
|
}
|
|
@@ -5202,7 +5244,7 @@ var uri$1 = {}, uri_all = { exports: {} };
|
|
|
5202
5244
|
function u(f) {
|
|
5203
5245
|
var c = "[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)), U = "[\\:\\/\\?\\#\\[\\]\\@]", L = "[\\!\\$\\&\\'\\(\\)\\*\\+\\,\\;\\=]", J = n(U, L), Y = f ? "[\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]" : "[]", se = f ? "[\\uE000-\\uF8FF]" : "[]", B = n(c, _, "[\\-\\.\\_\\~]", Y);
|
|
5204
5246
|
s(c + n(c, _, "[\\+\\-\\.]") + "*"), s(s(b + "|" + n(B, L, "[\\:]")) + "*");
|
|
5205
|
-
var
|
|
5247
|
+
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), z = s(E + "{1,4}"), X = s(s(z + "\\:" + z) + "|" + ie), ae = s(s(z + "\\:") + "{6}" + X), ee = s("\\:\\:" + s(z + "\\:") + "{5}" + X), Se = s(s(z) + "?\\:\\:" + s(z + "\\:") + "{4}" + X), $e = s(s(s(z + "\\:") + "{0,1}" + z) + "?\\:\\:" + s(z + "\\:") + "{3}" + X), ge = s(s(s(z + "\\:") + "{0,2}" + z) + "?\\:\\:" + s(z + "\\:") + "{2}" + X), Be = s(s(s(z + "\\:") + "{0,3}" + z) + "?\\:\\:" + z + "\\:" + X), Ie = s(s(s(z + "\\:") + "{0,4}" + z) + "?\\:\\:" + X), fe = s(s(s(z + "\\:") + "{0,5}" + z) + "?\\:\\:" + z), ye = s(s(s(z + "\\:") + "{0,6}" + z) + "?\\:\\:"), je = s([ae, ee, Se, $e, ge, Be, Ie, fe, ye].join("|")), we = s(s(B + "|" + b) + "+");
|
|
5206
5248
|
s("[vV]" + E + "+\\." + n(B, L, "[\\:]") + "+"), s(s(b + "|" + n(B, L)) + "*");
|
|
5207
5249
|
var ct = s(b + "|" + n(B, L, "[\\:\\@]"));
|
|
5208
5250
|
return s(s(b + "|" + n(B, L, "[\\@]")) + "+"), s(s(ct + "|" + n("[\\/\\?]", se)) + "*"), {
|
|
@@ -5254,7 +5296,7 @@ var uri$1 = {}, uri_all = { exports: {} };
|
|
|
5254
5296
|
return _;
|
|
5255
5297
|
} else
|
|
5256
5298
|
return Array.from(f);
|
|
5257
|
-
},
|
|
5299
|
+
}, T = 2147483647, v = 36, g = 1, m = 26, R = 38, S = 700, I = 72, D = 128, w = "-", k = /^xn--/, A = /[^\0-\x7E]/, V = /[\x2E\u3002\uFF0E\uFF61]/g, x = {
|
|
5258
5300
|
overflow: "Overflow: input needs wider integers to process",
|
|
5259
5301
|
"not-basic": "Illegal input >= 0x80 (not a basic code point)",
|
|
5260
5302
|
"invalid-input": "Invalid input"
|
|
@@ -5267,7 +5309,7 @@ var uri$1 = {}, uri_all = { exports: {} };
|
|
|
5267
5309
|
_[E] = c(f[E]);
|
|
5268
5310
|
return _;
|
|
5269
5311
|
}
|
|
5270
|
-
function
|
|
5312
|
+
function Oe(f, c) {
|
|
5271
5313
|
var _ = f.split("@"), E = "";
|
|
5272
5314
|
_.length > 1 && (E = _[0] + "@", f = _[1]), f = f.replace(V, ".");
|
|
5273
5315
|
var b = f.split("."), U = ke(b, c).join(".");
|
|
@@ -5293,7 +5335,7 @@ var uri$1 = {}, uri_all = { exports: {} };
|
|
|
5293
5335
|
}, y = function(c, _, E) {
|
|
5294
5336
|
var b = 0;
|
|
5295
5337
|
for (
|
|
5296
|
-
c = E ? K(c /
|
|
5338
|
+
c = E ? K(c / S) : c >> 1, c += K(c / _);
|
|
5297
5339
|
/* no initialization */
|
|
5298
5340
|
c > re * m >> 1;
|
|
5299
5341
|
b += v
|
|
@@ -5307,22 +5349,22 @@ var uri$1 = {}, uri_all = { exports: {} };
|
|
|
5307
5349
|
c.charCodeAt(Y) >= 128 && oe("not-basic"), _.push(c.charCodeAt(Y));
|
|
5308
5350
|
for (var se = J > 0 ? J + 1 : 0; se < E; ) {
|
|
5309
5351
|
for (
|
|
5310
|
-
var B = b,
|
|
5352
|
+
var B = b, Z = 1, ie = v;
|
|
5311
5353
|
;
|
|
5312
5354
|
/* no condition */
|
|
5313
5355
|
ie += v
|
|
5314
5356
|
) {
|
|
5315
5357
|
se >= E && oe("invalid-input");
|
|
5316
5358
|
var z = Ue(c.charCodeAt(se++));
|
|
5317
|
-
(z >= v || z > K((
|
|
5359
|
+
(z >= v || z > K((T - b) / Z)) && oe("overflow"), b += z * Z;
|
|
5318
5360
|
var X = ie <= L ? g : ie >= L + m ? m : ie - L;
|
|
5319
5361
|
if (z < X)
|
|
5320
5362
|
break;
|
|
5321
5363
|
var ae = v - X;
|
|
5322
|
-
|
|
5364
|
+
Z > K(T / ae) && oe("overflow"), Z *= ae;
|
|
5323
5365
|
}
|
|
5324
5366
|
var ee = _.length + 1;
|
|
5325
|
-
L = y(b - B, ee, B == 0), K(b / ee) >
|
|
5367
|
+
L = y(b - B, ee, B == 0), K(b / ee) > T - U && oe("overflow"), U += K(b / ee), b %= ee, _.splice(b++, 0, U);
|
|
5326
5368
|
}
|
|
5327
5369
|
return String.fromCodePoint.apply(String, _);
|
|
5328
5370
|
}, P = function(c) {
|
|
@@ -5330,8 +5372,8 @@ var uri$1 = {}, uri_all = { exports: {} };
|
|
|
5330
5372
|
c = qe(c);
|
|
5331
5373
|
var E = c.length, b = D, U = 0, L = I, J = !0, Y = !1, se = void 0;
|
|
5332
5374
|
try {
|
|
5333
|
-
for (var B = c[Symbol.iterator](),
|
|
5334
|
-
var ie =
|
|
5375
|
+
for (var B = c[Symbol.iterator](), Z; !(J = (Z = B.next()).done); J = !0) {
|
|
5376
|
+
var ie = Z.value;
|
|
5335
5377
|
ie < 128 && _.push(ue(ie));
|
|
5336
5378
|
}
|
|
5337
5379
|
} catch (lt) {
|
|
@@ -5346,29 +5388,29 @@ var uri$1 = {}, uri_all = { exports: {} };
|
|
|
5346
5388
|
}
|
|
5347
5389
|
var z = _.length, X = z;
|
|
5348
5390
|
for (z && _.push(w); X < E; ) {
|
|
5349
|
-
var ae =
|
|
5391
|
+
var ae = T, ee = !0, Se = !1, $e = void 0;
|
|
5350
5392
|
try {
|
|
5351
5393
|
for (var ge = c[Symbol.iterator](), Be; !(ee = (Be = ge.next()).done); ee = !0) {
|
|
5352
5394
|
var Ie = Be.value;
|
|
5353
5395
|
Ie >= b && Ie < ae && (ae = Ie);
|
|
5354
5396
|
}
|
|
5355
5397
|
} catch (lt) {
|
|
5356
|
-
|
|
5398
|
+
Se = !0, $e = lt;
|
|
5357
5399
|
} finally {
|
|
5358
5400
|
try {
|
|
5359
5401
|
!ee && ge.return && ge.return();
|
|
5360
5402
|
} finally {
|
|
5361
|
-
if (
|
|
5403
|
+
if (Se)
|
|
5362
5404
|
throw $e;
|
|
5363
5405
|
}
|
|
5364
5406
|
}
|
|
5365
5407
|
var fe = X + 1;
|
|
5366
|
-
ae - b > K((
|
|
5408
|
+
ae - b > K((T - U) / fe) && oe("overflow"), U += (ae - b) * fe, b = ae;
|
|
5367
5409
|
var ye = !0, je = !1, we = void 0;
|
|
5368
5410
|
try {
|
|
5369
|
-
for (var ct = c[Symbol.iterator](),
|
|
5370
|
-
var
|
|
5371
|
-
if (
|
|
5411
|
+
for (var ct = c[Symbol.iterator](), Lt; !(ye = (Lt = ct.next()).done); ye = !0) {
|
|
5412
|
+
var Ht = Lt.value;
|
|
5413
|
+
if (Ht < b && ++U > T && oe("overflow"), Ht == b) {
|
|
5372
5414
|
for (
|
|
5373
5415
|
var pt = U, ft = v;
|
|
5374
5416
|
;
|
|
@@ -5378,8 +5420,8 @@ var uri$1 = {}, uri_all = { exports: {} };
|
|
|
5378
5420
|
var ht = ft <= L ? g : ft >= L + m ? m : ft - L;
|
|
5379
5421
|
if (pt < ht)
|
|
5380
5422
|
break;
|
|
5381
|
-
var
|
|
5382
|
-
_.push(ue(F(ht +
|
|
5423
|
+
var Vt = pt - ht, zt = v - ht;
|
|
5424
|
+
_.push(ue(F(ht + Vt % zt, 0))), pt = K(Vt / zt);
|
|
5383
5425
|
}
|
|
5384
5426
|
_.push(ue(F(pt, 0))), L = y(U, fe, X == z), U = 0, ++X;
|
|
5385
5427
|
}
|
|
@@ -5398,11 +5440,11 @@ var uri$1 = {}, uri_all = { exports: {} };
|
|
|
5398
5440
|
}
|
|
5399
5441
|
return _.join("");
|
|
5400
5442
|
}, a = function(c) {
|
|
5401
|
-
return
|
|
5443
|
+
return Oe(c, function(_) {
|
|
5402
5444
|
return k.test(_) ? j(_.slice(4).toLowerCase()) : _;
|
|
5403
5445
|
});
|
|
5404
5446
|
}, h = function(c) {
|
|
5405
|
-
return
|
|
5447
|
+
return Oe(c, function(_) {
|
|
5406
5448
|
return A.test(_) ? "xn--" + P(_) : _;
|
|
5407
5449
|
});
|
|
5408
5450
|
}, C = {
|
|
@@ -5473,16 +5515,16 @@ var uri$1 = {}, uri_all = { exports: {} };
|
|
|
5473
5515
|
function Le(f, c) {
|
|
5474
5516
|
var _ = f.match(c.IPV6ADDRESS) || [], E = O(_, 3), b = E[1], U = E[2];
|
|
5475
5517
|
if (b) {
|
|
5476
|
-
for (var L = b.toLowerCase().split("::").reverse(), J = O(L, 2), Y = J[0], se = J[1], B = se ? se.split(":").map(ne) : [],
|
|
5477
|
-
ae[ee] = B[ee] ||
|
|
5518
|
+
for (var L = b.toLowerCase().split("::").reverse(), J = O(L, 2), Y = J[0], se = J[1], B = se ? se.split(":").map(ne) : [], Z = Y.split(":").map(ne), ie = c.IPV4ADDRESS.test(Z[Z.length - 1]), z = ie ? 7 : 8, X = Z.length - z, ae = Array(z), ee = 0; ee < z; ++ee)
|
|
5519
|
+
ae[ee] = B[ee] || Z[X + ee] || "";
|
|
5478
5520
|
ie && (ae[z - 1] = he(ae[z - 1], c));
|
|
5479
|
-
var
|
|
5521
|
+
var Se = ae.reduce(function(fe, ye, je) {
|
|
5480
5522
|
if (!ye || ye === "0") {
|
|
5481
5523
|
var we = fe[fe.length - 1];
|
|
5482
5524
|
we && we.index + we.length === je ? we.length++ : fe.push({ index: je, length: 1 });
|
|
5483
5525
|
}
|
|
5484
5526
|
return fe;
|
|
5485
|
-
}, []), $e =
|
|
5527
|
+
}, []), $e = Se.sort(function(fe, ye) {
|
|
5486
5528
|
return ye.length - fe.length;
|
|
5487
5529
|
})[0], ge = void 0;
|
|
5488
5530
|
if ($e && $e.length > 1) {
|
|
@@ -5570,7 +5612,7 @@ var uri$1 = {}, uri_all = { exports: {} };
|
|
|
5570
5612
|
var E = d({ scheme: "null" }, _);
|
|
5571
5613
|
return le(xe(de(f, E), de(c, E), E, !0), E);
|
|
5572
5614
|
}
|
|
5573
|
-
function
|
|
5615
|
+
function Ce(f, c) {
|
|
5574
5616
|
return typeof f == "string" ? f = le(de(f, c), c) : i(f) === "object" && (f = de(le(f, c), c)), f;
|
|
5575
5617
|
}
|
|
5576
5618
|
function ot(f, c, _) {
|
|
@@ -5592,13 +5634,13 @@ var uri$1 = {}, uri_all = { exports: {} };
|
|
|
5592
5634
|
var E = String(c.scheme).toLowerCase() === "https";
|
|
5593
5635
|
return (c.port === (E ? 443 : 80) || c.port === "") && (c.port = void 0), c.path || (c.path = "/"), c;
|
|
5594
5636
|
}
|
|
5595
|
-
},
|
|
5637
|
+
}, It = {
|
|
5596
5638
|
scheme: "https",
|
|
5597
5639
|
domainHost: Ne.domainHost,
|
|
5598
5640
|
parse: Ne.parse,
|
|
5599
5641
|
serialize: Ne.serialize
|
|
5600
5642
|
};
|
|
5601
|
-
function
|
|
5643
|
+
function jt(f) {
|
|
5602
5644
|
return typeof f.secure == "boolean" ? f.secure : String(f.scheme).toLowerCase() === "wss";
|
|
5603
5645
|
}
|
|
5604
5646
|
var at = {
|
|
@@ -5606,26 +5648,26 @@ var uri$1 = {}, uri_all = { exports: {} };
|
|
|
5606
5648
|
domainHost: !0,
|
|
5607
5649
|
parse: function(c, _) {
|
|
5608
5650
|
var E = c;
|
|
5609
|
-
return E.secure =
|
|
5651
|
+
return E.secure = jt(E), E.resourceName = (E.path || "/") + (E.query ? "?" + E.query : ""), E.path = void 0, E.query = void 0, E;
|
|
5610
5652
|
},
|
|
5611
5653
|
serialize: function(c, _) {
|
|
5612
|
-
if ((c.port === (
|
|
5654
|
+
if ((c.port === (jt(c) ? 443 : 80) || c.port === "") && (c.port = void 0), typeof c.secure == "boolean" && (c.scheme = c.secure ? "wss" : "ws", c.secure = void 0), c.resourceName) {
|
|
5613
5655
|
var E = c.resourceName.split("?"), b = O(E, 2), U = b[0], L = b[1];
|
|
5614
5656
|
c.path = U && U !== "/" ? U : void 0, c.query = L, c.resourceName = void 0;
|
|
5615
5657
|
}
|
|
5616
5658
|
return c.fragment = void 0, c;
|
|
5617
5659
|
}
|
|
5618
|
-
},
|
|
5660
|
+
}, At = {
|
|
5619
5661
|
scheme: "wss",
|
|
5620
5662
|
domainHost: at.domainHost,
|
|
5621
5663
|
parse: at.parse,
|
|
5622
5664
|
serialize: at.serialize
|
|
5623
|
-
},
|
|
5665
|
+
}, ir = {}, Dt = "[A-Za-z0-9\\-\\.\\_\\~\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]", _e = "[0-9A-Fa-f]", or = s(s("%[EFef]" + _e + "%" + _e + _e + "%" + _e + _e) + "|" + s("%[89A-Fa-f]" + _e + "%" + _e + _e) + "|" + s("%" + _e + _e)), ar = "[A-Za-z0-9\\!\\$\\%\\'\\*\\+\\-\\^\\_\\`\\{\\|\\}\\~]", cr = "[\\!\\$\\%\\'\\(\\)\\*\\+\\,\\-\\.0-9\\<\\>A-Z\\x5E-\\x7E]", lr = n(cr, '[\\"\\\\]'), dr = "[\\!\\$\\'\\(\\)\\*\\+\\,\\;\\:\\@]", ur = new RegExp(Dt, "g"), We = new RegExp(or, "g"), pr = new RegExp(n("[^]", ar, "[\\.]", '[\\"]', lr), "g"), Ft = new RegExp(n("[^]", Dt, dr), "g"), fr = Ft;
|
|
5624
5666
|
function Ct(f) {
|
|
5625
5667
|
var c = W(f);
|
|
5626
|
-
return c.match(
|
|
5668
|
+
return c.match(ur) ? c : f;
|
|
5627
5669
|
}
|
|
5628
|
-
var
|
|
5670
|
+
var Mt = {
|
|
5629
5671
|
scheme: "mailto",
|
|
5630
5672
|
parse: function(c, _) {
|
|
5631
5673
|
var E = c, b = E.to = E.path ? E.path.split(",") : [];
|
|
@@ -5634,8 +5676,8 @@ var uri$1 = {}, uri_all = { exports: {} };
|
|
|
5634
5676
|
var B = J[Y].split("=");
|
|
5635
5677
|
switch (B[0]) {
|
|
5636
5678
|
case "to":
|
|
5637
|
-
for (var
|
|
5638
|
-
b.push(
|
|
5679
|
+
for (var Z = B[1].split(","), ie = 0, z = Z.length; ie < z; ++ie)
|
|
5680
|
+
b.push(Z[ie]);
|
|
5639
5681
|
break;
|
|
5640
5682
|
case "subject":
|
|
5641
5683
|
E.subject = pe(B[1], _);
|
|
@@ -5658,8 +5700,8 @@ var uri$1 = {}, uri_all = { exports: {} };
|
|
|
5658
5700
|
else
|
|
5659
5701
|
try {
|
|
5660
5702
|
ee[1] = C.toASCII(pe(ee[1], _).toLowerCase());
|
|
5661
|
-
} catch (
|
|
5662
|
-
E.error = E.error || "Email address's domain name can not be converted to ASCII via punycode: " +
|
|
5703
|
+
} catch (Se) {
|
|
5704
|
+
E.error = E.error || "Email address's domain name can not be converted to ASCII via punycode: " + Se;
|
|
5663
5705
|
}
|
|
5664
5706
|
b[X] = ee.join("@");
|
|
5665
5707
|
}
|
|
@@ -5669,7 +5711,7 @@ var uri$1 = {}, uri_all = { exports: {} };
|
|
|
5669
5711
|
var E = c, b = l(c.to);
|
|
5670
5712
|
if (b) {
|
|
5671
5713
|
for (var U = 0, L = b.length; U < L; ++U) {
|
|
5672
|
-
var J = String(b[U]), Y = J.lastIndexOf("@"), se = J.slice(0, Y).replace(We, Ct).replace(We, o).replace(
|
|
5714
|
+
var J = String(b[U]), Y = J.lastIndexOf("@"), se = J.slice(0, Y).replace(We, Ct).replace(We, o).replace(pr, q), B = J.slice(Y + 1);
|
|
5673
5715
|
try {
|
|
5674
5716
|
B = _.iri ? C.toUnicode(B) : C.toASCII(pe(B, _).toLowerCase());
|
|
5675
5717
|
} catch (X) {
|
|
@@ -5679,17 +5721,17 @@ var uri$1 = {}, uri_all = { exports: {} };
|
|
|
5679
5721
|
}
|
|
5680
5722
|
E.path = b.join(",");
|
|
5681
5723
|
}
|
|
5682
|
-
var
|
|
5683
|
-
c.subject && (
|
|
5724
|
+
var Z = c.headers = c.headers || {};
|
|
5725
|
+
c.subject && (Z.subject = c.subject), c.body && (Z.body = c.body);
|
|
5684
5726
|
var ie = [];
|
|
5685
|
-
for (var z in
|
|
5686
|
-
|
|
5727
|
+
for (var z in Z)
|
|
5728
|
+
Z[z] !== ir[z] && ie.push(z.replace(We, Ct).replace(We, o).replace(Ft, q) + "=" + Z[z].replace(We, Ct).replace(We, o).replace(fr, q));
|
|
5687
5729
|
return ie.length && (E.query = ie.join("&")), E;
|
|
5688
5730
|
}
|
|
5689
|
-
},
|
|
5731
|
+
}, hr = /^([^\:]+)\:(.*)/, qt = {
|
|
5690
5732
|
scheme: "urn",
|
|
5691
5733
|
parse: function(c, _) {
|
|
5692
|
-
var E = c.path && c.path.match(
|
|
5734
|
+
var E = c.path && c.path.match(hr), b = c;
|
|
5693
5735
|
if (E) {
|
|
5694
5736
|
var U = _.scheme || b.scheme || "urn", L = E[1].toLowerCase(), J = E[2], Y = U + ":" + (_.nid || L), se = M[Y];
|
|
5695
5737
|
b.nid = L, b.nss = J, b.path = void 0, se && (b = se.parse(b, _));
|
|
@@ -5703,18 +5745,18 @@ var uri$1 = {}, uri_all = { exports: {} };
|
|
|
5703
5745
|
var J = c, Y = c.nss;
|
|
5704
5746
|
return J.path = (b || _.nid) + ":" + Y, J;
|
|
5705
5747
|
}
|
|
5706
|
-
},
|
|
5748
|
+
}, mr = /^[0-9A-Fa-f]{8}(?:\-[0-9A-Fa-f]{4}){3}\-[0-9A-Fa-f]{12}$/, Ut = {
|
|
5707
5749
|
scheme: "urn:uuid",
|
|
5708
5750
|
parse: function(c, _) {
|
|
5709
5751
|
var E = c;
|
|
5710
|
-
return E.uuid = E.nss, E.nss = void 0, !_.tolerant && (!E.uuid || !E.uuid.match(
|
|
5752
|
+
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;
|
|
5711
5753
|
},
|
|
5712
5754
|
serialize: function(c, _) {
|
|
5713
5755
|
var E = c;
|
|
5714
5756
|
return E.nss = (c.uuid || "").toLowerCase(), E;
|
|
5715
5757
|
}
|
|
5716
5758
|
};
|
|
5717
|
-
M[Ne.scheme] = Ne, M[
|
|
5759
|
+
M[Ne.scheme] = Ne, M[It.scheme] = It, M[at.scheme] = at, M[At.scheme] = At, M[Mt.scheme] = Mt, M[qt.scheme] = qt, M[Ut.scheme] = Ut, r.SCHEMES = M, r.pctEncChar = q, r.pctDecChars = W, r.parse = de, r.removeDotSegments = me, r.serialize = le, r.resolveComponents = xe, r.resolve = it, r.normalize = Ce, r.equal = ot, r.escapeComponent = ut, r.unescapeComponent = pe, Object.defineProperty(r, "__esModule", { value: !0 });
|
|
5718
5760
|
});
|
|
5719
5761
|
})(uri_all, uri_all.exports);
|
|
5720
5762
|
var uri_allExports = uri_all.exports;
|
|
@@ -5744,7 +5786,7 @@ uri$1.default = uri;
|
|
|
5744
5786
|
} });
|
|
5745
5787
|
const n = validation_error, s = ref_error, i = rules, o = compile, l = codegen, d = resolve$1, u = dataType, p = util, $ = require$$9, O = uri$1, N = (F, y) => new RegExp(F, y);
|
|
5746
5788
|
N.code = "new RegExp";
|
|
5747
|
-
const
|
|
5789
|
+
const T = ["removeAdditional", "useDefaults", "coerceTypes"], v = /* @__PURE__ */ new Set([
|
|
5748
5790
|
"validate",
|
|
5749
5791
|
"serialize",
|
|
5750
5792
|
"parse",
|
|
@@ -5779,15 +5821,15 @@ uri$1.default = uri;
|
|
|
5779
5821
|
jsPropertySyntax: "",
|
|
5780
5822
|
unicode: '"minLength"/"maxLength" account for unicode characters by default.'
|
|
5781
5823
|
}, R = 200;
|
|
5782
|
-
function
|
|
5824
|
+
function S(F) {
|
|
5783
5825
|
var y, j, P, a, h, C, M, q, W, G, ne, he, Le, tt, rt, de, nt, He, Ve, ze, st, me, le, xe, it;
|
|
5784
|
-
const
|
|
5826
|
+
const Ce = F.strict, ot = (y = F.code) === null || y === void 0 ? void 0 : y.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 : N, Ne = (a = F.uriResolver) !== null && a !== void 0 ? a : O.default;
|
|
5785
5827
|
return {
|
|
5786
|
-
strictSchema: (C = (h = F.strictSchema) !== null && h !== void 0 ? h :
|
|
5787
|
-
strictNumbers: (q = (M = F.strictNumbers) !== null && M !== void 0 ? M :
|
|
5788
|
-
strictTypes: (G = (W = F.strictTypes) !== null && W !== void 0 ? W :
|
|
5789
|
-
strictTuples: (he = (ne = F.strictTuples) !== null && ne !== void 0 ? ne :
|
|
5790
|
-
strictRequired: (tt = (Le = F.strictRequired) !== null && Le !== void 0 ? Le :
|
|
5828
|
+
strictSchema: (C = (h = F.strictSchema) !== null && h !== void 0 ? h : Ce) !== null && C !== void 0 ? C : !0,
|
|
5829
|
+
strictNumbers: (q = (M = F.strictNumbers) !== null && M !== void 0 ? M : Ce) !== null && q !== void 0 ? q : !0,
|
|
5830
|
+
strictTypes: (G = (W = F.strictTypes) !== null && W !== void 0 ? W : Ce) !== null && G !== void 0 ? G : "log",
|
|
5831
|
+
strictTuples: (he = (ne = F.strictTuples) !== null && ne !== void 0 ? ne : Ce) !== null && he !== void 0 ? he : "log",
|
|
5832
|
+
strictRequired: (tt = (Le = F.strictRequired) !== null && Le !== void 0 ? Le : Ce) !== null && tt !== void 0 ? tt : !1,
|
|
5791
5833
|
code: F.code ? { ...F.code, optimize: ut, regExp: pe } : { optimize: ut, regExp: pe },
|
|
5792
5834
|
loopRequired: (rt = F.loopRequired) !== null && rt !== void 0 ? rt : R,
|
|
5793
5835
|
loopEnum: (de = F.loopEnum) !== null && de !== void 0 ? de : R,
|
|
@@ -5805,7 +5847,7 @@ uri$1.default = uri;
|
|
|
5805
5847
|
}
|
|
5806
5848
|
class I {
|
|
5807
5849
|
constructor(y = {}) {
|
|
5808
|
-
this.schemas = {}, this.refs = {}, this.formats = {}, this._compilations = /* @__PURE__ */ new Set(), this._loading = {}, this._cache = /* @__PURE__ */ new Map(), y = this.opts = { ...y, ...
|
|
5850
|
+
this.schemas = {}, this.refs = {}, this.formats = {}, this._compilations = /* @__PURE__ */ new Set(), this._loading = {}, this._cache = /* @__PURE__ */ new Map(), y = this.opts = { ...y, ...S(y) };
|
|
5809
5851
|
const { es5: j, lines: P } = this.opts.code;
|
|
5810
5852
|
this.scope = new l.ValueScope({ scope: {}, prefixes: v, es5: j, lines: P }), this.logger = K(y.logger);
|
|
5811
5853
|
const a = y.validateFormats;
|
|
@@ -6100,7 +6142,7 @@ uri$1.default = uri;
|
|
|
6100
6142
|
}
|
|
6101
6143
|
function x() {
|
|
6102
6144
|
const F = { ...this.opts };
|
|
6103
|
-
for (const y of
|
|
6145
|
+
for (const y of T)
|
|
6104
6146
|
delete F[y];
|
|
6105
6147
|
return F;
|
|
6106
6148
|
}
|
|
@@ -6145,9 +6187,9 @@ uri$1.default = uri;
|
|
|
6145
6187
|
schemaType: (0, u.getJSONTypes)(y.schemaType)
|
|
6146
6188
|
}
|
|
6147
6189
|
};
|
|
6148
|
-
y.before ?
|
|
6190
|
+
y.before ? Oe.call(this, C, M, y.before) : C.rules.push(M), h.all[F] = M, (P = y.implements) === null || P === void 0 || P.forEach((q) => this.addKeyword(q));
|
|
6149
6191
|
}
|
|
6150
|
-
function
|
|
6192
|
+
function Oe(F, y, j) {
|
|
6151
6193
|
const P = F.rules.findIndex((a) => a.keyword === j);
|
|
6152
6194
|
P >= 0 ? F.rules.splice(P, 0, y) : (F.rules.push(y), this.logger.warn(`rule ${j} is not defined`));
|
|
6153
6195
|
}
|
|
@@ -6190,16 +6232,16 @@ const ref_error_1 = ref_error, code_1$8 = code, codegen_1$l = codegen, names_1$1
|
|
|
6190
6232
|
function $() {
|
|
6191
6233
|
if (i === u)
|
|
6192
6234
|
return callRef(e, o, i, i.$async);
|
|
6193
|
-
const
|
|
6194
|
-
return callRef(e, (0, codegen_1$l._)`${
|
|
6235
|
+
const T = t.scopeValue("root", { ref: u });
|
|
6236
|
+
return callRef(e, (0, codegen_1$l._)`${T}.validate`, u, u.$async);
|
|
6195
6237
|
}
|
|
6196
|
-
function O(
|
|
6197
|
-
const v = getValidate(e,
|
|
6198
|
-
callRef(e, v,
|
|
6238
|
+
function O(T) {
|
|
6239
|
+
const v = getValidate(e, T);
|
|
6240
|
+
callRef(e, v, T, T.$async);
|
|
6199
6241
|
}
|
|
6200
|
-
function N(
|
|
6201
|
-
const v = t.scopeValue("schema", l.code.source === !0 ? { ref:
|
|
6202
|
-
schema:
|
|
6242
|
+
function N(T) {
|
|
6243
|
+
const v = t.scopeValue("schema", l.code.source === !0 ? { ref: T, code: (0, codegen_1$l.stringify)(T) } : { ref: T }), g = t.name("valid"), m = e.subschema({
|
|
6244
|
+
schema: T,
|
|
6203
6245
|
dataTypes: [],
|
|
6204
6246
|
schemaPath: codegen_1$l.nil,
|
|
6205
6247
|
topSchemaRef: v,
|
|
@@ -6220,21 +6262,21 @@ function callRef(e, t, r, n) {
|
|
|
6220
6262
|
function p() {
|
|
6221
6263
|
if (!l.$async)
|
|
6222
6264
|
throw new Error("async schema referenced by sync schema");
|
|
6223
|
-
const
|
|
6265
|
+
const T = s.let("valid");
|
|
6224
6266
|
s.try(() => {
|
|
6225
|
-
s.code((0, codegen_1$l._)`await ${(0, code_1$8.callValidateCode)(e, t, u)}`), N(t), o || s.assign(
|
|
6267
|
+
s.code((0, codegen_1$l._)`await ${(0, code_1$8.callValidateCode)(e, t, u)}`), N(t), o || s.assign(T, !0);
|
|
6226
6268
|
}, (v) => {
|
|
6227
|
-
s.if((0, codegen_1$l._)`!(${v} instanceof ${i.ValidationError})`, () => s.throw(v)), O(v), o || s.assign(
|
|
6228
|
-
}), e.ok(
|
|
6269
|
+
s.if((0, codegen_1$l._)`!(${v} instanceof ${i.ValidationError})`, () => s.throw(v)), O(v), o || s.assign(T, !1);
|
|
6270
|
+
}), e.ok(T);
|
|
6229
6271
|
}
|
|
6230
6272
|
function $() {
|
|
6231
6273
|
e.result((0, code_1$8.callValidateCode)(e, t, u), () => N(t), () => O(t));
|
|
6232
6274
|
}
|
|
6233
|
-
function O(
|
|
6234
|
-
const v = (0, codegen_1$l._)`${
|
|
6275
|
+
function O(T) {
|
|
6276
|
+
const v = (0, codegen_1$l._)`${T}.errors`;
|
|
6235
6277
|
s.assign(names_1$1.default.vErrors, (0, codegen_1$l._)`${names_1$1.default.vErrors} === null ? ${v} : ${names_1$1.default.vErrors}.concat(${v})`), s.assign(names_1$1.default.errors, (0, codegen_1$l._)`${names_1$1.default.vErrors}.length`);
|
|
6236
6278
|
}
|
|
6237
|
-
function N(
|
|
6279
|
+
function N(T) {
|
|
6238
6280
|
var v;
|
|
6239
6281
|
if (!i.opts.unevaluated)
|
|
6240
6282
|
return;
|
|
@@ -6243,14 +6285,14 @@ function callRef(e, t, r, n) {
|
|
|
6243
6285
|
if (g && !g.dynamicProps)
|
|
6244
6286
|
g.props !== void 0 && (i.props = util_1$j.mergeEvaluated.props(s, g.props, i.props));
|
|
6245
6287
|
else {
|
|
6246
|
-
const m = s.var("props", (0, codegen_1$l._)`${
|
|
6288
|
+
const m = s.var("props", (0, codegen_1$l._)`${T}.evaluated.props`);
|
|
6247
6289
|
i.props = util_1$j.mergeEvaluated.props(s, m, i.props, codegen_1$l.Name);
|
|
6248
6290
|
}
|
|
6249
6291
|
if (i.items !== !0)
|
|
6250
6292
|
if (g && !g.dynamicItems)
|
|
6251
6293
|
g.items !== void 0 && (i.items = util_1$j.mergeEvaluated.items(s, g.items, i.items));
|
|
6252
6294
|
else {
|
|
6253
|
-
const m = s.var("items", (0, codegen_1$l._)`${
|
|
6295
|
+
const m = s.var("items", (0, codegen_1$l._)`${T}.evaluated.items`);
|
|
6254
6296
|
i.items = util_1$j.mergeEvaluated.items(s, m, i.items, codegen_1$l.Name);
|
|
6255
6297
|
}
|
|
6256
6298
|
}
|
|
@@ -6392,9 +6434,9 @@ const code_1$6 = code, codegen_1$f = codegen, util_1$h = util, error$d = {
|
|
|
6392
6434
|
return;
|
|
6393
6435
|
const d = r.length >= l.loopRequired;
|
|
6394
6436
|
if (o.allErrors ? u() : p(), l.strictRequired) {
|
|
6395
|
-
const N = e.parentSchema.properties, { definedProperties:
|
|
6437
|
+
const N = e.parentSchema.properties, { definedProperties: T } = e.it;
|
|
6396
6438
|
for (const v of r)
|
|
6397
|
-
if ((N == null ? void 0 : N[v]) === void 0 && !
|
|
6439
|
+
if ((N == null ? void 0 : N[v]) === void 0 && !T.has(v)) {
|
|
6398
6440
|
const g = o.schemaEnv.baseId + o.errSchemaPath, m = `required property "${v}" is not defined at "${g}" (strictRequired)`;
|
|
6399
6441
|
(0, util_1$h.checkStrictMode)(o, m, o.opts.strictRequired);
|
|
6400
6442
|
}
|
|
@@ -6409,8 +6451,8 @@ const code_1$6 = code, codegen_1$f = codegen, util_1$h = util, error$d = {
|
|
|
6409
6451
|
function p() {
|
|
6410
6452
|
const N = t.let("missing");
|
|
6411
6453
|
if (d || i) {
|
|
6412
|
-
const
|
|
6413
|
-
e.block$data(
|
|
6454
|
+
const T = t.let("valid", !0);
|
|
6455
|
+
e.block$data(T, () => O(N, T)), e.ok(T);
|
|
6414
6456
|
} else
|
|
6415
6457
|
t.if((0, code_1$6.checkMissingProp)(e, r, N)), (0, code_1$6.reportMissingProp)(e, N), t.else();
|
|
6416
6458
|
}
|
|
@@ -6419,9 +6461,9 @@ const code_1$6 = code, codegen_1$f = codegen, util_1$h = util, error$d = {
|
|
|
6419
6461
|
e.setParams({ missingProperty: N }), t.if((0, code_1$6.noPropertyInData)(t, s, N, l.ownProperties), () => e.error());
|
|
6420
6462
|
});
|
|
6421
6463
|
}
|
|
6422
|
-
function O(N,
|
|
6464
|
+
function O(N, T) {
|
|
6423
6465
|
e.setParams({ missingProperty: N }), t.forOf(N, n, () => {
|
|
6424
|
-
t.assign(
|
|
6466
|
+
t.assign(T, (0, code_1$6.propertyInData)(t, s, N, l.ownProperties)), t.if((0, codegen_1$f.not)(T), () => {
|
|
6425
6467
|
e.error(), t.break();
|
|
6426
6468
|
});
|
|
6427
6469
|
}, codegen_1$f.nil);
|
|
@@ -6471,23 +6513,23 @@ const dataType_1 = dataType, codegen_1$d = codegen, util_1$g = util, equal_1$2 =
|
|
|
6471
6513
|
const d = t.let("valid"), u = i.items ? (0, dataType_1.getSchemaTypes)(i.items) : [];
|
|
6472
6514
|
e.block$data(d, p, (0, codegen_1$d._)`${o} === false`), e.ok(d);
|
|
6473
6515
|
function p() {
|
|
6474
|
-
const
|
|
6475
|
-
e.setParams({ i:
|
|
6516
|
+
const T = t.let("i", (0, codegen_1$d._)`${r}.length`), v = t.let("j");
|
|
6517
|
+
e.setParams({ i: T, j: v }), t.assign(d, !0), t.if((0, codegen_1$d._)`${T} > 1`, () => ($() ? O : N)(T, v));
|
|
6476
6518
|
}
|
|
6477
6519
|
function $() {
|
|
6478
|
-
return u.length > 0 && !u.some((
|
|
6520
|
+
return u.length > 0 && !u.some((T) => T === "object" || T === "array");
|
|
6479
6521
|
}
|
|
6480
|
-
function O(
|
|
6522
|
+
function O(T, v) {
|
|
6481
6523
|
const g = t.name("item"), m = (0, dataType_1.checkDataTypes)(u, g, l.opts.strictNumbers, dataType_1.DataType.Wrong), R = t.const("indices", (0, codegen_1$d._)`{}`);
|
|
6482
|
-
t.for((0, codegen_1$d._)`;${
|
|
6483
|
-
t.let(g, (0, codegen_1$d._)`${r}[${
|
|
6524
|
+
t.for((0, codegen_1$d._)`;${T}--;`, () => {
|
|
6525
|
+
t.let(g, (0, codegen_1$d._)`${r}[${T}]`), t.if(m, (0, codegen_1$d._)`continue`), u.length > 1 && t.if((0, codegen_1$d._)`typeof ${g} == "string"`, (0, codegen_1$d._)`${g} += "_"`), t.if((0, codegen_1$d._)`typeof ${R}[${g}] == "number"`, () => {
|
|
6484
6526
|
t.assign(v, (0, codegen_1$d._)`${R}[${g}]`), e.error(), t.assign(d, !1).break();
|
|
6485
|
-
}).code((0, codegen_1$d._)`${R}[${g}] = ${
|
|
6527
|
+
}).code((0, codegen_1$d._)`${R}[${g}] = ${T}`);
|
|
6486
6528
|
});
|
|
6487
6529
|
}
|
|
6488
|
-
function N(
|
|
6530
|
+
function N(T, v) {
|
|
6489
6531
|
const g = (0, util_1$g.useFunc)(t, equal_1$2.default), m = t.name("outer");
|
|
6490
|
-
t.label(m).for((0, codegen_1$d._)`;${
|
|
6532
|
+
t.label(m).for((0, codegen_1$d._)`;${T}--;`, () => t.for((0, codegen_1$d._)`${v} = ${T}; ${v}--;`, () => t.if((0, codegen_1$d._)`${g}(${r}[${T}], ${r}[${v}])`, () => {
|
|
6491
6533
|
e.error(), t.assign(d, !1).break(m);
|
|
6492
6534
|
})));
|
|
6493
6535
|
}
|
|
@@ -6533,15 +6575,15 @@ const codegen_1$b = codegen, util_1$e = util, equal_1 = equal$1, error$9 = {
|
|
|
6533
6575
|
if (!Array.isArray(s))
|
|
6534
6576
|
throw new Error("ajv implementation error");
|
|
6535
6577
|
const N = t.const("vSchema", i);
|
|
6536
|
-
p = (0, codegen_1$b.or)(...s.map((
|
|
6578
|
+
p = (0, codegen_1$b.or)(...s.map((T, v) => O(N, v)));
|
|
6537
6579
|
}
|
|
6538
6580
|
e.pass(p);
|
|
6539
6581
|
function $() {
|
|
6540
6582
|
t.assign(p, !1), t.forOf("v", i, (N) => t.if((0, codegen_1$b._)`${u()}(${r}, ${N})`, () => t.assign(p, !0).break()));
|
|
6541
6583
|
}
|
|
6542
|
-
function O(N,
|
|
6543
|
-
const v = s[
|
|
6544
|
-
return typeof v == "object" && v !== null ? (0, codegen_1$b._)`${u()}(${r}, ${N}[${
|
|
6584
|
+
function O(N, T) {
|
|
6585
|
+
const v = s[T];
|
|
6586
|
+
return typeof v == "object" && v !== null ? (0, codegen_1$b._)`${u()}(${r}, ${N}[${T}])` : (0, codegen_1$b._)`${r} === ${v}`;
|
|
6545
6587
|
}
|
|
6546
6588
|
}
|
|
6547
6589
|
};
|
|
@@ -6633,9 +6675,9 @@ function validateTuple(e, t, r = e.schema) {
|
|
|
6633
6675
|
}, d)), e.ok(d));
|
|
6634
6676
|
});
|
|
6635
6677
|
function p($) {
|
|
6636
|
-
const { opts: O, errSchemaPath: N } = l,
|
|
6678
|
+
const { opts: O, errSchemaPath: N } = l, T = r.length, v = T === $.minItems && (T === $.maxItems || $[t] === !1);
|
|
6637
6679
|
if (O.strictTuples && !v) {
|
|
6638
|
-
const g = `"${o}" is ${
|
|
6680
|
+
const g = `"${o}" is ${T}-tuple, but minItems or maxItems/${t} are not specified or different at path "${N}"`;
|
|
6639
6681
|
(0, util_1$c.checkStrictMode)(l, g, O.strictTuples);
|
|
6640
6682
|
}
|
|
6641
6683
|
}
|
|
@@ -6704,7 +6746,7 @@ const codegen_1$7 = codegen, util_1$a = util, error$6 = {
|
|
|
6704
6746
|
l === void 0 && o === 1 ? N($, () => t.if($, () => t.break())) : o === 0 ? (t.let($, !0), l !== void 0 && t.if((0, codegen_1$7._)`${s}.length > 0`, O)) : (t.let($, !1), O()), e.result($, () => e.reset());
|
|
6705
6747
|
function O() {
|
|
6706
6748
|
const v = t.name("_valid"), g = t.let("count", 0);
|
|
6707
|
-
N(v, () => t.if(v, () =>
|
|
6749
|
+
N(v, () => t.if(v, () => T(g)));
|
|
6708
6750
|
}
|
|
6709
6751
|
function N(v, g) {
|
|
6710
6752
|
t.forRange("i", 0, p, (m) => {
|
|
@@ -6716,7 +6758,7 @@ const codegen_1$7 = codegen, util_1$a = util, error$6 = {
|
|
|
6716
6758
|
}, v), g();
|
|
6717
6759
|
});
|
|
6718
6760
|
}
|
|
6719
|
-
function
|
|
6761
|
+
function T(v) {
|
|
6720
6762
|
t.code((0, codegen_1$7._)`${v}++`), l === void 0 ? t.if((0, codegen_1$7._)`${v} >= ${o}`, () => t.assign($, !0).break()) : (t.if((0, codegen_1$7._)`${v} > ${l}`, () => t.assign($, !1).break()), o === 1 ? t.assign($, !0) : t.if((0, codegen_1$7._)`${v} >= ${o}`, () => t.assign($, !0)));
|
|
6721
6763
|
}
|
|
6722
6764
|
}
|
|
@@ -6762,13 +6804,13 @@ var dependencies = {};
|
|
|
6762
6804
|
if (Object.keys(u).length === 0)
|
|
6763
6805
|
return;
|
|
6764
6806
|
const N = p.let("missing");
|
|
6765
|
-
for (const
|
|
6766
|
-
const v = u[
|
|
6807
|
+
for (const T in u) {
|
|
6808
|
+
const v = u[T];
|
|
6767
6809
|
if (v.length === 0)
|
|
6768
6810
|
continue;
|
|
6769
|
-
const g = (0, n.propertyInData)(p, $,
|
|
6811
|
+
const g = (0, n.propertyInData)(p, $, T, O.opts.ownProperties);
|
|
6770
6812
|
d.setParams({
|
|
6771
|
-
property:
|
|
6813
|
+
property: T,
|
|
6772
6814
|
depsCount: v.length,
|
|
6773
6815
|
deps: v.join(", ")
|
|
6774
6816
|
}), O.allErrors ? p.if(g, () => {
|
|
@@ -6779,17 +6821,17 @@ var dependencies = {};
|
|
|
6779
6821
|
}
|
|
6780
6822
|
e.validatePropertyDeps = o;
|
|
6781
6823
|
function l(d, u = d.schema) {
|
|
6782
|
-
const { gen: p, data: $, keyword: O, it: N } = d,
|
|
6824
|
+
const { gen: p, data: $, keyword: O, it: N } = d, T = p.name("valid");
|
|
6783
6825
|
for (const v in u)
|
|
6784
6826
|
(0, r.alwaysValidSchema)(N, u[v]) || (p.if(
|
|
6785
6827
|
(0, n.propertyInData)(p, $, v, N.opts.ownProperties),
|
|
6786
6828
|
() => {
|
|
6787
|
-
const g = d.subschema({ keyword: O, schemaProp: v },
|
|
6788
|
-
d.mergeValidEvaluated(g,
|
|
6829
|
+
const g = d.subschema({ keyword: O, schemaProp: v }, T);
|
|
6830
|
+
d.mergeValidEvaluated(g, T);
|
|
6789
6831
|
},
|
|
6790
|
-
() => p.var(
|
|
6832
|
+
() => p.var(T, !0)
|
|
6791
6833
|
// TODO var
|
|
6792
|
-
), d.ok(
|
|
6834
|
+
), d.ok(T));
|
|
6793
6835
|
}
|
|
6794
6836
|
e.validateSchemaDeps = l, e.default = s;
|
|
6795
6837
|
})(dependencies);
|
|
@@ -6845,7 +6887,7 @@ const code_1$3 = code, codegen_1$5 = codegen, names_1 = names$1, util_1$8 = util
|
|
|
6845
6887
|
$(), e.ok((0, codegen_1$5._)`${i} === ${names_1.default.errors}`);
|
|
6846
6888
|
function $() {
|
|
6847
6889
|
t.forIn("key", s, (g) => {
|
|
6848
|
-
!u.length && !p.length ?
|
|
6890
|
+
!u.length && !p.length ? T(g) : t.if(O(g), () => T(g));
|
|
6849
6891
|
});
|
|
6850
6892
|
}
|
|
6851
6893
|
function O(g) {
|
|
@@ -6860,7 +6902,7 @@ const code_1$3 = code, codegen_1$5 = codegen, names_1 = names$1, util_1$8 = util
|
|
|
6860
6902
|
function N(g) {
|
|
6861
6903
|
t.code((0, codegen_1$5._)`delete ${s}[${g}]`);
|
|
6862
6904
|
}
|
|
6863
|
-
function
|
|
6905
|
+
function T(g) {
|
|
6864
6906
|
if (d.removeAdditional === "all" || d.removeAdditional && r === !1) {
|
|
6865
6907
|
N(g);
|
|
6866
6908
|
return;
|
|
@@ -6877,16 +6919,16 @@ const code_1$3 = code, codegen_1$5 = codegen, names_1 = names$1, util_1$8 = util
|
|
|
6877
6919
|
}
|
|
6878
6920
|
}
|
|
6879
6921
|
function v(g, m, R) {
|
|
6880
|
-
const
|
|
6922
|
+
const S = {
|
|
6881
6923
|
keyword: "additionalProperties",
|
|
6882
6924
|
dataProp: g,
|
|
6883
6925
|
dataPropType: util_1$8.Type.Str
|
|
6884
6926
|
};
|
|
6885
|
-
R === !1 && Object.assign(
|
|
6927
|
+
R === !1 && Object.assign(S, {
|
|
6886
6928
|
compositeRule: !0,
|
|
6887
6929
|
createErrors: !1,
|
|
6888
6930
|
allErrors: !1
|
|
6889
|
-
}), e.subschema(
|
|
6931
|
+
}), e.subschema(S, m);
|
|
6890
6932
|
}
|
|
6891
6933
|
}
|
|
6892
6934
|
};
|
|
@@ -6939,13 +6981,13 @@ const code_1$1 = code, codegen_1$4 = codegen, util_1$6 = util, util_2 = util, de
|
|
|
6939
6981
|
O();
|
|
6940
6982
|
function O() {
|
|
6941
6983
|
for (const v of l)
|
|
6942
|
-
u && N(v), i.allErrors ?
|
|
6984
|
+
u && N(v), i.allErrors ? T(v) : (t.var(p, !0), T(v), t.if(p));
|
|
6943
6985
|
}
|
|
6944
6986
|
function N(v) {
|
|
6945
6987
|
for (const g in u)
|
|
6946
6988
|
new RegExp(v).test(g) && (0, util_1$6.checkStrictMode)(i, `property ${g} matches pattern ${v} (use allowMatchingProperties)`);
|
|
6947
6989
|
}
|
|
6948
|
-
function
|
|
6990
|
+
function T(v) {
|
|
6949
6991
|
t.forIn("key", n, (g) => {
|
|
6950
6992
|
t.if((0, codegen_1$4._)`${(0, code_1$1.usePattern)(e, v)}.test(${g})`, () => {
|
|
6951
6993
|
const m = d.includes(v);
|
|
@@ -7139,28 +7181,28 @@ const codegen_1$1 = codegen, error$1 = {
|
|
|
7139
7181
|
return;
|
|
7140
7182
|
s ? O() : N();
|
|
7141
7183
|
function O() {
|
|
7142
|
-
const
|
|
7184
|
+
const T = r.scopeValue("formats", {
|
|
7143
7185
|
ref: $.formats,
|
|
7144
7186
|
code: d.code.formats
|
|
7145
|
-
}), v = r.const("fDef", (0, codegen_1$1._)`${
|
|
7146
|
-
r.if((0, codegen_1$1._)`typeof ${v} == "object" && !(${v} instanceof RegExp)`, () => r.assign(g, (0, codegen_1$1._)`${v}.type || "string"`).assign(m, (0, codegen_1$1._)`${v}.validate`), () => r.assign(g, (0, codegen_1$1._)`"string"`).assign(m, v)), e.fail$data((0, codegen_1$1.or)(R(),
|
|
7187
|
+
}), v = r.const("fDef", (0, codegen_1$1._)`${T}[${o}]`), g = r.let("fType"), m = r.let("format");
|
|
7188
|
+
r.if((0, codegen_1$1._)`typeof ${v} == "object" && !(${v} instanceof RegExp)`, () => r.assign(g, (0, codegen_1$1._)`${v}.type || "string"`).assign(m, (0, codegen_1$1._)`${v}.validate`), () => r.assign(g, (0, codegen_1$1._)`"string"`).assign(m, v)), e.fail$data((0, codegen_1$1.or)(R(), S()));
|
|
7147
7189
|
function R() {
|
|
7148
7190
|
return d.strictSchema === !1 ? codegen_1$1.nil : (0, codegen_1$1._)`${o} && !${m}`;
|
|
7149
7191
|
}
|
|
7150
|
-
function
|
|
7192
|
+
function S() {
|
|
7151
7193
|
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}))`;
|
|
7152
7194
|
return (0, codegen_1$1._)`${m} && ${m} !== true && ${g} === ${t} && !${D}`;
|
|
7153
7195
|
}
|
|
7154
7196
|
}
|
|
7155
7197
|
function N() {
|
|
7156
|
-
const
|
|
7157
|
-
if (!
|
|
7198
|
+
const T = $.formats[i];
|
|
7199
|
+
if (!T) {
|
|
7158
7200
|
R();
|
|
7159
7201
|
return;
|
|
7160
7202
|
}
|
|
7161
|
-
if (
|
|
7203
|
+
if (T === !0)
|
|
7162
7204
|
return;
|
|
7163
|
-
const [v, g, m] = T
|
|
7205
|
+
const [v, g, m] = S(T);
|
|
7164
7206
|
v === t && e.pass(I());
|
|
7165
7207
|
function R() {
|
|
7166
7208
|
if (d.strictSchema === !1) {
|
|
@@ -7172,12 +7214,12 @@ const codegen_1$1 = codegen, error$1 = {
|
|
|
7172
7214
|
return `unknown format "${i}" ignored in schema at path "${u}"`;
|
|
7173
7215
|
}
|
|
7174
7216
|
}
|
|
7175
|
-
function
|
|
7217
|
+
function S(D) {
|
|
7176
7218
|
const w = D instanceof RegExp ? (0, codegen_1$1.regexpCode)(D) : d.code.formats ? (0, codegen_1$1._)`${d.code.formats}${(0, codegen_1$1.getProperty)(i)}` : void 0, k = r.scopeValue("formats", { key: i, ref: D, code: w });
|
|
7177
7219
|
return typeof D == "object" && !(D instanceof RegExp) ? [D.type || "string", D.validate, (0, codegen_1$1._)`${k}.validate`] : ["string", D, k];
|
|
7178
7220
|
}
|
|
7179
7221
|
function I() {
|
|
7180
|
-
if (typeof
|
|
7222
|
+
if (typeof T == "object" && !(T instanceof RegExp) && T.async) {
|
|
7181
7223
|
if (!p.$async)
|
|
7182
7224
|
throw new Error("async format in sync schema");
|
|
7183
7225
|
return (0, codegen_1$1._)`await ${m}(${n})`;
|
|
@@ -7249,17 +7291,17 @@ const codegen_1 = codegen, types_1 = types, compile_1 = compile, util_1 = util,
|
|
|
7249
7291
|
function p() {
|
|
7250
7292
|
const N = O();
|
|
7251
7293
|
t.if(!1);
|
|
7252
|
-
for (const
|
|
7253
|
-
t.elseIf((0, codegen_1._)`${u} === ${
|
|
7294
|
+
for (const T in N)
|
|
7295
|
+
t.elseIf((0, codegen_1._)`${u} === ${T}`), t.assign(d, $(N[T]));
|
|
7254
7296
|
t.else(), e.error(!1, { discrError: types_1.DiscrError.Mapping, tag: u, tagName: l }), t.endIf();
|
|
7255
7297
|
}
|
|
7256
7298
|
function $(N) {
|
|
7257
|
-
const
|
|
7258
|
-
return e.mergeEvaluated(v, codegen_1.Name),
|
|
7299
|
+
const T = t.name("valid"), v = e.subschema({ keyword: "oneOf", schemaProp: N }, T);
|
|
7300
|
+
return e.mergeEvaluated(v, codegen_1.Name), T;
|
|
7259
7301
|
}
|
|
7260
7302
|
function O() {
|
|
7261
7303
|
var N;
|
|
7262
|
-
const
|
|
7304
|
+
const T = {}, v = m(s);
|
|
7263
7305
|
let g = !0;
|
|
7264
7306
|
for (let I = 0; I < o.length; I++) {
|
|
7265
7307
|
let D = o[I];
|
|
@@ -7271,23 +7313,23 @@ const codegen_1 = codegen, types_1 = types, compile_1 = compile, util_1 = util,
|
|
|
7271
7313
|
}
|
|
7272
7314
|
if (!g)
|
|
7273
7315
|
throw new Error(`discriminator: "${l}" must be required`);
|
|
7274
|
-
return
|
|
7316
|
+
return T;
|
|
7275
7317
|
function m({ required: I }) {
|
|
7276
7318
|
return Array.isArray(I) && I.includes(l);
|
|
7277
7319
|
}
|
|
7278
7320
|
function R(I, D) {
|
|
7279
7321
|
if (I.const)
|
|
7280
|
-
|
|
7322
|
+
S(I.const, D);
|
|
7281
7323
|
else if (I.enum)
|
|
7282
7324
|
for (const w of I.enum)
|
|
7283
|
-
|
|
7325
|
+
S(w, D);
|
|
7284
7326
|
else
|
|
7285
7327
|
throw new Error(`discriminator: "properties/${l}" must have "const" or "enum"`);
|
|
7286
7328
|
}
|
|
7287
|
-
function
|
|
7288
|
-
if (typeof I != "string" || I in
|
|
7329
|
+
function S(I, D) {
|
|
7330
|
+
if (typeof I != "string" || I in T)
|
|
7289
7331
|
throw new Error(`discriminator: "${l}" values must be unique strings`);
|
|
7290
|
-
|
|
7332
|
+
T[I] = D;
|
|
7291
7333
|
}
|
|
7292
7334
|
}
|
|
7293
7335
|
}
|
|
@@ -7539,13 +7581,13 @@ const $schema$1 = "http://json-schema.org/draft-07/schema#", $id = "http://json-
|
|
|
7539
7581
|
const r = core$2, n = draft7, s = discriminator, i = require$$3, o = ["/properties"], l = "http://json-schema.org/draft-07/schema";
|
|
7540
7582
|
class d extends r.default {
|
|
7541
7583
|
_addVocabularies() {
|
|
7542
|
-
super._addVocabularies(), n.default.forEach((
|
|
7584
|
+
super._addVocabularies(), n.default.forEach((T) => this.addVocabulary(T)), this.opts.discriminator && this.addKeyword(s.default);
|
|
7543
7585
|
}
|
|
7544
7586
|
_addDefaultMetaSchema() {
|
|
7545
7587
|
if (super._addDefaultMetaSchema(), !this.opts.meta)
|
|
7546
7588
|
return;
|
|
7547
|
-
const
|
|
7548
|
-
this.addMetaSchema(
|
|
7589
|
+
const T = this.opts.$data ? this.$dataMetaSchema(i, o) : i;
|
|
7590
|
+
this.addMetaSchema(T, l, !1), this.refs["http://json-schema.org/schema"] = l;
|
|
7549
7591
|
}
|
|
7550
7592
|
defaultMeta() {
|
|
7551
7593
|
return this.opts.defaultMeta = super.defaultMeta() || (this.getSchema(l) ? l : void 0);
|
|
@@ -9063,7 +9105,7 @@ function compileBlueprint(e, {
|
|
|
9063
9105
|
onStepCompleted: n = () => {
|
|
9064
9106
|
}
|
|
9065
9107
|
} = {}) {
|
|
9066
|
-
var p, $, O, N,
|
|
9108
|
+
var p, $, O, N, T;
|
|
9067
9109
|
if (e = {
|
|
9068
9110
|
...e,
|
|
9069
9111
|
steps: (e.steps || []).filter(isStepDefinition)
|
|
@@ -9148,7 +9190,7 @@ function compileBlueprint(e, {
|
|
|
9148
9190
|
),
|
|
9149
9191
|
features: {
|
|
9150
9192
|
// Disable networking by default
|
|
9151
|
-
networking: ((
|
|
9193
|
+
networking: ((T = e.features) == null ? void 0 : T.networking) ?? !1
|
|
9152
9194
|
},
|
|
9153
9195
|
run: async (v) => {
|
|
9154
9196
|
try {
|
|
@@ -9157,16 +9199,14 @@ function compileBlueprint(e, {
|
|
|
9157
9199
|
m.setPlayground(v), m.isAsync && m.resolve();
|
|
9158
9200
|
for (const [g, { run: m, step: R }] of Object.entries(u))
|
|
9159
9201
|
try {
|
|
9160
|
-
const
|
|
9161
|
-
n(
|
|
9162
|
-
} catch (
|
|
9163
|
-
throw console.error(
|
|
9202
|
+
const S = await m(v);
|
|
9203
|
+
n(S, R);
|
|
9204
|
+
} catch (S) {
|
|
9205
|
+
throw console.error(S), new Error(
|
|
9164
9206
|
`Error when executing the blueprint step #${g} (${JSON.stringify(
|
|
9165
9207
|
R
|
|
9166
|
-
)})
|
|
9167
|
-
{
|
|
9168
|
-
cause: T
|
|
9169
|
-
}
|
|
9208
|
+
)}) ${S instanceof Error ? `: ${S.message}` : S}`,
|
|
9209
|
+
{ cause: S }
|
|
9170
9210
|
);
|
|
9171
9211
|
}
|
|
9172
9212
|
} finally {
|