@helloao/tools 0.1.0 → 0.2.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 +727 -2
- package/dist/cjs/generation/api.cjs.map +2 -2
- package/dist/cjs/generation/audio.cjs +52 -5
- package/dist/cjs/generation/audio.cjs.map +2 -2
- package/dist/cjs/generation/book-order.cjs +1 -1
- package/dist/cjs/generation/book-order.cjs.map +2 -2
- package/dist/cjs/generation/common-types.cjs +651 -0
- package/dist/cjs/generation/common-types.cjs.map +2 -2
- package/dist/cjs/generation/dataset.cjs +31 -8
- package/dist/cjs/generation/dataset.cjs.map +2 -2
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/cjs/log.cjs.map +1 -1
- package/dist/cjs/parser/codex-parser.cjs.map +1 -1
- package/dist/cjs/parser/commentary-csv-parser.cjs.map +1 -1
- package/dist/cjs/parser/iterators.cjs.map +1 -1
- package/dist/cjs/parser/lockman-parser.cjs +334 -0
- package/dist/cjs/parser/lockman-parser.cjs.map +7 -0
- 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.map +1 -1
- package/dist/cjs/parser/usx-parser.cjs +24 -7
- package/dist/cjs/parser/usx-parser.cjs.map +2 -2
- package/dist/cjs/utils.cjs +152 -0
- package/dist/cjs/utils.cjs.map +3 -3
- package/dist/esm/generation/api.js +696 -2
- package/dist/esm/generation/api.js.map +2 -2
- package/dist/esm/generation/audio.js +46 -3
- package/dist/esm/generation/audio.js.map +2 -2
- package/dist/esm/generation/book-order.js +1 -1
- package/dist/esm/generation/book-order.js.map +2 -2
- package/dist/esm/generation/common-types.js +590 -0
- package/dist/esm/generation/common-types.js.map +3 -3
- package/dist/esm/generation/dataset.js +29 -8
- package/dist/esm/generation/dataset.js.map +2 -2
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/log.js.map +1 -1
- package/dist/esm/parser/codex-parser.js.map +1 -1
- package/dist/esm/parser/commentary-csv-parser.js.map +1 -1
- package/dist/esm/parser/iterators.js.map +1 -1
- package/dist/esm/parser/lockman-parser.js +306 -0
- package/dist/esm/parser/lockman-parser.js.map +7 -0
- package/dist/esm/parser/tyndale-xml-parser.js.map +1 -1
- package/dist/esm/parser/usfm-parser.js.map +1 -1
- package/dist/esm/parser/usx-parser.js +24 -7
- package/dist/esm/parser/usx-parser.js.map +2 -2
- package/dist/esm/utils.js +138 -0
- package/dist/esm/utils.js.map +2 -2
- package/dist/types/generation/api.d.ts +2515 -470
- package/dist/types/generation/audio.d.ts +5 -0
- package/dist/types/generation/common-types.d.ts +1222 -413
- package/dist/types/generation/dataset.d.ts +1 -0
- package/dist/types/parser/codex-parser.d.ts +18 -138
- package/dist/types/parser/lockman-parser.d.ts +14 -0
- package/dist/types/parser/types.d.ts +4 -0
- package/dist/types/parser/usx-parser.d.ts +2 -2
- package/dist/types/utils.d.ts +223 -18
- package/package.json +5 -3
|
@@ -1,4 +1,698 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
import {
|
|
4
|
+
CommentaryBookChapterSchema,
|
|
5
|
+
CommentaryBookSchema,
|
|
6
|
+
CommentaryProfileSchema,
|
|
7
|
+
DatasetBookChapterSchema,
|
|
8
|
+
DatasetBookSchema,
|
|
9
|
+
DatasetSchema,
|
|
10
|
+
TranslationSchema,
|
|
11
|
+
TranslationBookSchema,
|
|
12
|
+
TranslationBookChapterSchema,
|
|
13
|
+
CommentarySchema
|
|
14
|
+
} from "./common-types.js";
|
|
15
|
+
import "zod-openapi";
|
|
16
|
+
export const ApiAvailableTranslationsSchema = z.object({
|
|
17
|
+
/**
|
|
18
|
+
* The list of translations.
|
|
19
|
+
*/
|
|
20
|
+
translations: z.array(z.lazy(() => ApiTranslationSchema)).meta({
|
|
21
|
+
description: "The list of translations that are available in the API."
|
|
22
|
+
})
|
|
23
|
+
}).meta({
|
|
24
|
+
id: "ApiAvailableTranslations",
|
|
25
|
+
description: "The list of available translations. Maps to the /api/available-translations.json endpoint."
|
|
26
|
+
});
|
|
27
|
+
export const ApiAvailableCommentariesSchema = z.object({
|
|
28
|
+
/**
|
|
29
|
+
* The list of commentaries.
|
|
30
|
+
*/
|
|
31
|
+
commentaries: z.array(z.lazy(() => ApiCommentarySchema)).meta({
|
|
32
|
+
description: "The list of commentaries that are available in the API."
|
|
33
|
+
})
|
|
34
|
+
}).meta({
|
|
35
|
+
id: "ApiAvailableCommentaries",
|
|
36
|
+
description: "The list of available commentaries. Maps to the /api/available-commentaries.json endpoint."
|
|
37
|
+
});
|
|
38
|
+
export const ApiAvailableDatasetsSchema = z.object({
|
|
39
|
+
datasets: z.array(z.lazy(() => ApiDatasetSchema)).meta({
|
|
40
|
+
description: "The list of datasets that are available in the API."
|
|
41
|
+
})
|
|
42
|
+
}).meta({
|
|
43
|
+
id: "ApiAvailableDatasets",
|
|
44
|
+
description: "The list of available datasets. Maps to the /api/available-datasets.json endpoint."
|
|
45
|
+
});
|
|
46
|
+
export const ApiDatasetSchema = DatasetSchema.extend({
|
|
47
|
+
/**
|
|
48
|
+
* The API link for the list of books for this dataset.
|
|
49
|
+
*/
|
|
50
|
+
listOfBooksApiLink: z.string().meta({
|
|
51
|
+
description: "The API link for the list of books for this dataset. Relative to the API origin."
|
|
52
|
+
}),
|
|
53
|
+
/**
|
|
54
|
+
* The available list of formats.
|
|
55
|
+
*/
|
|
56
|
+
availableFormats: z.array(z.literal("json")),
|
|
57
|
+
/**
|
|
58
|
+
* The number of books that are contained in this dataset.
|
|
59
|
+
*/
|
|
60
|
+
numberOfBooks: z.number().meta({
|
|
61
|
+
description: "The number of books that are contained in this dataset."
|
|
62
|
+
}),
|
|
63
|
+
/**
|
|
64
|
+
* The total number of chapters that are contained in this dataset.
|
|
65
|
+
*/
|
|
66
|
+
totalNumberOfChapters: z.number().meta({
|
|
67
|
+
description: "The total number of chapters that are contained in this dataset."
|
|
68
|
+
}),
|
|
69
|
+
/**
|
|
70
|
+
* The total number of verses that are contained in this dataset.
|
|
71
|
+
*/
|
|
72
|
+
totalNumberOfVerses: z.number().meta({
|
|
73
|
+
description: "The total number of verses that are contained in this dataset."
|
|
74
|
+
}),
|
|
75
|
+
/**
|
|
76
|
+
* The total number of references that are contained in this dataset.
|
|
77
|
+
*/
|
|
78
|
+
totalNumberOfReferences: z.number().meta({
|
|
79
|
+
description: "The total number of references that are contained in this dataset."
|
|
80
|
+
}),
|
|
81
|
+
/**
|
|
82
|
+
* Gets the name of the language that the commentary is in.
|
|
83
|
+
* Null or undefined if the name of the language is not known.
|
|
84
|
+
*/
|
|
85
|
+
languageName: z.string().optional().meta({
|
|
86
|
+
description: "Gets the name of the language that the dataset is in. Null or undefined if the name of the language is not known."
|
|
87
|
+
}),
|
|
88
|
+
/**
|
|
89
|
+
* Gets the name of the language in English.
|
|
90
|
+
* Null or undefined if the language doesn't have an english name.
|
|
91
|
+
*/
|
|
92
|
+
languageEnglishName: z.string().optional().meta({
|
|
93
|
+
description: "Gets the name of the language in English. Null or undefined if the language doesn't have an english name."
|
|
94
|
+
})
|
|
95
|
+
}).meta({
|
|
96
|
+
id: "ApiDataset",
|
|
97
|
+
description: "Defines a dataset that is used in the API."
|
|
98
|
+
});
|
|
99
|
+
export const ApiTranslationSchema = TranslationSchema.extend({
|
|
100
|
+
/**
|
|
101
|
+
* The API link for the list of available books for this translation.
|
|
102
|
+
*/
|
|
103
|
+
listOfBooksApiLink: z.string().meta({
|
|
104
|
+
description: "The API link for the list of books for this translation. Relative to the API origin."
|
|
105
|
+
}),
|
|
106
|
+
/**
|
|
107
|
+
* The available list of formats.
|
|
108
|
+
*/
|
|
109
|
+
availableFormats: z.array(z.enum(["json", "usfm"])),
|
|
110
|
+
/**
|
|
111
|
+
* The number of books that are contained in this translation.
|
|
112
|
+
*
|
|
113
|
+
* Complete translations should have the same number of books as the Bible (66).
|
|
114
|
+
*/
|
|
115
|
+
numberOfBooks: z.number().meta({
|
|
116
|
+
description: "The number of books that are contained in this translation. Complete translations should have the same number of books as the Bible (66)."
|
|
117
|
+
}),
|
|
118
|
+
/**
|
|
119
|
+
* The total number of chapters that are contained in this translation.
|
|
120
|
+
*
|
|
121
|
+
* Complete translations should have the same number of chapters as the Bible (1,189).
|
|
122
|
+
*/
|
|
123
|
+
totalNumberOfChapters: z.number().meta({
|
|
124
|
+
description: "The total number of chapters that are contained in this translation. Complete translations should have the same number of chapters as the Bible (1,189)."
|
|
125
|
+
}),
|
|
126
|
+
/**
|
|
127
|
+
* The total number of verses that are contained in this translation.
|
|
128
|
+
*
|
|
129
|
+
* Complete translations should have the same number of verses as the Bible (around 31,102 - some translations exclude verses based on the aparent likelyhood of existing in the original source texts).
|
|
130
|
+
*/
|
|
131
|
+
totalNumberOfVerses: z.number().meta({
|
|
132
|
+
description: "The total number of verses that are contained in this translation. Complete translations should have the same number of verses as the Bible (around 31,102 - some translations exclude verses based on the aparent likelyhood of existing in the original source texts)."
|
|
133
|
+
}),
|
|
134
|
+
/**
|
|
135
|
+
* The total number of apocryphal books that are contained in this translation.
|
|
136
|
+
*/
|
|
137
|
+
numberOfApocryphalBooks: z.number().optional().meta({
|
|
138
|
+
description: "The total number of apocryphal books that are contained in this translation."
|
|
139
|
+
}),
|
|
140
|
+
/**
|
|
141
|
+
* The total number of apocryphal chapters that are contained in this translation.
|
|
142
|
+
*/
|
|
143
|
+
totalNumberOfApocryphalChapters: z.number().optional().meta({
|
|
144
|
+
description: "The total number of apocryphal chapters that are contained in this translation."
|
|
145
|
+
}),
|
|
146
|
+
/**
|
|
147
|
+
* The total number of apocryphal verses that are contained in this translation.
|
|
148
|
+
*/
|
|
149
|
+
totalNumberOfApocryphalVerses: z.number().optional().meta({
|
|
150
|
+
description: "The total number of apocryphal verses that are contained in this translation."
|
|
151
|
+
}),
|
|
152
|
+
/**
|
|
153
|
+
* Gets the name of the language that the translation is in.
|
|
154
|
+
* Null or undefined if the name of the language is not known.
|
|
155
|
+
*/
|
|
156
|
+
languageName: z.string().optional().meta({
|
|
157
|
+
description: "Gets the name of the language that the translation is in. Null or undefined if the name of the language is not known."
|
|
158
|
+
}),
|
|
159
|
+
/**
|
|
160
|
+
* Gets the name of the language in English.
|
|
161
|
+
* Null or undefined if the language doesn't have an english name.
|
|
162
|
+
*/
|
|
163
|
+
languageEnglishName: z.string().optional().meta({
|
|
164
|
+
description: "Gets the name of the language in English. Null or undefined if the language doesn't have an english name."
|
|
165
|
+
}),
|
|
166
|
+
/**
|
|
167
|
+
* The API link for downloading the complete translation as a single JSON file.
|
|
168
|
+
*
|
|
169
|
+
* Undefined if complete translation files are not available.
|
|
170
|
+
*/
|
|
171
|
+
completeTranslationApiLink: z.string().optional().meta({
|
|
172
|
+
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."
|
|
173
|
+
})
|
|
174
|
+
}).meta({
|
|
175
|
+
id: "ApiTranslation",
|
|
176
|
+
description: "Defines a translation that is used in the API."
|
|
177
|
+
});
|
|
178
|
+
export const ApiTranslationCompleteSchema = z.object({
|
|
179
|
+
/**
|
|
180
|
+
* The translation metadata.
|
|
181
|
+
*/
|
|
182
|
+
translation: z.lazy(() => ApiTranslationSchema).meta({
|
|
183
|
+
description: "The translation metadata."
|
|
184
|
+
}),
|
|
185
|
+
/**
|
|
186
|
+
* The complete list of books with all their chapters.
|
|
187
|
+
*/
|
|
188
|
+
books: z.array(z.lazy(() => ApiTranslationCompleteBookSchema)).meta({
|
|
189
|
+
description: "The complete list of books with all their chapters."
|
|
190
|
+
})
|
|
191
|
+
}).meta({
|
|
192
|
+
id: "ApiTranslationComplete",
|
|
193
|
+
description: "Defines the complete translation download data. Maps to the /api/:translationId/complete.json endpoint."
|
|
194
|
+
});
|
|
195
|
+
export const ApiTranslationCompleteBookSchema = TranslationBookSchema.extend({
|
|
196
|
+
/**
|
|
197
|
+
* The number of chapters in the book.
|
|
198
|
+
*/
|
|
199
|
+
numberOfChapters: z.number().meta({
|
|
200
|
+
description: "The number of chapters in the book."
|
|
201
|
+
}),
|
|
202
|
+
/**
|
|
203
|
+
* The total number of verses in the book.
|
|
204
|
+
*/
|
|
205
|
+
totalNumberOfVerses: z.number().meta({
|
|
206
|
+
description: "The total number of verses in the book."
|
|
207
|
+
}),
|
|
208
|
+
/**
|
|
209
|
+
* The complete list of chapters with all content.
|
|
210
|
+
*/
|
|
211
|
+
chapters: z.array(TranslationBookChapterSchema).meta({
|
|
212
|
+
description: "The complete list of chapters with all content."
|
|
213
|
+
})
|
|
214
|
+
}).meta({
|
|
215
|
+
id: "ApiTranslationCompleteBook",
|
|
216
|
+
description: "A book in the complete translation download."
|
|
217
|
+
});
|
|
218
|
+
export const ApiCommentarySchema = CommentarySchema.extend({
|
|
219
|
+
/**
|
|
220
|
+
* The API link for the list of available books for this translation.
|
|
221
|
+
*/
|
|
222
|
+
listOfBooksApiLink: z.string().meta({
|
|
223
|
+
description: "The API link for the list of books for this commentary. Relative to the API origin."
|
|
224
|
+
}),
|
|
225
|
+
/**
|
|
226
|
+
* The API link for the list of available profiles for this commentary.
|
|
227
|
+
*/
|
|
228
|
+
listOfProfilesApiLink: z.string().meta({
|
|
229
|
+
description: "The API link for the list of profiles for this commentary. Relative to the API origin."
|
|
230
|
+
}),
|
|
231
|
+
/**
|
|
232
|
+
* The available list of formats.
|
|
233
|
+
*/
|
|
234
|
+
availableFormats: z.array(z.enum(["json", "usfm"])),
|
|
235
|
+
/**
|
|
236
|
+
* The number of books that are contained in this commentary.
|
|
237
|
+
*
|
|
238
|
+
* Complete commentaries should have the same number of books as the Bible (66).
|
|
239
|
+
*/
|
|
240
|
+
numberOfBooks: z.number().meta({
|
|
241
|
+
description: "The number of books that are contained in this commentary. Complete commentaries should have the same number of books as the Bible (66)."
|
|
242
|
+
}),
|
|
243
|
+
/**
|
|
244
|
+
* The total number of chapters that are contained in this translation.
|
|
245
|
+
*
|
|
246
|
+
* Complete commentaries should have the same number of chapters as the Bible (1,189).
|
|
247
|
+
*/
|
|
248
|
+
totalNumberOfChapters: z.number().meta({
|
|
249
|
+
description: "The total number of chapters that are contained in this commentary. Complete commentaries should have the same number of chapters as the Bible (1,189)."
|
|
250
|
+
}),
|
|
251
|
+
/**
|
|
252
|
+
* The total number of verses that are contained in this commentary.
|
|
253
|
+
*
|
|
254
|
+
* Complete commentaries should have the same number of verses as the Bible (around 31,102 - some commentaries exclude verses based on the aparent likelyhood of existing in the original source texts).
|
|
255
|
+
*/
|
|
256
|
+
totalNumberOfVerses: z.number().meta({
|
|
257
|
+
description: "The total number of verses that are contained in this commentary. Complete commentaries should have the same number of verses as the Bible (around 31,102 - some commentaries exclude verses based on the aparent likelyhood of existing in the original source texts)."
|
|
258
|
+
}),
|
|
259
|
+
/**
|
|
260
|
+
* The total number of profiles that are contained in this commentary.
|
|
261
|
+
*
|
|
262
|
+
* Profiles are used to provide additional information about people and people groups that are mentioned in the Bible.
|
|
263
|
+
*/
|
|
264
|
+
totalNumberOfProfiles: z.number().meta({
|
|
265
|
+
description: "The total number of profiles that are contained in this commentary. Profiles are used to provide additional information about people and people groups that are mentioned in the Bible."
|
|
266
|
+
}),
|
|
267
|
+
/**
|
|
268
|
+
* Gets the name of the language that the commentary is in.
|
|
269
|
+
* Null or undefined if the name of the language is not known.
|
|
270
|
+
*/
|
|
271
|
+
languageName: z.string().optional().meta({
|
|
272
|
+
description: "Gets the name of the language that the commentary is in. Null or undefined if the name of the language is not known."
|
|
273
|
+
}),
|
|
274
|
+
/**
|
|
275
|
+
* Gets the name of the language in English.
|
|
276
|
+
* Null or undefined if the language doesn't have an english name.
|
|
277
|
+
*/
|
|
278
|
+
languageEnglishName: z.string().optional().meta({
|
|
279
|
+
description: "Gets the name of the language in English. Null or undefined if the language doesn't have an english name."
|
|
280
|
+
})
|
|
281
|
+
}).meta({
|
|
282
|
+
id: "ApiCommentary",
|
|
283
|
+
description: "Defines a commentary that is used in the API."
|
|
284
|
+
});
|
|
285
|
+
export const ApiTranslationBooksSchema = z.object({
|
|
286
|
+
/**
|
|
287
|
+
* The translation information for the books.
|
|
288
|
+
*/
|
|
289
|
+
translation: z.lazy(() => ApiTranslationSchema).meta({
|
|
290
|
+
description: "The translation information for the books."
|
|
291
|
+
}),
|
|
292
|
+
/**
|
|
293
|
+
* The list of books that are available for the translation.
|
|
294
|
+
*/
|
|
295
|
+
books: z.array(z.lazy(() => ApiTranslationBookSchema)).meta({
|
|
296
|
+
description: "The list of books that are available for the translation."
|
|
297
|
+
})
|
|
298
|
+
}).meta({
|
|
299
|
+
id: "ApiTranslationBooks",
|
|
300
|
+
description: "Defines an interface that contains information about the books that are available for a translation."
|
|
301
|
+
});
|
|
302
|
+
export const ApiCommentaryBooksSchema = z.object({
|
|
303
|
+
/**
|
|
304
|
+
* The commentary information for the books.
|
|
305
|
+
*/
|
|
306
|
+
commentary: z.lazy(() => ApiCommentarySchema).meta({
|
|
307
|
+
description: "The commentary information for the books."
|
|
308
|
+
}),
|
|
309
|
+
/**
|
|
310
|
+
* The list of books that are available for the commentary.
|
|
311
|
+
*/
|
|
312
|
+
books: z.array(z.lazy(() => ApiCommentaryBookSchema)).meta({
|
|
313
|
+
description: "The list of books that are available for the commentary."
|
|
314
|
+
})
|
|
315
|
+
}).meta({
|
|
316
|
+
id: "ApiCommentaryBooks",
|
|
317
|
+
description: "Defines an interface that contains information about the books that are available for a commentary."
|
|
318
|
+
});
|
|
319
|
+
export const ApiDatasetBooksSchema = z.object({
|
|
320
|
+
/**
|
|
321
|
+
* The dataset information for the books.
|
|
322
|
+
*/
|
|
323
|
+
dataset: z.lazy(() => ApiDatasetSchema).meta({
|
|
324
|
+
description: "The dataset information for the books."
|
|
325
|
+
}),
|
|
326
|
+
/**
|
|
327
|
+
* The list of books that are available for the dataset.
|
|
328
|
+
*/
|
|
329
|
+
books: z.array(z.lazy(() => ApiDatasetBookSchema)).meta({
|
|
330
|
+
description: "The list of books that are available for the dataset."
|
|
331
|
+
})
|
|
332
|
+
}).meta({
|
|
333
|
+
id: "ApiDatasetBooks",
|
|
334
|
+
description: "Defines an interface that contains information about the books that are available for a dataset."
|
|
335
|
+
});
|
|
336
|
+
export const ApiCommentaryProfilesSchema = z.object({
|
|
337
|
+
/**
|
|
338
|
+
* The commentary information for the books.
|
|
339
|
+
*/
|
|
340
|
+
commentary: z.lazy(() => ApiCommentarySchema).meta({
|
|
341
|
+
description: "The commentary information for the profiles."
|
|
342
|
+
}),
|
|
343
|
+
/**
|
|
344
|
+
* The list of profiles that are available for the commentary.
|
|
345
|
+
*/
|
|
346
|
+
profiles: z.array(z.lazy(() => ApiCommentaryProfileSchema)).meta({
|
|
347
|
+
description: "The list of profiles that are available for the commentary."
|
|
348
|
+
})
|
|
349
|
+
}).meta({
|
|
350
|
+
id: "ApiCommentaryProfiles",
|
|
351
|
+
description: "Defines an interface that contains information about the profiles that are available for a commentary."
|
|
352
|
+
});
|
|
353
|
+
export const ApiCommentaryProfileSchema = CommentaryProfileSchema.extend({
|
|
354
|
+
/**
|
|
355
|
+
* The link to this profile.
|
|
356
|
+
*/
|
|
357
|
+
thisProfileLink: z.string().meta({
|
|
358
|
+
description: "The API link for this profile. Relative to the API origin."
|
|
359
|
+
}),
|
|
360
|
+
/**
|
|
361
|
+
* The link to the chapter that this profile references in the commentary.
|
|
362
|
+
*/
|
|
363
|
+
referenceChapterLink: z.string().nullable().meta({
|
|
364
|
+
description: "The API link to the chapter that this profile references in the commentary. Relative to the API origin. Null if the profile doesn't reference a specific chapter."
|
|
365
|
+
})
|
|
366
|
+
}).meta({
|
|
367
|
+
id: "ApiCommentaryProfile",
|
|
368
|
+
description: "Defines an interface that contains information about a profile."
|
|
369
|
+
});
|
|
370
|
+
export const ApiTranslationBookSchema = TranslationBookSchema.extend({
|
|
371
|
+
/**
|
|
372
|
+
* The number of the first chapter in the book.
|
|
373
|
+
*/
|
|
374
|
+
firstChapterNumber: z.number().meta({
|
|
375
|
+
description: "The number of the first chapter in the book."
|
|
376
|
+
}),
|
|
377
|
+
/**
|
|
378
|
+
* The link to the first chapter of the book.
|
|
379
|
+
*/
|
|
380
|
+
firstChapterApiLink: z.string().meta({
|
|
381
|
+
description: "The link to the first chapter of the book."
|
|
382
|
+
}),
|
|
383
|
+
/**
|
|
384
|
+
* The number of the last chapter in the book.
|
|
385
|
+
*/
|
|
386
|
+
lastChapterNumber: z.number().meta({
|
|
387
|
+
description: "The number of the last chapter in the book."
|
|
388
|
+
}),
|
|
389
|
+
/**
|
|
390
|
+
* The link to the last chapter of the book.
|
|
391
|
+
*/
|
|
392
|
+
lastChapterApiLink: z.string().meta({
|
|
393
|
+
description: "The link to the last chapter of the book."
|
|
394
|
+
}),
|
|
395
|
+
/**
|
|
396
|
+
* The number of chapters that the book contains.
|
|
397
|
+
*/
|
|
398
|
+
numberOfChapters: z.number().meta({
|
|
399
|
+
description: "The number of chapters that the book contains."
|
|
400
|
+
}),
|
|
401
|
+
/**
|
|
402
|
+
* The number of verses that the book contains.
|
|
403
|
+
*/
|
|
404
|
+
totalNumberOfVerses: z.number().meta({
|
|
405
|
+
description: "The number of verses that the book contains."
|
|
406
|
+
})
|
|
407
|
+
}).meta({
|
|
408
|
+
id: "ApiTranslationBook",
|
|
409
|
+
description: "Defines a schema that contains information about a translation book."
|
|
410
|
+
});
|
|
411
|
+
export const ApiCommentaryBookSchema = CommentaryBookSchema.extend({
|
|
412
|
+
/**
|
|
413
|
+
* The number of the first chapter in the book.
|
|
414
|
+
*
|
|
415
|
+
* Null if the comentary book has no chapters.
|
|
416
|
+
*/
|
|
417
|
+
firstChapterNumber: z.number().nullable().meta({
|
|
418
|
+
description: "The number of the first chapter in the book. Null if the comentary book has no chapters."
|
|
419
|
+
}),
|
|
420
|
+
/**
|
|
421
|
+
* The link to the first chapter of the book.
|
|
422
|
+
*
|
|
423
|
+
* Null if the comentary book has no chapters.
|
|
424
|
+
*/
|
|
425
|
+
firstChapterApiLink: z.string().nullable().meta({
|
|
426
|
+
description: "The link to the first chapter of the book. Null if the comentary book has no chapters."
|
|
427
|
+
}),
|
|
428
|
+
/**
|
|
429
|
+
* The number of the last chapter in the book.
|
|
430
|
+
*
|
|
431
|
+
* Null if the comentary book has no chapters.
|
|
432
|
+
*/
|
|
433
|
+
lastChapterNumber: z.number().nullable().meta({
|
|
434
|
+
description: "The number of the last chapter in the book. Null if the comentary book has no chapters."
|
|
435
|
+
}),
|
|
436
|
+
/**
|
|
437
|
+
* The link to the last chapter of the book.
|
|
438
|
+
*
|
|
439
|
+
* Null if the comentary book has no chapters.
|
|
440
|
+
*/
|
|
441
|
+
lastChapterApiLink: z.string().nullable().meta({
|
|
442
|
+
description: "The link to the last chapter of the book. Null if the comentary book has no chapters."
|
|
443
|
+
}),
|
|
444
|
+
/**
|
|
445
|
+
* The number of chapters that the book contains.
|
|
446
|
+
*/
|
|
447
|
+
numberOfChapters: z.number().meta({
|
|
448
|
+
description: "The number of chapters that the book contains."
|
|
449
|
+
}),
|
|
450
|
+
/**
|
|
451
|
+
* The number of verses that the book contains.
|
|
452
|
+
*/
|
|
453
|
+
totalNumberOfVerses: z.number().meta({
|
|
454
|
+
description: "The number of verses that the book contains."
|
|
455
|
+
})
|
|
456
|
+
}).meta({
|
|
457
|
+
id: "ApiCommentaryBook",
|
|
458
|
+
description: "Defines a schema that contains information about a commentary book."
|
|
459
|
+
});
|
|
460
|
+
export const ApiDatasetBookSchema = DatasetBookSchema.extend({
|
|
461
|
+
/**
|
|
462
|
+
* The number of the first chapter in the book.
|
|
463
|
+
*/
|
|
464
|
+
firstChapterNumber: z.number().meta({
|
|
465
|
+
description: "The number of the first chapter in the book."
|
|
466
|
+
}),
|
|
467
|
+
/**
|
|
468
|
+
* The link to the first chapter of the book.
|
|
469
|
+
*/
|
|
470
|
+
firstChapterApiLink: z.string().meta({
|
|
471
|
+
description: "The link to the first chapter of the book."
|
|
472
|
+
}),
|
|
473
|
+
/**
|
|
474
|
+
* The number of the last chapter in the book.
|
|
475
|
+
*/
|
|
476
|
+
lastChapterNumber: z.number().meta({
|
|
477
|
+
description: "The number of the last chapter in the book."
|
|
478
|
+
}),
|
|
479
|
+
/**
|
|
480
|
+
* The link to the last chapter of the book.
|
|
481
|
+
*/
|
|
482
|
+
lastChapterApiLink: z.string().meta({
|
|
483
|
+
description: "The link to the last chapter of the book."
|
|
484
|
+
}),
|
|
485
|
+
/**
|
|
486
|
+
* The number of chapters that the book contains.
|
|
487
|
+
*/
|
|
488
|
+
numberOfChapters: z.number().meta({
|
|
489
|
+
description: "The number of chapters that the book contains."
|
|
490
|
+
}),
|
|
491
|
+
/**
|
|
492
|
+
* The number of verses that the book contains.
|
|
493
|
+
*/
|
|
494
|
+
totalNumberOfVerses: z.number().meta({
|
|
495
|
+
description: "The number of verses that the book contains."
|
|
496
|
+
}),
|
|
497
|
+
/**
|
|
498
|
+
* The number of references that the book contains.
|
|
499
|
+
*/
|
|
500
|
+
totalNumberOfReferences: z.number().meta({
|
|
501
|
+
description: "The number of references that the book contains."
|
|
502
|
+
})
|
|
503
|
+
}).meta({
|
|
504
|
+
id: "ApiDatasetBook",
|
|
505
|
+
description: "Defines a schema that contains information about a book in a dataset."
|
|
506
|
+
});
|
|
507
|
+
export const ApiTranslationBookChapterSchema = TranslationBookChapterSchema.extend({
|
|
508
|
+
/**
|
|
509
|
+
* The translation information for the book chapter.
|
|
510
|
+
*/
|
|
511
|
+
translation: z.lazy(() => ApiTranslationSchema).meta({
|
|
512
|
+
description: "The translation information for the book chapter."
|
|
513
|
+
}),
|
|
514
|
+
/**
|
|
515
|
+
* The book information for the book chapter.
|
|
516
|
+
*/
|
|
517
|
+
book: z.lazy(() => ApiTranslationBookSchema).meta({
|
|
518
|
+
description: "The book information for the book chapter."
|
|
519
|
+
}),
|
|
520
|
+
/**
|
|
521
|
+
* The link to this chapter.
|
|
522
|
+
*/
|
|
523
|
+
thisChapterLink: z.string().meta({
|
|
524
|
+
description: "The API link for this chapter. Relative to the API origin."
|
|
525
|
+
}),
|
|
526
|
+
/**
|
|
527
|
+
* The link to the next chapter.
|
|
528
|
+
* Null if this is the last chapter in the translation.
|
|
529
|
+
*/
|
|
530
|
+
nextChapterApiLink: z.string().nullable().meta({
|
|
531
|
+
description: "The API link to the next chapter. Relative to the API origin. Null if this is the last chapter in the translation."
|
|
532
|
+
}),
|
|
533
|
+
/**
|
|
534
|
+
* The links to the audio versions for the next chapter.
|
|
535
|
+
* Null if this is the last chapter in the translation.
|
|
536
|
+
*/
|
|
537
|
+
nextChapterAudioLinks: z.record(z.string(), z.string()).nullable().meta({
|
|
538
|
+
description: "The links to the audio versions for the next chapter. Relative to the API origin. Null if this is the last chapter in the translation."
|
|
539
|
+
}),
|
|
540
|
+
/**
|
|
541
|
+
* The link to the previous chapter.
|
|
542
|
+
* Null if this is the first chapter in the translation.
|
|
543
|
+
*/
|
|
544
|
+
previousChapterApiLink: z.string().nullable().meta({
|
|
545
|
+
description: "The API link to the previous chapter. Relative to the API origin. Null if this is the first chapter in the translation."
|
|
546
|
+
}),
|
|
547
|
+
/**
|
|
548
|
+
* The links to the audio versions for the previous chapter.
|
|
549
|
+
* Null if this is the first chapter in the translation.
|
|
550
|
+
*/
|
|
551
|
+
previousChapterAudioLinks: z.record(z.string(), z.string()).nullable().meta({
|
|
552
|
+
description: "The links to the audio versions for the previous chapter. Relative to the API origin. Null if this is the first chapter in the translation."
|
|
553
|
+
}),
|
|
554
|
+
/**
|
|
555
|
+
* The number of verses that the chapter contains.
|
|
556
|
+
*/
|
|
557
|
+
numberOfVerses: z.number().meta({
|
|
558
|
+
description: "The number of verses that the chapter contains."
|
|
559
|
+
})
|
|
560
|
+
}).meta({
|
|
561
|
+
id: "ApiTranslationBookChapter",
|
|
562
|
+
description: "Defines an interface that contains information about a book chapter in a translation."
|
|
563
|
+
});
|
|
564
|
+
export const ApiCommentaryBookChapterSchema = CommentaryBookChapterSchema.extend({
|
|
565
|
+
/**
|
|
566
|
+
* The commentary information for the book chapter.
|
|
567
|
+
*/
|
|
568
|
+
commentary: z.lazy(() => ApiCommentarySchema).meta({
|
|
569
|
+
description: "The commentary information for the book chapter."
|
|
570
|
+
}),
|
|
571
|
+
/**
|
|
572
|
+
* The book information for the book chapter.
|
|
573
|
+
*/
|
|
574
|
+
book: z.lazy(() => ApiCommentaryBookSchema).meta({
|
|
575
|
+
description: "The book information for the book chapter."
|
|
576
|
+
}),
|
|
577
|
+
/**
|
|
578
|
+
* The link to this chapter.
|
|
579
|
+
*/
|
|
580
|
+
thisChapterLink: z.string().meta({
|
|
581
|
+
description: "The API link for this chapter. Relative to the API origin."
|
|
582
|
+
}),
|
|
583
|
+
/**
|
|
584
|
+
* The link to the next chapter.
|
|
585
|
+
* Null if this is the last chapter in the translation.
|
|
586
|
+
*/
|
|
587
|
+
nextChapterApiLink: z.string().nullable().meta({
|
|
588
|
+
description: "The API link to the next chapter. Relative to the API origin. Null if this is the last chapter in the commentary."
|
|
589
|
+
}),
|
|
590
|
+
/**
|
|
591
|
+
* The link to the previous chapter.
|
|
592
|
+
* Null if this is the first chapter in the translation.
|
|
593
|
+
*/
|
|
594
|
+
previousChapterApiLink: z.string().nullable().meta({
|
|
595
|
+
description: "The API link to the previous chapter. Relative to the API origin. Null if this is the first chapter in the commentary."
|
|
596
|
+
}),
|
|
597
|
+
/**
|
|
598
|
+
* The number of verses that the chapter contains.
|
|
599
|
+
*/
|
|
600
|
+
numberOfVerses: z.number().meta({
|
|
601
|
+
description: "The number of verses that the chapter contains."
|
|
602
|
+
})
|
|
603
|
+
}).meta({
|
|
604
|
+
id: "ApiCommentaryBookChapter",
|
|
605
|
+
description: "Defines a schema that contains information about a book chapter in a commentary."
|
|
606
|
+
});
|
|
607
|
+
export const ApiDatasetBookChapterSchema = DatasetBookChapterSchema.extend({
|
|
608
|
+
/**
|
|
609
|
+
* The dataset information for the book chapter.
|
|
610
|
+
*/
|
|
611
|
+
dataset: z.lazy(() => ApiDatasetSchema).meta({
|
|
612
|
+
description: "The dataset information for the book chapter."
|
|
613
|
+
}),
|
|
614
|
+
/**
|
|
615
|
+
* The book information for the book chapter.
|
|
616
|
+
*/
|
|
617
|
+
book: z.lazy(() => ApiDatasetBookSchema).meta({
|
|
618
|
+
description: "The book information for the book chapter."
|
|
619
|
+
}),
|
|
620
|
+
/**
|
|
621
|
+
* The link to this chapter.
|
|
622
|
+
*/
|
|
623
|
+
thisChapterLink: z.string().meta({
|
|
624
|
+
description: "The API link for this chapter. Relative to the API origin."
|
|
625
|
+
}),
|
|
626
|
+
/**
|
|
627
|
+
* The link to the next chapter.
|
|
628
|
+
* Null if this is the last chapter in the translation.
|
|
629
|
+
*/
|
|
630
|
+
nextChapterApiLink: z.string().nullable().meta({
|
|
631
|
+
description: "The API link to the next chapter. Relative to the API origin. Null if this is the last chapter in the dataset."
|
|
632
|
+
}),
|
|
633
|
+
/**
|
|
634
|
+
* The link to the previous chapter.
|
|
635
|
+
* Null if this is the first chapter in the translation.
|
|
636
|
+
*/
|
|
637
|
+
previousChapterApiLink: z.string().nullable().meta({
|
|
638
|
+
description: "The API link to the previous chapter. Relative to the API origin. Null if this is the first chapter in the dataset."
|
|
639
|
+
}),
|
|
640
|
+
/**
|
|
641
|
+
* The number of verses that the chapter contains.
|
|
642
|
+
*/
|
|
643
|
+
numberOfVerses: z.number().meta({
|
|
644
|
+
description: "The number of verses that the chapter contains."
|
|
645
|
+
}),
|
|
646
|
+
/**
|
|
647
|
+
* The number of references that the chapter contains.
|
|
648
|
+
*/
|
|
649
|
+
numberOfReferences: z.number().meta({
|
|
650
|
+
description: "The number of references that the chapter contains."
|
|
651
|
+
})
|
|
652
|
+
}).meta({
|
|
653
|
+
id: "ApiDatasetBookChapter",
|
|
654
|
+
description: "Defines a schema that contains information about a book chapter in a dataset."
|
|
655
|
+
});
|
|
656
|
+
export const ApiTranslationBookChapterAudioSchema = z.object({
|
|
657
|
+
/**
|
|
658
|
+
* The chapter that the audio is for.
|
|
659
|
+
*/
|
|
660
|
+
chapter: z.lazy(() => ApiTranslationBookChapterSchema).meta({
|
|
661
|
+
description: "The chapter that the audio is for."
|
|
662
|
+
}),
|
|
663
|
+
/**
|
|
664
|
+
* The link that the audio should be placed at.
|
|
665
|
+
*/
|
|
666
|
+
link: z.string().meta({
|
|
667
|
+
description: "The link that the audio should be placed at. Relative to the API origin."
|
|
668
|
+
}),
|
|
669
|
+
/**
|
|
670
|
+
* The original URL of the audio.
|
|
671
|
+
*/
|
|
672
|
+
originalUrl: z.string().meta({
|
|
673
|
+
description: "The original URL of the audio."
|
|
674
|
+
})
|
|
675
|
+
});
|
|
676
|
+
export const ApiCommentaryProfileContentSchema = z.object({
|
|
677
|
+
/**
|
|
678
|
+
* The commentary information for the profile.
|
|
679
|
+
*/
|
|
680
|
+
commentary: z.lazy(() => ApiCommentarySchema).meta({
|
|
681
|
+
description: "The commentary information for the profile."
|
|
682
|
+
}),
|
|
683
|
+
/**
|
|
684
|
+
* The information about the profile.
|
|
685
|
+
*/
|
|
686
|
+
profile: z.lazy(() => ApiCommentaryProfileSchema).meta({
|
|
687
|
+
description: "The information about the profile."
|
|
688
|
+
}),
|
|
689
|
+
/**
|
|
690
|
+
* The content of the profile.
|
|
691
|
+
*/
|
|
692
|
+
content: z.array(z.string()).meta({
|
|
693
|
+
description: "The content of the profile. This is an array of strings, where each string is a paragraph of the profile content."
|
|
694
|
+
})
|
|
695
|
+
});
|
|
2
696
|
export function generateApiForDataset(dataset, options = {}) {
|
|
3
697
|
const { useCommonName, pathPrefix } = options;
|
|
4
698
|
const apiPathPrefix = pathPrefix ? pathPrefix : "";
|
|
@@ -54,8 +748,8 @@ export function generateApiForDataset(dataset, options = {}) {
|
|
|
54
748
|
};
|
|
55
749
|
let translationChapters = [];
|
|
56
750
|
for (let { chapters, ...book } of books) {
|
|
57
|
-
const firstChapterNumber = chapters[0]
|
|
58
|
-
const lastChapterNumber = chapters[chapters.length - 1]
|
|
751
|
+
const firstChapterNumber = chapters[0]?.chapter.number;
|
|
752
|
+
const lastChapterNumber = chapters[chapters.length - 1]?.chapter.number;
|
|
59
753
|
const apiBook = {
|
|
60
754
|
...book,
|
|
61
755
|
firstChapterNumber,
|