Files
template-app/apps/web/src/server/stores.ts
T
2026-11-14 09:56:45 +00:00

26 lines
1.2 KiB
TypeScript

// SPDX-License-Identifier: LicenseRef-ConusAI-Template-1.0
// The shape of a one-login store (the mariadb and mongodb profiles, dialect/): what app.ts keeps of it
// and what `/api/ready` asks of it. Types only, so the composition root and the engines meet here.
import type { DataSource, SystemDataSource } from "@conusai-kit/data"
import type { LiveLog } from "@conusai-kit/live-server"
/** A data source of the mariadb or mongodb profile: what the request container and the kit's ports need. */
export type DialectDataSource = DataSource & SystemDataSource & { close(): Promise<void> }
/** The readiness probes of a one-login store (router.ts `/api/ready`): its query and its recorded migrations. */
export interface StoreProbes {
store(): Promise<unknown>
applied(): Promise<ReadonlySet<string>>
/** Resolves once the store is proven usable at boot (MongoDB: a replica set, AT-D15). */
boot(): Promise<void>
}
/** One engine's data source and probes, over the URL of its profile. */
export interface EngineStore {
readonly data: DialectDataSource
readonly probes: StoreProbes
/** The engine's live log (mariadb, mongodb); built once, on the first stream. */
readonly liveLog?: () => LiveLog
}