@tmlmobilidade/go-interfaces-labdb 20261006.1122.0 → 20261007.1248.23

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.
@@ -0,0 +1,9 @@
1
+ import { ClickHouseInterfaceTemplate } from '../interface.template.js';
2
+ import { ClickHouseClient } from '@tmlmobilidade/go-clients-clickhouse';
3
+ import { type SimplifiedStop } from '@tmlmobilidade/go-types-infrastructure';
4
+ export declare class InfrastructureDatabase {
5
+ readonly simplifiedStops: ClickHouseInterfaceTemplate<SimplifiedStop>;
6
+ private readonly databaseName;
7
+ constructor(client: ClickHouseClient);
8
+ init(): Promise<void>;
9
+ }
@@ -0,0 +1,21 @@
1
+ /* * */
2
+ import { ClickHouseInterfaceTemplate } from '../interface.template.js';
3
+ import { simplifiedStopsTableSchema } from '../schemas/infrastructure.js';
4
+ /* * */
5
+ export class InfrastructureDatabase {
6
+ //
7
+ simplifiedStops;
8
+ databaseName = 'infrastructure';
9
+ constructor(client) {
10
+ //
11
+ this.simplifiedStops = new ClickHouseInterfaceTemplate(client, this.databaseName, 'simplified_stops', simplifiedStopsTableSchema, {
12
+ engine: 'ReplacingMergeTree(updated_at)',
13
+ orderBy: ['_id'],
14
+ });
15
+ }
16
+ async init() {
17
+ await Promise.all([
18
+ this.simplifiedStops.init(),
19
+ ]);
20
+ }
21
+ }
@@ -1,9 +1,11 @@
1
1
  import { ClickHouseClient, queryEachStatementFromFile, queryFromFile, queryFromString } from '@tmlmobilidade/go-clients-clickhouse';
2
+ import { InfrastructureDatabase } from './databases/infrastructure.js';
2
3
  import { OperationDatabase } from './databases/operation.js';
3
4
  import { PerformanceDatabase } from './databases/performance.js';
4
5
  import { SimplifiedApexDatabase } from './databases/simplified-apex.js';
5
6
  declare class LabDbClass {
6
7
  private static _instance;
8
+ readonly infrastructure: InfrastructureDatabase;
7
9
  readonly operation: OperationDatabase;
8
10
  readonly performance: PerformanceDatabase;
9
11
  readonly simplifiedApex: SimplifiedApexDatabase;
package/dist/interface.js CHANGED
@@ -1,6 +1,7 @@
1
1
  /* * */
2
2
  import { ClickHouseDatabaseClient, queryEachStatementFromFile, queryFromFile, queryFromString } from '@tmlmobilidade/go-clients-clickhouse';
3
3
  import { asyncSingletonProxy } from '@tmlmobilidade/go-utils-exec';
4
+ import { InfrastructureDatabase } from './databases/infrastructure.js';
4
5
  import { OperationDatabase } from './databases/operation.js';
5
6
  import { PerformanceDatabase } from './databases/performance.js';
6
7
  import { SimplifiedApexDatabase } from './databases/simplified-apex.js';
@@ -8,12 +9,14 @@ import { SimplifiedApexDatabase } from './databases/simplified-apex.js';
8
9
  class LabDbClass {
9
10
  //
10
11
  static _instance = null;
12
+ infrastructure;
11
13
  operation;
12
14
  performance;
13
15
  simplifiedApex;
14
16
  clickhouseClient;
15
17
  constructor(client) {
16
18
  this.clickhouseClient = client;
19
+ this.infrastructure = new InfrastructureDatabase(this.clickhouseClient);
17
20
  this.operation = new OperationDatabase(this.clickhouseClient);
18
21
  this.performance = new PerformanceDatabase(this.clickhouseClient);
19
22
  this.simplifiedApex = new SimplifiedApexDatabase(this.clickhouseClient);
@@ -56,6 +59,7 @@ class LabDbClass {
56
59
  }
57
60
  async init() {
58
61
  await Promise.all([
62
+ this.infrastructure.init(),
59
63
  this.operation.init(),
60
64
  this.performance.init(),
61
65
  this.simplifiedApex.init(),
@@ -0,0 +1,3 @@
1
+ import { type ClickHouseTableSchema } from '@tmlmobilidade/go-clients-clickhouse';
2
+ import { type SimplifiedStop } from '@tmlmobilidade/go-types-infrastructure';
3
+ export declare const simplifiedStopsTableSchema: ClickHouseTableSchema<SimplifiedStop>;
@@ -0,0 +1,32 @@
1
+ /* * */
2
+ /* * */
3
+ export const simplifiedStopsTableSchema = {
4
+ _id: { type: 'String' },
5
+ created_at: { type: 'Int64 CODEC(DoubleDelta, ZSTD)' },
6
+ is_deleted: { type: 'Bool' },
7
+ latitude: { type: 'Float32 CODEC(Gorilla, ZSTD)' },
8
+ legacy_ids: { type: 'Array(LowCardinality(String))' },
9
+ lifecycle_status: { type: 'LowCardinality(String)' },
10
+ location_country_admin_level: { type: 'UInt8' },
11
+ location_country_name: { type: 'LowCardinality(String)' },
12
+ location_country_osm_id: { type: 'UInt64' },
13
+ location_neighbourhood_admin_level: { type: 'LowCardinality(Nullable(String))' },
14
+ location_neighbourhood_name: { type: 'Nullable(String)' },
15
+ location_neighbourhood_osm_id: { type: 'Nullable(UInt64)' },
16
+ location_primary_admin_level: { type: 'UInt8' },
17
+ location_primary_code: { type: 'LowCardinality(Nullable(String))' },
18
+ location_primary_name: { type: 'String' },
19
+ location_primary_osm_id: { type: 'UInt64' },
20
+ location_secondary_admin_level: { type: 'UInt8' },
21
+ location_secondary_code: { type: 'LowCardinality(Nullable(String))' },
22
+ location_secondary_name: { type: 'String' },
23
+ location_secondary_osm_id: { type: 'UInt64' },
24
+ location_tertiary_admin_level: { type: 'UInt8' },
25
+ location_tertiary_code: { type: 'LowCardinality(Nullable(String))' },
26
+ location_tertiary_name: { type: 'String' },
27
+ location_tertiary_osm_id: { type: 'UInt64' },
28
+ longitude: { type: 'Float32 CODEC(Gorilla, ZSTD)' },
29
+ name: { type: 'String' },
30
+ short_name: { type: 'String' },
31
+ updated_at: { type: 'Int64 CODEC(DoubleDelta, ZSTD)' },
32
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tmlmobilidade/go-interfaces-labdb",
3
- "version": "20261006.1122.0",
3
+ "version": "20261007.1248.23",
4
4
  "author": {
5
5
  "email": "iso@tmlmobilidade.pt",
6
6
  "name": "TML-ISO"
@@ -38,6 +38,7 @@
38
38
  "dependencies": {
39
39
  "@tmlmobilidade/go-clients-clickhouse": "*",
40
40
  "@tmlmobilidade/go-types-apex": "*",
41
+ "@tmlmobilidade/go-types-infrastructure": "*",
41
42
  "@tmlmobilidade/go-types-operation": "*",
42
43
  "@tmlmobilidade/go-types-performance": "*",
43
44
  "@tmlmobilidade/go-types-vehicle-events": "*",