@mrtdown/core 2.0.0-alpha.1

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 (182) hide show
  1. package/README.md +107 -0
  2. package/dist/constants.d.ts +10 -0
  3. package/dist/constants.js +11 -0
  4. package/dist/constants.js.map +1 -0
  5. package/dist/helpers/calculateDurationWithinServiceHours.d.ts +2 -0
  6. package/dist/helpers/calculateDurationWithinServiceHours.js +13 -0
  7. package/dist/helpers/calculateDurationWithinServiceHours.js.map +1 -0
  8. package/dist/helpers/calculateDurationWithinServiceHours.test.d.ts +1 -0
  9. package/dist/helpers/calculateDurationWithinServiceHours.test.js +83 -0
  10. package/dist/helpers/calculateDurationWithinServiceHours.test.js.map +1 -0
  11. package/dist/helpers/computeImpactFromEvidenceClaims.d.ts +21 -0
  12. package/dist/helpers/computeImpactFromEvidenceClaims.js +293 -0
  13. package/dist/helpers/computeImpactFromEvidenceClaims.js.map +1 -0
  14. package/dist/helpers/computeImpactFromEvidenceClaims.test.d.ts +1 -0
  15. package/dist/helpers/computeImpactFromEvidenceClaims.test.js +544 -0
  16. package/dist/helpers/computeImpactFromEvidenceClaims.test.js.map +1 -0
  17. package/dist/helpers/computeStartOfDaysWithinInterval.d.ts +2 -0
  18. package/dist/helpers/computeStartOfDaysWithinInterval.js +15 -0
  19. package/dist/helpers/computeStartOfDaysWithinInterval.js.map +1 -0
  20. package/dist/helpers/computeStartOfDaysWithinInterval.test.d.ts +1 -0
  21. package/dist/helpers/computeStartOfDaysWithinInterval.test.js +126 -0
  22. package/dist/helpers/computeStartOfDaysWithinInterval.test.js.map +1 -0
  23. package/dist/helpers/estimateOpenAICost.d.ts +40 -0
  24. package/dist/helpers/estimateOpenAICost.js +55 -0
  25. package/dist/helpers/estimateOpenAICost.js.map +1 -0
  26. package/dist/helpers/keyForAffectedEntity.d.ts +7 -0
  27. package/dist/helpers/keyForAffectedEntity.js +14 -0
  28. package/dist/helpers/keyForAffectedEntity.js.map +1 -0
  29. package/dist/helpers/normalizeRecurringPeriod.d.ts +7 -0
  30. package/dist/helpers/normalizeRecurringPeriod.js +118 -0
  31. package/dist/helpers/normalizeRecurringPeriod.js.map +1 -0
  32. package/dist/helpers/normalizeRecurringPeriod.test.d.ts +1 -0
  33. package/dist/helpers/normalizeRecurringPeriod.test.js +93 -0
  34. package/dist/helpers/normalizeRecurringPeriod.test.js.map +1 -0
  35. package/dist/helpers/resolvePeriods.d.ts +224 -0
  36. package/dist/helpers/resolvePeriods.js +207 -0
  37. package/dist/helpers/resolvePeriods.js.map +1 -0
  38. package/dist/helpers/resolvePeriods.test.d.ts +1 -0
  39. package/dist/helpers/resolvePeriods.test.js +239 -0
  40. package/dist/helpers/resolvePeriods.test.js.map +1 -0
  41. package/dist/helpers/splitIntervalByServiceHours.d.ts +2 -0
  42. package/dist/helpers/splitIntervalByServiceHours.js +30 -0
  43. package/dist/helpers/splitIntervalByServiceHours.js.map +1 -0
  44. package/dist/helpers/splitIntervalByServiceHours.test.d.ts +1 -0
  45. package/dist/helpers/splitIntervalByServiceHours.test.js +152 -0
  46. package/dist/helpers/splitIntervalByServiceHours.test.js.map +1 -0
  47. package/dist/helpers/sumIntervalDuration.d.ts +2 -0
  48. package/dist/helpers/sumIntervalDuration.js +9 -0
  49. package/dist/helpers/sumIntervalDuration.js.map +1 -0
  50. package/dist/index.d.ts +18 -0
  51. package/dist/index.js +19 -0
  52. package/dist/index.js.map +1 -0
  53. package/dist/repo/MRTDownRepository.d.ts +23 -0
  54. package/dist/repo/MRTDownRepository.js +28 -0
  55. package/dist/repo/MRTDownRepository.js.map +1 -0
  56. package/dist/repo/common/FileStore.d.ts +12 -0
  57. package/dist/repo/common/FileStore.js +27 -0
  58. package/dist/repo/common/FileStore.js.map +1 -0
  59. package/dist/repo/common/StandardRepository.d.ts +32 -0
  60. package/dist/repo/common/StandardRepository.js +58 -0
  61. package/dist/repo/common/StandardRepository.js.map +1 -0
  62. package/dist/repo/common/store.d.ts +29 -0
  63. package/dist/repo/common/store.js +2 -0
  64. package/dist/repo/common/store.js.map +1 -0
  65. package/dist/repo/issue/IssueRepository.d.ts +36 -0
  66. package/dist/repo/issue/IssueRepository.js +177 -0
  67. package/dist/repo/issue/IssueRepository.js.map +1 -0
  68. package/dist/repo/issue/helpers/deriveCurrentState.d.ts +51 -0
  69. package/dist/repo/issue/helpers/deriveCurrentState.js +113 -0
  70. package/dist/repo/issue/helpers/deriveCurrentState.js.map +1 -0
  71. package/dist/repo/issue/helpers/deriveCurrentState.test.d.ts +1 -0
  72. package/dist/repo/issue/helpers/deriveCurrentState.test.js +477 -0
  73. package/dist/repo/issue/helpers/deriveCurrentState.test.js.map +1 -0
  74. package/dist/repo/landmark/LandmarkRepository.d.ts +7 -0
  75. package/dist/repo/landmark/LandmarkRepository.js +12 -0
  76. package/dist/repo/landmark/LandmarkRepository.js.map +1 -0
  77. package/dist/repo/line/LineRepository.d.ts +13 -0
  78. package/dist/repo/line/LineRepository.js +32 -0
  79. package/dist/repo/line/LineRepository.js.map +1 -0
  80. package/dist/repo/operator/OperatorRepository.d.ts +7 -0
  81. package/dist/repo/operator/OperatorRepository.js +12 -0
  82. package/dist/repo/operator/OperatorRepository.js.map +1 -0
  83. package/dist/repo/service/ServiceRepository.d.ts +19 -0
  84. package/dist/repo/service/ServiceRepository.js +39 -0
  85. package/dist/repo/service/ServiceRepository.js.map +1 -0
  86. package/dist/repo/station/StationRepository.d.ts +13 -0
  87. package/dist/repo/station/StationRepository.js +30 -0
  88. package/dist/repo/station/StationRepository.js.map +1 -0
  89. package/dist/repo/town/TownRepository.d.ts +7 -0
  90. package/dist/repo/town/TownRepository.js +12 -0
  91. package/dist/repo/town/TownRepository.js.map +1 -0
  92. package/dist/schema/Landmark.d.ts +11 -0
  93. package/dist/schema/Landmark.js +7 -0
  94. package/dist/schema/Landmark.js.map +1 -0
  95. package/dist/schema/Line.d.ts +58 -0
  96. package/dist/schema/Line.js +35 -0
  97. package/dist/schema/Line.js.map +1 -0
  98. package/dist/schema/Operator.d.ts +16 -0
  99. package/dist/schema/Operator.js +12 -0
  100. package/dist/schema/Operator.js.map +1 -0
  101. package/dist/schema/Service.d.ts +55 -0
  102. package/dist/schema/Service.js +24 -0
  103. package/dist/schema/Service.js.map +1 -0
  104. package/dist/schema/Station.d.ts +29 -0
  105. package/dist/schema/Station.js +25 -0
  106. package/dist/schema/Station.js.map +1 -0
  107. package/dist/schema/Town.d.ts +11 -0
  108. package/dist/schema/Town.js +7 -0
  109. package/dist/schema/Town.js.map +1 -0
  110. package/dist/schema/common.d.ts +24 -0
  111. package/dist/schema/common.js +23 -0
  112. package/dist/schema/common.js.map +1 -0
  113. package/dist/schema/issue/bundle.d.ts +239 -0
  114. package/dist/schema/issue/bundle.js +11 -0
  115. package/dist/schema/issue/bundle.js.map +1 -0
  116. package/dist/schema/issue/cause.d.ts +51 -0
  117. package/dist/schema/issue/cause.js +30 -0
  118. package/dist/schema/issue/cause.js.map +1 -0
  119. package/dist/schema/issue/claim.d.ts +149 -0
  120. package/dist/schema/issue/claim.js +36 -0
  121. package/dist/schema/issue/claim.js.map +1 -0
  122. package/dist/schema/issue/entity.d.ts +176 -0
  123. package/dist/schema/issue/entity.js +35 -0
  124. package/dist/schema/issue/entity.js.map +1 -0
  125. package/dist/schema/issue/evidence.d.ts +124 -0
  126. package/dist/schema/issue/evidence.js +30 -0
  127. package/dist/schema/issue/evidence.js.map +1 -0
  128. package/dist/schema/issue/facilityEffect.d.ts +15 -0
  129. package/dist/schema/issue/facilityEffect.js +12 -0
  130. package/dist/schema/issue/facilityEffect.js.map +1 -0
  131. package/dist/schema/issue/id.d.ts +3 -0
  132. package/dist/schema/issue/id.js +6 -0
  133. package/dist/schema/issue/id.js.map +1 -0
  134. package/dist/schema/issue/impactEvent.d.ts +373 -0
  135. package/dist/schema/issue/impactEvent.js +43 -0
  136. package/dist/schema/issue/impactEvent.js.map +1 -0
  137. package/dist/schema/issue/issue.d.ts +19 -0
  138. package/dist/schema/issue/issue.js +13 -0
  139. package/dist/schema/issue/issue.js.map +1 -0
  140. package/dist/schema/issue/issueType.d.ts +7 -0
  141. package/dist/schema/issue/issueType.js +3 -0
  142. package/dist/schema/issue/issueType.js.map +1 -0
  143. package/dist/schema/issue/period.d.ts +72 -0
  144. package/dist/schema/issue/period.js +32 -0
  145. package/dist/schema/issue/period.js.map +1 -0
  146. package/dist/schema/issue/serviceEffect.d.ts +29 -0
  147. package/dist/schema/issue/serviceEffect.js +21 -0
  148. package/dist/schema/issue/serviceEffect.js.map +1 -0
  149. package/dist/schema/issue/serviceScope.d.ts +38 -0
  150. package/dist/schema/issue/serviceScope.js +30 -0
  151. package/dist/schema/issue/serviceScope.js.map +1 -0
  152. package/dist/util/assert.d.ts +1 -0
  153. package/dist/util/assert.js +6 -0
  154. package/dist/util/assert.js.map +1 -0
  155. package/dist/util/ingestContent/helpers/getSlugDateTimeFromClaims.d.ts +7 -0
  156. package/dist/util/ingestContent/helpers/getSlugDateTimeFromClaims.js +24 -0
  157. package/dist/util/ingestContent/helpers/getSlugDateTimeFromClaims.js.map +1 -0
  158. package/dist/util/ingestContent/index.d.ts +12 -0
  159. package/dist/util/ingestContent/index.js +171 -0
  160. package/dist/util/ingestContent/index.js.map +1 -0
  161. package/dist/util/ingestContent/types.d.ts +32 -0
  162. package/dist/util/ingestContent/types.js +2 -0
  163. package/dist/util/ingestContent/types.js.map +1 -0
  164. package/dist/write/MRTDownWriter.d.ts +27 -0
  165. package/dist/write/MRTDownWriter.js +27 -0
  166. package/dist/write/MRTDownWriter.js.map +1 -0
  167. package/dist/write/common/FileWriteStore.d.ts +13 -0
  168. package/dist/write/common/FileWriteStore.js +31 -0
  169. package/dist/write/common/FileWriteStore.js.map +1 -0
  170. package/dist/write/common/StandardWriter.d.ts +14 -0
  171. package/dist/write/common/StandardWriter.js +17 -0
  172. package/dist/write/common/StandardWriter.js.map +1 -0
  173. package/dist/write/common/store.d.ts +32 -0
  174. package/dist/write/common/store.js +2 -0
  175. package/dist/write/common/store.js.map +1 -0
  176. package/dist/write/id/IdGenerator.d.ts +18 -0
  177. package/dist/write/id/IdGenerator.js +23 -0
  178. package/dist/write/id/IdGenerator.js.map +1 -0
  179. package/dist/write/issue/IssueWriter.d.ts +12 -0
  180. package/dist/write/issue/IssueWriter.js +33 -0
  181. package/dist/write/issue/IssueWriter.js.map +1 -0
  182. package/package.json +80 -0
@@ -0,0 +1,239 @@
1
+ import { z } from 'zod';
2
+ export declare const IssueBundleSchema: z.ZodObject<{
3
+ issue: z.ZodObject<{
4
+ id: z.ZodString;
5
+ type: z.ZodEnum<{
6
+ disruption: "disruption";
7
+ maintenance: "maintenance";
8
+ infra: "infra";
9
+ }>;
10
+ title: z.ZodObject<{
11
+ 'en-SG': z.ZodString;
12
+ 'zh-Hans': z.ZodNullable<z.ZodString>;
13
+ ms: z.ZodNullable<z.ZodString>;
14
+ ta: z.ZodNullable<z.ZodString>;
15
+ }, z.core.$strip>;
16
+ titleMeta: z.ZodObject<{
17
+ source: z.ZodString;
18
+ }, z.core.$strip>;
19
+ }, z.core.$strip>;
20
+ evidence: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
21
+ id: z.ZodString;
22
+ ts: z.ZodString;
23
+ text: z.ZodString;
24
+ render: z.ZodNullable<z.ZodObject<{
25
+ text: z.ZodObject<{
26
+ 'en-SG': z.ZodString;
27
+ 'zh-Hans': z.ZodNullable<z.ZodString>;
28
+ ms: z.ZodNullable<z.ZodString>;
29
+ ta: z.ZodNullable<z.ZodString>;
30
+ }, z.core.$strip>;
31
+ source: z.ZodString;
32
+ }, z.core.$strip>>;
33
+ type: z.ZodLiteral<"official-statement">;
34
+ sourceUrl: z.ZodString;
35
+ }, z.core.$strip>, z.ZodObject<{
36
+ id: z.ZodString;
37
+ ts: z.ZodString;
38
+ text: z.ZodString;
39
+ render: z.ZodNullable<z.ZodObject<{
40
+ text: z.ZodObject<{
41
+ 'en-SG': z.ZodString;
42
+ 'zh-Hans': z.ZodNullable<z.ZodString>;
43
+ ms: z.ZodNullable<z.ZodString>;
44
+ ta: z.ZodNullable<z.ZodString>;
45
+ }, z.core.$strip>;
46
+ source: z.ZodString;
47
+ }, z.core.$strip>>;
48
+ type: z.ZodLiteral<"public.report">;
49
+ sourceUrl: z.ZodString;
50
+ }, z.core.$strip>, z.ZodObject<{
51
+ id: z.ZodString;
52
+ ts: z.ZodString;
53
+ text: z.ZodString;
54
+ render: z.ZodNullable<z.ZodObject<{
55
+ text: z.ZodObject<{
56
+ 'en-SG': z.ZodString;
57
+ 'zh-Hans': z.ZodNullable<z.ZodString>;
58
+ ms: z.ZodNullable<z.ZodString>;
59
+ ta: z.ZodNullable<z.ZodString>;
60
+ }, z.core.$strip>;
61
+ source: z.ZodString;
62
+ }, z.core.$strip>>;
63
+ type: z.ZodLiteral<"media.report">;
64
+ sourceUrl: z.ZodString;
65
+ }, z.core.$strip>]>>;
66
+ impactEvents: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
67
+ id: z.ZodString;
68
+ entity: z.ZodDiscriminatedUnion<[z.ZodObject<{
69
+ type: z.ZodLiteral<"service">;
70
+ serviceId: z.ZodString;
71
+ }, z.core.$strip>, z.ZodObject<{
72
+ type: z.ZodLiteral<"facility">;
73
+ stationId: z.ZodString;
74
+ kind: z.ZodEnum<{
75
+ lift: "lift";
76
+ escalator: "escalator";
77
+ "screen-door": "screen-door";
78
+ }>;
79
+ }, z.core.$strip>]>;
80
+ ts: z.ZodISODateTime;
81
+ basis: z.ZodObject<{
82
+ evidenceId: z.ZodString;
83
+ }, z.core.$strip>;
84
+ type: z.ZodLiteral<"periods.set">;
85
+ periods: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
86
+ kind: z.ZodLiteral<"fixed">;
87
+ startAt: z.ZodISODateTime;
88
+ endAt: z.ZodNullable<z.ZodISODateTime>;
89
+ }, z.core.$strip>, z.ZodObject<{
90
+ kind: z.ZodLiteral<"recurring">;
91
+ frequency: z.ZodEnum<{
92
+ daily: "daily";
93
+ weekly: "weekly";
94
+ monthly: "monthly";
95
+ yearly: "yearly";
96
+ }>;
97
+ startAt: z.ZodISODateTime;
98
+ endAt: z.ZodISODateTime;
99
+ daysOfWeek: z.ZodNullable<z.ZodArray<z.ZodEnum<{
100
+ MO: "MO";
101
+ TU: "TU";
102
+ WE: "WE";
103
+ TH: "TH";
104
+ FR: "FR";
105
+ SA: "SA";
106
+ SU: "SU";
107
+ }>>>;
108
+ timeWindow: z.ZodObject<{
109
+ startAt: z.ZodISOTime;
110
+ endAt: z.ZodISOTime;
111
+ }, z.core.$strip>;
112
+ timeZone: z.ZodLiteral<"Asia/Singapore">;
113
+ excludedDates: z.ZodNullable<z.ZodArray<z.ZodISODate>>;
114
+ }, z.core.$strip>]>>;
115
+ }, z.core.$strip>, z.ZodObject<{
116
+ id: z.ZodString;
117
+ entity: z.ZodDiscriminatedUnion<[z.ZodObject<{
118
+ type: z.ZodLiteral<"service">;
119
+ serviceId: z.ZodString;
120
+ }, z.core.$strip>, z.ZodObject<{
121
+ type: z.ZodLiteral<"facility">;
122
+ stationId: z.ZodString;
123
+ kind: z.ZodEnum<{
124
+ lift: "lift";
125
+ escalator: "escalator";
126
+ "screen-door": "screen-door";
127
+ }>;
128
+ }, z.core.$strip>]>;
129
+ ts: z.ZodISODateTime;
130
+ basis: z.ZodObject<{
131
+ evidenceId: z.ZodString;
132
+ }, z.core.$strip>;
133
+ type: z.ZodLiteral<"service_scopes.set">;
134
+ serviceScopes: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
135
+ type: z.ZodLiteral<"service.whole">;
136
+ }, z.core.$strip>, z.ZodObject<{
137
+ type: z.ZodLiteral<"service.segment">;
138
+ fromStationId: z.ZodString;
139
+ toStationId: z.ZodString;
140
+ }, z.core.$strip>, z.ZodObject<{
141
+ type: z.ZodLiteral<"service.point">;
142
+ stationId: z.ZodString;
143
+ }, z.core.$strip>]>>;
144
+ }, z.core.$strip>, z.ZodObject<{
145
+ id: z.ZodString;
146
+ entity: z.ZodDiscriminatedUnion<[z.ZodObject<{
147
+ type: z.ZodLiteral<"service">;
148
+ serviceId: z.ZodString;
149
+ }, z.core.$strip>, z.ZodObject<{
150
+ type: z.ZodLiteral<"facility">;
151
+ stationId: z.ZodString;
152
+ kind: z.ZodEnum<{
153
+ lift: "lift";
154
+ escalator: "escalator";
155
+ "screen-door": "screen-door";
156
+ }>;
157
+ }, z.core.$strip>]>;
158
+ ts: z.ZodISODateTime;
159
+ basis: z.ZodObject<{
160
+ evidenceId: z.ZodString;
161
+ }, z.core.$strip>;
162
+ type: z.ZodLiteral<"service_effects.set">;
163
+ effect: z.ZodDiscriminatedUnion<[z.ZodObject<{
164
+ kind: z.ZodLiteral<"delay">;
165
+ duration: z.ZodNullable<z.ZodISODuration>;
166
+ }, z.core.$strip>, z.ZodObject<{
167
+ kind: z.ZodLiteral<"no-service">;
168
+ }, z.core.$strip>, z.ZodObject<{
169
+ kind: z.ZodLiteral<"reduced-service">;
170
+ }, z.core.$strip>, z.ZodObject<{
171
+ kind: z.ZodLiteral<"service-hours-adjustment">;
172
+ }, z.core.$strip>]>;
173
+ }, z.core.$strip>, z.ZodObject<{
174
+ id: z.ZodString;
175
+ entity: z.ZodDiscriminatedUnion<[z.ZodObject<{
176
+ type: z.ZodLiteral<"service">;
177
+ serviceId: z.ZodString;
178
+ }, z.core.$strip>, z.ZodObject<{
179
+ type: z.ZodLiteral<"facility">;
180
+ stationId: z.ZodString;
181
+ kind: z.ZodEnum<{
182
+ lift: "lift";
183
+ escalator: "escalator";
184
+ "screen-door": "screen-door";
185
+ }>;
186
+ }, z.core.$strip>]>;
187
+ ts: z.ZodISODateTime;
188
+ basis: z.ZodObject<{
189
+ evidenceId: z.ZodString;
190
+ }, z.core.$strip>;
191
+ type: z.ZodLiteral<"facility_effects.set">;
192
+ effect: z.ZodDiscriminatedUnion<[z.ZodObject<{
193
+ kind: z.ZodLiteral<"facility-out-of-service">;
194
+ }, z.core.$strip>, z.ZodObject<{
195
+ kind: z.ZodLiteral<"facility-degraded">;
196
+ }, z.core.$strip>]>;
197
+ }, z.core.$strip>, z.ZodObject<{
198
+ id: z.ZodString;
199
+ entity: z.ZodDiscriminatedUnion<[z.ZodObject<{
200
+ type: z.ZodLiteral<"service">;
201
+ serviceId: z.ZodString;
202
+ }, z.core.$strip>, z.ZodObject<{
203
+ type: z.ZodLiteral<"facility">;
204
+ stationId: z.ZodString;
205
+ kind: z.ZodEnum<{
206
+ lift: "lift";
207
+ escalator: "escalator";
208
+ "screen-door": "screen-door";
209
+ }>;
210
+ }, z.core.$strip>]>;
211
+ ts: z.ZodISODateTime;
212
+ basis: z.ZodObject<{
213
+ evidenceId: z.ZodString;
214
+ }, z.core.$strip>;
215
+ type: z.ZodLiteral<"causes.set">;
216
+ causes: z.ZodArray<z.ZodUnion<readonly [z.ZodEnum<{
217
+ "signal.fault": "signal.fault";
218
+ "track.fault": "track.fault";
219
+ "train.fault": "train.fault";
220
+ "power.fault": "power.fault";
221
+ "station.fault": "station.fault";
222
+ security: "security";
223
+ weather: "weather";
224
+ "passenger.incident": "passenger.incident";
225
+ "platform_door.fault": "platform_door.fault";
226
+ delay: "delay";
227
+ }>, z.ZodEnum<{
228
+ "track.work": "track.work";
229
+ "system.upgrade": "system.upgrade";
230
+ }>, z.ZodEnum<{
231
+ "elevator.outage": "elevator.outage";
232
+ "escalator.outage": "escalator.outage";
233
+ "air_conditioning.issue": "air_conditioning.issue";
234
+ "station.renovation": "station.renovation";
235
+ }>]>>;
236
+ }, z.core.$strip>]>>;
237
+ path: z.ZodString;
238
+ }, z.core.$strip>;
239
+ export type IssueBundle = z.infer<typeof IssueBundleSchema>;
@@ -0,0 +1,11 @@
1
+ import { z } from 'zod';
2
+ import { EvidenceSchema } from './evidence.js';
3
+ import { ImpactEventSchema } from './impactEvent.js';
4
+ import { IssueSchema } from './issue.js';
5
+ export const IssueBundleSchema = z.object({
6
+ issue: IssueSchema,
7
+ evidence: z.array(EvidenceSchema),
8
+ impactEvents: z.array(ImpactEventSchema),
9
+ path: z.string().describe('Relative path to issue folder, for debugging'),
10
+ });
11
+ //# sourceMappingURL=bundle.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bundle.js","sourceRoot":"/","sources":["schema/issue/bundle.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAEzC,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,CAAC,MAAM,CAAC;IACxC,KAAK,EAAE,WAAW;IAClB,QAAQ,EAAE,CAAC,CAAC,KAAK,CAAC,cAAc,CAAC;IACjC,YAAY,EAAE,CAAC,CAAC,KAAK,CAAC,iBAAiB,CAAC;IACxC,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,8CAA8C,CAAC;CAC1E,CAAC,CAAC","sourcesContent":["import { z } from 'zod';\nimport { EvidenceSchema } from './evidence.js';\nimport { ImpactEventSchema } from './impactEvent.js';\nimport { IssueSchema } from './issue.js';\n\nexport const IssueBundleSchema = z.object({\n issue: IssueSchema,\n evidence: z.array(EvidenceSchema),\n impactEvents: z.array(ImpactEventSchema),\n path: z.string().describe('Relative path to issue folder, for debugging'),\n});\nexport type IssueBundle = z.infer<typeof IssueBundleSchema>;\n"]}
@@ -0,0 +1,51 @@
1
+ import z from 'zod';
2
+ /** Cause subtype for disruption issues. */
3
+ export declare const CauseDisruptionSchema: z.ZodEnum<{
4
+ "signal.fault": "signal.fault";
5
+ "track.fault": "track.fault";
6
+ "train.fault": "train.fault";
7
+ "power.fault": "power.fault";
8
+ "station.fault": "station.fault";
9
+ security: "security";
10
+ weather: "weather";
11
+ "passenger.incident": "passenger.incident";
12
+ "platform_door.fault": "platform_door.fault";
13
+ delay: "delay";
14
+ }>;
15
+ export type CauseDisruption = z.infer<typeof CauseDisruptionSchema>;
16
+ /** Cause subtype for maintenance issues. */
17
+ export declare const CauseMaintenanceSchema: z.ZodEnum<{
18
+ "track.work": "track.work";
19
+ "system.upgrade": "system.upgrade";
20
+ }>;
21
+ export type CauseMaintenance = z.infer<typeof CauseMaintenanceSchema>;
22
+ /** Cause subtype for infra issues. */
23
+ export declare const CauseInfraSchema: z.ZodEnum<{
24
+ "elevator.outage": "elevator.outage";
25
+ "escalator.outage": "escalator.outage";
26
+ "air_conditioning.issue": "air_conditioning.issue";
27
+ "station.renovation": "station.renovation";
28
+ }>;
29
+ export type CauseInfra = z.infer<typeof CauseInfraSchema>;
30
+ /** Union of all cause subtypes for impact events. */
31
+ export declare const CauseSubtypeSchema: z.ZodUnion<readonly [z.ZodEnum<{
32
+ "signal.fault": "signal.fault";
33
+ "track.fault": "track.fault";
34
+ "train.fault": "train.fault";
35
+ "power.fault": "power.fault";
36
+ "station.fault": "station.fault";
37
+ security: "security";
38
+ weather: "weather";
39
+ "passenger.incident": "passenger.incident";
40
+ "platform_door.fault": "platform_door.fault";
41
+ delay: "delay";
42
+ }>, z.ZodEnum<{
43
+ "track.work": "track.work";
44
+ "system.upgrade": "system.upgrade";
45
+ }>, z.ZodEnum<{
46
+ "elevator.outage": "elevator.outage";
47
+ "escalator.outage": "escalator.outage";
48
+ "air_conditioning.issue": "air_conditioning.issue";
49
+ "station.renovation": "station.renovation";
50
+ }>]>;
51
+ export type CauseSubtype = z.infer<typeof CauseSubtypeSchema>;
@@ -0,0 +1,30 @@
1
+ import z from 'zod';
2
+ /** Cause subtype for disruption issues. */
3
+ export const CauseDisruptionSchema = z.enum([
4
+ 'signal.fault',
5
+ 'track.fault',
6
+ 'train.fault',
7
+ 'power.fault',
8
+ 'station.fault',
9
+ 'security',
10
+ 'weather',
11
+ 'passenger.incident',
12
+ 'platform_door.fault',
13
+ 'delay',
14
+ ]);
15
+ /** Cause subtype for maintenance issues. */
16
+ export const CauseMaintenanceSchema = z.enum(['track.work', 'system.upgrade']);
17
+ /** Cause subtype for infra issues. */
18
+ export const CauseInfraSchema = z.enum([
19
+ 'elevator.outage',
20
+ 'escalator.outage',
21
+ 'air_conditioning.issue',
22
+ 'station.renovation',
23
+ ]);
24
+ /** Union of all cause subtypes for impact events. */
25
+ export const CauseSubtypeSchema = z.union([
26
+ CauseDisruptionSchema,
27
+ CauseMaintenanceSchema,
28
+ CauseInfraSchema,
29
+ ]);
30
+ //# sourceMappingURL=cause.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cause.js","sourceRoot":"/","sources":["schema/issue/cause.ts"],"names":[],"mappings":"AAAA,OAAO,CAAC,MAAM,KAAK,CAAC;AAEpB,2CAA2C;AAC3C,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,CAAC,IAAI,CAAC;IAC1C,cAAc;IACd,aAAa;IACb,aAAa;IACb,aAAa;IACb,eAAe;IACf,UAAU;IACV,SAAS;IACT,oBAAoB;IACpB,qBAAqB;IACrB,OAAO;CACR,CAAC,CAAC;AAGH,4CAA4C;AAC5C,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,YAAY,EAAE,gBAAgB,CAAC,CAAC,CAAC;AAG/E,sCAAsC;AACtC,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,CAAC,IAAI,CAAC;IACrC,iBAAiB;IACjB,kBAAkB;IAClB,wBAAwB;IACxB,oBAAoB;CACrB,CAAC,CAAC;AAGH,qDAAqD;AACrD,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC;IACxC,qBAAqB;IACrB,sBAAsB;IACtB,gBAAgB;CACjB,CAAC,CAAC","sourcesContent":["import z from 'zod';\n\n/** Cause subtype for disruption issues. */\nexport const CauseDisruptionSchema = z.enum([\n 'signal.fault',\n 'track.fault',\n 'train.fault',\n 'power.fault',\n 'station.fault',\n 'security',\n 'weather',\n 'passenger.incident',\n 'platform_door.fault',\n 'delay',\n]);\nexport type CauseDisruption = z.infer<typeof CauseDisruptionSchema>;\n\n/** Cause subtype for maintenance issues. */\nexport const CauseMaintenanceSchema = z.enum(['track.work', 'system.upgrade']);\nexport type CauseMaintenance = z.infer<typeof CauseMaintenanceSchema>;\n\n/** Cause subtype for infra issues. */\nexport const CauseInfraSchema = z.enum([\n 'elevator.outage',\n 'escalator.outage',\n 'air_conditioning.issue',\n 'station.renovation',\n]);\nexport type CauseInfra = z.infer<typeof CauseInfraSchema>;\n\n/** Union of all cause subtypes for impact events. */\nexport const CauseSubtypeSchema = z.union([\n CauseDisruptionSchema,\n CauseMaintenanceSchema,\n CauseInfraSchema,\n]);\nexport type CauseSubtype = z.infer<typeof CauseSubtypeSchema>;\n"]}
@@ -0,0 +1,149 @@
1
+ import z from 'zod';
2
+ export declare const ClaimStatusSignalSchema: z.ZodEnum<{
3
+ open: "open";
4
+ cleared: "cleared";
5
+ planned: "planned";
6
+ }>;
7
+ export type ClaimStatusSignal = z.infer<typeof ClaimStatusSignalSchema>;
8
+ export declare const ClaimTimeHintsSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
9
+ kind: z.ZodLiteral<"fixed">;
10
+ startAt: z.z.ZodISODateTime;
11
+ endAt: z.ZodNullable<z.z.ZodISODateTime>;
12
+ }, z.z.core.$strip>, z.ZodObject<{
13
+ kind: z.ZodLiteral<"recurring">;
14
+ frequency: z.ZodEnum<{
15
+ daily: "daily";
16
+ weekly: "weekly";
17
+ monthly: "monthly";
18
+ yearly: "yearly";
19
+ }>;
20
+ startAt: z.z.ZodISODateTime;
21
+ endAt: z.z.ZodISODateTime;
22
+ daysOfWeek: z.ZodNullable<z.ZodArray<z.ZodEnum<{
23
+ MO: "MO";
24
+ TU: "TU";
25
+ WE: "WE";
26
+ TH: "TH";
27
+ FR: "FR";
28
+ SA: "SA";
29
+ SU: "SU";
30
+ }>>>;
31
+ timeWindow: z.ZodObject<{
32
+ startAt: z.z.ZodISOTime;
33
+ endAt: z.z.ZodISOTime;
34
+ }, z.z.core.$strip>;
35
+ timeZone: z.ZodLiteral<"Asia/Singapore">;
36
+ excludedDates: z.ZodNullable<z.ZodArray<z.z.ZodISODate>>;
37
+ }, z.z.core.$strip>, z.ZodObject<{
38
+ kind: z.ZodLiteral<"start-only">;
39
+ startAt: z.z.ZodISODateTime;
40
+ }, z.z.core.$strip>, z.ZodObject<{
41
+ kind: z.ZodLiteral<"end-only">;
42
+ endAt: z.z.ZodISODateTime;
43
+ }, z.z.core.$strip>]>;
44
+ export type ClaimTimeHints = z.infer<typeof ClaimTimeHintsSchema>;
45
+ export declare const ClaimSchema: z.ZodObject<{
46
+ entity: z.ZodDiscriminatedUnion<[z.ZodObject<{
47
+ type: z.ZodLiteral<"service">;
48
+ serviceId: z.ZodString;
49
+ }, z.z.core.$strip>, z.ZodObject<{
50
+ type: z.ZodLiteral<"facility">;
51
+ stationId: z.ZodString;
52
+ kind: z.ZodEnum<{
53
+ lift: "lift";
54
+ escalator: "escalator";
55
+ "screen-door": "screen-door";
56
+ }>;
57
+ }, z.z.core.$strip>]>;
58
+ effect: z.ZodNullable<z.ZodObject<{
59
+ service: z.ZodNullable<z.ZodDiscriminatedUnion<[z.ZodObject<{
60
+ kind: z.ZodLiteral<"delay">;
61
+ duration: z.ZodNullable<z.z.ZodISODuration>;
62
+ }, z.z.core.$strip>, z.ZodObject<{
63
+ kind: z.ZodLiteral<"no-service">;
64
+ }, z.z.core.$strip>, z.ZodObject<{
65
+ kind: z.ZodLiteral<"reduced-service">;
66
+ }, z.z.core.$strip>, z.ZodObject<{
67
+ kind: z.ZodLiteral<"service-hours-adjustment">;
68
+ }, z.z.core.$strip>]>>;
69
+ facility: z.ZodNullable<z.ZodDiscriminatedUnion<[z.ZodObject<{
70
+ kind: z.ZodLiteral<"facility-out-of-service">;
71
+ }, z.z.core.$strip>, z.ZodObject<{
72
+ kind: z.ZodLiteral<"facility-degraded">;
73
+ }, z.z.core.$strip>]>>;
74
+ }, z.z.core.$strip>>;
75
+ scopes: z.ZodObject<{
76
+ service: z.ZodNullable<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
77
+ type: z.ZodLiteral<"service.whole">;
78
+ }, z.z.core.$strip>, z.ZodObject<{
79
+ type: z.ZodLiteral<"service.segment">;
80
+ fromStationId: z.ZodString;
81
+ toStationId: z.ZodString;
82
+ }, z.z.core.$strip>, z.ZodObject<{
83
+ type: z.ZodLiteral<"service.point">;
84
+ stationId: z.ZodString;
85
+ }, z.z.core.$strip>]>>>;
86
+ }, z.z.core.$strip>;
87
+ statusSignal: z.ZodNullable<z.ZodEnum<{
88
+ open: "open";
89
+ cleared: "cleared";
90
+ planned: "planned";
91
+ }>>;
92
+ timeHints: z.ZodNullable<z.ZodDiscriminatedUnion<[z.ZodObject<{
93
+ kind: z.ZodLiteral<"fixed">;
94
+ startAt: z.z.ZodISODateTime;
95
+ endAt: z.ZodNullable<z.z.ZodISODateTime>;
96
+ }, z.z.core.$strip>, z.ZodObject<{
97
+ kind: z.ZodLiteral<"recurring">;
98
+ frequency: z.ZodEnum<{
99
+ daily: "daily";
100
+ weekly: "weekly";
101
+ monthly: "monthly";
102
+ yearly: "yearly";
103
+ }>;
104
+ startAt: z.z.ZodISODateTime;
105
+ endAt: z.z.ZodISODateTime;
106
+ daysOfWeek: z.ZodNullable<z.ZodArray<z.ZodEnum<{
107
+ MO: "MO";
108
+ TU: "TU";
109
+ WE: "WE";
110
+ TH: "TH";
111
+ FR: "FR";
112
+ SA: "SA";
113
+ SU: "SU";
114
+ }>>>;
115
+ timeWindow: z.ZodObject<{
116
+ startAt: z.z.ZodISOTime;
117
+ endAt: z.z.ZodISOTime;
118
+ }, z.z.core.$strip>;
119
+ timeZone: z.ZodLiteral<"Asia/Singapore">;
120
+ excludedDates: z.ZodNullable<z.ZodArray<z.z.ZodISODate>>;
121
+ }, z.z.core.$strip>, z.ZodObject<{
122
+ kind: z.ZodLiteral<"start-only">;
123
+ startAt: z.z.ZodISODateTime;
124
+ }, z.z.core.$strip>, z.ZodObject<{
125
+ kind: z.ZodLiteral<"end-only">;
126
+ endAt: z.z.ZodISODateTime;
127
+ }, z.z.core.$strip>]>>;
128
+ causes: z.ZodNullable<z.ZodArray<z.ZodUnion<readonly [z.ZodEnum<{
129
+ "signal.fault": "signal.fault";
130
+ "track.fault": "track.fault";
131
+ "train.fault": "train.fault";
132
+ "power.fault": "power.fault";
133
+ "station.fault": "station.fault";
134
+ security: "security";
135
+ weather: "weather";
136
+ "passenger.incident": "passenger.incident";
137
+ "platform_door.fault": "platform_door.fault";
138
+ delay: "delay";
139
+ }>, z.ZodEnum<{
140
+ "track.work": "track.work";
141
+ "system.upgrade": "system.upgrade";
142
+ }>, z.ZodEnum<{
143
+ "elevator.outage": "elevator.outage";
144
+ "escalator.outage": "escalator.outage";
145
+ "air_conditioning.issue": "air_conditioning.issue";
146
+ "station.renovation": "station.renovation";
147
+ }>]>>>;
148
+ }, z.z.core.$strip>;
149
+ export type Claim = z.infer<typeof ClaimSchema>;
@@ -0,0 +1,36 @@
1
+ import z from 'zod';
2
+ import { AffectedEntitySchema } from './entity.js';
3
+ import { FacilityEffectSchema } from './facilityEffect.js';
4
+ import { PeriodFixedSchema, PeriodRecurringSchema } from './period.js';
5
+ import { ServiceEffectSchema } from './serviceEffect.js';
6
+ import { ServiceScopeSchema } from './serviceScope.js';
7
+ import { CauseSubtypeSchema } from './cause.js';
8
+ export const ClaimStatusSignalSchema = z.enum(['open', 'cleared', 'planned']);
9
+ export const ClaimTimeHintsSchema = z.discriminatedUnion('kind', [
10
+ PeriodFixedSchema,
11
+ PeriodRecurringSchema,
12
+ z.object({
13
+ kind: z.literal('start-only'),
14
+ startAt: z.iso.datetime({ offset: true }),
15
+ }),
16
+ z.object({
17
+ kind: z.literal('end-only'),
18
+ endAt: z.iso.datetime({ offset: true }),
19
+ }),
20
+ ]);
21
+ export const ClaimSchema = z.object({
22
+ entity: AffectedEntitySchema,
23
+ effect: z
24
+ .object({
25
+ service: ServiceEffectSchema.nullable(),
26
+ facility: FacilityEffectSchema.nullable(),
27
+ })
28
+ .nullable(),
29
+ scopes: z.object({
30
+ service: z.array(ServiceScopeSchema).nullable(),
31
+ }),
32
+ statusSignal: ClaimStatusSignalSchema.nullable(),
33
+ timeHints: ClaimTimeHintsSchema.nullable(),
34
+ causes: z.array(CauseSubtypeSchema).nullable(),
35
+ });
36
+ //# sourceMappingURL=claim.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"claim.js","sourceRoot":"/","sources":["schema/issue/claim.ts"],"names":[],"mappings":"AAAA,OAAO,CAAC,MAAM,KAAK,CAAC;AACpB,OAAO,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AACnD,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAC3D,OAAO,EAAE,iBAAiB,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AACvE,OAAO,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AACvD,OAAO,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAEhD,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,SAAS,EAAE,SAAS,CAAC,CAAC,CAAC;AAG9E,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,CAAC,kBAAkB,CAAC,MAAM,EAAE;IAC/D,iBAAiB;IACjB,qBAAqB;IACrB,CAAC,CAAC,MAAM,CAAC;QACP,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,YAAY,CAAC;QAC7B,OAAO,EAAE,CAAC,CAAC,GAAG,CAAC,QAAQ,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC;KAC1C,CAAC;IACF,CAAC,CAAC,MAAM,CAAC;QACP,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,UAAU,CAAC;QAC3B,KAAK,EAAE,CAAC,CAAC,GAAG,CAAC,QAAQ,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC;KACxC,CAAC;CACH,CAAC,CAAC;AAGH,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,CAAC,MAAM,CAAC;IAClC,MAAM,EAAE,oBAAoB;IAC5B,MAAM,EAAE,CAAC;SACN,MAAM,CAAC;QACN,OAAO,EAAE,mBAAmB,CAAC,QAAQ,EAAE;QACvC,QAAQ,EAAE,oBAAoB,CAAC,QAAQ,EAAE;KAC1C,CAAC;SACD,QAAQ,EAAE;IACb,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC;QACf,OAAO,EAAE,CAAC,CAAC,KAAK,CAAC,kBAAkB,CAAC,CAAC,QAAQ,EAAE;KAChD,CAAC;IACF,YAAY,EAAE,uBAAuB,CAAC,QAAQ,EAAE;IAChD,SAAS,EAAE,oBAAoB,CAAC,QAAQ,EAAE;IAC1C,MAAM,EAAE,CAAC,CAAC,KAAK,CAAC,kBAAkB,CAAC,CAAC,QAAQ,EAAE;CAC/C,CAAC,CAAC","sourcesContent":["import z from 'zod';\nimport { AffectedEntitySchema } from './entity.js';\nimport { FacilityEffectSchema } from './facilityEffect.js';\nimport { PeriodFixedSchema, PeriodRecurringSchema } from './period.js';\nimport { ServiceEffectSchema } from './serviceEffect.js';\nimport { ServiceScopeSchema } from './serviceScope.js';\nimport { CauseSubtypeSchema } from './cause.js';\n\nexport const ClaimStatusSignalSchema = z.enum(['open', 'cleared', 'planned']);\nexport type ClaimStatusSignal = z.infer<typeof ClaimStatusSignalSchema>;\n\nexport const ClaimTimeHintsSchema = z.discriminatedUnion('kind', [\n PeriodFixedSchema,\n PeriodRecurringSchema,\n z.object({\n kind: z.literal('start-only'),\n startAt: z.iso.datetime({ offset: true }),\n }),\n z.object({\n kind: z.literal('end-only'),\n endAt: z.iso.datetime({ offset: true }),\n }),\n]);\nexport type ClaimTimeHints = z.infer<typeof ClaimTimeHintsSchema>;\n\nexport const ClaimSchema = z.object({\n entity: AffectedEntitySchema,\n effect: z\n .object({\n service: ServiceEffectSchema.nullable(),\n facility: FacilityEffectSchema.nullable(),\n })\n .nullable(),\n scopes: z.object({\n service: z.array(ServiceScopeSchema).nullable(),\n }),\n statusSignal: ClaimStatusSignalSchema.nullable(),\n timeHints: ClaimTimeHintsSchema.nullable(),\n causes: z.array(CauseSubtypeSchema).nullable(),\n});\n\nexport type Claim = z.infer<typeof ClaimSchema>;\n"]}