@youversion/platform-core 1.0.1 → 1.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/.turbo/turbo-build.log +8 -8
- package/CHANGELOG.md +19 -0
- package/dist/index.cjs +6 -2
- package/dist/index.d.cts +39 -24
- package/dist/index.d.ts +39 -24
- package/dist/index.js +6 -2
- package/package.json +1 -1
- package/src/__tests__/MockBibles.ts +14 -25
- package/src/__tests__/bible.test.ts +11 -0
- package/src/bible.ts +6 -2
- package/src/schemas/bible-index.ts +4 -4
- package/src/schemas/book.ts +15 -3
- package/src/schemas/chapter.ts +1 -1
- package/src/schemas/collection.ts +2 -2
- package/src/schemas/language.ts +1 -1
- package/src/schemas/passage.ts +1 -1
- package/src/schemas/verse.ts +1 -1
- package/src/schemas/version.ts +1 -1
- package/src/schemas/votd.ts +1 -1
- package/src/types/auth.ts +6 -6
- package/src/types/index.ts +1 -1
- package/src/types/book.ts +0 -116
- package/src/types/chapter.ts +0 -5
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
> @youversion/platform-core@1.0
|
|
2
|
+
> @youversion/platform-core@1.2.0 build /home/runner/work/platform-sdk-react/platform-sdk-react/packages/core
|
|
3
3
|
> tsup src/index.ts --format cjs,esm --dts
|
|
4
4
|
|
|
5
5
|
[34mCLI[39m Building entry: src/index.ts
|
|
@@ -8,11 +8,11 @@
|
|
|
8
8
|
[34mCLI[39m Target: es2022
|
|
9
9
|
[34mCJS[39m Build start
|
|
10
10
|
[34mESM[39m Build start
|
|
11
|
-
[
|
|
12
|
-
[
|
|
13
|
-
[
|
|
14
|
-
[
|
|
11
|
+
[32mCJS[39m [1mdist/index.cjs [22m[32m42.87 KB[39m
|
|
12
|
+
[32mCJS[39m ⚡️ Build success in 31ms
|
|
13
|
+
[32mESM[39m [1mdist/index.js [22m[32m41.06 KB[39m
|
|
14
|
+
[32mESM[39m ⚡️ Build success in 32ms
|
|
15
15
|
[34mDTS[39m Build start
|
|
16
|
-
[32mDTS[39m ⚡️ Build success in
|
|
17
|
-
[32mDTS[39m [1mdist/index.d.cts [22m[
|
|
18
|
-
[32mDTS[39m [1mdist/index.d.ts [22m[
|
|
16
|
+
[32mDTS[39m ⚡️ Build success in 1751ms
|
|
17
|
+
[32mDTS[39m [1mdist/index.d.cts [22m[32m32.80 KB[39m
|
|
18
|
+
[32mDTS[39m [1mdist/index.d.ts [22m[32m32.80 KB[39m
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,24 @@
|
|
|
1
1
|
# @youversion/platform-core
|
|
2
2
|
|
|
3
|
+
## 1.2.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- a8a5dd7: feat: Add intro metadata to BibleBook
|
|
8
|
+
- Added optional `intro` field to BibleBook schema for retrieving book introduction metadata
|
|
9
|
+
- The intro field includes `id`, `passage_id`, and `title` properties when available
|
|
10
|
+
- Simplified type definitions by removing duplicate type files and using Zod schemas as single source of truth
|
|
11
|
+
- Updated Bible mocks and tests to cover the new intro field
|
|
12
|
+
|
|
13
|
+
## 1.1.0
|
|
14
|
+
|
|
15
|
+
### Minor Changes
|
|
16
|
+
|
|
17
|
+
- efb1030: feat(core): make data objects that should be immutable readonly
|
|
18
|
+
- changed data types that come from api responses and should not
|
|
19
|
+
be mutated to be readonly.
|
|
20
|
+
- See the documentation on these types, https://developers.youversion.com/sdks/react#referenced-types
|
|
21
|
+
|
|
3
22
|
## 1.0.1
|
|
4
23
|
|
|
5
24
|
### Patch Changes
|
package/dist/index.cjs
CHANGED
|
@@ -232,7 +232,9 @@ var BibleClient = class {
|
|
|
232
232
|
* Fetches all books for a given Bible version.
|
|
233
233
|
* @param versionId The version ID.
|
|
234
234
|
* @param canon Optional canon filter ("old_testament", 'new_testament', 'deuterocanon').
|
|
235
|
-
* @returns An array of BibleBook objects.
|
|
235
|
+
* @returns An array of BibleBook objects. Each book may include an optional `intro` field
|
|
236
|
+
* containing metadata (id, passage_id, title) for the book's introduction when
|
|
237
|
+
* available in the Bible version.
|
|
236
238
|
*/
|
|
237
239
|
async getBooks(versionId, canon) {
|
|
238
240
|
this.versionIdSchema.parse(versionId);
|
|
@@ -244,7 +246,9 @@ var BibleClient = class {
|
|
|
244
246
|
* Fetches a specific book by USFM code for a given version.
|
|
245
247
|
* @param versionId The version ID.
|
|
246
248
|
* @param book The Book Identifier code of the book.
|
|
247
|
-
* @returns The requested BibleBook object
|
|
249
|
+
* @returns The requested BibleBook object, which may include an optional `intro` field
|
|
250
|
+
* containing metadata (id, passage_id, title) for the book's introduction when
|
|
251
|
+
* available. Use the `passage_id` with `getPassage()` to fetch intro content.
|
|
248
252
|
*/
|
|
249
253
|
async getBook(versionId, book) {
|
|
250
254
|
this.versionIdSchema.parse(versionId);
|
package/dist/index.d.cts
CHANGED
|
@@ -15,14 +15,20 @@ declare const BibleVersionSchema: z.ZodObject<{
|
|
|
15
15
|
books: z.ZodArray<z.ZodUnion<readonly [...z.ZodLiteral<"GEN" | "EXO" | "LEV" | "NUM" | "DEU" | "JOS" | "JDG" | "RUT" | "1SA" | "2SA" | "1KI" | "2KI" | "1CH" | "2CH" | "EZR" | "NEH" | "EST" | "JOB" | "PSA" | "PRO" | "ECC" | "SNG" | "ISA" | "JER" | "LAM" | "EZK" | "DAN" | "HOS" | "JOL" | "AMO" | "OBA" | "JON" | "MIC" | "NAM" | "HAB" | "ZEP" | "HAG" | "ZEC" | "MAL" | "MAT" | "MRK" | "LUK" | "JHN" | "ACT" | "ROM" | "1CO" | "2CO" | "GAL" | "EPH" | "PHP" | "COL" | "1TH" | "2TH" | "1TI" | "2TI" | "TIT" | "PHM" | "HEB" | "JAS" | "1PE" | "2PE" | "1JN" | "2JN" | "3JN" | "JUD" | "REV" | "TOB" | "JDT" | "ESG" | "WIS" | "SIR" | "BAR" | "LJE" | "S3Y" | "SUS" | "BEL" | "1MA" | "2MA" | "3MA" | "4MA" | "1ES" | "2ES" | "MAN" | "PS2" | "ODA" | "PSS" | "3ES" | "EZA" | "5EZ" | "6EZ" | "DAG" | "PS3" | "2BA" | "LBA" | "JUB" | "ENO" | "1MQ" | "2MQ" | "3MQ" | "REP" | "4BA" | "LAO" | "LKA">[], z.ZodType<string & {}, unknown, z.core.$ZodTypeInternals<string & {}, unknown>>]>>;
|
|
16
16
|
youversion_deep_link: z.ZodURL;
|
|
17
17
|
}, z.core.$strip>;
|
|
18
|
-
type BibleVersion = z.infer<typeof BibleVersionSchema
|
|
18
|
+
type BibleVersion = Readonly<z.infer<typeof BibleVersionSchema>>;
|
|
19
19
|
|
|
20
20
|
declare const CanonSchema: z.ZodEnum<{
|
|
21
21
|
old_testament: "old_testament";
|
|
22
22
|
new_testament: "new_testament";
|
|
23
23
|
deuterocanon: "deuterocanon";
|
|
24
24
|
}>;
|
|
25
|
-
type Canon = z.infer<typeof CanonSchema
|
|
25
|
+
type Canon = Readonly<z.infer<typeof CanonSchema>>;
|
|
26
|
+
declare const BibleBookIntroSchema: z.ZodObject<{
|
|
27
|
+
id: z.ZodString;
|
|
28
|
+
passage_id: z.ZodString;
|
|
29
|
+
title: z.ZodString;
|
|
30
|
+
}, z.core.$strip>;
|
|
31
|
+
type BibleBookIntro = Readonly<z.infer<typeof BibleBookIntroSchema>>;
|
|
26
32
|
declare const BookUsfmSchema: z.ZodUnion<readonly [...z.ZodLiteral<"GEN" | "EXO" | "LEV" | "NUM" | "DEU" | "JOS" | "JDG" | "RUT" | "1SA" | "2SA" | "1KI" | "2KI" | "1CH" | "2CH" | "EZR" | "NEH" | "EST" | "JOB" | "PSA" | "PRO" | "ECC" | "SNG" | "ISA" | "JER" | "LAM" | "EZK" | "DAN" | "HOS" | "JOL" | "AMO" | "OBA" | "JON" | "MIC" | "NAM" | "HAB" | "ZEP" | "HAG" | "ZEC" | "MAL" | "MAT" | "MRK" | "LUK" | "JHN" | "ACT" | "ROM" | "1CO" | "2CO" | "GAL" | "EPH" | "PHP" | "COL" | "1TH" | "2TH" | "1TI" | "2TI" | "TIT" | "PHM" | "HEB" | "JAS" | "1PE" | "2PE" | "1JN" | "2JN" | "3JN" | "JUD" | "REV" | "TOB" | "JDT" | "ESG" | "WIS" | "SIR" | "BAR" | "LJE" | "S3Y" | "SUS" | "BEL" | "1MA" | "2MA" | "3MA" | "4MA" | "1ES" | "2ES" | "MAN" | "PS2" | "ODA" | "PSS" | "3ES" | "EZA" | "5EZ" | "6EZ" | "DAG" | "PS3" | "2BA" | "LBA" | "JUB" | "ENO" | "1MQ" | "2MQ" | "3MQ" | "REP" | "4BA" | "LAO" | "LKA">[], z.ZodType<string & {}, unknown, z.core.$ZodTypeInternals<string & {}, unknown>>]>;
|
|
27
33
|
type BookUsfm = z.infer<typeof BookUsfmSchema>;
|
|
28
34
|
declare const BibleBookSchema: z.ZodObject<{
|
|
@@ -35,6 +41,11 @@ declare const BibleBookSchema: z.ZodObject<{
|
|
|
35
41
|
new_testament: "new_testament";
|
|
36
42
|
deuterocanon: "deuterocanon";
|
|
37
43
|
}>;
|
|
44
|
+
intro: z.ZodOptional<z.ZodObject<{
|
|
45
|
+
id: z.ZodString;
|
|
46
|
+
passage_id: z.ZodString;
|
|
47
|
+
title: z.ZodString;
|
|
48
|
+
}, z.core.$strip>>;
|
|
38
49
|
chapters: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
39
50
|
id: z.ZodString;
|
|
40
51
|
passage_id: z.ZodString;
|
|
@@ -46,8 +57,8 @@ declare const BibleBookSchema: z.ZodObject<{
|
|
|
46
57
|
}, z.core.$strip>>>;
|
|
47
58
|
}, z.core.$strip>>>;
|
|
48
59
|
}, z.core.$strip>;
|
|
49
|
-
type BibleBook = z.infer<typeof BibleBookSchema
|
|
50
|
-
type CANON = z.infer<typeof CanonSchema
|
|
60
|
+
type BibleBook = Readonly<z.infer<typeof BibleBookSchema>>;
|
|
61
|
+
type CANON = Readonly<z.infer<typeof CanonSchema>>;
|
|
51
62
|
|
|
52
63
|
declare const BibleChapterSchema: z.ZodObject<{
|
|
53
64
|
id: z.ZodString;
|
|
@@ -59,33 +70,33 @@ declare const BibleChapterSchema: z.ZodObject<{
|
|
|
59
70
|
title: z.ZodString;
|
|
60
71
|
}, z.core.$strip>>>;
|
|
61
72
|
}, z.core.$strip>;
|
|
62
|
-
type BibleChapter = z.infer<typeof BibleChapterSchema
|
|
73
|
+
type BibleChapter = Readonly<z.infer<typeof BibleChapterSchema>>;
|
|
63
74
|
|
|
64
75
|
declare const BibleVerseSchema: z.ZodObject<{
|
|
65
76
|
id: z.ZodString;
|
|
66
77
|
passage_id: z.ZodString;
|
|
67
78
|
title: z.ZodString;
|
|
68
79
|
}, z.core.$strip>;
|
|
69
|
-
type BibleVerse = z.infer<typeof BibleVerseSchema
|
|
80
|
+
type BibleVerse = Readonly<z.infer<typeof BibleVerseSchema>>;
|
|
70
81
|
|
|
71
82
|
declare const BiblePassageSchema: z.ZodObject<{
|
|
72
83
|
id: z.ZodString;
|
|
73
84
|
content: z.ZodString;
|
|
74
85
|
reference: z.ZodString;
|
|
75
86
|
}, z.core.$strip>;
|
|
76
|
-
type BiblePassage = z.infer<typeof BiblePassageSchema
|
|
87
|
+
type BiblePassage = Readonly<z.infer<typeof BiblePassageSchema>>;
|
|
77
88
|
|
|
78
89
|
declare const VOTDSchema: z.ZodObject<{
|
|
79
90
|
day: z.ZodNumber;
|
|
80
91
|
passage_id: z.ZodString;
|
|
81
92
|
}, z.core.$strip>;
|
|
82
|
-
type VOTD = z.infer<typeof VOTDSchema
|
|
93
|
+
type VOTD = Readonly<z.infer<typeof VOTDSchema>>;
|
|
83
94
|
|
|
84
95
|
declare const BibleIndexVerseSchema: z.ZodObject<{
|
|
85
96
|
id: z.ZodString;
|
|
86
97
|
title: z.ZodString;
|
|
87
98
|
}, z.core.$strip>;
|
|
88
|
-
type BibleIndexVerse = z.infer<typeof BibleIndexVerseSchema
|
|
99
|
+
type BibleIndexVerse = Readonly<z.infer<typeof BibleIndexVerseSchema>>;
|
|
89
100
|
declare const BibleIndexChapterSchema: z.ZodObject<{
|
|
90
101
|
id: z.ZodString;
|
|
91
102
|
title: z.ZodString;
|
|
@@ -94,7 +105,7 @@ declare const BibleIndexChapterSchema: z.ZodObject<{
|
|
|
94
105
|
title: z.ZodString;
|
|
95
106
|
}, z.core.$strip>>;
|
|
96
107
|
}, z.core.$strip>;
|
|
97
|
-
type BibleIndexChapter = z.infer<typeof BibleIndexChapterSchema
|
|
108
|
+
type BibleIndexChapter = Readonly<z.infer<typeof BibleIndexChapterSchema>>;
|
|
98
109
|
declare const BibleIndexBookSchema: z.ZodObject<{
|
|
99
110
|
id: z.ZodUnion<readonly [...z.ZodLiteral<"GEN" | "EXO" | "LEV" | "NUM" | "DEU" | "JOS" | "JDG" | "RUT" | "1SA" | "2SA" | "1KI" | "2KI" | "1CH" | "2CH" | "EZR" | "NEH" | "EST" | "JOB" | "PSA" | "PRO" | "ECC" | "SNG" | "ISA" | "JER" | "LAM" | "EZK" | "DAN" | "HOS" | "JOL" | "AMO" | "OBA" | "JON" | "MIC" | "NAM" | "HAB" | "ZEP" | "HAG" | "ZEC" | "MAL" | "MAT" | "MRK" | "LUK" | "JHN" | "ACT" | "ROM" | "1CO" | "2CO" | "GAL" | "EPH" | "PHP" | "COL" | "1TH" | "2TH" | "1TI" | "2TI" | "TIT" | "PHM" | "HEB" | "JAS" | "1PE" | "2PE" | "1JN" | "2JN" | "3JN" | "JUD" | "REV" | "TOB" | "JDT" | "ESG" | "WIS" | "SIR" | "BAR" | "LJE" | "S3Y" | "SUS" | "BEL" | "1MA" | "2MA" | "3MA" | "4MA" | "1ES" | "2ES" | "MAN" | "PS2" | "ODA" | "PSS" | "3ES" | "EZA" | "5EZ" | "6EZ" | "DAG" | "PS3" | "2BA" | "LBA" | "JUB" | "ENO" | "1MQ" | "2MQ" | "3MQ" | "REP" | "4BA" | "LAO" | "LKA">[], z.ZodType<string & {}, unknown, z.core.$ZodTypeInternals<string & {}, unknown>>]>;
|
|
100
111
|
title: z.ZodString;
|
|
@@ -114,7 +125,7 @@ declare const BibleIndexBookSchema: z.ZodObject<{
|
|
|
114
125
|
}, z.core.$strip>>;
|
|
115
126
|
}, z.core.$strip>>;
|
|
116
127
|
}, z.core.$strip>;
|
|
117
|
-
type BibleIndexBook = z.infer<typeof BibleIndexBookSchema
|
|
128
|
+
type BibleIndexBook = Readonly<z.infer<typeof BibleIndexBookSchema>>;
|
|
118
129
|
declare const _BibleIndexSchema: z.ZodObject<{
|
|
119
130
|
text_direction: z.ZodString;
|
|
120
131
|
books: z.ZodArray<z.ZodObject<{
|
|
@@ -137,7 +148,7 @@ declare const _BibleIndexSchema: z.ZodObject<{
|
|
|
137
148
|
}, z.core.$strip>>;
|
|
138
149
|
}, z.core.$strip>>;
|
|
139
150
|
}, z.core.$strip>;
|
|
140
|
-
type BibleIndex = z.infer<typeof _BibleIndexSchema
|
|
151
|
+
type BibleIndex = Readonly<z.infer<typeof _BibleIndexSchema>>;
|
|
141
152
|
|
|
142
153
|
declare const LanguageSchema: z.ZodObject<{
|
|
143
154
|
id: z.ZodString;
|
|
@@ -157,7 +168,7 @@ declare const LanguageSchema: z.ZodObject<{
|
|
|
157
168
|
speaking_population: z.ZodOptional<z.ZodNumber>;
|
|
158
169
|
default_bible_version_id: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
159
170
|
}, z.core.$strip>;
|
|
160
|
-
type Language = z.infer<typeof LanguageSchema
|
|
171
|
+
type Language = Readonly<z.infer<typeof LanguageSchema>>;
|
|
161
172
|
|
|
162
173
|
declare const _UserSchema: z.ZodObject<{
|
|
163
174
|
avatar_url: z.ZodString;
|
|
@@ -183,11 +194,11 @@ type CreateHighlight = z.infer<typeof _CreateHighlightSchema>;
|
|
|
183
194
|
/**
|
|
184
195
|
* Generic Collection type for paginated responses
|
|
185
196
|
*/
|
|
186
|
-
type Collection<T> = {
|
|
197
|
+
type Collection<T> = Readonly<{
|
|
187
198
|
data: T[];
|
|
188
199
|
next_page_token: string | null;
|
|
189
200
|
total_size?: number;
|
|
190
|
-
}
|
|
201
|
+
}>;
|
|
191
202
|
|
|
192
203
|
interface ApiConfig {
|
|
193
204
|
apiHost?: string;
|
|
@@ -228,12 +239,12 @@ declare class SignInWithYouVersionResult {
|
|
|
228
239
|
|
|
229
240
|
type SignInWithYouVersionPermissionValues = (typeof SignInWithYouVersionPermission)[keyof typeof SignInWithYouVersionPermission];
|
|
230
241
|
interface AuthenticationState {
|
|
231
|
-
isAuthenticated: boolean;
|
|
232
|
-
isLoading: boolean;
|
|
233
|
-
accessToken: string | null;
|
|
234
|
-
idToken: string | null;
|
|
235
|
-
result: SignInWithYouVersionResult | null;
|
|
236
|
-
error: Error | null;
|
|
242
|
+
readonly isAuthenticated: boolean;
|
|
243
|
+
readonly isLoading: boolean;
|
|
244
|
+
readonly accessToken: string | null;
|
|
245
|
+
readonly idToken: string | null;
|
|
246
|
+
readonly result: SignInWithYouVersionResult | null;
|
|
247
|
+
readonly error: Error | null;
|
|
237
248
|
}
|
|
238
249
|
type AuthenticationScopes = 'profile' | 'email';
|
|
239
250
|
|
|
@@ -337,14 +348,18 @@ declare class BibleClient {
|
|
|
337
348
|
* Fetches all books for a given Bible version.
|
|
338
349
|
* @param versionId The version ID.
|
|
339
350
|
* @param canon Optional canon filter ("old_testament", 'new_testament', 'deuterocanon').
|
|
340
|
-
* @returns An array of BibleBook objects.
|
|
351
|
+
* @returns An array of BibleBook objects. Each book may include an optional `intro` field
|
|
352
|
+
* containing metadata (id, passage_id, title) for the book's introduction when
|
|
353
|
+
* available in the Bible version.
|
|
341
354
|
*/
|
|
342
355
|
getBooks(versionId: number, canon?: CANON): Promise<Collection<BibleBook>>;
|
|
343
356
|
/**
|
|
344
357
|
* Fetches a specific book by USFM code for a given version.
|
|
345
358
|
* @param versionId The version ID.
|
|
346
359
|
* @param book The Book Identifier code of the book.
|
|
347
|
-
* @returns The requested BibleBook object
|
|
360
|
+
* @returns The requested BibleBook object, which may include an optional `intro` field
|
|
361
|
+
* containing metadata (id, passage_id, title) for the book's introduction when
|
|
362
|
+
* available. Use the `passage_id` with `getPassage()` to fetch intro content.
|
|
348
363
|
*/
|
|
349
364
|
getBook(versionId: number, book: string): Promise<BibleBook>;
|
|
350
365
|
/**
|
|
@@ -706,4 +721,4 @@ declare const BOOK_IDS: readonly ["GEN", "EXO", "LEV", "NUM", "DEU", "JOS", "JDG
|
|
|
706
721
|
*/
|
|
707
722
|
declare const BOOK_CANON: Record<BookUsfm, Canon>;
|
|
708
723
|
|
|
709
|
-
export { ApiClient, type ApiConfig, type AuthenticationScopes, type AuthenticationState, BOOK_CANON, BOOK_IDS, type BibleBook, type BibleChapter, BibleClient, type BibleIndex, type BibleIndexBook, type BibleIndexChapter, type BibleIndexVerse, type BiblePassage, type BibleVerse, type BibleVersion, type CANON, type Collection, type CreateHighlight, type DeleteHighlightOptions, type GetHighlightsOptions, type GetLanguagesOptions, type Highlight, type HighlightColor, HighlightsClient, type Language, LanguagesClient, MemoryStorageStrategy, SessionStorageStrategy, SignInWithYouVersionPermission, type SignInWithYouVersionPermissionValues, SignInWithYouVersionResult, type StorageStrategy, type User, type VOTD, YouVersionAPI, YouVersionAPIUsers, YouVersionPlatformConfiguration, YouVersionUserInfo, type YouVersionUserInfoJSON };
|
|
724
|
+
export { ApiClient, type ApiConfig, type AuthenticationScopes, type AuthenticationState, BOOK_CANON, BOOK_IDS, type BibleBook, type BibleBookIntro, type BibleChapter, BibleClient, type BibleIndex, type BibleIndexBook, type BibleIndexChapter, type BibleIndexVerse, type BiblePassage, type BibleVerse, type BibleVersion, type CANON, type Collection, type CreateHighlight, type DeleteHighlightOptions, type GetHighlightsOptions, type GetLanguagesOptions, type Highlight, type HighlightColor, HighlightsClient, type Language, LanguagesClient, MemoryStorageStrategy, SessionStorageStrategy, SignInWithYouVersionPermission, type SignInWithYouVersionPermissionValues, SignInWithYouVersionResult, type StorageStrategy, type User, type VOTD, YouVersionAPI, YouVersionAPIUsers, YouVersionPlatformConfiguration, YouVersionUserInfo, type YouVersionUserInfoJSON };
|
package/dist/index.d.ts
CHANGED
|
@@ -15,14 +15,20 @@ declare const BibleVersionSchema: z.ZodObject<{
|
|
|
15
15
|
books: z.ZodArray<z.ZodUnion<readonly [...z.ZodLiteral<"GEN" | "EXO" | "LEV" | "NUM" | "DEU" | "JOS" | "JDG" | "RUT" | "1SA" | "2SA" | "1KI" | "2KI" | "1CH" | "2CH" | "EZR" | "NEH" | "EST" | "JOB" | "PSA" | "PRO" | "ECC" | "SNG" | "ISA" | "JER" | "LAM" | "EZK" | "DAN" | "HOS" | "JOL" | "AMO" | "OBA" | "JON" | "MIC" | "NAM" | "HAB" | "ZEP" | "HAG" | "ZEC" | "MAL" | "MAT" | "MRK" | "LUK" | "JHN" | "ACT" | "ROM" | "1CO" | "2CO" | "GAL" | "EPH" | "PHP" | "COL" | "1TH" | "2TH" | "1TI" | "2TI" | "TIT" | "PHM" | "HEB" | "JAS" | "1PE" | "2PE" | "1JN" | "2JN" | "3JN" | "JUD" | "REV" | "TOB" | "JDT" | "ESG" | "WIS" | "SIR" | "BAR" | "LJE" | "S3Y" | "SUS" | "BEL" | "1MA" | "2MA" | "3MA" | "4MA" | "1ES" | "2ES" | "MAN" | "PS2" | "ODA" | "PSS" | "3ES" | "EZA" | "5EZ" | "6EZ" | "DAG" | "PS3" | "2BA" | "LBA" | "JUB" | "ENO" | "1MQ" | "2MQ" | "3MQ" | "REP" | "4BA" | "LAO" | "LKA">[], z.ZodType<string & {}, unknown, z.core.$ZodTypeInternals<string & {}, unknown>>]>>;
|
|
16
16
|
youversion_deep_link: z.ZodURL;
|
|
17
17
|
}, z.core.$strip>;
|
|
18
|
-
type BibleVersion = z.infer<typeof BibleVersionSchema
|
|
18
|
+
type BibleVersion = Readonly<z.infer<typeof BibleVersionSchema>>;
|
|
19
19
|
|
|
20
20
|
declare const CanonSchema: z.ZodEnum<{
|
|
21
21
|
old_testament: "old_testament";
|
|
22
22
|
new_testament: "new_testament";
|
|
23
23
|
deuterocanon: "deuterocanon";
|
|
24
24
|
}>;
|
|
25
|
-
type Canon = z.infer<typeof CanonSchema
|
|
25
|
+
type Canon = Readonly<z.infer<typeof CanonSchema>>;
|
|
26
|
+
declare const BibleBookIntroSchema: z.ZodObject<{
|
|
27
|
+
id: z.ZodString;
|
|
28
|
+
passage_id: z.ZodString;
|
|
29
|
+
title: z.ZodString;
|
|
30
|
+
}, z.core.$strip>;
|
|
31
|
+
type BibleBookIntro = Readonly<z.infer<typeof BibleBookIntroSchema>>;
|
|
26
32
|
declare const BookUsfmSchema: z.ZodUnion<readonly [...z.ZodLiteral<"GEN" | "EXO" | "LEV" | "NUM" | "DEU" | "JOS" | "JDG" | "RUT" | "1SA" | "2SA" | "1KI" | "2KI" | "1CH" | "2CH" | "EZR" | "NEH" | "EST" | "JOB" | "PSA" | "PRO" | "ECC" | "SNG" | "ISA" | "JER" | "LAM" | "EZK" | "DAN" | "HOS" | "JOL" | "AMO" | "OBA" | "JON" | "MIC" | "NAM" | "HAB" | "ZEP" | "HAG" | "ZEC" | "MAL" | "MAT" | "MRK" | "LUK" | "JHN" | "ACT" | "ROM" | "1CO" | "2CO" | "GAL" | "EPH" | "PHP" | "COL" | "1TH" | "2TH" | "1TI" | "2TI" | "TIT" | "PHM" | "HEB" | "JAS" | "1PE" | "2PE" | "1JN" | "2JN" | "3JN" | "JUD" | "REV" | "TOB" | "JDT" | "ESG" | "WIS" | "SIR" | "BAR" | "LJE" | "S3Y" | "SUS" | "BEL" | "1MA" | "2MA" | "3MA" | "4MA" | "1ES" | "2ES" | "MAN" | "PS2" | "ODA" | "PSS" | "3ES" | "EZA" | "5EZ" | "6EZ" | "DAG" | "PS3" | "2BA" | "LBA" | "JUB" | "ENO" | "1MQ" | "2MQ" | "3MQ" | "REP" | "4BA" | "LAO" | "LKA">[], z.ZodType<string & {}, unknown, z.core.$ZodTypeInternals<string & {}, unknown>>]>;
|
|
27
33
|
type BookUsfm = z.infer<typeof BookUsfmSchema>;
|
|
28
34
|
declare const BibleBookSchema: z.ZodObject<{
|
|
@@ -35,6 +41,11 @@ declare const BibleBookSchema: z.ZodObject<{
|
|
|
35
41
|
new_testament: "new_testament";
|
|
36
42
|
deuterocanon: "deuterocanon";
|
|
37
43
|
}>;
|
|
44
|
+
intro: z.ZodOptional<z.ZodObject<{
|
|
45
|
+
id: z.ZodString;
|
|
46
|
+
passage_id: z.ZodString;
|
|
47
|
+
title: z.ZodString;
|
|
48
|
+
}, z.core.$strip>>;
|
|
38
49
|
chapters: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
39
50
|
id: z.ZodString;
|
|
40
51
|
passage_id: z.ZodString;
|
|
@@ -46,8 +57,8 @@ declare const BibleBookSchema: z.ZodObject<{
|
|
|
46
57
|
}, z.core.$strip>>>;
|
|
47
58
|
}, z.core.$strip>>>;
|
|
48
59
|
}, z.core.$strip>;
|
|
49
|
-
type BibleBook = z.infer<typeof BibleBookSchema
|
|
50
|
-
type CANON = z.infer<typeof CanonSchema
|
|
60
|
+
type BibleBook = Readonly<z.infer<typeof BibleBookSchema>>;
|
|
61
|
+
type CANON = Readonly<z.infer<typeof CanonSchema>>;
|
|
51
62
|
|
|
52
63
|
declare const BibleChapterSchema: z.ZodObject<{
|
|
53
64
|
id: z.ZodString;
|
|
@@ -59,33 +70,33 @@ declare const BibleChapterSchema: z.ZodObject<{
|
|
|
59
70
|
title: z.ZodString;
|
|
60
71
|
}, z.core.$strip>>>;
|
|
61
72
|
}, z.core.$strip>;
|
|
62
|
-
type BibleChapter = z.infer<typeof BibleChapterSchema
|
|
73
|
+
type BibleChapter = Readonly<z.infer<typeof BibleChapterSchema>>;
|
|
63
74
|
|
|
64
75
|
declare const BibleVerseSchema: z.ZodObject<{
|
|
65
76
|
id: z.ZodString;
|
|
66
77
|
passage_id: z.ZodString;
|
|
67
78
|
title: z.ZodString;
|
|
68
79
|
}, z.core.$strip>;
|
|
69
|
-
type BibleVerse = z.infer<typeof BibleVerseSchema
|
|
80
|
+
type BibleVerse = Readonly<z.infer<typeof BibleVerseSchema>>;
|
|
70
81
|
|
|
71
82
|
declare const BiblePassageSchema: z.ZodObject<{
|
|
72
83
|
id: z.ZodString;
|
|
73
84
|
content: z.ZodString;
|
|
74
85
|
reference: z.ZodString;
|
|
75
86
|
}, z.core.$strip>;
|
|
76
|
-
type BiblePassage = z.infer<typeof BiblePassageSchema
|
|
87
|
+
type BiblePassage = Readonly<z.infer<typeof BiblePassageSchema>>;
|
|
77
88
|
|
|
78
89
|
declare const VOTDSchema: z.ZodObject<{
|
|
79
90
|
day: z.ZodNumber;
|
|
80
91
|
passage_id: z.ZodString;
|
|
81
92
|
}, z.core.$strip>;
|
|
82
|
-
type VOTD = z.infer<typeof VOTDSchema
|
|
93
|
+
type VOTD = Readonly<z.infer<typeof VOTDSchema>>;
|
|
83
94
|
|
|
84
95
|
declare const BibleIndexVerseSchema: z.ZodObject<{
|
|
85
96
|
id: z.ZodString;
|
|
86
97
|
title: z.ZodString;
|
|
87
98
|
}, z.core.$strip>;
|
|
88
|
-
type BibleIndexVerse = z.infer<typeof BibleIndexVerseSchema
|
|
99
|
+
type BibleIndexVerse = Readonly<z.infer<typeof BibleIndexVerseSchema>>;
|
|
89
100
|
declare const BibleIndexChapterSchema: z.ZodObject<{
|
|
90
101
|
id: z.ZodString;
|
|
91
102
|
title: z.ZodString;
|
|
@@ -94,7 +105,7 @@ declare const BibleIndexChapterSchema: z.ZodObject<{
|
|
|
94
105
|
title: z.ZodString;
|
|
95
106
|
}, z.core.$strip>>;
|
|
96
107
|
}, z.core.$strip>;
|
|
97
|
-
type BibleIndexChapter = z.infer<typeof BibleIndexChapterSchema
|
|
108
|
+
type BibleIndexChapter = Readonly<z.infer<typeof BibleIndexChapterSchema>>;
|
|
98
109
|
declare const BibleIndexBookSchema: z.ZodObject<{
|
|
99
110
|
id: z.ZodUnion<readonly [...z.ZodLiteral<"GEN" | "EXO" | "LEV" | "NUM" | "DEU" | "JOS" | "JDG" | "RUT" | "1SA" | "2SA" | "1KI" | "2KI" | "1CH" | "2CH" | "EZR" | "NEH" | "EST" | "JOB" | "PSA" | "PRO" | "ECC" | "SNG" | "ISA" | "JER" | "LAM" | "EZK" | "DAN" | "HOS" | "JOL" | "AMO" | "OBA" | "JON" | "MIC" | "NAM" | "HAB" | "ZEP" | "HAG" | "ZEC" | "MAL" | "MAT" | "MRK" | "LUK" | "JHN" | "ACT" | "ROM" | "1CO" | "2CO" | "GAL" | "EPH" | "PHP" | "COL" | "1TH" | "2TH" | "1TI" | "2TI" | "TIT" | "PHM" | "HEB" | "JAS" | "1PE" | "2PE" | "1JN" | "2JN" | "3JN" | "JUD" | "REV" | "TOB" | "JDT" | "ESG" | "WIS" | "SIR" | "BAR" | "LJE" | "S3Y" | "SUS" | "BEL" | "1MA" | "2MA" | "3MA" | "4MA" | "1ES" | "2ES" | "MAN" | "PS2" | "ODA" | "PSS" | "3ES" | "EZA" | "5EZ" | "6EZ" | "DAG" | "PS3" | "2BA" | "LBA" | "JUB" | "ENO" | "1MQ" | "2MQ" | "3MQ" | "REP" | "4BA" | "LAO" | "LKA">[], z.ZodType<string & {}, unknown, z.core.$ZodTypeInternals<string & {}, unknown>>]>;
|
|
100
111
|
title: z.ZodString;
|
|
@@ -114,7 +125,7 @@ declare const BibleIndexBookSchema: z.ZodObject<{
|
|
|
114
125
|
}, z.core.$strip>>;
|
|
115
126
|
}, z.core.$strip>>;
|
|
116
127
|
}, z.core.$strip>;
|
|
117
|
-
type BibleIndexBook = z.infer<typeof BibleIndexBookSchema
|
|
128
|
+
type BibleIndexBook = Readonly<z.infer<typeof BibleIndexBookSchema>>;
|
|
118
129
|
declare const _BibleIndexSchema: z.ZodObject<{
|
|
119
130
|
text_direction: z.ZodString;
|
|
120
131
|
books: z.ZodArray<z.ZodObject<{
|
|
@@ -137,7 +148,7 @@ declare const _BibleIndexSchema: z.ZodObject<{
|
|
|
137
148
|
}, z.core.$strip>>;
|
|
138
149
|
}, z.core.$strip>>;
|
|
139
150
|
}, z.core.$strip>;
|
|
140
|
-
type BibleIndex = z.infer<typeof _BibleIndexSchema
|
|
151
|
+
type BibleIndex = Readonly<z.infer<typeof _BibleIndexSchema>>;
|
|
141
152
|
|
|
142
153
|
declare const LanguageSchema: z.ZodObject<{
|
|
143
154
|
id: z.ZodString;
|
|
@@ -157,7 +168,7 @@ declare const LanguageSchema: z.ZodObject<{
|
|
|
157
168
|
speaking_population: z.ZodOptional<z.ZodNumber>;
|
|
158
169
|
default_bible_version_id: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
159
170
|
}, z.core.$strip>;
|
|
160
|
-
type Language = z.infer<typeof LanguageSchema
|
|
171
|
+
type Language = Readonly<z.infer<typeof LanguageSchema>>;
|
|
161
172
|
|
|
162
173
|
declare const _UserSchema: z.ZodObject<{
|
|
163
174
|
avatar_url: z.ZodString;
|
|
@@ -183,11 +194,11 @@ type CreateHighlight = z.infer<typeof _CreateHighlightSchema>;
|
|
|
183
194
|
/**
|
|
184
195
|
* Generic Collection type for paginated responses
|
|
185
196
|
*/
|
|
186
|
-
type Collection<T> = {
|
|
197
|
+
type Collection<T> = Readonly<{
|
|
187
198
|
data: T[];
|
|
188
199
|
next_page_token: string | null;
|
|
189
200
|
total_size?: number;
|
|
190
|
-
}
|
|
201
|
+
}>;
|
|
191
202
|
|
|
192
203
|
interface ApiConfig {
|
|
193
204
|
apiHost?: string;
|
|
@@ -228,12 +239,12 @@ declare class SignInWithYouVersionResult {
|
|
|
228
239
|
|
|
229
240
|
type SignInWithYouVersionPermissionValues = (typeof SignInWithYouVersionPermission)[keyof typeof SignInWithYouVersionPermission];
|
|
230
241
|
interface AuthenticationState {
|
|
231
|
-
isAuthenticated: boolean;
|
|
232
|
-
isLoading: boolean;
|
|
233
|
-
accessToken: string | null;
|
|
234
|
-
idToken: string | null;
|
|
235
|
-
result: SignInWithYouVersionResult | null;
|
|
236
|
-
error: Error | null;
|
|
242
|
+
readonly isAuthenticated: boolean;
|
|
243
|
+
readonly isLoading: boolean;
|
|
244
|
+
readonly accessToken: string | null;
|
|
245
|
+
readonly idToken: string | null;
|
|
246
|
+
readonly result: SignInWithYouVersionResult | null;
|
|
247
|
+
readonly error: Error | null;
|
|
237
248
|
}
|
|
238
249
|
type AuthenticationScopes = 'profile' | 'email';
|
|
239
250
|
|
|
@@ -337,14 +348,18 @@ declare class BibleClient {
|
|
|
337
348
|
* Fetches all books for a given Bible version.
|
|
338
349
|
* @param versionId The version ID.
|
|
339
350
|
* @param canon Optional canon filter ("old_testament", 'new_testament', 'deuterocanon').
|
|
340
|
-
* @returns An array of BibleBook objects.
|
|
351
|
+
* @returns An array of BibleBook objects. Each book may include an optional `intro` field
|
|
352
|
+
* containing metadata (id, passage_id, title) for the book's introduction when
|
|
353
|
+
* available in the Bible version.
|
|
341
354
|
*/
|
|
342
355
|
getBooks(versionId: number, canon?: CANON): Promise<Collection<BibleBook>>;
|
|
343
356
|
/**
|
|
344
357
|
* Fetches a specific book by USFM code for a given version.
|
|
345
358
|
* @param versionId The version ID.
|
|
346
359
|
* @param book The Book Identifier code of the book.
|
|
347
|
-
* @returns The requested BibleBook object
|
|
360
|
+
* @returns The requested BibleBook object, which may include an optional `intro` field
|
|
361
|
+
* containing metadata (id, passage_id, title) for the book's introduction when
|
|
362
|
+
* available. Use the `passage_id` with `getPassage()` to fetch intro content.
|
|
348
363
|
*/
|
|
349
364
|
getBook(versionId: number, book: string): Promise<BibleBook>;
|
|
350
365
|
/**
|
|
@@ -706,4 +721,4 @@ declare const BOOK_IDS: readonly ["GEN", "EXO", "LEV", "NUM", "DEU", "JOS", "JDG
|
|
|
706
721
|
*/
|
|
707
722
|
declare const BOOK_CANON: Record<BookUsfm, Canon>;
|
|
708
723
|
|
|
709
|
-
export { ApiClient, type ApiConfig, type AuthenticationScopes, type AuthenticationState, BOOK_CANON, BOOK_IDS, type BibleBook, type BibleChapter, BibleClient, type BibleIndex, type BibleIndexBook, type BibleIndexChapter, type BibleIndexVerse, type BiblePassage, type BibleVerse, type BibleVersion, type CANON, type Collection, type CreateHighlight, type DeleteHighlightOptions, type GetHighlightsOptions, type GetLanguagesOptions, type Highlight, type HighlightColor, HighlightsClient, type Language, LanguagesClient, MemoryStorageStrategy, SessionStorageStrategy, SignInWithYouVersionPermission, type SignInWithYouVersionPermissionValues, SignInWithYouVersionResult, type StorageStrategy, type User, type VOTD, YouVersionAPI, YouVersionAPIUsers, YouVersionPlatformConfiguration, YouVersionUserInfo, type YouVersionUserInfoJSON };
|
|
724
|
+
export { ApiClient, type ApiConfig, type AuthenticationScopes, type AuthenticationState, BOOK_CANON, BOOK_IDS, type BibleBook, type BibleBookIntro, type BibleChapter, BibleClient, type BibleIndex, type BibleIndexBook, type BibleIndexChapter, type BibleIndexVerse, type BiblePassage, type BibleVerse, type BibleVersion, type CANON, type Collection, type CreateHighlight, type DeleteHighlightOptions, type GetHighlightsOptions, type GetLanguagesOptions, type Highlight, type HighlightColor, HighlightsClient, type Language, LanguagesClient, MemoryStorageStrategy, SessionStorageStrategy, SignInWithYouVersionPermission, type SignInWithYouVersionPermissionValues, SignInWithYouVersionResult, type StorageStrategy, type User, type VOTD, YouVersionAPI, YouVersionAPIUsers, YouVersionPlatformConfiguration, YouVersionUserInfo, type YouVersionUserInfoJSON };
|
package/dist/index.js
CHANGED
|
@@ -193,7 +193,9 @@ var BibleClient = class {
|
|
|
193
193
|
* Fetches all books for a given Bible version.
|
|
194
194
|
* @param versionId The version ID.
|
|
195
195
|
* @param canon Optional canon filter ("old_testament", 'new_testament', 'deuterocanon').
|
|
196
|
-
* @returns An array of BibleBook objects.
|
|
196
|
+
* @returns An array of BibleBook objects. Each book may include an optional `intro` field
|
|
197
|
+
* containing metadata (id, passage_id, title) for the book's introduction when
|
|
198
|
+
* available in the Bible version.
|
|
197
199
|
*/
|
|
198
200
|
async getBooks(versionId, canon) {
|
|
199
201
|
this.versionIdSchema.parse(versionId);
|
|
@@ -205,7 +207,9 @@ var BibleClient = class {
|
|
|
205
207
|
* Fetches a specific book by USFM code for a given version.
|
|
206
208
|
* @param versionId The version ID.
|
|
207
209
|
* @param book The Book Identifier code of the book.
|
|
208
|
-
* @returns The requested BibleBook object
|
|
210
|
+
* @returns The requested BibleBook object, which may include an optional `intro` field
|
|
211
|
+
* containing metadata (id, passage_id, title) for the book's introduction when
|
|
212
|
+
* available. Use the `passage_id` with `getPassage()` to fetch intro content.
|
|
209
213
|
*/
|
|
210
214
|
async getBook(versionId, book) {
|
|
211
215
|
this.versionIdSchema.parse(versionId);
|
package/package.json
CHANGED
|
@@ -1,36 +1,13 @@
|
|
|
1
1
|
import { mockGenesisChapters } from './MockChapters';
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
id: 'GEN',
|
|
5
|
-
title: 'Genesis',
|
|
6
|
-
full_title: 'The First Book of Moses, Called Genesis',
|
|
7
|
-
abbreviation: 'Gen',
|
|
8
|
-
canon: 'old_testament',
|
|
9
|
-
chapters: mockGenesisChapters,
|
|
10
|
-
};
|
|
11
|
-
export const mockBibleBooks = [
|
|
3
|
+
const baseBibleBooks = [
|
|
12
4
|
{
|
|
13
5
|
id: 'GEN',
|
|
14
6
|
title: 'Genesis',
|
|
15
7
|
full_title: 'The First Book of Moses, Called Genesis',
|
|
16
8
|
abbreviation: 'Gen',
|
|
17
9
|
canon: 'old_testament',
|
|
18
|
-
chapters:
|
|
19
|
-
const chapterNumber = i + 1;
|
|
20
|
-
return {
|
|
21
|
-
id: chapterNumber.toString(),
|
|
22
|
-
passage_id: `GEN.${chapterNumber}`,
|
|
23
|
-
title: chapterNumber.toString(),
|
|
24
|
-
verses: Array.from({ length: 31 }, (_, j) => {
|
|
25
|
-
const verseNumber = j + 1;
|
|
26
|
-
return {
|
|
27
|
-
id: verseNumber.toString(),
|
|
28
|
-
passage_id: `GEN.${chapterNumber}.${verseNumber}`,
|
|
29
|
-
title: verseNumber.toString(),
|
|
30
|
-
};
|
|
31
|
-
}),
|
|
32
|
-
};
|
|
33
|
-
}),
|
|
10
|
+
chapters: mockGenesisChapters,
|
|
34
11
|
},
|
|
35
12
|
{
|
|
36
13
|
id: 'EXO',
|
|
@@ -1528,3 +1505,15 @@ export const mockBibleBooks = [
|
|
|
1528
1505
|
}),
|
|
1529
1506
|
},
|
|
1530
1507
|
];
|
|
1508
|
+
|
|
1509
|
+
const addIntro = <T extends { id: string }>(book: T) => ({
|
|
1510
|
+
...book,
|
|
1511
|
+
intro: {
|
|
1512
|
+
id: 'INTRO',
|
|
1513
|
+
passage_id: `${book.id}.INTRO`,
|
|
1514
|
+
title: 'Intro',
|
|
1515
|
+
},
|
|
1516
|
+
});
|
|
1517
|
+
|
|
1518
|
+
export const mockBibleBooks = baseBibleBooks.map(addIntro);
|
|
1519
|
+
export const mockBibleGenesis = mockBibleBooks[0];
|
|
@@ -77,6 +77,11 @@ describe('BibleClient', () => {
|
|
|
77
77
|
expect(books.data[0]).toHaveProperty('title', 'Genesis');
|
|
78
78
|
expect(books.data[0]).toHaveProperty('full_title', 'The First Book of Moses, Called Genesis');
|
|
79
79
|
expect(books.data[0]).toHaveProperty('abbreviation', 'Gen');
|
|
80
|
+
expect(books.data[0]?.intro).toEqual({
|
|
81
|
+
id: 'INTRO',
|
|
82
|
+
passage_id: 'GEN.INTRO',
|
|
83
|
+
title: 'Intro',
|
|
84
|
+
});
|
|
80
85
|
expect(books.data[0]).toHaveProperty('canon', 'old_testament');
|
|
81
86
|
expect(books.data[0]?.chapters).toHaveLength(50);
|
|
82
87
|
});
|
|
@@ -93,6 +98,12 @@ describe('BibleClient', () => {
|
|
|
93
98
|
expect(book).toHaveProperty('id', 'GEN');
|
|
94
99
|
expect(book).toHaveProperty('title', 'Genesis');
|
|
95
100
|
expect(book).toHaveProperty('abbreviation', 'Gen');
|
|
101
|
+
expect(book).toHaveProperty('intro');
|
|
102
|
+
expect(book.intro).toEqual({
|
|
103
|
+
id: 'INTRO',
|
|
104
|
+
passage_id: 'GEN.INTRO',
|
|
105
|
+
title: 'Intro',
|
|
106
|
+
});
|
|
96
107
|
expect(book).toHaveProperty('canon', 'old_testament');
|
|
97
108
|
});
|
|
98
109
|
|
package/src/bible.ts
CHANGED
|
@@ -82,7 +82,9 @@ export class BibleClient {
|
|
|
82
82
|
* Fetches all books for a given Bible version.
|
|
83
83
|
* @param versionId The version ID.
|
|
84
84
|
* @param canon Optional canon filter ("old_testament", 'new_testament', 'deuterocanon').
|
|
85
|
-
* @returns An array of BibleBook objects.
|
|
85
|
+
* @returns An array of BibleBook objects. Each book may include an optional `intro` field
|
|
86
|
+
* containing metadata (id, passage_id, title) for the book's introduction when
|
|
87
|
+
* available in the Bible version.
|
|
86
88
|
*/
|
|
87
89
|
async getBooks(versionId: number, canon?: CANON): Promise<Collection<BibleBook>> {
|
|
88
90
|
this.versionIdSchema.parse(versionId);
|
|
@@ -95,7 +97,9 @@ export class BibleClient {
|
|
|
95
97
|
* Fetches a specific book by USFM code for a given version.
|
|
96
98
|
* @param versionId The version ID.
|
|
97
99
|
* @param book The Book Identifier code of the book.
|
|
98
|
-
* @returns The requested BibleBook object
|
|
100
|
+
* @returns The requested BibleBook object, which may include an optional `intro` field
|
|
101
|
+
* containing metadata (id, passage_id, title) for the book's introduction when
|
|
102
|
+
* available. Use the `passage_id` with `getPassage()` to fetch intro content.
|
|
99
103
|
*/
|
|
100
104
|
async getBook(versionId: number, book: string): Promise<BibleBook> {
|
|
101
105
|
this.versionIdSchema.parse(versionId);
|
|
@@ -8,7 +8,7 @@ const BibleIndexVerseSchema = z.object({
|
|
|
8
8
|
title: z.string(),
|
|
9
9
|
});
|
|
10
10
|
|
|
11
|
-
export type BibleIndexVerse = z.infer<typeof BibleIndexVerseSchema
|
|
11
|
+
export type BibleIndexVerse = Readonly<z.infer<typeof BibleIndexVerseSchema>>;
|
|
12
12
|
|
|
13
13
|
const BibleIndexChapterSchema = z.object({
|
|
14
14
|
/** Chapter identifier */
|
|
@@ -19,7 +19,7 @@ const BibleIndexChapterSchema = z.object({
|
|
|
19
19
|
verses: z.array(BibleIndexVerseSchema),
|
|
20
20
|
});
|
|
21
21
|
|
|
22
|
-
export type BibleIndexChapter = z.infer<typeof BibleIndexChapterSchema
|
|
22
|
+
export type BibleIndexChapter = Readonly<z.infer<typeof BibleIndexChapterSchema>>;
|
|
23
23
|
|
|
24
24
|
const BibleIndexBookSchema = z.object({
|
|
25
25
|
/** Book identifier */
|
|
@@ -36,7 +36,7 @@ const BibleIndexBookSchema = z.object({
|
|
|
36
36
|
chapters: z.array(BibleIndexChapterSchema),
|
|
37
37
|
});
|
|
38
38
|
|
|
39
|
-
export type BibleIndexBook = z.infer<typeof BibleIndexBookSchema
|
|
39
|
+
export type BibleIndexBook = Readonly<z.infer<typeof BibleIndexBookSchema>>;
|
|
40
40
|
|
|
41
41
|
const _BibleIndexSchema = z.object({
|
|
42
42
|
/** Text direction (e.g., "ltr") */
|
|
@@ -45,4 +45,4 @@ const _BibleIndexSchema = z.object({
|
|
|
45
45
|
books: z.array(BibleIndexBookSchema),
|
|
46
46
|
});
|
|
47
47
|
|
|
48
|
-
export type BibleIndex = z.infer<typeof _BibleIndexSchema
|
|
48
|
+
export type BibleIndex = Readonly<z.infer<typeof _BibleIndexSchema>>;
|
package/src/schemas/book.ts
CHANGED
|
@@ -3,7 +3,17 @@ import { BOOK_IDS } from '../utils/constants';
|
|
|
3
3
|
import { BibleChapterSchema } from './chapter';
|
|
4
4
|
|
|
5
5
|
export const CanonSchema = z.enum(['old_testament', 'new_testament', 'deuterocanon']);
|
|
6
|
-
export type Canon = z.infer<typeof CanonSchema
|
|
6
|
+
export type Canon = Readonly<z.infer<typeof CanonSchema>>;
|
|
7
|
+
|
|
8
|
+
export const BibleBookIntroSchema = z.object({
|
|
9
|
+
/** Intro identifier */
|
|
10
|
+
id: z.string(),
|
|
11
|
+
/** Intro passage identifier */
|
|
12
|
+
passage_id: z.string(),
|
|
13
|
+
/** Intro title */
|
|
14
|
+
title: z.string(),
|
|
15
|
+
});
|
|
16
|
+
export type BibleBookIntro = Readonly<z.infer<typeof BibleBookIntroSchema>>;
|
|
7
17
|
|
|
8
18
|
// https://github.com/colinhacks/zod/discussions/4934#discussioncomment-13858053
|
|
9
19
|
export const BookUsfmSchema = z.union([
|
|
@@ -23,9 +33,11 @@ export const BibleBookSchema = z.object({
|
|
|
23
33
|
abbreviation: z.string().optional(),
|
|
24
34
|
/** Canonical section (new_testament, old_testament, deuterocanon) */
|
|
25
35
|
canon: CanonSchema,
|
|
36
|
+
/** Intro metadata (optional) */
|
|
37
|
+
intro: BibleBookIntroSchema.optional(),
|
|
26
38
|
/** Array of chapter identifiers (e.g., ["GEN.1", "GEN.2", "GEN.3"]) */
|
|
27
39
|
chapters: z.array(BibleChapterSchema).optional(),
|
|
28
40
|
});
|
|
29
41
|
|
|
30
|
-
export type BibleBook = z.infer<typeof BibleBookSchema
|
|
31
|
-
export type CANON = z.infer<typeof CanonSchema
|
|
42
|
+
export type BibleBook = Readonly<z.infer<typeof BibleBookSchema>>;
|
|
43
|
+
export type CANON = Readonly<z.infer<typeof CanonSchema>>;
|
package/src/schemas/chapter.ts
CHANGED
|
@@ -21,8 +21,8 @@ const _CollectionSchema = <T extends z.ZodTypeAny>(
|
|
|
21
21
|
/**
|
|
22
22
|
* Generic Collection type for paginated responses
|
|
23
23
|
*/
|
|
24
|
-
export type Collection<T> = {
|
|
24
|
+
export type Collection<T> = Readonly<{
|
|
25
25
|
data: T[];
|
|
26
26
|
next_page_token: string | null;
|
|
27
27
|
total_size?: number;
|
|
28
|
-
}
|
|
28
|
+
}>;
|
package/src/schemas/language.ts
CHANGED
package/src/schemas/passage.ts
CHANGED
package/src/schemas/verse.ts
CHANGED
package/src/schemas/version.ts
CHANGED
package/src/schemas/votd.ts
CHANGED
package/src/types/auth.ts
CHANGED
|
@@ -7,12 +7,12 @@ export type SignInWithYouVersionPermissionValues =
|
|
|
7
7
|
(typeof SignInWithYouVersionPermission)[keyof typeof SignInWithYouVersionPermission];
|
|
8
8
|
|
|
9
9
|
export interface AuthenticationState {
|
|
10
|
-
isAuthenticated: boolean;
|
|
11
|
-
isLoading: boolean;
|
|
12
|
-
accessToken: string | null;
|
|
13
|
-
idToken: string | null;
|
|
14
|
-
result: SignInWithYouVersionResult | null;
|
|
15
|
-
error: Error | null;
|
|
10
|
+
readonly isAuthenticated: boolean;
|
|
11
|
+
readonly isLoading: boolean;
|
|
12
|
+
readonly accessToken: string | null;
|
|
13
|
+
readonly idToken: string | null;
|
|
14
|
+
readonly result: SignInWithYouVersionResult | null;
|
|
15
|
+
readonly error: Error | null;
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
export type AuthenticationScopes = 'profile' | 'email';
|
package/src/types/index.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Re-export all schema-derived types from schemas
|
|
2
2
|
export type { BibleVersion } from '../schemas/version';
|
|
3
|
-
export type { BibleBook, CANON } from '../schemas/book';
|
|
3
|
+
export type { BibleBook, BibleBookIntro, CANON } from '../schemas/book';
|
|
4
4
|
export type { BibleChapter } from '../schemas/chapter';
|
|
5
5
|
export type { BibleVerse } from '../schemas/verse';
|
|
6
6
|
export type { BiblePassage } from '../schemas/passage';
|
package/src/types/book.ts
DELETED
|
@@ -1,116 +0,0 @@
|
|
|
1
|
-
export type BibleBook = {
|
|
2
|
-
id: BOOK_ID; // Book identifier (USFM)
|
|
3
|
-
title: string;
|
|
4
|
-
abbreviation?: string; // Book name abbreviation if provided by publisher
|
|
5
|
-
canon: CANON;
|
|
6
|
-
// eslint-disable-next-line @typescript-eslint/array-type -- Array<> syntax required for template literal type to represent chapter references
|
|
7
|
-
chapters?: Array<`${BOOK_ID}.${number | `INTRO${number}`}`>; // Ordered list of chapter ids for given Bible and book (e.g., ["GEN.1", "GEN.2", "3JN.INTRO1", "3JN.1"])
|
|
8
|
-
};
|
|
9
|
-
|
|
10
|
-
export type BOOK_ID =
|
|
11
|
-
| 'GEN'
|
|
12
|
-
| 'EXO'
|
|
13
|
-
| 'LEV'
|
|
14
|
-
| 'NUM'
|
|
15
|
-
| 'DEU'
|
|
16
|
-
| 'JOS'
|
|
17
|
-
| 'JDG'
|
|
18
|
-
| 'RUT'
|
|
19
|
-
| '1SA'
|
|
20
|
-
| '2SA'
|
|
21
|
-
| '1KI'
|
|
22
|
-
| '2KI'
|
|
23
|
-
| '1CH'
|
|
24
|
-
| '2CH'
|
|
25
|
-
| 'EZR'
|
|
26
|
-
| 'NEH'
|
|
27
|
-
| 'EST'
|
|
28
|
-
| 'JOB'
|
|
29
|
-
| 'PSA'
|
|
30
|
-
| 'PRO'
|
|
31
|
-
| 'ECC'
|
|
32
|
-
| 'SNG'
|
|
33
|
-
| 'ISA'
|
|
34
|
-
| 'JER'
|
|
35
|
-
| 'LAM'
|
|
36
|
-
| 'EZK'
|
|
37
|
-
| 'DAN'
|
|
38
|
-
| 'HOS'
|
|
39
|
-
| 'JOL'
|
|
40
|
-
| 'AMO'
|
|
41
|
-
| 'OBA'
|
|
42
|
-
| 'JON'
|
|
43
|
-
| 'MIC'
|
|
44
|
-
| 'NAM'
|
|
45
|
-
| 'HAB'
|
|
46
|
-
| 'ZEP'
|
|
47
|
-
| 'HAG'
|
|
48
|
-
| 'ZEC'
|
|
49
|
-
| 'MAL'
|
|
50
|
-
| 'MAT'
|
|
51
|
-
| 'MRK'
|
|
52
|
-
| 'LUK'
|
|
53
|
-
| 'JHN'
|
|
54
|
-
| 'ACT'
|
|
55
|
-
| 'ROM'
|
|
56
|
-
| '1CO'
|
|
57
|
-
| '2CO'
|
|
58
|
-
| 'GAL'
|
|
59
|
-
| 'EPH'
|
|
60
|
-
| 'PHP'
|
|
61
|
-
| 'COL'
|
|
62
|
-
| '1TH'
|
|
63
|
-
| '2TH'
|
|
64
|
-
| '1TI'
|
|
65
|
-
| '2TI'
|
|
66
|
-
| 'TIT'
|
|
67
|
-
| 'PHM'
|
|
68
|
-
| 'HEB'
|
|
69
|
-
| 'JAS'
|
|
70
|
-
| '1PE'
|
|
71
|
-
| '2PE'
|
|
72
|
-
| '1JN'
|
|
73
|
-
| '2JN'
|
|
74
|
-
| '3JN'
|
|
75
|
-
| 'JUD'
|
|
76
|
-
| 'REV'
|
|
77
|
-
| 'TOB'
|
|
78
|
-
| 'JDT'
|
|
79
|
-
| 'ESG'
|
|
80
|
-
| 'WIS'
|
|
81
|
-
| 'SIR'
|
|
82
|
-
| 'BAR'
|
|
83
|
-
| 'LJE'
|
|
84
|
-
| 'S3Y'
|
|
85
|
-
| 'SUS'
|
|
86
|
-
| 'BEL'
|
|
87
|
-
| '1MA'
|
|
88
|
-
| '2MA'
|
|
89
|
-
| '3MA'
|
|
90
|
-
| '4MA'
|
|
91
|
-
| '1ES'
|
|
92
|
-
| '2ES'
|
|
93
|
-
| 'MAN'
|
|
94
|
-
| 'PS2'
|
|
95
|
-
| 'ODA'
|
|
96
|
-
| 'PSS'
|
|
97
|
-
| '3ES'
|
|
98
|
-
| 'EZA'
|
|
99
|
-
| '5EZ'
|
|
100
|
-
| '6EZ'
|
|
101
|
-
| 'DAG'
|
|
102
|
-
| 'PS3'
|
|
103
|
-
| '2BA'
|
|
104
|
-
| 'LBA'
|
|
105
|
-
| 'JUB'
|
|
106
|
-
| 'ENO'
|
|
107
|
-
| '1MQ'
|
|
108
|
-
| '2MQ'
|
|
109
|
-
| '3MQ'
|
|
110
|
-
| 'REP'
|
|
111
|
-
| '4BA'
|
|
112
|
-
| 'LAO'
|
|
113
|
-
| 'LKA'
|
|
114
|
-
| (string & {});
|
|
115
|
-
|
|
116
|
-
export type CANON = 'old_testament' | 'new_testament' | 'deuterocanon';
|