@solutiondesk/help 0.0.0-stage → 1.0.0-1edea54
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/LICENSE +21 -0
- package/README.md +250 -2
- package/dist/fumadocs.d.ts +622 -0
- package/dist/fumadocs.js +665 -0
- package/dist/index.cjs +344 -0
- package/dist/index.d.cts +433 -0
- package/dist/index.d.ts +433 -0
- package/dist/index.js +334 -0
- package/package.json +84 -3
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,433 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The HTTP part shared by the public SolutionDesk SDKs. Runs on any runtime with
|
|
3
|
+
* a WHATWG `fetch` (Node ≥ 18, Deno, Bun, edge runtimes, browsers) — and on
|
|
4
|
+
* purpose names no DOM or Node type, so the published `.d.ts` files need neither
|
|
5
|
+
* `lib: ["dom"]` nor `@types/node`.
|
|
6
|
+
*/
|
|
7
|
+
/** The production API. */
|
|
8
|
+
declare const DEFAULT_BASE_URL = "https://api.solutiondesk.io";
|
|
9
|
+
/** The response parts the SDK reads — what every `fetch` implementation returns. */
|
|
10
|
+
interface FetchResponseLike {
|
|
11
|
+
readonly status: number;
|
|
12
|
+
readonly ok: boolean;
|
|
13
|
+
readonly headers: {
|
|
14
|
+
get(name: string): string | null;
|
|
15
|
+
};
|
|
16
|
+
text(): Promise<string>;
|
|
17
|
+
}
|
|
18
|
+
/** What the SDK passes to `fetch` (plus whatever you set in `fetchOptions`). */
|
|
19
|
+
interface FetchInitLike {
|
|
20
|
+
method: string;
|
|
21
|
+
headers: Record<string, string>;
|
|
22
|
+
body?: string;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* A `fetch` implementation. The global `fetch` fits, so do `undici`, `node-fetch`
|
|
26
|
+
* and wrappers (e.g. one that adds tracing). Declared bivariantly so a fetch with
|
|
27
|
+
* a richer `init` type is accepted.
|
|
28
|
+
*/
|
|
29
|
+
type FetchLike = {
|
|
30
|
+
bivarianceHack(input: string, init?: FetchInitLike): Promise<FetchResponseLike>;
|
|
31
|
+
}["bivarianceHack"];
|
|
32
|
+
/** A response kept for `If-None-Match` revalidation. */
|
|
33
|
+
interface CachedResponse {
|
|
34
|
+
etag: string;
|
|
35
|
+
body: unknown;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Where the client keeps answers for ETag revalidation. Any `Map` fits; bring
|
|
39
|
+
* your own to share it between clients or to bound it differently.
|
|
40
|
+
*/
|
|
41
|
+
interface EtagCache {
|
|
42
|
+
get(key: string): CachedResponse | undefined;
|
|
43
|
+
set(key: string, value: CachedResponse): unknown;
|
|
44
|
+
}
|
|
45
|
+
/** Options every client factory takes. */
|
|
46
|
+
interface BaseClientOptions {
|
|
47
|
+
/** The API origin, without `/v1`. Defaults to `https://api.solutiondesk.io`. */
|
|
48
|
+
baseUrl?: string;
|
|
49
|
+
/** A `fetch` implementation; defaults to the global one. */
|
|
50
|
+
fetch?: FetchLike;
|
|
51
|
+
/** Headers sent with every request (e.g. `accept-language` forwarded from your visitor). */
|
|
52
|
+
headers?: Record<string, string>;
|
|
53
|
+
/**
|
|
54
|
+
* Revalidate with `If-None-Match`: the client remembers each answer's `ETag`
|
|
55
|
+
* and, when the API answers `304 Not Modified`, returns the remembered body.
|
|
56
|
+
* `true` keeps up to 500 answers in memory; or pass your own {@link EtagCache}.
|
|
57
|
+
* Off by default (your framework's fetch cache may already do this).
|
|
58
|
+
*/
|
|
59
|
+
etagCache?: boolean | EtagCache;
|
|
60
|
+
}
|
|
61
|
+
/** Per-call options. */
|
|
62
|
+
interface RequestOptions {
|
|
63
|
+
/** Cancels the request (an `AbortSignal`). */
|
|
64
|
+
signal?: unknown;
|
|
65
|
+
/** Extra headers for this request. */
|
|
66
|
+
headers?: Record<string, string>;
|
|
67
|
+
/**
|
|
68
|
+
* Extra `fetch` options for this request, passed through unchanged — e.g.
|
|
69
|
+
* Next.js `{ next: { revalidate: 60, tags: ["legal"] } }` or `{ cache: "no-store" }`.
|
|
70
|
+
*/
|
|
71
|
+
fetchOptions?: Record<string, unknown>;
|
|
72
|
+
}
|
|
73
|
+
/** Any non-2xx answer of the API (and a failed network request, with `status` 0). */
|
|
74
|
+
declare class SolutionDeskError extends Error {
|
|
75
|
+
/** The HTTP status; `0` when no answer arrived (network error, aborted). */
|
|
76
|
+
readonly status: number;
|
|
77
|
+
/** The parsed JSON body of the error answer (usually `{ error: string }`), else its text. */
|
|
78
|
+
readonly body: unknown;
|
|
79
|
+
/** The requested URL. */
|
|
80
|
+
readonly url: string;
|
|
81
|
+
/** Messages per input field on a `400` (e.g. `{ email: "Enter a valid email address." }`). */
|
|
82
|
+
readonly fields: Record<string, string>;
|
|
83
|
+
constructor(message: string, init: {
|
|
84
|
+
status: number;
|
|
85
|
+
body?: unknown;
|
|
86
|
+
url: string;
|
|
87
|
+
cause?: unknown;
|
|
88
|
+
});
|
|
89
|
+
/** `404`: unknown workspace, module turned off or unknown item — on purpose indistinguishable. */
|
|
90
|
+
get isNotFound(): boolean;
|
|
91
|
+
/** `429`: over the rate limit; try again later. */
|
|
92
|
+
get isRateLimited(): boolean;
|
|
93
|
+
}
|
|
94
|
+
/** A bounded in-memory {@link EtagCache} (oldest entry dropped first). */
|
|
95
|
+
declare function createMemoryEtagCache(maxEntries?: number): EtagCache;
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* Webhook signature check with Web Crypto only — the same code runs in Node,
|
|
99
|
+
* Deno, Bun, edge runtimes and browsers. The header SolutionDesk sends is
|
|
100
|
+
* `X-SolutionDesk-Signature: t=<unix seconds>,v1=<hex HMAC-SHA256(secret, "<t>.<raw body>")>`.
|
|
101
|
+
*/
|
|
102
|
+
/** The header that carries the signature. */
|
|
103
|
+
declare const SIGNATURE_HEADER = "x-solutiondesk-signature";
|
|
104
|
+
/** The header that names the event (also in the body as `event`). */
|
|
105
|
+
declare const EVENT_HEADER = "x-solutiondesk-event";
|
|
106
|
+
interface VerifyWebhookOptions {
|
|
107
|
+
/** How old (or how far in the future) the signed time may be. Default 300 (5 minutes). */
|
|
108
|
+
toleranceSeconds?: number;
|
|
109
|
+
/** "Now" in milliseconds (or a `Date`) — for tests. Default `Date.now()`. */
|
|
110
|
+
now?: number | Date;
|
|
111
|
+
/**
|
|
112
|
+
* A Web Crypto implementation. Default `globalThis.crypto`. On Node 18 pass
|
|
113
|
+
* `require("node:crypto").webcrypto` (Node 19+ has it globally).
|
|
114
|
+
*/
|
|
115
|
+
crypto?: {
|
|
116
|
+
subtle: object;
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
/** The raw request body, exactly as received. */
|
|
120
|
+
type WebhookBody = string | Uint8Array | ArrayBuffer;
|
|
121
|
+
/**
|
|
122
|
+
* Check a SolutionDesk webhook signature. `true` only when the header is well
|
|
123
|
+
* formed, its time lies within the tolerance and the HMAC matches — anything
|
|
124
|
+
* else (missing, tampered, expired, malformed) is `false`, never an exception.
|
|
125
|
+
*
|
|
126
|
+
* @param secret The webhook's signing secret (`whsec_…`), shown once in SolutionDesk.
|
|
127
|
+
* @param rawBody The request body exactly as received — not re-serialized JSON.
|
|
128
|
+
* @param header The `X-SolutionDesk-Signature` header.
|
|
129
|
+
*/
|
|
130
|
+
declare function verifyWebhookSignature(secret: string, rawBody: WebhookBody, header: string | null | undefined, options?: VerifyWebhookOptions): Promise<boolean>;
|
|
131
|
+
|
|
132
|
+
/**
|
|
133
|
+
* The answers of the public help center API (`GET /v1/help/{workspace}/{site}/…`).
|
|
134
|
+
* Written by hand so the package has no dependencies; a drift test in the
|
|
135
|
+
* SolutionDesk repository keeps them identical to the API's own contracts.
|
|
136
|
+
*
|
|
137
|
+
* Only what is publicly visible ever appears here: a page that is published,
|
|
138
|
+
* public and placed in the site's navigation — except the one page a valid
|
|
139
|
+
* preview token names. Absent values are `null`, never a missing key.
|
|
140
|
+
*
|
|
141
|
+
* Paths: a page's path is its folder slugs plus its slug, without leading or
|
|
142
|
+
* trailing slash (`guides/login`) — a `group` folder adds no slug; the site's
|
|
143
|
+
* home page has the path `""`.
|
|
144
|
+
*/
|
|
145
|
+
/** The doc site itself. */
|
|
146
|
+
interface HelpPublicSite {
|
|
147
|
+
/** The site's handle in the URL (`hilfe`). */
|
|
148
|
+
slug: string;
|
|
149
|
+
name: string;
|
|
150
|
+
/** Main language (BCP 47 code, e.g. `de`). */
|
|
151
|
+
language: string;
|
|
152
|
+
/** Every language the site is offered in, main language first. */
|
|
153
|
+
languages: string[];
|
|
154
|
+
/** The docs website's base address (`https://help.acme.com/docs`), if set. */
|
|
155
|
+
websiteUrl: string | null;
|
|
156
|
+
}
|
|
157
|
+
/** A page in the navigation. */
|
|
158
|
+
interface HelpPublicTreePage {
|
|
159
|
+
type: "page";
|
|
160
|
+
/** The page's own slug (the last path segment; `index` for the home page). */
|
|
161
|
+
slug: string;
|
|
162
|
+
path: string;
|
|
163
|
+
title: string;
|
|
164
|
+
description: string | null;
|
|
165
|
+
/** A Lucide icon name (`BookOpen`). */
|
|
166
|
+
icon: string | null;
|
|
167
|
+
}
|
|
168
|
+
/** A folder (Fumadocs: a directory with `meta.json`). Empty folders are left out. */
|
|
169
|
+
interface HelpPublicTreeFolder {
|
|
170
|
+
type: "folder";
|
|
171
|
+
/** Stable node id. */
|
|
172
|
+
id: string;
|
|
173
|
+
slug: string;
|
|
174
|
+
/** The folder's path (its index page, if any, lives here; a group's is its parent's). */
|
|
175
|
+
path: string;
|
|
176
|
+
title: string;
|
|
177
|
+
icon: string | null;
|
|
178
|
+
/** A tab (top level only; Fumadocs `root`). */
|
|
179
|
+
root: boolean;
|
|
180
|
+
/**
|
|
181
|
+
* Adds no segment to its pages' paths (Fumadocs `(name)` folder): `path` is
|
|
182
|
+
* the parent's, a top-level group's index page is the home (`""`).
|
|
183
|
+
*/
|
|
184
|
+
group: boolean;
|
|
185
|
+
defaultOpen: boolean;
|
|
186
|
+
collapsible: boolean;
|
|
187
|
+
/** The folder's own page, shown at the folder's path; null without one. */
|
|
188
|
+
index: HelpPublicTreePage | null;
|
|
189
|
+
children: HelpPublicTreeNode[];
|
|
190
|
+
}
|
|
191
|
+
/** A labelled divider between entries (Fumadocs `---Title---`). */
|
|
192
|
+
interface HelpPublicTreeSeparator {
|
|
193
|
+
type: "separator";
|
|
194
|
+
id: string;
|
|
195
|
+
title: string | null;
|
|
196
|
+
icon: string | null;
|
|
197
|
+
}
|
|
198
|
+
/** A menu entry pointing elsewhere: an https address or a path on the docs website. */
|
|
199
|
+
interface HelpPublicTreeLink {
|
|
200
|
+
type: "link";
|
|
201
|
+
id: string;
|
|
202
|
+
title: string;
|
|
203
|
+
url: string;
|
|
204
|
+
icon: string | null;
|
|
205
|
+
/** Open as an external link (Fumadocs `external:`). */
|
|
206
|
+
external: boolean;
|
|
207
|
+
}
|
|
208
|
+
/** One entry of the navigation tree, discriminated by `type`. */
|
|
209
|
+
type HelpPublicTreeNode = HelpPublicTreePage | HelpPublicTreeFolder | HelpPublicTreeSeparator | HelpPublicTreeLink;
|
|
210
|
+
/** `GET site?lang=` — the site and its navigation in one language. */
|
|
211
|
+
interface HelpPublicSitePayload {
|
|
212
|
+
site: HelpPublicSite;
|
|
213
|
+
/** The language the labels are in (`?lang=`: exact, base language, else the main one). */
|
|
214
|
+
locale: string;
|
|
215
|
+
/** The site's languages, main first (same as `site.languages`). */
|
|
216
|
+
languages: string[];
|
|
217
|
+
tree: HelpPublicTreeNode[];
|
|
218
|
+
}
|
|
219
|
+
/** A visible page without its text (`GET pages`: builds and sitemaps). */
|
|
220
|
+
interface HelpPublicPageSummary {
|
|
221
|
+
path: string;
|
|
222
|
+
slug: string;
|
|
223
|
+
title: string;
|
|
224
|
+
description: string | null;
|
|
225
|
+
icon: string | null;
|
|
226
|
+
/** The language this page's texts are in (falls back to the main language per page). */
|
|
227
|
+
locale: string;
|
|
228
|
+
/** The languages this page is offered in, main language first. */
|
|
229
|
+
languages: string[];
|
|
230
|
+
/** When it was first published (ISO 8601). */
|
|
231
|
+
publishedAt: string | null;
|
|
232
|
+
/** "Updated on", set deliberately by the authors; null when never set. */
|
|
233
|
+
contentUpdatedAt: string | null;
|
|
234
|
+
/** The last change of any kind (ISO 8601) — for sitemaps and caches. */
|
|
235
|
+
updatedAt: string;
|
|
236
|
+
/** The page on the docs website (`websiteUrl` + path), null without a website address. */
|
|
237
|
+
url: string | null;
|
|
238
|
+
}
|
|
239
|
+
/** `GET pages?lang=` — every visible page in reading order. */
|
|
240
|
+
interface HelpPublicPagesPayload {
|
|
241
|
+
locale: string;
|
|
242
|
+
languages: string[];
|
|
243
|
+
pages: HelpPublicPageSummary[];
|
|
244
|
+
}
|
|
245
|
+
/** A heading of the page, with the anchor id the `html` gives it. */
|
|
246
|
+
interface HelpPublicHeading {
|
|
247
|
+
level: number;
|
|
248
|
+
text: string;
|
|
249
|
+
id: string;
|
|
250
|
+
}
|
|
251
|
+
/** The directives a page uses (a website loads tab scripts only when needed). */
|
|
252
|
+
type HelpPublicBlock = "callout" | "steps" | "step" | "tabs" | "tab" | "cards" | "card";
|
|
253
|
+
/** A folder above a page, outermost first; `path` only when the folder has its own page. */
|
|
254
|
+
interface HelpPublicBreadcrumb {
|
|
255
|
+
title: string;
|
|
256
|
+
path: string | null;
|
|
257
|
+
}
|
|
258
|
+
/** The page before or after, in the tree's reading order (never across tabs). */
|
|
259
|
+
interface HelpPublicPageLink {
|
|
260
|
+
path: string;
|
|
261
|
+
title: string;
|
|
262
|
+
}
|
|
263
|
+
/** One page with its text. */
|
|
264
|
+
interface HelpPublicPage extends HelpPublicPageSummary {
|
|
265
|
+
/** The page's Markdown with directives (`:::callout`, `::::steps`, …). */
|
|
266
|
+
markdown: string;
|
|
267
|
+
/** Safe server-rendered HTML of `markdown` (stable `sd-*` classes for the directives). */
|
|
268
|
+
html: string;
|
|
269
|
+
headings: HelpPublicHeading[];
|
|
270
|
+
blocks: HelpPublicBlock[];
|
|
271
|
+
breadcrumbs: HelpPublicBreadcrumb[];
|
|
272
|
+
previous: HelpPublicPageLink | null;
|
|
273
|
+
next: HelpPublicPageLink | null;
|
|
274
|
+
}
|
|
275
|
+
/**
|
|
276
|
+
* `GET page?path=&lang=`. A path the page had before answers `301` with
|
|
277
|
+
* `Location` pointing at the new `page?path=` and the body {@link HelpPublicRedirect}.
|
|
278
|
+
*/
|
|
279
|
+
interface HelpPublicPagePayload {
|
|
280
|
+
page: HelpPublicPage;
|
|
281
|
+
}
|
|
282
|
+
/** The body of a `301` for a moved page. */
|
|
283
|
+
interface HelpPublicRedirect {
|
|
284
|
+
/** The page's current path. */
|
|
285
|
+
redirectTo: string;
|
|
286
|
+
}
|
|
287
|
+
/**
|
|
288
|
+
* A page as its preview shows it: any status, any visibility, translations as
|
|
289
|
+
* soon as they have a title. `path` is null while the page isn't placed in the
|
|
290
|
+
* navigation (then without breadcrumbs and neighbours).
|
|
291
|
+
*/
|
|
292
|
+
interface HelpPublicPreviewPage extends Omit<HelpPublicPage, "path"> {
|
|
293
|
+
path: string | null;
|
|
294
|
+
status: "draft" | "published" | "archived";
|
|
295
|
+
visibility: "public" | "internal";
|
|
296
|
+
}
|
|
297
|
+
/** `GET preview?token=&lang=` — never cached. */
|
|
298
|
+
interface HelpPublicPreviewPayload {
|
|
299
|
+
page: HelpPublicPreviewPage;
|
|
300
|
+
}
|
|
301
|
+
/** One search hit. Title hits rank above heading hits above text hits. */
|
|
302
|
+
interface HelpPublicSearchHit {
|
|
303
|
+
path: string;
|
|
304
|
+
title: string;
|
|
305
|
+
description: string | null;
|
|
306
|
+
/** Plain text around the first match (escape it before putting it into HTML). */
|
|
307
|
+
excerpt: string;
|
|
308
|
+
/** The best matching heading, for a `path#id` link. */
|
|
309
|
+
heading: {
|
|
310
|
+
id: string;
|
|
311
|
+
text: string;
|
|
312
|
+
} | null;
|
|
313
|
+
/** The page on the docs website, null without a website address. */
|
|
314
|
+
url: string | null;
|
|
315
|
+
}
|
|
316
|
+
/** `GET search?q=&lang=&limit=` — at most 20 hits, best first. */
|
|
317
|
+
interface HelpPublicSearchPayload {
|
|
318
|
+
query: string;
|
|
319
|
+
locale: string;
|
|
320
|
+
languages: string[];
|
|
321
|
+
hits: HelpPublicSearchHit[];
|
|
322
|
+
}
|
|
323
|
+
/** What a help webhook announces. */
|
|
324
|
+
type HelpWebhookEvent = "page.published" | "page.updated" | "page.unpublished" | "page.deleted" | "navigation.updated" | "ping";
|
|
325
|
+
/** The body of a help webhook call (verify it first — see `verifyHelpWebhook`). */
|
|
326
|
+
interface HelpWebhookBody {
|
|
327
|
+
event: HelpWebhookEvent;
|
|
328
|
+
/** The workspace slug, as in the public API path. */
|
|
329
|
+
workspace: string;
|
|
330
|
+
/** The doc site's slug, as in the public API path. */
|
|
331
|
+
site: string;
|
|
332
|
+
/** The page's path (null for `navigation.updated` and `ping`). */
|
|
333
|
+
path: string | null;
|
|
334
|
+
/** Earlier paths — their pages are stale too (for `navigation.updated`: every path that moved). */
|
|
335
|
+
previousPaths: string[];
|
|
336
|
+
/** The languages the page is offered in after the change (the site's for navigation). */
|
|
337
|
+
locales: string[];
|
|
338
|
+
occurredAt: string;
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
interface HelpClientOptions extends BaseClientOptions {
|
|
342
|
+
/** Your workspace's slug — the `acme` in `https://api.solutiondesk.io/v1/help/acme/docs`. */
|
|
343
|
+
workspace: string;
|
|
344
|
+
/** The doc site's slug — the `docs` in `https://api.solutiondesk.io/v1/help/acme/docs`. */
|
|
345
|
+
site: string;
|
|
346
|
+
/**
|
|
347
|
+
* The language to ask for by default (`de`, `en`, `de-AT` …). Each answer
|
|
348
|
+
* says in `locale` which language it really is in. Override per call.
|
|
349
|
+
*/
|
|
350
|
+
lang?: string;
|
|
351
|
+
}
|
|
352
|
+
interface LangParams {
|
|
353
|
+
/** The language to ask for; overrides the client's `lang`. */
|
|
354
|
+
lang?: string;
|
|
355
|
+
}
|
|
356
|
+
interface GetPageParams extends LangParams {
|
|
357
|
+
/**
|
|
358
|
+
* What to do when the path is an earlier address of a page (the API answers
|
|
359
|
+
* `301` with `{ redirectTo }`):
|
|
360
|
+
* - `"follow"` (default): return the page; `movedFrom` holds the path you asked for.
|
|
361
|
+
* - `"manual"`: return `{ redirectTo }` with the current path instead.
|
|
362
|
+
*/
|
|
363
|
+
redirect?: "follow" | "manual";
|
|
364
|
+
}
|
|
365
|
+
interface SearchParams extends LangParams {
|
|
366
|
+
/** At most this many hits, 1–20 (default 20). */
|
|
367
|
+
limit?: number;
|
|
368
|
+
}
|
|
369
|
+
/** A page fetched with `redirect: "follow"`. */
|
|
370
|
+
interface HelpPageResult extends HelpPublicPagePayload {
|
|
371
|
+
/**
|
|
372
|
+
* The path you asked for when the page has moved to `page.path` since
|
|
373
|
+
* (redirect your page there, e.g. with a 301); null when it hasn't.
|
|
374
|
+
*/
|
|
375
|
+
movedFrom: string | null;
|
|
376
|
+
}
|
|
377
|
+
interface HelpClient {
|
|
378
|
+
/** The workspace this client reads. */
|
|
379
|
+
readonly workspace: string;
|
|
380
|
+
/** The doc site this client reads (its slug). */
|
|
381
|
+
readonly siteSlug: string;
|
|
382
|
+
/** The site and its navigation tree in one language (`GET …/site`). */
|
|
383
|
+
site(params?: LangParams, options?: RequestOptions): Promise<HelpPublicSitePayload>;
|
|
384
|
+
/** Every visible page without its text, in reading order (`GET …/pages`) — builds and sitemaps. */
|
|
385
|
+
pages(params?: LangParams, options?: RequestOptions): Promise<HelpPublicPagesPayload>;
|
|
386
|
+
/**
|
|
387
|
+
* One visible page with its Markdown, HTML, headings, breadcrumbs and
|
|
388
|
+
* neighbours (`GET …/page?path=`). The home page has the path `""`.
|
|
389
|
+
* Throws a `SolutionDeskError` with status 404 for an unknown or hidden page.
|
|
390
|
+
*/
|
|
391
|
+
page(path: string, params?: GetPageParams & {
|
|
392
|
+
redirect?: "follow";
|
|
393
|
+
}, options?: RequestOptions): Promise<HelpPageResult>;
|
|
394
|
+
page(path: string, params: GetPageParams & {
|
|
395
|
+
redirect: "manual";
|
|
396
|
+
}, options?: RequestOptions): Promise<HelpPublicPagePayload | HelpPublicRedirect>;
|
|
397
|
+
/** One visible page as plain Markdown (`GET …/page.md?path=`), title and source on top. */
|
|
398
|
+
pageMarkdown(path: string, params?: LangParams, options?: RequestOptions): Promise<string>;
|
|
399
|
+
/** Search the visible pages (`GET …/search?q=`): title hits before heading hits before text hits. */
|
|
400
|
+
search(query: string, params?: SearchParams, options?: RequestOptions): Promise<HelpPublicSearchPayload>;
|
|
401
|
+
/**
|
|
402
|
+
* The current state of a page (also a draft or an internal page) for your
|
|
403
|
+
* preview route — the `token` from your preview address (valid for one hour).
|
|
404
|
+
* The API sends it with `Cache-Control: no-store`; in Next.js also pass
|
|
405
|
+
* `fetchOptions: { cache: "no-store" }`.
|
|
406
|
+
*/
|
|
407
|
+
preview(token: string, params?: LangParams, options?: RequestOptions): Promise<HelpPublicPreviewPayload>;
|
|
408
|
+
/** The site's index in the llms.txt format (`GET …/llms.txt`). */
|
|
409
|
+
llmsTxt(params?: LangParams, options?: RequestOptions): Promise<string>;
|
|
410
|
+
/** Every visible page as Markdown, one after the other (`GET …/llms-full.txt`). */
|
|
411
|
+
llmsFullTxt(params?: LangParams, options?: RequestOptions): Promise<string>;
|
|
412
|
+
}
|
|
413
|
+
/** A path as the API writes it: no leading or trailing slash, lower case. */
|
|
414
|
+
declare function normalizeHelpPath(path: string): string;
|
|
415
|
+
/**
|
|
416
|
+
* A client for the public help center API — no key, no login; only pages
|
|
417
|
+
* that are published, public and placed in the navigation. Safe in the
|
|
418
|
+
* browser and on the server.
|
|
419
|
+
*
|
|
420
|
+
* @example
|
|
421
|
+
* const help = createHelpClient({ workspace: "acme", site: "docs", lang: "en" });
|
|
422
|
+
* const { tree } = await help.site();
|
|
423
|
+
* const { page } = await help.page("guides/login");
|
|
424
|
+
*/
|
|
425
|
+
declare function createHelpClient(options: HelpClientOptions): HelpClient;
|
|
426
|
+
/**
|
|
427
|
+
* Verify a help webhook call and return its body — or `null` when the
|
|
428
|
+
* `X-SolutionDesk-Signature` header doesn't match (wrong secret, changed body,
|
|
429
|
+
* older than 5 minutes, malformed). Pass the raw body exactly as received.
|
|
430
|
+
*/
|
|
431
|
+
declare function verifyHelpWebhook(secret: string, rawBody: WebhookBody, signatureHeader: string | null | undefined, options?: VerifyWebhookOptions): Promise<HelpWebhookBody | null>;
|
|
432
|
+
|
|
433
|
+
export { type BaseClientOptions, type CachedResponse, DEFAULT_BASE_URL, EVENT_HEADER, type EtagCache, type FetchInitLike, type FetchLike, type FetchResponseLike, type GetPageParams, type HelpClient, type HelpClientOptions, type HelpPageResult, type HelpPublicBlock, type HelpPublicBreadcrumb, type HelpPublicHeading, type HelpPublicPage, type HelpPublicPageLink, type HelpPublicPagePayload, type HelpPublicPageSummary, type HelpPublicPagesPayload, type HelpPublicPreviewPage, type HelpPublicPreviewPayload, type HelpPublicRedirect, type HelpPublicSearchHit, type HelpPublicSearchPayload, type HelpPublicSite, type HelpPublicSitePayload, type HelpPublicTreeFolder, type HelpPublicTreeLink, type HelpPublicTreeNode, type HelpPublicTreePage, type HelpPublicTreeSeparator, type HelpWebhookBody, type HelpWebhookEvent, type LangParams, type RequestOptions, SIGNATURE_HEADER, type SearchParams, SolutionDeskError, type VerifyWebhookOptions, type WebhookBody, createHelpClient, createMemoryEtagCache, normalizeHelpPath, verifyHelpWebhook, verifyWebhookSignature };
|