@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.
- package/README.md +107 -0
- package/dist/constants.d.ts +10 -0
- package/dist/constants.js +11 -0
- package/dist/constants.js.map +1 -0
- package/dist/helpers/calculateDurationWithinServiceHours.d.ts +2 -0
- package/dist/helpers/calculateDurationWithinServiceHours.js +13 -0
- package/dist/helpers/calculateDurationWithinServiceHours.js.map +1 -0
- package/dist/helpers/calculateDurationWithinServiceHours.test.d.ts +1 -0
- package/dist/helpers/calculateDurationWithinServiceHours.test.js +83 -0
- package/dist/helpers/calculateDurationWithinServiceHours.test.js.map +1 -0
- package/dist/helpers/computeImpactFromEvidenceClaims.d.ts +21 -0
- package/dist/helpers/computeImpactFromEvidenceClaims.js +293 -0
- package/dist/helpers/computeImpactFromEvidenceClaims.js.map +1 -0
- package/dist/helpers/computeImpactFromEvidenceClaims.test.d.ts +1 -0
- package/dist/helpers/computeImpactFromEvidenceClaims.test.js +544 -0
- package/dist/helpers/computeImpactFromEvidenceClaims.test.js.map +1 -0
- package/dist/helpers/computeStartOfDaysWithinInterval.d.ts +2 -0
- package/dist/helpers/computeStartOfDaysWithinInterval.js +15 -0
- package/dist/helpers/computeStartOfDaysWithinInterval.js.map +1 -0
- package/dist/helpers/computeStartOfDaysWithinInterval.test.d.ts +1 -0
- package/dist/helpers/computeStartOfDaysWithinInterval.test.js +126 -0
- package/dist/helpers/computeStartOfDaysWithinInterval.test.js.map +1 -0
- package/dist/helpers/estimateOpenAICost.d.ts +40 -0
- package/dist/helpers/estimateOpenAICost.js +55 -0
- package/dist/helpers/estimateOpenAICost.js.map +1 -0
- package/dist/helpers/keyForAffectedEntity.d.ts +7 -0
- package/dist/helpers/keyForAffectedEntity.js +14 -0
- package/dist/helpers/keyForAffectedEntity.js.map +1 -0
- package/dist/helpers/normalizeRecurringPeriod.d.ts +7 -0
- package/dist/helpers/normalizeRecurringPeriod.js +118 -0
- package/dist/helpers/normalizeRecurringPeriod.js.map +1 -0
- package/dist/helpers/normalizeRecurringPeriod.test.d.ts +1 -0
- package/dist/helpers/normalizeRecurringPeriod.test.js +93 -0
- package/dist/helpers/normalizeRecurringPeriod.test.js.map +1 -0
- package/dist/helpers/resolvePeriods.d.ts +224 -0
- package/dist/helpers/resolvePeriods.js +207 -0
- package/dist/helpers/resolvePeriods.js.map +1 -0
- package/dist/helpers/resolvePeriods.test.d.ts +1 -0
- package/dist/helpers/resolvePeriods.test.js +239 -0
- package/dist/helpers/resolvePeriods.test.js.map +1 -0
- package/dist/helpers/splitIntervalByServiceHours.d.ts +2 -0
- package/dist/helpers/splitIntervalByServiceHours.js +30 -0
- package/dist/helpers/splitIntervalByServiceHours.js.map +1 -0
- package/dist/helpers/splitIntervalByServiceHours.test.d.ts +1 -0
- package/dist/helpers/splitIntervalByServiceHours.test.js +152 -0
- package/dist/helpers/splitIntervalByServiceHours.test.js.map +1 -0
- package/dist/helpers/sumIntervalDuration.d.ts +2 -0
- package/dist/helpers/sumIntervalDuration.js +9 -0
- package/dist/helpers/sumIntervalDuration.js.map +1 -0
- package/dist/index.d.ts +18 -0
- package/dist/index.js +19 -0
- package/dist/index.js.map +1 -0
- package/dist/repo/MRTDownRepository.d.ts +23 -0
- package/dist/repo/MRTDownRepository.js +28 -0
- package/dist/repo/MRTDownRepository.js.map +1 -0
- package/dist/repo/common/FileStore.d.ts +12 -0
- package/dist/repo/common/FileStore.js +27 -0
- package/dist/repo/common/FileStore.js.map +1 -0
- package/dist/repo/common/StandardRepository.d.ts +32 -0
- package/dist/repo/common/StandardRepository.js +58 -0
- package/dist/repo/common/StandardRepository.js.map +1 -0
- package/dist/repo/common/store.d.ts +29 -0
- package/dist/repo/common/store.js +2 -0
- package/dist/repo/common/store.js.map +1 -0
- package/dist/repo/issue/IssueRepository.d.ts +36 -0
- package/dist/repo/issue/IssueRepository.js +177 -0
- package/dist/repo/issue/IssueRepository.js.map +1 -0
- package/dist/repo/issue/helpers/deriveCurrentState.d.ts +51 -0
- package/dist/repo/issue/helpers/deriveCurrentState.js +113 -0
- package/dist/repo/issue/helpers/deriveCurrentState.js.map +1 -0
- package/dist/repo/issue/helpers/deriveCurrentState.test.d.ts +1 -0
- package/dist/repo/issue/helpers/deriveCurrentState.test.js +477 -0
- package/dist/repo/issue/helpers/deriveCurrentState.test.js.map +1 -0
- package/dist/repo/landmark/LandmarkRepository.d.ts +7 -0
- package/dist/repo/landmark/LandmarkRepository.js +12 -0
- package/dist/repo/landmark/LandmarkRepository.js.map +1 -0
- package/dist/repo/line/LineRepository.d.ts +13 -0
- package/dist/repo/line/LineRepository.js +32 -0
- package/dist/repo/line/LineRepository.js.map +1 -0
- package/dist/repo/operator/OperatorRepository.d.ts +7 -0
- package/dist/repo/operator/OperatorRepository.js +12 -0
- package/dist/repo/operator/OperatorRepository.js.map +1 -0
- package/dist/repo/service/ServiceRepository.d.ts +19 -0
- package/dist/repo/service/ServiceRepository.js +39 -0
- package/dist/repo/service/ServiceRepository.js.map +1 -0
- package/dist/repo/station/StationRepository.d.ts +13 -0
- package/dist/repo/station/StationRepository.js +30 -0
- package/dist/repo/station/StationRepository.js.map +1 -0
- package/dist/repo/town/TownRepository.d.ts +7 -0
- package/dist/repo/town/TownRepository.js +12 -0
- package/dist/repo/town/TownRepository.js.map +1 -0
- package/dist/schema/Landmark.d.ts +11 -0
- package/dist/schema/Landmark.js +7 -0
- package/dist/schema/Landmark.js.map +1 -0
- package/dist/schema/Line.d.ts +58 -0
- package/dist/schema/Line.js +35 -0
- package/dist/schema/Line.js.map +1 -0
- package/dist/schema/Operator.d.ts +16 -0
- package/dist/schema/Operator.js +12 -0
- package/dist/schema/Operator.js.map +1 -0
- package/dist/schema/Service.d.ts +55 -0
- package/dist/schema/Service.js +24 -0
- package/dist/schema/Service.js.map +1 -0
- package/dist/schema/Station.d.ts +29 -0
- package/dist/schema/Station.js +25 -0
- package/dist/schema/Station.js.map +1 -0
- package/dist/schema/Town.d.ts +11 -0
- package/dist/schema/Town.js +7 -0
- package/dist/schema/Town.js.map +1 -0
- package/dist/schema/common.d.ts +24 -0
- package/dist/schema/common.js +23 -0
- package/dist/schema/common.js.map +1 -0
- package/dist/schema/issue/bundle.d.ts +239 -0
- package/dist/schema/issue/bundle.js +11 -0
- package/dist/schema/issue/bundle.js.map +1 -0
- package/dist/schema/issue/cause.d.ts +51 -0
- package/dist/schema/issue/cause.js +30 -0
- package/dist/schema/issue/cause.js.map +1 -0
- package/dist/schema/issue/claim.d.ts +149 -0
- package/dist/schema/issue/claim.js +36 -0
- package/dist/schema/issue/claim.js.map +1 -0
- package/dist/schema/issue/entity.d.ts +176 -0
- package/dist/schema/issue/entity.js +35 -0
- package/dist/schema/issue/entity.js.map +1 -0
- package/dist/schema/issue/evidence.d.ts +124 -0
- package/dist/schema/issue/evidence.js +30 -0
- package/dist/schema/issue/evidence.js.map +1 -0
- package/dist/schema/issue/facilityEffect.d.ts +15 -0
- package/dist/schema/issue/facilityEffect.js +12 -0
- package/dist/schema/issue/facilityEffect.js.map +1 -0
- package/dist/schema/issue/id.d.ts +3 -0
- package/dist/schema/issue/id.js +6 -0
- package/dist/schema/issue/id.js.map +1 -0
- package/dist/schema/issue/impactEvent.d.ts +373 -0
- package/dist/schema/issue/impactEvent.js +43 -0
- package/dist/schema/issue/impactEvent.js.map +1 -0
- package/dist/schema/issue/issue.d.ts +19 -0
- package/dist/schema/issue/issue.js +13 -0
- package/dist/schema/issue/issue.js.map +1 -0
- package/dist/schema/issue/issueType.d.ts +7 -0
- package/dist/schema/issue/issueType.js +3 -0
- package/dist/schema/issue/issueType.js.map +1 -0
- package/dist/schema/issue/period.d.ts +72 -0
- package/dist/schema/issue/period.js +32 -0
- package/dist/schema/issue/period.js.map +1 -0
- package/dist/schema/issue/serviceEffect.d.ts +29 -0
- package/dist/schema/issue/serviceEffect.js +21 -0
- package/dist/schema/issue/serviceEffect.js.map +1 -0
- package/dist/schema/issue/serviceScope.d.ts +38 -0
- package/dist/schema/issue/serviceScope.js +30 -0
- package/dist/schema/issue/serviceScope.js.map +1 -0
- package/dist/util/assert.d.ts +1 -0
- package/dist/util/assert.js +6 -0
- package/dist/util/assert.js.map +1 -0
- package/dist/util/ingestContent/helpers/getSlugDateTimeFromClaims.d.ts +7 -0
- package/dist/util/ingestContent/helpers/getSlugDateTimeFromClaims.js +24 -0
- package/dist/util/ingestContent/helpers/getSlugDateTimeFromClaims.js.map +1 -0
- package/dist/util/ingestContent/index.d.ts +12 -0
- package/dist/util/ingestContent/index.js +171 -0
- package/dist/util/ingestContent/index.js.map +1 -0
- package/dist/util/ingestContent/types.d.ts +32 -0
- package/dist/util/ingestContent/types.js +2 -0
- package/dist/util/ingestContent/types.js.map +1 -0
- package/dist/write/MRTDownWriter.d.ts +27 -0
- package/dist/write/MRTDownWriter.js +27 -0
- package/dist/write/MRTDownWriter.js.map +1 -0
- package/dist/write/common/FileWriteStore.d.ts +13 -0
- package/dist/write/common/FileWriteStore.js +31 -0
- package/dist/write/common/FileWriteStore.js.map +1 -0
- package/dist/write/common/StandardWriter.d.ts +14 -0
- package/dist/write/common/StandardWriter.js +17 -0
- package/dist/write/common/StandardWriter.js.map +1 -0
- package/dist/write/common/store.d.ts +32 -0
- package/dist/write/common/store.js +2 -0
- package/dist/write/common/store.js.map +1 -0
- package/dist/write/id/IdGenerator.d.ts +18 -0
- package/dist/write/id/IdGenerator.js +23 -0
- package/dist/write/id/IdGenerator.js.map +1 -0
- package/dist/write/issue/IssueWriter.d.ts +12 -0
- package/dist/write/issue/IssueWriter.js +33 -0
- package/dist/write/issue/IssueWriter.js.map +1 -0
- package/package.json +80 -0
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { type Service } from '../../schema/Service.js';
|
|
2
|
+
import { StandardRepository } from '../common/StandardRepository.js';
|
|
3
|
+
import type { IStore } from '../common/store.js';
|
|
4
|
+
export declare class ServiceRepository extends StandardRepository<Service> {
|
|
5
|
+
constructor(store: IStore);
|
|
6
|
+
protected parseItem(json: unknown): Service;
|
|
7
|
+
/**
|
|
8
|
+
* Search services by name.
|
|
9
|
+
* @param names
|
|
10
|
+
* @returns
|
|
11
|
+
*/
|
|
12
|
+
searchByName(names: string[]): Service[];
|
|
13
|
+
/**
|
|
14
|
+
* Search services by line ID.
|
|
15
|
+
* @param lineId
|
|
16
|
+
* @returns
|
|
17
|
+
*/
|
|
18
|
+
searchByLineId(lineId: string): Service[];
|
|
19
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import Fuse from 'fuse.js';
|
|
2
|
+
import { DIR_SERVICE } from '../../constants.js';
|
|
3
|
+
import { ServiceSchema } from '../../schema/Service.js';
|
|
4
|
+
import { StandardRepository } from '../common/StandardRepository.js';
|
|
5
|
+
export class ServiceRepository extends StandardRepository {
|
|
6
|
+
constructor(store) {
|
|
7
|
+
super(store, DIR_SERVICE);
|
|
8
|
+
}
|
|
9
|
+
parseItem(json) {
|
|
10
|
+
return ServiceSchema.parse(json);
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Search services by name.
|
|
14
|
+
* @param names
|
|
15
|
+
* @returns
|
|
16
|
+
*/
|
|
17
|
+
searchByName(names) {
|
|
18
|
+
this.loadAll();
|
|
19
|
+
const fuse = new Fuse(Array.from(this.byId.values()), {
|
|
20
|
+
keys: ['id', 'name.en-SG'],
|
|
21
|
+
includeScore: true,
|
|
22
|
+
threshold: 0.3,
|
|
23
|
+
});
|
|
24
|
+
const results = fuse.search({
|
|
25
|
+
$or: names.flatMap((name) => [{ id: name }, { 'name.en-SG': name }]),
|
|
26
|
+
});
|
|
27
|
+
return results.map((r) => r.item);
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Search services by line ID.
|
|
31
|
+
* @param lineId
|
|
32
|
+
* @returns
|
|
33
|
+
*/
|
|
34
|
+
searchByLineId(lineId) {
|
|
35
|
+
this.loadAll();
|
|
36
|
+
return Array.from(this.byId.values()).filter((s) => s.lineId === lineId);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
//# sourceMappingURL=ServiceRepository.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ServiceRepository.js","sourceRoot":"/","sources":["repo/service/ServiceRepository.ts"],"names":[],"mappings":"AAAA,OAAO,IAAyB,MAAM,SAAS,CAAC;AAChD,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAgB,aAAa,EAAE,MAAM,yBAAyB,CAAC;AACtE,OAAO,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAC;AAGrE,MAAM,OAAO,iBAAkB,SAAQ,kBAA2B;IAChE,YAAY,KAAa;QACvB,KAAK,CAAC,KAAK,EAAE,WAAW,CAAC,CAAC;IAC5B,CAAC;IAES,SAAS,CAAC,IAAa;QAC/B,OAAO,aAAa,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IACnC,CAAC;IAED;;;;OAIG;IACH,YAAY,CAAC,KAAe;QAC1B,IAAI,CAAC,OAAO,EAAE,CAAC;QACf,MAAM,IAAI,GAAG,IAAI,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC,EAAE;YACpD,IAAI,EAAE,CAAC,IAAI,EAAE,YAAY,CAAC;YAC1B,YAAY,EAAE,IAAI;YAClB,SAAS,EAAE,GAAG;SACf,CAAC,CAAC;QACH,MAAM,OAAO,GAAG,IAAI,CAAC,MAAM,CAAC;YAC1B,GAAG,EAAE,KAAK,CAAC,OAAO,CAChB,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,EAAE,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE,YAAY,EAAE,IAAI,EAAE,CAAiB,CACjE;SACF,CAAC,CAAC;QACH,OAAO,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;IACpC,CAAC;IAED;;;;OAIG;IACH,cAAc,CAAC,MAAc;QAC3B,IAAI,CAAC,OAAO,EAAE,CAAC;QACf,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,KAAK,MAAM,CAAC,CAAC;IAC3E,CAAC;CACF","sourcesContent":["import Fuse, { type Expression } from 'fuse.js';\nimport { DIR_SERVICE } from '../../constants.js';\nimport { type Service, ServiceSchema } from '../../schema/Service.js';\nimport { StandardRepository } from '../common/StandardRepository.js';\nimport type { IStore } from '../common/store.js';\n\nexport class ServiceRepository extends StandardRepository<Service> {\n constructor(store: IStore) {\n super(store, DIR_SERVICE);\n }\n\n protected parseItem(json: unknown): Service {\n return ServiceSchema.parse(json);\n }\n\n /**\n * Search services by name.\n * @param names\n * @returns\n */\n searchByName(names: string[]): Service[] {\n this.loadAll();\n const fuse = new Fuse(Array.from(this.byId.values()), {\n keys: ['id', 'name.en-SG'],\n includeScore: true,\n threshold: 0.3,\n });\n const results = fuse.search({\n $or: names.flatMap(\n (name) => [{ id: name }, { 'name.en-SG': name }] as Expression[],\n ),\n });\n return results.map((r) => r.item);\n }\n\n /**\n * Search services by line ID.\n * @param lineId\n * @returns\n */\n searchByLineId(lineId: string): Service[] {\n this.loadAll();\n return Array.from(this.byId.values()).filter((s) => s.lineId === lineId);\n }\n}\n"]}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { type Station } from '../../schema/Station.js';
|
|
2
|
+
import { StandardRepository } from '../common/StandardRepository.js';
|
|
3
|
+
import type { IStore } from '../common/store.js';
|
|
4
|
+
export declare class StationRepository extends StandardRepository<Station> {
|
|
5
|
+
constructor(store: IStore);
|
|
6
|
+
protected parseItem(json: unknown): Station;
|
|
7
|
+
/**
|
|
8
|
+
* Search stations by name.
|
|
9
|
+
* @param names
|
|
10
|
+
* @returns
|
|
11
|
+
*/
|
|
12
|
+
searchByName(names: string[]): Station[];
|
|
13
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import Fuse from 'fuse.js';
|
|
2
|
+
import { DIR_STATION } from '../../constants.js';
|
|
3
|
+
import { StationSchema } from '../../schema/Station.js';
|
|
4
|
+
import { StandardRepository } from '../common/StandardRepository.js';
|
|
5
|
+
export class StationRepository extends StandardRepository {
|
|
6
|
+
constructor(store) {
|
|
7
|
+
super(store, DIR_STATION);
|
|
8
|
+
}
|
|
9
|
+
parseItem(json) {
|
|
10
|
+
return StationSchema.parse(json);
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Search stations by name.
|
|
14
|
+
* @param names
|
|
15
|
+
* @returns
|
|
16
|
+
*/
|
|
17
|
+
searchByName(names) {
|
|
18
|
+
this.loadAll();
|
|
19
|
+
const fuse = new Fuse(Array.from(this.byId.values()), {
|
|
20
|
+
keys: ['id', 'name.en-SG'],
|
|
21
|
+
includeScore: true,
|
|
22
|
+
threshold: 0.2,
|
|
23
|
+
});
|
|
24
|
+
const results = fuse.search({
|
|
25
|
+
$or: names.flatMap((name) => [{ id: name }, { 'name.en-SG': name }]),
|
|
26
|
+
});
|
|
27
|
+
return results.map((r) => r.item);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=StationRepository.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"StationRepository.js","sourceRoot":"/","sources":["repo/station/StationRepository.ts"],"names":[],"mappings":"AAAA,OAAO,IAAyB,MAAM,SAAS,CAAC;AAChD,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAgB,aAAa,EAAE,MAAM,yBAAyB,CAAC;AACtE,OAAO,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAC;AAGrE,MAAM,OAAO,iBAAkB,SAAQ,kBAA2B;IAChE,YAAY,KAAa;QACvB,KAAK,CAAC,KAAK,EAAE,WAAW,CAAC,CAAC;IAC5B,CAAC;IAES,SAAS,CAAC,IAAa;QAC/B,OAAO,aAAa,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IACnC,CAAC;IAED;;;;OAIG;IACH,YAAY,CAAC,KAAe;QAC1B,IAAI,CAAC,OAAO,EAAE,CAAC;QACf,MAAM,IAAI,GAAG,IAAI,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC,EAAE;YACpD,IAAI,EAAE,CAAC,IAAI,EAAE,YAAY,CAAC;YAC1B,YAAY,EAAE,IAAI;YAClB,SAAS,EAAE,GAAG;SACf,CAAC,CAAC;QACH,MAAM,OAAO,GAAG,IAAI,CAAC,MAAM,CAAC;YAC1B,GAAG,EAAE,KAAK,CAAC,OAAO,CAChB,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,EAAE,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE,YAAY,EAAE,IAAI,EAAE,CAAiB,CACjE;SACF,CAAC,CAAC;QACH,OAAO,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;IACpC,CAAC;CACF","sourcesContent":["import Fuse, { type Expression } from 'fuse.js';\nimport { DIR_STATION } from '../../constants.js';\nimport { type Station, StationSchema } from '../../schema/Station.js';\nimport { StandardRepository } from '../common/StandardRepository.js';\nimport type { IStore } from '../common/store.js';\n\nexport class StationRepository extends StandardRepository<Station> {\n constructor(store: IStore) {\n super(store, DIR_STATION);\n }\n\n protected parseItem(json: unknown): Station {\n return StationSchema.parse(json);\n }\n\n /**\n * Search stations by name.\n * @param names\n * @returns\n */\n searchByName(names: string[]): Station[] {\n this.loadAll();\n const fuse = new Fuse(Array.from(this.byId.values()), {\n keys: ['id', 'name.en-SG'],\n includeScore: true,\n threshold: 0.2,\n });\n const results = fuse.search({\n $or: names.flatMap(\n (name) => [{ id: name }, { 'name.en-SG': name }] as Expression[],\n ),\n });\n return results.map((r) => r.item);\n }\n}\n"]}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { type Town } from '../../schema/Town.js';
|
|
2
|
+
import { StandardRepository } from '../common/StandardRepository.js';
|
|
3
|
+
import type { IStore } from '../common/store.js';
|
|
4
|
+
export declare class TownRepository extends StandardRepository<Town> {
|
|
5
|
+
constructor(store: IStore);
|
|
6
|
+
protected parseItem(json: unknown): Town;
|
|
7
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { DIR_TOWN } from '../../constants.js';
|
|
2
|
+
import { TownSchema } from '../../schema/Town.js';
|
|
3
|
+
import { StandardRepository } from '../common/StandardRepository.js';
|
|
4
|
+
export class TownRepository extends StandardRepository {
|
|
5
|
+
constructor(store) {
|
|
6
|
+
super(store, DIR_TOWN);
|
|
7
|
+
}
|
|
8
|
+
parseItem(json) {
|
|
9
|
+
return TownSchema.parse(json);
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=TownRepository.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TownRepository.js","sourceRoot":"/","sources":["repo/town/TownRepository.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAa,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAC7D,OAAO,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAC;AAGrE,MAAM,OAAO,cAAe,SAAQ,kBAAwB;IAC1D,YAAY,KAAa;QACvB,KAAK,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;IACzB,CAAC;IAES,SAAS,CAAC,IAAa;QAC/B,OAAO,UAAU,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAChC,CAAC;CACF","sourcesContent":["import { DIR_TOWN } from '../../constants.js';\nimport { type Town, TownSchema } from '../../schema/Town.js';\nimport { StandardRepository } from '../common/StandardRepository.js';\nimport type { IStore } from '../common/store.js';\n\nexport class TownRepository extends StandardRepository<Town> {\n constructor(store: IStore) {\n super(store, DIR_TOWN);\n }\n\n protected parseItem(json: unknown): Town {\n return TownSchema.parse(json);\n }\n}\n"]}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import z from 'zod';
|
|
2
|
+
export declare const LandmarkSchema: z.ZodObject<{
|
|
3
|
+
id: z.ZodString;
|
|
4
|
+
name: z.ZodObject<{
|
|
5
|
+
'en-SG': z.ZodString;
|
|
6
|
+
'zh-Hans': z.ZodNullable<z.ZodString>;
|
|
7
|
+
ms: z.ZodNullable<z.ZodString>;
|
|
8
|
+
ta: z.ZodNullable<z.ZodString>;
|
|
9
|
+
}, z.z.core.$strip>;
|
|
10
|
+
}, z.z.core.$strip>;
|
|
11
|
+
export type Landmark = z.infer<typeof LandmarkSchema>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Landmark.js","sourceRoot":"/","sources":["schema/Landmark.ts"],"names":[],"mappings":"AAAA,OAAO,CAAC,MAAM,KAAK,CAAC;AACpB,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAEjD,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,CAAC,MAAM,CAAC;IACrC,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE;IACd,IAAI,EAAE,kBAAkB;CACzB,CAAC,CAAC","sourcesContent":["import z from 'zod';\nimport { TranslationsSchema } from './common.js';\n\nexport const LandmarkSchema = z.object({\n id: z.string(),\n name: TranslationsSchema,\n});\nexport type Landmark = z.infer<typeof LandmarkSchema>;\n"]}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import z from 'zod';
|
|
2
|
+
/**
|
|
3
|
+
* Line operator
|
|
4
|
+
*/
|
|
5
|
+
export declare const LineOperatorSchema: z.ZodObject<{
|
|
6
|
+
operatorId: z.ZodString;
|
|
7
|
+
startedAt: z.ZodNullable<z.ZodString>;
|
|
8
|
+
endedAt: z.ZodNullable<z.ZodString>;
|
|
9
|
+
}, z.z.core.$strip>;
|
|
10
|
+
export type LineOperator = z.infer<typeof LineOperatorSchema>;
|
|
11
|
+
/**
|
|
12
|
+
* Operating hours for weekday/weekend service windows.
|
|
13
|
+
* Used by API uptime calculations.
|
|
14
|
+
*/
|
|
15
|
+
export declare const LineOperatingHoursSchema: z.ZodObject<{
|
|
16
|
+
weekdays: z.ZodObject<{
|
|
17
|
+
start: z.ZodString;
|
|
18
|
+
end: z.ZodString;
|
|
19
|
+
}, z.z.core.$strip>;
|
|
20
|
+
weekends: z.ZodObject<{
|
|
21
|
+
start: z.ZodString;
|
|
22
|
+
end: z.ZodString;
|
|
23
|
+
}, z.z.core.$strip>;
|
|
24
|
+
}, z.z.core.$strip>;
|
|
25
|
+
export type LineOperatingHours = z.infer<typeof LineOperatingHoursSchema>;
|
|
26
|
+
export declare const LineSchema: z.ZodObject<{
|
|
27
|
+
id: z.ZodString;
|
|
28
|
+
name: z.ZodObject<{
|
|
29
|
+
'en-SG': z.ZodString;
|
|
30
|
+
'zh-Hans': z.ZodNullable<z.ZodString>;
|
|
31
|
+
ms: z.ZodNullable<z.ZodString>;
|
|
32
|
+
ta: z.ZodNullable<z.ZodString>;
|
|
33
|
+
}, z.z.core.$strip>;
|
|
34
|
+
type: z.ZodEnum<{
|
|
35
|
+
"mrt.high": "mrt.high";
|
|
36
|
+
"mrt.medium": "mrt.medium";
|
|
37
|
+
lrt: "lrt";
|
|
38
|
+
}>;
|
|
39
|
+
color: z.ZodString;
|
|
40
|
+
startedAt: z.ZodNullable<z.z.ZodISODate>;
|
|
41
|
+
serviceIds: z.ZodArray<z.ZodString>;
|
|
42
|
+
operators: z.ZodArray<z.ZodObject<{
|
|
43
|
+
operatorId: z.ZodString;
|
|
44
|
+
startedAt: z.ZodNullable<z.ZodString>;
|
|
45
|
+
endedAt: z.ZodNullable<z.ZodString>;
|
|
46
|
+
}, z.z.core.$strip>>;
|
|
47
|
+
operatingHours: z.ZodOptional<z.ZodObject<{
|
|
48
|
+
weekdays: z.ZodObject<{
|
|
49
|
+
start: z.ZodString;
|
|
50
|
+
end: z.ZodString;
|
|
51
|
+
}, z.z.core.$strip>;
|
|
52
|
+
weekends: z.ZodObject<{
|
|
53
|
+
start: z.ZodString;
|
|
54
|
+
end: z.ZodString;
|
|
55
|
+
}, z.z.core.$strip>;
|
|
56
|
+
}, z.z.core.$strip>>;
|
|
57
|
+
}, z.z.core.$strip>;
|
|
58
|
+
export type Line = z.infer<typeof LineSchema>;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import z from 'zod';
|
|
2
|
+
import { TranslationsSchema } from './common.js';
|
|
3
|
+
/**
|
|
4
|
+
* Line operator
|
|
5
|
+
*/
|
|
6
|
+
export const LineOperatorSchema = z.object({
|
|
7
|
+
operatorId: z.string(),
|
|
8
|
+
startedAt: z.string().nullable(),
|
|
9
|
+
endedAt: z.string().nullable(),
|
|
10
|
+
});
|
|
11
|
+
/**
|
|
12
|
+
* Operating hours for weekday/weekend service windows.
|
|
13
|
+
* Used by API uptime calculations.
|
|
14
|
+
*/
|
|
15
|
+
export const LineOperatingHoursSchema = z.object({
|
|
16
|
+
weekdays: z.object({
|
|
17
|
+
start: z.string(), // HH:mm
|
|
18
|
+
end: z.string(),
|
|
19
|
+
}),
|
|
20
|
+
weekends: z.object({
|
|
21
|
+
start: z.string(),
|
|
22
|
+
end: z.string(),
|
|
23
|
+
}),
|
|
24
|
+
});
|
|
25
|
+
export const LineSchema = z.object({
|
|
26
|
+
id: z.string(),
|
|
27
|
+
name: TranslationsSchema,
|
|
28
|
+
type: z.enum(['mrt.high', 'mrt.medium', 'lrt']),
|
|
29
|
+
color: z.string(),
|
|
30
|
+
startedAt: z.iso.date().nullable(),
|
|
31
|
+
serviceIds: z.array(z.string()),
|
|
32
|
+
operators: z.array(LineOperatorSchema),
|
|
33
|
+
operatingHours: LineOperatingHoursSchema.optional(),
|
|
34
|
+
});
|
|
35
|
+
//# sourceMappingURL=Line.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Line.js","sourceRoot":"/","sources":["schema/Line.ts"],"names":[],"mappings":"AAAA,OAAO,CAAC,MAAM,KAAK,CAAC;AACpB,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAEjD;;GAEG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,CAAC,MAAM,CAAC;IACzC,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE;IACtB,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAChC,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;CAC/B,CAAC,CAAC;AAGH;;;GAGG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC/C,QAAQ,EAAE,CAAC,CAAC,MAAM,CAAC;QACjB,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,EAAE,QAAQ;QAC3B,GAAG,EAAE,CAAC,CAAC,MAAM,EAAE;KAChB,CAAC;IACF,QAAQ,EAAE,CAAC,CAAC,MAAM,CAAC;QACjB,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE;QACjB,GAAG,EAAE,CAAC,CAAC,MAAM,EAAE;KAChB,CAAC;CACH,CAAC,CAAC;AAGH,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,CAAC,MAAM,CAAC;IACjC,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE;IACd,IAAI,EAAE,kBAAkB;IACxB,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,UAAU,EAAE,YAAY,EAAE,KAAK,CAAC,CAAC;IAC/C,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE;IACjB,SAAS,EAAE,CAAC,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC,QAAQ,EAAE;IAClC,UAAU,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;IAC/B,SAAS,EAAE,CAAC,CAAC,KAAK,CAAC,kBAAkB,CAAC;IACtC,cAAc,EAAE,wBAAwB,CAAC,QAAQ,EAAE;CACpD,CAAC,CAAC","sourcesContent":["import z from 'zod';\nimport { TranslationsSchema } from './common.js';\n\n/**\n * Line operator\n */\nexport const LineOperatorSchema = z.object({\n operatorId: z.string(),\n startedAt: z.string().nullable(),\n endedAt: z.string().nullable(),\n});\nexport type LineOperator = z.infer<typeof LineOperatorSchema>;\n\n/**\n * Operating hours for weekday/weekend service windows.\n * Used by API uptime calculations.\n */\nexport const LineOperatingHoursSchema = z.object({\n weekdays: z.object({\n start: z.string(), // HH:mm\n end: z.string(),\n }),\n weekends: z.object({\n start: z.string(),\n end: z.string(),\n }),\n});\nexport type LineOperatingHours = z.infer<typeof LineOperatingHoursSchema>;\n\nexport const LineSchema = z.object({\n id: z.string(),\n name: TranslationsSchema,\n type: z.enum(['mrt.high', 'mrt.medium', 'lrt']),\n color: z.string(),\n startedAt: z.iso.date().nullable(),\n serviceIds: z.array(z.string()),\n operators: z.array(LineOperatorSchema),\n operatingHours: LineOperatingHoursSchema.optional(),\n});\nexport type Line = z.infer<typeof LineSchema>;\n"]}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import z from 'zod';
|
|
2
|
+
/**
|
|
3
|
+
* Operator
|
|
4
|
+
*/
|
|
5
|
+
export declare const OperatorSchema: z.ZodObject<{
|
|
6
|
+
id: z.ZodString;
|
|
7
|
+
name: z.ZodObject<{
|
|
8
|
+
'en-SG': z.ZodString;
|
|
9
|
+
'zh-Hans': z.ZodNullable<z.ZodString>;
|
|
10
|
+
ms: z.ZodNullable<z.ZodString>;
|
|
11
|
+
ta: z.ZodNullable<z.ZodString>;
|
|
12
|
+
}, z.z.core.$strip>;
|
|
13
|
+
foundedAt: z.z.ZodISODate;
|
|
14
|
+
url: z.ZodNullable<z.ZodURL>;
|
|
15
|
+
}, z.z.core.$strip>;
|
|
16
|
+
export type Operator = z.infer<typeof OperatorSchema>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import z from 'zod';
|
|
2
|
+
import { TranslationsSchema } from './common.js';
|
|
3
|
+
/**
|
|
4
|
+
* Operator
|
|
5
|
+
*/
|
|
6
|
+
export const OperatorSchema = z.object({
|
|
7
|
+
id: z.string(),
|
|
8
|
+
name: TranslationsSchema,
|
|
9
|
+
foundedAt: z.iso.date(),
|
|
10
|
+
url: z.url().nullable(),
|
|
11
|
+
});
|
|
12
|
+
//# sourceMappingURL=Operator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Operator.js","sourceRoot":"/","sources":["schema/Operator.ts"],"names":[],"mappings":"AAAA,OAAO,CAAC,MAAM,KAAK,CAAC;AACpB,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAEjD;;GAEG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,CAAC,MAAM,CAAC;IACrC,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE;IACd,IAAI,EAAE,kBAAkB;IACxB,SAAS,EAAE,CAAC,CAAC,GAAG,CAAC,IAAI,EAAE;IACvB,GAAG,EAAE,CAAC,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE;CACxB,CAAC,CAAC","sourcesContent":["import z from 'zod';\nimport { TranslationsSchema } from './common.js';\n\n/**\n * Operator\n */\nexport const OperatorSchema = z.object({\n id: z.string(),\n name: TranslationsSchema,\n foundedAt: z.iso.date(),\n url: z.url().nullable(),\n});\nexport type Operator = z.infer<typeof OperatorSchema>;\n"]}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import z from 'zod';
|
|
2
|
+
export declare const ServiceRevisionSchema: z.ZodObject<{
|
|
3
|
+
id: z.ZodString;
|
|
4
|
+
startAt: z.ZodString;
|
|
5
|
+
endAt: z.ZodNullable<z.ZodString>;
|
|
6
|
+
path: z.ZodObject<{
|
|
7
|
+
stations: z.ZodArray<z.ZodObject<{
|
|
8
|
+
stationId: z.ZodString;
|
|
9
|
+
displayCode: z.ZodString;
|
|
10
|
+
}, z.z.core.$strip>>;
|
|
11
|
+
}, z.z.core.$strip>;
|
|
12
|
+
operatingHours: z.ZodObject<{
|
|
13
|
+
weekdays: z.ZodObject<{
|
|
14
|
+
start: z.z.ZodISOTime;
|
|
15
|
+
end: z.z.ZodISOTime;
|
|
16
|
+
}, z.z.core.$strip>;
|
|
17
|
+
weekends: z.ZodObject<{
|
|
18
|
+
start: z.z.ZodISOTime;
|
|
19
|
+
end: z.z.ZodISOTime;
|
|
20
|
+
}, z.z.core.$strip>;
|
|
21
|
+
}, z.z.core.$strip>;
|
|
22
|
+
}, z.z.core.$strip>;
|
|
23
|
+
export type ServiceRevision = z.infer<typeof ServiceRevisionSchema>;
|
|
24
|
+
export declare const ServiceSchema: z.ZodObject<{
|
|
25
|
+
id: z.ZodString;
|
|
26
|
+
name: z.ZodObject<{
|
|
27
|
+
'en-SG': z.ZodString;
|
|
28
|
+
'zh-Hans': z.ZodNullable<z.ZodString>;
|
|
29
|
+
ms: z.ZodNullable<z.ZodString>;
|
|
30
|
+
ta: z.ZodNullable<z.ZodString>;
|
|
31
|
+
}, z.z.core.$strip>;
|
|
32
|
+
lineId: z.ZodString;
|
|
33
|
+
revisions: z.ZodArray<z.ZodObject<{
|
|
34
|
+
id: z.ZodString;
|
|
35
|
+
startAt: z.ZodString;
|
|
36
|
+
endAt: z.ZodNullable<z.ZodString>;
|
|
37
|
+
path: z.ZodObject<{
|
|
38
|
+
stations: z.ZodArray<z.ZodObject<{
|
|
39
|
+
stationId: z.ZodString;
|
|
40
|
+
displayCode: z.ZodString;
|
|
41
|
+
}, z.z.core.$strip>>;
|
|
42
|
+
}, z.z.core.$strip>;
|
|
43
|
+
operatingHours: z.ZodObject<{
|
|
44
|
+
weekdays: z.ZodObject<{
|
|
45
|
+
start: z.z.ZodISOTime;
|
|
46
|
+
end: z.z.ZodISOTime;
|
|
47
|
+
}, z.z.core.$strip>;
|
|
48
|
+
weekends: z.ZodObject<{
|
|
49
|
+
start: z.z.ZodISOTime;
|
|
50
|
+
end: z.z.ZodISOTime;
|
|
51
|
+
}, z.z.core.$strip>;
|
|
52
|
+
}, z.z.core.$strip>;
|
|
53
|
+
}, z.z.core.$strip>>;
|
|
54
|
+
}, z.z.core.$strip>;
|
|
55
|
+
export type Service = z.infer<typeof ServiceSchema>;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import z from 'zod';
|
|
2
|
+
import { OperatingHoursSchema, TranslationsSchema } from './common.js';
|
|
3
|
+
export const ServiceRevisionSchema = z.object({
|
|
4
|
+
id: z.string(),
|
|
5
|
+
startAt: z.string(),
|
|
6
|
+
endAt: z.string().nullable(),
|
|
7
|
+
path: z.object({
|
|
8
|
+
stations: z.array(z.object({
|
|
9
|
+
stationId: z.string(),
|
|
10
|
+
displayCode: z.string(),
|
|
11
|
+
})),
|
|
12
|
+
}),
|
|
13
|
+
operatingHours: OperatingHoursSchema,
|
|
14
|
+
});
|
|
15
|
+
export const ServiceSchema = z.object({
|
|
16
|
+
id: z.string(),
|
|
17
|
+
name: TranslationsSchema,
|
|
18
|
+
/**
|
|
19
|
+
* The station IDs in the order they are visited by the service.
|
|
20
|
+
*/
|
|
21
|
+
lineId: z.string(),
|
|
22
|
+
revisions: z.array(ServiceRevisionSchema),
|
|
23
|
+
});
|
|
24
|
+
//# sourceMappingURL=Service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Service.js","sourceRoot":"/","sources":["schema/Service.ts"],"names":[],"mappings":"AAAA,OAAO,CAAC,MAAM,KAAK,CAAC;AACpB,OAAO,EAAE,oBAAoB,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAEvE,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC5C,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE;IACd,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE;IACnB,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC5B,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC;QACb,QAAQ,EAAE,CAAC,CAAC,KAAK,CACf,CAAC,CAAC,MAAM,CAAC;YACP,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE;YACrB,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE;SACxB,CAAC,CACH;KACF,CAAC;IACF,cAAc,EAAE,oBAAoB;CACrC,CAAC,CAAC;AAGH,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,CAAC,MAAM,CAAC;IACpC,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE;IACd,IAAI,EAAE,kBAAkB;IACxB;;OAEG;IACH,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE;IAClB,SAAS,EAAE,CAAC,CAAC,KAAK,CAAC,qBAAqB,CAAC;CAC1C,CAAC,CAAC","sourcesContent":["import z from 'zod';\nimport { OperatingHoursSchema, TranslationsSchema } from './common.js';\n\nexport const ServiceRevisionSchema = z.object({\n id: z.string(),\n startAt: z.string(),\n endAt: z.string().nullable(),\n path: z.object({\n stations: z.array(\n z.object({\n stationId: z.string(),\n displayCode: z.string(),\n }),\n ),\n }),\n operatingHours: OperatingHoursSchema,\n});\nexport type ServiceRevision = z.infer<typeof ServiceRevisionSchema>;\n\nexport const ServiceSchema = z.object({\n id: z.string(),\n name: TranslationsSchema,\n /**\n * The station IDs in the order they are visited by the service.\n */\n lineId: z.string(),\n revisions: z.array(ServiceRevisionSchema),\n});\nexport type Service = z.infer<typeof ServiceSchema>;\n"]}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import z from 'zod';
|
|
2
|
+
export declare const StationSchema: z.ZodObject<{
|
|
3
|
+
id: z.ZodString;
|
|
4
|
+
name: z.ZodObject<{
|
|
5
|
+
'en-SG': z.ZodString;
|
|
6
|
+
'zh-Hans': z.ZodNullable<z.ZodString>;
|
|
7
|
+
ms: z.ZodNullable<z.ZodString>;
|
|
8
|
+
ta: z.ZodNullable<z.ZodString>;
|
|
9
|
+
}, z.z.core.$strip>;
|
|
10
|
+
geo: z.ZodObject<{
|
|
11
|
+
latitude: z.ZodNumber;
|
|
12
|
+
longitude: z.ZodNumber;
|
|
13
|
+
}, z.z.core.$strip>;
|
|
14
|
+
stationCodes: z.ZodArray<z.ZodObject<{
|
|
15
|
+
lineId: z.ZodString;
|
|
16
|
+
code: z.ZodString;
|
|
17
|
+
startedAt: z.ZodString;
|
|
18
|
+
endedAt: z.ZodNullable<z.ZodString>;
|
|
19
|
+
structureType: z.ZodEnum<{
|
|
20
|
+
elevated: "elevated";
|
|
21
|
+
underground: "underground";
|
|
22
|
+
at_grade: "at_grade";
|
|
23
|
+
in_building: "in_building";
|
|
24
|
+
}>;
|
|
25
|
+
}, z.z.core.$strip>>;
|
|
26
|
+
landmarkIds: z.ZodArray<z.ZodString>;
|
|
27
|
+
townId: z.ZodString;
|
|
28
|
+
}, z.z.core.$strip>;
|
|
29
|
+
export type Station = z.infer<typeof StationSchema>;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import z from 'zod';
|
|
2
|
+
import { TranslationsSchema } from './common.js';
|
|
3
|
+
export const StationSchema = z.object({
|
|
4
|
+
id: z.string(),
|
|
5
|
+
name: TranslationsSchema,
|
|
6
|
+
geo: z.object({
|
|
7
|
+
latitude: z.number(),
|
|
8
|
+
longitude: z.number(),
|
|
9
|
+
}),
|
|
10
|
+
stationCodes: z.array(z.object({
|
|
11
|
+
lineId: z.string(),
|
|
12
|
+
code: z.string(),
|
|
13
|
+
startedAt: z.string(),
|
|
14
|
+
endedAt: z.string().nullable(),
|
|
15
|
+
structureType: z.enum([
|
|
16
|
+
'elevated',
|
|
17
|
+
'underground',
|
|
18
|
+
'at_grade',
|
|
19
|
+
'in_building',
|
|
20
|
+
]),
|
|
21
|
+
})),
|
|
22
|
+
landmarkIds: z.array(z.string()),
|
|
23
|
+
townId: z.string(),
|
|
24
|
+
});
|
|
25
|
+
//# sourceMappingURL=Station.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Station.js","sourceRoot":"/","sources":["schema/Station.ts"],"names":[],"mappings":"AAAA,OAAO,CAAC,MAAM,KAAK,CAAC;AACpB,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAEjD,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,CAAC,MAAM,CAAC;IACpC,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE;IACd,IAAI,EAAE,kBAAkB;IACxB,GAAG,EAAE,CAAC,CAAC,MAAM,CAAC;QACZ,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE;QACpB,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE;KACtB,CAAC;IACF,YAAY,EAAE,CAAC,CAAC,KAAK,CACnB,CAAC,CAAC,MAAM,CAAC;QACP,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE;QAClB,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;QAChB,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE;QACrB,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;QAC9B,aAAa,EAAE,CAAC,CAAC,IAAI,CAAC;YACpB,UAAU;YACV,aAAa;YACb,UAAU;YACV,aAAa;SACd,CAAC;KACH,CAAC,CACH;IACD,WAAW,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;IAChC,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE;CACnB,CAAC,CAAC","sourcesContent":["import z from 'zod';\nimport { TranslationsSchema } from './common.js';\n\nexport const StationSchema = z.object({\n id: z.string(),\n name: TranslationsSchema,\n geo: z.object({\n latitude: z.number(),\n longitude: z.number(),\n }),\n stationCodes: z.array(\n z.object({\n lineId: z.string(),\n code: z.string(),\n startedAt: z.string(),\n endedAt: z.string().nullable(),\n structureType: z.enum([\n 'elevated',\n 'underground',\n 'at_grade',\n 'in_building',\n ]),\n }),\n ),\n landmarkIds: z.array(z.string()),\n townId: z.string(),\n});\nexport type Station = z.infer<typeof StationSchema>;\n"]}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import z from 'zod';
|
|
2
|
+
export declare const TownSchema: z.ZodObject<{
|
|
3
|
+
id: z.ZodString;
|
|
4
|
+
name: z.ZodObject<{
|
|
5
|
+
'en-SG': z.ZodString;
|
|
6
|
+
'zh-Hans': z.ZodNullable<z.ZodString>;
|
|
7
|
+
ms: z.ZodNullable<z.ZodString>;
|
|
8
|
+
ta: z.ZodNullable<z.ZodString>;
|
|
9
|
+
}, z.z.core.$strip>;
|
|
10
|
+
}, z.z.core.$strip>;
|
|
11
|
+
export type Town = z.infer<typeof TownSchema>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Town.js","sourceRoot":"/","sources":["schema/Town.ts"],"names":[],"mappings":"AAAA,OAAO,CAAC,MAAM,KAAK,CAAC;AACpB,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAEjD,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,CAAC,MAAM,CAAC;IACjC,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE;IACd,IAAI,EAAE,kBAAkB;CACzB,CAAC,CAAC","sourcesContent":["import z from 'zod';\nimport { TranslationsSchema } from './common.js';\n\nexport const TownSchema = z.object({\n id: z.string(),\n name: TranslationsSchema,\n});\nexport type Town = z.infer<typeof TownSchema>;\n"]}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
/**
|
|
3
|
+
* Translations
|
|
4
|
+
*
|
|
5
|
+
* `en` is mandatory.
|
|
6
|
+
*/
|
|
7
|
+
export declare const TranslationsSchema: z.ZodObject<{
|
|
8
|
+
'en-SG': z.ZodString;
|
|
9
|
+
'zh-Hans': z.ZodNullable<z.ZodString>;
|
|
10
|
+
ms: z.ZodNullable<z.ZodString>;
|
|
11
|
+
ta: z.ZodNullable<z.ZodString>;
|
|
12
|
+
}, z.core.$strip>;
|
|
13
|
+
export type Translations = z.infer<typeof TranslationsSchema>;
|
|
14
|
+
export declare const OperatingHoursSchema: z.ZodObject<{
|
|
15
|
+
weekdays: z.ZodObject<{
|
|
16
|
+
start: z.ZodISOTime;
|
|
17
|
+
end: z.ZodISOTime;
|
|
18
|
+
}, z.core.$strip>;
|
|
19
|
+
weekends: z.ZodObject<{
|
|
20
|
+
start: z.ZodISOTime;
|
|
21
|
+
end: z.ZodISOTime;
|
|
22
|
+
}, z.core.$strip>;
|
|
23
|
+
}, z.core.$strip>;
|
|
24
|
+
export type OperatingHours = z.infer<typeof OperatingHoursSchema>;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
/**
|
|
3
|
+
* Translations
|
|
4
|
+
*
|
|
5
|
+
* `en` is mandatory.
|
|
6
|
+
*/
|
|
7
|
+
export const TranslationsSchema = z.object({
|
|
8
|
+
'en-SG': z.string(),
|
|
9
|
+
'zh-Hans': z.string().nullable(),
|
|
10
|
+
ms: z.string().nullable(),
|
|
11
|
+
ta: z.string().nullable(),
|
|
12
|
+
});
|
|
13
|
+
export const OperatingHoursSchema = z.object({
|
|
14
|
+
weekdays: z.object({
|
|
15
|
+
start: z.iso.time(),
|
|
16
|
+
end: z.iso.time(),
|
|
17
|
+
}),
|
|
18
|
+
weekends: z.object({
|
|
19
|
+
start: z.iso.time(),
|
|
20
|
+
end: z.iso.time(),
|
|
21
|
+
}),
|
|
22
|
+
});
|
|
23
|
+
//# sourceMappingURL=common.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"common.js","sourceRoot":"/","sources":["schema/common.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;;;GAIG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,CAAC,MAAM,CAAC;IACzC,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE;IACnB,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAChC,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IACzB,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;CAC1B,CAAC,CAAC;AAGH,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC3C,QAAQ,EAAE,CAAC,CAAC,MAAM,CAAC;QACjB,KAAK,EAAE,CAAC,CAAC,GAAG,CAAC,IAAI,EAAE;QACnB,GAAG,EAAE,CAAC,CAAC,GAAG,CAAC,IAAI,EAAE;KAClB,CAAC;IACF,QAAQ,EAAE,CAAC,CAAC,MAAM,CAAC;QACjB,KAAK,EAAE,CAAC,CAAC,GAAG,CAAC,IAAI,EAAE;QACnB,GAAG,EAAE,CAAC,CAAC,GAAG,CAAC,IAAI,EAAE;KAClB,CAAC;CACH,CAAC,CAAC","sourcesContent":["import { z } from 'zod';\n\n/**\n * Translations\n *\n * `en` is mandatory.\n */\nexport const TranslationsSchema = z.object({\n 'en-SG': z.string(),\n 'zh-Hans': z.string().nullable(),\n ms: z.string().nullable(),\n ta: z.string().nullable(),\n});\nexport type Translations = z.infer<typeof TranslationsSchema>;\n\nexport const OperatingHoursSchema = z.object({\n weekdays: z.object({\n start: z.iso.time(),\n end: z.iso.time(),\n }),\n weekends: z.object({\n start: z.iso.time(),\n end: z.iso.time(),\n }),\n});\nexport type OperatingHours = z.infer<typeof OperatingHoursSchema>;\n"]}
|