@mrtdown/core 2.0.0-alpha.1 → 2.0.0-alpha.11

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 (156) hide show
  1. package/dist/helpers/normalizeRecurringPeriod.d.ts +1 -1
  2. package/dist/helpers/normalizeRecurringPeriod.js +1 -1
  3. package/dist/helpers/normalizeRecurringPeriod.js.map +1 -1
  4. package/dist/helpers/normalizeRecurringPeriod.test.js.map +1 -1
  5. package/dist/helpers/resolvePeriods.d.ts +20 -5
  6. package/dist/helpers/resolvePeriods.js +15 -1
  7. package/dist/helpers/resolvePeriods.js.map +1 -1
  8. package/dist/helpers/resolvePeriods.test.js.map +1 -1
  9. package/dist/index.d.ts +23 -18
  10. package/dist/index.js +23 -18
  11. package/dist/index.js.map +1 -1
  12. package/dist/schema/Landmark.js.map +1 -1
  13. package/dist/schema/Line.d.ts +6 -0
  14. package/dist/schema/Line.js +2 -1
  15. package/dist/schema/Line.js.map +1 -1
  16. package/dist/schema/Manifest.d.ts +13 -0
  17. package/dist/schema/Manifest.js +13 -0
  18. package/dist/schema/Manifest.js.map +1 -0
  19. package/dist/schema/Operator.js.map +1 -1
  20. package/dist/schema/Service.js.map +1 -1
  21. package/dist/schema/Station.d.ts +7 -0
  22. package/dist/schema/Station.js +7 -6
  23. package/dist/schema/Station.js.map +1 -1
  24. package/dist/schema/Town.js.map +1 -1
  25. package/dist/schema/common.d.ts +4 -0
  26. package/dist/schema/common.js +3 -0
  27. package/dist/schema/common.js.map +1 -1
  28. package/dist/schema/issue/bundle.js.map +1 -1
  29. package/dist/schema/issue/cause.js.map +1 -1
  30. package/dist/schema/issue/claim.js.map +1 -1
  31. package/dist/schema/issue/entity.d.ts +6 -0
  32. package/dist/schema/issue/entity.js +6 -1
  33. package/dist/schema/issue/entity.js.map +1 -1
  34. package/dist/schema/issue/evidence.d.ts +6 -0
  35. package/dist/schema/issue/evidence.js +9 -4
  36. package/dist/schema/issue/evidence.js.map +1 -1
  37. package/dist/schema/issue/facilityEffect.d.ts +5 -0
  38. package/dist/schema/issue/facilityEffect.js +6 -2
  39. package/dist/schema/issue/facilityEffect.js.map +1 -1
  40. package/dist/schema/issue/id.js.map +1 -1
  41. package/dist/schema/issue/impactEvent.js.map +1 -1
  42. package/dist/schema/issue/issue.js +2 -4
  43. package/dist/schema/issue/issue.js.map +1 -1
  44. package/dist/schema/issue/issueType.js.map +1 -1
  45. package/dist/schema/issue/period.js.map +1 -1
  46. package/dist/schema/issue/serviceEffect.d.ts +7 -0
  47. package/dist/schema/issue/serviceEffect.js +10 -4
  48. package/dist/schema/issue/serviceEffect.js.map +1 -1
  49. package/dist/schema/issue/serviceScope.d.ts +6 -0
  50. package/dist/schema/issue/serviceScope.js +8 -3
  51. package/dist/schema/issue/serviceScope.js.map +1 -1
  52. package/dist/util/assert.js.map +1 -1
  53. package/package.json +21 -61
  54. package/README.md +0 -107
  55. package/dist/constants.d.ts +0 -10
  56. package/dist/constants.js +0 -11
  57. package/dist/constants.js.map +0 -1
  58. package/dist/helpers/calculateDurationWithinServiceHours.d.ts +0 -2
  59. package/dist/helpers/calculateDurationWithinServiceHours.js +0 -13
  60. package/dist/helpers/calculateDurationWithinServiceHours.js.map +0 -1
  61. package/dist/helpers/calculateDurationWithinServiceHours.test.d.ts +0 -1
  62. package/dist/helpers/calculateDurationWithinServiceHours.test.js +0 -83
  63. package/dist/helpers/calculateDurationWithinServiceHours.test.js.map +0 -1
  64. package/dist/helpers/computeImpactFromEvidenceClaims.d.ts +0 -21
  65. package/dist/helpers/computeImpactFromEvidenceClaims.js +0 -293
  66. package/dist/helpers/computeImpactFromEvidenceClaims.js.map +0 -1
  67. package/dist/helpers/computeImpactFromEvidenceClaims.test.d.ts +0 -1
  68. package/dist/helpers/computeImpactFromEvidenceClaims.test.js +0 -544
  69. package/dist/helpers/computeImpactFromEvidenceClaims.test.js.map +0 -1
  70. package/dist/helpers/computeStartOfDaysWithinInterval.d.ts +0 -2
  71. package/dist/helpers/computeStartOfDaysWithinInterval.js +0 -15
  72. package/dist/helpers/computeStartOfDaysWithinInterval.js.map +0 -1
  73. package/dist/helpers/computeStartOfDaysWithinInterval.test.d.ts +0 -1
  74. package/dist/helpers/computeStartOfDaysWithinInterval.test.js +0 -126
  75. package/dist/helpers/computeStartOfDaysWithinInterval.test.js.map +0 -1
  76. package/dist/helpers/estimateOpenAICost.d.ts +0 -40
  77. package/dist/helpers/estimateOpenAICost.js +0 -55
  78. package/dist/helpers/estimateOpenAICost.js.map +0 -1
  79. package/dist/helpers/keyForAffectedEntity.d.ts +0 -7
  80. package/dist/helpers/keyForAffectedEntity.js +0 -14
  81. package/dist/helpers/keyForAffectedEntity.js.map +0 -1
  82. package/dist/helpers/splitIntervalByServiceHours.d.ts +0 -2
  83. package/dist/helpers/splitIntervalByServiceHours.js +0 -30
  84. package/dist/helpers/splitIntervalByServiceHours.js.map +0 -1
  85. package/dist/helpers/splitIntervalByServiceHours.test.d.ts +0 -1
  86. package/dist/helpers/splitIntervalByServiceHours.test.js +0 -152
  87. package/dist/helpers/splitIntervalByServiceHours.test.js.map +0 -1
  88. package/dist/helpers/sumIntervalDuration.d.ts +0 -2
  89. package/dist/helpers/sumIntervalDuration.js +0 -9
  90. package/dist/helpers/sumIntervalDuration.js.map +0 -1
  91. package/dist/repo/MRTDownRepository.d.ts +0 -23
  92. package/dist/repo/MRTDownRepository.js +0 -28
  93. package/dist/repo/MRTDownRepository.js.map +0 -1
  94. package/dist/repo/common/FileStore.d.ts +0 -12
  95. package/dist/repo/common/FileStore.js +0 -27
  96. package/dist/repo/common/FileStore.js.map +0 -1
  97. package/dist/repo/common/StandardRepository.d.ts +0 -32
  98. package/dist/repo/common/StandardRepository.js +0 -58
  99. package/dist/repo/common/StandardRepository.js.map +0 -1
  100. package/dist/repo/common/store.d.ts +0 -29
  101. package/dist/repo/common/store.js +0 -2
  102. package/dist/repo/common/store.js.map +0 -1
  103. package/dist/repo/issue/IssueRepository.d.ts +0 -36
  104. package/dist/repo/issue/IssueRepository.js +0 -177
  105. package/dist/repo/issue/IssueRepository.js.map +0 -1
  106. package/dist/repo/issue/helpers/deriveCurrentState.d.ts +0 -51
  107. package/dist/repo/issue/helpers/deriveCurrentState.js +0 -113
  108. package/dist/repo/issue/helpers/deriveCurrentState.js.map +0 -1
  109. package/dist/repo/issue/helpers/deriveCurrentState.test.d.ts +0 -1
  110. package/dist/repo/issue/helpers/deriveCurrentState.test.js +0 -477
  111. package/dist/repo/issue/helpers/deriveCurrentState.test.js.map +0 -1
  112. package/dist/repo/landmark/LandmarkRepository.d.ts +0 -7
  113. package/dist/repo/landmark/LandmarkRepository.js +0 -12
  114. package/dist/repo/landmark/LandmarkRepository.js.map +0 -1
  115. package/dist/repo/line/LineRepository.d.ts +0 -13
  116. package/dist/repo/line/LineRepository.js +0 -32
  117. package/dist/repo/line/LineRepository.js.map +0 -1
  118. package/dist/repo/operator/OperatorRepository.d.ts +0 -7
  119. package/dist/repo/operator/OperatorRepository.js +0 -12
  120. package/dist/repo/operator/OperatorRepository.js.map +0 -1
  121. package/dist/repo/service/ServiceRepository.d.ts +0 -19
  122. package/dist/repo/service/ServiceRepository.js +0 -39
  123. package/dist/repo/service/ServiceRepository.js.map +0 -1
  124. package/dist/repo/station/StationRepository.d.ts +0 -13
  125. package/dist/repo/station/StationRepository.js +0 -30
  126. package/dist/repo/station/StationRepository.js.map +0 -1
  127. package/dist/repo/town/TownRepository.d.ts +0 -7
  128. package/dist/repo/town/TownRepository.js +0 -12
  129. package/dist/repo/town/TownRepository.js.map +0 -1
  130. package/dist/util/ingestContent/helpers/getSlugDateTimeFromClaims.d.ts +0 -7
  131. package/dist/util/ingestContent/helpers/getSlugDateTimeFromClaims.js +0 -24
  132. package/dist/util/ingestContent/helpers/getSlugDateTimeFromClaims.js.map +0 -1
  133. package/dist/util/ingestContent/index.d.ts +0 -12
  134. package/dist/util/ingestContent/index.js +0 -171
  135. package/dist/util/ingestContent/index.js.map +0 -1
  136. package/dist/util/ingestContent/types.d.ts +0 -32
  137. package/dist/util/ingestContent/types.js +0 -2
  138. package/dist/util/ingestContent/types.js.map +0 -1
  139. package/dist/write/MRTDownWriter.d.ts +0 -27
  140. package/dist/write/MRTDownWriter.js +0 -27
  141. package/dist/write/MRTDownWriter.js.map +0 -1
  142. package/dist/write/common/FileWriteStore.d.ts +0 -13
  143. package/dist/write/common/FileWriteStore.js +0 -31
  144. package/dist/write/common/FileWriteStore.js.map +0 -1
  145. package/dist/write/common/StandardWriter.d.ts +0 -14
  146. package/dist/write/common/StandardWriter.js +0 -17
  147. package/dist/write/common/StandardWriter.js.map +0 -1
  148. package/dist/write/common/store.d.ts +0 -32
  149. package/dist/write/common/store.js +0 -2
  150. package/dist/write/common/store.js.map +0 -1
  151. package/dist/write/id/IdGenerator.d.ts +0 -18
  152. package/dist/write/id/IdGenerator.js +0 -23
  153. package/dist/write/id/IdGenerator.js.map +0 -1
  154. package/dist/write/issue/IssueWriter.d.ts +0 -12
  155. package/dist/write/issue/IssueWriter.js +0 -33
  156. package/dist/write/issue/IssueWriter.js.map +0 -1
@@ -7,10 +7,15 @@ export const AffectedEntityServiceSchema = z.object({
7
7
  type: z.literal('service'),
8
8
  serviceId: z.string(),
9
9
  });
10
+ export const AffectedEntityFacilityKindSchema = z.enum([
11
+ 'lift',
12
+ 'escalator',
13
+ 'screen-door',
14
+ ]);
10
15
  export const AffectedEntityFacilitySchema = z.object({
11
16
  type: z.literal('facility'),
12
17
  stationId: z.string(),
13
- kind: z.enum(['lift', 'escalator', 'screen-door']),
18
+ kind: AffectedEntityFacilityKindSchema,
14
19
  });
15
20
  export const AffectedEntitySchema = z.discriminatedUnion('type', [
16
21
  AffectedEntityServiceSchema,
@@ -1 +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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AAW,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"]}
1
+ {"version":3,"file":"entity.js","sourceRoot":"","sources":["../../../src/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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,CAAC,CAAC,MAAM,EAAE,CAAC;KACjC,CAAC;CACH,CAAC,CAAC"}
@@ -1,4 +1,10 @@
1
1
  import z from 'zod';
2
+ export declare const EvidenceTypeSchema: z.ZodEnum<{
3
+ "official-statement": "official-statement";
4
+ "public.report": "public.report";
5
+ "media.report": "media.report";
6
+ }>;
7
+ export type EvidenceType = z.infer<typeof EvidenceTypeSchema>;
2
8
  export declare const EvidenceRenderSchema: z.ZodObject<{
3
9
  text: z.ZodObject<{
4
10
  'en-SG': z.ZodString;
@@ -1,5 +1,10 @@
1
1
  import z from 'zod';
2
- import { TranslationsSchema } from '#schema/common.js';
2
+ import { TranslationsSchema } from '../common.js';
3
+ export const EvidenceTypeSchema = z.enum([
4
+ 'official-statement',
5
+ 'public.report',
6
+ 'media.report',
7
+ ]);
3
8
  export const EvidenceRenderSchema = z.object({
4
9
  text: TranslationsSchema,
5
10
  source: z.string(),
@@ -11,15 +16,15 @@ export const EvidenceBaseSchema = z.object({
11
16
  render: EvidenceRenderSchema.nullable(),
12
17
  });
13
18
  export const EvidenceOfficialStatementSchema = EvidenceBaseSchema.extend({
14
- type: z.literal('official-statement'),
19
+ type: z.literal(EvidenceTypeSchema.enum['official-statement']),
15
20
  sourceUrl: z.string(),
16
21
  });
17
22
  export const EvidencePublicReportSchema = EvidenceBaseSchema.extend({
18
- type: z.literal('public.report'),
23
+ type: z.literal(EvidenceTypeSchema.enum['public.report']),
19
24
  sourceUrl: z.string(),
20
25
  });
21
26
  export const EvidenceMediaReportSchema = EvidenceBaseSchema.extend({
22
- type: z.literal('media.report'),
27
+ type: z.literal(EvidenceTypeSchema.enum['media.report']),
23
28
  sourceUrl: z.string(),
24
29
  });
25
30
  export const EvidenceSchema = z.discriminatedUnion('type', [
@@ -1 +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"]}
1
+ {"version":3,"file":"evidence.js","sourceRoot":"","sources":["../../../src/schema/issue/evidence.ts"],"names":[],"mappings":"AAAA,OAAO,CAAC,MAAM,KAAK,CAAC;AACpB,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAElD,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,CAAC,IAAI,CAAC;IACvC,oBAAoB;IACpB,eAAe;IACf,cAAc;CACf,CAAC,CAAC;AAGH,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,kBAAkB,CAAC,IAAI,CAAC,oBAAoB,CAAC,CAAC;IAC9D,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,kBAAkB,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;IACzD,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,kBAAkB,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;IACxD,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"}
@@ -1,4 +1,9 @@
1
1
  import z from 'zod';
2
+ export declare const FacilityEffectKindSchema: z.ZodEnum<{
3
+ "facility-out-of-service": "facility-out-of-service";
4
+ "facility-degraded": "facility-degraded";
5
+ }>;
6
+ export type FacilityEffectKind = z.infer<typeof FacilityEffectKindSchema>;
2
7
  export declare const FacilityEffectOutOfServiceSchema: z.ZodObject<{
3
8
  kind: z.ZodLiteral<"facility-out-of-service">;
4
9
  }, z.z.core.$strip>;
@@ -1,9 +1,13 @@
1
1
  import z from 'zod';
2
+ export const FacilityEffectKindSchema = z.enum([
3
+ 'facility-out-of-service',
4
+ 'facility-degraded',
5
+ ]);
2
6
  export const FacilityEffectOutOfServiceSchema = z.object({
3
- kind: z.literal('facility-out-of-service'),
7
+ kind: z.literal(FacilityEffectKindSchema.enum['facility-out-of-service']),
4
8
  });
5
9
  export const FacilityEffectDegradedSchema = z.object({
6
- kind: z.literal('facility-degraded'),
10
+ kind: z.literal(FacilityEffectKindSchema.enum['facility-degraded']),
7
11
  });
8
12
  export const FacilityEffectSchema = z.discriminatedUnion('kind', [
9
13
  FacilityEffectOutOfServiceSchema,
@@ -1 +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"]}
1
+ {"version":3,"file":"facilityEffect.js","sourceRoot":"","sources":["../../../src/schema/issue/facilityEffect.ts"],"names":[],"mappings":"AAAA,OAAO,CAAC,MAAM,KAAK,CAAC;AAEpB,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,CAAC,IAAI,CAAC;IAC7C,yBAAyB;IACzB,mBAAmB;CACpB,CAAC,CAAC;AAGH,MAAM,CAAC,MAAM,gCAAgC,GAAG,CAAC,CAAC,MAAM,CAAC;IACvD,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,wBAAwB,CAAC,IAAI,CAAC,yBAAyB,CAAC,CAAC;CAC1E,CAAC,CAAC;AAKH,MAAM,CAAC,MAAM,4BAA4B,GAAG,CAAC,CAAC,MAAM,CAAC;IACnD,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,wBAAwB,CAAC,IAAI,CAAC,mBAAmB,CAAC,CAAC;CACpE,CAAC,CAAC;AAKH,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,CAAC,kBAAkB,CAAC,MAAM,EAAE;IAC/D,gCAAgC;IAChC,4BAA4B;CAC7B,CAAC,CAAC"}
@@ -1 +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"]}
1
+ {"version":3,"file":"id.js","sourceRoot":"","sources":["../../../src/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"}
@@ -1 +1 @@
1
- {"version":3,"file":"impactEvent.js","sourceRoot":"/","sources":["schema/issue/impactEvent.ts"],"names":[],"mappings":"AAAA,OAAO,CAAC,MAAM,KAAK,CAAC;AACpB,OAAO,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAChD,OAAO,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AACnD,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,qBAAqB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC5C,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE;IACd,MAAM,EAAE,oBAAoB;IAC5B,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,QAAQ,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC;IACpC,KAAK,EAAE,CAAC,CAAC,MAAM,CAAC;QACd,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE;KACvB,CAAC;CACH,CAAC,CAAC;AAGH,MAAM,CAAC,MAAM,2BAA2B,GAAG,qBAAqB,CAAC,MAAM,CAAC;IACtE,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,aAAa,CAAC;IAC9B,OAAO,EAAE,CAAC,CAAC,KAAK,CAAC,YAAY,CAAC;CAC/B,CAAC,CAAC;AAGH,MAAM,CAAC,MAAM,gCAAgC,GAAG,qBAAqB,CAAC,MAAM,CAAC;IAC3E,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,oBAAoB,CAAC;IACrC,aAAa,EAAE,CAAC,CAAC,KAAK,CAAC,kBAAkB,CAAC;CAC3C,CAAC,CAAC;AAKH,MAAM,CAAC,MAAM,iCAAiC,GAAG,qBAAqB,CAAC,MAAM,CAAC;IAC5E,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,qBAAqB,CAAC;IACtC,MAAM,EAAE,mBAAmB;CAC5B,CAAC,CAAC;AAKH,MAAM,CAAC,MAAM,kCAAkC,GAAG,qBAAqB,CAAC,MAAM,CAAC;IAC7E,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,sBAAsB,CAAC;IACvC,MAAM,EAAE,oBAAoB;CAC7B,CAAC,CAAC;AAKH,MAAM,CAAC,MAAM,0BAA0B,GAAG,qBAAqB,CAAC,MAAM,CAAC;IACrE,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,YAAY,CAAC;IAC7B,MAAM,EAAE,CAAC,CAAC,KAAK,CAAC,kBAAkB,CAAC;CACpC,CAAC,CAAC;AAGH,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,CAAC,kBAAkB,CAAC,MAAM,EAAE;IAC5D,2BAA2B;IAC3B,gCAAgC;IAChC,iCAAiC;IACjC,kCAAkC;IAClC,0BAA0B;CAC3B,CAAC,CAAC","sourcesContent":["import z from 'zod';\nimport { CauseSubtypeSchema } from './cause.js';\nimport { AffectedEntitySchema } from './entity.js';\nimport { FacilityEffectSchema } from './facilityEffect.js';\nimport { PeriodSchema } from './period.js';\nimport { ServiceEffectSchema } from './serviceEffect.js';\nimport { ServiceScopeSchema } from './serviceScope.js';\n\nexport const ImpactEventBaseSchema = z.object({\n id: z.string(),\n entity: AffectedEntitySchema,\n ts: z.iso.datetime({ offset: true }),\n basis: z.object({\n evidenceId: z.string(),\n }),\n});\nexport type ImpactEventBase = z.infer<typeof ImpactEventBaseSchema>;\n\nexport const ImpactEventPeriodsSetSchema = ImpactEventBaseSchema.extend({\n type: z.literal('periods.set'),\n periods: z.array(PeriodSchema),\n});\nexport type ImpactEventPeriodsSet = z.infer<typeof ImpactEventPeriodsSetSchema>;\n\nexport const ImpactEventServiceScopeSetSchema = ImpactEventBaseSchema.extend({\n type: z.literal('service_scopes.set'),\n serviceScopes: z.array(ServiceScopeSchema),\n});\nexport type ImpactEventServiceScopeSet = z.infer<\n typeof ImpactEventServiceScopeSetSchema\n>;\n\nexport const ImpactEventServiceEffectSetSchema = ImpactEventBaseSchema.extend({\n type: z.literal('service_effects.set'),\n effect: ServiceEffectSchema,\n});\nexport type ImpactEventServiceEffectSet = z.infer<\n typeof ImpactEventServiceEffectSetSchema\n>;\n\nexport const ImpactEventFacilityEffectSetSchema = ImpactEventBaseSchema.extend({\n type: z.literal('facility_effects.set'),\n effect: FacilityEffectSchema,\n});\nexport type ImpactEventFacilityEffectSet = z.infer<\n typeof ImpactEventFacilityEffectSetSchema\n>;\n\nexport const ImpactEventCausesSetSchema = ImpactEventBaseSchema.extend({\n type: z.literal('causes.set'),\n causes: z.array(CauseSubtypeSchema),\n});\nexport type ImpactEventCauseSet = z.infer<typeof ImpactEventCausesSetSchema>;\n\nexport const ImpactEventSchema = z.discriminatedUnion('type', [\n ImpactEventPeriodsSetSchema,\n ImpactEventServiceScopeSetSchema,\n ImpactEventServiceEffectSetSchema,\n ImpactEventFacilityEffectSetSchema,\n ImpactEventCausesSetSchema,\n]);\nexport type ImpactEvent = z.infer<typeof ImpactEventSchema>;\n"]}
1
+ {"version":3,"file":"impactEvent.js","sourceRoot":"","sources":["../../../src/schema/issue/impactEvent.ts"],"names":[],"mappings":"AAAA,OAAO,CAAC,MAAM,KAAK,CAAC;AACpB,OAAO,EAAE,kBAAkB,EAAE,MAAM,YA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IAC7E,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,sBAAsB,CAAC;IACvC,MAAM,EAAE,oBAAoB;CAC7B,CAAC,CAAC;AAKH,MAAM,CAAC,MAAM,0BAA0B,GAAG,qBAAqB,CAAC,MAAM,CAAC;IACrE,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,YAAY,CAAC;IAC7B,MAAM,EAAE,CAAC,CAAC,KAAK,CAAC,kBAAkB,CAAC;CACpC,CAAC,CAAC;AAGH,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,CAAC,kBAAkB,CAAC,MAAM,EAAE;IAC5D,2BAA2B;IAC3B,gCAAgC;IAChC,iCAAiC;IACjC,kCAAkC;IAClC,0BAA0B;CAC3B,CAAC,CAAC"}
@@ -1,13 +1,11 @@
1
1
  import z from 'zod';
2
- import { TranslationsSchema } from '#schema/common.js';
2
+ import { TranslationsMetaSchema, TranslationsSchema } from '../common.js';
3
3
  import { IssueIdSchema } from './id.js';
4
4
  import { IssueTypeSchema } from './issueType.js';
5
5
  export const IssueSchema = z.object({
6
6
  id: IssueIdSchema,
7
7
  type: IssueTypeSchema,
8
8
  title: TranslationsSchema,
9
- titleMeta: z.object({
10
- source: z.string(),
11
- }),
9
+ titleMeta: TranslationsMetaSchema,
12
10
  });
13
11
  //# sourceMappingURL=issue.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"issue.js","sourceRoot":"/","sources":["schema/issue/issue.ts"],"names":[],"mappings":"AAAA,OAAO,CAAC,MAAM,KAAK,CAAC;AACpB,OAAO,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AACvD,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACxC,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAEjD,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,CAAC,MAAM,CAAC;IAClC,EAAE,EAAE,aAAa;IACjB,IAAI,EAAE,eAAe;IACrB,KAAK,EAAE,kBAAkB;IACzB,SAAS,EAAE,CAAC,CAAC,MAAM,CAAC;QAClB,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE;KACnB,CAAC;CACH,CAAC,CAAC","sourcesContent":["import z from 'zod';\nimport { TranslationsSchema } from '#schema/common.js';\nimport { IssueIdSchema } from './id.js';\nimport { IssueTypeSchema } from './issueType.js';\n\nexport const IssueSchema = z.object({\n id: IssueIdSchema,\n type: IssueTypeSchema,\n title: TranslationsSchema,\n titleMeta: z.object({\n source: z.string(),\n }),\n});\nexport type Issue = z.infer<typeof IssueSchema>;\n"]}
1
+ {"version":3,"file":"issue.js","sourceRoot":"","sources":["../../../src/schema/issue/issue.ts"],"names":[],"mappings":"AAAA,OAAO,CAAC,MAAM,KAAK,CAAC;AACpB,OAAO,EAAE,sBAAsB,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAC1E,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACxC,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAEjD,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,CAAC,MAAM,CAAC;IAClC,EAAE,EAAE,aAAa;IACjB,IAAI,EAAE,eAAe;IACrB,KAAK,EAAE,kBAAkB;IACzB,SAAS,EAAE,sBAAsB;CAClC,CAAC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"issueType.js","sourceRoot":"/","sources":["schema/issue/issueType.ts"],"names":[],"mappings":"AAAA,OAAO,CAAC,MAAM,KAAK,CAAC;AAEpB,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,YAAY,EAAE,aAAa,EAAE,OAAO,CAAC,CAAC,CAAC","sourcesContent":["import z from 'zod';\n\nexport const IssueTypeSchema = z.enum(['disruption', 'maintenance', 'infra']);\nexport type IssueType = z.infer<typeof IssueTypeSchema>;\n"]}
1
+ {"version":3,"file":"issueType.js","sourceRoot":"","sources":["../../../src/schema/issue/issueType.ts"],"names":[],"mappings":"A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zD,QAAQ,EAAE;IACb,UAAU,EAAE,CAAC,CAAC,MAAM,CAAC;QACnB,OAAO,EAAE,CAAC,CAAC,GAAG,CAAC,IAAI,EAAE;QACrB,KAAK,EAAE,CAAC,CAAC,GAAG,CAAC,IAAI,EAAE;KACpB,CAAC;IACF,QAAQ,EAAE,CAAC,CAAC,OAAO,CAAC,gBAAgB,CAAC;IACrC,aAAa,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC,CAAC,QAAQ,EAAE;CAChD,CAAC,CAAC;AAGH,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,CAAC,kBAAkB,CAAC,MAAM,EAAE;IACvD,iBAAiB;IACjB,qBAAqB;CACtB,CAAC,CAAC","sourcesContent":["import z from 'zod';\n\nexport const PeriodFixedSchema = z.object({\n kind: z.literal('fixed'),\n startAt: z.iso.datetime({ offset: true }),\n endAt: z.iso.datetime({ offset: true }).nullable(),\n});\nexport type PeriodFixed = z.infer<typeof PeriodFixedSchema>;\n\nexport const PeriodFrequencySchema = z.enum([\n 'daily',\n 'weekly',\n 'monthly',\n 'yearly',\n]);\nexport type PeriodFrequency = z.infer<typeof PeriodFrequencySchema>;\n\nexport const PeriodRecurringSchema = z.object({\n kind: z.literal('recurring'),\n frequency: PeriodFrequencySchema,\n startAt: z.iso.datetime({ offset: true }),\n endAt: z.iso.datetime({ offset: true }),\n daysOfWeek: z\n .array(z.enum(['MO', 'TU', 'WE', 'TH', 'FR', 'SA', 'SU']))\n .nullable(),\n timeWindow: z.object({\n startAt: z.iso.time(),\n endAt: z.iso.time(),\n }),\n timeZone: z.literal('Asia/Singapore'),\n excludedDates: z.array(z.iso.date()).nullable(),\n});\nexport type PeriodRecurring = z.infer<typeof PeriodRecurringSchema>;\n\nexport const PeriodSchema = z.discriminatedUnion('kind', [\n PeriodFixedSchema,\n PeriodRecurringSchema,\n]);\nexport type Period = z.infer<typeof PeriodSchema>;\n"]}
1
+ {"version":3,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AAC;IACF,QAAQ,EAAE,CAAC,CAAC,OAAO,CAAC,gBAAgB,CAAC;IACrC,aAAa,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC,CAAC,QAAQ,EAAE;CAChD,CAAC,CAAC;AAGH,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,CAAC,kBAAkB,CAAC,MAAM,EAAE;IACvD,iBAAiB;IACjB,qBAAqB;CACtB,CAAC,CAAC"}
@@ -1,4 +1,11 @@
1
1
  import z from 'zod';
2
+ export declare const ServiceEffectKindSchema: z.ZodEnum<{
3
+ delay: "delay";
4
+ "no-service": "no-service";
5
+ "reduced-service": "reduced-service";
6
+ "service-hours-adjustment": "service-hours-adjustment";
7
+ }>;
8
+ export type ServiceEffectKind = z.infer<typeof ServiceEffectKindSchema>;
2
9
  export declare const ServiceEffectDelaySchema: z.ZodObject<{
3
10
  kind: z.ZodLiteral<"delay">;
4
11
  duration: z.ZodNullable<z.z.ZodISODuration>;
@@ -1,16 +1,22 @@
1
1
  import z from 'zod';
2
+ export const ServiceEffectKindSchema = z.enum([
3
+ 'delay',
4
+ 'no-service',
5
+ 'reduced-service',
6
+ 'service-hours-adjustment',
7
+ ]);
2
8
  export const ServiceEffectDelaySchema = z.object({
3
- kind: z.literal('delay'),
9
+ kind: z.literal(ServiceEffectKindSchema.enum.delay),
4
10
  duration: z.iso.duration().nullable(),
5
11
  });
6
12
  export const ServiceEffectNoServiceSchema = z.object({
7
- kind: z.literal('no-service'),
13
+ kind: z.literal(ServiceEffectKindSchema.enum['no-service']),
8
14
  });
9
15
  export const ServiceEffectReducedServiceSchema = z.object({
10
- kind: z.literal('reduced-service'),
16
+ kind: z.literal(ServiceEffectKindSchema.enum['reduced-service']),
11
17
  });
12
18
  export const ServiceEffectServiceHoursAdjustmentSchema = z.object({
13
- kind: z.literal('service-hours-adjustment'),
19
+ kind: z.literal(ServiceEffectKindSchema.enum['service-hours-adjustment']),
14
20
  });
15
21
  export const ServiceEffectSchema = z.discriminatedUnion('kind', [
16
22
  ServiceEffectDelaySchema,
@@ -1 +1 @@
1
- {"version":3,"file":"serviceEffect.js","sourceRoot":"/","sources":["schema/issue/serviceEffect.ts"],"names":[],"mappings":"AAAA,OAAO,CAAC,MAAM,KAAK,CAAC;AAEpB,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC/C,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC;IACxB,QAAQ,EAAE,CAAC,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAC,QAAQ,EAAE;CACtC,CAAC,CAAC;AAGH,MAAM,CAAC,MAAM,4BAA4B,GAAG,CAAC,CAAC,MAAM,CAAC;IACnD,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,YAAY,CAAC;CAC9B,CAAC,CAAC;AAKH,MAAM,CAAC,MAAM,iCAAiC,GAAG,CAAC,CAAC,MAAM,CAAC;IACxD,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,iBAAiB,CAAC;CACnC,CAAC,CAAC;AAKH,MAAM,CAAC,MAAM,yCAAyC,GAAG,CAAC,CAAC,MAAM,CAAC;IAChE,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,0BAA0B,CAAC;CAC5C,CAAC,CAAC;AAKH,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,CAAC,kBAAkB,CAAC,MAAM,EAAE;IAC9D,wBAAwB;IACxB,4BAA4B;IAC5B,iCAAiC;IACjC,yCAAyC;CAC1C,CAAC,CAAC","sourcesContent":["import z from 'zod';\n\nexport const ServiceEffectDelaySchema = z.object({\n kind: z.literal('delay'),\n duration: z.iso.duration().nullable(),\n});\nexport type ServiceEffectDelay = z.infer<typeof ServiceEffectDelaySchema>;\n\nexport const ServiceEffectNoServiceSchema = z.object({\n kind: z.literal('no-service'),\n});\nexport type ServiceEffectNoService = z.infer<\n typeof ServiceEffectNoServiceSchema\n>;\n\nexport const ServiceEffectReducedServiceSchema = z.object({\n kind: z.literal('reduced-service'),\n});\nexport type ServiceEffectReducedService = z.infer<\n typeof ServiceEffectReducedServiceSchema\n>;\n\nexport const ServiceEffectServiceHoursAdjustmentSchema = z.object({\n kind: z.literal('service-hours-adjustment'),\n});\nexport type ServiceEffectServiceHoursAdjustment = z.infer<\n typeof ServiceEffectServiceHoursAdjustmentSchema\n>;\n\nexport const ServiceEffectSchema = z.discriminatedUnion('kind', [\n ServiceEffectDelaySchema,\n ServiceEffectNoServiceSchema,\n ServiceEffectReducedServiceSchema,\n ServiceEffectServiceHoursAdjustmentSchema,\n]);\nexport type ServiceEffect = z.infer<typeof ServiceEffectSchema>;\n"]}
1
+ {"version":3,"file":"serviceEffect.js","sourceRoot":"","sources":["../../../src/schema/issue/serviceEffect.ts"],"names":[],"mappings":"AAAA,OAAO,CAAC,MAAM,KAAK,CAAC;AAEpB,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,CAAC,IAAI,CAAC;IAC5C,OAAO;IACP,YAAY;IACZ,iBAAiB;IACjB,0BAA0B;CAC3B,CAAC,CAAC;AAGH,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC/C,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,uBAAuB,CAAC,IAAI,CAAC,KAAK,CAAC;IACnD,QAAQ,EAAE,CAAC,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAC,QAAQ,EAAE;CACtC,CAAC,CAAC;AAGH,MAAM,CAAC,MAAM,4BAA4B,GAAG,CAAC,CAAC,MAAM,CAAC;IACnD,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,uBAAuB,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;CAC5D,CAAC,CAAC;AAKH,MAAM,CAAC,MAAM,iCAAiC,GAAG,CAAC,CAAC,MAAM,CAAC;IACxD,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,uBAAuB,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC;CACjE,CAAC,CAAC;AAKH,MAAM,CAAC,MAAM,yCAAyC,GAAG,CAAC,CAAC,MAAM,CAAC;IAChE,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,uBAAuB,CAAC,IAAI,CAAC,0BAA0B,CAAC,CAAC;CAC1E,CAAC,CAAC;AAKH,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,CAAC,kBAAkB,CAAC,MAAM,EAAE;IAC9D,wBAAwB;IACxB,4BAA4B;IAC5B,iCAAiC;IACjC,yCAAyC;CAC1C,CAAC,CAAC"}
@@ -1,4 +1,10 @@
1
1
  import z from 'zod';
2
+ export declare const ServiceScopeTypeSchema: z.ZodEnum<{
3
+ "service.whole": "service.whole";
4
+ "service.segment": "service.segment";
5
+ "service.point": "service.point";
6
+ }>;
7
+ export type ServiceScopeType = z.infer<typeof ServiceScopeTypeSchema>;
2
8
  /**
3
9
  * Service Whole (service)
4
10
  */
@@ -1,9 +1,14 @@
1
1
  import z from 'zod';
2
+ export const ServiceScopeTypeSchema = z.enum([
3
+ 'service.whole',
4
+ 'service.segment',
5
+ 'service.point',
6
+ ]);
2
7
  /**
3
8
  * Service Whole (service)
4
9
  */
5
10
  export const ServiceScopeWholeSchema = z.object({
6
- type: z.literal('service.whole'),
11
+ type: z.literal(ServiceScopeTypeSchema.enum['service.whole']),
7
12
  });
8
13
  /**
9
14
  * Service segment (service-level)
@@ -11,7 +16,7 @@ export const ServiceScopeWholeSchema = z.object({
11
16
  * This should also be used when representing an entire service.
12
17
  */
13
18
  export const ServiceScopeSegmentSchema = z.object({
14
- type: z.literal('service.segment'),
19
+ type: z.literal(ServiceScopeTypeSchema.enum['service.segment']),
15
20
  fromStationId: z.string(),
16
21
  toStationId: z.string(),
17
22
  });
@@ -19,7 +24,7 @@ export const ServiceScopeSegmentSchema = z.object({
19
24
  * Service point (station-level)
20
25
  */
21
26
  export const ServiceScopePointSchema = z.object({
22
- type: z.literal('service.point'),
27
+ type: z.literal(ServiceScopeTypeSchema.enum['service.point']),
23
28
  stationId: z.string(),
24
29
  });
25
30
  export const ServiceScopeSchema = z.discriminatedUnion('type', [
@@ -1 +1 @@
1
- {"version":3,"file":"serviceScope.js","sourceRoot":"/","sources":["schema/issue/serviceScope.ts"],"names":[],"mappings":"AAAA,OAAO,CAAC,MAAM,KAAK,CAAC;AAEpB;;GAEG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC9C,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,eAAe,CAAC;CACjC,CAAC,CAAC;AAGH;;;;GAIG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAAG,CAAC,CAAC,MAAM,CAAC;IAChD,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,iBAAiB,CAAC;IAClC,aAAa,EAAE,CAAC,CAAC,MAAM,EAAE;IACzB,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE;CACxB,CAAC,CAAC;AAGH;;GAEG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC9C,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,eAAe,CAAC;IAChC,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE;CACtB,CAAC,CAAC;AAGH,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,CAAC,kBAAkB,CAAC,MAAM,EAAE;IAC7D,uBAAuB;IACvB,yBAAyB;IACzB,uBAAuB;CACxB,CAAC,CAAC","sourcesContent":["import z from 'zod';\n\n/**\n * Service Whole (service)\n */\nexport const ServiceScopeWholeSchema = z.object({\n type: z.literal('service.whole'),\n});\nexport type ServiceScopeWhole = z.infer<typeof ServiceScopeWholeSchema>;\n\n/**\n * Service segment (service-level)\n *\n * This should also be used when representing an entire service.\n */\nexport const ServiceScopeSegmentSchema = z.object({\n type: z.literal('service.segment'),\n fromStationId: z.string(),\n toStationId: z.string(),\n});\nexport type ServiceScopeSegment = z.infer<typeof ServiceScopeSegmentSchema>;\n\n/**\n * Service point (station-level)\n */\nexport const ServiceScopePointSchema = z.object({\n type: z.literal('service.point'),\n stationId: z.string(),\n});\nexport type ServiceScopePoint = z.infer<typeof ServiceScopePointSchema>;\n\nexport const ServiceScopeSchema = z.discriminatedUnion('type', [\n ServiceScopeWholeSchema,\n ServiceScopeSegmentSchema,\n ServiceScopePointSchema,\n]);\nexport type ServiceScope = z.infer<typeof ServiceScopeSchema>;\n"]}
1
+ {"version":3,"file":"serviceScope.js","sourceRoot":"","sources":["../../../src/schema/issue/serviceScope.ts"],"names":[],"mappings":"AAAA,OAAO,CAAC,MAAM,KAAK,CAAC;AAEpB,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,CAAC,IAAI,CAAC;IAC3C,eAAe;IACf,iBAAiB;IACjB,eAAe;CAChB,CAAC,CAAC;AAGH;;GAEG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC9C,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,sBAAsB,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;CAC9D,CAAC,CAAC;AAGH;;;;GAIG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAAG,CAAC,CAAC,MAAM,CAAC;IAChD,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,sBAAsB,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC;IAC/D,aAAa,EAAE,CAAC,CAAC,MAAM,EAAE;IACzB,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE;CACxB,CAAC,CAAC;AAGH;;GAEG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC9C,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,sBAAsB,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;IAC7D,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE;CACtB,CAAC,CAAC;AAGH,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,CAAC,kBAAkB,CAAC,MAAM,EAAE;IAC7D,uBAAuB;IACvB,yBAAyB;IACzB,uBAAuB;CACxB,CAAC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"assert.js","sourceRoot":"/","sources":["util/assert.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,MAAM,CACpB,SAAkB,EAClB,OAAO,GAAG,kBAAkB;IAE5B,IAAI,CAAC,SAAS,EAAE,CAAC;QACf,MAAM,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC;IAC3B,CAAC;AACH,CAAC","sourcesContent":["export function assert(\n condition: boolean,\n message = 'Assertion failed',\n): asserts condition {\n if (!condition) {\n throw new Error(message);\n }\n}\n"]}
1
+ {"version":3,"file":"assert.js","sourceRoot":"","sources":["../../src/util/assert.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,MAAM,CACpB,SAAkB,EAClB,OAAO,GAAG,kBAAkB;IAE5B,IAAI,CAAC,SAAS,EAAE,CAAC;QACf,MAAM,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC;IAC3B,CAAC;AACH,CAAC"}
package/package.json CHANGED
@@ -1,80 +1,40 @@
1
1
  {
2
2
  "name": "@mrtdown/core",
3
- "version": "2.0.0-alpha.1",
4
- "description": "Data repository",
5
- "type": "module",
6
- "main": "dist/api/index.js",
7
- "scripts": {
8
- "build": "tsc",
9
- "test": "vitest",
10
- "validate": "tsx src/cli/index.ts validate",
11
- "create": "tsx src/cli/index.ts create",
12
- "cli": "tsx src/cli/index.ts",
13
- "ingest:webhook": "tsx src/scripts/ingestViaWebhook.ts",
14
- "check-rss-feeds": "tsx src/scripts/checkRssFeeds.ts",
15
- "db:generate": "tsx src/db/generate/index.ts",
16
- "api:dev": "tsx --watch api/index.ts",
17
- "sentry:sourcemaps": "sentry-cli sourcemaps inject ./dist && sentry-cli sourcemaps upload ./dist --release $SENTRY_RELEASE"
3
+ "version": "2.0.0-alpha.11",
4
+ "description": "",
5
+ "homepage": "https://github.com/foldaway/mrtdown-data#readme",
6
+ "bugs": {
7
+ "url": "https://github.com/foldaway/mrtdown-data/issues"
18
8
  },
19
- "author": "Foldaway <bottleneck.company@gmail.com>",
20
9
  "repository": {
21
10
  "type": "git",
22
- "url": "https://github.com/mrtdown/mrtdown-data.git"
11
+ "url": "git+https://github.com/foldaway/mrtdown-data.git"
23
12
  },
24
13
  "license": "UNLICENSED",
25
- "devDependencies": {
26
- "@biomejs/biome": "2.3.14",
27
- "@types/luxon": "^3.4.2",
28
- "@types/node": "^22.13.4",
29
- "tsx": "^4.19.3",
30
- "typescript": "^5.8.3",
31
- "vitest": "^3.0.9",
32
- "vitest-evals": "^0.5.0"
33
- },
34
- "files": [
35
- "dist",
36
- "!dist/cli",
37
- "!dist/legacy",
38
- "!dist/llm",
39
- "!dist/scripts",
40
- "!dist/validators"
41
- ],
14
+ "author": "Foldaway <bottleneck.company@gmail.com>",
15
+ "type": "module",
16
+ "main": "dist/index.js",
42
17
  "exports": {
43
18
  ".": {
44
19
  "types": "./dist/index.d.ts",
45
20
  "import": "./dist/index.js"
46
21
  }
47
22
  },
23
+ "files": [
24
+ "dist"
25
+ ],
26
+ "scripts": {
27
+ "build": "tsc",
28
+ "test": "echo \"Error: no test specified\" && exit 1"
29
+ },
48
30
  "dependencies": {
49
- "@duckdb/node-api": "^1.4.3-r.2",
50
- "@hono/node-server": "^1.19.6",
51
- "@hono/standard-validator": "^0.1.4",
52
- "@hono/zod-validator": "^0.4.3",
53
- "@scalar/hono-api-reference": "^0.9.13",
54
- "@sentry/cli": "^2.58.0",
55
- "@sentry/node": "^10.27.0",
56
- "commander": "^14.0.3",
57
- "dotenv": "^16.4.7",
58
- "fuse.js": "^7.1.0",
59
- "generic-pool": "^3.9.0",
60
- "hast-util-from-html": "^2.0.3",
61
- "hast-util-to-mdast": "^10.1.2",
62
- "hono": "^4.11.4",
63
- "hono-openapi": "^0.5.0-rc.3",
64
- "json-nd": "^1.0.0",
65
- "luxon": "^3.5.0",
66
- "mdast-util-gfm": "^3.1.0",
67
- "mdast-util-to-markdown": "^2.1.2",
68
- "openai": "^5.16.0",
69
31
  "rrule-rust": "^2.0.2",
70
- "rss-parser": "^3.13.0",
71
- "ulid": "^3.0.2",
72
32
  "zod": "^4.0.14"
73
33
  },
74
- "overrides": {
75
- "zod": "^4.0.14"
76
- },
77
- "publishConfig": {
78
- "access": "public"
34
+ "devDependencies": {
35
+ "@biomejs/biome": "2.3.14",
36
+ "typescript": "^5.8.3",
37
+ "vitest": "^3.0.9",
38
+ "vitest-evals": "^0.5.0"
79
39
  }
80
40
  }
package/README.md DELETED
@@ -1,107 +0,0 @@
1
- # mrtdown-data
2
-
3
- A comprehensive data repository and API system that tracks Singapore's MRT (Mass Rapid Transit) service disruptions, maintenance, and infrastructure issues. Functions as a status monitoring system for Singapore's public transportation network.
4
-
5
- ## Tech Stack
6
-
7
- - **Backend**: Node.js + TypeScript, Hono API framework
8
- - **Database**: DuckDB with normalized relational schema
9
- - **Validation**: Zod schemas with OpenAPI integration
10
- - **Testing**: Vitest
11
- - **Linting**: Biome
12
-
13
- ## Quick Start
14
-
15
- ```bash
16
- # Install dependencies
17
- npm install
18
-
19
- # Build and generate database
20
- npm run build
21
-
22
- # Start development API server
23
- npm run api:dev # Runs on port 4000
24
-
25
- # Run tests
26
- npm test
27
-
28
- # Lint and format
29
- npx biome check
30
- ```
31
-
32
- ## Development Commands
33
-
34
- ### Database Operations
35
- ```bash
36
- npm run build # Compile TypeScript (auto-runs db:generate)
37
- npm run db:generate # Generate DuckDB database from source data
38
- ```
39
-
40
- ### API Development
41
- ```bash
42
- npm run api:dev # Start dev server on port 4000
43
- ```
44
-
45
- ### Data Processing
46
- ```bash
47
- npm run ingest:webhook # Process incoming webhook data
48
- ```
49
-
50
- ### Testing & Quality
51
- ```bash
52
- npm test # Run Vitest tests
53
- npx biome check # Lint and format code
54
- ```
55
-
56
- ### Database Queries
57
- ```bash
58
- # Query the database (use -readonly when API server is running)
59
- duckdb -readonly -c "SELECT * FROM issues LIMIT 10" mrtdown.duckdb
60
- ```
61
-
62
- ## Architecture Overview
63
-
64
- ### Core Data Models
65
- - **Lines**: MRT/LRT lines (NSL, EWL, CCL, etc.) with service schedules
66
- - **Issues**: Disruptions, maintenance, infrastructure problems with time intervals
67
- - **Stations**: Station information with multi-language support
68
- - **Time-aware**: All operations handle Singapore timezone (`Asia/Singapore`)
69
-
70
- ### API Structure
71
- Located in `/src/api/routes/`:
72
- - **Overview**: System-wide status and line summaries
73
- - **Lines**: Individual line profiles with detailed uptime metrics
74
- - **Issues**: Issue details and historical data
75
- - **Stations**: Station-specific information
76
- - **Analytics**: Statistical analysis endpoints
77
-
78
- All endpoints require Bearer token authentication except `/docs`.
79
-
80
- ### Data Flow
81
- 1. **Source data** (JSON files in `/data/source/`)
82
- 2. **Database generation** (DuckDB with complex analytics)
83
- 3. **API endpoints** (Real-time queries with multi-language support)
84
-
85
- ## Key Features
86
-
87
- - **Real-time Status Monitoring**: Track MRT line disruptions and maintenance
88
- - **Historical Analytics**: Complex uptime calculations and service metrics
89
- - **Multi-language Support**: Content available in 4 languages
90
- - **Time-zone Aware**: All operations in Singapore timezone
91
- - **Service Hours Logic**: Different schedules for weekdays/weekends/holidays
92
- - **Webhook Integration**: Real-time data ingestion capabilities
93
-
94
- ## Issue Data Structure
95
-
96
- - **File naming**: `YYYY-MM-DD-descriptive-slug.json`
97
- - **Types**: `disruption`, `maintenance`, `infra`
98
- - **Time intervals**: Start/end timestamps with timezone awareness
99
- - **Multi-language**: All titles have 4-language translations
100
-
101
- ## Development Notes
102
-
103
- - Database regeneration required when source data changes
104
- - API responses include related entities for client efficiency
105
- - Performance optimized for read-heavy analytical workloads
106
- - Extensive use of CTEs for complex uptime calculations
107
- - Proper handling of ongoing issues (end_at = NULL)
@@ -1,10 +0,0 @@
1
- export declare const DIR_ISSUE = "issue";
2
- export declare const DIR_LINE = "line";
3
- export declare const DIR_LANDMARK = "landmark";
4
- export declare const DIR_OPERATOR = "operator";
5
- export declare const DIR_SERVICE = "service";
6
- export declare const DIR_STATION = "station";
7
- export declare const DIR_TOWN = "town";
8
- export declare const FILE_ISSUE = "issue.json";
9
- export declare const FILE_ISSUE_EVIDENCE = "evidence.ndjson";
10
- export declare const FILE_ISSUE_IMPACT = "impact.ndjson";
package/dist/constants.js DELETED
@@ -1,11 +0,0 @@
1
- export const DIR_ISSUE = 'issue';
2
- export const DIR_LINE = 'line';
3
- export const DIR_LANDMARK = 'landmark';
4
- export const DIR_OPERATOR = 'operator';
5
- export const DIR_SERVICE = 'service';
6
- export const DIR_STATION = 'station';
7
- export const DIR_TOWN = 'town';
8
- export const FILE_ISSUE = 'issue.json';
9
- export const FILE_ISSUE_EVIDENCE = 'evidence.ndjson';
10
- export const FILE_ISSUE_IMPACT = 'impact.ndjson';
11
- //# sourceMappingURL=constants.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"constants.js","sourceRoot":"/","sources":["constants.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,SAAS,GAAG,OAAO,CAAC;AACjC,MAAM,CAAC,MAAM,QAAQ,GAAG,MAAM,CAAC;AAC/B,MAAM,CAAC,MAAM,YAAY,GAAG,UAAU,CAAC;AACvC,MAAM,CAAC,MAAM,YAAY,GAAG,UAAU,CAAC;AACvC,MAAM,CAAC,MAAM,WAAW,GAAG,SAAS,CAAC;AACrC,MAAM,CAAC,MAAM,WAAW,GAAG,SAAS,CAAC;AACrC,MAAM,CAAC,MAAM,QAAQ,GAAG,MAAM,CAAC;AAE/B,MAAM,CAAC,MAAM,UAAU,GAAG,YAAY,CAAC;AACvC,MAAM,CAAC,MAAM,mBAAmB,GAAG,iBAAiB,CAAC;AACrD,MAAM,CAAC,MAAM,iBAAiB,GAAG,eAAe,CAAC","sourcesContent":["export const DIR_ISSUE = 'issue';\nexport const DIR_LINE = 'line';\nexport const DIR_LANDMARK = 'landmark';\nexport const DIR_OPERATOR = 'operator';\nexport const DIR_SERVICE = 'service';\nexport const DIR_STATION = 'station';\nexport const DIR_TOWN = 'town';\n\nexport const FILE_ISSUE = 'issue.json';\nexport const FILE_ISSUE_EVIDENCE = 'evidence.ndjson';\nexport const FILE_ISSUE_IMPACT = 'impact.ndjson';\n"]}
@@ -1,2 +0,0 @@
1
- import { type DateTime, Duration } from 'luxon';
2
- export declare function calculateDurationWithinServiceHours(start: DateTime, end: DateTime): Duration;
@@ -1,13 +0,0 @@
1
- import { Duration, Interval } from 'luxon';
2
- import { assert } from '../util/assert.js';
3
- import { splitIntervalByServiceHours } from './splitIntervalByServiceHours.js';
4
- export function calculateDurationWithinServiceHours(start, end) {
5
- const interval = Interval.fromDateTimes(start, end);
6
- assert(interval.isValid);
7
- let result = Duration.fromObject({ seconds: 0 });
8
- for (const segment of splitIntervalByServiceHours(interval)) {
9
- result = result.plus(segment.toDuration());
10
- }
11
- return result;
12
- }
13
- //# sourceMappingURL=calculateDurationWithinServiceHours.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"calculateDurationWithinServiceHours.js","sourceRoot":"/","sources":["helpers/calculateDurationWithinServiceHours.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,QAAQ,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC1D,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAC3C,OAAO,EAAE,2BAA2B,EAAE,MAAM,kCAAkC,CAAC;AAE/E,MAAM,UAAU,mCAAmC,CACjD,KAAe,EACf,GAAa;IAEb,MAAM,QAAQ,GAAG,QAAQ,CAAC,aAAa,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;IACpD,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;IAEzB,IAAI,MAAM,GAAG,QAAQ,CAAC,UAAU,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC,CAAC;IAEjD,KAAK,MAAM,OAAO,IAAI,2BAA2B,CAAC,QAAQ,CAAC,EAAE,CAAC;QAC5D,MAAM,GAAG,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE,CAAC,CAAC;IAC7C,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC","sourcesContent":["import { type DateTime, Duration, Interval } from 'luxon';\nimport { assert } from '../util/assert.js';\nimport { splitIntervalByServiceHours } from './splitIntervalByServiceHours.js';\n\nexport function calculateDurationWithinServiceHours(\n start: DateTime,\n end: DateTime,\n): Duration {\n const interval = Interval.fromDateTimes(start, end);\n assert(interval.isValid);\n\n let result = Duration.fromObject({ seconds: 0 });\n\n for (const segment of splitIntervalByServiceHours(interval)) {\n result = result.plus(segment.toDuration());\n }\n\n return result;\n}\n"]}