@helloao/tools 0.3.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.
@@ -31,6 +31,23 @@ __export(api_exports, {
31
31
  ApiDatasetBookChapterSchema: () => ApiDatasetBookChapterSchema,
32
32
  ApiDatasetBookSchema: () => ApiDatasetBookSchema,
33
33
  ApiDatasetBooksSchema: () => ApiDatasetBooksSchema,
34
+ ApiDatasetChapterEventSchema: () => ApiDatasetChapterEventSchema,
35
+ ApiDatasetChapterPersonSchema: () => ApiDatasetChapterPersonSchema,
36
+ ApiDatasetChapterPlaceSchema: () => ApiDatasetChapterPlaceSchema,
37
+ ApiDatasetEntityBookChapterSchema: () => ApiDatasetEntityBookChapterSchema,
38
+ ApiDatasetEntityChapterDataSchema: () => ApiDatasetEntityChapterDataSchema,
39
+ ApiDatasetEventSchema: () => ApiDatasetEventSchema,
40
+ ApiDatasetEventSummarySchema: () => ApiDatasetEventSummarySchema,
41
+ ApiDatasetEventsSchema: () => ApiDatasetEventsSchema,
42
+ ApiDatasetPeopleGroupSchema: () => ApiDatasetPeopleGroupSchema,
43
+ ApiDatasetPeopleGroupSummarySchema: () => ApiDatasetPeopleGroupSummarySchema,
44
+ ApiDatasetPeopleGroupsSchema: () => ApiDatasetPeopleGroupsSchema,
45
+ ApiDatasetPeopleSchema: () => ApiDatasetPeopleSchema,
46
+ ApiDatasetPersonSchema: () => ApiDatasetPersonSchema,
47
+ ApiDatasetPersonSummarySchema: () => ApiDatasetPersonSummarySchema,
48
+ ApiDatasetPlaceSchema: () => ApiDatasetPlaceSchema,
49
+ ApiDatasetPlaceSummarySchema: () => ApiDatasetPlaceSummarySchema,
50
+ ApiDatasetPlacesSchema: () => ApiDatasetPlacesSchema,
34
51
  ApiDatasetSchema: () => ApiDatasetSchema,
35
52
  ApiSimpleCommentaryBookChapterSchema: () => ApiSimpleCommentaryBookChapterSchema,
36
53
  ApiSimpleTranslationBookChapterSchema: () => ApiSimpleTranslationBookChapterSchema,
@@ -59,6 +76,7 @@ __export(api_exports, {
59
76
  bookCommentaryChapterApiLink: () => bookCommentaryChapterApiLink,
60
77
  bookDatasetChapterApiLink: () => bookDatasetChapterApiLink,
61
78
  completeTranslationApiLink: () => completeTranslationApiLink,
79
+ datasetEntityApiLink: () => datasetEntityApiLink,
62
80
  downloadedFile: () => downloadedFile,
63
81
  generateApiForDataset: () => generateApiForDataset,
64
82
  generateFilesForApi: () => generateFilesForApi,
@@ -67,6 +85,7 @@ __export(api_exports, {
67
85
  listOfBooksApiLink: () => listOfBooksApiLink,
68
86
  listOfCommentaryBooksApiLink: () => listOfCommentaryBooksApiLink,
69
87
  listOfDatasetBooksApiLink: () => listOfDatasetBooksApiLink,
88
+ listOfDatasetEntitiesApiLink: () => listOfDatasetEntitiesApiLink,
70
89
  profileCommentaryApiLink: () => profileCommentaryApiLink,
71
90
  profilesCommentaryApiLink: () => profilesCommentaryApiLink,
72
91
  replaceSpacesWithUnderscores: () => replaceSpacesWithUnderscores
@@ -76,6 +95,7 @@ var import_zod = require("zod");
76
95
  var import_common_types = require("./common-types.js");
77
96
  var import_simple = require("./simple.js");
78
97
  var import_utils = require("../utils.js");
98
+ var import_book_order = require("./book-order.js");
79
99
  const ApiAvailableTranslationsSchema = import_zod.z.object({
80
100
  /**
81
101
  * The list of translations.
@@ -154,6 +174,62 @@ const ApiDatasetSchema = import_common_types.DatasetSchema.extend({
154
174
  */
155
175
  languageEnglishName: import_zod.z.string().optional().meta({
156
176
  description: "Gets the name of the language in English. Null or undefined if the language doesn't have an english name."
177
+ }),
178
+ /**
179
+ * The API link for the list of people for this dataset.
180
+ * Omitted if the dataset doesn't contain people.
181
+ */
182
+ listOfPeopleApiLink: import_zod.z.string().optional().meta({
183
+ 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."
184
+ }),
185
+ /**
186
+ * The API link for the list of places for this dataset.
187
+ * Omitted if the dataset doesn't contain places.
188
+ */
189
+ listOfPlacesApiLink: import_zod.z.string().optional().meta({
190
+ 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."
191
+ }),
192
+ /**
193
+ * The API link for the list of events for this dataset.
194
+ * Omitted if the dataset doesn't contain events.
195
+ */
196
+ listOfEventsApiLink: import_zod.z.string().optional().meta({
197
+ 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."
198
+ }),
199
+ /**
200
+ * The API link for the list of people groups for this dataset.
201
+ * Omitted if the dataset doesn't contain people groups.
202
+ */
203
+ listOfPeopleGroupsApiLink: import_zod.z.string().optional().meta({
204
+ 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."
205
+ }),
206
+ /**
207
+ * The total number of people that are contained in this dataset.
208
+ * Omitted if the dataset doesn't contain people.
209
+ */
210
+ totalNumberOfPeople: import_zod.z.number().optional().meta({
211
+ description: "The total number of people that are contained in this dataset. Omitted if the dataset doesn't contain people."
212
+ }),
213
+ /**
214
+ * The total number of places that are contained in this dataset.
215
+ * Omitted if the dataset doesn't contain places.
216
+ */
217
+ totalNumberOfPlaces: import_zod.z.number().optional().meta({
218
+ description: "The total number of places that are contained in this dataset. Omitted if the dataset doesn't contain places."
219
+ }),
220
+ /**
221
+ * The total number of events that are contained in this dataset.
222
+ * Omitted if the dataset doesn't contain events.
223
+ */
224
+ totalNumberOfEvents: import_zod.z.number().optional().meta({
225
+ description: "The total number of events that are contained in this dataset. Omitted if the dataset doesn't contain events."
226
+ }),
227
+ /**
228
+ * The total number of people groups that are contained in this dataset.
229
+ * Omitted if the dataset doesn't contain people groups.
230
+ */
231
+ totalNumberOfPeopleGroups: import_zod.z.number().optional().meta({
232
+ description: "The total number of people groups that are contained in this dataset. Omitted if the dataset doesn't contain people groups."
157
233
  })
158
234
  }).meta({
159
235
  id: "ApiDataset",
@@ -264,23 +340,37 @@ const ApiTranslationCompleteSchema = import_zod.z.object({
264
340
  id: "ApiTranslationComplete",
265
341
  description: "Defines the complete translation download data. Maps to the /api/:translationId/complete.json endpoint."
266
342
  });
267
- const TranslationCompleteChapterSchema = import_common_types.TranslationBookChapterSchema.extend({
343
+ const TranslationCompleteChapterSchema = import_common_types.TranslationBookChapterSchema.omit({ thisChapterWords: true }).extend({
268
344
  /**
269
345
  * The number of verses that the chapter contains.
270
346
  */
271
347
  numberOfVerses: import_zod.z.number().meta({
272
348
  description: "The number of verses that the chapter contains."
349
+ }),
350
+ /**
351
+ * The link to the word-level annotations for the chapter.
352
+ * Omitted if the chapter doesn't have any word-level annotations.
353
+ */
354
+ thisChapterWordsLink: import_zod.z.string().optional().meta({
355
+ 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."
273
356
  })
274
357
  }).meta({
275
358
  id: "TranslationCompleteChapter",
276
359
  description: "A chapter in the complete translation download."
277
360
  });
278
- const SimpleTranslationCompleteChapterSchema = import_common_types.SimpleTranslationBookChapterSchema.extend({
361
+ const SimpleTranslationCompleteChapterSchema = import_common_types.SimpleTranslationBookChapterSchema.omit({ thisChapterWords: true }).extend({
279
362
  /**
280
363
  * The number of verses that the chapter contains.
281
364
  */
282
365
  numberOfVerses: import_zod.z.number().meta({
283
366
  description: "The number of verses that the chapter contains."
367
+ }),
368
+ /**
369
+ * The link to the word-level annotations for the chapter.
370
+ * Omitted if the chapter doesn't have any word-level annotations.
371
+ */
372
+ thisChapterWordsLink: import_zod.z.string().optional().meta({
373
+ 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."
284
374
  })
285
375
  }).meta({
286
376
  id: "SimpleTranslationCompleteChapter",
@@ -455,6 +545,571 @@ const ApiDatasetBooksSchema = import_zod.z.object({
455
545
  id: "ApiDatasetBooks",
456
546
  description: "Defines an interface that contains information about the books that are available for a dataset."
457
547
  });
548
+ const ApiDatasetPersonSummarySchema = import_zod.z.object({
549
+ /**
550
+ * The ID of the person.
551
+ */
552
+ id: import_zod.z.string().meta({
553
+ description: "The ID of the person."
554
+ }),
555
+ /**
556
+ * The name of the person.
557
+ */
558
+ name: import_zod.z.string().meta({
559
+ description: "The name of the person."
560
+ }),
561
+ /**
562
+ * Whether the name of the person is a proper name.
563
+ */
564
+ isProperName: import_zod.z.boolean().optional().meta({
565
+ description: "Whether the name of the person is a proper name."
566
+ }),
567
+ /**
568
+ * The gender of the person.
569
+ */
570
+ gender: import_zod.z.string().optional().meta({
571
+ description: "The gender of the person."
572
+ }),
573
+ /**
574
+ * The number of Bible references that mention the person.
575
+ */
576
+ numberOfReferences: import_zod.z.number().meta({
577
+ description: "The number of Bible references that mention the person."
578
+ }),
579
+ /**
580
+ * The API link for the person.
581
+ */
582
+ thisPersonApiLink: import_zod.z.string().meta({
583
+ description: "The API link for the person. Relative to the API origin."
584
+ })
585
+ }).meta({
586
+ id: "ApiDatasetPersonSummary",
587
+ description: "Defines a summary of a person in a dataset."
588
+ });
589
+ const ApiDatasetPeopleSchema = import_zod.z.object({
590
+ /**
591
+ * The dataset information for the people.
592
+ */
593
+ dataset: import_zod.z.lazy(() => ApiDatasetSchema).meta({
594
+ description: "The dataset information for the people."
595
+ }),
596
+ /**
597
+ * The list of people that are available for the dataset.
598
+ */
599
+ people: import_zod.z.array(ApiDatasetPersonSummarySchema).meta({
600
+ description: "The list of people that are available for the dataset."
601
+ })
602
+ }).meta({
603
+ id: "ApiDatasetPeople",
604
+ description: "The list of people in a dataset. Maps to the /api/d/:datasetId/people.json endpoint."
605
+ });
606
+ const ApiDatasetPersonSchema = import_zod.z.object({
607
+ /**
608
+ * The dataset information for the person.
609
+ */
610
+ dataset: import_zod.z.lazy(() => ApiDatasetSchema).meta({
611
+ description: "The dataset information for the person."
612
+ }),
613
+ /**
614
+ * The information about the person.
615
+ */
616
+ person: import_common_types.DatasetPersonSchema.meta({
617
+ description: "The information about the person."
618
+ }),
619
+ /**
620
+ * The API link for this person.
621
+ */
622
+ thisPersonApiLink: import_zod.z.string().meta({
623
+ description: "The API link for this person. Relative to the API origin."
624
+ })
625
+ }).meta({
626
+ id: "ApiDatasetPerson",
627
+ description: "The information about a person in a dataset. Maps to the /api/d/:datasetId/people/:personId.json endpoint."
628
+ });
629
+ const ApiDatasetPlaceSummarySchema = import_zod.z.object({
630
+ /**
631
+ * The ID of the place.
632
+ */
633
+ id: import_zod.z.string().meta({
634
+ description: "The ID of the place."
635
+ }),
636
+ /**
637
+ * The name of the place.
638
+ */
639
+ name: import_zod.z.string().meta({
640
+ description: "The name of the place."
641
+ }),
642
+ /**
643
+ * The type of geographical feature that the place is.
644
+ */
645
+ featureType: import_zod.z.string().optional().meta({
646
+ description: 'The type of geographical feature that the place is. For example, "City", "Region", "Mountain", "Water", etc.'
647
+ }),
648
+ /**
649
+ * The latitude of the place.
650
+ */
651
+ latitude: import_zod.z.number().optional().meta({
652
+ description: "The latitude of the place."
653
+ }),
654
+ /**
655
+ * The longitude of the place.
656
+ */
657
+ longitude: import_zod.z.number().optional().meta({
658
+ description: "The longitude of the place."
659
+ }),
660
+ /**
661
+ * The number of Bible references that mention the place.
662
+ */
663
+ numberOfReferences: import_zod.z.number().meta({
664
+ description: "The number of Bible references that mention the place."
665
+ }),
666
+ /**
667
+ * The API link for the place.
668
+ */
669
+ thisPlaceApiLink: import_zod.z.string().meta({
670
+ description: "The API link for the place. Relative to the API origin."
671
+ })
672
+ }).meta({
673
+ id: "ApiDatasetPlaceSummary",
674
+ description: "Defines a summary of a place in a dataset."
675
+ });
676
+ const ApiDatasetPlacesSchema = import_zod.z.object({
677
+ /**
678
+ * The dataset information for the places.
679
+ */
680
+ dataset: import_zod.z.lazy(() => ApiDatasetSchema).meta({
681
+ description: "The dataset information for the places."
682
+ }),
683
+ /**
684
+ * The list of places that are available for the dataset.
685
+ */
686
+ places: import_zod.z.array(ApiDatasetPlaceSummarySchema).meta({
687
+ description: "The list of places that are available for the dataset."
688
+ })
689
+ }).meta({
690
+ id: "ApiDatasetPlaces",
691
+ description: "The list of places in a dataset. Maps to the /api/d/:datasetId/places.json endpoint."
692
+ });
693
+ const ApiDatasetPlaceSchema = import_zod.z.object({
694
+ /**
695
+ * The dataset information for the place.
696
+ */
697
+ dataset: import_zod.z.lazy(() => ApiDatasetSchema).meta({
698
+ description: "The dataset information for the place."
699
+ }),
700
+ /**
701
+ * The information about the place.
702
+ */
703
+ place: import_common_types.DatasetPlaceSchema.meta({
704
+ description: "The information about the place."
705
+ }),
706
+ /**
707
+ * The API link for this place.
708
+ */
709
+ thisPlaceApiLink: import_zod.z.string().meta({
710
+ description: "The API link for this place. Relative to the API origin."
711
+ })
712
+ }).meta({
713
+ id: "ApiDatasetPlace",
714
+ description: "The information about a place in a dataset. Maps to the /api/d/:datasetId/places/:placeId.json endpoint."
715
+ });
716
+ const ApiDatasetEventSummarySchema = import_zod.z.object({
717
+ /**
718
+ * The ID of the event.
719
+ */
720
+ id: import_zod.z.string().meta({
721
+ description: "The ID of the event."
722
+ }),
723
+ /**
724
+ * The name of the event.
725
+ */
726
+ name: import_zod.z.string().meta({
727
+ description: "The name of the event."
728
+ }),
729
+ /**
730
+ * The date that the event started at.
731
+ */
732
+ startDate: import_zod.z.string().optional().meta({
733
+ 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."
734
+ }),
735
+ /**
736
+ * The number of Bible references that describe the event.
737
+ */
738
+ numberOfReferences: import_zod.z.number().meta({
739
+ description: "The number of Bible references that describe the event."
740
+ }),
741
+ /**
742
+ * The API link for the event.
743
+ */
744
+ thisEventApiLink: import_zod.z.string().meta({
745
+ description: "The API link for the event. Relative to the API origin."
746
+ })
747
+ }).meta({
748
+ id: "ApiDatasetEventSummary",
749
+ description: "Defines a summary of an event in a dataset."
750
+ });
751
+ const ApiDatasetEventsSchema = import_zod.z.object({
752
+ /**
753
+ * The dataset information for the events.
754
+ */
755
+ dataset: import_zod.z.lazy(() => ApiDatasetSchema).meta({
756
+ description: "The dataset information for the events."
757
+ }),
758
+ /**
759
+ * The list of events that are available for the dataset.
760
+ */
761
+ events: import_zod.z.array(ApiDatasetEventSummarySchema).meta({
762
+ description: "The list of events that are available for the dataset."
763
+ })
764
+ }).meta({
765
+ id: "ApiDatasetEvents",
766
+ description: "The list of events in a dataset. Maps to the /api/d/:datasetId/events.json endpoint."
767
+ });
768
+ const ApiDatasetEventSchema = import_zod.z.object({
769
+ /**
770
+ * The dataset information for the event.
771
+ */
772
+ dataset: import_zod.z.lazy(() => ApiDatasetSchema).meta({
773
+ description: "The dataset information for the event."
774
+ }),
775
+ /**
776
+ * The information about the event.
777
+ */
778
+ event: import_common_types.DatasetEventSchema.meta({
779
+ description: "The information about the event."
780
+ }),
781
+ /**
782
+ * The API link for this event.
783
+ */
784
+ thisEventApiLink: import_zod.z.string().meta({
785
+ description: "The API link for this event. Relative to the API origin."
786
+ })
787
+ }).meta({
788
+ id: "ApiDatasetEvent",
789
+ description: "The information about an event in a dataset. Maps to the /api/d/:datasetId/events/:eventId.json endpoint."
790
+ });
791
+ const ApiDatasetPeopleGroupSummarySchema = import_zod.z.object({
792
+ /**
793
+ * The ID of the people group.
794
+ */
795
+ id: import_zod.z.string().meta({
796
+ description: "The ID of the people group."
797
+ }),
798
+ /**
799
+ * The name of the people group.
800
+ */
801
+ name: import_zod.z.string().meta({
802
+ description: "The name of the people group."
803
+ }),
804
+ /**
805
+ * The number of people that are members of the people group.
806
+ */
807
+ numberOfMembers: import_zod.z.number().meta({
808
+ description: "The number of people that are members of the people group."
809
+ }),
810
+ /**
811
+ * The API link for the people group.
812
+ */
813
+ thisPeopleGroupApiLink: import_zod.z.string().meta({
814
+ description: "The API link for the people group. Relative to the API origin."
815
+ })
816
+ }).meta({
817
+ id: "ApiDatasetPeopleGroupSummary",
818
+ description: "Defines a summary of a people group in a dataset."
819
+ });
820
+ const ApiDatasetPeopleGroupsSchema = import_zod.z.object({
821
+ /**
822
+ * The dataset information for the people groups.
823
+ */
824
+ dataset: import_zod.z.lazy(() => ApiDatasetSchema).meta({
825
+ description: "The dataset information for the people groups."
826
+ }),
827
+ /**
828
+ * The list of people groups that are available for the dataset.
829
+ */
830
+ groups: import_zod.z.array(ApiDatasetPeopleGroupSummarySchema).meta({
831
+ description: "The list of people groups that are available for the dataset."
832
+ })
833
+ }).meta({
834
+ id: "ApiDatasetPeopleGroups",
835
+ description: "The list of people groups in a dataset. Maps to the /api/d/:datasetId/groups.json endpoint."
836
+ });
837
+ const ApiDatasetPeopleGroupSchema = import_zod.z.object({
838
+ /**
839
+ * The dataset information for the people group.
840
+ */
841
+ dataset: import_zod.z.lazy(() => ApiDatasetSchema).meta({
842
+ description: "The dataset information for the people group."
843
+ }),
844
+ /**
845
+ * The information about the people group.
846
+ */
847
+ group: import_common_types.DatasetPeopleGroupSchema.meta({
848
+ description: "The information about the people group."
849
+ }),
850
+ /**
851
+ * The API link for this people group.
852
+ */
853
+ thisPeopleGroupApiLink: import_zod.z.string().meta({
854
+ description: "The API link for this people group. Relative to the API origin."
855
+ })
856
+ }).meta({
857
+ id: "ApiDatasetPeopleGroup",
858
+ description: "The information about a people group in a dataset. Maps to the /api/d/:datasetId/groups/:groupId.json endpoint."
859
+ });
860
+ const ApiDatasetChapterPersonSchema = import_zod.z.object({
861
+ /**
862
+ * The ID of the person.
863
+ */
864
+ id: import_zod.z.string().meta({
865
+ description: "The ID of the person."
866
+ }),
867
+ /**
868
+ * The name of the person.
869
+ */
870
+ name: import_zod.z.string().meta({
871
+ description: "The name of the person."
872
+ }),
873
+ /**
874
+ * Whether the name of the person is a proper name.
875
+ */
876
+ isProperName: import_zod.z.boolean().optional().meta({
877
+ description: "Whether the name of the person is a proper name."
878
+ }),
879
+ /**
880
+ * The gender of the person.
881
+ */
882
+ gender: import_zod.z.string().optional().meta({
883
+ description: "The gender of the person."
884
+ }),
885
+ /**
886
+ * The year that the person was born.
887
+ * Negative numbers are years BC. Positive numbers are years AD.
888
+ */
889
+ birthYear: import_zod.z.number().optional().meta({
890
+ description: "The year that the person was born. Negative numbers are years BC. Positive numbers are years AD."
891
+ }),
892
+ /**
893
+ * The year that the person died.
894
+ * Negative numbers are years BC. Positive numbers are years AD.
895
+ */
896
+ deathYear: import_zod.z.number().optional().meta({
897
+ description: "The year that the person died. Negative numbers are years BC. Positive numbers are years AD."
898
+ }),
899
+ /**
900
+ * The API link for the person.
901
+ */
902
+ apiLink: import_zod.z.string().meta({
903
+ description: "The API link for the person. Relative to the API origin."
904
+ }),
905
+ /**
906
+ * The numbers of the verses in the chapter that mention the person.
907
+ * Sorted in ascending order.
908
+ */
909
+ verses: import_zod.z.array(import_zod.z.number()).meta({
910
+ description: "The numbers of the verses in the chapter that mention the person. Sorted in ascending order."
911
+ })
912
+ }).meta({
913
+ id: "ApiDatasetChapterPerson",
914
+ description: "Defines a person that appears in a chapter of a dataset."
915
+ });
916
+ const ApiDatasetChapterPlaceSchema = import_zod.z.object({
917
+ /**
918
+ * The ID of the place.
919
+ */
920
+ id: import_zod.z.string().meta({
921
+ description: "The ID of the place."
922
+ }),
923
+ /**
924
+ * The name of the place.
925
+ */
926
+ name: import_zod.z.string().meta({
927
+ description: "The name of the place."
928
+ }),
929
+ /**
930
+ * The type of geographical feature that the place is.
931
+ */
932
+ featureType: import_zod.z.string().optional().meta({
933
+ description: 'The type of geographical feature that the place is. For example, "City", "Region", "Mountain", "Water", etc.'
934
+ }),
935
+ /**
936
+ * The latitude of the place.
937
+ */
938
+ latitude: import_zod.z.number().optional().meta({
939
+ description: "The latitude of the place."
940
+ }),
941
+ /**
942
+ * The longitude of the place.
943
+ */
944
+ longitude: import_zod.z.number().optional().meta({
945
+ description: "The longitude of the place."
946
+ }),
947
+ /**
948
+ * The API link for the place.
949
+ */
950
+ apiLink: import_zod.z.string().meta({
951
+ description: "The API link for the place. Relative to the API origin."
952
+ }),
953
+ /**
954
+ * The numbers of the verses in the chapter that mention the place.
955
+ * Sorted in ascending order.
956
+ */
957
+ verses: import_zod.z.array(import_zod.z.number()).meta({
958
+ description: "The numbers of the verses in the chapter that mention the place. Sorted in ascending order."
959
+ })
960
+ }).meta({
961
+ id: "ApiDatasetChapterPlace",
962
+ description: "Defines a place that appears in a chapter of a dataset."
963
+ });
964
+ const ApiDatasetChapterEventSchema = import_zod.z.object({
965
+ /**
966
+ * The ID of the event.
967
+ */
968
+ id: import_zod.z.string().meta({
969
+ description: "The ID of the event."
970
+ }),
971
+ /**
972
+ * The name of the event.
973
+ */
974
+ name: import_zod.z.string().meta({
975
+ description: "The name of the event."
976
+ }),
977
+ /**
978
+ * The date that the event started at.
979
+ */
980
+ startDate: import_zod.z.string().optional().meta({
981
+ 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."
982
+ }),
983
+ /**
984
+ * The API link for the event.
985
+ */
986
+ apiLink: import_zod.z.string().meta({
987
+ description: "The API link for the event. Relative to the API origin."
988
+ }),
989
+ /**
990
+ * The numbers of the verses in the chapter that describe the event.
991
+ * Sorted in ascending order.
992
+ */
993
+ verses: import_zod.z.array(import_zod.z.number()).meta({
994
+ description: "The numbers of the verses in the chapter that describe the event. Sorted in ascending order."
995
+ })
996
+ }).meta({
997
+ id: "ApiDatasetChapterEvent",
998
+ description: "Defines an event that appears in a chapter of a dataset."
999
+ });
1000
+ const ApiDatasetEntityChapterDataSchema = import_zod.z.object({
1001
+ /**
1002
+ * The number of the chapter.
1003
+ */
1004
+ number: import_zod.z.number().meta({
1005
+ description: "The number of the chapter."
1006
+ }),
1007
+ /**
1008
+ * The people that appear in the chapter.
1009
+ * Sorted by the first verse that they appear in.
1010
+ */
1011
+ people: import_zod.z.array(ApiDatasetChapterPersonSchema).meta({
1012
+ description: "The people that appear in the chapter. Sorted by the first verse that they appear in."
1013
+ }),
1014
+ /**
1015
+ * The places that appear in the chapter.
1016
+ * Sorted by the first verse that they appear in.
1017
+ */
1018
+ places: import_zod.z.array(ApiDatasetChapterPlaceSchema).meta({
1019
+ description: "The places that appear in the chapter. Sorted by the first verse that they appear in."
1020
+ }),
1021
+ /**
1022
+ * The events that appear in the chapter.
1023
+ * Sorted by the first verse that they appear in.
1024
+ */
1025
+ events: import_zod.z.array(ApiDatasetChapterEventSchema).meta({
1026
+ description: "The events that appear in the chapter. Sorted by the first verse that they appear in."
1027
+ })
1028
+ }).meta({
1029
+ id: "ApiDatasetEntityChapterData",
1030
+ description: "Defines the entity data for a chapter in a dataset. Contains the people, places, and events that appear in the chapter."
1031
+ });
1032
+ const ApiDatasetEntityBookChapterSchema = import_zod.z.object({
1033
+ /**
1034
+ * The dataset information for the book chapter.
1035
+ */
1036
+ dataset: import_zod.z.lazy(() => ApiDatasetSchema).meta({
1037
+ description: "The dataset information for the book chapter."
1038
+ }),
1039
+ /**
1040
+ * The book information for the book chapter.
1041
+ */
1042
+ book: import_zod.z.lazy(() => ApiDatasetBookSchema).meta({
1043
+ description: "The book information for the book chapter."
1044
+ }),
1045
+ /**
1046
+ * The entity data for the chapter.
1047
+ */
1048
+ chapter: ApiDatasetEntityChapterDataSchema.meta({
1049
+ description: "The entity data for the chapter."
1050
+ }),
1051
+ /**
1052
+ * The link to this chapter.
1053
+ */
1054
+ thisChapterLink: import_zod.z.string().meta({
1055
+ description: "The link to this chapter. Relative to the API origin."
1056
+ }),
1057
+ /**
1058
+ * The reference for this chapter.
1059
+ */
1060
+ thisChapterReference: import_zod.z.lazy(() => DatasetChapterReferenceSchema).meta({
1061
+ description: "The reference for this chapter."
1062
+ }),
1063
+ /**
1064
+ * The link to the next chapter.
1065
+ * Null if this is the last chapter in the dataset.
1066
+ */
1067
+ nextChapterApiLink: import_zod.z.string().nullable().meta({
1068
+ description: "The link to the next chapter. Relative to the API origin. Null if this is the last chapter in the dataset."
1069
+ }),
1070
+ /**
1071
+ * The reference for the next chapter.
1072
+ * Null if this is the last chapter in the dataset.
1073
+ */
1074
+ nextChapterReference: import_zod.z.lazy(() => DatasetChapterReferenceSchema).nullable().meta({
1075
+ description: "The reference for the next chapter. Null if this is the last chapter in the dataset."
1076
+ }),
1077
+ /**
1078
+ * The link to the previous chapter.
1079
+ * Null if this is the first chapter in the dataset.
1080
+ */
1081
+ previousChapterApiLink: import_zod.z.string().nullable().meta({
1082
+ description: "The link to the previous chapter. Relative to the API origin. Null if this is the first chapter in the dataset."
1083
+ }),
1084
+ /**
1085
+ * The reference for the previous chapter.
1086
+ * Null if this is the first chapter in the dataset.
1087
+ */
1088
+ previousChapterReference: import_zod.z.lazy(() => DatasetChapterReferenceSchema).nullable().meta({
1089
+ description: "The reference for the previous chapter. Null if this is the first chapter in the dataset."
1090
+ }),
1091
+ /**
1092
+ * The number of people that appear in the chapter.
1093
+ */
1094
+ numberOfPeople: import_zod.z.number().meta({
1095
+ description: "The number of people that appear in the chapter."
1096
+ }),
1097
+ /**
1098
+ * The number of places that appear in the chapter.
1099
+ */
1100
+ numberOfPlaces: import_zod.z.number().meta({
1101
+ description: "The number of places that appear in the chapter."
1102
+ }),
1103
+ /**
1104
+ * The number of events that appear in the chapter.
1105
+ */
1106
+ numberOfEvents: import_zod.z.number().meta({
1107
+ description: "The number of events that appear in the chapter."
1108
+ })
1109
+ }).meta({
1110
+ id: "ApiDatasetEntityBookChapter",
1111
+ 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."
1112
+ });
458
1113
  const ApiCommentaryProfilesSchema = import_zod.z.object({
459
1114
  /**
460
1115
  * The commentary information for the books.
@@ -1202,12 +1857,19 @@ function generateApiForDataset(dataset, options = {}) {
1202
1857
  };
1203
1858
  if (generateSimpleChapterFiles) {
1204
1859
  api.simpleTranslationBookChapters = [];
1205
- api.simpleTranslationBookChapterWords = [];
1206
1860
  api.simpleCommentaryBookChapters = [];
1207
1861
  }
1862
+ if (generateSimpleChapterFiles || options.generateCompleteTranslationFiles) {
1863
+ api.simpleTranslationBookChapterWords = [];
1864
+ }
1208
1865
  const getNativeName = options.getNativeName;
1209
1866
  const getEnglishName = options.getEnglishName;
1210
1867
  for (let { books, ...translation } of dataset.translations) {
1868
+ let hasSimpleWords2 = function(chapter) {
1869
+ const words = simplifiedChapters.get(chapter)?.words;
1870
+ return !!words && Object.keys(words).length > 0;
1871
+ };
1872
+ var hasSimpleWords = hasSimpleWords2;
1211
1873
  let numberOfBooks = 0;
1212
1874
  let numberOfApocryphalBooks = 0;
1213
1875
  for (let book of books) {
@@ -1450,72 +2112,74 @@ function generateApiForDataset(dataset, options = {}) {
1450
2112
  );
1451
2113
  }
1452
2114
  }
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;
2115
+ const simpleChapterLink = (chapter) => bookChapterApiLink(
2116
+ translation.id,
2117
+ getBookLink(chapter.book),
2118
+ chapter.chapter.number,
2119
+ SIMPLE_JSON_EXTENSION,
2120
+ apiPathPrefix
2121
+ );
2122
+ const simpleWordsLink = (chapter) => hasSimpleWords2(chapter) ? bookChapterWordsApiLink(
2123
+ translation.id,
2124
+ getBookLink(chapter.book),
2125
+ chapter.chapter.number,
2126
+ apiPathPrefix,
2127
+ SIMPLE_JSON_EXTENSION
2128
+ ) : void 0;
2129
+ if (api.simpleTranslationBookChapters || api.simpleTranslationBookChapterWords) {
1473
2130
  for (let i = 0; i < translationChapters.length; i++) {
1474
2131
  const currentChapter = translationChapters[i];
1475
- const {
1476
- chapter,
1477
- simpleChapterApiLink,
1478
- thisChapterWordsLink,
1479
- nextChapterWordsLink,
1480
- previousChapterWordsLink,
1481
- ...rest
1482
- } = currentChapter;
1483
2132
  const previousChapter = translationChapters[i - 1];
1484
2133
  const nextChapter = translationChapters[i + 1];
1485
2134
  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
- };
2135
+ let simpleChapter;
2136
+ if (api.simpleTranslationBookChapters) {
2137
+ const {
2138
+ chapter,
2139
+ simpleChapterApiLink,
2140
+ thisChapterWordsLink,
2141
+ nextChapterWordsLink,
2142
+ previousChapterWordsLink,
2143
+ ...rest
2144
+ } = currentChapter;
2145
+ simpleChapter = {
2146
+ ...rest,
2147
+ chapter: simplified.chapter,
2148
+ thisChapterLink: simpleChapterLink(currentChapter),
2149
+ fullChapterApiLink: rest.thisChapterLink,
2150
+ previousChapterApiLink: previousChapter ? simpleChapterLink(previousChapter) : null,
2151
+ nextChapterApiLink: nextChapter ? simpleChapterLink(nextChapter) : null
2152
+ };
2153
+ }
1494
2154
  const thisWordsLink = simpleWordsLink(currentChapter);
1495
2155
  if (thisWordsLink) {
1496
- simpleChapter.thisChapterWordsLink = thisWordsLink;
2156
+ if (simpleChapter) {
2157
+ simpleChapter.thisChapterWordsLink = thisWordsLink;
2158
+ }
1497
2159
  api.simpleTranslationBookChapterWords?.push({
1498
2160
  translationId: translation.id,
1499
2161
  bookId: currentChapter.book.id,
1500
2162
  chapterNumber: currentChapter.chapter.number,
1501
- thisChapterLink: simpleChapter.thisChapterLink,
1502
- nextChapterLink: simpleChapter.nextChapterApiLink,
1503
- previousChapterLink: simpleChapter.previousChapterApiLink,
2163
+ thisChapterLink: simpleChapter?.thisChapterLink ?? currentChapter.thisChapterLink,
2164
+ nextChapterLink: simpleChapter?.nextChapterApiLink ?? currentChapter.nextChapterApiLink,
2165
+ previousChapterLink: simpleChapter?.previousChapterApiLink ?? currentChapter.previousChapterApiLink,
1504
2166
  thisChapterWordsLink: thisWordsLink,
1505
2167
  nextChapterWordsLink: nextChapter ? simpleWordsLink(nextChapter) ?? null : null,
1506
2168
  previousChapterWordsLink: previousChapter ? simpleWordsLink(previousChapter) ?? null : null,
1507
2169
  verses: simplified.words
1508
2170
  });
1509
2171
  }
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;
2172
+ if (simpleChapter) {
2173
+ const nextWordsLink = nextChapter ? simpleWordsLink(nextChapter) : void 0;
2174
+ if (nextWordsLink) {
2175
+ simpleChapter.nextChapterWordsLink = nextWordsLink;
2176
+ }
2177
+ const previousWordsLink = previousChapter ? simpleWordsLink(previousChapter) : void 0;
2178
+ if (previousWordsLink) {
2179
+ simpleChapter.previousChapterWordsLink = previousWordsLink;
2180
+ }
2181
+ api.simpleTranslationBookChapters.push(simpleChapter);
1517
2182
  }
1518
- api.simpleTranslationBookChapters.push(simpleChapter);
1519
2183
  }
1520
2184
  }
1521
2185
  for (let { reader, verses, apiBookChapter } of pendingAudioTimings) {
@@ -1584,16 +2248,16 @@ function generateApiForDataset(dataset, options = {}) {
1584
2248
  books: completeBooks.map(
1585
2249
  ({ book, chapters }) => completeBook(
1586
2250
  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
- })
2251
+ chapters.map((ch) => ({
2252
+ ...completeChapter(ch),
2253
+ // The complete files link to the word annotations
2254
+ // rather than embedding them, same as the regular
2255
+ // per-chapter endpoint.
2256
+ ...ch.thisChapterWordsLink ? {
2257
+ thisChapterWordsLink: ch.thisChapterWordsLink
2258
+ } : {},
2259
+ chapter: ch.chapter
2260
+ }))
1597
2261
  )
1598
2262
  )
1599
2263
  };
@@ -1605,10 +2269,10 @@ function generateApiForDataset(dataset, options = {}) {
1605
2269
  book,
1606
2270
  chapters.map((ch) => {
1607
2271
  const simplified = simplifiedChapters.get(ch);
1608
- const hasWords = Object.keys(simplified.words).length > 0;
2272
+ const wordsLink = simpleWordsLink(ch);
1609
2273
  return {
1610
2274
  ...completeChapter(ch),
1611
- ...hasWords ? { thisChapterWords: simplified.words } : {},
2275
+ ...wordsLink ? { thisChapterWordsLink: wordsLink } : {},
1612
2276
  chapter: simplified.chapter
1613
2277
  };
1614
2278
  })
@@ -1810,7 +2474,14 @@ function generateApiForDataset(dataset, options = {}) {
1810
2474
  api.commentaryBooks.push(commentaryBooks);
1811
2475
  api.commentaryProfiles.push(commentaryProfiles);
1812
2476
  }
1813
- for (let { books, ...datasetInfo } of dataset.datasets ?? []) {
2477
+ for (let {
2478
+ books,
2479
+ people,
2480
+ places,
2481
+ events,
2482
+ peopleGroups,
2483
+ ...datasetInfo
2484
+ } of dataset.datasets ?? []) {
1814
2485
  const apiDataset = {
1815
2486
  ...datasetInfo,
1816
2487
  availableFormats: ["json"],
@@ -1935,6 +2606,447 @@ function generateApiForDataset(dataset, options = {}) {
1935
2606
  };
1936
2607
  }
1937
2608
  }
2609
+ const linkEntityRef = (collection, ref) => ref ? {
2610
+ ...ref,
2611
+ type: collection,
2612
+ apiLink: datasetEntityApiLink(
2613
+ datasetInfo.id,
2614
+ collection,
2615
+ ref.id,
2616
+ "json",
2617
+ apiPathPrefix
2618
+ )
2619
+ } : void 0;
2620
+ const linkEntityRefs = (collection, refs) => refs?.map((ref) => linkEntityRef(collection, ref));
2621
+ if (people) {
2622
+ const datasetPeople = {
2623
+ dataset: apiDataset,
2624
+ people: []
2625
+ };
2626
+ for (let person of people) {
2627
+ const thisPersonApiLink = datasetEntityApiLink(
2628
+ datasetInfo.id,
2629
+ "people",
2630
+ person.id,
2631
+ "json",
2632
+ apiPathPrefix
2633
+ );
2634
+ datasetPeople.people.push({
2635
+ id: person.id,
2636
+ name: person.name,
2637
+ isProperName: person.isProperName,
2638
+ gender: person.gender,
2639
+ numberOfReferences: person.references.length,
2640
+ thisPersonApiLink
2641
+ });
2642
+ const apiPerson = {
2643
+ dataset: apiDataset,
2644
+ person: {
2645
+ ...person,
2646
+ birthPlace: linkEntityRef("places", person.birthPlace),
2647
+ deathPlace: linkEntityRef("places", person.deathPlace),
2648
+ father: linkEntityRefs("people", person.father),
2649
+ mother: linkEntityRefs("people", person.mother),
2650
+ partners: linkEntityRefs("people", person.partners),
2651
+ children: linkEntityRefs("people", person.children),
2652
+ siblings: linkEntityRefs("people", person.siblings),
2653
+ halfSiblingsSameMother: linkEntityRefs(
2654
+ "people",
2655
+ person.halfSiblingsSameMother
2656
+ ),
2657
+ halfSiblingsSameFather: linkEntityRefs(
2658
+ "people",
2659
+ person.halfSiblingsSameFather
2660
+ ),
2661
+ memberOf: linkEntityRefs("groups", person.memberOf),
2662
+ events: linkEntityRefs("events", person.events)
2663
+ },
2664
+ thisPersonApiLink
2665
+ };
2666
+ if (!api.datasetPeopleContents) {
2667
+ api.datasetPeopleContents = [];
2668
+ }
2669
+ api.datasetPeopleContents.push(apiPerson);
2670
+ }
2671
+ apiDataset.listOfPeopleApiLink = listOfDatasetEntitiesApiLink(
2672
+ datasetInfo.id,
2673
+ "people",
2674
+ "json",
2675
+ apiPathPrefix
2676
+ );
2677
+ apiDataset.totalNumberOfPeople = people.length;
2678
+ if (!api.datasetPeople) {
2679
+ api.datasetPeople = [];
2680
+ }
2681
+ api.datasetPeople.push(datasetPeople);
2682
+ }
2683
+ if (places) {
2684
+ const datasetPlaces = {
2685
+ dataset: apiDataset,
2686
+ places: []
2687
+ };
2688
+ for (let place of places) {
2689
+ const thisPlaceApiLink = datasetEntityApiLink(
2690
+ datasetInfo.id,
2691
+ "places",
2692
+ place.id,
2693
+ "json",
2694
+ apiPathPrefix
2695
+ );
2696
+ datasetPlaces.places.push({
2697
+ id: place.id,
2698
+ name: place.name,
2699
+ featureType: place.featureType,
2700
+ latitude: place.latitude,
2701
+ longitude: place.longitude,
2702
+ numberOfReferences: place.references.length,
2703
+ thisPlaceApiLink
2704
+ });
2705
+ const apiPlace = {
2706
+ dataset: apiDataset,
2707
+ place: {
2708
+ ...place,
2709
+ rootPlace: linkEntityRef("places", place.rootPlace),
2710
+ duplicateOf: linkEntityRef("places", place.duplicateOf),
2711
+ people: linkEntityRefs("people", place.people),
2712
+ peopleBorn: linkEntityRefs("people", place.peopleBorn),
2713
+ peopleDied: linkEntityRefs("people", place.peopleDied),
2714
+ events: linkEntityRefs("events", place.events)
2715
+ },
2716
+ thisPlaceApiLink
2717
+ };
2718
+ if (!api.datasetPlaceContents) {
2719
+ api.datasetPlaceContents = [];
2720
+ }
2721
+ api.datasetPlaceContents.push(apiPlace);
2722
+ }
2723
+ apiDataset.listOfPlacesApiLink = listOfDatasetEntitiesApiLink(
2724
+ datasetInfo.id,
2725
+ "places",
2726
+ "json",
2727
+ apiPathPrefix
2728
+ );
2729
+ apiDataset.totalNumberOfPlaces = places.length;
2730
+ if (!api.datasetPlaces) {
2731
+ api.datasetPlaces = [];
2732
+ }
2733
+ api.datasetPlaces.push(datasetPlaces);
2734
+ }
2735
+ if (events) {
2736
+ const datasetEvents = {
2737
+ dataset: apiDataset,
2738
+ events: []
2739
+ };
2740
+ for (let event of events) {
2741
+ const thisEventApiLink = datasetEntityApiLink(
2742
+ datasetInfo.id,
2743
+ "events",
2744
+ event.id,
2745
+ "json",
2746
+ apiPathPrefix
2747
+ );
2748
+ datasetEvents.events.push({
2749
+ id: event.id,
2750
+ name: event.name,
2751
+ startDate: event.startDate,
2752
+ numberOfReferences: event.references.length,
2753
+ thisEventApiLink
2754
+ });
2755
+ const apiEvent = {
2756
+ dataset: apiDataset,
2757
+ event: {
2758
+ ...event,
2759
+ participants: linkEntityRefs(
2760
+ "people",
2761
+ event.participants
2762
+ ),
2763
+ locations: linkEntityRefs("places", event.locations),
2764
+ groups: linkEntityRefs("groups", event.groups),
2765
+ partOf: linkEntityRef("events", event.partOf),
2766
+ predecessor: linkEntityRef("events", event.predecessor)
2767
+ },
2768
+ thisEventApiLink
2769
+ };
2770
+ if (!api.datasetEventContents) {
2771
+ api.datasetEventContents = [];
2772
+ }
2773
+ api.datasetEventContents.push(apiEvent);
2774
+ }
2775
+ apiDataset.listOfEventsApiLink = listOfDatasetEntitiesApiLink(
2776
+ datasetInfo.id,
2777
+ "events",
2778
+ "json",
2779
+ apiPathPrefix
2780
+ );
2781
+ apiDataset.totalNumberOfEvents = events.length;
2782
+ if (!api.datasetEvents) {
2783
+ api.datasetEvents = [];
2784
+ }
2785
+ api.datasetEvents.push(datasetEvents);
2786
+ }
2787
+ if (peopleGroups) {
2788
+ const datasetPeopleGroups = {
2789
+ dataset: apiDataset,
2790
+ groups: []
2791
+ };
2792
+ for (let group of peopleGroups) {
2793
+ const thisPeopleGroupApiLink = datasetEntityApiLink(
2794
+ datasetInfo.id,
2795
+ "groups",
2796
+ group.id,
2797
+ "json",
2798
+ apiPathPrefix
2799
+ );
2800
+ datasetPeopleGroups.groups.push({
2801
+ id: group.id,
2802
+ name: group.name,
2803
+ numberOfMembers: group.members?.length ?? 0,
2804
+ thisPeopleGroupApiLink
2805
+ });
2806
+ const apiGroup = {
2807
+ dataset: apiDataset,
2808
+ group: {
2809
+ ...group,
2810
+ members: linkEntityRefs("people", group.members),
2811
+ events: linkEntityRefs("events", group.events)
2812
+ },
2813
+ thisPeopleGroupApiLink
2814
+ };
2815
+ if (!api.datasetPeopleGroupContents) {
2816
+ api.datasetPeopleGroupContents = [];
2817
+ }
2818
+ api.datasetPeopleGroupContents.push(apiGroup);
2819
+ }
2820
+ apiDataset.listOfPeopleGroupsApiLink = listOfDatasetEntitiesApiLink(
2821
+ datasetInfo.id,
2822
+ "groups",
2823
+ "json",
2824
+ apiPathPrefix
2825
+ );
2826
+ apiDataset.totalNumberOfPeopleGroups = peopleGroups.length;
2827
+ if (!api.datasetPeopleGroups) {
2828
+ api.datasetPeopleGroups = [];
2829
+ }
2830
+ api.datasetPeopleGroups.push(datasetPeopleGroups);
2831
+ }
2832
+ if (books.length <= 0 && (people || places || events)) {
2833
+ let addEntityVerses2 = function(collection, references, createEntry) {
2834
+ for (let reference of references) {
2835
+ let bookChapters = chapterMap.get(reference.book);
2836
+ if (!bookChapters) {
2837
+ bookChapters = /* @__PURE__ */ new Map();
2838
+ chapterMap.set(reference.book, bookChapters);
2839
+ }
2840
+ let chapterEntities = bookChapters.get(reference.chapter);
2841
+ if (!chapterEntities) {
2842
+ chapterEntities = {
2843
+ people: /* @__PURE__ */ new Map(),
2844
+ places: /* @__PURE__ */ new Map(),
2845
+ events: /* @__PURE__ */ new Map()
2846
+ };
2847
+ bookChapters.set(reference.chapter, chapterEntities);
2848
+ }
2849
+ const entry = createEntry();
2850
+ const entities = chapterEntities[collection];
2851
+ let existing = entities.get(entry.id);
2852
+ if (!existing) {
2853
+ existing = { ...entry, verses: [] };
2854
+ entities.set(entry.id, existing);
2855
+ }
2856
+ const endVerse = reference.endVerse ?? reference.verse;
2857
+ for (let verse = reference.verse; verse <= endVerse; verse++) {
2858
+ existing.verses.push(verse);
2859
+ }
2860
+ }
2861
+ }, sortEntities2 = function(entities) {
2862
+ const list = [...entities.values()];
2863
+ for (let entity of list) {
2864
+ entity.verses.sort((a, b) => a - b);
2865
+ }
2866
+ return list.sort(
2867
+ (a, b) => a.verses[0] - b.verses[0] || a.id.localeCompare(b.id)
2868
+ );
2869
+ };
2870
+ var addEntityVerses = addEntityVerses2, sortEntities = sortEntities2;
2871
+ const chapterMap = /* @__PURE__ */ new Map();
2872
+ for (let person of people ?? []) {
2873
+ addEntityVerses2(
2874
+ "people",
2875
+ person.references,
2876
+ () => ({
2877
+ id: person.id,
2878
+ name: person.name,
2879
+ isProperName: person.isProperName,
2880
+ gender: person.gender,
2881
+ birthYear: person.birthYear,
2882
+ deathYear: person.deathYear,
2883
+ apiLink: datasetEntityApiLink(
2884
+ datasetInfo.id,
2885
+ "people",
2886
+ person.id,
2887
+ "json",
2888
+ apiPathPrefix
2889
+ )
2890
+ })
2891
+ );
2892
+ }
2893
+ for (let place of places ?? []) {
2894
+ addEntityVerses2(
2895
+ "places",
2896
+ place.references,
2897
+ () => ({
2898
+ id: place.id,
2899
+ name: place.name,
2900
+ featureType: place.featureType,
2901
+ latitude: place.latitude,
2902
+ longitude: place.longitude,
2903
+ apiLink: datasetEntityApiLink(
2904
+ datasetInfo.id,
2905
+ "places",
2906
+ place.id,
2907
+ "json",
2908
+ apiPathPrefix
2909
+ )
2910
+ })
2911
+ );
2912
+ }
2913
+ for (let event of events ?? []) {
2914
+ addEntityVerses2(
2915
+ "events",
2916
+ event.references,
2917
+ () => ({
2918
+ id: event.id,
2919
+ name: event.name,
2920
+ startDate: event.startDate,
2921
+ apiLink: datasetEntityApiLink(
2922
+ datasetInfo.id,
2923
+ "events",
2924
+ event.id,
2925
+ "json",
2926
+ apiPathPrefix
2927
+ )
2928
+ })
2929
+ );
2930
+ }
2931
+ const sortedBooks = [...chapterMap.keys()].sort(
2932
+ (a, b) => (import_book_order.bookOrderMap.get(a) ?? 9999) - (import_book_order.bookOrderMap.get(b) ?? 9999)
2933
+ );
2934
+ const entityChapters = [];
2935
+ for (let bookId of sortedBooks) {
2936
+ const bookChapters = chapterMap.get(bookId);
2937
+ const chapterNumbers = [...bookChapters.keys()].sort(
2938
+ (a, b) => a - b
2939
+ );
2940
+ const firstChapterNumber = chapterNumbers[0];
2941
+ const lastChapterNumber = chapterNumbers[chapterNumbers.length - 1];
2942
+ const apiBook = {
2943
+ id: bookId,
2944
+ order: import_book_order.bookOrderMap.get(bookId) ?? 9999,
2945
+ firstChapterNumber,
2946
+ firstChapterApiLink: bookDatasetChapterApiLink(
2947
+ datasetInfo.id,
2948
+ bookId,
2949
+ firstChapterNumber,
2950
+ "json",
2951
+ apiPathPrefix
2952
+ ),
2953
+ firstChapterReference: {
2954
+ datasetId: datasetInfo.id,
2955
+ book: bookId,
2956
+ chapter: firstChapterNumber
2957
+ },
2958
+ lastChapterNumber,
2959
+ lastChapterApiLink: bookDatasetChapterApiLink(
2960
+ datasetInfo.id,
2961
+ bookId,
2962
+ lastChapterNumber,
2963
+ "json",
2964
+ apiPathPrefix
2965
+ ),
2966
+ lastChapterReference: {
2967
+ datasetId: datasetInfo.id,
2968
+ book: bookId,
2969
+ chapter: lastChapterNumber
2970
+ },
2971
+ numberOfChapters: chapterNumbers.length,
2972
+ totalNumberOfVerses: 0,
2973
+ totalNumberOfReferences: 0
2974
+ };
2975
+ for (let chapterNumber of chapterNumbers) {
2976
+ const chapterEntities = bookChapters.get(chapterNumber);
2977
+ const chapterPeople = sortEntities2(chapterEntities.people);
2978
+ const chapterPlaces = sortEntities2(chapterEntities.places);
2979
+ const chapterEvents = sortEntities2(chapterEntities.events);
2980
+ const distinctVerses = /* @__PURE__ */ new Set();
2981
+ let numberOfReferences = 0;
2982
+ for (let list of [
2983
+ chapterPeople,
2984
+ chapterPlaces,
2985
+ chapterEvents
2986
+ ]) {
2987
+ for (let entity of list) {
2988
+ numberOfReferences += entity.verses.length;
2989
+ for (let verse of entity.verses) {
2990
+ distinctVerses.add(verse);
2991
+ }
2992
+ }
2993
+ }
2994
+ apiBook.totalNumberOfVerses += distinctVerses.size;
2995
+ apiBook.totalNumberOfReferences += numberOfReferences;
2996
+ const apiChapter = {
2997
+ dataset: apiDataset,
2998
+ book: apiBook,
2999
+ chapter: {
3000
+ number: chapterNumber,
3001
+ people: chapterPeople,
3002
+ places: chapterPlaces,
3003
+ events: chapterEvents
3004
+ },
3005
+ thisChapterLink: bookDatasetChapterApiLink(
3006
+ datasetInfo.id,
3007
+ bookId,
3008
+ chapterNumber,
3009
+ "json",
3010
+ apiPathPrefix
3011
+ ),
3012
+ thisChapterReference: {
3013
+ datasetId: datasetInfo.id,
3014
+ book: bookId,
3015
+ chapter: chapterNumber
3016
+ },
3017
+ nextChapterApiLink: null,
3018
+ nextChapterReference: null,
3019
+ previousChapterApiLink: null,
3020
+ previousChapterReference: null,
3021
+ numberOfPeople: chapterPeople.length,
3022
+ numberOfPlaces: chapterPlaces.length,
3023
+ numberOfEvents: chapterEvents.length
3024
+ };
3025
+ entityChapters.push(apiChapter);
3026
+ }
3027
+ datasetBooks.books.push(apiBook);
3028
+ apiDataset.totalNumberOfChapters += apiBook.numberOfChapters;
3029
+ apiDataset.totalNumberOfVerses += apiBook.totalNumberOfVerses;
3030
+ apiDataset.totalNumberOfReferences += apiBook.totalNumberOfReferences;
3031
+ }
3032
+ apiDataset.numberOfBooks = datasetBooks.books.length;
3033
+ for (let i = 0; i < entityChapters.length; i++) {
3034
+ if (i > 0) {
3035
+ entityChapters[i].previousChapterApiLink = entityChapters[i - 1].thisChapterLink;
3036
+ entityChapters[i].previousChapterReference = entityChapters[i - 1].thisChapterReference;
3037
+ }
3038
+ if (i < entityChapters.length - 1) {
3039
+ entityChapters[i].nextChapterApiLink = entityChapters[i + 1].thisChapterLink;
3040
+ entityChapters[i].nextChapterReference = entityChapters[i + 1].thisChapterReference;
3041
+ }
3042
+ }
3043
+ if (entityChapters.length > 0) {
3044
+ if (!api.datasetEntityBookChapters) {
3045
+ api.datasetEntityBookChapters = [];
3046
+ }
3047
+ api.datasetEntityBookChapters.push(...entityChapters);
3048
+ }
3049
+ }
1938
3050
  if (!api.availableDatasets) {
1939
3051
  api.availableDatasets = {
1940
3052
  datasets: []
@@ -2063,6 +3175,44 @@ function generateFilesForApi(api) {
2063
3175
  );
2064
3176
  }
2065
3177
  }
3178
+ for (let entityChapter of api.datasetEntityBookChapters ?? []) {
3179
+ files.push(jsonFile(entityChapter.thisChapterLink, entityChapter));
3180
+ }
3181
+ for (let datasetPeople of api.datasetPeople ?? []) {
3182
+ files.push(
3183
+ jsonFile(datasetPeople.dataset.listOfPeopleApiLink, datasetPeople)
3184
+ );
3185
+ }
3186
+ for (let person of api.datasetPeopleContents ?? []) {
3187
+ files.push(jsonFile(person.thisPersonApiLink, person));
3188
+ }
3189
+ for (let datasetPlaces of api.datasetPlaces ?? []) {
3190
+ files.push(
3191
+ jsonFile(datasetPlaces.dataset.listOfPlacesApiLink, datasetPlaces)
3192
+ );
3193
+ }
3194
+ for (let place of api.datasetPlaceContents ?? []) {
3195
+ files.push(jsonFile(place.thisPlaceApiLink, place));
3196
+ }
3197
+ for (let datasetEvents of api.datasetEvents ?? []) {
3198
+ files.push(
3199
+ jsonFile(datasetEvents.dataset.listOfEventsApiLink, datasetEvents)
3200
+ );
3201
+ }
3202
+ for (let event of api.datasetEventContents ?? []) {
3203
+ files.push(jsonFile(event.thisEventApiLink, event));
3204
+ }
3205
+ for (let datasetPeopleGroups of api.datasetPeopleGroups ?? []) {
3206
+ files.push(
3207
+ jsonFile(
3208
+ datasetPeopleGroups.dataset.listOfPeopleGroupsApiLink,
3209
+ datasetPeopleGroups
3210
+ )
3211
+ );
3212
+ }
3213
+ for (let group of api.datasetPeopleGroupContents ?? []) {
3214
+ files.push(jsonFile(group.thisPeopleGroupApiLink, group));
3215
+ }
2066
3216
  return files;
2067
3217
  }
2068
3218
  async function* generateOutputFilesFromDatasets(datasets, options) {
@@ -2084,6 +3234,14 @@ function listOfCommentaryBooksApiLink(commentaryId, prefix = "") {
2084
3234
  function listOfDatasetBooksApiLink(datasetId, prefix = "") {
2085
3235
  return `${prefix}/api/d/${datasetId}/books.json`;
2086
3236
  }
3237
+ function listOfDatasetEntitiesApiLink(datasetId, collection, extension = "json", prefix = "") {
3238
+ return `${prefix}/api/d/${datasetId}/${collection}.${extension}`;
3239
+ }
3240
+ function datasetEntityApiLink(datasetId, collection, entityId, extension = "json", prefix = "") {
3241
+ return `${prefix}/api/d/${datasetId}/${collection}/${replaceSpacesWithUnderscores(
3242
+ entityId
3243
+ )}.${extension}`;
3244
+ }
2087
3245
  const SIMPLE_JSON_EXTENSION = "simple.json";
2088
3246
  function bookChapterApiLink(translationId, commonName, chapterNumber, extension, prefix = "") {
2089
3247
  return `${prefix}/api/${translationId}/${replaceSpacesWithUnderscores(
@@ -2154,6 +3312,23 @@ function replaceSpacesWithUnderscores(str) {
2154
3312
  ApiDatasetBookChapterSchema,
2155
3313
  ApiDatasetBookSchema,
2156
3314
  ApiDatasetBooksSchema,
3315
+ ApiDatasetChapterEventSchema,
3316
+ ApiDatasetChapterPersonSchema,
3317
+ ApiDatasetChapterPlaceSchema,
3318
+ ApiDatasetEntityBookChapterSchema,
3319
+ ApiDatasetEntityChapterDataSchema,
3320
+ ApiDatasetEventSchema,
3321
+ ApiDatasetEventSummarySchema,
3322
+ ApiDatasetEventsSchema,
3323
+ ApiDatasetPeopleGroupSchema,
3324
+ ApiDatasetPeopleGroupSummarySchema,
3325
+ ApiDatasetPeopleGroupsSchema,
3326
+ ApiDatasetPeopleSchema,
3327
+ ApiDatasetPersonSchema,
3328
+ ApiDatasetPersonSummarySchema,
3329
+ ApiDatasetPlaceSchema,
3330
+ ApiDatasetPlaceSummarySchema,
3331
+ ApiDatasetPlacesSchema,
2157
3332
  ApiDatasetSchema,
2158
3333
  ApiSimpleCommentaryBookChapterSchema,
2159
3334
  ApiSimpleTranslationBookChapterSchema,
@@ -2182,6 +3357,7 @@ function replaceSpacesWithUnderscores(str) {
2182
3357
  bookCommentaryChapterApiLink,
2183
3358
  bookDatasetChapterApiLink,
2184
3359
  completeTranslationApiLink,
3360
+ datasetEntityApiLink,
2185
3361
  downloadedFile,
2186
3362
  generateApiForDataset,
2187
3363
  generateFilesForApi,
@@ -2190,6 +3366,7 @@ function replaceSpacesWithUnderscores(str) {
2190
3366
  listOfBooksApiLink,
2191
3367
  listOfCommentaryBooksApiLink,
2192
3368
  listOfDatasetBooksApiLink,
3369
+ listOfDatasetEntitiesApiLink,
2193
3370
  profileCommentaryApiLink,
2194
3371
  profilesCommentaryApiLink,
2195
3372
  replaceSpacesWithUnderscores