@prisma/config 6.5.0-dev.37 → 6.5.0-dev.39

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 CHANGED
@@ -1,3 +1,56 @@
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
+
1
54
  export declare type ConfigFromFile = {
2
55
  resolvedPath: string;
3
56
  config: PrismaConfigInternal;
@@ -12,15 +65,22 @@ export declare type ConfigFromFile = {
12
65
  error?: never;
13
66
  };
14
67
 
68
+ declare type ConnectionInfo = {
69
+ schemaName?: string;
70
+ maxBindValues?: number;
71
+ };
72
+
15
73
  /**
16
74
  * This default config can be used as basis for unit and integration tests.
17
75
  */
18
- export declare function defaultTestConfig(): PrismaConfigInternal;
76
+ export declare function defaultTestConfig<Env extends Record<string, string | undefined> = never>(): PrismaConfigInternal<Env>;
19
77
 
20
78
  /**
21
79
  * Define the configuration for the Prisma Development Kit.
22
80
  */
23
- export declare function defineConfig(configInput: PrismaConfig): PrismaConfigInternal;
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>;
24
84
 
25
85
  /**
26
86
  * Load a Prisma config file from the given directory.
@@ -53,13 +113,15 @@ declare type LoadConfigFromFileInput = {
53
113
  configRoot?: string;
54
114
  };
55
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
+
56
118
  declare const PRISMA_CONFIG_INTERNAL_BRAND: unique symbol;
57
119
 
58
120
  /**
59
121
  * The configuration for the Prisma Development Kit, before it is passed to the `defineConfig` function.
60
122
  * Thanks to the branding, this type is opaque and cannot be constructed directly.
61
123
  */
62
- export declare type PrismaConfig = {
124
+ export declare type PrismaConfig<Env extends EnvVars = never> = {
63
125
  /**
64
126
  * Whether features with an unstable API are enabled.
65
127
  */
@@ -68,6 +130,10 @@ export declare type PrismaConfig = {
68
130
  * The configuration for the Prisma schema file(s).
69
131
  */
70
132
  schema?: PrismaSchemaConfigShape;
133
+ /**
134
+ * The configuration for Prisma Studio.
135
+ */
136
+ studio?: PrismaStudioConfigShape<Env>;
71
137
  };
72
138
 
73
139
  /**
@@ -75,11 +141,11 @@ export declare type PrismaConfig = {
75
141
  * by the `defineConfig` function.
76
142
  * Thanks to the branding, this type is opaque and cannot be constructed directly.
77
143
  */
78
- export declare type PrismaConfigInternal = _PrismaConfigInternal & {
144
+ export declare type PrismaConfigInternal<Env extends EnvVars = never> = _PrismaConfigInternal<Env> & {
79
145
  __brand: typeof PRISMA_CONFIG_INTERNAL_BRAND;
80
146
  };
81
147
 
82
- declare type _PrismaConfigInternal = {
148
+ declare type _PrismaConfigInternal<Env extends EnvVars = never> = {
83
149
  /**
84
150
  * Whether features with an unstable API are enabled.
85
151
  */
@@ -88,6 +154,10 @@ declare type _PrismaConfigInternal = {
88
154
  * The configuration for the Prisma schema file(s).
89
155
  */
90
156
  schema?: PrismaSchemaConfigShape;
157
+ /**
158
+ * The configuration for Prisma Studio.
159
+ */
160
+ studio?: PrismaStudioConfigShape<Env>;
91
161
  /**
92
162
  * The path from where the config was loaded.
93
163
  * It's set to `null` if no config file was found and only default config is applied.
@@ -116,4 +186,97 @@ declare type PrismaSchemaConfigShape = {
116
186
  folderPath: string;
117
187
  };
118
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
+
119
282
  export { }
package/dist/index.js CHANGED
@@ -22472,6 +22472,7 @@ function defineConfig(configInput) {
22472
22472
  const config2 = defaultConfig();
22473
22473
  debug("Prisma config [default]: %o", config2);
22474
22474
  defineSchemaConfig(config2, configInput);
22475
+ defineStudioConfig(config2, configInput);
22475
22476
  return config2;
22476
22477
  }
22477
22478
  function defineSchemaConfig(config2, configInput) {
@@ -22481,9 +22482,34 @@ function defineSchemaConfig(config2, configInput) {
22481
22482
  config2.schema = configInput.schema;
22482
22483
  debug("Prisma config [schema]: %o", config2.schema);
22483
22484
  }
22485
+ function defineStudioConfig(config2, configInput) {
22486
+ if (!configInput.studio) {
22487
+ return;
22488
+ }
22489
+ config2.studio = {
22490
+ adapter: configInput.studio.adapter
22491
+ };
22492
+ debug("Prisma config [studio]: %o", config2.studio);
22493
+ }
22484
22494
 
22485
22495
  // src/PrismaConfig.ts
22486
22496
  var debug2 = Debug("prisma:config:PrismaConfig");
22497
+ var adapterShape = () => Schema_exports.declare(
22498
+ (input) => {
22499
+ return input instanceof Function;
22500
+ },
22501
+ {
22502
+ identifier: "Adapter<Env>",
22503
+ encode: identity,
22504
+ decode: identity
22505
+ }
22506
+ );
22507
+ var createPrismaStudioConfigInternalShape = () => Schema_exports.Struct({
22508
+ /**
22509
+ * Instantiates the Prisma driver adapter to use for Prisma Studio.
22510
+ */
22511
+ adapter: adapterShape()
22512
+ });
22487
22513
  var PrismaConfigSchemaSingleShape = Schema_exports.Struct({
22488
22514
  kind: Schema_exports.Literal("single"),
22489
22515
  filePath: Schema_exports.String
@@ -22494,8 +22520,10 @@ var PrismaConfigSchemaMultiShape = Schema_exports.Struct({
22494
22520
  });
22495
22521
  var PrismaSchemaConfigShape = Schema_exports.Union(PrismaConfigSchemaSingleShape, PrismaConfigSchemaMultiShape);
22496
22522
  if (false) {
22497
- __testPrismaConfigShapeValueA;
22498
- __testPrismaConfigShapeValueB;
22523
+ __testPrismaSchemaConfigShapeValueA;
22524
+ __testPrismaSchemaConfigShapeValueB;
22525
+ __testPrismaStudioConfigShapeValueA;
22526
+ __testPrismaStudioConfigShapeValueB;
22499
22527
  }
22500
22528
  var createPrismaConfigShape = () => Schema_exports.Struct({
22501
22529
  earlyAccess: Schema_exports.Literal(true),
@@ -22514,6 +22542,7 @@ var PRISMA_CONFIG_INTERNAL_BRAND = Symbol.for("PrismaConfigInternal");
22514
22542
  var createPrismaConfigInternalShape = () => Schema_exports.Struct({
22515
22543
  earlyAccess: Schema_exports.Literal(true),
22516
22544
  schema: Schema_exports.optional(PrismaSchemaConfigShape),
22545
+ studio: Schema_exports.optional(createPrismaStudioConfigInternalShape()),
22517
22546
  loadedFromFile: Schema_exports.NullOr(Schema_exports.String)
22518
22547
  });
22519
22548
  if (false) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@prisma/config",
3
- "version": "6.5.0-dev.37",
3
+ "version": "6.5.0-dev.39",
4
4
  "description": "Internal package used to define and read Prisma configuration files",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -22,8 +22,8 @@
22
22
  "esbuild-register": "3.6.0",
23
23
  "jest": "29.7.0",
24
24
  "jest-junit": "16.0.0",
25
- "@prisma/driver-adapter-utils": "6.5.0-dev.37",
26
- "@prisma/get-platform": "6.5.0-dev.37"
25
+ "@prisma/driver-adapter-utils": "6.5.0-dev.39",
26
+ "@prisma/get-platform": "6.5.0-dev.39"
27
27
  },
28
28
  "files": [
29
29
  "dist"