Initial Commit
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
/**
|
||||
* ServiceRegistry module augmentation — registers the three slots the
|
||||
* site plugin owns on `@suaveplan/api-plugin/service-registry`'s
|
||||
* `ServiceRegistry` interface so downstream plugins get fully-typed
|
||||
* `ctx.getService("siteService")` lookups.
|
||||
*
|
||||
* Importing this module for its side effects (which the package root
|
||||
* barrel does automatically) is sufficient.
|
||||
*
|
||||
* Host-side slots (`app`, `db`) are owned by `@suaveplan/api` /
|
||||
* `@suaveplan/api-plugin-database`'s own augmentations. They are
|
||||
* re-declared here as a cumulative augmentation so the site plugin's
|
||||
* `onInit(ctx)` can resolve them with full typing even when the
|
||||
* consumer has not explicitly imported the upstream plugin.
|
||||
*/
|
||||
import type { OpenAPIHono } from "@hono/zod-openapi";
|
||||
import type { SurrealAdapter } from "@suaveplan/surrealdb";
|
||||
import type { DomainResolverMiddleware } from "../middleware/domain-resolver.js";
|
||||
import type { DomainResolverService } from "../service/domain-resolver.js";
|
||||
import type { SiteService } from "../service/site.js";
|
||||
|
||||
declare module "@suaveplan/api-plugin/service-registry" {
|
||||
interface ServiceRegistry {
|
||||
siteService: SiteService;
|
||||
domainResolver: DomainResolverService;
|
||||
domainResolverMiddleware: DomainResolverMiddleware;
|
||||
app: OpenAPIHono;
|
||||
db: SurrealAdapter;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user