@golemio/core 3.0.7 → 3.1.0-dev.2514160696
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/.dependency-cruiser.base.js +289 -0
- package/bin/format-dependency-cruiser-report.js +94 -0
- package/dist/helpers/data-access/postgres/IDatabaseConnector.d.ts +1 -1
- package/dist/helpers/routing/AbstractGeoJsonRouter.js.map +1 -1
- package/dist/input-gateway/helpers/ResponseTimeMiddleware.js +4 -3
- package/dist/input-gateway/helpers/ResponseTimeMiddleware.js.map +1 -1
- package/dist/integration-engine/connectors/interfaces/IPostgresConnector.d.ts +1 -1
- package/dist/integration-engine/data-access/RawDataStorage.d.ts +2 -2
- package/dist/integration-engine/data-access/RawDataStorage.js +2 -2
- package/dist/integration-engine/data-access/RawDataStorage.js.map +1 -1
- package/dist/integration-engine/datasources/BatchWritable.d.ts +16 -0
- package/dist/integration-engine/datasources/BatchWritable.js +42 -0
- package/dist/integration-engine/datasources/BatchWritable.js.map +1 -0
- package/dist/integration-engine/datasources/DataSourceStreamedPipeline.d.ts +25 -0
- package/dist/integration-engine/datasources/DataSourceStreamedPipeline.js +72 -0
- package/dist/integration-engine/datasources/DataSourceStreamedPipeline.js.map +1 -0
- package/dist/integration-engine/datasources/datatype-strategy/JSONStreamTransformer.d.ts +5 -0
- package/dist/integration-engine/datasources/datatype-strategy/JSONStreamTransformer.js +12 -0
- package/dist/integration-engine/datasources/datatype-strategy/JSONStreamTransformer.js.map +1 -0
- package/dist/integration-engine/datasources/index.d.ts +5 -0
- package/dist/integration-engine/datasources/index.js +5 -0
- package/dist/integration-engine/datasources/index.js.map +1 -1
- package/dist/integration-engine/datasources/protocol-strategy/HTTPRequestProtocolStrategyStreamed.d.ts +5 -1
- package/dist/integration-engine/datasources/protocol-strategy/HTTPRequestProtocolStrategyStreamed.js +30 -1
- package/dist/integration-engine/datasources/protocol-strategy/HTTPRequestProtocolStrategyStreamed.js.map +1 -1
- package/dist/integration-engine/datasources/protocol-strategy/IStreamingProtocolStrategy.d.ts +5 -0
- package/dist/{output-gateway/routes/interfaces/IHistoryFilterParameters.js → integration-engine/datasources/protocol-strategy/IStreamingProtocolStrategy.js} +1 -1
- package/dist/integration-engine/datasources/protocol-strategy/IStreamingProtocolStrategy.js.map +1 -0
- package/dist/integration-engine/datasources/protocol-strategy/ProtocolStrategy.d.ts +3 -0
- package/dist/integration-engine/datasources/protocol-strategy/ProtocolStrategy.js +42 -3
- package/dist/integration-engine/datasources/protocol-strategy/ProtocolStrategy.js.map +1 -1
- package/dist/integration-engine/helpers/IntegrationErrorHandler.js +5 -5
- package/dist/integration-engine/helpers/IntegrationErrorHandler.js.map +1 -1
- package/dist/integration-engine/models/PostgresModel.d.ts +1 -1
- package/dist/integration-engine/models/RedisModel.d.ts +1 -1
- package/dist/integration-engine/models/RedisModel.js +6 -6
- package/dist/integration-engine/models/RedisModel.js.map +1 -1
- package/dist/integration-engine/queueprocessors/QueueProcessor.d.ts +1 -1
- package/dist/integration-engine/queueprocessors/abstract.d.ts +1 -1
- package/dist/integration-engine/transformations/BaseTransformation.d.ts +1 -1
- package/dist/integration-engine/workers/AbstractWorker.d.ts +1 -1
- package/dist/monitoring/metrics/metrics-middleware.d.ts +1 -1
- package/dist/monitoring/metrics/metrics-service.d.ts +1 -1
- package/dist/output-gateway/models/SequelizeModel.d.ts +1 -1
- package/dist/output-gateway/models/SequelizeModel.js +2 -2
- package/dist/output-gateway/models/SequelizeModel.js.map +1 -1
- package/dist/output-gateway/models/interfaces/IGeoJsonModel.d.ts +1 -1
- package/dist/output-gateway/routes/GeoJsonRouter.js.map +1 -1
- package/package.json +19 -9
- package/dist/output-gateway/routes/interfaces/IHistoryFilterParameters.d.ts +0 -7
- package/dist/output-gateway/routes/interfaces/IHistoryFilterParameters.js.map +0 -1
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DataSourceStreamedPipeline = void 0;
|
|
4
|
+
const logger_1 = require("../../helpers/logger");
|
|
5
|
+
const errors_1 = require("@golemio/errors");
|
|
6
|
+
const promises_1 = require("node:stream/promises");
|
|
7
|
+
const BatchWritable_1 = require("./BatchWritable");
|
|
8
|
+
const DataSource_1 = require("./DataSource");
|
|
9
|
+
class DataSourceStreamedPipeline extends DataSource_1.DataSource {
|
|
10
|
+
constructor(name, streamingStrategy, streamTransformer, options = {}) {
|
|
11
|
+
super(name, streamingStrategy, null, options.validator ?? null);
|
|
12
|
+
this.dataProcessor = null;
|
|
13
|
+
this.streamTransformer = streamTransformer;
|
|
14
|
+
this.batchSize = options.batchSize ?? DataSourceStreamedPipeline.DEFAULT_BATCH_SIZE;
|
|
15
|
+
this.timeoutMs = options.timeoutMs ?? DataSourceStreamedPipeline.DEFAULT_PIPELINE_TIMEOUT_MS;
|
|
16
|
+
}
|
|
17
|
+
get streamingStrategy() {
|
|
18
|
+
return this.protocolStrategy;
|
|
19
|
+
}
|
|
20
|
+
setDataProcessor(fn) {
|
|
21
|
+
this.dataProcessor = fn;
|
|
22
|
+
return this;
|
|
23
|
+
}
|
|
24
|
+
async proceed() {
|
|
25
|
+
if (!this.dataProcessor) {
|
|
26
|
+
throw new errors_1.GeneralError("No data processor registered. Call setDataProcessor() before proceed().", this.name);
|
|
27
|
+
}
|
|
28
|
+
const bodyStream = await this.streamingStrategy.getBodyStream();
|
|
29
|
+
let totalRecords = 0;
|
|
30
|
+
const batchWriter = this.createBatchWriter((processedCount) => {
|
|
31
|
+
totalRecords += processedCount;
|
|
32
|
+
});
|
|
33
|
+
try {
|
|
34
|
+
await (0, promises_1.pipeline)(bodyStream, this.streamTransformer, batchWriter, {
|
|
35
|
+
signal: AbortSignal.timeout(this.timeoutMs),
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
catch (err) {
|
|
39
|
+
bodyStream.destroy();
|
|
40
|
+
if (err instanceof errors_1.GeneralError)
|
|
41
|
+
throw err;
|
|
42
|
+
throw new errors_1.GeneralError("DataSourceStreamedPipeline pipeline failed.", this.name, err);
|
|
43
|
+
}
|
|
44
|
+
this.loggerEmitter.emit(logger_1.LoggerEventType.NumberOfRecords, { name: this.name, numberOfRecords: totalRecords });
|
|
45
|
+
}
|
|
46
|
+
createBatchWriter(onBatchProcessed) {
|
|
47
|
+
const batchSize = this.batchSize;
|
|
48
|
+
return new BatchWritable_1.BatchWritable({
|
|
49
|
+
batchSize,
|
|
50
|
+
onFlush: async (batch) => {
|
|
51
|
+
const processedCount = batch.length;
|
|
52
|
+
await this.validateAndProcess(batch);
|
|
53
|
+
onBatchProcessed(processedCount);
|
|
54
|
+
},
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
async validateAndProcess(batch) {
|
|
58
|
+
if (this.validator) {
|
|
59
|
+
try {
|
|
60
|
+
await this.validator.Validate(batch);
|
|
61
|
+
}
|
|
62
|
+
catch (err) {
|
|
63
|
+
throw new errors_1.GeneralError("Error while validating source data.", this.name, err);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
await this.dataProcessor(batch);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
exports.DataSourceStreamedPipeline = DataSourceStreamedPipeline;
|
|
70
|
+
DataSourceStreamedPipeline.DEFAULT_BATCH_SIZE = process.env.DATA_BATCH_SIZE ? Number(process.env.DATA_BATCH_SIZE) : 1000;
|
|
71
|
+
DataSourceStreamedPipeline.DEFAULT_PIPELINE_TIMEOUT_MS = 30 * 60 * 1000;
|
|
72
|
+
//# sourceMappingURL=DataSourceStreamedPipeline.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DataSourceStreamedPipeline.js","sourceRoot":"","sources":["../../../src/integration-engine/datasources/DataSourceStreamedPipeline.ts"],"names":[],"mappings":";;;AAAA,iDAAkD;AAElD,4CAA+C;AAG/C,mDAAgD;AAChD,mDAAgD;AAChD,6CAA0C;AAU1C,MAAa,0BAAmD,SAAQ,uBAAU;I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,GAAG,IAAI,AAAjB,CAAkB"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.JSONStreamTransformer = void 0;
|
|
4
|
+
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
5
|
+
const JSONStream = require("JSONStream");
|
|
6
|
+
class JSONStreamTransformer {
|
|
7
|
+
static parse(path) {
|
|
8
|
+
return JSONStream.parse(path);
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
exports.JSONStreamTransformer = JSONStreamTransformer;
|
|
12
|
+
//# sourceMappingURL=JSONStreamTransformer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"JSONStreamTransformer.js","sourceRoot":"","sources":["../../../../src/integration-engine/datasources/datatype-strategy/JSONStreamTransformer.ts"],"names":[],"mappings":";;;AAGA,8DAA8D;AAC9D,MAAM,UAAU,GAAG,OAAO,CAAC,YAAY,CAA4B,CAAC;AACpE,MAAa,qBAAqB;IAC9B,MAAM,CAAC,KAAK,CAAC,IAAY;QACrB,OAAO,UAAU,CAAC,KAAK,CAAC,IAAI,CAAyB,CAAC;IAC1D,CAAC;CACJ;AAJD,sDAIC"}
|
|
@@ -1,16 +1,21 @@
|
|
|
1
|
+
export * from "./BatchWritable";
|
|
1
2
|
export * from "./DataSource";
|
|
2
3
|
export * from "./DataSourceStream";
|
|
3
4
|
export * from "./DataSourceStreamManager";
|
|
4
5
|
export * from "./DataSourceStreamed";
|
|
6
|
+
export * from "./DataSourceStreamedPipeline";
|
|
5
7
|
export * from "./IDataSource";
|
|
6
8
|
export * from "./datatype-strategy/CSVDataTypeStrategy";
|
|
7
9
|
export * from "./datatype-strategy/IDataTypeStrategy";
|
|
8
10
|
export * from "./datatype-strategy/JSONDataTypeStrategy";
|
|
11
|
+
export * from "./datatype-strategy/JSONStreamTransformer";
|
|
9
12
|
export * from "./datatype-strategy/XMLDataTypeStrategy";
|
|
10
13
|
export * from "./protocol-strategy/FTPProtocolStrategy";
|
|
14
|
+
export * from "./protocol-strategy/HTTPRequestProtocolStrategyStreamed";
|
|
11
15
|
export * from "./protocol-strategy/GoogleCloudStorageProtocolStrategy";
|
|
12
16
|
export * from "./protocol-strategy/PaginatedHTTPProtocolStrategy";
|
|
13
17
|
export * from "./protocol-strategy/IProtocolStrategy";
|
|
18
|
+
export * from "./protocol-strategy/IStreamingProtocolStrategy";
|
|
14
19
|
export * from "./protocol-strategy/PostgresProtocolStrategy";
|
|
15
20
|
export * from "./protocol-strategy/PostgresProtocolStrategyStreamed";
|
|
16
21
|
export * from "./protocol-strategy/ProtocolStrategy";
|
|
@@ -15,19 +15,24 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
/* ie/datasources/index.ts */
|
|
18
|
+
__exportStar(require("./BatchWritable"), exports);
|
|
18
19
|
__exportStar(require("./DataSource"), exports);
|
|
19
20
|
__exportStar(require("./DataSourceStream"), exports);
|
|
20
21
|
__exportStar(require("./DataSourceStreamManager"), exports);
|
|
21
22
|
__exportStar(require("./DataSourceStreamed"), exports);
|
|
23
|
+
__exportStar(require("./DataSourceStreamedPipeline"), exports);
|
|
22
24
|
__exportStar(require("./IDataSource"), exports);
|
|
23
25
|
__exportStar(require("./datatype-strategy/CSVDataTypeStrategy"), exports);
|
|
24
26
|
__exportStar(require("./datatype-strategy/IDataTypeStrategy"), exports);
|
|
25
27
|
__exportStar(require("./datatype-strategy/JSONDataTypeStrategy"), exports);
|
|
28
|
+
__exportStar(require("./datatype-strategy/JSONStreamTransformer"), exports);
|
|
26
29
|
__exportStar(require("./datatype-strategy/XMLDataTypeStrategy"), exports);
|
|
27
30
|
__exportStar(require("./protocol-strategy/FTPProtocolStrategy"), exports);
|
|
31
|
+
__exportStar(require("./protocol-strategy/HTTPRequestProtocolStrategyStreamed"), exports);
|
|
28
32
|
__exportStar(require("./protocol-strategy/GoogleCloudStorageProtocolStrategy"), exports);
|
|
29
33
|
__exportStar(require("./protocol-strategy/PaginatedHTTPProtocolStrategy"), exports);
|
|
30
34
|
__exportStar(require("./protocol-strategy/IProtocolStrategy"), exports);
|
|
35
|
+
__exportStar(require("./protocol-strategy/IStreamingProtocolStrategy"), exports);
|
|
31
36
|
__exportStar(require("./protocol-strategy/PostgresProtocolStrategy"), exports);
|
|
32
37
|
__exportStar(require("./protocol-strategy/PostgresProtocolStrategyStreamed"), exports);
|
|
33
38
|
__exportStar(require("./protocol-strategy/ProtocolStrategy"), exports);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/integration-engine/datasources/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,6BAA6B;AAC7B,+CAA6B;AAC7B,qDAAmC;AACnC,4DAA0C;AAC1C,uDAAqC;AACrC,gDAA8B;AAC9B,0EAAwD;AACxD,wEAAsD;AACtD,2EAAyD;AACzD,0EAAwD;AACxD,0EAAwD;AACxD,yFAAuE;AACvE,oFAAkE;AAClE,wEAAsD;AACtD,+EAA6D;AAC7D,uFAAqE;AACrE,uEAAqD;AACrD,2EAAyD"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/integration-engine/datasources/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,6BAA6B;AAC7B,kDAAgC;AAChC,+CAA6B;AAC7B,qDAAmC;AACnC,4DAA0C;AAC1C,uDAAqC;AACrC,+DAA6C;AAC7C,gDAA8B;AAC9B,0EAAwD;AACxD,wEAAsD;AACtD,2EAAyD;AACzD,4EAA0D;AAC1D,0EAAwD;AACxD,0EAAwD;AACxD,0FAAwE;AACxE,yFAAuE;AACvE,oFAAkE;AAClE,wEAAsD;AACtD,iFAA+D;AAC/D,+EAA6D;AAC7D,uFAAqE;AACrE,uEAAqD;AACrD,2EAAyD"}
|
|
@@ -1,12 +1,16 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
1
2
|
import { IProtocolStrategy } from "./IProtocolStrategy";
|
|
3
|
+
import { Readable } from "node:stream";
|
|
2
4
|
import { DataSourceStream } from "../DataSourceStream";
|
|
3
5
|
import { HTTPRequestProtocolStrategy } from "./HTTPRequestProtocolStrategy";
|
|
4
|
-
|
|
6
|
+
import { IStreamingProtocolStrategy } from "./IStreamingProtocolStrategy";
|
|
7
|
+
export declare class HTTPRequestProtocolStrategyStreamed extends HTTPRequestProtocolStrategy implements IProtocolStrategy, IStreamingProtocolStrategy {
|
|
5
8
|
private streamTransform;
|
|
6
9
|
/**
|
|
7
10
|
* @param streamTransform data will be piped to this stream if provided
|
|
8
11
|
*/
|
|
9
12
|
setStreamTransformer: (streamTransform: any) => HTTPRequestProtocolStrategyStreamed;
|
|
10
13
|
getData(): Promise<DataSourceStream>;
|
|
14
|
+
getBodyStream(): Promise<Readable>;
|
|
11
15
|
getRawData: () => Promise<any>;
|
|
12
16
|
}
|
package/dist/integration-engine/datasources/protocol-strategy/HTTPRequestProtocolStrategyStreamed.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.HTTPRequestProtocolStrategyStreamed = void 0;
|
|
4
4
|
const errors_1 = require("@golemio/errors");
|
|
5
|
+
const node_zlib_1 = require("node:zlib");
|
|
5
6
|
const DataSourceStream_1 = require("../DataSourceStream");
|
|
6
7
|
const HTTPRequestProtocolStrategy_1 = require("./HTTPRequestProtocolStrategy");
|
|
7
8
|
class HTTPRequestProtocolStrategyStreamed extends HTTPRequestProtocolStrategy_1.HTTPRequestProtocolStrategy {
|
|
@@ -16,7 +17,8 @@ class HTTPRequestProtocolStrategyStreamed extends HTTPRequestProtocolStrategy_1.
|
|
|
16
17
|
};
|
|
17
18
|
this.getRawData = async () => {
|
|
18
19
|
if (this.connectionSettings.compression) {
|
|
19
|
-
throw new errors_1.GeneralError("
|
|
20
|
+
throw new errors_1.GeneralError("Compressed resources are not supported in the legacy DataSourceStream path;" +
|
|
21
|
+
"use DataSourceStreamedPipeline instead", this.constructor.name);
|
|
20
22
|
}
|
|
21
23
|
try {
|
|
22
24
|
const result = await this.getResponseInternal();
|
|
@@ -97,6 +99,33 @@ class HTTPRequestProtocolStrategyStreamed extends HTTPRequestProtocolStrategy_1.
|
|
|
97
99
|
}
|
|
98
100
|
return outStream;
|
|
99
101
|
}
|
|
102
|
+
async getBodyStream() {
|
|
103
|
+
try {
|
|
104
|
+
const result = await this.getResponseInternal();
|
|
105
|
+
if (result.statusCode < 200 || result.statusCode >= 300) {
|
|
106
|
+
result.body?.resume?.(); // drain to avoid connection leak (some statuses have no body)
|
|
107
|
+
throw new errors_1.GeneralError(`Unexpected HTTP status ${result.statusCode}`, this.constructor.name);
|
|
108
|
+
}
|
|
109
|
+
let body = result.body;
|
|
110
|
+
if (this.connectionSettings.compression === "gzip") {
|
|
111
|
+
const encoding = String(result.headers?.["content-encoding"] ?? "").toLowerCase();
|
|
112
|
+
if (encoding !== "gzip") {
|
|
113
|
+
body?.resume?.();
|
|
114
|
+
throw new errors_1.GeneralError(`Expected gzip-encoded response but server returned Content-Encoding: "${encoding || "<none>"}"`, this.constructor.name);
|
|
115
|
+
}
|
|
116
|
+
body = body.pipe((0, node_zlib_1.createGunzip)());
|
|
117
|
+
}
|
|
118
|
+
return this.teeRawDataToStorage(body, {
|
|
119
|
+
statusCode: result.statusCode,
|
|
120
|
+
headers: result.headers,
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
catch (err) {
|
|
124
|
+
if (err instanceof errors_1.GeneralError)
|
|
125
|
+
throw err;
|
|
126
|
+
throw new errors_1.GeneralError("Error while getting body stream from server.", this.constructor.name, err);
|
|
127
|
+
}
|
|
128
|
+
}
|
|
100
129
|
}
|
|
101
130
|
exports.HTTPRequestProtocolStrategyStreamed = HTTPRequestProtocolStrategyStreamed;
|
|
102
131
|
//# sourceMappingURL=HTTPRequestProtocolStrategyStreamed.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HTTPRequestProtocolStrategyStreamed.js","sourceRoot":"","sources":["../../../../src/integration-engine/datasources/protocol-strategy/HTTPRequestProtocolStrategyStreamed.ts"],"names":[],"mappings":";;;AACA,4CAAqE;
|
|
1
|
+
{"version":3,"file":"HTTPRequestProtocolStrategyStreamed.js","sourceRoot":"","sources":["../../../../src/integration-engine/datasources/protocol-strategy/HTTPRequestProtocolStrategyStreamed.ts"],"names":[],"mappings":";;;AACA,4CAAqE;AAErE,yCAAyC;AACzC,0DAAuD;AACvD,+EAA4E;AAG5E,MAAa,mCACT,SAAQ,yDAA2B;IADvC;;QAMI;;WAEG;QACI,yBAAoB,GAAG,CAAC,eAAoB,EAAuC,EAAE;YACxF,IAAI,CAAC,eAAe,GAAG,eAAe,CAAC;YACvC,OAAO,IAAI,CAAC;QAChB,CAAC,CAAC;QAuGK,eAAU,GAAG,KAAK,IAAkB,EAAE;YACzC,IAAI,IAAI,CAAC,kBAAkB,CAAC,WAAW,EAAE;gBACrC,MAAM,IAAI,qBAAY,CAClB,6EAA6E;oBACzE,wCAAwC,EAC5C,IAAI,CAAC,WAAW,CAAC,IAAI,CACxB,CAAC;aACL;YAED,IAAI;gBACA,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,mBAAmB,EAAE,CAAC;gBAEhD,OAAO;oBACH,IAAI,EAAE,MAAM,CAAC,IAAI;iBACpB,CAAC;aACL;YAAC,OAAO,GAAG,EAAE;gBACV,MAAM,IAAI,qBAAY,CAAC,uCAAuC,EAAE,IAAI,CAAC,WAAW,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;aAC/F;QACL,CAAC,CAAC;IACN,CAAC;IAxHU,KAAK,CAAC,OAAO;QAChB,MAAM,UAAU,GAAG,MAAM,KAAK,CAAC,OAAO,EAAE,CAAC;QAEzC,MAAM,SAAS,GAAG,IAAI,mCAAgB,CAAC;YACnC,UAAU,EAA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protocol-strategy/IStreamingProtocolStrategy.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IStreamingProtocolStrategy.js","sourceRoot":"","sources":["../../../../src/integration-engine/datasources/protocol-strategy/IStreamingProtocolStrategy.ts"],"names":[],"mappings":""}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import { Readable } from "node:stream";
|
|
1
3
|
import { DataSourceStream } from "../DataSourceStream";
|
|
2
4
|
import { IProtocolStrategy, ProtocolStrategySettings } from "./IProtocolStrategy";
|
|
3
5
|
export declare class ProtocolStrategy implements IProtocolStrategy {
|
|
@@ -18,6 +20,7 @@ export declare class ProtocolStrategy implements IProtocolStrategy {
|
|
|
18
20
|
}>;
|
|
19
21
|
getLastModified: () => Promise<string | null>;
|
|
20
22
|
protected getRawData(...args: any): Promise<any | DataSourceStream>;
|
|
23
|
+
protected teeRawDataToStorage(bodyStream: Readable, meta?: unknown): Readable;
|
|
21
24
|
private prepareRawData;
|
|
22
25
|
private pushRawDataToS3Stream;
|
|
23
26
|
}
|
|
@@ -9,7 +9,8 @@ const RawDataStorage_1 = __importDefault(require("../../data-access/RawDataStora
|
|
|
9
9
|
const ioc_1 = require("../../ioc");
|
|
10
10
|
const Di_1 = require("../../ioc/Di");
|
|
11
11
|
const errors_1 = require("@golemio/errors");
|
|
12
|
-
const
|
|
12
|
+
const node_stream_1 = require("node:stream");
|
|
13
|
+
const promises_1 = require("node:stream/promises");
|
|
13
14
|
const DataSourceStream_1 = require("../DataSourceStream");
|
|
14
15
|
class ProtocolStrategy {
|
|
15
16
|
constructor(settings) {
|
|
@@ -93,9 +94,9 @@ class ProtocolStrategy {
|
|
|
93
94
|
let dataSaveCalled = false;
|
|
94
95
|
let protocolDataStream;
|
|
95
96
|
// bit paranoid but ...
|
|
96
|
-
if (rawData && (rawData instanceof
|
|
97
|
+
if (rawData && (rawData instanceof node_stream_1.Readable || rawData.constructor.name === "Request") && rawData.on) {
|
|
97
98
|
protocolDataStream = rawData;
|
|
98
|
-
const S3Stream = new
|
|
99
|
+
const S3Stream = new node_stream_1.Readable({
|
|
99
100
|
objectMode: false,
|
|
100
101
|
read: () => {
|
|
101
102
|
return;
|
|
@@ -149,6 +150,44 @@ class ProtocolStrategy {
|
|
|
149
150
|
async getRawData(...args) {
|
|
150
151
|
throw new Error("getRawData: Method not implemented.");
|
|
151
152
|
}
|
|
153
|
+
teeRawDataToStorage(bodyStream, meta = {}) {
|
|
154
|
+
if (!this.storageEnabled || !this.saveRawDataWhitelist[this.caller]) {
|
|
155
|
+
return bodyStream;
|
|
156
|
+
}
|
|
157
|
+
const S3Stream = new node_stream_1.Readable({
|
|
158
|
+
objectMode: false,
|
|
159
|
+
read: () => {
|
|
160
|
+
return;
|
|
161
|
+
},
|
|
162
|
+
});
|
|
163
|
+
const consumer = new node_stream_1.PassThrough();
|
|
164
|
+
let consumerErrorFired = false;
|
|
165
|
+
(0, promises_1.pipeline)(bodyStream, consumer).catch((err) => {
|
|
166
|
+
if (!consumerErrorFired) {
|
|
167
|
+
this.logger.error(`Body stream source failed for ${this.caller}`, err);
|
|
168
|
+
}
|
|
169
|
+
});
|
|
170
|
+
let saveCalled = false;
|
|
171
|
+
consumer.on("data", async (chunk) => {
|
|
172
|
+
await this.pushRawDataToS3Stream(chunk, S3Stream);
|
|
173
|
+
if (!saveCalled) {
|
|
174
|
+
this.rawDataStorage.save(S3Stream, meta, this.caller);
|
|
175
|
+
saveCalled = true;
|
|
176
|
+
}
|
|
177
|
+
});
|
|
178
|
+
consumer.on("end", () => {
|
|
179
|
+
S3Stream.push(null);
|
|
180
|
+
});
|
|
181
|
+
consumer.on("error", (err) => {
|
|
182
|
+
consumerErrorFired = true;
|
|
183
|
+
this.logger.warn(`Raw data save to storage interrupted for ${this.caller}`, err);
|
|
184
|
+
S3Stream.push(null);
|
|
185
|
+
});
|
|
186
|
+
S3Stream.on("error", (err) => {
|
|
187
|
+
this.logger.error(`Error on saving raw data for ${this.caller}`, err);
|
|
188
|
+
});
|
|
189
|
+
return consumer;
|
|
190
|
+
}
|
|
152
191
|
}
|
|
153
192
|
exports.ProtocolStrategy = ProtocolStrategy;
|
|
154
193
|
//# sourceMappingURL=ProtocolStrategy.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ProtocolStrategy.js","sourceRoot":"","sources":["../../../../src/integration-engine/datasources/protocol-strategy/ProtocolStrategy.ts"],"names":[],"mappings":";;;;;;AACA,8DAAmD;AAGnD,sFAA4D;AAC5D,mCAAyC;AACzC,qCAAwD;AACxD,4CAAqE;AACrE,
|
|
1
|
+
{"version":3,"file":"ProtocolStrategy.js","sourceRoot":"","sources":["../../../../src/integration-engine/datasources/protocol-strategy/ProtocolStrategy.ts"],"names":[],"mappings":";;;;;;AACA,8DAAmD;AAGnD,sFAA4D;AAC5D,mCAAyC;AACzC,qCAAwD;AACxD,4CAAqE;AACrE,6CAAoD;AACpD,mDAAgD;AAChD,0DAAuD;AAGvD,MAAa,gBAAgB;IASzB,YAAY,QAAa;QANjB,WAAM,GAAG,SAAS,CAAC;QAgBpB,kBAAa,GAAG,CAAC,SAAiB,oBAAoB,EAAE,EAAE;YAC7D,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC,CAAC,iBAAiB;QAC3C,CAAC,CAAC;QAMK,0BAAqB,GAAG,GAA6B,EAAE;YAC1D,OAAO,IAAI,CAAC,kBAAkB,CAAC;QACnC,CAAC,CAAC;QA8EK,oBAAe,GAAG,KAAK,IAA4B,EAAE;YACxD,MAAM,IAAI,KAAK,CAAC,0CAA0C,CAAC,CAAC;QAChE,CAAC,CAAC;QAqDM,mBAAc,GAAG,KAAK,EAAE,IAAS,EAA0B,EAAE;YACjE,IAAI,OAAO,GAAkB,IAAI,CAAC;YAElC,IAAI,IAAI,YAAY,IAAI,EAAE;gBACtB,OAAO,GAAG,MAAM,IAAI,CAAC,IAAI,EAAE,CAAC;aAC/B;iBAAM,IAAI,IAAI,Y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AE;YACzB,kBAAkB,GAAG,IAAI,CAAC;YAC1B,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,4CAA4C,IAAI,CAAC,MAAM,EAAE,EAAE,GAAG,CAAC,CAAC;YACjF,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACxB,CAAC,CAAC,CAAC;QAEH,QAAQ,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,GAAG,EAAE,EAAE;YACzB,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,gCAAgC,IAAI,CAAC,MAAM,EAAE,EAAE,GAAG,CAAC,CAAC;QAC1E,CAAC,CAAC,CAAC;QAEH,OAAO,QAAQ,CAAC;IACpB,CAAC;CAsDJ;AAtND,4CAsNC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.IntegrationErrorHandler = void 0;
|
|
4
|
-
const
|
|
4
|
+
const Logger_1 = require("./Logger");
|
|
5
5
|
const errors_1 = require("@golemio/errors");
|
|
6
6
|
/**
|
|
7
7
|
* Class responsible for error handling in the app. Catches errors and based on their type performs some action.
|
|
@@ -18,19 +18,19 @@ class IntegrationErrorHandler extends errors_1.ErrorHandler {
|
|
|
18
18
|
if (err instanceof errors_1.GeneralError) {
|
|
19
19
|
if (err instanceof errors_1.RecoverableError) {
|
|
20
20
|
// warning: ack message - do not retry
|
|
21
|
-
|
|
21
|
+
Logger_1.log.warn(err);
|
|
22
22
|
return this.handleRecoverableError(err);
|
|
23
23
|
}
|
|
24
24
|
else {
|
|
25
25
|
// error: nack message
|
|
26
|
-
|
|
26
|
+
Logger_1.log.error(err);
|
|
27
27
|
return this.handleNonRecoverableError(err);
|
|
28
28
|
}
|
|
29
29
|
}
|
|
30
30
|
// Unexpected and Fatal errors
|
|
31
31
|
// error: nack message before exiting
|
|
32
32
|
if (err instanceof errors_1.AbortError) {
|
|
33
|
-
|
|
33
|
+
Logger_1.log.error(err);
|
|
34
34
|
return this.handleAbortError(err);
|
|
35
35
|
}
|
|
36
36
|
// error: exit - message is re-queued
|
|
@@ -39,7 +39,7 @@ class IntegrationErrorHandler extends errors_1.ErrorHandler {
|
|
|
39
39
|
cause: err.message,
|
|
40
40
|
stack: err.stack,
|
|
41
41
|
};
|
|
42
|
-
|
|
42
|
+
Logger_1.log.error({ message: msg });
|
|
43
43
|
// if anything fails, process is killed
|
|
44
44
|
return process.exit(1);
|
|
45
45
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IntegrationErrorHandler.js","sourceRoot":"","sources":["../../../src/integration-engine/helpers/IntegrationErrorHandler.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"IntegrationErrorHandler.js","sourceRoot":"","sources":["../../../src/integration-engine/helpers/IntegrationErrorHandler.ts"],"names":[],"mappings":";;;AAAA,qCAAyC;AACzC,4CAA0G;AAO1G;;;;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,YAAG,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;gBACd,OAAO,IAAI,CAAC,sBAAsB,CAAC,GAAG,CAAC,CAAC;aAC3C;iBAAM;gBACH,sBAAsB;gBACtB,YAAG,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,YAAG,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,YAAG,CAAC,KAAK,CAAC,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC,CAAC;QAC5B,uCAAuC;QAEvC,OAAO,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAC3B,CAAC;IAEO,MAAM,CAAC,sBAAsB,CAAC,GAAqB;QACvD,OAAO,EAAE,GAAG,GAAG,CAAC,QAAQ,EAAE,EAAE,GAAG,EAAE,IAAI,EAAE,CAAC;IAC5C,CAAC;IAEO,MAAM,CAAC,yBAAyB,CAAC,GAAiB;QACtD,OAAO,EAAE,GAAG,GAAG,CAAC,QAAQ,EAAE,EAAE,GAAG,EAAE,KAAK,EAAE,CAAC;IAC7C,CAAC;IAEO,MAAM,CAAC,gBAAgB,CAAC,GAAe;QAC3C,OAAO,EAAE,GAAG,GAAG,CAAC,QAAQ,EAAE,EAAE,GAAG,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;IACzD,CAAC;CACJ;AAjDD,0DAiDC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BulkSaveRecords, BulkSaveResult, IModel, ISequelizeSettings } from "./";
|
|
1
|
+
import { BulkSaveRecords, BulkSaveResult, IModel, ISequelizeSettings } from "./IModel";
|
|
2
2
|
import { IValidator } from "@golemio/validator";
|
|
3
3
|
import { Model, ModelCtor, Sequelize, SyncOptions, Transaction } from "sequelize";
|
|
4
4
|
export declare class PostgresModel implements IModel {
|
|
@@ -5,7 +5,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.RedisModel = void 0;
|
|
7
7
|
const utils_1 = require("../../helpers/utils");
|
|
8
|
-
const
|
|
8
|
+
const Logger_1 = require("../helpers/Logger");
|
|
9
9
|
const ioc_1 = require("../ioc");
|
|
10
10
|
const errors_1 = require("@golemio/errors");
|
|
11
11
|
const redis_rstream_1 = __importDefault(require("redis-rstream"));
|
|
@@ -128,18 +128,18 @@ class RedisModel {
|
|
|
128
128
|
}
|
|
129
129
|
});
|
|
130
130
|
stream.on("error", (err) => {
|
|
131
|
-
|
|
131
|
+
Logger_1.log.error(err);
|
|
132
132
|
return reject(err);
|
|
133
133
|
});
|
|
134
134
|
stream.on("end", async () => {
|
|
135
135
|
try {
|
|
136
136
|
const result = await pipeline.exec();
|
|
137
137
|
const deleteCount = result?.reduce((acc, el) => acc + el[1], 0) ?? 0;
|
|
138
|
-
|
|
138
|
+
Logger_1.log.info(`Truncate complete for ${prefix}, deleted ${deleteCount} in (${result?.length ?? 0}) batches`);
|
|
139
139
|
resolve(deleteCount);
|
|
140
140
|
}
|
|
141
141
|
catch (err) {
|
|
142
|
-
|
|
142
|
+
Logger_1.log.error(err);
|
|
143
143
|
return reject(err);
|
|
144
144
|
}
|
|
145
145
|
});
|
|
@@ -159,7 +159,7 @@ class RedisModel {
|
|
|
159
159
|
}
|
|
160
160
|
}
|
|
161
161
|
else if (!this.validator && this.isKeyConstructedFromData) {
|
|
162
|
-
|
|
162
|
+
Logger_1.log.warn(this.name + ": Model validator is not set.");
|
|
163
163
|
}
|
|
164
164
|
};
|
|
165
165
|
this.buildKey = (key, data) => {
|
|
@@ -177,7 +177,7 @@ class RedisModel {
|
|
|
177
177
|
this.encodeDataBeforeSave = settings.encodeDataBeforeSave ? settings.encodeDataBeforeSave : (raw) => raw;
|
|
178
178
|
this.decodeDataAfterGet = settings.decodeDataAfterGet ? settings.decodeDataAfterGet : (raw) => raw;
|
|
179
179
|
if (this.validator?.setLogger) {
|
|
180
|
-
this.validator.setLogger(
|
|
180
|
+
this.validator.setLogger(Logger_1.log);
|
|
181
181
|
}
|
|
182
182
|
}
|
|
183
183
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RedisModel.js","sourceRoot":"","sources":["../../../src/integration-engine/models/RedisModel.ts"],"names":[],"mappings":";;;;;;AACA,+CAAgD;AAChD,
|
|
1
|
+
{"version":3,"file":"RedisModel.js","sourceRoot":"","sources":["../../../src/integration-engine/models/RedisModel.ts"],"names":[],"mappings":";;;;;;AACA,+CAAgD;AAChD,8CAAyC;AACzC,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,EAAE,QAAQ,CAAC,EAAE,CAAC;oBAClE,MAAM,WAAW,GAAG,IAAI,CAAC,oBAAoB,CAAC,QAAQ,CAAC,CAAC;oBAExD,IAAI,UAAU,EAAE;wBACZ,OAAO,KAAK,CAAC,KAAK,CAAC,QAAQ,EAAE,UAAU,EAAE,WAAW,CAAC,CAAC;qBACzD;yBAAM,IAAI,eAAe,EAAE;wBACxB,iCAAiC;wBACjC,OAAO,KAAK,CAAC,GAAG,CAAC,QAAQ,EAAE,WAAW,EAAE,MAAM,EAAE,eAAe,CAAC,CAAC;qBACpE;yBAAM;wBACH,OAAO,KAAK,CAAC,GAAG,CAAC,QAAQ,EAAE,WAAW,CAAC,CAAC;qBAC3C;iBACJ;gBAED,2BAA2B;gBAC3B,OAA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AC;QAC9B,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAE3B,IAAI,CAAC,oBAAoB,GAAG,QAAQ,CAAC,oBAAoB,CAAC,CAAC,CAAC,QAAQ,CAAC,oBAAoB,CAAC,CAAC,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC;QACzG,IAAI,CAAC,kBAAkB,GAAG,QAAQ,CAAC,kBAAkB,CAAC,CAAC,CAAC,QAAQ,CAAC,kBAAkB,CAAC,CAAC,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC;QAEnG,IAAI,IAAI,CAAC,SAAS,EAAE,SAAS,EAAE;YAC3B,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,YAAG,CAAC,CAAC;SACjC;IACL,CAAC;CAgLJ;AA7MD,gCA6MC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Request, Response, NextFunction } from "express";
|
|
2
2
|
import { Registry } from "prom-client";
|
|
3
3
|
import { IMetricsClientConfig } from "./metrics-interface";
|
|
4
|
-
import { ILogger } from "../../helpers";
|
|
4
|
+
import { ILogger } from "../../helpers/logger/LoggerProvider";
|
|
5
5
|
export declare const apiMetricsMiddleware: (registry: Registry, config: IMetricsClientConfig, log: ILogger) => (req: Request, res: Response, next: NextFunction) => void;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/// <reference types="qs" />
|
|
2
2
|
import express, { Request } from "express";
|
|
3
3
|
import { Server } from "http";
|
|
4
|
-
import { ILogger } from "../../helpers";
|
|
4
|
+
import { ILogger } from "../../helpers/logger/LoggerProvider";
|
|
5
5
|
import { IMetricsClientConfig } from "./metrics-interface";
|
|
6
6
|
import { ICustomMetrics } from "./definitions/custom-metrics-definitions";
|
|
7
7
|
export interface IWorkerLabelData {
|
|
@@ -3,14 +3,14 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.SequelizeModel = void 0;
|
|
4
4
|
const CoreToken_1 = require("../../helpers/ioc/CoreToken");
|
|
5
5
|
const ioc_1 = require("../ioc");
|
|
6
|
-
const
|
|
6
|
+
const BaseModel_1 = require("./BaseModel");
|
|
7
7
|
/**
|
|
8
8
|
* General model for data stored in PostgreSQL.
|
|
9
9
|
*
|
|
10
10
|
* Model /DATA ACCESS LAYER/: Defines data structure, connects to DB storage and retrieves data directly from database.
|
|
11
11
|
* Performs database queries.
|
|
12
12
|
*/
|
|
13
|
-
class SequelizeModel extends
|
|
13
|
+
class SequelizeModel extends BaseModel_1.BaseModel {
|
|
14
14
|
constructor(name, tableName, attributes, options) {
|
|
15
15
|
super(name);
|
|
16
16
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SequelizeModel.js","sourceRoot":"","sources":["../../../src/output-gateway/models/SequelizeModel.ts"],"names":[],"mappings":";;;AACA,2DAAmD;AACnD,gCAAiD;AACjD
|
|
1
|
+
{"version":3,"file":"SequelizeModel.js","sourceRoot":"","sources":["../../../src/output-gateway/models/SequelizeModel.ts"],"names":[],"mappings":";;;AACA,2DAAmD;AACnD,gCAAiD;AACjD,2CAAiD;AAGjD;;;;;GAKG;AACH,MAAsB,cAAe,SAAQ,qBAAS;IAOlD,YAAsB,IAAY,EAAE,SAAiB,EAAE,UAAgC,EAAE,OAA2B;QAChH,KAAK,CAAC,IAAI,CAAC,CAAC;QAehB;;WAEG;QACI,cAAS,GAAG,CAAC,MAAW,EAAQ,EAAE;YACrC,OAAO;QACX,CAAC,CAAC;QAnBE,MAAM,SAAS,GAAG,4BAAsB,CAAC,OAAO,CAAqB,qBAAS,CAAC,iBAAiB,CAAC,CAAC;QAClG,aAAa;QACb,IAAI,CAAC,cAAc,GAAG,SAAS,CAAC,aAAa,EAAE,CAAC,MAAM,CAAC,SAAS,EAAE,UAAU,EAAE;YAC1E,qFAAqF;YACrF,8EAA8E;YAC9E,YAAY,EAAE;gBACV,UAAU,EAAE;oBACR,OAAO,EAAE,CAAC,YAAY,EAAE,YAAY,EAAE,YAAY,EAAE,YAAY,EAAE,iBAAiB,EAAE,iBAAiB,CAAC;iBAC1G;aACJ;YACD,GAAG,OAAO;SACb,CAAC,CAAC;IACP,CAAC;CAQJ;AA7BD,wCA6BC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { IBaseModel } from "./IBaseModel";
|
|
2
|
-
import { IPropertyResponseModel } from "
|
|
2
|
+
import { IPropertyResponseModel } from "../response/IPropertyResponseModel";
|
|
3
3
|
export interface IGeoJsonModel extends IBaseModel {
|
|
4
4
|
GetAll(options?: any): Promise<any>;
|
|
5
5
|
GetOne(id: string): Promise<any>;
|