@youversion/platform-core 1.8.0 → 1.8.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/.turbo/turbo-build.log +4 -4
- package/AGENTS.md +79 -0
- package/CHANGELOG.md +6 -0
- package/package.json +1 -1
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
> @youversion/platform-core@1.8.
|
|
2
|
+
> @youversion/platform-core@1.8.1 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
|
|
@@ -9,10 +9,10 @@
|
|
|
9
9
|
[34mCJS[39m Build start
|
|
10
10
|
[34mESM[39m Build start
|
|
11
11
|
[32mESM[39m [1mdist/index.js [22m[32m41.76 KB[39m
|
|
12
|
-
[32mESM[39m ⚡️ Build success in
|
|
12
|
+
[32mESM[39m ⚡️ Build success in 32ms
|
|
13
13
|
[32mCJS[39m [1mdist/index.cjs [22m[32m43.59 KB[39m
|
|
14
|
-
[32mCJS[39m ⚡️ Build success in
|
|
14
|
+
[32mCJS[39m ⚡️ Build success in 33ms
|
|
15
15
|
[34mDTS[39m Build start
|
|
16
|
-
[32mDTS[39m ⚡️ Build success in
|
|
16
|
+
[32mDTS[39m ⚡️ Build success in 1718ms
|
|
17
17
|
[32mDTS[39m [1mdist/index.d.cts [22m[32m32.92 KB[39m
|
|
18
18
|
[32mDTS[39m [1mdist/index.d.ts [22m[32m32.92 KB[39m
|
package/AGENTS.md
ADDED
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
# @youversion/platform-core
|
|
2
|
+
|
|
3
|
+
## OVERVIEW
|
|
4
|
+
Foundation package providing pure TypeScript API clients for YouVersion services with zero React dependencies.
|
|
5
|
+
|
|
6
|
+
**Related packages:**
|
|
7
|
+
- For React hooks wrapping these clients → see `packages/hooks/AGENTS.md`
|
|
8
|
+
- For pre-built UI components → see `packages/ui/AGENTS.md`
|
|
9
|
+
|
|
10
|
+
## STRUCTURE
|
|
11
|
+
```
|
|
12
|
+
schemas/ # Zod schemas for all data types (schema-first design)
|
|
13
|
+
client.ts # ApiClient - main HTTP client
|
|
14
|
+
bible.ts # BibleClient - Bible data operations
|
|
15
|
+
languages.ts # LanguagesClient - language data
|
|
16
|
+
highlights.ts # HighlightsClient - user highlights
|
|
17
|
+
YouVersionAPI.ts # Base YouVersion API client
|
|
18
|
+
SignInWithYouVersionPKCE.ts # PKCE auth implementation
|
|
19
|
+
StorageStrategy.ts # Storage interface (SessionStorage, MemoryStorage)
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## PUBLIC API
|
|
23
|
+
- `ApiClient`: Main HTTP client with auth handling
|
|
24
|
+
- `BibleClient`: Fetch Bibles, chapters, verses, versions
|
|
25
|
+
- `LanguagesClient`: Get available languages
|
|
26
|
+
- `HighlightsClient`: Manage user highlights
|
|
27
|
+
- `SignInWithYouVersionPKCE()`: PKCE auth flow function
|
|
28
|
+
- `SessionStorage`, `MemoryStorage`: Storage strategies
|
|
29
|
+
|
|
30
|
+
## DOs / DON'Ts
|
|
31
|
+
|
|
32
|
+
✅ Do: Keep this package **framework-agnostic** (no React, no DOM, no browser-only APIs)
|
|
33
|
+
✅ Do: Define all input/output types in `schemas/` using Zod; schemas are the single source of truth
|
|
34
|
+
✅ Do: Reuse `YouVersionAPI` base client for new service clients
|
|
35
|
+
✅ Do: Parse API responses with Zod schemas for validation
|
|
36
|
+
|
|
37
|
+
❌ Don't: Import React, `window`, `document`, or browser storage APIs directly
|
|
38
|
+
❌ Don't: Bypass Zod validation for API responses
|
|
39
|
+
❌ Don't: Implement UI, hooks, or React state here
|
|
40
|
+
|
|
41
|
+
## ADDING A NEW ENDPOINT OR CLIENT
|
|
42
|
+
|
|
43
|
+
1. **Define types** in `schemas/` using Zod:
|
|
44
|
+
- Request payload schema
|
|
45
|
+
- Response schema
|
|
46
|
+
2. **Extend or add a client**:
|
|
47
|
+
- Prefer extending existing clients (e.g., `BibleClient`) when the endpoint logically belongs there
|
|
48
|
+
- Otherwise, create `xyz.ts` with a new `XyzClient` that composes `YouVersionAPI`
|
|
49
|
+
3. **Wire validation**:
|
|
50
|
+
- Parse API responses with the corresponding Zod schema
|
|
51
|
+
- Throw or return typed errors on validation failure
|
|
52
|
+
4. **Export from public API**:
|
|
53
|
+
- Expose the new client/types from the main entry file so consumers can import them
|
|
54
|
+
5. **Add tests**:
|
|
55
|
+
- Unit tests with MSW for mock responses
|
|
56
|
+
- Optional integration tests guarded by `INTEGRATION_TESTS=true`
|
|
57
|
+
|
|
58
|
+
## HTTP & CONFIGURATION
|
|
59
|
+
|
|
60
|
+
- HTTP client: Native `fetch` API
|
|
61
|
+
- Base client: `YouVersionAPI` handles base URL, headers, auth tokens
|
|
62
|
+
- All clients extend or compose `YouVersionAPI` for consistent HTTP behavior
|
|
63
|
+
|
|
64
|
+
## CONVENTIONS
|
|
65
|
+
- Schema-first: All types defined in schemas/*.ts using Zod
|
|
66
|
+
- Zero React: Pure TypeScript, no React dependencies
|
|
67
|
+
- Storage: Abstract via StorageStrategy interface
|
|
68
|
+
- Auth: PKCE flow with pluggable storage backends
|
|
69
|
+
- Error handling: Zod validation for all API responses
|
|
70
|
+
|
|
71
|
+
## TESTING
|
|
72
|
+
|
|
73
|
+
- Run tests: `pnpm --filter @youversion/platform-core test`
|
|
74
|
+
- Framework: Vitest with Node environment
|
|
75
|
+
- Mocking: MSW for API endpoints
|
|
76
|
+
- Integration tests:
|
|
77
|
+
- Guarded by `INTEGRATION_TESTS=true`
|
|
78
|
+
- Only run in CI or when explicitly needed; default to mocked tests
|
|
79
|
+
- Coverage: @vitest/coverage-v8
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# @youversion/platform-core
|
|
2
2
|
|
|
3
|
+
## 1.8.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 607be3c: Refactor verse HTML transformation to support verse-level highlighting. Extract HTML processing logic to `verse-html-utils.ts` with new `wrapVerseContent()` function that wraps verse content in CSS-targetable `<span class="yv-v">` elements. Simplify footnote extraction using wrapped verse structure. Remove CSS rule preventing text wrapping. Add comprehensive test coverage for verse wrapping behavior.
|
|
8
|
+
|
|
3
9
|
## 1.8.0
|
|
4
10
|
|
|
5
11
|
### Minor Changes
|