- Add ReadOnly<F> phantom brand to core-shared/conformance (compile-time enforcement that readers only wrap non-mutating use cases) - Add isReadOnly runtime predicate for boot-time assertReaderPurity - Scaffold pnpm turbo gen reader: creates integrations/readers/ with interface, implementation, test, barrel, and adds ./reader export subpath to package.json
26 lines
858 B
Handlebars
26 lines
858 B
Handlebars
// packages/{{kebabCase feature}}/src/integrations/readers/{{kebabCase feature}}.reader.ts
|
|
|
|
import type { I{{pascalCase feature}}Reader } from "./{{kebabCase feature}}.reader.interface";
|
|
|
|
/**
|
|
* Internal implementation of I{{pascalCase feature}}Reader.
|
|
* Wraps existing use cases — does not add domain logic.
|
|
* Constructed by bind-production / bind-dev-seed; never exported.
|
|
*
|
|
* All injected use cases MUST be ReadOnly-branded (mutates: false).
|
|
*/
|
|
export class {{pascalCase feature}}Reader implements I{{pascalCase feature}}Reader {
|
|
// Inject ReadOnly-branded use cases via constructor:
|
|
//
|
|
// constructor(
|
|
// private getUser: ReadOnly<IGetUserUseCase>,
|
|
// ) {}
|
|
//
|
|
// Then delegate:
|
|
//
|
|
// async exists(userId: string): Promise<boolean> {
|
|
// const user = await this.getUser({ id: userId });
|
|
// return user !== null;
|
|
// }
|
|
}
|