@tmlmobilidade/types 20260518.1500.45 → 20260519.16.41

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.
@@ -1,5 +1,5 @@
1
1
  /* * */
2
- import { validateGtfsBinary, validateGtfsTernary } from './common.js';
2
+ import { validateGtfsBinary, validateGtfsHasField, validateGtfsTernary } from './common.js';
3
3
  /**
4
4
  * Validates and transforms a value into a GTFS Location Type.
5
5
  * It accepts numeric or string representations of location types.
@@ -77,13 +77,13 @@ export function validateGtfsStopExtended(rawData) {
77
77
  // Transform the raw data into the output format
78
78
  return {
79
79
  ...stop,
80
- has_bench: validateGtfsBinary(rawData.has_bench),
81
- has_network_map: validateGtfsBinary(rawData.has_network_map),
82
- has_pip_real_time: validateGtfsBinary(rawData.has_pip_real_time),
83
- has_schedules: validateGtfsBinary(rawData.has_schedules),
80
+ has_bench: validateGtfsHasField(rawData.has_bench),
81
+ has_network_map: validateGtfsHasField(rawData.has_network_map),
82
+ has_pip_real_time: validateGtfsHasField(rawData.has_pip_real_time),
83
+ has_schedules: validateGtfsHasField(rawData.has_schedules),
84
84
  has_shelter: validateGtfsBinary(rawData.has_shelter),
85
- has_stop_sign: validateGtfsBinary(rawData.has_stop_sign),
86
- has_tariffs_information: validateGtfsBinary(rawData.has_tariffs_information),
85
+ has_stop_sign: validateGtfsHasField(rawData.has_stop_sign),
86
+ has_tariffs_information: validateGtfsHasField(rawData.has_tariffs_information),
87
87
  municipality_id: rawData.municipality_id,
88
88
  parish_id: rawData.parish_id,
89
89
  public_visible: validateGtfsBinary(rawData.public_visible),
@@ -0,0 +1,141 @@
1
+ import { z } from 'zod';
2
+ export declare const HashedPatternWaypointSchema: z.ZodObject<{
3
+ drop_off_type: z.ZodUnion<[z.ZodLiteral<0>, z.ZodLiteral<1>, z.ZodLiteral<2>, z.ZodLiteral<3>]>;
4
+ pickup_type: z.ZodUnion<[z.ZodLiteral<0>, z.ZodLiteral<1>, z.ZodLiteral<2>, z.ZodLiteral<3>]>;
5
+ shape_dist_traveled: z.ZodNumber;
6
+ stop_id: z.ZodString;
7
+ stop_lat: z.ZodNumber;
8
+ stop_lon: z.ZodNumber;
9
+ stop_name: z.ZodString;
10
+ stop_sequence: z.ZodNumber;
11
+ timepoint: z.ZodNumber;
12
+ }, "strip", z.ZodTypeAny, {
13
+ stop_id: string;
14
+ drop_off_type: 0 | 1 | 2 | 3;
15
+ pickup_type: 0 | 1 | 2 | 3;
16
+ shape_dist_traveled: number;
17
+ stop_sequence: number;
18
+ timepoint: number;
19
+ stop_lat: number;
20
+ stop_lon: number;
21
+ stop_name: string;
22
+ }, {
23
+ stop_id: string;
24
+ drop_off_type: 0 | 1 | 2 | 3;
25
+ pickup_type: 0 | 1 | 2 | 3;
26
+ shape_dist_traveled: number;
27
+ stop_sequence: number;
28
+ timepoint: number;
29
+ stop_lat: number;
30
+ stop_lon: number;
31
+ stop_name: string;
32
+ }>;
33
+ export type HashedPatternWaypoint = z.infer<typeof HashedPatternWaypointSchema>;
34
+ export declare const HashedPatternSchema: z.ZodObject<Omit<{
35
+ _id: z.ZodString;
36
+ created_at: z.ZodEffects<z.ZodNumber, import("../../index.js").UnixTimestamp, number>;
37
+ created_by: z.ZodDefault<z.ZodNullable<z.ZodString>>;
38
+ is_locked: z.ZodDefault<z.ZodBoolean>;
39
+ updated_at: z.ZodEffects<z.ZodNumber, import("../../index.js").UnixTimestamp, number>;
40
+ updated_by: z.ZodOptional<z.ZodString>;
41
+ }, "created_by" | "is_locked" | "updated_by"> & {
42
+ agency_id: z.ZodString;
43
+ line_id: z.ZodNumber;
44
+ line_long_name: z.ZodString;
45
+ line_short_name: z.ZodString;
46
+ path: z.ZodDefault<z.ZodArray<z.ZodObject<{
47
+ drop_off_type: z.ZodUnion<[z.ZodLiteral<0>, z.ZodLiteral<1>, z.ZodLiteral<2>, z.ZodLiteral<3>]>;
48
+ pickup_type: z.ZodUnion<[z.ZodLiteral<0>, z.ZodLiteral<1>, z.ZodLiteral<2>, z.ZodLiteral<3>]>;
49
+ shape_dist_traveled: z.ZodNumber;
50
+ stop_id: z.ZodString;
51
+ stop_lat: z.ZodNumber;
52
+ stop_lon: z.ZodNumber;
53
+ stop_name: z.ZodString;
54
+ stop_sequence: z.ZodNumber;
55
+ timepoint: z.ZodNumber;
56
+ }, "strip", z.ZodTypeAny, {
57
+ stop_id: string;
58
+ drop_off_type: 0 | 1 | 2 | 3;
59
+ pickup_type: 0 | 1 | 2 | 3;
60
+ shape_dist_traveled: number;
61
+ stop_sequence: number;
62
+ timepoint: number;
63
+ stop_lat: number;
64
+ stop_lon: number;
65
+ stop_name: string;
66
+ }, {
67
+ stop_id: string;
68
+ drop_off_type: 0 | 1 | 2 | 3;
69
+ pickup_type: 0 | 1 | 2 | 3;
70
+ shape_dist_traveled: number;
71
+ stop_sequence: number;
72
+ timepoint: number;
73
+ stop_lat: number;
74
+ stop_lon: number;
75
+ stop_name: string;
76
+ }>, "many">>;
77
+ pattern_id: z.ZodString;
78
+ route_color: z.ZodString;
79
+ route_id: z.ZodString;
80
+ route_long_name: z.ZodString;
81
+ route_short_name: z.ZodString;
82
+ route_text_color: z.ZodString;
83
+ trip_headsign: z.ZodString;
84
+ }, "strip", z.ZodTypeAny, {
85
+ _id: string;
86
+ created_at: number & {
87
+ __brand: "UnixTimestamp";
88
+ };
89
+ updated_at: number & {
90
+ __brand: "UnixTimestamp";
91
+ };
92
+ path: {
93
+ stop_id: string;
94
+ drop_off_type: 0 | 1 | 2 | 3;
95
+ pickup_type: 0 | 1 | 2 | 3;
96
+ shape_dist_traveled: number;
97
+ stop_sequence: number;
98
+ timepoint: number;
99
+ stop_lat: number;
100
+ stop_lon: number;
101
+ stop_name: string;
102
+ }[];
103
+ agency_id: string;
104
+ line_id: number;
105
+ pattern_id: string;
106
+ route_id: string;
107
+ route_color: string;
108
+ route_long_name: string;
109
+ route_short_name: string;
110
+ route_text_color: string;
111
+ trip_headsign: string;
112
+ line_long_name: string;
113
+ line_short_name: string;
114
+ }, {
115
+ _id: string;
116
+ created_at: number;
117
+ updated_at: number;
118
+ agency_id: string;
119
+ line_id: number;
120
+ pattern_id: string;
121
+ route_id: string;
122
+ route_color: string;
123
+ route_long_name: string;
124
+ route_short_name: string;
125
+ route_text_color: string;
126
+ trip_headsign: string;
127
+ line_long_name: string;
128
+ line_short_name: string;
129
+ path?: {
130
+ stop_id: string;
131
+ drop_off_type: 0 | 1 | 2 | 3;
132
+ pickup_type: 0 | 1 | 2 | 3;
133
+ shape_dist_traveled: number;
134
+ stop_sequence: number;
135
+ timepoint: number;
136
+ stop_lat: number;
137
+ stop_lon: number;
138
+ stop_name: string;
139
+ }[] | undefined;
140
+ }>;
141
+ export type HashedPattern = z.infer<typeof HashedPatternSchema>;
@@ -0,0 +1,32 @@
1
+ /* * */
2
+ import { DocumentSchema } from '../../_common/document.js';
3
+ import { z } from 'zod';
4
+ /* * */
5
+ export const HashedPatternWaypointSchema = z.object({
6
+ drop_off_type: z.union([z.literal(0), z.literal(1), z.literal(2), z.literal(3)]),
7
+ pickup_type: z.union([z.literal(0), z.literal(1), z.literal(2), z.literal(3)]),
8
+ shape_dist_traveled: z.number(),
9
+ stop_id: z.string(),
10
+ stop_lat: z.number(),
11
+ stop_lon: z.number(),
12
+ stop_name: z.string(),
13
+ stop_sequence: z.number(),
14
+ timepoint: z.number(),
15
+ });
16
+ /* * */
17
+ export const HashedPatternSchema = DocumentSchema
18
+ .omit({ created_by: true, is_locked: true, updated_by: true })
19
+ .extend({
20
+ agency_id: z.string(),
21
+ line_id: z.number(),
22
+ line_long_name: z.string(),
23
+ line_short_name: z.string(),
24
+ path: z.array(HashedPatternWaypointSchema).default([]),
25
+ pattern_id: z.string(),
26
+ route_color: z.string(),
27
+ route_id: z.string(),
28
+ route_long_name: z.string(),
29
+ route_short_name: z.string(),
30
+ route_text_color: z.string(),
31
+ trip_headsign: z.string(),
32
+ });
@@ -0,0 +1 @@
1
+ export * from './hashed-pattern.js';
@@ -0,0 +1 @@
1
+ export * from './hashed-pattern.js';
@@ -1,3 +1,4 @@
1
+ export * from './hashed-patterns/index.js';
1
2
  export * from './hashed-shapes/index.js';
2
3
  export * from './hashed-trips/index.js';
3
4
  export * from './lines/index.js';
@@ -1,3 +1,4 @@
1
+ export * from './hashed-patterns/index.js';
1
2
  export * from './hashed-shapes/index.js';
2
3
  export * from './hashed-trips/index.js';
3
4
  export * from './lines/index.js';
@@ -458,6 +458,7 @@ export declare const RideNormalizedSchema: z.ZodObject<Omit<{
458
458
  end_time_scheduled: z.ZodEffects<z.ZodNumber, import("../../index.js").UnixTimestamp, number>;
459
459
  extension_observed: z.ZodNullable<z.ZodNumber>;
460
460
  extension_scheduled: z.ZodNumber;
461
+ hashed_pattern_id: z.ZodString;
461
462
  hashed_shape_id: z.ZodString;
462
463
  hashed_trip_id: z.ZodString;
463
464
  headsign: z.ZodString;
@@ -651,6 +652,7 @@ export declare const RideNormalizedSchema: z.ZodObject<Omit<{
651
652
  error_message?: string | undefined;
652
653
  };
653
654
  } | null;
655
+ hashed_pattern_id: string;
654
656
  hashed_shape_id: string;
655
657
  hashed_trip_id: string;
656
658
  system_status: "waiting" | "processing" | "complete" | "error" | "skipped";
@@ -799,6 +801,7 @@ export declare const RideNormalizedSchema: z.ZodObject<Omit<{
799
801
  error_message?: string | undefined;
800
802
  };
801
803
  } | null;
804
+ hashed_pattern_id: string;
802
805
  hashed_shape_id: string;
803
806
  hashed_trip_id: string;
804
807
  delay_status: "ontime" | "delayed" | "early" | "none";
@@ -458,6 +458,7 @@ export declare const RideSchema: z.ZodObject<Omit<{
458
458
  end_time_scheduled: z.ZodEffects<z.ZodNumber, import("../../_common/unix-timestamp.js").UnixTimestamp, number>;
459
459
  extension_observed: z.ZodNullable<z.ZodNumber>;
460
460
  extension_scheduled: z.ZodNumber;
461
+ hashed_pattern_id: z.ZodString;
461
462
  hashed_shape_id: z.ZodString;
462
463
  hashed_trip_id: z.ZodString;
463
464
  headsign: z.ZodString;
@@ -618,6 +619,7 @@ export declare const RideSchema: z.ZodObject<Omit<{
618
619
  error_message?: string | undefined;
619
620
  };
620
621
  } | null;
622
+ hashed_pattern_id: string;
621
623
  hashed_shape_id: string;
622
624
  hashed_trip_id: string;
623
625
  system_status: "waiting" | "processing" | "complete" | "error" | "skipped";
@@ -749,6 +751,7 @@ export declare const RideSchema: z.ZodObject<Omit<{
749
751
  error_message?: string | undefined;
750
752
  };
751
753
  } | null;
754
+ hashed_pattern_id: string;
752
755
  hashed_shape_id: string;
753
756
  hashed_trip_id: string;
754
757
  created_by?: string | null | undefined;
@@ -1231,6 +1234,7 @@ export declare const CreateRideSchema: z.ZodObject<Omit<{
1231
1234
  error_message?: string | undefined;
1232
1235
  };
1233
1236
  }>>;
1237
+ hashed_pattern_id: z.ZodString;
1234
1238
  hashed_shape_id: z.ZodString;
1235
1239
  hashed_trip_id: z.ZodString;
1236
1240
  system_status: z.ZodDefault<z.ZodEnum<["waiting", "processing", "complete", "error", "skipped"]>>;
@@ -1365,6 +1369,7 @@ export declare const CreateRideSchema: z.ZodObject<Omit<{
1365
1369
  error_message?: string | undefined;
1366
1370
  };
1367
1371
  } | null;
1372
+ hashed_pattern_id: string;
1368
1373
  hashed_shape_id: string;
1369
1374
  hashed_trip_id: string;
1370
1375
  system_status: "waiting" | "processing" | "complete" | "error" | "skipped";
@@ -1494,6 +1499,7 @@ export declare const CreateRideSchema: z.ZodObject<Omit<{
1494
1499
  error_message?: string | undefined;
1495
1500
  };
1496
1501
  } | null;
1502
+ hashed_pattern_id: string;
1497
1503
  hashed_shape_id: string;
1498
1504
  hashed_trip_id: string;
1499
1505
  _id?: string | undefined;
@@ -1974,6 +1980,7 @@ export declare const UpdateRideSchema: z.ZodObject<{
1974
1980
  error_message?: string | undefined;
1975
1981
  };
1976
1982
  }>>>;
1983
+ hashed_pattern_id: z.ZodOptional<z.ZodString>;
1977
1984
  hashed_shape_id: z.ZodOptional<z.ZodString>;
1978
1985
  hashed_trip_id: z.ZodOptional<z.ZodString>;
1979
1986
  system_status: z.ZodOptional<z.ZodDefault<z.ZodEnum<["waiting", "processing", "complete", "error", "skipped"]>>>;
@@ -2103,6 +2110,7 @@ export declare const UpdateRideSchema: z.ZodObject<{
2103
2110
  error_message?: string | undefined;
2104
2111
  };
2105
2112
  } | null | undefined;
2113
+ hashed_pattern_id?: string | undefined;
2106
2114
  hashed_shape_id?: string | undefined;
2107
2115
  hashed_trip_id?: string | undefined;
2108
2116
  system_status?: "waiting" | "processing" | "complete" | "error" | "skipped" | undefined;
@@ -2232,6 +2240,7 @@ export declare const UpdateRideSchema: z.ZodObject<{
2232
2240
  error_message?: string | undefined;
2233
2241
  };
2234
2242
  } | null | undefined;
2243
+ hashed_pattern_id?: string | undefined;
2235
2244
  hashed_shape_id?: string | undefined;
2236
2245
  hashed_trip_id?: string | undefined;
2237
2246
  system_status?: "waiting" | "processing" | "complete" | "error" | "skipped" | undefined;
@@ -38,6 +38,7 @@ export const RideSchema = DocumentSchema
38
38
  end_time_scheduled: UnixTimestampSchema,
39
39
  extension_observed: z.number().nullable(),
40
40
  extension_scheduled: z.number(),
41
+ hashed_pattern_id: z.string(),
41
42
  hashed_shape_id: z.string(),
42
43
  hashed_trip_id: z.string(),
43
44
  headsign: z.string(),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tmlmobilidade/types",
3
- "version": "20260518.1500.45",
3
+ "version": "20260519.16.41",
4
4
  "author": {
5
5
  "email": "iso@tmlmobilidade.pt",
6
6
  "name": "TML-ISO"