waha-shared 1.0.307 → 1.0.308

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 (102) hide show
  1. package/dist/data/areas/areas.json +48 -50
  2. package/dist/data/areas/areas.schema.json +2 -2
  3. package/dist/data/areas/areas.zod.d.ts +1 -1
  4. package/dist/data/areas/areas.zod.js +1 -1
  5. package/dist/data/areas/index.d.ts +1 -1
  6. package/dist/data/bibleAudios/bibleAudios.json +314 -581
  7. package/dist/data/bibleAudios/bibleAudios.schema.json +8 -17
  8. package/dist/data/bibleAudios/bibleAudios.zod.d.ts +2 -43
  9. package/dist/data/bibleAudios/bibleAudios.zod.js +7 -16
  10. package/dist/data/bibleAudios/index.d.ts +1 -2
  11. package/dist/data/bibleBooks/bibleBooks.json +782 -784
  12. package/dist/data/bibleStatuses/bibleStatuses.json +8284 -7785
  13. package/dist/data/bibleStatuses/bibleStatuses.schema.json +0 -6
  14. package/dist/data/bibleStatuses/bibleStatuses.zod.d.ts +0 -1
  15. package/dist/data/bibleStatuses/bibleStatuses.zod.js +0 -4
  16. package/dist/data/bibleStatuses/index.d.ts +0 -1
  17. package/dist/data/bibleTexts/bibleTexts.json +184 -269
  18. package/dist/data/bibleTexts/bibleTexts.schema.json +0 -7
  19. package/dist/data/bibleTexts/bibleTexts.zod.d.ts +0 -28
  20. package/dist/data/bibleTexts/bibleTexts.zod.js +3 -10
  21. package/dist/data/bibleTexts/index.d.ts +0 -2
  22. package/dist/data/clones/clones.json +0 -2
  23. package/dist/data/countries/countries.json +480 -480
  24. package/dist/data/countriesAndLanguages/countriesAndLanguages.json +6798 -6800
  25. package/dist/data/crowdinLanguages/crowdinLanguages.json +1438 -1440
  26. package/dist/data/crowdinLanguages/crowdinLanguages.schema.json +3 -3
  27. package/dist/data/crowdinLanguages/crowdinLanguages.zod.d.ts +2 -2
  28. package/dist/data/crowdinLanguages/crowdinLanguages.zod.js +2 -2
  29. package/dist/data/crowdinLanguages/index.d.ts +2 -2
  30. package/dist/data/curriculumFoundations/curriculumFoundations.json +69 -86
  31. package/dist/data/curriculumQuestions/curriculumQuestions.json +192 -194
  32. package/dist/data/curriculumTopics/curriculumTopics.json +8 -51
  33. package/dist/data/dblAudioLicenses/dblAudioLicenses.json +7 -36
  34. package/dist/data/dblTextLicenses/dblTextLicenses.json +4 -4
  35. package/dist/data/iosVoiceOverLanguages/iosVoiceOverLanguages.json +1 -1
  36. package/dist/data/iso6933LanguageCodes/iso6933LanguageCodes.json +1 -1
  37. package/dist/data/languageAssets/index.d.ts +1 -0
  38. package/dist/data/languageAssets/index.js +7 -0
  39. package/dist/data/languageAssets/languageAssets.json +45406 -0
  40. package/dist/data/languageAssets/languageAssets.schema.json +19 -0
  41. package/dist/data/languageAssets/languageAssets.zod.d.ts +3 -0
  42. package/dist/data/languageAssets/languageAssets.zod.js +7 -0
  43. package/dist/data/languages/index.d.ts +10 -20
  44. package/dist/data/languages/languages.json +2008 -2983
  45. package/dist/data/languages/languages.schema.json +47 -93
  46. package/dist/data/languages/languages.zod.d.ts +30 -93
  47. package/dist/data/languages/languages.zod.js +37 -59
  48. package/dist/data/lessonPauses/index.d.ts +1 -0
  49. package/dist/data/lessonPauses/lessonPauses.json +3 -2
  50. package/dist/data/lessonPauses/lessonPauses.schema.json +11 -1
  51. package/dist/data/lessonPauses/lessonPauses.zod.d.ts +1 -0
  52. package/dist/data/lessonPauses/lessonPauses.zod.js +3 -0
  53. package/dist/data/mediaDurations/mediaDurations.json +4231 -33446
  54. package/dist/data/mediaDurations/mediaDurations.schema.json +1 -1
  55. package/dist/data/mediaDurations/mediaDurations.zod.js +1 -1
  56. package/dist/data/notification/index.d.ts +1 -1
  57. package/dist/data/notification/notification.json +169 -93
  58. package/dist/data/phoneLanguages/phoneLanguages.json +635 -637
  59. package/dist/data/questions/questions.json +147 -149
  60. package/dist/data/releaseNotes/releaseNotes.json +124 -126
  61. package/dist/data/screenshots/screenshots.json +1 -1
  62. package/dist/data/scripts/scripts.json +1 -6
  63. package/dist/data/sets/index.d.ts +3 -3
  64. package/dist/data/sets/sets.json +476 -1766
  65. package/dist/data/sets/sets.schema.json +1 -1
  66. package/dist/data/sets/sets.zod.d.ts +3 -3
  67. package/dist/data/sets/sets.zod.js +6 -3
  68. package/dist/data/translationsApp/index.d.ts +0 -1
  69. package/dist/data/translationsApp/translationsApp.json +1582 -1623
  70. package/dist/data/translationsApp/translationsApp.schema.json +0 -1
  71. package/dist/data/translationsApp/translationsApp.zod.d.ts +0 -2
  72. package/dist/data/translationsApp/translationsApp.zod.js +0 -1
  73. package/dist/data/translationsFtb/translationsFtb.json +613 -69
  74. package/dist/data/translationsIntroduction/translationsIntroduction.json +1 -1
  75. package/dist/data/translationsQuestion/translationsQuestion.json +33 -65
  76. package/dist/data/translationsSet/translationsSet.json +19565 -30302
  77. package/dist/data/translationsSet/translationsSet.schema.json +4 -3
  78. package/dist/data/translationsSet/translationsSet.zod.js +4 -4
  79. package/dist/data/translationsSolarSpeaker/translationsSolarSpeaker.json +1 -1
  80. package/dist/data/translationsSpokenQuestion/translationsSpokenQuestion.json +33 -65
  81. package/dist/data/youtubePlaylists/youtubePlaylists.json +10 -10
  82. package/dist/data/youtubeVideos/youtubeVideos.json +82 -82
  83. package/dist/functions/languages.d.ts +7 -6
  84. package/dist/functions/languages.js +53 -51
  85. package/dist/functions/scripturePassages.d.ts +49 -34
  86. package/dist/functions/scripturePassages.js +304 -167
  87. package/dist/functions/sets.d.ts +52 -13
  88. package/dist/functions/sets.js +205 -193
  89. package/dist/types/bibleChapters.d.ts +2 -2
  90. package/dist/types/bibleChapters.js +1 -1
  91. package/dist/types/languages.d.ts +9 -39
  92. package/dist/types/languages.js +0 -2
  93. package/dist/types/sets.d.ts +11 -21
  94. package/package.json +1 -1
  95. package/dist/data/firebase.d.ts +0 -1
  96. package/dist/data/firebase.js +0 -4
  97. package/dist/functions/bibleBooks.d.ts +0 -16
  98. package/dist/functions/bibleBooks.js +0 -101
  99. package/dist/functions/bibles.d.ts +0 -44
  100. package/dist/functions/bibles.js +0 -291
  101. package/dist/functions/utils.d.ts +0 -2
  102. package/dist/functions/utils.js +0 -8
@@ -1,9 +1,7 @@
1
- import z from 'zod';
2
- import { BibleAudio } from '../data/bibleAudios/bibleAudios.zod';
3
- import { BibleText } from '../data/bibleTexts/bibleTexts.zod';
1
+ import type { BibleAudios } from '../data/bibleAudios/bibleAudios.zod';
2
+ import type { BibleTexts } from '../data/bibleTexts/bibleTexts.zod';
4
3
  import type { CurriculumQuestions } from '../data/curriculumQuestions/curriculumQuestions.zod';
5
- import { type Language } from '../data/languages/languages.zod';
6
- import { LessonPauses } from '../data/lessonPauses/lessonPauses.zod';
4
+ import type { Languages } from '../data/languages/languages.zod';
7
5
  import { Scripts } from '../data/scripts/scripts.zod';
8
6
  import { TranslationsApp } from '../data/translationsApp/translationsApp.zod';
9
7
  import type { TranslationsFtb } from '../data/translationsFtb/translationsFtb.zod';
@@ -11,52 +9,24 @@ import type { TranslationsIntroduction } from '../data/translationsIntroduction/
11
9
  import type { TranslationsQuestion } from '../data/translationsQuestion/translationsQuestion.zod';
12
10
  import type { TranslationsSet } from '../data/translationsSet/translationsSet.zod';
13
11
  import type { TranslationsSpokenQuestion } from '../data/translationsSpokenQuestion/translationsSpokenQuestion.zod';
12
+ type Language = Languages[number];
13
+ type BibleText = BibleTexts[number];
14
+ type BibleAudio = BibleAudios[number];
14
15
  export interface BibleInfo extends Omit<BibleText, 'language' | 'copyright'>, Omit<BibleAudio, 'language' | 'copyright'> {
15
16
  language: Language;
16
17
  availableTextChapters: string[];
17
- availableTimingsChapters: string[];
18
18
  availableAudioChapters: string[];
19
19
  fullCopyright: string;
20
20
  bookNames: Record<string, string>;
21
21
  script: Scripts[number];
22
22
  }
23
- declare const RequiredBridgeLanguages: z.ZodObject<{
24
- intros: z.ZodNonOptional<z.ZodOptional<z.ZodString>>;
25
- trainingVideos: z.ZodNonOptional<z.ZodOptional<z.ZodString>>;
26
- ftbs: z.ZodNonOptional<z.ZodOptional<z.ZodString>>;
27
- titles: z.ZodNonOptional<z.ZodOptional<z.ZodString>>;
28
- questionText: z.ZodNonOptional<z.ZodOptional<z.ZodString>>;
29
- questionAudio: z.ZodNonOptional<z.ZodOptional<z.ZodString>>;
30
- }, z.core.$strip>;
31
- type RequiredBridgeLanguages = z.infer<typeof RequiredBridgeLanguages>;
32
- export interface LanguageInfo extends Omit<Language, 'bible' | 'bibleFallbacks' | 'script' | 'bridgeLanguages'> {
33
- /** The set ids that make up this language's curriculum. */
23
+ export interface LanguageInfo extends Omit<Language, 'bible' | 'bibleFallback' | 'script'> {
34
24
  setIds: string[];
35
- /** The question sets available for this language. */
36
25
  questionSets: CurriculumQuestions[number]['questionSets'];
37
- /** The pauses that this language uses between different pieces of a lesson. */
38
- lessonPauses: LessonPauses;
39
- /**
40
- * A list of all bible ids used for a language, including bible fallbacks and
41
- * modifiers.
42
- */
43
- allBibleIds: string[];
44
- /**
45
- * Override {@link Language.bible} with an object containing more info about
46
- * the bible.
47
- */
48
26
  bible: BibleInfo;
49
- /**
50
- * Override {@link Language.bibleFallbacks} with an ordered list of fallback
51
- * bibles. Tried in order — the first bible that has the chapter is used.
52
- */
53
- bibleFallbacks: BibleInfo[];
54
- /**
55
- * Override {@link Language.script} with an object containing more info about
56
- * the script.
57
- */
27
+ bibleFallback: BibleInfo | undefined;
28
+ trainingVideoLanguage: string;
58
29
  script: Scripts[number];
59
- contentLanguages: RequiredBridgeLanguages;
60
30
  }
61
31
  export interface MeetTranslations {
62
32
  sets: TranslationsSet[string];
@@ -1,4 +1,2 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- const languages_zod_1 = require("../data/languages/languages.zod");
4
- const RequiredBridgeLanguages = languages_zod_1.BridgeLanguages.required();
@@ -1,10 +1,10 @@
1
- import { type SetCategory } from '../data/languages/languages.zod';
1
+ import { type Languages } from '../data/languages/languages.zod';
2
2
  import { type Sets } from '../data/sets/sets.zod';
3
- import { LanguageInfo } from './languages';
4
3
  export type Set = Sets[number];
5
4
  export type Lesson = Sets[number]['lessons'][number];
5
+ export type SetCategory = 'Foundations' | 'Topics' | 'WahaTraining';
6
6
  export interface SetInfo extends Set {
7
- languageId: string;
7
+ meetLanguageId: Languages[number]['languageId'];
8
8
  category: SetCategory;
9
9
  setNumber: string;
10
10
  setTitle?: string;
@@ -14,13 +14,14 @@ export interface SetInfo extends Set {
14
14
  setLink: string;
15
15
  }
16
16
  export interface Content {
17
+ languageId: string;
17
18
  id: string;
18
19
  localFileName: string;
19
20
  remoteFileName: string;
20
21
  path: string;
21
22
  url: string;
22
23
  }
23
- export interface BaseInfo extends LanguageInfo {
24
+ export interface BaseInfo {
24
25
  lessonNumber: string;
25
26
  lessonTitle: string | undefined;
26
27
  lessonLink: string;
@@ -32,33 +33,22 @@ export interface BaseInfo extends LanguageInfo {
32
33
  }
33
34
  export interface Section {
34
35
  id: string;
35
- languageId: string;
36
- header?: string;
37
- text?: string;
36
+ header: string | null;
37
+ text: string;
38
+ isChapter: boolean;
39
+ hasBeep: boolean;
38
40
  index: number;
39
41
  indexWithinChapter: number;
40
- chapter?: Chapter;
41
- /** Seconds of silence to insert before this section's audio. */
42
- pauseBefore?: number;
43
- /**
44
- * Filename for the "From the Book" clip to insert before this section, if
45
- * there is one.
46
- */
47
- ftbFileName?: string;
48
- fileName: string;
49
- }
50
- export interface EnrichedSection extends Section {
51
- startTime: number;
52
- length: number;
42
+ chapter: Chapter | null;
53
43
  }
54
44
  export interface DbsInfo extends BaseInfo, SetInfo, Lesson {
55
45
  type: 'dbs';
56
46
  full: Content;
57
- story: Content;
58
47
  dbsCast: {
59
48
  remoteFileName: string;
60
49
  url: string;
61
50
  };
51
+ introLength: number | undefined;
62
52
  passagesString: string;
63
53
  }
64
54
  export interface VideoInfo extends BaseInfo, SetInfo, Lesson {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "waha-shared",
3
- "version": "1.0.307",
3
+ "version": "1.0.308",
4
4
  "author": "Waha",
5
5
  "dependencies": {
6
6
  "@types/signale": "^1.4.7",
@@ -1 +0,0 @@
1
- export declare const firebaseUrl = "https://firebasestorage.googleapis.com/v0/b/waha-app-db.appspot.com/o/";
@@ -1,4 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.firebaseUrl = void 0;
4
- exports.firebaseUrl = 'https://firebasestorage.googleapis.com/v0/b/waha-app-db.appspot.com/o/';
@@ -1,16 +0,0 @@
1
- import { BibleTestament } from '../data/languages/languages.zod';
2
- export declare const OLD_TESTAMENT_BOOKS: Set<string>;
3
- export declare const NEW_TESTAMENT_BOOKS: Set<string>;
4
- export interface VerseRangeInfo {
5
- book: string;
6
- chapter: string;
7
- startVerse: string;
8
- endVerse: string;
9
- chapterId: string;
10
- chapterIdUnderscore: string;
11
- testament: BibleTestament;
12
- chapterAudioFileName: string;
13
- chapterJsonFileName: string;
14
- }
15
- /** Parses a verse range string like "GEN.1.1-GEN.1.25" or "JHN.3.16". */
16
- export declare function parseVerseRange(passageId: string): VerseRangeInfo;
@@ -1,101 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.NEW_TESTAMENT_BOOKS = exports.OLD_TESTAMENT_BOOKS = void 0;
4
- exports.parseVerseRange = parseVerseRange;
5
- // Old Testament books
6
- exports.OLD_TESTAMENT_BOOKS = new Set([
7
- 'GEN',
8
- 'EXO',
9
- 'LEV',
10
- 'NUM',
11
- 'DEU',
12
- 'JOS',
13
- 'JDG',
14
- 'RUT',
15
- '1SA',
16
- '2SA',
17
- '1KI',
18
- '2KI',
19
- '1CH',
20
- '2CH',
21
- 'EZR',
22
- 'NEH',
23
- 'EST',
24
- 'JOB',
25
- 'PSA',
26
- 'PRO',
27
- 'ECC',
28
- 'SNG',
29
- 'ISA',
30
- 'JER',
31
- 'LAM',
32
- 'EZK',
33
- 'DAN',
34
- 'HOS',
35
- 'JOL',
36
- 'AMO',
37
- 'OBA',
38
- 'JON',
39
- 'MIC',
40
- 'NAM',
41
- 'HAB',
42
- 'ZEP',
43
- 'HAG',
44
- 'ZEC',
45
- 'MAL',
46
- ]);
47
- // New Testament books
48
- exports.NEW_TESTAMENT_BOOKS = new Set([
49
- 'MAT',
50
- 'MRK',
51
- 'LUK',
52
- 'JHN',
53
- 'ACT',
54
- 'ROM',
55
- '1CO',
56
- '2CO',
57
- 'GAL',
58
- 'EPH',
59
- 'PHP',
60
- 'COL',
61
- '1TH',
62
- '2TH',
63
- '1TI',
64
- '2TI',
65
- 'TIT',
66
- 'PHM',
67
- 'HEB',
68
- 'JAS',
69
- '1PE',
70
- '2PE',
71
- '1JN',
72
- '2JN',
73
- '3JN',
74
- 'JUD',
75
- 'REV',
76
- ]);
77
- /** Parses a verse range string like "GEN.1.1-GEN.1.25" or "JHN.3.16". */
78
- function parseVerseRange(passageId) {
79
- // Handle single verse: "GEN.1.1" -> "GEN.1.1-GEN.1.1"
80
- const parts = passageId.includes('-')
81
- ? passageId.split('-')
82
- : [passageId, passageId];
83
- const startParts = parts[0].split('.');
84
- const endParts = parts[1].split('.');
85
- const book = startParts[0];
86
- const chapter = startParts[1];
87
- const startVerse = startParts.length > 2 ? startParts[2] : '1';
88
- const endVerse = endParts.length > 2 ? endParts[2] : '1';
89
- const chapterIdUnderscore = `${book}_${chapter.padStart(3, '0')}`;
90
- return {
91
- book,
92
- chapter,
93
- startVerse,
94
- endVerse,
95
- chapterId: `${book}.${chapter}`,
96
- testament: exports.OLD_TESTAMENT_BOOKS.has(book) ? 'OT' : 'NT',
97
- chapterIdUnderscore,
98
- chapterAudioFileName: `${chapterIdUnderscore}.mp3`,
99
- chapterJsonFileName: `${chapterIdUnderscore}.json`,
100
- };
101
- }
@@ -1,44 +0,0 @@
1
- import type { BibleModifier, Language, SetCategory } from '../data/languages/languages.zod';
2
- import { BibleInfo, LanguageInfo } from '../types/languages';
3
- export declare function getBibleInfo(bibleId: string): BibleInfo | undefined;
4
- export declare function replaceBibleWith({ modifiers, lessonCategory, passageId, }: {
5
- modifiers: BibleModifier[];
6
- lessonCategory: SetCategory | undefined;
7
- passageId: string;
8
- }): string | undefined;
9
- /** Determines whether a lesson/passage meet the requirements for concatenating. */
10
- export declare function shouldConcatBibleWith({ modifier, lessonCategory, passageId, }: {
11
- modifier: BibleModifier;
12
- lessonCategory: SetCategory;
13
- passageId: string;
14
- }): boolean;
15
- /** Returns a deduplicated list of all bible IDs referenced by a language. */
16
- export declare function getAllBibleIds(language: LanguageInfo | Language): string[];
17
- /**
18
- * Chapters that can be missing without affecting book/testament completeness.
19
- * MAL.4 is optional because the Hebrew Bible includes its content within
20
- * MAL.3.
21
- */
22
- export declare const OPTIONAL_CHAPTERS: Set<string>;
23
- export { NEW_TESTAMENT_BOOKS, OLD_TESTAMENT_BOOKS } from './bibleBooks';
24
- /**
25
- * Expands an optimized chapter list back to individual chapters Converts book
26
- * names (e.g., "GEN") back to all chapters (e.g., ["GEN.1", "GEN.2", ..."])
27
- * Converts testament names ("OT", "NT") back to all chapters in that testament
28
- * Leaves individual chapters unchanged
29
- *
30
- * @param optimizedChapters - Array that may contain testament IDs, book IDs, or
31
- * chapter IDs
32
- * @returns Array of individual chapter IDs in canonical order
33
- */
34
- export declare function getAvailableChapters(bibleId: string | undefined, type: 'text' | 'audio' | 'timings'): string[];
35
- export declare function getPercentage(bibleId: string, type: 'text' | 'audio' | 'timings'): number;
36
- /**
37
- * Determines the appropriate bible for a given passage based on the language's
38
- * bible, bible modifiers, and fallback bible.
39
- */
40
- export declare function getBibleForPassage({ languageInfo, lessonCategory, passageId, }: {
41
- languageInfo: LanguageInfo;
42
- lessonCategory: SetCategory | undefined;
43
- passageId: string;
44
- }): string;
@@ -1,291 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.OLD_TESTAMENT_BOOKS = exports.NEW_TESTAMENT_BOOKS = exports.OPTIONAL_CHAPTERS = void 0;
4
- exports.getBibleInfo = getBibleInfo;
5
- exports.replaceBibleWith = replaceBibleWith;
6
- exports.shouldConcatBibleWith = shouldConcatBibleWith;
7
- exports.getAllBibleIds = getAllBibleIds;
8
- exports.getAvailableChapters = getAvailableChapters;
9
- exports.getPercentage = getPercentage;
10
- exports.getBibleForPassage = getBibleForPassage;
11
- const bibleAudios_1 = require("../data/bibleAudios");
12
- const bibleChaptersList_1 = require("../data/bibleChaptersList");
13
- const bibleStatuses_1 = require("../data/bibleStatuses");
14
- const bibleTexts_1 = require("../data/bibleTexts");
15
- const languages_1 = require("../data/languages");
16
- const scripts_1 = require("../data/scripts");
17
- const bibleBooks_1 = require("./bibleBooks");
18
- const bibleInfoCache = new Map();
19
- function getBibleInfo(bibleId) {
20
- const cached = bibleInfoCache.get(bibleId);
21
- if (cached !== undefined)
22
- return cached;
23
- if (bibleInfoCache.has(bibleId))
24
- return undefined;
25
- const bibleStatus = bibleStatuses_1.bibleStatuses[bibleId];
26
- if (!bibleStatus) {
27
- bibleInfoCache.set(bibleId, undefined);
28
- return undefined;
29
- }
30
- const bibleText = bibleTexts_1.bibleTexts.find((t) => t.bibleTextId === bibleId);
31
- const bibleAudio = bibleAudios_1.bibleAudios.find((t) => t.bibleAudioId === bibleText?.audioId ||
32
- t.bibleAudioId === bibleText?.bibleTextId);
33
- const language = languages_1.languages.find((l) => l.languageId === bibleText?.languageId);
34
- const script = scripts_1.scripts.find((s) => s.name === language?.script) ?? scripts_1.scripts[0];
35
- const result = bibleText && bibleAudio && language
36
- ? {
37
- ...bibleText,
38
- ...bibleAudio,
39
- language,
40
- script,
41
- availableTextChapters: getAvailableChapters(bibleText.bibleTextId, 'text'),
42
- availableAudioChapters: getAvailableChapters(bibleAudio.bibleAudioId, 'audio'),
43
- availableTimingsChapters: getAvailableChapters(bibleAudio.bibleAudioId, 'timings'),
44
- bookNames: {
45
- ...(bibleText.bookNameFallback
46
- ? (bibleStatuses_1.bibleStatuses[bibleText.bookNameFallback]?.bookNames ?? {})
47
- : {}),
48
- ...bibleStatus.bookNames,
49
- },
50
- fullCopyright: (bibleText.copyright ?? '') + '\n\n' + (bibleAudio.copyright ?? ''),
51
- }
52
- : undefined;
53
- bibleInfoCache.set(bibleId, result);
54
- return result;
55
- }
56
- function replaceBibleWith({ modifiers, lessonCategory, passageId, }) {
57
- for (const modifier of modifiers) {
58
- if (modifier.action === 'concat')
59
- continue;
60
- /**
61
- * If our modifier matches the lesson category or passage testament, then we
62
- * want to replace the bible id.
63
- */
64
- if (modifier.scope === lessonCategory ||
65
- modifier.scope === (0, bibleBooks_1.parseVerseRange)(passageId).testament)
66
- return modifier.bibleId;
67
- }
68
- return undefined;
69
- }
70
- /** Determines whether a lesson/passage meet the requirements for concatenating. */
71
- function shouldConcatBibleWith({ modifier, lessonCategory, passageId, }) {
72
- if (modifier.action === 'replace')
73
- return false;
74
- /**
75
- * If our modifier matches the lesson category or passage testament, then we
76
- * are good to concat.
77
- */
78
- if (modifier.scope === lessonCategory ||
79
- modifier.scope === (0, bibleBooks_1.parseVerseRange)(passageId).testament)
80
- return true;
81
- else
82
- return false;
83
- }
84
- /** Returns a deduplicated list of all bible IDs referenced by a language. */
85
- function getAllBibleIds(language) {
86
- const ids = new Set();
87
- if (typeof language.bible === 'object')
88
- ids.add(language.bible.bibleTextId);
89
- else if (language.bible)
90
- ids.add(language.bible);
91
- for (const fallback of language.bibleFallbacks ?? []) {
92
- if (typeof fallback === 'object')
93
- ids.add(fallback.bibleTextId);
94
- else
95
- ids.add(fallback);
96
- }
97
- for (const modifier of language.bibleModifiers ?? []) {
98
- ids.add(modifier.bibleId);
99
- }
100
- return [...ids];
101
- }
102
- /**
103
- * Chapters that can be missing without affecting book/testament completeness.
104
- * MAL.4 is optional because the Hebrew Bible includes its content within
105
- * MAL.3.
106
- */
107
- exports.OPTIONAL_CHAPTERS = new Set(['MAL.4']);
108
- var bibleBooks_2 = require("./bibleBooks");
109
- Object.defineProperty(exports, "NEW_TESTAMENT_BOOKS", { enumerable: true, get: function () { return bibleBooks_2.NEW_TESTAMENT_BOOKS; } });
110
- Object.defineProperty(exports, "OLD_TESTAMENT_BOOKS", { enumerable: true, get: function () { return bibleBooks_2.OLD_TESTAMENT_BOOKS; } });
111
- const bookLengths = new Map([
112
- ['GEN', 50],
113
- ['EXO', 40],
114
- ['LEV', 27],
115
- ['NUM', 36],
116
- ['DEU', 34],
117
- ['JOS', 24],
118
- ['JDG', 21],
119
- ['RUT', 4],
120
- ['1SA', 31],
121
- ['2SA', 24],
122
- ['1KI', 22],
123
- ['2KI', 25],
124
- ['1CH', 29],
125
- ['2CH', 36],
126
- ['EZR', 10],
127
- ['NEH', 13],
128
- ['EST', 10],
129
- ['JOB', 42],
130
- ['PSA', 150],
131
- ['PRO', 31],
132
- ['ECC', 12],
133
- ['SNG', 8],
134
- ['ISA', 66],
135
- ['JER', 52],
136
- ['LAM', 5],
137
- ['EZK', 48],
138
- ['DAN', 12],
139
- ['HOS', 14],
140
- ['JOL', 3],
141
- ['AMO', 9],
142
- ['OBA', 1],
143
- ['JON', 4],
144
- ['MIC', 7],
145
- ['NAM', 3],
146
- ['HAB', 3],
147
- ['ZEP', 3],
148
- ['HAG', 2],
149
- ['ZEC', 14],
150
- ['MAL', 3],
151
- ['MAT', 28],
152
- ['MRK', 16],
153
- ['LUK', 24],
154
- ['JHN', 21],
155
- ['ACT', 28],
156
- ['ROM', 16],
157
- ['1CO', 16],
158
- ['2CO', 13],
159
- ['GAL', 6],
160
- ['EPH', 6],
161
- ['PHP', 4],
162
- ['COL', 4],
163
- ['1TH', 5],
164
- ['2TH', 3],
165
- ['1TI', 6],
166
- ['2TI', 4],
167
- ['TIT', 3],
168
- ['PHM', 1],
169
- ['HEB', 13],
170
- ['JAS', 5],
171
- ['1PE', 5],
172
- ['2PE', 3],
173
- ['1JN', 5],
174
- ['2JN', 1],
175
- ['3JN', 1],
176
- ['JUD', 1],
177
- ['REV', 22],
178
- ]);
179
- /**
180
- * Expands an optimized chapter list back to individual chapters Converts book
181
- * names (e.g., "GEN") back to all chapters (e.g., ["GEN.1", "GEN.2", ..."])
182
- * Converts testament names ("OT", "NT") back to all chapters in that testament
183
- * Leaves individual chapters unchanged
184
- *
185
- * @param optimizedChapters - Array that may contain testament IDs, book IDs, or
186
- * chapter IDs
187
- * @returns Array of individual chapter IDs in canonical order
188
- */
189
- function getAvailableChapters(bibleId, type) {
190
- if (!bibleId)
191
- return [];
192
- const optimizedChapters = bibleStatuses_1.bibleStatuses[bibleId]?.[type] || [];
193
- if (optimizedChapters.length === 0)
194
- return [];
195
- // Build a Set of included items for O(1) lookup
196
- const includedSet = new Set(optimizedChapters);
197
- // Check if we need OT/NT expansion
198
- const hasOT = includedSet.has('OT');
199
- const hasNT = includedSet.has('NT');
200
- // If we have both OT and NT, return all chapters but exclude optional
201
- // chapters unless they are explicitly listed in the optimized list
202
- if (hasOT && hasNT) {
203
- return bibleChaptersList_1.bibleChaptersList.filter((c) => !exports.OPTIONAL_CHAPTERS.has(c) || includedSet.has(c));
204
- }
205
- // Pre-calculate which books to include
206
- const includedBooks = new Set();
207
- if (hasOT) {
208
- bibleBooks_1.OLD_TESTAMENT_BOOKS.forEach((book) => includedBooks.add(book));
209
- }
210
- if (hasNT) {
211
- bibleBooks_1.NEW_TESTAMENT_BOOKS.forEach((book) => includedBooks.add(book));
212
- }
213
- // Add individual books from the optimized list
214
- for (const entry of optimizedChapters) {
215
- if (entry !== 'OT' && entry !== 'NT' && !entry.includes('.')) {
216
- includedBooks.add(entry);
217
- }
218
- }
219
- // Filter bibleChaptersList to only include relevant chapters
220
- // This maintains canonical order without needing to sort
221
- const result = [];
222
- for (const chapter of bibleChaptersList_1.bibleChaptersList) {
223
- // Check if this specific chapter is included
224
- if (includedSet.has(chapter)) {
225
- result.push(chapter);
226
- continue;
227
- }
228
- // Skip optional chapters unless explicitly listed
229
- if (exports.OPTIONAL_CHAPTERS.has(chapter))
230
- continue;
231
- // Check if this chapter's book is included
232
- const bookId = chapter.split('.')[0];
233
- if (includedBooks.has(bookId)) {
234
- result.push(chapter);
235
- }
236
- }
237
- return result;
238
- }
239
- function getPercentage(bibleId, type) {
240
- const optimizedChapters = bibleStatuses_1.bibleStatuses[bibleId]?.[type] || [];
241
- let total = 0;
242
- optimizedChapters.forEach((entry) => {
243
- if (entry === 'OT') {
244
- // All Old Testament books (excluding optional chapters like MAL.4)
245
- total += 928;
246
- }
247
- else if (entry === 'NT') {
248
- // All New Testament books
249
- total += 260;
250
- }
251
- else if (entry.includes('.')) {
252
- // It's already a chapter ID, count as 1
253
- total += 1;
254
- }
255
- else {
256
- // It's a book ID, add its chapter count
257
- total += bookLengths.get(entry) || 0;
258
- }
259
- });
260
- return (total / 1188) * 100;
261
- }
262
- /**
263
- * Determines the appropriate bible for a given passage based on the language's
264
- * bible, bible modifiers, and fallback bible.
265
- */
266
- function getBibleForPassage({ languageInfo, lessonCategory, passageId, }) {
267
- let bibleId = replaceBibleWith({
268
- modifiers: languageInfo.bibleModifiers ?? [],
269
- lessonCategory,
270
- passageId,
271
- }) ?? languageInfo.bible.bibleTextId;
272
- const passageInfo = (0, bibleBooks_1.parseVerseRange)(passageId);
273
- const bibleInfo = getBibleInfo(bibleId);
274
- /**
275
- * A bible can provide a passage either via full chapter audio (we'll extract
276
- * the verse range using timings) or via a custom recording keyed by the exact
277
- * passageId. The latter is essential for bibles like WAHA_QAK that have no
278
- * chapter audio at all and only ship hand-recorded passages.
279
- */
280
- const hasPassage = (id, info) => info.availableAudioChapters.includes(passageInfo.chapterId) ||
281
- bibleStatuses_1.bibleStatuses[id]?.customPassages?.[passageId] !== undefined;
282
- if (bibleInfo && !hasPassage(bibleId, bibleInfo)) {
283
- for (const fallback of languageInfo.bibleFallbacks) {
284
- if (hasPassage(fallback.bibleTextId, fallback)) {
285
- bibleId = fallback.bibleTextId;
286
- break;
287
- }
288
- }
289
- }
290
- return bibleId;
291
- }
@@ -1,2 +0,0 @@
1
- export declare const join: (...parts: string[]) => string;
2
- export declare const firebasePath: (path: string) => string;
@@ -1,8 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.firebasePath = exports.join = void 0;
4
- const firebase_1 = require("../data/firebase");
5
- const join = (...parts) => parts.join('/').replace(/\/+/g, '/');
6
- exports.join = join;
7
- const firebasePath = (path) => firebase_1.firebaseUrl + encodeURIComponent(path) + `?alt=media`;
8
- exports.firebasePath = firebasePath;