@youversion/platform-core 0.4.1
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/.env.example +7 -0
- package/.env.local +10 -0
- package/.turbo/turbo-build.log +18 -0
- package/CHANGELOG.md +7 -0
- package/LICENSE +201 -0
- package/README.md +369 -0
- package/dist/index.cjs +1330 -0
- package/dist/index.d.cts +737 -0
- package/dist/index.d.ts +737 -0
- package/dist/index.js +1286 -0
- package/package.json +46 -0
- package/src/AuthenticationStrategy.ts +78 -0
- package/src/SignInWithYouVersionResult.ts +53 -0
- package/src/StorageStrategy.ts +81 -0
- package/src/URLBuilder.ts +71 -0
- package/src/Users.ts +137 -0
- package/src/WebAuthenticationStrategy.ts +127 -0
- package/src/YouVersionAPI.ts +27 -0
- package/src/YouVersionPlatformConfiguration.ts +80 -0
- package/src/YouVersionUserInfo.ts +49 -0
- package/src/__tests__/StorageStrategy.test.ts +404 -0
- package/src/__tests__/URLBuilder.test.ts +289 -0
- package/src/__tests__/YouVersionPlatformConfiguration.test.ts +150 -0
- package/src/__tests__/authentication.test.ts +174 -0
- package/src/__tests__/bible.test.ts +356 -0
- package/src/__tests__/client.test.ts +109 -0
- package/src/__tests__/handlers.ts +41 -0
- package/src/__tests__/highlights.test.ts +485 -0
- package/src/__tests__/languages.test.ts +139 -0
- package/src/__tests__/setup.ts +17 -0
- package/src/authentication.ts +27 -0
- package/src/bible.ts +272 -0
- package/src/client.ts +162 -0
- package/src/highlight.ts +16 -0
- package/src/highlights.ts +173 -0
- package/src/index.ts +20 -0
- package/src/languages.ts +80 -0
- package/src/schemas/bible-index.ts +48 -0
- package/src/schemas/book.ts +34 -0
- package/src/schemas/chapter.ts +24 -0
- package/src/schemas/collection.ts +28 -0
- package/src/schemas/highlight.ts +23 -0
- package/src/schemas/index.ts +11 -0
- package/src/schemas/language.ts +38 -0
- package/src/schemas/passage.ts +14 -0
- package/src/schemas/user.ts +10 -0
- package/src/schemas/verse.ts +17 -0
- package/src/schemas/version.ts +31 -0
- package/src/schemas/votd.ts +10 -0
- package/src/types/api-config.ts +9 -0
- package/src/types/auth.ts +15 -0
- package/src/types/book.ts +116 -0
- package/src/types/chapter.ts +5 -0
- package/src/types/highlight.ts +9 -0
- package/src/types/index.ts +22 -0
- package/src/utils/constants.ts +219 -0
- package/tsconfig.build.json +11 -0
- package/tsconfig.json +12 -0
- package/vitest.config.ts +9 -0
package/src/languages.ts
ADDED
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import type { ApiClient } from './client';
|
|
3
|
+
import type { Collection, Language } from './types';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Options for getting languages collection.
|
|
7
|
+
*/
|
|
8
|
+
export type GetLanguagesOptions = {
|
|
9
|
+
page_size?: number;
|
|
10
|
+
page_token?: string;
|
|
11
|
+
country: string; // ISO 3166-1 alpha-2 country code (required per OpenAPI spec)
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Client for interacting with Languages API endpoints.
|
|
16
|
+
*/
|
|
17
|
+
export class LanguagesClient {
|
|
18
|
+
private client: ApiClient;
|
|
19
|
+
|
|
20
|
+
private languageIdSchema = z
|
|
21
|
+
.string()
|
|
22
|
+
.trim()
|
|
23
|
+
.min(1, 'Language ID must be a non-empty string')
|
|
24
|
+
.regex(
|
|
25
|
+
/^[a-z]{2,3}(?:-[A-Z][a-z]{3})?$/,
|
|
26
|
+
'Language ID must match BCP 47 format (language or language+script)',
|
|
27
|
+
);
|
|
28
|
+
private countrySchema = z
|
|
29
|
+
.string()
|
|
30
|
+
.trim()
|
|
31
|
+
.length(2, 'Country code must be a 2-character ISO 3166-1 alpha-2 code')
|
|
32
|
+
.toUpperCase();
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Creates a new LanguagesClient instance.
|
|
36
|
+
* @param client The API client to use for requests.
|
|
37
|
+
*/
|
|
38
|
+
constructor(client: ApiClient) {
|
|
39
|
+
this.client = client;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
private get rootPath(): string {
|
|
43
|
+
return `/${this.client.config.version}`;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Fetches a collection of languages supported in the Platform.
|
|
48
|
+
* @param options Query parameters for pagination and filtering (country is required).
|
|
49
|
+
* @returns A collection of Language objects.
|
|
50
|
+
*/
|
|
51
|
+
async getLanguages(options: GetLanguagesOptions): Promise<Collection<Language>> {
|
|
52
|
+
const params: Record<string, string | number> = {};
|
|
53
|
+
|
|
54
|
+
// Country is required per OpenAPI spec
|
|
55
|
+
const country = this.countrySchema.parse(options.country);
|
|
56
|
+
params.country = country;
|
|
57
|
+
|
|
58
|
+
if (options.page_size !== undefined) {
|
|
59
|
+
const pageSizeSchema = z.number().int().positive();
|
|
60
|
+
pageSizeSchema.parse(options.page_size);
|
|
61
|
+
params.page_size = options.page_size;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
if (options.page_token !== undefined) {
|
|
65
|
+
params.page_token = options.page_token;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
return this.client.get<Collection<Language>>(`${this.rootPath}/languages`, params);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* Fetches details about a specific language in the Platform.
|
|
73
|
+
* @param languageId The BCP 47 language code (optionally including script, e.g., "en" or "sr-Latn").
|
|
74
|
+
* @returns The requested Language object.
|
|
75
|
+
*/
|
|
76
|
+
async getLanguage(languageId: string): Promise<Language> {
|
|
77
|
+
this.languageIdSchema.parse(languageId);
|
|
78
|
+
return this.client.get<Language>(`${this.rootPath}/languages/${languageId}`);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { BookUsfmSchema, CanonSchema } from './book';
|
|
3
|
+
|
|
4
|
+
const BibleIndexVerseSchema = z.object({
|
|
5
|
+
/** Verse identifier */
|
|
6
|
+
id: z.string(),
|
|
7
|
+
/** Verse title */
|
|
8
|
+
title: z.string(),
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
export type BibleIndexVerse = z.infer<typeof BibleIndexVerseSchema>;
|
|
12
|
+
|
|
13
|
+
const BibleIndexChapterSchema = z.object({
|
|
14
|
+
/** Chapter identifier */
|
|
15
|
+
id: z.string(),
|
|
16
|
+
/** Chapter title */
|
|
17
|
+
title: z.string(),
|
|
18
|
+
/** Array of verses in this chapter */
|
|
19
|
+
verses: z.array(BibleIndexVerseSchema),
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
export type BibleIndexChapter = z.infer<typeof BibleIndexChapterSchema>;
|
|
23
|
+
|
|
24
|
+
const BibleIndexBookSchema = z.object({
|
|
25
|
+
/** Book identifier */
|
|
26
|
+
id: BookUsfmSchema,
|
|
27
|
+
/** Book title */
|
|
28
|
+
title: z.string(),
|
|
29
|
+
/** Full book title */
|
|
30
|
+
full_title: z.string(),
|
|
31
|
+
/** Book abbreviation */
|
|
32
|
+
abbreviation: z.string(),
|
|
33
|
+
/** Canonical section */
|
|
34
|
+
canon: CanonSchema,
|
|
35
|
+
/** Array of chapters in this book */
|
|
36
|
+
chapters: z.array(BibleIndexChapterSchema),
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
export type BibleIndexBook = z.infer<typeof BibleIndexBookSchema>;
|
|
40
|
+
|
|
41
|
+
const _BibleIndexSchema = z.object({
|
|
42
|
+
/** Text direction (e.g., "ltr") */
|
|
43
|
+
text_direction: z.string(),
|
|
44
|
+
/** Array of books with chapters and verses */
|
|
45
|
+
books: z.array(BibleIndexBookSchema),
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
export type BibleIndex = z.infer<typeof _BibleIndexSchema>;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { BOOK_IDS } from '../utils/constants';
|
|
3
|
+
|
|
4
|
+
export const CanonSchema = z.enum([
|
|
5
|
+
'ot', // Old Testament
|
|
6
|
+
'nt', // New Testament
|
|
7
|
+
'dc', // Deuterocanon (Apocrypha)
|
|
8
|
+
]);
|
|
9
|
+
export type Canon = z.infer<typeof CanonSchema>;
|
|
10
|
+
|
|
11
|
+
// https://github.com/colinhacks/zod/discussions/4934#discussioncomment-13858053
|
|
12
|
+
export const BookUsfmSchema = z.union([
|
|
13
|
+
...BOOK_IDS.map((id) => z.literal(id)),
|
|
14
|
+
z.string().length(3) as z.ZodType<string & {}>,
|
|
15
|
+
]);
|
|
16
|
+
export type BookUsfm = z.infer<typeof BookUsfmSchema>;
|
|
17
|
+
|
|
18
|
+
export const BibleBookSchema = z.object({
|
|
19
|
+
/** Book identifier (e.g., "MAT") */
|
|
20
|
+
id: BookUsfmSchema,
|
|
21
|
+
/** Book title (e.g., "Genesis") */
|
|
22
|
+
title: z.string(),
|
|
23
|
+
/** Book abbreviation (e.g., "Gen") */
|
|
24
|
+
abbreviation: z.string().optional(),
|
|
25
|
+
/** Canonical section (new_testament, old_testament, deuterocanon) */
|
|
26
|
+
canon: CanonSchema,
|
|
27
|
+
/** Array of chapter identifiers (e.g., ["GEN.1", "GEN.2", "GEN.3"]) */
|
|
28
|
+
chapters: z
|
|
29
|
+
.array(z.string().regex(/^\w{3}\.\d+$/, { message: 'Chapter must be an integer string' }))
|
|
30
|
+
.optional(),
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
export type BibleBook = z.infer<typeof BibleBookSchema>;
|
|
34
|
+
export type CANON = z.infer<typeof CanonSchema>;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { BookUsfmSchema } from './book';
|
|
3
|
+
|
|
4
|
+
export const BibleChapterSchema = z.object({
|
|
5
|
+
/** Chapter identifier (e.g., "1") */
|
|
6
|
+
id: z.string(),
|
|
7
|
+
/** Book identifier (e.g., "MAT") */
|
|
8
|
+
book_id: BookUsfmSchema,
|
|
9
|
+
/** Passage identifier (e.g., "MAT.1") */
|
|
10
|
+
passage_id: z.string(),
|
|
11
|
+
/** Chapter title (e.g., "1") */
|
|
12
|
+
title: z.string(),
|
|
13
|
+
/** Array of verse identifiers (e.g., ["1", "2", "3"]) */
|
|
14
|
+
verses: z
|
|
15
|
+
.array(
|
|
16
|
+
z
|
|
17
|
+
.string()
|
|
18
|
+
.regex(/^\d+$/, { message: 'Verse must be an integer string' })
|
|
19
|
+
.transform((val) => val as `${number}`),
|
|
20
|
+
)
|
|
21
|
+
.optional(),
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
export type BibleChapter = z.infer<typeof BibleChapterSchema>;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Generic Collection schema for paginated responses
|
|
5
|
+
* Used across multiple API endpoints
|
|
6
|
+
* Based on official YouVersion API schema
|
|
7
|
+
*/
|
|
8
|
+
const _CollectionSchema = <T extends z.ZodTypeAny>(
|
|
9
|
+
itemSchema: T,
|
|
10
|
+
): z.ZodObject<{
|
|
11
|
+
data: z.ZodArray<T>;
|
|
12
|
+
next_page_token: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
13
|
+
total_size: z.ZodOptional<z.ZodNumber>;
|
|
14
|
+
}> =>
|
|
15
|
+
z.object({
|
|
16
|
+
data: z.array(itemSchema),
|
|
17
|
+
next_page_token: z.string().nullable().optional(), // Real API sometimes returns undefined
|
|
18
|
+
total_size: z.number().int().optional(), // Used by Languages endpoint
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Generic Collection type for paginated responses
|
|
23
|
+
*/
|
|
24
|
+
export type Collection<T> = {
|
|
25
|
+
data: T[];
|
|
26
|
+
next_page_token: string | null;
|
|
27
|
+
total_size?: number;
|
|
28
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
3
|
+
const _HighlightSchema = z.object({
|
|
4
|
+
/** Bible version identifier */
|
|
5
|
+
version_id: z.number().int().positive(),
|
|
6
|
+
/** Passage identifier (e.g., "MAT.1.1") */
|
|
7
|
+
passage_id: z.string(),
|
|
8
|
+
/** Hex color code (6 digits, no #) */
|
|
9
|
+
color: z.string().regex(/^[0-9a-f]{6}$/),
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
export type Highlight = z.infer<typeof _HighlightSchema>;
|
|
13
|
+
|
|
14
|
+
const _CreateHighlightSchema = z.object({
|
|
15
|
+
/** Bible version identifier */
|
|
16
|
+
version_id: z.number().int().positive(),
|
|
17
|
+
/** Passage identifier (e.g., "MAT.1.1") */
|
|
18
|
+
passage_id: z.string(),
|
|
19
|
+
/** Hex color code (6 digits, no #) */
|
|
20
|
+
color: z.string().regex(/^[0-9a-f]{6}$/),
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
export type CreateHighlight = z.infer<typeof _CreateHighlightSchema>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export * from './bible-index';
|
|
2
|
+
export * from './book';
|
|
3
|
+
export * from './chapter';
|
|
4
|
+
export * from './collection';
|
|
5
|
+
export * from './highlight';
|
|
6
|
+
export * from './language';
|
|
7
|
+
export * from './passage';
|
|
8
|
+
export * from './version';
|
|
9
|
+
export * from './verse';
|
|
10
|
+
export * from './votd';
|
|
11
|
+
export * from './user';
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
3
|
+
export const LanguageSchema = z.object({
|
|
4
|
+
/** BCP 47 language identifier (e.g., "en") */
|
|
5
|
+
id: z
|
|
6
|
+
.string()
|
|
7
|
+
.regex(/^[a-z]{2,3}(?:-[A-Z][a-z]{3})?$/, 'BCP 47 id limited to language or language+script'),
|
|
8
|
+
/** ISO 639 language code */
|
|
9
|
+
language: z.string().regex(/^[a-z]{2,3}$/, 'ISO 639 canonical language subtag'),
|
|
10
|
+
/** ISO 15924 script code (e.g., "Latn") */
|
|
11
|
+
script: z
|
|
12
|
+
.string()
|
|
13
|
+
.regex(/^[A-Z][a-z]{3}$/, 'Script must match ISO 15924 format (e.g., "Latn")')
|
|
14
|
+
.nullable()
|
|
15
|
+
.optional(),
|
|
16
|
+
/** Script name (e.g., "Latin") */
|
|
17
|
+
script_name: z.string().nullable().optional(),
|
|
18
|
+
/** Language aliases */
|
|
19
|
+
aliases: z.array(z.string()).optional(),
|
|
20
|
+
/** Display names for different locales */
|
|
21
|
+
display_names: z.record(z.string(), z.string()).optional(),
|
|
22
|
+
/** Available scripts for this language (e.g., ["Cyrl", "Latn"]) */
|
|
23
|
+
scripts: z.array(z.string().regex(/^[A-Z][a-z]{3}$/, 'ISO 15924 script code')).optional(),
|
|
24
|
+
/** Language variants (e.g., ["1996", "fonipa"]) */
|
|
25
|
+
variants: z.array(z.string()).optional(),
|
|
26
|
+
/** ISO 3166-1 alpha-2 country codes (e.g., ["RS", "BA", "ME"]) */
|
|
27
|
+
countries: z.array(z.string().regex(/^[A-Z]{2}$/, 'ISO 3166-1 alpha-2 country code')).optional(),
|
|
28
|
+
/** Text direction (ltr or rtl) */
|
|
29
|
+
text_direction: z.enum(['ltr', 'rtl']).optional(),
|
|
30
|
+
/** Writing population count */
|
|
31
|
+
writing_population: z.number().int().optional(),
|
|
32
|
+
/** Speaking population count */
|
|
33
|
+
speaking_population: z.number().int().optional(),
|
|
34
|
+
/** Default Bible version ID for this language */
|
|
35
|
+
default_bible_version_id: z.number().int().nullable().optional(),
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
export type Language = z.infer<typeof LanguageSchema>;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
3
|
+
export const BiblePassageSchema = z.object({
|
|
4
|
+
/** Passage identifier (e.g., "MAT.1.1") */
|
|
5
|
+
id: z.string(),
|
|
6
|
+
/** Passage content text */
|
|
7
|
+
content: z.string(),
|
|
8
|
+
/** Bible version identifier */
|
|
9
|
+
bible_id: z.number().int().positive(),
|
|
10
|
+
/** Human-readable reference (e.g., "Matthew 1:1") */
|
|
11
|
+
human_reference: z.string(),
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
export type BiblePassage = z.infer<typeof BiblePassageSchema>;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { BookUsfmSchema } from './book';
|
|
3
|
+
|
|
4
|
+
export const BibleVerseSchema = z.object({
|
|
5
|
+
/** Verse identifier (e.g., "1") */
|
|
6
|
+
id: z.string(),
|
|
7
|
+
/** Book identifier (e.g., "MAT") */
|
|
8
|
+
book_id: BookUsfmSchema,
|
|
9
|
+
/** Chapter identifier (e.g., "1") */
|
|
10
|
+
chapter_id: z.string(),
|
|
11
|
+
/** Passage identifier (e.g., "MAT.1.1") */
|
|
12
|
+
passage_id: z.string(),
|
|
13
|
+
/** Human-readable reference (e.g., "Matthew 1:1") */
|
|
14
|
+
reference: z.string(),
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
export type BibleVerse = z.infer<typeof BibleVerseSchema>;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { BookUsfmSchema } from './book';
|
|
3
|
+
|
|
4
|
+
export const BibleVersionSchema = z.object({
|
|
5
|
+
/** Bible version identifier */
|
|
6
|
+
id: z.number().int(),
|
|
7
|
+
/** Bible version abbreviation */
|
|
8
|
+
abbreviation: z.string(),
|
|
9
|
+
/** Long copyright text */
|
|
10
|
+
copyright_long: z.string(),
|
|
11
|
+
/** Short copyright text */
|
|
12
|
+
copyright_short: z.string(),
|
|
13
|
+
/** Bible information text */
|
|
14
|
+
info: z.string().nullable().optional(),
|
|
15
|
+
/** Publisher URL */
|
|
16
|
+
publisher_url: z.url().nullable().optional(),
|
|
17
|
+
/** Language tag (e.g., "en") */
|
|
18
|
+
language_tag: z.string(),
|
|
19
|
+
/** Localized abbreviation */
|
|
20
|
+
local_abbreviation: z.string(),
|
|
21
|
+
/** Localized title */
|
|
22
|
+
local_title: z.string(),
|
|
23
|
+
/** Full title */
|
|
24
|
+
title: z.string(),
|
|
25
|
+
/** Array of book identifiers (e.g., ["GEN", "EXO", "LEV"]) */
|
|
26
|
+
books: z.array(BookUsfmSchema),
|
|
27
|
+
/** YouVersion deep link URL */
|
|
28
|
+
youversion_deep_link: z.url(),
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
export type BibleVersion = z.infer<typeof BibleVersionSchema>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
3
|
+
export const VOTDSchema = z.object({
|
|
4
|
+
/** Day of year (1-366) */
|
|
5
|
+
day: z.number().int().min(1).max(366),
|
|
6
|
+
/** Passage identifier (e.g., "JHN.3.16") */
|
|
7
|
+
passage_id: z.string(),
|
|
8
|
+
});
|
|
9
|
+
|
|
10
|
+
export type VOTD = z.infer<typeof VOTDSchema>;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
SignInWithYouVersionPermission,
|
|
3
|
+
SignInWithYouVersionResult,
|
|
4
|
+
} from '../SignInWithYouVersionResult';
|
|
5
|
+
|
|
6
|
+
export type SignInWithYouVersionPermissionValues =
|
|
7
|
+
(typeof SignInWithYouVersionPermission)[keyof typeof SignInWithYouVersionPermission];
|
|
8
|
+
|
|
9
|
+
export interface AuthenticationState {
|
|
10
|
+
isAuthenticated: boolean;
|
|
11
|
+
isLoading: boolean;
|
|
12
|
+
accessToken: string | null;
|
|
13
|
+
result: SignInWithYouVersionResult | null;
|
|
14
|
+
error: Error | null;
|
|
15
|
+
}
|
|
@@ -0,0 +1,116 @@
|
|
|
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';
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
// Re-export all schema-derived types from schemas
|
|
2
|
+
export type { BibleVersion } from '../schemas/version';
|
|
3
|
+
export type { BibleBook, CANON } from '../schemas/book';
|
|
4
|
+
export type { BibleChapter } from '../schemas/chapter';
|
|
5
|
+
export type { BibleVerse } from '../schemas/verse';
|
|
6
|
+
export type { BiblePassage } from '../schemas/passage';
|
|
7
|
+
export type { VOTD } from '../schemas/votd';
|
|
8
|
+
export type {
|
|
9
|
+
BibleIndex,
|
|
10
|
+
BibleIndexBook,
|
|
11
|
+
BibleIndexChapter,
|
|
12
|
+
BibleIndexVerse,
|
|
13
|
+
} from '../schemas/bible-index';
|
|
14
|
+
export type { Language } from '../schemas/language';
|
|
15
|
+
export type { User } from '../schemas/user';
|
|
16
|
+
export type { Highlight, CreateHighlight } from '../schemas/highlight';
|
|
17
|
+
export type { Collection } from '../schemas/collection';
|
|
18
|
+
|
|
19
|
+
// Re-export internal/non-API types
|
|
20
|
+
export type { ApiConfig } from './api-config';
|
|
21
|
+
export type { AuthenticationState, SignInWithYouVersionPermissionValues } from './auth';
|
|
22
|
+
export type { HighlightColor } from './highlight';
|