@stratal/inertia 0.0.18 → 0.0.20
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/dist/index.d.mts +472 -0
- package/dist/index.d.mts.map +1 -0
- package/dist/index.mjs +1171 -0
- package/dist/index.mjs.map +1 -0
- package/dist/react.d.mts +90 -0
- package/dist/react.d.mts.map +1 -0
- package/dist/react.mjs +222 -0
- package/dist/react.mjs.map +1 -0
- package/dist/testing.d.mts +36 -0
- package/dist/testing.d.mts.map +1 -0
- package/dist/testing.mjs +78 -0
- package/dist/testing.mjs.map +1 -0
- package/dist/type-generator-C5JljyzK.mjs +391 -0
- package/dist/type-generator-C5JljyzK.mjs.map +1 -0
- package/dist/vite.d.mts +21 -0
- package/dist/vite.d.mts.map +1 -0
- package/dist/vite.mjs +156 -0
- package/dist/vite.mjs.map +1 -0
- package/package.json +30 -30
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,472 @@
|
|
|
1
|
+
/// <reference path="../global.d.ts" />
|
|
2
|
+
import { ExceptionHandler } from "stratal/errors";
|
|
3
|
+
import { MessageKeyPrefix } from "stratal/i18n";
|
|
4
|
+
import { AsyncModuleOptions, DynamicModule, OnException, OnInitialize } from "stratal/module";
|
|
5
|
+
import { Middleware, Next, RouteConfig, RouteConfigurable, Router, RouterContext } from "stratal/router";
|
|
6
|
+
import { Command } from "stratal/quarry";
|
|
7
|
+
import { LoggerService } from "stratal/logger";
|
|
8
|
+
import { z } from "stratal/validation";
|
|
9
|
+
import { InertiaAppSSRResponse, Page, Page as InertiaPage, SharedPageProps } from "@inertiajs/core";
|
|
10
|
+
import { CookieOptions } from "hono/utils/cookie";
|
|
11
|
+
//#region src/flash/flash-store.d.ts
|
|
12
|
+
interface FlashStore {
|
|
13
|
+
read(ctx: RouterContext): Promise<Record<string, unknown>>;
|
|
14
|
+
write(ctx: RouterContext, data: Record<string, unknown>): Promise<void>;
|
|
15
|
+
clear(ctx: RouterContext): Promise<void>;
|
|
16
|
+
}
|
|
17
|
+
//#endregion
|
|
18
|
+
//#region src/types.d.ts
|
|
19
|
+
interface InertiaPageRegistry {}
|
|
20
|
+
type InertiaSharedProps = SharedPageProps;
|
|
21
|
+
type InertiaPageComponent = keyof InertiaPageRegistry extends never ? string : Extract<keyof InertiaPageRegistry, string>;
|
|
22
|
+
type AllowInertiaWrappers<T> = { [K in keyof T]: T[K] | InertiaDeferredProp | InertiaMergeProp | InertiaOptionalProp | InertiaOnceProp | InertiaAlwaysProp };
|
|
23
|
+
type ResolvedInertiaPageProps<C extends InertiaPageComponent> = C extends keyof InertiaPageRegistry ? AllowInertiaWrappers<InertiaPageRegistry[C]> : Record<string, unknown>;
|
|
24
|
+
type InertiaFullPageProps<C extends InertiaPageComponent> = (C extends keyof InertiaPageRegistry ? InertiaPageRegistry[C] : Record<string, unknown>) & InertiaSharedProps;
|
|
25
|
+
interface InertiaRenderOptions {
|
|
26
|
+
encryptHistory?: boolean;
|
|
27
|
+
clearHistory?: boolean;
|
|
28
|
+
preserveFragment?: boolean;
|
|
29
|
+
}
|
|
30
|
+
type InertiaSsrResult = InertiaAppSSRResponse;
|
|
31
|
+
interface InertiaSsrBundle {
|
|
32
|
+
render(page: Page): Promise<InertiaSsrResult>;
|
|
33
|
+
}
|
|
34
|
+
type SharedDataResolver = (ctx: RouterContext) => any;
|
|
35
|
+
interface ViteManifestEntry {
|
|
36
|
+
file: string;
|
|
37
|
+
css?: string[];
|
|
38
|
+
isEntry?: boolean;
|
|
39
|
+
imports?: string[];
|
|
40
|
+
dynamicImports?: string[];
|
|
41
|
+
src?: string;
|
|
42
|
+
}
|
|
43
|
+
type ViteManifest = Record<string, ViteManifestEntry>;
|
|
44
|
+
declare const INERTIA_PROP_OPTIONAL: unique symbol;
|
|
45
|
+
declare const INERTIA_PROP_DEFERRED: unique symbol;
|
|
46
|
+
declare const INERTIA_PROP_MERGE: unique symbol;
|
|
47
|
+
declare const INERTIA_PROP_ONCE: unique symbol;
|
|
48
|
+
declare const INERTIA_PROP_ALWAYS: unique symbol;
|
|
49
|
+
interface InertiaOptionalProp<T = unknown> {
|
|
50
|
+
[INERTIA_PROP_OPTIONAL]: true;
|
|
51
|
+
callback: () => T;
|
|
52
|
+
}
|
|
53
|
+
interface InertiaDeferredProp<T = unknown> {
|
|
54
|
+
[INERTIA_PROP_DEFERRED]: true;
|
|
55
|
+
callback: () => T;
|
|
56
|
+
group: string;
|
|
57
|
+
}
|
|
58
|
+
type InertiaMergeStrategy = 'append' | 'prepend' | 'deep';
|
|
59
|
+
interface InertiaMergeProp<T = unknown> {
|
|
60
|
+
[INERTIA_PROP_MERGE]: true;
|
|
61
|
+
callback: () => T;
|
|
62
|
+
strategy: InertiaMergeStrategy;
|
|
63
|
+
matchOn?: string;
|
|
64
|
+
}
|
|
65
|
+
interface InertiaOnceProp<T = unknown> {
|
|
66
|
+
[INERTIA_PROP_ONCE]: true;
|
|
67
|
+
callback: () => T;
|
|
68
|
+
expiresAt?: number | null;
|
|
69
|
+
key?: string;
|
|
70
|
+
}
|
|
71
|
+
interface InertiaAlwaysProp<T = unknown> {
|
|
72
|
+
[INERTIA_PROP_ALWAYS]: true;
|
|
73
|
+
callback: () => T;
|
|
74
|
+
}
|
|
75
|
+
//#endregion
|
|
76
|
+
//#region src/inertia.options.d.ts
|
|
77
|
+
interface SsrBundleModule {
|
|
78
|
+
render(page: Page): Promise<InertiaAppSSRResponse>;
|
|
79
|
+
}
|
|
80
|
+
interface InertiaSsrOptions {
|
|
81
|
+
bundle: () => Promise<SsrBundleModule | {
|
|
82
|
+
default: SsrBundleModule;
|
|
83
|
+
}>;
|
|
84
|
+
/**
|
|
85
|
+
* Route patterns where SSR is disabled (e.g., `"admin/*"`).
|
|
86
|
+
* Uses simple glob matching against the request pathname.
|
|
87
|
+
*/
|
|
88
|
+
disabled?: string[];
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Configuration for sharing i18n messages with the frontend.
|
|
92
|
+
*
|
|
93
|
+
* When provided to {@link InertiaModuleOptions.i18n}, the module auto-injects
|
|
94
|
+
* `locale` (string) and `translations` (flattened messages) into every Inertia
|
|
95
|
+
* page response as shared props. Use `only` to restrict which message namespaces
|
|
96
|
+
* are sent to the frontend.
|
|
97
|
+
*
|
|
98
|
+
* @example
|
|
99
|
+
* ```typescript
|
|
100
|
+
* InertiaModule.forRoot({
|
|
101
|
+
* rootView,
|
|
102
|
+
* i18n: { only: ['common', 'nav'] },
|
|
103
|
+
* })
|
|
104
|
+
* ```
|
|
105
|
+
*/
|
|
106
|
+
interface InertiaI18nOptions {
|
|
107
|
+
/**
|
|
108
|
+
* Dot-notation message key prefixes to include in frontend translations.
|
|
109
|
+
*
|
|
110
|
+
* Only messages whose keys match or start with the given prefixes are shared.
|
|
111
|
+
* When omitted, all messages are sent to the frontend.
|
|
112
|
+
*
|
|
113
|
+
* @example
|
|
114
|
+
* ```typescript
|
|
115
|
+
* // Only share 'common' and 'nav' namespaces
|
|
116
|
+
* { only: ['common', 'nav'] }
|
|
117
|
+
*
|
|
118
|
+
* // Share a deeply nested namespace
|
|
119
|
+
* { only: ['common.actions'] }
|
|
120
|
+
* ```
|
|
121
|
+
*/
|
|
122
|
+
only?: MessageKeyPrefix[];
|
|
123
|
+
}
|
|
124
|
+
interface InertiaFlashOptions {
|
|
125
|
+
store: FlashStore;
|
|
126
|
+
}
|
|
127
|
+
interface InertiaModuleOptions {
|
|
128
|
+
rootView: string;
|
|
129
|
+
version?: string;
|
|
130
|
+
ssr?: InertiaSsrOptions;
|
|
131
|
+
flash?: InertiaFlashOptions;
|
|
132
|
+
sharedData?: Record<string, unknown>;
|
|
133
|
+
/**
|
|
134
|
+
* I18n configuration for sharing backend translation messages with the frontend.
|
|
135
|
+
*
|
|
136
|
+
* When set, the module auto-injects `locale` and `translations` as shared props
|
|
137
|
+
* on every page response. Use with `useI18n()` from `@stratal/inertia/react` on the frontend.
|
|
138
|
+
*
|
|
139
|
+
* @example
|
|
140
|
+
* ```typescript
|
|
141
|
+
* InertiaModule.forRoot({
|
|
142
|
+
* rootView,
|
|
143
|
+
* i18n: { only: ['common', 'nav'] },
|
|
144
|
+
* })
|
|
145
|
+
* ```
|
|
146
|
+
*/
|
|
147
|
+
i18n?: InertiaI18nOptions;
|
|
148
|
+
/**
|
|
149
|
+
* When `true`, serializes all named routes and injects them as a `routes`
|
|
150
|
+
* shared prop on every Inertia page response.
|
|
151
|
+
*
|
|
152
|
+
* Use with `useRoute()` from `@stratal/inertia/react` on the frontend for
|
|
153
|
+
* Ziggy-like client-side URL generation.
|
|
154
|
+
*
|
|
155
|
+
* @example
|
|
156
|
+
* ```typescript
|
|
157
|
+
* InertiaModule.forRoot({
|
|
158
|
+
* rootView,
|
|
159
|
+
* routes: true,
|
|
160
|
+
* })
|
|
161
|
+
* ```
|
|
162
|
+
*/
|
|
163
|
+
routes?: boolean;
|
|
164
|
+
/**
|
|
165
|
+
* Vite manifest for production builds. When omitted, dev mode is assumed
|
|
166
|
+
* and Vite client + entry scripts are injected with same-origin paths.
|
|
167
|
+
*/
|
|
168
|
+
manifest?: ViteManifest;
|
|
169
|
+
/**
|
|
170
|
+
* Client entry path relative to project root (default: `src/inertia/app.tsx`).
|
|
171
|
+
* Used in dev mode to inject the entry script tag.
|
|
172
|
+
*/
|
|
173
|
+
entryClientPath?: string;
|
|
174
|
+
}
|
|
175
|
+
//#endregion
|
|
176
|
+
//#region src/inertia.module.d.ts
|
|
177
|
+
declare class InertiaModule implements RouteConfigurable, OnInitialize, OnException {
|
|
178
|
+
static forRoot(options: InertiaModuleOptions): DynamicModule;
|
|
179
|
+
static forRootAsync(options: AsyncModuleOptions<InertiaModuleOptions>): DynamicModule;
|
|
180
|
+
configureRoutes(router: Router): void;
|
|
181
|
+
onException(handler: ExceptionHandler): void;
|
|
182
|
+
onInitialize(): void;
|
|
183
|
+
private isInertiaRequest;
|
|
184
|
+
private isPrecognitionRequest;
|
|
185
|
+
private handlePrecognitionValidationError;
|
|
186
|
+
private createPrecognitionErrorResponse;
|
|
187
|
+
private redirectBack;
|
|
188
|
+
}
|
|
189
|
+
//#endregion
|
|
190
|
+
//#region src/inertia.tokens.d.ts
|
|
191
|
+
declare const INERTIA_TOKENS: {
|
|
192
|
+
readonly Options: symbol;
|
|
193
|
+
readonly InertiaService: symbol;
|
|
194
|
+
readonly TemplateService: symbol;
|
|
195
|
+
readonly ManifestService: symbol;
|
|
196
|
+
readonly SsrRenderer: symbol;
|
|
197
|
+
};
|
|
198
|
+
//#endregion
|
|
199
|
+
//#region src/flash/cookie-flash-store.d.ts
|
|
200
|
+
interface CookieFlashStoreOptions {
|
|
201
|
+
secret: string | BufferSource;
|
|
202
|
+
cookie?: string;
|
|
203
|
+
cookieOptions?: CookieOptions;
|
|
204
|
+
}
|
|
205
|
+
declare class CookieFlashStore implements FlashStore {
|
|
206
|
+
private readonly cookieName;
|
|
207
|
+
private readonly secret;
|
|
208
|
+
private readonly cookieOptions;
|
|
209
|
+
constructor(options: CookieFlashStoreOptions);
|
|
210
|
+
read(ctx: RouterContext): Promise<Record<string, unknown>>;
|
|
211
|
+
write(ctx: RouterContext, data: Record<string, unknown>): Promise<void>;
|
|
212
|
+
clear(ctx: RouterContext): Promise<void>;
|
|
213
|
+
}
|
|
214
|
+
//#endregion
|
|
215
|
+
//#region src/augment/router-context.d.ts
|
|
216
|
+
interface InertiaMergeOptions {
|
|
217
|
+
strategy?: InertiaMergeStrategy;
|
|
218
|
+
matchOn?: string;
|
|
219
|
+
}
|
|
220
|
+
interface InertiaOnceOptions {
|
|
221
|
+
expiresAt?: number | null;
|
|
222
|
+
key?: string;
|
|
223
|
+
}
|
|
224
|
+
declare module 'stratal/router' {
|
|
225
|
+
interface RouterContext {
|
|
226
|
+
/** Renders an Inertia page component with the given props and returns an HTTP response. */
|
|
227
|
+
inertia<C extends InertiaPageComponent>(component: C, ...args: keyof InertiaPageRegistry extends never ? [props?: Record<string, unknown>, options?: InertiaRenderOptions] : Record<string, never> extends ResolvedInertiaPageProps<C> ? [props?: ResolvedInertiaPageProps<C>, options?: InertiaRenderOptions] : [props: ResolvedInertiaPageProps<C>, options?: InertiaRenderOptions]): Promise<Response>;
|
|
228
|
+
/** Creates a deferred prop that is resolved after the initial page render, optionally grouped for batch loading. */
|
|
229
|
+
defer<T>(callback: () => T, group?: string): InertiaDeferredProp<T>;
|
|
230
|
+
/** Creates an optional prop that is only included in the response when explicitly requested by the client. */
|
|
231
|
+
optional<T>(callback: () => T): InertiaOptionalProp<T>;
|
|
232
|
+
/** Creates a mergeable prop that merges with existing client-side page data instead of replacing it. */
|
|
233
|
+
merge<T>(callback: () => T, options?: InertiaMergeOptions): InertiaMergeProp<T>;
|
|
234
|
+
/** Creates a prop that is only sent on the first visit and cached for subsequent requests. */
|
|
235
|
+
once<T>(callback: () => T, options?: InertiaOnceOptions): InertiaOnceProp<T>;
|
|
236
|
+
/** Creates a prop that is always evaluated and included, even on partial reload requests. */
|
|
237
|
+
always<T>(callback: () => T): InertiaAlwaysProp<T>;
|
|
238
|
+
/** Sets a flash data entry that will be available on the next page visit. */
|
|
239
|
+
flash(key: string, value: unknown): void;
|
|
240
|
+
/** Disables server-side rendering for the current request. */
|
|
241
|
+
withoutSsr(): void;
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
//#endregion
|
|
245
|
+
//#region src/services/ssr-renderer.service.d.ts
|
|
246
|
+
declare class SsrRendererService {
|
|
247
|
+
private readonly options;
|
|
248
|
+
private readonly logger;
|
|
249
|
+
private bundle;
|
|
250
|
+
private loadPromise;
|
|
251
|
+
constructor(options: InertiaModuleOptions, logger: LoggerService);
|
|
252
|
+
render(page: Page): Promise<InertiaAppSSRResponse>;
|
|
253
|
+
private ensureBundle;
|
|
254
|
+
private loadBundle;
|
|
255
|
+
}
|
|
256
|
+
//#endregion
|
|
257
|
+
//#region src/services/manifest.service.d.ts
|
|
258
|
+
declare class ManifestService {
|
|
259
|
+
private readonly manifest;
|
|
260
|
+
private readonly entryClientPath;
|
|
261
|
+
constructor(options: InertiaModuleOptions);
|
|
262
|
+
private get isDev();
|
|
263
|
+
getHeadTags(): string;
|
|
264
|
+
getScriptTags(): string;
|
|
265
|
+
}
|
|
266
|
+
//#endregion
|
|
267
|
+
//#region src/services/template.service.d.ts
|
|
268
|
+
declare class TemplateService {
|
|
269
|
+
private readonly options;
|
|
270
|
+
private readonly manifest;
|
|
271
|
+
constructor(options: InertiaModuleOptions, manifest: ManifestService);
|
|
272
|
+
render(page: Page, ssrHead: string[], ssrBody: string): string;
|
|
273
|
+
private buildClientOnlyBody;
|
|
274
|
+
}
|
|
275
|
+
//#endregion
|
|
276
|
+
//#region src/services/inertia.service.d.ts
|
|
277
|
+
declare class InertiaService {
|
|
278
|
+
private readonly options;
|
|
279
|
+
private readonly template;
|
|
280
|
+
private readonly ssr;
|
|
281
|
+
private sharedData;
|
|
282
|
+
constructor(options: InertiaModuleOptions, template: TemplateService, ssr: SsrRendererService);
|
|
283
|
+
share(key: string, value: unknown): void;
|
|
284
|
+
location(url: string): Response;
|
|
285
|
+
optional<T>(callback: () => T): InertiaOptionalProp<T>;
|
|
286
|
+
defer<T>(callback: () => T, group?: string): InertiaDeferredProp<T>;
|
|
287
|
+
merge<T>(callback: () => T, options?: InertiaMergeOptions): InertiaMergeProp<T>;
|
|
288
|
+
once<T>(callback: () => T, options?: InertiaOnceOptions): InertiaOnceProp<T>;
|
|
289
|
+
always<T>(callback: () => T): InertiaAlwaysProp<T>;
|
|
290
|
+
render(ctx: RouterContext, component: string, props?: Record<string, unknown>, renderOptions?: InertiaRenderOptions): Promise<Response>;
|
|
291
|
+
/**
|
|
292
|
+
* Resolve shared data from module options and i18n configuration.
|
|
293
|
+
*
|
|
294
|
+
* Processes static values and resolver functions from `sharedData` config.
|
|
295
|
+
* When `i18n` option is set, auto-injects `locale` and `translations` props
|
|
296
|
+
* using the core {@link MessageLoaderService} resolved from the request container.
|
|
297
|
+
*/
|
|
298
|
+
private resolveSharedData;
|
|
299
|
+
private isPartialReload;
|
|
300
|
+
private processProps;
|
|
301
|
+
/**
|
|
302
|
+
* Check if a prop key is requested — supports dot-notation (e.g., `user.permissions`
|
|
303
|
+
* matches the top-level `user` key).
|
|
304
|
+
*/
|
|
305
|
+
private isRequested;
|
|
306
|
+
private isExcepted;
|
|
307
|
+
private isOptionalProp;
|
|
308
|
+
private isDeferredProp;
|
|
309
|
+
private isMergeProp;
|
|
310
|
+
private isOnceProp;
|
|
311
|
+
private isAlwaysProp;
|
|
312
|
+
private serializeRoutes;
|
|
313
|
+
private isSsrDisabled;
|
|
314
|
+
}
|
|
315
|
+
//#endregion
|
|
316
|
+
//#region src/decorators/inertia.decorators.d.ts
|
|
317
|
+
type InertiaRouteConfig = Omit<RouteConfig, 'response' | 'statusCode' | 'hideFromDocs'> & {
|
|
318
|
+
hideFromDocs?: boolean;
|
|
319
|
+
};
|
|
320
|
+
/**
|
|
321
|
+
* Decorator for Inertia page routes using convention-based routing.
|
|
322
|
+
*
|
|
323
|
+
* Wraps `@Route()` with:
|
|
324
|
+
* - Auto-applied Inertia page response schema
|
|
325
|
+
* - `hideFromDocs: true` by default (overridable)
|
|
326
|
+
*
|
|
327
|
+
* **Cannot be mixed with HTTP method decorators** (`@Get`, `@Post`, `@InertiaGet`, etc.)
|
|
328
|
+
* in the same controller.
|
|
329
|
+
*
|
|
330
|
+
* @example
|
|
331
|
+
* ```typescript
|
|
332
|
+
* @Controller('/notes')
|
|
333
|
+
* export class NotesController implements IController {
|
|
334
|
+
* @InertiaRoute({ query: z.object({ page: z.string().optional() }) })
|
|
335
|
+
* async index(ctx: RouterContext) {
|
|
336
|
+
* return ctx.inertia('notes/Index', { notes: [] })
|
|
337
|
+
* }
|
|
338
|
+
* }
|
|
339
|
+
* ```
|
|
340
|
+
*/
|
|
341
|
+
declare function InertiaRoute(config?: InertiaRouteConfig): (target: object, propertyKey: string, descriptor: PropertyDescriptor) => PropertyDescriptor;
|
|
342
|
+
/**
|
|
343
|
+
* Registers a GET route for an Inertia page.
|
|
344
|
+
*
|
|
345
|
+
* Wraps `@Get()` with auto-applied Inertia page response schema
|
|
346
|
+
* and `hideFromDocs: true` by default.
|
|
347
|
+
*
|
|
348
|
+
* @param path - Route path relative to the controller base path
|
|
349
|
+
* @param config - Optional route configuration (query, params, tags, etc.)
|
|
350
|
+
*
|
|
351
|
+
* @example
|
|
352
|
+
* ```typescript
|
|
353
|
+
* @Controller('/notes')
|
|
354
|
+
* export class NotesController {
|
|
355
|
+
* @InertiaGet('/')
|
|
356
|
+
* async index(ctx: RouterContext) {
|
|
357
|
+
* return ctx.inertia('notes/Index', { notes: [] })
|
|
358
|
+
* }
|
|
359
|
+
*
|
|
360
|
+
* @InertiaGet('/:id', { params: z.object({ id: z.string() }) })
|
|
361
|
+
* async show(ctx: RouterContext) {
|
|
362
|
+
* return ctx.inertia('notes/Show', { note })
|
|
363
|
+
* }
|
|
364
|
+
* }
|
|
365
|
+
* ```
|
|
366
|
+
*/
|
|
367
|
+
declare function InertiaGet(path: string, config?: InertiaRouteConfig): (target: object, propertyKey: string, descriptor: PropertyDescriptor) => PropertyDescriptor;
|
|
368
|
+
/**
|
|
369
|
+
* Registers a POST route for an Inertia form submission.
|
|
370
|
+
*
|
|
371
|
+
* Wraps `@Post()` with auto-applied Inertia page response schema
|
|
372
|
+
* and `hideFromDocs: true` by default.
|
|
373
|
+
*
|
|
374
|
+
* @param path - Route path relative to the controller base path
|
|
375
|
+
* @param config - Optional route configuration (body, params, tags, etc.)
|
|
376
|
+
*/
|
|
377
|
+
declare function InertiaPost(path: string, config?: InertiaRouteConfig): (target: object, propertyKey: string, descriptor: PropertyDescriptor) => PropertyDescriptor;
|
|
378
|
+
/**
|
|
379
|
+
* Registers a PUT route for an Inertia form submission.
|
|
380
|
+
*
|
|
381
|
+
* Wraps `@Put()` with auto-applied Inertia page response schema
|
|
382
|
+
* and `hideFromDocs: true` by default.
|
|
383
|
+
*
|
|
384
|
+
* @param path - Route path relative to the controller base path
|
|
385
|
+
* @param config - Optional route configuration (body, params, tags, etc.)
|
|
386
|
+
*/
|
|
387
|
+
declare function InertiaPut(path: string, config?: InertiaRouteConfig): (target: object, propertyKey: string, descriptor: PropertyDescriptor) => PropertyDescriptor;
|
|
388
|
+
/**
|
|
389
|
+
* Registers a PATCH route for an Inertia form submission.
|
|
390
|
+
*
|
|
391
|
+
* Wraps `@Patch()` with auto-applied Inertia page response schema
|
|
392
|
+
* and `hideFromDocs: true` by default.
|
|
393
|
+
*
|
|
394
|
+
* @param path - Route path relative to the controller base path
|
|
395
|
+
* @param config - Optional route configuration (body, params, tags, etc.)
|
|
396
|
+
*/
|
|
397
|
+
declare function InertiaPatch(path: string, config?: InertiaRouteConfig): (target: object, propertyKey: string, descriptor: PropertyDescriptor) => PropertyDescriptor;
|
|
398
|
+
/**
|
|
399
|
+
* Registers a DELETE route for an Inertia form submission.
|
|
400
|
+
*
|
|
401
|
+
* Wraps `@Delete()` with auto-applied Inertia page response schema
|
|
402
|
+
* and `hideFromDocs: true` by default.
|
|
403
|
+
*
|
|
404
|
+
* @param path - Route path relative to the controller base path
|
|
405
|
+
* @param config - Optional route configuration (params, tags, etc.)
|
|
406
|
+
*/
|
|
407
|
+
declare function InertiaDelete(path: string, config?: InertiaRouteConfig): (target: object, propertyKey: string, descriptor: PropertyDescriptor) => PropertyDescriptor;
|
|
408
|
+
//#endregion
|
|
409
|
+
//#region src/middleware/handle-precognitive-requests.middleware.d.ts
|
|
410
|
+
declare class HandlePrecognitiveRequests implements Middleware {
|
|
411
|
+
handle(ctx: RouterContext, next: Next): Promise<void>;
|
|
412
|
+
}
|
|
413
|
+
//#endregion
|
|
414
|
+
//#region src/middleware/inertia.middleware.d.ts
|
|
415
|
+
declare class InertiaMiddleware implements Middleware {
|
|
416
|
+
private readonly options;
|
|
417
|
+
constructor(options: InertiaModuleOptions);
|
|
418
|
+
handle(ctx: RouterContext, next: Next): Promise<void>;
|
|
419
|
+
}
|
|
420
|
+
//#endregion
|
|
421
|
+
//#region src/commands/inertia-build.command.d.ts
|
|
422
|
+
declare class InertiaBuildCommand extends Command {
|
|
423
|
+
static command: string;
|
|
424
|
+
static description: string;
|
|
425
|
+
handle(): Promise<number | undefined>;
|
|
426
|
+
private spawnVite;
|
|
427
|
+
}
|
|
428
|
+
//#endregion
|
|
429
|
+
//#region src/commands/inertia-dev.command.d.ts
|
|
430
|
+
declare class InertiaDevCommand extends Command {
|
|
431
|
+
static command: string;
|
|
432
|
+
static description: string;
|
|
433
|
+
handle(): Promise<number | undefined>;
|
|
434
|
+
}
|
|
435
|
+
//#endregion
|
|
436
|
+
//#region src/commands/inertia-install.command.d.ts
|
|
437
|
+
declare class InertiaInstallCommand extends Command {
|
|
438
|
+
static command: string;
|
|
439
|
+
static description: string;
|
|
440
|
+
handle(): Promise<number | undefined>;
|
|
441
|
+
private updateAppModule;
|
|
442
|
+
}
|
|
443
|
+
//#endregion
|
|
444
|
+
//#region src/commands/inertia-types.command.d.ts
|
|
445
|
+
declare class InertiaTypesCommand extends Command {
|
|
446
|
+
static command: string;
|
|
447
|
+
static description: string;
|
|
448
|
+
handle(): Promise<number | undefined>;
|
|
449
|
+
private generate;
|
|
450
|
+
private watchForChanges;
|
|
451
|
+
}
|
|
452
|
+
//#endregion
|
|
453
|
+
//#region src/generator/type-generator.d.ts
|
|
454
|
+
declare function runTypeGeneration(cwd: string): Promise<{
|
|
455
|
+
outputPath: string;
|
|
456
|
+
pageCount: number;
|
|
457
|
+
}>;
|
|
458
|
+
//#endregion
|
|
459
|
+
//#region src/augment/router-variables.d.ts
|
|
460
|
+
declare module 'stratal/router' {
|
|
461
|
+
interface RouterVariables {
|
|
462
|
+
inertia: boolean;
|
|
463
|
+
inertiaPrefetch: boolean;
|
|
464
|
+
precognition: boolean;
|
|
465
|
+
withoutSsr: boolean;
|
|
466
|
+
inertiaFlash: Record<string, unknown>;
|
|
467
|
+
inertiaFlashOut: Record<string, unknown>;
|
|
468
|
+
}
|
|
469
|
+
}
|
|
470
|
+
//#endregion
|
|
471
|
+
export { CookieFlashStore, type FlashStore, HandlePrecognitiveRequests, INERTIA_TOKENS, type InertiaAlwaysProp, InertiaBuildCommand, type InertiaDeferredProp, InertiaDelete, InertiaDevCommand, type InertiaFlashOptions, type InertiaFullPageProps, InertiaGet, type InertiaI18nOptions, InertiaInstallCommand, type InertiaMergeProp, type InertiaMergeStrategy, InertiaMiddleware, InertiaModule, type InertiaModuleOptions, type InertiaOnceProp, type InertiaOptionalProp, type InertiaPage, type InertiaPageComponent, type InertiaPageRegistry, InertiaPatch, InertiaPost, InertiaPut, type InertiaRenderOptions, InertiaRoute, type InertiaRouteConfig, InertiaService, type InertiaSharedProps, type InertiaSsrBundle, type InertiaSsrOptions, type InertiaSsrResult, InertiaTypesCommand, ManifestService, type ResolvedInertiaPageProps, type SharedDataResolver, SsrRendererService, TemplateService, type ViteManifest, type ViteManifestEntry, runTypeGeneration };
|
|
472
|
+
//# sourceMappingURL=index.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/flash/flash-store.ts","../src/types.ts","../src/inertia.options.ts","../src/inertia.module.ts","../src/inertia.tokens.ts","../src/flash/cookie-flash-store.ts","../src/augment/router-context.ts","../src/services/ssr-renderer.service.ts","../src/services/manifest.service.ts","../src/services/template.service.ts","../src/services/inertia.service.ts","../src/decorators/inertia.decorators.ts","../src/middleware/handle-precognitive-requests.middleware.ts","../src/middleware/inertia.middleware.ts","../src/commands/inertia-build.command.ts","../src/commands/inertia-dev.command.ts","../src/commands/inertia-install.command.ts","../src/commands/inertia-types.command.ts","../src/generator/type-generator.ts","../src/augment/router-variables.ts"],"mappings":";;;;;;;;;;UAEiB,UAAA;EACf,IAAA,CAAK,GAAA,EAAK,aAAA,GAAgB,OAAA,CAAQ,MAAA;EAClC,KAAA,CAAM,GAAA,EAAK,aAAA,EAAe,IAAA,EAAM,MAAA,oBAA0B,OAAA;EAC1D,KAAA,CAAM,GAAA,EAAK,aAAA,GAAgB,OAAA;AAAA;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