@prisma/adapter-d1 7.3.0-integration-prisma6-fix-cloudflare-engine.2 → 7.3.0-integration-engines-7-3-0-10-fix-fix-mapped-enum-issue-0b7e6564db7dc3dac7f9312aa84e9ed81d805521.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.
@@ -0,0 +1,57 @@
1
+ import { D1Database as D1Database_2 } from '@cloudflare/workers-types';
2
+ import { SqlDriverAdapter } from '@prisma/driver-adapter-utils';
3
+ import { SqlDriverAdapterFactory } from '@prisma/driver-adapter-utils';
4
+ import { SqlMigrationAwareDriverAdapterFactory } from '@prisma/driver-adapter-utils';
5
+
6
+ declare type D1HttpParams = {
7
+ CLOUDFLARE_D1_TOKEN: string;
8
+ CLOUDFLARE_ACCOUNT_ID: string;
9
+ CLOUDFLARE_DATABASE_ID: string;
10
+ CLOUDFLARE_SHADOW_DATABASE_ID?: string;
11
+ };
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
+ * datasource: {
28
+ * url: `file:${listLocalDatabases().pop()}`,
29
+ * },
30
+ * })
31
+ * ```
32
+ */
33
+ export declare function listLocalDatabases(): string[];
34
+
35
+ export declare class PrismaD1<Args extends D1Database_2 | D1HttpParams = D1Database_2> implements PrismaD1Interface<Args> {
36
+ readonly provider = "sqlite";
37
+ readonly adapterName: string;
38
+ connect: PrismaD1Interface<Args>['connect'];
39
+ connectToShadowDb: PrismaD1Interface<Args>['connectToShadowDb'];
40
+ constructor(params: Args);
41
+ }
42
+
43
+ /** @deprecated Use PrismaD1 instead */
44
+ export declare class PrismaD1Http implements SqlMigrationAwareDriverAdapterFactory {
45
+ private params;
46
+ readonly provider = "sqlite";
47
+ readonly adapterName: string;
48
+ constructor(params: D1HttpParams);
49
+ connect(): Promise<SqlDriverAdapter>;
50
+ connectToShadowDb(): Promise<SqlDriverAdapter>;
51
+ }
52
+
53
+ declare type PrismaD1Interface<Params> = SqlDriverAdapterFactory & {
54
+ connectToShadowDb: Params extends D1HttpParams ? () => Promise<SqlDriverAdapter> : undefined;
55
+ };
56
+
57
+ export { }
@@ -0,0 +1,57 @@
1
+ import { D1Database as D1Database_2 } from '@cloudflare/workers-types';
2
+ import { SqlDriverAdapter } from '@prisma/driver-adapter-utils';
3
+ import { SqlDriverAdapterFactory } from '@prisma/driver-adapter-utils';
4
+ import { SqlMigrationAwareDriverAdapterFactory } from '@prisma/driver-adapter-utils';
5
+
6
+ declare type D1HttpParams = {
7
+ CLOUDFLARE_D1_TOKEN: string;
8
+ CLOUDFLARE_ACCOUNT_ID: string;
9
+ CLOUDFLARE_DATABASE_ID: string;
10
+ CLOUDFLARE_SHADOW_DATABASE_ID?: string;
11
+ };
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
+ * datasource: {
28
+ * url: `file:${listLocalDatabases().pop()}`,
29
+ * },
30
+ * })
31
+ * ```
32
+ */
33
+ export declare function listLocalDatabases(): string[];
34
+
35
+ export declare class PrismaD1<Args extends D1Database_2 | D1HttpParams = D1Database_2> implements PrismaD1Interface<Args> {
36
+ readonly provider = "sqlite";
37
+ readonly adapterName: string;
38
+ connect: PrismaD1Interface<Args>['connect'];
39
+ connectToShadowDb: PrismaD1Interface<Args>['connectToShadowDb'];
40
+ constructor(params: Args);
41
+ }
42
+
43
+ /** @deprecated Use PrismaD1 instead */
44
+ export declare class PrismaD1Http implements SqlMigrationAwareDriverAdapterFactory {
45
+ private params;
46
+ readonly provider = "sqlite";
47
+ readonly adapterName: string;
48
+ constructor(params: D1HttpParams);
49
+ connect(): Promise<SqlDriverAdapter>;
50
+ connectToShadowDb(): Promise<SqlDriverAdapter>;
51
+ }
52
+
53
+ declare type PrismaD1Interface<Params> = SqlDriverAdapterFactory & {
54
+ connectToShadowDb: Params extends D1HttpParams ? () => Promise<SqlDriverAdapter> : undefined;
55
+ };
56
+
57
+ export { }