@prisma/adapter-libsql
Advanced tools
Comparing version 5.6.0-integration-chore-upgrade-esm-deps.12 to 5.6.0-integration-chore-upgrade-esm-deps.13
import type { Client } from '@libsql/client'; | ||
import type { DriverAdapter } from '@prisma/driver-adapter-utils'; | ||
import { Mutex } from 'async-mutex'; | ||
import type { Query } from '@prisma/driver-adapter-utils'; | ||
import type { Queryable } from '@prisma/driver-adapter-utils'; | ||
import type { Result } from '@prisma/driver-adapter-utils'; | ||
import type { ResultSet } from '@prisma/driver-adapter-utils'; | ||
import type { Transaction } from '@libsql/client'; | ||
import type { Transaction as Transaction_2 } from '@prisma/driver-adapter-utils'; | ||
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 Char: 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 CharArray: 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; | ||
}; | ||
declare interface DriverAdapter extends Queryable { | ||
/** | ||
* Starts new transation. | ||
*/ | ||
startTransaction(): Promise<Result<Transaction_2>>; | ||
/** | ||
* Closes the connection to the database, if any. | ||
*/ | ||
close: () => Promise<Result<void>>; | ||
} | ||
declare type Error_2 = { | ||
kind: 'GenericJs'; | ||
id: number; | ||
} | { | ||
kind: 'Postgres'; | ||
code: string; | ||
severity: string; | ||
message: string; | ||
detail: string | undefined; | ||
column: string | undefined; | ||
hint: string | undefined; | ||
} | { | ||
kind: 'Mysql'; | ||
code: number; | ||
message: string; | ||
state: string; | ||
} | { | ||
kind: 'Sqlite'; | ||
/** | ||
* Sqlite extended error code: https://www.sqlite.org/rescode.html | ||
*/ | ||
extendedCode: number; | ||
message: string; | ||
}; | ||
declare class LibSqlQueryable<ClientT extends StdClient | TransactionClient> implements Queryable { | ||
@@ -109,89 +42,6 @@ protected readonly client: ClientT; | ||
declare type Query = { | ||
sql: string; | ||
args: Array<unknown>; | ||
}; | ||
declare interface Queryable { | ||
readonly flavour: 'mysql' | 'postgres' | 'sqlite'; | ||
/** | ||
* Execute a query given as SQL, interpolating the given parameters, | ||
* and returning the type-aware result set of the query. | ||
* | ||
* This is the preferred way of executing `SELECT` queries. | ||
*/ | ||
queryRaw(params: Query): Promise<Result<ResultSet>>; | ||
/** | ||
* Execute a query given as SQL, interpolating the given parameters, | ||
* and returning the number of affected rows. | ||
* | ||
* This is the preferred way of executing `INSERT`, `UPDATE`, `DELETE` queries, | ||
* as well as transactional queries. | ||
*/ | ||
executeRaw(params: Query): Promise<Result<number>>; | ||
} | ||
declare type Result<T> = { | ||
map<U>(fn: (value: T) => U): Result<U>; | ||
flatMap<U>(fn: (value: T) => Result<U>): Result<U>; | ||
} & ({ | ||
readonly ok: true; | ||
readonly value: T; | ||
} | { | ||
readonly ok: false; | ||
readonly error: Error_2; | ||
}); | ||
declare interface ResultSet { | ||
/** | ||
* 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 MySQL and SQLite-flavoured databases. | ||
*/ | ||
lastInsertId?: string; | ||
} | ||
declare type StdClient = Client; | ||
declare interface Transaction_2 extends Queryable { | ||
/** | ||
* Transaction options. | ||
*/ | ||
readonly options: TransactionOptions; | ||
/** | ||
* Commit the transaction. | ||
*/ | ||
commit(): Promise<Result<void>>; | ||
/** | ||
* Rolls back the transaction. | ||
*/ | ||
rollback(): Promise<Result<void>>; | ||
/** | ||
* Discards and closes the transaction which may or may not have been committed or rolled back. | ||
* This operation must be synchronous. If the implementation requires calling creating new | ||
* asynchronous tasks on the event loop, the driver is responsible for handling the errors | ||
* appropriately to ensure they don't crash the application. | ||
*/ | ||
dispose(): Result<void>; | ||
} | ||
declare type TransactionClient = Transaction; | ||
declare type TransactionOptions = { | ||
usePhantomQuery: boolean; | ||
}; | ||
export { } |
{ | ||
"name": "@prisma/adapter-libsql", | ||
"version": "5.6.0-integration-chore-upgrade-esm-deps.12", | ||
"version": "5.6.0-integration-chore-upgrade-esm-deps.13", | ||
"description": "Prisma's driver adapter for libSQL and Turso", | ||
@@ -23,3 +23,3 @@ "main": "dist/index.js", | ||
"async-mutex": "0.4.0", | ||
"@prisma/driver-adapter-utils": "5.6.0-integration-chore-upgrade-esm-deps.12" | ||
"@prisma/driver-adapter-utils": "5.6.0-integration-chore-upgrade-esm-deps.13" | ||
}, | ||
@@ -26,0 +26,0 @@ "devDependencies": { |
33712
587