@prisma/driver-adapter-utils
Advanced tools
Comparing version 5.6.0-integration-feat-auto-edge-import.1 to 5.6.0-integration-refactor-consistently-use-binarytarget-term.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; | ||
@@ -37,44 +41,19 @@ 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>; | ||
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'; | ||
@@ -103,3 +82,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 +124,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 +180,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) { | ||
@@ -63,0 +65,0 @@ return this.registeredErrors[id]; |
{ | ||
"name": "@prisma/driver-adapter-utils", | ||
"version": "5.6.0-integration-feat-auto-edge-import.1", | ||
"version": "5.6.0-integration-refactor-consistently-use-binarytarget-term.1", | ||
"description": "Internal set of utilities and types for Prisma's driver adapters.", | ||
@@ -8,2 +8,7 @@ "main": "dist/index.js", | ||
"types": "dist/index.d.ts", | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/prisma/prisma.git", | ||
"directory": "packages/driver-adapter-utils" | ||
}, | ||
"files": [ | ||
@@ -18,11 +23,11 @@ "dist", | ||
"dependencies": { | ||
"debug": "^4.3.4" | ||
"debug": "4.3.4" | ||
}, | ||
"devDependencies": { | ||
"@types/debug": "^4.1.8" | ||
"@types/debug": "4.1.10" | ||
}, | ||
"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
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
467
0
24760
6
+ Addeddebug@4.3.4(transitive)
+ Addedms@2.1.2(transitive)
- Removeddebug@4.4.0(transitive)
- Removedms@2.1.3(transitive)
Updateddebug@4.3.4