@shiyuhang0/prisma-adapter
Advanced tools
Comparing version 5.11.0-test3 to 5.20.0-1
import TiDBCloud from '@tidbcloud/serverless'; | ||
import { DriverAdapter, Result, ConnectionInfo, Queryable, Query, ResultSet, Transaction, TransactionOptions } from '@prisma/driver-adapter-utils'; | ||
import { DriverAdapter, Result, ConnectionInfo, TransactionContext, Queryable, Query, ResultSet } from '@prisma/driver-adapter-utils'; | ||
@@ -7,2 +7,3 @@ declare class TiDBCloudQueryable<ClientT extends TiDBCloud.Connection | TiDBCloud.Tx> implements Queryable { | ||
readonly provider = "mysql"; | ||
readonly adapterName: string; | ||
constructor(client: ClientT); | ||
@@ -26,16 +27,8 @@ /** | ||
} | ||
declare class TiDBCloudTransaction extends TiDBCloudQueryable<TiDBCloud.Tx> implements Transaction { | ||
readonly options: TransactionOptions; | ||
finished: boolean; | ||
constructor(tx: TiDBCloud.Tx, options: TransactionOptions); | ||
commit(): Promise<Result<void>>; | ||
rollback(): Promise<Result<void>>; | ||
dispose(): Result<void>; | ||
} | ||
declare class PrismaTiDBCloud extends TiDBCloudQueryable<TiDBCloud.Connection> implements DriverAdapter { | ||
constructor(client: TiDBCloud.Connection); | ||
getConnectionInfo(): Result<ConnectionInfo>; | ||
startTransaction(): Promise<Result<TiDBCloudTransaction>>; | ||
transactionContext(): Promise<Result<TransactionContext>>; | ||
} | ||
export { PrismaTiDBCloud }; |
@@ -7,4 +7,4 @@ "use strict"; | ||
var __export = (target, all) => { | ||
for (var name in all) | ||
__defProp(target, name, { get: all[name], enumerable: true }); | ||
for (var name2 in all) | ||
__defProp(target, name2, { get: all[name2], enumerable: true }); | ||
}; | ||
@@ -105,2 +105,5 @@ var __copyProps = (to, from, except, desc) => { | ||
// package.json | ||
var name = "@shiyuhang0/prisma-adapter"; | ||
// src/tidbcloud.ts | ||
@@ -114,2 +117,3 @@ var debug = (0, import_driver_adapter_utils2.Debug)("prisma:driver-adapter:tidbcloud"); | ||
provider = "mysql"; | ||
adapterName = name; | ||
/** | ||
@@ -195,2 +199,17 @@ * Execute a query given as SQL, interpolating the given parameters. | ||
}; | ||
var TiDBCloudTransactionContext = class extends TiDBCloudQueryable { | ||
constructor(connect) { | ||
super(connect); | ||
} | ||
async startTransaction() { | ||
const options = { | ||
usePhantomQuery: false | ||
}; | ||
const tag = "[js::startTransaction]"; | ||
debug("%s option: %O", tag, options); | ||
const tx = await this.client.begin(); | ||
debug("%s success", tag, options); | ||
return (0, import_driver_adapter_utils2.ok)(new TiDBCloudTransaction(tx, options)); | ||
} | ||
}; | ||
var PrismaTiDBCloud = class extends TiDBCloudQueryable { | ||
@@ -207,10 +226,4 @@ constructor(client) { | ||
} | ||
async startTransaction() { | ||
const options = { | ||
usePhantomQuery: true | ||
}; | ||
const tag = "[js::startTransaction]"; | ||
debug(`${tag} options: %O`, options); | ||
const tx = await this.client.begin(); | ||
return (0, import_driver_adapter_utils2.ok)(new TiDBCloudTransaction(tx, options)); | ||
async transactionContext() { | ||
return (0, import_driver_adapter_utils2.ok)(new TiDBCloudTransactionContext(this.client)); | ||
} | ||
@@ -217,0 +230,0 @@ }; |
{ | ||
"name": "@shiyuhang0/prisma-adapter", | ||
"version": "5.11.0-test3", | ||
"version": "5.20.0-1", | ||
"description": "Prisma's driver adapter for \"@tidbcloud/serverless\"", | ||
@@ -37,3 +37,3 @@ "main": "dist/index.js", | ||
"dependencies": { | ||
"@prisma/driver-adapter-utils": "5.11.0" | ||
"@prisma/driver-adapter-utils": "5.20.0" | ||
}, | ||
@@ -40,0 +40,0 @@ "devDependencies": { |
@@ -152,4 +152,8 @@ # @tidbcloud/prisma-adapter | ||
| v5.11.x | v5.11.x | \>= v0.1.0 | | ||
| v5.12.x | v5.12.x | \>= v0.1.0 | | ||
| v5.13.x | v5.13.x | \>= v0.1.0 | | ||
| v5.14.x | v5.14.x | \>= v0.1.0 | | ||
| v5.15.x | v5.15.x | \>= v0.1.0 | | ||
| v5.20.x | v5.20.x | \>= v0.1.0 | | ||
Here is the step to step guide for how to choose the version: | ||
@@ -156,0 +160,0 @@ 1. Choose the Prisma version: Choose the one as you need. |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
21612
453
166
+ Added@prisma/debug@5.20.0(transitive)
+ Added@prisma/driver-adapter-utils@5.20.0(transitive)
- Removed@prisma/debug@5.11.0(transitive)
- Removed@prisma/driver-adapter-utils@5.11.0(transitive)