@stratal/inertia 0.0.26 → 0.1.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/CHANGELOG.md +359 -0
- package/README.md +158 -14
- package/dist/build-seo-tags-DBsHKxX9.mjs.map +1 -1
- package/dist/{decorate-B7nr7eBl.mjs → decorate-RQD1h28J.mjs} +1 -1
- package/dist/generator/type-generator.worker.d.mts +1 -1
- package/dist/generator/type-generator.worker.mjs +1 -1
- package/dist/index.d.mts +214 -92
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +390 -130
- package/dist/index.mjs.map +1 -1
- package/dist/quarry.d.mts +6 -8
- package/dist/quarry.d.mts.map +1 -1
- package/dist/quarry.mjs +127 -12
- package/dist/quarry.mjs.map +1 -1
- package/dist/react/access.d.mts +95 -0
- package/dist/react/access.d.mts.map +1 -0
- package/dist/react/access.mjs +133 -0
- package/dist/react/access.mjs.map +1 -0
- package/dist/react-dom-server-legacy-stub.d.mts +20 -0
- package/dist/react-dom-server-legacy-stub.d.mts.map +1 -0
- package/dist/react-dom-server-legacy-stub.mjs +25 -0
- package/dist/react-dom-server-legacy-stub.mjs.map +1 -0
- package/dist/react.d.mts +4 -6
- package/dist/react.d.mts.map +1 -1
- package/dist/react.mjs +1 -1
- package/dist/react.mjs.map +1 -1
- package/dist/seo-runtime.d.mts +1 -1
- package/dist/seo-runtime.mjs +8 -6
- package/dist/seo-runtime.mjs.map +1 -1
- package/dist/services/ssr-exclusion.d.mts +38 -0
- package/dist/services/ssr-exclusion.d.mts.map +1 -0
- package/dist/services/ssr-exclusion.mjs +0 -0
- package/dist/services/ssr-exclusion.mjs.map +1 -0
- package/dist/ssr.d.mts +37 -8
- package/dist/ssr.d.mts.map +1 -1
- package/dist/ssr.mjs +7 -4
- package/dist/ssr.mjs.map +1 -1
- package/dist/testing.d.mts +3 -2
- package/dist/testing.d.mts.map +1 -1
- package/dist/testing.mjs +20 -6
- package/dist/testing.mjs.map +1 -1
- package/dist/{type-generator-DFpha_Fp.mjs → type-generator-BVw8mj1y.mjs} +373 -64
- package/dist/type-generator-BVw8mj1y.mjs.map +1 -0
- package/dist/types-BltKoOR7.d.mts +193 -0
- package/dist/types-BltKoOR7.d.mts.map +1 -0
- package/dist/types-D-j_Ee_h.d.mts +52 -0
- package/dist/types-D-j_Ee_h.d.mts.map +1 -0
- package/dist/types-DzE1pdZs.d.mts.map +1 -1
- package/dist/vite.d.mts +19 -6
- package/dist/vite.d.mts.map +1 -1
- package/dist/vite.mjs +67 -5
- package/dist/vite.mjs.map +1 -1
- package/package.json +38 -27
- package/dist/type-generator-DFpha_Fp.mjs.map +0 -1
- package/dist/types-BhgXhWx6.d.mts +0 -82
- package/dist/types-BhgXhWx6.d.mts.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as runTypeGeneration } from "../type-generator-
|
|
1
|
+
import { n as runTypeGeneration } from "../type-generator-BVw8mj1y.mjs";
|
|
2
2
|
import { parentPort, workerData } from "node:worker_threads";
|
|
3
3
|
//#region src/generator/type-generator.worker.ts
|
|
4
4
|
async function main() {
|
package/dist/index.d.mts
CHANGED
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
/// <reference path="../global.d.ts" />
|
|
2
2
|
import { a as SeoTagDescriptor, i as SeoOpenGraph, n as SeoLinkTag, o as SeoTwitter, r as SeoMetaTag, t as SeoData } from "./types-DzE1pdZs.mjs";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
3
|
+
import { C as InertiaSsrBundle, D as SharedDataResolver, E as ResolvedInertiaPageProps, O as ViteManifest, S as InertiaSharedProps, T as InertiaTranslationKeys, _ as InertiaScrollMetadata, a as InertiaFullPageProps, b as InertiaScrollPageIdentifier, c as InertiaMergeStrategy, d as InertiaPage, f as InertiaPageComponent, g as InertiaRenderOptions, h as InertiaPropResolution, i as InertiaDeferredProp, k as ViteManifestEntry, l as InertiaOnceProp, m as InertiaPartialRequest, n as INERTIA_VARY_HEADERS, o as InertiaI18nConfig, p as InertiaPageRegistry, r as InertiaAlwaysProp, s as InertiaMergeProp, t as INERTIA_SCROLL_MERGE_INTENT_HEADER, u as InertiaOptionalProp, v as InertiaScrollMetadataResolver, w as InertiaSsrResult, x as InertiaScrollProp, y as InertiaScrollOptions } from "./types-BltKoOR7.mjs";
|
|
4
|
+
import { a as RoleName, i as Permission, n as AccessControlRegistryNotGenerated, o as SharedAccess, r as Check, t as AccessControlRegistry } from "./types-D-j_Ee_h.mjs";
|
|
5
|
+
import { ApplicationError, ExceptionHandler } from "stratal/errors";
|
|
5
6
|
import { AsyncModuleOptions, DynamicModule, OnException, OnInitialize } from "stratal/module";
|
|
6
7
|
import { Middleware, Next, RouteConfig, RouteConfigurable, Router, RouterContext } from "stratal/router";
|
|
7
8
|
import { Container } from "stratal/di";
|
|
8
9
|
import { MessageKeyPrefix } from "stratal/i18n";
|
|
9
|
-
import { z } from "stratal/validation";
|
|
10
10
|
import { Page } from "@inertiajs/core";
|
|
11
11
|
import { CookieOptions } from "hono/utils/cookie";
|
|
12
|
-
|
|
13
12
|
//#region src/flash/flash-store.d.ts
|
|
14
13
|
interface FlashStore {
|
|
15
14
|
read(ctx: RouterContext): Promise<Record<string, unknown>>;
|
|
@@ -22,11 +21,6 @@ interface InertiaSsrOptions {
|
|
|
22
21
|
bundle: () => Promise<InertiaSsrBundle | {
|
|
23
22
|
default: InertiaSsrBundle;
|
|
24
23
|
}>;
|
|
25
|
-
/**
|
|
26
|
-
* Route patterns where SSR is disabled (e.g., `"admin/*"`).
|
|
27
|
-
* Uses simple glob matching against the request pathname.
|
|
28
|
-
*/
|
|
29
|
-
disabled?: string[];
|
|
30
24
|
}
|
|
31
25
|
/**
|
|
32
26
|
* Configuration for sharing i18n messages with the frontend.
|
|
@@ -166,7 +160,7 @@ interface InertiaModuleOptions {
|
|
|
166
160
|
}
|
|
167
161
|
//#endregion
|
|
168
162
|
//#region src/inertia.module.d.ts
|
|
169
|
-
declare class InertiaModule implements RouteConfigurable, OnInitialize, OnException {
|
|
163
|
+
export declare class InertiaModule implements RouteConfigurable, OnInitialize, OnException {
|
|
170
164
|
static forRoot(options: InertiaModuleOptions): DynamicModule;
|
|
171
165
|
static forRootAsync(options: AsyncModuleOptions<InertiaModuleOptions>): DynamicModule;
|
|
172
166
|
configureRoutes(router: Router): void;
|
|
@@ -194,12 +188,13 @@ declare class InertiaModule implements RouteConfigurable, OnInitialize, OnExcept
|
|
|
194
188
|
}
|
|
195
189
|
//#endregion
|
|
196
190
|
//#region src/inertia.tokens.d.ts
|
|
197
|
-
declare const INERTIA_TOKENS: {
|
|
191
|
+
export declare const INERTIA_TOKENS: {
|
|
198
192
|
readonly Options: symbol;
|
|
199
193
|
readonly InertiaService: symbol;
|
|
200
194
|
readonly TemplateService: symbol;
|
|
201
195
|
readonly ManifestService: symbol;
|
|
202
196
|
readonly SsrRenderer: symbol;
|
|
197
|
+
readonly DocumentRenderer: symbol;
|
|
203
198
|
readonly HreflangService: symbol;
|
|
204
199
|
readonly SeoService: symbol;
|
|
205
200
|
};
|
|
@@ -210,7 +205,7 @@ declare const INERTIA_TOKENS: {
|
|
|
210
205
|
* it on injected tags and the client head-sync runtime uses it to find and
|
|
211
206
|
* reconcile the same tags across SPA navigations.
|
|
212
207
|
*/
|
|
213
|
-
declare const DATA_SEO_ATTR = "data-seo";
|
|
208
|
+
export declare const DATA_SEO_ATTR = "data-seo";
|
|
214
209
|
/**
|
|
215
210
|
* Maps resolved {@link SeoData} into a flat list of {@link SeoTagDescriptor}s.
|
|
216
211
|
*
|
|
@@ -218,9 +213,9 @@ declare const DATA_SEO_ATTR = "data-seo";
|
|
|
218
213
|
* client-side to build DOM nodes, so the two never drift. Every descriptor
|
|
219
214
|
* carries the {@link DATA_SEO_ATTR} marker.
|
|
220
215
|
*/
|
|
221
|
-
declare function buildSeoTags(data: SeoData): SeoTagDescriptor[];
|
|
216
|
+
export declare function buildSeoTags(data: SeoData): SeoTagDescriptor[];
|
|
222
217
|
/** Renders a descriptor to an HTML string with attribute/text escaping (server-side). */
|
|
223
|
-
declare function descriptorToHtml(d: SeoTagDescriptor): string;
|
|
218
|
+
export declare function descriptorToHtml(d: SeoTagDescriptor): string;
|
|
224
219
|
//#endregion
|
|
225
220
|
//#region src/flash/cookie-flash-store.d.ts
|
|
226
221
|
interface CookieFlashStoreOptions {
|
|
@@ -228,7 +223,7 @@ interface CookieFlashStoreOptions {
|
|
|
228
223
|
cookie?: string;
|
|
229
224
|
cookieOptions?: CookieOptions;
|
|
230
225
|
}
|
|
231
|
-
declare class CookieFlashStore implements FlashStore {
|
|
226
|
+
export declare class CookieFlashStore implements FlashStore {
|
|
232
227
|
private readonly cookieName;
|
|
233
228
|
private readonly secret;
|
|
234
229
|
private readonly cookieOptions;
|
|
@@ -238,6 +233,22 @@ declare class CookieFlashStore implements FlashStore {
|
|
|
238
233
|
clear(ctx: RouterContext): Promise<void>;
|
|
239
234
|
}
|
|
240
235
|
//#endregion
|
|
236
|
+
//#region src/errors/unrecognized-scroll-shape.error.d.ts
|
|
237
|
+
/**
|
|
238
|
+
* Raised when `ctx.scroll()` is handed a value whose paging identifiers it
|
|
239
|
+
* cannot derive: neither the offset shape `{ data, pagination: { page,
|
|
240
|
+
* totalPages } }` nor the cursor shape `{ data, cursorName, cursor, nextCursor,
|
|
241
|
+
* prevCursor }`.
|
|
242
|
+
*
|
|
243
|
+
* A **programming error**, and deliberately loud: guessing an identifier is
|
|
244
|
+
* worse than failing, because a wrong `nextPage` reads to the client as "no
|
|
245
|
+
* more pages" and silently truncates the list. No request recovers from it and
|
|
246
|
+
* it carries no HTTP status. The fix is in the route — return one of the two
|
|
247
|
+
* recognized shapes, or pass `metadata` to `ctx.scroll()` to extract
|
|
248
|
+
* `pageName`, `currentPage`, `previousPage` and `nextPage` from this one.
|
|
249
|
+
*/
|
|
250
|
+
export declare class UnrecognizedScrollShapeError extends ApplicationError {}
|
|
251
|
+
//#endregion
|
|
241
252
|
//#region src/augment/router-context.d.ts
|
|
242
253
|
interface InertiaMergeOptions {
|
|
243
254
|
strategy?: InertiaMergeStrategy;
|
|
@@ -257,6 +268,14 @@ declare module 'stratal/router' {
|
|
|
257
268
|
optional<T>(callback: () => T): InertiaOptionalProp<T>;
|
|
258
269
|
/** Creates a mergeable prop that merges with existing client-side page data instead of replacing it. */
|
|
259
270
|
merge<T>(callback: () => T, options?: InertiaMergeOptions): InertiaMergeProp<T>;
|
|
271
|
+
/**
|
|
272
|
+
* Creates a scroll-paginated prop for the client's `<InfiniteScroll>`: a merge
|
|
273
|
+
* prop that also publishes the pagination identifiers the component needs.
|
|
274
|
+
* The rows accumulate under the `wrapper` key (`data` by default) while the
|
|
275
|
+
* prop value keeps its paginator shape, and the request — not the caller —
|
|
276
|
+
* decides whether a page is appended or prepended.
|
|
277
|
+
*/
|
|
278
|
+
scroll<T>(callback: () => T | Promise<T>, options?: InertiaScrollOptions<T>): InertiaScrollProp<T>;
|
|
260
279
|
/** Creates a prop that is only sent on the first visit and cached for subsequent requests. */
|
|
261
280
|
once<T>(callback: () => T, options?: InertiaOnceOptions): InertiaOnceProp<T>;
|
|
262
281
|
/** Creates a prop that is always evaluated and included, even on partial reload requests. */
|
|
@@ -277,11 +296,91 @@ declare module 'stratal/router' {
|
|
|
277
296
|
* by the runtime the `stratalInertia()` Vite plugin injects.
|
|
278
297
|
*/
|
|
279
298
|
seo(data: SeoData): void;
|
|
280
|
-
/** Disables server-side rendering for the current request. */
|
|
281
|
-
withoutSsr(): void;
|
|
282
299
|
}
|
|
283
300
|
}
|
|
284
301
|
//#endregion
|
|
302
|
+
//#region src/services/ssr-renderer.service.d.ts
|
|
303
|
+
export declare class SsrRendererService {
|
|
304
|
+
private readonly options;
|
|
305
|
+
private bundle;
|
|
306
|
+
private loadPromise;
|
|
307
|
+
constructor(options: InertiaModuleOptions);
|
|
308
|
+
/**
|
|
309
|
+
* Render a page to a streaming SSR result.
|
|
310
|
+
*
|
|
311
|
+
* The SSR bundle is imported once per worker (memoized). Bundle-load and render
|
|
312
|
+
* errors propagate — there is no silent client-side fallback. Callers must only
|
|
313
|
+
* invoke this when `options.ssr` is configured.
|
|
314
|
+
*/
|
|
315
|
+
render(page: Page): Promise<InertiaSsrResult>;
|
|
316
|
+
private ensureBundle;
|
|
317
|
+
private loadBundle;
|
|
318
|
+
}
|
|
319
|
+
//#endregion
|
|
320
|
+
//#region src/services/manifest.service.d.ts
|
|
321
|
+
export declare class ManifestService {
|
|
322
|
+
private readonly manifest;
|
|
323
|
+
private readonly entryClientPath;
|
|
324
|
+
private readonly isDev;
|
|
325
|
+
private headTags;
|
|
326
|
+
private scriptTags;
|
|
327
|
+
constructor(options: InertiaModuleOptions);
|
|
328
|
+
getHeadTags(): string;
|
|
329
|
+
getScriptTags(): string;
|
|
330
|
+
private buildHeadTags;
|
|
331
|
+
private buildScriptTags;
|
|
332
|
+
}
|
|
333
|
+
//#endregion
|
|
334
|
+
//#region src/services/template.service.d.ts
|
|
335
|
+
export declare class TemplateService {
|
|
336
|
+
private readonly manifest;
|
|
337
|
+
private readonly pre;
|
|
338
|
+
private readonly post;
|
|
339
|
+
constructor(options: InertiaModuleOptions, manifest: ManifestService);
|
|
340
|
+
/**
|
|
341
|
+
* Compose the streamed HTML response: the document shell (head + opening
|
|
342
|
+
* `#app` wrapper) is flushed first, the React stream is piped verbatim, then
|
|
343
|
+
* the wrapper is closed and the trailing scripts are appended.
|
|
344
|
+
*
|
|
345
|
+
* Reproduces Inertia's `buildSSRBody` markup: a `<script data-page>` JSON tag
|
|
346
|
+
* (parsed before hydration) followed by `<div data-server-rendered id="app">`.
|
|
347
|
+
*/
|
|
348
|
+
renderStream(page: Page, head: string[], reactStream: ReadableStream<Uint8Array>): ReadableStream<Uint8Array>;
|
|
349
|
+
/**
|
|
350
|
+
* Buffered, client-only document used when SSR is disabled for the request.
|
|
351
|
+
* Emits an empty `#app` div for the client bundle to hydrate.
|
|
352
|
+
*/
|
|
353
|
+
renderClientOnly(page: Page, head: string[]): string;
|
|
354
|
+
private fillPlaceholders;
|
|
355
|
+
private serialize;
|
|
356
|
+
}
|
|
357
|
+
//#endregion
|
|
358
|
+
//#region src/services/document-renderer.service.d.ts
|
|
359
|
+
/**
|
|
360
|
+
* Renders a fully-built {@link Page} into an HTML document Response, choosing
|
|
361
|
+
* streaming SSR or a client-only shell.
|
|
362
|
+
*
|
|
363
|
+
* SSR is skipped — and the page rendered client-only for the client bundle to
|
|
364
|
+
* hydrate — when SSR is unconfigured, or when the page component was build-time
|
|
365
|
+
* excluded from the worker bundle via `stratalInertia({ ssrExclude })` (there is
|
|
366
|
+
* no SSR entry left to render it from). Centralising the decision keeps the
|
|
367
|
+
* exclusion rule in one place; both {@link InertiaService} and the modal renderer
|
|
368
|
+
* delegate here rather than duplicating the branch.
|
|
369
|
+
*/
|
|
370
|
+
export declare class DocumentRendererService {
|
|
371
|
+
private readonly options;
|
|
372
|
+
private readonly ssr;
|
|
373
|
+
private readonly template;
|
|
374
|
+
private readonly ssrExcludeMatchers;
|
|
375
|
+
constructor(options: InertiaModuleOptions, ssr: SsrRendererService, template: TemplateService);
|
|
376
|
+
/**
|
|
377
|
+
* Render `page` to an HTML document Response. `extraHead` tags are appended to
|
|
378
|
+
* `<head>` — after the SSR-rendered Inertia `<Head>` when streaming, or as the
|
|
379
|
+
* only head tags in the client-only shell.
|
|
380
|
+
*/
|
|
381
|
+
render(page: Page, status?: number, extraHead?: string[]): Promise<Response>;
|
|
382
|
+
}
|
|
383
|
+
//#endregion
|
|
285
384
|
//#region src/services/hreflang.service.d.ts
|
|
286
385
|
/**
|
|
287
386
|
* Produces `rel="alternate" hreflang="…"` link descriptors for the SEO pipeline.
|
|
@@ -323,13 +422,21 @@ declare class HreflangService {
|
|
|
323
422
|
* defaults and title template, shares the result as the `seo` prop, and injects
|
|
324
423
|
* the rendered tags into `<head>`.
|
|
325
424
|
*/
|
|
326
|
-
declare class SeoService {
|
|
425
|
+
export declare class SeoService {
|
|
327
426
|
private readonly options;
|
|
328
427
|
private readonly hreflang;
|
|
329
428
|
private accumulated;
|
|
330
429
|
constructor(options: InertiaModuleOptions, hreflang: HreflangService);
|
|
331
430
|
/** Merges the given metadata into the request's accumulated SEO data. */
|
|
332
431
|
set(data: SeoData): void;
|
|
432
|
+
/**
|
|
433
|
+
* Whether anything has contributed SEO to this request.
|
|
434
|
+
*
|
|
435
|
+
* Told apart from "resolves to the defaults" so a caller rendering one page over another can
|
|
436
|
+
* keep the underlying page's metadata when the page on top named none of its own. Resolving
|
|
437
|
+
* regardless would answer with the module defaults and overwrite it.
|
|
438
|
+
*/
|
|
439
|
+
contributed(): boolean;
|
|
333
440
|
/**
|
|
334
441
|
* Resolves the final SEO data: module defaults (base) merged with the
|
|
335
442
|
* request's accumulated data, then the title template applied. Resolver
|
|
@@ -347,76 +454,20 @@ declare class SeoService {
|
|
|
347
454
|
tagsFor(resolved: SeoData): string[];
|
|
348
455
|
}
|
|
349
456
|
//#endregion
|
|
350
|
-
//#region src/services/ssr-renderer.service.d.ts
|
|
351
|
-
declare class SsrRendererService {
|
|
352
|
-
private readonly options;
|
|
353
|
-
private bundle;
|
|
354
|
-
private loadPromise;
|
|
355
|
-
constructor(options: InertiaModuleOptions);
|
|
356
|
-
/**
|
|
357
|
-
* Render a page to a streaming SSR result.
|
|
358
|
-
*
|
|
359
|
-
* The SSR bundle is imported once per worker (memoized). Bundle-load and render
|
|
360
|
-
* errors propagate — there is no silent client-side fallback. Callers must only
|
|
361
|
-
* invoke this when `options.ssr` is configured.
|
|
362
|
-
*/
|
|
363
|
-
render(page: Page): Promise<InertiaSsrResult>;
|
|
364
|
-
private ensureBundle;
|
|
365
|
-
private loadBundle;
|
|
366
|
-
}
|
|
367
|
-
//#endregion
|
|
368
|
-
//#region src/services/manifest.service.d.ts
|
|
369
|
-
declare class ManifestService {
|
|
370
|
-
private readonly manifest;
|
|
371
|
-
private readonly entryClientPath;
|
|
372
|
-
private readonly isDev;
|
|
373
|
-
private headTags;
|
|
374
|
-
private scriptTags;
|
|
375
|
-
constructor(options: InertiaModuleOptions);
|
|
376
|
-
getHeadTags(): string;
|
|
377
|
-
getScriptTags(): string;
|
|
378
|
-
private buildHeadTags;
|
|
379
|
-
private buildScriptTags;
|
|
380
|
-
}
|
|
381
|
-
//#endregion
|
|
382
|
-
//#region src/services/template.service.d.ts
|
|
383
|
-
declare class TemplateService {
|
|
384
|
-
private readonly manifest;
|
|
385
|
-
private readonly pre;
|
|
386
|
-
private readonly post;
|
|
387
|
-
constructor(options: InertiaModuleOptions, manifest: ManifestService);
|
|
388
|
-
/**
|
|
389
|
-
* Compose the streamed HTML response: the document shell (head + opening
|
|
390
|
-
* `#app` wrapper) is flushed first, the React stream is piped verbatim, then
|
|
391
|
-
* the wrapper is closed and the trailing scripts are appended.
|
|
392
|
-
*
|
|
393
|
-
* Reproduces Inertia's `buildSSRBody` markup: a `<script data-page>` JSON tag
|
|
394
|
-
* (parsed before hydration) followed by `<div data-server-rendered id="app">`.
|
|
395
|
-
*/
|
|
396
|
-
renderStream(page: Page, head: string[], reactStream: ReadableStream<Uint8Array>): ReadableStream<Uint8Array>;
|
|
397
|
-
/**
|
|
398
|
-
* Buffered, client-only document used when SSR is disabled for the request.
|
|
399
|
-
* Emits an empty `#app` div for the client bundle to hydrate.
|
|
400
|
-
*/
|
|
401
|
-
renderClientOnly(page: Page, head: string[]): string;
|
|
402
|
-
private fillPlaceholders;
|
|
403
|
-
private serialize;
|
|
404
|
-
}
|
|
405
|
-
//#endregion
|
|
406
457
|
//#region src/services/inertia.service.d.ts
|
|
407
|
-
declare class InertiaService {
|
|
458
|
+
export declare class InertiaService {
|
|
408
459
|
private readonly options;
|
|
409
|
-
private readonly
|
|
410
|
-
private readonly ssr;
|
|
460
|
+
private readonly documentRenderer;
|
|
411
461
|
private readonly seoService;
|
|
412
462
|
private sharedData;
|
|
413
|
-
constructor(options: InertiaModuleOptions,
|
|
463
|
+
constructor(options: InertiaModuleOptions, documentRenderer: DocumentRendererService, seoService: SeoService);
|
|
414
464
|
share(key: string, value: unknown): void;
|
|
415
465
|
seo(data: SeoData): void;
|
|
416
466
|
location(url: string): Response;
|
|
417
467
|
optional<T>(callback: () => T): InertiaOptionalProp<T>;
|
|
418
468
|
defer<T>(callback: () => T, group?: string): InertiaDeferredProp<T>;
|
|
419
469
|
merge<T>(callback: () => T, options?: InertiaMergeOptions): InertiaMergeProp<T>;
|
|
470
|
+
scroll<T>(callback: () => T | Promise<T>, options?: InertiaScrollOptions<T>): InertiaScrollProp<T>;
|
|
420
471
|
once<T>(callback: () => T, options?: InertiaOnceOptions): InertiaOnceProp<T>;
|
|
421
472
|
always<T>(callback: () => T): InertiaAlwaysProp<T>;
|
|
422
473
|
render(ctx: RouterContext, component: string, props?: Record<string, unknown>, renderOptions?: InertiaRenderOptions): Promise<Response>;
|
|
@@ -429,22 +480,71 @@ declare class InertiaService {
|
|
|
429
480
|
*/
|
|
430
481
|
private resolveSharedData;
|
|
431
482
|
private isPartialReload;
|
|
483
|
+
/**
|
|
484
|
+
* Reads everything about the incoming request that changes how props resolve.
|
|
485
|
+
*
|
|
486
|
+
* Split out so a caller assembling its own page — a modal level, whose props
|
|
487
|
+
* sit under a path rather than at the page root — can resolve props with the
|
|
488
|
+
* same semantics while supplying its own notion of which ones were asked for.
|
|
489
|
+
*/
|
|
490
|
+
partialRequestFor(ctx: RouterContext, component: string, isInertia: boolean): InertiaPartialRequest;
|
|
491
|
+
/**
|
|
492
|
+
* Resolves a prop record with the helper semantics `render()` applies, for a
|
|
493
|
+
* caller that owns its own page assembly.
|
|
494
|
+
*
|
|
495
|
+
* The returned paths are relative to the record passed in; a caller whose
|
|
496
|
+
* props live under a page path re-anchors them before they reach the page
|
|
497
|
+
* object.
|
|
498
|
+
*/
|
|
499
|
+
resolveProps(props: Record<string, unknown>, request: InertiaPartialRequest): Promise<InertiaPropResolution>;
|
|
432
500
|
private processProps;
|
|
433
501
|
/**
|
|
434
|
-
*
|
|
435
|
-
*
|
|
502
|
+
* Resolve one record of props into `into`, naming each by its full path.
|
|
503
|
+
*
|
|
504
|
+
* Recursive because the protocol addresses a nested prop by its dot path: `only: ['auth.user']`
|
|
505
|
+
* asks for one field of `auth`, not for the whole of it. Answering with all of `auth` is the
|
|
506
|
+
* payload the partial reload was sent to avoid.
|
|
507
|
+
*
|
|
508
|
+
* Three things make a prop survive a partial reload, mirroring Laravel's resolver: the request
|
|
509
|
+
* is not partial, its own path was asked for, or an ancestor of it resolved. The last is why a
|
|
510
|
+
* `defer()`/`optional()` prop comes back whole when a path inside it is asked for — nothing
|
|
511
|
+
* inside a callback's result can be narrowed without running the callback, so once it runs, all
|
|
512
|
+
* of it is included.
|
|
513
|
+
*
|
|
514
|
+
* Only plain objects are descended into. An array is a value: the client reads `items.0.name`
|
|
515
|
+
* as a path, but a partial reload asking for one element of a list it does not hold yet has
|
|
516
|
+
* nothing to merge that element into.
|
|
436
517
|
*/
|
|
437
|
-
private
|
|
518
|
+
private collectProps;
|
|
519
|
+
/** Whether a plain `{}` record, as opposed to an array, a class instance or a prop marker. */
|
|
520
|
+
private isPlainRecord;
|
|
521
|
+
/** Whether this path was asked for, or sits inside a path that was. */
|
|
522
|
+
private isNamed;
|
|
523
|
+
/** Whether something asked for sits inside this path. */
|
|
524
|
+
private enclosesNamed;
|
|
438
525
|
private isExcepted;
|
|
439
526
|
private isOptionalProp;
|
|
440
527
|
private isDeferredProp;
|
|
441
528
|
private isMergeProp;
|
|
529
|
+
private isScrollProp;
|
|
442
530
|
private isOnceProp;
|
|
443
531
|
private isAlwaysProp;
|
|
444
532
|
private serializeRoutes;
|
|
445
|
-
private isSsrDisabled;
|
|
446
533
|
}
|
|
447
534
|
//#endregion
|
|
535
|
+
//#region src/services/scroll-metadata.d.ts
|
|
536
|
+
/**
|
|
537
|
+
* Derives the infinite-scroll identifiers from a paginated result.
|
|
538
|
+
*
|
|
539
|
+
* Recognises both of the framework's own paginated shapes — the offset one
|
|
540
|
+
* `paginatedResponseSchema` describes, and the cursor one `db.$cursor`
|
|
541
|
+
* returns. Anything else throws rather than guessing: a wrong `nextPage` reads
|
|
542
|
+
* to the client as "no more pages" and silently truncates a list, so an
|
|
543
|
+
* unrecognised shape has to be named at the call site with
|
|
544
|
+
* `ctx.scroll(..., { metadata })`.
|
|
545
|
+
*/
|
|
546
|
+
export declare function deriveScrollMetadata(value: unknown): InertiaScrollMetadata;
|
|
547
|
+
//#endregion
|
|
448
548
|
//#region src/decorators/inertia.decorators.d.ts
|
|
449
549
|
type InertiaRouteConfig = Omit<RouteConfig, 'response' | 'statusCode' | 'hideFromDocs'> & {
|
|
450
550
|
hideFromDocs?: boolean;
|
|
@@ -470,7 +570,7 @@ type InertiaRouteConfig = Omit<RouteConfig, 'response' | 'statusCode' | 'hideFro
|
|
|
470
570
|
* }
|
|
471
571
|
* ```
|
|
472
572
|
*/
|
|
473
|
-
declare function InertiaRoute(config?: InertiaRouteConfig): (target: object, propertyKey: string, descriptor: PropertyDescriptor) => PropertyDescriptor;
|
|
573
|
+
export declare function InertiaRoute(config?: InertiaRouteConfig): (target: object, propertyKey: string, descriptor: PropertyDescriptor) => PropertyDescriptor;
|
|
474
574
|
/**
|
|
475
575
|
* Registers a GET route for an Inertia page.
|
|
476
576
|
*
|
|
@@ -496,7 +596,7 @@ declare function InertiaRoute(config?: InertiaRouteConfig): (target: object, pro
|
|
|
496
596
|
* }
|
|
497
597
|
* ```
|
|
498
598
|
*/
|
|
499
|
-
declare function InertiaGet(path: string, config?: InertiaRouteConfig): (target: object, propertyKey: string, descriptor: PropertyDescriptor) => PropertyDescriptor;
|
|
599
|
+
export declare function InertiaGet(path: string, config?: InertiaRouteConfig): (target: object, propertyKey: string, descriptor: PropertyDescriptor) => PropertyDescriptor;
|
|
500
600
|
/**
|
|
501
601
|
* Registers a POST route for an Inertia form submission.
|
|
502
602
|
*
|
|
@@ -506,7 +606,7 @@ declare function InertiaGet(path: string, config?: InertiaRouteConfig): (target:
|
|
|
506
606
|
* @param path - Route path relative to the controller base path
|
|
507
607
|
* @param config - Optional route configuration (body, params, tags, etc.)
|
|
508
608
|
*/
|
|
509
|
-
declare function InertiaPost(path: string, config?: InertiaRouteConfig): (target: object, propertyKey: string, descriptor: PropertyDescriptor) => PropertyDescriptor;
|
|
609
|
+
export declare function InertiaPost(path: string, config?: InertiaRouteConfig): (target: object, propertyKey: string, descriptor: PropertyDescriptor) => PropertyDescriptor;
|
|
510
610
|
/**
|
|
511
611
|
* Registers a PUT route for an Inertia form submission.
|
|
512
612
|
*
|
|
@@ -516,7 +616,7 @@ declare function InertiaPost(path: string, config?: InertiaRouteConfig): (target
|
|
|
516
616
|
* @param path - Route path relative to the controller base path
|
|
517
617
|
* @param config - Optional route configuration (body, params, tags, etc.)
|
|
518
618
|
*/
|
|
519
|
-
declare function InertiaPut(path: string, config?: InertiaRouteConfig): (target: object, propertyKey: string, descriptor: PropertyDescriptor) => PropertyDescriptor;
|
|
619
|
+
export declare function InertiaPut(path: string, config?: InertiaRouteConfig): (target: object, propertyKey: string, descriptor: PropertyDescriptor) => PropertyDescriptor;
|
|
520
620
|
/**
|
|
521
621
|
* Registers a PATCH route for an Inertia form submission.
|
|
522
622
|
*
|
|
@@ -526,7 +626,7 @@ declare function InertiaPut(path: string, config?: InertiaRouteConfig): (target:
|
|
|
526
626
|
* @param path - Route path relative to the controller base path
|
|
527
627
|
* @param config - Optional route configuration (body, params, tags, etc.)
|
|
528
628
|
*/
|
|
529
|
-
declare function InertiaPatch(path: string, config?: InertiaRouteConfig): (target: object, propertyKey: string, descriptor: PropertyDescriptor) => PropertyDescriptor;
|
|
629
|
+
export declare function InertiaPatch(path: string, config?: InertiaRouteConfig): (target: object, propertyKey: string, descriptor: PropertyDescriptor) => PropertyDescriptor;
|
|
530
630
|
/**
|
|
531
631
|
* Registers a DELETE route for an Inertia form submission.
|
|
532
632
|
*
|
|
@@ -536,31 +636,53 @@ declare function InertiaPatch(path: string, config?: InertiaRouteConfig): (targe
|
|
|
536
636
|
* @param path - Route path relative to the controller base path
|
|
537
637
|
* @param config - Optional route configuration (params, tags, etc.)
|
|
538
638
|
*/
|
|
539
|
-
declare function InertiaDelete(path: string, config?: InertiaRouteConfig): (target: object, propertyKey: string, descriptor: PropertyDescriptor) => PropertyDescriptor;
|
|
639
|
+
export declare function InertiaDelete(path: string, config?: InertiaRouteConfig): (target: object, propertyKey: string, descriptor: PropertyDescriptor) => PropertyDescriptor;
|
|
540
640
|
//#endregion
|
|
541
641
|
//#region src/middleware/handle-precognitive-requests.middleware.d.ts
|
|
542
|
-
declare class HandlePrecognitiveRequests implements Middleware {
|
|
642
|
+
export declare class HandlePrecognitiveRequests implements Middleware {
|
|
543
643
|
handle(ctx: RouterContext, next: Next): Promise<void>;
|
|
544
644
|
}
|
|
545
645
|
//#endregion
|
|
546
646
|
//#region src/middleware/inertia.middleware.d.ts
|
|
547
|
-
declare class InertiaMiddleware implements Middleware {
|
|
647
|
+
export declare class InertiaMiddleware implements Middleware {
|
|
548
648
|
private readonly options;
|
|
549
649
|
constructor(options: InertiaModuleOptions);
|
|
550
650
|
handle(ctx: RouterContext, next: Next): Promise<void>;
|
|
551
651
|
}
|
|
552
652
|
//#endregion
|
|
653
|
+
//#region src/services/inertia-cache-signals.d.ts
|
|
654
|
+
interface InertiaCacheSignals {
|
|
655
|
+
hasFlash: boolean;
|
|
656
|
+
isPartial: boolean;
|
|
657
|
+
hasOnceProps: boolean;
|
|
658
|
+
/**
|
|
659
|
+
* The request headers this response is a function of, for the response cache
|
|
660
|
+
* to declare in `Vary`.
|
|
661
|
+
*
|
|
662
|
+
* Reported from here rather than left to the middleware that also unions them
|
|
663
|
+
* on, because the cacheability check needs to KNOW the response is keyed on
|
|
664
|
+
* them. A partial reload arriving with an empty list is refused rather than
|
|
665
|
+
* cached under a key that does not describe which props it carries.
|
|
666
|
+
*/
|
|
667
|
+
varyHeaders: readonly string[];
|
|
668
|
+
}
|
|
669
|
+
//#endregion
|
|
553
670
|
//#region src/augment/router-variables.d.ts
|
|
554
671
|
declare module 'stratal/router' {
|
|
555
672
|
interface RouterVariables {
|
|
556
673
|
inertia: boolean;
|
|
557
674
|
inertiaPrefetch: boolean;
|
|
558
675
|
precognition: boolean;
|
|
559
|
-
withoutSsr: boolean;
|
|
560
676
|
inertiaFlash: Record<string, unknown>;
|
|
561
677
|
inertiaFlashOut: Record<string, unknown>;
|
|
678
|
+
/**
|
|
679
|
+
* Conditions that make the just-rendered Inertia page unsafe to cache,
|
|
680
|
+
* set by `InertiaService.render()`. Consumed by core's
|
|
681
|
+
* `CacheabilityService` to fail a `@Cacheable` response closed.
|
|
682
|
+
*/
|
|
683
|
+
inertiaCacheSignals?: InertiaCacheSignals;
|
|
562
684
|
}
|
|
563
685
|
}
|
|
564
686
|
//#endregion
|
|
565
|
-
export {
|
|
687
|
+
export { type AccessControlRegistry, type AccessControlRegistryNotGenerated, type Check, type FlashStore, INERTIA_SCROLL_MERGE_INTENT_HEADER, INERTIA_VARY_HEADERS, type InertiaAlwaysProp, type InertiaDeferredProp, type InertiaFlashOptions, type InertiaFullPageProps, type InertiaI18nConfig, type InertiaI18nOptions, type InertiaMergeProp, type InertiaMergeStrategy, type InertiaModuleOptions, type InertiaOnceProp, type InertiaOptionalProp, type InertiaPage, type InertiaPageComponent, type InertiaPageRegistry, type InertiaPartialRequest, type InertiaPropResolution, type InertiaRenderOptions, type InertiaRouteConfig, type InertiaScrollMetadata, type InertiaScrollMetadataResolver, type InertiaScrollOptions, type InertiaScrollPageIdentifier, type InertiaScrollProp, type InertiaSeoOptions, type InertiaSharedProps, type InertiaSsrBundle, type InertiaSsrOptions, type InertiaSsrResult, type InertiaTranslationKeys, type Permission, type ResolvedInertiaPageProps, type RoleName, type SeoData, type SeoLinkTag, type SeoMetaTag, type SeoOpenGraph, type SeoTagDescriptor, type SeoTwitter, type SharedAccess, type SharedDataResolver, type ViteManifest, type ViteManifestEntry };
|
|
566
688
|
//# sourceMappingURL=index.d.mts.map
|
package/dist/index.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/flash/flash-store.ts","../src/inertia.options.ts","../src/inertia.module.ts","../src/inertia.tokens.ts","../src/seo/build-seo-tags.ts","../src/flash/cookie-flash-store.ts","../src/augment/router-context.ts","../src/services/
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/flash/flash-store.ts","../src/inertia.options.ts","../src/inertia.module.ts","../src/inertia.tokens.ts","../src/seo/build-seo-tags.ts","../src/flash/cookie-flash-store.ts","../src/errors/unrecognized-scroll-shape.error.ts","../src/augment/router-context.ts","../src/services/ssr-renderer.service.ts","../src/services/manifest.service.ts","../src/services/template.service.ts","../src/services/document-renderer.service.ts","../src/services/hreflang.service.ts","../src/services/seo.service.ts","../src/services/inertia.service.ts","../src/services/scroll-metadata.ts","../src/decorators/inertia.decorators.ts","../src/middleware/handle-precognitive-requests.middleware.ts","../src/middleware/inertia.middleware.ts","../src/services/inertia-cache-signals.ts","../src/augment/router-variables.ts"],"mappings":";;;;;;;;;;;UAEiB;EACf,KAAK,KAAK,gBAAgB,QAAQ;EAClC,MAAM,KAAK,eAAe,MAAM,0BAA0B;EAC1D,MAAM,KAAK,gBAAgB;;;;UCCZ;EACf,cAAc,QAAQ;IAAqB,SAAS;;;;;;;;;;;;;;;;;;;UAmBrC;;;;;;;;;;;;;;;;EAgBf,OAAO;;UAGQ;EACf,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;UAoCQ;;;;;EAKf,WAAW,YAAY,KAAK,kBAAkB,UAAU,QAAQ;;;;;;;;;;EAUhE,2BAEM,2BAA2B,KAAK,uCAAuC;;UAG9D;EACf;EACA;EACA,MAAM;EACN,QAAQ;EACR,aAAa;;;;;;;;;;;;;;;EAeb,OAAO;;;;;;;;;;;;;;;;EAgBP;;;;;;EAMA,MAAM;;;;;EAKN;;;;qBC1HW,yBAAyB,mBAAmB,cAAc;SAC9D,QAAQ,SAAS,uBAAuB;SASxC,aAAa,SAAS,mBAAmB,wBAAwB;EAa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