@trigger.dev/build 4.1.0 → 4.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,51 +1,192 @@
1
1
  import { BuildManifest, BuildTarget } from "@trigger.dev/core/v3";
2
2
  import { BuildContext, BuildExtension } from "@trigger.dev/core/v3/build";
3
- export type PrismaExtensionOptions = {
4
- schema: string;
5
- migrate?: boolean;
6
- version?: string;
7
- /**
8
- * Adds the `--sql` flag to the `prisma generate` command. This will generate the SQL files for the Prisma schema. Requires the `typedSql preview feature and prisma 5.19.0 or later.
9
- */
10
- typedSql?: boolean;
3
+ export type PrismaLegacyModeExtensionOptions = {
11
4
  /**
12
- * The client generator to use. Set this param to prevent all generators in the prisma schema from being generated.
5
+ * Legacy mode configuration for Prisma 5.x/6.x with the `prisma-client-js` provider.
13
6
  *
14
- * @example
7
+ * **Use this mode when:**
8
+ * - Using Prisma 5.x or 6.x with `prisma-client-js` provider
9
+ * - You want automatic `prisma generate` during deployment
10
+ * - You need migration support
15
11
  *
16
- * ### Prisma schema
12
+ * **Key features:**
13
+ * - Automatic client generation
14
+ * - Multi-file schema support (Prisma 6.7+)
15
+ * - Config file support (`prisma.config.ts`)
16
+ * - TypedSQL support
17
+ * - Automatic version detection
18
+ */
19
+ mode: "legacy";
20
+ /**
21
+ * Path to your Prisma schema file or directory.
17
22
  *
18
- * ```prisma
19
- * generator client {
20
- * provider = "prisma-client-js"
21
- * }
23
+ * **Examples:**
24
+ * - Single file: `"./prisma/schema.prisma"`
25
+ * - Multi-file (Prisma 6.7+): `"./prisma"`
22
26
  *
23
- * generator typegraphql {
24
- * provider = "typegraphql-prisma"
25
- * output = "./generated/type-graphql"
26
- * }
27
- * ```
27
+ * **Note:** Either `schema` or `configFile` must be specified, but not both.
28
+ */
29
+ schema?: string;
30
+ /**
31
+ * Path to your Prisma config file (`prisma.config.ts`).
28
32
  *
29
- * ### PrismaExtension
33
+ * Uses `@prisma/config` to automatically extract schema and migrations paths.
34
+ * Requires Prisma 6+ with config file support.
30
35
  *
36
+ * **Example:**
31
37
  * ```ts
32
38
  * prismaExtension({
33
- * schema: "./prisma/schema.prisma",
34
- * clientGenerator: "client"
39
+ * mode: "legacy",
40
+ * configFile: "./prisma.config.ts",
41
+ * migrate: true,
35
42
  * });
36
43
  * ```
44
+ *
45
+ * **Note:** Either `schema` or `configFile` must be specified, but not both.
46
+ */
47
+ configFile?: string;
48
+ /**
49
+ * Enable automatic database migrations during deployment.
50
+ *
51
+ * Runs `prisma migrate deploy` before generating the client.
52
+ * Requires `directUrlEnvVarName` to be set.
53
+ */
54
+ migrate?: boolean;
55
+ /**
56
+ * Override the auto-detected Prisma version.
57
+ *
58
+ * **Auto-detection:** Checks externals, then `@prisma/client` in node_modules, then `prisma` package.
59
+ */
60
+ version?: string;
61
+ /**
62
+ * Enable TypedSQL support. Adds `--sql` flag to `prisma generate`.
63
+ *
64
+ * Requires Prisma 5.19+ and `previewFeatures = ["typedSql"]` in your schema.
65
+ */
66
+ typedSql?: boolean;
67
+ /**
68
+ * Specify which generator to use when you have multiple generators.
69
+ *
70
+ * Adds `--generator=<name>` to only generate the specified generator.
71
+ * Useful for skipping extra generators like `typegraphql-prisma`.
37
72
  */
38
73
  clientGenerator?: string;
74
+ /**
75
+ * Environment variable name for the direct (unpooled) database connection.
76
+ *
77
+ * Required for migrations. Common values: `"DATABASE_URL_UNPOOLED"`, `"DIRECT_URL"`.
78
+ */
39
79
  directUrlEnvVarName?: string;
40
80
  };
41
- export declare function prismaExtension(options: PrismaExtensionOptions): PrismaExtension;
42
- export declare class PrismaExtension implements BuildExtension {
81
+ export type PrismaEngineOnlyModeExtensionOptions = {
82
+ /**
83
+ * Engine-only mode for custom Prisma client output paths.
84
+ *
85
+ * **Use this mode when:**
86
+ * - You're using a custom output path for Prisma Client
87
+ * - You want to control when `prisma generate` runs
88
+ * - You run `prisma generate` in your build pipeline
89
+ *
90
+ * **What it does:**
91
+ * - Installs engine binaries only (no client generation)
92
+ * - Sets `PRISMA_QUERY_ENGINE_LIBRARY` and `PRISMA_QUERY_ENGINE_SCHEMA_ENGINE` env vars
93
+ * - Auto-detects version from filesystem
94
+ *
95
+ * **You must:** Run `prisma generate` yourself and include correct `binaryTargets` in your schema.
96
+ */
97
+ mode: "engine-only";
98
+ /**
99
+ * Prisma version to use. Auto-detected from `@prisma/client` or `prisma` package if omitted.
100
+ *
101
+ * **Recommended:** Specify explicitly for reproducible builds.
102
+ */
103
+ version?: string;
104
+ /**
105
+ * Binary target platform for Prisma engines.
106
+ *
107
+ * **Default:** `"debian-openssl-3.0.x"` (for Trigger.dev Cloud)
108
+ * **Local Docker on ARM:** `"linux-arm64-openssl-3.0.x"`
109
+ */
110
+ binaryTarget?: string;
111
+ /**
112
+ * Suppress progress messages during the build.
113
+ */
114
+ silent?: boolean;
115
+ };
116
+ export type PrismaEngineModernModeExtensionOptions = {
117
+ /**
118
+ * Modern mode for Prisma 6.16+ (with `prisma-client` provider) and Prisma 7.
119
+ *
120
+ * **Use this mode when:**
121
+ * - Using Prisma 6.16+ with `provider = "prisma-client"` and `engineType = "client"`
122
+ * - Using Prisma 7 beta or later
123
+ * - Using database adapters (e.g., `@prisma/adapter-pg`)
124
+ *
125
+ * **What it does:**
126
+ * - Marks `@prisma/client` as external (zero config)
127
+ * - Works with TypeScript-only client (no Rust binaries)
128
+ *
129
+ * **You must:** Run `prisma generate` yourself and install database adapters.
130
+ */
131
+ mode: "modern";
132
+ };
133
+ export type PrismaExtensionOptions = PrismaLegacyModeExtensionOptions | PrismaEngineOnlyModeExtensionOptions | PrismaEngineModernModeExtensionOptions;
134
+ /**
135
+ * Prisma build extension for Trigger.dev deployments.
136
+ *
137
+ * **Three modes available:**
138
+ * - `"legacy"` - Prisma 5.x/6.x with `prisma-client-js`, automatic generation
139
+ * - `"engine-only"` - Custom output paths, manual generation control
140
+ * - `"modern"` - Prisma 6.16+/7.x with `prisma-client` provider
141
+ *
142
+ * @example Legacy mode (most common)
143
+ * ```ts
144
+ * prismaExtension({
145
+ * mode: "legacy",
146
+ * schema: "prisma/schema.prisma",
147
+ * migrate: true,
148
+ * typedSql: true,
149
+ * });
150
+ * ```
151
+ *
152
+ * @example Engine-only mode (custom output)
153
+ * ```ts
154
+ * prismaExtension({
155
+ * mode: "engine-only",
156
+ * version: "6.19.0",
157
+ * });
158
+ * ```
159
+ *
160
+ * @example Modern mode (Prisma 7)
161
+ * ```ts
162
+ * prismaExtension({
163
+ * mode: "modern",
164
+ * });
165
+ * ```
166
+ */
167
+ export declare function prismaExtension(options: PrismaExtensionOptions): BuildExtension;
168
+ export declare class PrismaLegacyModeExtension implements BuildExtension {
43
169
  private options;
44
170
  moduleExternals: string[];
45
171
  readonly name = "PrismaExtension";
46
172
  private _resolvedSchemaPath?;
47
- constructor(options: PrismaExtensionOptions);
173
+ private _loadedConfig?;
174
+ constructor(options: PrismaLegacyModeExtensionOptions);
48
175
  externalsForTarget(target: BuildTarget): string[];
49
176
  onBuildStart(context: BuildContext): Promise<void>;
50
177
  onBuildComplete(context: BuildContext, manifest: BuildManifest): Promise<void>;
51
178
  }
179
+ export declare class PrismaEngineOnlyModeExtension implements BuildExtension {
180
+ private options;
181
+ readonly name = "PrismaEngineOnlyModeExtension";
182
+ private _binaryTarget;
183
+ constructor(options: PrismaEngineOnlyModeExtensionOptions);
184
+ onBuildComplete(context: BuildContext, manifest: BuildManifest): Promise<void>;
185
+ }
186
+ export declare class PrismaEngineModernModeExtension implements BuildExtension {
187
+ private options;
188
+ moduleExternals: string[];
189
+ readonly name = "PrismaEngineModernModeExtension";
190
+ constructor(options: PrismaEngineModernModeExtensionOptions);
191
+ externalsForTarget(target: BuildTarget): string[];
192
+ }