@blaaiz/docs-core 0.4.0 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-JHN5XQPU.js → chunk-2GUUVNTP.js} +226 -31
- package/dist/chunk-2GUUVNTP.js.map +1 -0
- package/dist/{chunk-ZKOOKLZ3.js → chunk-6H6OB7YP.js} +17 -2
- package/dist/chunk-6H6OB7YP.js.map +1 -0
- package/dist/generator.cjs +204 -30
- package/dist/generator.cjs.map +1 -1
- package/dist/generator.d.cts +24 -0
- package/dist/generator.d.ts +24 -0
- package/dist/generator.js +179 -22
- package/dist/generator.js.map +1 -1
- package/dist/index.cjs +228 -28
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +267 -8
- package/dist/index.d.ts +267 -8
- package/dist/index.js +1 -1
- package/dist/{navigation-CGqFIPlP.d.cts → navigation-DvgyWSZ4.d.cts} +22 -1
- package/dist/{navigation-CGqFIPlP.d.ts → navigation-DvgyWSZ4.d.ts} +22 -1
- package/dist/ui/api-try-it.cjs +15 -0
- package/dist/ui/api-try-it.cjs.map +1 -1
- package/dist/ui/api-try-it.js +1 -1
- package/dist/ui/ask-ai.cjs +26 -6
- package/dist/ui/ask-ai.cjs.map +1 -1
- package/dist/ui/ask-ai.d.cts +6 -1
- package/dist/ui/ask-ai.d.ts +6 -1
- package/dist/ui/ask-ai.js +26 -6
- package/dist/ui/ask-ai.js.map +1 -1
- package/dist/ui/copy-page.cjs +15 -0
- package/dist/ui/copy-page.cjs.map +1 -1
- package/dist/ui/copy-page.js +1 -1
- package/dist/ui.cjs +77 -6
- package/dist/ui.cjs.map +1 -1
- package/dist/ui.d.cts +99 -8
- package/dist/ui.d.ts +99 -8
- package/dist/ui.js +62 -8
- package/dist/ui.js.map +1 -1
- package/package.json +1 -1
- package/skills/SKILL.md +73 -27
- package/styles/api-reference.css +45 -2
- package/styles/ask-ai.css +28 -0
- package/styles/docs.css +96 -1
- package/styles/home.css +34 -1
- package/dist/chunk-JHN5XQPU.js.map +0 -1
- package/dist/chunk-ZKOOKLZ3.js.map +0 -1
|
@@ -1361,6 +1361,22 @@ function validateFeatures(value) {
|
|
|
1361
1361
|
}
|
|
1362
1362
|
optionalBoolean(features["copyPage"], "features.copyPage");
|
|
1363
1363
|
}
|
|
1364
|
+
function validateNavbarAction(value, field) {
|
|
1365
|
+
const action = optionalObject(value, field);
|
|
1366
|
+
if (action === void 0) {
|
|
1367
|
+
return;
|
|
1368
|
+
}
|
|
1369
|
+
requireString(action["text"], `${field}.text`, "Example: 'Dashboard'.");
|
|
1370
|
+
requireString(action["href"], `${field}.href`, "Example: 'https://app.example.com'.");
|
|
1371
|
+
}
|
|
1372
|
+
function validateNavbar(value) {
|
|
1373
|
+
const navbar = optionalObject(value, "navbar");
|
|
1374
|
+
if (navbar === void 0) {
|
|
1375
|
+
return;
|
|
1376
|
+
}
|
|
1377
|
+
validateNavbarAction(navbar["primary"], "navbar.primary");
|
|
1378
|
+
validateNavbarAction(navbar["secondary"], "navbar.secondary");
|
|
1379
|
+
}
|
|
1364
1380
|
function validateSeo(value) {
|
|
1365
1381
|
const seo = optionalObject(value, "seo");
|
|
1366
1382
|
if (seo === void 0) {
|
|
@@ -1411,6 +1427,7 @@ function validateDocsConfig(config) {
|
|
|
1411
1427
|
validateTheme(config["theme"]);
|
|
1412
1428
|
validateAuth(config["auth"]);
|
|
1413
1429
|
validateProxy(config["proxy"]);
|
|
1430
|
+
validateNavbar(config["navbar"]);
|
|
1414
1431
|
validateFeatures(config["features"]);
|
|
1415
1432
|
validateSeo(config["seo"]);
|
|
1416
1433
|
if (config["ai"] !== void 0) {
|
|
@@ -1458,6 +1475,90 @@ function buildThemeCss(theme) {
|
|
|
1458
1475
|
return blocks.join("\n");
|
|
1459
1476
|
}
|
|
1460
1477
|
|
|
1478
|
+
// src/core/redirects.ts
|
|
1479
|
+
function redirectTarget(url, redirects) {
|
|
1480
|
+
const { pathname } = url;
|
|
1481
|
+
const markdown = pathname.endsWith(".md");
|
|
1482
|
+
const page = markdown ? pathname.slice(0, -3) : pathname;
|
|
1483
|
+
const destination = redirects[page];
|
|
1484
|
+
if (destination === void 0) {
|
|
1485
|
+
return null;
|
|
1486
|
+
}
|
|
1487
|
+
const target = new URL(url);
|
|
1488
|
+
target.pathname = markdown ? `${destination}.md` : destination;
|
|
1489
|
+
return target;
|
|
1490
|
+
}
|
|
1491
|
+
|
|
1492
|
+
// src/core/llms-txt.ts
|
|
1493
|
+
function buildLlmsTxt(pages, options) {
|
|
1494
|
+
const origin = options.origin?.replace(/\/$/, "") ?? "";
|
|
1495
|
+
const lines = [`# ${options.name}`];
|
|
1496
|
+
if (options.description !== void 0 && options.description !== "") {
|
|
1497
|
+
lines.push("", `> ${options.description}`);
|
|
1498
|
+
}
|
|
1499
|
+
lines.push("", "## Docs", "");
|
|
1500
|
+
for (const page of pages) {
|
|
1501
|
+
const link = `[${page.title}](${origin}${page.url}.md)`;
|
|
1502
|
+
lines.push(
|
|
1503
|
+
page.description === void 0 || page.description === "" ? `- ${link}` : `- ${link}: ${page.description}`
|
|
1504
|
+
);
|
|
1505
|
+
}
|
|
1506
|
+
lines.push("");
|
|
1507
|
+
return lines.join("\n");
|
|
1508
|
+
}
|
|
1509
|
+
|
|
1510
|
+
// src/core/code-samples.ts
|
|
1511
|
+
function singleQuote(value) {
|
|
1512
|
+
return `'${value.replaceAll("'", "'\\''")}'`;
|
|
1513
|
+
}
|
|
1514
|
+
function isRecord(value) {
|
|
1515
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
1516
|
+
}
|
|
1517
|
+
function bodyToString(body, mediaType) {
|
|
1518
|
+
if (typeof body === "string") {
|
|
1519
|
+
return body;
|
|
1520
|
+
}
|
|
1521
|
+
if (mediaType === "application/x-www-form-urlencoded" && isRecord(body)) {
|
|
1522
|
+
const params = new URLSearchParams();
|
|
1523
|
+
for (const [key, value] of Object.entries(body)) {
|
|
1524
|
+
if (value === void 0 || value === null) {
|
|
1525
|
+
continue;
|
|
1526
|
+
}
|
|
1527
|
+
const encoded = typeof value === "string" || typeof value === "number" || typeof value === "boolean" ? String(value) : JSON.stringify(value);
|
|
1528
|
+
params.set(key, encoded);
|
|
1529
|
+
}
|
|
1530
|
+
return params.toString();
|
|
1531
|
+
}
|
|
1532
|
+
if (mediaType === "application/x-ndjson" && Array.isArray(body)) {
|
|
1533
|
+
return body.map((entry) => JSON.stringify(entry)).join("\n");
|
|
1534
|
+
}
|
|
1535
|
+
return JSON.stringify(body, null, 2);
|
|
1536
|
+
}
|
|
1537
|
+
var curlCodeUsage = {
|
|
1538
|
+
label: "cURL",
|
|
1539
|
+
lang: "bash",
|
|
1540
|
+
generate(data) {
|
|
1541
|
+
const lines = [`curl --request ${data.method.toUpperCase()}`, `--url ${singleQuote(data.url)}`];
|
|
1542
|
+
for (const [name, param] of Object.entries(data.header ?? {})) {
|
|
1543
|
+
lines.push(`--header ${singleQuote(`${name}: ${param.value}`)}`);
|
|
1544
|
+
}
|
|
1545
|
+
for (const [name, param] of Object.entries(data.cookie ?? {})) {
|
|
1546
|
+
lines.push(`--cookie ${singleQuote(`${name}=${param.value}`)}`);
|
|
1547
|
+
}
|
|
1548
|
+
if (isRecord(data.body) && data.bodyMediaType === "multipart/form-data") {
|
|
1549
|
+
for (const [key, value] of Object.entries(data.body)) {
|
|
1550
|
+
lines.push(
|
|
1551
|
+
`--form ${singleQuote(`${key}=${typeof value === "string" ? value : JSON.stringify(value)}`)}`
|
|
1552
|
+
);
|
|
1553
|
+
}
|
|
1554
|
+
} else if (data.body !== void 0 && data.body !== null && data.bodyMediaType !== void 0) {
|
|
1555
|
+
lines.push(`--header ${singleQuote(`Content-Type: ${data.bodyMediaType}`)}`);
|
|
1556
|
+
lines.push(`--data ${singleQuote(bodyToString(data.body, data.bodyMediaType))}`);
|
|
1557
|
+
}
|
|
1558
|
+
return lines.map((line, i) => i === 0 ? line : ` ${line}`).join(" \\\n");
|
|
1559
|
+
}
|
|
1560
|
+
};
|
|
1561
|
+
|
|
1461
1562
|
// src/core/seo.ts
|
|
1462
1563
|
function trimTrailingSlash(value) {
|
|
1463
1564
|
return value.replace(/\/+$/, "");
|
|
@@ -1560,12 +1661,13 @@ function firstDocFile(items) {
|
|
|
1560
1661
|
}
|
|
1561
1662
|
function planDocsTree(navigation, options = {}) {
|
|
1562
1663
|
const apiDir = options.apiDir ?? "api";
|
|
1664
|
+
const headings = (options.sidebar ?? "collapsible") === "headings";
|
|
1563
1665
|
const specs = [];
|
|
1564
1666
|
const apiPages = [];
|
|
1565
1667
|
const apiGroups = [];
|
|
1566
1668
|
const metas = [];
|
|
1567
1669
|
const rootPages = [];
|
|
1568
|
-
const
|
|
1670
|
+
const apiDocLinks = [];
|
|
1569
1671
|
const apiTabs = navigation.filter((tab) => hasOpenApi(tab.items));
|
|
1570
1672
|
const soleApiTab = apiTabs.length === 1;
|
|
1571
1673
|
for (const tab of navigation) {
|
|
@@ -1576,7 +1678,7 @@ function planDocsTree(navigation, options = {}) {
|
|
|
1576
1678
|
planDocTab(tab);
|
|
1577
1679
|
}
|
|
1578
1680
|
metas.unshift({ path: "meta.json", content: { pages: rootPages } });
|
|
1579
|
-
return { specs, apiPages, apiGroups, metas,
|
|
1681
|
+
return { specs, apiPages, apiGroups, metas, apiDocLinks };
|
|
1580
1682
|
function planApiTab(tab) {
|
|
1581
1683
|
const tabDir = soleApiTab ? apiDir : slugify(tab.title);
|
|
1582
1684
|
rootPages.push(tabDir);
|
|
@@ -1607,7 +1709,7 @@ function planDocsTree(navigation, options = {}) {
|
|
|
1607
1709
|
const at = apiGroups.length;
|
|
1608
1710
|
const sub = planApiItems(item.items, childDir);
|
|
1609
1711
|
apiGroups.splice(at, 0, { dir: childDir, title: item.title, children: sub });
|
|
1610
|
-
children.push({ order, folder });
|
|
1712
|
+
children.push({ order, folder, title: item.title });
|
|
1611
1713
|
order += 1;
|
|
1612
1714
|
continue;
|
|
1613
1715
|
}
|
|
@@ -1619,7 +1721,8 @@ function planDocsTree(navigation, options = {}) {
|
|
|
1619
1721
|
order += 1;
|
|
1620
1722
|
continue;
|
|
1621
1723
|
}
|
|
1622
|
-
|
|
1724
|
+
apiDocLinks.push({ file: item.file, dir, order });
|
|
1725
|
+
order += 1;
|
|
1623
1726
|
}
|
|
1624
1727
|
return children;
|
|
1625
1728
|
}
|
|
@@ -1644,11 +1747,11 @@ function planDocsTree(navigation, options = {}) {
|
|
|
1644
1747
|
title: tab.title,
|
|
1645
1748
|
root: true,
|
|
1646
1749
|
...tab.icon ? { icon: tab.icon } : {},
|
|
1647
|
-
pages: planDocItems(tab.items, tabDir)
|
|
1750
|
+
pages: planDocItems(tab.items, tabDir, true)
|
|
1648
1751
|
}
|
|
1649
1752
|
});
|
|
1650
1753
|
}
|
|
1651
|
-
function planDocItems(items, dir) {
|
|
1754
|
+
function planDocItems(items, dir, tabLevel) {
|
|
1652
1755
|
const entries = [];
|
|
1653
1756
|
for (const item of items) {
|
|
1654
1757
|
if (item.kind === "doc") {
|
|
@@ -1663,10 +1766,18 @@ function planDocsTree(navigation, options = {}) {
|
|
|
1663
1766
|
continue;
|
|
1664
1767
|
}
|
|
1665
1768
|
if (groupDir === dir) {
|
|
1666
|
-
|
|
1769
|
+
if (headings) {
|
|
1770
|
+
entries.push(`---${item.title}---`);
|
|
1771
|
+
}
|
|
1772
|
+
entries.push(...planDocItems(item.items, dir, false));
|
|
1773
|
+
continue;
|
|
1774
|
+
}
|
|
1775
|
+
const folder = groupDir.slice(dir.length + 1);
|
|
1776
|
+
if (headings && tabLevel) {
|
|
1777
|
+
entries.push(`---${item.title}---`, `...${folder}`);
|
|
1667
1778
|
continue;
|
|
1668
1779
|
}
|
|
1669
|
-
entries.push(
|
|
1780
|
+
entries.push(folder);
|
|
1670
1781
|
}
|
|
1671
1782
|
return entries;
|
|
1672
1783
|
}
|
|
@@ -1681,7 +1792,14 @@ function planDocsTree(navigation, options = {}) {
|
|
|
1681
1792
|
}
|
|
1682
1793
|
metas.push({
|
|
1683
1794
|
path: `${groupDir}/meta.json`,
|
|
1684
|
-
content: {
|
|
1795
|
+
content: {
|
|
1796
|
+
title: group.title,
|
|
1797
|
+
// A nested group starts closed in the headings style, whatever the
|
|
1798
|
+
// site's defaultOpenLevel. On a tab-level group the flag is inert:
|
|
1799
|
+
// that folder is extracted, so no folder node renders it.
|
|
1800
|
+
...headings ? { defaultOpen: false } : {},
|
|
1801
|
+
pages: planDocItems(group.items, groupDir, false)
|
|
1802
|
+
}
|
|
1685
1803
|
});
|
|
1686
1804
|
return groupDir;
|
|
1687
1805
|
}
|
|
@@ -2114,10 +2232,67 @@ ${description ? `${description}
|
|
|
2114
2232
|
` : ""}${cleanBody(trimmedBody)}
|
|
2115
2233
|
`;
|
|
2116
2234
|
}
|
|
2235
|
+
function operationHead(operation) {
|
|
2236
|
+
let title;
|
|
2237
|
+
let description;
|
|
2238
|
+
try {
|
|
2239
|
+
const parsed = JSON.parse(operation.source);
|
|
2240
|
+
const exact = parsed.paths?.[operation.route]?.[operation.method.toLowerCase()];
|
|
2241
|
+
const first = Object.values(parsed.paths ?? {}).flatMap((item) => Object.values(item))[0];
|
|
2242
|
+
const named = exact ?? first;
|
|
2243
|
+
title = named?.summary ?? parsed.info?.title;
|
|
2244
|
+
description = named?.description ?? parsed.info?.description;
|
|
2245
|
+
} catch {
|
|
2246
|
+
}
|
|
2247
|
+
const head = [`# ${title ?? "API operation"}`];
|
|
2248
|
+
if (description !== void 0 && description !== "") {
|
|
2249
|
+
head.push("", `> ${description.replace(/\n/g, "\n> ")}`);
|
|
2250
|
+
}
|
|
2251
|
+
return head.join("\n");
|
|
2252
|
+
}
|
|
2253
|
+
function fenceFor(source) {
|
|
2254
|
+
const longest = source.match(/`+/g)?.reduce((max, run) => Math.max(max, run.length), 0) ?? 0;
|
|
2255
|
+
return "`".repeat(Math.max(4, longest + 1));
|
|
2256
|
+
}
|
|
2117
2257
|
function createMarkdownRoute(options) {
|
|
2258
|
+
const requestOrigin = (request) => {
|
|
2259
|
+
const url = new URL(request.url);
|
|
2260
|
+
const proto = request.headers.get("x-forwarded-proto") ?? url.protocol.replace(/:$/, "");
|
|
2261
|
+
const host = request.headers.get("x-forwarded-host") ?? request.headers.get("host") ?? url.host;
|
|
2262
|
+
return `${proto}://${host}`;
|
|
2263
|
+
};
|
|
2264
|
+
const respond = (request, markdown) => {
|
|
2265
|
+
const preamble = options.llmsTxtPath === void 0 ? "" : [
|
|
2266
|
+
"> ## Documentation Index",
|
|
2267
|
+
`> Fetch the complete documentation index at: ${requestOrigin(request)}${options.llmsTxtPath}`,
|
|
2268
|
+
"> Use this file to discover all available pages before exploring further.",
|
|
2269
|
+
"",
|
|
2270
|
+
""
|
|
2271
|
+
].join("\n");
|
|
2272
|
+
return new Response(`${preamble}${markdown}`, {
|
|
2273
|
+
headers: { "content-type": "text/plain; charset=utf-8" }
|
|
2274
|
+
});
|
|
2275
|
+
};
|
|
2118
2276
|
return {
|
|
2119
|
-
async GET(
|
|
2277
|
+
async GET(request, context) {
|
|
2120
2278
|
const { slug } = await context.params;
|
|
2279
|
+
const operation = await options.loadOperationSource?.(slug);
|
|
2280
|
+
if (operation) {
|
|
2281
|
+
const fence = fenceFor(operation.source);
|
|
2282
|
+
return respond(
|
|
2283
|
+
request,
|
|
2284
|
+
[
|
|
2285
|
+
operationHead(operation),
|
|
2286
|
+
"",
|
|
2287
|
+
"## OpenAPI",
|
|
2288
|
+
"",
|
|
2289
|
+
`${fence}json ${operation.file} ${operation.method.toLowerCase()} ${operation.route}`,
|
|
2290
|
+
operation.source.trimEnd(),
|
|
2291
|
+
fence,
|
|
2292
|
+
""
|
|
2293
|
+
].join("\n")
|
|
2294
|
+
);
|
|
2295
|
+
}
|
|
2121
2296
|
const raw = await options.read(slug);
|
|
2122
2297
|
if (raw === null) {
|
|
2123
2298
|
return new Response("Not found", { status: 404 });
|
|
@@ -2131,12 +2306,32 @@ function createMarkdownRoute(options) {
|
|
|
2131
2306
|
if (markdown === null) {
|
|
2132
2307
|
return new Response("Not found", { status: 404 });
|
|
2133
2308
|
}
|
|
2134
|
-
return
|
|
2135
|
-
headers: { "content-type": "text/plain; charset=utf-8" }
|
|
2136
|
-
});
|
|
2309
|
+
return respond(request, markdown);
|
|
2137
2310
|
}
|
|
2138
2311
|
};
|
|
2139
2312
|
}
|
|
2313
|
+
function markdownRewriteTarget(url, options = {}) {
|
|
2314
|
+
const baseUrl = (options.baseUrl ?? "/docs").replace(/\/+$/, "");
|
|
2315
|
+
const markdownBase = (options.markdownBase ?? "/md").replace(/\/+$/, "");
|
|
2316
|
+
const { pathname } = url;
|
|
2317
|
+
if (!pathname.endsWith(".md") || pathname.includes("%")) {
|
|
2318
|
+
return null;
|
|
2319
|
+
}
|
|
2320
|
+
const page = pathname.slice(0, -3);
|
|
2321
|
+
if (page !== baseUrl && !page.startsWith(`${baseUrl}/`)) {
|
|
2322
|
+
return null;
|
|
2323
|
+
}
|
|
2324
|
+
if (page.endsWith("/") || page.includes("//")) {
|
|
2325
|
+
return null;
|
|
2326
|
+
}
|
|
2327
|
+
const target = new URL(url);
|
|
2328
|
+
target.pathname = `${markdownBase}${page.slice(baseUrl.length)}`;
|
|
2329
|
+
return target;
|
|
2330
|
+
}
|
|
2331
|
+
function isMarkdownRouteRequest(url, options = {}) {
|
|
2332
|
+
const markdownBase = options.markdownBase ?? "/md";
|
|
2333
|
+
return url.pathname === markdownBase || url.pathname.startsWith(`${markdownBase}/`);
|
|
2334
|
+
}
|
|
2140
2335
|
|
|
2141
2336
|
// src/core/auth/domains.ts
|
|
2142
2337
|
function isAllowedEmail(email, allowedDomains) {
|
|
@@ -2920,7 +3115,7 @@ var InvalidNavigationError = class extends Error {
|
|
|
2920
3115
|
this.name = "InvalidNavigationError";
|
|
2921
3116
|
}
|
|
2922
3117
|
};
|
|
2923
|
-
function
|
|
3118
|
+
function isRecord2(value) {
|
|
2924
3119
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
2925
3120
|
}
|
|
2926
3121
|
function parsePageString(entry) {
|
|
@@ -2943,7 +3138,7 @@ function parseItem(entry, path) {
|
|
|
2943
3138
|
if (typeof entry === "string") {
|
|
2944
3139
|
return parsePageString(entry);
|
|
2945
3140
|
}
|
|
2946
|
-
if (
|
|
3141
|
+
if (isRecord2(entry) && typeof entry["group"] === "string") {
|
|
2947
3142
|
return parseGroup(entry, path);
|
|
2948
3143
|
}
|
|
2949
3144
|
throw new InvalidNavigationError(
|
|
@@ -2968,7 +3163,7 @@ function parseGroup(group, path) {
|
|
|
2968
3163
|
};
|
|
2969
3164
|
}
|
|
2970
3165
|
function parseTab(tab, path) {
|
|
2971
|
-
if (!
|
|
3166
|
+
if (!isRecord2(tab) || typeof tab["tab"] !== "string") {
|
|
2972
3167
|
throw new InvalidNavigationError(`Tab at ${path} is missing a string "tab" title.`);
|
|
2973
3168
|
}
|
|
2974
3169
|
const items = tab["groups"] !== void 0 ? parseGroups(tab["groups"], `${path}.groups`) : parseItems(tab["pages"], `${path}.pages`);
|
|
@@ -2986,18 +3181,18 @@ function parseGroups(groups, path) {
|
|
|
2986
3181
|
}
|
|
2987
3182
|
return groups.map((group, index) => {
|
|
2988
3183
|
const groupPath = `${path}[${String(index)}]`;
|
|
2989
|
-
if (!
|
|
3184
|
+
if (!isRecord2(group)) {
|
|
2990
3185
|
throw new InvalidNavigationError(`Group at ${groupPath} must be an object.`);
|
|
2991
3186
|
}
|
|
2992
3187
|
return parseGroup(group, groupPath);
|
|
2993
3188
|
});
|
|
2994
3189
|
}
|
|
2995
3190
|
function parseNavigation(docsJson) {
|
|
2996
|
-
if (!
|
|
3191
|
+
if (!isRecord2(docsJson)) {
|
|
2997
3192
|
throw new InvalidNavigationError("docs.json must be an object.");
|
|
2998
3193
|
}
|
|
2999
3194
|
const navigation = docsJson["navigation"];
|
|
3000
|
-
if (!
|
|
3195
|
+
if (!isRecord2(navigation)) {
|
|
3001
3196
|
throw new InvalidNavigationError('docs.json must have a "navigation" object.');
|
|
3002
3197
|
}
|
|
3003
3198
|
const tabs = navigation["tabs"];
|
|
@@ -3014,7 +3209,7 @@ var OpenApiMergeError = class extends Error {
|
|
|
3014
3209
|
this.name = "OpenApiMergeError";
|
|
3015
3210
|
}
|
|
3016
3211
|
};
|
|
3017
|
-
function
|
|
3212
|
+
function isRecord3(value) {
|
|
3018
3213
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
3019
3214
|
}
|
|
3020
3215
|
function collectServers(inputs, override) {
|
|
@@ -3028,7 +3223,7 @@ function collectServers(inputs, override) {
|
|
|
3028
3223
|
continue;
|
|
3029
3224
|
}
|
|
3030
3225
|
for (const server of servers) {
|
|
3031
|
-
if (
|
|
3226
|
+
if (isRecord3(server) && typeof server["url"] === "string" && !byUrl.has(server["url"])) {
|
|
3032
3227
|
byUrl.set(server["url"], server);
|
|
3033
3228
|
}
|
|
3034
3229
|
}
|
|
@@ -3043,7 +3238,7 @@ function collectTags(inputs) {
|
|
|
3043
3238
|
continue;
|
|
3044
3239
|
}
|
|
3045
3240
|
for (const tag of tags) {
|
|
3046
|
-
if (
|
|
3241
|
+
if (isRecord3(tag) && typeof tag["name"] === "string" && !byName.has(tag["name"])) {
|
|
3047
3242
|
byName.set(tag["name"], tag);
|
|
3048
3243
|
}
|
|
3049
3244
|
}
|
|
@@ -3054,11 +3249,11 @@ function mergeComponents(inputs) {
|
|
|
3054
3249
|
const merged = {};
|
|
3055
3250
|
for (const doc of inputs) {
|
|
3056
3251
|
const components = doc["components"];
|
|
3057
|
-
if (!
|
|
3252
|
+
if (!isRecord3(components)) {
|
|
3058
3253
|
continue;
|
|
3059
3254
|
}
|
|
3060
3255
|
for (const [section, value] of Object.entries(components)) {
|
|
3061
|
-
if (!
|
|
3256
|
+
if (!isRecord3(value)) {
|
|
3062
3257
|
continue;
|
|
3063
3258
|
}
|
|
3064
3259
|
const target = merged[section] ?? (merged[section] = {});
|
|
@@ -3076,12 +3271,12 @@ function assemblePaths(inputs) {
|
|
|
3076
3271
|
const paths = {};
|
|
3077
3272
|
for (const doc of inputs) {
|
|
3078
3273
|
const docPaths = doc["paths"];
|
|
3079
|
-
if (!
|
|
3274
|
+
if (!isRecord3(docPaths)) {
|
|
3080
3275
|
throw new OpenApiMergeError('Each OpenAPI input must have a "paths" object.');
|
|
3081
3276
|
}
|
|
3082
3277
|
const docSecurity = doc["security"];
|
|
3083
3278
|
for (const [route, pathItem] of Object.entries(docPaths)) {
|
|
3084
|
-
if (!
|
|
3279
|
+
if (!isRecord3(pathItem)) {
|
|
3085
3280
|
throw new OpenApiMergeError(`Path item for "${route}" must be an object.`);
|
|
3086
3281
|
}
|
|
3087
3282
|
const target = paths[route] ?? (paths[route] = {});
|
|
@@ -3092,7 +3287,7 @@ function assemblePaths(inputs) {
|
|
|
3092
3287
|
);
|
|
3093
3288
|
}
|
|
3094
3289
|
let resolved = operation;
|
|
3095
|
-
if (HTTP_METHODS2.has(method.toLowerCase()) &&
|
|
3290
|
+
if (HTTP_METHODS2.has(method.toLowerCase()) && isRecord3(operation) && !("security" in operation) && Array.isArray(docSecurity)) {
|
|
3096
3291
|
resolved = { ...operation, security: docSecurity };
|
|
3097
3292
|
}
|
|
3098
3293
|
target[method] = resolved;
|
|
@@ -3103,7 +3298,7 @@ function assemblePaths(inputs) {
|
|
|
3103
3298
|
}
|
|
3104
3299
|
function mergeOpenApiDocuments(inputs, options) {
|
|
3105
3300
|
const records = inputs.map((input, index) => {
|
|
3106
|
-
if (!
|
|
3301
|
+
if (!isRecord3(input)) {
|
|
3107
3302
|
throw new OpenApiMergeError(`OpenAPI input at index ${String(index)} must be an object.`);
|
|
3108
3303
|
}
|
|
3109
3304
|
return input;
|
|
@@ -3118,6 +3313,6 @@ function mergeOpenApiDocuments(inputs, options) {
|
|
|
3118
3313
|
};
|
|
3119
3314
|
}
|
|
3120
3315
|
|
|
3121
|
-
export { AI_PROVIDER_MODELS, AI_PROVIDER_NAMES, AiConfigError, DocsConfigError, InvalidNavigationError, OpenApiMergeError, ProxyTargetError, SESSION_COOKIE, assertAllowedTarget, buildMetadata, buildRobots, buildSearchIndex, buildSessionCookie, buildSitemap, buildThemeCss, clearSessionCookie, createAskAiRoute, createAuthGate, createEmailSignIn, createGoogleAuth, createMarkdownRoute, createSecretSignIn, createSignOut, createSiteAuth, createTryItProxy, createTryItProxyRoute, defineDocsConfig, isAllowedEmail, mdxToMarkdown, mergeOpenApiDocuments, openApiOperationToMarkdown, parseNavigation, planDocsTree, readCookie, resolveAiConfig, searchIndex, signSession, unwrapProxyTarget, validateDocsConfig, verifySession };
|
|
3122
|
-
//# sourceMappingURL=chunk-
|
|
3123
|
-
//# sourceMappingURL=chunk-
|
|
3316
|
+
export { AI_PROVIDER_MODELS, AI_PROVIDER_NAMES, AiConfigError, DocsConfigError, InvalidNavigationError, OpenApiMergeError, ProxyTargetError, SESSION_COOKIE, assertAllowedTarget, buildLlmsTxt, buildMetadata, buildRobots, buildSearchIndex, buildSessionCookie, buildSitemap, buildThemeCss, clearSessionCookie, createAskAiRoute, createAuthGate, createEmailSignIn, createGoogleAuth, createMarkdownRoute, createSecretSignIn, createSignOut, createSiteAuth, createTryItProxy, createTryItProxyRoute, curlCodeUsage, defineDocsConfig, hasOpenApi, isAllowedEmail, isMarkdownRouteRequest, markdownRewriteTarget, mdxToMarkdown, mergeOpenApiDocuments, openApiOperationToMarkdown, parseNavigation, planDocsTree, readCookie, redirectTarget, resolveAiConfig, searchIndex, signSession, unwrapProxyTarget, validateDocsConfig, verifySession };
|
|
3317
|
+
//# sourceMappingURL=chunk-2GUUVNTP.js.map
|
|
3318
|
+
//# sourceMappingURL=chunk-2GUUVNTP.js.map
|