@andesine/pages 0.0.0-stage → 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.
Files changed (110) hide show
  1. package/CHANGELOG.md +103 -0
  2. package/LICENSE +21 -0
  3. package/README.md +92 -2
  4. package/dist/answers.d.ts +6 -0
  5. package/dist/astro/content.astro +118 -0
  6. package/dist/astro/middleware.js +39 -0
  7. package/dist/astro/middleware.js.map +1 -0
  8. package/dist/astro/routes/answers.js +129 -0
  9. package/dist/astro/routes/answers.js.map +1 -0
  10. package/dist/astro/routes/entry-pages.js +22 -0
  11. package/dist/astro/routes/entry-pages.js.map +1 -0
  12. package/dist/astro/routes/llms-full.js +12 -0
  13. package/dist/astro/routes/llms-full.js.map +1 -0
  14. package/dist/astro/routes/llms.js +12 -0
  15. package/dist/astro/routes/llms.js.map +1 -0
  16. package/dist/astro/routes/markdown-alias.js +14 -0
  17. package/dist/astro/routes/markdown-alias.js.map +1 -0
  18. package/dist/astro/routes/markdown.js +12 -0
  19. package/dist/astro/routes/markdown.js.map +1 -0
  20. package/dist/astro/routes/not-found.astro +12 -0
  21. package/dist/astro/routes/robots.js +9 -0
  22. package/dist/astro/routes/robots.js.map +1 -0
  23. package/dist/astro/routes/search.js +42 -0
  24. package/dist/astro/routes/search.js.map +1 -0
  25. package/dist/astro/routes/sitemap.js +12 -0
  26. package/dist/astro/routes/sitemap.js.map +1 -0
  27. package/dist/astro/routes/skill.js +13 -0
  28. package/dist/astro/routes/skill.js.map +1 -0
  29. package/dist/astro/routes/skills.js +24 -0
  30. package/dist/astro/routes/skills.js.map +1 -0
  31. package/dist/astro/routes/social.js +91 -0
  32. package/dist/astro/routes/social.js.map +1 -0
  33. package/dist/astro/routes/static.astro +53 -0
  34. package/dist/astro/routes/well-known-llms.js +2 -0
  35. package/dist/astro.d.ts +34 -0
  36. package/dist/astro.js +60 -0
  37. package/dist/astro.js.map +1 -0
  38. package/dist/chunks/assets-D6WJmZ05.js +21 -0
  39. package/dist/chunks/assets-D6WJmZ05.js.map +1 -0
  40. package/dist/chunks/catalog-DU4BUrpw.js +28 -0
  41. package/dist/chunks/catalog-DU4BUrpw.js.map +1 -0
  42. package/dist/chunks/config-CuH5JSI4.js +184 -0
  43. package/dist/chunks/config-CuH5JSI4.js.map +1 -0
  44. package/dist/chunks/files-BxqiQzFj.js +62 -0
  45. package/dist/chunks/files-BxqiQzFj.js.map +1 -0
  46. package/dist/chunks/hash-D4piIIQ6.js +11 -0
  47. package/dist/chunks/hash-D4piIIQ6.js.map +1 -0
  48. package/dist/chunks/index-D8wL2B5s.d.ts +571 -0
  49. package/dist/chunks/index-vsu3hISM.d.ts +62 -0
  50. package/dist/chunks/limits-Ppc7BQPG.js +45 -0
  51. package/dist/chunks/limits-Ppc7BQPG.js.map +1 -0
  52. package/dist/chunks/markdown-DKJSQxR2.js +42 -0
  53. package/dist/chunks/markdown-DKJSQxR2.js.map +1 -0
  54. package/dist/chunks/mdx-components-CUUDTapN.d.ts +9 -0
  55. package/dist/chunks/normalize-DG5nxOLm.js +361 -0
  56. package/dist/chunks/normalize-DG5nxOLm.js.map +1 -0
  57. package/dist/chunks/paths-75QgA3Qs.js +16 -0
  58. package/dist/chunks/paths-75QgA3Qs.js.map +1 -0
  59. package/dist/chunks/prepare-lnuw_ycM.js +219 -0
  60. package/dist/chunks/prepare-lnuw_ycM.js.map +1 -0
  61. package/dist/chunks/read-DCv1lmcM.js +57 -0
  62. package/dist/chunks/read-DCv1lmcM.js.map +1 -0
  63. package/dist/chunks/request-DOuBHGQs.js +92 -0
  64. package/dist/chunks/request-DOuBHGQs.js.map +1 -0
  65. package/dist/chunks/response-CtzaKMWH.js +15 -0
  66. package/dist/chunks/response-CtzaKMWH.js.map +1 -0
  67. package/dist/chunks/site-DY-uZ0PP.js +419 -0
  68. package/dist/chunks/site-DY-uZ0PP.js.map +1 -0
  69. package/dist/chunks/skill-CBTGUHQH.js +85 -0
  70. package/dist/chunks/skill-CBTGUHQH.js.map +1 -0
  71. package/dist/chunks/sources-Cm6NdIen.js +236 -0
  72. package/dist/chunks/sources-Cm6NdIen.js.map +1 -0
  73. package/dist/chunks/stored-CabomV-C.js +354 -0
  74. package/dist/chunks/stored-CabomV-C.js.map +1 -0
  75. package/dist/chunks/stored-CcEfvCQH.js +475 -0
  76. package/dist/chunks/stored-CcEfvCQH.js.map +1 -0
  77. package/dist/chunks/types-DBzuXfSe.d.ts +53 -0
  78. package/dist/chunks/view-C-9ZM1zK.js +745 -0
  79. package/dist/chunks/view-C-9ZM1zK.js.map +1 -0
  80. package/dist/chunks/view-Dlf_VRI7.d.ts +151 -0
  81. package/dist/client.d.ts +73 -0
  82. package/dist/client.js +295 -0
  83. package/dist/client.js.map +1 -0
  84. package/dist/collections.d.ts +7 -0
  85. package/dist/collections.js +215 -0
  86. package/dist/collections.js.map +1 -0
  87. package/dist/entry-pages.d.ts +10 -0
  88. package/dist/index.d.ts +5 -0
  89. package/dist/index.js +38 -0
  90. package/dist/index.js.map +1 -0
  91. package/dist/integration.d.ts +16 -0
  92. package/dist/integration.js +435 -0
  93. package/dist/integration.js.map +1 -0
  94. package/dist/llms-full.d.ts +5 -0
  95. package/dist/llms.d.ts +5 -0
  96. package/dist/markdown-alias.d.ts +7 -0
  97. package/dist/markdown.d.ts +7 -0
  98. package/dist/middleware.d.ts +8 -0
  99. package/dist/robots.d.ts +5 -0
  100. package/dist/runtime.d.ts +81 -0
  101. package/dist/runtime.js +56 -0
  102. package/dist/runtime.js.map +1 -0
  103. package/dist/scripts/restore-navigation.js +1 -0
  104. package/dist/search.d.ts +6 -0
  105. package/dist/sitemap.d.ts +5 -0
  106. package/dist/skill.d.ts +5 -0
  107. package/dist/skills.d.ts +10 -0
  108. package/dist/social.d.ts +7 -0
  109. package/dist/well-known-llms.d.ts +2 -0
  110. package/package.json +103 -3
@@ -0,0 +1,571 @@
1
+ import { z } from "zod";
2
+ import { Root } from "hast";
3
+ //#region src/config/schema.d.ts
4
+ declare const linkSchema: z.ZodObject<{
5
+ label: z.ZodString;
6
+ href: z.ZodString;
7
+ icon: z.ZodOptional<z.ZodString>;
8
+ }, z.core.$strict>;
9
+ declare const pageActionsSchema: z.ZodObject<{
10
+ openIn: z.ZodDefault<z.ZodArray<z.ZodEnum<{
11
+ chatgpt: "chatgpt";
12
+ claude: "claude";
13
+ perplexity: "perplexity";
14
+ }>>>;
15
+ }, z.core.$strict>;
16
+ declare const configSchema: z.ZodObject<{
17
+ name: z.ZodString;
18
+ description: z.ZodOptional<z.ZodString>;
19
+ site: z.ZodURL;
20
+ base: z.ZodDefault<z.ZodString>;
21
+ language: z.ZodDefault<z.ZodString>;
22
+ logo: z.ZodOptional<z.ZodObject<{
23
+ src: z.ZodString;
24
+ format: z.ZodDefault<z.ZodEnum<{
25
+ icon: "icon";
26
+ full: "full";
27
+ }>>;
28
+ alt: z.ZodOptional<z.ZodString>;
29
+ title: z.ZodDefault<z.ZodBoolean>;
30
+ }, z.core.$strict>>;
31
+ favicon: z.ZodOptional<z.ZodString>;
32
+ brand: z.ZodPrefault<z.ZodObject<{
33
+ primary: z.ZodDefault<z.ZodString>;
34
+ secondary: z.ZodDefault<z.ZodString>;
35
+ tertiary: z.ZodDefault<z.ZodString>;
36
+ }, z.core.$strict>>;
37
+ links: z.ZodDefault<z.ZodArray<z.ZodObject<{
38
+ label: z.ZodString;
39
+ href: z.ZodString;
40
+ icon: z.ZodString;
41
+ }, z.core.$strict>>>;
42
+ cta: z.ZodOptional<z.ZodObject<{
43
+ label: z.ZodString;
44
+ href: z.ZodString;
45
+ icon: z.ZodOptional<z.ZodString>;
46
+ }, z.core.$strict>>;
47
+ socialLinks: z.ZodDefault<z.ZodArray<z.ZodObject<{
48
+ label: z.ZodString;
49
+ href: z.ZodString;
50
+ icon: z.ZodString;
51
+ }, z.core.$strict>>>;
52
+ sections: z.ZodDefault<z.ZodArray<z.ZodObject<{
53
+ id: z.ZodString;
54
+ label: z.ZodString;
55
+ icon: z.ZodOptional<z.ZodString>;
56
+ sources: z.ZodArray<z.ZodString>;
57
+ links: z.ZodDefault<z.ZodArray<z.ZodObject<{
58
+ label: z.ZodString;
59
+ href: z.ZodString;
60
+ icon: z.ZodString;
61
+ }, z.core.$strict>>>;
62
+ }, z.core.$strict>>>;
63
+ sectionsDisplay: z.ZodDefault<z.ZodEnum<{
64
+ tabs: "tabs";
65
+ navigation: "navigation";
66
+ }>>;
67
+ sources: z.ZodDefault<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
68
+ id: z.ZodString;
69
+ type: z.ZodLiteral<"files">;
70
+ directory: z.ZodString;
71
+ mount: z.ZodDefault<z.ZodString>;
72
+ }, z.core.$strict>, z.ZodObject<{
73
+ id: z.ZodString;
74
+ type: z.ZodLiteral<"andesine">;
75
+ collection: z.ZodString;
76
+ mount: z.ZodDefault<z.ZodString>;
77
+ apiURL: z.ZodOptional<z.ZodURL>;
78
+ apiKeyEnv: z.ZodDefault<z.ZodString>;
79
+ answers: z.ZodDefault<z.ZodBoolean>;
80
+ publicKey: z.ZodOptional<z.ZodString>;
81
+ }, z.core.$strict>, z.ZodObject<{
82
+ id: z.ZodString;
83
+ type: z.ZodLiteral<"openapi">;
84
+ spec: z.ZodString;
85
+ mount: z.ZodDefault<z.ZodString>;
86
+ tagPages: z.ZodDefault<z.ZodBoolean>;
87
+ }, z.core.$strict>], "type">>>;
88
+ pageActions: z.ZodPrefault<z.ZodUnion<readonly [z.ZodLiteral<false>, z.ZodObject<{
89
+ openIn: z.ZodDefault<z.ZodArray<z.ZodEnum<{
90
+ chatgpt: "chatgpt";
91
+ claude: "claude";
92
+ perplexity: "perplexity";
93
+ }>>>;
94
+ }, z.core.$strict>]>>;
95
+ agents: z.ZodPrefault<z.ZodObject<{
96
+ instructions: z.ZodOptional<z.ZodString>;
97
+ skill: z.ZodOptional<z.ZodString>;
98
+ }, z.core.$strict>>;
99
+ social: z.ZodPrefault<z.ZodObject<{
100
+ image: z.ZodOptional<z.ZodString>;
101
+ generate: z.ZodDefault<z.ZodBoolean>;
102
+ background: z.ZodOptional<z.ZodString>;
103
+ }, z.core.$strict>>;
104
+ }, z.core.$strict>;
105
+ type PagesConfigInput = z.input<typeof configSchema>;
106
+ type PagesConfig = z.output<typeof configSchema>;
107
+ type SourceConfig = PagesConfig["sources"][number];
108
+ type FilesSourceConfig = Extract<SourceConfig, {
109
+ type: "files";
110
+ }>;
111
+ type AndesineSourceConfig = Extract<SourceConfig, {
112
+ type: "andesine";
113
+ }>;
114
+ type OpenAPISourceConfig = Extract<SourceConfig, {
115
+ type: "openapi";
116
+ }>;
117
+ type SectionConfig = PagesConfig["sections"][number];
118
+ type LinkConfig = z.output<typeof linkSchema>;
119
+ type IconLinkConfig = PagesConfig["links"][number];
120
+ type AIService = z.output<typeof pageActionsSchema>["openIn"][number];
121
+ //#endregion
122
+ //#region src/config/index.d.ts
123
+ declare const parseConfig: (input: unknown, source?: string) => PagesConfig;
124
+ declare const defineConfig: (input: PagesConfigInput) => PagesConfig;
125
+ //#endregion
126
+ //#region src/context/types.d.ts
127
+ interface SiteLogo {
128
+ src: string;
129
+ /** A square mark next to the site name, or a full wordmark before it. */
130
+ format: "icon" | "full";
131
+ /** The text in a full logo, for screen readers. */
132
+ alt?: string;
133
+ /** Shows the site name after the logo. */
134
+ title: boolean;
135
+ }
136
+ /** Direct access to the Andesine API with a publishable key, in place of the server routes. */
137
+ interface AndesineAPIContext {
138
+ /** Base URL of the API. */
139
+ url: string;
140
+ /** The publishable key; it is safe in browsers. */
141
+ key: string;
142
+ /** ID of the published collection. */
143
+ collection: string;
144
+ /** Base-prefixed URL of the JSON map from entry IDs to page URLs. */
145
+ pages: string;
146
+ }
147
+ interface SearchSourceContext {
148
+ id: string;
149
+ /** Group label in results: the section label, or the site name. */
150
+ label: string;
151
+ /** Pagefind for local pages, or the Andesine search endpoint. */
152
+ type: "pagefind" | "andesine";
153
+ /** Set when the source has a publishable key; the browser then calls the API. */
154
+ api?: AndesineAPIContext;
155
+ }
156
+ interface AnswersContext {
157
+ endpoint: string;
158
+ /** ID of the source that answers questions. */
159
+ source: string;
160
+ /** Set when the source has a publishable key; the browser then calls the API. */
161
+ api?: AndesineAPIContext;
162
+ }
163
+ interface SearchContext {
164
+ sources: SearchSourceContext[];
165
+ endpoint: string;
166
+ /** Base-prefixed URL of the Pagefind directory. */
167
+ pagefind: string;
168
+ /** Undefined when no Andesine source has AI answers. */
169
+ answers?: AnswersContext;
170
+ }
171
+ interface SiteContext {
172
+ name: string;
173
+ description?: string;
174
+ language: string;
175
+ /** Base-prefixed URL of the home page. */
176
+ href: string;
177
+ /** Absolute URL of the home page. */
178
+ url: string;
179
+ /** A prefix for browser storage keys, unique for each site. */
180
+ storageKey: string;
181
+ logo?: SiteLogo;
182
+ favicon?: string;
183
+ /** Where sections show: tabs in the header, or links at the top of the navigation. */
184
+ sectionsDisplay: "tabs" | "navigation";
185
+ links: IconLinkConfig[];
186
+ cta?: LinkConfig;
187
+ socialLinks: IconLinkConfig[];
188
+ /** Undefined when no source is searchable. */
189
+ search?: SearchContext;
190
+ }
191
+ interface SectionContext {
192
+ id: string;
193
+ label: string;
194
+ icon?: string;
195
+ href: string;
196
+ current: boolean;
197
+ }
198
+ interface NavigationItem {
199
+ id: string;
200
+ label: string;
201
+ /** Groups without a landing page have no URL. */
202
+ href?: string;
203
+ /** The HTTP method of an API operation, e.g. `get`. */
204
+ method?: string;
205
+ current: boolean;
206
+ /** The item contains the current page. */
207
+ active: boolean;
208
+ children: NavigationItem[];
209
+ }
210
+ interface BreadcrumbItem {
211
+ label: string;
212
+ href?: string;
213
+ }
214
+ interface HeadingContext {
215
+ id: string;
216
+ text: string;
217
+ depth: number;
218
+ }
219
+ interface PageLink {
220
+ label: string;
221
+ href: string;
222
+ }
223
+ interface PageMeta {
224
+ /** The document title: the page title, then the site name. */
225
+ title: string;
226
+ /** The page description, or else the site description. */
227
+ description?: string;
228
+ /** The Open Graph type: `website` for the home page, `article` for other pages. */
229
+ type: "website" | "article";
230
+ }
231
+ interface PageFragments {
232
+ /** The page has a `summary` slot with content. */
233
+ summary: boolean;
234
+ /** The page has an `aside` slot with content. */
235
+ aside: boolean;
236
+ }
237
+ interface SocialImage {
238
+ /** Absolute URL of the image. */
239
+ url: string;
240
+ /** Known for generated images. */
241
+ width?: number;
242
+ height?: number;
243
+ }
244
+ interface OpenInLink {
245
+ id: AIService;
246
+ label: string;
247
+ /** Opens the service with the page's Markdown alternative as context. */
248
+ href: string;
249
+ }
250
+ interface PageActionsContext {
251
+ openIn: OpenInLink[];
252
+ }
253
+ interface PageContext {
254
+ site: SiteContext;
255
+ title: string;
256
+ description?: string;
257
+ meta: PageMeta;
258
+ fragments: PageFragments;
259
+ /** `reference` fills the content area on wide screens, for API operations and their examples. */
260
+ layout: "docs" | "wide" | "reference";
261
+ sections: SectionContext[];
262
+ /** Links at the top of the navigation: the site's links, then the current section's. */
263
+ links: IconLinkConfig[];
264
+ navigation: NavigationItem[];
265
+ /** The groups that contain the page, from the section root. */
266
+ breadcrumbs: BreadcrumbItem[];
267
+ headings: HeadingContext[];
268
+ previous?: PageLink;
269
+ next?: PageLink;
270
+ /** Absolute URL of the page; undefined for the not-found page. */
271
+ canonical?: string;
272
+ /** URL of the page's Markdown alternative; undefined for the not-found page. */
273
+ markdown?: string;
274
+ /** Undefined when page actions are off, or for the not-found page. */
275
+ actions?: PageActionsContext;
276
+ /** ISO date of the last content change, when known. */
277
+ updatedAt?: string;
278
+ /** Search engines must not index the page: it is hidden from search, or not found. */
279
+ noindex?: boolean;
280
+ /** schema.org JSON-LD, safe to put in a `<script type="application/ld+json">`. */
281
+ structuredData?: string;
282
+ /** The image for link previews: generated for the page, or the configured default. */
283
+ image?: SocialImage;
284
+ }
285
+ //#endregion
286
+ //#region src/context/site.d.ts
287
+ declare const createSiteContext: (config: PagesConfig) => SiteContext;
288
+ //#endregion
289
+ //#region src/sources/openapi/model.d.ts
290
+ interface ApiModel {
291
+ title: string;
292
+ version: string;
293
+ /** Markdown. */
294
+ description?: string;
295
+ servers: ApiServer[];
296
+ securitySchemes: ApiSecurityScheme[];
297
+ /** Tags in the order of the spec's `tags`, then in order of first use. */
298
+ tags: ApiTag[];
299
+ operations: ApiOperation[];
300
+ /** Named schemas, which `ApiSchema.ref` points to. */
301
+ schemas: Record<string, ApiSchema>;
302
+ }
303
+ interface ApiServer {
304
+ /** Absolute URL with server variables resolved. */
305
+ url: string;
306
+ description?: string;
307
+ }
308
+ interface ApiSecurityScheme {
309
+ id: string;
310
+ type: string;
311
+ /** Markdown. */
312
+ description?: string;
313
+ /** For `http` schemes, e.g. `bearer`. */
314
+ scheme?: string;
315
+ bearerFormat?: string;
316
+ /** For `apiKey` schemes: the name and place of the key. */
317
+ name?: string;
318
+ in?: string;
319
+ }
320
+ interface ApiTag {
321
+ name: string;
322
+ label: string;
323
+ /** Markdown. */
324
+ description?: string;
325
+ }
326
+ interface ApiOperation {
327
+ /** The `operationId`, or `{method}-{path}` without one. */
328
+ id: string;
329
+ method: string;
330
+ path: string;
331
+ summary?: string;
332
+ /** Markdown. */
333
+ description?: string;
334
+ deprecated: boolean;
335
+ tags: string[];
336
+ parameters: ApiParameter[];
337
+ requestBody?: ApiRequestBody;
338
+ responses: ApiResponse[];
339
+ /** Alternative requirements; each maps scheme IDs to scopes. Empty means no authentication. */
340
+ security: Array<Record<string, string[]>>;
341
+ servers: ApiServer[];
342
+ /** From `x-codeSamples` or `x-code-samples`. */
343
+ codeSamples: ApiCodeSample[];
344
+ /** The `x-` fields of the operation. */
345
+ extensions: Record<string, unknown>;
346
+ }
347
+ interface ApiParameter {
348
+ name: string;
349
+ in: "path" | "query" | "header" | "cookie";
350
+ required: boolean;
351
+ deprecated: boolean;
352
+ /** Markdown. */
353
+ description?: string;
354
+ schema?: ApiSchema;
355
+ examples: ApiExample[];
356
+ /** The media type of a parameter with `content`, whose values are written in that type. */
357
+ mediaType?: string;
358
+ /** How values are written, e.g. `form` or `deepObject`; unset for the default of the place. */
359
+ style?: string;
360
+ explode?: boolean;
361
+ }
362
+ interface ApiRequestBody {
363
+ required: boolean;
364
+ /** Markdown. */
365
+ description?: string;
366
+ contents: ApiMediaType[];
367
+ }
368
+ interface ApiResponse {
369
+ /** A status code, a range such as `4XX`, or `default`. */
370
+ status: string;
371
+ /** Markdown. */
372
+ description?: string;
373
+ headers: ApiHeader[];
374
+ contents: ApiMediaType[];
375
+ }
376
+ interface ApiHeader {
377
+ name: string;
378
+ required: boolean;
379
+ /** Markdown. */
380
+ description?: string;
381
+ schema?: ApiSchema;
382
+ }
383
+ interface ApiMediaType {
384
+ type: string;
385
+ schema?: ApiSchema;
386
+ examples: ApiExample[];
387
+ encoding?: Record<string, ApiEncoding>;
388
+ }
389
+ interface ApiEncoding {
390
+ contentType?: string;
391
+ style?: string;
392
+ explode?: boolean;
393
+ }
394
+ interface ApiExample {
395
+ name?: string;
396
+ summary?: string;
397
+ value: unknown;
398
+ }
399
+ interface ApiCodeSample {
400
+ lang: string;
401
+ label: string;
402
+ source: string;
403
+ }
404
+ /** A JSON Schema with 3.0 and 3.1 differences removed, e.g. `nullable` is a `null` type. */
405
+ interface ApiSchema {
406
+ /**
407
+ * The name of a schema in `ApiModel.schemas`. Only annotations can be set with it: the
408
+ * description, default, examples, and the deprecated, read-only, and write-only flags.
409
+ */
410
+ ref?: string;
411
+ type?: string[];
412
+ format?: string;
413
+ /** OpenAPI 3.1 content of a string, e.g. `image/png` for a file. */
414
+ contentMediaType?: string;
415
+ contentEncoding?: string;
416
+ title?: string;
417
+ /** Markdown. */
418
+ description?: string;
419
+ enum?: unknown[];
420
+ const?: unknown;
421
+ default?: unknown;
422
+ examples?: unknown[];
423
+ deprecated?: boolean;
424
+ readOnly?: boolean;
425
+ writeOnly?: boolean;
426
+ required?: string[];
427
+ properties?: ApiProperty[];
428
+ additionalProperties?: ApiSchema | boolean;
429
+ items?: ApiSchema;
430
+ allOf?: ApiSchema[];
431
+ oneOf?: ApiSchema[];
432
+ anyOf?: ApiSchema[];
433
+ not?: ApiSchema;
434
+ discriminator?: {
435
+ propertyName: string;
436
+ mapping?: Record<string, string>;
437
+ };
438
+ /** Validation keywords, such as `minimum` or `pattern`. */
439
+ constraints?: Record<string, unknown>;
440
+ }
441
+ interface ApiProperty {
442
+ name: string;
443
+ required: boolean;
444
+ schema: ApiSchema;
445
+ }
446
+ //#endregion
447
+ //#region src/sources/openapi/markdown.d.ts
448
+ interface OpenAPILinks {
449
+ /** URL paths by operation ID. */
450
+ operations: Record<string, string>;
451
+ /** URL paths of tag landing pages by tag name. */
452
+ tags: Record<string, string>;
453
+ }
454
+ //#endregion
455
+ //#region src/sources/types.d.ts
456
+ interface FileEntry {
457
+ id: string;
458
+ data: Record<string, unknown>;
459
+ /** Raw Markdown or MDX source. */
460
+ body?: string;
461
+ }
462
+ interface FileContent {
463
+ type: "file";
464
+ /** Astro collection entry, rendered with `render()`. */
465
+ entry: FileEntry;
466
+ }
467
+ interface AndesineContent {
468
+ type: "andesine";
469
+ /** HTML syntax tree, rendered with the template's content components. */
470
+ nodes: Root;
471
+ headings: HeadingContext[];
472
+ iconCSS: string;
473
+ /** Introduction content, before the body. */
474
+ summary?: Root;
475
+ /** Supporting content, after the body. */
476
+ aside?: Root;
477
+ }
478
+ interface OpenAPIContent {
479
+ type: "openapi";
480
+ /** The whole API, which the page's schemas refer to. */
481
+ model: ApiModel;
482
+ links: OpenAPILinks;
483
+ /** Set on operation pages. */
484
+ operation?: ApiOperation;
485
+ /** Set on tag landing pages. */
486
+ tag?: ApiTag;
487
+ }
488
+ interface SourcePage {
489
+ sourceID: string;
490
+ id: string;
491
+ /** Base-prefixed, encoded URL path with a trailing slash. */
492
+ href: string;
493
+ title: string;
494
+ description?: string;
495
+ toc: boolean;
496
+ layout: "docs" | "wide" | "reference";
497
+ /** Leaves the page out of search. Search results are not access control. */
498
+ searchHidden: boolean;
499
+ /** The page's Markdown alternative, without the title and description. */
500
+ markdown: string;
501
+ /** ISO date of the last content change, when known. */
502
+ updatedAt?: string;
503
+ content: FileContent | AndesineContent | OpenAPIContent;
504
+ }
505
+ interface SourceNode {
506
+ id: string;
507
+ label: string;
508
+ /** The page of a leaf, or the landing page of a group. */
509
+ page?: SourcePage;
510
+ /** The HTTP method of an API operation, e.g. `get`. */
511
+ method?: string;
512
+ /** Present for groups only. */
513
+ children?: SourceNode[];
514
+ }
515
+ interface SourceData {
516
+ id: string;
517
+ /** Base-prefixed URL path of the source mount. */
518
+ href: string;
519
+ /** All pages, including pages that are hidden from navigation. */
520
+ pages: SourcePage[];
521
+ navigation: SourceNode[];
522
+ }
523
+ //#endregion
524
+ //#region src/navigation/sections.d.ts
525
+ interface Section {
526
+ id: string;
527
+ label: string;
528
+ icon?: string;
529
+ links: IconLinkConfig[];
530
+ /** URL of the first page, or of the first source mount. */
531
+ href: string;
532
+ sources: SourceData[];
533
+ navigation: SourceNode[];
534
+ }
535
+ //#endregion
536
+ //#region src/routing/routes.d.ts
537
+ interface PageRoute {
538
+ type: "page";
539
+ href: string;
540
+ page: SourcePage;
541
+ section: Section;
542
+ }
543
+ interface RedirectRoute {
544
+ type: "redirect";
545
+ href: string;
546
+ target: string;
547
+ }
548
+ //#endregion
549
+ //#region src/context/page.d.ts
550
+ interface PageContextOptions {
551
+ site: SiteContext;
552
+ /** Configured sections; empty when the site uses the implicit section. */
553
+ sections: Section[];
554
+ route: PageRoute;
555
+ pageActions: PagesConfig["pageActions"];
556
+ image?: SocialImage;
557
+ }
558
+ declare const toSectionContexts: (sections: Section[], current?: Section) => SectionContext[];
559
+ /** Creates the page context without headings, which exist only after rendering. */
560
+ declare const createPageContext: (options: PageContextOptions) => Omit<PageContext, "headings">;
561
+ //#endregion
562
+ //#region src/context/meta.d.ts
563
+ /** The document title, description, and type of a page. */
564
+ declare const createPageMeta: (site: SiteContext, page: {
565
+ title: string;
566
+ description?: string;
567
+ href?: string;
568
+ }) => PageMeta;
569
+ //#endregion
570
+ export { FilesSourceConfig as A, SiteContext as C, parseConfig as D, defineConfig as E, PagesConfigInput as F, SectionConfig as I, SourceConfig as L, LinkConfig as M, OpenAPISourceConfig as N, AIService as O, PagesConfig as P, configSchema as R, SectionContext as S, SocialImage as T, PageFragments as _, SourcePage as a, SearchContext as b, createSiteContext as c, BreadcrumbItem as d, HeadingContext as f, PageContext as g, PageActionsContext as h, RedirectRoute as i, IconLinkConfig as j, AndesineSourceConfig as k, AndesineAPIContext as l, OpenInLink as m, createPageContext as n, ApiModel as o, NavigationItem as p, toSectionContexts as r, ApiOperation as s, createPageMeta as t, AnswersContext as u, PageLink as v, SiteLogo as w, SearchSourceContext as x, PageMeta as y };
571
+ //# sourceMappingURL=index-D8wL2B5s.d.ts.map
@@ -0,0 +1,62 @@
1
+ import { P as PagesConfig, a as SourcePage, g as PageContext, i as RedirectRoute } from "./index-D8wL2B5s.js";
2
+ import { g as HighlightOptions, r as OperationView } from "./view-Dlf_VRI7.js";
3
+ import { n as SocialCardData } from "./types-DBzuXfSe.js";
4
+ import { Root } from "hast";
5
+ //#region src/site/index.d.ts
6
+ interface PageRouteData {
7
+ type: "page";
8
+ content: SourcePage["content"];
9
+ toc: boolean;
10
+ sourceID: string;
11
+ /** The page is in the Pagefind index. */
12
+ indexed: boolean;
13
+ /** The Markdown alternative, with the title and description. */
14
+ markdown: string;
15
+ context: Omit<PageContext, "headings">;
16
+ }
17
+ interface StaticPath {
18
+ params: {
19
+ path?: string;
20
+ };
21
+ props: {
22
+ route: PageRouteData | RedirectRoute;
23
+ };
24
+ }
25
+ interface MarkdownPath {
26
+ params: {
27
+ path?: string;
28
+ };
29
+ props: {
30
+ markdown: string;
31
+ };
32
+ }
33
+ interface SocialPath {
34
+ params: {
35
+ path?: string;
36
+ };
37
+ props: {
38
+ data: SocialData;
39
+ };
40
+ }
41
+ interface RenderedRoute {
42
+ /** Astro content of a file page. */
43
+ Content?: unknown;
44
+ /** The operation of an OpenAPI operation page. */
45
+ operation?: OperationView;
46
+ /** HTML syntax tree of an Andesine page, or of an OpenAPI overview or tag page. */
47
+ nodes?: Root;
48
+ summary?: Root;
49
+ aside?: Root;
50
+ /** CSS for icons in the Andesine content. */
51
+ iconCSS?: string;
52
+ page: PageContext;
53
+ }
54
+ /** Card data without the configured images and brand, which the route adds. */
55
+ type SocialData = Omit<SocialCardData, "logo" | "showSiteName" | "logoFormat" | "background" | "brand">;
56
+ declare const getStaticPaths: (config: PagesConfig) => Promise<StaticPath[]>;
57
+ /** The context of the not-found page, with the navigation of the first section. */
58
+ declare const getNotFoundContext: (config: PagesConfig) => Promise<PageContext>;
59
+ declare const renderRoute: (route: PageRouteData, highlight: HighlightOptions) => Promise<RenderedRoute>;
60
+ //#endregion
61
+ export { renderRoute as a, getStaticPaths as i, SocialPath as n, getNotFoundContext as r, MarkdownPath as t };
62
+ //# sourceMappingURL=index-vsu3hISM.d.ts.map
@@ -0,0 +1,45 @@
1
+ //#region src/search/items.ts
2
+ const toAnchorHash = (anchor) => anchor ? `#${encodeURIComponent(anchor)}` : "";
3
+ /** Maps search results to page links; results without a page are left out. */
4
+ const toSearchItems = (results, resolve) => {
5
+ return results.flatMap((result) => {
6
+ const href = resolve(result);
7
+ const hash = toAnchorHash(result.anchor);
8
+ if (!href) return [];
9
+ return [{
10
+ id: `${result.entryID}${hash}`,
11
+ href: `${href}${hash}`,
12
+ title: result.title,
13
+ excerpt: result.snippet,
14
+ headingPath: result.headingPath
15
+ }];
16
+ });
17
+ };
18
+ /** Maps the pages that an answer cites to page links; sources without a page are left out. */
19
+ const toAnswerSources = (sources, resolve) => {
20
+ return sources.flatMap((source) => {
21
+ const href = resolve(source);
22
+ if (!href) return [];
23
+ return [{
24
+ id: source.id,
25
+ href: `${href}${toAnchorHash(source.anchor)}`,
26
+ title: source.title,
27
+ headingPath: source.headingPath,
28
+ collectionPath: source.collectionPath
29
+ }];
30
+ });
31
+ };
32
+ //#endregion
33
+ //#region src/search/limits.ts
34
+ /** Used-up monthly quotas and spending limits show as unavailable, not as rate limits. */
35
+ const isRateLimited = (status, data) => {
36
+ const limit = data?.limit;
37
+ return status === 429 && (limit === void 0 || limit === "rate");
38
+ };
39
+ const readErrorData = async (response) => {
40
+ return (await response.json().catch(() => null))?.data;
41
+ };
42
+ //#endregion
43
+ export { toSearchItems as i, readErrorData as n, toAnswerSources as r, isRateLimited as t };
44
+
45
+ //# sourceMappingURL=limits-Ppc7BQPG.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"limits-Ppc7BQPG.js","names":[],"sources":["../../src/search/items.ts","../../src/search/limits.ts"],"sourcesContent":["import type { PublishedAnswerSource, PublishedSearchResult } from \"@andesine/sdk\";\nimport type { AnswerSource, SearchItem } from \"./types\";\n\n/** Maps an entry to its page URL; entries without a page give `undefined`. */\ntype PageResolver = (result: Pick<PublishedSearchResult, \"entryID\">) => string | undefined;\ntype SearchResult = Pick<\n PublishedSearchResult,\n \"entryID\" | \"anchor\" | \"title\" | \"snippet\" | \"headingPath\"\n>;\ntype CitedSource = Pick<\n PublishedAnswerSource,\n \"id\" | \"entryID\" | \"anchor\" | \"title\" | \"headingPath\" | \"collectionPath\"\n>;\n\nconst toAnchorHash = (anchor?: string): string => (anchor ? `#${encodeURIComponent(anchor)}` : \"\");\n/** Maps search results to page links; results without a page are left out. */\nconst toSearchItems = (results: SearchResult[], resolve: PageResolver): SearchItem[] => {\n return results.flatMap((result) => {\n const href = resolve(result);\n const hash = toAnchorHash(result.anchor);\n\n if (!href) return [];\n\n return [\n {\n id: `${result.entryID}${hash}`,\n href: `${href}${hash}`,\n title: result.title,\n excerpt: result.snippet,\n headingPath: result.headingPath\n }\n ];\n });\n};\n/** Maps the pages that an answer cites to page links; sources without a page are left out. */\nconst toAnswerSources = (sources: CitedSource[], resolve: PageResolver): AnswerSource[] => {\n return sources.flatMap((source) => {\n const href = resolve(source);\n\n if (!href) return [];\n\n return [\n {\n id: source.id,\n href: `${href}${toAnchorHash(source.anchor)}`,\n title: source.title,\n headingPath: source.headingPath,\n collectionPath: source.collectionPath\n }\n ];\n });\n};\n\nexport { toAnchorHash, toSearchItems, toAnswerSources };\nexport type { PageResolver };\n","/** Used-up monthly quotas and spending limits show as unavailable, not as rate limits. */\nconst isRateLimited = (status: number, data: unknown): boolean => {\n const limit = (data as { limit?: string } | null | undefined)?.limit;\n\n return status === 429 && (limit === undefined || limit === \"rate\");\n};\nconst readErrorData = async (response: Response): Promise<unknown> => {\n const body = (await response.json().catch(() => null)) as { data?: unknown } | null;\n\n return body?.data;\n};\n\nexport { isRateLimited, readErrorData };\n"],"mappings":";AAcA,MAAM,gBAAgB,WAA6B,SAAS,IAAI,mBAAmB,MAAM,MAAM;;AAE/F,MAAM,iBAAiB,SAAyB,YAAwC;CACtF,OAAO,QAAQ,SAAS,WAAW;EACjC,MAAM,OAAO,QAAQ,MAAM;EAC3B,MAAM,OAAO,aAAa,OAAO,MAAM;EAEvC,IAAI,CAAC,MAAM,OAAO,CAAC;EAEnB,OAAO,CACL;GACE,IAAI,GAAG,OAAO,UAAU;GACxB,MAAM,GAAG,OAAO;GAChB,OAAO,OAAO;GACd,SAAS,OAAO;GAChB,aAAa,OAAO;EACtB,CACF;CACF,CAAC;AACH;;AAEA,MAAM,mBAAmB,SAAwB,YAA0C;CACzF,OAAO,QAAQ,SAAS,WAAW;EACjC,MAAM,OAAO,QAAQ,MAAM;EAE3B,IAAI,CAAC,MAAM,OAAO,CAAC;EAEnB,OAAO,CACL;GACE,IAAI,OAAO;GACX,MAAM,GAAG,OAAO,aAAa,OAAO,MAAM;GAC1C,OAAO,OAAO;GACd,aAAa,OAAO;GACpB,gBAAgB,OAAO;EACzB,CACF;CACF,CAAC;AACH;;;;AClDA,MAAM,iBAAiB,QAAgB,SAA2B;CAChE,MAAM,QAAS,MAAgD;CAE/D,OAAO,WAAW,QAAQ,UAAU,KAAA,KAAa,UAAU;AAC7D;AACA,MAAM,gBAAgB,OAAO,aAAyC;CAGpE,QAAO,MAFa,SAAS,KAAK,CAAC,CAAC,YAAY,IAAI,EAAA,EAEvC;AACf"}