@prisma/config 6.5.0-dev.8 → 6.5.0-dev.80
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.
- package/dist/index.d.ts +282 -6
- package/dist/index.js +317 -272
- package/package.json +4 -4
- package/dist/PrismaConfig.d.ts +0 -109
- package/dist/PrismaConfig.js +0 -22215
- package/dist/defaultConfig.d.ts +0 -8
- package/dist/defaultConfig.js +0 -22197
- package/dist/defaultTestConfig.d.ts +0 -6
- package/dist/defaultTestConfig.js +0 -22197
- package/dist/defineConfig.d.ts +0 -6
- package/dist/defineConfig.js +0 -22398
- package/dist/loadConfigFromFile.d.ts +0 -44
- package/dist/loadConfigFromFile.js +0 -22667
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,282 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
/**
|
|
2
|
+
* An interface that exposes some basic information about the
|
|
3
|
+
* adapter like its name and provider type.
|
|
4
|
+
*/
|
|
5
|
+
declare interface AdapterInfo {
|
|
6
|
+
readonly provider: Provider;
|
|
7
|
+
readonly adapterName: (typeof officialPrismaAdapters)[number] | (string & {});
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Original `quaint::ValueType` enum tag from Prisma's `quaint`.
|
|
12
|
+
* Query arguments marked with this type are sanitized before being sent to the database.
|
|
13
|
+
* Notice while a query argument may be `null`, `ArgType` is guaranteed to be defined.
|
|
14
|
+
*/
|
|
15
|
+
declare type ArgType = 'Int32' | 'Int64' | 'Float' | 'Double' | 'Text' | 'Enum' | 'EnumArray' | 'Bytes' | 'Boolean' | 'Char' | 'Array' | 'Numeric' | 'Json' | 'Xml' | 'Uuid' | 'DateTime' | 'Date' | 'Time';
|
|
16
|
+
|
|
17
|
+
declare type ColumnType = (typeof ColumnTypeEnum)[keyof typeof ColumnTypeEnum];
|
|
18
|
+
|
|
19
|
+
declare const ColumnTypeEnum: {
|
|
20
|
+
readonly Int32: 0;
|
|
21
|
+
readonly Int64: 1;
|
|
22
|
+
readonly Float: 2;
|
|
23
|
+
readonly Double: 3;
|
|
24
|
+
readonly Numeric: 4;
|
|
25
|
+
readonly Boolean: 5;
|
|
26
|
+
readonly Character: 6;
|
|
27
|
+
readonly Text: 7;
|
|
28
|
+
readonly Date: 8;
|
|
29
|
+
readonly Time: 9;
|
|
30
|
+
readonly DateTime: 10;
|
|
31
|
+
readonly Json: 11;
|
|
32
|
+
readonly Enum: 12;
|
|
33
|
+
readonly Bytes: 13;
|
|
34
|
+
readonly Set: 14;
|
|
35
|
+
readonly Uuid: 15;
|
|
36
|
+
readonly Int32Array: 64;
|
|
37
|
+
readonly Int64Array: 65;
|
|
38
|
+
readonly FloatArray: 66;
|
|
39
|
+
readonly DoubleArray: 67;
|
|
40
|
+
readonly NumericArray: 68;
|
|
41
|
+
readonly BooleanArray: 69;
|
|
42
|
+
readonly CharacterArray: 70;
|
|
43
|
+
readonly TextArray: 71;
|
|
44
|
+
readonly DateArray: 72;
|
|
45
|
+
readonly TimeArray: 73;
|
|
46
|
+
readonly DateTimeArray: 74;
|
|
47
|
+
readonly JsonArray: 75;
|
|
48
|
+
readonly EnumArray: 76;
|
|
49
|
+
readonly BytesArray: 77;
|
|
50
|
+
readonly UuidArray: 78;
|
|
51
|
+
readonly UnknownNumber: 128;
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
export declare type ConfigFromFile = {
|
|
55
|
+
resolvedPath: string;
|
|
56
|
+
config: PrismaConfigInternal;
|
|
57
|
+
error?: never;
|
|
58
|
+
} | {
|
|
59
|
+
resolvedPath: string;
|
|
60
|
+
config?: never;
|
|
61
|
+
error: LoadConfigFromFileError;
|
|
62
|
+
} | {
|
|
63
|
+
resolvedPath: null;
|
|
64
|
+
config: PrismaConfigInternal;
|
|
65
|
+
error?: never;
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
declare type ConnectionInfo = {
|
|
69
|
+
schemaName?: string;
|
|
70
|
+
maxBindValues?: number;
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* This default config can be used as basis for unit and integration tests.
|
|
75
|
+
*/
|
|
76
|
+
export declare function defaultTestConfig<Env extends Record<string, string | undefined> = never>(): PrismaConfigInternal<Env>;
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* Define the configuration for the Prisma Development Kit.
|
|
80
|
+
*/
|
|
81
|
+
export declare function defineConfig<Env extends Record<string, string | undefined> = never>(configInput: PrismaConfig<Env>): PrismaConfigInternal<Env>;
|
|
82
|
+
|
|
83
|
+
declare type EnvVars = Record<string, string | undefined>;
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* Load a Prisma config file from the given directory.
|
|
87
|
+
* This function may fail, but it will never throw.
|
|
88
|
+
* The possible error is returned in the result object, so the caller can handle it as needed.
|
|
89
|
+
*/
|
|
90
|
+
export declare function loadConfigFromFile({ configFile, configRoot, }: LoadConfigFromFileInput): Promise<ConfigFromFile>;
|
|
91
|
+
|
|
92
|
+
export declare type LoadConfigFromFileError = {
|
|
93
|
+
_tag: 'ConfigFileNotFound';
|
|
94
|
+
} | {
|
|
95
|
+
_tag: 'TypeScriptImportFailed';
|
|
96
|
+
error: Error;
|
|
97
|
+
} | {
|
|
98
|
+
_tag: 'ConfigFileParseError';
|
|
99
|
+
error: Error;
|
|
100
|
+
} | {
|
|
101
|
+
_tag: 'UnknownError';
|
|
102
|
+
error: Error;
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
declare type LoadConfigFromFileInput = {
|
|
106
|
+
/**
|
|
107
|
+
* The path to the config file to load. If not provided, we will attempt to find a config file in the `configRoot` directory.
|
|
108
|
+
*/
|
|
109
|
+
configFile?: string;
|
|
110
|
+
/**
|
|
111
|
+
* The directory to search for the config file in. Defaults to the current working directory.
|
|
112
|
+
*/
|
|
113
|
+
configRoot?: string;
|
|
114
|
+
};
|
|
115
|
+
|
|
116
|
+
declare const officialPrismaAdapters: readonly ["@prisma/adapter-planetscale", "@prisma/adapter-neon", "@prisma/adapter-libsql", "@prisma/adapter-d1", "@prisma/adapter-pg", "@prisma/adapter-pg-worker"];
|
|
117
|
+
|
|
118
|
+
declare const PRISMA_CONFIG_INTERNAL_BRAND: unique symbol;
|
|
119
|
+
|
|
120
|
+
/**
|
|
121
|
+
* The configuration for the Prisma Development Kit, before it is passed to the `defineConfig` function.
|
|
122
|
+
* Thanks to the branding, this type is opaque and cannot be constructed directly.
|
|
123
|
+
*/
|
|
124
|
+
export declare type PrismaConfig<Env extends EnvVars = never> = {
|
|
125
|
+
/**
|
|
126
|
+
* Whether features with an unstable API are enabled.
|
|
127
|
+
*/
|
|
128
|
+
earlyAccess: true;
|
|
129
|
+
/**
|
|
130
|
+
* The configuration for the Prisma schema file(s).
|
|
131
|
+
*/
|
|
132
|
+
schema?: PrismaSchemaConfigShape;
|
|
133
|
+
/**
|
|
134
|
+
* The configuration for Prisma Studio.
|
|
135
|
+
*/
|
|
136
|
+
studio?: PrismaStudioConfigShape<Env>;
|
|
137
|
+
};
|
|
138
|
+
|
|
139
|
+
/**
|
|
140
|
+
* The configuration for the Prisma Development Kit, after it has been parsed and processed
|
|
141
|
+
* by the `defineConfig` function.
|
|
142
|
+
* Thanks to the branding, this type is opaque and cannot be constructed directly.
|
|
143
|
+
*/
|
|
144
|
+
export declare type PrismaConfigInternal<Env extends EnvVars = never> = _PrismaConfigInternal<Env> & {
|
|
145
|
+
__brand: typeof PRISMA_CONFIG_INTERNAL_BRAND;
|
|
146
|
+
};
|
|
147
|
+
|
|
148
|
+
declare type _PrismaConfigInternal<Env extends EnvVars = never> = {
|
|
149
|
+
/**
|
|
150
|
+
* Whether features with an unstable API are enabled.
|
|
151
|
+
*/
|
|
152
|
+
earlyAccess: true;
|
|
153
|
+
/**
|
|
154
|
+
* The configuration for the Prisma schema file(s).
|
|
155
|
+
*/
|
|
156
|
+
schema?: PrismaSchemaConfigShape;
|
|
157
|
+
/**
|
|
158
|
+
* The configuration for Prisma Studio.
|
|
159
|
+
*/
|
|
160
|
+
studio?: PrismaStudioConfigShape<Env>;
|
|
161
|
+
/**
|
|
162
|
+
* The path from where the config was loaded.
|
|
163
|
+
* It's set to `null` if no config file was found and only default config is applied.
|
|
164
|
+
*/
|
|
165
|
+
loadedFromFile: string | null;
|
|
166
|
+
};
|
|
167
|
+
|
|
168
|
+
declare type PrismaSchemaConfigShape = {
|
|
169
|
+
/**
|
|
170
|
+
* Tell Prisma to use a single `.prisma` schema file.
|
|
171
|
+
*/
|
|
172
|
+
kind: 'single';
|
|
173
|
+
/**
|
|
174
|
+
* The path to a single `.prisma` schema file.
|
|
175
|
+
*/
|
|
176
|
+
filePath: string;
|
|
177
|
+
} | {
|
|
178
|
+
/**
|
|
179
|
+
* Tell Prisma to use multiple `.prisma` schema files, via the `prismaSchemaFolder` preview feature.
|
|
180
|
+
*/
|
|
181
|
+
kind: 'multi';
|
|
182
|
+
/**
|
|
183
|
+
* The path to a folder containing multiple `.prisma` schema files.
|
|
184
|
+
* All of the files in this folder will be used.
|
|
185
|
+
*/
|
|
186
|
+
folderPath: string;
|
|
187
|
+
};
|
|
188
|
+
|
|
189
|
+
declare type PrismaStudioConfigShape<Env extends EnvVars = never> = {
|
|
190
|
+
adapter: (env: Env) => Promise<SqlConnection>;
|
|
191
|
+
};
|
|
192
|
+
|
|
193
|
+
declare type Provider = 'mysql' | 'postgres' | 'sqlite';
|
|
194
|
+
|
|
195
|
+
declare interface Queryable<Query, Result> extends AdapterInfo {
|
|
196
|
+
/**
|
|
197
|
+
* Execute a query and return its result.
|
|
198
|
+
*/
|
|
199
|
+
queryRaw(params: Query): Promise<Result>;
|
|
200
|
+
/**
|
|
201
|
+
* Execute a query and return the number of affected rows.
|
|
202
|
+
*/
|
|
203
|
+
executeRaw(params: Query): Promise<number>;
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
declare interface SqlConnection extends SqlQueryable {
|
|
207
|
+
/**
|
|
208
|
+
* Execute multiple SQL statements separated by semicolon.
|
|
209
|
+
*/
|
|
210
|
+
executeScript(script: string): Promise<void>;
|
|
211
|
+
/**
|
|
212
|
+
* Start new transaction.
|
|
213
|
+
*/
|
|
214
|
+
transactionContext(): Promise<TransactionContext>;
|
|
215
|
+
/**
|
|
216
|
+
* Optional method that returns extra connection info
|
|
217
|
+
*/
|
|
218
|
+
getConnectionInfo?(): ConnectionInfo;
|
|
219
|
+
/**
|
|
220
|
+
* Dispose of the connection and release any resources.
|
|
221
|
+
*/
|
|
222
|
+
dispose(): Promise<void>;
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
declare type SqlQuery = {
|
|
226
|
+
sql: string;
|
|
227
|
+
args: Array<unknown>;
|
|
228
|
+
argTypes: Array<ArgType>;
|
|
229
|
+
};
|
|
230
|
+
|
|
231
|
+
declare interface SqlQueryable extends Queryable<SqlQuery, SqlResultSet> {
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
declare interface SqlResultSet {
|
|
235
|
+
/**
|
|
236
|
+
* List of column types appearing in a database query, in the same order as `columnNames`.
|
|
237
|
+
* They are used within the Query Engine to convert values from JS to Quaint values.
|
|
238
|
+
*/
|
|
239
|
+
columnTypes: Array<ColumnType>;
|
|
240
|
+
/**
|
|
241
|
+
* List of column names appearing in a database query, in the same order as `columnTypes`.
|
|
242
|
+
*/
|
|
243
|
+
columnNames: Array<string>;
|
|
244
|
+
/**
|
|
245
|
+
* List of rows retrieved from a database query.
|
|
246
|
+
* Each row is a list of values, whose length matches `columnNames` and `columnTypes`.
|
|
247
|
+
*/
|
|
248
|
+
rows: Array<Array<unknown>>;
|
|
249
|
+
/**
|
|
250
|
+
* The last ID of an `INSERT` statement, if any.
|
|
251
|
+
* This is required for `AUTO_INCREMENT` columns in databases based on MySQL and SQLite.
|
|
252
|
+
*/
|
|
253
|
+
lastInsertId?: string;
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
declare interface Transaction extends AdapterInfo, SqlQueryable {
|
|
257
|
+
/**
|
|
258
|
+
* Transaction options.
|
|
259
|
+
*/
|
|
260
|
+
readonly options: TransactionOptions;
|
|
261
|
+
/**
|
|
262
|
+
* Commit the transaction.
|
|
263
|
+
*/
|
|
264
|
+
commit(): Promise<void>;
|
|
265
|
+
/**
|
|
266
|
+
* Roll back the transaction.
|
|
267
|
+
*/
|
|
268
|
+
rollback(): Promise<void>;
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
declare interface TransactionContext extends AdapterInfo, SqlQueryable {
|
|
272
|
+
/**
|
|
273
|
+
* Start new transaction.
|
|
274
|
+
*/
|
|
275
|
+
startTransaction(): Promise<Transaction>;
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
declare type TransactionOptions = {
|
|
279
|
+
usePhantomQuery: boolean;
|
|
280
|
+
};
|
|
281
|
+
|
|
282
|
+
export { }
|