@forzalabs/remora 1.0.21 → 1.1.1
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/actions/automap.js +26 -42
- package/actions/compile.js +27 -43
- package/actions/create_consumer.js +24 -40
- package/actions/create_producer.js +16 -32
- package/actions/debug.js +18 -34
- package/actions/deploy.js +30 -46
- package/actions/discover.js +13 -29
- package/actions/init.js +29 -45
- package/actions/mock.js +16 -32
- package/actions/run.js +34 -52
- package/actions/sample.js +42 -58
- package/index.js +38 -43
- package/package.json +4 -4
- package/workers/ExecutorWorker.js +18 -32
- package/Constants.js +0 -34
- package/core/Affirm.js +0 -42
- package/core/Algo.js +0 -160
- package/core/dste/DSTE.js +0 -113
- package/core/logger/DebugLogService.js +0 -48
- package/core/logger/DevelopmentLogService.js +0 -70
- package/core/logger/LocalLogService.js +0 -70
- package/core/logger/Logger.js +0 -54
- package/database/DatabaseEngine.js +0 -149
- package/database/DatabaseStructure.js +0 -27
- package/definitions/DatasetDefinitions.js +0 -2
- package/definitions/ExecutorDefinitions.js +0 -2
- package/definitions/ProcessENV.js +0 -2
- package/definitions/agents/DestinationDriver.js +0 -2
- package/definitions/agents/SourceDriver.js +0 -2
- package/definitions/cli.js +0 -2
- package/definitions/database/ApiKeys.js +0 -2
- package/definitions/database/Stored.js +0 -7
- package/definitions/database/UsageStat.js +0 -2
- package/definitions/database/User.js +0 -2
- package/definitions/json_schemas/consumer-schema.json +0 -1226
- package/definitions/json_schemas/producer-schema.json +0 -308
- package/definitions/json_schemas/project-schema.json +0 -100
- package/definitions/json_schemas/source-schema.json +0 -249
- package/definitions/requests/ConsumerRequest.js +0 -2
- package/definitions/requests/Developer.js +0 -2
- package/definitions/requests/Mapping.js +0 -2
- package/definitions/requests/ProducerRequest.js +0 -2
- package/definitions/requests/Request.js +0 -2
- package/definitions/resources/Compiled.js +0 -2
- package/definitions/resources/Consumer.js +0 -2
- package/definitions/resources/Environment.js +0 -2
- package/definitions/resources/Library.js +0 -2
- package/definitions/resources/Producer.js +0 -2
- package/definitions/resources/Project.js +0 -2
- package/definitions/resources/Schema.js +0 -2
- package/definitions/resources/Source.js +0 -2
- package/definitions/temp.js +0 -2
- package/definitions/transform/Transformations.js +0 -2
- package/drivers/DeltaShareDriver.js +0 -186
- package/drivers/DriverFactory.js +0 -72
- package/drivers/DriverHelper.js +0 -248
- package/drivers/HttpApiDriver.js +0 -208
- package/drivers/RedshiftDriver.js +0 -184
- package/drivers/files/LocalDestinationDriver.js +0 -146
- package/drivers/files/LocalSourceDriver.js +0 -405
- package/drivers/s3/S3DestinationDriver.js +0 -197
- package/drivers/s3/S3SourceDriver.js +0 -495
- package/engines/CryptoEngine.js +0 -75
- package/engines/Environment.js +0 -170
- package/engines/ProcessENVManager.js +0 -83
- package/engines/RandomEngine.js +0 -47
- package/engines/SecretManager.js +0 -23
- package/engines/UserManager.js +0 -66
- package/engines/ai/AutoMapperEngine.js +0 -37
- package/engines/ai/DeveloperEngine.js +0 -497
- package/engines/ai/LLM.js +0 -255
- package/engines/consumer/ConsumerManager.js +0 -218
- package/engines/consumer/ConsumerOnFinishManager.js +0 -202
- package/engines/dataset/Dataset.js +0 -824
- package/engines/dataset/DatasetManager.js +0 -211
- package/engines/dataset/DatasetRecord.js +0 -120
- package/engines/dataset/DatasetRecordPool.js +0 -77
- package/engines/execution/RequestExecutor.js +0 -67
- package/engines/parsing/CSVParser.js +0 -60
- package/engines/parsing/LineParser.js +0 -71
- package/engines/parsing/ParseCompression.js +0 -101
- package/engines/parsing/ParseHelper.js +0 -18
- package/engines/parsing/ParseManager.js +0 -54
- package/engines/parsing/XLSParser.js +0 -87
- package/engines/parsing/XMLParser.js +0 -115
- package/engines/producer/ProducerEngine.js +0 -127
- package/engines/producer/ProducerManager.js +0 -43
- package/engines/scheduler/CronScheduler.js +0 -222
- package/engines/scheduler/QueueManager.js +0 -314
- package/engines/schema/SchemaValidator.js +0 -67
- package/engines/transform/JoinEngine.js +0 -232
- package/engines/transform/TransformationEngine.js +0 -277
- package/engines/transform/TypeCaster.js +0 -59
- package/engines/usage/DataframeManager.js +0 -55
- package/engines/usage/UsageDataManager.js +0 -151
- package/engines/usage/UsageManager.js +0 -65
- package/engines/validation/Validator.js +0 -216
- package/executors/ConsumerExecutor.js +0 -280
- package/executors/Executor.js +0 -177
- package/executors/ExecutorOrchestrator.js +0 -331
- package/executors/ExecutorPerformance.js +0 -17
- package/executors/ExecutorProgress.js +0 -54
- package/executors/ExecutorScope.js +0 -52
- package/executors/OutputExecutor.js +0 -118
- package/executors/ProducerExecutor.js +0 -108
- package/helper/Helper.js +0 -149
- package/helper/Logger.js +0 -84
- package/helper/Runtime.js +0 -20
- package/helper/Settings.js +0 -13
- package/licencing/LicenceManager.js +0 -64
- package/settings.js +0 -12
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const fs_1 = require("fs");
|
|
7
|
-
const path_1 = __importDefault(require("path"));
|
|
8
|
-
class DevelopmentLogService {
|
|
9
|
-
constructor() {
|
|
10
|
-
this.id = 'DevelopmentLogService';
|
|
11
|
-
this._folder = 'local_logs';
|
|
12
|
-
this._file = 'logs.txt';
|
|
13
|
-
this._path = path_1.default.join(this._folder, this._file);
|
|
14
|
-
this.init = () => {
|
|
15
|
-
if (!(0, fs_1.existsSync)(this._folder))
|
|
16
|
-
(0, fs_1.mkdirSync)(this._folder);
|
|
17
|
-
return null;
|
|
18
|
-
};
|
|
19
|
-
this.log = (text) => {
|
|
20
|
-
try {
|
|
21
|
-
console.log(text);
|
|
22
|
-
this._write(text, 'LOG');
|
|
23
|
-
}
|
|
24
|
-
catch (error) {
|
|
25
|
-
console.error('ERROR on log', error);
|
|
26
|
-
}
|
|
27
|
-
finally {
|
|
28
|
-
return null;
|
|
29
|
-
}
|
|
30
|
-
};
|
|
31
|
-
this.info = (text) => {
|
|
32
|
-
try {
|
|
33
|
-
console.info(text);
|
|
34
|
-
this._write(text, 'INFO');
|
|
35
|
-
}
|
|
36
|
-
catch (error) {
|
|
37
|
-
console.error('ERROR on info', error);
|
|
38
|
-
}
|
|
39
|
-
finally {
|
|
40
|
-
return null;
|
|
41
|
-
}
|
|
42
|
-
};
|
|
43
|
-
this.error = (error) => {
|
|
44
|
-
try {
|
|
45
|
-
console.error(error);
|
|
46
|
-
this._write(error.message, 'INFO', error.name, error.stack);
|
|
47
|
-
}
|
|
48
|
-
catch (error) {
|
|
49
|
-
console.error('ERROR on error', error);
|
|
50
|
-
}
|
|
51
|
-
finally {
|
|
52
|
-
return null;
|
|
53
|
-
}
|
|
54
|
-
};
|
|
55
|
-
this._write = (text, level, errName, stackTrace) => {
|
|
56
|
-
if (!text || text.length === 0)
|
|
57
|
-
return;
|
|
58
|
-
const date = '"' + new Date().toJSON() + '"';
|
|
59
|
-
const sanitizedLevel = '"' + level + '"';
|
|
60
|
-
const sanitizedText = '"' + text.replace(new RegExp('"', 'g'), '"') + '"';
|
|
61
|
-
const sanitizedErrName = '"' + (errName !== null && errName !== void 0 ? errName : '') + '"';
|
|
62
|
-
const sanitizedStack = '"' + (stackTrace !== null && stackTrace !== void 0 ? stackTrace : '') + '"';
|
|
63
|
-
const line = [date, sanitizedLevel, sanitizedText, sanitizedErrName, sanitizedStack];
|
|
64
|
-
const sanitizedLine = line.join(',') + '\r\n';
|
|
65
|
-
(0, fs_1.appendFileSync)(this._path, sanitizedLine);
|
|
66
|
-
};
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
const DevelopmentLogger = new DevelopmentLogService();
|
|
70
|
-
exports.default = DevelopmentLogger;
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const fs_1 = require("fs");
|
|
7
|
-
const path_1 = __importDefault(require("path"));
|
|
8
|
-
class LocalLogService {
|
|
9
|
-
constructor() {
|
|
10
|
-
this.id = 'DevelopmentLogService';
|
|
11
|
-
this._folder = 'local_logs';
|
|
12
|
-
this._file = 'logs.txt';
|
|
13
|
-
this._path = path_1.default.join(this._folder, this._file);
|
|
14
|
-
this.init = () => {
|
|
15
|
-
if (!(0, fs_1.existsSync)(this._folder))
|
|
16
|
-
(0, fs_1.mkdirSync)(this._folder);
|
|
17
|
-
return null;
|
|
18
|
-
};
|
|
19
|
-
this.log = (text) => {
|
|
20
|
-
try {
|
|
21
|
-
console.log(text);
|
|
22
|
-
this._write(text, 'LOG');
|
|
23
|
-
}
|
|
24
|
-
catch (error) {
|
|
25
|
-
console.error('ERROR on log', error);
|
|
26
|
-
}
|
|
27
|
-
finally {
|
|
28
|
-
return null;
|
|
29
|
-
}
|
|
30
|
-
};
|
|
31
|
-
this.info = (text) => {
|
|
32
|
-
try {
|
|
33
|
-
console.info(text);
|
|
34
|
-
this._write(text, 'INFO');
|
|
35
|
-
}
|
|
36
|
-
catch (error) {
|
|
37
|
-
console.error('ERROR on info', error);
|
|
38
|
-
}
|
|
39
|
-
finally {
|
|
40
|
-
return null;
|
|
41
|
-
}
|
|
42
|
-
};
|
|
43
|
-
this.error = (error) => {
|
|
44
|
-
try {
|
|
45
|
-
console.error(error);
|
|
46
|
-
this._write(error.message, 'INFO', error.name, error.stack);
|
|
47
|
-
}
|
|
48
|
-
catch (error) {
|
|
49
|
-
console.error('ERROR on error', error);
|
|
50
|
-
}
|
|
51
|
-
finally {
|
|
52
|
-
return null;
|
|
53
|
-
}
|
|
54
|
-
};
|
|
55
|
-
this._write = (text, level, errName, stackTrace) => {
|
|
56
|
-
if (!text || text.length === 0)
|
|
57
|
-
return;
|
|
58
|
-
const date = '"' + new Date().toJSON() + '"';
|
|
59
|
-
const sanitizedLevel = '"' + level + '"';
|
|
60
|
-
const sanitizedText = '"' + text.replace(new RegExp('"', 'g'), '"') + '"';
|
|
61
|
-
const sanitizedErrName = '"' + (errName !== null && errName !== void 0 ? errName : '') + '"';
|
|
62
|
-
const sanitizedStack = '"' + (stackTrace !== null && stackTrace !== void 0 ? stackTrace : '') + '"';
|
|
63
|
-
const line = [date, sanitizedLevel, sanitizedText, sanitizedErrName, sanitizedStack];
|
|
64
|
-
const sanitizedLine = line.join(',') + '\r\n';
|
|
65
|
-
(0, fs_1.appendFileSync)(this._path, sanitizedLine);
|
|
66
|
-
};
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
const LocalLogger = new LocalLogService();
|
|
70
|
-
exports.default = LocalLogger;
|
package/core/logger/Logger.js
DELETED
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
-
};
|
|
14
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
const Affirm_1 = __importDefault(require("../Affirm"));
|
|
16
|
-
class LoggerService {
|
|
17
|
-
constructor() {
|
|
18
|
-
this.outputs = [];
|
|
19
|
-
this.register = (service) => __awaiter(this, void 0, void 0, function* () {
|
|
20
|
-
(0, Affirm_1.default)(this.outputs, 'Unassigned outputs in logging service');
|
|
21
|
-
(0, Affirm_1.default)(service, 'Invalid service passed to logger.register');
|
|
22
|
-
(0, Affirm_1.default)(service.id, 'Invalid id used for registering new logging output service');
|
|
23
|
-
(0, Affirm_1.default)(!this.outputs.some(x => x.id === service.id), 'Trying to register logging output service that was already registered');
|
|
24
|
-
try {
|
|
25
|
-
yield service.init();
|
|
26
|
-
this.outputs.push(service);
|
|
27
|
-
}
|
|
28
|
-
catch (error) {
|
|
29
|
-
this.error(error);
|
|
30
|
-
}
|
|
31
|
-
});
|
|
32
|
-
this.isRegistered = (id) => {
|
|
33
|
-
(0, Affirm_1.default)(this.outputs, 'Unassigned outputs in logging service');
|
|
34
|
-
(0, Affirm_1.default)(id, 'Invalid id used for checking if logging output service is registered');
|
|
35
|
-
return this.outputs.some(x => x.id === id);
|
|
36
|
-
};
|
|
37
|
-
this.log = (text) => {
|
|
38
|
-
this.outputs.forEach(x => x.log(text));
|
|
39
|
-
};
|
|
40
|
-
this.info = (text) => {
|
|
41
|
-
this.outputs.forEach(x => x.info(text));
|
|
42
|
-
};
|
|
43
|
-
this.error = (error) => {
|
|
44
|
-
if (error instanceof Error)
|
|
45
|
-
this.outputs.forEach(x => x.error(error));
|
|
46
|
-
else if (typeof error === 'string')
|
|
47
|
-
this.outputs.forEach(x => x.error(new Error(error)));
|
|
48
|
-
else
|
|
49
|
-
this.outputs.forEach(x => x.error(new Error(error)));
|
|
50
|
-
};
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
const logger = new LoggerService();
|
|
54
|
-
exports.default = logger;
|
|
@@ -1,149 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
-
};
|
|
14
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
const mongodb_1 = require("mongodb");
|
|
16
|
-
const Helper_1 = __importDefault(require("../helper/Helper"));
|
|
17
|
-
const Settings_1 = __importDefault(require("../helper/Settings"));
|
|
18
|
-
const ProcessENVManager_1 = __importDefault(require("../engines/ProcessENVManager"));
|
|
19
|
-
class DatabaseEngineClass {
|
|
20
|
-
constructor() {
|
|
21
|
-
this.MAX_TRY_CONNECTION = 3;
|
|
22
|
-
this.db = () => this._db;
|
|
23
|
-
this.connect = () => __awaiter(this, void 0, void 0, function* () {
|
|
24
|
-
// WARNING: this was changed during the deployment to ECS...
|
|
25
|
-
// I've reverted it, but maybe it needs to be changed or looked into...
|
|
26
|
-
var _a;
|
|
27
|
-
this._uri = ((_a = ProcessENVManager_1.default.getEnvVariable('MONGO_URI')) !== null && _a !== void 0 ? _a : Helper_1.default.isDev())
|
|
28
|
-
? 'mongodb://mongo:27017/remora'
|
|
29
|
-
: 'mongodb://localhost:27017/remora';
|
|
30
|
-
this._client = new mongodb_1.MongoClient(this._uri);
|
|
31
|
-
const errors = [];
|
|
32
|
-
this._client = new mongodb_1.MongoClient(this._uri);
|
|
33
|
-
for (let i = 0; i < this.MAX_TRY_CONNECTION; i++) {
|
|
34
|
-
try {
|
|
35
|
-
console.log(`Attempting to connect to mongo "${this._uri}`);
|
|
36
|
-
yield this._client.connect();
|
|
37
|
-
this._db = this._client.db(Settings_1.default.db.name);
|
|
38
|
-
this._connected = true;
|
|
39
|
-
console.log('Connected to MongoDB');
|
|
40
|
-
break;
|
|
41
|
-
}
|
|
42
|
-
catch (error) {
|
|
43
|
-
errors.push((i + 1) + ': connection to MongoDB throws this error: ' + error);
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
if (!this._connected)
|
|
47
|
-
console.error(`Despite ${this.MAX_TRY_CONNECTION} retries it was not possible to connect to mongoDb, these are the errors encountered:\n` + errors.join('\n'));
|
|
48
|
-
});
|
|
49
|
-
this.disconnect = () => __awaiter(this, void 0, void 0, function* () {
|
|
50
|
-
try {
|
|
51
|
-
yield this._client.close();
|
|
52
|
-
console.log('Disconnected from MongoDB');
|
|
53
|
-
}
|
|
54
|
-
catch (error) {
|
|
55
|
-
console.error('Error disconnecting from MongoDB:', error);
|
|
56
|
-
}
|
|
57
|
-
});
|
|
58
|
-
this.query = (collectionName, filter, options) => __awaiter(this, void 0, void 0, function* () {
|
|
59
|
-
try {
|
|
60
|
-
yield this._checkConnection();
|
|
61
|
-
const collection = this._db.collection(collectionName);
|
|
62
|
-
const result = yield collection.find(filter, options).toArray();
|
|
63
|
-
return result;
|
|
64
|
-
}
|
|
65
|
-
catch (error) {
|
|
66
|
-
console.error('Error getting documents:', error);
|
|
67
|
-
throw error;
|
|
68
|
-
}
|
|
69
|
-
});
|
|
70
|
-
this.aggregate = (collectionName, aggregation) => __awaiter(this, void 0, void 0, function* () {
|
|
71
|
-
try {
|
|
72
|
-
yield this._checkConnection();
|
|
73
|
-
const collection = this._db.collection(collectionName);
|
|
74
|
-
return yield collection.aggregate(aggregation).toArray();
|
|
75
|
-
}
|
|
76
|
-
catch (error) {
|
|
77
|
-
console.error('Error aggregate documents:', error);
|
|
78
|
-
throw error;
|
|
79
|
-
}
|
|
80
|
-
});
|
|
81
|
-
this.get = (collectionName, id) => __awaiter(this, void 0, void 0, function* () {
|
|
82
|
-
try {
|
|
83
|
-
yield this._checkConnection();
|
|
84
|
-
const collection = this._db.collection(collectionName);
|
|
85
|
-
return yield collection.findOne({ _id: id });
|
|
86
|
-
}
|
|
87
|
-
catch (error) {
|
|
88
|
-
console.error('Error finding document by ID:', error);
|
|
89
|
-
throw error;
|
|
90
|
-
}
|
|
91
|
-
});
|
|
92
|
-
this.findOne = (collectionName, query) => __awaiter(this, void 0, void 0, function* () {
|
|
93
|
-
try {
|
|
94
|
-
yield this._checkConnection();
|
|
95
|
-
const collection = this._db.collection(collectionName);
|
|
96
|
-
return yield collection.findOne(query);
|
|
97
|
-
}
|
|
98
|
-
catch (error) {
|
|
99
|
-
console.error('Error finding one document:', error);
|
|
100
|
-
throw error;
|
|
101
|
-
}
|
|
102
|
-
});
|
|
103
|
-
this.upsert = (collectionName, id, update) => __awaiter(this, void 0, void 0, function* () {
|
|
104
|
-
try {
|
|
105
|
-
yield this._checkConnection();
|
|
106
|
-
const collection = this._db.collection(collectionName);
|
|
107
|
-
const result = yield collection.findOneAndUpdate({ _id: id }, { $set: update }, { upsert: true, returnDocument: 'after' });
|
|
108
|
-
return result;
|
|
109
|
-
}
|
|
110
|
-
catch (error) {
|
|
111
|
-
console.error('Error upserting document:', error);
|
|
112
|
-
throw error;
|
|
113
|
-
}
|
|
114
|
-
});
|
|
115
|
-
this.addToList = (collectionName, id, arrayField, arrayItem) => __awaiter(this, void 0, void 0, function* () {
|
|
116
|
-
try {
|
|
117
|
-
yield this._checkConnection();
|
|
118
|
-
const collection = this._db.collection(collectionName);
|
|
119
|
-
const result = yield collection.findOneAndUpdate({ _id: id }, { $push: { [arrayField]: arrayItem } }, { returnDocument: 'after' });
|
|
120
|
-
return result;
|
|
121
|
-
}
|
|
122
|
-
catch (error) {
|
|
123
|
-
console.error('Error adding item to list:', error);
|
|
124
|
-
throw error;
|
|
125
|
-
}
|
|
126
|
-
});
|
|
127
|
-
this.doUpdate = (collectionName, id, update) => __awaiter(this, void 0, void 0, function* () {
|
|
128
|
-
try {
|
|
129
|
-
yield this._checkConnection();
|
|
130
|
-
const collection = this._db.collection(collectionName);
|
|
131
|
-
const result = yield collection.findOneAndUpdate({ _id: id }, update, { returnDocument: 'after' });
|
|
132
|
-
return result;
|
|
133
|
-
}
|
|
134
|
-
catch (error) {
|
|
135
|
-
console.error('Error adding item to list:', error);
|
|
136
|
-
throw error;
|
|
137
|
-
}
|
|
138
|
-
});
|
|
139
|
-
this._checkConnection = () => __awaiter(this, void 0, void 0, function* () {
|
|
140
|
-
if (this._connected)
|
|
141
|
-
return;
|
|
142
|
-
yield this.connect();
|
|
143
|
-
if (!this._connected)
|
|
144
|
-
throw new Error(`Can't to perform db operation: unable to connect to the database (${this._uri})`);
|
|
145
|
-
});
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
const DatabaseEngine = new DatabaseEngineClass();
|
|
149
|
-
exports.default = DatabaseEngine;
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const Settings_1 = __importDefault(require("../helper/Settings"));
|
|
7
|
-
const DATABASE_STRUCTURE = {
|
|
8
|
-
collections: [
|
|
9
|
-
{
|
|
10
|
-
name: Settings_1.default.db.collections.usage,
|
|
11
|
-
indexes: [
|
|
12
|
-
{ consumer: 1 },
|
|
13
|
-
{ startedAt: 1 },
|
|
14
|
-
{ status: 1 }
|
|
15
|
-
]
|
|
16
|
-
},
|
|
17
|
-
{
|
|
18
|
-
name: Settings_1.default.db.collections.users,
|
|
19
|
-
indexes: []
|
|
20
|
-
},
|
|
21
|
-
{
|
|
22
|
-
name: Settings_1.default.db.collections.apiKeys,
|
|
23
|
-
indexes: []
|
|
24
|
-
}
|
|
25
|
-
]
|
|
26
|
-
};
|
|
27
|
-
exports.default = DATABASE_STRUCTURE;
|
package/definitions/cli.js
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* TODO: these are the documents that are stored in the database.
|
|
4
|
-
* TODO: I need to register all the events and usage around these resources (producers and consumers).
|
|
5
|
-
* Like all the executions, who executed, for how long and others...
|
|
6
|
-
*/
|
|
7
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|