@golemio/pid 2.2.11 → 2.2.12-dev.631390368
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/db/example/{00_truncate_tables.sql → 00_clear_test_data.sql} +9 -0
- package/db/example/05_vehicle_positions_dump.sql +2 -2
- package/db/example/12_metro_runs_messages.sql +5 -0
- package/db/migrations/postgresql/20220830144637-metro-runs-messages.js +53 -0
- package/db/migrations/postgresql/sqls/20220830144637-metro-runs-messages-down.sql +1 -0
- package/db/migrations/postgresql/sqls/20220830144637-metro-runs-messages-up.sql +27 -0
- package/dist/integration-engine/index.d.ts +2 -0
- package/dist/integration-engine/index.js +3 -1
- package/dist/integration-engine/index.js.map +1 -1
- package/dist/integration-engine/queueDefinitions.d.ts +3 -0
- package/dist/integration-engine/queueDefinitions.js +3 -0
- package/dist/integration-engine/queueDefinitions.js.map +1 -1
- package/dist/integration-engine/vehicle-positions/VehiclePositionsWorker.d.ts +4 -4
- package/dist/integration-engine/vehicle-positions/VehiclePositionsWorker.js +5 -4
- package/dist/integration-engine/vehicle-positions/VehiclePositionsWorker.js.map +1 -1
- package/dist/integration-engine/vehicle-positions/data-access/MetroRunsMessagesRepository.d.ts +7 -0
- package/dist/integration-engine/vehicle-positions/data-access/MetroRunsMessagesRepository.js +81 -0
- package/dist/integration-engine/vehicle-positions/data-access/MetroRunsMessagesRepository.js.map +1 -0
- package/dist/integration-engine/vehicle-positions/data-access/index.d.ts +1 -0
- package/dist/integration-engine/vehicle-positions/data-access/index.js +18 -0
- package/dist/integration-engine/vehicle-positions/data-access/index.js.map +1 -0
- package/dist/integration-engine/vehicle-positions/schema/DataDeletionSchema.d.ts +6 -0
- package/dist/integration-engine/vehicle-positions/schema/DataDeletionSchema.js +22 -0
- package/dist/integration-engine/vehicle-positions/schema/DataDeletionSchema.js.map +1 -0
- package/dist/integration-engine/vehicle-positions/schema/MetroRunsSchema.d.ts +4 -0
- package/dist/integration-engine/vehicle-positions/schema/MetroRunsSchema.js +84 -0
- package/dist/integration-engine/vehicle-positions/schema/MetroRunsSchema.js.map +1 -0
- package/dist/integration-engine/vehicle-positions/schema/MetroRunsSchemaInterfaces.d.ts +22 -0
- package/dist/integration-engine/vehicle-positions/schema/MetroRunsSchemaInterfaces.js +3 -0
- package/dist/integration-engine/vehicle-positions/schema/MetroRunsSchemaInterfaces.js.map +1 -0
- package/dist/integration-engine/vehicle-positions/schema/index.d.ts +3 -0
- package/dist/integration-engine/vehicle-positions/schema/index.js +20 -0
- package/dist/integration-engine/vehicle-positions/schema/index.js.map +1 -0
- package/dist/integration-engine/vehicle-positions/transformations/MetroRunsMessagesTransformation.d.ts +6 -0
- package/dist/integration-engine/vehicle-positions/transformations/MetroRunsMessagesTransformation.js +37 -0
- package/dist/integration-engine/vehicle-positions/transformations/MetroRunsMessagesTransformation.js.map +1 -0
- package/dist/integration-engine/vehicle-positions/transformations/index.d.ts +1 -0
- package/dist/integration-engine/vehicle-positions/transformations/index.js +1 -0
- package/dist/integration-engine/vehicle-positions/transformations/index.js.map +1 -1
- package/dist/integration-engine/vehicle-positions/workers/runs/RunsWorker.d.ts +5 -0
- package/dist/integration-engine/vehicle-positions/workers/runs/RunsWorker.js +18 -0
- package/dist/integration-engine/vehicle-positions/workers/runs/RunsWorker.js.map +1 -0
- package/dist/integration-engine/vehicle-positions/workers/runs/tasks/DeleteDataTask.d.ts +10 -0
- package/dist/integration-engine/vehicle-positions/workers/runs/tasks/DeleteDataTask.js +31 -0
- package/dist/integration-engine/vehicle-positions/workers/runs/tasks/DeleteDataTask.js.map +1 -0
- package/dist/integration-engine/vehicle-positions/workers/runs/tasks/SaveMetroRunsToDBTask.d.ts +10 -0
- package/dist/integration-engine/vehicle-positions/workers/runs/tasks/SaveMetroRunsToDBTask.js +33 -0
- package/dist/integration-engine/vehicle-positions/workers/runs/tasks/SaveMetroRunsToDBTask.js.map +1 -0
- package/dist/schema-definitions/vehicle-positions/models/MetroRunsMessagesModel.d.ts +17 -0
- package/dist/schema-definitions/vehicle-positions/models/MetroRunsMessagesModel.js +90 -0
- package/dist/schema-definitions/vehicle-positions/models/MetroRunsMessagesModel.js.map +1 -0
- package/dist/schema-definitions/vehicle-positions/models/index.d.ts +1 -0
- package/dist/schema-definitions/vehicle-positions/models/index.js +18 -0
- package/dist/schema-definitions/vehicle-positions/models/index.js.map +1 -0
- package/dist/schema-definitions/vehicle-positions/models/interfaces/IMetroRunsMessagesModel.d.ts +10 -0
- package/dist/schema-definitions/vehicle-positions/models/interfaces/IMetroRunsMessagesModel.js +3 -0
- package/dist/schema-definitions/vehicle-positions/models/interfaces/IMetroRunsMessagesModel.js.map +1 -0
- package/package.json +77 -76
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.MetroRunsValidationSchema = void 0;
|
|
13
|
+
const class_validator_1 = require("@golemio/core/dist/shared/class-validator");
|
|
14
|
+
const class_transformer_1 = require("@golemio/core/dist/shared/class-transformer");
|
|
15
|
+
class MessagePropertiesValidationSchema {
|
|
16
|
+
}
|
|
17
|
+
__decorate([
|
|
18
|
+
(0, class_validator_1.IsString)(),
|
|
19
|
+
(0, class_validator_1.IsByteLength)(1, 1),
|
|
20
|
+
__metadata("design:type", String)
|
|
21
|
+
], MessagePropertiesValidationSchema.prototype, "linka", void 0);
|
|
22
|
+
__decorate([
|
|
23
|
+
(0, class_validator_1.IsISO8601)({ strict: true }),
|
|
24
|
+
__metadata("design:type", String)
|
|
25
|
+
], MessagePropertiesValidationSchema.prototype, "tm", void 0);
|
|
26
|
+
__decorate([
|
|
27
|
+
(0, class_validator_1.IsOptional)(),
|
|
28
|
+
(0, class_validator_1.IsString)(),
|
|
29
|
+
__metadata("design:type", String)
|
|
30
|
+
], MessagePropertiesValidationSchema.prototype, "gvd", void 0);
|
|
31
|
+
class TrainPropertiesValidationSchema {
|
|
32
|
+
}
|
|
33
|
+
__decorate([
|
|
34
|
+
(0, class_validator_1.IsString)(),
|
|
35
|
+
__metadata("design:type", String)
|
|
36
|
+
], TrainPropertiesValidationSchema.prototype, "csp", void 0);
|
|
37
|
+
__decorate([
|
|
38
|
+
(0, class_validator_1.IsString)(),
|
|
39
|
+
__metadata("design:type", String)
|
|
40
|
+
], TrainPropertiesValidationSchema.prototype, "csr", void 0);
|
|
41
|
+
__decorate([
|
|
42
|
+
(0, class_validator_1.IsString)(),
|
|
43
|
+
__metadata("design:type", String)
|
|
44
|
+
], TrainPropertiesValidationSchema.prototype, "cv", void 0);
|
|
45
|
+
__decorate([
|
|
46
|
+
(0, class_validator_1.IsString)(),
|
|
47
|
+
__metadata("design:type", String)
|
|
48
|
+
], TrainPropertiesValidationSchema.prototype, "ko", void 0);
|
|
49
|
+
__decorate([
|
|
50
|
+
(0, class_validator_1.IsNumberString)(),
|
|
51
|
+
__metadata("design:type", String)
|
|
52
|
+
], TrainPropertiesValidationSchema.prototype, "odch", void 0);
|
|
53
|
+
class TrainContentValidationSchema {
|
|
54
|
+
}
|
|
55
|
+
__decorate([
|
|
56
|
+
(0, class_validator_1.IsObject)(),
|
|
57
|
+
(0, class_validator_1.ValidateNested)(),
|
|
58
|
+
(0, class_transformer_1.Type)(() => TrainPropertiesValidationSchema),
|
|
59
|
+
__metadata("design:type", Object)
|
|
60
|
+
], TrainContentValidationSchema.prototype, "$", void 0);
|
|
61
|
+
class MessageContentValidationSchema {
|
|
62
|
+
}
|
|
63
|
+
__decorate([
|
|
64
|
+
(0, class_validator_1.IsObject)(),
|
|
65
|
+
(0, class_validator_1.ValidateNested)(),
|
|
66
|
+
(0, class_transformer_1.Type)(() => MessagePropertiesValidationSchema),
|
|
67
|
+
__metadata("design:type", Object)
|
|
68
|
+
], MessageContentValidationSchema.prototype, "$", void 0);
|
|
69
|
+
__decorate([
|
|
70
|
+
(0, class_validator_1.IsObject)({ each: true }),
|
|
71
|
+
(0, class_validator_1.ValidateNested)(),
|
|
72
|
+
(0, class_transformer_1.Type)(() => TrainContentValidationSchema),
|
|
73
|
+
__metadata("design:type", Object)
|
|
74
|
+
], MessageContentValidationSchema.prototype, "vlak", void 0);
|
|
75
|
+
class MetroRunsValidationSchema {
|
|
76
|
+
}
|
|
77
|
+
__decorate([
|
|
78
|
+
(0, class_validator_1.IsObject)(),
|
|
79
|
+
(0, class_validator_1.ValidateNested)(),
|
|
80
|
+
(0, class_transformer_1.Type)(() => MessageContentValidationSchema),
|
|
81
|
+
__metadata("design:type", Object)
|
|
82
|
+
], MetroRunsValidationSchema.prototype, "m", void 0);
|
|
83
|
+
exports.MetroRunsValidationSchema = MetroRunsValidationSchema;
|
|
84
|
+
//# sourceMappingURL=MetroRunsSchema.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MetroRunsSchema.js","sourceRoot":"","sources":["../../../../src/integration-engine/vehicle-positions/schema/MetroRunsSchema.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,+EAQmD;AACnD,mFAAmE;AASnE,MAAM,iCAAiC;CAWtC;AARG;IAFC,IAAA,0BAAQ,GAAE;IACV,IAAA,8BAAY,EAAC,CAAC,EAAE,CAAC,CAAC;;gEACJ;AAGf;IADC,IAAA,2BAAS,EAAC,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC;;6DAChB;AAIZ;IAFC,IAAA,4BAAU,GAAE;IACZ,IAAA,0BAAQ,GAAE;;8DACE;AAGjB,MAAM,+BAA+B;CAepC;AAbG;IADC,IAAA,0BAAQ,GAAE;;4DACE;AAGb;IADC,IAAA,0BAAQ,GAAE;;4DACE;AAGb;IADC,IAAA,0BAAQ,GAAE;;2DACC;AAGZ;IADC,IAAA,0BAAQ,GAAE;;2DACC;AAGZ;IADC,IAAA,gCAAc,GAAE;;6DACH;AAGlB,MAAM,4BAA4B;CAKjC;AADG;IAHC,IAAA,0BAAQ,GAAE;IACV,IAAA,gCAAc,GAAE;IAChB,IAAA,wBAAI,EAAC,GAAG,EAAE,CAAC,+BAA+B,CAAC;;uDACd;AAGlC,MAAM,8BAA8B;CAUnC;AANG;IAHC,IAAA,0BAAQ,GAAE;IACV,IAAA,gCAAc,GAAE;IAChB,IAAA,wBAAI,EAAC,GAAG,EAAE,CAAC,iCAAiC,CAAC;;yDACd;AAKhC;IAHC,IAAA,0BAAQ,EAAC,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;IACxB,IAAA,gCAAc,GAAE;IAChB,IAAA,wBAAI,EAAC,GAAG,EAAE,CAAC,4BAA4B,CAAC;;4DACgB;AAG7D,MAAa,yBAAyB;CAKrC;AADG;IAHC,IAAA,0BAAQ,GAAE;IACV,IAAA,gCAAc,GAAE;IAChB,IAAA,wBAAI,EAAC,GAAG,EAAE,CAAC,8BAA8B,CAAC;;oDACd;AAJjC,8DAKC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export interface IMetroRunsMessageProperties {
|
|
2
|
+
linka: string;
|
|
3
|
+
tm: string;
|
|
4
|
+
gvd?: string;
|
|
5
|
+
}
|
|
6
|
+
export interface IMetroRunsTrainProperties {
|
|
7
|
+
csp: string;
|
|
8
|
+
csr: string;
|
|
9
|
+
cv: string;
|
|
10
|
+
ko: string;
|
|
11
|
+
odch: string;
|
|
12
|
+
}
|
|
13
|
+
export interface IMetroRunsTrainContent {
|
|
14
|
+
$: IMetroRunsTrainProperties;
|
|
15
|
+
}
|
|
16
|
+
export interface IMetroRunsMessageContent {
|
|
17
|
+
$: IMetroRunsMessageProperties;
|
|
18
|
+
vlak: IMetroRunsTrainContent | IMetroRunsTrainContent[];
|
|
19
|
+
}
|
|
20
|
+
export interface IMetroRunsInput {
|
|
21
|
+
m: IMetroRunsMessageContent;
|
|
22
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MetroRunsSchemaInterfaces.js","sourceRoot":"","sources":["../../../../src/integration-engine/vehicle-positions/schema/MetroRunsSchemaInterfaces.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./MetroRunsSchema"), exports);
|
|
18
|
+
__exportStar(require("./MetroRunsSchemaInterfaces"), exports);
|
|
19
|
+
__exportStar(require("./DataDeletionSchema"), exports);
|
|
20
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/integration-engine/vehicle-positions/schema/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,oDAAkC;AAClC,8DAA4C;AAC5C,uDAAqC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { MetroRunsMessagesModel } from "../../../schema-definitions/vehicle-positions/models";
|
|
2
|
+
import { IMetroRunsInput } from "../schema";
|
|
3
|
+
export declare class MetroRunsMessagesTransformation {
|
|
4
|
+
static mapToDTO: (data: IMetroRunsInput) => MetroRunsMessagesModel[];
|
|
5
|
+
private static mapItemToDTO;
|
|
6
|
+
}
|
package/dist/integration-engine/vehicle-positions/transformations/MetroRunsMessagesTransformation.js
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var _a;
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.MetroRunsMessagesTransformation = void 0;
|
|
5
|
+
class MetroRunsMessagesTransformation {
|
|
6
|
+
}
|
|
7
|
+
exports.MetroRunsMessagesTransformation = MetroRunsMessagesTransformation;
|
|
8
|
+
_a = MetroRunsMessagesTransformation;
|
|
9
|
+
MetroRunsMessagesTransformation.mapToDTO = (data) => {
|
|
10
|
+
let { $: messageData, vlak: trainData } = data.m;
|
|
11
|
+
const dto = [];
|
|
12
|
+
if (!Array.isArray(trainData)) {
|
|
13
|
+
trainData = [trainData];
|
|
14
|
+
}
|
|
15
|
+
for (const trainDataItem of trainData) {
|
|
16
|
+
const dtoItem = _a.mapItemToDTO({ messageData, trainData: trainDataItem });
|
|
17
|
+
dto.push(dtoItem);
|
|
18
|
+
}
|
|
19
|
+
return dto;
|
|
20
|
+
};
|
|
21
|
+
MetroRunsMessagesTransformation.mapItemToDTO = ({ messageData, trainData }) => {
|
|
22
|
+
const delayOrigin = parseInt(trainData.$.odch);
|
|
23
|
+
const messageTimestamp = new Date(messageData.tm).getTime();
|
|
24
|
+
// delay is in seconds, positive number means the train is ahead of time
|
|
25
|
+
const scheduledTimestamp = messageTimestamp + delayOrigin * 1000;
|
|
26
|
+
return {
|
|
27
|
+
route_name: messageData.linka,
|
|
28
|
+
message_timestamp: messageData.tm,
|
|
29
|
+
train_set_number_scheduled: trainData.$.csp.trimStart(),
|
|
30
|
+
train_set_number_real: trainData.$.csr.trimStart(),
|
|
31
|
+
train_number: trainData.$.cv,
|
|
32
|
+
track_id: trainData.$.ko,
|
|
33
|
+
delay_origin: delayOrigin,
|
|
34
|
+
actual_position_timestamp_scheduled: scheduledTimestamp,
|
|
35
|
+
};
|
|
36
|
+
};
|
|
37
|
+
//# sourceMappingURL=MetroRunsMessagesTransformation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MetroRunsMessagesTransformation.js","sourceRoot":"","sources":["../../../../src/integration-engine/vehicle-positions/transformations/MetroRunsMessagesTransformation.ts"],"names":[],"mappings":";;;;AAQA,MAAa,+BAA+B;;AAA5C,0EAkCC;;AAjCiB,wCAAQ,GAAG,CAAC,IAAqB,EAA4B,EAAE;IACzE,IAAI,EAAE,CAAC,EAAE,WAAW,EAAE,IAAI,EAAE,SAAS,EAAE,GAAG,IAAI,CAAC,CAAC,CAAC;IACjD,MAAM,GAAG,GAA6B,EAAE,CAAC;IAEzC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,SAAS,CAAC,EAAE;QAC3B,SAAS,GAAG,CAAC,SAAS,CAAC,CAAC;KAC3B;IAED,KAAK,MAAM,aAAa,IAAI,SAAS,EAAE;QACnC,MAAM,OAAO,GAAG,EAAI,CAAC,YAAY,CAAC,EAAE,WAAW,EAAE,SAAS,EAAE,aAAa,EAAE,CAAC,CAAC;QAC7E,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;KACrB;IAED,OAAO,GAAG,CAAC;AACf,CAAE,CAAA;AAEa,4CAAY,GAAG,CAAC,EAAE,WAAW,EAAE,SAAS,EAAoB,EAA0B,EAAE;IACnG,MAAM,WAAW,GAAG,QAAQ,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;IAC/C,MAAM,gBAAgB,GAAG,IAAI,IAAI,CAAC,WAAW,CAAC,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC;IAC5D,wEAAwE;IACxE,MAAM,kBAAkB,GAAG,gBAAgB,GAAG,WAAW,GAAG,IAAI,CAAC;IAEjE,OAAO;QACH,UAAU,EAAE,WAAW,CAAC,KAAK;QAC7B,iBAAiB,EAAE,WAAW,CAAC,EAAE;QACjC,0BAA0B,EAAE,SAAS,CAAC,CAAC,CAAC,GAAG,CAAC,SAAS,EAAE;QACvD,qBAAqB,EAAE,SAAS,CAAC,CAAC,CAAC,GAAG,CAAC,SAAS,EAAE;QAClD,YAAY,EAAE,SAAS,CAAC,CAAC,CAAC,EAAE;QAC5B,QAAQ,EAAE,SAAS,CAAC,CAAC,CAAC,EAAE;QACxB,YAAY,EAAE,WAAW;QACzB,mCAAmC,EAAE,kBAAkB;KAChC,CAAC;AAChC,CAAE,CAAA"}
|
|
@@ -16,4 +16,5 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./VehiclePositionsRunsTransformation"), exports);
|
|
18
18
|
__exportStar(require("./VehiclePositionsTransformation"), exports);
|
|
19
|
+
__exportStar(require("./MetroRunsMessagesTransformation"), exports);
|
|
19
20
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/integration-engine/vehicle-positions/transformations/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,uEAAqD;AACrD,mEAAiD"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/integration-engine/vehicle-positions/transformations/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,uEAAqD;AACrD,mEAAiD;AACjD,oEAAkD"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.RunsWorker = void 0;
|
|
4
|
+
const workers_1 = require("@golemio/core/dist/integration-engine/workers");
|
|
5
|
+
const vehicle_positions_1 = require("../../../../schema-definitions/vehicle-positions");
|
|
6
|
+
const SaveMetroRunsToDBTask_1 = require("./tasks/SaveMetroRunsToDBTask");
|
|
7
|
+
const DeleteDataTask_1 = require("./tasks/DeleteDataTask");
|
|
8
|
+
class RunsWorker extends workers_1.AbstractWorker {
|
|
9
|
+
constructor() {
|
|
10
|
+
super();
|
|
11
|
+
this.name = vehicle_positions_1.VehiclePositions.name + "Runs";
|
|
12
|
+
// Register tasks
|
|
13
|
+
this.registerTask(new SaveMetroRunsToDBTask_1.SaveMetroRunsToDBTask(this.getQueuePrefix()));
|
|
14
|
+
this.registerTask(new DeleteDataTask_1.DeleteDataTask(this.getQueuePrefix()));
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
exports.RunsWorker = RunsWorker;
|
|
18
|
+
//# sourceMappingURL=RunsWorker.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RunsWorker.js","sourceRoot":"","sources":["../../../../../src/integration-engine/vehicle-positions/workers/runs/RunsWorker.ts"],"names":[],"mappings":";;;AAAA,2EAA+E;AAC/E,wFAA0D;AAC1D,yEAAsE;AACtE,2DAAwD;AAExD,MAAa,UAAW,SAAQ,wBAAc;IAG1C;QACI,KAAK,EAAE,CAAC;QAHF,SAAI,GAAG,oCAAgB,CAAC,IAAI,GAAG,MAAM,CAAC;QAK5C,iBAAiB;QACjB,IAAI,CAAC,YAAY,CAAC,IAAI,6CAAqB,CAAC,IAAI,CAAC,cAAc,EAAE,CAAC,CAAC,CAAC;QACpE,IAAI,CAAC,YAAY,CAAC,IAAI,+BAAc,CAAC,IAAI,CAAC,cAAc,EAAE,CAAC,CAAC,CAAC;IACjE,CAAC;CACJ;AAVD,gCAUC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { AbstractTask } from "@golemio/core/dist/integration-engine/workers";
|
|
2
|
+
import { IDataDeletionParams, DataDeletionValidationSchema } from "../../../schema";
|
|
3
|
+
export declare class DeleteDataTask extends AbstractTask<IDataDeletionParams> {
|
|
4
|
+
readonly queueName = "deleteData";
|
|
5
|
+
readonly queueTtl: number;
|
|
6
|
+
readonly schema: typeof DataDeletionValidationSchema;
|
|
7
|
+
private readonly messagesRepository;
|
|
8
|
+
constructor(queuePrefix: string);
|
|
9
|
+
protected execute(data: IDataDeletionParams): Promise<void>;
|
|
10
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.DeleteDataTask = void 0;
|
|
13
|
+
const workers_1 = require("@golemio/core/dist/integration-engine/workers");
|
|
14
|
+
const schema_1 = require("../../../schema");
|
|
15
|
+
const data_access_1 = require("../../../data-access");
|
|
16
|
+
class DeleteDataTask extends workers_1.AbstractTask {
|
|
17
|
+
constructor(queuePrefix) {
|
|
18
|
+
super(queuePrefix);
|
|
19
|
+
this.queueName = "deleteData";
|
|
20
|
+
this.queueTtl = 1 * 60 * 60 * 1000; // 1 hour
|
|
21
|
+
this.schema = schema_1.DataDeletionValidationSchema;
|
|
22
|
+
this.messagesRepository = new data_access_1.MetroRunsMessagesRepository();
|
|
23
|
+
}
|
|
24
|
+
execute(data) {
|
|
25
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
26
|
+
yield this.messagesRepository.deleteNHoursOldData(data.targetHours);
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
exports.DeleteDataTask = DeleteDataTask;
|
|
31
|
+
//# sourceMappingURL=DeleteDataTask.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DeleteDataTask.js","sourceRoot":"","sources":["../../../../../../src/integration-engine/vehicle-positions/workers/runs/tasks/DeleteDataTask.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2EAA6E;AAC7E,4CAAiG;AACjG,sDAAgF;AAEhF,MAAa,cAAe,SAAQ,sBAAiC;IAOjE,YAAY,WAAmB;QAC3B,KAAK,CAAC,WAAW,CAAC,CAAC;QAPP,cAAS,GAAG,YAAY,CAAC;QACzB,aAAQ,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC,CAAC,SAAS;QACxC,WAAM,GAAG,qCAA4B,CAAC;QAMlD,IAAI,CAAC,kBAAkB,GAAG,IAAI,yCAA2B,EAAE,CAAC;IAChE,CAAC;IAEe,OAAO,CAAC,IAAyB;;YAC7C,MAAM,IAAI,CAAC,kBAAkB,CAAC,mBAAmB,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;QACxE,CAAC;KAAA;CACJ;AAfD,wCAeC"}
|
package/dist/integration-engine/vehicle-positions/workers/runs/tasks/SaveMetroRunsToDBTask.d.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { AbstractTask } from "@golemio/core/dist/integration-engine/workers";
|
|
2
|
+
import { IMetroRunsInput, MetroRunsValidationSchema } from "../../../schema";
|
|
3
|
+
export declare class SaveMetroRunsToDBTask extends AbstractTask<IMetroRunsInput> {
|
|
4
|
+
readonly queueName = "saveMetroRunsToDB";
|
|
5
|
+
readonly queueTtl: number;
|
|
6
|
+
readonly schema: typeof MetroRunsValidationSchema;
|
|
7
|
+
private readonly messagesRepository;
|
|
8
|
+
constructor(queuePrefix: string);
|
|
9
|
+
protected execute(data: IMetroRunsInput): Promise<void>;
|
|
10
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.SaveMetroRunsToDBTask = void 0;
|
|
13
|
+
const workers_1 = require("@golemio/core/dist/integration-engine/workers");
|
|
14
|
+
const schema_1 = require("../../../schema");
|
|
15
|
+
const transformations_1 = require("../../../transformations");
|
|
16
|
+
const data_access_1 = require("../../../data-access");
|
|
17
|
+
class SaveMetroRunsToDBTask extends workers_1.AbstractTask {
|
|
18
|
+
constructor(queuePrefix) {
|
|
19
|
+
super(queuePrefix);
|
|
20
|
+
this.queueName = "saveMetroRunsToDB";
|
|
21
|
+
this.queueTtl = 3 * 60 * 1000; // 3 minutes
|
|
22
|
+
this.schema = schema_1.MetroRunsValidationSchema;
|
|
23
|
+
this.messagesRepository = new data_access_1.MetroRunsMessagesRepository();
|
|
24
|
+
}
|
|
25
|
+
execute(data) {
|
|
26
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
27
|
+
const messages = transformations_1.MetroRunsMessagesTransformation.mapToDTO(data);
|
|
28
|
+
yield this.messagesRepository.saveData(messages);
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
exports.SaveMetroRunsToDBTask = SaveMetroRunsToDBTask;
|
|
33
|
+
//# sourceMappingURL=SaveMetroRunsToDBTask.js.map
|
package/dist/integration-engine/vehicle-positions/workers/runs/tasks/SaveMetroRunsToDBTask.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SaveMetroRunsToDBTask.js","sourceRoot":"","sources":["../../../../../../src/integration-engine/vehicle-positions/workers/runs/tasks/SaveMetroRunsToDBTask.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2EAA6E;AAC7E,4CAA0F;AAC1F,8DAAwF;AACxF,sDAAgF;AAEhF,MAAa,qBAAsB,SAAQ,sBAA6B;IAOpE,YAAY,WAAmB;QAC3B,KAAK,CAAC,WAAW,CAAC,CAAC;QAPP,cAAS,GAAG,mBAAmB,CAAC;QAChC,aAAQ,GAAG,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC,CAAC,YAAY;QACtC,WAAM,GAAG,kCAAyB,CAAC;QAM/C,IAAI,CAAC,kBAAkB,GAAG,IAAI,yCAA2B,EAAE,CAAC;IAChE,CAAC;IAEe,OAAO,CAAC,IAAqB;;YACzC,MAAM,QAAQ,GAAG,iDAA+B,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;YAChE,MAAM,IAAI,CAAC,kBAAkB,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;QACrD,CAAC;KAAA;CACJ;AAhBD,sDAgBC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Model, ModelAttributes } from "@golemio/core/dist/shared/sequelize";
|
|
2
|
+
import { JSONSchemaType } from "@golemio/core/dist/shared/ajv";
|
|
3
|
+
import { IMetroRunsMessagesModel } from "./interfaces/IMetroRunsMessagesModel";
|
|
4
|
+
export declare class MetroRunsMessagesModel extends Model<MetroRunsMessagesModel> implements IMetroRunsMessagesModel {
|
|
5
|
+
static TABLE_NAME: string;
|
|
6
|
+
id: string;
|
|
7
|
+
route_name: string;
|
|
8
|
+
message_timestamp: string;
|
|
9
|
+
train_set_number_scheduled: string;
|
|
10
|
+
train_set_number_real: string;
|
|
11
|
+
train_number: string;
|
|
12
|
+
track_id: string;
|
|
13
|
+
delay_origin: number;
|
|
14
|
+
actual_position_timestamp_scheduled: number;
|
|
15
|
+
static attributeModel: ModelAttributes<MetroRunsMessagesModel>;
|
|
16
|
+
static arrayJsonSchema: JSONSchemaType<IMetroRunsMessagesModel[]>;
|
|
17
|
+
}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MetroRunsMessagesModel = void 0;
|
|
4
|
+
const sequelize_1 = require("@golemio/core/dist/shared/sequelize");
|
|
5
|
+
class MetroRunsMessagesModel extends sequelize_1.Model {
|
|
6
|
+
}
|
|
7
|
+
exports.MetroRunsMessagesModel = MetroRunsMessagesModel;
|
|
8
|
+
MetroRunsMessagesModel.TABLE_NAME = "vehiclepositions_metro_runs_messages";
|
|
9
|
+
MetroRunsMessagesModel.attributeModel = {
|
|
10
|
+
id: {
|
|
11
|
+
type: sequelize_1.DataTypes.INTEGER,
|
|
12
|
+
primaryKey: true,
|
|
13
|
+
autoIncrement: true,
|
|
14
|
+
},
|
|
15
|
+
route_name: {
|
|
16
|
+
type: sequelize_1.DataTypes.CHAR(1),
|
|
17
|
+
allowNull: false,
|
|
18
|
+
},
|
|
19
|
+
message_timestamp: {
|
|
20
|
+
type: sequelize_1.DataTypes.DATE,
|
|
21
|
+
allowNull: false,
|
|
22
|
+
},
|
|
23
|
+
train_set_number_scheduled: {
|
|
24
|
+
type: sequelize_1.DataTypes.STRING(15),
|
|
25
|
+
allowNull: false,
|
|
26
|
+
},
|
|
27
|
+
train_set_number_real: {
|
|
28
|
+
type: sequelize_1.DataTypes.STRING(15),
|
|
29
|
+
allowNull: false,
|
|
30
|
+
},
|
|
31
|
+
train_number: {
|
|
32
|
+
type: sequelize_1.DataTypes.STRING(15),
|
|
33
|
+
allowNull: false,
|
|
34
|
+
},
|
|
35
|
+
track_id: {
|
|
36
|
+
type: sequelize_1.DataTypes.STRING(15),
|
|
37
|
+
allowNull: false,
|
|
38
|
+
},
|
|
39
|
+
delay_origin: {
|
|
40
|
+
type: sequelize_1.DataTypes.SMALLINT,
|
|
41
|
+
allowNull: false,
|
|
42
|
+
},
|
|
43
|
+
actual_position_timestamp_scheduled: {
|
|
44
|
+
type: sequelize_1.DataTypes.DATE,
|
|
45
|
+
allowNull: false,
|
|
46
|
+
},
|
|
47
|
+
};
|
|
48
|
+
MetroRunsMessagesModel.arrayJsonSchema = {
|
|
49
|
+
type: "array",
|
|
50
|
+
items: {
|
|
51
|
+
type: "object",
|
|
52
|
+
properties: {
|
|
53
|
+
route_name: {
|
|
54
|
+
type: "string",
|
|
55
|
+
},
|
|
56
|
+
message_timestamp: {
|
|
57
|
+
type: "string",
|
|
58
|
+
},
|
|
59
|
+
train_set_number_scheduled: {
|
|
60
|
+
type: "string",
|
|
61
|
+
},
|
|
62
|
+
train_set_number_real: {
|
|
63
|
+
type: "string",
|
|
64
|
+
},
|
|
65
|
+
train_number: {
|
|
66
|
+
type: "string",
|
|
67
|
+
},
|
|
68
|
+
track_id: {
|
|
69
|
+
type: "string",
|
|
70
|
+
},
|
|
71
|
+
delay_origin: {
|
|
72
|
+
type: "integer",
|
|
73
|
+
},
|
|
74
|
+
actual_position_timestamp_scheduled: {
|
|
75
|
+
type: "number",
|
|
76
|
+
},
|
|
77
|
+
},
|
|
78
|
+
required: [
|
|
79
|
+
"route_name",
|
|
80
|
+
"message_timestamp",
|
|
81
|
+
"train_set_number_scheduled",
|
|
82
|
+
"train_set_number_real",
|
|
83
|
+
"train_number",
|
|
84
|
+
"track_id",
|
|
85
|
+
"delay_origin",
|
|
86
|
+
"actual_position_timestamp_scheduled",
|
|
87
|
+
],
|
|
88
|
+
},
|
|
89
|
+
};
|
|
90
|
+
//# sourceMappingURL=MetroRunsMessagesModel.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MetroRunsMessagesModel.js","sourceRoot":"","sources":["../../../../src/schema-definitions/vehicle-positions/models/MetroRunsMessagesModel.ts"],"names":[],"mappings":";;;AAAA,mEAAwF;AAIxF,MAAa,sBAAuB,SAAQ,iBAA6B;;AAAzE,wDA+FC;AA9FiB,iCAAU,GAAG,sCAAsC,CAAC;AAYpD,qCAAc,GAA4C;IACpE,EAAE,EAAE;QACA,IAAI,EAAE,qBAAS,CAAC,OAAO;QACvB,UAAU,EAAE,IAAI;QAChB,aAAa,EAAE,IAAI;KACtB;IACD,UAAU,EAAE;QACR,IAAI,EAAE,qBAAS,CAAC,IAAI,CAAC,CAAC,CAAC;QACvB,SAAS,EAAE,KAAK;KACnB;IACD,iBAAiB,EAAE;QACf,IAAI,EAAE,qBAAS,CAAC,IAAI;QACpB,SAAS,EAAE,KAAK;KACnB;IACD,0BAA0B,EAAE;QACxB,IAAI,EAAE,qBAAS,CAAC,MAAM,CAAC,EAAE,CAAC;QAC1B,SAAS,EAAE,KAAK;KACnB;IACD,qBAAqB,EAAE;QACnB,IAAI,EAAE,qBAAS,CAAC,MAAM,CAAC,EAAE,CAAC;QAC1B,SAAS,EAAE,KAAK;KACnB;IACD,YAAY,EAAE;QACV,IAAI,EAAE,qBAAS,CAAC,MAAM,CAAC,EAAE,CAAC;QAC1B,SAAS,EAAE,KAAK;KACnB;IACD,QAAQ,EAAE;QACN,IAAI,EAAE,qBAAS,CAAC,MAAM,CAAC,EAAE,CAAC;QAC1B,SAAS,EAAE,KAAK;KACnB;IACD,YAAY,EAAE;QACV,IAAI,EAAE,qBAAS,CAAC,QAAQ;QACxB,SAAS,EAAE,KAAK;KACnB;IACD,mCAAmC,EAAE;QACjC,IAAI,EAAE,qBAAS,CAAC,IAAI;QACpB,SAAS,EAAE,KAAK;KACnB;CACJ,CAAC;AAEY,sCAAe,GAA8C;IACvE,IAAI,EAAE,OAAO;IACb,KAAK,EAAE;QACH,IAAI,EAAE,QAAQ;QACd,UAAU,EAAE;YACR,UAAU,EAAE;gBACR,IAAI,EAAE,QAAQ;aACjB;YACD,iBAAiB,EAAE;gBACf,IAAI,EAAE,QAAQ;aACjB;YACD,0BAA0B,EAAE;gBACxB,IAAI,EAAE,QAAQ;aACjB;YACD,qBAAqB,EAAE;gBACnB,IAAI,EAAE,QAAQ;aACjB;YACD,YAAY,EAAE;gBACV,IAAI,EAAE,QAAQ;aACjB;YACD,QAAQ,EAAE;gBACN,IAAI,EAAE,QAAQ;aACjB;YACD,YAAY,EAAE;gBACV,IAAI,EAAE,SAAS;aAClB;YACD,mCAAmC,EAAE;gBACjC,IAAI,EAAE,QAAQ;aACjB;SACJ;QACD,QAAQ,EAAE;YACN,YAAY;YACZ,mBAAmB;YACnB,4BAA4B;YAC5B,uBAAuB;YACvB,cAAc;YACd,UAAU;YACV,cAAc;YACd,qCAAqC;SACxC;KACJ;CACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./MetroRunsMessagesModel";
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./MetroRunsMessagesModel"), exports);
|
|
18
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/schema-definitions/vehicle-positions/models/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2DAAyC"}
|
package/dist/schema-definitions/vehicle-positions/models/interfaces/IMetroRunsMessagesModel.d.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export interface IMetroRunsMessagesModel {
|
|
2
|
+
route_name: string;
|
|
3
|
+
message_timestamp: string;
|
|
4
|
+
train_set_number_scheduled: string;
|
|
5
|
+
train_set_number_real: string;
|
|
6
|
+
train_number: string;
|
|
7
|
+
track_id: string;
|
|
8
|
+
delay_origin: number;
|
|
9
|
+
actual_position_timestamp_scheduled: number;
|
|
10
|
+
}
|
package/dist/schema-definitions/vehicle-positions/models/interfaces/IMetroRunsMessagesModel.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IMetroRunsMessagesModel.js","sourceRoot":"","sources":["../../../../../src/schema-definitions/vehicle-positions/models/interfaces/IMetroRunsMessagesModel.ts"],"names":[],"mappings":""}
|