@helloao/tools 0.1.0 → 0.3.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.
Files changed (78) hide show
  1. package/dist/cjs/generation/api.cjs +1580 -35
  2. package/dist/cjs/generation/api.cjs.map +3 -3
  3. package/dist/cjs/generation/audio.cjs +55 -8
  4. package/dist/cjs/generation/audio.cjs.map +2 -2
  5. package/dist/cjs/generation/book-order.cjs +1 -1
  6. package/dist/cjs/generation/book-order.cjs.map +2 -2
  7. package/dist/cjs/generation/common-types.cjs +996 -0
  8. package/dist/cjs/generation/common-types.cjs.map +2 -2
  9. package/dist/cjs/generation/dataset.cjs +44 -17
  10. package/dist/cjs/generation/dataset.cjs.map +2 -2
  11. package/dist/cjs/generation/index.cjs +8 -5
  12. package/dist/cjs/generation/index.cjs.map +2 -2
  13. package/dist/cjs/generation/simple.cjs +294 -0
  14. package/dist/cjs/generation/simple.cjs.map +7 -0
  15. package/dist/cjs/index.cjs +4 -4
  16. package/dist/cjs/parser/codex-parser.cjs +3 -3
  17. package/dist/cjs/parser/codex-parser.cjs.map +3 -3
  18. package/dist/cjs/parser/commentary-csv-parser.cjs +14 -3
  19. package/dist/cjs/parser/commentary-csv-parser.cjs.map +3 -3
  20. package/dist/cjs/parser/index.cjs +1 -1
  21. package/dist/cjs/parser/lockman-parser.cjs +334 -0
  22. package/dist/cjs/parser/lockman-parser.cjs.map +7 -0
  23. package/dist/cjs/parser/tyndale-xml-parser.cjs +1 -1
  24. package/dist/cjs/parser/tyndale-xml-parser.cjs.map +1 -1
  25. package/dist/cjs/parser/types.cjs.map +1 -1
  26. package/dist/cjs/parser/usfm-parser.cjs +2 -2
  27. package/dist/cjs/parser/usfm-parser.cjs.map +1 -1
  28. package/dist/cjs/parser/usx-parser.cjs +145 -32
  29. package/dist/cjs/parser/usx-parser.cjs.map +2 -2
  30. package/dist/cjs/parser/words.cjs +187 -0
  31. package/dist/cjs/parser/words.cjs.map +7 -0
  32. package/dist/cjs/utils.cjs +152 -0
  33. package/dist/cjs/utils.cjs.map +3 -3
  34. package/dist/esm/generation/api.js +1527 -35
  35. package/dist/esm/generation/api.js.map +3 -3
  36. package/dist/esm/generation/audio.js +47 -4
  37. package/dist/esm/generation/audio.js.map +2 -2
  38. package/dist/esm/generation/book-order.js +1 -1
  39. package/dist/esm/generation/book-order.js.map +2 -2
  40. package/dist/esm/generation/common-types.js +903 -0
  41. package/dist/esm/generation/common-types.js.map +3 -3
  42. package/dist/esm/generation/dataset.js +35 -10
  43. package/dist/esm/generation/dataset.js.map +2 -2
  44. package/dist/esm/generation/index.js +2 -1
  45. package/dist/esm/generation/index.js.map +2 -2
  46. package/dist/esm/generation/simple.js +260 -0
  47. package/dist/esm/generation/simple.js.map +7 -0
  48. package/dist/esm/parser/codex-parser.js +3 -3
  49. package/dist/esm/parser/codex-parser.js.map +3 -3
  50. package/dist/esm/parser/commentary-csv-parser.js +3 -2
  51. package/dist/esm/parser/commentary-csv-parser.js.map +2 -2
  52. package/dist/esm/parser/lockman-parser.js +306 -0
  53. package/dist/esm/parser/lockman-parser.js.map +7 -0
  54. package/dist/esm/parser/tyndale-xml-parser.js +1 -1
  55. package/dist/esm/parser/tyndale-xml-parser.js.map +1 -1
  56. package/dist/esm/parser/usfm-parser.js +1 -1
  57. package/dist/esm/parser/usfm-parser.js.map +1 -1
  58. package/dist/esm/parser/usx-parser.js +153 -32
  59. package/dist/esm/parser/usx-parser.js.map +2 -2
  60. package/dist/esm/parser/words.js +149 -0
  61. package/dist/esm/parser/words.js.map +7 -0
  62. package/dist/esm/utils.js +138 -0
  63. package/dist/esm/utils.js.map +2 -2
  64. package/dist/types/generation/api.d.ts +8478 -472
  65. package/dist/types/generation/audio.d.ts +5 -0
  66. package/dist/types/generation/common-types.d.ts +1646 -407
  67. package/dist/types/generation/dataset.d.ts +1 -0
  68. package/dist/types/generation/index.d.ts +2 -1
  69. package/dist/types/generation/simple.d.ts +110 -0
  70. package/dist/types/parser/codex-parser.d.ts +18 -138
  71. package/dist/types/parser/commentary-csv-parser.d.ts +1 -1
  72. package/dist/types/parser/lockman-parser.d.ts +14 -0
  73. package/dist/types/parser/tyndale-xml-parser.d.ts +1 -1
  74. package/dist/types/parser/types.d.ts +67 -0
  75. package/dist/types/parser/usx-parser.d.ts +6 -5
  76. package/dist/types/parser/words.d.ts +104 -0
  77. package/dist/types/utils.d.ts +223 -18
  78. package/package.json +7 -4
@@ -1,7 +1,1131 @@
1
1
  "use strict";
2
+ import { z } from "zod";
3
+ import {
4
+ CommentaryBookChapterSchema,
5
+ CommentaryBookSchema,
6
+ CommentaryProfileSchema,
7
+ DatasetBookChapterSchema,
8
+ DatasetBookSchema,
9
+ DatasetSchema,
10
+ TranslationSchema,
11
+ TranslationBookSchema,
12
+ TranslationBookChapterSchema,
13
+ ChapterWordSchema,
14
+ CommentarySchema,
15
+ SimpleChapterDataSchema,
16
+ SimpleChapterWordSchema,
17
+ SimpleCommentaryChapterDataSchema,
18
+ SimpleTranslationBookChapterSchema
19
+ } from "./common-types.js";
20
+ import {
21
+ simplifyChapter,
22
+ simplifyCommentaryChapter
23
+ } from "./simple.js";
24
+ import { BookIdSchema } from "../utils.js";
25
+ export const ApiAvailableTranslationsSchema = z.object({
26
+ /**
27
+ * The list of translations.
28
+ */
29
+ translations: z.array(z.lazy(() => ApiTranslationSchema)).meta({
30
+ description: "The list of translations that are available in the API."
31
+ })
32
+ }).meta({
33
+ id: "ApiAvailableTranslations",
34
+ description: "The list of available translations. Maps to the /api/available-translations.json endpoint."
35
+ });
36
+ export const ApiAvailableCommentariesSchema = z.object({
37
+ /**
38
+ * The list of commentaries.
39
+ */
40
+ commentaries: z.array(z.lazy(() => ApiCommentarySchema)).meta({
41
+ description: "The list of commentaries that are available in the API."
42
+ })
43
+ }).meta({
44
+ id: "ApiAvailableCommentaries",
45
+ description: "The list of available commentaries. Maps to the /api/available-commentaries.json endpoint."
46
+ });
47
+ export const ApiAvailableDatasetsSchema = z.object({
48
+ datasets: z.array(z.lazy(() => ApiDatasetSchema)).meta({
49
+ description: "The list of datasets that are available in the API."
50
+ })
51
+ }).meta({
52
+ id: "ApiAvailableDatasets",
53
+ description: "The list of available datasets. Maps to the /api/available-datasets.json endpoint."
54
+ });
55
+ export const ApiDatasetSchema = DatasetSchema.extend({
56
+ /**
57
+ * The API link for the list of books for this dataset.
58
+ */
59
+ listOfBooksApiLink: z.string().meta({
60
+ description: "The API link for the list of books for this dataset. Relative to the API origin."
61
+ }),
62
+ /**
63
+ * The available list of formats.
64
+ */
65
+ availableFormats: z.array(z.literal("json")),
66
+ /**
67
+ * The number of books that are contained in this dataset.
68
+ */
69
+ numberOfBooks: z.number().meta({
70
+ description: "The number of books that are contained in this dataset."
71
+ }),
72
+ /**
73
+ * The total number of chapters that are contained in this dataset.
74
+ */
75
+ totalNumberOfChapters: z.number().meta({
76
+ description: "The total number of chapters that are contained in this dataset."
77
+ }),
78
+ /**
79
+ * The total number of verses that are contained in this dataset.
80
+ */
81
+ totalNumberOfVerses: z.number().meta({
82
+ description: "The total number of verses that are contained in this dataset."
83
+ }),
84
+ /**
85
+ * The total number of references that are contained in this dataset.
86
+ */
87
+ totalNumberOfReferences: z.number().meta({
88
+ description: "The total number of references that are contained in this dataset."
89
+ }),
90
+ /**
91
+ * Gets the name of the language that the commentary is in.
92
+ * Null or undefined if the name of the language is not known.
93
+ */
94
+ languageName: z.string().optional().meta({
95
+ description: "Gets the name of the language that the dataset is in. Null or undefined if the name of the language is not known."
96
+ }),
97
+ /**
98
+ * Gets the name of the language in English.
99
+ * Null or undefined if the language doesn't have an english name.
100
+ */
101
+ languageEnglishName: z.string().optional().meta({
102
+ description: "Gets the name of the language in English. Null or undefined if the language doesn't have an english name."
103
+ })
104
+ }).meta({
105
+ id: "ApiDataset",
106
+ description: "Defines a dataset that is used in the API."
107
+ });
108
+ export const ApiTranslationSchema = TranslationSchema.extend({
109
+ /**
110
+ * The API link for the list of available books for this translation.
111
+ */
112
+ listOfBooksApiLink: z.string().meta({
113
+ description: "The API link for the list of books for this translation. Relative to the API origin."
114
+ }),
115
+ /**
116
+ * The available list of formats.
117
+ */
118
+ availableFormats: z.array(z.enum(["json", "usfm"])),
119
+ /**
120
+ * The number of books that are contained in this translation.
121
+ *
122
+ * Complete translations should have the same number of books as the Bible (66).
123
+ */
124
+ numberOfBooks: z.number().meta({
125
+ description: "The number of books that are contained in this translation. Complete translations should have the same number of books as the Bible (66)."
126
+ }),
127
+ /**
128
+ * The total number of chapters that are contained in this translation.
129
+ *
130
+ * Complete translations should have the same number of chapters as the Bible (1,189).
131
+ */
132
+ totalNumberOfChapters: z.number().meta({
133
+ 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)."
134
+ }),
135
+ /**
136
+ * The total number of verses that are contained in this translation.
137
+ *
138
+ * 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).
139
+ */
140
+ totalNumberOfVerses: z.number().meta({
141
+ 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)."
142
+ }),
143
+ /**
144
+ * The total number of apocryphal books that are contained in this translation.
145
+ */
146
+ numberOfApocryphalBooks: z.number().optional().meta({
147
+ description: "The total number of apocryphal books that are contained in this translation."
148
+ }),
149
+ /**
150
+ * The total number of apocryphal chapters that are contained in this translation.
151
+ */
152
+ totalNumberOfApocryphalChapters: z.number().optional().meta({
153
+ description: "The total number of apocryphal chapters that are contained in this translation."
154
+ }),
155
+ /**
156
+ * The total number of apocryphal verses that are contained in this translation.
157
+ */
158
+ totalNumberOfApocryphalVerses: z.number().optional().meta({
159
+ description: "The total number of apocryphal verses that are contained in this translation."
160
+ }),
161
+ /**
162
+ * Gets the name of the language that the translation is in.
163
+ * Null or undefined if the name of the language is not known.
164
+ */
165
+ languageName: z.string().optional().meta({
166
+ description: "Gets the name of the language that the translation is in. Null or undefined if the name of the language is not known."
167
+ }),
168
+ /**
169
+ * Gets the name of the language in English.
170
+ * Null or undefined if the language doesn't have an english name.
171
+ */
172
+ languageEnglishName: z.string().optional().meta({
173
+ description: "Gets the name of the language in English. Null or undefined if the language doesn't have an english name."
174
+ }),
175
+ /**
176
+ * The API link for downloading the complete translation as a single JSON file.
177
+ *
178
+ * Undefined if complete translation files are not available.
179
+ */
180
+ completeTranslationApiLink: z.string().optional().meta({
181
+ 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."
182
+ }),
183
+ /**
184
+ * The API link for downloading the complete translation as a single JSON file,
185
+ * using the simplified chapter format.
186
+ *
187
+ * Undefined if complete translation files are not available.
188
+ */
189
+ simpleCompleteTranslationApiLink: z.string().optional().meta({
190
+ description: "The API link for downloading the complete translation as a single JSON file, using the simplified chapter format. Relative to the API origin. Undefined if complete translation files are not available."
191
+ })
192
+ }).meta({
193
+ id: "ApiTranslation",
194
+ description: "Defines a translation that is used in the API."
195
+ });
196
+ export const ApiTranslationCompleteSchema = z.object({
197
+ /**
198
+ * The translation metadata.
199
+ */
200
+ translation: z.lazy(() => ApiTranslationSchema).meta({
201
+ description: "The translation metadata."
202
+ }),
203
+ /**
204
+ * The complete list of books with all their chapters.
205
+ */
206
+ books: z.array(z.lazy(() => ApiTranslationCompleteBookSchema)).meta({
207
+ description: "The complete list of books with all their chapters."
208
+ })
209
+ }).meta({
210
+ id: "ApiTranslationComplete",
211
+ description: "Defines the complete translation download data. Maps to the /api/:translationId/complete.json endpoint."
212
+ });
213
+ export const TranslationCompleteChapterSchema = TranslationBookChapterSchema.extend({
214
+ /**
215
+ * The number of verses that the chapter contains.
216
+ */
217
+ numberOfVerses: z.number().meta({
218
+ description: "The number of verses that the chapter contains."
219
+ })
220
+ }).meta({
221
+ id: "TranslationCompleteChapter",
222
+ description: "A chapter in the complete translation download."
223
+ });
224
+ export const SimpleTranslationCompleteChapterSchema = SimpleTranslationBookChapterSchema.extend({
225
+ /**
226
+ * The number of verses that the chapter contains.
227
+ */
228
+ numberOfVerses: z.number().meta({
229
+ description: "The number of verses that the chapter contains."
230
+ })
231
+ }).meta({
232
+ id: "SimpleTranslationCompleteChapter",
233
+ description: "A chapter in the complete translation download, using the simplified chapter format."
234
+ });
235
+ export const ApiTranslationCompleteBookSchema = TranslationBookSchema.extend({
236
+ /**
237
+ * The number of chapters in the book.
238
+ */
239
+ numberOfChapters: z.number().meta({
240
+ description: "The number of chapters in the book."
241
+ }),
242
+ /**
243
+ * The total number of verses in the book.
244
+ */
245
+ totalNumberOfVerses: z.number().meta({
246
+ description: "The total number of verses in the book."
247
+ }),
248
+ /**
249
+ * The complete list of chapters with all content.
250
+ */
251
+ chapters: z.array(TranslationCompleteChapterSchema).meta({
252
+ description: "The complete list of chapters with all content."
253
+ })
254
+ }).meta({
255
+ id: "ApiTranslationCompleteBook",
256
+ description: "A book in the complete translation download."
257
+ });
258
+ export const ApiSimpleTranslationCompleteSchema = z.object({
259
+ /**
260
+ * The translation metadata.
261
+ */
262
+ translation: z.lazy(() => ApiTranslationSchema).meta({
263
+ description: "The translation metadata."
264
+ }),
265
+ /**
266
+ * The complete list of books with all their chapters.
267
+ */
268
+ books: z.array(z.lazy(() => ApiSimpleTranslationCompleteBookSchema)).meta({
269
+ description: "The complete list of books with all their chapters."
270
+ })
271
+ }).meta({
272
+ id: "ApiSimpleTranslationComplete",
273
+ description: "Defines the complete translation download data, using the simplified chapter format. Maps to the /api/:translationId/complete.simple.json endpoint."
274
+ });
275
+ export const ApiSimpleTranslationCompleteBookSchema = ApiTranslationCompleteBookSchema.extend({
276
+ /**
277
+ * The complete list of chapters with all content.
278
+ */
279
+ chapters: z.array(SimpleTranslationCompleteChapterSchema).meta({
280
+ description: "The complete list of chapters with all content."
281
+ })
282
+ }).meta({
283
+ id: "ApiSimpleTranslationCompleteBook",
284
+ description: "A book in the complete translation download, using the simplified chapter format."
285
+ });
286
+ export const ApiCommentarySchema = CommentarySchema.extend({
287
+ /**
288
+ * The API link for the list of available books for this translation.
289
+ */
290
+ listOfBooksApiLink: z.string().meta({
291
+ description: "The API link for the list of books for this commentary. Relative to the API origin."
292
+ }),
293
+ /**
294
+ * The API link for the list of available profiles for this commentary.
295
+ */
296
+ listOfProfilesApiLink: z.string().meta({
297
+ description: "The API link for the list of profiles for this commentary. Relative to the API origin."
298
+ }),
299
+ /**
300
+ * The available list of formats.
301
+ */
302
+ availableFormats: z.array(z.enum(["json", "usfm"])),
303
+ /**
304
+ * The number of books that are contained in this commentary.
305
+ *
306
+ * Complete commentaries should have the same number of books as the Bible (66).
307
+ */
308
+ numberOfBooks: z.number().meta({
309
+ description: "The number of books that are contained in this commentary. Complete commentaries should have the same number of books as the Bible (66)."
310
+ }),
311
+ /**
312
+ * The total number of chapters that are contained in this translation.
313
+ *
314
+ * Complete commentaries should have the same number of chapters as the Bible (1,189).
315
+ */
316
+ totalNumberOfChapters: z.number().meta({
317
+ 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)."
318
+ }),
319
+ /**
320
+ * The total number of verses that are contained in this commentary.
321
+ *
322
+ * 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).
323
+ */
324
+ totalNumberOfVerses: z.number().meta({
325
+ 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)."
326
+ }),
327
+ /**
328
+ * The total number of profiles that are contained in this commentary.
329
+ *
330
+ * Profiles are used to provide additional information about people and people groups that are mentioned in the Bible.
331
+ */
332
+ totalNumberOfProfiles: z.number().meta({
333
+ 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."
334
+ }),
335
+ /**
336
+ * Gets the name of the language that the commentary is in.
337
+ * Null or undefined if the name of the language is not known.
338
+ */
339
+ languageName: z.string().optional().meta({
340
+ description: "Gets the name of the language that the commentary is in. Null or undefined if the name of the language is not known."
341
+ }),
342
+ /**
343
+ * Gets the name of the language in English.
344
+ * Null or undefined if the language doesn't have an english name.
345
+ */
346
+ languageEnglishName: z.string().optional().meta({
347
+ description: "Gets the name of the language in English. Null or undefined if the language doesn't have an english name."
348
+ })
349
+ }).meta({
350
+ id: "ApiCommentary",
351
+ description: "Defines a commentary that is used in the API."
352
+ });
353
+ export const ApiTranslationBooksSchema = z.object({
354
+ /**
355
+ * The translation information for the books.
356
+ */
357
+ translation: z.lazy(() => ApiTranslationSchema).meta({
358
+ description: "The translation information for the books."
359
+ }),
360
+ /**
361
+ * The list of books that are available for the translation.
362
+ */
363
+ books: z.array(z.lazy(() => ApiTranslationBookSchema)).meta({
364
+ description: "The list of books that are available for the translation."
365
+ })
366
+ }).meta({
367
+ id: "ApiTranslationBooks",
368
+ description: "Defines an interface that contains information about the books that are available for a translation."
369
+ });
370
+ export const ApiCommentaryBooksSchema = z.object({
371
+ /**
372
+ * The commentary information for the books.
373
+ */
374
+ commentary: z.lazy(() => ApiCommentarySchema).meta({
375
+ description: "The commentary information for the books."
376
+ }),
377
+ /**
378
+ * The list of books that are available for the commentary.
379
+ */
380
+ books: z.array(z.lazy(() => ApiCommentaryBookSchema)).meta({
381
+ description: "The list of books that are available for the commentary."
382
+ })
383
+ }).meta({
384
+ id: "ApiCommentaryBooks",
385
+ description: "Defines an interface that contains information about the books that are available for a commentary."
386
+ });
387
+ export const ApiDatasetBooksSchema = z.object({
388
+ /**
389
+ * The dataset information for the books.
390
+ */
391
+ dataset: z.lazy(() => ApiDatasetSchema).meta({
392
+ description: "The dataset information for the books."
393
+ }),
394
+ /**
395
+ * The list of books that are available for the dataset.
396
+ */
397
+ books: z.array(z.lazy(() => ApiDatasetBookSchema)).meta({
398
+ description: "The list of books that are available for the dataset."
399
+ })
400
+ }).meta({
401
+ id: "ApiDatasetBooks",
402
+ description: "Defines an interface that contains information about the books that are available for a dataset."
403
+ });
404
+ export const ApiCommentaryProfilesSchema = z.object({
405
+ /**
406
+ * The commentary information for the books.
407
+ */
408
+ commentary: z.lazy(() => ApiCommentarySchema).meta({
409
+ description: "The commentary information for the profiles."
410
+ }),
411
+ /**
412
+ * The list of profiles that are available for the commentary.
413
+ */
414
+ profiles: z.array(z.lazy(() => ApiCommentaryProfileSchema)).meta({
415
+ description: "The list of profiles that are available for the commentary."
416
+ })
417
+ }).meta({
418
+ id: "ApiCommentaryProfiles",
419
+ description: "Defines an interface that contains information about the profiles that are available for a commentary."
420
+ });
421
+ export const ApiCommentaryProfileSchema = CommentaryProfileSchema.extend({
422
+ /**
423
+ * The link to this profile.
424
+ */
425
+ thisProfileLink: z.string().meta({
426
+ description: "The API link for this profile. Relative to the API origin."
427
+ }),
428
+ /**
429
+ * The link to the chapter that this profile references in the commentary.
430
+ */
431
+ referenceChapterLink: z.string().nullable().meta({
432
+ 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."
433
+ })
434
+ }).meta({
435
+ id: "ApiCommentaryProfile",
436
+ description: "Defines an interface that contains information about a profile."
437
+ });
438
+ export const TranslationChapterReferenceSchema = z.object({
439
+ translationId: z.string().meta({
440
+ description: "The ID of the translation that the chapter reference is for."
441
+ }),
442
+ book: BookIdSchema,
443
+ chapter: z.int().positive().meta({
444
+ description: "The chapter number of the chapter reference."
445
+ })
446
+ }).meta({
447
+ id: "TranslationChapterReference",
448
+ description: "Defines a reference to a chapter in a translation."
449
+ });
450
+ export const CommentaryChapterReferenceSchema = z.object({
451
+ commentaryId: z.string().meta({
452
+ description: "The ID of the commentary that the chapter reference is for."
453
+ }),
454
+ book: BookIdSchema,
455
+ chapter: z.int().positive().meta({
456
+ description: "The chapter number of the chapter reference."
457
+ })
458
+ }).meta({
459
+ id: "CommentaryChapterReference",
460
+ description: "Defines a reference to a chapter in a commentary."
461
+ });
462
+ export const DatasetChapterReferenceSchema = z.object({
463
+ datasetId: z.string().meta({
464
+ description: "The ID of the dataset that the chapter reference is for."
465
+ }),
466
+ book: BookIdSchema,
467
+ chapter: z.int().positive().meta({
468
+ description: "The chapter number of the chapter reference."
469
+ })
470
+ }).meta({
471
+ id: "DatasetChapterReference",
472
+ description: "Defines a reference to a chapter in a dataset."
473
+ });
474
+ export const ApiTranslationBookSchema = TranslationBookSchema.extend({
475
+ /**
476
+ * The number of the first chapter in the book.
477
+ */
478
+ firstChapterNumber: z.number().meta({
479
+ description: "The number of the first chapter in the book."
480
+ }),
481
+ /**
482
+ * The link to the first chapter of the book.
483
+ */
484
+ firstChapterApiLink: z.string().meta({
485
+ description: "The link to the first chapter of the book."
486
+ }),
487
+ /**
488
+ * The reference for the first chapter in the book.
489
+ */
490
+ firstChapterReference: TranslationChapterReferenceSchema,
491
+ /**
492
+ * The number of the last chapter in the book.
493
+ */
494
+ lastChapterNumber: z.number().meta({
495
+ description: "The number of the last chapter in the book."
496
+ }),
497
+ /**
498
+ * The link to the last chapter of the book.
499
+ */
500
+ lastChapterApiLink: z.string().meta({
501
+ description: "The link to the last chapter of the book."
502
+ }),
503
+ /**
504
+ * The reference for the last chapter in the book.
505
+ */
506
+ lastChapterReference: TranslationChapterReferenceSchema,
507
+ /**
508
+ * The number of chapters that the book contains.
509
+ */
510
+ numberOfChapters: z.number().meta({
511
+ description: "The number of chapters that the book contains."
512
+ }),
513
+ /**
514
+ * The number of verses that the book contains.
515
+ */
516
+ totalNumberOfVerses: z.number().meta({
517
+ description: "The number of verses that the book contains."
518
+ })
519
+ }).meta({
520
+ id: "ApiTranslationBook",
521
+ description: "Defines a schema that contains information about a translation book."
522
+ });
523
+ export const ApiCommentaryBookSchema = CommentaryBookSchema.extend({
524
+ /**
525
+ * The number of the first chapter in the book.
526
+ *
527
+ * Null if the comentary book has no chapters.
528
+ */
529
+ firstChapterNumber: z.number().nullable().meta({
530
+ description: "The number of the first chapter in the book. Null if the comentary book has no chapters."
531
+ }),
532
+ /**
533
+ * The link to the first chapter of the book.
534
+ *
535
+ * Null if the comentary book has no chapters.
536
+ */
537
+ firstChapterApiLink: z.string().nullable().meta({
538
+ description: "The link to the first chapter of the book. Null if the comentary book has no chapters."
539
+ }),
540
+ /**
541
+ * The reference for the first chapter in the book.
542
+ */
543
+ firstChapterReference: CommentaryChapterReferenceSchema.nullable().meta({
544
+ description: "The reference for the first chapter in the book. Null if the comentary book has no chapters."
545
+ }),
546
+ /**
547
+ * The number of the last chapter in the book.
548
+ *
549
+ * Null if the comentary book has no chapters.
550
+ */
551
+ lastChapterNumber: z.number().nullable().meta({
552
+ description: "The number of the last chapter in the book. Null if the comentary book has no chapters."
553
+ }),
554
+ /**
555
+ * The link to the last chapter of the book.
556
+ *
557
+ * Null if the comentary book has no chapters.
558
+ */
559
+ lastChapterApiLink: z.string().nullable().meta({
560
+ description: "The link to the last chapter of the book. Null if the comentary book has no chapters."
561
+ }),
562
+ /**
563
+ * The reference for the last chapter in the book.
564
+ */
565
+ lastChapterReference: CommentaryChapterReferenceSchema.nullable().meta({
566
+ description: "The reference for the last chapter in the book. Null if the comentary book has no chapters."
567
+ }),
568
+ /**
569
+ * The number of chapters that the book contains.
570
+ */
571
+ numberOfChapters: z.number().meta({
572
+ description: "The number of chapters that the book contains."
573
+ }),
574
+ /**
575
+ * The number of verses that the book contains.
576
+ */
577
+ totalNumberOfVerses: z.number().meta({
578
+ description: "The number of verses that the book contains."
579
+ })
580
+ }).meta({
581
+ id: "ApiCommentaryBook",
582
+ description: "Defines a schema that contains information about a commentary book."
583
+ });
584
+ export const ApiDatasetBookSchema = DatasetBookSchema.extend({
585
+ /**
586
+ * The number of the first chapter in the book.
587
+ */
588
+ firstChapterNumber: z.number().meta({
589
+ description: "The number of the first chapter in the book."
590
+ }),
591
+ /**
592
+ * The link to the first chapter of the book.
593
+ */
594
+ firstChapterApiLink: z.string().meta({
595
+ description: "The link to the first chapter of the book."
596
+ }),
597
+ /**
598
+ * The reference for the first chapter in the book.
599
+ */
600
+ firstChapterReference: DatasetChapterReferenceSchema,
601
+ /**
602
+ * The number of the last chapter in the book.
603
+ */
604
+ lastChapterNumber: z.number().meta({
605
+ description: "The number of the last chapter in the book."
606
+ }),
607
+ /**
608
+ * The link to the last chapter of the book.
609
+ */
610
+ lastChapterApiLink: z.string().meta({
611
+ description: "The link to the last chapter of the book."
612
+ }),
613
+ /**
614
+ * The reference for the last chapter in the book.
615
+ */
616
+ lastChapterReference: DatasetChapterReferenceSchema,
617
+ /**
618
+ * The number of chapters that the book contains.
619
+ */
620
+ numberOfChapters: z.number().meta({
621
+ description: "The number of chapters that the book contains."
622
+ }),
623
+ /**
624
+ * The number of verses that the book contains.
625
+ */
626
+ totalNumberOfVerses: z.number().meta({
627
+ description: "The number of verses that the book contains."
628
+ }),
629
+ /**
630
+ * The number of references that the book contains.
631
+ */
632
+ totalNumberOfReferences: z.number().meta({
633
+ description: "The number of references that the book contains."
634
+ })
635
+ }).meta({
636
+ id: "ApiDatasetBook",
637
+ description: "Defines a schema that contains information about a book in a dataset."
638
+ });
639
+ const ApiTranslationBookChapterBaseSchema = TranslationBookChapterSchema.omit({
640
+ thisChapterWords: true
641
+ });
642
+ export const ApiTranslationBookChapterSchema = ApiTranslationBookChapterBaseSchema.extend({
643
+ /**
644
+ * The translation information for the book chapter.
645
+ */
646
+ translation: z.lazy(() => ApiTranslationSchema).meta({
647
+ description: "The translation information for the book chapter."
648
+ }),
649
+ /**
650
+ * The book information for the book chapter.
651
+ */
652
+ book: z.lazy(() => ApiTranslationBookSchema).meta({
653
+ description: "The book information for the book chapter."
654
+ }),
655
+ /**
656
+ * The link to this chapter.
657
+ */
658
+ thisChapterLink: z.string().meta({
659
+ description: "The API link for this chapter. Relative to the API origin."
660
+ }),
661
+ /**
662
+ * The reference for this chapter.
663
+ */
664
+ thisChapterReference: TranslationChapterReferenceSchema,
665
+ /**
666
+ * The link to the next chapter.
667
+ * Null if this is the last chapter in the translation.
668
+ */
669
+ nextChapterApiLink: z.string().nullable().meta({
670
+ description: "The API link to the next chapter. Relative to the API origin. Null if this is the last chapter in the translation."
671
+ }),
672
+ /**
673
+ * The reference for the next chapter.
674
+ * Null if this is the last chapter in the translation.
675
+ */
676
+ nextChapterReference: TranslationChapterReferenceSchema.nullable().meta(
677
+ {
678
+ description: "The reference for the next chapter. Null if this is the last chapter in the translation."
679
+ }
680
+ ),
681
+ /**
682
+ * The links to the audio versions for the next chapter.
683
+ * Null if this is the last chapter in the translation.
684
+ */
685
+ nextChapterAudioLinks: z.record(z.string(), z.string()).nullable().meta({
686
+ 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."
687
+ }),
688
+ /**
689
+ * The links to the audio timings for different audio versions for the chapter.
690
+ */
691
+ thisChapterAudioTimings: z.record(z.string(), z.string()).meta({
692
+ description: "The links to the audio timings for different audio versions for the chapter. Relative to the API origin."
693
+ }),
694
+ /**
695
+ * The links to the audio timings for different audio versions for the next chapter.
696
+ * Null if this is the last chapter in the translation.
697
+ */
698
+ nextChapterAudioTimings: z.record(z.string(), z.string()).nullable().meta({
699
+ description: "The links to the audio timings for different audio versions for the next chapter. Relative to the API origin. Null if this is the last chapter in the translation."
700
+ }),
701
+ /**
702
+ * The links to the audio timings for different audio versions for the previous chapter.
703
+ * Null if this is the first chapter in the translation.
704
+ */
705
+ previousChapterAudioTimings: z.record(z.string(), z.string()).nullable().meta({
706
+ description: "The links to the audio timings for different audio versions for the previous chapter. Relative to the API origin. Null if this is the first chapter in the translation."
707
+ }),
708
+ /**
709
+ * The link to the previous chapter.
710
+ * Null if this is the first chapter in the translation.
711
+ */
712
+ previousChapterApiLink: z.string().nullable().meta({
713
+ description: "The API link to the previous chapter. Relative to the API origin. Null if this is the first chapter in the translation."
714
+ }),
715
+ /**
716
+ * The reference for the previous chapter.
717
+ * Null if this is the first chapter in the translation.
718
+ */
719
+ previousChapterReference: TranslationChapterReferenceSchema.nullable().meta({
720
+ description: "The reference for the previous chapter. Null if this is the first chapter in the translation."
721
+ }),
722
+ /**
723
+ * The links to the audio versions for the previous chapter.
724
+ * Null if this is the first chapter in the translation.
725
+ */
726
+ previousChapterAudioLinks: z.record(z.string(), z.string()).nullable().meta({
727
+ 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."
728
+ }),
729
+ /**
730
+ * The link to the word-level annotations for the chapter.
731
+ * Omitted if the chapter doesn't have any word-level annotations.
732
+ */
733
+ thisChapterWordsLink: z.string().optional().meta({
734
+ description: "The link to the word-level annotations for this chapter. Relative to the API origin. Omitted if the chapter doesn't have any word-level annotations."
735
+ }),
736
+ /**
737
+ * The link to the word-level annotations for the next chapter.
738
+ * Omitted if this is the last chapter in the translation, or if the next
739
+ * chapter doesn't have any word-level annotations.
740
+ */
741
+ nextChapterWordsLink: z.string().optional().meta({
742
+ description: "The link to the word-level annotations for the next chapter. Relative to the API origin. Omitted if this is the last chapter in the translation, or if the next chapter doesn't have any word-level annotations."
743
+ }),
744
+ /**
745
+ * The link to the word-level annotations for the previous chapter.
746
+ * Omitted if this is the first chapter in the translation, or if the
747
+ * previous chapter doesn't have any word-level annotations.
748
+ */
749
+ previousChapterWordsLink: z.string().optional().meta({
750
+ description: "The link to the word-level annotations for the previous chapter. Relative to the API origin. Omitted if this is the first chapter in the translation, or if the previous chapter doesn't have any word-level annotations."
751
+ }),
752
+ /**
753
+ * The number of verses that the chapter contains.
754
+ */
755
+ numberOfVerses: z.number().meta({
756
+ description: "The number of verses that the chapter contains."
757
+ }),
758
+ /**
759
+ * The link to the simplified version of this chapter.
760
+ * Omitted if simplified chapters were not generated.
761
+ */
762
+ simpleChapterApiLink: z.string().optional().meta({
763
+ description: "The API link to the simplified version of this chapter. Relative to the API origin. Omitted if simplified chapters are not available."
764
+ })
765
+ }).meta({
766
+ id: "ApiTranslationBookChapter",
767
+ description: "Defines an interface that contains information about a book chapter in a translation."
768
+ });
769
+ export const ApiSimpleTranslationBookChapterSchema = ApiTranslationBookChapterSchema.omit({
770
+ chapter: true,
771
+ simpleChapterApiLink: true
772
+ }).extend({
773
+ /**
774
+ * The simplified information for the chapter.
775
+ */
776
+ chapter: z.lazy(() => SimpleChapterDataSchema).meta({
777
+ description: "The simplified information for the chapter. Each verse contains a single text string, and the footnotes and formatting are represented by offsets into that string."
778
+ }),
779
+ /**
780
+ * The link to the regular version of this chapter.
781
+ */
782
+ fullChapterApiLink: z.string().meta({
783
+ description: "The API link to the regular (non-simplified) version of this chapter. Relative to the API origin."
784
+ })
785
+ }).meta({
786
+ id: "ApiSimpleTranslationBookChapter",
787
+ description: "Defines an interface that contains information about a book chapter in a translation, using the simplified chapter format."
788
+ });
789
+ export const ApiCommentaryBookChapterSchema = CommentaryBookChapterSchema.extend({
790
+ /**
791
+ * The commentary information for the book chapter.
792
+ */
793
+ commentary: z.lazy(() => ApiCommentarySchema).meta({
794
+ description: "The commentary information for the book chapter."
795
+ }),
796
+ /**
797
+ * The book information for the book chapter.
798
+ */
799
+ book: z.lazy(() => ApiCommentaryBookSchema).meta({
800
+ description: "The book information for the book chapter."
801
+ }),
802
+ /**
803
+ * The link to this chapter.
804
+ */
805
+ thisChapterLink: z.string().meta({
806
+ description: "The API link for this chapter. Relative to the API origin."
807
+ }),
808
+ thisChapterReference: CommentaryChapterReferenceSchema,
809
+ /**
810
+ * The link to the next chapter.
811
+ * Null if this is the last chapter in the translation.
812
+ */
813
+ nextChapterApiLink: z.string().nullable().meta({
814
+ description: "The API link to the next chapter. Relative to the API origin. Null if this is the last chapter in the commentary."
815
+ }),
816
+ nextChapterReference: CommentaryChapterReferenceSchema.nullable().meta({
817
+ description: "The reference for the next chapter. Null if this is the last chapter in the commentary."
818
+ }),
819
+ /**
820
+ * The link to the previous chapter.
821
+ * Null if this is the first chapter in the translation.
822
+ */
823
+ previousChapterApiLink: z.string().nullable().meta({
824
+ description: "The API link to the previous chapter. Relative to the API origin. Null if this is the first chapter in the commentary."
825
+ }),
826
+ previousChapterReference: CommentaryChapterReferenceSchema.nullable().meta({
827
+ description: "The reference for the previous chapter. Null if this is the first chapter in the commentary."
828
+ }),
829
+ /**
830
+ * The number of verses that the chapter contains.
831
+ */
832
+ numberOfVerses: z.number().meta({
833
+ description: "The number of verses that the chapter contains."
834
+ }),
835
+ /**
836
+ * The link to the simplified version of this chapter.
837
+ * Omitted if simplified chapters were not generated.
838
+ */
839
+ simpleChapterApiLink: z.string().optional().meta({
840
+ description: "The API link to the simplified version of this chapter. Relative to the API origin. Omitted if simplified chapters are not available."
841
+ })
842
+ }).meta({
843
+ id: "ApiCommentaryBookChapter",
844
+ description: "Defines a schema that contains information about a book chapter in a commentary."
845
+ });
846
+ export const ApiSimpleCommentaryBookChapterSchema = ApiCommentaryBookChapterSchema.omit({
847
+ chapter: true,
848
+ simpleChapterApiLink: true
849
+ }).extend({
850
+ /**
851
+ * The simplified information for the chapter.
852
+ */
853
+ chapter: z.lazy(() => SimpleCommentaryChapterDataSchema).meta({
854
+ description: "The simplified information for the chapter. Each verse contains a single text string, and the footnotes and formatting are represented by offsets into that string."
855
+ }),
856
+ /**
857
+ * The link to the regular version of this chapter.
858
+ */
859
+ fullChapterApiLink: z.string().meta({
860
+ description: "The API link to the regular (non-simplified) version of this chapter. Relative to the API origin."
861
+ })
862
+ }).meta({
863
+ id: "ApiSimpleCommentaryBookChapter",
864
+ description: "Defines a schema that contains information about a book chapter in a commentary, using the simplified chapter format."
865
+ });
866
+ export const ApiDatasetBookChapterSchema = DatasetBookChapterSchema.extend({
867
+ /**
868
+ * The dataset information for the book chapter.
869
+ */
870
+ dataset: z.lazy(() => ApiDatasetSchema).meta({
871
+ description: "The dataset information for the book chapter."
872
+ }),
873
+ /**
874
+ * The book information for the book chapter.
875
+ */
876
+ book: z.lazy(() => ApiDatasetBookSchema).meta({
877
+ description: "The book information for the book chapter."
878
+ }),
879
+ /**
880
+ * The link to this chapter.
881
+ */
882
+ thisChapterLink: z.string().meta({
883
+ description: "The API link for this chapter. Relative to the API origin."
884
+ }),
885
+ thisChapterReference: DatasetChapterReferenceSchema,
886
+ /**
887
+ * The link to the next chapter.
888
+ * Null if this is the last chapter in the translation.
889
+ */
890
+ nextChapterApiLink: z.string().nullable().meta({
891
+ description: "The API link to the next chapter. Relative to the API origin. Null if this is the last chapter in the dataset."
892
+ }),
893
+ nextChapterReference: DatasetChapterReferenceSchema.nullable().meta({
894
+ description: "The reference for the next chapter. Null if this is the last chapter in the dataset."
895
+ }),
896
+ /**
897
+ * The link to the previous chapter.
898
+ * Null if this is the first chapter in the translation.
899
+ */
900
+ previousChapterApiLink: z.string().nullable().meta({
901
+ description: "The API link to the previous chapter. Relative to the API origin. Null if this is the first chapter in the dataset."
902
+ }),
903
+ previousChapterReference: DatasetChapterReferenceSchema.nullable().meta({
904
+ description: "The reference for the previous chapter. Null if this is the first chapter in the dataset."
905
+ }),
906
+ /**
907
+ * The number of verses that the chapter contains.
908
+ */
909
+ numberOfVerses: z.number().meta({
910
+ description: "The number of verses that the chapter contains."
911
+ }),
912
+ /**
913
+ * The number of references that the chapter contains.
914
+ */
915
+ numberOfReferences: z.number().meta({
916
+ description: "The number of references that the chapter contains."
917
+ })
918
+ }).meta({
919
+ id: "ApiDatasetBookChapter",
920
+ description: "Defines a schema that contains information about a book chapter in a dataset."
921
+ });
922
+ export const ApiTranslationBookChapterAudioSchema = z.object({
923
+ /**
924
+ * The chapter that the audio is for.
925
+ */
926
+ chapter: z.lazy(() => ApiTranslationBookChapterSchema).meta({
927
+ description: "The chapter that the audio is for."
928
+ }),
929
+ /**
930
+ * The link that the audio should be placed at.
931
+ */
932
+ link: z.string().meta({
933
+ description: "The link that the audio should be placed at. Relative to the API origin."
934
+ }),
935
+ /**
936
+ * The original URL of the audio.
937
+ */
938
+ originalUrl: z.string().meta({
939
+ description: "The original URL of the audio."
940
+ })
941
+ });
942
+ export const ApiTranslationBookChapterAudioTimingsSchema = z.object({
943
+ /**
944
+ * The ID of the translation.
945
+ */
946
+ translationId: z.string().meta({
947
+ description: "The ID of the translation."
948
+ }),
949
+ /**
950
+ * The ID of the book.
951
+ */
952
+ bookId: z.string().meta({
953
+ description: "The ID of the book."
954
+ }),
955
+ /**
956
+ * The number of the chapter.
957
+ */
958
+ chapterNumber: z.number().meta({
959
+ description: "The number of the chapter."
960
+ }),
961
+ /**
962
+ * The reader for the chapter.
963
+ */
964
+ reader: z.string().meta({
965
+ description: "The reader for the chapter."
966
+ }),
967
+ /**
968
+ * The link to the audio for these timings.
969
+ */
970
+ audioLink: z.string().meta({
971
+ description: "The link to the audio for these timings."
972
+ }),
973
+ /**
974
+ * The link to the information for this chapter.
975
+ */
976
+ thisChapterLink: z.string().meta({
977
+ description: "The link to the information for this chapter."
978
+ }),
979
+ /**
980
+ * The link to the information for the next chapter.
981
+ * Null if this is the last chapter in the translation.
982
+ */
983
+ nextChapterLink: z.string().nullable().meta({
984
+ description: "The link to the information for the next chapter. Null if this is the last chapter in the translation."
985
+ }),
986
+ /**
987
+ * The link to the information for the previous chapter.
988
+ * Null if this is the first chapter in the translation.
989
+ */
990
+ previousChapterLink: z.string().nullable().meta({
991
+ description: "The link to the information for the previous chapter. Null if this is the first chapter in the translation."
992
+ }),
993
+ /**
994
+ * The link to this audio timings file.
995
+ */
996
+ thisChapterAudioTimingsLink: z.string().meta({
997
+ description: "The link to this audio timings file."
998
+ }),
999
+ /**
1000
+ * The link to the timings for the next chapter.
1001
+ * Null if this is the last chapter in the translation.
1002
+ */
1003
+ nextChapterAudioTimingsLink: z.string().nullable().meta({
1004
+ description: "The link to the timings for the next chapter. Null if this is the last chapter in the translation."
1005
+ }),
1006
+ /**
1007
+ * The link to the timings for the previous chapter.
1008
+ * Null if this is the first chapter in the translation.
1009
+ */
1010
+ previousChapterAudioTimingsLink: z.string().nullable().meta({
1011
+ description: "The link to the timings for the previous chapter. Null if this is the first chapter in the translation."
1012
+ }),
1013
+ /**
1014
+ * The times in seconds at which each verse starts, in order.
1015
+ */
1016
+ verses: z.array(z.number()).meta({
1017
+ description: "The times in seconds at which each verse starts, in order. The first number (index 0) is the time in the recording at which the first verse starts."
1018
+ })
1019
+ }).meta({
1020
+ id: "ApiTranslationBookChapterAudioTimings",
1021
+ description: "Defines an interface that contains the audio timings for a book chapter, for a specific reader."
1022
+ });
1023
+ export const ApiTranslationBookChapterWordsSchema = z.object({
1024
+ /**
1025
+ * The ID of the translation.
1026
+ */
1027
+ translationId: z.string().meta({
1028
+ description: "The ID of the translation."
1029
+ }),
1030
+ /**
1031
+ * The ID of the book.
1032
+ */
1033
+ bookId: z.string().meta({
1034
+ description: "The ID of the book."
1035
+ }),
1036
+ /**
1037
+ * The number of the chapter.
1038
+ */
1039
+ chapterNumber: z.number().meta({
1040
+ description: "The number of the chapter."
1041
+ }),
1042
+ /**
1043
+ * The link to the information for this chapter.
1044
+ */
1045
+ thisChapterLink: z.string().meta({
1046
+ description: "The link to the information for this chapter."
1047
+ }),
1048
+ /**
1049
+ * The link to the information for the next chapter.
1050
+ * Null if this is the last chapter in the translation.
1051
+ */
1052
+ nextChapterLink: z.string().nullable().meta({
1053
+ description: "The link to the information for the next chapter. Null if this is the last chapter in the translation."
1054
+ }),
1055
+ /**
1056
+ * The link to the information for the previous chapter.
1057
+ * Null if this is the first chapter in the translation.
1058
+ */
1059
+ previousChapterLink: z.string().nullable().meta({
1060
+ description: "The link to the information for the previous chapter. Null if this is the first chapter in the translation."
1061
+ }),
1062
+ /**
1063
+ * The link to this words file.
1064
+ */
1065
+ thisChapterWordsLink: z.string().meta({
1066
+ description: "The link to this words file."
1067
+ }),
1068
+ /**
1069
+ * The link to the words for the next chapter.
1070
+ * Null if this is the last chapter in the translation, or if the next chapter
1071
+ * doesn't have any word-level annotations.
1072
+ */
1073
+ nextChapterWordsLink: z.string().nullable().meta({
1074
+ description: "The link to the words for the next chapter. Null if this is the last chapter in the translation, or if the next chapter doesn't have any word-level annotations."
1075
+ }),
1076
+ /**
1077
+ * The link to the words for the previous chapter.
1078
+ * Null if this is the first chapter in the translation, or if the previous
1079
+ * chapter doesn't have any word-level annotations.
1080
+ */
1081
+ previousChapterWordsLink: z.string().nullable().meta({
1082
+ description: "The link to the words for the previous chapter. Null if this is the first chapter in the translation, or if the previous chapter doesn't have any word-level annotations."
1083
+ }),
1084
+ /**
1085
+ * The annotated words for each verse in the chapter.
1086
+ */
1087
+ verses: z.record(z.string(), z.array(z.lazy(() => ChapterWordSchema))).meta({
1088
+ description: "The annotated words for each verse in the chapter, keyed by verse number. Each list is in the order that the words occur in the verse."
1089
+ })
1090
+ }).meta({
1091
+ id: "ApiTranslationBookChapterWords",
1092
+ description: "Defines an interface that contains the word-level annotations for a book chapter."
1093
+ });
1094
+ export const ApiSimpleTranslationBookChapterWordsSchema = ApiTranslationBookChapterWordsSchema.extend({
1095
+ /**
1096
+ * The annotated words for each verse in the chapter.
1097
+ */
1098
+ verses: z.record(z.string(), z.array(z.lazy(() => SimpleChapterWordSchema))).meta({
1099
+ description: "The annotated words for each verse in the chapter, keyed by verse number. Each list is in the order that the words occur in the verse. The offsets are into the text of the simplified verse."
1100
+ })
1101
+ }).meta({
1102
+ id: "ApiSimpleTranslationBookChapterWords",
1103
+ description: "Defines an interface that contains the word-level annotations for a book chapter, with their offsets remapped onto the text of each simplified verse."
1104
+ });
1105
+ export const ApiCommentaryProfileContentSchema = z.object({
1106
+ /**
1107
+ * The commentary information for the profile.
1108
+ */
1109
+ commentary: z.lazy(() => ApiCommentarySchema).meta({
1110
+ description: "The commentary information for the profile."
1111
+ }),
1112
+ /**
1113
+ * The information about the profile.
1114
+ */
1115
+ profile: z.lazy(() => ApiCommentaryProfileSchema).meta({
1116
+ description: "The information about the profile."
1117
+ }),
1118
+ /**
1119
+ * The content of the profile.
1120
+ */
1121
+ content: z.array(z.string()).meta({
1122
+ description: "The content of the profile. This is an array of strings, where each string is a paragraph of the profile content."
1123
+ })
1124
+ });
2
1125
  export function generateApiForDataset(dataset, options = {}) {
3
1126
  const { useCommonName, pathPrefix } = options;
4
1127
  const apiPathPrefix = pathPrefix ? pathPrefix : "";
1128
+ const generateSimpleChapterFiles = !!options.generateSimpleChapterFiles;
5
1129
  let api = {
6
1130
  availableTranslations: {
7
1131
  translations: []
@@ -9,7 +1133,10 @@ export function generateApiForDataset(dataset, options = {}) {
9
1133
  translationBooks: [],
10
1134
  translationBookChapters: [],
11
1135
  translationBookChapterAudio: [],
1136
+ translationBookChapterAudioTimings: [],
1137
+ translationBookChapterWords: [],
12
1138
  translationComplete: [],
1139
+ simpleTranslationComplete: [],
13
1140
  availableCommentaries: {
14
1141
  commentaries: []
15
1142
  },
@@ -19,6 +1146,11 @@ export function generateApiForDataset(dataset, options = {}) {
19
1146
  commentaryProfileContents: [],
20
1147
  pathPrefix: apiPathPrefix
21
1148
  };
1149
+ if (generateSimpleChapterFiles) {
1150
+ api.simpleTranslationBookChapters = [];
1151
+ api.simpleTranslationBookChapterWords = [];
1152
+ api.simpleCommentaryBookChapters = [];
1153
+ }
22
1154
  const getNativeName = options.getNativeName;
23
1155
  const getEnglishName = options.getEnglishName;
24
1156
  for (let { books, ...translation } of dataset.translations) {
@@ -39,6 +1171,11 @@ export function generateApiForDataset(dataset, options = {}) {
39
1171
  apiPathPrefix
40
1172
  ),
41
1173
  completeTranslationApiLink: options.generateCompleteTranslationFiles ? completeTranslationApiLink(translation.id, apiPathPrefix) : void 0,
1174
+ simpleCompleteTranslationApiLink: options.generateCompleteTranslationFiles ? completeTranslationApiLink(
1175
+ translation.id,
1176
+ apiPathPrefix,
1177
+ SIMPLE_JSON_EXTENSION
1178
+ ) : void 0,
42
1179
  numberOfBooks,
43
1180
  totalNumberOfChapters: 0,
44
1181
  totalNumberOfVerses: 0,
@@ -53,9 +1190,12 @@ export function generateApiForDataset(dataset, options = {}) {
53
1190
  books: []
54
1191
  };
55
1192
  let translationChapters = [];
1193
+ let pendingAudioTimings = [];
1194
+ let rawAudioTimingsByChapter = /* @__PURE__ */ new Map();
1195
+ let rawWordsByChapter = /* @__PURE__ */ new Map();
56
1196
  for (let { chapters, ...book } of books) {
57
- const firstChapterNumber = chapters[0].chapter.number;
58
- const lastChapterNumber = chapters[chapters.length - 1].chapter.number;
1197
+ const firstChapterNumber = chapters[0]?.chapter.number;
1198
+ const lastChapterNumber = chapters[chapters.length - 1]?.chapter.number;
59
1199
  const apiBook = {
60
1200
  ...book,
61
1201
  firstChapterNumber,
@@ -66,6 +1206,11 @@ export function generateApiForDataset(dataset, options = {}) {
66
1206
  "json",
67
1207
  apiPathPrefix
68
1208
  ),
1209
+ firstChapterReference: {
1210
+ translationId: translation.id,
1211
+ book: book.id,
1212
+ chapter: firstChapterNumber
1213
+ },
69
1214
  lastChapterNumber,
70
1215
  lastChapterApiLink: bookChapterApiLink(
71
1216
  translation.id,
@@ -74,11 +1219,22 @@ export function generateApiForDataset(dataset, options = {}) {
74
1219
  "json",
75
1220
  apiPathPrefix
76
1221
  ),
1222
+ lastChapterReference: {
1223
+ translationId: translation.id,
1224
+ book: book.id,
1225
+ chapter: lastChapterNumber
1226
+ },
77
1227
  numberOfChapters: chapters.length,
78
1228
  totalNumberOfVerses: 0
79
1229
  };
80
- for (let { chapter, thisChapterAudioLinks } of chapters) {
1230
+ for (let {
1231
+ chapter,
1232
+ thisChapterAudioLinks,
1233
+ thisChapterAudioTimings,
1234
+ thisChapterWords
1235
+ } of chapters) {
81
1236
  const audio = {};
1237
+ const audioTimings = {};
82
1238
  const apiBookChapter = {
83
1239
  translation: apiTranslation,
84
1240
  book: apiBook,
@@ -90,12 +1246,29 @@ export function generateApiForDataset(dataset, options = {}) {
90
1246
  "json",
91
1247
  apiPathPrefix
92
1248
  ),
1249
+ thisChapterReference: {
1250
+ translationId: translation.id,
1251
+ book: book.id,
1252
+ chapter: chapter.number
1253
+ },
93
1254
  thisChapterAudioLinks: audio,
94
1255
  nextChapterApiLink: null,
1256
+ nextChapterReference: null,
95
1257
  nextChapterAudioLinks: null,
96
1258
  previousChapterApiLink: null,
1259
+ previousChapterReference: null,
97
1260
  previousChapterAudioLinks: null,
98
- numberOfVerses: 0
1261
+ thisChapterAudioTimings: audioTimings,
1262
+ nextChapterAudioTimings: null,
1263
+ previousChapterAudioTimings: null,
1264
+ numberOfVerses: 0,
1265
+ simpleChapterApiLink: generateSimpleChapterFiles ? bookChapterApiLink(
1266
+ translation.id,
1267
+ getBookLink(book),
1268
+ chapter.number,
1269
+ SIMPLE_JSON_EXTENSION,
1270
+ apiPathPrefix
1271
+ ) : void 0
99
1272
  };
100
1273
  for (let reader in thisChapterAudioLinks) {
101
1274
  if (options.generateAudioFiles) {
@@ -116,6 +1289,34 @@ export function generateApiForDataset(dataset, options = {}) {
116
1289
  audio[reader] = thisChapterAudioLinks[reader];
117
1290
  }
118
1291
  }
1292
+ rawAudioTimingsByChapter.set(
1293
+ apiBookChapter,
1294
+ thisChapterAudioTimings
1295
+ );
1296
+ if (thisChapterWords) {
1297
+ apiBookChapter.thisChapterWordsLink = bookChapterWordsApiLink(
1298
+ translation.id,
1299
+ getBookLink(book),
1300
+ chapter.number,
1301
+ apiPathPrefix
1302
+ );
1303
+ rawWordsByChapter.set(apiBookChapter, thisChapterWords);
1304
+ }
1305
+ for (let reader in thisChapterAudioTimings) {
1306
+ const verses = thisChapterAudioTimings[reader];
1307
+ audioTimings[reader] = bookChapterAudioTimingsApiLink(
1308
+ translation.id,
1309
+ getBookLink(book),
1310
+ chapter.number,
1311
+ reader,
1312
+ apiPathPrefix
1313
+ );
1314
+ pendingAudioTimings.push({
1315
+ reader,
1316
+ verses,
1317
+ apiBookChapter
1318
+ });
1319
+ }
119
1320
  for (let c of chapter.content) {
120
1321
  if (c.type === "verse") {
121
1322
  apiBookChapter.numberOfVerses++;
@@ -141,54 +1342,226 @@ export function generateApiForDataset(dataset, options = {}) {
141
1342
  }
142
1343
  }
143
1344
  for (let i = 0; i < translationChapters.length; i++) {
1345
+ const currentChapter = translationChapters[i];
144
1346
  if (i > 0) {
145
- translationChapters[i].previousChapterApiLink = bookChapterApiLink(
1347
+ const previousChapter = translationChapters[i - 1];
1348
+ currentChapter.previousChapterApiLink = bookChapterApiLink(
146
1349
  translation.id,
147
- getBookLink(translationChapters[i - 1].book),
148
- translationChapters[i - 1].chapter.number,
1350
+ getBookLink(previousChapter.book),
1351
+ previousChapter.chapter.number,
149
1352
  "json",
150
1353
  apiPathPrefix
151
1354
  );
152
- translationChapters[i].previousChapterAudioLinks = translationChapters[i - 1].thisChapterAudioLinks;
1355
+ currentChapter.previousChapterReference = {
1356
+ translationId: translation.id,
1357
+ book: previousChapter.book.id,
1358
+ chapter: previousChapter.chapter.number
1359
+ };
1360
+ currentChapter.previousChapterAudioLinks = previousChapter.thisChapterAudioLinks;
1361
+ currentChapter.previousChapterAudioTimings = previousChapter.thisChapterAudioTimings;
1362
+ if (previousChapter.thisChapterWordsLink) {
1363
+ currentChapter.previousChapterWordsLink = previousChapter.thisChapterWordsLink;
1364
+ }
153
1365
  }
154
1366
  if (i < translationChapters.length - 1) {
155
- translationChapters[i].nextChapterApiLink = bookChapterApiLink(
1367
+ const nextChapter = translationChapters[i + 1];
1368
+ currentChapter.nextChapterApiLink = bookChapterApiLink(
156
1369
  translation.id,
157
- getBookLink(translationChapters[i + 1].book),
158
- translationChapters[i + 1].chapter.number,
1370
+ getBookLink(nextChapter.book),
1371
+ nextChapter.chapter.number,
159
1372
  "json",
160
1373
  apiPathPrefix
161
1374
  );
162
- translationChapters[i].nextChapterAudioLinks = translationChapters[i + 1].thisChapterAudioLinks;
1375
+ currentChapter.nextChapterReference = {
1376
+ translationId: translation.id,
1377
+ book: nextChapter.book.id,
1378
+ chapter: nextChapter.chapter.number
1379
+ };
1380
+ currentChapter.nextChapterAudioLinks = nextChapter.thisChapterAudioLinks;
1381
+ currentChapter.nextChapterAudioTimings = nextChapter.thisChapterAudioTimings;
1382
+ if (nextChapter.thisChapterWordsLink) {
1383
+ currentChapter.nextChapterWordsLink = nextChapter.thisChapterWordsLink;
1384
+ }
1385
+ }
1386
+ }
1387
+ const simplifiedChapters = /* @__PURE__ */ new Map();
1388
+ if (generateSimpleChapterFiles || options.generateCompleteTranslationFiles) {
1389
+ for (let chapter of translationChapters) {
1390
+ simplifiedChapters.set(
1391
+ chapter,
1392
+ simplifyChapter(
1393
+ chapter.chapter,
1394
+ rawWordsByChapter.get(chapter)
1395
+ )
1396
+ );
1397
+ }
1398
+ }
1399
+ if (api.simpleTranslationBookChapters) {
1400
+ let hasSimpleWords2 = function(chapter) {
1401
+ const words = simplifiedChapters.get(chapter)?.words;
1402
+ return !!words && Object.keys(words).length > 0;
1403
+ };
1404
+ var hasSimpleWords = hasSimpleWords2;
1405
+ const simpleChapterLink = (chapter) => bookChapterApiLink(
1406
+ translation.id,
1407
+ getBookLink(chapter.book),
1408
+ chapter.chapter.number,
1409
+ SIMPLE_JSON_EXTENSION,
1410
+ apiPathPrefix
1411
+ );
1412
+ const simpleWordsLink = (chapter) => hasSimpleWords2(chapter) ? bookChapterWordsApiLink(
1413
+ translation.id,
1414
+ getBookLink(chapter.book),
1415
+ chapter.chapter.number,
1416
+ apiPathPrefix,
1417
+ SIMPLE_JSON_EXTENSION
1418
+ ) : void 0;
1419
+ for (let i = 0; i < translationChapters.length; i++) {
1420
+ const currentChapter = translationChapters[i];
1421
+ const {
1422
+ chapter,
1423
+ simpleChapterApiLink,
1424
+ thisChapterWordsLink,
1425
+ nextChapterWordsLink,
1426
+ previousChapterWordsLink,
1427
+ ...rest
1428
+ } = currentChapter;
1429
+ const previousChapter = translationChapters[i - 1];
1430
+ const nextChapter = translationChapters[i + 1];
1431
+ const simplified = simplifiedChapters.get(currentChapter);
1432
+ const simpleChapter = {
1433
+ ...rest,
1434
+ chapter: simplified.chapter,
1435
+ thisChapterLink: simpleChapterLink(currentChapter),
1436
+ fullChapterApiLink: rest.thisChapterLink,
1437
+ previousChapterApiLink: previousChapter ? simpleChapterLink(previousChapter) : null,
1438
+ nextChapterApiLink: nextChapter ? simpleChapterLink(nextChapter) : null
1439
+ };
1440
+ const thisWordsLink = simpleWordsLink(currentChapter);
1441
+ if (thisWordsLink) {
1442
+ simpleChapter.thisChapterWordsLink = thisWordsLink;
1443
+ api.simpleTranslationBookChapterWords?.push({
1444
+ translationId: translation.id,
1445
+ bookId: currentChapter.book.id,
1446
+ chapterNumber: currentChapter.chapter.number,
1447
+ thisChapterLink: simpleChapter.thisChapterLink,
1448
+ nextChapterLink: simpleChapter.nextChapterApiLink,
1449
+ previousChapterLink: simpleChapter.previousChapterApiLink,
1450
+ thisChapterWordsLink: thisWordsLink,
1451
+ nextChapterWordsLink: nextChapter ? simpleWordsLink(nextChapter) ?? null : null,
1452
+ previousChapterWordsLink: previousChapter ? simpleWordsLink(previousChapter) ?? null : null,
1453
+ verses: simplified.words
1454
+ });
1455
+ }
1456
+ const nextWordsLink = nextChapter ? simpleWordsLink(nextChapter) : void 0;
1457
+ if (nextWordsLink) {
1458
+ simpleChapter.nextChapterWordsLink = nextWordsLink;
1459
+ }
1460
+ const previousWordsLink = previousChapter ? simpleWordsLink(previousChapter) : void 0;
1461
+ if (previousWordsLink) {
1462
+ simpleChapter.previousChapterWordsLink = previousWordsLink;
1463
+ }
1464
+ api.simpleTranslationBookChapters.push(simpleChapter);
1465
+ }
1466
+ }
1467
+ for (let { reader, verses, apiBookChapter } of pendingAudioTimings) {
1468
+ api.translationBookChapterAudioTimings.push({
1469
+ translationId: translation.id,
1470
+ bookId: apiBookChapter.book.id,
1471
+ chapterNumber: apiBookChapter.chapter.number,
1472
+ reader,
1473
+ audioLink: apiBookChapter.thisChapterAudioLinks[reader] ?? "",
1474
+ thisChapterLink: apiBookChapter.thisChapterLink,
1475
+ nextChapterLink: apiBookChapter.nextChapterApiLink,
1476
+ previousChapterLink: apiBookChapter.previousChapterApiLink,
1477
+ thisChapterAudioTimingsLink: apiBookChapter.thisChapterAudioTimings[reader],
1478
+ nextChapterAudioTimingsLink: apiBookChapter.nextChapterAudioTimings?.[reader] ?? null,
1479
+ previousChapterAudioTimingsLink: apiBookChapter.previousChapterAudioTimings?.[reader] ?? null,
1480
+ verses
1481
+ });
1482
+ }
1483
+ for (let apiBookChapter of translationChapters) {
1484
+ const words = rawWordsByChapter.get(apiBookChapter);
1485
+ if (!words || !apiBookChapter.thisChapterWordsLink) {
1486
+ continue;
163
1487
  }
1488
+ api.translationBookChapterWords.push({
1489
+ translationId: translation.id,
1490
+ bookId: apiBookChapter.book.id,
1491
+ chapterNumber: apiBookChapter.chapter.number,
1492
+ thisChapterLink: apiBookChapter.thisChapterLink,
1493
+ nextChapterLink: apiBookChapter.nextChapterApiLink,
1494
+ previousChapterLink: apiBookChapter.previousChapterApiLink,
1495
+ thisChapterWordsLink: apiBookChapter.thisChapterWordsLink,
1496
+ nextChapterWordsLink: apiBookChapter.nextChapterWordsLink ?? null,
1497
+ previousChapterWordsLink: apiBookChapter.previousChapterWordsLink ?? null,
1498
+ verses: words
1499
+ });
164
1500
  }
165
1501
  api.availableTranslations.translations.push(apiTranslation);
166
1502
  api.translationBooks.push(translationBooks);
167
1503
  if (options.generateCompleteTranslationFiles) {
1504
+ const completeBooks = translationBooks.books.map((book) => ({
1505
+ book,
1506
+ chapters: translationChapters.filter(
1507
+ (ch) => ch.book.id === book.id
1508
+ )
1509
+ }));
1510
+ const completeBook = (book, chapters) => ({
1511
+ id: book.id,
1512
+ name: book.name,
1513
+ commonName: book.commonName,
1514
+ title: book.title,
1515
+ order: book.order,
1516
+ numberOfChapters: book.numberOfChapters,
1517
+ totalNumberOfVerses: book.totalNumberOfVerses,
1518
+ isApocryphal: book.isApocryphal,
1519
+ chapters
1520
+ });
1521
+ const completeChapter = (chapter) => ({
1522
+ numberOfVerses: chapter.numberOfVerses,
1523
+ thisChapterAudioLinks: chapter.thisChapterAudioLinks,
1524
+ // The complete files contain the raw audio timings rather than links
1525
+ // to them, since the point is to have everything in one file.
1526
+ thisChapterAudioTimings: rawAudioTimingsByChapter.get(chapter) ?? {}
1527
+ });
168
1528
  const completeTranslation = {
169
1529
  translation: apiTranslation,
170
- books: translationBooks.books.map((book) => {
171
- const bookChapters = translationChapters.filter(
172
- (ch) => ch.book.id === book.id
173
- );
174
- return {
175
- id: book.id,
176
- name: book.name,
177
- commonName: book.commonName,
178
- title: book.title,
179
- order: book.order,
180
- numberOfChapters: book.numberOfChapters,
181
- totalNumberOfVerses: book.totalNumberOfVerses,
182
- isApocryphal: book.isApocryphal,
183
- chapters: bookChapters.map((ch) => ({
184
- numberOfVerses: ch.numberOfVerses,
185
- thisChapterAudioLinks: ch.thisChapterAudioLinks,
186
- chapter: ch.chapter
187
- }))
188
- };
189
- })
1530
+ books: completeBooks.map(
1531
+ ({ book, chapters }) => completeBook(
1532
+ book,
1533
+ chapters.map((ch) => {
1534
+ const words = rawWordsByChapter.get(ch);
1535
+ return {
1536
+ ...completeChapter(ch),
1537
+ // The complete files also contain the word annotations
1538
+ // themselves rather than links to them.
1539
+ ...words ? { thisChapterWords: words } : {},
1540
+ chapter: ch.chapter
1541
+ };
1542
+ })
1543
+ )
1544
+ )
190
1545
  };
191
1546
  api.translationComplete.push(completeTranslation);
1547
+ const simpleCompleteTranslation = {
1548
+ translation: apiTranslation,
1549
+ books: completeBooks.map(
1550
+ ({ book, chapters }) => completeBook(
1551
+ book,
1552
+ chapters.map((ch) => {
1553
+ const simplified = simplifiedChapters.get(ch);
1554
+ const hasWords = Object.keys(simplified.words).length > 0;
1555
+ return {
1556
+ ...completeChapter(ch),
1557
+ ...hasWords ? { thisChapterWords: simplified.words } : {},
1558
+ chapter: simplified.chapter
1559
+ };
1560
+ })
1561
+ )
1562
+ )
1563
+ };
1564
+ api.simpleTranslationComplete.push(simpleCompleteTranslation);
192
1565
  }
193
1566
  }
194
1567
  for (let { books, profiles, ...commentary } of dataset.commentaries) {
@@ -233,6 +1606,11 @@ export function generateApiForDataset(dataset, options = {}) {
233
1606
  "json",
234
1607
  apiPathPrefix
235
1608
  ) : null,
1609
+ firstChapterReference: firstChapterNumber ? {
1610
+ commentaryId: commentary.id,
1611
+ book: book.id,
1612
+ chapter: firstChapterNumber
1613
+ } : null,
236
1614
  lastChapterNumber,
237
1615
  lastChapterApiLink: lastChapterNumber ? bookCommentaryChapterApiLink(
238
1616
  commentary.id,
@@ -241,6 +1619,11 @@ export function generateApiForDataset(dataset, options = {}) {
241
1619
  "json",
242
1620
  apiPathPrefix
243
1621
  ) : null,
1622
+ lastChapterReference: lastChapterNumber ? {
1623
+ commentaryId: commentary.id,
1624
+ book: book.id,
1625
+ chapter: lastChapterNumber
1626
+ } : null,
244
1627
  numberOfChapters: chapters.length,
245
1628
  totalNumberOfVerses: 0
246
1629
  };
@@ -256,9 +1639,23 @@ export function generateApiForDataset(dataset, options = {}) {
256
1639
  "json",
257
1640
  apiPathPrefix
258
1641
  ),
1642
+ thisChapterReference: {
1643
+ commentaryId: commentary.id,
1644
+ book: book.id,
1645
+ chapter: chapter.number
1646
+ },
259
1647
  nextChapterApiLink: null,
1648
+ nextChapterReference: null,
260
1649
  previousChapterApiLink: null,
261
- numberOfVerses: 0
1650
+ previousChapterReference: null,
1651
+ numberOfVerses: 0,
1652
+ simpleChapterApiLink: generateSimpleChapterFiles ? bookCommentaryChapterApiLink(
1653
+ commentary.id,
1654
+ getBookLink(book),
1655
+ chapter.number,
1656
+ SIMPLE_JSON_EXTENSION,
1657
+ apiPathPrefix
1658
+ ) : void 0
262
1659
  };
263
1660
  for (let c of chapter.content) {
264
1661
  if (c.type === "verse") {
@@ -312,6 +1709,11 @@ export function generateApiForDataset(dataset, options = {}) {
312
1709
  "json",
313
1710
  apiPathPrefix
314
1711
  );
1712
+ commentaryChapters[i].previousChapterReference = {
1713
+ commentaryId: commentary.id,
1714
+ book: commentaryChapters[i - 1].book.id,
1715
+ chapter: commentaryChapters[i - 1].chapter.number
1716
+ };
315
1717
  }
316
1718
  if (i < commentaryChapters.length - 1) {
317
1719
  commentaryChapters[i].nextChapterApiLink = bookCommentaryChapterApiLink(
@@ -321,6 +1723,33 @@ export function generateApiForDataset(dataset, options = {}) {
321
1723
  "json",
322
1724
  apiPathPrefix
323
1725
  );
1726
+ commentaryChapters[i].nextChapterReference = {
1727
+ commentaryId: commentary.id,
1728
+ book: commentaryChapters[i + 1].book.id,
1729
+ chapter: commentaryChapters[i + 1].chapter.number
1730
+ };
1731
+ }
1732
+ }
1733
+ if (api.simpleCommentaryBookChapters) {
1734
+ const simpleChapterLink = (chapter) => bookCommentaryChapterApiLink(
1735
+ commentary.id,
1736
+ getBookLink(chapter.book),
1737
+ chapter.chapter.number,
1738
+ SIMPLE_JSON_EXTENSION,
1739
+ apiPathPrefix
1740
+ );
1741
+ for (let i = 0; i < commentaryChapters.length; i++) {
1742
+ const { chapter, simpleChapterApiLink, ...currentChapter } = commentaryChapters[i];
1743
+ const previousChapter = commentaryChapters[i - 1];
1744
+ const nextChapter = commentaryChapters[i + 1];
1745
+ api.simpleCommentaryBookChapters.push({
1746
+ ...currentChapter,
1747
+ chapter: simplifyCommentaryChapter(chapter),
1748
+ thisChapterLink: simpleChapterLink(commentaryChapters[i]),
1749
+ fullChapterApiLink: currentChapter.thisChapterLink,
1750
+ previousChapterApiLink: previousChapter ? simpleChapterLink(previousChapter) : null,
1751
+ nextChapterApiLink: nextChapter ? simpleChapterLink(nextChapter) : null
1752
+ });
324
1753
  }
325
1754
  }
326
1755
  api.availableCommentaries.commentaries.push(apiCommentary);
@@ -360,6 +1789,11 @@ export function generateApiForDataset(dataset, options = {}) {
360
1789
  "json",
361
1790
  apiPathPrefix
362
1791
  ),
1792
+ firstChapterReference: {
1793
+ datasetId: datasetInfo.id,
1794
+ book: book.id,
1795
+ chapter: firstChapterNumber
1796
+ },
363
1797
  lastChapterNumber,
364
1798
  lastChapterApiLink: bookDatasetChapterApiLink(
365
1799
  datasetInfo.id,
@@ -368,6 +1802,11 @@ export function generateApiForDataset(dataset, options = {}) {
368
1802
  "json",
369
1803
  apiPathPrefix
370
1804
  ),
1805
+ lastChapterReference: {
1806
+ datasetId: datasetInfo.id,
1807
+ book: book.id,
1808
+ chapter: lastChapterNumber
1809
+ },
371
1810
  numberOfChapters: chapters.length,
372
1811
  totalNumberOfVerses: 0,
373
1812
  totalNumberOfReferences: 0
@@ -384,8 +1823,15 @@ export function generateApiForDataset(dataset, options = {}) {
384
1823
  "json",
385
1824
  apiPathPrefix
386
1825
  ),
1826
+ thisChapterReference: {
1827
+ datasetId: datasetInfo.id,
1828
+ book: book.id,
1829
+ chapter: chapter.number
1830
+ },
387
1831
  nextChapterApiLink: null,
1832
+ nextChapterReference: null,
388
1833
  previousChapterApiLink: null,
1834
+ previousChapterReference: null,
389
1835
  numberOfVerses: chapter.content.length,
390
1836
  numberOfReferences: 0
391
1837
  };
@@ -414,6 +1860,11 @@ export function generateApiForDataset(dataset, options = {}) {
414
1860
  "json",
415
1861
  apiPathPrefix
416
1862
  );
1863
+ datasetChapters[i].previousChapterReference = {
1864
+ datasetId: datasetInfo.id,
1865
+ book: datasetChapters[i - 1].book.id,
1866
+ chapter: datasetChapters[i - 1].chapter.number
1867
+ };
417
1868
  }
418
1869
  if (i < datasetChapters.length - 1) {
419
1870
  datasetChapters[i].nextChapterApiLink = bookDatasetChapterApiLink(
@@ -423,6 +1874,11 @@ export function generateApiForDataset(dataset, options = {}) {
423
1874
  "json",
424
1875
  apiPathPrefix
425
1876
  );
1877
+ datasetChapters[i].nextChapterReference = {
1878
+ datasetId: datasetInfo.id,
1879
+ book: datasetChapters[i + 1].book.id,
1880
+ chapter: datasetChapters[i + 1].chapter.number
1881
+ };
426
1882
  }
427
1883
  }
428
1884
  if (!api.availableDatasets) {
@@ -461,9 +1917,21 @@ export function generateFilesForApi(api) {
461
1917
  for (let bookChapter of api.translationBookChapters) {
462
1918
  files.push(jsonFile(bookChapter.thisChapterLink, bookChapter));
463
1919
  }
1920
+ for (let bookChapter of api.simpleTranslationBookChapters ?? []) {
1921
+ files.push(jsonFile(bookChapter.thisChapterLink, bookChapter));
1922
+ }
464
1923
  for (let audio of api.translationBookChapterAudio) {
465
1924
  files.push(downloadedFile(audio.link, audio.originalUrl));
466
1925
  }
1926
+ for (let timings of api.translationBookChapterAudioTimings) {
1927
+ files.push(jsonFile(timings.thisChapterAudioTimingsLink, timings));
1928
+ }
1929
+ for (let words of api.translationBookChapterWords) {
1930
+ files.push(jsonFile(words.thisChapterWordsLink, words));
1931
+ }
1932
+ for (let words of api.simpleTranslationBookChapterWords ?? []) {
1933
+ files.push(jsonFile(words.thisChapterWordsLink, words));
1934
+ }
467
1935
  for (let complete of api.translationComplete) {
468
1936
  if (complete.translation.completeTranslationApiLink) {
469
1937
  files.push(
@@ -474,6 +1942,16 @@ export function generateFilesForApi(api) {
474
1942
  );
475
1943
  }
476
1944
  }
1945
+ for (let complete of api.simpleTranslationComplete) {
1946
+ if (complete.translation.simpleCompleteTranslationApiLink) {
1947
+ files.push(
1948
+ jsonFile(
1949
+ complete.translation.simpleCompleteTranslationApiLink,
1950
+ complete
1951
+ )
1952
+ );
1953
+ }
1954
+ }
477
1955
  files.push(
478
1956
  jsonFile(
479
1957
  `${api.pathPrefix}/api/available_commentaries.json`,
@@ -505,6 +1983,9 @@ export function generateFilesForApi(api) {
505
1983
  for (let bookChapter of api.commentaryBookChapters) {
506
1984
  files.push(jsonFile(bookChapter.thisChapterLink, bookChapter));
507
1985
  }
1986
+ for (let bookChapter of api.simpleCommentaryBookChapters ?? []) {
1987
+ files.push(jsonFile(bookChapter.thisChapterLink, bookChapter));
1988
+ }
508
1989
  if (api.availableDatasets) {
509
1990
  files.push(
510
1991
  jsonFile(
@@ -540,8 +2021,8 @@ export async function* generateOutputFilesFromDatasets(datasets, options) {
540
2021
  export function listOfBooksApiLink(translationId, prefix = "") {
541
2022
  return `${prefix}/api/${translationId}/books.json`;
542
2023
  }
543
- export function completeTranslationApiLink(translationId, prefix = "") {
544
- return `${prefix}/api/${translationId}/complete.json`;
2024
+ export function completeTranslationApiLink(translationId, prefix = "", extension = "json") {
2025
+ return `${prefix}/api/${translationId}/complete.${extension}`;
545
2026
  }
546
2027
  export function listOfCommentaryBooksApiLink(commentaryId, prefix = "") {
547
2028
  return `${prefix}/api/c/${commentaryId}/books.json`;
@@ -549,6 +2030,7 @@ export function listOfCommentaryBooksApiLink(commentaryId, prefix = "") {
549
2030
  export function listOfDatasetBooksApiLink(datasetId, prefix = "") {
550
2031
  return `${prefix}/api/d/${datasetId}/books.json`;
551
2032
  }
2033
+ export const SIMPLE_JSON_EXTENSION = "simple.json";
552
2034
  export function bookChapterApiLink(translationId, commonName, chapterNumber, extension, prefix = "") {
553
2035
  return `${prefix}/api/${translationId}/${replaceSpacesWithUnderscores(
554
2036
  commonName
@@ -564,6 +2046,16 @@ export function bookChapterAudioApiLink(translationId, bookId, chapterNumber, re
564
2046
  bookId
565
2047
  )}/${chapterNumber}.${reader}.mp3`;
566
2048
  }
2049
+ export function bookChapterAudioTimingsApiLink(translationId, bookId, chapterNumber, reader, prefix = "") {
2050
+ return `${prefix}/api/${translationId}/${replaceSpacesWithUnderscores(
2051
+ bookId
2052
+ )}/${chapterNumber}.${reader}.audioTimings.json`;
2053
+ }
2054
+ export function bookChapterWordsApiLink(translationId, bookId, chapterNumber, prefix = "", extension = "json") {
2055
+ return `${prefix}/api/${translationId}/${replaceSpacesWithUnderscores(
2056
+ bookId
2057
+ )}/${chapterNumber}.words.${extension}`;
2058
+ }
567
2059
  export function bookDatasetChapterApiLink(translationId, commonName, chapterNumber, extension, prefix = "") {
568
2060
  return `${prefix}/api/d/${translationId}/${replaceSpacesWithUnderscores(
569
2061
  commonName