@golemio/pid 5.9.1 → 5.9.2-dev.2487723561
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/migrations/postgresql/20260428091015-jis-infotexts-presets.js +49 -0
- package/db/migrations/postgresql/sqls/20260428091015-jis-infotexts-presets-down.sql +2 -0
- package/db/migrations/postgresql/sqls/20260428091015-jis-infotexts-presets-up.sql +8 -0
- package/dist/integration-engine/jis/ioc/Di.js +2 -0
- package/dist/integration-engine/jis/ioc/Di.js.map +1 -1
- package/dist/integration-engine/jis/ioc/JISContainerToken.d.ts +1 -0
- package/dist/integration-engine/jis/ioc/JISContainerToken.js +1 -0
- package/dist/integration-engine/jis/ioc/JISContainerToken.js.map +1 -1
- package/dist/integration-engine/jis/repositories/JISInfotextsPresetsRepository.d.ts +32 -0
- package/dist/integration-engine/jis/repositories/JISInfotextsPresetsRepository.js +89 -0
- package/dist/integration-engine/jis/repositories/JISInfotextsPresetsRepository.js.map +1 -0
- package/dist/integration-engine/jis/repositories/JISInfotextsRepository.d.ts +3 -1
- package/dist/integration-engine/jis/repositories/JISInfotextsRepository.js +15 -2
- package/dist/integration-engine/jis/repositories/JISInfotextsRepository.js.map +1 -1
- package/dist/integration-engine/jis/repositories/JISInfotextsRopidGTFSStopsRepository.d.ts +6 -15
- package/dist/integration-engine/jis/repositories/JISInfotextsRopidGTFSStopsRepository.js +12 -20
- package/dist/integration-engine/jis/repositories/JISInfotextsRopidGTFSStopsRepository.js.map +1 -1
- package/dist/integration-engine/jis/services/JISInfotextsDataService.d.ts +7 -8
- package/dist/integration-engine/jis/services/JISInfotextsDataService.js +17 -12
- package/dist/integration-engine/jis/services/JISInfotextsDataService.js.map +1 -1
- package/dist/integration-engine/jis/transformations/JISInfotextsTransformation.d.ts +2 -1
- package/dist/integration-engine/jis/transformations/JISInfotextsTransformation.js +5 -0
- package/dist/integration-engine/jis/transformations/JISInfotextsTransformation.js.map +1 -1
- package/dist/integration-engine/jis/workers/tasks/RefreshJISInfotextsTask.js +8 -4
- package/dist/integration-engine/jis/workers/tasks/RefreshJISInfotextsTask.js.map +1 -1
- package/dist/output-gateway/pid/helpers/JISInfotextStopSuppressionFilter.d.ts +23 -3
- package/dist/output-gateway/pid/helpers/JISInfotextStopSuppressionFilter.js +227 -43
- package/dist/output-gateway/pid/helpers/JISInfotextStopSuppressionFilter.js.map +1 -1
- package/dist/output-gateway/pid/service/facade/InfotextFacade.d.ts +1 -1
- package/dist/output-gateway/pid/service/facade/InfotextFacade.js +3 -3
- package/dist/output-gateway/pid/service/facade/InfotextFacade.js.map +1 -1
- package/dist/schema-definitions/jis/datasources/JISInfotextsJsonSchema.js +12 -0
- package/dist/schema-definitions/jis/datasources/JISInfotextsJsonSchema.js.map +1 -1
- package/dist/schema-definitions/jis/datasources/interfaces/IJISInfotext.d.ts +2 -0
- package/dist/schema-definitions/jis/datasources/interfaces/IJISInfotextPreset.d.ts +3 -0
- package/dist/schema-definitions/jis/datasources/interfaces/IJISInfotextPreset.js +3 -0
- package/dist/schema-definitions/jis/datasources/interfaces/IJISInfotextPreset.js.map +1 -0
- package/dist/schema-definitions/jis/datasources/interfaces/index.d.ts +1 -0
- package/dist/schema-definitions/jis/datasources/interfaces/index.js +1 -0
- package/dist/schema-definitions/jis/datasources/interfaces/index.js.map +1 -1
- package/dist/schema-definitions/jis/models/JISInfotextsModel.d.ts +2 -0
- package/dist/schema-definitions/jis/models/JISInfotextsModel.js.map +1 -1
- package/dist/schema-definitions/jis/models/JISInfotextsPresetsModel.d.ts +12 -0
- package/dist/schema-definitions/jis/models/JISInfotextsPresetsModel.js +41 -0
- package/dist/schema-definitions/jis/models/JISInfotextsPresetsModel.js.map +1 -0
- package/dist/schema-definitions/jis/models/interfaces/IJISInfotextsPresets.d.ts +4 -0
- package/dist/schema-definitions/jis/models/interfaces/IJISInfotextsPresets.js +3 -0
- package/dist/schema-definitions/jis/models/interfaces/IJISInfotextsPresets.js.map +1 -0
- package/dist/schema-definitions/jis/models/interfaces/index.d.ts +1 -0
- package/dist/schema-definitions/jis/models/interfaces/index.js +1 -0
- package/dist/schema-definitions/jis/models/interfaces/index.js.map +1 -1
- package/docs/asyncapi.yaml +16 -5
- package/docs/openapi-input.yaml +14 -3
- package/package.json +7 -7
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var dbm;
|
|
4
|
+
var type;
|
|
5
|
+
var seed;
|
|
6
|
+
var fs = require('fs');
|
|
7
|
+
var path = require('path');
|
|
8
|
+
var Promise;
|
|
9
|
+
|
|
10
|
+
exports.setup = function(options, seedLink) {
|
|
11
|
+
dbm = options.dbmigrate;
|
|
12
|
+
type = dbm.dataType;
|
|
13
|
+
seed = seedLink;
|
|
14
|
+
Promise = options.Promise;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
exports.up = function(db) {
|
|
18
|
+
var filePath = path.join(__dirname, 'sqls', '20260428091015-jis-infotexts-presets-up.sql');
|
|
19
|
+
return new Promise( function( resolve, reject ) {
|
|
20
|
+
fs.readFile(filePath, {encoding: 'utf-8'}, function(err,data){
|
|
21
|
+
if (err) return reject(err);
|
|
22
|
+
console.log('received data: ' + data);
|
|
23
|
+
|
|
24
|
+
resolve(data);
|
|
25
|
+
});
|
|
26
|
+
})
|
|
27
|
+
.then(function(data) {
|
|
28
|
+
return db.runSql(data);
|
|
29
|
+
});
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
exports.down = function(db) {
|
|
33
|
+
var filePath = path.join(__dirname, 'sqls', '20260428091015-jis-infotexts-presets-down.sql');
|
|
34
|
+
return new Promise( function( resolve, reject ) {
|
|
35
|
+
fs.readFile(filePath, {encoding: 'utf-8'}, function(err,data){
|
|
36
|
+
if (err) return reject(err);
|
|
37
|
+
console.log('received data: ' + data);
|
|
38
|
+
|
|
39
|
+
resolve(data);
|
|
40
|
+
});
|
|
41
|
+
})
|
|
42
|
+
.then(function(data) {
|
|
43
|
+
return db.runSql(data);
|
|
44
|
+
});
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
exports._meta = {
|
|
48
|
+
"version": 1
|
|
49
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
create table jis_infotexts_presets (
|
|
2
|
+
infotext_id uuid not null,
|
|
3
|
+
route_name varchar(100) not null,
|
|
4
|
+
created_at timestamptz not null,
|
|
5
|
+
updated_at timestamptz not null,
|
|
6
|
+
constraint jis_infotexts_presets_pk primary key (infotext_id, route_name)
|
|
7
|
+
);
|
|
8
|
+
create index jis_infotexts_presets_route_name_idx on jis_infotexts_presets (route_name);
|
|
@@ -8,6 +8,7 @@ const JISInfotextsDataSourceFactory_1 = require("../datasources/JISInfotextsData
|
|
|
8
8
|
const JISEventsRepository_1 = require("../repositories/JISEventsRepository");
|
|
9
9
|
const JISEventsRopidGTFSRoutesRepository_1 = require("../repositories/JISEventsRopidGTFSRoutesRepository");
|
|
10
10
|
const JISInfotextsRedisRepository_1 = require("../repositories/JISInfotextsRedisRepository");
|
|
11
|
+
const JISInfotextsPresetsRepository_1 = require("../repositories/JISInfotextsPresetsRepository");
|
|
11
12
|
const JISInfotextsRepository_1 = require("../repositories/JISInfotextsRepository");
|
|
12
13
|
const JISInfotextsRopidGTFSStopsRepository_1 = require("../repositories/JISInfotextsRopidGTFSStopsRepository");
|
|
13
14
|
const JISMetadataRepository_1 = require("../repositories/JISMetadataRepository");
|
|
@@ -42,6 +43,7 @@ JISContainer.registerSingleton(JISContainerToken_1.JISContainerToken.JISEventsRe
|
|
|
42
43
|
JISContainer.registerSingleton(JISContainerToken_1.JISContainerToken.JISEventsRopidGTFSRoutesRepository, JISEventsRopidGTFSRoutesRepository_1.JISEventsRopidGTFSRoutesRepository);
|
|
43
44
|
JISContainer.registerSingleton(JISContainerToken_1.JISContainerToken.JISInfotextsRepository, JISInfotextsRepository_1.JISInfotextsRepository);
|
|
44
45
|
JISContainer.registerSingleton(JISContainerToken_1.JISContainerToken.JISInfotextsRopidGTFSStopsRepository, JISInfotextsRopidGTFSStopsRepository_1.JISInfotextsRopidGTFSStopsRepository);
|
|
46
|
+
JISContainer.registerSingleton(JISContainerToken_1.JISContainerToken.JISInfotextsPresetsRepository, JISInfotextsPresetsRepository_1.JISInfotextsPresetsRepository);
|
|
45
47
|
JISContainer.registerSingleton(JISContainerToken_1.JISContainerToken.JISMetadataRepository, JISMetadataRepository_1.JISMetadataRepository);
|
|
46
48
|
JISContainer.registerSingleton(JISContainerToken_1.JISContainerToken.RopidGTFSStopsRepository, RopidGTFSStopsModel_1.RopidGTFSStopsModel);
|
|
47
49
|
JISContainer.registerSingleton(JISContainerToken_1.JISContainerToken.RopidGTFSRoutesRepository, RopidGTFSRoutesRepository_1.RopidGTFSRoutesRepository);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Di.js","sourceRoot":"","sources":["../../../../src/integration-engine/jis/ioc/Di.ts"],"names":[],"mappings":";;;AAAA,qCAA0C;AAC1C,8EAAyE;AAEzE,0FAAuF;AACvF,gGAA6F;AAC7F,6EAA0E;AAC1E,2GAAwG;AACxG,6FAA0F;AAC1F,mFAAgF;AAChF,+GAA4G;AAC5G,iFAA8E;AAC9E,2EAAwE;AACxE,iFAA8E;AAC9E,oGAAiG;AACjG,wFAAqF;AACrF,oGAAiG;AACjG,8FAA2F;AAC3F,0GAAuG;AACvG,4EAAyE;AACzE,kFAA+E;AAC/E,gFAA6E;AAC7E,gGAA6F;AAC7F,sFAAmF;AACnF,oFAAiF;AACjF,2DAAwD;AACxD,sGAAiG;AAEjG,wBAAwB;AACxB,MAAM,YAAY,GAAwB,iBAAY,CAAC,oBAAoB,EAAE,CAAC;
|
|
1
|
+
{"version":3,"file":"Di.js","sourceRoot":"","sources":["../../../../src/integration-engine/jis/ioc/Di.ts"],"names":[],"mappings":";;;AAAA,qCAA0C;AAC1C,8EAAyE;AAEzE,0FAAuF;AACvF,gGAA6F;AAC7F,6EAA0E;AAC1E,2GAAwG;AACxG,6FA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AiB,CAAC,qCAAiB,CAAC,gCAAgC,EAAE,mEAAgC,CAAC,CAAC"}
|
|
@@ -6,6 +6,7 @@ declare const JISContainerToken: {
|
|
|
6
6
|
JISEventsRopidGTFSRoutesRepository: symbol;
|
|
7
7
|
JISInfotextsRepository: symbol;
|
|
8
8
|
JISInfotextsRopidGTFSStopsRepository: symbol;
|
|
9
|
+
JISInfotextsPresetsRepository: symbol;
|
|
9
10
|
JISMetadataRepository: symbol;
|
|
10
11
|
RopidGTFSStopsRepository: symbol;
|
|
11
12
|
RopidGTFSRoutesRepository: symbol;
|
|
@@ -12,6 +12,7 @@ const JISContainerToken = {
|
|
|
12
12
|
JISEventsRopidGTFSRoutesRepository: Symbol("JISEventsRopidGTFSRoutesRepository"),
|
|
13
13
|
JISInfotextsRepository: Symbol("JISInfotextsRepository"),
|
|
14
14
|
JISInfotextsRopidGTFSStopsRepository: Symbol("JISInfotextsRopidGTFSStopsRepository"),
|
|
15
|
+
JISInfotextsPresetsRepository: Symbol("JISInfotextsPresetsRepository"),
|
|
15
16
|
JISMetadataRepository: Symbol("JISMetadataRepository"),
|
|
16
17
|
RopidGTFSStopsRepository: Symbol("RopidGTFSStopsRepository"),
|
|
17
18
|
RopidGTFSRoutesRepository: Symbol("RopidGTFSRoutesRepository"),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"JISContainerToken.js","sourceRoot":"","sources":["../../../../src/integration-engine/jis/ioc/JISContainerToken.ts"],"names":[],"mappings":";;;AAAA,MAAM,iBAAiB,GAAG;IACtB,kBAAkB;IAClB,0BAA0B,EAAE,MAAM,CAAC,4BAA4B,CAAC;IAChE,6BAA6B,EAAE,MAAM,CAAC,+BAA+B,CAAC;IACtE,wBAAwB;IACxB,2BAA2B,EAAE,MAAM,CAAC,6BAA6B,CAAC;IAClE,kBAAkB;IAClB,mBAAmB,EAAE,MAAM,CAAC,qBAAqB,CAAC;IAClD,kCAAkC,EAAE,MAAM,CAAC,oCAAoC,CAAC;IAChF,sBAAsB,EAAE,MAAM,CAAC,wBAAwB,CAAC;IACxD,oCAAoC,EAAE,MAAM,CAAC,sCAAsC,CAAC;IACpF,qBAAqB,EAAE,MAAM,CAAC,uBAAuB,CAAC;IACtD,wBAAwB,EAAE,MAAM,CAAC,0BAA0B,CAAC;IAC5D,yBAAyB,EAAE,MAAM,CAAC,2BAA2B,CAAC;IAC9D,cAAc;IACd,oBAAoB,EAAE,MAAM,CAAC,sBAAsB,CAAC;IACpD,uBAAuB,EAAE,MAAM,CAAC,yBAAyB,CAAC;IAC1D,qBAAqB;IACrB,uBAAuB,EAAE,MAAM,CAAC,yBAAyB,CAAC;IAC1D,6BAA6B,EAAE,MAAM,CAAC,+BAA+B,CAAC;IACtE,0BAA0B,EAAE,MAAM,CAAC,4BAA4B,CAAC;IAChE,6BAA6B,EAAE,MAAM,CAAC,+BAA+B,CAAC;IACtE,gCAAgC,EAAE,MAAM,CAAC,kCAAkC,CAAC;IAC5E,WAAW;IACX,kBAAkB,EAAE,MAAM,CAAC,oBAAoB,CAAC;IAChD,qBAAqB,EAAE,MAAM,CAAC,uBAAuB,CAAC;IACtD,oBAAoB,EAAE,MAAM,CAAC,sBAAsB,CAAC;IACpD,uBAAuB,EAAE,MAAM,CAAC,yBAAyB,CAAC;IAC1D,4BAA4B,EAAE,MAAM,CAAC,8BAA8B,CAAC;IACpE,sBAAsB,EAAE,MAAM,CAAC,wBAAwB,CAAC;CAC3D,CAAC;AAEO,8CAAiB"}
|
|
1
|
+
{"version":3,"file":"JISContainerToken.js","sourceRoot":"","sources":["../../../../src/integration-engine/jis/ioc/JISContainerToken.ts"],"names":[],"mappings":";;;AAAA,MAAM,iBAAiB,GAAG;IACtB,kBAAkB;IAClB,0BAA0B,EAAE,MAAM,CAAC,4BAA4B,CAAC;IAChE,6BAA6B,EAAE,MAAM,CAAC,+BAA+B,CAAC;IACtE,wBAAwB;IACxB,2BAA2B,EAAE,MAAM,CAAC,6BAA6B,CAAC;IAClE,kBAAkB;IAClB,mBAAmB,EAAE,MAAM,CAAC,qBAAqB,CAAC;IAClD,kCAAkC,EAAE,MAAM,CAAC,oCAAoC,CAAC;IAChF,sBAAsB,EAAE,MAAM,CAAC,wBAAwB,CAAC;IACxD,oCAAoC,EAAE,MAAM,CAAC,sCAAsC,CAAC;IACpF,6BAA6B,EAAE,MAAM,CAAC,+BAA+B,CAAC;IACtE,qBAAqB,EAAE,MAAM,CAAC,uBAAuB,CAAC;IACtD,wBAAwB,EAAE,MAAM,CAAC,0BAA0B,CAAC;IAC5D,yBAAyB,EAAE,MAAM,CAAC,2BAA2B,CAAC;IAC9D,cAAc;IACd,oBAAoB,EAAE,MAAM,CAAC,sBAAsB,CAAC;IACpD,uBAAuB,EAAE,MAAM,CAAC,yBAAyB,CAAC;IAC1D,qBAAqB;IACrB,uBAAuB,EAAE,MAAM,CAAC,yBAAyB,CAAC;IAC1D,6BAA6B,EAAE,MAAM,CAAC,+BAA+B,CAAC;IACtE,0BAA0B,EAAE,MAAM,CAAC,4BAA4B,CAAC;IAChE,6BAA6B,EAAE,MAAM,CAAC,+BAA+B,CAAC;IACtE,gCAAgC,EAAE,MAAM,CAAC,kCAAkC,CAAC;IAC5E,WAAW;IACX,kBAAkB,EAAE,MAAM,CAAC,oBAAoB,CAAC;IAChD,qBAAqB,EAAE,MAAM,CAAC,uBAAuB,CAAC;IACtD,oBAAoB,EAAE,MAAM,CAAC,sBAAsB,CAAC;IACpD,uBAAuB,EAAE,MAAM,CAAC,yBAAyB,CAAC;IAC1D,4BAA4B,EAAE,MAAM,CAAC,8BAA8B,CAAC;IACpE,sBAAsB,EAAE,MAAM,CAAC,wBAAwB,CAAC;CAC3D,CAAC;AAEO,8CAAiB"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { JISInfotextsPresetsModel } from "../../../schema-definitions/jis/models/JISInfotextsPresetsModel";
|
|
2
|
+
import { IJISInfotextsPresets } from "../../../schema-definitions/jis/models/interfaces";
|
|
3
|
+
import { ILogger } from "@golemio/core/dist/helpers";
|
|
4
|
+
import { IDatabaseConnector } from "@golemio/core/dist/helpers/data-access/postgres/IDatabaseConnector";
|
|
5
|
+
import { AbstractValidatableRepository } from "@golemio/core/dist/helpers/data-access/postgres/repositories/AbstractValidatableRepository";
|
|
6
|
+
import { JSONSchemaValidator } from "@golemio/core/dist/shared/golemio-validator";
|
|
7
|
+
import { ModelStatic, Transaction } from "@golemio/core/dist/shared/sequelize";
|
|
8
|
+
type RepositoryOptions = {
|
|
9
|
+
transaction?: Transaction;
|
|
10
|
+
};
|
|
11
|
+
export declare class JISInfotextsPresetsRepository extends AbstractValidatableRepository {
|
|
12
|
+
validator: JSONSchemaValidator;
|
|
13
|
+
schema: string;
|
|
14
|
+
tableName: string;
|
|
15
|
+
private sequelizeModel;
|
|
16
|
+
constructor(connector: IDatabaseConnector, logger: ILogger);
|
|
17
|
+
/**
|
|
18
|
+
* Inserts new rows or updates existing ones. On conflict, all columns except `created_at` are overwritten —
|
|
19
|
+
* `created_at` is intentionally preserved to track when a row was first seen, while `updated_at` advances
|
|
20
|
+
* each cycle so stale-record cleanup can identify entries missing from the latest feed.
|
|
21
|
+
*/
|
|
22
|
+
upsertAll(data: IJISInfotextsPresets[], options?: RepositoryOptions): ReturnType<ModelStatic<JISInfotextsPresetsModel>["bulkCreate"]>;
|
|
23
|
+
/**
|
|
24
|
+
* Removes rows that were not touched during the current refresh cycle — any row whose `updated_at`
|
|
25
|
+
* predates `dateTime` was absent from the latest feed and is considered stale.
|
|
26
|
+
* Call this after `upsertAll` with the timestamp captured at the start of the save to clean up vanished entries.
|
|
27
|
+
*/
|
|
28
|
+
deleteAllLastUpdatedBefore(dateTime: Date, options?: RepositoryOptions): Promise<number>;
|
|
29
|
+
deleteAll(options?: RepositoryOptions): Promise<number>;
|
|
30
|
+
private getUpdateAttributes;
|
|
31
|
+
}
|
|
32
|
+
export {};
|
|
@@ -0,0 +1,89 @@
|
|
|
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
|
+
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
12
|
+
return function (target, key) { decorator(target, key, paramIndex); }
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.JISInfotextsPresetsRepository = void 0;
|
|
16
|
+
const const_1 = require("../../../schema-definitions/const");
|
|
17
|
+
const JISInfotextsPresetsModel_1 = require("../../../schema-definitions/jis/models/JISInfotextsPresetsModel");
|
|
18
|
+
const AbstractValidatableRepository_1 = require("@golemio/core/dist/helpers/data-access/postgres/repositories/AbstractValidatableRepository");
|
|
19
|
+
const CoreToken_1 = require("@golemio/core/dist/helpers/ioc/CoreToken");
|
|
20
|
+
const golemio_validator_1 = require("@golemio/core/dist/shared/golemio-validator");
|
|
21
|
+
const sequelize_1 = require("@golemio/core/dist/shared/sequelize");
|
|
22
|
+
const tsyringe_1 = require("@golemio/core/dist/shared/tsyringe");
|
|
23
|
+
const RepositoryUtils_1 = require("../../shared/RepositoryUtils");
|
|
24
|
+
let JISInfotextsPresetsRepository = class JISInfotextsPresetsRepository extends AbstractValidatableRepository_1.AbstractValidatableRepository {
|
|
25
|
+
constructor(connector, logger) {
|
|
26
|
+
super(connector, logger);
|
|
27
|
+
this.schema = const_1.PG_SCHEMA;
|
|
28
|
+
this.tableName = JISInfotextsPresetsModel_1.JISInfotextsPresetsModel.tableName;
|
|
29
|
+
this.validator = new golemio_validator_1.JSONSchemaValidator("JISInfotextsPresetsRepository", JISInfotextsPresetsModel_1.JISInfotextsPresetsModel.jsonSchema);
|
|
30
|
+
this.sequelizeModel = connector
|
|
31
|
+
.getConnection()
|
|
32
|
+
.define(this.tableName, JISInfotextsPresetsModel_1.JISInfotextsPresetsModel.attributeModel, { schema: this.schema });
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Inserts new rows or updates existing ones. On conflict, all columns except `created_at` are overwritten —
|
|
36
|
+
* `created_at` is intentionally preserved to track when a row was first seen, while `updated_at` advances
|
|
37
|
+
* each cycle so stale-record cleanup can identify entries missing from the latest feed.
|
|
38
|
+
*/
|
|
39
|
+
async upsertAll(data, options) {
|
|
40
|
+
try {
|
|
41
|
+
return await this.sequelizeModel.bulkCreate(data, {
|
|
42
|
+
updateOnDuplicate: this.getUpdateAttributes(),
|
|
43
|
+
transaction: options?.transaction,
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
catch (err) {
|
|
47
|
+
throw RepositoryUtils_1.RepositoryUtils.mapSequelizeError(err, this.constructor.name, "upsertAll");
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Removes rows that were not touched during the current refresh cycle — any row whose `updated_at`
|
|
52
|
+
* predates `dateTime` was absent from the latest feed and is considered stale.
|
|
53
|
+
* Call this after `upsertAll` with the timestamp captured at the start of the save to clean up vanished entries.
|
|
54
|
+
*/
|
|
55
|
+
async deleteAllLastUpdatedBefore(dateTime, options) {
|
|
56
|
+
try {
|
|
57
|
+
return await this.sequelizeModel.destroy({
|
|
58
|
+
where: {
|
|
59
|
+
updated_at: { [sequelize_1.Op.lt]: dateTime },
|
|
60
|
+
},
|
|
61
|
+
transaction: options?.transaction,
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
catch (err) {
|
|
65
|
+
throw RepositoryUtils_1.RepositoryUtils.mapSequelizeError(err, this.constructor.name, "deleteAllLastUpdatedBefore");
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
async deleteAll(options) {
|
|
69
|
+
try {
|
|
70
|
+
return await this.sequelizeModel.destroy({ where: {}, transaction: options?.transaction });
|
|
71
|
+
}
|
|
72
|
+
catch (err) {
|
|
73
|
+
throw RepositoryUtils_1.RepositoryUtils.mapSequelizeError(err, this.constructor.name, "deleteAll");
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
// created_at is excluded so that re-upserting an existing row doesn't overwrite
|
|
77
|
+
// when it was first seen — only updated_at should advance on subsequent refreshes.
|
|
78
|
+
getUpdateAttributes() {
|
|
79
|
+
return Object.keys(JISInfotextsPresetsModel_1.JISInfotextsPresetsModel.attributeModel).filter((attribute) => attribute !== "created_at");
|
|
80
|
+
}
|
|
81
|
+
};
|
|
82
|
+
exports.JISInfotextsPresetsRepository = JISInfotextsPresetsRepository;
|
|
83
|
+
exports.JISInfotextsPresetsRepository = JISInfotextsPresetsRepository = __decorate([
|
|
84
|
+
(0, tsyringe_1.injectable)(),
|
|
85
|
+
__param(0, (0, tsyringe_1.inject)(CoreToken_1.CoreToken.PostgresConnector)),
|
|
86
|
+
__param(1, (0, tsyringe_1.inject)(CoreToken_1.CoreToken.Logger)),
|
|
87
|
+
__metadata("design:paramtypes", [Object, Object])
|
|
88
|
+
], JISInfotextsPresetsRepository);
|
|
89
|
+
//# sourceMappingURL=JISInfotextsPresetsRepository.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"JISInfotextsPresetsRepository.js","sourceRoot":"","sources":["../../../../src/integration-engine/jis/repositories/JISInfotextsPresetsRepository.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,6DAAuC;AACvC,8GAAoF;AAIpF,8IAA2I;AAC3I,wEAAqE;AACrE,mFAAkF;AAClF,mEAAmF;A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pC,CAAC,CAAC;QACP,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACX,MAAM,iCAAe,CAAC,iBAAiB,CAAC,GAAG,EAAE,IAAI,CAAC,WAAW,CAAC,IAAI,EAAE,4BAA4B,CAAC,CAAC;QACtG,CAAC;IACL,CAAC;IAEM,KAAK,CAAC,SAAS,CAAC,OAA2B;QAC9C,IAAI,CAAC;YACD,OAAO,MAAM,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,WAAW,EAAE,OAAO,EAAE,WAAW,EAAE,CAAC,CAAC;QAC/F,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACX,MAAM,iCAAe,CAAC,iBAAiB,CAAC,GAAG,EAAE,IAAI,CAAC,WAAW,CAAC,IAAI,EAAE,WAAW,CAAC,CAAC;QACrF,CAAC;IACL,CAAC;IAED,gFAAgF;IAChF,mFAAmF;IAC3E,mBAAmB;QACvB,OAAO,MAAM,CAAC,IAAI,CAAC,mDAAwB,CAAC,cAAc,CAAC,CAAC,MAAM,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,SAAS,KAAK,YAAY,CAAC,CAAC;IAClH,CAAC;CACJ,CAAA;AAjEY,sEAA6B;wCAA7B,6BAA6B;IADzC,IAAA,qBAAU,GAAE;IAQI,WAAA,IAAA,iBAAM,EAAC,qBAAS,CAAC,iBAAiB,CAAC,CAAA;IAAiC,WAAA,IAAA,iBAAM,EAAC,qBAAS,CAAC,MAAM,CAAC,CAAA;;GAPhG,6BAA6B,CAiEzC"}
|
|
@@ -6,6 +6,7 @@ import { IDatabaseConnector } from "@golemio/core/dist/helpers/data-access/postg
|
|
|
6
6
|
import { AbstractValidatableRepository } from "@golemio/core/dist/helpers/data-access/postgres/repositories/AbstractValidatableRepository";
|
|
7
7
|
import { JSONSchemaValidator } from "@golemio/core/dist/shared/golemio-validator";
|
|
8
8
|
import { Transaction } from "@golemio/core/dist/shared/sequelize";
|
|
9
|
+
import { JISInfotextsPresetsRepository } from "./JISInfotextsPresetsRepository";
|
|
9
10
|
import { JISInfotextsRopidGTFSStopsRepository } from "./JISInfotextsRopidGTFSStopsRepository";
|
|
10
11
|
type RepositoryOptions = {
|
|
11
12
|
transaction?: Transaction;
|
|
@@ -13,12 +14,13 @@ type RepositoryOptions = {
|
|
|
13
14
|
export declare class JISInfotextsRepository extends AbstractValidatableRepository {
|
|
14
15
|
private logger;
|
|
15
16
|
private infotextStopRepository;
|
|
17
|
+
private infotextPresetsRepository;
|
|
16
18
|
private gtfsStopRepository;
|
|
17
19
|
validator: JSONSchemaValidator;
|
|
18
20
|
schema: string;
|
|
19
21
|
tableName: string;
|
|
20
22
|
private sequelizeModel;
|
|
21
|
-
constructor(connector: IDatabaseConnector, logger: ILogger, infotextStopRepository: JISInfotextsRopidGTFSStopsRepository, gtfsStopRepository: RopidGTFSStopsModel);
|
|
23
|
+
constructor(connector: IDatabaseConnector, logger: ILogger, infotextStopRepository: JISInfotextsRopidGTFSStopsRepository, infotextPresetsRepository: JISInfotextsPresetsRepository, gtfsStopRepository: RopidGTFSStopsModel);
|
|
22
24
|
/**
|
|
23
25
|
* Refresh all data from VYMI and delete old data
|
|
24
26
|
*
|
|
@@ -24,12 +24,14 @@ const sequelize_1 = require("@golemio/core/dist/shared/sequelize");
|
|
|
24
24
|
const tsyringe_1 = require("@golemio/core/dist/shared/tsyringe");
|
|
25
25
|
const RepositoryUtils_1 = require("../../shared/RepositoryUtils");
|
|
26
26
|
const JISContainerToken_1 = require("../ioc/JISContainerToken");
|
|
27
|
+
const JISInfotextsPresetsRepository_1 = require("./JISInfotextsPresetsRepository");
|
|
27
28
|
const JISInfotextsRopidGTFSStopsRepository_1 = require("./JISInfotextsRopidGTFSStopsRepository");
|
|
28
29
|
let JISInfotextsRepository = class JISInfotextsRepository extends AbstractValidatableRepository_1.AbstractValidatableRepository {
|
|
29
|
-
constructor(connector, logger, infotextStopRepository, gtfsStopRepository) {
|
|
30
|
+
constructor(connector, logger, infotextStopRepository, infotextPresetsRepository, gtfsStopRepository) {
|
|
30
31
|
super(connector, logger);
|
|
31
32
|
this.logger = logger;
|
|
32
33
|
this.infotextStopRepository = infotextStopRepository;
|
|
34
|
+
this.infotextPresetsRepository = infotextPresetsRepository;
|
|
33
35
|
this.gtfsStopRepository = gtfsStopRepository;
|
|
34
36
|
this.schema = const_1.PG_SCHEMA;
|
|
35
37
|
this.tableName = JISInfotextsModel_1.JISInfotextsModel.tableName;
|
|
@@ -64,6 +66,15 @@ let JISInfotextsRepository = class JISInfotextsRepository extends AbstractValida
|
|
|
64
66
|
sourceKey: "stop_id",
|
|
65
67
|
foreignKey: "stop_id",
|
|
66
68
|
});
|
|
69
|
+
this.sequelizeModel.hasMany(this.infotextPresetsRepository["sequelizeModel"], {
|
|
70
|
+
sourceKey: "id",
|
|
71
|
+
foreignKey: "infotext_id",
|
|
72
|
+
as: "presets",
|
|
73
|
+
});
|
|
74
|
+
this.infotextPresetsRepository["sequelizeModel"].belongsTo(this.sequelizeModel, {
|
|
75
|
+
targetKey: "id",
|
|
76
|
+
foreignKey: "infotext_id",
|
|
77
|
+
});
|
|
67
78
|
}
|
|
68
79
|
/**
|
|
69
80
|
* Refresh all data from VYMI and delete old data
|
|
@@ -146,8 +157,10 @@ exports.JISInfotextsRepository = JISInfotextsRepository = __decorate([
|
|
|
146
157
|
__param(0, (0, tsyringe_1.inject)(CoreToken_1.CoreToken.PostgresConnector)),
|
|
147
158
|
__param(1, (0, tsyringe_1.inject)(CoreToken_1.CoreToken.Logger)),
|
|
148
159
|
__param(2, (0, tsyringe_1.inject)(JISContainerToken_1.JISContainerToken.JISInfotextsRopidGTFSStopsRepository)),
|
|
149
|
-
__param(3, (0, tsyringe_1.inject)(JISContainerToken_1.JISContainerToken.
|
|
160
|
+
__param(3, (0, tsyringe_1.inject)(JISContainerToken_1.JISContainerToken.JISInfotextsPresetsRepository)),
|
|
161
|
+
__param(4, (0, tsyringe_1.inject)(JISContainerToken_1.JISContainerToken.RopidGTFSStopsRepository)),
|
|
150
162
|
__metadata("design:paramtypes", [Object, Object, JISInfotextsRopidGTFSStopsRepository_1.JISInfotextsRopidGTFSStopsRepository,
|
|
163
|
+
JISInfotextsPresetsRepository_1.JISInfotextsPresetsRepository,
|
|
151
164
|
ropid_gtfs_1.RopidGTFSStopsModel])
|
|
152
165
|
], JISInfotextsRepository);
|
|
153
166
|
//# sourceMappingURL=JISInfotextsRepository.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"JISInfotextsRepository.js","sourceRoot":"","sources":["../../../../src/integration-engine/jis/repositories/JISInfotextsRepository.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,iDAAqD;AACrD,6DAAuC;AACvC,gGAAsE;AAItE,8IAA2I;AAC3I,wEAAqE;AACrE,6EAAwE;AACxE,mFAAkF;AAClF,mEAAmF;AACnF,iEAAwE;AACxE,kEAA6D;AAC7D,gEAA6D;AAC7D,iGAA8F;AAOvF,IAAM,sBAAsB,GAA5B,MAAM,sBAAuB,SAAQ,6DAA6B;IAOrE,YACyC,SAA6B,EACxC,MAAuB,EAEjD,sBAAoE,EAEpE,kBAA+C;QAE/C,KAAK,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"JISInfotextsRepository.js","sourceRoot":"","sources":["../../../../src/integration-engine/jis/repositories/JISInfotextsRepository.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,iDAAqD;AACrD,6DAAuC;AACvC,gGAAsE;AAItE,8IAA2I;AAC3I,wEAAqE;AACrE,6EAAwE;AACxE,mFAAkF;AAClF,mEAAmF;AACnF,iEAAwE;AACxE,kEAA6D;AAC7D,gEAA6D;AAC7D,mFAAgF;AAChF,iGAA8F;AAOvF,IAAM,sBAAsB,GAA5B,MAAM,sBAAuB,SAAQ,6DAA6B;IAOrE,YACyC,SAA6B,EACxC,MAAuB,EAEjD,sBAAoE,EAEpE,yBAAgE,EAEhE,kBAA+C;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AAA,IAAA,iBAAM,EAAC,qCAAiB,CAAC,6BAA6B,CAAC,CAAA;IAEvD,WAAA,IAAA,iBAAM,EAAC,qCAAiB,CAAC,wBAAwB,CAAC,CAAA;qDAHnB,2EAAoC;QAEjC,6DAA6B;QAEpC,gCAAmB;GAf1C,sBAAsB,CAgJlC"}
|
|
@@ -9,33 +9,24 @@ type RepositoryOptions = {
|
|
|
9
9
|
transaction?: Transaction;
|
|
10
10
|
};
|
|
11
11
|
export declare class JISInfotextsRopidGTFSStopsRepository extends AbstractValidatableRepository {
|
|
12
|
-
private logger;
|
|
13
12
|
validator: JSONSchemaValidator;
|
|
14
13
|
schema: string;
|
|
15
14
|
tableName: string;
|
|
16
15
|
private sequelizeModel;
|
|
17
16
|
constructor(connector: IDatabaseConnector, logger: ILogger);
|
|
18
17
|
/**
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
* @param options Options for the operation
|
|
23
|
-
* @returns The number of deleted items
|
|
18
|
+
* Removes rows that were not touched during the current refresh cycle — any row whose `updated_at`
|
|
19
|
+
* predates `dateTime` was absent from the latest feed and is considered stale.
|
|
20
|
+
* Call this after `upsertAll` with the timestamp captured at the start of the save to clean up vanished entries.
|
|
24
21
|
*/
|
|
25
22
|
deleteAllLastUpdatedBefore(dateTime: Date, options?: RepositoryOptions): Promise<number>;
|
|
26
23
|
/**
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
* @param options Options for the operation
|
|
31
|
-
* @returns The upserted items
|
|
24
|
+
* Inserts new rows or updates existing ones. On conflict, all columns except `created_at` are overwritten —
|
|
25
|
+
* `created_at` is intentionally preserved to track when a row was first seen, while `updated_at` advances
|
|
26
|
+
* each cycle so stale-record cleanup can identify entries missing from the latest feed.
|
|
32
27
|
*/
|
|
33
28
|
upsertAll(data: IJISInfotextsRopidGTFSStops[], options?: RepositoryOptions): ReturnType<ModelStatic<JISInfotextsRopidGTFSStopsModel>["bulkCreate"]>;
|
|
34
29
|
private getUpdateAttributes;
|
|
35
|
-
/**
|
|
36
|
-
* @param options
|
|
37
|
-
* @returns The number of deleted items
|
|
38
|
-
*/
|
|
39
30
|
deleteAll(options?: RepositoryOptions): Promise<number>;
|
|
40
31
|
}
|
|
41
32
|
export {};
|
|
@@ -17,7 +17,6 @@ const const_1 = require("../../../schema-definitions/const");
|
|
|
17
17
|
const JISInfotextsRopidGTFSStopsModel_1 = require("../../../schema-definitions/jis/models/JISInfotextsRopidGTFSStopsModel");
|
|
18
18
|
const AbstractValidatableRepository_1 = require("@golemio/core/dist/helpers/data-access/postgres/repositories/AbstractValidatableRepository");
|
|
19
19
|
const CoreToken_1 = require("@golemio/core/dist/helpers/ioc/CoreToken");
|
|
20
|
-
const golemio_errors_1 = require("@golemio/core/dist/shared/golemio-errors");
|
|
21
20
|
const golemio_validator_1 = require("@golemio/core/dist/shared/golemio-validator");
|
|
22
21
|
const sequelize_1 = require("@golemio/core/dist/shared/sequelize");
|
|
23
22
|
const tsyringe_1 = require("@golemio/core/dist/shared/tsyringe");
|
|
@@ -25,7 +24,6 @@ const RepositoryUtils_1 = require("../../shared/RepositoryUtils");
|
|
|
25
24
|
let JISInfotextsRopidGTFSStopsRepository = class JISInfotextsRopidGTFSStopsRepository extends AbstractValidatableRepository_1.AbstractValidatableRepository {
|
|
26
25
|
constructor(connector, logger) {
|
|
27
26
|
super(connector, logger);
|
|
28
|
-
this.logger = logger;
|
|
29
27
|
this.schema = const_1.PG_SCHEMA;
|
|
30
28
|
this.tableName = JISInfotextsRopidGTFSStopsModel_1.JISInfotextsRopidGTFSStopsModel.tableName;
|
|
31
29
|
this.validator = new golemio_validator_1.JSONSchemaValidator("JISInfotextsRopidGTFSStopsRepository", JISInfotextsRopidGTFSStopsModel_1.JISInfotextsRopidGTFSStopsModel.jsonSchema);
|
|
@@ -34,11 +32,9 @@ let JISInfotextsRopidGTFSStopsRepository = class JISInfotextsRopidGTFSStopsRepos
|
|
|
34
32
|
.define(this.tableName, JISInfotextsRopidGTFSStopsModel_1.JISInfotextsRopidGTFSStopsModel.attributeModel, { schema: this.schema });
|
|
35
33
|
}
|
|
36
34
|
/**
|
|
37
|
-
*
|
|
38
|
-
*
|
|
39
|
-
*
|
|
40
|
-
* @param options Options for the operation
|
|
41
|
-
* @returns The number of deleted items
|
|
35
|
+
* Removes rows that were not touched during the current refresh cycle — any row whose `updated_at`
|
|
36
|
+
* predates `dateTime` was absent from the latest feed and is considered stale.
|
|
37
|
+
* Call this after `upsertAll` with the timestamp captured at the start of the save to clean up vanished entries.
|
|
42
38
|
*/
|
|
43
39
|
async deleteAllLastUpdatedBefore(dateTime, options) {
|
|
44
40
|
try {
|
|
@@ -50,15 +46,13 @@ let JISInfotextsRopidGTFSStopsRepository = class JISInfotextsRopidGTFSStopsRepos
|
|
|
50
46
|
});
|
|
51
47
|
}
|
|
52
48
|
catch (err) {
|
|
53
|
-
throw
|
|
49
|
+
throw RepositoryUtils_1.RepositoryUtils.mapSequelizeError(err, this.constructor.name, "deleteAllLastUpdatedBefore");
|
|
54
50
|
}
|
|
55
51
|
}
|
|
56
52
|
/**
|
|
57
|
-
*
|
|
58
|
-
*
|
|
59
|
-
*
|
|
60
|
-
* @param options Options for the operation
|
|
61
|
-
* @returns The upserted items
|
|
53
|
+
* Inserts new rows or updates existing ones. On conflict, all columns except `created_at` are overwritten —
|
|
54
|
+
* `created_at` is intentionally preserved to track when a row was first seen, while `updated_at` advances
|
|
55
|
+
* each cycle so stale-record cleanup can identify entries missing from the latest feed.
|
|
62
56
|
*/
|
|
63
57
|
async upsertAll(data, options) {
|
|
64
58
|
try {
|
|
@@ -68,22 +62,20 @@ let JISInfotextsRopidGTFSStopsRepository = class JISInfotextsRopidGTFSStopsRepos
|
|
|
68
62
|
});
|
|
69
63
|
}
|
|
70
64
|
catch (err) {
|
|
71
|
-
RepositoryUtils_1.RepositoryUtils.mapSequelizeError(err, this.constructor.name, "upsertAll");
|
|
65
|
+
throw RepositoryUtils_1.RepositoryUtils.mapSequelizeError(err, this.constructor.name, "upsertAll");
|
|
72
66
|
}
|
|
73
67
|
}
|
|
68
|
+
// created_at is excluded so that re-upserting an existing row doesn't overwrite
|
|
69
|
+
// when it was first seen — only updated_at should advance on subsequent refreshes.
|
|
74
70
|
getUpdateAttributes() {
|
|
75
|
-
return Object.keys(JISInfotextsRopidGTFSStopsModel_1.JISInfotextsRopidGTFSStopsModel.attributeModel).filter((attribute) =>
|
|
71
|
+
return Object.keys(JISInfotextsRopidGTFSStopsModel_1.JISInfotextsRopidGTFSStopsModel.attributeModel).filter((attribute) => attribute !== "created_at");
|
|
76
72
|
}
|
|
77
|
-
/**
|
|
78
|
-
* @param options
|
|
79
|
-
* @returns The number of deleted items
|
|
80
|
-
*/
|
|
81
73
|
async deleteAll(options) {
|
|
82
74
|
try {
|
|
83
75
|
return await this.sequelizeModel.destroy({ where: {}, transaction: options?.transaction });
|
|
84
76
|
}
|
|
85
77
|
catch (err) {
|
|
86
|
-
throw
|
|
78
|
+
throw RepositoryUtils_1.RepositoryUtils.mapSequelizeError(err, this.constructor.name, "deleteAll");
|
|
87
79
|
}
|
|
88
80
|
}
|
|
89
81
|
};
|
package/dist/integration-engine/jis/repositories/JISInfotextsRopidGTFSStopsRepository.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"JISInfotextsRopidGTFSStopsRepository.js","sourceRoot":"","sources":["../../../../src/integration-engine/jis/repositories/JISInfotextsRopidGTFSStopsRepository.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,6DAAuC;AACvC,4HAAkG;AAIlG,8IAA2I;AAC3I,wEAAqE;AACrE,
|
|
1
|
+
{"version":3,"file":"JISInfotextsRopidGTFSStopsRepository.js","sourceRoot":"","sources":["../../../../src/integration-engine/jis/repositories/JISInfotextsRopidGTFSStopsRepository.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,6DAAuC;AACvC,4HAAkG;AAIlG,8IAA2I;AAC3I,wEAAqE;A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W,EAAE,OAAO,EAAE,WAAW;aACpC,CAAC,CAAC;QACP,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACX,MAAM,iCAAe,CAAC,iBAAiB,CAAC,GAAG,EAAE,IAAI,CAAC,WAAW,CAAC,IAAI,EAAE,WAAW,CAAC,CAAC;QACrF,CAAC;IACL,CAAC;IAED,gFAAgF;IAChF,mFAAmF;IAC3E,mBAAmB;QACvB,OAAO,MAAM,CAAC,IAAI,CAAC,iEAA+B,CAAC,cAAc,CAAC,CAAC,MAAM,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,SAAS,KAAK,YAAY,CAAC,CAAC;IACzH,CAAC;IAEM,KAAK,CAAC,SAAS,CAAC,OAA2B;QAC9C,IAAI,CAAC;YACD,OAAO,MAAM,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,WAAW,EAAE,OAAO,EAAE,WAAW,EAAE,CAAC,CAAC;QAC/F,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACX,MAAM,iCAAe,CAAC,iBAAiB,CAAC,GAAG,EAAE,IAAI,CAAC,WAAW,CAAC,IAAI,EAAE,WAAW,CAAC,CAAC;QACrF,CAAC;IACL,CAAC;CACJ,CAAA;AApEY,oFAAoC;+CAApC,oCAAoC;IADhD,IAAA,qBAAU,GAAE;IAQI,WAAA,IAAA,iBAAM,EAAC,qBAAS,CAAC,iBAAiB,CAAC,CAAA;IAAiC,WAAA,IAAA,iBAAM,EAAC,qBAAS,CAAC,MAAM,CAAC,CAAA;;GAPhG,oCAAoC,CAoEhD"}
|
|
@@ -1,20 +1,19 @@
|
|
|
1
|
+
import { JISInfotextsPresetsRepository } from "../repositories/JISInfotextsPresetsRepository";
|
|
1
2
|
import { JISInfotextsRepository } from "../repositories/JISInfotextsRepository";
|
|
2
3
|
import { JISInfotextsRopidGTFSStopsRepository } from "../repositories/JISInfotextsRopidGTFSStopsRepository";
|
|
3
|
-
import { IJISInfotext, IJISInfotextsRopidGTFSStops } from "../../../schema-definitions/jis/models/interfaces";
|
|
4
|
+
import { IJISInfotext, IJISInfotextsPresets, IJISInfotextsRopidGTFSStops } from "../../../schema-definitions/jis/models/interfaces";
|
|
4
5
|
import { ILogger } from "@golemio/core/dist/helpers";
|
|
5
6
|
import { IDatabaseConnector } from "@golemio/core/dist/helpers/data-access/postgres/IDatabaseConnector";
|
|
6
7
|
export declare class JISInfotextsDataService {
|
|
7
8
|
private infotextsRepository;
|
|
8
9
|
private infotextsRopidGTFSStopsRepository;
|
|
10
|
+
private infotextsPresetsRepository;
|
|
9
11
|
private databaseConnector;
|
|
10
12
|
private logger;
|
|
11
|
-
constructor(infotextsRepository: JISInfotextsRepository, infotextsRopidGTFSStopsRepository: JISInfotextsRopidGTFSStopsRepository, databaseConnector: IDatabaseConnector, logger: ILogger);
|
|
13
|
+
constructor(infotextsRepository: JISInfotextsRepository, infotextsRopidGTFSStopsRepository: JISInfotextsRopidGTFSStopsRepository, infotextsPresetsRepository: JISInfotextsPresetsRepository, databaseConnector: IDatabaseConnector, logger: ILogger);
|
|
12
14
|
/**
|
|
13
|
-
* Insert or update all given infotexts and
|
|
14
|
-
* `created_at` shall be overwritten.
|
|
15
|
-
*
|
|
16
|
-
* @param infotexts The infotexts data to be upserted
|
|
17
|
-
* @param infotextsRopidGTFSStops The infotextsRopidGTFSStops data to be upserted
|
|
15
|
+
* Insert or update all given infotexts, their stop links and preset links. In case of an update, all attributes except for
|
|
16
|
+
* `created_at` shall be overwritten. Rows absent from this refresh cycle are deleted as stale.
|
|
18
17
|
*/
|
|
19
|
-
refreshData(infotexts: IJISInfotext[], infotextsRopidGTFSStops: IJISInfotextsRopidGTFSStops[]): Promise<void>;
|
|
18
|
+
refreshData(infotexts: IJISInfotext[], infotextsRopidGTFSStops: IJISInfotextsRopidGTFSStops[], infotextsPresets: IJISInfotextsPresets[]): Promise<void>;
|
|
20
19
|
}
|
|
@@ -14,32 +14,32 @@ var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
15
|
exports.JISInfotextsDataService = void 0;
|
|
16
16
|
const JISContainerToken_1 = require("../ioc/JISContainerToken");
|
|
17
|
+
const JISInfotextsPresetsRepository_1 = require("../repositories/JISInfotextsPresetsRepository");
|
|
17
18
|
const JISInfotextsRepository_1 = require("../repositories/JISInfotextsRepository");
|
|
18
19
|
const JISInfotextsRopidGTFSStopsRepository_1 = require("../repositories/JISInfotextsRopidGTFSStopsRepository");
|
|
19
20
|
const CoreToken_1 = require("@golemio/core/dist/helpers/ioc/CoreToken");
|
|
20
21
|
const golemio_errors_1 = require("@golemio/core/dist/shared/golemio-errors");
|
|
21
22
|
const tsyringe_1 = require("@golemio/core/dist/shared/tsyringe");
|
|
22
23
|
let JISInfotextsDataService = class JISInfotextsDataService {
|
|
23
|
-
constructor(infotextsRepository, infotextsRopidGTFSStopsRepository, databaseConnector, logger) {
|
|
24
|
+
constructor(infotextsRepository, infotextsRopidGTFSStopsRepository, infotextsPresetsRepository, databaseConnector, logger) {
|
|
24
25
|
this.infotextsRepository = infotextsRepository;
|
|
25
26
|
this.infotextsRopidGTFSStopsRepository = infotextsRopidGTFSStopsRepository;
|
|
27
|
+
this.infotextsPresetsRepository = infotextsPresetsRepository;
|
|
26
28
|
this.databaseConnector = databaseConnector;
|
|
27
29
|
this.logger = logger;
|
|
28
30
|
// do nothing
|
|
29
31
|
}
|
|
30
32
|
/**
|
|
31
|
-
* Insert or update all given infotexts and
|
|
32
|
-
* `created_at` shall be overwritten.
|
|
33
|
-
*
|
|
34
|
-
* @param infotexts The infotexts data to be upserted
|
|
35
|
-
* @param infotextsRopidGTFSStops The infotextsRopidGTFSStops data to be upserted
|
|
33
|
+
* Insert or update all given infotexts, their stop links and preset links. In case of an update, all attributes except for
|
|
34
|
+
* `created_at` shall be overwritten. Rows absent from this refresh cycle are deleted as stale.
|
|
36
35
|
*/
|
|
37
|
-
async refreshData(infotexts, infotextsRopidGTFSStops) {
|
|
36
|
+
async refreshData(infotexts, infotextsRopidGTFSStops, infotextsPresets) {
|
|
38
37
|
const connection = this.databaseConnector.getConnection();
|
|
39
38
|
const transaction = await connection.transaction();
|
|
40
39
|
const saveTime = new Date();
|
|
41
40
|
try {
|
|
42
41
|
if (infotexts.length === 0) {
|
|
42
|
+
await this.infotextsPresetsRepository.deleteAll({ transaction });
|
|
43
43
|
await this.infotextsRopidGTFSStopsRepository.deleteAll({ transaction });
|
|
44
44
|
await this.infotextsRepository.deleteAll({ transaction });
|
|
45
45
|
await transaction.commit();
|
|
@@ -49,9 +49,12 @@ let JISInfotextsDataService = class JISInfotextsDataService {
|
|
|
49
49
|
await this.infotextsRepository.refreshData(infotexts, { transaction });
|
|
50
50
|
await this.infotextsRopidGTFSStopsRepository.upsertAll(infotextsRopidGTFSStops, { transaction });
|
|
51
51
|
await this.infotextsRopidGTFSStopsRepository.deleteAllLastUpdatedBefore(saveTime, { transaction });
|
|
52
|
+
await this.infotextsPresetsRepository.upsertAll(infotextsPresets, { transaction });
|
|
53
|
+
await this.infotextsPresetsRepository.deleteAllLastUpdatedBefore(saveTime, { transaction });
|
|
52
54
|
await transaction.commit();
|
|
53
|
-
this.logger.info(`${this.constructor.name}.refreshData: ${infotexts.length} JIS infotexts
|
|
54
|
-
`${infotextsRopidGTFSStops.length} JIS infotextsRopidGTFSStops
|
|
55
|
+
this.logger.info(`${this.constructor.name}.refreshData: ${infotexts.length} JIS infotexts, ` +
|
|
56
|
+
`${infotextsRopidGTFSStops.length} JIS infotextsRopidGTFSStops and ` +
|
|
57
|
+
`${infotextsPresets.length} JIS infotextsPresets were saved`);
|
|
55
58
|
}
|
|
56
59
|
}
|
|
57
60
|
catch (err) {
|
|
@@ -67,9 +70,11 @@ exports.JISInfotextsDataService = JISInfotextsDataService = __decorate([
|
|
|
67
70
|
(0, tsyringe_1.injectable)(),
|
|
68
71
|
__param(0, (0, tsyringe_1.inject)(JISContainerToken_1.JISContainerToken.JISInfotextsRepository)),
|
|
69
72
|
__param(1, (0, tsyringe_1.inject)(JISContainerToken_1.JISContainerToken.JISInfotextsRopidGTFSStopsRepository)),
|
|
70
|
-
__param(2, (0, tsyringe_1.inject)(
|
|
71
|
-
__param(3, (0, tsyringe_1.inject)(CoreToken_1.CoreToken.
|
|
73
|
+
__param(2, (0, tsyringe_1.inject)(JISContainerToken_1.JISContainerToken.JISInfotextsPresetsRepository)),
|
|
74
|
+
__param(3, (0, tsyringe_1.inject)(CoreToken_1.CoreToken.PostgresConnector)),
|
|
75
|
+
__param(4, (0, tsyringe_1.inject)(CoreToken_1.CoreToken.Logger)),
|
|
72
76
|
__metadata("design:paramtypes", [JISInfotextsRepository_1.JISInfotextsRepository,
|
|
73
|
-
JISInfotextsRopidGTFSStopsRepository_1.JISInfotextsRopidGTFSStopsRepository,
|
|
77
|
+
JISInfotextsRopidGTFSStopsRepository_1.JISInfotextsRopidGTFSStopsRepository,
|
|
78
|
+
JISInfotextsPresetsRepository_1.JISInfotextsPresetsRepository, Object, Object])
|
|
74
79
|
], JISInfotextsDataService);
|
|
75
80
|
//# sourceMappingURL=JISInfotextsDataService.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"JISInfotextsDataService.js","sourceRoot":"","sources":["../../../../src/integration-engine/jis/services/JISInfotextsDataService.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,gEAAkE;AAClE,mFAAqF;AACrF,+GAAiH;AAIjH,wEAAqE;AACrE,6EAAwE;AACxE,iEAAwE;AAGjE,IAAM,uBAAuB,GAA7B,MAAM,uBAAuB;IAChC,YAEY,mBAA2C,EAE3C,iCAAuE,
|
|
1
|
+
{"version":3,"file":"JISInfotextsDataService.js","sourceRoot":"","sources":["../../../../src/integration-engine/jis/services/JISInfotextsDataService.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,gEAAkE;AAClE,iGAAmG;AACnG,mFAAqF;AACrF,+GAAiH;AAIjH,wEAAqE;AACrE,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A,iBAAM,EAAC,qBAAS,CAAC,MAAM,CAAC,CAAA;qCANI,+CAAsB;QAER,2EAAoC;QAE3C,6DAA6B;GAP5D,uBAAuB,CAuDnC"}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { IJISInfotext as IJISInfotextDataSource } from "../../../schema-definitions/jis/datasources/interfaces";
|
|
2
|
-
import { IJISInfotext as IJISInfotextModel, IJISInfotextsRopidGTFSStops as IJISInfotextsRopidGTFSStopsModel } from "../../../schema-definitions/jis/models/interfaces";
|
|
2
|
+
import { IJISInfotext as IJISInfotextModel, IJISInfotextsPresets as IJISInfotextsPresetsModel, IJISInfotextsRopidGTFSStops as IJISInfotextsRopidGTFSStopsModel } from "../../../schema-definitions/jis/models/interfaces";
|
|
3
3
|
import { AbstractTransformation } from "@golemio/core/dist/helpers/transformation/AbstractTransformation";
|
|
4
4
|
type TransformIn = IJISInfotextDataSource;
|
|
5
5
|
type TransformOut = {
|
|
6
6
|
infotext: IJISInfotextModel;
|
|
7
7
|
infotextsRopidGTFSStops: IJISInfotextsRopidGTFSStopsModel[];
|
|
8
|
+
infotextsPresets: IJISInfotextsPresetsModel[];
|
|
8
9
|
};
|
|
9
10
|
export declare class JISInfotextsTransformation extends AbstractTransformation<TransformIn, TransformOut> {
|
|
10
11
|
name: string;
|