@prisma/adapter-neon 6.7.0-dev.3 → 6.7.0-integration-push-sunrovnkrkpv.1
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 +15 -92
- package/dist/index.mjs +15 -92
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -368,94 +368,6 @@ function fixArrayBufferValues(values) {
|
|
|
368
368
|
return values;
|
|
369
369
|
}
|
|
370
370
|
|
|
371
|
-
// src/errors.ts
|
|
372
|
-
function convertDriverError(error) {
|
|
373
|
-
if (!isDbError(error)) {
|
|
374
|
-
throw error;
|
|
375
|
-
}
|
|
376
|
-
switch (error.code) {
|
|
377
|
-
case "22001":
|
|
378
|
-
return {
|
|
379
|
-
kind: "LengthMismatch",
|
|
380
|
-
column: error.column
|
|
381
|
-
};
|
|
382
|
-
case "23505":
|
|
383
|
-
return {
|
|
384
|
-
kind: "UniqueConstraintViolation",
|
|
385
|
-
fields: error.detail?.match(/Key \(([^)]+)\)/)?.at(1)?.split(", ") ?? []
|
|
386
|
-
};
|
|
387
|
-
case "23502":
|
|
388
|
-
return {
|
|
389
|
-
kind: "NullConstraintViolation",
|
|
390
|
-
fields: error.detail?.match(/Key \(([^)]+)\)/)?.at(1)?.split(", ") ?? []
|
|
391
|
-
};
|
|
392
|
-
case "23503": {
|
|
393
|
-
let constraint;
|
|
394
|
-
if (error.column) {
|
|
395
|
-
constraint = { fields: [error.column] };
|
|
396
|
-
} else if (error.constraint) {
|
|
397
|
-
constraint = { index: error.constraint };
|
|
398
|
-
}
|
|
399
|
-
return {
|
|
400
|
-
kind: "ForeignKeyConstraintViolation",
|
|
401
|
-
constraint
|
|
402
|
-
};
|
|
403
|
-
}
|
|
404
|
-
case "3D000":
|
|
405
|
-
return {
|
|
406
|
-
kind: "DatabaseDoesNotExist",
|
|
407
|
-
db: error.message.split(" ").at(1)?.split('"').at(1)
|
|
408
|
-
};
|
|
409
|
-
case "28000":
|
|
410
|
-
return {
|
|
411
|
-
kind: "DatabaseAccessDenied",
|
|
412
|
-
db: error.message.split(" ").at(5)?.split('"').at(1)
|
|
413
|
-
};
|
|
414
|
-
case "28P01":
|
|
415
|
-
return {
|
|
416
|
-
kind: "AuthenticationFailed",
|
|
417
|
-
user: error.message.split(" ").pop()?.split('"').at(1)
|
|
418
|
-
};
|
|
419
|
-
case "40001":
|
|
420
|
-
return {
|
|
421
|
-
kind: "TransactionWriteConflict"
|
|
422
|
-
};
|
|
423
|
-
case "42P01":
|
|
424
|
-
return {
|
|
425
|
-
kind: "TableDoesNotExist",
|
|
426
|
-
table: error.message.split(" ").at(1)?.split('"').at(1)
|
|
427
|
-
};
|
|
428
|
-
case "42703":
|
|
429
|
-
return {
|
|
430
|
-
kind: "ColumnNotFound",
|
|
431
|
-
column: error.message.split(" ").at(1)?.split('"').at(1)
|
|
432
|
-
};
|
|
433
|
-
case "42P04":
|
|
434
|
-
return {
|
|
435
|
-
kind: "DatabaseAlreadyExists",
|
|
436
|
-
db: error.message.split(" ").at(1)?.split('"').at(1)
|
|
437
|
-
};
|
|
438
|
-
case "53300":
|
|
439
|
-
return {
|
|
440
|
-
kind: "TooManyConnections",
|
|
441
|
-
cause: error.message
|
|
442
|
-
};
|
|
443
|
-
default:
|
|
444
|
-
return {
|
|
445
|
-
kind: "postgres",
|
|
446
|
-
code: error.code ?? "N/A",
|
|
447
|
-
severity: error.severity ?? "N/A",
|
|
448
|
-
message: error.message,
|
|
449
|
-
detail: error.detail,
|
|
450
|
-
column: error.column,
|
|
451
|
-
hint: error.hint
|
|
452
|
-
};
|
|
453
|
-
}
|
|
454
|
-
}
|
|
455
|
-
function isDbError(error) {
|
|
456
|
-
return typeof error.code === "string" && typeof error.message === "string" && typeof error.severity === "string" && (typeof error.detail === "string" || error.detail === void 0) && (typeof error.column === "string" || error.column === void 0) && (typeof error.hint === "string" || error.hint === void 0);
|
|
457
|
-
}
|
|
458
|
-
|
|
459
371
|
// src/neon.ts
|
|
460
372
|
var debug = (0, import_driver_adapter_utils2.Debug)("prisma:driver-adapter:neon");
|
|
461
373
|
var NeonQueryable = class {
|
|
@@ -541,7 +453,18 @@ var NeonWsQueryable = class extends NeonQueryable {
|
|
|
541
453
|
}
|
|
542
454
|
onError(e) {
|
|
543
455
|
debug("Error in onError: %O", e);
|
|
544
|
-
|
|
456
|
+
if (e && typeof e.code === "string" && typeof e.severity === "string" && typeof e.message === "string") {
|
|
457
|
+
throw new import_driver_adapter_utils2.DriverAdapterError({
|
|
458
|
+
kind: "postgres",
|
|
459
|
+
code: e.code,
|
|
460
|
+
severity: e.severity,
|
|
461
|
+
message: e.message,
|
|
462
|
+
detail: e.detail,
|
|
463
|
+
column: e.column,
|
|
464
|
+
hint: e.hint
|
|
465
|
+
});
|
|
466
|
+
}
|
|
467
|
+
throw e;
|
|
545
468
|
}
|
|
546
469
|
};
|
|
547
470
|
var NeonTransaction = class extends NeonWsQueryable {
|
|
@@ -573,9 +496,9 @@ var PrismaNeonAdapter = class extends NeonWsQueryable {
|
|
|
573
496
|
};
|
|
574
497
|
const tag = "[js::startTransaction]";
|
|
575
498
|
debug("%s options: %O", tag, options);
|
|
576
|
-
const conn = await this.client.connect()
|
|
499
|
+
const conn = await this.client.connect();
|
|
500
|
+
const tx = new NeonTransaction(conn, options);
|
|
577
501
|
try {
|
|
578
|
-
const tx = new NeonTransaction(conn, options);
|
|
579
502
|
await tx.executeRaw({ sql: "BEGIN", args: [], argTypes: [] });
|
|
580
503
|
if (isolationLevel) {
|
|
581
504
|
await tx.executeRaw({
|
|
@@ -587,7 +510,7 @@ var PrismaNeonAdapter = class extends NeonWsQueryable {
|
|
|
587
510
|
return tx;
|
|
588
511
|
} catch (error) {
|
|
589
512
|
conn.release(error);
|
|
590
|
-
|
|
513
|
+
throw error;
|
|
591
514
|
}
|
|
592
515
|
}
|
|
593
516
|
getConnectionInfo() {
|
package/dist/index.mjs
CHANGED
|
@@ -331,94 +331,6 @@ function fixArrayBufferValues(values) {
|
|
|
331
331
|
return values;
|
|
332
332
|
}
|
|
333
333
|
|
|
334
|
-
// src/errors.ts
|
|
335
|
-
function convertDriverError(error) {
|
|
336
|
-
if (!isDbError(error)) {
|
|
337
|
-
throw error;
|
|
338
|
-
}
|
|
339
|
-
switch (error.code) {
|
|
340
|
-
case "22001":
|
|
341
|
-
return {
|
|
342
|
-
kind: "LengthMismatch",
|
|
343
|
-
column: error.column
|
|
344
|
-
};
|
|
345
|
-
case "23505":
|
|
346
|
-
return {
|
|
347
|
-
kind: "UniqueConstraintViolation",
|
|
348
|
-
fields: error.detail?.match(/Key \(([^)]+)\)/)?.at(1)?.split(", ") ?? []
|
|
349
|
-
};
|
|
350
|
-
case "23502":
|
|
351
|
-
return {
|
|
352
|
-
kind: "NullConstraintViolation",
|
|
353
|
-
fields: error.detail?.match(/Key \(([^)]+)\)/)?.at(1)?.split(", ") ?? []
|
|
354
|
-
};
|
|
355
|
-
case "23503": {
|
|
356
|
-
let constraint;
|
|
357
|
-
if (error.column) {
|
|
358
|
-
constraint = { fields: [error.column] };
|
|
359
|
-
} else if (error.constraint) {
|
|
360
|
-
constraint = { index: error.constraint };
|
|
361
|
-
}
|
|
362
|
-
return {
|
|
363
|
-
kind: "ForeignKeyConstraintViolation",
|
|
364
|
-
constraint
|
|
365
|
-
};
|
|
366
|
-
}
|
|
367
|
-
case "3D000":
|
|
368
|
-
return {
|
|
369
|
-
kind: "DatabaseDoesNotExist",
|
|
370
|
-
db: error.message.split(" ").at(1)?.split('"').at(1)
|
|
371
|
-
};
|
|
372
|
-
case "28000":
|
|
373
|
-
return {
|
|
374
|
-
kind: "DatabaseAccessDenied",
|
|
375
|
-
db: error.message.split(" ").at(5)?.split('"').at(1)
|
|
376
|
-
};
|
|
377
|
-
case "28P01":
|
|
378
|
-
return {
|
|
379
|
-
kind: "AuthenticationFailed",
|
|
380
|
-
user: error.message.split(" ").pop()?.split('"').at(1)
|
|
381
|
-
};
|
|
382
|
-
case "40001":
|
|
383
|
-
return {
|
|
384
|
-
kind: "TransactionWriteConflict"
|
|
385
|
-
};
|
|
386
|
-
case "42P01":
|
|
387
|
-
return {
|
|
388
|
-
kind: "TableDoesNotExist",
|
|
389
|
-
table: error.message.split(" ").at(1)?.split('"').at(1)
|
|
390
|
-
};
|
|
391
|
-
case "42703":
|
|
392
|
-
return {
|
|
393
|
-
kind: "ColumnNotFound",
|
|
394
|
-
column: error.message.split(" ").at(1)?.split('"').at(1)
|
|
395
|
-
};
|
|
396
|
-
case "42P04":
|
|
397
|
-
return {
|
|
398
|
-
kind: "DatabaseAlreadyExists",
|
|
399
|
-
db: error.message.split(" ").at(1)?.split('"').at(1)
|
|
400
|
-
};
|
|
401
|
-
case "53300":
|
|
402
|
-
return {
|
|
403
|
-
kind: "TooManyConnections",
|
|
404
|
-
cause: error.message
|
|
405
|
-
};
|
|
406
|
-
default:
|
|
407
|
-
return {
|
|
408
|
-
kind: "postgres",
|
|
409
|
-
code: error.code ?? "N/A",
|
|
410
|
-
severity: error.severity ?? "N/A",
|
|
411
|
-
message: error.message,
|
|
412
|
-
detail: error.detail,
|
|
413
|
-
column: error.column,
|
|
414
|
-
hint: error.hint
|
|
415
|
-
};
|
|
416
|
-
}
|
|
417
|
-
}
|
|
418
|
-
function isDbError(error) {
|
|
419
|
-
return typeof error.code === "string" && typeof error.message === "string" && typeof error.severity === "string" && (typeof error.detail === "string" || error.detail === void 0) && (typeof error.column === "string" || error.column === void 0) && (typeof error.hint === "string" || error.hint === void 0);
|
|
420
|
-
}
|
|
421
|
-
|
|
422
334
|
// src/neon.ts
|
|
423
335
|
var debug = Debug("prisma:driver-adapter:neon");
|
|
424
336
|
var NeonQueryable = class {
|
|
@@ -504,7 +416,18 @@ var NeonWsQueryable = class extends NeonQueryable {
|
|
|
504
416
|
}
|
|
505
417
|
onError(e) {
|
|
506
418
|
debug("Error in onError: %O", e);
|
|
507
|
-
|
|
419
|
+
if (e && typeof e.code === "string" && typeof e.severity === "string" && typeof e.message === "string") {
|
|
420
|
+
throw new DriverAdapterError({
|
|
421
|
+
kind: "postgres",
|
|
422
|
+
code: e.code,
|
|
423
|
+
severity: e.severity,
|
|
424
|
+
message: e.message,
|
|
425
|
+
detail: e.detail,
|
|
426
|
+
column: e.column,
|
|
427
|
+
hint: e.hint
|
|
428
|
+
});
|
|
429
|
+
}
|
|
430
|
+
throw e;
|
|
508
431
|
}
|
|
509
432
|
};
|
|
510
433
|
var NeonTransaction = class extends NeonWsQueryable {
|
|
@@ -536,9 +459,9 @@ var PrismaNeonAdapter = class extends NeonWsQueryable {
|
|
|
536
459
|
};
|
|
537
460
|
const tag = "[js::startTransaction]";
|
|
538
461
|
debug("%s options: %O", tag, options);
|
|
539
|
-
const conn = await this.client.connect()
|
|
462
|
+
const conn = await this.client.connect();
|
|
463
|
+
const tx = new NeonTransaction(conn, options);
|
|
540
464
|
try {
|
|
541
|
-
const tx = new NeonTransaction(conn, options);
|
|
542
465
|
await tx.executeRaw({ sql: "BEGIN", args: [], argTypes: [] });
|
|
543
466
|
if (isolationLevel) {
|
|
544
467
|
await tx.executeRaw({
|
|
@@ -550,7 +473,7 @@ var PrismaNeonAdapter = class extends NeonWsQueryable {
|
|
|
550
473
|
return tx;
|
|
551
474
|
} catch (error) {
|
|
552
475
|
conn.release(error);
|
|
553
|
-
|
|
476
|
+
throw error;
|
|
554
477
|
}
|
|
555
478
|
}
|
|
556
479
|
getConnectionInfo() {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@prisma/adapter-neon",
|
|
3
|
-
"version": "6.7.0-
|
|
3
|
+
"version": "6.7.0-integration-push-sunrovnkrkpv.1",
|
|
4
4
|
"description": "Prisma's driver adapter for \"@neondatabase/serverless\"",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"sideEffects": false,
|
|
33
33
|
"dependencies": {
|
|
34
34
|
"postgres-array": "3.0.4",
|
|
35
|
-
"@prisma/driver-adapter-utils": "6.7.0-
|
|
35
|
+
"@prisma/driver-adapter-utils": "6.7.0-integration-push-sunrovnkrkpv.1"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
38
|
"@neondatabase/serverless": "0.10.2",
|