@golemio/energetics 1.12.2-dev.2740931754 → 1.12.2-dev.2741327856

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.
Files changed (72) hide show
  1. package/db/example/00_clear_test_data.sql +5 -0
  2. package/db/example/06_eno.sql +11 -0
  3. package/db/example/08_ded_search.sql +25 -0
  4. package/db/migrations/postgresql/20260807092000-ded-building-search.js +53 -0
  5. package/db/migrations/postgresql/sqls/20260807092000-ded-building-search-down.sql +41 -0
  6. package/db/migrations/postgresql/sqls/20260807092000-ded-building-search-up.sql +262 -0
  7. package/db/scripts/ded_gid_mapping_mock_import.sql +82 -23
  8. package/dist/integration-engine/enapo/ioc/Di.js +5 -1
  9. package/dist/integration-engine/enapo/ioc/Di.js.map +1 -1
  10. package/dist/integration-engine/enapo/ioc/EnapoWorkerContainerToken.d.ts +2 -0
  11. package/dist/integration-engine/enapo/ioc/EnapoWorkerContainerToken.js +2 -0
  12. package/dist/integration-engine/enapo/ioc/EnapoWorkerContainerToken.js.map +1 -1
  13. package/dist/integration-engine/enapo/repositories/DedSearchIndexRepository.d.ts +7 -0
  14. package/dist/integration-engine/enapo/repositories/DedSearchIndexRepository.js +50 -0
  15. package/dist/integration-engine/enapo/repositories/DedSearchIndexRepository.js.map +1 -0
  16. package/dist/integration-engine/enapo/repositories/interfaces/IDedSearchIndexRepository.d.ts +7 -0
  17. package/dist/integration-engine/enapo/repositories/interfaces/IDedSearchIndexRepository.js +3 -0
  18. package/dist/integration-engine/enapo/repositories/interfaces/IDedSearchIndexRepository.js.map +1 -0
  19. package/dist/integration-engine/enapo/workers/EnapoWorker.js +1 -0
  20. package/dist/integration-engine/enapo/workers/EnapoWorker.js.map +1 -1
  21. package/dist/integration-engine/enapo/workers/task/DedSearchIndexRefreshTask.d.ts +21 -0
  22. package/dist/integration-engine/enapo/workers/task/DedSearchIndexRefreshTask.js +58 -0
  23. package/dist/integration-engine/enapo/workers/task/DedSearchIndexRefreshTask.js.map +1 -0
  24. package/dist/integration-engine/enapo/workers/task/EnoGeometryTask.d.ts +13 -1
  25. package/dist/integration-engine/enapo/workers/task/EnoGeometryTask.js +25 -2
  26. package/dist/integration-engine/enapo/workers/task/EnoGeometryTask.js.map +1 -1
  27. package/dist/output-gateway/constants/DedSearchWeights.d.ts +60 -0
  28. package/dist/output-gateway/constants/DedSearchWeights.js +42 -0
  29. package/dist/output-gateway/constants/DedSearchWeights.js.map +1 -0
  30. package/dist/output-gateway/controllers/v2/EnoBuildingsController.d.ts +6 -1
  31. package/dist/output-gateway/controllers/v2/EnoBuildingsController.js +29 -2
  32. package/dist/output-gateway/controllers/v2/EnoBuildingsController.js.map +1 -1
  33. package/dist/output-gateway/ioc/Di.js +5 -1
  34. package/dist/output-gateway/ioc/Di.js.map +1 -1
  35. package/dist/output-gateway/ioc/ModuleContainerToken.d.ts +2 -0
  36. package/dist/output-gateway/ioc/ModuleContainerToken.js +2 -0
  37. package/dist/output-gateway/ioc/ModuleContainerToken.js.map +1 -1
  38. package/dist/output-gateway/models/DedBuildingSearchViewModel.d.ts +30 -0
  39. package/dist/output-gateway/models/DedBuildingSearchViewModel.js +38 -0
  40. package/dist/output-gateway/models/DedBuildingSearchViewModel.js.map +1 -0
  41. package/dist/output-gateway/models/EnoBuildingDetailViewModel.d.ts +14 -0
  42. package/dist/output-gateway/models/EnoBuildingDetailViewModel.js +14 -0
  43. package/dist/output-gateway/models/EnoBuildingDetailViewModel.js.map +1 -1
  44. package/dist/output-gateway/models/interfaces/IDedBuildingSearchView.d.ts +24 -0
  45. package/dist/output-gateway/models/interfaces/IDedBuildingSearchView.js +3 -0
  46. package/dist/output-gateway/models/interfaces/IDedBuildingSearchView.js.map +1 -0
  47. package/dist/output-gateway/models/interfaces/IEnoBuildingDetailView.d.ts +14 -0
  48. package/dist/output-gateway/repositories/DedBuildingSearchRepository.d.ts +16 -0
  49. package/dist/output-gateway/repositories/DedBuildingSearchRepository.js +250 -0
  50. package/dist/output-gateway/repositories/DedBuildingSearchRepository.js.map +1 -0
  51. package/dist/output-gateway/repositories/interfaces/IDedBuildingSearchRow.d.ts +14 -0
  52. package/dist/output-gateway/repositories/interfaces/IDedBuildingSearchRow.js +3 -0
  53. package/dist/output-gateway/repositories/interfaces/IDedBuildingSearchRow.js.map +1 -0
  54. package/dist/output-gateway/routers/interfaces/IDedBuildingSearchResponse.d.ts +50 -0
  55. package/dist/output-gateway/routers/interfaces/IDedBuildingSearchResponse.js +3 -0
  56. package/dist/output-gateway/routers/interfaces/IDedBuildingSearchResponse.js.map +1 -0
  57. package/dist/output-gateway/routers/interfaces/IEnoBuildingDetailResponse.d.ts +23 -1
  58. package/dist/output-gateway/routers/interfaces/IEnoRegistrationUnit.d.ts +11 -0
  59. package/dist/output-gateway/routers/interfaces/IEnoRegistrationUnit.js +3 -0
  60. package/dist/output-gateway/routers/interfaces/IEnoRegistrationUnit.js.map +1 -0
  61. package/dist/output-gateway/routers/v2/V2EnoBuildingsRouter.d.ts +2 -0
  62. package/dist/output-gateway/routers/v2/V2EnoBuildingsRouter.js +5 -0
  63. package/dist/output-gateway/routers/v2/V2EnoBuildingsRouter.js.map +1 -1
  64. package/dist/output-gateway/transformations/DedBuildingSearchTransformation.d.ts +11 -0
  65. package/dist/output-gateway/transformations/DedBuildingSearchTransformation.js +57 -0
  66. package/dist/output-gateway/transformations/DedBuildingSearchTransformation.js.map +1 -0
  67. package/dist/output-gateway/transformations/EnoBuildingDetailTransformation.d.ts +4 -0
  68. package/dist/output-gateway/transformations/EnoBuildingDetailTransformation.js +44 -1
  69. package/dist/output-gateway/transformations/EnoBuildingDetailTransformation.js.map +1 -1
  70. package/docs/implementation_documentation.md +49 -0
  71. package/docs/openapi-output.yaml +291 -0
  72. package/package.json +1 -1
@@ -0,0 +1,50 @@
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.DedSearchIndexRepository = void 0;
16
+ const constants_1 = require("../../../schema-definitions/constants");
17
+ const CoreToken_1 = require("@golemio/core/dist/helpers/ioc/CoreToken");
18
+ const golemio_errors_1 = require("@golemio/core/dist/shared/golemio-errors");
19
+ const sequelize_1 = require("@golemio/core/dist/shared/sequelize");
20
+ const tsyringe_1 = require("@golemio/core/dist/shared/tsyringe");
21
+ /**
22
+ * CONCURRENTLY keeps the search endpoint served during the rebuild - it relies on the unique index
23
+ * on gid created by the migration. It must not run inside a transaction, which is why this statement
24
+ * is issued on the plain (autocommit) connection and never wrapped in one.
25
+ *
26
+ * Two overlapping refreshes are serialised by Postgres itself and the second one simply redoes the
27
+ * work; with a single consumer on the queue that is harmless. Should this queue ever be scaled out,
28
+ * take an advisory lock here and skip the refresh when it is not granted.
29
+ */
30
+ const REFRESH_STATEMENT = `REFRESH MATERIALIZED VIEW CONCURRENTLY ${constants_1.PG_SCHEMA}.mv_ded_building_search`;
31
+ let DedSearchIndexRepository = class DedSearchIndexRepository {
32
+ constructor(connector) {
33
+ this.connector = connector;
34
+ }
35
+ async refresh() {
36
+ try {
37
+ await this.connector.getConnection().query(REFRESH_STATEMENT, { type: sequelize_1.QueryTypes.RAW });
38
+ }
39
+ catch (err) {
40
+ throw new golemio_errors_1.GeneralError("Failed to refresh the DeD building search index.", this.constructor.name, err);
41
+ }
42
+ }
43
+ };
44
+ exports.DedSearchIndexRepository = DedSearchIndexRepository;
45
+ exports.DedSearchIndexRepository = DedSearchIndexRepository = __decorate([
46
+ (0, tsyringe_1.injectable)(),
47
+ __param(0, (0, tsyringe_1.inject)(CoreToken_1.CoreToken.PostgresConnector)),
48
+ __metadata("design:paramtypes", [Object])
49
+ ], DedSearchIndexRepository);
50
+ //# sourceMappingURL=DedSearchIndexRepository.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DedSearchIndexRepository.js","sourceRoot":"","sources":["../../../../src/integration-engine/enapo/repositories/DedSearchIndexRepository.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,qEAA2C;AAE3C,wEAAqE;AACrE,6EAAwE;AACxE,mEAAiE;AACjE,iEAAwE;AAGxE;;;;;;;;GAQG;AACH,MAAM,iBAAiB,GAAG,0CAA0C,qBAAS,yBAAyB,CAAC;AAGhG,IAAM,wBAAwB,GAA9B,MAAM,wBAAwB;IACjC,YAAyD,SAA6B;QAA7B,cAAS,GAAT,SAAS,CAAoB;IAAG,CAAC;IAEnF,KAAK,CAAC,OAAO;QAChB,IAAI,CAAC;YACD,MAAM,IAAI,CAAC,SAAS,CAAC,aAAa,EAAE,CAAC,KAAK,CAAC,iBAAiB,EAAE,EAAE,IAAI,EAAE,sBAAU,CAAC,GAAG,EAAE,CAAC,CAAC;QAC5F,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACX,MAAM,IAAI,6BAAY,CAAC,kDAAkD,EAAE,IAAI,CAAC,WAAW,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;QAC3G,CAAC;IACL,CAAC;CACJ,CAAA;AAVY,4DAAwB;mCAAxB,wBAAwB;IADpC,IAAA,qBAAU,GAAE;IAEI,WAAA,IAAA,iBAAM,EAAC,qBAAS,CAAC,iBAAiB,CAAC,CAAA;;GADvC,wBAAwB,CAUpC"}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Rebuild contract of the DeD building search index. The refresh takes no parameters and always
3
+ * rebuilds the whole materialized view, so there is nothing to return.
4
+ */
5
+ export interface IDedSearchIndexRepository {
6
+ refresh(): Promise<void>;
7
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=IDedSearchIndexRepository.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IDedSearchIndexRepository.js","sourceRoot":"","sources":["../../../../../src/integration-engine/enapo/repositories/interfaces/IDedSearchIndexRepository.ts"],"names":[],"mappings":""}
@@ -23,6 +23,7 @@ class EnapoWorker extends integration_engine_1.AbstractWorker {
23
23
  this.registerTask(Di_1.EnapoContainer.resolve(EnapoWorkerContainerToken_1.EnapoWorkerContainerToken.EnapoPpasDistributionTask));
24
24
  this.registerTask(Di_1.EnapoContainer.resolve(EnapoWorkerContainerToken_1.EnapoWorkerContainerToken.EnapoPpasCommercialTask));
25
25
  this.registerTask(Di_1.EnapoContainer.resolve(EnapoWorkerContainerToken_1.EnapoWorkerContainerToken.PorsennaDistributionTask));
26
+ this.registerTask(Di_1.EnapoContainer.resolve(EnapoWorkerContainerToken_1.EnapoWorkerContainerToken.DedSearchIndexRefreshTask));
26
27
  }
27
28
  }
28
29
  exports.EnapoWorker = EnapoWorker;
@@ -1 +1 @@
1
- {"version":3,"file":"EnapoWorker.js","sourceRoot":"","sources":["../../../../src/integration-engine/enapo/workers/EnapoWorker.ts"],"names":[],"mappings":";;;AAAA,8EAAuE;AAEvE,4CAAiD;AACjD,kCAA2C;AAC3C,gFAA6E;AAE7E,MAAa,WAAY,SAAQ,mCAAc;IAG3C;QACI,KAAK,EAAE,CAAC;QAHF,SAAI,GAAG,6BAAiB,CAAC;QAiB5B,iBAAY,GAAG,CAAC,IAAW,EAAQ,EAAE;YACxC,KAAK,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC;YACzB,IAAI,CAAC,WAAW,GAAG,IAAI,C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../repositories/interfaces/IDedSearchIndexRepository";
2
+ import { AbstractTask } from "@golemio/core/dist/integration-engine/workers/AbstractTask";
3
+ /**
4
+ * Rebuilds mv_ded_building_search, the index behind the DeD building search endpoint.
5
+ *
6
+ * Runs on a nightly cron and is additionally triggered by the ENO tasks that change what the index
7
+ * contains, so a freshly ingested building becomes searchable the same day. The refresh takes no
8
+ * parameters - it always rebuilds the whole index - so there is nothing to validate and the schema
9
+ * is deliberately undefined.
10
+ *
11
+ * The TTL is short on purpose: a queued refresh that waited longer than half an hour has been
12
+ * superseded by a newer one and is not worth running.
13
+ */
14
+ export declare class DedSearchIndexRefreshTask extends AbstractTask<Record<string, never>> {
15
+ private dedSearchIndexRepository;
16
+ queueName: string;
17
+ queueTtl: number;
18
+ protected schema: undefined;
19
+ constructor(dedSearchIndexRepository: IDedSearchIndexRepository);
20
+ execute(): Promise<void>;
21
+ }
@@ -0,0 +1,58 @@
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.DedSearchIndexRefreshTask = void 0;
16
+ const constants_1 = require("../../constants");
17
+ const EnapoWorkerContainerToken_1 = require("../../ioc/EnapoWorkerContainerToken");
18
+ const AbstractTask_1 = require("@golemio/core/dist/integration-engine/workers/AbstractTask");
19
+ const golemio_errors_1 = require("@golemio/core/dist/shared/golemio-errors");
20
+ const tsyringe_1 = require("@golemio/core/dist/shared/tsyringe");
21
+ /**
22
+ * Rebuilds mv_ded_building_search, the index behind the DeD building search endpoint.
23
+ *
24
+ * Runs on a nightly cron and is additionally triggered by the ENO tasks that change what the index
25
+ * contains, so a freshly ingested building becomes searchable the same day. The refresh takes no
26
+ * parameters - it always rebuilds the whole index - so there is nothing to validate and the schema
27
+ * is deliberately undefined.
28
+ *
29
+ * The TTL is short on purpose: a queued refresh that waited longer than half an hour has been
30
+ * superseded by a newer one and is not worth running.
31
+ */
32
+ let DedSearchIndexRefreshTask = class DedSearchIndexRefreshTask extends AbstractTask_1.AbstractTask {
33
+ constructor(dedSearchIndexRepository) {
34
+ super(constants_1.ENAPO_WORKER_NAME);
35
+ this.dedSearchIndexRepository = dedSearchIndexRepository;
36
+ this.queueName = "refreshDedSearchIndex";
37
+ this.queueTtl = 30 * 60 * 1000;
38
+ this.schema = undefined;
39
+ }
40
+ async execute() {
41
+ try {
42
+ await this.dedSearchIndexRepository.refresh();
43
+ }
44
+ catch (err) {
45
+ if (err instanceof golemio_errors_1.AbstractGolemioError) {
46
+ throw err;
47
+ }
48
+ throw new golemio_errors_1.GeneralError("Failed to refresh the DeD building search index.", this.constructor.name, err);
49
+ }
50
+ }
51
+ };
52
+ exports.DedSearchIndexRefreshTask = DedSearchIndexRefreshTask;
53
+ exports.DedSearchIndexRefreshTask = DedSearchIndexRefreshTask = __decorate([
54
+ (0, tsyringe_1.injectable)(),
55
+ __param(0, (0, tsyringe_1.inject)(EnapoWorkerContainerToken_1.EnapoWorkerContainerToken.DedSearchIndexRepository)),
56
+ __metadata("design:paramtypes", [Object])
57
+ ], DedSearchIndexRefreshTask);
58
+ //# sourceMappingURL=DedSearchIndexRefreshTask.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DedSearchIndexRefreshTask.js","sourceRoot":"","sources":["../../../../../src/integration-engine/enapo/workers/task/DedSearchIndexRefreshTask.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,+CAAwD;AACxD,mFAAoF;AAEpF,6FAA0F;AAC1F,6EAA8F;AAC9F,iEAAwE;AAExE;;;;;;;;;;GAUG;AAEI,IAAM,yBAAyB,GAA/B,MAAM,yBAA0B,SAAQ,2BAAmC;IAK9E,YAEI,wBAA2D;QAE3D,KAAK,CAAC,6BAAiB,CAAC,CAAC;QAFjB,6BAAwB,GAAxB,wBAAwB,CAA2B;QANxD,cAAS,GAAG,uBAAuB,CAAC;QACpC,aAAQ,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;QACvB,WAAM,GAAG,SAAS,CAAC;IAO7B,CAAC;IAEM,KAAK,CAAC,OAAO;QAChB,IAAI,CAAC;YACD,MAAM,IAAI,CAAC,wBAAwB,CAAC,OAAO,EAAE,CAAC;QAClD,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACX,IAAI,GAAG,YAAY,qCAAoB,EAAE,CAAC;gBACtC,MAAM,GAAG,CAAC;YACd,CAAC;YAED,MAAM,IAAI,6BAAY,CAAC,kDAAkD,EAAE,IAAI,CAAC,WAAW,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;QAC3G,CAAC;IACL,CAAC;CACJ,CAAA;AAvBY,8DAAyB;oCAAzB,yBAAyB;IADrC,IAAA,qBAAU,GAAE;IAOJ,WAAA,IAAA,iBAAM,EAAC,qDAAyB,CAAC,wBAAwB,CAAC,CAAA;;GANtD,yBAAyB,CAuBrC"}
@@ -1,15 +1,27 @@
1
1
  import { EnoDatasourceFactory } from "../../datasources/eno/EnoDatasourceFactory";
2
2
  import { EnoGeometryRepository } from "../../repositories/eno/EnoGeometryRepository";
3
+ import { ILogger } from "@golemio/core/dist/helpers/logger/LoggerProvider";
3
4
  import { AbstractTask } from "@golemio/core/dist/integration-engine/workers/AbstractTask";
4
5
  import { IEnoGeometryTaskInput } from "../interfaces/IEnoGeometryTaskInput";
5
6
  import { EnoGeometryTaskInputSchema } from "../schema/EnoGeometryTaskInputSchema";
6
7
  export declare class EnoGeometryTask extends AbstractTask<IEnoGeometryTaskInput> {
7
8
  private enoDatasourceFactory;
8
9
  private enoGeometryRepository;
10
+ private logger;
9
11
  queueName: string;
10
12
  queueTtl: number;
11
13
  schema: typeof EnoGeometryTaskInputSchema;
12
14
  private static readonly BATCH_SIZE;
13
- constructor(enoDatasourceFactory: EnoDatasourceFactory, enoGeometryRepository: EnoGeometryRepository);
15
+ constructor(enoDatasourceFactory: EnoDatasourceFactory, enoGeometryRepository: EnoGeometryRepository, logger: ILogger);
14
16
  execute(data: IEnoGeometryTaskInput): Promise<void>;
17
+ /**
18
+ * Geometry is the last step of both ENO chains (buildings and structures both trigger it), so the
19
+ * search index is rebuilt here rather than after each individual ENO task.
20
+ *
21
+ * A failed publish is logged and swallowed on purpose. The geometry is already persisted, so
22
+ * letting the error propagate would nack the message and re-run the whole ENO geometry fetch -
23
+ * expensive SOAP work that already succeeded - because of a lost notification. The nightly cron
24
+ * is the fallback; this only has to stop the failure being silent.
25
+ */
26
+ private triggerSearchIndexRefresh;
15
27
  }
@@ -20,16 +20,19 @@ const EnoOperationEnum_1 = require("../../datasources/eno/EnoOperationEnum");
20
20
  const EnapoWorkerContainerToken_1 = require("../../ioc/EnapoWorkerContainerToken");
21
21
  const EnoGeometryRepository_1 = require("../../repositories/eno/EnoGeometryRepository");
22
22
  const EnoGeometryTransformation_1 = require("../../transformations/eno/EnoGeometryTransformation");
23
+ const CoreToken_1 = require("@golemio/core/dist/helpers/ioc/CoreToken");
24
+ const integration_engine_1 = require("@golemio/core/dist/integration-engine");
23
25
  const AbstractTask_1 = require("@golemio/core/dist/integration-engine/workers/AbstractTask");
24
26
  const golemio_errors_1 = require("@golemio/core/dist/shared/golemio-errors");
25
27
  const tsyringe_1 = require("@golemio/core/dist/shared/tsyringe");
26
28
  const EnoGeometryTaskInputSchema_1 = require("../schema/EnoGeometryTaskInputSchema");
27
29
  const Chunker_1 = require("../../helpers/Chunker");
28
30
  let EnoGeometryTask = EnoGeometryTask_1 = class EnoGeometryTask extends AbstractTask_1.AbstractTask {
29
- constructor(enoDatasourceFactory, enoGeometryRepository) {
31
+ constructor(enoDatasourceFactory, enoGeometryRepository, logger) {
30
32
  super(constants_1.ENAPO_WORKER_NAME);
31
33
  this.enoDatasourceFactory = enoDatasourceFactory;
32
34
  this.enoGeometryRepository = enoGeometryRepository;
35
+ this.logger = logger;
33
36
  this.queueName = "processEnoGeometry";
34
37
  this.queueTtl = 60 * 60 * 1000;
35
38
  this.schema = EnoGeometryTaskInputSchema_1.EnoGeometryTaskInputSchema;
@@ -49,6 +52,7 @@ let EnoGeometryTask = EnoGeometryTask_1 = class EnoGeometryTask extends Abstract
49
52
  await this.enoGeometryRepository.bulkSave(transformedData);
50
53
  }
51
54
  }
55
+ await this.triggerSearchIndexRefresh();
52
56
  }
53
57
  catch (err) {
54
58
  if (err instanceof golemio_errors_1.AbstractGolemioError) {
@@ -57,6 +61,24 @@ let EnoGeometryTask = EnoGeometryTask_1 = class EnoGeometryTask extends Abstract
57
61
  throw new golemio_errors_1.GeneralError(`Failed to save ENO geometry data (source: ${data.source}, gidCount: ${data.listGid.length})`, this.constructor.name, err);
58
62
  }
59
63
  }
64
+ /**
65
+ * Geometry is the last step of both ENO chains (buildings and structures both trigger it), so the
66
+ * search index is rebuilt here rather than after each individual ENO task.
67
+ *
68
+ * A failed publish is logged and swallowed on purpose. The geometry is already persisted, so
69
+ * letting the error propagate would nack the message and re-run the whole ENO geometry fetch -
70
+ * expensive SOAP work that already succeeded - because of a lost notification. The nightly cron
71
+ * is the fallback; this only has to stop the failure being silent.
72
+ */
73
+ async triggerSearchIndexRefresh() {
74
+ try {
75
+ await integration_engine_1.QueueManager.sendMessageToExchange(this.queuePrefix, "refreshDedSearchIndex", {});
76
+ }
77
+ catch (err) {
78
+ this.logger.error(`${this.constructor.name}: Failed to trigger the DeD search index refresh: ` +
79
+ (err instanceof Error ? err.message : String(err)));
80
+ }
81
+ }
60
82
  };
61
83
  exports.EnoGeometryTask = EnoGeometryTask;
62
84
  EnoGeometryTask.BATCH_SIZE = 1000;
@@ -64,7 +86,8 @@ exports.EnoGeometryTask = EnoGeometryTask = EnoGeometryTask_1 = __decorate([
64
86
  (0, tsyringe_1.injectable)(),
65
87
  __param(0, (0, tsyringe_1.inject)(EnapoWorkerContainerToken_1.EnapoWorkerContainerToken.EnoDatasourceFactory)),
66
88
  __param(1, (0, tsyringe_1.inject)(EnapoWorkerContainerToken_1.EnapoWorkerContainerToken.EnoGeometryRepository)),
89
+ __param(2, (0, tsyringe_1.inject)(CoreToken_1.CoreToken.Logger)),
67
90
  __metadata("design:paramtypes", [EnoDatasourceFactory_1.EnoDatasourceFactory,
68
- EnoGeometryRepository_1.EnoGeometryRepository])
91
+ EnoGeometryRepository_1.EnoGeometryRepository, Object])
69
92
  ], EnoGeometryTask);
70
93
  //# sourceMappingURL=EnoGeometryTask.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"EnoGeometryTask.js","sourceRoot":"","sources":["../../../../../src/integration-engine/enapo/workers/task/EnoGeometryTask.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,+CAAqF;AACrF,qFAAoG;AACpG,6EAAoF;AACpF,mFAAoF;AACpF,wFAAyF;AACzF,mGAAoG;AACpG,6FAA0F;AAC1F,6EAA8F;AAC9F,iEAAwE;AAExE,qFAAkF;AAClF,mDAAmD;AAG5C,IAAM,eAAe,uBAArB,MAAM,eAAgB,SAAQ,2BAAmC;IAMpE,YAC4D,oBAAkD,EACjD,qBAAoD;QAE7G,KAAK,CAAC,6BAAiB,CAAC,CAAC;QAHuC,yBAAoB,GAApB,oBAAoB,CAAsB;QACzC,0BAAqB,GAArB,qBAAqB,CAAuB;QAP1G,cAAS,GAAG,oBAAoB,CAAC;QACjC,aAAQ,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;Q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M,EAAC,qDAAyB,CAAC,oBAAoB,CAAC,CAAA;IACtD,WAAA,IAAA,iBAAM,EAAC,qDAAyB,CAAC,qBAAqB,CAAC,CAAA;qCAD8B,2CAAoB;QAClB,6CAAqB;GARxG,eAAe,CAyC3B"}
1
+ {"version":3,"file":"EnoGeometryTask.js","sourceRoot":"","sources":["../../../../../src/integration-engine/enapo/workers/task/EnoGeometryTask.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,+CAAqF;AACrF,qFAAoG;AACpG,6EAAoF;AACpF,mFAAoF;AACpF,wFAAyF;AACzF,mGAAoG;AACpG,wEAAqE;AAErE,8EAAqE;AACrE,6FAA0F;AAC1F,6EAA8F;AAC9F,iEAAwE;AAExE,qFAAkF;AAClF,mDAAmD;AAG5C,IAAM,eAAe,uBAArB,MAAM,eAAgB,SAAQ,2BAAmC;IAMpE,YAC4D,oBAAkD,EACjD,qBAAoD,EACnF,MAAuB;QAEjD,KAAK,CAAC,6BAAiB,CAAC,CAAC;QAJuC,yBAAoB,GAApB,oBAAoB,CAAsB;QACzC,0BAAqB,GAArB,qBAAqB,CAAuB;QAC3E,WAAM,GAAN,MAAM,CAAS;QAR9C,cAAS,GAAG,oBAAoB,CAAC;QACjC,aAAQ,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;QAC1B,WAAM,GAAG,uDAA0B,CAAC;IAS3C,CAAC;IAEM,KAAK,CAAC,OAAO,CAAC,IAA2B;QAC5C,IAAI,CAAC;YACD,MAAM,UAAU,GAAG,IAAI,CAAC,oBAAoB,CAAC,aAAa,CAAC,mCAAY,CAAC,QAAQ,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;YAC/F,MAAM,cAAc,GAAG,IAAI,qDAAyB,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;YAClE,MAAM,OAAO,GAAG,gBAAM,CAAC,UAAU,CAAC,IAAI,CAAC,OAAO,EAAE,iBAAe,CAAC,UAAU,CAAC,CAAC;YAE5E,KAAK,MA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AJjC,eAAe;IAD3B,IAAA,qBAAU,GAAE;IAQJ,WAAA,IAAA,iBAAM,EAAC,qDAAyB,CAAC,oBAAoB,CAAC,CAAA;IACtD,WAAA,IAAA,iBAAM,EAAC,qDAAyB,CAAC,qBAAqB,CAAC,CAAA;IACvD,WAAA,IAAA,iBAAM,EAAC,qBAAS,CAAC,MAAM,CAAC,CAAA;qCAF6D,2CAAoB;QAClB,6CAAqB;GARxG,eAAe,CAgE3B"}
@@ -0,0 +1,60 @@
1
+ /**
2
+ * Ranking weights of the DeD building search.
3
+ *
4
+ * There are two layers and they are deliberately separate:
5
+ *
6
+ * 1. The tsvector weight classes (A/B/C/D) are baked into mv_ded_building_search by the migration -
7
+ * A = name + designation + registration unit (evidenční jednotka) name, B = main address,
8
+ * C = secondary addresses, D = identifiers + registration unit code. Changing those requires a
9
+ * migration and a refresh. tsRank below is the weight array ts_rank_cd applies to them, in
10
+ * Postgres order {D, C, B, A}.
11
+ * 2. Everything else is applied at query time and can be retuned without a release.
12
+ */
13
+ export interface IDedSearchWeights {
14
+ /** ts_rank_cd weight array in Postgres order {D, C, B, A}. */
15
+ readonly tsRank: readonly [number, number, number, number];
16
+ /** Share of the full-text rank in the final score. */
17
+ readonly ftsRank: number;
18
+ /** Share of the trigram similarity against the building name. */
19
+ readonly nameTrigram: number;
20
+ /** Share of the trigram similarity against the addresses. */
21
+ readonly addressTrigram: number;
22
+ /** Flat bonus when the name starts with the query. */
23
+ readonly prefixBonus: number;
24
+ /** Tie-break bonus for buildings the map can zoom to. */
25
+ readonly geometryBonus: number;
26
+ /** Tie-break bonus for buildings with at least one active consumption point. */
27
+ readonly activePointsBonus: number;
28
+ /** Multiplier applied to GIDs with no eno_budova record. */
29
+ readonly missingBuildingPenalty: number;
30
+ /** Results scoring below this are dropped. Exact matches always pass. */
31
+ readonly minScore: number;
32
+ }
33
+ /**
34
+ * Reasoning for the defaults:
35
+ * - tsRank {0.05, 0.2, 0.5, 1.0}: the name is the most distinctive field, the main address is worth
36
+ * half of it so a name hit outranks an address hit, secondary addresses stay at the Postgres
37
+ * default, and identifiers sit near zero because identifier queries are answered by the exact
38
+ * tier - class D only helps partially typed identifiers surface at all.
39
+ * - ftsRank 0.45: the primary relevance signal, but under half so it cannot alone dominate.
40
+ * - nameTrigram 0.30: typing Czech without diacritics is the normal case, not an error case.
41
+ * - addressTrigram 0.15: half of the name weight, mirroring the A/B ratio of layer 1.
42
+ * - prefixBonus 0.30: in a suggest box, what was typed at the start is strong evidence of intent.
43
+ * - geometryBonus / activePointsBonus 0.05: tie-breaks only, never enough to reorder real relevance.
44
+ * - missingBuildingPenalty 0.80: mapping-only GIDs must stay findable but rank below described
45
+ * buildings; multiplicative so it scales with confidence.
46
+ */
47
+ export declare const DED_SEARCH_WEIGHTS_DEFAULT: IDedSearchWeights;
48
+ /** Score assigned to an exact identifier or GID match. Its own tier, not a weight. */
49
+ export declare const DED_SEARCH_EXACT_SCORE = 1000;
50
+ /**
51
+ * Size of the candidate pool each non-exact tier contributes before scoring. Both tiers rank inside
52
+ * their own CTE and truncate deterministically, so raising these widens what can be scored at the
53
+ * cost of running the unindexable ranking functions over more rows.
54
+ */
55
+ export declare const DED_SEARCH_FTS_CANDIDATES = 100;
56
+ /** Rows admitted to the candidate pool from the trigram nearest-neighbour tier. */
57
+ export declare const DED_SEARCH_FUZZY_CANDIDATES = 50;
58
+ export declare const DED_SEARCH_LIMIT_DEFAULT = 10;
59
+ export declare const DED_SEARCH_LIMIT_MAX = 50;
60
+ export declare const DED_SEARCH_QUERY_MAX_LENGTH = 100;
@@ -0,0 +1,42 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DED_SEARCH_QUERY_MAX_LENGTH = exports.DED_SEARCH_LIMIT_MAX = exports.DED_SEARCH_LIMIT_DEFAULT = exports.DED_SEARCH_FUZZY_CANDIDATES = exports.DED_SEARCH_FTS_CANDIDATES = exports.DED_SEARCH_EXACT_SCORE = exports.DED_SEARCH_WEIGHTS_DEFAULT = void 0;
4
+ /**
5
+ * Reasoning for the defaults:
6
+ * - tsRank {0.05, 0.2, 0.5, 1.0}: the name is the most distinctive field, the main address is worth
7
+ * half of it so a name hit outranks an address hit, secondary addresses stay at the Postgres
8
+ * default, and identifiers sit near zero because identifier queries are answered by the exact
9
+ * tier - class D only helps partially typed identifiers surface at all.
10
+ * - ftsRank 0.45: the primary relevance signal, but under half so it cannot alone dominate.
11
+ * - nameTrigram 0.30: typing Czech without diacritics is the normal case, not an error case.
12
+ * - addressTrigram 0.15: half of the name weight, mirroring the A/B ratio of layer 1.
13
+ * - prefixBonus 0.30: in a suggest box, what was typed at the start is strong evidence of intent.
14
+ * - geometryBonus / activePointsBonus 0.05: tie-breaks only, never enough to reorder real relevance.
15
+ * - missingBuildingPenalty 0.80: mapping-only GIDs must stay findable but rank below described
16
+ * buildings; multiplicative so it scales with confidence.
17
+ */
18
+ exports.DED_SEARCH_WEIGHTS_DEFAULT = {
19
+ tsRank: [0.05, 0.2, 0.5, 1.0],
20
+ ftsRank: 0.45,
21
+ nameTrigram: 0.3,
22
+ addressTrigram: 0.15,
23
+ prefixBonus: 0.3,
24
+ geometryBonus: 0.05,
25
+ activePointsBonus: 0.05,
26
+ missingBuildingPenalty: 0.8,
27
+ minScore: 0.08,
28
+ };
29
+ /** Score assigned to an exact identifier or GID match. Its own tier, not a weight. */
30
+ exports.DED_SEARCH_EXACT_SCORE = 1000;
31
+ /**
32
+ * Size of the candidate pool each non-exact tier contributes before scoring. Both tiers rank inside
33
+ * their own CTE and truncate deterministically, so raising these widens what can be scored at the
34
+ * cost of running the unindexable ranking functions over more rows.
35
+ */
36
+ exports.DED_SEARCH_FTS_CANDIDATES = 100;
37
+ /** Rows admitted to the candidate pool from the trigram nearest-neighbour tier. */
38
+ exports.DED_SEARCH_FUZZY_CANDIDATES = 50;
39
+ exports.DED_SEARCH_LIMIT_DEFAULT = 10;
40
+ exports.DED_SEARCH_LIMIT_MAX = 50;
41
+ exports.DED_SEARCH_QUERY_MAX_LENGTH = 100;
42
+ //# sourceMappingURL=DedSearchWeights.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DedSearchWeights.js","sourceRoot":"","sources":["../../../src/output-gateway/constants/DedSearchWeights.ts"],"names":[],"mappings":";;;AAiCA;;;;;;;;;;;;;GAaG;AACU,QAAA,0BAA0B,GAAsB;IACzD,MAAM,EAAE,CAAC,IAAI,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC;IAC7B,OAAO,EAAE,IAAI;IACb,WAAW,EAAE,GAAG;IAChB,cAAc,EAAE,IAAI;IACpB,WAAW,EAAE,GAAG;IAChB,aAAa,EAAE,IAAI;IACnB,iBAAiB,EAAE,IAAI;IACvB,sBAAsB,EAAE,GAAG;IAC3B,QAAQ,EAAE,IAAI;CACjB,CAAC;AAEF,sFAAsF;AACzE,QAAA,sBAAsB,GAAG,IAAI,CAAC;AAE3C;;;;GAIG;AACU,QAAA,yBAAyB,GAAG,GAAG,CAAC;AAC7C,mFAAmF;AACtE,QAAA,2BAA2B,GAAG,EAAE,CAAC;AAEjC,QAAA,wBAAwB,GAAG,EAAE,CAAC;AAC9B,QAAA,oBAAoB,GAAG,EAAE,CAAC;AAC1B,QAAA,2BAA2B,GAAG,GAAG,CAAC"}
@@ -1,11 +1,16 @@
1
1
  import { AccessLimitationRepository } from "../../repositories/AccessLimitationRepository";
2
+ import { DedBuildingSearchRepository } from "../../repositories/DedBuildingSearchRepository";
2
3
  import { EnoBuildingDetailRepository } from "../../repositories/EnoBuildingDetailRepository";
4
+ import { DedBuildingSearchTransformation } from "../../transformations/DedBuildingSearchTransformation";
3
5
  import { EnoBuildingDetailTransformation } from "../../transformations/EnoBuildingDetailTransformation";
4
6
  import { NextFunction, Request, Response } from "@golemio/core/dist/shared/express";
5
7
  import { AbstractController } from "./AbstractController";
6
8
  export declare class EnoBuildingsController extends AbstractController {
7
9
  private detailRepository;
8
10
  private transformation;
9
- constructor(accessLimitationRepository: AccessLimitationRepository, detailRepository: EnoBuildingDetailRepository, transformation: EnoBuildingDetailTransformation);
11
+ private searchRepository;
12
+ private searchTransformation;
13
+ constructor(accessLimitationRepository: AccessLimitationRepository, detailRepository: EnoBuildingDetailRepository, transformation: EnoBuildingDetailTransformation, searchRepository: DedBuildingSearchRepository, searchTransformation: DedBuildingSearchTransformation);
14
+ search: (req: Request, res: Response, next: NextFunction) => Promise<void>;
10
15
  getOne: (req: Request, res: Response, next: NextFunction) => Promise<void>;
11
16
  }
@@ -13,18 +13,41 @@ var __param = (this && this.__param) || function (paramIndex, decorator) {
13
13
  };
14
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
15
  exports.EnoBuildingsController = void 0;
16
+ const DedSearchWeights_1 = require("../../constants/DedSearchWeights");
16
17
  const ModuleContainerToken_1 = require("../../ioc/ModuleContainerToken");
17
18
  const AccessLimitationRepository_1 = require("../../repositories/AccessLimitationRepository");
19
+ const DedBuildingSearchRepository_1 = require("../../repositories/DedBuildingSearchRepository");
18
20
  const EnoBuildingDetailRepository_1 = require("../../repositories/EnoBuildingDetailRepository");
21
+ const DedBuildingSearchTransformation_1 = require("../../transformations/DedBuildingSearchTransformation");
19
22
  const EnoBuildingDetailTransformation_1 = require("../../transformations/EnoBuildingDetailTransformation");
20
23
  const golemio_errors_1 = require("@golemio/core/dist/shared/golemio-errors");
21
24
  const tsyringe_1 = require("@golemio/core/dist/shared/tsyringe");
22
25
  const AbstractController_1 = require("./AbstractController");
23
26
  let EnoBuildingsController = class EnoBuildingsController extends AbstractController_1.AbstractController {
24
- constructor(accessLimitationRepository, detailRepository, transformation) {
27
+ constructor(accessLimitationRepository, detailRepository, transformation, searchRepository, searchTransformation) {
25
28
  super(accessLimitationRepository);
26
29
  this.detailRepository = detailRepository;
27
30
  this.transformation = transformation;
31
+ this.searchRepository = searchRepository;
32
+ this.searchTransformation = searchTransformation;
33
+ this.search = async (req, res, next) => {
34
+ try {
35
+ const query = req.query.q.trim();
36
+ // The router's .toInt() has already converted this; Number() only restates that for the
37
+ // type system, which types req.query as string | ParsedQs | arrays of either.
38
+ const limit = req.query.limit === undefined ? DedSearchWeights_1.DED_SEARCH_LIMIT_DEFAULT : Number(req.query.limit);
39
+ const rows = await this.searchRepository.Search(query, limit, DedSearchWeights_1.DED_SEARCH_WEIGHTS_DEFAULT, DedSearchWeights_1.DED_SEARCH_EXACT_SCORE);
40
+ const response = {
41
+ query,
42
+ matched_exactly: rows.some((row) => row.is_exact),
43
+ results: this.searchTransformation.transformArray(rows),
44
+ };
45
+ res.json(response);
46
+ }
47
+ catch (err) {
48
+ next(err);
49
+ }
50
+ };
28
51
  this.getOne = async (req, res, next) => {
29
52
  try {
30
53
  const paramGid = Array.isArray(req.params.gid) ? req.params.gid[0] : req.params.gid;
@@ -46,8 +69,12 @@ exports.EnoBuildingsController = EnoBuildingsController = __decorate([
46
69
  __param(0, (0, tsyringe_1.inject)(ModuleContainerToken_1.ModuleContainerToken.AccessLimitationRepository)),
47
70
  __param(1, (0, tsyringe_1.inject)(ModuleContainerToken_1.ModuleContainerToken.EnoBuildingDetailRepository)),
48
71
  __param(2, (0, tsyringe_1.inject)(ModuleContainerToken_1.ModuleContainerToken.EnoBuildingDetailTransformation)),
72
+ __param(3, (0, tsyringe_1.inject)(ModuleContainerToken_1.ModuleContainerToken.DedBuildingSearchRepository)),
73
+ __param(4, (0, tsyringe_1.inject)(ModuleContainerToken_1.ModuleContainerToken.DedBuildingSearchTransformation)),
49
74
  __metadata("design:paramtypes", [AccessLimitationRepository_1.AccessLimitationRepository,
50
75
  EnoBuildingDetailRepository_1.EnoBuildingDetailRepository,
51
- EnoBuildingDetailTransformation_1.EnoBuildingDetailTransformation])
76
+ EnoBuildingDetailTransformation_1.EnoBuildingDetailTransformation,
77
+ DedBuildingSearchRepository_1.DedBuildingSearchRepository,
78
+ DedBuildingSearchTransformation_1.DedBuildingSearchTransformation])
52
79
  ], EnoBuildingsController);
53
80
  //# sourceMappingURL=EnoBuildingsController.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"EnoBuildingsController.js","sourceRoot":"","sources":["../../../../src/output-gateway/controllers/v2/EnoBuildingsController.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,yEAAoE;AACpE,8FAAyF;AACzF,gGAA2F;AAC3F,2GAAsG;AAEtG,6EAAwE;AACxE,iEAAwE;AACxE,6DAA0D;AAGnD,IAAM,sBAAsB,GAA5B,MAAM,sBAAuB,SAAQ,uCAAkB;IAC1D,YAC6D,0BAAsD,EACrD,gBAAqD,EACjD,cAAuD;QAErH,KAAK,CAAC,0BAA0B,CAAC,CAAC;QAHgC,qBAAgB,GAAhB,gBAAgB,CAA6B;QACzC,mBAAc,GAAd,cAAc,CAAiC;QAKlH,WAAM,GAAG,KAAK,EAAE,GAAY,EAAE,GAAa,EAAE,IAAkB,EAAE,EAAE;YACtE,IAAI,CAAC;gBACD,MAAM,QAAQ,GAAG,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC;gBACpF,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,gBAAgB,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC;gBAE/D,IAAI,MAAM,KAAK,IAAI,EAAE,CAAC;oBAClB,MAAM,IAAI,6BAAY,CAAC,WAAW,EAAE,wBAAwB,EAAE,SAAS,EAAE,GAAG,CAAC,CAAC;gBAClF,CAAC;gBAED,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,cAAc,CAAC,gBAAgB,CAAC,MAAM,CAAC,CAAC,CAAC;YAC3D,CAAC;YAAC,OAAO,GAAG,EAAE,CAAC;gBACX,IAAI,CAAC,GAAG,CAAC,CAAC;YACd,CAAC;QACL,CAAC,CAAC;IAfF,CAAC;CAgBJ,CAAA;AAvBY,wDAAsB;iCAAtB,sBAAsB;IADlC,IAAA,qBAAU,GAAE;IAGJ,WAAA,IAAA,iBAAM,EAAC,2CAAoB,CAAC,0BAA0B,CAAC,CAAA;IACvD,WAAA,IAAA,iBAAM,EAAC,2CAAoB,CAAC,2BAA2B,CAAC,CAAA;IACxD,WAAA,IAAA,iBAAM,EAAC,2CAAoB,CAAC,+BAA+B,CAAC,CAAA;qCAFwB,uDAA0B;QAC3B,yDAA2B;QACzB,iEAA+B;GAJhH,sBAAsB,CAuBlC"}
1
+ {"version":3,"file":"EnoBuildingsController.js","sourceRoot":"","sources":["../../../../src/output-gateway/controllers/v2/EnoBuildingsController.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,uEAA8H;AAC9H,yEAAoE;AACpE,8FAAyF;AACzF,gGAA2F;AAC3F,gGAA2F;AAE3F,2GAAsG;AACtG,2GAAsG;AAEtG,6EAAwE;AACxE,iEAAwE;AACxE,6DAA0D;AAGnD,IAAM,sBAAsB,GAA5B,MAAM,sBAAuB,SAAQ,uCAAkB;IAC1D,YAC6D,0BAAsD,EACrD,gBAAqD,EACjD,cAAuD,EAC3D,gBAAqD,EAE/G,oBAA6D;QAE7D,KAAK,CAAC,0BAA0B,CAAC,CAAC;QANgC,qBAAgB,GAAhB,gBAAgB,CAA6B;QACzC,mBAAc,GAAd,cAAc,CAAiC;QACnD,qBAAgB,GAAhB,gBAAgB,CAA6B;QAEvG,yBAAoB,GAApB,oBAAoB,CAAiC;QAK1D,WAAM,GAAG,KAAK,EAAE,GAAY,EAAE,GAAa,EAAE,IAAkB,EAAE,EAAE;YACtE,IAAI,CAAC;gBACD,MAAM,KAAK,GAAI,GAAG,CAAC,KAAK,CAAC,CAAY,CAAC,IAAI,EAAE,CAAC;gBAC7C,wFAAwF;gBACxF,8EAA8E;gBAC9E,MAAM,KAAK,GAAG,GAAG,CAAC,KAAK,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,2CAAwB,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,KA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AC,CAAC;YACd,CAAC;QACL,CAAC,CAAC;IApCF,CAAC;CAqCJ,CAAA;AA/CY,wDAAsB;iCAAtB,sBAAsB;IADlC,IAAA,qBAAU,GAAE;IAGJ,WAAA,IAAA,iBAAM,EAAC,2CAAoB,CAAC,0BAA0B,CAAC,CAAA;IACvD,WAAA,IAAA,iBAAM,EAAC,2CAAoB,CAAC,2BAA2B,CAAC,CAAA;IACxD,WAAA,IAAA,iBAAM,EAAC,2CAAoB,CAAC,+BAA+B,CAAC,CAAA;IAC5D,WAAA,IAAA,iBAAM,EAAC,2CAAoB,CAAC,2BAA2B,CAAC,CAAA;IACxD,WAAA,IAAA,iBAAM,EAAC,2CAAoB,CAAC,+BAA+B,CAAC,CAAA;qCAJwB,uDAA0B;QAC3B,yDAA2B;QACzB,iEAA+B;QACjC,yDAA2B;QAEjF,iEAA+B;GAPxD,sBAAsB,CA+ClC"}
@@ -29,6 +29,8 @@ const EnoBuildingDetailRepository_1 = require("../repositories/EnoBuildingDetail
29
29
  const EnoBuildingDetailTransformation_1 = require("../transformations/EnoBuildingDetailTransformation");
30
30
  const EnoBuildingsController_1 = require("../controllers/v2/EnoBuildingsController");
31
31
  const V2EnoBuildingsRouter_1 = require("../routers/v2/V2EnoBuildingsRouter");
32
+ const DedBuildingSearchRepository_1 = require("../repositories/DedBuildingSearchRepository");
33
+ const DedBuildingSearchTransformation_1 = require("../transformations/DedBuildingSearchTransformation");
32
34
  //#region Initialization
33
35
  const energeticsContainer = ioc_1.OutputGatewayContainer.createChildContainer();
34
36
  exports.OGEnergeticsContainer = energeticsContainer;
@@ -39,7 +41,8 @@ energeticsContainer
39
41
  .registerSingleton(ModuleContainerToken_1.ModuleContainerToken.OrganizationDetailDtoTransformation, OrganizationDetailDtoTransformation_1.OrganizationDetailDtoTransformation)
40
42
  .registerSingleton(ModuleContainerToken_1.ModuleContainerToken.DeviceDtoTransformation, DeviceDtoTransformation_1.DeviceDtoTransformation)
41
43
  .registerSingleton(ModuleContainerToken_1.ModuleContainerToken.BuildingTransformationFull, BuildingTransformationFull_1.BuildingTransformationFull)
42
- .registerSingleton(ModuleContainerToken_1.ModuleContainerToken.EnoBuildingDetailTransformation, EnoBuildingDetailTransformation_1.EnoBuildingDetailTransformation);
44
+ .registerSingleton(ModuleContainerToken_1.ModuleContainerToken.EnoBuildingDetailTransformation, EnoBuildingDetailTransformation_1.EnoBuildingDetailTransformation)
45
+ .registerSingleton(ModuleContainerToken_1.ModuleContainerToken.DedBuildingSearchTransformation, DedBuildingSearchTransformation_1.DedBuildingSearchTransformation);
43
46
  //#endregion
44
47
  //#region Repositories
45
48
  energeticsContainer
@@ -50,6 +53,7 @@ energeticsContainer
50
53
  .registerSingleton(ModuleContainerToken_1.ModuleContainerToken.DevicesRepository, DevicesRepository_1.DevicesRepository)
51
54
  .registerSingleton(ModuleContainerToken_1.ModuleContainerToken.MeasurementRepository, MeasurementRepository_1.MeasurementRepository)
52
55
  .registerSingleton(ModuleContainerToken_1.ModuleContainerToken.EnoBuildingDetailRepository, EnoBuildingDetailRepository_1.EnoBuildingDetailRepository)
56
+ .registerSingleton(ModuleContainerToken_1.ModuleContainerToken.DedBuildingSearchRepository, DedBuildingSearchRepository_1.DedBuildingSearchRepository)
53
57
  .register(ModuleContainerToken_1.ModuleContainerToken.AccessLimitationRepository, {
54
58
  useFactory: (0, tsyringe_1.instanceCachingFactory)((c) => new AccessLimitationRepository_1.AccessLimitationRepository(c.resolve(CoreToken_1.CoreToken.PostgresConnector), c.resolve(CoreToken_1.CoreToken.Logger))),
55
59
  });
@@ -1 +1 @@
1
- {"version":3,"file":"Di.js","sourceRoot":"","sources":["../../../src/output-gateway/ioc/Di.ts"],"names":[],"mappings":";;;AAAA,iEAAoE;AACpE,iEAAiG;AACjG,+DAA+E;AAC/E,qFAAmF;AACnF,2FAAyF;AACzF,mHAAiH;AACjH,2FAAyF;AACzF,qGAAmG;AACnG,yEAAuE;AACvE,+EAA6E;AAC7E,+EAA6E;AAC7E,mEAAiE;A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AoB,CAAC,oBAAoB,EAAE,2CAAoB,CAAC,CAAC;AAC9G,YAAY;AAEZ,iBAAiB;AACjB,mBAAmB,CAAC,iBAAiB,CAAmB,2CAAoB,CAAC,gBAAgB,EAAE,mCAAgB,CAAC,CAAC"}
@@ -5,6 +5,7 @@ declare const ModuleContainerToken: {
5
5
  DeviceDtoTransformation: symbol;
6
6
  BuildingTransformationFull: symbol;
7
7
  EnoBuildingDetailTransformation: symbol;
8
+ DedBuildingSearchTransformation: symbol;
8
9
  /** repositories */
9
10
  PrimaryBuildingsRepository: symbol;
10
11
  OrganizationsRepository: symbol;
@@ -13,6 +14,7 @@ declare const ModuleContainerToken: {
13
14
  DevicesRepository: symbol;
14
15
  MeasurementRepository: symbol;
15
16
  EnoBuildingDetailRepository: symbol;
17
+ DedBuildingSearchRepository: symbol;
16
18
  AccessLimitationRepository: symbol;
17
19
  /** controllers */
18
20
  BuildingsController: symbol;
@@ -8,6 +8,7 @@ const ModuleContainerToken = {
8
8
  DeviceDtoTransformation: Symbol("DeviceDtoTransformation"),
9
9
  BuildingTransformationFull: Symbol("BuildingTransformationFull"),
10
10
  EnoBuildingDetailTransformation: Symbol("EnoBuildingDetailTransformation"),
11
+ DedBuildingSearchTransformation: Symbol("DedBuildingSearchTransformation"),
11
12
  /** repositories */
12
13
  PrimaryBuildingsRepository: Symbol("PrimaryBuildingsRepository"),
13
14
  OrganizationsRepository: Symbol("OrganizationsRepository"),
@@ -16,6 +17,7 @@ const ModuleContainerToken = {
16
17
  DevicesRepository: Symbol("DevicesRepository"),
17
18
  MeasurementRepository: Symbol("MeasurementRepository"),
18
19
  EnoBuildingDetailRepository: Symbol("EnoBuildingDetailRepository"),
20
+ DedBuildingSearchRepository: Symbol("DedBuildingSearchRepository"),
19
21
  AccessLimitationRepository: Symbol(),
20
22
  /** controllers */
21
23
  BuildingsController: Symbol("BuildingController"),
@@ -1 +1 @@
1
- {"version":3,"file":"ModuleContainerToken.js","sourceRoot":"","sources":["../../../src/output-gate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M,CAAC,sBAAsB,CAAC;IACpD,qBAAqB,EAAE,MAAM,CAAC,uBAAuB,CAAC;IACtD,eAAe,EAAE,MAAM,CAAC,iBAAiB,CAAC;IAC1C,oBAAoB,EAAE,MAAM,CAAC,sBAAsB,CAAC;IACpD,cAAc;IACd,gBAAgB,EAAE,MAAM,CAAC,0BAA0B,CAAC;CACvD,CAAC;AAEO,oDAAoB"}
@@ -0,0 +1,30 @@
1
+ import { Model, ModelAttributes } from "@golemio/core/dist/shared/sequelize";
2
+ import { IDedBuildingSearchView } from "./interfaces/IDedBuildingSearchView";
3
+ /**
4
+ * Model over the mv_ded_building_search materialized view. The search itself runs as a single raw
5
+ * query (weighted ranking is not expressible through the query builder); this model exists so the
6
+ * repository inherits the numeric column parsing and the schema binding.
7
+ * The search_document and geom columns are intentionally not declared - they are never selected as
8
+ * values, only used inside the query.
9
+ */
10
+ export declare class DedBuildingSearchViewModel extends Model<IDedBuildingSearchView> implements IDedBuildingSearchView {
11
+ static tableName: string;
12
+ static modelName: string;
13
+ gid: string;
14
+ nazev: string | null;
15
+ oznaceni: string | null;
16
+ ej_id: number | null;
17
+ ej_kod: string | null;
18
+ ej_nazev: string | null;
19
+ ej_typ: string | null;
20
+ address_main: string | null;
21
+ addresses: string[];
22
+ ean: string[];
23
+ eic: string[];
24
+ om: string[];
25
+ active_points_count: number;
26
+ has_building_record: boolean;
27
+ name_norm: string;
28
+ address_norm: string;
29
+ static attributeModel: ModelAttributes<DedBuildingSearchViewModel, IDedBuildingSearchView>;
30
+ }