@youversion/platform-core 0.8.1 → 0.9.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 +23 -0
- package/dist/index.cjs +116 -169
- package/dist/index.d.cts +39 -35
- package/dist/index.d.ts +39 -35
- package/dist/index.js +116 -168
- package/package.json +2 -1
- package/src/SignInWithYouVersionPKCE.ts +7 -7
- package/src/SignInWithYouVersionResult.ts +0 -6
- package/src/Users.ts +5 -29
- package/src/__tests__/MockBibles.ts +1196 -1294
- package/src/__tests__/MockChapters.ts +171 -1950
- package/src/__tests__/MockPassages.ts +7 -14
- package/src/__tests__/MockVerses.ts +60 -75
- package/src/__tests__/MockVersions.ts +30 -30
- package/src/__tests__/SignInWithYouVersionPKCE.test.ts +8 -77
- package/src/__tests__/SignInWithYouVersionResult.test.ts +0 -2
- package/src/__tests__/Users.test.ts +4 -38
- package/src/__tests__/bible.test.ts +9 -18
- package/src/__tests__/client.test.ts +10 -1
- package/src/__tests__/setup.ts +12 -9
- package/src/bible.ts +1 -1
- package/src/index.ts +0 -1
- package/src/schemas/book.ts +5 -8
- package/src/schemas/chapter.ts +3 -12
- package/src/schemas/passage.ts +1 -3
- package/src/schemas/verse.ts +2 -7
- package/src/schemas/version.ts +2 -2
- package/src/types/auth.ts +2 -0
- package/src/types/index.ts +5 -1
- package/src/utils/constants.ts +103 -103
- package/src/URLBuilder.ts +0 -50
- package/src/__tests__/URLBuilder.test.ts +0 -190
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
> @youversion/platform-core@0.
|
|
2
|
+
> @youversion/platform-core@0.9.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
|
-
[32mESM[39m [1mdist/index.js [22m[
|
|
12
|
-
[32mESM[39m ⚡️ Build success in
|
|
13
|
-
[32mCJS[39m [1mdist/index.cjs [22m[
|
|
14
|
-
[32mCJS[39m ⚡️ Build success in
|
|
11
|
+
[32mESM[39m [1mdist/index.js [22m[32m40.66 KB[39m
|
|
12
|
+
[32mESM[39m ⚡️ Build success in 31ms
|
|
13
|
+
[32mCJS[39m [1mdist/index.cjs [22m[32m42.47 KB[39m
|
|
14
|
+
[32mCJS[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 1699ms
|
|
17
|
+
[32mDTS[39m [1mdist/index.d.cts [22m[32m31.83 KB[39m
|
|
18
|
+
[32mDTS[39m [1mdist/index.d.ts [22m[32m31.83 KB[39m
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,28 @@
|
|
|
1
1
|
# @youversion/platform-core
|
|
2
2
|
|
|
3
|
+
## 0.9.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- e4f93b6: Update authentication system with enhanced OAuth scopes and API schema alignment
|
|
8
|
+
|
|
9
|
+
Key Changes:
|
|
10
|
+
- Added profile and email scopes to OAuth authentication
|
|
11
|
+
- Updated book resource schema to match new API endpoints
|
|
12
|
+
- Removed deprecated URLBuilder functionality
|
|
13
|
+
|
|
14
|
+
Breaking Changes:
|
|
15
|
+
- Book Schema: Must use the new updated book schema in any APIs returning bible book data Please enter a summary for your changes.
|
|
16
|
+
|
|
17
|
+
## 0.8.2
|
|
18
|
+
|
|
19
|
+
### Patch Changes
|
|
20
|
+
|
|
21
|
+
- 93be9ef: Update types, zod schemas, and test mocks for the following updated endpoints:
|
|
22
|
+
- get bible books
|
|
23
|
+
- get bible chapters
|
|
24
|
+
- get bible verses
|
|
25
|
+
|
|
3
26
|
## 0.8.1
|
|
4
27
|
|
|
5
28
|
### Patch Changes
|
package/dist/index.cjs
CHANGED
|
@@ -30,7 +30,6 @@ __export(index_exports, {
|
|
|
30
30
|
SessionStorageStrategy: () => SessionStorageStrategy,
|
|
31
31
|
SignInWithYouVersionPermission: () => SignInWithYouVersionPermission,
|
|
32
32
|
SignInWithYouVersionResult: () => SignInWithYouVersionResult,
|
|
33
|
-
URLBuilder: () => URLBuilder,
|
|
34
33
|
YouVersionAPI: () => YouVersionAPI,
|
|
35
34
|
YouVersionAPIUsers: () => YouVersionAPIUsers,
|
|
36
35
|
YouVersionPlatformConfiguration: () => YouVersionPlatformConfiguration,
|
|
@@ -232,7 +231,7 @@ var BibleClient = class {
|
|
|
232
231
|
/**
|
|
233
232
|
* Fetches all books for a given Bible version.
|
|
234
233
|
* @param versionId The version ID.
|
|
235
|
-
* @param canon Optional canon filter (
|
|
234
|
+
* @param canon Optional canon filter ("old_testament", 'new_testament', 'deuterocanon').
|
|
236
235
|
* @returns An array of BibleBook objects.
|
|
237
236
|
*/
|
|
238
237
|
async getBooks(versionId, canon) {
|
|
@@ -732,7 +731,7 @@ var YouVersionUserInfo = class {
|
|
|
732
731
|
|
|
733
732
|
// src/SignInWithYouVersionPKCE.ts
|
|
734
733
|
var SignInWithYouVersionPKCEAuthorizationRequestBuilder = class {
|
|
735
|
-
static async make(appKey,
|
|
734
|
+
static async make(appKey, redirectURL, scopes) {
|
|
736
735
|
const codeVerifier = this.randomURLSafeString(32);
|
|
737
736
|
const codeChallenge = await this.codeChallenge(codeVerifier);
|
|
738
737
|
const state = this.randomURLSafeString(24);
|
|
@@ -743,10 +742,10 @@ var SignInWithYouVersionPKCEAuthorizationRequestBuilder = class {
|
|
|
743
742
|
state,
|
|
744
743
|
nonce
|
|
745
744
|
};
|
|
746
|
-
const url = this.authorizeURL(appKey,
|
|
745
|
+
const url = this.authorizeURL(appKey, redirectURL, parameters, scopes);
|
|
747
746
|
return { url, parameters };
|
|
748
747
|
}
|
|
749
|
-
static authorizeURL(appKey,
|
|
748
|
+
static authorizeURL(appKey, redirectURL, parameters, scopes) {
|
|
750
749
|
const components = new URL(`https://${YouVersionPlatformConfiguration.apiHost}/auth/authorize`);
|
|
751
750
|
const redirectUrlString = redirectURL.toString().endsWith("/") ? redirectURL.toString().slice(0, -1) : redirectURL.toString();
|
|
752
751
|
const queryParams = new URLSearchParams({
|
|
@@ -762,7 +761,7 @@ var SignInWithYouVersionPKCEAuthorizationRequestBuilder = class {
|
|
|
762
761
|
if (installId) {
|
|
763
762
|
queryParams.set("x-yvp-installation-id", installId);
|
|
764
763
|
}
|
|
765
|
-
const scopeValue = this.scopeValue(
|
|
764
|
+
const scopeValue = this.scopeValue(scopes || []);
|
|
766
765
|
if (scopeValue) {
|
|
767
766
|
queryParams.set("scope", scopeValue);
|
|
768
767
|
}
|
|
@@ -802,8 +801,8 @@ var SignInWithYouVersionPKCEAuthorizationRequestBuilder = class {
|
|
|
802
801
|
const base64 = btoa(String.fromCharCode.apply(null, Array.from(data)));
|
|
803
802
|
return base64.replace(/\+/g, "-").replace(/\//g, "_").replace(/=/g, "");
|
|
804
803
|
}
|
|
805
|
-
static scopeValue(
|
|
806
|
-
const scopeArray = Array.from(
|
|
804
|
+
static scopeValue(scopes) {
|
|
805
|
+
const scopeArray = Array.from(scopes).sort();
|
|
807
806
|
let scopeWithOpenID = scopeArray.join(" ");
|
|
808
807
|
if (!scopeWithOpenID.split(" ").includes("openid")) {
|
|
809
808
|
scopeWithOpenID += (scopeWithOpenID === "" ? "" : " ") + "openid";
|
|
@@ -825,7 +824,6 @@ var SignInWithYouVersionResult = class {
|
|
|
825
824
|
expiryDate;
|
|
826
825
|
refreshToken;
|
|
827
826
|
idToken;
|
|
828
|
-
permissions;
|
|
829
827
|
yvpUserId;
|
|
830
828
|
name;
|
|
831
829
|
profilePicture;
|
|
@@ -835,7 +833,6 @@ var SignInWithYouVersionResult = class {
|
|
|
835
833
|
expiresIn,
|
|
836
834
|
refreshToken,
|
|
837
835
|
idToken,
|
|
838
|
-
permissions,
|
|
839
836
|
yvpUserId,
|
|
840
837
|
name,
|
|
841
838
|
profilePicture,
|
|
@@ -845,7 +842,6 @@ var SignInWithYouVersionResult = class {
|
|
|
845
842
|
this.expiryDate = expiresIn ? new Date(Date.now() + expiresIn * 1e3) : /* @__PURE__ */ new Date();
|
|
846
843
|
this.refreshToken = refreshToken;
|
|
847
844
|
this.idToken = idToken;
|
|
848
|
-
this.permissions = permissions;
|
|
849
845
|
this.yvpUserId = yvpUserId;
|
|
850
846
|
this.name = name;
|
|
851
847
|
this.profilePicture = profilePicture;
|
|
@@ -858,22 +854,22 @@ var YouVersionAPIUsers = class {
|
|
|
858
854
|
/**
|
|
859
855
|
* Presents the YouVersion login flow to the user and returns the login result upon completion.
|
|
860
856
|
*
|
|
861
|
-
* This function authenticates the user with YouVersion
|
|
857
|
+
* This function authenticates the user with YouVersion.
|
|
862
858
|
* The function redirects to the YouVersion authorization URL and expects the callback to be handled separately.
|
|
863
859
|
*
|
|
864
|
-
* @param
|
|
860
|
+
* @param scopes - The scopes given to the authentication call.
|
|
865
861
|
* @param redirectURL - The URL to redirect back to after authentication.
|
|
866
862
|
* @throws An error if authentication fails or configuration is invalid.
|
|
867
863
|
*/
|
|
868
|
-
static async signIn(
|
|
864
|
+
static async signIn(redirectURL, scopes) {
|
|
869
865
|
const appKey = YouVersionPlatformConfiguration.appKey;
|
|
870
866
|
if (!appKey) {
|
|
871
867
|
throw new Error("YouVersionPlatformConfiguration.appKey must be set before calling signIn");
|
|
872
868
|
}
|
|
873
869
|
const authorizationRequest = await SignInWithYouVersionPKCEAuthorizationRequestBuilder.make(
|
|
874
870
|
appKey,
|
|
875
|
-
|
|
876
|
-
|
|
871
|
+
new URL(redirectURL),
|
|
872
|
+
scopes
|
|
877
873
|
);
|
|
878
874
|
localStorage.setItem(
|
|
879
875
|
"youversion-auth-code-verifier",
|
|
@@ -973,17 +969,11 @@ var YouVersionAPIUsers = class {
|
|
|
973
969
|
*/
|
|
974
970
|
static extractSignInResult(tokens) {
|
|
975
971
|
const idClaims = this.decodeJWT(tokens.id_token);
|
|
976
|
-
const permissions = tokens.scope.split(" ").map((p) => p.trim()).filter((p) => p.length > 0).filter(
|
|
977
|
-
(p) => Object.values(SignInWithYouVersionPermission).includes(
|
|
978
|
-
p
|
|
979
|
-
)
|
|
980
|
-
);
|
|
981
972
|
const resultData = {
|
|
982
973
|
accessToken: tokens.access_token,
|
|
983
974
|
expiresIn: tokens.expires_in,
|
|
984
975
|
refreshToken: tokens.refresh_token,
|
|
985
976
|
idToken: tokens.id_token,
|
|
986
|
-
permissions,
|
|
987
977
|
yvpUserId: idClaims.sub,
|
|
988
978
|
name: idClaims.name,
|
|
989
979
|
profilePicture: idClaims.profile_picture,
|
|
@@ -1102,12 +1092,7 @@ var YouVersionAPIUsers = class {
|
|
|
1102
1092
|
accessToken: tokens.access_token,
|
|
1103
1093
|
expiresIn: tokens.expires_in,
|
|
1104
1094
|
refreshToken: tokens.refresh_token,
|
|
1105
|
-
idToken: existingIdToken
|
|
1106
|
-
permissions: tokens.scope.split(" ").map((p) => p.trim()).filter((p) => p.length > 0).filter(
|
|
1107
|
-
(p) => Object.values(SignInWithYouVersionPermission).includes(
|
|
1108
|
-
p
|
|
1109
|
-
)
|
|
1110
|
-
)
|
|
1095
|
+
idToken: existingIdToken
|
|
1111
1096
|
});
|
|
1112
1097
|
YouVersionPlatformConfiguration.saveAuthData(
|
|
1113
1098
|
result.accessToken || null,
|
|
@@ -1177,43 +1162,6 @@ var YouVersionAPI = class {
|
|
|
1177
1162
|
}
|
|
1178
1163
|
};
|
|
1179
1164
|
|
|
1180
|
-
// src/URLBuilder.ts
|
|
1181
|
-
var URLBuilder = class {
|
|
1182
|
-
static get baseURL() {
|
|
1183
|
-
return new URL(`https://${YouVersionPlatformConfiguration.apiHost}`);
|
|
1184
|
-
}
|
|
1185
|
-
static authURL(appKey, requiredPermissions = /* @__PURE__ */ new Set(), optionalPermissions = /* @__PURE__ */ new Set()) {
|
|
1186
|
-
if (typeof appKey !== "string" || appKey.trim().length === 0) {
|
|
1187
|
-
throw new Error("appKey must be a non-empty string");
|
|
1188
|
-
}
|
|
1189
|
-
try {
|
|
1190
|
-
const url = new URL(this.baseURL);
|
|
1191
|
-
url.pathname = "/auth/login";
|
|
1192
|
-
const searchParams = new URLSearchParams();
|
|
1193
|
-
searchParams.append("APP_KEY", appKey);
|
|
1194
|
-
searchParams.append("language", "en");
|
|
1195
|
-
if (requiredPermissions.size > 0) {
|
|
1196
|
-
const requiredList = Array.from(requiredPermissions).map((p) => p.toString());
|
|
1197
|
-
searchParams.append("required_perms", requiredList.join(","));
|
|
1198
|
-
}
|
|
1199
|
-
if (optionalPermissions.size > 0) {
|
|
1200
|
-
const optionalList = Array.from(optionalPermissions).map((p) => p.toString());
|
|
1201
|
-
searchParams.append("opt_perms", optionalList.join(","));
|
|
1202
|
-
}
|
|
1203
|
-
const installationId = YouVersionPlatformConfiguration.installationId;
|
|
1204
|
-
if (installationId) {
|
|
1205
|
-
searchParams.append("x-yvp-installation-id", installationId);
|
|
1206
|
-
}
|
|
1207
|
-
url.search = searchParams.toString();
|
|
1208
|
-
return url;
|
|
1209
|
-
} catch (error) {
|
|
1210
|
-
throw new Error(
|
|
1211
|
-
`Failed to construct auth URL: ${error instanceof Error ? error.message : "Unknown error"}`
|
|
1212
|
-
);
|
|
1213
|
-
}
|
|
1214
|
-
}
|
|
1215
|
-
};
|
|
1216
|
-
|
|
1217
1165
|
// src/utils/constants.ts
|
|
1218
1166
|
var BOOK_IDS = [
|
|
1219
1167
|
"GEN",
|
|
@@ -1323,109 +1271,109 @@ var BOOK_IDS = [
|
|
|
1323
1271
|
"LKA"
|
|
1324
1272
|
];
|
|
1325
1273
|
var BOOK_CANON = {
|
|
1326
|
-
GEN: "
|
|
1327
|
-
EXO: "
|
|
1328
|
-
LEV: "
|
|
1329
|
-
NUM: "
|
|
1330
|
-
DEU: "
|
|
1331
|
-
JOS: "
|
|
1332
|
-
JDG: "
|
|
1333
|
-
RUT: "
|
|
1334
|
-
"1SA": "
|
|
1335
|
-
"2SA": "
|
|
1336
|
-
"1KI": "
|
|
1337
|
-
"2KI": "
|
|
1338
|
-
"1CH": "
|
|
1339
|
-
"2CH": "
|
|
1340
|
-
EZR: "
|
|
1341
|
-
NEH: "
|
|
1342
|
-
EST: "
|
|
1343
|
-
JOB: "
|
|
1344
|
-
PSA: "
|
|
1345
|
-
PRO: "
|
|
1346
|
-
ECC: "
|
|
1347
|
-
SNG: "
|
|
1348
|
-
ISA: "
|
|
1349
|
-
JER: "
|
|
1350
|
-
LAM: "
|
|
1351
|
-
EZK: "
|
|
1352
|
-
DAN: "
|
|
1353
|
-
HOS: "
|
|
1354
|
-
JOL: "
|
|
1355
|
-
AMO: "
|
|
1356
|
-
OBA: "
|
|
1357
|
-
JON: "
|
|
1358
|
-
MIC: "
|
|
1359
|
-
NAM: "
|
|
1360
|
-
HAB: "
|
|
1361
|
-
ZEP: "
|
|
1362
|
-
HAG: "
|
|
1363
|
-
ZEC: "
|
|
1364
|
-
MAL: "
|
|
1365
|
-
MAT: "
|
|
1366
|
-
MRK: "
|
|
1367
|
-
LUK: "
|
|
1368
|
-
JHN: "
|
|
1369
|
-
ACT: "
|
|
1370
|
-
ROM: "
|
|
1371
|
-
"1CO": "
|
|
1372
|
-
"2CO": "
|
|
1373
|
-
GAL: "
|
|
1374
|
-
EPH: "
|
|
1375
|
-
PHP: "
|
|
1376
|
-
COL: "
|
|
1377
|
-
"1TH": "
|
|
1378
|
-
"2TH": "
|
|
1379
|
-
"1TI": "
|
|
1380
|
-
"2TI": "
|
|
1381
|
-
TIT: "
|
|
1382
|
-
PHM: "
|
|
1383
|
-
HEB: "
|
|
1384
|
-
JAS: "
|
|
1385
|
-
"1PE": "
|
|
1386
|
-
"2PE": "
|
|
1387
|
-
"1JN": "
|
|
1388
|
-
"2JN": "
|
|
1389
|
-
"3JN": "
|
|
1390
|
-
JUD: "
|
|
1391
|
-
REV: "
|
|
1392
|
-
TOB: "
|
|
1393
|
-
JDT: "
|
|
1394
|
-
ESG: "
|
|
1395
|
-
WIS: "
|
|
1396
|
-
SIR: "
|
|
1397
|
-
BAR: "
|
|
1398
|
-
LJE: "
|
|
1399
|
-
S3Y: "
|
|
1400
|
-
SUS: "
|
|
1401
|
-
BEL: "
|
|
1402
|
-
"1MA": "
|
|
1403
|
-
"2MA": "
|
|
1404
|
-
"3MA": "
|
|
1405
|
-
"4MA": "
|
|
1406
|
-
"1ES": "
|
|
1407
|
-
"2ES": "
|
|
1408
|
-
MAN: "
|
|
1409
|
-
PS2: "
|
|
1410
|
-
ODA: "
|
|
1411
|
-
PSS: "
|
|
1412
|
-
"3ES": "
|
|
1413
|
-
EZA: "
|
|
1414
|
-
"5EZ": "
|
|
1415
|
-
"6EZ": "
|
|
1416
|
-
DAG: "
|
|
1417
|
-
PS3: "
|
|
1418
|
-
"2BA": "
|
|
1419
|
-
LBA: "
|
|
1420
|
-
JUB: "
|
|
1421
|
-
ENO: "
|
|
1422
|
-
"1MQ": "
|
|
1423
|
-
"2MQ": "
|
|
1424
|
-
"3MQ": "
|
|
1425
|
-
REP: "
|
|
1426
|
-
"4BA": "
|
|
1427
|
-
LAO: "
|
|
1428
|
-
LKA: "
|
|
1274
|
+
GEN: "old_testament",
|
|
1275
|
+
EXO: "old_testament",
|
|
1276
|
+
LEV: "old_testament",
|
|
1277
|
+
NUM: "old_testament",
|
|
1278
|
+
DEU: "old_testament",
|
|
1279
|
+
JOS: "old_testament",
|
|
1280
|
+
JDG: "old_testament",
|
|
1281
|
+
RUT: "old_testament",
|
|
1282
|
+
"1SA": "old_testament",
|
|
1283
|
+
"2SA": "old_testament",
|
|
1284
|
+
"1KI": "old_testament",
|
|
1285
|
+
"2KI": "old_testament",
|
|
1286
|
+
"1CH": "old_testament",
|
|
1287
|
+
"2CH": "old_testament",
|
|
1288
|
+
EZR: "old_testament",
|
|
1289
|
+
NEH: "old_testament",
|
|
1290
|
+
EST: "old_testament",
|
|
1291
|
+
JOB: "old_testament",
|
|
1292
|
+
PSA: "old_testament",
|
|
1293
|
+
PRO: "old_testament",
|
|
1294
|
+
ECC: "old_testament",
|
|
1295
|
+
SNG: "old_testament",
|
|
1296
|
+
ISA: "old_testament",
|
|
1297
|
+
JER: "old_testament",
|
|
1298
|
+
LAM: "old_testament",
|
|
1299
|
+
EZK: "old_testament",
|
|
1300
|
+
DAN: "old_testament",
|
|
1301
|
+
HOS: "old_testament",
|
|
1302
|
+
JOL: "old_testament",
|
|
1303
|
+
AMO: "old_testament",
|
|
1304
|
+
OBA: "old_testament",
|
|
1305
|
+
JON: "old_testament",
|
|
1306
|
+
MIC: "old_testament",
|
|
1307
|
+
NAM: "old_testament",
|
|
1308
|
+
HAB: "old_testament",
|
|
1309
|
+
ZEP: "old_testament",
|
|
1310
|
+
HAG: "old_testament",
|
|
1311
|
+
ZEC: "old_testament",
|
|
1312
|
+
MAL: "old_testament",
|
|
1313
|
+
MAT: "new_testament",
|
|
1314
|
+
MRK: "new_testament",
|
|
1315
|
+
LUK: "new_testament",
|
|
1316
|
+
JHN: "new_testament",
|
|
1317
|
+
ACT: "new_testament",
|
|
1318
|
+
ROM: "new_testament",
|
|
1319
|
+
"1CO": "new_testament",
|
|
1320
|
+
"2CO": "new_testament",
|
|
1321
|
+
GAL: "new_testament",
|
|
1322
|
+
EPH: "new_testament",
|
|
1323
|
+
PHP: "new_testament",
|
|
1324
|
+
COL: "new_testament",
|
|
1325
|
+
"1TH": "new_testament",
|
|
1326
|
+
"2TH": "new_testament",
|
|
1327
|
+
"1TI": "new_testament",
|
|
1328
|
+
"2TI": "new_testament",
|
|
1329
|
+
TIT: "new_testament",
|
|
1330
|
+
PHM: "new_testament",
|
|
1331
|
+
HEB: "new_testament",
|
|
1332
|
+
JAS: "new_testament",
|
|
1333
|
+
"1PE": "new_testament",
|
|
1334
|
+
"2PE": "new_testament",
|
|
1335
|
+
"1JN": "new_testament",
|
|
1336
|
+
"2JN": "new_testament",
|
|
1337
|
+
"3JN": "new_testament",
|
|
1338
|
+
JUD: "new_testament",
|
|
1339
|
+
REV: "new_testament",
|
|
1340
|
+
TOB: "deuterocanon",
|
|
1341
|
+
JDT: "deuterocanon",
|
|
1342
|
+
ESG: "deuterocanon",
|
|
1343
|
+
WIS: "deuterocanon",
|
|
1344
|
+
SIR: "deuterocanon",
|
|
1345
|
+
BAR: "deuterocanon",
|
|
1346
|
+
LJE: "deuterocanon",
|
|
1347
|
+
S3Y: "deuterocanon",
|
|
1348
|
+
SUS: "deuterocanon",
|
|
1349
|
+
BEL: "deuterocanon",
|
|
1350
|
+
"1MA": "deuterocanon",
|
|
1351
|
+
"2MA": "deuterocanon",
|
|
1352
|
+
"3MA": "deuterocanon",
|
|
1353
|
+
"4MA": "deuterocanon",
|
|
1354
|
+
"1ES": "deuterocanon",
|
|
1355
|
+
"2ES": "deuterocanon",
|
|
1356
|
+
MAN: "deuterocanon",
|
|
1357
|
+
PS2: "deuterocanon",
|
|
1358
|
+
ODA: "deuterocanon",
|
|
1359
|
+
PSS: "deuterocanon",
|
|
1360
|
+
"3ES": "deuterocanon",
|
|
1361
|
+
EZA: "deuterocanon",
|
|
1362
|
+
"5EZ": "deuterocanon",
|
|
1363
|
+
"6EZ": "deuterocanon",
|
|
1364
|
+
DAG: "deuterocanon",
|
|
1365
|
+
PS3: "deuterocanon",
|
|
1366
|
+
"2BA": "deuterocanon",
|
|
1367
|
+
LBA: "deuterocanon",
|
|
1368
|
+
JUB: "deuterocanon",
|
|
1369
|
+
ENO: "deuterocanon",
|
|
1370
|
+
"1MQ": "deuterocanon",
|
|
1371
|
+
"2MQ": "deuterocanon",
|
|
1372
|
+
"3MQ": "deuterocanon",
|
|
1373
|
+
REP: "deuterocanon",
|
|
1374
|
+
"4BA": "deuterocanon",
|
|
1375
|
+
LAO: "deuterocanon",
|
|
1376
|
+
LKA: "new_testament"
|
|
1429
1377
|
// Luke-Acts combo, treated canonically as New Testament
|
|
1430
1378
|
};
|
|
1431
1379
|
// Annotate the CommonJS export names for ESM import in node:
|
|
@@ -1440,7 +1388,6 @@ var BOOK_CANON = {
|
|
|
1440
1388
|
SessionStorageStrategy,
|
|
1441
1389
|
SignInWithYouVersionPermission,
|
|
1442
1390
|
SignInWithYouVersionResult,
|
|
1443
|
-
URLBuilder,
|
|
1444
1391
|
YouVersionAPI,
|
|
1445
1392
|
YouVersionAPIUsers,
|
|
1446
1393
|
YouVersionPlatformConfiguration,
|
package/dist/index.d.cts
CHANGED
|
@@ -8,8 +8,8 @@ declare const BibleVersionSchema: z.ZodObject<{
|
|
|
8
8
|
info: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
9
9
|
publisher_url: z.ZodOptional<z.ZodNullable<z.ZodURL>>;
|
|
10
10
|
language_tag: z.ZodString;
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
localized_abbreviation: z.ZodString;
|
|
12
|
+
localized_title: z.ZodString;
|
|
13
13
|
organization_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
14
14
|
title: z.ZodString;
|
|
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>>]>>;
|
|
@@ -18,9 +18,9 @@ declare const BibleVersionSchema: z.ZodObject<{
|
|
|
18
18
|
type BibleVersion = z.infer<typeof BibleVersionSchema>;
|
|
19
19
|
|
|
20
20
|
declare const CanonSchema: z.ZodEnum<{
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
21
|
+
old_testament: "old_testament";
|
|
22
|
+
new_testament: "new_testament";
|
|
23
|
+
deuterocanon: "deuterocanon";
|
|
24
24
|
}>;
|
|
25
25
|
type Canon = z.infer<typeof CanonSchema>;
|
|
26
26
|
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>>]>;
|
|
@@ -28,40 +28,50 @@ type BookUsfm = z.infer<typeof BookUsfmSchema>;
|
|
|
28
28
|
declare const BibleBookSchema: z.ZodObject<{
|
|
29
29
|
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>>]>;
|
|
30
30
|
title: z.ZodString;
|
|
31
|
+
full_title: z.ZodString;
|
|
31
32
|
abbreviation: z.ZodOptional<z.ZodString>;
|
|
32
33
|
canon: z.ZodEnum<{
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
34
|
+
old_testament: "old_testament";
|
|
35
|
+
new_testament: "new_testament";
|
|
36
|
+
deuterocanon: "deuterocanon";
|
|
36
37
|
}>;
|
|
37
|
-
chapters: z.ZodOptional<z.ZodArray<z.
|
|
38
|
+
chapters: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
39
|
+
id: z.ZodString;
|
|
40
|
+
passage_id: z.ZodString;
|
|
41
|
+
title: z.ZodString;
|
|
42
|
+
verses: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
43
|
+
id: z.ZodString;
|
|
44
|
+
passage_id: z.ZodString;
|
|
45
|
+
title: z.ZodString;
|
|
46
|
+
}, z.core.$strip>>>;
|
|
47
|
+
}, z.core.$strip>>>;
|
|
38
48
|
}, z.core.$strip>;
|
|
39
49
|
type BibleBook = z.infer<typeof BibleBookSchema>;
|
|
40
50
|
type CANON = z.infer<typeof CanonSchema>;
|
|
41
51
|
|
|
42
52
|
declare const BibleChapterSchema: z.ZodObject<{
|
|
43
53
|
id: z.ZodString;
|
|
44
|
-
book_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>>]>;
|
|
45
54
|
passage_id: z.ZodString;
|
|
46
55
|
title: z.ZodString;
|
|
47
|
-
verses: z.ZodOptional<z.ZodArray<z.
|
|
56
|
+
verses: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
57
|
+
id: z.ZodString;
|
|
58
|
+
passage_id: z.ZodString;
|
|
59
|
+
title: z.ZodString;
|
|
60
|
+
}, z.core.$strip>>>;
|
|
48
61
|
}, z.core.$strip>;
|
|
49
62
|
type BibleChapter = z.infer<typeof BibleChapterSchema>;
|
|
50
63
|
|
|
51
64
|
declare const BibleVerseSchema: z.ZodObject<{
|
|
52
65
|
id: z.ZodString;
|
|
53
|
-
book_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>>]>;
|
|
54
|
-
chapter_id: z.ZodString;
|
|
55
66
|
passage_id: z.ZodString;
|
|
56
|
-
|
|
67
|
+
title: z.ZodString;
|
|
57
68
|
}, z.core.$strip>;
|
|
58
69
|
type BibleVerse = z.infer<typeof BibleVerseSchema>;
|
|
59
70
|
|
|
60
71
|
declare const BiblePassageSchema: z.ZodObject<{
|
|
61
72
|
id: z.ZodString;
|
|
62
73
|
content: z.ZodString;
|
|
63
|
-
|
|
64
|
-
human_reference: z.ZodString;
|
|
74
|
+
reference: z.ZodString;
|
|
65
75
|
}, z.core.$strip>;
|
|
66
76
|
type BiblePassage = z.infer<typeof BiblePassageSchema>;
|
|
67
77
|
|
|
@@ -91,9 +101,9 @@ declare const BibleIndexBookSchema: z.ZodObject<{
|
|
|
91
101
|
full_title: z.ZodString;
|
|
92
102
|
abbreviation: z.ZodString;
|
|
93
103
|
canon: z.ZodEnum<{
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
104
|
+
old_testament: "old_testament";
|
|
105
|
+
new_testament: "new_testament";
|
|
106
|
+
deuterocanon: "deuterocanon";
|
|
97
107
|
}>;
|
|
98
108
|
chapters: z.ZodArray<z.ZodObject<{
|
|
99
109
|
id: z.ZodString;
|
|
@@ -113,9 +123,9 @@ declare const _BibleIndexSchema: z.ZodObject<{
|
|
|
113
123
|
full_title: z.ZodString;
|
|
114
124
|
abbreviation: z.ZodString;
|
|
115
125
|
canon: z.ZodEnum<{
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
126
|
+
old_testament: "old_testament";
|
|
127
|
+
new_testament: "new_testament";
|
|
128
|
+
deuterocanon: "deuterocanon";
|
|
119
129
|
}>;
|
|
120
130
|
chapters: z.ZodArray<z.ZodObject<{
|
|
121
131
|
id: z.ZodString;
|
|
@@ -199,7 +209,6 @@ type SignInWithYouVersionResultProps = {
|
|
|
199
209
|
expiresIn?: number;
|
|
200
210
|
refreshToken?: string;
|
|
201
211
|
idToken?: string;
|
|
202
|
-
permissions?: SignInWithYouVersionPermissionValues[];
|
|
203
212
|
yvpUserId?: string;
|
|
204
213
|
name?: string;
|
|
205
214
|
profilePicture?: string;
|
|
@@ -210,12 +219,11 @@ declare class SignInWithYouVersionResult {
|
|
|
210
219
|
readonly expiryDate: Date | undefined;
|
|
211
220
|
readonly refreshToken: string | undefined;
|
|
212
221
|
readonly idToken: string | undefined;
|
|
213
|
-
readonly permissions: SignInWithYouVersionPermissionValues[] | undefined;
|
|
214
222
|
readonly yvpUserId: string | undefined;
|
|
215
223
|
readonly name: string | undefined;
|
|
216
224
|
readonly profilePicture: string | undefined;
|
|
217
225
|
readonly email: string | undefined;
|
|
218
|
-
constructor({ accessToken, expiresIn, refreshToken, idToken,
|
|
226
|
+
constructor({ accessToken, expiresIn, refreshToken, idToken, yvpUserId, name, profilePicture, email, }: SignInWithYouVersionResultProps);
|
|
219
227
|
}
|
|
220
228
|
|
|
221
229
|
type SignInWithYouVersionPermissionValues = (typeof SignInWithYouVersionPermission)[keyof typeof SignInWithYouVersionPermission];
|
|
@@ -227,6 +235,7 @@ interface AuthenticationState {
|
|
|
227
235
|
result: SignInWithYouVersionResult | null;
|
|
228
236
|
error: Error | null;
|
|
229
237
|
}
|
|
238
|
+
type AuthenticationScopes = 'profile' | 'email';
|
|
230
239
|
|
|
231
240
|
/**
|
|
232
241
|
* Legacy type for highlight colors (constants only)
|
|
@@ -327,7 +336,7 @@ declare class BibleClient {
|
|
|
327
336
|
/**
|
|
328
337
|
* Fetches all books for a given Bible version.
|
|
329
338
|
* @param versionId The version ID.
|
|
330
|
-
* @param canon Optional canon filter (
|
|
339
|
+
* @param canon Optional canon filter ("old_testament", 'new_testament', 'deuterocanon').
|
|
331
340
|
* @returns An array of BibleBook objects.
|
|
332
341
|
*/
|
|
333
342
|
getBooks(versionId: number, canon?: CANON): Promise<Collection<BibleBook>>;
|
|
@@ -583,14 +592,14 @@ declare class YouVersionAPIUsers {
|
|
|
583
592
|
/**
|
|
584
593
|
* Presents the YouVersion login flow to the user and returns the login result upon completion.
|
|
585
594
|
*
|
|
586
|
-
* This function authenticates the user with YouVersion
|
|
595
|
+
* This function authenticates the user with YouVersion.
|
|
587
596
|
* The function redirects to the YouVersion authorization URL and expects the callback to be handled separately.
|
|
588
597
|
*
|
|
589
|
-
* @param
|
|
598
|
+
* @param scopes - The scopes given to the authentication call.
|
|
590
599
|
* @param redirectURL - The URL to redirect back to after authentication.
|
|
591
600
|
* @throws An error if authentication fails or configuration is invalid.
|
|
592
601
|
*/
|
|
593
|
-
static signIn(
|
|
602
|
+
static signIn(redirectURL: string, scopes?: AuthenticationScopes[]): Promise<void>;
|
|
594
603
|
/**
|
|
595
604
|
* Handles the OAuth callback after user authentication.
|
|
596
605
|
*
|
|
@@ -658,11 +667,6 @@ declare class YouVersionAPI {
|
|
|
658
667
|
static addStandardHeaders(url: URL): Request;
|
|
659
668
|
}
|
|
660
669
|
|
|
661
|
-
declare class URLBuilder {
|
|
662
|
-
private static get baseURL();
|
|
663
|
-
static authURL(appKey: string, requiredPermissions?: Set<SignInWithYouVersionPermissionValues>, optionalPermissions?: Set<SignInWithYouVersionPermissionValues>): URL;
|
|
664
|
-
}
|
|
665
|
-
|
|
666
670
|
/**
|
|
667
671
|
* Security Note: Tokens are stored in localStorage for persistence.
|
|
668
672
|
* Ensure your application follows XSS prevention best practices:
|
|
@@ -702,4 +706,4 @@ declare const BOOK_IDS: readonly ["GEN", "EXO", "LEV", "NUM", "DEU", "JOS", "JDG
|
|
|
702
706
|
*/
|
|
703
707
|
declare const BOOK_CANON: Record<BookUsfm, Canon>;
|
|
704
708
|
|
|
705
|
-
export { ApiClient, type ApiConfig, 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,
|
|
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 };
|