@prisma/adapter-d1 7.2.0 → 7.3.0-integration-prisma6-fix-cloudflare-engine.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.
@@ -3,14 +3,14 @@ import { SqlDriverAdapter } from '@prisma/driver-adapter-utils';
3
3
  import { SqlDriverAdapterFactory } from '@prisma/driver-adapter-utils';
4
4
  import { SqlMigrationAwareDriverAdapterFactory } from '@prisma/driver-adapter-utils';
5
5
 
6
- declare type D1HttpParams = {
6
+ declare type D1HTTPParams = {
7
7
  CLOUDFLARE_D1_TOKEN: string;
8
8
  CLOUDFLARE_ACCOUNT_ID: string;
9
9
  CLOUDFLARE_DATABASE_ID: string;
10
10
  CLOUDFLARE_SHADOW_DATABASE_ID?: string;
11
11
  };
12
12
 
13
- export declare class PrismaD1<Args extends D1Database_2 | D1HttpParams = D1Database_2> implements PrismaD1Interface<Args> {
13
+ export declare class PrismaD1<Args extends D1Database_2 | D1HTTPParams = D1Database_2> implements PrismaD1Interface<Args> {
14
14
  readonly provider = "sqlite";
15
15
  readonly adapterName: string;
16
16
  connect: PrismaD1Interface<Args>['connect'];
@@ -19,17 +19,17 @@ export declare class PrismaD1<Args extends D1Database_2 | D1HttpParams = D1Datab
19
19
  }
20
20
 
21
21
  /** @deprecated Use PrismaD1 instead */
22
- export declare class PrismaD1Http implements SqlMigrationAwareDriverAdapterFactory {
22
+ export declare class PrismaD1HTTP implements SqlMigrationAwareDriverAdapterFactory {
23
23
  private params;
24
24
  readonly provider = "sqlite";
25
25
  readonly adapterName: string;
26
- constructor(params: D1HttpParams);
26
+ constructor(params: D1HTTPParams);
27
27
  connect(): Promise<SqlDriverAdapter>;
28
28
  connectToShadowDb(): Promise<SqlDriverAdapter>;
29
29
  }
30
30
 
31
31
  declare type PrismaD1Interface<Params> = SqlDriverAdapterFactory & {
32
- connectToShadowDb: Params extends D1HttpParams ? () => Promise<SqlDriverAdapter> : undefined;
32
+ connectToShadowDb: Params extends D1HTTPParams ? () => Promise<SqlDriverAdapter> : undefined;
33
33
  };
34
34
 
35
35
  export { }
@@ -3,14 +3,14 @@ import { SqlDriverAdapter } from '@prisma/driver-adapter-utils';
3
3
  import { SqlDriverAdapterFactory } from '@prisma/driver-adapter-utils';
4
4
  import { SqlMigrationAwareDriverAdapterFactory } from '@prisma/driver-adapter-utils';
5
5
 
6
- declare type D1HttpParams = {
6
+ declare type D1HTTPParams = {
7
7
  CLOUDFLARE_D1_TOKEN: string;
8
8
  CLOUDFLARE_ACCOUNT_ID: string;
9
9
  CLOUDFLARE_DATABASE_ID: string;
10
10
  CLOUDFLARE_SHADOW_DATABASE_ID?: string;
11
11
  };
12
12
 
13
- export declare class PrismaD1<Args extends D1Database_2 | D1HttpParams = D1Database_2> implements PrismaD1Interface<Args> {
13
+ export declare class PrismaD1<Args extends D1Database_2 | D1HTTPParams = D1Database_2> implements PrismaD1Interface<Args> {
14
14
  readonly provider = "sqlite";
15
15
  readonly adapterName: string;
16
16
  connect: PrismaD1Interface<Args>['connect'];
@@ -19,17 +19,17 @@ export declare class PrismaD1<Args extends D1Database_2 | D1HttpParams = D1Datab
19
19
  }
20
20
 
21
21
  /** @deprecated Use PrismaD1 instead */
22
- export declare class PrismaD1Http implements SqlMigrationAwareDriverAdapterFactory {
22
+ export declare class PrismaD1HTTP implements SqlMigrationAwareDriverAdapterFactory {
23
23
  private params;
24
24
  readonly provider = "sqlite";
25
25
  readonly adapterName: string;
26
- constructor(params: D1HttpParams);
26
+ constructor(params: D1HTTPParams);
27
27
  connect(): Promise<SqlDriverAdapter>;
28
28
  connectToShadowDb(): Promise<SqlDriverAdapter>;
29
29
  }
30
30
 
31
31
  declare type PrismaD1Interface<Params> = SqlDriverAdapterFactory & {
32
- connectToShadowDb: Params extends D1HttpParams ? () => Promise<SqlDriverAdapter> : undefined;
32
+ connectToShadowDb: Params extends D1HTTPParams ? () => Promise<SqlDriverAdapter> : undefined;
33
33
  };
34
34
 
35
35
  export { }
@@ -27,13 +27,13 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
27
27
  ));
28
28
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
29
 
30
- // src/index-workerd.ts
31
- var index_workerd_exports = {};
32
- __export(index_workerd_exports, {
30
+ // src/index.ts
31
+ var index_exports = {};
32
+ __export(index_exports, {
33
33
  PrismaD1: () => PrismaD1,
34
- PrismaD1Http: () => PrismaD1HttpAdapterFactory
34
+ PrismaD1HTTP: () => PrismaD1HTTPAdapterFactory
35
35
  });
36
- module.exports = __toCommonJS(index_workerd_exports);
36
+ module.exports = __toCommonJS(index_exports);
37
37
 
38
38
  // package.json
39
39
  var name = "@prisma/adapter-d1";
@@ -165,7 +165,7 @@ function mapRow(result, columnTypes) {
165
165
  for (let i = 0; i < result.length; i++) {
166
166
  const value = result[i];
167
167
  if (value instanceof ArrayBuffer) {
168
- result[i] = new Uint8Array(value);
168
+ result[i] = Array.from(new Uint8Array(value));
169
169
  continue;
170
170
  }
171
171
  if (typeof value === "number" && (columnTypes[i] === import_driver_adapter_utils.ColumnTypeEnum.Int32 || columnTypes[i] === import_driver_adapter_utils.ColumnTypeEnum.Int64) && !Number.isInteger(value)) {
@@ -285,12 +285,12 @@ function isDriverError(error) {
285
285
 
286
286
  // src/d1-http.ts
287
287
  var debug = (0, import_driver_adapter_utils2.Debug)("prisma:driver-adapter:d1-http");
288
- function onUnsuccessfulD1HttpResponse({ errors }) {
288
+ function onUnsuccessfulD1HTTPResponse({ errors }) {
289
289
  debug("D1 HTTP Errors: %O", errors);
290
290
  const error = errors.at(0) ?? { message: "Unknown error", code: GENERIC_SQLITE_ERROR };
291
291
  throw new import_driver_adapter_utils2.DriverAdapterError(convertDriverError(error));
292
292
  }
293
- function onGenericD1HttpError(error) {
293
+ function onGenericD1HTTPError(error) {
294
294
  debug("HTTP Error: %O", error);
295
295
  throw new import_driver_adapter_utils2.DriverAdapterError(convertDriverError(error));
296
296
  }
@@ -309,17 +309,17 @@ async function performRawQuery(client, options) {
309
309
  result: response.result
310
310
  });
311
311
  if (!response.success) {
312
- onUnsuccessfulD1HttpResponse(response);
312
+ onUnsuccessfulD1HTTPResponse(response);
313
313
  }
314
314
  return response.result;
315
315
  } catch (e) {
316
- onGenericD1HttpError(e);
316
+ onGenericD1HTTPError(e);
317
317
  }
318
318
  }
319
- function isD1HttpParams(params) {
319
+ function isD1HTTPParams(params) {
320
320
  return typeof params === "object" && params !== null && "CLOUDFLARE_D1_TOKEN" in params && "CLOUDFLARE_ACCOUNT_ID" in params && "CLOUDFLARE_DATABASE_ID" in params;
321
321
  }
322
- var D1HttpQueryable = class {
322
+ var D1HTTPQueryable = class {
323
323
  constructor(client) {
324
324
  this.client = client;
325
325
  }
@@ -385,7 +385,7 @@ var D1HttpQueryable = class {
385
385
  }
386
386
  }
387
387
  };
388
- var D1HttpTransaction = class extends D1HttpQueryable {
388
+ var D1HTTPTransaction = class extends D1HTTPQueryable {
389
389
  constructor(client, options) {
390
390
  super(client);
391
391
  this.options = options;
@@ -397,7 +397,7 @@ var D1HttpTransaction = class extends D1HttpQueryable {
397
397
  debug(`[js::rollback]`);
398
398
  }
399
399
  };
400
- var PrismaD1HttpAdapter = class extends D1HttpQueryable {
400
+ var PrismaD1HTTPAdapter = class extends D1HTTPQueryable {
401
401
  constructor(params, release) {
402
402
  const D1_API_BASE_URL = `https://api.cloudflare.com/client/v4/accounts/${params.CLOUDFLARE_ACCOUNT_ID}/d1/database/${params.CLOUDFLARE_DATABASE_ID}`;
403
403
  const client = import_ky.default.create({
@@ -467,20 +467,20 @@ var PrismaD1HttpAdapter = class extends D1HttpQueryable {
467
467
  };
468
468
  const tag = "[js::startTransaction]";
469
469
  debug("%s options: %O", tag, options);
470
- return new D1HttpTransaction(this.client, options);
470
+ return new D1HTTPTransaction(this.client, options);
471
471
  }
472
472
  async dispose() {
473
473
  await this.release?.();
474
474
  }
475
475
  };
476
- var PrismaD1HttpAdapterFactory = class {
476
+ var PrismaD1HTTPAdapterFactory = class {
477
477
  constructor(params) {
478
478
  this.params = params;
479
479
  }
480
480
  provider = "sqlite";
481
481
  adapterName = `${name}-http`;
482
482
  async connect() {
483
- return new PrismaD1HttpAdapter(this.params, async () => {
483
+ return new PrismaD1HTTPAdapter(this.params, async () => {
484
484
  });
485
485
  }
486
486
  async connectToShadowDb() {
@@ -505,13 +505,13 @@ var PrismaD1HttpAdapterFactory = class {
505
505
  }).json();
506
506
  debug(`${tag} %O`, response);
507
507
  if (!response.success) {
508
- onUnsuccessfulD1HttpResponse(response);
508
+ onUnsuccessfulD1HTTPResponse(response);
509
509
  }
510
510
  const { uuid: CLOUDFLARE_SHADOW_DATABASE_ID2 } = response.result;
511
511
  debug(`${tag} created database %s with ID %s`, CLOUDFLARE_SHADOW_DATABASE_NAME, CLOUDFLARE_SHADOW_DATABASE_ID2);
512
512
  return CLOUDFLARE_SHADOW_DATABASE_ID2;
513
513
  } catch (e) {
514
- onGenericD1HttpError(e);
514
+ onGenericD1HTTPError(e);
515
515
  }
516
516
  };
517
517
  const CLOUDFLARE_SHADOW_DATABASE_ID = this.params.CLOUDFLARE_SHADOW_DATABASE_ID ?? await createShadowDatabase();
@@ -522,13 +522,13 @@ var PrismaD1HttpAdapterFactory = class {
522
522
  const response = await client.delete(`${D1_API_BASE_URL}/${CLOUDFLARE_SHADOW_DATABASE_ID}`).json();
523
523
  debug(`${tag} %O`, response);
524
524
  if (!response.success) {
525
- onUnsuccessfulD1HttpResponse(response);
525
+ onUnsuccessfulD1HTTPResponse(response);
526
526
  }
527
527
  } catch (e) {
528
- onGenericD1HttpError(e);
528
+ onGenericD1HTTPError(e);
529
529
  }
530
530
  };
531
- return new PrismaD1HttpAdapter(this.params, dispose);
531
+ return new PrismaD1HTTPAdapter(this.params, dispose);
532
532
  }
533
533
  };
534
534
 
@@ -697,8 +697,8 @@ var PrismaD1 = class {
697
697
  connect;
698
698
  connectToShadowDb;
699
699
  constructor(params) {
700
- if (isD1HttpParams(params)) {
701
- const factory = new PrismaD1HttpAdapterFactory(params);
700
+ if (isD1HTTPParams(params)) {
701
+ const factory = new PrismaD1HTTPAdapterFactory(params);
702
702
  const self = this;
703
703
  self.connect = factory.connect.bind(factory);
704
704
  self.connectToShadowDb = factory.connectToShadowDb.bind(factory);
@@ -712,5 +712,5 @@ var PrismaD1 = class {
712
712
  // Annotate the CommonJS export names for ESM import in node:
713
713
  0 && (module.exports = {
714
714
  PrismaD1,
715
- PrismaD1Http
715
+ PrismaD1HTTP
716
716
  });
@@ -131,7 +131,7 @@ function mapRow(result, columnTypes) {
131
131
  for (let i = 0; i < result.length; i++) {
132
132
  const value = result[i];
133
133
  if (value instanceof ArrayBuffer) {
134
- result[i] = new Uint8Array(value);
134
+ result[i] = Array.from(new Uint8Array(value));
135
135
  continue;
136
136
  }
137
137
  if (typeof value === "number" && (columnTypes[i] === ColumnTypeEnum.Int32 || columnTypes[i] === ColumnTypeEnum.Int64) && !Number.isInteger(value)) {
@@ -251,12 +251,12 @@ function isDriverError(error) {
251
251
 
252
252
  // src/d1-http.ts
253
253
  var debug = Debug("prisma:driver-adapter:d1-http");
254
- function onUnsuccessfulD1HttpResponse({ errors }) {
254
+ function onUnsuccessfulD1HTTPResponse({ errors }) {
255
255
  debug("D1 HTTP Errors: %O", errors);
256
256
  const error = errors.at(0) ?? { message: "Unknown error", code: GENERIC_SQLITE_ERROR };
257
257
  throw new DriverAdapterError(convertDriverError(error));
258
258
  }
259
- function onGenericD1HttpError(error) {
259
+ function onGenericD1HTTPError(error) {
260
260
  debug("HTTP Error: %O", error);
261
261
  throw new DriverAdapterError(convertDriverError(error));
262
262
  }
@@ -275,17 +275,17 @@ async function performRawQuery(client, options) {
275
275
  result: response.result
276
276
  });
277
277
  if (!response.success) {
278
- onUnsuccessfulD1HttpResponse(response);
278
+ onUnsuccessfulD1HTTPResponse(response);
279
279
  }
280
280
  return response.result;
281
281
  } catch (e) {
282
- onGenericD1HttpError(e);
282
+ onGenericD1HTTPError(e);
283
283
  }
284
284
  }
285
- function isD1HttpParams(params) {
285
+ function isD1HTTPParams(params) {
286
286
  return typeof params === "object" && params !== null && "CLOUDFLARE_D1_TOKEN" in params && "CLOUDFLARE_ACCOUNT_ID" in params && "CLOUDFLARE_DATABASE_ID" in params;
287
287
  }
288
- var D1HttpQueryable = class {
288
+ var D1HTTPQueryable = class {
289
289
  constructor(client) {
290
290
  this.client = client;
291
291
  }
@@ -351,7 +351,7 @@ var D1HttpQueryable = class {
351
351
  }
352
352
  }
353
353
  };
354
- var D1HttpTransaction = class extends D1HttpQueryable {
354
+ var D1HTTPTransaction = class extends D1HTTPQueryable {
355
355
  constructor(client, options) {
356
356
  super(client);
357
357
  this.options = options;
@@ -363,7 +363,7 @@ var D1HttpTransaction = class extends D1HttpQueryable {
363
363
  debug(`[js::rollback]`);
364
364
  }
365
365
  };
366
- var PrismaD1HttpAdapter = class extends D1HttpQueryable {
366
+ var PrismaD1HTTPAdapter = class extends D1HTTPQueryable {
367
367
  constructor(params, release) {
368
368
  const D1_API_BASE_URL = `https://api.cloudflare.com/client/v4/accounts/${params.CLOUDFLARE_ACCOUNT_ID}/d1/database/${params.CLOUDFLARE_DATABASE_ID}`;
369
369
  const client = ky.create({
@@ -433,20 +433,20 @@ var PrismaD1HttpAdapter = class extends D1HttpQueryable {
433
433
  };
434
434
  const tag = "[js::startTransaction]";
435
435
  debug("%s options: %O", tag, options);
436
- return new D1HttpTransaction(this.client, options);
436
+ return new D1HTTPTransaction(this.client, options);
437
437
  }
438
438
  async dispose() {
439
439
  await this.release?.();
440
440
  }
441
441
  };
442
- var PrismaD1HttpAdapterFactory = class {
442
+ var PrismaD1HTTPAdapterFactory = class {
443
443
  constructor(params) {
444
444
  this.params = params;
445
445
  }
446
446
  provider = "sqlite";
447
447
  adapterName = `${name}-http`;
448
448
  async connect() {
449
- return new PrismaD1HttpAdapter(this.params, async () => {
449
+ return new PrismaD1HTTPAdapter(this.params, async () => {
450
450
  });
451
451
  }
452
452
  async connectToShadowDb() {
@@ -471,13 +471,13 @@ var PrismaD1HttpAdapterFactory = class {
471
471
  }).json();
472
472
  debug(`${tag} %O`, response);
473
473
  if (!response.success) {
474
- onUnsuccessfulD1HttpResponse(response);
474
+ onUnsuccessfulD1HTTPResponse(response);
475
475
  }
476
476
  const { uuid: CLOUDFLARE_SHADOW_DATABASE_ID2 } = response.result;
477
477
  debug(`${tag} created database %s with ID %s`, CLOUDFLARE_SHADOW_DATABASE_NAME, CLOUDFLARE_SHADOW_DATABASE_ID2);
478
478
  return CLOUDFLARE_SHADOW_DATABASE_ID2;
479
479
  } catch (e) {
480
- onGenericD1HttpError(e);
480
+ onGenericD1HTTPError(e);
481
481
  }
482
482
  };
483
483
  const CLOUDFLARE_SHADOW_DATABASE_ID = this.params.CLOUDFLARE_SHADOW_DATABASE_ID ?? await createShadowDatabase();
@@ -488,13 +488,13 @@ var PrismaD1HttpAdapterFactory = class {
488
488
  const response = await client.delete(`${D1_API_BASE_URL}/${CLOUDFLARE_SHADOW_DATABASE_ID}`).json();
489
489
  debug(`${tag} %O`, response);
490
490
  if (!response.success) {
491
- onUnsuccessfulD1HttpResponse(response);
491
+ onUnsuccessfulD1HTTPResponse(response);
492
492
  }
493
493
  } catch (e) {
494
- onGenericD1HttpError(e);
494
+ onGenericD1HTTPError(e);
495
495
  }
496
496
  };
497
- return new PrismaD1HttpAdapter(this.params, dispose);
497
+ return new PrismaD1HTTPAdapter(this.params, dispose);
498
498
  }
499
499
  };
500
500
 
@@ -666,8 +666,8 @@ var PrismaD1 = class {
666
666
  connect;
667
667
  connectToShadowDb;
668
668
  constructor(params) {
669
- if (isD1HttpParams(params)) {
670
- const factory = new PrismaD1HttpAdapterFactory(params);
669
+ if (isD1HTTPParams(params)) {
670
+ const factory = new PrismaD1HTTPAdapterFactory(params);
671
671
  const self = this;
672
672
  self.connect = factory.connect.bind(factory);
673
673
  self.connectToShadowDb = factory.connectToShadowDb.bind(factory);
@@ -680,5 +680,5 @@ var PrismaD1 = class {
680
680
  };
681
681
  export {
682
682
  PrismaD1,
683
- PrismaD1HttpAdapterFactory as PrismaD1Http
683
+ PrismaD1HTTPAdapterFactory as PrismaD1HTTP
684
684
  };
package/package.json CHANGED
@@ -1,32 +1,19 @@
1
1
  {
2
2
  "name": "@prisma/adapter-d1",
3
- "version": "7.2.0",
3
+ "version": "7.3.0-integration-prisma6-fix-cloudflare-engine.1",
4
4
  "description": "Prisma's driver adapter for Cloudflare D1",
5
- "main": "dist/index-node.js",
6
- "module": "dist/index-node.mjs",
7
- "types": "dist/index-node.d.ts",
5
+ "main": "dist/index.js",
6
+ "module": "dist/index.mjs",
7
+ "types": "dist/index.d.ts",
8
8
  "exports": {
9
9
  ".": {
10
- "types": "./dist/index-node.d.ts",
11
- "node": {
12
- "types": "./dist/index-node.d.ts",
13
- "require": "./dist/index-node.js",
14
- "import": "./dist/index-node.mjs"
10
+ "require": {
11
+ "types": "./dist/index.d.ts",
12
+ "default": "./dist/index.js"
15
13
  },
16
- "workerd": {
17
- "types": "./dist/index-workerd.d.ts",
18
- "require": "./dist/index-workerd.js",
19
- "import": "./dist/index-workerd.mjs"
20
- },
21
- "browser": {
22
- "types": "./dist/index-workerd.d.ts",
23
- "require": "./dist/index-workerd.js",
24
- "import": "./dist/index-workerd.mjs"
25
- },
26
- "default": {
27
- "types": "./dist/index-node.d.ts",
28
- "require": "./dist/index-node.js",
29
- "import": "./dist/index-node.mjs"
14
+ "import": {
15
+ "types": "./dist/index.d.mts",
16
+ "default": "./dist/index.mjs"
30
17
  }
31
18
  }
32
19
  },
@@ -48,9 +35,9 @@
48
35
  "license": "Apache-2.0",
49
36
  "sideEffects": false,
50
37
  "dependencies": {
51
- "@cloudflare/workers-types": "^4.20251014.0",
38
+ "@cloudflare/workers-types": "^4.20250408.0",
52
39
  "ky": "1.7.5",
53
- "@prisma/driver-adapter-utils": "7.2.0"
40
+ "@prisma/driver-adapter-utils": "7.3.0-integration-prisma6-fix-cloudflare-engine.1"
54
41
  },
55
42
  "scripts": {
56
43
  "dev": "DEV=true tsx helpers/build.ts",
@@ -1,57 +0,0 @@
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 { }
@@ -1,57 +0,0 @@
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 { }