@helloao/tools 0.0.9 → 0.0.11
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 +194 -0
- package/dist/cjs/generation/api.cjs.map +2 -2
- package/dist/cjs/generation/common-types.cjs.map +1 -1
- package/dist/cjs/generation/dataset.cjs +180 -83
- package/dist/cjs/generation/dataset.cjs.map +3 -3
- package/dist/cjs/index.cjs +3 -0
- package/dist/cjs/index.cjs.map +2 -2
- package/dist/cjs/log.cjs +50 -0
- package/dist/cjs/log.cjs.map +7 -0
- package/dist/cjs/parser/codex-parser.cjs +81 -67
- package/dist/cjs/parser/codex-parser.cjs.map +2 -2
- 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 +3 -1
- package/dist/cjs/parser/index.cjs.map +2 -2
- package/dist/cjs/parser/iterators.cjs +17 -6
- package/dist/cjs/parser/iterators.cjs.map +2 -2
- package/dist/cjs/parser/tyndale-xml-parser.cjs +212 -0
- package/dist/cjs/parser/tyndale-xml-parser.cjs.map +7 -0
- package/dist/cjs/parser/types.cjs.map +1 -1
- package/dist/cjs/parser/usfm-parser.cjs +4 -2
- package/dist/cjs/parser/usfm-parser.cjs.map +2 -2
- package/dist/cjs/parser/usx-parser.cjs +13 -1
- package/dist/cjs/parser/usx-parser.cjs.map +2 -2
- package/dist/cjs/utils.cjs +180 -6
- package/dist/cjs/utils.cjs.map +3 -3
- package/dist/esm/generation/api.js +186 -0
- package/dist/esm/generation/api.js.map +2 -2
- package/dist/esm/generation/dataset.js +181 -84
- package/dist/esm/generation/dataset.js.map +2 -2
- package/dist/esm/index.js +2 -1
- package/dist/esm/index.js.map +2 -2
- package/dist/esm/log.js +20 -0
- package/dist/esm/log.js.map +7 -0
- package/dist/esm/parser/codex-parser.js +75 -65
- package/dist/esm/parser/codex-parser.js.map +2 -2
- 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 +1 -0
- package/dist/esm/parser/index.js.map +2 -2
- package/dist/esm/parser/iterators.js +17 -6
- package/dist/esm/parser/iterators.js.map +2 -2
- package/dist/esm/parser/tyndale-xml-parser.js +184 -0
- package/dist/esm/parser/tyndale-xml-parser.js.map +7 -0
- package/dist/esm/parser/usfm-parser.js +4 -2
- package/dist/esm/parser/usfm-parser.js.map +2 -2
- package/dist/esm/parser/usx-parser.js +13 -1
- package/dist/esm/parser/usx-parser.js.map +2 -2
- package/dist/esm/utils.js +178 -6
- package/dist/esm/utils.js.map +3 -3
- package/dist/types/generation/api.d.ts +222 -1
- package/dist/types/generation/common-types.d.ts +151 -24
- package/dist/types/generation/dataset.d.ts +38 -2
- package/dist/types/index.d.ts +2 -1
- package/dist/types/log.d.ts +23 -0
- package/dist/types/parser/codex-parser.d.ts +50 -7
- package/dist/types/parser/commentary-csv-parser.d.ts +12 -0
- package/dist/types/parser/index.d.ts +1 -0
- package/dist/types/parser/tyndale-xml-parser.d.ts +8 -0
- package/dist/types/parser/types.d.ts +53 -1
- package/dist/types/parser/usx-parser.d.ts +1 -1
- package/dist/types/utils.d.ts +14 -0
- package/package.json +37 -14
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { OutputFile, Translation, TranslationBook, TranslationBookChapter, TranslationBookChapterAudioLinks } from './common-types.js';
|
|
1
|
+
import { Commentary, CommentaryBook, CommentaryBookChapter, CommentaryProfile, OutputFile, Translation, TranslationBook, TranslationBookChapter, TranslationBookChapterAudioLinks } from './common-types.js';
|
|
2
2
|
import { DatasetOutput } from './dataset.js';
|
|
3
3
|
/**
|
|
4
4
|
* Defines the output of the API generation.
|
|
@@ -27,6 +27,33 @@ 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 profiles for each commentary.
|
|
42
|
+
* This maps to the /api/c/:commentaryId/profiles.json endpoint.
|
|
43
|
+
*/
|
|
44
|
+
commentaryProfiles: ApiCommentaryProfiles[];
|
|
45
|
+
/**
|
|
46
|
+
* The list of chapters for each commentary book.
|
|
47
|
+
* This maps to the following endpoint:
|
|
48
|
+
* - /api/c/:commentaryId/:bookId/:chapterNumber.json
|
|
49
|
+
*/
|
|
50
|
+
commentaryBookChapters: ApiCommentaryBookChapter[];
|
|
51
|
+
/**
|
|
52
|
+
* The list of individual profiles for each commentary.
|
|
53
|
+
* This maps to the following endpoint:
|
|
54
|
+
* - /api/c/:commentaryId/profiles/:profileId.json
|
|
55
|
+
*/
|
|
56
|
+
commentaryProfileContents: ApiCommentaryProfileContent[];
|
|
30
57
|
/**
|
|
31
58
|
* The path prefix that the API should use.
|
|
32
59
|
*/
|
|
@@ -42,6 +69,16 @@ export interface ApiAvailableTranslations {
|
|
|
42
69
|
*/
|
|
43
70
|
translations: ApiTranslation[];
|
|
44
71
|
}
|
|
72
|
+
/**
|
|
73
|
+
* The list of available commentaries.
|
|
74
|
+
* Maps to the /api/available-commentaries.json endpoint.
|
|
75
|
+
*/
|
|
76
|
+
export interface ApiAvailableCommentaries {
|
|
77
|
+
/**
|
|
78
|
+
* The list of commentaries.
|
|
79
|
+
*/
|
|
80
|
+
commentaries: ApiCommentary[];
|
|
81
|
+
}
|
|
45
82
|
/**
|
|
46
83
|
* Defines a translation that is used in the API.
|
|
47
84
|
*/
|
|
@@ -83,6 +120,57 @@ export interface ApiTranslation extends Translation {
|
|
|
83
120
|
*/
|
|
84
121
|
languageEnglishName?: string;
|
|
85
122
|
}
|
|
123
|
+
/**
|
|
124
|
+
* Defines a commentary that is used in the API.
|
|
125
|
+
*/
|
|
126
|
+
export interface ApiCommentary extends Commentary {
|
|
127
|
+
/**
|
|
128
|
+
* The API link for the list of available books for this translation.
|
|
129
|
+
*/
|
|
130
|
+
listOfBooksApiLink: string;
|
|
131
|
+
/**
|
|
132
|
+
* The API link for the list of available profiles for this commentary.
|
|
133
|
+
*/
|
|
134
|
+
listOfProfilesApiLink: string;
|
|
135
|
+
/**
|
|
136
|
+
* The available list of formats.
|
|
137
|
+
*/
|
|
138
|
+
availableFormats: ('json' | 'usfm')[];
|
|
139
|
+
/**
|
|
140
|
+
* The number of books that are contained in this commentary.
|
|
141
|
+
*
|
|
142
|
+
* Complete commentaries should have the same number of books as the Bible (66).
|
|
143
|
+
*/
|
|
144
|
+
numberOfBooks: number;
|
|
145
|
+
/**
|
|
146
|
+
* The total number of chapters that are contained in this translation.
|
|
147
|
+
*
|
|
148
|
+
* Complete commentaries should have the same number of chapters as the Bible (1,189).
|
|
149
|
+
*/
|
|
150
|
+
totalNumberOfChapters: number;
|
|
151
|
+
/**
|
|
152
|
+
* The total number of verses that are contained in this commentary.
|
|
153
|
+
*
|
|
154
|
+
* 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).
|
|
155
|
+
*/
|
|
156
|
+
totalNumberOfVerses: number;
|
|
157
|
+
/**
|
|
158
|
+
* The total number of profiles that are contained in this commentary.
|
|
159
|
+
*
|
|
160
|
+
* Profiles are used to provide additional information about people and people groups that are mentioned in the Bible.
|
|
161
|
+
*/
|
|
162
|
+
totalNumberOfProfiles: number;
|
|
163
|
+
/**
|
|
164
|
+
* Gets the name of the language that the commentary is in.
|
|
165
|
+
* Null or undefined if the name of the language is not known.
|
|
166
|
+
*/
|
|
167
|
+
languageName?: string;
|
|
168
|
+
/**
|
|
169
|
+
* Gets the name of the language in English.
|
|
170
|
+
* Null or undefined if the language doesn't have an english name.
|
|
171
|
+
*/
|
|
172
|
+
languageEnglishName?: string;
|
|
173
|
+
}
|
|
86
174
|
/**
|
|
87
175
|
* Defines an interface that contains information about the books that are available for a translation.
|
|
88
176
|
*/
|
|
@@ -96,6 +184,45 @@ export interface ApiTranslationBooks {
|
|
|
96
184
|
*/
|
|
97
185
|
books: ApiTranslationBook[];
|
|
98
186
|
}
|
|
187
|
+
/**
|
|
188
|
+
* Defines an interface that contains information about the books that are available for a commentary.
|
|
189
|
+
*/
|
|
190
|
+
export interface ApiCommentaryBooks {
|
|
191
|
+
/**
|
|
192
|
+
* The commentary information for the books.
|
|
193
|
+
*/
|
|
194
|
+
commentary: ApiCommentary;
|
|
195
|
+
/**
|
|
196
|
+
* The list of books that are available for the commentary.
|
|
197
|
+
*/
|
|
198
|
+
books: ApiCommentaryBook[];
|
|
199
|
+
}
|
|
200
|
+
/**
|
|
201
|
+
* Defines an interface that contains information about the profiles that are available for a commentary.
|
|
202
|
+
*/
|
|
203
|
+
export interface ApiCommentaryProfiles {
|
|
204
|
+
/**
|
|
205
|
+
* The commentary information for the books.
|
|
206
|
+
*/
|
|
207
|
+
commentary: ApiCommentary;
|
|
208
|
+
/**
|
|
209
|
+
* The list of profiles that are available for the commentary.
|
|
210
|
+
*/
|
|
211
|
+
profiles: ApiCommentaryProfile[];
|
|
212
|
+
}
|
|
213
|
+
/**
|
|
214
|
+
* Defines an interface that contains information about a profile.
|
|
215
|
+
*/
|
|
216
|
+
export interface ApiCommentaryProfile extends CommentaryProfile {
|
|
217
|
+
/**
|
|
218
|
+
* The link to this profile.
|
|
219
|
+
*/
|
|
220
|
+
thisProfileLink: string;
|
|
221
|
+
/**
|
|
222
|
+
* The link to the chapter that this profile references in the commentary.
|
|
223
|
+
*/
|
|
224
|
+
referenceChapterLink: string | null;
|
|
225
|
+
}
|
|
99
226
|
/**
|
|
100
227
|
* Defines a translation book that is used in the API.
|
|
101
228
|
*/
|
|
@@ -117,6 +244,27 @@ export interface ApiTranslationBook extends TranslationBook {
|
|
|
117
244
|
*/
|
|
118
245
|
totalNumberOfVerses: number;
|
|
119
246
|
}
|
|
247
|
+
/**
|
|
248
|
+
* Defines a commentary book that is used in the API.
|
|
249
|
+
*/
|
|
250
|
+
export interface ApiCommentaryBook extends CommentaryBook {
|
|
251
|
+
/**
|
|
252
|
+
* The link to the first chapter of the book.
|
|
253
|
+
*/
|
|
254
|
+
firstChapterApiLink: string;
|
|
255
|
+
/**
|
|
256
|
+
* The link to the last chapter of the book.
|
|
257
|
+
*/
|
|
258
|
+
lastChapterApiLink: string;
|
|
259
|
+
/**
|
|
260
|
+
* The number of chapters that the book contains.
|
|
261
|
+
*/
|
|
262
|
+
numberOfChapters: number;
|
|
263
|
+
/**
|
|
264
|
+
* The number of verses that the book contains.
|
|
265
|
+
*/
|
|
266
|
+
totalNumberOfVerses: number;
|
|
267
|
+
}
|
|
120
268
|
/**
|
|
121
269
|
* Defines an interface that contains information about a book chapter.
|
|
122
270
|
*/
|
|
@@ -158,6 +306,37 @@ export interface ApiTranslationBookChapter extends TranslationBookChapter {
|
|
|
158
306
|
*/
|
|
159
307
|
numberOfVerses: number;
|
|
160
308
|
}
|
|
309
|
+
/**
|
|
310
|
+
* Defines an interface that contains information about a book chapter.
|
|
311
|
+
*/
|
|
312
|
+
export interface ApiCommentaryBookChapter extends CommentaryBookChapter {
|
|
313
|
+
/**
|
|
314
|
+
* The commentary information for the book chapter.
|
|
315
|
+
*/
|
|
316
|
+
commentary: ApiCommentary;
|
|
317
|
+
/**
|
|
318
|
+
* The book information for the book chapter.
|
|
319
|
+
*/
|
|
320
|
+
book: ApiCommentaryBook;
|
|
321
|
+
/**
|
|
322
|
+
* The link to this chapter.
|
|
323
|
+
*/
|
|
324
|
+
thisChapterLink: string;
|
|
325
|
+
/**
|
|
326
|
+
* The link to the next chapter.
|
|
327
|
+
* Null if this is the last chapter in the translation.
|
|
328
|
+
*/
|
|
329
|
+
nextChapterApiLink: string | null;
|
|
330
|
+
/**
|
|
331
|
+
* The link to the previous chapter.
|
|
332
|
+
* Null if this is the first chapter in the translation.
|
|
333
|
+
*/
|
|
334
|
+
previousChapterApiLink: string | null;
|
|
335
|
+
/**
|
|
336
|
+
* The number of verses that the chapter contains.
|
|
337
|
+
*/
|
|
338
|
+
numberOfVerses: number;
|
|
339
|
+
}
|
|
161
340
|
export interface ApiTranslationBookChapterAudio {
|
|
162
341
|
/**
|
|
163
342
|
* The chapter that the audio is for.
|
|
@@ -172,6 +351,20 @@ export interface ApiTranslationBookChapterAudio {
|
|
|
172
351
|
*/
|
|
173
352
|
originalUrl: string;
|
|
174
353
|
}
|
|
354
|
+
export interface ApiCommentaryProfileContent {
|
|
355
|
+
/**
|
|
356
|
+
* The commentary information for the profile.
|
|
357
|
+
*/
|
|
358
|
+
commentary: ApiCommentary;
|
|
359
|
+
/**
|
|
360
|
+
* The information about the profile.
|
|
361
|
+
*/
|
|
362
|
+
profile: ApiCommentaryProfile;
|
|
363
|
+
/**
|
|
364
|
+
* The content of the profile.
|
|
365
|
+
*/
|
|
366
|
+
content: string[];
|
|
367
|
+
}
|
|
175
368
|
/**
|
|
176
369
|
* The options for generating the API.
|
|
177
370
|
*/
|
|
@@ -229,6 +422,12 @@ export declare function generateOutputFilesFromDatasets(datasets: AsyncIterable<
|
|
|
229
422
|
* @returns
|
|
230
423
|
*/
|
|
231
424
|
export declare function listOfBooksApiLink(translationId: string, prefix?: string): string;
|
|
425
|
+
/**
|
|
426
|
+
* Gets the API Link for the list of books endpoint for a commentary.
|
|
427
|
+
* @param commentaryId The ID of the commentary.
|
|
428
|
+
* @returns
|
|
429
|
+
*/
|
|
430
|
+
export declare function listOfCommentaryBooksApiLink(commentaryId: string, prefix?: string): string;
|
|
232
431
|
/**
|
|
233
432
|
* Getes the API link for a book chapter.
|
|
234
433
|
* @param translationId The ID of the translation.
|
|
@@ -237,7 +436,29 @@ export declare function listOfBooksApiLink(translationId: string, prefix?: strin
|
|
|
237
436
|
* @param extension The extension of the file.
|
|
238
437
|
*/
|
|
239
438
|
export declare function bookChapterApiLink(translationId: string, commonName: string, chapterNumber: number, extension: string, prefix?: string): string;
|
|
439
|
+
/**
|
|
440
|
+
* Getes the API link for a book chapter.
|
|
441
|
+
* @param translationId The ID of the translation.
|
|
442
|
+
* @param commonName The name of the book.
|
|
443
|
+
* @param chapterNumber The number of the book.
|
|
444
|
+
* @param extension The extension of the file.
|
|
445
|
+
*/
|
|
446
|
+
export declare function bookCommentaryChapterApiLink(translationId: string, commonName: string, chapterNumber: number, extension: string, prefix?: string): string;
|
|
240
447
|
export declare function bookChapterAudioApiLink(translationId: string, bookId: string, chapterNumber: number, reader: string, prefix?: string): string;
|
|
448
|
+
/**
|
|
449
|
+
* Gets the API link for a profile.
|
|
450
|
+
* @param translationId The ID of the translation.
|
|
451
|
+
* @param profileId The ID of the profile.
|
|
452
|
+
* @param extension The extension of the file.
|
|
453
|
+
*/
|
|
454
|
+
export declare function profilesCommentaryApiLink(translationId: string, extension: string, prefix?: string): string;
|
|
455
|
+
/**
|
|
456
|
+
* Gets the API link for a profile.
|
|
457
|
+
* @param translationId The ID of the translation.
|
|
458
|
+
* @param profileId The ID of the profile.
|
|
459
|
+
* @param extension The extension of the file.
|
|
460
|
+
*/
|
|
461
|
+
export declare function profileCommentaryApiLink(translationId: string, profileId: string, extension: string, prefix?: string): string;
|
|
241
462
|
export declare function jsonFile(path: string, content: any, mergable?: boolean): OutputFile;
|
|
242
463
|
export declare function downloadedFile(path: string, url: string): OutputFile;
|
|
243
464
|
export declare function replaceSpacesWithUnderscores(str: string): string;
|
|
@@ -1,12 +1,21 @@
|
|
|
1
|
+
import { VerseRef } from '../utils.js';
|
|
1
2
|
/**
|
|
2
3
|
* Defines an interface that contains information about a input file.
|
|
3
4
|
*/
|
|
4
|
-
export
|
|
5
|
+
export type InputFile = InputTranslationFile | InputCommentaryFile;
|
|
6
|
+
export interface InputFileBase {
|
|
5
7
|
name?: string;
|
|
6
|
-
metadata: ParseTreeMetadata;
|
|
7
8
|
content: string;
|
|
8
9
|
sha256?: string;
|
|
10
|
+
}
|
|
11
|
+
export type InputFileMetadata = InputTranslationMetadata | InputCommentaryMetadata;
|
|
12
|
+
export interface InputTranslationFile extends InputFileBase {
|
|
9
13
|
fileType: 'usfm' | 'usx' | 'json';
|
|
14
|
+
metadata: InputTranslationMetadata;
|
|
15
|
+
}
|
|
16
|
+
export interface InputCommentaryFile extends InputFileBase {
|
|
17
|
+
fileType: 'commentary/csv' | 'commentary/tyndale-xml';
|
|
18
|
+
metadata: InputCommentaryMetadata;
|
|
10
19
|
}
|
|
11
20
|
export type OutputFileContent = object | ReadableStream;
|
|
12
21
|
/**
|
|
@@ -26,23 +35,7 @@ export interface OutputFile {
|
|
|
26
35
|
*/
|
|
27
36
|
mergable?: boolean;
|
|
28
37
|
}
|
|
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;
|
|
38
|
+
export interface MetadataBase {
|
|
46
39
|
/**
|
|
47
40
|
* The name of the translation.
|
|
48
41
|
*/
|
|
@@ -59,10 +52,6 @@ export interface InputTranslationMetadata {
|
|
|
59
52
|
* The URL that the license for the translation can be found.
|
|
60
53
|
*/
|
|
61
54
|
licenseUrl: string;
|
|
62
|
-
/**
|
|
63
|
-
* The short name for the translation.
|
|
64
|
-
*/
|
|
65
|
-
shortName?: string;
|
|
66
55
|
/**
|
|
67
56
|
* The ISO 639 letter language tag that the translation is primarily in.
|
|
68
57
|
*/
|
|
@@ -72,6 +61,28 @@ export interface InputTranslationMetadata {
|
|
|
72
61
|
*/
|
|
73
62
|
direction: 'ltr' | 'rtl';
|
|
74
63
|
}
|
|
64
|
+
/**
|
|
65
|
+
* The metadata for a translation that is input into the generator.
|
|
66
|
+
*/
|
|
67
|
+
export interface InputTranslationMetadata extends MetadataBase {
|
|
68
|
+
/**
|
|
69
|
+
* The ID of the translation.
|
|
70
|
+
*/
|
|
71
|
+
id: string;
|
|
72
|
+
/**
|
|
73
|
+
* The short name for the translation.
|
|
74
|
+
*/
|
|
75
|
+
shortName?: string;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* The metadata for a translation that is input into the generator.
|
|
79
|
+
*/
|
|
80
|
+
export interface InputCommentaryMetadata extends MetadataBase {
|
|
81
|
+
/**
|
|
82
|
+
* The ID of the commentary.
|
|
83
|
+
*/
|
|
84
|
+
id: string;
|
|
85
|
+
}
|
|
75
86
|
/**
|
|
76
87
|
* Defines an interface that contains information about a translation.
|
|
77
88
|
*/
|
|
@@ -92,6 +103,10 @@ export interface Translation {
|
|
|
92
103
|
* The URL that the license for the translation can be found.
|
|
93
104
|
*/
|
|
94
105
|
licenseUrl: string;
|
|
106
|
+
/**
|
|
107
|
+
* The API-added notes for the license.
|
|
108
|
+
*/
|
|
109
|
+
licenseNotes?: string | null;
|
|
95
110
|
/**
|
|
96
111
|
* The short name for the translation.
|
|
97
112
|
*/
|
|
@@ -111,12 +126,51 @@ export interface Translation {
|
|
|
111
126
|
*/
|
|
112
127
|
textDirection: 'ltr' | 'rtl';
|
|
113
128
|
}
|
|
129
|
+
/**
|
|
130
|
+
* Defines an interface that contains information about a commentary.
|
|
131
|
+
*/
|
|
132
|
+
export interface Commentary {
|
|
133
|
+
/**
|
|
134
|
+
* The ID of the commentary.
|
|
135
|
+
*/
|
|
136
|
+
id: string;
|
|
137
|
+
/**
|
|
138
|
+
* The name of the commentary.
|
|
139
|
+
*/
|
|
140
|
+
name: string;
|
|
141
|
+
/**
|
|
142
|
+
* The website for the commentary.
|
|
143
|
+
*/
|
|
144
|
+
website: string;
|
|
145
|
+
/**
|
|
146
|
+
* The URL that the license for the commentary can be found.
|
|
147
|
+
*/
|
|
148
|
+
licenseUrl: string;
|
|
149
|
+
/**
|
|
150
|
+
* The API-added notes for the license.
|
|
151
|
+
*/
|
|
152
|
+
licenseNotes?: string | null;
|
|
153
|
+
/**
|
|
154
|
+
* The english name for the commentary.
|
|
155
|
+
*/
|
|
156
|
+
englishName: string;
|
|
157
|
+
/**
|
|
158
|
+
* The ISO 639 3-letter language tag that the translation is primarily in.
|
|
159
|
+
*/
|
|
160
|
+
language: string;
|
|
161
|
+
/**
|
|
162
|
+
* The direction that the language is written in.
|
|
163
|
+
* "ltr" indicates that the text is written from the left side of the page to the right.
|
|
164
|
+
* "rtl" indicates that the text is written from the right side of the page to the left.
|
|
165
|
+
*/
|
|
166
|
+
textDirection: 'ltr' | 'rtl';
|
|
167
|
+
}
|
|
114
168
|
/**
|
|
115
169
|
* Defines an interface that contains information about a book.
|
|
116
170
|
*/
|
|
117
171
|
export interface TranslationBook {
|
|
118
172
|
/**
|
|
119
|
-
* The ID of the book.
|
|
173
|
+
* The ID of the book. Should match the USFM book ID.
|
|
120
174
|
*/
|
|
121
175
|
id: string;
|
|
122
176
|
/**
|
|
@@ -138,6 +192,52 @@ export interface TranslationBook {
|
|
|
138
192
|
*/
|
|
139
193
|
order: number;
|
|
140
194
|
}
|
|
195
|
+
/**
|
|
196
|
+
* Defines an interface that contains information about a book in a commentary.
|
|
197
|
+
*/
|
|
198
|
+
export interface CommentaryBook {
|
|
199
|
+
/**
|
|
200
|
+
* The ID of the book. Should match the USFM book ID.
|
|
201
|
+
*/
|
|
202
|
+
id: string;
|
|
203
|
+
/**
|
|
204
|
+
* The name that the commentary provided for the book.
|
|
205
|
+
*/
|
|
206
|
+
name: string;
|
|
207
|
+
/**
|
|
208
|
+
* The common name for the book.
|
|
209
|
+
*/
|
|
210
|
+
commonName: string;
|
|
211
|
+
/**
|
|
212
|
+
* The commentary's introduction for the book.
|
|
213
|
+
*/
|
|
214
|
+
introduction?: string;
|
|
215
|
+
/**
|
|
216
|
+
* The summary of the commentary's introduction for the book.
|
|
217
|
+
*/
|
|
218
|
+
introductionSummary?: string;
|
|
219
|
+
/**
|
|
220
|
+
* The order of the book in the Bible.
|
|
221
|
+
*/
|
|
222
|
+
order: number;
|
|
223
|
+
}
|
|
224
|
+
/**
|
|
225
|
+
* Defines an interface that contains information about a profile in a commentary.
|
|
226
|
+
*/
|
|
227
|
+
export interface CommentaryProfile {
|
|
228
|
+
/**
|
|
229
|
+
* The ID of the profile.
|
|
230
|
+
*/
|
|
231
|
+
id: string;
|
|
232
|
+
/**
|
|
233
|
+
* The subject of the profile.
|
|
234
|
+
*/
|
|
235
|
+
subject: string;
|
|
236
|
+
/**
|
|
237
|
+
* The Bible reference that the profile is associated with.
|
|
238
|
+
*/
|
|
239
|
+
reference: VerseRef | null;
|
|
240
|
+
}
|
|
141
241
|
/**
|
|
142
242
|
* Defines an interface that contains information about a book chapter.
|
|
143
243
|
*/
|
|
@@ -151,6 +251,15 @@ export interface TranslationBookChapter {
|
|
|
151
251
|
*/
|
|
152
252
|
thisChapterAudioLinks: TranslationBookChapterAudioLinks;
|
|
153
253
|
}
|
|
254
|
+
/**
|
|
255
|
+
* Defines an interface that contains information about a book chapter in a commentary.
|
|
256
|
+
*/
|
|
257
|
+
export interface CommentaryBookChapter {
|
|
258
|
+
/**
|
|
259
|
+
* The information for the chapter.
|
|
260
|
+
*/
|
|
261
|
+
chapter: CommentaryChapterData;
|
|
262
|
+
}
|
|
154
263
|
/**
|
|
155
264
|
* Defines an interface that contains the audio links for a book chapter.
|
|
156
265
|
*/
|
|
@@ -177,6 +286,24 @@ export interface ChapterData {
|
|
|
177
286
|
*/
|
|
178
287
|
footnotes: ChapterFootnote[];
|
|
179
288
|
}
|
|
289
|
+
/**
|
|
290
|
+
* Defines an interface that represents data in a chapter in a commentary.
|
|
291
|
+
*/
|
|
292
|
+
export interface CommentaryChapterData {
|
|
293
|
+
/**
|
|
294
|
+
* The number of the chapter.
|
|
295
|
+
*/
|
|
296
|
+
number: number;
|
|
297
|
+
/**
|
|
298
|
+
* The introduction that the commentary provided to the chapter.
|
|
299
|
+
* Not all commentaries provide an introduction to a chapter.
|
|
300
|
+
*/
|
|
301
|
+
introduction?: string;
|
|
302
|
+
/**
|
|
303
|
+
* The content of the chapter.
|
|
304
|
+
*/
|
|
305
|
+
content: ChapterVerse[];
|
|
306
|
+
}
|
|
180
307
|
/**
|
|
181
308
|
* A union type that represents a single piece of chapter content.
|
|
182
309
|
* A piece of chapter content can be one of the following things:
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { InputFile, Translation, TranslationBook, TranslationBookChapter } from './common-types.js';
|
|
1
|
+
import { Commentary, CommentaryBook, CommentaryBookChapter, CommentaryProfile, InputFile, Translation, TranslationBook, TranslationBookChapter } from './common-types.js';
|
|
2
2
|
/**
|
|
3
3
|
* Defines an interface that contains generated dataset info.
|
|
4
4
|
*/
|
|
@@ -7,6 +7,10 @@ export interface DatasetOutput {
|
|
|
7
7
|
* The list of translations that are available in the dataset.
|
|
8
8
|
*/
|
|
9
9
|
translations: DatasetTranslation[];
|
|
10
|
+
/**
|
|
11
|
+
* The list of commentaries that are available in the dataset.
|
|
12
|
+
*/
|
|
13
|
+
commentaries: DatasetCommentary[];
|
|
10
14
|
}
|
|
11
15
|
/**
|
|
12
16
|
* Defines a translation that is used in the dataset.
|
|
@@ -17,6 +21,19 @@ export interface DatasetTranslation extends Translation {
|
|
|
17
21
|
*/
|
|
18
22
|
books: DatasetTranslationBook[];
|
|
19
23
|
}
|
|
24
|
+
/**
|
|
25
|
+
* Defines a commentary that is used in the dataset.
|
|
26
|
+
*/
|
|
27
|
+
export interface DatasetCommentary extends Commentary {
|
|
28
|
+
/**
|
|
29
|
+
* The list of books that are available for the commentary.
|
|
30
|
+
*/
|
|
31
|
+
books: DatasetCommentaryBook[];
|
|
32
|
+
/**
|
|
33
|
+
* The list of profiles that are available for the commentary.
|
|
34
|
+
*/
|
|
35
|
+
profiles: DatasetCommentaryProfile[];
|
|
36
|
+
}
|
|
20
37
|
/**
|
|
21
38
|
* Defines a translation book that is used in the dataset.
|
|
22
39
|
*/
|
|
@@ -26,9 +43,28 @@ export interface DatasetTranslationBook extends TranslationBook {
|
|
|
26
43
|
*/
|
|
27
44
|
chapters: TranslationBookChapter[];
|
|
28
45
|
}
|
|
46
|
+
/**
|
|
47
|
+
* Defines a commentary book that is used in the dataset.
|
|
48
|
+
*/
|
|
49
|
+
export interface DatasetCommentaryBook extends CommentaryBook {
|
|
50
|
+
/**
|
|
51
|
+
* The list of chapters that are available for the book.
|
|
52
|
+
*/
|
|
53
|
+
chapters: CommentaryBookChapter[];
|
|
54
|
+
}
|
|
55
|
+
export interface DatasetCommentaryProfile extends CommentaryProfile {
|
|
56
|
+
/**
|
|
57
|
+
* The contents of the profile.
|
|
58
|
+
*/
|
|
59
|
+
content: string[];
|
|
60
|
+
}
|
|
29
61
|
/**
|
|
30
62
|
* Generates a list of output files from the given list of input files.
|
|
31
63
|
* @param file The list of files.
|
|
64
|
+
* @param parser The parser to use for parsing the files.
|
|
65
|
+
* @param bookMap The map of book IDs to names. If undefined, then a default map will be used.
|
|
32
66
|
*/
|
|
33
|
-
export declare function generateDataset(files: InputFile[], parser?: DOMParser
|
|
67
|
+
export declare function generateDataset(files: InputFile[], parser?: DOMParser, bookMap?: Map<string, {
|
|
68
|
+
commonName: string;
|
|
69
|
+
}> | undefined): DatasetOutput;
|
|
34
70
|
//# sourceMappingURL=dataset.d.ts.map
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as utils from './utils.js';
|
|
2
2
|
import * as generation from './generation/index.js';
|
|
3
3
|
import * as parser from './parser/index.js';
|
|
4
|
-
|
|
4
|
+
import * as log from './log.js';
|
|
5
|
+
export { utils, generation, parser, log };
|
|
5
6
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A simple logging interface that can be used to log messages.
|
|
3
|
+
*/
|
|
4
|
+
export interface Logger {
|
|
5
|
+
log: (message: any, ...args: any[]) => void;
|
|
6
|
+
warn: (message: string, ...args: any[]) => void;
|
|
7
|
+
error: (message: string, ...args: any[]) => void;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* A logger that logs messages to the console.
|
|
11
|
+
*/
|
|
12
|
+
export declare const consoleLogger: Logger;
|
|
13
|
+
/**
|
|
14
|
+
* Gets the logger that is currently being used for logging messages.
|
|
15
|
+
* @returns The logger that is currently being used.
|
|
16
|
+
*/
|
|
17
|
+
export declare function getLogger(): Logger;
|
|
18
|
+
/**
|
|
19
|
+
* Sets the logger to use for logging messages.
|
|
20
|
+
* @param newLogger The new logger to use.
|
|
21
|
+
*/
|
|
22
|
+
export declare function setLogger(newLogger: Logger): void;
|
|
23
|
+
//# sourceMappingURL=log.d.ts.map
|