@prisma/adapter-planetscale 6.10.0-dev.2 → 6.10.0-dev.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +16 -0
- package/dist/index.mjs +16 -0
- package/package.json +3 -2
package/dist/index.js
CHANGED
|
@@ -37,6 +37,7 @@ module.exports = __toCommonJS(index_exports);
|
|
|
37
37
|
// src/planetscale.ts
|
|
38
38
|
var planetScale = __toESM(require("@planetscale/database"));
|
|
39
39
|
var import_driver_adapter_utils2 = require("@prisma/driver-adapter-utils");
|
|
40
|
+
var import_async_mutex = require("async-mutex");
|
|
40
41
|
|
|
41
42
|
// package.json
|
|
42
43
|
var name = "@prisma/adapter-planetscale";
|
|
@@ -221,6 +222,7 @@ function parseErrorMessage(message) {
|
|
|
221
222
|
return void 0;
|
|
222
223
|
}
|
|
223
224
|
}
|
|
225
|
+
var LOCK_TAG = Symbol();
|
|
224
226
|
var PlanetScaleTransaction = class extends PlanetScaleQueryable {
|
|
225
227
|
constructor(tx, options, txDeferred, txResultPromise) {
|
|
226
228
|
super(tx);
|
|
@@ -228,6 +230,20 @@ var PlanetScaleTransaction = class extends PlanetScaleQueryable {
|
|
|
228
230
|
this.txDeferred = txDeferred;
|
|
229
231
|
this.txResultPromise = txResultPromise;
|
|
230
232
|
}
|
|
233
|
+
// The PlanetScale connection objects are not meant to be used concurrently,
|
|
234
|
+
// so we override the `performIO` method to synchronize access to it with a mutex.
|
|
235
|
+
// See: https://github.com/mattrobenolt/ps-http-sim/issues/7
|
|
236
|
+
[LOCK_TAG] = new import_async_mutex.Mutex();
|
|
237
|
+
async performIO(query) {
|
|
238
|
+
const release = await this[LOCK_TAG].acquire();
|
|
239
|
+
try {
|
|
240
|
+
return await super.performIO(query);
|
|
241
|
+
} catch (e) {
|
|
242
|
+
onError(e);
|
|
243
|
+
} finally {
|
|
244
|
+
release();
|
|
245
|
+
}
|
|
246
|
+
}
|
|
231
247
|
async commit() {
|
|
232
248
|
debug(`[js::commit]`);
|
|
233
249
|
this.txDeferred.resolve();
|
package/dist/index.mjs
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
// src/planetscale.ts
|
|
2
2
|
import * as planetScale from "@planetscale/database";
|
|
3
3
|
import { Debug, DriverAdapterError } from "@prisma/driver-adapter-utils";
|
|
4
|
+
import { Mutex } from "async-mutex";
|
|
4
5
|
|
|
5
6
|
// package.json
|
|
6
7
|
var name = "@prisma/adapter-planetscale";
|
|
@@ -185,6 +186,7 @@ function parseErrorMessage(message) {
|
|
|
185
186
|
return void 0;
|
|
186
187
|
}
|
|
187
188
|
}
|
|
189
|
+
var LOCK_TAG = Symbol();
|
|
188
190
|
var PlanetScaleTransaction = class extends PlanetScaleQueryable {
|
|
189
191
|
constructor(tx, options, txDeferred, txResultPromise) {
|
|
190
192
|
super(tx);
|
|
@@ -192,6 +194,20 @@ var PlanetScaleTransaction = class extends PlanetScaleQueryable {
|
|
|
192
194
|
this.txDeferred = txDeferred;
|
|
193
195
|
this.txResultPromise = txResultPromise;
|
|
194
196
|
}
|
|
197
|
+
// The PlanetScale connection objects are not meant to be used concurrently,
|
|
198
|
+
// so we override the `performIO` method to synchronize access to it with a mutex.
|
|
199
|
+
// See: https://github.com/mattrobenolt/ps-http-sim/issues/7
|
|
200
|
+
[LOCK_TAG] = new Mutex();
|
|
201
|
+
async performIO(query) {
|
|
202
|
+
const release = await this[LOCK_TAG].acquire();
|
|
203
|
+
try {
|
|
204
|
+
return await super.performIO(query);
|
|
205
|
+
} catch (e) {
|
|
206
|
+
onError(e);
|
|
207
|
+
} finally {
|
|
208
|
+
release();
|
|
209
|
+
}
|
|
210
|
+
}
|
|
195
211
|
async commit() {
|
|
196
212
|
debug(`[js::commit]`);
|
|
197
213
|
this.txDeferred.resolve();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@prisma/adapter-planetscale",
|
|
3
|
-
"version": "6.10.0-dev.
|
|
3
|
+
"version": "6.10.0-dev.3",
|
|
4
4
|
"description": "Prisma's driver adapter for \"@planetscale/database\"",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -31,7 +31,8 @@
|
|
|
31
31
|
"license": "Apache-2.0",
|
|
32
32
|
"sideEffects": false,
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"
|
|
34
|
+
"async-mutex": "0.5.0",
|
|
35
|
+
"@prisma/driver-adapter-utils": "6.10.0-dev.3"
|
|
35
36
|
},
|
|
36
37
|
"devDependencies": {
|
|
37
38
|
"@planetscale/database": "1.19.0",
|