@golemio/parkings 1.20.0-dev.1791870037 → 1.20.0-dev.1802444292
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/integration-engine/datasources/parkomats/ParkomatsDataSource.d.ts +3 -6
- package/dist/integration-engine/datasources/parkomats/ParkomatsDataSource.js +13 -31
- package/dist/integration-engine/datasources/parkomats/ParkomatsDataSource.js.map +1 -1
- package/dist/integration-engine/workers/tasks/UpdateAddressAndNameTask.js +8 -5
- package/dist/integration-engine/workers/tasks/UpdateAddressAndNameTask.js.map +1 -1
- package/dist/integration-engine/workers/tasks/UpdateAddressTask.js +7 -4
- package/dist/integration-engine/workers/tasks/UpdateAddressTask.js.map +1 -1
- package/dist/integration-engine/workers/tasks/UpdateLocationAddressTask.js +7 -4
- package/dist/integration-engine/workers/tasks/UpdateLocationAddressTask.js.map +1 -1
- package/docs/implementation_documentation.md +3 -3
- package/package.json +1 -1
|
@@ -1,13 +1,10 @@
|
|
|
1
|
-
import { IConfiguration } from "@golemio/core/dist/integration-engine";
|
|
2
|
-
import { IGenericFeature } from "../interfaces/IGenericFeature";
|
|
3
1
|
import { IParkomatInput } from "../../../schema-definitions/parkomats/datasources/interfaces/IParkomatInput";
|
|
4
|
-
import {
|
|
2
|
+
import { IConfiguration } from "@golemio/core/dist/integration-engine/config/abstract";
|
|
3
|
+
import { IGenericFeature } from "../interfaces/IGenericFeature";
|
|
5
4
|
export declare class ParkomatsDataSource {
|
|
6
5
|
private config;
|
|
7
|
-
private logger;
|
|
8
6
|
private readonly MAX_RETRIES;
|
|
9
|
-
|
|
10
|
-
constructor(config: IConfiguration, logger: ILogger);
|
|
7
|
+
constructor(config: IConfiguration);
|
|
11
8
|
getParkomats(params: string): Promise<Array<IGenericFeature<IParkomatInput>>>;
|
|
12
9
|
private getDatasource;
|
|
13
10
|
}
|
|
@@ -15,57 +15,39 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
15
15
|
exports.ParkomatsDataSource = void 0;
|
|
16
16
|
const _sch_1 = require("../../../schema-definitions");
|
|
17
17
|
const ParkomatInputSchema_1 = require("../../../schema-definitions/parkomats/datasources/ParkomatInputSchema");
|
|
18
|
-
const
|
|
19
|
-
const tsyringe_1 = require("@golemio/core/dist/shared/tsyringe");
|
|
20
|
-
const golemio_validator_1 = require("@golemio/core/dist/shared/golemio-validator");
|
|
18
|
+
const JSONDataTypeStrategy_1 = require("@golemio/core/dist/integration-engine/datasources/datatype-strategy/JSONDataTypeStrategy");
|
|
21
19
|
const HTTPFetchProtocolStrategy_1 = require("@golemio/core/dist/integration-engine/datasources/protocol-strategy/HTTPFetchProtocolStrategy");
|
|
20
|
+
const RetryDataSource_1 = require("@golemio/core/dist/integration-engine/datasources/RetryDataSource");
|
|
22
21
|
const ioc_1 = require("@golemio/core/dist/integration-engine/ioc");
|
|
23
22
|
const golemio_errors_1 = require("@golemio/core/dist/shared/golemio-errors");
|
|
24
|
-
const
|
|
23
|
+
const golemio_validator_1 = require("@golemio/core/dist/shared/golemio-validator");
|
|
24
|
+
const tsyringe_1 = require("@golemio/core/dist/shared/tsyringe");
|
|
25
25
|
let ParkomatsDataSource = exports.ParkomatsDataSource = class ParkomatsDataSource {
|
|
26
|
-
constructor(config
|
|
26
|
+
constructor(config) {
|
|
27
27
|
this.config = config;
|
|
28
|
-
this.logger = logger;
|
|
29
28
|
this.MAX_RETRIES = 3;
|
|
30
|
-
this.RETRY_DELAY_MS = 30000; // 30 second delay
|
|
31
29
|
}
|
|
32
30
|
async getParkomats(params) {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
return result;
|
|
39
|
-
}
|
|
40
|
-
catch (error) {
|
|
41
|
-
if (attempt === this.MAX_RETRIES) {
|
|
42
|
-
// If it's the last
|
|
43
|
-
throw new golemio_errors_1.GeneralError("Failed to fetch parkomats data after multiple attempts. " + error.message, this.constructor.name, error);
|
|
44
|
-
}
|
|
45
|
-
this.logger.warn({
|
|
46
|
-
className: this.constructor.name,
|
|
47
|
-
}, `Attempt ${attempt} failed to fetch parkomats data. Retrying in ${this.RETRY_DELAY_MS / 1000} seconds...`);
|
|
48
|
-
// sleep for a while before retrying
|
|
49
|
-
await new Promise((resolve) => setTimeout(resolve, this.RETRY_DELAY_MS));
|
|
50
|
-
}
|
|
31
|
+
try {
|
|
32
|
+
return await this.getDatasource(params).getAll();
|
|
33
|
+
}
|
|
34
|
+
catch (error) {
|
|
35
|
+
throw new golemio_errors_1.GeneralError("Failed to fetch parkomats data after multiple attempts. " + error.message, this.constructor.name, error);
|
|
51
36
|
}
|
|
52
|
-
// This line should never be reached due to the loop above
|
|
53
|
-
throw new golemio_errors_1.GeneralError("Unexpected error in ParkomatsDataSource", this.constructor.name);
|
|
54
37
|
}
|
|
55
38
|
getDatasource(params) {
|
|
56
|
-
return new
|
|
39
|
+
return new RetryDataSource_1.RetryDataSource(_sch_1.Parkomats.name + "DataSource", new HTTPFetchProtocolStrategy_1.HTTPFetchProtocolStrategy({
|
|
57
40
|
headers: {
|
|
58
41
|
authorization: this.config.datasources.TSKParkomatsToken,
|
|
59
42
|
},
|
|
60
43
|
method: "GET",
|
|
61
44
|
url: this.config.datasources.TSKParkomats + "/parkingsessionshistory?" + params,
|
|
62
|
-
}), new
|
|
45
|
+
}), new JSONDataTypeStrategy_1.JSONDataTypeStrategy({ resultsPath: "" }), new golemio_validator_1.JSONSchemaValidator(_sch_1.Parkomats.name + "DataSource", ParkomatInputSchema_1.ParkomatInputSchema), this.MAX_RETRIES);
|
|
63
46
|
}
|
|
64
47
|
};
|
|
65
48
|
exports.ParkomatsDataSource = ParkomatsDataSource = __decorate([
|
|
66
49
|
(0, tsyringe_1.injectable)(),
|
|
67
50
|
__param(0, (0, tsyringe_1.inject)(ioc_1.ContainerToken.Config)),
|
|
68
|
-
|
|
69
|
-
__metadata("design:paramtypes", [Object, Object])
|
|
51
|
+
__metadata("design:paramtypes", [Object])
|
|
70
52
|
], ParkomatsDataSource);
|
|
71
53
|
//# sourceMappingURL=ParkomatsDataSource.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ParkomatsDataSource.js","sourceRoot":"","sources":["../../../../src/integration-engine/datasources/parkomats/ParkomatsDataSource.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,sDAAiC;
|
|
1
|
+
{"version":3,"file":"ParkomatsDataSource.js","sourceRoot":"","sources":["../../../../src/integration-engine/datasources/parkomats/ParkomatsDataSource.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,sDAAiC;AAEjC,+GAAqF;AAErF,mIAAgI;AAChI,6IAA0I;AAC1I,uGAAoG;AACpG,mEAA2E;AAC3E,6EAAwE;AACxE,mFAAkF;AAClF,iEAAwE;AAIjE,IAAM,mBAAmB,iCAAzB,MAAM,mBAAmB;IAG5B,YAA2C,MAA8B;QAAtB,WAAM,GAAN,MAAM,CAAgB;QAFxD,gBAAW,GAAG,CAAC,CAAC;IAE2C,CAAC;IAEtE,KAAK,CAAC,YAAY,CAAC,MAAc;QACpC,IAAI;YACA,OAAO,MAAM,IAAI,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC,MAAM,EAAE,CAAC;SACpD;QAAC,OAAO,KAAK,EAAE;YACZ,MAAM,IAAI,6BAAY,CAClB,0DAA0D,GAAG,KAAK,CAAC,OAAO,EAC1E,IAAI,CAAC,WAAW,CAAC,IAAI,EACrB,KAAK,CACR,CAAC;SACL;IACL,CAAC;IAEO,aAAa,CAAC,MAAc;QAChC,OAAO,IAAI,iCAAe,CACtB,gBAAS,CAAC,IAAI,GAAG,YAAY,EAC7B,IAAI,qDAAyB,CAAC;YAC1B,OAAO,EAAE;gBACL,aAAa,EAAE,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC,iBAAiB;aAC3D;YACD,MAAM,EAAE,KAAK;YACb,GAAG,EAAE,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC,YAAY,GAAG,0BAA0B,GAAG,MAAM;SAClF,CAAC,EACF,IAAI,2CAAoB,CAAC,EAAE,WAAW,EAAE,EAAE,EAAE,CAAC,EAC7C,IAAI,uCAAmB,CAAC,gBAAS,CAAC,IAAI,GAAG,YAAY,EAAE,yCAAmB,CAAC,EAC3E,IAAI,CAAC,WAAW,CACnB,CAAC;IACN,CAAC;CACJ,CAAA;8BAhCY,mBAAmB;IAD/B,IAAA,qBAAU,GAAE;IAII,WAAA,IAAA,iBAAM,EAAC,oBAAc,CAAC,MAAM,CAAC,CAAA;;GAHjC,mBAAmB,CAgC/B"}
|
|
@@ -35,21 +35,24 @@ let UpdateAddressAndNameTask = exports.UpdateAddressAndNameTask = class UpdateAd
|
|
|
35
35
|
async execute(data) {
|
|
36
36
|
const now = Date.now();
|
|
37
37
|
try {
|
|
38
|
-
const address =
|
|
38
|
+
const address = await this.geocodeApi.getExtendedAddressFromPhoton(data.point.coordinates[1], data.point.coordinates[0]);
|
|
39
|
+
if (!address) {
|
|
40
|
+
this.log.info(data, `Address not found`);
|
|
41
|
+
return await this.postponeNextCheck(data.id);
|
|
42
|
+
}
|
|
39
43
|
const name = this.buildName(address, data);
|
|
40
44
|
await this.repository.update({ address, name, address_updated_at: now }, { where: { id: data.id }, fields: ["address", "name", "address_updated_at"] });
|
|
41
45
|
}
|
|
42
46
|
catch (err) {
|
|
43
|
-
this.log.error(
|
|
47
|
+
this.log.error(err,
|
|
44
48
|
// eslint-disable-next-line max-len
|
|
45
|
-
`Error while updating address: ${data?.name} [${data?.point?.coordinates[1]},${data?.point?.coordinates[0]}] ${
|
|
46
|
-
await this.postponeNextCheck(data.id);
|
|
49
|
+
`Error while updating address: ${data?.name} [${data?.point?.coordinates[1]},${data?.point?.coordinates[0]}] with id ${data?.id}`);
|
|
47
50
|
}
|
|
48
51
|
}
|
|
49
52
|
buildName(address, data) {
|
|
50
53
|
return `${data.name} ${address.street_address}, ${address.address_region}`;
|
|
51
54
|
}
|
|
52
|
-
//
|
|
55
|
+
// Temporary solution to decrease the number of requests to the geocoding service. Should be solved in
|
|
53
56
|
// https://gitlab.com/operator-ict/golemio/code/modules/core/-/issues/120
|
|
54
57
|
async postponeNextCheck(parkingId) {
|
|
55
58
|
try {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UpdateAddressAndNameTask.js","sourceRoot":"","sources":["../../../../src/integration-engine/workers/tasks/UpdateAddressAndNameTask.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,yEAAoE;AACpE,8EAAyE;AACzE,4CAAiE;AAEjE,wEAA6G;AAE7G,wEAAqE;AACrE,8EAAqE;AACrE,yFAAsG;AACtG,mEAA2E;AAC3E,iEAAwE;
|
|
1
|
+
{"version":3,"file":"UpdateAddressAndNameTask.js","sourceRoot":"","sources":["../../../../src/integration-engine/workers/tasks/UpdateAddressAndNameTask.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,yEAAoE;AACpE,8EAAyE;AACzE,4CAAiE;AAEjE,wEAA6G;AAE7G,wEAAqE;AACrE,8EAAqE;AACrE,yFAAsG;AACtG,mEAA2E;AAC3E,iEAAwE;AAGjE,IAAM,wBAAwB,sCAA9B,MAAM,wBAAyB,SAAQ,iCAAiC;IAK3E,YAC8B,GAAoB,EAE9C,UAAuC,EAEvC,UAA+C;QAE/C,KAAK,CAAC,oCAAwB,CAAC,CAAC;QANE,QAAG,GAAH,GAAG,CAAS;QAE7B,eAAU,GAAV,UAAU,CAAY;QAEtB,eAAU,GAAV,UAAU,CAAoB;QATnC,cAAS,GAAG,sBAAsB,CAAC;QACnC,aAAQ,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC,CAAC,KAAK;QAChC,WAAM,GAAG,mDAA6B,CAAC;IAUvD,CAAC;IACM,KAAK,CAAC,OAAO,CAAC,IAAgC;QACjD,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;QAEvB,IAAI;YACA,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,UAAU,CAA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,IAAI,CAAC,GAAG,EAAE,EAAE,EAClC,EAAE,KAAK,EAAE,EAAE,EAAE,EAAE,SAAS,EAAE,EAAE,MAAM,EAAE,CAAC,oBAAoB,CAAC,EAAE,CAC/D,CAAC;SACL;QAAC,OAAO,GAAG,EAAE;YACV,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,kEAAkE,SAAS,IAAI,GAAG,EAAE,CAAC,CAAC;SACxG;IACL,CAAC;CACJ,CAAA;mCA3DY,wBAAwB;IADpC,IAAA,qBAAU,GAAE;IAOJ,WAAA,IAAA,iBAAM,EAAC,qBAAS,CAAC,MAAM,CAAC,CAAA;IACxB,WAAA,IAAA,iBAAM,EAAC,oBAAc,CAAC,UAAU,CAAC,CAAA;IAEjC,WAAA,IAAA,iBAAM,EAAC,2CAAoB,CAAC,kBAAkB,CAAC,CAAA;6CADnB,uBAAU;QAEV,uCAAkB;GAV1C,wBAAwB,CA2DpC"}
|
|
@@ -36,16 +36,19 @@ let UpdateAddressTask = exports.UpdateAddressTask = class UpdateAddressTask exte
|
|
|
36
36
|
const now = Date.now();
|
|
37
37
|
try {
|
|
38
38
|
const address = await this.geocodeApi.getExtendedAddressFromPhoton(data.point.coordinates[1], data.point.coordinates[0]);
|
|
39
|
+
if (!address) {
|
|
40
|
+
this.log.info(data, `Address not found`);
|
|
41
|
+
return await this.postponeNextCheck(data.id);
|
|
42
|
+
}
|
|
39
43
|
await this.repository.update({ address, address_updated_at: now }, { where: { id: data.id }, fields: ["address", "address_updated_at"] });
|
|
40
44
|
}
|
|
41
45
|
catch (err) {
|
|
42
|
-
this.log.error(
|
|
46
|
+
this.log.error(err,
|
|
43
47
|
// eslint-disable-next-line max-len
|
|
44
|
-
`Error while updating address: [${data?.point?.coordinates[1]},${data?.point?.coordinates[0]}] with id ${data?.id}
|
|
45
|
-
await this.postponeNextCheck(data.id);
|
|
48
|
+
`Error while updating address: [${data?.point?.coordinates[1]},${data?.point?.coordinates[0]}] with id ${data?.id}`);
|
|
46
49
|
}
|
|
47
50
|
}
|
|
48
|
-
//
|
|
51
|
+
// Temporary solution to decrease the number of requests to the geocoding service. Should be solved in
|
|
49
52
|
// https://gitlab.com/operator-ict/golemio/code/modules/core/-/issues/120
|
|
50
53
|
async postponeNextCheck(parkingId) {
|
|
51
54
|
try {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UpdateAddressTask.js","sourceRoot":"","sources":["../../../../src/integration-engine/workers/tasks/UpdateAddressTask.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,yEAAoE;AACpE,8EAAyE;AACzE,4CAAiE;AACjE,wEAA6G;AAE7G,wEAAqE;AACrE,8EAAqE;AACrE,yFAAsF;AACtF,mEAA2E;AAC3E,iEAAwE;AAGjE,IAAM,iBAAiB,+BAAvB,MAAM,iBAAkB,SAAQ,iCAAiC;IAKpE,YAC8B,GAAoB,EAE9C,UAAuC,EAEvC,UAA+C;QAE/C,KAAK,CAAC,oCAAwB,CAAC,CAAC;QANE,QAAG,GAAH,GAAG,CAAS;QAE7B,eAAU,GAAV,UAAU,CAAY;QAEtB,eAAU,GAAV,UAAU,CAAoB;QATnC,cAAS,GAAG,eAAe,CAAC;QAC5B,aAAQ,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC,CAAC,SAAS;QACpC,WAAM,GAAG,mDAA6B,CAAC;IAUvD,CAAC;IAEM,KAAK,CAAC,OAAO,CAAC,IAAyB;QAC1C,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;QAEvB,IAAI;YACA,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,UAAU,CAAC,4BAA4B,CAC9D,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC,CAAC,EACzB,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC,CAAC,CAC5B,CAAC;
|
|
1
|
+
{"version":3,"file":"UpdateAddressTask.js","sourceRoot":"","sources":["../../../../src/integration-engine/workers/tasks/UpdateAddressTask.ts"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AC,EAAE,CACxE,CAAC;SACL;QAAC,OAAO,GAAG,EAAE;YACV,IAAI,CAAC,GAAG,CAAC,KAAK,CACV,GAAG;YACH,mCAAmC;YACnC,kCAAkC,IAAI,EAAE,KAAK,EAAE,WAAW,CAAC,CAAC,CAAC,IAAI,IAAI,EAAE,KAAK,EAAE,WAAW,CAAC,CAAC,CAAC,aAAa,IAAI,EAAE,EAAE,EAAE,CACtH,CAAC;SACL;IACL,CAAC;IACD,sGAAsG;IACtG,yEAAyE;IACjE,KAAK,CAAC,iBAAiB,CAAC,SAAiB;QAC7C,IAAI;YACA,MAAM,IAAI,CAAC,UAAU,CAAC,MAAM,CACxB,EAAE,kBAAkB,EAAE,IAAI,CAAC,GAAG,EAAE,EAAE,EAClC,EAAE,KAAK,EAAE,EAAE,EAAE,EAAE,SAAS,EAAE,EAAE,MAAM,EAAE,CAAC,oBAAoB,CAAC,EAAE,CAC/D,CAAC;SACL;QAAC,OAAO,GAAG,EAAE;YACV,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,yDAAyD,SAAS,IAAI,GAAG,EAAE,CAAC,CAAC;SAC/F;IACL,CAAC;CACJ,CAAA;4BArDY,iBAAiB;IAD7B,IAAA,qBAAU,GAAE;IAOJ,WAAA,IAAA,iBAAM,EAAC,qBAAS,CAAC,MAAM,CAAC,CAAA;IACxB,WAAA,IAAA,iBAAM,EAAC,oBAAc,CAAC,UAAU,CAAC,CAAA;IAEjC,WAAA,IAAA,iBAAM,EAAC,2CAAoB,CAAC,kBAAkB,CAAC,CAAA;6CADnB,uBAAU;QAEV,uCAAkB;GAV1C,iBAAiB,CAqD7B"}
|
|
@@ -36,16 +36,19 @@ let UpdateLocationAddressTask = exports.UpdateLocationAddressTask = class Update
|
|
|
36
36
|
const now = Date.now();
|
|
37
37
|
try {
|
|
38
38
|
const address = await this.geocodeApi.getExtendedAddressFromPhoton(data.point.coordinates[1], data.point.coordinates[0]);
|
|
39
|
+
if (!address) {
|
|
40
|
+
this.log.info(data, `Address not found`);
|
|
41
|
+
return await this.postponeNextCheck(data.id);
|
|
42
|
+
}
|
|
39
43
|
await this.repository.update({ address, address_updated_at: now }, { where: { id: data.id }, fields: ["address", "address_updated_at"] });
|
|
40
44
|
}
|
|
41
45
|
catch (err) {
|
|
42
|
-
this.log.error(
|
|
46
|
+
this.log.error(err,
|
|
43
47
|
// eslint-disable-next-line max-len
|
|
44
|
-
`Error while updating address: [${data?.point?.coordinates[1]},${data?.point?.coordinates[0]}] with id ${data?.id}
|
|
45
|
-
await this.postponeNextCheck(data.id);
|
|
48
|
+
`Error while updating address: [${data?.point?.coordinates[1]},${data?.point?.coordinates[0]}] with id ${data?.id}`);
|
|
46
49
|
}
|
|
47
50
|
}
|
|
48
|
-
//
|
|
51
|
+
// Temporary solution to decrease the number of requests to the geocoding service. Should be solved in
|
|
49
52
|
// https://gitlab.com/operator-ict/golemio/code/modules/core/-/issues/120
|
|
50
53
|
async postponeNextCheck(parkingLocationId) {
|
|
51
54
|
try {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UpdateLocationAddressTask.js","sourceRoot":"","sources":["../../../../src/integration-engine/workers/tasks/UpdateLocationAddressTask.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,yEAAoE;AACpE,8FAAyF;AACzF,4CAAiE;AACjE,wEAA6G;AAE7G,wEAAqE;AACrE,8EAAqE;AACrE,yFAAsF;AACtF,mEAA2E;AAC3E,iEAAwE;AAGjE,IAAM,yBAAyB,uCAA/B,MAAM,yBAA0B,SAAQ,iCAAiC;IAK5E,YAC8B,GAAoB,EAE9C,UAAuC,EAEvC,UAAuD;QAEvD,KAAK,CAAC,oCAAwB,CAAC,CAAC;QANE,QAAG,GAAH,GAAG,CAAS;QAE7B,eAAU,GAAV,UAAU,CAAY;QAEtB,eAAU,GAAV,UAAU,CAA4B;QAT3C,cAAS,GAAG,uBAAuB,CAAC;QACpC,aAAQ,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC,CAAC,KAAK;QAChC,WAAM,GAAG,mDAA6B,CAAC;IAUvD,CAAC;IACM,KAAK,CAAC,OAAO,CAAC,IAAyB;QAC1C,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;QAEvB,IAAI;YACA,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,UAAU,CAAC,4BAA4B,CAC9D,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC,CAAC,EACzB,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC,CAAC,CAC5B,CAAC;
|
|
1
|
+
{"version":3,"file":"UpdateLocationAddressTask.js","sourceRoot":"","sources":["../../../../src/integration-engine/workers/tasks/UpdateLocationAddressTask.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,yEAAoE;AACpE,8FAAyF;AACzF,4CAAiE;AACjE,wEAA6G;AAE7G,wEAAqE;AACrE,8EAAqE;AACrE,yFAAsF;AACtF,mEAA2E;AAC3E,iEAAwE;AAGjE,IAAM,yBAAyB,uCAA/B,MAAM,yBAA0B,SAAQ,iCAAiC;IAK5E,YAC8B,GAAoB,EAE9C,UAAuC,EAEvC,UAAuD;QAEvD,KAAK,CAAC,oCAAwB,CAAC,CAAC;QANE,QAAG,GAAH,GAAG,CAAS;QAE7B,eAAU,GAAV,UAAU,CAAY;QAEtB,eAAU,GAAV,UAAU,CAA4B;QAT3C,cAAS,GAAG,uBAAuB,CAAC;QACpC,aAAQ,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC,CAAC,KAAK;QAChC,WAAM,GAAG,mDAA6B,CAAC;IAUvD,CAAC;IACM,KAAK,CAAC,OAAO,CAAC,IAAyB;QAC1C,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;QAEvB,IAAI;YACA,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,UAAU,CAAC,4BAA4B,CAC9D,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC,CAAC,EACzB,IAA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AAM,EAAC,qBAAS,CAAC,MAAM,CAAC,CAAA;IACxB,WAAA,IAAA,iBAAM,EAAC,oBAAc,CAAC,UAAU,CAAC,CAAA;IAEjC,WAAA,IAAA,iBAAM,EAAC,2CAAoB,CAAC,0BAA0B,CAAC,CAAA;6CAD3B,uBAAU;QAEV,uDAA0B;GAVlD,yBAAyB,CAqDrC"}
|
|
@@ -813,7 +813,7 @@ Vybraným parkovištím může být nahrazena location za Multipolygon ze zdroje
|
|
|
813
813
|
- id
|
|
814
814
|
- POINT
|
|
815
815
|
- id je z tabulky parkings
|
|
816
|
-
- obohacuje id o adresu, která vychází z centroidu geometrie daného parkoviště a získává se z Photon API metodou `GeocodeApi.
|
|
816
|
+
- obohacuje id o adresu, která vychází z centroidu geometrie daného parkoviště a získává se z Photon API metodou `GeocodeApi.getExtendedAddressFromPhoton` v modulu Core
|
|
817
817
|
|
|
818
818
|
#### _UpdateLocationAddressTask_
|
|
819
819
|
|
|
@@ -823,7 +823,7 @@ Vybraným parkovištím může být nahrazena location za Multipolygon ze zdroje
|
|
|
823
823
|
- id
|
|
824
824
|
- POINT
|
|
825
825
|
- id je z tabulky parkings_location
|
|
826
|
-
- obohacuje id o adresu, která vychází z centroidu geometrie daného parkoviště a získává se z Photon API metodou `GeocodeApi.
|
|
826
|
+
- obohacuje id o adresu, která vychází z centroidu geometrie daného parkoviště a získává se z Photon API metodou `GeocodeApi.getExtendedAddressFromPhoton` v modulu Core
|
|
827
827
|
|
|
828
828
|
|
|
829
829
|
#### _UpdateAddressAndNameTask_
|
|
@@ -834,7 +834,7 @@ Vybraným parkovištím může být nahrazena location za Multipolygon ze zdroje
|
|
|
834
834
|
- id
|
|
835
835
|
- POINT
|
|
836
836
|
- id je z tabulky parkings s parking.source "ipr"
|
|
837
|
-
- obohacuje id o adresu, která vychází z centroidu geometrie daného parkoviště a získává se z Photon API metodou `GeocodeApi.
|
|
837
|
+
- obohacuje id o adresu, která vychází z centroidu geometrie daného parkoviště a získává se z Photon API metodou `GeocodeApi.getExtendedAddressFromPhoton` v modulu Core
|
|
838
838
|
|
|
839
839
|
#### _UpdateAllParkingAdresses_
|
|
840
840
|
|