@prisma/config
Advanced tools
+168
-5
@@ -0,1 +1,54 @@ | ||
| /** | ||
| * An interface that exposes some basic information about the | ||
| * adapter like its name and provider type. | ||
| */ | ||
| declare interface AdapterInfo { | ||
| readonly provider: Provider; | ||
| readonly adapterName: (typeof officialPrismaAdapters)[number] | (string & {}); | ||
| } | ||
| /** | ||
| * Original `quaint::ValueType` enum tag from Prisma's `quaint`. | ||
| * Query arguments marked with this type are sanitized before being sent to the database. | ||
| * Notice while a query argument may be `null`, `ArgType` is guaranteed to be defined. | ||
| */ | ||
| declare type ArgType = 'Int32' | 'Int64' | 'Float' | 'Double' | 'Text' | 'Enum' | 'EnumArray' | 'Bytes' | 'Boolean' | 'Char' | 'Array' | 'Numeric' | 'Json' | 'Xml' | 'Uuid' | 'DateTime' | 'Date' | 'Time'; | ||
| declare type ColumnType = (typeof ColumnTypeEnum)[keyof typeof ColumnTypeEnum]; | ||
| declare const ColumnTypeEnum: { | ||
| readonly Int32: 0; | ||
| readonly Int64: 1; | ||
| readonly Float: 2; | ||
| readonly Double: 3; | ||
| readonly Numeric: 4; | ||
| readonly Boolean: 5; | ||
| readonly Character: 6; | ||
| readonly Text: 7; | ||
| readonly Date: 8; | ||
| readonly Time: 9; | ||
| readonly DateTime: 10; | ||
| readonly Json: 11; | ||
| readonly Enum: 12; | ||
| readonly Bytes: 13; | ||
| readonly Set: 14; | ||
| readonly Uuid: 15; | ||
| readonly Int32Array: 64; | ||
| readonly Int64Array: 65; | ||
| readonly FloatArray: 66; | ||
| readonly DoubleArray: 67; | ||
| readonly NumericArray: 68; | ||
| readonly BooleanArray: 69; | ||
| readonly CharacterArray: 70; | ||
| readonly TextArray: 71; | ||
| readonly DateArray: 72; | ||
| readonly TimeArray: 73; | ||
| readonly DateTimeArray: 74; | ||
| readonly JsonArray: 75; | ||
| readonly EnumArray: 76; | ||
| readonly BytesArray: 77; | ||
| readonly UuidArray: 78; | ||
| readonly UnknownNumber: 128; | ||
| }; | ||
| export declare type ConfigFromFile = { | ||
@@ -15,6 +68,11 @@ resolvedPath: string; | ||
| declare type ConnectionInfo = { | ||
| schemaName?: string; | ||
| maxBindValues?: number; | ||
| }; | ||
| /** | ||
| * This default config can be used as basis for unit and integration tests. | ||
| */ | ||
| export declare function defaultTestConfig(): PrismaConfigInternal; | ||
| export declare function defaultTestConfig<Env extends Record<string, string | undefined> = never>(): PrismaConfigInternal<Env>; | ||
@@ -24,4 +82,6 @@ /** | ||
| */ | ||
| export declare function defineConfig(configInput: PrismaConfig): PrismaConfigInternal; | ||
| export declare function defineConfig<Env extends Record<string, string | undefined> = never>(configInput: PrismaConfig<Env>): PrismaConfigInternal<Env>; | ||
| declare type EnvVars = Record<string, string | undefined>; | ||
| /** | ||
@@ -58,2 +118,4 @@ * Load a Prisma config file from the given directory. | ||
| declare const officialPrismaAdapters: readonly ["@prisma/adapter-planetscale", "@prisma/adapter-neon", "@prisma/adapter-libsql", "@prisma/adapter-d1", "@prisma/adapter-pg", "@prisma/adapter-pg-worker"]; | ||
| declare const PRISMA_CONFIG_INTERNAL_BRAND: unique symbol; | ||
@@ -65,3 +127,3 @@ | ||
| */ | ||
| export declare type PrismaConfig = { | ||
| export declare type PrismaConfig<Env extends EnvVars = never> = { | ||
| /** | ||
@@ -75,2 +137,6 @@ * Whether features with an unstable API are enabled. | ||
| schema?: PrismaSchemaConfigShape; | ||
| /** | ||
| * The configuration for Prisma Studio. | ||
| */ | ||
| studio?: PrismaStudioConfigShape<Env>; | ||
| }; | ||
@@ -83,7 +149,7 @@ | ||
| */ | ||
| export declare type PrismaConfigInternal = _PrismaConfigInternal & { | ||
| export declare type PrismaConfigInternal<Env extends EnvVars = never> = _PrismaConfigInternal<Env> & { | ||
| __brand: typeof PRISMA_CONFIG_INTERNAL_BRAND; | ||
| }; | ||
| declare type _PrismaConfigInternal = { | ||
| declare type _PrismaConfigInternal<Env extends EnvVars = never> = { | ||
| /** | ||
@@ -98,2 +164,6 @@ * Whether features with an unstable API are enabled. | ||
| /** | ||
| * The configuration for Prisma Studio. | ||
| */ | ||
| studio?: PrismaStudioConfigShape<Env>; | ||
| /** | ||
| * The path from where the config was loaded. | ||
@@ -126,2 +196,95 @@ * It's set to `null` if no config file was found and only default config is applied. | ||
| declare type PrismaStudioConfigShape<Env extends EnvVars = never> = { | ||
| adapter: (env: Env) => Promise<SqlConnection>; | ||
| }; | ||
| declare type Provider = 'mysql' | 'postgres' | 'sqlite'; | ||
| declare interface Queryable<Query, Result> extends AdapterInfo { | ||
| /** | ||
| * Execute a query and return its result. | ||
| */ | ||
| queryRaw(params: Query): Promise<Result>; | ||
| /** | ||
| * Execute a query and return the number of affected rows. | ||
| */ | ||
| executeRaw(params: Query): Promise<number>; | ||
| } | ||
| declare interface SqlConnection extends SqlQueryable { | ||
| /** | ||
| * Execute multiple SQL statements separated by semicolon. | ||
| */ | ||
| executeScript(script: string): Promise<void>; | ||
| /** | ||
| * Start new transaction. | ||
| */ | ||
| transactionContext(): Promise<TransactionContext>; | ||
| /** | ||
| * Optional method that returns extra connection info | ||
| */ | ||
| getConnectionInfo?(): ConnectionInfo; | ||
| /** | ||
| * Dispose of the connection and release any resources. | ||
| */ | ||
| dispose(): Promise<void>; | ||
| } | ||
| declare type SqlQuery = { | ||
| sql: string; | ||
| args: Array<unknown>; | ||
| argTypes: Array<ArgType>; | ||
| }; | ||
| declare interface SqlQueryable extends Queryable<SqlQuery, SqlResultSet> { | ||
| } | ||
| declare interface SqlResultSet { | ||
| /** | ||
| * List of column types appearing in a database query, in the same order as `columnNames`. | ||
| * They are used within the Query Engine to convert values from JS to Quaint values. | ||
| */ | ||
| columnTypes: Array<ColumnType>; | ||
| /** | ||
| * List of column names appearing in a database query, in the same order as `columnTypes`. | ||
| */ | ||
| columnNames: Array<string>; | ||
| /** | ||
| * List of rows retrieved from a database query. | ||
| * Each row is a list of values, whose length matches `columnNames` and `columnTypes`. | ||
| */ | ||
| rows: Array<Array<unknown>>; | ||
| /** | ||
| * The last ID of an `INSERT` statement, if any. | ||
| * This is required for `AUTO_INCREMENT` columns in databases based on MySQL and SQLite. | ||
| */ | ||
| lastInsertId?: string; | ||
| } | ||
| declare interface Transaction extends AdapterInfo, SqlQueryable { | ||
| /** | ||
| * Transaction options. | ||
| */ | ||
| readonly options: TransactionOptions; | ||
| /** | ||
| * Commit the transaction. | ||
| */ | ||
| commit(): Promise<void>; | ||
| /** | ||
| * Roll back the transaction. | ||
| */ | ||
| rollback(): Promise<void>; | ||
| } | ||
| declare interface TransactionContext extends AdapterInfo, SqlQueryable { | ||
| /** | ||
| * Start new transaction. | ||
| */ | ||
| startTransaction(): Promise<Transaction>; | ||
| } | ||
| declare type TransactionOptions = { | ||
| usePhantomQuery: boolean; | ||
| }; | ||
| export { } |
+3
-3
| { | ||
| "name": "@prisma/config", | ||
| "version": "6.5.0-dev.38", | ||
| "version": "6.5.0-dev.39", | ||
| "description": "Internal package used to define and read Prisma configuration files", | ||
@@ -25,4 +25,4 @@ "main": "dist/index.js", | ||
| "jest-junit": "16.0.0", | ||
| "@prisma/driver-adapter-utils": "6.5.0-dev.38", | ||
| "@prisma/get-platform": "6.5.0-dev.38" | ||
| "@prisma/driver-adapter-utils": "6.5.0-dev.39", | ||
| "@prisma/get-platform": "6.5.0-dev.39" | ||
| }, | ||
@@ -29,0 +29,0 @@ "files": [ |
Sorry, the diff of this file is too big to display
776375
0.77%22769
0.77%