@helloao/tools 0.2.0 → 0.4.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 (81) hide show
  1. package/dist/cjs/generation/api.cjs +2213 -216
  2. package/dist/cjs/generation/api.cjs.map +3 -3
  3. package/dist/cjs/generation/audio.cjs +5 -5
  4. package/dist/cjs/generation/audio.cjs.map +1 -1
  5. package/dist/cjs/generation/book-order.cjs.map +1 -1
  6. package/dist/cjs/generation/common-types.cjs +782 -14
  7. package/dist/cjs/generation/common-types.cjs.map +2 -2
  8. package/dist/cjs/generation/dataset.cjs +13 -9
  9. package/dist/cjs/generation/dataset.cjs.map +2 -2
  10. package/dist/cjs/generation/index.cjs +8 -5
  11. package/dist/cjs/generation/index.cjs.map +2 -2
  12. package/dist/cjs/generation/simple.cjs +294 -0
  13. package/dist/cjs/generation/simple.cjs.map +7 -0
  14. package/dist/cjs/generation/theographic.cjs +446 -0
  15. package/dist/cjs/generation/theographic.cjs.map +7 -0
  16. package/dist/cjs/index.cjs +4 -4
  17. package/dist/cjs/index.cjs.map +1 -1
  18. package/dist/cjs/log.cjs.map +1 -1
  19. package/dist/cjs/parser/codex-parser.cjs +3 -3
  20. package/dist/cjs/parser/codex-parser.cjs.map +3 -3
  21. package/dist/cjs/parser/commentary-csv-parser.cjs +14 -3
  22. package/dist/cjs/parser/commentary-csv-parser.cjs.map +3 -3
  23. package/dist/cjs/parser/index.cjs +1 -1
  24. package/dist/cjs/parser/iterators.cjs.map +1 -1
  25. package/dist/cjs/parser/lockman-parser.cjs +1 -1
  26. package/dist/cjs/parser/lockman-parser.cjs.map +1 -1
  27. package/dist/cjs/parser/tyndale-xml-parser.cjs +1 -1
  28. package/dist/cjs/parser/tyndale-xml-parser.cjs.map +1 -1
  29. package/dist/cjs/parser/types.cjs.map +1 -1
  30. package/dist/cjs/parser/usfm-parser.cjs +2 -2
  31. package/dist/cjs/parser/usfm-parser.cjs.map +1 -1
  32. package/dist/cjs/parser/usx-parser.cjs +122 -26
  33. package/dist/cjs/parser/usx-parser.cjs.map +2 -2
  34. package/dist/cjs/parser/words.cjs +187 -0
  35. package/dist/cjs/parser/words.cjs.map +7 -0
  36. package/dist/cjs/utils.cjs +1 -1
  37. package/dist/esm/generation/api.js +2155 -214
  38. package/dist/esm/generation/api.js.map +3 -3
  39. package/dist/esm/generation/audio.js +1 -1
  40. package/dist/esm/generation/audio.js.map +1 -1
  41. package/dist/esm/generation/book-order.js.map +1 -1
  42. package/dist/esm/generation/common-types.js +738 -14
  43. package/dist/esm/generation/common-types.js.map +2 -2
  44. package/dist/esm/generation/dataset.js +6 -2
  45. package/dist/esm/generation/dataset.js.map +2 -2
  46. package/dist/esm/generation/index.js +2 -1
  47. package/dist/esm/generation/index.js.map +2 -2
  48. package/dist/esm/generation/simple.js +260 -0
  49. package/dist/esm/generation/simple.js.map +7 -0
  50. package/dist/esm/generation/theographic.js +412 -0
  51. package/dist/esm/generation/theographic.js.map +7 -0
  52. package/dist/esm/index.js.map +1 -1
  53. package/dist/esm/log.js.map +1 -1
  54. package/dist/esm/parser/codex-parser.js +3 -3
  55. package/dist/esm/parser/codex-parser.js.map +3 -3
  56. package/dist/esm/parser/commentary-csv-parser.js +3 -2
  57. package/dist/esm/parser/commentary-csv-parser.js.map +2 -2
  58. package/dist/esm/parser/iterators.js.map +1 -1
  59. package/dist/esm/parser/lockman-parser.js +1 -1
  60. package/dist/esm/parser/lockman-parser.js.map +1 -1
  61. package/dist/esm/parser/tyndale-xml-parser.js +1 -1
  62. package/dist/esm/parser/tyndale-xml-parser.js.map +1 -1
  63. package/dist/esm/parser/usfm-parser.js +1 -1
  64. package/dist/esm/parser/usfm-parser.js.map +1 -1
  65. package/dist/esm/parser/usx-parser.js +130 -26
  66. package/dist/esm/parser/usx-parser.js.map +2 -2
  67. package/dist/esm/parser/words.js +149 -0
  68. package/dist/esm/parser/words.js.map +7 -0
  69. package/dist/types/generation/api.d.ts +9006 -1101
  70. package/dist/types/generation/common-types.d.ts +1318 -106
  71. package/dist/types/generation/dataset.d.ts +17 -1
  72. package/dist/types/generation/index.d.ts +2 -1
  73. package/dist/types/generation/simple.d.ts +110 -0
  74. package/dist/types/generation/theographic.d.ts +64 -0
  75. package/dist/types/parser/commentary-csv-parser.d.ts +1 -1
  76. package/dist/types/parser/lockman-parser.d.ts +1 -1
  77. package/dist/types/parser/tyndale-xml-parser.d.ts +1 -1
  78. package/dist/types/parser/types.d.ts +63 -0
  79. package/dist/types/parser/usx-parser.d.ts +6 -5
  80. package/dist/types/parser/words.d.ts +104 -0
  81. package/package.json +3 -2
@@ -6,13 +6,27 @@ import {
6
6
  CommentaryProfileSchema,
7
7
  DatasetBookChapterSchema,
8
8
  DatasetBookSchema,
9
+ DatasetEventSchema,
10
+ DatasetPeopleGroupSchema,
11
+ DatasetPersonSchema,
12
+ DatasetPlaceSchema,
9
13
  DatasetSchema,
10
14
  TranslationSchema,
11
15
  TranslationBookSchema,
12
16
  TranslationBookChapterSchema,
13
- CommentarySchema
17
+ ChapterWordSchema,
18
+ CommentarySchema,
19
+ SimpleChapterDataSchema,
20
+ SimpleChapterWordSchema,
21
+ SimpleCommentaryChapterDataSchema,
22
+ SimpleTranslationBookChapterSchema
14
23
  } from "./common-types.js";
15
- import "zod-openapi";
24
+ import {
25
+ simplifyChapter,
26
+ simplifyCommentaryChapter
27
+ } from "./simple.js";
28
+ import { BookIdSchema } from "../utils.js";
29
+ import { bookOrderMap } from "./book-order.js";
16
30
  export const ApiAvailableTranslationsSchema = z.object({
17
31
  /**
18
32
  * The list of translations.
@@ -91,6 +105,62 @@ export const ApiDatasetSchema = DatasetSchema.extend({
91
105
  */
92
106
  languageEnglishName: z.string().optional().meta({
93
107
  description: "Gets the name of the language in English. Null or undefined if the language doesn't have an english name."
108
+ }),
109
+ /**
110
+ * The API link for the list of people for this dataset.
111
+ * Omitted if the dataset doesn't contain people.
112
+ */
113
+ listOfPeopleApiLink: z.string().optional().meta({
114
+ description: "The API link for the list of people for this dataset. Relative to the API origin. Omitted if the dataset doesn't contain people."
115
+ }),
116
+ /**
117
+ * The API link for the list of places for this dataset.
118
+ * Omitted if the dataset doesn't contain places.
119
+ */
120
+ listOfPlacesApiLink: z.string().optional().meta({
121
+ description: "The API link for the list of places for this dataset. Relative to the API origin. Omitted if the dataset doesn't contain places."
122
+ }),
123
+ /**
124
+ * The API link for the list of events for this dataset.
125
+ * Omitted if the dataset doesn't contain events.
126
+ */
127
+ listOfEventsApiLink: z.string().optional().meta({
128
+ description: "The API link for the list of events for this dataset. Relative to the API origin. Omitted if the dataset doesn't contain events."
129
+ }),
130
+ /**
131
+ * The API link for the list of people groups for this dataset.
132
+ * Omitted if the dataset doesn't contain people groups.
133
+ */
134
+ listOfPeopleGroupsApiLink: z.string().optional().meta({
135
+ description: "The API link for the list of people groups for this dataset. Relative to the API origin. Omitted if the dataset doesn't contain people groups."
136
+ }),
137
+ /**
138
+ * The total number of people that are contained in this dataset.
139
+ * Omitted if the dataset doesn't contain people.
140
+ */
141
+ totalNumberOfPeople: z.number().optional().meta({
142
+ description: "The total number of people that are contained in this dataset. Omitted if the dataset doesn't contain people."
143
+ }),
144
+ /**
145
+ * The total number of places that are contained in this dataset.
146
+ * Omitted if the dataset doesn't contain places.
147
+ */
148
+ totalNumberOfPlaces: z.number().optional().meta({
149
+ description: "The total number of places that are contained in this dataset. Omitted if the dataset doesn't contain places."
150
+ }),
151
+ /**
152
+ * The total number of events that are contained in this dataset.
153
+ * Omitted if the dataset doesn't contain events.
154
+ */
155
+ totalNumberOfEvents: z.number().optional().meta({
156
+ description: "The total number of events that are contained in this dataset. Omitted if the dataset doesn't contain events."
157
+ }),
158
+ /**
159
+ * The total number of people groups that are contained in this dataset.
160
+ * Omitted if the dataset doesn't contain people groups.
161
+ */
162
+ totalNumberOfPeopleGroups: z.number().optional().meta({
163
+ description: "The total number of people groups that are contained in this dataset. Omitted if the dataset doesn't contain people groups."
94
164
  })
95
165
  }).meta({
96
166
  id: "ApiDataset",
@@ -170,6 +240,15 @@ export const ApiTranslationSchema = TranslationSchema.extend({
170
240
  */
171
241
  completeTranslationApiLink: z.string().optional().meta({
172
242
  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."
243
+ }),
244
+ /**
245
+ * The API link for downloading the complete translation as a single JSON file,
246
+ * using the simplified chapter format.
247
+ *
248
+ * Undefined if complete translation files are not available.
249
+ */
250
+ simpleCompleteTranslationApiLink: z.string().optional().meta({
251
+ 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."
173
252
  })
174
253
  }).meta({
175
254
  id: "ApiTranslation",
@@ -192,6 +271,42 @@ export const ApiTranslationCompleteSchema = z.object({
192
271
  id: "ApiTranslationComplete",
193
272
  description: "Defines the complete translation download data. Maps to the /api/:translationId/complete.json endpoint."
194
273
  });
274
+ export const TranslationCompleteChapterSchema = TranslationBookChapterSchema.omit({ thisChapterWords: true }).extend({
275
+ /**
276
+ * The number of verses that the chapter contains.
277
+ */
278
+ numberOfVerses: z.number().meta({
279
+ description: "The number of verses that the chapter contains."
280
+ }),
281
+ /**
282
+ * The link to the word-level annotations for the chapter.
283
+ * Omitted if the chapter doesn't have any word-level annotations.
284
+ */
285
+ thisChapterWordsLink: z.string().optional().meta({
286
+ 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."
287
+ })
288
+ }).meta({
289
+ id: "TranslationCompleteChapter",
290
+ description: "A chapter in the complete translation download."
291
+ });
292
+ export const SimpleTranslationCompleteChapterSchema = SimpleTranslationBookChapterSchema.omit({ thisChapterWords: true }).extend({
293
+ /**
294
+ * The number of verses that the chapter contains.
295
+ */
296
+ numberOfVerses: z.number().meta({
297
+ description: "The number of verses that the chapter contains."
298
+ }),
299
+ /**
300
+ * The link to the word-level annotations for the chapter.
301
+ * Omitted if the chapter doesn't have any word-level annotations.
302
+ */
303
+ thisChapterWordsLink: z.string().optional().meta({
304
+ 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."
305
+ })
306
+ }).meta({
307
+ id: "SimpleTranslationCompleteChapter",
308
+ description: "A chapter in the complete translation download, using the simplified chapter format."
309
+ });
195
310
  export const ApiTranslationCompleteBookSchema = TranslationBookSchema.extend({
196
311
  /**
197
312
  * The number of chapters in the book.
@@ -208,13 +323,41 @@ export const ApiTranslationCompleteBookSchema = TranslationBookSchema.extend({
208
323
  /**
209
324
  * The complete list of chapters with all content.
210
325
  */
211
- chapters: z.array(TranslationBookChapterSchema).meta({
326
+ chapters: z.array(TranslationCompleteChapterSchema).meta({
212
327
  description: "The complete list of chapters with all content."
213
328
  })
214
329
  }).meta({
215
330
  id: "ApiTranslationCompleteBook",
216
331
  description: "A book in the complete translation download."
217
332
  });
333
+ export const ApiSimpleTranslationCompleteSchema = z.object({
334
+ /**
335
+ * The translation metadata.
336
+ */
337
+ translation: z.lazy(() => ApiTranslationSchema).meta({
338
+ description: "The translation metadata."
339
+ }),
340
+ /**
341
+ * The complete list of books with all their chapters.
342
+ */
343
+ books: z.array(z.lazy(() => ApiSimpleTranslationCompleteBookSchema)).meta({
344
+ description: "The complete list of books with all their chapters."
345
+ })
346
+ }).meta({
347
+ id: "ApiSimpleTranslationComplete",
348
+ description: "Defines the complete translation download data, using the simplified chapter format. Maps to the /api/:translationId/complete.simple.json endpoint."
349
+ });
350
+ export const ApiSimpleTranslationCompleteBookSchema = ApiTranslationCompleteBookSchema.extend({
351
+ /**
352
+ * The complete list of chapters with all content.
353
+ */
354
+ chapters: z.array(SimpleTranslationCompleteChapterSchema).meta({
355
+ description: "The complete list of chapters with all content."
356
+ })
357
+ }).meta({
358
+ id: "ApiSimpleTranslationCompleteBook",
359
+ description: "A book in the complete translation download, using the simplified chapter format."
360
+ });
218
361
  export const ApiCommentarySchema = CommentarySchema.extend({
219
362
  /**
220
363
  * The API link for the list of available books for this translation.
@@ -333,253 +476,976 @@ export const ApiDatasetBooksSchema = z.object({
333
476
  id: "ApiDatasetBooks",
334
477
  description: "Defines an interface that contains information about the books that are available for a dataset."
335
478
  });
336
- export const ApiCommentaryProfilesSchema = z.object({
479
+ export const ApiDatasetPersonSummarySchema = z.object({
337
480
  /**
338
- * The commentary information for the books.
481
+ * The ID of the person.
339
482
  */
340
- commentary: z.lazy(() => ApiCommentarySchema).meta({
341
- description: "The commentary information for the profiles."
483
+ id: z.string().meta({
484
+ description: "The ID of the person."
342
485
  }),
343
486
  /**
344
- * The list of profiles that are available for the commentary.
487
+ * The name of the person.
345
488
  */
346
- profiles: z.array(z.lazy(() => ApiCommentaryProfileSchema)).meta({
347
- description: "The list of profiles that are available for the commentary."
489
+ name: z.string().meta({
490
+ description: "The name of the person."
491
+ }),
492
+ /**
493
+ * Whether the name of the person is a proper name.
494
+ */
495
+ isProperName: z.boolean().optional().meta({
496
+ description: "Whether the name of the person is a proper name."
497
+ }),
498
+ /**
499
+ * The gender of the person.
500
+ */
501
+ gender: z.string().optional().meta({
502
+ description: "The gender of the person."
503
+ }),
504
+ /**
505
+ * The number of Bible references that mention the person.
506
+ */
507
+ numberOfReferences: z.number().meta({
508
+ description: "The number of Bible references that mention the person."
509
+ }),
510
+ /**
511
+ * The API link for the person.
512
+ */
513
+ thisPersonApiLink: z.string().meta({
514
+ description: "The API link for the person. Relative to the API origin."
348
515
  })
349
516
  }).meta({
350
- id: "ApiCommentaryProfiles",
351
- description: "Defines an interface that contains information about the profiles that are available for a commentary."
517
+ id: "ApiDatasetPersonSummary",
518
+ description: "Defines a summary of a person in a dataset."
352
519
  });
353
- export const ApiCommentaryProfileSchema = CommentaryProfileSchema.extend({
520
+ export const ApiDatasetPeopleSchema = z.object({
354
521
  /**
355
- * The link to this profile.
522
+ * The dataset information for the people.
356
523
  */
357
- thisProfileLink: z.string().meta({
358
- description: "The API link for this profile. Relative to the API origin."
524
+ dataset: z.lazy(() => ApiDatasetSchema).meta({
525
+ description: "The dataset information for the people."
359
526
  }),
360
527
  /**
361
- * The link to the chapter that this profile references in the commentary.
528
+ * The list of people that are available for the dataset.
362
529
  */
363
- referenceChapterLink: z.string().nullable().meta({
364
- 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."
530
+ people: z.array(ApiDatasetPersonSummarySchema).meta({
531
+ description: "The list of people that are available for the dataset."
365
532
  })
366
533
  }).meta({
367
- id: "ApiCommentaryProfile",
368
- description: "Defines an interface that contains information about a profile."
534
+ id: "ApiDatasetPeople",
535
+ description: "The list of people in a dataset. Maps to the /api/d/:datasetId/people.json endpoint."
369
536
  });
370
- export const ApiTranslationBookSchema = TranslationBookSchema.extend({
537
+ export const ApiDatasetPersonSchema = z.object({
371
538
  /**
372
- * The number of the first chapter in the book.
539
+ * The dataset information for the person.
373
540
  */
374
- firstChapterNumber: z.number().meta({
375
- description: "The number of the first chapter in the book."
541
+ dataset: z.lazy(() => ApiDatasetSchema).meta({
542
+ description: "The dataset information for the person."
376
543
  }),
377
544
  /**
378
- * The link to the first chapter of the book.
545
+ * The information about the person.
379
546
  */
380
- firstChapterApiLink: z.string().meta({
381
- description: "The link to the first chapter of the book."
547
+ person: DatasetPersonSchema.meta({
548
+ description: "The information about the person."
382
549
  }),
383
550
  /**
384
- * The number of the last chapter in the book.
551
+ * The API link for this person.
385
552
  */
386
- lastChapterNumber: z.number().meta({
387
- description: "The number of the last chapter in the book."
388
- }),
553
+ thisPersonApiLink: z.string().meta({
554
+ description: "The API link for this person. Relative to the API origin."
555
+ })
556
+ }).meta({
557
+ id: "ApiDatasetPerson",
558
+ description: "The information about a person in a dataset. Maps to the /api/d/:datasetId/people/:personId.json endpoint."
559
+ });
560
+ export const ApiDatasetPlaceSummarySchema = z.object({
389
561
  /**
390
- * The link to the last chapter of the book.
562
+ * The ID of the place.
391
563
  */
392
- lastChapterApiLink: z.string().meta({
393
- description: "The link to the last chapter of the book."
564
+ id: z.string().meta({
565
+ description: "The ID of the place."
394
566
  }),
395
567
  /**
396
- * The number of chapters that the book contains.
568
+ * The name of the place.
397
569
  */
398
- numberOfChapters: z.number().meta({
399
- description: "The number of chapters that the book contains."
570
+ name: z.string().meta({
571
+ description: "The name of the place."
400
572
  }),
401
573
  /**
402
- * The number of verses that the book contains.
574
+ * The type of geographical feature that the place is.
403
575
  */
404
- totalNumberOfVerses: z.number().meta({
405
- description: "The number of verses that the book contains."
406
- })
407
- }).meta({
408
- id: "ApiTranslationBook",
409
- description: "Defines a schema that contains information about a translation book."
410
- });
411
- export const ApiCommentaryBookSchema = CommentaryBookSchema.extend({
576
+ featureType: z.string().optional().meta({
577
+ description: 'The type of geographical feature that the place is. For example, "City", "Region", "Mountain", "Water", etc.'
578
+ }),
412
579
  /**
413
- * The number of the first chapter in the book.
414
- *
415
- * Null if the comentary book has no chapters.
580
+ * The latitude of the place.
416
581
  */
417
- firstChapterNumber: z.number().nullable().meta({
418
- description: "The number of the first chapter in the book. Null if the comentary book has no chapters."
582
+ latitude: z.number().optional().meta({
583
+ description: "The latitude of the place."
419
584
  }),
420
585
  /**
421
- * The link to the first chapter of the book.
422
- *
423
- * Null if the comentary book has no chapters.
586
+ * The longitude of the place.
424
587
  */
425
- firstChapterApiLink: z.string().nullable().meta({
426
- description: "The link to the first chapter of the book. Null if the comentary book has no chapters."
588
+ longitude: z.number().optional().meta({
589
+ description: "The longitude of the place."
427
590
  }),
428
591
  /**
429
- * The number of the last chapter in the book.
430
- *
431
- * Null if the comentary book has no chapters.
592
+ * The number of Bible references that mention the place.
432
593
  */
433
- lastChapterNumber: z.number().nullable().meta({
434
- description: "The number of the last chapter in the book. Null if the comentary book has no chapters."
594
+ numberOfReferences: z.number().meta({
595
+ description: "The number of Bible references that mention the place."
435
596
  }),
436
597
  /**
437
- * The link to the last chapter of the book.
438
- *
439
- * Null if the comentary book has no chapters.
598
+ * The API link for the place.
440
599
  */
441
- lastChapterApiLink: z.string().nullable().meta({
442
- description: "The link to the last chapter of the book. Null if the comentary book has no chapters."
443
- }),
600
+ thisPlaceApiLink: z.string().meta({
601
+ description: "The API link for the place. Relative to the API origin."
602
+ })
603
+ }).meta({
604
+ id: "ApiDatasetPlaceSummary",
605
+ description: "Defines a summary of a place in a dataset."
606
+ });
607
+ export const ApiDatasetPlacesSchema = z.object({
444
608
  /**
445
- * The number of chapters that the book contains.
609
+ * The dataset information for the places.
446
610
  */
447
- numberOfChapters: z.number().meta({
448
- description: "The number of chapters that the book contains."
611
+ dataset: z.lazy(() => ApiDatasetSchema).meta({
612
+ description: "The dataset information for the places."
449
613
  }),
450
614
  /**
451
- * The number of verses that the book contains.
615
+ * The list of places that are available for the dataset.
452
616
  */
453
- totalNumberOfVerses: z.number().meta({
454
- description: "The number of verses that the book contains."
617
+ places: z.array(ApiDatasetPlaceSummarySchema).meta({
618
+ description: "The list of places that are available for the dataset."
455
619
  })
456
620
  }).meta({
457
- id: "ApiCommentaryBook",
458
- description: "Defines a schema that contains information about a commentary book."
621
+ id: "ApiDatasetPlaces",
622
+ description: "The list of places in a dataset. Maps to the /api/d/:datasetId/places.json endpoint."
459
623
  });
460
- export const ApiDatasetBookSchema = DatasetBookSchema.extend({
624
+ export const ApiDatasetPlaceSchema = z.object({
461
625
  /**
462
- * The number of the first chapter in the book.
626
+ * The dataset information for the place.
463
627
  */
464
- firstChapterNumber: z.number().meta({
465
- description: "The number of the first chapter in the book."
628
+ dataset: z.lazy(() => ApiDatasetSchema).meta({
629
+ description: "The dataset information for the place."
466
630
  }),
467
631
  /**
468
- * The link to the first chapter of the book.
632
+ * The information about the place.
469
633
  */
470
- firstChapterApiLink: z.string().meta({
471
- description: "The link to the first chapter of the book."
634
+ place: DatasetPlaceSchema.meta({
635
+ description: "The information about the place."
472
636
  }),
473
637
  /**
474
- * The number of the last chapter in the book.
638
+ * The API link for this place.
475
639
  */
476
- lastChapterNumber: z.number().meta({
477
- description: "The number of the last chapter in the book."
640
+ thisPlaceApiLink: z.string().meta({
641
+ description: "The API link for this place. Relative to the API origin."
642
+ })
643
+ }).meta({
644
+ id: "ApiDatasetPlace",
645
+ description: "The information about a place in a dataset. Maps to the /api/d/:datasetId/places/:placeId.json endpoint."
646
+ });
647
+ export const ApiDatasetEventSummarySchema = z.object({
648
+ /**
649
+ * The ID of the event.
650
+ */
651
+ id: z.string().meta({
652
+ description: "The ID of the event."
478
653
  }),
479
654
  /**
480
- * The link to the last chapter of the book.
655
+ * The name of the event.
481
656
  */
482
- lastChapterApiLink: z.string().meta({
483
- description: "The link to the last chapter of the book."
657
+ name: z.string().meta({
658
+ description: "The name of the event."
484
659
  }),
485
660
  /**
486
- * The number of chapters that the book contains.
661
+ * The date that the event started at.
487
662
  */
488
- numberOfChapters: z.number().meta({
489
- description: "The number of chapters that the book contains."
663
+ startDate: z.string().optional().meta({
664
+ description: "The date that the event started at. Negative numbers are years BC. Positive numbers are years AD. More specific dates use the `YYYY-MM-DD` format."
490
665
  }),
491
666
  /**
492
- * The number of verses that the book contains.
667
+ * The number of Bible references that describe the event.
493
668
  */
494
- totalNumberOfVerses: z.number().meta({
495
- description: "The number of verses that the book contains."
669
+ numberOfReferences: z.number().meta({
670
+ description: "The number of Bible references that describe the event."
496
671
  }),
497
672
  /**
498
- * The number of references that the book contains.
673
+ * The API link for the event.
499
674
  */
500
- totalNumberOfReferences: z.number().meta({
501
- description: "The number of references that the book contains."
675
+ thisEventApiLink: z.string().meta({
676
+ description: "The API link for the event. Relative to the API origin."
502
677
  })
503
678
  }).meta({
504
- id: "ApiDatasetBook",
505
- description: "Defines a schema that contains information about a book in a dataset."
679
+ id: "ApiDatasetEventSummary",
680
+ description: "Defines a summary of an event in a dataset."
506
681
  });
507
- export const ApiTranslationBookChapterSchema = TranslationBookChapterSchema.extend({
682
+ export const ApiDatasetEventsSchema = z.object({
508
683
  /**
509
- * The translation information for the book chapter.
684
+ * The dataset information for the events.
510
685
  */
511
- translation: z.lazy(() => ApiTranslationSchema).meta({
512
- description: "The translation information for the book chapter."
686
+ dataset: z.lazy(() => ApiDatasetSchema).meta({
687
+ description: "The dataset information for the events."
513
688
  }),
514
689
  /**
515
- * The book information for the book chapter.
690
+ * The list of events that are available for the dataset.
516
691
  */
517
- book: z.lazy(() => ApiTranslationBookSchema).meta({
518
- description: "The book information for the book chapter."
519
- }),
692
+ events: z.array(ApiDatasetEventSummarySchema).meta({
693
+ description: "The list of events that are available for the dataset."
694
+ })
695
+ }).meta({
696
+ id: "ApiDatasetEvents",
697
+ description: "The list of events in a dataset. Maps to the /api/d/:datasetId/events.json endpoint."
698
+ });
699
+ export const ApiDatasetEventSchema = z.object({
520
700
  /**
521
- * The link to this chapter.
701
+ * The dataset information for the event.
522
702
  */
523
- thisChapterLink: z.string().meta({
524
- description: "The API link for this chapter. Relative to the API origin."
703
+ dataset: z.lazy(() => ApiDatasetSchema).meta({
704
+ description: "The dataset information for the event."
525
705
  }),
526
706
  /**
527
- * The link to the next chapter.
528
- * Null if this is the last chapter in the translation.
707
+ * The information about the event.
529
708
  */
530
- nextChapterApiLink: z.string().nullable().meta({
531
- description: "The API link to the next chapter. Relative to the API origin. Null if this is the last chapter in the translation."
709
+ event: DatasetEventSchema.meta({
710
+ description: "The information about the event."
532
711
  }),
533
712
  /**
534
- * The links to the audio versions for the next chapter.
535
- * Null if this is the last chapter in the translation.
713
+ * The API link for this event.
536
714
  */
537
- nextChapterAudioLinks: z.record(z.string(), z.string()).nullable().meta({
538
- 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."
715
+ thisEventApiLink: z.string().meta({
716
+ description: "The API link for this event. Relative to the API origin."
717
+ })
718
+ }).meta({
719
+ id: "ApiDatasetEvent",
720
+ description: "The information about an event in a dataset. Maps to the /api/d/:datasetId/events/:eventId.json endpoint."
721
+ });
722
+ export const ApiDatasetPeopleGroupSummarySchema = z.object({
723
+ /**
724
+ * The ID of the people group.
725
+ */
726
+ id: z.string().meta({
727
+ description: "The ID of the people group."
539
728
  }),
540
729
  /**
541
- * The link to the previous chapter.
542
- * Null if this is the first chapter in the translation.
730
+ * The name of the people group.
543
731
  */
544
- previousChapterApiLink: z.string().nullable().meta({
545
- description: "The API link to the previous chapter. Relative to the API origin. Null if this is the first chapter in the translation."
732
+ name: z.string().meta({
733
+ description: "The name of the people group."
546
734
  }),
547
735
  /**
548
- * The links to the audio versions for the previous chapter.
549
- * Null if this is the first chapter in the translation.
736
+ * The number of people that are members of the people group.
550
737
  */
551
- previousChapterAudioLinks: z.record(z.string(), z.string()).nullable().meta({
552
- 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."
738
+ numberOfMembers: z.number().meta({
739
+ description: "The number of people that are members of the people group."
553
740
  }),
554
741
  /**
555
- * The number of verses that the chapter contains.
742
+ * The API link for the people group.
556
743
  */
557
- numberOfVerses: z.number().meta({
558
- description: "The number of verses that the chapter contains."
744
+ thisPeopleGroupApiLink: z.string().meta({
745
+ description: "The API link for the people group. Relative to the API origin."
559
746
  })
560
747
  }).meta({
561
- id: "ApiTranslationBookChapter",
562
- description: "Defines an interface that contains information about a book chapter in a translation."
748
+ id: "ApiDatasetPeopleGroupSummary",
749
+ description: "Defines a summary of a people group in a dataset."
563
750
  });
564
- export const ApiCommentaryBookChapterSchema = CommentaryBookChapterSchema.extend({
751
+ export const ApiDatasetPeopleGroupsSchema = z.object({
565
752
  /**
566
- * The commentary information for the book chapter.
753
+ * The dataset information for the people groups.
567
754
  */
568
- commentary: z.lazy(() => ApiCommentarySchema).meta({
569
- description: "The commentary information for the book chapter."
755
+ dataset: z.lazy(() => ApiDatasetSchema).meta({
756
+ description: "The dataset information for the people groups."
570
757
  }),
571
758
  /**
572
- * The book information for the book chapter.
759
+ * The list of people groups that are available for the dataset.
573
760
  */
574
- book: z.lazy(() => ApiCommentaryBookSchema).meta({
575
- description: "The book information for the book chapter."
761
+ groups: z.array(ApiDatasetPeopleGroupSummarySchema).meta({
762
+ description: "The list of people groups that are available for the dataset."
763
+ })
764
+ }).meta({
765
+ id: "ApiDatasetPeopleGroups",
766
+ description: "The list of people groups in a dataset. Maps to the /api/d/:datasetId/groups.json endpoint."
767
+ });
768
+ export const ApiDatasetPeopleGroupSchema = z.object({
769
+ /**
770
+ * The dataset information for the people group.
771
+ */
772
+ dataset: z.lazy(() => ApiDatasetSchema).meta({
773
+ description: "The dataset information for the people group."
576
774
  }),
577
775
  /**
578
- * The link to this chapter.
776
+ * The information about the people group.
777
+ */
778
+ group: DatasetPeopleGroupSchema.meta({
779
+ description: "The information about the people group."
780
+ }),
781
+ /**
782
+ * The API link for this people group.
783
+ */
784
+ thisPeopleGroupApiLink: z.string().meta({
785
+ description: "The API link for this people group. Relative to the API origin."
786
+ })
787
+ }).meta({
788
+ id: "ApiDatasetPeopleGroup",
789
+ description: "The information about a people group in a dataset. Maps to the /api/d/:datasetId/groups/:groupId.json endpoint."
790
+ });
791
+ export const ApiDatasetChapterPersonSchema = z.object({
792
+ /**
793
+ * The ID of the person.
794
+ */
795
+ id: z.string().meta({
796
+ description: "The ID of the person."
797
+ }),
798
+ /**
799
+ * The name of the person.
800
+ */
801
+ name: z.string().meta({
802
+ description: "The name of the person."
803
+ }),
804
+ /**
805
+ * Whether the name of the person is a proper name.
806
+ */
807
+ isProperName: z.boolean().optional().meta({
808
+ description: "Whether the name of the person is a proper name."
809
+ }),
810
+ /**
811
+ * The gender of the person.
812
+ */
813
+ gender: z.string().optional().meta({
814
+ description: "The gender of the person."
815
+ }),
816
+ /**
817
+ * The year that the person was born.
818
+ * Negative numbers are years BC. Positive numbers are years AD.
819
+ */
820
+ birthYear: z.number().optional().meta({
821
+ description: "The year that the person was born. Negative numbers are years BC. Positive numbers are years AD."
822
+ }),
823
+ /**
824
+ * The year that the person died.
825
+ * Negative numbers are years BC. Positive numbers are years AD.
826
+ */
827
+ deathYear: z.number().optional().meta({
828
+ description: "The year that the person died. Negative numbers are years BC. Positive numbers are years AD."
829
+ }),
830
+ /**
831
+ * The API link for the person.
832
+ */
833
+ apiLink: z.string().meta({
834
+ description: "The API link for the person. Relative to the API origin."
835
+ }),
836
+ /**
837
+ * The numbers of the verses in the chapter that mention the person.
838
+ * Sorted in ascending order.
839
+ */
840
+ verses: z.array(z.number()).meta({
841
+ description: "The numbers of the verses in the chapter that mention the person. Sorted in ascending order."
842
+ })
843
+ }).meta({
844
+ id: "ApiDatasetChapterPerson",
845
+ description: "Defines a person that appears in a chapter of a dataset."
846
+ });
847
+ export const ApiDatasetChapterPlaceSchema = z.object({
848
+ /**
849
+ * The ID of the place.
850
+ */
851
+ id: z.string().meta({
852
+ description: "The ID of the place."
853
+ }),
854
+ /**
855
+ * The name of the place.
856
+ */
857
+ name: z.string().meta({
858
+ description: "The name of the place."
859
+ }),
860
+ /**
861
+ * The type of geographical feature that the place is.
862
+ */
863
+ featureType: z.string().optional().meta({
864
+ description: 'The type of geographical feature that the place is. For example, "City", "Region", "Mountain", "Water", etc.'
865
+ }),
866
+ /**
867
+ * The latitude of the place.
868
+ */
869
+ latitude: z.number().optional().meta({
870
+ description: "The latitude of the place."
871
+ }),
872
+ /**
873
+ * The longitude of the place.
874
+ */
875
+ longitude: z.number().optional().meta({
876
+ description: "The longitude of the place."
877
+ }),
878
+ /**
879
+ * The API link for the place.
880
+ */
881
+ apiLink: z.string().meta({
882
+ description: "The API link for the place. Relative to the API origin."
883
+ }),
884
+ /**
885
+ * The numbers of the verses in the chapter that mention the place.
886
+ * Sorted in ascending order.
887
+ */
888
+ verses: z.array(z.number()).meta({
889
+ description: "The numbers of the verses in the chapter that mention the place. Sorted in ascending order."
890
+ })
891
+ }).meta({
892
+ id: "ApiDatasetChapterPlace",
893
+ description: "Defines a place that appears in a chapter of a dataset."
894
+ });
895
+ export const ApiDatasetChapterEventSchema = z.object({
896
+ /**
897
+ * The ID of the event.
898
+ */
899
+ id: z.string().meta({
900
+ description: "The ID of the event."
901
+ }),
902
+ /**
903
+ * The name of the event.
904
+ */
905
+ name: z.string().meta({
906
+ description: "The name of the event."
907
+ }),
908
+ /**
909
+ * The date that the event started at.
910
+ */
911
+ startDate: z.string().optional().meta({
912
+ description: "The date that the event started at. Negative numbers are years BC. Positive numbers are years AD. More specific dates use the `YYYY-MM-DD` format."
913
+ }),
914
+ /**
915
+ * The API link for the event.
916
+ */
917
+ apiLink: z.string().meta({
918
+ description: "The API link for the event. Relative to the API origin."
919
+ }),
920
+ /**
921
+ * The numbers of the verses in the chapter that describe the event.
922
+ * Sorted in ascending order.
923
+ */
924
+ verses: z.array(z.number()).meta({
925
+ description: "The numbers of the verses in the chapter that describe the event. Sorted in ascending order."
926
+ })
927
+ }).meta({
928
+ id: "ApiDatasetChapterEvent",
929
+ description: "Defines an event that appears in a chapter of a dataset."
930
+ });
931
+ export const ApiDatasetEntityChapterDataSchema = z.object({
932
+ /**
933
+ * The number of the chapter.
934
+ */
935
+ number: z.number().meta({
936
+ description: "The number of the chapter."
937
+ }),
938
+ /**
939
+ * The people that appear in the chapter.
940
+ * Sorted by the first verse that they appear in.
941
+ */
942
+ people: z.array(ApiDatasetChapterPersonSchema).meta({
943
+ description: "The people that appear in the chapter. Sorted by the first verse that they appear in."
944
+ }),
945
+ /**
946
+ * The places that appear in the chapter.
947
+ * Sorted by the first verse that they appear in.
948
+ */
949
+ places: z.array(ApiDatasetChapterPlaceSchema).meta({
950
+ description: "The places that appear in the chapter. Sorted by the first verse that they appear in."
951
+ }),
952
+ /**
953
+ * The events that appear in the chapter.
954
+ * Sorted by the first verse that they appear in.
955
+ */
956
+ events: z.array(ApiDatasetChapterEventSchema).meta({
957
+ description: "The events that appear in the chapter. Sorted by the first verse that they appear in."
958
+ })
959
+ }).meta({
960
+ id: "ApiDatasetEntityChapterData",
961
+ description: "Defines the entity data for a chapter in a dataset. Contains the people, places, and events that appear in the chapter."
962
+ });
963
+ export const ApiDatasetEntityBookChapterSchema = z.object({
964
+ /**
965
+ * The dataset information for the book chapter.
966
+ */
967
+ dataset: z.lazy(() => ApiDatasetSchema).meta({
968
+ description: "The dataset information for the book chapter."
969
+ }),
970
+ /**
971
+ * The book information for the book chapter.
972
+ */
973
+ book: z.lazy(() => ApiDatasetBookSchema).meta({
974
+ description: "The book information for the book chapter."
975
+ }),
976
+ /**
977
+ * The entity data for the chapter.
978
+ */
979
+ chapter: ApiDatasetEntityChapterDataSchema.meta({
980
+ description: "The entity data for the chapter."
981
+ }),
982
+ /**
983
+ * The link to this chapter.
984
+ */
985
+ thisChapterLink: z.string().meta({
986
+ description: "The link to this chapter. Relative to the API origin."
987
+ }),
988
+ /**
989
+ * The reference for this chapter.
990
+ */
991
+ thisChapterReference: z.lazy(() => DatasetChapterReferenceSchema).meta({
992
+ description: "The reference for this chapter."
993
+ }),
994
+ /**
995
+ * The link to the next chapter.
996
+ * Null if this is the last chapter in the dataset.
997
+ */
998
+ nextChapterApiLink: z.string().nullable().meta({
999
+ description: "The link to the next chapter. Relative to the API origin. Null if this is the last chapter in the dataset."
1000
+ }),
1001
+ /**
1002
+ * The reference for the next chapter.
1003
+ * Null if this is the last chapter in the dataset.
1004
+ */
1005
+ nextChapterReference: z.lazy(() => DatasetChapterReferenceSchema).nullable().meta({
1006
+ description: "The reference for the next chapter. Null if this is the last chapter in the dataset."
1007
+ }),
1008
+ /**
1009
+ * The link to the previous chapter.
1010
+ * Null if this is the first chapter in the dataset.
1011
+ */
1012
+ previousChapterApiLink: z.string().nullable().meta({
1013
+ description: "The link to the previous chapter. Relative to the API origin. Null if this is the first chapter in the dataset."
1014
+ }),
1015
+ /**
1016
+ * The reference for the previous chapter.
1017
+ * Null if this is the first chapter in the dataset.
1018
+ */
1019
+ previousChapterReference: z.lazy(() => DatasetChapterReferenceSchema).nullable().meta({
1020
+ description: "The reference for the previous chapter. Null if this is the first chapter in the dataset."
1021
+ }),
1022
+ /**
1023
+ * The number of people that appear in the chapter.
1024
+ */
1025
+ numberOfPeople: z.number().meta({
1026
+ description: "The number of people that appear in the chapter."
1027
+ }),
1028
+ /**
1029
+ * The number of places that appear in the chapter.
1030
+ */
1031
+ numberOfPlaces: z.number().meta({
1032
+ description: "The number of places that appear in the chapter."
1033
+ }),
1034
+ /**
1035
+ * The number of events that appear in the chapter.
1036
+ */
1037
+ numberOfEvents: z.number().meta({
1038
+ description: "The number of events that appear in the chapter."
1039
+ })
1040
+ }).meta({
1041
+ id: "ApiDatasetEntityBookChapter",
1042
+ description: "The entities (people, places, and events) that appear in a chapter of a book for a dataset. Maps to the /api/d/:datasetId/:bookId/:chapterNumber.json endpoint for datasets that contain entities."
1043
+ });
1044
+ export const ApiCommentaryProfilesSchema = z.object({
1045
+ /**
1046
+ * The commentary information for the books.
1047
+ */
1048
+ commentary: z.lazy(() => ApiCommentarySchema).meta({
1049
+ description: "The commentary information for the profiles."
1050
+ }),
1051
+ /**
1052
+ * The list of profiles that are available for the commentary.
1053
+ */
1054
+ profiles: z.array(z.lazy(() => ApiCommentaryProfileSchema)).meta({
1055
+ description: "The list of profiles that are available for the commentary."
1056
+ })
1057
+ }).meta({
1058
+ id: "ApiCommentaryProfiles",
1059
+ description: "Defines an interface that contains information about the profiles that are available for a commentary."
1060
+ });
1061
+ export const ApiCommentaryProfileSchema = CommentaryProfileSchema.extend({
1062
+ /**
1063
+ * The link to this profile.
1064
+ */
1065
+ thisProfileLink: z.string().meta({
1066
+ description: "The API link for this profile. Relative to the API origin."
1067
+ }),
1068
+ /**
1069
+ * The link to the chapter that this profile references in the commentary.
1070
+ */
1071
+ referenceChapterLink: z.string().nullable().meta({
1072
+ 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."
1073
+ })
1074
+ }).meta({
1075
+ id: "ApiCommentaryProfile",
1076
+ description: "Defines an interface that contains information about a profile."
1077
+ });
1078
+ export const TranslationChapterReferenceSchema = z.object({
1079
+ translationId: z.string().meta({
1080
+ description: "The ID of the translation that the chapter reference is for."
1081
+ }),
1082
+ book: BookIdSchema,
1083
+ chapter: z.int().positive().meta({
1084
+ description: "The chapter number of the chapter reference."
1085
+ })
1086
+ }).meta({
1087
+ id: "TranslationChapterReference",
1088
+ description: "Defines a reference to a chapter in a translation."
1089
+ });
1090
+ export const CommentaryChapterReferenceSchema = z.object({
1091
+ commentaryId: z.string().meta({
1092
+ description: "The ID of the commentary that the chapter reference is for."
1093
+ }),
1094
+ book: BookIdSchema,
1095
+ chapter: z.int().positive().meta({
1096
+ description: "The chapter number of the chapter reference."
1097
+ })
1098
+ }).meta({
1099
+ id: "CommentaryChapterReference",
1100
+ description: "Defines a reference to a chapter in a commentary."
1101
+ });
1102
+ export const DatasetChapterReferenceSchema = z.object({
1103
+ datasetId: z.string().meta({
1104
+ description: "The ID of the dataset that the chapter reference is for."
1105
+ }),
1106
+ book: BookIdSchema,
1107
+ chapter: z.int().positive().meta({
1108
+ description: "The chapter number of the chapter reference."
1109
+ })
1110
+ }).meta({
1111
+ id: "DatasetChapterReference",
1112
+ description: "Defines a reference to a chapter in a dataset."
1113
+ });
1114
+ export const ApiTranslationBookSchema = TranslationBookSchema.extend({
1115
+ /**
1116
+ * The number of the first chapter in the book.
1117
+ */
1118
+ firstChapterNumber: z.number().meta({
1119
+ description: "The number of the first chapter in the book."
1120
+ }),
1121
+ /**
1122
+ * The link to the first chapter of the book.
1123
+ */
1124
+ firstChapterApiLink: z.string().meta({
1125
+ description: "The link to the first chapter of the book."
1126
+ }),
1127
+ /**
1128
+ * The reference for the first chapter in the book.
1129
+ */
1130
+ firstChapterReference: TranslationChapterReferenceSchema,
1131
+ /**
1132
+ * The number of the last chapter in the book.
1133
+ */
1134
+ lastChapterNumber: z.number().meta({
1135
+ description: "The number of the last chapter in the book."
1136
+ }),
1137
+ /**
1138
+ * The link to the last chapter of the book.
1139
+ */
1140
+ lastChapterApiLink: z.string().meta({
1141
+ description: "The link to the last chapter of the book."
1142
+ }),
1143
+ /**
1144
+ * The reference for the last chapter in the book.
1145
+ */
1146
+ lastChapterReference: TranslationChapterReferenceSchema,
1147
+ /**
1148
+ * The number of chapters that the book contains.
1149
+ */
1150
+ numberOfChapters: z.number().meta({
1151
+ description: "The number of chapters that the book contains."
1152
+ }),
1153
+ /**
1154
+ * The number of verses that the book contains.
1155
+ */
1156
+ totalNumberOfVerses: z.number().meta({
1157
+ description: "The number of verses that the book contains."
1158
+ })
1159
+ }).meta({
1160
+ id: "ApiTranslationBook",
1161
+ description: "Defines a schema that contains information about a translation book."
1162
+ });
1163
+ export const ApiCommentaryBookSchema = CommentaryBookSchema.extend({
1164
+ /**
1165
+ * The number of the first chapter in the book.
1166
+ *
1167
+ * Null if the comentary book has no chapters.
1168
+ */
1169
+ firstChapterNumber: z.number().nullable().meta({
1170
+ description: "The number of the first chapter in the book. Null if the comentary book has no chapters."
1171
+ }),
1172
+ /**
1173
+ * The link to the first chapter of the book.
1174
+ *
1175
+ * Null if the comentary book has no chapters.
1176
+ */
1177
+ firstChapterApiLink: z.string().nullable().meta({
1178
+ description: "The link to the first chapter of the book. Null if the comentary book has no chapters."
1179
+ }),
1180
+ /**
1181
+ * The reference for the first chapter in the book.
1182
+ */
1183
+ firstChapterReference: CommentaryChapterReferenceSchema.nullable().meta({
1184
+ description: "The reference for the first chapter in the book. Null if the comentary book has no chapters."
1185
+ }),
1186
+ /**
1187
+ * The number of the last chapter in the book.
1188
+ *
1189
+ * Null if the comentary book has no chapters.
1190
+ */
1191
+ lastChapterNumber: z.number().nullable().meta({
1192
+ description: "The number of the last chapter in the book. Null if the comentary book has no chapters."
1193
+ }),
1194
+ /**
1195
+ * The link to the last chapter of the book.
1196
+ *
1197
+ * Null if the comentary book has no chapters.
1198
+ */
1199
+ lastChapterApiLink: z.string().nullable().meta({
1200
+ description: "The link to the last chapter of the book. Null if the comentary book has no chapters."
1201
+ }),
1202
+ /**
1203
+ * The reference for the last chapter in the book.
1204
+ */
1205
+ lastChapterReference: CommentaryChapterReferenceSchema.nullable().meta({
1206
+ description: "The reference for the last chapter in the book. Null if the comentary book has no chapters."
1207
+ }),
1208
+ /**
1209
+ * The number of chapters that the book contains.
1210
+ */
1211
+ numberOfChapters: z.number().meta({
1212
+ description: "The number of chapters that the book contains."
1213
+ }),
1214
+ /**
1215
+ * The number of verses that the book contains.
1216
+ */
1217
+ totalNumberOfVerses: z.number().meta({
1218
+ description: "The number of verses that the book contains."
1219
+ })
1220
+ }).meta({
1221
+ id: "ApiCommentaryBook",
1222
+ description: "Defines a schema that contains information about a commentary book."
1223
+ });
1224
+ export const ApiDatasetBookSchema = DatasetBookSchema.extend({
1225
+ /**
1226
+ * The number of the first chapter in the book.
1227
+ */
1228
+ firstChapterNumber: z.number().meta({
1229
+ description: "The number of the first chapter in the book."
1230
+ }),
1231
+ /**
1232
+ * The link to the first chapter of the book.
1233
+ */
1234
+ firstChapterApiLink: z.string().meta({
1235
+ description: "The link to the first chapter of the book."
1236
+ }),
1237
+ /**
1238
+ * The reference for the first chapter in the book.
1239
+ */
1240
+ firstChapterReference: DatasetChapterReferenceSchema,
1241
+ /**
1242
+ * The number of the last chapter in the book.
1243
+ */
1244
+ lastChapterNumber: z.number().meta({
1245
+ description: "The number of the last chapter in the book."
1246
+ }),
1247
+ /**
1248
+ * The link to the last chapter of the book.
1249
+ */
1250
+ lastChapterApiLink: z.string().meta({
1251
+ description: "The link to the last chapter of the book."
1252
+ }),
1253
+ /**
1254
+ * The reference for the last chapter in the book.
1255
+ */
1256
+ lastChapterReference: DatasetChapterReferenceSchema,
1257
+ /**
1258
+ * The number of chapters that the book contains.
1259
+ */
1260
+ numberOfChapters: z.number().meta({
1261
+ description: "The number of chapters that the book contains."
1262
+ }),
1263
+ /**
1264
+ * The number of verses that the book contains.
1265
+ */
1266
+ totalNumberOfVerses: z.number().meta({
1267
+ description: "The number of verses that the book contains."
1268
+ }),
1269
+ /**
1270
+ * The number of references that the book contains.
1271
+ */
1272
+ totalNumberOfReferences: z.number().meta({
1273
+ description: "The number of references that the book contains."
1274
+ })
1275
+ }).meta({
1276
+ id: "ApiDatasetBook",
1277
+ description: "Defines a schema that contains information about a book in a dataset."
1278
+ });
1279
+ const ApiTranslationBookChapterBaseSchema = TranslationBookChapterSchema.omit({
1280
+ thisChapterWords: true
1281
+ });
1282
+ export const ApiTranslationBookChapterSchema = ApiTranslationBookChapterBaseSchema.extend({
1283
+ /**
1284
+ * The translation information for the book chapter.
1285
+ */
1286
+ translation: z.lazy(() => ApiTranslationSchema).meta({
1287
+ description: "The translation information for the book chapter."
1288
+ }),
1289
+ /**
1290
+ * The book information for the book chapter.
1291
+ */
1292
+ book: z.lazy(() => ApiTranslationBookSchema).meta({
1293
+ description: "The book information for the book chapter."
1294
+ }),
1295
+ /**
1296
+ * The link to this chapter.
1297
+ */
1298
+ thisChapterLink: z.string().meta({
1299
+ description: "The API link for this chapter. Relative to the API origin."
1300
+ }),
1301
+ /**
1302
+ * The reference for this chapter.
1303
+ */
1304
+ thisChapterReference: TranslationChapterReferenceSchema,
1305
+ /**
1306
+ * The link to the next chapter.
1307
+ * Null if this is the last chapter in the translation.
1308
+ */
1309
+ nextChapterApiLink: z.string().nullable().meta({
1310
+ description: "The API link to the next chapter. Relative to the API origin. Null if this is the last chapter in the translation."
1311
+ }),
1312
+ /**
1313
+ * The reference for the next chapter.
1314
+ * Null if this is the last chapter in the translation.
1315
+ */
1316
+ nextChapterReference: TranslationChapterReferenceSchema.nullable().meta(
1317
+ {
1318
+ description: "The reference for the next chapter. Null if this is the last chapter in the translation."
1319
+ }
1320
+ ),
1321
+ /**
1322
+ * The links to the audio versions for the next chapter.
1323
+ * Null if this is the last chapter in the translation.
1324
+ */
1325
+ nextChapterAudioLinks: z.record(z.string(), z.string()).nullable().meta({
1326
+ 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."
1327
+ }),
1328
+ /**
1329
+ * The links to the audio timings for different audio versions for the chapter.
1330
+ */
1331
+ thisChapterAudioTimings: z.record(z.string(), z.string()).meta({
1332
+ description: "The links to the audio timings for different audio versions for the chapter. Relative to the API origin."
1333
+ }),
1334
+ /**
1335
+ * The links to the audio timings for different audio versions for the next chapter.
1336
+ * Null if this is the last chapter in the translation.
1337
+ */
1338
+ nextChapterAudioTimings: z.record(z.string(), z.string()).nullable().meta({
1339
+ 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."
1340
+ }),
1341
+ /**
1342
+ * The links to the audio timings for different audio versions for the previous chapter.
1343
+ * Null if this is the first chapter in the translation.
1344
+ */
1345
+ previousChapterAudioTimings: z.record(z.string(), z.string()).nullable().meta({
1346
+ 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."
1347
+ }),
1348
+ /**
1349
+ * The link to the previous chapter.
1350
+ * Null if this is the first chapter in the translation.
1351
+ */
1352
+ previousChapterApiLink: z.string().nullable().meta({
1353
+ description: "The API link to the previous chapter. Relative to the API origin. Null if this is the first chapter in the translation."
1354
+ }),
1355
+ /**
1356
+ * The reference for the previous chapter.
1357
+ * Null if this is the first chapter in the translation.
1358
+ */
1359
+ previousChapterReference: TranslationChapterReferenceSchema.nullable().meta({
1360
+ description: "The reference for the previous chapter. Null if this is the first chapter in the translation."
1361
+ }),
1362
+ /**
1363
+ * The links to the audio versions for the previous chapter.
1364
+ * Null if this is the first chapter in the translation.
1365
+ */
1366
+ previousChapterAudioLinks: z.record(z.string(), z.string()).nullable().meta({
1367
+ 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."
1368
+ }),
1369
+ /**
1370
+ * The link to the word-level annotations for the chapter.
1371
+ * Omitted if the chapter doesn't have any word-level annotations.
1372
+ */
1373
+ thisChapterWordsLink: z.string().optional().meta({
1374
+ 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."
1375
+ }),
1376
+ /**
1377
+ * The link to the word-level annotations for the next chapter.
1378
+ * Omitted if this is the last chapter in the translation, or if the next
1379
+ * chapter doesn't have any word-level annotations.
1380
+ */
1381
+ nextChapterWordsLink: z.string().optional().meta({
1382
+ 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."
1383
+ }),
1384
+ /**
1385
+ * The link to the word-level annotations for the previous chapter.
1386
+ * Omitted if this is the first chapter in the translation, or if the
1387
+ * previous chapter doesn't have any word-level annotations.
1388
+ */
1389
+ previousChapterWordsLink: z.string().optional().meta({
1390
+ 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."
1391
+ }),
1392
+ /**
1393
+ * The number of verses that the chapter contains.
1394
+ */
1395
+ numberOfVerses: z.number().meta({
1396
+ description: "The number of verses that the chapter contains."
1397
+ }),
1398
+ /**
1399
+ * The link to the simplified version of this chapter.
1400
+ * Omitted if simplified chapters were not generated.
1401
+ */
1402
+ simpleChapterApiLink: z.string().optional().meta({
1403
+ description: "The API link to the simplified version of this chapter. Relative to the API origin. Omitted if simplified chapters are not available."
1404
+ })
1405
+ }).meta({
1406
+ id: "ApiTranslationBookChapter",
1407
+ description: "Defines an interface that contains information about a book chapter in a translation."
1408
+ });
1409
+ export const ApiSimpleTranslationBookChapterSchema = ApiTranslationBookChapterSchema.omit({
1410
+ chapter: true,
1411
+ simpleChapterApiLink: true
1412
+ }).extend({
1413
+ /**
1414
+ * The simplified information for the chapter.
1415
+ */
1416
+ chapter: z.lazy(() => SimpleChapterDataSchema).meta({
1417
+ 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."
1418
+ }),
1419
+ /**
1420
+ * The link to the regular version of this chapter.
1421
+ */
1422
+ fullChapterApiLink: z.string().meta({
1423
+ description: "The API link to the regular (non-simplified) version of this chapter. Relative to the API origin."
1424
+ })
1425
+ }).meta({
1426
+ id: "ApiSimpleTranslationBookChapter",
1427
+ description: "Defines an interface that contains information about a book chapter in a translation, using the simplified chapter format."
1428
+ });
1429
+ export const ApiCommentaryBookChapterSchema = CommentaryBookChapterSchema.extend({
1430
+ /**
1431
+ * The commentary information for the book chapter.
1432
+ */
1433
+ commentary: z.lazy(() => ApiCommentarySchema).meta({
1434
+ description: "The commentary information for the book chapter."
1435
+ }),
1436
+ /**
1437
+ * The book information for the book chapter.
1438
+ */
1439
+ book: z.lazy(() => ApiCommentaryBookSchema).meta({
1440
+ description: "The book information for the book chapter."
1441
+ }),
1442
+ /**
1443
+ * The link to this chapter.
579
1444
  */
580
1445
  thisChapterLink: z.string().meta({
581
1446
  description: "The API link for this chapter. Relative to the API origin."
582
1447
  }),
1448
+ thisChapterReference: CommentaryChapterReferenceSchema,
583
1449
  /**
584
1450
  * The link to the next chapter.
585
1451
  * Null if this is the last chapter in the translation.
@@ -587,6 +1453,9 @@ export const ApiCommentaryBookChapterSchema = CommentaryBookChapterSchema.extend
587
1453
  nextChapterApiLink: z.string().nullable().meta({
588
1454
  description: "The API link to the next chapter. Relative to the API origin. Null if this is the last chapter in the commentary."
589
1455
  }),
1456
+ nextChapterReference: CommentaryChapterReferenceSchema.nullable().meta({
1457
+ description: "The reference for the next chapter. Null if this is the last chapter in the commentary."
1458
+ }),
590
1459
  /**
591
1460
  * The link to the previous chapter.
592
1461
  * Null if this is the first chapter in the translation.
@@ -594,84 +1463,284 @@ export const ApiCommentaryBookChapterSchema = CommentaryBookChapterSchema.extend
594
1463
  previousChapterApiLink: z.string().nullable().meta({
595
1464
  description: "The API link to the previous chapter. Relative to the API origin. Null if this is the first chapter in the commentary."
596
1465
  }),
1466
+ previousChapterReference: CommentaryChapterReferenceSchema.nullable().meta({
1467
+ description: "The reference for the previous chapter. Null if this is the first chapter in the commentary."
1468
+ }),
1469
+ /**
1470
+ * The number of verses that the chapter contains.
1471
+ */
1472
+ numberOfVerses: z.number().meta({
1473
+ description: "The number of verses that the chapter contains."
1474
+ }),
1475
+ /**
1476
+ * The link to the simplified version of this chapter.
1477
+ * Omitted if simplified chapters were not generated.
1478
+ */
1479
+ simpleChapterApiLink: z.string().optional().meta({
1480
+ description: "The API link to the simplified version of this chapter. Relative to the API origin. Omitted if simplified chapters are not available."
1481
+ })
1482
+ }).meta({
1483
+ id: "ApiCommentaryBookChapter",
1484
+ description: "Defines a schema that contains information about a book chapter in a commentary."
1485
+ });
1486
+ export const ApiSimpleCommentaryBookChapterSchema = ApiCommentaryBookChapterSchema.omit({
1487
+ chapter: true,
1488
+ simpleChapterApiLink: true
1489
+ }).extend({
1490
+ /**
1491
+ * The simplified information for the chapter.
1492
+ */
1493
+ chapter: z.lazy(() => SimpleCommentaryChapterDataSchema).meta({
1494
+ 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."
1495
+ }),
1496
+ /**
1497
+ * The link to the regular version of this chapter.
1498
+ */
1499
+ fullChapterApiLink: z.string().meta({
1500
+ description: "The API link to the regular (non-simplified) version of this chapter. Relative to the API origin."
1501
+ })
1502
+ }).meta({
1503
+ id: "ApiSimpleCommentaryBookChapter",
1504
+ description: "Defines a schema that contains information about a book chapter in a commentary, using the simplified chapter format."
1505
+ });
1506
+ export const ApiDatasetBookChapterSchema = DatasetBookChapterSchema.extend({
1507
+ /**
1508
+ * The dataset information for the book chapter.
1509
+ */
1510
+ dataset: z.lazy(() => ApiDatasetSchema).meta({
1511
+ description: "The dataset information for the book chapter."
1512
+ }),
1513
+ /**
1514
+ * The book information for the book chapter.
1515
+ */
1516
+ book: z.lazy(() => ApiDatasetBookSchema).meta({
1517
+ description: "The book information for the book chapter."
1518
+ }),
1519
+ /**
1520
+ * The link to this chapter.
1521
+ */
1522
+ thisChapterLink: z.string().meta({
1523
+ description: "The API link for this chapter. Relative to the API origin."
1524
+ }),
1525
+ thisChapterReference: DatasetChapterReferenceSchema,
1526
+ /**
1527
+ * The link to the next chapter.
1528
+ * Null if this is the last chapter in the translation.
1529
+ */
1530
+ nextChapterApiLink: z.string().nullable().meta({
1531
+ description: "The API link to the next chapter. Relative to the API origin. Null if this is the last chapter in the dataset."
1532
+ }),
1533
+ nextChapterReference: DatasetChapterReferenceSchema.nullable().meta({
1534
+ description: "The reference for the next chapter. Null if this is the last chapter in the dataset."
1535
+ }),
1536
+ /**
1537
+ * The link to the previous chapter.
1538
+ * Null if this is the first chapter in the translation.
1539
+ */
1540
+ previousChapterApiLink: z.string().nullable().meta({
1541
+ description: "The API link to the previous chapter. Relative to the API origin. Null if this is the first chapter in the dataset."
1542
+ }),
1543
+ previousChapterReference: DatasetChapterReferenceSchema.nullable().meta({
1544
+ description: "The reference for the previous chapter. Null if this is the first chapter in the dataset."
1545
+ }),
1546
+ /**
1547
+ * The number of verses that the chapter contains.
1548
+ */
1549
+ numberOfVerses: z.number().meta({
1550
+ description: "The number of verses that the chapter contains."
1551
+ }),
1552
+ /**
1553
+ * The number of references that the chapter contains.
1554
+ */
1555
+ numberOfReferences: z.number().meta({
1556
+ description: "The number of references that the chapter contains."
1557
+ })
1558
+ }).meta({
1559
+ id: "ApiDatasetBookChapter",
1560
+ description: "Defines a schema that contains information about a book chapter in a dataset."
1561
+ });
1562
+ export const ApiTranslationBookChapterAudioSchema = z.object({
1563
+ /**
1564
+ * The chapter that the audio is for.
1565
+ */
1566
+ chapter: z.lazy(() => ApiTranslationBookChapterSchema).meta({
1567
+ description: "The chapter that the audio is for."
1568
+ }),
1569
+ /**
1570
+ * The link that the audio should be placed at.
1571
+ */
1572
+ link: z.string().meta({
1573
+ description: "The link that the audio should be placed at. Relative to the API origin."
1574
+ }),
1575
+ /**
1576
+ * The original URL of the audio.
1577
+ */
1578
+ originalUrl: z.string().meta({
1579
+ description: "The original URL of the audio."
1580
+ })
1581
+ });
1582
+ export const ApiTranslationBookChapterAudioTimingsSchema = z.object({
1583
+ /**
1584
+ * The ID of the translation.
1585
+ */
1586
+ translationId: z.string().meta({
1587
+ description: "The ID of the translation."
1588
+ }),
1589
+ /**
1590
+ * The ID of the book.
1591
+ */
1592
+ bookId: z.string().meta({
1593
+ description: "The ID of the book."
1594
+ }),
1595
+ /**
1596
+ * The number of the chapter.
1597
+ */
1598
+ chapterNumber: z.number().meta({
1599
+ description: "The number of the chapter."
1600
+ }),
1601
+ /**
1602
+ * The reader for the chapter.
1603
+ */
1604
+ reader: z.string().meta({
1605
+ description: "The reader for the chapter."
1606
+ }),
1607
+ /**
1608
+ * The link to the audio for these timings.
1609
+ */
1610
+ audioLink: z.string().meta({
1611
+ description: "The link to the audio for these timings."
1612
+ }),
1613
+ /**
1614
+ * The link to the information for this chapter.
1615
+ */
1616
+ thisChapterLink: z.string().meta({
1617
+ description: "The link to the information for this chapter."
1618
+ }),
1619
+ /**
1620
+ * The link to the information for the next chapter.
1621
+ * Null if this is the last chapter in the translation.
1622
+ */
1623
+ nextChapterLink: z.string().nullable().meta({
1624
+ description: "The link to the information for the next chapter. Null if this is the last chapter in the translation."
1625
+ }),
1626
+ /**
1627
+ * The link to the information for the previous chapter.
1628
+ * Null if this is the first chapter in the translation.
1629
+ */
1630
+ previousChapterLink: z.string().nullable().meta({
1631
+ description: "The link to the information for the previous chapter. Null if this is the first chapter in the translation."
1632
+ }),
1633
+ /**
1634
+ * The link to this audio timings file.
1635
+ */
1636
+ thisChapterAudioTimingsLink: z.string().meta({
1637
+ description: "The link to this audio timings file."
1638
+ }),
1639
+ /**
1640
+ * The link to the timings for the next chapter.
1641
+ * Null if this is the last chapter in the translation.
1642
+ */
1643
+ nextChapterAudioTimingsLink: z.string().nullable().meta({
1644
+ description: "The link to the timings for the next chapter. Null if this is the last chapter in the translation."
1645
+ }),
1646
+ /**
1647
+ * The link to the timings for the previous chapter.
1648
+ * Null if this is the first chapter in the translation.
1649
+ */
1650
+ previousChapterAudioTimingsLink: z.string().nullable().meta({
1651
+ description: "The link to the timings for the previous chapter. Null if this is the first chapter in the translation."
1652
+ }),
597
1653
  /**
598
- * The number of verses that the chapter contains.
1654
+ * The times in seconds at which each verse starts, in order.
599
1655
  */
600
- numberOfVerses: z.number().meta({
601
- description: "The number of verses that the chapter contains."
1656
+ verses: z.array(z.number()).meta({
1657
+ 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."
602
1658
  })
603
1659
  }).meta({
604
- id: "ApiCommentaryBookChapter",
605
- description: "Defines a schema that contains information about a book chapter in a commentary."
1660
+ id: "ApiTranslationBookChapterAudioTimings",
1661
+ description: "Defines an interface that contains the audio timings for a book chapter, for a specific reader."
606
1662
  });
607
- export const ApiDatasetBookChapterSchema = DatasetBookChapterSchema.extend({
1663
+ export const ApiTranslationBookChapterWordsSchema = z.object({
608
1664
  /**
609
- * The dataset information for the book chapter.
1665
+ * The ID of the translation.
610
1666
  */
611
- dataset: z.lazy(() => ApiDatasetSchema).meta({
612
- description: "The dataset information for the book chapter."
1667
+ translationId: z.string().meta({
1668
+ description: "The ID of the translation."
613
1669
  }),
614
1670
  /**
615
- * The book information for the book chapter.
1671
+ * The ID of the book.
616
1672
  */
617
- book: z.lazy(() => ApiDatasetBookSchema).meta({
618
- description: "The book information for the book chapter."
1673
+ bookId: z.string().meta({
1674
+ description: "The ID of the book."
619
1675
  }),
620
1676
  /**
621
- * The link to this chapter.
1677
+ * The number of the chapter.
1678
+ */
1679
+ chapterNumber: z.number().meta({
1680
+ description: "The number of the chapter."
1681
+ }),
1682
+ /**
1683
+ * The link to the information for this chapter.
622
1684
  */
623
1685
  thisChapterLink: z.string().meta({
624
- description: "The API link for this chapter. Relative to the API origin."
1686
+ description: "The link to the information for this chapter."
625
1687
  }),
626
1688
  /**
627
- * The link to the next chapter.
1689
+ * The link to the information for the next chapter.
628
1690
  * Null if this is the last chapter in the translation.
629
1691
  */
630
- nextChapterApiLink: z.string().nullable().meta({
631
- description: "The API link to the next chapter. Relative to the API origin. Null if this is the last chapter in the dataset."
1692
+ nextChapterLink: z.string().nullable().meta({
1693
+ description: "The link to the information for the next chapter. Null if this is the last chapter in the translation."
632
1694
  }),
633
1695
  /**
634
- * The link to the previous chapter.
1696
+ * The link to the information for the previous chapter.
635
1697
  * Null if this is the first chapter in the translation.
636
1698
  */
637
- previousChapterApiLink: z.string().nullable().meta({
638
- description: "The API link to the previous chapter. Relative to the API origin. Null if this is the first chapter in the dataset."
1699
+ previousChapterLink: z.string().nullable().meta({
1700
+ description: "The link to the information for the previous chapter. Null if this is the first chapter in the translation."
639
1701
  }),
640
1702
  /**
641
- * The number of verses that the chapter contains.
1703
+ * The link to this words file.
642
1704
  */
643
- numberOfVerses: z.number().meta({
644
- description: "The number of verses that the chapter contains."
1705
+ thisChapterWordsLink: z.string().meta({
1706
+ description: "The link to this words file."
645
1707
  }),
646
1708
  /**
647
- * The number of references that the chapter contains.
1709
+ * The link to the words for the next chapter.
1710
+ * Null if this is the last chapter in the translation, or if the next chapter
1711
+ * doesn't have any word-level annotations.
648
1712
  */
649
- numberOfReferences: z.number().meta({
650
- description: "The number of references that the chapter contains."
651
- })
652
- }).meta({
653
- id: "ApiDatasetBookChapter",
654
- description: "Defines a schema that contains information about a book chapter in a dataset."
655
- });
656
- export const ApiTranslationBookChapterAudioSchema = z.object({
1713
+ nextChapterWordsLink: z.string().nullable().meta({
1714
+ 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."
1715
+ }),
657
1716
  /**
658
- * The chapter that the audio is for.
1717
+ * The link to the words for the previous chapter.
1718
+ * Null if this is the first chapter in the translation, or if the previous
1719
+ * chapter doesn't have any word-level annotations.
659
1720
  */
660
- chapter: z.lazy(() => ApiTranslationBookChapterSchema).meta({
661
- description: "The chapter that the audio is for."
1721
+ previousChapterWordsLink: z.string().nullable().meta({
1722
+ 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."
662
1723
  }),
663
1724
  /**
664
- * The link that the audio should be placed at.
1725
+ * The annotated words for each verse in the chapter.
665
1726
  */
666
- link: z.string().meta({
667
- description: "The link that the audio should be placed at. Relative to the API origin."
668
- }),
1727
+ verses: z.record(z.string(), z.array(z.lazy(() => ChapterWordSchema))).meta({
1728
+ 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."
1729
+ })
1730
+ }).meta({
1731
+ id: "ApiTranslationBookChapterWords",
1732
+ description: "Defines an interface that contains the word-level annotations for a book chapter."
1733
+ });
1734
+ export const ApiSimpleTranslationBookChapterWordsSchema = ApiTranslationBookChapterWordsSchema.extend({
669
1735
  /**
670
- * The original URL of the audio.
1736
+ * The annotated words for each verse in the chapter.
671
1737
  */
672
- originalUrl: z.string().meta({
673
- description: "The original URL of the audio."
1738
+ verses: z.record(z.string(), z.array(z.lazy(() => SimpleChapterWordSchema))).meta({
1739
+ 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."
674
1740
  })
1741
+ }).meta({
1742
+ id: "ApiSimpleTranslationBookChapterWords",
1743
+ 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."
675
1744
  });
676
1745
  export const ApiCommentaryProfileContentSchema = z.object({
677
1746
  /**
@@ -696,6 +1765,7 @@ export const ApiCommentaryProfileContentSchema = z.object({
696
1765
  export function generateApiForDataset(dataset, options = {}) {
697
1766
  const { useCommonName, pathPrefix } = options;
698
1767
  const apiPathPrefix = pathPrefix ? pathPrefix : "";
1768
+ const generateSimpleChapterFiles = !!options.generateSimpleChapterFiles;
699
1769
  let api = {
700
1770
  availableTranslations: {
701
1771
  translations: []
@@ -703,7 +1773,10 @@ export function generateApiForDataset(dataset, options = {}) {
703
1773
  translationBooks: [],
704
1774
  translationBookChapters: [],
705
1775
  translationBookChapterAudio: [],
1776
+ translationBookChapterAudioTimings: [],
1777
+ translationBookChapterWords: [],
706
1778
  translationComplete: [],
1779
+ simpleTranslationComplete: [],
707
1780
  availableCommentaries: {
708
1781
  commentaries: []
709
1782
  },
@@ -713,9 +1786,21 @@ export function generateApiForDataset(dataset, options = {}) {
713
1786
  commentaryProfileContents: [],
714
1787
  pathPrefix: apiPathPrefix
715
1788
  };
1789
+ if (generateSimpleChapterFiles) {
1790
+ api.simpleTranslationBookChapters = [];
1791
+ api.simpleCommentaryBookChapters = [];
1792
+ }
1793
+ if (generateSimpleChapterFiles || options.generateCompleteTranslationFiles) {
1794
+ api.simpleTranslationBookChapterWords = [];
1795
+ }
716
1796
  const getNativeName = options.getNativeName;
717
1797
  const getEnglishName = options.getEnglishName;
718
1798
  for (let { books, ...translation } of dataset.translations) {
1799
+ let hasSimpleWords2 = function(chapter) {
1800
+ const words = simplifiedChapters.get(chapter)?.words;
1801
+ return !!words && Object.keys(words).length > 0;
1802
+ };
1803
+ var hasSimpleWords = hasSimpleWords2;
719
1804
  let numberOfBooks = 0;
720
1805
  let numberOfApocryphalBooks = 0;
721
1806
  for (let book of books) {
@@ -733,6 +1818,11 @@ export function generateApiForDataset(dataset, options = {}) {
733
1818
  apiPathPrefix
734
1819
  ),
735
1820
  completeTranslationApiLink: options.generateCompleteTranslationFiles ? completeTranslationApiLink(translation.id, apiPathPrefix) : void 0,
1821
+ simpleCompleteTranslationApiLink: options.generateCompleteTranslationFiles ? completeTranslationApiLink(
1822
+ translation.id,
1823
+ apiPathPrefix,
1824
+ SIMPLE_JSON_EXTENSION
1825
+ ) : void 0,
736
1826
  numberOfBooks,
737
1827
  totalNumberOfChapters: 0,
738
1828
  totalNumberOfVerses: 0,
@@ -747,6 +1837,9 @@ export function generateApiForDataset(dataset, options = {}) {
747
1837
  books: []
748
1838
  };
749
1839
  let translationChapters = [];
1840
+ let pendingAudioTimings = [];
1841
+ let rawAudioTimingsByChapter = /* @__PURE__ */ new Map();
1842
+ let rawWordsByChapter = /* @__PURE__ */ new Map();
750
1843
  for (let { chapters, ...book } of books) {
751
1844
  const firstChapterNumber = chapters[0]?.chapter.number;
752
1845
  const lastChapterNumber = chapters[chapters.length - 1]?.chapter.number;
@@ -760,6 +1853,11 @@ export function generateApiForDataset(dataset, options = {}) {
760
1853
  "json",
761
1854
  apiPathPrefix
762
1855
  ),
1856
+ firstChapterReference: {
1857
+ translationId: translation.id,
1858
+ book: book.id,
1859
+ chapter: firstChapterNumber
1860
+ },
763
1861
  lastChapterNumber,
764
1862
  lastChapterApiLink: bookChapterApiLink(
765
1863
  translation.id,
@@ -768,11 +1866,22 @@ export function generateApiForDataset(dataset, options = {}) {
768
1866
  "json",
769
1867
  apiPathPrefix
770
1868
  ),
1869
+ lastChapterReference: {
1870
+ translationId: translation.id,
1871
+ book: book.id,
1872
+ chapter: lastChapterNumber
1873
+ },
771
1874
  numberOfChapters: chapters.length,
772
1875
  totalNumberOfVerses: 0
773
1876
  };
774
- for (let { chapter, thisChapterAudioLinks } of chapters) {
1877
+ for (let {
1878
+ chapter,
1879
+ thisChapterAudioLinks,
1880
+ thisChapterAudioTimings,
1881
+ thisChapterWords
1882
+ } of chapters) {
775
1883
  const audio = {};
1884
+ const audioTimings = {};
776
1885
  const apiBookChapter = {
777
1886
  translation: apiTranslation,
778
1887
  book: apiBook,
@@ -784,12 +1893,29 @@ export function generateApiForDataset(dataset, options = {}) {
784
1893
  "json",
785
1894
  apiPathPrefix
786
1895
  ),
1896
+ thisChapterReference: {
1897
+ translationId: translation.id,
1898
+ book: book.id,
1899
+ chapter: chapter.number
1900
+ },
787
1901
  thisChapterAudioLinks: audio,
788
1902
  nextChapterApiLink: null,
1903
+ nextChapterReference: null,
789
1904
  nextChapterAudioLinks: null,
790
1905
  previousChapterApiLink: null,
1906
+ previousChapterReference: null,
791
1907
  previousChapterAudioLinks: null,
792
- numberOfVerses: 0
1908
+ thisChapterAudioTimings: audioTimings,
1909
+ nextChapterAudioTimings: null,
1910
+ previousChapterAudioTimings: null,
1911
+ numberOfVerses: 0,
1912
+ simpleChapterApiLink: generateSimpleChapterFiles ? bookChapterApiLink(
1913
+ translation.id,
1914
+ getBookLink(book),
1915
+ chapter.number,
1916
+ SIMPLE_JSON_EXTENSION,
1917
+ apiPathPrefix
1918
+ ) : void 0
793
1919
  };
794
1920
  for (let reader in thisChapterAudioLinks) {
795
1921
  if (options.generateAudioFiles) {
@@ -810,6 +1936,34 @@ export function generateApiForDataset(dataset, options = {}) {
810
1936
  audio[reader] = thisChapterAudioLinks[reader];
811
1937
  }
812
1938
  }
1939
+ rawAudioTimingsByChapter.set(
1940
+ apiBookChapter,
1941
+ thisChapterAudioTimings
1942
+ );
1943
+ if (thisChapterWords) {
1944
+ apiBookChapter.thisChapterWordsLink = bookChapterWordsApiLink(
1945
+ translation.id,
1946
+ getBookLink(book),
1947
+ chapter.number,
1948
+ apiPathPrefix
1949
+ );
1950
+ rawWordsByChapter.set(apiBookChapter, thisChapterWords);
1951
+ }
1952
+ for (let reader in thisChapterAudioTimings) {
1953
+ const verses = thisChapterAudioTimings[reader];
1954
+ audioTimings[reader] = bookChapterAudioTimingsApiLink(
1955
+ translation.id,
1956
+ getBookLink(book),
1957
+ chapter.number,
1958
+ reader,
1959
+ apiPathPrefix
1960
+ );
1961
+ pendingAudioTimings.push({
1962
+ reader,
1963
+ verses,
1964
+ apiBookChapter
1965
+ });
1966
+ }
813
1967
  for (let c of chapter.content) {
814
1968
  if (c.type === "verse") {
815
1969
  apiBookChapter.numberOfVerses++;
@@ -835,54 +1989,228 @@ export function generateApiForDataset(dataset, options = {}) {
835
1989
  }
836
1990
  }
837
1991
  for (let i = 0; i < translationChapters.length; i++) {
1992
+ const currentChapter = translationChapters[i];
838
1993
  if (i > 0) {
839
- translationChapters[i].previousChapterApiLink = bookChapterApiLink(
1994
+ const previousChapter = translationChapters[i - 1];
1995
+ currentChapter.previousChapterApiLink = bookChapterApiLink(
840
1996
  translation.id,
841
- getBookLink(translationChapters[i - 1].book),
842
- translationChapters[i - 1].chapter.number,
1997
+ getBookLink(previousChapter.book),
1998
+ previousChapter.chapter.number,
843
1999
  "json",
844
2000
  apiPathPrefix
845
2001
  );
846
- translationChapters[i].previousChapterAudioLinks = translationChapters[i - 1].thisChapterAudioLinks;
2002
+ currentChapter.previousChapterReference = {
2003
+ translationId: translation.id,
2004
+ book: previousChapter.book.id,
2005
+ chapter: previousChapter.chapter.number
2006
+ };
2007
+ currentChapter.previousChapterAudioLinks = previousChapter.thisChapterAudioLinks;
2008
+ currentChapter.previousChapterAudioTimings = previousChapter.thisChapterAudioTimings;
2009
+ if (previousChapter.thisChapterWordsLink) {
2010
+ currentChapter.previousChapterWordsLink = previousChapter.thisChapterWordsLink;
2011
+ }
847
2012
  }
848
2013
  if (i < translationChapters.length - 1) {
849
- translationChapters[i].nextChapterApiLink = bookChapterApiLink(
2014
+ const nextChapter = translationChapters[i + 1];
2015
+ currentChapter.nextChapterApiLink = bookChapterApiLink(
850
2016
  translation.id,
851
- getBookLink(translationChapters[i + 1].book),
852
- translationChapters[i + 1].chapter.number,
2017
+ getBookLink(nextChapter.book),
2018
+ nextChapter.chapter.number,
853
2019
  "json",
854
2020
  apiPathPrefix
855
2021
  );
856
- translationChapters[i].nextChapterAudioLinks = translationChapters[i + 1].thisChapterAudioLinks;
2022
+ currentChapter.nextChapterReference = {
2023
+ translationId: translation.id,
2024
+ book: nextChapter.book.id,
2025
+ chapter: nextChapter.chapter.number
2026
+ };
2027
+ currentChapter.nextChapterAudioLinks = nextChapter.thisChapterAudioLinks;
2028
+ currentChapter.nextChapterAudioTimings = nextChapter.thisChapterAudioTimings;
2029
+ if (nextChapter.thisChapterWordsLink) {
2030
+ currentChapter.nextChapterWordsLink = nextChapter.thisChapterWordsLink;
2031
+ }
2032
+ }
2033
+ }
2034
+ const simplifiedChapters = /* @__PURE__ */ new Map();
2035
+ if (generateSimpleChapterFiles || options.generateCompleteTranslationFiles) {
2036
+ for (let chapter of translationChapters) {
2037
+ simplifiedChapters.set(
2038
+ chapter,
2039
+ simplifyChapter(
2040
+ chapter.chapter,
2041
+ rawWordsByChapter.get(chapter)
2042
+ )
2043
+ );
2044
+ }
2045
+ }
2046
+ const simpleChapterLink = (chapter) => bookChapterApiLink(
2047
+ translation.id,
2048
+ getBookLink(chapter.book),
2049
+ chapter.chapter.number,
2050
+ SIMPLE_JSON_EXTENSION,
2051
+ apiPathPrefix
2052
+ );
2053
+ const simpleWordsLink = (chapter) => hasSimpleWords2(chapter) ? bookChapterWordsApiLink(
2054
+ translation.id,
2055
+ getBookLink(chapter.book),
2056
+ chapter.chapter.number,
2057
+ apiPathPrefix,
2058
+ SIMPLE_JSON_EXTENSION
2059
+ ) : void 0;
2060
+ if (api.simpleTranslationBookChapters || api.simpleTranslationBookChapterWords) {
2061
+ for (let i = 0; i < translationChapters.length; i++) {
2062
+ const currentChapter = translationChapters[i];
2063
+ const previousChapter = translationChapters[i - 1];
2064
+ const nextChapter = translationChapters[i + 1];
2065
+ const simplified = simplifiedChapters.get(currentChapter);
2066
+ let simpleChapter;
2067
+ if (api.simpleTranslationBookChapters) {
2068
+ const {
2069
+ chapter,
2070
+ simpleChapterApiLink,
2071
+ thisChapterWordsLink,
2072
+ nextChapterWordsLink,
2073
+ previousChapterWordsLink,
2074
+ ...rest
2075
+ } = currentChapter;
2076
+ simpleChapter = {
2077
+ ...rest,
2078
+ chapter: simplified.chapter,
2079
+ thisChapterLink: simpleChapterLink(currentChapter),
2080
+ fullChapterApiLink: rest.thisChapterLink,
2081
+ previousChapterApiLink: previousChapter ? simpleChapterLink(previousChapter) : null,
2082
+ nextChapterApiLink: nextChapter ? simpleChapterLink(nextChapter) : null
2083
+ };
2084
+ }
2085
+ const thisWordsLink = simpleWordsLink(currentChapter);
2086
+ if (thisWordsLink) {
2087
+ if (simpleChapter) {
2088
+ simpleChapter.thisChapterWordsLink = thisWordsLink;
2089
+ }
2090
+ api.simpleTranslationBookChapterWords?.push({
2091
+ translationId: translation.id,
2092
+ bookId: currentChapter.book.id,
2093
+ chapterNumber: currentChapter.chapter.number,
2094
+ thisChapterLink: simpleChapter?.thisChapterLink ?? currentChapter.thisChapterLink,
2095
+ nextChapterLink: simpleChapter?.nextChapterApiLink ?? currentChapter.nextChapterApiLink,
2096
+ previousChapterLink: simpleChapter?.previousChapterApiLink ?? currentChapter.previousChapterApiLink,
2097
+ thisChapterWordsLink: thisWordsLink,
2098
+ nextChapterWordsLink: nextChapter ? simpleWordsLink(nextChapter) ?? null : null,
2099
+ previousChapterWordsLink: previousChapter ? simpleWordsLink(previousChapter) ?? null : null,
2100
+ verses: simplified.words
2101
+ });
2102
+ }
2103
+ if (simpleChapter) {
2104
+ const nextWordsLink = nextChapter ? simpleWordsLink(nextChapter) : void 0;
2105
+ if (nextWordsLink) {
2106
+ simpleChapter.nextChapterWordsLink = nextWordsLink;
2107
+ }
2108
+ const previousWordsLink = previousChapter ? simpleWordsLink(previousChapter) : void 0;
2109
+ if (previousWordsLink) {
2110
+ simpleChapter.previousChapterWordsLink = previousWordsLink;
2111
+ }
2112
+ api.simpleTranslationBookChapters.push(simpleChapter);
2113
+ }
2114
+ }
2115
+ }
2116
+ for (let { reader, verses, apiBookChapter } of pendingAudioTimings) {
2117
+ api.translationBookChapterAudioTimings.push({
2118
+ translationId: translation.id,
2119
+ bookId: apiBookChapter.book.id,
2120
+ chapterNumber: apiBookChapter.chapter.number,
2121
+ reader,
2122
+ audioLink: apiBookChapter.thisChapterAudioLinks[reader] ?? "",
2123
+ thisChapterLink: apiBookChapter.thisChapterLink,
2124
+ nextChapterLink: apiBookChapter.nextChapterApiLink,
2125
+ previousChapterLink: apiBookChapter.previousChapterApiLink,
2126
+ thisChapterAudioTimingsLink: apiBookChapter.thisChapterAudioTimings[reader],
2127
+ nextChapterAudioTimingsLink: apiBookChapter.nextChapterAudioTimings?.[reader] ?? null,
2128
+ previousChapterAudioTimingsLink: apiBookChapter.previousChapterAudioTimings?.[reader] ?? null,
2129
+ verses
2130
+ });
2131
+ }
2132
+ for (let apiBookChapter of translationChapters) {
2133
+ const words = rawWordsByChapter.get(apiBookChapter);
2134
+ if (!words || !apiBookChapter.thisChapterWordsLink) {
2135
+ continue;
857
2136
  }
2137
+ api.translationBookChapterWords.push({
2138
+ translationId: translation.id,
2139
+ bookId: apiBookChapter.book.id,
2140
+ chapterNumber: apiBookChapter.chapter.number,
2141
+ thisChapterLink: apiBookChapter.thisChapterLink,
2142
+ nextChapterLink: apiBookChapter.nextChapterApiLink,
2143
+ previousChapterLink: apiBookChapter.previousChapterApiLink,
2144
+ thisChapterWordsLink: apiBookChapter.thisChapterWordsLink,
2145
+ nextChapterWordsLink: apiBookChapter.nextChapterWordsLink ?? null,
2146
+ previousChapterWordsLink: apiBookChapter.previousChapterWordsLink ?? null,
2147
+ verses: words
2148
+ });
858
2149
  }
859
2150
  api.availableTranslations.translations.push(apiTranslation);
860
2151
  api.translationBooks.push(translationBooks);
861
2152
  if (options.generateCompleteTranslationFiles) {
2153
+ const completeBooks = translationBooks.books.map((book) => ({
2154
+ book,
2155
+ chapters: translationChapters.filter(
2156
+ (ch) => ch.book.id === book.id
2157
+ )
2158
+ }));
2159
+ const completeBook = (book, chapters) => ({
2160
+ id: book.id,
2161
+ name: book.name,
2162
+ commonName: book.commonName,
2163
+ title: book.title,
2164
+ order: book.order,
2165
+ numberOfChapters: book.numberOfChapters,
2166
+ totalNumberOfVerses: book.totalNumberOfVerses,
2167
+ isApocryphal: book.isApocryphal,
2168
+ chapters
2169
+ });
2170
+ const completeChapter = (chapter) => ({
2171
+ numberOfVerses: chapter.numberOfVerses,
2172
+ thisChapterAudioLinks: chapter.thisChapterAudioLinks,
2173
+ // The complete files contain the raw audio timings rather than links
2174
+ // to them, since the point is to have everything in one file.
2175
+ thisChapterAudioTimings: rawAudioTimingsByChapter.get(chapter) ?? {}
2176
+ });
862
2177
  const completeTranslation = {
863
2178
  translation: apiTranslation,
864
- books: translationBooks.books.map((book) => {
865
- const bookChapters = translationChapters.filter(
866
- (ch) => ch.book.id === book.id
867
- );
868
- return {
869
- id: book.id,
870
- name: book.name,
871
- commonName: book.commonName,
872
- title: book.title,
873
- order: book.order,
874
- numberOfChapters: book.numberOfChapters,
875
- totalNumberOfVerses: book.totalNumberOfVerses,
876
- isApocryphal: book.isApocryphal,
877
- chapters: bookChapters.map((ch) => ({
878
- numberOfVerses: ch.numberOfVerses,
879
- thisChapterAudioLinks: ch.thisChapterAudioLinks,
2179
+ books: completeBooks.map(
2180
+ ({ book, chapters }) => completeBook(
2181
+ book,
2182
+ chapters.map((ch) => ({
2183
+ ...completeChapter(ch),
2184
+ // The complete files link to the word annotations
2185
+ // rather than embedding them, same as the regular
2186
+ // per-chapter endpoint.
2187
+ ...ch.thisChapterWordsLink ? {
2188
+ thisChapterWordsLink: ch.thisChapterWordsLink
2189
+ } : {},
880
2190
  chapter: ch.chapter
881
2191
  }))
882
- };
883
- })
2192
+ )
2193
+ )
884
2194
  };
885
2195
  api.translationComplete.push(completeTranslation);
2196
+ const simpleCompleteTranslation = {
2197
+ translation: apiTranslation,
2198
+ books: completeBooks.map(
2199
+ ({ book, chapters }) => completeBook(
2200
+ book,
2201
+ chapters.map((ch) => {
2202
+ const simplified = simplifiedChapters.get(ch);
2203
+ const wordsLink = simpleWordsLink(ch);
2204
+ return {
2205
+ ...completeChapter(ch),
2206
+ ...wordsLink ? { thisChapterWordsLink: wordsLink } : {},
2207
+ chapter: simplified.chapter
2208
+ };
2209
+ })
2210
+ )
2211
+ )
2212
+ };
2213
+ api.simpleTranslationComplete.push(simpleCompleteTranslation);
886
2214
  }
887
2215
  }
888
2216
  for (let { books, profiles, ...commentary } of dataset.commentaries) {
@@ -927,6 +2255,11 @@ export function generateApiForDataset(dataset, options = {}) {
927
2255
  "json",
928
2256
  apiPathPrefix
929
2257
  ) : null,
2258
+ firstChapterReference: firstChapterNumber ? {
2259
+ commentaryId: commentary.id,
2260
+ book: book.id,
2261
+ chapter: firstChapterNumber
2262
+ } : null,
930
2263
  lastChapterNumber,
931
2264
  lastChapterApiLink: lastChapterNumber ? bookCommentaryChapterApiLink(
932
2265
  commentary.id,
@@ -935,6 +2268,11 @@ export function generateApiForDataset(dataset, options = {}) {
935
2268
  "json",
936
2269
  apiPathPrefix
937
2270
  ) : null,
2271
+ lastChapterReference: lastChapterNumber ? {
2272
+ commentaryId: commentary.id,
2273
+ book: book.id,
2274
+ chapter: lastChapterNumber
2275
+ } : null,
938
2276
  numberOfChapters: chapters.length,
939
2277
  totalNumberOfVerses: 0
940
2278
  };
@@ -950,9 +2288,23 @@ export function generateApiForDataset(dataset, options = {}) {
950
2288
  "json",
951
2289
  apiPathPrefix
952
2290
  ),
2291
+ thisChapterReference: {
2292
+ commentaryId: commentary.id,
2293
+ book: book.id,
2294
+ chapter: chapter.number
2295
+ },
953
2296
  nextChapterApiLink: null,
2297
+ nextChapterReference: null,
954
2298
  previousChapterApiLink: null,
955
- numberOfVerses: 0
2299
+ previousChapterReference: null,
2300
+ numberOfVerses: 0,
2301
+ simpleChapterApiLink: generateSimpleChapterFiles ? bookCommentaryChapterApiLink(
2302
+ commentary.id,
2303
+ getBookLink(book),
2304
+ chapter.number,
2305
+ SIMPLE_JSON_EXTENSION,
2306
+ apiPathPrefix
2307
+ ) : void 0
956
2308
  };
957
2309
  for (let c of chapter.content) {
958
2310
  if (c.type === "verse") {
@@ -1006,6 +2358,11 @@ export function generateApiForDataset(dataset, options = {}) {
1006
2358
  "json",
1007
2359
  apiPathPrefix
1008
2360
  );
2361
+ commentaryChapters[i].previousChapterReference = {
2362
+ commentaryId: commentary.id,
2363
+ book: commentaryChapters[i - 1].book.id,
2364
+ chapter: commentaryChapters[i - 1].chapter.number
2365
+ };
1009
2366
  }
1010
2367
  if (i < commentaryChapters.length - 1) {
1011
2368
  commentaryChapters[i].nextChapterApiLink = bookCommentaryChapterApiLink(
@@ -1015,13 +2372,47 @@ export function generateApiForDataset(dataset, options = {}) {
1015
2372
  "json",
1016
2373
  apiPathPrefix
1017
2374
  );
2375
+ commentaryChapters[i].nextChapterReference = {
2376
+ commentaryId: commentary.id,
2377
+ book: commentaryChapters[i + 1].book.id,
2378
+ chapter: commentaryChapters[i + 1].chapter.number
2379
+ };
2380
+ }
2381
+ }
2382
+ if (api.simpleCommentaryBookChapters) {
2383
+ const simpleChapterLink = (chapter) => bookCommentaryChapterApiLink(
2384
+ commentary.id,
2385
+ getBookLink(chapter.book),
2386
+ chapter.chapter.number,
2387
+ SIMPLE_JSON_EXTENSION,
2388
+ apiPathPrefix
2389
+ );
2390
+ for (let i = 0; i < commentaryChapters.length; i++) {
2391
+ const { chapter, simpleChapterApiLink, ...currentChapter } = commentaryChapters[i];
2392
+ const previousChapter = commentaryChapters[i - 1];
2393
+ const nextChapter = commentaryChapters[i + 1];
2394
+ api.simpleCommentaryBookChapters.push({
2395
+ ...currentChapter,
2396
+ chapter: simplifyCommentaryChapter(chapter),
2397
+ thisChapterLink: simpleChapterLink(commentaryChapters[i]),
2398
+ fullChapterApiLink: currentChapter.thisChapterLink,
2399
+ previousChapterApiLink: previousChapter ? simpleChapterLink(previousChapter) : null,
2400
+ nextChapterApiLink: nextChapter ? simpleChapterLink(nextChapter) : null
2401
+ });
1018
2402
  }
1019
2403
  }
1020
2404
  api.availableCommentaries.commentaries.push(apiCommentary);
1021
2405
  api.commentaryBooks.push(commentaryBooks);
1022
2406
  api.commentaryProfiles.push(commentaryProfiles);
1023
2407
  }
1024
- for (let { books, ...datasetInfo } of dataset.datasets ?? []) {
2408
+ for (let {
2409
+ books,
2410
+ people,
2411
+ places,
2412
+ events,
2413
+ peopleGroups,
2414
+ ...datasetInfo
2415
+ } of dataset.datasets ?? []) {
1025
2416
  const apiDataset = {
1026
2417
  ...datasetInfo,
1027
2418
  availableFormats: ["json"],
@@ -1054,6 +2445,11 @@ export function generateApiForDataset(dataset, options = {}) {
1054
2445
  "json",
1055
2446
  apiPathPrefix
1056
2447
  ),
2448
+ firstChapterReference: {
2449
+ datasetId: datasetInfo.id,
2450
+ book: book.id,
2451
+ chapter: firstChapterNumber
2452
+ },
1057
2453
  lastChapterNumber,
1058
2454
  lastChapterApiLink: bookDatasetChapterApiLink(
1059
2455
  datasetInfo.id,
@@ -1062,6 +2458,11 @@ export function generateApiForDataset(dataset, options = {}) {
1062
2458
  "json",
1063
2459
  apiPathPrefix
1064
2460
  ),
2461
+ lastChapterReference: {
2462
+ datasetId: datasetInfo.id,
2463
+ book: book.id,
2464
+ chapter: lastChapterNumber
2465
+ },
1065
2466
  numberOfChapters: chapters.length,
1066
2467
  totalNumberOfVerses: 0,
1067
2468
  totalNumberOfReferences: 0
@@ -1078,8 +2479,15 @@ export function generateApiForDataset(dataset, options = {}) {
1078
2479
  "json",
1079
2480
  apiPathPrefix
1080
2481
  ),
2482
+ thisChapterReference: {
2483
+ datasetId: datasetInfo.id,
2484
+ book: book.id,
2485
+ chapter: chapter.number
2486
+ },
1081
2487
  nextChapterApiLink: null,
2488
+ nextChapterReference: null,
1082
2489
  previousChapterApiLink: null,
2490
+ previousChapterReference: null,
1083
2491
  numberOfVerses: chapter.content.length,
1084
2492
  numberOfReferences: 0
1085
2493
  };
@@ -1108,6 +2516,11 @@ export function generateApiForDataset(dataset, options = {}) {
1108
2516
  "json",
1109
2517
  apiPathPrefix
1110
2518
  );
2519
+ datasetChapters[i].previousChapterReference = {
2520
+ datasetId: datasetInfo.id,
2521
+ book: datasetChapters[i - 1].book.id,
2522
+ chapter: datasetChapters[i - 1].chapter.number
2523
+ };
1111
2524
  }
1112
2525
  if (i < datasetChapters.length - 1) {
1113
2526
  datasetChapters[i].nextChapterApiLink = bookDatasetChapterApiLink(
@@ -1117,6 +2530,452 @@ export function generateApiForDataset(dataset, options = {}) {
1117
2530
  "json",
1118
2531
  apiPathPrefix
1119
2532
  );
2533
+ datasetChapters[i].nextChapterReference = {
2534
+ datasetId: datasetInfo.id,
2535
+ book: datasetChapters[i + 1].book.id,
2536
+ chapter: datasetChapters[i + 1].chapter.number
2537
+ };
2538
+ }
2539
+ }
2540
+ const linkEntityRef = (collection, ref) => ref ? {
2541
+ ...ref,
2542
+ type: collection,
2543
+ apiLink: datasetEntityApiLink(
2544
+ datasetInfo.id,
2545
+ collection,
2546
+ ref.id,
2547
+ "json",
2548
+ apiPathPrefix
2549
+ )
2550
+ } : void 0;
2551
+ const linkEntityRefs = (collection, refs) => refs?.map((ref) => linkEntityRef(collection, ref));
2552
+ if (people) {
2553
+ const datasetPeople = {
2554
+ dataset: apiDataset,
2555
+ people: []
2556
+ };
2557
+ for (let person of people) {
2558
+ const thisPersonApiLink = datasetEntityApiLink(
2559
+ datasetInfo.id,
2560
+ "people",
2561
+ person.id,
2562
+ "json",
2563
+ apiPathPrefix
2564
+ );
2565
+ datasetPeople.people.push({
2566
+ id: person.id,
2567
+ name: person.name,
2568
+ isProperName: person.isProperName,
2569
+ gender: person.gender,
2570
+ numberOfReferences: person.references.length,
2571
+ thisPersonApiLink
2572
+ });
2573
+ const apiPerson = {
2574
+ dataset: apiDataset,
2575
+ person: {
2576
+ ...person,
2577
+ birthPlace: linkEntityRef("places", person.birthPlace),
2578
+ deathPlace: linkEntityRef("places", person.deathPlace),
2579
+ father: linkEntityRefs("people", person.father),
2580
+ mother: linkEntityRefs("people", person.mother),
2581
+ partners: linkEntityRefs("people", person.partners),
2582
+ children: linkEntityRefs("people", person.children),
2583
+ siblings: linkEntityRefs("people", person.siblings),
2584
+ halfSiblingsSameMother: linkEntityRefs(
2585
+ "people",
2586
+ person.halfSiblingsSameMother
2587
+ ),
2588
+ halfSiblingsSameFather: linkEntityRefs(
2589
+ "people",
2590
+ person.halfSiblingsSameFather
2591
+ ),
2592
+ memberOf: linkEntityRefs("groups", person.memberOf),
2593
+ events: linkEntityRefs("events", person.events)
2594
+ },
2595
+ thisPersonApiLink
2596
+ };
2597
+ if (!api.datasetPeopleContents) {
2598
+ api.datasetPeopleContents = [];
2599
+ }
2600
+ api.datasetPeopleContents.push(apiPerson);
2601
+ }
2602
+ apiDataset.listOfPeopleApiLink = listOfDatasetEntitiesApiLink(
2603
+ datasetInfo.id,
2604
+ "people",
2605
+ "json",
2606
+ apiPathPrefix
2607
+ );
2608
+ apiDataset.totalNumberOfPeople = people.length;
2609
+ if (!api.datasetPeople) {
2610
+ api.datasetPeople = [];
2611
+ }
2612
+ api.datasetPeople.push(datasetPeople);
2613
+ }
2614
+ if (places) {
2615
+ const datasetPlaces = {
2616
+ dataset: apiDataset,
2617
+ places: []
2618
+ };
2619
+ for (let place of places) {
2620
+ const thisPlaceApiLink = datasetEntityApiLink(
2621
+ datasetInfo.id,
2622
+ "places",
2623
+ place.id,
2624
+ "json",
2625
+ apiPathPrefix
2626
+ );
2627
+ datasetPlaces.places.push({
2628
+ id: place.id,
2629
+ name: place.name,
2630
+ featureType: place.featureType,
2631
+ latitude: place.latitude,
2632
+ longitude: place.longitude,
2633
+ numberOfReferences: place.references.length,
2634
+ thisPlaceApiLink
2635
+ });
2636
+ const apiPlace = {
2637
+ dataset: apiDataset,
2638
+ place: {
2639
+ ...place,
2640
+ rootPlace: linkEntityRef("places", place.rootPlace),
2641
+ duplicateOf: linkEntityRef("places", place.duplicateOf),
2642
+ people: linkEntityRefs("people", place.people),
2643
+ peopleBorn: linkEntityRefs("people", place.peopleBorn),
2644
+ peopleDied: linkEntityRefs("people", place.peopleDied),
2645
+ events: linkEntityRefs("events", place.events)
2646
+ },
2647
+ thisPlaceApiLink
2648
+ };
2649
+ if (!api.datasetPlaceContents) {
2650
+ api.datasetPlaceContents = [];
2651
+ }
2652
+ api.datasetPlaceContents.push(apiPlace);
2653
+ }
2654
+ apiDataset.listOfPlacesApiLink = listOfDatasetEntitiesApiLink(
2655
+ datasetInfo.id,
2656
+ "places",
2657
+ "json",
2658
+ apiPathPrefix
2659
+ );
2660
+ apiDataset.totalNumberOfPlaces = places.length;
2661
+ if (!api.datasetPlaces) {
2662
+ api.datasetPlaces = [];
2663
+ }
2664
+ api.datasetPlaces.push(datasetPlaces);
2665
+ }
2666
+ if (events) {
2667
+ const datasetEvents = {
2668
+ dataset: apiDataset,
2669
+ events: []
2670
+ };
2671
+ for (let event of events) {
2672
+ const thisEventApiLink = datasetEntityApiLink(
2673
+ datasetInfo.id,
2674
+ "events",
2675
+ event.id,
2676
+ "json",
2677
+ apiPathPrefix
2678
+ );
2679
+ datasetEvents.events.push({
2680
+ id: event.id,
2681
+ name: event.name,
2682
+ startDate: event.startDate,
2683
+ numberOfReferences: event.references.length,
2684
+ thisEventApiLink
2685
+ });
2686
+ const apiEvent = {
2687
+ dataset: apiDataset,
2688
+ event: {
2689
+ ...event,
2690
+ participants: linkEntityRefs(
2691
+ "people",
2692
+ event.participants
2693
+ ),
2694
+ locations: linkEntityRefs("places", event.locations),
2695
+ groups: linkEntityRefs("groups", event.groups),
2696
+ partOf: linkEntityRef("events", event.partOf),
2697
+ predecessor: linkEntityRef("events", event.predecessor)
2698
+ },
2699
+ thisEventApiLink
2700
+ };
2701
+ if (!api.datasetEventContents) {
2702
+ api.datasetEventContents = [];
2703
+ }
2704
+ api.datasetEventContents.push(apiEvent);
2705
+ }
2706
+ apiDataset.listOfEventsApiLink = listOfDatasetEntitiesApiLink(
2707
+ datasetInfo.id,
2708
+ "events",
2709
+ "json",
2710
+ apiPathPrefix
2711
+ );
2712
+ apiDataset.totalNumberOfEvents = events.length;
2713
+ if (!api.datasetEvents) {
2714
+ api.datasetEvents = [];
2715
+ }
2716
+ api.datasetEvents.push(datasetEvents);
2717
+ }
2718
+ if (peopleGroups) {
2719
+ const datasetPeopleGroups = {
2720
+ dataset: apiDataset,
2721
+ groups: []
2722
+ };
2723
+ for (let group of peopleGroups) {
2724
+ const thisPeopleGroupApiLink = datasetEntityApiLink(
2725
+ datasetInfo.id,
2726
+ "groups",
2727
+ group.id,
2728
+ "json",
2729
+ apiPathPrefix
2730
+ );
2731
+ datasetPeopleGroups.groups.push({
2732
+ id: group.id,
2733
+ name: group.name,
2734
+ numberOfMembers: group.members?.length ?? 0,
2735
+ thisPeopleGroupApiLink
2736
+ });
2737
+ const apiGroup = {
2738
+ dataset: apiDataset,
2739
+ group: {
2740
+ ...group,
2741
+ members: linkEntityRefs("people", group.members),
2742
+ events: linkEntityRefs("events", group.events)
2743
+ },
2744
+ thisPeopleGroupApiLink
2745
+ };
2746
+ if (!api.datasetPeopleGroupContents) {
2747
+ api.datasetPeopleGroupContents = [];
2748
+ }
2749
+ api.datasetPeopleGroupContents.push(apiGroup);
2750
+ }
2751
+ apiDataset.listOfPeopleGroupsApiLink = listOfDatasetEntitiesApiLink(
2752
+ datasetInfo.id,
2753
+ "groups",
2754
+ "json",
2755
+ apiPathPrefix
2756
+ );
2757
+ apiDataset.totalNumberOfPeopleGroups = peopleGroups.length;
2758
+ if (!api.datasetPeopleGroups) {
2759
+ api.datasetPeopleGroups = [];
2760
+ }
2761
+ api.datasetPeopleGroups.push(datasetPeopleGroups);
2762
+ }
2763
+ if (books.length <= 0 && (people || places || events)) {
2764
+ let addEntityVerses2 = function(collection, references, createEntry) {
2765
+ for (let reference of references) {
2766
+ let bookChapters = chapterMap.get(reference.book);
2767
+ if (!bookChapters) {
2768
+ bookChapters = /* @__PURE__ */ new Map();
2769
+ chapterMap.set(reference.book, bookChapters);
2770
+ }
2771
+ let chapterEntities = bookChapters.get(reference.chapter);
2772
+ if (!chapterEntities) {
2773
+ chapterEntities = {
2774
+ people: /* @__PURE__ */ new Map(),
2775
+ places: /* @__PURE__ */ new Map(),
2776
+ events: /* @__PURE__ */ new Map()
2777
+ };
2778
+ bookChapters.set(reference.chapter, chapterEntities);
2779
+ }
2780
+ const entry = createEntry();
2781
+ const entities = chapterEntities[collection];
2782
+ let existing = entities.get(entry.id);
2783
+ if (!existing) {
2784
+ existing = { ...entry, verses: [] };
2785
+ entities.set(entry.id, existing);
2786
+ }
2787
+ const endVerse = reference.endVerse ?? reference.verse;
2788
+ for (let verse = reference.verse; verse <= endVerse; verse++) {
2789
+ existing.verses.push(verse);
2790
+ }
2791
+ }
2792
+ }, sortEntities2 = function(entities) {
2793
+ const list = [...entities.values()];
2794
+ for (let entity of list) {
2795
+ entity.verses.sort((a, b) => a - b);
2796
+ }
2797
+ return list.sort(
2798
+ (a, b) => a.verses[0] - b.verses[0] || a.id.localeCompare(b.id)
2799
+ );
2800
+ };
2801
+ var addEntityVerses = addEntityVerses2, sortEntities = sortEntities2;
2802
+ const chapterMap = /* @__PURE__ */ new Map();
2803
+ for (let person of people ?? []) {
2804
+ addEntityVerses2(
2805
+ "people",
2806
+ person.references,
2807
+ () => ({
2808
+ id: person.id,
2809
+ name: person.name,
2810
+ isProperName: person.isProperName,
2811
+ gender: person.gender,
2812
+ birthYear: person.birthYear,
2813
+ deathYear: person.deathYear,
2814
+ apiLink: datasetEntityApiLink(
2815
+ datasetInfo.id,
2816
+ "people",
2817
+ person.id,
2818
+ "json",
2819
+ apiPathPrefix
2820
+ )
2821
+ })
2822
+ );
2823
+ }
2824
+ for (let place of places ?? []) {
2825
+ addEntityVerses2(
2826
+ "places",
2827
+ place.references,
2828
+ () => ({
2829
+ id: place.id,
2830
+ name: place.name,
2831
+ featureType: place.featureType,
2832
+ latitude: place.latitude,
2833
+ longitude: place.longitude,
2834
+ apiLink: datasetEntityApiLink(
2835
+ datasetInfo.id,
2836
+ "places",
2837
+ place.id,
2838
+ "json",
2839
+ apiPathPrefix
2840
+ )
2841
+ })
2842
+ );
2843
+ }
2844
+ for (let event of events ?? []) {
2845
+ addEntityVerses2(
2846
+ "events",
2847
+ event.references,
2848
+ () => ({
2849
+ id: event.id,
2850
+ name: event.name,
2851
+ startDate: event.startDate,
2852
+ apiLink: datasetEntityApiLink(
2853
+ datasetInfo.id,
2854
+ "events",
2855
+ event.id,
2856
+ "json",
2857
+ apiPathPrefix
2858
+ )
2859
+ })
2860
+ );
2861
+ }
2862
+ const sortedBooks = [...chapterMap.keys()].sort(
2863
+ (a, b) => (bookOrderMap.get(a) ?? 9999) - (bookOrderMap.get(b) ?? 9999)
2864
+ );
2865
+ const entityChapters = [];
2866
+ for (let bookId of sortedBooks) {
2867
+ const bookChapters = chapterMap.get(bookId);
2868
+ const chapterNumbers = [...bookChapters.keys()].sort(
2869
+ (a, b) => a - b
2870
+ );
2871
+ const firstChapterNumber = chapterNumbers[0];
2872
+ const lastChapterNumber = chapterNumbers[chapterNumbers.length - 1];
2873
+ const apiBook = {
2874
+ id: bookId,
2875
+ order: bookOrderMap.get(bookId) ?? 9999,
2876
+ firstChapterNumber,
2877
+ firstChapterApiLink: bookDatasetChapterApiLink(
2878
+ datasetInfo.id,
2879
+ bookId,
2880
+ firstChapterNumber,
2881
+ "json",
2882
+ apiPathPrefix
2883
+ ),
2884
+ firstChapterReference: {
2885
+ datasetId: datasetInfo.id,
2886
+ book: bookId,
2887
+ chapter: firstChapterNumber
2888
+ },
2889
+ lastChapterNumber,
2890
+ lastChapterApiLink: bookDatasetChapterApiLink(
2891
+ datasetInfo.id,
2892
+ bookId,
2893
+ lastChapterNumber,
2894
+ "json",
2895
+ apiPathPrefix
2896
+ ),
2897
+ lastChapterReference: {
2898
+ datasetId: datasetInfo.id,
2899
+ book: bookId,
2900
+ chapter: lastChapterNumber
2901
+ },
2902
+ numberOfChapters: chapterNumbers.length,
2903
+ totalNumberOfVerses: 0,
2904
+ totalNumberOfReferences: 0
2905
+ };
2906
+ for (let chapterNumber of chapterNumbers) {
2907
+ const chapterEntities = bookChapters.get(chapterNumber);
2908
+ const chapterPeople = sortEntities2(chapterEntities.people);
2909
+ const chapterPlaces = sortEntities2(chapterEntities.places);
2910
+ const chapterEvents = sortEntities2(chapterEntities.events);
2911
+ const distinctVerses = /* @__PURE__ */ new Set();
2912
+ let numberOfReferences = 0;
2913
+ for (let list of [
2914
+ chapterPeople,
2915
+ chapterPlaces,
2916
+ chapterEvents
2917
+ ]) {
2918
+ for (let entity of list) {
2919
+ numberOfReferences += entity.verses.length;
2920
+ for (let verse of entity.verses) {
2921
+ distinctVerses.add(verse);
2922
+ }
2923
+ }
2924
+ }
2925
+ apiBook.totalNumberOfVerses += distinctVerses.size;
2926
+ apiBook.totalNumberOfReferences += numberOfReferences;
2927
+ const apiChapter = {
2928
+ dataset: apiDataset,
2929
+ book: apiBook,
2930
+ chapter: {
2931
+ number: chapterNumber,
2932
+ people: chapterPeople,
2933
+ places: chapterPlaces,
2934
+ events: chapterEvents
2935
+ },
2936
+ thisChapterLink: bookDatasetChapterApiLink(
2937
+ datasetInfo.id,
2938
+ bookId,
2939
+ chapterNumber,
2940
+ "json",
2941
+ apiPathPrefix
2942
+ ),
2943
+ thisChapterReference: {
2944
+ datasetId: datasetInfo.id,
2945
+ book: bookId,
2946
+ chapter: chapterNumber
2947
+ },
2948
+ nextChapterApiLink: null,
2949
+ nextChapterReference: null,
2950
+ previousChapterApiLink: null,
2951
+ previousChapterReference: null,
2952
+ numberOfPeople: chapterPeople.length,
2953
+ numberOfPlaces: chapterPlaces.length,
2954
+ numberOfEvents: chapterEvents.length
2955
+ };
2956
+ entityChapters.push(apiChapter);
2957
+ }
2958
+ datasetBooks.books.push(apiBook);
2959
+ apiDataset.totalNumberOfChapters += apiBook.numberOfChapters;
2960
+ apiDataset.totalNumberOfVerses += apiBook.totalNumberOfVerses;
2961
+ apiDataset.totalNumberOfReferences += apiBook.totalNumberOfReferences;
2962
+ }
2963
+ apiDataset.numberOfBooks = datasetBooks.books.length;
2964
+ for (let i = 0; i < entityChapters.length; i++) {
2965
+ if (i > 0) {
2966
+ entityChapters[i].previousChapterApiLink = entityChapters[i - 1].thisChapterLink;
2967
+ entityChapters[i].previousChapterReference = entityChapters[i - 1].thisChapterReference;
2968
+ }
2969
+ if (i < entityChapters.length - 1) {
2970
+ entityChapters[i].nextChapterApiLink = entityChapters[i + 1].thisChapterLink;
2971
+ entityChapters[i].nextChapterReference = entityChapters[i + 1].thisChapterReference;
2972
+ }
2973
+ }
2974
+ if (entityChapters.length > 0) {
2975
+ if (!api.datasetEntityBookChapters) {
2976
+ api.datasetEntityBookChapters = [];
2977
+ }
2978
+ api.datasetEntityBookChapters.push(...entityChapters);
1120
2979
  }
1121
2980
  }
1122
2981
  if (!api.availableDatasets) {
@@ -1155,9 +3014,21 @@ export function generateFilesForApi(api) {
1155
3014
  for (let bookChapter of api.translationBookChapters) {
1156
3015
  files.push(jsonFile(bookChapter.thisChapterLink, bookChapter));
1157
3016
  }
3017
+ for (let bookChapter of api.simpleTranslationBookChapters ?? []) {
3018
+ files.push(jsonFile(bookChapter.thisChapterLink, bookChapter));
3019
+ }
1158
3020
  for (let audio of api.translationBookChapterAudio) {
1159
3021
  files.push(downloadedFile(audio.link, audio.originalUrl));
1160
3022
  }
3023
+ for (let timings of api.translationBookChapterAudioTimings) {
3024
+ files.push(jsonFile(timings.thisChapterAudioTimingsLink, timings));
3025
+ }
3026
+ for (let words of api.translationBookChapterWords) {
3027
+ files.push(jsonFile(words.thisChapterWordsLink, words));
3028
+ }
3029
+ for (let words of api.simpleTranslationBookChapterWords ?? []) {
3030
+ files.push(jsonFile(words.thisChapterWordsLink, words));
3031
+ }
1161
3032
  for (let complete of api.translationComplete) {
1162
3033
  if (complete.translation.completeTranslationApiLink) {
1163
3034
  files.push(
@@ -1168,6 +3039,16 @@ export function generateFilesForApi(api) {
1168
3039
  );
1169
3040
  }
1170
3041
  }
3042
+ for (let complete of api.simpleTranslationComplete) {
3043
+ if (complete.translation.simpleCompleteTranslationApiLink) {
3044
+ files.push(
3045
+ jsonFile(
3046
+ complete.translation.simpleCompleteTranslationApiLink,
3047
+ complete
3048
+ )
3049
+ );
3050
+ }
3051
+ }
1171
3052
  files.push(
1172
3053
  jsonFile(
1173
3054
  `${api.pathPrefix}/api/available_commentaries.json`,
@@ -1199,6 +3080,9 @@ export function generateFilesForApi(api) {
1199
3080
  for (let bookChapter of api.commentaryBookChapters) {
1200
3081
  files.push(jsonFile(bookChapter.thisChapterLink, bookChapter));
1201
3082
  }
3083
+ for (let bookChapter of api.simpleCommentaryBookChapters ?? []) {
3084
+ files.push(jsonFile(bookChapter.thisChapterLink, bookChapter));
3085
+ }
1202
3086
  if (api.availableDatasets) {
1203
3087
  files.push(
1204
3088
  jsonFile(
@@ -1222,6 +3106,44 @@ export function generateFilesForApi(api) {
1222
3106
  );
1223
3107
  }
1224
3108
  }
3109
+ for (let entityChapter of api.datasetEntityBookChapters ?? []) {
3110
+ files.push(jsonFile(entityChapter.thisChapterLink, entityChapter));
3111
+ }
3112
+ for (let datasetPeople of api.datasetPeople ?? []) {
3113
+ files.push(
3114
+ jsonFile(datasetPeople.dataset.listOfPeopleApiLink, datasetPeople)
3115
+ );
3116
+ }
3117
+ for (let person of api.datasetPeopleContents ?? []) {
3118
+ files.push(jsonFile(person.thisPersonApiLink, person));
3119
+ }
3120
+ for (let datasetPlaces of api.datasetPlaces ?? []) {
3121
+ files.push(
3122
+ jsonFile(datasetPlaces.dataset.listOfPlacesApiLink, datasetPlaces)
3123
+ );
3124
+ }
3125
+ for (let place of api.datasetPlaceContents ?? []) {
3126
+ files.push(jsonFile(place.thisPlaceApiLink, place));
3127
+ }
3128
+ for (let datasetEvents of api.datasetEvents ?? []) {
3129
+ files.push(
3130
+ jsonFile(datasetEvents.dataset.listOfEventsApiLink, datasetEvents)
3131
+ );
3132
+ }
3133
+ for (let event of api.datasetEventContents ?? []) {
3134
+ files.push(jsonFile(event.thisEventApiLink, event));
3135
+ }
3136
+ for (let datasetPeopleGroups of api.datasetPeopleGroups ?? []) {
3137
+ files.push(
3138
+ jsonFile(
3139
+ datasetPeopleGroups.dataset.listOfPeopleGroupsApiLink,
3140
+ datasetPeopleGroups
3141
+ )
3142
+ );
3143
+ }
3144
+ for (let group of api.datasetPeopleGroupContents ?? []) {
3145
+ files.push(jsonFile(group.thisPeopleGroupApiLink, group));
3146
+ }
1225
3147
  return files;
1226
3148
  }
1227
3149
  export async function* generateOutputFilesFromDatasets(datasets, options) {
@@ -1234,8 +3156,8 @@ export async function* generateOutputFilesFromDatasets(datasets, options) {
1234
3156
  export function listOfBooksApiLink(translationId, prefix = "") {
1235
3157
  return `${prefix}/api/${translationId}/books.json`;
1236
3158
  }
1237
- export function completeTranslationApiLink(translationId, prefix = "") {
1238
- return `${prefix}/api/${translationId}/complete.json`;
3159
+ export function completeTranslationApiLink(translationId, prefix = "", extension = "json") {
3160
+ return `${prefix}/api/${translationId}/complete.${extension}`;
1239
3161
  }
1240
3162
  export function listOfCommentaryBooksApiLink(commentaryId, prefix = "") {
1241
3163
  return `${prefix}/api/c/${commentaryId}/books.json`;
@@ -1243,6 +3165,15 @@ export function listOfCommentaryBooksApiLink(commentaryId, prefix = "") {
1243
3165
  export function listOfDatasetBooksApiLink(datasetId, prefix = "") {
1244
3166
  return `${prefix}/api/d/${datasetId}/books.json`;
1245
3167
  }
3168
+ export function listOfDatasetEntitiesApiLink(datasetId, collection, extension = "json", prefix = "") {
3169
+ return `${prefix}/api/d/${datasetId}/${collection}.${extension}`;
3170
+ }
3171
+ export function datasetEntityApiLink(datasetId, collection, entityId, extension = "json", prefix = "") {
3172
+ return `${prefix}/api/d/${datasetId}/${collection}/${replaceSpacesWithUnderscores(
3173
+ entityId
3174
+ )}.${extension}`;
3175
+ }
3176
+ export const SIMPLE_JSON_EXTENSION = "simple.json";
1246
3177
  export function bookChapterApiLink(translationId, commonName, chapterNumber, extension, prefix = "") {
1247
3178
  return `${prefix}/api/${translationId}/${replaceSpacesWithUnderscores(
1248
3179
  commonName
@@ -1258,6 +3189,16 @@ export function bookChapterAudioApiLink(translationId, bookId, chapterNumber, re
1258
3189
  bookId
1259
3190
  )}/${chapterNumber}.${reader}.mp3`;
1260
3191
  }
3192
+ export function bookChapterAudioTimingsApiLink(translationId, bookId, chapterNumber, reader, prefix = "") {
3193
+ return `${prefix}/api/${translationId}/${replaceSpacesWithUnderscores(
3194
+ bookId
3195
+ )}/${chapterNumber}.${reader}.audioTimings.json`;
3196
+ }
3197
+ export function bookChapterWordsApiLink(translationId, bookId, chapterNumber, prefix = "", extension = "json") {
3198
+ return `${prefix}/api/${translationId}/${replaceSpacesWithUnderscores(
3199
+ bookId
3200
+ )}/${chapterNumber}.words.${extension}`;
3201
+ }
1261
3202
  export function bookDatasetChapterApiLink(translationId, commonName, chapterNumber, extension, prefix = "") {
1262
3203
  return `${prefix}/api/d/${translationId}/${replaceSpacesWithUnderscores(
1263
3204
  commonName