Files
suaveplan/packages/api-stack/api/api-plugin-site/src/services/registry-augmentation.ts
2026-05-27 23:29:53 +01:00

31 lines
1.3 KiB
TypeScript

/**
* 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;
}
}