apexify.js 1.2.9 → 2.1.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.
- package/README.md +583 -361
- package/declare.d.ts +117 -1
- package/index.js +1 -4
- package/lib/canvas/ApexPainter.js +50 -55
- package/lib/database/NanoDB.js +353 -330
- package/lib/discord/events/starter.js +88 -19
- package/lib/general-functions/utils.js +19 -0
- package/lib/utils.js +1 -1
- package/package.json +47 -5
package/lib/database/NanoDB.js
CHANGED
|
@@ -77,8 +77,9 @@ var utils_1 = require("./utils");
|
|
|
77
77
|
var fs = require("fs");
|
|
78
78
|
var fs_1 = require("fs");
|
|
79
79
|
var zlib = require("zlib");
|
|
80
|
+
var archiver = require("archiver");
|
|
80
81
|
var path = require("path");
|
|
81
|
-
var crypto = require("crypto
|
|
82
|
+
var crypto = require("crypto");
|
|
82
83
|
var NanoDb = /** @class */ (function (_super) {
|
|
83
84
|
__extends(NanoDb, _super);
|
|
84
85
|
function NanoDb(filePath) {
|
|
@@ -139,7 +140,7 @@ var NanoDb = /** @class */ (function (_super) {
|
|
|
139
140
|
};
|
|
140
141
|
NanoDb.prototype.displayData = function (options) {
|
|
141
142
|
return __awaiter(this, void 0, void 0, function () {
|
|
142
|
-
var data, filteredData, sortOrder_1, page, pageSize, startIndex, endIndex, paginatedData, error_2;
|
|
143
|
+
var data, filteredData, sortBy_1, sortOrder_1, page, pageSize, startIndex, endIndex, paginatedData, error_2;
|
|
143
144
|
return __generator(this, function (_a) {
|
|
144
145
|
switch (_a.label) {
|
|
145
146
|
case 0:
|
|
@@ -151,9 +152,10 @@ var NanoDb = /** @class */ (function (_super) {
|
|
|
151
152
|
if (options === null || options === void 0 ? void 0 : options.filters) {
|
|
152
153
|
filteredData = data.filter(function (document) { return (0, utils_1.matchesFilterQuery)(document, options.filters); });
|
|
153
154
|
}
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
155
|
+
sortBy_1 = options === null || options === void 0 ? void 0 : options.sortBy;
|
|
156
|
+
sortOrder_1 = (options === null || options === void 0 ? void 0 : options.sortOrder) === 'desc' ? -1 : 1;
|
|
157
|
+
if (sortBy_1) {
|
|
158
|
+
filteredData.sort(function (a, b) { return (a[sortBy_1] > b[sortBy_1] ? sortOrder_1 : -sortOrder_1); });
|
|
157
159
|
}
|
|
158
160
|
page = (options === null || options === void 0 ? void 0 : options.page) || 1;
|
|
159
161
|
pageSize = (options === null || options === void 0 ? void 0 : options.pageSize) || 10;
|
|
@@ -271,10 +273,11 @@ var NanoDb = /** @class */ (function (_super) {
|
|
|
271
273
|
});
|
|
272
274
|
});
|
|
273
275
|
};
|
|
274
|
-
NanoDb.prototype.updateData = function (filterQuery, updateOptions, upsert) {
|
|
276
|
+
NanoDb.prototype.updateData = function (filterQuery, updateOptions, uniqueKeys, upsert) {
|
|
277
|
+
if (uniqueKeys === void 0) { uniqueKeys = []; }
|
|
275
278
|
if (upsert === void 0) { upsert = false; }
|
|
276
279
|
return __awaiter(this, void 0, void 0, function () {
|
|
277
|
-
var data, indexToUpdate, updatedDocument, newDocument, error_5;
|
|
280
|
+
var data, existingDocumentsWithUniqueKeys, indexToUpdate, updatedDocument, newDocument, error_5;
|
|
278
281
|
return __generator(this, function (_a) {
|
|
279
282
|
switch (_a.label) {
|
|
280
283
|
case 0:
|
|
@@ -282,6 +285,27 @@ var NanoDb = /** @class */ (function (_super) {
|
|
|
282
285
|
return [4 /*yield*/, this.dataPromise];
|
|
283
286
|
case 1:
|
|
284
287
|
data = _a.sent();
|
|
288
|
+
if (uniqueKeys.length > 0) {
|
|
289
|
+
existingDocumentsWithUniqueKeys = data.filter(function (document) {
|
|
290
|
+
return uniqueKeys.every(function (key) {
|
|
291
|
+
return document.unique && document.unique[key] === updateOptions[key];
|
|
292
|
+
});
|
|
293
|
+
});
|
|
294
|
+
if (existingDocumentsWithUniqueKeys.length > 0) {
|
|
295
|
+
this.emit('dataUpdateError', {
|
|
296
|
+
success: false,
|
|
297
|
+
message: "Update violates uniqueness for specified keys: ".concat(uniqueKeys.join(', '), "."),
|
|
298
|
+
documentsCount: data.length,
|
|
299
|
+
fileSizeInBytes: 0,
|
|
300
|
+
});
|
|
301
|
+
return [2 /*return*/, {
|
|
302
|
+
success: false,
|
|
303
|
+
message: "Update violates uniqueness for specified keys: ".concat(uniqueKeys.join(', '), "."),
|
|
304
|
+
documentsCount: data.length,
|
|
305
|
+
fileSizeInBytes: 0,
|
|
306
|
+
}];
|
|
307
|
+
}
|
|
308
|
+
}
|
|
285
309
|
indexToUpdate = data.findIndex(function (document) { return (0, utils_1.matchesFilterQuery)(document, filterQuery); });
|
|
286
310
|
if (!(indexToUpdate !== -1)) return [3 /*break*/, 3];
|
|
287
311
|
return [4 /*yield*/, (0, utils_1.updateOption)(data[indexToUpdate], updateOptions)];
|
|
@@ -681,7 +705,7 @@ var NanoDb = /** @class */ (function (_super) {
|
|
|
681
705
|
};
|
|
682
706
|
NanoDb.prototype.distinct = function (field) {
|
|
683
707
|
return __awaiter(this, void 0, void 0, function () {
|
|
684
|
-
var data, distinctValues, error_12;
|
|
708
|
+
var data, distinctValues, valueSet, _i, data_2, document_2, fieldValue, error_12;
|
|
685
709
|
return __generator(this, function (_a) {
|
|
686
710
|
switch (_a.label) {
|
|
687
711
|
case 0:
|
|
@@ -689,7 +713,25 @@ var NanoDb = /** @class */ (function (_super) {
|
|
|
689
713
|
return [4 /*yield*/, this.dataPromise];
|
|
690
714
|
case 1:
|
|
691
715
|
data = _a.sent();
|
|
692
|
-
distinctValues =
|
|
716
|
+
distinctValues = [];
|
|
717
|
+
valueSet = new Set();
|
|
718
|
+
for (_i = 0, data_2 = data; _i < data_2.length; _i++) {
|
|
719
|
+
document_2 = data_2[_i];
|
|
720
|
+
fieldValue = document_2[field];
|
|
721
|
+
if (fieldValue === undefined || fieldValue === null) {
|
|
722
|
+
return [2 /*return*/, {
|
|
723
|
+
success: false,
|
|
724
|
+
message: "Error retrieving distinct values. Field with the name '".concat(field, "' not found in some documents."),
|
|
725
|
+
documentsCount: 0,
|
|
726
|
+
distinctValues: [],
|
|
727
|
+
fileSizeInBytes: 0,
|
|
728
|
+
}];
|
|
729
|
+
}
|
|
730
|
+
if (!valueSet.has(fieldValue)) {
|
|
731
|
+
valueSet.add(fieldValue);
|
|
732
|
+
distinctValues.push(fieldValue);
|
|
733
|
+
}
|
|
734
|
+
}
|
|
693
735
|
return [2 /*return*/, {
|
|
694
736
|
success: true,
|
|
695
737
|
message: 'Distinct values retrieved successfully.',
|
|
@@ -724,357 +766,262 @@ var NanoDb = /** @class */ (function (_super) {
|
|
|
724
766
|
this.indexes.get(field).get(fieldValue).push(data);
|
|
725
767
|
}
|
|
726
768
|
};
|
|
727
|
-
NanoDb.prototype.backup = function (
|
|
728
|
-
if (
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
return [3 /*break*/, 9];
|
|
747
|
-
case 2:
|
|
748
|
-
serializedData = JSON.stringify(data, null, 2);
|
|
749
|
-
return [3 /*break*/, 10];
|
|
750
|
-
case 3: return [4 /*yield*/, this.createCompressedBackup(filepath, data, 'zip')];
|
|
751
|
-
case 4:
|
|
752
|
-
zipBackupResult = _b.sent();
|
|
753
|
-
this.emit('backupCreated', zipBackupResult);
|
|
754
|
-
return [2 /*return*/, zipBackupResult];
|
|
755
|
-
case 5: return [4 /*yield*/, this.createCompressedBackup(filepath, data, 'gzip')];
|
|
756
|
-
case 6:
|
|
757
|
-
gzipBackupResult = _b.sent();
|
|
758
|
-
this.emit('backupCreated', gzipBackupResult);
|
|
759
|
-
return [2 /*return*/, gzipBackupResult];
|
|
760
|
-
case 7: return [4 /*yield*/, this.transferData(filepath)];
|
|
761
|
-
case 8:
|
|
762
|
-
transferDataResult = _b.sent();
|
|
763
|
-
this.emit('backupCreated', transferDataResult);
|
|
764
|
-
return [2 /*return*/, transferDataResult];
|
|
765
|
-
case 9: return [2 /*return*/, {
|
|
766
|
-
success: false,
|
|
767
|
-
message: 'Unsupported backup format.',
|
|
768
|
-
documentsCount: 0,
|
|
769
|
-
fileSizeInBytes: 0,
|
|
770
|
-
}];
|
|
771
|
-
case 10: return [4 /*yield*/, fs_1.promises.writeFile(filepath, serializedData, 'utf8')];
|
|
772
|
-
case 11:
|
|
773
|
-
_b.sent();
|
|
774
|
-
this.emit('backupCreated', {
|
|
775
|
-
success: true,
|
|
776
|
-
message: "Backup created successfully in ".concat(format, " format."),
|
|
777
|
-
documentsCount: data.length,
|
|
778
|
-
fileSizeInBytes: Buffer.from(serializedData).length,
|
|
779
|
-
});
|
|
780
|
-
return [2 /*return*/, {
|
|
781
|
-
success: true,
|
|
782
|
-
message: "Backup created successfully in ".concat(format, " format."),
|
|
783
|
-
documentsCount: data.length,
|
|
784
|
-
fileSizeInBytes: Buffer.from(serializedData).length,
|
|
785
|
-
}];
|
|
786
|
-
case 12:
|
|
787
|
-
error_13 = _b.sent();
|
|
788
|
-
this.emit('backupError', {
|
|
789
|
-
success: false,
|
|
790
|
-
message: 'Error creating backup.',
|
|
791
|
-
errorMessage: error_13.message,
|
|
792
|
-
documentsCount: 0,
|
|
793
|
-
fileSizeInBytes: 0,
|
|
794
|
-
});
|
|
795
|
-
return [2 /*return*/, {
|
|
796
|
-
success: false,
|
|
797
|
-
message: 'Error creating backup.',
|
|
798
|
-
errorMessage: error_13.message,
|
|
799
|
-
documentsCount: 0,
|
|
800
|
-
fileSizeInBytes: 0,
|
|
801
|
-
}];
|
|
802
|
-
case 13: return [2 /*return*/];
|
|
803
|
-
}
|
|
804
|
-
});
|
|
805
|
-
});
|
|
806
|
-
};
|
|
807
|
-
NanoDb.prototype.createCompressedBackup = function (filepath, data, compression) {
|
|
808
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
809
|
-
var compressedData, _a, error_14;
|
|
810
|
-
return __generator(this, function (_b) {
|
|
811
|
-
switch (_b.label) {
|
|
812
|
-
case 0:
|
|
813
|
-
_b.trys.push([0, 8, , 9]);
|
|
814
|
-
compressedData = void 0;
|
|
815
|
-
_a = compression;
|
|
816
|
-
switch (_a) {
|
|
817
|
-
case 'zip': return [3 /*break*/, 1];
|
|
818
|
-
case 'gzip': return [3 /*break*/, 3];
|
|
819
|
-
}
|
|
820
|
-
return [3 /*break*/, 5];
|
|
821
|
-
case 1: return [4 /*yield*/, this.zipData(data)];
|
|
822
|
-
case 2:
|
|
823
|
-
compressedData = _b.sent();
|
|
824
|
-
return [3 /*break*/, 6];
|
|
825
|
-
case 3: return [4 /*yield*/, this.gzipData(data)];
|
|
826
|
-
case 4:
|
|
827
|
-
compressedData = _b.sent();
|
|
828
|
-
return [3 /*break*/, 6];
|
|
829
|
-
case 5: return [2 /*return*/, {
|
|
830
|
-
success: false,
|
|
831
|
-
message: 'Unsupported compression format.',
|
|
832
|
-
documentsCount: 0,
|
|
833
|
-
fileSizeInBytes: 0,
|
|
834
|
-
}];
|
|
835
|
-
case 6: return [4 /*yield*/, fs_1.promises.writeFile(filepath, compressedData)];
|
|
836
|
-
case 7:
|
|
837
|
-
_b.sent();
|
|
838
|
-
return [2 /*return*/, {
|
|
839
|
-
success: true,
|
|
840
|
-
message: "Backup created successfully in ".concat(compression, " format."),
|
|
841
|
-
documentsCount: data.length,
|
|
842
|
-
fileSizeInBytes: compressedData.length,
|
|
843
|
-
}];
|
|
844
|
-
case 8:
|
|
845
|
-
error_14 = _b.sent();
|
|
846
|
-
return [2 /*return*/, {
|
|
847
|
-
success: false,
|
|
848
|
-
message: 'Error creating compressed backup.',
|
|
849
|
-
errorMessage: error_14.message,
|
|
850
|
-
documentsCount: 0,
|
|
851
|
-
fileSizeInBytes: 0,
|
|
852
|
-
}];
|
|
853
|
-
case 9: return [2 /*return*/];
|
|
854
|
-
}
|
|
769
|
+
NanoDb.prototype.backup = function (filePathToJsonData, typeOfCompression, options) {
|
|
770
|
+
if (options === void 0) { options = {}; }
|
|
771
|
+
var compressionTypes = ['zip', 'json', 'gzip', 'txt'];
|
|
772
|
+
if (!compressionTypes.includes(typeOfCompression)) {
|
|
773
|
+
throw new Error('Invalid compression type');
|
|
774
|
+
}
|
|
775
|
+
var outputPath = options.outputPath, _a = options.encrypted, encrypted = _a === void 0 ? false : _a, key = options.key;
|
|
776
|
+
if (encrypted && !key) {
|
|
777
|
+
throw new Error('Encryption key is required for encryption');
|
|
778
|
+
}
|
|
779
|
+
var jsonData = fs.readFileSync(filePathToJsonData, 'utf-8');
|
|
780
|
+
var encryptedData = jsonData;
|
|
781
|
+
if (encrypted) {
|
|
782
|
+
var algorithm = 'aes-256-cbc';
|
|
783
|
+
var iv = crypto.randomBytes(16);
|
|
784
|
+
var cipher = crypto.createCipheriv(algorithm, Buffer.from(key), iv);
|
|
785
|
+
encryptedData = JSON.stringify({
|
|
786
|
+
iv: iv.toString('hex'),
|
|
787
|
+
content: cipher.update(jsonData, 'utf8', 'hex') + cipher.final('hex'),
|
|
855
788
|
});
|
|
856
|
-
}
|
|
789
|
+
}
|
|
790
|
+
if (typeOfCompression === 'zip') {
|
|
791
|
+
this.createZipBackup(encryptedData, outputPath);
|
|
792
|
+
}
|
|
793
|
+
else if (typeOfCompression === 'gzip') {
|
|
794
|
+
this.createGzipBackup(jsonData, encryptedData, outputPath, encrypted, key);
|
|
795
|
+
}
|
|
796
|
+
else if (typeOfCompression === 'txt' || typeOfCompression === 'json') {
|
|
797
|
+
this.createTextOrJsonBackup(encryptedData, outputPath);
|
|
798
|
+
}
|
|
799
|
+
else {
|
|
800
|
+
throw new Error('Unsupported compression format');
|
|
801
|
+
}
|
|
857
802
|
};
|
|
858
|
-
NanoDb.prototype.
|
|
859
|
-
return
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
}
|
|
803
|
+
NanoDb.prototype.createZipBackup = function (data, outputPath) {
|
|
804
|
+
return new Promise(function (resolve, reject) {
|
|
805
|
+
try {
|
|
806
|
+
var archive = archiver('zip', { zlib: { level: 9 } });
|
|
807
|
+
var outputStream = outputPath ? fs.createWriteStream(outputPath) : process.stdout;
|
|
808
|
+
archive.pipe(outputStream);
|
|
809
|
+
archive.append(data, { name: 'backup.json' });
|
|
810
|
+
archive.finalize();
|
|
811
|
+
outputStream.on('close', function () {
|
|
812
|
+
resolve({
|
|
813
|
+
success: true,
|
|
814
|
+
message: "Backup created successfully: ".concat(outputPath || 'stdout'),
|
|
815
|
+
documentsCount: null
|
|
816
|
+
});
|
|
817
|
+
});
|
|
818
|
+
}
|
|
819
|
+
catch (error) {
|
|
820
|
+
console.error(error.message);
|
|
821
|
+
reject({
|
|
822
|
+
success: false,
|
|
823
|
+
message: 'Error performing backup.',
|
|
824
|
+
errorMessage: error.message,
|
|
825
|
+
});
|
|
826
|
+
}
|
|
874
827
|
});
|
|
875
828
|
};
|
|
876
|
-
NanoDb.prototype.
|
|
877
|
-
return
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
829
|
+
NanoDb.prototype.createGzipBackup = function (jsonData, encryptedData, outputPath, encrypted, key) {
|
|
830
|
+
return new Promise(function (resolve, reject) {
|
|
831
|
+
try {
|
|
832
|
+
var gzip = zlib.createGzip({ level: 9 });
|
|
833
|
+
var cipher = encrypted
|
|
834
|
+
? crypto.createCipheriv('aes-256-cbc', Buffer.from(key), crypto.randomBytes(16))
|
|
835
|
+
: null;
|
|
836
|
+
var inputStream = encrypted
|
|
837
|
+
? fs.createReadStream('./data2.json').pipe(cipher)
|
|
838
|
+
: fs.createReadStream(Buffer.from(jsonData, 'utf-8'));
|
|
839
|
+
var outputStream = outputPath ? fs.createWriteStream(outputPath) : process.stdout;
|
|
840
|
+
var pipeline = inputStream.pipe(gzip).pipe(outputStream);
|
|
841
|
+
pipeline.on('finish', function () {
|
|
842
|
+
resolve({
|
|
843
|
+
success: true,
|
|
844
|
+
message: "Backup created successfully: ".concat(outputPath || 'stdout'),
|
|
845
|
+
documentsCount: null
|
|
846
|
+
});
|
|
847
|
+
});
|
|
848
|
+
}
|
|
849
|
+
catch (error) {
|
|
850
|
+
console.error(error.message);
|
|
851
|
+
reject({
|
|
852
|
+
success: false,
|
|
853
|
+
message: 'Error performing backup.',
|
|
854
|
+
errorMessage: error.message,
|
|
855
|
+
});
|
|
856
|
+
}
|
|
892
857
|
});
|
|
893
858
|
};
|
|
894
|
-
NanoDb.prototype.
|
|
895
|
-
return
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
return [2 /*return*/, JSON.parse(decryptedData)];
|
|
906
|
-
case 2:
|
|
907
|
-
err_2 = _a.sent();
|
|
908
|
-
return [2 /*return*/, []];
|
|
909
|
-
case 3: return [2 /*return*/];
|
|
859
|
+
NanoDb.prototype.createTextOrJsonBackup = function (encryptedData, outputPath) {
|
|
860
|
+
return new Promise(function (resolve, reject) {
|
|
861
|
+
try {
|
|
862
|
+
var dataToWrite = encryptedData;
|
|
863
|
+
if (outputPath) {
|
|
864
|
+
fs.writeFileSync(outputPath, dataToWrite, 'utf-8');
|
|
865
|
+
resolve({
|
|
866
|
+
success: true,
|
|
867
|
+
message: "Backup created successfully: ".concat(outputPath || 'stdout'),
|
|
868
|
+
documentsCount: null
|
|
869
|
+
});
|
|
910
870
|
}
|
|
911
|
-
|
|
871
|
+
else {
|
|
872
|
+
resolve({
|
|
873
|
+
success: false,
|
|
874
|
+
message: "No output path specified. Backup content: ".concat(dataToWrite),
|
|
875
|
+
documentsCount: null
|
|
876
|
+
});
|
|
877
|
+
}
|
|
878
|
+
}
|
|
879
|
+
catch (error) {
|
|
880
|
+
console.error(error.message);
|
|
881
|
+
reject({
|
|
882
|
+
success: false,
|
|
883
|
+
message: 'Error performing backup.',
|
|
884
|
+
errorMessage: error.message,
|
|
885
|
+
});
|
|
886
|
+
}
|
|
912
887
|
});
|
|
913
888
|
};
|
|
914
|
-
NanoDb.prototype.
|
|
915
|
-
if (!
|
|
916
|
-
throw new Error('Encryption key is required for encryption.');
|
|
917
|
-
}
|
|
918
|
-
var cipher = crypto.createCipher('aes-256-cbc', Buffer.from(this.encryptionKey, 'utf8'));
|
|
919
|
-
var encrypted = cipher.update(data, 'utf8', 'hex');
|
|
920
|
-
encrypted += cipher.final('hex');
|
|
921
|
-
return encrypted;
|
|
922
|
-
};
|
|
923
|
-
NanoDb.prototype.decrypt = function (encryptedData) {
|
|
924
|
-
if (!this.encryptionKey) {
|
|
889
|
+
NanoDb.prototype.decrypt = function (encryptedData, decryptKey) {
|
|
890
|
+
if (!decryptKey) {
|
|
925
891
|
throw new Error('Encryption key is required for decryption.');
|
|
926
892
|
}
|
|
927
|
-
var
|
|
893
|
+
var algorithm = 'aes-256-cbc';
|
|
894
|
+
var key = Buffer.from(decryptKey, 'utf8');
|
|
895
|
+
var decipher = crypto.createDecipheriv(algorithm, key, Buffer.alloc(16));
|
|
928
896
|
var decrypted = decipher.update(encryptedData, 'hex', 'utf8');
|
|
929
897
|
decrypted += decipher.final('utf8');
|
|
930
898
|
return decrypted;
|
|
931
899
|
};
|
|
932
900
|
NanoDb.prototype.nanoSize = function () {
|
|
933
901
|
return __awaiter(this, void 0, void 0, function () {
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
return __generator(this, function (_a) {
|
|
938
|
-
switch (_a.label) {
|
|
939
|
-
case 0:
|
|
940
|
-
_a.trys.push([0, 9, , 10]);
|
|
941
|
-
return [4 /*yield*/, fs.readdir(directoryPath)];
|
|
942
|
-
case 1:
|
|
943
|
-
files = _a.sent();
|
|
944
|
-
_i = 0, files_1 = files;
|
|
945
|
-
_a.label = 2;
|
|
946
|
-
case 2:
|
|
947
|
-
if (!(_i < files_1.length)) return [3 /*break*/, 8];
|
|
948
|
-
file = files_1[_i];
|
|
949
|
-
filePath = path.join(directoryPath, file);
|
|
950
|
-
return [4 /*yield*/, fs.stat(filePath)];
|
|
951
|
-
case 3:
|
|
952
|
-
stats = _a.sent();
|
|
953
|
-
if (!stats.isDirectory()) return [3 /*break*/, 6];
|
|
954
|
-
if (!!filePath.includes('node_modules')) return [3 /*break*/, 5];
|
|
955
|
-
return [4 /*yield*/, processDirectory(filePath)];
|
|
956
|
-
case 4:
|
|
957
|
-
_a.sent();
|
|
958
|
-
_a.label = 5;
|
|
959
|
-
case 5: return [3 /*break*/, 7];
|
|
960
|
-
case 6:
|
|
961
|
-
if (path.extname(filePath).toLowerCase() === '.json') {
|
|
962
|
-
totalSize_1 += stats.size;
|
|
963
|
-
}
|
|
964
|
-
_a.label = 7;
|
|
965
|
-
case 7:
|
|
966
|
-
_i++;
|
|
967
|
-
return [3 /*break*/, 2];
|
|
968
|
-
case 8: return [3 /*break*/, 10];
|
|
969
|
-
case 9:
|
|
970
|
-
error_16 = _a.sent();
|
|
971
|
-
console.error('Error reading directory:', error_16.message);
|
|
972
|
-
return [3 /*break*/, 10];
|
|
973
|
-
case 10: return [2 /*return*/];
|
|
974
|
-
}
|
|
975
|
-
});
|
|
976
|
-
});
|
|
977
|
-
}
|
|
978
|
-
var projectRoot, totalSize_1, error_15;
|
|
979
|
-
return __generator(this, function (_a) {
|
|
980
|
-
switch (_a.label) {
|
|
902
|
+
var projectRoot, totalSize, fileSizes, files, _i, files_1, file, filePath, stats, subFiles, _a, subFiles_1, subFile, subFilePath, subFileStats, subFileSize, fileSize, error_13;
|
|
903
|
+
return __generator(this, function (_b) {
|
|
904
|
+
switch (_b.label) {
|
|
981
905
|
case 0:
|
|
982
906
|
projectRoot = process.cwd();
|
|
983
|
-
|
|
907
|
+
totalSize = 0;
|
|
908
|
+
fileSizes = {};
|
|
909
|
+
_b.label = 1;
|
|
984
910
|
case 1:
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
return [4 /*yield*/, processDirectory(projectRoot)];
|
|
911
|
+
_b.trys.push([1, 13, , 14]);
|
|
912
|
+
return [4 /*yield*/, fs_1.promises.readdir(projectRoot)];
|
|
988
913
|
case 2:
|
|
989
|
-
|
|
990
|
-
|
|
914
|
+
files = _b.sent();
|
|
915
|
+
_i = 0, files_1 = files;
|
|
916
|
+
_b.label = 3;
|
|
991
917
|
case 3:
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
918
|
+
if (!(_i < files_1.length)) return [3 /*break*/, 12];
|
|
919
|
+
file = files_1[_i];
|
|
920
|
+
filePath = path.join(projectRoot, file);
|
|
921
|
+
return [4 /*yield*/, fs_1.promises.stat(filePath)];
|
|
922
|
+
case 4:
|
|
923
|
+
stats = _b.sent();
|
|
924
|
+
if (!(stats.isDirectory() && !filePath.includes('node_modules'))) return [3 /*break*/, 10];
|
|
925
|
+
return [4 /*yield*/, fs_1.promises.readdir(filePath)];
|
|
926
|
+
case 5:
|
|
927
|
+
subFiles = _b.sent();
|
|
928
|
+
_a = 0, subFiles_1 = subFiles;
|
|
929
|
+
_b.label = 6;
|
|
930
|
+
case 6:
|
|
931
|
+
if (!(_a < subFiles_1.length)) return [3 /*break*/, 9];
|
|
932
|
+
subFile = subFiles_1[_a];
|
|
933
|
+
subFilePath = path.join(filePath, subFile);
|
|
934
|
+
return [4 /*yield*/, fs_1.promises.stat(subFilePath)];
|
|
935
|
+
case 7:
|
|
936
|
+
subFileStats = _b.sent();
|
|
937
|
+
if (subFileStats.isFile() && path.extname(subFilePath).toLowerCase() === '.json') {
|
|
938
|
+
subFileSize = subFileStats.size;
|
|
939
|
+
totalSize += subFileSize;
|
|
940
|
+
fileSizes[subFile] = subFileSize;
|
|
941
|
+
}
|
|
942
|
+
_b.label = 8;
|
|
943
|
+
case 8:
|
|
944
|
+
_a++;
|
|
945
|
+
return [3 /*break*/, 6];
|
|
946
|
+
case 9: return [3 /*break*/, 11];
|
|
947
|
+
case 10:
|
|
948
|
+
if (stats.isFile() && path.extname(filePath).toLowerCase() === '.json') {
|
|
949
|
+
fileSize = stats.size;
|
|
950
|
+
totalSize += fileSize;
|
|
951
|
+
fileSizes[file] = fileSize;
|
|
952
|
+
}
|
|
953
|
+
_b.label = 11;
|
|
954
|
+
case 11:
|
|
955
|
+
_i++;
|
|
956
|
+
return [3 /*break*/, 3];
|
|
957
|
+
case 12: return [2 /*return*/, { totalSize: totalSize, fileSizes: fileSizes }];
|
|
958
|
+
case 13:
|
|
959
|
+
error_13 = _b.sent();
|
|
960
|
+
console.error('Error calculating total size:', error_13.message);
|
|
961
|
+
return [2 /*return*/, { totalSize: 0, fileSizes: {} }];
|
|
962
|
+
case 14: return [2 /*return*/];
|
|
996
963
|
}
|
|
997
964
|
});
|
|
998
965
|
});
|
|
999
966
|
};
|
|
1000
|
-
NanoDb.prototype.replicate = function (
|
|
1001
|
-
|
|
1002
|
-
var sourceData
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
error_17 = _a.sent();
|
|
1031
|
-
this.emit('replicationError', {
|
|
1032
|
-
success: false,
|
|
1033
|
-
message: 'Error replicating data.',
|
|
1034
|
-
errorMessage: error_17.message,
|
|
1035
|
-
documentsCount: 0,
|
|
1036
|
-
fileSizeInBytes: 0,
|
|
1037
|
-
});
|
|
1038
|
-
return [2 /*return*/, {
|
|
1039
|
-
success: false,
|
|
1040
|
-
message: 'Error replicating data.',
|
|
1041
|
-
errorMessage: error_17.message,
|
|
1042
|
-
documentsCount: 0,
|
|
1043
|
-
fileSizeInBytes: 0,
|
|
1044
|
-
}];
|
|
1045
|
-
case 4: return [2 /*return*/];
|
|
1046
|
-
}
|
|
1047
|
-
});
|
|
1048
|
-
});
|
|
967
|
+
NanoDb.prototype.replicate = function (sourceFilePath, targetFilePath) {
|
|
968
|
+
try {
|
|
969
|
+
var sourceData = fs.readFileSync(sourceFilePath, 'utf8');
|
|
970
|
+
var jsonData = JSON.parse(sourceData);
|
|
971
|
+
fs.writeFileSync(targetFilePath, JSON.stringify(jsonData, null, 2), 'utf8');
|
|
972
|
+
var documentCount = jsonData.length;
|
|
973
|
+
var fileSize = Buffer.from(JSON.stringify(jsonData)).length;
|
|
974
|
+
return {
|
|
975
|
+
success: true,
|
|
976
|
+
message: 'Data replicated successfully.',
|
|
977
|
+
documentCount: documentCount,
|
|
978
|
+
fileSize: fileSize,
|
|
979
|
+
};
|
|
980
|
+
}
|
|
981
|
+
catch (error) {
|
|
982
|
+
if (error.code === 'ENOENT') {
|
|
983
|
+
console.error('Target file not found.');
|
|
984
|
+
return {
|
|
985
|
+
success: false,
|
|
986
|
+
message: 'Target file not found.',
|
|
987
|
+
};
|
|
988
|
+
}
|
|
989
|
+
else {
|
|
990
|
+
console.error(error.message);
|
|
991
|
+
return {
|
|
992
|
+
success: false,
|
|
993
|
+
message: "Error replicating data: ".concat(error.message),
|
|
994
|
+
};
|
|
995
|
+
}
|
|
996
|
+
}
|
|
1049
997
|
};
|
|
1050
998
|
NanoDb.prototype.aggregate = function (pipeline) {
|
|
1051
999
|
return __awaiter(this, void 0, void 0, function () {
|
|
1052
|
-
var
|
|
1000
|
+
var data_3, result, error_14;
|
|
1053
1001
|
return __generator(this, function (_a) {
|
|
1054
1002
|
switch (_a.label) {
|
|
1055
1003
|
case 0:
|
|
1056
1004
|
_a.trys.push([0, 2, , 3]);
|
|
1057
1005
|
return [4 /*yield*/, this.dataPromise];
|
|
1058
1006
|
case 1:
|
|
1059
|
-
|
|
1007
|
+
data_3 = _a.sent();
|
|
1060
1008
|
result = pipeline.reduce(function (acc, stage) {
|
|
1061
1009
|
if (stage.$match) {
|
|
1062
1010
|
acc = acc.filter(function (document) { return (0, utils_1.matchesFilterQuery)(document, stage.$match); });
|
|
1063
1011
|
}
|
|
1064
1012
|
else if (stage.$group) {
|
|
1065
1013
|
var groupedData_1 = new Map();
|
|
1014
|
+
var key_1 = stage.$group._id;
|
|
1066
1015
|
acc.forEach(function (document) {
|
|
1067
|
-
var
|
|
1068
|
-
var keyValue = String(document[key]);
|
|
1016
|
+
var keyValue = String(document[key_1]);
|
|
1069
1017
|
if (!groupedData_1.has(keyValue)) {
|
|
1070
1018
|
groupedData_1.set(keyValue, []);
|
|
1071
1019
|
}
|
|
1072
1020
|
groupedData_1.get(keyValue).push(document);
|
|
1073
1021
|
});
|
|
1074
|
-
acc = Array.from(groupedData_1, function (
|
|
1075
|
-
var
|
|
1076
|
-
|
|
1077
|
-
return (_b = {}, _b[key] = value, _b);
|
|
1022
|
+
acc = Array.from(groupedData_1.values(), function (value) {
|
|
1023
|
+
var _a;
|
|
1024
|
+
return (_a = {}, _a[key_1] = value, _a);
|
|
1078
1025
|
});
|
|
1079
1026
|
}
|
|
1080
1027
|
else if (stage.$project) {
|
|
@@ -1089,9 +1036,9 @@ var NanoDb = /** @class */ (function (_super) {
|
|
|
1089
1036
|
});
|
|
1090
1037
|
}
|
|
1091
1038
|
else if (stage.$sort) {
|
|
1092
|
-
var
|
|
1039
|
+
var sortBy_2 = stage.$sort.field;
|
|
1093
1040
|
var sortOrder_2 = stage.$sort.order === 'desc' ? -1 : 1;
|
|
1094
|
-
acc.sort(function (a, b) { return (a[
|
|
1041
|
+
acc.sort(function (a, b) { return (a[sortBy_2] > b[sortBy_2] ? sortOrder_2 : -sortOrder_2); });
|
|
1095
1042
|
}
|
|
1096
1043
|
else if (stage.$skip) {
|
|
1097
1044
|
var skipCount = stage.$skip;
|
|
@@ -1112,14 +1059,13 @@ var NanoDb = /** @class */ (function (_super) {
|
|
|
1112
1059
|
});
|
|
1113
1060
|
}
|
|
1114
1061
|
else if (stage.$lookup) {
|
|
1115
|
-
var lookupField = stage.$lookup.from;
|
|
1116
1062
|
var localField_1 = stage.$lookup.localField;
|
|
1117
1063
|
var foreignField_1 = stage.$lookup.foreignField;
|
|
1118
1064
|
var asField_1 = stage.$lookup.as;
|
|
1119
1065
|
acc = acc.map(function (document) {
|
|
1120
1066
|
var _a;
|
|
1121
1067
|
var lookupValue = document[localField_1];
|
|
1122
|
-
var matchingDocuments =
|
|
1068
|
+
var matchingDocuments = data_3.filter(function (lookupDoc) { return lookupDoc[foreignField_1] === lookupValue; });
|
|
1123
1069
|
return __assign(__assign({}, document), (_a = {}, _a[asField_1] = matchingDocuments, _a));
|
|
1124
1070
|
});
|
|
1125
1071
|
}
|
|
@@ -1140,7 +1086,7 @@ var NanoDb = /** @class */ (function (_super) {
|
|
|
1140
1086
|
acc = [{ count: acc.length }];
|
|
1141
1087
|
}
|
|
1142
1088
|
return acc;
|
|
1143
|
-
},
|
|
1089
|
+
}, data_3);
|
|
1144
1090
|
return [2 /*return*/, {
|
|
1145
1091
|
success: true,
|
|
1146
1092
|
message: 'Aggregation completed successfully.',
|
|
@@ -1148,11 +1094,11 @@ var NanoDb = /** @class */ (function (_super) {
|
|
|
1148
1094
|
aggregatedResults: result,
|
|
1149
1095
|
}];
|
|
1150
1096
|
case 2:
|
|
1151
|
-
|
|
1097
|
+
error_14 = _a.sent();
|
|
1152
1098
|
return [2 /*return*/, {
|
|
1153
1099
|
success: false,
|
|
1154
1100
|
message: 'Error performing aggregation.',
|
|
1155
|
-
errorMessage:
|
|
1101
|
+
errorMessage: error_14.message,
|
|
1156
1102
|
documentsCount: 0,
|
|
1157
1103
|
aggregatedResults: [],
|
|
1158
1104
|
}];
|
|
@@ -1161,9 +1107,87 @@ var NanoDb = /** @class */ (function (_super) {
|
|
|
1161
1107
|
});
|
|
1162
1108
|
});
|
|
1163
1109
|
};
|
|
1110
|
+
NanoDb.prototype.encryptData = function (encryptKey) {
|
|
1111
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
1112
|
+
var data, algorithm, iv, cipher, encryptedData, encryptedDataObject, error_15;
|
|
1113
|
+
return __generator(this, function (_a) {
|
|
1114
|
+
switch (_a.label) {
|
|
1115
|
+
case 0:
|
|
1116
|
+
_a.trys.push([0, 3, , 4]);
|
|
1117
|
+
return [4 /*yield*/, this.dataPromise];
|
|
1118
|
+
case 1:
|
|
1119
|
+
data = _a.sent();
|
|
1120
|
+
algorithm = 'aes-256-cbc';
|
|
1121
|
+
iv = crypto.randomBytes(16);
|
|
1122
|
+
cipher = crypto.createCipheriv(algorithm, Buffer.from(encryptKey), iv);
|
|
1123
|
+
encryptedData = cipher.update(JSON.stringify(data), 'utf8', 'hex');
|
|
1124
|
+
encryptedData += cipher.final('hex');
|
|
1125
|
+
encryptedDataObject = {
|
|
1126
|
+
iv: iv.toString('hex'),
|
|
1127
|
+
encryptedData: encryptedData,
|
|
1128
|
+
};
|
|
1129
|
+
this.dataPromise = Promise.resolve([encryptedDataObject]);
|
|
1130
|
+
return [4 /*yield*/, fs_1.promises.writeFile(this.filePath, JSON.stringify([encryptedDataObject], null, 2), 'utf8')];
|
|
1131
|
+
case 2:
|
|
1132
|
+
_a.sent();
|
|
1133
|
+
return [2 /*return*/, {
|
|
1134
|
+
success: true,
|
|
1135
|
+
message: 'Data encrypted and written to file successfully.',
|
|
1136
|
+
documentsCount: data.length,
|
|
1137
|
+
}];
|
|
1138
|
+
case 3:
|
|
1139
|
+
error_15 = _a.sent();
|
|
1140
|
+
return [2 /*return*/, {
|
|
1141
|
+
success: false,
|
|
1142
|
+
message: 'Error encrypting and writing data to file.',
|
|
1143
|
+
documentsCount: 0,
|
|
1144
|
+
errorMessage: error_15.message,
|
|
1145
|
+
}];
|
|
1146
|
+
case 4: return [2 /*return*/];
|
|
1147
|
+
}
|
|
1148
|
+
});
|
|
1149
|
+
});
|
|
1150
|
+
};
|
|
1151
|
+
NanoDb.prototype.decryptData = function (encryptKey) {
|
|
1152
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
1153
|
+
var encryptedDataArray, encryptedDataObject, algorithm, decipher, decryptedData, error_16;
|
|
1154
|
+
return __generator(this, function (_a) {
|
|
1155
|
+
switch (_a.label) {
|
|
1156
|
+
case 0:
|
|
1157
|
+
_a.trys.push([0, 3, , 4]);
|
|
1158
|
+
return [4 /*yield*/, fs_1.promises.readFile(this.filePath, 'utf8')];
|
|
1159
|
+
case 1:
|
|
1160
|
+
encryptedDataArray = _a.sent();
|
|
1161
|
+
encryptedDataObject = JSON.parse(encryptedDataArray)[0];
|
|
1162
|
+
algorithm = 'aes-256-cbc';
|
|
1163
|
+
decipher = crypto.createDecipheriv(algorithm, Buffer.from(encryptKey), Buffer.from(encryptedDataObject.iv, 'hex'));
|
|
1164
|
+
decryptedData = decipher.update(encryptedDataObject.encryptedData, 'hex', 'utf8');
|
|
1165
|
+
decryptedData += decipher.final('utf8');
|
|
1166
|
+
this.dataPromise = Promise.resolve(JSON.parse(decryptedData));
|
|
1167
|
+
return [4 /*yield*/, fs_1.promises.writeFile(this.filePath, JSON.stringify(JSON.parse(decryptedData), null, 2), 'utf8')];
|
|
1168
|
+
case 2:
|
|
1169
|
+
_a.sent();
|
|
1170
|
+
return [2 /*return*/, {
|
|
1171
|
+
success: true,
|
|
1172
|
+
message: 'Data decrypted and written to file successfully.',
|
|
1173
|
+
documentsCount: JSON.parse(decryptedData).length,
|
|
1174
|
+
}];
|
|
1175
|
+
case 3:
|
|
1176
|
+
error_16 = _a.sent();
|
|
1177
|
+
return [2 /*return*/, {
|
|
1178
|
+
success: false,
|
|
1179
|
+
message: 'Error decrypting data.',
|
|
1180
|
+
documentsCount: 0,
|
|
1181
|
+
errorMessage: error_16.message,
|
|
1182
|
+
}];
|
|
1183
|
+
case 4: return [2 /*return*/];
|
|
1184
|
+
}
|
|
1185
|
+
});
|
|
1186
|
+
});
|
|
1187
|
+
};
|
|
1164
1188
|
NanoDb.prototype.fullTextSearch = function (query) {
|
|
1165
1189
|
return __awaiter(this, void 0, void 0, function () {
|
|
1166
|
-
var data, foundResults,
|
|
1190
|
+
var data, foundResults, error_17;
|
|
1167
1191
|
return __generator(this, function (_a) {
|
|
1168
1192
|
switch (_a.label) {
|
|
1169
1193
|
case 0:
|
|
@@ -1187,7 +1211,7 @@ var NanoDb = /** @class */ (function (_super) {
|
|
|
1187
1211
|
foundResults: foundResults,
|
|
1188
1212
|
}];
|
|
1189
1213
|
case 2:
|
|
1190
|
-
|
|
1214
|
+
error_17 = _a.sent();
|
|
1191
1215
|
return [2 /*return*/, {
|
|
1192
1216
|
success: false,
|
|
1193
1217
|
message: 'Error performing full-text search.',
|
|
@@ -1201,7 +1225,7 @@ var NanoDb = /** @class */ (function (_super) {
|
|
|
1201
1225
|
};
|
|
1202
1226
|
NanoDb.prototype.takeSnapshot = function (snapshotPathWithFileName) {
|
|
1203
1227
|
return __awaiter(this, void 0, void 0, function () {
|
|
1204
|
-
var data, snapshotPathComponents, snapshotFileName, snapshotPath, snapshotFilePath,
|
|
1228
|
+
var data, snapshotPathComponents, snapshotFileName, snapshotPath, snapshotFilePath, error_18;
|
|
1205
1229
|
return __generator(this, function (_a) {
|
|
1206
1230
|
switch (_a.label) {
|
|
1207
1231
|
case 0:
|
|
@@ -1231,18 +1255,18 @@ var NanoDb = /** @class */ (function (_super) {
|
|
|
1231
1255
|
fileSizeInBytes: Buffer.from(JSON.stringify(data, null, 2)).length,
|
|
1232
1256
|
}];
|
|
1233
1257
|
case 3:
|
|
1234
|
-
|
|
1258
|
+
error_18 = _a.sent();
|
|
1235
1259
|
this.emit('snapshotError', {
|
|
1236
1260
|
success: false,
|
|
1237
1261
|
message: 'Error taking snapshot.',
|
|
1238
|
-
errorMessage:
|
|
1262
|
+
errorMessage: error_18.message,
|
|
1239
1263
|
documentsCount: 0,
|
|
1240
1264
|
fileSizeInBytes: 0,
|
|
1241
1265
|
});
|
|
1242
1266
|
return [2 /*return*/, {
|
|
1243
1267
|
success: false,
|
|
1244
1268
|
message: 'Error taking snapshot.',
|
|
1245
|
-
errorMessage:
|
|
1269
|
+
errorMessage: error_18.message,
|
|
1246
1270
|
documentsCount: 0,
|
|
1247
1271
|
fileSizeInBytes: 0,
|
|
1248
1272
|
}];
|
|
@@ -1253,7 +1277,7 @@ var NanoDb = /** @class */ (function (_super) {
|
|
|
1253
1277
|
};
|
|
1254
1278
|
NanoDb.prototype.restoreSnapshot = function (snapshotIndex, filePath) {
|
|
1255
1279
|
return __awaiter(this, void 0, void 0, function () {
|
|
1256
|
-
var directoryPath, fileName, snapshotFiles, snapshotRegex_1, matchingSnapshots, snapshotFilePath, snapshotData,
|
|
1280
|
+
var directoryPath, fileName, snapshotFiles, snapshotRegex_1, matchingSnapshots, snapshotFilePath, snapshotData, error_19;
|
|
1257
1281
|
return __generator(this, function (_a) {
|
|
1258
1282
|
switch (_a.label) {
|
|
1259
1283
|
case 0:
|
|
@@ -1300,11 +1324,11 @@ var NanoDb = /** @class */ (function (_super) {
|
|
|
1300
1324
|
snapshotFilePath: snapshotFilePath,
|
|
1301
1325
|
}];
|
|
1302
1326
|
case 4:
|
|
1303
|
-
|
|
1327
|
+
error_19 = _a.sent();
|
|
1304
1328
|
return [2 /*return*/, {
|
|
1305
1329
|
success: false,
|
|
1306
1330
|
message: 'Error restoring snapshot.',
|
|
1307
|
-
errorMessage:
|
|
1331
|
+
errorMessage: error_19.message,
|
|
1308
1332
|
documentsCount: 0,
|
|
1309
1333
|
}];
|
|
1310
1334
|
case 5: return [2 /*return*/];
|
|
@@ -1314,5 +1338,4 @@ var NanoDb = /** @class */ (function (_super) {
|
|
|
1314
1338
|
};
|
|
1315
1339
|
return NanoDb;
|
|
1316
1340
|
}(events_1.EventEmitter));
|
|
1317
|
-
|
|
1318
1341
|
exports.NanoDb = NanoDb;
|