@inertia-node/nest-fastify 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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Inertia Node Adapter contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,108 @@
1
+ import { RenderOptions, InputProps, ValidationErrorInput, ValidationErrorOptions, CreateInertiaOptions, InertiaInstance, SessionStore, AuthConfig, AuthRuntime } from '@inertia-node/core';
2
+ export { AuthConfig, AuthRuntime, CreateInertiaOptions, InertiaInstance, InputProps, ProtocolResponse, RenderOptions, SessionStore, ValidationErrorInput, ValidationErrorOptions, ValidationErrorPayload, always, createInertia, defer, inertiaAuth, merge, optional, validationError } from '@inertia-node/core';
3
+ import { ModuleMetadata, Type, CanActivate, ExecutionContext, NestInterceptor, CallHandler, DynamicModule } from '@nestjs/common';
4
+ import { FastifyRequest } from 'fastify';
5
+ import { Reflector } from '@nestjs/core';
6
+ import { Observable } from 'rxjs';
7
+
8
+ interface NestFastifyInertiaOptions extends CreateInertiaOptions {
9
+ instance?: InertiaInstance;
10
+ session?: (request: FastifyRequest) => SessionStore | undefined;
11
+ auth?: AuthConfig<FastifyRequest, any, any>;
12
+ withAllErrors?: boolean;
13
+ }
14
+ type NestFastifyRenderOptions = RenderOptions;
15
+ interface NestFastifyInertiaOptionsFactory {
16
+ createInertiaOptions(): Promise<NestFastifyInertiaOptions> | NestFastifyInertiaOptions;
17
+ }
18
+ interface NestFastifyInertiaAsyncOptions extends Pick<ModuleMetadata, "imports"> {
19
+ inject?: any[];
20
+ useExisting?: Type<NestFastifyInertiaOptionsFactory>;
21
+ useClass?: Type<NestFastifyInertiaOptionsFactory>;
22
+ useFactory?: (...args: any[]) => Promise<NestFastifyInertiaOptions> | NestFastifyInertiaOptions;
23
+ }
24
+ type InertiaControllerResult = InertiaRenderResult | InertiaRedirectResult | InertiaLocationResult | InertiaBackWithErrorsResult;
25
+ interface InertiaRenderResult {
26
+ readonly __inertiaNestFastify: "render";
27
+ component: string;
28
+ props?: InputProps;
29
+ options?: NestFastifyRenderOptions;
30
+ }
31
+ interface InertiaRedirectResult {
32
+ readonly __inertiaNestFastify: "redirect";
33
+ location: string;
34
+ status?: number;
35
+ }
36
+ interface InertiaLocationResult {
37
+ readonly __inertiaNestFastify: "location";
38
+ location: string;
39
+ }
40
+ interface InertiaBackWithErrorsResult {
41
+ readonly __inertiaNestFastify: "backWithErrors";
42
+ errors: ValidationErrorInput;
43
+ options?: ValidationErrorOptions;
44
+ }
45
+
46
+ declare function inertiaDecorator(component: string, options?: NestFastifyRenderOptions): MethodDecorator;
47
+ declare const Inertia: typeof inertiaDecorator & {
48
+ render(component: string, props?: InputProps, options?: NestFastifyRenderOptions): InertiaRenderResult;
49
+ redirect(location: string, status?: number): InertiaRedirectResult;
50
+ location(location: string): InertiaLocationResult;
51
+ backWithErrors(errors: ValidationErrorInput, options?: ValidationErrorOptions): InertiaBackWithErrorsResult;
52
+ };
53
+ declare function InertiaRenderOptions(options: NestFastifyRenderOptions): MethodDecorator;
54
+
55
+ declare class InertiaAuthGuard implements CanActivate {
56
+ private readonly options;
57
+ constructor(options: NestFastifyInertiaOptions);
58
+ canActivate(context: ExecutionContext): Promise<boolean>;
59
+ }
60
+ declare class InertiaGuestGuard implements CanActivate {
61
+ private readonly options;
62
+ constructor(options: NestFastifyInertiaOptions);
63
+ canActivate(context: ExecutionContext): Promise<boolean>;
64
+ }
65
+
66
+ declare class InertiaInterceptor implements NestInterceptor {
67
+ private readonly options;
68
+ private readonly reflector;
69
+ private readonly inertia;
70
+ constructor(options: NestFastifyInertiaOptions, reflector: Reflector);
71
+ intercept(context: ExecutionContext, next: CallHandler): Observable<unknown>;
72
+ private handleResult;
73
+ private sendRender;
74
+ private sendRedirect;
75
+ private sendLocation;
76
+ private sendBackWithErrors;
77
+ }
78
+
79
+ declare class InertiaModule {
80
+ static forRoot(options?: NestFastifyInertiaOptions): DynamicModule;
81
+ static forRootAsync(options: NestFastifyInertiaAsyncOptions): DynamicModule;
82
+ }
83
+
84
+ declare function fastifySessionAdapter(): (request: FastifyRequest) => SessionStore | undefined;
85
+
86
+ declare class InertiaService {
87
+ readonly options: NestFastifyInertiaOptions;
88
+ constructor(options: NestFastifyInertiaOptions);
89
+ render(component: string, props?: InputProps, options?: NestFastifyRenderOptions): InertiaRenderResult;
90
+ redirect(location: string, status?: number): InertiaRedirectResult;
91
+ location(location: string): InertiaLocationResult;
92
+ backWithErrors(errors: ValidationErrorInput, options?: ValidationErrorOptions): InertiaBackWithErrorsResult;
93
+ }
94
+
95
+ type NestFastifyInertiaRequest<User = unknown> = FastifyRequest & {
96
+ user?: User;
97
+ auth?: AuthRuntime<User>;
98
+ flash(key: string, value: unknown): Promise<void>;
99
+ };
100
+ declare module "fastify" {
101
+ interface FastifyRequest {
102
+ user?: unknown;
103
+ auth?: AuthRuntime<unknown>;
104
+ flash(key: string, value: unknown): Promise<void>;
105
+ }
106
+ }
107
+
108
+ export { Inertia, InertiaAuthGuard, type InertiaBackWithErrorsResult, type InertiaControllerResult, InertiaGuestGuard, InertiaInterceptor, type InertiaLocationResult, InertiaModule, type InertiaRedirectResult, InertiaRenderOptions, type InertiaRenderResult, InertiaService, type NestFastifyInertiaAsyncOptions, type NestFastifyInertiaOptions, type NestFastifyInertiaOptionsFactory, type NestFastifyInertiaRequest, type NestFastifyRenderOptions, fastifySessionAdapter };
package/dist/index.js ADDED
@@ -0,0 +1,559 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __decorateClass = (decorators, target, key, kind) => {
4
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
5
+ for (var i = decorators.length - 1, decorator; i >= 0; i--)
6
+ if (decorator = decorators[i])
7
+ result = (kind ? decorator(target, key, result) : decorator(result)) || result;
8
+ if (kind && result) __defProp(target, key, result);
9
+ return result;
10
+ };
11
+ var __decorateParam = (index, decorator) => (target, key) => decorator(target, key, index);
12
+
13
+ // src/decorators.ts
14
+ import { SetMetadata } from "@nestjs/common";
15
+
16
+ // src/constants.ts
17
+ var INERTIA_MODULE_OPTIONS = /* @__PURE__ */ Symbol("INERTIA_MODULE_OPTIONS");
18
+ var INERTIA_COMPONENT_METADATA = "inertia-node-fastify:component";
19
+ var INERTIA_RENDER_OPTIONS_METADATA = "inertia-node-fastify:render-options";
20
+
21
+ // src/decorators.ts
22
+ function inertiaDecorator(component, options = {}) {
23
+ return (target, propertyKey, descriptor) => {
24
+ SetMetadata(INERTIA_COMPONENT_METADATA, component)(
25
+ target,
26
+ propertyKey,
27
+ descriptor
28
+ );
29
+ SetMetadata(INERTIA_RENDER_OPTIONS_METADATA, options)(
30
+ target,
31
+ propertyKey,
32
+ descriptor
33
+ );
34
+ };
35
+ }
36
+ var Inertia = Object.assign(inertiaDecorator, {
37
+ render(component, props = {}, options = {}) {
38
+ return {
39
+ __inertiaNestFastify: "render",
40
+ component,
41
+ props,
42
+ options
43
+ };
44
+ },
45
+ redirect(location, status) {
46
+ return {
47
+ __inertiaNestFastify: "redirect",
48
+ location,
49
+ status
50
+ };
51
+ },
52
+ location(location) {
53
+ return {
54
+ __inertiaNestFastify: "location",
55
+ location
56
+ };
57
+ },
58
+ backWithErrors(errors, options = {}) {
59
+ return {
60
+ __inertiaNestFastify: "backWithErrors",
61
+ errors,
62
+ options
63
+ };
64
+ }
65
+ });
66
+ function InertiaRenderOptions(options) {
67
+ return SetMetadata(INERTIA_RENDER_OPTIONS_METADATA, options);
68
+ }
69
+ function isInertiaControllerResult(value) {
70
+ return typeof value === "object" && value !== null && "__inertiaNestFastify" in value && typeof value.__inertiaNestFastify === "string";
71
+ }
72
+
73
+ // src/guards.ts
74
+ import {
75
+ Inject,
76
+ Injectable
77
+ } from "@nestjs/common";
78
+
79
+ // src/runtime.ts
80
+ import {
81
+ always,
82
+ validationError
83
+ } from "@inertia-node/core";
84
+ function prepareInertiaRequest(request, options) {
85
+ const sessionStore = options.session?.(request);
86
+ const inertiaRequest = request;
87
+ inertiaRequest.flash = async (key, value) => {
88
+ await sessionStore?.flash("flash", {
89
+ ...await sessionStore.get("flash") ?? {},
90
+ [key]: value
91
+ });
92
+ };
93
+ if (options.auth && !inertiaRequest.auth) {
94
+ installAuth(inertiaRequest, options.auth);
95
+ }
96
+ return sessionStore;
97
+ }
98
+ function sendProtocolResponse(request, reply, sessionStore, protocol) {
99
+ if (protocol.status === 409) {
100
+ void sessionStore?.reflash();
101
+ void request.session?.save?.();
102
+ }
103
+ reply.code(protocol.status);
104
+ for (const [name, value] of Object.entries(protocol.headers)) {
105
+ reply.header(name, value);
106
+ }
107
+ reply.send(protocol.body);
108
+ }
109
+ function toInertiaRequest(request) {
110
+ const host = request.headers.host;
111
+ return {
112
+ headers: request.headers,
113
+ method: request.method,
114
+ url: request.url,
115
+ originalUrl: request.url,
116
+ host: Array.isArray(host) ? host[0] : host,
117
+ raw: request
118
+ };
119
+ }
120
+ async function resolveUserShare(options, context) {
121
+ const request = context.request.raw;
122
+ if (!request || !options.auth) {
123
+ return {};
124
+ }
125
+ prepareInertiaRequest(request, options);
126
+ return {
127
+ auth: always({
128
+ user: await request.auth?.serializedUser()
129
+ })
130
+ };
131
+ }
132
+ async function flashErrors(session, payload, withAllErrors = false) {
133
+ const normalized = normalizeErrors(payload.errors, withAllErrors);
134
+ if (payload.bag) {
135
+ await session.flash("errors", {
136
+ [payload.bag]: normalized
137
+ });
138
+ return;
139
+ }
140
+ await session.flash("errors", normalized);
141
+ }
142
+ async function pullErrors(session, request, withAllErrors = false) {
143
+ const errors = await session.pull("errors");
144
+ if (!errors) {
145
+ return {};
146
+ }
147
+ const bag = typeof request?.headers["x-inertia-error-bag"] === "string" ? request.headers["x-inertia-error-bag"] : void 0;
148
+ if (bag && bag in errors) {
149
+ return {
150
+ [bag]: normalizeErrors(
151
+ errors[bag],
152
+ withAllErrors
153
+ )
154
+ };
155
+ }
156
+ return normalizeErrors(errors, withAllErrors);
157
+ }
158
+ function validationPayloadForRequest(request, errors, options = {}) {
159
+ return validationError(errors, {
160
+ bag: options.bag ?? (typeof request.headers["x-inertia-error-bag"] === "string" ? request.headers["x-inertia-error-bag"] : void 0)
161
+ });
162
+ }
163
+ function installAuth(request, config) {
164
+ let loaded = false;
165
+ let cachedUser = null;
166
+ async function user() {
167
+ if (!loaded) {
168
+ cachedUser = await config.getUser(request);
169
+ loaded = true;
170
+ request.user = cachedUser ?? void 0;
171
+ }
172
+ return cachedUser;
173
+ }
174
+ const runtime = {
175
+ user,
176
+ check: async () => await user() !== null,
177
+ login: async (loginUser) => {
178
+ await config.login(request, loginUser);
179
+ cachedUser = loginUser;
180
+ loaded = true;
181
+ request.user = loginUser;
182
+ },
183
+ logout: async () => {
184
+ await config.logout(request);
185
+ cachedUser = null;
186
+ loaded = true;
187
+ request.user = void 0;
188
+ },
189
+ serializedUser: async () => {
190
+ const currentUser = await user();
191
+ if (!currentUser) {
192
+ return null;
193
+ }
194
+ return config.serializeUser ? await config.serializeUser(currentUser) : currentUser;
195
+ }
196
+ };
197
+ request.auth = runtime;
198
+ }
199
+ function normalizeErrors(errors, withAllErrors) {
200
+ const normalized = {};
201
+ for (const [field, value] of Object.entries(errors)) {
202
+ const messages = Array.isArray(value) ? value.flat().map(String) : [String(value)];
203
+ normalized[field] = withAllErrors ? messages : messages[0] ?? "";
204
+ }
205
+ return normalized;
206
+ }
207
+
208
+ // src/guards.ts
209
+ var InertiaAuthGuard = class {
210
+ constructor(options) {
211
+ this.options = options;
212
+ }
213
+ options;
214
+ async canActivate(context) {
215
+ const request = context.switchToHttp().getRequest();
216
+ const reply = context.switchToHttp().getResponse();
217
+ prepareInertiaRequest(request, this.options);
218
+ if (request.auth && await request.auth.check()) {
219
+ request.user = await request.auth.user();
220
+ return true;
221
+ }
222
+ reply.code(303).redirect(this.options.auth?.redirectTo ?? "/login");
223
+ return false;
224
+ }
225
+ };
226
+ InertiaAuthGuard = __decorateClass([
227
+ Injectable(),
228
+ __decorateParam(0, Inject(INERTIA_MODULE_OPTIONS))
229
+ ], InertiaAuthGuard);
230
+ var InertiaGuestGuard = class {
231
+ constructor(options) {
232
+ this.options = options;
233
+ }
234
+ options;
235
+ async canActivate(context) {
236
+ const request = context.switchToHttp().getRequest();
237
+ const reply = context.switchToHttp().getResponse();
238
+ prepareInertiaRequest(request, this.options);
239
+ if (request.auth && await request.auth.check()) {
240
+ reply.code(303).redirect(this.options.auth?.home ?? "/dashboard");
241
+ return false;
242
+ }
243
+ return true;
244
+ }
245
+ };
246
+ InertiaGuestGuard = __decorateClass([
247
+ Injectable(),
248
+ __decorateParam(0, Inject(INERTIA_MODULE_OPTIONS))
249
+ ], InertiaGuestGuard);
250
+
251
+ // src/interceptor.ts
252
+ import {
253
+ Inject as Inject2,
254
+ Injectable as Injectable2
255
+ } from "@nestjs/common";
256
+ import { Reflector } from "@nestjs/core";
257
+ import {
258
+ always as always2,
259
+ createInertia
260
+ } from "@inertia-node/core";
261
+ import { mergeMap } from "rxjs";
262
+ var InertiaInterceptor = class {
263
+ constructor(options, reflector) {
264
+ this.options = options;
265
+ this.reflector = reflector;
266
+ this.inertia = options.instance ?? createInertia({
267
+ ...options,
268
+ share: async (context) => {
269
+ const request = context.request.raw;
270
+ const sessionStore = request ? options.session?.(request) : void 0;
271
+ const userShare = await resolveUserShare(options, context);
272
+ const baseShare = typeof options.share === "function" ? await options.share(context) : options.share ?? {};
273
+ return {
274
+ errors: always2(
275
+ sessionStore ? await pullErrors(sessionStore, request, options.withAllErrors) : {}
276
+ ),
277
+ flash: always2(
278
+ sessionStore ? await sessionStore.pull("flash") ?? {} : {}
279
+ ),
280
+ ...userShare,
281
+ ...baseShare
282
+ };
283
+ }
284
+ });
285
+ }
286
+ options;
287
+ reflector;
288
+ inertia;
289
+ intercept(context, next) {
290
+ const request = context.switchToHttp().getRequest();
291
+ prepareInertiaRequest(request, this.options);
292
+ return next.handle().pipe(
293
+ mergeMap(async (result) => {
294
+ const handled = await this.handleResult(context, result);
295
+ return handled.handled ? void 0 : result;
296
+ })
297
+ );
298
+ }
299
+ async handleResult(context, result) {
300
+ const http = context.switchToHttp();
301
+ const request = http.getRequest();
302
+ const reply = http.getResponse();
303
+ const sessionStore = prepareInertiaRequest(request, this.options);
304
+ if (isInertiaControllerResult(result)) {
305
+ switch (result.__inertiaNestFastify) {
306
+ case "render":
307
+ await this.sendRender(request, reply, sessionStore, result);
308
+ return { handled: true };
309
+ case "redirect":
310
+ this.sendRedirect(request, reply, sessionStore, result);
311
+ return { handled: true };
312
+ case "location":
313
+ this.sendLocation(reply, result);
314
+ return { handled: true };
315
+ case "backWithErrors":
316
+ await this.sendBackWithErrors(request, reply, sessionStore, result);
317
+ return { handled: true };
318
+ }
319
+ }
320
+ const component = this.reflector.get(
321
+ INERTIA_COMPONENT_METADATA,
322
+ context.getHandler()
323
+ );
324
+ if (!component) {
325
+ return { handled: false };
326
+ }
327
+ const decoratorOptions = this.reflector.get(
328
+ INERTIA_RENDER_OPTIONS_METADATA,
329
+ context.getHandler()
330
+ ) ?? {};
331
+ const props = result && typeof result === "object" && !Array.isArray(result) ? result : {};
332
+ await this.sendRender(request, reply, sessionStore, {
333
+ __inertiaNestFastify: "render",
334
+ component,
335
+ props,
336
+ options: decoratorOptions
337
+ });
338
+ return { handled: true };
339
+ }
340
+ async sendRender(request, reply, sessionStore, result) {
341
+ sendProtocolResponse(
342
+ request,
343
+ reply,
344
+ sessionStore,
345
+ await this.inertia.render(
346
+ toInertiaRequest(request),
347
+ result.component,
348
+ result.props,
349
+ result.options
350
+ )
351
+ );
352
+ }
353
+ sendRedirect(request, reply, sessionStore, result) {
354
+ sendProtocolResponse(
355
+ request,
356
+ reply,
357
+ sessionStore,
358
+ this.inertia.redirect(
359
+ toInertiaRequest(request),
360
+ result.location,
361
+ result.status
362
+ )
363
+ );
364
+ }
365
+ sendLocation(reply, result) {
366
+ sendProtocolResponse(
367
+ reply.request,
368
+ reply,
369
+ void 0,
370
+ this.inertia.location(result.location)
371
+ );
372
+ }
373
+ async sendBackWithErrors(request, reply, sessionStore, result) {
374
+ if (!sessionStore) {
375
+ throw new Error("backWithErrors requires a configured session adapter");
376
+ }
377
+ await flashErrors(
378
+ sessionStore,
379
+ validationPayloadForRequest(request, result.errors, result.options),
380
+ this.options.withAllErrors
381
+ );
382
+ this.sendRedirect(request, reply, sessionStore, {
383
+ __inertiaNestFastify: "redirect",
384
+ location: firstHeader(request.headers.referrer) ?? firstHeader(request.headers.referer) ?? "/"
385
+ });
386
+ }
387
+ };
388
+ InertiaInterceptor = __decorateClass([
389
+ Injectable2(),
390
+ __decorateParam(0, Inject2(INERTIA_MODULE_OPTIONS)),
391
+ __decorateParam(1, Inject2(Reflector))
392
+ ], InertiaInterceptor);
393
+ function firstHeader(value) {
394
+ return Array.isArray(value) ? value[0] : value;
395
+ }
396
+
397
+ // src/module.ts
398
+ import { Module } from "@nestjs/common";
399
+
400
+ // src/service.ts
401
+ import { Inject as Inject3, Injectable as Injectable3 } from "@nestjs/common";
402
+ var InertiaService = class {
403
+ constructor(options) {
404
+ this.options = options;
405
+ }
406
+ options;
407
+ render(component, props = {}, options = {}) {
408
+ return Inertia.render(component, props, options);
409
+ }
410
+ redirect(location, status) {
411
+ return Inertia.redirect(location, status);
412
+ }
413
+ location(location) {
414
+ return Inertia.location(location);
415
+ }
416
+ backWithErrors(errors, options = {}) {
417
+ return Inertia.backWithErrors(errors, options);
418
+ }
419
+ };
420
+ InertiaService = __decorateClass([
421
+ Injectable3(),
422
+ __decorateParam(0, Inject3(INERTIA_MODULE_OPTIONS))
423
+ ], InertiaService);
424
+
425
+ // src/module.ts
426
+ var InertiaModule = class {
427
+ static forRoot(options = {}) {
428
+ return {
429
+ module: InertiaModule,
430
+ providers: [
431
+ { provide: INERTIA_MODULE_OPTIONS, useValue: options },
432
+ InertiaService,
433
+ InertiaInterceptor,
434
+ InertiaAuthGuard,
435
+ InertiaGuestGuard
436
+ ],
437
+ exports: [
438
+ INERTIA_MODULE_OPTIONS,
439
+ InertiaService,
440
+ InertiaInterceptor,
441
+ InertiaAuthGuard,
442
+ InertiaGuestGuard
443
+ ]
444
+ };
445
+ }
446
+ static forRootAsync(options) {
447
+ return {
448
+ module: InertiaModule,
449
+ imports: options.imports,
450
+ providers: [
451
+ ...createAsyncProviders(options),
452
+ InertiaService,
453
+ InertiaInterceptor,
454
+ InertiaAuthGuard,
455
+ InertiaGuestGuard
456
+ ],
457
+ exports: [
458
+ INERTIA_MODULE_OPTIONS,
459
+ InertiaService,
460
+ InertiaInterceptor,
461
+ InertiaAuthGuard,
462
+ InertiaGuestGuard
463
+ ]
464
+ };
465
+ }
466
+ };
467
+ InertiaModule = __decorateClass([
468
+ Module({})
469
+ ], InertiaModule);
470
+ function createAsyncProviders(options) {
471
+ if (options.useFactory) {
472
+ return [
473
+ {
474
+ provide: INERTIA_MODULE_OPTIONS,
475
+ useFactory: options.useFactory,
476
+ inject: options.inject ?? []
477
+ }
478
+ ];
479
+ }
480
+ const useClass = options.useClass ?? options.useExisting;
481
+ if (!useClass) {
482
+ throw new Error(
483
+ "InertiaModule.forRootAsync requires useFactory, useClass, or useExisting."
484
+ );
485
+ }
486
+ const providers = [
487
+ {
488
+ provide: INERTIA_MODULE_OPTIONS,
489
+ useFactory: async (factory) => factory.createInertiaOptions(),
490
+ inject: [useClass]
491
+ }
492
+ ];
493
+ if (options.useClass) {
494
+ providers.push({
495
+ provide: useClass,
496
+ useClass
497
+ });
498
+ }
499
+ return providers;
500
+ }
501
+
502
+ // src/session.ts
503
+ function fastifySessionAdapter() {
504
+ return (request) => {
505
+ const session = request.session;
506
+ if (!session) {
507
+ return void 0;
508
+ }
509
+ return {
510
+ get: (key) => session.get(key),
511
+ set: (key, value) => {
512
+ session.set(key, value);
513
+ },
514
+ pull: (key) => {
515
+ const value = session.get(key);
516
+ if (session.delete) {
517
+ session.delete(key);
518
+ } else {
519
+ session.set(key, void 0);
520
+ }
521
+ return value;
522
+ },
523
+ flash: (key, value) => {
524
+ session.set(key, value);
525
+ },
526
+ reflash: () => {
527
+ }
528
+ };
529
+ };
530
+ }
531
+
532
+ // src/index.ts
533
+ import {
534
+ always as always3,
535
+ createInertia as createInertia2,
536
+ defer,
537
+ inertiaAuth,
538
+ merge,
539
+ optional,
540
+ validationError as validationError2
541
+ } from "@inertia-node/core";
542
+ export {
543
+ Inertia,
544
+ InertiaAuthGuard,
545
+ InertiaGuestGuard,
546
+ InertiaInterceptor,
547
+ InertiaModule,
548
+ InertiaRenderOptions,
549
+ InertiaService,
550
+ always3 as always,
551
+ createInertia2 as createInertia,
552
+ defer,
553
+ fastifySessionAdapter,
554
+ inertiaAuth,
555
+ merge,
556
+ optional,
557
+ validationError2 as validationError
558
+ };
559
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/decorators.ts","../src/constants.ts","../src/guards.ts","../src/runtime.ts","../src/interceptor.ts","../src/module.ts","../src/service.ts","../src/session.ts","../src/index.ts"],"sourcesContent":["import { SetMetadata } from \"@nestjs/common\";\nimport {\n INERTIA_COMPONENT_METADATA,\n INERTIA_RENDER_OPTIONS_METADATA,\n} from \"./constants.js\";\nimport type {\n InertiaBackWithErrorsResult,\n InertiaLocationResult,\n InertiaRedirectResult,\n InertiaRenderResult,\n NestFastifyRenderOptions,\n} from \"./types.js\";\nimport type {\n InputProps,\n ValidationErrorInput,\n ValidationErrorOptions,\n} from \"@inertia-node/core\";\n\nfunction inertiaDecorator(\n component: string,\n options: NestFastifyRenderOptions = {},\n): MethodDecorator {\n return (target, propertyKey, descriptor) => {\n SetMetadata(INERTIA_COMPONENT_METADATA, component)(\n target,\n propertyKey,\n descriptor,\n );\n SetMetadata(INERTIA_RENDER_OPTIONS_METADATA, options)(\n target,\n propertyKey,\n descriptor,\n );\n };\n}\n\nexport const Inertia = Object.assign(inertiaDecorator, {\n render(\n component: string,\n props: InputProps = {},\n options: NestFastifyRenderOptions = {},\n ): InertiaRenderResult {\n return {\n __inertiaNestFastify: \"render\",\n component,\n props,\n options,\n };\n },\n\n redirect(location: string, status?: number): InertiaRedirectResult {\n return {\n __inertiaNestFastify: \"redirect\",\n location,\n status,\n };\n },\n\n location(location: string): InertiaLocationResult {\n return {\n __inertiaNestFastify: \"location\",\n location,\n };\n },\n\n backWithErrors(\n errors: ValidationErrorInput,\n options: ValidationErrorOptions = {},\n ): InertiaBackWithErrorsResult {\n return {\n __inertiaNestFastify: \"backWithErrors\",\n errors,\n options,\n };\n },\n});\n\nexport function InertiaRenderOptions(\n options: NestFastifyRenderOptions,\n): MethodDecorator {\n return SetMetadata(INERTIA_RENDER_OPTIONS_METADATA, options);\n}\n\nexport function isInertiaControllerResult(\n value: unknown,\n): value is\n | InertiaRenderResult\n | InertiaRedirectResult\n | InertiaLocationResult\n | InertiaBackWithErrorsResult {\n return (\n typeof value === \"object\" &&\n value !== null &&\n \"__inertiaNestFastify\" in value &&\n typeof (value as { __inertiaNestFastify?: unknown })\n .__inertiaNestFastify === \"string\"\n );\n}\n","export const INERTIA_MODULE_OPTIONS = Symbol(\"INERTIA_MODULE_OPTIONS\");\nexport const INERTIA_COMPONENT_METADATA = \"inertia-node-fastify:component\";\nexport const INERTIA_RENDER_OPTIONS_METADATA =\n \"inertia-node-fastify:render-options\";\n","import {\n CanActivate,\n ExecutionContext,\n Inject,\n Injectable,\n} from \"@nestjs/common\";\nimport type { FastifyReply, FastifyRequest } from \"fastify\";\nimport { INERTIA_MODULE_OPTIONS } from \"./constants.js\";\nimport { prepareInertiaRequest } from \"./runtime.js\";\nimport type { NestFastifyInertiaOptions } from \"./types.js\";\n\n@Injectable()\nexport class InertiaAuthGuard implements CanActivate {\n constructor(\n @Inject(INERTIA_MODULE_OPTIONS)\n private readonly options: NestFastifyInertiaOptions,\n ) {}\n\n async canActivate(context: ExecutionContext): Promise<boolean> {\n const request = context.switchToHttp().getRequest<FastifyRequest>();\n const reply = context.switchToHttp().getResponse<FastifyReply>();\n prepareInertiaRequest(request, this.options);\n\n if (request.auth && (await request.auth.check())) {\n request.user = await request.auth.user();\n return true;\n }\n\n reply.code(303).redirect(this.options.auth?.redirectTo ?? \"/login\");\n return false;\n }\n}\n\n@Injectable()\nexport class InertiaGuestGuard implements CanActivate {\n constructor(\n @Inject(INERTIA_MODULE_OPTIONS)\n private readonly options: NestFastifyInertiaOptions,\n ) {}\n\n async canActivate(context: ExecutionContext): Promise<boolean> {\n const request = context.switchToHttp().getRequest<FastifyRequest>();\n const reply = context.switchToHttp().getResponse<FastifyReply>();\n prepareInertiaRequest(request, this.options);\n\n if (request.auth && (await request.auth.check())) {\n reply.code(303).redirect(this.options.auth?.home ?? \"/dashboard\");\n return false;\n }\n\n return true;\n }\n}\n","import {\n always,\n validationError,\n type AuthConfig,\n type AuthRuntime,\n type InertiaRequest,\n type InputProps,\n type ProtocolResponse,\n type SessionStore,\n type ValidationErrorInput,\n type ValidationErrorPayload,\n} from \"@inertia-node/core\";\nimport type { FastifyReply, FastifyRequest } from \"fastify\";\nimport type { NestFastifyInertiaOptions } from \"./types.js\";\n\nexport type NestFastifyInertiaRequest<User = unknown> = FastifyRequest & {\n user?: User;\n auth?: AuthRuntime<User>;\n flash(key: string, value: unknown): Promise<void>;\n};\n\ndeclare module \"fastify\" {\n interface FastifyRequest {\n user?: unknown;\n auth?: AuthRuntime<unknown>;\n flash(key: string, value: unknown): Promise<void>;\n }\n}\n\nexport function prepareInertiaRequest(\n request: FastifyRequest,\n options: NestFastifyInertiaOptions,\n): SessionStore | undefined {\n const sessionStore = options.session?.(request);\n const inertiaRequest = request as NestFastifyInertiaRequest;\n\n inertiaRequest.flash = async (key: string, value: unknown) => {\n await sessionStore?.flash(\"flash\", {\n ...((await sessionStore.get<Record<string, unknown>>(\"flash\")) ?? {}),\n [key]: value,\n });\n };\n\n if (options.auth && !inertiaRequest.auth) {\n installAuth(inertiaRequest, options.auth);\n }\n\n return sessionStore;\n}\n\nexport function sendProtocolResponse(\n request: FastifyRequest,\n reply: FastifyReply,\n sessionStore: SessionStore | undefined,\n protocol: ProtocolResponse,\n): void {\n if (protocol.status === 409) {\n void sessionStore?.reflash();\n void (\n request as FastifyRequest & { session?: { save?: () => unknown } }\n ).session?.save?.();\n }\n\n reply.code(protocol.status);\n\n for (const [name, value] of Object.entries(protocol.headers)) {\n reply.header(name, value);\n }\n\n reply.send(protocol.body);\n}\n\nexport function toInertiaRequest(request: FastifyRequest): InertiaRequest {\n const host = request.headers.host;\n\n return {\n headers: request.headers,\n method: request.method,\n url: request.url,\n originalUrl: request.url,\n host: Array.isArray(host) ? host[0] : host,\n raw: request,\n };\n}\n\nexport async function resolveUserShare(\n options: NestFastifyInertiaOptions,\n context: { request: InertiaRequest },\n): Promise<InputProps> {\n const request = context.request.raw as FastifyRequest | undefined;\n\n if (!request || !options.auth) {\n return {};\n }\n\n prepareInertiaRequest(request, options);\n\n return {\n auth: always({\n user: await request.auth?.serializedUser(),\n }),\n };\n}\n\nexport async function flashErrors(\n session: SessionStore,\n payload: ValidationErrorPayload,\n withAllErrors = false,\n): Promise<void> {\n const normalized = normalizeErrors(payload.errors, withAllErrors);\n\n if (payload.bag) {\n await session.flash(\"errors\", {\n [payload.bag]: normalized,\n });\n return;\n }\n\n await session.flash(\"errors\", normalized);\n}\n\nexport async function pullErrors(\n session: SessionStore,\n request?: FastifyRequest,\n withAllErrors = false,\n): Promise<Record<string, unknown>> {\n const errors = await session.pull<ValidationErrorInput>(\"errors\");\n\n if (!errors) {\n return {};\n }\n\n const bag =\n typeof request?.headers[\"x-inertia-error-bag\"] === \"string\"\n ? request.headers[\"x-inertia-error-bag\"]\n : undefined;\n\n if (bag && bag in errors) {\n return {\n [bag]: normalizeErrors(\n errors[bag] as unknown as ValidationErrorInput,\n withAllErrors,\n ),\n };\n }\n\n return normalizeErrors(errors, withAllErrors);\n}\n\nexport function validationPayloadForRequest(\n request: FastifyRequest,\n errors: ValidationErrorInput,\n options: { bag?: string } = {},\n): ValidationErrorPayload {\n return validationError(errors, {\n bag:\n options.bag ??\n (typeof request.headers[\"x-inertia-error-bag\"] === \"string\"\n ? request.headers[\"x-inertia-error-bag\"]\n : undefined),\n });\n}\n\nfunction installAuth<User, Serialized>(\n request: NestFastifyInertiaRequest<User>,\n config: AuthConfig<FastifyRequest, User, Serialized>,\n): void {\n let loaded = false;\n let cachedUser: User | null = null;\n\n async function user(): Promise<User | null> {\n if (!loaded) {\n cachedUser = await config.getUser(request);\n loaded = true;\n request.user = cachedUser ?? undefined;\n }\n\n return cachedUser;\n }\n\n const runtime = {\n user,\n check: async () => (await user()) !== null,\n login: async (loginUser: User) => {\n await config.login(request, loginUser);\n cachedUser = loginUser;\n loaded = true;\n request.user = loginUser;\n },\n logout: async () => {\n await config.logout(request);\n cachedUser = null;\n loaded = true;\n request.user = undefined;\n },\n serializedUser: async () => {\n const currentUser = await user();\n\n if (!currentUser) {\n return null;\n }\n\n return config.serializeUser\n ? await config.serializeUser(currentUser)\n : (currentUser as unknown as Serialized);\n },\n } satisfies AuthRuntime<User, Serialized>;\n\n (request as FastifyRequest & { auth?: AuthRuntime<User, Serialized> }).auth =\n runtime;\n}\n\nfunction normalizeErrors(\n errors: ValidationErrorInput,\n withAllErrors: boolean,\n): Record<string, string | string[]> {\n const normalized: Record<string, string | string[]> = {};\n\n for (const [field, value] of Object.entries(errors)) {\n const messages = Array.isArray(value)\n ? value.flat().map(String)\n : [String(value)];\n normalized[field] = withAllErrors ? messages : (messages[0] ?? \"\");\n }\n\n return normalized;\n}\n","import {\n CallHandler,\n ExecutionContext,\n Inject,\n Injectable,\n NestInterceptor,\n} from \"@nestjs/common\";\nimport { Reflector } from \"@nestjs/core\";\nimport {\n always,\n createInertia,\n type InertiaInstance,\n type InputProps,\n type SessionStore,\n} from \"@inertia-node/core\";\nimport type { FastifyReply, FastifyRequest } from \"fastify\";\nimport { mergeMap, type Observable } from \"rxjs\";\nimport {\n INERTIA_COMPONENT_METADATA,\n INERTIA_MODULE_OPTIONS,\n INERTIA_RENDER_OPTIONS_METADATA,\n} from \"./constants.js\";\nimport { isInertiaControllerResult } from \"./decorators.js\";\nimport {\n flashErrors,\n prepareInertiaRequest,\n pullErrors,\n resolveUserShare,\n sendProtocolResponse,\n toInertiaRequest,\n validationPayloadForRequest,\n} from \"./runtime.js\";\nimport type {\n InertiaBackWithErrorsResult,\n InertiaLocationResult,\n InertiaRedirectResult,\n InertiaRenderResult,\n NestFastifyInertiaOptions,\n NestFastifyRenderOptions,\n} from \"./types.js\";\n\n@Injectable()\nexport class InertiaInterceptor implements NestInterceptor {\n private readonly inertia: InertiaInstance;\n\n constructor(\n @Inject(INERTIA_MODULE_OPTIONS)\n private readonly options: NestFastifyInertiaOptions,\n @Inject(Reflector)\n private readonly reflector: Reflector,\n ) {\n this.inertia =\n options.instance ??\n createInertia({\n ...options,\n share: async (context) => {\n const request = context.request.raw as FastifyRequest | undefined;\n const sessionStore = request ? options.session?.(request) : undefined;\n const userShare = await resolveUserShare(options, context);\n const baseShare =\n typeof options.share === \"function\"\n ? await options.share(context)\n : (options.share ?? {});\n\n return {\n errors: always(\n sessionStore\n ? await pullErrors(sessionStore, request, options.withAllErrors)\n : {},\n ),\n flash: always(\n sessionStore ? ((await sessionStore.pull(\"flash\")) ?? {}) : {},\n ),\n ...userShare,\n ...baseShare,\n };\n },\n });\n }\n\n intercept(context: ExecutionContext, next: CallHandler): Observable<unknown> {\n const request = context.switchToHttp().getRequest<FastifyRequest>();\n prepareInertiaRequest(request, this.options);\n\n return next.handle().pipe(\n mergeMap(async (result: unknown) => {\n const handled = await this.handleResult(context, result);\n return handled.handled ? undefined : result;\n }),\n );\n }\n\n private async handleResult(\n context: ExecutionContext,\n result: unknown,\n ): Promise<{ handled: boolean }> {\n const http = context.switchToHttp();\n const request = http.getRequest<FastifyRequest>();\n const reply = http.getResponse<FastifyReply>();\n const sessionStore = prepareInertiaRequest(request, this.options);\n\n if (isInertiaControllerResult(result)) {\n switch (result.__inertiaNestFastify) {\n case \"render\":\n await this.sendRender(request, reply, sessionStore, result);\n return { handled: true };\n case \"redirect\":\n this.sendRedirect(request, reply, sessionStore, result);\n return { handled: true };\n case \"location\":\n this.sendLocation(reply, result);\n return { handled: true };\n case \"backWithErrors\":\n await this.sendBackWithErrors(request, reply, sessionStore, result);\n return { handled: true };\n }\n }\n\n const component = this.reflector.get<string>(\n INERTIA_COMPONENT_METADATA,\n context.getHandler(),\n );\n\n if (!component) {\n return { handled: false };\n }\n\n const decoratorOptions =\n this.reflector.get<NestFastifyRenderOptions>(\n INERTIA_RENDER_OPTIONS_METADATA,\n context.getHandler(),\n ) ?? {};\n\n const props =\n result && typeof result === \"object\" && !Array.isArray(result)\n ? (result as InputProps)\n : {};\n\n await this.sendRender(request, reply, sessionStore, {\n __inertiaNestFastify: \"render\",\n component,\n props,\n options: decoratorOptions,\n });\n\n return { handled: true };\n }\n\n private async sendRender(\n request: FastifyRequest,\n reply: FastifyReply,\n sessionStore: SessionStore | undefined,\n result: InertiaRenderResult,\n ): Promise<void> {\n sendProtocolResponse(\n request,\n reply,\n sessionStore,\n await this.inertia.render(\n toInertiaRequest(request),\n result.component,\n result.props,\n result.options,\n ),\n );\n }\n\n private sendRedirect(\n request: FastifyRequest,\n reply: FastifyReply,\n sessionStore: SessionStore | undefined,\n result: InertiaRedirectResult,\n ): void {\n sendProtocolResponse(\n request,\n reply,\n sessionStore,\n this.inertia.redirect(\n toInertiaRequest(request),\n result.location,\n result.status,\n ),\n );\n }\n\n private sendLocation(\n reply: FastifyReply,\n result: InertiaLocationResult,\n ): void {\n sendProtocolResponse(\n reply.request,\n reply,\n undefined,\n this.inertia.location(result.location),\n );\n }\n\n private async sendBackWithErrors(\n request: FastifyRequest,\n reply: FastifyReply,\n sessionStore: SessionStore | undefined,\n result: InertiaBackWithErrorsResult,\n ): Promise<void> {\n if (!sessionStore) {\n throw new Error(\"backWithErrors requires a configured session adapter\");\n }\n\n await flashErrors(\n sessionStore,\n validationPayloadForRequest(request, result.errors, result.options),\n this.options.withAllErrors,\n );\n\n this.sendRedirect(request, reply, sessionStore, {\n __inertiaNestFastify: \"redirect\",\n location:\n firstHeader(request.headers.referrer) ??\n firstHeader(request.headers.referer) ??\n \"/\",\n });\n }\n}\n\nfunction firstHeader(value: string | string[] | undefined): string | undefined {\n return Array.isArray(value) ? value[0] : value;\n}\n","import { DynamicModule, Module, Provider, type Type } from \"@nestjs/common\";\nimport { INERTIA_MODULE_OPTIONS } from \"./constants.js\";\nimport { InertiaAuthGuard, InertiaGuestGuard } from \"./guards.js\";\nimport { InertiaInterceptor } from \"./interceptor.js\";\nimport { InertiaService } from \"./service.js\";\nimport type {\n NestFastifyInertiaAsyncOptions,\n NestFastifyInertiaOptions,\n NestFastifyInertiaOptionsFactory,\n} from \"./types.js\";\n\n@Module({})\nexport class InertiaModule {\n static forRoot(options: NestFastifyInertiaOptions = {}): DynamicModule {\n return {\n module: InertiaModule,\n providers: [\n { provide: INERTIA_MODULE_OPTIONS, useValue: options },\n InertiaService,\n InertiaInterceptor,\n InertiaAuthGuard,\n InertiaGuestGuard,\n ],\n exports: [\n INERTIA_MODULE_OPTIONS,\n InertiaService,\n InertiaInterceptor,\n InertiaAuthGuard,\n InertiaGuestGuard,\n ],\n };\n }\n\n static forRootAsync(options: NestFastifyInertiaAsyncOptions): DynamicModule {\n return {\n module: InertiaModule,\n imports: options.imports,\n providers: [\n ...createAsyncProviders(options),\n InertiaService,\n InertiaInterceptor,\n InertiaAuthGuard,\n InertiaGuestGuard,\n ],\n exports: [\n INERTIA_MODULE_OPTIONS,\n InertiaService,\n InertiaInterceptor,\n InertiaAuthGuard,\n InertiaGuestGuard,\n ],\n };\n }\n}\n\nfunction createAsyncProviders(\n options: NestFastifyInertiaAsyncOptions,\n): Provider[] {\n if (options.useFactory) {\n return [\n {\n provide: INERTIA_MODULE_OPTIONS,\n useFactory: options.useFactory,\n inject: options.inject ?? [],\n },\n ];\n }\n\n const useClass = options.useClass ?? options.useExisting;\n\n if (!useClass) {\n throw new Error(\n \"InertiaModule.forRootAsync requires useFactory, useClass, or useExisting.\",\n );\n }\n\n const providers: Provider[] = [\n {\n provide: INERTIA_MODULE_OPTIONS,\n useFactory: async (factory: NestFastifyInertiaOptionsFactory) =>\n factory.createInertiaOptions(),\n inject: [useClass],\n },\n ];\n\n if (options.useClass) {\n providers.push({\n provide: useClass,\n useClass: useClass as Type<NestFastifyInertiaOptionsFactory>,\n });\n }\n\n return providers;\n}\n","import { Inject, Injectable } from \"@nestjs/common\";\nimport type {\n InputProps,\n ValidationErrorInput,\n ValidationErrorOptions,\n} from \"@inertia-node/core\";\nimport { INERTIA_MODULE_OPTIONS } from \"./constants.js\";\nimport { Inertia } from \"./decorators.js\";\nimport type {\n NestFastifyInertiaOptions,\n NestFastifyRenderOptions,\n} from \"./types.js\";\n\n@Injectable()\nexport class InertiaService {\n constructor(\n @Inject(INERTIA_MODULE_OPTIONS)\n readonly options: NestFastifyInertiaOptions,\n ) {}\n\n render(\n component: string,\n props: InputProps = {},\n options: NestFastifyRenderOptions = {},\n ) {\n return Inertia.render(component, props, options);\n }\n\n redirect(location: string, status?: number) {\n return Inertia.redirect(location, status);\n }\n\n location(location: string) {\n return Inertia.location(location);\n }\n\n backWithErrors(\n errors: ValidationErrorInput,\n options: ValidationErrorOptions = {},\n ) {\n return Inertia.backWithErrors(errors, options);\n }\n}\n","import type { SessionStore } from \"@inertia-node/core\";\nimport type { FastifyRequest } from \"fastify\";\n\ninterface FastifySessionLike {\n get<T = unknown>(key: string): T | undefined;\n set<T = unknown>(key: string, value: T): void;\n delete?(key: string): void;\n save?(callback?: (error?: unknown) => void): Promise<void> | void;\n}\n\nexport function fastifySessionAdapter(): (\n request: FastifyRequest,\n) => SessionStore | undefined {\n return (request: FastifyRequest) => {\n const session = (\n request as FastifyRequest & { session?: FastifySessionLike }\n ).session;\n\n if (!session) {\n return undefined;\n }\n\n return {\n get: <T = unknown>(key: string) => session.get<T>(key),\n set: <T = unknown>(key: string, value: T) => {\n session.set(key, value);\n },\n pull: <T = unknown>(key: string) => {\n const value = session.get<T>(key);\n\n if (session.delete) {\n session.delete(key);\n } else {\n session.set(key, undefined);\n }\n\n return value;\n },\n flash: <T = unknown>(key: string, value: T) => {\n session.set(key, value);\n },\n reflash: () => {\n // @fastify/session keeps values until explicitly pulled.\n },\n };\n };\n}\n","export { Inertia, InertiaRenderOptions } from \"./decorators.js\";\nexport { InertiaAuthGuard, InertiaGuestGuard } from \"./guards.js\";\nexport { InertiaInterceptor } from \"./interceptor.js\";\nexport { InertiaModule } from \"./module.js\";\nexport { fastifySessionAdapter } from \"./session.js\";\nexport { InertiaService } from \"./service.js\";\nexport type {\n InertiaBackWithErrorsResult,\n InertiaControllerResult,\n InertiaLocationResult,\n InertiaRedirectResult,\n InertiaRenderResult,\n NestFastifyInertiaAsyncOptions,\n NestFastifyInertiaOptions,\n NestFastifyInertiaOptionsFactory,\n NestFastifyRenderOptions,\n} from \"./types.js\";\nexport type { NestFastifyInertiaRequest } from \"./runtime.js\";\nexport {\n always,\n createInertia,\n defer,\n inertiaAuth,\n merge,\n optional,\n validationError,\n} from \"@inertia-node/core\";\nexport type {\n AuthConfig,\n AuthRuntime,\n CreateInertiaOptions,\n InertiaInstance,\n InputProps,\n ProtocolResponse,\n RenderOptions,\n SessionStore,\n ValidationErrorInput,\n ValidationErrorOptions,\n ValidationErrorPayload,\n} from \"@inertia-node/core\";\n"],"mappings":";;;;;;;;;;;;;AAAA,SAAS,mBAAmB;;;ACArB,IAAM,yBAAyB,uBAAO,wBAAwB;AAC9D,IAAM,6BAA6B;AACnC,IAAM,kCACX;;;ADeF,SAAS,iBACP,WACA,UAAoC,CAAC,GACpB;AACjB,SAAO,CAAC,QAAQ,aAAa,eAAe;AAC1C,gBAAY,4BAA4B,SAAS;AAAA,MAC/C;AAAA,MACA;AAAA,MACA;AAAA,IACF;AACA,gBAAY,iCAAiC,OAAO;AAAA,MAClD;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,EACF;AACF;AAEO,IAAM,UAAU,OAAO,OAAO,kBAAkB;AAAA,EACrD,OACE,WACA,QAAoB,CAAC,GACrB,UAAoC,CAAC,GAChB;AACrB,WAAO;AAAA,MACL,sBAAsB;AAAA,MACtB;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,EACF;AAAA,EAEA,SAAS,UAAkB,QAAwC;AACjE,WAAO;AAAA,MACL,sBAAsB;AAAA,MACtB;AAAA,MACA;AAAA,IACF;AAAA,EACF;AAAA,EAEA,SAAS,UAAyC;AAChD,WAAO;AAAA,MACL,sBAAsB;AAAA,MACtB;AAAA,IACF;AAAA,EACF;AAAA,EAEA,eACE,QACA,UAAkC,CAAC,GACN;AAC7B,WAAO;AAAA,MACL,sBAAsB;AAAA,MACtB;AAAA,MACA;AAAA,IACF;AAAA,EACF;AACF,CAAC;AAEM,SAAS,qBACd,SACiB;AACjB,SAAO,YAAY,iCAAiC,OAAO;AAC7D;AAEO,SAAS,0BACd,OAK8B;AAC9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,MACA,MAAM,CAAc,QAAgB;AAClC,cAAM,QAAQ,QAAQ,IAAO,GAAG;AAEhC,YAAI,QAAQ,QAAQ;AAClB,kBAAQ,OAAO,GAAG;AAAA,QACpB,OAAO;AACL,kBAAQ,IAAI,KAAK,MAAS;AAAA,QAC5B;AAEA,eAAO;AAAA,MACT;AAAA,MACA,OAAO,CAAc,KAAa,UAAa;AAC7C,gBAAQ,IAAI,KAAK,KAAK;AAAA,MACxB;AAAA,MACA,SAAS,MAAM;AAAA,MAEf;AAAA,IACF;AAAA,EACF;AACF;;;AC5BA;AAAA,EACE,UAAAC;AAAA,EACA,iBAAAC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,mBAAAC;AAAA,OACK;","names":["Inject","Injectable","always","always","Injectable","Inject","Inject","Injectable","Injectable","Inject","always","createInertia","validationError"]}
package/package.json ADDED
@@ -0,0 +1,69 @@
1
+ {
2
+ "name": "@inertia-node/nest-fastify",
3
+ "version": "0.1.0",
4
+ "description": "NestJS Fastify adapter for Inertia.js on Node.js.",
5
+ "license": "MIT",
6
+ "author": "Inertia Node Adapter contributors",
7
+ "type": "module",
8
+ "repository": {
9
+ "type": "git",
10
+ "url": "https://github.com/inertia-node/inertia-node-adapter.git",
11
+ "directory": "packages/nest-fastify"
12
+ },
13
+ "homepage": "https://github.com/inertia-node/inertia-node-adapter#readme",
14
+ "bugs": {
15
+ "url": "https://github.com/inertia-node/inertia-node-adapter/issues"
16
+ },
17
+ "keywords": [
18
+ "inertia",
19
+ "inertiajs",
20
+ "nestjs",
21
+ "fastify",
22
+ "node",
23
+ "react",
24
+ "typescript"
25
+ ],
26
+ "publishConfig": {
27
+ "access": "public"
28
+ },
29
+ "exports": {
30
+ ".": {
31
+ "types": "./dist/index.d.ts",
32
+ "import": "./dist/index.js"
33
+ }
34
+ },
35
+ "files": [
36
+ "dist"
37
+ ],
38
+ "dependencies": {
39
+ "@inertia-node/core": "0.1.0"
40
+ },
41
+ "peerDependencies": {
42
+ "@nestjs/common": ">=10 <12",
43
+ "@nestjs/core": ">=10 <12",
44
+ "@nestjs/platform-fastify": ">=10 <12",
45
+ "fastify": ">=4 <6",
46
+ "reflect-metadata": ">=0.1 <1",
47
+ "rxjs": ">=7 <8"
48
+ },
49
+ "devDependencies": {
50
+ "@fastify/cookie": "^11.0.2",
51
+ "@fastify/session": "^11.1.1",
52
+ "@nestjs/common": "^11.1.9",
53
+ "@nestjs/core": "^11.1.9",
54
+ "@nestjs/platform-fastify": "^11.1.9",
55
+ "@nestjs/testing": "^11.1.9",
56
+ "@types/node": "^24.10.1",
57
+ "fastify": "^5.6.2",
58
+ "light-my-request": "^6.6.0",
59
+ "reflect-metadata": "^0.2.2",
60
+ "rxjs": "^7.8.2"
61
+ },
62
+ "engines": {
63
+ "node": ">=20"
64
+ },
65
+ "scripts": {
66
+ "build": "tsup src/index.ts --format esm --dts --sourcemap",
67
+ "clean": "rm -rf dist"
68
+ }
69
+ }