@churchapps/content-providers 0.14.0 → 0.15.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 +48 -8
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +23 -0
- package/dist/index.d.ts +23 -0
- package/dist/index.js +48 -8
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -625,6 +625,27 @@ interface GoCurriculumResource {
|
|
|
625
625
|
url: string;
|
|
626
626
|
shareUrl?: string;
|
|
627
627
|
}
|
|
628
|
+
interface GoCurriculumGuideFile {
|
|
629
|
+
file: string;
|
|
630
|
+
url: string;
|
|
631
|
+
mediaType?: string;
|
|
632
|
+
thumbnail?: string;
|
|
633
|
+
seconds?: number;
|
|
634
|
+
}
|
|
635
|
+
interface GoCurriculumGuideItem {
|
|
636
|
+
type: string;
|
|
637
|
+
content: string;
|
|
638
|
+
files?: GoCurriculumGuideFile[];
|
|
639
|
+
}
|
|
640
|
+
interface GoCurriculumGuideSection {
|
|
641
|
+
name: string;
|
|
642
|
+
role?: string;
|
|
643
|
+
items: GoCurriculumGuideItem[];
|
|
644
|
+
}
|
|
645
|
+
interface GoCurriculumGuide {
|
|
646
|
+
source?: string;
|
|
647
|
+
sections: GoCurriculumGuideSection[];
|
|
648
|
+
}
|
|
628
649
|
interface GoCurriculumLesson {
|
|
629
650
|
id: string;
|
|
630
651
|
name: string;
|
|
@@ -634,6 +655,8 @@ interface GoCurriculumLesson {
|
|
|
634
655
|
keyVerse?: string;
|
|
635
656
|
playlist: GoCurriculumPlaylistItem[];
|
|
636
657
|
resources?: GoCurriculumResource[];
|
|
658
|
+
script?: GoCurriculumGuide;
|
|
659
|
+
smallGroup?: GoCurriculumGuide;
|
|
637
660
|
}
|
|
638
661
|
interface GoCurriculumCollection {
|
|
639
662
|
id: string;
|
package/dist/index.d.ts
CHANGED
|
@@ -625,6 +625,27 @@ interface GoCurriculumResource {
|
|
|
625
625
|
url: string;
|
|
626
626
|
shareUrl?: string;
|
|
627
627
|
}
|
|
628
|
+
interface GoCurriculumGuideFile {
|
|
629
|
+
file: string;
|
|
630
|
+
url: string;
|
|
631
|
+
mediaType?: string;
|
|
632
|
+
thumbnail?: string;
|
|
633
|
+
seconds?: number;
|
|
634
|
+
}
|
|
635
|
+
interface GoCurriculumGuideItem {
|
|
636
|
+
type: string;
|
|
637
|
+
content: string;
|
|
638
|
+
files?: GoCurriculumGuideFile[];
|
|
639
|
+
}
|
|
640
|
+
interface GoCurriculumGuideSection {
|
|
641
|
+
name: string;
|
|
642
|
+
role?: string;
|
|
643
|
+
items: GoCurriculumGuideItem[];
|
|
644
|
+
}
|
|
645
|
+
interface GoCurriculumGuide {
|
|
646
|
+
source?: string;
|
|
647
|
+
sections: GoCurriculumGuideSection[];
|
|
648
|
+
}
|
|
628
649
|
interface GoCurriculumLesson {
|
|
629
650
|
id: string;
|
|
630
651
|
name: string;
|
|
@@ -634,6 +655,8 @@ interface GoCurriculumLesson {
|
|
|
634
655
|
keyVerse?: string;
|
|
635
656
|
playlist: GoCurriculumPlaylistItem[];
|
|
636
657
|
resources?: GoCurriculumResource[];
|
|
658
|
+
script?: GoCurriculumGuide;
|
|
659
|
+
smallGroup?: GoCurriculumGuide;
|
|
637
660
|
}
|
|
638
661
|
interface GoCurriculumCollection {
|
|
639
662
|
id: string;
|
package/dist/index.js
CHANGED
|
@@ -12743,6 +12743,30 @@ var GROUPS = [
|
|
|
12743
12743
|
{ id: "preschool", name: "Preschool" }
|
|
12744
12744
|
];
|
|
12745
12745
|
var CATALOG_TTL_MS = 60 * 60 * 1e3;
|
|
12746
|
+
var SMALL_GROUP = "small-group";
|
|
12747
|
+
function guideAction(item, id, lesson) {
|
|
12748
|
+
const plain = (item.content || "").replace(/\*+/g, "").trim();
|
|
12749
|
+
const label = plain.length > 100 ? plain.slice(0, 100).trimEnd() + "\u2026" : plain;
|
|
12750
|
+
const files = (item.files || []).map((f) => ({
|
|
12751
|
+
id: slugify(f.file),
|
|
12752
|
+
itemType: "file",
|
|
12753
|
+
label: lesson.playlist.find((p) => p.url === f.url)?.title || f.file,
|
|
12754
|
+
seconds: f.seconds,
|
|
12755
|
+
downloadUrl: f.url,
|
|
12756
|
+
mediaType: detectMediaType(`${f.url} ${f.file}`, f.mediaType),
|
|
12757
|
+
thumbnail: f.thumbnail || lesson.thumbnail
|
|
12758
|
+
}));
|
|
12759
|
+
return { id, itemType: "action", actionType: item.type, label, content: item.content !== label ? item.content : void 0, seconds: files[0]?.seconds, children: files.length ? files : void 0 };
|
|
12760
|
+
}
|
|
12761
|
+
function guideToInstructions(name, guide, prefix, lesson) {
|
|
12762
|
+
const items = guide.sections.map((s, i) => ({
|
|
12763
|
+
id: `${prefix}-${i}`,
|
|
12764
|
+
itemType: "section",
|
|
12765
|
+
label: s.name,
|
|
12766
|
+
children: s.items.map((a, j) => guideAction(a, `${prefix}-${i}-${j}`, lesson))
|
|
12767
|
+
}));
|
|
12768
|
+
return { name, items };
|
|
12769
|
+
}
|
|
12746
12770
|
async function loadFromFeed(groupId) {
|
|
12747
12771
|
let url;
|
|
12748
12772
|
try {
|
|
@@ -12830,7 +12854,12 @@ var GoCurriculumProvider = class extends BaseProvider {
|
|
|
12830
12854
|
if (depth === 1) return ((await this.getData(segments[0], auth))?.catalog || []).map((c) => createFolder(c.id, c.name, `/${segments[0]}/${c.id}`, c.thumbnail));
|
|
12831
12855
|
const collection = await this.getCollection(segments, auth);
|
|
12832
12856
|
if (!collection) return [];
|
|
12833
|
-
|
|
12857
|
+
const base = `/${segments[0]}/${collection.id}`;
|
|
12858
|
+
if (depth === 2) {
|
|
12859
|
+
const lessons = collection.lessons.map((l) => createFolder(l.id, l.name, `${base}/${l.id}`, l.thumbnail || collection.thumbnail, true));
|
|
12860
|
+
return collection.lessons.some((l) => l.smallGroup) ? [createFolder(SMALL_GROUP, "Small Group Guides", `${base}/${SMALL_GROUP}`, collection.thumbnail), ...lessons] : lessons;
|
|
12861
|
+
}
|
|
12862
|
+
if (depth === 3 && segments[2] === SMALL_GROUP) return collection.lessons.filter((l) => l.smallGroup).map((l) => createFolder(l.id, l.name, `${base}/${SMALL_GROUP}/${l.id}`, l.thumbnail || collection.thumbnail, true));
|
|
12834
12863
|
if (depth === 3) return this.getLessonFiles(collection, segments[2]);
|
|
12835
12864
|
return [];
|
|
12836
12865
|
}
|
|
@@ -12849,14 +12878,25 @@ var GoCurriculumProvider = class extends BaseProvider {
|
|
|
12849
12878
|
return files.length > 0 ? files : null;
|
|
12850
12879
|
}
|
|
12851
12880
|
async getInstructions(path, auth) {
|
|
12881
|
+
if (!auth || !await this.verifyAuth(auth)) return null;
|
|
12852
12882
|
const { segments, depth } = parsePath(path);
|
|
12853
|
-
|
|
12854
|
-
|
|
12855
|
-
if (!files || !auth) return null;
|
|
12883
|
+
const smallGroup = depth === 4 && segments[2] === SMALL_GROUP;
|
|
12884
|
+
if (depth !== 3 && !smallGroup) return null;
|
|
12856
12885
|
const collection = await this.getCollection(segments, auth);
|
|
12857
|
-
const lesson = collection?.lessons.find((l) => l.id === segments[
|
|
12858
|
-
|
|
12859
|
-
|
|
12886
|
+
const lesson = collection?.lessons.find((l) => l.id === segments[depth - 1]);
|
|
12887
|
+
if (!collection || !lesson) return null;
|
|
12888
|
+
let instructions;
|
|
12889
|
+
if (smallGroup) {
|
|
12890
|
+
if (!lesson.smallGroup?.sections?.length) return null;
|
|
12891
|
+
instructions = guideToInstructions(`${lesson.name} - Small Group`, lesson.smallGroup, "sg", lesson);
|
|
12892
|
+
} else if (lesson.script?.sections?.length) {
|
|
12893
|
+
instructions = guideToInstructions(lesson.name, lesson.script, "lg", lesson);
|
|
12894
|
+
} else {
|
|
12895
|
+
const files = this.getLessonFiles(collection, lesson.id);
|
|
12896
|
+
if (files.length === 0) return null;
|
|
12897
|
+
instructions = filesToInstructions(lesson.name, files);
|
|
12898
|
+
}
|
|
12899
|
+
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 }));
|
|
12860
12900
|
if (downloads.length > 0) instructions.downloads = downloads;
|
|
12861
12901
|
return instructions;
|
|
12862
12902
|
}
|
|
@@ -17025,7 +17065,7 @@ function getAvailableProviders(ids) {
|
|
|
17025
17065
|
}
|
|
17026
17066
|
|
|
17027
17067
|
// src/index.ts
|
|
17028
|
-
var VERSION = true ? "0.
|
|
17068
|
+
var VERSION = true ? "0.15.0" : "dev";
|
|
17029
17069
|
export {
|
|
17030
17070
|
APlayProvider,
|
|
17031
17071
|
B1ChurchProvider,
|