@mrtdown/core 2.0.0-alpha.1 → 2.0.0-alpha.10
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 +22 -18
- package/dist/index.js +22 -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/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
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import type { DateTime } from 'luxon';
|
|
2
|
-
/**
|
|
3
|
-
* A utility for generating unique IDs.
|
|
4
|
-
*/
|
|
5
|
-
export declare const IdGenerator: {
|
|
6
|
-
/**
|
|
7
|
-
* Generate a unique ID for an evidence.
|
|
8
|
-
* @param ts - The timestamp of the evidence.
|
|
9
|
-
* @returns
|
|
10
|
-
*/
|
|
11
|
-
evidenceId(ts?: DateTime): string;
|
|
12
|
-
/**
|
|
13
|
-
* Generate a unique ID for an impact event.
|
|
14
|
-
* @param ts - The timestamp of the impact event.
|
|
15
|
-
* @returns
|
|
16
|
-
*/
|
|
17
|
-
impactEventId(ts?: DateTime): string;
|
|
18
|
-
};
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { ulid } from 'ulid';
|
|
2
|
-
/**
|
|
3
|
-
* A utility for generating unique IDs.
|
|
4
|
-
*/
|
|
5
|
-
export const IdGenerator = {
|
|
6
|
-
/**
|
|
7
|
-
* Generate a unique ID for an evidence.
|
|
8
|
-
* @param ts - The timestamp of the evidence.
|
|
9
|
-
* @returns
|
|
10
|
-
*/
|
|
11
|
-
evidenceId(ts) {
|
|
12
|
-
return `ev_${ulid(ts?.toMillis?.() ?? undefined)}`;
|
|
13
|
-
},
|
|
14
|
-
/**
|
|
15
|
-
* Generate a unique ID for an impact event.
|
|
16
|
-
* @param ts - The timestamp of the impact event.
|
|
17
|
-
* @returns
|
|
18
|
-
*/
|
|
19
|
-
impactEventId(ts) {
|
|
20
|
-
return `ie_${ulid(ts?.toMillis?.() ?? undefined)}`;
|
|
21
|
-
},
|
|
22
|
-
};
|
|
23
|
-
//# sourceMappingURL=IdGenerator.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"IdGenerator.js","sourceRoot":"/","sources":["write/id/IdGenerator.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAE5B;;GAEG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG;IACzB;;;;OAIG;IACH,UAAU,CAAC,EAAa;QACtB,OAAO,MAAM,IAAI,CAAC,EAAE,EAAE,QAAQ,EAAE,EAAE,IAAI,SAAS,CAAC,EAAE,CAAC;IACrD,CAAC;IAED;;;;OAIG;IACH,aAAa,CAAC,EAAa;QACzB,OAAO,MAAM,IAAI,CAAC,EAAE,EAAE,QAAQ,EAAE,EAAE,IAAI,SAAS,CAAC,EAAE,CAAC;IACrD,CAAC;CACF,CAAC","sourcesContent":["import type { DateTime } from 'luxon';\nimport { ulid } from 'ulid';\n\n/**\n * A utility for generating unique IDs.\n */\nexport const IdGenerator = {\n /**\n * Generate a unique ID for an evidence.\n * @param ts - The timestamp of the evidence.\n * @returns\n */\n evidenceId(ts?: DateTime) {\n return `ev_${ulid(ts?.toMillis?.() ?? undefined)}`;\n },\n\n /**\n * Generate a unique ID for an impact event.\n * @param ts - The timestamp of the impact event.\n * @returns\n */\n impactEventId(ts?: DateTime) {\n return `ie_${ulid(ts?.toMillis?.() ?? undefined)}`;\n },\n};\n"]}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import type { Evidence } from '#schema/issue/evidence.js';
|
|
2
|
-
import type { ImpactEvent } from '#schema/issue/impactEvent.js';
|
|
3
|
-
import type { Issue } from '#schema/issue/issue.js';
|
|
4
|
-
import type { IWriteStore } from '../common/store.js';
|
|
5
|
-
export declare class IssueWriter {
|
|
6
|
-
private readonly store;
|
|
7
|
-
constructor(store: IWriteStore);
|
|
8
|
-
create(issue: Issue): void;
|
|
9
|
-
appendEvidence(issueId: string, evidence: Evidence): void;
|
|
10
|
-
appendImpact(issueId: string, impact: ImpactEvent): void;
|
|
11
|
-
private getIssueDir;
|
|
12
|
-
}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { join } from 'node:path';
|
|
2
|
-
import { NdJson } from 'json-nd';
|
|
3
|
-
import { DIR_ISSUE, FILE_ISSUE, FILE_ISSUE_EVIDENCE, FILE_ISSUE_IMPACT, } from '../../constants.js';
|
|
4
|
-
export class IssueWriter {
|
|
5
|
-
store;
|
|
6
|
-
constructor(store) {
|
|
7
|
-
this.store = store;
|
|
8
|
-
}
|
|
9
|
-
create(issue) {
|
|
10
|
-
const issueDir = this.getIssueDir(issue.id);
|
|
11
|
-
this.store.ensureDir(issueDir);
|
|
12
|
-
this.store.writeJson(join(issueDir, FILE_ISSUE), issue);
|
|
13
|
-
this.store.writeText(join(issueDir, FILE_ISSUE_EVIDENCE), '');
|
|
14
|
-
this.store.writeText(join(issueDir, FILE_ISSUE_IMPACT), '');
|
|
15
|
-
}
|
|
16
|
-
appendEvidence(issueId, evidence) {
|
|
17
|
-
this.store.ensureDir(this.getIssueDir(issueId));
|
|
18
|
-
this.store.appendText(join(this.getIssueDir(issueId), FILE_ISSUE_EVIDENCE), `${NdJson.stringify([evidence])}\n`);
|
|
19
|
-
}
|
|
20
|
-
appendImpact(issueId, impact) {
|
|
21
|
-
this.store.ensureDir(this.getIssueDir(issueId));
|
|
22
|
-
this.store.appendText(join(this.getIssueDir(issueId), FILE_ISSUE_IMPACT), `${NdJson.stringify([impact])}\n`);
|
|
23
|
-
}
|
|
24
|
-
getIssueDir(issueId) {
|
|
25
|
-
const tsMatch = /^(\d{4})-(\d{2})-(\d{2})/.exec(issueId);
|
|
26
|
-
if (!tsMatch) {
|
|
27
|
-
throw new Error(`Invalid issue ID: ${issueId}`);
|
|
28
|
-
}
|
|
29
|
-
const [_, year, month] = tsMatch;
|
|
30
|
-
return join(DIR_ISSUE, year, month, issueId);
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
//# sourceMappingURL=I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AC;IACJ,CAAC;IAED,YAAY,CAAC,OAAe,EAAE,MAAmB;QAC/C,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC,CAAC;QAChD,IAAI,CAAC,KAAK,CAAC,UAAU,CACnB,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,EAAE,iBAAiB,CAAC,EAClD,GAAG,MAAM,CAAC,SAAS,CAAC,CAAC,MAAM,CAAC,CAAC,IAAI,CAClC,CAAC;IACJ,CAAC;IAEO,WAAW,CAAC,OAAe;QACjC,MAAM,OAAO,GAAG,0BAA0B,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QACzD,IAAI,CAAC,OAAO,EAAE,CAAC;YACb,MAAM,IAAI,KAAK,CAAC,qBAAqB,OAAO,EAAE,CAAC,CAAC;QAClD,CAAC;QACD,MAAM,CAAC,CAAC,EAAE,IAAI,EAAE,KAAK,CAAC,GAAG,OAAO,CAAC;QACjC,OAAO,IAAI,CAAC,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC;IAC/C,CAAC;CACF","sourcesContent":["import { join } from 'node:path';\nimport { NdJson } from 'json-nd';\nimport type { Evidence } from '#schema/issue/evidence.js';\nimport type { ImpactEvent } from '#schema/issue/impactEvent.js';\nimport type { Issue } from '#schema/issue/issue.js';\nimport {\n DIR_ISSUE,\n FILE_ISSUE,\n FILE_ISSUE_EVIDENCE,\n FILE_ISSUE_IMPACT,\n} from '../../constants.js';\nimport type { IWriteStore } from '../common/store.js';\n\nexport class IssueWriter {\n private readonly store: IWriteStore;\n\n constructor(store: IWriteStore) {\n this.store = store;\n }\n\n create(issue: Issue): void {\n const issueDir = this.getIssueDir(issue.id);\n this.store.ensureDir(issueDir);\n this.store.writeJson(join(issueDir, FILE_ISSUE), issue);\n this.store.writeText(join(issueDir, FILE_ISSUE_EVIDENCE), '');\n this.store.writeText(join(issueDir, FILE_ISSUE_IMPACT), '');\n }\n\n appendEvidence(issueId: string, evidence: Evidence): void {\n this.store.ensureDir(this.getIssueDir(issueId));\n this.store.appendText(\n join(this.getIssueDir(issueId), FILE_ISSUE_EVIDENCE),\n `${NdJson.stringify([evidence])}\\n`,\n );\n }\n\n appendImpact(issueId: string, impact: ImpactEvent): void {\n this.store.ensureDir(this.getIssueDir(issueId));\n this.store.appendText(\n join(this.getIssueDir(issueId), FILE_ISSUE_IMPACT),\n `${NdJson.stringify([impact])}\\n`,\n );\n }\n\n private getIssueDir(issueId: string): string {\n const tsMatch = /^(\\d{4})-(\\d{2})-(\\d{2})/.exec(issueId);\n if (!tsMatch) {\n throw new Error(`Invalid issue ID: ${issueId}`);\n }\n const [_, year, month] = tsMatch;\n return join(DIR_ISSUE, year, month, issueId);\n }\n}\n"]}
|