@stratal/inertia 0.0.1 → 0.0.19
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 +265 -52
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +551 -177
- package/dist/index.mjs.map +1 -1
- package/dist/react.d.mts +83 -0
- package/dist/react.d.mts.map +1 -0
- package/dist/react.mjs +158 -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 +8 -1
- package/dist/vite.d.mts.map +1 -1
- package/dist/vite.mjs +152 -4
- package/dist/vite.mjs.map +1 -0
- package/package.json +47 -19
- package/dist/inertia-dev-css-plugin-BYromyO_.mjs +0 -70
- package/dist/inertia-dev-css-plugin-BYromyO_.mjs.map +0 -1
- package/dist/inertia-types-plugin-NO_uxhxQ.mjs +0 -39
- package/dist/inertia-types-plugin-NO_uxhxQ.mjs.map +0 -1
- package/dist/rolldown-runtime-wcPFST8Q.mjs +0 -13
- package/dist/type-generator-DlXIc6e2.mjs +0 -193
- package/dist/type-generator-DlXIc6e2.mjs.map +0 -1
package/dist/index.d.mts
CHANGED
|
@@ -1,38 +1,35 @@
|
|
|
1
1
|
/// <reference path="../global.d.ts" />
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
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";
|
|
4
6
|
import { Command } from "stratal/quarry";
|
|
7
|
+
import { LoggerService } from "stratal/logger";
|
|
5
8
|
import { z } from "stratal/validation";
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
|
|
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
|
|
9
18
|
//#region src/types.d.ts
|
|
10
19
|
interface InertiaPageRegistry {}
|
|
11
20
|
type InertiaSharedProps = SharedPageProps;
|
|
12
21
|
type InertiaPageComponent = keyof InertiaPageRegistry extends never ? string : Extract<keyof InertiaPageRegistry, string>;
|
|
13
|
-
type AllowInertiaWrappers<T> = { [K in keyof T]: T[K] | InertiaDeferredProp | InertiaMergeProp | InertiaOptionalProp };
|
|
22
|
+
type AllowInertiaWrappers<T> = { [K in keyof T]: T[K] | InertiaDeferredProp | InertiaMergeProp | InertiaOptionalProp | InertiaOnceProp | InertiaAlwaysProp };
|
|
14
23
|
type ResolvedInertiaPageProps<C extends InertiaPageComponent> = C extends keyof InertiaPageRegistry ? AllowInertiaWrappers<InertiaPageRegistry[C]> : Record<string, unknown>;
|
|
15
24
|
type InertiaFullPageProps<C extends InertiaPageComponent> = (C extends keyof InertiaPageRegistry ? InertiaPageRegistry[C] : Record<string, unknown>) & InertiaSharedProps;
|
|
16
|
-
interface InertiaPage {
|
|
17
|
-
component: string;
|
|
18
|
-
props: Record<string, unknown>;
|
|
19
|
-
url: string;
|
|
20
|
-
version: string;
|
|
21
|
-
mergeProps: string[];
|
|
22
|
-
deferredProps: Record<string, string[]>;
|
|
23
|
-
encryptHistory?: boolean;
|
|
24
|
-
clearHistory?: boolean;
|
|
25
|
-
}
|
|
26
25
|
interface InertiaRenderOptions {
|
|
27
26
|
encryptHistory?: boolean;
|
|
28
27
|
clearHistory?: boolean;
|
|
28
|
+
preserveFragment?: boolean;
|
|
29
29
|
}
|
|
30
|
-
|
|
31
|
-
head: string[];
|
|
32
|
-
body: string;
|
|
33
|
-
}
|
|
30
|
+
type InertiaSsrResult = InertiaAppSSRResponse;
|
|
34
31
|
interface InertiaSsrBundle {
|
|
35
|
-
render(page:
|
|
32
|
+
render(page: Page): Promise<InertiaSsrResult>;
|
|
36
33
|
}
|
|
37
34
|
type SharedDataResolver = (ctx: RouterContext) => any;
|
|
38
35
|
interface ViteManifestEntry {
|
|
@@ -47,23 +44,38 @@ type ViteManifest = Record<string, ViteManifestEntry>;
|
|
|
47
44
|
declare const INERTIA_PROP_OPTIONAL: unique symbol;
|
|
48
45
|
declare const INERTIA_PROP_DEFERRED: unique symbol;
|
|
49
46
|
declare const INERTIA_PROP_MERGE: unique symbol;
|
|
50
|
-
|
|
47
|
+
declare const INERTIA_PROP_ONCE: unique symbol;
|
|
48
|
+
declare const INERTIA_PROP_ALWAYS: unique symbol;
|
|
49
|
+
interface InertiaOptionalProp<T = unknown> {
|
|
51
50
|
[INERTIA_PROP_OPTIONAL]: true;
|
|
52
|
-
callback: () =>
|
|
51
|
+
callback: () => T;
|
|
53
52
|
}
|
|
54
|
-
interface InertiaDeferredProp {
|
|
53
|
+
interface InertiaDeferredProp<T = unknown> {
|
|
55
54
|
[INERTIA_PROP_DEFERRED]: true;
|
|
56
|
-
callback: () =>
|
|
55
|
+
callback: () => T;
|
|
57
56
|
group: string;
|
|
58
57
|
}
|
|
59
|
-
|
|
58
|
+
type InertiaMergeStrategy = 'append' | 'prepend' | 'deep';
|
|
59
|
+
interface InertiaMergeProp<T = unknown> {
|
|
60
60
|
[INERTIA_PROP_MERGE]: true;
|
|
61
|
-
callback: () =>
|
|
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;
|
|
62
74
|
}
|
|
63
75
|
//#endregion
|
|
64
76
|
//#region src/inertia.options.d.ts
|
|
65
77
|
interface SsrBundleModule {
|
|
66
|
-
render(page:
|
|
78
|
+
render(page: Page): Promise<InertiaAppSSRResponse>;
|
|
67
79
|
}
|
|
68
80
|
interface InertiaSsrOptions {
|
|
69
81
|
bundle: () => Promise<SsrBundleModule | {
|
|
@@ -75,11 +87,80 @@ interface InertiaSsrOptions {
|
|
|
75
87
|
*/
|
|
76
88
|
disabled?: string[];
|
|
77
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
|
+
}
|
|
78
127
|
interface InertiaModuleOptions {
|
|
79
128
|
rootView: string;
|
|
80
129
|
version?: string;
|
|
81
130
|
ssr?: InertiaSsrOptions;
|
|
131
|
+
flash?: InertiaFlashOptions;
|
|
82
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;
|
|
83
164
|
/**
|
|
84
165
|
* Vite manifest for production builds. When omitted, dev mode is assumed
|
|
85
166
|
* and Vite client + entry scripts are injected with same-origin paths.
|
|
@@ -93,11 +174,17 @@ interface InertiaModuleOptions {
|
|
|
93
174
|
}
|
|
94
175
|
//#endregion
|
|
95
176
|
//#region src/inertia.module.d.ts
|
|
96
|
-
declare class InertiaModule implements
|
|
177
|
+
declare class InertiaModule implements RouteConfigurable, OnInitialize, OnException {
|
|
97
178
|
static forRoot(options: InertiaModuleOptions): DynamicModule;
|
|
98
179
|
static forRootAsync(options: AsyncModuleOptions<InertiaModuleOptions>): DynamicModule;
|
|
99
|
-
|
|
180
|
+
configureRoutes(router: Router): void;
|
|
181
|
+
onException(handler: ExceptionHandler): void;
|
|
100
182
|
onInitialize(): void;
|
|
183
|
+
private isInertiaRequest;
|
|
184
|
+
private isPrecognitionRequest;
|
|
185
|
+
private handlePrecognitionValidationError;
|
|
186
|
+
private createPrecognitionErrorResponse;
|
|
187
|
+
private redirectBack;
|
|
101
188
|
}
|
|
102
189
|
//#endregion
|
|
103
190
|
//#region src/inertia.tokens.d.ts
|
|
@@ -109,13 +196,60 @@ declare const INERTIA_TOKENS: {
|
|
|
109
196
|
readonly SsrRenderer: symbol;
|
|
110
197
|
};
|
|
111
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
|
|
112
245
|
//#region src/services/ssr-renderer.service.d.ts
|
|
113
246
|
declare class SsrRendererService {
|
|
114
247
|
private readonly options;
|
|
248
|
+
private readonly logger;
|
|
115
249
|
private bundle;
|
|
116
250
|
private loadPromise;
|
|
117
|
-
constructor(options: InertiaModuleOptions);
|
|
118
|
-
render(page:
|
|
251
|
+
constructor(options: InertiaModuleOptions, logger: LoggerService);
|
|
252
|
+
render(page: Page): Promise<InertiaAppSSRResponse>;
|
|
119
253
|
private ensureBundle;
|
|
120
254
|
private loadBundle;
|
|
121
255
|
}
|
|
@@ -135,7 +269,7 @@ declare class TemplateService {
|
|
|
135
269
|
private readonly options;
|
|
136
270
|
private readonly manifest;
|
|
137
271
|
constructor(options: InertiaModuleOptions, manifest: ManifestService);
|
|
138
|
-
render(page:
|
|
272
|
+
render(page: Page, ssrHead: string[], ssrBody: string): string;
|
|
139
273
|
private buildClientOnlyBody;
|
|
140
274
|
}
|
|
141
275
|
//#endregion
|
|
@@ -148,35 +282,50 @@ declare class InertiaService {
|
|
|
148
282
|
constructor(options: InertiaModuleOptions, template: TemplateService, ssr: SsrRendererService);
|
|
149
283
|
share(key: string, value: unknown): void;
|
|
150
284
|
location(url: string): Response;
|
|
151
|
-
optional(callback: () =>
|
|
152
|
-
defer(callback: () =>
|
|
153
|
-
merge(callback: () =>
|
|
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>;
|
|
154
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
|
+
*/
|
|
155
298
|
private resolveSharedData;
|
|
299
|
+
private isPartialReload;
|
|
156
300
|
private processProps;
|
|
157
301
|
/**
|
|
158
302
|
* Check if a prop key is requested — supports dot-notation (e.g., `user.permissions`
|
|
159
303
|
* matches the top-level `user` key).
|
|
160
304
|
*/
|
|
161
305
|
private isRequested;
|
|
306
|
+
private isExcepted;
|
|
162
307
|
private isOptionalProp;
|
|
163
308
|
private isDeferredProp;
|
|
164
309
|
private isMergeProp;
|
|
310
|
+
private isOnceProp;
|
|
311
|
+
private isAlwaysProp;
|
|
312
|
+
private serializeRoutes;
|
|
165
313
|
private isSsrDisabled;
|
|
166
314
|
}
|
|
167
315
|
//#endregion
|
|
168
|
-
//#region src/decorators/inertia
|
|
316
|
+
//#region src/decorators/inertia.decorators.d.ts
|
|
169
317
|
type InertiaRouteConfig = Omit<RouteConfig, 'response' | 'statusCode' | 'hideFromDocs'> & {
|
|
170
318
|
hideFromDocs?: boolean;
|
|
171
319
|
};
|
|
172
320
|
/**
|
|
173
|
-
* Decorator for Inertia page routes.
|
|
321
|
+
* Decorator for Inertia page routes using convention-based routing.
|
|
174
322
|
*
|
|
175
323
|
* Wraps `@Route()` with:
|
|
176
324
|
* - Auto-applied Inertia page response schema
|
|
177
325
|
* - `hideFromDocs: true` by default (overridable)
|
|
178
326
|
*
|
|
179
|
-
*
|
|
327
|
+
* **Cannot be mixed with HTTP method decorators** (`@Get`, `@Post`, `@InertiaGet`, etc.)
|
|
328
|
+
* in the same controller.
|
|
180
329
|
*
|
|
181
330
|
* @example
|
|
182
331
|
* ```typescript
|
|
@@ -190,12 +339,83 @@ type InertiaRouteConfig = Omit<RouteConfig, 'response' | 'statusCode' | 'hideFro
|
|
|
190
339
|
* ```
|
|
191
340
|
*/
|
|
192
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
|
+
}
|
|
193
413
|
//#endregion
|
|
194
414
|
//#region src/middleware/inertia.middleware.d.ts
|
|
195
415
|
declare class InertiaMiddleware implements Middleware {
|
|
196
416
|
private readonly options;
|
|
197
417
|
constructor(options: InertiaModuleOptions);
|
|
198
|
-
handle(ctx: RouterContext, next:
|
|
418
|
+
handle(ctx: RouterContext, next: Next): Promise<void>;
|
|
199
419
|
}
|
|
200
420
|
//#endregion
|
|
201
421
|
//#region src/commands/inertia-build.command.d.ts
|
|
@@ -203,6 +423,7 @@ declare class InertiaBuildCommand extends Command {
|
|
|
203
423
|
static command: string;
|
|
204
424
|
static description: string;
|
|
205
425
|
handle(): Promise<number | undefined>;
|
|
426
|
+
private spawnVite;
|
|
206
427
|
}
|
|
207
428
|
//#endregion
|
|
208
429
|
//#region src/commands/inertia-dev.command.d.ts
|
|
@@ -235,25 +456,17 @@ declare function runTypeGeneration(cwd: string): Promise<{
|
|
|
235
456
|
pageCount: number;
|
|
236
457
|
}>;
|
|
237
458
|
//#endregion
|
|
238
|
-
//#region src/augment/router-context.d.ts
|
|
239
|
-
declare module 'stratal/router' {
|
|
240
|
-
interface RouterContext {
|
|
241
|
-
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>;
|
|
242
|
-
defer(callback: () => unknown, group?: string): InertiaDeferredProp;
|
|
243
|
-
optional(callback: () => unknown): InertiaOptionalProp;
|
|
244
|
-
merge(callback: () => unknown): InertiaMergeProp;
|
|
245
|
-
withoutSsr(): void;
|
|
246
|
-
}
|
|
247
|
-
}
|
|
248
|
-
//#endregion
|
|
249
459
|
//#region src/augment/router-variables.d.ts
|
|
250
460
|
declare module 'stratal/router' {
|
|
251
461
|
interface RouterVariables {
|
|
252
462
|
inertia: boolean;
|
|
253
463
|
inertiaPrefetch: boolean;
|
|
464
|
+
precognition: boolean;
|
|
254
465
|
withoutSsr: boolean;
|
|
466
|
+
inertiaFlash: Record<string, unknown>;
|
|
467
|
+
inertiaFlashOut: Record<string, unknown>;
|
|
255
468
|
}
|
|
256
469
|
}
|
|
257
470
|
//#endregion
|
|
258
|
-
export { INERTIA_TOKENS, InertiaBuildCommand, type InertiaDeferredProp, InertiaDevCommand, type InertiaFullPageProps, InertiaInstallCommand, type InertiaMergeProp, InertiaMiddleware, InertiaModule, type InertiaModuleOptions, type InertiaOptionalProp, type InertiaPage, type InertiaPageComponent, type InertiaPageRegistry, 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 };
|
|
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 };
|
|
259
472
|
//# sourceMappingURL=index.d.mts.map
|
package/dist/index.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/types.ts","../src/inertia.options.ts","../src/inertia.module.ts","../src/inertia.tokens.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-
|
|
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;;;UCDZ,mBAAA;AAAA,KAIL,kBAAA,GAAqB,eAAA;AAAA,KAErB,oBAAA,SAA6B,mBAAA,0BAErC,OAAA,OAAc,mBAAA;AAAA,KAGb,oBAAA,oBACS,CAAA,GAAI,CAAA,CAAE,CAAA,IAAK,mBAAA,GAAsB,gBAAA,GAAmB,mBAAA,GAAsB,eAAA,GAAkB,iBAAA;AAAA,KAK9F,wBAAA,WAAmC,oBAAA,IAC7C,CAAA,eAAgB,mBAAA,GAAsB,oBAAA,CAAqB,mBAAA,CAAoB,CAAA,KAAM,MAAA;AAAA,KAG3E,oBAAA,WAA+B,oBAAA,KACxC,CAAA,eAAgB,mBAAA,GAAsB,mBAAA,CAAoB,CAAA,IAAK,MAAA,qBAA2B,kBAAA;AAAA,UAK5E,oBAAA;EACf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