Files
vu/src/propers/nocturn-readings.ts
T
will 83bf55efdb Add reusable Matins building blocks: types, content stores, seed data
New ResolvedPart kinds (nocturn-psalmody, te-deum) and lesson fields
(nocturn, source, isGospel, responsory) in hours/types.ts. Three new
content-store modules: propers/bible-plan.ts (the user's own continuous
scripture-reading plan, replacing the historical Nocturn-1 lectionary),
propers/nocturn-readings.ts (general feast/temporal-day Nocturn 2-3
readings, extending propers/octave-readings.ts's combine-into-one-reading
pattern via a newly-exported resolvePassages), and
propers/matins-responsories.ts (a per-book responsory pool, matched
loosely rather than by exact citation).

Data: Sunday's fixed 12-psalm/3-canticle psalmody (live-verified against
the reference engine), the invitatory antiphon, ferial hymn and
capitulum, the Te Deum, a seeded Isaiah responsory, two live-transcribed
scripture chapters, and the two bible-plan rows needed for this pass'
proof content.
2026-08-14 11:40:31 -04:00

50 lines
2.2 KiB
TypeScript

// Matins Nocturn 2/3 readings for regular (non-octave-day) Sunday and
// Duplex+ feast days — extends src/propers/octave-readings.ts's own
// "combine several historical lessons into one reading, per real source
// change" pattern to ordinary days, not just the days *within* an octave
// that file already covers. Kept as a separate store (not folded into
// octave-readings.ts) because the id scheme is flat (a saint id or a
// temporal id, not `${octaveId}-octave-day-${n}`) and because a day can
// have several of these active at once — see hours/matins.ts, which
// loops every commemorated saint (calendar/types.ts's
// LiturgicalDay.commemorations) and every calendar/octaves.ts
// activeOctavesFor(date) entry, not just the office winner, per the
// user's own "be generous, not winner-takes-all" instruction (2026-08).
import type { LanguageCode, TranslationStatus } from '../psalter/types';
export interface NocturnReading {
nocturn: number;
isGospel: boolean;
/** Attribution, e.g. "St. Gregory the Great, Moralia in Job, Bk. 9" —
* absent for a bare Gospel pericope (the citation itself is enough). */
source?: string;
citation?: Partial<Record<LanguageCode, string>>;
text: Partial<Record<LanguageCode, string>>;
responsory?: Partial<Record<LanguageCode, string>>;
status: Partial<Record<LanguageCode, TranslationStatus>>;
}
interface NocturnReadingsFile {
id: string;
readings: NocturnReading[];
}
const modules = import.meta.glob<{ default: NocturnReadingsFile }>('../data/propers/nocturn-readings/*.yml', {
eager: true,
});
const readingsById = new Map<string, NocturnReading[]>();
for (const mod of Object.values(modules)) {
readingsById.set(mod.default.id, mod.default.readings);
}
/** Empty array, not undefined — a saint/temporal id with nothing authored
* here yet is the common case during this build's incremental content
* pass (see TODO.md), not an error; callers just get nothing to render
* for that id's own Nocturn 2/3 contribution. `id` is a saint id or a
* temporal id (calendar/temporal-id.ts's resolveTemporalId), matched
* exactly as `resolveOfficeWinner`/`day.commemorations` entries name it. */
export function getNocturnReadings(id: string): NocturnReading[] {
return readingsById.get(id) ?? [];
}