@drizzle-adapter/d1 1.0.6 → 1.0.7

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,11 @@
1
+ import type { DrizzleDataTypesFactoryInterface, TypeDrizzleDatabaseConfig } from '@drizzle-adapter/core';
2
+ import { SqliteCoreDrizzleDataTypes } from '@drizzle-adapter/sqlite-core';
3
+ export declare class D1DrizzleDataTypesFactory implements DrizzleDataTypesFactoryInterface {
4
+ /**
5
+ * Creates a new data types instance.
6
+ *
7
+ * @param {TypeDrizzleDatabaseConfig} _config - Not used in this implementation
8
+ * @returns {SqliteCoreDrizzleDataTypes}
9
+ */
10
+ create(_config: TypeDrizzleDatabaseConfig): SqliteCoreDrizzleDataTypes;
11
+ }
@@ -0,0 +1,12 @@
1
+ import { SqliteCoreDrizzleDataTypes } from '@drizzle-adapter/sqlite-core';
2
+ export class D1DrizzleDataTypesFactory {
3
+ /**
4
+ * Creates a new data types instance.
5
+ *
6
+ * @param {TypeDrizzleDatabaseConfig} _config - Not used in this implementation
7
+ * @returns {SqliteCoreDrizzleDataTypes}
8
+ */
9
+ create(_config) {
10
+ return new SqliteCoreDrizzleDataTypes();
11
+ }
12
+ }
@@ -1 +1,2 @@
1
1
  export * from './D1DrizzleAdapterFactory.js';
2
+ export * from './D1DrizzleDataTypesFactory.js';
@@ -1 +1,2 @@
1
1
  export * from './D1DrizzleAdapterFactory.js';
2
+ export * from './D1DrizzleDataTypesFactory.js';
package/dist/index.js CHANGED
@@ -3,7 +3,8 @@ export * from './Factory/index.js';
3
3
  export * from './Interface/index.js';
4
4
  export * from './Type/index.js';
5
5
  // default export so that core factory can use it directly
6
- import { D1DrizzleAdapterFactory } from './Factory/index.js';
6
+ import { D1DrizzleAdapterFactory, D1DrizzleDataTypesFactory } from './Factory/index.js';
7
7
  export default D1DrizzleAdapterFactory;
8
- import { DrizzleAdapterFactoryRegistry } from '@drizzle-adapter/core';
8
+ import { DrizzleAdapterFactoryRegistry, DrizzleDataTypesFactoryRegistry } from '@drizzle-adapter/core';
9
9
  DrizzleAdapterFactoryRegistry.registerAdapterFactory('d1', D1DrizzleAdapterFactory);
10
+ DrizzleDataTypesFactoryRegistry.registerDataTypesFactory('d1', D1DrizzleDataTypesFactory);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@drizzle-adapter/d1",
3
3
  "type": "module",
4
- "version": "1.0.6",
4
+ "version": "1.0.7",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
7
7
  "devDependencies": {
@@ -0,0 +1,16 @@
1
+ import type { DrizzleDataTypesFactoryInterface, TypeDrizzleDatabaseConfig } from '@drizzle-adapter/core';
2
+ import { SqliteCoreDrizzleDataTypes } from '@drizzle-adapter/sqlite-core';
3
+
4
+ export class D1DrizzleDataTypesFactory implements DrizzleDataTypesFactoryInterface
5
+ {
6
+ /**
7
+ * Creates a new data types instance.
8
+ *
9
+ * @param {TypeDrizzleDatabaseConfig} _config - Not used in this implementation
10
+ * @returns {SqliteCoreDrizzleDataTypes}
11
+ */
12
+ public create(_config: TypeDrizzleDatabaseConfig): SqliteCoreDrizzleDataTypes
13
+ {
14
+ return new SqliteCoreDrizzleDataTypes();
15
+ }
16
+ }
@@ -1 +1,2 @@
1
1
  export * from './D1DrizzleAdapterFactory';
2
+ export * from './D1DrizzleDataTypesFactory';
package/src/index.ts CHANGED
@@ -4,8 +4,10 @@ export * from './Interface';
4
4
  export * from './Type';
5
5
 
6
6
  // default export so that core factory can use it directly
7
- import { D1DrizzleAdapterFactory } from './Factory';
7
+ import { D1DrizzleAdapterFactory, D1DrizzleDataTypesFactory } from './Factory';
8
8
  export default D1DrizzleAdapterFactory;
9
9
 
10
- import { DrizzleAdapterFactoryRegistry } from '@drizzle-adapter/core';
10
+ import { DrizzleAdapterFactoryRegistry, DrizzleDataTypesFactoryRegistry } from '@drizzle-adapter/core';
11
11
  DrizzleAdapterFactoryRegistry.registerAdapterFactory('d1', D1DrizzleAdapterFactory);
12
+ DrizzleDataTypesFactoryRegistry.registerDataTypesFactory('d1', D1DrizzleDataTypesFactory);
13
+
@@ -0,0 +1,11 @@
1
+ import { describe, it, expect } from 'vitest';
2
+ import { D1DrizzleDataTypesFactory } from '../../src/Factory/D1DrizzleDataTypesFactory';
3
+ import { SqliteCoreDrizzleDataTypes } from '@drizzle-adapter/sqlite-core';
4
+
5
+ describe('D1DrizzleDataTypesFactory', () => {
6
+ it('should create an instance of SqliteCoreDrizzleDataTypes', () => {
7
+ const factory = new D1DrizzleDataTypesFactory();
8
+ const dataTypes = factory.create({ DATABASE_DRIVER: 'd1' });
9
+ expect(dataTypes).toBeInstanceOf(SqliteCoreDrizzleDataTypes);
10
+ });
11
+ });