@helloao/tools 0.1.0 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/generation/api.cjs +727 -2
- package/dist/cjs/generation/api.cjs.map +2 -2
- package/dist/cjs/generation/audio.cjs +52 -5
- package/dist/cjs/generation/audio.cjs.map +2 -2
- package/dist/cjs/generation/book-order.cjs +1 -1
- package/dist/cjs/generation/book-order.cjs.map +2 -2
- package/dist/cjs/generation/common-types.cjs +651 -0
- package/dist/cjs/generation/common-types.cjs.map +2 -2
- package/dist/cjs/generation/dataset.cjs +31 -8
- package/dist/cjs/generation/dataset.cjs.map +2 -2
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/cjs/log.cjs.map +1 -1
- package/dist/cjs/parser/codex-parser.cjs.map +1 -1
- package/dist/cjs/parser/commentary-csv-parser.cjs.map +1 -1
- package/dist/cjs/parser/iterators.cjs.map +1 -1
- package/dist/cjs/parser/lockman-parser.cjs +334 -0
- package/dist/cjs/parser/lockman-parser.cjs.map +7 -0
- package/dist/cjs/parser/tyndale-xml-parser.cjs.map +1 -1
- package/dist/cjs/parser/types.cjs.map +1 -1
- package/dist/cjs/parser/usfm-parser.cjs.map +1 -1
- package/dist/cjs/parser/usx-parser.cjs +24 -7
- package/dist/cjs/parser/usx-parser.cjs.map +2 -2
- package/dist/cjs/utils.cjs +152 -0
- package/dist/cjs/utils.cjs.map +3 -3
- package/dist/esm/generation/api.js +696 -2
- package/dist/esm/generation/api.js.map +2 -2
- package/dist/esm/generation/audio.js +46 -3
- package/dist/esm/generation/audio.js.map +2 -2
- package/dist/esm/generation/book-order.js +1 -1
- package/dist/esm/generation/book-order.js.map +2 -2
- package/dist/esm/generation/common-types.js +590 -0
- package/dist/esm/generation/common-types.js.map +3 -3
- package/dist/esm/generation/dataset.js +29 -8
- package/dist/esm/generation/dataset.js.map +2 -2
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/log.js.map +1 -1
- package/dist/esm/parser/codex-parser.js.map +1 -1
- package/dist/esm/parser/commentary-csv-parser.js.map +1 -1
- package/dist/esm/parser/iterators.js.map +1 -1
- package/dist/esm/parser/lockman-parser.js +306 -0
- package/dist/esm/parser/lockman-parser.js.map +7 -0
- package/dist/esm/parser/tyndale-xml-parser.js.map +1 -1
- package/dist/esm/parser/usfm-parser.js.map +1 -1
- package/dist/esm/parser/usx-parser.js +24 -7
- package/dist/esm/parser/usx-parser.js.map +2 -2
- package/dist/esm/utils.js +138 -0
- package/dist/esm/utils.js.map +2 -2
- package/dist/types/generation/api.d.ts +2515 -470
- package/dist/types/generation/audio.d.ts +5 -0
- package/dist/types/generation/common-types.d.ts +1222 -413
- package/dist/types/generation/dataset.d.ts +1 -0
- package/dist/types/parser/codex-parser.d.ts +18 -138
- package/dist/types/parser/lockman-parser.d.ts +14 -0
- package/dist/types/parser/types.d.ts +4 -0
- package/dist/types/parser/usx-parser.d.ts +2 -2
- package/dist/types/utils.d.ts +223 -18
- package/package.json +5 -3
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../generation/api.ts"],
|
|
4
|
-
"sourcesContent": ["import {\r\n ChapterContent,\r\n ChapterData,\r\n ChapterFootnote,\r\n Commentary,\r\n CommentaryBook,\r\n CommentaryBookChapter,\r\n CommentaryProfile,\r\n Dataset,\r\n DatasetBook,\r\n DatasetBookChapter,\r\n OutputFile,\r\n Translation,\r\n TranslationBook,\r\n TranslationBookChapter,\r\n TranslationBookChapterAudioLinks,\r\n} from './common-types.js';\r\nimport { DatasetOutput } from './dataset.js';\r\n\r\n/**\r\n * Defines the output of the API generation.\r\n */\r\nexport interface ApiOutput {\r\n /**\r\n * The list of available translations.\r\n * This maps to the /api/available-translations.json endpoint.\r\n */\r\n availableTranslations: ApiAvailableTranslations;\r\n\r\n /**\r\n * The list of books for each translation.\r\n * This maps to the /api/:translationId/books.json endpoint.\r\n */\r\n translationBooks: ApiTranslationBooks[];\r\n\r\n /**\r\n * The list of chapters for each book.\r\n * This maps to the following endpoints:\r\n * - /api/:translationId/:bookId/:chapterNumber.json\r\n * - /api/:translationId/:bookCommonName/:chapterNumber.json\r\n */\r\n translationBookChapters: ApiTranslationBookChapter[];\r\n\r\n /**\r\n * The list of audio files.\r\n * This maps to the following endpoints:\r\n * - /api/:translationId/:bookId/:chapterNumber.:reader.mp3\r\n */\r\n translationBookChapterAudio: ApiTranslationBookChapterAudio[];\r\n\r\n /**\r\n * The list of available commentaries.\r\n * This maps to the /api/available-commentaries.json endpoint.\r\n */\r\n availableCommentaries: ApiAvailableCommentaries;\r\n\r\n /**\r\n * The list of books for each commentary.\r\n * This maps to the /api/c/:commentaryId/books.json endpoint.\r\n */\r\n commentaryBooks: ApiCommentaryBooks[];\r\n\r\n /**\r\n * The list of profiles for each commentary.\r\n * This maps to the /api/c/:commentaryId/profiles.json endpoint.\r\n */\r\n commentaryProfiles: ApiCommentaryProfiles[];\r\n\r\n /**\r\n * The list of chapters for each commentary book.\r\n * This maps to the following endpoint:\r\n * - /api/c/:commentaryId/:bookId/:chapterNumber.json\r\n */\r\n commentaryBookChapters: ApiCommentaryBookChapter[];\r\n\r\n /**\r\n * The list of individual profiles for each commentary.\r\n * This maps to the following endpoint:\r\n * - /api/c/:commentaryId/profiles/:profileId.json\r\n */\r\n commentaryProfileContents: ApiCommentaryProfileContent[];\r\n\r\n /**\r\n * The list of available datasets.\r\n * This maps to the /api/available-datasets.json endpoint.\r\n */\r\n availableDatasets?: ApiAvailableDatasets;\r\n\r\n /**\r\n * The list of books for each dataset.\r\n * This maps to the /api/d/:datasetId/books.json endpoint.\r\n */\r\n datasetBooks?: ApiDatasetBooks[];\r\n\r\n /**\r\n * The list of chapters for each dataset book.\r\n * This maps to the following endpoint:\r\n * - /api/d/:datasetId/:bookId/:chapterNumber.json\r\n */\r\n datasetBookChapters?: ApiDatasetBookChapter[];\r\n\r\n /**\r\n * The complete translation data for each translation.\r\n * This maps to the /api/:translationId/complete.json endpoint.\r\n */\r\n translationComplete: ApiTranslationComplete[];\r\n\r\n /**\r\n * The path prefix that the API should use.\r\n */\r\n pathPrefix: string;\r\n}\r\n\r\n/**\r\n * The list of available translations.\r\n * Maps to the /api/available-translations.json endpoint.\r\n */\r\nexport interface ApiAvailableTranslations {\r\n /**\r\n * The list of translations.\r\n */\r\n translations: ApiTranslation[];\r\n}\r\n\r\n/**\r\n * The list of available commentaries.\r\n * Maps to the /api/available-commentaries.json endpoint.\r\n */\r\nexport interface ApiAvailableCommentaries {\r\n /**\r\n * The list of commentaries.\r\n */\r\n commentaries: ApiCommentary[];\r\n}\r\n\r\n/**\r\n * The list of available datasets.\r\n * Maps to the /api/available-datasets.json endpoint.\r\n */\r\nexport interface ApiAvailableDatasets {\r\n datasets: ApiDataset[];\r\n}\r\n\r\n/**\r\n * Defines a dataset that is used in the API.\r\n */\r\nexport interface ApiDataset extends Dataset {\r\n /**\r\n * The API link for the list of books for this dataset.\r\n */\r\n listOfBooksApiLink: string;\r\n\r\n /**\r\n * The available list of formats.\r\n */\r\n availableFormats: 'json'[];\r\n\r\n /**\r\n * The number of books that are contained in this dataset.\r\n */\r\n numberOfBooks: number;\r\n\r\n /**\r\n * The total number of chapters that are contained in this dataset.\r\n */\r\n totalNumberOfChapters: number;\r\n\r\n /**\r\n * The total number of verses that are contained in this dataset.\r\n */\r\n totalNumberOfVerses: number;\r\n\r\n /**\r\n * The total number of references that are contained in this dataset.\r\n */\r\n totalNumberOfReferences: number;\r\n\r\n /**\r\n * Gets the name of the language that the commentary is in.\r\n * Null or undefined if the name of the language is not known.\r\n */\r\n languageName?: string;\r\n\r\n /**\r\n * Gets the name of the language in English.\r\n * Null or undefined if the language doesn't have an english name.\r\n */\r\n languageEnglishName?: string;\r\n}\r\n\r\n/**\r\n * Defines a translation that is used in the API.\r\n */\r\nexport interface ApiTranslation extends Translation {\r\n /**\r\n * The API link for the list of available books for this translation.\r\n */\r\n listOfBooksApiLink: string;\r\n\r\n /**\r\n * The available list of formats.\r\n */\r\n availableFormats: ('json' | 'usfm')[];\r\n\r\n /**\r\n * The number of books that are contained in this translation.\r\n *\r\n * Complete translations should have the same number of books as the Bible (66).\r\n */\r\n numberOfBooks: number;\r\n\r\n /**\r\n * The total number of chapters that are contained in this translation.\r\n *\r\n * Complete translations should have the same number of chapters as the Bible (1,189).\r\n */\r\n totalNumberOfChapters: number;\r\n\r\n /**\r\n * The total number of verses that are contained in this translation.\r\n *\r\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).\r\n */\r\n totalNumberOfVerses: number;\r\n\r\n /**\r\n * The total number of apocryphal books that are contained in this translation.\r\n */\r\n numberOfApocryphalBooks?: number;\r\n\r\n /**\r\n * The total number of apocryphal chapters that are contained in this translation.\r\n */\r\n totalNumberOfApocryphalChapters?: number;\r\n\r\n /**\r\n * the total number of apocryphal verses that are contained in this translation.\r\n */\r\n totalNumberOfApocryphalVerses?: number;\r\n\r\n /**\r\n * Gets the name of the language that the translation is in.\r\n * Null or undefined if the name of the language is not known.\r\n */\r\n languageName?: string;\r\n\r\n /**\r\n * Gets the name of the language in English.\r\n * Null or undefined if the language doesn't have an english name.\r\n */\r\n languageEnglishName?: string;\r\n\r\n /**\r\n * The API link for downloading the complete translation as a single JSON file.\r\n *\r\n * Undefined if complete translation files are not available.\r\n */\r\n completeTranslationApiLink?: string;\r\n}\r\n\r\n/**\r\n * Defines the complete translation download data.\r\n * Maps to the /api/:translationId/complete.json endpoint.\r\n */\r\nexport interface ApiTranslationComplete {\r\n /**\r\n * The translation metadata.\r\n */\r\n translation: ApiTranslation;\r\n\r\n /**\r\n * The complete list of books with all their chapters.\r\n */\r\n books: ApiTranslationCompleteBook[];\r\n}\r\n\r\n/**\r\n * A book in the complete translation download.\r\n */\r\nexport interface ApiTranslationCompleteBook {\r\n /**\r\n * The ID of the book.\r\n */\r\n id: string;\r\n\r\n /**\r\n * The name of the book from the translation.\r\n */\r\n name: string;\r\n\r\n /**\r\n * The common name for the book.\r\n */\r\n commonName: string;\r\n\r\n /**\r\n * The title of the book.\r\n */\r\n title: string | null;\r\n\r\n /**\r\n * The order of the book.\r\n */\r\n order: number;\r\n\r\n /**\r\n * The number of chapters in the book.\r\n */\r\n numberOfChapters: number;\r\n\r\n /**\r\n * The total number of verses in the book.\r\n */\r\n totalNumberOfVerses: number;\r\n\r\n /**\r\n * Whether the book is apocryphal.\r\n */\r\n isApocryphal?: boolean;\r\n\r\n /**\r\n * The complete list of chapters with all content.\r\n */\r\n chapters: TranslationBookChapter[];\r\n}\r\n\r\n/**\r\n * Defines a commentary that is used in the API.\r\n */\r\nexport interface ApiCommentary extends Commentary {\r\n /**\r\n * The API link for the list of available books for this translation.\r\n */\r\n listOfBooksApiLink: string;\r\n\r\n /**\r\n * The API link for the list of available profiles for this commentary.\r\n */\r\n listOfProfilesApiLink: string;\r\n\r\n /**\r\n * The available list of formats.\r\n */\r\n availableFormats: ('json' | 'usfm')[];\r\n\r\n /**\r\n * The number of books that are contained in this commentary.\r\n *\r\n * Complete commentaries should have the same number of books as the Bible (66).\r\n */\r\n numberOfBooks: number;\r\n\r\n /**\r\n * The total number of chapters that are contained in this translation.\r\n *\r\n * Complete commentaries should have the same number of chapters as the Bible (1,189).\r\n */\r\n totalNumberOfChapters: number;\r\n\r\n /**\r\n * The total number of verses that are contained in this commentary.\r\n *\r\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).\r\n */\r\n totalNumberOfVerses: number;\r\n\r\n /**\r\n * The total number of profiles that are contained in this commentary.\r\n *\r\n * Profiles are used to provide additional information about people and people groups that are mentioned in the Bible.\r\n */\r\n totalNumberOfProfiles: number;\r\n\r\n /**\r\n * Gets the name of the language that the commentary is in.\r\n * Null or undefined if the name of the language is not known.\r\n */\r\n languageName?: string;\r\n\r\n /**\r\n * Gets the name of the language in English.\r\n * Null or undefined if the language doesn't have an english name.\r\n */\r\n languageEnglishName?: string;\r\n}\r\n\r\n/**\r\n * Defines an interface that contains information about the books that are available for a translation.\r\n */\r\nexport interface ApiTranslationBooks {\r\n /**\r\n * The translation information for the books.\r\n */\r\n translation: ApiTranslation;\r\n\r\n /**\r\n * The list of books that are available for the translation.\r\n */\r\n books: ApiTranslationBook[];\r\n}\r\n\r\n/**\r\n * Defines an interface that contains information about the books that are available for a commentary.\r\n */\r\nexport interface ApiCommentaryBooks {\r\n /**\r\n * The commentary information for the books.\r\n */\r\n commentary: ApiCommentary;\r\n\r\n /**\r\n * The list of books that are available for the commentary.\r\n */\r\n books: ApiCommentaryBook[];\r\n}\r\n\r\n/**\r\n * Defines an interface that contains information about the books that are available for a dataset.\r\n */\r\nexport interface ApiDatasetBooks {\r\n /**\r\n * The dataset information for the books.\r\n */\r\n dataset: ApiDataset;\r\n\r\n /**\r\n * The list of books that are available for the dataset.\r\n */\r\n books: ApiDatasetBook[];\r\n}\r\n\r\n/**\r\n * Defines an interface that contains information about the profiles that are available for a commentary.\r\n */\r\nexport interface ApiCommentaryProfiles {\r\n /**\r\n * The commentary information for the books.\r\n */\r\n commentary: ApiCommentary;\r\n\r\n /**\r\n * The list of profiles that are available for the commentary.\r\n */\r\n profiles: ApiCommentaryProfile[];\r\n}\r\n\r\n/**\r\n * Defines an interface that contains information about a profile.\r\n */\r\nexport interface ApiCommentaryProfile extends CommentaryProfile {\r\n /**\r\n * The link to this profile.\r\n */\r\n thisProfileLink: string;\r\n\r\n /**\r\n * The link to the chapter that this profile references in the commentary.\r\n */\r\n referenceChapterLink: string | null;\r\n}\r\n\r\n/**\r\n * Defines a translation book that is used in the API.\r\n */\r\nexport interface ApiTranslationBook extends TranslationBook {\r\n /**\r\n * The number of the first chapter in the book.\r\n */\r\n firstChapterNumber: number;\r\n\r\n /**\r\n * The link to the first chapter of the book.\r\n */\r\n firstChapterApiLink: string;\r\n\r\n /**\r\n * The number of the last chapter in the book.\r\n */\r\n lastChapterNumber: number;\r\n\r\n /**\r\n * The link to the last chapter of the book.\r\n */\r\n lastChapterApiLink: string;\r\n\r\n /**\r\n * The number of chapters that the book contains.\r\n */\r\n numberOfChapters: number;\r\n\r\n /**\r\n * The number of verses that the book contains.\r\n */\r\n totalNumberOfVerses: number;\r\n}\r\n\r\n/**\r\n * Defines a commentary book that is used in the API.\r\n */\r\nexport interface ApiCommentaryBook extends CommentaryBook {\r\n /**\r\n * The number of the first chapter in the book.\r\n *\r\n * Null if the comentary book has no chapters.\r\n */\r\n firstChapterNumber: number | null;\r\n\r\n /**\r\n * The link to the first chapter of the book.\r\n *\r\n * Null if the comentary book has no chapters.\r\n */\r\n firstChapterApiLink: string | null;\r\n\r\n /**\r\n * The number of the last chapter in the book.\r\n *\r\n * Null if the comentary book has no chapters.\r\n */\r\n lastChapterNumber: number | null;\r\n\r\n /**\r\n * The link to the last chapter of the book.\r\n *\r\n * Null if the comentary book has no chapters.\r\n */\r\n lastChapterApiLink: string | null;\r\n\r\n /**\r\n * The number of chapters that the book contains.\r\n */\r\n numberOfChapters: number;\r\n\r\n /**\r\n * The number of verses that the book contains.\r\n */\r\n totalNumberOfVerses: number;\r\n}\r\n\r\n/**\r\n * Defines an interface that contains information about a book in a dataset.\r\n */\r\nexport interface ApiDatasetBook extends DatasetBook {\r\n /**\r\n * The number of the first chapter in the book.\r\n */\r\n firstChapterNumber: number;\r\n\r\n /**\r\n * The link to the first chapter of the book.\r\n */\r\n firstChapterApiLink: string;\r\n\r\n /**\r\n * The number of the last chapter in the book.\r\n */\r\n lastChapterNumber: number;\r\n\r\n /**\r\n * The link to the last chapter of the book.\r\n */\r\n lastChapterApiLink: string;\r\n\r\n /**\r\n * The number of chapters that the book contains.\r\n */\r\n numberOfChapters: number;\r\n\r\n /**\r\n * The number of verses that the book contains.\r\n */\r\n totalNumberOfVerses: number;\r\n\r\n /**\r\n * The number of references that the book contains.\r\n */\r\n totalNumberOfReferences: number;\r\n}\r\n\r\n/**\r\n * Defines an interface that contains information about a book chapter.\r\n */\r\nexport interface ApiTranslationBookChapter extends TranslationBookChapter {\r\n /**\r\n * The translation information for the book chapter.\r\n */\r\n translation: ApiTranslation;\r\n\r\n /**\r\n * The book information for the book chapter.\r\n */\r\n book: ApiTranslationBook;\r\n\r\n /**\r\n * The link to this chapter.\r\n */\r\n thisChapterLink: string;\r\n\r\n /**\r\n * The link to the next chapter.\r\n * Null if this is the last chapter in the translation.\r\n */\r\n nextChapterApiLink: string | null;\r\n\r\n /**\r\n * The links to the audio versions for the next chapter.\r\n * Null if this is the last chapter in the translation.\r\n */\r\n nextChapterAudioLinks: TranslationBookChapterAudioLinks | null;\r\n\r\n /**\r\n * The link to the previous chapter.\r\n * Null if this is the first chapter in the translation.\r\n */\r\n previousChapterApiLink: string | null;\r\n\r\n /**\r\n * The links to the audio versions for the previous chapter.\r\n * Null if this is the first chapter in the translation.\r\n */\r\n previousChapterAudioLinks: TranslationBookChapterAudioLinks | null;\r\n\r\n /**\r\n * The number of verses that the chapter contains.\r\n */\r\n numberOfVerses: number;\r\n}\r\n\r\n/**\r\n * Defines an interface that contains information about a book chapter.\r\n */\r\nexport interface ApiCommentaryBookChapter extends CommentaryBookChapter {\r\n /**\r\n * The commentary information for the book chapter.\r\n */\r\n commentary: ApiCommentary;\r\n\r\n /**\r\n * The book information for the book chapter.\r\n */\r\n book: ApiCommentaryBook;\r\n\r\n /**\r\n * The link to this chapter.\r\n */\r\n thisChapterLink: string;\r\n\r\n /**\r\n * The link to the next chapter.\r\n * Null if this is the last chapter in the translation.\r\n */\r\n nextChapterApiLink: string | null;\r\n\r\n /**\r\n * The link to the previous chapter.\r\n * Null if this is the first chapter in the translation.\r\n */\r\n previousChapterApiLink: string | null;\r\n\r\n /**\r\n * The number of verses that the chapter contains.\r\n */\r\n numberOfVerses: number;\r\n}\r\n\r\n/**\r\n * Defines an interface that contains information about a book chapter.\r\n */\r\nexport interface ApiDatasetBookChapter extends DatasetBookChapter {\r\n /**\r\n * The dataset information for the book chapter.\r\n */\r\n dataset: ApiDataset;\r\n\r\n /**\r\n * The book information for the book chapter.\r\n */\r\n book: ApiDatasetBook;\r\n\r\n /**\r\n * The link to this chapter.\r\n */\r\n thisChapterLink: string;\r\n\r\n /**\r\n * The link to the next chapter.\r\n * Null if this is the last chapter in the translation.\r\n */\r\n nextChapterApiLink: string | null;\r\n\r\n /**\r\n * The link to the previous chapter.\r\n * Null if this is the first chapter in the translation.\r\n */\r\n previousChapterApiLink: string | null;\r\n\r\n /**\r\n * The number of verses that the chapter contains.\r\n */\r\n numberOfVerses: number;\r\n\r\n /**\r\n * The number of references that the chapter contains.\r\n */\r\n numberOfReferences: number;\r\n}\r\n\r\nexport interface ApiTranslationBookChapterAudio {\r\n /**\r\n * The chapter that the audio is for.\r\n */\r\n chapter: ApiTranslationBookChapter;\r\n\r\n /**\r\n * The link that the audio should be placed at.\r\n */\r\n link: string;\r\n\r\n /**\r\n * The original URL of the audio.\r\n */\r\n originalUrl: string;\r\n}\r\n\r\nexport interface ApiCommentaryProfileContent {\r\n /**\r\n * The commentary information for the profile.\r\n */\r\n commentary: ApiCommentary;\r\n\r\n /**\r\n * The information about the profile.\r\n */\r\n profile: ApiCommentaryProfile;\r\n\r\n /**\r\n * The content of the profile.\r\n */\r\n content: string[];\r\n}\r\n\r\n/**\r\n * The options for generating the API.\r\n */\r\nexport interface GenerateApiOptions {\r\n /**\r\n * Whether to use the common name for the book chapter API link. If false, then book IDs are used.\r\n * Audio URLs will always use the book ID.\r\n * Defaults to false.\r\n */\r\n useCommonName?: boolean;\r\n\r\n /**\r\n * Whether to replace the audio URLs in the dataset with ones that are hosted locally.\r\n * If true, then the audio URLs in the dataset will be replaced with ones that reference files hosted by the API itself.\r\n * If false, then the audio URLs in the dataset will be left as is.\r\n * Defaults to false.\r\n */\r\n generateAudioFiles?: boolean;\r\n\r\n /**\r\n * Gets the english name of the given language.\r\n * If not provided, then the english name for the language will be unknown and omitted.\r\n * @param language The language to get the english name for.\r\n */\r\n getEnglishName?: (language: string) => string | null | undefined;\r\n\r\n /**\r\n * Gets the native name of the given language.\r\n * If not provided, then the native name for the language will be unknown and omitted.\r\n * @param language The language to get the native name for.\r\n */\r\n getNativeName?: (language: string) => string | null | undefined;\r\n\r\n /**\r\n * The prefix that should be added to paths that are generated.\r\n */\r\n pathPrefix?: string;\r\n\r\n /**\r\n * Whether to generate complete translation files for each translation.\r\n */\r\n generateCompleteTranslationFiles?: boolean;\r\n}\r\n\r\n/**\r\n * Generates the API output for the given dataset.\r\n * @param dataset The dataset to generate the API for.\r\n * @param options The options for generating the API.\r\n */\r\nexport function generateApiForDataset(\r\n dataset: DatasetOutput,\r\n options: GenerateApiOptions = {}\r\n): ApiOutput {\r\n const { useCommonName, pathPrefix } = options;\r\n const apiPathPrefix = pathPrefix ? pathPrefix : '';\r\n let api: ApiOutput = {\r\n availableTranslations: {\r\n translations: [],\r\n },\r\n translationBooks: [],\r\n translationBookChapters: [],\r\n translationBookChapterAudio: [],\r\n translationComplete: [],\r\n availableCommentaries: {\r\n commentaries: [],\r\n },\r\n commentaryBookChapters: [],\r\n commentaryBooks: [],\r\n commentaryProfiles: [],\r\n commentaryProfileContents: [],\r\n pathPrefix: apiPathPrefix,\r\n };\r\n\r\n const getNativeName = options.getNativeName;\r\n const getEnglishName = options.getEnglishName;\r\n\r\n for (let { books, ...translation } of dataset.translations) {\r\n let numberOfBooks = 0;\r\n let numberOfApocryphalBooks = 0;\r\n\r\n for (let book of books) {\r\n if (book.isApocryphal) {\r\n numberOfApocryphalBooks++;\r\n } else {\r\n numberOfBooks++;\r\n }\r\n }\r\n\r\n const apiTranslation: ApiTranslation = {\r\n ...translation,\r\n availableFormats: ['json'],\r\n listOfBooksApiLink: listOfBooksApiLink(\r\n translation.id,\r\n apiPathPrefix\r\n ),\r\n completeTranslationApiLink: options.generateCompleteTranslationFiles\r\n ? completeTranslationApiLink(translation.id, apiPathPrefix)\r\n : undefined,\r\n numberOfBooks,\r\n totalNumberOfChapters: 0,\r\n totalNumberOfVerses: 0,\r\n languageName: getNativeName\r\n ? (getNativeName(translation.language) ?? undefined)\r\n : undefined,\r\n languageEnglishName: getEnglishName\r\n ? (getEnglishName(translation.language) ?? undefined)\r\n : undefined,\r\n };\r\n\r\n if (numberOfApocryphalBooks > 0) {\r\n apiTranslation.numberOfApocryphalBooks = numberOfApocryphalBooks;\r\n }\r\n\r\n const translationBooks: ApiTranslationBooks = {\r\n translation: apiTranslation,\r\n books: [],\r\n };\r\n\r\n let translationChapters: ApiTranslationBookChapter[] = [];\r\n\r\n for (let { chapters, ...book } of books) {\r\n const firstChapterNumber = chapters[0].chapter.number;\r\n const lastChapterNumber =\r\n chapters[chapters.length - 1].chapter.number;\r\n const apiBook: ApiTranslationBook = {\r\n ...book,\r\n firstChapterNumber,\r\n firstChapterApiLink: bookChapterApiLink(\r\n translation.id,\r\n getBookLink(book),\r\n firstChapterNumber,\r\n 'json',\r\n apiPathPrefix\r\n ),\r\n lastChapterNumber,\r\n lastChapterApiLink: bookChapterApiLink(\r\n translation.id,\r\n getBookLink(book),\r\n lastChapterNumber,\r\n 'json',\r\n apiPathPrefix\r\n ),\r\n numberOfChapters: chapters.length,\r\n totalNumberOfVerses: 0,\r\n };\r\n\r\n for (let { chapter, thisChapterAudioLinks } of chapters) {\r\n const audio: TranslationBookChapterAudioLinks = {};\r\n const apiBookChapter: ApiTranslationBookChapter = {\r\n translation: apiTranslation,\r\n book: apiBook,\r\n chapter: chapter,\r\n thisChapterLink: bookChapterApiLink(\r\n translation.id,\r\n getBookLink(book),\r\n chapter.number,\r\n 'json',\r\n apiPathPrefix\r\n ),\r\n thisChapterAudioLinks: audio,\r\n nextChapterApiLink: null,\r\n nextChapterAudioLinks: null,\r\n previousChapterApiLink: null,\r\n previousChapterAudioLinks: null,\r\n numberOfVerses: 0,\r\n };\r\n\r\n for (let reader in thisChapterAudioLinks) {\r\n if (options.generateAudioFiles) {\r\n const apiAudio: ApiTranslationBookChapterAudio = {\r\n chapter: apiBookChapter,\r\n link: bookChapterAudioApiLink(\r\n translation.id,\r\n getBookLink(book),\r\n chapter.number,\r\n reader,\r\n apiPathPrefix\r\n ),\r\n originalUrl: thisChapterAudioLinks[reader],\r\n };\r\n audio[reader] = apiAudio.link;\r\n api.translationBookChapterAudio.push(apiAudio);\r\n } else {\r\n audio[reader] = thisChapterAudioLinks[reader];\r\n }\r\n }\r\n\r\n for (let c of chapter.content) {\r\n if (c.type === 'verse') {\r\n apiBookChapter.numberOfVerses++;\r\n }\r\n }\r\n\r\n apiBook.totalNumberOfVerses += apiBookChapter.numberOfVerses;\r\n\r\n translationChapters.push(apiBookChapter);\r\n api.translationBookChapters.push(apiBookChapter);\r\n }\r\n\r\n translationBooks.books.push(apiBook);\r\n\r\n if (apiBook.isApocryphal) {\r\n if (!apiTranslation.totalNumberOfApocryphalChapters) {\r\n apiTranslation.totalNumberOfApocryphalChapters = 0;\r\n }\r\n if (!apiTranslation.totalNumberOfApocryphalVerses) {\r\n apiTranslation.totalNumberOfApocryphalVerses = 0;\r\n }\r\n apiTranslation.totalNumberOfApocryphalChapters +=\r\n apiBook.numberOfChapters;\r\n apiTranslation.totalNumberOfApocryphalVerses +=\r\n apiBook.totalNumberOfVerses;\r\n } else {\r\n apiTranslation.totalNumberOfChapters +=\r\n apiBook.numberOfChapters;\r\n apiTranslation.totalNumberOfVerses +=\r\n apiBook.totalNumberOfVerses;\r\n }\r\n }\r\n\r\n for (let i = 0; i < translationChapters.length; i++) {\r\n if (i > 0) {\r\n translationChapters[i].previousChapterApiLink =\r\n bookChapterApiLink(\r\n translation.id,\r\n getBookLink(translationChapters[i - 1].book),\r\n translationChapters[i - 1].chapter.number,\r\n 'json',\r\n apiPathPrefix\r\n );\r\n translationChapters[i].previousChapterAudioLinks =\r\n translationChapters[i - 1].thisChapterAudioLinks;\r\n }\r\n\r\n if (i < translationChapters.length - 1) {\r\n translationChapters[i].nextChapterApiLink = bookChapterApiLink(\r\n translation.id,\r\n getBookLink(translationChapters[i + 1].book),\r\n translationChapters[i + 1].chapter.number,\r\n 'json',\r\n apiPathPrefix\r\n );\r\n translationChapters[i].nextChapterAudioLinks =\r\n translationChapters[i + 1].thisChapterAudioLinks;\r\n }\r\n }\r\n\r\n api.availableTranslations.translations.push(apiTranslation);\r\n api.translationBooks.push(translationBooks);\r\n\r\n if (options.generateCompleteTranslationFiles) {\r\n // Build the complete translation data for download\r\n const completeTranslation: ApiTranslationComplete = {\r\n translation: apiTranslation,\r\n books: translationBooks.books.map((book) => {\r\n const bookChapters = translationChapters.filter(\r\n (ch) => ch.book.id === book.id\r\n );\r\n return {\r\n id: book.id,\r\n name: book.name,\r\n commonName: book.commonName,\r\n title: book.title,\r\n order: book.order,\r\n numberOfChapters: book.numberOfChapters,\r\n totalNumberOfVerses: book.totalNumberOfVerses,\r\n isApocryphal: book.isApocryphal,\r\n chapters: bookChapters.map((ch) => ({\r\n numberOfVerses: ch.numberOfVerses,\r\n thisChapterAudioLinks: ch.thisChapterAudioLinks,\r\n chapter: ch.chapter,\r\n })),\r\n };\r\n }),\r\n };\r\n api.translationComplete.push(completeTranslation);\r\n }\r\n }\r\n\r\n for (let { books, profiles, ...commentary } of dataset.commentaries) {\r\n const apiCommentary: ApiCommentary = {\r\n ...commentary,\r\n availableFormats: ['json'],\r\n listOfBooksApiLink: listOfCommentaryBooksApiLink(\r\n commentary.id,\r\n apiPathPrefix\r\n ),\r\n listOfProfilesApiLink: profilesCommentaryApiLink(\r\n commentary.id,\r\n 'json',\r\n apiPathPrefix\r\n ),\r\n numberOfBooks: books.length,\r\n totalNumberOfChapters: 0,\r\n totalNumberOfVerses: 0,\r\n totalNumberOfProfiles: 0,\r\n languageName: getNativeName\r\n ? (getNativeName(commentary.language) ?? undefined)\r\n : undefined,\r\n languageEnglishName: getEnglishName\r\n ? (getEnglishName(commentary.language) ?? undefined)\r\n : undefined,\r\n };\r\n\r\n const commentaryBooks: ApiCommentaryBooks = {\r\n commentary: apiCommentary,\r\n books: [],\r\n };\r\n\r\n const commentaryProfiles: ApiCommentaryProfiles = {\r\n commentary: apiCommentary,\r\n profiles: [],\r\n };\r\n\r\n let commentaryChapters: ApiCommentaryBookChapter[] = [];\r\n\r\n for (let { chapters, ...book } of books) {\r\n const firstChapterNumber = chapters[0]?.chapter.number ?? null;\r\n const lastChapterNumber =\r\n chapters[chapters.length - 1]?.chapter.number ?? null;\r\n const apiBook: ApiCommentaryBook = {\r\n ...book,\r\n firstChapterNumber,\r\n firstChapterApiLink: firstChapterNumber\r\n ? bookCommentaryChapterApiLink(\r\n commentary.id,\r\n getBookLink(book),\r\n firstChapterNumber,\r\n 'json',\r\n apiPathPrefix\r\n )\r\n : null,\r\n lastChapterNumber,\r\n lastChapterApiLink: lastChapterNumber\r\n ? bookCommentaryChapterApiLink(\r\n commentary.id,\r\n getBookLink(book),\r\n lastChapterNumber,\r\n 'json',\r\n apiPathPrefix\r\n )\r\n : null,\r\n numberOfChapters: chapters.length,\r\n totalNumberOfVerses: 0,\r\n };\r\n\r\n for (let { chapter } of chapters) {\r\n const apiBookChapter: ApiCommentaryBookChapter = {\r\n commentary: apiCommentary,\r\n book: apiBook,\r\n chapter: chapter,\r\n thisChapterLink: bookCommentaryChapterApiLink(\r\n commentary.id,\r\n getBookLink(book),\r\n chapter.number,\r\n 'json',\r\n apiPathPrefix\r\n ),\r\n nextChapterApiLink: null,\r\n previousChapterApiLink: null,\r\n numberOfVerses: 0,\r\n };\r\n\r\n for (let c of chapter.content) {\r\n if (c.type === 'verse') {\r\n apiBookChapter.numberOfVerses++;\r\n }\r\n }\r\n\r\n apiBook.totalNumberOfVerses += apiBookChapter.numberOfVerses;\r\n\r\n commentaryChapters.push(apiBookChapter);\r\n api.commentaryBookChapters.push(apiBookChapter);\r\n }\r\n\r\n commentaryBooks.books.push(apiBook);\r\n\r\n apiCommentary.totalNumberOfChapters += apiBook.numberOfChapters;\r\n apiCommentary.totalNumberOfVerses += apiBook.totalNumberOfVerses;\r\n }\r\n\r\n if (profiles) {\r\n for (let profile of profiles) {\r\n const apiProfile: ApiCommentaryProfile = {\r\n id: profile.id,\r\n reference: profile.reference,\r\n subject: profile.subject,\r\n thisProfileLink: profileCommentaryApiLink(\r\n commentary.id,\r\n profile.id,\r\n 'json',\r\n apiPathPrefix\r\n ),\r\n referenceChapterLink: profile.reference\r\n ? bookCommentaryChapterApiLink(\r\n commentary.id,\r\n profile.reference.book,\r\n profile.reference.chapter,\r\n 'json',\r\n apiPathPrefix\r\n )\r\n : null,\r\n };\r\n\r\n const apiProfileContent: ApiCommentaryProfileContent = {\r\n commentary: apiCommentary,\r\n profile: apiProfile,\r\n content: profile.content,\r\n };\r\n\r\n apiCommentary.totalNumberOfProfiles += 1;\r\n commentaryProfiles.profiles.push(apiProfile);\r\n api.commentaryProfileContents.push(apiProfileContent);\r\n }\r\n }\r\n\r\n for (let i = 0; i < commentaryChapters.length; i++) {\r\n if (i > 0) {\r\n commentaryChapters[i].previousChapterApiLink =\r\n bookCommentaryChapterApiLink(\r\n commentary.id,\r\n getBookLink(commentaryChapters[i - 1].book),\r\n commentaryChapters[i - 1].chapter.number,\r\n 'json',\r\n apiPathPrefix\r\n );\r\n // commentaryChapters[i].previousChapterAudioLinks =\r\n // commentaryChapters[i - 1].thisChapterAudioLinks;\r\n }\r\n\r\n if (i < commentaryChapters.length - 1) {\r\n commentaryChapters[i].nextChapterApiLink =\r\n bookCommentaryChapterApiLink(\r\n commentary.id,\r\n getBookLink(commentaryChapters[i + 1].book),\r\n commentaryChapters[i + 1].chapter.number,\r\n 'json',\r\n apiPathPrefix\r\n );\r\n // commentaryChapters[i].nextChapterAudioLinks =\r\n // commentaryChapters[i + 1].thisChapterAudioLinks;\r\n }\r\n }\r\n\r\n api.availableCommentaries.commentaries.push(apiCommentary);\r\n api.commentaryBooks.push(commentaryBooks);\r\n api.commentaryProfiles.push(commentaryProfiles);\r\n }\r\n\r\n for (let { books, ...datasetInfo } of dataset.datasets ?? []) {\r\n const apiDataset: ApiDataset = {\r\n ...datasetInfo,\r\n availableFormats: ['json'],\r\n listOfBooksApiLink: listOfDatasetBooksApiLink(\r\n datasetInfo.id,\r\n apiPathPrefix\r\n ),\r\n numberOfBooks: books.length,\r\n totalNumberOfChapters: 0,\r\n totalNumberOfVerses: 0,\r\n totalNumberOfReferences: 0,\r\n languageName: getNativeName\r\n ? (getNativeName(datasetInfo.language) ?? undefined)\r\n : undefined,\r\n languageEnglishName: getEnglishName\r\n ? (getEnglishName(datasetInfo.language) ?? undefined)\r\n : undefined,\r\n };\r\n\r\n const datasetBooks: ApiDatasetBooks = {\r\n dataset: apiDataset,\r\n books: [],\r\n };\r\n\r\n let datasetChapters: ApiDatasetBookChapter[] = [];\r\n\r\n for (let { chapters, ...book } of books) {\r\n const firstChapterNumber = chapters[0]?.chapter.number ?? null;\r\n const lastChapterNumber =\r\n chapters[chapters.length - 1]?.chapter.number ?? null;\r\n const apiBook: ApiDatasetBook = {\r\n ...book,\r\n firstChapterNumber,\r\n firstChapterApiLink: bookDatasetChapterApiLink(\r\n datasetInfo.id,\r\n book.id,\r\n firstChapterNumber,\r\n 'json',\r\n apiPathPrefix\r\n ),\r\n lastChapterNumber,\r\n lastChapterApiLink: bookDatasetChapterApiLink(\r\n datasetInfo.id,\r\n book.id,\r\n lastChapterNumber,\r\n 'json',\r\n apiPathPrefix\r\n ),\r\n numberOfChapters: chapters.length,\r\n totalNumberOfVerses: 0,\r\n totalNumberOfReferences: 0,\r\n };\r\n\r\n for (let { chapter } of chapters) {\r\n const apiBookChapter: ApiDatasetBookChapter = {\r\n dataset: apiDataset,\r\n book: apiBook,\r\n chapter: chapter,\r\n thisChapterLink: bookDatasetChapterApiLink(\r\n datasetInfo.id,\r\n book.id,\r\n chapter.number,\r\n 'json',\r\n apiPathPrefix\r\n ),\r\n nextChapterApiLink: null,\r\n previousChapterApiLink: null,\r\n numberOfVerses: chapter.content.length,\r\n numberOfReferences: 0,\r\n };\r\n\r\n // apiBookChapter.numberOfVerses += ;\r\n for (let verse of chapter.content) {\r\n apiBookChapter.numberOfReferences +=\r\n verse.references.length;\r\n }\r\n\r\n apiBook.totalNumberOfVerses += apiBookChapter.numberOfVerses;\r\n apiBook.totalNumberOfReferences +=\r\n apiBookChapter.numberOfReferences;\r\n\r\n datasetChapters.push(apiBookChapter);\r\n if (!api.datasetBookChapters) {\r\n api.datasetBookChapters = [];\r\n }\r\n api.datasetBookChapters.push(apiBookChapter);\r\n }\r\n\r\n datasetBooks.books.push(apiBook);\r\n\r\n apiDataset.totalNumberOfChapters += apiBook.numberOfChapters;\r\n apiDataset.totalNumberOfVerses += apiBook.totalNumberOfVerses;\r\n apiDataset.totalNumberOfReferences +=\r\n apiBook.totalNumberOfReferences;\r\n }\r\n\r\n for (let i = 0; i < datasetChapters.length; i++) {\r\n if (i > 0) {\r\n datasetChapters[i].previousChapterApiLink =\r\n bookDatasetChapterApiLink(\r\n datasetInfo.id,\r\n datasetChapters[i - 1].book.id,\r\n datasetChapters[i - 1].chapter.number,\r\n 'json',\r\n apiPathPrefix\r\n );\r\n }\r\n\r\n if (i < datasetChapters.length - 1) {\r\n datasetChapters[i].nextChapterApiLink =\r\n bookDatasetChapterApiLink(\r\n datasetInfo.id,\r\n datasetChapters[i + 1].book.id,\r\n datasetChapters[i + 1].chapter.number,\r\n 'json',\r\n apiPathPrefix\r\n );\r\n }\r\n }\r\n\r\n if (!api.availableDatasets) {\r\n api.availableDatasets = {\r\n datasets: [],\r\n };\r\n }\r\n api.availableDatasets.datasets.push(apiDataset);\r\n if (!api.datasetBooks) {\r\n api.datasetBooks = [];\r\n }\r\n api.datasetBooks.push(datasetBooks);\r\n }\r\n\r\n return api;\r\n\r\n function getBookLink(book: TranslationBook | CommentaryBook): string {\r\n return useCommonName ? book.commonName : book.id;\r\n }\r\n}\r\n\r\n/**\r\n * Generates the output files for the given API.\r\n * @param api The API that the files should be generated for.\r\n */\r\nexport function generateFilesForApi(api: ApiOutput): OutputFile[] {\r\n let files: OutputFile[] = [];\r\n\r\n files.push(\r\n jsonFile(\r\n `${api.pathPrefix}/api/available_translations.json`,\r\n api.availableTranslations,\r\n true\r\n )\r\n );\r\n for (let translationBooks of api.translationBooks) {\r\n files.push(\r\n jsonFile(\r\n translationBooks.translation.listOfBooksApiLink,\r\n translationBooks\r\n )\r\n );\r\n }\r\n\r\n for (let bookChapter of api.translationBookChapters) {\r\n files.push(jsonFile(bookChapter.thisChapterLink, bookChapter));\r\n }\r\n\r\n for (let audio of api.translationBookChapterAudio) {\r\n files.push(downloadedFile(audio.link, audio.originalUrl));\r\n }\r\n\r\n // Generate complete translation download files\r\n for (let complete of api.translationComplete) {\r\n if (complete.translation.completeTranslationApiLink) {\r\n files.push(\r\n jsonFile(\r\n complete.translation.completeTranslationApiLink,\r\n complete\r\n )\r\n );\r\n }\r\n }\r\n\r\n files.push(\r\n jsonFile(\r\n `${api.pathPrefix}/api/available_commentaries.json`,\r\n api.availableCommentaries,\r\n true\r\n )\r\n );\r\n for (let commentaryBooks of api.commentaryBooks) {\r\n files.push(\r\n jsonFile(\r\n commentaryBooks.commentary.listOfBooksApiLink,\r\n commentaryBooks\r\n )\r\n );\r\n }\r\n\r\n for (let commentaryProfiles of api.commentaryProfiles) {\r\n files.push(\r\n jsonFile(\r\n commentaryProfiles.commentary.listOfProfilesApiLink,\r\n commentaryProfiles\r\n )\r\n );\r\n }\r\n\r\n for (let profileContent of api.commentaryProfileContents) {\r\n files.push(\r\n jsonFile(profileContent.profile.thisProfileLink, profileContent)\r\n );\r\n }\r\n\r\n for (let bookChapter of api.commentaryBookChapters) {\r\n files.push(jsonFile(bookChapter.thisChapterLink, bookChapter));\r\n }\r\n\r\n if (api.availableDatasets) {\r\n files.push(\r\n jsonFile(\r\n `${api.pathPrefix}/api/available_datasets.json`,\r\n api.availableDatasets,\r\n true\r\n )\r\n );\r\n }\r\n\r\n if (api.datasetBooks) {\r\n for (let datasetBook of api.datasetBooks) {\r\n files.push(\r\n jsonFile(datasetBook.dataset.listOfBooksApiLink, datasetBook)\r\n );\r\n }\r\n }\r\n\r\n if (api.datasetBookChapters) {\r\n for (let datasetBookChapter of api.datasetBookChapters) {\r\n files.push(\r\n jsonFile(datasetBookChapter.thisChapterLink, datasetBookChapter)\r\n );\r\n }\r\n }\r\n\r\n // for (let audio of api.translationBookChapterAudio) {\r\n // files.push(downloadedFile(audio.link, audio.originalUrl));\r\n // }\r\n\r\n return files;\r\n}\r\n\r\n/**\r\n * Generates the output files for the given datasets.\r\n * @param datasets The datasets to generate the output files for.\r\n * @param options The options for generating the API files.\r\n */\r\nexport async function* generateOutputFilesFromDatasets(\r\n datasets: AsyncIterable<DatasetOutput>,\r\n options?: GenerateApiOptions\r\n): AsyncGenerator<OutputFile[]> {\r\n for await (let dataset of datasets) {\r\n const api = generateApiForDataset(dataset, options);\r\n const files = generateFilesForApi(api);\r\n\r\n yield files;\r\n }\r\n}\r\n\r\n/**\r\n * Gets the API Link for the list of books endpoint for a translation.\r\n * @param translationId The ID of the translation.\r\n * @returns\r\n */\r\nexport function listOfBooksApiLink(\r\n translationId: string,\r\n prefix: string = ''\r\n): string {\r\n return `${prefix}/api/${translationId}/books.json`;\r\n}\r\n\r\n/**\r\n * Gets the API Link for the complete translation download endpoint.\r\n * @param translationId The ID of the translation.\r\n * @param prefix The path prefix.\r\n * @returns\r\n */\r\nexport function completeTranslationApiLink(\r\n translationId: string,\r\n prefix: string = ''\r\n): string {\r\n return `${prefix}/api/${translationId}/complete.json`;\r\n}\r\n\r\n/**\r\n * Gets the API Link for the list of books endpoint for a commentary.\r\n * @param commentaryId The ID of the commentary.\r\n * @returns\r\n */\r\nexport function listOfCommentaryBooksApiLink(\r\n commentaryId: string,\r\n prefix: string = ''\r\n): string {\r\n return `${prefix}/api/c/${commentaryId}/books.json`;\r\n}\r\n\r\n/**\r\n * Gets the API Link for the list of books endpoint for a dataset.\r\n * @param datasetId The ID of the dataset.\r\n * @returns\r\n */\r\nexport function listOfDatasetBooksApiLink(\r\n datasetId: string,\r\n prefix: string = ''\r\n): string {\r\n return `${prefix}/api/d/${datasetId}/books.json`;\r\n}\r\n\r\n/**\r\n * Getes the API link for a book chapter.\r\n * @param translationId The ID of the translation.\r\n * @param commonName The name of the book.\r\n * @param chapterNumber The number of the book.\r\n * @param extension The extension of the file.\r\n */\r\nexport function bookChapterApiLink(\r\n translationId: string,\r\n commonName: string,\r\n chapterNumber: number,\r\n extension: string,\r\n prefix: string = ''\r\n) {\r\n return `${prefix}/api/${translationId}/${replaceSpacesWithUnderscores(\r\n commonName\r\n )}/${chapterNumber}.${extension}`;\r\n}\r\n\r\n/**\r\n * Getes the API link for a book chapter.\r\n * @param translationId The ID of the translation.\r\n * @param commonName The name of the book.\r\n * @param chapterNumber The number of the book.\r\n * @param extension The extension of the file.\r\n */\r\nexport function bookCommentaryChapterApiLink(\r\n translationId: string,\r\n commonName: string,\r\n chapterNumber: number,\r\n extension: string,\r\n prefix: string = ''\r\n) {\r\n return `${prefix}/api/c/${translationId}/${replaceSpacesWithUnderscores(\r\n commonName\r\n )}/${chapterNumber}.${extension}`;\r\n}\r\n\r\nexport function bookChapterAudioApiLink(\r\n translationId: string,\r\n bookId: string,\r\n chapterNumber: number,\r\n reader: string,\r\n prefix: string = ''\r\n) {\r\n return `${prefix}/api/${translationId}/${replaceSpacesWithUnderscores(\r\n bookId\r\n )}/${chapterNumber}.${reader}.mp3`;\r\n}\r\n\r\n/**\r\n * Getes the API link for a book chapter.\r\n * @param translationId The ID of the translation.\r\n * @param commonName The name of the book.\r\n * @param chapterNumber The number of the book.\r\n * @param extension The extension of the file.\r\n */\r\nexport function bookDatasetChapterApiLink(\r\n translationId: string,\r\n commonName: string,\r\n chapterNumber: number,\r\n extension: string,\r\n prefix: string = ''\r\n) {\r\n return `${prefix}/api/d/${translationId}/${replaceSpacesWithUnderscores(\r\n commonName\r\n )}/${chapterNumber}.${extension}`;\r\n}\r\n\r\n/**\r\n * Gets the API link for a profile.\r\n * @param translationId The ID of the translation.\r\n * @param profileId The ID of the profile.\r\n * @param extension The extension of the file.\r\n */\r\nexport function profilesCommentaryApiLink(\r\n translationId: string,\r\n extension: string,\r\n prefix: string = ''\r\n) {\r\n return `${prefix}/api/c/${translationId}/profiles.${extension}`;\r\n}\r\n\r\n/**\r\n * Gets the API link for a profile.\r\n * @param translationId The ID of the translation.\r\n * @param profileId The ID of the profile.\r\n * @param extension The extension of the file.\r\n */\r\nexport function profileCommentaryApiLink(\r\n translationId: string,\r\n profileId: string,\r\n extension: string,\r\n prefix: string = ''\r\n) {\r\n return `${prefix}/api/c/${translationId}/profiles/${replaceSpacesWithUnderscores(\r\n profileId\r\n )}.${extension}`;\r\n}\r\n\r\nexport function jsonFile(\r\n path: string,\r\n content: any,\r\n mergable?: boolean\r\n): OutputFile {\r\n return {\r\n path,\r\n content,\r\n mergable,\r\n };\r\n}\r\n\r\nexport function downloadedFile(path: string, url: string): OutputFile {\r\n return {\r\n path,\r\n content: () => fetch(url).then((response) => response.body),\r\n };\r\n}\r\n\r\nexport function replaceSpacesWithUnderscores(str: string): string {\r\n return str.replace(/[<>:\"/\\\\|?*\\s]/g, '_');\r\n}\r\n"],
|
|
5
|
-
"mappings": ";AAsxBO,gBAAS,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,qBAAqB,CAAC;AAAA,IACtB,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,WA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AAa,aAAa,SAAS;AACjE;AAQO,gBAAS,yBACZ,eACA,WACA,WACA,SAAiB,IACnB;AACE,SAAO,GAAG,MAAM,UAAU,aAAa,aAAa;AAAA,IAChD;AAAA,EACJ,CAAC,IAAI,SAAS;AAClB;AAEO,gBAAS,SACZ,MACA,SACA,UACU;AACV,SAAO;AAAA,IACH;AAAA,IACA;AAAA,IACA;AAAA,EACJ;AACJ;AAEO,gBAAS,eAAe,MAAc,KAAyB;AAClE,SAAO;AAAA,IACH;AAAA,IACA,SAAS,MAAM,MAAM,GAAG,EAAE,KAAK,CAAC,aAAa,SAAS,IAAI;AAAA,EAC9D;AACJ;AAEO,gBAAS,6BAA6B,KAAqB;AAC9D,SAAO,IAAI,QAAQ,mBAAmB,GAAG;AAC7C;",
|
|
4
|
+
"sourcesContent": ["import { z } from 'zod';\r\nimport {\r\n ChapterContent,\r\n ChapterData,\r\n ChapterFootnote,\r\n Commentary,\r\n CommentaryBook,\r\n CommentaryBookChapterSchema,\r\n CommentaryBookSchema,\r\n CommentaryBookChapter,\r\n CommentaryProfile,\r\n CommentaryProfileSchema,\r\n Dataset,\r\n DatasetBook,\r\n DatasetBookChapterSchema,\r\n DatasetBookSchema,\r\n DatasetBookChapter,\r\n OutputFile,\r\n DatasetSchema,\r\n TranslationSchema,\r\n Translation,\r\n TranslationBook,\r\n TranslationBookSchema,\r\n TranslationBookChapter,\r\n TranslationBookChapterSchema,\r\n TranslationBookChapterAudioLinks,\r\n CommentarySchema,\r\n} from './common-types.js';\r\nimport { DatasetOutput } from './dataset.js';\r\nimport \"zod-openapi\";\r\n\r\n/**\r\n * Defines the output of the API generation.\r\n */\r\nexport interface ApiOutput {\r\n /**\r\n * The list of available translations.\r\n * This maps to the /api/available-translations.json endpoint.\r\n */\r\n availableTranslations: ApiAvailableTranslations;\r\n\r\n /**\r\n * The list of books for each translation.\r\n * This maps to the /api/:translationId/books.json endpoint.\r\n */\r\n translationBooks: ApiTranslationBooks[];\r\n\r\n /**\r\n * The list of chapters for each book.\r\n * This maps to the following endpoints:\r\n * - /api/:translationId/:bookId/:chapterNumber.json\r\n * - /api/:translationId/:bookCommonName/:chapterNumber.json\r\n */\r\n translationBookChapters: ApiTranslationBookChapter[];\r\n\r\n /**\r\n * The list of audio files.\r\n * This maps to the following endpoints:\r\n * - /api/:translationId/:bookId/:chapterNumber.:reader.mp3\r\n */\r\n translationBookChapterAudio: ApiTranslationBookChapterAudio[];\r\n\r\n /**\r\n * The list of available commentaries.\r\n * This maps to the /api/available-commentaries.json endpoint.\r\n */\r\n availableCommentaries: ApiAvailableCommentaries;\r\n\r\n /**\r\n * The list of books for each commentary.\r\n * This maps to the /api/c/:commentaryId/books.json endpoint.\r\n */\r\n commentaryBooks: ApiCommentaryBooks[];\r\n\r\n /**\r\n * The list of profiles for each commentary.\r\n * This maps to the /api/c/:commentaryId/profiles.json endpoint.\r\n */\r\n commentaryProfiles: ApiCommentaryProfiles[];\r\n\r\n /**\r\n * The list of chapters for each commentary book.\r\n * This maps to the following endpoint:\r\n * - /api/c/:commentaryId/:bookId/:chapterNumber.json\r\n */\r\n commentaryBookChapters: ApiCommentaryBookChapter[];\r\n\r\n /**\r\n * The list of individual profiles for each commentary.\r\n * This maps to the following endpoint:\r\n * - /api/c/:commentaryId/profiles/:profileId.json\r\n */\r\n commentaryProfileContents: ApiCommentaryProfileContent[];\r\n\r\n /**\r\n * The list of available datasets.\r\n * This maps to the /api/available-datasets.json endpoint.\r\n */\r\n availableDatasets?: ApiAvailableDatasets;\r\n\r\n /**\r\n * The list of books for each dataset.\r\n * This maps to the /api/d/:datasetId/books.json endpoint.\r\n */\r\n datasetBooks?: ApiDatasetBooks[];\r\n\r\n /**\r\n * The list of chapters for each dataset book.\r\n * This maps to the following endpoint:\r\n * - /api/d/:datasetId/:bookId/:chapterNumber.json\r\n */\r\n datasetBookChapters?: ApiDatasetBookChapter[];\r\n\r\n /**\r\n * The complete translation data for each translation.\r\n * This maps to the /api/:translationId/complete.json endpoint.\r\n */\r\n translationComplete: ApiTranslationComplete[];\r\n\r\n /**\r\n * The path prefix that the API should use.\r\n */\r\n pathPrefix: string;\r\n}\r\n\r\n/**\r\n * The list of available translations.\r\n * Maps to the /api/available-translations.json endpoint.\r\n */\r\nexport const ApiAvailableTranslationsSchema = z.object({\r\n /**\r\n * The list of translations.\r\n */\r\n translations: z.array(z.lazy(() => ApiTranslationSchema))\r\n .meta({\r\n description: 'The list of translations that are available in the API.',\r\n }),\r\n}).meta({\r\n id: 'ApiAvailableTranslations',\r\n description: 'The list of available translations. Maps to the /api/available-translations.json endpoint.',\r\n});\r\n\r\nexport type ApiAvailableTranslations = z.infer<\r\n typeof ApiAvailableTranslationsSchema\r\n>;\r\n\r\n/**\r\n * The list of available commentaries.\r\n * Maps to the /api/available-commentaries.json endpoint.\r\n */\r\nexport const ApiAvailableCommentariesSchema = z.object({\r\n /**\r\n * The list of commentaries.\r\n */\r\n commentaries: z.array(z.lazy(() => ApiCommentarySchema)).meta({\r\n description: 'The list of commentaries that are available in the API.',\r\n }),\r\n}).meta({\r\n id: 'ApiAvailableCommentaries',\r\n description: 'The list of available commentaries. Maps to the /api/available-commentaries.json endpoint.',\r\n});\r\n\r\nexport type ApiAvailableCommentaries = z.infer<\r\n typeof ApiAvailableCommentariesSchema\r\n>;\r\n\r\n/**\r\n * The list of available datasets.\r\n * Maps to the /api/available-datasets.json endpoint.\r\n */\r\nexport const ApiAvailableDatasetsSchema = z.object({\r\n datasets: z.array(z.lazy(() => ApiDatasetSchema)).meta({\r\n description: 'The list of datasets that are available in the API.',\r\n }),\r\n}).meta({\r\n id: 'ApiAvailableDatasets',\r\n description: 'The list of available datasets. Maps to the /api/available-datasets.json endpoint.',\r\n});\r\n\r\nexport type ApiAvailableDatasets = z.infer<typeof ApiAvailableDatasetsSchema>;\r\n\r\n/**\r\n * Defines a dataset that is used in the API.\r\n */\r\nexport const ApiDatasetSchema = DatasetSchema.extend({\r\n /**\r\n * The API link for the list of books for this dataset.\r\n */\r\n listOfBooksApiLink: z.string().meta({\r\n description: 'The API link for the list of books for this dataset. Relative to the API origin.',\r\n }),\r\n\r\n /**\r\n * The available list of formats.\r\n */\r\n availableFormats: z.array(z.literal('json')),\r\n\r\n /**\r\n * The number of books that are contained in this dataset.\r\n */\r\n numberOfBooks: z.number().meta({\r\n description: 'The number of books that are contained in this dataset.',\r\n }),\r\n\r\n /**\r\n * The total number of chapters that are contained in this dataset.\r\n */\r\n totalNumberOfChapters: z.number().meta({\r\n description: 'The total number of chapters that are contained in this dataset.',\r\n }),\r\n\r\n /**\r\n * The total number of verses that are contained in this dataset.\r\n */\r\n totalNumberOfVerses: z.number().meta({\r\n description: 'The total number of verses that are contained in this dataset.',\r\n }),\r\n\r\n /**\r\n * The total number of references that are contained in this dataset.\r\n */\r\n totalNumberOfReferences: z.number().meta({\r\n description: 'The total number of references that are contained in this dataset.',\r\n }),\r\n\r\n /**\r\n * Gets the name of the language that the commentary is in.\r\n * Null or undefined if the name of the language is not known.\r\n */\r\n languageName: z.string().optional().meta({\r\n description: 'Gets the name of the language that the dataset is in. Null or undefined if the name of the language is not known.',\r\n }),\r\n\r\n /**\r\n * Gets the name of the language in English.\r\n * Null or undefined if the language doesn't have an english name.\r\n */\r\n languageEnglishName: z.string().optional().meta({\r\n description: 'Gets the name of the language in English. Null or undefined if the language doesn\\'t have an english name.',\r\n }),\r\n}).meta({\r\n id: 'ApiDataset',\r\n description: 'Defines a dataset that is used in the API.',\r\n});\r\n\r\nexport type ApiDataset = z.infer<typeof ApiDatasetSchema>;\r\n\r\n/**\r\n * Defines a translation that is used in the API.\r\n */\r\nexport const ApiTranslationSchema = TranslationSchema.extend({\r\n /**\r\n * The API link for the list of available books for this translation.\r\n */\r\n listOfBooksApiLink: z.string().meta({\r\n description: 'The API link for the list of books for this translation. Relative to the API origin.',\r\n }),\r\n\r\n /**\r\n * The available list of formats.\r\n */\r\n availableFormats: z.array(z.enum(['json', 'usfm'])),\r\n\r\n /**\r\n * The number of books that are contained in this translation.\r\n *\r\n * Complete translations should have the same number of books as the Bible (66).\r\n */\r\n numberOfBooks: z.number().meta({\r\n description: 'The number of books that are contained in this translation. Complete translations should have the same number of books as the Bible (66).',\r\n }),\r\n\r\n /**\r\n * The total number of chapters that are contained in this translation.\r\n *\r\n * Complete translations should have the same number of chapters as the Bible (1,189).\r\n */\r\n totalNumberOfChapters: z.number().meta({\r\n description: 'The total number of chapters that are contained in this translation. Complete translations should have the same number of chapters as the Bible (1,189).',\r\n }),\r\n\r\n /**\r\n * The total number of verses that are contained in this translation.\r\n *\r\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).\r\n */\r\n totalNumberOfVerses: z.number().meta({\r\n description: 'The total number of verses that are contained in this translation. 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).',\r\n }),\r\n\r\n /**\r\n * The total number of apocryphal books that are contained in this translation.\r\n */\r\n numberOfApocryphalBooks: z.number().optional().meta({\r\n description: 'The total number of apocryphal books that are contained in this translation.',\r\n }),\r\n\r\n /**\r\n * The total number of apocryphal chapters that are contained in this translation.\r\n */\r\n totalNumberOfApocryphalChapters: z.number().optional().meta({\r\n description: 'The total number of apocryphal chapters that are contained in this translation.',\r\n }),\r\n\r\n /**\r\n * The total number of apocryphal verses that are contained in this translation.\r\n */\r\n totalNumberOfApocryphalVerses: z.number().optional().meta({\r\n description: 'The total number of apocryphal verses that are contained in this translation.',\r\n }),\r\n\r\n /**\r\n * Gets the name of the language that the translation is in.\r\n * Null or undefined if the name of the language is not known.\r\n */\r\n languageName: z.string().optional().meta({\r\n description: 'Gets the name of the language that the translation is in. Null or undefined if the name of the language is not known.',\r\n }),\r\n\r\n /**\r\n * Gets the name of the language in English.\r\n * Null or undefined if the language doesn't have an english name.\r\n */\r\n languageEnglishName: z.string().optional().meta({\r\n description: 'Gets the name of the language in English. Null or undefined if the language doesn\\'t have an english name.',\r\n }),\r\n\r\n /**\r\n * The API link for downloading the complete translation as a single JSON file.\r\n *\r\n * Undefined if complete translation files are not available.\r\n */\r\n completeTranslationApiLink: z.string().optional().meta({\r\n description: 'The API link for downloading the complete translation as a single JSON file. Relative to the API origin. Undefined if complete translation files are not available.',\r\n }),\r\n}).meta({\r\n id: 'ApiTranslation',\r\n description: 'Defines a translation that is used in the API.',\r\n});\r\n\r\nexport type ApiTranslation = z.infer<typeof ApiTranslationSchema>;\r\n\r\n/**\r\n * Defines the complete translation download data.\r\n * Maps to the /api/:translationId/complete.json endpoint.\r\n */\r\nexport const ApiTranslationCompleteSchema = z.object({\r\n /**\r\n * The translation metadata.\r\n */\r\n translation: z.lazy(() => ApiTranslationSchema).meta({\r\n description: 'The translation metadata.',\r\n }),\r\n\r\n /**\r\n * The complete list of books with all their chapters.\r\n */\r\n books: z.array(z.lazy(() => ApiTranslationCompleteBookSchema)).meta({\r\n description: 'The complete list of books with all their chapters.',\r\n }),\r\n}).meta({\r\n id: 'ApiTranslationComplete',\r\n description: 'Defines the complete translation download data. Maps to the /api/:translationId/complete.json endpoint.',\r\n});\r\n\r\nexport type ApiTranslationComplete = z.infer<typeof ApiTranslationCompleteSchema>;\r\n\r\n/**\r\n * A book in the complete translation download.\r\n */\r\nexport const ApiTranslationCompleteBookSchema = TranslationBookSchema.extend({\r\n /**\r\n * The number of chapters in the book.\r\n */\r\n numberOfChapters: z.number().meta({\r\n description: 'The number of chapters in the book.',\r\n }),\r\n\r\n /**\r\n * The total number of verses in the book.\r\n */\r\n totalNumberOfVerses: z.number().meta({\r\n description: 'The total number of verses in the book.',\r\n }),\r\n\r\n /**\r\n * The complete list of chapters with all content.\r\n */\r\n chapters: z.array(TranslationBookChapterSchema).meta({\r\n description: 'The complete list of chapters with all content.',\r\n }),\r\n}).meta({\r\n id: 'ApiTranslationCompleteBook',\r\n description: 'A book in the complete translation download.',\r\n});\r\n\r\nexport type ApiTranslationCompleteBook = z.infer<\r\n typeof ApiTranslationCompleteBookSchema\r\n>;\r\n\r\n/**\r\n * Defines a commentary that is used in the API.\r\n */\r\nexport const ApiCommentarySchema = CommentarySchema.extend({\r\n /**\r\n * The API link for the list of available books for this translation.\r\n */\r\n listOfBooksApiLink: z.string().meta({\r\n description: 'The API link for the list of books for this commentary. Relative to the API origin.',\r\n }),\r\n\r\n /**\r\n * The API link for the list of available profiles for this commentary.\r\n */\r\n listOfProfilesApiLink: z.string().meta({\r\n description: 'The API link for the list of profiles for this commentary. Relative to the API origin.',\r\n }),\r\n\r\n /**\r\n * The available list of formats.\r\n */\r\n availableFormats: z.array(z.enum(['json', 'usfm'])),\r\n\r\n /**\r\n * The number of books that are contained in this commentary.\r\n *\r\n * Complete commentaries should have the same number of books as the Bible (66).\r\n */\r\n numberOfBooks: z.number().meta({\r\n description: 'The number of books that are contained in this commentary. Complete commentaries should have the same number of books as the Bible (66).',\r\n }),\r\n\r\n /**\r\n * The total number of chapters that are contained in this translation.\r\n *\r\n * Complete commentaries should have the same number of chapters as the Bible (1,189).\r\n */\r\n totalNumberOfChapters: z.number().meta({\r\n description: 'The total number of chapters that are contained in this commentary. Complete commentaries should have the same number of chapters as the Bible (1,189).',\r\n }),\r\n\r\n /**\r\n * The total number of verses that are contained in this commentary.\r\n *\r\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).\r\n */\r\n totalNumberOfVerses: z.number().meta({\r\n description: 'The total number of verses that are contained in this commentary. 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).',\r\n }),\r\n\r\n /**\r\n * The total number of profiles that are contained in this commentary.\r\n *\r\n * Profiles are used to provide additional information about people and people groups that are mentioned in the Bible.\r\n */\r\n totalNumberOfProfiles: z.number().meta({\r\n description: 'The total number of profiles that are contained in this commentary. Profiles are used to provide additional information about people and people groups that are mentioned in the Bible.',\r\n }),\r\n\r\n /**\r\n * Gets the name of the language that the commentary is in.\r\n * Null or undefined if the name of the language is not known.\r\n */\r\n languageName: z.string().optional().meta({\r\n description: 'Gets the name of the language that the commentary is in. Null or undefined if the name of the language is not known.',\r\n }),\r\n\r\n /**\r\n * Gets the name of the language in English.\r\n * Null or undefined if the language doesn't have an english name.\r\n */\r\n languageEnglishName: z.string().optional().meta({\r\n description: 'Gets the name of the language in English. Null or undefined if the language doesn\\'t have an english name.',\r\n }),\r\n}).meta({\r\n id: 'ApiCommentary',\r\n description: 'Defines a commentary that is used in the API.',\r\n});\r\n\r\nexport type ApiCommentary = z.infer<typeof ApiCommentarySchema>;\r\n\r\n/**\r\n * Defines an interface that contains information about the books that are available for a translation.\r\n */\r\nexport const ApiTranslationBooksSchema = z.object({\r\n /**\r\n * The translation information for the books.\r\n */\r\n translation: z.lazy(() => ApiTranslationSchema).meta({\r\n description: 'The translation information for the books.',\r\n }),\r\n\r\n /**\r\n * The list of books that are available for the translation.\r\n */\r\n books: z.array(z.lazy(() => ApiTranslationBookSchema)).meta({\r\n description: 'The list of books that are available for the translation.',\r\n }),\r\n}).meta({\r\n id: 'ApiTranslationBooks',\r\n description: 'Defines an interface that contains information about the books that are available for a translation.',\r\n});\r\n\r\nexport type ApiTranslationBooks = z.infer<typeof ApiTranslationBooksSchema>;\r\n\r\n/**\r\n * Defines an interface that contains information about the books that are available for a commentary.\r\n */\r\nexport const ApiCommentaryBooksSchema = z.object({\r\n /**\r\n * The commentary information for the books.\r\n */\r\n commentary: z.lazy(() => ApiCommentarySchema).meta({\r\n description: 'The commentary information for the books.',\r\n }),\r\n\r\n /**\r\n * The list of books that are available for the commentary.\r\n */\r\n books: z.array(z.lazy(() => ApiCommentaryBookSchema)).meta({\r\n description: 'The list of books that are available for the commentary.',\r\n }),\r\n}).meta({\r\n id: 'ApiCommentaryBooks',\r\n description: 'Defines an interface that contains information about the books that are available for a commentary.',\r\n});\r\n\r\nexport type ApiCommentaryBooks = z.infer<typeof ApiCommentaryBooksSchema>;\r\n\r\n/**\r\n * Defines an interface that contains information about the books that are available for a dataset.\r\n */\r\nexport const ApiDatasetBooksSchema = z.object({\r\n /**\r\n * The dataset information for the books.\r\n */\r\n dataset: z.lazy(() => ApiDatasetSchema).meta({\r\n description: 'The dataset information for the books.',\r\n }),\r\n\r\n /**\r\n * The list of books that are available for the dataset.\r\n */\r\n books: z.array(z.lazy(() => ApiDatasetBookSchema)).meta({\r\n description: 'The list of books that are available for the dataset.',\r\n }),\r\n}).meta({\r\n id: 'ApiDatasetBooks',\r\n description: 'Defines an interface that contains information about the books that are available for a dataset.',\r\n});\r\n\r\nexport type ApiDatasetBooks = z.infer<typeof ApiDatasetBooksSchema>;\r\n\r\n/**\r\n * Defines an interface that contains information about the profiles that are available for a commentary.\r\n */\r\nexport const ApiCommentaryProfilesSchema = z.object({\r\n /**\r\n * The commentary information for the books.\r\n */\r\n commentary: z.lazy(() => ApiCommentarySchema).meta({\r\n description: 'The commentary information for the profiles.',\r\n }),\r\n\r\n /**\r\n * The list of profiles that are available for the commentary.\r\n */\r\n profiles: z.array(z.lazy(() => ApiCommentaryProfileSchema)).meta({\r\n description: 'The list of profiles that are available for the commentary.',\r\n }),\r\n}).meta({\r\n id: 'ApiCommentaryProfiles',\r\n description: 'Defines an interface that contains information about the profiles that are available for a commentary.',\r\n});\r\n\r\nexport type ApiCommentaryProfiles = z.infer<typeof ApiCommentaryProfilesSchema>;\r\n\r\n/**\r\n * Defines an interface that contains information about a profile.\r\n */\r\nexport const ApiCommentaryProfileSchema = CommentaryProfileSchema.extend({\r\n /**\r\n * The link to this profile.\r\n */\r\n thisProfileLink: z.string().meta({\r\n description: 'The API link for this profile. Relative to the API origin.',\r\n }),\r\n\r\n /**\r\n * The link to the chapter that this profile references in the commentary.\r\n */\r\n referenceChapterLink: z.string().nullable().meta({\r\n description: 'The API link to the chapter that this profile references in the commentary. Relative to the API origin. Null if the profile doesn\\'t reference a specific chapter.',\r\n }),\r\n}).meta({\r\n id: 'ApiCommentaryProfile',\r\n description: 'Defines an interface that contains information about a profile.',\r\n});\r\n\r\nexport type ApiCommentaryProfile = z.infer<typeof ApiCommentaryProfileSchema>;\r\n\r\n/**\r\n * Defines a translation book that is used in the API.\r\n */\r\nexport const ApiTranslationBookSchema = TranslationBookSchema.extend({\r\n /**\r\n * The number of the first chapter in the book.\r\n */\r\n firstChapterNumber: z.number().meta({\r\n description: 'The number of the first chapter in the book.',\r\n }),\r\n\r\n /**\r\n * The link to the first chapter of the book.\r\n */\r\n firstChapterApiLink: z.string().meta({\r\n description: 'The link to the first chapter of the book.',\r\n }),\r\n\r\n /**\r\n * The number of the last chapter in the book.\r\n */\r\n lastChapterNumber: z.number().meta({\r\n description: 'The number of the last chapter in the book.',\r\n }),\r\n\r\n /**\r\n * The link to the last chapter of the book.\r\n */\r\n lastChapterApiLink: z.string().meta({\r\n description: 'The link to the last chapter of the book.',\r\n }),\r\n\r\n /**\r\n * The number of chapters that the book contains.\r\n */\r\n numberOfChapters: z.number().meta({\r\n description: 'The number of chapters that the book contains.',\r\n }),\r\n\r\n /**\r\n * The number of verses that the book contains.\r\n */\r\n totalNumberOfVerses: z.number().meta({\r\n description: 'The number of verses that the book contains.',\r\n }),\r\n}).meta({\r\n id: 'ApiTranslationBook',\r\n description: 'Defines a schema that contains information about a translation book.',\r\n});\r\n\r\nexport type ApiTranslationBook = z.infer<typeof ApiTranslationBookSchema>;\r\n\r\n/**\r\n * Defines a commentary book that is used in the API.\r\n */\r\nexport const ApiCommentaryBookSchema = CommentaryBookSchema.extend({\r\n /**\r\n * The number of the first chapter in the book.\r\n *\r\n * Null if the comentary book has no chapters.\r\n */\r\n firstChapterNumber: z.number().nullable().meta({\r\n description: 'The number of the first chapter in the book. Null if the comentary book has no chapters.',\r\n }),\r\n\r\n /**\r\n * The link to the first chapter of the book.\r\n *\r\n * Null if the comentary book has no chapters.\r\n */\r\n firstChapterApiLink: z.string().nullable().meta({\r\n description: 'The link to the first chapter of the book. Null if the comentary book has no chapters.',\r\n }),\r\n\r\n /**\r\n * The number of the last chapter in the book.\r\n *\r\n * Null if the comentary book has no chapters.\r\n */\r\n lastChapterNumber: z.number().nullable().meta({\r\n description: 'The number of the last chapter in the book. Null if the comentary book has no chapters.',\r\n }),\r\n\r\n /**\r\n * The link to the last chapter of the book.\r\n *\r\n * Null if the comentary book has no chapters.\r\n */\r\n lastChapterApiLink: z.string().nullable().meta({\r\n description: 'The link to the last chapter of the book. Null if the comentary book has no chapters.',\r\n }),\r\n\r\n /**\r\n * The number of chapters that the book contains.\r\n */\r\n numberOfChapters: z.number().meta({\r\n description: 'The number of chapters that the book contains.',\r\n }),\r\n\r\n /**\r\n * The number of verses that the book contains.\r\n */\r\n totalNumberOfVerses: z.number().meta({\r\n description: 'The number of verses that the book contains.',\r\n }),\r\n}).meta({\r\n id: 'ApiCommentaryBook',\r\n description: 'Defines a schema that contains information about a commentary book.',\r\n});\r\n\r\nexport type ApiCommentaryBook = z.infer<typeof ApiCommentaryBookSchema>;\r\n\r\n/**\r\n * Defines an interface that contains information about a book in a dataset.\r\n */\r\nexport const ApiDatasetBookSchema = DatasetBookSchema.extend({\r\n /**\r\n * The number of the first chapter in the book.\r\n */\r\n firstChapterNumber: z.number().meta({\r\n description: 'The number of the first chapter in the book.',\r\n }),\r\n\r\n /**\r\n * The link to the first chapter of the book.\r\n */\r\n firstChapterApiLink: z.string().meta({\r\n description: 'The link to the first chapter of the book.',\r\n }),\r\n\r\n /**\r\n * The number of the last chapter in the book.\r\n */\r\n lastChapterNumber: z.number().meta({\r\n description: 'The number of the last chapter in the book.',\r\n }),\r\n\r\n /**\r\n * The link to the last chapter of the book.\r\n */\r\n lastChapterApiLink: z.string().meta({\r\n description: 'The link to the last chapter of the book.',\r\n }),\r\n\r\n /**\r\n * The number of chapters that the book contains.\r\n */\r\n numberOfChapters: z.number().meta({\r\n description: 'The number of chapters that the book contains.',\r\n }),\r\n\r\n /**\r\n * The number of verses that the book contains.\r\n */\r\n totalNumberOfVerses: z.number().meta({\r\n description: 'The number of verses that the book contains.',\r\n }),\r\n\r\n /**\r\n * The number of references that the book contains.\r\n */\r\n totalNumberOfReferences: z.number().meta({\r\n description: 'The number of references that the book contains.',\r\n }),\r\n}).meta({\r\n id: 'ApiDatasetBook',\r\n description: 'Defines a schema that contains information about a book in a dataset.',\r\n});\r\n\r\nexport type ApiDatasetBook = z.infer<typeof ApiDatasetBookSchema>;\r\n\r\n/**\r\n * Defines an interface that contains information about a book chapter.\r\n */\r\nexport const ApiTranslationBookChapterSchema = TranslationBookChapterSchema.extend({\r\n /**\r\n * The translation information for the book chapter.\r\n */\r\n translation: z.lazy(() => ApiTranslationSchema).meta({\r\n description: 'The translation information for the book chapter.',\r\n }),\r\n\r\n /**\r\n * The book information for the book chapter.\r\n */\r\n book: z.lazy(() => ApiTranslationBookSchema).meta({\r\n description: 'The book information for the book chapter.',\r\n }),\r\n\r\n /**\r\n * The link to this chapter.\r\n */\r\n thisChapterLink: z.string().meta({\r\n description: 'The API link for this chapter. Relative to the API origin.',\r\n }),\r\n\r\n /**\r\n * The link to the next chapter.\r\n * Null if this is the last chapter in the translation.\r\n */\r\n nextChapterApiLink: z.string().nullable().meta({\r\n description: 'The API link to the next chapter. Relative to the API origin. Null if this is the last chapter in the translation.',\r\n }),\r\n\r\n /**\r\n * The links to the audio versions for the next chapter.\r\n * Null if this is the last chapter in the translation.\r\n */\r\n nextChapterAudioLinks: z.record(z.string(), z.string()).nullable().meta({\r\n description: 'The links to the audio versions for the next chapter. Relative to the API origin. Null if this is the last chapter in the translation.',\r\n }),\r\n\r\n /**\r\n * The link to the previous chapter.\r\n * Null if this is the first chapter in the translation.\r\n */\r\n previousChapterApiLink: z.string().nullable().meta({\r\n description: 'The API link to the previous chapter. Relative to the API origin. Null if this is the first chapter in the translation.',\r\n }),\r\n\r\n /**\r\n * The links to the audio versions for the previous chapter.\r\n * Null if this is the first chapter in the translation.\r\n */\r\n previousChapterAudioLinks: z.record(z.string(), z.string()).nullable().meta({\r\n description: 'The links to the audio versions for the previous chapter. Relative to the API origin. Null if this is the first chapter in the translation.',\r\n }),\r\n\r\n /**\r\n * The number of verses that the chapter contains.\r\n */\r\n numberOfVerses: z.number().meta({\r\n description: 'The number of verses that the chapter contains.',\r\n }),\r\n}).meta({\r\n id: 'ApiTranslationBookChapter',\r\n description: 'Defines an interface that contains information about a book chapter in a translation.',\r\n});\r\n\r\nexport type ApiTranslationBookChapter = z.infer<\r\n typeof ApiTranslationBookChapterSchema\r\n>;\r\n\r\n/**\r\n * Defines an interface that contains information about a book chapter.\r\n */\r\nexport const ApiCommentaryBookChapterSchema = CommentaryBookChapterSchema.extend({\r\n /**\r\n * The commentary information for the book chapter.\r\n */\r\n commentary: z.lazy(() => ApiCommentarySchema).meta({\r\n description: 'The commentary information for the book chapter.',\r\n }),\r\n\r\n /**\r\n * The book information for the book chapter.\r\n */\r\n book: z.lazy(() => ApiCommentaryBookSchema).meta({\r\n description: 'The book information for the book chapter.',\r\n }),\r\n\r\n /**\r\n * The link to this chapter.\r\n */\r\n thisChapterLink: z.string().meta({\r\n description: 'The API link for this chapter. Relative to the API origin.',\r\n }),\r\n\r\n /**\r\n * The link to the next chapter.\r\n * Null if this is the last chapter in the translation.\r\n */\r\n nextChapterApiLink: z.string().nullable().meta({\r\n description: 'The API link to the next chapter. Relative to the API origin. Null if this is the last chapter in the commentary.',\r\n }),\r\n\r\n /**\r\n * The link to the previous chapter.\r\n * Null if this is the first chapter in the translation.\r\n */\r\n previousChapterApiLink: z.string().nullable().meta({\r\n description: 'The API link to the previous chapter. Relative to the API origin. Null if this is the first chapter in the commentary.',\r\n }),\r\n\r\n /**\r\n * The number of verses that the chapter contains.\r\n */\r\n numberOfVerses: z.number().meta({\r\n description: 'The number of verses that the chapter contains.',\r\n }),\r\n}).meta({\r\n id: 'ApiCommentaryBookChapter',\r\n description: 'Defines a schema that contains information about a book chapter in a commentary.',\r\n});\r\n\r\nexport type ApiCommentaryBookChapter = z.infer<\r\n typeof ApiCommentaryBookChapterSchema\r\n>;\r\n\r\n/**\r\n * Defines an interface that contains information about a book chapter.\r\n */\r\nexport const ApiDatasetBookChapterSchema = DatasetBookChapterSchema.extend({\r\n /**\r\n * The dataset information for the book chapter.\r\n */\r\n dataset: z.lazy(() => ApiDatasetSchema).meta({\r\n description: 'The dataset information for the book chapter.',\r\n }),\r\n\r\n /**\r\n * The book information for the book chapter.\r\n */\r\n book: z.lazy(() => ApiDatasetBookSchema).meta({\r\n description: 'The book information for the book chapter.',\r\n }),\r\n\r\n /**\r\n * The link to this chapter.\r\n */\r\n thisChapterLink: z.string().meta({\r\n description: 'The API link for this chapter. Relative to the API origin.',\r\n }),\r\n\r\n /**\r\n * The link to the next chapter.\r\n * Null if this is the last chapter in the translation.\r\n */\r\n nextChapterApiLink: z.string().nullable().meta({\r\n description: 'The API link to the next chapter. Relative to the API origin. Null if this is the last chapter in the dataset.',\r\n }),\r\n\r\n /**\r\n * The link to the previous chapter.\r\n * Null if this is the first chapter in the translation.\r\n */\r\n previousChapterApiLink: z.string().nullable().meta({\r\n description: 'The API link to the previous chapter. Relative to the API origin. Null if this is the first chapter in the dataset.',\r\n }),\r\n\r\n /**\r\n * The number of verses that the chapter contains.\r\n */\r\n numberOfVerses: z.number().meta({\r\n description: 'The number of verses that the chapter contains.',\r\n }),\r\n\r\n /**\r\n * The number of references that the chapter contains.\r\n */\r\n numberOfReferences: z.number().meta({\r\n description: 'The number of references that the chapter contains.',\r\n }),\r\n}).meta({\r\n id: 'ApiDatasetBookChapter',\r\n description: 'Defines a schema that contains information about a book chapter in a dataset.',\r\n});\r\n\r\nexport type ApiDatasetBookChapter = z.infer<typeof ApiDatasetBookChapterSchema>;\r\n\r\nexport const ApiTranslationBookChapterAudioSchema = z.object({\r\n /**\r\n * The chapter that the audio is for.\r\n */\r\n chapter: z.lazy(() => ApiTranslationBookChapterSchema).meta({\r\n description: 'The chapter that the audio is for.',\r\n }),\r\n\r\n /**\r\n * The link that the audio should be placed at.\r\n */\r\n link: z.string().meta({\r\n description: 'The link that the audio should be placed at. Relative to the API origin.',\r\n }),\r\n\r\n /**\r\n * The original URL of the audio.\r\n */\r\n originalUrl: z.string().meta({\r\n description: 'The original URL of the audio.',\r\n }),\r\n});\r\n\r\nexport type ApiTranslationBookChapterAudio = z.infer<\r\n typeof ApiTranslationBookChapterAudioSchema\r\n>;\r\n\r\nexport const ApiCommentaryProfileContentSchema = z.object({\r\n /**\r\n * The commentary information for the profile.\r\n */\r\n commentary: z.lazy(() => ApiCommentarySchema).meta({\r\n description: 'The commentary information for the profile.',\r\n }),\r\n\r\n /**\r\n * The information about the profile.\r\n */\r\n profile: z.lazy(() => ApiCommentaryProfileSchema).meta({\r\n description: 'The information about the profile.',\r\n }),\r\n\r\n /**\r\n * The content of the profile.\r\n */\r\n content: z.array(z.string()).meta({\r\n description: 'The content of the profile. This is an array of strings, where each string is a paragraph of the profile content.',\r\n }),\r\n});\r\n\r\nexport type ApiCommentaryProfileContent = z.infer<\r\n typeof ApiCommentaryProfileContentSchema\r\n>;\r\n\r\n/**\r\n * The options for generating the API.\r\n */\r\nexport interface GenerateApiOptions {\r\n /**\r\n * Whether to use the common name for the book chapter API link. If false, then book IDs are used.\r\n * Audio URLs will always use the book ID.\r\n * Defaults to false.\r\n */\r\n useCommonName?: boolean;\r\n\r\n /**\r\n * Whether to replace the audio URLs in the dataset with ones that are hosted locally.\r\n * If true, then the audio URLs in the dataset will be replaced with ones that reference files hosted by the API itself.\r\n * If false, then the audio URLs in the dataset will be left as is.\r\n * Defaults to false.\r\n */\r\n generateAudioFiles?: boolean;\r\n\r\n /**\r\n * Gets the english name of the given language.\r\n * If not provided, then the english name for the language will be unknown and omitted.\r\n * @param language The language to get the english name for.\r\n */\r\n getEnglishName?: (language: string) => string | null | undefined;\r\n\r\n /**\r\n * Gets the native name of the given language.\r\n * If not provided, then the native name for the language will be unknown and omitted.\r\n * @param language The language to get the native name for.\r\n */\r\n getNativeName?: (language: string) => string | null | undefined;\r\n\r\n /**\r\n * The prefix that should be added to paths that are generated.\r\n */\r\n pathPrefix?: string;\r\n\r\n /**\r\n * Whether to generate complete translation files for each translation.\r\n */\r\n generateCompleteTranslationFiles?: boolean;\r\n}\r\n\r\n/**\r\n * Generates the API output for the given dataset.\r\n * @param dataset The dataset to generate the API for.\r\n * @param options The options for generating the API.\r\n */\r\nexport function generateApiForDataset(\r\n dataset: DatasetOutput,\r\n options: GenerateApiOptions = {}\r\n): ApiOutput {\r\n const { useCommonName, pathPrefix } = options;\r\n const apiPathPrefix = pathPrefix ? pathPrefix : '';\r\n let api: ApiOutput = {\r\n availableTranslations: {\r\n translations: [],\r\n },\r\n translationBooks: [],\r\n translationBookChapters: [],\r\n translationBookChapterAudio: [],\r\n translationComplete: [],\r\n availableCommentaries: {\r\n commentaries: [],\r\n },\r\n commentaryBookChapters: [],\r\n commentaryBooks: [],\r\n commentaryProfiles: [],\r\n commentaryProfileContents: [],\r\n pathPrefix: apiPathPrefix,\r\n };\r\n\r\n const getNativeName = options.getNativeName;\r\n const getEnglishName = options.getEnglishName;\r\n\r\n for (let { books, ...translation } of dataset.translations) {\r\n let numberOfBooks = 0;\r\n let numberOfApocryphalBooks = 0;\r\n\r\n for (let book of books) {\r\n if (book.isApocryphal) {\r\n numberOfApocryphalBooks++;\r\n } else {\r\n numberOfBooks++;\r\n }\r\n }\r\n\r\n const apiTranslation: ApiTranslation = {\r\n ...translation,\r\n availableFormats: ['json'],\r\n listOfBooksApiLink: listOfBooksApiLink(\r\n translation.id,\r\n apiPathPrefix\r\n ),\r\n completeTranslationApiLink: options.generateCompleteTranslationFiles\r\n ? completeTranslationApiLink(translation.id, apiPathPrefix)\r\n : undefined,\r\n numberOfBooks,\r\n totalNumberOfChapters: 0,\r\n totalNumberOfVerses: 0,\r\n languageName: getNativeName\r\n ? (getNativeName(translation.language) ?? undefined)\r\n : undefined,\r\n languageEnglishName: getEnglishName\r\n ? (getEnglishName(translation.language) ?? undefined)\r\n : undefined,\r\n };\r\n\r\n if (numberOfApocryphalBooks > 0) {\r\n apiTranslation.numberOfApocryphalBooks = numberOfApocryphalBooks;\r\n }\r\n\r\n const translationBooks: ApiTranslationBooks = {\r\n translation: apiTranslation,\r\n books: [],\r\n };\r\n\r\n let translationChapters: ApiTranslationBookChapter[] = [];\r\n\r\n for (let { chapters, ...book } of books) {\r\n const firstChapterNumber = chapters[0]?.chapter.number;\r\n const lastChapterNumber =\r\n chapters[chapters.length - 1]?.chapter.number;\r\n const apiBook: ApiTranslationBook = {\r\n ...book,\r\n firstChapterNumber,\r\n firstChapterApiLink: bookChapterApiLink(\r\n translation.id,\r\n getBookLink(book),\r\n firstChapterNumber,\r\n 'json',\r\n apiPathPrefix\r\n ),\r\n lastChapterNumber,\r\n lastChapterApiLink: bookChapterApiLink(\r\n translation.id,\r\n getBookLink(book),\r\n lastChapterNumber,\r\n 'json',\r\n apiPathPrefix\r\n ),\r\n numberOfChapters: chapters.length,\r\n totalNumberOfVerses: 0,\r\n };\r\n\r\n for (let { chapter, thisChapterAudioLinks } of chapters) {\r\n const audio: TranslationBookChapterAudioLinks = {};\r\n const apiBookChapter: ApiTranslationBookChapter = {\r\n translation: apiTranslation,\r\n book: apiBook,\r\n chapter: chapter,\r\n thisChapterLink: bookChapterApiLink(\r\n translation.id,\r\n getBookLink(book),\r\n chapter.number,\r\n 'json',\r\n apiPathPrefix\r\n ),\r\n thisChapterAudioLinks: audio,\r\n nextChapterApiLink: null,\r\n nextChapterAudioLinks: null,\r\n previousChapterApiLink: null,\r\n previousChapterAudioLinks: null,\r\n numberOfVerses: 0,\r\n };\r\n\r\n for (let reader in thisChapterAudioLinks) {\r\n if (options.generateAudioFiles) {\r\n const apiAudio: ApiTranslationBookChapterAudio = {\r\n chapter: apiBookChapter,\r\n link: bookChapterAudioApiLink(\r\n translation.id,\r\n getBookLink(book),\r\n chapter.number,\r\n reader,\r\n apiPathPrefix\r\n ),\r\n originalUrl: thisChapterAudioLinks[reader],\r\n };\r\n audio[reader] = apiAudio.link;\r\n api.translationBookChapterAudio.push(apiAudio);\r\n } else {\r\n audio[reader] = thisChapterAudioLinks[reader];\r\n }\r\n }\r\n\r\n for (let c of chapter.content) {\r\n if (c.type === 'verse') {\r\n apiBookChapter.numberOfVerses++;\r\n }\r\n }\r\n\r\n apiBook.totalNumberOfVerses += apiBookChapter.numberOfVerses;\r\n\r\n translationChapters.push(apiBookChapter);\r\n api.translationBookChapters.push(apiBookChapter);\r\n }\r\n\r\n translationBooks.books.push(apiBook);\r\n\r\n if (apiBook.isApocryphal) {\r\n if (!apiTranslation.totalNumberOfApocryphalChapters) {\r\n apiTranslation.totalNumberOfApocryphalChapters = 0;\r\n }\r\n if (!apiTranslation.totalNumberOfApocryphalVerses) {\r\n apiTranslation.totalNumberOfApocryphalVerses = 0;\r\n }\r\n apiTranslation.totalNumberOfApocryphalChapters +=\r\n apiBook.numberOfChapters;\r\n apiTranslation.totalNumberOfApocryphalVerses +=\r\n apiBook.totalNumberOfVerses;\r\n } else {\r\n apiTranslation.totalNumberOfChapters +=\r\n apiBook.numberOfChapters;\r\n apiTranslation.totalNumberOfVerses +=\r\n apiBook.totalNumberOfVerses;\r\n }\r\n }\r\n\r\n for (let i = 0; i < translationChapters.length; i++) {\r\n if (i > 0) {\r\n translationChapters[i].previousChapterApiLink =\r\n bookChapterApiLink(\r\n translation.id,\r\n getBookLink(translationChapters[i - 1].book),\r\n translationChapters[i - 1].chapter.number,\r\n 'json',\r\n apiPathPrefix\r\n );\r\n translationChapters[i].previousChapterAudioLinks =\r\n translationChapters[i - 1].thisChapterAudioLinks;\r\n }\r\n\r\n if (i < translationChapters.length - 1) {\r\n translationChapters[i].nextChapterApiLink = bookChapterApiLink(\r\n translation.id,\r\n getBookLink(translationChapters[i + 1].book),\r\n translationChapters[i + 1].chapter.number,\r\n 'json',\r\n apiPathPrefix\r\n );\r\n translationChapters[i].nextChapterAudioLinks =\r\n translationChapters[i + 1].thisChapterAudioLinks;\r\n }\r\n }\r\n\r\n api.availableTranslations.translations.push(apiTranslation);\r\n api.translationBooks.push(translationBooks);\r\n\r\n if (options.generateCompleteTranslationFiles) {\r\n // Build the complete translation data for download\r\n const completeTranslation: ApiTranslationComplete = {\r\n translation: apiTranslation,\r\n books: translationBooks.books.map((book) => {\r\n const bookChapters = translationChapters.filter(\r\n (ch) => ch.book.id === book.id\r\n );\r\n return {\r\n id: book.id,\r\n name: book.name,\r\n commonName: book.commonName,\r\n title: book.title,\r\n order: book.order,\r\n numberOfChapters: book.numberOfChapters,\r\n totalNumberOfVerses: book.totalNumberOfVerses,\r\n isApocryphal: book.isApocryphal,\r\n chapters: bookChapters.map((ch) => ({\r\n numberOfVerses: ch.numberOfVerses,\r\n thisChapterAudioLinks: ch.thisChapterAudioLinks,\r\n chapter: ch.chapter,\r\n })),\r\n };\r\n }),\r\n };\r\n api.translationComplete.push(completeTranslation);\r\n }\r\n }\r\n\r\n for (let { books, profiles, ...commentary } of dataset.commentaries) {\r\n const apiCommentary: ApiCommentary = {\r\n ...commentary,\r\n availableFormats: ['json'],\r\n listOfBooksApiLink: listOfCommentaryBooksApiLink(\r\n commentary.id,\r\n apiPathPrefix\r\n ),\r\n listOfProfilesApiLink: profilesCommentaryApiLink(\r\n commentary.id,\r\n 'json',\r\n apiPathPrefix\r\n ),\r\n numberOfBooks: books.length,\r\n totalNumberOfChapters: 0,\r\n totalNumberOfVerses: 0,\r\n totalNumberOfProfiles: 0,\r\n languageName: getNativeName\r\n ? (getNativeName(commentary.language) ?? undefined)\r\n : undefined,\r\n languageEnglishName: getEnglishName\r\n ? (getEnglishName(commentary.language) ?? undefined)\r\n : undefined,\r\n };\r\n\r\n const commentaryBooks: ApiCommentaryBooks = {\r\n commentary: apiCommentary,\r\n books: [],\r\n };\r\n\r\n const commentaryProfiles: ApiCommentaryProfiles = {\r\n commentary: apiCommentary,\r\n profiles: [],\r\n };\r\n\r\n let commentaryChapters: ApiCommentaryBookChapter[] = [];\r\n\r\n for (let { chapters, ...book } of books) {\r\n const firstChapterNumber = chapters[0]?.chapter.number ?? null;\r\n const lastChapterNumber =\r\n chapters[chapters.length - 1]?.chapter.number ?? null;\r\n const apiBook: ApiCommentaryBook = {\r\n ...book,\r\n firstChapterNumber,\r\n firstChapterApiLink: firstChapterNumber\r\n ? bookCommentaryChapterApiLink(\r\n commentary.id,\r\n getBookLink(book),\r\n firstChapterNumber,\r\n 'json',\r\n apiPathPrefix\r\n )\r\n : null,\r\n lastChapterNumber,\r\n lastChapterApiLink: lastChapterNumber\r\n ? bookCommentaryChapterApiLink(\r\n commentary.id,\r\n getBookLink(book),\r\n lastChapterNumber,\r\n 'json',\r\n apiPathPrefix\r\n )\r\n : null,\r\n numberOfChapters: chapters.length,\r\n totalNumberOfVerses: 0,\r\n };\r\n\r\n for (let { chapter } of chapters) {\r\n const apiBookChapter: ApiCommentaryBookChapter = {\r\n commentary: apiCommentary,\r\n book: apiBook,\r\n chapter: chapter,\r\n thisChapterLink: bookCommentaryChapterApiLink(\r\n commentary.id,\r\n getBookLink(book),\r\n chapter.number,\r\n 'json',\r\n apiPathPrefix\r\n ),\r\n nextChapterApiLink: null,\r\n previousChapterApiLink: null,\r\n numberOfVerses: 0,\r\n };\r\n\r\n for (let c of chapter.content) {\r\n if (c.type === 'verse') {\r\n apiBookChapter.numberOfVerses++;\r\n }\r\n }\r\n\r\n apiBook.totalNumberOfVerses += apiBookChapter.numberOfVerses;\r\n\r\n commentaryChapters.push(apiBookChapter);\r\n api.commentaryBookChapters.push(apiBookChapter);\r\n }\r\n\r\n commentaryBooks.books.push(apiBook);\r\n\r\n apiCommentary.totalNumberOfChapters += apiBook.numberOfChapters;\r\n apiCommentary.totalNumberOfVerses += apiBook.totalNumberOfVerses;\r\n }\r\n\r\n if (profiles) {\r\n for (let profile of profiles) {\r\n const apiProfile: ApiCommentaryProfile = {\r\n id: profile.id,\r\n reference: profile.reference,\r\n subject: profile.subject,\r\n thisProfileLink: profileCommentaryApiLink(\r\n commentary.id,\r\n profile.id,\r\n 'json',\r\n apiPathPrefix\r\n ),\r\n referenceChapterLink: profile.reference\r\n ? bookCommentaryChapterApiLink(\r\n commentary.id,\r\n profile.reference.book,\r\n profile.reference.chapter,\r\n 'json',\r\n apiPathPrefix\r\n )\r\n : null,\r\n };\r\n\r\n const apiProfileContent: ApiCommentaryProfileContent = {\r\n commentary: apiCommentary,\r\n profile: apiProfile,\r\n content: profile.content,\r\n };\r\n\r\n apiCommentary.totalNumberOfProfiles += 1;\r\n commentaryProfiles.profiles.push(apiProfile);\r\n api.commentaryProfileContents.push(apiProfileContent);\r\n }\r\n }\r\n\r\n for (let i = 0; i < commentaryChapters.length; i++) {\r\n if (i > 0) {\r\n commentaryChapters[i].previousChapterApiLink =\r\n bookCommentaryChapterApiLink(\r\n commentary.id,\r\n getBookLink(commentaryChapters[i - 1].book),\r\n commentaryChapters[i - 1].chapter.number,\r\n 'json',\r\n apiPathPrefix\r\n );\r\n // commentaryChapters[i].previousChapterAudioLinks =\r\n // commentaryChapters[i - 1].thisChapterAudioLinks;\r\n }\r\n\r\n if (i < commentaryChapters.length - 1) {\r\n commentaryChapters[i].nextChapterApiLink =\r\n bookCommentaryChapterApiLink(\r\n commentary.id,\r\n getBookLink(commentaryChapters[i + 1].book),\r\n commentaryChapters[i + 1].chapter.number,\r\n 'json',\r\n apiPathPrefix\r\n );\r\n // commentaryChapters[i].nextChapterAudioLinks =\r\n // commentaryChapters[i + 1].thisChapterAudioLinks;\r\n }\r\n }\r\n\r\n api.availableCommentaries.commentaries.push(apiCommentary);\r\n api.commentaryBooks.push(commentaryBooks);\r\n api.commentaryProfiles.push(commentaryProfiles);\r\n }\r\n\r\n for (let { books, ...datasetInfo } of dataset.datasets ?? []) {\r\n const apiDataset: ApiDataset = {\r\n ...datasetInfo,\r\n availableFormats: ['json'],\r\n listOfBooksApiLink: listOfDatasetBooksApiLink(\r\n datasetInfo.id,\r\n apiPathPrefix\r\n ),\r\n numberOfBooks: books.length,\r\n totalNumberOfChapters: 0,\r\n totalNumberOfVerses: 0,\r\n totalNumberOfReferences: 0,\r\n languageName: getNativeName\r\n ? (getNativeName(datasetInfo.language) ?? undefined)\r\n : undefined,\r\n languageEnglishName: getEnglishName\r\n ? (getEnglishName(datasetInfo.language) ?? undefined)\r\n : undefined,\r\n };\r\n\r\n const datasetBooks: ApiDatasetBooks = {\r\n dataset: apiDataset,\r\n books: [],\r\n };\r\n\r\n let datasetChapters: ApiDatasetBookChapter[] = [];\r\n\r\n for (let { chapters, ...book } of books) {\r\n const firstChapterNumber = chapters[0]?.chapter.number ?? null;\r\n const lastChapterNumber =\r\n chapters[chapters.length - 1]?.chapter.number ?? null;\r\n const apiBook: ApiDatasetBook = {\r\n ...book,\r\n firstChapterNumber,\r\n firstChapterApiLink: bookDatasetChapterApiLink(\r\n datasetInfo.id,\r\n book.id,\r\n firstChapterNumber,\r\n 'json',\r\n apiPathPrefix\r\n ),\r\n lastChapterNumber,\r\n lastChapterApiLink: bookDatasetChapterApiLink(\r\n datasetInfo.id,\r\n book.id,\r\n lastChapterNumber,\r\n 'json',\r\n apiPathPrefix\r\n ),\r\n numberOfChapters: chapters.length,\r\n totalNumberOfVerses: 0,\r\n totalNumberOfReferences: 0,\r\n };\r\n\r\n for (let { chapter } of chapters) {\r\n const apiBookChapter: ApiDatasetBookChapter = {\r\n dataset: apiDataset,\r\n book: apiBook,\r\n chapter: chapter,\r\n thisChapterLink: bookDatasetChapterApiLink(\r\n datasetInfo.id,\r\n book.id,\r\n chapter.number,\r\n 'json',\r\n apiPathPrefix\r\n ),\r\n nextChapterApiLink: null,\r\n previousChapterApiLink: null,\r\n numberOfVerses: chapter.content.length,\r\n numberOfReferences: 0,\r\n };\r\n\r\n // apiBookChapter.numberOfVerses += ;\r\n for (let verse of chapter.content) {\r\n apiBookChapter.numberOfReferences +=\r\n verse.references.length;\r\n }\r\n\r\n apiBook.totalNumberOfVerses += apiBookChapter.numberOfVerses;\r\n apiBook.totalNumberOfReferences +=\r\n apiBookChapter.numberOfReferences;\r\n\r\n datasetChapters.push(apiBookChapter);\r\n if (!api.datasetBookChapters) {\r\n api.datasetBookChapters = [];\r\n }\r\n api.datasetBookChapters.push(apiBookChapter);\r\n }\r\n\r\n datasetBooks.books.push(apiBook);\r\n\r\n apiDataset.totalNumberOfChapters += apiBook.numberOfChapters;\r\n apiDataset.totalNumberOfVerses += apiBook.totalNumberOfVerses;\r\n apiDataset.totalNumberOfReferences +=\r\n apiBook.totalNumberOfReferences;\r\n }\r\n\r\n for (let i = 0; i < datasetChapters.length; i++) {\r\n if (i > 0) {\r\n datasetChapters[i].previousChapterApiLink =\r\n bookDatasetChapterApiLink(\r\n datasetInfo.id,\r\n datasetChapters[i - 1].book.id,\r\n datasetChapters[i - 1].chapter.number,\r\n 'json',\r\n apiPathPrefix\r\n );\r\n }\r\n\r\n if (i < datasetChapters.length - 1) {\r\n datasetChapters[i].nextChapterApiLink =\r\n bookDatasetChapterApiLink(\r\n datasetInfo.id,\r\n datasetChapters[i + 1].book.id,\r\n datasetChapters[i + 1].chapter.number,\r\n 'json',\r\n apiPathPrefix\r\n );\r\n }\r\n }\r\n\r\n if (!api.availableDatasets) {\r\n api.availableDatasets = {\r\n datasets: [],\r\n };\r\n }\r\n api.availableDatasets.datasets.push(apiDataset);\r\n if (!api.datasetBooks) {\r\n api.datasetBooks = [];\r\n }\r\n api.datasetBooks.push(datasetBooks);\r\n }\r\n\r\n return api;\r\n\r\n function getBookLink(book: TranslationBook | CommentaryBook): string {\r\n return useCommonName ? book.commonName : book.id;\r\n }\r\n}\r\n\r\n/**\r\n * Generates the output files for the given API.\r\n * @param api The API that the files should be generated for.\r\n */\r\nexport function generateFilesForApi(api: ApiOutput): OutputFile[] {\r\n let files: OutputFile[] = [];\r\n\r\n files.push(\r\n jsonFile(\r\n `${api.pathPrefix}/api/available_translations.json`,\r\n api.availableTranslations,\r\n true\r\n )\r\n );\r\n for (let translationBooks of api.translationBooks) {\r\n files.push(\r\n jsonFile(\r\n translationBooks.translation.listOfBooksApiLink,\r\n translationBooks\r\n )\r\n );\r\n }\r\n\r\n for (let bookChapter of api.translationBookChapters) {\r\n files.push(jsonFile(bookChapter.thisChapterLink, bookChapter));\r\n }\r\n\r\n for (let audio of api.translationBookChapterAudio) {\r\n files.push(downloadedFile(audio.link, audio.originalUrl));\r\n }\r\n\r\n // Generate complete translation download files\r\n for (let complete of api.translationComplete) {\r\n if (complete.translation.completeTranslationApiLink) {\r\n files.push(\r\n jsonFile(\r\n complete.translation.completeTranslationApiLink,\r\n complete\r\n )\r\n );\r\n }\r\n }\r\n\r\n files.push(\r\n jsonFile(\r\n `${api.pathPrefix}/api/available_commentaries.json`,\r\n api.availableCommentaries,\r\n true\r\n )\r\n );\r\n for (let commentaryBooks of api.commentaryBooks) {\r\n files.push(\r\n jsonFile(\r\n commentaryBooks.commentary.listOfBooksApiLink,\r\n commentaryBooks\r\n )\r\n );\r\n }\r\n\r\n for (let commentaryProfiles of api.commentaryProfiles) {\r\n files.push(\r\n jsonFile(\r\n commentaryProfiles.commentary.listOfProfilesApiLink,\r\n commentaryProfiles\r\n )\r\n );\r\n }\r\n\r\n for (let profileContent of api.commentaryProfileContents) {\r\n files.push(\r\n jsonFile(profileContent.profile.thisProfileLink, profileContent)\r\n );\r\n }\r\n\r\n for (let bookChapter of api.commentaryBookChapters) {\r\n files.push(jsonFile(bookChapter.thisChapterLink, bookChapter));\r\n }\r\n\r\n if (api.availableDatasets) {\r\n files.push(\r\n jsonFile(\r\n `${api.pathPrefix}/api/available_datasets.json`,\r\n api.availableDatasets,\r\n true\r\n )\r\n );\r\n }\r\n\r\n if (api.datasetBooks) {\r\n for (let datasetBook of api.datasetBooks) {\r\n files.push(\r\n jsonFile(datasetBook.dataset.listOfBooksApiLink, datasetBook)\r\n );\r\n }\r\n }\r\n\r\n if (api.datasetBookChapters) {\r\n for (let datasetBookChapter of api.datasetBookChapters) {\r\n files.push(\r\n jsonFile(datasetBookChapter.thisChapterLink, datasetBookChapter)\r\n );\r\n }\r\n }\r\n\r\n // for (let audio of api.translationBookChapterAudio) {\r\n // files.push(downloadedFile(audio.link, audio.originalUrl));\r\n // }\r\n\r\n return files;\r\n}\r\n\r\n/**\r\n * Generates the output files for the given datasets.\r\n * @param datasets The datasets to generate the output files for.\r\n * @param options The options for generating the API files.\r\n */\r\nexport async function* generateOutputFilesFromDatasets(\r\n datasets: AsyncIterable<DatasetOutput>,\r\n options?: GenerateApiOptions\r\n): AsyncGenerator<OutputFile[]> {\r\n for await (let dataset of datasets) {\r\n const api = generateApiForDataset(dataset, options);\r\n const files = generateFilesForApi(api);\r\n\r\n yield files;\r\n }\r\n}\r\n\r\n/**\r\n * Gets the API Link for the list of books endpoint for a translation.\r\n * @param translationId The ID of the translation.\r\n * @returns\r\n */\r\nexport function listOfBooksApiLink(\r\n translationId: string,\r\n prefix: string = ''\r\n): string {\r\n return `${prefix}/api/${translationId}/books.json`;\r\n}\r\n\r\n/**\r\n * Gets the API Link for the complete translation download endpoint.\r\n * @param translationId The ID of the translation.\r\n * @param prefix The path prefix.\r\n * @returns\r\n */\r\nexport function completeTranslationApiLink(\r\n translationId: string,\r\n prefix: string = ''\r\n): string {\r\n return `${prefix}/api/${translationId}/complete.json`;\r\n}\r\n\r\n/**\r\n * Gets the API Link for the list of books endpoint for a commentary.\r\n * @param commentaryId The ID of the commentary.\r\n * @returns\r\n */\r\nexport function listOfCommentaryBooksApiLink(\r\n commentaryId: string,\r\n prefix: string = ''\r\n): string {\r\n return `${prefix}/api/c/${commentaryId}/books.json`;\r\n}\r\n\r\n/**\r\n * Gets the API Link for the list of books endpoint for a dataset.\r\n * @param datasetId The ID of the dataset.\r\n * @returns\r\n */\r\nexport function listOfDatasetBooksApiLink(\r\n datasetId: string,\r\n prefix: string = ''\r\n): string {\r\n return `${prefix}/api/d/${datasetId}/books.json`;\r\n}\r\n\r\n/**\r\n * Getes the API link for a book chapter.\r\n * @param translationId The ID of the translation.\r\n * @param commonName The name of the book.\r\n * @param chapterNumber The number of the book.\r\n * @param extension The extension of the file.\r\n */\r\nexport function bookChapterApiLink(\r\n translationId: string,\r\n commonName: string,\r\n chapterNumber: number,\r\n extension: string,\r\n prefix: string = ''\r\n) {\r\n return `${prefix}/api/${translationId}/${replaceSpacesWithUnderscores(\r\n commonName\r\n )}/${chapterNumber}.${extension}`;\r\n}\r\n\r\n/**\r\n * Getes the API link for a book chapter.\r\n * @param translationId The ID of the translation.\r\n * @param commonName The name of the book.\r\n * @param chapterNumber The number of the book.\r\n * @param extension The extension of the file.\r\n */\r\nexport function bookCommentaryChapterApiLink(\r\n translationId: string,\r\n commonName: string,\r\n chapterNumber: number,\r\n extension: string,\r\n prefix: string = ''\r\n) {\r\n return `${prefix}/api/c/${translationId}/${replaceSpacesWithUnderscores(\r\n commonName\r\n )}/${chapterNumber}.${extension}`;\r\n}\r\n\r\nexport function bookChapterAudioApiLink(\r\n translationId: string,\r\n bookId: string,\r\n chapterNumber: number,\r\n reader: string,\r\n prefix: string = ''\r\n) {\r\n return `${prefix}/api/${translationId}/${replaceSpacesWithUnderscores(\r\n bookId\r\n )}/${chapterNumber}.${reader}.mp3`;\r\n}\r\n\r\n/**\r\n * Getes the API link for a book chapter.\r\n * @param translationId The ID of the translation.\r\n * @param commonName The name of the book.\r\n * @param chapterNumber The number of the book.\r\n * @param extension The extension of the file.\r\n */\r\nexport function bookDatasetChapterApiLink(\r\n translationId: string,\r\n commonName: string,\r\n chapterNumber: number,\r\n extension: string,\r\n prefix: string = ''\r\n) {\r\n return `${prefix}/api/d/${translationId}/${replaceSpacesWithUnderscores(\r\n commonName\r\n )}/${chapterNumber}.${extension}`;\r\n}\r\n\r\n/**\r\n * Gets the API link for a profile.\r\n * @param translationId The ID of the translation.\r\n * @param profileId The ID of the profile.\r\n * @param extension The extension of the file.\r\n */\r\nexport function profilesCommentaryApiLink(\r\n translationId: string,\r\n extension: string,\r\n prefix: string = ''\r\n) {\r\n return `${prefix}/api/c/${translationId}/profiles.${extension}`;\r\n}\r\n\r\n/**\r\n * Gets the API link for a profile.\r\n * @param translationId The ID of the translation.\r\n * @param profileId The ID of the profile.\r\n * @param extension The extension of the file.\r\n */\r\nexport function profileCommentaryApiLink(\r\n translationId: string,\r\n profileId: string,\r\n extension: string,\r\n prefix: string = ''\r\n) {\r\n return `${prefix}/api/c/${translationId}/profiles/${replaceSpacesWithUnderscores(\r\n profileId\r\n )}.${extension}`;\r\n}\r\n\r\nexport function jsonFile(\r\n path: string,\r\n content: any,\r\n mergable?: boolean\r\n): OutputFile {\r\n return {\r\n path,\r\n content,\r\n mergable,\r\n };\r\n}\r\n\r\nexport function downloadedFile(path: string, url: string): OutputFile {\r\n return {\r\n path,\r\n content: () => fetch(url).then((response) => response.body),\r\n };\r\n}\r\n\r\nexport function replaceSpacesWithUnderscores(str: string): string {\r\n return str.replace(/[<>:\"/\\\\|?*\\s]/g, '_');\r\n}\r\n"],
|
|
5
|
+
"mappings": ";AAAA,SAAS,SAAS;AAClB;AAAA,EAMI;AAAA,EACA;AAAA,EAGA;AAAA,EAGA;AAAA,EACA;AAAA,EAGA;AAAA,EACA;AAAA,EAGA;AAAA,EAEA;AAAA,EAEA;AAAA,OACG;AAEP,OAAO;AAoGA,aAAM,iCAAiC,EAAE,OAAO;AAAA;AAAA;AAAA;AAAA,EAInD,cAAc,EAAE,MAAM,EAAE,KAAK,MAAM,oBAAoB,CAAC,EACnD,KAAK;AAAA,IACF,aAAa;AAAA,EACjB,CAAC;AACT,CAAC,EAAE,KAAK;AAAA,EACJ,IAAI;AAAA,EACJ,aAAa;AACjB,CAAC;AAUM,aAAM,iCAAiC,EAAE,OAAO;AAAA;AAAA;AAAA;AAAA,EAInD,cAAc,EAAE,MAAM,EAAE,KAAK,MAAM,mBAAmB,CAAC,EAAE,KAAK;AAAA,IAC1D,aAAa;AAAA,EACjB,CAAC;AACL,CAAC,EAAE,KAAK;AAAA,EACJ,IAAI;AAAA,EACJ,aAAa;AACjB,CAAC;AAUM,aAAM,6BAA6B,EAAE,OAAO;AAAA,EAC/C,UAAU,EAAE,MAAM,EAAE,KAAK,MAAM,gBAAgB,CAAC,EAAE,KAAK;AAAA,IACnD,a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;AACV,SAAO;AAAA,IACH;AAAA,IACA;AAAA,IACA;AAAA,EACJ;AACJ;AAEO,gBAAS,eAAe,MAAc,KAAyB;AAClE,SAAO;AAAA,IACH;AAAA,IACA,SAAS,MAAM,MAAM,GAAG,EAAE,KAAK,CAAC,aAAa,SAAS,IAAI;AAAA,EAC9D;AACJ;AAEO,gBAAS,6BAA6B,KAAqB;AAC9D,SAAO,IAAI,QAAQ,mBAAmB,GAAG;AAC7C;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,6 +1,24 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
import { padStart } from "lodash";
|
|
3
3
|
import { bookOrderMap } from "./book-order.js";
|
|
4
|
+
export const openBibleFilenameGenerator = (translation, postfix) => {
|
|
5
|
+
return (bookId, chapter) => {
|
|
6
|
+
const bookOrder = padStart(
|
|
7
|
+
bookOrderMap.get(bookId).toString(),
|
|
8
|
+
2,
|
|
9
|
+
"0"
|
|
10
|
+
);
|
|
11
|
+
const chapterStr = padStart(chapter.toString(), 3, "0");
|
|
12
|
+
let filename = `${translation}_${bookOrder}_${capitalize(
|
|
13
|
+
bookId === "TIT" ? "TTS" : bookId
|
|
14
|
+
)}_${chapterStr}`;
|
|
15
|
+
if (postfix) {
|
|
16
|
+
filename += `_${postfix}`;
|
|
17
|
+
}
|
|
18
|
+
filename += ".mp3";
|
|
19
|
+
return filename;
|
|
20
|
+
};
|
|
21
|
+
};
|
|
4
22
|
const openBibleUrlGenerator = (translation, reader, postfix) => {
|
|
5
23
|
return (bookId, chapter) => {
|
|
6
24
|
const bookOrder = padStart(
|
|
@@ -19,13 +37,38 @@ const openBibleUrlGenerator = (translation, reader, postfix) => {
|
|
|
19
37
|
return link;
|
|
20
38
|
};
|
|
21
39
|
};
|
|
40
|
+
const freeUseBibleApiGenerator = (translation, reader) => {
|
|
41
|
+
return (bookId, chapter) => {
|
|
42
|
+
const link = `https://audio.bible.helloao.org/api/${translation}/${bookId}/${chapter.toString()}/audio/${reader}.mp3`;
|
|
43
|
+
return link;
|
|
44
|
+
};
|
|
45
|
+
};
|
|
46
|
+
export const KNOWN_AUDIO_FILE_TRANSLATIONS = /* @__PURE__ */ new Map([
|
|
47
|
+
[
|
|
48
|
+
"BSB",
|
|
49
|
+
/* @__PURE__ */ new Map([
|
|
50
|
+
["hays", openBibleFilenameGenerator("BSB", "H")],
|
|
51
|
+
["souer", openBibleFilenameGenerator("BSB", null)],
|
|
52
|
+
["david", openBibleFilenameGenerator("BSB", "D")]
|
|
53
|
+
])
|
|
54
|
+
]
|
|
55
|
+
]);
|
|
22
56
|
export const KNOWN_AUDIO_TRANSLATIONS = /* @__PURE__ */ new Map([
|
|
23
57
|
[
|
|
24
58
|
"BSB",
|
|
25
59
|
/* @__PURE__ */ new Map([
|
|
26
|
-
["
|
|
27
|
-
["
|
|
28
|
-
["
|
|
60
|
+
["hays", freeUseBibleApiGenerator("BSB", "hays")],
|
|
61
|
+
["souer", freeUseBibleApiGenerator("BSB", "souer")],
|
|
62
|
+
["david", freeUseBibleApiGenerator("BSB", "david")]
|
|
63
|
+
])
|
|
64
|
+
],
|
|
65
|
+
[
|
|
66
|
+
"AAB",
|
|
67
|
+
// AAB re-uses the BSB audio files
|
|
68
|
+
/* @__PURE__ */ new Map([
|
|
69
|
+
["hays", freeUseBibleApiGenerator("BSB", "hays")],
|
|
70
|
+
["souer", freeUseBibleApiGenerator("BSB", "souer")],
|
|
71
|
+
["david", freeUseBibleApiGenerator("BSB", "david")]
|
|
29
72
|
])
|
|
30
73
|
]
|
|
31
74
|
]);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../generation/audio.ts"],
|
|
4
|
-
"sourcesContent": ["import { padStart } from 'lodash';\nimport { bookOrderMap } from './book-order.js';\nimport { TranslationBookChapterAudioLinks } from './common-types.js';\n\ntype AudioTranslationUrlGenerator = (bookId: string, chapter: number) => string;\n\nconst openBibleUrlGenerator: (\n translation: string,\n reader: string,\n postfix: string | null\n) => AudioTranslationUrlGenerator = (translation, reader, postfix) => {\n return (bookId, chapter) => {\n const bookOrder = padStart(\n bookOrderMap.get(bookId)!.toString(),\n 2,\n '0'\n );\n const chapterStr = padStart(chapter.toString(), 3, '0');\n\n let link = `https://openbible.com/audio/${reader}/${translation}_${bookOrder}_${capitalize(\n bookId === 'TIT' ? 'TTS' : bookId\n )}_${chapterStr}`;\n\n if (postfix) {\n link += `_${postfix}`;\n }\n\n link += '.mp3';\n\n return link;\n };\n};\n\n/**\n * A map of translation IDs to a map of reader IDs to the URL generator for the audio file.\n */\nexport const
|
|
5
|
-
"mappings": ";AAAA,SAAS,gBAAgB;AACzB,SAAS,oBAAoB;
|
|
4
|
+
"sourcesContent": ["import { padStart } from 'lodash';\r\nimport { bookOrderMap } from './book-order.js';\r\nimport { TranslationBookChapterAudioLinks } from './common-types.js';\r\n\r\ntype AudioTranslationUrlGenerator = (bookId: string, chapter: number) => string;\r\n\r\nexport const openBibleFilenameGenerator: (\r\n translation: string,\r\n postfix: string | null\r\n) => AudioTranslationUrlGenerator = (translation, postfix) => {\r\n return (bookId, chapter) => {\r\n const bookOrder = padStart(\r\n bookOrderMap.get(bookId)!.toString(),\r\n 2,\r\n '0'\r\n );\r\n const chapterStr = padStart(chapter.toString(), 3, '0');\r\n\r\n let filename = `${translation}_${bookOrder}_${capitalize(\r\n bookId === 'TIT' ? 'TTS' : bookId\r\n )}_${chapterStr}`;\r\n\r\n if (postfix) {\r\n filename += `_${postfix}`;\r\n }\r\n\r\n filename += '.mp3';\r\n\r\n return filename;\r\n };\r\n};\r\n\r\nconst openBibleUrlGenerator: (\r\n translation: string,\r\n reader: string,\r\n postfix: string | null\r\n) => AudioTranslationUrlGenerator = (translation, reader, postfix) => {\r\n return (bookId, chapter) => {\r\n const bookOrder = padStart(\r\n bookOrderMap.get(bookId)!.toString(),\r\n 2,\r\n '0'\r\n );\r\n const chapterStr = padStart(chapter.toString(), 3, '0');\r\n\r\n let link = `https://openbible.com/audio/${reader}/${translation}_${bookOrder}_${capitalize(\r\n bookId === 'TIT' ? 'TTS' : bookId\r\n )}_${chapterStr}`;\r\n\r\n if (postfix) {\r\n link += `_${postfix}`;\r\n }\r\n\r\n link += '.mp3';\r\n\r\n return link;\r\n };\r\n};\r\n\r\nconst freeUseBibleApiGenerator: (\r\n translation: string,\r\n reader: string\r\n) => AudioTranslationUrlGenerator = (translation, reader) => {\r\n return (bookId, chapter) => {\r\n const link = `https://audio.bible.helloao.org/api/${translation}/${bookId}/${chapter.toString()}/audio/${reader}.mp3`;\r\n return link;\r\n };\r\n};\r\n\r\n/**\r\n * A map of translation IDs to a map of reader IDs to the URL generator for the audio file.\r\n */\r\nexport const KNOWN_AUDIO_FILE_TRANSLATIONS: Map<\r\n string,\r\n Map<string, AudioTranslationUrlGenerator>\r\n> = new Map([\r\n [\r\n 'BSB',\r\n new Map([\r\n ['hays', openBibleFilenameGenerator('BSB', 'H')],\r\n ['souer', openBibleFilenameGenerator('BSB', null)],\r\n ['david', openBibleFilenameGenerator('BSB', 'D')],\r\n ]),\r\n ],\r\n]);\r\n\r\n/**\r\n * A map of translation IDs to a map of reader IDs to the URL generator for the audio file.\r\n */\r\nexport const KNOWN_AUDIO_TRANSLATIONS: Map<\r\n string,\r\n Map<string, AudioTranslationUrlGenerator>\r\n> = new Map([\r\n [\r\n 'BSB',\r\n new Map([\r\n ['hays', freeUseBibleApiGenerator('BSB', 'hays')],\r\n ['souer', freeUseBibleApiGenerator('BSB', 'souer')],\r\n ['david', freeUseBibleApiGenerator('BSB', 'david')],\r\n ]),\r\n ],\r\n [\r\n 'AAB',\r\n // AAB re-uses the BSB audio files\r\n new Map([\r\n ['hays', freeUseBibleApiGenerator('BSB', 'hays')],\r\n ['souer', freeUseBibleApiGenerator('BSB', 'souer')],\r\n ['david', freeUseBibleApiGenerator('BSB', 'david')],\r\n ]),\r\n ],\r\n]);\r\n\r\n/**\r\n * Gets the audio URLs for the given translation, book, and chapter.\r\n * @param translationId The ID of the translation.\r\n * @param bookId The ID of the book.\r\n * @param chapter The number of the chapter.\r\n */\r\nexport function getAudioUrlsForChapter(\r\n translationId: string,\r\n bookId: string,\r\n chapter: number\r\n): TranslationBookChapterAudioLinks {\r\n const translation = KNOWN_AUDIO_TRANSLATIONS.get(translationId);\r\n if (!translation) {\r\n return {};\r\n }\r\n\r\n const links: TranslationBookChapterAudioLinks = {};\r\n for (let [reader, generator] of translation) {\r\n const url = generator(bookId, chapter);\r\n if (url) {\r\n links[reader] = url;\r\n }\r\n }\r\n return links;\r\n}\r\n\r\n/**\r\n * Capitalizes the first letter of the given string.\r\n * @param str The string to capitalize.\r\n */\r\nexport function capitalize(str: string): string {\r\n const char = str.charAt(0);\r\n if (/[0-9]/.test(char)) {\r\n return (\r\n str.charAt(0) +\r\n str.charAt(1).toUpperCase() +\r\n str.slice(2).toLowerCase()\r\n );\r\n }\r\n\r\n return str.charAt(0).toUpperCase() + str.slice(1).toLowerCase();\r\n}\r\n"],
|
|
5
|
+
"mappings": ";AAAA,SAAS,gBAAgB;AACzB,SAAS,oBAAoB;AAKtB,aAAM,6BAGuB,CAAC,aAAa,YAAY;AAC1D,SAAO,CAAC,QAAQ,YAAY;AACxB,UAAM,YAAY;AAAA,MACd,aAAa,IAAI,MAAM,EAAG,SAAS;AAAA,MACnC;AAAA,MACA;AAAA,IACJ;AACA,UAAM,aAAa,SAAS,QAAQ,SAAS,GAAG,GAAG,GAAG;AAEtD,QAAI,WAAW,GAAG,WAAW,IAAI,SAAS,IAAI;AAAA,MAC1C,WAAW,QAAQ,QAAQ;AAAA,IAC/B,CAAC,IAAI,UAAU;AAEf,QAAI,SAAS;AACT,kBAAY,IAAI,OAAO;AAAA,IAC3B;AAEA,gBAAY;AAEZ,WAAO;AAAA,EACX;AACJ;AAEA,MAAM,wBAI8B,CAAC,aAAa,QAAQ,YAAY;AAClE,SAAO,CAAC,QAAQ,YAAY;AACxB,UAAM,YAAY;AAAA,MACd,aAA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,yBAAyB,OAAO,OAAO,CAAC;AAAA,IACtD,CAAC;AAAA,EACL;AACJ,CAAC;AAQM,gBAAS,uBACZ,eACA,QACA,SACgC;AAChC,QAAM,cAAc,yBAAyB,IAAI,aAAa;AAC9D,MAAI,CAAC,aAAa;AACd,WAAO,CAAC;AAAA,EACZ;AAEA,QAAM,QAA0C,CAAC;AACjD,WAAS,CAAC,QAAQ,SAAS,KAAK,aAAa;AACzC,UAAM,MAAM,UAAU,QAAQ,OAAO;AACrC,QAAI,KAAK;AACL,YAAM,MAAM,IAAI;AAAA,IACpB;AAAA,EACJ;AACA,SAAO;AACX;AAMO,gBAAS,WAAW,KAAqB;AAC5C,QAAM,OAAO,IAAI,OAAO,CAAC;AACzB,MAAI,QAAQ,KAAK,IAAI,GAAG;AACpB,WACI,IAAI,OAAO,CAAC,IACZ,IAAI,OAAO,CAAC,EAAE,YAAY,IAC1B,IAAI,MAAM,CAAC,EAAE,YAAY;AAAA,EAEjC;AAEA,SAAO,IAAI,OAAO,CAAC,EAAE,YAAY,IAAI,IAAI,MAAM,CAAC,EAAE,YAAY;AAClE;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -196,7 +196,7 @@ const englishBookMap = /* @__PURE__ */ new Map([
|
|
|
196
196
|
["PSA", { commonName: "Psalms" }],
|
|
197
197
|
["PRO", { commonName: "Proverbs" }],
|
|
198
198
|
["ECC", { commonName: "Ecclesiastes" }],
|
|
199
|
-
["SNG", { commonName: "Song of
|
|
199
|
+
["SNG", { commonName: "Song of Solomon" }],
|
|
200
200
|
["ISA", { commonName: "Isaiah" }],
|
|
201
201
|
["JER", { commonName: "Jeremiah" }],
|
|
202
202
|
["LAM", { commonName: "Lamentations" }],
|