@tdacorp/hyle-sdk 0.14.1 → 0.21.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 (86) hide show
  1. package/README.md +171 -32
  2. package/dist/check-routes-bin.js +48 -21
  3. package/dist/chunk-56Y24XBV.js +840 -0
  4. package/dist/{chunk-MGSUQBDW.js → chunk-75JFLML4.js} +176 -14
  5. package/dist/chunk-HJX57NLI.js +1105 -0
  6. package/dist/chunk-K5VDLROQ.js +145 -0
  7. package/dist/{chunk-BUJFMR3M.js → chunk-QVYQM5R2.js} +15 -6
  8. package/dist/chunk-U74B7AUG.js +398 -0
  9. package/dist/{chunk-6VOHFFA5.js → chunk-X2TLYM7Y.js} +2 -2
  10. package/dist/client-41fU6OY2.d.cts +201 -0
  11. package/dist/client-LwzHwqpM.d.ts +201 -0
  12. package/dist/code-copy.cjs +72 -0
  13. package/dist/code-copy.d.cts +15 -0
  14. package/dist/code-copy.d.ts +15 -0
  15. package/dist/code-copy.js +48 -0
  16. package/dist/comments.cjs +733 -278
  17. package/dist/comments.d.cts +66 -3
  18. package/dist/comments.d.ts +66 -3
  19. package/dist/comments.js +414 -330
  20. package/dist/{diagram-viewer-DYX6R63Y.js → diagram-viewer-XY3CG75U.js} +107 -46
  21. package/dist/{embed-B76zRRPa.d.cts → embed-BUFRQboD.d.ts} +10 -5
  22. package/dist/{embed-SqOBGI-E.d.ts → embed-CYt-q13P.d.cts} +10 -5
  23. package/dist/fragment-alias.cjs +51 -0
  24. package/dist/fragment-alias.d.cts +7 -0
  25. package/dist/fragment-alias.d.ts +7 -0
  26. package/dist/fragment-alias.js +27 -0
  27. package/dist/html.cjs +881 -0
  28. package/dist/html.d.cts +20 -0
  29. package/dist/html.d.ts +20 -0
  30. package/dist/html.js +45 -0
  31. package/dist/index.cjs +181 -14
  32. package/dist/index.d.cts +14 -62
  33. package/dist/index.d.ts +14 -62
  34. package/dist/index.js +11 -1
  35. package/dist/labels-CrA-iqTN.d.cts +46 -0
  36. package/dist/labels-CrA-iqTN.d.ts +46 -0
  37. package/dist/mermaid-diagram.cjs +453 -148
  38. package/dist/mermaid-diagram.d.cts +25 -42
  39. package/dist/mermaid-diagram.d.ts +25 -42
  40. package/dist/mermaid-diagram.js +205 -50
  41. package/dist/mermaid-image.cjs +1456 -0
  42. package/dist/mermaid-image.d.cts +30 -0
  43. package/dist/mermaid-image.d.ts +30 -0
  44. package/dist/mermaid-image.js +93 -0
  45. package/dist/next.cjs +1709 -1134
  46. package/dist/next.d.cts +67 -14
  47. package/dist/next.d.ts +67 -14
  48. package/dist/next.js +950 -794
  49. package/dist/print-coordinator.cjs +157 -0
  50. package/dist/print-coordinator.d.cts +27 -0
  51. package/dist/print-coordinator.d.ts +27 -0
  52. package/dist/print-coordinator.js +83 -0
  53. package/dist/react.cjs +677 -264
  54. package/dist/react.d.cts +161 -31
  55. package/dist/react.d.ts +161 -31
  56. package/dist/react.js +23 -3
  57. package/dist/reactions.cjs +653 -0
  58. package/dist/reactions.d.cts +27 -0
  59. package/dist/reactions.d.ts +27 -0
  60. package/dist/reactions.js +364 -0
  61. package/dist/{resolve-DC2ccfwA.d.ts → resolve-BjAK0k_Y.d.ts} +2 -2
  62. package/dist/{resolve-DKLVftk_.d.cts → resolve-eI1muCKL.d.cts} +2 -2
  63. package/dist/revalidation-callback-BQl77tQR.d.cts +75 -0
  64. package/dist/revalidation-callback-BQl77tQR.d.ts +75 -0
  65. package/dist/sanitize-ijiWjEm9.d.cts +23 -0
  66. package/dist/sanitize-ijiWjEm9.d.ts +23 -0
  67. package/dist/styles.css +107 -47
  68. package/dist/toc-spy.cjs +59 -0
  69. package/dist/toc-spy.d.cts +15 -0
  70. package/dist/toc-spy.d.ts +15 -0
  71. package/dist/toc-spy.js +35 -0
  72. package/dist/{types-ByodIyEv.d.cts → types-3F0wqD-o.d.cts} +44 -4
  73. package/dist/{types-ByodIyEv.d.ts → types-3F0wqD-o.d.ts} +44 -4
  74. package/dist/use-cache.cjs +37 -11
  75. package/dist/use-cache.d.cts +12 -5
  76. package/dist/use-cache.d.ts +12 -5
  77. package/dist/use-cache.js +7 -7
  78. package/dist/youtube-facade.cjs +50 -0
  79. package/dist/youtube-facade.d.cts +17 -0
  80. package/dist/youtube-facade.d.ts +17 -0
  81. package/dist/youtube-facade.js +26 -0
  82. package/package.json +16 -3
  83. package/dist/chunk-4V4VKB3O.js +0 -1471
  84. package/dist/chunk-R5EMI4HQ.js +0 -61
  85. package/dist/revalidation-callback-D7Ms_Puz.d.cts +0 -42
  86. package/dist/revalidation-callback-D7Ms_Puz.d.ts +0 -42
package/dist/next.d.cts CHANGED
@@ -1,11 +1,11 @@
1
1
  import { ReactElement } from 'react';
2
- import { A as ArticleRef, O as OgImage, J as JsonLdConfig, H as HyleComponents, a as HyleSlots, E as EngagementConfig, b as EmbedHeading } from './embed-B76zRRPa.cjs';
3
- export { c as HyleCommentsFallback } from './embed-B76zRRPa.cjs';
4
- import { F as FetchResolverOptions, H as HyleResolver } from './resolve-DKLVftk_.cjs';
5
- export { f as fetchResolver, w as workspaceTags } from './resolve-DKLVftk_.cjs';
6
- import { MetadataRoute, Metadata } from 'next';
7
- import { a as RevalidationCallbackRoute } from './revalidation-callback-D7Ms_Puz.cjs';
8
- import './types-ByodIyEv.cjs';
2
+ import { A as ArticleRef, O as OgImage, J as JsonLdConfig, H as HyleComponents, a as HyleSlots, E as EngagementConfig, b as EmbedHeading } from './embed-CYt-q13P.cjs';
3
+ export { c as HyleCommentsFallback } from './embed-CYt-q13P.cjs';
4
+ import { F as FetchResolverOptions, H as HyleResolver } from './resolve-eI1muCKL.cjs';
5
+ export { f as fetchResolver, w as workspaceTags } from './resolve-eI1muCKL.cjs';
6
+ import { MetadataRoute, ResolvingMetadata, Metadata } from 'next';
7
+ import { R as RevalidationCallbackOptions, b as RevalidationCallbackRoute } from './revalidation-callback-BQl77tQR.cjs';
8
+ import './types-3F0wqD-o.cjs';
9
9
 
10
10
  type RouteParams = Record<string, string | string[] | undefined>;
11
11
  interface CommonOptions {
@@ -34,9 +34,34 @@ interface CommonOptions {
34
34
  /**
35
35
  * The Open Graph / Twitter card image of an article. Return an absolute https URL, or a root-relative path (joined onto
36
36
  * `siteOrigin`); anything invalid, or a relative path without a valid `siteOrigin`, is omitted rather than emitted broken.
37
- * The same image becomes the BlogPosting `image`.
37
+ * The same image becomes the BlogPosting `image`. Unset, see `ogImageRoute`.
38
38
  */
39
39
  readonly ogImage?: (article: ArticleRef) => OgImage | undefined;
40
+ /**
41
+ * "More in this section" under article pages (layout "article"): one extra list request of the article's section, the current
42
+ * article left out, rendered after the pager, plus the article's own child pages when it has any. `limit` is the number of
43
+ * related articles (default 5, at most 100), `title` the heading (default localized). A failed request renders nothing.
44
+ */
45
+ readonly related?: {
46
+ readonly limit?: number;
47
+ readonly title?: string;
48
+ };
49
+ /**
50
+ * Use the generated card as the article image when `ogImage` is unset and `siteOrigin` is valid: `/api/hyle/og/<canonical path>?locale=`.
51
+ * Opt-in because it needs `createOgImageRoute` mounted at `app/api/hyle/og/[...path]/route.ts`; without it the URL would 404. Default false.
52
+ */
53
+ readonly ogImageRoute?: boolean;
54
+ /**
55
+ * Where the host mounted `hyleFeed` (for example "/feed.xml", or a function of the locale). With it, article and list metadata carry
56
+ * `<link rel="alternate" type="application/rss+xml">` (absolute with `siteOrigin`; the path is not localized, so return the locale's own feed path from the function form if feeds are per-locale, which receives the page's locale and is skipped when none is configured); `hyleFeedLink` gives the same link for a host-owned page.
57
+ * `title` defaults to "<siteName> feed", else "Feed". Unset: no link.
58
+ */
59
+ readonly feed?: {
60
+ readonly path: string | ((locale: string) => string);
61
+ readonly title?: string;
62
+ };
63
+ /** Set when `createMarkdownRoute` and its middleware rewrite are mounted: article metadata then carries `<link rel="alternate" type="text/markdown">` to `<canonical>.md`. Default false. */
64
+ readonly markdownTwin?: boolean;
40
65
  /** Open Graph `og:site_name`. Unset: not emitted. */
41
66
  readonly siteName?: string;
42
67
  /** `twitter:site` and `twitter:creator` handles (for example "@TDACorp"), emitted with the Twitter card (needs `ogImage`). Unset: not emitted. */
@@ -155,6 +180,11 @@ type HyleSitemapOptions = HyleNextOptions & {
155
180
  */
156
181
  declare function hyleSitemap(options: HyleSitemapOptions): Promise<MetadataRoute.Sitemap>;
157
182
 
183
+ /** The RSS `<link rel="alternate">` for `options.feed` in `locale` (absolute with a valid `siteOrigin`), or undefined when `feed` is unset or its function form has no locale. The path is the host's own, never locale-prefixed. For a host-owned page's own metadata. */
184
+ declare function hyleFeedLink(options: HyleNextOptions, locale?: string): {
185
+ url: string;
186
+ title: string;
187
+ } | undefined;
158
188
  /**
159
189
  * `export const generateMetadata = hyleMetadata({ ... })` with the same options as `hylePage`. Title (`titleTemplate` applied last, as an
160
190
  * absolute title), description, a canonical URL in the page's own locale (so a fallback copy under another locale prefix points at the
@@ -167,7 +197,7 @@ declare function hyleSitemap(options: HyleSitemapOptions): Promise<MetadataRoute
167
197
  * gives no metadata; any other failure (network, timeout, 5xx, 401, 403, 429) is rethrown, so a transient outage is not
168
198
  * cached as a page; Next control flow is rethrown.
169
199
  */
170
- declare function hyleMetadata(options: HyleNextOptions): (props: PageProps) => Promise<Metadata>;
200
+ declare function hyleMetadata(options: HyleNextOptions): (props: PageProps, parent?: ResolvingMetadata) => Promise<Metadata>;
171
201
 
172
202
  type HyleFeedOptions = HyleNextOptions & {
173
203
  /** Items in the feed (the server maximum is 100). Default 50. */
@@ -188,6 +218,8 @@ interface RevalidateRouteOptions {
188
218
  readonly workspaceId: string | undefined;
189
219
  /** Current signing secret first, previous ones after during rotation (HYLE_WEBHOOK_SECRET). */
190
220
  readonly secrets: readonly (string | undefined)[];
221
+ /** Comment notifications, see `RevalidationCallbackOptions.onCommentEvent`. */
222
+ readonly onCommentEvent?: RevalidationCallbackOptions["onCommentEvent"];
191
223
  /** Environment to read the site switch from. Default process.env. */
192
224
  readonly env?: Readonly<Record<string, string | undefined>>;
193
225
  }
@@ -203,7 +235,7 @@ declare function createRevalidateRoute(options: RevalidateRouteOptions): Revalid
203
235
  /**
204
236
  * One workspace of a root catch-all: the options of `hylePage` without `basePath` (the mount prefix comes from hyle's mounts)
205
237
  * and without `resolver` (the mounts are read through Next's fetch cache, so `baseUrl`, `token` and `workspaceId` are required).
206
- * `revalidate` (default 300) also bounds the mounts fetch.
238
+ * `revalidate` (default 86400, a safety net behind tag webhooks) also bounds the mounts fetch.
207
239
  */
208
240
  type HyleRootConfig = Omit<Extract<HyleNextOptions, {
209
241
  resolver?: undefined;
@@ -238,7 +270,7 @@ declare const MOUNTS_MAX_STALE_MS: number;
238
270
  */
239
271
  declare function hyleRootPage(options: Configs): (props: PageProps) => Promise<ReactElement>;
240
272
  /** `export const generateMetadata = hyleRootMetadata({ ... })` with the same options as `hyleRootPage`: no metadata for a path no mount serves. */
241
- declare function hyleRootMetadata(options: Configs): (props: PageProps) => Promise<Metadata>;
273
+ declare function hyleRootMetadata(options: Configs): (props: PageProps, parent?: ResolvingMetadata) => Promise<Metadata>;
242
274
  interface HyleRootSitemapOptions {
243
275
  /** The site's public origin, for example "https://tdacorp.in": https, no path, query or credentials. */
244
276
  readonly origin: string;
@@ -292,6 +324,22 @@ declare function createLlmsTxtRoute(options: Configs, llms: LlmsTxtOptions): {
292
324
  GET(): Promise<Response>;
293
325
  };
294
326
 
327
+ interface OgImageRoute {
328
+ GET(req: Request, ctx: {
329
+ params: Promise<{
330
+ path?: string[];
331
+ }>;
332
+ }): Promise<Response>;
333
+ }
334
+ /**
335
+ * `export const { GET } = createOgImageRoute({ ...same options as hylePage })` in `app/api/hyle/og/[...path]/route.ts`.
336
+ *
337
+ * The default `og:image` of an article page when `ogImage` is unset: a plain 1200x630 card with the title and `siteName`, in the
338
+ * system font. The URL is `/api/hyle/og` + the article's canonical path (no `basePath` involved, so any mount works), resolved with the page's own resolver (a redirect, such as a renamed slug, is followed once), so cache tags and purges are the
339
+ * page's. `?locale=` is honoured only when it names a translation the article has (the path is resolved without it first), so it cannot fan out requests. An unknown path is a 404, an outage a 502.
340
+ */
341
+ declare function createOgImageRoute(options: HyleNextOptions): OgImageRoute;
342
+
295
343
  interface AssetRouteOptions {
296
344
  /** hyle's origin (HYLE_TARGET_BASE_URL). */
297
345
  readonly baseUrl: string | undefined;
@@ -345,9 +393,13 @@ interface HyleListProps {
345
393
  readonly headingLevel?: EmbedHeading | undefined;
346
394
  /** Where "View all" goes, usually the mount's index. Omit to hide it. */
347
395
  readonly moreHref?: string | undefined;
396
+ /** Start after this `next_cursor` (a malformed one is ignored). The host reads it from its own `?cursor=`. */
397
+ readonly cursor?: string | undefined;
398
+ /** Builds the "Older posts" href from the list's validated `next_cursor`; called only when there is one. Omit to hide the link. */
399
+ readonly olderHref?: ((nextCursor: string) => string) | undefined;
348
400
  }
349
401
  /** The newest articles of a section as a list or a grid of links to the mount. Slots: `list.item`, `list.empty`. */
350
- declare function HyleList({ options, limit, locale, layout, title, headingLevel, moreHref }: HyleListProps): Promise<ReactElement | null>;
402
+ declare function HyleList({ options, limit, locale, layout, title, headingLevel, moreHref, cursor, olderHref }: HyleListProps): Promise<ReactElement | null>;
351
403
  interface HyleArticleProps {
352
404
  readonly options: HyleNextOptions;
353
405
  /** The article's canonical site path, as hyle sends it (`canonical_path`, with the workspace prefix, no locale prefix). */
@@ -414,7 +466,8 @@ interface EngagementRouteOptions {
414
466
  readonly allowedOrigins?: readonly string[];
415
467
  /**
416
468
  * Called for every matched request before any work (after the allowlist and CSRF checks), with the action name:
417
- * "session", "comments.list", "comments.create", "comments.edit", "comments.delete", "reactions.add" or "reactions.remove".
469
+ * "session", "comments.list", "comments.create", "comments.edit", "comments.delete", "reactions.add", "reactions.remove",
470
+ * "votes.set" or "votes.remove".
418
471
  * Return a Response (for example a 429 from your own rate limiter) to answer instead; return nothing to continue. A throw is a 502.
419
472
  * hyle rate-limits too, but every anonymous read reaches your server first: limit /api/hyle/engage in your own middleware or here.
420
473
  */
@@ -459,4 +512,4 @@ declare const ENGAGE_CSRF_HEADER = "x-hyle-engage";
459
512
  */
460
513
  declare function createEngagementRoute(options: EngagementRouteOptions): EngagementRoute;
461
514
 
462
- export { type AssetRoute, type AssetRouteOptions, ENGAGE_CSRF_HEADER, type EngageReader, type EngagementRoute, type EngagementRouteOptions, FetchResolverOptions, HyleArticle, type HyleArticleProps, HyleComments, type HyleCommentsProps, type HyleFeedOptions, HyleList, type HyleListProps, type HyleNextOptions, HyleResolver, type HyleRootConfig, type HyleRootSitemapOptions, type HyleSitemapOptions, type LlmsTxtOptions, MOUNTS_MAX_STALE_MS, type MarkdownRoute, type PageProps, type RevalidateRouteOptions, type RouteParams, createAssetRoute, createEngagementRoute, createLlmsTxtRoute, createMarkdownRoute, createRevalidateRoute, hyleFeed, hyleMetadata, hylePage, hyleRootMetadata, hyleRootPage, hyleRootSitemap, hyleSitemap, markdownRewritePath };
515
+ export { type AssetRoute, type AssetRouteOptions, ENGAGE_CSRF_HEADER, type EngageReader, type EngagementRoute, type EngagementRouteOptions, FetchResolverOptions, HyleArticle, type HyleArticleProps, HyleComments, type HyleCommentsProps, type HyleFeedOptions, HyleList, type HyleListProps, type HyleNextOptions, HyleResolver, type HyleRootConfig, type HyleRootSitemapOptions, type HyleSitemapOptions, type LlmsTxtOptions, MOUNTS_MAX_STALE_MS, type MarkdownRoute, type OgImageRoute, type PageProps, type RevalidateRouteOptions, type RouteParams, createAssetRoute, createEngagementRoute, createLlmsTxtRoute, createMarkdownRoute, createOgImageRoute, createRevalidateRoute, hyleFeed, hyleFeedLink, hyleMetadata, hylePage, hyleRootMetadata, hyleRootPage, hyleRootSitemap, hyleSitemap, markdownRewritePath };
package/dist/next.d.ts CHANGED
@@ -1,11 +1,11 @@
1
1
  import { ReactElement } from 'react';
2
- import { A as ArticleRef, O as OgImage, J as JsonLdConfig, H as HyleComponents, a as HyleSlots, E as EngagementConfig, b as EmbedHeading } from './embed-SqOBGI-E.js';
3
- export { c as HyleCommentsFallback } from './embed-SqOBGI-E.js';
4
- import { F as FetchResolverOptions, H as HyleResolver } from './resolve-DC2ccfwA.js';
5
- export { f as fetchResolver, w as workspaceTags } from './resolve-DC2ccfwA.js';
6
- import { MetadataRoute, Metadata } from 'next';
7
- import { a as RevalidationCallbackRoute } from './revalidation-callback-D7Ms_Puz.js';
8
- import './types-ByodIyEv.js';
2
+ import { A as ArticleRef, O as OgImage, J as JsonLdConfig, H as HyleComponents, a as HyleSlots, E as EngagementConfig, b as EmbedHeading } from './embed-BUFRQboD.js';
3
+ export { c as HyleCommentsFallback } from './embed-BUFRQboD.js';
4
+ import { F as FetchResolverOptions, H as HyleResolver } from './resolve-BjAK0k_Y.js';
5
+ export { f as fetchResolver, w as workspaceTags } from './resolve-BjAK0k_Y.js';
6
+ import { MetadataRoute, ResolvingMetadata, Metadata } from 'next';
7
+ import { R as RevalidationCallbackOptions, b as RevalidationCallbackRoute } from './revalidation-callback-BQl77tQR.js';
8
+ import './types-3F0wqD-o.js';
9
9
 
10
10
  type RouteParams = Record<string, string | string[] | undefined>;
11
11
  interface CommonOptions {
@@ -34,9 +34,34 @@ interface CommonOptions {
34
34
  /**
35
35
  * The Open Graph / Twitter card image of an article. Return an absolute https URL, or a root-relative path (joined onto
36
36
  * `siteOrigin`); anything invalid, or a relative path without a valid `siteOrigin`, is omitted rather than emitted broken.
37
- * The same image becomes the BlogPosting `image`.
37
+ * The same image becomes the BlogPosting `image`. Unset, see `ogImageRoute`.
38
38
  */
39
39
  readonly ogImage?: (article: ArticleRef) => OgImage | undefined;
40
+ /**
41
+ * "More in this section" under article pages (layout "article"): one extra list request of the article's section, the current
42
+ * article left out, rendered after the pager, plus the article's own child pages when it has any. `limit` is the number of
43
+ * related articles (default 5, at most 100), `title` the heading (default localized). A failed request renders nothing.
44
+ */
45
+ readonly related?: {
46
+ readonly limit?: number;
47
+ readonly title?: string;
48
+ };
49
+ /**
50
+ * Use the generated card as the article image when `ogImage` is unset and `siteOrigin` is valid: `/api/hyle/og/<canonical path>?locale=`.
51
+ * Opt-in because it needs `createOgImageRoute` mounted at `app/api/hyle/og/[...path]/route.ts`; without it the URL would 404. Default false.
52
+ */
53
+ readonly ogImageRoute?: boolean;
54
+ /**
55
+ * Where the host mounted `hyleFeed` (for example "/feed.xml", or a function of the locale). With it, article and list metadata carry
56
+ * `<link rel="alternate" type="application/rss+xml">` (absolute with `siteOrigin`; the path is not localized, so return the locale's own feed path from the function form if feeds are per-locale, which receives the page's locale and is skipped when none is configured); `hyleFeedLink` gives the same link for a host-owned page.
57
+ * `title` defaults to "<siteName> feed", else "Feed". Unset: no link.
58
+ */
59
+ readonly feed?: {
60
+ readonly path: string | ((locale: string) => string);
61
+ readonly title?: string;
62
+ };
63
+ /** Set when `createMarkdownRoute` and its middleware rewrite are mounted: article metadata then carries `<link rel="alternate" type="text/markdown">` to `<canonical>.md`. Default false. */
64
+ readonly markdownTwin?: boolean;
40
65
  /** Open Graph `og:site_name`. Unset: not emitted. */
41
66
  readonly siteName?: string;
42
67
  /** `twitter:site` and `twitter:creator` handles (for example "@TDACorp"), emitted with the Twitter card (needs `ogImage`). Unset: not emitted. */
@@ -155,6 +180,11 @@ type HyleSitemapOptions = HyleNextOptions & {
155
180
  */
156
181
  declare function hyleSitemap(options: HyleSitemapOptions): Promise<MetadataRoute.Sitemap>;
157
182
 
183
+ /** The RSS `<link rel="alternate">` for `options.feed` in `locale` (absolute with a valid `siteOrigin`), or undefined when `feed` is unset or its function form has no locale. The path is the host's own, never locale-prefixed. For a host-owned page's own metadata. */
184
+ declare function hyleFeedLink(options: HyleNextOptions, locale?: string): {
185
+ url: string;
186
+ title: string;
187
+ } | undefined;
158
188
  /**
159
189
  * `export const generateMetadata = hyleMetadata({ ... })` with the same options as `hylePage`. Title (`titleTemplate` applied last, as an
160
190
  * absolute title), description, a canonical URL in the page's own locale (so a fallback copy under another locale prefix points at the
@@ -167,7 +197,7 @@ declare function hyleSitemap(options: HyleSitemapOptions): Promise<MetadataRoute
167
197
  * gives no metadata; any other failure (network, timeout, 5xx, 401, 403, 429) is rethrown, so a transient outage is not
168
198
  * cached as a page; Next control flow is rethrown.
169
199
  */
170
- declare function hyleMetadata(options: HyleNextOptions): (props: PageProps) => Promise<Metadata>;
200
+ declare function hyleMetadata(options: HyleNextOptions): (props: PageProps, parent?: ResolvingMetadata) => Promise<Metadata>;
171
201
 
172
202
  type HyleFeedOptions = HyleNextOptions & {
173
203
  /** Items in the feed (the server maximum is 100). Default 50. */
@@ -188,6 +218,8 @@ interface RevalidateRouteOptions {
188
218
  readonly workspaceId: string | undefined;
189
219
  /** Current signing secret first, previous ones after during rotation (HYLE_WEBHOOK_SECRET). */
190
220
  readonly secrets: readonly (string | undefined)[];
221
+ /** Comment notifications, see `RevalidationCallbackOptions.onCommentEvent`. */
222
+ readonly onCommentEvent?: RevalidationCallbackOptions["onCommentEvent"];
191
223
  /** Environment to read the site switch from. Default process.env. */
192
224
  readonly env?: Readonly<Record<string, string | undefined>>;
193
225
  }
@@ -203,7 +235,7 @@ declare function createRevalidateRoute(options: RevalidateRouteOptions): Revalid
203
235
  /**
204
236
  * One workspace of a root catch-all: the options of `hylePage` without `basePath` (the mount prefix comes from hyle's mounts)
205
237
  * and without `resolver` (the mounts are read through Next's fetch cache, so `baseUrl`, `token` and `workspaceId` are required).
206
- * `revalidate` (default 300) also bounds the mounts fetch.
238
+ * `revalidate` (default 86400, a safety net behind tag webhooks) also bounds the mounts fetch.
207
239
  */
208
240
  type HyleRootConfig = Omit<Extract<HyleNextOptions, {
209
241
  resolver?: undefined;
@@ -238,7 +270,7 @@ declare const MOUNTS_MAX_STALE_MS: number;
238
270
  */
239
271
  declare function hyleRootPage(options: Configs): (props: PageProps) => Promise<ReactElement>;
240
272
  /** `export const generateMetadata = hyleRootMetadata({ ... })` with the same options as `hyleRootPage`: no metadata for a path no mount serves. */
241
- declare function hyleRootMetadata(options: Configs): (props: PageProps) => Promise<Metadata>;
273
+ declare function hyleRootMetadata(options: Configs): (props: PageProps, parent?: ResolvingMetadata) => Promise<Metadata>;
242
274
  interface HyleRootSitemapOptions {
243
275
  /** The site's public origin, for example "https://tdacorp.in": https, no path, query or credentials. */
244
276
  readonly origin: string;
@@ -292,6 +324,22 @@ declare function createLlmsTxtRoute(options: Configs, llms: LlmsTxtOptions): {
292
324
  GET(): Promise<Response>;
293
325
  };
294
326
 
327
+ interface OgImageRoute {
328
+ GET(req: Request, ctx: {
329
+ params: Promise<{
330
+ path?: string[];
331
+ }>;
332
+ }): Promise<Response>;
333
+ }
334
+ /**
335
+ * `export const { GET } = createOgImageRoute({ ...same options as hylePage })` in `app/api/hyle/og/[...path]/route.ts`.
336
+ *
337
+ * The default `og:image` of an article page when `ogImage` is unset: a plain 1200x630 card with the title and `siteName`, in the
338
+ * system font. The URL is `/api/hyle/og` + the article's canonical path (no `basePath` involved, so any mount works), resolved with the page's own resolver (a redirect, such as a renamed slug, is followed once), so cache tags and purges are the
339
+ * page's. `?locale=` is honoured only when it names a translation the article has (the path is resolved without it first), so it cannot fan out requests. An unknown path is a 404, an outage a 502.
340
+ */
341
+ declare function createOgImageRoute(options: HyleNextOptions): OgImageRoute;
342
+
295
343
  interface AssetRouteOptions {
296
344
  /** hyle's origin (HYLE_TARGET_BASE_URL). */
297
345
  readonly baseUrl: string | undefined;
@@ -345,9 +393,13 @@ interface HyleListProps {
345
393
  readonly headingLevel?: EmbedHeading | undefined;
346
394
  /** Where "View all" goes, usually the mount's index. Omit to hide it. */
347
395
  readonly moreHref?: string | undefined;
396
+ /** Start after this `next_cursor` (a malformed one is ignored). The host reads it from its own `?cursor=`. */
397
+ readonly cursor?: string | undefined;
398
+ /** Builds the "Older posts" href from the list's validated `next_cursor`; called only when there is one. Omit to hide the link. */
399
+ readonly olderHref?: ((nextCursor: string) => string) | undefined;
348
400
  }
349
401
  /** The newest articles of a section as a list or a grid of links to the mount. Slots: `list.item`, `list.empty`. */
350
- declare function HyleList({ options, limit, locale, layout, title, headingLevel, moreHref }: HyleListProps): Promise<ReactElement | null>;
402
+ declare function HyleList({ options, limit, locale, layout, title, headingLevel, moreHref, cursor, olderHref }: HyleListProps): Promise<ReactElement | null>;
351
403
  interface HyleArticleProps {
352
404
  readonly options: HyleNextOptions;
353
405
  /** The article's canonical site path, as hyle sends it (`canonical_path`, with the workspace prefix, no locale prefix). */
@@ -414,7 +466,8 @@ interface EngagementRouteOptions {
414
466
  readonly allowedOrigins?: readonly string[];
415
467
  /**
416
468
  * Called for every matched request before any work (after the allowlist and CSRF checks), with the action name:
417
- * "session", "comments.list", "comments.create", "comments.edit", "comments.delete", "reactions.add" or "reactions.remove".
469
+ * "session", "comments.list", "comments.create", "comments.edit", "comments.delete", "reactions.add", "reactions.remove",
470
+ * "votes.set" or "votes.remove".
418
471
  * Return a Response (for example a 429 from your own rate limiter) to answer instead; return nothing to continue. A throw is a 502.
419
472
  * hyle rate-limits too, but every anonymous read reaches your server first: limit /api/hyle/engage in your own middleware or here.
420
473
  */
@@ -459,4 +512,4 @@ declare const ENGAGE_CSRF_HEADER = "x-hyle-engage";
459
512
  */
460
513
  declare function createEngagementRoute(options: EngagementRouteOptions): EngagementRoute;
461
514
 
462
- export { type AssetRoute, type AssetRouteOptions, ENGAGE_CSRF_HEADER, type EngageReader, type EngagementRoute, type EngagementRouteOptions, FetchResolverOptions, HyleArticle, type HyleArticleProps, HyleComments, type HyleCommentsProps, type HyleFeedOptions, HyleList, type HyleListProps, type HyleNextOptions, HyleResolver, type HyleRootConfig, type HyleRootSitemapOptions, type HyleSitemapOptions, type LlmsTxtOptions, MOUNTS_MAX_STALE_MS, type MarkdownRoute, type PageProps, type RevalidateRouteOptions, type RouteParams, createAssetRoute, createEngagementRoute, createLlmsTxtRoute, createMarkdownRoute, createRevalidateRoute, hyleFeed, hyleMetadata, hylePage, hyleRootMetadata, hyleRootPage, hyleRootSitemap, hyleSitemap, markdownRewritePath };
515
+ export { type AssetRoute, type AssetRouteOptions, ENGAGE_CSRF_HEADER, type EngageReader, type EngagementRoute, type EngagementRouteOptions, FetchResolverOptions, HyleArticle, type HyleArticleProps, HyleComments, type HyleCommentsProps, type HyleFeedOptions, HyleList, type HyleListProps, type HyleNextOptions, HyleResolver, type HyleRootConfig, type HyleRootSitemapOptions, type HyleSitemapOptions, type LlmsTxtOptions, MOUNTS_MAX_STALE_MS, type MarkdownRoute, type OgImageRoute, type PageProps, type RevalidateRouteOptions, type RouteParams, createAssetRoute, createEngagementRoute, createLlmsTxtRoute, createMarkdownRoute, createOgImageRoute, createRevalidateRoute, hyleFeed, hyleFeedLink, hyleMetadata, hylePage, hyleRootMetadata, hyleRootPage, hyleRootSitemap, hyleSitemap, markdownRewritePath };