@devries-cameron20 / t3code Mirror · read-only
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

Mirrored from https://github.com/Camo67/t3code.git

Synced Nov 21, 06:00 UTC

main
ts 34 lines 1.12 KB
Raw
1 import type { SchemaOptions } from "./Schema.ts";
2
3 /** Optional outputs alongside Prisma's canonical contract artifacts. */
4 export interface EffectGeneratorOptions extends SchemaOptions {
5 /** Emit the contract-bound Effect client factory. Defaults to true. */
6 readonly client?: boolean;
7 /** Emit standalone Effect row schemas. Defaults to true. */
8 readonly schemas?: boolean;
9 }
10
11 export const effectGeneratorKey = Symbol.for("alchemy/Prisma/ORM/generator");
12
13 /**
14 * Attach Effect generation to the ORM section of a Prisma configuration.
15 * Run `alchemy provider prisma generate --config ./prisma.config.ts` to emit outputs.
16 * Native Prisma commands continue to work and do not run this generator.
17 *
18 * ```typescript
19 * export default definePrismaConfig({
20 * orm: withEffect(ormConfig({ contract: "./contract.psl", output: "./generated" }), {
21 * client: true,
22 * schemas: true,
23 * }),
24 * });
25 * ```
26 */
27 export function withEffect<C extends object>(
28 config: C,
29 options: EffectGeneratorOptions = {},
30 ): C & {
31 readonly [effectGeneratorKey]: EffectGeneratorOptions;
32 } {
33 return { ...config, [effectGeneratorKey]: options };
34 }