@tdacorp/hyle-sdk 0.24.0 → 0.26.1
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 +7 -5
- package/dist/{embed-B7T--kTT.d.cts → brand-CwXvdSkk.d.ts} +14 -2
- package/dist/{embed-DavTgSU4.d.ts → brand-IuZSB9UX.d.cts} +14 -2
- package/dist/check-routes-bin.js +10 -5
- package/dist/{chunk-4REU4HJI.js → chunk-3UQGU62T.js} +22 -5
- package/dist/{chunk-SY2FMIRZ.js → chunk-IDBQSMWT.js} +1 -1
- package/dist/{chunk-5TKJH2XC.js → chunk-NUQQ6VHH.js} +267 -43
- package/dist/{chunk-Y3BACEWA.js → chunk-T4EZAQFU.js} +129 -3
- package/dist/chunk-VAR2B7S6.js +82 -0
- package/dist/{chunk-U74B7AUG.js → chunk-ZWKAEWEW.js} +22 -74
- package/dist/{client-BErei7cE.d.ts → client-B2zi_BGq.d.ts} +11 -4
- package/dist/{client-DrB2vcTi.d.cts → client-DBZTvcCh.d.cts} +11 -4
- package/dist/comments.cjs +25 -1
- package/dist/comments.js +4 -2
- package/dist/html.cjs +129 -3
- package/dist/html.js +1 -1
- package/dist/index.cjs +22 -5
- package/dist/index.d.cts +4 -4
- package/dist/index.d.ts +4 -4
- package/dist/index.js +1 -1
- package/dist/next.cjs +674 -211
- package/dist/next.d.cts +44 -18
- package/dist/next.d.ts +44 -18
- package/dist/next.js +241 -135
- package/dist/react.cjs +401 -46
- package/dist/react.d.cts +114 -4
- package/dist/react.d.ts +114 -4
- package/dist/react.js +14 -4
- package/dist/reactions.cjs +25 -1
- package/dist/reactions.js +4 -2
- package/dist/{resolve-03IVloXU.d.cts → resolve-0nGnsIHo.d.cts} +1 -1
- package/dist/{resolve-BseM68oy.d.ts → resolve-CguSaZLa.d.ts} +1 -1
- package/dist/{revalidation-callback-BQl77tQR.d.cts → revalidation-callback-FT9ik1dh.d.cts} +11 -0
- package/dist/{revalidation-callback-BQl77tQR.d.ts → revalidation-callback-FT9ik1dh.d.ts} +11 -0
- package/dist/share-client.cjs +498 -0
- package/dist/share-client.d.cts +99 -0
- package/dist/share-client.d.ts +99 -0
- package/dist/share-client.js +390 -0
- package/dist/styles.css +176 -1
- package/dist/{types-Dx-fEiZd.d.cts → types-CdaIzSjg.d.cts} +10 -3
- package/dist/{types-Dx-fEiZd.d.ts → types-CdaIzSjg.d.ts} +10 -3
- package/dist/use-cache.cjs +10 -5
- package/dist/use-cache.d.cts +3 -3
- package/dist/use-cache.d.ts +3 -3
- package/dist/use-cache.js +2 -2
- package/package.json +1 -1
package/dist/next.d.cts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
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 './
|
|
3
|
-
export { c as HyleCommentsFallback } from './
|
|
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, S as ShareHost, b as EmbedHeading } from './brand-IuZSB9UX.cjs';
|
|
3
|
+
export { c as HyleCommentsFallback } from './brand-IuZSB9UX.cjs';
|
|
4
|
+
import { F as FetchResolverOptions, H as HyleResolver } from './resolve-0nGnsIHo.cjs';
|
|
5
|
+
export { f as fetchResolver, w as workspaceTags } from './resolve-0nGnsIHo.cjs';
|
|
6
6
|
import { MetadataRoute, ResolvingMetadata, Metadata } from 'next';
|
|
7
|
-
import { R as RevalidationCallbackOptions, b as RevalidationCallbackRoute } from './revalidation-callback-
|
|
8
|
-
import { c as HyleCredential } from './client-
|
|
7
|
+
import { R as RevalidationCallbackOptions, b as RevalidationCallbackRoute } from './revalidation-callback-FT9ik1dh.cjs';
|
|
8
|
+
import { c as HyleCredential } from './client-DBZTvcCh.cjs';
|
|
9
9
|
import { NextRequest, NextResponse } from 'next/server';
|
|
10
|
-
import './types-
|
|
10
|
+
import './types-CdaIzSjg.cjs';
|
|
11
11
|
|
|
12
12
|
type RouteParams = Record<string, string | string[] | undefined>;
|
|
13
13
|
interface CommonOptions {
|
|
@@ -222,6 +222,16 @@ interface RevalidateRouteOptions {
|
|
|
222
222
|
readonly secrets: readonly (string | undefined)[];
|
|
223
223
|
/** Comment notifications, see `RevalidationCallbackOptions.onCommentEvent`. */
|
|
224
224
|
readonly onCommentEvent?: RevalidationCallbackOptions["onCommentEvent"];
|
|
225
|
+
/**
|
|
226
|
+
* Tell search engines (IndexNow) about the addresses a publish changed. Submits only in production and only with a key.
|
|
227
|
+
* The origin is this option's alone, never the payload's, and must be a bare https origin (else logged and off).
|
|
228
|
+
* `localePrefix` is the host's, as in `hylePage` (docs/cp1-spec.md section 5.3.5).
|
|
229
|
+
*/
|
|
230
|
+
readonly indexNow?: {
|
|
231
|
+
readonly origin: string;
|
|
232
|
+
readonly key: string | undefined;
|
|
233
|
+
readonly localePrefix?: (locale: string) => string;
|
|
234
|
+
};
|
|
225
235
|
/** Environment to read the site switch from. Default process.env. */
|
|
226
236
|
readonly env?: Readonly<Record<string, string | undefined>>;
|
|
227
237
|
}
|
|
@@ -247,6 +257,8 @@ type HyleRootConfig = Omit<Extract<HyleNextOptions, {
|
|
|
247
257
|
* (a given `list` or `jsonLd` replaces the config's whole value). Lets one mount carry its own `titleTemplate`, `ogImage`, `jsonLd`, `list` or `siteOrigin`.
|
|
248
258
|
*/
|
|
249
259
|
readonly mountOptions?: Readonly<Record<string, Partial<Pick<CommonOptions, "titleTemplate" | "list" | "ogImage" | "jsonLd" | "siteOrigin">>>>;
|
|
260
|
+
/** The host's logo and name in a protected share's bar (`chrome.brand` is the slot alternative). Only protected shares read it. */
|
|
261
|
+
readonly host?: ShareHost;
|
|
250
262
|
};
|
|
251
263
|
type Configs = HyleRootConfig | readonly HyleRootConfig[];
|
|
252
264
|
/** How long a mounts copy that could not be refreshed may still be used. Past this a transient failure is rethrown. */
|
|
@@ -546,10 +558,11 @@ declare function hylePreviewPage(options: HylePreviewPageOptions): (props: PageP
|
|
|
546
558
|
declare const hyleProtectedMetadata: Metadata;
|
|
547
559
|
/**
|
|
548
560
|
* `export const { POST } = createProtectedUnlockRoute()` in `app/hyle-protected/unlock/route.ts` (ADR 0040). The password form
|
|
549
|
-
* posts `slug
|
|
550
|
-
*
|
|
551
|
-
*
|
|
552
|
-
*
|
|
561
|
+
* posts `slug`, `password` and the optional `docSlug` here; the Lock button posts `slug` and `lock=1`. A password sets the share's
|
|
562
|
+
* HttpOnly cookie (scoped to `/<slug>` and the asset route, so no other request of the host carries it) and sends the visitor to
|
|
563
|
+
* the share, where the page checks it with hyle. `lock=1` clears that cookie on both paths and sends the visitor to the gate with
|
|
564
|
+
* `?locked=1`. It never calls hyle, so a view is one open. Only a same-origin POST with a form body of at most 1 KiB is read, and
|
|
565
|
+
* the redirect is built from the validated slugs alone.
|
|
553
566
|
*/
|
|
554
567
|
declare function createProtectedUnlockRoute(): {
|
|
555
568
|
POST: (req: Request) => Promise<Response>;
|
|
@@ -561,17 +574,30 @@ declare function createProtectedUnlockRoute(): {
|
|
|
561
574
|
* `const share = hyleProtectedProxy(configs); export async function proxy(req) { return (await share(req)) ?? NextResponse.next(); }`.
|
|
562
575
|
* A path under a live share slug is REWRITTEN to `/hyle-protected/view/<path>` (the visitor's URL does not change); every other
|
|
563
576
|
* request returns undefined, so the host's ordinary pages stay cached. A proxy has no fetch cache, so it keeps ONE read of hyle's
|
|
564
|
-
* mounts per config in memory
|
|
565
|
-
*
|
|
566
|
-
*
|
|
567
|
-
*
|
|
577
|
+
* mounts per config in memory and matches every path against it locally: random paths never cost a call to hyle. It is
|
|
578
|
+
* stale-while-revalidate: after 30 seconds the copy it has is still used at once and ONE refresh runs in the background (a failed
|
|
579
|
+
* refresh keeps the copy, within the 15 minutes `hyleRootPage` also allows), so a slow hyle delays no request. Only with no copy
|
|
580
|
+
* at all (a cold start) does a request wait, for `lookupTimeoutMs` (default 1500) at most, then it passes through as not a share;
|
|
581
|
+
* the read goes on and the next request finds its result. The page behind the rewrite checks again through the usual mounts cache.
|
|
582
|
+
* A mounts read that fails with no copy counts as "not a share" for those 30 seconds rather than erroring every request of the host.
|
|
568
583
|
*/
|
|
569
|
-
declare function hyleProtectedProxy(options: Configs
|
|
570
|
-
|
|
571
|
-
|
|
584
|
+
declare function hyleProtectedProxy(options: Configs, { lookupTimeoutMs }?: {
|
|
585
|
+
readonly lookupTimeoutMs?: number;
|
|
586
|
+
}): (req: NextRequest) => Promise<NextResponse | undefined>;
|
|
587
|
+
/**
|
|
588
|
+
* The page of `app/hyle-protected/view/[[...path]]/page.tsx` (see `hyleProtectedProxy`): the share under the path, else `notFound()`.
|
|
589
|
+
* The visitor's address goes to hyle with every read: by default the first `x-forwarded-for` hop, else `x-real-ip`; pass `clientIp`
|
|
590
|
+
* to read it from where your platform puts it (the first hop is only the visitor's when your edge overwrites that header).
|
|
591
|
+
*/
|
|
592
|
+
declare function hyleProtectedPage(options: Configs, { clientIp }?: {
|
|
593
|
+
readonly clientIp?: (headers: Headers) => string | undefined;
|
|
594
|
+
}): (props: {
|
|
572
595
|
readonly params: Promise<{
|
|
573
596
|
readonly path?: string[];
|
|
574
597
|
}>;
|
|
598
|
+
readonly searchParams?: Promise<{
|
|
599
|
+
readonly locked?: string | string[];
|
|
600
|
+
}>;
|
|
575
601
|
}) => Promise<ReactElement>;
|
|
576
602
|
|
|
577
603
|
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, hyleProtectedProxy, hyleRootMetadata, hyleRootPage, hyleRootSitemap, hyleSitemap, markdownRewritePath };
|
package/dist/next.d.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
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 './
|
|
3
|
-
export { c as HyleCommentsFallback } from './
|
|
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, S as ShareHost, b as EmbedHeading } from './brand-CwXvdSkk.js';
|
|
3
|
+
export { c as HyleCommentsFallback } from './brand-CwXvdSkk.js';
|
|
4
|
+
import { F as FetchResolverOptions, H as HyleResolver } from './resolve-CguSaZLa.js';
|
|
5
|
+
export { f as fetchResolver, w as workspaceTags } from './resolve-CguSaZLa.js';
|
|
6
6
|
import { MetadataRoute, ResolvingMetadata, Metadata } from 'next';
|
|
7
|
-
import { R as RevalidationCallbackOptions, b as RevalidationCallbackRoute } from './revalidation-callback-
|
|
8
|
-
import { c as HyleCredential } from './client-
|
|
7
|
+
import { R as RevalidationCallbackOptions, b as RevalidationCallbackRoute } from './revalidation-callback-FT9ik1dh.js';
|
|
8
|
+
import { c as HyleCredential } from './client-B2zi_BGq.js';
|
|
9
9
|
import { NextRequest, NextResponse } from 'next/server';
|
|
10
|
-
import './types-
|
|
10
|
+
import './types-CdaIzSjg.js';
|
|
11
11
|
|
|
12
12
|
type RouteParams = Record<string, string | string[] | undefined>;
|
|
13
13
|
interface CommonOptions {
|
|
@@ -222,6 +222,16 @@ interface RevalidateRouteOptions {
|
|
|
222
222
|
readonly secrets: readonly (string | undefined)[];
|
|
223
223
|
/** Comment notifications, see `RevalidationCallbackOptions.onCommentEvent`. */
|
|
224
224
|
readonly onCommentEvent?: RevalidationCallbackOptions["onCommentEvent"];
|
|
225
|
+
/**
|
|
226
|
+
* Tell search engines (IndexNow) about the addresses a publish changed. Submits only in production and only with a key.
|
|
227
|
+
* The origin is this option's alone, never the payload's, and must be a bare https origin (else logged and off).
|
|
228
|
+
* `localePrefix` is the host's, as in `hylePage` (docs/cp1-spec.md section 5.3.5).
|
|
229
|
+
*/
|
|
230
|
+
readonly indexNow?: {
|
|
231
|
+
readonly origin: string;
|
|
232
|
+
readonly key: string | undefined;
|
|
233
|
+
readonly localePrefix?: (locale: string) => string;
|
|
234
|
+
};
|
|
225
235
|
/** Environment to read the site switch from. Default process.env. */
|
|
226
236
|
readonly env?: Readonly<Record<string, string | undefined>>;
|
|
227
237
|
}
|
|
@@ -247,6 +257,8 @@ type HyleRootConfig = Omit<Extract<HyleNextOptions, {
|
|
|
247
257
|
* (a given `list` or `jsonLd` replaces the config's whole value). Lets one mount carry its own `titleTemplate`, `ogImage`, `jsonLd`, `list` or `siteOrigin`.
|
|
248
258
|
*/
|
|
249
259
|
readonly mountOptions?: Readonly<Record<string, Partial<Pick<CommonOptions, "titleTemplate" | "list" | "ogImage" | "jsonLd" | "siteOrigin">>>>;
|
|
260
|
+
/** The host's logo and name in a protected share's bar (`chrome.brand` is the slot alternative). Only protected shares read it. */
|
|
261
|
+
readonly host?: ShareHost;
|
|
250
262
|
};
|
|
251
263
|
type Configs = HyleRootConfig | readonly HyleRootConfig[];
|
|
252
264
|
/** How long a mounts copy that could not be refreshed may still be used. Past this a transient failure is rethrown. */
|
|
@@ -546,10 +558,11 @@ declare function hylePreviewPage(options: HylePreviewPageOptions): (props: PageP
|
|
|
546
558
|
declare const hyleProtectedMetadata: Metadata;
|
|
547
559
|
/**
|
|
548
560
|
* `export const { POST } = createProtectedUnlockRoute()` in `app/hyle-protected/unlock/route.ts` (ADR 0040). The password form
|
|
549
|
-
* posts `slug
|
|
550
|
-
*
|
|
551
|
-
*
|
|
552
|
-
*
|
|
561
|
+
* posts `slug`, `password` and the optional `docSlug` here; the Lock button posts `slug` and `lock=1`. A password sets the share's
|
|
562
|
+
* HttpOnly cookie (scoped to `/<slug>` and the asset route, so no other request of the host carries it) and sends the visitor to
|
|
563
|
+
* the share, where the page checks it with hyle. `lock=1` clears that cookie on both paths and sends the visitor to the gate with
|
|
564
|
+
* `?locked=1`. It never calls hyle, so a view is one open. Only a same-origin POST with a form body of at most 1 KiB is read, and
|
|
565
|
+
* the redirect is built from the validated slugs alone.
|
|
553
566
|
*/
|
|
554
567
|
declare function createProtectedUnlockRoute(): {
|
|
555
568
|
POST: (req: Request) => Promise<Response>;
|
|
@@ -561,17 +574,30 @@ declare function createProtectedUnlockRoute(): {
|
|
|
561
574
|
* `const share = hyleProtectedProxy(configs); export async function proxy(req) { return (await share(req)) ?? NextResponse.next(); }`.
|
|
562
575
|
* A path under a live share slug is REWRITTEN to `/hyle-protected/view/<path>` (the visitor's URL does not change); every other
|
|
563
576
|
* request returns undefined, so the host's ordinary pages stay cached. A proxy has no fetch cache, so it keeps ONE read of hyle's
|
|
564
|
-
* mounts per config in memory
|
|
565
|
-
*
|
|
566
|
-
*
|
|
567
|
-
*
|
|
577
|
+
* mounts per config in memory and matches every path against it locally: random paths never cost a call to hyle. It is
|
|
578
|
+
* stale-while-revalidate: after 30 seconds the copy it has is still used at once and ONE refresh runs in the background (a failed
|
|
579
|
+
* refresh keeps the copy, within the 15 minutes `hyleRootPage` also allows), so a slow hyle delays no request. Only with no copy
|
|
580
|
+
* at all (a cold start) does a request wait, for `lookupTimeoutMs` (default 1500) at most, then it passes through as not a share;
|
|
581
|
+
* the read goes on and the next request finds its result. The page behind the rewrite checks again through the usual mounts cache.
|
|
582
|
+
* A mounts read that fails with no copy counts as "not a share" for those 30 seconds rather than erroring every request of the host.
|
|
568
583
|
*/
|
|
569
|
-
declare function hyleProtectedProxy(options: Configs
|
|
570
|
-
|
|
571
|
-
|
|
584
|
+
declare function hyleProtectedProxy(options: Configs, { lookupTimeoutMs }?: {
|
|
585
|
+
readonly lookupTimeoutMs?: number;
|
|
586
|
+
}): (req: NextRequest) => Promise<NextResponse | undefined>;
|
|
587
|
+
/**
|
|
588
|
+
* The page of `app/hyle-protected/view/[[...path]]/page.tsx` (see `hyleProtectedProxy`): the share under the path, else `notFound()`.
|
|
589
|
+
* The visitor's address goes to hyle with every read: by default the first `x-forwarded-for` hop, else `x-real-ip`; pass `clientIp`
|
|
590
|
+
* to read it from where your platform puts it (the first hop is only the visitor's when your edge overwrites that header).
|
|
591
|
+
*/
|
|
592
|
+
declare function hyleProtectedPage(options: Configs, { clientIp }?: {
|
|
593
|
+
readonly clientIp?: (headers: Headers) => string | undefined;
|
|
594
|
+
}): (props: {
|
|
572
595
|
readonly params: Promise<{
|
|
573
596
|
readonly path?: string[];
|
|
574
597
|
}>;
|
|
598
|
+
readonly searchParams?: Promise<{
|
|
599
|
+
readonly locked?: string | string[];
|
|
600
|
+
}>;
|
|
575
601
|
}) => Promise<ReactElement>;
|
|
576
602
|
|
|
577
603
|
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, hyleProtectedProxy, hyleRootMetadata, hyleRootPage, hyleRootSitemap, hyleSitemap, markdownRewritePath };
|