diff --git a/src/hooks.server.ts b/src/hooks.server.ts index cf156c0..4c99ccb 100644 --- a/src/hooks.server.ts +++ b/src/hooks.server.ts @@ -1,11 +1,11 @@ import { log, timedExecution } from '$lib'; import { validate, v7 as uuidv7 } from 'uuid'; +import type { Handle } from '@sveltejs/kit'; const requestIdHeader = 'x-request-id'; -/** @type {import('@sveltejs/kit').Handle} */ -export async function handle({ event, resolve }) { - // use incomming requestId, if it is a valid uuid, else generate one +export const handle: Handle = async ({ event, resolve }) => { + // use incoming requestId, if it is a valid uuid, else generate one const reqIdFromRequest = event.request.headers.get(requestIdHeader); const { requestId, fromRequest } = reqIdFromRequest && validate(reqIdFromRequest) @@ -20,7 +20,7 @@ export async function handle({ event, resolve }) { clientIP: event.getClientAddress(), }; if (fromRequest) { - log.trace(context, 'using incomming request-id'); + log.trace(context, 'using incoming request-id'); } // make requestId available to handlers @@ -42,4 +42,4 @@ export async function handle({ event, resolve }) { ); return response; -} +};