@tmlmobilidade/types 20250911.1034.51 → 20250911.1325.18

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.
Files changed (51) hide show
  1. package/dist/src/_common/operational-date.d.ts +1 -1
  2. package/dist/src/_common/operational-date.js +1 -2
  3. package/dist/src/_common/proposed-change.d.ts +9 -31
  4. package/dist/src/_common/proposed-change.js +5 -14
  5. package/dist/src/agency.d.ts +10 -21
  6. package/dist/src/agency.js +1 -1
  7. package/dist/src/alert.d.ts +32 -58
  8. package/dist/src/alert.js +8 -48
  9. package/dist/src/auth/login.js +2 -8
  10. package/dist/src/auth/role.d.ts +6 -13
  11. package/dist/src/auth/role.js +1 -1
  12. package/dist/src/auth/session.d.ts +13 -29
  13. package/dist/src/auth/session.js +3 -3
  14. package/dist/src/auth/user.d.ts +13 -32
  15. package/dist/src/auth/user.js +3 -3
  16. package/dist/src/auth/verification-token.d.ts +13 -25
  17. package/dist/src/auth/verification-token.js +3 -3
  18. package/dist/src/gtfs.d.ts +6 -17
  19. package/dist/src/organization.d.ts +1 -4
  20. package/dist/src/organization.js +1 -1
  21. package/dist/src/plans/gtfs-validation.d.ts +25 -63
  22. package/dist/src/plans/gtfs-validation.js +2 -6
  23. package/dist/src/plans/plan-controller.d.ts +3 -8
  24. package/dist/src/plans/plan-controller.js +2 -2
  25. package/dist/src/plans/plan.d.ts +34 -86
  26. package/dist/src/plans/plan.js +2 -6
  27. package/dist/src/rides/ride-audit.d.ts +0 -3
  28. package/dist/src/rides/ride-audit.js +1 -1
  29. package/dist/src/rides/ride-justification.d.ts +0 -3
  30. package/dist/src/rides/ride-justification.js +1 -1
  31. package/dist/src/rides/ride.d.ts +46 -97
  32. package/dist/src/rides/ride.js +8 -8
  33. package/dist/src/sams/sam-analysis.d.ts +5 -13
  34. package/dist/src/sams/sam-analysis.js +3 -3
  35. package/dist/src/sams/sam.d.ts +37 -88
  36. package/dist/src/sams/sam.js +4 -4
  37. package/dist/src/simplified-apex/simplified-apex-location.d.ts +12 -19
  38. package/dist/src/simplified-apex/simplified-apex-location.js +2 -2
  39. package/dist/src/simplified-apex/simplified-apex-on-board-refund.d.ts +12 -19
  40. package/dist/src/simplified-apex/simplified-apex-on-board-refund.js +2 -2
  41. package/dist/src/simplified-apex/simplified-apex-on-board-sale.d.ts +23 -33
  42. package/dist/src/simplified-apex/simplified-apex-on-board-sale.js +3 -3
  43. package/dist/src/simplified-apex/simplified-apex-validation.d.ts +12 -19
  44. package/dist/src/simplified-apex/simplified-apex-validation.js +2 -2
  45. package/dist/src/stop.d.ts +68 -86
  46. package/dist/src/stop.js +11 -74
  47. package/dist/src/vehicle-event.d.ts +5 -10
  48. package/dist/src/vehicle-event.js +2 -2
  49. package/dist/src/zone.d.ts +0 -3
  50. package/dist/src/zone.js +1 -1
  51. package/package.json +1 -1
package/dist/src/stop.js CHANGED
@@ -6,75 +6,15 @@ import { z } from 'zod';
6
6
  /* * */
7
7
  //
8
8
  // Define constants for enum values for better maintainability
9
- const JURISDICTION_VALUES = [
10
- 'ip',
11
- 'municipality',
12
- 'other',
13
- 'unknown',
14
- ];
15
- const OPERATIONAL_STATUS_VALUES = [
16
- 'active',
17
- 'inactive',
18
- 'provisional',
19
- 'seasonal',
20
- 'voided',
21
- ];
22
- const ELECTRICITY_STATUS_VALUES = [
23
- 'available',
24
- 'unavailable',
25
- 'unknown',
26
- ];
27
- const ROAD_TYPE_VALUES = [
28
- 'complementary_itinerary',
29
- 'highway',
30
- 'main_itinerary',
31
- 'national_road',
32
- 'regional_road',
33
- 'secondary_road',
34
- 'unknown',
35
- ];
36
- const INFRASTRUCTURE_STATUS_VALUES = [
37
- 'not_applicable',
38
- 'unknown',
39
- 'missing',
40
- 'damaged',
41
- 'ok',
42
- ];
43
- const CONNECTIONS_VALUES = [
44
- 'ferry',
45
- 'light_rail',
46
- 'subway',
47
- 'train',
48
- 'boat',
49
- 'airport',
50
- 'bike_sharing',
51
- 'bike_parking',
52
- 'car_parking',
53
- ];
54
- const FACILITIES_VALUES = [
55
- 'fire_station',
56
- 'health_clinic',
57
- 'historic_building',
58
- 'hospital',
59
- 'police_station',
60
- 'school',
61
- 'shopping',
62
- 'transit_office',
63
- 'university',
64
- 'beach',
65
- ];
66
- const HAS_ANY = [
67
- 'yes',
68
- 'no',
69
- 'unknown',
70
- ];
71
- const EQUIPMENT_VALUES = [
72
- 'pip',
73
- 'mupi',
74
- 'mini_pip',
75
- ];
76
- //
77
- // Define schemas using constants
9
+ const JURISDICTION_VALUES = ['ip', 'municipality', 'other', 'unknown'];
10
+ const OPERATIONAL_STATUS_VALUES = ['active', 'inactive', 'provisional', 'seasonal', 'voided'];
11
+ const ELECTRICITY_STATUS_VALUES = ['available', 'unavailable', 'unknown'];
12
+ const ROAD_TYPE_VALUES = ['complementary_itinerary', 'highway', 'main_itinerary', 'national_road', 'regional_road', 'secondary_road', 'unknown'];
13
+ const INFRASTRUCTURE_STATUS_VALUES = ['not_applicable', 'unknown', 'missing', 'damaged', 'ok'];
14
+ const CONNECTIONS_VALUES = ['ferry', 'light_rail', 'subway', 'train', 'boat', 'airport', 'bike_sharing', 'bike_parking', 'car_parking'];
15
+ const FACILITIES_VALUES = ['fire_station', 'health_clinic', 'historic_building', 'hospital', 'police_station', 'school', 'shopping', 'transit_office', 'university', 'beach'];
16
+ const HAS_ANY = ['yes', 'no', 'unknown'];
17
+ const EQUIPMENT_VALUES = ['pip', 'mupi', 'mini_pip'];
78
18
  export const jurisdictionSchema = z.enum(JURISDICTION_VALUES);
79
19
  export const operationalStatusSchema = z.enum(OPERATIONAL_STATUS_VALUES);
80
20
  export const electricityStatusSchema = z.enum(ELECTRICITY_STATUS_VALUES);
@@ -158,11 +98,8 @@ export const stopAreaSchema = DocumentSchema.extend({
158
98
  _id: z.string(),
159
99
  parent_station_ids: z.array(z.string()),
160
100
  }).strict();
161
- export const CreateStopSchema = StopSchema
162
- .omit({ created_at: true, updated_at: true });
163
- export const UpdateStopSchema = StopSchema
164
- .omit({ _id: true, created_at: true, updated_at: true })
165
- .partial();
101
+ export const CreateStopSchema = StopSchema.omit({ _id: true, created_at: true, updated_at: true });
102
+ export const UpdateStopSchema = CreateStopSchema.omit({ created_by: true }).partial();
166
103
  /* * */
167
104
  export const StopPermissionSchema = z.object({
168
105
  agency_ids: z.array(z.string()),
@@ -1,10 +1,9 @@
1
- import { type UnixTimestamp } from './_common/unix-timestamp.js';
2
1
  import { z } from 'zod';
3
2
  export declare const VehicleEventSchema: z.ZodObject<{
4
3
  _id: z.ZodString;
5
- created_at: z.ZodEffects<z.ZodNumber, UnixTimestamp, number>;
4
+ created_at: z.ZodEffects<z.ZodNumber, import("./_common/unix-timestamp.js").UnixTimestamp, number>;
6
5
  created_by: z.ZodDefault<z.ZodString>;
7
- updated_at: z.ZodEffects<z.ZodNumber, UnixTimestamp, number>;
6
+ updated_at: z.ZodEffects<z.ZodNumber, import("./_common/unix-timestamp.js").UnixTimestamp, number>;
8
7
  updated_by: z.ZodDefault<z.ZodString>;
9
8
  } & {
10
9
  agency_id: z.ZodString;
@@ -15,7 +14,7 @@ export declare const VehicleEventSchema: z.ZodObject<{
15
14
  longitude: z.ZodNumber;
16
15
  odometer: z.ZodNumber;
17
16
  pattern_id: z.ZodString;
18
- received_at: z.ZodBranded<z.ZodEffects<z.ZodNumber, UnixTimestamp, number>, "UnixTimestamp">;
17
+ received_at: z.ZodEffects<z.ZodNumber, import("./_common/unix-timestamp.js").UnixTimestamp, number>;
19
18
  stop_id: z.ZodString;
20
19
  trigger_activity: z.ZodString;
21
20
  trigger_door: z.ZodString;
@@ -37,7 +36,7 @@ export declare const VehicleEventSchema: z.ZodObject<{
37
36
  vehicle_id: string;
38
37
  received_at: number & {
39
38
  __brand: "UnixTimestamp";
40
- } & z.BRAND<"UnixTimestamp">;
39
+ };
41
40
  stop_id: string;
42
41
  latitude: number;
43
42
  longitude: number;
@@ -75,8 +74,4 @@ export declare const VehicleEventSchema: z.ZodObject<{
75
74
  * These events are based on the GTFS-RT specification but extended with additional fields
76
75
  * specific to TML's needs.
77
76
  */
78
- export interface VehicleEvent extends Omit<z.infer<typeof VehicleEventSchema>, 'created_at' | 'received_at' | 'updated_at'> {
79
- created_at: UnixTimestamp;
80
- received_at: UnixTimestamp;
81
- updated_at: UnixTimestamp;
82
- }
77
+ export type VehicleEvent = z.infer<typeof VehicleEventSchema>;
@@ -1,6 +1,6 @@
1
1
  /* * */
2
2
  import { DocumentSchema } from './_common/document.js';
3
- import { validateUnixTimestamp } from './_common/unix-timestamp.js';
3
+ import { unixTimeStampSchema } from './_common/unix-timestamp.js';
4
4
  import { z } from 'zod';
5
5
  /* * */
6
6
  export const VehicleEventSchema = DocumentSchema.extend({
@@ -12,7 +12,7 @@ export const VehicleEventSchema = DocumentSchema.extend({
12
12
  longitude: z.number(),
13
13
  odometer: z.number(),
14
14
  pattern_id: z.string(),
15
- received_at: z.number().transform(validateUnixTimestamp).brand('UnixTimestamp'),
15
+ received_at: unixTimeStampSchema,
16
16
  stop_id: z.string(),
17
17
  trigger_activity: z.string(),
18
18
  trigger_door: z.string(),
@@ -91,7 +91,6 @@ export declare const CreateZoneSchema: z.ZodObject<Omit<{
91
91
  updated_by?: string | undefined;
92
92
  }>;
93
93
  export declare const UpdateZoneSchema: z.ZodObject<{
94
- created_by: z.ZodOptional<z.ZodDefault<z.ZodString>>;
95
94
  updated_by: z.ZodOptional<z.ZodDefault<z.ZodString>>;
96
95
  code: z.ZodOptional<z.ZodString>;
97
96
  name: z.ZodOptional<z.ZodString>;
@@ -103,7 +102,6 @@ export declare const UpdateZoneSchema: z.ZodObject<{
103
102
  fill_color: z.ZodOptional<z.ZodString>;
104
103
  fill_opacity: z.ZodOptional<z.ZodNumber>;
105
104
  }, "strict", z.ZodTypeAny, {
106
- created_by?: string | undefined;
107
105
  updated_by?: string | undefined;
108
106
  code?: string | undefined;
109
107
  name?: string | undefined;
@@ -115,7 +113,6 @@ export declare const UpdateZoneSchema: z.ZodObject<{
115
113
  fill_color?: string | undefined;
116
114
  fill_opacity?: number | undefined;
117
115
  }, {
118
- created_by?: string | undefined;
119
116
  updated_by?: string | undefined;
120
117
  code?: string | undefined;
121
118
  name?: string | undefined;
package/dist/src/zone.js CHANGED
@@ -15,7 +15,7 @@ export const ZoneSchema = DocumentSchema.extend({
15
15
  name: z.string(),
16
16
  }).strict();
17
17
  export const CreateZoneSchema = ZoneSchema.omit({ _id: true, created_at: true, updated_at: true });
18
- export const UpdateZoneSchema = CreateZoneSchema.partial();
18
+ export const UpdateZoneSchema = CreateZoneSchema.omit({ created_by: true }).partial();
19
19
  /* * */
20
20
  export const ZonePermissionSchema = z.object({
21
21
  agency_ids: z.array(z.string()),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tmlmobilidade/types",
3
- "version": "20250911.1034.51",
3
+ "version": "20250911.1325.18",
4
4
  "author": "João de Vasconcelos & Jusi Monteiro",
5
5
  "license": "AGPL-3.0-or-later",
6
6
  "homepage": "https://github.com/tmlmobilidade/services#readme",