@tmlmobilidade/types 20260602.2346.23 → 20260603.1343.57

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.
@@ -3,3 +3,4 @@ export * from './lines.js';
3
3
  export * from './patterns.js';
4
4
  export * from './shapes.js';
5
5
  export * from './stop.js';
6
+ export * from './timetables.js';
@@ -3,3 +3,4 @@ export * from './lines.js';
3
3
  export * from './patterns.js';
4
4
  export * from './shapes.js';
5
5
  export * from './stop.js';
6
+ export * from './timetables.js';
@@ -1,5 +1,33 @@
1
1
  import { type Feature, type LineString } from 'geojson';
2
2
  import { z } from 'zod';
3
+ export declare const HubShapeGeoJsonSchema: z.ZodObject<{
4
+ geometry: z.ZodObject<{
5
+ coordinates: z.ZodArray<z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>, "many">;
6
+ type: z.ZodLiteral<"LineString">;
7
+ }, "strip", z.ZodTypeAny, {
8
+ type: "LineString";
9
+ coordinates: [number, number][];
10
+ }, {
11
+ type: "LineString";
12
+ coordinates: [number, number][];
13
+ }>;
14
+ properties: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
15
+ type: z.ZodLiteral<"Feature">;
16
+ }, "strip", z.ZodTypeAny, {
17
+ type: "Feature";
18
+ geometry: {
19
+ type: "LineString";
20
+ coordinates: [number, number][];
21
+ };
22
+ properties?: Record<string, any> | undefined;
23
+ }, {
24
+ type: "Feature";
25
+ geometry: {
26
+ type: "LineString";
27
+ coordinates: [number, number][];
28
+ };
29
+ properties?: Record<string, any> | undefined;
30
+ }>;
3
31
  export declare const HubShapePointSchema: z.ZodObject<{
4
32
  shape_dist_traveled: z.ZodNumber;
5
33
  shape_pt_lat: z.ZodNumber;
@@ -24,6 +52,34 @@ export declare const HubShapeSchema: z.ZodObject<{
24
52
  _id: z.ZodString;
25
53
  agency_id: z.ZodString;
26
54
  extension: z.ZodNumber;
55
+ geojson: z.ZodObject<{
56
+ geometry: z.ZodObject<{
57
+ coordinates: z.ZodArray<z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>, "many">;
58
+ type: z.ZodLiteral<"LineString">;
59
+ }, "strip", z.ZodTypeAny, {
60
+ type: "LineString";
61
+ coordinates: [number, number][];
62
+ }, {
63
+ type: "LineString";
64
+ coordinates: [number, number][];
65
+ }>;
66
+ properties: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
67
+ type: z.ZodLiteral<"Feature">;
68
+ }, "strip", z.ZodTypeAny, {
69
+ type: "Feature";
70
+ geometry: {
71
+ type: "LineString";
72
+ coordinates: [number, number][];
73
+ };
74
+ properties?: Record<string, any> | undefined;
75
+ }, {
76
+ type: "Feature";
77
+ geometry: {
78
+ type: "LineString";
79
+ coordinates: [number, number][];
80
+ };
81
+ properties?: Record<string, any> | undefined;
82
+ }>;
27
83
  points: z.ZodArray<z.ZodObject<{
28
84
  shape_dist_traveled: z.ZodNumber;
29
85
  shape_pt_lat: z.ZodNumber;
@@ -44,6 +100,14 @@ export declare const HubShapeSchema: z.ZodObject<{
44
100
  _id: string;
45
101
  agency_id: string;
46
102
  extension: number;
103
+ geojson: {
104
+ type: "Feature";
105
+ geometry: {
106
+ type: "LineString";
107
+ coordinates: [number, number][];
108
+ };
109
+ properties?: Record<string, any> | undefined;
110
+ };
47
111
  points: {
48
112
  shape_dist_traveled: number;
49
113
  shape_pt_lat: number;
@@ -54,6 +118,14 @@ export declare const HubShapeSchema: z.ZodObject<{
54
118
  _id: string;
55
119
  agency_id: string;
56
120
  extension: number;
121
+ geojson: {
122
+ type: "Feature";
123
+ geometry: {
124
+ type: "LineString";
125
+ coordinates: [number, number][];
126
+ };
127
+ properties?: Record<string, any> | undefined;
128
+ };
57
129
  points: {
58
130
  shape_dist_traveled: number;
59
131
  shape_pt_lat: number;
@@ -61,9 +133,13 @@ export declare const HubShapeSchema: z.ZodObject<{
61
133
  shape_pt_sequence: number;
62
134
  }[];
63
135
  }>;
136
+ /**
137
+ * GeoJSON feature for a hub network shape line.
138
+ */
139
+ export type HubShapeGeoJson = Feature<LineString>;
64
140
  /**
65
141
  * Publishable shape data for the Hub Shapes API.
66
142
  */
67
- export type HubShape = z.infer<typeof HubShapeSchema> & {
68
- geojson: Feature<LineString>;
143
+ export type HubShape = Omit<z.infer<typeof HubShapeSchema>, 'geojson'> & {
144
+ geojson: HubShapeGeoJson;
69
145
  };
@@ -1,6 +1,14 @@
1
1
  /* * */
2
2
  import { z } from 'zod';
3
3
  /* * */
4
+ export const HubShapeGeoJsonSchema = z.object({
5
+ geometry: z.object({
6
+ coordinates: z.array(z.tuple([z.number(), z.number()])),
7
+ type: z.literal('LineString'),
8
+ }),
9
+ properties: z.record(z.string(), z.any()).optional(),
10
+ type: z.literal('Feature'),
11
+ });
4
12
  export const HubShapePointSchema = z.object({
5
13
  shape_dist_traveled: z.number(),
6
14
  shape_pt_lat: z.number(),
@@ -12,5 +20,6 @@ export const HubShapeSchema = z.object({
12
20
  _id: z.string(),
13
21
  agency_id: z.string(),
14
22
  extension: z.number(),
23
+ geojson: HubShapeGeoJsonSchema,
15
24
  points: z.array(HubShapePointSchema),
16
25
  });
@@ -0,0 +1,36 @@
1
+ export interface Timetable {
2
+ exceptions: Exception[];
3
+ hours: Hour[];
4
+ }
5
+ export interface Hour {
6
+ hour_label: string;
7
+ hour_value: number;
8
+ minutes: Minute[];
9
+ }
10
+ export interface Minute {
11
+ exception_ids: string[];
12
+ minute_label: string;
13
+ minute_value: number;
14
+ trip_ids: string[];
15
+ }
16
+ interface ExceptionTemplate {
17
+ exception_id: string;
18
+ pattern_headsign: string;
19
+ pattern_id: string;
20
+ pattern_version_id: string;
21
+ route_long_name: string;
22
+ }
23
+ interface ExceptionExtensionSchedule {
24
+ calendar_desc: string;
25
+ type: 'schedule';
26
+ }
27
+ interface ExceptionExtensionVariant {
28
+ calendar_desc?: null;
29
+ type: 'variant';
30
+ }
31
+ export type Exception = ((ExceptionExtensionSchedule | ExceptionExtensionVariant) & ExceptionTemplate);
32
+ export interface NextArrival {
33
+ type: 'realtime' | 'scheduled';
34
+ unixTs: number;
35
+ }
36
+ export {};
@@ -0,0 +1,2 @@
1
+ /* * */
2
+ export {};
@@ -9,6 +9,6 @@ export declare const RoutePathTypeValues: readonly ["base", "partial", "variant"
9
9
  export declare const RoutePathTypeSchema: z.ZodEnum<["base", "partial", "variant"]>;
10
10
  export type RoutePathType = z.infer<typeof RoutePathTypeSchema>;
11
11
  export declare const pathTypeMapper: {
12
- fromGtfs: (value: "1" | "2" | "3") => "partial" | "base" | "variant";
13
- toGtfs: (value: "partial" | "base" | "variant") => "1" | "2" | "3";
12
+ fromGtfs: (value: "1" | "2" | "3") => "partial" | "variant" | "base";
13
+ toGtfs: (value: "partial" | "variant" | "base") => "1" | "2" | "3";
14
14
  };
@@ -48,7 +48,7 @@ export declare const RouteSchema: z.ZodObject<{
48
48
  code: string;
49
49
  name: string;
50
50
  line_id: string;
51
- path_type: "partial" | "base" | "variant";
51
+ path_type: "partial" | "variant" | "base";
52
52
  updated_by?: string | undefined;
53
53
  patterns?: {
54
54
  _id: string;
@@ -67,7 +67,7 @@ export declare const RouteSchema: z.ZodObject<{
67
67
  created_by?: string | null | undefined;
68
68
  is_locked?: boolean | undefined;
69
69
  updated_by?: string | undefined;
70
- path_type?: "partial" | "base" | "variant" | undefined;
70
+ path_type?: "partial" | "variant" | "base" | undefined;
71
71
  patterns?: {
72
72
  _id: string;
73
73
  code: string;
@@ -126,7 +126,7 @@ export declare const CreateRouteSchema: z.ZodObject<Omit<{
126
126
  code: string;
127
127
  name: string;
128
128
  line_id: string;
129
- path_type: "partial" | "base" | "variant";
129
+ path_type: "partial" | "variant" | "base";
130
130
  updated_by?: string | undefined;
131
131
  }, {
132
132
  code: string;
@@ -135,7 +135,7 @@ export declare const CreateRouteSchema: z.ZodObject<Omit<{
135
135
  created_by?: string | null | undefined;
136
136
  is_locked?: boolean | undefined;
137
137
  updated_by?: string | undefined;
138
- path_type?: "partial" | "base" | "variant" | undefined;
138
+ path_type?: "partial" | "variant" | "base" | undefined;
139
139
  }>;
140
140
  export declare const UpdateRouteSchema: z.ZodObject<{
141
141
  is_locked: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
@@ -150,14 +150,14 @@ export declare const UpdateRouteSchema: z.ZodObject<{
150
150
  code?: string | undefined;
151
151
  name?: string | undefined;
152
152
  line_id?: string | undefined;
153
- path_type?: "partial" | "base" | "variant" | undefined;
153
+ path_type?: "partial" | "variant" | "base" | undefined;
154
154
  }, {
155
155
  is_locked?: boolean | undefined;
156
156
  updated_by?: string | undefined;
157
157
  code?: string | undefined;
158
158
  name?: string | undefined;
159
159
  line_id?: string | undefined;
160
- path_type?: "partial" | "base" | "variant" | undefined;
160
+ path_type?: "partial" | "variant" | "base" | undefined;
161
161
  }>;
162
162
  export type Route = z.infer<typeof RouteSchema>;
163
163
  export type CreateRouteDto = z.infer<typeof CreateRouteSchema>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tmlmobilidade/types",
3
- "version": "20260602.2346.23",
3
+ "version": "20260603.1343.57",
4
4
  "author": {
5
5
  "email": "iso@tmlmobilidade.pt",
6
6
  "name": "TML-ISO"