@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,176 @@
1
+ import z from 'zod';
2
+ export declare const AffectedEntityServiceSchema: z.ZodObject<{
3
+ type: z.ZodLiteral<"service">;
4
+ serviceId: z.ZodString;
5
+ }, z.z.core.$strip>;
6
+ export type AffectedEntityService = z.infer<typeof AffectedEntityServiceSchema>;
7
+ export declare const AffectedEntityFacilitySchema: z.ZodObject<{
8
+ type: z.ZodLiteral<"facility">;
9
+ stationId: z.ZodString;
10
+ kind: z.ZodEnum<{
11
+ lift: "lift";
12
+ escalator: "escalator";
13
+ "screen-door": "screen-door";
14
+ }>;
15
+ }, z.z.core.$strip>;
16
+ export type AffectedEntityFacility = z.infer<typeof AffectedEntityFacilitySchema>;
17
+ export declare const AffectedEntitySchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
18
+ type: z.ZodLiteral<"service">;
19
+ serviceId: z.ZodString;
20
+ }, z.z.core.$strip>, z.ZodObject<{
21
+ type: z.ZodLiteral<"facility">;
22
+ stationId: z.ZodString;
23
+ kind: z.ZodEnum<{
24
+ lift: "lift";
25
+ escalator: "escalator";
26
+ "screen-door": "screen-door";
27
+ }>;
28
+ }, z.z.core.$strip>]>;
29
+ export type AffectedEntity = z.infer<typeof AffectedEntitySchema>;
30
+ export declare const EntityImpactStateSchema: z.ZodObject<{
31
+ serviceScopes: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
32
+ type: z.ZodLiteral<"service.whole">;
33
+ }, z.z.core.$strip>, z.ZodObject<{
34
+ type: z.ZodLiteral<"service.segment">;
35
+ fromStationId: z.ZodString;
36
+ toStationId: z.ZodString;
37
+ }, z.z.core.$strip>, z.ZodObject<{
38
+ type: z.ZodLiteral<"service.point">;
39
+ stationId: z.ZodString;
40
+ }, z.z.core.$strip>]>>;
41
+ periods: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
42
+ kind: z.ZodLiteral<"fixed">;
43
+ startAt: z.z.ZodISODateTime;
44
+ endAt: z.ZodNullable<z.z.ZodISODateTime>;
45
+ }, z.z.core.$strip>, z.ZodObject<{
46
+ kind: z.ZodLiteral<"recurring">;
47
+ frequency: z.ZodEnum<{
48
+ daily: "daily";
49
+ weekly: "weekly";
50
+ monthly: "monthly";
51
+ yearly: "yearly";
52
+ }>;
53
+ startAt: z.z.ZodISODateTime;
54
+ endAt: z.z.ZodISODateTime;
55
+ daysOfWeek: z.ZodNullable<z.ZodArray<z.ZodEnum<{
56
+ MO: "MO";
57
+ TU: "TU";
58
+ WE: "WE";
59
+ TH: "TH";
60
+ FR: "FR";
61
+ SA: "SA";
62
+ SU: "SU";
63
+ }>>>;
64
+ timeWindow: z.ZodObject<{
65
+ startAt: z.z.ZodISOTime;
66
+ endAt: z.z.ZodISOTime;
67
+ }, z.z.core.$strip>;
68
+ timeZone: z.ZodLiteral<"Asia/Singapore">;
69
+ excludedDates: z.ZodNullable<z.ZodArray<z.z.ZodISODate>>;
70
+ }, z.z.core.$strip>]>>;
71
+ entity: z.ZodDiscriminatedUnion<[z.ZodObject<{
72
+ type: z.ZodLiteral<"service">;
73
+ serviceId: z.ZodString;
74
+ }, z.z.core.$strip>, z.ZodObject<{
75
+ type: z.ZodLiteral<"facility">;
76
+ stationId: z.ZodString;
77
+ kind: z.ZodEnum<{
78
+ lift: "lift";
79
+ escalator: "escalator";
80
+ "screen-door": "screen-door";
81
+ }>;
82
+ }, z.z.core.$strip>]>;
83
+ effects: z.ZodNullable<z.ZodObject<{
84
+ service: z.ZodNullable<z.ZodDiscriminatedUnion<[z.ZodObject<{
85
+ kind: z.ZodLiteral<"delay">;
86
+ duration: z.ZodNullable<z.z.ZodISODuration>;
87
+ }, z.z.core.$strip>, z.ZodObject<{
88
+ kind: z.ZodLiteral<"no-service">;
89
+ }, z.z.core.$strip>, z.ZodObject<{
90
+ kind: z.ZodLiteral<"reduced-service">;
91
+ }, z.z.core.$strip>, z.ZodObject<{
92
+ kind: z.ZodLiteral<"service-hours-adjustment">;
93
+ }, z.z.core.$strip>]>>;
94
+ facility: z.ZodNullable<z.ZodDiscriminatedUnion<[z.ZodObject<{
95
+ kind: z.ZodLiteral<"facility-out-of-service">;
96
+ }, z.z.core.$strip>, z.ZodObject<{
97
+ kind: z.ZodLiteral<"facility-degraded">;
98
+ }, z.z.core.$strip>]>>;
99
+ }, z.z.core.$strip>>;
100
+ }, z.z.core.$strip>;
101
+ export type EntityImpactState = z.infer<typeof EntityImpactStateSchema>;
102
+ export declare const EntityImpactStateWithBasisSchema: z.ZodObject<{
103
+ serviceScopes: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
104
+ type: z.ZodLiteral<"service.whole">;
105
+ }, z.z.core.$strip>, z.ZodObject<{
106
+ type: z.ZodLiteral<"service.segment">;
107
+ fromStationId: z.ZodString;
108
+ toStationId: z.ZodString;
109
+ }, z.z.core.$strip>, z.ZodObject<{
110
+ type: z.ZodLiteral<"service.point">;
111
+ stationId: z.ZodString;
112
+ }, z.z.core.$strip>]>>;
113
+ periods: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
114
+ kind: z.ZodLiteral<"fixed">;
115
+ startAt: z.z.ZodISODateTime;
116
+ endAt: z.ZodNullable<z.z.ZodISODateTime>;
117
+ }, z.z.core.$strip>, z.ZodObject<{
118
+ kind: z.ZodLiteral<"recurring">;
119
+ frequency: z.ZodEnum<{
120
+ daily: "daily";
121
+ weekly: "weekly";
122
+ monthly: "monthly";
123
+ yearly: "yearly";
124
+ }>;
125
+ startAt: z.z.ZodISODateTime;
126
+ endAt: z.z.ZodISODateTime;
127
+ daysOfWeek: z.ZodNullable<z.ZodArray<z.ZodEnum<{
128
+ MO: "MO";
129
+ TU: "TU";
130
+ WE: "WE";
131
+ TH: "TH";
132
+ FR: "FR";
133
+ SA: "SA";
134
+ SU: "SU";
135
+ }>>>;
136
+ timeWindow: z.ZodObject<{
137
+ startAt: z.z.ZodISOTime;
138
+ endAt: z.z.ZodISOTime;
139
+ }, z.z.core.$strip>;
140
+ timeZone: z.ZodLiteral<"Asia/Singapore">;
141
+ excludedDates: z.ZodNullable<z.ZodArray<z.z.ZodISODate>>;
142
+ }, z.z.core.$strip>]>>;
143
+ entity: z.ZodDiscriminatedUnion<[z.ZodObject<{
144
+ type: z.ZodLiteral<"service">;
145
+ serviceId: z.ZodString;
146
+ }, z.z.core.$strip>, z.ZodObject<{
147
+ type: z.ZodLiteral<"facility">;
148
+ stationId: z.ZodString;
149
+ kind: z.ZodEnum<{
150
+ lift: "lift";
151
+ escalator: "escalator";
152
+ "screen-door": "screen-door";
153
+ }>;
154
+ }, z.z.core.$strip>]>;
155
+ effects: z.ZodNullable<z.ZodObject<{
156
+ service: z.ZodNullable<z.ZodDiscriminatedUnion<[z.ZodObject<{
157
+ kind: z.ZodLiteral<"delay">;
158
+ duration: z.ZodNullable<z.z.ZodISODuration>;
159
+ }, z.z.core.$strip>, z.ZodObject<{
160
+ kind: z.ZodLiteral<"no-service">;
161
+ }, z.z.core.$strip>, z.ZodObject<{
162
+ kind: z.ZodLiteral<"reduced-service">;
163
+ }, z.z.core.$strip>, z.ZodObject<{
164
+ kind: z.ZodLiteral<"service-hours-adjustment">;
165
+ }, z.z.core.$strip>]>>;
166
+ facility: z.ZodNullable<z.ZodDiscriminatedUnion<[z.ZodObject<{
167
+ kind: z.ZodLiteral<"facility-out-of-service">;
168
+ }, z.z.core.$strip>, z.ZodObject<{
169
+ kind: z.ZodLiteral<"facility-degraded">;
170
+ }, z.z.core.$strip>]>>;
171
+ }, z.z.core.$strip>>;
172
+ basis: z.ZodObject<{
173
+ evidenceIds: z.ZodArray<z.ZodString>;
174
+ }, z.z.core.$strip>;
175
+ }, z.z.core.$strip>;
176
+ export type EntityImpactStateWithBasis = z.infer<typeof EntityImpactStateWithBasisSchema>;
@@ -0,0 +1,35 @@
1
+ import z from 'zod';
2
+ import { FacilityEffectSchema } from './facilityEffect.js';
3
+ import { PeriodSchema } from './period.js';
4
+ import { ServiceEffectSchema } from './serviceEffect.js';
5
+ import { ServiceScopeSchema } from './serviceScope.js';
6
+ export const AffectedEntityServiceSchema = z.object({
7
+ type: z.literal('service'),
8
+ serviceId: z.string(),
9
+ });
10
+ export const AffectedEntityFacilitySchema = z.object({
11
+ type: z.literal('facility'),
12
+ stationId: z.string(),
13
+ kind: z.enum(['lift', 'escalator', 'screen-door']),
14
+ });
15
+ export const AffectedEntitySchema = z.discriminatedUnion('type', [
16
+ AffectedEntityServiceSchema,
17
+ AffectedEntityFacilitySchema,
18
+ ]);
19
+ export const EntityImpactStateSchema = z.object({
20
+ serviceScopes: z.array(ServiceScopeSchema),
21
+ periods: z.array(PeriodSchema),
22
+ entity: AffectedEntitySchema,
23
+ effects: z
24
+ .object({
25
+ service: ServiceEffectSchema.nullable(),
26
+ facility: FacilityEffectSchema.nullable(),
27
+ })
28
+ .nullable(),
29
+ });
30
+ export const EntityImpactStateWithBasisSchema = EntityImpactStateSchema.extend({
31
+ basis: z.object({
32
+ evidenceIds: z.array(z.string()),
33
+ }),
34
+ });
35
+ //# sourceMappingURL=entity.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"entity.js","sourceRoot":"/","sources":["schema/issue/entity.ts"],"names":[],"mappings":"AAAA,OAAO,CAAC,MAAM,KAAK,CAAC;AACpB,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAC3D,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAEvD,MAAM,CAAC,MAAM,2BAA2B,GAAG,CAAC,CAAC,MAAM,CAAC;IAClD,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,SAAS,CAAC;IAC1B,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE;CACtB,CAAC,CAAC;AAGH,MAAM,CAAC,MAAM,4BAA4B,GAAG,CAAC,CAAC,MAAM,CAAC;IACnD,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,UAAU,CAAC;IAC3B,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE;IACrB,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,WAAW,EAAE,aAAa,CAAC,CAAC;CACnD,CAAC,CAAC;AAKH,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,CAAC,kBAAkB,CAAC,MAAM,EAAE;IAC/D,2BAA2B;IAC3B,4BAA4B;CAC7B,CAAC,CAAC;AAGH,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC9C,aAAa,EAAE,CAAC,CAAC,KAAK,CAAC,kBAAkB,CAAC;IAC1C,OAAO,EAAE,CAAC,CAAC,KAAK,CAAC,YAAY,CAAC;IAC9B,MAAM,EAAE,oBAAoB;IAC5B,OAAO,EAAE,CAAC;SACP,MAAM,CAAC;QACN,OAAO,EAAE,mBAAmB,CAAC,QAAQ,EAAE;QACvC,QAAQ,EAAE,oBAAoB,CAAC,QAAQ,EAAE;KAC1C,CAAC;SACD,QAAQ,EAAE;CACd,CAAC,CAAC;AAIH,MAAM,CAAC,MAAM,gCAAgC,GAAG,uBAAuB,CAAC,MAAM,CAAC;IAC7E,KAAK,EAAE,CAAC,CAAC,MAAM,CAAC;QACd,WAAW,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;KACjC,CAAC;CACH,CAAC,CAAC","sourcesContent":["import z from 'zod';\nimport { FacilityEffectSchema } from './facilityEffect.js';\nimport { PeriodSchema } from './period.js';\nimport { ServiceEffectSchema } from './serviceEffect.js';\nimport { ServiceScopeSchema } from './serviceScope.js';\n\nexport const AffectedEntityServiceSchema = z.object({\n type: z.literal('service'),\n serviceId: z.string(),\n});\nexport type AffectedEntityService = z.infer<typeof AffectedEntityServiceSchema>;\n\nexport const AffectedEntityFacilitySchema = z.object({\n type: z.literal('facility'),\n stationId: z.string(),\n kind: z.enum(['lift', 'escalator', 'screen-door']),\n});\nexport type AffectedEntityFacility = z.infer<\n typeof AffectedEntityFacilitySchema\n>;\n\nexport const AffectedEntitySchema = z.discriminatedUnion('type', [\n AffectedEntityServiceSchema,\n AffectedEntityFacilitySchema,\n]);\nexport type AffectedEntity = z.infer<typeof AffectedEntitySchema>;\n\nexport const EntityImpactStateSchema = z.object({\n serviceScopes: z.array(ServiceScopeSchema),\n periods: z.array(PeriodSchema),\n entity: AffectedEntitySchema,\n effects: z\n .object({\n service: ServiceEffectSchema.nullable(),\n facility: FacilityEffectSchema.nullable(),\n })\n .nullable(),\n});\n\nexport type EntityImpactState = z.infer<typeof EntityImpactStateSchema>;\n\nexport const EntityImpactStateWithBasisSchema = EntityImpactStateSchema.extend({\n basis: z.object({\n evidenceIds: z.array(z.string()),\n }),\n});\n\nexport type EntityImpactStateWithBasis = z.infer<\n typeof EntityImpactStateWithBasisSchema\n>;\n"]}
@@ -0,0 +1,124 @@
1
+ import z from 'zod';
2
+ export declare const EvidenceRenderSchema: z.ZodObject<{
3
+ text: z.ZodObject<{
4
+ 'en-SG': z.ZodString;
5
+ 'zh-Hans': z.ZodNullable<z.ZodString>;
6
+ ms: z.ZodNullable<z.ZodString>;
7
+ ta: z.ZodNullable<z.ZodString>;
8
+ }, z.z.core.$strip>;
9
+ source: z.ZodString;
10
+ }, z.z.core.$strip>;
11
+ export type EvidenceRender = z.infer<typeof EvidenceRenderSchema>;
12
+ export declare const EvidenceBaseSchema: z.ZodObject<{
13
+ id: z.ZodString;
14
+ ts: z.ZodString;
15
+ text: z.ZodString;
16
+ render: z.ZodNullable<z.ZodObject<{
17
+ text: z.ZodObject<{
18
+ 'en-SG': z.ZodString;
19
+ 'zh-Hans': z.ZodNullable<z.ZodString>;
20
+ ms: z.ZodNullable<z.ZodString>;
21
+ ta: z.ZodNullable<z.ZodString>;
22
+ }, z.z.core.$strip>;
23
+ source: z.ZodString;
24
+ }, z.z.core.$strip>>;
25
+ }, z.z.core.$strip>;
26
+ export type EvidenceBase = z.infer<typeof EvidenceBaseSchema>;
27
+ export declare const EvidenceOfficialStatementSchema: z.ZodObject<{
28
+ id: z.ZodString;
29
+ ts: z.ZodString;
30
+ text: z.ZodString;
31
+ render: z.ZodNullable<z.ZodObject<{
32
+ text: z.ZodObject<{
33
+ 'en-SG': z.ZodString;
34
+ 'zh-Hans': z.ZodNullable<z.ZodString>;
35
+ ms: z.ZodNullable<z.ZodString>;
36
+ ta: z.ZodNullable<z.ZodString>;
37
+ }, z.z.core.$strip>;
38
+ source: z.ZodString;
39
+ }, z.z.core.$strip>>;
40
+ type: z.ZodLiteral<"official-statement">;
41
+ sourceUrl: z.ZodString;
42
+ }, z.z.core.$strip>;
43
+ export type EvidenceOfficialStatement = z.infer<typeof EvidenceOfficialStatementSchema>;
44
+ export declare const EvidencePublicReportSchema: z.ZodObject<{
45
+ id: z.ZodString;
46
+ ts: z.ZodString;
47
+ text: z.ZodString;
48
+ render: z.ZodNullable<z.ZodObject<{
49
+ text: z.ZodObject<{
50
+ 'en-SG': z.ZodString;
51
+ 'zh-Hans': z.ZodNullable<z.ZodString>;
52
+ ms: z.ZodNullable<z.ZodString>;
53
+ ta: z.ZodNullable<z.ZodString>;
54
+ }, z.z.core.$strip>;
55
+ source: z.ZodString;
56
+ }, z.z.core.$strip>>;
57
+ type: z.ZodLiteral<"public.report">;
58
+ sourceUrl: z.ZodString;
59
+ }, z.z.core.$strip>;
60
+ export type EvidencePublicReport = z.infer<typeof EvidencePublicReportSchema>;
61
+ export declare const EvidenceMediaReportSchema: z.ZodObject<{
62
+ id: z.ZodString;
63
+ ts: z.ZodString;
64
+ text: z.ZodString;
65
+ render: z.ZodNullable<z.ZodObject<{
66
+ text: z.ZodObject<{
67
+ 'en-SG': z.ZodString;
68
+ 'zh-Hans': z.ZodNullable<z.ZodString>;
69
+ ms: z.ZodNullable<z.ZodString>;
70
+ ta: z.ZodNullable<z.ZodString>;
71
+ }, z.z.core.$strip>;
72
+ source: z.ZodString;
73
+ }, z.z.core.$strip>>;
74
+ type: z.ZodLiteral<"media.report">;
75
+ sourceUrl: z.ZodString;
76
+ }, z.z.core.$strip>;
77
+ export type EvidenceMediaReport = z.infer<typeof EvidenceMediaReportSchema>;
78
+ export declare const EvidenceSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
79
+ id: z.ZodString;
80
+ ts: z.ZodString;
81
+ text: z.ZodString;
82
+ render: z.ZodNullable<z.ZodObject<{
83
+ text: z.ZodObject<{
84
+ 'en-SG': z.ZodString;
85
+ 'zh-Hans': z.ZodNullable<z.ZodString>;
86
+ ms: z.ZodNullable<z.ZodString>;
87
+ ta: z.ZodNullable<z.ZodString>;
88
+ }, z.z.core.$strip>;
89
+ source: z.ZodString;
90
+ }, z.z.core.$strip>>;
91
+ type: z.ZodLiteral<"official-statement">;
92
+ sourceUrl: z.ZodString;
93
+ }, z.z.core.$strip>, z.ZodObject<{
94
+ id: z.ZodString;
95
+ ts: z.ZodString;
96
+ text: z.ZodString;
97
+ render: z.ZodNullable<z.ZodObject<{
98
+ text: z.ZodObject<{
99
+ 'en-SG': z.ZodString;
100
+ 'zh-Hans': z.ZodNullable<z.ZodString>;
101
+ ms: z.ZodNullable<z.ZodString>;
102
+ ta: z.ZodNullable<z.ZodString>;
103
+ }, z.z.core.$strip>;
104
+ source: z.ZodString;
105
+ }, z.z.core.$strip>>;
106
+ type: z.ZodLiteral<"public.report">;
107
+ sourceUrl: z.ZodString;
108
+ }, z.z.core.$strip>, z.ZodObject<{
109
+ id: z.ZodString;
110
+ ts: z.ZodString;
111
+ text: z.ZodString;
112
+ render: z.ZodNullable<z.ZodObject<{
113
+ text: z.ZodObject<{
114
+ 'en-SG': z.ZodString;
115
+ 'zh-Hans': z.ZodNullable<z.ZodString>;
116
+ ms: z.ZodNullable<z.ZodString>;
117
+ ta: z.ZodNullable<z.ZodString>;
118
+ }, z.z.core.$strip>;
119
+ source: z.ZodString;
120
+ }, z.z.core.$strip>>;
121
+ type: z.ZodLiteral<"media.report">;
122
+ sourceUrl: z.ZodString;
123
+ }, z.z.core.$strip>]>;
124
+ export type Evidence = z.infer<typeof EvidenceSchema>;
@@ -0,0 +1,30 @@
1
+ import z from 'zod';
2
+ import { TranslationsSchema } from '#schema/common.js';
3
+ export const EvidenceRenderSchema = z.object({
4
+ text: TranslationsSchema,
5
+ source: z.string(),
6
+ });
7
+ export const EvidenceBaseSchema = z.object({
8
+ id: z.string(),
9
+ ts: z.string(),
10
+ text: z.string(),
11
+ render: EvidenceRenderSchema.nullable(),
12
+ });
13
+ export const EvidenceOfficialStatementSchema = EvidenceBaseSchema.extend({
14
+ type: z.literal('official-statement'),
15
+ sourceUrl: z.string(),
16
+ });
17
+ export const EvidencePublicReportSchema = EvidenceBaseSchema.extend({
18
+ type: z.literal('public.report'),
19
+ sourceUrl: z.string(),
20
+ });
21
+ export const EvidenceMediaReportSchema = EvidenceBaseSchema.extend({
22
+ type: z.literal('media.report'),
23
+ sourceUrl: z.string(),
24
+ });
25
+ export const EvidenceSchema = z.discriminatedUnion('type', [
26
+ EvidenceOfficialStatementSchema,
27
+ EvidencePublicReportSchema,
28
+ EvidenceMediaReportSchema,
29
+ ]);
30
+ //# sourceMappingURL=evidence.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"evidence.js","sourceRoot":"/","sources":["schema/issue/evidence.ts"],"names":[],"mappings":"AAAA,OAAO,CAAC,MAAM,KAAK,CAAC;AACpB,OAAO,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAEvD,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC3C,IAAI,EAAE,kBAAkB;IACxB,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE;CACnB,CAAC,CAAC;AAGH,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,CAAC,MAAM,CAAC;IACzC,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE;IACd,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE;IACd,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;IAChB,MAAM,EAAE,oBAAoB,CAAC,QAAQ,EAAE;CACxC,CAAC,CAAC;AAGH,MAAM,CAAC,MAAM,+BAA+B,GAAG,kBAAkB,CAAC,MAAM,CAAC;IACvE,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,oBAAoB,CAAC;IACrC,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE;CACtB,CAAC,CAAC;AAKH,MAAM,CAAC,MAAM,0BAA0B,GAAG,kBAAkB,CAAC,MAAM,CAAC;IAClE,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,eAAe,CAAC;IAChC,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE;CACtB,CAAC,CAAC;AAGH,MAAM,CAAC,MAAM,yBAAyB,GAAG,kBAAkB,CAAC,MAAM,CAAC;IACjE,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,cAAc,CAAC;IAC/B,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE;CACtB,CAAC,CAAC;AAGH,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,CAAC,kBAAkB,CAAC,MAAM,EAAE;IACzD,+BAA+B;IAC/B,0BAA0B;IAC1B,yBAAyB;CAC1B,CAAC,CAAC","sourcesContent":["import z from 'zod';\nimport { TranslationsSchema } from '#schema/common.js';\n\nexport const EvidenceRenderSchema = z.object({\n text: TranslationsSchema,\n source: z.string(),\n});\nexport type EvidenceRender = z.infer<typeof EvidenceRenderSchema>;\n\nexport const EvidenceBaseSchema = z.object({\n id: z.string(),\n ts: z.string(),\n text: z.string(),\n render: EvidenceRenderSchema.nullable(),\n});\nexport type EvidenceBase = z.infer<typeof EvidenceBaseSchema>;\n\nexport const EvidenceOfficialStatementSchema = EvidenceBaseSchema.extend({\n type: z.literal('official-statement'),\n sourceUrl: z.string(),\n});\nexport type EvidenceOfficialStatement = z.infer<\n typeof EvidenceOfficialStatementSchema\n>;\n\nexport const EvidencePublicReportSchema = EvidenceBaseSchema.extend({\n type: z.literal('public.report'),\n sourceUrl: z.string(),\n});\nexport type EvidencePublicReport = z.infer<typeof EvidencePublicReportSchema>;\n\nexport const EvidenceMediaReportSchema = EvidenceBaseSchema.extend({\n type: z.literal('media.report'),\n sourceUrl: z.string(),\n});\nexport type EvidenceMediaReport = z.infer<typeof EvidenceMediaReportSchema>;\n\nexport const EvidenceSchema = z.discriminatedUnion('type', [\n EvidenceOfficialStatementSchema,\n EvidencePublicReportSchema,\n EvidenceMediaReportSchema,\n]);\nexport type Evidence = z.infer<typeof EvidenceSchema>;\n"]}
@@ -0,0 +1,15 @@
1
+ import z from 'zod';
2
+ export declare const FacilityEffectOutOfServiceSchema: z.ZodObject<{
3
+ kind: z.ZodLiteral<"facility-out-of-service">;
4
+ }, z.z.core.$strip>;
5
+ export type FacilityEffectOutOfService = z.infer<typeof FacilityEffectOutOfServiceSchema>;
6
+ export declare const FacilityEffectDegradedSchema: z.ZodObject<{
7
+ kind: z.ZodLiteral<"facility-degraded">;
8
+ }, z.z.core.$strip>;
9
+ export type FacilityEffectDegraded = z.infer<typeof FacilityEffectDegradedSchema>;
10
+ export declare const FacilityEffectSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
11
+ kind: z.ZodLiteral<"facility-out-of-service">;
12
+ }, z.z.core.$strip>, z.ZodObject<{
13
+ kind: z.ZodLiteral<"facility-degraded">;
14
+ }, z.z.core.$strip>]>;
15
+ export type FacilityEffect = z.infer<typeof FacilityEffectSchema>;
@@ -0,0 +1,12 @@
1
+ import z from 'zod';
2
+ export const FacilityEffectOutOfServiceSchema = z.object({
3
+ kind: z.literal('facility-out-of-service'),
4
+ });
5
+ export const FacilityEffectDegradedSchema = z.object({
6
+ kind: z.literal('facility-degraded'),
7
+ });
8
+ export const FacilityEffectSchema = z.discriminatedUnion('kind', [
9
+ FacilityEffectOutOfServiceSchema,
10
+ FacilityEffectDegradedSchema,
11
+ ]);
12
+ //# sourceMappingURL=facilityEffect.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"facilityEffect.js","sourceRoot":"/","sources":["schema/issue/facilityEffect.ts"],"names":[],"mappings":"AAAA,OAAO,CAAC,MAAM,KAAK,CAAC;AAEpB,MAAM,CAAC,MAAM,gCAAgC,GAAG,CAAC,CAAC,MAAM,CAAC;IACvD,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,yBAAyB,CAAC;CAC3C,CAAC,CAAC;AAKH,MAAM,CAAC,MAAM,4BAA4B,GAAG,CAAC,CAAC,MAAM,CAAC;IACnD,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,mBAAmB,CAAC;CACrC,CAAC,CAAC;AAKH,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,CAAC,kBAAkB,CAAC,MAAM,EAAE;IAC/D,gCAAgC;IAChC,4BAA4B;CAC7B,CAAC,CAAC","sourcesContent":["import z from 'zod';\n\nexport const FacilityEffectOutOfServiceSchema = z.object({\n kind: z.literal('facility-out-of-service'),\n});\nexport type FacilityEffectOutOfService = z.infer<\n typeof FacilityEffectOutOfServiceSchema\n>;\n\nexport const FacilityEffectDegradedSchema = z.object({\n kind: z.literal('facility-degraded'),\n});\nexport type FacilityEffectDegraded = z.infer<\n typeof FacilityEffectDegradedSchema\n>;\n\nexport const FacilityEffectSchema = z.discriminatedUnion('kind', [\n FacilityEffectOutOfServiceSchema,\n FacilityEffectDegradedSchema,\n]);\nexport type FacilityEffect = z.infer<typeof FacilityEffectSchema>;\n"]}
@@ -0,0 +1,3 @@
1
+ import { z } from 'zod';
2
+ export declare const IssueIdSchema: z.ZodString;
3
+ export type IssueId = z.infer<typeof IssueIdSchema>;
@@ -0,0 +1,6 @@
1
+ import { z } from 'zod';
2
+ export const IssueIdSchema = z
3
+ .string()
4
+ .refine((val) => /^\d{4}-\d{2}-\d{2}-.+$/.test(val))
5
+ .describe('YYYY-MM-DD followed by a lowercase blog post-like slug');
6
+ //# sourceMappingURL=id.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"id.js","sourceRoot":"/","sources":["schema/issue/id.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC;KAC3B,MAAM,EAAE;KACR,MAAM,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,wBAAwB,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;KACnD,QAAQ,CAAC,wDAAwD,CAAC,CAAC","sourcesContent":["import { z } from 'zod';\n\nexport const IssueIdSchema = z\n .string()\n .refine((val) => /^\\d{4}-\\d{2}-\\d{2}-.+$/.test(val))\n .describe('YYYY-MM-DD followed by a lowercase blog post-like slug');\nexport type IssueId = z.infer<typeof IssueIdSchema>;\n"]}