@drizzle-adapter/d1 1.0.14 → 1.0.17

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.
Files changed (52) hide show
  1. package/.wrangler/tmp/bundle-CHc9gh/checked-fetch.js +30 -0
  2. package/.wrangler/tmp/bundle-CHc9gh/middleware-insertion-facade.js +11 -0
  3. package/.wrangler/tmp/bundle-CHc9gh/middleware-loader.entry.ts +134 -0
  4. package/.wrangler/tmp/bundle-CHc9gh/strip-cf-connecting-ip-header.js +13 -0
  5. package/.wrangler/tmp/bundle-kh10f5/checked-fetch.js +30 -0
  6. package/.wrangler/tmp/bundle-kh10f5/middleware-insertion-facade.js +11 -0
  7. package/.wrangler/tmp/bundle-kh10f5/middleware-loader.entry.ts +134 -0
  8. package/.wrangler/tmp/bundle-kh10f5/strip-cf-connecting-ip-header.js +13 -0
  9. package/.wrangler/tmp/dev-BRrYv0/worker.js +6512 -0
  10. package/.wrangler/tmp/dev-BRrYv0/worker.js.map +8 -0
  11. package/.wrangler/tmp/dev-NlAyrN/worker.js +6512 -0
  12. package/.wrangler/tmp/dev-NlAyrN/worker.js.map +8 -0
  13. package/LICENSE +21 -674
  14. package/dist/Adapter/D1DrizzleAdapter.d.ts +14 -10
  15. package/dist/Adapter/D1DrizzleAdapter.js +16 -12
  16. package/dist/Adapter/D1DrizzleConnection.d.ts +6 -2
  17. package/dist/Adapter/D1DrizzleConnection.js +6 -2
  18. package/dist/Adapter/D1DrizzleDataTypes.d.ts +4 -0
  19. package/dist/Adapter/D1DrizzleDataTypes.js +4 -0
  20. package/dist/Adapter/D1DrizzleMigrator.d.ts +6 -2
  21. package/dist/Adapter/D1DrizzleMigrator.js +5 -1
  22. package/dist/Adapter/index.d.ts +2 -2
  23. package/dist/Adapter/index.js +2 -2
  24. package/dist/Factory/D1DrizzleAdapterFactory.d.ts +8 -4
  25. package/dist/Factory/D1DrizzleAdapterFactory.js +7 -3
  26. package/dist/Factory/D1DrizzleDataTypesFactory.d.ts +5 -1
  27. package/dist/Factory/D1DrizzleDataTypesFactory.js +5 -1
  28. package/dist/Factory/D1DrizzleMigratorFactory.d.ts +7 -3
  29. package/dist/Factory/D1DrizzleMigratorFactory.js +7 -3
  30. package/dist/Factory/index.d.ts +2 -2
  31. package/dist/Factory/index.js +2 -2
  32. package/dist/Interface/D1DrizzleClientInterface.d.ts +5 -1
  33. package/dist/Interface/index.d.ts +1 -1
  34. package/dist/Interface/index.js +1 -1
  35. package/dist/Type/Types.d.ts +4 -0
  36. package/dist/Type/index.d.ts +1 -1
  37. package/dist/Type/index.js +1 -1
  38. package/dist/index.d.ts +5 -5
  39. package/dist/index.js +5 -5
  40. package/dist/migrator.d.ts +3 -3
  41. package/dist/migrator.js +3 -3
  42. package/eslint.config.mjs +1 -1
  43. package/package.json +13 -11
  44. package/src/Adapter/D1DrizzleAdapter.ts +16 -11
  45. package/src/Adapter/D1DrizzleConnection.ts +7 -3
  46. package/src/Adapter/D1DrizzleDataTypes.ts +4 -0
  47. package/src/Adapter/D1DrizzleMigrator.ts +6 -1
  48. package/src/Factory/D1DrizzleAdapterFactory.ts +9 -4
  49. package/src/Factory/D1DrizzleDataTypesFactory.ts +5 -1
  50. package/src/Factory/D1DrizzleMigratorFactory.ts +7 -2
  51. package/src/Interface/D1DrizzleClientInterface.ts +5 -1
  52. package/src/Type/Types.ts +4 -0
@@ -1,31 +1,35 @@
1
1
  import type { D1Database } from '@cloudflare/workers-types';
2
- import { D1DrizzleConnection } from './D1DrizzleConnection';
3
- import { D1DrizzleDataTypes } from './D1DrizzleDataTypes';
4
2
  import type { DrizzleAdapterInterface } from '@drizzle-adapter/core';
3
+ import { D1DrizzleConnection } from './D1DrizzleConnection.js';
4
+ import { D1DrizzleDataTypes } from './D1DrizzleDataTypes.js';
5
+ /**
6
+ * D1 adapter implementation for Drizzle ORM.
7
+ * Provides D1-specific database operations and connection management.
8
+ */
5
9
  export declare class D1DrizzleAdapter implements DrizzleAdapterInterface {
6
10
  private connection;
7
11
  /**
8
12
  * Constructor.
9
13
  *
10
- * @param {D1Database} driver
14
+ * @param {D1Database} driver - The D1 database driver instance
11
15
  */
12
16
  constructor(driver: D1Database);
13
17
  /**
14
- * Returns the dialect.
18
+ * Returns the connection.
15
19
  *
16
- * @returns {string}
20
+ * @returns {Promise<D1DrizzleConnection>} A promise that resolves to the D1 connection instance
17
21
  */
18
- getDialect(): string;
22
+ getConnection(): Promise<D1DrizzleConnection>;
19
23
  /**
20
24
  * Returns the data types.
21
25
  *
22
- * @returns {D1DrizzleDataTypes}
26
+ * @returns {D1DrizzleDataTypes} The D1 data types instance
23
27
  */
24
28
  getDataTypes(): D1DrizzleDataTypes;
25
29
  /**
26
- * Returns the connection.
30
+ * Returns the dialect.
27
31
  *
28
- * @returns {Promise<D1DrizzleConnection>}
32
+ * @returns {string} The database dialect string
29
33
  */
30
- getConnection(): Promise<D1DrizzleConnection>;
34
+ getDialect(): string;
31
35
  }
@@ -1,37 +1,41 @@
1
- import { D1DrizzleConnection } from './D1DrizzleConnection';
2
- import { D1DrizzleDataTypes } from './D1DrizzleDataTypes';
1
+ import { D1DrizzleConnection } from './D1DrizzleConnection.js';
2
+ import { D1DrizzleDataTypes } from './D1DrizzleDataTypes.js';
3
+ /**
4
+ * D1 adapter implementation for Drizzle ORM.
5
+ * Provides D1-specific database operations and connection management.
6
+ */
3
7
  export class D1DrizzleAdapter {
4
8
  connection;
5
9
  /**
6
10
  * Constructor.
7
11
  *
8
- * @param {D1Database} driver
12
+ * @param {D1Database} driver - The D1 database driver instance
9
13
  */
10
14
  constructor(driver) {
11
15
  this.connection = new D1DrizzleConnection(driver);
12
16
  }
13
17
  /**
14
- * Returns the dialect.
18
+ * Returns the connection.
15
19
  *
16
- * @returns {string}
20
+ * @returns {Promise<D1DrizzleConnection>} A promise that resolves to the D1 connection instance
17
21
  */
18
- getDialect() {
19
- return 'sqlite';
22
+ async getConnection() {
23
+ return this.connection.connect();
20
24
  }
21
25
  /**
22
26
  * Returns the data types.
23
27
  *
24
- * @returns {D1DrizzleDataTypes}
28
+ * @returns {D1DrizzleDataTypes} The D1 data types instance
25
29
  */
26
30
  getDataTypes() {
27
31
  return new D1DrizzleDataTypes();
28
32
  }
29
33
  /**
30
- * Returns the connection.
34
+ * Returns the dialect.
31
35
  *
32
- * @returns {Promise<D1DrizzleConnection>}
36
+ * @returns {string} The database dialect string
33
37
  */
34
- async getConnection() {
35
- return this.connection.connect();
38
+ getDialect() {
39
+ return 'sqlite';
36
40
  }
37
41
  }
@@ -1,12 +1,16 @@
1
1
  import type { D1Database } from '@cloudflare/workers-types';
2
2
  import type { DrizzleConnectionInterface } from '@drizzle-adapter/core';
3
3
  import type { D1DrizzleClientInterface } from 'src/Interface';
4
+ /**
5
+ * D1 connection implementation for Drizzle ORM.
6
+ * Manages database connections and provides client access for D1 databases.
7
+ */
4
8
  export declare class D1DrizzleConnection implements DrizzleConnectionInterface {
5
9
  private client;
6
10
  /**
7
11
  * Constructor.
8
12
  *
9
- * @param {D1Database} driver
13
+ * @param {D1Database} driver - The D1 database driver instance
10
14
  */
11
15
  constructor(driver: D1Database);
12
16
  /**
@@ -24,7 +28,7 @@ export declare class D1DrizzleConnection implements DrizzleConnectionInterface {
24
28
  /**
25
29
  * Returns the client.
26
30
  *
27
- * @returns {D1DrizzleClientInterface}
31
+ * @returns {D1DrizzleClientInterface} The D1 Drizzle client instance
28
32
  */
29
33
  getClient(): D1DrizzleClientInterface;
30
34
  }
@@ -1,10 +1,14 @@
1
1
  import { drizzle } from 'drizzle-orm/d1';
2
+ /**
3
+ * D1 connection implementation for Drizzle ORM.
4
+ * Manages database connections and provides client access for D1 databases.
5
+ */
2
6
  export class D1DrizzleConnection {
3
7
  client;
4
8
  /**
5
9
  * Constructor.
6
10
  *
7
- * @param {D1Database} driver
11
+ * @param {D1Database} driver - The D1 database driver instance
8
12
  */
9
13
  constructor(driver) {
10
14
  // We want to add the execute method as an alias for run
@@ -33,7 +37,7 @@ export class D1DrizzleConnection {
33
37
  /**
34
38
  * Returns the client.
35
39
  *
36
- * @returns {D1DrizzleClientInterface}
40
+ * @returns {D1DrizzleClientInterface} The D1 Drizzle client instance
37
41
  */
38
42
  getClient() {
39
43
  return this.client;
@@ -1,3 +1,7 @@
1
1
  import { SqliteCoreDrizzleDataTypes } from '@drizzle-adapter/sqlite-core';
2
+ /**
3
+ * D1 data types implementation for Drizzle ORM.
4
+ * Extends the core SQLite data types with D1-specific functionality.
5
+ */
2
6
  export declare class D1DrizzleDataTypes extends SqliteCoreDrizzleDataTypes {
3
7
  }
@@ -1,3 +1,7 @@
1
1
  import { SqliteCoreDrizzleDataTypes } from '@drizzle-adapter/sqlite-core';
2
+ /**
3
+ * D1 data types implementation for Drizzle ORM.
4
+ * Extends the core SQLite data types with D1-specific functionality.
5
+ */
2
6
  export class D1DrizzleDataTypes extends SqliteCoreDrizzleDataTypes {
3
7
  }
@@ -1,5 +1,9 @@
1
1
  import type { DrizzleMigratorInterface, TypeDrizzleMigratorConfig } from '@drizzle-adapter/core';
2
- import type { D1DrizzleClientInterface } from '../Interface';
2
+ import type { D1DrizzleClientInterface } from '../Interface/index.js';
3
+ /**
4
+ * D1 migrator implementation for Drizzle ORM.
5
+ * Handles database migrations for D1 databases.
6
+ */
3
7
  export declare class D1DrizzleMigrator implements DrizzleMigratorInterface {
4
8
  private readonly config;
5
9
  /**
@@ -11,7 +15,7 @@ export declare class D1DrizzleMigrator implements DrizzleMigratorInterface {
11
15
  /**
12
16
  * Migrate the database.
13
17
  *
14
- * @param {DrizzleClientInterface} client The Drizzle client.
18
+ * @param {D1DrizzleClientInterface} client The Drizzle client.
15
19
  */
16
20
  migrate(client: D1DrizzleClientInterface): Promise<void>;
17
21
  }
@@ -1,4 +1,8 @@
1
1
  import { DrizzleD1Database } from 'drizzle-orm/d1/driver';
2
+ /**
3
+ * D1 migrator implementation for Drizzle ORM.
4
+ * Handles database migrations for D1 databases.
5
+ */
2
6
  export class D1DrizzleMigrator {
3
7
  config;
4
8
  /**
@@ -12,7 +16,7 @@ export class D1DrizzleMigrator {
12
16
  /**
13
17
  * Migrate the database.
14
18
  *
15
- * @param {DrizzleClientInterface} client The Drizzle client.
19
+ * @param {D1DrizzleClientInterface} client The Drizzle client.
16
20
  */
17
21
  async migrate(client) {
18
22
  const { migrate } = await import('drizzle-orm/d1/migrator');
@@ -1,2 +1,2 @@
1
- export * from './D1DrizzleAdapter';
2
- export * from './D1DrizzleConnection';
1
+ export * from './D1DrizzleAdapter.js';
2
+ export * from './D1DrizzleConnection.js';
@@ -1,2 +1,2 @@
1
- export * from './D1DrizzleAdapter';
2
- export * from './D1DrizzleConnection';
1
+ export * from './D1DrizzleAdapter.js';
2
+ export * from './D1DrizzleConnection.js';
@@ -1,12 +1,16 @@
1
- import type { TypeD1DatabaseConfig } from '../Type/Types';
2
- import { D1DrizzleAdapter } from '../Adapter/D1DrizzleAdapter';
3
1
  import type { DrizzleAdapterFactoryInterface } from '@drizzle-adapter/core';
2
+ import { D1DrizzleAdapter } from '../Adapter/D1DrizzleAdapter.js';
3
+ import type { TypeD1DatabaseConfig } from '../Type/Types.js';
4
+ /**
5
+ * Factory for creating D1 adapter instances.
6
+ * Implements the DrizzleAdapterFactoryInterface for D1 database operations.
7
+ */
4
8
  export declare class D1DrizzleAdapterFactory implements DrizzleAdapterFactoryInterface {
5
9
  /**
6
10
  * Returns a adapter.
7
11
  *
8
- * @param {TypeD1DatabaseConfig} databaseConfig
9
- * @returns {D1DrizzleAdapter}
12
+ * @param {TypeD1DatabaseConfig} databaseConfig - The D1 database configuration
13
+ * @returns {D1DrizzleAdapter} A new D1 adapter instance
10
14
  */
11
15
  create(databaseConfig: TypeD1DatabaseConfig): D1DrizzleAdapter;
12
16
  }
@@ -1,10 +1,14 @@
1
- import { D1DrizzleAdapter } from '../Adapter/D1DrizzleAdapter';
1
+ import { D1DrizzleAdapter } from '../Adapter/D1DrizzleAdapter.js';
2
+ /**
3
+ * Factory for creating D1 adapter instances.
4
+ * Implements the DrizzleAdapterFactoryInterface for D1 database operations.
5
+ */
2
6
  export class D1DrizzleAdapterFactory {
3
7
  /**
4
8
  * Returns a adapter.
5
9
  *
6
- * @param {TypeD1DatabaseConfig} databaseConfig
7
- * @returns {D1DrizzleAdapter}
10
+ * @param {TypeD1DatabaseConfig} databaseConfig - The D1 database configuration
11
+ * @returns {D1DrizzleAdapter} A new D1 adapter instance
8
12
  */
9
13
  create(databaseConfig) {
10
14
  return new D1DrizzleAdapter(databaseConfig.DATABASE);
@@ -1,11 +1,15 @@
1
1
  import type { DrizzleDataTypesFactoryInterface, TypeDrizzleDatabaseConfig } from '@drizzle-adapter/core';
2
2
  import { SqliteCoreDrizzleDataTypes } from '@drizzle-adapter/sqlite-core';
3
+ /**
4
+ * Factory for creating D1 data types instances.
5
+ * Implements the DrizzleDataTypesFactoryInterface for D1 database operations.
6
+ */
3
7
  export declare class D1DrizzleDataTypesFactory implements DrizzleDataTypesFactoryInterface {
4
8
  /**
5
9
  * Creates a new data types instance.
6
10
  *
7
11
  * @param {TypeDrizzleDatabaseConfig} _config - Not used in this implementation
8
- * @returns {SqliteCoreDrizzleDataTypes}
12
+ * @returns {SqliteCoreDrizzleDataTypes} A new SQLite core data types instance
9
13
  */
10
14
  create(_config: TypeDrizzleDatabaseConfig): SqliteCoreDrizzleDataTypes;
11
15
  }
@@ -1,10 +1,14 @@
1
1
  import { SqliteCoreDrizzleDataTypes } from '@drizzle-adapter/sqlite-core';
2
+ /**
3
+ * Factory for creating D1 data types instances.
4
+ * Implements the DrizzleDataTypesFactoryInterface for D1 database operations.
5
+ */
2
6
  export class D1DrizzleDataTypesFactory {
3
7
  /**
4
8
  * Creates a new data types instance.
5
9
  *
6
10
  * @param {TypeDrizzleDatabaseConfig} _config - Not used in this implementation
7
- * @returns {SqliteCoreDrizzleDataTypes}
11
+ * @returns {SqliteCoreDrizzleDataTypes} A new SQLite core data types instance
8
12
  */
9
13
  create(_config) {
10
14
  return new SqliteCoreDrizzleDataTypes();
@@ -1,11 +1,15 @@
1
1
  import type { DrizzleMigratorFactoryInterface, TypeDrizzleMigratorConfig } from '@drizzle-adapter/core';
2
- import { D1DrizzleMigrator } from '../migrator';
2
+ import { D1DrizzleMigrator } from '../migrator.js';
3
+ /**
4
+ * Factory for creating D1 migrator instances.
5
+ * Implements the DrizzleMigratorFactoryInterface for D1 database migrations.
6
+ */
3
7
  export declare class D1DrizzleMigratorFactory implements DrizzleMigratorFactoryInterface {
4
8
  /**
5
9
  * Returns a new migrator.
6
10
  *
7
- * @param {TypeDrizzleMigratorConfig} config
8
- * @returns {D1DrizzleMigrator}
11
+ * @param {TypeDrizzleMigratorConfig} config - The migrator configuration
12
+ * @returns {D1DrizzleMigrator} A new D1 migrator instance
9
13
  */
10
14
  create(config: TypeDrizzleMigratorConfig): D1DrizzleMigrator;
11
15
  }
@@ -1,10 +1,14 @@
1
- import { D1DrizzleMigrator } from '../migrator';
1
+ import { D1DrizzleMigrator } from '../migrator.js';
2
+ /**
3
+ * Factory for creating D1 migrator instances.
4
+ * Implements the DrizzleMigratorFactoryInterface for D1 database migrations.
5
+ */
2
6
  export class D1DrizzleMigratorFactory {
3
7
  /**
4
8
  * Returns a new migrator.
5
9
  *
6
- * @param {TypeDrizzleMigratorConfig} config
7
- * @returns {D1DrizzleMigrator}
10
+ * @param {TypeDrizzleMigratorConfig} config - The migrator configuration
11
+ * @returns {D1DrizzleMigrator} A new D1 migrator instance
8
12
  */
9
13
  create(config) {
10
14
  return new D1DrizzleMigrator(config);
@@ -1,2 +1,2 @@
1
- export * from './D1DrizzleAdapterFactory';
2
- export * from './D1DrizzleDataTypesFactory';
1
+ export * from './D1DrizzleAdapterFactory.js';
2
+ export * from './D1DrizzleDataTypesFactory.js';
@@ -1,2 +1,2 @@
1
- export * from './D1DrizzleAdapterFactory';
2
- export * from './D1DrizzleDataTypesFactory';
1
+ export * from './D1DrizzleAdapterFactory.js';
2
+ export * from './D1DrizzleDataTypesFactory.js';
@@ -1,5 +1,9 @@
1
- import type { AnyD1Database } from 'drizzle-orm/d1';
2
1
  import type { DrizzleClientInterface } from '@drizzle-adapter/core';
2
+ import type { AnyD1Database } from 'drizzle-orm/d1';
3
+ /**
4
+ * Interface for D1 Drizzle client operations.
5
+ * Extends the core DrizzleClientInterface with D1-specific database operations.
6
+ */
3
7
  export interface D1DrizzleClientInterface extends DrizzleClientInterface {
4
8
  execute(...args: any[]): ReturnType<AnyD1Database['run']>;
5
9
  $with(...args: any[]): ReturnType<AnyD1Database['$with']>;
@@ -1 +1 @@
1
- export * from './D1DrizzleClientInterface';
1
+ export * from './D1DrizzleClientInterface.js';
@@ -1 +1 @@
1
- export * from './D1DrizzleClientInterface';
1
+ export * from './D1DrizzleClientInterface.js';
@@ -1,5 +1,9 @@
1
1
  import type { D1Database } from '@cloudflare/workers-types';
2
2
  import type { TypeDrizzleDatabaseConfig } from '@drizzle-adapter/core';
3
+ /**
4
+ * Configuration interface for D1 database connections.
5
+ * Extends the core database configuration with D1-specific settings.
6
+ */
3
7
  export interface TypeD1DatabaseConfig extends TypeDrizzleDatabaseConfig {
4
8
  readonly DATABASE: D1Database;
5
9
  }
@@ -1 +1 @@
1
- export * from './Types';
1
+ export * from './Types.js';
@@ -1 +1 @@
1
- export * from './Types';
1
+ export * from './Types.js';
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
- export * from './Adapter';
2
- export * from './Factory';
3
- export * from './Interface';
4
- export * from './Type';
5
- import { D1DrizzleAdapterFactory } from './Factory';
1
+ export * from './Adapter/index.js';
2
+ export * from './Factory/index.js';
3
+ export * from './Interface/index.js';
4
+ export * from './Type/index.js';
5
+ import { D1DrizzleAdapterFactory } from './Factory/index.js';
6
6
  export default D1DrizzleAdapterFactory;
package/dist/index.js CHANGED
@@ -1,9 +1,9 @@
1
- export * from './Adapter';
2
- export * from './Factory';
3
- export * from './Interface';
4
- export * from './Type';
1
+ export * from './Adapter/index.js';
2
+ export * from './Factory/index.js';
3
+ export * from './Interface/index.js';
4
+ export * from './Type/index.js';
5
5
  // default export so that core factory can use it directly
6
- import { D1DrizzleAdapterFactory, D1DrizzleDataTypesFactory } from './Factory';
6
+ import { D1DrizzleAdapterFactory, D1DrizzleDataTypesFactory } from './Factory/index.js';
7
7
  export default D1DrizzleAdapterFactory;
8
8
  import { DrizzleAdapterFactoryRegistry, DrizzleDataTypesFactoryRegistry } from '@drizzle-adapter/core';
9
9
  DrizzleAdapterFactoryRegistry.registerAdapterFactory('d1', D1DrizzleAdapterFactory);
@@ -1,4 +1,4 @@
1
- export * from './Adapter/D1DrizzleMigrator';
2
- export * from './Factory/D1DrizzleMigratorFactory';
3
- import { D1DrizzleMigratorFactory } from './Factory/D1DrizzleMigratorFactory';
1
+ export * from './Adapter/D1DrizzleMigrator.js';
2
+ export * from './Factory/D1DrizzleMigratorFactory.js';
3
+ import { D1DrizzleMigratorFactory } from './Factory/D1DrizzleMigratorFactory.js';
4
4
  export default D1DrizzleMigratorFactory;
package/dist/migrator.js CHANGED
@@ -1,7 +1,7 @@
1
- export * from './Adapter/D1DrizzleMigrator';
2
- export * from './Factory/D1DrizzleMigratorFactory';
1
+ export * from './Adapter/D1DrizzleMigrator.js';
2
+ export * from './Factory/D1DrizzleMigratorFactory.js';
3
3
  // default export so that core factory can use it directly
4
- import { D1DrizzleMigratorFactory } from './Factory/D1DrizzleMigratorFactory';
4
+ import { D1DrizzleMigratorFactory } from './Factory/D1DrizzleMigratorFactory.js';
5
5
  export default D1DrizzleMigratorFactory;
6
6
  import { DrizzleMigratorFactoryRegistry } from '@drizzle-adapter/core/migrator';
7
7
  DrizzleMigratorFactoryRegistry.registerMigratorFactory('d1', D1DrizzleMigratorFactory);
package/eslint.config.mjs CHANGED
@@ -3,4 +3,4 @@ import eslintConfig from '@dmitryrechkin/eslint-standard/eslint.config.mjs';
3
3
  export default eslintConfig({
4
4
  tsconfigPath: './tsconfig.eslint.json',
5
5
  ignores: ['packages/**', 'tests/**'],
6
- });
6
+ });
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@drizzle-adapter/d1",
3
3
  "type": "module",
4
- "version": "1.0.14",
4
+ "version": "1.0.17",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
7
7
  "exports": {
@@ -17,26 +17,28 @@
17
17
  "devDependencies": {
18
18
  "@cloudflare/workers-types": "^4.20250419.0",
19
19
  "@dmitryrechkin/eslint-standard": "^1.0.7",
20
- "dotenv": "^16.5.0",
21
- "eslint": "^8.57.1",
22
- "eslint-plugin-unused-imports": "^3.2.0",
23
- "shx": "^0.3.4",
20
+ "dotenv": "^17.0.1",
21
+ "eslint": "^9.30.1",
22
+ "eslint-plugin-unused-imports": "^4.1.4",
23
+ "shx": "^0.4.0",
24
+ "tsc-esm-fix": "^3.1.2",
24
25
  "tsconfig-paths": "^4.2.0",
25
26
  "typescript": "^5.8.3",
26
- "vitest": "^0.24.5",
27
- "wrangler": "^3.114.6"
27
+ "vitest": "^3.2.4",
28
+ "wrangler": "^3.114.11"
28
29
  },
29
30
  "dependencies": {
30
- "drizzle-orm": "^0.36.4",
31
- "@drizzle-adapter/sqlite-core": "^1.0.11",
32
- "@drizzle-adapter/core": "^1.0.11"
31
+ "drizzle-orm": "^0.44.2",
32
+ "@drizzle-adapter/core": "^1.0.14",
33
+ "@drizzle-adapter/sqlite-core": "^1.0.14"
33
34
  },
35
+ "license": "MIT",
34
36
  "scripts": {
35
37
  "lint": "eslint src/",
36
38
  "format": "eslint --fix src/",
37
39
  "test": "vitest run",
38
40
  "check": "tsc --noEmit",
39
- "build": "shx rm -rf dist && tsc",
41
+ "build": "shx rm -rf dist && tsc && tsc-esm-fix",
40
42
  "package:tgz": "pnpm pack",
41
43
  "package:publish": "pnpm publish --access public"
42
44
  }
@@ -1,8 +1,13 @@
1
1
  import type { D1Database } from '@cloudflare/workers-types';
2
+ import type { DrizzleAdapterInterface } from '@drizzle-adapter/core';
3
+
2
4
  import { D1DrizzleConnection } from './D1DrizzleConnection';
3
5
  import { D1DrizzleDataTypes } from './D1DrizzleDataTypes';
4
- import type { DrizzleAdapterInterface } from '@drizzle-adapter/core';
5
6
 
7
+ /**
8
+ * D1 adapter implementation for Drizzle ORM.
9
+ * Provides D1-specific database operations and connection management.
10
+ */
6
11
  export class D1DrizzleAdapter implements DrizzleAdapterInterface
7
12
  {
8
13
  private connection: D1DrizzleConnection;
@@ -10,7 +15,7 @@ export class D1DrizzleAdapter implements DrizzleAdapterInterface
10
15
  /**
11
16
  * Constructor.
12
17
  *
13
- * @param {D1Database} driver
18
+ * @param {D1Database} driver - The D1 database driver instance
14
19
  */
15
20
  public constructor(driver: D1Database)
16
21
  {
@@ -18,19 +23,19 @@ export class D1DrizzleAdapter implements DrizzleAdapterInterface
18
23
  }
19
24
 
20
25
  /**
21
- * Returns the dialect.
26
+ * Returns the connection.
22
27
  *
23
- * @returns {string}
28
+ * @returns {Promise<D1DrizzleConnection>} A promise that resolves to the D1 connection instance
24
29
  */
25
- public getDialect(): string
30
+ public async getConnection(): Promise<D1DrizzleConnection>
26
31
  {
27
- return 'sqlite';
32
+ return this.connection.connect();
28
33
  }
29
34
 
30
35
  /**
31
36
  * Returns the data types.
32
37
  *
33
- * @returns {D1DrizzleDataTypes}
38
+ * @returns {D1DrizzleDataTypes} The D1 data types instance
34
39
  */
35
40
  public getDataTypes(): D1DrizzleDataTypes
36
41
  {
@@ -38,12 +43,12 @@ export class D1DrizzleAdapter implements DrizzleAdapterInterface
38
43
  }
39
44
 
40
45
  /**
41
- * Returns the connection.
46
+ * Returns the dialect.
42
47
  *
43
- * @returns {Promise<D1DrizzleConnection>}
48
+ * @returns {string} The database dialect string
44
49
  */
45
- public async getConnection(): Promise<D1DrizzleConnection>
50
+ public getDialect(): string
46
51
  {
47
- return this.connection.connect();
52
+ return 'sqlite';
48
53
  }
49
54
  }
@@ -1,8 +1,12 @@
1
1
  import type { D1Database } from '@cloudflare/workers-types';
2
- import { drizzle } from 'drizzle-orm/d1';
3
2
  import type { DrizzleConnectionInterface } from '@drizzle-adapter/core';
3
+ import { drizzle } from 'drizzle-orm/d1';
4
4
  import type { D1DrizzleClientInterface } from 'src/Interface';
5
5
 
6
+ /**
7
+ * D1 connection implementation for Drizzle ORM.
8
+ * Manages database connections and provides client access for D1 databases.
9
+ */
6
10
  export class D1DrizzleConnection implements DrizzleConnectionInterface
7
11
  {
8
12
  private client: D1DrizzleClientInterface;
@@ -10,7 +14,7 @@ export class D1DrizzleConnection implements DrizzleConnectionInterface
10
14
  /**
11
15
  * Constructor.
12
16
  *
13
- * @param {D1Database} driver
17
+ * @param {D1Database} driver - The D1 database driver instance
14
18
  */
15
19
  public constructor(driver: D1Database)
16
20
  {
@@ -46,7 +50,7 @@ export class D1DrizzleConnection implements DrizzleConnectionInterface
46
50
  /**
47
51
  * Returns the client.
48
52
  *
49
- * @returns {D1DrizzleClientInterface}
53
+ * @returns {D1DrizzleClientInterface} The D1 Drizzle client instance
50
54
  */
51
55
  public getClient(): D1DrizzleClientInterface
52
56
  {
@@ -1,3 +1,7 @@
1
1
  import { SqliteCoreDrizzleDataTypes } from '@drizzle-adapter/sqlite-core';
2
2
 
3
+ /**
4
+ * D1 data types implementation for Drizzle ORM.
5
+ * Extends the core SQLite data types with D1-specific functionality.
6
+ */
3
7
  export class D1DrizzleDataTypes extends SqliteCoreDrizzleDataTypes {}
@@ -1,7 +1,12 @@
1
1
  import type { DrizzleMigratorInterface, TypeDrizzleMigratorConfig } from '@drizzle-adapter/core';
2
2
  import { DrizzleD1Database } from 'drizzle-orm/d1/driver';
3
+
3
4
  import type { D1DrizzleClientInterface } from '../Interface';
4
5
 
6
+ /**
7
+ * D1 migrator implementation for Drizzle ORM.
8
+ * Handles database migrations for D1 databases.
9
+ */
5
10
  export class D1DrizzleMigrator implements DrizzleMigratorInterface
6
11
  {
7
12
  /**
@@ -14,7 +19,7 @@ export class D1DrizzleMigrator implements DrizzleMigratorInterface
14
19
  /**
15
20
  * Migrate the database.
16
21
  *
17
- * @param {DrizzleClientInterface} client The Drizzle client.
22
+ * @param {D1DrizzleClientInterface} client The Drizzle client.
18
23
  */
19
24
  public async migrate(client: D1DrizzleClientInterface): Promise<void>
20
25
  {