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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (156) hide show
  1. package/dist/helpers/normalizeRecurringPeriod.d.ts +1 -1
  2. package/dist/helpers/normalizeRecurringPeriod.js +1 -1
  3. package/dist/helpers/normalizeRecurringPeriod.js.map +1 -1
  4. package/dist/helpers/normalizeRecurringPeriod.test.js.map +1 -1
  5. package/dist/helpers/resolvePeriods.d.ts +20 -5
  6. package/dist/helpers/resolvePeriods.js +15 -1
  7. package/dist/helpers/resolvePeriods.js.map +1 -1
  8. package/dist/helpers/resolvePeriods.test.js.map +1 -1
  9. package/dist/index.d.ts +23 -18
  10. package/dist/index.js +23 -18
  11. package/dist/index.js.map +1 -1
  12. package/dist/schema/Landmark.js.map +1 -1
  13. package/dist/schema/Line.d.ts +6 -0
  14. package/dist/schema/Line.js +2 -1
  15. package/dist/schema/Line.js.map +1 -1
  16. package/dist/schema/Manifest.d.ts +13 -0
  17. package/dist/schema/Manifest.js +13 -0
  18. package/dist/schema/Manifest.js.map +1 -0
  19. package/dist/schema/Operator.js.map +1 -1
  20. package/dist/schema/Service.js.map +1 -1
  21. package/dist/schema/Station.d.ts +7 -0
  22. package/dist/schema/Station.js +7 -6
  23. package/dist/schema/Station.js.map +1 -1
  24. package/dist/schema/Town.js.map +1 -1
  25. package/dist/schema/common.d.ts +4 -0
  26. package/dist/schema/common.js +3 -0
  27. package/dist/schema/common.js.map +1 -1
  28. package/dist/schema/issue/bundle.js.map +1 -1
  29. package/dist/schema/issue/cause.js.map +1 -1
  30. package/dist/schema/issue/claim.js.map +1 -1
  31. package/dist/schema/issue/entity.d.ts +6 -0
  32. package/dist/schema/issue/entity.js +6 -1
  33. package/dist/schema/issue/entity.js.map +1 -1
  34. package/dist/schema/issue/evidence.d.ts +6 -0
  35. package/dist/schema/issue/evidence.js +9 -4
  36. package/dist/schema/issue/evidence.js.map +1 -1
  37. package/dist/schema/issue/facilityEffect.d.ts +5 -0
  38. package/dist/schema/issue/facilityEffect.js +6 -2
  39. package/dist/schema/issue/facilityEffect.js.map +1 -1
  40. package/dist/schema/issue/id.js.map +1 -1
  41. package/dist/schema/issue/impactEvent.js.map +1 -1
  42. package/dist/schema/issue/issue.js +2 -4
  43. package/dist/schema/issue/issue.js.map +1 -1
  44. package/dist/schema/issue/issueType.js.map +1 -1
  45. package/dist/schema/issue/period.js.map +1 -1
  46. package/dist/schema/issue/serviceEffect.d.ts +7 -0
  47. package/dist/schema/issue/serviceEffect.js +10 -4
  48. package/dist/schema/issue/serviceEffect.js.map +1 -1
  49. package/dist/schema/issue/serviceScope.d.ts +6 -0
  50. package/dist/schema/issue/serviceScope.js +8 -3
  51. package/dist/schema/issue/serviceScope.js.map +1 -1
  52. package/dist/util/assert.js.map +1 -1
  53. package/package.json +21 -61
  54. package/README.md +0 -107
  55. package/dist/constants.d.ts +0 -10
  56. package/dist/constants.js +0 -11
  57. package/dist/constants.js.map +0 -1
  58. package/dist/helpers/calculateDurationWithinServiceHours.d.ts +0 -2
  59. package/dist/helpers/calculateDurationWithinServiceHours.js +0 -13
  60. package/dist/helpers/calculateDurationWithinServiceHours.js.map +0 -1
  61. package/dist/helpers/calculateDurationWithinServiceHours.test.d.ts +0 -1
  62. package/dist/helpers/calculateDurationWithinServiceHours.test.js +0 -83
  63. package/dist/helpers/calculateDurationWithinServiceHours.test.js.map +0 -1
  64. package/dist/helpers/computeImpactFromEvidenceClaims.d.ts +0 -21
  65. package/dist/helpers/computeImpactFromEvidenceClaims.js +0 -293
  66. package/dist/helpers/computeImpactFromEvidenceClaims.js.map +0 -1
  67. package/dist/helpers/computeImpactFromEvidenceClaims.test.d.ts +0 -1
  68. package/dist/helpers/computeImpactFromEvidenceClaims.test.js +0 -544
  69. package/dist/helpers/computeImpactFromEvidenceClaims.test.js.map +0 -1
  70. package/dist/helpers/computeStartOfDaysWithinInterval.d.ts +0 -2
  71. package/dist/helpers/computeStartOfDaysWithinInterval.js +0 -15
  72. package/dist/helpers/computeStartOfDaysWithinInterval.js.map +0 -1
  73. package/dist/helpers/computeStartOfDaysWithinInterval.test.d.ts +0 -1
  74. package/dist/helpers/computeStartOfDaysWithinInterval.test.js +0 -126
  75. package/dist/helpers/computeStartOfDaysWithinInterval.test.js.map +0 -1
  76. package/dist/helpers/estimateOpenAICost.d.ts +0 -40
  77. package/dist/helpers/estimateOpenAICost.js +0 -55
  78. package/dist/helpers/estimateOpenAICost.js.map +0 -1
  79. package/dist/helpers/keyForAffectedEntity.d.ts +0 -7
  80. package/dist/helpers/keyForAffectedEntity.js +0 -14
  81. package/dist/helpers/keyForAffectedEntity.js.map +0 -1
  82. package/dist/helpers/splitIntervalByServiceHours.d.ts +0 -2
  83. package/dist/helpers/splitIntervalByServiceHours.js +0 -30
  84. package/dist/helpers/splitIntervalByServiceHours.js.map +0 -1
  85. package/dist/helpers/splitIntervalByServiceHours.test.d.ts +0 -1
  86. package/dist/helpers/splitIntervalByServiceHours.test.js +0 -152
  87. package/dist/helpers/splitIntervalByServiceHours.test.js.map +0 -1
  88. package/dist/helpers/sumIntervalDuration.d.ts +0 -2
  89. package/dist/helpers/sumIntervalDuration.js +0 -9
  90. package/dist/helpers/sumIntervalDuration.js.map +0 -1
  91. package/dist/repo/MRTDownRepository.d.ts +0 -23
  92. package/dist/repo/MRTDownRepository.js +0 -28
  93. package/dist/repo/MRTDownRepository.js.map +0 -1
  94. package/dist/repo/common/FileStore.d.ts +0 -12
  95. package/dist/repo/common/FileStore.js +0 -27
  96. package/dist/repo/common/FileStore.js.map +0 -1
  97. package/dist/repo/common/StandardRepository.d.ts +0 -32
  98. package/dist/repo/common/StandardRepository.js +0 -58
  99. package/dist/repo/common/StandardRepository.js.map +0 -1
  100. package/dist/repo/common/store.d.ts +0 -29
  101. package/dist/repo/common/store.js +0 -2
  102. package/dist/repo/common/store.js.map +0 -1
  103. package/dist/repo/issue/IssueRepository.d.ts +0 -36
  104. package/dist/repo/issue/IssueRepository.js +0 -177
  105. package/dist/repo/issue/IssueRepository.js.map +0 -1
  106. package/dist/repo/issue/helpers/deriveCurrentState.d.ts +0 -51
  107. package/dist/repo/issue/helpers/deriveCurrentState.js +0 -113
  108. package/dist/repo/issue/helpers/deriveCurrentState.js.map +0 -1
  109. package/dist/repo/issue/helpers/deriveCurrentState.test.d.ts +0 -1
  110. package/dist/repo/issue/helpers/deriveCurrentState.test.js +0 -477
  111. package/dist/repo/issue/helpers/deriveCurrentState.test.js.map +0 -1
  112. package/dist/repo/landmark/LandmarkRepository.d.ts +0 -7
  113. package/dist/repo/landmark/LandmarkRepository.js +0 -12
  114. package/dist/repo/landmark/LandmarkRepository.js.map +0 -1
  115. package/dist/repo/line/LineRepository.d.ts +0 -13
  116. package/dist/repo/line/LineRepository.js +0 -32
  117. package/dist/repo/line/LineRepository.js.map +0 -1
  118. package/dist/repo/operator/OperatorRepository.d.ts +0 -7
  119. package/dist/repo/operator/OperatorRepository.js +0 -12
  120. package/dist/repo/operator/OperatorRepository.js.map +0 -1
  121. package/dist/repo/service/ServiceRepository.d.ts +0 -19
  122. package/dist/repo/service/ServiceRepository.js +0 -39
  123. package/dist/repo/service/ServiceRepository.js.map +0 -1
  124. package/dist/repo/station/StationRepository.d.ts +0 -13
  125. package/dist/repo/station/StationRepository.js +0 -30
  126. package/dist/repo/station/StationRepository.js.map +0 -1
  127. package/dist/repo/town/TownRepository.d.ts +0 -7
  128. package/dist/repo/town/TownRepository.js +0 -12
  129. package/dist/repo/town/TownRepository.js.map +0 -1
  130. package/dist/util/ingestContent/helpers/getSlugDateTimeFromClaims.d.ts +0 -7
  131. package/dist/util/ingestContent/helpers/getSlugDateTimeFromClaims.js +0 -24
  132. package/dist/util/ingestContent/helpers/getSlugDateTimeFromClaims.js.map +0 -1
  133. package/dist/util/ingestContent/index.d.ts +0 -12
  134. package/dist/util/ingestContent/index.js +0 -171
  135. package/dist/util/ingestContent/index.js.map +0 -1
  136. package/dist/util/ingestContent/types.d.ts +0 -32
  137. package/dist/util/ingestContent/types.js +0 -2
  138. package/dist/util/ingestContent/types.js.map +0 -1
  139. package/dist/write/MRTDownWriter.d.ts +0 -27
  140. package/dist/write/MRTDownWriter.js +0 -27
  141. package/dist/write/MRTDownWriter.js.map +0 -1
  142. package/dist/write/common/FileWriteStore.d.ts +0 -13
  143. package/dist/write/common/FileWriteStore.js +0 -31
  144. package/dist/write/common/FileWriteStore.js.map +0 -1
  145. package/dist/write/common/StandardWriter.d.ts +0 -14
  146. package/dist/write/common/StandardWriter.js +0 -17
  147. package/dist/write/common/StandardWriter.js.map +0 -1
  148. package/dist/write/common/store.d.ts +0 -32
  149. package/dist/write/common/store.js +0 -2
  150. package/dist/write/common/store.js.map +0 -1
  151. package/dist/write/id/IdGenerator.d.ts +0 -18
  152. package/dist/write/id/IdGenerator.js +0 -23
  153. package/dist/write/id/IdGenerator.js.map +0 -1
  154. package/dist/write/issue/IssueWriter.d.ts +0 -12
  155. package/dist/write/issue/IssueWriter.js +0 -33
  156. package/dist/write/issue/IssueWriter.js.map +0 -1
@@ -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=IssueWriter.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"IssueWriter.js","sourceRoot":"/","sources":["write/issue/IssueWriter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAIjC,OAAO,EACL,SAAS,EACT,UAAU,EACV,mBAAmB,EACnB,iBAAiB,GAClB,MAAM,oBAAoB,CAAC;AAG5B,MAAM,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,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"]}