@prisma/adapter-better-sqlite3 7.10.1 → 7.11.0-dev.2

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 CHANGED
@@ -352,7 +352,7 @@ function inferColumnType(value) {
352
352
  }
353
353
  }
354
354
  function inferObjectType(value) {
355
- if (value instanceof ArrayBuffer) {
355
+ if (value instanceof ArrayBuffer || value instanceof Uint8Array) {
356
356
  return import_driver_adapter_utils.ColumnTypeEnum.Bytes;
357
357
  }
358
358
  throw new UnexpectedTypeError(value);
@@ -619,8 +619,16 @@ var BetterSQLite3Transaction = class extends BetterSQLite3Queryable {
619
619
  };
620
620
  var PrismaBetterSqlite3Adapter = class extends BetterSQLite3Queryable {
621
621
  #mutex = new Mutex();
622
+ #maxBindValues;
622
623
  constructor(client, adapterOptions) {
623
624
  super(client, adapterOptions);
625
+ this.#maxBindValues = readMaxBindValues(client);
626
+ }
627
+ getConnectionInfo() {
628
+ return {
629
+ maxBindValues: this.#maxBindValues,
630
+ supportsRelationJoins: false
631
+ };
624
632
  }
625
633
  executeScript(script) {
626
634
  try {
@@ -674,6 +682,12 @@ var PrismaBetterSqlite3AdapterFactory = class {
674
682
  );
675
683
  }
676
684
  };
685
+ function readMaxBindValues(client) {
686
+ const options = client.pragma("compile_options");
687
+ const option = options.find(({ compile_options }) => compile_options.startsWith("MAX_VARIABLE_NUMBER="));
688
+ const value = Number(option?.compile_options.slice("MAX_VARIABLE_NUMBER=".length));
689
+ return Number.isSafeInteger(value) && value > 0 ? value : void 0;
690
+ }
677
691
  function createBetterSQLite3Client(input) {
678
692
  const { url, ...config } = input;
679
693
  const dbPath = url.replace(/^file:/, "");
package/dist/index.mjs CHANGED
@@ -316,7 +316,7 @@ function inferColumnType(value) {
316
316
  }
317
317
  }
318
318
  function inferObjectType(value) {
319
- if (value instanceof ArrayBuffer) {
319
+ if (value instanceof ArrayBuffer || value instanceof Uint8Array) {
320
320
  return ColumnTypeEnum.Bytes;
321
321
  }
322
322
  throw new UnexpectedTypeError(value);
@@ -583,8 +583,16 @@ var BetterSQLite3Transaction = class extends BetterSQLite3Queryable {
583
583
  };
584
584
  var PrismaBetterSqlite3Adapter = class extends BetterSQLite3Queryable {
585
585
  #mutex = new Mutex();
586
+ #maxBindValues;
586
587
  constructor(client, adapterOptions) {
587
588
  super(client, adapterOptions);
589
+ this.#maxBindValues = readMaxBindValues(client);
590
+ }
591
+ getConnectionInfo() {
592
+ return {
593
+ maxBindValues: this.#maxBindValues,
594
+ supportsRelationJoins: false
595
+ };
588
596
  }
589
597
  executeScript(script) {
590
598
  try {
@@ -638,6 +646,12 @@ var PrismaBetterSqlite3AdapterFactory = class {
638
646
  );
639
647
  }
640
648
  };
649
+ function readMaxBindValues(client) {
650
+ const options = client.pragma("compile_options");
651
+ const option = options.find(({ compile_options }) => compile_options.startsWith("MAX_VARIABLE_NUMBER="));
652
+ const value = Number(option?.compile_options.slice("MAX_VARIABLE_NUMBER=".length));
653
+ return Number.isSafeInteger(value) && value > 0 ? value : void 0;
654
+ }
641
655
  function createBetterSQLite3Client(input) {
642
656
  const { url, ...config } = input;
643
657
  const dbPath = url.replace(/^file:/, "");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@prisma/adapter-better-sqlite3",
3
- "version": "7.10.1",
3
+ "version": "7.11.0-dev.2",
4
4
  "description": "Prisma's driver adapter for better-sqlite3, a fast SQLite3 driver for JavaScript runtimes",
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
  "better-sqlite3": "^12.6.0",
35
- "@prisma/driver-adapter-utils": "7.10.1"
35
+ "@prisma/driver-adapter-utils": "7.11.0-dev.2"
36
36
  },
37
37
  "devDependencies": {
38
38
  "@types/better-sqlite3": "7.6.12",
@@ -40,7 +40,6 @@
40
40
  },
41
41
  "scripts": {
42
42
  "dev": "DEV=true tsx helpers/build.ts",
43
- "build": "tsx helpers/build.ts",
44
- "test": "vitest run"
43
+ "build": "tsx helpers/build.ts"
45
44
  }
46
45
  }