@helloao/tools 0.0.6 → 0.0.10
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.
- package/dist/cjs/generation/api.cjs +366 -0
- package/dist/cjs/generation/api.cjs.map +7 -0
- package/dist/cjs/generation/audio.cjs +83 -0
- package/dist/cjs/generation/audio.cjs.map +7 -0
- package/dist/cjs/generation/book-order.cjs +508 -0
- package/dist/cjs/generation/book-order.cjs.map +7 -0
- package/dist/cjs/generation/common-types.cjs +17 -0
- package/dist/cjs/generation/common-types.cjs.map +7 -0
- package/dist/cjs/generation/dataset.cjs +238 -0
- package/dist/cjs/generation/dataset.cjs.map +7 -0
- package/dist/cjs/generation/index.cjs +51 -0
- package/dist/cjs/generation/index.cjs.map +7 -0
- package/dist/cjs/index.cjs +45 -0
- package/dist/cjs/index.cjs.map +7 -0
- package/dist/cjs/parser/codex-parser.cjs +187 -0
- package/dist/cjs/parser/codex-parser.cjs.map +7 -0
- package/dist/cjs/parser/commentary-csv-parser.cjs +133 -0
- package/dist/cjs/parser/commentary-csv-parser.cjs.map +7 -0
- package/dist/cjs/parser/index.cjs +50 -0
- package/dist/cjs/parser/index.cjs.map +7 -0
- package/dist/cjs/parser/iterators.cjs +204 -0
- package/dist/cjs/parser/iterators.cjs.map +7 -0
- package/dist/cjs/parser/types.cjs +17 -0
- package/dist/cjs/parser/types.cjs.map +7 -0
- package/dist/cjs/parser/usfm-parser.cjs +791 -0
- package/dist/cjs/parser/usfm-parser.cjs.map +7 -0
- package/dist/cjs/parser/usx-parser.cjs +483 -0
- package/dist/cjs/parser/usx-parser.cjs.map +7 -0
- package/dist/cjs/utils.cjs +237 -0
- package/dist/cjs/utils.cjs.map +7 -0
- package/dist/esm/generation/api.js +320 -0
- package/dist/esm/generation/api.js.map +7 -0
- package/dist/esm/generation/audio.js +53 -0
- package/dist/esm/generation/audio.js.map +7 -0
- package/dist/esm/generation/book-order.js +478 -0
- package/dist/esm/generation/book-order.js.map +7 -0
- package/dist/esm/generation/common-types.js +2 -0
- package/dist/esm/generation/common-types.js.map +7 -0
- package/dist/esm/generation/dataset.js +212 -0
- package/dist/esm/generation/dataset.js.map +7 -0
- package/dist/esm/generation/index.js +8 -0
- package/dist/esm/generation/index.js.map +7 -0
- package/dist/esm/index.js +6 -0
- package/dist/esm/index.js.map +7 -0
- package/dist/esm/parser/codex-parser.js +151 -0
- package/dist/esm/parser/codex-parser.js.map +7 -0
- package/dist/esm/parser/commentary-csv-parser.js +107 -0
- package/dist/esm/parser/commentary-csv-parser.js.map +7 -0
- package/dist/esm/parser/index.js +9 -0
- package/dist/esm/parser/index.js.map +7 -0
- package/dist/esm/parser/iterators.js +152 -0
- package/dist/esm/parser/iterators.js.map +7 -0
- package/dist/esm/parser/types.js +2 -0
- package/dist/esm/parser/types.js.map +7 -0
- package/dist/esm/parser/usfm-parser.js +749 -0
- package/dist/esm/parser/usfm-parser.js.map +7 -0
- package/dist/esm/parser/usx-parser.js +459 -0
- package/dist/esm/parser/usx-parser.js.map +7 -0
- package/dist/esm/utils.js +201 -0
- package/dist/esm/utils.js.map +7 -0
- package/{generation → dist/types/generation}/api.d.ts +148 -2
- package/{generation → dist/types/generation}/audio.d.ts +1 -1
- package/{generation → dist/types/generation}/common-types.d.ts +121 -24
- package/{generation → dist/types/generation}/dataset.d.ts +23 -1
- package/dist/types/generation/index.d.ts +7 -0
- package/dist/types/index.d.ts +5 -0
- package/{parser → dist/types/parser}/codex-parser.d.ts +51 -8
- package/dist/types/parser/commentary-csv-parser.d.ts +12 -0
- package/dist/types/parser/index.d.ts +8 -0
- package/{parser → dist/types/parser}/types.d.ts +28 -1
- package/{parser → dist/types/parser}/usfm-parser.d.ts +1 -1
- package/{parser → dist/types/parser}/usx-parser.d.ts +3 -3
- package/{utils.d.ts → dist/types/utils.d.ts} +6 -0
- package/package.json +27 -4
- package/generation/api.js +0 -187
- package/generation/api.spec.d.ts +0 -2
- package/generation/api.spec.js +0 -620
- package/generation/audio.js +0 -60
- package/generation/audio.spec.d.ts +0 -2
- package/generation/audio.spec.js +0 -36
- package/generation/book-order.js +0 -494
- package/generation/book-order.spec.d.ts +0 -2
- package/generation/book-order.spec.js +0 -8
- package/generation/common-types.js +0 -2
- package/generation/dataset.js +0 -106
- package/generation/index.d.ts +0 -7
- package/generation/index.js +0 -38
- package/index.d.ts +0 -5
- package/index.js +0 -32
- package/parser/codex-parser.js +0 -160
- package/parser/codex-parser.spec.d.ts +0 -2
- package/parser/codex-parser.spec.js +0 -645
- package/parser/index.d.ts +0 -7
- package/parser/index.js +0 -35
- package/parser/iterators.js +0 -222
- package/parser/iterators.spec.d.ts +0 -2
- package/parser/iterators.spec.js +0 -174
- package/parser/types.js +0 -2
- package/parser/usfm-parser.js +0 -840
- package/parser/usfm-parser.spec.d.ts +0 -2
- package/parser/usfm-parser.spec.js +0 -1593
- package/parser/usx-parser.js +0 -486
- package/parser/usx-parser.spec.d.ts +0 -2
- package/parser/usx-parser.spec.js +0 -1260
- package/utils.js +0 -73
- package/utils.spec.d.ts +0 -2
- package/utils.spec.js +0 -42
- /package/{generation → dist/types/generation}/book-order.d.ts +0 -0
- /package/{parser → dist/types/parser}/iterators.d.ts +0 -0
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
export function normalizeLanguage(language) {
|
|
3
|
+
return language;
|
|
4
|
+
}
|
|
5
|
+
const TRANSLATION_ID_MAP = /* @__PURE__ */ new Map([
|
|
6
|
+
["eng_bsb", "BSB"],
|
|
7
|
+
["arb_nav", "ARBNAV"],
|
|
8
|
+
["eng_webp", "ENGWEBP"],
|
|
9
|
+
["hin_irv", "HINIRV"],
|
|
10
|
+
["hbo_mas", "HBOMAS"]
|
|
11
|
+
]);
|
|
12
|
+
export function getTranslationId(translationId) {
|
|
13
|
+
return TRANSLATION_ID_MAP.get(translationId) ?? translationId;
|
|
14
|
+
}
|
|
15
|
+
export function isEmptyOrWhitespace(str) {
|
|
16
|
+
return !str || /^\s*$/.test(str);
|
|
17
|
+
}
|
|
18
|
+
export function getFirstNonEmpty(...values) {
|
|
19
|
+
for (let value of values) {
|
|
20
|
+
if (!isEmptyOrWhitespace(value)) {
|
|
21
|
+
return value;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
throw new Error("All values are empty or whitespace!");
|
|
25
|
+
}
|
|
26
|
+
export function parseVerseReference(text) {
|
|
27
|
+
const match = text.match(/^\s*([0-9A-Za-z\s]+)\s+(\d+):(\d+)/);
|
|
28
|
+
if (!match) {
|
|
29
|
+
return null;
|
|
30
|
+
}
|
|
31
|
+
const [reference, book, chapterStr, verseStr] = match;
|
|
32
|
+
const chapter = parseInt(chapterStr);
|
|
33
|
+
const verse = parseInt(verseStr);
|
|
34
|
+
if (isNaN(chapter) || isNaN(verse)) {
|
|
35
|
+
return null;
|
|
36
|
+
}
|
|
37
|
+
if (reference.length !== text.length) {
|
|
38
|
+
return {
|
|
39
|
+
book: getBookId(book) ?? book,
|
|
40
|
+
chapter,
|
|
41
|
+
verse,
|
|
42
|
+
content: text.substring(reference.length).trim()
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
return {
|
|
46
|
+
book: getBookId(book) ?? book,
|
|
47
|
+
chapter,
|
|
48
|
+
verse
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
const BOOK_ID_MAP = /* @__PURE__ */ new Map([
|
|
52
|
+
["gen", "GEN"],
|
|
53
|
+
["genesis", "GEN"],
|
|
54
|
+
["exo", "EXO"],
|
|
55
|
+
["exodus", "EXO"],
|
|
56
|
+
["lev", "LEV"],
|
|
57
|
+
["lev", "LEV"],
|
|
58
|
+
["laviticus", "LEV"],
|
|
59
|
+
["num", "NUM"],
|
|
60
|
+
["numbers", "NUM"],
|
|
61
|
+
["deu", "DEU"],
|
|
62
|
+
["deuteronomy", "DEU"],
|
|
63
|
+
["jos", "JOS"],
|
|
64
|
+
["joshua", "JOS"],
|
|
65
|
+
["jdg", "JDG"],
|
|
66
|
+
["judges", "JDG"],
|
|
67
|
+
["rut", "RUT"],
|
|
68
|
+
["ruth", "RUT"],
|
|
69
|
+
["1sa", "1SA"],
|
|
70
|
+
["1samuel", "1SA"],
|
|
71
|
+
["2sa", "2SA"],
|
|
72
|
+
["2samuel", "2SA"],
|
|
73
|
+
["1ki", "1KI"],
|
|
74
|
+
["1kings", "1KI"],
|
|
75
|
+
["2ki", "2KI"],
|
|
76
|
+
["2kings", "2KI"],
|
|
77
|
+
["1ch", "1CH"],
|
|
78
|
+
["1chronicles", "1CH"],
|
|
79
|
+
["chronicles1", "1CH"],
|
|
80
|
+
["2ch", "2CH"],
|
|
81
|
+
["2chronicles", "2CH"],
|
|
82
|
+
["chronicles2", "2CH"],
|
|
83
|
+
["ezr", "EZR"],
|
|
84
|
+
["ezra", "EZR"],
|
|
85
|
+
["neh", "NEH"],
|
|
86
|
+
["nehemiah", "NEH"],
|
|
87
|
+
["est", "EST"],
|
|
88
|
+
["ester", "EST"],
|
|
89
|
+
["job", "JOB"],
|
|
90
|
+
["psa", "PSA"],
|
|
91
|
+
["psalms", "PSA"],
|
|
92
|
+
["psalm", "PSA"],
|
|
93
|
+
["pro", "PRO"],
|
|
94
|
+
["proverbs", "PRO"],
|
|
95
|
+
["ecc", "ECC"],
|
|
96
|
+
["ecclesiastes", "ECC"],
|
|
97
|
+
["sng", "SNG"],
|
|
98
|
+
["songofsolomon", "SNG"],
|
|
99
|
+
["isa", "ISA"],
|
|
100
|
+
["isaiah", "ISA"],
|
|
101
|
+
["jer", "JER"],
|
|
102
|
+
["jeremiah", "JER"],
|
|
103
|
+
["lam", "LAM"],
|
|
104
|
+
["lamentations", "LAM"],
|
|
105
|
+
["ezk", "EZK"],
|
|
106
|
+
["ezekiel", "EZK"],
|
|
107
|
+
["dan", "DAN"],
|
|
108
|
+
["daniel", "DAN"],
|
|
109
|
+
["hos", "HOS"],
|
|
110
|
+
["hosea", "HOS"],
|
|
111
|
+
["jol", "JOL"],
|
|
112
|
+
["joel", "JOL"],
|
|
113
|
+
["amo", "AMO"],
|
|
114
|
+
["amos", "AMO"],
|
|
115
|
+
["oba", "OBA"],
|
|
116
|
+
["obadiah", "OBA"],
|
|
117
|
+
["jon", "JON"],
|
|
118
|
+
["jonah", "JON"],
|
|
119
|
+
["mic", "MIC"],
|
|
120
|
+
["micah", "MIC"],
|
|
121
|
+
["nam", "NAM"],
|
|
122
|
+
["nahum", "NAM"],
|
|
123
|
+
["hab", "HAB"],
|
|
124
|
+
["habakkuk", "HAB"],
|
|
125
|
+
["zep", "ZEP"],
|
|
126
|
+
["zepaniah", "ZEP"],
|
|
127
|
+
["hag", "HAG"],
|
|
128
|
+
["haggai", "HAG"],
|
|
129
|
+
["zec", "ZEC"],
|
|
130
|
+
["zechariah", "ZEC"],
|
|
131
|
+
["mal", "MAL"],
|
|
132
|
+
["malachi", "MAL"],
|
|
133
|
+
["mat", "MAT"],
|
|
134
|
+
["matthew", "MAT"],
|
|
135
|
+
["mrk", "MRK"],
|
|
136
|
+
["mark", "MRK"],
|
|
137
|
+
["luk", "LUK"],
|
|
138
|
+
["luke", "LUK"],
|
|
139
|
+
["jhn", "JHN"],
|
|
140
|
+
["john", "JHN"],
|
|
141
|
+
["act", "ACT"],
|
|
142
|
+
["acts", "ACT"],
|
|
143
|
+
["rom", "ROM"],
|
|
144
|
+
["romans", "ROM"],
|
|
145
|
+
["1co", "1CO"],
|
|
146
|
+
["1corinthians", "1CO"],
|
|
147
|
+
["2co", "2CO"],
|
|
148
|
+
["2corinthians", "2CO"],
|
|
149
|
+
["gal", "GAL"],
|
|
150
|
+
["galatians", "GAL"],
|
|
151
|
+
["eph", "EPH"],
|
|
152
|
+
["ephesians", "EPH"],
|
|
153
|
+
["php", "PHP"],
|
|
154
|
+
["philippians", "PHP"],
|
|
155
|
+
["col", "COL"],
|
|
156
|
+
["colossians", "COL"],
|
|
157
|
+
["1th", "1TH"],
|
|
158
|
+
["1thessalonians", "1TH"],
|
|
159
|
+
["2th", "2TH"],
|
|
160
|
+
["2thessalonians", "2TH"],
|
|
161
|
+
["1ti", "1TI"],
|
|
162
|
+
["1timothy", "1TI"],
|
|
163
|
+
["2ti", "2TI"],
|
|
164
|
+
["2timothy", "2TI"],
|
|
165
|
+
["tit", "TIT"],
|
|
166
|
+
["titus", "TIT"],
|
|
167
|
+
["phm", "PHM"],
|
|
168
|
+
["philemon", "PHM"],
|
|
169
|
+
["heb", "HEB"],
|
|
170
|
+
["hebrews", "HEB"],
|
|
171
|
+
["jas", "JAS"],
|
|
172
|
+
["james", "JAS"],
|
|
173
|
+
["1pe", "1PE"],
|
|
174
|
+
["1peter", "1PE"],
|
|
175
|
+
["2pe", "2PE"],
|
|
176
|
+
["2peter", "2PE"],
|
|
177
|
+
["1jn", "1JN"],
|
|
178
|
+
["1john", "1JN"],
|
|
179
|
+
["2jn", "2JN"],
|
|
180
|
+
["2john", "2JN"],
|
|
181
|
+
["3jn", "3JN"],
|
|
182
|
+
["3john", "3JN"],
|
|
183
|
+
["jud", "JUD"],
|
|
184
|
+
["jude", "JUD"],
|
|
185
|
+
["rev", "REV"],
|
|
186
|
+
["revelation", "REV"]
|
|
187
|
+
]);
|
|
188
|
+
export function getBookId(book) {
|
|
189
|
+
const bookLower = book.toLowerCase().replaceAll(/\s+/g, "");
|
|
190
|
+
const id = BOOK_ID_MAP.get(bookLower);
|
|
191
|
+
if (id) {
|
|
192
|
+
return id;
|
|
193
|
+
}
|
|
194
|
+
for (let [key, id2] of BOOK_ID_MAP) {
|
|
195
|
+
if (bookLower.startsWith(key)) {
|
|
196
|
+
return id2;
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
return null;
|
|
200
|
+
}
|
|
201
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../utils.ts"],
|
|
4
|
+
"sourcesContent": ["/**\r\n * Normalizes the given language code into a ISO 639 code.\r\n * @param language The language code to normalize.\r\n */\r\nexport function normalizeLanguage(language: string): string {\r\n return language;\r\n}\r\n\r\n/**\r\n * The map of translation IDs from fetch.bible to their translation ID in the API.\r\n */\r\nconst TRANSLATION_ID_MAP: Map<string, string> = new Map([\r\n ['eng_bsb', 'BSB'],\r\n ['arb_nav', 'ARBNAV'],\r\n ['eng_webp', 'ENGWEBP'],\r\n ['hin_irv', 'HINIRV'],\r\n ['hbo_mas', 'HBOMAS'],\r\n]);\r\n\r\n/**\r\n * Gets the ID of the translation.\r\n * @param translation The translation to get the ID for.\r\n */\r\nexport function getTranslationId(translationId: string): string {\r\n return TRANSLATION_ID_MAP.get(translationId) ?? translationId;\r\n}\r\n\r\nexport function isEmptyOrWhitespace(str: string | null | undefined): boolean {\r\n return !str || /^\\s*$/.test(str);\r\n}\r\n\r\nexport function getFirstNonEmpty<T extends string>(...values: T[]): T {\r\n for (let value of values) {\r\n if (!isEmptyOrWhitespace(value)) {\r\n return value;\r\n }\r\n }\r\n\r\n throw new Error('All values are empty or whitespace!');\r\n}\r\n\r\nexport interface VerseRef {\r\n book: string;\r\n chapter: number;\r\n verse: number;\r\n\r\n /**\r\n * The rest of the content of the verse.\r\n */\r\n content?: string;\r\n}\r\n\r\n/**\r\n * Parses the given verse reference.\r\n * Formatted like \"GEN 1:1\".\r\n *\r\n * @param text The reference to parse.\r\n */\r\nexport function parseVerseReference(text: string): VerseRef | null {\r\n const match = text.match(/^\\s*([0-9A-Za-z\\s]+)\\s+(\\d+):(\\d+)/);\r\n\r\n if (!match) {\r\n return null;\r\n }\r\n\r\n const [reference, book, chapterStr, verseStr] = match;\r\n\r\n const chapter = parseInt(chapterStr);\r\n const verse = parseInt(verseStr);\r\n\r\n if (isNaN(chapter) || isNaN(verse)) {\r\n return null;\r\n }\r\n\r\n if (reference.length !== text.length) {\r\n return {\r\n book: getBookId(book) ?? book,\r\n chapter,\r\n verse,\r\n content: text.substring(reference.length).trim(),\r\n };\r\n }\r\n\r\n return {\r\n book: getBookId(book) ?? book,\r\n chapter,\r\n verse,\r\n };\r\n}\r\n\r\n/**\r\n * Defines a map that maps the book ID to the numerical order of the book.\r\n */\r\nconst BOOK_ID_MAP: Map<string, string> = new Map([\r\n ['gen', 'GEN'],\r\n ['genesis', 'GEN'],\r\n ['exo', 'EXO'],\r\n ['exodus', 'EXO'],\r\n ['lev', 'LEV'],\r\n ['lev', 'LEV'],\r\n ['laviticus', 'LEV'],\r\n ['num', 'NUM'],\r\n ['numbers', 'NUM'],\r\n ['deu', 'DEU'],\r\n ['deuteronomy', 'DEU'],\r\n ['jos', 'JOS'],\r\n ['joshua', 'JOS'],\r\n ['jdg', 'JDG'],\r\n ['judges', 'JDG'],\r\n ['rut', 'RUT'],\r\n ['ruth', 'RUT'],\r\n ['1sa', '1SA'],\r\n ['1samuel', '1SA'],\r\n ['2sa', '2SA'],\r\n ['2samuel', '2SA'],\r\n ['1ki', '1KI'],\r\n ['1kings', '1KI'],\r\n ['2ki', '2KI'],\r\n ['2kings', '2KI'],\r\n ['1ch', '1CH'],\r\n ['1chronicles', '1CH'],\r\n ['chronicles1', '1CH'],\r\n ['2ch', '2CH'],\r\n ['2chronicles', '2CH'],\r\n ['chronicles2', '2CH'],\r\n ['ezr', 'EZR'],\r\n ['ezra', 'EZR'],\r\n ['neh', 'NEH'],\r\n ['nehemiah', 'NEH'],\r\n ['est', 'EST'],\r\n ['ester', 'EST'],\r\n ['job', 'JOB'],\r\n ['psa', 'PSA'],\r\n ['psalms', 'PSA'],\r\n ['psalm', 'PSA'],\r\n ['pro', 'PRO'],\r\n ['proverbs', 'PRO'],\r\n ['ecc', 'ECC'],\r\n ['ecclesiastes', 'ECC'],\r\n ['sng', 'SNG'],\r\n ['songofsolomon', 'SNG'],\r\n ['isa', 'ISA'],\r\n ['isaiah', 'ISA'],\r\n ['jer', 'JER'],\r\n ['jeremiah', 'JER'],\r\n ['lam', 'LAM'],\r\n ['lamentations', 'LAM'],\r\n ['ezk', 'EZK'],\r\n ['ezekiel', 'EZK'],\r\n ['dan', 'DAN'],\r\n ['daniel', 'DAN'],\r\n ['hos', 'HOS'],\r\n ['hosea', 'HOS'],\r\n ['jol', 'JOL'],\r\n ['joel', 'JOL'],\r\n ['amo', 'AMO'],\r\n ['amos', 'AMO'],\r\n ['oba', 'OBA'],\r\n ['obadiah', 'OBA'],\r\n ['jon', 'JON'],\r\n ['jonah', 'JON'],\r\n ['mic', 'MIC'],\r\n ['micah', 'MIC'],\r\n ['nam', 'NAM'],\r\n ['nahum', 'NAM'],\r\n ['hab', 'HAB'],\r\n ['habakkuk', 'HAB'],\r\n ['zep', 'ZEP'],\r\n ['zepaniah', 'ZEP'],\r\n ['hag', 'HAG'],\r\n ['haggai', 'HAG'],\r\n ['zec', 'ZEC'],\r\n ['zechariah', 'ZEC'],\r\n ['mal', 'MAL'],\r\n ['malachi', 'MAL'],\r\n ['mat', 'MAT'],\r\n ['matthew', 'MAT'],\r\n ['mrk', 'MRK'],\r\n ['mark', 'MRK'],\r\n ['luk', 'LUK'],\r\n ['luke', 'LUK'],\r\n ['jhn', 'JHN'],\r\n ['john', 'JHN'],\r\n ['act', 'ACT'],\r\n ['acts', 'ACT'],\r\n ['rom', 'ROM'],\r\n ['romans', 'ROM'],\r\n ['1co', '1CO'],\r\n ['1corinthians', '1CO'],\r\n ['2co', '2CO'],\r\n ['2corinthians', '2CO'],\r\n ['gal', 'GAL'],\r\n ['galatians', 'GAL'],\r\n ['eph', 'EPH'],\r\n ['ephesians', 'EPH'],\r\n ['php', 'PHP'],\r\n ['philippians', 'PHP'],\r\n ['col', 'COL'],\r\n ['colossians', 'COL'],\r\n ['1th', '1TH'],\r\n ['1thessalonians', '1TH'],\r\n ['2th', '2TH'],\r\n ['2thessalonians', '2TH'],\r\n ['1ti', '1TI'],\r\n ['1timothy', '1TI'],\r\n ['2ti', '2TI'],\r\n ['2timothy', '2TI'],\r\n ['tit', 'TIT'],\r\n ['titus', 'TIT'],\r\n ['phm', 'PHM'],\r\n ['philemon', 'PHM'],\r\n ['heb', 'HEB'],\r\n ['hebrews', 'HEB'],\r\n ['jas', 'JAS'],\r\n ['james', 'JAS'],\r\n ['1pe', '1PE'],\r\n ['1peter', '1PE'],\r\n ['2pe', '2PE'],\r\n ['2peter', '2PE'],\r\n ['1jn', '1JN'],\r\n ['1john', '1JN'],\r\n ['2jn', '2JN'],\r\n ['2john', '2JN'],\r\n ['3jn', '3JN'],\r\n ['3john', '3JN'],\r\n ['jud', 'JUD'],\r\n ['jude', 'JUD'],\r\n ['rev', 'REV'],\r\n ['revelation', 'REV'],\r\n]);\r\n\r\n/**\r\n * Gets the ID of the given book.\r\n * Returns null if the ID could not be found.\r\n * @param book The name/ID of the book.\r\n */\r\nexport function getBookId(book: string): string | null {\r\n const bookLower = book.toLowerCase().replaceAll(/\\s+/g, '');\r\n\r\n const id = BOOK_ID_MAP.get(bookLower);\r\n if (id) {\r\n return id;\r\n }\r\n\r\n for (let [key, id] of BOOK_ID_MAP) {\r\n if (bookLower.startsWith(key)) {\r\n return id;\r\n }\r\n }\r\n\r\n return null;\r\n}\r\n"],
|
|
5
|
+
"mappings": ";AAIO,gBAAS,kBAAkB,UAA0B;AACxD,SAAO;AACX;AAKA,MAAM,qBAA0C,oBAAI,IAAI;AAAA,EACpD,CAAC,WAAW,KAAK;AAAA,EACjB,CAAC,WAAW,QAAQ;AAAA,EACpB,CAAC,YAAY,SAAS;AAAA,EACtB,CAAC,WAAW,QAAQ;AAAA,EACpB,CAAC,WAAW,QAAQ;AACxB,CAAC;AAMM,gBAAS,iBAAiB,eAA+B;AAC5D,SAAO,mBAAmB,IAAI,aAAa,KAAK;AACpD;AAEO,gBAAS,oBAAoB,KAAyC;AACzE,SAAO,CAAC,OAAO,QAAQ,KAAK,GAAG;AACnC;AAEO,gBAAS,oBAAsC,QAAgB;AAClE,WAAS,SAAS,QAAQ;AACtB,QAAI,CAAC,oBAAoB,KAAK,GAAG;AAC7B,aAAO;AAAA,IACX;AAAA,EACJ;AAEA,QAAM,IAAI,MAAM,qCAAq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id"]
|
|
7
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { OutputFile, Translation, TranslationBook, TranslationBookChapter, TranslationBookChapterAudioLinks } from './common-types';
|
|
2
|
-
import { DatasetOutput } from './dataset';
|
|
1
|
+
import { Commentary, CommentaryBook, CommentaryBookChapter, OutputFile, Translation, TranslationBook, TranslationBookChapter, TranslationBookChapterAudioLinks } from './common-types.js';
|
|
2
|
+
import { DatasetOutput } from './dataset.js';
|
|
3
3
|
/**
|
|
4
4
|
* Defines the output of the API generation.
|
|
5
5
|
*/
|
|
@@ -27,6 +27,22 @@ export interface ApiOutput {
|
|
|
27
27
|
* - /api/:translationId/:bookId/:chapterNumber.:reader.mp3
|
|
28
28
|
*/
|
|
29
29
|
translationBookChapterAudio: ApiTranslationBookChapterAudio[];
|
|
30
|
+
/**
|
|
31
|
+
* The list of available commentaries.
|
|
32
|
+
* This maps to the /api/available-commentaries.json endpoint.
|
|
33
|
+
*/
|
|
34
|
+
availableCommentaries: ApiAvailableCommentaries;
|
|
35
|
+
/**
|
|
36
|
+
* The list of books for each commentary.
|
|
37
|
+
* This maps to the /api/c/:commentaryId/books.json endpoint.
|
|
38
|
+
*/
|
|
39
|
+
commentaryBooks: ApiCommentaryBooks[];
|
|
40
|
+
/**
|
|
41
|
+
* The list of chapters for each commentary book.
|
|
42
|
+
* This maps to the following endpoint:
|
|
43
|
+
* - /api/c/:commentaryId/:bookId/:chapterNumber.json
|
|
44
|
+
*/
|
|
45
|
+
commentaryBookChapters: ApiCommentaryBookChapter[];
|
|
30
46
|
/**
|
|
31
47
|
* The path prefix that the API should use.
|
|
32
48
|
*/
|
|
@@ -42,6 +58,16 @@ export interface ApiAvailableTranslations {
|
|
|
42
58
|
*/
|
|
43
59
|
translations: ApiTranslation[];
|
|
44
60
|
}
|
|
61
|
+
/**
|
|
62
|
+
* The list of available commentaries.
|
|
63
|
+
* Maps to the /api/available-commentaries.json endpoint.
|
|
64
|
+
*/
|
|
65
|
+
export interface ApiAvailableCommentaries {
|
|
66
|
+
/**
|
|
67
|
+
* The list of commentaries.
|
|
68
|
+
*/
|
|
69
|
+
commentaries: ApiCommentary[];
|
|
70
|
+
}
|
|
45
71
|
/**
|
|
46
72
|
* Defines a translation that is used in the API.
|
|
47
73
|
*/
|
|
@@ -83,6 +109,47 @@ export interface ApiTranslation extends Translation {
|
|
|
83
109
|
*/
|
|
84
110
|
languageEnglishName?: string;
|
|
85
111
|
}
|
|
112
|
+
/**
|
|
113
|
+
* Defines a commentary that is used in the API.
|
|
114
|
+
*/
|
|
115
|
+
export interface ApiCommentary extends Commentary {
|
|
116
|
+
/**
|
|
117
|
+
* The API link for the list of available books for this translation.
|
|
118
|
+
*/
|
|
119
|
+
listOfBooksApiLink: string;
|
|
120
|
+
/**
|
|
121
|
+
* The available list of formats.
|
|
122
|
+
*/
|
|
123
|
+
availableFormats: ('json' | 'usfm')[];
|
|
124
|
+
/**
|
|
125
|
+
* The number of books that are contained in this commentary.
|
|
126
|
+
*
|
|
127
|
+
* Complete commentaries should have the same number of books as the Bible (66).
|
|
128
|
+
*/
|
|
129
|
+
numberOfBooks: number;
|
|
130
|
+
/**
|
|
131
|
+
* The total number of chapters that are contained in this translation.
|
|
132
|
+
*
|
|
133
|
+
* Complete commentaries should have the same number of chapters as the Bible (1,189).
|
|
134
|
+
*/
|
|
135
|
+
totalNumberOfChapters: number;
|
|
136
|
+
/**
|
|
137
|
+
* The total number of verses that are contained in this commentary.
|
|
138
|
+
*
|
|
139
|
+
* Complete commentaries should have the same number of verses as the Bible (around 31,102 - some commentaries exclude verses based on the aparent likelyhood of existing in the original source texts).
|
|
140
|
+
*/
|
|
141
|
+
totalNumberOfVerses: number;
|
|
142
|
+
/**
|
|
143
|
+
* Gets the name of the language that the commentary is in.
|
|
144
|
+
* Null or undefined if the name of the language is not known.
|
|
145
|
+
*/
|
|
146
|
+
languageName?: string;
|
|
147
|
+
/**
|
|
148
|
+
* Gets the name of the language in English.
|
|
149
|
+
* Null or undefined if the language doesn't have an english name.
|
|
150
|
+
*/
|
|
151
|
+
languageEnglishName?: string;
|
|
152
|
+
}
|
|
86
153
|
/**
|
|
87
154
|
* Defines an interface that contains information about the books that are available for a translation.
|
|
88
155
|
*/
|
|
@@ -96,6 +163,19 @@ export interface ApiTranslationBooks {
|
|
|
96
163
|
*/
|
|
97
164
|
books: ApiTranslationBook[];
|
|
98
165
|
}
|
|
166
|
+
/**
|
|
167
|
+
* Defines an interface that contains information about the books that are available for a commentary.
|
|
168
|
+
*/
|
|
169
|
+
export interface ApiCommentaryBooks {
|
|
170
|
+
/**
|
|
171
|
+
* The commentary information for the books.
|
|
172
|
+
*/
|
|
173
|
+
commentary: ApiCommentary;
|
|
174
|
+
/**
|
|
175
|
+
* The list of books that are available for the commentary.
|
|
176
|
+
*/
|
|
177
|
+
books: ApiCommentaryBook[];
|
|
178
|
+
}
|
|
99
179
|
/**
|
|
100
180
|
* Defines a translation book that is used in the API.
|
|
101
181
|
*/
|
|
@@ -117,6 +197,27 @@ export interface ApiTranslationBook extends TranslationBook {
|
|
|
117
197
|
*/
|
|
118
198
|
totalNumberOfVerses: number;
|
|
119
199
|
}
|
|
200
|
+
/**
|
|
201
|
+
* Defines a commentary book that is used in the API.
|
|
202
|
+
*/
|
|
203
|
+
export interface ApiCommentaryBook extends CommentaryBook {
|
|
204
|
+
/**
|
|
205
|
+
* The link to the first chapter of the book.
|
|
206
|
+
*/
|
|
207
|
+
firstChapterApiLink: string;
|
|
208
|
+
/**
|
|
209
|
+
* The link to the last chapter of the book.
|
|
210
|
+
*/
|
|
211
|
+
lastChapterApiLink: string;
|
|
212
|
+
/**
|
|
213
|
+
* The number of chapters that the book contains.
|
|
214
|
+
*/
|
|
215
|
+
numberOfChapters: number;
|
|
216
|
+
/**
|
|
217
|
+
* The number of verses that the book contains.
|
|
218
|
+
*/
|
|
219
|
+
totalNumberOfVerses: number;
|
|
220
|
+
}
|
|
120
221
|
/**
|
|
121
222
|
* Defines an interface that contains information about a book chapter.
|
|
122
223
|
*/
|
|
@@ -158,6 +259,37 @@ export interface ApiTranslationBookChapter extends TranslationBookChapter {
|
|
|
158
259
|
*/
|
|
159
260
|
numberOfVerses: number;
|
|
160
261
|
}
|
|
262
|
+
/**
|
|
263
|
+
* Defines an interface that contains information about a book chapter.
|
|
264
|
+
*/
|
|
265
|
+
export interface ApiCommentaryBookChapter extends CommentaryBookChapter {
|
|
266
|
+
/**
|
|
267
|
+
* The commentary information for the book chapter.
|
|
268
|
+
*/
|
|
269
|
+
commentary: ApiCommentary;
|
|
270
|
+
/**
|
|
271
|
+
* The book information for the book chapter.
|
|
272
|
+
*/
|
|
273
|
+
book: ApiCommentaryBook;
|
|
274
|
+
/**
|
|
275
|
+
* The link to this chapter.
|
|
276
|
+
*/
|
|
277
|
+
thisChapterLink: string;
|
|
278
|
+
/**
|
|
279
|
+
* The link to the next chapter.
|
|
280
|
+
* Null if this is the last chapter in the translation.
|
|
281
|
+
*/
|
|
282
|
+
nextChapterApiLink: string | null;
|
|
283
|
+
/**
|
|
284
|
+
* The link to the previous chapter.
|
|
285
|
+
* Null if this is the first chapter in the translation.
|
|
286
|
+
*/
|
|
287
|
+
previousChapterApiLink: string | null;
|
|
288
|
+
/**
|
|
289
|
+
* The number of verses that the chapter contains.
|
|
290
|
+
*/
|
|
291
|
+
numberOfVerses: number;
|
|
292
|
+
}
|
|
161
293
|
export interface ApiTranslationBookChapterAudio {
|
|
162
294
|
/**
|
|
163
295
|
* The chapter that the audio is for.
|
|
@@ -229,6 +361,12 @@ export declare function generateOutputFilesFromDatasets(datasets: AsyncIterable<
|
|
|
229
361
|
* @returns
|
|
230
362
|
*/
|
|
231
363
|
export declare function listOfBooksApiLink(translationId: string, prefix?: string): string;
|
|
364
|
+
/**
|
|
365
|
+
* Gets the API Link for the list of books endpoint for a commentary.
|
|
366
|
+
* @param commentaryId The ID of the commentary.
|
|
367
|
+
* @returns
|
|
368
|
+
*/
|
|
369
|
+
export declare function listOfCommentaryBooksApiLink(commentaryId: string, prefix?: string): string;
|
|
232
370
|
/**
|
|
233
371
|
* Getes the API link for a book chapter.
|
|
234
372
|
* @param translationId The ID of the translation.
|
|
@@ -237,6 +375,14 @@ export declare function listOfBooksApiLink(translationId: string, prefix?: strin
|
|
|
237
375
|
* @param extension The extension of the file.
|
|
238
376
|
*/
|
|
239
377
|
export declare function bookChapterApiLink(translationId: string, commonName: string, chapterNumber: number, extension: string, prefix?: string): string;
|
|
378
|
+
/**
|
|
379
|
+
* Getes the API link for a book chapter.
|
|
380
|
+
* @param translationId The ID of the translation.
|
|
381
|
+
* @param commonName The name of the book.
|
|
382
|
+
* @param chapterNumber The number of the book.
|
|
383
|
+
* @param extension The extension of the file.
|
|
384
|
+
*/
|
|
385
|
+
export declare function bookCommentaryChapterApiLink(translationId: string, commonName: string, chapterNumber: number, extension: string, prefix?: string): string;
|
|
240
386
|
export declare function bookChapterAudioApiLink(translationId: string, bookId: string, chapterNumber: number, reader: string, prefix?: string): string;
|
|
241
387
|
export declare function jsonFile(path: string, content: any, mergable?: boolean): OutputFile;
|
|
242
388
|
export declare function downloadedFile(path: string, url: string): OutputFile;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { TranslationBookChapterAudioLinks } from
|
|
1
|
+
import { TranslationBookChapterAudioLinks } from './common-types.js';
|
|
2
2
|
type AudioTranslationUrlGenerator = (bookId: string, chapter: number) => string;
|
|
3
3
|
/**
|
|
4
4
|
* A map of translation IDs to a map of reader IDs to the URL generator for the audio file.
|
|
@@ -1,12 +1,20 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Defines an interface that contains information about a input file.
|
|
3
3
|
*/
|
|
4
|
-
export
|
|
4
|
+
export type InputFile = InputTranslationFile | InputCommentaryFile;
|
|
5
|
+
export interface InputFileBase {
|
|
5
6
|
name?: string;
|
|
6
|
-
metadata: ParseTreeMetadata;
|
|
7
7
|
content: string;
|
|
8
8
|
sha256?: string;
|
|
9
|
+
}
|
|
10
|
+
export type InputFileMetadata = InputTranslationMetadata | InputCommentaryMetadata;
|
|
11
|
+
export interface InputTranslationFile extends InputFileBase {
|
|
9
12
|
fileType: 'usfm' | 'usx' | 'json';
|
|
13
|
+
metadata: InputTranslationMetadata;
|
|
14
|
+
}
|
|
15
|
+
export interface InputCommentaryFile extends InputFileBase {
|
|
16
|
+
fileType: 'commentary/csv';
|
|
17
|
+
metadata: InputCommentaryMetadata;
|
|
10
18
|
}
|
|
11
19
|
export type OutputFileContent = object | ReadableStream;
|
|
12
20
|
/**
|
|
@@ -26,23 +34,7 @@ export interface OutputFile {
|
|
|
26
34
|
*/
|
|
27
35
|
mergable?: boolean;
|
|
28
36
|
}
|
|
29
|
-
|
|
30
|
-
* Defines an interface that contains metadata for a parse tree.
|
|
31
|
-
*/
|
|
32
|
-
export interface ParseTreeMetadata {
|
|
33
|
-
/**
|
|
34
|
-
* Information about the translation.
|
|
35
|
-
*/
|
|
36
|
-
translation: InputTranslationMetadata;
|
|
37
|
-
}
|
|
38
|
-
/**
|
|
39
|
-
* The metadata for a translation that is input into the generator.
|
|
40
|
-
*/
|
|
41
|
-
export interface InputTranslationMetadata {
|
|
42
|
-
/**
|
|
43
|
-
* The ID of the translation.
|
|
44
|
-
*/
|
|
45
|
-
id: string;
|
|
37
|
+
export interface MetadataBase {
|
|
46
38
|
/**
|
|
47
39
|
* The name of the translation.
|
|
48
40
|
*/
|
|
@@ -59,10 +51,6 @@ export interface InputTranslationMetadata {
|
|
|
59
51
|
* The URL that the license for the translation can be found.
|
|
60
52
|
*/
|
|
61
53
|
licenseUrl: string;
|
|
62
|
-
/**
|
|
63
|
-
* The short name for the translation.
|
|
64
|
-
*/
|
|
65
|
-
shortName?: string;
|
|
66
54
|
/**
|
|
67
55
|
* The ISO 639 letter language tag that the translation is primarily in.
|
|
68
56
|
*/
|
|
@@ -72,6 +60,28 @@ export interface InputTranslationMetadata {
|
|
|
72
60
|
*/
|
|
73
61
|
direction: 'ltr' | 'rtl';
|
|
74
62
|
}
|
|
63
|
+
/**
|
|
64
|
+
* The metadata for a translation that is input into the generator.
|
|
65
|
+
*/
|
|
66
|
+
export interface InputTranslationMetadata extends MetadataBase {
|
|
67
|
+
/**
|
|
68
|
+
* The ID of the translation.
|
|
69
|
+
*/
|
|
70
|
+
id: string;
|
|
71
|
+
/**
|
|
72
|
+
* The short name for the translation.
|
|
73
|
+
*/
|
|
74
|
+
shortName?: string;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* The metadata for a translation that is input into the generator.
|
|
78
|
+
*/
|
|
79
|
+
export interface InputCommentaryMetadata extends MetadataBase {
|
|
80
|
+
/**
|
|
81
|
+
* The ID of the commentary.
|
|
82
|
+
*/
|
|
83
|
+
id: string;
|
|
84
|
+
}
|
|
75
85
|
/**
|
|
76
86
|
* Defines an interface that contains information about a translation.
|
|
77
87
|
*/
|
|
@@ -111,12 +121,47 @@ export interface Translation {
|
|
|
111
121
|
*/
|
|
112
122
|
textDirection: 'ltr' | 'rtl';
|
|
113
123
|
}
|
|
124
|
+
/**
|
|
125
|
+
* Defines an interface that contains information about a commentary.
|
|
126
|
+
*/
|
|
127
|
+
export interface Commentary {
|
|
128
|
+
/**
|
|
129
|
+
* The ID of the commentary.
|
|
130
|
+
*/
|
|
131
|
+
id: string;
|
|
132
|
+
/**
|
|
133
|
+
* The name of the commentary.
|
|
134
|
+
*/
|
|
135
|
+
name: string;
|
|
136
|
+
/**
|
|
137
|
+
* The website for the commentary.
|
|
138
|
+
*/
|
|
139
|
+
website: string;
|
|
140
|
+
/**
|
|
141
|
+
* The URL that the license for the commentary can be found.
|
|
142
|
+
*/
|
|
143
|
+
licenseUrl: string;
|
|
144
|
+
/**
|
|
145
|
+
* The english name for the commentary.
|
|
146
|
+
*/
|
|
147
|
+
englishName: string;
|
|
148
|
+
/**
|
|
149
|
+
* The ISO 639 3-letter language tag that the translation is primarily in.
|
|
150
|
+
*/
|
|
151
|
+
language: string;
|
|
152
|
+
/**
|
|
153
|
+
* The direction that the language is written in.
|
|
154
|
+
* "ltr" indicates that the text is written from the left side of the page to the right.
|
|
155
|
+
* "rtl" indicates that the text is written from the right side of the page to the left.
|
|
156
|
+
*/
|
|
157
|
+
textDirection: 'ltr' | 'rtl';
|
|
158
|
+
}
|
|
114
159
|
/**
|
|
115
160
|
* Defines an interface that contains information about a book.
|
|
116
161
|
*/
|
|
117
162
|
export interface TranslationBook {
|
|
118
163
|
/**
|
|
119
|
-
* The ID of the book.
|
|
164
|
+
* The ID of the book. Should match the USFM book ID.
|
|
120
165
|
*/
|
|
121
166
|
id: string;
|
|
122
167
|
/**
|
|
@@ -138,6 +183,31 @@ export interface TranslationBook {
|
|
|
138
183
|
*/
|
|
139
184
|
order: number;
|
|
140
185
|
}
|
|
186
|
+
/**
|
|
187
|
+
* Defines an interface that contains information about a book in a commentary.
|
|
188
|
+
*/
|
|
189
|
+
export interface CommentaryBook {
|
|
190
|
+
/**
|
|
191
|
+
* The ID of the book. Should match the USFM book ID.
|
|
192
|
+
*/
|
|
193
|
+
id: string;
|
|
194
|
+
/**
|
|
195
|
+
* The name that the commentary provided for the book.
|
|
196
|
+
*/
|
|
197
|
+
name: string;
|
|
198
|
+
/**
|
|
199
|
+
* The common name for the book.
|
|
200
|
+
*/
|
|
201
|
+
commonName: string;
|
|
202
|
+
/**
|
|
203
|
+
* The commentary's introduction for the book.
|
|
204
|
+
*/
|
|
205
|
+
introduction?: string;
|
|
206
|
+
/**
|
|
207
|
+
* The order of the book in the Bible.
|
|
208
|
+
*/
|
|
209
|
+
order: number;
|
|
210
|
+
}
|
|
141
211
|
/**
|
|
142
212
|
* Defines an interface that contains information about a book chapter.
|
|
143
213
|
*/
|
|
@@ -151,6 +221,15 @@ export interface TranslationBookChapter {
|
|
|
151
221
|
*/
|
|
152
222
|
thisChapterAudioLinks: TranslationBookChapterAudioLinks;
|
|
153
223
|
}
|
|
224
|
+
/**
|
|
225
|
+
* Defines an interface that contains information about a book chapter in a commentary.
|
|
226
|
+
*/
|
|
227
|
+
export interface CommentaryBookChapter {
|
|
228
|
+
/**
|
|
229
|
+
* The information for the chapter.
|
|
230
|
+
*/
|
|
231
|
+
chapter: CommentaryChapterData;
|
|
232
|
+
}
|
|
154
233
|
/**
|
|
155
234
|
* Defines an interface that contains the audio links for a book chapter.
|
|
156
235
|
*/
|
|
@@ -177,6 +256,24 @@ export interface ChapterData {
|
|
|
177
256
|
*/
|
|
178
257
|
footnotes: ChapterFootnote[];
|
|
179
258
|
}
|
|
259
|
+
/**
|
|
260
|
+
* Defines an interface that represents data in a chapter in a commentary.
|
|
261
|
+
*/
|
|
262
|
+
export interface CommentaryChapterData {
|
|
263
|
+
/**
|
|
264
|
+
* The number of the chapter.
|
|
265
|
+
*/
|
|
266
|
+
number: number;
|
|
267
|
+
/**
|
|
268
|
+
* The introduction that the commentary provided to the chapter.
|
|
269
|
+
* Not all commentaries provide an introduction to a chapter.
|
|
270
|
+
*/
|
|
271
|
+
introduction?: string;
|
|
272
|
+
/**
|
|
273
|
+
* The content of the chapter.
|
|
274
|
+
*/
|
|
275
|
+
content: ChapterVerse[];
|
|
276
|
+
}
|
|
180
277
|
/**
|
|
181
278
|
* A union type that represents a single piece of chapter content.
|
|
182
279
|
* A piece of chapter content can be one of the following things:
|