@tmlmobilidade/databases 20260616.2238.2 → 20260617.1318.33

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.
@@ -19,9 +19,6 @@ declare class SimplifiedApexBankingTapsNewClass extends ClickHouseInterfaceTempl
19
19
  };
20
20
  apex_version: string;
21
21
  banking_token: string;
22
- calendar_date: string & {
23
- __brand: "CalendarDate";
24
- };
25
22
  card_brand: number;
26
23
  card_pan: string;
27
24
  device_id: string;
@@ -8,7 +8,6 @@ const tableSchema = {
8
8
  agency_id: { type: 'LowCardinality(String)' },
9
9
  apex_version: { type: 'LowCardinality(String)' },
10
10
  banking_token: { type: 'String' },
11
- calendar_date: { type: 'Date' },
12
11
  card_brand: { type: 'UInt8' },
13
12
  card_pan: { type: 'String' },
14
13
  created_at: { type: 'DateTime64(3, \'UTC\') CODEC(Delta, ZSTD)' },
@@ -18,9 +18,6 @@ declare class SimplifiedApexInspectionDecisionsNewClass extends ClickHouseInterf
18
18
  __brand: "UnixTimestamp";
19
19
  };
20
20
  apex_version: string;
21
- calendar_date: string & {
22
- __brand: "CalendarDate";
23
- };
24
21
  device_id: string;
25
22
  is_ok_pcgi: boolean;
26
23
  mac_ase_counter_value: number;
@@ -7,7 +7,6 @@ const tableSchema = {
7
7
  _id: { type: 'UUID' },
8
8
  agency_id: { type: 'LowCardinality(String)' },
9
9
  apex_version: { type: 'LowCardinality(String)' },
10
- calendar_date: { type: 'Date' },
11
10
  created_at: { type: 'DateTime64(3, \'UTC\') CODEC(Delta, ZSTD)' },
12
11
  device_id: { type: 'LowCardinality(String)' },
13
12
  final_control_status: { type: 'UInt8' },
@@ -18,9 +18,6 @@ declare class SimplifiedApexInspectionsNewClass extends ClickHouseInterfaceTempl
18
18
  __brand: "UnixTimestamp";
19
19
  };
20
20
  apex_version: string;
21
- calendar_date: string & {
22
- __brand: "CalendarDate";
23
- };
24
21
  device_id: string;
25
22
  is_ok_pcgi: boolean;
26
23
  line_id: string;
@@ -33,7 +30,7 @@ declare class SimplifiedApexInspectionsNewClass extends ClickHouseInterfaceTempl
33
30
  __brand: "UnixTimestamp";
34
31
  };
35
32
  vehicle_id: number | null;
36
- card_serial_number: bigint | null;
33
+ card_serial_number: string | null;
37
34
  control_destination_stop_id: string;
38
35
  control_origin_stop_id: string;
39
36
  control_status: number;
@@ -7,10 +7,9 @@ const tableSchema = {
7
7
  _id: { type: 'UUID' },
8
8
  agency_id: { type: 'LowCardinality(String)' },
9
9
  apex_version: { type: 'LowCardinality(String)' },
10
- calendar_date: { type: 'Date' },
11
10
  card_serial_number: { type: 'Nullable(UInt64)' },
12
- control_destination_stop_id: { type: 'Nullable(LowCardinality(String))' },
13
- control_origin_stop_id: { type: 'Nullable(LowCardinality(String))' },
11
+ control_destination_stop_id: { type: 'LowCardinality(Nullable(String))' },
12
+ control_origin_stop_id: { type: 'LowCardinality(Nullable(String))' },
14
13
  control_status: { type: 'UInt8' },
15
14
  created_at: { type: 'DateTime64(3, \'UTC\') CODEC(Delta, ZSTD)' },
16
15
  device_id: { type: 'LowCardinality(String)' },
@@ -18,15 +17,15 @@ const tableSchema = {
18
17
  inspection_id: { type: 'Nullable(UUID)' },
19
18
  is_ok: { type: 'Bool' },
20
19
  is_ok_pcgi: { type: 'Bool' },
21
- line_id: { type: 'Nullable(LowCardinality(String))' },
20
+ line_id: { type: 'LowCardinality(Nullable(String))' },
22
21
  mac_ase_counter_value: { type: 'UInt64' },
23
22
  mac_sam_serial_number: { type: 'UInt64' },
24
- pattern_id: { type: 'Nullable(LowCardinality(String))' },
25
- product_id: { type: 'Nullable(LowCardinality(String))' },
23
+ pattern_id: { type: 'LowCardinality(Nullable(String))' },
24
+ product_id: { type: 'LowCardinality(Nullable(String))' },
26
25
  received_at: { type: 'DateTime64(3, \'UTC\') CODEC(Delta, ZSTD)' },
27
26
  trip_id: { type: 'Nullable(String)' },
28
27
  updated_at: { type: 'DateTime64(3, \'UTC\') CODEC(Delta, ZSTD)' },
29
- vehicle_id: { type: 'Nullable(LowCardinality(String))' },
28
+ vehicle_id: { type: 'LowCardinality(Nullable(String))' },
30
29
  };
31
30
  /* * */
32
31
  class SimplifiedApexInspectionsNewClass extends ClickHouseInterfaceTemplate {
@@ -17,9 +17,6 @@ declare class SimplifiedApexLocationsNewClass extends ClickHouseInterfaceTemplat
17
17
  __brand: "UnixTimestamp";
18
18
  };
19
19
  apex_version: string;
20
- calendar_date: string & {
21
- __brand: "CalendarDate";
22
- };
23
20
  device_id: string;
24
21
  line_id: string;
25
22
  mac_ase_counter_value: number;
@@ -7,18 +7,17 @@ const tableSchema = {
7
7
  _id: { type: 'UUID' },
8
8
  agency_id: { type: 'LowCardinality(String)' },
9
9
  apex_version: { type: 'LowCardinality(String)' },
10
- calendar_date: { type: 'Date' },
11
10
  created_at: { type: 'DateTime64(3, \'UTC\') CODEC(Delta, ZSTD)' },
12
11
  device_id: { type: 'LowCardinality(String)' },
13
- line_id: { type: 'Nullable(LowCardinality(String))' },
12
+ line_id: { type: 'LowCardinality(Nullable(String))' },
14
13
  mac_ase_counter_value: { type: 'UInt64' },
15
14
  mac_sam_serial_number: { type: 'UInt64' },
16
- pattern_id: { type: 'Nullable(LowCardinality(String))' },
15
+ pattern_id: { type: 'LowCardinality(Nullable(String))' },
17
16
  received_at: { type: 'DateTime64(3, \'UTC\') CODEC(Delta, ZSTD)' },
18
- stop_id: { type: 'Nullable(LowCardinality(String))' },
17
+ stop_id: { type: 'LowCardinality(Nullable(String))' },
19
18
  trip_id: { type: 'Nullable(String)' },
20
19
  updated_at: { type: 'DateTime64(3, \'UTC\') CODEC(Delta, ZSTD)' },
21
- vehicle_id: { type: 'Nullable(LowCardinality(String))' },
20
+ vehicle_id: { type: 'LowCardinality(Nullable(String))' },
22
21
  };
23
22
  /* * */
24
23
  class SimplifiedApexLocationsNewClass extends ClickHouseInterfaceTemplate {
@@ -18,27 +18,24 @@ declare class SimplifiedApexOnBoardRefundsNewClass extends ClickHouseInterfaceTe
18
18
  };
19
19
  price: number;
20
20
  apex_version: string;
21
- calendar_date: string & {
22
- __brand: "CalendarDate";
23
- };
24
21
  device_id: string;
25
22
  line_id: string | null;
26
23
  mac_ase_counter_value: number;
27
24
  mac_sam_serial_number: number;
28
25
  pattern_id: string | null;
26
+ product_id: string;
29
27
  stop_id: string | null;
30
28
  trip_id: string | null;
31
29
  updated_at: number & {
32
30
  __brand: "UnixTimestamp";
33
31
  };
34
32
  vehicle_id: number | null;
35
- card_serial_number: bigint | null;
33
+ card_serial_number: string | null;
36
34
  block_id: string | null;
37
35
  card_physical_type: number;
38
36
  duty_id: string | null;
39
37
  on_board_sale_id: string | null;
40
38
  payment_method: number;
41
- product_long_id: string;
42
39
  product_quantity: number;
43
40
  validation_id: string | null;
44
41
  }>;
@@ -8,27 +8,26 @@ const tableSchema = {
8
8
  agency_id: { type: 'LowCardinality(String)' },
9
9
  apex_version: { type: 'LowCardinality(String)' },
10
10
  block_id: { type: 'Nullable(String)' },
11
- calendar_date: { type: 'Date' },
12
11
  card_physical_type: { type: 'UInt8' },
13
12
  card_serial_number: { type: 'Nullable(UInt64)' },
14
13
  created_at: { type: 'DateTime64(3, \'UTC\') CODEC(Delta, ZSTD)' },
15
14
  device_id: { type: 'LowCardinality(String)' },
16
15
  duty_id: { type: 'Nullable(String)' },
17
- line_id: { type: 'Nullable(LowCardinality(String))' },
16
+ line_id: { type: 'LowCardinality(Nullable(String))' },
18
17
  mac_ase_counter_value: { type: 'UInt64' },
19
18
  mac_sam_serial_number: { type: 'UInt64' },
20
19
  on_board_sale_id: { type: 'Nullable(UUID)' },
21
- pattern_id: { type: 'Nullable(LowCardinality(String))' },
20
+ pattern_id: { type: 'LowCardinality(Nullable(String))' },
22
21
  payment_method: { type: 'UInt8' },
23
22
  price: { type: 'Int32' },
24
- product_long_id: { type: 'Nullable(LowCardinality(String))' },
23
+ product_id: { type: 'LowCardinality(Nullable(String))' },
25
24
  product_quantity: { type: 'Int32' },
26
25
  received_at: { type: 'DateTime64(3, \'UTC\') CODEC(Delta, ZSTD)' },
27
- stop_id: { type: 'Nullable(LowCardinality(String))' },
26
+ stop_id: { type: 'LowCardinality(Nullable(String))' },
28
27
  trip_id: { type: 'Nullable(String)' },
29
28
  updated_at: { type: 'DateTime64(3, \'UTC\') CODEC(Delta, ZSTD)' },
30
29
  validation_id: { type: 'Nullable(UUID)' },
31
- vehicle_id: { type: 'Nullable(LowCardinality(String))' },
30
+ vehicle_id: { type: 'LowCardinality(Nullable(String))' },
32
31
  };
33
32
  /* * */
34
33
  class SimplifiedApexOnBoardRefundsNewClass extends ClickHouseInterfaceTemplate {
@@ -18,26 +18,23 @@ declare class SimplifiedApexOnBoardSalesNewClass extends ClickHouseInterfaceTemp
18
18
  };
19
19
  price: number;
20
20
  apex_version: string;
21
- calendar_date: string & {
22
- __brand: "CalendarDate";
23
- };
24
21
  device_id: string;
25
22
  line_id: string | null;
26
23
  mac_ase_counter_value: number;
27
24
  mac_sam_serial_number: number;
28
25
  pattern_id: string | null;
26
+ product_id: string;
29
27
  stop_id: string | null;
30
28
  trip_id: string | null;
31
29
  updated_at: number & {
32
30
  __brand: "UnixTimestamp";
33
31
  };
34
32
  vehicle_id: number | null;
35
- card_serial_number: bigint | null;
33
+ card_serial_number: string | null;
36
34
  block_id: string | null;
37
35
  card_physical_type: number;
38
36
  duty_id: string | null;
39
37
  payment_method: number;
40
- product_long_id: string;
41
38
  product_quantity: number;
42
39
  validation_id: string | null;
43
40
  is_passenger: boolean;
@@ -8,28 +8,27 @@ const tableSchema = {
8
8
  agency_id: { type: 'LowCardinality(String)' },
9
9
  apex_version: { type: 'LowCardinality(String)' },
10
10
  block_id: { type: 'Nullable(String)' },
11
- calendar_date: { type: 'Date' },
12
11
  card_physical_type: { type: 'UInt8' },
13
12
  card_serial_number: { type: 'Nullable(UInt64)' },
14
13
  created_at: { type: 'DateTime64(3, \'UTC\') CODEC(Delta, ZSTD)' },
15
14
  device_id: { type: 'LowCardinality(String)' },
16
15
  duty_id: { type: 'Nullable(String)' },
17
16
  is_passenger: { type: 'Bool' },
18
- line_id: { type: 'Nullable(LowCardinality(String))' },
17
+ line_id: { type: 'LowCardinality(Nullable(String))' },
19
18
  mac_ase_counter_value: { type: 'UInt64' },
20
19
  mac_sam_serial_number: { type: 'UInt64' },
21
20
  on_board_refund_id: { type: 'Nullable(UUID)' },
22
- pattern_id: { type: 'Nullable(LowCardinality(String))' },
21
+ pattern_id: { type: 'LowCardinality(Nullable(String))' },
23
22
  payment_method: { type: 'UInt8' },
24
23
  price: { type: 'Int32' },
25
- product_long_id: { type: 'Nullable(LowCardinality(String))' },
24
+ product_id: { type: 'LowCardinality(Nullable(String))' },
26
25
  product_quantity: { type: 'Int32' },
27
26
  received_at: { type: 'DateTime64(3, \'UTC\') CODEC(Delta, ZSTD)' },
28
- stop_id: { type: 'Nullable(LowCardinality(String))' },
27
+ stop_id: { type: 'LowCardinality(Nullable(String))' },
29
28
  trip_id: { type: 'Nullable(String)' },
30
29
  updated_at: { type: 'DateTime64(3, \'UTC\') CODEC(Delta, ZSTD)' },
31
30
  validation_id: { type: 'Nullable(UUID)' },
32
- vehicle_id: { type: 'Nullable(LowCardinality(String))' },
31
+ vehicle_id: { type: 'LowCardinality(Nullable(String))' },
33
32
  };
34
33
  /* * */
35
34
  class SimplifiedApexOnBoardSalesNewClass extends ClickHouseInterfaceTemplate {
@@ -18,9 +18,6 @@ declare class SimplifiedApexValidationsNewClass extends ClickHouseInterfaceTempl
18
18
  __brand: "UnixTimestamp";
19
19
  };
20
20
  apex_version: string;
21
- calendar_date: string & {
22
- __brand: "CalendarDate";
23
- };
24
21
  device_id: string;
25
22
  event_type: number;
26
23
  is_ok_pcgi: boolean;
@@ -36,11 +33,11 @@ declare class SimplifiedApexValidationsNewClass extends ClickHouseInterfaceTempl
36
33
  __brand: "UnixTimestamp";
37
34
  };
38
35
  vehicle_id: number | null;
39
- card_serial_number: bigint | null;
36
+ card_serial_number: string | null;
40
37
  on_board_sale_id: string | null;
41
38
  is_passenger: boolean;
42
39
  on_board_refund_id: string | null;
43
- category: "on_board_sale" | "prepaid" | "subscription" | null;
40
+ category: "prepaid" | "subscription" | "on_board_sale" | null;
44
41
  validation_status: "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9" | "10" | "11" | "12" | "13";
45
42
  }>;
46
43
  protected readonly tableName = "validations";
@@ -7,7 +7,6 @@ const tableSchema = {
7
7
  _id: { type: 'UUID' },
8
8
  agency_id: { type: 'LowCardinality(String)' },
9
9
  apex_version: { type: 'LowCardinality(String)' },
10
- calendar_date: { type: 'Date' },
11
10
  card_serial_number: { type: 'Nullable(UInt64)' },
12
11
  category: { type: 'LowCardinality(String)' },
13
12
  created_at: { type: 'DateTime64(3, \'UTC\') CODEC(Delta, ZSTD)' },
@@ -16,20 +15,20 @@ const tableSchema = {
16
15
  is_ok: { type: 'Bool' },
17
16
  is_ok_pcgi: { type: 'Bool' },
18
17
  is_passenger: { type: 'Bool' },
19
- line_id: { type: 'Nullable(LowCardinality(String))' },
18
+ line_id: { type: 'LowCardinality(Nullable(String))' },
20
19
  mac_ase_counter_value: { type: 'UInt64' },
21
20
  mac_sam_serial_number: { type: 'UInt64' },
22
21
  on_board_refund_id: { type: 'Nullable(UUID)' },
23
22
  on_board_sale_id: { type: 'Nullable(UUID)' },
24
- pattern_id: { type: 'Nullable(LowCardinality(String))' },
25
- product_id: { type: 'Nullable(LowCardinality(String))' },
23
+ pattern_id: { type: 'LowCardinality(Nullable(String))' },
24
+ product_id: { type: 'LowCardinality(Nullable(String))' },
26
25
  received_at: { type: 'DateTime64(3, \'UTC\') CODEC(Delta, ZSTD)' },
27
- stop_id: { type: 'Nullable(LowCardinality(String))' },
26
+ stop_id: { type: 'LowCardinality(Nullable(String))' },
28
27
  trip_id: { type: 'Nullable(String)' },
29
28
  units_qty: { type: 'Nullable(Int32)' },
30
29
  updated_at: { type: 'DateTime64(3, \'UTC\') CODEC(Delta, ZSTD)' },
31
- validation_status: { type: 'UInt8' },
32
- vehicle_id: { type: 'Nullable(LowCardinality(String))' },
30
+ validation_status: { type: 'LowCardinality(String)' },
31
+ vehicle_id: { type: 'LowCardinality(Nullable(String))' },
33
32
  };
34
33
  /* * */
35
34
  class SimplifiedApexValidationsNewClass extends ClickHouseInterfaceTemplate {
@@ -37,7 +37,7 @@ export declare abstract class ClickHouseInterfaceTemplate<T extends object> {
37
37
  * @param params Optional key-value substitutions applied to the WHERE clause (replaces $1, $2, etc.).
38
38
  * @returns A promise that resolves when the delete operation is complete.
39
39
  */
40
- delete(where: string, params?: Record<string, number | string>): Promise<void>;
40
+ delete(where: string, params?: Record<string, number | string | string[]>): Promise<void>;
41
41
  /**
42
42
  * Executes a DISTINCT query on the ClickHouse table using the service's client.
43
43
  * @param select The columns to select in the query (e.g., `"*"`, `"column1, column2"`).
@@ -2,4 +2,4 @@
2
2
  * Supported ClickHouse data types that
3
3
  * can be used in ClickHouse table schemas.
4
4
  */
5
- export type ClickHouseDataType = 'Bool' | 'Date' | 'Float64' | 'Int32' | 'Int64' | 'String' | 'UInt8' | 'UInt64' | 'UUID' | `DateTime64(3, 'UTC') CODEC(Delta, ZSTD)` | `Enum8(${string})` | `LowCardinality(String)` | `Nullable(Float64)` | `Nullable(Int32)` | `Nullable(Int64)` | `Nullable(LowCardinality(String))` | `Nullable(String)` | `Nullable(UInt64)` | `Nullable(UUID)`;
5
+ export type ClickHouseDataType = 'Bool' | 'Date' | 'Float64' | 'Int32' | 'Int64' | 'String' | 'UInt8' | 'UInt64' | 'UUID' | `DateTime64(3, 'UTC') CODEC(Delta, ZSTD)` | `Enum8(${string})` | `LowCardinality(Nullable(String))` | `LowCardinality(String)` | `Nullable(Float64)` | `Nullable(Int32)` | `Nullable(Int64)` | `Nullable(String)` | `Nullable(UInt64)` | `Nullable(UUID)`;
@@ -4,4 +4,4 @@
4
4
  * @param value
5
5
  * @returns
6
6
  */
7
- export declare function getClickHouseParamType(value: number | string): 'Float64' | 'Int64' | 'String';
7
+ export declare function getClickHouseParamType(value: number | string | string[]): 'Array(String)' | 'Float64' | 'Int64' | 'String';
@@ -12,5 +12,8 @@ export function getClickHouseParamType(value) {
12
12
  }
13
13
  return Number.isInteger(value) ? 'Int64' : 'Float64';
14
14
  }
15
+ if (Array.isArray(value)) {
16
+ return 'Array(String)';
17
+ }
15
18
  return 'String';
16
19
  }
@@ -7,7 +7,7 @@
7
7
  * @throws Will throw an error if a placeholder is missing a corresponding parameter, if there are unused parameters, or if any parameter keys are invalid.
8
8
  * @returns An object containing the transformed query and a mapping of named parameters to their values.
9
9
  */
10
- export declare function preparePositionalQueryParams(query: string, params?: Record<string, number | string>): {
10
+ export declare function preparePositionalQueryParams(query: string, params?: Record<string, number | string | string[]>): {
11
11
  query: string;
12
- query_params: Record<string, number | string>;
12
+ query_params: Record<string, number | string | string[]>;
13
13
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tmlmobilidade/databases",
3
- "version": "20260616.2238.2",
3
+ "version": "20260617.1318.33",
4
4
  "author": {
5
5
  "email": "iso@tmlmobilidade.pt",
6
6
  "name": "TML-ISO"