@tmlmobilidade/databases 20260615.1034.33 → 20260615.1553.39
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/clients/go-clickhouse.js +3 -3
- package/dist/clients/go-mongo.js +2 -2
- package/dist/clients/go-redis.js +3 -3
- package/dist/clients/pcgi-file-manager.js +2 -2
- package/dist/clients/pcgi-raw.js +2 -2
- package/dist/clients/pcgi-ticketing.js +2 -2
- package/dist/clients/pcgi-validations.js +2 -2
- package/dist/interfaces/apex/index.d.ts +2 -5
- package/dist/interfaces/apex/index.js +2 -5
- package/dist/interfaces/apex/raw/index.d.ts +1 -0
- package/dist/interfaces/apex/raw/index.js +1 -0
- package/dist/interfaces/apex/raw/raw-apex-transactions.d.ts +4724 -0
- package/dist/interfaces/apex/raw/raw-apex-transactions.js +51 -0
- package/dist/interfaces/apex/simplified/index.d.ts +7 -0
- package/dist/interfaces/apex/simplified/index.js +7 -0
- package/dist/interfaces/apex/simplified/simplified-apex-banking-taps.d.ts +43 -0
- package/dist/interfaces/apex/simplified/simplified-apex-banking-taps.js +64 -0
- package/dist/interfaces/apex/simplified/simplified-apex-inspection-decisions.d.ts +34 -0
- package/dist/interfaces/apex/simplified/simplified-apex-inspection-decisions.js +55 -0
- package/dist/interfaces/apex/simplified/simplified-apex-inspections.d.ts +43 -0
- package/dist/interfaces/apex/simplified/simplified-apex-inspections.js +64 -0
- package/dist/interfaces/{simplified-apex → apex/simplified}/simplified-apex-locations.d.ts +6 -9
- package/dist/interfaces/{simplified-apex → apex/simplified}/simplified-apex-locations.js +4 -5
- package/dist/interfaces/{simplified-apex/simplified-apex-on-board-refunds.d.ts → apex/simplified/simplified-apex-refunds.d.ts} +6 -9
- package/dist/interfaces/{simplified-apex/simplified-apex-on-board-refunds.js → apex/simplified/simplified-apex-refunds.js} +4 -5
- package/dist/interfaces/{simplified-apex/simplified-apex-on-board-sales.d.ts → apex/simplified/simplified-apex-sales.d.ts} +6 -9
- package/dist/interfaces/{simplified-apex/simplified-apex-on-board-sales.js → apex/simplified/simplified-apex-sales.js} +4 -5
- package/dist/interfaces/{simplified-apex → apex/simplified}/simplified-apex-validations.d.ts +8 -8
- package/dist/interfaces/{simplified-apex → apex/simplified}/simplified-apex-validations.js +4 -4
- package/dist/interfaces/index.d.ts +1 -1
- package/dist/interfaces/index.js +1 -1
- package/dist/interfaces/pcgi/index.d.ts +6 -0
- package/dist/interfaces/pcgi/index.js +6 -0
- package/dist/interfaces/pcgi/pcgi-transaction-entities.d.ts +17 -0
- package/dist/interfaces/{apex/pcgi-transaction-entity.js → pcgi/pcgi-transaction-entities.js} +7 -13
- package/dist/interfaces/vehicle-events/raw-vehicle-events.d.ts +50 -50
- package/dist/interfaces/vehicle-events/simplified-vehicle-events.d.ts +5 -5
- package/package.json +2 -1
- package/dist/interfaces/apex/pcgi-transaction-entity.d.ts +0 -2374
- package/dist/interfaces/simplified-apex/index.d.ts +0 -4
- package/dist/interfaces/simplified-apex/index.js +0 -4
- /package/dist/interfaces/{apex → pcgi}/pcgi-locations.d.ts +0 -0
- /package/dist/interfaces/{apex → pcgi}/pcgi-locations.js +0 -0
- /package/dist/interfaces/{apex → pcgi}/pcgi-sales.d.ts +0 -0
- /package/dist/interfaces/{apex → pcgi}/pcgi-sales.js +0 -0
- /package/dist/interfaces/{apex → pcgi}/pcgi-validations.d.ts +0 -0
- /package/dist/interfaces/{apex → pcgi}/pcgi-validations.js +0 -0
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Raw On-Board Refunds represent the raw on-board refunds as they are received from the data sources.
|
|
3
|
+
* These are stored in MongoDB for persistence and later processing.
|
|
4
|
+
* These documents are also different depending on the version of the enclosed APEX transaction.
|
|
5
|
+
**/
|
|
6
|
+
import { PCGIRawClient } from '../../../clients/pcgi-raw.js';
|
|
7
|
+
import { MongoInterfaceTemplate } from '../../../templates/mongodb.js';
|
|
8
|
+
import { RawApexTransactionSchema } from '@tmlmobilidade/go-types-apex';
|
|
9
|
+
import { asyncSingletonProxy } from '@tmlmobilidade/utils';
|
|
10
|
+
/* * */
|
|
11
|
+
class RawApexTransactionsClass extends MongoInterfaceTemplate {
|
|
12
|
+
//
|
|
13
|
+
static _instance = null;
|
|
14
|
+
collectionName = 'raw_apex_transactions';
|
|
15
|
+
databaseName = 'raw';
|
|
16
|
+
indexDescription = [
|
|
17
|
+
{ key: { created_at: 1 } },
|
|
18
|
+
{ key: { agency_id: 1, created_at: 1 } },
|
|
19
|
+
// eslint-disable-next-line perfectionist/sort-objects
|
|
20
|
+
{ key: { version: 1, created_at: 1 } },
|
|
21
|
+
// eslint-disable-next-line perfectionist/sort-objects
|
|
22
|
+
{ key: { version: 1, received_at: 1 } },
|
|
23
|
+
];
|
|
24
|
+
createSchema = RawApexTransactionSchema;
|
|
25
|
+
updateSchema = null;
|
|
26
|
+
/**
|
|
27
|
+
* Returns the singleton instance of the subclass.
|
|
28
|
+
*/
|
|
29
|
+
static async getInstance() {
|
|
30
|
+
// If no instance exists, create one and store the promise.
|
|
31
|
+
// This ensures that if multiple calls to getInstance() happen concurrently,
|
|
32
|
+
// they will all await the same initialization process.
|
|
33
|
+
if (!this._instance) {
|
|
34
|
+
this._instance = (async () => {
|
|
35
|
+
const instance = new RawApexTransactionsClass();
|
|
36
|
+
// This behaves like the constructor,
|
|
37
|
+
// but allows for async initialization.
|
|
38
|
+
await instance.init();
|
|
39
|
+
return instance;
|
|
40
|
+
})();
|
|
41
|
+
}
|
|
42
|
+
// Await the instance if it's still initializing,
|
|
43
|
+
// or return it immediately if ready.
|
|
44
|
+
return await this._instance;
|
|
45
|
+
}
|
|
46
|
+
connectToClient() {
|
|
47
|
+
return PCGIRawClient.getClient();
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
/* * */
|
|
51
|
+
export const rawApexTransactions = asyncSingletonProxy(RawApexTransactionsClass);
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export * from './simplified-apex-banking-taps.js';
|
|
2
|
+
export * from './simplified-apex-inspection-decisions.js';
|
|
3
|
+
export * from './simplified-apex-inspections.js';
|
|
4
|
+
export * from './simplified-apex-locations.js';
|
|
5
|
+
export * from './simplified-apex-refunds.js';
|
|
6
|
+
export * from './simplified-apex-sales.js';
|
|
7
|
+
export * from './simplified-apex-validations.js';
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export * from './simplified-apex-banking-taps.js';
|
|
2
|
+
export * from './simplified-apex-inspection-decisions.js';
|
|
3
|
+
export * from './simplified-apex-inspections.js';
|
|
4
|
+
export * from './simplified-apex-locations.js';
|
|
5
|
+
export * from './simplified-apex-refunds.js';
|
|
6
|
+
export * from './simplified-apex-sales.js';
|
|
7
|
+
export * from './simplified-apex-validations.js';
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { ClickHouseInterfaceTemplate } from '../../../templates/clickhouse.js';
|
|
2
|
+
import { type ClickHouseSchema } from '../../../types/index.js';
|
|
3
|
+
import { type SimplifiedApexBankingTap } from '@tmlmobilidade/go-types-apex';
|
|
4
|
+
declare class SimplifiedApexBankingTapsNewClass extends ClickHouseInterfaceTemplate<SimplifiedApexBankingTap> {
|
|
5
|
+
private static _instance;
|
|
6
|
+
protected readonly databaseName = "simplified_apex";
|
|
7
|
+
protected readonly schema: ClickHouseSchema<{
|
|
8
|
+
_id: string;
|
|
9
|
+
agency_id: string;
|
|
10
|
+
created_at: number & {
|
|
11
|
+
__brand: "UnixTimestamp";
|
|
12
|
+
};
|
|
13
|
+
is_ok: boolean;
|
|
14
|
+
received_at: number & {
|
|
15
|
+
__brand: "UnixTimestamp";
|
|
16
|
+
};
|
|
17
|
+
apex_version: string;
|
|
18
|
+
banking_token: string;
|
|
19
|
+
card_brand: number;
|
|
20
|
+
card_pan: string;
|
|
21
|
+
device_id: string;
|
|
22
|
+
event_type: number | null;
|
|
23
|
+
is_ok_pcgi: boolean;
|
|
24
|
+
line_id: string;
|
|
25
|
+
mac_ase_counter_value: number;
|
|
26
|
+
mac_sam_serial_number: number;
|
|
27
|
+
pattern_id: string;
|
|
28
|
+
product_id: string;
|
|
29
|
+
stop_id: string;
|
|
30
|
+
trip_id: string;
|
|
31
|
+
units_qty: number;
|
|
32
|
+
vehicle_id: number;
|
|
33
|
+
}>;
|
|
34
|
+
protected readonly tableName = "banking_taps";
|
|
35
|
+
/**
|
|
36
|
+
* Returns the singleton instance of the subclass.
|
|
37
|
+
*/
|
|
38
|
+
static getInstance(): Promise<SimplifiedApexBankingTapsNewClass>;
|
|
39
|
+
protected connectToClient(): Promise<import("@clickhouse/client").ClickHouseClient>;
|
|
40
|
+
protected postInit(): Promise<void>;
|
|
41
|
+
}
|
|
42
|
+
export declare const simplifiedApexBankingTapsNew: SimplifiedApexBankingTapsNewClass;
|
|
43
|
+
export {};
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/* * */
|
|
2
|
+
import { GOClickHouseClient } from '../../../clients/go-clickhouse.js';
|
|
3
|
+
import { ClickHouseInterfaceTemplate } from '../../../templates/clickhouse.js';
|
|
4
|
+
import { asyncSingletonProxy } from '@tmlmobilidade/utils';
|
|
5
|
+
/* * */
|
|
6
|
+
const tableSchema = {
|
|
7
|
+
_id: { primaryKey: true, type: 'String' },
|
|
8
|
+
agency_id: { type: 'String' },
|
|
9
|
+
apex_version: { type: 'String' },
|
|
10
|
+
banking_token: { type: 'String' },
|
|
11
|
+
card_brand: { type: 'Int64' },
|
|
12
|
+
card_pan: { type: 'String' },
|
|
13
|
+
created_at: { type: 'Int64' },
|
|
14
|
+
device_id: { type: 'String' },
|
|
15
|
+
event_type: { type: 'Int64' },
|
|
16
|
+
is_ok: { type: 'Bool' },
|
|
17
|
+
is_ok_pcgi: { type: 'Bool' },
|
|
18
|
+
line_id: { type: 'String' },
|
|
19
|
+
mac_ase_counter_value: { type: 'Int64' },
|
|
20
|
+
mac_sam_serial_number: { type: 'Int64' },
|
|
21
|
+
pattern_id: { type: 'String' },
|
|
22
|
+
product_id: { type: 'String' },
|
|
23
|
+
received_at: { type: 'Int64' },
|
|
24
|
+
stop_id: { type: 'String' },
|
|
25
|
+
trip_id: { type: 'String' },
|
|
26
|
+
units_qty: { type: 'Int64' },
|
|
27
|
+
vehicle_id: { type: 'String' },
|
|
28
|
+
};
|
|
29
|
+
/* * */
|
|
30
|
+
class SimplifiedApexBankingTapsNewClass extends ClickHouseInterfaceTemplate {
|
|
31
|
+
//
|
|
32
|
+
static _instance = null;
|
|
33
|
+
databaseName = 'simplified_apex';
|
|
34
|
+
schema = tableSchema;
|
|
35
|
+
tableName = 'banking_taps';
|
|
36
|
+
/**
|
|
37
|
+
* Returns the singleton instance of the subclass.
|
|
38
|
+
*/
|
|
39
|
+
static async getInstance() {
|
|
40
|
+
// If no instance exists, create one and store the promise.
|
|
41
|
+
// This ensures that if multiple calls to getInstance() happen concurrently,
|
|
42
|
+
// they will all await the same initialization process.
|
|
43
|
+
if (!this._instance) {
|
|
44
|
+
this._instance = (async () => {
|
|
45
|
+
const instance = new SimplifiedApexBankingTapsNewClass();
|
|
46
|
+
// This behaves like the constructor,
|
|
47
|
+
// but allows for async initialization.
|
|
48
|
+
await instance.init();
|
|
49
|
+
return instance;
|
|
50
|
+
})();
|
|
51
|
+
}
|
|
52
|
+
// Await the instance if it's still initializing,
|
|
53
|
+
// or return it immediately if ready.
|
|
54
|
+
return await this._instance;
|
|
55
|
+
}
|
|
56
|
+
connectToClient() {
|
|
57
|
+
return GOClickHouseClient.getClient();
|
|
58
|
+
}
|
|
59
|
+
async postInit() {
|
|
60
|
+
console.log('Post init ClickHouse service for Simplified Apex Banking Taps...');
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
/* * */
|
|
64
|
+
export const simplifiedApexBankingTapsNew = asyncSingletonProxy(SimplifiedApexBankingTapsNewClass);
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { ClickHouseInterfaceTemplate } from '../../../templates/clickhouse.js';
|
|
2
|
+
import { type ClickHouseSchema } from '../../../types/index.js';
|
|
3
|
+
import { type SimplifiedApexInspectionDecision } from '@tmlmobilidade/go-types-apex';
|
|
4
|
+
declare class SimplifiedApexInspectionDecisionsNewClass extends ClickHouseInterfaceTemplate<SimplifiedApexInspectionDecision> {
|
|
5
|
+
private static _instance;
|
|
6
|
+
protected readonly databaseName = "simplified_apex";
|
|
7
|
+
protected readonly schema: ClickHouseSchema<{
|
|
8
|
+
_id: string;
|
|
9
|
+
agency_id: string;
|
|
10
|
+
created_at: number & {
|
|
11
|
+
__brand: "UnixTimestamp";
|
|
12
|
+
};
|
|
13
|
+
is_ok: boolean;
|
|
14
|
+
received_at: number & {
|
|
15
|
+
__brand: "UnixTimestamp";
|
|
16
|
+
};
|
|
17
|
+
apex_version: string;
|
|
18
|
+
device_id: string;
|
|
19
|
+
is_ok_pcgi: boolean;
|
|
20
|
+
mac_ase_counter_value: number;
|
|
21
|
+
mac_sam_serial_number: number;
|
|
22
|
+
final_control_status: number;
|
|
23
|
+
inspection_decision_id: string | null;
|
|
24
|
+
}>;
|
|
25
|
+
protected readonly tableName = "inspection_decisions";
|
|
26
|
+
/**
|
|
27
|
+
* Returns the singleton instance of the subclass.
|
|
28
|
+
*/
|
|
29
|
+
static getInstance(): Promise<SimplifiedApexInspectionDecisionsNewClass>;
|
|
30
|
+
protected connectToClient(): Promise<import("@clickhouse/client").ClickHouseClient>;
|
|
31
|
+
protected postInit(): Promise<void>;
|
|
32
|
+
}
|
|
33
|
+
export declare const simplifiedApexInspectionDecisionsNew: SimplifiedApexInspectionDecisionsNewClass;
|
|
34
|
+
export {};
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/* * */
|
|
2
|
+
import { GOClickHouseClient } from '../../../clients/go-clickhouse.js';
|
|
3
|
+
import { ClickHouseInterfaceTemplate } from '../../../templates/clickhouse.js';
|
|
4
|
+
import { asyncSingletonProxy } from '@tmlmobilidade/utils';
|
|
5
|
+
/* * */
|
|
6
|
+
const tableSchema = {
|
|
7
|
+
_id: { primaryKey: true, type: 'String' },
|
|
8
|
+
agency_id: { type: 'String' },
|
|
9
|
+
apex_version: { type: 'String' },
|
|
10
|
+
created_at: { type: 'Int64' },
|
|
11
|
+
device_id: { type: 'String' },
|
|
12
|
+
final_control_status: { type: 'Int64' },
|
|
13
|
+
inspection_decision_id: { type: 'String' },
|
|
14
|
+
is_ok: { type: 'Bool' },
|
|
15
|
+
is_ok_pcgi: { type: 'Bool' },
|
|
16
|
+
mac_ase_counter_value: { type: 'Int64' },
|
|
17
|
+
mac_sam_serial_number: { type: 'Int64' },
|
|
18
|
+
received_at: { type: 'Int64' },
|
|
19
|
+
};
|
|
20
|
+
/* * */
|
|
21
|
+
class SimplifiedApexInspectionDecisionsNewClass extends ClickHouseInterfaceTemplate {
|
|
22
|
+
//
|
|
23
|
+
static _instance = null;
|
|
24
|
+
databaseName = 'simplified_apex';
|
|
25
|
+
schema = tableSchema;
|
|
26
|
+
tableName = 'inspection_decisions';
|
|
27
|
+
/**
|
|
28
|
+
* Returns the singleton instance of the subclass.
|
|
29
|
+
*/
|
|
30
|
+
static async getInstance() {
|
|
31
|
+
// If no instance exists, create one and store the promise.
|
|
32
|
+
// This ensures that if multiple calls to getInstance() happen concurrently,
|
|
33
|
+
// they will all await the same initialization process.
|
|
34
|
+
if (!this._instance) {
|
|
35
|
+
this._instance = (async () => {
|
|
36
|
+
const instance = new SimplifiedApexInspectionDecisionsNewClass();
|
|
37
|
+
// This behaves like the constructor,
|
|
38
|
+
// but allows for async initialization.
|
|
39
|
+
await instance.init();
|
|
40
|
+
return instance;
|
|
41
|
+
})();
|
|
42
|
+
}
|
|
43
|
+
// Await the instance if it's still initializing,
|
|
44
|
+
// or return it immediately if ready.
|
|
45
|
+
return await this._instance;
|
|
46
|
+
}
|
|
47
|
+
connectToClient() {
|
|
48
|
+
return GOClickHouseClient.getClient();
|
|
49
|
+
}
|
|
50
|
+
async postInit() {
|
|
51
|
+
console.log('Post init ClickHouse service for Simplified Apex Inspection Decisions...');
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
/* * */
|
|
55
|
+
export const simplifiedApexInspectionDecisionsNew = asyncSingletonProxy(SimplifiedApexInspectionDecisionsNewClass);
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { ClickHouseInterfaceTemplate } from '../../../templates/clickhouse.js';
|
|
2
|
+
import { type ClickHouseSchema } from '../../../types/index.js';
|
|
3
|
+
import { type SimplifiedApexInspection } from '@tmlmobilidade/go-types-apex';
|
|
4
|
+
declare class SimplifiedApexInspectionsNewClass extends ClickHouseInterfaceTemplate<SimplifiedApexInspection> {
|
|
5
|
+
private static _instance;
|
|
6
|
+
protected readonly databaseName = "simplified_apex";
|
|
7
|
+
protected readonly schema: ClickHouseSchema<{
|
|
8
|
+
_id: string;
|
|
9
|
+
agency_id: string;
|
|
10
|
+
created_at: number & {
|
|
11
|
+
__brand: "UnixTimestamp";
|
|
12
|
+
};
|
|
13
|
+
is_ok: boolean;
|
|
14
|
+
received_at: number & {
|
|
15
|
+
__brand: "UnixTimestamp";
|
|
16
|
+
};
|
|
17
|
+
apex_version: string;
|
|
18
|
+
device_id: string;
|
|
19
|
+
is_ok_pcgi: boolean;
|
|
20
|
+
line_id: string;
|
|
21
|
+
mac_ase_counter_value: number;
|
|
22
|
+
mac_sam_serial_number: number;
|
|
23
|
+
pattern_id: string;
|
|
24
|
+
product_id: string;
|
|
25
|
+
trip_id: string;
|
|
26
|
+
vehicle_id: number;
|
|
27
|
+
card_serial_number: string;
|
|
28
|
+
control_destination_stop_id: string;
|
|
29
|
+
control_origin_stop_id: string;
|
|
30
|
+
control_status: number;
|
|
31
|
+
environment_status: number;
|
|
32
|
+
inspection_id: string | null;
|
|
33
|
+
}>;
|
|
34
|
+
protected readonly tableName = "inspections";
|
|
35
|
+
/**
|
|
36
|
+
* Returns the singleton instance of the subclass.
|
|
37
|
+
*/
|
|
38
|
+
static getInstance(): Promise<SimplifiedApexInspectionsNewClass>;
|
|
39
|
+
protected connectToClient(): Promise<import("@clickhouse/client").ClickHouseClient>;
|
|
40
|
+
protected postInit(): Promise<void>;
|
|
41
|
+
}
|
|
42
|
+
export declare const simplifiedApexInspectionsNew: SimplifiedApexInspectionsNewClass;
|
|
43
|
+
export {};
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/* * */
|
|
2
|
+
import { GOClickHouseClient } from '../../../clients/go-clickhouse.js';
|
|
3
|
+
import { ClickHouseInterfaceTemplate } from '../../../templates/clickhouse.js';
|
|
4
|
+
import { asyncSingletonProxy } from '@tmlmobilidade/utils';
|
|
5
|
+
/* * */
|
|
6
|
+
const tableSchema = {
|
|
7
|
+
_id: { primaryKey: true, type: 'String' },
|
|
8
|
+
agency_id: { type: 'String' },
|
|
9
|
+
apex_version: { type: 'String' },
|
|
10
|
+
card_serial_number: { type: 'String' },
|
|
11
|
+
control_destination_stop_id: { type: 'String' },
|
|
12
|
+
control_origin_stop_id: { type: 'String' },
|
|
13
|
+
control_status: { type: 'Int64' },
|
|
14
|
+
created_at: { type: 'Int64' },
|
|
15
|
+
device_id: { type: 'String' },
|
|
16
|
+
environment_status: { type: 'Int64' },
|
|
17
|
+
inspection_id: { type: 'String' },
|
|
18
|
+
is_ok: { type: 'Bool' },
|
|
19
|
+
is_ok_pcgi: { type: 'Bool' },
|
|
20
|
+
line_id: { type: 'String' },
|
|
21
|
+
mac_ase_counter_value: { type: 'Int64' },
|
|
22
|
+
mac_sam_serial_number: { type: 'Int64' },
|
|
23
|
+
pattern_id: { type: 'String' },
|
|
24
|
+
product_id: { type: 'String' },
|
|
25
|
+
received_at: { type: 'Int64' },
|
|
26
|
+
trip_id: { type: 'String' },
|
|
27
|
+
vehicle_id: { type: 'String' },
|
|
28
|
+
};
|
|
29
|
+
/* * */
|
|
30
|
+
class SimplifiedApexInspectionsNewClass extends ClickHouseInterfaceTemplate {
|
|
31
|
+
//
|
|
32
|
+
static _instance = null;
|
|
33
|
+
databaseName = 'simplified_apex';
|
|
34
|
+
schema = tableSchema;
|
|
35
|
+
tableName = 'inspections';
|
|
36
|
+
/**
|
|
37
|
+
* Returns the singleton instance of the subclass.
|
|
38
|
+
*/
|
|
39
|
+
static async getInstance() {
|
|
40
|
+
// If no instance exists, create one and store the promise.
|
|
41
|
+
// This ensures that if multiple calls to getInstance() happen concurrently,
|
|
42
|
+
// they will all await the same initialization process.
|
|
43
|
+
if (!this._instance) {
|
|
44
|
+
this._instance = (async () => {
|
|
45
|
+
const instance = new SimplifiedApexInspectionsNewClass();
|
|
46
|
+
// This behaves like the constructor,
|
|
47
|
+
// but allows for async initialization.
|
|
48
|
+
await instance.init();
|
|
49
|
+
return instance;
|
|
50
|
+
})();
|
|
51
|
+
}
|
|
52
|
+
// Await the instance if it's still initializing,
|
|
53
|
+
// or return it immediately if ready.
|
|
54
|
+
return await this._instance;
|
|
55
|
+
}
|
|
56
|
+
connectToClient() {
|
|
57
|
+
return GOClickHouseClient.getClient();
|
|
58
|
+
}
|
|
59
|
+
async postInit() {
|
|
60
|
+
console.log('Post init ClickHouse service for Simplified Apex Inspections...');
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
/* * */
|
|
64
|
+
export const simplifiedApexInspectionsNew = asyncSingletonProxy(SimplifiedApexInspectionsNewClass);
|
|
@@ -1,18 +1,15 @@
|
|
|
1
|
-
import { ClickHouseInterfaceTemplate } from '
|
|
2
|
-
import { type ClickHouseSchema } from '
|
|
3
|
-
import { type SimplifiedApexLocation } from '@tmlmobilidade/types';
|
|
1
|
+
import { ClickHouseInterfaceTemplate } from '../../../templates/clickhouse.js';
|
|
2
|
+
import { type ClickHouseSchema } from '../../../types/index.js';
|
|
3
|
+
import { type SimplifiedApexLocation } from '@tmlmobilidade/go-types-apex';
|
|
4
4
|
declare class SimplifiedApexLocationsNewClass extends ClickHouseInterfaceTemplate<SimplifiedApexLocation> {
|
|
5
5
|
private static _instance;
|
|
6
|
-
protected readonly databaseName = "
|
|
6
|
+
protected readonly databaseName = "simplified_apex";
|
|
7
7
|
protected readonly schema: ClickHouseSchema<{
|
|
8
8
|
_id: string;
|
|
9
|
+
agency_id: string;
|
|
9
10
|
created_at: number & {
|
|
10
11
|
__brand: "UnixTimestamp";
|
|
11
12
|
};
|
|
12
|
-
updated_at: number & {
|
|
13
|
-
__brand: "UnixTimestamp";
|
|
14
|
-
};
|
|
15
|
-
agency_id: string;
|
|
16
13
|
received_at: number & {
|
|
17
14
|
__brand: "UnixTimestamp";
|
|
18
15
|
};
|
|
@@ -26,7 +23,7 @@ declare class SimplifiedApexLocationsNewClass extends ClickHouseInterfaceTemplat
|
|
|
26
23
|
trip_id: string;
|
|
27
24
|
vehicle_id: number;
|
|
28
25
|
}>;
|
|
29
|
-
protected readonly tableName = "
|
|
26
|
+
protected readonly tableName = "locations";
|
|
30
27
|
/**
|
|
31
28
|
* Returns the singleton instance of the subclass.
|
|
32
29
|
*/
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/* * */
|
|
2
|
-
import { GOClickHouseClient } from '
|
|
3
|
-
import { ClickHouseInterfaceTemplate } from '
|
|
2
|
+
import { GOClickHouseClient } from '../../../clients/go-clickhouse.js';
|
|
3
|
+
import { ClickHouseInterfaceTemplate } from '../../../templates/clickhouse.js';
|
|
4
4
|
import { asyncSingletonProxy } from '@tmlmobilidade/utils';
|
|
5
5
|
/* * */
|
|
6
6
|
const tableSchema = {
|
|
@@ -16,16 +16,15 @@ const tableSchema = {
|
|
|
16
16
|
received_at: { type: 'Int64' },
|
|
17
17
|
stop_id: { type: 'String' },
|
|
18
18
|
trip_id: { type: 'String' },
|
|
19
|
-
updated_at: { type: 'Int64' },
|
|
20
19
|
vehicle_id: { type: 'String' },
|
|
21
20
|
};
|
|
22
21
|
/* * */
|
|
23
22
|
class SimplifiedApexLocationsNewClass extends ClickHouseInterfaceTemplate {
|
|
24
23
|
//
|
|
25
24
|
static _instance = null;
|
|
26
|
-
databaseName = '
|
|
25
|
+
databaseName = 'simplified_apex';
|
|
27
26
|
schema = tableSchema;
|
|
28
|
-
tableName = '
|
|
27
|
+
tableName = 'locations';
|
|
29
28
|
/**
|
|
30
29
|
* Returns the singleton instance of the subclass.
|
|
31
30
|
*/
|
|
@@ -1,18 +1,15 @@
|
|
|
1
|
-
import { ClickHouseInterfaceTemplate } from '
|
|
2
|
-
import { type ClickHouseSchema } from '
|
|
3
|
-
import { type SimplifiedApexOnBoardRefund } from '@tmlmobilidade/types';
|
|
1
|
+
import { ClickHouseInterfaceTemplate } from '../../../templates/clickhouse.js';
|
|
2
|
+
import { type ClickHouseSchema } from '../../../types/index.js';
|
|
3
|
+
import { type SimplifiedApexOnBoardRefund } from '@tmlmobilidade/go-types-apex';
|
|
4
4
|
declare class SimplifiedApexOnBoardRefundsNewClass extends ClickHouseInterfaceTemplate<SimplifiedApexOnBoardRefund> {
|
|
5
5
|
private static _instance;
|
|
6
|
-
protected readonly databaseName = "
|
|
6
|
+
protected readonly databaseName = "simplified_apex";
|
|
7
7
|
protected readonly schema: ClickHouseSchema<{
|
|
8
8
|
_id: string;
|
|
9
|
+
agency_id: string;
|
|
9
10
|
created_at: number & {
|
|
10
11
|
__brand: "UnixTimestamp";
|
|
11
12
|
};
|
|
12
|
-
updated_at: number & {
|
|
13
|
-
__brand: "UnixTimestamp";
|
|
14
|
-
};
|
|
15
|
-
agency_id: string;
|
|
16
13
|
received_at: number & {
|
|
17
14
|
__brand: "UnixTimestamp";
|
|
18
15
|
};
|
|
@@ -36,7 +33,7 @@ declare class SimplifiedApexOnBoardRefundsNewClass extends ClickHouseInterfaceTe
|
|
|
36
33
|
product_quantity: number;
|
|
37
34
|
validation_id: string | null;
|
|
38
35
|
}>;
|
|
39
|
-
protected readonly tableName = "
|
|
36
|
+
protected readonly tableName = "refunds";
|
|
40
37
|
/**
|
|
41
38
|
* Returns the singleton instance of the subclass.
|
|
42
39
|
*/
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/* * */
|
|
2
|
-
import { GOClickHouseClient } from '
|
|
3
|
-
import { ClickHouseInterfaceTemplate } from '
|
|
2
|
+
import { GOClickHouseClient } from '../../../clients/go-clickhouse.js';
|
|
3
|
+
import { ClickHouseInterfaceTemplate } from '../../../templates/clickhouse.js';
|
|
4
4
|
import { asyncSingletonProxy } from '@tmlmobilidade/utils';
|
|
5
5
|
/* * */
|
|
6
6
|
const tableSchema = {
|
|
@@ -25,7 +25,6 @@ const tableSchema = {
|
|
|
25
25
|
received_at: { type: 'Int64' },
|
|
26
26
|
stop_id: { type: 'String' },
|
|
27
27
|
trip_id: { type: 'String' },
|
|
28
|
-
updated_at: { type: 'Int64' },
|
|
29
28
|
validation_id: { type: 'Nullable(String)' },
|
|
30
29
|
vehicle_id: { type: 'String' },
|
|
31
30
|
};
|
|
@@ -33,9 +32,9 @@ const tableSchema = {
|
|
|
33
32
|
class SimplifiedApexOnBoardRefundsNewClass extends ClickHouseInterfaceTemplate {
|
|
34
33
|
//
|
|
35
34
|
static _instance = null;
|
|
36
|
-
databaseName = '
|
|
35
|
+
databaseName = 'simplified_apex';
|
|
37
36
|
schema = tableSchema;
|
|
38
|
-
tableName = '
|
|
37
|
+
tableName = 'refunds';
|
|
39
38
|
/**
|
|
40
39
|
* Returns the singleton instance of the subclass.
|
|
41
40
|
*/
|
|
@@ -1,18 +1,15 @@
|
|
|
1
|
-
import { ClickHouseInterfaceTemplate } from '
|
|
2
|
-
import { type ClickHouseSchema } from '
|
|
3
|
-
import { type SimplifiedApexOnBoardSale } from '@tmlmobilidade/types';
|
|
1
|
+
import { ClickHouseInterfaceTemplate } from '../../../templates/clickhouse.js';
|
|
2
|
+
import { type ClickHouseSchema } from '../../../types/index.js';
|
|
3
|
+
import { type SimplifiedApexOnBoardSale } from '@tmlmobilidade/go-types-apex';
|
|
4
4
|
declare class SimplifiedApexOnBoardSalesNewClass extends ClickHouseInterfaceTemplate<SimplifiedApexOnBoardSale> {
|
|
5
5
|
private static _instance;
|
|
6
|
-
protected readonly databaseName = "
|
|
6
|
+
protected readonly databaseName = "simplified_apex";
|
|
7
7
|
protected readonly schema: ClickHouseSchema<{
|
|
8
8
|
_id: string;
|
|
9
|
+
agency_id: string;
|
|
9
10
|
created_at: number & {
|
|
10
11
|
__brand: "UnixTimestamp";
|
|
11
12
|
};
|
|
12
|
-
updated_at: number & {
|
|
13
|
-
__brand: "UnixTimestamp";
|
|
14
|
-
};
|
|
15
|
-
agency_id: string;
|
|
16
13
|
received_at: number & {
|
|
17
14
|
__brand: "UnixTimestamp";
|
|
18
15
|
};
|
|
@@ -37,7 +34,7 @@ declare class SimplifiedApexOnBoardSalesNewClass extends ClickHouseInterfaceTemp
|
|
|
37
34
|
is_passenger: boolean;
|
|
38
35
|
on_board_refund_id: string | null;
|
|
39
36
|
}>;
|
|
40
|
-
protected readonly tableName = "
|
|
37
|
+
protected readonly tableName = "sales";
|
|
41
38
|
/**
|
|
42
39
|
* Returns the singleton instance of the subclass.
|
|
43
40
|
*/
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/* * */
|
|
2
|
-
import { GOClickHouseClient } from '
|
|
3
|
-
import { ClickHouseInterfaceTemplate } from '
|
|
2
|
+
import { GOClickHouseClient } from '../../../clients/go-clickhouse.js';
|
|
3
|
+
import { ClickHouseInterfaceTemplate } from '../../../templates/clickhouse.js';
|
|
4
4
|
import { asyncSingletonProxy } from '@tmlmobilidade/utils';
|
|
5
5
|
/* * */
|
|
6
6
|
const tableSchema = {
|
|
@@ -26,7 +26,6 @@ const tableSchema = {
|
|
|
26
26
|
received_at: { type: 'Int64' },
|
|
27
27
|
stop_id: { type: 'String' },
|
|
28
28
|
trip_id: { type: 'String' },
|
|
29
|
-
updated_at: { type: 'Int64' },
|
|
30
29
|
validation_id: { type: 'Nullable(String)' },
|
|
31
30
|
vehicle_id: { type: 'String' },
|
|
32
31
|
};
|
|
@@ -34,9 +33,9 @@ const tableSchema = {
|
|
|
34
33
|
class SimplifiedApexOnBoardSalesNewClass extends ClickHouseInterfaceTemplate {
|
|
35
34
|
//
|
|
36
35
|
static _instance = null;
|
|
37
|
-
databaseName = '
|
|
36
|
+
databaseName = 'simplified_apex';
|
|
38
37
|
schema = tableSchema;
|
|
39
|
-
tableName = '
|
|
38
|
+
tableName = 'sales';
|
|
40
39
|
/**
|
|
41
40
|
* Returns the singleton instance of the subclass.
|
|
42
41
|
*/
|
package/dist/interfaces/{simplified-apex → apex/simplified}/simplified-apex-validations.d.ts
RENAMED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { ClickHouseInterfaceTemplate } from '
|
|
2
|
-
import { type ClickHouseSchema } from '
|
|
3
|
-
import { type SimplifiedApexValidation } from '@tmlmobilidade/types';
|
|
1
|
+
import { ClickHouseInterfaceTemplate } from '../../../templates/clickhouse.js';
|
|
2
|
+
import { type ClickHouseSchema } from '../../../types/index.js';
|
|
3
|
+
import { type SimplifiedApexValidation } from '@tmlmobilidade/go-types-apex';
|
|
4
4
|
declare class SimplifiedApexValidationsNewClass extends ClickHouseInterfaceTemplate<SimplifiedApexValidation> {
|
|
5
5
|
private static _instance;
|
|
6
|
-
protected readonly databaseName = "
|
|
6
|
+
protected readonly databaseName = "simplified_apex";
|
|
7
7
|
protected readonly schema: ClickHouseSchema<{
|
|
8
8
|
_id: string;
|
|
9
|
+
agency_id: string;
|
|
9
10
|
created_at: number & {
|
|
10
11
|
__brand: "UnixTimestamp";
|
|
11
12
|
};
|
|
12
|
-
agency_id: string;
|
|
13
13
|
is_ok: boolean;
|
|
14
14
|
received_at: number & {
|
|
15
15
|
__brand: "UnixTimestamp";
|
|
@@ -31,10 +31,10 @@ declare class SimplifiedApexValidationsNewClass extends ClickHouseInterfaceTempl
|
|
|
31
31
|
on_board_sale_id: string | null;
|
|
32
32
|
is_passenger: boolean;
|
|
33
33
|
on_board_refund_id: string | null;
|
|
34
|
-
category: "
|
|
35
|
-
validation_status: 0 | 1 | 2 |
|
|
34
|
+
category: "on_board_sale" | "prepaid" | "subscription" | null;
|
|
35
|
+
validation_status: 0 | 1 | 2 | 3 | 4 | 5 | 6 | 10 | 7 | 8 | 9 | 11 | 12 | 13;
|
|
36
36
|
}>;
|
|
37
|
-
protected readonly tableName = "
|
|
37
|
+
protected readonly tableName = "validations";
|
|
38
38
|
/**
|
|
39
39
|
* Returns the singleton instance of the subclass.
|
|
40
40
|
*/
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/* * */
|
|
2
|
-
import { GOClickHouseClient } from '
|
|
3
|
-
import { ClickHouseInterfaceTemplate } from '
|
|
2
|
+
import { GOClickHouseClient } from '../../../clients/go-clickhouse.js';
|
|
3
|
+
import { ClickHouseInterfaceTemplate } from '../../../templates/clickhouse.js';
|
|
4
4
|
import { asyncSingletonProxy } from '@tmlmobilidade/utils';
|
|
5
5
|
/* * */
|
|
6
6
|
const tableSchema = {
|
|
@@ -33,9 +33,9 @@ const tableSchema = {
|
|
|
33
33
|
class SimplifiedApexValidationsNewClass extends ClickHouseInterfaceTemplate {
|
|
34
34
|
//
|
|
35
35
|
static _instance = null;
|
|
36
|
-
databaseName = '
|
|
36
|
+
databaseName = 'simplified_apex';
|
|
37
37
|
schema = tableSchema;
|
|
38
|
-
tableName = '
|
|
38
|
+
tableName = 'validations';
|
|
39
39
|
/**
|
|
40
40
|
* Returns the singleton instance of the subclass.
|
|
41
41
|
*/
|
package/dist/interfaces/index.js
CHANGED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export * from './pcgi-locations.js';
|
|
2
|
+
export * from './pcgi-sales.js';
|
|
3
|
+
export * from './pcgi-transaction-entities.js';
|
|
4
|
+
export * from './pcgi-validations.js';
|
|
5
|
+
export * from '../vehicle-events/raw-vehicle-events.js';
|
|
6
|
+
export * from '../vehicle-events/simplified-vehicle-events.js';
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export * from './pcgi-locations.js';
|
|
2
|
+
export * from './pcgi-sales.js';
|
|
3
|
+
export * from './pcgi-transaction-entities.js';
|
|
4
|
+
export * from './pcgi-validations.js';
|
|
5
|
+
export * from '../vehicle-events/raw-vehicle-events.js';
|
|
6
|
+
export * from '../vehicle-events/simplified-vehicle-events.js';
|