@tmlmobilidade/go-interfaces-labdb 20261009.1553.57 → 20261013.1121.17

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 PublicFeedback } from '@tmlmobilidade/go-types-hub';
4
+ export declare class HubDatabase {
5
+ readonly feedback: ClickHouseInterfaceTemplate<PublicFeedback>;
6
+ private readonly databaseName;
7
+ constructor(client: ClickHouseClient);
8
+ init(): Promise<void>;
9
+ }
@@ -0,0 +1,19 @@
1
+ /* * */
2
+ import { ClickHouseInterfaceTemplate } from '../interface.template.js';
3
+ import { publicFeedbackTableSchema } from '../schemas/hub.js';
4
+ /* * */
5
+ export class HubDatabase {
6
+ //
7
+ feedback;
8
+ databaseName = 'hub';
9
+ constructor(client) {
10
+ this.feedback = new ClickHouseInterfaceTemplate(client, this.databaseName, 'feedback', publicFeedbackTableSchema, {
11
+ engine: 'MergeTree()',
12
+ orderBy: ['created_at', 'entity_type', 'entity_id'],
13
+ partitionBy: 'toYYYYMM(fromUnixTimestamp64Milli(toInt64(created_at)))',
14
+ });
15
+ }
16
+ async init() {
17
+ await this.feedback.init();
18
+ }
19
+ }
@@ -1,10 +1,12 @@
1
1
  import { ClickHouseClient, queryEachStatementFromFile, queryFromFile, queryFromString } from '@tmlmobilidade/go-clients-clickhouse';
2
+ import { HubDatabase } from './databases/hub.js';
2
3
  import { InfrastructureDatabase } from './databases/infrastructure.js';
3
4
  import { OperationDatabase } from './databases/operation.js';
4
5
  import { PerformanceDatabase } from './databases/performance.js';
5
6
  import { SimplifiedApexDatabase } from './databases/simplified-apex.js';
6
7
  declare class LabDbClass {
7
8
  private static _instance;
9
+ readonly hub: HubDatabase;
8
10
  readonly infrastructure: InfrastructureDatabase;
9
11
  readonly operation: OperationDatabase;
10
12
  readonly performance: PerformanceDatabase;
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 { HubDatabase } from './databases/hub.js';
4
5
  import { InfrastructureDatabase } from './databases/infrastructure.js';
5
6
  import { OperationDatabase } from './databases/operation.js';
6
7
  import { PerformanceDatabase } from './databases/performance.js';
@@ -9,6 +10,7 @@ import { SimplifiedApexDatabase } from './databases/simplified-apex.js';
9
10
  class LabDbClass {
10
11
  //
11
12
  static _instance = null;
13
+ hub;
12
14
  infrastructure;
13
15
  operation;
14
16
  performance;
@@ -16,6 +18,7 @@ class LabDbClass {
16
18
  clickhouseClient;
17
19
  constructor(client) {
18
20
  this.clickhouseClient = client;
21
+ this.hub = new HubDatabase(this.clickhouseClient);
19
22
  this.infrastructure = new InfrastructureDatabase(this.clickhouseClient);
20
23
  this.operation = new OperationDatabase(this.clickhouseClient);
21
24
  this.performance = new PerformanceDatabase(this.clickhouseClient);
@@ -59,6 +62,7 @@ class LabDbClass {
59
62
  }
60
63
  async init() {
61
64
  await Promise.all([
65
+ this.hub.init(),
62
66
  this.infrastructure.init(),
63
67
  this.operation.init(),
64
68
  this.performance.init(),
@@ -0,0 +1,3 @@
1
+ import { type ClickHouseTableSchema } from '@tmlmobilidade/go-clients-clickhouse';
2
+ import { type PublicFeedback } from '@tmlmobilidade/go-types-hub';
3
+ export declare const publicFeedbackTableSchema: ClickHouseTableSchema<PublicFeedback>;
@@ -0,0 +1,11 @@
1
+ /* * */
2
+ /* * */
3
+ export const publicFeedbackTableSchema = {
4
+ agency_id: { type: 'Nullable(String)' },
5
+ created_at: { type: 'UInt64' },
6
+ entity_id: { type: 'String' },
7
+ entity_type: { type: 'Enum8(\'line\' = 1, \'stop\' = 2)' },
8
+ mood: { type: 'Enum8(\'happy\' = 1, \'unhappy\' = 2)' },
9
+ reasons: { type: 'Array(String)' },
10
+ schema_version: { type: 'LowCardinality(String)' },
11
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tmlmobilidade/go-interfaces-labdb",
3
- "version": "20261009.1553.57",
3
+ "version": "20261013.1121.17",
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-hub": "*",
41
42
  "@tmlmobilidade/go-types-infrastructure": "*",
42
43
  "@tmlmobilidade/go-types-operation": "*",
43
44
  "@tmlmobilidade/go-types-performance": "*",