blackcat.js-database 1.0.4 → 1.0.6

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.
package/dist/index.mjs CHANGED
@@ -1,15 +1,17 @@
1
1
  var __defProp = Object.defineProperty;
2
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3
2
  var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
4
- var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
5
3
 
6
4
  // src/utils/isObject.function.ts
7
- var isObject = /* @__PURE__ */ __name((item) => !Array.isArray(item) && item !== null && typeof item == "object", "isObject");
5
+ var isObject = /* @__PURE__ */ __name((item) => !Array.isArray(item) && item !== null && typeof item === "object", "isObject");
8
6
 
9
7
  // src/utils/typeOf.function.ts
10
8
  var typeOf = /* @__PURE__ */ __name((input) => {
11
- if (input == null || typeof input === "number" && Number.isNaN(input)) return String(input);
12
- if (typeof input === "function" && input.prototype) return `${input.name} class instance`;
9
+ if (input == null || typeof input === "number" && Number.isNaN(input)) {
10
+ return String(input);
11
+ }
12
+ if (typeof input === "function" && input.prototype) {
13
+ return `${input.name} class instance`;
14
+ }
13
15
  return input?.constructor?.name ?? typeof input;
14
16
  }, "typeOf");
15
17
 
@@ -18,23 +20,18 @@ var isNumber = /* @__PURE__ */ __name((input) => !isNaN(input) && input !== "" &
18
20
 
19
21
  // src/utils/BlackCatError.ts
20
22
  var errors = {
21
- DEVICE_IS_OFFLINE: "Your device appears to be offline so it's impossible to proceed with connection to your online MongoDB cluster. Please connect your device to the internet or switch to the local MongoDB database and try again.",
22
- CONNECTION_NOT_ESTABLISHED: "Failed to connect to MongoDB. Please double-check the specified connection URI and make sure that you're performing the database connection using the `QuickMongoClient.connect()` method.",
23
- CONNECTION_URI_NOT_SPECIFIED: "The MongoDB connection URI must be specified.",
24
- INVALID_CONNECTION_URI: "The specified MongoDB connection URI is invalid.",
25
- UNKNOWN_ERROR: "Unknown error.",
26
- REQUIRED_PARAMETER_MISSING: "'{1}' parameter is required but is missing.",
27
- REQUIRED_CONSTRUCTOR_PARAMETER_MISSING: "'{1}' parameter in constructor '{2}' is required but is missing.",
28
- INVALID_CONSTRUCTOR_PARAMETER_TYPE: "'{1}' parameter in constructor '{2}' must be a type of {3}. Received type: {4}.",
29
- INVALID_TYPE: "'{1}' must be a type of {2}. Received type: {3}.",
30
- ONE_OR_MORE_ARRAY_TYPES_INVALID: "All specified elements from array in '{1}' parameter must be a type of {2}. Received array of types: {3}.",
31
- INVALID_TARGET: "The target in database must be a type of {1}. Received target type: {2}.",
32
- INVALID_KEY: "{1}",
33
- INVALID_PARAMETER: "{1} {2}",
34
- DATABASE_CONNECTION_FAILED: "{1}"
23
+ UNKNOWN_ERROR: "L\u1ED7i kh\xF4ng x\xE1c \u0111\u1ECBnh.",
24
+ REQUIRED_PARAMETER_MISSING: "Tham s\u1ED1 '{1}' l\xE0 b\u1EAFt bu\u1ED9c nh\u01B0ng ch\u01B0a \u0111\u01B0\u1EE3c cung c\u1EA5p.",
25
+ INVALID_TYPE: "'{1}' ph\u1EA3i c\xF3 ki\u1EC3u {2}. Ki\u1EC3u nh\u1EADn \u0111\u01B0\u1EE3c: {3}.",
26
+ ONE_OR_MORE_ARRAY_TYPES_INVALID: "T\u1EA5t c\u1EA3 ph\u1EA7n t\u1EED trong m\u1EA3ng c\u1EE7a tham s\u1ED1 '{1}' ph\u1EA3i c\xF3 ki\u1EC3u {2}. C\xE1c ki\u1EC3u nh\u1EADn \u0111\u01B0\u1EE3c trong m\u1EA3ng: {3}.",
27
+ INVALID_TARGET: "\u0110\u1ED1i t\u01B0\u1EE3ng target trong database ph\u1EA3i c\xF3 ki\u1EC3u {1}. Ki\u1EC3u nh\u1EADn \u0111\u01B0\u1EE3c: {2}.",
28
+ INVALID_KEY: "{1}"
35
29
  };
36
30
  var createTypesArray = /* @__PURE__ */ __name((...elements) => `[${elements.map((element) => typeOf(element))}]`, "createTypesArray");
37
- var _BlackCatError = class _BlackCatError extends Error {
31
+ var BlackCatError = class extends Error {
32
+ static {
33
+ __name(this, "BlackCatError");
34
+ }
38
35
  /**
39
36
  * Creates a BlackCatError instance.
40
37
  * @param {string} errorCode Quick Mongo error code.
@@ -51,65 +48,138 @@ var _BlackCatError = class _BlackCatError extends Error {
51
48
  this.name = `BlackCatError [${code}]`;
52
49
  }
53
50
  };
54
- __name(_BlackCatError, "BlackCatError");
55
- var BlackCatError = _BlackCatError;
56
51
 
57
52
  // src/utils/TypedObject.ts
58
- var _TypedObject = class _TypedObject {
53
+ var TypedObject = class {
54
+ static {
55
+ __name(this, "TypedObject");
56
+ }
59
57
  /**
60
- * Returns the names of the enumerable string properties and methods of an object.
58
+ * Lấy danh sách key của object với type chính xác.
59
+ *
60
+ * @typeParam TObject - Kiểu object đầu vào
61
61
  *
62
- * Type parameters:
62
+ * @param obj - Object cần lấy key
63
+ * @returns Mảng các key của object (`ExtractObjectKeys<TObject>[]`)
63
64
  *
64
- * - `TObject` (`Record<string, any>`) - The object to get the object keys types from.
65
+ * @remarks
66
+ * Khác với `Object.keys`:
67
+ * - `Object.keys(obj)` → `string[]`
68
+ * - `TypedObject.keys(obj)` → union key chính xác
69
+ *
70
+ * ---
71
+ *
72
+ * ### Lưu ý:
73
+ * - Nếu `obj` là `null` hoặc `undefined`, sẽ fallback thành `{}` → trả về `[]`
74
+ *
75
+ * ---
76
+ *
77
+ * @example
78
+ * ```ts
79
+ * const obj = { a: 1, b: 2 };
65
80
  *
66
- * @param {TObject} obj Object to get the keys from.
81
+ * const keys = TypedObject.keys(obj);
82
+ * // ("a" | "b")[]
83
+ * ```
67
84
  *
68
- * @returns {Array<ExtractObjectKeys<TObject>>}
69
- * Array of names of the enumerable string properties and methods of the specified object.
85
+ * @see Object.keys
70
86
  */
71
87
  static keys(obj) {
72
88
  return Object.keys(obj || {});
73
89
  }
74
90
  /**
75
- * Returns an array of values of the enumerable properties of an object.
91
+ * Lấy danh sách value của object với type chính xác.
92
+ *
93
+ * @typeParam TObject - Kiểu object đầu vào
94
+ *
95
+ * @param obj - Object cần lấy value
96
+ * @returns Mảng các value của object (`ExtractObjectValues<TObject>[]`)
97
+ *
98
+ * @remarks
99
+ * Khác với `Object.values`:
100
+ * - `Object.values(obj)` → `any[]`
101
+ * - `TypedObject.values(obj)` → union value chính xác
76
102
  *
77
- * Type parameters:
103
+ * ---
78
104
  *
79
- * - `TObject` (`Record<string, any>`) - The object to get the object values types from.
105
+ * ### Lưu ý:
106
+ * - Nếu `obj` là `null` hoặc `undefined`, sẽ fallback thành `{}` → trả về `[]`
80
107
  *
81
- * @param {TObject} obj Object to get the values from.
108
+ * ---
109
+ *
110
+ * @example
111
+ * ```ts
112
+ * const obj = { a: 1, b: 2 };
113
+ *
114
+ * const values = TypedObject.values(obj);
115
+ * // number[]
116
+ * ```
82
117
  *
83
- * @returns {Array<ExtractObjectValues<TObject>>}
84
- * Array of values of the enumerable properties of the specified object.
118
+ * @see Object.values
85
119
  */
86
120
  static values(obj) {
87
121
  return Object.values(obj || {});
88
122
  }
89
123
  /**
90
- * Returns an array of entries (key-value pairs) of the enumerable properties of an object.
124
+ * Lấy danh sách entry (key-value) của object với type chính xác.
91
125
  *
92
- * Type parameters:
126
+ * @typeParam TObject - Kiểu object đầu vào
93
127
  *
94
- * - `TObject` (`Record<string, any>`) - The object to get the object entries types (key-value pairs types) from.
128
+ * @param obj - Object cần lấy entries
129
+ * @returns Mảng các cặp `[key, value]` (`ExtractObjectEntries<TObject>[]`)
95
130
  *
96
- * @param {TObject} obj Object to get the entries from.
131
+ * @remarks
132
+ * Khác với `Object.entries`:
133
+ * - `Object.entries(obj)` → `[string, any][]`
134
+ * - `TypedObject.entries(obj)` → typed tuple chính xác
97
135
  *
98
- * @returns {ExtractObjectEntries<TObject>[]}
99
- * Array of entries (key-value pairs) of the enumerable properties of the specified object.
136
+ * ---
137
+ *
138
+ * ### Lưu ý:
139
+ * - Nếu `obj` là `null` hoặc `undefined`, sẽ fallback thành `{}` → trả về `[]`
140
+ *
141
+ * ---
142
+ *
143
+ * @example
144
+ * ```ts
145
+ * const obj = { a: 1, b: 2 };
146
+ *
147
+ * const entries = TypedObject.entries(obj);
148
+ * // ["a" | "b", number][]
149
+ * ```
150
+ *
151
+ * @example
152
+ * ```ts
153
+ * for (const [key, value] of TypedObject.entries(obj)) {
154
+ * // key & value được infer đúng type
155
+ * }
156
+ * ```
157
+ *
158
+ * @see Object.entries
100
159
  */
101
160
  static entries(obj) {
102
161
  return Object.entries(obj || {});
103
162
  }
104
163
  };
105
- __name(_TypedObject, "TypedObject");
106
- var TypedObject = _TypedObject;
107
-
108
- // src/utils/Emitter.ts
109
- import { EventEmitter } from "events";
110
164
 
111
165
  // src/Database.ts
112
- var _Database = class _Database {
166
+ var Database = class {
167
+ static {
168
+ __name(this, "Database");
169
+ }
170
+ /**
171
+ * Storage driver được sử dụng để đọc và ghi dữ liệu database.
172
+ *
173
+ * Driver phải implement interface `DatabaseDriver`.
174
+ *
175
+ * Ví dụ:
176
+ * ```ts
177
+ * const db = new Database({
178
+ * driver: new JSONDriver({ filePath: "./database.json" }),
179
+ * })
180
+ * ```
181
+ */
182
+ driver;
113
183
  /**
114
184
  * Khởi tạo Database instance.
115
185
  *
@@ -135,19 +205,6 @@ var _Database = class _Database {
135
205
  * ```
136
206
  */
137
207
  constructor(options) {
138
- /**
139
- * Storage driver được sử dụng để đọc và ghi dữ liệu database.
140
- *
141
- * Driver phải implement interface `DatabaseDriver`.
142
- *
143
- * Ví dụ:
144
- * ```ts
145
- * const db = new Database({
146
- * driver: new JSONDriver({ filePath: "./database.json" }),
147
- * })
148
- * ```
149
- */
150
- __publicField(this, "driver");
151
208
  this.driver = options.driver;
152
209
  }
153
210
  /**
@@ -196,7 +253,6 @@ var _Database = class _Database {
196
253
  */
197
254
  async get(key) {
198
255
  const data = await this.all();
199
- if (key === void 0) return data;
200
256
  if (typeof key !== "string") {
201
257
  throw new BlackCatError("INVALID_TYPE", "key", "string", typeOf(key));
202
258
  }
@@ -285,7 +341,7 @@ var _Database = class _Database {
285
341
  * @param {AutocompletableString<P>} key Đường dẫn dữ liệu cần gán giá trị.
286
342
  * @param {ObjectValue<V, P>} value Giá trị mới.
287
343
  *
288
- * @returns {Promise<If<IsObject<V>, ObjectValue<V, FirstObjectKey<P>>, V>>} Giá trị vừa được set hoặc object root nếu value là object.
344
+ * @returns {void} Giá trị vừa được set hoặc object root nếu value là object.
289
345
  *
290
346
  * @example
291
347
  * ```ts
@@ -320,7 +376,6 @@ var _Database = class _Database {
320
376
  }
321
377
  ;
322
378
  await this.driver.set(allDatabase);
323
- return typeof value == "object" && value !== null ? await this.get(keys[0]) : value;
324
379
  }
325
380
  /**
326
381
  * Xóa một key khỏi database.
@@ -537,7 +592,8 @@ var _Database = class _Database {
537
592
  if (!isNumber(numberToAdd)) {
538
593
  throw new BlackCatError("INVALID_TYPE", "numberToAdd", "number", typeOf(numberToAdd));
539
594
  }
540
- return await this.set(key, targetNumber + numberToAdd);
595
+ await this.set(key, targetNumber + numberToAdd);
596
+ return targetNumber + numberToAdd;
541
597
  }
542
598
  /**
543
599
  * Trừ giá trị khỏi một key dạng number.
@@ -567,7 +623,8 @@ var _Database = class _Database {
567
623
  if (!isNumber(numberToSubtract)) {
568
624
  throw new BlackCatError("INVALID_TYPE", "numberToSubtract", "number", typeOf(numberToSubtract));
569
625
  }
570
- return await this.set(key, targetNumber - numberToSubtract);
626
+ await this.set(key, targetNumber - numberToSubtract);
627
+ return targetNumber - numberToSubtract;
571
628
  }
572
629
  /**
573
630
  * Thêm một hoặc nhiều phần tử vào cuối array tại key-path.
@@ -785,7 +842,8 @@ var _Database = class _Database {
785
842
  * const userKeys = await db.keys("user");
786
843
  */
787
844
  async keys(key) {
788
- if (!key) return TypedObject.keys(await this.all());
845
+ const all = await this.all();
846
+ if (!key) return TypedObject.keys(all);
789
847
  const data = await this.get(key);
790
848
  return TypedObject.keys(data).filter((key2) => data[key2] !== void 0 && data[key2] !== null);
791
849
  }
@@ -819,7 +877,8 @@ var _Database = class _Database {
819
877
  * const userValues = await db.values("users");
820
878
  */
821
879
  async values(key) {
822
- if (!key) return TypedObject.values(await this.all());
880
+ const all = await this.all();
881
+ if (!key) return TypedObject.values(all);
823
882
  const data = await this.get(key);
824
883
  return TypedObject.values(data);
825
884
  }
@@ -944,12 +1003,21 @@ var _Database = class _Database {
944
1003
  return values.every(queryFunction);
945
1004
  }
946
1005
  };
947
- __name(_Database, "Database");
948
- var Database = _Database;
949
1006
 
950
1007
  // src/drivers/JSONDriver.ts
951
1008
  import { promises as fs } from "fs";
952
- var _JSONDriver = class _JSONDriver {
1009
+ var JSONDriver = class {
1010
+ static {
1011
+ __name(this, "JSONDriver");
1012
+ }
1013
+ /**
1014
+ * Đường dẫn tới file database JSON.
1015
+ */
1016
+ filePath;
1017
+ /**
1018
+ * Cho biết có minify JSON khi ghi file hay không.
1019
+ */
1020
+ minifyJSON;
953
1021
  /**
954
1022
  * Khởi tạo một instance mới của {@link JSONDriver}.
955
1023
  *
@@ -971,14 +1039,6 @@ var _JSONDriver = class _JSONDriver {
971
1039
  * ```
972
1040
  */
973
1041
  constructor(options) {
974
- /**
975
- * Đường dẫn tới file database JSON.
976
- */
977
- __publicField(this, "filePath");
978
- /**
979
- * Cho biết có minify JSON khi ghi file hay không.
980
- */
981
- __publicField(this, "minifyJSON");
982
1042
  this.filePath = options.filePath || "database.json";
983
1043
  this.minifyJSON = options.minifyJSON || false;
984
1044
  }
@@ -1039,11 +1099,16 @@ var _JSONDriver = class _JSONDriver {
1039
1099
  return true;
1040
1100
  }
1041
1101
  };
1042
- __name(_JSONDriver, "JSONDriver");
1043
- var JSONDriver = _JSONDriver;
1044
1102
 
1045
1103
  // src/drivers/MemoryDriver.ts
1046
- var _MemoryDriver = class _MemoryDriver {
1104
+ var MemoryDriver = class {
1105
+ static {
1106
+ __name(this, "MemoryDriver");
1107
+ }
1108
+ /**
1109
+ * Object chứa toàn bộ dữ liệu database trong RAM.
1110
+ */
1111
+ store;
1047
1112
  /**
1048
1113
  * Khởi tạo MemoryDriver.
1049
1114
  *
@@ -1070,10 +1135,6 @@ var _MemoryDriver = class _MemoryDriver {
1070
1135
  * ```
1071
1136
  */
1072
1137
  constructor(initialData = {}) {
1073
- /**
1074
- * Object chứa toàn bộ dữ liệu database trong RAM.
1075
- */
1076
- __publicField(this, "store");
1077
1138
  this.store = initialData;
1078
1139
  }
1079
1140
  /**
@@ -1104,12 +1165,21 @@ var _MemoryDriver = class _MemoryDriver {
1104
1165
  return true;
1105
1166
  }
1106
1167
  };
1107
- __name(_MemoryDriver, "MemoryDriver");
1108
- var MemoryDriver = _MemoryDriver;
1109
1168
 
1110
1169
  // src/drivers/SQLiteDriver.ts
1111
1170
  import SQLite from "better-sqlite3";
1112
- var _SQLiteDriver = class _SQLiteDriver {
1171
+ var SQLiteDriver = class {
1172
+ static {
1173
+ __name(this, "SQLiteDriver");
1174
+ }
1175
+ /**
1176
+ * SQLite database instance.
1177
+ */
1178
+ db;
1179
+ /**
1180
+ * Tên table lưu trữ dữ liệu JSON.
1181
+ */
1182
+ table;
1113
1183
  /**
1114
1184
  * Khởi tạo SQLiteDriver.
1115
1185
  *
@@ -1126,14 +1196,6 @@ var _SQLiteDriver = class _SQLiteDriver {
1126
1196
  * ```
1127
1197
  */
1128
1198
  constructor(options = {}) {
1129
- /**
1130
- * SQLite database instance.
1131
- */
1132
- __publicField(this, "db");
1133
- /**
1134
- * Tên table lưu trữ dữ liệu JSON.
1135
- */
1136
- __publicField(this, "table");
1137
1199
  this.db = new SQLite(options.filePath ?? "database.sqlite");
1138
1200
  this.table = options.table ?? "json_store";
1139
1201
  this.db.prepare(`CREATE TABLE IF NOT EXISTS ${this.table} (id INTEGER PRIMARY KEY, data TEXT)`).run();
@@ -1171,12 +1233,45 @@ var _SQLiteDriver = class _SQLiteDriver {
1171
1233
  return true;
1172
1234
  }
1173
1235
  };
1174
- __name(_SQLiteDriver, "SQLiteDriver");
1175
- var SQLiteDriver = _SQLiteDriver;
1176
1236
 
1177
1237
  // src/drivers/MongoDriver.ts
1178
1238
  import { MongoClient } from "mongodb";
1179
- var _MongoDriver = class _MongoDriver {
1239
+ var MongoDriver = class {
1240
+ static {
1241
+ __name(this, "MongoDriver");
1242
+ }
1243
+ /**
1244
+ * MongoDB client instance.
1245
+ */
1246
+ client;
1247
+ /**
1248
+ * MongoDB database instance.
1249
+ */
1250
+ db;
1251
+ /**
1252
+ * Collection lưu dữ liệu JSON.
1253
+ */
1254
+ collection;
1255
+ /**
1256
+ * Tên database MongoDB.
1257
+ */
1258
+ databaseName;
1259
+ /**
1260
+ * Tên collection MongoDB.
1261
+ */
1262
+ collectionName;
1263
+ /**
1264
+ * Callback khi kết nối thành công.
1265
+ */
1266
+ onLoad;
1267
+ /**
1268
+ * Callback khi xảy ra lỗi.
1269
+ */
1270
+ onError;
1271
+ /**
1272
+ * Trạng thái đã gọi onLoad chưa (tránh spam)
1273
+ */
1274
+ isLoaded = false;
1180
1275
  /**
1181
1276
  * Khởi tạo MongoDriver.
1182
1277
  *
@@ -1184,35 +1279,25 @@ var _MongoDriver = class _MongoDriver {
1184
1279
  *
1185
1280
  * @example
1186
1281
  * ```ts
1282
+ * import { Database, MongoDriver } from "blackcat.js-database";
1283
+ *
1187
1284
  * const database = new Database({
1188
1285
  * driver: new MongoDriver({
1189
1286
  * mongourl: "mongodb://localhost:27017",
1190
1287
  * databaseName: "mydb",
1191
- * collectionName: "store"
1288
+ * collectionName: "store",
1289
+ * onLoad: ({ db, collection, databaseName }) => {
1290
+ * console.log(`✅ Đã kết nối với cơ sở dữ liệu: ${databaseName}`);
1291
+ * console.log(`📦 Bộ sưu tập: ${collection.collectionName}`);
1292
+ * },
1293
+ * onError: ({ error, databaseName }) => {
1294
+ * console.error(`❌ Không thể kết nối với cơ sở dữ liệu: ${databaseName}`);
1295
+ * console.error(error);
1296
+ * }
1192
1297
  * })
1193
1298
  * });
1194
1299
  */
1195
1300
  constructor(options = {}) {
1196
- /**
1197
- * MongoDB client instance.
1198
- */
1199
- __publicField(this, "client");
1200
- /**
1201
- * MongoDB database instance.
1202
- */
1203
- __publicField(this, "db");
1204
- /**
1205
- * Collection lưu dữ liệu JSON.
1206
- */
1207
- __publicField(this, "collection");
1208
- /**
1209
- * Tên database MongoDB.
1210
- */
1211
- __publicField(this, "databaseName");
1212
- /**
1213
- * Tên collection MongoDB.
1214
- */
1215
- __publicField(this, "collectionName");
1216
1301
  const {
1217
1302
  mongourl = "mongodb://localhost:27017",
1218
1303
  databaseName = "database",
@@ -1221,21 +1306,42 @@ var _MongoDriver = class _MongoDriver {
1221
1306
  this.client = new MongoClient(mongourl);
1222
1307
  this.databaseName = databaseName;
1223
1308
  this.collectionName = collectionName;
1309
+ this.onLoad = options.onLoad;
1310
+ this.onError = options.onError;
1224
1311
  }
1225
1312
  /**
1226
1313
  * Thiết lập kết nối MongoDB nếu chưa kết nối.
1227
1314
  */
1228
1315
  async connect() {
1229
1316
  if (!this.db) {
1230
- await this.client.connect();
1231
- this.db = this.client.db(this.databaseName);
1232
- this.collection = this.db.collection(this.collectionName);
1233
- const doc = await this.collection.findOne({ _id: "database" });
1234
- if (!doc) {
1235
- await this.collection.insertOne({
1236
- _id: "database",
1237
- data: {}
1317
+ try {
1318
+ await this.client.connect();
1319
+ this.db = this.client.db(this.databaseName);
1320
+ this.collection = this.db.collection(this.collectionName);
1321
+ const doc = await this.collection.findOne({ _id: "database" });
1322
+ if (!doc) {
1323
+ await this.collection.insertOne({
1324
+ _id: "database",
1325
+ data: {}
1326
+ });
1327
+ }
1328
+ if (!this.isLoaded) {
1329
+ this.isLoaded = true;
1330
+ this.onLoad?.({
1331
+ client: this.client,
1332
+ db: this.db,
1333
+ collection: this.collection,
1334
+ databaseName: this.databaseName,
1335
+ collectionName: this.collectionName
1336
+ });
1337
+ }
1338
+ } catch (error) {
1339
+ this.onError?.({
1340
+ error,
1341
+ databaseName: this.databaseName,
1342
+ collectionName: this.collectionName
1238
1343
  });
1344
+ throw error;
1239
1345
  }
1240
1346
  }
1241
1347
  }
@@ -1275,8 +1381,6 @@ var _MongoDriver = class _MongoDriver {
1275
1381
  return true;
1276
1382
  }
1277
1383
  };
1278
- __name(_MongoDriver, "MongoDriver");
1279
- var MongoDriver = _MongoDriver;
1280
1384
  export {
1281
1385
  Database,
1282
1386
  JSONDriver,