@churchapps/content-providers 0.1.0 → 0.1.2
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/README.md +6 -6
- package/dist/index.cjs +41 -13
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +4 -2
- package/dist/index.d.ts +4 -2
- package/dist/index.js +41 -13
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -450,7 +450,8 @@ declare class SignPresenterProvider implements IProvider {
|
|
|
450
450
|
* /lessons/{programId}/{studyId}/{lessonId}/{venueId} -> playlist files
|
|
451
451
|
*
|
|
452
452
|
* /addons -> categories
|
|
453
|
-
* /addons/{category} -> add-
|
|
453
|
+
* /addons/{category} -> individual add-ons
|
|
454
|
+
* /addons/{category}/{addOnId} -> single add-on file
|
|
454
455
|
*/
|
|
455
456
|
declare class LessonsChurchProvider implements IProvider {
|
|
456
457
|
readonly id = "lessonschurch";
|
|
@@ -469,6 +470,7 @@ declare class LessonsChurchProvider implements IProvider {
|
|
|
469
470
|
private getVenues;
|
|
470
471
|
private getPlaylistFiles;
|
|
471
472
|
private browseAddOns;
|
|
473
|
+
private getAddOnFiles;
|
|
472
474
|
private getAddOnCategories;
|
|
473
475
|
private getAddOnsByCategory;
|
|
474
476
|
getInstructions(path: string, _auth?: ContentProviderAuthData | null): Promise<Instructions | null>;
|
|
@@ -663,7 +665,7 @@ declare function getProviderConfig(providerId: string): ContentProviderConfig |
|
|
|
663
665
|
declare function getAvailableProviders(ids?: string[]): ProviderInfo[];
|
|
664
666
|
|
|
665
667
|
/**
|
|
666
|
-
* @churchapps/content-
|
|
668
|
+
* @churchapps/content-providers
|
|
667
669
|
* Helper classes for interacting with third party content providers
|
|
668
670
|
*/
|
|
669
671
|
declare const VERSION = "0.0.5";
|
package/dist/index.d.ts
CHANGED
|
@@ -450,7 +450,8 @@ declare class SignPresenterProvider implements IProvider {
|
|
|
450
450
|
* /lessons/{programId}/{studyId}/{lessonId}/{venueId} -> playlist files
|
|
451
451
|
*
|
|
452
452
|
* /addons -> categories
|
|
453
|
-
* /addons/{category} -> add-
|
|
453
|
+
* /addons/{category} -> individual add-ons
|
|
454
|
+
* /addons/{category}/{addOnId} -> single add-on file
|
|
454
455
|
*/
|
|
455
456
|
declare class LessonsChurchProvider implements IProvider {
|
|
456
457
|
readonly id = "lessonschurch";
|
|
@@ -469,6 +470,7 @@ declare class LessonsChurchProvider implements IProvider {
|
|
|
469
470
|
private getVenues;
|
|
470
471
|
private getPlaylistFiles;
|
|
471
472
|
private browseAddOns;
|
|
473
|
+
private getAddOnFiles;
|
|
472
474
|
private getAddOnCategories;
|
|
473
475
|
private getAddOnsByCategory;
|
|
474
476
|
getInstructions(path: string, _auth?: ContentProviderAuthData | null): Promise<Instructions | null>;
|
|
@@ -663,7 +665,7 @@ declare function getProviderConfig(providerId: string): ContentProviderConfig |
|
|
|
663
665
|
declare function getAvailableProviders(ids?: string[]): ProviderInfo[];
|
|
664
666
|
|
|
665
667
|
/**
|
|
666
|
-
* @churchapps/content-
|
|
668
|
+
* @churchapps/content-providers
|
|
667
669
|
* Helper classes for interacting with third party content providers
|
|
668
670
|
*/
|
|
669
671
|
declare const VERSION = "0.0.5";
|
package/dist/index.js
CHANGED
|
@@ -1056,6 +1056,12 @@ var LessonsChurchProvider = class {
|
|
|
1056
1056
|
this.capabilities = { browse: true, presentations: true, playlist: true, instructions: true, mediaLicensing: false };
|
|
1057
1057
|
}
|
|
1058
1058
|
async getPlaylist(path, _auth, resolution) {
|
|
1059
|
+
const { segments } = parsePath(path);
|
|
1060
|
+
if (segments[0] === "addons" && segments.length >= 3) {
|
|
1061
|
+
const addOnId = segments[2];
|
|
1062
|
+
const file = await convertAddOnToFile({ id: addOnId });
|
|
1063
|
+
return file ? [file] : null;
|
|
1064
|
+
}
|
|
1059
1065
|
const venueId = getSegment(path, 4);
|
|
1060
1066
|
if (!venueId) return null;
|
|
1061
1067
|
let apiPath = `/venues/playlist/${venueId}`;
|
|
@@ -1157,12 +1163,17 @@ var LessonsChurchProvider = class {
|
|
|
1157
1163
|
const files = await this.getPlaylist(`/lessons/_/_/_/${venueId}`, null);
|
|
1158
1164
|
return files || [];
|
|
1159
1165
|
}
|
|
1160
|
-
async browseAddOns(
|
|
1166
|
+
async browseAddOns(currentPath, segments) {
|
|
1161
1167
|
const depth = segments.length;
|
|
1162
1168
|
if (depth === 1) return this.getAddOnCategories();
|
|
1163
|
-
if (depth === 2) return this.getAddOnsByCategory(segments[1]);
|
|
1169
|
+
if (depth === 2) return this.getAddOnsByCategory(segments[1], currentPath);
|
|
1170
|
+
if (depth === 3) return this.getAddOnFiles(segments[2]);
|
|
1164
1171
|
return [];
|
|
1165
1172
|
}
|
|
1173
|
+
async getAddOnFiles(addOnId) {
|
|
1174
|
+
const file = await convertAddOnToFile({ id: addOnId });
|
|
1175
|
+
return file ? [file] : [];
|
|
1176
|
+
}
|
|
1166
1177
|
async getAddOnCategories() {
|
|
1167
1178
|
const response = await apiRequest(this.config.endpoints.addOns);
|
|
1168
1179
|
if (!response) return [];
|
|
@@ -1172,22 +1183,23 @@ var LessonsChurchProvider = class {
|
|
|
1172
1183
|
type: "folder",
|
|
1173
1184
|
id: `category-${category}`,
|
|
1174
1185
|
title: category,
|
|
1175
|
-
isLeaf: true,
|
|
1176
1186
|
path: `/addons/${encodeURIComponent(category)}`
|
|
1177
1187
|
}));
|
|
1178
1188
|
}
|
|
1179
|
-
async getAddOnsByCategory(category) {
|
|
1189
|
+
async getAddOnsByCategory(category, currentPath) {
|
|
1180
1190
|
const decodedCategory = decodeURIComponent(category);
|
|
1181
1191
|
const response = await apiRequest(this.config.endpoints.addOns);
|
|
1182
1192
|
if (!response) return [];
|
|
1183
1193
|
const allAddOns = Array.isArray(response) ? response : [];
|
|
1184
1194
|
const filtered = allAddOns.filter((a) => a.category === decodedCategory);
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1195
|
+
return filtered.map((addOn) => ({
|
|
1196
|
+
type: "folder",
|
|
1197
|
+
id: addOn.id,
|
|
1198
|
+
title: addOn.name,
|
|
1199
|
+
thumbnail: addOn.image,
|
|
1200
|
+
isLeaf: true,
|
|
1201
|
+
path: `${currentPath}/${addOn.id}`
|
|
1202
|
+
}));
|
|
1191
1203
|
}
|
|
1192
1204
|
// async getPresentations(path: string, _auth?: ContentProviderAuthData | null): Promise<Plan | null> {
|
|
1193
1205
|
// const venueId = getSegment(path, 4);
|
|
@@ -1216,6 +1228,22 @@ var LessonsChurchProvider = class {
|
|
|
1216
1228
|
return { name: planItemsResponse.venueName, items: (planItemsResponse.items || []).map((item) => processInstructionItem(item, sectionActionsMap, lessonImage)) };
|
|
1217
1229
|
}
|
|
1218
1230
|
const { segments } = parsePath(path);
|
|
1231
|
+
if (segments[0] === "addons" && segments.length === 3) {
|
|
1232
|
+
const addOnId = segments[2];
|
|
1233
|
+
const file = await convertAddOnToFile({ id: addOnId });
|
|
1234
|
+
if (!file) return null;
|
|
1235
|
+
return {
|
|
1236
|
+
name: file.title,
|
|
1237
|
+
items: [{
|
|
1238
|
+
id: addOnId,
|
|
1239
|
+
itemType: "action",
|
|
1240
|
+
relatedId: addOnId,
|
|
1241
|
+
label: file.title,
|
|
1242
|
+
seconds: file.seconds,
|
|
1243
|
+
children: [{ id: addOnId + "-file", itemType: "file", label: file.title, seconds: file.seconds, downloadUrl: file.url, thumbnail: file.thumbnail }]
|
|
1244
|
+
}]
|
|
1245
|
+
};
|
|
1246
|
+
}
|
|
1219
1247
|
if (segments[0] === "addons" && segments.length === 2) {
|
|
1220
1248
|
return convertAddOnCategoryToInstructions(segments[1]);
|
|
1221
1249
|
}
|
|
@@ -1996,15 +2024,15 @@ var DropboxProvider = class {
|
|
|
1996
2024
|
this.id = "dropbox";
|
|
1997
2025
|
this.name = "Dropbox";
|
|
1998
2026
|
this.logos = {
|
|
1999
|
-
light: "https://
|
|
2000
|
-
dark: "https://
|
|
2027
|
+
light: "https://cdn.prod.website-files.com/66c503d081b2f012369fc5d2/674000d6c0a42d41f8c331be_dropbox-2-logo-png-transparent.png",
|
|
2028
|
+
dark: "https://cdn.prod.website-files.com/66c503d081b2f012369fc5d2/674000d6c0a42d41f8c331be_dropbox-2-logo-png-transparent.png"
|
|
2001
2029
|
};
|
|
2002
2030
|
this.config = {
|
|
2003
2031
|
id: "dropbox",
|
|
2004
2032
|
name: "Dropbox",
|
|
2005
2033
|
apiBase: "https://api.dropboxapi.com",
|
|
2006
2034
|
oauthBase: "https://www.dropbox.com/oauth2",
|
|
2007
|
-
clientId: "
|
|
2035
|
+
clientId: "9io0q0q9angdz9j",
|
|
2008
2036
|
scopes: [],
|
|
2009
2037
|
endpoints: {
|
|
2010
2038
|
listFolder: "/2/files/list_folder",
|