@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/index.cjs
CHANGED
|
@@ -1069,14 +1069,14 @@ var require_util = __commonJS({
|
|
|
1069
1069
|
}
|
|
1070
1070
|
const port = url.port != null ? url.port : url.protocol === "https:" ? 443 : 80;
|
|
1071
1071
|
let origin = url.origin != null ? url.origin : `${url.protocol || ""}//${url.hostname || ""}:${port}`;
|
|
1072
|
-
let
|
|
1072
|
+
let path8 = url.path != null ? url.path : `${url.pathname || ""}${url.search || ""}`;
|
|
1073
1073
|
if (origin[origin.length - 1] === "/") {
|
|
1074
1074
|
origin = origin.slice(0, origin.length - 1);
|
|
1075
1075
|
}
|
|
1076
|
-
if (
|
|
1077
|
-
|
|
1076
|
+
if (path8 && path8[0] !== "/") {
|
|
1077
|
+
path8 = `/${path8}`;
|
|
1078
1078
|
}
|
|
1079
|
-
return new URL(`${origin}${
|
|
1079
|
+
return new URL(`${origin}${path8}`);
|
|
1080
1080
|
}
|
|
1081
1081
|
if (!isHttpOrHttpsPrefixed(url.origin || url.protocol)) {
|
|
1082
1082
|
throw new InvalidArgumentError("Invalid URL protocol: the URL must start with `http:` or `https:`.");
|
|
@@ -1527,39 +1527,39 @@ var require_diagnostics = __commonJS({
|
|
|
1527
1527
|
});
|
|
1528
1528
|
diagnosticsChannel.channel("undici:client:sendHeaders").subscribe((evt) => {
|
|
1529
1529
|
const {
|
|
1530
|
-
request: { method, path:
|
|
1530
|
+
request: { method, path: path8, origin }
|
|
1531
1531
|
} = evt;
|
|
1532
|
-
debuglog("sending request to %s %s/%s", method, origin,
|
|
1532
|
+
debuglog("sending request to %s %s/%s", method, origin, path8);
|
|
1533
1533
|
});
|
|
1534
1534
|
diagnosticsChannel.channel("undici:request:headers").subscribe((evt) => {
|
|
1535
1535
|
const {
|
|
1536
|
-
request: { method, path:
|
|
1536
|
+
request: { method, path: path8, origin },
|
|
1537
1537
|
response: { statusCode }
|
|
1538
1538
|
} = evt;
|
|
1539
1539
|
debuglog(
|
|
1540
1540
|
"received response to %s %s/%s - HTTP %d",
|
|
1541
1541
|
method,
|
|
1542
1542
|
origin,
|
|
1543
|
-
|
|
1543
|
+
path8,
|
|
1544
1544
|
statusCode
|
|
1545
1545
|
);
|
|
1546
1546
|
});
|
|
1547
1547
|
diagnosticsChannel.channel("undici:request:trailers").subscribe((evt) => {
|
|
1548
1548
|
const {
|
|
1549
|
-
request: { method, path:
|
|
1549
|
+
request: { method, path: path8, origin }
|
|
1550
1550
|
} = evt;
|
|
1551
|
-
debuglog("trailers received from %s %s/%s", method, origin,
|
|
1551
|
+
debuglog("trailers received from %s %s/%s", method, origin, path8);
|
|
1552
1552
|
});
|
|
1553
1553
|
diagnosticsChannel.channel("undici:request:error").subscribe((evt) => {
|
|
1554
1554
|
const {
|
|
1555
|
-
request: { method, path:
|
|
1555
|
+
request: { method, path: path8, origin },
|
|
1556
1556
|
error: error2
|
|
1557
1557
|
} = evt;
|
|
1558
1558
|
debuglog(
|
|
1559
1559
|
"request to %s %s/%s errored - %s",
|
|
1560
1560
|
method,
|
|
1561
1561
|
origin,
|
|
1562
|
-
|
|
1562
|
+
path8,
|
|
1563
1563
|
error2.message
|
|
1564
1564
|
);
|
|
1565
1565
|
});
|
|
@@ -1608,9 +1608,9 @@ var require_diagnostics = __commonJS({
|
|
|
1608
1608
|
});
|
|
1609
1609
|
diagnosticsChannel.channel("undici:client:sendHeaders").subscribe((evt) => {
|
|
1610
1610
|
const {
|
|
1611
|
-
request: { method, path:
|
|
1611
|
+
request: { method, path: path8, origin }
|
|
1612
1612
|
} = evt;
|
|
1613
|
-
debuglog("sending request to %s %s/%s", method, origin,
|
|
1613
|
+
debuglog("sending request to %s %s/%s", method, origin, path8);
|
|
1614
1614
|
});
|
|
1615
1615
|
}
|
|
1616
1616
|
diagnosticsChannel.channel("undici:websocket:open").subscribe((evt) => {
|
|
@@ -1673,7 +1673,7 @@ var require_request = __commonJS({
|
|
|
1673
1673
|
var kHandler = /* @__PURE__ */ Symbol("handler");
|
|
1674
1674
|
var Request = class {
|
|
1675
1675
|
constructor(origin, {
|
|
1676
|
-
path:
|
|
1676
|
+
path: path8,
|
|
1677
1677
|
method,
|
|
1678
1678
|
body,
|
|
1679
1679
|
headers,
|
|
@@ -1688,11 +1688,11 @@ var require_request = __commonJS({
|
|
|
1688
1688
|
expectContinue,
|
|
1689
1689
|
servername
|
|
1690
1690
|
}, handler) {
|
|
1691
|
-
if (typeof
|
|
1691
|
+
if (typeof path8 !== "string") {
|
|
1692
1692
|
throw new InvalidArgumentError("path must be a string");
|
|
1693
|
-
} else if (
|
|
1693
|
+
} else if (path8[0] !== "/" && !(path8.startsWith("http://") || path8.startsWith("https://")) && method !== "CONNECT") {
|
|
1694
1694
|
throw new InvalidArgumentError("path must be an absolute URL or start with a slash");
|
|
1695
|
-
} else if (invalidPathRegex.test(
|
|
1695
|
+
} else if (invalidPathRegex.test(path8)) {
|
|
1696
1696
|
throw new InvalidArgumentError("invalid request path");
|
|
1697
1697
|
}
|
|
1698
1698
|
if (typeof method !== "string") {
|
|
@@ -1758,7 +1758,7 @@ var require_request = __commonJS({
|
|
|
1758
1758
|
this.completed = false;
|
|
1759
1759
|
this.aborted = false;
|
|
1760
1760
|
this.upgrade = upgrade || null;
|
|
1761
|
-
this.path = query ? buildURL(
|
|
1761
|
+
this.path = query ? buildURL(path8, query) : path8;
|
|
1762
1762
|
this.origin = origin;
|
|
1763
1763
|
this.idempotent = idempotent == null ? method === "HEAD" || method === "GET" : idempotent;
|
|
1764
1764
|
this.blocking = blocking == null ? false : blocking;
|
|
@@ -6322,7 +6322,7 @@ var require_client_h1 = __commonJS({
|
|
|
6322
6322
|
return method !== "GET" && method !== "HEAD" && method !== "OPTIONS" && method !== "TRACE" && method !== "CONNECT";
|
|
6323
6323
|
}
|
|
6324
6324
|
function writeH1(client, request) {
|
|
6325
|
-
const { method, path:
|
|
6325
|
+
const { method, path: path8, host, upgrade, blocking, reset } = request;
|
|
6326
6326
|
let { body, headers, contentLength } = request;
|
|
6327
6327
|
const expectsPayload = method === "PUT" || method === "POST" || method === "PATCH" || method === "QUERY" || method === "PROPFIND" || method === "PROPPATCH";
|
|
6328
6328
|
if (util.isFormDataLike(body)) {
|
|
@@ -6388,7 +6388,7 @@ var require_client_h1 = __commonJS({
|
|
|
6388
6388
|
if (blocking) {
|
|
6389
6389
|
socket[kBlocking] = true;
|
|
6390
6390
|
}
|
|
6391
|
-
let header = `${method} ${
|
|
6391
|
+
let header = `${method} ${path8} HTTP/1.1\r
|
|
6392
6392
|
`;
|
|
6393
6393
|
if (typeof host === "string") {
|
|
6394
6394
|
header += `host: ${host}\r
|
|
@@ -6914,7 +6914,7 @@ var require_client_h2 = __commonJS({
|
|
|
6914
6914
|
}
|
|
6915
6915
|
function writeH2(client, request) {
|
|
6916
6916
|
const session = client[kHTTP2Session];
|
|
6917
|
-
const { method, path:
|
|
6917
|
+
const { method, path: path8, host, upgrade, expectContinue, signal, headers: reqHeaders } = request;
|
|
6918
6918
|
let { body } = request;
|
|
6919
6919
|
if (upgrade) {
|
|
6920
6920
|
util.errorRequest(client, request, new Error("Upgrade not supported for H2"));
|
|
@@ -6981,7 +6981,7 @@ var require_client_h2 = __commonJS({
|
|
|
6981
6981
|
});
|
|
6982
6982
|
return true;
|
|
6983
6983
|
}
|
|
6984
|
-
headers[HTTP2_HEADER_PATH] =
|
|
6984
|
+
headers[HTTP2_HEADER_PATH] = path8;
|
|
6985
6985
|
headers[HTTP2_HEADER_SCHEME] = "https";
|
|
6986
6986
|
const expectsPayload = method === "PUT" || method === "POST" || method === "PATCH";
|
|
6987
6987
|
if (body && typeof body.read === "function") {
|
|
@@ -7334,9 +7334,9 @@ var require_redirect_handler = __commonJS({
|
|
|
7334
7334
|
return this.handler.onHeaders(statusCode, headers, resume, statusText);
|
|
7335
7335
|
}
|
|
7336
7336
|
const { origin, pathname, search } = util.parseURL(new URL(this.location, this.opts.origin && new URL(this.opts.path, this.opts.origin)));
|
|
7337
|
-
const
|
|
7337
|
+
const path8 = search ? `${pathname}${search}` : pathname;
|
|
7338
7338
|
this.opts.headers = cleanRequestHeaders(this.opts.headers, statusCode === 303, this.opts.origin !== origin);
|
|
7339
|
-
this.opts.path =
|
|
7339
|
+
this.opts.path = path8;
|
|
7340
7340
|
this.opts.origin = origin;
|
|
7341
7341
|
this.opts.maxRedirections = 0;
|
|
7342
7342
|
this.opts.query = null;
|
|
@@ -8571,10 +8571,10 @@ var require_proxy_agent = __commonJS({
|
|
|
8571
8571
|
};
|
|
8572
8572
|
const {
|
|
8573
8573
|
origin,
|
|
8574
|
-
path:
|
|
8574
|
+
path: path8 = "/",
|
|
8575
8575
|
headers = {}
|
|
8576
8576
|
} = opts;
|
|
8577
|
-
opts.path = origin +
|
|
8577
|
+
opts.path = origin + path8;
|
|
8578
8578
|
if (!("host" in headers) && !("Host" in headers)) {
|
|
8579
8579
|
const { host } = new URL3(origin);
|
|
8580
8580
|
headers.host = host;
|
|
@@ -10495,20 +10495,20 @@ var require_mock_utils = __commonJS({
|
|
|
10495
10495
|
}
|
|
10496
10496
|
return true;
|
|
10497
10497
|
}
|
|
10498
|
-
function safeUrl(
|
|
10499
|
-
if (typeof
|
|
10500
|
-
return
|
|
10498
|
+
function safeUrl(path8) {
|
|
10499
|
+
if (typeof path8 !== "string") {
|
|
10500
|
+
return path8;
|
|
10501
10501
|
}
|
|
10502
|
-
const pathSegments =
|
|
10502
|
+
const pathSegments = path8.split("?");
|
|
10503
10503
|
if (pathSegments.length !== 2) {
|
|
10504
|
-
return
|
|
10504
|
+
return path8;
|
|
10505
10505
|
}
|
|
10506
10506
|
const qp = new URLSearchParams(pathSegments.pop());
|
|
10507
10507
|
qp.sort();
|
|
10508
10508
|
return [...pathSegments, qp.toString()].join("?");
|
|
10509
10509
|
}
|
|
10510
|
-
function matchKey(mockDispatch2, { path:
|
|
10511
|
-
const pathMatch = matchValue(mockDispatch2.path,
|
|
10510
|
+
function matchKey(mockDispatch2, { path: path8, method, body, headers }) {
|
|
10511
|
+
const pathMatch = matchValue(mockDispatch2.path, path8);
|
|
10512
10512
|
const methodMatch = matchValue(mockDispatch2.method, method);
|
|
10513
10513
|
const bodyMatch = typeof mockDispatch2.body !== "undefined" ? matchValue(mockDispatch2.body, body) : true;
|
|
10514
10514
|
const headersMatch = matchHeaders(mockDispatch2, headers);
|
|
@@ -10530,7 +10530,7 @@ var require_mock_utils = __commonJS({
|
|
|
10530
10530
|
function getMockDispatch(mockDispatches, key) {
|
|
10531
10531
|
const basePath = key.query ? buildURL(key.path, key.query) : key.path;
|
|
10532
10532
|
const resolvedPath = typeof basePath === "string" ? safeUrl(basePath) : basePath;
|
|
10533
|
-
let matchedMockDispatches = mockDispatches.filter(({ consumed }) => !consumed).filter(({ path:
|
|
10533
|
+
let matchedMockDispatches = mockDispatches.filter(({ consumed }) => !consumed).filter(({ path: path8 }) => matchValue(safeUrl(path8), resolvedPath));
|
|
10534
10534
|
if (matchedMockDispatches.length === 0) {
|
|
10535
10535
|
throw new MockNotMatchedError(`Mock dispatch not matched for path '${resolvedPath}'`);
|
|
10536
10536
|
}
|
|
@@ -10568,9 +10568,9 @@ var require_mock_utils = __commonJS({
|
|
|
10568
10568
|
}
|
|
10569
10569
|
}
|
|
10570
10570
|
function buildKey(opts) {
|
|
10571
|
-
const { path:
|
|
10571
|
+
const { path: path8, method, body, headers, query } = opts;
|
|
10572
10572
|
return {
|
|
10573
|
-
path:
|
|
10573
|
+
path: path8,
|
|
10574
10574
|
method,
|
|
10575
10575
|
body,
|
|
10576
10576
|
headers,
|
|
@@ -11033,10 +11033,10 @@ var require_pending_interceptors_formatter = __commonJS({
|
|
|
11033
11033
|
}
|
|
11034
11034
|
format(pendingInterceptors) {
|
|
11035
11035
|
const withPrettyHeaders = pendingInterceptors.map(
|
|
11036
|
-
({ method, path:
|
|
11036
|
+
({ method, path: path8, data: { statusCode }, persist, times, timesInvoked, origin }) => ({
|
|
11037
11037
|
Method: method,
|
|
11038
11038
|
Origin: origin,
|
|
11039
|
-
Path:
|
|
11039
|
+
Path: path8,
|
|
11040
11040
|
"Status code": statusCode,
|
|
11041
11041
|
Persistent: persist ? PERSISTENT : NOT_PERSISTENT,
|
|
11042
11042
|
Invocations: timesInvoked,
|
|
@@ -11888,9 +11888,9 @@ var require_headers = __commonJS({
|
|
|
11888
11888
|
return array;
|
|
11889
11889
|
}
|
|
11890
11890
|
const iterator = this[kHeadersMap][Symbol.iterator]();
|
|
11891
|
-
const
|
|
11892
|
-
array[0] = [
|
|
11893
|
-
assert(
|
|
11891
|
+
const firstValue2 = iterator.next().value;
|
|
11892
|
+
array[0] = [firstValue2[0], firstValue2[1].value];
|
|
11893
|
+
assert(firstValue2[1].value !== null);
|
|
11894
11894
|
for (let i = 1, j = 0, right = 0, left = 0, pivot = 0, x, value; i < size; ++i) {
|
|
11895
11895
|
value = iterator.next().value;
|
|
11896
11896
|
x = array[i] = [value[0], value[1].value];
|
|
@@ -15917,9 +15917,9 @@ var require_util6 = __commonJS({
|
|
|
15917
15917
|
}
|
|
15918
15918
|
}
|
|
15919
15919
|
}
|
|
15920
|
-
function validateCookiePath(
|
|
15921
|
-
for (let i = 0; i <
|
|
15922
|
-
const code =
|
|
15920
|
+
function validateCookiePath(path8) {
|
|
15921
|
+
for (let i = 0; i < path8.length; ++i) {
|
|
15922
|
+
const code = path8.charCodeAt(i);
|
|
15923
15923
|
if (code < 32 || // exclude CTLs (0-31)
|
|
15924
15924
|
code === 127 || // DEL
|
|
15925
15925
|
code === 59) {
|
|
@@ -18596,11 +18596,11 @@ var require_undici = __commonJS({
|
|
|
18596
18596
|
if (typeof opts.path !== "string") {
|
|
18597
18597
|
throw new InvalidArgumentError("invalid opts.path");
|
|
18598
18598
|
}
|
|
18599
|
-
let
|
|
18599
|
+
let path8 = opts.path;
|
|
18600
18600
|
if (!opts.path.startsWith("/")) {
|
|
18601
|
-
|
|
18601
|
+
path8 = `/${path8}`;
|
|
18602
18602
|
}
|
|
18603
|
-
url = new URL(util.parseOrigin(url).origin +
|
|
18603
|
+
url = new URL(util.parseOrigin(url).origin + path8);
|
|
18604
18604
|
} else {
|
|
18605
18605
|
if (!opts) {
|
|
18606
18606
|
opts = typeof url === "object" ? url : {};
|
|
@@ -18748,17 +18748,17 @@ var require_visit = __commonJS({
|
|
|
18748
18748
|
visit.BREAK = BREAK;
|
|
18749
18749
|
visit.SKIP = SKIP;
|
|
18750
18750
|
visit.REMOVE = REMOVE;
|
|
18751
|
-
function visit_(key, node, visitor,
|
|
18752
|
-
const ctrl = callVisitor(key, node, visitor,
|
|
18751
|
+
function visit_(key, node, visitor, path8) {
|
|
18752
|
+
const ctrl = callVisitor(key, node, visitor, path8);
|
|
18753
18753
|
if (identity.isNode(ctrl) || identity.isPair(ctrl)) {
|
|
18754
|
-
replaceNode(key,
|
|
18755
|
-
return visit_(key, ctrl, visitor,
|
|
18754
|
+
replaceNode(key, path8, ctrl);
|
|
18755
|
+
return visit_(key, ctrl, visitor, path8);
|
|
18756
18756
|
}
|
|
18757
18757
|
if (typeof ctrl !== "symbol") {
|
|
18758
18758
|
if (identity.isCollection(node)) {
|
|
18759
|
-
|
|
18759
|
+
path8 = Object.freeze(path8.concat(node));
|
|
18760
18760
|
for (let i = 0; i < node.items.length; ++i) {
|
|
18761
|
-
const ci = visit_(i, node.items[i], visitor,
|
|
18761
|
+
const ci = visit_(i, node.items[i], visitor, path8);
|
|
18762
18762
|
if (typeof ci === "number")
|
|
18763
18763
|
i = ci - 1;
|
|
18764
18764
|
else if (ci === BREAK)
|
|
@@ -18769,13 +18769,13 @@ var require_visit = __commonJS({
|
|
|
18769
18769
|
}
|
|
18770
18770
|
}
|
|
18771
18771
|
} else if (identity.isPair(node)) {
|
|
18772
|
-
|
|
18773
|
-
const ck = visit_("key", node.key, visitor,
|
|
18772
|
+
path8 = Object.freeze(path8.concat(node));
|
|
18773
|
+
const ck = visit_("key", node.key, visitor, path8);
|
|
18774
18774
|
if (ck === BREAK)
|
|
18775
18775
|
return BREAK;
|
|
18776
18776
|
else if (ck === REMOVE)
|
|
18777
18777
|
node.key = null;
|
|
18778
|
-
const cv = visit_("value", node.value, visitor,
|
|
18778
|
+
const cv = visit_("value", node.value, visitor, path8);
|
|
18779
18779
|
if (cv === BREAK)
|
|
18780
18780
|
return BREAK;
|
|
18781
18781
|
else if (cv === REMOVE)
|
|
@@ -18796,17 +18796,17 @@ var require_visit = __commonJS({
|
|
|
18796
18796
|
visitAsync.BREAK = BREAK;
|
|
18797
18797
|
visitAsync.SKIP = SKIP;
|
|
18798
18798
|
visitAsync.REMOVE = REMOVE;
|
|
18799
|
-
async function visitAsync_(key, node, visitor,
|
|
18800
|
-
const ctrl = await callVisitor(key, node, visitor,
|
|
18799
|
+
async function visitAsync_(key, node, visitor, path8) {
|
|
18800
|
+
const ctrl = await callVisitor(key, node, visitor, path8);
|
|
18801
18801
|
if (identity.isNode(ctrl) || identity.isPair(ctrl)) {
|
|
18802
|
-
replaceNode(key,
|
|
18803
|
-
return visitAsync_(key, ctrl, visitor,
|
|
18802
|
+
replaceNode(key, path8, ctrl);
|
|
18803
|
+
return visitAsync_(key, ctrl, visitor, path8);
|
|
18804
18804
|
}
|
|
18805
18805
|
if (typeof ctrl !== "symbol") {
|
|
18806
18806
|
if (identity.isCollection(node)) {
|
|
18807
|
-
|
|
18807
|
+
path8 = Object.freeze(path8.concat(node));
|
|
18808
18808
|
for (let i = 0; i < node.items.length; ++i) {
|
|
18809
|
-
const ci = await visitAsync_(i, node.items[i], visitor,
|
|
18809
|
+
const ci = await visitAsync_(i, node.items[i], visitor, path8);
|
|
18810
18810
|
if (typeof ci === "number")
|
|
18811
18811
|
i = ci - 1;
|
|
18812
18812
|
else if (ci === BREAK)
|
|
@@ -18817,13 +18817,13 @@ var require_visit = __commonJS({
|
|
|
18817
18817
|
}
|
|
18818
18818
|
}
|
|
18819
18819
|
} else if (identity.isPair(node)) {
|
|
18820
|
-
|
|
18821
|
-
const ck = await visitAsync_("key", node.key, visitor,
|
|
18820
|
+
path8 = Object.freeze(path8.concat(node));
|
|
18821
|
+
const ck = await visitAsync_("key", node.key, visitor, path8);
|
|
18822
18822
|
if (ck === BREAK)
|
|
18823
18823
|
return BREAK;
|
|
18824
18824
|
else if (ck === REMOVE)
|
|
18825
18825
|
node.key = null;
|
|
18826
|
-
const cv = await visitAsync_("value", node.value, visitor,
|
|
18826
|
+
const cv = await visitAsync_("value", node.value, visitor, path8);
|
|
18827
18827
|
if (cv === BREAK)
|
|
18828
18828
|
return BREAK;
|
|
18829
18829
|
else if (cv === REMOVE)
|
|
@@ -18850,23 +18850,23 @@ var require_visit = __commonJS({
|
|
|
18850
18850
|
}
|
|
18851
18851
|
return visitor;
|
|
18852
18852
|
}
|
|
18853
|
-
function callVisitor(key, node, visitor,
|
|
18853
|
+
function callVisitor(key, node, visitor, path8) {
|
|
18854
18854
|
if (typeof visitor === "function")
|
|
18855
|
-
return visitor(key, node,
|
|
18855
|
+
return visitor(key, node, path8);
|
|
18856
18856
|
if (identity.isMap(node))
|
|
18857
|
-
return visitor.Map?.(key, node,
|
|
18857
|
+
return visitor.Map?.(key, node, path8);
|
|
18858
18858
|
if (identity.isSeq(node))
|
|
18859
|
-
return visitor.Seq?.(key, node,
|
|
18859
|
+
return visitor.Seq?.(key, node, path8);
|
|
18860
18860
|
if (identity.isPair(node))
|
|
18861
|
-
return visitor.Pair?.(key, node,
|
|
18861
|
+
return visitor.Pair?.(key, node, path8);
|
|
18862
18862
|
if (identity.isScalar(node))
|
|
18863
|
-
return visitor.Scalar?.(key, node,
|
|
18863
|
+
return visitor.Scalar?.(key, node, path8);
|
|
18864
18864
|
if (identity.isAlias(node))
|
|
18865
|
-
return visitor.Alias?.(key, node,
|
|
18865
|
+
return visitor.Alias?.(key, node, path8);
|
|
18866
18866
|
return void 0;
|
|
18867
18867
|
}
|
|
18868
|
-
function replaceNode(key,
|
|
18869
|
-
const parent =
|
|
18868
|
+
function replaceNode(key, path8, node) {
|
|
18869
|
+
const parent = path8[path8.length - 1];
|
|
18870
18870
|
if (identity.isCollection(parent)) {
|
|
18871
18871
|
parent.items[key] = node;
|
|
18872
18872
|
} else if (identity.isPair(parent)) {
|
|
@@ -19476,10 +19476,10 @@ var require_Collection = __commonJS({
|
|
|
19476
19476
|
var createNode = require_createNode();
|
|
19477
19477
|
var identity = require_identity();
|
|
19478
19478
|
var Node = require_Node();
|
|
19479
|
-
function collectionFromPath(schema2,
|
|
19479
|
+
function collectionFromPath(schema2, path8, value) {
|
|
19480
19480
|
let v = value;
|
|
19481
|
-
for (let i =
|
|
19482
|
-
const k =
|
|
19481
|
+
for (let i = path8.length - 1; i >= 0; --i) {
|
|
19482
|
+
const k = path8[i];
|
|
19483
19483
|
if (typeof k === "number" && Number.isInteger(k) && k >= 0) {
|
|
19484
19484
|
const a = [];
|
|
19485
19485
|
a[k] = v;
|
|
@@ -19498,7 +19498,7 @@ var require_Collection = __commonJS({
|
|
|
19498
19498
|
sourceObjects: /* @__PURE__ */ new Map()
|
|
19499
19499
|
});
|
|
19500
19500
|
}
|
|
19501
|
-
var isEmptyPath = (
|
|
19501
|
+
var isEmptyPath = (path8) => path8 == null || typeof path8 === "object" && !!path8[Symbol.iterator]().next().done;
|
|
19502
19502
|
var Collection = class extends Node.NodeBase {
|
|
19503
19503
|
constructor(type2, schema2) {
|
|
19504
19504
|
super(type2);
|
|
@@ -19528,11 +19528,11 @@ var require_Collection = __commonJS({
|
|
|
19528
19528
|
* be a Pair instance or a `{ key, value }` object, which may not have a key
|
|
19529
19529
|
* that already exists in the map.
|
|
19530
19530
|
*/
|
|
19531
|
-
addIn(
|
|
19532
|
-
if (isEmptyPath(
|
|
19531
|
+
addIn(path8, value) {
|
|
19532
|
+
if (isEmptyPath(path8))
|
|
19533
19533
|
this.add(value);
|
|
19534
19534
|
else {
|
|
19535
|
-
const [key, ...rest] =
|
|
19535
|
+
const [key, ...rest] = path8;
|
|
19536
19536
|
const node = this.get(key, true);
|
|
19537
19537
|
if (identity.isCollection(node))
|
|
19538
19538
|
node.addIn(rest, value);
|
|
@@ -19546,8 +19546,8 @@ var require_Collection = __commonJS({
|
|
|
19546
19546
|
* Removes a value from the collection.
|
|
19547
19547
|
* @returns `true` if the item was found and removed.
|
|
19548
19548
|
*/
|
|
19549
|
-
deleteIn(
|
|
19550
|
-
const [key, ...rest] =
|
|
19549
|
+
deleteIn(path8) {
|
|
19550
|
+
const [key, ...rest] = path8;
|
|
19551
19551
|
if (rest.length === 0)
|
|
19552
19552
|
return this.delete(key);
|
|
19553
19553
|
const node = this.get(key, true);
|
|
@@ -19561,8 +19561,8 @@ var require_Collection = __commonJS({
|
|
|
19561
19561
|
* scalar values from their surrounding node; to disable set `keepScalar` to
|
|
19562
19562
|
* `true` (collections are always returned intact).
|
|
19563
19563
|
*/
|
|
19564
|
-
getIn(
|
|
19565
|
-
const [key, ...rest] =
|
|
19564
|
+
getIn(path8, keepScalar) {
|
|
19565
|
+
const [key, ...rest] = path8;
|
|
19566
19566
|
const node = this.get(key, true);
|
|
19567
19567
|
if (rest.length === 0)
|
|
19568
19568
|
return !keepScalar && identity.isScalar(node) ? node.value : node;
|
|
@@ -19580,8 +19580,8 @@ var require_Collection = __commonJS({
|
|
|
19580
19580
|
/**
|
|
19581
19581
|
* Checks if the collection includes a value with the key `key`.
|
|
19582
19582
|
*/
|
|
19583
|
-
hasIn(
|
|
19584
|
-
const [key, ...rest] =
|
|
19583
|
+
hasIn(path8) {
|
|
19584
|
+
const [key, ...rest] = path8;
|
|
19585
19585
|
if (rest.length === 0)
|
|
19586
19586
|
return this.has(key);
|
|
19587
19587
|
const node = this.get(key, true);
|
|
@@ -19591,8 +19591,8 @@ var require_Collection = __commonJS({
|
|
|
19591
19591
|
* Sets a value in this collection. For `!!set`, `value` needs to be a
|
|
19592
19592
|
* boolean to add/remove the item from the set.
|
|
19593
19593
|
*/
|
|
19594
|
-
setIn(
|
|
19595
|
-
const [key, ...rest] =
|
|
19594
|
+
setIn(path8, value) {
|
|
19595
|
+
const [key, ...rest] = path8;
|
|
19596
19596
|
if (rest.length === 0) {
|
|
19597
19597
|
this.set(key, value);
|
|
19598
19598
|
} else {
|
|
@@ -22107,9 +22107,9 @@ var require_Document = __commonJS({
|
|
|
22107
22107
|
this.contents.add(value);
|
|
22108
22108
|
}
|
|
22109
22109
|
/** Adds a value to the document. */
|
|
22110
|
-
addIn(
|
|
22110
|
+
addIn(path8, value) {
|
|
22111
22111
|
if (assertCollection(this.contents))
|
|
22112
|
-
this.contents.addIn(
|
|
22112
|
+
this.contents.addIn(path8, value);
|
|
22113
22113
|
}
|
|
22114
22114
|
/**
|
|
22115
22115
|
* Create a new `Alias` node, ensuring that the target `node` has the required anchor.
|
|
@@ -22184,14 +22184,14 @@ var require_Document = __commonJS({
|
|
|
22184
22184
|
* Removes a value from the document.
|
|
22185
22185
|
* @returns `true` if the item was found and removed.
|
|
22186
22186
|
*/
|
|
22187
|
-
deleteIn(
|
|
22188
|
-
if (Collection.isEmptyPath(
|
|
22187
|
+
deleteIn(path8) {
|
|
22188
|
+
if (Collection.isEmptyPath(path8)) {
|
|
22189
22189
|
if (this.contents == null)
|
|
22190
22190
|
return false;
|
|
22191
22191
|
this.contents = null;
|
|
22192
22192
|
return true;
|
|
22193
22193
|
}
|
|
22194
|
-
return assertCollection(this.contents) ? this.contents.deleteIn(
|
|
22194
|
+
return assertCollection(this.contents) ? this.contents.deleteIn(path8) : false;
|
|
22195
22195
|
}
|
|
22196
22196
|
/**
|
|
22197
22197
|
* Returns item at `key`, or `undefined` if not found. By default unwraps
|
|
@@ -22206,10 +22206,10 @@ var require_Document = __commonJS({
|
|
|
22206
22206
|
* scalar values from their surrounding node; to disable set `keepScalar` to
|
|
22207
22207
|
* `true` (collections are always returned intact).
|
|
22208
22208
|
*/
|
|
22209
|
-
getIn(
|
|
22210
|
-
if (Collection.isEmptyPath(
|
|
22209
|
+
getIn(path8, keepScalar) {
|
|
22210
|
+
if (Collection.isEmptyPath(path8))
|
|
22211
22211
|
return !keepScalar && identity.isScalar(this.contents) ? this.contents.value : this.contents;
|
|
22212
|
-
return identity.isCollection(this.contents) ? this.contents.getIn(
|
|
22212
|
+
return identity.isCollection(this.contents) ? this.contents.getIn(path8, keepScalar) : void 0;
|
|
22213
22213
|
}
|
|
22214
22214
|
/**
|
|
22215
22215
|
* Checks if the document includes a value with the key `key`.
|
|
@@ -22220,10 +22220,10 @@ var require_Document = __commonJS({
|
|
|
22220
22220
|
/**
|
|
22221
22221
|
* Checks if the document includes a value at `path`.
|
|
22222
22222
|
*/
|
|
22223
|
-
hasIn(
|
|
22224
|
-
if (Collection.isEmptyPath(
|
|
22223
|
+
hasIn(path8) {
|
|
22224
|
+
if (Collection.isEmptyPath(path8))
|
|
22225
22225
|
return this.contents !== void 0;
|
|
22226
|
-
return identity.isCollection(this.contents) ? this.contents.hasIn(
|
|
22226
|
+
return identity.isCollection(this.contents) ? this.contents.hasIn(path8) : false;
|
|
22227
22227
|
}
|
|
22228
22228
|
/**
|
|
22229
22229
|
* Sets a value in this document. For `!!set`, `value` needs to be a
|
|
@@ -22240,13 +22240,13 @@ var require_Document = __commonJS({
|
|
|
22240
22240
|
* Sets a value in this document. For `!!set`, `value` needs to be a
|
|
22241
22241
|
* boolean to add/remove the item from the set.
|
|
22242
22242
|
*/
|
|
22243
|
-
setIn(
|
|
22244
|
-
if (Collection.isEmptyPath(
|
|
22243
|
+
setIn(path8, value) {
|
|
22244
|
+
if (Collection.isEmptyPath(path8)) {
|
|
22245
22245
|
this.contents = value;
|
|
22246
22246
|
} else if (this.contents == null) {
|
|
22247
|
-
this.contents = Collection.collectionFromPath(this.schema, Array.from(
|
|
22247
|
+
this.contents = Collection.collectionFromPath(this.schema, Array.from(path8), value);
|
|
22248
22248
|
} else if (assertCollection(this.contents)) {
|
|
22249
|
-
this.contents.setIn(
|
|
22249
|
+
this.contents.setIn(path8, value);
|
|
22250
22250
|
}
|
|
22251
22251
|
}
|
|
22252
22252
|
/**
|
|
@@ -24206,9 +24206,9 @@ var require_cst_visit = __commonJS({
|
|
|
24206
24206
|
visit.BREAK = BREAK;
|
|
24207
24207
|
visit.SKIP = SKIP;
|
|
24208
24208
|
visit.REMOVE = REMOVE;
|
|
24209
|
-
visit.itemAtPath = (cst,
|
|
24209
|
+
visit.itemAtPath = (cst, path8) => {
|
|
24210
24210
|
let item = cst;
|
|
24211
|
-
for (const [field, index] of
|
|
24211
|
+
for (const [field, index] of path8) {
|
|
24212
24212
|
const tok = item?.[field];
|
|
24213
24213
|
if (tok && "items" in tok) {
|
|
24214
24214
|
item = tok.items[index];
|
|
@@ -24217,23 +24217,23 @@ var require_cst_visit = __commonJS({
|
|
|
24217
24217
|
}
|
|
24218
24218
|
return item;
|
|
24219
24219
|
};
|
|
24220
|
-
visit.parentCollection = (cst,
|
|
24221
|
-
const parent = visit.itemAtPath(cst,
|
|
24222
|
-
const field =
|
|
24220
|
+
visit.parentCollection = (cst, path8) => {
|
|
24221
|
+
const parent = visit.itemAtPath(cst, path8.slice(0, -1));
|
|
24222
|
+
const field = path8[path8.length - 1][0];
|
|
24223
24223
|
const coll = parent?.[field];
|
|
24224
24224
|
if (coll && "items" in coll)
|
|
24225
24225
|
return coll;
|
|
24226
24226
|
throw new Error("Parent collection not found");
|
|
24227
24227
|
};
|
|
24228
|
-
function _visit(
|
|
24229
|
-
let ctrl = visitor(item,
|
|
24228
|
+
function _visit(path8, item, visitor) {
|
|
24229
|
+
let ctrl = visitor(item, path8);
|
|
24230
24230
|
if (typeof ctrl === "symbol")
|
|
24231
24231
|
return ctrl;
|
|
24232
24232
|
for (const field of ["key", "value"]) {
|
|
24233
24233
|
const token = item[field];
|
|
24234
24234
|
if (token && "items" in token) {
|
|
24235
24235
|
for (let i = 0; i < token.items.length; ++i) {
|
|
24236
|
-
const ci = _visit(Object.freeze(
|
|
24236
|
+
const ci = _visit(Object.freeze(path8.concat([[field, i]])), token.items[i], visitor);
|
|
24237
24237
|
if (typeof ci === "number")
|
|
24238
24238
|
i = ci - 1;
|
|
24239
24239
|
else if (ci === BREAK)
|
|
@@ -24244,10 +24244,10 @@ var require_cst_visit = __commonJS({
|
|
|
24244
24244
|
}
|
|
24245
24245
|
}
|
|
24246
24246
|
if (typeof ctrl === "function" && field === "key")
|
|
24247
|
-
ctrl = ctrl(item,
|
|
24247
|
+
ctrl = ctrl(item, path8);
|
|
24248
24248
|
}
|
|
24249
24249
|
}
|
|
24250
|
-
return typeof ctrl === "function" ? ctrl(item,
|
|
24250
|
+
return typeof ctrl === "function" ? ctrl(item, path8) : ctrl;
|
|
24251
24251
|
}
|
|
24252
24252
|
exports2.visit = visit;
|
|
24253
24253
|
}
|
|
@@ -26187,7 +26187,7 @@ var require_scope_functions = __commonJS({
|
|
|
26187
26187
|
var hasOwn = Function.prototype.call.bind(Object.prototype.hasOwnProperty);
|
|
26188
26188
|
hasOwn[/* @__PURE__ */ Symbol.for("toJayString")] = "Function.prototype.call.bind(Object.prototype.hasOwnProperty)";
|
|
26189
26189
|
var pointerPart = (s) => /~\//.test(s) ? `${s}`.replace(/~/g, "~0").replace(/\//g, "~1") : s;
|
|
26190
|
-
var toPointer = (
|
|
26190
|
+
var toPointer = (path8) => path8.length === 0 ? "#" : `#/${path8.map(pointerPart).join("/")}`;
|
|
26191
26191
|
var errorMerge = ({ keywordLocation, instanceLocation }, schemaBase, dataBase) => ({
|
|
26192
26192
|
keywordLocation: `${schemaBase}${keywordLocation.slice(1)}`,
|
|
26193
26193
|
instanceLocation: `${dataBase}${instanceLocation.slice(1)}`
|
|
@@ -26524,7 +26524,7 @@ var require_pointer = __commonJS({
|
|
|
26524
26524
|
throw new Error("Unreachable");
|
|
26525
26525
|
});
|
|
26526
26526
|
}
|
|
26527
|
-
function
|
|
26527
|
+
function get3(obj, pointer, objpath) {
|
|
26528
26528
|
if (typeof obj !== "object") throw new Error("Invalid input object");
|
|
26529
26529
|
if (typeof pointer !== "string") throw new Error("Invalid JSON pointer");
|
|
26530
26530
|
const parts = pointer.split("/");
|
|
@@ -26581,14 +26581,14 @@ var require_pointer = __commonJS({
|
|
|
26581
26581
|
const visit = (sub, oldPath, specialChilds = false, dynamic = false) => {
|
|
26582
26582
|
if (!sub || typeof sub !== "object") return;
|
|
26583
26583
|
const id = sub.$id || sub.id;
|
|
26584
|
-
let
|
|
26584
|
+
let path8 = oldPath;
|
|
26585
26585
|
if (id && typeof id === "string") {
|
|
26586
|
-
|
|
26587
|
-
if (
|
|
26586
|
+
path8 = joinPath(path8, id);
|
|
26587
|
+
if (path8 === ptr || path8 === main && local === "") {
|
|
26588
26588
|
results.push([sub, root, oldPath]);
|
|
26589
|
-
} else if (
|
|
26589
|
+
} else if (path8 === main && local[0] === "/") {
|
|
26590
26590
|
const objpath = [];
|
|
26591
|
-
const res =
|
|
26591
|
+
const res = get3(sub, local, objpath);
|
|
26592
26592
|
if (res !== void 0) results.push([res, root, joinPath(oldPath, objpath2path(objpath))]);
|
|
26593
26593
|
}
|
|
26594
26594
|
}
|
|
@@ -26596,20 +26596,20 @@ var require_pointer = __commonJS({
|
|
|
26596
26596
|
if (anchor && typeof anchor === "string") {
|
|
26597
26597
|
if (anchor.includes("#")) throw new Error("$anchor can't include '#'");
|
|
26598
26598
|
if (anchor.startsWith("/")) throw new Error("$anchor can't start with '/'");
|
|
26599
|
-
|
|
26600
|
-
if (
|
|
26599
|
+
path8 = joinPath(path8, `#${anchor}`);
|
|
26600
|
+
if (path8 === ptr) results.push([sub, root, oldPath]);
|
|
26601
26601
|
}
|
|
26602
26602
|
for (const k of Object.keys(sub)) {
|
|
26603
26603
|
if (!specialChilds && !Array.isArray(sub) && !knownKeywords.includes(k)) continue;
|
|
26604
26604
|
if (!specialChilds && skipChilds.includes(k)) continue;
|
|
26605
|
-
visit(sub[k],
|
|
26605
|
+
visit(sub[k], path8, !specialChilds && withSpecialChilds.includes(k));
|
|
26606
26606
|
}
|
|
26607
26607
|
if (!dynamic && sub.$dynamicAnchor) visit(sub, oldPath, specialChilds, true);
|
|
26608
26608
|
};
|
|
26609
26609
|
visit(root, main);
|
|
26610
26610
|
if (main === base.replace(/#$/, "") && (local[0] === "/" || local === "")) {
|
|
26611
26611
|
const objpath = [];
|
|
26612
|
-
const res =
|
|
26612
|
+
const res = get3(root, local, objpath);
|
|
26613
26613
|
if (res !== void 0) results.push([res, root, objpath2path(objpath)]);
|
|
26614
26614
|
}
|
|
26615
26615
|
if (schemas.has(main) && schemas.get(main) !== root) {
|
|
@@ -26662,7 +26662,7 @@ var require_pointer = __commonJS({
|
|
|
26662
26662
|
}
|
|
26663
26663
|
throw new Error("Unexpected value for 'schemas' option");
|
|
26664
26664
|
};
|
|
26665
|
-
module2.exports = { get:
|
|
26665
|
+
module2.exports = { get: get3, joinPath, resolveReference, getDynamicAnchors, hasKeywords, buildSchemas };
|
|
26666
26666
|
}
|
|
26667
26667
|
});
|
|
26668
26668
|
|
|
@@ -27048,14 +27048,14 @@ var require_compile = __commonJS({
|
|
|
27048
27048
|
}
|
|
27049
27049
|
const { gensym, getref, genref, genformat } = scopeMethods(scope);
|
|
27050
27050
|
const buildPath = (prop) => {
|
|
27051
|
-
const
|
|
27051
|
+
const path8 = [];
|
|
27052
27052
|
let curr = prop;
|
|
27053
27053
|
while (curr) {
|
|
27054
|
-
if (!curr.name)
|
|
27054
|
+
if (!curr.name) path8.unshift(curr);
|
|
27055
27055
|
curr = curr.parent || curr.errorParent;
|
|
27056
27056
|
}
|
|
27057
|
-
if (
|
|
27058
|
-
return format("%j", toPointer(
|
|
27057
|
+
if (path8.every((part) => part.keyval !== void 0))
|
|
27058
|
+
return format("%j", toPointer(path8.map((part) => part.keyval)));
|
|
27059
27059
|
const stringParts = ["#"];
|
|
27060
27060
|
const stringJoined = () => {
|
|
27061
27061
|
const value = stringParts.map(functions.pointerPart).join("/");
|
|
@@ -27063,7 +27063,7 @@ var require_compile = __commonJS({
|
|
|
27063
27063
|
return value;
|
|
27064
27064
|
};
|
|
27065
27065
|
let res = null;
|
|
27066
|
-
for (const { keyname, keyval, number } of
|
|
27066
|
+
for (const { keyname, keyval, number } of path8) {
|
|
27067
27067
|
if (keyname) {
|
|
27068
27068
|
if (!number) scope.pointerPart = functions.pointerPart;
|
|
27069
27069
|
const value = number ? keyname : format("pointerPart(%s)", keyname);
|
|
@@ -27109,8 +27109,8 @@ var require_compile = __commonJS({
|
|
|
27109
27109
|
const definitelyPresent = !current.parent || current.checked || current.inKeys && isJSON || queryCurrent().length > 0;
|
|
27110
27110
|
const name = buildName(current);
|
|
27111
27111
|
const currPropImm = (...args) => propimm(current, ...args);
|
|
27112
|
-
const error2 = ({ path:
|
|
27113
|
-
const schemaP = toPointer([...schemaPath, ...
|
|
27112
|
+
const error2 = ({ path: path8 = [], prop = current, source, suberr }) => {
|
|
27113
|
+
const schemaP = toPointer([...schemaPath, ...path8]);
|
|
27114
27114
|
const dataP = includeErrors ? buildPath(prop) : null;
|
|
27115
27115
|
if (includeErrors === true && errors && source) {
|
|
27116
27116
|
scope.errorMerge = functions.errorMerge;
|
|
@@ -27182,7 +27182,7 @@ var require_compile = __commonJS({
|
|
|
27182
27182
|
enforce(ruleTypes.some((t) => schemaTypes.get(t)(node[prop])), "Unexpected type for", prop);
|
|
27183
27183
|
unused.delete(prop);
|
|
27184
27184
|
};
|
|
27185
|
-
const
|
|
27185
|
+
const get3 = (prop, ...ruleTypes) => {
|
|
27186
27186
|
if (node[prop] !== void 0) consume(prop, ...ruleTypes);
|
|
27187
27187
|
return node[prop];
|
|
27188
27188
|
};
|
|
@@ -27204,7 +27204,7 @@ var require_compile = __commonJS({
|
|
|
27204
27204
|
return true;
|
|
27205
27205
|
};
|
|
27206
27206
|
if (node === root) {
|
|
27207
|
-
saveMeta(
|
|
27207
|
+
saveMeta(get3("$schema", "string"));
|
|
27208
27208
|
handle("$vocabulary", ["object"], ($vocabulary) => {
|
|
27209
27209
|
for (const [vocab, flag] of Object.entries($vocabulary)) {
|
|
27210
27210
|
if (flag === false) continue;
|
|
@@ -27221,7 +27221,7 @@ var require_compile = __commonJS({
|
|
|
27221
27221
|
for (const ignore of ["title", "description", "$comment"]) handle(ignore, ["string"], null);
|
|
27222
27222
|
for (const ignore of ["deprecated", "readOnly", "writeOnly"]) handle(ignore, ["boolean"], null);
|
|
27223
27223
|
handle("$defs", ["object"], null) || handle("definitions", ["object"], null);
|
|
27224
|
-
const compileSub = (sub, subR,
|
|
27224
|
+
const compileSub = (sub, subR, path8) => sub === schema2 ? safe("validate") : getref(sub) || compileSchema(sub, subR, opts, scope, path8);
|
|
27225
27225
|
const basePath = () => basePathStack.length > 0 ? basePathStack[basePathStack.length - 1] : "";
|
|
27226
27226
|
const basePathStackLength = basePathStack.length;
|
|
27227
27227
|
const setId = ($id) => {
|
|
@@ -27245,9 +27245,9 @@ var require_compile = __commonJS({
|
|
|
27245
27245
|
if (node !== schema2) fun.write("dynLocal.unshift({})");
|
|
27246
27246
|
for (const [key, subcheck] of allDynamic) {
|
|
27247
27247
|
const resolved = resolveReference(root, schemas, `#${key}`, basePath());
|
|
27248
|
-
const [sub, subRoot,
|
|
27248
|
+
const [sub, subRoot, path8] = resolved[0] || [];
|
|
27249
27249
|
enforce(sub === subcheck, `Unexpected $dynamicAnchor resolution: ${key}`);
|
|
27250
|
-
const n = compileSub(sub, subRoot,
|
|
27250
|
+
const n = compileSub(sub, subRoot, path8);
|
|
27251
27251
|
fun.write("dynLocal[0][%j] = %s", `#${key}`, n);
|
|
27252
27252
|
}
|
|
27253
27253
|
}
|
|
@@ -27953,12 +27953,12 @@ var require_compile = __commonJS({
|
|
|
27953
27953
|
if (local2.props) fun.write("const %s = [[], []]", local2.props);
|
|
27954
27954
|
handle("$ref", ["string"], ($ref) => {
|
|
27955
27955
|
const resolved = resolveReference(root, schemas, $ref, basePath());
|
|
27956
|
-
const [sub, subRoot,
|
|
27956
|
+
const [sub, subRoot, path8] = resolved[0] || [];
|
|
27957
27957
|
if (!sub && sub !== false) {
|
|
27958
27958
|
fail2("failed to resolve $ref:", $ref);
|
|
27959
27959
|
if (lintOnly) return null;
|
|
27960
27960
|
}
|
|
27961
|
-
const n = compileSub(sub, subRoot,
|
|
27961
|
+
const n = compileSub(sub, subRoot, path8);
|
|
27962
27962
|
const rn = sub === schema2 ? funname : n;
|
|
27963
27963
|
if (!scope[rn]) throw new Error("Unexpected: coherence check failed");
|
|
27964
27964
|
if (!scope[rn][evaluatedStatic] && sub.type) {
|
|
@@ -27984,9 +27984,9 @@ var require_compile = __commonJS({
|
|
|
27984
27984
|
if (!opts[optRecAnchors]) throw new Error("[opt] Recursive anchors are not enabled");
|
|
27985
27985
|
enforce($recursiveRef === "#", 'Behavior of $recursiveRef is defined only for "#"');
|
|
27986
27986
|
const resolved = resolveReference(root, schemas, "#", basePath());
|
|
27987
|
-
const [sub, subRoot,
|
|
27987
|
+
const [sub, subRoot, path8] = resolved[0];
|
|
27988
27988
|
laxMode(sub.$recursiveAnchor, "$recursiveRef without $recursiveAnchor");
|
|
27989
|
-
const n = compileSub(sub, subRoot,
|
|
27989
|
+
const n = compileSub(sub, subRoot, path8);
|
|
27990
27990
|
const nrec = sub.$recursiveAnchor ? format("(recursive || %s)", n) : n;
|
|
27991
27991
|
return applyRef(nrec, { path: ["$recursiveRef"] });
|
|
27992
27992
|
});
|
|
@@ -28002,10 +28002,10 @@ var require_compile = __commonJS({
|
|
|
28002
28002
|
return applyRef(nrec2, { path: ["$dynamicRef"] });
|
|
28003
28003
|
}
|
|
28004
28004
|
enforce(resolved[0], "$dynamicRef bookending resolution failed", $dynamicRef);
|
|
28005
|
-
const [sub, subRoot,
|
|
28005
|
+
const [sub, subRoot, path8] = resolved[0];
|
|
28006
28006
|
const ok2 = sub.$dynamicAnchor && `#${sub.$dynamicAnchor}` === dynamicTail;
|
|
28007
28007
|
laxMode(ok2, "$dynamicRef without $dynamicAnchor in the same scope");
|
|
28008
|
-
const n = compileSub(sub, subRoot,
|
|
28008
|
+
const n = compileSub(sub, subRoot, path8);
|
|
28009
28009
|
scope.dynamicResolve = functions.dynamicResolve;
|
|
28010
28010
|
const nrec = ok2 ? format("(dynamicResolve(dynAnchors || [], %j) || %s)", dynamicTail, n) : n;
|
|
28011
28011
|
return applyRef(nrec, { path: ["$dynamicRef"] });
|
|
@@ -28036,7 +28036,7 @@ var require_compile = __commonJS({
|
|
|
28036
28036
|
};
|
|
28037
28037
|
if (node.default !== void 0 && useDefaults) {
|
|
28038
28038
|
if (definitelyPresent) fail2("Can not apply default value here (e.g. at root)");
|
|
28039
|
-
const defvalue =
|
|
28039
|
+
const defvalue = get3("default", "jsonval");
|
|
28040
28040
|
fun.if(present(current), writeMain, () => fun.write("%s = %j", name, defvalue));
|
|
28041
28041
|
} else {
|
|
28042
28042
|
handle("default", ["jsonval"], null);
|
|
@@ -28340,59 +28340,59 @@ var require_url = __commonJS({
|
|
|
28340
28340
|
return href;
|
|
28341
28341
|
}
|
|
28342
28342
|
if (typeof process !== "undefined" && process.cwd) {
|
|
28343
|
-
const
|
|
28344
|
-
const lastChar =
|
|
28343
|
+
const path8 = process.cwd();
|
|
28344
|
+
const lastChar = path8.slice(-1);
|
|
28345
28345
|
if (lastChar === "/" || lastChar === "\\") {
|
|
28346
|
-
return
|
|
28346
|
+
return path8;
|
|
28347
28347
|
} else {
|
|
28348
|
-
return
|
|
28348
|
+
return path8 + "/";
|
|
28349
28349
|
}
|
|
28350
28350
|
}
|
|
28351
28351
|
return "/";
|
|
28352
28352
|
}
|
|
28353
|
-
function getProtocol2(
|
|
28354
|
-
const match = protocolPattern2.exec(
|
|
28353
|
+
function getProtocol2(path8) {
|
|
28354
|
+
const match = protocolPattern2.exec(path8 || "");
|
|
28355
28355
|
if (match) {
|
|
28356
28356
|
return match[1].toLowerCase();
|
|
28357
28357
|
}
|
|
28358
28358
|
return void 0;
|
|
28359
28359
|
}
|
|
28360
|
-
function getExtension2(
|
|
28361
|
-
const lastDot =
|
|
28360
|
+
function getExtension2(path8) {
|
|
28361
|
+
const lastDot = path8.lastIndexOf(".");
|
|
28362
28362
|
if (lastDot >= 0) {
|
|
28363
|
-
return stripQuery2(
|
|
28363
|
+
return stripQuery2(path8.substring(lastDot).toLowerCase());
|
|
28364
28364
|
}
|
|
28365
28365
|
return "";
|
|
28366
28366
|
}
|
|
28367
|
-
function stripQuery2(
|
|
28368
|
-
const queryIndex =
|
|
28367
|
+
function stripQuery2(path8) {
|
|
28368
|
+
const queryIndex = path8.indexOf("?");
|
|
28369
28369
|
if (queryIndex >= 0) {
|
|
28370
|
-
|
|
28370
|
+
path8 = path8.substring(0, queryIndex);
|
|
28371
28371
|
}
|
|
28372
|
-
return
|
|
28372
|
+
return path8;
|
|
28373
28373
|
}
|
|
28374
|
-
function getHash2(
|
|
28375
|
-
if (!
|
|
28374
|
+
function getHash2(path8) {
|
|
28375
|
+
if (!path8) {
|
|
28376
28376
|
return "#";
|
|
28377
28377
|
}
|
|
28378
|
-
const hashIndex =
|
|
28378
|
+
const hashIndex = path8.indexOf("#");
|
|
28379
28379
|
if (hashIndex >= 0) {
|
|
28380
|
-
return
|
|
28380
|
+
return path8.substring(hashIndex);
|
|
28381
28381
|
}
|
|
28382
28382
|
return "#";
|
|
28383
28383
|
}
|
|
28384
|
-
function stripHash2(
|
|
28385
|
-
if (!
|
|
28384
|
+
function stripHash2(path8) {
|
|
28385
|
+
if (!path8) {
|
|
28386
28386
|
return "";
|
|
28387
28387
|
}
|
|
28388
|
-
const hashIndex =
|
|
28388
|
+
const hashIndex = path8.indexOf("#");
|
|
28389
28389
|
if (hashIndex >= 0) {
|
|
28390
|
-
|
|
28390
|
+
path8 = path8.substring(0, hashIndex);
|
|
28391
28391
|
}
|
|
28392
|
-
return
|
|
28392
|
+
return path8;
|
|
28393
28393
|
}
|
|
28394
|
-
function isHttp2(
|
|
28395
|
-
const protocol = getProtocol2(
|
|
28394
|
+
function isHttp2(path8) {
|
|
28395
|
+
const protocol = getProtocol2(path8);
|
|
28396
28396
|
if (protocol === "http" || protocol === "https") {
|
|
28397
28397
|
return true;
|
|
28398
28398
|
} else if (protocol === void 0) {
|
|
@@ -28401,11 +28401,11 @@ var require_url = __commonJS({
|
|
|
28401
28401
|
return false;
|
|
28402
28402
|
}
|
|
28403
28403
|
}
|
|
28404
|
-
function isUnsafeUrl2(
|
|
28405
|
-
if (!
|
|
28404
|
+
function isUnsafeUrl2(path8) {
|
|
28405
|
+
if (!path8 || typeof path8 !== "string") {
|
|
28406
28406
|
return true;
|
|
28407
28407
|
}
|
|
28408
|
-
const normalizedPath =
|
|
28408
|
+
const normalizedPath = path8.trim().toLowerCase();
|
|
28409
28409
|
if (!normalizedPath) {
|
|
28410
28410
|
return true;
|
|
28411
28411
|
}
|
|
@@ -28536,58 +28536,58 @@ var require_url = __commonJS({
|
|
|
28536
28536
|
];
|
|
28537
28537
|
return internalPorts.includes(port);
|
|
28538
28538
|
}
|
|
28539
|
-
function isFileSystemPath2(
|
|
28539
|
+
function isFileSystemPath2(path8) {
|
|
28540
28540
|
if (typeof window !== "undefined" || typeof process !== "undefined" && process.browser) {
|
|
28541
28541
|
return false;
|
|
28542
28542
|
}
|
|
28543
|
-
const protocol = getProtocol2(
|
|
28543
|
+
const protocol = getProtocol2(path8);
|
|
28544
28544
|
return protocol === void 0 || protocol === "file";
|
|
28545
28545
|
}
|
|
28546
|
-
function fromFileSystemPath2(
|
|
28546
|
+
function fromFileSystemPath2(path8) {
|
|
28547
28547
|
if ((0, is_windows_1.isWindows)()) {
|
|
28548
28548
|
const projectDir = cwd2();
|
|
28549
|
-
const upperPath =
|
|
28549
|
+
const upperPath = path8.toUpperCase();
|
|
28550
28550
|
const projectDirPosixPath = (0, convert_path_to_posix_1.default)(projectDir);
|
|
28551
28551
|
const posixUpper = projectDirPosixPath.toUpperCase();
|
|
28552
28552
|
const hasProjectDir = upperPath.includes(posixUpper);
|
|
28553
28553
|
const hasProjectUri = upperPath.includes(posixUpper);
|
|
28554
|
-
const isAbsolutePath = path_1.win32?.isAbsolute(
|
|
28554
|
+
const isAbsolutePath = path_1.win32?.isAbsolute(path8) || path8.startsWith("http://") || path8.startsWith("https://") || path8.startsWith("file://");
|
|
28555
28555
|
if (!(hasProjectDir || hasProjectUri || isAbsolutePath) && !projectDir.startsWith("http")) {
|
|
28556
|
-
|
|
28556
|
+
path8 = (0, path_2.join)(projectDir, path8);
|
|
28557
28557
|
}
|
|
28558
|
-
|
|
28558
|
+
path8 = (0, convert_path_to_posix_1.default)(path8);
|
|
28559
28559
|
}
|
|
28560
|
-
|
|
28560
|
+
path8 = encodeURI(path8);
|
|
28561
28561
|
for (const pattern of urlEncodePatterns2) {
|
|
28562
|
-
|
|
28562
|
+
path8 = path8.replace(pattern[0], pattern[1]);
|
|
28563
28563
|
}
|
|
28564
|
-
return
|
|
28564
|
+
return path8;
|
|
28565
28565
|
}
|
|
28566
|
-
function toFileSystemPath2(
|
|
28567
|
-
|
|
28566
|
+
function toFileSystemPath2(path8, keepFileProtocol) {
|
|
28567
|
+
path8 = decodeURI(path8);
|
|
28568
28568
|
for (let i = 0; i < urlDecodePatterns2.length; i += 2) {
|
|
28569
|
-
|
|
28569
|
+
path8 = path8.replace(urlDecodePatterns2[i], urlDecodePatterns2[i + 1]);
|
|
28570
28570
|
}
|
|
28571
|
-
let isFileUrl =
|
|
28571
|
+
let isFileUrl = path8.toLowerCase().startsWith("file://");
|
|
28572
28572
|
if (isFileUrl) {
|
|
28573
|
-
|
|
28574
|
-
if ((0, is_windows_1.isWindows)() &&
|
|
28575
|
-
|
|
28573
|
+
path8 = path8.replace(/^file:\/\//, "").replace(/^\//, "");
|
|
28574
|
+
if ((0, is_windows_1.isWindows)() && path8[1] === "/") {
|
|
28575
|
+
path8 = `${path8[0]}:${path8.substring(1)}`;
|
|
28576
28576
|
}
|
|
28577
28577
|
if (keepFileProtocol) {
|
|
28578
|
-
|
|
28578
|
+
path8 = "file:///" + path8;
|
|
28579
28579
|
} else {
|
|
28580
28580
|
isFileUrl = false;
|
|
28581
|
-
|
|
28581
|
+
path8 = (0, is_windows_1.isWindows)() ? path8 : "/" + path8;
|
|
28582
28582
|
}
|
|
28583
28583
|
}
|
|
28584
28584
|
if ((0, is_windows_1.isWindows)() && !isFileUrl) {
|
|
28585
|
-
|
|
28586
|
-
if (
|
|
28587
|
-
|
|
28585
|
+
path8 = path8.replace(forwardSlashPattern2, "\\");
|
|
28586
|
+
if (path8.match(/^[a-z]:\\/i)) {
|
|
28587
|
+
path8 = path8[0].toUpperCase() + path8.substring(1);
|
|
28588
28588
|
}
|
|
28589
28589
|
}
|
|
28590
|
-
return
|
|
28590
|
+
return path8;
|
|
28591
28591
|
}
|
|
28592
28592
|
function safePointerToPath2(pointer) {
|
|
28593
28593
|
if (pointer.length <= 1 || pointer[0] !== "#" || pointer[1] !== "/") {
|
|
@@ -28735,8 +28735,8 @@ var require_errors3 = __commonJS({
|
|
|
28735
28735
|
targetRef;
|
|
28736
28736
|
targetFound;
|
|
28737
28737
|
parentPath;
|
|
28738
|
-
constructor(token,
|
|
28739
|
-
super(`Missing $ref pointer "${(0, url_js_1.getHash)(
|
|
28738
|
+
constructor(token, path8, targetRef, targetFound, parentPath) {
|
|
28739
|
+
super(`Missing $ref pointer "${(0, url_js_1.getHash)(path8)}". Token "${token}" does not exist.`, (0, url_js_1.stripHash)(path8));
|
|
28740
28740
|
this.targetToken = token;
|
|
28741
28741
|
this.targetRef = targetRef;
|
|
28742
28742
|
this.targetFound = targetFound;
|
|
@@ -28755,8 +28755,8 @@ var require_errors3 = __commonJS({
|
|
|
28755
28755
|
var InvalidPointerError2 = class extends JSONParserError2 {
|
|
28756
28756
|
code = "EUNMATCHEDRESOLVER";
|
|
28757
28757
|
name = "InvalidPointerError";
|
|
28758
|
-
constructor(pointer,
|
|
28759
|
-
super(`Invalid $ref pointer "${pointer}". Pointers must begin with "#/"`, (0, url_js_1.stripHash)(
|
|
28758
|
+
constructor(pointer, path8) {
|
|
28759
|
+
super(`Invalid $ref pointer "${pointer}". Pointers must begin with "#/"`, (0, url_js_1.stripHash)(path8));
|
|
28760
28760
|
}
|
|
28761
28761
|
};
|
|
28762
28762
|
exports2.InvalidPointerError = InvalidPointerError2;
|
|
@@ -28861,10 +28861,10 @@ var require_pointer2 = __commonJS({
|
|
|
28861
28861
|
* Resolving a single pointer may require resolving multiple $Refs.
|
|
28862
28862
|
*/
|
|
28863
28863
|
indirections;
|
|
28864
|
-
constructor($ref,
|
|
28864
|
+
constructor($ref, path8, friendlyPath) {
|
|
28865
28865
|
this.$ref = $ref;
|
|
28866
|
-
this.path =
|
|
28867
|
-
this.originalPath = friendlyPath ||
|
|
28866
|
+
this.path = path8;
|
|
28867
|
+
this.originalPath = friendlyPath || path8;
|
|
28868
28868
|
this.value = void 0;
|
|
28869
28869
|
this.circular = false;
|
|
28870
28870
|
this.indirections = 0;
|
|
@@ -28910,10 +28910,10 @@ var require_pointer2 = __commonJS({
|
|
|
28910
28910
|
continue;
|
|
28911
28911
|
}
|
|
28912
28912
|
this.value = null;
|
|
28913
|
-
const
|
|
28914
|
-
const targetRef = this.path.replace(
|
|
28913
|
+
const path8 = this.$ref.path || "";
|
|
28914
|
+
const targetRef = this.path.replace(path8, "");
|
|
28915
28915
|
const targetFound = _Pointer.join("", found);
|
|
28916
|
-
const parentPath = pathFromRoot?.replace(
|
|
28916
|
+
const parentPath = pathFromRoot?.replace(path8, "");
|
|
28917
28917
|
throw new errors_js_1.MissingPointerError(token, decodeURI(this.originalPath), targetRef, targetFound, parentPath);
|
|
28918
28918
|
} else {
|
|
28919
28919
|
this.value = this.value[token];
|
|
@@ -28969,8 +28969,8 @@ var require_pointer2 = __commonJS({
|
|
|
28969
28969
|
* @param [originalPath]
|
|
28970
28970
|
* @returns
|
|
28971
28971
|
*/
|
|
28972
|
-
static parse(
|
|
28973
|
-
const pointer = url.getHash(
|
|
28972
|
+
static parse(path8, originalPath) {
|
|
28973
|
+
const pointer = url.getHash(path8).substring(1);
|
|
28974
28974
|
if (!pointer) {
|
|
28975
28975
|
return [];
|
|
28976
28976
|
}
|
|
@@ -28979,7 +28979,7 @@ var require_pointer2 = __commonJS({
|
|
|
28979
28979
|
split[i] = safeDecodeURIComponent(split[i].replace(escapedSlash2, "/").replace(escapedTilde2, "~"));
|
|
28980
28980
|
}
|
|
28981
28981
|
if (split[0] !== "") {
|
|
28982
|
-
throw new errors_js_1.InvalidPointerError(pointer, originalPath === void 0 ?
|
|
28982
|
+
throw new errors_js_1.InvalidPointerError(pointer, originalPath === void 0 ? path8 : originalPath);
|
|
28983
28983
|
}
|
|
28984
28984
|
return split.slice(1);
|
|
28985
28985
|
}
|
|
@@ -29157,9 +29157,9 @@ var require_ref = __commonJS({
|
|
|
29157
29157
|
* @param options
|
|
29158
29158
|
* @returns
|
|
29159
29159
|
*/
|
|
29160
|
-
exists(
|
|
29160
|
+
exists(path8, options) {
|
|
29161
29161
|
try {
|
|
29162
|
-
this.resolve(
|
|
29162
|
+
this.resolve(path8, options);
|
|
29163
29163
|
return true;
|
|
29164
29164
|
} catch {
|
|
29165
29165
|
return false;
|
|
@@ -29172,8 +29172,8 @@ var require_ref = __commonJS({
|
|
|
29172
29172
|
* @param options
|
|
29173
29173
|
* @returns - Returns the resolved value
|
|
29174
29174
|
*/
|
|
29175
|
-
get(
|
|
29176
|
-
return this.resolve(
|
|
29175
|
+
get(path8, options) {
|
|
29176
|
+
return this.resolve(path8, options)?.value;
|
|
29177
29177
|
}
|
|
29178
29178
|
/**
|
|
29179
29179
|
* Resolves the given JSON reference within this {@link $Ref#value}.
|
|
@@ -29184,8 +29184,8 @@ var require_ref = __commonJS({
|
|
|
29184
29184
|
* @param pathFromRoot - The path of `obj` from the schema root
|
|
29185
29185
|
* @returns
|
|
29186
29186
|
*/
|
|
29187
|
-
resolve(
|
|
29188
|
-
const pointer = new pointer_js_1.default(this,
|
|
29187
|
+
resolve(path8, options, friendlyPath, pathFromRoot) {
|
|
29188
|
+
const pointer = new pointer_js_1.default(this, path8, friendlyPath);
|
|
29189
29189
|
try {
|
|
29190
29190
|
const resolved = pointer.resolve(this.value, options, pathFromRoot);
|
|
29191
29191
|
if (resolved.value === pointer_js_1.nullSymbol) {
|
|
@@ -29213,8 +29213,8 @@ var require_ref = __commonJS({
|
|
|
29213
29213
|
* @param path - The full path of the property to set, optionally with a JSON pointer in the hash
|
|
29214
29214
|
* @param value - The value to assign
|
|
29215
29215
|
*/
|
|
29216
|
-
set(
|
|
29217
|
-
const pointer = new pointer_js_1.default(this,
|
|
29216
|
+
set(path8, value) {
|
|
29217
|
+
const pointer = new pointer_js_1.default(this, path8);
|
|
29218
29218
|
this.value = pointer.set(this.value, value);
|
|
29219
29219
|
if (this.value === pointer_js_1.nullSymbol) {
|
|
29220
29220
|
this.value = null;
|
|
@@ -29411,8 +29411,8 @@ var require_refs = __commonJS({
|
|
|
29411
29411
|
*/
|
|
29412
29412
|
paths(...types2) {
|
|
29413
29413
|
const paths = getPaths2(this._$refs, types2.flat());
|
|
29414
|
-
return paths.map((
|
|
29415
|
-
return (0, convert_path_to_posix_1.default)(
|
|
29414
|
+
return paths.map((path8) => {
|
|
29415
|
+
return (0, convert_path_to_posix_1.default)(path8.decoded);
|
|
29416
29416
|
});
|
|
29417
29417
|
}
|
|
29418
29418
|
/**
|
|
@@ -29425,8 +29425,8 @@ var require_refs = __commonJS({
|
|
|
29425
29425
|
values(...types2) {
|
|
29426
29426
|
const $refs = this._$refs;
|
|
29427
29427
|
const paths = getPaths2($refs, types2.flat());
|
|
29428
|
-
return paths.reduce((obj,
|
|
29429
|
-
obj[(0, convert_path_to_posix_1.default)(
|
|
29428
|
+
return paths.reduce((obj, path8) => {
|
|
29429
|
+
obj[(0, convert_path_to_posix_1.default)(path8.decoded)] = $refs[path8.encoded].value;
|
|
29430
29430
|
return obj;
|
|
29431
29431
|
}, {});
|
|
29432
29432
|
}
|
|
@@ -29444,9 +29444,9 @@ var require_refs = __commonJS({
|
|
|
29444
29444
|
* @param [options]
|
|
29445
29445
|
* @returns
|
|
29446
29446
|
*/
|
|
29447
|
-
exists(
|
|
29447
|
+
exists(path8, options) {
|
|
29448
29448
|
try {
|
|
29449
|
-
this._resolve(
|
|
29449
|
+
this._resolve(path8, "", options);
|
|
29450
29450
|
return true;
|
|
29451
29451
|
} catch {
|
|
29452
29452
|
return false;
|
|
@@ -29459,8 +29459,8 @@ var require_refs = __commonJS({
|
|
|
29459
29459
|
* @param [options]
|
|
29460
29460
|
* @returns - Returns the resolved value
|
|
29461
29461
|
*/
|
|
29462
|
-
get(
|
|
29463
|
-
return this._resolve(
|
|
29462
|
+
get(path8, options) {
|
|
29463
|
+
return this._resolve(path8, "", options).value;
|
|
29464
29464
|
}
|
|
29465
29465
|
/**
|
|
29466
29466
|
* 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.
|
|
@@ -29468,12 +29468,12 @@ var require_refs = __commonJS({
|
|
|
29468
29468
|
* @param path The JSON Reference path, optionally with a JSON Pointer in the hash
|
|
29469
29469
|
* @param value The value to assign. Can be anything (object, string, number, etc.)
|
|
29470
29470
|
*/
|
|
29471
|
-
set(
|
|
29472
|
-
const absPath = url.resolve(this._root$Ref.path,
|
|
29471
|
+
set(path8, value) {
|
|
29472
|
+
const absPath = url.resolve(this._root$Ref.path, path8);
|
|
29473
29473
|
const withoutHash = url.stripHash(absPath);
|
|
29474
29474
|
const $ref = this._$refs[withoutHash];
|
|
29475
29475
|
if (!$ref) {
|
|
29476
|
-
throw new Error(`Error resolving $ref pointer "${
|
|
29476
|
+
throw new Error(`Error resolving $ref pointer "${path8}".
|
|
29477
29477
|
"${withoutHash}" not found.`);
|
|
29478
29478
|
}
|
|
29479
29479
|
$ref.set(absPath, value);
|
|
@@ -29485,9 +29485,9 @@ var require_refs = __commonJS({
|
|
|
29485
29485
|
* @returns
|
|
29486
29486
|
* @protected
|
|
29487
29487
|
*/
|
|
29488
|
-
_get$Ref(
|
|
29489
|
-
|
|
29490
|
-
const withoutHash = url.stripHash(
|
|
29488
|
+
_get$Ref(path8) {
|
|
29489
|
+
path8 = url.resolve(this._root$Ref.path, path8);
|
|
29490
|
+
const withoutHash = url.stripHash(path8);
|
|
29491
29491
|
return this._$refs[withoutHash];
|
|
29492
29492
|
}
|
|
29493
29493
|
/**
|
|
@@ -29495,8 +29495,8 @@ var require_refs = __commonJS({
|
|
|
29495
29495
|
*
|
|
29496
29496
|
* @param path - The file path or URL of the referenced file
|
|
29497
29497
|
*/
|
|
29498
|
-
_add(
|
|
29499
|
-
const withoutHash = url.stripHash(
|
|
29498
|
+
_add(path8) {
|
|
29499
|
+
const withoutHash = url.stripHash(path8);
|
|
29500
29500
|
const $ref = new ref_js_1.default(this);
|
|
29501
29501
|
$ref.path = withoutHash;
|
|
29502
29502
|
this._$refs[withoutHash] = $ref;
|
|
@@ -29512,15 +29512,15 @@ var require_refs = __commonJS({
|
|
|
29512
29512
|
* @returns
|
|
29513
29513
|
* @protected
|
|
29514
29514
|
*/
|
|
29515
|
-
_resolve(
|
|
29516
|
-
const absPath = url.resolve(this._root$Ref.path,
|
|
29515
|
+
_resolve(path8, pathFromRoot, options) {
|
|
29516
|
+
const absPath = url.resolve(this._root$Ref.path, path8);
|
|
29517
29517
|
const withoutHash = url.stripHash(absPath);
|
|
29518
29518
|
const $ref = this._$refs[withoutHash];
|
|
29519
29519
|
if (!$ref) {
|
|
29520
|
-
throw new Error(`Error resolving $ref pointer "${
|
|
29520
|
+
throw new Error(`Error resolving $ref pointer "${path8}".
|
|
29521
29521
|
"${withoutHash}" not found.`);
|
|
29522
29522
|
}
|
|
29523
|
-
return $ref.resolve(absPath, options,
|
|
29523
|
+
return $ref.resolve(absPath, options, path8, pathFromRoot);
|
|
29524
29524
|
}
|
|
29525
29525
|
/**
|
|
29526
29526
|
* A map of paths/urls to {@link $Ref} objects
|
|
@@ -29570,10 +29570,10 @@ var require_refs = __commonJS({
|
|
|
29570
29570
|
return types2.includes($refs[key].pathType);
|
|
29571
29571
|
});
|
|
29572
29572
|
}
|
|
29573
|
-
return paths.map((
|
|
29573
|
+
return paths.map((path8) => {
|
|
29574
29574
|
return {
|
|
29575
|
-
encoded:
|
|
29576
|
-
decoded: $refs[
|
|
29575
|
+
encoded: path8,
|
|
29576
|
+
decoded: $refs[path8].pathType === "file" ? url.toFileSystemPath(path8, true) : path8
|
|
29577
29577
|
};
|
|
29578
29578
|
});
|
|
29579
29579
|
}
|
|
@@ -29720,18 +29720,18 @@ var require_parse2 = __commonJS({
|
|
|
29720
29720
|
var url = __importStar(require_url());
|
|
29721
29721
|
var plugins = __importStar(require_plugins());
|
|
29722
29722
|
var errors_js_1 = require_errors3();
|
|
29723
|
-
async function parse6(
|
|
29724
|
-
const hashIndex =
|
|
29723
|
+
async function parse6(path8, $refs, options) {
|
|
29724
|
+
const hashIndex = path8.indexOf("#");
|
|
29725
29725
|
let hash = "";
|
|
29726
29726
|
if (hashIndex >= 0) {
|
|
29727
|
-
hash =
|
|
29728
|
-
|
|
29727
|
+
hash = path8.substring(hashIndex);
|
|
29728
|
+
path8 = path8.substring(0, hashIndex);
|
|
29729
29729
|
}
|
|
29730
|
-
const $ref = $refs._add(
|
|
29730
|
+
const $ref = $refs._add(path8);
|
|
29731
29731
|
const file = {
|
|
29732
|
-
url:
|
|
29732
|
+
url: path8,
|
|
29733
29733
|
hash,
|
|
29734
|
-
extension: url.getExtension(
|
|
29734
|
+
extension: url.getExtension(path8)
|
|
29735
29735
|
};
|
|
29736
29736
|
try {
|
|
29737
29737
|
const resolver = await readFile3(file, options, $refs);
|
|
@@ -32864,23 +32864,23 @@ var require_file2 = __commonJS({
|
|
|
32864
32864
|
* Reads the given file and returns its raw contents as a Buffer.
|
|
32865
32865
|
*/
|
|
32866
32866
|
async read(file) {
|
|
32867
|
-
let
|
|
32867
|
+
let path8;
|
|
32868
32868
|
try {
|
|
32869
|
-
|
|
32869
|
+
path8 = url.toFileSystemPath(file.url);
|
|
32870
32870
|
} catch (err) {
|
|
32871
32871
|
const e = err;
|
|
32872
32872
|
e.message = `Malformed URI: ${file.url}: ${e.message}`;
|
|
32873
32873
|
throw new errors_js_1.ResolverError(e, file.url);
|
|
32874
32874
|
}
|
|
32875
|
-
if (
|
|
32876
|
-
|
|
32875
|
+
if (path8.endsWith("/") || path8.endsWith("\\")) {
|
|
32876
|
+
path8 = path8.slice(0, -1);
|
|
32877
32877
|
}
|
|
32878
32878
|
try {
|
|
32879
|
-
return await fs_1.default.promises.readFile(
|
|
32879
|
+
return await fs_1.default.promises.readFile(path8);
|
|
32880
32880
|
} catch (err) {
|
|
32881
32881
|
const e = err;
|
|
32882
|
-
e.message = `Error opening file ${
|
|
32883
|
-
throw new errors_js_1.ResolverError(e,
|
|
32882
|
+
e.message = `Error opening file ${path8}: ${e.message}`;
|
|
32883
|
+
throw new errors_js_1.ResolverError(e, path8);
|
|
32884
32884
|
}
|
|
32885
32885
|
}
|
|
32886
32886
|
};
|
|
@@ -32989,7 +32989,7 @@ var require_http = __commonJS({
|
|
|
32989
32989
|
const redirects = _redirects || [];
|
|
32990
32990
|
redirects.push(u.href);
|
|
32991
32991
|
try {
|
|
32992
|
-
const res = await
|
|
32992
|
+
const res = await get3(u, httpOptions);
|
|
32993
32993
|
if (res.status >= 400) {
|
|
32994
32994
|
const error2 = new Error(`HTTP ERROR ${res.status}`);
|
|
32995
32995
|
error2.status = res.status;
|
|
@@ -33022,7 +33022,7 @@ Too many redirects:
|
|
|
33022
33022
|
throw new errors_js_1.ResolverError(e, u.href);
|
|
33023
33023
|
}
|
|
33024
33024
|
}
|
|
33025
|
-
async function
|
|
33025
|
+
async function get3(u, httpOptions) {
|
|
33026
33026
|
let controller;
|
|
33027
33027
|
let timeoutId;
|
|
33028
33028
|
if (httpOptions.timeout) {
|
|
@@ -33174,7 +33174,7 @@ var require_normalize_args = __commonJS({
|
|
|
33174
33174
|
exports2.normalizeArgs = normalizeArgs2;
|
|
33175
33175
|
var options_js_1 = require_options();
|
|
33176
33176
|
function normalizeArgs2(_args) {
|
|
33177
|
-
let
|
|
33177
|
+
let path8;
|
|
33178
33178
|
let schema2;
|
|
33179
33179
|
let options;
|
|
33180
33180
|
let callback;
|
|
@@ -33183,7 +33183,7 @@ var require_normalize_args = __commonJS({
|
|
|
33183
33183
|
callback = args.pop();
|
|
33184
33184
|
}
|
|
33185
33185
|
if (typeof args[0] === "string") {
|
|
33186
|
-
|
|
33186
|
+
path8 = args[0];
|
|
33187
33187
|
if (typeof args[2] === "object") {
|
|
33188
33188
|
schema2 = args[1];
|
|
33189
33189
|
options = args[2];
|
|
@@ -33192,7 +33192,7 @@ var require_normalize_args = __commonJS({
|
|
|
33192
33192
|
options = args[1];
|
|
33193
33193
|
}
|
|
33194
33194
|
} else {
|
|
33195
|
-
|
|
33195
|
+
path8 = "";
|
|
33196
33196
|
schema2 = args[0];
|
|
33197
33197
|
options = args[1];
|
|
33198
33198
|
}
|
|
@@ -33205,7 +33205,7 @@ var require_normalize_args = __commonJS({
|
|
|
33205
33205
|
schema2 = JSON.parse(JSON.stringify(schema2));
|
|
33206
33206
|
}
|
|
33207
33207
|
return {
|
|
33208
|
-
path:
|
|
33208
|
+
path: path8,
|
|
33209
33209
|
schema: schema2,
|
|
33210
33210
|
options,
|
|
33211
33211
|
callback
|
|
@@ -33276,26 +33276,26 @@ var require_resolve_external = __commonJS({
|
|
|
33276
33276
|
return Promise.reject(e);
|
|
33277
33277
|
}
|
|
33278
33278
|
}
|
|
33279
|
-
function crawl4(obj,
|
|
33279
|
+
function crawl4(obj, path8, $refs, options, seen, external) {
|
|
33280
33280
|
seen ||= /* @__PURE__ */ new Set();
|
|
33281
33281
|
let promises3 = [];
|
|
33282
33282
|
if (obj && typeof obj === "object" && !ArrayBuffer.isView(obj) && !seen.has(obj)) {
|
|
33283
33283
|
seen.add(obj);
|
|
33284
33284
|
if (ref_js_1.default.isExternal$Ref(obj)) {
|
|
33285
|
-
promises3.push(resolve$Ref2(obj,
|
|
33285
|
+
promises3.push(resolve$Ref2(obj, path8, $refs, options));
|
|
33286
33286
|
}
|
|
33287
33287
|
const keys = Object.keys(obj);
|
|
33288
33288
|
for (const key of keys) {
|
|
33289
|
-
const keyPath = pointer_js_1.default.join(
|
|
33289
|
+
const keyPath = pointer_js_1.default.join(path8, key);
|
|
33290
33290
|
const value = obj[key];
|
|
33291
33291
|
promises3 = promises3.concat(crawl4(value, keyPath, $refs, options, seen, external));
|
|
33292
33292
|
}
|
|
33293
33293
|
}
|
|
33294
33294
|
return promises3;
|
|
33295
33295
|
}
|
|
33296
|
-
async function resolve$Ref2($ref,
|
|
33296
|
+
async function resolve$Ref2($ref, path8, $refs, options) {
|
|
33297
33297
|
const shouldResolveOnCwd = options.dereference?.externalReferenceResolution === "root";
|
|
33298
|
-
const resolvedPath = url.resolve(shouldResolveOnCwd ? url.cwd() :
|
|
33298
|
+
const resolvedPath = url.resolve(shouldResolveOnCwd ? url.cwd() : path8, $ref.$ref);
|
|
33299
33299
|
const withoutHash = url.stripHash(resolvedPath);
|
|
33300
33300
|
const ref = $refs._$refs[withoutHash];
|
|
33301
33301
|
if (ref) {
|
|
@@ -33310,8 +33310,8 @@ var require_resolve_external = __commonJS({
|
|
|
33310
33310
|
throw err;
|
|
33311
33311
|
}
|
|
33312
33312
|
if ($refs._$refs[withoutHash]) {
|
|
33313
|
-
err.source = decodeURI(url.stripHash(
|
|
33314
|
-
err.path = url.safePointerToPath(url.getHash(
|
|
33313
|
+
err.source = decodeURI(url.stripHash(path8));
|
|
33314
|
+
err.path = url.safePointerToPath(url.getHash(path8));
|
|
33315
33315
|
}
|
|
33316
33316
|
return [];
|
|
33317
33317
|
}
|
|
@@ -33373,13 +33373,13 @@ var require_bundle = __commonJS({
|
|
|
33373
33373
|
crawl4(parser, "schema", parser.$refs._root$Ref.path + "#", "#", 0, inventory, parser.$refs, options);
|
|
33374
33374
|
remap2(inventory);
|
|
33375
33375
|
}
|
|
33376
|
-
function crawl4(parent, key,
|
|
33376
|
+
function crawl4(parent, key, path8, pathFromRoot, indirections, inventory, $refs, options) {
|
|
33377
33377
|
const obj = key === null ? parent : parent[key];
|
|
33378
33378
|
const bundleOptions = options.bundle || {};
|
|
33379
33379
|
const isExcludedPath = bundleOptions.excludedPathMatcher || (() => false);
|
|
33380
33380
|
if (obj && typeof obj === "object" && !ArrayBuffer.isView(obj) && !isExcludedPath(pathFromRoot)) {
|
|
33381
33381
|
if (ref_js_1.default.isAllowed$Ref(obj)) {
|
|
33382
|
-
inventory$Ref2(parent, key,
|
|
33382
|
+
inventory$Ref2(parent, key, path8, pathFromRoot, indirections, inventory, $refs, options);
|
|
33383
33383
|
} else {
|
|
33384
33384
|
const keys = Object.keys(obj).sort((a, b) => {
|
|
33385
33385
|
if (a === "definitions" || a === "$defs") {
|
|
@@ -33391,11 +33391,11 @@ var require_bundle = __commonJS({
|
|
|
33391
33391
|
}
|
|
33392
33392
|
});
|
|
33393
33393
|
for (const key2 of keys) {
|
|
33394
|
-
const keyPath = pointer_js_1.default.join(
|
|
33394
|
+
const keyPath = pointer_js_1.default.join(path8, key2);
|
|
33395
33395
|
const keyPathFromRoot = pointer_js_1.default.join(pathFromRoot, key2);
|
|
33396
33396
|
const value = obj[key2];
|
|
33397
33397
|
if (ref_js_1.default.isAllowed$Ref(value)) {
|
|
33398
|
-
inventory$Ref2(obj, key2,
|
|
33398
|
+
inventory$Ref2(obj, key2, path8, keyPathFromRoot, indirections, inventory, $refs, options);
|
|
33399
33399
|
} else {
|
|
33400
33400
|
crawl4(obj, key2, keyPath, keyPathFromRoot, indirections, inventory, $refs, options);
|
|
33401
33401
|
}
|
|
@@ -33408,9 +33408,9 @@ var require_bundle = __commonJS({
|
|
|
33408
33408
|
}
|
|
33409
33409
|
}
|
|
33410
33410
|
}
|
|
33411
|
-
function inventory$Ref2($refParent, $refKey,
|
|
33411
|
+
function inventory$Ref2($refParent, $refKey, path8, pathFromRoot, indirections, inventory, $refs, options) {
|
|
33412
33412
|
const $ref = $refKey === null ? $refParent : $refParent[$refKey];
|
|
33413
|
-
const $refPath = url.resolve(
|
|
33413
|
+
const $refPath = url.resolve(path8, $ref.$ref);
|
|
33414
33414
|
const pointer = $refs._resolve($refPath, pathFromRoot, options);
|
|
33415
33415
|
if (pointer === null) {
|
|
33416
33416
|
return;
|
|
@@ -33575,7 +33575,7 @@ var require_dereference = __commonJS({
|
|
|
33575
33575
|
parser.$refs.circular = dereferenced.circular;
|
|
33576
33576
|
parser.schema = dereferenced.value;
|
|
33577
33577
|
}
|
|
33578
|
-
function crawl4(obj,
|
|
33578
|
+
function crawl4(obj, path8, pathFromRoot, parents, processedObjects, dereferencedCache, $refs, options, startTime) {
|
|
33579
33579
|
let dereferenced;
|
|
33580
33580
|
const result = {
|
|
33581
33581
|
value: obj,
|
|
@@ -33589,13 +33589,13 @@ var require_dereference = __commonJS({
|
|
|
33589
33589
|
parents.add(obj);
|
|
33590
33590
|
processedObjects.add(obj);
|
|
33591
33591
|
if (ref_js_1.default.isAllowed$Ref(obj, options)) {
|
|
33592
|
-
dereferenced = dereference$Ref2(obj,
|
|
33592
|
+
dereferenced = dereference$Ref2(obj, path8, pathFromRoot, parents, processedObjects, dereferencedCache, $refs, options, startTime);
|
|
33593
33593
|
result.circular = dereferenced.circular;
|
|
33594
33594
|
result.value = dereferenced.value;
|
|
33595
33595
|
} else {
|
|
33596
33596
|
for (const key of Object.keys(obj)) {
|
|
33597
33597
|
checkDereferenceTimeout2(startTime, options);
|
|
33598
|
-
const keyPath = pointer_js_1.default.join(
|
|
33598
|
+
const keyPath = pointer_js_1.default.join(path8, key);
|
|
33599
33599
|
const keyPathFromRoot = pointer_js_1.default.join(pathFromRoot, key);
|
|
33600
33600
|
if (isExcludedPath(keyPathFromRoot)) {
|
|
33601
33601
|
continue;
|
|
@@ -33645,10 +33645,10 @@ var require_dereference = __commonJS({
|
|
|
33645
33645
|
}
|
|
33646
33646
|
return result;
|
|
33647
33647
|
}
|
|
33648
|
-
function dereference$Ref2($ref,
|
|
33648
|
+
function dereference$Ref2($ref, path8, pathFromRoot, parents, processedObjects, dereferencedCache, $refs, options, startTime) {
|
|
33649
33649
|
const isExternalRef = ref_js_1.default.isExternal$Ref($ref);
|
|
33650
33650
|
const shouldResolveOnCwd = isExternalRef && options?.dereference?.externalReferenceResolution === "root";
|
|
33651
|
-
const $refPath = url.resolve(shouldResolveOnCwd ? url.cwd() :
|
|
33651
|
+
const $refPath = url.resolve(shouldResolveOnCwd ? url.cwd() : path8, $ref.$ref);
|
|
33652
33652
|
const cache = dereferencedCache.get($refPath);
|
|
33653
33653
|
if (cache) {
|
|
33654
33654
|
if (!cache.circular) {
|
|
@@ -33676,7 +33676,7 @@ var require_dereference = __commonJS({
|
|
|
33676
33676
|
return cache;
|
|
33677
33677
|
}
|
|
33678
33678
|
}
|
|
33679
|
-
const pointer = $refs._resolve($refPath,
|
|
33679
|
+
const pointer = $refs._resolve($refPath, path8, options);
|
|
33680
33680
|
if (pointer === null) {
|
|
33681
33681
|
return {
|
|
33682
33682
|
circular: false,
|
|
@@ -33686,7 +33686,7 @@ var require_dereference = __commonJS({
|
|
|
33686
33686
|
const directCircular = pointer.circular;
|
|
33687
33687
|
let circular = directCircular || parents.has(pointer.value);
|
|
33688
33688
|
if (circular) {
|
|
33689
|
-
foundCircularReference2(
|
|
33689
|
+
foundCircularReference2(path8, $refs, options);
|
|
33690
33690
|
}
|
|
33691
33691
|
let dereferencedValue = ref_js_1.default.dereference($ref, pointer.value);
|
|
33692
33692
|
if (!circular) {
|
|
@@ -35662,13 +35662,13 @@ var require_json3 = __commonJS({
|
|
|
35662
35662
|
});
|
|
35663
35663
|
Object.defineProperty(exports2, "getDecoratedDataPath", {
|
|
35664
35664
|
enumerable: true,
|
|
35665
|
-
get: function
|
|
35665
|
+
get: function get3() {
|
|
35666
35666
|
return _getDecoratedDataPath["default"];
|
|
35667
35667
|
}
|
|
35668
35668
|
});
|
|
35669
35669
|
Object.defineProperty(exports2, "getMetaFromPath", {
|
|
35670
35670
|
enumerable: true,
|
|
35671
|
-
get: function
|
|
35671
|
+
get: function get3() {
|
|
35672
35672
|
return _getMetaFromPath["default"];
|
|
35673
35673
|
}
|
|
35674
35674
|
});
|
|
@@ -35713,7 +35713,7 @@ var require_base = __commonJS({
|
|
|
35713
35713
|
// creating an empty proxy that'll just return the arguments of any color functions we
|
|
35714
35714
|
// invoke, sans any colorization.
|
|
35715
35715
|
new Proxy({}, {
|
|
35716
|
-
get: function
|
|
35716
|
+
get: function get3() {
|
|
35717
35717
|
return function(arg) {
|
|
35718
35718
|
return arg;
|
|
35719
35719
|
};
|
|
@@ -35764,7 +35764,7 @@ var require_base = __commonJS({
|
|
|
35764
35764
|
*/
|
|
35765
35765
|
}, {
|
|
35766
35766
|
key: "instancePath",
|
|
35767
|
-
get: function
|
|
35767
|
+
get: function get3() {
|
|
35768
35768
|
return typeof this.options.instancePath !== "undefined" ? this.options.instancePath : this.options.dataPath;
|
|
35769
35769
|
}
|
|
35770
35770
|
}, {
|
|
@@ -36012,7 +36012,7 @@ var require_jsonpointer = __commonJS({
|
|
|
36012
36012
|
}
|
|
36013
36013
|
throw new Error("Invalid JSON pointer.");
|
|
36014
36014
|
}
|
|
36015
|
-
function
|
|
36015
|
+
function get3(obj, pointer) {
|
|
36016
36016
|
if (typeof obj !== "object") throw new Error("Invalid input object.");
|
|
36017
36017
|
pointer = compilePointer(pointer);
|
|
36018
36018
|
var len = pointer.length;
|
|
@@ -36033,14 +36033,14 @@ var require_jsonpointer = __commonJS({
|
|
|
36033
36033
|
var compiled = compilePointer(pointer);
|
|
36034
36034
|
return {
|
|
36035
36035
|
get: function(object) {
|
|
36036
|
-
return
|
|
36036
|
+
return get3(object, compiled);
|
|
36037
36037
|
},
|
|
36038
36038
|
set: function(object, value) {
|
|
36039
36039
|
return set2(object, compiled, value);
|
|
36040
36040
|
}
|
|
36041
36041
|
};
|
|
36042
36042
|
}
|
|
36043
|
-
exports2.get =
|
|
36043
|
+
exports2.get = get3;
|
|
36044
36044
|
exports2.set = set2;
|
|
36045
36045
|
exports2.compile = compile;
|
|
36046
36046
|
}
|
|
@@ -36527,37 +36527,37 @@ var require_validation_errors = __commonJS({
|
|
|
36527
36527
|
});
|
|
36528
36528
|
Object.defineProperty(exports2, "AdditionalPropValidationError", {
|
|
36529
36529
|
enumerable: true,
|
|
36530
|
-
get: function
|
|
36530
|
+
get: function get3() {
|
|
36531
36531
|
return _additionalProp["default"];
|
|
36532
36532
|
}
|
|
36533
36533
|
});
|
|
36534
36534
|
Object.defineProperty(exports2, "DefaultValidationError", {
|
|
36535
36535
|
enumerable: true,
|
|
36536
|
-
get: function
|
|
36536
|
+
get: function get3() {
|
|
36537
36537
|
return _default2["default"];
|
|
36538
36538
|
}
|
|
36539
36539
|
});
|
|
36540
36540
|
Object.defineProperty(exports2, "EnumValidationError", {
|
|
36541
36541
|
enumerable: true,
|
|
36542
|
-
get: function
|
|
36542
|
+
get: function get3() {
|
|
36543
36543
|
return _enum["default"];
|
|
36544
36544
|
}
|
|
36545
36545
|
});
|
|
36546
36546
|
Object.defineProperty(exports2, "PatternValidationError", {
|
|
36547
36547
|
enumerable: true,
|
|
36548
|
-
get: function
|
|
36548
|
+
get: function get3() {
|
|
36549
36549
|
return _pattern["default"];
|
|
36550
36550
|
}
|
|
36551
36551
|
});
|
|
36552
36552
|
Object.defineProperty(exports2, "RequiredValidationError", {
|
|
36553
36553
|
enumerable: true,
|
|
36554
|
-
get: function
|
|
36554
|
+
get: function get3() {
|
|
36555
36555
|
return _required["default"];
|
|
36556
36556
|
}
|
|
36557
36557
|
});
|
|
36558
36558
|
Object.defineProperty(exports2, "UnevaluatedPropValidationError", {
|
|
36559
36559
|
enumerable: true,
|
|
36560
|
-
get: function
|
|
36560
|
+
get: function get3() {
|
|
36561
36561
|
return _unevaluatedProp["default"];
|
|
36562
36562
|
}
|
|
36563
36563
|
});
|
|
@@ -36618,15 +36618,15 @@ var require_helpers = __commonJS({
|
|
|
36618
36618
|
var instancePath = typeof ajvError.instancePath !== "undefined" ? ajvError.instancePath : ajvError.dataPath;
|
|
36619
36619
|
var paths = instancePath === "" ? [""] : instancePath.match(JSON_POINTERS_REGEX);
|
|
36620
36620
|
if (paths) {
|
|
36621
|
-
paths.reduce(function(obj,
|
|
36622
|
-
obj.children[
|
|
36621
|
+
paths.reduce(function(obj, path8, i) {
|
|
36622
|
+
obj.children[path8] = obj.children[path8] || {
|
|
36623
36623
|
children: {},
|
|
36624
36624
|
errors: []
|
|
36625
36625
|
};
|
|
36626
36626
|
if (i === paths.length - 1) {
|
|
36627
|
-
obj.children[
|
|
36627
|
+
obj.children[path8].errors.push(ajvError);
|
|
36628
36628
|
}
|
|
36629
|
-
return obj.children[
|
|
36629
|
+
return obj.children[path8];
|
|
36630
36630
|
}, root);
|
|
36631
36631
|
}
|
|
36632
36632
|
});
|
|
@@ -39934,8 +39934,8 @@ var require_utils4 = __commonJS({
|
|
|
39934
39934
|
}
|
|
39935
39935
|
return ind;
|
|
39936
39936
|
}
|
|
39937
|
-
function removeDotSegments(
|
|
39938
|
-
let input =
|
|
39937
|
+
function removeDotSegments(path8) {
|
|
39938
|
+
let input = path8;
|
|
39939
39939
|
const output = [];
|
|
39940
39940
|
let nextSlash = -1;
|
|
39941
39941
|
let len = 0;
|
|
@@ -40187,8 +40187,8 @@ var require_schemes = __commonJS({
|
|
|
40187
40187
|
wsComponent.secure = void 0;
|
|
40188
40188
|
}
|
|
40189
40189
|
if (wsComponent.resourceName) {
|
|
40190
|
-
const [
|
|
40191
|
-
wsComponent.path =
|
|
40190
|
+
const [path8, query] = wsComponent.resourceName.split("?");
|
|
40191
|
+
wsComponent.path = path8 && path8 !== "/" ? path8 : void 0;
|
|
40192
40192
|
wsComponent.query = query;
|
|
40193
40193
|
wsComponent.resourceName = void 0;
|
|
40194
40194
|
}
|
|
@@ -46649,8 +46649,8 @@ function getIDToken(aud) {
|
|
|
46649
46649
|
}
|
|
46650
46650
|
|
|
46651
46651
|
// src/index.ts
|
|
46652
|
-
var
|
|
46653
|
-
var
|
|
46652
|
+
var import_node_crypto2 = require("node:crypto");
|
|
46653
|
+
var import_node_fs3 = require("node:fs");
|
|
46654
46654
|
var import_yaml3 = __toESM(require_dist(), 1);
|
|
46655
46655
|
|
|
46656
46656
|
// src/contracts.ts
|
|
@@ -46742,6 +46742,35 @@ var customerPreviewActionContract = {
|
|
|
46742
46742
|
default: "",
|
|
46743
46743
|
allowedValues: ["3.0", "3.1"]
|
|
46744
46744
|
},
|
|
46745
|
+
"breaking-change-mode": {
|
|
46746
|
+
description: "OpenAPI breaking-change comparison mode.",
|
|
46747
|
+
required: false,
|
|
46748
|
+
default: "off",
|
|
46749
|
+
allowedValues: ["off", "pr-native", "baseline-only", "previous-spec"]
|
|
46750
|
+
},
|
|
46751
|
+
"breaking-baseline-spec-path": {
|
|
46752
|
+
description: "Workspace-relative baseline OpenAPI spec path used by baseline-only mode and pr-native fallback.",
|
|
46753
|
+
required: false
|
|
46754
|
+
},
|
|
46755
|
+
"breaking-rules-path": {
|
|
46756
|
+
description: "Workspace-relative openapi-changes rules file. Missing files are ignored.",
|
|
46757
|
+
required: false,
|
|
46758
|
+
default: "changes-rules.yaml"
|
|
46759
|
+
},
|
|
46760
|
+
"breaking-target-ref": {
|
|
46761
|
+
description: "Optional target branch or git ref override for pr-native breaking-change comparisons.",
|
|
46762
|
+
required: false
|
|
46763
|
+
},
|
|
46764
|
+
"breaking-summary-path": {
|
|
46765
|
+
description: "Optional markdown report output path. Defaults to a runner-temp file.",
|
|
46766
|
+
required: false,
|
|
46767
|
+
default: ""
|
|
46768
|
+
},
|
|
46769
|
+
"breaking-log-path": {
|
|
46770
|
+
description: "Optional raw command log output path. Defaults to a runner-temp file.",
|
|
46771
|
+
required: false,
|
|
46772
|
+
default: ""
|
|
46773
|
+
},
|
|
46745
46774
|
"governance-mapping-json": {
|
|
46746
46775
|
description: "Legacy JSON map of business domain to governance group name. Prefer governance-group or the postman-governance-group repository custom property.",
|
|
46747
46776
|
required: false,
|
|
@@ -46820,6 +46849,12 @@ var customerPreviewActionContract = {
|
|
|
46820
46849
|
},
|
|
46821
46850
|
"lint-summary-json": {
|
|
46822
46851
|
description: "JSON summary of lint errors and warnings."
|
|
46852
|
+
},
|
|
46853
|
+
"breaking-change-status": {
|
|
46854
|
+
description: "OpenAPI breaking-change check status."
|
|
46855
|
+
},
|
|
46856
|
+
"breaking-change-summary-json": {
|
|
46857
|
+
description: "JSON summary of the OpenAPI breaking-change check."
|
|
46823
46858
|
}
|
|
46824
46859
|
},
|
|
46825
46860
|
retainedBehavior: [
|
|
@@ -46829,6 +46864,7 @@ var customerPreviewActionContract = {
|
|
|
46829
46864
|
"workspace admin assignment",
|
|
46830
46865
|
"spec upload to Spec Hub",
|
|
46831
46866
|
"OpenAPI operation summary normalization before upload (missing or oversized summaries)",
|
|
46867
|
+
"optional OpenAPI breaking-change detection before Postman mutations",
|
|
46832
46868
|
"spec linting by UID",
|
|
46833
46869
|
"baseline, smoke, and contract collection generation",
|
|
46834
46870
|
"collection refresh and versioning policies",
|
|
@@ -46924,10 +46960,10 @@ function sanitizeHeaders(headers, secretValues) {
|
|
|
46924
46960
|
}
|
|
46925
46961
|
|
|
46926
46962
|
// src/lib/github/github-api-client.ts
|
|
46927
|
-
function buildErrorMessage(method,
|
|
46963
|
+
function buildErrorMessage(method, path8, response, body, masker) {
|
|
46928
46964
|
const status = `${response.status}${response.statusText ? ` ${response.statusText}` : ""}`;
|
|
46929
46965
|
const sanitizedBody = masker(body || "");
|
|
46930
|
-
return sanitizedBody ? masker(`${method} ${
|
|
46966
|
+
return sanitizedBody ? masker(`${method} ${path8} failed with ${status} - ${sanitizedBody}`) : masker(`${method} ${path8} failed with ${status} - [REDACTED]`);
|
|
46931
46967
|
}
|
|
46932
46968
|
var GitHubApiClient = class {
|
|
46933
46969
|
apiBase;
|
|
@@ -46977,11 +47013,11 @@ var GitHubApiClient = class {
|
|
|
46977
47013
|
}
|
|
46978
47014
|
return ordered;
|
|
46979
47015
|
}
|
|
46980
|
-
isVariablesEndpoint(
|
|
46981
|
-
return
|
|
47016
|
+
isVariablesEndpoint(path8) {
|
|
47017
|
+
return path8.startsWith(`/repos/${this.owner}/${this.repo}/actions/variables`);
|
|
46982
47018
|
}
|
|
46983
|
-
canUseFallback(
|
|
46984
|
-
return this.isVariablesEndpoint(
|
|
47019
|
+
canUseFallback(path8) {
|
|
47020
|
+
return this.isVariablesEndpoint(path8) || path8 === `/repos/${this.owner}/${this.repo}/properties/values` || path8.includes(`/repos/${this.owner}/${this.repo}/contents`) || path8.includes("/dispatches");
|
|
46985
47021
|
}
|
|
46986
47022
|
rateLimitDelayMs(response, attempt) {
|
|
46987
47023
|
const retryAfter = Number(response.headers.get("retry-after") || "");
|
|
@@ -46999,14 +47035,14 @@ var GitHubApiClient = class {
|
|
|
46999
47035
|
const jitter = Math.floor(Math.random() * 250);
|
|
47000
47036
|
return Math.min(base + jitter, 12e4);
|
|
47001
47037
|
}
|
|
47002
|
-
async requestWithToken(
|
|
47038
|
+
async requestWithToken(path8, init, token) {
|
|
47003
47039
|
const MAX_RETRIES = 5;
|
|
47004
47040
|
const normalizedToken = String(token || "").trim();
|
|
47005
47041
|
if (!normalizedToken) {
|
|
47006
|
-
throw new Error(`Missing GitHub auth token for request ${
|
|
47042
|
+
throw new Error(`Missing GitHub auth token for request ${path8}`);
|
|
47007
47043
|
}
|
|
47008
47044
|
for (let attempt = 0; ; attempt++) {
|
|
47009
|
-
const response = await this.fetchImpl(`${this.apiBase}${
|
|
47045
|
+
const response = await this.fetchImpl(`${this.apiBase}${path8}`, {
|
|
47010
47046
|
...init,
|
|
47011
47047
|
headers: {
|
|
47012
47048
|
Accept: "application/vnd.github+json",
|
|
@@ -47029,28 +47065,28 @@ var GitHubApiClient = class {
|
|
|
47029
47065
|
return response;
|
|
47030
47066
|
}
|
|
47031
47067
|
}
|
|
47032
|
-
async request(
|
|
47068
|
+
async request(path8, init = {}) {
|
|
47033
47069
|
const orderedTokens = this.getTokenOrder();
|
|
47034
47070
|
if (orderedTokens.length === 0) {
|
|
47035
47071
|
throw new Error("No GitHub auth token configured");
|
|
47036
47072
|
}
|
|
47037
|
-
const first = await this.requestWithToken(
|
|
47038
|
-
if (orderedTokens.length < 2 || !this.canUseFallback(
|
|
47073
|
+
const first = await this.requestWithToken(path8, init, orderedTokens[0]);
|
|
47074
|
+
if (orderedTokens.length < 2 || !this.canUseFallback(path8)) {
|
|
47039
47075
|
return first;
|
|
47040
47076
|
}
|
|
47041
|
-
const isVariableGet404 = first.status === 404 && (!init.method || init.method === "GET") && this.isVariablesEndpoint(
|
|
47077
|
+
const isVariableGet404 = first.status === 404 && (!init.method || init.method === "GET") && this.isVariablesEndpoint(path8);
|
|
47042
47078
|
if (first.status !== 403 && !isVariableGet404) {
|
|
47043
47079
|
return first;
|
|
47044
47080
|
}
|
|
47045
|
-
return this.requestWithToken(
|
|
47081
|
+
return this.requestWithToken(path8, init, orderedTokens[1]);
|
|
47046
47082
|
}
|
|
47047
47083
|
async setRepositoryVariable(name, value) {
|
|
47048
47084
|
if (!value) {
|
|
47049
47085
|
throw new Error(`Repo variable ${name} is empty`);
|
|
47050
47086
|
}
|
|
47051
|
-
const
|
|
47087
|
+
const path8 = `/repos/${this.repository}/actions/variables`;
|
|
47052
47088
|
const body = JSON.stringify({ name, value: String(value) });
|
|
47053
|
-
const createResponse = await this.request(
|
|
47089
|
+
const createResponse = await this.request(path8, {
|
|
47054
47090
|
method: "POST",
|
|
47055
47091
|
body
|
|
47056
47092
|
});
|
|
@@ -47073,12 +47109,12 @@ var GitHubApiClient = class {
|
|
|
47073
47109
|
}
|
|
47074
47110
|
const text = await createResponse.text().catch(() => "");
|
|
47075
47111
|
throw new Error(
|
|
47076
|
-
buildErrorMessage("POST",
|
|
47112
|
+
buildErrorMessage("POST", path8, createResponse, text, this.secretMasker)
|
|
47077
47113
|
);
|
|
47078
47114
|
}
|
|
47079
47115
|
async getRepositoryVariable(name) {
|
|
47080
|
-
const
|
|
47081
|
-
const response = await this.request(
|
|
47116
|
+
const path8 = `/repos/${this.repository}/actions/variables/${name}`;
|
|
47117
|
+
const response = await this.request(path8, {
|
|
47082
47118
|
method: "GET"
|
|
47083
47119
|
});
|
|
47084
47120
|
if (response.status === 404) {
|
|
@@ -47087,15 +47123,15 @@ var GitHubApiClient = class {
|
|
|
47087
47123
|
if (!response.ok) {
|
|
47088
47124
|
const text = await response.text().catch(() => "");
|
|
47089
47125
|
throw new Error(
|
|
47090
|
-
buildErrorMessage("GET",
|
|
47126
|
+
buildErrorMessage("GET", path8, response, text, this.secretMasker)
|
|
47091
47127
|
);
|
|
47092
47128
|
}
|
|
47093
47129
|
const data = await response.json();
|
|
47094
47130
|
return String(data.value || "");
|
|
47095
47131
|
}
|
|
47096
47132
|
async getRepositoryCustomProperty(name) {
|
|
47097
|
-
const
|
|
47098
|
-
const response = await this.request(
|
|
47133
|
+
const path8 = `/repos/${this.repository}/properties/values`;
|
|
47134
|
+
const response = await this.request(path8, {
|
|
47099
47135
|
method: "GET"
|
|
47100
47136
|
});
|
|
47101
47137
|
if (response.status === 404) {
|
|
@@ -47104,7 +47140,7 @@ var GitHubApiClient = class {
|
|
|
47104
47140
|
if (!response.ok) {
|
|
47105
47141
|
const text = await response.text().catch(() => "");
|
|
47106
47142
|
throw new Error(
|
|
47107
|
-
buildErrorMessage("GET",
|
|
47143
|
+
buildErrorMessage("GET", path8, response, text, this.secretMasker)
|
|
47108
47144
|
);
|
|
47109
47145
|
}
|
|
47110
47146
|
const values = await response.json();
|
|
@@ -47186,6 +47222,593 @@ var HttpError = class _HttpError extends Error {
|
|
|
47186
47222
|
}
|
|
47187
47223
|
};
|
|
47188
47224
|
|
|
47225
|
+
// src/lib/openapi-changes.ts
|
|
47226
|
+
var import_node_crypto = require("node:crypto");
|
|
47227
|
+
var import_node_fs = require("node:fs");
|
|
47228
|
+
var import_promises = require("node:fs/promises");
|
|
47229
|
+
var import_node_https = require("node:https");
|
|
47230
|
+
var import_node_os = __toESM(require("node:os"), 1);
|
|
47231
|
+
var import_node_path = __toESM(require("node:path"), 1);
|
|
47232
|
+
var TOOL_NAME = "openapi-changes";
|
|
47233
|
+
var OPENAPI_CHANGES_VERSION = "0.2.7";
|
|
47234
|
+
var RELEASE_BASE_URL = `https://github.com/pb33f/openapi-changes/releases/download/v${OPENAPI_CHANGES_VERSION}`;
|
|
47235
|
+
var CHECKSUMS = {
|
|
47236
|
+
"0.2.7": {
|
|
47237
|
+
"openapi-changes_0.2.7_darwin_arm64.tar.gz": "03e65e0d16c51fb8d43a93318409027bd9cd7c7c3355061d23c084c1ac9c0f7b",
|
|
47238
|
+
"openapi-changes_0.2.7_darwin_x86_64.tar.gz": "c064dab16fac342926126d060efd157ff283e18548ccf6081a7a71a8d3c5bc04",
|
|
47239
|
+
"openapi-changes_0.2.7_linux_arm64.tar.gz": "698b29336699fd4ec61e52585f140a6450d112c1eb1c637bbe34c13b4203fecc",
|
|
47240
|
+
"openapi-changes_0.2.7_linux_i386.tar.gz": "bb95699989ef67d0fd9d8644e56b1e183dea4dc439e59d051fe6964b87636f8c",
|
|
47241
|
+
"openapi-changes_0.2.7_linux_x86_64.tar.gz": "333742ea369c90437fbda47a814cf2393cb65eaa3867268a4c86281e74f614bf",
|
|
47242
|
+
"openapi-changes_0.2.7_windows_arm64.tar.gz": "3dfc29f88fb4332a3bf2d6d45fb9ab02ef907e7bc45fb8e8630ad943c4b9d814",
|
|
47243
|
+
"openapi-changes_0.2.7_windows_i386.tar.gz": "78e868e15d0e15f358f7f350af3c9532f6720a140bbb9241dbb947d49c6ec20c",
|
|
47244
|
+
"openapi-changes_0.2.7_windows_x86_64.tar.gz": "fff5a68713b9093ad8ab547d214b5a3b9139ad71e90ee9e1347b3f9bd6e1e191"
|
|
47245
|
+
}
|
|
47246
|
+
};
|
|
47247
|
+
function firstValue(...values) {
|
|
47248
|
+
return values.find((value) => String(value ?? "").trim())?.trim();
|
|
47249
|
+
}
|
|
47250
|
+
function getWorkspaceRoot(env = process.env) {
|
|
47251
|
+
return (0, import_node_fs.realpathSync)(import_node_path.default.resolve(env.GITHUB_WORKSPACE || process.cwd()));
|
|
47252
|
+
}
|
|
47253
|
+
function getTempRoot(env = process.env) {
|
|
47254
|
+
return (0, import_node_fs.realpathSync)(import_node_path.default.resolve(env.RUNNER_TEMP || import_node_os.default.tmpdir()));
|
|
47255
|
+
}
|
|
47256
|
+
function ensureInsideRoot(root, candidate, message) {
|
|
47257
|
+
const relative2 = import_node_path.default.relative(root, candidate);
|
|
47258
|
+
if (relative2.startsWith("..") || import_node_path.default.isAbsolute(relative2)) {
|
|
47259
|
+
throw new Error(message);
|
|
47260
|
+
}
|
|
47261
|
+
}
|
|
47262
|
+
function nearestExistingPath(candidate) {
|
|
47263
|
+
let current = candidate;
|
|
47264
|
+
while (!(0, import_node_fs.existsSync)(current)) {
|
|
47265
|
+
const parent = import_node_path.default.dirname(current);
|
|
47266
|
+
if (parent === current) {
|
|
47267
|
+
return current;
|
|
47268
|
+
}
|
|
47269
|
+
current = parent;
|
|
47270
|
+
}
|
|
47271
|
+
return current;
|
|
47272
|
+
}
|
|
47273
|
+
function isInsideAnyRoot(roots, candidate) {
|
|
47274
|
+
return roots.some((root) => {
|
|
47275
|
+
const relative2 = import_node_path.default.relative(root, candidate);
|
|
47276
|
+
return !relative2.startsWith("..") && !import_node_path.default.isAbsolute(relative2);
|
|
47277
|
+
});
|
|
47278
|
+
}
|
|
47279
|
+
function assertOutputFileAllowed(filePath, workspaceRoot, tempRoot) {
|
|
47280
|
+
const workspaceRealPath = (0, import_node_fs.realpathSync)(workspaceRoot);
|
|
47281
|
+
const tempRealPath = (0, import_node_fs.realpathSync)(tempRoot);
|
|
47282
|
+
const resolved = import_node_path.default.resolve(filePath);
|
|
47283
|
+
const existingPath = nearestExistingPath(resolved);
|
|
47284
|
+
const existingRealPath = (0, import_node_fs.realpathSync)(existingPath);
|
|
47285
|
+
if (!isInsideAnyRoot([workspaceRealPath, tempRealPath], existingRealPath)) {
|
|
47286
|
+
throw new Error("Breaking-change output path must stay within the workspace or runner temp directory");
|
|
47287
|
+
}
|
|
47288
|
+
return resolved;
|
|
47289
|
+
}
|
|
47290
|
+
function resolveConfiguredOutputPath(configuredPath, defaultFileName, workspaceRoot, tempRoot) {
|
|
47291
|
+
const defaultPath = import_node_path.default.join(tempRoot, "postman-bootstrap", defaultFileName);
|
|
47292
|
+
if (!configuredPath) {
|
|
47293
|
+
return defaultPath;
|
|
47294
|
+
}
|
|
47295
|
+
const resolved = import_node_path.default.isAbsolute(configuredPath) ? configuredPath : import_node_path.default.join(workspaceRoot, configuredPath);
|
|
47296
|
+
return assertOutputFileAllowed(resolved, workspaceRoot, tempRoot);
|
|
47297
|
+
}
|
|
47298
|
+
function resolveWorkspaceFilePath(configuredPath, workspaceRoot) {
|
|
47299
|
+
if (!configuredPath) {
|
|
47300
|
+
return void 0;
|
|
47301
|
+
}
|
|
47302
|
+
const workspaceRealPath = (0, import_node_fs.realpathSync)(workspaceRoot);
|
|
47303
|
+
const resolved = import_node_path.default.isAbsolute(configuredPath) ? import_node_path.default.resolve(configuredPath) : import_node_path.default.resolve(workspaceRoot, configuredPath);
|
|
47304
|
+
ensureInsideRoot(workspaceRealPath, resolved, "Breaking-change input path must stay within the workspace");
|
|
47305
|
+
if (!(0, import_node_fs.existsSync)(resolved)) {
|
|
47306
|
+
return void 0;
|
|
47307
|
+
}
|
|
47308
|
+
const realResolved = (0, import_node_fs.realpathSync)(resolved);
|
|
47309
|
+
ensureInsideRoot(
|
|
47310
|
+
workspaceRealPath,
|
|
47311
|
+
realResolved,
|
|
47312
|
+
"Breaking-change input path must stay within the workspace"
|
|
47313
|
+
);
|
|
47314
|
+
return realResolved;
|
|
47315
|
+
}
|
|
47316
|
+
function workspaceRelativePath(filePath, workspaceRoot) {
|
|
47317
|
+
const resolved = import_node_path.default.isAbsolute(filePath) ? import_node_path.default.resolve(filePath) : import_node_path.default.resolve(workspaceRoot, filePath);
|
|
47318
|
+
const realResolved = (0, import_node_fs.existsSync)(resolved) ? (0, import_node_fs.realpathSync)(resolved) : resolved;
|
|
47319
|
+
ensureInsideRoot(workspaceRoot, realResolved, "spec-path must stay within the workspace");
|
|
47320
|
+
const relative2 = import_node_path.default.relative(workspaceRoot, realResolved);
|
|
47321
|
+
return relative2.split(import_node_path.default.sep).join("/");
|
|
47322
|
+
}
|
|
47323
|
+
function normalizeBranch(value) {
|
|
47324
|
+
let branchName = String(value || "main").trim();
|
|
47325
|
+
branchName = branchName.replace(/^refs\/remotes\/origin\//, "").replace(/^refs\/heads\//, "").replace(/^origin\//, "");
|
|
47326
|
+
if (!branchName) {
|
|
47327
|
+
branchName = "main";
|
|
47328
|
+
}
|
|
47329
|
+
if (!/^[A-Za-z0-9._/-]+$/.test(branchName)) {
|
|
47330
|
+
throw new Error(`Unsupported target branch name: ${branchName}`);
|
|
47331
|
+
}
|
|
47332
|
+
return branchName;
|
|
47333
|
+
}
|
|
47334
|
+
async function gitObjectExists(dependencies, refSpec, cwd2) {
|
|
47335
|
+
const result = await dependencies.exec.getExecOutput("git", ["cat-file", "-e", refSpec], {
|
|
47336
|
+
cwd: cwd2,
|
|
47337
|
+
ignoreReturnCode: true
|
|
47338
|
+
});
|
|
47339
|
+
return result.exitCode === 0;
|
|
47340
|
+
}
|
|
47341
|
+
function targetBranchCandidates(configuredTargetRef, env) {
|
|
47342
|
+
const targetBranch = normalizeBranch(firstValue(
|
|
47343
|
+
configuredTargetRef,
|
|
47344
|
+
env.GITHUB_BASE_REF,
|
|
47345
|
+
env.CHANGE_TARGET,
|
|
47346
|
+
env.BITBUCKET_TARGET_BRANCH,
|
|
47347
|
+
env.CI_MERGE_REQUEST_TARGET_BRANCH_NAME,
|
|
47348
|
+
env.SYSTEM_PULLREQUEST_TARGETBRANCH,
|
|
47349
|
+
"main"
|
|
47350
|
+
));
|
|
47351
|
+
return Array.from(/* @__PURE__ */ new Set([`origin/${targetBranch}`, targetBranch]));
|
|
47352
|
+
}
|
|
47353
|
+
async function writeTempSpecFile(tempRoot, name, content) {
|
|
47354
|
+
const tempDir = import_node_path.default.join(tempRoot, "postman-bootstrap", `openapi-changes-${process.pid}-${Date.now()}`);
|
|
47355
|
+
await (0, import_promises.mkdir)(tempDir, { recursive: true });
|
|
47356
|
+
const filePath = import_node_path.default.join(tempDir, name);
|
|
47357
|
+
await (0, import_promises.writeFile)(filePath, content, "utf8");
|
|
47358
|
+
return filePath;
|
|
47359
|
+
}
|
|
47360
|
+
async function removeTempSpecFile(filePath) {
|
|
47361
|
+
const parent = import_node_path.default.dirname(filePath);
|
|
47362
|
+
if (parent.includes(`${import_node_path.default.sep}openapi-changes-`)) {
|
|
47363
|
+
await (0, import_promises.rm)(parent, { recursive: true, force: true });
|
|
47364
|
+
}
|
|
47365
|
+
}
|
|
47366
|
+
async function resolveComparisonSource(inputs, dependencies, workspaceRoot, tempRoot) {
|
|
47367
|
+
if (inputs.mode === "previous-spec") {
|
|
47368
|
+
if (!inputs.previousSpecContent) {
|
|
47369
|
+
return {
|
|
47370
|
+
skipped: true,
|
|
47371
|
+
reason: "No existing Spec Hub content was available for comparison."
|
|
47372
|
+
};
|
|
47373
|
+
}
|
|
47374
|
+
const previous = await writeTempSpecFile(tempRoot, "previous-openapi.json", inputs.previousSpecContent);
|
|
47375
|
+
const current = await writeTempSpecFile(tempRoot, "current-openapi.json", inputs.currentUploadContent);
|
|
47376
|
+
return {
|
|
47377
|
+
current,
|
|
47378
|
+
label: "Spec Hub previous version -> incoming spec",
|
|
47379
|
+
previous,
|
|
47380
|
+
tempFiles: [previous, current]
|
|
47381
|
+
};
|
|
47382
|
+
}
|
|
47383
|
+
const currentPath = inputs.specPath ? resolveWorkspaceFilePath(inputs.specPath, workspaceRoot) : void 0;
|
|
47384
|
+
if (inputs.mode === "pr-native" && inputs.specPath && currentPath) {
|
|
47385
|
+
const gitSpecPath = workspaceRelativePath(inputs.specPath, workspaceRoot);
|
|
47386
|
+
for (const targetRef of targetBranchCandidates(inputs.targetRef, dependencies.env ?? process.env)) {
|
|
47387
|
+
const targetRefSpec = `${targetRef}:${gitSpecPath}`;
|
|
47388
|
+
if (await gitObjectExists(dependencies, targetRefSpec, workspaceRoot)) {
|
|
47389
|
+
return {
|
|
47390
|
+
current: gitSpecPath,
|
|
47391
|
+
label: `${targetRefSpec} -> ${gitSpecPath}`,
|
|
47392
|
+
previous: targetRefSpec,
|
|
47393
|
+
tempFiles: []
|
|
47394
|
+
};
|
|
47395
|
+
}
|
|
47396
|
+
}
|
|
47397
|
+
}
|
|
47398
|
+
const baselinePath = resolveWorkspaceFilePath(inputs.baselineSpecPath, workspaceRoot);
|
|
47399
|
+
if (baselinePath) {
|
|
47400
|
+
const current = currentPath ?? await writeTempSpecFile(
|
|
47401
|
+
tempRoot,
|
|
47402
|
+
"current-openapi.json",
|
|
47403
|
+
inputs.currentUploadContent
|
|
47404
|
+
);
|
|
47405
|
+
return {
|
|
47406
|
+
current,
|
|
47407
|
+
label: `${inputs.baselineSpecPath} -> ${inputs.specPath || "incoming spec"}`,
|
|
47408
|
+
previous: baselinePath,
|
|
47409
|
+
tempFiles: currentPath ? [] : [current]
|
|
47410
|
+
};
|
|
47411
|
+
}
|
|
47412
|
+
return {
|
|
47413
|
+
skipped: true,
|
|
47414
|
+
reason: inputs.mode === "baseline-only" ? `No baseline spec found at ${inputs.baselineSpecPath || "(empty)"}.` : "No target-branch spec or baseline spec was available for comparison."
|
|
47415
|
+
};
|
|
47416
|
+
}
|
|
47417
|
+
var ANSI_ESCAPE_PATTERN = new RegExp(String.raw`\u001B\[[0-?]*[ -/]*[@-~]`, "g");
|
|
47418
|
+
function stripAnsi(value) {
|
|
47419
|
+
return String(value || "").replace(ANSI_ESCAPE_PATTERN, "");
|
|
47420
|
+
}
|
|
47421
|
+
function sanitizeOpenApiChangesSummary(value) {
|
|
47422
|
+
return String(value || "").split(/\r?\n/).filter((line) => {
|
|
47423
|
+
const normalized = line.trim().replace(/\*\*/g, "");
|
|
47424
|
+
return !/^Date:\s.*\|\s*Commit:\s*Original:\s.*,\s*Modified:\s.*$/.test(normalized);
|
|
47425
|
+
}).join("\n").trim();
|
|
47426
|
+
}
|
|
47427
|
+
function breakingChangeCount(value) {
|
|
47428
|
+
if (Array.isArray(value)) {
|
|
47429
|
+
return value.reduce((total2, entry) => total2 + breakingChangeCount(entry), 0);
|
|
47430
|
+
}
|
|
47431
|
+
if (!value || typeof value !== "object") {
|
|
47432
|
+
return 0;
|
|
47433
|
+
}
|
|
47434
|
+
let total = 0;
|
|
47435
|
+
for (const [key, entry] of Object.entries(value)) {
|
|
47436
|
+
const normalizedKey = key.toLowerCase().replace(/[^a-z]/g, "");
|
|
47437
|
+
if (entry === true && ["breaking", "breakingchange", "isbreaking", "isbreakingchange"].includes(normalizedKey)) {
|
|
47438
|
+
total += 1;
|
|
47439
|
+
continue;
|
|
47440
|
+
}
|
|
47441
|
+
total += breakingChangeCount(entry);
|
|
47442
|
+
}
|
|
47443
|
+
return total;
|
|
47444
|
+
}
|
|
47445
|
+
function formatReport(options) {
|
|
47446
|
+
const lines = [
|
|
47447
|
+
"# OpenAPI Breaking Change Check",
|
|
47448
|
+
"",
|
|
47449
|
+
`Status: ${options.status}`
|
|
47450
|
+
];
|
|
47451
|
+
if (options.comparison) {
|
|
47452
|
+
lines.push(`Comparison: ${options.comparison}`);
|
|
47453
|
+
}
|
|
47454
|
+
if (options.message) {
|
|
47455
|
+
lines.push("", options.message);
|
|
47456
|
+
}
|
|
47457
|
+
if (options.body?.trim()) {
|
|
47458
|
+
lines.push("", options.body.trim());
|
|
47459
|
+
}
|
|
47460
|
+
return `${lines.join("\n")}
|
|
47461
|
+
`;
|
|
47462
|
+
}
|
|
47463
|
+
async function writeReportFiles(summaryPath, logPath, report, log, env) {
|
|
47464
|
+
await (0, import_promises.mkdir)(import_node_path.default.dirname(summaryPath), { recursive: true });
|
|
47465
|
+
await (0, import_promises.mkdir)(import_node_path.default.dirname(logPath), { recursive: true });
|
|
47466
|
+
await (0, import_promises.writeFile)(summaryPath, report, "utf8");
|
|
47467
|
+
await (0, import_promises.writeFile)(logPath, log, "utf8");
|
|
47468
|
+
if (env.GITHUB_STEP_SUMMARY) {
|
|
47469
|
+
await (0, import_promises.appendFile)(env.GITHUB_STEP_SUMMARY, `
|
|
47470
|
+
${report}
|
|
47471
|
+
`, "utf8");
|
|
47472
|
+
}
|
|
47473
|
+
}
|
|
47474
|
+
function buildResultJson(result) {
|
|
47475
|
+
return JSON.stringify({
|
|
47476
|
+
breakingChanges: result.breakingChanges,
|
|
47477
|
+
comparison: result.comparison,
|
|
47478
|
+
exitCode: result.exitCode,
|
|
47479
|
+
logPath: result.logPath,
|
|
47480
|
+
message: result.message,
|
|
47481
|
+
mode: result.mode,
|
|
47482
|
+
status: result.status,
|
|
47483
|
+
summaryPath: result.summaryPath
|
|
47484
|
+
});
|
|
47485
|
+
}
|
|
47486
|
+
function createBreakingChangeSummaryJson(result) {
|
|
47487
|
+
return buildResultJson(result);
|
|
47488
|
+
}
|
|
47489
|
+
function mapPlatform() {
|
|
47490
|
+
const platforms = {
|
|
47491
|
+
aix: void 0,
|
|
47492
|
+
android: void 0,
|
|
47493
|
+
darwin: "darwin",
|
|
47494
|
+
freebsd: void 0,
|
|
47495
|
+
haiku: void 0,
|
|
47496
|
+
linux: "linux",
|
|
47497
|
+
openbsd: void 0,
|
|
47498
|
+
sunos: void 0,
|
|
47499
|
+
win32: "windows",
|
|
47500
|
+
cygwin: void 0,
|
|
47501
|
+
netbsd: void 0
|
|
47502
|
+
};
|
|
47503
|
+
const platform2 = platforms[process.platform];
|
|
47504
|
+
if (!platform2) {
|
|
47505
|
+
throw new Error(`Unsupported openapi-changes platform: ${process.platform}`);
|
|
47506
|
+
}
|
|
47507
|
+
return platform2;
|
|
47508
|
+
}
|
|
47509
|
+
function mapArch() {
|
|
47510
|
+
const architectures = {
|
|
47511
|
+
arm: void 0,
|
|
47512
|
+
arm64: "arm64",
|
|
47513
|
+
ia32: "i386",
|
|
47514
|
+
loong64: void 0,
|
|
47515
|
+
mips: void 0,
|
|
47516
|
+
mipsel: void 0,
|
|
47517
|
+
ppc: void 0,
|
|
47518
|
+
ppc64: void 0,
|
|
47519
|
+
riscv64: void 0,
|
|
47520
|
+
s390: void 0,
|
|
47521
|
+
s390x: void 0,
|
|
47522
|
+
x64: "x86_64"
|
|
47523
|
+
};
|
|
47524
|
+
const arch2 = architectures[process.arch];
|
|
47525
|
+
if (!arch2) {
|
|
47526
|
+
throw new Error(`Unsupported openapi-changes architecture: ${process.arch}`);
|
|
47527
|
+
}
|
|
47528
|
+
return arch2;
|
|
47529
|
+
}
|
|
47530
|
+
function sha256(filePath) {
|
|
47531
|
+
return (0, import_node_crypto.createHash)("sha256").update((0, import_node_fs.readFileSync)(filePath)).digest("hex");
|
|
47532
|
+
}
|
|
47533
|
+
function validatePinnedOpenApiChangesChecksums() {
|
|
47534
|
+
for (const [version, checksums] of Object.entries(CHECKSUMS)) {
|
|
47535
|
+
for (const [assetName, checksum] of Object.entries(checksums)) {
|
|
47536
|
+
if (!/^[a-f0-9]{64}$/.test(checksum)) {
|
|
47537
|
+
throw new Error(
|
|
47538
|
+
`Pinned checksum for ${assetName} in openapi-changes ${version} must be a 64-character lowercase SHA-256 hex digest`
|
|
47539
|
+
);
|
|
47540
|
+
}
|
|
47541
|
+
}
|
|
47542
|
+
}
|
|
47543
|
+
}
|
|
47544
|
+
function downloadFile(url, destination, redirectsRemaining = 5) {
|
|
47545
|
+
return new Promise((resolve4, reject) => {
|
|
47546
|
+
(0, import_node_https.get)(url, (response) => {
|
|
47547
|
+
const statusCode = response.statusCode || 0;
|
|
47548
|
+
const location2 = response.headers.location;
|
|
47549
|
+
if ([301, 302, 303, 307, 308].includes(statusCode) && location2) {
|
|
47550
|
+
response.resume();
|
|
47551
|
+
if (redirectsRemaining <= 0) {
|
|
47552
|
+
reject(new Error(`Too many redirects while downloading ${url}`));
|
|
47553
|
+
return;
|
|
47554
|
+
}
|
|
47555
|
+
const redirectedUrl = new URL(location2, url);
|
|
47556
|
+
if (redirectedUrl.protocol !== "https:") {
|
|
47557
|
+
reject(new Error(`Refusing non-HTTPS redirect for ${url}`));
|
|
47558
|
+
return;
|
|
47559
|
+
}
|
|
47560
|
+
downloadFile(redirectedUrl.toString(), destination, redirectsRemaining - 1).then(resolve4, reject);
|
|
47561
|
+
return;
|
|
47562
|
+
}
|
|
47563
|
+
if (statusCode < 200 || statusCode >= 300) {
|
|
47564
|
+
response.resume();
|
|
47565
|
+
reject(new Error(`Download failed for ${url}: HTTP ${statusCode}`));
|
|
47566
|
+
return;
|
|
47567
|
+
}
|
|
47568
|
+
const output = (0, import_node_fs.createWriteStream)(destination, { flags: "w" });
|
|
47569
|
+
response.pipe(output);
|
|
47570
|
+
output.on("finish", () => output.close(() => resolve4()));
|
|
47571
|
+
output.on("error", reject);
|
|
47572
|
+
}).on("error", reject);
|
|
47573
|
+
});
|
|
47574
|
+
}
|
|
47575
|
+
async function assertBinaryWorks(binaryPath, dependencies) {
|
|
47576
|
+
const result = await dependencies.exec.getExecOutput(binaryPath, ["version"], {
|
|
47577
|
+
ignoreReturnCode: true,
|
|
47578
|
+
silent: true
|
|
47579
|
+
});
|
|
47580
|
+
const installedVersion = result.stdout.trim();
|
|
47581
|
+
if (result.exitCode !== 0 || installedVersion !== OPENAPI_CHANGES_VERSION) {
|
|
47582
|
+
throw new Error(
|
|
47583
|
+
`Expected ${TOOL_NAME} ${OPENAPI_CHANGES_VERSION}, found ${installedVersion || "(unknown)"}.`
|
|
47584
|
+
);
|
|
47585
|
+
}
|
|
47586
|
+
}
|
|
47587
|
+
async function assertSafeTarEntries(archivePath, dependencies) {
|
|
47588
|
+
const listing = await dependencies.exec.getExecOutput("tar", ["-tzf", archivePath], {
|
|
47589
|
+
ignoreReturnCode: true,
|
|
47590
|
+
silent: true
|
|
47591
|
+
});
|
|
47592
|
+
if (listing.exitCode !== 0) {
|
|
47593
|
+
throw new Error(`Could not inspect ${TOOL_NAME} archive: ${listing.stderr}`);
|
|
47594
|
+
}
|
|
47595
|
+
for (const rawEntry of listing.stdout.split(/\r?\n/)) {
|
|
47596
|
+
const entry = rawEntry.trim();
|
|
47597
|
+
if (!entry) {
|
|
47598
|
+
continue;
|
|
47599
|
+
}
|
|
47600
|
+
if (entry.startsWith("/") || entry.startsWith("\\") || entry.includes("..")) {
|
|
47601
|
+
throw new Error(`Refusing unsafe archive entry: ${entry}`);
|
|
47602
|
+
}
|
|
47603
|
+
}
|
|
47604
|
+
}
|
|
47605
|
+
function findBinary(searchRoot, binaryName) {
|
|
47606
|
+
const entries = (0, import_node_fs.readdirSync)(searchRoot, { withFileTypes: true });
|
|
47607
|
+
for (const entry of entries) {
|
|
47608
|
+
const entryPath = import_node_path.default.join(searchRoot, entry.name);
|
|
47609
|
+
if (entry.isDirectory()) {
|
|
47610
|
+
const nested = findBinary(entryPath, binaryName);
|
|
47611
|
+
if (nested) {
|
|
47612
|
+
return nested;
|
|
47613
|
+
}
|
|
47614
|
+
} else if (entry.name === binaryName || entry.name === TOOL_NAME) {
|
|
47615
|
+
return entryPath;
|
|
47616
|
+
}
|
|
47617
|
+
}
|
|
47618
|
+
return "";
|
|
47619
|
+
}
|
|
47620
|
+
async function installOpenApiChanges(dependencies) {
|
|
47621
|
+
validatePinnedOpenApiChangesChecksums();
|
|
47622
|
+
const env = dependencies.env ?? process.env;
|
|
47623
|
+
const tempRoot = getTempRoot(env);
|
|
47624
|
+
const platform2 = mapPlatform();
|
|
47625
|
+
const arch2 = mapArch();
|
|
47626
|
+
const binaryName = process.platform === "win32" ? `${TOOL_NAME}.exe` : TOOL_NAME;
|
|
47627
|
+
const toolRoot = import_node_path.default.join(tempRoot, "postman-bootstrap-tools", TOOL_NAME, OPENAPI_CHANGES_VERSION, `${platform2}-${arch2}`);
|
|
47628
|
+
const binDir = import_node_path.default.join(toolRoot, "bin");
|
|
47629
|
+
const downloadsDir = import_node_path.default.join(toolRoot, "downloads");
|
|
47630
|
+
const extractDir = import_node_path.default.join(toolRoot, `extract-${Date.now()}`);
|
|
47631
|
+
const binaryPath = import_node_path.default.join(binDir, binaryName);
|
|
47632
|
+
if ((0, import_node_fs.existsSync)(binaryPath)) {
|
|
47633
|
+
try {
|
|
47634
|
+
await assertBinaryWorks(binaryPath, dependencies);
|
|
47635
|
+
dependencies.core.info(`${TOOL_NAME} ${OPENAPI_CHANGES_VERSION} already installed at ${binaryPath}`);
|
|
47636
|
+
return binaryPath;
|
|
47637
|
+
} catch (error2) {
|
|
47638
|
+
dependencies.core.warning(
|
|
47639
|
+
`Reinstalling ${TOOL_NAME}: ${error2 instanceof Error ? error2.message : String(error2)}`
|
|
47640
|
+
);
|
|
47641
|
+
(0, import_node_fs.rmSync)(binaryPath, { force: true });
|
|
47642
|
+
}
|
|
47643
|
+
}
|
|
47644
|
+
const assetName = `${TOOL_NAME}_${OPENAPI_CHANGES_VERSION}_${platform2}_${arch2}.tar.gz`;
|
|
47645
|
+
const expectedChecksum = CHECKSUMS[OPENAPI_CHANGES_VERSION]?.[assetName];
|
|
47646
|
+
if (!expectedChecksum) {
|
|
47647
|
+
throw new Error(`No pinned checksum is configured for ${assetName}.`);
|
|
47648
|
+
}
|
|
47649
|
+
(0, import_node_fs.mkdirSync)(binDir, { recursive: true });
|
|
47650
|
+
(0, import_node_fs.mkdirSync)(downloadsDir, { recursive: true });
|
|
47651
|
+
(0, import_node_fs.mkdirSync)(extractDir, { recursive: true });
|
|
47652
|
+
const archivePath = import_node_path.default.join(downloadsDir, assetName);
|
|
47653
|
+
await downloadFile(`${RELEASE_BASE_URL}/${assetName}`, archivePath);
|
|
47654
|
+
const actualChecksum = sha256(archivePath);
|
|
47655
|
+
if (actualChecksum !== expectedChecksum) {
|
|
47656
|
+
throw new Error(`Checksum mismatch for ${assetName}: expected ${expectedChecksum}, got ${actualChecksum}`);
|
|
47657
|
+
}
|
|
47658
|
+
await assertSafeTarEntries(archivePath, dependencies);
|
|
47659
|
+
await dependencies.exec.exec("tar", ["-xzf", archivePath, "-C", extractDir], {
|
|
47660
|
+
silent: true
|
|
47661
|
+
});
|
|
47662
|
+
const extractedBinary = findBinary(extractDir, binaryName);
|
|
47663
|
+
if (!extractedBinary) {
|
|
47664
|
+
throw new Error(`Could not find ${binaryName} in ${assetName}.`);
|
|
47665
|
+
}
|
|
47666
|
+
(0, import_node_fs.rmSync)(binaryPath, { force: true });
|
|
47667
|
+
(0, import_node_fs.copyFileSync)(extractedBinary, binaryPath);
|
|
47668
|
+
if (process.platform !== "win32") {
|
|
47669
|
+
(0, import_node_fs.chmodSync)(binaryPath, 493);
|
|
47670
|
+
}
|
|
47671
|
+
(0, import_node_fs.rmSync)(extractDir, { recursive: true, force: true });
|
|
47672
|
+
await assertBinaryWorks(binaryPath, dependencies);
|
|
47673
|
+
dependencies.core.info(`Installed ${TOOL_NAME} ${OPENAPI_CHANGES_VERSION} at ${binaryPath}`);
|
|
47674
|
+
return binaryPath;
|
|
47675
|
+
}
|
|
47676
|
+
function rulesArgs(rulesPath, workspaceRoot, tempRoot) {
|
|
47677
|
+
const resolved = resolveWorkspaceFilePath(rulesPath, workspaceRoot);
|
|
47678
|
+
if (resolved) {
|
|
47679
|
+
return ["--config", resolved];
|
|
47680
|
+
}
|
|
47681
|
+
const defaultRulesPath = import_node_path.default.join(tempRoot, "postman-bootstrap", "openapi-changes-default-rules.yaml");
|
|
47682
|
+
(0, import_node_fs.mkdirSync)(import_node_path.default.dirname(defaultRulesPath), { recursive: true });
|
|
47683
|
+
(0, import_node_fs.writeFileSync)(defaultRulesPath, "{}\n", "utf8");
|
|
47684
|
+
return ["--config", defaultRulesPath];
|
|
47685
|
+
}
|
|
47686
|
+
var runOpenApiBreakingChangeCheck = async (inputs, dependencies) => {
|
|
47687
|
+
const env = dependencies.env ?? process.env;
|
|
47688
|
+
const workspaceRoot = getWorkspaceRoot(env);
|
|
47689
|
+
const tempRoot = getTempRoot(env);
|
|
47690
|
+
if (inputs.mode === "off") {
|
|
47691
|
+
return {
|
|
47692
|
+
breakingChanges: 0,
|
|
47693
|
+
comparison: "",
|
|
47694
|
+
exitCode: 0,
|
|
47695
|
+
logPath: "",
|
|
47696
|
+
message: "Breaking-change check is disabled.",
|
|
47697
|
+
mode: inputs.mode,
|
|
47698
|
+
status: "skipped",
|
|
47699
|
+
summaryPath: ""
|
|
47700
|
+
};
|
|
47701
|
+
}
|
|
47702
|
+
const summaryPath = resolveConfiguredOutputPath(
|
|
47703
|
+
inputs.summaryPath,
|
|
47704
|
+
"openapi-changes-summary.md",
|
|
47705
|
+
workspaceRoot,
|
|
47706
|
+
tempRoot
|
|
47707
|
+
);
|
|
47708
|
+
const logPath = resolveConfiguredOutputPath(
|
|
47709
|
+
inputs.logPath,
|
|
47710
|
+
"openapi-changes.log",
|
|
47711
|
+
workspaceRoot,
|
|
47712
|
+
tempRoot
|
|
47713
|
+
);
|
|
47714
|
+
const source = await resolveComparisonSource(inputs, dependencies, workspaceRoot, tempRoot);
|
|
47715
|
+
if ("skipped" in source) {
|
|
47716
|
+
const report = formatReport({
|
|
47717
|
+
message: source.reason,
|
|
47718
|
+
status: "skipped"
|
|
47719
|
+
});
|
|
47720
|
+
await writeReportFiles(summaryPath, logPath, report, source.reason, env);
|
|
47721
|
+
return {
|
|
47722
|
+
breakingChanges: 0,
|
|
47723
|
+
comparison: "",
|
|
47724
|
+
exitCode: 0,
|
|
47725
|
+
logPath,
|
|
47726
|
+
message: source.reason,
|
|
47727
|
+
mode: inputs.mode,
|
|
47728
|
+
status: "skipped",
|
|
47729
|
+
summaryPath
|
|
47730
|
+
};
|
|
47731
|
+
}
|
|
47732
|
+
try {
|
|
47733
|
+
const binaryPath = await installOpenApiChanges(dependencies);
|
|
47734
|
+
const configArgs = rulesArgs(inputs.rulesPath, workspaceRoot, tempRoot);
|
|
47735
|
+
const reportArgs = [
|
|
47736
|
+
"report",
|
|
47737
|
+
"--reproducible",
|
|
47738
|
+
"--no-color",
|
|
47739
|
+
...configArgs,
|
|
47740
|
+
source.previous,
|
|
47741
|
+
source.current
|
|
47742
|
+
];
|
|
47743
|
+
const reportResult = await dependencies.exec.getExecOutput(binaryPath, reportArgs, {
|
|
47744
|
+
cwd: workspaceRoot,
|
|
47745
|
+
ignoreReturnCode: true,
|
|
47746
|
+
silent: true
|
|
47747
|
+
});
|
|
47748
|
+
const reportStdout = stripAnsi(reportResult.stdout);
|
|
47749
|
+
const reportStderr = stripAnsi(reportResult.stderr);
|
|
47750
|
+
let breakingChanges = 0;
|
|
47751
|
+
let parsedReport = false;
|
|
47752
|
+
if (reportStdout.trim()) {
|
|
47753
|
+
try {
|
|
47754
|
+
breakingChanges = breakingChangeCount(JSON.parse(reportStdout));
|
|
47755
|
+
parsedReport = true;
|
|
47756
|
+
} catch (error2) {
|
|
47757
|
+
dependencies.core.warning(
|
|
47758
|
+
`Could not parse openapi-changes JSON report: ${error2 instanceof Error ? error2.message : String(error2)}`
|
|
47759
|
+
);
|
|
47760
|
+
}
|
|
47761
|
+
}
|
|
47762
|
+
const summaryArgs = [
|
|
47763
|
+
"summary",
|
|
47764
|
+
"--markdown",
|
|
47765
|
+
"--no-logo",
|
|
47766
|
+
"--no-color",
|
|
47767
|
+
"--with-lines",
|
|
47768
|
+
...configArgs,
|
|
47769
|
+
source.previous,
|
|
47770
|
+
source.current
|
|
47771
|
+
];
|
|
47772
|
+
const summaryResult = await dependencies.exec.getExecOutput(binaryPath, summaryArgs, {
|
|
47773
|
+
cwd: workspaceRoot,
|
|
47774
|
+
ignoreReturnCode: true,
|
|
47775
|
+
silent: true
|
|
47776
|
+
});
|
|
47777
|
+
const summaryStdout = sanitizeOpenApiChangesSummary(stripAnsi(summaryResult.stdout));
|
|
47778
|
+
const summaryStderr = stripAnsi(summaryResult.stderr);
|
|
47779
|
+
const commandFailed = reportResult.exitCode !== 0 && !parsedReport || summaryResult.exitCode !== 0 && !summaryStdout.trim() && breakingChanges === 0;
|
|
47780
|
+
const status = commandFailed || breakingChanges > 0 ? "failed" : "passed";
|
|
47781
|
+
const message = commandFailed ? "openapi-changes failed while comparing specifications." : breakingChanges > 0 ? `${breakingChanges} breaking change marker${breakingChanges === 1 ? "" : "s"} detected.` : "No breaking changes detected.";
|
|
47782
|
+
const report = formatReport({
|
|
47783
|
+
body: summaryStdout || message,
|
|
47784
|
+
comparison: source.label,
|
|
47785
|
+
message,
|
|
47786
|
+
status
|
|
47787
|
+
});
|
|
47788
|
+
const log = [
|
|
47789
|
+
`report exit code: ${reportResult.exitCode}`,
|
|
47790
|
+
reportStderr.trim(),
|
|
47791
|
+
`summary exit code: ${summaryResult.exitCode}`,
|
|
47792
|
+
summaryStderr.trim()
|
|
47793
|
+
].filter(Boolean).join("\n\n");
|
|
47794
|
+
await writeReportFiles(summaryPath, logPath, report, log, env);
|
|
47795
|
+
return {
|
|
47796
|
+
breakingChanges,
|
|
47797
|
+
comparison: source.label,
|
|
47798
|
+
exitCode: status === "failed" ? 1 : 0,
|
|
47799
|
+
logPath,
|
|
47800
|
+
message,
|
|
47801
|
+
mode: inputs.mode,
|
|
47802
|
+
status,
|
|
47803
|
+
summaryPath
|
|
47804
|
+
};
|
|
47805
|
+
} finally {
|
|
47806
|
+
for (const tempFile of source.tempFiles) {
|
|
47807
|
+
await removeTempSpecFile(tempFile);
|
|
47808
|
+
}
|
|
47809
|
+
}
|
|
47810
|
+
};
|
|
47811
|
+
|
|
47189
47812
|
// src/lib/postman/base-urls.ts
|
|
47190
47813
|
var POSTMAN_ENDPOINT_PROFILES = {
|
|
47191
47814
|
prod: {
|
|
@@ -47368,8 +47991,8 @@ var PostmanAssetsClient = class {
|
|
|
47368
47991
|
...team.organizationId != null ? { organizationId: Number(team.organizationId) } : {}
|
|
47369
47992
|
})) : [];
|
|
47370
47993
|
}
|
|
47371
|
-
async request(
|
|
47372
|
-
const url =
|
|
47994
|
+
async request(path8, init = {}) {
|
|
47995
|
+
const url = path8.startsWith("http") ? path8 : `${this.baseUrl}${path8}`;
|
|
47373
47996
|
const response = await this.fetchImpl(url, {
|
|
47374
47997
|
...init,
|
|
47375
47998
|
headers: {
|
|
@@ -47427,12 +48050,25 @@ var PostmanAssetsClient = class {
|
|
|
47427
48050
|
throw new Error("Workspace create did not return an id");
|
|
47428
48051
|
}
|
|
47429
48052
|
const workspace = await this.request(`/workspaces/${workspaceId}`);
|
|
47430
|
-
|
|
47431
|
-
if (
|
|
48053
|
+
let visibility = asRecord(workspace?.workspace)?.visibility;
|
|
48054
|
+
if (visibility !== "team") {
|
|
47432
48055
|
await this.request(`/workspaces/${workspaceId}`, {
|
|
47433
48056
|
method: "PUT",
|
|
47434
48057
|
body: JSON.stringify(payload)
|
|
47435
48058
|
});
|
|
48059
|
+
const reread = await this.request(`/workspaces/${workspaceId}`);
|
|
48060
|
+
visibility = asRecord(reread?.workspace)?.visibility;
|
|
48061
|
+
}
|
|
48062
|
+
if (typeof visibility === "string" && visibility !== "team") {
|
|
48063
|
+
let cleanedUp = false;
|
|
48064
|
+
try {
|
|
48065
|
+
await this.request(`/workspaces/${workspaceId}`, { method: "DELETE" });
|
|
48066
|
+
cleanedUp = true;
|
|
48067
|
+
} catch {
|
|
48068
|
+
}
|
|
48069
|
+
throw new Error(
|
|
48070
|
+
`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.`)
|
|
48071
|
+
);
|
|
47436
48072
|
}
|
|
47437
48073
|
return {
|
|
47438
48074
|
id: workspaceId
|
|
@@ -47443,6 +48079,19 @@ var PostmanAssetsClient = class {
|
|
|
47443
48079
|
shouldRetry: (err) => !(err instanceof Error && err.message.includes("workspace-team-id"))
|
|
47444
48080
|
});
|
|
47445
48081
|
}
|
|
48082
|
+
/**
|
|
48083
|
+
* Visibility of a workspace as seen by this API key, or null when the
|
|
48084
|
+
* workspace cannot be read (deleted, or invisible to these credentials).
|
|
48085
|
+
*/
|
|
48086
|
+
async getWorkspaceVisibility(workspaceId) {
|
|
48087
|
+
try {
|
|
48088
|
+
const workspace = await this.request(`/workspaces/${workspaceId}`);
|
|
48089
|
+
const visibility = asRecord(workspace?.workspace)?.visibility;
|
|
48090
|
+
return typeof visibility === "string" ? visibility : null;
|
|
48091
|
+
} catch {
|
|
48092
|
+
return null;
|
|
48093
|
+
}
|
|
48094
|
+
}
|
|
47446
48095
|
async listWorkspaces() {
|
|
47447
48096
|
const allWorkspaces = [];
|
|
47448
48097
|
const seenCursors = /* @__PURE__ */ new Set();
|
|
@@ -48154,8 +48803,8 @@ function createInternalIntegrationAdapter(options) {
|
|
|
48154
48803
|
}
|
|
48155
48804
|
|
|
48156
48805
|
// src/lib/spec/safe-spec-fetch.ts
|
|
48157
|
-
var
|
|
48158
|
-
var
|
|
48806
|
+
var import_promises2 = require("node:dns/promises");
|
|
48807
|
+
var import_node_https2 = require("node:https");
|
|
48159
48808
|
var import_node_net = require("node:net");
|
|
48160
48809
|
var import_node_url = require("node:url");
|
|
48161
48810
|
var SAFE_FETCH_LIMITS = {
|
|
@@ -48288,7 +48937,7 @@ function validateSafeHttpsUrl(input) {
|
|
|
48288
48937
|
return url;
|
|
48289
48938
|
}
|
|
48290
48939
|
async function defaultLookup(hostname) {
|
|
48291
|
-
const results = await (0,
|
|
48940
|
+
const results = await (0, import_promises2.lookup)(hostname, { all: true, verbatim: true });
|
|
48292
48941
|
return results.map((entry) => ({ address: entry.address, family: entry.family }));
|
|
48293
48942
|
}
|
|
48294
48943
|
function createPinnedLookup(pinnedAddress, family) {
|
|
@@ -48325,7 +48974,7 @@ async function defaultTransport(url, options) {
|
|
|
48325
48974
|
timeout: options.timeoutMs,
|
|
48326
48975
|
lookup: createPinnedLookup(options.pinnedAddress, options.family)
|
|
48327
48976
|
};
|
|
48328
|
-
const req = (0,
|
|
48977
|
+
const req = (0, import_node_https2.request)(requestOptions, (res) => {
|
|
48329
48978
|
const remoteAddress = res.socket?.remoteAddress;
|
|
48330
48979
|
const chunks = [];
|
|
48331
48980
|
let bytes = 0;
|
|
@@ -48575,8 +49224,8 @@ function normalizeRepoUrl(url) {
|
|
|
48575
49224
|
const sshMatch = raw.match(/^git@([^:]+):(.+?)(?:\.git)?$/);
|
|
48576
49225
|
if (sshMatch) {
|
|
48577
49226
|
const host = sshMatch[1];
|
|
48578
|
-
const
|
|
48579
|
-
return `https://${host}/${
|
|
49227
|
+
const path8 = sshMatch[2];
|
|
49228
|
+
return `https://${host}/${path8}`;
|
|
48580
49229
|
}
|
|
48581
49230
|
return raw.replace(/\.git$/, "");
|
|
48582
49231
|
}
|
|
@@ -48896,8 +49545,8 @@ function safeDecodeSegment(segment) {
|
|
|
48896
49545
|
return segment;
|
|
48897
49546
|
}
|
|
48898
49547
|
}
|
|
48899
|
-
function normalizePath(
|
|
48900
|
-
const raw = String(
|
|
49548
|
+
function normalizePath(path8) {
|
|
49549
|
+
const raw = String(path8 || "").split(/[?#]/, 1)[0] || "/";
|
|
48901
49550
|
const withSlash = raw.startsWith("/") ? raw : `/${raw}`;
|
|
48902
49551
|
const normalized = withSlash.replace(/\/+/g, "/");
|
|
48903
49552
|
const trimmed = normalized.length > 1 ? normalized.replace(/\/+$/g, "") : normalized;
|
|
@@ -48921,8 +49570,8 @@ function serverPathPrefix(url) {
|
|
|
48921
49570
|
return normalizePath(noProtocol).replace(/__server_variable__/g, "{serverVariable}");
|
|
48922
49571
|
}
|
|
48923
49572
|
}
|
|
48924
|
-
function joinPaths(prefix,
|
|
48925
|
-
return normalizePath(`${prefix}/${
|
|
49573
|
+
function joinPaths(prefix, path8) {
|
|
49574
|
+
return normalizePath(`${prefix}/${path8}`.replace(/\/+/g, "/"));
|
|
48926
49575
|
}
|
|
48927
49576
|
function normalizeResponseKey(status) {
|
|
48928
49577
|
const raw = String(status);
|
|
@@ -49026,7 +49675,7 @@ function buildContractIndex(root) {
|
|
|
49026
49675
|
const warnings = [];
|
|
49027
49676
|
if (asRecord3(root.webhooks)) warnings.push("CONTRACT_WEBHOOKS_NOT_VALIDATED: OpenAPI webhooks are not validated by dynamic contract tests");
|
|
49028
49677
|
if (paths) {
|
|
49029
|
-
for (const [
|
|
49678
|
+
for (const [path8, rawPathItem] of Object.entries(paths)) {
|
|
49030
49679
|
const pathItem = resolveInternalRef(root, rawPathItem);
|
|
49031
49680
|
if (!pathItem) continue;
|
|
49032
49681
|
for (const [method, rawOperation] of Object.entries(pathItem)) {
|
|
@@ -49034,10 +49683,10 @@ function buildContractIndex(root) {
|
|
|
49034
49683
|
if (!HTTP_METHODS.has(lowerMethod)) continue;
|
|
49035
49684
|
const operation = resolveInternalRef(root, rawOperation);
|
|
49036
49685
|
if (!operation) continue;
|
|
49037
|
-
if (operation.callbacks) warnings.push(`CONTRACT_CALLBACKS_NOT_VALIDATED: callbacks are not validated for ${lowerMethod.toUpperCase()} ${
|
|
49686
|
+
if (operation.callbacks) warnings.push(`CONTRACT_CALLBACKS_NOT_VALIDATED: callbacks are not validated for ${lowerMethod.toUpperCase()} ${path8}`);
|
|
49038
49687
|
const responses = asRecord3(operation.responses);
|
|
49039
49688
|
if (!responses || Object.keys(responses).length === 0) {
|
|
49040
|
-
throw new Error(`CONTRACT_OPERATION_NO_RESPONSES: ${lowerMethod.toUpperCase()} ${
|
|
49689
|
+
throw new Error(`CONTRACT_OPERATION_NO_RESPONSES: ${lowerMethod.toUpperCase()} ${path8} must define at least one response`);
|
|
49041
49690
|
}
|
|
49042
49691
|
const contractResponses = {};
|
|
49043
49692
|
for (const [status, rawResponse] of Object.entries(responses)) {
|
|
@@ -49052,8 +49701,8 @@ function buildContractIndex(root) {
|
|
|
49052
49701
|
};
|
|
49053
49702
|
}
|
|
49054
49703
|
const candidates = [...new Set([
|
|
49055
|
-
|
|
49056
|
-
...operationServers(root, pathItem, operation).map((server) => joinPaths(serverPathPrefix(server),
|
|
49704
|
+
path8,
|
|
49705
|
+
...operationServers(root, pathItem, operation).map((server) => joinPaths(serverPathPrefix(server), path8))
|
|
49057
49706
|
].map(normalizePath))];
|
|
49058
49707
|
const opWarnings = [];
|
|
49059
49708
|
opWarnings.push(...collectSecuritySchemeWarnings(root, operation));
|
|
@@ -49062,10 +49711,10 @@ function buildContractIndex(root) {
|
|
|
49062
49711
|
opWarnings.push(`CONTRACT_SECURITY_NOT_VALIDATED: security parameter ${parameter.in}:${parameter.name} is not statically required in generated requests`);
|
|
49063
49712
|
}
|
|
49064
49713
|
operations.push({
|
|
49065
|
-
id: `${lowerMethod.toUpperCase()} ${
|
|
49714
|
+
id: `${lowerMethod.toUpperCase()} ${path8}`,
|
|
49066
49715
|
method: lowerMethod.toUpperCase(),
|
|
49067
|
-
path:
|
|
49068
|
-
pointer: `/paths/${
|
|
49716
|
+
path: path8,
|
|
49717
|
+
pointer: `/paths/${path8.replace(/~/g, "~0").replace(/\//g, "~1")}/${lowerMethod}`,
|
|
49069
49718
|
candidates,
|
|
49070
49719
|
responses: contractResponses,
|
|
49071
49720
|
requiredParameters,
|
|
@@ -49162,8 +49811,8 @@ function requestPath(request) {
|
|
|
49162
49811
|
if (typeof urlRecord.raw === "string") return pathFromRaw(urlRecord.raw);
|
|
49163
49812
|
return "/";
|
|
49164
49813
|
}
|
|
49165
|
-
function segments(
|
|
49166
|
-
return normalizePath(
|
|
49814
|
+
function segments(path8) {
|
|
49815
|
+
return normalizePath(path8).split("/").filter(Boolean);
|
|
49167
49816
|
}
|
|
49168
49817
|
function isTemplateSegment(segment) {
|
|
49169
49818
|
return /^\{[^}]+\}$/.test(segment) || /^:[^/]+$/.test(segment) || /^\{\{[^}]+\}\}$/.test(segment) || /^<[^>]+>$/.test(segment);
|
|
@@ -49189,8 +49838,8 @@ function matchCandidate(candidate, request) {
|
|
|
49189
49838
|
function matchOperation(index, request) {
|
|
49190
49839
|
const record = asRecord4(request);
|
|
49191
49840
|
const method = String(record?.method || "").toUpperCase();
|
|
49192
|
-
const
|
|
49193
|
-
const candidates = index.operations.filter((operation) => operation.method === method).flatMap((operation) => operation.candidates.map((candidate) => ({ operation, score: matchCandidate(candidate,
|
|
49841
|
+
const path8 = requestPath(request);
|
|
49842
|
+
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) => {
|
|
49194
49843
|
for (let index2 = 0; index2 < a.score.length; index2 += 1) {
|
|
49195
49844
|
const delta = b.score[index2] - a.score[index2];
|
|
49196
49845
|
if (delta !== 0) return delta;
|
|
@@ -49198,11 +49847,11 @@ function matchOperation(index, request) {
|
|
|
49198
49847
|
return a.operation.id.localeCompare(b.operation.id);
|
|
49199
49848
|
});
|
|
49200
49849
|
const best = candidates[0];
|
|
49201
|
-
if (!best) return { path:
|
|
49850
|
+
if (!best) return { path: path8, method };
|
|
49202
49851
|
const tied = candidates.filter((entry) => entry.score.every((value, index2) => value === best.score[index2]));
|
|
49203
49852
|
const uniqueTied = [...new Map(tied.map((entry) => [entry.operation.id, entry.operation])).values()];
|
|
49204
|
-
if (uniqueTied.length > 1) return { path:
|
|
49205
|
-
return { path:
|
|
49853
|
+
if (uniqueTied.length > 1) return { path: path8, method, ambiguous: uniqueTied };
|
|
49854
|
+
return { path: path8, method, operation: best.operation };
|
|
49206
49855
|
}
|
|
49207
49856
|
function assignValidator(lines, target, source) {
|
|
49208
49857
|
lines.push(`${target} = ${source};`);
|
|
@@ -49487,10 +50136,10 @@ function instrumentContractCollection(collection, index) {
|
|
|
49487
50136
|
}
|
|
49488
50137
|
|
|
49489
50138
|
// src/lib/spec/openapi-loader.ts
|
|
49490
|
-
var
|
|
49491
|
-
var
|
|
50139
|
+
var import_node_fs2 = require("node:fs");
|
|
50140
|
+
var import_promises3 = require("node:fs/promises");
|
|
49492
50141
|
var import_node_url2 = require("node:url");
|
|
49493
|
-
var
|
|
50142
|
+
var import_node_path2 = __toESM(require("node:path"), 1);
|
|
49494
50143
|
|
|
49495
50144
|
// node_modules/@apidevtools/json-schema-ref-parser/dist/lib/util/convert-path-to-posix.js
|
|
49496
50145
|
var win32Sep = "\\";
|
|
@@ -49547,59 +50196,59 @@ function cwd() {
|
|
|
49547
50196
|
return href;
|
|
49548
50197
|
}
|
|
49549
50198
|
if (typeof process !== "undefined" && process.cwd) {
|
|
49550
|
-
const
|
|
49551
|
-
const lastChar =
|
|
50199
|
+
const path8 = process.cwd();
|
|
50200
|
+
const lastChar = path8.slice(-1);
|
|
49552
50201
|
if (lastChar === "/" || lastChar === "\\") {
|
|
49553
|
-
return
|
|
50202
|
+
return path8;
|
|
49554
50203
|
} else {
|
|
49555
|
-
return
|
|
50204
|
+
return path8 + "/";
|
|
49556
50205
|
}
|
|
49557
50206
|
}
|
|
49558
50207
|
return "/";
|
|
49559
50208
|
}
|
|
49560
|
-
function getProtocol(
|
|
49561
|
-
const match = protocolPattern.exec(
|
|
50209
|
+
function getProtocol(path8) {
|
|
50210
|
+
const match = protocolPattern.exec(path8 || "");
|
|
49562
50211
|
if (match) {
|
|
49563
50212
|
return match[1].toLowerCase();
|
|
49564
50213
|
}
|
|
49565
50214
|
return void 0;
|
|
49566
50215
|
}
|
|
49567
|
-
function getExtension(
|
|
49568
|
-
const lastDot =
|
|
50216
|
+
function getExtension(path8) {
|
|
50217
|
+
const lastDot = path8.lastIndexOf(".");
|
|
49569
50218
|
if (lastDot >= 0) {
|
|
49570
|
-
return stripQuery(
|
|
50219
|
+
return stripQuery(path8.substring(lastDot).toLowerCase());
|
|
49571
50220
|
}
|
|
49572
50221
|
return "";
|
|
49573
50222
|
}
|
|
49574
|
-
function stripQuery(
|
|
49575
|
-
const queryIndex =
|
|
50223
|
+
function stripQuery(path8) {
|
|
50224
|
+
const queryIndex = path8.indexOf("?");
|
|
49576
50225
|
if (queryIndex >= 0) {
|
|
49577
|
-
|
|
50226
|
+
path8 = path8.substring(0, queryIndex);
|
|
49578
50227
|
}
|
|
49579
|
-
return
|
|
50228
|
+
return path8;
|
|
49580
50229
|
}
|
|
49581
|
-
function getHash(
|
|
49582
|
-
if (!
|
|
50230
|
+
function getHash(path8) {
|
|
50231
|
+
if (!path8) {
|
|
49583
50232
|
return "#";
|
|
49584
50233
|
}
|
|
49585
|
-
const hashIndex =
|
|
50234
|
+
const hashIndex = path8.indexOf("#");
|
|
49586
50235
|
if (hashIndex >= 0) {
|
|
49587
|
-
return
|
|
50236
|
+
return path8.substring(hashIndex);
|
|
49588
50237
|
}
|
|
49589
50238
|
return "#";
|
|
49590
50239
|
}
|
|
49591
|
-
function stripHash(
|
|
49592
|
-
if (!
|
|
50240
|
+
function stripHash(path8) {
|
|
50241
|
+
if (!path8) {
|
|
49593
50242
|
return "";
|
|
49594
50243
|
}
|
|
49595
|
-
const hashIndex =
|
|
50244
|
+
const hashIndex = path8.indexOf("#");
|
|
49596
50245
|
if (hashIndex >= 0) {
|
|
49597
|
-
|
|
50246
|
+
path8 = path8.substring(0, hashIndex);
|
|
49598
50247
|
}
|
|
49599
|
-
return
|
|
50248
|
+
return path8;
|
|
49600
50249
|
}
|
|
49601
|
-
function isHttp(
|
|
49602
|
-
const protocol = getProtocol(
|
|
50250
|
+
function isHttp(path8) {
|
|
50251
|
+
const protocol = getProtocol(path8);
|
|
49603
50252
|
if (protocol === "http" || protocol === "https") {
|
|
49604
50253
|
return true;
|
|
49605
50254
|
} else if (protocol === void 0) {
|
|
@@ -49608,11 +50257,11 @@ function isHttp(path7) {
|
|
|
49608
50257
|
return false;
|
|
49609
50258
|
}
|
|
49610
50259
|
}
|
|
49611
|
-
function isUnsafeUrl(
|
|
49612
|
-
if (!
|
|
50260
|
+
function isUnsafeUrl(path8) {
|
|
50261
|
+
if (!path8 || typeof path8 !== "string") {
|
|
49613
50262
|
return true;
|
|
49614
50263
|
}
|
|
49615
|
-
const normalizedPath =
|
|
50264
|
+
const normalizedPath = path8.trim().toLowerCase();
|
|
49616
50265
|
if (!normalizedPath) {
|
|
49617
50266
|
return true;
|
|
49618
50267
|
}
|
|
@@ -49743,22 +50392,22 @@ function isInternalPort(port) {
|
|
|
49743
50392
|
];
|
|
49744
50393
|
return internalPorts.includes(port);
|
|
49745
50394
|
}
|
|
49746
|
-
function isFileSystemPath(
|
|
50395
|
+
function isFileSystemPath(path8) {
|
|
49747
50396
|
if (typeof window !== "undefined" || typeof process !== "undefined" && process.browser) {
|
|
49748
50397
|
return false;
|
|
49749
50398
|
}
|
|
49750
|
-
const protocol = getProtocol(
|
|
50399
|
+
const protocol = getProtocol(path8);
|
|
49751
50400
|
return protocol === void 0 || protocol === "file";
|
|
49752
50401
|
}
|
|
49753
|
-
function fromFileSystemPath(
|
|
50402
|
+
function fromFileSystemPath(path8) {
|
|
49754
50403
|
if (isWindows2()) {
|
|
49755
50404
|
const projectDir = cwd();
|
|
49756
|
-
const upperPath =
|
|
50405
|
+
const upperPath = path8.toUpperCase();
|
|
49757
50406
|
const projectDirPosixPath = convertPathToPosix(projectDir);
|
|
49758
50407
|
const posixUpper = projectDirPosixPath.toUpperCase();
|
|
49759
50408
|
const hasProjectDir = upperPath.includes(posixUpper);
|
|
49760
50409
|
const hasProjectUri = upperPath.includes(posixUpper);
|
|
49761
|
-
const isAbsolutePath = isAbsoluteWin32Path.test(
|
|
50410
|
+
const isAbsolutePath = isAbsoluteWin32Path.test(path8) || path8.startsWith("http://") || path8.startsWith("https://") || path8.startsWith("file://");
|
|
49762
50411
|
if (!(hasProjectDir || hasProjectUri || isAbsolutePath) && !projectDir.startsWith("http")) {
|
|
49763
50412
|
const join3 = (a, b) => {
|
|
49764
50413
|
if (a.endsWith("/") || a.endsWith("\\")) {
|
|
@@ -49767,42 +50416,42 @@ function fromFileSystemPath(path7) {
|
|
|
49767
50416
|
return a + "/" + b;
|
|
49768
50417
|
}
|
|
49769
50418
|
};
|
|
49770
|
-
|
|
50419
|
+
path8 = join3(projectDir, path8);
|
|
49771
50420
|
}
|
|
49772
|
-
|
|
50421
|
+
path8 = convertPathToPosix(path8);
|
|
49773
50422
|
}
|
|
49774
|
-
|
|
50423
|
+
path8 = encodeURI(path8);
|
|
49775
50424
|
for (const pattern of urlEncodePatterns) {
|
|
49776
|
-
|
|
50425
|
+
path8 = path8.replace(pattern[0], pattern[1]);
|
|
49777
50426
|
}
|
|
49778
|
-
return
|
|
50427
|
+
return path8;
|
|
49779
50428
|
}
|
|
49780
|
-
function toFileSystemPath(
|
|
49781
|
-
|
|
49782
|
-
|
|
50429
|
+
function toFileSystemPath(path8, keepFileProtocol) {
|
|
50430
|
+
path8 = path8.replace(/%(?![0-9A-Fa-f]{2})/g, "%25");
|
|
50431
|
+
path8 = decodeURI(path8);
|
|
49783
50432
|
for (let i = 0; i < urlDecodePatterns.length; i += 2) {
|
|
49784
|
-
|
|
50433
|
+
path8 = path8.replace(urlDecodePatterns[i], urlDecodePatterns[i + 1]);
|
|
49785
50434
|
}
|
|
49786
|
-
let isFileUrl =
|
|
50435
|
+
let isFileUrl = path8.toLowerCase().startsWith("file://");
|
|
49787
50436
|
if (isFileUrl) {
|
|
49788
|
-
|
|
49789
|
-
if (isWindows2() &&
|
|
49790
|
-
|
|
50437
|
+
path8 = path8.replace(/^file:\/\//, "").replace(/^\//, "");
|
|
50438
|
+
if (isWindows2() && path8[1] === "/") {
|
|
50439
|
+
path8 = `${path8[0]}:${path8.substring(1)}`;
|
|
49791
50440
|
}
|
|
49792
50441
|
if (keepFileProtocol) {
|
|
49793
|
-
|
|
50442
|
+
path8 = "file:///" + path8;
|
|
49794
50443
|
} else {
|
|
49795
50444
|
isFileUrl = false;
|
|
49796
|
-
|
|
50445
|
+
path8 = isWindows2() ? path8 : "/" + path8;
|
|
49797
50446
|
}
|
|
49798
50447
|
}
|
|
49799
50448
|
if (isWindows2() && !isFileUrl) {
|
|
49800
|
-
|
|
49801
|
-
if (
|
|
49802
|
-
|
|
50449
|
+
path8 = path8.replace(forwardSlashPattern, "\\");
|
|
50450
|
+
if (path8.match(/^[a-z]:\\/i)) {
|
|
50451
|
+
path8 = path8[0].toUpperCase() + path8.substring(1);
|
|
49803
50452
|
}
|
|
49804
50453
|
}
|
|
49805
|
-
return
|
|
50454
|
+
return path8;
|
|
49806
50455
|
}
|
|
49807
50456
|
function safePointerToPath(pointer) {
|
|
49808
50457
|
if (pointer.length <= 1 || pointer[0] !== "#" || pointer[1] !== "/") {
|
|
@@ -49923,8 +50572,8 @@ var MissingPointerError = class extends JSONParserError {
|
|
|
49923
50572
|
targetRef;
|
|
49924
50573
|
targetFound;
|
|
49925
50574
|
parentPath;
|
|
49926
|
-
constructor(token,
|
|
49927
|
-
super(`Missing $ref pointer "${getHash(
|
|
50575
|
+
constructor(token, path8, targetRef, targetFound, parentPath) {
|
|
50576
|
+
super(`Missing $ref pointer "${getHash(path8)}". Token "${token}" does not exist.`, stripHash(path8));
|
|
49928
50577
|
this.targetToken = token;
|
|
49929
50578
|
this.targetRef = targetRef;
|
|
49930
50579
|
this.targetFound = targetFound;
|
|
@@ -49941,8 +50590,8 @@ var TimeoutError = class extends JSONParserError {
|
|
|
49941
50590
|
var InvalidPointerError = class extends JSONParserError {
|
|
49942
50591
|
code = "EUNMATCHEDRESOLVER";
|
|
49943
50592
|
name = "InvalidPointerError";
|
|
49944
|
-
constructor(pointer,
|
|
49945
|
-
super(`Invalid $ref pointer "${pointer}". Pointers must begin with "#/"`, stripHash(
|
|
50593
|
+
constructor(pointer, path8) {
|
|
50594
|
+
super(`Invalid $ref pointer "${pointer}". Pointers must begin with "#/"`, stripHash(path8));
|
|
49946
50595
|
}
|
|
49947
50596
|
};
|
|
49948
50597
|
function isHandledError(err) {
|
|
@@ -50036,11 +50685,11 @@ var Pointer = class _Pointer {
|
|
|
50036
50685
|
* Resolving a single pointer may require resolving multiple $Refs.
|
|
50037
50686
|
*/
|
|
50038
50687
|
indirections;
|
|
50039
|
-
constructor($ref,
|
|
50688
|
+
constructor($ref, path8, friendlyPath) {
|
|
50040
50689
|
this.$ref = $ref;
|
|
50041
|
-
this.path =
|
|
50042
|
-
this.originalPath = friendlyPath ||
|
|
50043
|
-
this.scopeBase = $ref.path || stripHash(
|
|
50690
|
+
this.path = path8;
|
|
50691
|
+
this.originalPath = friendlyPath || path8;
|
|
50692
|
+
this.scopeBase = $ref.path || stripHash(path8);
|
|
50044
50693
|
this.value = void 0;
|
|
50045
50694
|
this.circular = false;
|
|
50046
50695
|
this.indirections = 0;
|
|
@@ -50093,10 +50742,10 @@ var Pointer = class _Pointer {
|
|
|
50093
50742
|
continue;
|
|
50094
50743
|
}
|
|
50095
50744
|
this.value = null;
|
|
50096
|
-
const
|
|
50097
|
-
const targetRef = this.path.replace(
|
|
50745
|
+
const path8 = this.$ref.path || "";
|
|
50746
|
+
const targetRef = this.path.replace(path8, "");
|
|
50098
50747
|
const targetFound = _Pointer.join("", found);
|
|
50099
|
-
const parentPath = pathFromRoot?.replace(
|
|
50748
|
+
const parentPath = pathFromRoot?.replace(path8, "");
|
|
50100
50749
|
throw new MissingPointerError(token, decodeURI(this.originalPath), targetRef, targetFound, parentPath);
|
|
50101
50750
|
} else {
|
|
50102
50751
|
this.value = this.value[token];
|
|
@@ -50162,8 +50811,8 @@ var Pointer = class _Pointer {
|
|
|
50162
50811
|
* @param [originalPath]
|
|
50163
50812
|
* @returns
|
|
50164
50813
|
*/
|
|
50165
|
-
static parse(
|
|
50166
|
-
const pointer = getHash(
|
|
50814
|
+
static parse(path8, originalPath) {
|
|
50815
|
+
const pointer = getHash(path8).substring(1);
|
|
50167
50816
|
if (!pointer) {
|
|
50168
50817
|
return [];
|
|
50169
50818
|
}
|
|
@@ -50172,7 +50821,7 @@ var Pointer = class _Pointer {
|
|
|
50172
50821
|
split[i] = split[i].replace(escapedSlash, "/").replace(escapedTilde, "~");
|
|
50173
50822
|
}
|
|
50174
50823
|
if (split[0] !== "") {
|
|
50175
|
-
throw new InvalidPointerError(pointer, originalPath === void 0 ?
|
|
50824
|
+
throw new InvalidPointerError(pointer, originalPath === void 0 ? path8 : originalPath);
|
|
50176
50825
|
}
|
|
50177
50826
|
return split.slice(1);
|
|
50178
50827
|
}
|
|
@@ -50313,9 +50962,9 @@ var $Ref = class _$Ref {
|
|
|
50313
50962
|
* @param options
|
|
50314
50963
|
* @returns
|
|
50315
50964
|
*/
|
|
50316
|
-
exists(
|
|
50965
|
+
exists(path8, options) {
|
|
50317
50966
|
try {
|
|
50318
|
-
this.resolve(
|
|
50967
|
+
this.resolve(path8, options);
|
|
50319
50968
|
return true;
|
|
50320
50969
|
} catch {
|
|
50321
50970
|
return false;
|
|
@@ -50328,8 +50977,8 @@ var $Ref = class _$Ref {
|
|
|
50328
50977
|
* @param options
|
|
50329
50978
|
* @returns - Returns the resolved value
|
|
50330
50979
|
*/
|
|
50331
|
-
get(
|
|
50332
|
-
return this.resolve(
|
|
50980
|
+
get(path8, options) {
|
|
50981
|
+
return this.resolve(path8, options)?.value;
|
|
50333
50982
|
}
|
|
50334
50983
|
/**
|
|
50335
50984
|
* Resolves the given JSON reference within this {@link $Ref#value}.
|
|
@@ -50340,8 +50989,8 @@ var $Ref = class _$Ref {
|
|
|
50340
50989
|
* @param pathFromRoot - The path of `obj` from the schema root
|
|
50341
50990
|
* @returns
|
|
50342
50991
|
*/
|
|
50343
|
-
resolve(
|
|
50344
|
-
const pointer = new pointer_default(this,
|
|
50992
|
+
resolve(path8, options, friendlyPath, pathFromRoot) {
|
|
50993
|
+
const pointer = new pointer_default(this, path8, friendlyPath);
|
|
50345
50994
|
try {
|
|
50346
50995
|
const resolved = pointer.resolve(this.value, options, pathFromRoot);
|
|
50347
50996
|
if (resolved.value === nullSymbol) {
|
|
@@ -50369,8 +51018,8 @@ var $Ref = class _$Ref {
|
|
|
50369
51018
|
* @param path - The full path of the property to set, optionally with a JSON pointer in the hash
|
|
50370
51019
|
* @param value - The value to assign
|
|
50371
51020
|
*/
|
|
50372
|
-
set(
|
|
50373
|
-
const pointer = new pointer_default(this,
|
|
51021
|
+
set(path8, value) {
|
|
51022
|
+
const pointer = new pointer_default(this, path8);
|
|
50374
51023
|
this.value = pointer.set(this.value, value);
|
|
50375
51024
|
if (this.value === nullSymbol) {
|
|
50376
51025
|
this.value = null;
|
|
@@ -50544,8 +51193,8 @@ var $Refs = class {
|
|
|
50544
51193
|
*/
|
|
50545
51194
|
paths(...types2) {
|
|
50546
51195
|
const paths = getPaths(this._$refs, types2.flat());
|
|
50547
|
-
return paths.map((
|
|
50548
|
-
return convertPathToPosix(
|
|
51196
|
+
return paths.map((path8) => {
|
|
51197
|
+
return convertPathToPosix(path8.decoded);
|
|
50549
51198
|
});
|
|
50550
51199
|
}
|
|
50551
51200
|
/**
|
|
@@ -50558,8 +51207,8 @@ var $Refs = class {
|
|
|
50558
51207
|
values(...types2) {
|
|
50559
51208
|
const $refs = this._$refs;
|
|
50560
51209
|
const paths = getPaths($refs, types2.flat());
|
|
50561
|
-
return paths.reduce((obj,
|
|
50562
|
-
obj[convertPathToPosix(
|
|
51210
|
+
return paths.reduce((obj, path8) => {
|
|
51211
|
+
obj[convertPathToPosix(path8.decoded)] = $refs[path8.encoded].value;
|
|
50563
51212
|
return obj;
|
|
50564
51213
|
}, {});
|
|
50565
51214
|
}
|
|
@@ -50577,9 +51226,9 @@ var $Refs = class {
|
|
|
50577
51226
|
* @param [options]
|
|
50578
51227
|
* @returns
|
|
50579
51228
|
*/
|
|
50580
|
-
exists(
|
|
51229
|
+
exists(path8, options) {
|
|
50581
51230
|
try {
|
|
50582
|
-
this._resolve(
|
|
51231
|
+
this._resolve(path8, "", options);
|
|
50583
51232
|
return true;
|
|
50584
51233
|
} catch {
|
|
50585
51234
|
return false;
|
|
@@ -50592,8 +51241,8 @@ var $Refs = class {
|
|
|
50592
51241
|
* @param [options]
|
|
50593
51242
|
* @returns - Returns the resolved value
|
|
50594
51243
|
*/
|
|
50595
|
-
get(
|
|
50596
|
-
return this._resolve(
|
|
51244
|
+
get(path8, options) {
|
|
51245
|
+
return this._resolve(path8, "", options).value;
|
|
50597
51246
|
}
|
|
50598
51247
|
/**
|
|
50599
51248
|
* 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.
|
|
@@ -50601,11 +51250,11 @@ var $Refs = class {
|
|
|
50601
51250
|
* @param path The JSON Reference path, optionally with a JSON Pointer in the hash
|
|
50602
51251
|
* @param value The value to assign. Can be anything (object, string, number, etc.)
|
|
50603
51252
|
*/
|
|
50604
|
-
set(
|
|
50605
|
-
const absPath = resolve2(this._root$Ref.path,
|
|
51253
|
+
set(path8, value) {
|
|
51254
|
+
const absPath = resolve2(this._root$Ref.path, path8);
|
|
50606
51255
|
const $ref = this._getRef(absPath);
|
|
50607
51256
|
if (!$ref) {
|
|
50608
|
-
throw new Error(`Error resolving $ref pointer "${
|
|
51257
|
+
throw new Error(`Error resolving $ref pointer "${path8}".
|
|
50609
51258
|
"${stripHash(absPath)}" not found.`);
|
|
50610
51259
|
}
|
|
50611
51260
|
$ref.set(absPath, value);
|
|
@@ -50617,25 +51266,25 @@ var $Refs = class {
|
|
|
50617
51266
|
* @returns
|
|
50618
51267
|
* @protected
|
|
50619
51268
|
*/
|
|
50620
|
-
_get$Ref(
|
|
50621
|
-
|
|
50622
|
-
return this._getRef(
|
|
51269
|
+
_get$Ref(path8) {
|
|
51270
|
+
path8 = resolve2(this._root$Ref.path, path8);
|
|
51271
|
+
return this._getRef(path8);
|
|
50623
51272
|
}
|
|
50624
51273
|
/**
|
|
50625
51274
|
* Creates a new {@link $Ref} object and adds it to this {@link $Refs} object.
|
|
50626
51275
|
*
|
|
50627
51276
|
* @param path - The file path or URL of the referenced file
|
|
50628
51277
|
*/
|
|
50629
|
-
_add(
|
|
50630
|
-
const withoutHash = stripHash(
|
|
51278
|
+
_add(path8) {
|
|
51279
|
+
const withoutHash = stripHash(path8);
|
|
50631
51280
|
const $ref = new ref_default(this);
|
|
50632
51281
|
$ref.path = withoutHash;
|
|
50633
51282
|
this._$refs[withoutHash] = $ref;
|
|
50634
51283
|
this._root$Ref = this._root$Ref || $ref;
|
|
50635
51284
|
return $ref;
|
|
50636
51285
|
}
|
|
50637
|
-
_addAlias(
|
|
50638
|
-
const withoutHash = stripHash(
|
|
51286
|
+
_addAlias(path8, value, pathType, dynamicIdScope = false) {
|
|
51287
|
+
const withoutHash = stripHash(path8);
|
|
50639
51288
|
if (!withoutHash || this._$refs[withoutHash] || this._aliases[withoutHash]) {
|
|
50640
51289
|
return this._$refs[withoutHash] || this._aliases[withoutHash];
|
|
50641
51290
|
}
|
|
@@ -50656,14 +51305,14 @@ var $Refs = class {
|
|
|
50656
51305
|
* @returns
|
|
50657
51306
|
* @protected
|
|
50658
51307
|
*/
|
|
50659
|
-
_resolve(
|
|
50660
|
-
const absPath = resolve2(this._root$Ref.path,
|
|
51308
|
+
_resolve(path8, pathFromRoot, options) {
|
|
51309
|
+
const absPath = resolve2(this._root$Ref.path, path8);
|
|
50661
51310
|
const $ref = this._getRef(absPath);
|
|
50662
51311
|
if (!$ref) {
|
|
50663
|
-
throw new Error(`Error resolving $ref pointer "${
|
|
51312
|
+
throw new Error(`Error resolving $ref pointer "${path8}".
|
|
50664
51313
|
"${stripHash(absPath)}" not found.`);
|
|
50665
51314
|
}
|
|
50666
|
-
return $ref.resolve(absPath, options,
|
|
51315
|
+
return $ref.resolve(absPath, options, path8, pathFromRoot);
|
|
50667
51316
|
}
|
|
50668
51317
|
/**
|
|
50669
51318
|
* A map of paths/urls to {@link $Ref} objects
|
|
@@ -50705,8 +51354,8 @@ var $Refs = class {
|
|
|
50705
51354
|
* @returns {object}
|
|
50706
51355
|
*/
|
|
50707
51356
|
toJSON = this.values;
|
|
50708
|
-
_getRef(
|
|
50709
|
-
const withoutHash = stripHash(
|
|
51357
|
+
_getRef(path8) {
|
|
51358
|
+
const withoutHash = stripHash(path8);
|
|
50710
51359
|
return this._$refs[withoutHash] || this._aliases[withoutHash];
|
|
50711
51360
|
}
|
|
50712
51361
|
};
|
|
@@ -50718,10 +51367,10 @@ function getPaths($refs, types2) {
|
|
|
50718
51367
|
return types2.includes($refs[key].pathType);
|
|
50719
51368
|
});
|
|
50720
51369
|
}
|
|
50721
|
-
return paths.map((
|
|
51370
|
+
return paths.map((path8) => {
|
|
50722
51371
|
return {
|
|
50723
|
-
encoded:
|
|
50724
|
-
decoded: $refs[
|
|
51372
|
+
encoded: path8,
|
|
51373
|
+
decoded: $refs[path8].pathType === "file" ? toFileSystemPath(path8, true) : path8
|
|
50725
51374
|
};
|
|
50726
51375
|
});
|
|
50727
51376
|
}
|
|
@@ -50813,14 +51462,14 @@ function getResult(obj, prop, file, callback, $refs) {
|
|
|
50813
51462
|
|
|
50814
51463
|
// node_modules/@apidevtools/json-schema-ref-parser/dist/lib/parse.js
|
|
50815
51464
|
async function parse2(target, $refs, options) {
|
|
50816
|
-
let
|
|
51465
|
+
let path8 = typeof target === "string" ? target : target.url;
|
|
50817
51466
|
const baseUrl = typeof target === "string" ? void 0 : target.baseUrl;
|
|
50818
51467
|
let reference = typeof target === "string" ? void 0 : target.reference;
|
|
50819
|
-
const hashIndex =
|
|
51468
|
+
const hashIndex = path8.indexOf("#");
|
|
50820
51469
|
let hash = "";
|
|
50821
51470
|
if (hashIndex >= 0) {
|
|
50822
|
-
hash =
|
|
50823
|
-
|
|
51471
|
+
hash = path8.substring(hashIndex);
|
|
51472
|
+
path8 = path8.substring(0, hashIndex);
|
|
50824
51473
|
}
|
|
50825
51474
|
if (reference) {
|
|
50826
51475
|
const referenceHashIndex = reference.indexOf("#");
|
|
@@ -50828,11 +51477,11 @@ async function parse2(target, $refs, options) {
|
|
|
50828
51477
|
reference = reference.substring(0, referenceHashIndex);
|
|
50829
51478
|
}
|
|
50830
51479
|
}
|
|
50831
|
-
const $ref = $refs._add(
|
|
51480
|
+
const $ref = $refs._add(path8);
|
|
50832
51481
|
const file = {
|
|
50833
|
-
url:
|
|
51482
|
+
url: path8,
|
|
50834
51483
|
hash,
|
|
50835
|
-
extension: getExtension(
|
|
51484
|
+
extension: getExtension(path8),
|
|
50836
51485
|
...reference !== void 0 ? { reference } : {},
|
|
50837
51486
|
...baseUrl !== void 0 ? { baseUrl } : {}
|
|
50838
51487
|
};
|
|
@@ -53717,24 +54366,24 @@ var file_default = {
|
|
|
53717
54366
|
* Reads the given file and returns its raw contents as a Buffer.
|
|
53718
54367
|
*/
|
|
53719
54368
|
async read(file) {
|
|
53720
|
-
let
|
|
54369
|
+
let path8;
|
|
53721
54370
|
const fs3 = await import("fs");
|
|
53722
54371
|
try {
|
|
53723
|
-
|
|
54372
|
+
path8 = toFileSystemPath(file.url);
|
|
53724
54373
|
} catch (err) {
|
|
53725
54374
|
const e = err;
|
|
53726
54375
|
e.message = `Malformed URI: ${file.url}: ${e.message}`;
|
|
53727
54376
|
throw new ResolverError(e, file.url);
|
|
53728
54377
|
}
|
|
53729
|
-
if (
|
|
53730
|
-
|
|
54378
|
+
if (path8.endsWith("/") || path8.endsWith("\\")) {
|
|
54379
|
+
path8 = path8.slice(0, -1);
|
|
53731
54380
|
}
|
|
53732
54381
|
try {
|
|
53733
|
-
return await fs3.promises.readFile(
|
|
54382
|
+
return await fs3.promises.readFile(path8);
|
|
53734
54383
|
} catch (err) {
|
|
53735
54384
|
const e = err;
|
|
53736
|
-
e.message = `Error opening file ${
|
|
53737
|
-
throw new ResolverError(e,
|
|
54385
|
+
e.message = `Error opening file ${path8}: ${e.message}`;
|
|
54386
|
+
throw new ResolverError(e, path8);
|
|
53738
54387
|
}
|
|
53739
54388
|
}
|
|
53740
54389
|
};
|
|
@@ -53798,7 +54447,7 @@ async function download(u, httpOptions, _redirects) {
|
|
|
53798
54447
|
const redirects = _redirects || [];
|
|
53799
54448
|
redirects.push(u.href);
|
|
53800
54449
|
try {
|
|
53801
|
-
const res = await
|
|
54450
|
+
const res = await get2(u, httpOptions);
|
|
53802
54451
|
if (res.status >= 400) {
|
|
53803
54452
|
const error2 = new Error(`HTTP ERROR ${res.status}`);
|
|
53804
54453
|
error2.status = res.status;
|
|
@@ -53831,7 +54480,7 @@ Too many redirects:
|
|
|
53831
54480
|
throw new ResolverError(e, u.href);
|
|
53832
54481
|
}
|
|
53833
54482
|
}
|
|
53834
|
-
async function
|
|
54483
|
+
async function get2(u, httpOptions) {
|
|
53835
54484
|
let controller;
|
|
53836
54485
|
let timeoutId;
|
|
53837
54486
|
if (httpOptions.timeout && typeof AbortController !== "undefined") {
|
|
@@ -53958,7 +54607,7 @@ function isMergeable(val) {
|
|
|
53958
54607
|
|
|
53959
54608
|
// node_modules/@apidevtools/json-schema-ref-parser/dist/lib/normalize-args.js
|
|
53960
54609
|
function normalizeArgs(_args) {
|
|
53961
|
-
let
|
|
54610
|
+
let path8;
|
|
53962
54611
|
let schema2;
|
|
53963
54612
|
let options;
|
|
53964
54613
|
let callback;
|
|
@@ -53967,7 +54616,7 @@ function normalizeArgs(_args) {
|
|
|
53967
54616
|
callback = args.pop();
|
|
53968
54617
|
}
|
|
53969
54618
|
if (typeof args[0] === "string") {
|
|
53970
|
-
|
|
54619
|
+
path8 = args[0];
|
|
53971
54620
|
if (typeof args[2] === "object") {
|
|
53972
54621
|
schema2 = args[1];
|
|
53973
54622
|
options = args[2];
|
|
@@ -53976,7 +54625,7 @@ function normalizeArgs(_args) {
|
|
|
53976
54625
|
options = args[1];
|
|
53977
54626
|
}
|
|
53978
54627
|
} else {
|
|
53979
|
-
|
|
54628
|
+
path8 = "";
|
|
53980
54629
|
schema2 = args[0];
|
|
53981
54630
|
options = args[1];
|
|
53982
54631
|
}
|
|
@@ -53989,7 +54638,7 @@ function normalizeArgs(_args) {
|
|
|
53989
54638
|
schema2 = JSON.parse(JSON.stringify(schema2));
|
|
53990
54639
|
}
|
|
53991
54640
|
return {
|
|
53992
|
-
path:
|
|
54641
|
+
path: path8,
|
|
53993
54642
|
schema: schema2,
|
|
53994
54643
|
options,
|
|
53995
54644
|
callback
|
|
@@ -54010,18 +54659,18 @@ function resolveExternal(parser, options) {
|
|
|
54010
54659
|
return Promise.reject(e);
|
|
54011
54660
|
}
|
|
54012
54661
|
}
|
|
54013
|
-
function crawl(obj,
|
|
54662
|
+
function crawl(obj, path8, scopeBase, dynamicIdScope, $refs, options, seen, external) {
|
|
54014
54663
|
seen ||= /* @__PURE__ */ new Set();
|
|
54015
54664
|
let promises3 = [];
|
|
54016
54665
|
if (obj && typeof obj === "object" && !ArrayBuffer.isView(obj) && !seen.has(obj)) {
|
|
54017
54666
|
seen.add(obj);
|
|
54018
54667
|
const currentScopeBase = scopeBase;
|
|
54019
54668
|
if (ref_default.isExternal$Ref(obj)) {
|
|
54020
|
-
promises3.push(resolve$Ref(obj,
|
|
54669
|
+
promises3.push(resolve$Ref(obj, path8, currentScopeBase, dynamicIdScope, $refs, options));
|
|
54021
54670
|
}
|
|
54022
54671
|
const keys = Object.keys(obj);
|
|
54023
54672
|
for (const key of keys) {
|
|
54024
|
-
const keyPath = pointer_default.join(
|
|
54673
|
+
const keyPath = pointer_default.join(path8, key);
|
|
54025
54674
|
const value = obj[key];
|
|
54026
54675
|
const childScopeBase = dynamicIdScope && value && typeof value === "object" && !ArrayBuffer.isView(value) ? getSchemaBasePath(currentScopeBase, value) : currentScopeBase;
|
|
54027
54676
|
promises3 = promises3.concat(crawl(value, keyPath, childScopeBase, dynamicIdScope, $refs, options, seen, external));
|
|
@@ -54029,9 +54678,9 @@ function crawl(obj, path7, scopeBase, dynamicIdScope, $refs, options, seen, exte
|
|
|
54029
54678
|
}
|
|
54030
54679
|
return promises3;
|
|
54031
54680
|
}
|
|
54032
|
-
async function resolve$Ref($ref,
|
|
54681
|
+
async function resolve$Ref($ref, path8, scopeBase, dynamicIdScope, $refs, options) {
|
|
54033
54682
|
const shouldResolveOnCwd = options.dereference?.externalReferenceResolution === "root";
|
|
54034
|
-
const resolutionBase = shouldResolveOnCwd ? cwd() : dynamicIdScope ? scopeBase :
|
|
54683
|
+
const resolutionBase = shouldResolveOnCwd ? cwd() : dynamicIdScope ? scopeBase : path8;
|
|
54035
54684
|
const resolvedPath = resolve2(resolutionBase, $ref.$ref);
|
|
54036
54685
|
const withoutHash = stripHash(resolvedPath);
|
|
54037
54686
|
const ref = $refs._get$Ref(withoutHash);
|
|
@@ -54056,8 +54705,8 @@ async function resolve$Ref($ref, path7, scopeBase, dynamicIdScope, $refs, option
|
|
|
54056
54705
|
throw err;
|
|
54057
54706
|
}
|
|
54058
54707
|
if ($refs._$refs[withoutHash]) {
|
|
54059
|
-
err.source = decodeURI(stripHash(
|
|
54060
|
-
err.path = safePointerToPath(getHash(
|
|
54708
|
+
err.source = decodeURI(stripHash(path8));
|
|
54709
|
+
err.path = safePointerToPath(getHash(path8));
|
|
54061
54710
|
}
|
|
54062
54711
|
return [];
|
|
54063
54712
|
}
|
|
@@ -54076,14 +54725,14 @@ function bundle(parser, options) {
|
|
|
54076
54725
|
fixRefsThroughRefs(inventory, parser.schema);
|
|
54077
54726
|
}
|
|
54078
54727
|
}
|
|
54079
|
-
function crawl2(parent, key,
|
|
54728
|
+
function crawl2(parent, key, path8, scopeBase, dynamicIdScope, pathFromRoot, indirections, inventory, $refs, options) {
|
|
54080
54729
|
const obj = key === null ? parent : parent[key];
|
|
54081
54730
|
const bundleOptions = options.bundle || {};
|
|
54082
54731
|
const isExcludedPath = bundleOptions.excludedPathMatcher || (() => false);
|
|
54083
54732
|
if (obj && typeof obj === "object" && !ArrayBuffer.isView(obj) && !isExcludedPath(pathFromRoot)) {
|
|
54084
54733
|
const currentScopeBase = scopeBase;
|
|
54085
54734
|
if (ref_default.isAllowed$Ref(obj)) {
|
|
54086
|
-
inventory$Ref(parent, key,
|
|
54735
|
+
inventory$Ref(parent, key, path8, currentScopeBase, dynamicIdScope, pathFromRoot, indirections, inventory, $refs, options);
|
|
54087
54736
|
} else {
|
|
54088
54737
|
const keys = Object.keys(obj).sort((a, b) => {
|
|
54089
54738
|
if (a === "definitions" || a === "$defs") {
|
|
@@ -54095,7 +54744,7 @@ function crawl2(parent, key, path7, scopeBase, dynamicIdScope, pathFromRoot, ind
|
|
|
54095
54744
|
}
|
|
54096
54745
|
});
|
|
54097
54746
|
for (const key2 of keys) {
|
|
54098
|
-
const keyPath = pointer_default.join(
|
|
54747
|
+
const keyPath = pointer_default.join(path8, key2);
|
|
54099
54748
|
const keyPathFromRoot = pointer_default.join(pathFromRoot, key2);
|
|
54100
54749
|
const value = obj[key2];
|
|
54101
54750
|
const childScopeBase = dynamicIdScope && value && typeof value === "object" && !ArrayBuffer.isView(value) ? getSchemaBasePath(currentScopeBase, value) : currentScopeBase;
|
|
@@ -54113,9 +54762,9 @@ function crawl2(parent, key, path7, scopeBase, dynamicIdScope, pathFromRoot, ind
|
|
|
54113
54762
|
}
|
|
54114
54763
|
}
|
|
54115
54764
|
}
|
|
54116
|
-
function inventory$Ref($refParent, $refKey,
|
|
54765
|
+
function inventory$Ref($refParent, $refKey, path8, scopeBase, dynamicIdScope, pathFromRoot, indirections, inventory, $refs, options) {
|
|
54117
54766
|
const $ref = $refKey === null ? $refParent : $refParent[$refKey];
|
|
54118
|
-
const $refPath = resolve2(dynamicIdScope ? scopeBase :
|
|
54767
|
+
const $refPath = resolve2(dynamicIdScope ? scopeBase : path8, $ref.$ref);
|
|
54119
54768
|
const pointer = $refs._resolve($refPath, pathFromRoot, options);
|
|
54120
54769
|
if (pointer === null) {
|
|
54121
54770
|
return;
|
|
@@ -54275,11 +54924,11 @@ function resolvePathThroughRefs(schema2, refPath) {
|
|
|
54275
54924
|
const result = "#/" + resolvedSegments.join("/");
|
|
54276
54925
|
return result;
|
|
54277
54926
|
}
|
|
54278
|
-
function walkPath(schema2,
|
|
54279
|
-
if (!
|
|
54927
|
+
function walkPath(schema2, path8) {
|
|
54928
|
+
if (!path8.startsWith("#/")) {
|
|
54280
54929
|
return void 0;
|
|
54281
54930
|
}
|
|
54282
|
-
const segments2 =
|
|
54931
|
+
const segments2 = path8.slice(2).split("/");
|
|
54283
54932
|
let current = schema2;
|
|
54284
54933
|
for (const seg of segments2) {
|
|
54285
54934
|
if (current === null || current === void 0 || typeof current !== "object") {
|
|
@@ -54315,7 +54964,7 @@ function dereference(parser, options) {
|
|
|
54315
54964
|
parser.$refs.circular = dereferenced.circular;
|
|
54316
54965
|
parser.schema = dereferenced.value;
|
|
54317
54966
|
}
|
|
54318
|
-
function crawl3(obj,
|
|
54967
|
+
function crawl3(obj, path8, scopeBase, dynamicIdScope, pathFromRoot, parents, processedObjects, dereferencedCache, $refs, options, startTime, depth) {
|
|
54319
54968
|
let dereferenced;
|
|
54320
54969
|
const result = {
|
|
54321
54970
|
value: obj,
|
|
@@ -54334,13 +54983,13 @@ function crawl3(obj, path7, scopeBase, dynamicIdScope, pathFromRoot, parents, pr
|
|
|
54334
54983
|
processedObjects.add(obj);
|
|
54335
54984
|
const currentScopeBase = scopeBase;
|
|
54336
54985
|
if (ref_default.isAllowed$Ref(obj, options)) {
|
|
54337
|
-
dereferenced = dereference$Ref(obj,
|
|
54986
|
+
dereferenced = dereference$Ref(obj, path8, currentScopeBase, dynamicIdScope, pathFromRoot, parents, processedObjects, dereferencedCache, $refs, options, startTime, depth);
|
|
54338
54987
|
result.circular = dereferenced.circular;
|
|
54339
54988
|
result.value = dereferenced.value;
|
|
54340
54989
|
} else {
|
|
54341
54990
|
for (const key of Object.keys(obj)) {
|
|
54342
54991
|
checkDereferenceTimeout(startTime, options);
|
|
54343
|
-
const keyPath = pointer_default.join(
|
|
54992
|
+
const keyPath = pointer_default.join(path8, key);
|
|
54344
54993
|
const keyPathFromRoot = pointer_default.join(pathFromRoot, key);
|
|
54345
54994
|
if (isExcludedPath(keyPathFromRoot)) {
|
|
54346
54995
|
continue;
|
|
@@ -54395,10 +55044,10 @@ function crawl3(obj, path7, scopeBase, dynamicIdScope, pathFromRoot, parents, pr
|
|
|
54395
55044
|
}
|
|
54396
55045
|
return result;
|
|
54397
55046
|
}
|
|
54398
|
-
function dereference$Ref($ref,
|
|
55047
|
+
function dereference$Ref($ref, path8, scopeBase, dynamicIdScope, pathFromRoot, parents, processedObjects, dereferencedCache, $refs, options, startTime, depth) {
|
|
54399
55048
|
const isExternalRef = ref_default.isExternal$Ref($ref);
|
|
54400
55049
|
const shouldResolveOnCwd = isExternalRef && options?.dereference?.externalReferenceResolution === "root";
|
|
54401
|
-
const resolutionBase = shouldResolveOnCwd ? cwd() : dynamicIdScope ? scopeBase :
|
|
55050
|
+
const resolutionBase = shouldResolveOnCwd ? cwd() : dynamicIdScope ? scopeBase : path8;
|
|
54402
55051
|
const $refPath = resolve2(resolutionBase, $ref.$ref);
|
|
54403
55052
|
const cache = dereferencedCache.get($refPath);
|
|
54404
55053
|
if (cache) {
|
|
@@ -54420,16 +55069,16 @@ function dereference$Ref($ref, path7, scopeBase, dynamicIdScope, pathFromRoot, p
|
|
|
54420
55069
|
}
|
|
54421
55070
|
if (typeof cache.value === "object" && "$ref" in cache.value && "$ref" in $ref) {
|
|
54422
55071
|
if (cache.value.$ref === $ref.$ref) {
|
|
54423
|
-
foundCircularReference(
|
|
55072
|
+
foundCircularReference(path8, $refs, options);
|
|
54424
55073
|
return cache;
|
|
54425
55074
|
} else {
|
|
54426
55075
|
}
|
|
54427
55076
|
} else {
|
|
54428
|
-
foundCircularReference(
|
|
55077
|
+
foundCircularReference(path8, $refs, options);
|
|
54429
55078
|
return cache;
|
|
54430
55079
|
}
|
|
54431
55080
|
}
|
|
54432
|
-
const pointer = $refs._resolve($refPath,
|
|
55081
|
+
const pointer = $refs._resolve($refPath, path8, options);
|
|
54433
55082
|
if (pointer === null) {
|
|
54434
55083
|
return {
|
|
54435
55084
|
circular: false,
|
|
@@ -54439,7 +55088,7 @@ function dereference$Ref($ref, path7, scopeBase, dynamicIdScope, pathFromRoot, p
|
|
|
54439
55088
|
const directCircular = pointer.circular;
|
|
54440
55089
|
let circular = directCircular || parents.has(pointer.value);
|
|
54441
55090
|
if (circular) {
|
|
54442
|
-
foundCircularReference(
|
|
55091
|
+
foundCircularReference(path8, $refs, options);
|
|
54443
55092
|
}
|
|
54444
55093
|
let dereferencedValue = ref_default.dereference($ref, pointer.value, options);
|
|
54445
55094
|
if (!circular) {
|
|
@@ -60847,7 +61496,7 @@ function hasInvalidPaths(api) {
|
|
|
60847
61496
|
if (!api.paths || typeof api.paths !== "object" || Array.isArray(api.paths)) {
|
|
60848
61497
|
return false;
|
|
60849
61498
|
}
|
|
60850
|
-
return Object.keys(api.paths).some((
|
|
61499
|
+
return Object.keys(api.paths).some((path8) => !path8.startsWith("/"));
|
|
60851
61500
|
}
|
|
60852
61501
|
function reduceAjvErrors(errors) {
|
|
60853
61502
|
const flattened = /* @__PURE__ */ new Map();
|
|
@@ -60932,7 +61581,7 @@ function validateSchema(api, options = {}, suppressedInstancePaths = []) {
|
|
|
60932
61581
|
}
|
|
60933
61582
|
let additionalErrors = 0;
|
|
60934
61583
|
let reducedErrors = reduceAjvErrors(ajv.errors).filter((err) => {
|
|
60935
|
-
return !suppressedInstancePaths.some((
|
|
61584
|
+
return !suppressedInstancePaths.some((path8) => err.instancePath === path8 || err.instancePath.startsWith(`${path8}/`));
|
|
60936
61585
|
});
|
|
60937
61586
|
if (!reducedErrors.length) {
|
|
60938
61587
|
return { valid: true, warnings: [], specification: specificationName };
|
|
@@ -60983,9 +61632,9 @@ var SpecificationValidator = class {
|
|
|
60983
61632
|
reportWarning(message) {
|
|
60984
61633
|
this.warnings.push({ message });
|
|
60985
61634
|
}
|
|
60986
|
-
flagInstancePath(
|
|
60987
|
-
if (!this.flaggedInstancePaths.includes(
|
|
60988
|
-
this.flaggedInstancePaths.push(
|
|
61635
|
+
flagInstancePath(path8) {
|
|
61636
|
+
if (!this.flaggedInstancePaths.includes(path8)) {
|
|
61637
|
+
this.flaggedInstancePaths.push(path8);
|
|
60989
61638
|
}
|
|
60990
61639
|
}
|
|
60991
61640
|
};
|
|
@@ -61003,10 +61652,10 @@ var OpenAPISpecificationValidator = class extends SpecificationValidator {
|
|
|
61003
61652
|
run() {
|
|
61004
61653
|
const operationIds = [];
|
|
61005
61654
|
Object.keys(this.api.paths || {}).forEach((pathName) => {
|
|
61006
|
-
const
|
|
61655
|
+
const path8 = this.api.paths[pathName];
|
|
61007
61656
|
const pathId = `/paths${pathName}`;
|
|
61008
|
-
if (
|
|
61009
|
-
this.validatePath(
|
|
61657
|
+
if (path8 && pathName.startsWith("/")) {
|
|
61658
|
+
this.validatePath(path8, pathId, operationIds);
|
|
61010
61659
|
}
|
|
61011
61660
|
});
|
|
61012
61661
|
if (isOpenAPI30(this.api)) {
|
|
@@ -61035,9 +61684,9 @@ var OpenAPISpecificationValidator = class extends SpecificationValidator {
|
|
|
61035
61684
|
* Validates the given path.
|
|
61036
61685
|
*
|
|
61037
61686
|
*/
|
|
61038
|
-
validatePath(
|
|
61687
|
+
validatePath(path8, pathId, operationIds) {
|
|
61039
61688
|
supportedHTTPMethods.forEach((operationName) => {
|
|
61040
|
-
const operation =
|
|
61689
|
+
const operation = path8[operationName];
|
|
61041
61690
|
const operationId = `${pathId}/${operationName}`;
|
|
61042
61691
|
if (operation) {
|
|
61043
61692
|
const declaredOperationId = operation.operationId;
|
|
@@ -61050,7 +61699,7 @@ var OpenAPISpecificationValidator = class extends SpecificationValidator {
|
|
|
61050
61699
|
this.reportError(`The operationId \`${declaredOperationId}\` is duplicated and must be made unique.`);
|
|
61051
61700
|
}
|
|
61052
61701
|
}
|
|
61053
|
-
this.validateParameters(
|
|
61702
|
+
this.validateParameters(path8, pathId, operation, operationId);
|
|
61054
61703
|
Object.keys(operation.responses || {}).forEach((responseCode) => {
|
|
61055
61704
|
const response = operation.responses[responseCode];
|
|
61056
61705
|
const responseId = `${operationId}/responses/${responseCode}`;
|
|
@@ -61065,8 +61714,8 @@ var OpenAPISpecificationValidator = class extends SpecificationValidator {
|
|
|
61065
61714
|
* Validates the parameters for the given operation.
|
|
61066
61715
|
*
|
|
61067
61716
|
*/
|
|
61068
|
-
validateParameters(
|
|
61069
|
-
const pathParams =
|
|
61717
|
+
validateParameters(path8, pathId, operation, operationId) {
|
|
61718
|
+
const pathParams = path8.parameters || [];
|
|
61070
61719
|
const operationParams = operation.parameters || [];
|
|
61071
61720
|
this.checkForDuplicates(pathParams, pathId);
|
|
61072
61721
|
this.checkForDuplicates(operationParams, operationId);
|
|
@@ -61365,10 +62014,10 @@ var SwaggerSpecificationValidator = class extends SpecificationValidator {
|
|
|
61365
62014
|
run() {
|
|
61366
62015
|
const operationIds = [];
|
|
61367
62016
|
Object.keys(this.api.paths || {}).forEach((pathName) => {
|
|
61368
|
-
const
|
|
62017
|
+
const path8 = this.api.paths[pathName];
|
|
61369
62018
|
const pathId = `/paths${pathName}`;
|
|
61370
|
-
if (
|
|
61371
|
-
this.validatePath(
|
|
62019
|
+
if (path8 && pathName.startsWith("/")) {
|
|
62020
|
+
this.validatePath(path8, pathId, operationIds);
|
|
61372
62021
|
}
|
|
61373
62022
|
});
|
|
61374
62023
|
Object.keys(this.api.definitions || {}).forEach((definitionName) => {
|
|
@@ -61386,9 +62035,9 @@ var SwaggerSpecificationValidator = class extends SpecificationValidator {
|
|
|
61386
62035
|
* Validates the given path.
|
|
61387
62036
|
*
|
|
61388
62037
|
*/
|
|
61389
|
-
validatePath(
|
|
62038
|
+
validatePath(path8, pathId, operationIds) {
|
|
61390
62039
|
swaggerHTTPMethods.forEach((operationName) => {
|
|
61391
|
-
const operation =
|
|
62040
|
+
const operation = path8[operationName];
|
|
61392
62041
|
const operationId = `${pathId}/${operationName}`;
|
|
61393
62042
|
if (operation) {
|
|
61394
62043
|
const declaredOperationId = operation.operationId;
|
|
@@ -61401,7 +62050,7 @@ var SwaggerSpecificationValidator = class extends SpecificationValidator {
|
|
|
61401
62050
|
this.reportError(`The operationId \`${declaredOperationId}\` is duplicated and must be made unique.`);
|
|
61402
62051
|
}
|
|
61403
62052
|
}
|
|
61404
|
-
this.validateParameters(
|
|
62053
|
+
this.validateParameters(path8, pathId, operation, operationId);
|
|
61405
62054
|
Object.keys(operation.responses || {}).forEach((responseName) => {
|
|
61406
62055
|
const response = operation.responses[responseName];
|
|
61407
62056
|
if ("$ref" in response || !response) {
|
|
@@ -61417,8 +62066,8 @@ var SwaggerSpecificationValidator = class extends SpecificationValidator {
|
|
|
61417
62066
|
* Validates the parameters for the given operation.
|
|
61418
62067
|
*
|
|
61419
62068
|
*/
|
|
61420
|
-
validateParameters(
|
|
61421
|
-
const pathParams = (
|
|
62069
|
+
validateParameters(path8, pathId, operation, operationId) {
|
|
62070
|
+
const pathParams = (path8.parameters || []).filter((param) => !("$ref" in param));
|
|
61422
62071
|
const operationParams = (operation.parameters || []).filter(
|
|
61423
62072
|
(param) => !("$ref" in param)
|
|
61424
62073
|
);
|
|
@@ -61997,29 +62646,29 @@ async function loadOpenApiContractSpec(specUrl, options = {}) {
|
|
|
61997
62646
|
async function loadOpenApiContractSpecFromPath(specPath, options = {}) {
|
|
61998
62647
|
if (!specPath) throw new Error("CONTRACT_SPEC_READ_FAILED: spec-path must not be empty");
|
|
61999
62648
|
const workspaceRoot = (() => {
|
|
62000
|
-
const root =
|
|
62649
|
+
const root = import_node_path2.default.resolve(process.env.GITHUB_WORKSPACE ?? process.cwd());
|
|
62001
62650
|
try {
|
|
62002
|
-
return (0,
|
|
62651
|
+
return (0, import_node_fs2.realpathSync)(root);
|
|
62003
62652
|
} catch {
|
|
62004
62653
|
return root;
|
|
62005
62654
|
}
|
|
62006
62655
|
})();
|
|
62007
|
-
const resolved =
|
|
62656
|
+
const resolved = import_node_path2.default.resolve(workspaceRoot, specPath);
|
|
62008
62657
|
let absolutePath;
|
|
62009
62658
|
try {
|
|
62010
|
-
absolutePath = (0,
|
|
62659
|
+
absolutePath = (0, import_node_fs2.realpathSync)(resolved);
|
|
62011
62660
|
} catch (error2) {
|
|
62012
62661
|
throw new Error(`CONTRACT_SPEC_READ_FAILED: Unable to read spec at ${specPath}`, { cause: error2 });
|
|
62013
62662
|
}
|
|
62014
|
-
const rel =
|
|
62015
|
-
if (!rel || rel.startsWith("..") ||
|
|
62663
|
+
const rel = import_node_path2.default.relative(workspaceRoot, absolutePath);
|
|
62664
|
+
if (!rel || rel.startsWith("..") || import_node_path2.default.isAbsolute(rel)) {
|
|
62016
62665
|
throw new Error(`CONTRACT_SPEC_READ_FAILED: spec-path must resolve inside ${workspaceRoot}, got: ${specPath}`);
|
|
62017
62666
|
}
|
|
62018
62667
|
const maxBytes = options.maxBytesPerResource ?? SAFE_FETCH_LIMITS.maxBytesPerResource;
|
|
62019
62668
|
const maxTotalBytes = options.maxTotalBytes ?? SAFE_FETCH_LIMITS.maxTotalBytes;
|
|
62020
62669
|
let onDiskBytes;
|
|
62021
62670
|
try {
|
|
62022
|
-
onDiskBytes = (await (0,
|
|
62671
|
+
onDiskBytes = (await (0, import_promises3.stat)(absolutePath)).size;
|
|
62023
62672
|
} catch (error2) {
|
|
62024
62673
|
throw new Error(`CONTRACT_SPEC_READ_FAILED: Unable to read spec at ${specPath}`, { cause: error2 });
|
|
62025
62674
|
}
|
|
@@ -62032,7 +62681,7 @@ async function loadOpenApiContractSpecFromPath(specPath, options = {}) {
|
|
|
62032
62681
|
}
|
|
62033
62682
|
let content;
|
|
62034
62683
|
try {
|
|
62035
|
-
content = await (0,
|
|
62684
|
+
content = await (0, import_promises3.readFile)(absolutePath, "utf8");
|
|
62036
62685
|
} catch (error2) {
|
|
62037
62686
|
throw new Error(`CONTRACT_SPEC_READ_FAILED: Unable to read spec at ${specPath}`, { cause: error2 });
|
|
62038
62687
|
}
|
|
@@ -62094,6 +62743,13 @@ function parseSpecSyncMode(value) {
|
|
|
62094
62743
|
}
|
|
62095
62744
|
throw new Error(`Unsupported spec-sync-mode "${v}". Supported values: ${allowed.join(", ")}`);
|
|
62096
62745
|
}
|
|
62746
|
+
function parseBreakingChangeMode(value) {
|
|
62747
|
+
return parseEnumInput(
|
|
62748
|
+
"breaking-change-mode",
|
|
62749
|
+
value,
|
|
62750
|
+
customerPreviewActionContract.inputs["breaking-change-mode"].default ?? "off"
|
|
62751
|
+
);
|
|
62752
|
+
}
|
|
62097
62753
|
function parseEnumInput(name, value, defaultValue) {
|
|
62098
62754
|
const allowed = customerPreviewActionContract.inputs[name].allowedValues ?? [];
|
|
62099
62755
|
const v = value?.trim() || defaultValue;
|
|
@@ -62199,6 +62855,12 @@ function resolveInputs(env = process.env) {
|
|
|
62199
62855
|
specUrl,
|
|
62200
62856
|
specPath,
|
|
62201
62857
|
openapiVersion: resolveOpenapiVersion(getInput2("openapi-version", env)),
|
|
62858
|
+
breakingChangeMode: parseBreakingChangeMode(getInput2("breaking-change-mode", env)),
|
|
62859
|
+
breakingBaselineSpecPath: getInput2("breaking-baseline-spec-path", env),
|
|
62860
|
+
breakingRulesPath: getInput2("breaking-rules-path", env) ?? customerPreviewActionContract.inputs["breaking-rules-path"].default,
|
|
62861
|
+
breakingTargetRef: getInput2("breaking-target-ref", env),
|
|
62862
|
+
breakingSummaryPath: getInput2("breaking-summary-path", env),
|
|
62863
|
+
breakingLogPath: getInput2("breaking-log-path", env),
|
|
62202
62864
|
governanceMappingJson: parseGovernanceMappingJson(getInput2("governance-mapping-json", env)),
|
|
62203
62865
|
postmanApiKey: getInput2("postman-api-key", env) ?? "",
|
|
62204
62866
|
postmanAccessToken: getInput2("postman-access-token", env),
|
|
@@ -62239,6 +62901,17 @@ function createPlannedOutputs(inputs) {
|
|
|
62239
62901
|
total: 0,
|
|
62240
62902
|
violations: [],
|
|
62241
62903
|
warnings: 0
|
|
62904
|
+
}),
|
|
62905
|
+
"breaking-change-status": "skipped",
|
|
62906
|
+
"breaking-change-summary-json": JSON.stringify({
|
|
62907
|
+
breakingChanges: 0,
|
|
62908
|
+
comparison: "",
|
|
62909
|
+
exitCode: 0,
|
|
62910
|
+
logPath: "",
|
|
62911
|
+
message: "Breaking-change check is disabled.",
|
|
62912
|
+
mode: inputs.breakingChangeMode,
|
|
62913
|
+
status: "skipped",
|
|
62914
|
+
summaryPath: ""
|
|
62242
62915
|
})
|
|
62243
62916
|
};
|
|
62244
62917
|
}
|
|
@@ -62293,6 +62966,12 @@ function readActionInputs(actionCore) {
|
|
|
62293
62966
|
INPUT_NESTED_FOLDER_HIERARCHY: optionalInput(actionCore, "nested-folder-hierarchy") ?? customerPreviewActionContract.inputs["nested-folder-hierarchy"].default,
|
|
62294
62967
|
INPUT_REQUEST_NAME_SOURCE: optionalInput(actionCore, "request-name-source") ?? customerPreviewActionContract.inputs["request-name-source"].default,
|
|
62295
62968
|
INPUT_OPENAPI_VERSION: optionalInput(actionCore, "openapi-version") ?? "",
|
|
62969
|
+
INPUT_BREAKING_CHANGE_MODE: optionalInput(actionCore, "breaking-change-mode") ?? customerPreviewActionContract.inputs["breaking-change-mode"].default,
|
|
62970
|
+
INPUT_BREAKING_BASELINE_SPEC_PATH: optionalInput(actionCore, "breaking-baseline-spec-path"),
|
|
62971
|
+
INPUT_BREAKING_RULES_PATH: optionalInput(actionCore, "breaking-rules-path") ?? customerPreviewActionContract.inputs["breaking-rules-path"].default,
|
|
62972
|
+
INPUT_BREAKING_TARGET_REF: optionalInput(actionCore, "breaking-target-ref"),
|
|
62973
|
+
INPUT_BREAKING_SUMMARY_PATH: optionalInput(actionCore, "breaking-summary-path"),
|
|
62974
|
+
INPUT_BREAKING_LOG_PATH: optionalInput(actionCore, "breaking-log-path"),
|
|
62296
62975
|
INPUT_POSTMAN_STACK: optionalInput(actionCore, "postman-stack") ?? customerPreviewActionContract.inputs["postman-stack"].default,
|
|
62297
62976
|
INPUT_GITHUB_TOKEN: githubToken,
|
|
62298
62977
|
INPUT_GH_FALLBACK_TOKEN: ghFallbackToken
|
|
@@ -62439,7 +63118,7 @@ function createAssetProjectName(inputs, releaseLabel) {
|
|
|
62439
63118
|
}
|
|
62440
63119
|
function readResourcesState() {
|
|
62441
63120
|
try {
|
|
62442
|
-
return (0, import_yaml3.parse)((0,
|
|
63121
|
+
return (0, import_yaml3.parse)((0, import_node_fs3.readFileSync)(".postman/resources.yaml", "utf8"));
|
|
62443
63122
|
} catch {
|
|
62444
63123
|
return null;
|
|
62445
63124
|
}
|
|
@@ -62585,6 +63264,7 @@ async function runBootstrap(inputs, dependencies) {
|
|
|
62585
63264
|
let previousSpecRollbackHash;
|
|
62586
63265
|
let detectedOpenapiVersion = "3.0";
|
|
62587
63266
|
let contractIndex;
|
|
63267
|
+
let sourceSpecContent = "";
|
|
62588
63268
|
const specContent = await runGroup(
|
|
62589
63269
|
dependencies.core,
|
|
62590
63270
|
"Preflight OpenAPI Contract",
|
|
@@ -62593,6 +63273,7 @@ async function runBootstrap(inputs, dependencies) {
|
|
|
62593
63273
|
fetchText: dependencies.specFetcher === fetch ? void 0 : async (url) => fetchSpecDocument(url, dependencies.specFetcher)
|
|
62594
63274
|
};
|
|
62595
63275
|
const loaded = inputs.specPath ? await loadOpenApiContractSpecFromPath(inputs.specPath, loaderOptions) : await loadOpenApiContractSpec(inputs.specUrl, loaderOptions);
|
|
63276
|
+
sourceSpecContent = loaded.content;
|
|
62596
63277
|
const document = normalizeSpecDocument(
|
|
62597
63278
|
loaded.bundledContent,
|
|
62598
63279
|
(msg) => dependencies.core.warning(msg)
|
|
@@ -62619,7 +63300,7 @@ async function runBootstrap(inputs, dependencies) {
|
|
|
62619
63300
|
previousRaw,
|
|
62620
63301
|
(msg) => dependencies.core.warning(`Previous spec normalization: ${msg}`)
|
|
62621
63302
|
);
|
|
62622
|
-
previousSpecRollbackHash = (0,
|
|
63303
|
+
previousSpecRollbackHash = (0, import_node_crypto2.createHash)("sha256").update(previousSpecContent).digest("hex");
|
|
62623
63304
|
const existingSpecType = normalizeSpecTypeFromContent(previousSpecContent);
|
|
62624
63305
|
if (existingSpecType !== incomingSpecType) {
|
|
62625
63306
|
throw new Error(
|
|
@@ -62633,6 +63314,38 @@ async function runBootstrap(inputs, dependencies) {
|
|
|
62633
63314
|
return document;
|
|
62634
63315
|
}
|
|
62635
63316
|
);
|
|
63317
|
+
const breakingChangeResult = await runGroup(
|
|
63318
|
+
dependencies.core,
|
|
63319
|
+
"OpenAPI Breaking Change Check",
|
|
63320
|
+
async () => (dependencies.openApiChanges ?? runOpenApiBreakingChangeCheck)(
|
|
63321
|
+
{
|
|
63322
|
+
baselineSpecPath: inputs.breakingBaselineSpecPath,
|
|
63323
|
+
currentSourceContent: sourceSpecContent,
|
|
63324
|
+
currentUploadContent: specContent,
|
|
63325
|
+
logPath: inputs.breakingLogPath,
|
|
63326
|
+
mode: inputs.breakingChangeMode,
|
|
63327
|
+
previousSpecContent,
|
|
63328
|
+
rulesPath: inputs.breakingRulesPath,
|
|
63329
|
+
specPath: inputs.specPath,
|
|
63330
|
+
summaryPath: inputs.breakingSummaryPath,
|
|
63331
|
+
targetRef: inputs.breakingTargetRef
|
|
63332
|
+
},
|
|
63333
|
+
{
|
|
63334
|
+
core: dependencies.core,
|
|
63335
|
+
env: process.env,
|
|
63336
|
+
exec: dependencies.exec
|
|
63337
|
+
}
|
|
63338
|
+
)
|
|
63339
|
+
);
|
|
63340
|
+
outputs["breaking-change-status"] = breakingChangeResult.status;
|
|
63341
|
+
outputs["breaking-change-summary-json"] = createBreakingChangeSummaryJson(breakingChangeResult);
|
|
63342
|
+
if (breakingChangeResult.status === "failed") {
|
|
63343
|
+
dependencies.core.setOutput("breaking-change-status", outputs["breaking-change-status"]);
|
|
63344
|
+
dependencies.core.setOutput("breaking-change-summary-json", outputs["breaking-change-summary-json"]);
|
|
63345
|
+
throw new Error(
|
|
63346
|
+
`OpenAPI breaking-change check failed: ${breakingChangeResult.message || "breaking changes detected"}`
|
|
63347
|
+
);
|
|
63348
|
+
}
|
|
62636
63349
|
let explicitWorkspaceId = inputs.workspaceId;
|
|
62637
63350
|
if (!explicitWorkspaceId && resourcesState?.workspace?.id) {
|
|
62638
63351
|
explicitWorkspaceId = resourcesState.workspace.id;
|
|
@@ -62733,6 +63446,13 @@ For CLI usage, pass --workspace-team-id <id> or export POSTMAN_WORKSPACE_TEAM_ID
|
|
|
62733
63446
|
async () => dependencies.postman.createWorkspace(workspaceName, aboutText, workspaceTeamId)
|
|
62734
63447
|
);
|
|
62735
63448
|
workspaceId = workspace.id;
|
|
63449
|
+
} else {
|
|
63450
|
+
const visibility = await dependencies.postman.getWorkspaceVisibility(workspaceId);
|
|
63451
|
+
if (visibility && visibility !== "team") {
|
|
63452
|
+
dependencies.core.warning(
|
|
63453
|
+
`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.`
|
|
63454
|
+
);
|
|
63455
|
+
}
|
|
62736
63456
|
}
|
|
62737
63457
|
outputs["workspace-id"] = workspaceId || "";
|
|
62738
63458
|
outputs["workspace-url"] = `https://go.postman.co/workspace/${workspaceId}`;
|