@prisma/adapter-neon 6.15.0-dev.3 → 6.15.0-dev.4
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 +29 -15
- package/dist/index.mjs +29 -15
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -354,20 +354,35 @@ var customParsers = {
|
|
|
354
354
|
[ArrayColumnType.VARBIT_ARRAY]: normalize_array(normalizeBit),
|
|
355
355
|
[ArrayColumnType.XML_ARRAY]: normalize_array(normalize_xml)
|
|
356
356
|
};
|
|
357
|
-
function
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
357
|
+
function mapArg(arg, argType) {
|
|
358
|
+
if (arg === null) {
|
|
359
|
+
return null;
|
|
360
|
+
}
|
|
361
|
+
if (Array.isArray(arg) && argType.arity === "list") {
|
|
362
|
+
return arg.map((value) => mapArg(value, argType));
|
|
363
|
+
}
|
|
364
|
+
if (typeof arg === "string" && argType.scalarType === "datetime") {
|
|
365
|
+
arg = new Date(arg);
|
|
366
|
+
}
|
|
367
|
+
if (arg instanceof Date) {
|
|
368
|
+
switch (argType.dbType) {
|
|
369
|
+
case "TIME":
|
|
370
|
+
case "TIMETZ":
|
|
371
|
+
return arg.toISOString().split("T")[1];
|
|
372
|
+
default:
|
|
373
|
+
return arg.toISOString();
|
|
368
374
|
}
|
|
369
375
|
}
|
|
370
|
-
|
|
376
|
+
if (typeof arg === "string" && argType.scalarType === "bytes") {
|
|
377
|
+
return Buffer.from(arg, "base64");
|
|
378
|
+
}
|
|
379
|
+
if (Array.isArray(arg) && argType.scalarType === "bytes") {
|
|
380
|
+
return Buffer.from(arg);
|
|
381
|
+
}
|
|
382
|
+
if (ArrayBuffer.isView(arg)) {
|
|
383
|
+
return Buffer.from(arg.buffer, arg.byteOffset, arg.byteLength);
|
|
384
|
+
}
|
|
385
|
+
return arg;
|
|
371
386
|
}
|
|
372
387
|
|
|
373
388
|
// src/errors.ts
|
|
@@ -522,12 +537,11 @@ var NeonWsQueryable = class extends NeonQueryable {
|
|
|
522
537
|
this.client = client;
|
|
523
538
|
}
|
|
524
539
|
async performIO(query) {
|
|
525
|
-
const { sql, args
|
|
540
|
+
const { sql, args } = query;
|
|
526
541
|
try {
|
|
527
542
|
const result = await this.client.query(
|
|
528
543
|
{
|
|
529
544
|
text: sql,
|
|
530
|
-
values: fixArrayBufferValues(values),
|
|
531
545
|
rowMode: "array",
|
|
532
546
|
types: {
|
|
533
547
|
// This is the error expected:
|
|
@@ -550,7 +564,7 @@ var NeonWsQueryable = class extends NeonQueryable {
|
|
|
550
564
|
}
|
|
551
565
|
}
|
|
552
566
|
},
|
|
553
|
-
|
|
567
|
+
args.map((arg, i) => mapArg(arg, query.argTypes[i]))
|
|
554
568
|
);
|
|
555
569
|
return result;
|
|
556
570
|
} catch (e) {
|
package/dist/index.mjs
CHANGED
|
@@ -317,20 +317,35 @@ var customParsers = {
|
|
|
317
317
|
[ArrayColumnType.VARBIT_ARRAY]: normalize_array(normalizeBit),
|
|
318
318
|
[ArrayColumnType.XML_ARRAY]: normalize_array(normalize_xml)
|
|
319
319
|
};
|
|
320
|
-
function
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
320
|
+
function mapArg(arg, argType) {
|
|
321
|
+
if (arg === null) {
|
|
322
|
+
return null;
|
|
323
|
+
}
|
|
324
|
+
if (Array.isArray(arg) && argType.arity === "list") {
|
|
325
|
+
return arg.map((value) => mapArg(value, argType));
|
|
326
|
+
}
|
|
327
|
+
if (typeof arg === "string" && argType.scalarType === "datetime") {
|
|
328
|
+
arg = new Date(arg);
|
|
329
|
+
}
|
|
330
|
+
if (arg instanceof Date) {
|
|
331
|
+
switch (argType.dbType) {
|
|
332
|
+
case "TIME":
|
|
333
|
+
case "TIMETZ":
|
|
334
|
+
return arg.toISOString().split("T")[1];
|
|
335
|
+
default:
|
|
336
|
+
return arg.toISOString();
|
|
331
337
|
}
|
|
332
338
|
}
|
|
333
|
-
|
|
339
|
+
if (typeof arg === "string" && argType.scalarType === "bytes") {
|
|
340
|
+
return Buffer.from(arg, "base64");
|
|
341
|
+
}
|
|
342
|
+
if (Array.isArray(arg) && argType.scalarType === "bytes") {
|
|
343
|
+
return Buffer.from(arg);
|
|
344
|
+
}
|
|
345
|
+
if (ArrayBuffer.isView(arg)) {
|
|
346
|
+
return Buffer.from(arg.buffer, arg.byteOffset, arg.byteLength);
|
|
347
|
+
}
|
|
348
|
+
return arg;
|
|
334
349
|
}
|
|
335
350
|
|
|
336
351
|
// src/errors.ts
|
|
@@ -485,12 +500,11 @@ var NeonWsQueryable = class extends NeonQueryable {
|
|
|
485
500
|
this.client = client;
|
|
486
501
|
}
|
|
487
502
|
async performIO(query) {
|
|
488
|
-
const { sql, args
|
|
503
|
+
const { sql, args } = query;
|
|
489
504
|
try {
|
|
490
505
|
const result = await this.client.query(
|
|
491
506
|
{
|
|
492
507
|
text: sql,
|
|
493
|
-
values: fixArrayBufferValues(values),
|
|
494
508
|
rowMode: "array",
|
|
495
509
|
types: {
|
|
496
510
|
// This is the error expected:
|
|
@@ -513,7 +527,7 @@ var NeonWsQueryable = class extends NeonQueryable {
|
|
|
513
527
|
}
|
|
514
528
|
}
|
|
515
529
|
},
|
|
516
|
-
|
|
530
|
+
args.map((arg, i) => mapArg(arg, query.argTypes[i]))
|
|
517
531
|
);
|
|
518
532
|
return result;
|
|
519
533
|
} catch (e) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@prisma/adapter-neon",
|
|
3
|
-
"version": "6.15.0-dev.
|
|
3
|
+
"version": "6.15.0-dev.4",
|
|
4
4
|
"description": "Prisma's driver adapter for \"@neondatabase/serverless\"",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"dependencies": {
|
|
34
34
|
"postgres-array": "3.0.4",
|
|
35
35
|
"@neondatabase/serverless": ">0.6.0 <2",
|
|
36
|
-
"@prisma/driver-adapter-utils": "6.15.0-dev.
|
|
36
|
+
"@prisma/driver-adapter-utils": "6.15.0-dev.4"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
39
|
"@swc/core": "1.11.5",
|