first commit
This commit is contained in:
46
packages/core/locals.d.ts
vendored
Normal file
46
packages/core/locals.d.ts
vendored
Normal file
@@ -0,0 +1,46 @@
|
||||
/**
|
||||
* EmDash Astro type declarations
|
||||
*
|
||||
* Augments App.Locals with EmDash types.
|
||||
* Referenced via triple-slash directive in the generated emdash-env.d.ts.
|
||||
*/
|
||||
|
||||
import type { User } from "@emdashcms/auth";
|
||||
|
||||
import type { EmDashHandlers, EmDashManifest } from "./dist/types.d.mts";
|
||||
|
||||
declare global {
|
||||
namespace App {
|
||||
interface Locals {
|
||||
/**
|
||||
* EmDash API handlers - available on /_emdash/* routes
|
||||
*/
|
||||
emdash: EmDashHandlers;
|
||||
|
||||
/**
|
||||
* EmDash manifest - the serialized admin configuration
|
||||
*/
|
||||
emdashManifest: EmDashManifest;
|
||||
|
||||
/**
|
||||
* Authenticated user - set by auth middleware when a valid session exists
|
||||
*/
|
||||
user?: User;
|
||||
|
||||
/**
|
||||
* Per-session Durable Object database for playground mode.
|
||||
*
|
||||
* Set by the playground middleware (@emdashcms/cloudflare). Read by
|
||||
* the runtime middleware and request-context middleware to set the
|
||||
* database in ALS for the current request.
|
||||
*
|
||||
* This exists because Vite SSR loads two copies of request-context.ts
|
||||
* (dist for integration middleware, source for the loader). locals
|
||||
* bridges the DB across that module boundary.
|
||||
*/
|
||||
__playgroundDb?: unknown;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export {};
|
||||
Reference in New Issue
Block a user