@tmlmobilidade/types 20251217.1540.37 → 20251218.110.37

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 (119) hide show
  1. package/dist/_common/comment.js +15 -6
  2. package/dist/_common/document.d.ts +3 -0
  3. package/dist/_common/document.js +4 -3
  4. package/dist/_common/status.d.ts +15 -1
  5. package/dist/_common/status.js +24 -6
  6. package/dist/_common/unix-timestamp.d.ts +1 -1
  7. package/dist/_common/unix-timestamp.js +1 -1
  8. package/dist/agency.d.ts +18 -13
  9. package/dist/agency.js +1 -1
  10. package/dist/alert.d.ts +101 -112
  11. package/dist/alert.js +18 -19
  12. package/dist/apex/simplified-apex-location.d.ts +5 -4
  13. package/dist/apex/simplified-apex-location.js +6 -4
  14. package/dist/apex/simplified-apex-on-board-refund.d.ts +5 -4
  15. package/dist/apex/simplified-apex-on-board-refund.js +6 -4
  16. package/dist/apex/simplified-apex-on-board-sale.d.ts +5 -4
  17. package/dist/apex/simplified-apex-on-board-sale.js +6 -4
  18. package/dist/apex/simplified-apex-validation.d.ts +9 -8
  19. package/dist/apex/simplified-apex-validation.js +6 -4
  20. package/dist/auth/login.d.ts +1 -1
  21. package/dist/auth/login.js +1 -1
  22. package/dist/auth/role.d.ts +260 -149
  23. package/dist/auth/role.js +1 -1
  24. package/dist/auth/session.d.ts +9 -7
  25. package/dist/auth/session.js +6 -4
  26. package/dist/auth/user.d.ts +737 -207
  27. package/dist/auth/user.js +12 -9
  28. package/dist/auth/verification-token.d.ts +9 -7
  29. package/dist/auth/verification-token.js +6 -4
  30. package/dist/dates/annotation.d.ts +94 -0
  31. package/dist/dates/annotation.js +14 -0
  32. package/dist/dates/index.d.ts +1 -0
  33. package/dist/dates/index.js +1 -0
  34. package/dist/file-exports/{common.d.ts → base.d.ts} +6 -5
  35. package/dist/file-exports/{common.js → base.js} +7 -4
  36. package/dist/file-exports/file-exports.d.ts +124 -0
  37. package/dist/file-exports/file-exports.js +7 -0
  38. package/dist/file-exports/index.d.ts +3 -126
  39. package/dist/file-exports/index.js +3 -9
  40. package/dist/file-exports/ride-export.d.ts +13 -13
  41. package/dist/file-exports/ride-export.js +5 -5
  42. package/dist/file.d.ts +3 -3
  43. package/dist/file.js +4 -2
  44. package/dist/index.d.ts +2 -1
  45. package/dist/index.js +2 -1
  46. package/dist/notification.d.ts +9 -7
  47. package/dist/notification.js +4 -2
  48. package/dist/organization.d.ts +24 -15
  49. package/dist/organization.js +3 -3
  50. package/dist/permissions/agencies.d.ts +3 -3
  51. package/dist/permissions/agencies.js +1 -1
  52. package/dist/permissions/alerts.d.ts +6 -6
  53. package/dist/permissions/alerts.js +2 -2
  54. package/dist/permissions/dates.d.ts +25 -0
  55. package/dist/permissions/dates.js +16 -0
  56. package/dist/permissions/gtfs-validations.d.ts +3 -3
  57. package/dist/permissions/gtfs-validations.js +1 -0
  58. package/dist/permissions/index.d.ts +49 -27
  59. package/dist/permissions/index.js +2 -0
  60. package/dist/permissions/organizations.d.ts +3 -3
  61. package/dist/permissions/organizations.js +1 -0
  62. package/dist/permissions/plans.d.ts +3 -3
  63. package/dist/permissions/plans.js +1 -1
  64. package/dist/permissions/roles.d.ts +3 -3
  65. package/dist/permissions/roles.js +1 -0
  66. package/dist/permissions/stops.d.ts +3 -3
  67. package/dist/permissions/stops.js +1 -1
  68. package/dist/permissions/users.d.ts +3 -3
  69. package/dist/permissions/users.js +1 -0
  70. package/dist/plans/gtfs-validation.d.ts +12 -3
  71. package/dist/plans/gtfs-validation.js +1 -1
  72. package/dist/plans/plan-app-status.js +2 -2
  73. package/dist/plans/plan-pcgi-legacy.d.ts +1 -1
  74. package/dist/plans/plan-pcgi-legacy.js +1 -1
  75. package/dist/plans/plan.d.ts +9 -9
  76. package/dist/proposed-change.d.ts +12 -3
  77. package/dist/proposed-change.js +1 -1
  78. package/dist/rides/ride-acceptance.d.ts +23 -19
  79. package/dist/rides/ride-acceptance.js +5 -3
  80. package/dist/rides/ride-analysis.d.ts +16 -16
  81. package/dist/rides/ride-analysis.js +16 -16
  82. package/dist/rides/ride-audit.d.ts +11 -11
  83. package/dist/rides/ride-audit.js +1 -1
  84. package/dist/rides/ride-overrides.d.ts +1 -1
  85. package/dist/rides/ride-overrides.js +1 -1
  86. package/dist/rides/ride.d.ts +56 -55
  87. package/dist/rides/ride.js +10 -8
  88. package/dist/sams/sam-analysis.d.ts +1 -1
  89. package/dist/sams/sam-analysis.js +4 -4
  90. package/dist/sams/sam.d.ts +13 -13
  91. package/dist/sams/sam.js +7 -5
  92. package/dist/stops/connections.d.ts +3 -0
  93. package/dist/stops/connections.js +15 -0
  94. package/dist/stops/equipment.d.ts +3 -0
  95. package/dist/stops/equipment.js +9 -0
  96. package/dist/stops/facilities.d.ts +4 -0
  97. package/dist/stops/facilities.js +16 -0
  98. package/dist/stops/index.d.ts +9 -0
  99. package/dist/stops/index.js +9 -0
  100. package/dist/stops/jurisdiction.d.ts +4 -0
  101. package/dist/stops/jurisdiction.js +10 -0
  102. package/dist/stops/name-abbreviations.d.ts +11 -0
  103. package/dist/stops/name-abbreviations.js +117 -0
  104. package/dist/stops/parent-station.d.ts +76 -0
  105. package/dist/stops/parent-station.js +11 -0
  106. package/dist/stops/road-type.d.ts +3 -0
  107. package/dist/stops/road-type.js +13 -0
  108. package/dist/stops/stop-area.d.ts +67 -0
  109. package/dist/stops/stop-area.js +10 -0
  110. package/dist/{stop.d.ts → stops/stop.d.ts} +271 -345
  111. package/dist/stops/stop.js +78 -0
  112. package/dist/vehicle-events/gtfs-rt-vehicle-event-extended.d.ts +1 -21
  113. package/dist/vehicle-events/gtfs-rt-vehicle-event-extended.js +4 -5
  114. package/dist/vehicle-events/simplified-vehicle-event.d.ts +4 -3
  115. package/dist/vehicle-events/simplified-vehicle-event.js +6 -4
  116. package/dist/zone.d.ts +10 -10
  117. package/dist/zone.js +1 -1
  118. package/package.json +2 -2
  119. package/dist/stop.js +0 -102
@@ -0,0 +1,78 @@
1
+ /* * */
2
+ import { CommentSchema } from '../_common/comment.js';
3
+ import { DocumentSchema } from '../_common/document.js';
4
+ import { AvailabilityStatusSchema, ConditionStatusSchema, LifecycleStatusSchema } from '../_common/status.js';
5
+ import { UnixTimeStampSchema } from '../_common/unix-timestamp.js';
6
+ import { StopConnectionSchema } from './connections.js';
7
+ import { StopEquipmentSchema } from './equipment.js';
8
+ import { StopFacilitySchema } from './facilities.js';
9
+ import { StopJurisdictionSchema } from './jurisdiction.js';
10
+ import { StopRoadTypeSchema } from './road-type.js';
11
+ import { z } from 'zod';
12
+ /* * */
13
+ export const StopSchema = DocumentSchema.extend({
14
+ //
15
+ // General
16
+ _id: z.string(),
17
+ is_deleted: z.boolean().default(false),
18
+ jurisdiction: StopJurisdictionSchema.default('unknown'),
19
+ legacy_id: z.string().nullable().default(null),
20
+ lifecycle_status: LifecycleStatusSchema.default('draft'),
21
+ name: z.string().min(2).max(100),
22
+ new_name: z.string().min(5).max(100).nullable().default(null),
23
+ short_name: z.string().min(2).max(55),
24
+ tts_name: z.string(),
25
+ //
26
+ // Location
27
+ district_id: z.string(),
28
+ latitude: z.number(),
29
+ locality_id: z.string().nullable().default(null),
30
+ longitude: z.number(),
31
+ municipality_id: z.string(),
32
+ parish_id: z.string().nullable().default(null),
33
+ //
34
+ // Infrastructure
35
+ bench_status: ConditionStatusSchema.default('unknown'),
36
+ electricity_status: AvailabilityStatusSchema.default('unknown'),
37
+ pole_status: ConditionStatusSchema.default('unknown'),
38
+ road_type: StopRoadTypeSchema.default('unknown'),
39
+ //
40
+ // Shelter
41
+ shelter_code: z.string().nullable().default(null),
42
+ shelter_frame_size: z.tuple([z.number(), z.number()]).nullable().default(null),
43
+ shelter_installation_date: UnixTimeStampSchema.nullable().default(null),
44
+ shelter_maintainer: z.string().nullable().default(null),
45
+ shelter_make: z.string().nullable().default(null),
46
+ shelter_model: z.string().nullable().default(null),
47
+ shelter_status: ConditionStatusSchema.default('unknown'),
48
+ //
49
+ // Checks
50
+ last_infrastructure_check: UnixTimeStampSchema.nullable().default(null),
51
+ last_infrastructure_maintenance: UnixTimeStampSchema.nullable().default(null),
52
+ last_schedules_check: UnixTimeStampSchema.nullable().default(null),
53
+ last_schedules_maintenance: UnixTimeStampSchema.nullable().default(null),
54
+ //
55
+ // Facilities
56
+ connections: z.array(StopConnectionSchema).default([]),
57
+ facilities: z.array(StopFacilitySchema).default([]),
58
+ //
59
+ // Equipments
60
+ equipment: z.array(StopEquipmentSchema).default([]),
61
+ // Has ...
62
+ has_bench: AvailabilityStatusSchema.default('unknown'),
63
+ has_mupi: AvailabilityStatusSchema.default('unknown'),
64
+ has_network_map: AvailabilityStatusSchema.default('unknown'),
65
+ has_schedules: AvailabilityStatusSchema.default('unknown'),
66
+ has_shelter: AvailabilityStatusSchema.default('unknown'),
67
+ has_stop_sign: AvailabilityStatusSchema.default('unknown'),
68
+ //
69
+ // Images & Files
70
+ file_ids: z.array(z.string()).default([]),
71
+ image_ids: z.array(z.string()).default([]),
72
+ //
73
+ // Notes & Comments
74
+ comments: z.array(CommentSchema).default([]),
75
+ observations: z.string().nullable().default(null),
76
+ });
77
+ export const CreateStopSchema = StopSchema.omit({ _id: true, created_at: true, updated_at: true });
78
+ export const UpdateStopSchema = CreateStopSchema.omit({ created_by: true }).partial();
@@ -1,11 +1,5 @@
1
1
  import { z } from 'zod';
2
2
  export declare const GtfsRtVehicleEventExtendedSchema: z.ZodObject<{
3
- _id: z.ZodString;
4
- created_at: z.ZodEffects<z.ZodNumber, import("../_common/unix-timestamp.js").UnixTimestamp, number>;
5
- created_by: z.ZodOptional<z.ZodString>;
6
- updated_at: z.ZodEffects<z.ZodNumber, import("../_common/unix-timestamp.js").UnixTimestamp, number>;
7
- updated_by: z.ZodOptional<z.ZodString>;
8
- } & {
9
3
  agency_id: z.ZodString;
10
4
  driver_id: z.ZodString;
11
5
  event_id: z.ZodString;
@@ -20,14 +14,7 @@ export declare const GtfsRtVehicleEventExtendedSchema: z.ZodObject<{
20
14
  trigger_door: z.ZodString;
21
15
  trip_id: z.ZodString;
22
16
  vehicle_id: z.ZodString;
23
- }, "strict", z.ZodTypeAny, {
24
- _id: string;
25
- created_at: number & {
26
- __brand: "UnixTimestamp";
27
- };
28
- updated_at: number & {
29
- __brand: "UnixTimestamp";
30
- };
17
+ }, "strip", z.ZodTypeAny, {
31
18
  agency_id: string;
32
19
  pattern_id: string;
33
20
  received_at: number & {
@@ -43,13 +30,8 @@ export declare const GtfsRtVehicleEventExtendedSchema: z.ZodObject<{
43
30
  odometer: number;
44
31
  trigger_activity: string;
45
32
  trigger_door: string;
46
- created_by?: string | undefined;
47
- updated_by?: string | undefined;
48
33
  extra_trip_id?: string | null | undefined;
49
34
  }, {
50
- _id: string;
51
- created_at: number;
52
- updated_at: number;
53
35
  agency_id: string;
54
36
  pattern_id: string;
55
37
  received_at: number;
@@ -63,8 +45,6 @@ export declare const GtfsRtVehicleEventExtendedSchema: z.ZodObject<{
63
45
  odometer: number;
64
46
  trigger_activity: string;
65
47
  trigger_door: string;
66
- created_by?: string | undefined;
67
- updated_by?: string | undefined;
68
48
  extra_trip_id?: string | null | undefined;
69
49
  }>;
70
50
  /**
@@ -1,9 +1,8 @@
1
1
  /* * */
2
- import { DocumentSchema } from '../_common/document.js';
3
- import { unixTimeStampSchema } from '../_common/unix-timestamp.js';
2
+ import { UnixTimeStampSchema } from '../_common/unix-timestamp.js';
4
3
  import { z } from 'zod';
5
4
  /* * */
6
- export const GtfsRtVehicleEventExtendedSchema = DocumentSchema.extend({
5
+ export const GtfsRtVehicleEventExtendedSchema = z.object({
7
6
  agency_id: z.string(),
8
7
  driver_id: z.string(),
9
8
  event_id: z.string(),
@@ -12,10 +11,10 @@ export const GtfsRtVehicleEventExtendedSchema = DocumentSchema.extend({
12
11
  longitude: z.number(),
13
12
  odometer: z.number(),
14
13
  pattern_id: z.string(),
15
- received_at: unixTimeStampSchema,
14
+ received_at: UnixTimeStampSchema,
16
15
  stop_id: z.string(),
17
16
  trigger_activity: z.string(),
18
17
  trigger_door: z.string(),
19
18
  trip_id: z.string(),
20
19
  vehicle_id: z.string(),
21
- }).strict();
20
+ });
@@ -1,11 +1,12 @@
1
1
  import { z } from 'zod';
2
- export declare const SimplifiedVehicleEventSchema: z.ZodObject<{
2
+ export declare const SimplifiedVehicleEventSchema: z.ZodObject<Omit<{
3
3
  _id: z.ZodString;
4
4
  created_at: z.ZodEffects<z.ZodNumber, import("../_common/unix-timestamp.js").UnixTimestamp, number>;
5
5
  created_by: z.ZodOptional<z.ZodString>;
6
+ is_locked: z.ZodDefault<z.ZodBoolean>;
6
7
  updated_at: z.ZodEffects<z.ZodNumber, import("../_common/unix-timestamp.js").UnixTimestamp, number>;
7
8
  updated_by: z.ZodOptional<z.ZodString>;
8
- } & {
9
+ }, "is_locked"> & {
9
10
  agency_id: z.ZodString;
10
11
  driver_id: z.ZodString;
11
12
  event_id: z.ZodString;
@@ -20,7 +21,7 @@ export declare const SimplifiedVehicleEventSchema: z.ZodObject<{
20
21
  trigger_door: z.ZodString;
21
22
  trip_id: z.ZodString;
22
23
  vehicle_id: z.ZodString;
23
- }, "strict", z.ZodTypeAny, {
24
+ }, "strip", z.ZodTypeAny, {
24
25
  _id: string;
25
26
  created_at: number & {
26
27
  __brand: "UnixTimestamp";
@@ -1,9 +1,11 @@
1
1
  /* * */
2
2
  import { DocumentSchema } from '../_common/document.js';
3
- import { unixTimeStampSchema } from '../_common/unix-timestamp.js';
3
+ import { UnixTimeStampSchema } from '../_common/unix-timestamp.js';
4
4
  import { z } from 'zod';
5
5
  /* * */
6
- export const SimplifiedVehicleEventSchema = DocumentSchema.extend({
6
+ export const SimplifiedVehicleEventSchema = DocumentSchema
7
+ .omit({ is_locked: true })
8
+ .extend({
7
9
  agency_id: z.string(),
8
10
  driver_id: z.string(),
9
11
  event_id: z.string(),
@@ -12,10 +14,10 @@ export const SimplifiedVehicleEventSchema = DocumentSchema.extend({
12
14
  longitude: z.number(),
13
15
  odometer: z.number(),
14
16
  pattern_id: z.string(),
15
- received_at: unixTimeStampSchema,
17
+ received_at: UnixTimeStampSchema,
16
18
  stop_id: z.string(),
17
19
  trigger_activity: z.string(),
18
20
  trigger_door: z.string(),
19
21
  trip_id: z.string(),
20
22
  vehicle_id: z.string(),
21
- }).strict();
23
+ });
package/dist/zone.d.ts CHANGED
@@ -16,15 +16,15 @@ export declare const ZoneSchema: z.ZodObject<{
16
16
  geojson: z.ZodRecord<z.ZodString, z.ZodAny>;
17
17
  is_locked: z.ZodBoolean;
18
18
  name: z.ZodString;
19
- }, "strict", z.ZodTypeAny, {
19
+ }, "strip", z.ZodTypeAny, {
20
20
  _id: string;
21
21
  created_at: Date;
22
+ is_locked: boolean;
22
23
  updated_at: number & {
23
24
  __brand: "UnixTimestamp";
24
25
  };
25
26
  code: string;
26
27
  name: string;
27
- is_locked: boolean;
28
28
  geojson: Record<string, any>;
29
29
  border_color: string;
30
30
  border_opacity: number;
@@ -36,10 +36,10 @@ export declare const ZoneSchema: z.ZodObject<{
36
36
  }, {
37
37
  _id: string;
38
38
  created_at: Date;
39
+ is_locked: boolean;
39
40
  updated_at: number;
40
41
  code: string;
41
42
  name: string;
42
- is_locked: boolean;
43
43
  geojson: Record<string, any>;
44
44
  border_color: string;
45
45
  border_opacity: number;
@@ -65,10 +65,10 @@ export declare const CreateZoneSchema: z.ZodObject<Omit<{
65
65
  geojson: z.ZodRecord<z.ZodString, z.ZodAny>;
66
66
  is_locked: z.ZodBoolean;
67
67
  name: z.ZodString;
68
- }, "_id" | "created_at" | "updated_at">, "strict", z.ZodTypeAny, {
68
+ }, "_id" | "created_at" | "updated_at">, "strip", z.ZodTypeAny, {
69
+ is_locked: boolean;
69
70
  code: string;
70
71
  name: string;
71
- is_locked: boolean;
72
72
  geojson: Record<string, any>;
73
73
  border_color: string;
74
74
  border_opacity: number;
@@ -78,9 +78,9 @@ export declare const CreateZoneSchema: z.ZodObject<Omit<{
78
78
  created_by?: string | undefined;
79
79
  updated_by?: string | undefined;
80
80
  }, {
81
+ is_locked: boolean;
81
82
  code: string;
82
83
  name: string;
83
- is_locked: boolean;
84
84
  geojson: Record<string, any>;
85
85
  border_color: string;
86
86
  border_opacity: number;
@@ -91,21 +91,21 @@ export declare const CreateZoneSchema: z.ZodObject<Omit<{
91
91
  updated_by?: string | undefined;
92
92
  }>;
93
93
  export declare const UpdateZoneSchema: z.ZodObject<{
94
+ is_locked: z.ZodOptional<z.ZodBoolean>;
94
95
  updated_by: z.ZodOptional<z.ZodOptional<z.ZodString>>;
95
96
  code: z.ZodOptional<z.ZodString>;
96
97
  name: z.ZodOptional<z.ZodString>;
97
- is_locked: z.ZodOptional<z.ZodBoolean>;
98
98
  geojson: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
99
99
  border_color: z.ZodOptional<z.ZodString>;
100
100
  border_opacity: z.ZodOptional<z.ZodNumber>;
101
101
  border_width: z.ZodOptional<z.ZodNumber>;
102
102
  fill_color: z.ZodOptional<z.ZodString>;
103
103
  fill_opacity: z.ZodOptional<z.ZodNumber>;
104
- }, "strict", z.ZodTypeAny, {
104
+ }, "strip", z.ZodTypeAny, {
105
+ is_locked?: boolean | undefined;
105
106
  updated_by?: string | undefined;
106
107
  code?: string | undefined;
107
108
  name?: string | undefined;
108
- is_locked?: boolean | undefined;
109
109
  geojson?: Record<string, any> | undefined;
110
110
  border_color?: string | undefined;
111
111
  border_opacity?: number | undefined;
@@ -113,10 +113,10 @@ export declare const UpdateZoneSchema: z.ZodObject<{
113
113
  fill_color?: string | undefined;
114
114
  fill_opacity?: number | undefined;
115
115
  }, {
116
+ is_locked?: boolean | undefined;
116
117
  updated_by?: string | undefined;
117
118
  code?: string | undefined;
118
119
  name?: string | undefined;
119
- is_locked?: boolean | undefined;
120
120
  geojson?: Record<string, any> | undefined;
121
121
  border_color?: string | undefined;
122
122
  border_opacity?: number | undefined;
package/dist/zone.js CHANGED
@@ -13,6 +13,6 @@ export const ZoneSchema = DocumentSchema.extend({
13
13
  geojson: z.record(z.any()), // TODO: Validate GeoJSON
14
14
  is_locked: z.boolean(),
15
15
  name: z.string(),
16
- }).strict();
16
+ });
17
17
  export const CreateZoneSchema = ZoneSchema.omit({ _id: true, created_at: true, updated_at: true });
18
18
  export const UpdateZoneSchema = CreateZoneSchema.omit({ created_by: true }).partial();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tmlmobilidade/types",
3
- "version": "20251217.1540.37",
3
+ "version": "20251218.110.37",
4
4
  "author": {
5
5
  "email": "iso@tmlmobilidade.pt",
6
6
  "name": "TML-ISO"
@@ -44,7 +44,7 @@
44
44
  "devDependencies": {
45
45
  "@tmlmobilidade/tsconfig": "*",
46
46
  "@types/luxon": "3.7.1",
47
- "@types/node": "25.0.1",
47
+ "@types/node": "25.0.3",
48
48
  "resolve-tspaths": "0.8.23",
49
49
  "tsc-watch": "7.2.0",
50
50
  "typescript": "5.9.3"
package/dist/stop.js DELETED
@@ -1,102 +0,0 @@
1
- /* * */
2
- import { CommentSchema } from './_common/comment.js';
3
- import { DocumentSchema } from './_common/document.js';
4
- import { unixTimeStampSchema } from './_common/unix-timestamp.js';
5
- import { z } from 'zod';
6
- /* * */
7
- //
8
- // Define constants for enum values for better maintainability
9
- const JURISDICTION_VALUES = ['ip', 'municipality', 'other', 'unknown'];
10
- const STOP_LIFECYCLE_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'];
18
- export const jurisdictionSchema = z.enum(JURISDICTION_VALUES);
19
- export const stopLifecycleStatusSchema = z.enum(STOP_LIFECYCLE_STATUS_VALUES);
20
- export const electricityStatusSchema = z.enum(ELECTRICITY_STATUS_VALUES);
21
- export const roadTypeSchema = z.enum(ROAD_TYPE_VALUES);
22
- export const infrastructureStatusSchema = z.enum(INFRASTRUCTURE_STATUS_VALUES);
23
- export const connectionsSchema = z.enum(CONNECTIONS_VALUES);
24
- export const facilitiesSchema = z.enum(FACILITIES_VALUES);
25
- export const hasAnySchema = z.enum(HAS_ANY);
26
- export const equipmentSchema = z.enum(EQUIPMENT_VALUES);
27
- export const StopSchema = DocumentSchema.extend({
28
- //
29
- // General
30
- _id: z.string(),
31
- is_archived: z.boolean().default(false),
32
- is_locked: z.boolean().default(false),
33
- jurisdiction: jurisdictionSchema,
34
- legacy_id: z.string().nullish(),
35
- lifecycle_status: stopLifecycleStatusSchema,
36
- name: z.string(),
37
- new_name: z.string().nullish(),
38
- short_name: z.string().nullish(),
39
- tts_name: z.string().nullish(),
40
- //
41
- // Location
42
- district_id: z.string(),
43
- latitude: z.number(),
44
- locality_id: z.string().nullish(),
45
- longitude: z.number(),
46
- municipality_id: z.string(),
47
- parish_id: z.string().nullish(),
48
- //
49
- // Infrastructure
50
- bench_status: infrastructureStatusSchema,
51
- electricity_status: electricityStatusSchema,
52
- pole_status: infrastructureStatusSchema,
53
- road_type: roadTypeSchema,
54
- //
55
- // Shelter
56
- shelter_code: z.string().nullish(),
57
- shelter_frame_size: z.tuple([z.number(), z.number()]).nullish(),
58
- shelter_installation_date: unixTimeStampSchema.nullish(),
59
- shelter_maintainer: z.string().nullish(),
60
- shelter_make: z.string().nullish(),
61
- shelter_model: z.string().nullish(),
62
- shelter_status: infrastructureStatusSchema,
63
- //
64
- // Checks
65
- last_infrastructure_check: unixTimeStampSchema.nullish(),
66
- last_infrastructure_maintenance: unixTimeStampSchema.nullish(),
67
- last_schedules_check: unixTimeStampSchema.nullish(),
68
- last_schedules_maintenance: unixTimeStampSchema.nullish(),
69
- //
70
- // Facilities
71
- connections: z.array(connectionsSchema),
72
- facilities: z.array(facilitiesSchema),
73
- //
74
- // Equipments
75
- equipment: z.array(equipmentSchema),
76
- // Has ...
77
- has_bench: hasAnySchema,
78
- has_mupi: hasAnySchema,
79
- has_network_map: hasAnySchema,
80
- has_schedules: hasAnySchema,
81
- has_shelter: hasAnySchema,
82
- has_stop_sign: hasAnySchema,
83
- //
84
- // Images & Files
85
- file_ids: z.array(z.string()).default([]),
86
- image_ids: z.array(z.string()).default([]),
87
- //
88
- // Notes & Comments
89
- comments: z.array(CommentSchema),
90
- observations: z.string().nullish(),
91
- }).strict();
92
- export const parentStationSchema = DocumentSchema.extend({
93
- _id: z.string(),
94
- agency_id: z.string(),
95
- stop_ids: z.array(z.string()),
96
- }).strict();
97
- export const stopAreaSchema = DocumentSchema.extend({
98
- _id: z.string(),
99
- parent_station_ids: z.array(z.string()),
100
- }).strict();
101
- export const CreateStopSchema = StopSchema.omit({ _id: true, created_at: true, updated_at: true });
102
- export const UpdateStopSchema = CreateStopSchema.omit({ created_by: true }).partial();