@prisma/adapter-d1 6.19.0-integration-next.22 → 6.20.0-integration-next.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.d.mts +23 -0
- package/dist/index.d.ts +23 -0
- package/dist/index.js +15 -2
- package/dist/index.mjs +13 -1
- package/package.json +2 -2
package/dist/index.d.mts
CHANGED
|
@@ -10,6 +10,29 @@ declare type D1HttpParams = {
|
|
|
10
10
|
CLOUDFLARE_SHADOW_DATABASE_ID?: string;
|
|
11
11
|
};
|
|
12
12
|
|
|
13
|
+
/**
|
|
14
|
+
* Lists all local D1 databases found in the Wrangler state directory.
|
|
15
|
+
*
|
|
16
|
+
* This function scans the `.wrangler/state/v3/d1/miniflare-D1DatabaseObject` directory
|
|
17
|
+
* for SQLite database files and returns their paths.
|
|
18
|
+
*
|
|
19
|
+
* @returns An array of file paths to local D1 database files
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* ```typescript
|
|
23
|
+
* import { defineConfig } from '@prisma/config'
|
|
24
|
+
* import { listLocalDatabases } from '@prisma/adapter-d1'
|
|
25
|
+
*
|
|
26
|
+
* export default defineConfig({
|
|
27
|
+
* engine: 'classic',
|
|
28
|
+
* datasource: {
|
|
29
|
+
* url: `file:${listLocalDatabases().pop()}`,
|
|
30
|
+
* },
|
|
31
|
+
* })
|
|
32
|
+
* ```
|
|
33
|
+
*/
|
|
34
|
+
export declare function listLocalDatabases(): string[];
|
|
35
|
+
|
|
13
36
|
export declare class PrismaD1<Args extends D1Database_2 | D1HttpParams = D1Database_2> implements PrismaD1Interface<Args> {
|
|
14
37
|
readonly provider = "sqlite";
|
|
15
38
|
readonly adapterName: string;
|
package/dist/index.d.ts
CHANGED
|
@@ -10,6 +10,29 @@ declare type D1HttpParams = {
|
|
|
10
10
|
CLOUDFLARE_SHADOW_DATABASE_ID?: string;
|
|
11
11
|
};
|
|
12
12
|
|
|
13
|
+
/**
|
|
14
|
+
* Lists all local D1 databases found in the Wrangler state directory.
|
|
15
|
+
*
|
|
16
|
+
* This function scans the `.wrangler/state/v3/d1/miniflare-D1DatabaseObject` directory
|
|
17
|
+
* for SQLite database files and returns their paths.
|
|
18
|
+
*
|
|
19
|
+
* @returns An array of file paths to local D1 database files
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* ```typescript
|
|
23
|
+
* import { defineConfig } from '@prisma/config'
|
|
24
|
+
* import { listLocalDatabases } from '@prisma/adapter-d1'
|
|
25
|
+
*
|
|
26
|
+
* export default defineConfig({
|
|
27
|
+
* engine: 'classic',
|
|
28
|
+
* datasource: {
|
|
29
|
+
* url: `file:${listLocalDatabases().pop()}`,
|
|
30
|
+
* },
|
|
31
|
+
* })
|
|
32
|
+
* ```
|
|
33
|
+
*/
|
|
34
|
+
export declare function listLocalDatabases(): string[];
|
|
35
|
+
|
|
13
36
|
export declare class PrismaD1<Args extends D1Database_2 | D1HttpParams = D1Database_2> implements PrismaD1Interface<Args> {
|
|
14
37
|
readonly provider = "sqlite";
|
|
15
38
|
readonly adapterName: string;
|
package/dist/index.js
CHANGED
|
@@ -31,10 +31,15 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
31
31
|
var index_exports = {};
|
|
32
32
|
__export(index_exports, {
|
|
33
33
|
PrismaD1: () => PrismaD1,
|
|
34
|
-
PrismaD1Http: () => PrismaD1HttpAdapterFactory
|
|
34
|
+
PrismaD1Http: () => PrismaD1HttpAdapterFactory,
|
|
35
|
+
listLocalDatabases: () => listLocalDatabases
|
|
35
36
|
});
|
|
36
37
|
module.exports = __toCommonJS(index_exports);
|
|
37
38
|
|
|
39
|
+
// src/d1.ts
|
|
40
|
+
var import_node_fs = __toESM(require("node:fs"));
|
|
41
|
+
var import_node_path = __toESM(require("node:path"));
|
|
42
|
+
|
|
38
43
|
// package.json
|
|
39
44
|
var name = "@prisma/adapter-d1";
|
|
40
45
|
|
|
@@ -709,8 +714,16 @@ var PrismaD1 = class {
|
|
|
709
714
|
}
|
|
710
715
|
}
|
|
711
716
|
};
|
|
717
|
+
var localD1DatabasePath = import_node_path.default.join(".wrangler", "state", "v3", "d1", "miniflare-D1DatabaseObject");
|
|
718
|
+
function listLocalDatabases() {
|
|
719
|
+
const cwd = process.cwd();
|
|
720
|
+
const d1DirPath = import_node_path.default.join(cwd, localD1DatabasePath);
|
|
721
|
+
const files = import_node_fs.default.readdirSync(d1DirPath);
|
|
722
|
+
return files.filter((file) => file.endsWith(".sqlite")).map((file) => import_node_path.default.join(d1DirPath, file));
|
|
723
|
+
}
|
|
712
724
|
// Annotate the CommonJS export names for ESM import in node:
|
|
713
725
|
0 && (module.exports = {
|
|
714
726
|
PrismaD1,
|
|
715
|
-
PrismaD1Http
|
|
727
|
+
PrismaD1Http,
|
|
728
|
+
listLocalDatabases
|
|
716
729
|
});
|
package/dist/index.mjs
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
// src/d1.ts
|
|
2
|
+
import fs from "node:fs";
|
|
3
|
+
import path from "node:path";
|
|
4
|
+
|
|
1
5
|
// package.json
|
|
2
6
|
var name = "@prisma/adapter-d1";
|
|
3
7
|
|
|
@@ -678,7 +682,15 @@ var PrismaD1 = class {
|
|
|
678
682
|
}
|
|
679
683
|
}
|
|
680
684
|
};
|
|
685
|
+
var localD1DatabasePath = path.join(".wrangler", "state", "v3", "d1", "miniflare-D1DatabaseObject");
|
|
686
|
+
function listLocalDatabases() {
|
|
687
|
+
const cwd = process.cwd();
|
|
688
|
+
const d1DirPath = path.join(cwd, localD1DatabasePath);
|
|
689
|
+
const files = fs.readdirSync(d1DirPath);
|
|
690
|
+
return files.filter((file) => file.endsWith(".sqlite")).map((file) => path.join(d1DirPath, file));
|
|
691
|
+
}
|
|
681
692
|
export {
|
|
682
693
|
PrismaD1,
|
|
683
|
-
PrismaD1HttpAdapterFactory as PrismaD1Http
|
|
694
|
+
PrismaD1HttpAdapterFactory as PrismaD1Http,
|
|
695
|
+
listLocalDatabases
|
|
684
696
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@prisma/adapter-d1",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.20.0-integration-next.1",
|
|
4
4
|
"description": "Prisma's driver adapter for Cloudflare D1",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"dependencies": {
|
|
38
38
|
"@cloudflare/workers-types": "^4.20251014.0",
|
|
39
39
|
"ky": "1.7.5",
|
|
40
|
-
"@prisma/driver-adapter-utils": "6.
|
|
40
|
+
"@prisma/driver-adapter-utils": "6.20.0-integration-next.1"
|
|
41
41
|
},
|
|
42
42
|
"scripts": {
|
|
43
43
|
"dev": "DEV=true tsx helpers/build.ts",
|