@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.
- package/dist/helpers/normalizeRecurringPeriod.d.ts +1 -1
- package/dist/helpers/normalizeRecurringPeriod.js +1 -1
- package/dist/helpers/normalizeRecurringPeriod.js.map +1 -1
- package/dist/helpers/normalizeRecurringPeriod.test.js.map +1 -1
- package/dist/helpers/resolvePeriods.d.ts +20 -5
- package/dist/helpers/resolvePeriods.js +15 -1
- package/dist/helpers/resolvePeriods.js.map +1 -1
- package/dist/helpers/resolvePeriods.test.js.map +1 -1
- package/dist/index.d.ts +23 -18
- package/dist/index.js +23 -18
- package/dist/index.js.map +1 -1
- package/dist/schema/Landmark.js.map +1 -1
- package/dist/schema/Line.d.ts +6 -0
- package/dist/schema/Line.js +2 -1
- package/dist/schema/Line.js.map +1 -1
- package/dist/schema/Manifest.d.ts +13 -0
- package/dist/schema/Manifest.js +13 -0
- package/dist/schema/Manifest.js.map +1 -0
- package/dist/schema/Operator.js.map +1 -1
- package/dist/schema/Service.js.map +1 -1
- package/dist/schema/Station.d.ts +7 -0
- package/dist/schema/Station.js +7 -6
- package/dist/schema/Station.js.map +1 -1
- package/dist/schema/Town.js.map +1 -1
- package/dist/schema/common.d.ts +4 -0
- package/dist/schema/common.js +3 -0
- package/dist/schema/common.js.map +1 -1
- package/dist/schema/issue/bundle.js.map +1 -1
- package/dist/schema/issue/cause.js.map +1 -1
- package/dist/schema/issue/claim.js.map +1 -1
- package/dist/schema/issue/entity.d.ts +6 -0
- package/dist/schema/issue/entity.js +6 -1
- package/dist/schema/issue/entity.js.map +1 -1
- package/dist/schema/issue/evidence.d.ts +6 -0
- package/dist/schema/issue/evidence.js +9 -4
- package/dist/schema/issue/evidence.js.map +1 -1
- package/dist/schema/issue/facilityEffect.d.ts +5 -0
- package/dist/schema/issue/facilityEffect.js +6 -2
- package/dist/schema/issue/facilityEffect.js.map +1 -1
- package/dist/schema/issue/id.js.map +1 -1
- package/dist/schema/issue/impactEvent.js.map +1 -1
- package/dist/schema/issue/issue.js +2 -4
- package/dist/schema/issue/issue.js.map +1 -1
- package/dist/schema/issue/issueType.js.map +1 -1
- package/dist/schema/issue/period.js.map +1 -1
- package/dist/schema/issue/serviceEffect.d.ts +7 -0
- package/dist/schema/issue/serviceEffect.js +10 -4
- package/dist/schema/issue/serviceEffect.js.map +1 -1
- package/dist/schema/issue/serviceScope.d.ts +6 -0
- package/dist/schema/issue/serviceScope.js +8 -3
- package/dist/schema/issue/serviceScope.js.map +1 -1
- package/dist/util/assert.js.map +1 -1
- package/package.json +21 -61
- package/README.md +0 -107
- package/dist/constants.d.ts +0 -10
- package/dist/constants.js +0 -11
- package/dist/constants.js.map +0 -1
- package/dist/helpers/calculateDurationWithinServiceHours.d.ts +0 -2
- package/dist/helpers/calculateDurationWithinServiceHours.js +0 -13
- package/dist/helpers/calculateDurationWithinServiceHours.js.map +0 -1
- package/dist/helpers/calculateDurationWithinServiceHours.test.d.ts +0 -1
- package/dist/helpers/calculateDurationWithinServiceHours.test.js +0 -83
- package/dist/helpers/calculateDurationWithinServiceHours.test.js.map +0 -1
- package/dist/helpers/computeImpactFromEvidenceClaims.d.ts +0 -21
- package/dist/helpers/computeImpactFromEvidenceClaims.js +0 -293
- package/dist/helpers/computeImpactFromEvidenceClaims.js.map +0 -1
- package/dist/helpers/computeImpactFromEvidenceClaims.test.d.ts +0 -1
- package/dist/helpers/computeImpactFromEvidenceClaims.test.js +0 -544
- package/dist/helpers/computeImpactFromEvidenceClaims.test.js.map +0 -1
- package/dist/helpers/computeStartOfDaysWithinInterval.d.ts +0 -2
- package/dist/helpers/computeStartOfDaysWithinInterval.js +0 -15
- package/dist/helpers/computeStartOfDaysWithinInterval.js.map +0 -1
- package/dist/helpers/computeStartOfDaysWithinInterval.test.d.ts +0 -1
- package/dist/helpers/computeStartOfDaysWithinInterval.test.js +0 -126
- package/dist/helpers/computeStartOfDaysWithinInterval.test.js.map +0 -1
- package/dist/helpers/estimateOpenAICost.d.ts +0 -40
- package/dist/helpers/estimateOpenAICost.js +0 -55
- package/dist/helpers/estimateOpenAICost.js.map +0 -1
- package/dist/helpers/keyForAffectedEntity.d.ts +0 -7
- package/dist/helpers/keyForAffectedEntity.js +0 -14
- package/dist/helpers/keyForAffectedEntity.js.map +0 -1
- package/dist/helpers/splitIntervalByServiceHours.d.ts +0 -2
- package/dist/helpers/splitIntervalByServiceHours.js +0 -30
- package/dist/helpers/splitIntervalByServiceHours.js.map +0 -1
- package/dist/helpers/splitIntervalByServiceHours.test.d.ts +0 -1
- package/dist/helpers/splitIntervalByServiceHours.test.js +0 -152
- package/dist/helpers/splitIntervalByServiceHours.test.js.map +0 -1
- package/dist/helpers/sumIntervalDuration.d.ts +0 -2
- package/dist/helpers/sumIntervalDuration.js +0 -9
- package/dist/helpers/sumIntervalDuration.js.map +0 -1
- package/dist/repo/MRTDownRepository.d.ts +0 -23
- package/dist/repo/MRTDownRepository.js +0 -28
- package/dist/repo/MRTDownRepository.js.map +0 -1
- package/dist/repo/common/FileStore.d.ts +0 -12
- package/dist/repo/common/FileStore.js +0 -27
- package/dist/repo/common/FileStore.js.map +0 -1
- package/dist/repo/common/StandardRepository.d.ts +0 -32
- package/dist/repo/common/StandardRepository.js +0 -58
- package/dist/repo/common/StandardRepository.js.map +0 -1
- package/dist/repo/common/store.d.ts +0 -29
- package/dist/repo/common/store.js +0 -2
- package/dist/repo/common/store.js.map +0 -1
- package/dist/repo/issue/IssueRepository.d.ts +0 -36
- package/dist/repo/issue/IssueRepository.js +0 -177
- package/dist/repo/issue/IssueRepository.js.map +0 -1
- package/dist/repo/issue/helpers/deriveCurrentState.d.ts +0 -51
- package/dist/repo/issue/helpers/deriveCurrentState.js +0 -113
- package/dist/repo/issue/helpers/deriveCurrentState.js.map +0 -1
- package/dist/repo/issue/helpers/deriveCurrentState.test.d.ts +0 -1
- package/dist/repo/issue/helpers/deriveCurrentState.test.js +0 -477
- package/dist/repo/issue/helpers/deriveCurrentState.test.js.map +0 -1
- package/dist/repo/landmark/LandmarkRepository.d.ts +0 -7
- package/dist/repo/landmark/LandmarkRepository.js +0 -12
- package/dist/repo/landmark/LandmarkRepository.js.map +0 -1
- package/dist/repo/line/LineRepository.d.ts +0 -13
- package/dist/repo/line/LineRepository.js +0 -32
- package/dist/repo/line/LineRepository.js.map +0 -1
- package/dist/repo/operator/OperatorRepository.d.ts +0 -7
- package/dist/repo/operator/OperatorRepository.js +0 -12
- package/dist/repo/operator/OperatorRepository.js.map +0 -1
- package/dist/repo/service/ServiceRepository.d.ts +0 -19
- package/dist/repo/service/ServiceRepository.js +0 -39
- package/dist/repo/service/ServiceRepository.js.map +0 -1
- package/dist/repo/station/StationRepository.d.ts +0 -13
- package/dist/repo/station/StationRepository.js +0 -30
- package/dist/repo/station/StationRepository.js.map +0 -1
- package/dist/repo/town/TownRepository.d.ts +0 -7
- package/dist/repo/town/TownRepository.js +0 -12
- package/dist/repo/town/TownRepository.js.map +0 -1
- package/dist/util/ingestContent/helpers/getSlugDateTimeFromClaims.d.ts +0 -7
- package/dist/util/ingestContent/helpers/getSlugDateTimeFromClaims.js +0 -24
- package/dist/util/ingestContent/helpers/getSlugDateTimeFromClaims.js.map +0 -1
- package/dist/util/ingestContent/index.d.ts +0 -12
- package/dist/util/ingestContent/index.js +0 -171
- package/dist/util/ingestContent/index.js.map +0 -1
- package/dist/util/ingestContent/types.d.ts +0 -32
- package/dist/util/ingestContent/types.js +0 -2
- package/dist/util/ingestContent/types.js.map +0 -1
- package/dist/write/MRTDownWriter.d.ts +0 -27
- package/dist/write/MRTDownWriter.js +0 -27
- package/dist/write/MRTDownWriter.js.map +0 -1
- package/dist/write/common/FileWriteStore.d.ts +0 -13
- package/dist/write/common/FileWriteStore.js +0 -31
- package/dist/write/common/FileWriteStore.js.map +0 -1
- package/dist/write/common/StandardWriter.d.ts +0 -14
- package/dist/write/common/StandardWriter.js +0 -17
- package/dist/write/common/StandardWriter.js.map +0 -1
- package/dist/write/common/store.d.ts +0 -32
- package/dist/write/common/store.js +0 -2
- package/dist/write/common/store.js.map +0 -1
- package/dist/write/id/IdGenerator.d.ts +0 -18
- package/dist/write/id/IdGenerator.js +0 -23
- package/dist/write/id/IdGenerator.js.map +0 -1
- package/dist/write/issue/IssueWriter.d.ts +0 -12
- package/dist/write/issue/IssueWriter.js +0 -33
- 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:
|
|
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":"
|
|
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,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,CAA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+
"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 '
|
|
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":"ev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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":"
|
|
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":"
|
|
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":"
|
|
1
|
+
{"version":3,"file":"impactEvent.js","sourceRoot":"","sources":["../../../src/schema/issue/impactEvent.ts"],"names":[],"mappings":"AAAA,OAAO,CAAC,MAAM,KAA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C,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"}
|
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
import z from 'zod';
|
|
2
|
-
import { TranslationsSchema } from '
|
|
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:
|
|
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":"
|
|
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":"
|
|
1
|
+
{"version":3,"file":"issueType.js","sourceRoot":"","sources":["../../../src/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"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"period.js","sourceRoot":"
|
|
1
|
+
{"version":3,"file":"period.js","sourceRoot":"","sources":["../../../src/schema/issue/period.ts"],"names":[],"mappings":"AAAA,OAAO,CAAC,MAAM,KAAK,CAAC;AAEpB,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,CAAC,MAAM,CAAC;IACxC,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC;IACxB,OAAO,EAAE,CAAC,CAAC,GAAG,CAAC,QAAQ,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC;IACzC,KAAK,EAAE,CAAC,CAAC,GAAG,CAAC,QAAQ,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,QAAQ,EAAE;CACnD,CAAC,CAAC;AAGH,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,CAAC,IAAI,CAAC;IAC1C,OAAO;IACP,QAAQ;IACR,SAAS;IACT,QAAQ;CACT,CAAC,CAAC;AAGH,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC5C,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,WAAW,CAAC;IAC5B,SAAS,EAAE,qBAAqB;IAChC,OAAO,EAAE,CAAC,CAAC,GAAG,CAAC,QAAQ,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC;IACzC,KAAK,EAAE,CAAC,CAAC,GAAG,CAAC,QAAQ,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC;IACvC,UAAU,EAAE,CAAC;SACV,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC;SACzD,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"}
|
|
@@ -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(
|
|
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":"
|
|
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":"
|
|
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"}
|
package/dist/util/assert.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"assert.js","sourceRoot":"
|
|
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.
|
|
4
|
-
"description": "
|
|
5
|
-
"
|
|
6
|
-
"
|
|
7
|
-
|
|
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/
|
|
11
|
+
"url": "git+https://github.com/foldaway/mrtdown-data.git"
|
|
23
12
|
},
|
|
24
13
|
"license": "UNLICENSED",
|
|
25
|
-
"
|
|
26
|
-
|
|
27
|
-
|
|
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
|
-
"
|
|
75
|
-
"
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
"
|
|
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)
|
package/dist/constants.d.ts
DELETED
|
@@ -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
|
package/dist/constants.js.map
DELETED
|
@@ -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,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"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|