@prisma/driver-adapter-utils
Advanced tools
Comparing version 5.6.0-integration-engines-5-6-0-10-integration-bump-mobc-e4056297dc83a2ee095f9f9fb637fc1dbc167b73.2 to 5.6.0-integration-engines-5-6-0-12-integration-sql-nested-transactions-a8af640da343c10e0f7421264c2838b302d3ce6d.1
@@ -1,4 +0,8 @@ | ||
export { debug as Debug } from 'debug'; | ||
import { debug as Debug } from 'debug'; | ||
declare const ColumnTypeEnum: { | ||
export declare const bindAdapter: (adapter: DriverAdapter) => ErrorCapturingDriverAdapter; | ||
export declare type ColumnType = (typeof ColumnTypeEnum)[keyof typeof ColumnTypeEnum]; | ||
export declare const ColumnTypeEnum: { | ||
readonly Int32: 0; | ||
@@ -10,3 +14,3 @@ readonly Int64: 1; | ||
readonly Boolean: 5; | ||
readonly Char: 6; | ||
readonly Character: 6; | ||
readonly Text: 7; | ||
@@ -27,3 +31,3 @@ readonly Date: 8; | ||
readonly BooleanArray: 69; | ||
readonly CharArray: 70; | ||
readonly CharacterArray: 70; | ||
readonly TextArray: 71; | ||
@@ -39,44 +43,19 @@ readonly DateArray: 72; | ||
}; | ||
declare const JsonNullMarker = "$__prisma_null"; | ||
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; | ||
}); | ||
declare function ok<T>(value: T): Result<T>; | ||
declare function err<T>(error: Error): Result<T>; | ||
export { Debug } | ||
type ColumnType = (typeof ColumnTypeEnum)[keyof typeof ColumnTypeEnum]; | ||
interface ResultSet { | ||
export declare interface DriverAdapter extends Queryable { | ||
/** | ||
* 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. | ||
* Starts new transation. | ||
*/ | ||
columnTypes: Array<ColumnType>; | ||
startTransaction(): Promise<Result<Transaction>>; | ||
/** | ||
* List of column names appearing in a database query, in the same order as `columnTypes`. | ||
* Closes the connection to the database, if any. | ||
*/ | ||
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; | ||
close: () => Promise<Result<void>>; | ||
} | ||
type Query = { | ||
sql: string; | ||
args: Array<unknown>; | ||
}; | ||
type Error = { | ||
export declare function err<T>(error: Error_2): Result<T>; | ||
declare type Error_2 = { | ||
kind: 'GenericJs'; | ||
@@ -105,3 +84,26 @@ id: number; | ||
}; | ||
interface Queryable { | ||
export { Error_2 as Error } | ||
export declare interface ErrorCapturingDriverAdapter extends DriverAdapter { | ||
readonly errorRegistry: ErrorRegistry; | ||
} | ||
export declare type ErrorRecord = { | ||
error: unknown; | ||
}; | ||
export declare interface ErrorRegistry { | ||
consumeError(id: number): ErrorRecord | undefined; | ||
} | ||
export declare const JsonNullMarker = "$__prisma_null"; | ||
export declare function ok<T>(value: T): Result<T>; | ||
export declare type Query = { | ||
sql: string; | ||
args: Array<unknown>; | ||
}; | ||
export declare interface Queryable { | ||
readonly flavour: 'mysql' | 'postgres' | 'sqlite'; | ||
@@ -124,16 +126,37 @@ /** | ||
} | ||
interface DriverAdapter extends Queryable { | ||
export 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; | ||
}); | ||
export declare interface ResultSet { | ||
/** | ||
* Starts new transation. | ||
* 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. | ||
*/ | ||
startTransaction(): Promise<Result<Transaction>>; | ||
columnTypes: Array<ColumnType>; | ||
/** | ||
* Closes the connection to the database, if any. | ||
* List of column names appearing in a database query, in the same order as `columnTypes`. | ||
*/ | ||
close: () => Promise<Result<void>>; | ||
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; | ||
} | ||
type TransactionOptions = { | ||
usePhantomQuery: boolean; | ||
}; | ||
interface Transaction extends Queryable { | ||
export declare interface Transaction extends Queryable { | ||
/** | ||
@@ -159,14 +182,7 @@ * Transaction options. | ||
} | ||
interface ErrorCapturingDriverAdapter extends DriverAdapter { | ||
readonly errorRegistry: ErrorRegistry; | ||
} | ||
interface ErrorRegistry { | ||
consumeError(id: number): ErrorRecord | undefined; | ||
} | ||
type ErrorRecord = { | ||
error: unknown; | ||
export declare type TransactionOptions = { | ||
usePhantomQuery: boolean; | ||
}; | ||
declare const bindAdapter: (adapter: DriverAdapter) => ErrorCapturingDriverAdapter; | ||
export { ColumnType, ColumnTypeEnum, DriverAdapter, Error, ErrorCapturingDriverAdapter, ErrorRecord, ErrorRegistry, JsonNullMarker, Query, Queryable, Result, ResultSet, Transaction, TransactionOptions, bindAdapter, err, ok }; | ||
export { } |
@@ -60,3 +60,5 @@ "use strict"; | ||
var ErrorRegistryInternal = class { | ||
registeredErrors = []; | ||
constructor() { | ||
this.registeredErrors = []; | ||
} | ||
consumeError(id) { | ||
@@ -130,3 +132,3 @@ return this.registeredErrors[id]; | ||
Boolean: 5, | ||
Char: 6, | ||
Character: 6, | ||
Text: 7, | ||
@@ -148,3 +150,3 @@ Date: 8, | ||
BooleanArray: 69, | ||
CharArray: 70, | ||
CharacterArray: 70, | ||
TextArray: 71, | ||
@@ -151,0 +153,0 @@ DateArray: 72, |
{ | ||
"name": "@prisma/driver-adapter-utils", | ||
"version": "5.6.0-integration-engines-5-6-0-10-integration-bump-mobc-e4056297dc83a2ee095f9f9fb637fc1dbc167b73.2", | ||
"version": "5.6.0-integration-engines-5-6-0-12-integration-sql-nested-transactions-a8af640da343c10e0f7421264c2838b302d3ce6d.1", | ||
"description": "Internal set of utilities and types for Prisma's driver adapters.", | ||
@@ -28,5 +28,5 @@ "main": "dist/index.js", | ||
"scripts": { | ||
"build": "tsup ./src/index.ts --format cjs,esm --dts", | ||
"lint": "tsc -p ./tsconfig.build.json" | ||
"dev": "DEV=true node -r esbuild-register helpers/build.ts", | ||
"build": "node -r esbuild-register helpers/build.ts" | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
467
24840
6