@postman-cse/onboarding-bootstrap 0.13.1 → 0.14.1
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 +1253 -533
- package/dist/cli.cjs +1279 -559
- package/dist/index.cjs +1253 -533
- package/package.json +1 -1
package/dist/action.cjs
CHANGED
|
@@ -1068,14 +1068,14 @@ var require_util = __commonJS({
|
|
|
1068
1068
|
}
|
|
1069
1069
|
const port = url.port != null ? url.port : url.protocol === "https:" ? 443 : 80;
|
|
1070
1070
|
let origin = url.origin != null ? url.origin : `${url.protocol || ""}//${url.hostname || ""}:${port}`;
|
|
1071
|
-
let
|
|
1071
|
+
let path8 = url.path != null ? url.path : `${url.pathname || ""}${url.search || ""}`;
|
|
1072
1072
|
if (origin[origin.length - 1] === "/") {
|
|
1073
1073
|
origin = origin.slice(0, origin.length - 1);
|
|
1074
1074
|
}
|
|
1075
|
-
if (
|
|
1076
|
-
|
|
1075
|
+
if (path8 && path8[0] !== "/") {
|
|
1076
|
+
path8 = `/${path8}`;
|
|
1077
1077
|
}
|
|
1078
|
-
return new URL(`${origin}${
|
|
1078
|
+
return new URL(`${origin}${path8}`);
|
|
1079
1079
|
}
|
|
1080
1080
|
if (!isHttpOrHttpsPrefixed(url.origin || url.protocol)) {
|
|
1081
1081
|
throw new InvalidArgumentError("Invalid URL protocol: the URL must start with `http:` or `https:`.");
|
|
@@ -1526,39 +1526,39 @@ var require_diagnostics = __commonJS({
|
|
|
1526
1526
|
});
|
|
1527
1527
|
diagnosticsChannel.channel("undici:client:sendHeaders").subscribe((evt) => {
|
|
1528
1528
|
const {
|
|
1529
|
-
request: { method, path:
|
|
1529
|
+
request: { method, path: path8, origin }
|
|
1530
1530
|
} = evt;
|
|
1531
|
-
debuglog("sending request to %s %s/%s", method, origin,
|
|
1531
|
+
debuglog("sending request to %s %s/%s", method, origin, path8);
|
|
1532
1532
|
});
|
|
1533
1533
|
diagnosticsChannel.channel("undici:request:headers").subscribe((evt) => {
|
|
1534
1534
|
const {
|
|
1535
|
-
request: { method, path:
|
|
1535
|
+
request: { method, path: path8, origin },
|
|
1536
1536
|
response: { statusCode }
|
|
1537
1537
|
} = evt;
|
|
1538
1538
|
debuglog(
|
|
1539
1539
|
"received response to %s %s/%s - HTTP %d",
|
|
1540
1540
|
method,
|
|
1541
1541
|
origin,
|
|
1542
|
-
|
|
1542
|
+
path8,
|
|
1543
1543
|
statusCode
|
|
1544
1544
|
);
|
|
1545
1545
|
});
|
|
1546
1546
|
diagnosticsChannel.channel("undici:request:trailers").subscribe((evt) => {
|
|
1547
1547
|
const {
|
|
1548
|
-
request: { method, path:
|
|
1548
|
+
request: { method, path: path8, origin }
|
|
1549
1549
|
} = evt;
|
|
1550
|
-
debuglog("trailers received from %s %s/%s", method, origin,
|
|
1550
|
+
debuglog("trailers received from %s %s/%s", method, origin, path8);
|
|
1551
1551
|
});
|
|
1552
1552
|
diagnosticsChannel.channel("undici:request:error").subscribe((evt) => {
|
|
1553
1553
|
const {
|
|
1554
|
-
request: { method, path:
|
|
1554
|
+
request: { method, path: path8, origin },
|
|
1555
1555
|
error: error2
|
|
1556
1556
|
} = evt;
|
|
1557
1557
|
debuglog(
|
|
1558
1558
|
"request to %s %s/%s errored - %s",
|
|
1559
1559
|
method,
|
|
1560
1560
|
origin,
|
|
1561
|
-
|
|
1561
|
+
path8,
|
|
1562
1562
|
error2.message
|
|
1563
1563
|
);
|
|
1564
1564
|
});
|
|
@@ -1607,9 +1607,9 @@ var require_diagnostics = __commonJS({
|
|
|
1607
1607
|
});
|
|
1608
1608
|
diagnosticsChannel.channel("undici:client:sendHeaders").subscribe((evt) => {
|
|
1609
1609
|
const {
|
|
1610
|
-
request: { method, path:
|
|
1610
|
+
request: { method, path: path8, origin }
|
|
1611
1611
|
} = evt;
|
|
1612
|
-
debuglog("sending request to %s %s/%s", method, origin,
|
|
1612
|
+
debuglog("sending request to %s %s/%s", method, origin, path8);
|
|
1613
1613
|
});
|
|
1614
1614
|
}
|
|
1615
1615
|
diagnosticsChannel.channel("undici:websocket:open").subscribe((evt) => {
|
|
@@ -1672,7 +1672,7 @@ var require_request = __commonJS({
|
|
|
1672
1672
|
var kHandler = /* @__PURE__ */ Symbol("handler");
|
|
1673
1673
|
var Request = class {
|
|
1674
1674
|
constructor(origin, {
|
|
1675
|
-
path:
|
|
1675
|
+
path: path8,
|
|
1676
1676
|
method,
|
|
1677
1677
|
body,
|
|
1678
1678
|
headers,
|
|
@@ -1687,11 +1687,11 @@ var require_request = __commonJS({
|
|
|
1687
1687
|
expectContinue,
|
|
1688
1688
|
servername
|
|
1689
1689
|
}, handler) {
|
|
1690
|
-
if (typeof
|
|
1690
|
+
if (typeof path8 !== "string") {
|
|
1691
1691
|
throw new InvalidArgumentError("path must be a string");
|
|
1692
|
-
} else if (
|
|
1692
|
+
} else if (path8[0] !== "/" && !(path8.startsWith("http://") || path8.startsWith("https://")) && method !== "CONNECT") {
|
|
1693
1693
|
throw new InvalidArgumentError("path must be an absolute URL or start with a slash");
|
|
1694
|
-
} else if (invalidPathRegex.test(
|
|
1694
|
+
} else if (invalidPathRegex.test(path8)) {
|
|
1695
1695
|
throw new InvalidArgumentError("invalid request path");
|
|
1696
1696
|
}
|
|
1697
1697
|
if (typeof method !== "string") {
|
|
@@ -1757,7 +1757,7 @@ var require_request = __commonJS({
|
|
|
1757
1757
|
this.completed = false;
|
|
1758
1758
|
this.aborted = false;
|
|
1759
1759
|
this.upgrade = upgrade || null;
|
|
1760
|
-
this.path = query ? buildURL(
|
|
1760
|
+
this.path = query ? buildURL(path8, query) : path8;
|
|
1761
1761
|
this.origin = origin;
|
|
1762
1762
|
this.idempotent = idempotent == null ? method === "HEAD" || method === "GET" : idempotent;
|
|
1763
1763
|
this.blocking = blocking == null ? false : blocking;
|
|
@@ -6321,7 +6321,7 @@ var require_client_h1 = __commonJS({
|
|
|
6321
6321
|
return method !== "GET" && method !== "HEAD" && method !== "OPTIONS" && method !== "TRACE" && method !== "CONNECT";
|
|
6322
6322
|
}
|
|
6323
6323
|
function writeH1(client, request) {
|
|
6324
|
-
const { method, path:
|
|
6324
|
+
const { method, path: path8, host, upgrade, blocking, reset } = request;
|
|
6325
6325
|
let { body, headers, contentLength } = request;
|
|
6326
6326
|
const expectsPayload = method === "PUT" || method === "POST" || method === "PATCH" || method === "QUERY" || method === "PROPFIND" || method === "PROPPATCH";
|
|
6327
6327
|
if (util.isFormDataLike(body)) {
|
|
@@ -6387,7 +6387,7 @@ var require_client_h1 = __commonJS({
|
|
|
6387
6387
|
if (blocking) {
|
|
6388
6388
|
socket[kBlocking] = true;
|
|
6389
6389
|
}
|
|
6390
|
-
let header = `${method} ${
|
|
6390
|
+
let header = `${method} ${path8} HTTP/1.1\r
|
|
6391
6391
|
`;
|
|
6392
6392
|
if (typeof host === "string") {
|
|
6393
6393
|
header += `host: ${host}\r
|
|
@@ -6913,7 +6913,7 @@ var require_client_h2 = __commonJS({
|
|
|
6913
6913
|
}
|
|
6914
6914
|
function writeH2(client, request) {
|
|
6915
6915
|
const session = client[kHTTP2Session];
|
|
6916
|
-
const { method, path:
|
|
6916
|
+
const { method, path: path8, host, upgrade, expectContinue, signal, headers: reqHeaders } = request;
|
|
6917
6917
|
let { body } = request;
|
|
6918
6918
|
if (upgrade) {
|
|
6919
6919
|
util.errorRequest(client, request, new Error("Upgrade not supported for H2"));
|
|
@@ -6980,7 +6980,7 @@ var require_client_h2 = __commonJS({
|
|
|
6980
6980
|
});
|
|
6981
6981
|
return true;
|
|
6982
6982
|
}
|
|
6983
|
-
headers[HTTP2_HEADER_PATH] =
|
|
6983
|
+
headers[HTTP2_HEADER_PATH] = path8;
|
|
6984
6984
|
headers[HTTP2_HEADER_SCHEME] = "https";
|
|
6985
6985
|
const expectsPayload = method === "PUT" || method === "POST" || method === "PATCH";
|
|
6986
6986
|
if (body && typeof body.read === "function") {
|
|
@@ -7333,9 +7333,9 @@ var require_redirect_handler = __commonJS({
|
|
|
7333
7333
|
return this.handler.onHeaders(statusCode, headers, resume, statusText);
|
|
7334
7334
|
}
|
|
7335
7335
|
const { origin, pathname, search } = util.parseURL(new URL(this.location, this.opts.origin && new URL(this.opts.path, this.opts.origin)));
|
|
7336
|
-
const
|
|
7336
|
+
const path8 = search ? `${pathname}${search}` : pathname;
|
|
7337
7337
|
this.opts.headers = cleanRequestHeaders(this.opts.headers, statusCode === 303, this.opts.origin !== origin);
|
|
7338
|
-
this.opts.path =
|
|
7338
|
+
this.opts.path = path8;
|
|
7339
7339
|
this.opts.origin = origin;
|
|
7340
7340
|
this.opts.maxRedirections = 0;
|
|
7341
7341
|
this.opts.query = null;
|
|
@@ -8570,10 +8570,10 @@ var require_proxy_agent = __commonJS({
|
|
|
8570
8570
|
};
|
|
8571
8571
|
const {
|
|
8572
8572
|
origin,
|
|
8573
|
-
path:
|
|
8573
|
+
path: path8 = "/",
|
|
8574
8574
|
headers = {}
|
|
8575
8575
|
} = opts;
|
|
8576
|
-
opts.path = origin +
|
|
8576
|
+
opts.path = origin + path8;
|
|
8577
8577
|
if (!("host" in headers) && !("Host" in headers)) {
|
|
8578
8578
|
const { host } = new URL3(origin);
|
|
8579
8579
|
headers.host = host;
|
|
@@ -10494,20 +10494,20 @@ var require_mock_utils = __commonJS({
|
|
|
10494
10494
|
}
|
|
10495
10495
|
return true;
|
|
10496
10496
|
}
|
|
10497
|
-
function safeUrl(
|
|
10498
|
-
if (typeof
|
|
10499
|
-
return
|
|
10497
|
+
function safeUrl(path8) {
|
|
10498
|
+
if (typeof path8 !== "string") {
|
|
10499
|
+
return path8;
|
|
10500
10500
|
}
|
|
10501
|
-
const pathSegments =
|
|
10501
|
+
const pathSegments = path8.split("?");
|
|
10502
10502
|
if (pathSegments.length !== 2) {
|
|
10503
|
-
return
|
|
10503
|
+
return path8;
|
|
10504
10504
|
}
|
|
10505
10505
|
const qp = new URLSearchParams(pathSegments.pop());
|
|
10506
10506
|
qp.sort();
|
|
10507
10507
|
return [...pathSegments, qp.toString()].join("?");
|
|
10508
10508
|
}
|
|
10509
|
-
function matchKey(mockDispatch2, { path:
|
|
10510
|
-
const pathMatch = matchValue(mockDispatch2.path,
|
|
10509
|
+
function matchKey(mockDispatch2, { path: path8, method, body, headers }) {
|
|
10510
|
+
const pathMatch = matchValue(mockDispatch2.path, path8);
|
|
10511
10511
|
const methodMatch = matchValue(mockDispatch2.method, method);
|
|
10512
10512
|
const bodyMatch = typeof mockDispatch2.body !== "undefined" ? matchValue(mockDispatch2.body, body) : true;
|
|
10513
10513
|
const headersMatch = matchHeaders(mockDispatch2, headers);
|
|
@@ -10529,7 +10529,7 @@ var require_mock_utils = __commonJS({
|
|
|
10529
10529
|
function getMockDispatch(mockDispatches, key) {
|
|
10530
10530
|
const basePath = key.query ? buildURL(key.path, key.query) : key.path;
|
|
10531
10531
|
const resolvedPath = typeof basePath === "string" ? safeUrl(basePath) : basePath;
|
|
10532
|
-
let matchedMockDispatches = mockDispatches.filter(({ consumed }) => !consumed).filter(({ path:
|
|
10532
|
+
let matchedMockDispatches = mockDispatches.filter(({ consumed }) => !consumed).filter(({ path: path8 }) => matchValue(safeUrl(path8), resolvedPath));
|
|
10533
10533
|
if (matchedMockDispatches.length === 0) {
|
|
10534
10534
|
throw new MockNotMatchedError(`Mock dispatch not matched for path '${resolvedPath}'`);
|
|
10535
10535
|
}
|
|
@@ -10567,9 +10567,9 @@ var require_mock_utils = __commonJS({
|
|
|
10567
10567
|
}
|
|
10568
10568
|
}
|
|
10569
10569
|
function buildKey(opts) {
|
|
10570
|
-
const { path:
|
|
10570
|
+
const { path: path8, method, body, headers, query } = opts;
|
|
10571
10571
|
return {
|
|
10572
|
-
path:
|
|
10572
|
+
path: path8,
|
|
10573
10573
|
method,
|
|
10574
10574
|
body,
|
|
10575
10575
|
headers,
|
|
@@ -11032,10 +11032,10 @@ var require_pending_interceptors_formatter = __commonJS({
|
|
|
11032
11032
|
}
|
|
11033
11033
|
format(pendingInterceptors) {
|
|
11034
11034
|
const withPrettyHeaders = pendingInterceptors.map(
|
|
11035
|
-
({ method, path:
|
|
11035
|
+
({ method, path: path8, data: { statusCode }, persist, times, timesInvoked, origin }) => ({
|
|
11036
11036
|
Method: method,
|
|
11037
11037
|
Origin: origin,
|
|
11038
|
-
Path:
|
|
11038
|
+
Path: path8,
|
|
11039
11039
|
"Status code": statusCode,
|
|
11040
11040
|
Persistent: persist ? PERSISTENT : NOT_PERSISTENT,
|
|
11041
11041
|
Invocations: timesInvoked,
|
|
@@ -11887,9 +11887,9 @@ var require_headers = __commonJS({
|
|
|
11887
11887
|
return array;
|
|
11888
11888
|
}
|
|
11889
11889
|
const iterator = this[kHeadersMap][Symbol.iterator]();
|
|
11890
|
-
const
|
|
11891
|
-
array[0] = [
|
|
11892
|
-
assert(
|
|
11890
|
+
const firstValue2 = iterator.next().value;
|
|
11891
|
+
array[0] = [firstValue2[0], firstValue2[1].value];
|
|
11892
|
+
assert(firstValue2[1].value !== null);
|
|
11893
11893
|
for (let i = 1, j = 0, right = 0, left = 0, pivot = 0, x, value; i < size; ++i) {
|
|
11894
11894
|
value = iterator.next().value;
|
|
11895
11895
|
x = array[i] = [value[0], value[1].value];
|
|
@@ -15916,9 +15916,9 @@ var require_util6 = __commonJS({
|
|
|
15916
15916
|
}
|
|
15917
15917
|
}
|
|
15918
15918
|
}
|
|
15919
|
-
function validateCookiePath(
|
|
15920
|
-
for (let i = 0; i <
|
|
15921
|
-
const code =
|
|
15919
|
+
function validateCookiePath(path8) {
|
|
15920
|
+
for (let i = 0; i < path8.length; ++i) {
|
|
15921
|
+
const code = path8.charCodeAt(i);
|
|
15922
15922
|
if (code < 32 || // exclude CTLs (0-31)
|
|
15923
15923
|
code === 127 || // DEL
|
|
15924
15924
|
code === 59) {
|
|
@@ -18595,11 +18595,11 @@ var require_undici = __commonJS({
|
|
|
18595
18595
|
if (typeof opts.path !== "string") {
|
|
18596
18596
|
throw new InvalidArgumentError("invalid opts.path");
|
|
18597
18597
|
}
|
|
18598
|
-
let
|
|
18598
|
+
let path8 = opts.path;
|
|
18599
18599
|
if (!opts.path.startsWith("/")) {
|
|
18600
|
-
|
|
18600
|
+
path8 = `/${path8}`;
|
|
18601
18601
|
}
|
|
18602
|
-
url = new URL(util.parseOrigin(url).origin +
|
|
18602
|
+
url = new URL(util.parseOrigin(url).origin + path8);
|
|
18603
18603
|
} else {
|
|
18604
18604
|
if (!opts) {
|
|
18605
18605
|
opts = typeof url === "object" ? url : {};
|
|
@@ -18747,17 +18747,17 @@ var require_visit = __commonJS({
|
|
|
18747
18747
|
visit.BREAK = BREAK;
|
|
18748
18748
|
visit.SKIP = SKIP;
|
|
18749
18749
|
visit.REMOVE = REMOVE;
|
|
18750
|
-
function visit_(key, node, visitor,
|
|
18751
|
-
const ctrl = callVisitor(key, node, visitor,
|
|
18750
|
+
function visit_(key, node, visitor, path8) {
|
|
18751
|
+
const ctrl = callVisitor(key, node, visitor, path8);
|
|
18752
18752
|
if (identity.isNode(ctrl) || identity.isPair(ctrl)) {
|
|
18753
|
-
replaceNode(key,
|
|
18754
|
-
return visit_(key, ctrl, visitor,
|
|
18753
|
+
replaceNode(key, path8, ctrl);
|
|
18754
|
+
return visit_(key, ctrl, visitor, path8);
|
|
18755
18755
|
}
|
|
18756
18756
|
if (typeof ctrl !== "symbol") {
|
|
18757
18757
|
if (identity.isCollection(node)) {
|
|
18758
|
-
|
|
18758
|
+
path8 = Object.freeze(path8.concat(node));
|
|
18759
18759
|
for (let i = 0; i < node.items.length; ++i) {
|
|
18760
|
-
const ci = visit_(i, node.items[i], visitor,
|
|
18760
|
+
const ci = visit_(i, node.items[i], visitor, path8);
|
|
18761
18761
|
if (typeof ci === "number")
|
|
18762
18762
|
i = ci - 1;
|
|
18763
18763
|
else if (ci === BREAK)
|
|
@@ -18768,13 +18768,13 @@ var require_visit = __commonJS({
|
|
|
18768
18768
|
}
|
|
18769
18769
|
}
|
|
18770
18770
|
} else if (identity.isPair(node)) {
|
|
18771
|
-
|
|
18772
|
-
const ck = visit_("key", node.key, visitor,
|
|
18771
|
+
path8 = Object.freeze(path8.concat(node));
|
|
18772
|
+
const ck = visit_("key", node.key, visitor, path8);
|
|
18773
18773
|
if (ck === BREAK)
|
|
18774
18774
|
return BREAK;
|
|
18775
18775
|
else if (ck === REMOVE)
|
|
18776
18776
|
node.key = null;
|
|
18777
|
-
const cv = visit_("value", node.value, visitor,
|
|
18777
|
+
const cv = visit_("value", node.value, visitor, path8);
|
|
18778
18778
|
if (cv === BREAK)
|
|
18779
18779
|
return BREAK;
|
|
18780
18780
|
else if (cv === REMOVE)
|
|
@@ -18795,17 +18795,17 @@ var require_visit = __commonJS({
|
|
|
18795
18795
|
visitAsync.BREAK = BREAK;
|
|
18796
18796
|
visitAsync.SKIP = SKIP;
|
|
18797
18797
|
visitAsync.REMOVE = REMOVE;
|
|
18798
|
-
async function visitAsync_(key, node, visitor,
|
|
18799
|
-
const ctrl = await callVisitor(key, node, visitor,
|
|
18798
|
+
async function visitAsync_(key, node, visitor, path8) {
|
|
18799
|
+
const ctrl = await callVisitor(key, node, visitor, path8);
|
|
18800
18800
|
if (identity.isNode(ctrl) || identity.isPair(ctrl)) {
|
|
18801
|
-
replaceNode(key,
|
|
18802
|
-
return visitAsync_(key, ctrl, visitor,
|
|
18801
|
+
replaceNode(key, path8, ctrl);
|
|
18802
|
+
return visitAsync_(key, ctrl, visitor, path8);
|
|
18803
18803
|
}
|
|
18804
18804
|
if (typeof ctrl !== "symbol") {
|
|
18805
18805
|
if (identity.isCollection(node)) {
|
|
18806
|
-
|
|
18806
|
+
path8 = Object.freeze(path8.concat(node));
|
|
18807
18807
|
for (let i = 0; i < node.items.length; ++i) {
|
|
18808
|
-
const ci = await visitAsync_(i, node.items[i], visitor,
|
|
18808
|
+
const ci = await visitAsync_(i, node.items[i], visitor, path8);
|
|
18809
18809
|
if (typeof ci === "number")
|
|
18810
18810
|
i = ci - 1;
|
|
18811
18811
|
else if (ci === BREAK)
|
|
@@ -18816,13 +18816,13 @@ var require_visit = __commonJS({
|
|
|
18816
18816
|
}
|
|
18817
18817
|
}
|
|
18818
18818
|
} else if (identity.isPair(node)) {
|
|
18819
|
-
|
|
18820
|
-
const ck = await visitAsync_("key", node.key, visitor,
|
|
18819
|
+
path8 = Object.freeze(path8.concat(node));
|
|
18820
|
+
const ck = await visitAsync_("key", node.key, visitor, path8);
|
|
18821
18821
|
if (ck === BREAK)
|
|
18822
18822
|
return BREAK;
|
|
18823
18823
|
else if (ck === REMOVE)
|
|
18824
18824
|
node.key = null;
|
|
18825
|
-
const cv = await visitAsync_("value", node.value, visitor,
|
|
18825
|
+
const cv = await visitAsync_("value", node.value, visitor, path8);
|
|
18826
18826
|
if (cv === BREAK)
|
|
18827
18827
|
return BREAK;
|
|
18828
18828
|
else if (cv === REMOVE)
|
|
@@ -18849,23 +18849,23 @@ var require_visit = __commonJS({
|
|
|
18849
18849
|
}
|
|
18850
18850
|
return visitor;
|
|
18851
18851
|
}
|
|
18852
|
-
function callVisitor(key, node, visitor,
|
|
18852
|
+
function callVisitor(key, node, visitor, path8) {
|
|
18853
18853
|
if (typeof visitor === "function")
|
|
18854
|
-
return visitor(key, node,
|
|
18854
|
+
return visitor(key, node, path8);
|
|
18855
18855
|
if (identity.isMap(node))
|
|
18856
|
-
return visitor.Map?.(key, node,
|
|
18856
|
+
return visitor.Map?.(key, node, path8);
|
|
18857
18857
|
if (identity.isSeq(node))
|
|
18858
|
-
return visitor.Seq?.(key, node,
|
|
18858
|
+
return visitor.Seq?.(key, node, path8);
|
|
18859
18859
|
if (identity.isPair(node))
|
|
18860
|
-
return visitor.Pair?.(key, node,
|
|
18860
|
+
return visitor.Pair?.(key, node, path8);
|
|
18861
18861
|
if (identity.isScalar(node))
|
|
18862
|
-
return visitor.Scalar?.(key, node,
|
|
18862
|
+
return visitor.Scalar?.(key, node, path8);
|
|
18863
18863
|
if (identity.isAlias(node))
|
|
18864
|
-
return visitor.Alias?.(key, node,
|
|
18864
|
+
return visitor.Alias?.(key, node, path8);
|
|
18865
18865
|
return void 0;
|
|
18866
18866
|
}
|
|
18867
|
-
function replaceNode(key,
|
|
18868
|
-
const parent =
|
|
18867
|
+
function replaceNode(key, path8, node) {
|
|
18868
|
+
const parent = path8[path8.length - 1];
|
|
18869
18869
|
if (identity.isCollection(parent)) {
|
|
18870
18870
|
parent.items[key] = node;
|
|
18871
18871
|
} else if (identity.isPair(parent)) {
|
|
@@ -19475,10 +19475,10 @@ var require_Collection = __commonJS({
|
|
|
19475
19475
|
var createNode = require_createNode();
|
|
19476
19476
|
var identity = require_identity();
|
|
19477
19477
|
var Node = require_Node();
|
|
19478
|
-
function collectionFromPath(schema2,
|
|
19478
|
+
function collectionFromPath(schema2, path8, value) {
|
|
19479
19479
|
let v = value;
|
|
19480
|
-
for (let i =
|
|
19481
|
-
const k =
|
|
19480
|
+
for (let i = path8.length - 1; i >= 0; --i) {
|
|
19481
|
+
const k = path8[i];
|
|
19482
19482
|
if (typeof k === "number" && Number.isInteger(k) && k >= 0) {
|
|
19483
19483
|
const a = [];
|
|
19484
19484
|
a[k] = v;
|
|
@@ -19497,7 +19497,7 @@ var require_Collection = __commonJS({
|
|
|
19497
19497
|
sourceObjects: /* @__PURE__ */ new Map()
|
|
19498
19498
|
});
|
|
19499
19499
|
}
|
|
19500
|
-
var isEmptyPath = (
|
|
19500
|
+
var isEmptyPath = (path8) => path8 == null || typeof path8 === "object" && !!path8[Symbol.iterator]().next().done;
|
|
19501
19501
|
var Collection = class extends Node.NodeBase {
|
|
19502
19502
|
constructor(type2, schema2) {
|
|
19503
19503
|
super(type2);
|
|
@@ -19527,11 +19527,11 @@ var require_Collection = __commonJS({
|
|
|
19527
19527
|
* be a Pair instance or a `{ key, value }` object, which may not have a key
|
|
19528
19528
|
* that already exists in the map.
|
|
19529
19529
|
*/
|
|
19530
|
-
addIn(
|
|
19531
|
-
if (isEmptyPath(
|
|
19530
|
+
addIn(path8, value) {
|
|
19531
|
+
if (isEmptyPath(path8))
|
|
19532
19532
|
this.add(value);
|
|
19533
19533
|
else {
|
|
19534
|
-
const [key, ...rest] =
|
|
19534
|
+
const [key, ...rest] = path8;
|
|
19535
19535
|
const node = this.get(key, true);
|
|
19536
19536
|
if (identity.isCollection(node))
|
|
19537
19537
|
node.addIn(rest, value);
|
|
@@ -19545,8 +19545,8 @@ var require_Collection = __commonJS({
|
|
|
19545
19545
|
* Removes a value from the collection.
|
|
19546
19546
|
* @returns `true` if the item was found and removed.
|
|
19547
19547
|
*/
|
|
19548
|
-
deleteIn(
|
|
19549
|
-
const [key, ...rest] =
|
|
19548
|
+
deleteIn(path8) {
|
|
19549
|
+
const [key, ...rest] = path8;
|
|
19550
19550
|
if (rest.length === 0)
|
|
19551
19551
|
return this.delete(key);
|
|
19552
19552
|
const node = this.get(key, true);
|
|
@@ -19560,8 +19560,8 @@ var require_Collection = __commonJS({
|
|
|
19560
19560
|
* scalar values from their surrounding node; to disable set `keepScalar` to
|
|
19561
19561
|
* `true` (collections are always returned intact).
|
|
19562
19562
|
*/
|
|
19563
|
-
getIn(
|
|
19564
|
-
const [key, ...rest] =
|
|
19563
|
+
getIn(path8, keepScalar) {
|
|
19564
|
+
const [key, ...rest] = path8;
|
|
19565
19565
|
const node = this.get(key, true);
|
|
19566
19566
|
if (rest.length === 0)
|
|
19567
19567
|
return !keepScalar && identity.isScalar(node) ? node.value : node;
|
|
@@ -19579,8 +19579,8 @@ var require_Collection = __commonJS({
|
|
|
19579
19579
|
/**
|
|
19580
19580
|
* Checks if the collection includes a value with the key `key`.
|
|
19581
19581
|
*/
|
|
19582
|
-
hasIn(
|
|
19583
|
-
const [key, ...rest] =
|
|
19582
|
+
hasIn(path8) {
|
|
19583
|
+
const [key, ...rest] = path8;
|
|
19584
19584
|
if (rest.length === 0)
|
|
19585
19585
|
return this.has(key);
|
|
19586
19586
|
const node = this.get(key, true);
|
|
@@ -19590,8 +19590,8 @@ var require_Collection = __commonJS({
|
|
|
19590
19590
|
* Sets a value in this collection. For `!!set`, `value` needs to be a
|
|
19591
19591
|
* boolean to add/remove the item from the set.
|
|
19592
19592
|
*/
|
|
19593
|
-
setIn(
|
|
19594
|
-
const [key, ...rest] =
|
|
19593
|
+
setIn(path8, value) {
|
|
19594
|
+
const [key, ...rest] = path8;
|
|
19595
19595
|
if (rest.length === 0) {
|
|
19596
19596
|
this.set(key, value);
|
|
19597
19597
|
} else {
|
|
@@ -22106,9 +22106,9 @@ var require_Document = __commonJS({
|
|
|
22106
22106
|
this.contents.add(value);
|
|
22107
22107
|
}
|
|
22108
22108
|
/** Adds a value to the document. */
|
|
22109
|
-
addIn(
|
|
22109
|
+
addIn(path8, value) {
|
|
22110
22110
|
if (assertCollection(this.contents))
|
|
22111
|
-
this.contents.addIn(
|
|
22111
|
+
this.contents.addIn(path8, value);
|
|
22112
22112
|
}
|
|
22113
22113
|
/**
|
|
22114
22114
|
* Create a new `Alias` node, ensuring that the target `node` has the required anchor.
|
|
@@ -22183,14 +22183,14 @@ var require_Document = __commonJS({
|
|
|
22183
22183
|
* Removes a value from the document.
|
|
22184
22184
|
* @returns `true` if the item was found and removed.
|
|
22185
22185
|
*/
|
|
22186
|
-
deleteIn(
|
|
22187
|
-
if (Collection.isEmptyPath(
|
|
22186
|
+
deleteIn(path8) {
|
|
22187
|
+
if (Collection.isEmptyPath(path8)) {
|
|
22188
22188
|
if (this.contents == null)
|
|
22189
22189
|
return false;
|
|
22190
22190
|
this.contents = null;
|
|
22191
22191
|
return true;
|
|
22192
22192
|
}
|
|
22193
|
-
return assertCollection(this.contents) ? this.contents.deleteIn(
|
|
22193
|
+
return assertCollection(this.contents) ? this.contents.deleteIn(path8) : false;
|
|
22194
22194
|
}
|
|
22195
22195
|
/**
|
|
22196
22196
|
* Returns item at `key`, or `undefined` if not found. By default unwraps
|
|
@@ -22205,10 +22205,10 @@ var require_Document = __commonJS({
|
|
|
22205
22205
|
* scalar values from their surrounding node; to disable set `keepScalar` to
|
|
22206
22206
|
* `true` (collections are always returned intact).
|
|
22207
22207
|
*/
|
|
22208
|
-
getIn(
|
|
22209
|
-
if (Collection.isEmptyPath(
|
|
22208
|
+
getIn(path8, keepScalar) {
|
|
22209
|
+
if (Collection.isEmptyPath(path8))
|
|
22210
22210
|
return !keepScalar && identity.isScalar(this.contents) ? this.contents.value : this.contents;
|
|
22211
|
-
return identity.isCollection(this.contents) ? this.contents.getIn(
|
|
22211
|
+
return identity.isCollection(this.contents) ? this.contents.getIn(path8, keepScalar) : void 0;
|
|
22212
22212
|
}
|
|
22213
22213
|
/**
|
|
22214
22214
|
* Checks if the document includes a value with the key `key`.
|
|
@@ -22219,10 +22219,10 @@ var require_Document = __commonJS({
|
|
|
22219
22219
|
/**
|
|
22220
22220
|
* Checks if the document includes a value at `path`.
|
|
22221
22221
|
*/
|
|
22222
|
-
hasIn(
|
|
22223
|
-
if (Collection.isEmptyPath(
|
|
22222
|
+
hasIn(path8) {
|
|
22223
|
+
if (Collection.isEmptyPath(path8))
|
|
22224
22224
|
return this.contents !== void 0;
|
|
22225
|
-
return identity.isCollection(this.contents) ? this.contents.hasIn(
|
|
22225
|
+
return identity.isCollection(this.contents) ? this.contents.hasIn(path8) : false;
|
|
22226
22226
|
}
|
|
22227
22227
|
/**
|
|
22228
22228
|
* Sets a value in this document. For `!!set`, `value` needs to be a
|
|
@@ -22239,13 +22239,13 @@ var require_Document = __commonJS({
|
|
|
22239
22239
|
* Sets a value in this document. For `!!set`, `value` needs to be a
|
|
22240
22240
|
* boolean to add/remove the item from the set.
|
|
22241
22241
|
*/
|
|
22242
|
-
setIn(
|
|
22243
|
-
if (Collection.isEmptyPath(
|
|
22242
|
+
setIn(path8, value) {
|
|
22243
|
+
if (Collection.isEmptyPath(path8)) {
|
|
22244
22244
|
this.contents = value;
|
|
22245
22245
|
} else if (this.contents == null) {
|
|
22246
|
-
this.contents = Collection.collectionFromPath(this.schema, Array.from(
|
|
22246
|
+
this.contents = Collection.collectionFromPath(this.schema, Array.from(path8), value);
|
|
22247
22247
|
} else if (assertCollection(this.contents)) {
|
|
22248
|
-
this.contents.setIn(
|
|
22248
|
+
this.contents.setIn(path8, value);
|
|
22249
22249
|
}
|
|
22250
22250
|
}
|
|
22251
22251
|
/**
|
|
@@ -24205,9 +24205,9 @@ var require_cst_visit = __commonJS({
|
|
|
24205
24205
|
visit.BREAK = BREAK;
|
|
24206
24206
|
visit.SKIP = SKIP;
|
|
24207
24207
|
visit.REMOVE = REMOVE;
|
|
24208
|
-
visit.itemAtPath = (cst,
|
|
24208
|
+
visit.itemAtPath = (cst, path8) => {
|
|
24209
24209
|
let item = cst;
|
|
24210
|
-
for (const [field, index] of
|
|
24210
|
+
for (const [field, index] of path8) {
|
|
24211
24211
|
const tok = item?.[field];
|
|
24212
24212
|
if (tok && "items" in tok) {
|
|
24213
24213
|
item = tok.items[index];
|
|
@@ -24216,23 +24216,23 @@ var require_cst_visit = __commonJS({
|
|
|
24216
24216
|
}
|
|
24217
24217
|
return item;
|
|
24218
24218
|
};
|
|
24219
|
-
visit.parentCollection = (cst,
|
|
24220
|
-
const parent = visit.itemAtPath(cst,
|
|
24221
|
-
const field =
|
|
24219
|
+
visit.parentCollection = (cst, path8) => {
|
|
24220
|
+
const parent = visit.itemAtPath(cst, path8.slice(0, -1));
|
|
24221
|
+
const field = path8[path8.length - 1][0];
|
|
24222
24222
|
const coll = parent?.[field];
|
|
24223
24223
|
if (coll && "items" in coll)
|
|
24224
24224
|
return coll;
|
|
24225
24225
|
throw new Error("Parent collection not found");
|
|
24226
24226
|
};
|
|
24227
|
-
function _visit(
|
|
24228
|
-
let ctrl = visitor(item,
|
|
24227
|
+
function _visit(path8, item, visitor) {
|
|
24228
|
+
let ctrl = visitor(item, path8);
|
|
24229
24229
|
if (typeof ctrl === "symbol")
|
|
24230
24230
|
return ctrl;
|
|
24231
24231
|
for (const field of ["key", "value"]) {
|
|
24232
24232
|
const token = item[field];
|
|
24233
24233
|
if (token && "items" in token) {
|
|
24234
24234
|
for (let i = 0; i < token.items.length; ++i) {
|
|
24235
|
-
const ci = _visit(Object.freeze(
|
|
24235
|
+
const ci = _visit(Object.freeze(path8.concat([[field, i]])), token.items[i], visitor);
|
|
24236
24236
|
if (typeof ci === "number")
|
|
24237
24237
|
i = ci - 1;
|
|
24238
24238
|
else if (ci === BREAK)
|
|
@@ -24243,10 +24243,10 @@ var require_cst_visit = __commonJS({
|
|
|
24243
24243
|
}
|
|
24244
24244
|
}
|
|
24245
24245
|
if (typeof ctrl === "function" && field === "key")
|
|
24246
|
-
ctrl = ctrl(item,
|
|
24246
|
+
ctrl = ctrl(item, path8);
|
|
24247
24247
|
}
|
|
24248
24248
|
}
|
|
24249
|
-
return typeof ctrl === "function" ? ctrl(item,
|
|
24249
|
+
return typeof ctrl === "function" ? ctrl(item, path8) : ctrl;
|
|
24250
24250
|
}
|
|
24251
24251
|
exports2.visit = visit;
|
|
24252
24252
|
}
|
|
@@ -26186,7 +26186,7 @@ var require_scope_functions = __commonJS({
|
|
|
26186
26186
|
var hasOwn = Function.prototype.call.bind(Object.prototype.hasOwnProperty);
|
|
26187
26187
|
hasOwn[/* @__PURE__ */ Symbol.for("toJayString")] = "Function.prototype.call.bind(Object.prototype.hasOwnProperty)";
|
|
26188
26188
|
var pointerPart = (s) => /~\//.test(s) ? `${s}`.replace(/~/g, "~0").replace(/\//g, "~1") : s;
|
|
26189
|
-
var toPointer = (
|
|
26189
|
+
var toPointer = (path8) => path8.length === 0 ? "#" : `#/${path8.map(pointerPart).join("/")}`;
|
|
26190
26190
|
var errorMerge = ({ keywordLocation, instanceLocation }, schemaBase, dataBase) => ({
|
|
26191
26191
|
keywordLocation: `${schemaBase}${keywordLocation.slice(1)}`,
|
|
26192
26192
|
instanceLocation: `${dataBase}${instanceLocation.slice(1)}`
|
|
@@ -26523,7 +26523,7 @@ var require_pointer = __commonJS({
|
|
|
26523
26523
|
throw new Error("Unreachable");
|
|
26524
26524
|
});
|
|
26525
26525
|
}
|
|
26526
|
-
function
|
|
26526
|
+
function get3(obj, pointer, objpath) {
|
|
26527
26527
|
if (typeof obj !== "object") throw new Error("Invalid input object");
|
|
26528
26528
|
if (typeof pointer !== "string") throw new Error("Invalid JSON pointer");
|
|
26529
26529
|
const parts = pointer.split("/");
|
|
@@ -26580,14 +26580,14 @@ var require_pointer = __commonJS({
|
|
|
26580
26580
|
const visit = (sub, oldPath, specialChilds = false, dynamic = false) => {
|
|
26581
26581
|
if (!sub || typeof sub !== "object") return;
|
|
26582
26582
|
const id = sub.$id || sub.id;
|
|
26583
|
-
let
|
|
26583
|
+
let path8 = oldPath;
|
|
26584
26584
|
if (id && typeof id === "string") {
|
|
26585
|
-
|
|
26586
|
-
if (
|
|
26585
|
+
path8 = joinPath(path8, id);
|
|
26586
|
+
if (path8 === ptr || path8 === main && local === "") {
|
|
26587
26587
|
results.push([sub, root, oldPath]);
|
|
26588
|
-
} else if (
|
|
26588
|
+
} else if (path8 === main && local[0] === "/") {
|
|
26589
26589
|
const objpath = [];
|
|
26590
|
-
const res =
|
|
26590
|
+
const res = get3(sub, local, objpath);
|
|
26591
26591
|
if (res !== void 0) results.push([res, root, joinPath(oldPath, objpath2path(objpath))]);
|
|
26592
26592
|
}
|
|
26593
26593
|
}
|
|
@@ -26595,20 +26595,20 @@ var require_pointer = __commonJS({
|
|
|
26595
26595
|
if (anchor && typeof anchor === "string") {
|
|
26596
26596
|
if (anchor.includes("#")) throw new Error("$anchor can't include '#'");
|
|
26597
26597
|
if (anchor.startsWith("/")) throw new Error("$anchor can't start with '/'");
|
|
26598
|
-
|
|
26599
|
-
if (
|
|
26598
|
+
path8 = joinPath(path8, `#${anchor}`);
|
|
26599
|
+
if (path8 === ptr) results.push([sub, root, oldPath]);
|
|
26600
26600
|
}
|
|
26601
26601
|
for (const k of Object.keys(sub)) {
|
|
26602
26602
|
if (!specialChilds && !Array.isArray(sub) && !knownKeywords.includes(k)) continue;
|
|
26603
26603
|
if (!specialChilds && skipChilds.includes(k)) continue;
|
|
26604
|
-
visit(sub[k],
|
|
26604
|
+
visit(sub[k], path8, !specialChilds && withSpecialChilds.includes(k));
|
|
26605
26605
|
}
|
|
26606
26606
|
if (!dynamic && sub.$dynamicAnchor) visit(sub, oldPath, specialChilds, true);
|
|
26607
26607
|
};
|
|
26608
26608
|
visit(root, main);
|
|
26609
26609
|
if (main === base.replace(/#$/, "") && (local[0] === "/" || local === "")) {
|
|
26610
26610
|
const objpath = [];
|
|
26611
|
-
const res =
|
|
26611
|
+
const res = get3(root, local, objpath);
|
|
26612
26612
|
if (res !== void 0) results.push([res, root, objpath2path(objpath)]);
|
|
26613
26613
|
}
|
|
26614
26614
|
if (schemas.has(main) && schemas.get(main) !== root) {
|
|
@@ -26661,7 +26661,7 @@ var require_pointer = __commonJS({
|
|
|
26661
26661
|
}
|
|
26662
26662
|
throw new Error("Unexpected value for 'schemas' option");
|
|
26663
26663
|
};
|
|
26664
|
-
module2.exports = { get:
|
|
26664
|
+
module2.exports = { get: get3, joinPath, resolveReference, getDynamicAnchors, hasKeywords, buildSchemas };
|
|
26665
26665
|
}
|
|
26666
26666
|
});
|
|
26667
26667
|
|
|
@@ -27047,14 +27047,14 @@ var require_compile = __commonJS({
|
|
|
27047
27047
|
}
|
|
27048
27048
|
const { gensym, getref, genref, genformat } = scopeMethods(scope);
|
|
27049
27049
|
const buildPath = (prop) => {
|
|
27050
|
-
const
|
|
27050
|
+
const path8 = [];
|
|
27051
27051
|
let curr = prop;
|
|
27052
27052
|
while (curr) {
|
|
27053
|
-
if (!curr.name)
|
|
27053
|
+
if (!curr.name) path8.unshift(curr);
|
|
27054
27054
|
curr = curr.parent || curr.errorParent;
|
|
27055
27055
|
}
|
|
27056
|
-
if (
|
|
27057
|
-
return format("%j", toPointer(
|
|
27056
|
+
if (path8.every((part) => part.keyval !== void 0))
|
|
27057
|
+
return format("%j", toPointer(path8.map((part) => part.keyval)));
|
|
27058
27058
|
const stringParts = ["#"];
|
|
27059
27059
|
const stringJoined = () => {
|
|
27060
27060
|
const value = stringParts.map(functions.pointerPart).join("/");
|
|
@@ -27062,7 +27062,7 @@ var require_compile = __commonJS({
|
|
|
27062
27062
|
return value;
|
|
27063
27063
|
};
|
|
27064
27064
|
let res = null;
|
|
27065
|
-
for (const { keyname, keyval, number } of
|
|
27065
|
+
for (const { keyname, keyval, number } of path8) {
|
|
27066
27066
|
if (keyname) {
|
|
27067
27067
|
if (!number) scope.pointerPart = functions.pointerPart;
|
|
27068
27068
|
const value = number ? keyname : format("pointerPart(%s)", keyname);
|
|
@@ -27108,8 +27108,8 @@ var require_compile = __commonJS({
|
|
|
27108
27108
|
const definitelyPresent = !current.parent || current.checked || current.inKeys && isJSON || queryCurrent().length > 0;
|
|
27109
27109
|
const name = buildName(current);
|
|
27110
27110
|
const currPropImm = (...args) => propimm(current, ...args);
|
|
27111
|
-
const error2 = ({ path:
|
|
27112
|
-
const schemaP = toPointer([...schemaPath, ...
|
|
27111
|
+
const error2 = ({ path: path8 = [], prop = current, source, suberr }) => {
|
|
27112
|
+
const schemaP = toPointer([...schemaPath, ...path8]);
|
|
27113
27113
|
const dataP = includeErrors ? buildPath(prop) : null;
|
|
27114
27114
|
if (includeErrors === true && errors && source) {
|
|
27115
27115
|
scope.errorMerge = functions.errorMerge;
|
|
@@ -27181,7 +27181,7 @@ var require_compile = __commonJS({
|
|
|
27181
27181
|
enforce(ruleTypes.some((t) => schemaTypes.get(t)(node[prop])), "Unexpected type for", prop);
|
|
27182
27182
|
unused.delete(prop);
|
|
27183
27183
|
};
|
|
27184
|
-
const
|
|
27184
|
+
const get3 = (prop, ...ruleTypes) => {
|
|
27185
27185
|
if (node[prop] !== void 0) consume(prop, ...ruleTypes);
|
|
27186
27186
|
return node[prop];
|
|
27187
27187
|
};
|
|
@@ -27203,7 +27203,7 @@ var require_compile = __commonJS({
|
|
|
27203
27203
|
return true;
|
|
27204
27204
|
};
|
|
27205
27205
|
if (node === root) {
|
|
27206
|
-
saveMeta(
|
|
27206
|
+
saveMeta(get3("$schema", "string"));
|
|
27207
27207
|
handle("$vocabulary", ["object"], ($vocabulary) => {
|
|
27208
27208
|
for (const [vocab, flag] of Object.entries($vocabulary)) {
|
|
27209
27209
|
if (flag === false) continue;
|
|
@@ -27220,7 +27220,7 @@ var require_compile = __commonJS({
|
|
|
27220
27220
|
for (const ignore of ["title", "description", "$comment"]) handle(ignore, ["string"], null);
|
|
27221
27221
|
for (const ignore of ["deprecated", "readOnly", "writeOnly"]) handle(ignore, ["boolean"], null);
|
|
27222
27222
|
handle("$defs", ["object"], null) || handle("definitions", ["object"], null);
|
|
27223
|
-
const compileSub = (sub, subR,
|
|
27223
|
+
const compileSub = (sub, subR, path8) => sub === schema2 ? safe("validate") : getref(sub) || compileSchema(sub, subR, opts, scope, path8);
|
|
27224
27224
|
const basePath = () => basePathStack.length > 0 ? basePathStack[basePathStack.length - 1] : "";
|
|
27225
27225
|
const basePathStackLength = basePathStack.length;
|
|
27226
27226
|
const setId = ($id) => {
|
|
@@ -27244,9 +27244,9 @@ var require_compile = __commonJS({
|
|
|
27244
27244
|
if (node !== schema2) fun.write("dynLocal.unshift({})");
|
|
27245
27245
|
for (const [key, subcheck] of allDynamic) {
|
|
27246
27246
|
const resolved = resolveReference(root, schemas, `#${key}`, basePath());
|
|
27247
|
-
const [sub, subRoot,
|
|
27247
|
+
const [sub, subRoot, path8] = resolved[0] || [];
|
|
27248
27248
|
enforce(sub === subcheck, `Unexpected $dynamicAnchor resolution: ${key}`);
|
|
27249
|
-
const n = compileSub(sub, subRoot,
|
|
27249
|
+
const n = compileSub(sub, subRoot, path8);
|
|
27250
27250
|
fun.write("dynLocal[0][%j] = %s", `#${key}`, n);
|
|
27251
27251
|
}
|
|
27252
27252
|
}
|
|
@@ -27952,12 +27952,12 @@ var require_compile = __commonJS({
|
|
|
27952
27952
|
if (local2.props) fun.write("const %s = [[], []]", local2.props);
|
|
27953
27953
|
handle("$ref", ["string"], ($ref) => {
|
|
27954
27954
|
const resolved = resolveReference(root, schemas, $ref, basePath());
|
|
27955
|
-
const [sub, subRoot,
|
|
27955
|
+
const [sub, subRoot, path8] = resolved[0] || [];
|
|
27956
27956
|
if (!sub && sub !== false) {
|
|
27957
27957
|
fail2("failed to resolve $ref:", $ref);
|
|
27958
27958
|
if (lintOnly) return null;
|
|
27959
27959
|
}
|
|
27960
|
-
const n = compileSub(sub, subRoot,
|
|
27960
|
+
const n = compileSub(sub, subRoot, path8);
|
|
27961
27961
|
const rn = sub === schema2 ? funname : n;
|
|
27962
27962
|
if (!scope[rn]) throw new Error("Unexpected: coherence check failed");
|
|
27963
27963
|
if (!scope[rn][evaluatedStatic] && sub.type) {
|
|
@@ -27983,9 +27983,9 @@ var require_compile = __commonJS({
|
|
|
27983
27983
|
if (!opts[optRecAnchors]) throw new Error("[opt] Recursive anchors are not enabled");
|
|
27984
27984
|
enforce($recursiveRef === "#", 'Behavior of $recursiveRef is defined only for "#"');
|
|
27985
27985
|
const resolved = resolveReference(root, schemas, "#", basePath());
|
|
27986
|
-
const [sub, subRoot,
|
|
27986
|
+
const [sub, subRoot, path8] = resolved[0];
|
|
27987
27987
|
laxMode(sub.$recursiveAnchor, "$recursiveRef without $recursiveAnchor");
|
|
27988
|
-
const n = compileSub(sub, subRoot,
|
|
27988
|
+
const n = compileSub(sub, subRoot, path8);
|
|
27989
27989
|
const nrec = sub.$recursiveAnchor ? format("(recursive || %s)", n) : n;
|
|
27990
27990
|
return applyRef(nrec, { path: ["$recursiveRef"] });
|
|
27991
27991
|
});
|
|
@@ -28001,10 +28001,10 @@ var require_compile = __commonJS({
|
|
|
28001
28001
|
return applyRef(nrec2, { path: ["$dynamicRef"] });
|
|
28002
28002
|
}
|
|
28003
28003
|
enforce(resolved[0], "$dynamicRef bookending resolution failed", $dynamicRef);
|
|
28004
|
-
const [sub, subRoot,
|
|
28004
|
+
const [sub, subRoot, path8] = resolved[0];
|
|
28005
28005
|
const ok2 = sub.$dynamicAnchor && `#${sub.$dynamicAnchor}` === dynamicTail;
|
|
28006
28006
|
laxMode(ok2, "$dynamicRef without $dynamicAnchor in the same scope");
|
|
28007
|
-
const n = compileSub(sub, subRoot,
|
|
28007
|
+
const n = compileSub(sub, subRoot, path8);
|
|
28008
28008
|
scope.dynamicResolve = functions.dynamicResolve;
|
|
28009
28009
|
const nrec = ok2 ? format("(dynamicResolve(dynAnchors || [], %j) || %s)", dynamicTail, n) : n;
|
|
28010
28010
|
return applyRef(nrec, { path: ["$dynamicRef"] });
|
|
@@ -28035,7 +28035,7 @@ var require_compile = __commonJS({
|
|
|
28035
28035
|
};
|
|
28036
28036
|
if (node.default !== void 0 && useDefaults) {
|
|
28037
28037
|
if (definitelyPresent) fail2("Can not apply default value here (e.g. at root)");
|
|
28038
|
-
const defvalue =
|
|
28038
|
+
const defvalue = get3("default", "jsonval");
|
|
28039
28039
|
fun.if(present(current), writeMain, () => fun.write("%s = %j", name, defvalue));
|
|
28040
28040
|
} else {
|
|
28041
28041
|
handle("default", ["jsonval"], null);
|
|
@@ -28339,59 +28339,59 @@ var require_url = __commonJS({
|
|
|
28339
28339
|
return href;
|
|
28340
28340
|
}
|
|
28341
28341
|
if (typeof process !== "undefined" && process.cwd) {
|
|
28342
|
-
const
|
|
28343
|
-
const lastChar =
|
|
28342
|
+
const path8 = process.cwd();
|
|
28343
|
+
const lastChar = path8.slice(-1);
|
|
28344
28344
|
if (lastChar === "/" || lastChar === "\\") {
|
|
28345
|
-
return
|
|
28345
|
+
return path8;
|
|
28346
28346
|
} else {
|
|
28347
|
-
return
|
|
28347
|
+
return path8 + "/";
|
|
28348
28348
|
}
|
|
28349
28349
|
}
|
|
28350
28350
|
return "/";
|
|
28351
28351
|
}
|
|
28352
|
-
function getProtocol2(
|
|
28353
|
-
const match = protocolPattern2.exec(
|
|
28352
|
+
function getProtocol2(path8) {
|
|
28353
|
+
const match = protocolPattern2.exec(path8 || "");
|
|
28354
28354
|
if (match) {
|
|
28355
28355
|
return match[1].toLowerCase();
|
|
28356
28356
|
}
|
|
28357
28357
|
return void 0;
|
|
28358
28358
|
}
|
|
28359
|
-
function getExtension2(
|
|
28360
|
-
const lastDot =
|
|
28359
|
+
function getExtension2(path8) {
|
|
28360
|
+
const lastDot = path8.lastIndexOf(".");
|
|
28361
28361
|
if (lastDot >= 0) {
|
|
28362
|
-
return stripQuery2(
|
|
28362
|
+
return stripQuery2(path8.substring(lastDot).toLowerCase());
|
|
28363
28363
|
}
|
|
28364
28364
|
return "";
|
|
28365
28365
|
}
|
|
28366
|
-
function stripQuery2(
|
|
28367
|
-
const queryIndex =
|
|
28366
|
+
function stripQuery2(path8) {
|
|
28367
|
+
const queryIndex = path8.indexOf("?");
|
|
28368
28368
|
if (queryIndex >= 0) {
|
|
28369
|
-
|
|
28369
|
+
path8 = path8.substring(0, queryIndex);
|
|
28370
28370
|
}
|
|
28371
|
-
return
|
|
28371
|
+
return path8;
|
|
28372
28372
|
}
|
|
28373
|
-
function getHash2(
|
|
28374
|
-
if (!
|
|
28373
|
+
function getHash2(path8) {
|
|
28374
|
+
if (!path8) {
|
|
28375
28375
|
return "#";
|
|
28376
28376
|
}
|
|
28377
|
-
const hashIndex =
|
|
28377
|
+
const hashIndex = path8.indexOf("#");
|
|
28378
28378
|
if (hashIndex >= 0) {
|
|
28379
|
-
return
|
|
28379
|
+
return path8.substring(hashIndex);
|
|
28380
28380
|
}
|
|
28381
28381
|
return "#";
|
|
28382
28382
|
}
|
|
28383
|
-
function stripHash2(
|
|
28384
|
-
if (!
|
|
28383
|
+
function stripHash2(path8) {
|
|
28384
|
+
if (!path8) {
|
|
28385
28385
|
return "";
|
|
28386
28386
|
}
|
|
28387
|
-
const hashIndex =
|
|
28387
|
+
const hashIndex = path8.indexOf("#");
|
|
28388
28388
|
if (hashIndex >= 0) {
|
|
28389
|
-
|
|
28389
|
+
path8 = path8.substring(0, hashIndex);
|
|
28390
28390
|
}
|
|
28391
|
-
return
|
|
28391
|
+
return path8;
|
|
28392
28392
|
}
|
|
28393
|
-
function isHttp2(
|
|
28394
|
-
const protocol = getProtocol2(
|
|
28393
|
+
function isHttp2(path8) {
|
|
28394
|
+
const protocol = getProtocol2(path8);
|
|
28395
28395
|
if (protocol === "http" || protocol === "https") {
|
|
28396
28396
|
return true;
|
|
28397
28397
|
} else if (protocol === void 0) {
|
|
@@ -28400,11 +28400,11 @@ var require_url = __commonJS({
|
|
|
28400
28400
|
return false;
|
|
28401
28401
|
}
|
|
28402
28402
|
}
|
|
28403
|
-
function isUnsafeUrl2(
|
|
28404
|
-
if (!
|
|
28403
|
+
function isUnsafeUrl2(path8) {
|
|
28404
|
+
if (!path8 || typeof path8 !== "string") {
|
|
28405
28405
|
return true;
|
|
28406
28406
|
}
|
|
28407
|
-
const normalizedPath =
|
|
28407
|
+
const normalizedPath = path8.trim().toLowerCase();
|
|
28408
28408
|
if (!normalizedPath) {
|
|
28409
28409
|
return true;
|
|
28410
28410
|
}
|
|
@@ -28535,58 +28535,58 @@ var require_url = __commonJS({
|
|
|
28535
28535
|
];
|
|
28536
28536
|
return internalPorts.includes(port);
|
|
28537
28537
|
}
|
|
28538
|
-
function isFileSystemPath2(
|
|
28538
|
+
function isFileSystemPath2(path8) {
|
|
28539
28539
|
if (typeof window !== "undefined" || typeof process !== "undefined" && process.browser) {
|
|
28540
28540
|
return false;
|
|
28541
28541
|
}
|
|
28542
|
-
const protocol = getProtocol2(
|
|
28542
|
+
const protocol = getProtocol2(path8);
|
|
28543
28543
|
return protocol === void 0 || protocol === "file";
|
|
28544
28544
|
}
|
|
28545
|
-
function fromFileSystemPath2(
|
|
28545
|
+
function fromFileSystemPath2(path8) {
|
|
28546
28546
|
if ((0, is_windows_1.isWindows)()) {
|
|
28547
28547
|
const projectDir = cwd2();
|
|
28548
|
-
const upperPath =
|
|
28548
|
+
const upperPath = path8.toUpperCase();
|
|
28549
28549
|
const projectDirPosixPath = (0, convert_path_to_posix_1.default)(projectDir);
|
|
28550
28550
|
const posixUpper = projectDirPosixPath.toUpperCase();
|
|
28551
28551
|
const hasProjectDir = upperPath.includes(posixUpper);
|
|
28552
28552
|
const hasProjectUri = upperPath.includes(posixUpper);
|
|
28553
|
-
const isAbsolutePath = path_1.win32?.isAbsolute(
|
|
28553
|
+
const isAbsolutePath = path_1.win32?.isAbsolute(path8) || path8.startsWith("http://") || path8.startsWith("https://") || path8.startsWith("file://");
|
|
28554
28554
|
if (!(hasProjectDir || hasProjectUri || isAbsolutePath) && !projectDir.startsWith("http")) {
|
|
28555
|
-
|
|
28555
|
+
path8 = (0, path_2.join)(projectDir, path8);
|
|
28556
28556
|
}
|
|
28557
|
-
|
|
28557
|
+
path8 = (0, convert_path_to_posix_1.default)(path8);
|
|
28558
28558
|
}
|
|
28559
|
-
|
|
28559
|
+
path8 = encodeURI(path8);
|
|
28560
28560
|
for (const pattern of urlEncodePatterns2) {
|
|
28561
|
-
|
|
28561
|
+
path8 = path8.replace(pattern[0], pattern[1]);
|
|
28562
28562
|
}
|
|
28563
|
-
return
|
|
28563
|
+
return path8;
|
|
28564
28564
|
}
|
|
28565
|
-
function toFileSystemPath2(
|
|
28566
|
-
|
|
28565
|
+
function toFileSystemPath2(path8, keepFileProtocol) {
|
|
28566
|
+
path8 = decodeURI(path8);
|
|
28567
28567
|
for (let i = 0; i < urlDecodePatterns2.length; i += 2) {
|
|
28568
|
-
|
|
28568
|
+
path8 = path8.replace(urlDecodePatterns2[i], urlDecodePatterns2[i + 1]);
|
|
28569
28569
|
}
|
|
28570
|
-
let isFileUrl =
|
|
28570
|
+
let isFileUrl = path8.toLowerCase().startsWith("file://");
|
|
28571
28571
|
if (isFileUrl) {
|
|
28572
|
-
|
|
28573
|
-
if ((0, is_windows_1.isWindows)() &&
|
|
28574
|
-
|
|
28572
|
+
path8 = path8.replace(/^file:\/\//, "").replace(/^\//, "");
|
|
28573
|
+
if ((0, is_windows_1.isWindows)() && path8[1] === "/") {
|
|
28574
|
+
path8 = `${path8[0]}:${path8.substring(1)}`;
|
|
28575
28575
|
}
|
|
28576
28576
|
if (keepFileProtocol) {
|
|
28577
|
-
|
|
28577
|
+
path8 = "file:///" + path8;
|
|
28578
28578
|
} else {
|
|
28579
28579
|
isFileUrl = false;
|
|
28580
|
-
|
|
28580
|
+
path8 = (0, is_windows_1.isWindows)() ? path8 : "/" + path8;
|
|
28581
28581
|
}
|
|
28582
28582
|
}
|
|
28583
28583
|
if ((0, is_windows_1.isWindows)() && !isFileUrl) {
|
|
28584
|
-
|
|
28585
|
-
if (
|
|
28586
|
-
|
|
28584
|
+
path8 = path8.replace(forwardSlashPattern2, "\\");
|
|
28585
|
+
if (path8.match(/^[a-z]:\\/i)) {
|
|
28586
|
+
path8 = path8[0].toUpperCase() + path8.substring(1);
|
|
28587
28587
|
}
|
|
28588
28588
|
}
|
|
28589
|
-
return
|
|
28589
|
+
return path8;
|
|
28590
28590
|
}
|
|
28591
28591
|
function safePointerToPath2(pointer) {
|
|
28592
28592
|
if (pointer.length <= 1 || pointer[0] !== "#" || pointer[1] !== "/") {
|
|
@@ -28734,8 +28734,8 @@ var require_errors3 = __commonJS({
|
|
|
28734
28734
|
targetRef;
|
|
28735
28735
|
targetFound;
|
|
28736
28736
|
parentPath;
|
|
28737
|
-
constructor(token,
|
|
28738
|
-
super(`Missing $ref pointer "${(0, url_js_1.getHash)(
|
|
28737
|
+
constructor(token, path8, targetRef, targetFound, parentPath) {
|
|
28738
|
+
super(`Missing $ref pointer "${(0, url_js_1.getHash)(path8)}". Token "${token}" does not exist.`, (0, url_js_1.stripHash)(path8));
|
|
28739
28739
|
this.targetToken = token;
|
|
28740
28740
|
this.targetRef = targetRef;
|
|
28741
28741
|
this.targetFound = targetFound;
|
|
@@ -28754,8 +28754,8 @@ var require_errors3 = __commonJS({
|
|
|
28754
28754
|
var InvalidPointerError2 = class extends JSONParserError2 {
|
|
28755
28755
|
code = "EUNMATCHEDRESOLVER";
|
|
28756
28756
|
name = "InvalidPointerError";
|
|
28757
|
-
constructor(pointer,
|
|
28758
|
-
super(`Invalid $ref pointer "${pointer}". Pointers must begin with "#/"`, (0, url_js_1.stripHash)(
|
|
28757
|
+
constructor(pointer, path8) {
|
|
28758
|
+
super(`Invalid $ref pointer "${pointer}". Pointers must begin with "#/"`, (0, url_js_1.stripHash)(path8));
|
|
28759
28759
|
}
|
|
28760
28760
|
};
|
|
28761
28761
|
exports2.InvalidPointerError = InvalidPointerError2;
|
|
@@ -28860,10 +28860,10 @@ var require_pointer2 = __commonJS({
|
|
|
28860
28860
|
* Resolving a single pointer may require resolving multiple $Refs.
|
|
28861
28861
|
*/
|
|
28862
28862
|
indirections;
|
|
28863
|
-
constructor($ref,
|
|
28863
|
+
constructor($ref, path8, friendlyPath) {
|
|
28864
28864
|
this.$ref = $ref;
|
|
28865
|
-
this.path =
|
|
28866
|
-
this.originalPath = friendlyPath ||
|
|
28865
|
+
this.path = path8;
|
|
28866
|
+
this.originalPath = friendlyPath || path8;
|
|
28867
28867
|
this.value = void 0;
|
|
28868
28868
|
this.circular = false;
|
|
28869
28869
|
this.indirections = 0;
|
|
@@ -28909,10 +28909,10 @@ var require_pointer2 = __commonJS({
|
|
|
28909
28909
|
continue;
|
|
28910
28910
|
}
|
|
28911
28911
|
this.value = null;
|
|
28912
|
-
const
|
|
28913
|
-
const targetRef = this.path.replace(
|
|
28912
|
+
const path8 = this.$ref.path || "";
|
|
28913
|
+
const targetRef = this.path.replace(path8, "");
|
|
28914
28914
|
const targetFound = _Pointer.join("", found);
|
|
28915
|
-
const parentPath = pathFromRoot?.replace(
|
|
28915
|
+
const parentPath = pathFromRoot?.replace(path8, "");
|
|
28916
28916
|
throw new errors_js_1.MissingPointerError(token, decodeURI(this.originalPath), targetRef, targetFound, parentPath);
|
|
28917
28917
|
} else {
|
|
28918
28918
|
this.value = this.value[token];
|
|
@@ -28968,8 +28968,8 @@ var require_pointer2 = __commonJS({
|
|
|
28968
28968
|
* @param [originalPath]
|
|
28969
28969
|
* @returns
|
|
28970
28970
|
*/
|
|
28971
|
-
static parse(
|
|
28972
|
-
const pointer = url.getHash(
|
|
28971
|
+
static parse(path8, originalPath) {
|
|
28972
|
+
const pointer = url.getHash(path8).substring(1);
|
|
28973
28973
|
if (!pointer) {
|
|
28974
28974
|
return [];
|
|
28975
28975
|
}
|
|
@@ -28978,7 +28978,7 @@ var require_pointer2 = __commonJS({
|
|
|
28978
28978
|
split[i] = safeDecodeURIComponent(split[i].replace(escapedSlash2, "/").replace(escapedTilde2, "~"));
|
|
28979
28979
|
}
|
|
28980
28980
|
if (split[0] !== "") {
|
|
28981
|
-
throw new errors_js_1.InvalidPointerError(pointer, originalPath === void 0 ?
|
|
28981
|
+
throw new errors_js_1.InvalidPointerError(pointer, originalPath === void 0 ? path8 : originalPath);
|
|
28982
28982
|
}
|
|
28983
28983
|
return split.slice(1);
|
|
28984
28984
|
}
|
|
@@ -29156,9 +29156,9 @@ var require_ref = __commonJS({
|
|
|
29156
29156
|
* @param options
|
|
29157
29157
|
* @returns
|
|
29158
29158
|
*/
|
|
29159
|
-
exists(
|
|
29159
|
+
exists(path8, options) {
|
|
29160
29160
|
try {
|
|
29161
|
-
this.resolve(
|
|
29161
|
+
this.resolve(path8, options);
|
|
29162
29162
|
return true;
|
|
29163
29163
|
} catch {
|
|
29164
29164
|
return false;
|
|
@@ -29171,8 +29171,8 @@ var require_ref = __commonJS({
|
|
|
29171
29171
|
* @param options
|
|
29172
29172
|
* @returns - Returns the resolved value
|
|
29173
29173
|
*/
|
|
29174
|
-
get(
|
|
29175
|
-
return this.resolve(
|
|
29174
|
+
get(path8, options) {
|
|
29175
|
+
return this.resolve(path8, options)?.value;
|
|
29176
29176
|
}
|
|
29177
29177
|
/**
|
|
29178
29178
|
* Resolves the given JSON reference within this {@link $Ref#value}.
|
|
@@ -29183,8 +29183,8 @@ var require_ref = __commonJS({
|
|
|
29183
29183
|
* @param pathFromRoot - The path of `obj` from the schema root
|
|
29184
29184
|
* @returns
|
|
29185
29185
|
*/
|
|
29186
|
-
resolve(
|
|
29187
|
-
const pointer = new pointer_js_1.default(this,
|
|
29186
|
+
resolve(path8, options, friendlyPath, pathFromRoot) {
|
|
29187
|
+
const pointer = new pointer_js_1.default(this, path8, friendlyPath);
|
|
29188
29188
|
try {
|
|
29189
29189
|
const resolved = pointer.resolve(this.value, options, pathFromRoot);
|
|
29190
29190
|
if (resolved.value === pointer_js_1.nullSymbol) {
|
|
@@ -29212,8 +29212,8 @@ var require_ref = __commonJS({
|
|
|
29212
29212
|
* @param path - The full path of the property to set, optionally with a JSON pointer in the hash
|
|
29213
29213
|
* @param value - The value to assign
|
|
29214
29214
|
*/
|
|
29215
|
-
set(
|
|
29216
|
-
const pointer = new pointer_js_1.default(this,
|
|
29215
|
+
set(path8, value) {
|
|
29216
|
+
const pointer = new pointer_js_1.default(this, path8);
|
|
29217
29217
|
this.value = pointer.set(this.value, value);
|
|
29218
29218
|
if (this.value === pointer_js_1.nullSymbol) {
|
|
29219
29219
|
this.value = null;
|
|
@@ -29410,8 +29410,8 @@ var require_refs = __commonJS({
|
|
|
29410
29410
|
*/
|
|
29411
29411
|
paths(...types2) {
|
|
29412
29412
|
const paths = getPaths2(this._$refs, types2.flat());
|
|
29413
|
-
return paths.map((
|
|
29414
|
-
return (0, convert_path_to_posix_1.default)(
|
|
29413
|
+
return paths.map((path8) => {
|
|
29414
|
+
return (0, convert_path_to_posix_1.default)(path8.decoded);
|
|
29415
29415
|
});
|
|
29416
29416
|
}
|
|
29417
29417
|
/**
|
|
@@ -29424,8 +29424,8 @@ var require_refs = __commonJS({
|
|
|
29424
29424
|
values(...types2) {
|
|
29425
29425
|
const $refs = this._$refs;
|
|
29426
29426
|
const paths = getPaths2($refs, types2.flat());
|
|
29427
|
-
return paths.reduce((obj,
|
|
29428
|
-
obj[(0, convert_path_to_posix_1.default)(
|
|
29427
|
+
return paths.reduce((obj, path8) => {
|
|
29428
|
+
obj[(0, convert_path_to_posix_1.default)(path8.decoded)] = $refs[path8.encoded].value;
|
|
29429
29429
|
return obj;
|
|
29430
29430
|
}, {});
|
|
29431
29431
|
}
|
|
@@ -29443,9 +29443,9 @@ var require_refs = __commonJS({
|
|
|
29443
29443
|
* @param [options]
|
|
29444
29444
|
* @returns
|
|
29445
29445
|
*/
|
|
29446
|
-
exists(
|
|
29446
|
+
exists(path8, options) {
|
|
29447
29447
|
try {
|
|
29448
|
-
this._resolve(
|
|
29448
|
+
this._resolve(path8, "", options);
|
|
29449
29449
|
return true;
|
|
29450
29450
|
} catch {
|
|
29451
29451
|
return false;
|
|
@@ -29458,8 +29458,8 @@ var require_refs = __commonJS({
|
|
|
29458
29458
|
* @param [options]
|
|
29459
29459
|
* @returns - Returns the resolved value
|
|
29460
29460
|
*/
|
|
29461
|
-
get(
|
|
29462
|
-
return this._resolve(
|
|
29461
|
+
get(path8, options) {
|
|
29462
|
+
return this._resolve(path8, "", options).value;
|
|
29463
29463
|
}
|
|
29464
29464
|
/**
|
|
29465
29465
|
* 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.
|
|
@@ -29467,12 +29467,12 @@ var require_refs = __commonJS({
|
|
|
29467
29467
|
* @param path The JSON Reference path, optionally with a JSON Pointer in the hash
|
|
29468
29468
|
* @param value The value to assign. Can be anything (object, string, number, etc.)
|
|
29469
29469
|
*/
|
|
29470
|
-
set(
|
|
29471
|
-
const absPath = url.resolve(this._root$Ref.path,
|
|
29470
|
+
set(path8, value) {
|
|
29471
|
+
const absPath = url.resolve(this._root$Ref.path, path8);
|
|
29472
29472
|
const withoutHash = url.stripHash(absPath);
|
|
29473
29473
|
const $ref = this._$refs[withoutHash];
|
|
29474
29474
|
if (!$ref) {
|
|
29475
|
-
throw new Error(`Error resolving $ref pointer "${
|
|
29475
|
+
throw new Error(`Error resolving $ref pointer "${path8}".
|
|
29476
29476
|
"${withoutHash}" not found.`);
|
|
29477
29477
|
}
|
|
29478
29478
|
$ref.set(absPath, value);
|
|
@@ -29484,9 +29484,9 @@ var require_refs = __commonJS({
|
|
|
29484
29484
|
* @returns
|
|
29485
29485
|
* @protected
|
|
29486
29486
|
*/
|
|
29487
|
-
_get$Ref(
|
|
29488
|
-
|
|
29489
|
-
const withoutHash = url.stripHash(
|
|
29487
|
+
_get$Ref(path8) {
|
|
29488
|
+
path8 = url.resolve(this._root$Ref.path, path8);
|
|
29489
|
+
const withoutHash = url.stripHash(path8);
|
|
29490
29490
|
return this._$refs[withoutHash];
|
|
29491
29491
|
}
|
|
29492
29492
|
/**
|
|
@@ -29494,8 +29494,8 @@ var require_refs = __commonJS({
|
|
|
29494
29494
|
*
|
|
29495
29495
|
* @param path - The file path or URL of the referenced file
|
|
29496
29496
|
*/
|
|
29497
|
-
_add(
|
|
29498
|
-
const withoutHash = url.stripHash(
|
|
29497
|
+
_add(path8) {
|
|
29498
|
+
const withoutHash = url.stripHash(path8);
|
|
29499
29499
|
const $ref = new ref_js_1.default(this);
|
|
29500
29500
|
$ref.path = withoutHash;
|
|
29501
29501
|
this._$refs[withoutHash] = $ref;
|
|
@@ -29511,15 +29511,15 @@ var require_refs = __commonJS({
|
|
|
29511
29511
|
* @returns
|
|
29512
29512
|
* @protected
|
|
29513
29513
|
*/
|
|
29514
|
-
_resolve(
|
|
29515
|
-
const absPath = url.resolve(this._root$Ref.path,
|
|
29514
|
+
_resolve(path8, pathFromRoot, options) {
|
|
29515
|
+
const absPath = url.resolve(this._root$Ref.path, path8);
|
|
29516
29516
|
const withoutHash = url.stripHash(absPath);
|
|
29517
29517
|
const $ref = this._$refs[withoutHash];
|
|
29518
29518
|
if (!$ref) {
|
|
29519
|
-
throw new Error(`Error resolving $ref pointer "${
|
|
29519
|
+
throw new Error(`Error resolving $ref pointer "${path8}".
|
|
29520
29520
|
"${withoutHash}" not found.`);
|
|
29521
29521
|
}
|
|
29522
|
-
return $ref.resolve(absPath, options,
|
|
29522
|
+
return $ref.resolve(absPath, options, path8, pathFromRoot);
|
|
29523
29523
|
}
|
|
29524
29524
|
/**
|
|
29525
29525
|
* A map of paths/urls to {@link $Ref} objects
|
|
@@ -29569,10 +29569,10 @@ var require_refs = __commonJS({
|
|
|
29569
29569
|
return types2.includes($refs[key].pathType);
|
|
29570
29570
|
});
|
|
29571
29571
|
}
|
|
29572
|
-
return paths.map((
|
|
29572
|
+
return paths.map((path8) => {
|
|
29573
29573
|
return {
|
|
29574
|
-
encoded:
|
|
29575
|
-
decoded: $refs[
|
|
29574
|
+
encoded: path8,
|
|
29575
|
+
decoded: $refs[path8].pathType === "file" ? url.toFileSystemPath(path8, true) : path8
|
|
29576
29576
|
};
|
|
29577
29577
|
});
|
|
29578
29578
|
}
|
|
@@ -29719,18 +29719,18 @@ var require_parse2 = __commonJS({
|
|
|
29719
29719
|
var url = __importStar(require_url());
|
|
29720
29720
|
var plugins = __importStar(require_plugins());
|
|
29721
29721
|
var errors_js_1 = require_errors3();
|
|
29722
|
-
async function parse6(
|
|
29723
|
-
const hashIndex =
|
|
29722
|
+
async function parse6(path8, $refs, options) {
|
|
29723
|
+
const hashIndex = path8.indexOf("#");
|
|
29724
29724
|
let hash = "";
|
|
29725
29725
|
if (hashIndex >= 0) {
|
|
29726
|
-
hash =
|
|
29727
|
-
|
|
29726
|
+
hash = path8.substring(hashIndex);
|
|
29727
|
+
path8 = path8.substring(0, hashIndex);
|
|
29728
29728
|
}
|
|
29729
|
-
const $ref = $refs._add(
|
|
29729
|
+
const $ref = $refs._add(path8);
|
|
29730
29730
|
const file = {
|
|
29731
|
-
url:
|
|
29731
|
+
url: path8,
|
|
29732
29732
|
hash,
|
|
29733
|
-
extension: url.getExtension(
|
|
29733
|
+
extension: url.getExtension(path8)
|
|
29734
29734
|
};
|
|
29735
29735
|
try {
|
|
29736
29736
|
const resolver = await readFile3(file, options, $refs);
|
|
@@ -32863,23 +32863,23 @@ var require_file2 = __commonJS({
|
|
|
32863
32863
|
* Reads the given file and returns its raw contents as a Buffer.
|
|
32864
32864
|
*/
|
|
32865
32865
|
async read(file) {
|
|
32866
|
-
let
|
|
32866
|
+
let path8;
|
|
32867
32867
|
try {
|
|
32868
|
-
|
|
32868
|
+
path8 = url.toFileSystemPath(file.url);
|
|
32869
32869
|
} catch (err) {
|
|
32870
32870
|
const e = err;
|
|
32871
32871
|
e.message = `Malformed URI: ${file.url}: ${e.message}`;
|
|
32872
32872
|
throw new errors_js_1.ResolverError(e, file.url);
|
|
32873
32873
|
}
|
|
32874
|
-
if (
|
|
32875
|
-
|
|
32874
|
+
if (path8.endsWith("/") || path8.endsWith("\\")) {
|
|
32875
|
+
path8 = path8.slice(0, -1);
|
|
32876
32876
|
}
|
|
32877
32877
|
try {
|
|
32878
|
-
return await fs_1.default.promises.readFile(
|
|
32878
|
+
return await fs_1.default.promises.readFile(path8);
|
|
32879
32879
|
} catch (err) {
|
|
32880
32880
|
const e = err;
|
|
32881
|
-
e.message = `Error opening file ${
|
|
32882
|
-
throw new errors_js_1.ResolverError(e,
|
|
32881
|
+
e.message = `Error opening file ${path8}: ${e.message}`;
|
|
32882
|
+
throw new errors_js_1.ResolverError(e, path8);
|
|
32883
32883
|
}
|
|
32884
32884
|
}
|
|
32885
32885
|
};
|
|
@@ -32988,7 +32988,7 @@ var require_http = __commonJS({
|
|
|
32988
32988
|
const redirects = _redirects || [];
|
|
32989
32989
|
redirects.push(u.href);
|
|
32990
32990
|
try {
|
|
32991
|
-
const res = await
|
|
32991
|
+
const res = await get3(u, httpOptions);
|
|
32992
32992
|
if (res.status >= 400) {
|
|
32993
32993
|
const error2 = new Error(`HTTP ERROR ${res.status}`);
|
|
32994
32994
|
error2.status = res.status;
|
|
@@ -33021,7 +33021,7 @@ Too many redirects:
|
|
|
33021
33021
|
throw new errors_js_1.ResolverError(e, u.href);
|
|
33022
33022
|
}
|
|
33023
33023
|
}
|
|
33024
|
-
async function
|
|
33024
|
+
async function get3(u, httpOptions) {
|
|
33025
33025
|
let controller;
|
|
33026
33026
|
let timeoutId;
|
|
33027
33027
|
if (httpOptions.timeout) {
|
|
@@ -33173,7 +33173,7 @@ var require_normalize_args = __commonJS({
|
|
|
33173
33173
|
exports2.normalizeArgs = normalizeArgs2;
|
|
33174
33174
|
var options_js_1 = require_options();
|
|
33175
33175
|
function normalizeArgs2(_args) {
|
|
33176
|
-
let
|
|
33176
|
+
let path8;
|
|
33177
33177
|
let schema2;
|
|
33178
33178
|
let options;
|
|
33179
33179
|
let callback;
|
|
@@ -33182,7 +33182,7 @@ var require_normalize_args = __commonJS({
|
|
|
33182
33182
|
callback = args.pop();
|
|
33183
33183
|
}
|
|
33184
33184
|
if (typeof args[0] === "string") {
|
|
33185
|
-
|
|
33185
|
+
path8 = args[0];
|
|
33186
33186
|
if (typeof args[2] === "object") {
|
|
33187
33187
|
schema2 = args[1];
|
|
33188
33188
|
options = args[2];
|
|
@@ -33191,7 +33191,7 @@ var require_normalize_args = __commonJS({
|
|
|
33191
33191
|
options = args[1];
|
|
33192
33192
|
}
|
|
33193
33193
|
} else {
|
|
33194
|
-
|
|
33194
|
+
path8 = "";
|
|
33195
33195
|
schema2 = args[0];
|
|
33196
33196
|
options = args[1];
|
|
33197
33197
|
}
|
|
@@ -33204,7 +33204,7 @@ var require_normalize_args = __commonJS({
|
|
|
33204
33204
|
schema2 = JSON.parse(JSON.stringify(schema2));
|
|
33205
33205
|
}
|
|
33206
33206
|
return {
|
|
33207
|
-
path:
|
|
33207
|
+
path: path8,
|
|
33208
33208
|
schema: schema2,
|
|
33209
33209
|
options,
|
|
33210
33210
|
callback
|
|
@@ -33275,26 +33275,26 @@ var require_resolve_external = __commonJS({
|
|
|
33275
33275
|
return Promise.reject(e);
|
|
33276
33276
|
}
|
|
33277
33277
|
}
|
|
33278
|
-
function crawl4(obj,
|
|
33278
|
+
function crawl4(obj, path8, $refs, options, seen, external) {
|
|
33279
33279
|
seen ||= /* @__PURE__ */ new Set();
|
|
33280
33280
|
let promises3 = [];
|
|
33281
33281
|
if (obj && typeof obj === "object" && !ArrayBuffer.isView(obj) && !seen.has(obj)) {
|
|
33282
33282
|
seen.add(obj);
|
|
33283
33283
|
if (ref_js_1.default.isExternal$Ref(obj)) {
|
|
33284
|
-
promises3.push(resolve$Ref2(obj,
|
|
33284
|
+
promises3.push(resolve$Ref2(obj, path8, $refs, options));
|
|
33285
33285
|
}
|
|
33286
33286
|
const keys = Object.keys(obj);
|
|
33287
33287
|
for (const key of keys) {
|
|
33288
|
-
const keyPath = pointer_js_1.default.join(
|
|
33288
|
+
const keyPath = pointer_js_1.default.join(path8, key);
|
|
33289
33289
|
const value = obj[key];
|
|
33290
33290
|
promises3 = promises3.concat(crawl4(value, keyPath, $refs, options, seen, external));
|
|
33291
33291
|
}
|
|
33292
33292
|
}
|
|
33293
33293
|
return promises3;
|
|
33294
33294
|
}
|
|
33295
|
-
async function resolve$Ref2($ref,
|
|
33295
|
+
async function resolve$Ref2($ref, path8, $refs, options) {
|
|
33296
33296
|
const shouldResolveOnCwd = options.dereference?.externalReferenceResolution === "root";
|
|
33297
|
-
const resolvedPath = url.resolve(shouldResolveOnCwd ? url.cwd() :
|
|
33297
|
+
const resolvedPath = url.resolve(shouldResolveOnCwd ? url.cwd() : path8, $ref.$ref);
|
|
33298
33298
|
const withoutHash = url.stripHash(resolvedPath);
|
|
33299
33299
|
const ref = $refs._$refs[withoutHash];
|
|
33300
33300
|
if (ref) {
|
|
@@ -33309,8 +33309,8 @@ var require_resolve_external = __commonJS({
|
|
|
33309
33309
|
throw err;
|
|
33310
33310
|
}
|
|
33311
33311
|
if ($refs._$refs[withoutHash]) {
|
|
33312
|
-
err.source = decodeURI(url.stripHash(
|
|
33313
|
-
err.path = url.safePointerToPath(url.getHash(
|
|
33312
|
+
err.source = decodeURI(url.stripHash(path8));
|
|
33313
|
+
err.path = url.safePointerToPath(url.getHash(path8));
|
|
33314
33314
|
}
|
|
33315
33315
|
return [];
|
|
33316
33316
|
}
|
|
@@ -33372,13 +33372,13 @@ var require_bundle = __commonJS({
|
|
|
33372
33372
|
crawl4(parser, "schema", parser.$refs._root$Ref.path + "#", "#", 0, inventory, parser.$refs, options);
|
|
33373
33373
|
remap2(inventory);
|
|
33374
33374
|
}
|
|
33375
|
-
function crawl4(parent, key,
|
|
33375
|
+
function crawl4(parent, key, path8, pathFromRoot, indirections, inventory, $refs, options) {
|
|
33376
33376
|
const obj = key === null ? parent : parent[key];
|
|
33377
33377
|
const bundleOptions = options.bundle || {};
|
|
33378
33378
|
const isExcludedPath = bundleOptions.excludedPathMatcher || (() => false);
|
|
33379
33379
|
if (obj && typeof obj === "object" && !ArrayBuffer.isView(obj) && !isExcludedPath(pathFromRoot)) {
|
|
33380
33380
|
if (ref_js_1.default.isAllowed$Ref(obj)) {
|
|
33381
|
-
inventory$Ref2(parent, key,
|
|
33381
|
+
inventory$Ref2(parent, key, path8, pathFromRoot, indirections, inventory, $refs, options);
|
|
33382
33382
|
} else {
|
|
33383
33383
|
const keys = Object.keys(obj).sort((a, b) => {
|
|
33384
33384
|
if (a === "definitions" || a === "$defs") {
|
|
@@ -33390,11 +33390,11 @@ var require_bundle = __commonJS({
|
|
|
33390
33390
|
}
|
|
33391
33391
|
});
|
|
33392
33392
|
for (const key2 of keys) {
|
|
33393
|
-
const keyPath = pointer_js_1.default.join(
|
|
33393
|
+
const keyPath = pointer_js_1.default.join(path8, key2);
|
|
33394
33394
|
const keyPathFromRoot = pointer_js_1.default.join(pathFromRoot, key2);
|
|
33395
33395
|
const value = obj[key2];
|
|
33396
33396
|
if (ref_js_1.default.isAllowed$Ref(value)) {
|
|
33397
|
-
inventory$Ref2(obj, key2,
|
|
33397
|
+
inventory$Ref2(obj, key2, path8, keyPathFromRoot, indirections, inventory, $refs, options);
|
|
33398
33398
|
} else {
|
|
33399
33399
|
crawl4(obj, key2, keyPath, keyPathFromRoot, indirections, inventory, $refs, options);
|
|
33400
33400
|
}
|
|
@@ -33407,9 +33407,9 @@ var require_bundle = __commonJS({
|
|
|
33407
33407
|
}
|
|
33408
33408
|
}
|
|
33409
33409
|
}
|
|
33410
|
-
function inventory$Ref2($refParent, $refKey,
|
|
33410
|
+
function inventory$Ref2($refParent, $refKey, path8, pathFromRoot, indirections, inventory, $refs, options) {
|
|
33411
33411
|
const $ref = $refKey === null ? $refParent : $refParent[$refKey];
|
|
33412
|
-
const $refPath = url.resolve(
|
|
33412
|
+
const $refPath = url.resolve(path8, $ref.$ref);
|
|
33413
33413
|
const pointer = $refs._resolve($refPath, pathFromRoot, options);
|
|
33414
33414
|
if (pointer === null) {
|
|
33415
33415
|
return;
|
|
@@ -33574,7 +33574,7 @@ var require_dereference = __commonJS({
|
|
|
33574
33574
|
parser.$refs.circular = dereferenced.circular;
|
|
33575
33575
|
parser.schema = dereferenced.value;
|
|
33576
33576
|
}
|
|
33577
|
-
function crawl4(obj,
|
|
33577
|
+
function crawl4(obj, path8, pathFromRoot, parents, processedObjects, dereferencedCache, $refs, options, startTime) {
|
|
33578
33578
|
let dereferenced;
|
|
33579
33579
|
const result = {
|
|
33580
33580
|
value: obj,
|
|
@@ -33588,13 +33588,13 @@ var require_dereference = __commonJS({
|
|
|
33588
33588
|
parents.add(obj);
|
|
33589
33589
|
processedObjects.add(obj);
|
|
33590
33590
|
if (ref_js_1.default.isAllowed$Ref(obj, options)) {
|
|
33591
|
-
dereferenced = dereference$Ref2(obj,
|
|
33591
|
+
dereferenced = dereference$Ref2(obj, path8, pathFromRoot, parents, processedObjects, dereferencedCache, $refs, options, startTime);
|
|
33592
33592
|
result.circular = dereferenced.circular;
|
|
33593
33593
|
result.value = dereferenced.value;
|
|
33594
33594
|
} else {
|
|
33595
33595
|
for (const key of Object.keys(obj)) {
|
|
33596
33596
|
checkDereferenceTimeout2(startTime, options);
|
|
33597
|
-
const keyPath = pointer_js_1.default.join(
|
|
33597
|
+
const keyPath = pointer_js_1.default.join(path8, key);
|
|
33598
33598
|
const keyPathFromRoot = pointer_js_1.default.join(pathFromRoot, key);
|
|
33599
33599
|
if (isExcludedPath(keyPathFromRoot)) {
|
|
33600
33600
|
continue;
|
|
@@ -33644,10 +33644,10 @@ var require_dereference = __commonJS({
|
|
|
33644
33644
|
}
|
|
33645
33645
|
return result;
|
|
33646
33646
|
}
|
|
33647
|
-
function dereference$Ref2($ref,
|
|
33647
|
+
function dereference$Ref2($ref, path8, pathFromRoot, parents, processedObjects, dereferencedCache, $refs, options, startTime) {
|
|
33648
33648
|
const isExternalRef = ref_js_1.default.isExternal$Ref($ref);
|
|
33649
33649
|
const shouldResolveOnCwd = isExternalRef && options?.dereference?.externalReferenceResolution === "root";
|
|
33650
|
-
const $refPath = url.resolve(shouldResolveOnCwd ? url.cwd() :
|
|
33650
|
+
const $refPath = url.resolve(shouldResolveOnCwd ? url.cwd() : path8, $ref.$ref);
|
|
33651
33651
|
const cache = dereferencedCache.get($refPath);
|
|
33652
33652
|
if (cache) {
|
|
33653
33653
|
if (!cache.circular) {
|
|
@@ -33675,7 +33675,7 @@ var require_dereference = __commonJS({
|
|
|
33675
33675
|
return cache;
|
|
33676
33676
|
}
|
|
33677
33677
|
}
|
|
33678
|
-
const pointer = $refs._resolve($refPath,
|
|
33678
|
+
const pointer = $refs._resolve($refPath, path8, options);
|
|
33679
33679
|
if (pointer === null) {
|
|
33680
33680
|
return {
|
|
33681
33681
|
circular: false,
|
|
@@ -33685,7 +33685,7 @@ var require_dereference = __commonJS({
|
|
|
33685
33685
|
const directCircular = pointer.circular;
|
|
33686
33686
|
let circular = directCircular || parents.has(pointer.value);
|
|
33687
33687
|
if (circular) {
|
|
33688
|
-
foundCircularReference2(
|
|
33688
|
+
foundCircularReference2(path8, $refs, options);
|
|
33689
33689
|
}
|
|
33690
33690
|
let dereferencedValue = ref_js_1.default.dereference($ref, pointer.value);
|
|
33691
33691
|
if (!circular) {
|
|
@@ -35661,13 +35661,13 @@ var require_json3 = __commonJS({
|
|
|
35661
35661
|
});
|
|
35662
35662
|
Object.defineProperty(exports2, "getDecoratedDataPath", {
|
|
35663
35663
|
enumerable: true,
|
|
35664
|
-
get: function
|
|
35664
|
+
get: function get3() {
|
|
35665
35665
|
return _getDecoratedDataPath["default"];
|
|
35666
35666
|
}
|
|
35667
35667
|
});
|
|
35668
35668
|
Object.defineProperty(exports2, "getMetaFromPath", {
|
|
35669
35669
|
enumerable: true,
|
|
35670
|
-
get: function
|
|
35670
|
+
get: function get3() {
|
|
35671
35671
|
return _getMetaFromPath["default"];
|
|
35672
35672
|
}
|
|
35673
35673
|
});
|
|
@@ -35712,7 +35712,7 @@ var require_base = __commonJS({
|
|
|
35712
35712
|
// creating an empty proxy that'll just return the arguments of any color functions we
|
|
35713
35713
|
// invoke, sans any colorization.
|
|
35714
35714
|
new Proxy({}, {
|
|
35715
|
-
get: function
|
|
35715
|
+
get: function get3() {
|
|
35716
35716
|
return function(arg) {
|
|
35717
35717
|
return arg;
|
|
35718
35718
|
};
|
|
@@ -35763,7 +35763,7 @@ var require_base = __commonJS({
|
|
|
35763
35763
|
*/
|
|
35764
35764
|
}, {
|
|
35765
35765
|
key: "instancePath",
|
|
35766
|
-
get: function
|
|
35766
|
+
get: function get3() {
|
|
35767
35767
|
return typeof this.options.instancePath !== "undefined" ? this.options.instancePath : this.options.dataPath;
|
|
35768
35768
|
}
|
|
35769
35769
|
}, {
|
|
@@ -36011,7 +36011,7 @@ var require_jsonpointer = __commonJS({
|
|
|
36011
36011
|
}
|
|
36012
36012
|
throw new Error("Invalid JSON pointer.");
|
|
36013
36013
|
}
|
|
36014
|
-
function
|
|
36014
|
+
function get3(obj, pointer) {
|
|
36015
36015
|
if (typeof obj !== "object") throw new Error("Invalid input object.");
|
|
36016
36016
|
pointer = compilePointer(pointer);
|
|
36017
36017
|
var len = pointer.length;
|
|
@@ -36032,14 +36032,14 @@ var require_jsonpointer = __commonJS({
|
|
|
36032
36032
|
var compiled = compilePointer(pointer);
|
|
36033
36033
|
return {
|
|
36034
36034
|
get: function(object) {
|
|
36035
|
-
return
|
|
36035
|
+
return get3(object, compiled);
|
|
36036
36036
|
},
|
|
36037
36037
|
set: function(object, value) {
|
|
36038
36038
|
return set2(object, compiled, value);
|
|
36039
36039
|
}
|
|
36040
36040
|
};
|
|
36041
36041
|
}
|
|
36042
|
-
exports2.get =
|
|
36042
|
+
exports2.get = get3;
|
|
36043
36043
|
exports2.set = set2;
|
|
36044
36044
|
exports2.compile = compile;
|
|
36045
36045
|
}
|
|
@@ -36526,37 +36526,37 @@ var require_validation_errors = __commonJS({
|
|
|
36526
36526
|
});
|
|
36527
36527
|
Object.defineProperty(exports2, "AdditionalPropValidationError", {
|
|
36528
36528
|
enumerable: true,
|
|
36529
|
-
get: function
|
|
36529
|
+
get: function get3() {
|
|
36530
36530
|
return _additionalProp["default"];
|
|
36531
36531
|
}
|
|
36532
36532
|
});
|
|
36533
36533
|
Object.defineProperty(exports2, "DefaultValidationError", {
|
|
36534
36534
|
enumerable: true,
|
|
36535
|
-
get: function
|
|
36535
|
+
get: function get3() {
|
|
36536
36536
|
return _default2["default"];
|
|
36537
36537
|
}
|
|
36538
36538
|
});
|
|
36539
36539
|
Object.defineProperty(exports2, "EnumValidationError", {
|
|
36540
36540
|
enumerable: true,
|
|
36541
|
-
get: function
|
|
36541
|
+
get: function get3() {
|
|
36542
36542
|
return _enum["default"];
|
|
36543
36543
|
}
|
|
36544
36544
|
});
|
|
36545
36545
|
Object.defineProperty(exports2, "PatternValidationError", {
|
|
36546
36546
|
enumerable: true,
|
|
36547
|
-
get: function
|
|
36547
|
+
get: function get3() {
|
|
36548
36548
|
return _pattern["default"];
|
|
36549
36549
|
}
|
|
36550
36550
|
});
|
|
36551
36551
|
Object.defineProperty(exports2, "RequiredValidationError", {
|
|
36552
36552
|
enumerable: true,
|
|
36553
|
-
get: function
|
|
36553
|
+
get: function get3() {
|
|
36554
36554
|
return _required["default"];
|
|
36555
36555
|
}
|
|
36556
36556
|
});
|
|
36557
36557
|
Object.defineProperty(exports2, "UnevaluatedPropValidationError", {
|
|
36558
36558
|
enumerable: true,
|
|
36559
|
-
get: function
|
|
36559
|
+
get: function get3() {
|
|
36560
36560
|
return _unevaluatedProp["default"];
|
|
36561
36561
|
}
|
|
36562
36562
|
});
|
|
@@ -36617,15 +36617,15 @@ var require_helpers = __commonJS({
|
|
|
36617
36617
|
var instancePath = typeof ajvError.instancePath !== "undefined" ? ajvError.instancePath : ajvError.dataPath;
|
|
36618
36618
|
var paths = instancePath === "" ? [""] : instancePath.match(JSON_POINTERS_REGEX);
|
|
36619
36619
|
if (paths) {
|
|
36620
|
-
paths.reduce(function(obj,
|
|
36621
|
-
obj.children[
|
|
36620
|
+
paths.reduce(function(obj, path8, i) {
|
|
36621
|
+
obj.children[path8] = obj.children[path8] || {
|
|
36622
36622
|
children: {},
|
|
36623
36623
|
errors: []
|
|
36624
36624
|
};
|
|
36625
36625
|
if (i === paths.length - 1) {
|
|
36626
|
-
obj.children[
|
|
36626
|
+
obj.children[path8].errors.push(ajvError);
|
|
36627
36627
|
}
|
|
36628
|
-
return obj.children[
|
|
36628
|
+
return obj.children[path8];
|
|
36629
36629
|
}, root);
|
|
36630
36630
|
}
|
|
36631
36631
|
});
|
|
@@ -39933,8 +39933,8 @@ var require_utils4 = __commonJS({
|
|
|
39933
39933
|
}
|
|
39934
39934
|
return ind;
|
|
39935
39935
|
}
|
|
39936
|
-
function removeDotSegments(
|
|
39937
|
-
let input =
|
|
39936
|
+
function removeDotSegments(path8) {
|
|
39937
|
+
let input = path8;
|
|
39938
39938
|
const output = [];
|
|
39939
39939
|
let nextSlash = -1;
|
|
39940
39940
|
let len = 0;
|
|
@@ -40186,8 +40186,8 @@ var require_schemes = __commonJS({
|
|
|
40186
40186
|
wsComponent.secure = void 0;
|
|
40187
40187
|
}
|
|
40188
40188
|
if (wsComponent.resourceName) {
|
|
40189
|
-
const [
|
|
40190
|
-
wsComponent.path =
|
|
40189
|
+
const [path8, query] = wsComponent.resourceName.split("?");
|
|
40190
|
+
wsComponent.path = path8 && path8 !== "/" ? path8 : void 0;
|
|
40191
40191
|
wsComponent.query = query;
|
|
40192
40192
|
wsComponent.resourceName = void 0;
|
|
40193
40193
|
}
|
|
@@ -46633,8 +46633,8 @@ function getIDToken(aud) {
|
|
|
46633
46633
|
}
|
|
46634
46634
|
|
|
46635
46635
|
// src/index.ts
|
|
46636
|
-
var
|
|
46637
|
-
var
|
|
46636
|
+
var import_node_crypto2 = require("node:crypto");
|
|
46637
|
+
var import_node_fs3 = require("node:fs");
|
|
46638
46638
|
var import_yaml3 = __toESM(require_dist(), 1);
|
|
46639
46639
|
|
|
46640
46640
|
// src/contracts.ts
|
|
@@ -46726,6 +46726,35 @@ var customerPreviewActionContract = {
|
|
|
46726
46726
|
default: "",
|
|
46727
46727
|
allowedValues: ["3.0", "3.1"]
|
|
46728
46728
|
},
|
|
46729
|
+
"breaking-change-mode": {
|
|
46730
|
+
description: "OpenAPI breaking-change comparison mode.",
|
|
46731
|
+
required: false,
|
|
46732
|
+
default: "off",
|
|
46733
|
+
allowedValues: ["off", "pr-native", "baseline-only", "previous-spec"]
|
|
46734
|
+
},
|
|
46735
|
+
"breaking-baseline-spec-path": {
|
|
46736
|
+
description: "Workspace-relative baseline OpenAPI spec path used by baseline-only mode and pr-native fallback.",
|
|
46737
|
+
required: false
|
|
46738
|
+
},
|
|
46739
|
+
"breaking-rules-path": {
|
|
46740
|
+
description: "Workspace-relative openapi-changes rules file. Missing files are ignored.",
|
|
46741
|
+
required: false,
|
|
46742
|
+
default: "changes-rules.yaml"
|
|
46743
|
+
},
|
|
46744
|
+
"breaking-target-ref": {
|
|
46745
|
+
description: "Optional target branch or git ref override for pr-native breaking-change comparisons.",
|
|
46746
|
+
required: false
|
|
46747
|
+
},
|
|
46748
|
+
"breaking-summary-path": {
|
|
46749
|
+
description: "Optional markdown report output path. Defaults to a runner-temp file.",
|
|
46750
|
+
required: false,
|
|
46751
|
+
default: ""
|
|
46752
|
+
},
|
|
46753
|
+
"breaking-log-path": {
|
|
46754
|
+
description: "Optional raw command log output path. Defaults to a runner-temp file.",
|
|
46755
|
+
required: false,
|
|
46756
|
+
default: ""
|
|
46757
|
+
},
|
|
46729
46758
|
"governance-mapping-json": {
|
|
46730
46759
|
description: "Legacy JSON map of business domain to governance group name. Prefer governance-group or the postman-governance-group repository custom property.",
|
|
46731
46760
|
required: false,
|
|
@@ -46804,6 +46833,12 @@ var customerPreviewActionContract = {
|
|
|
46804
46833
|
},
|
|
46805
46834
|
"lint-summary-json": {
|
|
46806
46835
|
description: "JSON summary of lint errors and warnings."
|
|
46836
|
+
},
|
|
46837
|
+
"breaking-change-status": {
|
|
46838
|
+
description: "OpenAPI breaking-change check status."
|
|
46839
|
+
},
|
|
46840
|
+
"breaking-change-summary-json": {
|
|
46841
|
+
description: "JSON summary of the OpenAPI breaking-change check."
|
|
46807
46842
|
}
|
|
46808
46843
|
},
|
|
46809
46844
|
retainedBehavior: [
|
|
@@ -46813,6 +46848,7 @@ var customerPreviewActionContract = {
|
|
|
46813
46848
|
"workspace admin assignment",
|
|
46814
46849
|
"spec upload to Spec Hub",
|
|
46815
46850
|
"OpenAPI operation summary normalization before upload (missing or oversized summaries)",
|
|
46851
|
+
"optional OpenAPI breaking-change detection before Postman mutations",
|
|
46816
46852
|
"spec linting by UID",
|
|
46817
46853
|
"baseline, smoke, and contract collection generation",
|
|
46818
46854
|
"collection refresh and versioning policies",
|
|
@@ -46908,10 +46944,10 @@ function sanitizeHeaders(headers, secretValues) {
|
|
|
46908
46944
|
}
|
|
46909
46945
|
|
|
46910
46946
|
// src/lib/github/github-api-client.ts
|
|
46911
|
-
function buildErrorMessage(method,
|
|
46947
|
+
function buildErrorMessage(method, path8, response, body, masker) {
|
|
46912
46948
|
const status = `${response.status}${response.statusText ? ` ${response.statusText}` : ""}`;
|
|
46913
46949
|
const sanitizedBody = masker(body || "");
|
|
46914
|
-
return sanitizedBody ? masker(`${method} ${
|
|
46950
|
+
return sanitizedBody ? masker(`${method} ${path8} failed with ${status} - ${sanitizedBody}`) : masker(`${method} ${path8} failed with ${status} - [REDACTED]`);
|
|
46915
46951
|
}
|
|
46916
46952
|
var GitHubApiClient = class {
|
|
46917
46953
|
apiBase;
|
|
@@ -46961,11 +46997,11 @@ var GitHubApiClient = class {
|
|
|
46961
46997
|
}
|
|
46962
46998
|
return ordered;
|
|
46963
46999
|
}
|
|
46964
|
-
isVariablesEndpoint(
|
|
46965
|
-
return
|
|
47000
|
+
isVariablesEndpoint(path8) {
|
|
47001
|
+
return path8.startsWith(`/repos/${this.owner}/${this.repo}/actions/variables`);
|
|
46966
47002
|
}
|
|
46967
|
-
canUseFallback(
|
|
46968
|
-
return this.isVariablesEndpoint(
|
|
47003
|
+
canUseFallback(path8) {
|
|
47004
|
+
return this.isVariablesEndpoint(path8) || path8 === `/repos/${this.owner}/${this.repo}/properties/values` || path8.includes(`/repos/${this.owner}/${this.repo}/contents`) || path8.includes("/dispatches");
|
|
46969
47005
|
}
|
|
46970
47006
|
rateLimitDelayMs(response, attempt) {
|
|
46971
47007
|
const retryAfter = Number(response.headers.get("retry-after") || "");
|
|
@@ -46983,14 +47019,14 @@ var GitHubApiClient = class {
|
|
|
46983
47019
|
const jitter = Math.floor(Math.random() * 250);
|
|
46984
47020
|
return Math.min(base + jitter, 12e4);
|
|
46985
47021
|
}
|
|
46986
|
-
async requestWithToken(
|
|
47022
|
+
async requestWithToken(path8, init, token) {
|
|
46987
47023
|
const MAX_RETRIES = 5;
|
|
46988
47024
|
const normalizedToken = String(token || "").trim();
|
|
46989
47025
|
if (!normalizedToken) {
|
|
46990
|
-
throw new Error(`Missing GitHub auth token for request ${
|
|
47026
|
+
throw new Error(`Missing GitHub auth token for request ${path8}`);
|
|
46991
47027
|
}
|
|
46992
47028
|
for (let attempt = 0; ; attempt++) {
|
|
46993
|
-
const response = await this.fetchImpl(`${this.apiBase}${
|
|
47029
|
+
const response = await this.fetchImpl(`${this.apiBase}${path8}`, {
|
|
46994
47030
|
...init,
|
|
46995
47031
|
headers: {
|
|
46996
47032
|
Accept: "application/vnd.github+json",
|
|
@@ -47013,28 +47049,28 @@ var GitHubApiClient = class {
|
|
|
47013
47049
|
return response;
|
|
47014
47050
|
}
|
|
47015
47051
|
}
|
|
47016
|
-
async request(
|
|
47052
|
+
async request(path8, init = {}) {
|
|
47017
47053
|
const orderedTokens = this.getTokenOrder();
|
|
47018
47054
|
if (orderedTokens.length === 0) {
|
|
47019
47055
|
throw new Error("No GitHub auth token configured");
|
|
47020
47056
|
}
|
|
47021
|
-
const first = await this.requestWithToken(
|
|
47022
|
-
if (orderedTokens.length < 2 || !this.canUseFallback(
|
|
47057
|
+
const first = await this.requestWithToken(path8, init, orderedTokens[0]);
|
|
47058
|
+
if (orderedTokens.length < 2 || !this.canUseFallback(path8)) {
|
|
47023
47059
|
return first;
|
|
47024
47060
|
}
|
|
47025
|
-
const isVariableGet404 = first.status === 404 && (!init.method || init.method === "GET") && this.isVariablesEndpoint(
|
|
47061
|
+
const isVariableGet404 = first.status === 404 && (!init.method || init.method === "GET") && this.isVariablesEndpoint(path8);
|
|
47026
47062
|
if (first.status !== 403 && !isVariableGet404) {
|
|
47027
47063
|
return first;
|
|
47028
47064
|
}
|
|
47029
|
-
return this.requestWithToken(
|
|
47065
|
+
return this.requestWithToken(path8, init, orderedTokens[1]);
|
|
47030
47066
|
}
|
|
47031
47067
|
async setRepositoryVariable(name, value) {
|
|
47032
47068
|
if (!value) {
|
|
47033
47069
|
throw new Error(`Repo variable ${name} is empty`);
|
|
47034
47070
|
}
|
|
47035
|
-
const
|
|
47071
|
+
const path8 = `/repos/${this.repository}/actions/variables`;
|
|
47036
47072
|
const body = JSON.stringify({ name, value: String(value) });
|
|
47037
|
-
const createResponse = await this.request(
|
|
47073
|
+
const createResponse = await this.request(path8, {
|
|
47038
47074
|
method: "POST",
|
|
47039
47075
|
body
|
|
47040
47076
|
});
|
|
@@ -47057,12 +47093,12 @@ var GitHubApiClient = class {
|
|
|
47057
47093
|
}
|
|
47058
47094
|
const text = await createResponse.text().catch(() => "");
|
|
47059
47095
|
throw new Error(
|
|
47060
|
-
buildErrorMessage("POST",
|
|
47096
|
+
buildErrorMessage("POST", path8, createResponse, text, this.secretMasker)
|
|
47061
47097
|
);
|
|
47062
47098
|
}
|
|
47063
47099
|
async getRepositoryVariable(name) {
|
|
47064
|
-
const
|
|
47065
|
-
const response = await this.request(
|
|
47100
|
+
const path8 = `/repos/${this.repository}/actions/variables/${name}`;
|
|
47101
|
+
const response = await this.request(path8, {
|
|
47066
47102
|
method: "GET"
|
|
47067
47103
|
});
|
|
47068
47104
|
if (response.status === 404) {
|
|
@@ -47071,15 +47107,15 @@ var GitHubApiClient = class {
|
|
|
47071
47107
|
if (!response.ok) {
|
|
47072
47108
|
const text = await response.text().catch(() => "");
|
|
47073
47109
|
throw new Error(
|
|
47074
|
-
buildErrorMessage("GET",
|
|
47110
|
+
buildErrorMessage("GET", path8, response, text, this.secretMasker)
|
|
47075
47111
|
);
|
|
47076
47112
|
}
|
|
47077
47113
|
const data = await response.json();
|
|
47078
47114
|
return String(data.value || "");
|
|
47079
47115
|
}
|
|
47080
47116
|
async getRepositoryCustomProperty(name) {
|
|
47081
|
-
const
|
|
47082
|
-
const response = await this.request(
|
|
47117
|
+
const path8 = `/repos/${this.repository}/properties/values`;
|
|
47118
|
+
const response = await this.request(path8, {
|
|
47083
47119
|
method: "GET"
|
|
47084
47120
|
});
|
|
47085
47121
|
if (response.status === 404) {
|
|
@@ -47088,7 +47124,7 @@ var GitHubApiClient = class {
|
|
|
47088
47124
|
if (!response.ok) {
|
|
47089
47125
|
const text = await response.text().catch(() => "");
|
|
47090
47126
|
throw new Error(
|
|
47091
|
-
buildErrorMessage("GET",
|
|
47127
|
+
buildErrorMessage("GET", path8, response, text, this.secretMasker)
|
|
47092
47128
|
);
|
|
47093
47129
|
}
|
|
47094
47130
|
const values = await response.json();
|
|
@@ -47170,6 +47206,593 @@ var HttpError = class _HttpError extends Error {
|
|
|
47170
47206
|
}
|
|
47171
47207
|
};
|
|
47172
47208
|
|
|
47209
|
+
// src/lib/openapi-changes.ts
|
|
47210
|
+
var import_node_crypto = require("node:crypto");
|
|
47211
|
+
var import_node_fs = require("node:fs");
|
|
47212
|
+
var import_promises = require("node:fs/promises");
|
|
47213
|
+
var import_node_https = require("node:https");
|
|
47214
|
+
var import_node_os = __toESM(require("node:os"), 1);
|
|
47215
|
+
var import_node_path = __toESM(require("node:path"), 1);
|
|
47216
|
+
var TOOL_NAME = "openapi-changes";
|
|
47217
|
+
var OPENAPI_CHANGES_VERSION = "0.2.7";
|
|
47218
|
+
var RELEASE_BASE_URL = `https://github.com/pb33f/openapi-changes/releases/download/v${OPENAPI_CHANGES_VERSION}`;
|
|
47219
|
+
var CHECKSUMS = {
|
|
47220
|
+
"0.2.7": {
|
|
47221
|
+
"openapi-changes_0.2.7_darwin_arm64.tar.gz": "03e65e0d16c51fb8d43a93318409027bd9cd7c7c3355061d23c084c1ac9c0f7b",
|
|
47222
|
+
"openapi-changes_0.2.7_darwin_x86_64.tar.gz": "c064dab16fac342926126d060efd157ff283e18548ccf6081a7a71a8d3c5bc04",
|
|
47223
|
+
"openapi-changes_0.2.7_linux_arm64.tar.gz": "698b29336699fd4ec61e52585f140a6450d112c1eb1c637bbe34c13b4203fecc",
|
|
47224
|
+
"openapi-changes_0.2.7_linux_i386.tar.gz": "bb95699989ef67d0fd9d8644e56b1e183dea4dc439e59d051fe6964b87636f8c",
|
|
47225
|
+
"openapi-changes_0.2.7_linux_x86_64.tar.gz": "333742ea369c90437fbda47a814cf2393cb65eaa3867268a4c86281e74f614bf",
|
|
47226
|
+
"openapi-changes_0.2.7_windows_arm64.tar.gz": "3dfc29f88fb4332a3bf2d6d45fb9ab02ef907e7bc45fb8e8630ad943c4b9d814",
|
|
47227
|
+
"openapi-changes_0.2.7_windows_i386.tar.gz": "78e868e15d0e15f358f7f350af3c9532f6720a140bbb9241dbb947d49c6ec20c",
|
|
47228
|
+
"openapi-changes_0.2.7_windows_x86_64.tar.gz": "fff5a68713b9093ad8ab547d214b5a3b9139ad71e90ee9e1347b3f9bd6e1e191"
|
|
47229
|
+
}
|
|
47230
|
+
};
|
|
47231
|
+
function firstValue(...values) {
|
|
47232
|
+
return values.find((value) => String(value ?? "").trim())?.trim();
|
|
47233
|
+
}
|
|
47234
|
+
function getWorkspaceRoot(env = process.env) {
|
|
47235
|
+
return (0, import_node_fs.realpathSync)(import_node_path.default.resolve(env.GITHUB_WORKSPACE || process.cwd()));
|
|
47236
|
+
}
|
|
47237
|
+
function getTempRoot(env = process.env) {
|
|
47238
|
+
return (0, import_node_fs.realpathSync)(import_node_path.default.resolve(env.RUNNER_TEMP || import_node_os.default.tmpdir()));
|
|
47239
|
+
}
|
|
47240
|
+
function ensureInsideRoot(root, candidate, message) {
|
|
47241
|
+
const relative2 = import_node_path.default.relative(root, candidate);
|
|
47242
|
+
if (relative2.startsWith("..") || import_node_path.default.isAbsolute(relative2)) {
|
|
47243
|
+
throw new Error(message);
|
|
47244
|
+
}
|
|
47245
|
+
}
|
|
47246
|
+
function nearestExistingPath(candidate) {
|
|
47247
|
+
let current = candidate;
|
|
47248
|
+
while (!(0, import_node_fs.existsSync)(current)) {
|
|
47249
|
+
const parent = import_node_path.default.dirname(current);
|
|
47250
|
+
if (parent === current) {
|
|
47251
|
+
return current;
|
|
47252
|
+
}
|
|
47253
|
+
current = parent;
|
|
47254
|
+
}
|
|
47255
|
+
return current;
|
|
47256
|
+
}
|
|
47257
|
+
function isInsideAnyRoot(roots, candidate) {
|
|
47258
|
+
return roots.some((root) => {
|
|
47259
|
+
const relative2 = import_node_path.default.relative(root, candidate);
|
|
47260
|
+
return !relative2.startsWith("..") && !import_node_path.default.isAbsolute(relative2);
|
|
47261
|
+
});
|
|
47262
|
+
}
|
|
47263
|
+
function assertOutputFileAllowed(filePath, workspaceRoot, tempRoot) {
|
|
47264
|
+
const workspaceRealPath = (0, import_node_fs.realpathSync)(workspaceRoot);
|
|
47265
|
+
const tempRealPath = (0, import_node_fs.realpathSync)(tempRoot);
|
|
47266
|
+
const resolved = import_node_path.default.resolve(filePath);
|
|
47267
|
+
const existingPath = nearestExistingPath(resolved);
|
|
47268
|
+
const existingRealPath = (0, import_node_fs.realpathSync)(existingPath);
|
|
47269
|
+
if (!isInsideAnyRoot([workspaceRealPath, tempRealPath], existingRealPath)) {
|
|
47270
|
+
throw new Error("Breaking-change output path must stay within the workspace or runner temp directory");
|
|
47271
|
+
}
|
|
47272
|
+
return resolved;
|
|
47273
|
+
}
|
|
47274
|
+
function resolveConfiguredOutputPath(configuredPath, defaultFileName, workspaceRoot, tempRoot) {
|
|
47275
|
+
const defaultPath = import_node_path.default.join(tempRoot, "postman-bootstrap", defaultFileName);
|
|
47276
|
+
if (!configuredPath) {
|
|
47277
|
+
return defaultPath;
|
|
47278
|
+
}
|
|
47279
|
+
const resolved = import_node_path.default.isAbsolute(configuredPath) ? configuredPath : import_node_path.default.join(workspaceRoot, configuredPath);
|
|
47280
|
+
return assertOutputFileAllowed(resolved, workspaceRoot, tempRoot);
|
|
47281
|
+
}
|
|
47282
|
+
function resolveWorkspaceFilePath(configuredPath, workspaceRoot) {
|
|
47283
|
+
if (!configuredPath) {
|
|
47284
|
+
return void 0;
|
|
47285
|
+
}
|
|
47286
|
+
const workspaceRealPath = (0, import_node_fs.realpathSync)(workspaceRoot);
|
|
47287
|
+
const resolved = import_node_path.default.isAbsolute(configuredPath) ? import_node_path.default.resolve(configuredPath) : import_node_path.default.resolve(workspaceRoot, configuredPath);
|
|
47288
|
+
ensureInsideRoot(workspaceRealPath, resolved, "Breaking-change input path must stay within the workspace");
|
|
47289
|
+
if (!(0, import_node_fs.existsSync)(resolved)) {
|
|
47290
|
+
return void 0;
|
|
47291
|
+
}
|
|
47292
|
+
const realResolved = (0, import_node_fs.realpathSync)(resolved);
|
|
47293
|
+
ensureInsideRoot(
|
|
47294
|
+
workspaceRealPath,
|
|
47295
|
+
realResolved,
|
|
47296
|
+
"Breaking-change input path must stay within the workspace"
|
|
47297
|
+
);
|
|
47298
|
+
return realResolved;
|
|
47299
|
+
}
|
|
47300
|
+
function workspaceRelativePath(filePath, workspaceRoot) {
|
|
47301
|
+
const resolved = import_node_path.default.isAbsolute(filePath) ? import_node_path.default.resolve(filePath) : import_node_path.default.resolve(workspaceRoot, filePath);
|
|
47302
|
+
const realResolved = (0, import_node_fs.existsSync)(resolved) ? (0, import_node_fs.realpathSync)(resolved) : resolved;
|
|
47303
|
+
ensureInsideRoot(workspaceRoot, realResolved, "spec-path must stay within the workspace");
|
|
47304
|
+
const relative2 = import_node_path.default.relative(workspaceRoot, realResolved);
|
|
47305
|
+
return relative2.split(import_node_path.default.sep).join("/");
|
|
47306
|
+
}
|
|
47307
|
+
function normalizeBranch(value) {
|
|
47308
|
+
let branchName = String(value || "main").trim();
|
|
47309
|
+
branchName = branchName.replace(/^refs\/remotes\/origin\//, "").replace(/^refs\/heads\//, "").replace(/^origin\//, "");
|
|
47310
|
+
if (!branchName) {
|
|
47311
|
+
branchName = "main";
|
|
47312
|
+
}
|
|
47313
|
+
if (!/^[A-Za-z0-9._/-]+$/.test(branchName)) {
|
|
47314
|
+
throw new Error(`Unsupported target branch name: ${branchName}`);
|
|
47315
|
+
}
|
|
47316
|
+
return branchName;
|
|
47317
|
+
}
|
|
47318
|
+
async function gitObjectExists(dependencies, refSpec, cwd2) {
|
|
47319
|
+
const result = await dependencies.exec.getExecOutput("git", ["cat-file", "-e", refSpec], {
|
|
47320
|
+
cwd: cwd2,
|
|
47321
|
+
ignoreReturnCode: true
|
|
47322
|
+
});
|
|
47323
|
+
return result.exitCode === 0;
|
|
47324
|
+
}
|
|
47325
|
+
function targetBranchCandidates(configuredTargetRef, env) {
|
|
47326
|
+
const targetBranch = normalizeBranch(firstValue(
|
|
47327
|
+
configuredTargetRef,
|
|
47328
|
+
env.GITHUB_BASE_REF,
|
|
47329
|
+
env.CHANGE_TARGET,
|
|
47330
|
+
env.BITBUCKET_TARGET_BRANCH,
|
|
47331
|
+
env.CI_MERGE_REQUEST_TARGET_BRANCH_NAME,
|
|
47332
|
+
env.SYSTEM_PULLREQUEST_TARGETBRANCH,
|
|
47333
|
+
"main"
|
|
47334
|
+
));
|
|
47335
|
+
return Array.from(/* @__PURE__ */ new Set([`origin/${targetBranch}`, targetBranch]));
|
|
47336
|
+
}
|
|
47337
|
+
async function writeTempSpecFile(tempRoot, name, content) {
|
|
47338
|
+
const tempDir = import_node_path.default.join(tempRoot, "postman-bootstrap", `openapi-changes-${process.pid}-${Date.now()}`);
|
|
47339
|
+
await (0, import_promises.mkdir)(tempDir, { recursive: true });
|
|
47340
|
+
const filePath = import_node_path.default.join(tempDir, name);
|
|
47341
|
+
await (0, import_promises.writeFile)(filePath, content, "utf8");
|
|
47342
|
+
return filePath;
|
|
47343
|
+
}
|
|
47344
|
+
async function removeTempSpecFile(filePath) {
|
|
47345
|
+
const parent = import_node_path.default.dirname(filePath);
|
|
47346
|
+
if (parent.includes(`${import_node_path.default.sep}openapi-changes-`)) {
|
|
47347
|
+
await (0, import_promises.rm)(parent, { recursive: true, force: true });
|
|
47348
|
+
}
|
|
47349
|
+
}
|
|
47350
|
+
async function resolveComparisonSource(inputs, dependencies, workspaceRoot, tempRoot) {
|
|
47351
|
+
if (inputs.mode === "previous-spec") {
|
|
47352
|
+
if (!inputs.previousSpecContent) {
|
|
47353
|
+
return {
|
|
47354
|
+
skipped: true,
|
|
47355
|
+
reason: "No existing Spec Hub content was available for comparison."
|
|
47356
|
+
};
|
|
47357
|
+
}
|
|
47358
|
+
const previous = await writeTempSpecFile(tempRoot, "previous-openapi.json", inputs.previousSpecContent);
|
|
47359
|
+
const current = await writeTempSpecFile(tempRoot, "current-openapi.json", inputs.currentUploadContent);
|
|
47360
|
+
return {
|
|
47361
|
+
current,
|
|
47362
|
+
label: "Spec Hub previous version -> incoming spec",
|
|
47363
|
+
previous,
|
|
47364
|
+
tempFiles: [previous, current]
|
|
47365
|
+
};
|
|
47366
|
+
}
|
|
47367
|
+
const currentPath = inputs.specPath ? resolveWorkspaceFilePath(inputs.specPath, workspaceRoot) : void 0;
|
|
47368
|
+
if (inputs.mode === "pr-native" && inputs.specPath && currentPath) {
|
|
47369
|
+
const gitSpecPath = workspaceRelativePath(inputs.specPath, workspaceRoot);
|
|
47370
|
+
for (const targetRef of targetBranchCandidates(inputs.targetRef, dependencies.env ?? process.env)) {
|
|
47371
|
+
const targetRefSpec = `${targetRef}:${gitSpecPath}`;
|
|
47372
|
+
if (await gitObjectExists(dependencies, targetRefSpec, workspaceRoot)) {
|
|
47373
|
+
return {
|
|
47374
|
+
current: gitSpecPath,
|
|
47375
|
+
label: `${targetRefSpec} -> ${gitSpecPath}`,
|
|
47376
|
+
previous: targetRefSpec,
|
|
47377
|
+
tempFiles: []
|
|
47378
|
+
};
|
|
47379
|
+
}
|
|
47380
|
+
}
|
|
47381
|
+
}
|
|
47382
|
+
const baselinePath = resolveWorkspaceFilePath(inputs.baselineSpecPath, workspaceRoot);
|
|
47383
|
+
if (baselinePath) {
|
|
47384
|
+
const current = currentPath ?? await writeTempSpecFile(
|
|
47385
|
+
tempRoot,
|
|
47386
|
+
"current-openapi.json",
|
|
47387
|
+
inputs.currentUploadContent
|
|
47388
|
+
);
|
|
47389
|
+
return {
|
|
47390
|
+
current,
|
|
47391
|
+
label: `${inputs.baselineSpecPath} -> ${inputs.specPath || "incoming spec"}`,
|
|
47392
|
+
previous: baselinePath,
|
|
47393
|
+
tempFiles: currentPath ? [] : [current]
|
|
47394
|
+
};
|
|
47395
|
+
}
|
|
47396
|
+
return {
|
|
47397
|
+
skipped: true,
|
|
47398
|
+
reason: inputs.mode === "baseline-only" ? `No baseline spec found at ${inputs.baselineSpecPath || "(empty)"}.` : "No target-branch spec or baseline spec was available for comparison."
|
|
47399
|
+
};
|
|
47400
|
+
}
|
|
47401
|
+
var ANSI_ESCAPE_PATTERN = new RegExp(String.raw`\u001B\[[0-?]*[ -/]*[@-~]`, "g");
|
|
47402
|
+
function stripAnsi(value) {
|
|
47403
|
+
return String(value || "").replace(ANSI_ESCAPE_PATTERN, "");
|
|
47404
|
+
}
|
|
47405
|
+
function sanitizeOpenApiChangesSummary(value) {
|
|
47406
|
+
return String(value || "").split(/\r?\n/).filter((line) => {
|
|
47407
|
+
const normalized = line.trim().replace(/\*\*/g, "");
|
|
47408
|
+
return !/^Date:\s.*\|\s*Commit:\s*Original:\s.*,\s*Modified:\s.*$/.test(normalized);
|
|
47409
|
+
}).join("\n").trim();
|
|
47410
|
+
}
|
|
47411
|
+
function breakingChangeCount(value) {
|
|
47412
|
+
if (Array.isArray(value)) {
|
|
47413
|
+
return value.reduce((total2, entry) => total2 + breakingChangeCount(entry), 0);
|
|
47414
|
+
}
|
|
47415
|
+
if (!value || typeof value !== "object") {
|
|
47416
|
+
return 0;
|
|
47417
|
+
}
|
|
47418
|
+
let total = 0;
|
|
47419
|
+
for (const [key, entry] of Object.entries(value)) {
|
|
47420
|
+
const normalizedKey = key.toLowerCase().replace(/[^a-z]/g, "");
|
|
47421
|
+
if (entry === true && ["breaking", "breakingchange", "isbreaking", "isbreakingchange"].includes(normalizedKey)) {
|
|
47422
|
+
total += 1;
|
|
47423
|
+
continue;
|
|
47424
|
+
}
|
|
47425
|
+
total += breakingChangeCount(entry);
|
|
47426
|
+
}
|
|
47427
|
+
return total;
|
|
47428
|
+
}
|
|
47429
|
+
function formatReport(options) {
|
|
47430
|
+
const lines = [
|
|
47431
|
+
"# OpenAPI Breaking Change Check",
|
|
47432
|
+
"",
|
|
47433
|
+
`Status: ${options.status}`
|
|
47434
|
+
];
|
|
47435
|
+
if (options.comparison) {
|
|
47436
|
+
lines.push(`Comparison: ${options.comparison}`);
|
|
47437
|
+
}
|
|
47438
|
+
if (options.message) {
|
|
47439
|
+
lines.push("", options.message);
|
|
47440
|
+
}
|
|
47441
|
+
if (options.body?.trim()) {
|
|
47442
|
+
lines.push("", options.body.trim());
|
|
47443
|
+
}
|
|
47444
|
+
return `${lines.join("\n")}
|
|
47445
|
+
`;
|
|
47446
|
+
}
|
|
47447
|
+
async function writeReportFiles(summaryPath, logPath, report, log, env) {
|
|
47448
|
+
await (0, import_promises.mkdir)(import_node_path.default.dirname(summaryPath), { recursive: true });
|
|
47449
|
+
await (0, import_promises.mkdir)(import_node_path.default.dirname(logPath), { recursive: true });
|
|
47450
|
+
await (0, import_promises.writeFile)(summaryPath, report, "utf8");
|
|
47451
|
+
await (0, import_promises.writeFile)(logPath, log, "utf8");
|
|
47452
|
+
if (env.GITHUB_STEP_SUMMARY) {
|
|
47453
|
+
await (0, import_promises.appendFile)(env.GITHUB_STEP_SUMMARY, `
|
|
47454
|
+
${report}
|
|
47455
|
+
`, "utf8");
|
|
47456
|
+
}
|
|
47457
|
+
}
|
|
47458
|
+
function buildResultJson(result) {
|
|
47459
|
+
return JSON.stringify({
|
|
47460
|
+
breakingChanges: result.breakingChanges,
|
|
47461
|
+
comparison: result.comparison,
|
|
47462
|
+
exitCode: result.exitCode,
|
|
47463
|
+
logPath: result.logPath,
|
|
47464
|
+
message: result.message,
|
|
47465
|
+
mode: result.mode,
|
|
47466
|
+
status: result.status,
|
|
47467
|
+
summaryPath: result.summaryPath
|
|
47468
|
+
});
|
|
47469
|
+
}
|
|
47470
|
+
function createBreakingChangeSummaryJson(result) {
|
|
47471
|
+
return buildResultJson(result);
|
|
47472
|
+
}
|
|
47473
|
+
function mapPlatform() {
|
|
47474
|
+
const platforms = {
|
|
47475
|
+
aix: void 0,
|
|
47476
|
+
android: void 0,
|
|
47477
|
+
darwin: "darwin",
|
|
47478
|
+
freebsd: void 0,
|
|
47479
|
+
haiku: void 0,
|
|
47480
|
+
linux: "linux",
|
|
47481
|
+
openbsd: void 0,
|
|
47482
|
+
sunos: void 0,
|
|
47483
|
+
win32: "windows",
|
|
47484
|
+
cygwin: void 0,
|
|
47485
|
+
netbsd: void 0
|
|
47486
|
+
};
|
|
47487
|
+
const platform2 = platforms[process.platform];
|
|
47488
|
+
if (!platform2) {
|
|
47489
|
+
throw new Error(`Unsupported openapi-changes platform: ${process.platform}`);
|
|
47490
|
+
}
|
|
47491
|
+
return platform2;
|
|
47492
|
+
}
|
|
47493
|
+
function mapArch() {
|
|
47494
|
+
const architectures = {
|
|
47495
|
+
arm: void 0,
|
|
47496
|
+
arm64: "arm64",
|
|
47497
|
+
ia32: "i386",
|
|
47498
|
+
loong64: void 0,
|
|
47499
|
+
mips: void 0,
|
|
47500
|
+
mipsel: void 0,
|
|
47501
|
+
ppc: void 0,
|
|
47502
|
+
ppc64: void 0,
|
|
47503
|
+
riscv64: void 0,
|
|
47504
|
+
s390: void 0,
|
|
47505
|
+
s390x: void 0,
|
|
47506
|
+
x64: "x86_64"
|
|
47507
|
+
};
|
|
47508
|
+
const arch2 = architectures[process.arch];
|
|
47509
|
+
if (!arch2) {
|
|
47510
|
+
throw new Error(`Unsupported openapi-changes architecture: ${process.arch}`);
|
|
47511
|
+
}
|
|
47512
|
+
return arch2;
|
|
47513
|
+
}
|
|
47514
|
+
function sha256(filePath) {
|
|
47515
|
+
return (0, import_node_crypto.createHash)("sha256").update((0, import_node_fs.readFileSync)(filePath)).digest("hex");
|
|
47516
|
+
}
|
|
47517
|
+
function validatePinnedOpenApiChangesChecksums() {
|
|
47518
|
+
for (const [version, checksums] of Object.entries(CHECKSUMS)) {
|
|
47519
|
+
for (const [assetName, checksum] of Object.entries(checksums)) {
|
|
47520
|
+
if (!/^[a-f0-9]{64}$/.test(checksum)) {
|
|
47521
|
+
throw new Error(
|
|
47522
|
+
`Pinned checksum for ${assetName} in openapi-changes ${version} must be a 64-character lowercase SHA-256 hex digest`
|
|
47523
|
+
);
|
|
47524
|
+
}
|
|
47525
|
+
}
|
|
47526
|
+
}
|
|
47527
|
+
}
|
|
47528
|
+
function downloadFile(url, destination, redirectsRemaining = 5) {
|
|
47529
|
+
return new Promise((resolve4, reject) => {
|
|
47530
|
+
(0, import_node_https.get)(url, (response) => {
|
|
47531
|
+
const statusCode = response.statusCode || 0;
|
|
47532
|
+
const location2 = response.headers.location;
|
|
47533
|
+
if ([301, 302, 303, 307, 308].includes(statusCode) && location2) {
|
|
47534
|
+
response.resume();
|
|
47535
|
+
if (redirectsRemaining <= 0) {
|
|
47536
|
+
reject(new Error(`Too many redirects while downloading ${url}`));
|
|
47537
|
+
return;
|
|
47538
|
+
}
|
|
47539
|
+
const redirectedUrl = new URL(location2, url);
|
|
47540
|
+
if (redirectedUrl.protocol !== "https:") {
|
|
47541
|
+
reject(new Error(`Refusing non-HTTPS redirect for ${url}`));
|
|
47542
|
+
return;
|
|
47543
|
+
}
|
|
47544
|
+
downloadFile(redirectedUrl.toString(), destination, redirectsRemaining - 1).then(resolve4, reject);
|
|
47545
|
+
return;
|
|
47546
|
+
}
|
|
47547
|
+
if (statusCode < 200 || statusCode >= 300) {
|
|
47548
|
+
response.resume();
|
|
47549
|
+
reject(new Error(`Download failed for ${url}: HTTP ${statusCode}`));
|
|
47550
|
+
return;
|
|
47551
|
+
}
|
|
47552
|
+
const output = (0, import_node_fs.createWriteStream)(destination, { flags: "w" });
|
|
47553
|
+
response.pipe(output);
|
|
47554
|
+
output.on("finish", () => output.close(() => resolve4()));
|
|
47555
|
+
output.on("error", reject);
|
|
47556
|
+
}).on("error", reject);
|
|
47557
|
+
});
|
|
47558
|
+
}
|
|
47559
|
+
async function assertBinaryWorks(binaryPath, dependencies) {
|
|
47560
|
+
const result = await dependencies.exec.getExecOutput(binaryPath, ["version"], {
|
|
47561
|
+
ignoreReturnCode: true,
|
|
47562
|
+
silent: true
|
|
47563
|
+
});
|
|
47564
|
+
const installedVersion = result.stdout.trim();
|
|
47565
|
+
if (result.exitCode !== 0 || installedVersion !== OPENAPI_CHANGES_VERSION) {
|
|
47566
|
+
throw new Error(
|
|
47567
|
+
`Expected ${TOOL_NAME} ${OPENAPI_CHANGES_VERSION}, found ${installedVersion || "(unknown)"}.`
|
|
47568
|
+
);
|
|
47569
|
+
}
|
|
47570
|
+
}
|
|
47571
|
+
async function assertSafeTarEntries(archivePath, dependencies) {
|
|
47572
|
+
const listing = await dependencies.exec.getExecOutput("tar", ["-tzf", archivePath], {
|
|
47573
|
+
ignoreReturnCode: true,
|
|
47574
|
+
silent: true
|
|
47575
|
+
});
|
|
47576
|
+
if (listing.exitCode !== 0) {
|
|
47577
|
+
throw new Error(`Could not inspect ${TOOL_NAME} archive: ${listing.stderr}`);
|
|
47578
|
+
}
|
|
47579
|
+
for (const rawEntry of listing.stdout.split(/\r?\n/)) {
|
|
47580
|
+
const entry = rawEntry.trim();
|
|
47581
|
+
if (!entry) {
|
|
47582
|
+
continue;
|
|
47583
|
+
}
|
|
47584
|
+
if (entry.startsWith("/") || entry.startsWith("\\") || entry.includes("..")) {
|
|
47585
|
+
throw new Error(`Refusing unsafe archive entry: ${entry}`);
|
|
47586
|
+
}
|
|
47587
|
+
}
|
|
47588
|
+
}
|
|
47589
|
+
function findBinary(searchRoot, binaryName) {
|
|
47590
|
+
const entries = (0, import_node_fs.readdirSync)(searchRoot, { withFileTypes: true });
|
|
47591
|
+
for (const entry of entries) {
|
|
47592
|
+
const entryPath = import_node_path.default.join(searchRoot, entry.name);
|
|
47593
|
+
if (entry.isDirectory()) {
|
|
47594
|
+
const nested = findBinary(entryPath, binaryName);
|
|
47595
|
+
if (nested) {
|
|
47596
|
+
return nested;
|
|
47597
|
+
}
|
|
47598
|
+
} else if (entry.name === binaryName || entry.name === TOOL_NAME) {
|
|
47599
|
+
return entryPath;
|
|
47600
|
+
}
|
|
47601
|
+
}
|
|
47602
|
+
return "";
|
|
47603
|
+
}
|
|
47604
|
+
async function installOpenApiChanges(dependencies) {
|
|
47605
|
+
validatePinnedOpenApiChangesChecksums();
|
|
47606
|
+
const env = dependencies.env ?? process.env;
|
|
47607
|
+
const tempRoot = getTempRoot(env);
|
|
47608
|
+
const platform2 = mapPlatform();
|
|
47609
|
+
const arch2 = mapArch();
|
|
47610
|
+
const binaryName = process.platform === "win32" ? `${TOOL_NAME}.exe` : TOOL_NAME;
|
|
47611
|
+
const toolRoot = import_node_path.default.join(tempRoot, "postman-bootstrap-tools", TOOL_NAME, OPENAPI_CHANGES_VERSION, `${platform2}-${arch2}`);
|
|
47612
|
+
const binDir = import_node_path.default.join(toolRoot, "bin");
|
|
47613
|
+
const downloadsDir = import_node_path.default.join(toolRoot, "downloads");
|
|
47614
|
+
const extractDir = import_node_path.default.join(toolRoot, `extract-${Date.now()}`);
|
|
47615
|
+
const binaryPath = import_node_path.default.join(binDir, binaryName);
|
|
47616
|
+
if ((0, import_node_fs.existsSync)(binaryPath)) {
|
|
47617
|
+
try {
|
|
47618
|
+
await assertBinaryWorks(binaryPath, dependencies);
|
|
47619
|
+
dependencies.core.info(`${TOOL_NAME} ${OPENAPI_CHANGES_VERSION} already installed at ${binaryPath}`);
|
|
47620
|
+
return binaryPath;
|
|
47621
|
+
} catch (error2) {
|
|
47622
|
+
dependencies.core.warning(
|
|
47623
|
+
`Reinstalling ${TOOL_NAME}: ${error2 instanceof Error ? error2.message : String(error2)}`
|
|
47624
|
+
);
|
|
47625
|
+
(0, import_node_fs.rmSync)(binaryPath, { force: true });
|
|
47626
|
+
}
|
|
47627
|
+
}
|
|
47628
|
+
const assetName = `${TOOL_NAME}_${OPENAPI_CHANGES_VERSION}_${platform2}_${arch2}.tar.gz`;
|
|
47629
|
+
const expectedChecksum = CHECKSUMS[OPENAPI_CHANGES_VERSION]?.[assetName];
|
|
47630
|
+
if (!expectedChecksum) {
|
|
47631
|
+
throw new Error(`No pinned checksum is configured for ${assetName}.`);
|
|
47632
|
+
}
|
|
47633
|
+
(0, import_node_fs.mkdirSync)(binDir, { recursive: true });
|
|
47634
|
+
(0, import_node_fs.mkdirSync)(downloadsDir, { recursive: true });
|
|
47635
|
+
(0, import_node_fs.mkdirSync)(extractDir, { recursive: true });
|
|
47636
|
+
const archivePath = import_node_path.default.join(downloadsDir, assetName);
|
|
47637
|
+
await downloadFile(`${RELEASE_BASE_URL}/${assetName}`, archivePath);
|
|
47638
|
+
const actualChecksum = sha256(archivePath);
|
|
47639
|
+
if (actualChecksum !== expectedChecksum) {
|
|
47640
|
+
throw new Error(`Checksum mismatch for ${assetName}: expected ${expectedChecksum}, got ${actualChecksum}`);
|
|
47641
|
+
}
|
|
47642
|
+
await assertSafeTarEntries(archivePath, dependencies);
|
|
47643
|
+
await dependencies.exec.exec("tar", ["-xzf", archivePath, "-C", extractDir], {
|
|
47644
|
+
silent: true
|
|
47645
|
+
});
|
|
47646
|
+
const extractedBinary = findBinary(extractDir, binaryName);
|
|
47647
|
+
if (!extractedBinary) {
|
|
47648
|
+
throw new Error(`Could not find ${binaryName} in ${assetName}.`);
|
|
47649
|
+
}
|
|
47650
|
+
(0, import_node_fs.rmSync)(binaryPath, { force: true });
|
|
47651
|
+
(0, import_node_fs.copyFileSync)(extractedBinary, binaryPath);
|
|
47652
|
+
if (process.platform !== "win32") {
|
|
47653
|
+
(0, import_node_fs.chmodSync)(binaryPath, 493);
|
|
47654
|
+
}
|
|
47655
|
+
(0, import_node_fs.rmSync)(extractDir, { recursive: true, force: true });
|
|
47656
|
+
await assertBinaryWorks(binaryPath, dependencies);
|
|
47657
|
+
dependencies.core.info(`Installed ${TOOL_NAME} ${OPENAPI_CHANGES_VERSION} at ${binaryPath}`);
|
|
47658
|
+
return binaryPath;
|
|
47659
|
+
}
|
|
47660
|
+
function rulesArgs(rulesPath, workspaceRoot, tempRoot) {
|
|
47661
|
+
const resolved = resolveWorkspaceFilePath(rulesPath, workspaceRoot);
|
|
47662
|
+
if (resolved) {
|
|
47663
|
+
return ["--config", resolved];
|
|
47664
|
+
}
|
|
47665
|
+
const defaultRulesPath = import_node_path.default.join(tempRoot, "postman-bootstrap", "openapi-changes-default-rules.yaml");
|
|
47666
|
+
(0, import_node_fs.mkdirSync)(import_node_path.default.dirname(defaultRulesPath), { recursive: true });
|
|
47667
|
+
(0, import_node_fs.writeFileSync)(defaultRulesPath, "{}\n", "utf8");
|
|
47668
|
+
return ["--config", defaultRulesPath];
|
|
47669
|
+
}
|
|
47670
|
+
var runOpenApiBreakingChangeCheck = async (inputs, dependencies) => {
|
|
47671
|
+
const env = dependencies.env ?? process.env;
|
|
47672
|
+
const workspaceRoot = getWorkspaceRoot(env);
|
|
47673
|
+
const tempRoot = getTempRoot(env);
|
|
47674
|
+
if (inputs.mode === "off") {
|
|
47675
|
+
return {
|
|
47676
|
+
breakingChanges: 0,
|
|
47677
|
+
comparison: "",
|
|
47678
|
+
exitCode: 0,
|
|
47679
|
+
logPath: "",
|
|
47680
|
+
message: "Breaking-change check is disabled.",
|
|
47681
|
+
mode: inputs.mode,
|
|
47682
|
+
status: "skipped",
|
|
47683
|
+
summaryPath: ""
|
|
47684
|
+
};
|
|
47685
|
+
}
|
|
47686
|
+
const summaryPath = resolveConfiguredOutputPath(
|
|
47687
|
+
inputs.summaryPath,
|
|
47688
|
+
"openapi-changes-summary.md",
|
|
47689
|
+
workspaceRoot,
|
|
47690
|
+
tempRoot
|
|
47691
|
+
);
|
|
47692
|
+
const logPath = resolveConfiguredOutputPath(
|
|
47693
|
+
inputs.logPath,
|
|
47694
|
+
"openapi-changes.log",
|
|
47695
|
+
workspaceRoot,
|
|
47696
|
+
tempRoot
|
|
47697
|
+
);
|
|
47698
|
+
const source = await resolveComparisonSource(inputs, dependencies, workspaceRoot, tempRoot);
|
|
47699
|
+
if ("skipped" in source) {
|
|
47700
|
+
const report = formatReport({
|
|
47701
|
+
message: source.reason,
|
|
47702
|
+
status: "skipped"
|
|
47703
|
+
});
|
|
47704
|
+
await writeReportFiles(summaryPath, logPath, report, source.reason, env);
|
|
47705
|
+
return {
|
|
47706
|
+
breakingChanges: 0,
|
|
47707
|
+
comparison: "",
|
|
47708
|
+
exitCode: 0,
|
|
47709
|
+
logPath,
|
|
47710
|
+
message: source.reason,
|
|
47711
|
+
mode: inputs.mode,
|
|
47712
|
+
status: "skipped",
|
|
47713
|
+
summaryPath
|
|
47714
|
+
};
|
|
47715
|
+
}
|
|
47716
|
+
try {
|
|
47717
|
+
const binaryPath = await installOpenApiChanges(dependencies);
|
|
47718
|
+
const configArgs = rulesArgs(inputs.rulesPath, workspaceRoot, tempRoot);
|
|
47719
|
+
const reportArgs = [
|
|
47720
|
+
"report",
|
|
47721
|
+
"--reproducible",
|
|
47722
|
+
"--no-color",
|
|
47723
|
+
...configArgs,
|
|
47724
|
+
source.previous,
|
|
47725
|
+
source.current
|
|
47726
|
+
];
|
|
47727
|
+
const reportResult = await dependencies.exec.getExecOutput(binaryPath, reportArgs, {
|
|
47728
|
+
cwd: workspaceRoot,
|
|
47729
|
+
ignoreReturnCode: true,
|
|
47730
|
+
silent: true
|
|
47731
|
+
});
|
|
47732
|
+
const reportStdout = stripAnsi(reportResult.stdout);
|
|
47733
|
+
const reportStderr = stripAnsi(reportResult.stderr);
|
|
47734
|
+
let breakingChanges = 0;
|
|
47735
|
+
let parsedReport = false;
|
|
47736
|
+
if (reportStdout.trim()) {
|
|
47737
|
+
try {
|
|
47738
|
+
breakingChanges = breakingChangeCount(JSON.parse(reportStdout));
|
|
47739
|
+
parsedReport = true;
|
|
47740
|
+
} catch (error2) {
|
|
47741
|
+
dependencies.core.warning(
|
|
47742
|
+
`Could not parse openapi-changes JSON report: ${error2 instanceof Error ? error2.message : String(error2)}`
|
|
47743
|
+
);
|
|
47744
|
+
}
|
|
47745
|
+
}
|
|
47746
|
+
const summaryArgs = [
|
|
47747
|
+
"summary",
|
|
47748
|
+
"--markdown",
|
|
47749
|
+
"--no-logo",
|
|
47750
|
+
"--no-color",
|
|
47751
|
+
"--with-lines",
|
|
47752
|
+
...configArgs,
|
|
47753
|
+
source.previous,
|
|
47754
|
+
source.current
|
|
47755
|
+
];
|
|
47756
|
+
const summaryResult = await dependencies.exec.getExecOutput(binaryPath, summaryArgs, {
|
|
47757
|
+
cwd: workspaceRoot,
|
|
47758
|
+
ignoreReturnCode: true,
|
|
47759
|
+
silent: true
|
|
47760
|
+
});
|
|
47761
|
+
const summaryStdout = sanitizeOpenApiChangesSummary(stripAnsi(summaryResult.stdout));
|
|
47762
|
+
const summaryStderr = stripAnsi(summaryResult.stderr);
|
|
47763
|
+
const commandFailed = reportResult.exitCode !== 0 && !parsedReport || summaryResult.exitCode !== 0 && !summaryStdout.trim() && breakingChanges === 0;
|
|
47764
|
+
const status = commandFailed || breakingChanges > 0 ? "failed" : "passed";
|
|
47765
|
+
const message = commandFailed ? "openapi-changes failed while comparing specifications." : breakingChanges > 0 ? `${breakingChanges} breaking change marker${breakingChanges === 1 ? "" : "s"} detected.` : "No breaking changes detected.";
|
|
47766
|
+
const report = formatReport({
|
|
47767
|
+
body: summaryStdout || message,
|
|
47768
|
+
comparison: source.label,
|
|
47769
|
+
message,
|
|
47770
|
+
status
|
|
47771
|
+
});
|
|
47772
|
+
const log = [
|
|
47773
|
+
`report exit code: ${reportResult.exitCode}`,
|
|
47774
|
+
reportStderr.trim(),
|
|
47775
|
+
`summary exit code: ${summaryResult.exitCode}`,
|
|
47776
|
+
summaryStderr.trim()
|
|
47777
|
+
].filter(Boolean).join("\n\n");
|
|
47778
|
+
await writeReportFiles(summaryPath, logPath, report, log, env);
|
|
47779
|
+
return {
|
|
47780
|
+
breakingChanges,
|
|
47781
|
+
comparison: source.label,
|
|
47782
|
+
exitCode: status === "failed" ? 1 : 0,
|
|
47783
|
+
logPath,
|
|
47784
|
+
message,
|
|
47785
|
+
mode: inputs.mode,
|
|
47786
|
+
status,
|
|
47787
|
+
summaryPath
|
|
47788
|
+
};
|
|
47789
|
+
} finally {
|
|
47790
|
+
for (const tempFile of source.tempFiles) {
|
|
47791
|
+
await removeTempSpecFile(tempFile);
|
|
47792
|
+
}
|
|
47793
|
+
}
|
|
47794
|
+
};
|
|
47795
|
+
|
|
47173
47796
|
// src/lib/postman/base-urls.ts
|
|
47174
47797
|
var POSTMAN_ENDPOINT_PROFILES = {
|
|
47175
47798
|
prod: {
|
|
@@ -47352,8 +47975,8 @@ var PostmanAssetsClient = class {
|
|
|
47352
47975
|
...team.organizationId != null ? { organizationId: Number(team.organizationId) } : {}
|
|
47353
47976
|
})) : [];
|
|
47354
47977
|
}
|
|
47355
|
-
async request(
|
|
47356
|
-
const url =
|
|
47978
|
+
async request(path8, init = {}) {
|
|
47979
|
+
const url = path8.startsWith("http") ? path8 : `${this.baseUrl}${path8}`;
|
|
47357
47980
|
const response = await this.fetchImpl(url, {
|
|
47358
47981
|
...init,
|
|
47359
47982
|
headers: {
|
|
@@ -47411,12 +48034,25 @@ var PostmanAssetsClient = class {
|
|
|
47411
48034
|
throw new Error("Workspace create did not return an id");
|
|
47412
48035
|
}
|
|
47413
48036
|
const workspace = await this.request(`/workspaces/${workspaceId}`);
|
|
47414
|
-
|
|
47415
|
-
if (
|
|
48037
|
+
let visibility = asRecord(workspace?.workspace)?.visibility;
|
|
48038
|
+
if (visibility !== "team") {
|
|
47416
48039
|
await this.request(`/workspaces/${workspaceId}`, {
|
|
47417
48040
|
method: "PUT",
|
|
47418
48041
|
body: JSON.stringify(payload)
|
|
47419
48042
|
});
|
|
48043
|
+
const reread = await this.request(`/workspaces/${workspaceId}`);
|
|
48044
|
+
visibility = asRecord(reread?.workspace)?.visibility;
|
|
48045
|
+
}
|
|
48046
|
+
if (typeof visibility === "string" && visibility !== "team") {
|
|
48047
|
+
let cleanedUp = false;
|
|
48048
|
+
try {
|
|
48049
|
+
await this.request(`/workspaces/${workspaceId}`, { method: "DELETE" });
|
|
48050
|
+
cleanedUp = true;
|
|
48051
|
+
} catch {
|
|
48052
|
+
}
|
|
48053
|
+
throw new Error(
|
|
48054
|
+
`Workspace ${workspaceId} was created with visibility '${visibility}' and could not be promoted to team visibility. On org-mode accounts this happens when the workspace-team-id input is missing or wrong: the workspace is created at the organization level with personal visibility, so teammates, other API keys, and the API Catalog cannot see it. Set workspace-team-id to the sub-team that should own this workspace and re-run. ` + (cleanedUp ? "The just-created workspace has been deleted so it does not hold the repository link invisibly." : `Cleanup of the just-created workspace failed; delete workspace ${workspaceId} manually before re-running.`)
|
|
48055
|
+
);
|
|
47420
48056
|
}
|
|
47421
48057
|
return {
|
|
47422
48058
|
id: workspaceId
|
|
@@ -47427,6 +48063,19 @@ var PostmanAssetsClient = class {
|
|
|
47427
48063
|
shouldRetry: (err) => !(err instanceof Error && err.message.includes("workspace-team-id"))
|
|
47428
48064
|
});
|
|
47429
48065
|
}
|
|
48066
|
+
/**
|
|
48067
|
+
* Visibility of a workspace as seen by this API key, or null when the
|
|
48068
|
+
* workspace cannot be read (deleted, or invisible to these credentials).
|
|
48069
|
+
*/
|
|
48070
|
+
async getWorkspaceVisibility(workspaceId) {
|
|
48071
|
+
try {
|
|
48072
|
+
const workspace = await this.request(`/workspaces/${workspaceId}`);
|
|
48073
|
+
const visibility = asRecord(workspace?.workspace)?.visibility;
|
|
48074
|
+
return typeof visibility === "string" ? visibility : null;
|
|
48075
|
+
} catch {
|
|
48076
|
+
return null;
|
|
48077
|
+
}
|
|
48078
|
+
}
|
|
47430
48079
|
async listWorkspaces() {
|
|
47431
48080
|
const allWorkspaces = [];
|
|
47432
48081
|
const seenCursors = /* @__PURE__ */ new Set();
|
|
@@ -48138,8 +48787,8 @@ function createInternalIntegrationAdapter(options) {
|
|
|
48138
48787
|
}
|
|
48139
48788
|
|
|
48140
48789
|
// src/lib/spec/safe-spec-fetch.ts
|
|
48141
|
-
var
|
|
48142
|
-
var
|
|
48790
|
+
var import_promises2 = require("node:dns/promises");
|
|
48791
|
+
var import_node_https2 = require("node:https");
|
|
48143
48792
|
var import_node_net = require("node:net");
|
|
48144
48793
|
var import_node_url = require("node:url");
|
|
48145
48794
|
var SAFE_FETCH_LIMITS = {
|
|
@@ -48272,7 +48921,7 @@ function validateSafeHttpsUrl(input) {
|
|
|
48272
48921
|
return url;
|
|
48273
48922
|
}
|
|
48274
48923
|
async function defaultLookup(hostname) {
|
|
48275
|
-
const results = await (0,
|
|
48924
|
+
const results = await (0, import_promises2.lookup)(hostname, { all: true, verbatim: true });
|
|
48276
48925
|
return results.map((entry) => ({ address: entry.address, family: entry.family }));
|
|
48277
48926
|
}
|
|
48278
48927
|
function createPinnedLookup(pinnedAddress, family) {
|
|
@@ -48309,7 +48958,7 @@ async function defaultTransport(url, options) {
|
|
|
48309
48958
|
timeout: options.timeoutMs,
|
|
48310
48959
|
lookup: createPinnedLookup(options.pinnedAddress, options.family)
|
|
48311
48960
|
};
|
|
48312
|
-
const req = (0,
|
|
48961
|
+
const req = (0, import_node_https2.request)(requestOptions, (res) => {
|
|
48313
48962
|
const remoteAddress = res.socket?.remoteAddress;
|
|
48314
48963
|
const chunks = [];
|
|
48315
48964
|
let bytes = 0;
|
|
@@ -48559,8 +49208,8 @@ function normalizeRepoUrl(url) {
|
|
|
48559
49208
|
const sshMatch = raw.match(/^git@([^:]+):(.+?)(?:\.git)?$/);
|
|
48560
49209
|
if (sshMatch) {
|
|
48561
49210
|
const host = sshMatch[1];
|
|
48562
|
-
const
|
|
48563
|
-
return `https://${host}/${
|
|
49211
|
+
const path8 = sshMatch[2];
|
|
49212
|
+
return `https://${host}/${path8}`;
|
|
48564
49213
|
}
|
|
48565
49214
|
return raw.replace(/\.git$/, "");
|
|
48566
49215
|
}
|
|
@@ -48880,8 +49529,8 @@ function safeDecodeSegment(segment) {
|
|
|
48880
49529
|
return segment;
|
|
48881
49530
|
}
|
|
48882
49531
|
}
|
|
48883
|
-
function normalizePath(
|
|
48884
|
-
const raw = String(
|
|
49532
|
+
function normalizePath(path8) {
|
|
49533
|
+
const raw = String(path8 || "").split(/[?#]/, 1)[0] || "/";
|
|
48885
49534
|
const withSlash = raw.startsWith("/") ? raw : `/${raw}`;
|
|
48886
49535
|
const normalized = withSlash.replace(/\/+/g, "/");
|
|
48887
49536
|
const trimmed = normalized.length > 1 ? normalized.replace(/\/+$/g, "") : normalized;
|
|
@@ -48905,8 +49554,8 @@ function serverPathPrefix(url) {
|
|
|
48905
49554
|
return normalizePath(noProtocol).replace(/__server_variable__/g, "{serverVariable}");
|
|
48906
49555
|
}
|
|
48907
49556
|
}
|
|
48908
|
-
function joinPaths(prefix,
|
|
48909
|
-
return normalizePath(`${prefix}/${
|
|
49557
|
+
function joinPaths(prefix, path8) {
|
|
49558
|
+
return normalizePath(`${prefix}/${path8}`.replace(/\/+/g, "/"));
|
|
48910
49559
|
}
|
|
48911
49560
|
function normalizeResponseKey(status) {
|
|
48912
49561
|
const raw = String(status);
|
|
@@ -49010,7 +49659,7 @@ function buildContractIndex(root) {
|
|
|
49010
49659
|
const warnings = [];
|
|
49011
49660
|
if (asRecord3(root.webhooks)) warnings.push("CONTRACT_WEBHOOKS_NOT_VALIDATED: OpenAPI webhooks are not validated by dynamic contract tests");
|
|
49012
49661
|
if (paths) {
|
|
49013
|
-
for (const [
|
|
49662
|
+
for (const [path8, rawPathItem] of Object.entries(paths)) {
|
|
49014
49663
|
const pathItem = resolveInternalRef(root, rawPathItem);
|
|
49015
49664
|
if (!pathItem) continue;
|
|
49016
49665
|
for (const [method, rawOperation] of Object.entries(pathItem)) {
|
|
@@ -49018,10 +49667,10 @@ function buildContractIndex(root) {
|
|
|
49018
49667
|
if (!HTTP_METHODS.has(lowerMethod)) continue;
|
|
49019
49668
|
const operation = resolveInternalRef(root, rawOperation);
|
|
49020
49669
|
if (!operation) continue;
|
|
49021
|
-
if (operation.callbacks) warnings.push(`CONTRACT_CALLBACKS_NOT_VALIDATED: callbacks are not validated for ${lowerMethod.toUpperCase()} ${
|
|
49670
|
+
if (operation.callbacks) warnings.push(`CONTRACT_CALLBACKS_NOT_VALIDATED: callbacks are not validated for ${lowerMethod.toUpperCase()} ${path8}`);
|
|
49022
49671
|
const responses = asRecord3(operation.responses);
|
|
49023
49672
|
if (!responses || Object.keys(responses).length === 0) {
|
|
49024
|
-
throw new Error(`CONTRACT_OPERATION_NO_RESPONSES: ${lowerMethod.toUpperCase()} ${
|
|
49673
|
+
throw new Error(`CONTRACT_OPERATION_NO_RESPONSES: ${lowerMethod.toUpperCase()} ${path8} must define at least one response`);
|
|
49025
49674
|
}
|
|
49026
49675
|
const contractResponses = {};
|
|
49027
49676
|
for (const [status, rawResponse] of Object.entries(responses)) {
|
|
@@ -49036,8 +49685,8 @@ function buildContractIndex(root) {
|
|
|
49036
49685
|
};
|
|
49037
49686
|
}
|
|
49038
49687
|
const candidates = [...new Set([
|
|
49039
|
-
|
|
49040
|
-
...operationServers(root, pathItem, operation).map((server) => joinPaths(serverPathPrefix(server),
|
|
49688
|
+
path8,
|
|
49689
|
+
...operationServers(root, pathItem, operation).map((server) => joinPaths(serverPathPrefix(server), path8))
|
|
49041
49690
|
].map(normalizePath))];
|
|
49042
49691
|
const opWarnings = [];
|
|
49043
49692
|
opWarnings.push(...collectSecuritySchemeWarnings(root, operation));
|
|
@@ -49046,10 +49695,10 @@ function buildContractIndex(root) {
|
|
|
49046
49695
|
opWarnings.push(`CONTRACT_SECURITY_NOT_VALIDATED: security parameter ${parameter.in}:${parameter.name} is not statically required in generated requests`);
|
|
49047
49696
|
}
|
|
49048
49697
|
operations.push({
|
|
49049
|
-
id: `${lowerMethod.toUpperCase()} ${
|
|
49698
|
+
id: `${lowerMethod.toUpperCase()} ${path8}`,
|
|
49050
49699
|
method: lowerMethod.toUpperCase(),
|
|
49051
|
-
path:
|
|
49052
|
-
pointer: `/paths/${
|
|
49700
|
+
path: path8,
|
|
49701
|
+
pointer: `/paths/${path8.replace(/~/g, "~0").replace(/\//g, "~1")}/${lowerMethod}`,
|
|
49053
49702
|
candidates,
|
|
49054
49703
|
responses: contractResponses,
|
|
49055
49704
|
requiredParameters,
|
|
@@ -49146,8 +49795,8 @@ function requestPath(request) {
|
|
|
49146
49795
|
if (typeof urlRecord.raw === "string") return pathFromRaw(urlRecord.raw);
|
|
49147
49796
|
return "/";
|
|
49148
49797
|
}
|
|
49149
|
-
function segments(
|
|
49150
|
-
return normalizePath(
|
|
49798
|
+
function segments(path8) {
|
|
49799
|
+
return normalizePath(path8).split("/").filter(Boolean);
|
|
49151
49800
|
}
|
|
49152
49801
|
function isTemplateSegment(segment) {
|
|
49153
49802
|
return /^\{[^}]+\}$/.test(segment) || /^:[^/]+$/.test(segment) || /^\{\{[^}]+\}\}$/.test(segment) || /^<[^>]+>$/.test(segment);
|
|
@@ -49173,8 +49822,8 @@ function matchCandidate(candidate, request) {
|
|
|
49173
49822
|
function matchOperation(index, request) {
|
|
49174
49823
|
const record = asRecord4(request);
|
|
49175
49824
|
const method = String(record?.method || "").toUpperCase();
|
|
49176
|
-
const
|
|
49177
|
-
const candidates = index.operations.filter((operation) => operation.method === method).flatMap((operation) => operation.candidates.map((candidate) => ({ operation, score: matchCandidate(candidate,
|
|
49825
|
+
const path8 = requestPath(request);
|
|
49826
|
+
const candidates = index.operations.filter((operation) => operation.method === method).flatMap((operation) => operation.candidates.map((candidate) => ({ operation, score: matchCandidate(candidate, path8), 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) => {
|
|
49178
49827
|
for (let index2 = 0; index2 < a.score.length; index2 += 1) {
|
|
49179
49828
|
const delta = b.score[index2] - a.score[index2];
|
|
49180
49829
|
if (delta !== 0) return delta;
|
|
@@ -49182,11 +49831,11 @@ function matchOperation(index, request) {
|
|
|
49182
49831
|
return a.operation.id.localeCompare(b.operation.id);
|
|
49183
49832
|
});
|
|
49184
49833
|
const best = candidates[0];
|
|
49185
|
-
if (!best) return { path:
|
|
49834
|
+
if (!best) return { path: path8, method };
|
|
49186
49835
|
const tied = candidates.filter((entry) => entry.score.every((value, index2) => value === best.score[index2]));
|
|
49187
49836
|
const uniqueTied = [...new Map(tied.map((entry) => [entry.operation.id, entry.operation])).values()];
|
|
49188
|
-
if (uniqueTied.length > 1) return { path:
|
|
49189
|
-
return { path:
|
|
49837
|
+
if (uniqueTied.length > 1) return { path: path8, method, ambiguous: uniqueTied };
|
|
49838
|
+
return { path: path8, method, operation: best.operation };
|
|
49190
49839
|
}
|
|
49191
49840
|
function assignValidator(lines, target, source) {
|
|
49192
49841
|
lines.push(`${target} = ${source};`);
|
|
@@ -49471,10 +50120,10 @@ function instrumentContractCollection(collection, index) {
|
|
|
49471
50120
|
}
|
|
49472
50121
|
|
|
49473
50122
|
// src/lib/spec/openapi-loader.ts
|
|
49474
|
-
var
|
|
49475
|
-
var
|
|
50123
|
+
var import_node_fs2 = require("node:fs");
|
|
50124
|
+
var import_promises3 = require("node:fs/promises");
|
|
49476
50125
|
var import_node_url2 = require("node:url");
|
|
49477
|
-
var
|
|
50126
|
+
var import_node_path2 = __toESM(require("node:path"), 1);
|
|
49478
50127
|
|
|
49479
50128
|
// node_modules/@apidevtools/json-schema-ref-parser/dist/lib/util/convert-path-to-posix.js
|
|
49480
50129
|
var win32Sep = "\\";
|
|
@@ -49531,59 +50180,59 @@ function cwd() {
|
|
|
49531
50180
|
return href;
|
|
49532
50181
|
}
|
|
49533
50182
|
if (typeof process !== "undefined" && process.cwd) {
|
|
49534
|
-
const
|
|
49535
|
-
const lastChar =
|
|
50183
|
+
const path8 = process.cwd();
|
|
50184
|
+
const lastChar = path8.slice(-1);
|
|
49536
50185
|
if (lastChar === "/" || lastChar === "\\") {
|
|
49537
|
-
return
|
|
50186
|
+
return path8;
|
|
49538
50187
|
} else {
|
|
49539
|
-
return
|
|
50188
|
+
return path8 + "/";
|
|
49540
50189
|
}
|
|
49541
50190
|
}
|
|
49542
50191
|
return "/";
|
|
49543
50192
|
}
|
|
49544
|
-
function getProtocol(
|
|
49545
|
-
const match = protocolPattern.exec(
|
|
50193
|
+
function getProtocol(path8) {
|
|
50194
|
+
const match = protocolPattern.exec(path8 || "");
|
|
49546
50195
|
if (match) {
|
|
49547
50196
|
return match[1].toLowerCase();
|
|
49548
50197
|
}
|
|
49549
50198
|
return void 0;
|
|
49550
50199
|
}
|
|
49551
|
-
function getExtension(
|
|
49552
|
-
const lastDot =
|
|
50200
|
+
function getExtension(path8) {
|
|
50201
|
+
const lastDot = path8.lastIndexOf(".");
|
|
49553
50202
|
if (lastDot >= 0) {
|
|
49554
|
-
return stripQuery(
|
|
50203
|
+
return stripQuery(path8.substring(lastDot).toLowerCase());
|
|
49555
50204
|
}
|
|
49556
50205
|
return "";
|
|
49557
50206
|
}
|
|
49558
|
-
function stripQuery(
|
|
49559
|
-
const queryIndex =
|
|
50207
|
+
function stripQuery(path8) {
|
|
50208
|
+
const queryIndex = path8.indexOf("?");
|
|
49560
50209
|
if (queryIndex >= 0) {
|
|
49561
|
-
|
|
50210
|
+
path8 = path8.substring(0, queryIndex);
|
|
49562
50211
|
}
|
|
49563
|
-
return
|
|
50212
|
+
return path8;
|
|
49564
50213
|
}
|
|
49565
|
-
function getHash(
|
|
49566
|
-
if (!
|
|
50214
|
+
function getHash(path8) {
|
|
50215
|
+
if (!path8) {
|
|
49567
50216
|
return "#";
|
|
49568
50217
|
}
|
|
49569
|
-
const hashIndex =
|
|
50218
|
+
const hashIndex = path8.indexOf("#");
|
|
49570
50219
|
if (hashIndex >= 0) {
|
|
49571
|
-
return
|
|
50220
|
+
return path8.substring(hashIndex);
|
|
49572
50221
|
}
|
|
49573
50222
|
return "#";
|
|
49574
50223
|
}
|
|
49575
|
-
function stripHash(
|
|
49576
|
-
if (!
|
|
50224
|
+
function stripHash(path8) {
|
|
50225
|
+
if (!path8) {
|
|
49577
50226
|
return "";
|
|
49578
50227
|
}
|
|
49579
|
-
const hashIndex =
|
|
50228
|
+
const hashIndex = path8.indexOf("#");
|
|
49580
50229
|
if (hashIndex >= 0) {
|
|
49581
|
-
|
|
50230
|
+
path8 = path8.substring(0, hashIndex);
|
|
49582
50231
|
}
|
|
49583
|
-
return
|
|
50232
|
+
return path8;
|
|
49584
50233
|
}
|
|
49585
|
-
function isHttp(
|
|
49586
|
-
const protocol = getProtocol(
|
|
50234
|
+
function isHttp(path8) {
|
|
50235
|
+
const protocol = getProtocol(path8);
|
|
49587
50236
|
if (protocol === "http" || protocol === "https") {
|
|
49588
50237
|
return true;
|
|
49589
50238
|
} else if (protocol === void 0) {
|
|
@@ -49592,11 +50241,11 @@ function isHttp(path7) {
|
|
|
49592
50241
|
return false;
|
|
49593
50242
|
}
|
|
49594
50243
|
}
|
|
49595
|
-
function isUnsafeUrl(
|
|
49596
|
-
if (!
|
|
50244
|
+
function isUnsafeUrl(path8) {
|
|
50245
|
+
if (!path8 || typeof path8 !== "string") {
|
|
49597
50246
|
return true;
|
|
49598
50247
|
}
|
|
49599
|
-
const normalizedPath =
|
|
50248
|
+
const normalizedPath = path8.trim().toLowerCase();
|
|
49600
50249
|
if (!normalizedPath) {
|
|
49601
50250
|
return true;
|
|
49602
50251
|
}
|
|
@@ -49727,22 +50376,22 @@ function isInternalPort(port) {
|
|
|
49727
50376
|
];
|
|
49728
50377
|
return internalPorts.includes(port);
|
|
49729
50378
|
}
|
|
49730
|
-
function isFileSystemPath(
|
|
50379
|
+
function isFileSystemPath(path8) {
|
|
49731
50380
|
if (typeof window !== "undefined" || typeof process !== "undefined" && process.browser) {
|
|
49732
50381
|
return false;
|
|
49733
50382
|
}
|
|
49734
|
-
const protocol = getProtocol(
|
|
50383
|
+
const protocol = getProtocol(path8);
|
|
49735
50384
|
return protocol === void 0 || protocol === "file";
|
|
49736
50385
|
}
|
|
49737
|
-
function fromFileSystemPath(
|
|
50386
|
+
function fromFileSystemPath(path8) {
|
|
49738
50387
|
if (isWindows2()) {
|
|
49739
50388
|
const projectDir = cwd();
|
|
49740
|
-
const upperPath =
|
|
50389
|
+
const upperPath = path8.toUpperCase();
|
|
49741
50390
|
const projectDirPosixPath = convertPathToPosix(projectDir);
|
|
49742
50391
|
const posixUpper = projectDirPosixPath.toUpperCase();
|
|
49743
50392
|
const hasProjectDir = upperPath.includes(posixUpper);
|
|
49744
50393
|
const hasProjectUri = upperPath.includes(posixUpper);
|
|
49745
|
-
const isAbsolutePath = isAbsoluteWin32Path.test(
|
|
50394
|
+
const isAbsolutePath = isAbsoluteWin32Path.test(path8) || path8.startsWith("http://") || path8.startsWith("https://") || path8.startsWith("file://");
|
|
49746
50395
|
if (!(hasProjectDir || hasProjectUri || isAbsolutePath) && !projectDir.startsWith("http")) {
|
|
49747
50396
|
const join3 = (a, b) => {
|
|
49748
50397
|
if (a.endsWith("/") || a.endsWith("\\")) {
|
|
@@ -49751,42 +50400,42 @@ function fromFileSystemPath(path7) {
|
|
|
49751
50400
|
return a + "/" + b;
|
|
49752
50401
|
}
|
|
49753
50402
|
};
|
|
49754
|
-
|
|
50403
|
+
path8 = join3(projectDir, path8);
|
|
49755
50404
|
}
|
|
49756
|
-
|
|
50405
|
+
path8 = convertPathToPosix(path8);
|
|
49757
50406
|
}
|
|
49758
|
-
|
|
50407
|
+
path8 = encodeURI(path8);
|
|
49759
50408
|
for (const pattern of urlEncodePatterns) {
|
|
49760
|
-
|
|
50409
|
+
path8 = path8.replace(pattern[0], pattern[1]);
|
|
49761
50410
|
}
|
|
49762
|
-
return
|
|
50411
|
+
return path8;
|
|
49763
50412
|
}
|
|
49764
|
-
function toFileSystemPath(
|
|
49765
|
-
|
|
49766
|
-
|
|
50413
|
+
function toFileSystemPath(path8, keepFileProtocol) {
|
|
50414
|
+
path8 = path8.replace(/%(?![0-9A-Fa-f]{2})/g, "%25");
|
|
50415
|
+
path8 = decodeURI(path8);
|
|
49767
50416
|
for (let i = 0; i < urlDecodePatterns.length; i += 2) {
|
|
49768
|
-
|
|
50417
|
+
path8 = path8.replace(urlDecodePatterns[i], urlDecodePatterns[i + 1]);
|
|
49769
50418
|
}
|
|
49770
|
-
let isFileUrl =
|
|
50419
|
+
let isFileUrl = path8.toLowerCase().startsWith("file://");
|
|
49771
50420
|
if (isFileUrl) {
|
|
49772
|
-
|
|
49773
|
-
if (isWindows2() &&
|
|
49774
|
-
|
|
50421
|
+
path8 = path8.replace(/^file:\/\//, "").replace(/^\//, "");
|
|
50422
|
+
if (isWindows2() && path8[1] === "/") {
|
|
50423
|
+
path8 = `${path8[0]}:${path8.substring(1)}`;
|
|
49775
50424
|
}
|
|
49776
50425
|
if (keepFileProtocol) {
|
|
49777
|
-
|
|
50426
|
+
path8 = "file:///" + path8;
|
|
49778
50427
|
} else {
|
|
49779
50428
|
isFileUrl = false;
|
|
49780
|
-
|
|
50429
|
+
path8 = isWindows2() ? path8 : "/" + path8;
|
|
49781
50430
|
}
|
|
49782
50431
|
}
|
|
49783
50432
|
if (isWindows2() && !isFileUrl) {
|
|
49784
|
-
|
|
49785
|
-
if (
|
|
49786
|
-
|
|
50433
|
+
path8 = path8.replace(forwardSlashPattern, "\\");
|
|
50434
|
+
if (path8.match(/^[a-z]:\\/i)) {
|
|
50435
|
+
path8 = path8[0].toUpperCase() + path8.substring(1);
|
|
49787
50436
|
}
|
|
49788
50437
|
}
|
|
49789
|
-
return
|
|
50438
|
+
return path8;
|
|
49790
50439
|
}
|
|
49791
50440
|
function safePointerToPath(pointer) {
|
|
49792
50441
|
if (pointer.length <= 1 || pointer[0] !== "#" || pointer[1] !== "/") {
|
|
@@ -49907,8 +50556,8 @@ var MissingPointerError = class extends JSONParserError {
|
|
|
49907
50556
|
targetRef;
|
|
49908
50557
|
targetFound;
|
|
49909
50558
|
parentPath;
|
|
49910
|
-
constructor(token,
|
|
49911
|
-
super(`Missing $ref pointer "${getHash(
|
|
50559
|
+
constructor(token, path8, targetRef, targetFound, parentPath) {
|
|
50560
|
+
super(`Missing $ref pointer "${getHash(path8)}". Token "${token}" does not exist.`, stripHash(path8));
|
|
49912
50561
|
this.targetToken = token;
|
|
49913
50562
|
this.targetRef = targetRef;
|
|
49914
50563
|
this.targetFound = targetFound;
|
|
@@ -49925,8 +50574,8 @@ var TimeoutError = class extends JSONParserError {
|
|
|
49925
50574
|
var InvalidPointerError = class extends JSONParserError {
|
|
49926
50575
|
code = "EUNMATCHEDRESOLVER";
|
|
49927
50576
|
name = "InvalidPointerError";
|
|
49928
|
-
constructor(pointer,
|
|
49929
|
-
super(`Invalid $ref pointer "${pointer}". Pointers must begin with "#/"`, stripHash(
|
|
50577
|
+
constructor(pointer, path8) {
|
|
50578
|
+
super(`Invalid $ref pointer "${pointer}". Pointers must begin with "#/"`, stripHash(path8));
|
|
49930
50579
|
}
|
|
49931
50580
|
};
|
|
49932
50581
|
function isHandledError(err) {
|
|
@@ -50020,11 +50669,11 @@ var Pointer = class _Pointer {
|
|
|
50020
50669
|
* Resolving a single pointer may require resolving multiple $Refs.
|
|
50021
50670
|
*/
|
|
50022
50671
|
indirections;
|
|
50023
|
-
constructor($ref,
|
|
50672
|
+
constructor($ref, path8, friendlyPath) {
|
|
50024
50673
|
this.$ref = $ref;
|
|
50025
|
-
this.path =
|
|
50026
|
-
this.originalPath = friendlyPath ||
|
|
50027
|
-
this.scopeBase = $ref.path || stripHash(
|
|
50674
|
+
this.path = path8;
|
|
50675
|
+
this.originalPath = friendlyPath || path8;
|
|
50676
|
+
this.scopeBase = $ref.path || stripHash(path8);
|
|
50028
50677
|
this.value = void 0;
|
|
50029
50678
|
this.circular = false;
|
|
50030
50679
|
this.indirections = 0;
|
|
@@ -50077,10 +50726,10 @@ var Pointer = class _Pointer {
|
|
|
50077
50726
|
continue;
|
|
50078
50727
|
}
|
|
50079
50728
|
this.value = null;
|
|
50080
|
-
const
|
|
50081
|
-
const targetRef = this.path.replace(
|
|
50729
|
+
const path8 = this.$ref.path || "";
|
|
50730
|
+
const targetRef = this.path.replace(path8, "");
|
|
50082
50731
|
const targetFound = _Pointer.join("", found);
|
|
50083
|
-
const parentPath = pathFromRoot?.replace(
|
|
50732
|
+
const parentPath = pathFromRoot?.replace(path8, "");
|
|
50084
50733
|
throw new MissingPointerError(token, decodeURI(this.originalPath), targetRef, targetFound, parentPath);
|
|
50085
50734
|
} else {
|
|
50086
50735
|
this.value = this.value[token];
|
|
@@ -50146,8 +50795,8 @@ var Pointer = class _Pointer {
|
|
|
50146
50795
|
* @param [originalPath]
|
|
50147
50796
|
* @returns
|
|
50148
50797
|
*/
|
|
50149
|
-
static parse(
|
|
50150
|
-
const pointer = getHash(
|
|
50798
|
+
static parse(path8, originalPath) {
|
|
50799
|
+
const pointer = getHash(path8).substring(1);
|
|
50151
50800
|
if (!pointer) {
|
|
50152
50801
|
return [];
|
|
50153
50802
|
}
|
|
@@ -50156,7 +50805,7 @@ var Pointer = class _Pointer {
|
|
|
50156
50805
|
split[i] = split[i].replace(escapedSlash, "/").replace(escapedTilde, "~");
|
|
50157
50806
|
}
|
|
50158
50807
|
if (split[0] !== "") {
|
|
50159
|
-
throw new InvalidPointerError(pointer, originalPath === void 0 ?
|
|
50808
|
+
throw new InvalidPointerError(pointer, originalPath === void 0 ? path8 : originalPath);
|
|
50160
50809
|
}
|
|
50161
50810
|
return split.slice(1);
|
|
50162
50811
|
}
|
|
@@ -50297,9 +50946,9 @@ var $Ref = class _$Ref {
|
|
|
50297
50946
|
* @param options
|
|
50298
50947
|
* @returns
|
|
50299
50948
|
*/
|
|
50300
|
-
exists(
|
|
50949
|
+
exists(path8, options) {
|
|
50301
50950
|
try {
|
|
50302
|
-
this.resolve(
|
|
50951
|
+
this.resolve(path8, options);
|
|
50303
50952
|
return true;
|
|
50304
50953
|
} catch {
|
|
50305
50954
|
return false;
|
|
@@ -50312,8 +50961,8 @@ var $Ref = class _$Ref {
|
|
|
50312
50961
|
* @param options
|
|
50313
50962
|
* @returns - Returns the resolved value
|
|
50314
50963
|
*/
|
|
50315
|
-
get(
|
|
50316
|
-
return this.resolve(
|
|
50964
|
+
get(path8, options) {
|
|
50965
|
+
return this.resolve(path8, options)?.value;
|
|
50317
50966
|
}
|
|
50318
50967
|
/**
|
|
50319
50968
|
* Resolves the given JSON reference within this {@link $Ref#value}.
|
|
@@ -50324,8 +50973,8 @@ var $Ref = class _$Ref {
|
|
|
50324
50973
|
* @param pathFromRoot - The path of `obj` from the schema root
|
|
50325
50974
|
* @returns
|
|
50326
50975
|
*/
|
|
50327
|
-
resolve(
|
|
50328
|
-
const pointer = new pointer_default(this,
|
|
50976
|
+
resolve(path8, options, friendlyPath, pathFromRoot) {
|
|
50977
|
+
const pointer = new pointer_default(this, path8, friendlyPath);
|
|
50329
50978
|
try {
|
|
50330
50979
|
const resolved = pointer.resolve(this.value, options, pathFromRoot);
|
|
50331
50980
|
if (resolved.value === nullSymbol) {
|
|
@@ -50353,8 +51002,8 @@ var $Ref = class _$Ref {
|
|
|
50353
51002
|
* @param path - The full path of the property to set, optionally with a JSON pointer in the hash
|
|
50354
51003
|
* @param value - The value to assign
|
|
50355
51004
|
*/
|
|
50356
|
-
set(
|
|
50357
|
-
const pointer = new pointer_default(this,
|
|
51005
|
+
set(path8, value) {
|
|
51006
|
+
const pointer = new pointer_default(this, path8);
|
|
50358
51007
|
this.value = pointer.set(this.value, value);
|
|
50359
51008
|
if (this.value === nullSymbol) {
|
|
50360
51009
|
this.value = null;
|
|
@@ -50528,8 +51177,8 @@ var $Refs = class {
|
|
|
50528
51177
|
*/
|
|
50529
51178
|
paths(...types2) {
|
|
50530
51179
|
const paths = getPaths(this._$refs, types2.flat());
|
|
50531
|
-
return paths.map((
|
|
50532
|
-
return convertPathToPosix(
|
|
51180
|
+
return paths.map((path8) => {
|
|
51181
|
+
return convertPathToPosix(path8.decoded);
|
|
50533
51182
|
});
|
|
50534
51183
|
}
|
|
50535
51184
|
/**
|
|
@@ -50542,8 +51191,8 @@ var $Refs = class {
|
|
|
50542
51191
|
values(...types2) {
|
|
50543
51192
|
const $refs = this._$refs;
|
|
50544
51193
|
const paths = getPaths($refs, types2.flat());
|
|
50545
|
-
return paths.reduce((obj,
|
|
50546
|
-
obj[convertPathToPosix(
|
|
51194
|
+
return paths.reduce((obj, path8) => {
|
|
51195
|
+
obj[convertPathToPosix(path8.decoded)] = $refs[path8.encoded].value;
|
|
50547
51196
|
return obj;
|
|
50548
51197
|
}, {});
|
|
50549
51198
|
}
|
|
@@ -50561,9 +51210,9 @@ var $Refs = class {
|
|
|
50561
51210
|
* @param [options]
|
|
50562
51211
|
* @returns
|
|
50563
51212
|
*/
|
|
50564
|
-
exists(
|
|
51213
|
+
exists(path8, options) {
|
|
50565
51214
|
try {
|
|
50566
|
-
this._resolve(
|
|
51215
|
+
this._resolve(path8, "", options);
|
|
50567
51216
|
return true;
|
|
50568
51217
|
} catch {
|
|
50569
51218
|
return false;
|
|
@@ -50576,8 +51225,8 @@ var $Refs = class {
|
|
|
50576
51225
|
* @param [options]
|
|
50577
51226
|
* @returns - Returns the resolved value
|
|
50578
51227
|
*/
|
|
50579
|
-
get(
|
|
50580
|
-
return this._resolve(
|
|
51228
|
+
get(path8, options) {
|
|
51229
|
+
return this._resolve(path8, "", options).value;
|
|
50581
51230
|
}
|
|
50582
51231
|
/**
|
|
50583
51232
|
* 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.
|
|
@@ -50585,11 +51234,11 @@ var $Refs = class {
|
|
|
50585
51234
|
* @param path The JSON Reference path, optionally with a JSON Pointer in the hash
|
|
50586
51235
|
* @param value The value to assign. Can be anything (object, string, number, etc.)
|
|
50587
51236
|
*/
|
|
50588
|
-
set(
|
|
50589
|
-
const absPath = resolve2(this._root$Ref.path,
|
|
51237
|
+
set(path8, value) {
|
|
51238
|
+
const absPath = resolve2(this._root$Ref.path, path8);
|
|
50590
51239
|
const $ref = this._getRef(absPath);
|
|
50591
51240
|
if (!$ref) {
|
|
50592
|
-
throw new Error(`Error resolving $ref pointer "${
|
|
51241
|
+
throw new Error(`Error resolving $ref pointer "${path8}".
|
|
50593
51242
|
"${stripHash(absPath)}" not found.`);
|
|
50594
51243
|
}
|
|
50595
51244
|
$ref.set(absPath, value);
|
|
@@ -50601,25 +51250,25 @@ var $Refs = class {
|
|
|
50601
51250
|
* @returns
|
|
50602
51251
|
* @protected
|
|
50603
51252
|
*/
|
|
50604
|
-
_get$Ref(
|
|
50605
|
-
|
|
50606
|
-
return this._getRef(
|
|
51253
|
+
_get$Ref(path8) {
|
|
51254
|
+
path8 = resolve2(this._root$Ref.path, path8);
|
|
51255
|
+
return this._getRef(path8);
|
|
50607
51256
|
}
|
|
50608
51257
|
/**
|
|
50609
51258
|
* Creates a new {@link $Ref} object and adds it to this {@link $Refs} object.
|
|
50610
51259
|
*
|
|
50611
51260
|
* @param path - The file path or URL of the referenced file
|
|
50612
51261
|
*/
|
|
50613
|
-
_add(
|
|
50614
|
-
const withoutHash = stripHash(
|
|
51262
|
+
_add(path8) {
|
|
51263
|
+
const withoutHash = stripHash(path8);
|
|
50615
51264
|
const $ref = new ref_default(this);
|
|
50616
51265
|
$ref.path = withoutHash;
|
|
50617
51266
|
this._$refs[withoutHash] = $ref;
|
|
50618
51267
|
this._root$Ref = this._root$Ref || $ref;
|
|
50619
51268
|
return $ref;
|
|
50620
51269
|
}
|
|
50621
|
-
_addAlias(
|
|
50622
|
-
const withoutHash = stripHash(
|
|
51270
|
+
_addAlias(path8, value, pathType, dynamicIdScope = false) {
|
|
51271
|
+
const withoutHash = stripHash(path8);
|
|
50623
51272
|
if (!withoutHash || this._$refs[withoutHash] || this._aliases[withoutHash]) {
|
|
50624
51273
|
return this._$refs[withoutHash] || this._aliases[withoutHash];
|
|
50625
51274
|
}
|
|
@@ -50640,14 +51289,14 @@ var $Refs = class {
|
|
|
50640
51289
|
* @returns
|
|
50641
51290
|
* @protected
|
|
50642
51291
|
*/
|
|
50643
|
-
_resolve(
|
|
50644
|
-
const absPath = resolve2(this._root$Ref.path,
|
|
51292
|
+
_resolve(path8, pathFromRoot, options) {
|
|
51293
|
+
const absPath = resolve2(this._root$Ref.path, path8);
|
|
50645
51294
|
const $ref = this._getRef(absPath);
|
|
50646
51295
|
if (!$ref) {
|
|
50647
|
-
throw new Error(`Error resolving $ref pointer "${
|
|
51296
|
+
throw new Error(`Error resolving $ref pointer "${path8}".
|
|
50648
51297
|
"${stripHash(absPath)}" not found.`);
|
|
50649
51298
|
}
|
|
50650
|
-
return $ref.resolve(absPath, options,
|
|
51299
|
+
return $ref.resolve(absPath, options, path8, pathFromRoot);
|
|
50651
51300
|
}
|
|
50652
51301
|
/**
|
|
50653
51302
|
* A map of paths/urls to {@link $Ref} objects
|
|
@@ -50689,8 +51338,8 @@ var $Refs = class {
|
|
|
50689
51338
|
* @returns {object}
|
|
50690
51339
|
*/
|
|
50691
51340
|
toJSON = this.values;
|
|
50692
|
-
_getRef(
|
|
50693
|
-
const withoutHash = stripHash(
|
|
51341
|
+
_getRef(path8) {
|
|
51342
|
+
const withoutHash = stripHash(path8);
|
|
50694
51343
|
return this._$refs[withoutHash] || this._aliases[withoutHash];
|
|
50695
51344
|
}
|
|
50696
51345
|
};
|
|
@@ -50702,10 +51351,10 @@ function getPaths($refs, types2) {
|
|
|
50702
51351
|
return types2.includes($refs[key].pathType);
|
|
50703
51352
|
});
|
|
50704
51353
|
}
|
|
50705
|
-
return paths.map((
|
|
51354
|
+
return paths.map((path8) => {
|
|
50706
51355
|
return {
|
|
50707
|
-
encoded:
|
|
50708
|
-
decoded: $refs[
|
|
51356
|
+
encoded: path8,
|
|
51357
|
+
decoded: $refs[path8].pathType === "file" ? toFileSystemPath(path8, true) : path8
|
|
50709
51358
|
};
|
|
50710
51359
|
});
|
|
50711
51360
|
}
|
|
@@ -50797,14 +51446,14 @@ function getResult(obj, prop, file, callback, $refs) {
|
|
|
50797
51446
|
|
|
50798
51447
|
// node_modules/@apidevtools/json-schema-ref-parser/dist/lib/parse.js
|
|
50799
51448
|
async function parse2(target, $refs, options) {
|
|
50800
|
-
let
|
|
51449
|
+
let path8 = typeof target === "string" ? target : target.url;
|
|
50801
51450
|
const baseUrl = typeof target === "string" ? void 0 : target.baseUrl;
|
|
50802
51451
|
let reference = typeof target === "string" ? void 0 : target.reference;
|
|
50803
|
-
const hashIndex =
|
|
51452
|
+
const hashIndex = path8.indexOf("#");
|
|
50804
51453
|
let hash = "";
|
|
50805
51454
|
if (hashIndex >= 0) {
|
|
50806
|
-
hash =
|
|
50807
|
-
|
|
51455
|
+
hash = path8.substring(hashIndex);
|
|
51456
|
+
path8 = path8.substring(0, hashIndex);
|
|
50808
51457
|
}
|
|
50809
51458
|
if (reference) {
|
|
50810
51459
|
const referenceHashIndex = reference.indexOf("#");
|
|
@@ -50812,11 +51461,11 @@ async function parse2(target, $refs, options) {
|
|
|
50812
51461
|
reference = reference.substring(0, referenceHashIndex);
|
|
50813
51462
|
}
|
|
50814
51463
|
}
|
|
50815
|
-
const $ref = $refs._add(
|
|
51464
|
+
const $ref = $refs._add(path8);
|
|
50816
51465
|
const file = {
|
|
50817
|
-
url:
|
|
51466
|
+
url: path8,
|
|
50818
51467
|
hash,
|
|
50819
|
-
extension: getExtension(
|
|
51468
|
+
extension: getExtension(path8),
|
|
50820
51469
|
...reference !== void 0 ? { reference } : {},
|
|
50821
51470
|
...baseUrl !== void 0 ? { baseUrl } : {}
|
|
50822
51471
|
};
|
|
@@ -53701,24 +54350,24 @@ var file_default = {
|
|
|
53701
54350
|
* Reads the given file and returns its raw contents as a Buffer.
|
|
53702
54351
|
*/
|
|
53703
54352
|
async read(file) {
|
|
53704
|
-
let
|
|
54353
|
+
let path8;
|
|
53705
54354
|
const fs3 = await import("fs");
|
|
53706
54355
|
try {
|
|
53707
|
-
|
|
54356
|
+
path8 = toFileSystemPath(file.url);
|
|
53708
54357
|
} catch (err) {
|
|
53709
54358
|
const e = err;
|
|
53710
54359
|
e.message = `Malformed URI: ${file.url}: ${e.message}`;
|
|
53711
54360
|
throw new ResolverError(e, file.url);
|
|
53712
54361
|
}
|
|
53713
|
-
if (
|
|
53714
|
-
|
|
54362
|
+
if (path8.endsWith("/") || path8.endsWith("\\")) {
|
|
54363
|
+
path8 = path8.slice(0, -1);
|
|
53715
54364
|
}
|
|
53716
54365
|
try {
|
|
53717
|
-
return await fs3.promises.readFile(
|
|
54366
|
+
return await fs3.promises.readFile(path8);
|
|
53718
54367
|
} catch (err) {
|
|
53719
54368
|
const e = err;
|
|
53720
|
-
e.message = `Error opening file ${
|
|
53721
|
-
throw new ResolverError(e,
|
|
54369
|
+
e.message = `Error opening file ${path8}: ${e.message}`;
|
|
54370
|
+
throw new ResolverError(e, path8);
|
|
53722
54371
|
}
|
|
53723
54372
|
}
|
|
53724
54373
|
};
|
|
@@ -53782,7 +54431,7 @@ async function download(u, httpOptions, _redirects) {
|
|
|
53782
54431
|
const redirects = _redirects || [];
|
|
53783
54432
|
redirects.push(u.href);
|
|
53784
54433
|
try {
|
|
53785
|
-
const res = await
|
|
54434
|
+
const res = await get2(u, httpOptions);
|
|
53786
54435
|
if (res.status >= 400) {
|
|
53787
54436
|
const error2 = new Error(`HTTP ERROR ${res.status}`);
|
|
53788
54437
|
error2.status = res.status;
|
|
@@ -53815,7 +54464,7 @@ Too many redirects:
|
|
|
53815
54464
|
throw new ResolverError(e, u.href);
|
|
53816
54465
|
}
|
|
53817
54466
|
}
|
|
53818
|
-
async function
|
|
54467
|
+
async function get2(u, httpOptions) {
|
|
53819
54468
|
let controller;
|
|
53820
54469
|
let timeoutId;
|
|
53821
54470
|
if (httpOptions.timeout && typeof AbortController !== "undefined") {
|
|
@@ -53942,7 +54591,7 @@ function isMergeable(val) {
|
|
|
53942
54591
|
|
|
53943
54592
|
// node_modules/@apidevtools/json-schema-ref-parser/dist/lib/normalize-args.js
|
|
53944
54593
|
function normalizeArgs(_args) {
|
|
53945
|
-
let
|
|
54594
|
+
let path8;
|
|
53946
54595
|
let schema2;
|
|
53947
54596
|
let options;
|
|
53948
54597
|
let callback;
|
|
@@ -53951,7 +54600,7 @@ function normalizeArgs(_args) {
|
|
|
53951
54600
|
callback = args.pop();
|
|
53952
54601
|
}
|
|
53953
54602
|
if (typeof args[0] === "string") {
|
|
53954
|
-
|
|
54603
|
+
path8 = args[0];
|
|
53955
54604
|
if (typeof args[2] === "object") {
|
|
53956
54605
|
schema2 = args[1];
|
|
53957
54606
|
options = args[2];
|
|
@@ -53960,7 +54609,7 @@ function normalizeArgs(_args) {
|
|
|
53960
54609
|
options = args[1];
|
|
53961
54610
|
}
|
|
53962
54611
|
} else {
|
|
53963
|
-
|
|
54612
|
+
path8 = "";
|
|
53964
54613
|
schema2 = args[0];
|
|
53965
54614
|
options = args[1];
|
|
53966
54615
|
}
|
|
@@ -53973,7 +54622,7 @@ function normalizeArgs(_args) {
|
|
|
53973
54622
|
schema2 = JSON.parse(JSON.stringify(schema2));
|
|
53974
54623
|
}
|
|
53975
54624
|
return {
|
|
53976
|
-
path:
|
|
54625
|
+
path: path8,
|
|
53977
54626
|
schema: schema2,
|
|
53978
54627
|
options,
|
|
53979
54628
|
callback
|
|
@@ -53994,18 +54643,18 @@ function resolveExternal(parser, options) {
|
|
|
53994
54643
|
return Promise.reject(e);
|
|
53995
54644
|
}
|
|
53996
54645
|
}
|
|
53997
|
-
function crawl(obj,
|
|
54646
|
+
function crawl(obj, path8, scopeBase, dynamicIdScope, $refs, options, seen, external) {
|
|
53998
54647
|
seen ||= /* @__PURE__ */ new Set();
|
|
53999
54648
|
let promises3 = [];
|
|
54000
54649
|
if (obj && typeof obj === "object" && !ArrayBuffer.isView(obj) && !seen.has(obj)) {
|
|
54001
54650
|
seen.add(obj);
|
|
54002
54651
|
const currentScopeBase = scopeBase;
|
|
54003
54652
|
if (ref_default.isExternal$Ref(obj)) {
|
|
54004
|
-
promises3.push(resolve$Ref(obj,
|
|
54653
|
+
promises3.push(resolve$Ref(obj, path8, currentScopeBase, dynamicIdScope, $refs, options));
|
|
54005
54654
|
}
|
|
54006
54655
|
const keys = Object.keys(obj);
|
|
54007
54656
|
for (const key of keys) {
|
|
54008
|
-
const keyPath = pointer_default.join(
|
|
54657
|
+
const keyPath = pointer_default.join(path8, key);
|
|
54009
54658
|
const value = obj[key];
|
|
54010
54659
|
const childScopeBase = dynamicIdScope && value && typeof value === "object" && !ArrayBuffer.isView(value) ? getSchemaBasePath(currentScopeBase, value) : currentScopeBase;
|
|
54011
54660
|
promises3 = promises3.concat(crawl(value, keyPath, childScopeBase, dynamicIdScope, $refs, options, seen, external));
|
|
@@ -54013,9 +54662,9 @@ function crawl(obj, path7, scopeBase, dynamicIdScope, $refs, options, seen, exte
|
|
|
54013
54662
|
}
|
|
54014
54663
|
return promises3;
|
|
54015
54664
|
}
|
|
54016
|
-
async function resolve$Ref($ref,
|
|
54665
|
+
async function resolve$Ref($ref, path8, scopeBase, dynamicIdScope, $refs, options) {
|
|
54017
54666
|
const shouldResolveOnCwd = options.dereference?.externalReferenceResolution === "root";
|
|
54018
|
-
const resolutionBase = shouldResolveOnCwd ? cwd() : dynamicIdScope ? scopeBase :
|
|
54667
|
+
const resolutionBase = shouldResolveOnCwd ? cwd() : dynamicIdScope ? scopeBase : path8;
|
|
54019
54668
|
const resolvedPath = resolve2(resolutionBase, $ref.$ref);
|
|
54020
54669
|
const withoutHash = stripHash(resolvedPath);
|
|
54021
54670
|
const ref = $refs._get$Ref(withoutHash);
|
|
@@ -54040,8 +54689,8 @@ async function resolve$Ref($ref, path7, scopeBase, dynamicIdScope, $refs, option
|
|
|
54040
54689
|
throw err;
|
|
54041
54690
|
}
|
|
54042
54691
|
if ($refs._$refs[withoutHash]) {
|
|
54043
|
-
err.source = decodeURI(stripHash(
|
|
54044
|
-
err.path = safePointerToPath(getHash(
|
|
54692
|
+
err.source = decodeURI(stripHash(path8));
|
|
54693
|
+
err.path = safePointerToPath(getHash(path8));
|
|
54045
54694
|
}
|
|
54046
54695
|
return [];
|
|
54047
54696
|
}
|
|
@@ -54060,14 +54709,14 @@ function bundle(parser, options) {
|
|
|
54060
54709
|
fixRefsThroughRefs(inventory, parser.schema);
|
|
54061
54710
|
}
|
|
54062
54711
|
}
|
|
54063
|
-
function crawl2(parent, key,
|
|
54712
|
+
function crawl2(parent, key, path8, scopeBase, dynamicIdScope, pathFromRoot, indirections, inventory, $refs, options) {
|
|
54064
54713
|
const obj = key === null ? parent : parent[key];
|
|
54065
54714
|
const bundleOptions = options.bundle || {};
|
|
54066
54715
|
const isExcludedPath = bundleOptions.excludedPathMatcher || (() => false);
|
|
54067
54716
|
if (obj && typeof obj === "object" && !ArrayBuffer.isView(obj) && !isExcludedPath(pathFromRoot)) {
|
|
54068
54717
|
const currentScopeBase = scopeBase;
|
|
54069
54718
|
if (ref_default.isAllowed$Ref(obj)) {
|
|
54070
|
-
inventory$Ref(parent, key,
|
|
54719
|
+
inventory$Ref(parent, key, path8, currentScopeBase, dynamicIdScope, pathFromRoot, indirections, inventory, $refs, options);
|
|
54071
54720
|
} else {
|
|
54072
54721
|
const keys = Object.keys(obj).sort((a, b) => {
|
|
54073
54722
|
if (a === "definitions" || a === "$defs") {
|
|
@@ -54079,7 +54728,7 @@ function crawl2(parent, key, path7, scopeBase, dynamicIdScope, pathFromRoot, ind
|
|
|
54079
54728
|
}
|
|
54080
54729
|
});
|
|
54081
54730
|
for (const key2 of keys) {
|
|
54082
|
-
const keyPath = pointer_default.join(
|
|
54731
|
+
const keyPath = pointer_default.join(path8, key2);
|
|
54083
54732
|
const keyPathFromRoot = pointer_default.join(pathFromRoot, key2);
|
|
54084
54733
|
const value = obj[key2];
|
|
54085
54734
|
const childScopeBase = dynamicIdScope && value && typeof value === "object" && !ArrayBuffer.isView(value) ? getSchemaBasePath(currentScopeBase, value) : currentScopeBase;
|
|
@@ -54097,9 +54746,9 @@ function crawl2(parent, key, path7, scopeBase, dynamicIdScope, pathFromRoot, ind
|
|
|
54097
54746
|
}
|
|
54098
54747
|
}
|
|
54099
54748
|
}
|
|
54100
|
-
function inventory$Ref($refParent, $refKey,
|
|
54749
|
+
function inventory$Ref($refParent, $refKey, path8, scopeBase, dynamicIdScope, pathFromRoot, indirections, inventory, $refs, options) {
|
|
54101
54750
|
const $ref = $refKey === null ? $refParent : $refParent[$refKey];
|
|
54102
|
-
const $refPath = resolve2(dynamicIdScope ? scopeBase :
|
|
54751
|
+
const $refPath = resolve2(dynamicIdScope ? scopeBase : path8, $ref.$ref);
|
|
54103
54752
|
const pointer = $refs._resolve($refPath, pathFromRoot, options);
|
|
54104
54753
|
if (pointer === null) {
|
|
54105
54754
|
return;
|
|
@@ -54259,11 +54908,11 @@ function resolvePathThroughRefs(schema2, refPath) {
|
|
|
54259
54908
|
const result = "#/" + resolvedSegments.join("/");
|
|
54260
54909
|
return result;
|
|
54261
54910
|
}
|
|
54262
|
-
function walkPath(schema2,
|
|
54263
|
-
if (!
|
|
54911
|
+
function walkPath(schema2, path8) {
|
|
54912
|
+
if (!path8.startsWith("#/")) {
|
|
54264
54913
|
return void 0;
|
|
54265
54914
|
}
|
|
54266
|
-
const segments2 =
|
|
54915
|
+
const segments2 = path8.slice(2).split("/");
|
|
54267
54916
|
let current = schema2;
|
|
54268
54917
|
for (const seg of segments2) {
|
|
54269
54918
|
if (current === null || current === void 0 || typeof current !== "object") {
|
|
@@ -54299,7 +54948,7 @@ function dereference(parser, options) {
|
|
|
54299
54948
|
parser.$refs.circular = dereferenced.circular;
|
|
54300
54949
|
parser.schema = dereferenced.value;
|
|
54301
54950
|
}
|
|
54302
|
-
function crawl3(obj,
|
|
54951
|
+
function crawl3(obj, path8, scopeBase, dynamicIdScope, pathFromRoot, parents, processedObjects, dereferencedCache, $refs, options, startTime, depth) {
|
|
54303
54952
|
let dereferenced;
|
|
54304
54953
|
const result = {
|
|
54305
54954
|
value: obj,
|
|
@@ -54318,13 +54967,13 @@ function crawl3(obj, path7, scopeBase, dynamicIdScope, pathFromRoot, parents, pr
|
|
|
54318
54967
|
processedObjects.add(obj);
|
|
54319
54968
|
const currentScopeBase = scopeBase;
|
|
54320
54969
|
if (ref_default.isAllowed$Ref(obj, options)) {
|
|
54321
|
-
dereferenced = dereference$Ref(obj,
|
|
54970
|
+
dereferenced = dereference$Ref(obj, path8, currentScopeBase, dynamicIdScope, pathFromRoot, parents, processedObjects, dereferencedCache, $refs, options, startTime, depth);
|
|
54322
54971
|
result.circular = dereferenced.circular;
|
|
54323
54972
|
result.value = dereferenced.value;
|
|
54324
54973
|
} else {
|
|
54325
54974
|
for (const key of Object.keys(obj)) {
|
|
54326
54975
|
checkDereferenceTimeout(startTime, options);
|
|
54327
|
-
const keyPath = pointer_default.join(
|
|
54976
|
+
const keyPath = pointer_default.join(path8, key);
|
|
54328
54977
|
const keyPathFromRoot = pointer_default.join(pathFromRoot, key);
|
|
54329
54978
|
if (isExcludedPath(keyPathFromRoot)) {
|
|
54330
54979
|
continue;
|
|
@@ -54379,10 +55028,10 @@ function crawl3(obj, path7, scopeBase, dynamicIdScope, pathFromRoot, parents, pr
|
|
|
54379
55028
|
}
|
|
54380
55029
|
return result;
|
|
54381
55030
|
}
|
|
54382
|
-
function dereference$Ref($ref,
|
|
55031
|
+
function dereference$Ref($ref, path8, scopeBase, dynamicIdScope, pathFromRoot, parents, processedObjects, dereferencedCache, $refs, options, startTime, depth) {
|
|
54383
55032
|
const isExternalRef = ref_default.isExternal$Ref($ref);
|
|
54384
55033
|
const shouldResolveOnCwd = isExternalRef && options?.dereference?.externalReferenceResolution === "root";
|
|
54385
|
-
const resolutionBase = shouldResolveOnCwd ? cwd() : dynamicIdScope ? scopeBase :
|
|
55034
|
+
const resolutionBase = shouldResolveOnCwd ? cwd() : dynamicIdScope ? scopeBase : path8;
|
|
54386
55035
|
const $refPath = resolve2(resolutionBase, $ref.$ref);
|
|
54387
55036
|
const cache = dereferencedCache.get($refPath);
|
|
54388
55037
|
if (cache) {
|
|
@@ -54404,16 +55053,16 @@ function dereference$Ref($ref, path7, scopeBase, dynamicIdScope, pathFromRoot, p
|
|
|
54404
55053
|
}
|
|
54405
55054
|
if (typeof cache.value === "object" && "$ref" in cache.value && "$ref" in $ref) {
|
|
54406
55055
|
if (cache.value.$ref === $ref.$ref) {
|
|
54407
|
-
foundCircularReference(
|
|
55056
|
+
foundCircularReference(path8, $refs, options);
|
|
54408
55057
|
return cache;
|
|
54409
55058
|
} else {
|
|
54410
55059
|
}
|
|
54411
55060
|
} else {
|
|
54412
|
-
foundCircularReference(
|
|
55061
|
+
foundCircularReference(path8, $refs, options);
|
|
54413
55062
|
return cache;
|
|
54414
55063
|
}
|
|
54415
55064
|
}
|
|
54416
|
-
const pointer = $refs._resolve($refPath,
|
|
55065
|
+
const pointer = $refs._resolve($refPath, path8, options);
|
|
54417
55066
|
if (pointer === null) {
|
|
54418
55067
|
return {
|
|
54419
55068
|
circular: false,
|
|
@@ -54423,7 +55072,7 @@ function dereference$Ref($ref, path7, scopeBase, dynamicIdScope, pathFromRoot, p
|
|
|
54423
55072
|
const directCircular = pointer.circular;
|
|
54424
55073
|
let circular = directCircular || parents.has(pointer.value);
|
|
54425
55074
|
if (circular) {
|
|
54426
|
-
foundCircularReference(
|
|
55075
|
+
foundCircularReference(path8, $refs, options);
|
|
54427
55076
|
}
|
|
54428
55077
|
let dereferencedValue = ref_default.dereference($ref, pointer.value, options);
|
|
54429
55078
|
if (!circular) {
|
|
@@ -60831,7 +61480,7 @@ function hasInvalidPaths(api) {
|
|
|
60831
61480
|
if (!api.paths || typeof api.paths !== "object" || Array.isArray(api.paths)) {
|
|
60832
61481
|
return false;
|
|
60833
61482
|
}
|
|
60834
|
-
return Object.keys(api.paths).some((
|
|
61483
|
+
return Object.keys(api.paths).some((path8) => !path8.startsWith("/"));
|
|
60835
61484
|
}
|
|
60836
61485
|
function reduceAjvErrors(errors) {
|
|
60837
61486
|
const flattened = /* @__PURE__ */ new Map();
|
|
@@ -60916,7 +61565,7 @@ function validateSchema(api, options = {}, suppressedInstancePaths = []) {
|
|
|
60916
61565
|
}
|
|
60917
61566
|
let additionalErrors = 0;
|
|
60918
61567
|
let reducedErrors = reduceAjvErrors(ajv.errors).filter((err) => {
|
|
60919
|
-
return !suppressedInstancePaths.some((
|
|
61568
|
+
return !suppressedInstancePaths.some((path8) => err.instancePath === path8 || err.instancePath.startsWith(`${path8}/`));
|
|
60920
61569
|
});
|
|
60921
61570
|
if (!reducedErrors.length) {
|
|
60922
61571
|
return { valid: true, warnings: [], specification: specificationName };
|
|
@@ -60967,9 +61616,9 @@ var SpecificationValidator = class {
|
|
|
60967
61616
|
reportWarning(message) {
|
|
60968
61617
|
this.warnings.push({ message });
|
|
60969
61618
|
}
|
|
60970
|
-
flagInstancePath(
|
|
60971
|
-
if (!this.flaggedInstancePaths.includes(
|
|
60972
|
-
this.flaggedInstancePaths.push(
|
|
61619
|
+
flagInstancePath(path8) {
|
|
61620
|
+
if (!this.flaggedInstancePaths.includes(path8)) {
|
|
61621
|
+
this.flaggedInstancePaths.push(path8);
|
|
60973
61622
|
}
|
|
60974
61623
|
}
|
|
60975
61624
|
};
|
|
@@ -60987,10 +61636,10 @@ var OpenAPISpecificationValidator = class extends SpecificationValidator {
|
|
|
60987
61636
|
run() {
|
|
60988
61637
|
const operationIds = [];
|
|
60989
61638
|
Object.keys(this.api.paths || {}).forEach((pathName) => {
|
|
60990
|
-
const
|
|
61639
|
+
const path8 = this.api.paths[pathName];
|
|
60991
61640
|
const pathId = `/paths${pathName}`;
|
|
60992
|
-
if (
|
|
60993
|
-
this.validatePath(
|
|
61641
|
+
if (path8 && pathName.startsWith("/")) {
|
|
61642
|
+
this.validatePath(path8, pathId, operationIds);
|
|
60994
61643
|
}
|
|
60995
61644
|
});
|
|
60996
61645
|
if (isOpenAPI30(this.api)) {
|
|
@@ -61019,9 +61668,9 @@ var OpenAPISpecificationValidator = class extends SpecificationValidator {
|
|
|
61019
61668
|
* Validates the given path.
|
|
61020
61669
|
*
|
|
61021
61670
|
*/
|
|
61022
|
-
validatePath(
|
|
61671
|
+
validatePath(path8, pathId, operationIds) {
|
|
61023
61672
|
supportedHTTPMethods.forEach((operationName) => {
|
|
61024
|
-
const operation =
|
|
61673
|
+
const operation = path8[operationName];
|
|
61025
61674
|
const operationId = `${pathId}/${operationName}`;
|
|
61026
61675
|
if (operation) {
|
|
61027
61676
|
const declaredOperationId = operation.operationId;
|
|
@@ -61034,7 +61683,7 @@ var OpenAPISpecificationValidator = class extends SpecificationValidator {
|
|
|
61034
61683
|
this.reportError(`The operationId \`${declaredOperationId}\` is duplicated and must be made unique.`);
|
|
61035
61684
|
}
|
|
61036
61685
|
}
|
|
61037
|
-
this.validateParameters(
|
|
61686
|
+
this.validateParameters(path8, pathId, operation, operationId);
|
|
61038
61687
|
Object.keys(operation.responses || {}).forEach((responseCode) => {
|
|
61039
61688
|
const response = operation.responses[responseCode];
|
|
61040
61689
|
const responseId = `${operationId}/responses/${responseCode}`;
|
|
@@ -61049,8 +61698,8 @@ var OpenAPISpecificationValidator = class extends SpecificationValidator {
|
|
|
61049
61698
|
* Validates the parameters for the given operation.
|
|
61050
61699
|
*
|
|
61051
61700
|
*/
|
|
61052
|
-
validateParameters(
|
|
61053
|
-
const pathParams =
|
|
61701
|
+
validateParameters(path8, pathId, operation, operationId) {
|
|
61702
|
+
const pathParams = path8.parameters || [];
|
|
61054
61703
|
const operationParams = operation.parameters || [];
|
|
61055
61704
|
this.checkForDuplicates(pathParams, pathId);
|
|
61056
61705
|
this.checkForDuplicates(operationParams, operationId);
|
|
@@ -61349,10 +61998,10 @@ var SwaggerSpecificationValidator = class extends SpecificationValidator {
|
|
|
61349
61998
|
run() {
|
|
61350
61999
|
const operationIds = [];
|
|
61351
62000
|
Object.keys(this.api.paths || {}).forEach((pathName) => {
|
|
61352
|
-
const
|
|
62001
|
+
const path8 = this.api.paths[pathName];
|
|
61353
62002
|
const pathId = `/paths${pathName}`;
|
|
61354
|
-
if (
|
|
61355
|
-
this.validatePath(
|
|
62003
|
+
if (path8 && pathName.startsWith("/")) {
|
|
62004
|
+
this.validatePath(path8, pathId, operationIds);
|
|
61356
62005
|
}
|
|
61357
62006
|
});
|
|
61358
62007
|
Object.keys(this.api.definitions || {}).forEach((definitionName) => {
|
|
@@ -61370,9 +62019,9 @@ var SwaggerSpecificationValidator = class extends SpecificationValidator {
|
|
|
61370
62019
|
* Validates the given path.
|
|
61371
62020
|
*
|
|
61372
62021
|
*/
|
|
61373
|
-
validatePath(
|
|
62022
|
+
validatePath(path8, pathId, operationIds) {
|
|
61374
62023
|
swaggerHTTPMethods.forEach((operationName) => {
|
|
61375
|
-
const operation =
|
|
62024
|
+
const operation = path8[operationName];
|
|
61376
62025
|
const operationId = `${pathId}/${operationName}`;
|
|
61377
62026
|
if (operation) {
|
|
61378
62027
|
const declaredOperationId = operation.operationId;
|
|
@@ -61385,7 +62034,7 @@ var SwaggerSpecificationValidator = class extends SpecificationValidator {
|
|
|
61385
62034
|
this.reportError(`The operationId \`${declaredOperationId}\` is duplicated and must be made unique.`);
|
|
61386
62035
|
}
|
|
61387
62036
|
}
|
|
61388
|
-
this.validateParameters(
|
|
62037
|
+
this.validateParameters(path8, pathId, operation, operationId);
|
|
61389
62038
|
Object.keys(operation.responses || {}).forEach((responseName) => {
|
|
61390
62039
|
const response = operation.responses[responseName];
|
|
61391
62040
|
if ("$ref" in response || !response) {
|
|
@@ -61401,8 +62050,8 @@ var SwaggerSpecificationValidator = class extends SpecificationValidator {
|
|
|
61401
62050
|
* Validates the parameters for the given operation.
|
|
61402
62051
|
*
|
|
61403
62052
|
*/
|
|
61404
|
-
validateParameters(
|
|
61405
|
-
const pathParams = (
|
|
62053
|
+
validateParameters(path8, pathId, operation, operationId) {
|
|
62054
|
+
const pathParams = (path8.parameters || []).filter((param) => !("$ref" in param));
|
|
61406
62055
|
const operationParams = (operation.parameters || []).filter(
|
|
61407
62056
|
(param) => !("$ref" in param)
|
|
61408
62057
|
);
|
|
@@ -61981,29 +62630,29 @@ async function loadOpenApiContractSpec(specUrl, options = {}) {
|
|
|
61981
62630
|
async function loadOpenApiContractSpecFromPath(specPath, options = {}) {
|
|
61982
62631
|
if (!specPath) throw new Error("CONTRACT_SPEC_READ_FAILED: spec-path must not be empty");
|
|
61983
62632
|
const workspaceRoot = (() => {
|
|
61984
|
-
const root =
|
|
62633
|
+
const root = import_node_path2.default.resolve(process.env.GITHUB_WORKSPACE ?? process.cwd());
|
|
61985
62634
|
try {
|
|
61986
|
-
return (0,
|
|
62635
|
+
return (0, import_node_fs2.realpathSync)(root);
|
|
61987
62636
|
} catch {
|
|
61988
62637
|
return root;
|
|
61989
62638
|
}
|
|
61990
62639
|
})();
|
|
61991
|
-
const resolved =
|
|
62640
|
+
const resolved = import_node_path2.default.resolve(workspaceRoot, specPath);
|
|
61992
62641
|
let absolutePath;
|
|
61993
62642
|
try {
|
|
61994
|
-
absolutePath = (0,
|
|
62643
|
+
absolutePath = (0, import_node_fs2.realpathSync)(resolved);
|
|
61995
62644
|
} catch (error2) {
|
|
61996
62645
|
throw new Error(`CONTRACT_SPEC_READ_FAILED: Unable to read spec at ${specPath}`, { cause: error2 });
|
|
61997
62646
|
}
|
|
61998
|
-
const rel =
|
|
61999
|
-
if (!rel || rel.startsWith("..") ||
|
|
62647
|
+
const rel = import_node_path2.default.relative(workspaceRoot, absolutePath);
|
|
62648
|
+
if (!rel || rel.startsWith("..") || import_node_path2.default.isAbsolute(rel)) {
|
|
62000
62649
|
throw new Error(`CONTRACT_SPEC_READ_FAILED: spec-path must resolve inside ${workspaceRoot}, got: ${specPath}`);
|
|
62001
62650
|
}
|
|
62002
62651
|
const maxBytes = options.maxBytesPerResource ?? SAFE_FETCH_LIMITS.maxBytesPerResource;
|
|
62003
62652
|
const maxTotalBytes = options.maxTotalBytes ?? SAFE_FETCH_LIMITS.maxTotalBytes;
|
|
62004
62653
|
let onDiskBytes;
|
|
62005
62654
|
try {
|
|
62006
|
-
onDiskBytes = (await (0,
|
|
62655
|
+
onDiskBytes = (await (0, import_promises3.stat)(absolutePath)).size;
|
|
62007
62656
|
} catch (error2) {
|
|
62008
62657
|
throw new Error(`CONTRACT_SPEC_READ_FAILED: Unable to read spec at ${specPath}`, { cause: error2 });
|
|
62009
62658
|
}
|
|
@@ -62016,7 +62665,7 @@ async function loadOpenApiContractSpecFromPath(specPath, options = {}) {
|
|
|
62016
62665
|
}
|
|
62017
62666
|
let content;
|
|
62018
62667
|
try {
|
|
62019
|
-
content = await (0,
|
|
62668
|
+
content = await (0, import_promises3.readFile)(absolutePath, "utf8");
|
|
62020
62669
|
} catch (error2) {
|
|
62021
62670
|
throw new Error(`CONTRACT_SPEC_READ_FAILED: Unable to read spec at ${specPath}`, { cause: error2 });
|
|
62022
62671
|
}
|
|
@@ -62078,6 +62727,13 @@ function parseSpecSyncMode(value) {
|
|
|
62078
62727
|
}
|
|
62079
62728
|
throw new Error(`Unsupported spec-sync-mode "${v}". Supported values: ${allowed.join(", ")}`);
|
|
62080
62729
|
}
|
|
62730
|
+
function parseBreakingChangeMode(value) {
|
|
62731
|
+
return parseEnumInput(
|
|
62732
|
+
"breaking-change-mode",
|
|
62733
|
+
value,
|
|
62734
|
+
customerPreviewActionContract.inputs["breaking-change-mode"].default ?? "off"
|
|
62735
|
+
);
|
|
62736
|
+
}
|
|
62081
62737
|
function parseEnumInput(name, value, defaultValue) {
|
|
62082
62738
|
const allowed = customerPreviewActionContract.inputs[name].allowedValues ?? [];
|
|
62083
62739
|
const v = value?.trim() || defaultValue;
|
|
@@ -62183,6 +62839,12 @@ function resolveInputs(env = process.env) {
|
|
|
62183
62839
|
specUrl,
|
|
62184
62840
|
specPath,
|
|
62185
62841
|
openapiVersion: resolveOpenapiVersion(getInput2("openapi-version", env)),
|
|
62842
|
+
breakingChangeMode: parseBreakingChangeMode(getInput2("breaking-change-mode", env)),
|
|
62843
|
+
breakingBaselineSpecPath: getInput2("breaking-baseline-spec-path", env),
|
|
62844
|
+
breakingRulesPath: getInput2("breaking-rules-path", env) ?? customerPreviewActionContract.inputs["breaking-rules-path"].default,
|
|
62845
|
+
breakingTargetRef: getInput2("breaking-target-ref", env),
|
|
62846
|
+
breakingSummaryPath: getInput2("breaking-summary-path", env),
|
|
62847
|
+
breakingLogPath: getInput2("breaking-log-path", env),
|
|
62186
62848
|
governanceMappingJson: parseGovernanceMappingJson(getInput2("governance-mapping-json", env)),
|
|
62187
62849
|
postmanApiKey: getInput2("postman-api-key", env) ?? "",
|
|
62188
62850
|
postmanAccessToken: getInput2("postman-access-token", env),
|
|
@@ -62223,6 +62885,17 @@ function createPlannedOutputs(inputs) {
|
|
|
62223
62885
|
total: 0,
|
|
62224
62886
|
violations: [],
|
|
62225
62887
|
warnings: 0
|
|
62888
|
+
}),
|
|
62889
|
+
"breaking-change-status": "skipped",
|
|
62890
|
+
"breaking-change-summary-json": JSON.stringify({
|
|
62891
|
+
breakingChanges: 0,
|
|
62892
|
+
comparison: "",
|
|
62893
|
+
exitCode: 0,
|
|
62894
|
+
logPath: "",
|
|
62895
|
+
message: "Breaking-change check is disabled.",
|
|
62896
|
+
mode: inputs.breakingChangeMode,
|
|
62897
|
+
status: "skipped",
|
|
62898
|
+
summaryPath: ""
|
|
62226
62899
|
})
|
|
62227
62900
|
};
|
|
62228
62901
|
}
|
|
@@ -62277,6 +62950,12 @@ function readActionInputs(actionCore) {
|
|
|
62277
62950
|
INPUT_NESTED_FOLDER_HIERARCHY: optionalInput(actionCore, "nested-folder-hierarchy") ?? customerPreviewActionContract.inputs["nested-folder-hierarchy"].default,
|
|
62278
62951
|
INPUT_REQUEST_NAME_SOURCE: optionalInput(actionCore, "request-name-source") ?? customerPreviewActionContract.inputs["request-name-source"].default,
|
|
62279
62952
|
INPUT_OPENAPI_VERSION: optionalInput(actionCore, "openapi-version") ?? "",
|
|
62953
|
+
INPUT_BREAKING_CHANGE_MODE: optionalInput(actionCore, "breaking-change-mode") ?? customerPreviewActionContract.inputs["breaking-change-mode"].default,
|
|
62954
|
+
INPUT_BREAKING_BASELINE_SPEC_PATH: optionalInput(actionCore, "breaking-baseline-spec-path"),
|
|
62955
|
+
INPUT_BREAKING_RULES_PATH: optionalInput(actionCore, "breaking-rules-path") ?? customerPreviewActionContract.inputs["breaking-rules-path"].default,
|
|
62956
|
+
INPUT_BREAKING_TARGET_REF: optionalInput(actionCore, "breaking-target-ref"),
|
|
62957
|
+
INPUT_BREAKING_SUMMARY_PATH: optionalInput(actionCore, "breaking-summary-path"),
|
|
62958
|
+
INPUT_BREAKING_LOG_PATH: optionalInput(actionCore, "breaking-log-path"),
|
|
62280
62959
|
INPUT_POSTMAN_STACK: optionalInput(actionCore, "postman-stack") ?? customerPreviewActionContract.inputs["postman-stack"].default,
|
|
62281
62960
|
INPUT_GITHUB_TOKEN: githubToken,
|
|
62282
62961
|
INPUT_GH_FALLBACK_TOKEN: ghFallbackToken
|
|
@@ -62423,7 +63102,7 @@ function createAssetProjectName(inputs, releaseLabel) {
|
|
|
62423
63102
|
}
|
|
62424
63103
|
function readResourcesState() {
|
|
62425
63104
|
try {
|
|
62426
|
-
return (0, import_yaml3.parse)((0,
|
|
63105
|
+
return (0, import_yaml3.parse)((0, import_node_fs3.readFileSync)(".postman/resources.yaml", "utf8"));
|
|
62427
63106
|
} catch {
|
|
62428
63107
|
return null;
|
|
62429
63108
|
}
|
|
@@ -62569,6 +63248,7 @@ async function runBootstrap(inputs, dependencies) {
|
|
|
62569
63248
|
let previousSpecRollbackHash;
|
|
62570
63249
|
let detectedOpenapiVersion = "3.0";
|
|
62571
63250
|
let contractIndex;
|
|
63251
|
+
let sourceSpecContent = "";
|
|
62572
63252
|
const specContent = await runGroup(
|
|
62573
63253
|
dependencies.core,
|
|
62574
63254
|
"Preflight OpenAPI Contract",
|
|
@@ -62577,6 +63257,7 @@ async function runBootstrap(inputs, dependencies) {
|
|
|
62577
63257
|
fetchText: dependencies.specFetcher === fetch ? void 0 : async (url) => fetchSpecDocument(url, dependencies.specFetcher)
|
|
62578
63258
|
};
|
|
62579
63259
|
const loaded = inputs.specPath ? await loadOpenApiContractSpecFromPath(inputs.specPath, loaderOptions) : await loadOpenApiContractSpec(inputs.specUrl, loaderOptions);
|
|
63260
|
+
sourceSpecContent = loaded.content;
|
|
62580
63261
|
const document = normalizeSpecDocument(
|
|
62581
63262
|
loaded.bundledContent,
|
|
62582
63263
|
(msg) => dependencies.core.warning(msg)
|
|
@@ -62603,7 +63284,7 @@ async function runBootstrap(inputs, dependencies) {
|
|
|
62603
63284
|
previousRaw,
|
|
62604
63285
|
(msg) => dependencies.core.warning(`Previous spec normalization: ${msg}`)
|
|
62605
63286
|
);
|
|
62606
|
-
previousSpecRollbackHash = (0,
|
|
63287
|
+
previousSpecRollbackHash = (0, import_node_crypto2.createHash)("sha256").update(previousSpecContent).digest("hex");
|
|
62607
63288
|
const existingSpecType = normalizeSpecTypeFromContent(previousSpecContent);
|
|
62608
63289
|
if (existingSpecType !== incomingSpecType) {
|
|
62609
63290
|
throw new Error(
|
|
@@ -62617,6 +63298,38 @@ async function runBootstrap(inputs, dependencies) {
|
|
|
62617
63298
|
return document;
|
|
62618
63299
|
}
|
|
62619
63300
|
);
|
|
63301
|
+
const breakingChangeResult = await runGroup(
|
|
63302
|
+
dependencies.core,
|
|
63303
|
+
"OpenAPI Breaking Change Check",
|
|
63304
|
+
async () => (dependencies.openApiChanges ?? runOpenApiBreakingChangeCheck)(
|
|
63305
|
+
{
|
|
63306
|
+
baselineSpecPath: inputs.breakingBaselineSpecPath,
|
|
63307
|
+
currentSourceContent: sourceSpecContent,
|
|
63308
|
+
currentUploadContent: specContent,
|
|
63309
|
+
logPath: inputs.breakingLogPath,
|
|
63310
|
+
mode: inputs.breakingChangeMode,
|
|
63311
|
+
previousSpecContent,
|
|
63312
|
+
rulesPath: inputs.breakingRulesPath,
|
|
63313
|
+
specPath: inputs.specPath,
|
|
63314
|
+
summaryPath: inputs.breakingSummaryPath,
|
|
63315
|
+
targetRef: inputs.breakingTargetRef
|
|
63316
|
+
},
|
|
63317
|
+
{
|
|
63318
|
+
core: dependencies.core,
|
|
63319
|
+
env: process.env,
|
|
63320
|
+
exec: dependencies.exec
|
|
63321
|
+
}
|
|
63322
|
+
)
|
|
63323
|
+
);
|
|
63324
|
+
outputs["breaking-change-status"] = breakingChangeResult.status;
|
|
63325
|
+
outputs["breaking-change-summary-json"] = createBreakingChangeSummaryJson(breakingChangeResult);
|
|
63326
|
+
if (breakingChangeResult.status === "failed") {
|
|
63327
|
+
dependencies.core.setOutput("breaking-change-status", outputs["breaking-change-status"]);
|
|
63328
|
+
dependencies.core.setOutput("breaking-change-summary-json", outputs["breaking-change-summary-json"]);
|
|
63329
|
+
throw new Error(
|
|
63330
|
+
`OpenAPI breaking-change check failed: ${breakingChangeResult.message || "breaking changes detected"}`
|
|
63331
|
+
);
|
|
63332
|
+
}
|
|
62620
63333
|
let explicitWorkspaceId = inputs.workspaceId;
|
|
62621
63334
|
if (!explicitWorkspaceId && resourcesState?.workspace?.id) {
|
|
62622
63335
|
explicitWorkspaceId = resourcesState.workspace.id;
|
|
@@ -62717,6 +63430,13 @@ For CLI usage, pass --workspace-team-id <id> or export POSTMAN_WORKSPACE_TEAM_ID
|
|
|
62717
63430
|
async () => dependencies.postman.createWorkspace(workspaceName, aboutText, workspaceTeamId)
|
|
62718
63431
|
);
|
|
62719
63432
|
workspaceId = workspace.id;
|
|
63433
|
+
} else {
|
|
63434
|
+
const visibility = await dependencies.postman.getWorkspaceVisibility(workspaceId);
|
|
63435
|
+
if (visibility && visibility !== "team") {
|
|
63436
|
+
dependencies.core.warning(
|
|
63437
|
+
`Workspace ${workspaceId} has visibility '${visibility}', so it does not appear in the API Catalog and teammates or other API keys cannot see it. This usually means an org-mode run created it without workspace-team-id. Recreate it with workspace-team-id set (delete the workspace and clear the POSTMAN_WORKSPACE_ID repository variable), or share it to the team from Workspace Settings.`
|
|
63438
|
+
);
|
|
63439
|
+
}
|
|
62720
63440
|
}
|
|
62721
63441
|
outputs["workspace-id"] = workspaceId || "";
|
|
62722
63442
|
outputs["workspace-url"] = `https://go.postman.co/workspace/${workspaceId}`;
|