@helloao/tools 0.0.13 → 0.0.15

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.
@@ -21,6 +21,7 @@ __export(api_exports, {
21
21
  bookChapterApiLink: () => bookChapterApiLink,
22
22
  bookChapterAudioApiLink: () => bookChapterAudioApiLink,
23
23
  bookCommentaryChapterApiLink: () => bookCommentaryChapterApiLink,
24
+ bookDatasetChapterApiLink: () => bookDatasetChapterApiLink,
24
25
  downloadedFile: () => downloadedFile,
25
26
  generateApiForDataset: () => generateApiForDataset,
26
27
  generateFilesForApi: () => generateFilesForApi,
@@ -28,6 +29,7 @@ __export(api_exports, {
28
29
  jsonFile: () => jsonFile,
29
30
  listOfBooksApiLink: () => listOfBooksApiLink,
30
31
  listOfCommentaryBooksApiLink: () => listOfCommentaryBooksApiLink,
32
+ listOfDatasetBooksApiLink: () => listOfDatasetBooksApiLink,
31
33
  profileCommentaryApiLink: () => profileCommentaryApiLink,
32
34
  profilesCommentaryApiLink: () => profilesCommentaryApiLink,
33
35
  replaceSpacesWithUnderscores: () => replaceSpacesWithUnderscores
@@ -86,19 +88,23 @@ function generateApiForDataset(dataset, options = {}) {
86
88
  };
87
89
  let translationChapters = [];
88
90
  for (let { chapters, ...book } of books) {
91
+ const firstChapterNumber = chapters[0].chapter.number;
92
+ const lastChapterNumber = chapters[chapters.length - 1].chapter.number;
89
93
  const apiBook = {
90
94
  ...book,
95
+ firstChapterNumber,
91
96
  firstChapterApiLink: bookChapterApiLink(
92
97
  translation.id,
93
98
  getBookLink(book),
94
- 1,
99
+ firstChapterNumber,
95
100
  "json",
96
101
  apiPathPrefix
97
102
  ),
103
+ lastChapterNumber,
98
104
  lastChapterApiLink: bookChapterApiLink(
99
105
  translation.id,
100
106
  getBookLink(book),
101
- chapters.length,
107
+ lastChapterNumber,
102
108
  "json",
103
109
  apiPathPrefix
104
110
  ),
@@ -223,22 +229,26 @@ function generateApiForDataset(dataset, options = {}) {
223
229
  };
224
230
  let commentaryChapters = [];
225
231
  for (let { chapters, ...book } of books) {
232
+ const firstChapterNumber = chapters[0]?.chapter.number ?? null;
233
+ const lastChapterNumber = chapters[chapters.length - 1]?.chapter.number ?? null;
226
234
  const apiBook = {
227
235
  ...book,
228
- firstChapterApiLink: bookCommentaryChapterApiLink(
236
+ firstChapterNumber,
237
+ firstChapterApiLink: firstChapterNumber ? bookCommentaryChapterApiLink(
229
238
  commentary.id,
230
239
  getBookLink(book),
231
- 1,
240
+ firstChapterNumber,
232
241
  "json",
233
242
  apiPathPrefix
234
- ),
235
- lastChapterApiLink: bookCommentaryChapterApiLink(
243
+ ) : null,
244
+ lastChapterNumber,
245
+ lastChapterApiLink: lastChapterNumber ? bookCommentaryChapterApiLink(
236
246
  commentary.id,
237
247
  getBookLink(book),
238
- chapters.length,
248
+ lastChapterNumber,
239
249
  "json",
240
250
  apiPathPrefix
241
- ),
251
+ ) : null,
242
252
  numberOfChapters: chapters.length,
243
253
  totalNumberOfVerses: 0
244
254
  };
@@ -325,6 +335,115 @@ function generateApiForDataset(dataset, options = {}) {
325
335
  api.commentaryBooks.push(commentaryBooks);
326
336
  api.commentaryProfiles.push(commentaryProfiles);
327
337
  }
338
+ for (let { books, ...datasetInfo } of dataset.datasets ?? []) {
339
+ const apiDataset = {
340
+ ...datasetInfo,
341
+ availableFormats: ["json"],
342
+ listOfBooksApiLink: listOfDatasetBooksApiLink(
343
+ datasetInfo.id,
344
+ apiPathPrefix
345
+ ),
346
+ numberOfBooks: books.length,
347
+ totalNumberOfChapters: 0,
348
+ totalNumberOfVerses: 0,
349
+ totalNumberOfReferences: 0,
350
+ languageName: getNativeName ? getNativeName(datasetInfo.language) ?? void 0 : void 0,
351
+ languageEnglishName: getEnglishName ? getEnglishName(datasetInfo.language) ?? void 0 : void 0
352
+ };
353
+ const datasetBooks = {
354
+ dataset: apiDataset,
355
+ books: []
356
+ };
357
+ let datasetChapters = [];
358
+ for (let { chapters, ...book } of books) {
359
+ const firstChapterNumber = chapters[0]?.chapter.number ?? null;
360
+ const lastChapterNumber = chapters[chapters.length - 1]?.chapter.number ?? null;
361
+ const apiBook = {
362
+ ...book,
363
+ firstChapterNumber,
364
+ firstChapterApiLink: bookDatasetChapterApiLink(
365
+ datasetInfo.id,
366
+ book.id,
367
+ firstChapterNumber,
368
+ "json",
369
+ apiPathPrefix
370
+ ),
371
+ lastChapterNumber,
372
+ lastChapterApiLink: bookDatasetChapterApiLink(
373
+ datasetInfo.id,
374
+ book.id,
375
+ lastChapterNumber,
376
+ "json",
377
+ apiPathPrefix
378
+ ),
379
+ numberOfChapters: chapters.length,
380
+ totalNumberOfVerses: 0,
381
+ totalNumberOfReferences: 0
382
+ };
383
+ for (let { chapter } of chapters) {
384
+ const apiBookChapter = {
385
+ dataset: apiDataset,
386
+ book: apiBook,
387
+ chapter,
388
+ thisChapterLink: bookDatasetChapterApiLink(
389
+ datasetInfo.id,
390
+ book.id,
391
+ chapter.number,
392
+ "json",
393
+ apiPathPrefix
394
+ ),
395
+ nextChapterApiLink: null,
396
+ previousChapterApiLink: null,
397
+ numberOfVerses: chapter.content.length,
398
+ numberOfReferences: 0
399
+ };
400
+ for (let verse of chapter.content) {
401
+ apiBookChapter.numberOfReferences += verse.references.length;
402
+ }
403
+ apiBook.totalNumberOfVerses += apiBookChapter.numberOfVerses;
404
+ apiBook.totalNumberOfReferences += apiBookChapter.numberOfReferences;
405
+ datasetChapters.push(apiBookChapter);
406
+ if (!api.datasetBookChapters) {
407
+ api.datasetBookChapters = [];
408
+ }
409
+ api.datasetBookChapters.push(apiBookChapter);
410
+ }
411
+ datasetBooks.books.push(apiBook);
412
+ apiDataset.totalNumberOfChapters += apiBook.numberOfChapters;
413
+ apiDataset.totalNumberOfVerses += apiBook.totalNumberOfVerses;
414
+ apiDataset.totalNumberOfReferences += apiBook.totalNumberOfReferences;
415
+ }
416
+ for (let i = 0; i < datasetChapters.length; i++) {
417
+ if (i > 0) {
418
+ datasetChapters[i].previousChapterApiLink = bookDatasetChapterApiLink(
419
+ datasetInfo.id,
420
+ datasetChapters[i - 1].book.id,
421
+ datasetChapters[i - 1].chapter.number,
422
+ "json",
423
+ apiPathPrefix
424
+ );
425
+ }
426
+ if (i < datasetChapters.length - 1) {
427
+ datasetChapters[i].nextChapterApiLink = bookDatasetChapterApiLink(
428
+ datasetInfo.id,
429
+ datasetChapters[i + 1].book.id,
430
+ datasetChapters[i + 1].chapter.number,
431
+ "json",
432
+ apiPathPrefix
433
+ );
434
+ }
435
+ }
436
+ if (!api.availableDatasets) {
437
+ api.availableDatasets = {
438
+ datasets: []
439
+ };
440
+ }
441
+ api.availableDatasets.datasets.push(apiDataset);
442
+ if (!api.datasetBooks) {
443
+ api.datasetBooks = [];
444
+ }
445
+ api.datasetBooks.push(datasetBooks);
446
+ }
328
447
  return api;
329
448
  function getBookLink(book) {
330
449
  return useCommonName ? book.commonName : book.id;
@@ -384,6 +503,29 @@ function generateFilesForApi(api) {
384
503
  for (let bookChapter of api.commentaryBookChapters) {
385
504
  files.push(jsonFile(bookChapter.thisChapterLink, bookChapter));
386
505
  }
506
+ if (api.availableDatasets) {
507
+ files.push(
508
+ jsonFile(
509
+ `${api.pathPrefix}/api/available_datasets.json`,
510
+ api.availableDatasets,
511
+ true
512
+ )
513
+ );
514
+ }
515
+ if (api.datasetBooks) {
516
+ for (let datasetBook of api.datasetBooks) {
517
+ files.push(
518
+ jsonFile(datasetBook.dataset.listOfBooksApiLink, datasetBook)
519
+ );
520
+ }
521
+ }
522
+ if (api.datasetBookChapters) {
523
+ for (let datasetBookChapter of api.datasetBookChapters) {
524
+ files.push(
525
+ jsonFile(datasetBookChapter.thisChapterLink, datasetBookChapter)
526
+ );
527
+ }
528
+ }
387
529
  return files;
388
530
  }
389
531
  async function* generateOutputFilesFromDatasets(datasets, options) {
@@ -399,6 +541,9 @@ function listOfBooksApiLink(translationId, prefix = "") {
399
541
  function listOfCommentaryBooksApiLink(commentaryId, prefix = "") {
400
542
  return `${prefix}/api/c/${commentaryId}/books.json`;
401
543
  }
544
+ function listOfDatasetBooksApiLink(datasetId, prefix = "") {
545
+ return `${prefix}/api/d/${datasetId}/books.json`;
546
+ }
402
547
  function bookChapterApiLink(translationId, commonName, chapterNumber, extension, prefix = "") {
403
548
  return `${prefix}/api/${translationId}/${replaceSpacesWithUnderscores(
404
549
  commonName
@@ -414,6 +559,11 @@ function bookChapterAudioApiLink(translationId, bookId, chapterNumber, reader, p
414
559
  bookId
415
560
  )}/${chapterNumber}.${reader}.mp3`;
416
561
  }
562
+ function bookDatasetChapterApiLink(translationId, commonName, chapterNumber, extension, prefix = "") {
563
+ return `${prefix}/api/d/${translationId}/${replaceSpacesWithUnderscores(
564
+ commonName
565
+ )}/${chapterNumber}.${extension}`;
566
+ }
417
567
  function profilesCommentaryApiLink(translationId, extension, prefix = "") {
418
568
  return `${prefix}/api/c/${translationId}/profiles.${extension}`;
419
569
  }
@@ -443,6 +593,7 @@ function replaceSpacesWithUnderscores(str) {
443
593
  bookChapterApiLink,
444
594
  bookChapterAudioApiLink,
445
595
  bookCommentaryChapterApiLink,
596
+ bookDatasetChapterApiLink,
446
597
  downloadedFile,
447
598
  generateApiForDataset,
448
599
  generateFilesForApi,
@@ -450,6 +601,7 @@ function replaceSpacesWithUnderscores(str) {
450
601
  jsonFile,
451
602
  listOfBooksApiLink,
452
603
  listOfCommentaryBooksApiLink,
604
+ listOfDatasetBooksApiLink,
453
605
  profileCommentaryApiLink,
454
606
  profilesCommentaryApiLink,
455
607
  replaceSpacesWithUnderscores
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../generation/api.ts"],
4
- "sourcesContent": ["import {\n Commentary,\n CommentaryBook,\n CommentaryBookChapter,\n CommentaryProfile,\n OutputFile,\n Translation,\n TranslationBook,\n TranslationBookChapter,\n TranslationBookChapterAudioLinks,\n} from './common-types.js';\nimport { DatasetOutput } from './dataset.js';\n\n/**\n * Defines the output of the API generation.\n */\nexport interface ApiOutput {\n /**\n * The list of available translations.\n * This maps to the /api/available-translations.json endpoint.\n */\n availableTranslations: ApiAvailableTranslations;\n\n /**\n * The list of books for each translation.\n * This maps to the /api/:translationId/books.json endpoint.\n */\n translationBooks: ApiTranslationBooks[];\n\n /**\n * The list of chapters for each book.\n * This maps to the following endpoints:\n * - /api/:translationId/:bookId/:chapterNumber.json\n * - /api/:translationId/:bookCommonName/:chapterNumber.json\n */\n translationBookChapters: ApiTranslationBookChapter[];\n\n /**\n * The list of audio files.\n * This maps to the following endpoints:\n * - /api/:translationId/:bookId/:chapterNumber.:reader.mp3\n */\n translationBookChapterAudio: ApiTranslationBookChapterAudio[];\n\n /**\n * The list of available commentaries.\n * This maps to the /api/available-commentaries.json endpoint.\n */\n availableCommentaries: ApiAvailableCommentaries;\n\n /**\n * The list of books for each commentary.\n * This maps to the /api/c/:commentaryId/books.json endpoint.\n */\n commentaryBooks: ApiCommentaryBooks[];\n\n /**\n * The list of profiles for each commentary.\n * This maps to the /api/c/:commentaryId/profiles.json endpoint.\n */\n commentaryProfiles: ApiCommentaryProfiles[];\n\n /**\n * The list of chapters for each commentary book.\n * This maps to the following endpoint:\n * - /api/c/:commentaryId/:bookId/:chapterNumber.json\n */\n commentaryBookChapters: ApiCommentaryBookChapter[];\n\n /**\n * The list of individual profiles for each commentary.\n * This maps to the following endpoint:\n * - /api/c/:commentaryId/profiles/:profileId.json\n */\n commentaryProfileContents: ApiCommentaryProfileContent[];\n\n /**\n * The path prefix that the API should use.\n */\n pathPrefix: string;\n}\n\n/**\n * The list of available translations.\n * Maps to the /api/available-translations.json endpoint.\n */\nexport interface ApiAvailableTranslations {\n /**\n * The list of translations.\n */\n translations: ApiTranslation[];\n}\n\n/**\n * The list of available commentaries.\n * Maps to the /api/available-commentaries.json endpoint.\n */\nexport interface ApiAvailableCommentaries {\n /**\n * The list of commentaries.\n */\n commentaries: ApiCommentary[];\n}\n\n/**\n * Defines a translation that is used in the API.\n */\nexport interface ApiTranslation extends Translation {\n /**\n * The API link for the list of available books for this translation.\n */\n listOfBooksApiLink: string;\n\n /**\n * The available list of formats.\n */\n availableFormats: ('json' | 'usfm')[];\n\n /**\n * The number of books that are contained in this translation.\n *\n * Complete translations should have the same number of books as the Bible (66).\n */\n numberOfBooks: number;\n\n /**\n * The total number of chapters that are contained in this translation.\n *\n * Complete translations should have the same number of chapters as the Bible (1,189).\n */\n totalNumberOfChapters: number;\n\n /**\n * The total number of verses that are contained in this translation.\n *\n * Complete translations should have the same number of verses as the Bible (around 31,102 - some translations exclude verses based on the aparent likelyhood of existing in the original source texts).\n */\n totalNumberOfVerses: number;\n\n /**\n * The total number of apocryphal books that are contained in this translation.\n */\n numberOfApocryphalBooks?: number;\n\n /**\n * The total number of apocryphal chapters that are contained in this translation.\n */\n totalNumberOfApocryphalChapters?: number;\n\n /**\n * the total number of apocryphal verses that are contained in this translation.\n */\n totalNumberOfApocryphalVerses?: number;\n\n /**\n * Gets the name of the language that the translation is in.\n * Null or undefined if the name of the language is not known.\n */\n languageName?: string;\n\n /**\n * Gets the name of the language in English.\n * Null or undefined if the language doesn't have an english name.\n */\n languageEnglishName?: string;\n}\n\n/**\n * Defines a commentary that is used in the API.\n */\nexport interface ApiCommentary extends Commentary {\n /**\n * The API link for the list of available books for this translation.\n */\n listOfBooksApiLink: string;\n\n /**\n * The API link for the list of available profiles for this commentary.\n */\n listOfProfilesApiLink: string;\n\n /**\n * The available list of formats.\n */\n availableFormats: ('json' | 'usfm')[];\n\n /**\n * The number of books that are contained in this commentary.\n *\n * Complete commentaries should have the same number of books as the Bible (66).\n */\n numberOfBooks: number;\n\n /**\n * The total number of chapters that are contained in this translation.\n *\n * Complete commentaries should have the same number of chapters as the Bible (1,189).\n */\n totalNumberOfChapters: number;\n\n /**\n * The total number of verses that are contained in this commentary.\n *\n * 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).\n */\n totalNumberOfVerses: number;\n\n /**\n * The total number of profiles that are contained in this commentary.\n *\n * Profiles are used to provide additional information about people and people groups that are mentioned in the Bible.\n */\n totalNumberOfProfiles: number;\n\n /**\n * Gets the name of the language that the commentary is in.\n * Null or undefined if the name of the language is not known.\n */\n languageName?: string;\n\n /**\n * Gets the name of the language in English.\n * Null or undefined if the language doesn't have an english name.\n */\n languageEnglishName?: string;\n}\n\n/**\n * Defines an interface that contains information about the books that are available for a translation.\n */\nexport interface ApiTranslationBooks {\n /**\n * The translation information for the books.\n */\n translation: ApiTranslation;\n\n /**\n * The list of books that are available for the translation.\n */\n books: ApiTranslationBook[];\n}\n\n/**\n * Defines an interface that contains information about the books that are available for a commentary.\n */\nexport interface ApiCommentaryBooks {\n /**\n * The commentary information for the books.\n */\n commentary: ApiCommentary;\n\n /**\n * The list of books that are available for the commentary.\n */\n books: ApiCommentaryBook[];\n}\n\n/**\n * Defines an interface that contains information about the profiles that are available for a commentary.\n */\nexport interface ApiCommentaryProfiles {\n /**\n * The commentary information for the books.\n */\n commentary: ApiCommentary;\n\n /**\n * The list of profiles that are available for the commentary.\n */\n profiles: ApiCommentaryProfile[];\n}\n\n/**\n * Defines an interface that contains information about a profile.\n */\nexport interface ApiCommentaryProfile extends CommentaryProfile {\n /**\n * The link to this profile.\n */\n thisProfileLink: string;\n\n /**\n * The link to the chapter that this profile references in the commentary.\n */\n referenceChapterLink: string | null;\n}\n\n/**\n * Defines a translation book that is used in the API.\n */\nexport interface ApiTranslationBook extends TranslationBook {\n /**\n * The link to the first chapter of the book.\n */\n firstChapterApiLink: string;\n\n /**\n * The link to the last chapter of the book.\n */\n lastChapterApiLink: string;\n\n /**\n * The number of chapters that the book contains.\n */\n numberOfChapters: number;\n\n /**\n * The number of verses that the book contains.\n */\n totalNumberOfVerses: number;\n}\n\n/**\n * Defines a commentary book that is used in the API.\n */\nexport interface ApiCommentaryBook extends CommentaryBook {\n /**\n * The link to the first chapter of the book.\n */\n firstChapterApiLink: string;\n\n /**\n * The link to the last chapter of the book.\n */\n lastChapterApiLink: string;\n\n /**\n * The number of chapters that the book contains.\n */\n numberOfChapters: number;\n\n /**\n * The number of verses that the book contains.\n */\n totalNumberOfVerses: number;\n}\n\n/**\n * Defines an interface that contains information about a book chapter.\n */\nexport interface ApiTranslationBookChapter extends TranslationBookChapter {\n /**\n * The translation information for the book chapter.\n */\n translation: ApiTranslation;\n\n /**\n * The book information for the book chapter.\n */\n book: ApiTranslationBook;\n\n /**\n * The link to this chapter.\n */\n thisChapterLink: string;\n\n /**\n * The link to the next chapter.\n * Null if this is the last chapter in the translation.\n */\n nextChapterApiLink: string | null;\n\n /**\n * The links to the audio versions for the next chapter.\n * Null if this is the last chapter in the translation.\n */\n nextChapterAudioLinks: TranslationBookChapterAudioLinks | null;\n\n /**\n * The link to the previous chapter.\n * Null if this is the first chapter in the translation.\n */\n previousChapterApiLink: string | null;\n\n /**\n * The links to the audio versions for the previous chapter.\n * Null if this is the first chapter in the translation.\n */\n previousChapterAudioLinks: TranslationBookChapterAudioLinks | null;\n\n /**\n * The number of verses that the chapter contains.\n */\n numberOfVerses: number;\n}\n\n/**\n * Defines an interface that contains information about a book chapter.\n */\nexport interface ApiCommentaryBookChapter extends CommentaryBookChapter {\n /**\n * The commentary information for the book chapter.\n */\n commentary: ApiCommentary;\n\n /**\n * The book information for the book chapter.\n */\n book: ApiCommentaryBook;\n\n /**\n * The link to this chapter.\n */\n thisChapterLink: string;\n\n /**\n * The link to the next chapter.\n * Null if this is the last chapter in the translation.\n */\n nextChapterApiLink: string | null;\n\n /**\n * The link to the previous chapter.\n * Null if this is the first chapter in the translation.\n */\n previousChapterApiLink: string | null;\n\n /**\n * The number of verses that the chapter contains.\n */\n numberOfVerses: number;\n}\n\nexport interface ApiTranslationBookChapterAudio {\n /**\n * The chapter that the audio is for.\n */\n chapter: ApiTranslationBookChapter;\n\n /**\n * The link that the audio should be placed at.\n */\n link: string;\n\n /**\n * The original URL of the audio.\n */\n originalUrl: string;\n}\n\nexport interface ApiCommentaryProfileContent {\n /**\n * The commentary information for the profile.\n */\n commentary: ApiCommentary;\n\n /**\n * The information about the profile.\n */\n profile: ApiCommentaryProfile;\n\n /**\n * The content of the profile.\n */\n content: string[];\n}\n\n/**\n * The options for generating the API.\n */\nexport interface GenerateApiOptions {\n /**\n * Whether to use the common name for the book chapter API link. If false, then book IDs are used.\n * Audio URLs will always use the book ID.\n * Defaults to false.\n */\n useCommonName?: boolean;\n\n /**\n * Whether to replace the audio URLs in the dataset with ones that are hosted locally.\n * If true, then the audio URLs in the dataset will be replaced with ones that reference files hosted by the API itself.\n * If false, then the audio URLs in the dataset will be left as is.\n * Defaults to false.\n */\n generateAudioFiles?: boolean;\n\n /**\n * Gets the english name of the given language.\n * If not provided, then the english name for the language will be unknown and omitted.\n * @param language The language to get the english name for.\n */\n getEnglishName?: (language: string) => string | null | undefined;\n\n /**\n * Gets the native name of the given language.\n * If not provided, then the native name for the language will be unknown and omitted.\n * @param language The language to get the native name for.\n */\n getNativeName?: (language: string) => string | null | undefined;\n\n /**\n * The prefix that should be added to paths that are generated.\n */\n pathPrefix?: string;\n}\n\n/**\n * Generates the API output for the given dataset.\n * @param dataset The dataset to generate the API for.\n * @param options The options for generating the API.\n */\nexport function generateApiForDataset(\n dataset: DatasetOutput,\n options: GenerateApiOptions = {}\n): ApiOutput {\n const { useCommonName, pathPrefix } = options;\n const apiPathPrefix = pathPrefix ? pathPrefix : '';\n let api: ApiOutput = {\n availableTranslations: {\n translations: [],\n },\n translationBooks: [],\n translationBookChapters: [],\n translationBookChapterAudio: [],\n availableCommentaries: {\n commentaries: [],\n },\n commentaryBookChapters: [],\n commentaryBooks: [],\n commentaryProfiles: [],\n commentaryProfileContents: [],\n pathPrefix: apiPathPrefix,\n };\n\n const getNativeName = options.getNativeName;\n const getEnglishName = options.getEnglishName;\n\n for (let { books, ...translation } of dataset.translations) {\n let numberOfBooks = 0;\n let numberOfApocryphalBooks = 0;\n\n for (let book of books) {\n if (book.isApocryphal) {\n numberOfApocryphalBooks++;\n } else {\n numberOfBooks++;\n }\n }\n\n const apiTranslation: ApiTranslation = {\n ...translation,\n availableFormats: ['json'],\n listOfBooksApiLink: listOfBooksApiLink(\n translation.id,\n apiPathPrefix\n ),\n numberOfBooks,\n totalNumberOfChapters: 0,\n totalNumberOfVerses: 0,\n languageName: getNativeName\n ? (getNativeName(translation.language) ?? undefined)\n : undefined,\n languageEnglishName: getEnglishName\n ? (getEnglishName(translation.language) ?? undefined)\n : undefined,\n };\n\n if (numberOfApocryphalBooks > 0) {\n apiTranslation.numberOfApocryphalBooks = numberOfApocryphalBooks;\n }\n\n const translationBooks: ApiTranslationBooks = {\n translation: apiTranslation,\n books: [],\n };\n\n let translationChapters: ApiTranslationBookChapter[] = [];\n\n for (let { chapters, ...book } of books) {\n const apiBook: ApiTranslationBook = {\n ...book,\n firstChapterApiLink: bookChapterApiLink(\n translation.id,\n getBookLink(book),\n 1,\n 'json',\n apiPathPrefix\n ),\n lastChapterApiLink: bookChapterApiLink(\n translation.id,\n getBookLink(book),\n chapters.length,\n 'json',\n apiPathPrefix\n ),\n numberOfChapters: chapters.length,\n totalNumberOfVerses: 0,\n };\n\n for (let { chapter, thisChapterAudioLinks } of chapters) {\n const audio: TranslationBookChapterAudioLinks = {};\n const apiBookChapter: ApiTranslationBookChapter = {\n translation: apiTranslation,\n book: apiBook,\n chapter: chapter,\n thisChapterLink: bookChapterApiLink(\n translation.id,\n getBookLink(book),\n chapter.number,\n 'json',\n apiPathPrefix\n ),\n thisChapterAudioLinks: audio,\n nextChapterApiLink: null,\n nextChapterAudioLinks: null,\n previousChapterApiLink: null,\n previousChapterAudioLinks: null,\n numberOfVerses: 0,\n };\n\n for (let reader in thisChapterAudioLinks) {\n if (options.generateAudioFiles) {\n const apiAudio: ApiTranslationBookChapterAudio = {\n chapter: apiBookChapter,\n link: bookChapterAudioApiLink(\n translation.id,\n getBookLink(book),\n chapter.number,\n reader,\n apiPathPrefix\n ),\n originalUrl: thisChapterAudioLinks[reader],\n };\n audio[reader] = apiAudio.link;\n api.translationBookChapterAudio.push(apiAudio);\n } else {\n audio[reader] = thisChapterAudioLinks[reader];\n }\n }\n\n for (let c of chapter.content) {\n if (c.type === 'verse') {\n apiBookChapter.numberOfVerses++;\n }\n }\n\n apiBook.totalNumberOfVerses += apiBookChapter.numberOfVerses;\n\n translationChapters.push(apiBookChapter);\n api.translationBookChapters.push(apiBookChapter);\n }\n\n translationBooks.books.push(apiBook);\n\n if (apiBook.isApocryphal) {\n if (!apiTranslation.totalNumberOfApocryphalChapters) {\n apiTranslation.totalNumberOfApocryphalChapters = 0;\n }\n if (!apiTranslation.totalNumberOfApocryphalVerses) {\n apiTranslation.totalNumberOfApocryphalVerses = 0;\n }\n apiTranslation.totalNumberOfApocryphalChapters +=\n apiBook.numberOfChapters;\n apiTranslation.totalNumberOfApocryphalVerses +=\n apiBook.totalNumberOfVerses;\n } else {\n apiTranslation.totalNumberOfChapters +=\n apiBook.numberOfChapters;\n apiTranslation.totalNumberOfVerses +=\n apiBook.totalNumberOfVerses;\n }\n }\n\n for (let i = 0; i < translationChapters.length; i++) {\n if (i > 0) {\n translationChapters[i].previousChapterApiLink =\n bookChapterApiLink(\n translation.id,\n getBookLink(translationChapters[i - 1].book),\n translationChapters[i - 1].chapter.number,\n 'json',\n apiPathPrefix\n );\n translationChapters[i].previousChapterAudioLinks =\n translationChapters[i - 1].thisChapterAudioLinks;\n }\n\n if (i < translationChapters.length - 1) {\n translationChapters[i].nextChapterApiLink = bookChapterApiLink(\n translation.id,\n getBookLink(translationChapters[i + 1].book),\n translationChapters[i + 1].chapter.number,\n 'json',\n apiPathPrefix\n );\n translationChapters[i].nextChapterAudioLinks =\n translationChapters[i + 1].thisChapterAudioLinks;\n }\n }\n\n api.availableTranslations.translations.push(apiTranslation);\n api.translationBooks.push(translationBooks);\n }\n\n for (let { books, profiles, ...commentary } of dataset.commentaries) {\n const apiCommentary: ApiCommentary = {\n ...commentary,\n availableFormats: ['json'],\n listOfBooksApiLink: listOfCommentaryBooksApiLink(\n commentary.id,\n apiPathPrefix\n ),\n listOfProfilesApiLink: profilesCommentaryApiLink(\n commentary.id,\n 'json',\n apiPathPrefix\n ),\n numberOfBooks: books.length,\n totalNumberOfChapters: 0,\n totalNumberOfVerses: 0,\n totalNumberOfProfiles: 0,\n languageName: getNativeName\n ? (getNativeName(commentary.language) ?? undefined)\n : undefined,\n languageEnglishName: getEnglishName\n ? (getEnglishName(commentary.language) ?? undefined)\n : undefined,\n };\n\n const commentaryBooks: ApiCommentaryBooks = {\n commentary: apiCommentary,\n books: [],\n };\n\n const commentaryProfiles: ApiCommentaryProfiles = {\n commentary: apiCommentary,\n profiles: [],\n };\n\n let commentaryChapters: ApiCommentaryBookChapter[] = [];\n\n for (let { chapters, ...book } of books) {\n const apiBook: ApiCommentaryBook = {\n ...book,\n firstChapterApiLink: bookCommentaryChapterApiLink(\n commentary.id,\n getBookLink(book),\n 1,\n 'json',\n apiPathPrefix\n ),\n lastChapterApiLink: bookCommentaryChapterApiLink(\n commentary.id,\n getBookLink(book),\n chapters.length,\n 'json',\n apiPathPrefix\n ),\n numberOfChapters: chapters.length,\n totalNumberOfVerses: 0,\n };\n\n for (let { chapter } of chapters) {\n const apiBookChapter: ApiCommentaryBookChapter = {\n commentary: apiCommentary,\n book: apiBook,\n chapter: chapter,\n thisChapterLink: bookCommentaryChapterApiLink(\n commentary.id,\n getBookLink(book),\n chapter.number,\n 'json',\n apiPathPrefix\n ),\n nextChapterApiLink: null,\n previousChapterApiLink: null,\n numberOfVerses: 0,\n };\n\n for (let c of chapter.content) {\n if (c.type === 'verse') {\n apiBookChapter.numberOfVerses++;\n }\n }\n\n apiBook.totalNumberOfVerses += apiBookChapter.numberOfVerses;\n\n commentaryChapters.push(apiBookChapter);\n api.commentaryBookChapters.push(apiBookChapter);\n }\n\n commentaryBooks.books.push(apiBook);\n\n apiCommentary.totalNumberOfChapters += apiBook.numberOfChapters;\n apiCommentary.totalNumberOfVerses += apiBook.totalNumberOfVerses;\n }\n\n if (profiles) {\n for (let profile of profiles) {\n const apiProfile: ApiCommentaryProfile = {\n id: profile.id,\n reference: profile.reference,\n subject: profile.subject,\n thisProfileLink: profileCommentaryApiLink(\n commentary.id,\n profile.id,\n 'json',\n apiPathPrefix\n ),\n referenceChapterLink: profile.reference\n ? bookCommentaryChapterApiLink(\n commentary.id,\n profile.reference.book,\n profile.reference.chapter,\n 'json',\n apiPathPrefix\n )\n : null,\n };\n\n const apiProfileContent: ApiCommentaryProfileContent = {\n commentary: apiCommentary,\n profile: apiProfile,\n content: profile.content,\n };\n\n apiCommentary.totalNumberOfProfiles += 1;\n commentaryProfiles.profiles.push(apiProfile);\n api.commentaryProfileContents.push(apiProfileContent);\n }\n }\n\n for (let i = 0; i < commentaryChapters.length; i++) {\n if (i > 0) {\n commentaryChapters[i].previousChapterApiLink =\n bookCommentaryChapterApiLink(\n commentary.id,\n getBookLink(commentaryChapters[i - 1].book),\n commentaryChapters[i - 1].chapter.number,\n 'json',\n apiPathPrefix\n );\n // commentaryChapters[i].previousChapterAudioLinks =\n // commentaryChapters[i - 1].thisChapterAudioLinks;\n }\n\n if (i < commentaryChapters.length - 1) {\n commentaryChapters[i].nextChapterApiLink =\n bookCommentaryChapterApiLink(\n commentary.id,\n getBookLink(commentaryChapters[i + 1].book),\n commentaryChapters[i + 1].chapter.number,\n 'json',\n apiPathPrefix\n );\n // commentaryChapters[i].nextChapterAudioLinks =\n // commentaryChapters[i + 1].thisChapterAudioLinks;\n }\n }\n\n api.availableCommentaries.commentaries.push(apiCommentary);\n api.commentaryBooks.push(commentaryBooks);\n api.commentaryProfiles.push(commentaryProfiles);\n }\n\n return api;\n\n function getBookLink(book: TranslationBook | CommentaryBook): string {\n return useCommonName ? book.commonName : book.id;\n }\n}\n\n/**\n * Generates the output files for the given API.\n * @param api The API that the files should be generated for.\n */\nexport function generateFilesForApi(api: ApiOutput): OutputFile[] {\n let files: OutputFile[] = [];\n\n files.push(\n jsonFile(\n `${api.pathPrefix}/api/available_translations.json`,\n api.availableTranslations,\n true\n )\n );\n for (let translationBooks of api.translationBooks) {\n files.push(\n jsonFile(\n translationBooks.translation.listOfBooksApiLink,\n translationBooks\n )\n );\n }\n\n for (let bookChapter of api.translationBookChapters) {\n files.push(jsonFile(bookChapter.thisChapterLink, bookChapter));\n }\n\n for (let audio of api.translationBookChapterAudio) {\n files.push(downloadedFile(audio.link, audio.originalUrl));\n }\n\n files.push(\n jsonFile(\n `${api.pathPrefix}/api/available_commentaries.json`,\n api.availableCommentaries,\n true\n )\n );\n for (let commentaryBooks of api.commentaryBooks) {\n files.push(\n jsonFile(\n commentaryBooks.commentary.listOfBooksApiLink,\n commentaryBooks\n )\n );\n }\n\n for (let commentaryProfiles of api.commentaryProfiles) {\n files.push(\n jsonFile(\n commentaryProfiles.commentary.listOfProfilesApiLink,\n commentaryProfiles\n )\n );\n }\n\n for (let profileContent of api.commentaryProfileContents) {\n files.push(\n jsonFile(profileContent.profile.thisProfileLink, profileContent)\n );\n }\n\n for (let bookChapter of api.commentaryBookChapters) {\n files.push(jsonFile(bookChapter.thisChapterLink, bookChapter));\n }\n\n // for (let audio of api.translationBookChapterAudio) {\n // files.push(downloadedFile(audio.link, audio.originalUrl));\n // }\n\n return files;\n}\n\n/**\n * Generates the output files for the given datasets.\n * @param datasets The datasets to generate the output files for.\n * @param options The options for generating the API files.\n */\nexport async function* generateOutputFilesFromDatasets(\n datasets: AsyncIterable<DatasetOutput>,\n options?: GenerateApiOptions\n): AsyncGenerator<OutputFile[]> {\n for await (let dataset of datasets) {\n const api = generateApiForDataset(dataset, options);\n const files = generateFilesForApi(api);\n\n yield files;\n }\n}\n\n/**\n * Gets the API Link for the list of books endpoint for a translation.\n * @param translationId The ID of the translation.\n * @returns\n */\nexport function listOfBooksApiLink(\n translationId: string,\n prefix: string = ''\n): string {\n return `${prefix}/api/${translationId}/books.json`;\n}\n\n/**\n * Gets the API Link for the list of books endpoint for a commentary.\n * @param commentaryId The ID of the commentary.\n * @returns\n */\nexport function listOfCommentaryBooksApiLink(\n commentaryId: string,\n prefix: string = ''\n): string {\n return `${prefix}/api/c/${commentaryId}/books.json`;\n}\n\n/**\n * Getes the API link for a book chapter.\n * @param translationId The ID of the translation.\n * @param commonName The name of the book.\n * @param chapterNumber The number of the book.\n * @param extension The extension of the file.\n */\nexport function bookChapterApiLink(\n translationId: string,\n commonName: string,\n chapterNumber: number,\n extension: string,\n prefix: string = ''\n) {\n return `${prefix}/api/${translationId}/${replaceSpacesWithUnderscores(\n commonName\n )}/${chapterNumber}.${extension}`;\n}\n\n/**\n * Getes the API link for a book chapter.\n * @param translationId The ID of the translation.\n * @param commonName The name of the book.\n * @param chapterNumber The number of the book.\n * @param extension The extension of the file.\n */\nexport function bookCommentaryChapterApiLink(\n translationId: string,\n commonName: string,\n chapterNumber: number,\n extension: string,\n prefix: string = ''\n) {\n return `${prefix}/api/c/${translationId}/${replaceSpacesWithUnderscores(\n commonName\n )}/${chapterNumber}.${extension}`;\n}\n\nexport function bookChapterAudioApiLink(\n translationId: string,\n bookId: string,\n chapterNumber: number,\n reader: string,\n prefix: string = ''\n) {\n return `${prefix}/api/${translationId}/${replaceSpacesWithUnderscores(\n bookId\n )}/${chapterNumber}.${reader}.mp3`;\n}\n\n/**\n * Gets the API link for a profile.\n * @param translationId The ID of the translation.\n * @param profileId The ID of the profile.\n * @param extension The extension of the file.\n */\nexport function profilesCommentaryApiLink(\n translationId: string,\n extension: string,\n prefix: string = ''\n) {\n return `${prefix}/api/c/${translationId}/profiles.${extension}`;\n}\n\n/**\n * Gets the API link for a profile.\n * @param translationId The ID of the translation.\n * @param profileId The ID of the profile.\n * @param extension The extension of the file.\n */\nexport function profileCommentaryApiLink(\n translationId: string,\n profileId: string,\n extension: string,\n prefix: string = ''\n) {\n return `${prefix}/api/c/${translationId}/profiles/${replaceSpacesWithUnderscores(\n profileId\n )}.${extension}`;\n}\n\nexport function jsonFile(\n path: string,\n content: any,\n mergable?: boolean\n): OutputFile {\n return {\n path,\n content,\n mergable,\n };\n}\n\nexport function downloadedFile(path: string, url: string): OutputFile {\n return {\n path,\n content: () => fetch(url).then((response) => response.body),\n };\n}\n\nexport function replaceSpacesWithUnderscores(str: string): string {\n return str.replace(/[<>:\"/\\\\|?*\\s]/g, '_');\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAqfO,SAAS,sBACZ,SACA,UAA8B,CAAC,GACtB;AACT,QAAM,EAAE,eAAe,WAAW,IAAI;AACtC,QAAM,gBAAgB,aAAa,aAAa;AAChD,MAAI,MAAiB;AAAA,IACjB,uBAAuB;AAAA,MACnB,cAAc,CAAC;AAAA,IACnB;AAAA,IACA,kBAAkB,CAAC;AAAA,IACnB,yBAAyB,CAAC;AAAA,IAC1B,6BAA6B,CAAC;AAAA,IAC9B,uBAAuB;AAAA,MACnB,cAAc,CAAC;AAAA,IACnB;AAAA,IACA,wBAAwB,CAAC;AAAA,IACzB,iBAAiB,CAAC;AAAA,IAClB,oBAAoB,CAAC;AAAA,IACrB,2BAA2B,CAAC;AAAA,IAC5B,YAAY;AAAA,EAChB;AAEA,QAAM,gBAAgB,QAAQ;AAC9B,QAAM,iBAAiB,QAAQ;AAE/B,WAAS,EAAE,OAAO,GAAG,YAAY,KAAK,QAAQ,cAAc;AACxD,QAAI,gBAAgB;AACpB,QAAI,0BAA0B;AAE9B,aAAS,QAAQ,OAAO;AACpB,UAAI,KAAK,cAAc;AACnB;AAAA,MACJ,OAAO;AACH;AAAA,MACJ;AAAA,IACJ;AAEA,UAAM,iBAAiC;AAAA,MACnC,GAAG;AAAA,MACH,kBAAkB,CAAC,MAAM;AAAA,MACzB,oBAAoB;AAAA,QAChB,YAAY;AAAA,QACZ;AAAA,MACJ;AAAA,MACA;AAAA,MACA,uBAAuB;AAAA,MACvB,qBAAqB;AAAA,MACrB,cAAc,gBACP,cAAc,YAAY,QAAQ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AA,EACJ,CAAC,IAAI,aAAa,IAAI,MAAM;AAChC;AAQO,SAAS,0BACZ,eACA,WACA,SAAiB,IACnB;AACE,SAAO,GAAG,MAAM,UAAU,aAAa,aAAa,SAAS;AACjE;AAQO,SAAS,yBACZ,eACA,WACA,WACA,SAAiB,IACnB;AACE,SAAO,GAAG,MAAM,UAAU,aAAa,aAAa;AAAA,IAChD;AAAA,EACJ,CAAC,IAAI,SAAS;AAClB;AAEO,SAAS,SACZ,MACA,SACA,UACU;AACV,SAAO;AAAA,IACH;AAAA,IACA;AAAA,IACA;AAAA,EACJ;AACJ;AAEO,SAAS,eAAe,MAAc,KAAyB;AAClE,SAAO;AAAA,IACH;AAAA,IACA,SAAS,MAAM,MAAM,GAAG,EAAE,KAAK,CAAC,aAAa,SAAS,IAAI;AAAA,EAC9D;AACJ;AAEO,SAAS,6BAA6B,KAAqB;AAC9D,SAAO,IAAI,QAAQ,mBAAmB,GAAG;AAC7C;",
4
+ "sourcesContent": ["import {\n Commentary,\n CommentaryBook,\n CommentaryBookChapter,\n CommentaryProfile,\n Dataset,\n DatasetBook,\n DatasetBookChapter,\n OutputFile,\n Translation,\n TranslationBook,\n TranslationBookChapter,\n TranslationBookChapterAudioLinks,\n} from './common-types.js';\nimport { DatasetOutput } from './dataset.js';\n\n/**\n * Defines the output of the API generation.\n */\nexport interface ApiOutput {\n /**\n * The list of available translations.\n * This maps to the /api/available-translations.json endpoint.\n */\n availableTranslations: ApiAvailableTranslations;\n\n /**\n * The list of books for each translation.\n * This maps to the /api/:translationId/books.json endpoint.\n */\n translationBooks: ApiTranslationBooks[];\n\n /**\n * The list of chapters for each book.\n * This maps to the following endpoints:\n * - /api/:translationId/:bookId/:chapterNumber.json\n * - /api/:translationId/:bookCommonName/:chapterNumber.json\n */\n translationBookChapters: ApiTranslationBookChapter[];\n\n /**\n * The list of audio files.\n * This maps to the following endpoints:\n * - /api/:translationId/:bookId/:chapterNumber.:reader.mp3\n */\n translationBookChapterAudio: ApiTranslationBookChapterAudio[];\n\n /**\n * The list of available commentaries.\n * This maps to the /api/available-commentaries.json endpoint.\n */\n availableCommentaries: ApiAvailableCommentaries;\n\n /**\n * The list of books for each commentary.\n * This maps to the /api/c/:commentaryId/books.json endpoint.\n */\n commentaryBooks: ApiCommentaryBooks[];\n\n /**\n * The list of profiles for each commentary.\n * This maps to the /api/c/:commentaryId/profiles.json endpoint.\n */\n commentaryProfiles: ApiCommentaryProfiles[];\n\n /**\n * The list of chapters for each commentary book.\n * This maps to the following endpoint:\n * - /api/c/:commentaryId/:bookId/:chapterNumber.json\n */\n commentaryBookChapters: ApiCommentaryBookChapter[];\n\n /**\n * The list of individual profiles for each commentary.\n * This maps to the following endpoint:\n * - /api/c/:commentaryId/profiles/:profileId.json\n */\n commentaryProfileContents: ApiCommentaryProfileContent[];\n\n /**\n * The list of available datasets.\n * This maps to the /api/available-datasets.json endpoint.\n */\n availableDatasets?: ApiAvailableDatasets;\n\n /**\n * The list of books for each dataset.\n * This maps to the /api/d/:datasetId/books.json endpoint.\n */\n datasetBooks?: ApiDatasetBooks[];\n\n /**\n * The list of chapters for each dataset book.\n * This maps to the following endpoint:\n * - /api/d/:datasetId/:bookId/:chapterNumber.json\n */\n datasetBookChapters?: ApiDatasetBookChapter[];\n\n /**\n * The path prefix that the API should use.\n */\n pathPrefix: string;\n}\n\n/**\n * The list of available translations.\n * Maps to the /api/available-translations.json endpoint.\n */\nexport interface ApiAvailableTranslations {\n /**\n * The list of translations.\n */\n translations: ApiTranslation[];\n}\n\n/**\n * The list of available commentaries.\n * Maps to the /api/available-commentaries.json endpoint.\n */\nexport interface ApiAvailableCommentaries {\n /**\n * The list of commentaries.\n */\n commentaries: ApiCommentary[];\n}\n\n/**\n * The list of available datasets.\n * Maps to the /api/available-datasets.json endpoint.\n */\nexport interface ApiAvailableDatasets {\n datasets: ApiDataset[];\n}\n\n/**\n * Defines a dataset that is used in the API.\n */\nexport interface ApiDataset extends Dataset {\n /**\n * The API link for the list of books for this dataset.\n */\n listOfBooksApiLink: string;\n\n /**\n * The available list of formats.\n */\n availableFormats: 'json'[];\n\n /**\n * The number of books that are contained in this dataset.\n */\n numberOfBooks: number;\n\n /**\n * The total number of chapters that are contained in this dataset.\n */\n totalNumberOfChapters: number;\n\n /**\n * The total number of verses that are contained in this dataset.\n */\n totalNumberOfVerses: number;\n\n /**\n * The total number of references that are contained in this dataset.\n */\n totalNumberOfReferences: number;\n\n /**\n * Gets the name of the language that the commentary is in.\n * Null or undefined if the name of the language is not known.\n */\n languageName?: string;\n\n /**\n * Gets the name of the language in English.\n * Null or undefined if the language doesn't have an english name.\n */\n languageEnglishName?: string;\n}\n\n/**\n * Defines a translation that is used in the API.\n */\nexport interface ApiTranslation extends Translation {\n /**\n * The API link for the list of available books for this translation.\n */\n listOfBooksApiLink: string;\n\n /**\n * The available list of formats.\n */\n availableFormats: ('json' | 'usfm')[];\n\n /**\n * The number of books that are contained in this translation.\n *\n * Complete translations should have the same number of books as the Bible (66).\n */\n numberOfBooks: number;\n\n /**\n * The total number of chapters that are contained in this translation.\n *\n * Complete translations should have the same number of chapters as the Bible (1,189).\n */\n totalNumberOfChapters: number;\n\n /**\n * The total number of verses that are contained in this translation.\n *\n * Complete translations should have the same number of verses as the Bible (around 31,102 - some translations exclude verses based on the aparent likelyhood of existing in the original source texts).\n */\n totalNumberOfVerses: number;\n\n /**\n * The total number of apocryphal books that are contained in this translation.\n */\n numberOfApocryphalBooks?: number;\n\n /**\n * The total number of apocryphal chapters that are contained in this translation.\n */\n totalNumberOfApocryphalChapters?: number;\n\n /**\n * the total number of apocryphal verses that are contained in this translation.\n */\n totalNumberOfApocryphalVerses?: number;\n\n /**\n * Gets the name of the language that the translation is in.\n * Null or undefined if the name of the language is not known.\n */\n languageName?: string;\n\n /**\n * Gets the name of the language in English.\n * Null or undefined if the language doesn't have an english name.\n */\n languageEnglishName?: string;\n}\n\n/**\n * Defines a commentary that is used in the API.\n */\nexport interface ApiCommentary extends Commentary {\n /**\n * The API link for the list of available books for this translation.\n */\n listOfBooksApiLink: string;\n\n /**\n * The API link for the list of available profiles for this commentary.\n */\n listOfProfilesApiLink: string;\n\n /**\n * The available list of formats.\n */\n availableFormats: ('json' | 'usfm')[];\n\n /**\n * The number of books that are contained in this commentary.\n *\n * Complete commentaries should have the same number of books as the Bible (66).\n */\n numberOfBooks: number;\n\n /**\n * The total number of chapters that are contained in this translation.\n *\n * Complete commentaries should have the same number of chapters as the Bible (1,189).\n */\n totalNumberOfChapters: number;\n\n /**\n * The total number of verses that are contained in this commentary.\n *\n * 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).\n */\n totalNumberOfVerses: number;\n\n /**\n * The total number of profiles that are contained in this commentary.\n *\n * Profiles are used to provide additional information about people and people groups that are mentioned in the Bible.\n */\n totalNumberOfProfiles: number;\n\n /**\n * Gets the name of the language that the commentary is in.\n * Null or undefined if the name of the language is not known.\n */\n languageName?: string;\n\n /**\n * Gets the name of the language in English.\n * Null or undefined if the language doesn't have an english name.\n */\n languageEnglishName?: string;\n}\n\n/**\n * Defines an interface that contains information about the books that are available for a translation.\n */\nexport interface ApiTranslationBooks {\n /**\n * The translation information for the books.\n */\n translation: ApiTranslation;\n\n /**\n * The list of books that are available for the translation.\n */\n books: ApiTranslationBook[];\n}\n\n/**\n * Defines an interface that contains information about the books that are available for a commentary.\n */\nexport interface ApiCommentaryBooks {\n /**\n * The commentary information for the books.\n */\n commentary: ApiCommentary;\n\n /**\n * The list of books that are available for the commentary.\n */\n books: ApiCommentaryBook[];\n}\n\n/**\n * Defines an interface that contains information about the books that are available for a dataset.\n */\nexport interface ApiDatasetBooks {\n /**\n * The dataset information for the books.\n */\n dataset: ApiDataset;\n\n /**\n * The list of books that are available for the dataset.\n */\n books: ApiDatasetBook[];\n}\n\n/**\n * Defines an interface that contains information about the profiles that are available for a commentary.\n */\nexport interface ApiCommentaryProfiles {\n /**\n * The commentary information for the books.\n */\n commentary: ApiCommentary;\n\n /**\n * The list of profiles that are available for the commentary.\n */\n profiles: ApiCommentaryProfile[];\n}\n\n/**\n * Defines an interface that contains information about a profile.\n */\nexport interface ApiCommentaryProfile extends CommentaryProfile {\n /**\n * The link to this profile.\n */\n thisProfileLink: string;\n\n /**\n * The link to the chapter that this profile references in the commentary.\n */\n referenceChapterLink: string | null;\n}\n\n/**\n * Defines a translation book that is used in the API.\n */\nexport interface ApiTranslationBook extends TranslationBook {\n /**\n * The number of the first chapter in the book.\n */\n firstChapterNumber: number;\n\n /**\n * The link to the first chapter of the book.\n */\n firstChapterApiLink: string;\n\n /**\n * The number of the last chapter in the book.\n */\n lastChapterNumber: number;\n\n /**\n * The link to the last chapter of the book.\n */\n lastChapterApiLink: string;\n\n /**\n * The number of chapters that the book contains.\n */\n numberOfChapters: number;\n\n /**\n * The number of verses that the book contains.\n */\n totalNumberOfVerses: number;\n}\n\n/**\n * Defines a commentary book that is used in the API.\n */\nexport interface ApiCommentaryBook extends CommentaryBook {\n /**\n * The number of the first chapter in the book.\n *\n * Null if the comentary book has no chapters.\n */\n firstChapterNumber: number | null;\n\n /**\n * The link to the first chapter of the book.\n *\n * Null if the comentary book has no chapters.\n */\n firstChapterApiLink: string | null;\n\n /**\n * The number of the last chapter in the book.\n *\n * Null if the comentary book has no chapters.\n */\n lastChapterNumber: number | null;\n\n /**\n * The link to the last chapter of the book.\n *\n * Null if the comentary book has no chapters.\n */\n lastChapterApiLink: string | null;\n\n /**\n * The number of chapters that the book contains.\n */\n numberOfChapters: number;\n\n /**\n * The number of verses that the book contains.\n */\n totalNumberOfVerses: number;\n}\n\n/**\n * Defines an interface that contains information about a book in a dataset.\n */\nexport interface ApiDatasetBook extends DatasetBook {\n /**\n * The number of the first chapter in the book.\n */\n firstChapterNumber: number;\n\n /**\n * The link to the first chapter of the book.\n */\n firstChapterApiLink: string;\n\n /**\n * The number of the last chapter in the book.\n */\n lastChapterNumber: number;\n\n /**\n * The link to the last chapter of the book.\n */\n lastChapterApiLink: string;\n\n /**\n * The number of chapters that the book contains.\n */\n numberOfChapters: number;\n\n /**\n * The number of verses that the book contains.\n */\n totalNumberOfVerses: number;\n\n /**\n * The number of references that the book contains.\n */\n totalNumberOfReferences: number;\n}\n\n/**\n * Defines an interface that contains information about a book chapter.\n */\nexport interface ApiTranslationBookChapter extends TranslationBookChapter {\n /**\n * The translation information for the book chapter.\n */\n translation: ApiTranslation;\n\n /**\n * The book information for the book chapter.\n */\n book: ApiTranslationBook;\n\n /**\n * The link to this chapter.\n */\n thisChapterLink: string;\n\n /**\n * The link to the next chapter.\n * Null if this is the last chapter in the translation.\n */\n nextChapterApiLink: string | null;\n\n /**\n * The links to the audio versions for the next chapter.\n * Null if this is the last chapter in the translation.\n */\n nextChapterAudioLinks: TranslationBookChapterAudioLinks | null;\n\n /**\n * The link to the previous chapter.\n * Null if this is the first chapter in the translation.\n */\n previousChapterApiLink: string | null;\n\n /**\n * The links to the audio versions for the previous chapter.\n * Null if this is the first chapter in the translation.\n */\n previousChapterAudioLinks: TranslationBookChapterAudioLinks | null;\n\n /**\n * The number of verses that the chapter contains.\n */\n numberOfVerses: number;\n}\n\n/**\n * Defines an interface that contains information about a book chapter.\n */\nexport interface ApiCommentaryBookChapter extends CommentaryBookChapter {\n /**\n * The commentary information for the book chapter.\n */\n commentary: ApiCommentary;\n\n /**\n * The book information for the book chapter.\n */\n book: ApiCommentaryBook;\n\n /**\n * The link to this chapter.\n */\n thisChapterLink: string;\n\n /**\n * The link to the next chapter.\n * Null if this is the last chapter in the translation.\n */\n nextChapterApiLink: string | null;\n\n /**\n * The link to the previous chapter.\n * Null if this is the first chapter in the translation.\n */\n previousChapterApiLink: string | null;\n\n /**\n * The number of verses that the chapter contains.\n */\n numberOfVerses: number;\n}\n\n/**\n * Defines an interface that contains information about a book chapter.\n */\nexport interface ApiDatasetBookChapter extends DatasetBookChapter {\n /**\n * The dataset information for the book chapter.\n */\n dataset: ApiDataset;\n\n /**\n * The book information for the book chapter.\n */\n book: ApiDatasetBook;\n\n /**\n * The link to this chapter.\n */\n thisChapterLink: string;\n\n /**\n * The link to the next chapter.\n * Null if this is the last chapter in the translation.\n */\n nextChapterApiLink: string | null;\n\n /**\n * The link to the previous chapter.\n * Null if this is the first chapter in the translation.\n */\n previousChapterApiLink: string | null;\n\n /**\n * The number of verses that the chapter contains.\n */\n numberOfVerses: number;\n\n /**\n * The number of references that the chapter contains.\n */\n numberOfReferences: number;\n}\n\nexport interface ApiTranslationBookChapterAudio {\n /**\n * The chapter that the audio is for.\n */\n chapter: ApiTranslationBookChapter;\n\n /**\n * The link that the audio should be placed at.\n */\n link: string;\n\n /**\n * The original URL of the audio.\n */\n originalUrl: string;\n}\n\nexport interface ApiCommentaryProfileContent {\n /**\n * The commentary information for the profile.\n */\n commentary: ApiCommentary;\n\n /**\n * The information about the profile.\n */\n profile: ApiCommentaryProfile;\n\n /**\n * The content of the profile.\n */\n content: string[];\n}\n\n/**\n * The options for generating the API.\n */\nexport interface GenerateApiOptions {\n /**\n * Whether to use the common name for the book chapter API link. If false, then book IDs are used.\n * Audio URLs will always use the book ID.\n * Defaults to false.\n */\n useCommonName?: boolean;\n\n /**\n * Whether to replace the audio URLs in the dataset with ones that are hosted locally.\n * If true, then the audio URLs in the dataset will be replaced with ones that reference files hosted by the API itself.\n * If false, then the audio URLs in the dataset will be left as is.\n * Defaults to false.\n */\n generateAudioFiles?: boolean;\n\n /**\n * Gets the english name of the given language.\n * If not provided, then the english name for the language will be unknown and omitted.\n * @param language The language to get the english name for.\n */\n getEnglishName?: (language: string) => string | null | undefined;\n\n /**\n * Gets the native name of the given language.\n * If not provided, then the native name for the language will be unknown and omitted.\n * @param language The language to get the native name for.\n */\n getNativeName?: (language: string) => string | null | undefined;\n\n /**\n * The prefix that should be added to paths that are generated.\n */\n pathPrefix?: string;\n}\n\n/**\n * Generates the API output for the given dataset.\n * @param dataset The dataset to generate the API for.\n * @param options The options for generating the API.\n */\nexport function generateApiForDataset(\n dataset: DatasetOutput,\n options: GenerateApiOptions = {}\n): ApiOutput {\n const { useCommonName, pathPrefix } = options;\n const apiPathPrefix = pathPrefix ? pathPrefix : '';\n let api: ApiOutput = {\n availableTranslations: {\n translations: [],\n },\n translationBooks: [],\n translationBookChapters: [],\n translationBookChapterAudio: [],\n availableCommentaries: {\n commentaries: [],\n },\n commentaryBookChapters: [],\n commentaryBooks: [],\n commentaryProfiles: [],\n commentaryProfileContents: [],\n pathPrefix: apiPathPrefix,\n };\n\n const getNativeName = options.getNativeName;\n const getEnglishName = options.getEnglishName;\n\n for (let { books, ...translation } of dataset.translations) {\n let numberOfBooks = 0;\n let numberOfApocryphalBooks = 0;\n\n for (let book of books) {\n if (book.isApocryphal) {\n numberOfApocryphalBooks++;\n } else {\n numberOfBooks++;\n }\n }\n\n const apiTranslation: ApiTranslation = {\n ...translation,\n availableFormats: ['json'],\n listOfBooksApiLink: listOfBooksApiLink(\n translation.id,\n apiPathPrefix\n ),\n numberOfBooks,\n totalNumberOfChapters: 0,\n totalNumberOfVerses: 0,\n languageName: getNativeName\n ? (getNativeName(translation.language) ?? undefined)\n : undefined,\n languageEnglishName: getEnglishName\n ? (getEnglishName(translation.language) ?? undefined)\n : undefined,\n };\n\n if (numberOfApocryphalBooks > 0) {\n apiTranslation.numberOfApocryphalBooks = numberOfApocryphalBooks;\n }\n\n const translationBooks: ApiTranslationBooks = {\n translation: apiTranslation,\n books: [],\n };\n\n let translationChapters: ApiTranslationBookChapter[] = [];\n\n for (let { chapters, ...book } of books) {\n const firstChapterNumber = chapters[0].chapter.number;\n const lastChapterNumber =\n chapters[chapters.length - 1].chapter.number;\n const apiBook: ApiTranslationBook = {\n ...book,\n firstChapterNumber,\n firstChapterApiLink: bookChapterApiLink(\n translation.id,\n getBookLink(book),\n firstChapterNumber,\n 'json',\n apiPathPrefix\n ),\n lastChapterNumber,\n lastChapterApiLink: bookChapterApiLink(\n translation.id,\n getBookLink(book),\n lastChapterNumber,\n 'json',\n apiPathPrefix\n ),\n numberOfChapters: chapters.length,\n totalNumberOfVerses: 0,\n };\n\n for (let { chapter, thisChapterAudioLinks } of chapters) {\n const audio: TranslationBookChapterAudioLinks = {};\n const apiBookChapter: ApiTranslationBookChapter = {\n translation: apiTranslation,\n book: apiBook,\n chapter: chapter,\n thisChapterLink: bookChapterApiLink(\n translation.id,\n getBookLink(book),\n chapter.number,\n 'json',\n apiPathPrefix\n ),\n thisChapterAudioLinks: audio,\n nextChapterApiLink: null,\n nextChapterAudioLinks: null,\n previousChapterApiLink: null,\n previousChapterAudioLinks: null,\n numberOfVerses: 0,\n };\n\n for (let reader in thisChapterAudioLinks) {\n if (options.generateAudioFiles) {\n const apiAudio: ApiTranslationBookChapterAudio = {\n chapter: apiBookChapter,\n link: bookChapterAudioApiLink(\n translation.id,\n getBookLink(book),\n chapter.number,\n reader,\n apiPathPrefix\n ),\n originalUrl: thisChapterAudioLinks[reader],\n };\n audio[reader] = apiAudio.link;\n api.translationBookChapterAudio.push(apiAudio);\n } else {\n audio[reader] = thisChapterAudioLinks[reader];\n }\n }\n\n for (let c of chapter.content) {\n if (c.type === 'verse') {\n apiBookChapter.numberOfVerses++;\n }\n }\n\n apiBook.totalNumberOfVerses += apiBookChapter.numberOfVerses;\n\n translationChapters.push(apiBookChapter);\n api.translationBookChapters.push(apiBookChapter);\n }\n\n translationBooks.books.push(apiBook);\n\n if (apiBook.isApocryphal) {\n if (!apiTranslation.totalNumberOfApocryphalChapters) {\n apiTranslation.totalNumberOfApocryphalChapters = 0;\n }\n if (!apiTranslation.totalNumberOfApocryphalVerses) {\n apiTranslation.totalNumberOfApocryphalVerses = 0;\n }\n apiTranslation.totalNumberOfApocryphalChapters +=\n apiBook.numberOfChapters;\n apiTranslation.totalNumberOfApocryphalVerses +=\n apiBook.totalNumberOfVerses;\n } else {\n apiTranslation.totalNumberOfChapters +=\n apiBook.numberOfChapters;\n apiTranslation.totalNumberOfVerses +=\n apiBook.totalNumberOfVerses;\n }\n }\n\n for (let i = 0; i < translationChapters.length; i++) {\n if (i > 0) {\n translationChapters[i].previousChapterApiLink =\n bookChapterApiLink(\n translation.id,\n getBookLink(translationChapters[i - 1].book),\n translationChapters[i - 1].chapter.number,\n 'json',\n apiPathPrefix\n );\n translationChapters[i].previousChapterAudioLinks =\n translationChapters[i - 1].thisChapterAudioLinks;\n }\n\n if (i < translationChapters.length - 1) {\n translationChapters[i].nextChapterApiLink = bookChapterApiLink(\n translation.id,\n getBookLink(translationChapters[i + 1].book),\n translationChapters[i + 1].chapter.number,\n 'json',\n apiPathPrefix\n );\n translationChapters[i].nextChapterAudioLinks =\n translationChapters[i + 1].thisChapterAudioLinks;\n }\n }\n\n api.availableTranslations.translations.push(apiTranslation);\n api.translationBooks.push(translationBooks);\n }\n\n for (let { books, profiles, ...commentary } of dataset.commentaries) {\n const apiCommentary: ApiCommentary = {\n ...commentary,\n availableFormats: ['json'],\n listOfBooksApiLink: listOfCommentaryBooksApiLink(\n commentary.id,\n apiPathPrefix\n ),\n listOfProfilesApiLink: profilesCommentaryApiLink(\n commentary.id,\n 'json',\n apiPathPrefix\n ),\n numberOfBooks: books.length,\n totalNumberOfChapters: 0,\n totalNumberOfVerses: 0,\n totalNumberOfProfiles: 0,\n languageName: getNativeName\n ? (getNativeName(commentary.language) ?? undefined)\n : undefined,\n languageEnglishName: getEnglishName\n ? (getEnglishName(commentary.language) ?? undefined)\n : undefined,\n };\n\n const commentaryBooks: ApiCommentaryBooks = {\n commentary: apiCommentary,\n books: [],\n };\n\n const commentaryProfiles: ApiCommentaryProfiles = {\n commentary: apiCommentary,\n profiles: [],\n };\n\n let commentaryChapters: ApiCommentaryBookChapter[] = [];\n\n for (let { chapters, ...book } of books) {\n const firstChapterNumber = chapters[0]?.chapter.number ?? null;\n const lastChapterNumber =\n chapters[chapters.length - 1]?.chapter.number ?? null;\n const apiBook: ApiCommentaryBook = {\n ...book,\n firstChapterNumber,\n firstChapterApiLink: firstChapterNumber\n ? bookCommentaryChapterApiLink(\n commentary.id,\n getBookLink(book),\n firstChapterNumber,\n 'json',\n apiPathPrefix\n )\n : null,\n lastChapterNumber,\n lastChapterApiLink: lastChapterNumber\n ? bookCommentaryChapterApiLink(\n commentary.id,\n getBookLink(book),\n lastChapterNumber,\n 'json',\n apiPathPrefix\n )\n : null,\n numberOfChapters: chapters.length,\n totalNumberOfVerses: 0,\n };\n\n for (let { chapter } of chapters) {\n const apiBookChapter: ApiCommentaryBookChapter = {\n commentary: apiCommentary,\n book: apiBook,\n chapter: chapter,\n thisChapterLink: bookCommentaryChapterApiLink(\n commentary.id,\n getBookLink(book),\n chapter.number,\n 'json',\n apiPathPrefix\n ),\n nextChapterApiLink: null,\n previousChapterApiLink: null,\n numberOfVerses: 0,\n };\n\n for (let c of chapter.content) {\n if (c.type === 'verse') {\n apiBookChapter.numberOfVerses++;\n }\n }\n\n apiBook.totalNumberOfVerses += apiBookChapter.numberOfVerses;\n\n commentaryChapters.push(apiBookChapter);\n api.commentaryBookChapters.push(apiBookChapter);\n }\n\n commentaryBooks.books.push(apiBook);\n\n apiCommentary.totalNumberOfChapters += apiBook.numberOfChapters;\n apiCommentary.totalNumberOfVerses += apiBook.totalNumberOfVerses;\n }\n\n if (profiles) {\n for (let profile of profiles) {\n const apiProfile: ApiCommentaryProfile = {\n id: profile.id,\n reference: profile.reference,\n subject: profile.subject,\n thisProfileLink: profileCommentaryApiLink(\n commentary.id,\n profile.id,\n 'json',\n apiPathPrefix\n ),\n referenceChapterLink: profile.reference\n ? bookCommentaryChapterApiLink(\n commentary.id,\n profile.reference.book,\n profile.reference.chapter,\n 'json',\n apiPathPrefix\n )\n : null,\n };\n\n const apiProfileContent: ApiCommentaryProfileContent = {\n commentary: apiCommentary,\n profile: apiProfile,\n content: profile.content,\n };\n\n apiCommentary.totalNumberOfProfiles += 1;\n commentaryProfiles.profiles.push(apiProfile);\n api.commentaryProfileContents.push(apiProfileContent);\n }\n }\n\n for (let i = 0; i < commentaryChapters.length; i++) {\n if (i > 0) {\n commentaryChapters[i].previousChapterApiLink =\n bookCommentaryChapterApiLink(\n commentary.id,\n getBookLink(commentaryChapters[i - 1].book),\n commentaryChapters[i - 1].chapter.number,\n 'json',\n apiPathPrefix\n );\n // commentaryChapters[i].previousChapterAudioLinks =\n // commentaryChapters[i - 1].thisChapterAudioLinks;\n }\n\n if (i < commentaryChapters.length - 1) {\n commentaryChapters[i].nextChapterApiLink =\n bookCommentaryChapterApiLink(\n commentary.id,\n getBookLink(commentaryChapters[i + 1].book),\n commentaryChapters[i + 1].chapter.number,\n 'json',\n apiPathPrefix\n );\n // commentaryChapters[i].nextChapterAudioLinks =\n // commentaryChapters[i + 1].thisChapterAudioLinks;\n }\n }\n\n api.availableCommentaries.commentaries.push(apiCommentary);\n api.commentaryBooks.push(commentaryBooks);\n api.commentaryProfiles.push(commentaryProfiles);\n }\n\n for (let { books, ...datasetInfo } of dataset.datasets ?? []) {\n const apiDataset: ApiDataset = {\n ...datasetInfo,\n availableFormats: ['json'],\n listOfBooksApiLink: listOfDatasetBooksApiLink(\n datasetInfo.id,\n apiPathPrefix\n ),\n numberOfBooks: books.length,\n totalNumberOfChapters: 0,\n totalNumberOfVerses: 0,\n totalNumberOfReferences: 0,\n languageName: getNativeName\n ? (getNativeName(datasetInfo.language) ?? undefined)\n : undefined,\n languageEnglishName: getEnglishName\n ? (getEnglishName(datasetInfo.language) ?? undefined)\n : undefined,\n };\n\n const datasetBooks: ApiDatasetBooks = {\n dataset: apiDataset,\n books: [],\n };\n\n let datasetChapters: ApiDatasetBookChapter[] = [];\n\n for (let { chapters, ...book } of books) {\n const firstChapterNumber = chapters[0]?.chapter.number ?? null;\n const lastChapterNumber =\n chapters[chapters.length - 1]?.chapter.number ?? null;\n const apiBook: ApiDatasetBook = {\n ...book,\n firstChapterNumber,\n firstChapterApiLink: bookDatasetChapterApiLink(\n datasetInfo.id,\n book.id,\n firstChapterNumber,\n 'json',\n apiPathPrefix\n ),\n lastChapterNumber,\n lastChapterApiLink: bookDatasetChapterApiLink(\n datasetInfo.id,\n book.id,\n lastChapterNumber,\n 'json',\n apiPathPrefix\n ),\n numberOfChapters: chapters.length,\n totalNumberOfVerses: 0,\n totalNumberOfReferences: 0,\n };\n\n for (let { chapter } of chapters) {\n const apiBookChapter: ApiDatasetBookChapter = {\n dataset: apiDataset,\n book: apiBook,\n chapter: chapter,\n thisChapterLink: bookDatasetChapterApiLink(\n datasetInfo.id,\n book.id,\n chapter.number,\n 'json',\n apiPathPrefix\n ),\n nextChapterApiLink: null,\n previousChapterApiLink: null,\n numberOfVerses: chapter.content.length,\n numberOfReferences: 0,\n };\n\n // apiBookChapter.numberOfVerses += ;\n for (let verse of chapter.content) {\n apiBookChapter.numberOfReferences +=\n verse.references.length;\n }\n\n apiBook.totalNumberOfVerses += apiBookChapter.numberOfVerses;\n apiBook.totalNumberOfReferences +=\n apiBookChapter.numberOfReferences;\n\n datasetChapters.push(apiBookChapter);\n if (!api.datasetBookChapters) {\n api.datasetBookChapters = [];\n }\n api.datasetBookChapters.push(apiBookChapter);\n }\n\n datasetBooks.books.push(apiBook);\n\n apiDataset.totalNumberOfChapters += apiBook.numberOfChapters;\n apiDataset.totalNumberOfVerses += apiBook.totalNumberOfVerses;\n apiDataset.totalNumberOfReferences +=\n apiBook.totalNumberOfReferences;\n }\n\n for (let i = 0; i < datasetChapters.length; i++) {\n if (i > 0) {\n datasetChapters[i].previousChapterApiLink =\n bookDatasetChapterApiLink(\n datasetInfo.id,\n datasetChapters[i - 1].book.id,\n datasetChapters[i - 1].chapter.number,\n 'json',\n apiPathPrefix\n );\n }\n\n if (i < datasetChapters.length - 1) {\n datasetChapters[i].nextChapterApiLink =\n bookDatasetChapterApiLink(\n datasetInfo.id,\n datasetChapters[i + 1].book.id,\n datasetChapters[i + 1].chapter.number,\n 'json',\n apiPathPrefix\n );\n }\n }\n\n if (!api.availableDatasets) {\n api.availableDatasets = {\n datasets: [],\n };\n }\n api.availableDatasets.datasets.push(apiDataset);\n if (!api.datasetBooks) {\n api.datasetBooks = [];\n }\n api.datasetBooks.push(datasetBooks);\n }\n\n return api;\n\n function getBookLink(book: TranslationBook | CommentaryBook): string {\n return useCommonName ? book.commonName : book.id;\n }\n}\n\n/**\n * Generates the output files for the given API.\n * @param api The API that the files should be generated for.\n */\nexport function generateFilesForApi(api: ApiOutput): OutputFile[] {\n let files: OutputFile[] = [];\n\n files.push(\n jsonFile(\n `${api.pathPrefix}/api/available_translations.json`,\n api.availableTranslations,\n true\n )\n );\n for (let translationBooks of api.translationBooks) {\n files.push(\n jsonFile(\n translationBooks.translation.listOfBooksApiLink,\n translationBooks\n )\n );\n }\n\n for (let bookChapter of api.translationBookChapters) {\n files.push(jsonFile(bookChapter.thisChapterLink, bookChapter));\n }\n\n for (let audio of api.translationBookChapterAudio) {\n files.push(downloadedFile(audio.link, audio.originalUrl));\n }\n\n files.push(\n jsonFile(\n `${api.pathPrefix}/api/available_commentaries.json`,\n api.availableCommentaries,\n true\n )\n );\n for (let commentaryBooks of api.commentaryBooks) {\n files.push(\n jsonFile(\n commentaryBooks.commentary.listOfBooksApiLink,\n commentaryBooks\n )\n );\n }\n\n for (let commentaryProfiles of api.commentaryProfiles) {\n files.push(\n jsonFile(\n commentaryProfiles.commentary.listOfProfilesApiLink,\n commentaryProfiles\n )\n );\n }\n\n for (let profileContent of api.commentaryProfileContents) {\n files.push(\n jsonFile(profileContent.profile.thisProfileLink, profileContent)\n );\n }\n\n for (let bookChapter of api.commentaryBookChapters) {\n files.push(jsonFile(bookChapter.thisChapterLink, bookChapter));\n }\n\n if (api.availableDatasets) {\n files.push(\n jsonFile(\n `${api.pathPrefix}/api/available_datasets.json`,\n api.availableDatasets,\n true\n )\n );\n }\n\n if (api.datasetBooks) {\n for (let datasetBook of api.datasetBooks) {\n files.push(\n jsonFile(datasetBook.dataset.listOfBooksApiLink, datasetBook)\n );\n }\n }\n\n if (api.datasetBookChapters) {\n for (let datasetBookChapter of api.datasetBookChapters) {\n files.push(\n jsonFile(datasetBookChapter.thisChapterLink, datasetBookChapter)\n );\n }\n }\n\n // for (let audio of api.translationBookChapterAudio) {\n // files.push(downloadedFile(audio.link, audio.originalUrl));\n // }\n\n return files;\n}\n\n/**\n * Generates the output files for the given datasets.\n * @param datasets The datasets to generate the output files for.\n * @param options The options for generating the API files.\n */\nexport async function* generateOutputFilesFromDatasets(\n datasets: AsyncIterable<DatasetOutput>,\n options?: GenerateApiOptions\n): AsyncGenerator<OutputFile[]> {\n for await (let dataset of datasets) {\n const api = generateApiForDataset(dataset, options);\n const files = generateFilesForApi(api);\n\n yield files;\n }\n}\n\n/**\n * Gets the API Link for the list of books endpoint for a translation.\n * @param translationId The ID of the translation.\n * @returns\n */\nexport function listOfBooksApiLink(\n translationId: string,\n prefix: string = ''\n): string {\n return `${prefix}/api/${translationId}/books.json`;\n}\n\n/**\n * Gets the API Link for the list of books endpoint for a commentary.\n * @param commentaryId The ID of the commentary.\n * @returns\n */\nexport function listOfCommentaryBooksApiLink(\n commentaryId: string,\n prefix: string = ''\n): string {\n return `${prefix}/api/c/${commentaryId}/books.json`;\n}\n\n/**\n * Gets the API Link for the list of books endpoint for a dataset.\n * @param datasetId The ID of the dataset.\n * @returns\n */\nexport function listOfDatasetBooksApiLink(\n datasetId: string,\n prefix: string = ''\n): string {\n return `${prefix}/api/d/${datasetId}/books.json`;\n}\n\n/**\n * Getes the API link for a book chapter.\n * @param translationId The ID of the translation.\n * @param commonName The name of the book.\n * @param chapterNumber The number of the book.\n * @param extension The extension of the file.\n */\nexport function bookChapterApiLink(\n translationId: string,\n commonName: string,\n chapterNumber: number,\n extension: string,\n prefix: string = ''\n) {\n return `${prefix}/api/${translationId}/${replaceSpacesWithUnderscores(\n commonName\n )}/${chapterNumber}.${extension}`;\n}\n\n/**\n * Getes the API link for a book chapter.\n * @param translationId The ID of the translation.\n * @param commonName The name of the book.\n * @param chapterNumber The number of the book.\n * @param extension The extension of the file.\n */\nexport function bookCommentaryChapterApiLink(\n translationId: string,\n commonName: string,\n chapterNumber: number,\n extension: string,\n prefix: string = ''\n) {\n return `${prefix}/api/c/${translationId}/${replaceSpacesWithUnderscores(\n commonName\n )}/${chapterNumber}.${extension}`;\n}\n\nexport function bookChapterAudioApiLink(\n translationId: string,\n bookId: string,\n chapterNumber: number,\n reader: string,\n prefix: string = ''\n) {\n return `${prefix}/api/${translationId}/${replaceSpacesWithUnderscores(\n bookId\n )}/${chapterNumber}.${reader}.mp3`;\n}\n\n/**\n * Getes the API link for a book chapter.\n * @param translationId The ID of the translation.\n * @param commonName The name of the book.\n * @param chapterNumber The number of the book.\n * @param extension The extension of the file.\n */\nexport function bookDatasetChapterApiLink(\n translationId: string,\n commonName: string,\n chapterNumber: number,\n extension: string,\n prefix: string = ''\n) {\n return `${prefix}/api/d/${translationId}/${replaceSpacesWithUnderscores(\n commonName\n )}/${chapterNumber}.${extension}`;\n}\n\n/**\n * Gets the API link for a profile.\n * @param translationId The ID of the translation.\n * @param profileId The ID of the profile.\n * @param extension The extension of the file.\n */\nexport function profilesCommentaryApiLink(\n translationId: string,\n extension: string,\n prefix: string = ''\n) {\n return `${prefix}/api/c/${translationId}/profiles.${extension}`;\n}\n\n/**\n * Gets the API link for a profile.\n * @param translationId The ID of the translation.\n * @param profileId The ID of the profile.\n * @param extension The extension of the file.\n */\nexport function profileCommentaryApiLink(\n translationId: string,\n profileId: string,\n extension: string,\n prefix: string = ''\n) {\n return `${prefix}/api/c/${translationId}/profiles/${replaceSpacesWithUnderscores(\n profileId\n )}.${extension}`;\n}\n\nexport function jsonFile(\n path: string,\n content: any,\n mergable?: boolean\n): OutputFile {\n return {\n path,\n content,\n mergable,\n };\n}\n\nexport function downloadedFile(path: string, url: string): OutputFile {\n return {\n path,\n content: () => fetch(url).then((response) => response.body),\n };\n}\n\nexport function replaceSpacesWithUnderscores(str: string): string {\n return str.replace(/[<>:\"/\\\\|?*\\s]/g, '_');\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA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,EAC9D;AACJ;AAEO,SAAS,6BAA6B,KAAqB;AAC9D,SAAO,IAAI,QAAQ,mBAAmB,GAAG;AAC7C;",
6
6
  "names": []
7
7
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../generation/common-types.ts"],
4
- "sourcesContent": ["import { VerseRef } from '../utils.js';\n\n/**\n * Defines an interface that contains information about a input file.\n */\nexport type InputFile = InputTranslationFile | InputCommentaryFile;\n\nexport interface InputFileBase {\n name?: string;\n content: string;\n sha256?: string;\n}\n\nexport type InputFileMetadata =\n | InputTranslationMetadata\n | InputCommentaryMetadata;\n\nexport interface InputTranslationFile extends InputFileBase {\n fileType: 'usfm' | 'usx' | 'json';\n metadata: InputTranslationMetadata;\n}\n\nexport interface InputCommentaryFile extends InputFileBase {\n fileType: 'commentary/csv' | 'commentary/tyndale-xml';\n metadata: InputCommentaryMetadata;\n}\n\nexport type OutputFileContent = object | ReadableStream;\n\n/**\n * Defines an interface that contains information about a output file.\n */\nexport interface OutputFile {\n /**\n * The path that the file should be stored at.\n */\n path: string;\n\n /**\n * The content of the file.\n */\n content: OutputFileContent | (() => Promise<OutputFileContent>);\n\n /**\n * Whether the file can be merged with files of the same name but from other datasets.\n */\n mergable?: boolean;\n}\n\nexport interface MetadataBase {\n /**\n * The name of the translation.\n */\n name: string;\n\n /**\n * The english name of the translation.\n */\n englishName: string;\n\n /**\n * The website for the translation.\n */\n website: string;\n\n /**\n * The URL that the license for the translation can be found.\n */\n licenseUrl: string;\n\n /**\n * The ISO 639 letter language tag that the translation is primarily in.\n */\n language: string;\n\n /**\n * The direction that the text is written in.\n */\n direction: 'ltr' | 'rtl';\n}\n\n/**\n * The metadata for a translation that is input into the generator.\n */\nexport interface InputTranslationMetadata extends MetadataBase {\n /**\n * The ID of the translation.\n */\n id: string;\n\n /**\n * The short name for the translation.\n */\n shortName: string;\n}\n\n/**\n * The metadata for a translation that is input into the generator.\n */\nexport interface InputCommentaryMetadata extends MetadataBase {\n /**\n * The ID of the commentary.\n */\n id: string;\n}\n\n/**\n * Defines an interface that contains information about a translation.\n */\nexport interface Translation {\n /**\n * The ID of the translation.\n */\n id: string;\n\n /**\n * The name of the translation.\n */\n name: string;\n\n /**\n * The website for the translation.\n */\n website: string;\n\n /**\n * The URL that the license for the translation can be found.\n */\n licenseUrl: string;\n\n /**\n * The API-added notes for the license.\n */\n licenseNotes?: string | null;\n\n /**\n * The short name for the translation.\n */\n shortName?: string;\n\n /**\n * The English name for the translation.\n */\n englishName: string;\n\n /**\n * The ISO 639 3-letter language tag that the translation is primarily in.\n */\n language: string;\n\n /**\n * The direction that the language is written in.\n * \"ltr\" indicates that the text is written from the left side of the page to the right.\n * \"rtl\" indicates that the text is written from the right side of the page to the left.\n */\n textDirection: 'ltr' | 'rtl';\n}\n\n/**\n * Defines an interface that contains information about a commentary.\n */\nexport interface Commentary {\n /**\n * The ID of the commentary.\n */\n id: string;\n\n /**\n * The name of the commentary.\n */\n name: string;\n\n /**\n * The website for the commentary.\n */\n website: string;\n\n /**\n * The URL that the license for the commentary can be found.\n */\n licenseUrl: string;\n\n /**\n * The API-added notes for the license.\n */\n licenseNotes?: string | null;\n\n /**\n * The english name for the commentary.\n */\n englishName: string;\n\n /**\n * The ISO 639 3-letter language tag that the translation is primarily in.\n */\n language: string;\n\n /**\n * The direction that the language is written in.\n * \"ltr\" indicates that the text is written from the left side of the page to the right.\n * \"rtl\" indicates that the text is written from the right side of the page to the left.\n */\n textDirection: 'ltr' | 'rtl';\n}\n\n/**\n * Defines an interface that contains information about a book.\n */\nexport interface TranslationBook {\n /**\n * The ID of the book. Should match the USFM book ID.\n */\n id: string;\n\n /**\n * The name that the translation provided for the book.\n */\n name: string;\n\n /**\n * The common name for the book.\n */\n commonName: string;\n\n /**\n * The title of the book.\n * This is usually a more descriptive version of the book name.\n * If not available, then one was not provided by the translation.\n */\n title: string | null;\n\n /**\n * The numerical order of the book in the translation.\n */\n order: number;\n\n /**\n * Whether the book is an apocryphal book.\n */\n isApocryphal?: boolean;\n}\n\n/**\n * Defines an interface that contains information about a book in a commentary.\n */\nexport interface CommentaryBook {\n /**\n * The ID of the book. Should match the USFM book ID.\n */\n id: string;\n\n /**\n * The name that the commentary provided for the book.\n */\n name: string;\n\n /**\n * The common name for the book.\n */\n commonName: string;\n\n /**\n * The commentary's introduction for the book.\n */\n introduction?: string;\n\n /**\n * The summary of the commentary's introduction for the book.\n */\n introductionSummary?: string;\n\n /**\n * The order of the book in the Bible.\n */\n order: number;\n}\n\n/**\n * Defines an interface that contains information about a profile in a commentary.\n */\nexport interface CommentaryProfile {\n /**\n * The ID of the profile.\n */\n id: string;\n\n /**\n * The subject of the profile.\n */\n subject: string;\n\n /**\n * The Bible reference that the profile is associated with.\n */\n reference: VerseRef | null;\n}\n\n/**\n * Defines an interface that contains information about a book chapter.\n */\nexport interface TranslationBookChapter {\n /**\n * The information for the chapter.\n */\n chapter: ChapterData;\n\n /**\n * The links to different audio versions for the chapter.\n */\n thisChapterAudioLinks: TranslationBookChapterAudioLinks;\n}\n\n/**\n * Defines an interface that contains information about a book chapter in a commentary.\n */\nexport interface CommentaryBookChapter {\n /**\n * The information for the chapter.\n */\n chapter: CommentaryChapterData;\n}\n\n/**\n * Defines an interface that contains the audio links for a book chapter.\n */\nexport interface TranslationBookChapterAudioLinks {\n /**\n * The reader for the chapter and the URL link to the audio file.\n */\n [reader: string]: string;\n}\n\n/**\n * Defines an interface that represents data in a chapter.\n */\nexport interface ChapterData {\n /**\n * The number of the chapter.\n */\n number: number;\n\n /**\n * The content of the chapter.\n */\n content: ChapterContent[];\n\n /**\n * The list of footnotes for the chapter.\n */\n footnotes: ChapterFootnote[];\n}\n\n/**\n * Defines an interface that represents data in a chapter in a commentary.\n */\nexport interface CommentaryChapterData {\n /**\n * The number of the chapter.\n */\n number: number;\n\n /**\n * The introduction that the commentary provided to the chapter.\n * Not all commentaries provide an introduction to a chapter.\n */\n introduction?: string;\n\n /**\n * The content of the chapter.\n */\n content: ChapterVerse[];\n}\n\n/**\n * A union type that represents a single piece of chapter content.\n * A piece of chapter content can be one of the following things:\n * - A heading.\n * - A line break.\n * - A verse.\n * - A Hebrew Subtitle.\n */\nexport type ChapterContent =\n | ChapterHeading\n | ChapterLineBreak\n | ChapterVerse\n | ChapterHebrewSubtitle;\n\n/**\n * A heading in a chapter.\n */\nexport interface ChapterHeading {\n /**\n * Indicates that the content represents a heading.\n */\n type: 'heading';\n\n /**\n * The content for the heading.\n * If multiple strings are included in the array, they should be concatenated with a space.\n */\n content: string[];\n}\n\n/**\n * A line break in a chapter.\n */\nexport interface ChapterLineBreak {\n /**\n * Indicates that the content represents a line break.\n */\n type: 'line_break';\n}\n\n/**\n * A Hebrew Subtitle in a chapter.\n * These are often used included as informational content that appeared in the original manuscripts.\n * For example, Psalms 49 has the Hebrew Subtitle \"To the choirmaster. A Psalm of the Sons of Korah.\"\n */\nexport interface ChapterHebrewSubtitle {\n /**\n * Indicates that the content represents a Hebrew Subtitle.\n */\n type: 'hebrew_subtitle';\n\n /**\n * The list of content that is contained in the subtitle.\n * Each element in the list could be a string, formatted text, or a footnote reference.\n */\n content: (string | FormattedText | VerseFootnoteReference)[];\n}\n\n/**\n * A verse in a chapter.\n */\nexport interface ChapterVerse {\n /**\n * Indicates that the content is a verse.\n */\n type: 'verse';\n\n /**\n * The number of the verse.\n */\n number: number;\n\n /**\n * The list of content for the verse.\n * Each element in the list could be a string, formatted text, or a footnote reference.\n */\n content: (\n | string\n | FormattedText\n | InlineHeading\n | InlineLineBreak\n | VerseFootnoteReference\n )[];\n}\n\n/**\n * Formatted text. That is, text that is formated in a particular manner.\n */\nexport interface FormattedText {\n /**\n * The text that is formatted.\n */\n text: string;\n\n /**\n * Whether the text represents a poem.\n * The number indicates the level of indent.\n *\n * Common in Psalms.\n */\n poem?: number;\n\n /**\n * Whether the text represents the Words of Jesus.\n */\n wordsOfJesus?: boolean;\n}\n\n/**\n * Defines an interface that represents a heading that is embedded in a verse.\n */\nexport interface InlineHeading {\n /**\n * The text of the heading.\n */\n heading: string;\n}\n\n/**\n * Defines an interface that represents a line break that is embedded in a verse.\n */\nexport interface InlineLineBreak {\n lineBreak: true;\n}\n\n/**\n * A footnote reference in a verse or a Hebrew Subtitle.\n */\nexport interface VerseFootnoteReference {\n /**\n * The ID of the note.\n */\n noteId: number;\n}\n\n/**\n * Information about a footnote.\n */\nexport interface ChapterFootnote {\n /**\n * The ID of the note that is referenced.\n */\n noteId: number;\n\n /**\n * The text of the footnote.\n */\n text: string;\n\n /**\n * The verse reference for the footnote.\n */\n reference?: {\n chapter: number;\n verse: number;\n };\n\n /**\n * The caller that should be used for the footnote.\n * For footnotes, a \"caller\" is the character that is used in the text to reference to footnote.\n *\n * For example, in the text:\n * Hello (a) World\n *\n * ----\n * (a) This is a footnote.\n *\n * The \"(a)\" is the caller.\n *\n * If \"+\", then the caller should be autogenerated.\n * If null, then the caller should be empty.\n * If a string, then the caller should be that string.\n */\n caller: '+' | string | null;\n}\n"],
4
+ "sourcesContent": ["import { VerseRef } from '../utils.js';\n\n/**\n * Defines an interface that contains information about a input file.\n */\nexport type InputFile = InputTranslationFile | InputCommentaryFile;\n\nexport interface InputFileBase {\n name?: string;\n content: string;\n sha256?: string;\n}\n\nexport type InputFileMetadata =\n | InputTranslationMetadata\n | InputCommentaryMetadata;\n\nexport interface InputTranslationFile extends InputFileBase {\n fileType: 'usfm' | 'usx' | 'json';\n metadata: InputTranslationMetadata;\n}\n\nexport interface InputCommentaryFile extends InputFileBase {\n fileType: 'commentary/csv' | 'commentary/tyndale-xml';\n metadata: InputCommentaryMetadata;\n}\n\nexport type OutputFileContent = object | ReadableStream;\n\n/**\n * Defines an interface that contains information about a output file.\n */\nexport interface OutputFile {\n /**\n * The path that the file should be stored at.\n */\n path: string;\n\n /**\n * The content of the file.\n */\n content: OutputFileContent | (() => Promise<OutputFileContent>);\n\n /**\n * Whether the file can be merged with files of the same name but from other datasets.\n */\n mergable?: boolean;\n}\n\nexport interface MetadataBase {\n /**\n * The name of the translation.\n */\n name: string;\n\n /**\n * The english name of the translation.\n */\n englishName: string;\n\n /**\n * The website for the translation.\n */\n website: string;\n\n /**\n * The URL that the license for the translation can be found.\n */\n licenseUrl: string;\n\n /**\n * The ISO 639 letter language tag that the translation is primarily in.\n */\n language: string;\n\n /**\n * The direction that the text is written in.\n */\n direction: 'ltr' | 'rtl';\n}\n\n/**\n * The metadata for a translation that is input into the generator.\n */\nexport interface InputTranslationMetadata extends MetadataBase {\n /**\n * The ID of the translation.\n */\n id: string;\n\n /**\n * The short name for the translation.\n */\n shortName: string;\n}\n\n/**\n * The metadata for a translation that is input into the generator.\n */\nexport interface InputCommentaryMetadata extends MetadataBase {\n /**\n * The ID of the commentary.\n */\n id: string;\n}\n\n/**\n * Defines an interface that contains information about a translation.\n */\nexport interface Translation {\n /**\n * The ID of the translation.\n */\n id: string;\n\n /**\n * The name of the translation.\n */\n name: string;\n\n /**\n * The website for the translation.\n */\n website: string;\n\n /**\n * The URL that the license for the translation can be found.\n */\n licenseUrl: string;\n\n /**\n * The API-added notes for the license.\n */\n licenseNotes?: string | null;\n\n /**\n * The short name for the translation.\n */\n shortName?: string;\n\n /**\n * The English name for the translation.\n */\n englishName: string;\n\n /**\n * The ISO 639 3-letter language tag that the translation is primarily in.\n */\n language: string;\n\n /**\n * The direction that the language is written in.\n * \"ltr\" indicates that the text is written from the left side of the page to the right.\n * \"rtl\" indicates that the text is written from the right side of the page to the left.\n */\n textDirection: 'ltr' | 'rtl';\n}\n\n/**\n * Defines an interface that contains information about a commentary.\n */\nexport interface Commentary {\n /**\n * The ID of the commentary.\n */\n id: string;\n\n /**\n * The name of the commentary.\n */\n name: string;\n\n /**\n * The website for the commentary.\n */\n website: string;\n\n /**\n * The URL that the license for the commentary can be found.\n */\n licenseUrl: string;\n\n /**\n * The API-added notes for the license.\n */\n licenseNotes?: string | null;\n\n /**\n * The english name for the commentary.\n */\n englishName: string;\n\n /**\n * The ISO 639 3-letter language tag that the translation is primarily in.\n */\n language: string;\n\n /**\n * The direction that the language is written in.\n * \"ltr\" indicates that the text is written from the left side of the page to the right.\n * \"rtl\" indicates that the text is written from the right side of the page to the left.\n */\n textDirection: 'ltr' | 'rtl';\n}\n\nexport interface Dataset {\n /**\n * The ID of the dataset.\n */\n id: string;\n\n /**\n * The name of the dataset.\n */\n name: string;\n\n /**\n * The website for the dataset.\n */\n website: string;\n\n /**\n * The URL that the license for the dataset can be found.\n */\n licenseUrl: string;\n\n /**\n * The API-added notes for the license.\n */\n licenseNotes?: string | null;\n\n /**\n * The English name for the dataset.\n */\n englishName: string;\n\n /**\n * The ISO 639 3-letter language tag that the dataset is primarily in.\n */\n language: string;\n\n /**\n * The direction that the language is written in.\n */\n textDirection: 'ltr' | 'rtl';\n}\n\n/**\n * Defines an interface that contains information about a book.\n */\nexport interface TranslationBook {\n /**\n * The ID of the book. Should match the USFM book ID.\n */\n id: string;\n\n /**\n * The name that the translation provided for the book.\n */\n name: string;\n\n /**\n * The common name for the book.\n */\n commonName: string;\n\n /**\n * The title of the book.\n * This is usually a more descriptive version of the book name.\n * If not available, then one was not provided by the translation.\n */\n title: string | null;\n\n /**\n * The numerical order of the book in the translation.\n */\n order: number;\n\n /**\n * Whether the book is an apocryphal book.\n */\n isApocryphal?: boolean;\n}\n\n/**\n * Defines an interface that contains information about a book in a commentary.\n */\nexport interface CommentaryBook {\n /**\n * The ID of the book. Should match the USFM book ID.\n */\n id: string;\n\n /**\n * The name that the commentary provided for the book.\n */\n name: string;\n\n /**\n * The common name for the book.\n */\n commonName: string;\n\n /**\n * The commentary's introduction for the book.\n */\n introduction?: string;\n\n /**\n * The summary of the commentary's introduction for the book.\n */\n introductionSummary?: string;\n\n /**\n * The order of the book in the Bible.\n */\n order: number;\n}\n\n/**\n * Defines an interface that contains information about a dataset book.\n */\nexport interface DatasetBook {\n /**\n * The ID of the book. Should match the USFM book ID.\n */\n id: string;\n\n /**\n * The order of the book in the Bible.\n */\n order: number;\n}\n\n/**\n * Defines an interface that contains information about a chapter in a dataset.\n */\nexport interface DatasetBookChapter {\n /**\n * The data for the chapter.\n */\n chapter: DatasetChapterData;\n}\n\nexport interface DatasetChapterData {\n /**\n * The number of the chapter.\n */\n number: number;\n\n /**\n * The content of the chapter.\n */\n content: DatasetChapterVerseContent[];\n}\n\n/**\n * Defines an interface that contains information about a verse in a dataset chapter.\n */\nexport interface DatasetChapterVerseContent {\n /**\n * The number of the verse.\n */\n verse: number;\n\n /**\n * The list of references for the verse.\n */\n references: ScoredVerseRef[];\n}\n\n/**\n * Defines an interface that contains information about a verse reference that has an arbitrary score attached to it.\n */\nexport interface ScoredVerseRef extends VerseRef {\n /**\n * The score of the verse reference.\n */\n score: number;\n}\n\n/**\n * Defines an interface that contains information about a profile in a commentary.\n */\nexport interface CommentaryProfile {\n /**\n * The ID of the profile.\n */\n id: string;\n\n /**\n * The subject of the profile.\n */\n subject: string;\n\n /**\n * The Bible reference that the profile is associated with.\n */\n reference: VerseRef | null;\n}\n\n/**\n * Defines an interface that contains information about a book chapter.\n */\nexport interface TranslationBookChapter {\n /**\n * The information for the chapter.\n */\n chapter: ChapterData;\n\n /**\n * The links to different audio versions for the chapter.\n */\n thisChapterAudioLinks: TranslationBookChapterAudioLinks;\n}\n\n/**\n * Defines an interface that contains information about a book chapter in a commentary.\n */\nexport interface CommentaryBookChapter {\n /**\n * The information for the chapter.\n */\n chapter: CommentaryChapterData;\n}\n\n/**\n * Defines an interface that contains the audio links for a book chapter.\n */\nexport interface TranslationBookChapterAudioLinks {\n /**\n * The reader for the chapter and the URL link to the audio file.\n */\n [reader: string]: string;\n}\n\n/**\n * Defines an interface that represents data in a chapter.\n */\nexport interface ChapterData {\n /**\n * The number of the chapter.\n */\n number: number;\n\n /**\n * The content of the chapter.\n */\n content: ChapterContent[];\n\n /**\n * The list of footnotes for the chapter.\n */\n footnotes: ChapterFootnote[];\n}\n\n/**\n * Defines an interface that represents data in a chapter in a commentary.\n */\nexport interface CommentaryChapterData {\n /**\n * The number of the chapter.\n */\n number: number;\n\n /**\n * The introduction that the commentary provided to the chapter.\n * Not all commentaries provide an introduction to a chapter.\n */\n introduction?: string;\n\n /**\n * The content of the chapter.\n */\n content: ChapterVerse[];\n}\n\n/**\n * A union type that represents a single piece of chapter content.\n * A piece of chapter content can be one of the following things:\n * - A heading.\n * - A line break.\n * - A verse.\n * - A Hebrew Subtitle.\n */\nexport type ChapterContent =\n | ChapterHeading\n | ChapterLineBreak\n | ChapterVerse\n | ChapterHebrewSubtitle;\n\n/**\n * A heading in a chapter.\n */\nexport interface ChapterHeading {\n /**\n * Indicates that the content represents a heading.\n */\n type: 'heading';\n\n /**\n * The content for the heading.\n * If multiple strings are included in the array, they should be concatenated with a space.\n */\n content: string[];\n}\n\n/**\n * A line break in a chapter.\n */\nexport interface ChapterLineBreak {\n /**\n * Indicates that the content represents a line break.\n */\n type: 'line_break';\n}\n\n/**\n * A Hebrew Subtitle in a chapter.\n * These are often used included as informational content that appeared in the original manuscripts.\n * For example, Psalms 49 has the Hebrew Subtitle \"To the choirmaster. A Psalm of the Sons of Korah.\"\n */\nexport interface ChapterHebrewSubtitle {\n /**\n * Indicates that the content represents a Hebrew Subtitle.\n */\n type: 'hebrew_subtitle';\n\n /**\n * The list of content that is contained in the subtitle.\n * Each element in the list could be a string, formatted text, or a footnote reference.\n */\n content: (string | FormattedText | VerseFootnoteReference)[];\n}\n\n/**\n * A verse in a chapter.\n */\nexport interface ChapterVerse {\n /**\n * Indicates that the content is a verse.\n */\n type: 'verse';\n\n /**\n * The number of the verse.\n */\n number: number;\n\n /**\n * The list of content for the verse.\n * Each element in the list could be a string, formatted text, or a footnote reference.\n */\n content: (\n | string\n | FormattedText\n | InlineHeading\n | InlineLineBreak\n | VerseFootnoteReference\n )[];\n}\n\n/**\n * Formatted text. That is, text that is formated in a particular manner.\n */\nexport interface FormattedText {\n /**\n * The text that is formatted.\n */\n text: string;\n\n /**\n * Whether the text represents a poem.\n * The number indicates the level of indent.\n *\n * Common in Psalms.\n */\n poem?: number;\n\n /**\n * Whether the text represents the Words of Jesus.\n */\n wordsOfJesus?: boolean;\n}\n\n/**\n * Defines an interface that represents a heading that is embedded in a verse.\n */\nexport interface InlineHeading {\n /**\n * The text of the heading.\n */\n heading: string;\n}\n\n/**\n * Defines an interface that represents a line break that is embedded in a verse.\n */\nexport interface InlineLineBreak {\n lineBreak: true;\n}\n\n/**\n * A footnote reference in a verse or a Hebrew Subtitle.\n */\nexport interface VerseFootnoteReference {\n /**\n * The ID of the note.\n */\n noteId: number;\n}\n\n/**\n * Information about a footnote.\n */\nexport interface ChapterFootnote {\n /**\n * The ID of the note that is referenced.\n */\n noteId: number;\n\n /**\n * The text of the footnote.\n */\n text: string;\n\n /**\n * The verse reference for the footnote.\n */\n reference?: {\n chapter: number;\n verse: number;\n };\n\n /**\n * The caller that should be used for the footnote.\n * For footnotes, a \"caller\" is the character that is used in the text to reference to footnote.\n *\n * For example, in the text:\n * Hello (a) World\n *\n * ----\n * (a) This is a footnote.\n *\n * The \"(a)\" is the caller.\n *\n * If \"+\", then the caller should be autogenerated.\n * If null, then the caller should be empty.\n * If a string, then the caller should be that string.\n */\n caller: '+' | string | null;\n}\n"],
5
5
  "mappings": ";;;;;;;;;;;;;;AAAA;AAAA;",
6
6
  "names": []
7
7
  }