@postman-cse/onboarding-bootstrap 0.13.1 → 0.14.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +42 -0
- package/action.yml +26 -0
- package/dist/action.cjs +1218 -531
- package/dist/cli.cjs +1244 -557
- package/dist/index.cjs +1218 -531
- package/package.json +1 -1
package/dist/cli.cjs
CHANGED
|
@@ -1070,14 +1070,14 @@ var require_util = __commonJS({
|
|
|
1070
1070
|
}
|
|
1071
1071
|
const port = url.port != null ? url.port : url.protocol === "https:" ? 443 : 80;
|
|
1072
1072
|
let origin = url.origin != null ? url.origin : `${url.protocol || ""}//${url.hostname || ""}:${port}`;
|
|
1073
|
-
let
|
|
1073
|
+
let path6 = url.path != null ? url.path : `${url.pathname || ""}${url.search || ""}`;
|
|
1074
1074
|
if (origin[origin.length - 1] === "/") {
|
|
1075
1075
|
origin = origin.slice(0, origin.length - 1);
|
|
1076
1076
|
}
|
|
1077
|
-
if (
|
|
1078
|
-
|
|
1077
|
+
if (path6 && path6[0] !== "/") {
|
|
1078
|
+
path6 = `/${path6}`;
|
|
1079
1079
|
}
|
|
1080
|
-
return new URL(`${origin}${
|
|
1080
|
+
return new URL(`${origin}${path6}`);
|
|
1081
1081
|
}
|
|
1082
1082
|
if (!isHttpOrHttpsPrefixed(url.origin || url.protocol)) {
|
|
1083
1083
|
throw new InvalidArgumentError("Invalid URL protocol: the URL must start with `http:` or `https:`.");
|
|
@@ -1528,39 +1528,39 @@ var require_diagnostics = __commonJS({
|
|
|
1528
1528
|
});
|
|
1529
1529
|
diagnosticsChannel.channel("undici:client:sendHeaders").subscribe((evt) => {
|
|
1530
1530
|
const {
|
|
1531
|
-
request: { method, path:
|
|
1531
|
+
request: { method, path: path6, origin }
|
|
1532
1532
|
} = evt;
|
|
1533
|
-
debuglog("sending request to %s %s/%s", method, origin,
|
|
1533
|
+
debuglog("sending request to %s %s/%s", method, origin, path6);
|
|
1534
1534
|
});
|
|
1535
1535
|
diagnosticsChannel.channel("undici:request:headers").subscribe((evt) => {
|
|
1536
1536
|
const {
|
|
1537
|
-
request: { method, path:
|
|
1537
|
+
request: { method, path: path6, origin },
|
|
1538
1538
|
response: { statusCode }
|
|
1539
1539
|
} = evt;
|
|
1540
1540
|
debuglog(
|
|
1541
1541
|
"received response to %s %s/%s - HTTP %d",
|
|
1542
1542
|
method,
|
|
1543
1543
|
origin,
|
|
1544
|
-
|
|
1544
|
+
path6,
|
|
1545
1545
|
statusCode
|
|
1546
1546
|
);
|
|
1547
1547
|
});
|
|
1548
1548
|
diagnosticsChannel.channel("undici:request:trailers").subscribe((evt) => {
|
|
1549
1549
|
const {
|
|
1550
|
-
request: { method, path:
|
|
1550
|
+
request: { method, path: path6, origin }
|
|
1551
1551
|
} = evt;
|
|
1552
|
-
debuglog("trailers received from %s %s/%s", method, origin,
|
|
1552
|
+
debuglog("trailers received from %s %s/%s", method, origin, path6);
|
|
1553
1553
|
});
|
|
1554
1554
|
diagnosticsChannel.channel("undici:request:error").subscribe((evt) => {
|
|
1555
1555
|
const {
|
|
1556
|
-
request: { method, path:
|
|
1556
|
+
request: { method, path: path6, origin },
|
|
1557
1557
|
error
|
|
1558
1558
|
} = evt;
|
|
1559
1559
|
debuglog(
|
|
1560
1560
|
"request to %s %s/%s errored - %s",
|
|
1561
1561
|
method,
|
|
1562
1562
|
origin,
|
|
1563
|
-
|
|
1563
|
+
path6,
|
|
1564
1564
|
error.message
|
|
1565
1565
|
);
|
|
1566
1566
|
});
|
|
@@ -1609,9 +1609,9 @@ var require_diagnostics = __commonJS({
|
|
|
1609
1609
|
});
|
|
1610
1610
|
diagnosticsChannel.channel("undici:client:sendHeaders").subscribe((evt) => {
|
|
1611
1611
|
const {
|
|
1612
|
-
request: { method, path:
|
|
1612
|
+
request: { method, path: path6, origin }
|
|
1613
1613
|
} = evt;
|
|
1614
|
-
debuglog("sending request to %s %s/%s", method, origin,
|
|
1614
|
+
debuglog("sending request to %s %s/%s", method, origin, path6);
|
|
1615
1615
|
});
|
|
1616
1616
|
}
|
|
1617
1617
|
diagnosticsChannel.channel("undici:websocket:open").subscribe((evt) => {
|
|
@@ -1674,7 +1674,7 @@ var require_request = __commonJS({
|
|
|
1674
1674
|
var kHandler = /* @__PURE__ */ Symbol("handler");
|
|
1675
1675
|
var Request = class {
|
|
1676
1676
|
constructor(origin, {
|
|
1677
|
-
path:
|
|
1677
|
+
path: path6,
|
|
1678
1678
|
method,
|
|
1679
1679
|
body,
|
|
1680
1680
|
headers,
|
|
@@ -1689,11 +1689,11 @@ var require_request = __commonJS({
|
|
|
1689
1689
|
expectContinue,
|
|
1690
1690
|
servername
|
|
1691
1691
|
}, handler) {
|
|
1692
|
-
if (typeof
|
|
1692
|
+
if (typeof path6 !== "string") {
|
|
1693
1693
|
throw new InvalidArgumentError("path must be a string");
|
|
1694
|
-
} else if (
|
|
1694
|
+
} else if (path6[0] !== "/" && !(path6.startsWith("http://") || path6.startsWith("https://")) && method !== "CONNECT") {
|
|
1695
1695
|
throw new InvalidArgumentError("path must be an absolute URL or start with a slash");
|
|
1696
|
-
} else if (invalidPathRegex.test(
|
|
1696
|
+
} else if (invalidPathRegex.test(path6)) {
|
|
1697
1697
|
throw new InvalidArgumentError("invalid request path");
|
|
1698
1698
|
}
|
|
1699
1699
|
if (typeof method !== "string") {
|
|
@@ -1759,7 +1759,7 @@ var require_request = __commonJS({
|
|
|
1759
1759
|
this.completed = false;
|
|
1760
1760
|
this.aborted = false;
|
|
1761
1761
|
this.upgrade = upgrade || null;
|
|
1762
|
-
this.path = query ? buildURL(
|
|
1762
|
+
this.path = query ? buildURL(path6, query) : path6;
|
|
1763
1763
|
this.origin = origin;
|
|
1764
1764
|
this.idempotent = idempotent == null ? method === "HEAD" || method === "GET" : idempotent;
|
|
1765
1765
|
this.blocking = blocking == null ? false : blocking;
|
|
@@ -6323,7 +6323,7 @@ var require_client_h1 = __commonJS({
|
|
|
6323
6323
|
return method !== "GET" && method !== "HEAD" && method !== "OPTIONS" && method !== "TRACE" && method !== "CONNECT";
|
|
6324
6324
|
}
|
|
6325
6325
|
function writeH1(client, request) {
|
|
6326
|
-
const { method, path:
|
|
6326
|
+
const { method, path: path6, host, upgrade, blocking, reset } = request;
|
|
6327
6327
|
let { body, headers, contentLength } = request;
|
|
6328
6328
|
const expectsPayload = method === "PUT" || method === "POST" || method === "PATCH" || method === "QUERY" || method === "PROPFIND" || method === "PROPPATCH";
|
|
6329
6329
|
if (util.isFormDataLike(body)) {
|
|
@@ -6389,7 +6389,7 @@ var require_client_h1 = __commonJS({
|
|
|
6389
6389
|
if (blocking) {
|
|
6390
6390
|
socket[kBlocking] = true;
|
|
6391
6391
|
}
|
|
6392
|
-
let header = `${method} ${
|
|
6392
|
+
let header = `${method} ${path6} HTTP/1.1\r
|
|
6393
6393
|
`;
|
|
6394
6394
|
if (typeof host === "string") {
|
|
6395
6395
|
header += `host: ${host}\r
|
|
@@ -6915,7 +6915,7 @@ var require_client_h2 = __commonJS({
|
|
|
6915
6915
|
}
|
|
6916
6916
|
function writeH2(client, request) {
|
|
6917
6917
|
const session = client[kHTTP2Session];
|
|
6918
|
-
const { method, path:
|
|
6918
|
+
const { method, path: path6, host, upgrade, expectContinue, signal, headers: reqHeaders } = request;
|
|
6919
6919
|
let { body } = request;
|
|
6920
6920
|
if (upgrade) {
|
|
6921
6921
|
util.errorRequest(client, request, new Error("Upgrade not supported for H2"));
|
|
@@ -6982,7 +6982,7 @@ var require_client_h2 = __commonJS({
|
|
|
6982
6982
|
});
|
|
6983
6983
|
return true;
|
|
6984
6984
|
}
|
|
6985
|
-
headers[HTTP2_HEADER_PATH] =
|
|
6985
|
+
headers[HTTP2_HEADER_PATH] = path6;
|
|
6986
6986
|
headers[HTTP2_HEADER_SCHEME] = "https";
|
|
6987
6987
|
const expectsPayload = method === "PUT" || method === "POST" || method === "PATCH";
|
|
6988
6988
|
if (body && typeof body.read === "function") {
|
|
@@ -7335,9 +7335,9 @@ var require_redirect_handler = __commonJS({
|
|
|
7335
7335
|
return this.handler.onHeaders(statusCode, headers, resume, statusText);
|
|
7336
7336
|
}
|
|
7337
7337
|
const { origin, pathname, search } = util.parseURL(new URL(this.location, this.opts.origin && new URL(this.opts.path, this.opts.origin)));
|
|
7338
|
-
const
|
|
7338
|
+
const path6 = search ? `${pathname}${search}` : pathname;
|
|
7339
7339
|
this.opts.headers = cleanRequestHeaders(this.opts.headers, statusCode === 303, this.opts.origin !== origin);
|
|
7340
|
-
this.opts.path =
|
|
7340
|
+
this.opts.path = path6;
|
|
7341
7341
|
this.opts.origin = origin;
|
|
7342
7342
|
this.opts.maxRedirections = 0;
|
|
7343
7343
|
this.opts.query = null;
|
|
@@ -8572,10 +8572,10 @@ var require_proxy_agent = __commonJS({
|
|
|
8572
8572
|
};
|
|
8573
8573
|
const {
|
|
8574
8574
|
origin,
|
|
8575
|
-
path:
|
|
8575
|
+
path: path6 = "/",
|
|
8576
8576
|
headers = {}
|
|
8577
8577
|
} = opts;
|
|
8578
|
-
opts.path = origin +
|
|
8578
|
+
opts.path = origin + path6;
|
|
8579
8579
|
if (!("host" in headers) && !("Host" in headers)) {
|
|
8580
8580
|
const { host } = new URL3(origin);
|
|
8581
8581
|
headers.host = host;
|
|
@@ -10496,20 +10496,20 @@ var require_mock_utils = __commonJS({
|
|
|
10496
10496
|
}
|
|
10497
10497
|
return true;
|
|
10498
10498
|
}
|
|
10499
|
-
function safeUrl(
|
|
10500
|
-
if (typeof
|
|
10501
|
-
return
|
|
10499
|
+
function safeUrl(path6) {
|
|
10500
|
+
if (typeof path6 !== "string") {
|
|
10501
|
+
return path6;
|
|
10502
10502
|
}
|
|
10503
|
-
const pathSegments =
|
|
10503
|
+
const pathSegments = path6.split("?");
|
|
10504
10504
|
if (pathSegments.length !== 2) {
|
|
10505
|
-
return
|
|
10505
|
+
return path6;
|
|
10506
10506
|
}
|
|
10507
10507
|
const qp = new URLSearchParams(pathSegments.pop());
|
|
10508
10508
|
qp.sort();
|
|
10509
10509
|
return [...pathSegments, qp.toString()].join("?");
|
|
10510
10510
|
}
|
|
10511
|
-
function matchKey(mockDispatch2, { path:
|
|
10512
|
-
const pathMatch = matchValue(mockDispatch2.path,
|
|
10511
|
+
function matchKey(mockDispatch2, { path: path6, method, body, headers }) {
|
|
10512
|
+
const pathMatch = matchValue(mockDispatch2.path, path6);
|
|
10513
10513
|
const methodMatch = matchValue(mockDispatch2.method, method);
|
|
10514
10514
|
const bodyMatch = typeof mockDispatch2.body !== "undefined" ? matchValue(mockDispatch2.body, body) : true;
|
|
10515
10515
|
const headersMatch = matchHeaders(mockDispatch2, headers);
|
|
@@ -10531,7 +10531,7 @@ var require_mock_utils = __commonJS({
|
|
|
10531
10531
|
function getMockDispatch(mockDispatches, key) {
|
|
10532
10532
|
const basePath = key.query ? buildURL(key.path, key.query) : key.path;
|
|
10533
10533
|
const resolvedPath = typeof basePath === "string" ? safeUrl(basePath) : basePath;
|
|
10534
|
-
let matchedMockDispatches = mockDispatches.filter(({ consumed }) => !consumed).filter(({ path:
|
|
10534
|
+
let matchedMockDispatches = mockDispatches.filter(({ consumed }) => !consumed).filter(({ path: path6 }) => matchValue(safeUrl(path6), resolvedPath));
|
|
10535
10535
|
if (matchedMockDispatches.length === 0) {
|
|
10536
10536
|
throw new MockNotMatchedError(`Mock dispatch not matched for path '${resolvedPath}'`);
|
|
10537
10537
|
}
|
|
@@ -10569,9 +10569,9 @@ var require_mock_utils = __commonJS({
|
|
|
10569
10569
|
}
|
|
10570
10570
|
}
|
|
10571
10571
|
function buildKey(opts) {
|
|
10572
|
-
const { path:
|
|
10572
|
+
const { path: path6, method, body, headers, query } = opts;
|
|
10573
10573
|
return {
|
|
10574
|
-
path:
|
|
10574
|
+
path: path6,
|
|
10575
10575
|
method,
|
|
10576
10576
|
body,
|
|
10577
10577
|
headers,
|
|
@@ -11034,10 +11034,10 @@ var require_pending_interceptors_formatter = __commonJS({
|
|
|
11034
11034
|
}
|
|
11035
11035
|
format(pendingInterceptors) {
|
|
11036
11036
|
const withPrettyHeaders = pendingInterceptors.map(
|
|
11037
|
-
({ method, path:
|
|
11037
|
+
({ method, path: path6, data: { statusCode }, persist, times, timesInvoked, origin }) => ({
|
|
11038
11038
|
Method: method,
|
|
11039
11039
|
Origin: origin,
|
|
11040
|
-
Path:
|
|
11040
|
+
Path: path6,
|
|
11041
11041
|
"Status code": statusCode,
|
|
11042
11042
|
Persistent: persist ? PERSISTENT : NOT_PERSISTENT,
|
|
11043
11043
|
Invocations: timesInvoked,
|
|
@@ -11889,9 +11889,9 @@ var require_headers = __commonJS({
|
|
|
11889
11889
|
return array;
|
|
11890
11890
|
}
|
|
11891
11891
|
const iterator = this[kHeadersMap][Symbol.iterator]();
|
|
11892
|
-
const
|
|
11893
|
-
array[0] = [
|
|
11894
|
-
assert(
|
|
11892
|
+
const firstValue2 = iterator.next().value;
|
|
11893
|
+
array[0] = [firstValue2[0], firstValue2[1].value];
|
|
11894
|
+
assert(firstValue2[1].value !== null);
|
|
11895
11895
|
for (let i = 1, j = 0, right = 0, left = 0, pivot = 0, x, value; i < size; ++i) {
|
|
11896
11896
|
value = iterator.next().value;
|
|
11897
11897
|
x = array[i] = [value[0], value[1].value];
|
|
@@ -15918,9 +15918,9 @@ var require_util6 = __commonJS({
|
|
|
15918
15918
|
}
|
|
15919
15919
|
}
|
|
15920
15920
|
}
|
|
15921
|
-
function validateCookiePath(
|
|
15922
|
-
for (let i = 0; i <
|
|
15923
|
-
const code =
|
|
15921
|
+
function validateCookiePath(path6) {
|
|
15922
|
+
for (let i = 0; i < path6.length; ++i) {
|
|
15923
|
+
const code = path6.charCodeAt(i);
|
|
15924
15924
|
if (code < 32 || // exclude CTLs (0-31)
|
|
15925
15925
|
code === 127 || // DEL
|
|
15926
15926
|
code === 59) {
|
|
@@ -18597,11 +18597,11 @@ var require_undici = __commonJS({
|
|
|
18597
18597
|
if (typeof opts.path !== "string") {
|
|
18598
18598
|
throw new InvalidArgumentError("invalid opts.path");
|
|
18599
18599
|
}
|
|
18600
|
-
let
|
|
18600
|
+
let path6 = opts.path;
|
|
18601
18601
|
if (!opts.path.startsWith("/")) {
|
|
18602
|
-
|
|
18602
|
+
path6 = `/${path6}`;
|
|
18603
18603
|
}
|
|
18604
|
-
url = new URL(util.parseOrigin(url).origin +
|
|
18604
|
+
url = new URL(util.parseOrigin(url).origin + path6);
|
|
18605
18605
|
} else {
|
|
18606
18606
|
if (!opts) {
|
|
18607
18607
|
opts = typeof url === "object" ? url : {};
|
|
@@ -18749,17 +18749,17 @@ var require_visit = __commonJS({
|
|
|
18749
18749
|
visit.BREAK = BREAK;
|
|
18750
18750
|
visit.SKIP = SKIP;
|
|
18751
18751
|
visit.REMOVE = REMOVE;
|
|
18752
|
-
function visit_(key, node, visitor,
|
|
18753
|
-
const ctrl = callVisitor(key, node, visitor,
|
|
18752
|
+
function visit_(key, node, visitor, path6) {
|
|
18753
|
+
const ctrl = callVisitor(key, node, visitor, path6);
|
|
18754
18754
|
if (identity.isNode(ctrl) || identity.isPair(ctrl)) {
|
|
18755
|
-
replaceNode(key,
|
|
18756
|
-
return visit_(key, ctrl, visitor,
|
|
18755
|
+
replaceNode(key, path6, ctrl);
|
|
18756
|
+
return visit_(key, ctrl, visitor, path6);
|
|
18757
18757
|
}
|
|
18758
18758
|
if (typeof ctrl !== "symbol") {
|
|
18759
18759
|
if (identity.isCollection(node)) {
|
|
18760
|
-
|
|
18760
|
+
path6 = Object.freeze(path6.concat(node));
|
|
18761
18761
|
for (let i = 0; i < node.items.length; ++i) {
|
|
18762
|
-
const ci = visit_(i, node.items[i], visitor,
|
|
18762
|
+
const ci = visit_(i, node.items[i], visitor, path6);
|
|
18763
18763
|
if (typeof ci === "number")
|
|
18764
18764
|
i = ci - 1;
|
|
18765
18765
|
else if (ci === BREAK)
|
|
@@ -18770,13 +18770,13 @@ var require_visit = __commonJS({
|
|
|
18770
18770
|
}
|
|
18771
18771
|
}
|
|
18772
18772
|
} else if (identity.isPair(node)) {
|
|
18773
|
-
|
|
18774
|
-
const ck = visit_("key", node.key, visitor,
|
|
18773
|
+
path6 = Object.freeze(path6.concat(node));
|
|
18774
|
+
const ck = visit_("key", node.key, visitor, path6);
|
|
18775
18775
|
if (ck === BREAK)
|
|
18776
18776
|
return BREAK;
|
|
18777
18777
|
else if (ck === REMOVE)
|
|
18778
18778
|
node.key = null;
|
|
18779
|
-
const cv = visit_("value", node.value, visitor,
|
|
18779
|
+
const cv = visit_("value", node.value, visitor, path6);
|
|
18780
18780
|
if (cv === BREAK)
|
|
18781
18781
|
return BREAK;
|
|
18782
18782
|
else if (cv === REMOVE)
|
|
@@ -18797,17 +18797,17 @@ var require_visit = __commonJS({
|
|
|
18797
18797
|
visitAsync.BREAK = BREAK;
|
|
18798
18798
|
visitAsync.SKIP = SKIP;
|
|
18799
18799
|
visitAsync.REMOVE = REMOVE;
|
|
18800
|
-
async function visitAsync_(key, node, visitor,
|
|
18801
|
-
const ctrl = await callVisitor(key, node, visitor,
|
|
18800
|
+
async function visitAsync_(key, node, visitor, path6) {
|
|
18801
|
+
const ctrl = await callVisitor(key, node, visitor, path6);
|
|
18802
18802
|
if (identity.isNode(ctrl) || identity.isPair(ctrl)) {
|
|
18803
|
-
replaceNode(key,
|
|
18804
|
-
return visitAsync_(key, ctrl, visitor,
|
|
18803
|
+
replaceNode(key, path6, ctrl);
|
|
18804
|
+
return visitAsync_(key, ctrl, visitor, path6);
|
|
18805
18805
|
}
|
|
18806
18806
|
if (typeof ctrl !== "symbol") {
|
|
18807
18807
|
if (identity.isCollection(node)) {
|
|
18808
|
-
|
|
18808
|
+
path6 = Object.freeze(path6.concat(node));
|
|
18809
18809
|
for (let i = 0; i < node.items.length; ++i) {
|
|
18810
|
-
const ci = await visitAsync_(i, node.items[i], visitor,
|
|
18810
|
+
const ci = await visitAsync_(i, node.items[i], visitor, path6);
|
|
18811
18811
|
if (typeof ci === "number")
|
|
18812
18812
|
i = ci - 1;
|
|
18813
18813
|
else if (ci === BREAK)
|
|
@@ -18818,13 +18818,13 @@ var require_visit = __commonJS({
|
|
|
18818
18818
|
}
|
|
18819
18819
|
}
|
|
18820
18820
|
} else if (identity.isPair(node)) {
|
|
18821
|
-
|
|
18822
|
-
const ck = await visitAsync_("key", node.key, visitor,
|
|
18821
|
+
path6 = Object.freeze(path6.concat(node));
|
|
18822
|
+
const ck = await visitAsync_("key", node.key, visitor, path6);
|
|
18823
18823
|
if (ck === BREAK)
|
|
18824
18824
|
return BREAK;
|
|
18825
18825
|
else if (ck === REMOVE)
|
|
18826
18826
|
node.key = null;
|
|
18827
|
-
const cv = await visitAsync_("value", node.value, visitor,
|
|
18827
|
+
const cv = await visitAsync_("value", node.value, visitor, path6);
|
|
18828
18828
|
if (cv === BREAK)
|
|
18829
18829
|
return BREAK;
|
|
18830
18830
|
else if (cv === REMOVE)
|
|
@@ -18851,23 +18851,23 @@ var require_visit = __commonJS({
|
|
|
18851
18851
|
}
|
|
18852
18852
|
return visitor;
|
|
18853
18853
|
}
|
|
18854
|
-
function callVisitor(key, node, visitor,
|
|
18854
|
+
function callVisitor(key, node, visitor, path6) {
|
|
18855
18855
|
if (typeof visitor === "function")
|
|
18856
|
-
return visitor(key, node,
|
|
18856
|
+
return visitor(key, node, path6);
|
|
18857
18857
|
if (identity.isMap(node))
|
|
18858
|
-
return visitor.Map?.(key, node,
|
|
18858
|
+
return visitor.Map?.(key, node, path6);
|
|
18859
18859
|
if (identity.isSeq(node))
|
|
18860
|
-
return visitor.Seq?.(key, node,
|
|
18860
|
+
return visitor.Seq?.(key, node, path6);
|
|
18861
18861
|
if (identity.isPair(node))
|
|
18862
|
-
return visitor.Pair?.(key, node,
|
|
18862
|
+
return visitor.Pair?.(key, node, path6);
|
|
18863
18863
|
if (identity.isScalar(node))
|
|
18864
|
-
return visitor.Scalar?.(key, node,
|
|
18864
|
+
return visitor.Scalar?.(key, node, path6);
|
|
18865
18865
|
if (identity.isAlias(node))
|
|
18866
|
-
return visitor.Alias?.(key, node,
|
|
18866
|
+
return visitor.Alias?.(key, node, path6);
|
|
18867
18867
|
return void 0;
|
|
18868
18868
|
}
|
|
18869
|
-
function replaceNode(key,
|
|
18870
|
-
const parent =
|
|
18869
|
+
function replaceNode(key, path6, node) {
|
|
18870
|
+
const parent = path6[path6.length - 1];
|
|
18871
18871
|
if (identity.isCollection(parent)) {
|
|
18872
18872
|
parent.items[key] = node;
|
|
18873
18873
|
} else if (identity.isPair(parent)) {
|
|
@@ -19477,10 +19477,10 @@ var require_Collection = __commonJS({
|
|
|
19477
19477
|
var createNode = require_createNode();
|
|
19478
19478
|
var identity = require_identity();
|
|
19479
19479
|
var Node = require_Node();
|
|
19480
|
-
function collectionFromPath(schema2,
|
|
19480
|
+
function collectionFromPath(schema2, path6, value) {
|
|
19481
19481
|
let v = value;
|
|
19482
|
-
for (let i =
|
|
19483
|
-
const k =
|
|
19482
|
+
for (let i = path6.length - 1; i >= 0; --i) {
|
|
19483
|
+
const k = path6[i];
|
|
19484
19484
|
if (typeof k === "number" && Number.isInteger(k) && k >= 0) {
|
|
19485
19485
|
const a = [];
|
|
19486
19486
|
a[k] = v;
|
|
@@ -19499,7 +19499,7 @@ var require_Collection = __commonJS({
|
|
|
19499
19499
|
sourceObjects: /* @__PURE__ */ new Map()
|
|
19500
19500
|
});
|
|
19501
19501
|
}
|
|
19502
|
-
var isEmptyPath = (
|
|
19502
|
+
var isEmptyPath = (path6) => path6 == null || typeof path6 === "object" && !!path6[Symbol.iterator]().next().done;
|
|
19503
19503
|
var Collection = class extends Node.NodeBase {
|
|
19504
19504
|
constructor(type2, schema2) {
|
|
19505
19505
|
super(type2);
|
|
@@ -19529,11 +19529,11 @@ var require_Collection = __commonJS({
|
|
|
19529
19529
|
* be a Pair instance or a `{ key, value }` object, which may not have a key
|
|
19530
19530
|
* that already exists in the map.
|
|
19531
19531
|
*/
|
|
19532
|
-
addIn(
|
|
19533
|
-
if (isEmptyPath(
|
|
19532
|
+
addIn(path6, value) {
|
|
19533
|
+
if (isEmptyPath(path6))
|
|
19534
19534
|
this.add(value);
|
|
19535
19535
|
else {
|
|
19536
|
-
const [key, ...rest] =
|
|
19536
|
+
const [key, ...rest] = path6;
|
|
19537
19537
|
const node = this.get(key, true);
|
|
19538
19538
|
if (identity.isCollection(node))
|
|
19539
19539
|
node.addIn(rest, value);
|
|
@@ -19547,8 +19547,8 @@ var require_Collection = __commonJS({
|
|
|
19547
19547
|
* Removes a value from the collection.
|
|
19548
19548
|
* @returns `true` if the item was found and removed.
|
|
19549
19549
|
*/
|
|
19550
|
-
deleteIn(
|
|
19551
|
-
const [key, ...rest] =
|
|
19550
|
+
deleteIn(path6) {
|
|
19551
|
+
const [key, ...rest] = path6;
|
|
19552
19552
|
if (rest.length === 0)
|
|
19553
19553
|
return this.delete(key);
|
|
19554
19554
|
const node = this.get(key, true);
|
|
@@ -19562,8 +19562,8 @@ var require_Collection = __commonJS({
|
|
|
19562
19562
|
* scalar values from their surrounding node; to disable set `keepScalar` to
|
|
19563
19563
|
* `true` (collections are always returned intact).
|
|
19564
19564
|
*/
|
|
19565
|
-
getIn(
|
|
19566
|
-
const [key, ...rest] =
|
|
19565
|
+
getIn(path6, keepScalar) {
|
|
19566
|
+
const [key, ...rest] = path6;
|
|
19567
19567
|
const node = this.get(key, true);
|
|
19568
19568
|
if (rest.length === 0)
|
|
19569
19569
|
return !keepScalar && identity.isScalar(node) ? node.value : node;
|
|
@@ -19581,8 +19581,8 @@ var require_Collection = __commonJS({
|
|
|
19581
19581
|
/**
|
|
19582
19582
|
* Checks if the collection includes a value with the key `key`.
|
|
19583
19583
|
*/
|
|
19584
|
-
hasIn(
|
|
19585
|
-
const [key, ...rest] =
|
|
19584
|
+
hasIn(path6) {
|
|
19585
|
+
const [key, ...rest] = path6;
|
|
19586
19586
|
if (rest.length === 0)
|
|
19587
19587
|
return this.has(key);
|
|
19588
19588
|
const node = this.get(key, true);
|
|
@@ -19592,8 +19592,8 @@ var require_Collection = __commonJS({
|
|
|
19592
19592
|
* Sets a value in this collection. For `!!set`, `value` needs to be a
|
|
19593
19593
|
* boolean to add/remove the item from the set.
|
|
19594
19594
|
*/
|
|
19595
|
-
setIn(
|
|
19596
|
-
const [key, ...rest] =
|
|
19595
|
+
setIn(path6, value) {
|
|
19596
|
+
const [key, ...rest] = path6;
|
|
19597
19597
|
if (rest.length === 0) {
|
|
19598
19598
|
this.set(key, value);
|
|
19599
19599
|
} else {
|
|
@@ -22108,9 +22108,9 @@ var require_Document = __commonJS({
|
|
|
22108
22108
|
this.contents.add(value);
|
|
22109
22109
|
}
|
|
22110
22110
|
/** Adds a value to the document. */
|
|
22111
|
-
addIn(
|
|
22111
|
+
addIn(path6, value) {
|
|
22112
22112
|
if (assertCollection(this.contents))
|
|
22113
|
-
this.contents.addIn(
|
|
22113
|
+
this.contents.addIn(path6, value);
|
|
22114
22114
|
}
|
|
22115
22115
|
/**
|
|
22116
22116
|
* Create a new `Alias` node, ensuring that the target `node` has the required anchor.
|
|
@@ -22185,14 +22185,14 @@ var require_Document = __commonJS({
|
|
|
22185
22185
|
* Removes a value from the document.
|
|
22186
22186
|
* @returns `true` if the item was found and removed.
|
|
22187
22187
|
*/
|
|
22188
|
-
deleteIn(
|
|
22189
|
-
if (Collection.isEmptyPath(
|
|
22188
|
+
deleteIn(path6) {
|
|
22189
|
+
if (Collection.isEmptyPath(path6)) {
|
|
22190
22190
|
if (this.contents == null)
|
|
22191
22191
|
return false;
|
|
22192
22192
|
this.contents = null;
|
|
22193
22193
|
return true;
|
|
22194
22194
|
}
|
|
22195
|
-
return assertCollection(this.contents) ? this.contents.deleteIn(
|
|
22195
|
+
return assertCollection(this.contents) ? this.contents.deleteIn(path6) : false;
|
|
22196
22196
|
}
|
|
22197
22197
|
/**
|
|
22198
22198
|
* Returns item at `key`, or `undefined` if not found. By default unwraps
|
|
@@ -22207,10 +22207,10 @@ var require_Document = __commonJS({
|
|
|
22207
22207
|
* scalar values from their surrounding node; to disable set `keepScalar` to
|
|
22208
22208
|
* `true` (collections are always returned intact).
|
|
22209
22209
|
*/
|
|
22210
|
-
getIn(
|
|
22211
|
-
if (Collection.isEmptyPath(
|
|
22210
|
+
getIn(path6, keepScalar) {
|
|
22211
|
+
if (Collection.isEmptyPath(path6))
|
|
22212
22212
|
return !keepScalar && identity.isScalar(this.contents) ? this.contents.value : this.contents;
|
|
22213
|
-
return identity.isCollection(this.contents) ? this.contents.getIn(
|
|
22213
|
+
return identity.isCollection(this.contents) ? this.contents.getIn(path6, keepScalar) : void 0;
|
|
22214
22214
|
}
|
|
22215
22215
|
/**
|
|
22216
22216
|
* Checks if the document includes a value with the key `key`.
|
|
@@ -22221,10 +22221,10 @@ var require_Document = __commonJS({
|
|
|
22221
22221
|
/**
|
|
22222
22222
|
* Checks if the document includes a value at `path`.
|
|
22223
22223
|
*/
|
|
22224
|
-
hasIn(
|
|
22225
|
-
if (Collection.isEmptyPath(
|
|
22224
|
+
hasIn(path6) {
|
|
22225
|
+
if (Collection.isEmptyPath(path6))
|
|
22226
22226
|
return this.contents !== void 0;
|
|
22227
|
-
return identity.isCollection(this.contents) ? this.contents.hasIn(
|
|
22227
|
+
return identity.isCollection(this.contents) ? this.contents.hasIn(path6) : false;
|
|
22228
22228
|
}
|
|
22229
22229
|
/**
|
|
22230
22230
|
* Sets a value in this document. For `!!set`, `value` needs to be a
|
|
@@ -22241,13 +22241,13 @@ var require_Document = __commonJS({
|
|
|
22241
22241
|
* Sets a value in this document. For `!!set`, `value` needs to be a
|
|
22242
22242
|
* boolean to add/remove the item from the set.
|
|
22243
22243
|
*/
|
|
22244
|
-
setIn(
|
|
22245
|
-
if (Collection.isEmptyPath(
|
|
22244
|
+
setIn(path6, value) {
|
|
22245
|
+
if (Collection.isEmptyPath(path6)) {
|
|
22246
22246
|
this.contents = value;
|
|
22247
22247
|
} else if (this.contents == null) {
|
|
22248
|
-
this.contents = Collection.collectionFromPath(this.schema, Array.from(
|
|
22248
|
+
this.contents = Collection.collectionFromPath(this.schema, Array.from(path6), value);
|
|
22249
22249
|
} else if (assertCollection(this.contents)) {
|
|
22250
|
-
this.contents.setIn(
|
|
22250
|
+
this.contents.setIn(path6, value);
|
|
22251
22251
|
}
|
|
22252
22252
|
}
|
|
22253
22253
|
/**
|
|
@@ -24207,9 +24207,9 @@ var require_cst_visit = __commonJS({
|
|
|
24207
24207
|
visit.BREAK = BREAK;
|
|
24208
24208
|
visit.SKIP = SKIP;
|
|
24209
24209
|
visit.REMOVE = REMOVE;
|
|
24210
|
-
visit.itemAtPath = (cst,
|
|
24210
|
+
visit.itemAtPath = (cst, path6) => {
|
|
24211
24211
|
let item = cst;
|
|
24212
|
-
for (const [field, index] of
|
|
24212
|
+
for (const [field, index] of path6) {
|
|
24213
24213
|
const tok = item?.[field];
|
|
24214
24214
|
if (tok && "items" in tok) {
|
|
24215
24215
|
item = tok.items[index];
|
|
@@ -24218,23 +24218,23 @@ var require_cst_visit = __commonJS({
|
|
|
24218
24218
|
}
|
|
24219
24219
|
return item;
|
|
24220
24220
|
};
|
|
24221
|
-
visit.parentCollection = (cst,
|
|
24222
|
-
const parent = visit.itemAtPath(cst,
|
|
24223
|
-
const field =
|
|
24221
|
+
visit.parentCollection = (cst, path6) => {
|
|
24222
|
+
const parent = visit.itemAtPath(cst, path6.slice(0, -1));
|
|
24223
|
+
const field = path6[path6.length - 1][0];
|
|
24224
24224
|
const coll = parent?.[field];
|
|
24225
24225
|
if (coll && "items" in coll)
|
|
24226
24226
|
return coll;
|
|
24227
24227
|
throw new Error("Parent collection not found");
|
|
24228
24228
|
};
|
|
24229
|
-
function _visit(
|
|
24230
|
-
let ctrl = visitor(item,
|
|
24229
|
+
function _visit(path6, item, visitor) {
|
|
24230
|
+
let ctrl = visitor(item, path6);
|
|
24231
24231
|
if (typeof ctrl === "symbol")
|
|
24232
24232
|
return ctrl;
|
|
24233
24233
|
for (const field of ["key", "value"]) {
|
|
24234
24234
|
const token = item[field];
|
|
24235
24235
|
if (token && "items" in token) {
|
|
24236
24236
|
for (let i = 0; i < token.items.length; ++i) {
|
|
24237
|
-
const ci = _visit(Object.freeze(
|
|
24237
|
+
const ci = _visit(Object.freeze(path6.concat([[field, i]])), token.items[i], visitor);
|
|
24238
24238
|
if (typeof ci === "number")
|
|
24239
24239
|
i = ci - 1;
|
|
24240
24240
|
else if (ci === BREAK)
|
|
@@ -24245,10 +24245,10 @@ var require_cst_visit = __commonJS({
|
|
|
24245
24245
|
}
|
|
24246
24246
|
}
|
|
24247
24247
|
if (typeof ctrl === "function" && field === "key")
|
|
24248
|
-
ctrl = ctrl(item,
|
|
24248
|
+
ctrl = ctrl(item, path6);
|
|
24249
24249
|
}
|
|
24250
24250
|
}
|
|
24251
|
-
return typeof ctrl === "function" ? ctrl(item,
|
|
24251
|
+
return typeof ctrl === "function" ? ctrl(item, path6) : ctrl;
|
|
24252
24252
|
}
|
|
24253
24253
|
exports2.visit = visit;
|
|
24254
24254
|
}
|
|
@@ -26188,7 +26188,7 @@ var require_scope_functions = __commonJS({
|
|
|
26188
26188
|
var hasOwn = Function.prototype.call.bind(Object.prototype.hasOwnProperty);
|
|
26189
26189
|
hasOwn[/* @__PURE__ */ Symbol.for("toJayString")] = "Function.prototype.call.bind(Object.prototype.hasOwnProperty)";
|
|
26190
26190
|
var pointerPart = (s) => /~\//.test(s) ? `${s}`.replace(/~/g, "~0").replace(/\//g, "~1") : s;
|
|
26191
|
-
var toPointer = (
|
|
26191
|
+
var toPointer = (path6) => path6.length === 0 ? "#" : `#/${path6.map(pointerPart).join("/")}`;
|
|
26192
26192
|
var errorMerge = ({ keywordLocation, instanceLocation }, schemaBase, dataBase) => ({
|
|
26193
26193
|
keywordLocation: `${schemaBase}${keywordLocation.slice(1)}`,
|
|
26194
26194
|
instanceLocation: `${dataBase}${instanceLocation.slice(1)}`
|
|
@@ -26525,7 +26525,7 @@ var require_pointer = __commonJS({
|
|
|
26525
26525
|
throw new Error("Unreachable");
|
|
26526
26526
|
});
|
|
26527
26527
|
}
|
|
26528
|
-
function
|
|
26528
|
+
function get3(obj, pointer, objpath) {
|
|
26529
26529
|
if (typeof obj !== "object") throw new Error("Invalid input object");
|
|
26530
26530
|
if (typeof pointer !== "string") throw new Error("Invalid JSON pointer");
|
|
26531
26531
|
const parts = pointer.split("/");
|
|
@@ -26582,14 +26582,14 @@ var require_pointer = __commonJS({
|
|
|
26582
26582
|
const visit = (sub, oldPath, specialChilds = false, dynamic = false) => {
|
|
26583
26583
|
if (!sub || typeof sub !== "object") return;
|
|
26584
26584
|
const id = sub.$id || sub.id;
|
|
26585
|
-
let
|
|
26585
|
+
let path6 = oldPath;
|
|
26586
26586
|
if (id && typeof id === "string") {
|
|
26587
|
-
|
|
26588
|
-
if (
|
|
26587
|
+
path6 = joinPath(path6, id);
|
|
26588
|
+
if (path6 === ptr || path6 === main && local === "") {
|
|
26589
26589
|
results.push([sub, root, oldPath]);
|
|
26590
|
-
} else if (
|
|
26590
|
+
} else if (path6 === main && local[0] === "/") {
|
|
26591
26591
|
const objpath = [];
|
|
26592
|
-
const res =
|
|
26592
|
+
const res = get3(sub, local, objpath);
|
|
26593
26593
|
if (res !== void 0) results.push([res, root, joinPath(oldPath, objpath2path(objpath))]);
|
|
26594
26594
|
}
|
|
26595
26595
|
}
|
|
@@ -26597,20 +26597,20 @@ var require_pointer = __commonJS({
|
|
|
26597
26597
|
if (anchor && typeof anchor === "string") {
|
|
26598
26598
|
if (anchor.includes("#")) throw new Error("$anchor can't include '#'");
|
|
26599
26599
|
if (anchor.startsWith("/")) throw new Error("$anchor can't start with '/'");
|
|
26600
|
-
|
|
26601
|
-
if (
|
|
26600
|
+
path6 = joinPath(path6, `#${anchor}`);
|
|
26601
|
+
if (path6 === ptr) results.push([sub, root, oldPath]);
|
|
26602
26602
|
}
|
|
26603
26603
|
for (const k of Object.keys(sub)) {
|
|
26604
26604
|
if (!specialChilds && !Array.isArray(sub) && !knownKeywords.includes(k)) continue;
|
|
26605
26605
|
if (!specialChilds && skipChilds.includes(k)) continue;
|
|
26606
|
-
visit(sub[k],
|
|
26606
|
+
visit(sub[k], path6, !specialChilds && withSpecialChilds.includes(k));
|
|
26607
26607
|
}
|
|
26608
26608
|
if (!dynamic && sub.$dynamicAnchor) visit(sub, oldPath, specialChilds, true);
|
|
26609
26609
|
};
|
|
26610
26610
|
visit(root, main);
|
|
26611
26611
|
if (main === base.replace(/#$/, "") && (local[0] === "/" || local === "")) {
|
|
26612
26612
|
const objpath = [];
|
|
26613
|
-
const res =
|
|
26613
|
+
const res = get3(root, local, objpath);
|
|
26614
26614
|
if (res !== void 0) results.push([res, root, objpath2path(objpath)]);
|
|
26615
26615
|
}
|
|
26616
26616
|
if (schemas.has(main) && schemas.get(main) !== root) {
|
|
@@ -26663,7 +26663,7 @@ var require_pointer = __commonJS({
|
|
|
26663
26663
|
}
|
|
26664
26664
|
throw new Error("Unexpected value for 'schemas' option");
|
|
26665
26665
|
};
|
|
26666
|
-
module2.exports = { get:
|
|
26666
|
+
module2.exports = { get: get3, joinPath, resolveReference, getDynamicAnchors, hasKeywords, buildSchemas };
|
|
26667
26667
|
}
|
|
26668
26668
|
});
|
|
26669
26669
|
|
|
@@ -27049,14 +27049,14 @@ var require_compile = __commonJS({
|
|
|
27049
27049
|
}
|
|
27050
27050
|
const { gensym, getref, genref, genformat } = scopeMethods(scope);
|
|
27051
27051
|
const buildPath = (prop) => {
|
|
27052
|
-
const
|
|
27052
|
+
const path6 = [];
|
|
27053
27053
|
let curr = prop;
|
|
27054
27054
|
while (curr) {
|
|
27055
|
-
if (!curr.name)
|
|
27055
|
+
if (!curr.name) path6.unshift(curr);
|
|
27056
27056
|
curr = curr.parent || curr.errorParent;
|
|
27057
27057
|
}
|
|
27058
|
-
if (
|
|
27059
|
-
return format("%j", toPointer(
|
|
27058
|
+
if (path6.every((part) => part.keyval !== void 0))
|
|
27059
|
+
return format("%j", toPointer(path6.map((part) => part.keyval)));
|
|
27060
27060
|
const stringParts = ["#"];
|
|
27061
27061
|
const stringJoined = () => {
|
|
27062
27062
|
const value = stringParts.map(functions.pointerPart).join("/");
|
|
@@ -27064,7 +27064,7 @@ var require_compile = __commonJS({
|
|
|
27064
27064
|
return value;
|
|
27065
27065
|
};
|
|
27066
27066
|
let res = null;
|
|
27067
|
-
for (const { keyname, keyval, number } of
|
|
27067
|
+
for (const { keyname, keyval, number } of path6) {
|
|
27068
27068
|
if (keyname) {
|
|
27069
27069
|
if (!number) scope.pointerPart = functions.pointerPart;
|
|
27070
27070
|
const value = number ? keyname : format("pointerPart(%s)", keyname);
|
|
@@ -27110,8 +27110,8 @@ var require_compile = __commonJS({
|
|
|
27110
27110
|
const definitelyPresent = !current.parent || current.checked || current.inKeys && isJSON || queryCurrent().length > 0;
|
|
27111
27111
|
const name = buildName(current);
|
|
27112
27112
|
const currPropImm = (...args) => propimm(current, ...args);
|
|
27113
|
-
const error = ({ path:
|
|
27114
|
-
const schemaP = toPointer([...schemaPath, ...
|
|
27113
|
+
const error = ({ path: path6 = [], prop = current, source, suberr }) => {
|
|
27114
|
+
const schemaP = toPointer([...schemaPath, ...path6]);
|
|
27115
27115
|
const dataP = includeErrors ? buildPath(prop) : null;
|
|
27116
27116
|
if (includeErrors === true && errors && source) {
|
|
27117
27117
|
scope.errorMerge = functions.errorMerge;
|
|
@@ -27183,7 +27183,7 @@ var require_compile = __commonJS({
|
|
|
27183
27183
|
enforce(ruleTypes.some((t) => schemaTypes.get(t)(node[prop])), "Unexpected type for", prop);
|
|
27184
27184
|
unused.delete(prop);
|
|
27185
27185
|
};
|
|
27186
|
-
const
|
|
27186
|
+
const get3 = (prop, ...ruleTypes) => {
|
|
27187
27187
|
if (node[prop] !== void 0) consume(prop, ...ruleTypes);
|
|
27188
27188
|
return node[prop];
|
|
27189
27189
|
};
|
|
@@ -27205,7 +27205,7 @@ var require_compile = __commonJS({
|
|
|
27205
27205
|
return true;
|
|
27206
27206
|
};
|
|
27207
27207
|
if (node === root) {
|
|
27208
|
-
saveMeta(
|
|
27208
|
+
saveMeta(get3("$schema", "string"));
|
|
27209
27209
|
handle("$vocabulary", ["object"], ($vocabulary) => {
|
|
27210
27210
|
for (const [vocab, flag] of Object.entries($vocabulary)) {
|
|
27211
27211
|
if (flag === false) continue;
|
|
@@ -27222,7 +27222,7 @@ var require_compile = __commonJS({
|
|
|
27222
27222
|
for (const ignore of ["title", "description", "$comment"]) handle(ignore, ["string"], null);
|
|
27223
27223
|
for (const ignore of ["deprecated", "readOnly", "writeOnly"]) handle(ignore, ["boolean"], null);
|
|
27224
27224
|
handle("$defs", ["object"], null) || handle("definitions", ["object"], null);
|
|
27225
|
-
const compileSub = (sub, subR,
|
|
27225
|
+
const compileSub = (sub, subR, path6) => sub === schema2 ? safe("validate") : getref(sub) || compileSchema(sub, subR, opts, scope, path6);
|
|
27226
27226
|
const basePath = () => basePathStack.length > 0 ? basePathStack[basePathStack.length - 1] : "";
|
|
27227
27227
|
const basePathStackLength = basePathStack.length;
|
|
27228
27228
|
const setId = ($id) => {
|
|
@@ -27246,9 +27246,9 @@ var require_compile = __commonJS({
|
|
|
27246
27246
|
if (node !== schema2) fun.write("dynLocal.unshift({})");
|
|
27247
27247
|
for (const [key, subcheck] of allDynamic) {
|
|
27248
27248
|
const resolved = resolveReference(root, schemas, `#${key}`, basePath());
|
|
27249
|
-
const [sub, subRoot,
|
|
27249
|
+
const [sub, subRoot, path6] = resolved[0] || [];
|
|
27250
27250
|
enforce(sub === subcheck, `Unexpected $dynamicAnchor resolution: ${key}`);
|
|
27251
|
-
const n = compileSub(sub, subRoot,
|
|
27251
|
+
const n = compileSub(sub, subRoot, path6);
|
|
27252
27252
|
fun.write("dynLocal[0][%j] = %s", `#${key}`, n);
|
|
27253
27253
|
}
|
|
27254
27254
|
}
|
|
@@ -27954,12 +27954,12 @@ var require_compile = __commonJS({
|
|
|
27954
27954
|
if (local2.props) fun.write("const %s = [[], []]", local2.props);
|
|
27955
27955
|
handle("$ref", ["string"], ($ref) => {
|
|
27956
27956
|
const resolved = resolveReference(root, schemas, $ref, basePath());
|
|
27957
|
-
const [sub, subRoot,
|
|
27957
|
+
const [sub, subRoot, path6] = resolved[0] || [];
|
|
27958
27958
|
if (!sub && sub !== false) {
|
|
27959
27959
|
fail2("failed to resolve $ref:", $ref);
|
|
27960
27960
|
if (lintOnly) return null;
|
|
27961
27961
|
}
|
|
27962
|
-
const n = compileSub(sub, subRoot,
|
|
27962
|
+
const n = compileSub(sub, subRoot, path6);
|
|
27963
27963
|
const rn = sub === schema2 ? funname : n;
|
|
27964
27964
|
if (!scope[rn]) throw new Error("Unexpected: coherence check failed");
|
|
27965
27965
|
if (!scope[rn][evaluatedStatic] && sub.type) {
|
|
@@ -27985,9 +27985,9 @@ var require_compile = __commonJS({
|
|
|
27985
27985
|
if (!opts[optRecAnchors]) throw new Error("[opt] Recursive anchors are not enabled");
|
|
27986
27986
|
enforce($recursiveRef === "#", 'Behavior of $recursiveRef is defined only for "#"');
|
|
27987
27987
|
const resolved = resolveReference(root, schemas, "#", basePath());
|
|
27988
|
-
const [sub, subRoot,
|
|
27988
|
+
const [sub, subRoot, path6] = resolved[0];
|
|
27989
27989
|
laxMode(sub.$recursiveAnchor, "$recursiveRef without $recursiveAnchor");
|
|
27990
|
-
const n = compileSub(sub, subRoot,
|
|
27990
|
+
const n = compileSub(sub, subRoot, path6);
|
|
27991
27991
|
const nrec = sub.$recursiveAnchor ? format("(recursive || %s)", n) : n;
|
|
27992
27992
|
return applyRef(nrec, { path: ["$recursiveRef"] });
|
|
27993
27993
|
});
|
|
@@ -28003,10 +28003,10 @@ var require_compile = __commonJS({
|
|
|
28003
28003
|
return applyRef(nrec2, { path: ["$dynamicRef"] });
|
|
28004
28004
|
}
|
|
28005
28005
|
enforce(resolved[0], "$dynamicRef bookending resolution failed", $dynamicRef);
|
|
28006
|
-
const [sub, subRoot,
|
|
28006
|
+
const [sub, subRoot, path6] = resolved[0];
|
|
28007
28007
|
const ok2 = sub.$dynamicAnchor && `#${sub.$dynamicAnchor}` === dynamicTail;
|
|
28008
28008
|
laxMode(ok2, "$dynamicRef without $dynamicAnchor in the same scope");
|
|
28009
|
-
const n = compileSub(sub, subRoot,
|
|
28009
|
+
const n = compileSub(sub, subRoot, path6);
|
|
28010
28010
|
scope.dynamicResolve = functions.dynamicResolve;
|
|
28011
28011
|
const nrec = ok2 ? format("(dynamicResolve(dynAnchors || [], %j) || %s)", dynamicTail, n) : n;
|
|
28012
28012
|
return applyRef(nrec, { path: ["$dynamicRef"] });
|
|
@@ -28037,7 +28037,7 @@ var require_compile = __commonJS({
|
|
|
28037
28037
|
};
|
|
28038
28038
|
if (node.default !== void 0 && useDefaults) {
|
|
28039
28039
|
if (definitelyPresent) fail2("Can not apply default value here (e.g. at root)");
|
|
28040
|
-
const defvalue =
|
|
28040
|
+
const defvalue = get3("default", "jsonval");
|
|
28041
28041
|
fun.if(present(current), writeMain, () => fun.write("%s = %j", name, defvalue));
|
|
28042
28042
|
} else {
|
|
28043
28043
|
handle("default", ["jsonval"], null);
|
|
@@ -28341,59 +28341,59 @@ var require_url = __commonJS({
|
|
|
28341
28341
|
return href;
|
|
28342
28342
|
}
|
|
28343
28343
|
if (typeof process !== "undefined" && process.cwd) {
|
|
28344
|
-
const
|
|
28345
|
-
const lastChar =
|
|
28344
|
+
const path6 = process.cwd();
|
|
28345
|
+
const lastChar = path6.slice(-1);
|
|
28346
28346
|
if (lastChar === "/" || lastChar === "\\") {
|
|
28347
|
-
return
|
|
28347
|
+
return path6;
|
|
28348
28348
|
} else {
|
|
28349
|
-
return
|
|
28349
|
+
return path6 + "/";
|
|
28350
28350
|
}
|
|
28351
28351
|
}
|
|
28352
28352
|
return "/";
|
|
28353
28353
|
}
|
|
28354
|
-
function getProtocol2(
|
|
28355
|
-
const match = protocolPattern2.exec(
|
|
28354
|
+
function getProtocol2(path6) {
|
|
28355
|
+
const match = protocolPattern2.exec(path6 || "");
|
|
28356
28356
|
if (match) {
|
|
28357
28357
|
return match[1].toLowerCase();
|
|
28358
28358
|
}
|
|
28359
28359
|
return void 0;
|
|
28360
28360
|
}
|
|
28361
|
-
function getExtension2(
|
|
28362
|
-
const lastDot =
|
|
28361
|
+
function getExtension2(path6) {
|
|
28362
|
+
const lastDot = path6.lastIndexOf(".");
|
|
28363
28363
|
if (lastDot >= 0) {
|
|
28364
|
-
return stripQuery2(
|
|
28364
|
+
return stripQuery2(path6.substring(lastDot).toLowerCase());
|
|
28365
28365
|
}
|
|
28366
28366
|
return "";
|
|
28367
28367
|
}
|
|
28368
|
-
function stripQuery2(
|
|
28369
|
-
const queryIndex =
|
|
28368
|
+
function stripQuery2(path6) {
|
|
28369
|
+
const queryIndex = path6.indexOf("?");
|
|
28370
28370
|
if (queryIndex >= 0) {
|
|
28371
|
-
|
|
28371
|
+
path6 = path6.substring(0, queryIndex);
|
|
28372
28372
|
}
|
|
28373
|
-
return
|
|
28373
|
+
return path6;
|
|
28374
28374
|
}
|
|
28375
|
-
function getHash2(
|
|
28376
|
-
if (!
|
|
28375
|
+
function getHash2(path6) {
|
|
28376
|
+
if (!path6) {
|
|
28377
28377
|
return "#";
|
|
28378
28378
|
}
|
|
28379
|
-
const hashIndex =
|
|
28379
|
+
const hashIndex = path6.indexOf("#");
|
|
28380
28380
|
if (hashIndex >= 0) {
|
|
28381
|
-
return
|
|
28381
|
+
return path6.substring(hashIndex);
|
|
28382
28382
|
}
|
|
28383
28383
|
return "#";
|
|
28384
28384
|
}
|
|
28385
|
-
function stripHash2(
|
|
28386
|
-
if (!
|
|
28385
|
+
function stripHash2(path6) {
|
|
28386
|
+
if (!path6) {
|
|
28387
28387
|
return "";
|
|
28388
28388
|
}
|
|
28389
|
-
const hashIndex =
|
|
28389
|
+
const hashIndex = path6.indexOf("#");
|
|
28390
28390
|
if (hashIndex >= 0) {
|
|
28391
|
-
|
|
28391
|
+
path6 = path6.substring(0, hashIndex);
|
|
28392
28392
|
}
|
|
28393
|
-
return
|
|
28393
|
+
return path6;
|
|
28394
28394
|
}
|
|
28395
|
-
function isHttp2(
|
|
28396
|
-
const protocol = getProtocol2(
|
|
28395
|
+
function isHttp2(path6) {
|
|
28396
|
+
const protocol = getProtocol2(path6);
|
|
28397
28397
|
if (protocol === "http" || protocol === "https") {
|
|
28398
28398
|
return true;
|
|
28399
28399
|
} else if (protocol === void 0) {
|
|
@@ -28402,11 +28402,11 @@ var require_url = __commonJS({
|
|
|
28402
28402
|
return false;
|
|
28403
28403
|
}
|
|
28404
28404
|
}
|
|
28405
|
-
function isUnsafeUrl2(
|
|
28406
|
-
if (!
|
|
28405
|
+
function isUnsafeUrl2(path6) {
|
|
28406
|
+
if (!path6 || typeof path6 !== "string") {
|
|
28407
28407
|
return true;
|
|
28408
28408
|
}
|
|
28409
|
-
const normalizedPath =
|
|
28409
|
+
const normalizedPath = path6.trim().toLowerCase();
|
|
28410
28410
|
if (!normalizedPath) {
|
|
28411
28411
|
return true;
|
|
28412
28412
|
}
|
|
@@ -28537,58 +28537,58 @@ var require_url = __commonJS({
|
|
|
28537
28537
|
];
|
|
28538
28538
|
return internalPorts.includes(port);
|
|
28539
28539
|
}
|
|
28540
|
-
function isFileSystemPath2(
|
|
28540
|
+
function isFileSystemPath2(path6) {
|
|
28541
28541
|
if (typeof window !== "undefined" || typeof process !== "undefined" && process.browser) {
|
|
28542
28542
|
return false;
|
|
28543
28543
|
}
|
|
28544
|
-
const protocol = getProtocol2(
|
|
28544
|
+
const protocol = getProtocol2(path6);
|
|
28545
28545
|
return protocol === void 0 || protocol === "file";
|
|
28546
28546
|
}
|
|
28547
|
-
function fromFileSystemPath2(
|
|
28547
|
+
function fromFileSystemPath2(path6) {
|
|
28548
28548
|
if ((0, is_windows_1.isWindows)()) {
|
|
28549
28549
|
const projectDir = cwd2();
|
|
28550
|
-
const upperPath =
|
|
28550
|
+
const upperPath = path6.toUpperCase();
|
|
28551
28551
|
const projectDirPosixPath = (0, convert_path_to_posix_1.default)(projectDir);
|
|
28552
28552
|
const posixUpper = projectDirPosixPath.toUpperCase();
|
|
28553
28553
|
const hasProjectDir = upperPath.includes(posixUpper);
|
|
28554
28554
|
const hasProjectUri = upperPath.includes(posixUpper);
|
|
28555
|
-
const isAbsolutePath = path_1.win32?.isAbsolute(
|
|
28555
|
+
const isAbsolutePath = path_1.win32?.isAbsolute(path6) || path6.startsWith("http://") || path6.startsWith("https://") || path6.startsWith("file://");
|
|
28556
28556
|
if (!(hasProjectDir || hasProjectUri || isAbsolutePath) && !projectDir.startsWith("http")) {
|
|
28557
|
-
|
|
28557
|
+
path6 = (0, path_2.join)(projectDir, path6);
|
|
28558
28558
|
}
|
|
28559
|
-
|
|
28559
|
+
path6 = (0, convert_path_to_posix_1.default)(path6);
|
|
28560
28560
|
}
|
|
28561
|
-
|
|
28561
|
+
path6 = encodeURI(path6);
|
|
28562
28562
|
for (const pattern of urlEncodePatterns2) {
|
|
28563
|
-
|
|
28563
|
+
path6 = path6.replace(pattern[0], pattern[1]);
|
|
28564
28564
|
}
|
|
28565
|
-
return
|
|
28565
|
+
return path6;
|
|
28566
28566
|
}
|
|
28567
|
-
function toFileSystemPath2(
|
|
28568
|
-
|
|
28567
|
+
function toFileSystemPath2(path6, keepFileProtocol) {
|
|
28568
|
+
path6 = decodeURI(path6);
|
|
28569
28569
|
for (let i = 0; i < urlDecodePatterns2.length; i += 2) {
|
|
28570
|
-
|
|
28570
|
+
path6 = path6.replace(urlDecodePatterns2[i], urlDecodePatterns2[i + 1]);
|
|
28571
28571
|
}
|
|
28572
|
-
let isFileUrl =
|
|
28572
|
+
let isFileUrl = path6.toLowerCase().startsWith("file://");
|
|
28573
28573
|
if (isFileUrl) {
|
|
28574
|
-
|
|
28575
|
-
if ((0, is_windows_1.isWindows)() &&
|
|
28576
|
-
|
|
28574
|
+
path6 = path6.replace(/^file:\/\//, "").replace(/^\//, "");
|
|
28575
|
+
if ((0, is_windows_1.isWindows)() && path6[1] === "/") {
|
|
28576
|
+
path6 = `${path6[0]}:${path6.substring(1)}`;
|
|
28577
28577
|
}
|
|
28578
28578
|
if (keepFileProtocol) {
|
|
28579
|
-
|
|
28579
|
+
path6 = "file:///" + path6;
|
|
28580
28580
|
} else {
|
|
28581
28581
|
isFileUrl = false;
|
|
28582
|
-
|
|
28582
|
+
path6 = (0, is_windows_1.isWindows)() ? path6 : "/" + path6;
|
|
28583
28583
|
}
|
|
28584
28584
|
}
|
|
28585
28585
|
if ((0, is_windows_1.isWindows)() && !isFileUrl) {
|
|
28586
|
-
|
|
28587
|
-
if (
|
|
28588
|
-
|
|
28586
|
+
path6 = path6.replace(forwardSlashPattern2, "\\");
|
|
28587
|
+
if (path6.match(/^[a-z]:\\/i)) {
|
|
28588
|
+
path6 = path6[0].toUpperCase() + path6.substring(1);
|
|
28589
28589
|
}
|
|
28590
28590
|
}
|
|
28591
|
-
return
|
|
28591
|
+
return path6;
|
|
28592
28592
|
}
|
|
28593
28593
|
function safePointerToPath2(pointer) {
|
|
28594
28594
|
if (pointer.length <= 1 || pointer[0] !== "#" || pointer[1] !== "/") {
|
|
@@ -28736,8 +28736,8 @@ var require_errors3 = __commonJS({
|
|
|
28736
28736
|
targetRef;
|
|
28737
28737
|
targetFound;
|
|
28738
28738
|
parentPath;
|
|
28739
|
-
constructor(token,
|
|
28740
|
-
super(`Missing $ref pointer "${(0, url_js_1.getHash)(
|
|
28739
|
+
constructor(token, path6, targetRef, targetFound, parentPath) {
|
|
28740
|
+
super(`Missing $ref pointer "${(0, url_js_1.getHash)(path6)}". Token "${token}" does not exist.`, (0, url_js_1.stripHash)(path6));
|
|
28741
28741
|
this.targetToken = token;
|
|
28742
28742
|
this.targetRef = targetRef;
|
|
28743
28743
|
this.targetFound = targetFound;
|
|
@@ -28756,8 +28756,8 @@ var require_errors3 = __commonJS({
|
|
|
28756
28756
|
var InvalidPointerError2 = class extends JSONParserError2 {
|
|
28757
28757
|
code = "EUNMATCHEDRESOLVER";
|
|
28758
28758
|
name = "InvalidPointerError";
|
|
28759
|
-
constructor(pointer,
|
|
28760
|
-
super(`Invalid $ref pointer "${pointer}". Pointers must begin with "#/"`, (0, url_js_1.stripHash)(
|
|
28759
|
+
constructor(pointer, path6) {
|
|
28760
|
+
super(`Invalid $ref pointer "${pointer}". Pointers must begin with "#/"`, (0, url_js_1.stripHash)(path6));
|
|
28761
28761
|
}
|
|
28762
28762
|
};
|
|
28763
28763
|
exports2.InvalidPointerError = InvalidPointerError2;
|
|
@@ -28862,10 +28862,10 @@ var require_pointer2 = __commonJS({
|
|
|
28862
28862
|
* Resolving a single pointer may require resolving multiple $Refs.
|
|
28863
28863
|
*/
|
|
28864
28864
|
indirections;
|
|
28865
|
-
constructor($ref,
|
|
28865
|
+
constructor($ref, path6, friendlyPath) {
|
|
28866
28866
|
this.$ref = $ref;
|
|
28867
|
-
this.path =
|
|
28868
|
-
this.originalPath = friendlyPath ||
|
|
28867
|
+
this.path = path6;
|
|
28868
|
+
this.originalPath = friendlyPath || path6;
|
|
28869
28869
|
this.value = void 0;
|
|
28870
28870
|
this.circular = false;
|
|
28871
28871
|
this.indirections = 0;
|
|
@@ -28911,10 +28911,10 @@ var require_pointer2 = __commonJS({
|
|
|
28911
28911
|
continue;
|
|
28912
28912
|
}
|
|
28913
28913
|
this.value = null;
|
|
28914
|
-
const
|
|
28915
|
-
const targetRef = this.path.replace(
|
|
28914
|
+
const path6 = this.$ref.path || "";
|
|
28915
|
+
const targetRef = this.path.replace(path6, "");
|
|
28916
28916
|
const targetFound = _Pointer.join("", found);
|
|
28917
|
-
const parentPath = pathFromRoot?.replace(
|
|
28917
|
+
const parentPath = pathFromRoot?.replace(path6, "");
|
|
28918
28918
|
throw new errors_js_1.MissingPointerError(token, decodeURI(this.originalPath), targetRef, targetFound, parentPath);
|
|
28919
28919
|
} else {
|
|
28920
28920
|
this.value = this.value[token];
|
|
@@ -28970,8 +28970,8 @@ var require_pointer2 = __commonJS({
|
|
|
28970
28970
|
* @param [originalPath]
|
|
28971
28971
|
* @returns
|
|
28972
28972
|
*/
|
|
28973
|
-
static parse(
|
|
28974
|
-
const pointer = url.getHash(
|
|
28973
|
+
static parse(path6, originalPath) {
|
|
28974
|
+
const pointer = url.getHash(path6).substring(1);
|
|
28975
28975
|
if (!pointer) {
|
|
28976
28976
|
return [];
|
|
28977
28977
|
}
|
|
@@ -28980,7 +28980,7 @@ var require_pointer2 = __commonJS({
|
|
|
28980
28980
|
split[i] = safeDecodeURIComponent(split[i].replace(escapedSlash2, "/").replace(escapedTilde2, "~"));
|
|
28981
28981
|
}
|
|
28982
28982
|
if (split[0] !== "") {
|
|
28983
|
-
throw new errors_js_1.InvalidPointerError(pointer, originalPath === void 0 ?
|
|
28983
|
+
throw new errors_js_1.InvalidPointerError(pointer, originalPath === void 0 ? path6 : originalPath);
|
|
28984
28984
|
}
|
|
28985
28985
|
return split.slice(1);
|
|
28986
28986
|
}
|
|
@@ -29158,9 +29158,9 @@ var require_ref = __commonJS({
|
|
|
29158
29158
|
* @param options
|
|
29159
29159
|
* @returns
|
|
29160
29160
|
*/
|
|
29161
|
-
exists(
|
|
29161
|
+
exists(path6, options) {
|
|
29162
29162
|
try {
|
|
29163
|
-
this.resolve(
|
|
29163
|
+
this.resolve(path6, options);
|
|
29164
29164
|
return true;
|
|
29165
29165
|
} catch {
|
|
29166
29166
|
return false;
|
|
@@ -29173,8 +29173,8 @@ var require_ref = __commonJS({
|
|
|
29173
29173
|
* @param options
|
|
29174
29174
|
* @returns - Returns the resolved value
|
|
29175
29175
|
*/
|
|
29176
|
-
get(
|
|
29177
|
-
return this.resolve(
|
|
29176
|
+
get(path6, options) {
|
|
29177
|
+
return this.resolve(path6, options)?.value;
|
|
29178
29178
|
}
|
|
29179
29179
|
/**
|
|
29180
29180
|
* Resolves the given JSON reference within this {@link $Ref#value}.
|
|
@@ -29185,8 +29185,8 @@ var require_ref = __commonJS({
|
|
|
29185
29185
|
* @param pathFromRoot - The path of `obj` from the schema root
|
|
29186
29186
|
* @returns
|
|
29187
29187
|
*/
|
|
29188
|
-
resolve(
|
|
29189
|
-
const pointer = new pointer_js_1.default(this,
|
|
29188
|
+
resolve(path6, options, friendlyPath, pathFromRoot) {
|
|
29189
|
+
const pointer = new pointer_js_1.default(this, path6, friendlyPath);
|
|
29190
29190
|
try {
|
|
29191
29191
|
const resolved = pointer.resolve(this.value, options, pathFromRoot);
|
|
29192
29192
|
if (resolved.value === pointer_js_1.nullSymbol) {
|
|
@@ -29214,8 +29214,8 @@ var require_ref = __commonJS({
|
|
|
29214
29214
|
* @param path - The full path of the property to set, optionally with a JSON pointer in the hash
|
|
29215
29215
|
* @param value - The value to assign
|
|
29216
29216
|
*/
|
|
29217
|
-
set(
|
|
29218
|
-
const pointer = new pointer_js_1.default(this,
|
|
29217
|
+
set(path6, value) {
|
|
29218
|
+
const pointer = new pointer_js_1.default(this, path6);
|
|
29219
29219
|
this.value = pointer.set(this.value, value);
|
|
29220
29220
|
if (this.value === pointer_js_1.nullSymbol) {
|
|
29221
29221
|
this.value = null;
|
|
@@ -29412,8 +29412,8 @@ var require_refs = __commonJS({
|
|
|
29412
29412
|
*/
|
|
29413
29413
|
paths(...types2) {
|
|
29414
29414
|
const paths = getPaths2(this._$refs, types2.flat());
|
|
29415
|
-
return paths.map((
|
|
29416
|
-
return (0, convert_path_to_posix_1.default)(
|
|
29415
|
+
return paths.map((path6) => {
|
|
29416
|
+
return (0, convert_path_to_posix_1.default)(path6.decoded);
|
|
29417
29417
|
});
|
|
29418
29418
|
}
|
|
29419
29419
|
/**
|
|
@@ -29426,8 +29426,8 @@ var require_refs = __commonJS({
|
|
|
29426
29426
|
values(...types2) {
|
|
29427
29427
|
const $refs = this._$refs;
|
|
29428
29428
|
const paths = getPaths2($refs, types2.flat());
|
|
29429
|
-
return paths.reduce((obj,
|
|
29430
|
-
obj[(0, convert_path_to_posix_1.default)(
|
|
29429
|
+
return paths.reduce((obj, path6) => {
|
|
29430
|
+
obj[(0, convert_path_to_posix_1.default)(path6.decoded)] = $refs[path6.encoded].value;
|
|
29431
29431
|
return obj;
|
|
29432
29432
|
}, {});
|
|
29433
29433
|
}
|
|
@@ -29445,9 +29445,9 @@ var require_refs = __commonJS({
|
|
|
29445
29445
|
* @param [options]
|
|
29446
29446
|
* @returns
|
|
29447
29447
|
*/
|
|
29448
|
-
exists(
|
|
29448
|
+
exists(path6, options) {
|
|
29449
29449
|
try {
|
|
29450
|
-
this._resolve(
|
|
29450
|
+
this._resolve(path6, "", options);
|
|
29451
29451
|
return true;
|
|
29452
29452
|
} catch {
|
|
29453
29453
|
return false;
|
|
@@ -29460,8 +29460,8 @@ var require_refs = __commonJS({
|
|
|
29460
29460
|
* @param [options]
|
|
29461
29461
|
* @returns - Returns the resolved value
|
|
29462
29462
|
*/
|
|
29463
|
-
get(
|
|
29464
|
-
return this._resolve(
|
|
29463
|
+
get(path6, options) {
|
|
29464
|
+
return this._resolve(path6, "", options).value;
|
|
29465
29465
|
}
|
|
29466
29466
|
/**
|
|
29467
29467
|
* Sets the value at the given path in the schema. If the property, or any of its parents, don't exist, they will be created.
|
|
@@ -29469,12 +29469,12 @@ var require_refs = __commonJS({
|
|
|
29469
29469
|
* @param path The JSON Reference path, optionally with a JSON Pointer in the hash
|
|
29470
29470
|
* @param value The value to assign. Can be anything (object, string, number, etc.)
|
|
29471
29471
|
*/
|
|
29472
|
-
set(
|
|
29473
|
-
const absPath = url.resolve(this._root$Ref.path,
|
|
29472
|
+
set(path6, value) {
|
|
29473
|
+
const absPath = url.resolve(this._root$Ref.path, path6);
|
|
29474
29474
|
const withoutHash = url.stripHash(absPath);
|
|
29475
29475
|
const $ref = this._$refs[withoutHash];
|
|
29476
29476
|
if (!$ref) {
|
|
29477
|
-
throw new Error(`Error resolving $ref pointer "${
|
|
29477
|
+
throw new Error(`Error resolving $ref pointer "${path6}".
|
|
29478
29478
|
"${withoutHash}" not found.`);
|
|
29479
29479
|
}
|
|
29480
29480
|
$ref.set(absPath, value);
|
|
@@ -29486,9 +29486,9 @@ var require_refs = __commonJS({
|
|
|
29486
29486
|
* @returns
|
|
29487
29487
|
* @protected
|
|
29488
29488
|
*/
|
|
29489
|
-
_get$Ref(
|
|
29490
|
-
|
|
29491
|
-
const withoutHash = url.stripHash(
|
|
29489
|
+
_get$Ref(path6) {
|
|
29490
|
+
path6 = url.resolve(this._root$Ref.path, path6);
|
|
29491
|
+
const withoutHash = url.stripHash(path6);
|
|
29492
29492
|
return this._$refs[withoutHash];
|
|
29493
29493
|
}
|
|
29494
29494
|
/**
|
|
@@ -29496,8 +29496,8 @@ var require_refs = __commonJS({
|
|
|
29496
29496
|
*
|
|
29497
29497
|
* @param path - The file path or URL of the referenced file
|
|
29498
29498
|
*/
|
|
29499
|
-
_add(
|
|
29500
|
-
const withoutHash = url.stripHash(
|
|
29499
|
+
_add(path6) {
|
|
29500
|
+
const withoutHash = url.stripHash(path6);
|
|
29501
29501
|
const $ref = new ref_js_1.default(this);
|
|
29502
29502
|
$ref.path = withoutHash;
|
|
29503
29503
|
this._$refs[withoutHash] = $ref;
|
|
@@ -29513,15 +29513,15 @@ var require_refs = __commonJS({
|
|
|
29513
29513
|
* @returns
|
|
29514
29514
|
* @protected
|
|
29515
29515
|
*/
|
|
29516
|
-
_resolve(
|
|
29517
|
-
const absPath = url.resolve(this._root$Ref.path,
|
|
29516
|
+
_resolve(path6, pathFromRoot, options) {
|
|
29517
|
+
const absPath = url.resolve(this._root$Ref.path, path6);
|
|
29518
29518
|
const withoutHash = url.stripHash(absPath);
|
|
29519
29519
|
const $ref = this._$refs[withoutHash];
|
|
29520
29520
|
if (!$ref) {
|
|
29521
|
-
throw new Error(`Error resolving $ref pointer "${
|
|
29521
|
+
throw new Error(`Error resolving $ref pointer "${path6}".
|
|
29522
29522
|
"${withoutHash}" not found.`);
|
|
29523
29523
|
}
|
|
29524
|
-
return $ref.resolve(absPath, options,
|
|
29524
|
+
return $ref.resolve(absPath, options, path6, pathFromRoot);
|
|
29525
29525
|
}
|
|
29526
29526
|
/**
|
|
29527
29527
|
* A map of paths/urls to {@link $Ref} objects
|
|
@@ -29571,10 +29571,10 @@ var require_refs = __commonJS({
|
|
|
29571
29571
|
return types2.includes($refs[key].pathType);
|
|
29572
29572
|
});
|
|
29573
29573
|
}
|
|
29574
|
-
return paths.map((
|
|
29574
|
+
return paths.map((path6) => {
|
|
29575
29575
|
return {
|
|
29576
|
-
encoded:
|
|
29577
|
-
decoded: $refs[
|
|
29576
|
+
encoded: path6,
|
|
29577
|
+
decoded: $refs[path6].pathType === "file" ? url.toFileSystemPath(path6, true) : path6
|
|
29578
29578
|
};
|
|
29579
29579
|
});
|
|
29580
29580
|
}
|
|
@@ -29721,18 +29721,18 @@ var require_parse2 = __commonJS({
|
|
|
29721
29721
|
var url = __importStar(require_url());
|
|
29722
29722
|
var plugins = __importStar(require_plugins());
|
|
29723
29723
|
var errors_js_1 = require_errors3();
|
|
29724
|
-
async function parse6(
|
|
29725
|
-
const hashIndex =
|
|
29724
|
+
async function parse6(path6, $refs, options) {
|
|
29725
|
+
const hashIndex = path6.indexOf("#");
|
|
29726
29726
|
let hash = "";
|
|
29727
29727
|
if (hashIndex >= 0) {
|
|
29728
|
-
hash =
|
|
29729
|
-
|
|
29728
|
+
hash = path6.substring(hashIndex);
|
|
29729
|
+
path6 = path6.substring(0, hashIndex);
|
|
29730
29730
|
}
|
|
29731
|
-
const $ref = $refs._add(
|
|
29731
|
+
const $ref = $refs._add(path6);
|
|
29732
29732
|
const file = {
|
|
29733
|
-
url:
|
|
29733
|
+
url: path6,
|
|
29734
29734
|
hash,
|
|
29735
|
-
extension: url.getExtension(
|
|
29735
|
+
extension: url.getExtension(path6)
|
|
29736
29736
|
};
|
|
29737
29737
|
try {
|
|
29738
29738
|
const resolver = await readFile3(file, options, $refs);
|
|
@@ -32865,23 +32865,23 @@ var require_file2 = __commonJS({
|
|
|
32865
32865
|
* Reads the given file and returns its raw contents as a Buffer.
|
|
32866
32866
|
*/
|
|
32867
32867
|
async read(file) {
|
|
32868
|
-
let
|
|
32868
|
+
let path6;
|
|
32869
32869
|
try {
|
|
32870
|
-
|
|
32870
|
+
path6 = url.toFileSystemPath(file.url);
|
|
32871
32871
|
} catch (err) {
|
|
32872
32872
|
const e = err;
|
|
32873
32873
|
e.message = `Malformed URI: ${file.url}: ${e.message}`;
|
|
32874
32874
|
throw new errors_js_1.ResolverError(e, file.url);
|
|
32875
32875
|
}
|
|
32876
|
-
if (
|
|
32877
|
-
|
|
32876
|
+
if (path6.endsWith("/") || path6.endsWith("\\")) {
|
|
32877
|
+
path6 = path6.slice(0, -1);
|
|
32878
32878
|
}
|
|
32879
32879
|
try {
|
|
32880
|
-
return await fs_1.default.promises.readFile(
|
|
32880
|
+
return await fs_1.default.promises.readFile(path6);
|
|
32881
32881
|
} catch (err) {
|
|
32882
32882
|
const e = err;
|
|
32883
|
-
e.message = `Error opening file ${
|
|
32884
|
-
throw new errors_js_1.ResolverError(e,
|
|
32883
|
+
e.message = `Error opening file ${path6}: ${e.message}`;
|
|
32884
|
+
throw new errors_js_1.ResolverError(e, path6);
|
|
32885
32885
|
}
|
|
32886
32886
|
}
|
|
32887
32887
|
};
|
|
@@ -32990,7 +32990,7 @@ var require_http = __commonJS({
|
|
|
32990
32990
|
const redirects = _redirects || [];
|
|
32991
32991
|
redirects.push(u.href);
|
|
32992
32992
|
try {
|
|
32993
|
-
const res = await
|
|
32993
|
+
const res = await get3(u, httpOptions);
|
|
32994
32994
|
if (res.status >= 400) {
|
|
32995
32995
|
const error = new Error(`HTTP ERROR ${res.status}`);
|
|
32996
32996
|
error.status = res.status;
|
|
@@ -33023,7 +33023,7 @@ Too many redirects:
|
|
|
33023
33023
|
throw new errors_js_1.ResolverError(e, u.href);
|
|
33024
33024
|
}
|
|
33025
33025
|
}
|
|
33026
|
-
async function
|
|
33026
|
+
async function get3(u, httpOptions) {
|
|
33027
33027
|
let controller;
|
|
33028
33028
|
let timeoutId;
|
|
33029
33029
|
if (httpOptions.timeout) {
|
|
@@ -33175,7 +33175,7 @@ var require_normalize_args = __commonJS({
|
|
|
33175
33175
|
exports2.normalizeArgs = normalizeArgs2;
|
|
33176
33176
|
var options_js_1 = require_options();
|
|
33177
33177
|
function normalizeArgs2(_args) {
|
|
33178
|
-
let
|
|
33178
|
+
let path6;
|
|
33179
33179
|
let schema2;
|
|
33180
33180
|
let options;
|
|
33181
33181
|
let callback;
|
|
@@ -33184,7 +33184,7 @@ var require_normalize_args = __commonJS({
|
|
|
33184
33184
|
callback = args.pop();
|
|
33185
33185
|
}
|
|
33186
33186
|
if (typeof args[0] === "string") {
|
|
33187
|
-
|
|
33187
|
+
path6 = args[0];
|
|
33188
33188
|
if (typeof args[2] === "object") {
|
|
33189
33189
|
schema2 = args[1];
|
|
33190
33190
|
options = args[2];
|
|
@@ -33193,7 +33193,7 @@ var require_normalize_args = __commonJS({
|
|
|
33193
33193
|
options = args[1];
|
|
33194
33194
|
}
|
|
33195
33195
|
} else {
|
|
33196
|
-
|
|
33196
|
+
path6 = "";
|
|
33197
33197
|
schema2 = args[0];
|
|
33198
33198
|
options = args[1];
|
|
33199
33199
|
}
|
|
@@ -33206,7 +33206,7 @@ var require_normalize_args = __commonJS({
|
|
|
33206
33206
|
schema2 = JSON.parse(JSON.stringify(schema2));
|
|
33207
33207
|
}
|
|
33208
33208
|
return {
|
|
33209
|
-
path:
|
|
33209
|
+
path: path6,
|
|
33210
33210
|
schema: schema2,
|
|
33211
33211
|
options,
|
|
33212
33212
|
callback
|
|
@@ -33277,26 +33277,26 @@ var require_resolve_external = __commonJS({
|
|
|
33277
33277
|
return Promise.reject(e);
|
|
33278
33278
|
}
|
|
33279
33279
|
}
|
|
33280
|
-
function crawl4(obj,
|
|
33280
|
+
function crawl4(obj, path6, $refs, options, seen, external) {
|
|
33281
33281
|
seen ||= /* @__PURE__ */ new Set();
|
|
33282
33282
|
let promises3 = [];
|
|
33283
33283
|
if (obj && typeof obj === "object" && !ArrayBuffer.isView(obj) && !seen.has(obj)) {
|
|
33284
33284
|
seen.add(obj);
|
|
33285
33285
|
if (ref_js_1.default.isExternal$Ref(obj)) {
|
|
33286
|
-
promises3.push(resolve$Ref2(obj,
|
|
33286
|
+
promises3.push(resolve$Ref2(obj, path6, $refs, options));
|
|
33287
33287
|
}
|
|
33288
33288
|
const keys = Object.keys(obj);
|
|
33289
33289
|
for (const key of keys) {
|
|
33290
|
-
const keyPath = pointer_js_1.default.join(
|
|
33290
|
+
const keyPath = pointer_js_1.default.join(path6, key);
|
|
33291
33291
|
const value = obj[key];
|
|
33292
33292
|
promises3 = promises3.concat(crawl4(value, keyPath, $refs, options, seen, external));
|
|
33293
33293
|
}
|
|
33294
33294
|
}
|
|
33295
33295
|
return promises3;
|
|
33296
33296
|
}
|
|
33297
|
-
async function resolve$Ref2($ref,
|
|
33297
|
+
async function resolve$Ref2($ref, path6, $refs, options) {
|
|
33298
33298
|
const shouldResolveOnCwd = options.dereference?.externalReferenceResolution === "root";
|
|
33299
|
-
const resolvedPath = url.resolve(shouldResolveOnCwd ? url.cwd() :
|
|
33299
|
+
const resolvedPath = url.resolve(shouldResolveOnCwd ? url.cwd() : path6, $ref.$ref);
|
|
33300
33300
|
const withoutHash = url.stripHash(resolvedPath);
|
|
33301
33301
|
const ref = $refs._$refs[withoutHash];
|
|
33302
33302
|
if (ref) {
|
|
@@ -33311,8 +33311,8 @@ var require_resolve_external = __commonJS({
|
|
|
33311
33311
|
throw err;
|
|
33312
33312
|
}
|
|
33313
33313
|
if ($refs._$refs[withoutHash]) {
|
|
33314
|
-
err.source = decodeURI(url.stripHash(
|
|
33315
|
-
err.path = url.safePointerToPath(url.getHash(
|
|
33314
|
+
err.source = decodeURI(url.stripHash(path6));
|
|
33315
|
+
err.path = url.safePointerToPath(url.getHash(path6));
|
|
33316
33316
|
}
|
|
33317
33317
|
return [];
|
|
33318
33318
|
}
|
|
@@ -33374,13 +33374,13 @@ var require_bundle = __commonJS({
|
|
|
33374
33374
|
crawl4(parser, "schema", parser.$refs._root$Ref.path + "#", "#", 0, inventory, parser.$refs, options);
|
|
33375
33375
|
remap2(inventory);
|
|
33376
33376
|
}
|
|
33377
|
-
function crawl4(parent, key,
|
|
33377
|
+
function crawl4(parent, key, path6, pathFromRoot, indirections, inventory, $refs, options) {
|
|
33378
33378
|
const obj = key === null ? parent : parent[key];
|
|
33379
33379
|
const bundleOptions = options.bundle || {};
|
|
33380
33380
|
const isExcludedPath = bundleOptions.excludedPathMatcher || (() => false);
|
|
33381
33381
|
if (obj && typeof obj === "object" && !ArrayBuffer.isView(obj) && !isExcludedPath(pathFromRoot)) {
|
|
33382
33382
|
if (ref_js_1.default.isAllowed$Ref(obj)) {
|
|
33383
|
-
inventory$Ref2(parent, key,
|
|
33383
|
+
inventory$Ref2(parent, key, path6, pathFromRoot, indirections, inventory, $refs, options);
|
|
33384
33384
|
} else {
|
|
33385
33385
|
const keys = Object.keys(obj).sort((a, b) => {
|
|
33386
33386
|
if (a === "definitions" || a === "$defs") {
|
|
@@ -33392,11 +33392,11 @@ var require_bundle = __commonJS({
|
|
|
33392
33392
|
}
|
|
33393
33393
|
});
|
|
33394
33394
|
for (const key2 of keys) {
|
|
33395
|
-
const keyPath = pointer_js_1.default.join(
|
|
33395
|
+
const keyPath = pointer_js_1.default.join(path6, key2);
|
|
33396
33396
|
const keyPathFromRoot = pointer_js_1.default.join(pathFromRoot, key2);
|
|
33397
33397
|
const value = obj[key2];
|
|
33398
33398
|
if (ref_js_1.default.isAllowed$Ref(value)) {
|
|
33399
|
-
inventory$Ref2(obj, key2,
|
|
33399
|
+
inventory$Ref2(obj, key2, path6, keyPathFromRoot, indirections, inventory, $refs, options);
|
|
33400
33400
|
} else {
|
|
33401
33401
|
crawl4(obj, key2, keyPath, keyPathFromRoot, indirections, inventory, $refs, options);
|
|
33402
33402
|
}
|
|
@@ -33409,9 +33409,9 @@ var require_bundle = __commonJS({
|
|
|
33409
33409
|
}
|
|
33410
33410
|
}
|
|
33411
33411
|
}
|
|
33412
|
-
function inventory$Ref2($refParent, $refKey,
|
|
33412
|
+
function inventory$Ref2($refParent, $refKey, path6, pathFromRoot, indirections, inventory, $refs, options) {
|
|
33413
33413
|
const $ref = $refKey === null ? $refParent : $refParent[$refKey];
|
|
33414
|
-
const $refPath = url.resolve(
|
|
33414
|
+
const $refPath = url.resolve(path6, $ref.$ref);
|
|
33415
33415
|
const pointer = $refs._resolve($refPath, pathFromRoot, options);
|
|
33416
33416
|
if (pointer === null) {
|
|
33417
33417
|
return;
|
|
@@ -33576,7 +33576,7 @@ var require_dereference = __commonJS({
|
|
|
33576
33576
|
parser.$refs.circular = dereferenced.circular;
|
|
33577
33577
|
parser.schema = dereferenced.value;
|
|
33578
33578
|
}
|
|
33579
|
-
function crawl4(obj,
|
|
33579
|
+
function crawl4(obj, path6, pathFromRoot, parents, processedObjects, dereferencedCache, $refs, options, startTime) {
|
|
33580
33580
|
let dereferenced;
|
|
33581
33581
|
const result = {
|
|
33582
33582
|
value: obj,
|
|
@@ -33590,13 +33590,13 @@ var require_dereference = __commonJS({
|
|
|
33590
33590
|
parents.add(obj);
|
|
33591
33591
|
processedObjects.add(obj);
|
|
33592
33592
|
if (ref_js_1.default.isAllowed$Ref(obj, options)) {
|
|
33593
|
-
dereferenced = dereference$Ref2(obj,
|
|
33593
|
+
dereferenced = dereference$Ref2(obj, path6, pathFromRoot, parents, processedObjects, dereferencedCache, $refs, options, startTime);
|
|
33594
33594
|
result.circular = dereferenced.circular;
|
|
33595
33595
|
result.value = dereferenced.value;
|
|
33596
33596
|
} else {
|
|
33597
33597
|
for (const key of Object.keys(obj)) {
|
|
33598
33598
|
checkDereferenceTimeout2(startTime, options);
|
|
33599
|
-
const keyPath = pointer_js_1.default.join(
|
|
33599
|
+
const keyPath = pointer_js_1.default.join(path6, key);
|
|
33600
33600
|
const keyPathFromRoot = pointer_js_1.default.join(pathFromRoot, key);
|
|
33601
33601
|
if (isExcludedPath(keyPathFromRoot)) {
|
|
33602
33602
|
continue;
|
|
@@ -33646,10 +33646,10 @@ var require_dereference = __commonJS({
|
|
|
33646
33646
|
}
|
|
33647
33647
|
return result;
|
|
33648
33648
|
}
|
|
33649
|
-
function dereference$Ref2($ref,
|
|
33649
|
+
function dereference$Ref2($ref, path6, pathFromRoot, parents, processedObjects, dereferencedCache, $refs, options, startTime) {
|
|
33650
33650
|
const isExternalRef = ref_js_1.default.isExternal$Ref($ref);
|
|
33651
33651
|
const shouldResolveOnCwd = isExternalRef && options?.dereference?.externalReferenceResolution === "root";
|
|
33652
|
-
const $refPath = url.resolve(shouldResolveOnCwd ? url.cwd() :
|
|
33652
|
+
const $refPath = url.resolve(shouldResolveOnCwd ? url.cwd() : path6, $ref.$ref);
|
|
33653
33653
|
const cache = dereferencedCache.get($refPath);
|
|
33654
33654
|
if (cache) {
|
|
33655
33655
|
if (!cache.circular) {
|
|
@@ -33677,7 +33677,7 @@ var require_dereference = __commonJS({
|
|
|
33677
33677
|
return cache;
|
|
33678
33678
|
}
|
|
33679
33679
|
}
|
|
33680
|
-
const pointer = $refs._resolve($refPath,
|
|
33680
|
+
const pointer = $refs._resolve($refPath, path6, options);
|
|
33681
33681
|
if (pointer === null) {
|
|
33682
33682
|
return {
|
|
33683
33683
|
circular: false,
|
|
@@ -33687,7 +33687,7 @@ var require_dereference = __commonJS({
|
|
|
33687
33687
|
const directCircular = pointer.circular;
|
|
33688
33688
|
let circular = directCircular || parents.has(pointer.value);
|
|
33689
33689
|
if (circular) {
|
|
33690
|
-
foundCircularReference2(
|
|
33690
|
+
foundCircularReference2(path6, $refs, options);
|
|
33691
33691
|
}
|
|
33692
33692
|
let dereferencedValue = ref_js_1.default.dereference($ref, pointer.value);
|
|
33693
33693
|
if (!circular) {
|
|
@@ -35663,13 +35663,13 @@ var require_json3 = __commonJS({
|
|
|
35663
35663
|
});
|
|
35664
35664
|
Object.defineProperty(exports2, "getDecoratedDataPath", {
|
|
35665
35665
|
enumerable: true,
|
|
35666
|
-
get: function
|
|
35666
|
+
get: function get3() {
|
|
35667
35667
|
return _getDecoratedDataPath["default"];
|
|
35668
35668
|
}
|
|
35669
35669
|
});
|
|
35670
35670
|
Object.defineProperty(exports2, "getMetaFromPath", {
|
|
35671
35671
|
enumerable: true,
|
|
35672
|
-
get: function
|
|
35672
|
+
get: function get3() {
|
|
35673
35673
|
return _getMetaFromPath["default"];
|
|
35674
35674
|
}
|
|
35675
35675
|
});
|
|
@@ -35714,7 +35714,7 @@ var require_base = __commonJS({
|
|
|
35714
35714
|
// creating an empty proxy that'll just return the arguments of any color functions we
|
|
35715
35715
|
// invoke, sans any colorization.
|
|
35716
35716
|
new Proxy({}, {
|
|
35717
|
-
get: function
|
|
35717
|
+
get: function get3() {
|
|
35718
35718
|
return function(arg) {
|
|
35719
35719
|
return arg;
|
|
35720
35720
|
};
|
|
@@ -35765,7 +35765,7 @@ var require_base = __commonJS({
|
|
|
35765
35765
|
*/
|
|
35766
35766
|
}, {
|
|
35767
35767
|
key: "instancePath",
|
|
35768
|
-
get: function
|
|
35768
|
+
get: function get3() {
|
|
35769
35769
|
return typeof this.options.instancePath !== "undefined" ? this.options.instancePath : this.options.dataPath;
|
|
35770
35770
|
}
|
|
35771
35771
|
}, {
|
|
@@ -36013,7 +36013,7 @@ var require_jsonpointer = __commonJS({
|
|
|
36013
36013
|
}
|
|
36014
36014
|
throw new Error("Invalid JSON pointer.");
|
|
36015
36015
|
}
|
|
36016
|
-
function
|
|
36016
|
+
function get3(obj, pointer) {
|
|
36017
36017
|
if (typeof obj !== "object") throw new Error("Invalid input object.");
|
|
36018
36018
|
pointer = compilePointer(pointer);
|
|
36019
36019
|
var len = pointer.length;
|
|
@@ -36034,14 +36034,14 @@ var require_jsonpointer = __commonJS({
|
|
|
36034
36034
|
var compiled = compilePointer(pointer);
|
|
36035
36035
|
return {
|
|
36036
36036
|
get: function(object) {
|
|
36037
|
-
return
|
|
36037
|
+
return get3(object, compiled);
|
|
36038
36038
|
},
|
|
36039
36039
|
set: function(object, value) {
|
|
36040
36040
|
return set2(object, compiled, value);
|
|
36041
36041
|
}
|
|
36042
36042
|
};
|
|
36043
36043
|
}
|
|
36044
|
-
exports2.get =
|
|
36044
|
+
exports2.get = get3;
|
|
36045
36045
|
exports2.set = set2;
|
|
36046
36046
|
exports2.compile = compile;
|
|
36047
36047
|
}
|
|
@@ -36528,37 +36528,37 @@ var require_validation_errors = __commonJS({
|
|
|
36528
36528
|
});
|
|
36529
36529
|
Object.defineProperty(exports2, "AdditionalPropValidationError", {
|
|
36530
36530
|
enumerable: true,
|
|
36531
|
-
get: function
|
|
36531
|
+
get: function get3() {
|
|
36532
36532
|
return _additionalProp["default"];
|
|
36533
36533
|
}
|
|
36534
36534
|
});
|
|
36535
36535
|
Object.defineProperty(exports2, "DefaultValidationError", {
|
|
36536
36536
|
enumerable: true,
|
|
36537
|
-
get: function
|
|
36537
|
+
get: function get3() {
|
|
36538
36538
|
return _default2["default"];
|
|
36539
36539
|
}
|
|
36540
36540
|
});
|
|
36541
36541
|
Object.defineProperty(exports2, "EnumValidationError", {
|
|
36542
36542
|
enumerable: true,
|
|
36543
|
-
get: function
|
|
36543
|
+
get: function get3() {
|
|
36544
36544
|
return _enum["default"];
|
|
36545
36545
|
}
|
|
36546
36546
|
});
|
|
36547
36547
|
Object.defineProperty(exports2, "PatternValidationError", {
|
|
36548
36548
|
enumerable: true,
|
|
36549
|
-
get: function
|
|
36549
|
+
get: function get3() {
|
|
36550
36550
|
return _pattern["default"];
|
|
36551
36551
|
}
|
|
36552
36552
|
});
|
|
36553
36553
|
Object.defineProperty(exports2, "RequiredValidationError", {
|
|
36554
36554
|
enumerable: true,
|
|
36555
|
-
get: function
|
|
36555
|
+
get: function get3() {
|
|
36556
36556
|
return _required["default"];
|
|
36557
36557
|
}
|
|
36558
36558
|
});
|
|
36559
36559
|
Object.defineProperty(exports2, "UnevaluatedPropValidationError", {
|
|
36560
36560
|
enumerable: true,
|
|
36561
|
-
get: function
|
|
36561
|
+
get: function get3() {
|
|
36562
36562
|
return _unevaluatedProp["default"];
|
|
36563
36563
|
}
|
|
36564
36564
|
});
|
|
@@ -36619,15 +36619,15 @@ var require_helpers = __commonJS({
|
|
|
36619
36619
|
var instancePath = typeof ajvError.instancePath !== "undefined" ? ajvError.instancePath : ajvError.dataPath;
|
|
36620
36620
|
var paths = instancePath === "" ? [""] : instancePath.match(JSON_POINTERS_REGEX);
|
|
36621
36621
|
if (paths) {
|
|
36622
|
-
paths.reduce(function(obj,
|
|
36623
|
-
obj.children[
|
|
36622
|
+
paths.reduce(function(obj, path6, i) {
|
|
36623
|
+
obj.children[path6] = obj.children[path6] || {
|
|
36624
36624
|
children: {},
|
|
36625
36625
|
errors: []
|
|
36626
36626
|
};
|
|
36627
36627
|
if (i === paths.length - 1) {
|
|
36628
|
-
obj.children[
|
|
36628
|
+
obj.children[path6].errors.push(ajvError);
|
|
36629
36629
|
}
|
|
36630
|
-
return obj.children[
|
|
36630
|
+
return obj.children[path6];
|
|
36631
36631
|
}, root);
|
|
36632
36632
|
}
|
|
36633
36633
|
});
|
|
@@ -39935,8 +39935,8 @@ var require_utils4 = __commonJS({
|
|
|
39935
39935
|
}
|
|
39936
39936
|
return ind;
|
|
39937
39937
|
}
|
|
39938
|
-
function removeDotSegments(
|
|
39939
|
-
let input =
|
|
39938
|
+
function removeDotSegments(path6) {
|
|
39939
|
+
let input = path6;
|
|
39940
39940
|
const output = [];
|
|
39941
39941
|
let nextSlash = -1;
|
|
39942
39942
|
let len = 0;
|
|
@@ -40188,8 +40188,8 @@ var require_schemes = __commonJS({
|
|
|
40188
40188
|
wsComponent.secure = void 0;
|
|
40189
40189
|
}
|
|
40190
40190
|
if (wsComponent.resourceName) {
|
|
40191
|
-
const [
|
|
40192
|
-
wsComponent.path =
|
|
40191
|
+
const [path6, query] = wsComponent.resourceName.split("?");
|
|
40192
|
+
wsComponent.path = path6 && path6 !== "/" ? path6 : void 0;
|
|
40193
40193
|
wsComponent.query = query;
|
|
40194
40194
|
wsComponent.resourceName = void 0;
|
|
40195
40195
|
}
|
|
@@ -44226,10 +44226,10 @@ __export(cli_exports, {
|
|
|
44226
44226
|
toDotenv: () => toDotenv
|
|
44227
44227
|
});
|
|
44228
44228
|
module.exports = __toCommonJS(cli_exports);
|
|
44229
|
-
var
|
|
44230
|
-
var
|
|
44229
|
+
var import_node_fs4 = require("node:fs");
|
|
44230
|
+
var import_promises4 = require("node:fs/promises");
|
|
44231
44231
|
var import_node_child_process = require("node:child_process");
|
|
44232
|
-
var
|
|
44232
|
+
var import_node_path3 = __toESM(require("node:path"), 1);
|
|
44233
44233
|
var import_node_util = require("node:util");
|
|
44234
44234
|
|
|
44235
44235
|
// node_modules/@actions/io/lib/io.js
|
|
@@ -44952,8 +44952,8 @@ var ExitCode;
|
|
|
44952
44952
|
})(ExitCode || (ExitCode = {}));
|
|
44953
44953
|
|
|
44954
44954
|
// src/index.ts
|
|
44955
|
-
var
|
|
44956
|
-
var
|
|
44955
|
+
var import_node_crypto2 = require("node:crypto");
|
|
44956
|
+
var import_node_fs3 = require("node:fs");
|
|
44957
44957
|
var import_yaml3 = __toESM(require_dist(), 1);
|
|
44958
44958
|
|
|
44959
44959
|
// src/contracts.ts
|
|
@@ -45045,6 +45045,35 @@ var customerPreviewActionContract = {
|
|
|
45045
45045
|
default: "",
|
|
45046
45046
|
allowedValues: ["3.0", "3.1"]
|
|
45047
45047
|
},
|
|
45048
|
+
"breaking-change-mode": {
|
|
45049
|
+
description: "OpenAPI breaking-change comparison mode.",
|
|
45050
|
+
required: false,
|
|
45051
|
+
default: "off",
|
|
45052
|
+
allowedValues: ["off", "pr-native", "baseline-only", "previous-spec"]
|
|
45053
|
+
},
|
|
45054
|
+
"breaking-baseline-spec-path": {
|
|
45055
|
+
description: "Workspace-relative baseline OpenAPI spec path used by baseline-only mode and pr-native fallback.",
|
|
45056
|
+
required: false
|
|
45057
|
+
},
|
|
45058
|
+
"breaking-rules-path": {
|
|
45059
|
+
description: "Workspace-relative openapi-changes rules file. Missing files are ignored.",
|
|
45060
|
+
required: false,
|
|
45061
|
+
default: "changes-rules.yaml"
|
|
45062
|
+
},
|
|
45063
|
+
"breaking-target-ref": {
|
|
45064
|
+
description: "Optional target branch or git ref override for pr-native breaking-change comparisons.",
|
|
45065
|
+
required: false
|
|
45066
|
+
},
|
|
45067
|
+
"breaking-summary-path": {
|
|
45068
|
+
description: "Optional markdown report output path. Defaults to a runner-temp file.",
|
|
45069
|
+
required: false,
|
|
45070
|
+
default: ""
|
|
45071
|
+
},
|
|
45072
|
+
"breaking-log-path": {
|
|
45073
|
+
description: "Optional raw command log output path. Defaults to a runner-temp file.",
|
|
45074
|
+
required: false,
|
|
45075
|
+
default: ""
|
|
45076
|
+
},
|
|
45048
45077
|
"governance-mapping-json": {
|
|
45049
45078
|
description: "Legacy JSON map of business domain to governance group name. Prefer governance-group or the postman-governance-group repository custom property.",
|
|
45050
45079
|
required: false,
|
|
@@ -45123,6 +45152,12 @@ var customerPreviewActionContract = {
|
|
|
45123
45152
|
},
|
|
45124
45153
|
"lint-summary-json": {
|
|
45125
45154
|
description: "JSON summary of lint errors and warnings."
|
|
45155
|
+
},
|
|
45156
|
+
"breaking-change-status": {
|
|
45157
|
+
description: "OpenAPI breaking-change check status."
|
|
45158
|
+
},
|
|
45159
|
+
"breaking-change-summary-json": {
|
|
45160
|
+
description: "JSON summary of the OpenAPI breaking-change check."
|
|
45126
45161
|
}
|
|
45127
45162
|
},
|
|
45128
45163
|
retainedBehavior: [
|
|
@@ -45132,6 +45167,7 @@ var customerPreviewActionContract = {
|
|
|
45132
45167
|
"workspace admin assignment",
|
|
45133
45168
|
"spec upload to Spec Hub",
|
|
45134
45169
|
"OpenAPI operation summary normalization before upload (missing or oversized summaries)",
|
|
45170
|
+
"optional OpenAPI breaking-change detection before Postman mutations",
|
|
45135
45171
|
"spec linting by UID",
|
|
45136
45172
|
"baseline, smoke, and contract collection generation",
|
|
45137
45173
|
"collection refresh and versioning policies",
|
|
@@ -45227,10 +45263,10 @@ function sanitizeHeaders(headers, secretValues) {
|
|
|
45227
45263
|
}
|
|
45228
45264
|
|
|
45229
45265
|
// src/lib/github/github-api-client.ts
|
|
45230
|
-
function buildErrorMessage(method,
|
|
45266
|
+
function buildErrorMessage(method, path6, response, body, masker) {
|
|
45231
45267
|
const status = `${response.status}${response.statusText ? ` ${response.statusText}` : ""}`;
|
|
45232
45268
|
const sanitizedBody = masker(body || "");
|
|
45233
|
-
return sanitizedBody ? masker(`${method} ${
|
|
45269
|
+
return sanitizedBody ? masker(`${method} ${path6} failed with ${status} - ${sanitizedBody}`) : masker(`${method} ${path6} failed with ${status} - [REDACTED]`);
|
|
45234
45270
|
}
|
|
45235
45271
|
var GitHubApiClient = class {
|
|
45236
45272
|
apiBase;
|
|
@@ -45280,11 +45316,11 @@ var GitHubApiClient = class {
|
|
|
45280
45316
|
}
|
|
45281
45317
|
return ordered;
|
|
45282
45318
|
}
|
|
45283
|
-
isVariablesEndpoint(
|
|
45284
|
-
return
|
|
45319
|
+
isVariablesEndpoint(path6) {
|
|
45320
|
+
return path6.startsWith(`/repos/${this.owner}/${this.repo}/actions/variables`);
|
|
45285
45321
|
}
|
|
45286
|
-
canUseFallback(
|
|
45287
|
-
return this.isVariablesEndpoint(
|
|
45322
|
+
canUseFallback(path6) {
|
|
45323
|
+
return this.isVariablesEndpoint(path6) || path6 === `/repos/${this.owner}/${this.repo}/properties/values` || path6.includes(`/repos/${this.owner}/${this.repo}/contents`) || path6.includes("/dispatches");
|
|
45288
45324
|
}
|
|
45289
45325
|
rateLimitDelayMs(response, attempt) {
|
|
45290
45326
|
const retryAfter = Number(response.headers.get("retry-after") || "");
|
|
@@ -45302,14 +45338,14 @@ var GitHubApiClient = class {
|
|
|
45302
45338
|
const jitter = Math.floor(Math.random() * 250);
|
|
45303
45339
|
return Math.min(base + jitter, 12e4);
|
|
45304
45340
|
}
|
|
45305
|
-
async requestWithToken(
|
|
45341
|
+
async requestWithToken(path6, init, token) {
|
|
45306
45342
|
const MAX_RETRIES = 5;
|
|
45307
45343
|
const normalizedToken = String(token || "").trim();
|
|
45308
45344
|
if (!normalizedToken) {
|
|
45309
|
-
throw new Error(`Missing GitHub auth token for request ${
|
|
45345
|
+
throw new Error(`Missing GitHub auth token for request ${path6}`);
|
|
45310
45346
|
}
|
|
45311
45347
|
for (let attempt = 0; ; attempt++) {
|
|
45312
|
-
const response = await this.fetchImpl(`${this.apiBase}${
|
|
45348
|
+
const response = await this.fetchImpl(`${this.apiBase}${path6}`, {
|
|
45313
45349
|
...init,
|
|
45314
45350
|
headers: {
|
|
45315
45351
|
Accept: "application/vnd.github+json",
|
|
@@ -45332,28 +45368,28 @@ var GitHubApiClient = class {
|
|
|
45332
45368
|
return response;
|
|
45333
45369
|
}
|
|
45334
45370
|
}
|
|
45335
|
-
async request(
|
|
45371
|
+
async request(path6, init = {}) {
|
|
45336
45372
|
const orderedTokens = this.getTokenOrder();
|
|
45337
45373
|
if (orderedTokens.length === 0) {
|
|
45338
45374
|
throw new Error("No GitHub auth token configured");
|
|
45339
45375
|
}
|
|
45340
|
-
const first = await this.requestWithToken(
|
|
45341
|
-
if (orderedTokens.length < 2 || !this.canUseFallback(
|
|
45376
|
+
const first = await this.requestWithToken(path6, init, orderedTokens[0]);
|
|
45377
|
+
if (orderedTokens.length < 2 || !this.canUseFallback(path6)) {
|
|
45342
45378
|
return first;
|
|
45343
45379
|
}
|
|
45344
|
-
const isVariableGet404 = first.status === 404 && (!init.method || init.method === "GET") && this.isVariablesEndpoint(
|
|
45380
|
+
const isVariableGet404 = first.status === 404 && (!init.method || init.method === "GET") && this.isVariablesEndpoint(path6);
|
|
45345
45381
|
if (first.status !== 403 && !isVariableGet404) {
|
|
45346
45382
|
return first;
|
|
45347
45383
|
}
|
|
45348
|
-
return this.requestWithToken(
|
|
45384
|
+
return this.requestWithToken(path6, init, orderedTokens[1]);
|
|
45349
45385
|
}
|
|
45350
45386
|
async setRepositoryVariable(name, value) {
|
|
45351
45387
|
if (!value) {
|
|
45352
45388
|
throw new Error(`Repo variable ${name} is empty`);
|
|
45353
45389
|
}
|
|
45354
|
-
const
|
|
45390
|
+
const path6 = `/repos/${this.repository}/actions/variables`;
|
|
45355
45391
|
const body = JSON.stringify({ name, value: String(value) });
|
|
45356
|
-
const createResponse = await this.request(
|
|
45392
|
+
const createResponse = await this.request(path6, {
|
|
45357
45393
|
method: "POST",
|
|
45358
45394
|
body
|
|
45359
45395
|
});
|
|
@@ -45376,12 +45412,12 @@ var GitHubApiClient = class {
|
|
|
45376
45412
|
}
|
|
45377
45413
|
const text = await createResponse.text().catch(() => "");
|
|
45378
45414
|
throw new Error(
|
|
45379
|
-
buildErrorMessage("POST",
|
|
45415
|
+
buildErrorMessage("POST", path6, createResponse, text, this.secretMasker)
|
|
45380
45416
|
);
|
|
45381
45417
|
}
|
|
45382
45418
|
async getRepositoryVariable(name) {
|
|
45383
|
-
const
|
|
45384
|
-
const response = await this.request(
|
|
45419
|
+
const path6 = `/repos/${this.repository}/actions/variables/${name}`;
|
|
45420
|
+
const response = await this.request(path6, {
|
|
45385
45421
|
method: "GET"
|
|
45386
45422
|
});
|
|
45387
45423
|
if (response.status === 404) {
|
|
@@ -45390,15 +45426,15 @@ var GitHubApiClient = class {
|
|
|
45390
45426
|
if (!response.ok) {
|
|
45391
45427
|
const text = await response.text().catch(() => "");
|
|
45392
45428
|
throw new Error(
|
|
45393
|
-
buildErrorMessage("GET",
|
|
45429
|
+
buildErrorMessage("GET", path6, response, text, this.secretMasker)
|
|
45394
45430
|
);
|
|
45395
45431
|
}
|
|
45396
45432
|
const data = await response.json();
|
|
45397
45433
|
return String(data.value || "");
|
|
45398
45434
|
}
|
|
45399
45435
|
async getRepositoryCustomProperty(name) {
|
|
45400
|
-
const
|
|
45401
|
-
const response = await this.request(
|
|
45436
|
+
const path6 = `/repos/${this.repository}/properties/values`;
|
|
45437
|
+
const response = await this.request(path6, {
|
|
45402
45438
|
method: "GET"
|
|
45403
45439
|
});
|
|
45404
45440
|
if (response.status === 404) {
|
|
@@ -45407,7 +45443,7 @@ var GitHubApiClient = class {
|
|
|
45407
45443
|
if (!response.ok) {
|
|
45408
45444
|
const text = await response.text().catch(() => "");
|
|
45409
45445
|
throw new Error(
|
|
45410
|
-
buildErrorMessage("GET",
|
|
45446
|
+
buildErrorMessage("GET", path6, response, text, this.secretMasker)
|
|
45411
45447
|
);
|
|
45412
45448
|
}
|
|
45413
45449
|
const values = await response.json();
|
|
@@ -45489,6 +45525,593 @@ var HttpError = class _HttpError extends Error {
|
|
|
45489
45525
|
}
|
|
45490
45526
|
};
|
|
45491
45527
|
|
|
45528
|
+
// src/lib/openapi-changes.ts
|
|
45529
|
+
var import_node_crypto = require("node:crypto");
|
|
45530
|
+
var import_node_fs = require("node:fs");
|
|
45531
|
+
var import_promises = require("node:fs/promises");
|
|
45532
|
+
var import_node_https = require("node:https");
|
|
45533
|
+
var import_node_os = __toESM(require("node:os"), 1);
|
|
45534
|
+
var import_node_path = __toESM(require("node:path"), 1);
|
|
45535
|
+
var TOOL_NAME = "openapi-changes";
|
|
45536
|
+
var OPENAPI_CHANGES_VERSION = "0.2.7";
|
|
45537
|
+
var RELEASE_BASE_URL = `https://github.com/pb33f/openapi-changes/releases/download/v${OPENAPI_CHANGES_VERSION}`;
|
|
45538
|
+
var CHECKSUMS = {
|
|
45539
|
+
"0.2.7": {
|
|
45540
|
+
"openapi-changes_0.2.7_darwin_arm64.tar.gz": "03e65e0d16c51fb8d43a93318409027bd9cd7c7c3355061d23c084c1ac9c0f7b",
|
|
45541
|
+
"openapi-changes_0.2.7_darwin_x86_64.tar.gz": "c064dab16fac342926126d060efd157ff283e18548ccf6081a7a71a8d3c5bc04",
|
|
45542
|
+
"openapi-changes_0.2.7_linux_arm64.tar.gz": "698b29336699fd4ec61e52585f140a6450d112c1eb1c637bbe34c13b4203fecc",
|
|
45543
|
+
"openapi-changes_0.2.7_linux_i386.tar.gz": "bb95699989ef67d0fd9d8644e56b1e183dea4dc439e59d051fe6964b87636f8c",
|
|
45544
|
+
"openapi-changes_0.2.7_linux_x86_64.tar.gz": "333742ea369c90437fbda47a814cf2393cb65eaa3867268a4c86281e74f614bf",
|
|
45545
|
+
"openapi-changes_0.2.7_windows_arm64.tar.gz": "3dfc29f88fb4332a3bf2d6d45fb9ab02ef907e7bc45fb8e8630ad943c4b9d814",
|
|
45546
|
+
"openapi-changes_0.2.7_windows_i386.tar.gz": "78e868e15d0e15f358f7f350af3c9532f6720a140bbb9241dbb947d49c6ec20c",
|
|
45547
|
+
"openapi-changes_0.2.7_windows_x86_64.tar.gz": "fff5a68713b9093ad8ab547d214b5a3b9139ad71e90ee9e1347b3f9bd6e1e191"
|
|
45548
|
+
}
|
|
45549
|
+
};
|
|
45550
|
+
function firstValue(...values) {
|
|
45551
|
+
return values.find((value) => String(value ?? "").trim())?.trim();
|
|
45552
|
+
}
|
|
45553
|
+
function getWorkspaceRoot(env = process.env) {
|
|
45554
|
+
return (0, import_node_fs.realpathSync)(import_node_path.default.resolve(env.GITHUB_WORKSPACE || process.cwd()));
|
|
45555
|
+
}
|
|
45556
|
+
function getTempRoot(env = process.env) {
|
|
45557
|
+
return (0, import_node_fs.realpathSync)(import_node_path.default.resolve(env.RUNNER_TEMP || import_node_os.default.tmpdir()));
|
|
45558
|
+
}
|
|
45559
|
+
function ensureInsideRoot(root, candidate, message) {
|
|
45560
|
+
const relative2 = import_node_path.default.relative(root, candidate);
|
|
45561
|
+
if (relative2.startsWith("..") || import_node_path.default.isAbsolute(relative2)) {
|
|
45562
|
+
throw new Error(message);
|
|
45563
|
+
}
|
|
45564
|
+
}
|
|
45565
|
+
function nearestExistingPath(candidate) {
|
|
45566
|
+
let current = candidate;
|
|
45567
|
+
while (!(0, import_node_fs.existsSync)(current)) {
|
|
45568
|
+
const parent = import_node_path.default.dirname(current);
|
|
45569
|
+
if (parent === current) {
|
|
45570
|
+
return current;
|
|
45571
|
+
}
|
|
45572
|
+
current = parent;
|
|
45573
|
+
}
|
|
45574
|
+
return current;
|
|
45575
|
+
}
|
|
45576
|
+
function isInsideAnyRoot(roots, candidate) {
|
|
45577
|
+
return roots.some((root) => {
|
|
45578
|
+
const relative2 = import_node_path.default.relative(root, candidate);
|
|
45579
|
+
return !relative2.startsWith("..") && !import_node_path.default.isAbsolute(relative2);
|
|
45580
|
+
});
|
|
45581
|
+
}
|
|
45582
|
+
function assertOutputFileAllowed(filePath, workspaceRoot, tempRoot) {
|
|
45583
|
+
const workspaceRealPath = (0, import_node_fs.realpathSync)(workspaceRoot);
|
|
45584
|
+
const tempRealPath = (0, import_node_fs.realpathSync)(tempRoot);
|
|
45585
|
+
const resolved = import_node_path.default.resolve(filePath);
|
|
45586
|
+
const existingPath = nearestExistingPath(resolved);
|
|
45587
|
+
const existingRealPath = (0, import_node_fs.realpathSync)(existingPath);
|
|
45588
|
+
if (!isInsideAnyRoot([workspaceRealPath, tempRealPath], existingRealPath)) {
|
|
45589
|
+
throw new Error("Breaking-change output path must stay within the workspace or runner temp directory");
|
|
45590
|
+
}
|
|
45591
|
+
return resolved;
|
|
45592
|
+
}
|
|
45593
|
+
function resolveConfiguredOutputPath(configuredPath, defaultFileName, workspaceRoot, tempRoot) {
|
|
45594
|
+
const defaultPath = import_node_path.default.join(tempRoot, "postman-bootstrap", defaultFileName);
|
|
45595
|
+
if (!configuredPath) {
|
|
45596
|
+
return defaultPath;
|
|
45597
|
+
}
|
|
45598
|
+
const resolved = import_node_path.default.isAbsolute(configuredPath) ? configuredPath : import_node_path.default.join(workspaceRoot, configuredPath);
|
|
45599
|
+
return assertOutputFileAllowed(resolved, workspaceRoot, tempRoot);
|
|
45600
|
+
}
|
|
45601
|
+
function resolveWorkspaceFilePath(configuredPath, workspaceRoot) {
|
|
45602
|
+
if (!configuredPath) {
|
|
45603
|
+
return void 0;
|
|
45604
|
+
}
|
|
45605
|
+
const workspaceRealPath = (0, import_node_fs.realpathSync)(workspaceRoot);
|
|
45606
|
+
const resolved = import_node_path.default.isAbsolute(configuredPath) ? import_node_path.default.resolve(configuredPath) : import_node_path.default.resolve(workspaceRoot, configuredPath);
|
|
45607
|
+
ensureInsideRoot(workspaceRealPath, resolved, "Breaking-change input path must stay within the workspace");
|
|
45608
|
+
if (!(0, import_node_fs.existsSync)(resolved)) {
|
|
45609
|
+
return void 0;
|
|
45610
|
+
}
|
|
45611
|
+
const realResolved = (0, import_node_fs.realpathSync)(resolved);
|
|
45612
|
+
ensureInsideRoot(
|
|
45613
|
+
workspaceRealPath,
|
|
45614
|
+
realResolved,
|
|
45615
|
+
"Breaking-change input path must stay within the workspace"
|
|
45616
|
+
);
|
|
45617
|
+
return realResolved;
|
|
45618
|
+
}
|
|
45619
|
+
function workspaceRelativePath(filePath, workspaceRoot) {
|
|
45620
|
+
const resolved = import_node_path.default.isAbsolute(filePath) ? import_node_path.default.resolve(filePath) : import_node_path.default.resolve(workspaceRoot, filePath);
|
|
45621
|
+
const realResolved = (0, import_node_fs.existsSync)(resolved) ? (0, import_node_fs.realpathSync)(resolved) : resolved;
|
|
45622
|
+
ensureInsideRoot(workspaceRoot, realResolved, "spec-path must stay within the workspace");
|
|
45623
|
+
const relative2 = import_node_path.default.relative(workspaceRoot, realResolved);
|
|
45624
|
+
return relative2.split(import_node_path.default.sep).join("/");
|
|
45625
|
+
}
|
|
45626
|
+
function normalizeBranch(value) {
|
|
45627
|
+
let branchName = String(value || "main").trim();
|
|
45628
|
+
branchName = branchName.replace(/^refs\/remotes\/origin\//, "").replace(/^refs\/heads\//, "").replace(/^origin\//, "");
|
|
45629
|
+
if (!branchName) {
|
|
45630
|
+
branchName = "main";
|
|
45631
|
+
}
|
|
45632
|
+
if (!/^[A-Za-z0-9._/-]+$/.test(branchName)) {
|
|
45633
|
+
throw new Error(`Unsupported target branch name: ${branchName}`);
|
|
45634
|
+
}
|
|
45635
|
+
return branchName;
|
|
45636
|
+
}
|
|
45637
|
+
async function gitObjectExists(dependencies, refSpec, cwd2) {
|
|
45638
|
+
const result = await dependencies.exec.getExecOutput("git", ["cat-file", "-e", refSpec], {
|
|
45639
|
+
cwd: cwd2,
|
|
45640
|
+
ignoreReturnCode: true
|
|
45641
|
+
});
|
|
45642
|
+
return result.exitCode === 0;
|
|
45643
|
+
}
|
|
45644
|
+
function targetBranchCandidates(configuredTargetRef, env) {
|
|
45645
|
+
const targetBranch = normalizeBranch(firstValue(
|
|
45646
|
+
configuredTargetRef,
|
|
45647
|
+
env.GITHUB_BASE_REF,
|
|
45648
|
+
env.CHANGE_TARGET,
|
|
45649
|
+
env.BITBUCKET_TARGET_BRANCH,
|
|
45650
|
+
env.CI_MERGE_REQUEST_TARGET_BRANCH_NAME,
|
|
45651
|
+
env.SYSTEM_PULLREQUEST_TARGETBRANCH,
|
|
45652
|
+
"main"
|
|
45653
|
+
));
|
|
45654
|
+
return Array.from(/* @__PURE__ */ new Set([`origin/${targetBranch}`, targetBranch]));
|
|
45655
|
+
}
|
|
45656
|
+
async function writeTempSpecFile(tempRoot, name, content) {
|
|
45657
|
+
const tempDir = import_node_path.default.join(tempRoot, "postman-bootstrap", `openapi-changes-${process.pid}-${Date.now()}`);
|
|
45658
|
+
await (0, import_promises.mkdir)(tempDir, { recursive: true });
|
|
45659
|
+
const filePath = import_node_path.default.join(tempDir, name);
|
|
45660
|
+
await (0, import_promises.writeFile)(filePath, content, "utf8");
|
|
45661
|
+
return filePath;
|
|
45662
|
+
}
|
|
45663
|
+
async function removeTempSpecFile(filePath) {
|
|
45664
|
+
const parent = import_node_path.default.dirname(filePath);
|
|
45665
|
+
if (parent.includes(`${import_node_path.default.sep}openapi-changes-`)) {
|
|
45666
|
+
await (0, import_promises.rm)(parent, { recursive: true, force: true });
|
|
45667
|
+
}
|
|
45668
|
+
}
|
|
45669
|
+
async function resolveComparisonSource(inputs, dependencies, workspaceRoot, tempRoot) {
|
|
45670
|
+
if (inputs.mode === "previous-spec") {
|
|
45671
|
+
if (!inputs.previousSpecContent) {
|
|
45672
|
+
return {
|
|
45673
|
+
skipped: true,
|
|
45674
|
+
reason: "No existing Spec Hub content was available for comparison."
|
|
45675
|
+
};
|
|
45676
|
+
}
|
|
45677
|
+
const previous = await writeTempSpecFile(tempRoot, "previous-openapi.json", inputs.previousSpecContent);
|
|
45678
|
+
const current = await writeTempSpecFile(tempRoot, "current-openapi.json", inputs.currentUploadContent);
|
|
45679
|
+
return {
|
|
45680
|
+
current,
|
|
45681
|
+
label: "Spec Hub previous version -> incoming spec",
|
|
45682
|
+
previous,
|
|
45683
|
+
tempFiles: [previous, current]
|
|
45684
|
+
};
|
|
45685
|
+
}
|
|
45686
|
+
const currentPath = inputs.specPath ? resolveWorkspaceFilePath(inputs.specPath, workspaceRoot) : void 0;
|
|
45687
|
+
if (inputs.mode === "pr-native" && inputs.specPath && currentPath) {
|
|
45688
|
+
const gitSpecPath = workspaceRelativePath(inputs.specPath, workspaceRoot);
|
|
45689
|
+
for (const targetRef of targetBranchCandidates(inputs.targetRef, dependencies.env ?? process.env)) {
|
|
45690
|
+
const targetRefSpec = `${targetRef}:${gitSpecPath}`;
|
|
45691
|
+
if (await gitObjectExists(dependencies, targetRefSpec, workspaceRoot)) {
|
|
45692
|
+
return {
|
|
45693
|
+
current: gitSpecPath,
|
|
45694
|
+
label: `${targetRefSpec} -> ${gitSpecPath}`,
|
|
45695
|
+
previous: targetRefSpec,
|
|
45696
|
+
tempFiles: []
|
|
45697
|
+
};
|
|
45698
|
+
}
|
|
45699
|
+
}
|
|
45700
|
+
}
|
|
45701
|
+
const baselinePath = resolveWorkspaceFilePath(inputs.baselineSpecPath, workspaceRoot);
|
|
45702
|
+
if (baselinePath) {
|
|
45703
|
+
const current = currentPath ?? await writeTempSpecFile(
|
|
45704
|
+
tempRoot,
|
|
45705
|
+
"current-openapi.json",
|
|
45706
|
+
inputs.currentUploadContent
|
|
45707
|
+
);
|
|
45708
|
+
return {
|
|
45709
|
+
current,
|
|
45710
|
+
label: `${inputs.baselineSpecPath} -> ${inputs.specPath || "incoming spec"}`,
|
|
45711
|
+
previous: baselinePath,
|
|
45712
|
+
tempFiles: currentPath ? [] : [current]
|
|
45713
|
+
};
|
|
45714
|
+
}
|
|
45715
|
+
return {
|
|
45716
|
+
skipped: true,
|
|
45717
|
+
reason: inputs.mode === "baseline-only" ? `No baseline spec found at ${inputs.baselineSpecPath || "(empty)"}.` : "No target-branch spec or baseline spec was available for comparison."
|
|
45718
|
+
};
|
|
45719
|
+
}
|
|
45720
|
+
var ANSI_ESCAPE_PATTERN = new RegExp(String.raw`\u001B\[[0-?]*[ -/]*[@-~]`, "g");
|
|
45721
|
+
function stripAnsi(value) {
|
|
45722
|
+
return String(value || "").replace(ANSI_ESCAPE_PATTERN, "");
|
|
45723
|
+
}
|
|
45724
|
+
function sanitizeOpenApiChangesSummary(value) {
|
|
45725
|
+
return String(value || "").split(/\r?\n/).filter((line) => {
|
|
45726
|
+
const normalized = line.trim().replace(/\*\*/g, "");
|
|
45727
|
+
return !/^Date:\s.*\|\s*Commit:\s*Original:\s.*,\s*Modified:\s.*$/.test(normalized);
|
|
45728
|
+
}).join("\n").trim();
|
|
45729
|
+
}
|
|
45730
|
+
function breakingChangeCount(value) {
|
|
45731
|
+
if (Array.isArray(value)) {
|
|
45732
|
+
return value.reduce((total2, entry) => total2 + breakingChangeCount(entry), 0);
|
|
45733
|
+
}
|
|
45734
|
+
if (!value || typeof value !== "object") {
|
|
45735
|
+
return 0;
|
|
45736
|
+
}
|
|
45737
|
+
let total = 0;
|
|
45738
|
+
for (const [key, entry] of Object.entries(value)) {
|
|
45739
|
+
const normalizedKey = key.toLowerCase().replace(/[^a-z]/g, "");
|
|
45740
|
+
if (entry === true && ["breaking", "breakingchange", "isbreaking", "isbreakingchange"].includes(normalizedKey)) {
|
|
45741
|
+
total += 1;
|
|
45742
|
+
continue;
|
|
45743
|
+
}
|
|
45744
|
+
total += breakingChangeCount(entry);
|
|
45745
|
+
}
|
|
45746
|
+
return total;
|
|
45747
|
+
}
|
|
45748
|
+
function formatReport(options) {
|
|
45749
|
+
const lines = [
|
|
45750
|
+
"# OpenAPI Breaking Change Check",
|
|
45751
|
+
"",
|
|
45752
|
+
`Status: ${options.status}`
|
|
45753
|
+
];
|
|
45754
|
+
if (options.comparison) {
|
|
45755
|
+
lines.push(`Comparison: ${options.comparison}`);
|
|
45756
|
+
}
|
|
45757
|
+
if (options.message) {
|
|
45758
|
+
lines.push("", options.message);
|
|
45759
|
+
}
|
|
45760
|
+
if (options.body?.trim()) {
|
|
45761
|
+
lines.push("", options.body.trim());
|
|
45762
|
+
}
|
|
45763
|
+
return `${lines.join("\n")}
|
|
45764
|
+
`;
|
|
45765
|
+
}
|
|
45766
|
+
async function writeReportFiles(summaryPath, logPath, report, log, env) {
|
|
45767
|
+
await (0, import_promises.mkdir)(import_node_path.default.dirname(summaryPath), { recursive: true });
|
|
45768
|
+
await (0, import_promises.mkdir)(import_node_path.default.dirname(logPath), { recursive: true });
|
|
45769
|
+
await (0, import_promises.writeFile)(summaryPath, report, "utf8");
|
|
45770
|
+
await (0, import_promises.writeFile)(logPath, log, "utf8");
|
|
45771
|
+
if (env.GITHUB_STEP_SUMMARY) {
|
|
45772
|
+
await (0, import_promises.appendFile)(env.GITHUB_STEP_SUMMARY, `
|
|
45773
|
+
${report}
|
|
45774
|
+
`, "utf8");
|
|
45775
|
+
}
|
|
45776
|
+
}
|
|
45777
|
+
function buildResultJson(result) {
|
|
45778
|
+
return JSON.stringify({
|
|
45779
|
+
breakingChanges: result.breakingChanges,
|
|
45780
|
+
comparison: result.comparison,
|
|
45781
|
+
exitCode: result.exitCode,
|
|
45782
|
+
logPath: result.logPath,
|
|
45783
|
+
message: result.message,
|
|
45784
|
+
mode: result.mode,
|
|
45785
|
+
status: result.status,
|
|
45786
|
+
summaryPath: result.summaryPath
|
|
45787
|
+
});
|
|
45788
|
+
}
|
|
45789
|
+
function createBreakingChangeSummaryJson(result) {
|
|
45790
|
+
return buildResultJson(result);
|
|
45791
|
+
}
|
|
45792
|
+
function mapPlatform() {
|
|
45793
|
+
const platforms = {
|
|
45794
|
+
aix: void 0,
|
|
45795
|
+
android: void 0,
|
|
45796
|
+
darwin: "darwin",
|
|
45797
|
+
freebsd: void 0,
|
|
45798
|
+
haiku: void 0,
|
|
45799
|
+
linux: "linux",
|
|
45800
|
+
openbsd: void 0,
|
|
45801
|
+
sunos: void 0,
|
|
45802
|
+
win32: "windows",
|
|
45803
|
+
cygwin: void 0,
|
|
45804
|
+
netbsd: void 0
|
|
45805
|
+
};
|
|
45806
|
+
const platform2 = platforms[process.platform];
|
|
45807
|
+
if (!platform2) {
|
|
45808
|
+
throw new Error(`Unsupported openapi-changes platform: ${process.platform}`);
|
|
45809
|
+
}
|
|
45810
|
+
return platform2;
|
|
45811
|
+
}
|
|
45812
|
+
function mapArch() {
|
|
45813
|
+
const architectures = {
|
|
45814
|
+
arm: void 0,
|
|
45815
|
+
arm64: "arm64",
|
|
45816
|
+
ia32: "i386",
|
|
45817
|
+
loong64: void 0,
|
|
45818
|
+
mips: void 0,
|
|
45819
|
+
mipsel: void 0,
|
|
45820
|
+
ppc: void 0,
|
|
45821
|
+
ppc64: void 0,
|
|
45822
|
+
riscv64: void 0,
|
|
45823
|
+
s390: void 0,
|
|
45824
|
+
s390x: void 0,
|
|
45825
|
+
x64: "x86_64"
|
|
45826
|
+
};
|
|
45827
|
+
const arch2 = architectures[process.arch];
|
|
45828
|
+
if (!arch2) {
|
|
45829
|
+
throw new Error(`Unsupported openapi-changes architecture: ${process.arch}`);
|
|
45830
|
+
}
|
|
45831
|
+
return arch2;
|
|
45832
|
+
}
|
|
45833
|
+
function sha256(filePath) {
|
|
45834
|
+
return (0, import_node_crypto.createHash)("sha256").update((0, import_node_fs.readFileSync)(filePath)).digest("hex");
|
|
45835
|
+
}
|
|
45836
|
+
function validatePinnedOpenApiChangesChecksums() {
|
|
45837
|
+
for (const [version, checksums] of Object.entries(CHECKSUMS)) {
|
|
45838
|
+
for (const [assetName, checksum] of Object.entries(checksums)) {
|
|
45839
|
+
if (!/^[a-f0-9]{64}$/.test(checksum)) {
|
|
45840
|
+
throw new Error(
|
|
45841
|
+
`Pinned checksum for ${assetName} in openapi-changes ${version} must be a 64-character lowercase SHA-256 hex digest`
|
|
45842
|
+
);
|
|
45843
|
+
}
|
|
45844
|
+
}
|
|
45845
|
+
}
|
|
45846
|
+
}
|
|
45847
|
+
function downloadFile(url, destination, redirectsRemaining = 5) {
|
|
45848
|
+
return new Promise((resolve3, reject) => {
|
|
45849
|
+
(0, import_node_https.get)(url, (response) => {
|
|
45850
|
+
const statusCode = response.statusCode || 0;
|
|
45851
|
+
const location2 = response.headers.location;
|
|
45852
|
+
if ([301, 302, 303, 307, 308].includes(statusCode) && location2) {
|
|
45853
|
+
response.resume();
|
|
45854
|
+
if (redirectsRemaining <= 0) {
|
|
45855
|
+
reject(new Error(`Too many redirects while downloading ${url}`));
|
|
45856
|
+
return;
|
|
45857
|
+
}
|
|
45858
|
+
const redirectedUrl = new URL(location2, url);
|
|
45859
|
+
if (redirectedUrl.protocol !== "https:") {
|
|
45860
|
+
reject(new Error(`Refusing non-HTTPS redirect for ${url}`));
|
|
45861
|
+
return;
|
|
45862
|
+
}
|
|
45863
|
+
downloadFile(redirectedUrl.toString(), destination, redirectsRemaining - 1).then(resolve3, reject);
|
|
45864
|
+
return;
|
|
45865
|
+
}
|
|
45866
|
+
if (statusCode < 200 || statusCode >= 300) {
|
|
45867
|
+
response.resume();
|
|
45868
|
+
reject(new Error(`Download failed for ${url}: HTTP ${statusCode}`));
|
|
45869
|
+
return;
|
|
45870
|
+
}
|
|
45871
|
+
const output = (0, import_node_fs.createWriteStream)(destination, { flags: "w" });
|
|
45872
|
+
response.pipe(output);
|
|
45873
|
+
output.on("finish", () => output.close(() => resolve3()));
|
|
45874
|
+
output.on("error", reject);
|
|
45875
|
+
}).on("error", reject);
|
|
45876
|
+
});
|
|
45877
|
+
}
|
|
45878
|
+
async function assertBinaryWorks(binaryPath, dependencies) {
|
|
45879
|
+
const result = await dependencies.exec.getExecOutput(binaryPath, ["version"], {
|
|
45880
|
+
ignoreReturnCode: true,
|
|
45881
|
+
silent: true
|
|
45882
|
+
});
|
|
45883
|
+
const installedVersion = result.stdout.trim();
|
|
45884
|
+
if (result.exitCode !== 0 || installedVersion !== OPENAPI_CHANGES_VERSION) {
|
|
45885
|
+
throw new Error(
|
|
45886
|
+
`Expected ${TOOL_NAME} ${OPENAPI_CHANGES_VERSION}, found ${installedVersion || "(unknown)"}.`
|
|
45887
|
+
);
|
|
45888
|
+
}
|
|
45889
|
+
}
|
|
45890
|
+
async function assertSafeTarEntries(archivePath, dependencies) {
|
|
45891
|
+
const listing = await dependencies.exec.getExecOutput("tar", ["-tzf", archivePath], {
|
|
45892
|
+
ignoreReturnCode: true,
|
|
45893
|
+
silent: true
|
|
45894
|
+
});
|
|
45895
|
+
if (listing.exitCode !== 0) {
|
|
45896
|
+
throw new Error(`Could not inspect ${TOOL_NAME} archive: ${listing.stderr}`);
|
|
45897
|
+
}
|
|
45898
|
+
for (const rawEntry of listing.stdout.split(/\r?\n/)) {
|
|
45899
|
+
const entry = rawEntry.trim();
|
|
45900
|
+
if (!entry) {
|
|
45901
|
+
continue;
|
|
45902
|
+
}
|
|
45903
|
+
if (entry.startsWith("/") || entry.startsWith("\\") || entry.includes("..")) {
|
|
45904
|
+
throw new Error(`Refusing unsafe archive entry: ${entry}`);
|
|
45905
|
+
}
|
|
45906
|
+
}
|
|
45907
|
+
}
|
|
45908
|
+
function findBinary(searchRoot, binaryName) {
|
|
45909
|
+
const entries = (0, import_node_fs.readdirSync)(searchRoot, { withFileTypes: true });
|
|
45910
|
+
for (const entry of entries) {
|
|
45911
|
+
const entryPath = import_node_path.default.join(searchRoot, entry.name);
|
|
45912
|
+
if (entry.isDirectory()) {
|
|
45913
|
+
const nested = findBinary(entryPath, binaryName);
|
|
45914
|
+
if (nested) {
|
|
45915
|
+
return nested;
|
|
45916
|
+
}
|
|
45917
|
+
} else if (entry.name === binaryName || entry.name === TOOL_NAME) {
|
|
45918
|
+
return entryPath;
|
|
45919
|
+
}
|
|
45920
|
+
}
|
|
45921
|
+
return "";
|
|
45922
|
+
}
|
|
45923
|
+
async function installOpenApiChanges(dependencies) {
|
|
45924
|
+
validatePinnedOpenApiChangesChecksums();
|
|
45925
|
+
const env = dependencies.env ?? process.env;
|
|
45926
|
+
const tempRoot = getTempRoot(env);
|
|
45927
|
+
const platform2 = mapPlatform();
|
|
45928
|
+
const arch2 = mapArch();
|
|
45929
|
+
const binaryName = process.platform === "win32" ? `${TOOL_NAME}.exe` : TOOL_NAME;
|
|
45930
|
+
const toolRoot = import_node_path.default.join(tempRoot, "postman-bootstrap-tools", TOOL_NAME, OPENAPI_CHANGES_VERSION, `${platform2}-${arch2}`);
|
|
45931
|
+
const binDir = import_node_path.default.join(toolRoot, "bin");
|
|
45932
|
+
const downloadsDir = import_node_path.default.join(toolRoot, "downloads");
|
|
45933
|
+
const extractDir = import_node_path.default.join(toolRoot, `extract-${Date.now()}`);
|
|
45934
|
+
const binaryPath = import_node_path.default.join(binDir, binaryName);
|
|
45935
|
+
if ((0, import_node_fs.existsSync)(binaryPath)) {
|
|
45936
|
+
try {
|
|
45937
|
+
await assertBinaryWorks(binaryPath, dependencies);
|
|
45938
|
+
dependencies.core.info(`${TOOL_NAME} ${OPENAPI_CHANGES_VERSION} already installed at ${binaryPath}`);
|
|
45939
|
+
return binaryPath;
|
|
45940
|
+
} catch (error) {
|
|
45941
|
+
dependencies.core.warning(
|
|
45942
|
+
`Reinstalling ${TOOL_NAME}: ${error instanceof Error ? error.message : String(error)}`
|
|
45943
|
+
);
|
|
45944
|
+
(0, import_node_fs.rmSync)(binaryPath, { force: true });
|
|
45945
|
+
}
|
|
45946
|
+
}
|
|
45947
|
+
const assetName = `${TOOL_NAME}_${OPENAPI_CHANGES_VERSION}_${platform2}_${arch2}.tar.gz`;
|
|
45948
|
+
const expectedChecksum = CHECKSUMS[OPENAPI_CHANGES_VERSION]?.[assetName];
|
|
45949
|
+
if (!expectedChecksum) {
|
|
45950
|
+
throw new Error(`No pinned checksum is configured for ${assetName}.`);
|
|
45951
|
+
}
|
|
45952
|
+
(0, import_node_fs.mkdirSync)(binDir, { recursive: true });
|
|
45953
|
+
(0, import_node_fs.mkdirSync)(downloadsDir, { recursive: true });
|
|
45954
|
+
(0, import_node_fs.mkdirSync)(extractDir, { recursive: true });
|
|
45955
|
+
const archivePath = import_node_path.default.join(downloadsDir, assetName);
|
|
45956
|
+
await downloadFile(`${RELEASE_BASE_URL}/${assetName}`, archivePath);
|
|
45957
|
+
const actualChecksum = sha256(archivePath);
|
|
45958
|
+
if (actualChecksum !== expectedChecksum) {
|
|
45959
|
+
throw new Error(`Checksum mismatch for ${assetName}: expected ${expectedChecksum}, got ${actualChecksum}`);
|
|
45960
|
+
}
|
|
45961
|
+
await assertSafeTarEntries(archivePath, dependencies);
|
|
45962
|
+
await dependencies.exec.exec("tar", ["-xzf", archivePath, "-C", extractDir], {
|
|
45963
|
+
silent: true
|
|
45964
|
+
});
|
|
45965
|
+
const extractedBinary = findBinary(extractDir, binaryName);
|
|
45966
|
+
if (!extractedBinary) {
|
|
45967
|
+
throw new Error(`Could not find ${binaryName} in ${assetName}.`);
|
|
45968
|
+
}
|
|
45969
|
+
(0, import_node_fs.rmSync)(binaryPath, { force: true });
|
|
45970
|
+
(0, import_node_fs.copyFileSync)(extractedBinary, binaryPath);
|
|
45971
|
+
if (process.platform !== "win32") {
|
|
45972
|
+
(0, import_node_fs.chmodSync)(binaryPath, 493);
|
|
45973
|
+
}
|
|
45974
|
+
(0, import_node_fs.rmSync)(extractDir, { recursive: true, force: true });
|
|
45975
|
+
await assertBinaryWorks(binaryPath, dependencies);
|
|
45976
|
+
dependencies.core.info(`Installed ${TOOL_NAME} ${OPENAPI_CHANGES_VERSION} at ${binaryPath}`);
|
|
45977
|
+
return binaryPath;
|
|
45978
|
+
}
|
|
45979
|
+
function rulesArgs(rulesPath, workspaceRoot, tempRoot) {
|
|
45980
|
+
const resolved = resolveWorkspaceFilePath(rulesPath, workspaceRoot);
|
|
45981
|
+
if (resolved) {
|
|
45982
|
+
return ["--config", resolved];
|
|
45983
|
+
}
|
|
45984
|
+
const defaultRulesPath = import_node_path.default.join(tempRoot, "postman-bootstrap", "openapi-changes-default-rules.yaml");
|
|
45985
|
+
(0, import_node_fs.mkdirSync)(import_node_path.default.dirname(defaultRulesPath), { recursive: true });
|
|
45986
|
+
(0, import_node_fs.writeFileSync)(defaultRulesPath, "{}\n", "utf8");
|
|
45987
|
+
return ["--config", defaultRulesPath];
|
|
45988
|
+
}
|
|
45989
|
+
var runOpenApiBreakingChangeCheck = async (inputs, dependencies) => {
|
|
45990
|
+
const env = dependencies.env ?? process.env;
|
|
45991
|
+
const workspaceRoot = getWorkspaceRoot(env);
|
|
45992
|
+
const tempRoot = getTempRoot(env);
|
|
45993
|
+
if (inputs.mode === "off") {
|
|
45994
|
+
return {
|
|
45995
|
+
breakingChanges: 0,
|
|
45996
|
+
comparison: "",
|
|
45997
|
+
exitCode: 0,
|
|
45998
|
+
logPath: "",
|
|
45999
|
+
message: "Breaking-change check is disabled.",
|
|
46000
|
+
mode: inputs.mode,
|
|
46001
|
+
status: "skipped",
|
|
46002
|
+
summaryPath: ""
|
|
46003
|
+
};
|
|
46004
|
+
}
|
|
46005
|
+
const summaryPath = resolveConfiguredOutputPath(
|
|
46006
|
+
inputs.summaryPath,
|
|
46007
|
+
"openapi-changes-summary.md",
|
|
46008
|
+
workspaceRoot,
|
|
46009
|
+
tempRoot
|
|
46010
|
+
);
|
|
46011
|
+
const logPath = resolveConfiguredOutputPath(
|
|
46012
|
+
inputs.logPath,
|
|
46013
|
+
"openapi-changes.log",
|
|
46014
|
+
workspaceRoot,
|
|
46015
|
+
tempRoot
|
|
46016
|
+
);
|
|
46017
|
+
const source = await resolveComparisonSource(inputs, dependencies, workspaceRoot, tempRoot);
|
|
46018
|
+
if ("skipped" in source) {
|
|
46019
|
+
const report = formatReport({
|
|
46020
|
+
message: source.reason,
|
|
46021
|
+
status: "skipped"
|
|
46022
|
+
});
|
|
46023
|
+
await writeReportFiles(summaryPath, logPath, report, source.reason, env);
|
|
46024
|
+
return {
|
|
46025
|
+
breakingChanges: 0,
|
|
46026
|
+
comparison: "",
|
|
46027
|
+
exitCode: 0,
|
|
46028
|
+
logPath,
|
|
46029
|
+
message: source.reason,
|
|
46030
|
+
mode: inputs.mode,
|
|
46031
|
+
status: "skipped",
|
|
46032
|
+
summaryPath
|
|
46033
|
+
};
|
|
46034
|
+
}
|
|
46035
|
+
try {
|
|
46036
|
+
const binaryPath = await installOpenApiChanges(dependencies);
|
|
46037
|
+
const configArgs = rulesArgs(inputs.rulesPath, workspaceRoot, tempRoot);
|
|
46038
|
+
const reportArgs = [
|
|
46039
|
+
"report",
|
|
46040
|
+
"--reproducible",
|
|
46041
|
+
"--no-color",
|
|
46042
|
+
...configArgs,
|
|
46043
|
+
source.previous,
|
|
46044
|
+
source.current
|
|
46045
|
+
];
|
|
46046
|
+
const reportResult = await dependencies.exec.getExecOutput(binaryPath, reportArgs, {
|
|
46047
|
+
cwd: workspaceRoot,
|
|
46048
|
+
ignoreReturnCode: true,
|
|
46049
|
+
silent: true
|
|
46050
|
+
});
|
|
46051
|
+
const reportStdout = stripAnsi(reportResult.stdout);
|
|
46052
|
+
const reportStderr = stripAnsi(reportResult.stderr);
|
|
46053
|
+
let breakingChanges = 0;
|
|
46054
|
+
let parsedReport = false;
|
|
46055
|
+
if (reportStdout.trim()) {
|
|
46056
|
+
try {
|
|
46057
|
+
breakingChanges = breakingChangeCount(JSON.parse(reportStdout));
|
|
46058
|
+
parsedReport = true;
|
|
46059
|
+
} catch (error) {
|
|
46060
|
+
dependencies.core.warning(
|
|
46061
|
+
`Could not parse openapi-changes JSON report: ${error instanceof Error ? error.message : String(error)}`
|
|
46062
|
+
);
|
|
46063
|
+
}
|
|
46064
|
+
}
|
|
46065
|
+
const summaryArgs = [
|
|
46066
|
+
"summary",
|
|
46067
|
+
"--markdown",
|
|
46068
|
+
"--no-logo",
|
|
46069
|
+
"--no-color",
|
|
46070
|
+
"--with-lines",
|
|
46071
|
+
...configArgs,
|
|
46072
|
+
source.previous,
|
|
46073
|
+
source.current
|
|
46074
|
+
];
|
|
46075
|
+
const summaryResult = await dependencies.exec.getExecOutput(binaryPath, summaryArgs, {
|
|
46076
|
+
cwd: workspaceRoot,
|
|
46077
|
+
ignoreReturnCode: true,
|
|
46078
|
+
silent: true
|
|
46079
|
+
});
|
|
46080
|
+
const summaryStdout = sanitizeOpenApiChangesSummary(stripAnsi(summaryResult.stdout));
|
|
46081
|
+
const summaryStderr = stripAnsi(summaryResult.stderr);
|
|
46082
|
+
const commandFailed = reportResult.exitCode !== 0 && !parsedReport || summaryResult.exitCode !== 0 && !summaryStdout.trim() && breakingChanges === 0;
|
|
46083
|
+
const status = commandFailed || breakingChanges > 0 ? "failed" : "passed";
|
|
46084
|
+
const message = commandFailed ? "openapi-changes failed while comparing specifications." : breakingChanges > 0 ? `${breakingChanges} breaking change marker${breakingChanges === 1 ? "" : "s"} detected.` : "No breaking changes detected.";
|
|
46085
|
+
const report = formatReport({
|
|
46086
|
+
body: summaryStdout || message,
|
|
46087
|
+
comparison: source.label,
|
|
46088
|
+
message,
|
|
46089
|
+
status
|
|
46090
|
+
});
|
|
46091
|
+
const log = [
|
|
46092
|
+
`report exit code: ${reportResult.exitCode}`,
|
|
46093
|
+
reportStderr.trim(),
|
|
46094
|
+
`summary exit code: ${summaryResult.exitCode}`,
|
|
46095
|
+
summaryStderr.trim()
|
|
46096
|
+
].filter(Boolean).join("\n\n");
|
|
46097
|
+
await writeReportFiles(summaryPath, logPath, report, log, env);
|
|
46098
|
+
return {
|
|
46099
|
+
breakingChanges,
|
|
46100
|
+
comparison: source.label,
|
|
46101
|
+
exitCode: status === "failed" ? 1 : 0,
|
|
46102
|
+
logPath,
|
|
46103
|
+
message,
|
|
46104
|
+
mode: inputs.mode,
|
|
46105
|
+
status,
|
|
46106
|
+
summaryPath
|
|
46107
|
+
};
|
|
46108
|
+
} finally {
|
|
46109
|
+
for (const tempFile of source.tempFiles) {
|
|
46110
|
+
await removeTempSpecFile(tempFile);
|
|
46111
|
+
}
|
|
46112
|
+
}
|
|
46113
|
+
};
|
|
46114
|
+
|
|
45492
46115
|
// src/lib/postman/base-urls.ts
|
|
45493
46116
|
var POSTMAN_ENDPOINT_PROFILES = {
|
|
45494
46117
|
prod: {
|
|
@@ -45671,8 +46294,8 @@ var PostmanAssetsClient = class {
|
|
|
45671
46294
|
...team.organizationId != null ? { organizationId: Number(team.organizationId) } : {}
|
|
45672
46295
|
})) : [];
|
|
45673
46296
|
}
|
|
45674
|
-
async request(
|
|
45675
|
-
const url =
|
|
46297
|
+
async request(path6, init = {}) {
|
|
46298
|
+
const url = path6.startsWith("http") ? path6 : `${this.baseUrl}${path6}`;
|
|
45676
46299
|
const response = await this.fetchImpl(url, {
|
|
45677
46300
|
...init,
|
|
45678
46301
|
headers: {
|
|
@@ -46457,8 +47080,8 @@ function createInternalIntegrationAdapter(options) {
|
|
|
46457
47080
|
}
|
|
46458
47081
|
|
|
46459
47082
|
// src/lib/spec/safe-spec-fetch.ts
|
|
46460
|
-
var
|
|
46461
|
-
var
|
|
47083
|
+
var import_promises2 = require("node:dns/promises");
|
|
47084
|
+
var import_node_https2 = require("node:https");
|
|
46462
47085
|
var import_node_net = require("node:net");
|
|
46463
47086
|
var import_node_url = require("node:url");
|
|
46464
47087
|
var SAFE_FETCH_LIMITS = {
|
|
@@ -46591,7 +47214,7 @@ function validateSafeHttpsUrl(input) {
|
|
|
46591
47214
|
return url;
|
|
46592
47215
|
}
|
|
46593
47216
|
async function defaultLookup(hostname) {
|
|
46594
|
-
const results = await (0,
|
|
47217
|
+
const results = await (0, import_promises2.lookup)(hostname, { all: true, verbatim: true });
|
|
46595
47218
|
return results.map((entry) => ({ address: entry.address, family: entry.family }));
|
|
46596
47219
|
}
|
|
46597
47220
|
function createPinnedLookup(pinnedAddress, family) {
|
|
@@ -46628,7 +47251,7 @@ async function defaultTransport(url, options) {
|
|
|
46628
47251
|
timeout: options.timeoutMs,
|
|
46629
47252
|
lookup: createPinnedLookup(options.pinnedAddress, options.family)
|
|
46630
47253
|
};
|
|
46631
|
-
const req = (0,
|
|
47254
|
+
const req = (0, import_node_https2.request)(requestOptions, (res) => {
|
|
46632
47255
|
const remoteAddress = res.socket?.remoteAddress;
|
|
46633
47256
|
const chunks = [];
|
|
46634
47257
|
let bytes = 0;
|
|
@@ -46878,8 +47501,8 @@ function normalizeRepoUrl(url) {
|
|
|
46878
47501
|
const sshMatch = raw.match(/^git@([^:]+):(.+?)(?:\.git)?$/);
|
|
46879
47502
|
if (sshMatch) {
|
|
46880
47503
|
const host = sshMatch[1];
|
|
46881
|
-
const
|
|
46882
|
-
return `https://${host}/${
|
|
47504
|
+
const path6 = sshMatch[2];
|
|
47505
|
+
return `https://${host}/${path6}`;
|
|
46883
47506
|
}
|
|
46884
47507
|
return raw.replace(/\.git$/, "");
|
|
46885
47508
|
}
|
|
@@ -47199,8 +47822,8 @@ function safeDecodeSegment(segment) {
|
|
|
47199
47822
|
return segment;
|
|
47200
47823
|
}
|
|
47201
47824
|
}
|
|
47202
|
-
function normalizePath(
|
|
47203
|
-
const raw = String(
|
|
47825
|
+
function normalizePath(path6) {
|
|
47826
|
+
const raw = String(path6 || "").split(/[?#]/, 1)[0] || "/";
|
|
47204
47827
|
const withSlash = raw.startsWith("/") ? raw : `/${raw}`;
|
|
47205
47828
|
const normalized = withSlash.replace(/\/+/g, "/");
|
|
47206
47829
|
const trimmed = normalized.length > 1 ? normalized.replace(/\/+$/g, "") : normalized;
|
|
@@ -47224,8 +47847,8 @@ function serverPathPrefix(url) {
|
|
|
47224
47847
|
return normalizePath(noProtocol).replace(/__server_variable__/g, "{serverVariable}");
|
|
47225
47848
|
}
|
|
47226
47849
|
}
|
|
47227
|
-
function joinPaths(prefix,
|
|
47228
|
-
return normalizePath(`${prefix}/${
|
|
47850
|
+
function joinPaths(prefix, path6) {
|
|
47851
|
+
return normalizePath(`${prefix}/${path6}`.replace(/\/+/g, "/"));
|
|
47229
47852
|
}
|
|
47230
47853
|
function normalizeResponseKey(status) {
|
|
47231
47854
|
const raw = String(status);
|
|
@@ -47329,7 +47952,7 @@ function buildContractIndex(root) {
|
|
|
47329
47952
|
const warnings = [];
|
|
47330
47953
|
if (asRecord3(root.webhooks)) warnings.push("CONTRACT_WEBHOOKS_NOT_VALIDATED: OpenAPI webhooks are not validated by dynamic contract tests");
|
|
47331
47954
|
if (paths) {
|
|
47332
|
-
for (const [
|
|
47955
|
+
for (const [path6, rawPathItem] of Object.entries(paths)) {
|
|
47333
47956
|
const pathItem = resolveInternalRef(root, rawPathItem);
|
|
47334
47957
|
if (!pathItem) continue;
|
|
47335
47958
|
for (const [method, rawOperation] of Object.entries(pathItem)) {
|
|
@@ -47337,10 +47960,10 @@ function buildContractIndex(root) {
|
|
|
47337
47960
|
if (!HTTP_METHODS.has(lowerMethod)) continue;
|
|
47338
47961
|
const operation = resolveInternalRef(root, rawOperation);
|
|
47339
47962
|
if (!operation) continue;
|
|
47340
|
-
if (operation.callbacks) warnings.push(`CONTRACT_CALLBACKS_NOT_VALIDATED: callbacks are not validated for ${lowerMethod.toUpperCase()} ${
|
|
47963
|
+
if (operation.callbacks) warnings.push(`CONTRACT_CALLBACKS_NOT_VALIDATED: callbacks are not validated for ${lowerMethod.toUpperCase()} ${path6}`);
|
|
47341
47964
|
const responses = asRecord3(operation.responses);
|
|
47342
47965
|
if (!responses || Object.keys(responses).length === 0) {
|
|
47343
|
-
throw new Error(`CONTRACT_OPERATION_NO_RESPONSES: ${lowerMethod.toUpperCase()} ${
|
|
47966
|
+
throw new Error(`CONTRACT_OPERATION_NO_RESPONSES: ${lowerMethod.toUpperCase()} ${path6} must define at least one response`);
|
|
47344
47967
|
}
|
|
47345
47968
|
const contractResponses = {};
|
|
47346
47969
|
for (const [status, rawResponse] of Object.entries(responses)) {
|
|
@@ -47355,8 +47978,8 @@ function buildContractIndex(root) {
|
|
|
47355
47978
|
};
|
|
47356
47979
|
}
|
|
47357
47980
|
const candidates = [...new Set([
|
|
47358
|
-
|
|
47359
|
-
...operationServers(root, pathItem, operation).map((server) => joinPaths(serverPathPrefix(server),
|
|
47981
|
+
path6,
|
|
47982
|
+
...operationServers(root, pathItem, operation).map((server) => joinPaths(serverPathPrefix(server), path6))
|
|
47360
47983
|
].map(normalizePath))];
|
|
47361
47984
|
const opWarnings = [];
|
|
47362
47985
|
opWarnings.push(...collectSecuritySchemeWarnings(root, operation));
|
|
@@ -47365,10 +47988,10 @@ function buildContractIndex(root) {
|
|
|
47365
47988
|
opWarnings.push(`CONTRACT_SECURITY_NOT_VALIDATED: security parameter ${parameter.in}:${parameter.name} is not statically required in generated requests`);
|
|
47366
47989
|
}
|
|
47367
47990
|
operations.push({
|
|
47368
|
-
id: `${lowerMethod.toUpperCase()} ${
|
|
47991
|
+
id: `${lowerMethod.toUpperCase()} ${path6}`,
|
|
47369
47992
|
method: lowerMethod.toUpperCase(),
|
|
47370
|
-
path:
|
|
47371
|
-
pointer: `/paths/${
|
|
47993
|
+
path: path6,
|
|
47994
|
+
pointer: `/paths/${path6.replace(/~/g, "~0").replace(/\//g, "~1")}/${lowerMethod}`,
|
|
47372
47995
|
candidates,
|
|
47373
47996
|
responses: contractResponses,
|
|
47374
47997
|
requiredParameters,
|
|
@@ -47465,8 +48088,8 @@ function requestPath(request) {
|
|
|
47465
48088
|
if (typeof urlRecord.raw === "string") return pathFromRaw(urlRecord.raw);
|
|
47466
48089
|
return "/";
|
|
47467
48090
|
}
|
|
47468
|
-
function segments(
|
|
47469
|
-
return normalizePath(
|
|
48091
|
+
function segments(path6) {
|
|
48092
|
+
return normalizePath(path6).split("/").filter(Boolean);
|
|
47470
48093
|
}
|
|
47471
48094
|
function isTemplateSegment(segment) {
|
|
47472
48095
|
return /^\{[^}]+\}$/.test(segment) || /^:[^/]+$/.test(segment) || /^\{\{[^}]+\}\}$/.test(segment) || /^<[^>]+>$/.test(segment);
|
|
@@ -47492,8 +48115,8 @@ function matchCandidate(candidate, request) {
|
|
|
47492
48115
|
function matchOperation(index, request) {
|
|
47493
48116
|
const record = asRecord4(request);
|
|
47494
48117
|
const method = String(record?.method || "").toUpperCase();
|
|
47495
|
-
const
|
|
47496
|
-
const candidates = index.operations.filter((operation) => operation.method === method).flatMap((operation) => operation.candidates.map((candidate) => ({ operation, score: matchCandidate(candidate,
|
|
48118
|
+
const path6 = requestPath(request);
|
|
48119
|
+
const candidates = index.operations.filter((operation) => operation.method === method).flatMap((operation) => operation.candidates.map((candidate) => ({ operation, score: matchCandidate(candidate, path6), serverFull: candidate !== normalizePath(operation.path) }))).filter((entry) => entry.score.matched).map((entry) => ({ operation: entry.operation, score: [entry.score.staticCount, entry.serverFull ? 2 : 1, -entry.score.templateCount] })).sort((a, b) => {
|
|
47497
48120
|
for (let index2 = 0; index2 < a.score.length; index2 += 1) {
|
|
47498
48121
|
const delta = b.score[index2] - a.score[index2];
|
|
47499
48122
|
if (delta !== 0) return delta;
|
|
@@ -47501,11 +48124,11 @@ function matchOperation(index, request) {
|
|
|
47501
48124
|
return a.operation.id.localeCompare(b.operation.id);
|
|
47502
48125
|
});
|
|
47503
48126
|
const best = candidates[0];
|
|
47504
|
-
if (!best) return { path:
|
|
48127
|
+
if (!best) return { path: path6, method };
|
|
47505
48128
|
const tied = candidates.filter((entry) => entry.score.every((value, index2) => value === best.score[index2]));
|
|
47506
48129
|
const uniqueTied = [...new Map(tied.map((entry) => [entry.operation.id, entry.operation])).values()];
|
|
47507
|
-
if (uniqueTied.length > 1) return { path:
|
|
47508
|
-
return { path:
|
|
48130
|
+
if (uniqueTied.length > 1) return { path: path6, method, ambiguous: uniqueTied };
|
|
48131
|
+
return { path: path6, method, operation: best.operation };
|
|
47509
48132
|
}
|
|
47510
48133
|
function assignValidator(lines, target, source) {
|
|
47511
48134
|
lines.push(`${target} = ${source};`);
|
|
@@ -47790,10 +48413,10 @@ function instrumentContractCollection(collection, index) {
|
|
|
47790
48413
|
}
|
|
47791
48414
|
|
|
47792
48415
|
// src/lib/spec/openapi-loader.ts
|
|
47793
|
-
var
|
|
47794
|
-
var
|
|
48416
|
+
var import_node_fs2 = require("node:fs");
|
|
48417
|
+
var import_promises3 = require("node:fs/promises");
|
|
47795
48418
|
var import_node_url2 = require("node:url");
|
|
47796
|
-
var
|
|
48419
|
+
var import_node_path2 = __toESM(require("node:path"), 1);
|
|
47797
48420
|
|
|
47798
48421
|
// node_modules/@apidevtools/json-schema-ref-parser/dist/lib/util/convert-path-to-posix.js
|
|
47799
48422
|
var win32Sep = "\\";
|
|
@@ -47850,59 +48473,59 @@ function cwd() {
|
|
|
47850
48473
|
return href;
|
|
47851
48474
|
}
|
|
47852
48475
|
if (typeof process !== "undefined" && process.cwd) {
|
|
47853
|
-
const
|
|
47854
|
-
const lastChar =
|
|
48476
|
+
const path6 = process.cwd();
|
|
48477
|
+
const lastChar = path6.slice(-1);
|
|
47855
48478
|
if (lastChar === "/" || lastChar === "\\") {
|
|
47856
|
-
return
|
|
48479
|
+
return path6;
|
|
47857
48480
|
} else {
|
|
47858
|
-
return
|
|
48481
|
+
return path6 + "/";
|
|
47859
48482
|
}
|
|
47860
48483
|
}
|
|
47861
48484
|
return "/";
|
|
47862
48485
|
}
|
|
47863
|
-
function getProtocol(
|
|
47864
|
-
const match = protocolPattern.exec(
|
|
48486
|
+
function getProtocol(path6) {
|
|
48487
|
+
const match = protocolPattern.exec(path6 || "");
|
|
47865
48488
|
if (match) {
|
|
47866
48489
|
return match[1].toLowerCase();
|
|
47867
48490
|
}
|
|
47868
48491
|
return void 0;
|
|
47869
48492
|
}
|
|
47870
|
-
function getExtension(
|
|
47871
|
-
const lastDot =
|
|
48493
|
+
function getExtension(path6) {
|
|
48494
|
+
const lastDot = path6.lastIndexOf(".");
|
|
47872
48495
|
if (lastDot >= 0) {
|
|
47873
|
-
return stripQuery(
|
|
48496
|
+
return stripQuery(path6.substring(lastDot).toLowerCase());
|
|
47874
48497
|
}
|
|
47875
48498
|
return "";
|
|
47876
48499
|
}
|
|
47877
|
-
function stripQuery(
|
|
47878
|
-
const queryIndex =
|
|
48500
|
+
function stripQuery(path6) {
|
|
48501
|
+
const queryIndex = path6.indexOf("?");
|
|
47879
48502
|
if (queryIndex >= 0) {
|
|
47880
|
-
|
|
48503
|
+
path6 = path6.substring(0, queryIndex);
|
|
47881
48504
|
}
|
|
47882
|
-
return
|
|
48505
|
+
return path6;
|
|
47883
48506
|
}
|
|
47884
|
-
function getHash(
|
|
47885
|
-
if (!
|
|
48507
|
+
function getHash(path6) {
|
|
48508
|
+
if (!path6) {
|
|
47886
48509
|
return "#";
|
|
47887
48510
|
}
|
|
47888
|
-
const hashIndex =
|
|
48511
|
+
const hashIndex = path6.indexOf("#");
|
|
47889
48512
|
if (hashIndex >= 0) {
|
|
47890
|
-
return
|
|
48513
|
+
return path6.substring(hashIndex);
|
|
47891
48514
|
}
|
|
47892
48515
|
return "#";
|
|
47893
48516
|
}
|
|
47894
|
-
function stripHash(
|
|
47895
|
-
if (!
|
|
48517
|
+
function stripHash(path6) {
|
|
48518
|
+
if (!path6) {
|
|
47896
48519
|
return "";
|
|
47897
48520
|
}
|
|
47898
|
-
const hashIndex =
|
|
48521
|
+
const hashIndex = path6.indexOf("#");
|
|
47899
48522
|
if (hashIndex >= 0) {
|
|
47900
|
-
|
|
48523
|
+
path6 = path6.substring(0, hashIndex);
|
|
47901
48524
|
}
|
|
47902
|
-
return
|
|
48525
|
+
return path6;
|
|
47903
48526
|
}
|
|
47904
|
-
function isHttp(
|
|
47905
|
-
const protocol = getProtocol(
|
|
48527
|
+
function isHttp(path6) {
|
|
48528
|
+
const protocol = getProtocol(path6);
|
|
47906
48529
|
if (protocol === "http" || protocol === "https") {
|
|
47907
48530
|
return true;
|
|
47908
48531
|
} else if (protocol === void 0) {
|
|
@@ -47911,11 +48534,11 @@ function isHttp(path5) {
|
|
|
47911
48534
|
return false;
|
|
47912
48535
|
}
|
|
47913
48536
|
}
|
|
47914
|
-
function isUnsafeUrl(
|
|
47915
|
-
if (!
|
|
48537
|
+
function isUnsafeUrl(path6) {
|
|
48538
|
+
if (!path6 || typeof path6 !== "string") {
|
|
47916
48539
|
return true;
|
|
47917
48540
|
}
|
|
47918
|
-
const normalizedPath =
|
|
48541
|
+
const normalizedPath = path6.trim().toLowerCase();
|
|
47919
48542
|
if (!normalizedPath) {
|
|
47920
48543
|
return true;
|
|
47921
48544
|
}
|
|
@@ -48046,22 +48669,22 @@ function isInternalPort(port) {
|
|
|
48046
48669
|
];
|
|
48047
48670
|
return internalPorts.includes(port);
|
|
48048
48671
|
}
|
|
48049
|
-
function isFileSystemPath(
|
|
48672
|
+
function isFileSystemPath(path6) {
|
|
48050
48673
|
if (typeof window !== "undefined" || typeof process !== "undefined" && process.browser) {
|
|
48051
48674
|
return false;
|
|
48052
48675
|
}
|
|
48053
|
-
const protocol = getProtocol(
|
|
48676
|
+
const protocol = getProtocol(path6);
|
|
48054
48677
|
return protocol === void 0 || protocol === "file";
|
|
48055
48678
|
}
|
|
48056
|
-
function fromFileSystemPath(
|
|
48679
|
+
function fromFileSystemPath(path6) {
|
|
48057
48680
|
if (isWindows()) {
|
|
48058
48681
|
const projectDir = cwd();
|
|
48059
|
-
const upperPath =
|
|
48682
|
+
const upperPath = path6.toUpperCase();
|
|
48060
48683
|
const projectDirPosixPath = convertPathToPosix(projectDir);
|
|
48061
48684
|
const posixUpper = projectDirPosixPath.toUpperCase();
|
|
48062
48685
|
const hasProjectDir = upperPath.includes(posixUpper);
|
|
48063
48686
|
const hasProjectUri = upperPath.includes(posixUpper);
|
|
48064
|
-
const isAbsolutePath = isAbsoluteWin32Path.test(
|
|
48687
|
+
const isAbsolutePath = isAbsoluteWin32Path.test(path6) || path6.startsWith("http://") || path6.startsWith("https://") || path6.startsWith("file://");
|
|
48065
48688
|
if (!(hasProjectDir || hasProjectUri || isAbsolutePath) && !projectDir.startsWith("http")) {
|
|
48066
48689
|
const join3 = (a, b) => {
|
|
48067
48690
|
if (a.endsWith("/") || a.endsWith("\\")) {
|
|
@@ -48070,42 +48693,42 @@ function fromFileSystemPath(path5) {
|
|
|
48070
48693
|
return a + "/" + b;
|
|
48071
48694
|
}
|
|
48072
48695
|
};
|
|
48073
|
-
|
|
48696
|
+
path6 = join3(projectDir, path6);
|
|
48074
48697
|
}
|
|
48075
|
-
|
|
48698
|
+
path6 = convertPathToPosix(path6);
|
|
48076
48699
|
}
|
|
48077
|
-
|
|
48700
|
+
path6 = encodeURI(path6);
|
|
48078
48701
|
for (const pattern of urlEncodePatterns) {
|
|
48079
|
-
|
|
48702
|
+
path6 = path6.replace(pattern[0], pattern[1]);
|
|
48080
48703
|
}
|
|
48081
|
-
return
|
|
48704
|
+
return path6;
|
|
48082
48705
|
}
|
|
48083
|
-
function toFileSystemPath(
|
|
48084
|
-
|
|
48085
|
-
|
|
48706
|
+
function toFileSystemPath(path6, keepFileProtocol) {
|
|
48707
|
+
path6 = path6.replace(/%(?![0-9A-Fa-f]{2})/g, "%25");
|
|
48708
|
+
path6 = decodeURI(path6);
|
|
48086
48709
|
for (let i = 0; i < urlDecodePatterns.length; i += 2) {
|
|
48087
|
-
|
|
48710
|
+
path6 = path6.replace(urlDecodePatterns[i], urlDecodePatterns[i + 1]);
|
|
48088
48711
|
}
|
|
48089
|
-
let isFileUrl =
|
|
48712
|
+
let isFileUrl = path6.toLowerCase().startsWith("file://");
|
|
48090
48713
|
if (isFileUrl) {
|
|
48091
|
-
|
|
48092
|
-
if (isWindows() &&
|
|
48093
|
-
|
|
48714
|
+
path6 = path6.replace(/^file:\/\//, "").replace(/^\//, "");
|
|
48715
|
+
if (isWindows() && path6[1] === "/") {
|
|
48716
|
+
path6 = `${path6[0]}:${path6.substring(1)}`;
|
|
48094
48717
|
}
|
|
48095
48718
|
if (keepFileProtocol) {
|
|
48096
|
-
|
|
48719
|
+
path6 = "file:///" + path6;
|
|
48097
48720
|
} else {
|
|
48098
48721
|
isFileUrl = false;
|
|
48099
|
-
|
|
48722
|
+
path6 = isWindows() ? path6 : "/" + path6;
|
|
48100
48723
|
}
|
|
48101
48724
|
}
|
|
48102
48725
|
if (isWindows() && !isFileUrl) {
|
|
48103
|
-
|
|
48104
|
-
if (
|
|
48105
|
-
|
|
48726
|
+
path6 = path6.replace(forwardSlashPattern, "\\");
|
|
48727
|
+
if (path6.match(/^[a-z]:\\/i)) {
|
|
48728
|
+
path6 = path6[0].toUpperCase() + path6.substring(1);
|
|
48106
48729
|
}
|
|
48107
48730
|
}
|
|
48108
|
-
return
|
|
48731
|
+
return path6;
|
|
48109
48732
|
}
|
|
48110
48733
|
function safePointerToPath(pointer) {
|
|
48111
48734
|
if (pointer.length <= 1 || pointer[0] !== "#" || pointer[1] !== "/") {
|
|
@@ -48226,8 +48849,8 @@ var MissingPointerError = class extends JSONParserError {
|
|
|
48226
48849
|
targetRef;
|
|
48227
48850
|
targetFound;
|
|
48228
48851
|
parentPath;
|
|
48229
|
-
constructor(token,
|
|
48230
|
-
super(`Missing $ref pointer "${getHash(
|
|
48852
|
+
constructor(token, path6, targetRef, targetFound, parentPath) {
|
|
48853
|
+
super(`Missing $ref pointer "${getHash(path6)}". Token "${token}" does not exist.`, stripHash(path6));
|
|
48231
48854
|
this.targetToken = token;
|
|
48232
48855
|
this.targetRef = targetRef;
|
|
48233
48856
|
this.targetFound = targetFound;
|
|
@@ -48244,8 +48867,8 @@ var TimeoutError = class extends JSONParserError {
|
|
|
48244
48867
|
var InvalidPointerError = class extends JSONParserError {
|
|
48245
48868
|
code = "EUNMATCHEDRESOLVER";
|
|
48246
48869
|
name = "InvalidPointerError";
|
|
48247
|
-
constructor(pointer,
|
|
48248
|
-
super(`Invalid $ref pointer "${pointer}". Pointers must begin with "#/"`, stripHash(
|
|
48870
|
+
constructor(pointer, path6) {
|
|
48871
|
+
super(`Invalid $ref pointer "${pointer}". Pointers must begin with "#/"`, stripHash(path6));
|
|
48249
48872
|
}
|
|
48250
48873
|
};
|
|
48251
48874
|
function isHandledError(err) {
|
|
@@ -48339,11 +48962,11 @@ var Pointer = class _Pointer {
|
|
|
48339
48962
|
* Resolving a single pointer may require resolving multiple $Refs.
|
|
48340
48963
|
*/
|
|
48341
48964
|
indirections;
|
|
48342
|
-
constructor($ref,
|
|
48965
|
+
constructor($ref, path6, friendlyPath) {
|
|
48343
48966
|
this.$ref = $ref;
|
|
48344
|
-
this.path =
|
|
48345
|
-
this.originalPath = friendlyPath ||
|
|
48346
|
-
this.scopeBase = $ref.path || stripHash(
|
|
48967
|
+
this.path = path6;
|
|
48968
|
+
this.originalPath = friendlyPath || path6;
|
|
48969
|
+
this.scopeBase = $ref.path || stripHash(path6);
|
|
48347
48970
|
this.value = void 0;
|
|
48348
48971
|
this.circular = false;
|
|
48349
48972
|
this.indirections = 0;
|
|
@@ -48396,10 +49019,10 @@ var Pointer = class _Pointer {
|
|
|
48396
49019
|
continue;
|
|
48397
49020
|
}
|
|
48398
49021
|
this.value = null;
|
|
48399
|
-
const
|
|
48400
|
-
const targetRef = this.path.replace(
|
|
49022
|
+
const path6 = this.$ref.path || "";
|
|
49023
|
+
const targetRef = this.path.replace(path6, "");
|
|
48401
49024
|
const targetFound = _Pointer.join("", found);
|
|
48402
|
-
const parentPath = pathFromRoot?.replace(
|
|
49025
|
+
const parentPath = pathFromRoot?.replace(path6, "");
|
|
48403
49026
|
throw new MissingPointerError(token, decodeURI(this.originalPath), targetRef, targetFound, parentPath);
|
|
48404
49027
|
} else {
|
|
48405
49028
|
this.value = this.value[token];
|
|
@@ -48465,8 +49088,8 @@ var Pointer = class _Pointer {
|
|
|
48465
49088
|
* @param [originalPath]
|
|
48466
49089
|
* @returns
|
|
48467
49090
|
*/
|
|
48468
|
-
static parse(
|
|
48469
|
-
const pointer = getHash(
|
|
49091
|
+
static parse(path6, originalPath) {
|
|
49092
|
+
const pointer = getHash(path6).substring(1);
|
|
48470
49093
|
if (!pointer) {
|
|
48471
49094
|
return [];
|
|
48472
49095
|
}
|
|
@@ -48475,7 +49098,7 @@ var Pointer = class _Pointer {
|
|
|
48475
49098
|
split[i] = split[i].replace(escapedSlash, "/").replace(escapedTilde, "~");
|
|
48476
49099
|
}
|
|
48477
49100
|
if (split[0] !== "") {
|
|
48478
|
-
throw new InvalidPointerError(pointer, originalPath === void 0 ?
|
|
49101
|
+
throw new InvalidPointerError(pointer, originalPath === void 0 ? path6 : originalPath);
|
|
48479
49102
|
}
|
|
48480
49103
|
return split.slice(1);
|
|
48481
49104
|
}
|
|
@@ -48616,9 +49239,9 @@ var $Ref = class _$Ref {
|
|
|
48616
49239
|
* @param options
|
|
48617
49240
|
* @returns
|
|
48618
49241
|
*/
|
|
48619
|
-
exists(
|
|
49242
|
+
exists(path6, options) {
|
|
48620
49243
|
try {
|
|
48621
|
-
this.resolve(
|
|
49244
|
+
this.resolve(path6, options);
|
|
48622
49245
|
return true;
|
|
48623
49246
|
} catch {
|
|
48624
49247
|
return false;
|
|
@@ -48631,8 +49254,8 @@ var $Ref = class _$Ref {
|
|
|
48631
49254
|
* @param options
|
|
48632
49255
|
* @returns - Returns the resolved value
|
|
48633
49256
|
*/
|
|
48634
|
-
get(
|
|
48635
|
-
return this.resolve(
|
|
49257
|
+
get(path6, options) {
|
|
49258
|
+
return this.resolve(path6, options)?.value;
|
|
48636
49259
|
}
|
|
48637
49260
|
/**
|
|
48638
49261
|
* Resolves the given JSON reference within this {@link $Ref#value}.
|
|
@@ -48643,8 +49266,8 @@ var $Ref = class _$Ref {
|
|
|
48643
49266
|
* @param pathFromRoot - The path of `obj` from the schema root
|
|
48644
49267
|
* @returns
|
|
48645
49268
|
*/
|
|
48646
|
-
resolve(
|
|
48647
|
-
const pointer = new pointer_default(this,
|
|
49269
|
+
resolve(path6, options, friendlyPath, pathFromRoot) {
|
|
49270
|
+
const pointer = new pointer_default(this, path6, friendlyPath);
|
|
48648
49271
|
try {
|
|
48649
49272
|
const resolved = pointer.resolve(this.value, options, pathFromRoot);
|
|
48650
49273
|
if (resolved.value === nullSymbol) {
|
|
@@ -48672,8 +49295,8 @@ var $Ref = class _$Ref {
|
|
|
48672
49295
|
* @param path - The full path of the property to set, optionally with a JSON pointer in the hash
|
|
48673
49296
|
* @param value - The value to assign
|
|
48674
49297
|
*/
|
|
48675
|
-
set(
|
|
48676
|
-
const pointer = new pointer_default(this,
|
|
49298
|
+
set(path6, value) {
|
|
49299
|
+
const pointer = new pointer_default(this, path6);
|
|
48677
49300
|
this.value = pointer.set(this.value, value);
|
|
48678
49301
|
if (this.value === nullSymbol) {
|
|
48679
49302
|
this.value = null;
|
|
@@ -48847,8 +49470,8 @@ var $Refs = class {
|
|
|
48847
49470
|
*/
|
|
48848
49471
|
paths(...types2) {
|
|
48849
49472
|
const paths = getPaths(this._$refs, types2.flat());
|
|
48850
|
-
return paths.map((
|
|
48851
|
-
return convertPathToPosix(
|
|
49473
|
+
return paths.map((path6) => {
|
|
49474
|
+
return convertPathToPosix(path6.decoded);
|
|
48852
49475
|
});
|
|
48853
49476
|
}
|
|
48854
49477
|
/**
|
|
@@ -48861,8 +49484,8 @@ var $Refs = class {
|
|
|
48861
49484
|
values(...types2) {
|
|
48862
49485
|
const $refs = this._$refs;
|
|
48863
49486
|
const paths = getPaths($refs, types2.flat());
|
|
48864
|
-
return paths.reduce((obj,
|
|
48865
|
-
obj[convertPathToPosix(
|
|
49487
|
+
return paths.reduce((obj, path6) => {
|
|
49488
|
+
obj[convertPathToPosix(path6.decoded)] = $refs[path6.encoded].value;
|
|
48866
49489
|
return obj;
|
|
48867
49490
|
}, {});
|
|
48868
49491
|
}
|
|
@@ -48880,9 +49503,9 @@ var $Refs = class {
|
|
|
48880
49503
|
* @param [options]
|
|
48881
49504
|
* @returns
|
|
48882
49505
|
*/
|
|
48883
|
-
exists(
|
|
49506
|
+
exists(path6, options) {
|
|
48884
49507
|
try {
|
|
48885
|
-
this._resolve(
|
|
49508
|
+
this._resolve(path6, "", options);
|
|
48886
49509
|
return true;
|
|
48887
49510
|
} catch {
|
|
48888
49511
|
return false;
|
|
@@ -48895,8 +49518,8 @@ var $Refs = class {
|
|
|
48895
49518
|
* @param [options]
|
|
48896
49519
|
* @returns - Returns the resolved value
|
|
48897
49520
|
*/
|
|
48898
|
-
get(
|
|
48899
|
-
return this._resolve(
|
|
49521
|
+
get(path6, options) {
|
|
49522
|
+
return this._resolve(path6, "", options).value;
|
|
48900
49523
|
}
|
|
48901
49524
|
/**
|
|
48902
49525
|
* Sets the value at the given path in the schema. If the property, or any of its parents, don't exist, they will be created.
|
|
@@ -48904,11 +49527,11 @@ var $Refs = class {
|
|
|
48904
49527
|
* @param path The JSON Reference path, optionally with a JSON Pointer in the hash
|
|
48905
49528
|
* @param value The value to assign. Can be anything (object, string, number, etc.)
|
|
48906
49529
|
*/
|
|
48907
|
-
set(
|
|
48908
|
-
const absPath = resolve(this._root$Ref.path,
|
|
49530
|
+
set(path6, value) {
|
|
49531
|
+
const absPath = resolve(this._root$Ref.path, path6);
|
|
48909
49532
|
const $ref = this._getRef(absPath);
|
|
48910
49533
|
if (!$ref) {
|
|
48911
|
-
throw new Error(`Error resolving $ref pointer "${
|
|
49534
|
+
throw new Error(`Error resolving $ref pointer "${path6}".
|
|
48912
49535
|
"${stripHash(absPath)}" not found.`);
|
|
48913
49536
|
}
|
|
48914
49537
|
$ref.set(absPath, value);
|
|
@@ -48920,25 +49543,25 @@ var $Refs = class {
|
|
|
48920
49543
|
* @returns
|
|
48921
49544
|
* @protected
|
|
48922
49545
|
*/
|
|
48923
|
-
_get$Ref(
|
|
48924
|
-
|
|
48925
|
-
return this._getRef(
|
|
49546
|
+
_get$Ref(path6) {
|
|
49547
|
+
path6 = resolve(this._root$Ref.path, path6);
|
|
49548
|
+
return this._getRef(path6);
|
|
48926
49549
|
}
|
|
48927
49550
|
/**
|
|
48928
49551
|
* Creates a new {@link $Ref} object and adds it to this {@link $Refs} object.
|
|
48929
49552
|
*
|
|
48930
49553
|
* @param path - The file path or URL of the referenced file
|
|
48931
49554
|
*/
|
|
48932
|
-
_add(
|
|
48933
|
-
const withoutHash = stripHash(
|
|
49555
|
+
_add(path6) {
|
|
49556
|
+
const withoutHash = stripHash(path6);
|
|
48934
49557
|
const $ref = new ref_default(this);
|
|
48935
49558
|
$ref.path = withoutHash;
|
|
48936
49559
|
this._$refs[withoutHash] = $ref;
|
|
48937
49560
|
this._root$Ref = this._root$Ref || $ref;
|
|
48938
49561
|
return $ref;
|
|
48939
49562
|
}
|
|
48940
|
-
_addAlias(
|
|
48941
|
-
const withoutHash = stripHash(
|
|
49563
|
+
_addAlias(path6, value, pathType, dynamicIdScope = false) {
|
|
49564
|
+
const withoutHash = stripHash(path6);
|
|
48942
49565
|
if (!withoutHash || this._$refs[withoutHash] || this._aliases[withoutHash]) {
|
|
48943
49566
|
return this._$refs[withoutHash] || this._aliases[withoutHash];
|
|
48944
49567
|
}
|
|
@@ -48959,14 +49582,14 @@ var $Refs = class {
|
|
|
48959
49582
|
* @returns
|
|
48960
49583
|
* @protected
|
|
48961
49584
|
*/
|
|
48962
|
-
_resolve(
|
|
48963
|
-
const absPath = resolve(this._root$Ref.path,
|
|
49585
|
+
_resolve(path6, pathFromRoot, options) {
|
|
49586
|
+
const absPath = resolve(this._root$Ref.path, path6);
|
|
48964
49587
|
const $ref = this._getRef(absPath);
|
|
48965
49588
|
if (!$ref) {
|
|
48966
|
-
throw new Error(`Error resolving $ref pointer "${
|
|
49589
|
+
throw new Error(`Error resolving $ref pointer "${path6}".
|
|
48967
49590
|
"${stripHash(absPath)}" not found.`);
|
|
48968
49591
|
}
|
|
48969
|
-
return $ref.resolve(absPath, options,
|
|
49592
|
+
return $ref.resolve(absPath, options, path6, pathFromRoot);
|
|
48970
49593
|
}
|
|
48971
49594
|
/**
|
|
48972
49595
|
* A map of paths/urls to {@link $Ref} objects
|
|
@@ -49008,8 +49631,8 @@ var $Refs = class {
|
|
|
49008
49631
|
* @returns {object}
|
|
49009
49632
|
*/
|
|
49010
49633
|
toJSON = this.values;
|
|
49011
|
-
_getRef(
|
|
49012
|
-
const withoutHash = stripHash(
|
|
49634
|
+
_getRef(path6) {
|
|
49635
|
+
const withoutHash = stripHash(path6);
|
|
49013
49636
|
return this._$refs[withoutHash] || this._aliases[withoutHash];
|
|
49014
49637
|
}
|
|
49015
49638
|
};
|
|
@@ -49021,10 +49644,10 @@ function getPaths($refs, types2) {
|
|
|
49021
49644
|
return types2.includes($refs[key].pathType);
|
|
49022
49645
|
});
|
|
49023
49646
|
}
|
|
49024
|
-
return paths.map((
|
|
49647
|
+
return paths.map((path6) => {
|
|
49025
49648
|
return {
|
|
49026
|
-
encoded:
|
|
49027
|
-
decoded: $refs[
|
|
49649
|
+
encoded: path6,
|
|
49650
|
+
decoded: $refs[path6].pathType === "file" ? toFileSystemPath(path6, true) : path6
|
|
49028
49651
|
};
|
|
49029
49652
|
});
|
|
49030
49653
|
}
|
|
@@ -49116,14 +49739,14 @@ function getResult(obj, prop, file, callback, $refs) {
|
|
|
49116
49739
|
|
|
49117
49740
|
// node_modules/@apidevtools/json-schema-ref-parser/dist/lib/parse.js
|
|
49118
49741
|
async function parse2(target, $refs, options) {
|
|
49119
|
-
let
|
|
49742
|
+
let path6 = typeof target === "string" ? target : target.url;
|
|
49120
49743
|
const baseUrl = typeof target === "string" ? void 0 : target.baseUrl;
|
|
49121
49744
|
let reference = typeof target === "string" ? void 0 : target.reference;
|
|
49122
|
-
const hashIndex =
|
|
49745
|
+
const hashIndex = path6.indexOf("#");
|
|
49123
49746
|
let hash = "";
|
|
49124
49747
|
if (hashIndex >= 0) {
|
|
49125
|
-
hash =
|
|
49126
|
-
|
|
49748
|
+
hash = path6.substring(hashIndex);
|
|
49749
|
+
path6 = path6.substring(0, hashIndex);
|
|
49127
49750
|
}
|
|
49128
49751
|
if (reference) {
|
|
49129
49752
|
const referenceHashIndex = reference.indexOf("#");
|
|
@@ -49131,11 +49754,11 @@ async function parse2(target, $refs, options) {
|
|
|
49131
49754
|
reference = reference.substring(0, referenceHashIndex);
|
|
49132
49755
|
}
|
|
49133
49756
|
}
|
|
49134
|
-
const $ref = $refs._add(
|
|
49757
|
+
const $ref = $refs._add(path6);
|
|
49135
49758
|
const file = {
|
|
49136
|
-
url:
|
|
49759
|
+
url: path6,
|
|
49137
49760
|
hash,
|
|
49138
|
-
extension: getExtension(
|
|
49761
|
+
extension: getExtension(path6),
|
|
49139
49762
|
...reference !== void 0 ? { reference } : {},
|
|
49140
49763
|
...baseUrl !== void 0 ? { baseUrl } : {}
|
|
49141
49764
|
};
|
|
@@ -52020,24 +52643,24 @@ var file_default = {
|
|
|
52020
52643
|
* Reads the given file and returns its raw contents as a Buffer.
|
|
52021
52644
|
*/
|
|
52022
52645
|
async read(file) {
|
|
52023
|
-
let
|
|
52646
|
+
let path6;
|
|
52024
52647
|
const fs2 = await import("fs");
|
|
52025
52648
|
try {
|
|
52026
|
-
|
|
52649
|
+
path6 = toFileSystemPath(file.url);
|
|
52027
52650
|
} catch (err) {
|
|
52028
52651
|
const e = err;
|
|
52029
52652
|
e.message = `Malformed URI: ${file.url}: ${e.message}`;
|
|
52030
52653
|
throw new ResolverError(e, file.url);
|
|
52031
52654
|
}
|
|
52032
|
-
if (
|
|
52033
|
-
|
|
52655
|
+
if (path6.endsWith("/") || path6.endsWith("\\")) {
|
|
52656
|
+
path6 = path6.slice(0, -1);
|
|
52034
52657
|
}
|
|
52035
52658
|
try {
|
|
52036
|
-
return await fs2.promises.readFile(
|
|
52659
|
+
return await fs2.promises.readFile(path6);
|
|
52037
52660
|
} catch (err) {
|
|
52038
52661
|
const e = err;
|
|
52039
|
-
e.message = `Error opening file ${
|
|
52040
|
-
throw new ResolverError(e,
|
|
52662
|
+
e.message = `Error opening file ${path6}: ${e.message}`;
|
|
52663
|
+
throw new ResolverError(e, path6);
|
|
52041
52664
|
}
|
|
52042
52665
|
}
|
|
52043
52666
|
};
|
|
@@ -52101,7 +52724,7 @@ async function download(u, httpOptions, _redirects) {
|
|
|
52101
52724
|
const redirects = _redirects || [];
|
|
52102
52725
|
redirects.push(u.href);
|
|
52103
52726
|
try {
|
|
52104
|
-
const res = await
|
|
52727
|
+
const res = await get2(u, httpOptions);
|
|
52105
52728
|
if (res.status >= 400) {
|
|
52106
52729
|
const error = new Error(`HTTP ERROR ${res.status}`);
|
|
52107
52730
|
error.status = res.status;
|
|
@@ -52134,7 +52757,7 @@ Too many redirects:
|
|
|
52134
52757
|
throw new ResolverError(e, u.href);
|
|
52135
52758
|
}
|
|
52136
52759
|
}
|
|
52137
|
-
async function
|
|
52760
|
+
async function get2(u, httpOptions) {
|
|
52138
52761
|
let controller;
|
|
52139
52762
|
let timeoutId;
|
|
52140
52763
|
if (httpOptions.timeout && typeof AbortController !== "undefined") {
|
|
@@ -52261,7 +52884,7 @@ function isMergeable(val) {
|
|
|
52261
52884
|
|
|
52262
52885
|
// node_modules/@apidevtools/json-schema-ref-parser/dist/lib/normalize-args.js
|
|
52263
52886
|
function normalizeArgs(_args) {
|
|
52264
|
-
let
|
|
52887
|
+
let path6;
|
|
52265
52888
|
let schema2;
|
|
52266
52889
|
let options;
|
|
52267
52890
|
let callback;
|
|
@@ -52270,7 +52893,7 @@ function normalizeArgs(_args) {
|
|
|
52270
52893
|
callback = args.pop();
|
|
52271
52894
|
}
|
|
52272
52895
|
if (typeof args[0] === "string") {
|
|
52273
|
-
|
|
52896
|
+
path6 = args[0];
|
|
52274
52897
|
if (typeof args[2] === "object") {
|
|
52275
52898
|
schema2 = args[1];
|
|
52276
52899
|
options = args[2];
|
|
@@ -52279,7 +52902,7 @@ function normalizeArgs(_args) {
|
|
|
52279
52902
|
options = args[1];
|
|
52280
52903
|
}
|
|
52281
52904
|
} else {
|
|
52282
|
-
|
|
52905
|
+
path6 = "";
|
|
52283
52906
|
schema2 = args[0];
|
|
52284
52907
|
options = args[1];
|
|
52285
52908
|
}
|
|
@@ -52292,7 +52915,7 @@ function normalizeArgs(_args) {
|
|
|
52292
52915
|
schema2 = JSON.parse(JSON.stringify(schema2));
|
|
52293
52916
|
}
|
|
52294
52917
|
return {
|
|
52295
|
-
path:
|
|
52918
|
+
path: path6,
|
|
52296
52919
|
schema: schema2,
|
|
52297
52920
|
options,
|
|
52298
52921
|
callback
|
|
@@ -52313,18 +52936,18 @@ function resolveExternal(parser, options) {
|
|
|
52313
52936
|
return Promise.reject(e);
|
|
52314
52937
|
}
|
|
52315
52938
|
}
|
|
52316
|
-
function crawl(obj,
|
|
52939
|
+
function crawl(obj, path6, scopeBase, dynamicIdScope, $refs, options, seen, external) {
|
|
52317
52940
|
seen ||= /* @__PURE__ */ new Set();
|
|
52318
52941
|
let promises3 = [];
|
|
52319
52942
|
if (obj && typeof obj === "object" && !ArrayBuffer.isView(obj) && !seen.has(obj)) {
|
|
52320
52943
|
seen.add(obj);
|
|
52321
52944
|
const currentScopeBase = scopeBase;
|
|
52322
52945
|
if (ref_default.isExternal$Ref(obj)) {
|
|
52323
|
-
promises3.push(resolve$Ref(obj,
|
|
52946
|
+
promises3.push(resolve$Ref(obj, path6, currentScopeBase, dynamicIdScope, $refs, options));
|
|
52324
52947
|
}
|
|
52325
52948
|
const keys = Object.keys(obj);
|
|
52326
52949
|
for (const key of keys) {
|
|
52327
|
-
const keyPath = pointer_default.join(
|
|
52950
|
+
const keyPath = pointer_default.join(path6, key);
|
|
52328
52951
|
const value = obj[key];
|
|
52329
52952
|
const childScopeBase = dynamicIdScope && value && typeof value === "object" && !ArrayBuffer.isView(value) ? getSchemaBasePath(currentScopeBase, value) : currentScopeBase;
|
|
52330
52953
|
promises3 = promises3.concat(crawl(value, keyPath, childScopeBase, dynamicIdScope, $refs, options, seen, external));
|
|
@@ -52332,9 +52955,9 @@ function crawl(obj, path5, scopeBase, dynamicIdScope, $refs, options, seen, exte
|
|
|
52332
52955
|
}
|
|
52333
52956
|
return promises3;
|
|
52334
52957
|
}
|
|
52335
|
-
async function resolve$Ref($ref,
|
|
52958
|
+
async function resolve$Ref($ref, path6, scopeBase, dynamicIdScope, $refs, options) {
|
|
52336
52959
|
const shouldResolveOnCwd = options.dereference?.externalReferenceResolution === "root";
|
|
52337
|
-
const resolutionBase = shouldResolveOnCwd ? cwd() : dynamicIdScope ? scopeBase :
|
|
52960
|
+
const resolutionBase = shouldResolveOnCwd ? cwd() : dynamicIdScope ? scopeBase : path6;
|
|
52338
52961
|
const resolvedPath = resolve(resolutionBase, $ref.$ref);
|
|
52339
52962
|
const withoutHash = stripHash(resolvedPath);
|
|
52340
52963
|
const ref = $refs._get$Ref(withoutHash);
|
|
@@ -52359,8 +52982,8 @@ async function resolve$Ref($ref, path5, scopeBase, dynamicIdScope, $refs, option
|
|
|
52359
52982
|
throw err;
|
|
52360
52983
|
}
|
|
52361
52984
|
if ($refs._$refs[withoutHash]) {
|
|
52362
|
-
err.source = decodeURI(stripHash(
|
|
52363
|
-
err.path = safePointerToPath(getHash(
|
|
52985
|
+
err.source = decodeURI(stripHash(path6));
|
|
52986
|
+
err.path = safePointerToPath(getHash(path6));
|
|
52364
52987
|
}
|
|
52365
52988
|
return [];
|
|
52366
52989
|
}
|
|
@@ -52379,14 +53002,14 @@ function bundle(parser, options) {
|
|
|
52379
53002
|
fixRefsThroughRefs(inventory, parser.schema);
|
|
52380
53003
|
}
|
|
52381
53004
|
}
|
|
52382
|
-
function crawl2(parent, key,
|
|
53005
|
+
function crawl2(parent, key, path6, scopeBase, dynamicIdScope, pathFromRoot, indirections, inventory, $refs, options) {
|
|
52383
53006
|
const obj = key === null ? parent : parent[key];
|
|
52384
53007
|
const bundleOptions = options.bundle || {};
|
|
52385
53008
|
const isExcludedPath = bundleOptions.excludedPathMatcher || (() => false);
|
|
52386
53009
|
if (obj && typeof obj === "object" && !ArrayBuffer.isView(obj) && !isExcludedPath(pathFromRoot)) {
|
|
52387
53010
|
const currentScopeBase = scopeBase;
|
|
52388
53011
|
if (ref_default.isAllowed$Ref(obj)) {
|
|
52389
|
-
inventory$Ref(parent, key,
|
|
53012
|
+
inventory$Ref(parent, key, path6, currentScopeBase, dynamicIdScope, pathFromRoot, indirections, inventory, $refs, options);
|
|
52390
53013
|
} else {
|
|
52391
53014
|
const keys = Object.keys(obj).sort((a, b) => {
|
|
52392
53015
|
if (a === "definitions" || a === "$defs") {
|
|
@@ -52398,7 +53021,7 @@ function crawl2(parent, key, path5, scopeBase, dynamicIdScope, pathFromRoot, ind
|
|
|
52398
53021
|
}
|
|
52399
53022
|
});
|
|
52400
53023
|
for (const key2 of keys) {
|
|
52401
|
-
const keyPath = pointer_default.join(
|
|
53024
|
+
const keyPath = pointer_default.join(path6, key2);
|
|
52402
53025
|
const keyPathFromRoot = pointer_default.join(pathFromRoot, key2);
|
|
52403
53026
|
const value = obj[key2];
|
|
52404
53027
|
const childScopeBase = dynamicIdScope && value && typeof value === "object" && !ArrayBuffer.isView(value) ? getSchemaBasePath(currentScopeBase, value) : currentScopeBase;
|
|
@@ -52416,9 +53039,9 @@ function crawl2(parent, key, path5, scopeBase, dynamicIdScope, pathFromRoot, ind
|
|
|
52416
53039
|
}
|
|
52417
53040
|
}
|
|
52418
53041
|
}
|
|
52419
|
-
function inventory$Ref($refParent, $refKey,
|
|
53042
|
+
function inventory$Ref($refParent, $refKey, path6, scopeBase, dynamicIdScope, pathFromRoot, indirections, inventory, $refs, options) {
|
|
52420
53043
|
const $ref = $refKey === null ? $refParent : $refParent[$refKey];
|
|
52421
|
-
const $refPath = resolve(dynamicIdScope ? scopeBase :
|
|
53044
|
+
const $refPath = resolve(dynamicIdScope ? scopeBase : path6, $ref.$ref);
|
|
52422
53045
|
const pointer = $refs._resolve($refPath, pathFromRoot, options);
|
|
52423
53046
|
if (pointer === null) {
|
|
52424
53047
|
return;
|
|
@@ -52578,11 +53201,11 @@ function resolvePathThroughRefs(schema2, refPath) {
|
|
|
52578
53201
|
const result = "#/" + resolvedSegments.join("/");
|
|
52579
53202
|
return result;
|
|
52580
53203
|
}
|
|
52581
|
-
function walkPath(schema2,
|
|
52582
|
-
if (!
|
|
53204
|
+
function walkPath(schema2, path6) {
|
|
53205
|
+
if (!path6.startsWith("#/")) {
|
|
52583
53206
|
return void 0;
|
|
52584
53207
|
}
|
|
52585
|
-
const segments2 =
|
|
53208
|
+
const segments2 = path6.slice(2).split("/");
|
|
52586
53209
|
let current = schema2;
|
|
52587
53210
|
for (const seg of segments2) {
|
|
52588
53211
|
if (current === null || current === void 0 || typeof current !== "object") {
|
|
@@ -52618,7 +53241,7 @@ function dereference(parser, options) {
|
|
|
52618
53241
|
parser.$refs.circular = dereferenced.circular;
|
|
52619
53242
|
parser.schema = dereferenced.value;
|
|
52620
53243
|
}
|
|
52621
|
-
function crawl3(obj,
|
|
53244
|
+
function crawl3(obj, path6, scopeBase, dynamicIdScope, pathFromRoot, parents, processedObjects, dereferencedCache, $refs, options, startTime, depth) {
|
|
52622
53245
|
let dereferenced;
|
|
52623
53246
|
const result = {
|
|
52624
53247
|
value: obj,
|
|
@@ -52637,13 +53260,13 @@ function crawl3(obj, path5, scopeBase, dynamicIdScope, pathFromRoot, parents, pr
|
|
|
52637
53260
|
processedObjects.add(obj);
|
|
52638
53261
|
const currentScopeBase = scopeBase;
|
|
52639
53262
|
if (ref_default.isAllowed$Ref(obj, options)) {
|
|
52640
|
-
dereferenced = dereference$Ref(obj,
|
|
53263
|
+
dereferenced = dereference$Ref(obj, path6, currentScopeBase, dynamicIdScope, pathFromRoot, parents, processedObjects, dereferencedCache, $refs, options, startTime, depth);
|
|
52641
53264
|
result.circular = dereferenced.circular;
|
|
52642
53265
|
result.value = dereferenced.value;
|
|
52643
53266
|
} else {
|
|
52644
53267
|
for (const key of Object.keys(obj)) {
|
|
52645
53268
|
checkDereferenceTimeout(startTime, options);
|
|
52646
|
-
const keyPath = pointer_default.join(
|
|
53269
|
+
const keyPath = pointer_default.join(path6, key);
|
|
52647
53270
|
const keyPathFromRoot = pointer_default.join(pathFromRoot, key);
|
|
52648
53271
|
if (isExcludedPath(keyPathFromRoot)) {
|
|
52649
53272
|
continue;
|
|
@@ -52698,10 +53321,10 @@ function crawl3(obj, path5, scopeBase, dynamicIdScope, pathFromRoot, parents, pr
|
|
|
52698
53321
|
}
|
|
52699
53322
|
return result;
|
|
52700
53323
|
}
|
|
52701
|
-
function dereference$Ref($ref,
|
|
53324
|
+
function dereference$Ref($ref, path6, scopeBase, dynamicIdScope, pathFromRoot, parents, processedObjects, dereferencedCache, $refs, options, startTime, depth) {
|
|
52702
53325
|
const isExternalRef = ref_default.isExternal$Ref($ref);
|
|
52703
53326
|
const shouldResolveOnCwd = isExternalRef && options?.dereference?.externalReferenceResolution === "root";
|
|
52704
|
-
const resolutionBase = shouldResolveOnCwd ? cwd() : dynamicIdScope ? scopeBase :
|
|
53327
|
+
const resolutionBase = shouldResolveOnCwd ? cwd() : dynamicIdScope ? scopeBase : path6;
|
|
52705
53328
|
const $refPath = resolve(resolutionBase, $ref.$ref);
|
|
52706
53329
|
const cache = dereferencedCache.get($refPath);
|
|
52707
53330
|
if (cache) {
|
|
@@ -52723,16 +53346,16 @@ function dereference$Ref($ref, path5, scopeBase, dynamicIdScope, pathFromRoot, p
|
|
|
52723
53346
|
}
|
|
52724
53347
|
if (typeof cache.value === "object" && "$ref" in cache.value && "$ref" in $ref) {
|
|
52725
53348
|
if (cache.value.$ref === $ref.$ref) {
|
|
52726
|
-
foundCircularReference(
|
|
53349
|
+
foundCircularReference(path6, $refs, options);
|
|
52727
53350
|
return cache;
|
|
52728
53351
|
} else {
|
|
52729
53352
|
}
|
|
52730
53353
|
} else {
|
|
52731
|
-
foundCircularReference(
|
|
53354
|
+
foundCircularReference(path6, $refs, options);
|
|
52732
53355
|
return cache;
|
|
52733
53356
|
}
|
|
52734
53357
|
}
|
|
52735
|
-
const pointer = $refs._resolve($refPath,
|
|
53358
|
+
const pointer = $refs._resolve($refPath, path6, options);
|
|
52736
53359
|
if (pointer === null) {
|
|
52737
53360
|
return {
|
|
52738
53361
|
circular: false,
|
|
@@ -52742,7 +53365,7 @@ function dereference$Ref($ref, path5, scopeBase, dynamicIdScope, pathFromRoot, p
|
|
|
52742
53365
|
const directCircular = pointer.circular;
|
|
52743
53366
|
let circular = directCircular || parents.has(pointer.value);
|
|
52744
53367
|
if (circular) {
|
|
52745
|
-
foundCircularReference(
|
|
53368
|
+
foundCircularReference(path6, $refs, options);
|
|
52746
53369
|
}
|
|
52747
53370
|
let dereferencedValue = ref_default.dereference($ref, pointer.value, options);
|
|
52748
53371
|
if (!circular) {
|
|
@@ -59150,7 +59773,7 @@ function hasInvalidPaths(api) {
|
|
|
59150
59773
|
if (!api.paths || typeof api.paths !== "object" || Array.isArray(api.paths)) {
|
|
59151
59774
|
return false;
|
|
59152
59775
|
}
|
|
59153
|
-
return Object.keys(api.paths).some((
|
|
59776
|
+
return Object.keys(api.paths).some((path6) => !path6.startsWith("/"));
|
|
59154
59777
|
}
|
|
59155
59778
|
function reduceAjvErrors(errors) {
|
|
59156
59779
|
const flattened = /* @__PURE__ */ new Map();
|
|
@@ -59235,7 +59858,7 @@ function validateSchema(api, options = {}, suppressedInstancePaths = []) {
|
|
|
59235
59858
|
}
|
|
59236
59859
|
let additionalErrors = 0;
|
|
59237
59860
|
let reducedErrors = reduceAjvErrors(ajv.errors).filter((err) => {
|
|
59238
|
-
return !suppressedInstancePaths.some((
|
|
59861
|
+
return !suppressedInstancePaths.some((path6) => err.instancePath === path6 || err.instancePath.startsWith(`${path6}/`));
|
|
59239
59862
|
});
|
|
59240
59863
|
if (!reducedErrors.length) {
|
|
59241
59864
|
return { valid: true, warnings: [], specification: specificationName };
|
|
@@ -59286,9 +59909,9 @@ var SpecificationValidator = class {
|
|
|
59286
59909
|
reportWarning(message) {
|
|
59287
59910
|
this.warnings.push({ message });
|
|
59288
59911
|
}
|
|
59289
|
-
flagInstancePath(
|
|
59290
|
-
if (!this.flaggedInstancePaths.includes(
|
|
59291
|
-
this.flaggedInstancePaths.push(
|
|
59912
|
+
flagInstancePath(path6) {
|
|
59913
|
+
if (!this.flaggedInstancePaths.includes(path6)) {
|
|
59914
|
+
this.flaggedInstancePaths.push(path6);
|
|
59292
59915
|
}
|
|
59293
59916
|
}
|
|
59294
59917
|
};
|
|
@@ -59306,10 +59929,10 @@ var OpenAPISpecificationValidator = class extends SpecificationValidator {
|
|
|
59306
59929
|
run() {
|
|
59307
59930
|
const operationIds = [];
|
|
59308
59931
|
Object.keys(this.api.paths || {}).forEach((pathName) => {
|
|
59309
|
-
const
|
|
59932
|
+
const path6 = this.api.paths[pathName];
|
|
59310
59933
|
const pathId = `/paths${pathName}`;
|
|
59311
|
-
if (
|
|
59312
|
-
this.validatePath(
|
|
59934
|
+
if (path6 && pathName.startsWith("/")) {
|
|
59935
|
+
this.validatePath(path6, pathId, operationIds);
|
|
59313
59936
|
}
|
|
59314
59937
|
});
|
|
59315
59938
|
if (isOpenAPI30(this.api)) {
|
|
@@ -59338,9 +59961,9 @@ var OpenAPISpecificationValidator = class extends SpecificationValidator {
|
|
|
59338
59961
|
* Validates the given path.
|
|
59339
59962
|
*
|
|
59340
59963
|
*/
|
|
59341
|
-
validatePath(
|
|
59964
|
+
validatePath(path6, pathId, operationIds) {
|
|
59342
59965
|
supportedHTTPMethods.forEach((operationName) => {
|
|
59343
|
-
const operation =
|
|
59966
|
+
const operation = path6[operationName];
|
|
59344
59967
|
const operationId = `${pathId}/${operationName}`;
|
|
59345
59968
|
if (operation) {
|
|
59346
59969
|
const declaredOperationId = operation.operationId;
|
|
@@ -59353,7 +59976,7 @@ var OpenAPISpecificationValidator = class extends SpecificationValidator {
|
|
|
59353
59976
|
this.reportError(`The operationId \`${declaredOperationId}\` is duplicated and must be made unique.`);
|
|
59354
59977
|
}
|
|
59355
59978
|
}
|
|
59356
|
-
this.validateParameters(
|
|
59979
|
+
this.validateParameters(path6, pathId, operation, operationId);
|
|
59357
59980
|
Object.keys(operation.responses || {}).forEach((responseCode) => {
|
|
59358
59981
|
const response = operation.responses[responseCode];
|
|
59359
59982
|
const responseId = `${operationId}/responses/${responseCode}`;
|
|
@@ -59368,8 +59991,8 @@ var OpenAPISpecificationValidator = class extends SpecificationValidator {
|
|
|
59368
59991
|
* Validates the parameters for the given operation.
|
|
59369
59992
|
*
|
|
59370
59993
|
*/
|
|
59371
|
-
validateParameters(
|
|
59372
|
-
const pathParams =
|
|
59994
|
+
validateParameters(path6, pathId, operation, operationId) {
|
|
59995
|
+
const pathParams = path6.parameters || [];
|
|
59373
59996
|
const operationParams = operation.parameters || [];
|
|
59374
59997
|
this.checkForDuplicates(pathParams, pathId);
|
|
59375
59998
|
this.checkForDuplicates(operationParams, operationId);
|
|
@@ -59668,10 +60291,10 @@ var SwaggerSpecificationValidator = class extends SpecificationValidator {
|
|
|
59668
60291
|
run() {
|
|
59669
60292
|
const operationIds = [];
|
|
59670
60293
|
Object.keys(this.api.paths || {}).forEach((pathName) => {
|
|
59671
|
-
const
|
|
60294
|
+
const path6 = this.api.paths[pathName];
|
|
59672
60295
|
const pathId = `/paths${pathName}`;
|
|
59673
|
-
if (
|
|
59674
|
-
this.validatePath(
|
|
60296
|
+
if (path6 && pathName.startsWith("/")) {
|
|
60297
|
+
this.validatePath(path6, pathId, operationIds);
|
|
59675
60298
|
}
|
|
59676
60299
|
});
|
|
59677
60300
|
Object.keys(this.api.definitions || {}).forEach((definitionName) => {
|
|
@@ -59689,9 +60312,9 @@ var SwaggerSpecificationValidator = class extends SpecificationValidator {
|
|
|
59689
60312
|
* Validates the given path.
|
|
59690
60313
|
*
|
|
59691
60314
|
*/
|
|
59692
|
-
validatePath(
|
|
60315
|
+
validatePath(path6, pathId, operationIds) {
|
|
59693
60316
|
swaggerHTTPMethods.forEach((operationName) => {
|
|
59694
|
-
const operation =
|
|
60317
|
+
const operation = path6[operationName];
|
|
59695
60318
|
const operationId = `${pathId}/${operationName}`;
|
|
59696
60319
|
if (operation) {
|
|
59697
60320
|
const declaredOperationId = operation.operationId;
|
|
@@ -59704,7 +60327,7 @@ var SwaggerSpecificationValidator = class extends SpecificationValidator {
|
|
|
59704
60327
|
this.reportError(`The operationId \`${declaredOperationId}\` is duplicated and must be made unique.`);
|
|
59705
60328
|
}
|
|
59706
60329
|
}
|
|
59707
|
-
this.validateParameters(
|
|
60330
|
+
this.validateParameters(path6, pathId, operation, operationId);
|
|
59708
60331
|
Object.keys(operation.responses || {}).forEach((responseName) => {
|
|
59709
60332
|
const response = operation.responses[responseName];
|
|
59710
60333
|
if ("$ref" in response || !response) {
|
|
@@ -59720,8 +60343,8 @@ var SwaggerSpecificationValidator = class extends SpecificationValidator {
|
|
|
59720
60343
|
* Validates the parameters for the given operation.
|
|
59721
60344
|
*
|
|
59722
60345
|
*/
|
|
59723
|
-
validateParameters(
|
|
59724
|
-
const pathParams = (
|
|
60346
|
+
validateParameters(path6, pathId, operation, operationId) {
|
|
60347
|
+
const pathParams = (path6.parameters || []).filter((param) => !("$ref" in param));
|
|
59725
60348
|
const operationParams = (operation.parameters || []).filter(
|
|
59726
60349
|
(param) => !("$ref" in param)
|
|
59727
60350
|
);
|
|
@@ -60300,29 +60923,29 @@ async function loadOpenApiContractSpec(specUrl, options = {}) {
|
|
|
60300
60923
|
async function loadOpenApiContractSpecFromPath(specPath, options = {}) {
|
|
60301
60924
|
if (!specPath) throw new Error("CONTRACT_SPEC_READ_FAILED: spec-path must not be empty");
|
|
60302
60925
|
const workspaceRoot = (() => {
|
|
60303
|
-
const root =
|
|
60926
|
+
const root = import_node_path2.default.resolve(process.env.GITHUB_WORKSPACE ?? process.cwd());
|
|
60304
60927
|
try {
|
|
60305
|
-
return (0,
|
|
60928
|
+
return (0, import_node_fs2.realpathSync)(root);
|
|
60306
60929
|
} catch {
|
|
60307
60930
|
return root;
|
|
60308
60931
|
}
|
|
60309
60932
|
})();
|
|
60310
|
-
const resolved =
|
|
60933
|
+
const resolved = import_node_path2.default.resolve(workspaceRoot, specPath);
|
|
60311
60934
|
let absolutePath;
|
|
60312
60935
|
try {
|
|
60313
|
-
absolutePath = (0,
|
|
60936
|
+
absolutePath = (0, import_node_fs2.realpathSync)(resolved);
|
|
60314
60937
|
} catch (error) {
|
|
60315
60938
|
throw new Error(`CONTRACT_SPEC_READ_FAILED: Unable to read spec at ${specPath}`, { cause: error });
|
|
60316
60939
|
}
|
|
60317
|
-
const rel =
|
|
60318
|
-
if (!rel || rel.startsWith("..") ||
|
|
60940
|
+
const rel = import_node_path2.default.relative(workspaceRoot, absolutePath);
|
|
60941
|
+
if (!rel || rel.startsWith("..") || import_node_path2.default.isAbsolute(rel)) {
|
|
60319
60942
|
throw new Error(`CONTRACT_SPEC_READ_FAILED: spec-path must resolve inside ${workspaceRoot}, got: ${specPath}`);
|
|
60320
60943
|
}
|
|
60321
60944
|
const maxBytes = options.maxBytesPerResource ?? SAFE_FETCH_LIMITS.maxBytesPerResource;
|
|
60322
60945
|
const maxTotalBytes = options.maxTotalBytes ?? SAFE_FETCH_LIMITS.maxTotalBytes;
|
|
60323
60946
|
let onDiskBytes;
|
|
60324
60947
|
try {
|
|
60325
|
-
onDiskBytes = (await (0,
|
|
60948
|
+
onDiskBytes = (await (0, import_promises3.stat)(absolutePath)).size;
|
|
60326
60949
|
} catch (error) {
|
|
60327
60950
|
throw new Error(`CONTRACT_SPEC_READ_FAILED: Unable to read spec at ${specPath}`, { cause: error });
|
|
60328
60951
|
}
|
|
@@ -60335,7 +60958,7 @@ async function loadOpenApiContractSpecFromPath(specPath, options = {}) {
|
|
|
60335
60958
|
}
|
|
60336
60959
|
let content;
|
|
60337
60960
|
try {
|
|
60338
|
-
content = await (0,
|
|
60961
|
+
content = await (0, import_promises3.readFile)(absolutePath, "utf8");
|
|
60339
60962
|
} catch (error) {
|
|
60340
60963
|
throw new Error(`CONTRACT_SPEC_READ_FAILED: Unable to read spec at ${specPath}`, { cause: error });
|
|
60341
60964
|
}
|
|
@@ -60391,6 +61014,13 @@ function parseSpecSyncMode(value) {
|
|
|
60391
61014
|
}
|
|
60392
61015
|
throw new Error(`Unsupported spec-sync-mode "${v}". Supported values: ${allowed.join(", ")}`);
|
|
60393
61016
|
}
|
|
61017
|
+
function parseBreakingChangeMode(value) {
|
|
61018
|
+
return parseEnumInput(
|
|
61019
|
+
"breaking-change-mode",
|
|
61020
|
+
value,
|
|
61021
|
+
customerPreviewActionContract.inputs["breaking-change-mode"].default ?? "off"
|
|
61022
|
+
);
|
|
61023
|
+
}
|
|
60394
61024
|
function parseEnumInput(name, value, defaultValue) {
|
|
60395
61025
|
const allowed = customerPreviewActionContract.inputs[name].allowedValues ?? [];
|
|
60396
61026
|
const v = value?.trim() || defaultValue;
|
|
@@ -60496,6 +61126,12 @@ function resolveInputs(env = process.env) {
|
|
|
60496
61126
|
specUrl,
|
|
60497
61127
|
specPath,
|
|
60498
61128
|
openapiVersion: resolveOpenapiVersion(getInput("openapi-version", env)),
|
|
61129
|
+
breakingChangeMode: parseBreakingChangeMode(getInput("breaking-change-mode", env)),
|
|
61130
|
+
breakingBaselineSpecPath: getInput("breaking-baseline-spec-path", env),
|
|
61131
|
+
breakingRulesPath: getInput("breaking-rules-path", env) ?? customerPreviewActionContract.inputs["breaking-rules-path"].default,
|
|
61132
|
+
breakingTargetRef: getInput("breaking-target-ref", env),
|
|
61133
|
+
breakingSummaryPath: getInput("breaking-summary-path", env),
|
|
61134
|
+
breakingLogPath: getInput("breaking-log-path", env),
|
|
60499
61135
|
governanceMappingJson: parseGovernanceMappingJson(getInput("governance-mapping-json", env)),
|
|
60500
61136
|
postmanApiKey: getInput("postman-api-key", env) ?? "",
|
|
60501
61137
|
postmanAccessToken: getInput("postman-access-token", env),
|
|
@@ -60536,6 +61172,17 @@ function createPlannedOutputs(inputs) {
|
|
|
60536
61172
|
total: 0,
|
|
60537
61173
|
violations: [],
|
|
60538
61174
|
warnings: 0
|
|
61175
|
+
}),
|
|
61176
|
+
"breaking-change-status": "skipped",
|
|
61177
|
+
"breaking-change-summary-json": JSON.stringify({
|
|
61178
|
+
breakingChanges: 0,
|
|
61179
|
+
comparison: "",
|
|
61180
|
+
exitCode: 0,
|
|
61181
|
+
logPath: "",
|
|
61182
|
+
message: "Breaking-change check is disabled.",
|
|
61183
|
+
mode: inputs.breakingChangeMode,
|
|
61184
|
+
status: "skipped",
|
|
61185
|
+
summaryPath: ""
|
|
60539
61186
|
})
|
|
60540
61187
|
};
|
|
60541
61188
|
}
|
|
@@ -60679,7 +61326,7 @@ function createAssetProjectName(inputs, releaseLabel) {
|
|
|
60679
61326
|
}
|
|
60680
61327
|
function readResourcesState() {
|
|
60681
61328
|
try {
|
|
60682
|
-
return (0, import_yaml3.parse)((0,
|
|
61329
|
+
return (0, import_yaml3.parse)((0, import_node_fs3.readFileSync)(".postman/resources.yaml", "utf8"));
|
|
60683
61330
|
} catch {
|
|
60684
61331
|
return null;
|
|
60685
61332
|
}
|
|
@@ -60825,6 +61472,7 @@ async function runBootstrap(inputs, dependencies) {
|
|
|
60825
61472
|
let previousSpecRollbackHash;
|
|
60826
61473
|
let detectedOpenapiVersion = "3.0";
|
|
60827
61474
|
let contractIndex;
|
|
61475
|
+
let sourceSpecContent = "";
|
|
60828
61476
|
const specContent = await runGroup(
|
|
60829
61477
|
dependencies.core,
|
|
60830
61478
|
"Preflight OpenAPI Contract",
|
|
@@ -60833,6 +61481,7 @@ async function runBootstrap(inputs, dependencies) {
|
|
|
60833
61481
|
fetchText: dependencies.specFetcher === fetch ? void 0 : async (url) => fetchSpecDocument(url, dependencies.specFetcher)
|
|
60834
61482
|
};
|
|
60835
61483
|
const loaded = inputs.specPath ? await loadOpenApiContractSpecFromPath(inputs.specPath, loaderOptions) : await loadOpenApiContractSpec(inputs.specUrl, loaderOptions);
|
|
61484
|
+
sourceSpecContent = loaded.content;
|
|
60836
61485
|
const document = normalizeSpecDocument(
|
|
60837
61486
|
loaded.bundledContent,
|
|
60838
61487
|
(msg) => dependencies.core.warning(msg)
|
|
@@ -60859,7 +61508,7 @@ async function runBootstrap(inputs, dependencies) {
|
|
|
60859
61508
|
previousRaw,
|
|
60860
61509
|
(msg) => dependencies.core.warning(`Previous spec normalization: ${msg}`)
|
|
60861
61510
|
);
|
|
60862
|
-
previousSpecRollbackHash = (0,
|
|
61511
|
+
previousSpecRollbackHash = (0, import_node_crypto2.createHash)("sha256").update(previousSpecContent).digest("hex");
|
|
60863
61512
|
const existingSpecType = normalizeSpecTypeFromContent(previousSpecContent);
|
|
60864
61513
|
if (existingSpecType !== incomingSpecType) {
|
|
60865
61514
|
throw new Error(
|
|
@@ -60873,6 +61522,38 @@ async function runBootstrap(inputs, dependencies) {
|
|
|
60873
61522
|
return document;
|
|
60874
61523
|
}
|
|
60875
61524
|
);
|
|
61525
|
+
const breakingChangeResult = await runGroup(
|
|
61526
|
+
dependencies.core,
|
|
61527
|
+
"OpenAPI Breaking Change Check",
|
|
61528
|
+
async () => (dependencies.openApiChanges ?? runOpenApiBreakingChangeCheck)(
|
|
61529
|
+
{
|
|
61530
|
+
baselineSpecPath: inputs.breakingBaselineSpecPath,
|
|
61531
|
+
currentSourceContent: sourceSpecContent,
|
|
61532
|
+
currentUploadContent: specContent,
|
|
61533
|
+
logPath: inputs.breakingLogPath,
|
|
61534
|
+
mode: inputs.breakingChangeMode,
|
|
61535
|
+
previousSpecContent,
|
|
61536
|
+
rulesPath: inputs.breakingRulesPath,
|
|
61537
|
+
specPath: inputs.specPath,
|
|
61538
|
+
summaryPath: inputs.breakingSummaryPath,
|
|
61539
|
+
targetRef: inputs.breakingTargetRef
|
|
61540
|
+
},
|
|
61541
|
+
{
|
|
61542
|
+
core: dependencies.core,
|
|
61543
|
+
env: process.env,
|
|
61544
|
+
exec: dependencies.exec
|
|
61545
|
+
}
|
|
61546
|
+
)
|
|
61547
|
+
);
|
|
61548
|
+
outputs["breaking-change-status"] = breakingChangeResult.status;
|
|
61549
|
+
outputs["breaking-change-summary-json"] = createBreakingChangeSummaryJson(breakingChangeResult);
|
|
61550
|
+
if (breakingChangeResult.status === "failed") {
|
|
61551
|
+
dependencies.core.setOutput("breaking-change-status", outputs["breaking-change-status"]);
|
|
61552
|
+
dependencies.core.setOutput("breaking-change-summary-json", outputs["breaking-change-summary-json"]);
|
|
61553
|
+
throw new Error(
|
|
61554
|
+
`OpenAPI breaking-change check failed: ${breakingChangeResult.message || "breaking changes detected"}`
|
|
61555
|
+
);
|
|
61556
|
+
}
|
|
60876
61557
|
let explicitWorkspaceId = inputs.workspaceId;
|
|
60877
61558
|
if (!explicitWorkspaceId && resourcesState?.workspace?.id) {
|
|
60878
61559
|
explicitWorkspaceId = resourcesState.workspace.id;
|
|
@@ -61679,6 +62360,12 @@ var cliInputNames = [
|
|
|
61679
62360
|
"workspace-team-id",
|
|
61680
62361
|
"repo-url",
|
|
61681
62362
|
"openapi-version",
|
|
62363
|
+
"breaking-change-mode",
|
|
62364
|
+
"breaking-baseline-spec-path",
|
|
62365
|
+
"breaking-rules-path",
|
|
62366
|
+
"breaking-target-ref",
|
|
62367
|
+
"breaking-summary-path",
|
|
62368
|
+
"breaking-log-path",
|
|
61682
62369
|
"postman-stack"
|
|
61683
62370
|
];
|
|
61684
62371
|
var execFileAsync = (0, import_node_util.promisify)(import_node_child_process.execFile);
|
|
@@ -61791,15 +62478,15 @@ function shellQuote(value) {
|
|
|
61791
62478
|
return `'${value.replace(/'/g, `'\\''`)}'`;
|
|
61792
62479
|
}
|
|
61793
62480
|
function ensureInsideWorkspace(workspaceRoot, candidate) {
|
|
61794
|
-
const relative2 =
|
|
61795
|
-
if (relative2.startsWith("..") ||
|
|
62481
|
+
const relative2 = import_node_path3.default.relative(workspaceRoot, candidate);
|
|
62482
|
+
if (relative2.startsWith("..") || import_node_path3.default.isAbsolute(relative2)) {
|
|
61796
62483
|
throw new Error("Output path must stay within workspace");
|
|
61797
62484
|
}
|
|
61798
62485
|
}
|
|
61799
|
-
function
|
|
62486
|
+
function nearestExistingPath2(candidate) {
|
|
61800
62487
|
let current = candidate;
|
|
61801
62488
|
while (!pathExists(current)) {
|
|
61802
|
-
const parent =
|
|
62489
|
+
const parent = import_node_path3.default.dirname(current);
|
|
61803
62490
|
if (parent === current) {
|
|
61804
62491
|
return current;
|
|
61805
62492
|
}
|
|
@@ -61808,11 +62495,11 @@ function nearestExistingPath(candidate) {
|
|
|
61808
62495
|
return current;
|
|
61809
62496
|
}
|
|
61810
62497
|
function pathExists(candidate) {
|
|
61811
|
-
if ((0,
|
|
62498
|
+
if ((0, import_node_fs4.existsSync)(candidate)) {
|
|
61812
62499
|
return true;
|
|
61813
62500
|
}
|
|
61814
62501
|
try {
|
|
61815
|
-
(0,
|
|
62502
|
+
(0, import_node_fs4.lstatSync)(candidate);
|
|
61816
62503
|
return true;
|
|
61817
62504
|
} catch {
|
|
61818
62505
|
return false;
|
|
@@ -61820,35 +62507,35 @@ function pathExists(candidate) {
|
|
|
61820
62507
|
}
|
|
61821
62508
|
function checkedRealPath(existingPath, workspaceRealPath) {
|
|
61822
62509
|
try {
|
|
61823
|
-
return (0,
|
|
62510
|
+
return (0, import_node_fs4.realpathSync)(existingPath);
|
|
61824
62511
|
} catch (error) {
|
|
61825
|
-
if ((0,
|
|
61826
|
-
const linkTarget = (0,
|
|
61827
|
-
const resolvedTarget =
|
|
62512
|
+
if ((0, import_node_fs4.lstatSync)(existingPath).isSymbolicLink()) {
|
|
62513
|
+
const linkTarget = (0, import_node_fs4.readlinkSync)(existingPath);
|
|
62514
|
+
const resolvedTarget = import_node_path3.default.resolve(import_node_path3.default.dirname(existingPath), linkTarget);
|
|
61828
62515
|
ensureInsideWorkspace(workspaceRealPath, resolvedTarget);
|
|
61829
62516
|
}
|
|
61830
62517
|
throw error;
|
|
61831
62518
|
}
|
|
61832
62519
|
}
|
|
61833
|
-
function
|
|
62520
|
+
function assertOutputFileAllowed2(filePath) {
|
|
61834
62521
|
if (!filePath) {
|
|
61835
62522
|
return void 0;
|
|
61836
62523
|
}
|
|
61837
|
-
const workspaceRoot =
|
|
61838
|
-
const workspaceRealPath = (0,
|
|
61839
|
-
const resolved =
|
|
61840
|
-
const existingPath =
|
|
62524
|
+
const workspaceRoot = import_node_path3.default.resolve(process.cwd());
|
|
62525
|
+
const workspaceRealPath = (0, import_node_fs4.realpathSync)(workspaceRoot);
|
|
62526
|
+
const resolved = import_node_path3.default.isAbsolute(filePath) ? import_node_path3.default.resolve(filePath) : import_node_path3.default.resolve(workspaceRoot, filePath);
|
|
62527
|
+
const existingPath = nearestExistingPath2(resolved);
|
|
61841
62528
|
ensureInsideWorkspace(workspaceRealPath, checkedRealPath(existingPath, workspaceRealPath));
|
|
61842
62529
|
return resolved;
|
|
61843
62530
|
}
|
|
61844
62531
|
async function writeOptionalFile(filePath, content) {
|
|
61845
|
-
const resolved =
|
|
62532
|
+
const resolved = assertOutputFileAllowed2(filePath);
|
|
61846
62533
|
if (!resolved) {
|
|
61847
62534
|
return;
|
|
61848
62535
|
}
|
|
61849
|
-
await (0,
|
|
61850
|
-
ensureInsideWorkspace((0,
|
|
61851
|
-
await (0,
|
|
62536
|
+
await (0, import_promises4.mkdir)(import_node_path3.default.dirname(resolved), { recursive: true });
|
|
62537
|
+
ensureInsideWorkspace((0, import_node_fs4.realpathSync)(import_node_path3.default.resolve(process.cwd())), (0, import_node_fs4.realpathSync)(import_node_path3.default.dirname(resolved)));
|
|
62538
|
+
await (0, import_promises4.writeFile)(resolved, content, "utf8");
|
|
61852
62539
|
}
|
|
61853
62540
|
function requireCliInput(name, value) {
|
|
61854
62541
|
if (!value) {
|
|
@@ -61870,8 +62557,8 @@ async function runCli(argv = process.argv.slice(2), runtime = {}) {
|
|
|
61870
62557
|
const config = parseCliArgs(argv, env);
|
|
61871
62558
|
const inputs = resolveInputs(config.inputEnv);
|
|
61872
62559
|
validateCliInputs(inputs);
|
|
61873
|
-
|
|
61874
|
-
|
|
62560
|
+
assertOutputFileAllowed2(config.resultJsonPath);
|
|
62561
|
+
assertOutputFileAllowed2(config.dotenvPath);
|
|
61875
62562
|
const dependencies = createCliDependencies(inputs);
|
|
61876
62563
|
if ((inputs.domain || inputs.governanceGroup) && !dependencies.internalIntegration) {
|
|
61877
62564
|
dependencies.core.warning(
|
|
@@ -61892,9 +62579,9 @@ function isEntrypoint(currentPath, entrypointPath) {
|
|
|
61892
62579
|
return false;
|
|
61893
62580
|
}
|
|
61894
62581
|
try {
|
|
61895
|
-
return (0,
|
|
62582
|
+
return (0, import_node_fs4.realpathSync)(currentPath) === (0, import_node_fs4.realpathSync)(entrypointPath);
|
|
61896
62583
|
} catch {
|
|
61897
|
-
return
|
|
62584
|
+
return import_node_path3.default.resolve(currentPath) === import_node_path3.default.resolve(entrypointPath);
|
|
61898
62585
|
}
|
|
61899
62586
|
}
|
|
61900
62587
|
if (isEntrypoint(currentModulePath, entrypoint)) {
|