@helloao/tools 0.0.14 → 0.0.15

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.
@@ -1,4 +1,4 @@
1
- import { Commentary, CommentaryBook, CommentaryBookChapter, CommentaryProfile, OutputFile, Translation, TranslationBook, TranslationBookChapter, TranslationBookChapterAudioLinks } from './common-types.js';
1
+ import { Commentary, CommentaryBook, CommentaryBookChapter, CommentaryProfile, Dataset, DatasetBook, DatasetBookChapter, OutputFile, Translation, TranslationBook, TranslationBookChapter, TranslationBookChapterAudioLinks } from './common-types.js';
2
2
  import { DatasetOutput } from './dataset.js';
3
3
  /**
4
4
  * Defines the output of the API generation.
@@ -54,6 +54,22 @@ export interface ApiOutput {
54
54
  * - /api/c/:commentaryId/profiles/:profileId.json
55
55
  */
56
56
  commentaryProfileContents: ApiCommentaryProfileContent[];
57
+ /**
58
+ * The list of available datasets.
59
+ * This maps to the /api/available-datasets.json endpoint.
60
+ */
61
+ availableDatasets?: ApiAvailableDatasets;
62
+ /**
63
+ * The list of books for each dataset.
64
+ * This maps to the /api/d/:datasetId/books.json endpoint.
65
+ */
66
+ datasetBooks?: ApiDatasetBooks[];
67
+ /**
68
+ * The list of chapters for each dataset book.
69
+ * This maps to the following endpoint:
70
+ * - /api/d/:datasetId/:bookId/:chapterNumber.json
71
+ */
72
+ datasetBookChapters?: ApiDatasetBookChapter[];
57
73
  /**
58
74
  * The path prefix that the API should use.
59
75
  */
@@ -79,6 +95,52 @@ export interface ApiAvailableCommentaries {
79
95
  */
80
96
  commentaries: ApiCommentary[];
81
97
  }
98
+ /**
99
+ * The list of available datasets.
100
+ * Maps to the /api/available-datasets.json endpoint.
101
+ */
102
+ export interface ApiAvailableDatasets {
103
+ datasets: ApiDataset[];
104
+ }
105
+ /**
106
+ * Defines a dataset that is used in the API.
107
+ */
108
+ export interface ApiDataset extends Dataset {
109
+ /**
110
+ * The API link for the list of books for this dataset.
111
+ */
112
+ listOfBooksApiLink: string;
113
+ /**
114
+ * The available list of formats.
115
+ */
116
+ availableFormats: 'json'[];
117
+ /**
118
+ * The number of books that are contained in this dataset.
119
+ */
120
+ numberOfBooks: number;
121
+ /**
122
+ * The total number of chapters that are contained in this dataset.
123
+ */
124
+ totalNumberOfChapters: number;
125
+ /**
126
+ * The total number of verses that are contained in this dataset.
127
+ */
128
+ totalNumberOfVerses: number;
129
+ /**
130
+ * The total number of references that are contained in this dataset.
131
+ */
132
+ totalNumberOfReferences: number;
133
+ /**
134
+ * Gets the name of the language that the commentary is in.
135
+ * Null or undefined if the name of the language is not known.
136
+ */
137
+ languageName?: string;
138
+ /**
139
+ * Gets the name of the language in English.
140
+ * Null or undefined if the language doesn't have an english name.
141
+ */
142
+ languageEnglishName?: string;
143
+ }
82
144
  /**
83
145
  * Defines a translation that is used in the API.
84
146
  */
@@ -209,6 +271,19 @@ export interface ApiCommentaryBooks {
209
271
  */
210
272
  books: ApiCommentaryBook[];
211
273
  }
274
+ /**
275
+ * Defines an interface that contains information about the books that are available for a dataset.
276
+ */
277
+ export interface ApiDatasetBooks {
278
+ /**
279
+ * The dataset information for the books.
280
+ */
281
+ dataset: ApiDataset;
282
+ /**
283
+ * The list of books that are available for the dataset.
284
+ */
285
+ books: ApiDatasetBook[];
286
+ }
212
287
  /**
213
288
  * Defines an interface that contains information about the profiles that are available for a commentary.
214
289
  */
@@ -301,6 +376,39 @@ export interface ApiCommentaryBook extends CommentaryBook {
301
376
  */
302
377
  totalNumberOfVerses: number;
303
378
  }
379
+ /**
380
+ * Defines an interface that contains information about a book in a dataset.
381
+ */
382
+ export interface ApiDatasetBook extends DatasetBook {
383
+ /**
384
+ * The number of the first chapter in the book.
385
+ */
386
+ firstChapterNumber: number;
387
+ /**
388
+ * The link to the first chapter of the book.
389
+ */
390
+ firstChapterApiLink: string;
391
+ /**
392
+ * The number of the last chapter in the book.
393
+ */
394
+ lastChapterNumber: number;
395
+ /**
396
+ * The link to the last chapter of the book.
397
+ */
398
+ lastChapterApiLink: string;
399
+ /**
400
+ * The number of chapters that the book contains.
401
+ */
402
+ numberOfChapters: number;
403
+ /**
404
+ * The number of verses that the book contains.
405
+ */
406
+ totalNumberOfVerses: number;
407
+ /**
408
+ * The number of references that the book contains.
409
+ */
410
+ totalNumberOfReferences: number;
411
+ }
304
412
  /**
305
413
  * Defines an interface that contains information about a book chapter.
306
414
  */
@@ -373,6 +481,41 @@ export interface ApiCommentaryBookChapter extends CommentaryBookChapter {
373
481
  */
374
482
  numberOfVerses: number;
375
483
  }
484
+ /**
485
+ * Defines an interface that contains information about a book chapter.
486
+ */
487
+ export interface ApiDatasetBookChapter extends DatasetBookChapter {
488
+ /**
489
+ * The dataset information for the book chapter.
490
+ */
491
+ dataset: ApiDataset;
492
+ /**
493
+ * The book information for the book chapter.
494
+ */
495
+ book: ApiDatasetBook;
496
+ /**
497
+ * The link to this chapter.
498
+ */
499
+ thisChapterLink: string;
500
+ /**
501
+ * The link to the next chapter.
502
+ * Null if this is the last chapter in the translation.
503
+ */
504
+ nextChapterApiLink: string | null;
505
+ /**
506
+ * The link to the previous chapter.
507
+ * Null if this is the first chapter in the translation.
508
+ */
509
+ previousChapterApiLink: string | null;
510
+ /**
511
+ * The number of verses that the chapter contains.
512
+ */
513
+ numberOfVerses: number;
514
+ /**
515
+ * The number of references that the chapter contains.
516
+ */
517
+ numberOfReferences: number;
518
+ }
376
519
  export interface ApiTranslationBookChapterAudio {
377
520
  /**
378
521
  * The chapter that the audio is for.
@@ -464,6 +607,12 @@ export declare function listOfBooksApiLink(translationId: string, prefix?: strin
464
607
  * @returns
465
608
  */
466
609
  export declare function listOfCommentaryBooksApiLink(commentaryId: string, prefix?: string): string;
610
+ /**
611
+ * Gets the API Link for the list of books endpoint for a dataset.
612
+ * @param datasetId The ID of the dataset.
613
+ * @returns
614
+ */
615
+ export declare function listOfDatasetBooksApiLink(datasetId: string, prefix?: string): string;
467
616
  /**
468
617
  * Getes the API link for a book chapter.
469
618
  * @param translationId The ID of the translation.
@@ -481,6 +630,14 @@ export declare function bookChapterApiLink(translationId: string, commonName: st
481
630
  */
482
631
  export declare function bookCommentaryChapterApiLink(translationId: string, commonName: string, chapterNumber: number, extension: string, prefix?: string): string;
483
632
  export declare function bookChapterAudioApiLink(translationId: string, bookId: string, chapterNumber: number, reader: string, prefix?: string): string;
633
+ /**
634
+ * Getes the API link for a book chapter.
635
+ * @param translationId The ID of the translation.
636
+ * @param commonName The name of the book.
637
+ * @param chapterNumber The number of the book.
638
+ * @param extension The extension of the file.
639
+ */
640
+ export declare function bookDatasetChapterApiLink(translationId: string, commonName: string, chapterNumber: number, extension: string, prefix?: string): string;
484
641
  /**
485
642
  * Gets the API link for a profile.
486
643
  * @param translationId The ID of the translation.
@@ -165,6 +165,40 @@ export interface Commentary {
165
165
  */
166
166
  textDirection: 'ltr' | 'rtl';
167
167
  }
168
+ export interface Dataset {
169
+ /**
170
+ * The ID of the dataset.
171
+ */
172
+ id: string;
173
+ /**
174
+ * The name of the dataset.
175
+ */
176
+ name: string;
177
+ /**
178
+ * The website for the dataset.
179
+ */
180
+ website: string;
181
+ /**
182
+ * The URL that the license for the dataset can be found.
183
+ */
184
+ licenseUrl: string;
185
+ /**
186
+ * The API-added notes for the license.
187
+ */
188
+ licenseNotes?: string | null;
189
+ /**
190
+ * The English name for the dataset.
191
+ */
192
+ englishName: string;
193
+ /**
194
+ * The ISO 639 3-letter language tag that the dataset is primarily in.
195
+ */
196
+ language: string;
197
+ /**
198
+ * The direction that the language is written in.
199
+ */
200
+ textDirection: 'ltr' | 'rtl';
201
+ }
168
202
  /**
169
203
  * Defines an interface that contains information about a book.
170
204
  */
@@ -225,6 +259,60 @@ export interface CommentaryBook {
225
259
  */
226
260
  order: number;
227
261
  }
262
+ /**
263
+ * Defines an interface that contains information about a dataset book.
264
+ */
265
+ export interface DatasetBook {
266
+ /**
267
+ * The ID of the book. Should match the USFM book ID.
268
+ */
269
+ id: string;
270
+ /**
271
+ * The order of the book in the Bible.
272
+ */
273
+ order: number;
274
+ }
275
+ /**
276
+ * Defines an interface that contains information about a chapter in a dataset.
277
+ */
278
+ export interface DatasetBookChapter {
279
+ /**
280
+ * The data for the chapter.
281
+ */
282
+ chapter: DatasetChapterData;
283
+ }
284
+ export interface DatasetChapterData {
285
+ /**
286
+ * The number of the chapter.
287
+ */
288
+ number: number;
289
+ /**
290
+ * The content of the chapter.
291
+ */
292
+ content: DatasetChapterVerseContent[];
293
+ }
294
+ /**
295
+ * Defines an interface that contains information about a verse in a dataset chapter.
296
+ */
297
+ export interface DatasetChapterVerseContent {
298
+ /**
299
+ * The number of the verse.
300
+ */
301
+ verse: number;
302
+ /**
303
+ * The list of references for the verse.
304
+ */
305
+ references: ScoredVerseRef[];
306
+ }
307
+ /**
308
+ * Defines an interface that contains information about a verse reference that has an arbitrary score attached to it.
309
+ */
310
+ export interface ScoredVerseRef extends VerseRef {
311
+ /**
312
+ * The score of the verse reference.
313
+ */
314
+ score: number;
315
+ }
228
316
  /**
229
317
  * Defines an interface that contains information about a profile in a commentary.
230
318
  */
@@ -1,4 +1,4 @@
1
- import { Commentary, CommentaryBook, CommentaryBookChapter, CommentaryProfile, InputFile, Translation, TranslationBook, TranslationBookChapter } from './common-types.js';
1
+ import { Commentary, CommentaryBook, CommentaryBookChapter, CommentaryProfile, InputFile, Translation, TranslationBook, TranslationBookChapter, Dataset as CommonDataset, DatasetBook, DatasetBookChapter } from './common-types.js';
2
2
  import { ParseMessage } from '../parser/types.js';
3
3
  /**
4
4
  * Defines an interface that contains generated dataset info.
@@ -12,6 +12,10 @@ export interface DatasetOutput {
12
12
  * The list of commentaries that are available in the dataset.
13
13
  */
14
14
  commentaries: DatasetCommentary[];
15
+ /**
16
+ * The list of datasets that are available in the dataset.
17
+ */
18
+ datasets?: DatasetDataset[];
15
19
  parseMessages?: {
16
20
  [key: string]: ParseMessage[];
17
21
  };
@@ -62,6 +66,12 @@ export interface DatasetCommentaryProfile extends CommentaryProfile {
62
66
  */
63
67
  content: string[];
64
68
  }
69
+ export interface DatasetDataset extends CommonDataset {
70
+ books: DatasetDatasetBook[];
71
+ }
72
+ export interface DatasetDatasetBook extends DatasetBook {
73
+ chapters: DatasetBookChapter[];
74
+ }
65
75
  /**
66
76
  * Generates a list of output files from the given list of input files.
67
77
  * @param file The list of files.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@helloao/tools",
3
- "version": "0.0.14",
3
+ "version": "0.0.15",
4
4
  "description": "A set of tools for managing HelloAO's Free Bible API",
5
5
  "main": "./dist/cjs/index.cjs",
6
6
  "module": "./dist/esm/index.js",