Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | import { autoInjectable } from "tsyringe";
import { MetadataSubs } from "../../tr8-script/domain/metadata-subs.js";
import { JournalEntryMapper } from "./journal-entry-mapper.js";
import { Journal, JournalEvent } from "./journal-events.js";
@autoInjectable()
class JournalMapper {
constructor(
private readonly substituter: MetadataSubs,
private readonly journalEntryMapper: JournalEntryMapper,
) {}
map(journal: JournalEvent): Journal {
return {
id: journal.id,
metadata: this.substituter.substitute(
journal.metadata,
journal.variables,
),
receivedAt: journal.receivedAt,
executedAt: journal.executedAt,
entries: this.journalEntryMapper.map(journal.journals),
};
}
}
export { JournalMapper };
|