28 lines
1.1 KiB
TypeScript
28 lines
1.1 KiB
TypeScript
/**
|
|
* ServiceRegistry module augmentation — declares the `searchIndexes`
|
|
* slot on `@suaveplan/api-plugin/service-registry`'s `ServiceRegistry`
|
|
* interface so downstream plugins typed against the augmented registry
|
|
* see `ctx.getService("searchIndexes")` resolve to
|
|
* `Map<string, SearchIndex> | undefined` without any cast.
|
|
*
|
|
* Importing this module for its side effects (which the package root
|
|
* barrel does automatically) is sufficient — every consumer of
|
|
* `@suaveplan/api-plugin-search` gets typed `searchIndexes` access.
|
|
*
|
|
* The host-side slot `app` is owned by `@suaveplan/api`'s own
|
|
* registry-augmentation module. We re-declare it here as a
|
|
* cumulative augmentation so the search plugin's `onInit(ctx)` can
|
|
* resolve it with full typing even when the consumer has not
|
|
* explicitly imported `@suaveplan/api`. TypeScript merges duplicate
|
|
* declarations.
|
|
*/
|
|
import type { OpenAPIHono } from "@hono/zod-openapi";
|
|
import type { SearchIndex } from "../types/types.js";
|
|
|
|
declare module "@suaveplan/api-plugin/service-registry" {
|
|
interface ServiceRegistry {
|
|
searchIndexes: Map<string, SearchIndex>;
|
|
app: OpenAPIHono;
|
|
}
|
|
}
|