@youversion/platform-core 1.20.1 → 1.21.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 +21 -10
- package/AGENTS.md +47 -2
- package/CHANGELOG.md +22 -0
- package/dist/browser-DzQ1yOHv.d.cts +69 -0
- package/dist/browser-DzQ1yOHv.d.ts +69 -0
- package/dist/browser.cjs +270 -0
- package/dist/browser.d.cts +1 -0
- package/dist/browser.d.ts +1 -0
- package/dist/browser.js +6 -0
- package/dist/chunk-2Z2S2WY3.js +245 -0
- package/dist/index.cjs +250 -3
- package/dist/index.d.cts +45 -41
- package/dist/index.d.ts +45 -41
- package/dist/index.js +19 -2
- package/dist/server.cjs +275 -0
- package/dist/server.d.cts +25 -0
- package/dist/server.d.ts +25 -0
- package/dist/server.js +18 -0
- package/package.json +21 -3
- package/src/bible-html-transformer-server.ts +37 -0
- package/src/bible-html-transformer.server.test.ts +151 -0
- package/src/bible-html-transformer.test.ts +403 -0
- package/src/bible-html-transformer.ts +378 -0
- package/src/bible.ts +10 -0
- package/src/browser.ts +4 -0
- package/src/index.ts +5 -0
- package/src/schemas/book.ts +3 -5
- package/src/server.ts +2 -0
- package/src/types/index.ts +32 -8
- package/src/utils/constants.ts +5 -3
- package/src/__tests__/mocks/configuration.ts +0 -53
- package/src/__tests__/mocks/jwt.ts +0 -93
- package/src/__tests__/mocks/tokens.ts +0 -69
- package/src/highlight.ts +0 -16
- package/src/types/api-config.ts +0 -7
- package/src/types/auth.ts +0 -18
- package/src/types/highlight.ts +0 -9
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
import { vi } from 'vitest';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Creates a mock OAuth token response for testing
|
|
5
|
-
* @param overrides Optional properties to override the default values
|
|
6
|
-
*/
|
|
7
|
-
export const createMockTokenResponse = (
|
|
8
|
-
overrides: Record<string, unknown> = {},
|
|
9
|
-
): Record<string, unknown> => ({
|
|
10
|
-
access_token: 'access-token-123',
|
|
11
|
-
expires_in: 3600,
|
|
12
|
-
id_token:
|
|
13
|
-
'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyLCJlbWFpbCI6ImpvaG5AZXhhbXBsZS5jb20iLCJwcm9maWxlX3BpY3R1cmUiOiJodHRwczovL2V4YW1wbGUuY29tL2F2YXRhci5qcGcifQ.invalid-signature',
|
|
14
|
-
refresh_token: 'refresh-token-456',
|
|
15
|
-
scope: 'bibles highlights openid',
|
|
16
|
-
token_type: 'Bearer',
|
|
17
|
-
...overrides,
|
|
18
|
-
});
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* Creates a mock fetch response for testing
|
|
22
|
-
* @param data The response data
|
|
23
|
-
* @param options Optional properties to override the default response
|
|
24
|
-
*/
|
|
25
|
-
export const createMockFetchResponse = (
|
|
26
|
-
data: unknown,
|
|
27
|
-
options: Record<string, unknown> = {},
|
|
28
|
-
): Record<string, unknown> => ({
|
|
29
|
-
ok: true,
|
|
30
|
-
status: 200,
|
|
31
|
-
statusText: 'OK',
|
|
32
|
-
json: vi.fn().mockResolvedValue(data),
|
|
33
|
-
text: vi.fn().mockResolvedValue(JSON.stringify(data)),
|
|
34
|
-
clone: vi.fn(() => ({
|
|
35
|
-
text: vi.fn().mockResolvedValue(JSON.stringify(data)),
|
|
36
|
-
})),
|
|
37
|
-
...options,
|
|
38
|
-
});
|
|
39
|
-
|
|
40
|
-
/**
|
|
41
|
-
* Creates a mock error fetch response for testing
|
|
42
|
-
* @param status The HTTP status code
|
|
43
|
-
* @param statusText The HTTP status text
|
|
44
|
-
*/
|
|
45
|
-
export const createMockErrorFetchResponse = (
|
|
46
|
-
status: number,
|
|
47
|
-
statusText: string,
|
|
48
|
-
): Record<string, unknown> => ({
|
|
49
|
-
ok: false,
|
|
50
|
-
status,
|
|
51
|
-
statusText,
|
|
52
|
-
json: vi.fn().mockRejectedValue(new Error('Response not JSON')),
|
|
53
|
-
text: vi.fn().mockResolvedValue(''),
|
|
54
|
-
});
|
|
55
|
-
|
|
56
|
-
/**
|
|
57
|
-
* Creates a mock refresh token response for testing
|
|
58
|
-
* @param overrides Optional properties to override the default values
|
|
59
|
-
*/
|
|
60
|
-
export const createMockRefreshTokenResponse = (
|
|
61
|
-
overrides: Record<string, unknown> = {},
|
|
62
|
-
): Record<string, unknown> => ({
|
|
63
|
-
access_token: 'new-access-token',
|
|
64
|
-
expires_in: 3600,
|
|
65
|
-
refresh_token: 'new-refresh-token',
|
|
66
|
-
scope: 'bibles highlights openid',
|
|
67
|
-
token_type: 'Bearer',
|
|
68
|
-
...overrides,
|
|
69
|
-
});
|
package/src/highlight.ts
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import type { HighlightColor } from './types';
|
|
2
|
-
|
|
3
|
-
export const HIGHLIGHT_COLORS: HighlightColor[] = [
|
|
4
|
-
{ id: 0, color: '#fffe00', label: 'Yellow' },
|
|
5
|
-
{ id: 1, color: '#5dff79', label: 'Green' },
|
|
6
|
-
{ id: 2, color: '#00d6ff', label: 'Blue' },
|
|
7
|
-
{ id: 3, color: '#ffc66f', label: 'Orange' },
|
|
8
|
-
{ id: 4, color: '#ff95ef', label: 'Pink' },
|
|
9
|
-
] as const;
|
|
10
|
-
|
|
11
|
-
export function hexToRgba(hex: string, alpha: number): string {
|
|
12
|
-
const r = parseInt(hex.slice(1, 3), 16);
|
|
13
|
-
const g = parseInt(hex.slice(3, 5), 16);
|
|
14
|
-
const b = parseInt(hex.slice(5, 7), 16);
|
|
15
|
-
return `rgba(${r}, ${g}, ${b}, ${alpha})`;
|
|
16
|
-
}
|
package/src/types/api-config.ts
DELETED
package/src/types/auth.ts
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
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
|
-
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
|
-
}
|
|
17
|
-
|
|
18
|
-
export type AuthenticationScopes = 'profile' | 'email';
|