@churchapps/content-providers 0.9.4 → 0.10.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/dist/index.cjs +25 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +18 -1
- package/dist/index.d.ts +18 -1
- package/dist/index.js +25 -3
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -338,6 +338,12 @@ function isMediaFile(filename) {
|
|
|
338
338
|
const lower = filename.toLowerCase();
|
|
339
339
|
return [...VIDEO_EXTENSIONS, ...IMAGE_EXTENSIONS, ...AUDIO_EXTENSIONS].some((ext) => lower.endsWith(ext));
|
|
340
340
|
}
|
|
341
|
+
function isPlaylistMedia(url, fileType, name) {
|
|
342
|
+
if (fileType?.startsWith("video/") || fileType?.startsWith("audio/") || fileType === "video" || fileType === "audio") return true;
|
|
343
|
+
const haystack = `${url} ${name || ""}`.toLowerCase();
|
|
344
|
+
if (haystack.includes("stream.mux.com") || haystack.includes("externalvideos/download")) return true;
|
|
345
|
+
return [...VIDEO_EXTENSIONS, ...AUDIO_EXTENSIONS].some((ext) => haystack.includes(ext));
|
|
346
|
+
}
|
|
341
347
|
function createFolder(id, title, path, thumbnail, isLeaf) {
|
|
342
348
|
return { type: "folder", id, title, path, thumbnail, isLeaf };
|
|
343
349
|
}
|
|
@@ -1011,6 +1017,18 @@ var LessonsChurchProvider = class extends BaseProvider {
|
|
|
1011
1017
|
const filtered = allAddOns.filter((a) => a.category === decodedCategory);
|
|
1012
1018
|
return filtered.map((addOn) => createFolder(addOn.id, addOn.name, `${currentPath}/${addOn.id}`, addOn.image, true));
|
|
1013
1019
|
}
|
|
1020
|
+
/** Flatten feed download bundles into printable files, keeping playlist media (videos already in the run-of-show) out. */
|
|
1021
|
+
convertFeedDownloads(bundles) {
|
|
1022
|
+
const result = [];
|
|
1023
|
+
for (const bundle of bundles || []) {
|
|
1024
|
+
const files = (bundle.files || []).filter((f) => f.url && !isPlaylistMedia(f.url, f.fileType, f.name));
|
|
1025
|
+
for (const file of files) {
|
|
1026
|
+
const title = (files.length === 1 ? bundle.name || file.name : file.name || bundle.name) || "Download";
|
|
1027
|
+
result.push({ id: file.id, title, url: file.url, fileType: file.fileType, bytes: file.bytes });
|
|
1028
|
+
}
|
|
1029
|
+
}
|
|
1030
|
+
return result;
|
|
1031
|
+
}
|
|
1014
1032
|
async getInstructions(path, _auth) {
|
|
1015
1033
|
const venueId = getSegment(path, 4);
|
|
1016
1034
|
if (venueId) {
|
|
@@ -1022,7 +1040,8 @@ var LessonsChurchProvider = class extends BaseProvider {
|
|
|
1022
1040
|
if (!planItemsResponse) return null;
|
|
1023
1041
|
const lessonImage = feedResponse?.lessonImage;
|
|
1024
1042
|
const sectionActionsMap = buildSectionActionsMap(actionsResponse, lessonImage, feedResponse);
|
|
1025
|
-
|
|
1043
|
+
const downloads = this.convertFeedDownloads(feedResponse?.downloads);
|
|
1044
|
+
return { name: planItemsResponse.venueName, items: (planItemsResponse.items || []).map((item) => processInstructionItem(item, sectionActionsMap, lessonImage)), downloads: downloads.length > 0 ? downloads : void 0 };
|
|
1026
1045
|
}
|
|
1027
1046
|
const { segments } = parsePath(path);
|
|
1028
1047
|
if (segments[0] === "addons" && segments.length === 3) {
|
|
@@ -17792,7 +17811,10 @@ var GoCurriculumProvider = class extends BaseProvider {
|
|
|
17792
17811
|
if (!files) return null;
|
|
17793
17812
|
const collection = (await this.getData()).catalog.find((c) => c.id === segments[0]);
|
|
17794
17813
|
const lesson = collection?.lessons.find((l) => l.id === segments[1]);
|
|
17795
|
-
|
|
17814
|
+
const instructions = filesToInstructions(lesson?.name || "Lesson", files);
|
|
17815
|
+
const downloads = (lesson?.resources || []).filter((r) => r.url && !isPlaylistMedia(r.url, void 0, r.file)).map((r) => ({ id: slugify(r.file || r.title), title: r.title || r.file, url: r.url }));
|
|
17816
|
+
if (downloads.length > 0) instructions.downloads = downloads;
|
|
17817
|
+
return instructions;
|
|
17796
17818
|
}
|
|
17797
17819
|
generateCodeVerifier() {
|
|
17798
17820
|
return this.oauthHelper.generateCodeVerifier();
|
|
@@ -18039,7 +18061,7 @@ function getAvailableProviders(ids) {
|
|
|
18039
18061
|
}
|
|
18040
18062
|
|
|
18041
18063
|
// src/index.ts
|
|
18042
|
-
var VERSION = true ? "0.
|
|
18064
|
+
var VERSION = true ? "0.10.0" : "dev";
|
|
18043
18065
|
// Annotate the CommonJS export names for ESM import in node:
|
|
18044
18066
|
0 && (module.exports = {
|
|
18045
18067
|
APlayProvider,
|