- Add #domain, #protocol, #utils aliases to package.json imports map - Replace all relative imports (./, ../, ../..) in app/ and database/mongo_migrations/ with the corresponding #alias imports, eliminating relative path traversal across the codebase - Remove dead code: ConfigurationVersionModel.findByConfigurationIdentifier (unused, superseded by paginateVersions) and unused exception classes (NotFoundException, UnprocessableEntityException, DatabaseException) from app/exceptions/index.ts, keeping only BadRequestException - Fix pre-existing syntax error in configuration_version.ts (mismatched parenthesis) that broke tsc - Fix eqeqeq violation in configuration_service.ts and isNaN -> Number.isNaN in configuration_engine.ts / cwmp-1-0.ts / exchange_controller.ts - Fix no-shadow violation in cwmp-1-0.ts EventStruct constructor - Prettier formatting pass on touched files Validated: tsc --noEmit clean, eslint app/ clean, full test suite green.
31 lines
996 B
TypeScript
31 lines
996 B
TypeScript
import BaseInertiaMiddleware from '@adonisjs/inertia/inertia_middleware'
|
|
import type { HttpContext } from '@adonisjs/core/http'
|
|
import type { NextFn } from '@adonisjs/core/types/http'
|
|
|
|
export default class InertiaMiddleware extends BaseInertiaMiddleware {
|
|
/**
|
|
* Implements BaseInertiaMiddleware's abstract `share` method.
|
|
* Invoked internally by @adonisjs/inertia — not called directly from this codebase.
|
|
*/
|
|
async share(ctx: HttpContext) {
|
|
return {
|
|
errors: ctx.session?.flashMessages.get('errors'),
|
|
auth: {
|
|
username: ctx.session?.get('username') ?? null,
|
|
authenticated: ctx.session?.get('authenticated') ?? false,
|
|
},
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Standard AdonisJS middleware entrypoint.
|
|
* Invoked dynamically by AdonisJS via the named middleware loader in start/kernel.ts —
|
|
* not called directly from this codebase.
|
|
*/
|
|
async handle(ctx: HttpContext, next: NextFn) {
|
|
await this.init(ctx)
|
|
await next()
|
|
this.dispose(ctx)
|
|
}
|
|
}
|