@farming-labs/docs 0.2.117 → 0.2.119
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/{agent-DGNTD-N6.mjs → agent-CYk2DxY7.mjs} +4 -4
- package/dist/{agent-CEZCaYto.mjs → agent-DkAidqtV.mjs} +23 -9
- package/dist/{agent-evals-CmeTjDMC.mjs → agent-evals-BLNLvXbG.mjs} +4 -4
- package/dist/{agent-export-DIKwVWYN.mjs → agent-export-Cxljt6RP.mjs} +16 -12
- package/dist/{agent-feedback-evaluations-DQCTFegz.mjs → agent-feedback-evaluations-CcMGlgsO.mjs} +1 -1
- package/dist/agent-skills-bundle.d.mts +1 -1
- package/dist/{agent-skills-progressive-disclosure-BDSjGGFd.mjs → agent-skills-progressive-disclosure-PjPtTYL-.mjs} +1 -1
- package/dist/{agent-skills-server-Ddm90WL6.mjs → agent-skills-server-BC7md56k.mjs} +224 -46
- package/dist/{agent-skills-server-BWRJjIQG.d.mts → agent-skills-server-CTNWr23x.d.mts} +2 -2
- package/dist/agent-skills-vite.d.mts +3 -3
- package/dist/agent-skills-vite.mjs +2 -2
- package/dist/{agents-l8RtkFim.mjs → agents-jtn256sz.mjs} +15 -11
- package/dist/{analytics-R9c-Md4b.d.mts → analytics-B8RZiKUt.d.mts} +1 -1
- package/dist/{analytics-CqfcIBdg.mjs → analytics-p8Vhhu2P.mjs} +1 -1
- package/dist/{api-reference-0XdEWya8.mjs → api-reference-By_LokQ-.mjs} +1 -1
- package/dist/{authoring-CvsCmYuq.mjs → authoring-C2ymvYWl.mjs} +8 -6
- package/dist/{authoring-mcp-C35lj3cI.mjs → authoring-mcp-CiCUQe3o.mjs} +1 -1
- package/dist/browser.d.mts +4 -4
- package/dist/browser.mjs +7 -4
- package/dist/cli/index.mjs +38 -38
- package/dist/client/react.d.mts +1 -1
- package/dist/client/react.mjs +1 -1
- package/dist/{cloud-DtmNQJg2.mjs → cloud-6eKrlmKd.mjs} +3 -3
- package/dist/{cloud-ask-ai-DLyrydIR.d.mts → cloud-ask-ai-BOahlsIZ.d.mts} +1 -1
- package/dist/{cloud-ask-ai-BDtBbbZZ.mjs → cloud-ask-ai-BqKhjpS5.mjs} +8 -7
- package/dist/{codeblocks-DEcqNXve.mjs → codeblocks-CHpgAwY-.mjs} +1 -1
- package/dist/{content-change-hydration-BWJNUIot.d.mts → content-change-hydration-CvHJadhE.d.mts} +3 -3
- package/dist/{dev-Df77AKR1.mjs → dev-Bnn-NUNa.mjs} +2 -2
- package/dist/docs-cloud-server.d.mts +2 -2
- package/dist/docs-cloud-server.mjs +3 -2
- package/dist/{doctor-zNmt9s6j.mjs → doctor-CUMgbglt.mjs} +21 -17
- package/dist/{downgrade-C6DSsOO9.mjs → downgrade-CHMta85e.mjs} +2 -2
- package/dist/{feedback-evals-CYuS2wTu.mjs → feedback-evals-DMilg9pY.mjs} +1 -1
- package/dist/{golden-evaluations-B1QDOzYj.mjs → golden-evaluations-CLUViycJ.mjs} +2 -2
- package/dist/http-body-DkAPk6D5.mjs +64 -0
- package/dist/index.d.mts +26 -43
- package/dist/index.mjs +13 -13
- package/dist/{init-BXKzipSS.mjs → init-K0LmXDZ5.mjs} +3 -3
- package/dist/markdown-rendering.mjs +1 -1
- package/dist/{mcp-Bj3ZoEtt.mjs → mcp-Bvha6_mG.mjs} +16 -12
- package/dist/mcp.d.mts +3 -3
- package/dist/mcp.mjs +79 -22
- package/dist/{metadata-7htr-Xj_.mjs → metadata-BOHn0Y5K.mjs} +1 -1
- package/dist/{openapi-diff-DKW3xkQU.mjs → openapi-diff-BOESBfnP.mjs} +6 -5
- package/dist/{openapi-mcp-UF4Cx885.mjs → openapi-mcp-BIOTLiA7.mjs} +4 -316
- package/dist/{openapi-sdk-DqRHPsCb.mjs → openapi-sdk-DJutz2AC.mjs} +6 -5
- package/dist/{openapi-source-CiKbUK71.mjs → openapi-source-CiX3hwFp.mjs} +1 -1
- package/dist/{package-version-CTkii52k.mjs → package-version-HJhYeq4M.mjs} +1 -1
- package/dist/{prompt-references-Cficetgk.mjs → prompt-references-DMgbu_dz.mjs} +20 -4
- package/dist/{sitemap-server-C4bpuoLi.mjs → prompt-utils-B5g-bv7o.mjs} +1 -17
- package/dist/{retrieval-digest-PD4fFy7P.d.mts → retrieval-digest-DLAQsQmx.d.mts} +2 -109
- package/dist/{review-CcplK9Hj.mjs → review-C6EmbV0l.mjs} +13 -11
- package/dist/{robots-BPYWIGqD.mjs → robots-BYJAVeI6.mjs} +2 -2
- package/dist/{robots-D4T3zZr_.mjs → robots-DteZB8vl.mjs} +7 -6
- package/dist/runtime.d.mts +5 -0
- package/dist/runtime.mjs +12 -0
- package/dist/{search-BNmlDQJ2.mjs → search-DKcdZgGx.mjs} +16 -12
- package/dist/server.d.mts +8 -116
- package/dist/server.mjs +15 -12
- package/dist/sidebar-C2LKcU7n.d.mts +63 -0
- package/dist/sidebar-CFHBj29f.mjs +421 -0
- package/dist/{sitemap-Bc4LkIcm.mjs → sitemap-CBQoERNz.mjs} +15 -11
- package/dist/sitemap-DafdOrxK.d.mts +110 -0
- package/dist/sitemap-server-C9r22_06.d.mts +114 -0
- package/dist/sitemap-server-Lg3YhUx4.mjs +18 -0
- package/dist/{skills-B6wl1bUL.mjs → skills-a90P31sJ.mjs} +15 -11
- package/dist/{standards-discovery-C1RLKwV9.d.mts → standards-discovery-1fiUVDAo.d.mts} +1 -1
- package/dist/{standards-discovery-Bpz90VYq.mjs → standards-discovery-sSEojU80.mjs} +1 -1
- package/dist/{types-Dkl2DUfp.d.mts → types-BncG8J3g.d.mts} +1 -1
- package/dist/{upgrade-8zStRidw.mjs → upgrade-DlQMOFV1.mjs} +2 -2
- package/package.json +8 -3
- package/dist/audience-exposure-DVsfT9Sx.mjs +0 -8
- package/dist/sidebar-3W51s2sF.mjs +0 -73
- package/dist/sidebar-CGbvEPTX.d.mts +0 -15
- /package/dist/{audience-exposure-BAjHjaTT.d.mts → audience-exposure-DBrFWULA.d.mts} +0 -0
- /package/dist/{cloud-analytics-Ci1yiwD8.mjs → cloud-analytics-D14HplI7.mjs} +0 -0
- /package/dist/{config-BnUOoj07.mjs → config-BZnKAj_Y.mjs} +0 -0
- /package/dist/{errors-BkS29NUA.mjs → errors-BtnVLhNF.mjs} +0 -0
- /package/dist/{feedback-CNsQP2jY.mjs → feedback-DL4T5oIO.mjs} +0 -0
- /package/dist/{markdown-sections-BKy4labo.mjs → markdown-sections-9Oxr33b-.mjs} +0 -0
- /package/dist/{openapi-anOaQn9o.mjs → openapi-CfCzX_a1.mjs} +0 -0
- /package/dist/{propose-ZH_mGMY_.mjs → propose-JmUv_BTt.mjs} +0 -0
- /package/dist/{retrieval-digest-B-SgtXKK.mjs → retrieval-digest-CT-eIEcp.mjs} +0 -0
- /package/dist/{templates-BiORflC3.mjs → templates-BuQ8YsGv.mjs} +0 -0
- /package/dist/{utils-c9arebCi.mjs → utils-C7KDrPpA.mjs} +0 -0
|
@@ -0,0 +1,421 @@
|
|
|
1
|
+
import { $ as isDocsSkillRequest, K as isDocsAgentDiscoveryRequest, St as resolveDocsSkillFormat, Xt as resolveDocsContentChangesConfig, Yt as isDocsContentChangesRequest, dt as resolveDocsAgentFeedbackRequest, ft as resolveDocsAgentsFormat, mt as resolveDocsLlmsTxtRequest, q as isDocsAgentsRequest, ut as resolveDocsAgentFeedbackConfig, vt as resolveDocsMarkdownRequest } from "./agent-DkAidqtV.mjs";
|
|
2
|
+
|
|
3
|
+
//#region src/telemetry.ts
|
|
4
|
+
const DOCS_PACKAGE_NAME = "@farming-labs/docs";
|
|
5
|
+
const DOCS_PACKAGE_VERSION = "0.2.25";
|
|
6
|
+
const DEFAULT_DOCS_TELEMETRY_ENDPOINT = "https://docs.farming-labs.dev/api/telemetry/events";
|
|
7
|
+
const PROJECT_TELEMETRY_CACHE_TTL_MS = 1440 * 60 * 1e3;
|
|
8
|
+
const PROJECT_TELEMETRY_CACHE_MAX_KEYS = 256;
|
|
9
|
+
function getRuntimeEnv() {
|
|
10
|
+
if (typeof process === "undefined" || !process.env) return;
|
|
11
|
+
return process.env;
|
|
12
|
+
}
|
|
13
|
+
function readRuntimeEnv(name) {
|
|
14
|
+
const value = getRuntimeEnv()?.[name]?.trim();
|
|
15
|
+
return value ? value : void 0;
|
|
16
|
+
}
|
|
17
|
+
function isTruthyEnv(value) {
|
|
18
|
+
return /^(1|true|yes|on)$/i.test(value ?? "");
|
|
19
|
+
}
|
|
20
|
+
function isFalsyEnv(value) {
|
|
21
|
+
return /^(0|false|no|off)$/i.test(value ?? "");
|
|
22
|
+
}
|
|
23
|
+
function isBrowserRuntime() {
|
|
24
|
+
return typeof window !== "undefined" && typeof document !== "undefined";
|
|
25
|
+
}
|
|
26
|
+
function isProductionTelemetryRuntime() {
|
|
27
|
+
if (isBrowserRuntime()) return false;
|
|
28
|
+
const env = getRuntimeEnv();
|
|
29
|
+
if (!env) return true;
|
|
30
|
+
if (env.NODE_ENV === "test") return false;
|
|
31
|
+
if (env.VERCEL_ENV === "production") return true;
|
|
32
|
+
if (env.CONTEXT === "production" && isTruthyEnv(env.NETLIFY)) return true;
|
|
33
|
+
if (isTruthyEnv(env.CF_PAGES)) return true;
|
|
34
|
+
if (env.RENDER_SERVICE_ID || env.FLY_APP_NAME || env.RAILWAY_ENVIRONMENT) return true;
|
|
35
|
+
return env.NODE_ENV === "production";
|
|
36
|
+
}
|
|
37
|
+
function resolveDocsTelemetryConfig(telemetry) {
|
|
38
|
+
const envToggle = readRuntimeEnv("DOCS_TELEMETRY");
|
|
39
|
+
const envDisabled = readRuntimeEnv("DOCS_TELEMETRY_DISABLED");
|
|
40
|
+
if (isFalsyEnv(envToggle) || isTruthyEnv(envDisabled) || telemetry === false) return { enabled: false };
|
|
41
|
+
const objectConfig = telemetry && typeof telemetry === "object" ? telemetry : void 0;
|
|
42
|
+
if (objectConfig?.enabled === false) return { enabled: false };
|
|
43
|
+
return {
|
|
44
|
+
enabled: telemetry === true || objectConfig?.enabled === true || isTruthyEnv(envToggle) || isProductionTelemetryRuntime(),
|
|
45
|
+
endpoint: objectConfig?.endpoint?.trim() || readRuntimeEnv("DOCS_TELEMETRY_ENDPOINT") || DEFAULT_DOCS_TELEMETRY_ENDPOINT
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
function readRequestOrigin(request) {
|
|
49
|
+
if (!request?.url) return void 0;
|
|
50
|
+
try {
|
|
51
|
+
return new URL(request.url).origin;
|
|
52
|
+
} catch {
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
/** Normalize an HTTP(S) telemetry site value to its origin. */
|
|
57
|
+
function normalizeDocsTelemetryOrigin(candidate) {
|
|
58
|
+
if (typeof candidate !== "string") return void 0;
|
|
59
|
+
const trimmed = candidate.trim();
|
|
60
|
+
if (!trimmed) return void 0;
|
|
61
|
+
try {
|
|
62
|
+
const hasScheme = /^[a-z][a-z\d+.-]*:(?!\d)/i.test(trimmed);
|
|
63
|
+
const url = new URL(hasScheme ? trimmed : `https://${trimmed}`);
|
|
64
|
+
if (url.protocol !== "http:" && url.protocol !== "https:") return void 0;
|
|
65
|
+
return url.origin;
|
|
66
|
+
} catch {
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
/** Return whether a telemetry origin points at a local development server. */
|
|
71
|
+
function isLocalDocsTelemetryOrigin(candidate) {
|
|
72
|
+
const origin = normalizeDocsTelemetryOrigin(candidate);
|
|
73
|
+
if (!origin) return false;
|
|
74
|
+
const hostname = new URL(origin).hostname.toLowerCase().replace(/^\[|\]$/g, "").replace(/\.+$/, "");
|
|
75
|
+
if ([
|
|
76
|
+
"localhost",
|
|
77
|
+
"localhost.localdomain",
|
|
78
|
+
"localhost6",
|
|
79
|
+
"localhost6.localdomain6",
|
|
80
|
+
"ip6-localhost",
|
|
81
|
+
"ip6-loopback"
|
|
82
|
+
].includes(hostname) || hostname.endsWith(".localhost")) return true;
|
|
83
|
+
if (hostname === "::" || hostname === "::1") return true;
|
|
84
|
+
const ipv4 = hostname.split(".").map((part) => Number(part));
|
|
85
|
+
if (ipv4.length === 4 && ipv4.every((part) => Number.isInteger(part) && part >= 0 && part <= 255)) return ipv4[0] === 127 || ipv4.every((part) => part === 0);
|
|
86
|
+
return /^::ffff:7f[0-9a-f]{2}:/.test(hostname) || hostname === "::ffff:0:0";
|
|
87
|
+
}
|
|
88
|
+
function isBlockedDocsTelemetryOrigin(candidate) {
|
|
89
|
+
if (candidate === void 0) return false;
|
|
90
|
+
return !normalizeDocsTelemetryOrigin(candidate) || isLocalDocsTelemetryOrigin(candidate);
|
|
91
|
+
}
|
|
92
|
+
function readDeploymentOrigin() {
|
|
93
|
+
const candidates = [
|
|
94
|
+
readRuntimeEnv("DOCS_SITE_URL"),
|
|
95
|
+
readRuntimeEnv("NEXT_PUBLIC_BASE_URL"),
|
|
96
|
+
readRuntimeEnv("NEXT_PUBLIC_SITE_URL"),
|
|
97
|
+
readRuntimeEnv("SITE_URL"),
|
|
98
|
+
readRuntimeEnv("URL"),
|
|
99
|
+
readRuntimeEnv("CF_PAGES_URL"),
|
|
100
|
+
readRuntimeEnv("VERCEL_PROJECT_PRODUCTION_URL"),
|
|
101
|
+
readRuntimeEnv("VERCEL_URL"),
|
|
102
|
+
readRuntimeEnv("DEPLOY_PRIME_URL")
|
|
103
|
+
];
|
|
104
|
+
for (const candidate of candidates) {
|
|
105
|
+
const origin = normalizeDocsTelemetryOrigin(candidate);
|
|
106
|
+
if (origin) return origin;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
function detectDeployment() {
|
|
110
|
+
const env = getRuntimeEnv();
|
|
111
|
+
if (!env) return void 0;
|
|
112
|
+
if (env.VERCEL || env.VERCEL_ENV) return {
|
|
113
|
+
provider: "vercel",
|
|
114
|
+
environment: env.VERCEL_ENV,
|
|
115
|
+
id: env.VERCEL_DEPLOYMENT_ID ?? env.VERCEL_GIT_COMMIT_SHA,
|
|
116
|
+
region: env.VERCEL_REGION
|
|
117
|
+
};
|
|
118
|
+
if (env.NETLIFY) return {
|
|
119
|
+
provider: "netlify",
|
|
120
|
+
environment: env.CONTEXT,
|
|
121
|
+
id: env.DEPLOY_ID ?? env.COMMIT_REF
|
|
122
|
+
};
|
|
123
|
+
if (env.CF_PAGES) return {
|
|
124
|
+
provider: "cloudflare-pages",
|
|
125
|
+
environment: env.CF_PAGES_BRANCH,
|
|
126
|
+
id: env.CF_PAGES_COMMIT_SHA
|
|
127
|
+
};
|
|
128
|
+
if (env.RENDER_SERVICE_ID) return {
|
|
129
|
+
provider: "render",
|
|
130
|
+
environment: env.RENDER_ENV,
|
|
131
|
+
id: env.RENDER_SERVICE_ID
|
|
132
|
+
};
|
|
133
|
+
if (env.FLY_APP_NAME) return {
|
|
134
|
+
provider: "fly",
|
|
135
|
+
environment: env.FLY_APP_NAME,
|
|
136
|
+
id: env.FLY_ALLOC_ID,
|
|
137
|
+
region: env.FLY_REGION
|
|
138
|
+
};
|
|
139
|
+
if (env.RAILWAY_ENVIRONMENT) return {
|
|
140
|
+
provider: "railway",
|
|
141
|
+
environment: env.RAILWAY_ENVIRONMENT,
|
|
142
|
+
id: env.RAILWAY_DEPLOYMENT_ID
|
|
143
|
+
};
|
|
144
|
+
return env.NODE_ENV === "production" ? { environment: "production" } : void 0;
|
|
145
|
+
}
|
|
146
|
+
function detectRuntime() {
|
|
147
|
+
if (typeof process !== "undefined" && process.versions?.node) return {
|
|
148
|
+
name: "node",
|
|
149
|
+
version: process.versions.node
|
|
150
|
+
};
|
|
151
|
+
if (typeof navigator !== "undefined" && navigator.userAgent) return { name: "web-standard" };
|
|
152
|
+
}
|
|
153
|
+
function isObjectConfigEnabled(value, defaultEnabled) {
|
|
154
|
+
if (value === false) return false;
|
|
155
|
+
if (value === true) return true;
|
|
156
|
+
if (value && typeof value === "object" && !Array.isArray(value)) {
|
|
157
|
+
const enabled = value.enabled;
|
|
158
|
+
return enabled === false ? false : defaultEnabled || enabled === true;
|
|
159
|
+
}
|
|
160
|
+
return defaultEnabled;
|
|
161
|
+
}
|
|
162
|
+
function hasObjectConfig(value) {
|
|
163
|
+
return Boolean(value && typeof value === "object" && !Array.isArray(value));
|
|
164
|
+
}
|
|
165
|
+
function getDocsTelemetryFeatures(config) {
|
|
166
|
+
const pageActions = config.pageActions;
|
|
167
|
+
const feedback = config.feedback;
|
|
168
|
+
return {
|
|
169
|
+
search: isObjectConfigEnabled(config.search, true),
|
|
170
|
+
contentChanges: resolveDocsContentChangesConfig(config.agent?.contentChanges, { staticExport: config.staticExport === true }).enabled,
|
|
171
|
+
ai: isObjectConfigEnabled(config.ai, false),
|
|
172
|
+
mcp: isObjectConfigEnabled(config.mcp, true),
|
|
173
|
+
llmsTxt: isObjectConfigEnabled(config.llmsTxt, true),
|
|
174
|
+
pageActions: hasObjectConfig(pageActions),
|
|
175
|
+
feedback: feedback === true || hasObjectConfig(feedback) && feedback.enabled !== false,
|
|
176
|
+
agentFeedback: feedback !== false && !(hasObjectConfig(feedback) && feedback.agent === false) && !(hasObjectConfig(feedback) && hasObjectConfig(feedback.agent) && feedback.agent.enabled === false),
|
|
177
|
+
sitemap: isObjectConfigEnabled(config.sitemap, true),
|
|
178
|
+
robots: isObjectConfigEnabled(config.robots, true),
|
|
179
|
+
apiReference: isObjectConfigEnabled(config.apiReference, false),
|
|
180
|
+
staticExport: config.staticExport === true,
|
|
181
|
+
changelog: isObjectConfigEnabled(config.changelog, false),
|
|
182
|
+
cloud: typeof config.cloud !== "undefined" && isObjectConfigEnabled(config.cloud, true),
|
|
183
|
+
review: isObjectConfigEnabled(config.review, true),
|
|
184
|
+
codeBlocksValidate: hasObjectConfig(config.codeBlocks) && Boolean(config.codeBlocks.validate)
|
|
185
|
+
};
|
|
186
|
+
}
|
|
187
|
+
function createDocsTelemetryEvent(config, input, context = {}) {
|
|
188
|
+
const telemetryConfig = config.telemetry && typeof config.telemetry === "object" ? config.telemetry : void 0;
|
|
189
|
+
const siteOriginCandidates = [
|
|
190
|
+
context.siteOrigin,
|
|
191
|
+
input.site?.origin,
|
|
192
|
+
telemetryConfig?.siteOrigin,
|
|
193
|
+
readRequestOrigin(context.request),
|
|
194
|
+
readDeploymentOrigin()
|
|
195
|
+
];
|
|
196
|
+
if (siteOriginCandidates.some(isBlockedDocsTelemetryOrigin)) return void 0;
|
|
197
|
+
const siteOrigin = siteOriginCandidates.map(normalizeDocsTelemetryOrigin).find((origin) => Boolean(origin));
|
|
198
|
+
const deployment = input.deployment ?? detectDeployment();
|
|
199
|
+
const properties = context.properties || input.properties ? {
|
|
200
|
+
...input.properties,
|
|
201
|
+
...context.properties
|
|
202
|
+
} : void 0;
|
|
203
|
+
return {
|
|
204
|
+
...input,
|
|
205
|
+
timestamp: input.timestamp ?? (/* @__PURE__ */ new Date()).toISOString(),
|
|
206
|
+
package: {
|
|
207
|
+
name: DOCS_PACKAGE_NAME,
|
|
208
|
+
version: DOCS_PACKAGE_VERSION,
|
|
209
|
+
...input.package
|
|
210
|
+
},
|
|
211
|
+
framework: input.framework ?? context.framework,
|
|
212
|
+
runtime: input.runtime ?? detectRuntime(),
|
|
213
|
+
site: siteOrigin ? { origin: siteOrigin } : input.site,
|
|
214
|
+
deployment,
|
|
215
|
+
features: input.features ?? getDocsTelemetryFeatures(config),
|
|
216
|
+
properties
|
|
217
|
+
};
|
|
218
|
+
}
|
|
219
|
+
function projectEventKey(event) {
|
|
220
|
+
return [
|
|
221
|
+
event.package.name,
|
|
222
|
+
event.package.version,
|
|
223
|
+
event.framework ?? "",
|
|
224
|
+
event.site?.origin ?? "",
|
|
225
|
+
event.deployment?.provider ?? "",
|
|
226
|
+
event.deployment?.environment ?? "",
|
|
227
|
+
event.deployment?.id ?? ""
|
|
228
|
+
].join("|");
|
|
229
|
+
}
|
|
230
|
+
function getSentProjectKeys() {
|
|
231
|
+
const globalValue = globalThis;
|
|
232
|
+
globalValue.__farmingLabsDocsTelemetryProjectKeys__ ??= /* @__PURE__ */ new Map();
|
|
233
|
+
return globalValue.__farmingLabsDocsTelemetryProjectKeys__;
|
|
234
|
+
}
|
|
235
|
+
function pruneSentProjectKeys(sent, now) {
|
|
236
|
+
for (const [key, expiresAt] of sent) if (expiresAt <= now) sent.delete(key);
|
|
237
|
+
while (sent.size >= PROJECT_TELEMETRY_CACHE_MAX_KEYS) {
|
|
238
|
+
const oldestKey = sent.keys().next().value;
|
|
239
|
+
if (!oldestKey) return;
|
|
240
|
+
sent.delete(oldestKey);
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
async function emitDocsTelemetryEvent(telemetry, event) {
|
|
244
|
+
const resolved = resolveDocsTelemetryConfig(telemetry);
|
|
245
|
+
const eventSiteOrigin = event.site?.origin;
|
|
246
|
+
const normalizedSiteOrigin = normalizeDocsTelemetryOrigin(eventSiteOrigin);
|
|
247
|
+
if (!resolved.enabled || !resolved.endpoint || typeof fetch !== "function" || eventSiteOrigin !== void 0 && (!normalizedSiteOrigin || isLocalDocsTelemetryOrigin(eventSiteOrigin))) return;
|
|
248
|
+
const eventToSend = normalizedSiteOrigin ? {
|
|
249
|
+
...event,
|
|
250
|
+
site: { origin: normalizedSiteOrigin }
|
|
251
|
+
} : event;
|
|
252
|
+
try {
|
|
253
|
+
const ingestKey = readRuntimeEnv("DOCS_TELEMETRY_INGEST_KEY");
|
|
254
|
+
const browserRequest = isBrowserRuntime() && !ingestKey;
|
|
255
|
+
const headers = { "content-type": browserRequest ? "text/plain;charset=UTF-8" : "application/json" };
|
|
256
|
+
if (ingestKey) headers["x-docs-telemetry-key"] = ingestKey;
|
|
257
|
+
await fetch(resolved.endpoint, {
|
|
258
|
+
method: "POST",
|
|
259
|
+
headers,
|
|
260
|
+
body: JSON.stringify({ event: eventToSend }),
|
|
261
|
+
keepalive: true,
|
|
262
|
+
...browserRequest ? {
|
|
263
|
+
credentials: "omit",
|
|
264
|
+
mode: "no-cors"
|
|
265
|
+
} : {}
|
|
266
|
+
});
|
|
267
|
+
} catch {}
|
|
268
|
+
}
|
|
269
|
+
function emitDocsTelemetryProjectEvent(config, context = {}) {
|
|
270
|
+
const event = createDocsTelemetryEvent(config, { type: "project_detected" }, context);
|
|
271
|
+
if (!event) return;
|
|
272
|
+
const key = projectEventKey(event);
|
|
273
|
+
const sent = getSentProjectKeys();
|
|
274
|
+
const now = Date.now();
|
|
275
|
+
const expiresAt = sent.get(key);
|
|
276
|
+
if (expiresAt && expiresAt > now) return;
|
|
277
|
+
if (typeof expiresAt === "number") sent.delete(key);
|
|
278
|
+
pruneSentProjectKeys(sent, now);
|
|
279
|
+
sent.set(key, now + PROJECT_TELEMETRY_CACHE_TTL_MS);
|
|
280
|
+
emitDocsTelemetryEvent(config.telemetry, event);
|
|
281
|
+
}
|
|
282
|
+
/**
|
|
283
|
+
* Emit a privacy-preserving browser page view for the maintainer telemetry dashboard.
|
|
284
|
+
*
|
|
285
|
+
* Page views include only the public site origin, pathname, locale, framework, and package
|
|
286
|
+
* metadata. They never include a query string, referrer, visitor id, IP address, or user agent.
|
|
287
|
+
*/
|
|
288
|
+
function emitDocsTelemetryPageViewEvent(telemetry, context = {}) {
|
|
289
|
+
if (telemetry === false || telemetry && typeof telemetry === "object" && telemetry.enabled === false) return;
|
|
290
|
+
const runtimeSiteOrigin = context.siteOrigin ?? (typeof window !== "undefined" ? window.location?.origin : void 0);
|
|
291
|
+
if (isBlockedDocsTelemetryOrigin(runtimeSiteOrigin)) return;
|
|
292
|
+
const siteOrigin = (telemetry && typeof telemetry === "object" ? telemetry.siteOrigin : void 0) ?? runtimeSiteOrigin;
|
|
293
|
+
const event = createDocsTelemetryEvent({ telemetry }, {
|
|
294
|
+
type: "page_view",
|
|
295
|
+
features: {},
|
|
296
|
+
properties: {
|
|
297
|
+
trafficType: "human",
|
|
298
|
+
...context.path ? { path: context.path.slice(0, 2048) } : {},
|
|
299
|
+
...context.locale ? { locale: context.locale.slice(0, 80) } : {}
|
|
300
|
+
}
|
|
301
|
+
}, {
|
|
302
|
+
framework: context.framework,
|
|
303
|
+
siteOrigin
|
|
304
|
+
});
|
|
305
|
+
if (!event) return;
|
|
306
|
+
emitDocsTelemetryEvent(telemetry && typeof telemetry === "object" ? {
|
|
307
|
+
...telemetry,
|
|
308
|
+
enabled: true
|
|
309
|
+
} : true, event);
|
|
310
|
+
}
|
|
311
|
+
function emitDocsTelemetryAgentSurfaceEvent(config, context) {
|
|
312
|
+
const event = createDocsTelemetryEvent(config, {
|
|
313
|
+
type: context.surface === "mcp" ? "mcp_request" : "agent_surface_used",
|
|
314
|
+
properties: { surface: context.surface }
|
|
315
|
+
}, context);
|
|
316
|
+
if (!event) return;
|
|
317
|
+
emitDocsTelemetryEvent(config.telemetry, event);
|
|
318
|
+
}
|
|
319
|
+
function emitDocsTelemetryMcpToolEvent(config, context) {
|
|
320
|
+
const event = createDocsTelemetryEvent(config, {
|
|
321
|
+
type: "mcp_tool_used",
|
|
322
|
+
properties: {
|
|
323
|
+
tool: context.tool,
|
|
324
|
+
locale: context.locale,
|
|
325
|
+
resultCount: context.resultCount
|
|
326
|
+
}
|
|
327
|
+
}, context);
|
|
328
|
+
if (!event) return;
|
|
329
|
+
emitDocsTelemetryEvent(config.telemetry, event);
|
|
330
|
+
}
|
|
331
|
+
function inferDocsTelemetryAgentSurface(request, options) {
|
|
332
|
+
const url = new URL(request.url);
|
|
333
|
+
const method = request.method.toUpperCase();
|
|
334
|
+
const feedbackRequest = resolveDocsAgentFeedbackRequest(url, resolveDocsAgentFeedbackConfig(options.feedback));
|
|
335
|
+
if ((method === "GET" || method === "HEAD") && isDocsAgentDiscoveryRequest(url)) return "agent_spec";
|
|
336
|
+
if ((method === "GET" || method === "HEAD") && feedbackRequest?.kind === "schema") return "agent_feedback_schema";
|
|
337
|
+
if (method === "POST" && feedbackRequest?.kind === "submit") return "agent_feedback_submit";
|
|
338
|
+
if (method === "GET" || method === "HEAD") {
|
|
339
|
+
if (isDocsContentChangesRequest(url)) return "content_changes";
|
|
340
|
+
if (isDocsAgentsRequest(url) || resolveDocsAgentsFormat(url) === "agents") return "agents";
|
|
341
|
+
if (isDocsSkillRequest(url) || resolveDocsSkillFormat(url) === "skill") return "skill";
|
|
342
|
+
if (resolveDocsMarkdownRequest(options.entry, url, request)) return "markdown";
|
|
343
|
+
if (resolveDocsLlmsTxtRequest(url, options.llmsTxt, options.entry)) return "llms";
|
|
344
|
+
}
|
|
345
|
+
if (method === "POST") return "ask_ai";
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
//#endregion
|
|
349
|
+
//#region src/sidebar.ts
|
|
350
|
+
function resolvePageSidebarFolderIndexBehavior(sidebar) {
|
|
351
|
+
if (!sidebar || typeof sidebar !== "object") return void 0;
|
|
352
|
+
const value = sidebar.folderIndexBehavior;
|
|
353
|
+
return value === "link" || value === "toggle" || value === "hidden" ? value : void 0;
|
|
354
|
+
}
|
|
355
|
+
function normalizeSidebarFolderBehaviorPath(path) {
|
|
356
|
+
if (!path) return void 0;
|
|
357
|
+
let value = path.trim();
|
|
358
|
+
if (!value) return void 0;
|
|
359
|
+
if (/^[a-zA-Z][a-zA-Z\d+\-.]*:\/\//.test(value)) try {
|
|
360
|
+
value = new URL(value).pathname;
|
|
361
|
+
} catch {
|
|
362
|
+
return;
|
|
363
|
+
}
|
|
364
|
+
else value = value.split("#", 1)[0]?.split("?", 1)[0] ?? value;
|
|
365
|
+
if (!value.startsWith("/")) value = `/${value}`;
|
|
366
|
+
return value.replace(/\/$/, "") || "/";
|
|
367
|
+
}
|
|
368
|
+
function resolveSidebarFolderIndexBehavior(sidebar, defaultBehavior = "link") {
|
|
369
|
+
if (sidebar === void 0 || sidebar === true || sidebar === false) return defaultBehavior;
|
|
370
|
+
if (sidebar.folderIndexBehavior === "toggle") return "toggle";
|
|
371
|
+
if (sidebar.folderIndexBehavior === "hidden") return "hidden";
|
|
372
|
+
if (sidebar.folderIndexBehavior === "link") return "link";
|
|
373
|
+
return defaultBehavior;
|
|
374
|
+
}
|
|
375
|
+
function resolveSidebarFolderIndexBehaviorForPath(sidebar, folderPath, defaultBehavior = "link") {
|
|
376
|
+
const fallback = resolveSidebarFolderIndexBehavior(sidebar, defaultBehavior);
|
|
377
|
+
if (!sidebar || typeof sidebar !== "object") return fallback;
|
|
378
|
+
const normalizedPath = normalizeSidebarFolderBehaviorPath(folderPath);
|
|
379
|
+
if (!normalizedPath) return fallback;
|
|
380
|
+
for (const [rawPath, override] of Object.entries(sidebar.folderIndexBehaviorOverrides ?? {})) if (normalizeSidebarFolderBehaviorPath(rawPath) === normalizedPath) return override === "link" || override === "toggle" || override === "hidden" ? override : fallback;
|
|
381
|
+
return fallback;
|
|
382
|
+
}
|
|
383
|
+
function applySidebarFolderIndexBehavior(tree, behaviorOrOptions) {
|
|
384
|
+
const resolveBehavior = typeof behaviorOrOptions === "string" ? () => behaviorOrOptions : (folderPath) => resolveSidebarFolderIndexBehaviorForPath(behaviorOrOptions.sidebar, folderPath, behaviorOrOptions.defaultBehavior);
|
|
385
|
+
function mapNode(node) {
|
|
386
|
+
if (!node || typeof node !== "object") return node;
|
|
387
|
+
const candidate = node;
|
|
388
|
+
if (candidate.type !== "folder" || !Array.isArray(candidate.children)) return node;
|
|
389
|
+
const children = candidate.children.map(mapNode);
|
|
390
|
+
const index = candidate.index ? mapNode(candidate.index) : void 0;
|
|
391
|
+
const folderPath = (typeof candidate.url === "string" ? candidate.url : void 0) || (candidate.index && typeof candidate.index === "object" && "url" in candidate.index && typeof candidate.index.url === "string" ? candidate.index.url ?? void 0 : void 0);
|
|
392
|
+
const behavior = (candidate.folderIndexBehavior === "link" || candidate.folderIndexBehavior === "toggle" || candidate.folderIndexBehavior === "hidden" ? candidate.folderIndexBehavior : void 0) ?? resolveBehavior(folderPath);
|
|
393
|
+
if (behavior === "link") return {
|
|
394
|
+
...candidate,
|
|
395
|
+
folderIndexBehavior: void 0,
|
|
396
|
+
index,
|
|
397
|
+
children
|
|
398
|
+
};
|
|
399
|
+
if (behavior === "hidden") return {
|
|
400
|
+
...candidate,
|
|
401
|
+
folderIndexBehavior: void 0,
|
|
402
|
+
index: void 0,
|
|
403
|
+
url: void 0,
|
|
404
|
+
children
|
|
405
|
+
};
|
|
406
|
+
return {
|
|
407
|
+
...candidate,
|
|
408
|
+
folderIndexBehavior: void 0,
|
|
409
|
+
index: void 0,
|
|
410
|
+
url: void 0,
|
|
411
|
+
children: index ? [index, ...children] : children
|
|
412
|
+
};
|
|
413
|
+
}
|
|
414
|
+
return {
|
|
415
|
+
...tree,
|
|
416
|
+
children: tree.children.map(mapNode)
|
|
417
|
+
};
|
|
418
|
+
}
|
|
419
|
+
|
|
420
|
+
//#endregion
|
|
421
|
+
export { emitDocsTelemetryAgentSurfaceEvent as a, emitDocsTelemetryPageViewEvent as c, inferDocsTelemetryAgentSurface as d, isLocalDocsTelemetryOrigin as f, resolveSidebarFolderIndexBehaviorForPath as i, emitDocsTelemetryProjectEvent as l, resolveDocsTelemetryConfig as m, resolvePageSidebarFolderIndexBehavior as n, emitDocsTelemetryEvent as o, normalizeDocsTelemetryOrigin as p, resolveSidebarFolderIndexBehavior as r, emitDocsTelemetryMcpToolEvent as s, applySidebarFolderIndexBehavior as t, getDocsTelemetryFeatures as u };
|
|
@@ -1,17 +1,21 @@
|
|
|
1
|
-
import "./
|
|
2
|
-
import
|
|
3
|
-
import "./
|
|
4
|
-
import "./
|
|
5
|
-
import "./
|
|
6
|
-
import "./
|
|
7
|
-
import "./
|
|
8
|
-
import "./
|
|
1
|
+
import "./http-body-DkAPk6D5.mjs";
|
|
2
|
+
import "./markdown-sections-9Oxr33b-.mjs";
|
|
3
|
+
import { It as renderDocsSitemapMarkdown, Lt as renderDocsSitemapXml, Nt as buildDocsSitemapManifest, Rt as resolveDocsSitemapConfig } from "./agent-DkAidqtV.mjs";
|
|
4
|
+
import "./standards-discovery-sSEojU80.mjs";
|
|
5
|
+
import "./sidebar-CFHBj29f.mjs";
|
|
6
|
+
import "./openapi-mcp-BIOTLiA7.mjs";
|
|
7
|
+
import "./prompt-utils-B5g-bv7o.mjs";
|
|
8
|
+
import "./api-reference-By_LokQ-.mjs";
|
|
9
|
+
import "./agent-skills-server-BC7md56k.mjs";
|
|
10
|
+
import "./agent-evals-BLNLvXbG.mjs";
|
|
9
11
|
import { createFilesystemDocsMcpSource } from "./mcp.mjs";
|
|
10
|
-
import "./authoring-mcp-
|
|
12
|
+
import "./authoring-mcp-CiCUQe3o.mjs";
|
|
13
|
+
import "./cloud-ask-ai-BqKhjpS5.mjs";
|
|
11
14
|
import "./code-blocks-GYdvS3BH.mjs";
|
|
15
|
+
import "./sitemap-server-Lg3YhUx4.mjs";
|
|
12
16
|
import "./server.mjs";
|
|
13
|
-
import { _ as resolveDocsContentDir, a as loadDocsConfigModule, d as readNavTitle, g as resolveDocsConfigPath, h as readTopLevelStringProperty, l as readBooleanProperty, p as readStringProperty, t as extractNestedObjectLiteral } from "./config-
|
|
14
|
-
import { t as detectFramework } from "./utils-
|
|
17
|
+
import { _ as resolveDocsContentDir, a as loadDocsConfigModule, d as readNavTitle, g as resolveDocsConfigPath, h as readTopLevelStringProperty, l as readBooleanProperty, p as readStringProperty, t as extractNestedObjectLiteral } from "./config-BZnKAj_Y.mjs";
|
|
18
|
+
import { t as detectFramework } from "./utils-C7KDrPpA.mjs";
|
|
15
19
|
import { existsSync, mkdirSync, readFileSync, statSync, writeFileSync } from "node:fs";
|
|
16
20
|
import path from "node:path";
|
|
17
21
|
import { execFileSync } from "node:child_process";
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import { oi as ResolvedDocsRelatedLink, yr as DocsSitemapConfig } from "./types-BncG8J3g.mjs";
|
|
2
|
+
import { R as DocsDiscoveryApiRouteOptions } from "./standards-discovery-1fiUVDAo.mjs";
|
|
3
|
+
|
|
4
|
+
//#region src/sitemap.d.ts
|
|
5
|
+
declare const DEFAULT_SITEMAP_XML_ROUTE = "/sitemap.xml";
|
|
6
|
+
declare const DEFAULT_SITEMAP_MD_ROUTE = "/sitemap.md";
|
|
7
|
+
declare const DEFAULT_SITEMAP_MD_DOCS_ROUTE = "/docs/sitemap.md";
|
|
8
|
+
declare const DEFAULT_SITEMAP_MD_WELL_KNOWN_ROUTE = "/.well-known/sitemap.md";
|
|
9
|
+
declare const DEFAULT_SITEMAP_MANIFEST_PATH = ".farming-labs/sitemap-manifest.json";
|
|
10
|
+
type DocsSitemapFormat = "xml" | "markdown";
|
|
11
|
+
interface DocsSitemapPageInput {
|
|
12
|
+
slug?: string;
|
|
13
|
+
url: string;
|
|
14
|
+
/** Override the public Markdown representation URL when it differs from `${url}.md`. */
|
|
15
|
+
markdownUrl?: string;
|
|
16
|
+
title: string;
|
|
17
|
+
description?: string;
|
|
18
|
+
related?: ResolvedDocsRelatedLink[];
|
|
19
|
+
sourcePath?: string;
|
|
20
|
+
lastmod?: string;
|
|
21
|
+
lastModified?: string;
|
|
22
|
+
}
|
|
23
|
+
interface DocsSitemapManifestPage {
|
|
24
|
+
url: string;
|
|
25
|
+
absoluteUrl?: string;
|
|
26
|
+
markdownUrl: string;
|
|
27
|
+
title: string;
|
|
28
|
+
description?: string;
|
|
29
|
+
sourcePath?: string;
|
|
30
|
+
lastmod?: string;
|
|
31
|
+
lastmodSource?: "git" | "filesystem" | "frontmatter" | "manifest" | "unknown";
|
|
32
|
+
related?: string[];
|
|
33
|
+
}
|
|
34
|
+
interface DocsSitemapManifest {
|
|
35
|
+
version: 1;
|
|
36
|
+
generatedAt: string;
|
|
37
|
+
baseUrl?: string;
|
|
38
|
+
entry: string;
|
|
39
|
+
siteTitle?: string;
|
|
40
|
+
pages: DocsSitemapManifestPage[];
|
|
41
|
+
}
|
|
42
|
+
interface DocsSitemapResolvedConfig {
|
|
43
|
+
enabled: boolean;
|
|
44
|
+
routePrefix: string;
|
|
45
|
+
baseUrl?: string;
|
|
46
|
+
manifestPath: string;
|
|
47
|
+
xml: {
|
|
48
|
+
enabled: boolean;
|
|
49
|
+
includeLastmod: boolean;
|
|
50
|
+
route: string;
|
|
51
|
+
};
|
|
52
|
+
markdown: {
|
|
53
|
+
enabled: boolean;
|
|
54
|
+
includeDescriptions: boolean;
|
|
55
|
+
includeLastmod: boolean;
|
|
56
|
+
linkTarget: "html" | "markdown" | "both";
|
|
57
|
+
route: string;
|
|
58
|
+
docsRoute?: string;
|
|
59
|
+
wellKnownRoute: string;
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
interface CreateDocsSitemapResponseOptions extends DocsDiscoveryApiRouteOptions {
|
|
63
|
+
request: Request;
|
|
64
|
+
sitemap?: boolean | DocsSitemapConfig;
|
|
65
|
+
entry?: string;
|
|
66
|
+
siteTitle?: string;
|
|
67
|
+
baseUrl?: string;
|
|
68
|
+
pages: DocsSitemapPageInput[];
|
|
69
|
+
manifest?: DocsSitemapManifest | null;
|
|
70
|
+
}
|
|
71
|
+
declare function resolveDocsSitemapConfig(sitemap?: boolean | DocsSitemapConfig, defaults?: {
|
|
72
|
+
baseUrl?: string;
|
|
73
|
+
}): DocsSitemapResolvedConfig;
|
|
74
|
+
declare function resolveDocsSitemapRequest(url: URL, sitemap?: boolean | DocsSitemapConfig, options?: DocsDiscoveryApiRouteOptions): DocsSitemapFormat | null;
|
|
75
|
+
declare function toDocsSitemapMarkdownUrl(url: string): string;
|
|
76
|
+
declare function buildDocsSitemapManifest(options: {
|
|
77
|
+
pages: DocsSitemapPageInput[];
|
|
78
|
+
entry?: string;
|
|
79
|
+
siteTitle?: string;
|
|
80
|
+
baseUrl?: string;
|
|
81
|
+
generatedAt?: string;
|
|
82
|
+
resolveLastmod?: (page: DocsSitemapPageInput) => {
|
|
83
|
+
lastmod?: string;
|
|
84
|
+
lastmodSource?: DocsSitemapManifestPage["lastmodSource"];
|
|
85
|
+
} | undefined;
|
|
86
|
+
}): DocsSitemapManifest;
|
|
87
|
+
declare function renderDocsSitemapXml(manifest: DocsSitemapManifest, options?: {
|
|
88
|
+
baseUrl?: string;
|
|
89
|
+
includeLastmod?: boolean;
|
|
90
|
+
}): string;
|
|
91
|
+
declare function renderDocsSitemapMarkdown(manifest: DocsSitemapManifest, options?: {
|
|
92
|
+
baseUrl?: string;
|
|
93
|
+
includeDescriptions?: boolean;
|
|
94
|
+
includeLastmod?: boolean;
|
|
95
|
+
linkTarget?: "html" | "markdown" | "both";
|
|
96
|
+
}): string;
|
|
97
|
+
declare function readDocsSitemapManifestFromContentMap(contentMap?: Record<string, string> | null): DocsSitemapManifest | null;
|
|
98
|
+
declare function resolveDocsSitemapPageLastmod(manifest: DocsSitemapManifest | null | undefined, url: string): string | undefined;
|
|
99
|
+
declare function createDocsSitemapResponse({
|
|
100
|
+
request,
|
|
101
|
+
apiRoute,
|
|
102
|
+
sitemap,
|
|
103
|
+
entry,
|
|
104
|
+
siteTitle,
|
|
105
|
+
baseUrl,
|
|
106
|
+
pages,
|
|
107
|
+
manifest
|
|
108
|
+
}: CreateDocsSitemapResponseOptions): Response | null;
|
|
109
|
+
//#endregion
|
|
110
|
+
export { resolveDocsSitemapPageLastmod as _, DEFAULT_SITEMAP_XML_ROUTE as a, DocsSitemapManifestPage as c, buildDocsSitemapManifest as d, createDocsSitemapResponse as f, resolveDocsSitemapConfig as g, renderDocsSitemapXml as h, DEFAULT_SITEMAP_MD_WELL_KNOWN_ROUTE as i, DocsSitemapPageInput as l, renderDocsSitemapMarkdown as m, DEFAULT_SITEMAP_MD_DOCS_ROUTE as n, DocsSitemapFormat as o, readDocsSitemapManifestFromContentMap as p, DEFAULT_SITEMAP_MD_ROUTE as r, DocsSitemapManifest as s, DEFAULT_SITEMAP_MANIFEST_PATH as t, DocsSitemapResolvedConfig as u, resolveDocsSitemapRequest as v, toDocsSitemapMarkdownUrl as y };
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import { Ht as DocsConfig, a as ApiReferenceRenderer, gr as DocsSearchSourcePage, vn as DocsOkfConfig, wn as DocsOpenApiMcpConfig, yr as DocsSitemapConfig } from "./types-BncG8J3g.mjs";
|
|
2
|
+
import { s as DocsSitemapManifest } from "./sitemap-DafdOrxK.mjs";
|
|
3
|
+
|
|
4
|
+
//#region src/api-reference.d.ts
|
|
5
|
+
type HttpMethod = "GET" | "POST" | "PUT" | "PATCH" | "DELETE" | "OPTIONS" | "HEAD";
|
|
6
|
+
type ApiReferenceFramework = "next" | "tanstack-start" | "farmjs" | "sveltekit" | "astro" | "nuxt";
|
|
7
|
+
interface ApiReferenceRoute {
|
|
8
|
+
title: string;
|
|
9
|
+
summary: string;
|
|
10
|
+
description?: string;
|
|
11
|
+
routePath: string;
|
|
12
|
+
sourceFile: string;
|
|
13
|
+
methods: HttpMethod[];
|
|
14
|
+
tag: string;
|
|
15
|
+
parameters: Array<Record<string, unknown>>;
|
|
16
|
+
}
|
|
17
|
+
interface ResolvedApiReferenceConfig {
|
|
18
|
+
enabled: boolean;
|
|
19
|
+
path: string;
|
|
20
|
+
specUrl?: string;
|
|
21
|
+
overlays: string[];
|
|
22
|
+
versions: ResolvedApiReferenceVersion[];
|
|
23
|
+
defaultVersion?: string;
|
|
24
|
+
catalogTargets?: string[];
|
|
25
|
+
renderer?: ApiReferenceRenderer;
|
|
26
|
+
mcp?: DocsOpenApiMcpConfig;
|
|
27
|
+
routeRoot: string;
|
|
28
|
+
exclude: string[];
|
|
29
|
+
}
|
|
30
|
+
interface ResolvedApiReferenceVersion {
|
|
31
|
+
id: string;
|
|
32
|
+
label: string;
|
|
33
|
+
specUrl: string;
|
|
34
|
+
overlays: string[];
|
|
35
|
+
default: boolean;
|
|
36
|
+
}
|
|
37
|
+
interface ApiReferenceOpenApiVersionDiscovery {
|
|
38
|
+
id: string;
|
|
39
|
+
label: string;
|
|
40
|
+
default: boolean;
|
|
41
|
+
url: string;
|
|
42
|
+
apiReferencePath: string;
|
|
43
|
+
specUrl?: string;
|
|
44
|
+
operationCount?: number;
|
|
45
|
+
}
|
|
46
|
+
interface ApiReferenceOpenApiDiscovery {
|
|
47
|
+
enabled: boolean;
|
|
48
|
+
url?: string;
|
|
49
|
+
urlSource?: "default" | "configured";
|
|
50
|
+
source?: "generated" | "configured";
|
|
51
|
+
specUrl?: string;
|
|
52
|
+
apiReferencePath?: string;
|
|
53
|
+
catalogTargets?: string[];
|
|
54
|
+
operationCount?: number;
|
|
55
|
+
versions?: ApiReferenceOpenApiVersionDiscovery[];
|
|
56
|
+
}
|
|
57
|
+
interface BuildApiReferenceOptions {
|
|
58
|
+
framework: ApiReferenceFramework;
|
|
59
|
+
rootDir?: string;
|
|
60
|
+
baseUrl?: string;
|
|
61
|
+
version?: string;
|
|
62
|
+
}
|
|
63
|
+
interface BuildApiReferenceOperationPagesOptions extends Omit<BuildApiReferenceOptions, "version"> {
|
|
64
|
+
/** Locale attached to generated search records in localized documentation sites. */
|
|
65
|
+
locale?: string;
|
|
66
|
+
}
|
|
67
|
+
interface CreateApiReferenceOperationMarkdownResponseOptions extends BuildApiReferenceOperationPagesOptions {
|
|
68
|
+
request: Request;
|
|
69
|
+
/** Shared Docs API pathname used by query-form Markdown requests. @default "/api/docs" */
|
|
70
|
+
apiRoute?: string;
|
|
71
|
+
/** Public metadata origin. Defaults to `baseUrl`, then the request origin. */
|
|
72
|
+
origin?: string;
|
|
73
|
+
/** Authored pages included in Markdown recovery suggestions. */
|
|
74
|
+
pages?: DocsSearchSourcePage[];
|
|
75
|
+
/** Reuse a cached operation projection when the adapter already maintains one. */
|
|
76
|
+
operationPages?: DocsSearchSourcePage[] | (() => DocsSearchSourcePage[] | Promise<DocsSearchSourcePage[]>);
|
|
77
|
+
sitemap?: boolean | DocsSitemapConfig;
|
|
78
|
+
okf?: boolean | DocsOkfConfig;
|
|
79
|
+
}
|
|
80
|
+
interface BuildApiReferenceHtmlOptions extends BuildApiReferenceOptions {
|
|
81
|
+
title?: string;
|
|
82
|
+
}
|
|
83
|
+
declare const DEFAULT_API_REFERENCE_OPENAPI_ROUTE = "/api/docs?format=openapi";
|
|
84
|
+
declare function resolveApiReferenceConfig(value: DocsConfig["apiReference"]): ResolvedApiReferenceConfig;
|
|
85
|
+
declare function resolveApiReferenceRenderer(value: DocsConfig["apiReference"], _framework: ApiReferenceFramework): ApiReferenceRenderer;
|
|
86
|
+
declare function resolveApiReferenceOpenApiDiscovery(value: DocsConfig["apiReference"], options?: {
|
|
87
|
+
route?: string;
|
|
88
|
+
}): ApiReferenceOpenApiDiscovery;
|
|
89
|
+
declare function resolveApiReferenceVersion(config: ResolvedApiReferenceConfig, requestedVersion?: string): ResolvedApiReferenceVersion | undefined;
|
|
90
|
+
declare function resolveApiReferenceVersionFromPathname(value: DocsConfig["apiReference"], pathname: string): ResolvedApiReferenceVersion | undefined;
|
|
91
|
+
declare function isApiReferenceOpenApiRequest(url: URL): boolean;
|
|
92
|
+
declare function buildApiReferencePageTitle(config: DocsConfig, title?: string): string;
|
|
93
|
+
declare function buildApiReferenceScalarCss(config: DocsConfig): string;
|
|
94
|
+
declare function buildApiReferenceOpenApiDocument(config: DocsConfig, options: BuildApiReferenceOptions): Record<string, unknown>;
|
|
95
|
+
declare function buildApiReferenceOpenApiDocumentAsync(config: DocsConfig, options: BuildApiReferenceOptions): Promise<Record<string, unknown>>;
|
|
96
|
+
/**
|
|
97
|
+
* Build deterministic, operation-level source pages from every configured OpenAPI version.
|
|
98
|
+
*
|
|
99
|
+
* These pages are framework-neutral projections used by documentation search and other
|
|
100
|
+
* read-only knowledge surfaces. They never inherit MCP execution headers or credentials.
|
|
101
|
+
*/
|
|
102
|
+
declare function buildApiReferenceOperationPagesAsync(config: DocsConfig, options: BuildApiReferenceOperationPagesOptions): Promise<DocsSearchSourcePage[]>;
|
|
103
|
+
/**
|
|
104
|
+
* Resolve a public per-operation Markdown request using the same generated projection as search,
|
|
105
|
+
* Ask AI, and MCP. Returns `null` when the request is not an API operation Markdown route.
|
|
106
|
+
*/
|
|
107
|
+
declare function createApiReferenceOperationMarkdownResponse(config: DocsConfig, options: CreateApiReferenceOperationMarkdownResponseOptions): Promise<Response | null>;
|
|
108
|
+
declare function buildApiReferenceHtmlDocument(config: DocsConfig, options: BuildApiReferenceHtmlOptions): string;
|
|
109
|
+
declare function buildApiReferenceHtmlDocumentAsync(config: DocsConfig, options: BuildApiReferenceHtmlOptions): Promise<string>;
|
|
110
|
+
//#endregion
|
|
111
|
+
//#region src/sitemap-server.d.ts
|
|
112
|
+
declare function readDocsSitemapManifest(rootDir: string, sitemap?: boolean | DocsSitemapConfig): DocsSitemapManifest | null;
|
|
113
|
+
//#endregion
|
|
114
|
+
export { resolveApiReferenceRenderer as C, resolveApiReferenceOpenApiDiscovery as S, resolveApiReferenceVersionFromPathname as T, buildApiReferencePageTitle as _, ApiReferenceRoute as a, isApiReferenceOpenApiRequest as b, CreateApiReferenceOperationMarkdownResponseOptions as c, ResolvedApiReferenceVersion as d, buildApiReferenceHtmlDocument as f, buildApiReferenceOperationPagesAsync as g, buildApiReferenceOpenApiDocumentAsync as h, ApiReferenceOpenApiVersionDiscovery as i, DEFAULT_API_REFERENCE_OPENAPI_ROUTE as l, buildApiReferenceOpenApiDocument as m, ApiReferenceFramework as n, BuildApiReferenceOperationPagesOptions as o, buildApiReferenceHtmlDocumentAsync as p, ApiReferenceOpenApiDiscovery as r, BuildApiReferenceOptions as s, readDocsSitemapManifest as t, ResolvedApiReferenceConfig as u, buildApiReferenceScalarCss as v, resolveApiReferenceVersion as w, resolveApiReferenceConfig as x, createApiReferenceOperationMarkdownResponse as y };
|