d06f9deb99
Ps 5, 35, 42, 50, 56, 62, 63, 64, 66, 75, 87, 89, 91, 117, 142, 148-150 weren't needed by any hour built so far. The 7 weekday OT canticles (Isaiah, Ezechias, Anna, Moses x2, Habacuc, the Three Young Men) get their own small store (src/hours/lauds-canticles.ts), separate from the Psalter, since they use their own liturgical verse-numbering per canticle rather than the Psalter's 1-150 numbering. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
37 lines
1.1 KiB
TypeScript
37 lines
1.1 KiB
TypeScript
import type { LanguageCode, TranslationStatus } from '../psalter';
|
|
|
|
export interface CanticleVerse {
|
|
n: string;
|
|
text: Partial<Record<LanguageCode, string>>;
|
|
status: Partial<Record<LanguageCode, TranslationStatus>>;
|
|
}
|
|
|
|
export interface Canticle {
|
|
id: string;
|
|
name: string;
|
|
citation: string;
|
|
verses: CanticleVerse[];
|
|
}
|
|
|
|
// The 7 Lauds OT canticles (data/hours/lauds-canticles/*.yml) — a small,
|
|
// separate store from the Psalter, since these use their own liturgical
|
|
// verse-numbering per canticle (not the Psalter's 1-150 numbering) and
|
|
// each id is only ever looked up directly by data/hours/lauds-
|
|
// antiphons.yml's weekday->canticleId mapping, never by number.
|
|
const modules = import.meta.glob<{ default: Canticle }>('../data/hours/lauds-canticles/*.yml', {
|
|
eager: true,
|
|
});
|
|
|
|
const canticles = new Map<string, Canticle>();
|
|
for (const mod of Object.values(modules)) {
|
|
canticles.set(mod.default.id, mod.default);
|
|
}
|
|
|
|
export function getCanticle(id: string): Canticle {
|
|
const canticle = canticles.get(id);
|
|
if (!canticle) {
|
|
throw new Error(`No Lauds canticle authored for id '${id}'`);
|
|
}
|
|
return canticle;
|
|
}
|