@golemio/core 1.18.0 → 1.18.1-dev.1622172793
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/helpers/DateTime.js +4 -5
- package/dist/helpers/DateTime.js.map +1 -1
- package/dist/helpers/HealthCheck.js +5 -14
- package/dist/helpers/HealthCheck.js.map +1 -1
- package/dist/helpers/configuration/SimpleConfig.js +4 -1
- package/dist/helpers/configuration/SimpleConfig.js.map +1 -1
- package/dist/helpers/data-access/amqp/AlternateExchangeCreator.js +4 -13
- package/dist/helpers/data-access/amqp/AlternateExchangeCreator.js.map +1 -1
- package/dist/helpers/data-access/amqp/AmqpConnector.js +28 -40
- package/dist/helpers/data-access/amqp/AmqpConnector.js.map +1 -1
- package/dist/helpers/data-access/feature-flags/helpers/AbstractFeatureFlagServiceWrapper.js +2 -13
- package/dist/helpers/data-access/feature-flags/helpers/AbstractFeatureFlagServiceWrapper.js.map +1 -1
- package/dist/helpers/data-access/feature-flags/providers/NoopFeatureFlagService.js +9 -24
- package/dist/helpers/data-access/feature-flags/providers/NoopFeatureFlagService.js.map +1 -1
- package/dist/helpers/data-access/postgres/DatabaseConnector.js +23 -25
- package/dist/helpers/data-access/postgres/DatabaseConnector.js.map +1 -1
- package/dist/helpers/data-access/postgres/repositories/AbstractCachedRepository.js +3 -12
- package/dist/helpers/data-access/postgres/repositories/AbstractCachedRepository.js.map +1 -1
- package/dist/helpers/data-access/pubsub/subscribers/RedisSubscriber.js +15 -30
- package/dist/helpers/data-access/pubsub/subscribers/RedisSubscriber.js.map +1 -1
- package/dist/helpers/data-access/redis/IoRedisConnector.js +8 -17
- package/dist/helpers/data-access/redis/IoRedisConnector.js.map +1 -1
- package/dist/helpers/data-access/storage/AzureBlobStorageService.js +64 -81
- package/dist/helpers/data-access/storage/AzureBlobStorageService.js.map +1 -1
- package/dist/helpers/data-access/storage/NoopStorageService.js +9 -26
- package/dist/helpers/data-access/storage/NoopStorageService.js.map +1 -1
- package/dist/helpers/data-access/table-storage/TableStorageServiceFactory.js +1 -2
- package/dist/helpers/data-access/table-storage/TableStorageServiceFactory.js.map +1 -1
- package/dist/helpers/data-access/table-storage/providers/AzureTableStorageService.js +39 -68
- package/dist/helpers/data-access/table-storage/providers/AzureTableStorageService.js.map +1 -1
- package/dist/helpers/data-access/table-storage/providers/NoopTableStorageService.js +4 -17
- package/dist/helpers/data-access/table-storage/providers/NoopTableStorageService.js.map +1 -1
- package/dist/helpers/logger/LoggerProvider.js +33 -14
- package/dist/helpers/logger/LoggerProvider.js.map +1 -1
- package/dist/helpers/logger/RequestLoggerProvider.js +1 -2
- package/dist/helpers/logger/RequestLoggerProvider.js.map +1 -1
- package/dist/helpers/routing/AbstractGeoJsonRouter.js +16 -34
- package/dist/helpers/routing/AbstractGeoJsonRouter.js.map +1 -1
- package/dist/input-gateway/config/InputGatewayConfiguration.js +1 -2
- package/dist/input-gateway/config/InputGatewayConfiguration.js.map +1 -1
- package/dist/input-gateway/connectors/AMQPConnector.js +52 -68
- package/dist/input-gateway/connectors/AMQPConnector.js.map +1 -1
- package/dist/input-gateway/controllers/BaseController.js +4 -13
- package/dist/input-gateway/controllers/BaseController.js.map +1 -1
- package/dist/integration-engine/connectors/AMQPConnector.js +28 -40
- package/dist/integration-engine/connectors/AMQPConnector.js.map +1 -1
- package/dist/integration-engine/data-access/RawDataStorage.js +7 -16
- package/dist/integration-engine/data-access/RawDataStorage.js.map +1 -1
- package/dist/integration-engine/data-access/pubsub/RedisPubSubChannel.js +3 -14
- package/dist/integration-engine/data-access/pubsub/RedisPubSubChannel.js.map +1 -1
- package/dist/integration-engine/data-access/pubsub/subscribers/RedisSubscriber.js +12 -25
- package/dist/integration-engine/data-access/pubsub/subscribers/RedisSubscriber.js.map +1 -1
- package/dist/integration-engine/datasources/DataSource.js +41 -60
- package/dist/integration-engine/datasources/DataSource.js.map +1 -1
- package/dist/integration-engine/datasources/DataSourceStream.js +12 -21
- package/dist/integration-engine/datasources/DataSourceStream.js.map +1 -1
- package/dist/integration-engine/datasources/DataSourceStreamManager.js +4 -13
- package/dist/integration-engine/datasources/DataSourceStreamManager.js.map +1 -1
- package/dist/integration-engine/datasources/DataSourceStreamed.js +37 -51
- package/dist/integration-engine/datasources/DataSourceStreamed.js.map +1 -1
- package/dist/integration-engine/datasources/RetryDataSource.js +25 -40
- package/dist/integration-engine/datasources/RetryDataSource.js.map +1 -1
- package/dist/integration-engine/datasources/datatype-strategy/CSVDataTypeStrategy.js +22 -33
- package/dist/integration-engine/datasources/datatype-strategy/CSVDataTypeStrategy.js.map +1 -1
- package/dist/integration-engine/datasources/datatype-strategy/JSONDataTypeStrategy.js +14 -25
- package/dist/integration-engine/datasources/datatype-strategy/JSONDataTypeStrategy.js.map +1 -1
- package/dist/integration-engine/datasources/datatype-strategy/XMLDataTypeStrategy.js +11 -22
- package/dist/integration-engine/datasources/datatype-strategy/XMLDataTypeStrategy.js.map +1 -1
- package/dist/integration-engine/datasources/datatype-strategy/ZipFileDataTypeStrategy.js +33 -45
- package/dist/integration-engine/datasources/datatype-strategy/ZipFileDataTypeStrategy.js.map +1 -1
- package/dist/integration-engine/datasources/protocol-strategy/FTPProtocolStrategy.js +17 -26
- package/dist/integration-engine/datasources/protocol-strategy/FTPProtocolStrategy.js.map +1 -1
- package/dist/integration-engine/datasources/protocol-strategy/GoogleCloudStorageProtocolStrategy.js +10 -19
- package/dist/integration-engine/datasources/protocol-strategy/GoogleCloudStorageProtocolStrategy.js.map +1 -1
- package/dist/integration-engine/datasources/protocol-strategy/HTTPFetchProtocolStrategy.js +42 -51
- package/dist/integration-engine/datasources/protocol-strategy/HTTPFetchProtocolStrategy.js.map +1 -1
- package/dist/integration-engine/datasources/protocol-strategy/HTTPRequestProtocolStrategy.js +49 -62
- package/dist/integration-engine/datasources/protocol-strategy/HTTPRequestProtocolStrategy.js.map +1 -1
- package/dist/integration-engine/datasources/protocol-strategy/HTTPRequestProtocolStrategyStreamed.js +67 -81
- package/dist/integration-engine/datasources/protocol-strategy/HTTPRequestProtocolStrategyStreamed.js.map +1 -1
- package/dist/integration-engine/datasources/protocol-strategy/PaginatedHTTPProtocolStrategy.js +29 -38
- package/dist/integration-engine/datasources/protocol-strategy/PaginatedHTTPProtocolStrategy.js.map +1 -1
- package/dist/integration-engine/datasources/protocol-strategy/PostgresProtocolStrategy.js +37 -42
- package/dist/integration-engine/datasources/protocol-strategy/PostgresProtocolStrategy.js.map +1 -1
- package/dist/integration-engine/datasources/protocol-strategy/PostgresProtocolStrategyStreamed.js +29 -32
- package/dist/integration-engine/datasources/protocol-strategy/PostgresProtocolStrategyStreamed.js.map +1 -1
- package/dist/integration-engine/datasources/protocol-strategy/ProtocolStrategy.js +73 -88
- package/dist/integration-engine/datasources/protocol-strategy/ProtocolStrategy.js.map +1 -1
- package/dist/integration-engine/datasources/protocol-strategy/SFTPProtocolStrategy.js +17 -26
- package/dist/integration-engine/datasources/protocol-strategy/SFTPProtocolStrategy.js.map +1 -1
- package/dist/integration-engine/datasources/protocol-strategy/helpers/FTPFileProcessor.js +37 -49
- package/dist/integration-engine/datasources/protocol-strategy/helpers/FTPFileProcessor.js.map +1 -1
- package/dist/integration-engine/helpers/FileCompressor.js +59 -76
- package/dist/integration-engine/helpers/FileCompressor.js.map +1 -1
- package/dist/integration-engine/helpers/GeocodeApi.js +20 -30
- package/dist/integration-engine/helpers/GeocodeApi.js.map +1 -1
- package/dist/integration-engine/helpers/IntegrationErrorHandler.js +3 -3
- package/dist/integration-engine/helpers/IntegrationErrorHandler.js.map +1 -1
- package/dist/integration-engine/helpers/PaginationHelper.js +1 -2
- package/dist/integration-engine/helpers/PaginationHelper.js.map +1 -1
- package/dist/integration-engine/models/PostgresModel.js +70 -75
- package/dist/integration-engine/models/PostgresModel.js.map +1 -1
- package/dist/integration-engine/models/RedisModel.js +28 -39
- package/dist/integration-engine/models/RedisModel.js.map +1 -1
- package/dist/integration-engine/queueprocessors/QueueProcessor.js +23 -28
- package/dist/integration-engine/queueprocessors/QueueProcessor.js.map +1 -1
- package/dist/integration-engine/transformations/BaseTransformation.js +8 -17
- package/dist/integration-engine/transformations/BaseTransformation.js.map +1 -1
- package/dist/integration-engine/workers/AbstractTask.js +7 -18
- package/dist/integration-engine/workers/AbstractTask.js.map +1 -1
- package/dist/integration-engine/workers/AbstractTaskJsonSchema.js +25 -38
- package/dist/integration-engine/workers/AbstractTaskJsonSchema.js.map +1 -1
- package/dist/integration-engine/workers/AbstractTaskWithoutValidation.js +2 -13
- package/dist/integration-engine/workers/AbstractTaskWithoutValidation.js.map +1 -1
- package/dist/integration-engine/workers/BaseWorker.js +4 -13
- package/dist/integration-engine/workers/BaseWorker.js.map +1 -1
- package/dist/integration-engine/workers/helpers/MessageDataParser.js +1 -2
- package/dist/integration-engine/workers/helpers/MessageDataParser.js.map +1 -1
- package/dist/integration-engine/workers/helpers/MessageDataValidator.js +18 -29
- package/dist/integration-engine/workers/helpers/MessageDataValidator.js.map +1 -1
- package/dist/integration-engine/workers/helpers/WebhookDecorators.js +1 -10
- package/dist/integration-engine/workers/helpers/WebhookDecorators.js.map +1 -1
- package/dist/integration-engine/workers/webhooks/CloudflareCachePurgeWebhook.js +13 -24
- package/dist/integration-engine/workers/webhooks/CloudflareCachePurgeWebhook.js.map +1 -1
- package/dist/monitoring/metrics/metrics-builder.js +21 -17
- package/dist/monitoring/metrics/metrics-builder.js.map +1 -1
- package/dist/monitoring/metrics/metrics-service.js +4 -14
- package/dist/monitoring/metrics/metrics-service.js.map +1 -1
- package/dist/monitoring/opentelemetry/instrumentation/configs/amqplib.js +1 -2
- package/dist/monitoring/opentelemetry/instrumentation/configs/amqplib.js.map +1 -1
- package/dist/monitoring/opentelemetry/instrumentation/configs/aws-sdk.js +1 -1
- package/dist/monitoring/opentelemetry/instrumentation/configs/aws-sdk.js.map +1 -1
- package/dist/monitoring/opentelemetry/trace-provider.js +8 -2
- package/dist/monitoring/opentelemetry/trace-provider.js.map +1 -1
- package/dist/monitoring/sentry/sentry-provider.js +1 -1
- package/dist/monitoring/sentry/sentry-provider.js.map +1 -1
- package/dist/monitoring/sentry/sentry-transactions.js +9 -19
- package/dist/monitoring/sentry/sentry-transactions.js.map +1 -1
- package/dist/output-gateway/Geo.js +3 -24
- package/dist/output-gateway/Geo.js.map +1 -1
- package/dist/output-gateway/config/OutputGatewayConfiguration.js +1 -2
- package/dist/output-gateway/config/OutputGatewayConfiguration.js.map +1 -1
- package/dist/output-gateway/database/index.js +3 -12
- package/dist/output-gateway/database/index.js.map +1 -1
- package/dist/output-gateway/ioc/Di.js +1 -10
- package/dist/output-gateway/ioc/Di.js.map +1 -1
- package/dist/output-gateway/models/SequelizeModel.js +4 -2
- package/dist/output-gateway/models/SequelizeModel.js.map +1 -1
- package/dist/output-gateway/routes/GeoJsonRouter.js +14 -32
- package/dist/output-gateway/routes/GeoJsonRouter.js.map +1 -1
- package/package.json +6 -5
- package/tsconfig.base.json +2 -2
|
@@ -72,17 +72,17 @@ class IntegrationErrorHandler extends errors_1.ErrorHandler {
|
|
|
72
72
|
static handleRecoverableError(err) {
|
|
73
73
|
sentry.setTag("status", "ack");
|
|
74
74
|
sentry.captureMessage(err.toString(), node_1.Severity.Warning);
|
|
75
|
-
return
|
|
75
|
+
return { ...err.toObject(), ack: true };
|
|
76
76
|
}
|
|
77
77
|
static handleNonRecoverableError(err) {
|
|
78
78
|
sentry.setTag("status", "nack");
|
|
79
79
|
sentry.captureException(err);
|
|
80
|
-
return
|
|
80
|
+
return { ...err.toObject(), ack: false };
|
|
81
81
|
}
|
|
82
82
|
static handleAbortError(err) {
|
|
83
83
|
sentry.setTag("status", "nack");
|
|
84
84
|
sentry.captureException(err);
|
|
85
|
-
return
|
|
85
|
+
return { ...err.toObject(), ack: false, exit: true };
|
|
86
86
|
}
|
|
87
87
|
}
|
|
88
88
|
exports.IntegrationErrorHandler = IntegrationErrorHandler;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IntegrationErrorHandler.js","sourceRoot":"","sources":["../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,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC;QAC/B,MAAM,CAAC,cAAc,CAAC,GAAG,CAAC,QAAQ,EAAE,EAAE,eAAQ,CAAC,OAAO,CAAC,CAAC;QACxD,
|
|
1
|
+
{"version":3,"file":"IntegrationErrorHandler.js","sourceRoot":"","sources":["../../../src/integration-engine/helpers/IntegrationErrorHandler.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,gCAAkC;AAClC,4CAA0G;AAC1G,qDAAuC;AACvC,uCAAwC;AAOxC;;;;GAIG;AACH,MAAa,uBAAwB,SAAQ,qBAAY;IACrD;;;;OAIG;IACI,MAAM,CAAC,MAAM,CAAC,GAAU;QAC3B,IAAI,GAAG,YAAY,qBAAY,EAAE;YAC7B,IAAI,GAAG,YAAY,yBAAgB,EAAE;gBACjC,sCAAsC;gBACtC,aAAG,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;gBACd,OAAO,IAAI,CAAC,sBAAsB,CAAC,GAAG,CAAC,CAAC;aAC3C;iBAAM;gBACH,sBAAsB;gBACtB,aAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;gBACf,OAAO,IAAI,CAAC,yBAAyB,CAAC,GAAG,CAAC,CAAC;aAC9C;SACJ;QAED,8BAA8B;QAC9B,qCAAqC;QACrC,IAAI,GAAG,YAAY,mBAAU,EAAE;YAC3B,aAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;YACf,OAAO,IAAI,CAAC,gBAAgB,CAAC,GAAG,CAAC,CAAC;SACrC;QAED,qCAAqC;QACrC,MAAM,GAAG,GAAG;YACR,OAAO,EAAE,4CAA4C;YACrD,KAAK,EAAE,GAAG,CAAC,OAAO;YAClB,KAAK,EAAE,GAAG,CAAC,KAAK;SACnB,CAAC;QACF,aAAG,CAAC,KAAK,CAAC,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC,CAAC;QAC5B,uCAAuC;QACvC,MAAM,CAAC,cAAc,CAAC,YAAY,GAAG,CAAC,QAAQ,EAAE,EAAE,EAAE,eAAQ,CAAC,KAAK,CAAC,CAAC;QACpE,OAAO,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAC3B,CAAC;IAEO,MAAM,CAAC,sBAAsB,CAAC,GAAqB;QACvD,MAAM,CAAC,MAAM,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC;QAC/B,MAAM,CAAC,cAAc,CAAC,GAAG,CAAC,QAAQ,EAAE,EAAE,eAAQ,CAAC,OAAO,CAAC,CAAC;QACxD,OAAO,EAAE,GAAG,GAAG,CAAC,QAAQ,EAAE,EAAE,GAAG,EAAE,IAAI,EAAE,CAAC;IAC5C,CAAC;IAEO,MAAM,CAAC,yBAAyB,CAAC,GAAiB;QACtD,MAAM,CAAC,MAAM,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;QAChC,MAAM,CAAC,gBAAgB,CAAC,GAAG,CAAC,CAAC;QAC7B,OAAO,EAAE,GAAG,GAAG,CAAC,QAAQ,EAAE,EAAE,GAAG,EAAE,KAAK,EAAE,CAAC;IAC7C,CAAC;IAEO,MAAM,CAAC,gBAAgB,CAAC,GAAe;QAC3C,MAAM,CAAC,MAAM,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;QAChC,MAAM,CAAC,gBAAgB,CAAC,GAAG,CAAC,CAAC;QAC7B,OAAO,EAAE,GAAG,GAAG,CAAC,QAAQ,EAAE,EAAE,GAAG,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;IACzD,CAAC;CACJ;AAvDD,0DAuDC"}
|
|
@@ -3,9 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.PaginationHelper = void 0;
|
|
4
4
|
class PaginationHelper {
|
|
5
5
|
static setPaginationParams(currentUrl) {
|
|
6
|
-
var _a;
|
|
7
6
|
const url = new URL(currentUrl);
|
|
8
|
-
const limit =
|
|
7
|
+
const limit = url.searchParams.get("resultRecordCount") ?? "1000";
|
|
9
8
|
url.searchParams.set("resultRecordCount", limit);
|
|
10
9
|
url.searchParams.set("resultOffset", "0");
|
|
11
10
|
return url.toString();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PaginationHelper.js","sourceRoot":"","sources":["../../../src/integration-engine/helpers/PaginationHelper.ts"],"names":[],"mappings":";;;AAAA,MAAa,gBAAgB;IAClB,MAAM,CAAC,mBAAmB,CAAC,UAAkB
|
|
1
|
+
{"version":3,"file":"PaginationHelper.js","sourceRoot":"","sources":["../../../src/integration-engine/helpers/PaginationHelper.ts"],"names":[],"mappings":";;;AAAA,MAAa,gBAAgB;IAClB,MAAM,CAAC,mBAAmB,CAAC,UAAkB;QAChD,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,UAAU,CAAC,CAAC;QAChC,MAAM,KAAK,GAAG,GAAG,CAAC,YAAY,CAAC,GAAG,CAAC,mBAAmB,CAAC,IAAI,MAAM,CAAC;QAElE,GAAG,CAAC,YAAY,CAAC,GAAG,CAAC,mBAAmB,EAAE,KAAK,CAAC,CAAC;QACjD,GAAG,CAAC,YAAY,CAAC,GAAG,CAAC,cAAc,EAAE,GAAG,CAAC,CAAC;QAC1C,OAAO,GAAG,CAAC,QAAQ,EAAE,CAAC;IAC1B,CAAC;IAEM,MAAM,CAAC,cAAc,CAAC,UAAkB;QAC3C,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,UAAU,CAAC,CAAC;QAChC,MAAM,KAAK,GAAG,QAAQ,CAAC,GAAG,CAAC,YAAY,CAAC,GAAG,CAAC,mBAAmB,CAAW,CAAC,CAAC;QAC5E,MAAM,MAAM,GAAG,QAAQ,CAAC,GAAG,CAAC,YAAY,CAAC,GAAG,CAAC,cAAc,CAAW,CAAC,CAAC;QAExE,GAAG,CAAC,YAAY,CAAC,GAAG,CAAC,cAAc,EAAE,CAAC,MAAM,GAAG,KAAK,CAAC,CAAC,QAAQ,EAAE,CAAC,CAAC;QAClE,OAAO,GAAG,CAAC,QAAQ,EAAE,CAAC;IAC1B,CAAC;IAEM,MAAM,CAAC,cAAc,CAAC,UAAkB;QAC3C,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,UAAU,CAAC,CAAC;QAChC,GAAG,CAAC,YAAY,CAAC,GAAG,CAAC,cAAc,EAAE,GAAG,CAAC,CAAC;QAC1C,OAAO,GAAG,CAAC,QAAQ,EAAE,CAAC;IAC1B,CAAC;CACJ;AAxBD,4CAwBC"}
|
|
@@ -1,13 +1,4 @@
|
|
|
1
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
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
3
|
exports.PostgresModel = void 0;
|
|
13
4
|
const CoreToken_1 = require("../../helpers/ioc/CoreToken");
|
|
@@ -17,18 +8,17 @@ const sequelize_1 = require("sequelize");
|
|
|
17
8
|
const AuditAttributeModel_1 = require("./postgres/AuditAttributeModel");
|
|
18
9
|
class PostgresModel {
|
|
19
10
|
constructor(name, settings, validator) {
|
|
20
|
-
|
|
21
|
-
this.save = (data, useTmpTable = false) => __awaiter(this, void 0, void 0, function* () {
|
|
11
|
+
this.save = async (data, useTmpTable = false) => {
|
|
22
12
|
// data validation
|
|
23
|
-
|
|
24
|
-
const model =
|
|
13
|
+
await this.validate(data);
|
|
14
|
+
const model = await this.getSequelizeModelSafely(useTmpTable);
|
|
25
15
|
// calling the method based on savingType (this.insertOnly() or this.insertOrUpdate())
|
|
26
16
|
return this[this.savingType](model, data);
|
|
27
|
-
}
|
|
28
|
-
this.validate = (data) =>
|
|
17
|
+
};
|
|
18
|
+
this.validate = async (data) => {
|
|
29
19
|
if (this.validator) {
|
|
30
20
|
try {
|
|
31
|
-
return
|
|
21
|
+
return await this.validator.Validate(data);
|
|
32
22
|
}
|
|
33
23
|
catch (err) {
|
|
34
24
|
throw new errors_1.ValidationError(`[${this.name}] Could not validate data`, this.name, err);
|
|
@@ -38,18 +28,18 @@ class PostgresModel {
|
|
|
38
28
|
this.log.warn(this.name + ": Model validator is not set.");
|
|
39
29
|
return true;
|
|
40
30
|
}
|
|
41
|
-
}
|
|
42
|
-
this.query = (query) =>
|
|
43
|
-
return
|
|
44
|
-
}
|
|
45
|
-
this.saveBySqlFunction = (data, primaryKeys, useTmpTable = false, transaction = null, connection = null, batchId = null) =>
|
|
46
|
-
|
|
31
|
+
};
|
|
32
|
+
this.query = async (query) => {
|
|
33
|
+
return await this.postgresConnector.getConnection().query(query);
|
|
34
|
+
};
|
|
35
|
+
this.saveBySqlFunction = async (data, primaryKeys, useTmpTable = false, transaction = null, connection = null, batchId = null) => {
|
|
36
|
+
await this.validate(data);
|
|
47
37
|
try {
|
|
48
38
|
connection = connection || this.postgresConnector.getConnection();
|
|
49
39
|
// json stringify and escape quotes
|
|
50
40
|
const stringifiedData = JSON.stringify(data).replace(/'/g, "\\'").replace(/\"/g, '\\"');
|
|
51
41
|
// TODO doplnit batch_id a author
|
|
52
|
-
|
|
42
|
+
await this.postgresConnector.getConnection().query("SELECT meta.import_from_json(" +
|
|
53
43
|
`${batchId || "-1"}, ` + // p_batch_id bigint
|
|
54
44
|
"E'" +
|
|
55
45
|
stringifiedData +
|
|
@@ -73,7 +63,7 @@ class PostgresModel {
|
|
|
73
63
|
catch (err) {
|
|
74
64
|
throw new errors_1.GeneralError("Error while saving to database.", this.name, err);
|
|
75
65
|
}
|
|
76
|
-
}
|
|
66
|
+
};
|
|
77
67
|
/**
|
|
78
68
|
* Save data in bulk
|
|
79
69
|
*
|
|
@@ -83,16 +73,15 @@ class PostgresModel {
|
|
|
83
73
|
* @param useTmpTable - if true, uses temporary table
|
|
84
74
|
* @param transaction - transaction to use or null to run without transaction
|
|
85
75
|
*/
|
|
86
|
-
this.bulkSave = (records, updateAttributes, isReturning = false, useTmpTable = false, transaction = null) =>
|
|
87
|
-
var _b;
|
|
76
|
+
this.bulkSave = async (records, updateAttributes, isReturning = false, useTmpTable = false, transaction = null) => {
|
|
88
77
|
if (records.length === 0) {
|
|
89
78
|
return [];
|
|
90
79
|
}
|
|
91
|
-
|
|
92
|
-
const model =
|
|
93
|
-
const attributesToUpdate = this.savingType === "insertOrUpdate" ? updateAttributes
|
|
80
|
+
await this.validate(records);
|
|
81
|
+
const model = await this.getSequelizeModelSafely(useTmpTable);
|
|
82
|
+
const attributesToUpdate = this.savingType === "insertOrUpdate" ? updateAttributes ?? Object.keys(records[0]).concat("updated_at") : undefined;
|
|
94
83
|
try {
|
|
95
|
-
return
|
|
84
|
+
return await model.bulkCreate(records, {
|
|
96
85
|
updateOnDuplicate: attributesToUpdate,
|
|
97
86
|
ignoreDuplicates: this.savingType === "insertOnly",
|
|
98
87
|
returning: isReturning,
|
|
@@ -100,112 +89,112 @@ class PostgresModel {
|
|
|
100
89
|
});
|
|
101
90
|
}
|
|
102
91
|
catch (err) {
|
|
103
|
-
if (err instanceof sequelize_1.ValidationError &&
|
|
92
|
+
if (err instanceof sequelize_1.ValidationError && err.errors?.length > 0) {
|
|
104
93
|
throw new errors_1.ValidationError(`[${this.name}] bulkSave: got Sequelize internal validation error: ${this.formatValidationErrors(err)}`, this.name, err);
|
|
105
94
|
}
|
|
106
95
|
throw new errors_1.GeneralError(`[${this.name}] bulkSave: could not save data: ${err.message}`, this.name, err);
|
|
107
96
|
}
|
|
108
|
-
}
|
|
109
|
-
this.truncate = (useTmpTable = false) =>
|
|
110
|
-
const model =
|
|
97
|
+
};
|
|
98
|
+
this.truncate = async (useTmpTable = false) => {
|
|
99
|
+
const model = await this.getSequelizeModelSafely(useTmpTable);
|
|
111
100
|
const connection = this.postgresConnector.getConnection();
|
|
112
|
-
const t =
|
|
101
|
+
const t = await connection.transaction();
|
|
113
102
|
try {
|
|
114
|
-
|
|
115
|
-
|
|
103
|
+
await connection.query("SET lock_timeout TO '1min'", { type: sequelize_1.QueryTypes.RAW, transaction: t });
|
|
104
|
+
await model.destroy({
|
|
116
105
|
cascade: false,
|
|
117
106
|
transaction: t,
|
|
118
107
|
truncate: true,
|
|
119
108
|
where: {},
|
|
120
109
|
});
|
|
121
|
-
return
|
|
110
|
+
return await t.commit();
|
|
122
111
|
}
|
|
123
112
|
catch (err) {
|
|
124
|
-
|
|
113
|
+
await t.rollback();
|
|
125
114
|
throw new errors_1.GeneralError("Error while truncating data.", this.name, err);
|
|
126
115
|
}
|
|
127
|
-
}
|
|
128
|
-
this.find = (opts, useTmpTable = false) =>
|
|
129
|
-
const model =
|
|
116
|
+
};
|
|
117
|
+
this.find = async (opts, useTmpTable = false) => {
|
|
118
|
+
const model = await this.getSequelizeModelSafely(useTmpTable);
|
|
130
119
|
try {
|
|
131
|
-
return
|
|
120
|
+
return await model.findAll(opts);
|
|
132
121
|
}
|
|
133
122
|
catch (err) {
|
|
134
123
|
throw new errors_1.GeneralError("Error while getting from database.", this.name, err);
|
|
135
124
|
}
|
|
136
|
-
}
|
|
137
|
-
this.findOne = (opts, useTmpTable = false) =>
|
|
138
|
-
const model =
|
|
125
|
+
};
|
|
126
|
+
this.findOne = async (opts, useTmpTable = false) => {
|
|
127
|
+
const model = await this.getSequelizeModelSafely(useTmpTable);
|
|
139
128
|
try {
|
|
140
|
-
return
|
|
129
|
+
return await model.findOne(opts);
|
|
141
130
|
}
|
|
142
131
|
catch (err) {
|
|
143
132
|
throw new errors_1.GeneralError("Error while getting from database.", this.name, err);
|
|
144
133
|
}
|
|
145
|
-
}
|
|
146
|
-
this.findAndCountAll = (opts, useTmpTable = false) =>
|
|
147
|
-
const model =
|
|
134
|
+
};
|
|
135
|
+
this.findAndCountAll = async (opts, useTmpTable = false) => {
|
|
136
|
+
const model = await this.getSequelizeModelSafely(useTmpTable);
|
|
148
137
|
try {
|
|
149
|
-
return
|
|
138
|
+
return await model.findAndCountAll(opts);
|
|
150
139
|
}
|
|
151
140
|
catch (err) {
|
|
152
141
|
throw new errors_1.GeneralError("Error while getting from database.", this.name, err);
|
|
153
142
|
}
|
|
154
|
-
}
|
|
155
|
-
this.update = (data, opts, useTmpTable = false) =>
|
|
156
|
-
const model =
|
|
143
|
+
};
|
|
144
|
+
this.update = async (data, opts, useTmpTable = false) => {
|
|
145
|
+
const model = await this.getSequelizeModelSafely(useTmpTable);
|
|
157
146
|
return model.update(data, opts);
|
|
158
|
-
}
|
|
147
|
+
};
|
|
159
148
|
this.sync = (options) => {
|
|
160
149
|
return this.sequelizeModel.sync(options);
|
|
161
150
|
};
|
|
162
|
-
this.insertOnly = (model, data) =>
|
|
151
|
+
this.insertOnly = async (model, data) => {
|
|
163
152
|
try {
|
|
164
153
|
if (data instanceof Array) {
|
|
165
|
-
return
|
|
154
|
+
return await model.bulkCreate(data);
|
|
166
155
|
}
|
|
167
156
|
else {
|
|
168
|
-
return
|
|
157
|
+
return await model.create(data);
|
|
169
158
|
}
|
|
170
159
|
}
|
|
171
160
|
catch (err) {
|
|
172
161
|
this.log.error(JSON.stringify({ message: err.message, errors: err.errors, fields: err.fields }));
|
|
173
162
|
throw new errors_1.GeneralError("Error while saving to database.", this.name, err);
|
|
174
163
|
}
|
|
175
|
-
}
|
|
176
|
-
this.insertOrUpdate = (model, data) =>
|
|
164
|
+
};
|
|
165
|
+
this.insertOrUpdate = async (model, data) => {
|
|
177
166
|
const connection = this.postgresConnector.getConnection();
|
|
178
|
-
const t =
|
|
167
|
+
const t = await connection.transaction();
|
|
179
168
|
try {
|
|
180
169
|
if (data instanceof Array) {
|
|
181
|
-
const promises = data.map((d) =>
|
|
182
|
-
|
|
183
|
-
})
|
|
184
|
-
|
|
170
|
+
const promises = data.map(async (d) => {
|
|
171
|
+
await model.upsert(d, { transaction: t });
|
|
172
|
+
});
|
|
173
|
+
await Promise.all(promises);
|
|
185
174
|
}
|
|
186
175
|
else {
|
|
187
|
-
|
|
176
|
+
await model.upsert(data, { transaction: t });
|
|
188
177
|
}
|
|
189
|
-
return
|
|
178
|
+
return await t.commit();
|
|
190
179
|
}
|
|
191
180
|
catch (err) {
|
|
192
181
|
this.log.error(JSON.stringify({ message: err.message, errors: err.errors, fields: err.fields }));
|
|
193
|
-
|
|
182
|
+
await t.rollback();
|
|
194
183
|
throw new errors_1.GeneralError("Error while saving to database.", this.name, err);
|
|
195
184
|
}
|
|
196
|
-
}
|
|
197
|
-
this.getSequelizeModelSafely = (useTmpTable) =>
|
|
185
|
+
};
|
|
186
|
+
this.getSequelizeModelSafely = async (useTmpTable) => {
|
|
198
187
|
let model = this.sequelizeModel;
|
|
199
188
|
if (useTmpTable && this.tmpSequelizeModel) {
|
|
200
189
|
model = this.tmpSequelizeModel;
|
|
201
190
|
/// synchronizing only tmp model
|
|
202
|
-
|
|
191
|
+
await model.sync();
|
|
203
192
|
}
|
|
204
193
|
else if (useTmpTable && !this.tmpSequelizeModel) {
|
|
205
194
|
throw new errors_1.GeneralError("Temporary model is not defined.", this.name);
|
|
206
195
|
}
|
|
207
196
|
return model;
|
|
208
|
-
}
|
|
197
|
+
};
|
|
209
198
|
this.formatValidationErrors = ({ errors }) => {
|
|
210
199
|
return errors.map((e) => `${e.message} (${e.value})`).join(", ");
|
|
211
200
|
};
|
|
@@ -216,11 +205,17 @@ class PostgresModel {
|
|
|
216
205
|
this.log = ioc_1.IntegrationEngineContainer.resolve(ioc_1.ContainerToken.Logger);
|
|
217
206
|
this.sequelizeModel = this.postgresConnector
|
|
218
207
|
.getConnection()
|
|
219
|
-
.define(settings.pgTableName, settings.outputSequelizeAttributes,
|
|
208
|
+
.define(settings.pgTableName, settings.outputSequelizeAttributes, {
|
|
209
|
+
...settings.sequelizeAdditionalSettings,
|
|
210
|
+
schema: this.schema,
|
|
211
|
+
});
|
|
220
212
|
if (settings.hasTmpTable) {
|
|
221
213
|
this.tmpSequelizeModel = this.postgresConnector
|
|
222
214
|
.getConnection()
|
|
223
|
-
.define(settings.pgTableName, Object.assign({}, settings.outputSequelizeAttributes, settings.addAuditAttributes ? AuditAttributeModel_1.AuditAttributes : {}),
|
|
215
|
+
.define(settings.pgTableName, Object.assign({}, settings.outputSequelizeAttributes, settings.addAuditAttributes ? AuditAttributeModel_1.AuditAttributes : {}), {
|
|
216
|
+
...settings.sequelizeAdditionalSettings,
|
|
217
|
+
schema: "tmp",
|
|
218
|
+
});
|
|
224
219
|
}
|
|
225
220
|
else {
|
|
226
221
|
this.tmpSequelizeModel = null;
|
|
@@ -234,7 +229,7 @@ class PostgresModel {
|
|
|
234
229
|
});
|
|
235
230
|
}
|
|
236
231
|
this.validator = validator;
|
|
237
|
-
if (
|
|
232
|
+
if (this.validator?.setLogger) {
|
|
238
233
|
this.validator.setLogger(this.log);
|
|
239
234
|
}
|
|
240
235
|
this.savingType = settings.savingType;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PostgresModel.js","sourceRoot":"","sources":["../../../src/integration-engine/models/PostgresModel.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"PostgresModel.js","sourceRoot":"","sources":["../../../src/integration-engine/models/PostgresModel.ts"],"names":[],"mappings":";;;AAEA,2DAAmD;AACnD,gCAAqE;AAErE,4CAAgE;AAEhE,yCAQmB;AACnB,wEAAiE;AAEjE,MAAa,aAAa;IAkBtB,YAAY,IAAY,EAAE,QAA4B,EAAE,SAAqB;QA+CtE,SAAI,GAAG,KAAK,EAAE,IAAS,EAAE,cAAuB,KAAK,EAAgB,EAAE;YAC1E,kBAAkB;YAClB,MAAM,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;YAC1B,MAAM,KAAK,GAAG,MA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BAAkB,CAAC,CAAC,CAAC,qCAAe,CAAC,CAAC,CAAC,EAAE,CAAC,EACzG;gBACI,GAAG,QAAQ,CAAC,2BAA2B;gBACvC,MAAM,EAAE,KAAK;aAChB,CACJ,CAAC;SACT;aAAM;YACH,IAAI,CAAC,iBAAiB,GAAG,IAAI,CAAC;SACjC;QAED,IAAI,QAAQ,CAAC,kBAAkB,EAAE;YAC7B,QAAQ,CAAC,kBAAkB,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE;gBACzC,IAAI,CAAC,cAAc,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC;gBAC1C,IAAI,IAAI,CAAC,iBAAiB,EAAE;oBACxB,IAAI,CAAC,iBAAiB,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC;iBAChD;YACL,CAAC,CAAC,CAAC;SACN;QAED,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAE3B,IAAI,IAAI,CAAC,SAAS,EAAE,SAAS,EAAE;YAC3B,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;SACtC;QAED,IAAI,CAAC,UAAU,GAAG,QAAQ,CAAC,UAAU,CAAC;IAC1C,CAAC;CAgOJ;AA/RD,sCA+RC"}
|
|
@@ -1,13 +1,4 @@
|
|
|
1
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
2
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
4
|
};
|
|
@@ -21,7 +12,6 @@ const redis_rstream_1 = __importDefault(require("redis-rstream"));
|
|
|
21
12
|
const redis_wstream_1 = __importDefault(require("redis-wstream"));
|
|
22
13
|
class RedisModel {
|
|
23
14
|
constructor(name, settings, validator = null) {
|
|
24
|
-
var _a;
|
|
25
15
|
/**
|
|
26
16
|
*
|
|
27
17
|
* @param key
|
|
@@ -29,8 +19,8 @@ class RedisModel {
|
|
|
29
19
|
* @param ttlSeconds Key timeout, in seconds
|
|
30
20
|
* @param expireTimestamp Unix time at which the key will expire, in milliseconds
|
|
31
21
|
*/
|
|
32
|
-
this.set = (key, data, ttlSeconds, expireTimestamp) =>
|
|
33
|
-
|
|
22
|
+
this.set = async (key, data, ttlSeconds, expireTimestamp) => {
|
|
23
|
+
await this.validate(data);
|
|
34
24
|
if (data instanceof Array) {
|
|
35
25
|
// start the redis transaction
|
|
36
26
|
const multi = this.connection.multi();
|
|
@@ -65,9 +55,9 @@ class RedisModel {
|
|
|
65
55
|
return this.connection.set(redisKey, encodedData);
|
|
66
56
|
}
|
|
67
57
|
}
|
|
68
|
-
}
|
|
69
|
-
this.hset = (key, data) =>
|
|
70
|
-
|
|
58
|
+
};
|
|
59
|
+
this.hset = async (key, data) => {
|
|
60
|
+
await this.validate(data);
|
|
71
61
|
if (data instanceof Array) {
|
|
72
62
|
// start the redis transaction
|
|
73
63
|
const multi = this.connection.multi();
|
|
@@ -84,26 +74,26 @@ class RedisModel {
|
|
|
84
74
|
// encoding and saving the data as redis hash
|
|
85
75
|
return this.connection.hset(this.prefix, k, this.encodeDataBeforeSave(data));
|
|
86
76
|
}
|
|
87
|
-
}
|
|
88
|
-
this.get = (key) =>
|
|
77
|
+
};
|
|
78
|
+
this.get = async (key) => {
|
|
89
79
|
// getting and decoding the data from redis hash
|
|
90
|
-
return this.decodeDataAfterGet(
|
|
91
|
-
}
|
|
92
|
-
this.hget = (key) =>
|
|
80
|
+
return this.decodeDataAfterGet(await this.connection.get(`${this.prefix}:${key}`));
|
|
81
|
+
};
|
|
82
|
+
this.hget = async (key) => {
|
|
93
83
|
// getting and decoding the data from redis hash
|
|
94
|
-
return this.decodeDataAfterGet(
|
|
95
|
-
}
|
|
96
|
-
this.mget = (keys) =>
|
|
84
|
+
return this.decodeDataAfterGet(await this.connection.hget(this.prefix, key));
|
|
85
|
+
};
|
|
86
|
+
this.mget = async (keys) => {
|
|
97
87
|
if (keys.length === 0) {
|
|
98
88
|
return [];
|
|
99
89
|
}
|
|
100
|
-
const values =
|
|
90
|
+
const values = await this.connection.mget(...keys.map((key) => `${this.prefix}:${key}`));
|
|
101
91
|
return values.map((value) => this.decodeDataAfterGet(value));
|
|
102
|
-
}
|
|
92
|
+
};
|
|
103
93
|
/**
|
|
104
94
|
* Stream data into a key from file read stream via SET/APPEND
|
|
105
95
|
*/
|
|
106
|
-
this.pipeStream = (key, readStream) =>
|
|
96
|
+
this.pipeStream = async (key, readStream) => {
|
|
107
97
|
const redisWriteStream = new redis_wstream_1.default(this.connection, `${this.prefix}:${key}`);
|
|
108
98
|
return new Promise((resolve, reject) => {
|
|
109
99
|
redisWriteStream.on("finish", () => {
|
|
@@ -114,19 +104,19 @@ class RedisModel {
|
|
|
114
104
|
});
|
|
115
105
|
readStream.pipe(redisWriteStream);
|
|
116
106
|
});
|
|
117
|
-
}
|
|
107
|
+
};
|
|
118
108
|
/**
|
|
119
109
|
* Get a readable stream of data from a key via GETRANGE
|
|
120
110
|
*/
|
|
121
111
|
this.getReadableStream = (key) => {
|
|
122
112
|
return new redis_rstream_1.default(this.connection, `${this.prefix}:${key}`);
|
|
123
113
|
};
|
|
124
|
-
this.delete = (key) =>
|
|
114
|
+
this.delete = async (key) => {
|
|
125
115
|
if (key) {
|
|
126
116
|
return this.connection.del(`${this.prefix}:${key}`);
|
|
127
117
|
}
|
|
128
118
|
return this.connection.del(`${this.prefix}`);
|
|
129
|
-
}
|
|
119
|
+
};
|
|
130
120
|
this.truncate = (namespace = true) => {
|
|
131
121
|
const prefix = `${this.prefix}${namespace ? ":" : ""}*`;
|
|
132
122
|
const stream = this.connection.scanStream({ match: prefix, count: 500 });
|
|
@@ -141,29 +131,28 @@ class RedisModel {
|
|
|
141
131
|
helpers_1.log.error(err);
|
|
142
132
|
return reject(err);
|
|
143
133
|
});
|
|
144
|
-
stream.on("end", () =>
|
|
145
|
-
var _a, _b;
|
|
134
|
+
stream.on("end", async () => {
|
|
146
135
|
try {
|
|
147
|
-
const result =
|
|
148
|
-
const deleteCount =
|
|
149
|
-
helpers_1.log.info(`Truncate complete for ${prefix}, deleted ${deleteCount} in (${
|
|
136
|
+
const result = await pipeline.exec();
|
|
137
|
+
const deleteCount = result?.reduce((acc, el) => acc + el[1], 0) ?? 0;
|
|
138
|
+
helpers_1.log.info(`Truncate complete for ${prefix}, deleted ${deleteCount} in (${result?.length ?? 0}) batches`);
|
|
150
139
|
resolve(deleteCount);
|
|
151
140
|
}
|
|
152
141
|
catch (err) {
|
|
153
142
|
helpers_1.log.error(err);
|
|
154
143
|
return reject(err);
|
|
155
144
|
}
|
|
156
|
-
})
|
|
145
|
+
});
|
|
157
146
|
});
|
|
158
147
|
};
|
|
159
148
|
this.flush = () => {
|
|
160
149
|
return this.connection.flushdb();
|
|
161
150
|
};
|
|
162
|
-
this.validate = (data) =>
|
|
151
|
+
this.validate = async (data) => {
|
|
163
152
|
// data validation
|
|
164
153
|
if (this.validator) {
|
|
165
154
|
try {
|
|
166
|
-
|
|
155
|
+
await this.validator.Validate(data);
|
|
167
156
|
}
|
|
168
157
|
catch (err) {
|
|
169
158
|
throw new errors_1.GeneralError("Error while validating data.", this.name, err);
|
|
@@ -172,7 +161,7 @@ class RedisModel {
|
|
|
172
161
|
else if (!this.validator && this.isKeyConstructedFromData) {
|
|
173
162
|
helpers_1.log.warn(this.name + ": Model validator is not set.");
|
|
174
163
|
}
|
|
175
|
-
}
|
|
164
|
+
};
|
|
176
165
|
this.buildKey = (key, data) => {
|
|
177
166
|
// checking if the value is type of object
|
|
178
167
|
if (this.isKeyConstructedFromData && typeof data !== "object") {
|
|
@@ -187,7 +176,7 @@ class RedisModel {
|
|
|
187
176
|
this.validator = validator;
|
|
188
177
|
this.encodeDataBeforeSave = settings.encodeDataBeforeSave ? settings.encodeDataBeforeSave : (raw) => raw;
|
|
189
178
|
this.decodeDataAfterGet = settings.decodeDataAfterGet ? settings.decodeDataAfterGet : (raw) => raw;
|
|
190
|
-
if (
|
|
179
|
+
if (this.validator?.setLogger) {
|
|
191
180
|
this.validator.setLogger(helpers_1.log);
|
|
192
181
|
}
|
|
193
182
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RedisModel.js","sourceRoot":"","sources":["../../../src/integration-engine/models/RedisModel.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"RedisModel.js","sourceRoot":"","sources":["../../../src/integration-engine/models/RedisModel.ts"],"names":[],"mappings":";;;;;;AACA,+CAAgD;AAChD,wCAAkC;AAClC,gCAAqE;AAErE,4CAA+C;AAI/C,kEAAyC;AACzC,kEAAyC;AAGzC,MAAa,UAAU;IAgBnB,YAAY,IAAY,EAAE,QAAwB,EAAE,YAA+B,IAAI;QAevF;;;;;;WAMG;QACI,QAAG,GAAG,KAAK,EAAE,GAAW,EAAE,IAAS,EAAE,UAAmB,EAAE,eAAwB,EAAgB,EAAE;YACvG,MAAM,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;YAE1B,IAAI,IAAI,YAAY,KAAK,EAAE;gBACvB,8BAA8B;gBAC9B,MAAM,KAAK,GAAG,IAAI,CAAC,UAAU,CAAC,KAAK,EAAE,CAAC;gBAEtC,KAAK,MAAM,QAAQ,IAAI,IAAI,EAAE;oBACzB,MAAM,QAAQ,GAAG,GAAG,IAAI,CAAC,MAAM,IAAI,IAAI,CAAC,QAAQ,CAAC,GAAG,EA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