@helloao/tools 0.2.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/generation/api.cjs +856 -36
- package/dist/cjs/generation/api.cjs.map +3 -3
- package/dist/cjs/generation/audio.cjs +5 -5
- package/dist/cjs/generation/audio.cjs.map +1 -1
- package/dist/cjs/generation/book-order.cjs.map +1 -1
- package/dist/cjs/generation/common-types.cjs +359 -14
- package/dist/cjs/generation/common-types.cjs.map +2 -2
- package/dist/cjs/generation/dataset.cjs +13 -9
- package/dist/cjs/generation/dataset.cjs.map +2 -2
- package/dist/cjs/generation/index.cjs +8 -5
- package/dist/cjs/generation/index.cjs.map +2 -2
- package/dist/cjs/generation/simple.cjs +294 -0
- package/dist/cjs/generation/simple.cjs.map +7 -0
- package/dist/cjs/index.cjs +4 -4
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/cjs/log.cjs.map +1 -1
- package/dist/cjs/parser/codex-parser.cjs +3 -3
- package/dist/cjs/parser/codex-parser.cjs.map +3 -3
- package/dist/cjs/parser/commentary-csv-parser.cjs +14 -3
- package/dist/cjs/parser/commentary-csv-parser.cjs.map +3 -3
- package/dist/cjs/parser/index.cjs +1 -1
- package/dist/cjs/parser/iterators.cjs.map +1 -1
- package/dist/cjs/parser/lockman-parser.cjs +1 -1
- package/dist/cjs/parser/lockman-parser.cjs.map +1 -1
- package/dist/cjs/parser/tyndale-xml-parser.cjs +1 -1
- package/dist/cjs/parser/tyndale-xml-parser.cjs.map +1 -1
- package/dist/cjs/parser/types.cjs.map +1 -1
- package/dist/cjs/parser/usfm-parser.cjs +2 -2
- package/dist/cjs/parser/usfm-parser.cjs.map +1 -1
- package/dist/cjs/parser/usx-parser.cjs +122 -26
- package/dist/cjs/parser/usx-parser.cjs.map +2 -2
- package/dist/cjs/parser/words.cjs +187 -0
- package/dist/cjs/parser/words.cjs.map +7 -0
- package/dist/cjs/utils.cjs +1 -1
- package/dist/esm/generation/api.js +835 -37
- package/dist/esm/generation/api.js.map +3 -3
- package/dist/esm/generation/audio.js +1 -1
- package/dist/esm/generation/audio.js.map +1 -1
- package/dist/esm/generation/book-order.js.map +1 -1
- package/dist/esm/generation/common-types.js +327 -14
- package/dist/esm/generation/common-types.js.map +2 -2
- package/dist/esm/generation/dataset.js +6 -2
- package/dist/esm/generation/dataset.js.map +2 -2
- package/dist/esm/generation/index.js +2 -1
- package/dist/esm/generation/index.js.map +2 -2
- package/dist/esm/generation/simple.js +260 -0
- package/dist/esm/generation/simple.js.map +7 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/log.js.map +1 -1
- package/dist/esm/parser/codex-parser.js +3 -3
- package/dist/esm/parser/codex-parser.js.map +3 -3
- package/dist/esm/parser/commentary-csv-parser.js +3 -2
- package/dist/esm/parser/commentary-csv-parser.js.map +2 -2
- package/dist/esm/parser/iterators.js.map +1 -1
- package/dist/esm/parser/lockman-parser.js +1 -1
- package/dist/esm/parser/lockman-parser.js.map +1 -1
- package/dist/esm/parser/tyndale-xml-parser.js +1 -1
- package/dist/esm/parser/tyndale-xml-parser.js.map +1 -1
- package/dist/esm/parser/usfm-parser.js +1 -1
- package/dist/esm/parser/usfm-parser.js.map +1 -1
- package/dist/esm/parser/usx-parser.js +130 -26
- package/dist/esm/parser/usx-parser.js.map +2 -2
- package/dist/esm/parser/words.js +149 -0
- package/dist/esm/parser/words.js.map +7 -0
- package/dist/types/generation/api.d.ts +6879 -918
- package/dist/types/generation/common-types.d.ts +432 -2
- package/dist/types/generation/index.d.ts +2 -1
- package/dist/types/generation/simple.d.ts +110 -0
- package/dist/types/parser/commentary-csv-parser.d.ts +1 -1
- package/dist/types/parser/lockman-parser.d.ts +1 -1
- package/dist/types/parser/tyndale-xml-parser.d.ts +1 -1
- package/dist/types/parser/types.d.ts +63 -0
- package/dist/types/parser/usx-parser.d.ts +6 -5
- package/dist/types/parser/words.d.ts +104 -0
- package/package.json +3 -2
|
@@ -32,15 +32,30 @@ __export(api_exports, {
|
|
|
32
32
|
ApiDatasetBookSchema: () => ApiDatasetBookSchema,
|
|
33
33
|
ApiDatasetBooksSchema: () => ApiDatasetBooksSchema,
|
|
34
34
|
ApiDatasetSchema: () => ApiDatasetSchema,
|
|
35
|
+
ApiSimpleCommentaryBookChapterSchema: () => ApiSimpleCommentaryBookChapterSchema,
|
|
36
|
+
ApiSimpleTranslationBookChapterSchema: () => ApiSimpleTranslationBookChapterSchema,
|
|
37
|
+
ApiSimpleTranslationBookChapterWordsSchema: () => ApiSimpleTranslationBookChapterWordsSchema,
|
|
38
|
+
ApiSimpleTranslationCompleteBookSchema: () => ApiSimpleTranslationCompleteBookSchema,
|
|
39
|
+
ApiSimpleTranslationCompleteSchema: () => ApiSimpleTranslationCompleteSchema,
|
|
35
40
|
ApiTranslationBookChapterAudioSchema: () => ApiTranslationBookChapterAudioSchema,
|
|
41
|
+
ApiTranslationBookChapterAudioTimingsSchema: () => ApiTranslationBookChapterAudioTimingsSchema,
|
|
36
42
|
ApiTranslationBookChapterSchema: () => ApiTranslationBookChapterSchema,
|
|
43
|
+
ApiTranslationBookChapterWordsSchema: () => ApiTranslationBookChapterWordsSchema,
|
|
37
44
|
ApiTranslationBookSchema: () => ApiTranslationBookSchema,
|
|
38
45
|
ApiTranslationBooksSchema: () => ApiTranslationBooksSchema,
|
|
39
46
|
ApiTranslationCompleteBookSchema: () => ApiTranslationCompleteBookSchema,
|
|
40
47
|
ApiTranslationCompleteSchema: () => ApiTranslationCompleteSchema,
|
|
41
48
|
ApiTranslationSchema: () => ApiTranslationSchema,
|
|
49
|
+
CommentaryChapterReferenceSchema: () => CommentaryChapterReferenceSchema,
|
|
50
|
+
DatasetChapterReferenceSchema: () => DatasetChapterReferenceSchema,
|
|
51
|
+
SIMPLE_JSON_EXTENSION: () => SIMPLE_JSON_EXTENSION,
|
|
52
|
+
SimpleTranslationCompleteChapterSchema: () => SimpleTranslationCompleteChapterSchema,
|
|
53
|
+
TranslationChapterReferenceSchema: () => TranslationChapterReferenceSchema,
|
|
54
|
+
TranslationCompleteChapterSchema: () => TranslationCompleteChapterSchema,
|
|
42
55
|
bookChapterApiLink: () => bookChapterApiLink,
|
|
43
56
|
bookChapterAudioApiLink: () => bookChapterAudioApiLink,
|
|
57
|
+
bookChapterAudioTimingsApiLink: () => bookChapterAudioTimingsApiLink,
|
|
58
|
+
bookChapterWordsApiLink: () => bookChapterWordsApiLink,
|
|
44
59
|
bookCommentaryChapterApiLink: () => bookCommentaryChapterApiLink,
|
|
45
60
|
bookDatasetChapterApiLink: () => bookDatasetChapterApiLink,
|
|
46
61
|
completeTranslationApiLink: () => completeTranslationApiLink,
|
|
@@ -59,7 +74,8 @@ __export(api_exports, {
|
|
|
59
74
|
module.exports = __toCommonJS(api_exports);
|
|
60
75
|
var import_zod = require("zod");
|
|
61
76
|
var import_common_types = require("./common-types.js");
|
|
62
|
-
var
|
|
77
|
+
var import_simple = require("./simple.js");
|
|
78
|
+
var import_utils = require("../utils.js");
|
|
63
79
|
const ApiAvailableTranslationsSchema = import_zod.z.object({
|
|
64
80
|
/**
|
|
65
81
|
* The list of translations.
|
|
@@ -217,6 +233,15 @@ const ApiTranslationSchema = import_common_types.TranslationSchema.extend({
|
|
|
217
233
|
*/
|
|
218
234
|
completeTranslationApiLink: import_zod.z.string().optional().meta({
|
|
219
235
|
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."
|
|
236
|
+
}),
|
|
237
|
+
/**
|
|
238
|
+
* The API link for downloading the complete translation as a single JSON file,
|
|
239
|
+
* using the simplified chapter format.
|
|
240
|
+
*
|
|
241
|
+
* Undefined if complete translation files are not available.
|
|
242
|
+
*/
|
|
243
|
+
simpleCompleteTranslationApiLink: import_zod.z.string().optional().meta({
|
|
244
|
+
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."
|
|
220
245
|
})
|
|
221
246
|
}).meta({
|
|
222
247
|
id: "ApiTranslation",
|
|
@@ -239,6 +264,28 @@ const ApiTranslationCompleteSchema = import_zod.z.object({
|
|
|
239
264
|
id: "ApiTranslationComplete",
|
|
240
265
|
description: "Defines the complete translation download data. Maps to the /api/:translationId/complete.json endpoint."
|
|
241
266
|
});
|
|
267
|
+
const TranslationCompleteChapterSchema = import_common_types.TranslationBookChapterSchema.extend({
|
|
268
|
+
/**
|
|
269
|
+
* The number of verses that the chapter contains.
|
|
270
|
+
*/
|
|
271
|
+
numberOfVerses: import_zod.z.number().meta({
|
|
272
|
+
description: "The number of verses that the chapter contains."
|
|
273
|
+
})
|
|
274
|
+
}).meta({
|
|
275
|
+
id: "TranslationCompleteChapter",
|
|
276
|
+
description: "A chapter in the complete translation download."
|
|
277
|
+
});
|
|
278
|
+
const SimpleTranslationCompleteChapterSchema = import_common_types.SimpleTranslationBookChapterSchema.extend({
|
|
279
|
+
/**
|
|
280
|
+
* The number of verses that the chapter contains.
|
|
281
|
+
*/
|
|
282
|
+
numberOfVerses: import_zod.z.number().meta({
|
|
283
|
+
description: "The number of verses that the chapter contains."
|
|
284
|
+
})
|
|
285
|
+
}).meta({
|
|
286
|
+
id: "SimpleTranslationCompleteChapter",
|
|
287
|
+
description: "A chapter in the complete translation download, using the simplified chapter format."
|
|
288
|
+
});
|
|
242
289
|
const ApiTranslationCompleteBookSchema = import_common_types.TranslationBookSchema.extend({
|
|
243
290
|
/**
|
|
244
291
|
* The number of chapters in the book.
|
|
@@ -255,13 +302,41 @@ const ApiTranslationCompleteBookSchema = import_common_types.TranslationBookSche
|
|
|
255
302
|
/**
|
|
256
303
|
* The complete list of chapters with all content.
|
|
257
304
|
*/
|
|
258
|
-
chapters: import_zod.z.array(
|
|
305
|
+
chapters: import_zod.z.array(TranslationCompleteChapterSchema).meta({
|
|
259
306
|
description: "The complete list of chapters with all content."
|
|
260
307
|
})
|
|
261
308
|
}).meta({
|
|
262
309
|
id: "ApiTranslationCompleteBook",
|
|
263
310
|
description: "A book in the complete translation download."
|
|
264
311
|
});
|
|
312
|
+
const ApiSimpleTranslationCompleteSchema = import_zod.z.object({
|
|
313
|
+
/**
|
|
314
|
+
* The translation metadata.
|
|
315
|
+
*/
|
|
316
|
+
translation: import_zod.z.lazy(() => ApiTranslationSchema).meta({
|
|
317
|
+
description: "The translation metadata."
|
|
318
|
+
}),
|
|
319
|
+
/**
|
|
320
|
+
* The complete list of books with all their chapters.
|
|
321
|
+
*/
|
|
322
|
+
books: import_zod.z.array(import_zod.z.lazy(() => ApiSimpleTranslationCompleteBookSchema)).meta({
|
|
323
|
+
description: "The complete list of books with all their chapters."
|
|
324
|
+
})
|
|
325
|
+
}).meta({
|
|
326
|
+
id: "ApiSimpleTranslationComplete",
|
|
327
|
+
description: "Defines the complete translation download data, using the simplified chapter format. Maps to the /api/:translationId/complete.simple.json endpoint."
|
|
328
|
+
});
|
|
329
|
+
const ApiSimpleTranslationCompleteBookSchema = ApiTranslationCompleteBookSchema.extend({
|
|
330
|
+
/**
|
|
331
|
+
* The complete list of chapters with all content.
|
|
332
|
+
*/
|
|
333
|
+
chapters: import_zod.z.array(SimpleTranslationCompleteChapterSchema).meta({
|
|
334
|
+
description: "The complete list of chapters with all content."
|
|
335
|
+
})
|
|
336
|
+
}).meta({
|
|
337
|
+
id: "ApiSimpleTranslationCompleteBook",
|
|
338
|
+
description: "A book in the complete translation download, using the simplified chapter format."
|
|
339
|
+
});
|
|
265
340
|
const ApiCommentarySchema = import_common_types.CommentarySchema.extend({
|
|
266
341
|
/**
|
|
267
342
|
* The API link for the list of available books for this translation.
|
|
@@ -414,6 +489,42 @@ const ApiCommentaryProfileSchema = import_common_types.CommentaryProfileSchema.e
|
|
|
414
489
|
id: "ApiCommentaryProfile",
|
|
415
490
|
description: "Defines an interface that contains information about a profile."
|
|
416
491
|
});
|
|
492
|
+
const TranslationChapterReferenceSchema = import_zod.z.object({
|
|
493
|
+
translationId: import_zod.z.string().meta({
|
|
494
|
+
description: "The ID of the translation that the chapter reference is for."
|
|
495
|
+
}),
|
|
496
|
+
book: import_utils.BookIdSchema,
|
|
497
|
+
chapter: import_zod.z.int().positive().meta({
|
|
498
|
+
description: "The chapter number of the chapter reference."
|
|
499
|
+
})
|
|
500
|
+
}).meta({
|
|
501
|
+
id: "TranslationChapterReference",
|
|
502
|
+
description: "Defines a reference to a chapter in a translation."
|
|
503
|
+
});
|
|
504
|
+
const CommentaryChapterReferenceSchema = import_zod.z.object({
|
|
505
|
+
commentaryId: import_zod.z.string().meta({
|
|
506
|
+
description: "The ID of the commentary that the chapter reference is for."
|
|
507
|
+
}),
|
|
508
|
+
book: import_utils.BookIdSchema,
|
|
509
|
+
chapter: import_zod.z.int().positive().meta({
|
|
510
|
+
description: "The chapter number of the chapter reference."
|
|
511
|
+
})
|
|
512
|
+
}).meta({
|
|
513
|
+
id: "CommentaryChapterReference",
|
|
514
|
+
description: "Defines a reference to a chapter in a commentary."
|
|
515
|
+
});
|
|
516
|
+
const DatasetChapterReferenceSchema = import_zod.z.object({
|
|
517
|
+
datasetId: import_zod.z.string().meta({
|
|
518
|
+
description: "The ID of the dataset that the chapter reference is for."
|
|
519
|
+
}),
|
|
520
|
+
book: import_utils.BookIdSchema,
|
|
521
|
+
chapter: import_zod.z.int().positive().meta({
|
|
522
|
+
description: "The chapter number of the chapter reference."
|
|
523
|
+
})
|
|
524
|
+
}).meta({
|
|
525
|
+
id: "DatasetChapterReference",
|
|
526
|
+
description: "Defines a reference to a chapter in a dataset."
|
|
527
|
+
});
|
|
417
528
|
const ApiTranslationBookSchema = import_common_types.TranslationBookSchema.extend({
|
|
418
529
|
/**
|
|
419
530
|
* The number of the first chapter in the book.
|
|
@@ -427,6 +538,10 @@ const ApiTranslationBookSchema = import_common_types.TranslationBookSchema.exten
|
|
|
427
538
|
firstChapterApiLink: import_zod.z.string().meta({
|
|
428
539
|
description: "The link to the first chapter of the book."
|
|
429
540
|
}),
|
|
541
|
+
/**
|
|
542
|
+
* The reference for the first chapter in the book.
|
|
543
|
+
*/
|
|
544
|
+
firstChapterReference: TranslationChapterReferenceSchema,
|
|
430
545
|
/**
|
|
431
546
|
* The number of the last chapter in the book.
|
|
432
547
|
*/
|
|
@@ -439,6 +554,10 @@ const ApiTranslationBookSchema = import_common_types.TranslationBookSchema.exten
|
|
|
439
554
|
lastChapterApiLink: import_zod.z.string().meta({
|
|
440
555
|
description: "The link to the last chapter of the book."
|
|
441
556
|
}),
|
|
557
|
+
/**
|
|
558
|
+
* The reference for the last chapter in the book.
|
|
559
|
+
*/
|
|
560
|
+
lastChapterReference: TranslationChapterReferenceSchema,
|
|
442
561
|
/**
|
|
443
562
|
* The number of chapters that the book contains.
|
|
444
563
|
*/
|
|
@@ -472,6 +591,12 @@ const ApiCommentaryBookSchema = import_common_types.CommentaryBookSchema.extend(
|
|
|
472
591
|
firstChapterApiLink: import_zod.z.string().nullable().meta({
|
|
473
592
|
description: "The link to the first chapter of the book. Null if the comentary book has no chapters."
|
|
474
593
|
}),
|
|
594
|
+
/**
|
|
595
|
+
* The reference for the first chapter in the book.
|
|
596
|
+
*/
|
|
597
|
+
firstChapterReference: CommentaryChapterReferenceSchema.nullable().meta({
|
|
598
|
+
description: "The reference for the first chapter in the book. Null if the comentary book has no chapters."
|
|
599
|
+
}),
|
|
475
600
|
/**
|
|
476
601
|
* The number of the last chapter in the book.
|
|
477
602
|
*
|
|
@@ -488,6 +613,12 @@ const ApiCommentaryBookSchema = import_common_types.CommentaryBookSchema.extend(
|
|
|
488
613
|
lastChapterApiLink: import_zod.z.string().nullable().meta({
|
|
489
614
|
description: "The link to the last chapter of the book. Null if the comentary book has no chapters."
|
|
490
615
|
}),
|
|
616
|
+
/**
|
|
617
|
+
* The reference for the last chapter in the book.
|
|
618
|
+
*/
|
|
619
|
+
lastChapterReference: CommentaryChapterReferenceSchema.nullable().meta({
|
|
620
|
+
description: "The reference for the last chapter in the book. Null if the comentary book has no chapters."
|
|
621
|
+
}),
|
|
491
622
|
/**
|
|
492
623
|
* The number of chapters that the book contains.
|
|
493
624
|
*/
|
|
@@ -517,6 +648,10 @@ const ApiDatasetBookSchema = import_common_types.DatasetBookSchema.extend({
|
|
|
517
648
|
firstChapterApiLink: import_zod.z.string().meta({
|
|
518
649
|
description: "The link to the first chapter of the book."
|
|
519
650
|
}),
|
|
651
|
+
/**
|
|
652
|
+
* The reference for the first chapter in the book.
|
|
653
|
+
*/
|
|
654
|
+
firstChapterReference: DatasetChapterReferenceSchema,
|
|
520
655
|
/**
|
|
521
656
|
* The number of the last chapter in the book.
|
|
522
657
|
*/
|
|
@@ -529,6 +664,10 @@ const ApiDatasetBookSchema = import_common_types.DatasetBookSchema.extend({
|
|
|
529
664
|
lastChapterApiLink: import_zod.z.string().meta({
|
|
530
665
|
description: "The link to the last chapter of the book."
|
|
531
666
|
}),
|
|
667
|
+
/**
|
|
668
|
+
* The reference for the last chapter in the book.
|
|
669
|
+
*/
|
|
670
|
+
lastChapterReference: DatasetChapterReferenceSchema,
|
|
532
671
|
/**
|
|
533
672
|
* The number of chapters that the book contains.
|
|
534
673
|
*/
|
|
@@ -551,7 +690,10 @@ const ApiDatasetBookSchema = import_common_types.DatasetBookSchema.extend({
|
|
|
551
690
|
id: "ApiDatasetBook",
|
|
552
691
|
description: "Defines a schema that contains information about a book in a dataset."
|
|
553
692
|
});
|
|
554
|
-
const
|
|
693
|
+
const ApiTranslationBookChapterBaseSchema = import_common_types.TranslationBookChapterSchema.omit({
|
|
694
|
+
thisChapterWords: true
|
|
695
|
+
});
|
|
696
|
+
const ApiTranslationBookChapterSchema = ApiTranslationBookChapterBaseSchema.extend({
|
|
555
697
|
/**
|
|
556
698
|
* The translation information for the book chapter.
|
|
557
699
|
*/
|
|
@@ -570,6 +712,10 @@ const ApiTranslationBookChapterSchema = import_common_types.TranslationBookChapt
|
|
|
570
712
|
thisChapterLink: import_zod.z.string().meta({
|
|
571
713
|
description: "The API link for this chapter. Relative to the API origin."
|
|
572
714
|
}),
|
|
715
|
+
/**
|
|
716
|
+
* The reference for this chapter.
|
|
717
|
+
*/
|
|
718
|
+
thisChapterReference: TranslationChapterReferenceSchema,
|
|
573
719
|
/**
|
|
574
720
|
* The link to the next chapter.
|
|
575
721
|
* Null if this is the last chapter in the translation.
|
|
@@ -577,6 +723,15 @@ const ApiTranslationBookChapterSchema = import_common_types.TranslationBookChapt
|
|
|
577
723
|
nextChapterApiLink: import_zod.z.string().nullable().meta({
|
|
578
724
|
description: "The API link to the next chapter. Relative to the API origin. Null if this is the last chapter in the translation."
|
|
579
725
|
}),
|
|
726
|
+
/**
|
|
727
|
+
* The reference for the next chapter.
|
|
728
|
+
* Null if this is the last chapter in the translation.
|
|
729
|
+
*/
|
|
730
|
+
nextChapterReference: TranslationChapterReferenceSchema.nullable().meta(
|
|
731
|
+
{
|
|
732
|
+
description: "The reference for the next chapter. Null if this is the last chapter in the translation."
|
|
733
|
+
}
|
|
734
|
+
),
|
|
580
735
|
/**
|
|
581
736
|
* The links to the audio versions for the next chapter.
|
|
582
737
|
* Null if this is the last chapter in the translation.
|
|
@@ -584,6 +739,26 @@ const ApiTranslationBookChapterSchema = import_common_types.TranslationBookChapt
|
|
|
584
739
|
nextChapterAudioLinks: import_zod.z.record(import_zod.z.string(), import_zod.z.string()).nullable().meta({
|
|
585
740
|
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."
|
|
586
741
|
}),
|
|
742
|
+
/**
|
|
743
|
+
* The links to the audio timings for different audio versions for the chapter.
|
|
744
|
+
*/
|
|
745
|
+
thisChapterAudioTimings: import_zod.z.record(import_zod.z.string(), import_zod.z.string()).meta({
|
|
746
|
+
description: "The links to the audio timings for different audio versions for the chapter. Relative to the API origin."
|
|
747
|
+
}),
|
|
748
|
+
/**
|
|
749
|
+
* The links to the audio timings for different audio versions for the next chapter.
|
|
750
|
+
* Null if this is the last chapter in the translation.
|
|
751
|
+
*/
|
|
752
|
+
nextChapterAudioTimings: import_zod.z.record(import_zod.z.string(), import_zod.z.string()).nullable().meta({
|
|
753
|
+
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."
|
|
754
|
+
}),
|
|
755
|
+
/**
|
|
756
|
+
* The links to the audio timings for different audio versions for the previous chapter.
|
|
757
|
+
* Null if this is the first chapter in the translation.
|
|
758
|
+
*/
|
|
759
|
+
previousChapterAudioTimings: import_zod.z.record(import_zod.z.string(), import_zod.z.string()).nullable().meta({
|
|
760
|
+
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."
|
|
761
|
+
}),
|
|
587
762
|
/**
|
|
588
763
|
* The link to the previous chapter.
|
|
589
764
|
* Null if this is the first chapter in the translation.
|
|
@@ -591,6 +766,13 @@ const ApiTranslationBookChapterSchema = import_common_types.TranslationBookChapt
|
|
|
591
766
|
previousChapterApiLink: import_zod.z.string().nullable().meta({
|
|
592
767
|
description: "The API link to the previous chapter. Relative to the API origin. Null if this is the first chapter in the translation."
|
|
593
768
|
}),
|
|
769
|
+
/**
|
|
770
|
+
* The reference for the previous chapter.
|
|
771
|
+
* Null if this is the first chapter in the translation.
|
|
772
|
+
*/
|
|
773
|
+
previousChapterReference: TranslationChapterReferenceSchema.nullable().meta({
|
|
774
|
+
description: "The reference for the previous chapter. Null if this is the first chapter in the translation."
|
|
775
|
+
}),
|
|
594
776
|
/**
|
|
595
777
|
* The links to the audio versions for the previous chapter.
|
|
596
778
|
* Null if this is the first chapter in the translation.
|
|
@@ -598,16 +780,66 @@ const ApiTranslationBookChapterSchema = import_common_types.TranslationBookChapt
|
|
|
598
780
|
previousChapterAudioLinks: import_zod.z.record(import_zod.z.string(), import_zod.z.string()).nullable().meta({
|
|
599
781
|
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."
|
|
600
782
|
}),
|
|
783
|
+
/**
|
|
784
|
+
* The link to the word-level annotations for the chapter.
|
|
785
|
+
* Omitted if the chapter doesn't have any word-level annotations.
|
|
786
|
+
*/
|
|
787
|
+
thisChapterWordsLink: import_zod.z.string().optional().meta({
|
|
788
|
+
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."
|
|
789
|
+
}),
|
|
790
|
+
/**
|
|
791
|
+
* The link to the word-level annotations for the next chapter.
|
|
792
|
+
* Omitted if this is the last chapter in the translation, or if the next
|
|
793
|
+
* chapter doesn't have any word-level annotations.
|
|
794
|
+
*/
|
|
795
|
+
nextChapterWordsLink: import_zod.z.string().optional().meta({
|
|
796
|
+
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."
|
|
797
|
+
}),
|
|
798
|
+
/**
|
|
799
|
+
* The link to the word-level annotations for the previous chapter.
|
|
800
|
+
* Omitted if this is the first chapter in the translation, or if the
|
|
801
|
+
* previous chapter doesn't have any word-level annotations.
|
|
802
|
+
*/
|
|
803
|
+
previousChapterWordsLink: import_zod.z.string().optional().meta({
|
|
804
|
+
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."
|
|
805
|
+
}),
|
|
601
806
|
/**
|
|
602
807
|
* The number of verses that the chapter contains.
|
|
603
808
|
*/
|
|
604
809
|
numberOfVerses: import_zod.z.number().meta({
|
|
605
810
|
description: "The number of verses that the chapter contains."
|
|
811
|
+
}),
|
|
812
|
+
/**
|
|
813
|
+
* The link to the simplified version of this chapter.
|
|
814
|
+
* Omitted if simplified chapters were not generated.
|
|
815
|
+
*/
|
|
816
|
+
simpleChapterApiLink: import_zod.z.string().optional().meta({
|
|
817
|
+
description: "The API link to the simplified version of this chapter. Relative to the API origin. Omitted if simplified chapters are not available."
|
|
606
818
|
})
|
|
607
819
|
}).meta({
|
|
608
820
|
id: "ApiTranslationBookChapter",
|
|
609
821
|
description: "Defines an interface that contains information about a book chapter in a translation."
|
|
610
822
|
});
|
|
823
|
+
const ApiSimpleTranslationBookChapterSchema = ApiTranslationBookChapterSchema.omit({
|
|
824
|
+
chapter: true,
|
|
825
|
+
simpleChapterApiLink: true
|
|
826
|
+
}).extend({
|
|
827
|
+
/**
|
|
828
|
+
* The simplified information for the chapter.
|
|
829
|
+
*/
|
|
830
|
+
chapter: import_zod.z.lazy(() => import_common_types.SimpleChapterDataSchema).meta({
|
|
831
|
+
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."
|
|
832
|
+
}),
|
|
833
|
+
/**
|
|
834
|
+
* The link to the regular version of this chapter.
|
|
835
|
+
*/
|
|
836
|
+
fullChapterApiLink: import_zod.z.string().meta({
|
|
837
|
+
description: "The API link to the regular (non-simplified) version of this chapter. Relative to the API origin."
|
|
838
|
+
})
|
|
839
|
+
}).meta({
|
|
840
|
+
id: "ApiSimpleTranslationBookChapter",
|
|
841
|
+
description: "Defines an interface that contains information about a book chapter in a translation, using the simplified chapter format."
|
|
842
|
+
});
|
|
611
843
|
const ApiCommentaryBookChapterSchema = import_common_types.CommentaryBookChapterSchema.extend({
|
|
612
844
|
/**
|
|
613
845
|
* The commentary information for the book chapter.
|
|
@@ -627,6 +859,7 @@ const ApiCommentaryBookChapterSchema = import_common_types.CommentaryBookChapter
|
|
|
627
859
|
thisChapterLink: import_zod.z.string().meta({
|
|
628
860
|
description: "The API link for this chapter. Relative to the API origin."
|
|
629
861
|
}),
|
|
862
|
+
thisChapterReference: CommentaryChapterReferenceSchema,
|
|
630
863
|
/**
|
|
631
864
|
* The link to the next chapter.
|
|
632
865
|
* Null if this is the last chapter in the translation.
|
|
@@ -634,6 +867,9 @@ const ApiCommentaryBookChapterSchema = import_common_types.CommentaryBookChapter
|
|
|
634
867
|
nextChapterApiLink: import_zod.z.string().nullable().meta({
|
|
635
868
|
description: "The API link to the next chapter. Relative to the API origin. Null if this is the last chapter in the commentary."
|
|
636
869
|
}),
|
|
870
|
+
nextChapterReference: CommentaryChapterReferenceSchema.nullable().meta({
|
|
871
|
+
description: "The reference for the next chapter. Null if this is the last chapter in the commentary."
|
|
872
|
+
}),
|
|
637
873
|
/**
|
|
638
874
|
* The link to the previous chapter.
|
|
639
875
|
* Null if this is the first chapter in the translation.
|
|
@@ -641,16 +877,46 @@ const ApiCommentaryBookChapterSchema = import_common_types.CommentaryBookChapter
|
|
|
641
877
|
previousChapterApiLink: import_zod.z.string().nullable().meta({
|
|
642
878
|
description: "The API link to the previous chapter. Relative to the API origin. Null if this is the first chapter in the commentary."
|
|
643
879
|
}),
|
|
880
|
+
previousChapterReference: CommentaryChapterReferenceSchema.nullable().meta({
|
|
881
|
+
description: "The reference for the previous chapter. Null if this is the first chapter in the commentary."
|
|
882
|
+
}),
|
|
644
883
|
/**
|
|
645
884
|
* The number of verses that the chapter contains.
|
|
646
885
|
*/
|
|
647
886
|
numberOfVerses: import_zod.z.number().meta({
|
|
648
887
|
description: "The number of verses that the chapter contains."
|
|
888
|
+
}),
|
|
889
|
+
/**
|
|
890
|
+
* The link to the simplified version of this chapter.
|
|
891
|
+
* Omitted if simplified chapters were not generated.
|
|
892
|
+
*/
|
|
893
|
+
simpleChapterApiLink: import_zod.z.string().optional().meta({
|
|
894
|
+
description: "The API link to the simplified version of this chapter. Relative to the API origin. Omitted if simplified chapters are not available."
|
|
649
895
|
})
|
|
650
896
|
}).meta({
|
|
651
897
|
id: "ApiCommentaryBookChapter",
|
|
652
898
|
description: "Defines a schema that contains information about a book chapter in a commentary."
|
|
653
899
|
});
|
|
900
|
+
const ApiSimpleCommentaryBookChapterSchema = ApiCommentaryBookChapterSchema.omit({
|
|
901
|
+
chapter: true,
|
|
902
|
+
simpleChapterApiLink: true
|
|
903
|
+
}).extend({
|
|
904
|
+
/**
|
|
905
|
+
* The simplified information for the chapter.
|
|
906
|
+
*/
|
|
907
|
+
chapter: import_zod.z.lazy(() => import_common_types.SimpleCommentaryChapterDataSchema).meta({
|
|
908
|
+
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."
|
|
909
|
+
}),
|
|
910
|
+
/**
|
|
911
|
+
* The link to the regular version of this chapter.
|
|
912
|
+
*/
|
|
913
|
+
fullChapterApiLink: import_zod.z.string().meta({
|
|
914
|
+
description: "The API link to the regular (non-simplified) version of this chapter. Relative to the API origin."
|
|
915
|
+
})
|
|
916
|
+
}).meta({
|
|
917
|
+
id: "ApiSimpleCommentaryBookChapter",
|
|
918
|
+
description: "Defines a schema that contains information about a book chapter in a commentary, using the simplified chapter format."
|
|
919
|
+
});
|
|
654
920
|
const ApiDatasetBookChapterSchema = import_common_types.DatasetBookChapterSchema.extend({
|
|
655
921
|
/**
|
|
656
922
|
* The dataset information for the book chapter.
|
|
@@ -670,6 +936,7 @@ const ApiDatasetBookChapterSchema = import_common_types.DatasetBookChapterSchema
|
|
|
670
936
|
thisChapterLink: import_zod.z.string().meta({
|
|
671
937
|
description: "The API link for this chapter. Relative to the API origin."
|
|
672
938
|
}),
|
|
939
|
+
thisChapterReference: DatasetChapterReferenceSchema,
|
|
673
940
|
/**
|
|
674
941
|
* The link to the next chapter.
|
|
675
942
|
* Null if this is the last chapter in the translation.
|
|
@@ -677,6 +944,9 @@ const ApiDatasetBookChapterSchema = import_common_types.DatasetBookChapterSchema
|
|
|
677
944
|
nextChapterApiLink: import_zod.z.string().nullable().meta({
|
|
678
945
|
description: "The API link to the next chapter. Relative to the API origin. Null if this is the last chapter in the dataset."
|
|
679
946
|
}),
|
|
947
|
+
nextChapterReference: DatasetChapterReferenceSchema.nullable().meta({
|
|
948
|
+
description: "The reference for the next chapter. Null if this is the last chapter in the dataset."
|
|
949
|
+
}),
|
|
680
950
|
/**
|
|
681
951
|
* The link to the previous chapter.
|
|
682
952
|
* Null if this is the first chapter in the translation.
|
|
@@ -684,6 +954,9 @@ const ApiDatasetBookChapterSchema = import_common_types.DatasetBookChapterSchema
|
|
|
684
954
|
previousChapterApiLink: import_zod.z.string().nullable().meta({
|
|
685
955
|
description: "The API link to the previous chapter. Relative to the API origin. Null if this is the first chapter in the dataset."
|
|
686
956
|
}),
|
|
957
|
+
previousChapterReference: DatasetChapterReferenceSchema.nullable().meta({
|
|
958
|
+
description: "The reference for the previous chapter. Null if this is the first chapter in the dataset."
|
|
959
|
+
}),
|
|
687
960
|
/**
|
|
688
961
|
* The number of verses that the chapter contains.
|
|
689
962
|
*/
|
|
@@ -720,6 +993,169 @@ const ApiTranslationBookChapterAudioSchema = import_zod.z.object({
|
|
|
720
993
|
description: "The original URL of the audio."
|
|
721
994
|
})
|
|
722
995
|
});
|
|
996
|
+
const ApiTranslationBookChapterAudioTimingsSchema = import_zod.z.object({
|
|
997
|
+
/**
|
|
998
|
+
* The ID of the translation.
|
|
999
|
+
*/
|
|
1000
|
+
translationId: import_zod.z.string().meta({
|
|
1001
|
+
description: "The ID of the translation."
|
|
1002
|
+
}),
|
|
1003
|
+
/**
|
|
1004
|
+
* The ID of the book.
|
|
1005
|
+
*/
|
|
1006
|
+
bookId: import_zod.z.string().meta({
|
|
1007
|
+
description: "The ID of the book."
|
|
1008
|
+
}),
|
|
1009
|
+
/**
|
|
1010
|
+
* The number of the chapter.
|
|
1011
|
+
*/
|
|
1012
|
+
chapterNumber: import_zod.z.number().meta({
|
|
1013
|
+
description: "The number of the chapter."
|
|
1014
|
+
}),
|
|
1015
|
+
/**
|
|
1016
|
+
* The reader for the chapter.
|
|
1017
|
+
*/
|
|
1018
|
+
reader: import_zod.z.string().meta({
|
|
1019
|
+
description: "The reader for the chapter."
|
|
1020
|
+
}),
|
|
1021
|
+
/**
|
|
1022
|
+
* The link to the audio for these timings.
|
|
1023
|
+
*/
|
|
1024
|
+
audioLink: import_zod.z.string().meta({
|
|
1025
|
+
description: "The link to the audio for these timings."
|
|
1026
|
+
}),
|
|
1027
|
+
/**
|
|
1028
|
+
* The link to the information for this chapter.
|
|
1029
|
+
*/
|
|
1030
|
+
thisChapterLink: import_zod.z.string().meta({
|
|
1031
|
+
description: "The link to the information for this chapter."
|
|
1032
|
+
}),
|
|
1033
|
+
/**
|
|
1034
|
+
* The link to the information for the next chapter.
|
|
1035
|
+
* Null if this is the last chapter in the translation.
|
|
1036
|
+
*/
|
|
1037
|
+
nextChapterLink: import_zod.z.string().nullable().meta({
|
|
1038
|
+
description: "The link to the information for the next chapter. Null if this is the last chapter in the translation."
|
|
1039
|
+
}),
|
|
1040
|
+
/**
|
|
1041
|
+
* The link to the information for the previous chapter.
|
|
1042
|
+
* Null if this is the first chapter in the translation.
|
|
1043
|
+
*/
|
|
1044
|
+
previousChapterLink: import_zod.z.string().nullable().meta({
|
|
1045
|
+
description: "The link to the information for the previous chapter. Null if this is the first chapter in the translation."
|
|
1046
|
+
}),
|
|
1047
|
+
/**
|
|
1048
|
+
* The link to this audio timings file.
|
|
1049
|
+
*/
|
|
1050
|
+
thisChapterAudioTimingsLink: import_zod.z.string().meta({
|
|
1051
|
+
description: "The link to this audio timings file."
|
|
1052
|
+
}),
|
|
1053
|
+
/**
|
|
1054
|
+
* The link to the timings for the next chapter.
|
|
1055
|
+
* Null if this is the last chapter in the translation.
|
|
1056
|
+
*/
|
|
1057
|
+
nextChapterAudioTimingsLink: import_zod.z.string().nullable().meta({
|
|
1058
|
+
description: "The link to the timings for the next chapter. Null if this is the last chapter in the translation."
|
|
1059
|
+
}),
|
|
1060
|
+
/**
|
|
1061
|
+
* The link to the timings for the previous chapter.
|
|
1062
|
+
* Null if this is the first chapter in the translation.
|
|
1063
|
+
*/
|
|
1064
|
+
previousChapterAudioTimingsLink: import_zod.z.string().nullable().meta({
|
|
1065
|
+
description: "The link to the timings for the previous chapter. Null if this is the first chapter in the translation."
|
|
1066
|
+
}),
|
|
1067
|
+
/**
|
|
1068
|
+
* The times in seconds at which each verse starts, in order.
|
|
1069
|
+
*/
|
|
1070
|
+
verses: import_zod.z.array(import_zod.z.number()).meta({
|
|
1071
|
+
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."
|
|
1072
|
+
})
|
|
1073
|
+
}).meta({
|
|
1074
|
+
id: "ApiTranslationBookChapterAudioTimings",
|
|
1075
|
+
description: "Defines an interface that contains the audio timings for a book chapter, for a specific reader."
|
|
1076
|
+
});
|
|
1077
|
+
const ApiTranslationBookChapterWordsSchema = import_zod.z.object({
|
|
1078
|
+
/**
|
|
1079
|
+
* The ID of the translation.
|
|
1080
|
+
*/
|
|
1081
|
+
translationId: import_zod.z.string().meta({
|
|
1082
|
+
description: "The ID of the translation."
|
|
1083
|
+
}),
|
|
1084
|
+
/**
|
|
1085
|
+
* The ID of the book.
|
|
1086
|
+
*/
|
|
1087
|
+
bookId: import_zod.z.string().meta({
|
|
1088
|
+
description: "The ID of the book."
|
|
1089
|
+
}),
|
|
1090
|
+
/**
|
|
1091
|
+
* The number of the chapter.
|
|
1092
|
+
*/
|
|
1093
|
+
chapterNumber: import_zod.z.number().meta({
|
|
1094
|
+
description: "The number of the chapter."
|
|
1095
|
+
}),
|
|
1096
|
+
/**
|
|
1097
|
+
* The link to the information for this chapter.
|
|
1098
|
+
*/
|
|
1099
|
+
thisChapterLink: import_zod.z.string().meta({
|
|
1100
|
+
description: "The link to the information for this chapter."
|
|
1101
|
+
}),
|
|
1102
|
+
/**
|
|
1103
|
+
* The link to the information for the next chapter.
|
|
1104
|
+
* Null if this is the last chapter in the translation.
|
|
1105
|
+
*/
|
|
1106
|
+
nextChapterLink: import_zod.z.string().nullable().meta({
|
|
1107
|
+
description: "The link to the information for the next chapter. Null if this is the last chapter in the translation."
|
|
1108
|
+
}),
|
|
1109
|
+
/**
|
|
1110
|
+
* The link to the information for the previous chapter.
|
|
1111
|
+
* Null if this is the first chapter in the translation.
|
|
1112
|
+
*/
|
|
1113
|
+
previousChapterLink: import_zod.z.string().nullable().meta({
|
|
1114
|
+
description: "The link to the information for the previous chapter. Null if this is the first chapter in the translation."
|
|
1115
|
+
}),
|
|
1116
|
+
/**
|
|
1117
|
+
* The link to this words file.
|
|
1118
|
+
*/
|
|
1119
|
+
thisChapterWordsLink: import_zod.z.string().meta({
|
|
1120
|
+
description: "The link to this words file."
|
|
1121
|
+
}),
|
|
1122
|
+
/**
|
|
1123
|
+
* The link to the words for the next chapter.
|
|
1124
|
+
* Null if this is the last chapter in the translation, or if the next chapter
|
|
1125
|
+
* doesn't have any word-level annotations.
|
|
1126
|
+
*/
|
|
1127
|
+
nextChapterWordsLink: import_zod.z.string().nullable().meta({
|
|
1128
|
+
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."
|
|
1129
|
+
}),
|
|
1130
|
+
/**
|
|
1131
|
+
* The link to the words for the previous chapter.
|
|
1132
|
+
* Null if this is the first chapter in the translation, or if the previous
|
|
1133
|
+
* chapter doesn't have any word-level annotations.
|
|
1134
|
+
*/
|
|
1135
|
+
previousChapterWordsLink: import_zod.z.string().nullable().meta({
|
|
1136
|
+
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."
|
|
1137
|
+
}),
|
|
1138
|
+
/**
|
|
1139
|
+
* The annotated words for each verse in the chapter.
|
|
1140
|
+
*/
|
|
1141
|
+
verses: import_zod.z.record(import_zod.z.string(), import_zod.z.array(import_zod.z.lazy(() => import_common_types.ChapterWordSchema))).meta({
|
|
1142
|
+
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."
|
|
1143
|
+
})
|
|
1144
|
+
}).meta({
|
|
1145
|
+
id: "ApiTranslationBookChapterWords",
|
|
1146
|
+
description: "Defines an interface that contains the word-level annotations for a book chapter."
|
|
1147
|
+
});
|
|
1148
|
+
const ApiSimpleTranslationBookChapterWordsSchema = ApiTranslationBookChapterWordsSchema.extend({
|
|
1149
|
+
/**
|
|
1150
|
+
* The annotated words for each verse in the chapter.
|
|
1151
|
+
*/
|
|
1152
|
+
verses: import_zod.z.record(import_zod.z.string(), import_zod.z.array(import_zod.z.lazy(() => import_common_types.SimpleChapterWordSchema))).meta({
|
|
1153
|
+
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."
|
|
1154
|
+
})
|
|
1155
|
+
}).meta({
|
|
1156
|
+
id: "ApiSimpleTranslationBookChapterWords",
|
|
1157
|
+
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."
|
|
1158
|
+
});
|
|
723
1159
|
const ApiCommentaryProfileContentSchema = import_zod.z.object({
|
|
724
1160
|
/**
|
|
725
1161
|
* The commentary information for the profile.
|
|
@@ -743,6 +1179,7 @@ const ApiCommentaryProfileContentSchema = import_zod.z.object({
|
|
|
743
1179
|
function generateApiForDataset(dataset, options = {}) {
|
|
744
1180
|
const { useCommonName, pathPrefix } = options;
|
|
745
1181
|
const apiPathPrefix = pathPrefix ? pathPrefix : "";
|
|
1182
|
+
const generateSimpleChapterFiles = !!options.generateSimpleChapterFiles;
|
|
746
1183
|
let api = {
|
|
747
1184
|
availableTranslations: {
|
|
748
1185
|
translations: []
|
|
@@ -750,7 +1187,10 @@ function generateApiForDataset(dataset, options = {}) {
|
|
|
750
1187
|
translationBooks: [],
|
|
751
1188
|
translationBookChapters: [],
|
|
752
1189
|
translationBookChapterAudio: [],
|
|
1190
|
+
translationBookChapterAudioTimings: [],
|
|
1191
|
+
translationBookChapterWords: [],
|
|
753
1192
|
translationComplete: [],
|
|
1193
|
+
simpleTranslationComplete: [],
|
|
754
1194
|
availableCommentaries: {
|
|
755
1195
|
commentaries: []
|
|
756
1196
|
},
|
|
@@ -760,6 +1200,11 @@ function generateApiForDataset(dataset, options = {}) {
|
|
|
760
1200
|
commentaryProfileContents: [],
|
|
761
1201
|
pathPrefix: apiPathPrefix
|
|
762
1202
|
};
|
|
1203
|
+
if (generateSimpleChapterFiles) {
|
|
1204
|
+
api.simpleTranslationBookChapters = [];
|
|
1205
|
+
api.simpleTranslationBookChapterWords = [];
|
|
1206
|
+
api.simpleCommentaryBookChapters = [];
|
|
1207
|
+
}
|
|
763
1208
|
const getNativeName = options.getNativeName;
|
|
764
1209
|
const getEnglishName = options.getEnglishName;
|
|
765
1210
|
for (let { books, ...translation } of dataset.translations) {
|
|
@@ -780,6 +1225,11 @@ function generateApiForDataset(dataset, options = {}) {
|
|
|
780
1225
|
apiPathPrefix
|
|
781
1226
|
),
|
|
782
1227
|
completeTranslationApiLink: options.generateCompleteTranslationFiles ? completeTranslationApiLink(translation.id, apiPathPrefix) : void 0,
|
|
1228
|
+
simpleCompleteTranslationApiLink: options.generateCompleteTranslationFiles ? completeTranslationApiLink(
|
|
1229
|
+
translation.id,
|
|
1230
|
+
apiPathPrefix,
|
|
1231
|
+
SIMPLE_JSON_EXTENSION
|
|
1232
|
+
) : void 0,
|
|
783
1233
|
numberOfBooks,
|
|
784
1234
|
totalNumberOfChapters: 0,
|
|
785
1235
|
totalNumberOfVerses: 0,
|
|
@@ -794,6 +1244,9 @@ function generateApiForDataset(dataset, options = {}) {
|
|
|
794
1244
|
books: []
|
|
795
1245
|
};
|
|
796
1246
|
let translationChapters = [];
|
|
1247
|
+
let pendingAudioTimings = [];
|
|
1248
|
+
let rawAudioTimingsByChapter = /* @__PURE__ */ new Map();
|
|
1249
|
+
let rawWordsByChapter = /* @__PURE__ */ new Map();
|
|
797
1250
|
for (let { chapters, ...book } of books) {
|
|
798
1251
|
const firstChapterNumber = chapters[0]?.chapter.number;
|
|
799
1252
|
const lastChapterNumber = chapters[chapters.length - 1]?.chapter.number;
|
|
@@ -807,6 +1260,11 @@ function generateApiForDataset(dataset, options = {}) {
|
|
|
807
1260
|
"json",
|
|
808
1261
|
apiPathPrefix
|
|
809
1262
|
),
|
|
1263
|
+
firstChapterReference: {
|
|
1264
|
+
translationId: translation.id,
|
|
1265
|
+
book: book.id,
|
|
1266
|
+
chapter: firstChapterNumber
|
|
1267
|
+
},
|
|
810
1268
|
lastChapterNumber,
|
|
811
1269
|
lastChapterApiLink: bookChapterApiLink(
|
|
812
1270
|
translation.id,
|
|
@@ -815,11 +1273,22 @@ function generateApiForDataset(dataset, options = {}) {
|
|
|
815
1273
|
"json",
|
|
816
1274
|
apiPathPrefix
|
|
817
1275
|
),
|
|
1276
|
+
lastChapterReference: {
|
|
1277
|
+
translationId: translation.id,
|
|
1278
|
+
book: book.id,
|
|
1279
|
+
chapter: lastChapterNumber
|
|
1280
|
+
},
|
|
818
1281
|
numberOfChapters: chapters.length,
|
|
819
1282
|
totalNumberOfVerses: 0
|
|
820
1283
|
};
|
|
821
|
-
for (let {
|
|
1284
|
+
for (let {
|
|
1285
|
+
chapter,
|
|
1286
|
+
thisChapterAudioLinks,
|
|
1287
|
+
thisChapterAudioTimings,
|
|
1288
|
+
thisChapterWords
|
|
1289
|
+
} of chapters) {
|
|
822
1290
|
const audio = {};
|
|
1291
|
+
const audioTimings = {};
|
|
823
1292
|
const apiBookChapter = {
|
|
824
1293
|
translation: apiTranslation,
|
|
825
1294
|
book: apiBook,
|
|
@@ -831,12 +1300,29 @@ function generateApiForDataset(dataset, options = {}) {
|
|
|
831
1300
|
"json",
|
|
832
1301
|
apiPathPrefix
|
|
833
1302
|
),
|
|
1303
|
+
thisChapterReference: {
|
|
1304
|
+
translationId: translation.id,
|
|
1305
|
+
book: book.id,
|
|
1306
|
+
chapter: chapter.number
|
|
1307
|
+
},
|
|
834
1308
|
thisChapterAudioLinks: audio,
|
|
835
1309
|
nextChapterApiLink: null,
|
|
1310
|
+
nextChapterReference: null,
|
|
836
1311
|
nextChapterAudioLinks: null,
|
|
837
1312
|
previousChapterApiLink: null,
|
|
1313
|
+
previousChapterReference: null,
|
|
838
1314
|
previousChapterAudioLinks: null,
|
|
839
|
-
|
|
1315
|
+
thisChapterAudioTimings: audioTimings,
|
|
1316
|
+
nextChapterAudioTimings: null,
|
|
1317
|
+
previousChapterAudioTimings: null,
|
|
1318
|
+
numberOfVerses: 0,
|
|
1319
|
+
simpleChapterApiLink: generateSimpleChapterFiles ? bookChapterApiLink(
|
|
1320
|
+
translation.id,
|
|
1321
|
+
getBookLink(book),
|
|
1322
|
+
chapter.number,
|
|
1323
|
+
SIMPLE_JSON_EXTENSION,
|
|
1324
|
+
apiPathPrefix
|
|
1325
|
+
) : void 0
|
|
840
1326
|
};
|
|
841
1327
|
for (let reader in thisChapterAudioLinks) {
|
|
842
1328
|
if (options.generateAudioFiles) {
|
|
@@ -857,6 +1343,34 @@ function generateApiForDataset(dataset, options = {}) {
|
|
|
857
1343
|
audio[reader] = thisChapterAudioLinks[reader];
|
|
858
1344
|
}
|
|
859
1345
|
}
|
|
1346
|
+
rawAudioTimingsByChapter.set(
|
|
1347
|
+
apiBookChapter,
|
|
1348
|
+
thisChapterAudioTimings
|
|
1349
|
+
);
|
|
1350
|
+
if (thisChapterWords) {
|
|
1351
|
+
apiBookChapter.thisChapterWordsLink = bookChapterWordsApiLink(
|
|
1352
|
+
translation.id,
|
|
1353
|
+
getBookLink(book),
|
|
1354
|
+
chapter.number,
|
|
1355
|
+
apiPathPrefix
|
|
1356
|
+
);
|
|
1357
|
+
rawWordsByChapter.set(apiBookChapter, thisChapterWords);
|
|
1358
|
+
}
|
|
1359
|
+
for (let reader in thisChapterAudioTimings) {
|
|
1360
|
+
const verses = thisChapterAudioTimings[reader];
|
|
1361
|
+
audioTimings[reader] = bookChapterAudioTimingsApiLink(
|
|
1362
|
+
translation.id,
|
|
1363
|
+
getBookLink(book),
|
|
1364
|
+
chapter.number,
|
|
1365
|
+
reader,
|
|
1366
|
+
apiPathPrefix
|
|
1367
|
+
);
|
|
1368
|
+
pendingAudioTimings.push({
|
|
1369
|
+
reader,
|
|
1370
|
+
verses,
|
|
1371
|
+
apiBookChapter
|
|
1372
|
+
});
|
|
1373
|
+
}
|
|
860
1374
|
for (let c of chapter.content) {
|
|
861
1375
|
if (c.type === "verse") {
|
|
862
1376
|
apiBookChapter.numberOfVerses++;
|
|
@@ -882,54 +1396,226 @@ function generateApiForDataset(dataset, options = {}) {
|
|
|
882
1396
|
}
|
|
883
1397
|
}
|
|
884
1398
|
for (let i = 0; i < translationChapters.length; i++) {
|
|
1399
|
+
const currentChapter = translationChapters[i];
|
|
885
1400
|
if (i > 0) {
|
|
886
|
-
translationChapters[i
|
|
1401
|
+
const previousChapter = translationChapters[i - 1];
|
|
1402
|
+
currentChapter.previousChapterApiLink = bookChapterApiLink(
|
|
887
1403
|
translation.id,
|
|
888
|
-
getBookLink(
|
|
889
|
-
|
|
1404
|
+
getBookLink(previousChapter.book),
|
|
1405
|
+
previousChapter.chapter.number,
|
|
890
1406
|
"json",
|
|
891
1407
|
apiPathPrefix
|
|
892
1408
|
);
|
|
893
|
-
|
|
1409
|
+
currentChapter.previousChapterReference = {
|
|
1410
|
+
translationId: translation.id,
|
|
1411
|
+
book: previousChapter.book.id,
|
|
1412
|
+
chapter: previousChapter.chapter.number
|
|
1413
|
+
};
|
|
1414
|
+
currentChapter.previousChapterAudioLinks = previousChapter.thisChapterAudioLinks;
|
|
1415
|
+
currentChapter.previousChapterAudioTimings = previousChapter.thisChapterAudioTimings;
|
|
1416
|
+
if (previousChapter.thisChapterWordsLink) {
|
|
1417
|
+
currentChapter.previousChapterWordsLink = previousChapter.thisChapterWordsLink;
|
|
1418
|
+
}
|
|
894
1419
|
}
|
|
895
1420
|
if (i < translationChapters.length - 1) {
|
|
896
|
-
translationChapters[i
|
|
1421
|
+
const nextChapter = translationChapters[i + 1];
|
|
1422
|
+
currentChapter.nextChapterApiLink = bookChapterApiLink(
|
|
897
1423
|
translation.id,
|
|
898
|
-
getBookLink(
|
|
899
|
-
|
|
1424
|
+
getBookLink(nextChapter.book),
|
|
1425
|
+
nextChapter.chapter.number,
|
|
900
1426
|
"json",
|
|
901
1427
|
apiPathPrefix
|
|
902
1428
|
);
|
|
903
|
-
|
|
1429
|
+
currentChapter.nextChapterReference = {
|
|
1430
|
+
translationId: translation.id,
|
|
1431
|
+
book: nextChapter.book.id,
|
|
1432
|
+
chapter: nextChapter.chapter.number
|
|
1433
|
+
};
|
|
1434
|
+
currentChapter.nextChapterAudioLinks = nextChapter.thisChapterAudioLinks;
|
|
1435
|
+
currentChapter.nextChapterAudioTimings = nextChapter.thisChapterAudioTimings;
|
|
1436
|
+
if (nextChapter.thisChapterWordsLink) {
|
|
1437
|
+
currentChapter.nextChapterWordsLink = nextChapter.thisChapterWordsLink;
|
|
1438
|
+
}
|
|
1439
|
+
}
|
|
1440
|
+
}
|
|
1441
|
+
const simplifiedChapters = /* @__PURE__ */ new Map();
|
|
1442
|
+
if (generateSimpleChapterFiles || options.generateCompleteTranslationFiles) {
|
|
1443
|
+
for (let chapter of translationChapters) {
|
|
1444
|
+
simplifiedChapters.set(
|
|
1445
|
+
chapter,
|
|
1446
|
+
(0, import_simple.simplifyChapter)(
|
|
1447
|
+
chapter.chapter,
|
|
1448
|
+
rawWordsByChapter.get(chapter)
|
|
1449
|
+
)
|
|
1450
|
+
);
|
|
904
1451
|
}
|
|
905
1452
|
}
|
|
1453
|
+
if (api.simpleTranslationBookChapters) {
|
|
1454
|
+
let hasSimpleWords2 = function(chapter) {
|
|
1455
|
+
const words = simplifiedChapters.get(chapter)?.words;
|
|
1456
|
+
return !!words && Object.keys(words).length > 0;
|
|
1457
|
+
};
|
|
1458
|
+
var hasSimpleWords = hasSimpleWords2;
|
|
1459
|
+
const simpleChapterLink = (chapter) => bookChapterApiLink(
|
|
1460
|
+
translation.id,
|
|
1461
|
+
getBookLink(chapter.book),
|
|
1462
|
+
chapter.chapter.number,
|
|
1463
|
+
SIMPLE_JSON_EXTENSION,
|
|
1464
|
+
apiPathPrefix
|
|
1465
|
+
);
|
|
1466
|
+
const simpleWordsLink = (chapter) => hasSimpleWords2(chapter) ? bookChapterWordsApiLink(
|
|
1467
|
+
translation.id,
|
|
1468
|
+
getBookLink(chapter.book),
|
|
1469
|
+
chapter.chapter.number,
|
|
1470
|
+
apiPathPrefix,
|
|
1471
|
+
SIMPLE_JSON_EXTENSION
|
|
1472
|
+
) : void 0;
|
|
1473
|
+
for (let i = 0; i < translationChapters.length; i++) {
|
|
1474
|
+
const currentChapter = translationChapters[i];
|
|
1475
|
+
const {
|
|
1476
|
+
chapter,
|
|
1477
|
+
simpleChapterApiLink,
|
|
1478
|
+
thisChapterWordsLink,
|
|
1479
|
+
nextChapterWordsLink,
|
|
1480
|
+
previousChapterWordsLink,
|
|
1481
|
+
...rest
|
|
1482
|
+
} = currentChapter;
|
|
1483
|
+
const previousChapter = translationChapters[i - 1];
|
|
1484
|
+
const nextChapter = translationChapters[i + 1];
|
|
1485
|
+
const simplified = simplifiedChapters.get(currentChapter);
|
|
1486
|
+
const simpleChapter = {
|
|
1487
|
+
...rest,
|
|
1488
|
+
chapter: simplified.chapter,
|
|
1489
|
+
thisChapterLink: simpleChapterLink(currentChapter),
|
|
1490
|
+
fullChapterApiLink: rest.thisChapterLink,
|
|
1491
|
+
previousChapterApiLink: previousChapter ? simpleChapterLink(previousChapter) : null,
|
|
1492
|
+
nextChapterApiLink: nextChapter ? simpleChapterLink(nextChapter) : null
|
|
1493
|
+
};
|
|
1494
|
+
const thisWordsLink = simpleWordsLink(currentChapter);
|
|
1495
|
+
if (thisWordsLink) {
|
|
1496
|
+
simpleChapter.thisChapterWordsLink = thisWordsLink;
|
|
1497
|
+
api.simpleTranslationBookChapterWords?.push({
|
|
1498
|
+
translationId: translation.id,
|
|
1499
|
+
bookId: currentChapter.book.id,
|
|
1500
|
+
chapterNumber: currentChapter.chapter.number,
|
|
1501
|
+
thisChapterLink: simpleChapter.thisChapterLink,
|
|
1502
|
+
nextChapterLink: simpleChapter.nextChapterApiLink,
|
|
1503
|
+
previousChapterLink: simpleChapter.previousChapterApiLink,
|
|
1504
|
+
thisChapterWordsLink: thisWordsLink,
|
|
1505
|
+
nextChapterWordsLink: nextChapter ? simpleWordsLink(nextChapter) ?? null : null,
|
|
1506
|
+
previousChapterWordsLink: previousChapter ? simpleWordsLink(previousChapter) ?? null : null,
|
|
1507
|
+
verses: simplified.words
|
|
1508
|
+
});
|
|
1509
|
+
}
|
|
1510
|
+
const nextWordsLink = nextChapter ? simpleWordsLink(nextChapter) : void 0;
|
|
1511
|
+
if (nextWordsLink) {
|
|
1512
|
+
simpleChapter.nextChapterWordsLink = nextWordsLink;
|
|
1513
|
+
}
|
|
1514
|
+
const previousWordsLink = previousChapter ? simpleWordsLink(previousChapter) : void 0;
|
|
1515
|
+
if (previousWordsLink) {
|
|
1516
|
+
simpleChapter.previousChapterWordsLink = previousWordsLink;
|
|
1517
|
+
}
|
|
1518
|
+
api.simpleTranslationBookChapters.push(simpleChapter);
|
|
1519
|
+
}
|
|
1520
|
+
}
|
|
1521
|
+
for (let { reader, verses, apiBookChapter } of pendingAudioTimings) {
|
|
1522
|
+
api.translationBookChapterAudioTimings.push({
|
|
1523
|
+
translationId: translation.id,
|
|
1524
|
+
bookId: apiBookChapter.book.id,
|
|
1525
|
+
chapterNumber: apiBookChapter.chapter.number,
|
|
1526
|
+
reader,
|
|
1527
|
+
audioLink: apiBookChapter.thisChapterAudioLinks[reader] ?? "",
|
|
1528
|
+
thisChapterLink: apiBookChapter.thisChapterLink,
|
|
1529
|
+
nextChapterLink: apiBookChapter.nextChapterApiLink,
|
|
1530
|
+
previousChapterLink: apiBookChapter.previousChapterApiLink,
|
|
1531
|
+
thisChapterAudioTimingsLink: apiBookChapter.thisChapterAudioTimings[reader],
|
|
1532
|
+
nextChapterAudioTimingsLink: apiBookChapter.nextChapterAudioTimings?.[reader] ?? null,
|
|
1533
|
+
previousChapterAudioTimingsLink: apiBookChapter.previousChapterAudioTimings?.[reader] ?? null,
|
|
1534
|
+
verses
|
|
1535
|
+
});
|
|
1536
|
+
}
|
|
1537
|
+
for (let apiBookChapter of translationChapters) {
|
|
1538
|
+
const words = rawWordsByChapter.get(apiBookChapter);
|
|
1539
|
+
if (!words || !apiBookChapter.thisChapterWordsLink) {
|
|
1540
|
+
continue;
|
|
1541
|
+
}
|
|
1542
|
+
api.translationBookChapterWords.push({
|
|
1543
|
+
translationId: translation.id,
|
|
1544
|
+
bookId: apiBookChapter.book.id,
|
|
1545
|
+
chapterNumber: apiBookChapter.chapter.number,
|
|
1546
|
+
thisChapterLink: apiBookChapter.thisChapterLink,
|
|
1547
|
+
nextChapterLink: apiBookChapter.nextChapterApiLink,
|
|
1548
|
+
previousChapterLink: apiBookChapter.previousChapterApiLink,
|
|
1549
|
+
thisChapterWordsLink: apiBookChapter.thisChapterWordsLink,
|
|
1550
|
+
nextChapterWordsLink: apiBookChapter.nextChapterWordsLink ?? null,
|
|
1551
|
+
previousChapterWordsLink: apiBookChapter.previousChapterWordsLink ?? null,
|
|
1552
|
+
verses: words
|
|
1553
|
+
});
|
|
1554
|
+
}
|
|
906
1555
|
api.availableTranslations.translations.push(apiTranslation);
|
|
907
1556
|
api.translationBooks.push(translationBooks);
|
|
908
1557
|
if (options.generateCompleteTranslationFiles) {
|
|
1558
|
+
const completeBooks = translationBooks.books.map((book) => ({
|
|
1559
|
+
book,
|
|
1560
|
+
chapters: translationChapters.filter(
|
|
1561
|
+
(ch) => ch.book.id === book.id
|
|
1562
|
+
)
|
|
1563
|
+
}));
|
|
1564
|
+
const completeBook = (book, chapters) => ({
|
|
1565
|
+
id: book.id,
|
|
1566
|
+
name: book.name,
|
|
1567
|
+
commonName: book.commonName,
|
|
1568
|
+
title: book.title,
|
|
1569
|
+
order: book.order,
|
|
1570
|
+
numberOfChapters: book.numberOfChapters,
|
|
1571
|
+
totalNumberOfVerses: book.totalNumberOfVerses,
|
|
1572
|
+
isApocryphal: book.isApocryphal,
|
|
1573
|
+
chapters
|
|
1574
|
+
});
|
|
1575
|
+
const completeChapter = (chapter) => ({
|
|
1576
|
+
numberOfVerses: chapter.numberOfVerses,
|
|
1577
|
+
thisChapterAudioLinks: chapter.thisChapterAudioLinks,
|
|
1578
|
+
// The complete files contain the raw audio timings rather than links
|
|
1579
|
+
// to them, since the point is to have everything in one file.
|
|
1580
|
+
thisChapterAudioTimings: rawAudioTimingsByChapter.get(chapter) ?? {}
|
|
1581
|
+
});
|
|
909
1582
|
const completeTranslation = {
|
|
910
1583
|
translation: apiTranslation,
|
|
911
|
-
books:
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
thisChapterAudioLinks: ch.thisChapterAudioLinks,
|
|
927
|
-
chapter: ch.chapter
|
|
928
|
-
}))
|
|
929
|
-
};
|
|
930
|
-
})
|
|
1584
|
+
books: completeBooks.map(
|
|
1585
|
+
({ book, chapters }) => completeBook(
|
|
1586
|
+
book,
|
|
1587
|
+
chapters.map((ch) => {
|
|
1588
|
+
const words = rawWordsByChapter.get(ch);
|
|
1589
|
+
return {
|
|
1590
|
+
...completeChapter(ch),
|
|
1591
|
+
// The complete files also contain the word annotations
|
|
1592
|
+
// themselves rather than links to them.
|
|
1593
|
+
...words ? { thisChapterWords: words } : {},
|
|
1594
|
+
chapter: ch.chapter
|
|
1595
|
+
};
|
|
1596
|
+
})
|
|
1597
|
+
)
|
|
1598
|
+
)
|
|
931
1599
|
};
|
|
932
1600
|
api.translationComplete.push(completeTranslation);
|
|
1601
|
+
const simpleCompleteTranslation = {
|
|
1602
|
+
translation: apiTranslation,
|
|
1603
|
+
books: completeBooks.map(
|
|
1604
|
+
({ book, chapters }) => completeBook(
|
|
1605
|
+
book,
|
|
1606
|
+
chapters.map((ch) => {
|
|
1607
|
+
const simplified = simplifiedChapters.get(ch);
|
|
1608
|
+
const hasWords = Object.keys(simplified.words).length > 0;
|
|
1609
|
+
return {
|
|
1610
|
+
...completeChapter(ch),
|
|
1611
|
+
...hasWords ? { thisChapterWords: simplified.words } : {},
|
|
1612
|
+
chapter: simplified.chapter
|
|
1613
|
+
};
|
|
1614
|
+
})
|
|
1615
|
+
)
|
|
1616
|
+
)
|
|
1617
|
+
};
|
|
1618
|
+
api.simpleTranslationComplete.push(simpleCompleteTranslation);
|
|
933
1619
|
}
|
|
934
1620
|
}
|
|
935
1621
|
for (let { books, profiles, ...commentary } of dataset.commentaries) {
|
|
@@ -974,6 +1660,11 @@ function generateApiForDataset(dataset, options = {}) {
|
|
|
974
1660
|
"json",
|
|
975
1661
|
apiPathPrefix
|
|
976
1662
|
) : null,
|
|
1663
|
+
firstChapterReference: firstChapterNumber ? {
|
|
1664
|
+
commentaryId: commentary.id,
|
|
1665
|
+
book: book.id,
|
|
1666
|
+
chapter: firstChapterNumber
|
|
1667
|
+
} : null,
|
|
977
1668
|
lastChapterNumber,
|
|
978
1669
|
lastChapterApiLink: lastChapterNumber ? bookCommentaryChapterApiLink(
|
|
979
1670
|
commentary.id,
|
|
@@ -982,6 +1673,11 @@ function generateApiForDataset(dataset, options = {}) {
|
|
|
982
1673
|
"json",
|
|
983
1674
|
apiPathPrefix
|
|
984
1675
|
) : null,
|
|
1676
|
+
lastChapterReference: lastChapterNumber ? {
|
|
1677
|
+
commentaryId: commentary.id,
|
|
1678
|
+
book: book.id,
|
|
1679
|
+
chapter: lastChapterNumber
|
|
1680
|
+
} : null,
|
|
985
1681
|
numberOfChapters: chapters.length,
|
|
986
1682
|
totalNumberOfVerses: 0
|
|
987
1683
|
};
|
|
@@ -997,9 +1693,23 @@ function generateApiForDataset(dataset, options = {}) {
|
|
|
997
1693
|
"json",
|
|
998
1694
|
apiPathPrefix
|
|
999
1695
|
),
|
|
1696
|
+
thisChapterReference: {
|
|
1697
|
+
commentaryId: commentary.id,
|
|
1698
|
+
book: book.id,
|
|
1699
|
+
chapter: chapter.number
|
|
1700
|
+
},
|
|
1000
1701
|
nextChapterApiLink: null,
|
|
1702
|
+
nextChapterReference: null,
|
|
1001
1703
|
previousChapterApiLink: null,
|
|
1002
|
-
|
|
1704
|
+
previousChapterReference: null,
|
|
1705
|
+
numberOfVerses: 0,
|
|
1706
|
+
simpleChapterApiLink: generateSimpleChapterFiles ? bookCommentaryChapterApiLink(
|
|
1707
|
+
commentary.id,
|
|
1708
|
+
getBookLink(book),
|
|
1709
|
+
chapter.number,
|
|
1710
|
+
SIMPLE_JSON_EXTENSION,
|
|
1711
|
+
apiPathPrefix
|
|
1712
|
+
) : void 0
|
|
1003
1713
|
};
|
|
1004
1714
|
for (let c of chapter.content) {
|
|
1005
1715
|
if (c.type === "verse") {
|
|
@@ -1053,6 +1763,11 @@ function generateApiForDataset(dataset, options = {}) {
|
|
|
1053
1763
|
"json",
|
|
1054
1764
|
apiPathPrefix
|
|
1055
1765
|
);
|
|
1766
|
+
commentaryChapters[i].previousChapterReference = {
|
|
1767
|
+
commentaryId: commentary.id,
|
|
1768
|
+
book: commentaryChapters[i - 1].book.id,
|
|
1769
|
+
chapter: commentaryChapters[i - 1].chapter.number
|
|
1770
|
+
};
|
|
1056
1771
|
}
|
|
1057
1772
|
if (i < commentaryChapters.length - 1) {
|
|
1058
1773
|
commentaryChapters[i].nextChapterApiLink = bookCommentaryChapterApiLink(
|
|
@@ -1062,6 +1777,33 @@ function generateApiForDataset(dataset, options = {}) {
|
|
|
1062
1777
|
"json",
|
|
1063
1778
|
apiPathPrefix
|
|
1064
1779
|
);
|
|
1780
|
+
commentaryChapters[i].nextChapterReference = {
|
|
1781
|
+
commentaryId: commentary.id,
|
|
1782
|
+
book: commentaryChapters[i + 1].book.id,
|
|
1783
|
+
chapter: commentaryChapters[i + 1].chapter.number
|
|
1784
|
+
};
|
|
1785
|
+
}
|
|
1786
|
+
}
|
|
1787
|
+
if (api.simpleCommentaryBookChapters) {
|
|
1788
|
+
const simpleChapterLink = (chapter) => bookCommentaryChapterApiLink(
|
|
1789
|
+
commentary.id,
|
|
1790
|
+
getBookLink(chapter.book),
|
|
1791
|
+
chapter.chapter.number,
|
|
1792
|
+
SIMPLE_JSON_EXTENSION,
|
|
1793
|
+
apiPathPrefix
|
|
1794
|
+
);
|
|
1795
|
+
for (let i = 0; i < commentaryChapters.length; i++) {
|
|
1796
|
+
const { chapter, simpleChapterApiLink, ...currentChapter } = commentaryChapters[i];
|
|
1797
|
+
const previousChapter = commentaryChapters[i - 1];
|
|
1798
|
+
const nextChapter = commentaryChapters[i + 1];
|
|
1799
|
+
api.simpleCommentaryBookChapters.push({
|
|
1800
|
+
...currentChapter,
|
|
1801
|
+
chapter: (0, import_simple.simplifyCommentaryChapter)(chapter),
|
|
1802
|
+
thisChapterLink: simpleChapterLink(commentaryChapters[i]),
|
|
1803
|
+
fullChapterApiLink: currentChapter.thisChapterLink,
|
|
1804
|
+
previousChapterApiLink: previousChapter ? simpleChapterLink(previousChapter) : null,
|
|
1805
|
+
nextChapterApiLink: nextChapter ? simpleChapterLink(nextChapter) : null
|
|
1806
|
+
});
|
|
1065
1807
|
}
|
|
1066
1808
|
}
|
|
1067
1809
|
api.availableCommentaries.commentaries.push(apiCommentary);
|
|
@@ -1101,6 +1843,11 @@ function generateApiForDataset(dataset, options = {}) {
|
|
|
1101
1843
|
"json",
|
|
1102
1844
|
apiPathPrefix
|
|
1103
1845
|
),
|
|
1846
|
+
firstChapterReference: {
|
|
1847
|
+
datasetId: datasetInfo.id,
|
|
1848
|
+
book: book.id,
|
|
1849
|
+
chapter: firstChapterNumber
|
|
1850
|
+
},
|
|
1104
1851
|
lastChapterNumber,
|
|
1105
1852
|
lastChapterApiLink: bookDatasetChapterApiLink(
|
|
1106
1853
|
datasetInfo.id,
|
|
@@ -1109,6 +1856,11 @@ function generateApiForDataset(dataset, options = {}) {
|
|
|
1109
1856
|
"json",
|
|
1110
1857
|
apiPathPrefix
|
|
1111
1858
|
),
|
|
1859
|
+
lastChapterReference: {
|
|
1860
|
+
datasetId: datasetInfo.id,
|
|
1861
|
+
book: book.id,
|
|
1862
|
+
chapter: lastChapterNumber
|
|
1863
|
+
},
|
|
1112
1864
|
numberOfChapters: chapters.length,
|
|
1113
1865
|
totalNumberOfVerses: 0,
|
|
1114
1866
|
totalNumberOfReferences: 0
|
|
@@ -1125,8 +1877,15 @@ function generateApiForDataset(dataset, options = {}) {
|
|
|
1125
1877
|
"json",
|
|
1126
1878
|
apiPathPrefix
|
|
1127
1879
|
),
|
|
1880
|
+
thisChapterReference: {
|
|
1881
|
+
datasetId: datasetInfo.id,
|
|
1882
|
+
book: book.id,
|
|
1883
|
+
chapter: chapter.number
|
|
1884
|
+
},
|
|
1128
1885
|
nextChapterApiLink: null,
|
|
1886
|
+
nextChapterReference: null,
|
|
1129
1887
|
previousChapterApiLink: null,
|
|
1888
|
+
previousChapterReference: null,
|
|
1130
1889
|
numberOfVerses: chapter.content.length,
|
|
1131
1890
|
numberOfReferences: 0
|
|
1132
1891
|
};
|
|
@@ -1155,6 +1914,11 @@ function generateApiForDataset(dataset, options = {}) {
|
|
|
1155
1914
|
"json",
|
|
1156
1915
|
apiPathPrefix
|
|
1157
1916
|
);
|
|
1917
|
+
datasetChapters[i].previousChapterReference = {
|
|
1918
|
+
datasetId: datasetInfo.id,
|
|
1919
|
+
book: datasetChapters[i - 1].book.id,
|
|
1920
|
+
chapter: datasetChapters[i - 1].chapter.number
|
|
1921
|
+
};
|
|
1158
1922
|
}
|
|
1159
1923
|
if (i < datasetChapters.length - 1) {
|
|
1160
1924
|
datasetChapters[i].nextChapterApiLink = bookDatasetChapterApiLink(
|
|
@@ -1164,6 +1928,11 @@ function generateApiForDataset(dataset, options = {}) {
|
|
|
1164
1928
|
"json",
|
|
1165
1929
|
apiPathPrefix
|
|
1166
1930
|
);
|
|
1931
|
+
datasetChapters[i].nextChapterReference = {
|
|
1932
|
+
datasetId: datasetInfo.id,
|
|
1933
|
+
book: datasetChapters[i + 1].book.id,
|
|
1934
|
+
chapter: datasetChapters[i + 1].chapter.number
|
|
1935
|
+
};
|
|
1167
1936
|
}
|
|
1168
1937
|
}
|
|
1169
1938
|
if (!api.availableDatasets) {
|
|
@@ -1202,9 +1971,21 @@ function generateFilesForApi(api) {
|
|
|
1202
1971
|
for (let bookChapter of api.translationBookChapters) {
|
|
1203
1972
|
files.push(jsonFile(bookChapter.thisChapterLink, bookChapter));
|
|
1204
1973
|
}
|
|
1974
|
+
for (let bookChapter of api.simpleTranslationBookChapters ?? []) {
|
|
1975
|
+
files.push(jsonFile(bookChapter.thisChapterLink, bookChapter));
|
|
1976
|
+
}
|
|
1205
1977
|
for (let audio of api.translationBookChapterAudio) {
|
|
1206
1978
|
files.push(downloadedFile(audio.link, audio.originalUrl));
|
|
1207
1979
|
}
|
|
1980
|
+
for (let timings of api.translationBookChapterAudioTimings) {
|
|
1981
|
+
files.push(jsonFile(timings.thisChapterAudioTimingsLink, timings));
|
|
1982
|
+
}
|
|
1983
|
+
for (let words of api.translationBookChapterWords) {
|
|
1984
|
+
files.push(jsonFile(words.thisChapterWordsLink, words));
|
|
1985
|
+
}
|
|
1986
|
+
for (let words of api.simpleTranslationBookChapterWords ?? []) {
|
|
1987
|
+
files.push(jsonFile(words.thisChapterWordsLink, words));
|
|
1988
|
+
}
|
|
1208
1989
|
for (let complete of api.translationComplete) {
|
|
1209
1990
|
if (complete.translation.completeTranslationApiLink) {
|
|
1210
1991
|
files.push(
|
|
@@ -1215,6 +1996,16 @@ function generateFilesForApi(api) {
|
|
|
1215
1996
|
);
|
|
1216
1997
|
}
|
|
1217
1998
|
}
|
|
1999
|
+
for (let complete of api.simpleTranslationComplete) {
|
|
2000
|
+
if (complete.translation.simpleCompleteTranslationApiLink) {
|
|
2001
|
+
files.push(
|
|
2002
|
+
jsonFile(
|
|
2003
|
+
complete.translation.simpleCompleteTranslationApiLink,
|
|
2004
|
+
complete
|
|
2005
|
+
)
|
|
2006
|
+
);
|
|
2007
|
+
}
|
|
2008
|
+
}
|
|
1218
2009
|
files.push(
|
|
1219
2010
|
jsonFile(
|
|
1220
2011
|
`${api.pathPrefix}/api/available_commentaries.json`,
|
|
@@ -1246,6 +2037,9 @@ function generateFilesForApi(api) {
|
|
|
1246
2037
|
for (let bookChapter of api.commentaryBookChapters) {
|
|
1247
2038
|
files.push(jsonFile(bookChapter.thisChapterLink, bookChapter));
|
|
1248
2039
|
}
|
|
2040
|
+
for (let bookChapter of api.simpleCommentaryBookChapters ?? []) {
|
|
2041
|
+
files.push(jsonFile(bookChapter.thisChapterLink, bookChapter));
|
|
2042
|
+
}
|
|
1249
2043
|
if (api.availableDatasets) {
|
|
1250
2044
|
files.push(
|
|
1251
2045
|
jsonFile(
|
|
@@ -1281,8 +2075,8 @@ async function* generateOutputFilesFromDatasets(datasets, options) {
|
|
|
1281
2075
|
function listOfBooksApiLink(translationId, prefix = "") {
|
|
1282
2076
|
return `${prefix}/api/${translationId}/books.json`;
|
|
1283
2077
|
}
|
|
1284
|
-
function completeTranslationApiLink(translationId, prefix = "") {
|
|
1285
|
-
return `${prefix}/api/${translationId}/complete
|
|
2078
|
+
function completeTranslationApiLink(translationId, prefix = "", extension = "json") {
|
|
2079
|
+
return `${prefix}/api/${translationId}/complete.${extension}`;
|
|
1286
2080
|
}
|
|
1287
2081
|
function listOfCommentaryBooksApiLink(commentaryId, prefix = "") {
|
|
1288
2082
|
return `${prefix}/api/c/${commentaryId}/books.json`;
|
|
@@ -1290,6 +2084,7 @@ function listOfCommentaryBooksApiLink(commentaryId, prefix = "") {
|
|
|
1290
2084
|
function listOfDatasetBooksApiLink(datasetId, prefix = "") {
|
|
1291
2085
|
return `${prefix}/api/d/${datasetId}/books.json`;
|
|
1292
2086
|
}
|
|
2087
|
+
const SIMPLE_JSON_EXTENSION = "simple.json";
|
|
1293
2088
|
function bookChapterApiLink(translationId, commonName, chapterNumber, extension, prefix = "") {
|
|
1294
2089
|
return `${prefix}/api/${translationId}/${replaceSpacesWithUnderscores(
|
|
1295
2090
|
commonName
|
|
@@ -1305,6 +2100,16 @@ function bookChapterAudioApiLink(translationId, bookId, chapterNumber, reader, p
|
|
|
1305
2100
|
bookId
|
|
1306
2101
|
)}/${chapterNumber}.${reader}.mp3`;
|
|
1307
2102
|
}
|
|
2103
|
+
function bookChapterAudioTimingsApiLink(translationId, bookId, chapterNumber, reader, prefix = "") {
|
|
2104
|
+
return `${prefix}/api/${translationId}/${replaceSpacesWithUnderscores(
|
|
2105
|
+
bookId
|
|
2106
|
+
)}/${chapterNumber}.${reader}.audioTimings.json`;
|
|
2107
|
+
}
|
|
2108
|
+
function bookChapterWordsApiLink(translationId, bookId, chapterNumber, prefix = "", extension = "json") {
|
|
2109
|
+
return `${prefix}/api/${translationId}/${replaceSpacesWithUnderscores(
|
|
2110
|
+
bookId
|
|
2111
|
+
)}/${chapterNumber}.words.${extension}`;
|
|
2112
|
+
}
|
|
1308
2113
|
function bookDatasetChapterApiLink(translationId, commonName, chapterNumber, extension, prefix = "") {
|
|
1309
2114
|
return `${prefix}/api/d/${translationId}/${replaceSpacesWithUnderscores(
|
|
1310
2115
|
commonName
|
|
@@ -1350,15 +2155,30 @@ function replaceSpacesWithUnderscores(str) {
|
|
|
1350
2155
|
ApiDatasetBookSchema,
|
|
1351
2156
|
ApiDatasetBooksSchema,
|
|
1352
2157
|
ApiDatasetSchema,
|
|
2158
|
+
ApiSimpleCommentaryBookChapterSchema,
|
|
2159
|
+
ApiSimpleTranslationBookChapterSchema,
|
|
2160
|
+
ApiSimpleTranslationBookChapterWordsSchema,
|
|
2161
|
+
ApiSimpleTranslationCompleteBookSchema,
|
|
2162
|
+
ApiSimpleTranslationCompleteSchema,
|
|
1353
2163
|
ApiTranslationBookChapterAudioSchema,
|
|
2164
|
+
ApiTranslationBookChapterAudioTimingsSchema,
|
|
1354
2165
|
ApiTranslationBookChapterSchema,
|
|
2166
|
+
ApiTranslationBookChapterWordsSchema,
|
|
1355
2167
|
ApiTranslationBookSchema,
|
|
1356
2168
|
ApiTranslationBooksSchema,
|
|
1357
2169
|
ApiTranslationCompleteBookSchema,
|
|
1358
2170
|
ApiTranslationCompleteSchema,
|
|
1359
2171
|
ApiTranslationSchema,
|
|
2172
|
+
CommentaryChapterReferenceSchema,
|
|
2173
|
+
DatasetChapterReferenceSchema,
|
|
2174
|
+
SIMPLE_JSON_EXTENSION,
|
|
2175
|
+
SimpleTranslationCompleteChapterSchema,
|
|
2176
|
+
TranslationChapterReferenceSchema,
|
|
2177
|
+
TranslationCompleteChapterSchema,
|
|
1360
2178
|
bookChapterApiLink,
|
|
1361
2179
|
bookChapterAudioApiLink,
|
|
2180
|
+
bookChapterAudioTimingsApiLink,
|
|
2181
|
+
bookChapterWordsApiLink,
|
|
1362
2182
|
bookCommentaryChapterApiLink,
|
|
1363
2183
|
bookDatasetChapterApiLink,
|
|
1364
2184
|
completeTranslationApiLink,
|