@prisma/driver-adapter-utils
Advanced tools
Comparing version 5.6.0-dev.23 to 5.6.0-integration-chore-client-adapter-porting-nits.1
@@ -1,4 +0,6 @@ | ||
export { debug as Debug } from 'debug'; | ||
export declare const bindAdapter: (adapter: DriverAdapter) => ErrorCapturingDriverAdapter; | ||
declare const ColumnTypeEnum: { | ||
export declare type ColumnType = (typeof ColumnTypeEnum)[keyof typeof ColumnTypeEnum]; | ||
export declare const ColumnTypeEnum: { | ||
readonly Int32: 0; | ||
@@ -37,44 +39,17 @@ readonly Int64: 1; | ||
}; | ||
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>; | ||
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'; | ||
@@ -103,3 +78,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'; | ||
@@ -122,16 +120,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 { | ||
/** | ||
@@ -157,14 +176,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 { } |
@@ -24,3 +24,2 @@ "use strict"; | ||
ColumnTypeEnum: () => ColumnTypeEnum, | ||
Debug: () => import_debug.debug, | ||
JsonNullMarker: () => JsonNullMarker, | ||
@@ -61,3 +60,5 @@ bindAdapter: () => bindAdapter, | ||
var ErrorRegistryInternal = class { | ||
registeredErrors = []; | ||
constructor() { | ||
this.registeredErrors = []; | ||
} | ||
consumeError(id) { | ||
@@ -161,9 +162,5 @@ return this.registeredErrors[id]; | ||
var JsonNullMarker = "$__prisma_null"; | ||
// src/debug.ts | ||
var import_debug = require("debug"); | ||
// Annotate the CommonJS export names for ESM import in node: | ||
0 && (module.exports = { | ||
ColumnTypeEnum, | ||
Debug, | ||
JsonNullMarker, | ||
@@ -170,0 +167,0 @@ bindAdapter, |
{ | ||
"name": "@prisma/driver-adapter-utils", | ||
"version": "5.6.0-dev.23", | ||
"version": "5.6.0-integration-chore-client-adapter-porting-nits.1", | ||
"description": "Internal set of utilities and types for Prisma's driver adapters.", | ||
@@ -16,12 +16,8 @@ "main": "dist/index.js", | ||
"sideEffects": false, | ||
"dependencies": { | ||
"debug": "4.3.4" | ||
}, | ||
"devDependencies": { | ||
"@types/debug": "4.1.10" | ||
}, | ||
"dependencies": {}, | ||
"devDependencies": {}, | ||
"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
0
0
24325
6
458
- Removeddebug@4.3.4
- Removeddebug@4.3.4(transitive)
- Removedms@2.1.2(transitive)