@medyll/idae-db 0.3.0 → 0.5.0

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,56 @@
1
+ import { type Filter } from 'mongodb';
2
+ export type IdaeDbQueryFilter<T> = Filter<T>;
3
+ export type AdapterConstructor<CON> = new <T extends object>(collection: string, connection: CON, _constructor: () => IdaeDbAdapterInterface<T>) => Omit<IdaeDbAdapterInterface<T>, 'connect' | 'getDb' | 'close' | 'registerEvents'>;
4
+ export interface IdaeDbAdapterInterface<T extends object> {
5
+ createIndex<F, O>(fieldOrSpec: F, options?: O): Promise<any>;
6
+ create(data: Partial<T>): Promise<T>;
7
+ findById(id: string): Promise<T[]>;
8
+ find(params: IdaeDbParams<T>): Promise<T[]>;
9
+ findOne(params: IdaeDbParams<T>): Promise<T | null>;
10
+ update(id: string, updateData: Partial<T>): Promise<any>;
11
+ updateWhere<OPT = any>(params: IdaeDbParams<T>, updateData: Partial<T>, options?: OPT): Promise<any>;
12
+ deleteById(id: string): Promise<any>;
13
+ deleteWhere(params: IdaeDbParams<T>): Promise<{
14
+ deletedCount?: number;
15
+ }>;
16
+ transaction<TResult>(callback: (session: any) => Promise<TResult>): Promise<TResult>;
17
+ }
18
+ export interface IdaeDbAdapterStaticMethods {
19
+ connect(uri: string): Promise<any>;
20
+ getDb(client: any, dbName: string): any;
21
+ close(client: any): Promise<void>;
22
+ }
23
+ export interface IdaeDbParams<T extends object = Record<string, unknown>> {
24
+ id?: string;
25
+ query: IdaeDbQueryFilter<T>;
26
+ sortBy?: string;
27
+ limit?: number;
28
+ skip?: number;
29
+ }
30
+ export interface IdaeDbParamsSortOptions {
31
+ [key: string]: 1 | -1;
32
+ }
33
+ export declare enum DbType {
34
+ MONGODB = "mongodb",
35
+ MYSQL = "mysql",
36
+ CHROMADB = "chromaDb"
37
+ }
38
+ export declare abstract class AbstractIdaeDbAdapter<T extends object> implements IdaeDbAdapterInterface<T> {
39
+ abstract createIndex(fieldOrSpec: any, options?: any): Promise<string>;
40
+ abstract create(data: Partial<T>): Promise<T>;
41
+ abstract findById(id: string): Promise<T[]>;
42
+ abstract find(params: IdaeDbParams<T>): Promise<T[]>;
43
+ abstract findOne(params: IdaeDbParams<T>): Promise<T | null>;
44
+ abstract update(id: string, updateData: Partial<T>): Promise<any>;
45
+ abstract updateWhere<OPT = any>(params: IdaeDbParams<T>, updateData: Partial<T>, options?: OPT): Promise<any>;
46
+ abstract deleteById(id: string): Promise<any>;
47
+ abstract deleteWhere(params: IdaeDbParams<T>): Promise<{
48
+ deletedCount?: number;
49
+ }>;
50
+ abstract transaction<TResult>(callback: (session: any) => Promise<TResult>): Promise<TResult>;
51
+ static connect(uri: string): Promise<any>;
52
+ static getDb(client: any, dbName: string): any;
53
+ static close(client: any): Promise<void>;
54
+ }
55
+ export interface IdaeDbApiMethods<T extends object> extends AbstractIdaeDbAdapter<T> {
56
+ }
@@ -0,0 +1,19 @@
1
+ // packages\idae-db\src\lib\adapters\types.ts
2
+ import {} from 'mongodb';
3
+ export var DbType;
4
+ (function (DbType) {
5
+ DbType["MONGODB"] = "mongodb";
6
+ DbType["MYSQL"] = "mysql";
7
+ DbType["CHROMADB"] = "chromaDb";
8
+ })(DbType || (DbType = {}));
9
+ export class AbstractIdaeDbAdapter {
10
+ static connect(uri) {
11
+ throw new Error('Method not implemented.');
12
+ }
13
+ static getDb(client, dbName) {
14
+ throw new Error('Method not implemented.');
15
+ }
16
+ static close(client) {
17
+ throw new Error('Method not implemented.');
18
+ }
19
+ }
@@ -1,10 +1,10 @@
1
- import type { Collection, Document } from 'mongodb';
1
+ import type { Collection } from 'mongodb';
2
2
  import { IdaeDbConnection } from './IdaeDbConnection.js';
3
3
  export interface IdaeModelOptions {
4
4
  autoIncrementFormat?: (collection: string) => string;
5
5
  autoIncrementDbCollection?: string;
6
6
  }
7
- export declare class IdaeDBModel<T extends Document> {
7
+ export declare class IdaeDBModel<T extends object> {
8
8
  private connection;
9
9
  private _collectionName;
10
10
  private _collection;
@@ -1,8 +1,14 @@
1
- import { DbType, type IdaeDbAdapterInterface, type IdaeDbParams } from './types.js';
1
+ import { AbstractIdaeDbAdapter, DbType, type AdapterConstructor, type IdaeDbParams } from './@types/types.js';
2
2
  import { IdaeDbConnection } from './IdaeDbConnection.js';
3
- import { IdaeEventEmitter, type EventListeners } from './IdaeEventEmitter.js';
4
- export type AdapterConstructor = new <T extends Document = Document>(collection: string, connection: IdaeDbConnection) => Omit<IdaeDbAdapterInterface<T>, 'connect' | 'getDb' | 'close'>;
5
- export declare class IdaeDbAdapter<T extends Document> extends IdaeEventEmitter {
3
+ import { IdaeEventEmitter, type ErrorEventListener, type PostEventListener, type PreEventListener } from './IdaeEventEmitter.js';
4
+ export type EventListeners<T extends object> = {
5
+ [K in keyof IdaeDbAdapter<T> as IdaeDbAdapter<T>[K] extends (...args: unknown[]) => unknown ? K : never]?: {
6
+ pre?: PreEventListener<IdaeDbAdapter<T>[K] extends (...args: infer P) => unknown ? P : never>;
7
+ post?: PostEventListener<IdaeDbAdapter<T>[K] extends (...args: infer P) => unknown ? P : never, IdaeDbAdapter<T>[K] extends (...args: unknown[]) => infer R ? R : never>;
8
+ error?: ErrorEventListener;
9
+ };
10
+ };
11
+ export declare class IdaeDbAdapter<T extends object> extends IdaeEventEmitter implements AbstractIdaeDbAdapter<T> {
6
12
  private dbType;
7
13
  private adapter;
8
14
  private static adapters;
@@ -11,24 +17,37 @@ export declare class IdaeDbAdapter<T extends Document> extends IdaeEventEmitter
11
17
  * @param dbType The type of database for this adapter.
12
18
  * @param adapterConstructor The constructor function for the adapter.
13
19
  */
14
- static addAdapter<A>(dbType: DbType, adapterConstructor: AdapterConstructor): void;
20
+ static addAdapter<A>(dbType: DbType, adapterConstructor: new (collection: string, connection: IdaeDbConnection) => A): void;
21
+ /**
22
+ * Retrieves the adapter constructor for a specific database type.
23
+ * @param dbType The type of database for which to retrieve the adapter.
24
+ * @returns The adapter constructor for the specified database type, or undefined if not found.
25
+ */
26
+ static getAdapterForDbType(dbType: DbType): AdapterConstructor<IdaeDbConnection> | undefined;
27
+ /**
28
+ * Creates a new instance of IdaeDbAdapter.
29
+ * @param collection The name of the collection or table to operate on.
30
+ * @param connection The database connection object.
31
+ * @param dbType The type of database being used (e.g., MongoDB, MySQL, ChromaDB).
32
+ * @throws {Error} If no adapter is found for the specified database type.
33
+ */
15
34
  constructor(collection: string, connection: IdaeDbConnection, dbType: DbType);
16
- private applyAdapter;
17
35
  /**
18
- * Registers event listeners specific to this collection.
36
+ * Register event listeners for different operations.
19
37
  * @param events An object containing event listeners for different operations.
20
38
  */
21
39
  registerEvents(events: EventListeners<T>): void;
22
- static getAdapterForDbType(dbType: DbType): IdaeDbAdapterInterface<T> | undefined;
40
+ createIndex<F, O>(fieldOrSpec: F, options?: O): Promise<any>;
23
41
  create(data: Partial<T>): Promise<T>;
24
42
  findById(id: string): Promise<T[]>;
25
43
  find(params: IdaeDbParams<T>): Promise<T[]>;
26
44
  findOne(params: IdaeDbParams<T>): Promise<T | null>;
27
45
  update(id: string, updateData: Partial<T>): Promise<any>;
28
- updateWhere(params: IdaeDbParams<T>, updateData: Partial<T>): Promise<any>;
46
+ updateWhere<OPT = any>(params: IdaeDbParams<T>, updateData: Partial<T>, options: OPT): Promise<any>;
29
47
  deleteById(id: string): Promise<any>;
30
48
  deleteWhere(params: IdaeDbParams<T>): Promise<{
31
49
  deletedCount?: number;
32
50
  }>;
33
- transaction<TResult>(callback: (session: any) => Promise<TResult>): Promise<TResult>;
51
+ transaction<TResult>(callback: (session: unknown) => Promise<TResult>): Promise<TResult>;
52
+ private applyAdapter;
34
53
  }
@@ -8,8 +8,8 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
8
8
  var __metadata = (this && this.__metadata) || function (k, v) {
9
9
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
10
  };
11
- var _a, _b, _c, _d;
12
- import { DbType } from './types.js';
11
+ var _a, _b, _c, _d, _e, _f, _g;
12
+ import { AbstractIdaeDbAdapter, DbType } from './@types/types.js';
13
13
  import { IdaeDbConnection } from './IdaeDbConnection.js';
14
14
  import { MongoDBAdapter } from './adapters/MongoDBAdapter.js';
15
15
  import { MySQLAdapter } from './adapters/MySQLAdapter.js';
@@ -32,20 +32,28 @@ export class IdaeDbAdapter extends IdaeEventEmitter {
32
32
  static addAdapter(dbType, adapterConstructor) {
33
33
  IdaeDbAdapter.adapters.set(dbType, adapterConstructor);
34
34
  }
35
+ /**
36
+ * Retrieves the adapter constructor for a specific database type.
37
+ * @param dbType The type of database for which to retrieve the adapter.
38
+ * @returns The adapter constructor for the specified database type, or undefined if not found.
39
+ */
40
+ static getAdapterForDbType(dbType) {
41
+ return IdaeDbAdapter.adapters.get(dbType);
42
+ }
43
+ /**
44
+ * Creates a new instance of IdaeDbAdapter.
45
+ * @param collection The name of the collection or table to operate on.
46
+ * @param connection The database connection object.
47
+ * @param dbType The type of database being used (e.g., MongoDB, MySQL, ChromaDB).
48
+ * @throws {Error} If no adapter is found for the specified database type.
49
+ */
35
50
  constructor(collection, connection, dbType) {
36
51
  super();
37
52
  this.dbType = dbType;
38
53
  this.applyAdapter(collection, connection, this.dbType);
39
54
  }
40
- applyAdapter(collection, connection, dbType) {
41
- const AdapterConstructor = IdaeDbAdapter.adapters.get(dbType);
42
- if (!AdapterConstructor) {
43
- throw new Error(`No adapter found for database type: ${dbType}`);
44
- }
45
- this.adapter = new AdapterConstructor(collection, connection);
46
- }
47
55
  /**
48
- * Registers event listeners specific to this collection.
56
+ * Register event listeners for different operations.
49
57
  * @param events An object containing event listeners for different operations.
50
58
  */
51
59
  registerEvents(events) {
@@ -61,8 +69,8 @@ export class IdaeDbAdapter extends IdaeEventEmitter {
61
69
  }
62
70
  }
63
71
  }
64
- static getAdapterForDbType(dbType) {
65
- return IdaeDbAdapter.adapters.get(dbType);
72
+ async createIndex(fieldOrSpec, options) {
73
+ return this.adapter.createIndex(fieldOrSpec, options);
66
74
  }
67
75
  async create(data) {
68
76
  return this.adapter.create(data);
@@ -79,8 +87,8 @@ export class IdaeDbAdapter extends IdaeEventEmitter {
79
87
  async update(id, updateData) {
80
88
  return this.adapter.update(id, updateData);
81
89
  }
82
- async updateWhere(params, updateData) {
83
- return this.adapter.updateWhere(params, updateData);
90
+ async updateWhere(params, updateData, options) {
91
+ return this.adapter.updateWhere(params, updateData, options);
84
92
  }
85
93
  async deleteById(id) {
86
94
  return this.adapter.deleteById(id);
@@ -91,11 +99,25 @@ export class IdaeDbAdapter extends IdaeEventEmitter {
91
99
  async transaction(callback) {
92
100
  return this.adapter.transaction(callback);
93
101
  }
102
+ applyAdapter(collection, connection, dbType) {
103
+ const adapterConstructor = IdaeDbAdapter.adapters.get(dbType);
104
+ if (!adapterConstructor) {
105
+ throw new Error(`No adapter found for database type : ${dbType}`);
106
+ }
107
+ /** @ts-expect-error --- */
108
+ this.adapter = new adapterConstructor(collection, connection);
109
+ }
94
110
  }
95
111
  __decorate([
96
112
  withEmitter(),
97
113
  __metadata("design:type", Function),
98
- __metadata("design:paramtypes", [typeof (_a = typeof Partial !== "undefined" && Partial) === "function" ? _a : Object]),
114
+ __metadata("design:paramtypes", [typeof (_a = typeof F !== "undefined" && F) === "function" ? _a : Object, typeof (_b = typeof O !== "undefined" && O) === "function" ? _b : Object]),
115
+ __metadata("design:returntype", Promise)
116
+ ], IdaeDbAdapter.prototype, "createIndex", null);
117
+ __decorate([
118
+ withEmitter(),
119
+ __metadata("design:type", Function),
120
+ __metadata("design:paramtypes", [typeof (_c = typeof Partial !== "undefined" && Partial) === "function" ? _c : Object]),
99
121
  __metadata("design:returntype", Promise)
100
122
  ], IdaeDbAdapter.prototype, "create", null);
101
123
  __decorate([
@@ -119,13 +141,13 @@ __decorate([
119
141
  __decorate([
120
142
  withEmitter(),
121
143
  __metadata("design:type", Function),
122
- __metadata("design:paramtypes", [String, typeof (_b = typeof Partial !== "undefined" && Partial) === "function" ? _b : Object]),
144
+ __metadata("design:paramtypes", [String, typeof (_d = typeof Partial !== "undefined" && Partial) === "function" ? _d : Object]),
123
145
  __metadata("design:returntype", Promise)
124
146
  ], IdaeDbAdapter.prototype, "update", null);
125
147
  __decorate([
126
148
  withEmitter(),
127
149
  __metadata("design:type", Function),
128
- __metadata("design:paramtypes", [Object, typeof (_c = typeof Partial !== "undefined" && Partial) === "function" ? _c : Object]),
150
+ __metadata("design:paramtypes", [Object, typeof (_e = typeof Partial !== "undefined" && Partial) === "function" ? _e : Object, typeof (_f = typeof OPT !== "undefined" && OPT) === "function" ? _f : Object]),
129
151
  __metadata("design:returntype", Promise)
130
152
  ], IdaeDbAdapter.prototype, "updateWhere", null);
131
153
  __decorate([
@@ -144,5 +166,5 @@ __decorate([
144
166
  withEmitter(),
145
167
  __metadata("design:type", Function),
146
168
  __metadata("design:paramtypes", [Function]),
147
- __metadata("design:returntype", typeof (_d = typeof Promise !== "undefined" && Promise) === "function" ? _d : Object)
169
+ __metadata("design:returntype", typeof (_g = typeof Promise !== "undefined" && Promise) === "function" ? _g : Object)
148
170
  ], IdaeDbAdapter.prototype, "transaction", null);
@@ -1,5 +1,5 @@
1
1
  // packages\idae-db\lib\IdaeDbConnection.ts
2
- import { DbType } from './types.js';
2
+ import { DbType } from './@types/types.js';
3
3
  import { IdaeDBModel } from './IdaeDBModel.js';
4
4
  import { IdaeDb } from './idaeDb.js';
5
5
  export class IdaeDbConnection {
@@ -1,5 +1,4 @@
1
1
  import { EventEmitter } from 'events';
2
- import { IdaeDbAdapter } from './IdaeDbAdapter.js';
3
2
  /**
4
3
  * IdaeEventEmitter extends Node's EventEmitter to provide pre/post method hooks.
5
4
  */
@@ -20,11 +19,12 @@ export declare function withEmitter(): (target: object, propertyKey: string | sy
20
19
  /**
21
20
  * Type for pre-execution event listeners.
22
21
  */
23
- export type PreEventListener<T extends any[]> = (...args: T) => void | Promise<void>;
22
+ export type PreEventListener<T extends unknown[]> = (...args: T) => void | Promise<void>;
24
23
  /**
25
24
  * Type for post-execution event listeners.
26
25
  */
27
- export type PostEventListener<T extends any[], R> = (result: R, ...args: T) => void | Promise<void>;
26
+ export type PostEventListener<T extends unknown[], R> = (result: R, ...args: T) => void | Promise<void>;
27
+ export type EventListeners<T, R> = PreEventListener<T> & PostEventListener<T, R> & ErrorEventListener;
28
28
  /**
29
29
  * Type for error event listeners.
30
30
  */
@@ -43,10 +43,3 @@ export interface TypedIdaeEventEmitter<T> {
43
43
  emit<K extends keyof T>(event: `post:${K & string}`, result: ReturnType<T[K]>, ...args: Parameters<T[K]>): boolean;
44
44
  emit<K extends keyof T>(event: `error:${K & string}`, error: Error): boolean;
45
45
  }
46
- export type EventListeners<T> = {
47
- [K in keyof IdaeDbAdapter<T>]?: {
48
- pre?: PreEventListener<Parameters<IdaeDbAdapter<T>[K]>>;
49
- post?: PostEventListener<Parameters<IdaeDbAdapter<T>[K]>, ReturnType<IdaeDbAdapter<T>[K]>>;
50
- error?: ErrorEventListener;
51
- };
52
- };
@@ -1,5 +1,4 @@
1
1
  import { EventEmitter } from 'events';
2
- import { IdaeDbAdapter } from './IdaeDbAdapter.js';
3
2
  /**
4
3
  * IdaeEventEmitter extends Node's EventEmitter to provide pre/post method hooks.
5
4
  */
@@ -1,29 +1,30 @@
1
- import { type Document } from 'chromadb';
2
- import type { IdaeDbParams, IdaeDbAdapterInterface } from '../types.js';
1
+ import { type AddParams, type Metadata, type UpdateParams, type Documents, type Embeddings, type ID } from 'chromadb';
2
+ import type { IdaeDbParams, AbstractIdaeDbAdapter } from '../@types/types.js';
3
3
  import { IdaeDbConnection } from '../IdaeDbConnection.js';
4
- export declare class ChromaDBAdapter<T extends Document = Document> implements IdaeDbAdapterInterface<T> {
4
+ type ChromaDBAdapterContent = {
5
+ id: ID;
6
+ embeddings: Embeddings;
7
+ metadatas: Metadata;
8
+ documents: Documents;
9
+ };
10
+ export declare class ChromaDBAdapter<T extends ChromaDBAdapterContent> implements AbstractIdaeDbAdapter<T> {
5
11
  private collectionName;
6
12
  private connection;
7
13
  private collection;
8
14
  private client;
9
15
  constructor(collectionName: string, connection: IdaeDbConnection);
10
16
  private _init;
11
- create(data: Partial<T>): Promise<{
12
- error: string;
13
- }>;
14
- findById(id: string): Promise<import("chromadb").GetResponse>;
15
- find(params: IdaeDbParams<T>): Promise<import("chromadb").QueryResponse>;
16
- findOne(params: IdaeDbParams<T>): Promise<any>;
17
- update(id: string, updateData: Partial<T>): Promise<{
18
- error: string;
19
- }>;
20
- updateWhere(params: IdaeDbParams<T>, updateData: Partial<T>): Promise<void>;
21
- deleteById(id: string): Promise<string[]>;
17
+ create(data: AddParams): Promise<T>;
18
+ findById(id: string): Promise<T[]>;
19
+ find(params: IdaeDbParams<T>): Promise<T[]>;
20
+ findOne(params: IdaeDbParams<T>): Promise<T | null>;
21
+ update(id: string, updateData: UpdateParams): Promise<T>;
22
+ updateWhere(params: IdaeDbParams<T>, updateData: Partial<T>): Promise<T[]>;
23
+ createIndex(field: unknown, opt: unknown): Promise<T[]>;
24
+ deleteById(id: string | string[]): Promise<boolean>;
22
25
  deleteWhere(params: IdaeDbParams<T>): Promise<{
23
- deletedCount?: number;
24
- }>;
25
- addItem(id: string, vector: number[], metadata?: object): Promise<{
26
- error: string;
26
+ deletedCount: number;
27
27
  }>;
28
- similaritySearch(vector: number[], k?: number): Promise<import("chromadb").QueryResponse>;
28
+ similaritySearch(vector: number[], k?: number): Promise<T[]>;
29
29
  }
30
+ export {};
@@ -1,4 +1,3 @@
1
- // packages/idae-db/lib/adapters/ChromaDBAdapter.ts
2
1
  import { Collection } from 'chromadb';
3
2
  import { IdaeDbConnection } from '../IdaeDbConnection.js';
4
3
  export class ChromaDBAdapter {
@@ -9,53 +8,64 @@ export class ChromaDBAdapter {
9
8
  constructor(collectionName, connection) {
10
9
  this.collectionName = collectionName;
11
10
  this.connection = connection;
12
- this.client = this.connection.getDb(); // Assuming getDb() returns ChromaClient
13
- return this._init();
14
- }
15
- _init() {
16
- this.collection = this.client
17
- .getOrCreateCollection({ name: this.collectionName })
18
- .then((collection) => {
19
- return collection;
20
- });
21
- return this;
11
+ this.client = this.connection.getDb();
12
+ this._init();
13
+ }
14
+ async _init() {
15
+ this.collection = await this.client.getOrCreateCollection({ name: this.collectionName });
22
16
  }
23
17
  async create(data) {
24
- const { id, vector, metadata } = data;
25
- return this.collection.add(id, vector, metadata);
18
+ const { embeddings, metadatas, documents } = data;
19
+ const itemId = data.ids || crypto.randomUUID();
20
+ await this.collection.add({
21
+ ids: [itemId],
22
+ embeddings: [embeddings],
23
+ metadatas: [metadatas],
24
+ documents: [documents]
25
+ });
26
+ return { ...data, id: itemId };
26
27
  }
27
28
  async findById(id) {
28
- return this.collection.get([id]);
29
+ const result = await this.collection.get([id]);
30
+ return result;
29
31
  }
30
32
  async find(params) {
31
33
  const { query = {}, limit } = params;
32
- // ChromaDB uses vector similarity search, so we need to adapt the query
33
- // This is a simplified example and may need to be adjusted based on your specific use case
34
- return this.collection.query(query.vector || [], limit);
34
+ const results = await this.collection.query(query.vector || [], limit);
35
+ return results;
35
36
  }
36
37
  async findOne(params) {
37
38
  const results = await this.find({ ...params, limit: 1 });
38
39
  return results.length > 0 ? results[0] : null;
39
40
  }
40
41
  async update(id, updateData) {
41
- // ChromaDB doesn't have a direct update method, so we need to delete and re-add
42
- await this.deleteById(id);
43
- return this.collection.add(id, updateData.vector, updateData.metadata);
42
+ await this.collection.update(updateData);
43
+ return updateData;
44
44
  }
45
45
  async updateWhere(params, updateData) {
46
46
  throw new Error('updateWhere not supported in ChromaDB');
47
47
  }
48
+ async createIndex(field, opt) {
49
+ throw new Error(`updateWhere not supported in ChromaDB ${field} ${opt}`);
50
+ }
48
51
  async deleteById(id) {
49
- return this.collection.delete([id]);
52
+ if (typeof id === 'string') {
53
+ await this.collection.delete({ ids: [id] });
54
+ }
55
+ else {
56
+ await this.collection.delete({ ids: id });
57
+ }
58
+ return true;
50
59
  }
51
60
  async deleteWhere(params) {
52
61
  throw new Error('deleteWhere not supported in ChromaDB');
53
62
  }
54
- // Additional ChromaDB specific methods
55
- async addItem(id, vector, metadata) {
56
- return this.collection.add(id, vector, metadata);
57
- }
63
+ // Specific methods for ChromaDB
64
+ /* async addItem(ids: string, vector: number[], metadata?: object): Promise<void> {
65
+ await this.collection.add({ ids, vector, metadata });
66
+ } */
58
67
  async similaritySearch(vector, k = 10) {
59
- return this.collection.query(vector, k);
68
+ const results = await this.collection.query(vector, k);
69
+ return results;
60
70
  }
61
71
  }
@@ -1,7 +1,7 @@
1
- import type { IdaeDbParams, IdaeDbAdapterInterface } from '../types.js';
2
- import { type Document, type UpdateOptions, type IndexSpecification, type CreateIndexesOptions, ClientSession, MongoClient, Db } from 'mongodb';
1
+ import { type IdaeDbParams, AbstractIdaeDbAdapter } from '../@types/types.js';
2
+ import { type UpdateOptions, type IndexSpecification, type CreateIndexesOptions, type Document, ClientSession, MongoClient, Db } from 'mongodb';
3
3
  import { IdaeDbConnection } from '../IdaeDbConnection.js';
4
- export declare class MongoDBAdapter<T extends Document = Document> implements IdaeDbAdapterInterface<T> {
4
+ export declare class MongoDBAdapter<T extends Document> implements AbstractIdaeDbAdapter<T> {
5
5
  private model;
6
6
  private connection;
7
7
  private fieldId;
@@ -11,11 +11,11 @@ export declare class MongoDBAdapter<T extends Document = Document> implements Id
11
11
  static close(client: MongoClient): Promise<void>;
12
12
  createIndex(fieldOrSpec: IndexSpecification, options?: CreateIndexesOptions): Promise<string>;
13
13
  findById(id: string): Promise<T[]>;
14
- find(params: IdaeDbParams<T>): Promise<import("mongodb").WithId<T>[]>;
15
- findOne(params: IdaeDbParams<T>): Promise<import("mongodb").WithId<T> | null>;
16
- create(data: Partial<T>): Promise<import("mongodb").UpdateResult<T>>;
14
+ find(params: IdaeDbParams<T>): Promise<T[]>;
15
+ findOne(params: IdaeDbParams<T>): Promise<T | null>;
16
+ create(data: Partial<T>): Promise<T>;
17
17
  update(id: string, updateData: Partial<T>, options?: UpdateOptions): Promise<import("mongodb").UpdateResult<T>>;
18
- updateWhere(params: IdaeDbParams<T>, updateData: Partial<T>, options?: UpdateOptions): Promise<import("mongodb").UpdateResult<T>>;
18
+ updateWhere(params: IdaeDbParams<T>, updateData: Partial<T>, options?: any): Promise<import("mongodb").UpdateResult<T>>;
19
19
  deleteById(id: string | number): Promise<import("mongodb").DeleteResult>;
20
20
  deleteWhere(params: IdaeDbParams<T>): Promise<{
21
21
  deletedCount?: number;
@@ -1,5 +1,6 @@
1
1
  // packages\idae-db\src\lib\adapters\MongoDBAdapter.ts
2
2
  import dotenv from 'dotenv';
3
+ import { AbstractIdaeDbAdapter } from '../@types/types.js';
3
4
  import { ClientSession, MongoClient, Db } from 'mongodb';
4
5
  import { IdaeDbConnection } from '../IdaeDbConnection.js';
5
6
  import { IdaeDBModel } from '../IdaeDBModel.js';
@@ -16,13 +17,16 @@ export class MongoDBAdapter {
16
17
  this.connection = connection;
17
18
  this.model = this.connection.getModel(collection);
18
19
  this.fieldId = this.model.fieldId;
20
+ console.log('MongoDBAdapter constructor', collection);
19
21
  }
20
22
  static async connect(uri) {
23
+ console.log('MongoDBAdapter connect', uri);
21
24
  const client = new MongoClient(uri);
22
25
  await client.connect();
23
26
  return client;
24
27
  }
25
28
  static getDb(client, dbName) {
29
+ console.log('MongoDBAdapter getDb', dbName);
26
30
  return client.db(dbName);
27
31
  }
28
32
  static async close(client) {
@@ -39,23 +43,21 @@ export class MongoDBAdapter {
39
43
  async find(params) {
40
44
  const { query = {}, sortBy, limit, skip } = params;
41
45
  const sortOptions = this.parseSortOptions(sortBy);
42
- return await this.model.collection
46
+ return (await this.model.collection
43
47
  .find(query)
44
48
  .sort(sortOptions)
45
49
  .limit(Number(limit) || 0)
46
50
  .skip(Number(skip) || 0)
47
- .toArray();
51
+ .toArray());
48
52
  }
49
53
  async findOne(params) {
50
- return this.model.collection.findOne(params.query);
54
+ const result = await this.model.collection.findOne(params.query);
55
+ return result;
51
56
  }
52
57
  async create(data) {
53
- // create auto_increment
54
58
  const id = await this.model.getNextIncrement();
55
- // ensure Index i set
56
- return this.model.collection.updateOne({ [this.fieldId]: id }, { $set: { ...data } }, {
57
- upsert: true
58
- });
59
+ const result = await this.model.collection.findOneAndUpdate({ [this.fieldId]: id }, { $set: { ...data, [this.fieldId]: id } }, { upsert: true, returnDocument: 'after' });
60
+ return result.value;
59
61
  }
60
62
  async update(id, updateData, options) {
61
63
  return this.model.collection.updateMany({ [this.fieldId]: id }, { $set: { ...updateData } }, options);
@@ -1,23 +1,22 @@
1
- import { Model } from 'sequelize';
2
- import type { IdaeDbAdapterInterface, IdaeDbParams } from '../types.js';
3
- interface MySQLDocument extends Model {
4
- id: number;
5
- [key: string]: any;
6
- }
7
- export declare class MySQLAdapter<T extends MySQLDocument> implements IdaeDbAdapterInterface<T> {
8
- private sequelize;
1
+ import { AbstractIdaeDbAdapter, type IdaeDbParams } from '../@types/types.js';
2
+ import { IdaeDbConnection } from '../IdaeDbConnection.js';
3
+ import mysql from 'mysql2/promise';
4
+ export declare class MySQLAdapter<T extends Record<string, any>> implements AbstractIdaeDbAdapter<T> {
9
5
  private model;
10
- constructor(tableName: string);
11
- create(document: Partial<T>): Promise<T>;
12
- find(params: IdaeDbParams): Promise<T[]>;
13
- findById(id: string): Promise<T | null>;
14
- findOne(): Promise<T | null>;
15
- update(id: string, updateData: Partial<T>): Promise<T | null>;
16
- updateWhere(params: IdaeDbParams, updateData: Partial<T>): Promise<T | null>;
17
- deleteById(id: string): Promise<T | null>;
18
- deleteManyByQuery(params: IdaeDbParams): Promise<{
6
+ private connection;
7
+ private fieldId;
8
+ private tableName;
9
+ constructor(collection: string, connection: IdaeDbConnection);
10
+ findById(id: string): Promise<T[]>;
11
+ find(params: IdaeDbParams<T>): Promise<T[]>;
12
+ findOne(params: IdaeDbParams<T>): Promise<T | null>;
13
+ create(data: Partial<T>): Promise<T>;
14
+ update(id: string, updateData: Partial<T>, options?: any): Promise<any>;
15
+ updateWhere(params: IdaeDbParams<T>, updateData: Partial<T>, options?: any): Promise<any>;
16
+ deleteById(id: string | number): Promise<any>;
17
+ deleteWhere(params: IdaeDbParams<T>): Promise<{
19
18
  deletedCount?: number;
20
19
  }>;
20
+ transaction<TResult>(callback: (session: mysql.Connection) => Promise<TResult>): Promise<TResult>;
21
21
  private parseSortOptions;
22
22
  }
23
- export {};
@@ -1,88 +1,125 @@
1
- // packages\idae-api\src\lib\adapters\MySQLAdapter.ts
2
- import { Sequelize, Model, DataTypes } from 'sequelize';
3
- import dotenv from 'dotenv';
4
- dotenv.config();
1
+ import { AbstractIdaeDbAdapter } from '../@types/types.js';
2
+ import { IdaeDbConnection } from '../IdaeDbConnection.js';
3
+ import { IdaeDBModel } from '../IdaeDBModel.js';
4
+ import mysql from 'mysql2/promise';
5
5
  export class MySQLAdapter {
6
- sequelize;
7
6
  model;
8
- constructor(tableName) {
9
- this.sequelize = new Sequelize({
10
- dialect: 'mysql',
11
- host: process.env.MYSQL_HOST || 'localhost',
12
- port: Number(process.env.MYSQL_PORT) || 3306,
13
- database: process.env.MYSQL_DATABASE || 'database',
14
- username: process.env.MYSQL_USER || 'root',
15
- password: process.env.MYSQL_PASSWORD || 'password'
16
- });
17
- this.model = this.sequelize.define(tableName, {
18
- id: {
19
- type: DataTypes.INTEGER.UNSIGNED,
20
- autoIncrement: true,
21
- primaryKey: true
22
- }
23
- // Define other fields here as needed
24
- }, {
25
- timestamps: false,
26
- tableName
27
- });
7
+ connection;
8
+ fieldId;
9
+ tableName;
10
+ constructor(collection, connection) {
11
+ this.connection = connection;
12
+ this.model = this.connection.getModel(collection);
13
+ this.fieldId = this.model.fieldId;
14
+ this.tableName = collection;
28
15
  }
29
- async create(document) {
30
- const newDocument = await this.model.create(document);
31
- return newDocument;
16
+ async findById(id) {
17
+ const [rows] = await this.connection
18
+ .getClient()
19
+ .execute(`SELECT * FROM ${this.tableName} WHERE ${this.fieldId} = ?`, [id]);
20
+ return rows;
32
21
  }
33
22
  async find(params) {
34
23
  const { query = {}, sortBy, limit, skip } = params;
35
- const options = {
36
- where: query,
37
- order: this.parseSortOptions(sortBy),
38
- limit: limit ? Number(limit) : undefined,
39
- offset: skip ? Number(skip) : undefined
40
- };
41
- const results = await this.model.findAll(options);
42
- return results;
24
+ let sql = `SELECT * FROM ${this.tableName}`;
25
+ const values = [];
26
+ if (Object.keys(query).length > 0) {
27
+ sql +=
28
+ ' WHERE ' +
29
+ Object.keys(query)
30
+ .map((key) => `${key} = ?`)
31
+ .join(' AND ');
32
+ values.push(...Object.values(query));
33
+ }
34
+ if (sortBy) {
35
+ sql += ' ORDER BY ' + this.parseSortOptions(sortBy);
36
+ }
37
+ if (limit) {
38
+ sql += ' LIMIT ?';
39
+ values.push(Number(limit));
40
+ }
41
+ if (skip) {
42
+ sql += ' OFFSET ?';
43
+ values.push(Number(skip));
44
+ }
45
+ const [rows] = await this.connection.getClient().execute(sql, values);
46
+ return rows;
43
47
  }
44
- async findById(id) {
45
- const result = await this.model.findByPk(id);
46
- return result ? result : null;
48
+ async findOne(params) {
49
+ const results = await this.find({ ...params, limit: 1 });
50
+ return results[0] || null;
47
51
  }
48
- async findOne() {
49
- const { query = {} } = params;
50
- const result = await this.model.findOne({ where: query });
51
- return result ? result : null;
52
+ async create(data) {
53
+ const columns = Object.keys(data);
54
+ const values = Object.values(data);
55
+ const placeholders = columns.map(() => '?').join(', ');
56
+ const [result] = await this.connection
57
+ .getClient()
58
+ .execute(`INSERT INTO ${this.tableName} (${columns.join(', ')}) VALUES (${placeholders})`, values);
59
+ const insertId = result.insertId;
60
+ return { ...data, [this.fieldId]: insertId };
52
61
  }
53
- async update(id, updateData) {
54
- const [affectedCount, affectedRows] = await this.model.update(updateData, {
55
- where: { id },
56
- returning: true
57
- });
58
- return affectedCount > 0 ? affectedRows[0] : null;
62
+ async update(id, updateData, options) {
63
+ const setClause = Object.keys(updateData)
64
+ .map((key) => `${key} = ?`)
65
+ .join(', ');
66
+ const values = [...Object.values(updateData), id];
67
+ const [result] = await this.connection
68
+ .getClient()
69
+ .execute(`UPDATE ${this.tableName} SET ${setClause} WHERE ${this.fieldId} = ?`, values);
70
+ return result;
59
71
  }
60
- async updateWhere(params, updateData) {
61
- const [affectedCount, affectedRows] = await this.model.update(updateData, {
62
- where: { id },
63
- returning: true
64
- });
65
- return affectedCount > 0 ? affectedRows[0] : null;
72
+ async updateWhere(params, updateData, options = {}) {
73
+ const { query = {} } = params;
74
+ const setClause = Object.keys(updateData)
75
+ .map((key) => `${key} = ?`)
76
+ .join(', ');
77
+ const whereClause = Object.keys(query)
78
+ .map((key) => `${key} = ?`)
79
+ .join(' AND ');
80
+ const values = [...Object.values(updateData), ...Object.values(query)];
81
+ const [result] = await this.connection
82
+ .getClient()
83
+ .execute(`UPDATE ${this.tableName} SET ${setClause} WHERE ${whereClause}`, values);
84
+ return result;
66
85
  }
67
86
  async deleteById(id) {
68
- const result = await this.model.findByPk(id);
69
- if (result) {
70
- await result.destroy();
71
- return result;
72
- }
73
- return null;
87
+ const [result] = await this.connection
88
+ .getClient()
89
+ .execute(`DELETE FROM ${this.tableName} WHERE ${this.fieldId} = ?`, [id]);
90
+ return result;
74
91
  }
75
- async deleteManyByQuery(params) {
92
+ async deleteWhere(params) {
76
93
  const { query = {} } = params;
77
- const deletedCount = await this.model.destroy({ where: query });
78
- return { deletedCount };
94
+ const whereClause = Object.keys(query)
95
+ .map((key) => `${key} = ?`)
96
+ .join(' AND ');
97
+ const values = Object.values(query);
98
+ const [result] = await this.connection
99
+ .getClient()
100
+ .execute(`DELETE FROM ${this.tableName} WHERE ${whereClause}`, values);
101
+ return { deletedCount: result.affectedRows };
102
+ }
103
+ async transaction(callback) {
104
+ const connection = await this.connection.getClient();
105
+ await connection.beginTransaction();
106
+ try {
107
+ const result = await callback(connection);
108
+ await connection.commit();
109
+ return result;
110
+ }
111
+ catch (error) {
112
+ await connection.rollback();
113
+ throw error;
114
+ }
79
115
  }
80
116
  parseSortOptions(sortBy) {
81
- if (!sortBy)
82
- return [];
83
- return sortBy.split(',').map((field) => {
117
+ return sortBy
118
+ .split(',')
119
+ .map((field) => {
84
120
  const [key, order] = field.split(':');
85
- return [key, order === 'desc' ? 'DESC' : 'ASC'];
86
- });
121
+ return `${key} ${order === 'desc' ? 'DESC' : 'ASC'}`;
122
+ })
123
+ .join(', ');
87
124
  }
88
125
  }
package/dist/idaeDb.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { DbType } from './types.js';
1
+ import { DbType } from './@types/types.js';
2
2
  import { IdaeDbConnection } from './IdaeDbConnection.js';
3
3
  import type { IdaeModelOptions } from './IdaeDBModel.js';
4
4
  import type { Document } from 'mongodb';
@@ -6,30 +6,33 @@ import { IdaeDbAdapter } from './IdaeDbAdapter.js';
6
6
  import type { EventListeners } from './IdaeEventEmitter.js';
7
7
  type Uri = string;
8
8
  type IdaeDbInstanceKey = `${DbType}:${Uri}`;
9
- type Options = {
9
+ export type IdaeDbOptions = {
10
10
  dbType: DbType;
11
11
  dbScope: string | undefined;
12
12
  dbScopeSeparator?: string;
13
13
  idaeModelOptions?: IdaeModelOptions;
14
+ dbEvents?: EventListeners<object, object>;
14
15
  };
15
16
  export declare class IdaeDb {
16
17
  #private;
17
18
  private _uri;
18
- private globalEvents?;
19
- private static instances;
20
19
  private constructor();
21
20
  /**
22
21
  * Initializes or retrieves an IdaeDb instance.
23
- * @param dbType The type of database.
24
22
  * @param uri The URI of the database.
23
+ * @param options options.
24
+ * @param options.dbType The type of database.
25
+ * @param options.dbScope The scope of the database.
26
+ * @param options.dbScopeSeparator The separator of the database scope.
27
+ * @param options.idaeModelOptions The options of the IdaeDBModel.
25
28
  * @returns An IdaeDb instance.
26
29
  */
27
- static init(uri: Uri, options?: Partial<Options>): IdaeDb;
30
+ static init(uri: Uri, options?: Partial<IdaeDbOptions>): IdaeDb;
28
31
  /**
29
32
  * Registers event listeners for all collections.
30
33
  * @param events An object containing event listeners for different operations.
31
34
  */
32
- registerEvents<T extends Document>(events: EventListeners<T>): void;
35
+ registerEvents<T extends object, R extends object>(events: EventListeners<T, R>): void;
33
36
  /**
34
37
  * Creates a new database connection.
35
38
  * @param dbName The name of the database.
@@ -44,12 +47,11 @@ export declare class IdaeDb {
44
47
  * @throws Error if the connection is not found or the database type is unsupported.
45
48
  */
46
49
  collection<T extends Document>(collectionName: string): IdaeDbAdapter<T>;
47
- private applyEvents;
48
50
  closeConnection(): Promise<void>;
49
51
  closeAllConnections(): Promise<void>;
50
- get adapterClass(): import("./types.js").IdaeDbAdapterInterface<T> | undefined;
52
+ get adapterClass(): import("./@types/types.js").AdapterConstructor<IdaeDbConnection> | undefined;
51
53
  get connectionKey(): IdaeDbInstanceKey;
52
54
  get uri(): string;
53
- get options(): Options;
55
+ get options(): IdaeDbOptions;
54
56
  }
55
57
  export {};
package/dist/idaeDb.js CHANGED
@@ -1,44 +1,52 @@
1
1
  // packages\idae-db\lib\idaeDb.ts
2
- import { DbType } from './types.js';
2
+ import { DbType } from './@types/types.js';
3
3
  import { IdaeDbConnection } from './IdaeDbConnection.js';
4
4
  import { IdaeDbAdapter } from './IdaeDbAdapter.js';
5
5
  export class IdaeDb {
6
6
  _uri;
7
- globalEvents;
8
- static instances = new Map();
7
+ #globalEvents;
8
+ static #instances = new Map();
9
9
  #adapterClass;
10
10
  #connections = new Map();
11
11
  #connection = undefined;
12
12
  #options = {
13
13
  dbType: DbType.MONGODB,
14
14
  dbScope: undefined,
15
- idaeModelOptions: {}
15
+ idaeModelOptions: {},
16
+ dbEvents: {}
16
17
  };
17
18
  constructor(_uri, options = {}) {
18
19
  this._uri = _uri;
19
20
  this.#options = { ...this.#options, ...options };
20
21
  this.#adapterClass = IdaeDbAdapter.getAdapterForDbType(this.options.dbType);
22
+ if (this.#options.dbEvents) {
23
+ this.registerEvents(this.#options.dbEvents);
24
+ }
21
25
  }
22
26
  /**
23
27
  * Initializes or retrieves an IdaeDb instance.
24
- * @param dbType The type of database.
25
28
  * @param uri The URI of the database.
29
+ * @param options options.
30
+ * @param options.dbType The type of database.
31
+ * @param options.dbScope The scope of the database.
32
+ * @param options.dbScopeSeparator The separator of the database scope.
33
+ * @param options.idaeModelOptions The options of the IdaeDBModel.
26
34
  * @returns An IdaeDb instance.
27
35
  */
28
36
  static init(uri, options) {
29
37
  const dbType = options?.dbType ?? DbType.MONGODB;
30
38
  const instanceKey = `${dbType}:${uri}`;
31
- if (!IdaeDb.instances.has(instanceKey)) {
32
- IdaeDb.instances.set(instanceKey, new IdaeDb(uri, options));
39
+ if (!IdaeDb.#instances.has(instanceKey)) {
40
+ IdaeDb.#instances.set(instanceKey, new IdaeDb(uri, options));
33
41
  }
34
- return IdaeDb.instances.get(instanceKey);
42
+ return IdaeDb.#instances.get(instanceKey);
35
43
  }
36
44
  /**
37
45
  * Registers event listeners for all collections.
38
46
  * @param events An object containing event listeners for different operations.
39
47
  */
40
48
  registerEvents(events) {
41
- this.globalEvents = events;
49
+ this.#globalEvents = events;
42
50
  }
43
51
  /**
44
52
  * Creates a new database connection.
@@ -66,12 +74,12 @@ export class IdaeDb {
66
74
  throw new Error(`Connection for '${this.options.dbType}:${this._uri}' not found.`);
67
75
  }
68
76
  const adapter = new IdaeDbAdapter(collectionName, this.#connection, this.options.dbType);
69
- if (this.globalEvents) {
70
- this.applyEvents(adapter, this.globalEvents);
77
+ if (this.#globalEvents) {
78
+ this.#applyEvents(adapter, this.#globalEvents);
71
79
  }
72
80
  return adapter;
73
81
  }
74
- applyEvents(adapter, events) {
82
+ #applyEvents(adapter, events) {
75
83
  for (const [method, listeners] of Object.entries(events)) {
76
84
  if (listeners.pre) {
77
85
  adapter.on(`pre:${String(method)}`, listeners.pre);
package/dist/index.d.ts CHANGED
@@ -1,4 +1,3 @@
1
- export * from './types.js';
2
1
  export * from './idaeDb.js';
3
2
  export * from './IdaeEventEmitter.js';
4
3
  export * from './IdaeDbConnection.js';
@@ -7,3 +6,4 @@ export * from './IdaeDBModel.js';
7
6
  export * from './adapters/MySQLAdapter.js';
8
7
  export * from './adapters/MongoDBAdapter.js';
9
8
  export * from './adapters/ChromaDBAdapter.js';
9
+ export * from './@types/types.js';
package/dist/index.js CHANGED
@@ -1,5 +1,4 @@
1
1
  // auto exports of entry components
2
- export * from './types.js';
3
2
  export * from './idaeDb.js';
4
3
  export * from './IdaeEventEmitter.js';
5
4
  export * from './IdaeDbConnection.js';
@@ -8,3 +7,4 @@ export * from './IdaeDBModel.js';
8
7
  export * from './adapters/MySQLAdapter.js';
9
8
  export * from './adapters/MongoDBAdapter.js';
10
9
  export * from './adapters/ChromaDBAdapter.js';
10
+ export * from './@types/types.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@medyll/idae-db",
3
- "version": "0.3.0",
3
+ "version": "0.5.0",
4
4
  "scripts": {
5
5
  "dev": "vite dev",
6
6
  "build": "vite build && npm run package",
package/dist/types.d.ts DELETED
@@ -1,33 +0,0 @@
1
- import { type Document, type Filter, type IndexSpecification, type CreateIndexesOptions } from 'mongodb';
2
- export interface IdaeDbAdapterInterface<T extends Document> {
3
- createIndex(fieldOrSpec: IndexSpecification, options?: CreateIndexesOptions): Promise<string>;
4
- create(data: Partial<T>): Promise<T>;
5
- findById(id: string): Promise<T[]>;
6
- find(params: IdaeDbParams<T>): Promise<T[]>;
7
- findOne(params: IdaeDbParams<T>): Promise<T | null>;
8
- update(id: string, updateData: Partial<T>): Promise<any>;
9
- updateWhere(params: IdaeDbParams<T>, updateData: Partial<T>): Promise<any>;
10
- deleteById(id: string): Promise<any>;
11
- deleteWhere(params: IdaeDbParams<T>): Promise<{
12
- deletedCount?: number;
13
- }>;
14
- transaction<TResult>(callback: (session: any) => Promise<TResult>): Promise<TResult>;
15
- connect(uri: string): Promise<any>;
16
- getDb(client: any, dbName: string): any;
17
- close(client: any): Promise<void>;
18
- }
19
- export interface IdaeDbParams<T extends object = Record<string, unknown>> {
20
- id?: string;
21
- query: Filter<T>;
22
- sortBy?: string;
23
- limit?: number;
24
- skip?: number;
25
- }
26
- export interface IdaeDbParamsSortOptions {
27
- [key: string]: 1 | -1;
28
- }
29
- export declare enum DbType {
30
- MONGODB = "mongodb",
31
- MYSQL = "mysql",
32
- CHROMADB = "chromaDb"
33
- }
package/dist/types.js DELETED
@@ -1,8 +0,0 @@
1
- // packages\idae-db\src\lib\adapters\types.ts
2
- import {} from 'mongodb';
3
- export var DbType;
4
- (function (DbType) {
5
- DbType["MONGODB"] = "mongodb";
6
- DbType["MYSQL"] = "mysql";
7
- DbType["CHROMADB"] = "chromaDb";
8
- })(DbType || (DbType = {}));