@tdacorp/hyle-sdk 0.21.0 → 0.23.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +141 -18
- package/dist/check-routes-bin.js +174 -42
- package/dist/{chunk-56Y24XBV.js → chunk-JHZJOJDC.js} +4 -3
- package/dist/{chunk-K5VDLROQ.js → chunk-SFFBZFEN.js} +34 -1
- package/dist/{chunk-HJX57NLI.js → chunk-UFMKLCXS.js} +246 -225
- package/dist/{chunk-X2TLYM7Y.js → chunk-VUML2UPD.js} +1 -1
- package/dist/chunk-VXARM37R.js +68 -0
- package/dist/{chunk-75JFLML4.js → chunk-YHXE3TGS.js} +94 -12
- package/dist/{client-41fU6OY2.d.cts → client--ighAWaj.d.ts} +13 -1
- package/dist/{client-LwzHwqpM.d.ts → client-DK-S2580.d.cts} +13 -1
- package/dist/code-copy.cjs +4 -2
- package/dist/code-copy.d.cts +5 -2
- package/dist/code-copy.d.ts +5 -2
- package/dist/code-copy.js +5 -3
- package/dist/comments.cjs +14 -6
- package/dist/comments.js +14 -6
- package/dist/docs-enhance.cjs +7 -4
- package/dist/docs-enhance.d.cts +5 -3
- package/dist/docs-enhance.d.ts +5 -3
- package/dist/docs-enhance.js +8 -5
- package/dist/{embed-BUFRQboD.d.ts → embed-XT0x_Jaa.d.cts} +4 -2
- package/dist/{embed-CYt-q13P.d.cts → embed-g7NT1CyB.d.ts} +4 -2
- package/dist/html.cjs +14 -6
- package/dist/html.d.cts +1 -1
- package/dist/html.d.ts +1 -1
- package/dist/html.js +2 -2
- package/dist/index.cjs +85 -12
- package/dist/index.d.cts +13 -11
- package/dist/index.d.ts +13 -11
- package/dist/index.js +2 -2
- package/dist/mermaid-diagram.cjs +46 -6
- package/dist/mermaid-diagram.js +15 -6
- package/dist/mermaid-image.cjs +4 -1
- package/dist/mermaid-image.js +1 -1
- package/dist/next.cjs +521 -242
- package/dist/next.d.cts +74 -17
- package/dist/next.d.ts +74 -17
- package/dist/next.js +207 -33
- package/dist/print-coordinator.js +1 -1
- package/dist/react.cjs +233 -197
- package/dist/react.d.cts +17 -6
- package/dist/react.d.ts +17 -6
- package/dist/react.js +5 -3
- package/dist/{resolve-BjAK0k_Y.d.ts → resolve-BqC9l5RH.d.ts} +1 -1
- package/dist/{resolve-eI1muCKL.d.cts → resolve-CiZCPysX.d.cts} +1 -1
- package/dist/{sanitize-ijiWjEm9.d.cts → sanitize-BpY_AdZh.d.cts} +1 -1
- package/dist/{sanitize-ijiWjEm9.d.ts → sanitize-BpY_AdZh.d.ts} +1 -1
- package/dist/styles.css +4 -4
- package/dist/toc-spy.cjs +2 -1
- package/dist/toc-spy.js +2 -1
- package/dist/{types-3F0wqD-o.d.cts → types-b9QbmEDd.d.cts} +44 -1
- package/dist/{types-3F0wqD-o.d.ts → types-b9QbmEDd.d.ts} +44 -1
- package/dist/use-cache.cjs +73 -3
- package/dist/use-cache.d.cts +3 -3
- package/dist/use-cache.d.ts +3 -3
- package/dist/use-cache.js +3 -3
- package/package.json +3 -3
- package/dist/chunk-67IOIAVW.js +0 -35
package/dist/next.d.cts
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
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-
|
|
3
|
-
export { c as HyleCommentsFallback } from './embed-
|
|
4
|
-
import { F as FetchResolverOptions, H as HyleResolver } from './resolve-
|
|
5
|
-
export { f as fetchResolver, w as workspaceTags } from './resolve-
|
|
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-XT0x_Jaa.cjs';
|
|
3
|
+
export { c as HyleCommentsFallback } from './embed-XT0x_Jaa.cjs';
|
|
4
|
+
import { F as FetchResolverOptions, H as HyleResolver } from './resolve-CiZCPysX.cjs';
|
|
5
|
+
export { f as fetchResolver, w as workspaceTags } from './resolve-CiZCPysX.cjs';
|
|
6
6
|
import { MetadataRoute, ResolvingMetadata, Metadata } from 'next';
|
|
7
7
|
import { R as RevalidationCallbackOptions, b as RevalidationCallbackRoute } from './revalidation-callback-BQl77tQR.cjs';
|
|
8
|
-
import './
|
|
8
|
+
import { c as HyleCredential } from './client-DK-S2580.cjs';
|
|
9
|
+
import './types-b9QbmEDd.cjs';
|
|
9
10
|
|
|
10
11
|
type RouteParams = Record<string, string | string[] | undefined>;
|
|
11
12
|
interface CommonOptions {
|
|
@@ -108,16 +109,16 @@ interface CommonOptions {
|
|
|
108
109
|
* `"searchParams"` makes list pages paginate: `?cursor=` is read, sent to hyle, and an "Older posts" link is built from
|
|
109
110
|
* `next_cursor`. Default off, and the trade-off is real: reading `searchParams` makes the route dynamic, so it can no longer
|
|
110
111
|
* be statically generated or served from ISR (hyle's fetch cache still applies). Leave it off when one page of `listLimit`
|
|
111
|
-
* items is enough. A malformed `cursor` is ignored (the first page is shown); one that is well-formed but
|
|
112
|
+
* items is enough. A malformed `cursor` is ignored (the first page is shown); one that is well-formed but rejected by hyle is a 404.
|
|
112
113
|
*/
|
|
113
114
|
readonly paginate?: "searchParams";
|
|
114
115
|
/**
|
|
115
|
-
* Opt-in custom UI for
|
|
116
|
+
* Opt-in custom UI for hyle failures (network error, timeout, 5xx, any 4xx that is not hyle's NOT_FOUND, a malformed
|
|
116
117
|
* response, a refused redirect target). Without it `hylePage` rethrows them, so Next keeps serving the last good ISR page
|
|
117
118
|
* when a revalidation fails (and a failure on a first render is an uncached 500). With it, the returned element is a NORMAL
|
|
118
119
|
* render: it is cached for the revalidate window and replaces the last good page for that long, so prefer a boundary
|
|
119
120
|
* (`error.tsx`) unless you want that. The `error` can carry `Cp1ClientError.message` and `requestId`: never render it.
|
|
120
|
-
* Only its name is logged. A
|
|
121
|
+
* Only its name is logged. A not-found answer from hyle (or a `cursor` it refuses) is always `notFound()` and never reaches this, and
|
|
121
122
|
* `notFound()` and redirects are Next control flow that always propagate.
|
|
122
123
|
*/
|
|
123
124
|
readonly onError?: (error: unknown) => ReactElement;
|
|
@@ -145,8 +146,8 @@ interface PageProps {
|
|
|
145
146
|
* in front, and 301 maps to permanentRedirect (308) while 307 maps to redirect (temporary). A target equal to the current
|
|
146
147
|
* URL would loop, so it is treated as not found.
|
|
147
148
|
*
|
|
148
|
-
* Failure:
|
|
149
|
-
*
|
|
149
|
+
* Failure: only hyle's own not-found answer (or its refusal of the visitor's `cursor`) is `notFound()`. Every other failure (network error, timeout, 5xx, any other
|
|
150
|
+
* 4xx, a malformed response, a refused redirect target) is RETHROWN, so under ISR Next keeps serving the last good
|
|
150
151
|
* page when a revalidation fails, and a first-render failure is an uncached 500 rather than a cached soft 200. `onError`
|
|
151
152
|
* opts in to a custom element instead (see its docs). `notFound()` and redirects always propagate (`unstable_rethrow`).
|
|
152
153
|
*
|
|
@@ -193,8 +194,8 @@ declare function hyleFeedLink(options: HyleNextOptions, locale?: string): {
|
|
|
193
194
|
* when there is one). A list page canonicals to itself; with `paginate` a cursor page canonicals to its own `?cursor=` URL (never to the
|
|
194
195
|
* first page) and its title gets an "Older posts" suffix. Open Graph titles are always the bare title.
|
|
195
196
|
* Canonical and hreflang URLs are ABSOLUTE when `siteOrigin` is a bare https origin, else relative paths (set `metadataBase` in the host's root layout).
|
|
196
|
-
* Redirects, 404s and a switched-off read surface produce no metadata; `hylePage` handles those.
|
|
197
|
-
* gives no metadata; any other failure (network, timeout, 5xx,
|
|
197
|
+
* Redirects, 404s and a switched-off read surface produce no metadata; `hylePage` handles those. hyle's own not-found
|
|
198
|
+
* gives no metadata; any other failure (network, timeout, 5xx, any other 4xx) is rethrown, so an outage is not
|
|
198
199
|
* cached as a page; Next control flow is rethrown.
|
|
199
200
|
*/
|
|
200
201
|
declare function hyleMetadata(options: HyleNextOptions): (props: PageProps, parent?: ResolvingMetadata) => Promise<Metadata>;
|
|
@@ -258,8 +259,8 @@ declare const MOUNTS_MAX_STALE_MS: number;
|
|
|
258
259
|
* entries: `notFound()` with ZERO resolve calls, so junk URLs and bot probes never reach hyle;
|
|
259
260
|
* - otherwise the request is served by `hylePage` with `basePath` = the matched prefix (same locale, redirect and error rules).
|
|
260
261
|
*
|
|
261
|
-
* Failure of the mounts fetch:
|
|
262
|
-
* 5xx,
|
|
262
|
+
* Failure of the mounts fetch: the kill switch means nothing is served (404); 401 and 403 are rethrown at once. Any other
|
|
263
|
+
* failure (network, timeout, 5xx, any other 4xx, malformed body) uses the last mounts read successfully for up to 15 minutes, so a hyle outage keeps
|
|
263
264
|
* unmatched URLs a plain 404 and mounted pages on their last good render; with no such copy (a cold server) it is RETHROWN,
|
|
264
265
|
* because the URL might be a mounted page: Next keeps the last good ISR page, or a first render is an uncached 500. A host
|
|
265
266
|
* route never depends on this at all: Next matches it first. With a ROOT mount and no copy, every unmatched URL errors
|
|
@@ -301,7 +302,7 @@ interface MarkdownRoute {
|
|
|
301
302
|
* `hyleRootPage`. It serves the markdown source of a page the mounts serve (same mount matching, reserved paths, `locale`,
|
|
302
303
|
* `localePrefix`, fetch cache and tags as the page itself): `text/markdown; charset=utf-8` with `X-Robots-Tag: noindex`, asset links
|
|
303
304
|
* rewritten to the host's asset route. A redirect (301 becomes 308, 307 stays) goes to the target's `.md` twin; a list, an unknown
|
|
304
|
-
* path or
|
|
305
|
+
* path or hyle's not-found is 404; any other failure is 502 with no body. Reached by `markdownRewritePath` in the host's middleware.
|
|
305
306
|
* For a locale-prefixed site put the route under `[locale]` (`app/api/hyle/md/[locale]/[...path]/route.ts`) so `locale(params)` sees it.
|
|
306
307
|
*/
|
|
307
308
|
declare function createMarkdownRoute(options: Configs): MarkdownRoute;
|
|
@@ -374,11 +375,21 @@ interface AssetRoute {
|
|
|
374
375
|
* `img-src 'self'` (and `media-src 'self'`) CSP needs no change. hyle serves only assets that a currently published page of this
|
|
375
376
|
* workspace references, so an unpublished or other workspace's asset is a 404 here too.
|
|
376
377
|
*
|
|
377
|
-
*
|
|
378
|
+
* The same route serves the workspace's theme stylesheet as `theme-<scope>-<sha256>.css` (see `serveTheme`), which `<HyleTheme>` links.
|
|
379
|
+
*
|
|
380
|
+
* Safety: the only input is the `file` segment, matched against `<uuid>[.<ext>]` or the theme name before anything is sent, so this is not an open
|
|
378
381
|
* proxy. The browser's cookies and authorization header are never forwarded; only `Range`, `If-Range` and `If-None-Match` are.
|
|
379
382
|
* The response headers are built here (no upstream header is copied blindly), the content type must be on the asset allowlist,
|
|
380
383
|
* the body is size-capped and time-bounded, and every failure is an empty 404 or 502 that says nothing about hyle.
|
|
381
384
|
* The site switch `HYLE_CONTENT_ENABLED=0`/`false`, or missing configuration, answers 404.
|
|
385
|
+
*
|
|
386
|
+
* Draft preview (hyle ADR 0037): `?hyle_preview=<token>`, which the preview page puts on its own images, is sent to hyle as a
|
|
387
|
+
* header so that draft's assets load; every such answer is `no-store`. The token is never sent for the theme stylesheet,
|
|
388
|
+
* which is the credential's own with or without it. No other query parameter is read.
|
|
389
|
+
*
|
|
390
|
+
* Protected page (hyle ADR 0039): `?hyle_protected=<pageId>` takes the password from that page's cookie (`hyle_p_<pageId>`, set by
|
|
391
|
+
* `createProtectedUnlockRoute`) and forwards it as the `cp-protected` header. A missing or malformed cookie is a 404 that reaches
|
|
392
|
+
* nobody; every such answer is private and `no-store`, as a draft's is.
|
|
382
393
|
*/
|
|
383
394
|
declare function createAssetRoute(options: AssetRouteOptions): AssetRoute;
|
|
384
395
|
|
|
@@ -512,4 +523,50 @@ declare const ENGAGE_CSRF_HEADER = "x-hyle-engage";
|
|
|
512
523
|
*/
|
|
513
524
|
declare function createEngagementRoute(options: EngagementRouteOptions): EngagementRoute;
|
|
514
525
|
|
|
515
|
-
|
|
526
|
+
/** The credential and base URL of `createHyleClient`, plus how your article pages are drawn. */
|
|
527
|
+
type HylePreviewPageOptions = HyleCredential & {
|
|
528
|
+
readonly baseUrl: string;
|
|
529
|
+
} & Pick<CommonOptions, "components" | "slots" | "layout" | "localePrefix">;
|
|
530
|
+
/** `export const metadata = hylePreviewMetadata`, next to `hylePreviewPage`. The page also renders both tags itself. */
|
|
531
|
+
declare const hylePreviewMetadata: Metadata;
|
|
532
|
+
/**
|
|
533
|
+
* The page behind hyle's "Open on site" (ADR 0037): `export default hylePreviewPage({ baseUrl, token })` in
|
|
534
|
+
* `app/hyle-preview/page.tsx`. It draws the draft behind `?token=` with your article components; a missing, wrong or
|
|
535
|
+
* expired token is `notFound()`. The page opens with an "Unpublished draft preview" banner. Nothing is cached (it reads
|
|
536
|
+
* `searchParams` and fetches `no-store`), the page is noindex with no referrer, and the token is never logged. Keep
|
|
537
|
+
* analytics off this route: its URL carries the token.
|
|
538
|
+
*/
|
|
539
|
+
declare function hylePreviewPage(options: HylePreviewPageOptions): (props: PageProps) => Promise<ReactElement>;
|
|
540
|
+
|
|
541
|
+
/**
|
|
542
|
+
* `export const metadata = hyleProtectedMetadata`, next to `hyleProtectedPage`. The page also renders both tags itself. The
|
|
543
|
+
* referrer is `same-origin`, not `no-referrer`: a no-referrer page sends `Origin: null` on its own form POST, which the unlock
|
|
544
|
+
* route would refuse. The URL carries no secret.
|
|
545
|
+
*/
|
|
546
|
+
declare const hyleProtectedMetadata: Metadata;
|
|
547
|
+
/**
|
|
548
|
+
* The page behind a protected link (ADR 0039): `export default hyleProtectedPage({ baseUrl, token })` in `app/p/[id]/page.tsx`.
|
|
549
|
+
* It reads the visitor's cookie for this page and asks hyle for it: no cookie shows the password form, a cookie hyle refuses
|
|
550
|
+
* shows the form with "Wrong or expired password", and a good one draws the article as a published page does. A malformed id
|
|
551
|
+
* or a switched-off surface is `notFound()`. The page reads cookies, so it is rendered per request and never cached.
|
|
552
|
+
*/
|
|
553
|
+
declare function hyleProtectedPage(options: HylePreviewPageOptions): (props: {
|
|
554
|
+
params: Promise<{
|
|
555
|
+
id?: string;
|
|
556
|
+
}>;
|
|
557
|
+
}) => Promise<ReactElement>;
|
|
558
|
+
/**
|
|
559
|
+
* `export const { POST } = createProtectedUnlockRoute()` in `app/p/[id]/unlock/route.ts`. The form posts the password here; the
|
|
560
|
+
* route sets it in the page's HttpOnly cookie and sends the visitor back to `/p/<id>`, where the page checks it with hyle. It
|
|
561
|
+
* never calls hyle itself, so a view is one open. Only a same-origin POST with a form body of at most 1 KiB is read, and the
|
|
562
|
+
* password is stored only if it has the password's shape. The redirect target is built from the validated page id alone.
|
|
563
|
+
*/
|
|
564
|
+
declare function createProtectedUnlockRoute(): {
|
|
565
|
+
POST: (req: Request, ctx: {
|
|
566
|
+
params: Promise<{
|
|
567
|
+
id?: string;
|
|
568
|
+
}>;
|
|
569
|
+
}) => Promise<Response>;
|
|
570
|
+
};
|
|
571
|
+
|
|
572
|
+
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, type HylePreviewPageOptions, 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, createProtectedUnlockRoute, createRevalidateRoute, hyleFeed, hyleFeedLink, hyleMetadata, hylePage, hylePreviewMetadata, hylePreviewPage, hyleProtectedMetadata, hyleProtectedPage, hyleRootMetadata, hyleRootPage, hyleRootSitemap, hyleSitemap, markdownRewritePath };
|
package/dist/next.d.ts
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
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-
|
|
3
|
-
export { c as HyleCommentsFallback } from './embed-
|
|
4
|
-
import { F as FetchResolverOptions, H as HyleResolver } from './resolve-
|
|
5
|
-
export { f as fetchResolver, w as workspaceTags } from './resolve-
|
|
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-g7NT1CyB.js';
|
|
3
|
+
export { c as HyleCommentsFallback } from './embed-g7NT1CyB.js';
|
|
4
|
+
import { F as FetchResolverOptions, H as HyleResolver } from './resolve-BqC9l5RH.js';
|
|
5
|
+
export { f as fetchResolver, w as workspaceTags } from './resolve-BqC9l5RH.js';
|
|
6
6
|
import { MetadataRoute, ResolvingMetadata, Metadata } from 'next';
|
|
7
7
|
import { R as RevalidationCallbackOptions, b as RevalidationCallbackRoute } from './revalidation-callback-BQl77tQR.js';
|
|
8
|
-
import './
|
|
8
|
+
import { c as HyleCredential } from './client--ighAWaj.js';
|
|
9
|
+
import './types-b9QbmEDd.js';
|
|
9
10
|
|
|
10
11
|
type RouteParams = Record<string, string | string[] | undefined>;
|
|
11
12
|
interface CommonOptions {
|
|
@@ -108,16 +109,16 @@ interface CommonOptions {
|
|
|
108
109
|
* `"searchParams"` makes list pages paginate: `?cursor=` is read, sent to hyle, and an "Older posts" link is built from
|
|
109
110
|
* `next_cursor`. Default off, and the trade-off is real: reading `searchParams` makes the route dynamic, so it can no longer
|
|
110
111
|
* be statically generated or served from ISR (hyle's fetch cache still applies). Leave it off when one page of `listLimit`
|
|
111
|
-
* items is enough. A malformed `cursor` is ignored (the first page is shown); one that is well-formed but
|
|
112
|
+
* items is enough. A malformed `cursor` is ignored (the first page is shown); one that is well-formed but rejected by hyle is a 404.
|
|
112
113
|
*/
|
|
113
114
|
readonly paginate?: "searchParams";
|
|
114
115
|
/**
|
|
115
|
-
* Opt-in custom UI for
|
|
116
|
+
* Opt-in custom UI for hyle failures (network error, timeout, 5xx, any 4xx that is not hyle's NOT_FOUND, a malformed
|
|
116
117
|
* response, a refused redirect target). Without it `hylePage` rethrows them, so Next keeps serving the last good ISR page
|
|
117
118
|
* when a revalidation fails (and a failure on a first render is an uncached 500). With it, the returned element is a NORMAL
|
|
118
119
|
* render: it is cached for the revalidate window and replaces the last good page for that long, so prefer a boundary
|
|
119
120
|
* (`error.tsx`) unless you want that. The `error` can carry `Cp1ClientError.message` and `requestId`: never render it.
|
|
120
|
-
* Only its name is logged. A
|
|
121
|
+
* Only its name is logged. A not-found answer from hyle (or a `cursor` it refuses) is always `notFound()` and never reaches this, and
|
|
121
122
|
* `notFound()` and redirects are Next control flow that always propagate.
|
|
122
123
|
*/
|
|
123
124
|
readonly onError?: (error: unknown) => ReactElement;
|
|
@@ -145,8 +146,8 @@ interface PageProps {
|
|
|
145
146
|
* in front, and 301 maps to permanentRedirect (308) while 307 maps to redirect (temporary). A target equal to the current
|
|
146
147
|
* URL would loop, so it is treated as not found.
|
|
147
148
|
*
|
|
148
|
-
* Failure:
|
|
149
|
-
*
|
|
149
|
+
* Failure: only hyle's own not-found answer (or its refusal of the visitor's `cursor`) is `notFound()`. Every other failure (network error, timeout, 5xx, any other
|
|
150
|
+
* 4xx, a malformed response, a refused redirect target) is RETHROWN, so under ISR Next keeps serving the last good
|
|
150
151
|
* page when a revalidation fails, and a first-render failure is an uncached 500 rather than a cached soft 200. `onError`
|
|
151
152
|
* opts in to a custom element instead (see its docs). `notFound()` and redirects always propagate (`unstable_rethrow`).
|
|
152
153
|
*
|
|
@@ -193,8 +194,8 @@ declare function hyleFeedLink(options: HyleNextOptions, locale?: string): {
|
|
|
193
194
|
* when there is one). A list page canonicals to itself; with `paginate` a cursor page canonicals to its own `?cursor=` URL (never to the
|
|
194
195
|
* first page) and its title gets an "Older posts" suffix. Open Graph titles are always the bare title.
|
|
195
196
|
* Canonical and hreflang URLs are ABSOLUTE when `siteOrigin` is a bare https origin, else relative paths (set `metadataBase` in the host's root layout).
|
|
196
|
-
* Redirects, 404s and a switched-off read surface produce no metadata; `hylePage` handles those.
|
|
197
|
-
* gives no metadata; any other failure (network, timeout, 5xx,
|
|
197
|
+
* Redirects, 404s and a switched-off read surface produce no metadata; `hylePage` handles those. hyle's own not-found
|
|
198
|
+
* gives no metadata; any other failure (network, timeout, 5xx, any other 4xx) is rethrown, so an outage is not
|
|
198
199
|
* cached as a page; Next control flow is rethrown.
|
|
199
200
|
*/
|
|
200
201
|
declare function hyleMetadata(options: HyleNextOptions): (props: PageProps, parent?: ResolvingMetadata) => Promise<Metadata>;
|
|
@@ -258,8 +259,8 @@ declare const MOUNTS_MAX_STALE_MS: number;
|
|
|
258
259
|
* entries: `notFound()` with ZERO resolve calls, so junk URLs and bot probes never reach hyle;
|
|
259
260
|
* - otherwise the request is served by `hylePage` with `basePath` = the matched prefix (same locale, redirect and error rules).
|
|
260
261
|
*
|
|
261
|
-
* Failure of the mounts fetch:
|
|
262
|
-
* 5xx,
|
|
262
|
+
* Failure of the mounts fetch: the kill switch means nothing is served (404); 401 and 403 are rethrown at once. Any other
|
|
263
|
+
* failure (network, timeout, 5xx, any other 4xx, malformed body) uses the last mounts read successfully for up to 15 minutes, so a hyle outage keeps
|
|
263
264
|
* unmatched URLs a plain 404 and mounted pages on their last good render; with no such copy (a cold server) it is RETHROWN,
|
|
264
265
|
* because the URL might be a mounted page: Next keeps the last good ISR page, or a first render is an uncached 500. A host
|
|
265
266
|
* route never depends on this at all: Next matches it first. With a ROOT mount and no copy, every unmatched URL errors
|
|
@@ -301,7 +302,7 @@ interface MarkdownRoute {
|
|
|
301
302
|
* `hyleRootPage`. It serves the markdown source of a page the mounts serve (same mount matching, reserved paths, `locale`,
|
|
302
303
|
* `localePrefix`, fetch cache and tags as the page itself): `text/markdown; charset=utf-8` with `X-Robots-Tag: noindex`, asset links
|
|
303
304
|
* rewritten to the host's asset route. A redirect (301 becomes 308, 307 stays) goes to the target's `.md` twin; a list, an unknown
|
|
304
|
-
* path or
|
|
305
|
+
* path or hyle's not-found is 404; any other failure is 502 with no body. Reached by `markdownRewritePath` in the host's middleware.
|
|
305
306
|
* For a locale-prefixed site put the route under `[locale]` (`app/api/hyle/md/[locale]/[...path]/route.ts`) so `locale(params)` sees it.
|
|
306
307
|
*/
|
|
307
308
|
declare function createMarkdownRoute(options: Configs): MarkdownRoute;
|
|
@@ -374,11 +375,21 @@ interface AssetRoute {
|
|
|
374
375
|
* `img-src 'self'` (and `media-src 'self'`) CSP needs no change. hyle serves only assets that a currently published page of this
|
|
375
376
|
* workspace references, so an unpublished or other workspace's asset is a 404 here too.
|
|
376
377
|
*
|
|
377
|
-
*
|
|
378
|
+
* The same route serves the workspace's theme stylesheet as `theme-<scope>-<sha256>.css` (see `serveTheme`), which `<HyleTheme>` links.
|
|
379
|
+
*
|
|
380
|
+
* Safety: the only input is the `file` segment, matched against `<uuid>[.<ext>]` or the theme name before anything is sent, so this is not an open
|
|
378
381
|
* proxy. The browser's cookies and authorization header are never forwarded; only `Range`, `If-Range` and `If-None-Match` are.
|
|
379
382
|
* The response headers are built here (no upstream header is copied blindly), the content type must be on the asset allowlist,
|
|
380
383
|
* the body is size-capped and time-bounded, and every failure is an empty 404 or 502 that says nothing about hyle.
|
|
381
384
|
* The site switch `HYLE_CONTENT_ENABLED=0`/`false`, or missing configuration, answers 404.
|
|
385
|
+
*
|
|
386
|
+
* Draft preview (hyle ADR 0037): `?hyle_preview=<token>`, which the preview page puts on its own images, is sent to hyle as a
|
|
387
|
+
* header so that draft's assets load; every such answer is `no-store`. The token is never sent for the theme stylesheet,
|
|
388
|
+
* which is the credential's own with or without it. No other query parameter is read.
|
|
389
|
+
*
|
|
390
|
+
* Protected page (hyle ADR 0039): `?hyle_protected=<pageId>` takes the password from that page's cookie (`hyle_p_<pageId>`, set by
|
|
391
|
+
* `createProtectedUnlockRoute`) and forwards it as the `cp-protected` header. A missing or malformed cookie is a 404 that reaches
|
|
392
|
+
* nobody; every such answer is private and `no-store`, as a draft's is.
|
|
382
393
|
*/
|
|
383
394
|
declare function createAssetRoute(options: AssetRouteOptions): AssetRoute;
|
|
384
395
|
|
|
@@ -512,4 +523,50 @@ declare const ENGAGE_CSRF_HEADER = "x-hyle-engage";
|
|
|
512
523
|
*/
|
|
513
524
|
declare function createEngagementRoute(options: EngagementRouteOptions): EngagementRoute;
|
|
514
525
|
|
|
515
|
-
|
|
526
|
+
/** The credential and base URL of `createHyleClient`, plus how your article pages are drawn. */
|
|
527
|
+
type HylePreviewPageOptions = HyleCredential & {
|
|
528
|
+
readonly baseUrl: string;
|
|
529
|
+
} & Pick<CommonOptions, "components" | "slots" | "layout" | "localePrefix">;
|
|
530
|
+
/** `export const metadata = hylePreviewMetadata`, next to `hylePreviewPage`. The page also renders both tags itself. */
|
|
531
|
+
declare const hylePreviewMetadata: Metadata;
|
|
532
|
+
/**
|
|
533
|
+
* The page behind hyle's "Open on site" (ADR 0037): `export default hylePreviewPage({ baseUrl, token })` in
|
|
534
|
+
* `app/hyle-preview/page.tsx`. It draws the draft behind `?token=` with your article components; a missing, wrong or
|
|
535
|
+
* expired token is `notFound()`. The page opens with an "Unpublished draft preview" banner. Nothing is cached (it reads
|
|
536
|
+
* `searchParams` and fetches `no-store`), the page is noindex with no referrer, and the token is never logged. Keep
|
|
537
|
+
* analytics off this route: its URL carries the token.
|
|
538
|
+
*/
|
|
539
|
+
declare function hylePreviewPage(options: HylePreviewPageOptions): (props: PageProps) => Promise<ReactElement>;
|
|
540
|
+
|
|
541
|
+
/**
|
|
542
|
+
* `export const metadata = hyleProtectedMetadata`, next to `hyleProtectedPage`. The page also renders both tags itself. The
|
|
543
|
+
* referrer is `same-origin`, not `no-referrer`: a no-referrer page sends `Origin: null` on its own form POST, which the unlock
|
|
544
|
+
* route would refuse. The URL carries no secret.
|
|
545
|
+
*/
|
|
546
|
+
declare const hyleProtectedMetadata: Metadata;
|
|
547
|
+
/**
|
|
548
|
+
* The page behind a protected link (ADR 0039): `export default hyleProtectedPage({ baseUrl, token })` in `app/p/[id]/page.tsx`.
|
|
549
|
+
* It reads the visitor's cookie for this page and asks hyle for it: no cookie shows the password form, a cookie hyle refuses
|
|
550
|
+
* shows the form with "Wrong or expired password", and a good one draws the article as a published page does. A malformed id
|
|
551
|
+
* or a switched-off surface is `notFound()`. The page reads cookies, so it is rendered per request and never cached.
|
|
552
|
+
*/
|
|
553
|
+
declare function hyleProtectedPage(options: HylePreviewPageOptions): (props: {
|
|
554
|
+
params: Promise<{
|
|
555
|
+
id?: string;
|
|
556
|
+
}>;
|
|
557
|
+
}) => Promise<ReactElement>;
|
|
558
|
+
/**
|
|
559
|
+
* `export const { POST } = createProtectedUnlockRoute()` in `app/p/[id]/unlock/route.ts`. The form posts the password here; the
|
|
560
|
+
* route sets it in the page's HttpOnly cookie and sends the visitor back to `/p/<id>`, where the page checks it with hyle. It
|
|
561
|
+
* never calls hyle itself, so a view is one open. Only a same-origin POST with a form body of at most 1 KiB is read, and the
|
|
562
|
+
* password is stored only if it has the password's shape. The redirect target is built from the validated page id alone.
|
|
563
|
+
*/
|
|
564
|
+
declare function createProtectedUnlockRoute(): {
|
|
565
|
+
POST: (req: Request, ctx: {
|
|
566
|
+
params: Promise<{
|
|
567
|
+
id?: string;
|
|
568
|
+
}>;
|
|
569
|
+
}) => Promise<Response>;
|
|
570
|
+
};
|
|
571
|
+
|
|
572
|
+
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, type HylePreviewPageOptions, 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, createProtectedUnlockRoute, createRevalidateRoute, hyleFeed, hyleFeedLink, hyleMetadata, hylePage, hylePreviewMetadata, hylePreviewPage, hyleProtectedMetadata, hyleProtectedPage, hyleRootMetadata, hyleRootPage, hyleRootSitemap, hyleSitemap, markdownRewritePath };
|