File tree Expand file tree Collapse file tree
packages/foundation/types/src Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -169,6 +169,15 @@ export interface BaseDriverConfig {
169169// Driver Interface
170170// ============================================================================
171171
172+ /**
173+ * Database driver interface. All storage backends implement this contract.
174+ *
175+ * Type strategy:
176+ * - `Record<string, unknown>` for data payloads (plain field-value maps)
177+ * - `object` for query/filter/command parameters that may receive named interfaces
178+ * (e.g., UnifiedQuery, Filter) which lack implicit index signatures
179+ * - `unknown` for opaque values (transaction handles, heterogeneous returns)
180+ */
172181export interface Driver {
173182 /** Driver identifier (e.g., 'memory', 'sql', 'mongo') */
174183 readonly name ?: string ;
Original file line number Diff line number Diff line change @@ -61,7 +61,11 @@ export interface BaseHookContext<_T = Record<string, unknown>> {
6161export interface RetrievalHookContext < T = Record < string , unknown > > extends BaseHookContext < T > {
6262 operation : 'find' | 'count' ;
6363
64- /** The query criteria being executed. Modifiable in 'before' hooks. */
64+ /**
65+ * The query criteria being executed. Modifiable in 'before' hooks.
66+ * Typed as `object` (not `Record<string, unknown>`) because named interfaces
67+ * like UnifiedQuery lack index signatures and aren't assignable to Record types.
68+ */
6569 query : object ;
6670
6771 /** The result of the query. Only available in 'after' hooks. */
Original file line number Diff line number Diff line change 88
99import { UnifiedQuery , Filter } from "./query" ;
1010
11+ /**
12+ * Repository interface for CRUD operations on a single object type.
13+ *
14+ * Note: `object` is used for filter/query parameters instead of `Record<string, unknown>`
15+ * because named TypeScript interfaces (e.g., UnifiedQuery, Filter) lack implicit index
16+ * signatures and are not assignable to `Record<string, unknown>`.
17+ *
18+ * @typeParam T - The document shape returned by queries. Defaults to `Record<string, unknown>`.
19+ */
1120export interface IObjectRepository < T = Record < string , unknown > > {
1221 find ( query ?: UnifiedQuery ) : Promise < T [ ] > ;
1322 findOne ( idOrQuery : string | number | UnifiedQuery ) : Promise < T | null > ;
You can’t perform that action at this time.
0 commit comments