@tmlmobilidade/types 20260121.1805.44 → 20260121.2317.50

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.
@@ -15,3 +15,146 @@ export declare const PositionSchema: z.ZodObject<{
15
15
  latitude: number;
16
16
  longitude: number;
17
17
  }>;
18
+ export declare const ExtendedPositionSchema: z.ZodObject<{
19
+ geohash: z.ZodObject<{
20
+ geohash_2: z.ZodString;
21
+ geohash_3: z.ZodString;
22
+ geohash_4: z.ZodString;
23
+ geohash_5: z.ZodString;
24
+ geohash_6: z.ZodString;
25
+ geohash_7: z.ZodString;
26
+ geohash_8: z.ZodString;
27
+ geohash_9: z.ZodString;
28
+ geohash_10: z.ZodString;
29
+ geohash_11: z.ZodString;
30
+ geohash_12: z.ZodString;
31
+ }, "strip", z.ZodTypeAny, {
32
+ geohash_2: string;
33
+ geohash_3: string;
34
+ geohash_4: string;
35
+ geohash_5: string;
36
+ geohash_6: string;
37
+ geohash_7: string;
38
+ geohash_8: string;
39
+ geohash_9: string;
40
+ geohash_10: string;
41
+ geohash_11: string;
42
+ geohash_12: string;
43
+ }, {
44
+ geohash_2: string;
45
+ geohash_3: string;
46
+ geohash_4: string;
47
+ geohash_5: string;
48
+ geohash_6: string;
49
+ geohash_7: string;
50
+ geohash_8: string;
51
+ geohash_9: string;
52
+ geohash_10: string;
53
+ geohash_11: string;
54
+ geohash_12: string;
55
+ }>;
56
+ h3: z.ZodObject<{
57
+ h3_1: z.ZodString;
58
+ h3_2: z.ZodString;
59
+ h3_3: z.ZodString;
60
+ h3_4: z.ZodString;
61
+ h3_5: z.ZodString;
62
+ h3_6: z.ZodString;
63
+ h3_7: z.ZodString;
64
+ h3_8: z.ZodString;
65
+ h3_9: z.ZodString;
66
+ h3_10: z.ZodString;
67
+ h3_11: z.ZodString;
68
+ h3_12: z.ZodString;
69
+ }, "strip", z.ZodTypeAny, {
70
+ h3_1: string;
71
+ h3_2: string;
72
+ h3_3: string;
73
+ h3_4: string;
74
+ h3_5: string;
75
+ h3_6: string;
76
+ h3_7: string;
77
+ h3_8: string;
78
+ h3_9: string;
79
+ h3_10: string;
80
+ h3_11: string;
81
+ h3_12: string;
82
+ }, {
83
+ h3_1: string;
84
+ h3_2: string;
85
+ h3_3: string;
86
+ h3_4: string;
87
+ h3_5: string;
88
+ h3_6: string;
89
+ h3_7: string;
90
+ h3_8: string;
91
+ h3_9: string;
92
+ h3_10: string;
93
+ h3_11: string;
94
+ h3_12: string;
95
+ }>;
96
+ latitude: z.ZodNumber;
97
+ longitude: z.ZodNumber;
98
+ }, "strip", z.ZodTypeAny, {
99
+ geohash: {
100
+ geohash_2: string;
101
+ geohash_3: string;
102
+ geohash_4: string;
103
+ geohash_5: string;
104
+ geohash_6: string;
105
+ geohash_7: string;
106
+ geohash_8: string;
107
+ geohash_9: string;
108
+ geohash_10: string;
109
+ geohash_11: string;
110
+ geohash_12: string;
111
+ };
112
+ h3: {
113
+ h3_1: string;
114
+ h3_2: string;
115
+ h3_3: string;
116
+ h3_4: string;
117
+ h3_5: string;
118
+ h3_6: string;
119
+ h3_7: string;
120
+ h3_8: string;
121
+ h3_9: string;
122
+ h3_10: string;
123
+ h3_11: string;
124
+ h3_12: string;
125
+ };
126
+ latitude: number;
127
+ longitude: number;
128
+ }, {
129
+ geohash: {
130
+ geohash_2: string;
131
+ geohash_3: string;
132
+ geohash_4: string;
133
+ geohash_5: string;
134
+ geohash_6: string;
135
+ geohash_7: string;
136
+ geohash_8: string;
137
+ geohash_9: string;
138
+ geohash_10: string;
139
+ geohash_11: string;
140
+ geohash_12: string;
141
+ };
142
+ h3: {
143
+ h3_1: string;
144
+ h3_2: string;
145
+ h3_3: string;
146
+ h3_4: string;
147
+ h3_5: string;
148
+ h3_6: string;
149
+ h3_7: string;
150
+ h3_8: string;
151
+ h3_9: string;
152
+ h3_10: string;
153
+ h3_11: string;
154
+ h3_12: string;
155
+ };
156
+ latitude: number;
157
+ longitude: number;
158
+ }>;
159
+ export type Position = z.infer<typeof PositionSchema>;
160
+ export type ExtendedPosition = z.infer<typeof ExtendedPositionSchema>;
@@ -6,3 +6,36 @@ export const PositionSchema = z.object({
6
6
  latitude: z.number(),
7
7
  longitude: z.number(),
8
8
  });
9
+ export const ExtendedPositionSchema = z.object({
10
+ geohash: z.object({
11
+ geohash_2: z.string(),
12
+ geohash_3: z.string(),
13
+ geohash_4: z.string(),
14
+ geohash_5: z.string(),
15
+ geohash_6: z.string(),
16
+ geohash_7: z.string(),
17
+ geohash_8: z.string(),
18
+ geohash_9: z.string(),
19
+ //
20
+ geohash_10: z.string(),
21
+ geohash_11: z.string(),
22
+ geohash_12: z.string(),
23
+ }),
24
+ h3: z.object({
25
+ h3_1: z.string(),
26
+ h3_2: z.string(),
27
+ h3_3: z.string(),
28
+ h3_4: z.string(),
29
+ h3_5: z.string(),
30
+ h3_6: z.string(),
31
+ h3_7: z.string(),
32
+ h3_8: z.string(),
33
+ h3_9: z.string(),
34
+ //
35
+ h3_10: z.string(),
36
+ h3_11: z.string(),
37
+ h3_12: z.string(),
38
+ }),
39
+ latitude: z.number(),
40
+ longitude: z.number(),
41
+ });
@@ -0,0 +1,179 @@
1
+ import { z } from 'zod';
2
+ export declare const ClickHouseVehicleEventSchema: z.ZodObject<Omit<Omit<{
3
+ _id: z.ZodString;
4
+ created_at: z.ZodEffects<z.ZodNumber, import("../_common/index.js").UnixTimestamp, number>;
5
+ created_by: z.ZodOptional<z.ZodString>;
6
+ is_locked: z.ZodDefault<z.ZodBoolean>;
7
+ updated_at: z.ZodEffects<z.ZodNumber, import("../_common/index.js").UnixTimestamp, number>;
8
+ updated_by: z.ZodOptional<z.ZodString>;
9
+ }, "is_locked"> & {
10
+ agency_id: z.ZodString;
11
+ current_status: z.ZodEnum<["INCOMING_AT", "STOPPED_AT", "IN_TRANSIT_TO"]>;
12
+ driver_id: z.ZodString;
13
+ event_id: z.ZodString;
14
+ extra_trip_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
15
+ latitude: z.ZodNumber;
16
+ longitude: z.ZodNumber;
17
+ odometer: z.ZodNumber;
18
+ pattern_id: z.ZodString;
19
+ position: z.ZodObject<{
20
+ geohash: z.ZodString;
21
+ h3: z.ZodString;
22
+ latitude: z.ZodNumber;
23
+ longitude: z.ZodNumber;
24
+ }, "strip", z.ZodTypeAny, {
25
+ geohash: string;
26
+ h3: string;
27
+ latitude: number;
28
+ longitude: number;
29
+ }, {
30
+ geohash: string;
31
+ h3: string;
32
+ latitude: number;
33
+ longitude: number;
34
+ }>;
35
+ received_at: z.ZodEffects<z.ZodNumber, import("../_common/index.js").UnixTimestamp, number>;
36
+ stop_id: z.ZodString;
37
+ trigger_activity: z.ZodString;
38
+ trigger_door: z.ZodString;
39
+ trip_id: z.ZodString;
40
+ vehicle_id: z.ZodString;
41
+ }, "position"> & {
42
+ h3_1: z.ZodString;
43
+ h3_2: z.ZodString;
44
+ h3_3: z.ZodString;
45
+ h3_4: z.ZodString;
46
+ h3_5: z.ZodString;
47
+ h3_6: z.ZodString;
48
+ h3_7: z.ZodString;
49
+ h3_8: z.ZodString;
50
+ h3_9: z.ZodString;
51
+ h3_10: z.ZodString;
52
+ h3_11: z.ZodString;
53
+ h3_12: z.ZodString;
54
+ geohash_2: z.ZodString;
55
+ geohash_3: z.ZodString;
56
+ geohash_4: z.ZodString;
57
+ geohash_5: z.ZodString;
58
+ geohash_6: z.ZodString;
59
+ geohash_7: z.ZodString;
60
+ geohash_8: z.ZodString;
61
+ geohash_9: z.ZodString;
62
+ geohash_10: z.ZodString;
63
+ geohash_11: z.ZodString;
64
+ geohash_12: z.ZodString;
65
+ hour: z.ZodNumber;
66
+ operational_date: z.ZodEffects<z.ZodString, import("../_common/index.js").OperationalDate, string>;
67
+ plan_id: z.ZodString;
68
+ route_id: z.ZodString;
69
+ }, "strip", z.ZodTypeAny, {
70
+ _id: string;
71
+ created_at: number & {
72
+ __brand: "UnixTimestamp";
73
+ };
74
+ updated_at: number & {
75
+ __brand: "UnixTimestamp";
76
+ };
77
+ latitude: number;
78
+ longitude: number;
79
+ geohash_2: string;
80
+ geohash_3: string;
81
+ geohash_4: string;
82
+ geohash_5: string;
83
+ geohash_6: string;
84
+ geohash_7: string;
85
+ geohash_8: string;
86
+ geohash_9: string;
87
+ geohash_10: string;
88
+ geohash_11: string;
89
+ geohash_12: string;
90
+ h3_1: string;
91
+ h3_2: string;
92
+ h3_3: string;
93
+ h3_4: string;
94
+ h3_5: string;
95
+ h3_6: string;
96
+ h3_7: string;
97
+ h3_8: string;
98
+ h3_9: string;
99
+ h3_10: string;
100
+ h3_11: string;
101
+ h3_12: string;
102
+ agency_id: string;
103
+ pattern_id: string;
104
+ received_at: number & {
105
+ __brand: "UnixTimestamp";
106
+ };
107
+ stop_id: string;
108
+ trip_id: string;
109
+ vehicle_id: string;
110
+ plan_id: string;
111
+ route_id: string;
112
+ operational_date: string & {
113
+ __brand: "OperationalDate";
114
+ };
115
+ hour: number;
116
+ current_status: "INCOMING_AT" | "STOPPED_AT" | "IN_TRANSIT_TO";
117
+ driver_id: string;
118
+ event_id: string;
119
+ odometer: number;
120
+ trigger_activity: string;
121
+ trigger_door: string;
122
+ created_by?: string | undefined;
123
+ updated_by?: string | undefined;
124
+ extra_trip_id?: string | null | undefined;
125
+ }, {
126
+ _id: string;
127
+ created_at: number;
128
+ updated_at: number;
129
+ latitude: number;
130
+ longitude: number;
131
+ geohash_2: string;
132
+ geohash_3: string;
133
+ geohash_4: string;
134
+ geohash_5: string;
135
+ geohash_6: string;
136
+ geohash_7: string;
137
+ geohash_8: string;
138
+ geohash_9: string;
139
+ geohash_10: string;
140
+ geohash_11: string;
141
+ geohash_12: string;
142
+ h3_1: string;
143
+ h3_2: string;
144
+ h3_3: string;
145
+ h3_4: string;
146
+ h3_5: string;
147
+ h3_6: string;
148
+ h3_7: string;
149
+ h3_8: string;
150
+ h3_9: string;
151
+ h3_10: string;
152
+ h3_11: string;
153
+ h3_12: string;
154
+ agency_id: string;
155
+ pattern_id: string;
156
+ received_at: number;
157
+ stop_id: string;
158
+ trip_id: string;
159
+ vehicle_id: string;
160
+ plan_id: string;
161
+ route_id: string;
162
+ operational_date: string;
163
+ hour: number;
164
+ current_status: "INCOMING_AT" | "STOPPED_AT" | "IN_TRANSIT_TO";
165
+ driver_id: string;
166
+ event_id: string;
167
+ odometer: number;
168
+ trigger_activity: string;
169
+ trigger_door: string;
170
+ created_by?: string | undefined;
171
+ updated_by?: string | undefined;
172
+ extra_trip_id?: string | null | undefined;
173
+ }>;
174
+ /**
175
+ * ClickHouse Vehicle Events are used to store vehicle events in ClickHouse.
176
+ * They are based on the SimplifiedVehicleEventSchema but extended with additional fields
177
+ * specific to ClickHouse.
178
+ */
179
+ export type ClickHouseVehicleEvent = z.infer<typeof ClickHouseVehicleEventSchema>;
@@ -0,0 +1,13 @@
1
+ /* * */
2
+ import { ExtendedPositionSchema, operationalDateSchema } from '../_common/index.js';
3
+ import { z } from 'zod';
4
+ import { SimplifiedVehicleEventSchema } from './simplified-vehicle-event.js';
5
+ /* * */
6
+ export const ClickHouseVehicleEventSchema = SimplifiedVehicleEventSchema.omit({ position: true }).extend({
7
+ hour: z.number().min(0).max(23),
8
+ operational_date: operationalDateSchema,
9
+ plan_id: z.string(),
10
+ route_id: z.string(),
11
+ ...ExtendedPositionSchema.shape.geohash.shape,
12
+ ...ExtendedPositionSchema.shape.h3.shape,
13
+ });
@@ -1,2 +1,3 @@
1
+ export * from './clickhouse-vehicle-event.js';
1
2
  export * from './gtfs-rt-vehicle-event-extended.js';
2
3
  export * from './simplified-vehicle-event.js';
@@ -1,2 +1,3 @@
1
+ export * from './clickhouse-vehicle-event.js';
1
2
  export * from './gtfs-rt-vehicle-event-extended.js';
2
3
  export * from './simplified-vehicle-event.js';
@@ -56,18 +56,18 @@ export declare const SimplifiedVehicleEventSchema: z.ZodObject<Omit<{
56
56
  stop_id: string;
57
57
  trip_id: string;
58
58
  vehicle_id: string;
59
+ current_status: "INCOMING_AT" | "STOPPED_AT" | "IN_TRANSIT_TO";
59
60
  driver_id: string;
60
61
  event_id: string;
61
62
  odometer: number;
62
- trigger_activity: string;
63
- trigger_door: string;
64
- current_status: "INCOMING_AT" | "STOPPED_AT" | "IN_TRANSIT_TO";
65
63
  position: {
66
64
  geohash: string;
67
65
  h3: string;
68
66
  latitude: number;
69
67
  longitude: number;
70
68
  };
69
+ trigger_activity: string;
70
+ trigger_door: string;
71
71
  created_by?: string | undefined;
72
72
  updated_by?: string | undefined;
73
73
  extra_trip_id?: string | null | undefined;
@@ -83,18 +83,18 @@ export declare const SimplifiedVehicleEventSchema: z.ZodObject<Omit<{
83
83
  stop_id: string;
84
84
  trip_id: string;
85
85
  vehicle_id: string;
86
+ current_status: "INCOMING_AT" | "STOPPED_AT" | "IN_TRANSIT_TO";
86
87
  driver_id: string;
87
88
  event_id: string;
88
89
  odometer: number;
89
- trigger_activity: string;
90
- trigger_door: string;
91
- current_status: "INCOMING_AT" | "STOPPED_AT" | "IN_TRANSIT_TO";
92
90
  position: {
93
91
  geohash: string;
94
92
  h3: string;
95
93
  latitude: number;
96
94
  longitude: number;
97
95
  };
96
+ trigger_activity: string;
97
+ trigger_door: string;
98
98
  created_by?: string | undefined;
99
99
  updated_by?: string | undefined;
100
100
  extra_trip_id?: string | null | undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tmlmobilidade/types",
3
- "version": "20260121.1805.44",
3
+ "version": "20260121.2317.50",
4
4
  "author": {
5
5
  "email": "iso@tmlmobilidade.pt",
6
6
  "name": "TML-ISO"