@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.d.cts
CHANGED
|
@@ -116,6 +116,11 @@ interface FeedFileInterface {
|
|
|
116
116
|
seconds?: number;
|
|
117
117
|
fileType?: string;
|
|
118
118
|
thumbnail?: string;
|
|
119
|
+
bytes?: number;
|
|
120
|
+
}
|
|
121
|
+
interface FeedDownloadInterface {
|
|
122
|
+
name?: string;
|
|
123
|
+
files?: FeedFileInterface[];
|
|
119
124
|
}
|
|
120
125
|
interface FeedActionInterface {
|
|
121
126
|
id?: string;
|
|
@@ -135,6 +140,7 @@ interface FeedVenueInterface {
|
|
|
135
140
|
lessonName?: string;
|
|
136
141
|
lessonDescription?: string;
|
|
137
142
|
lessonImage?: string;
|
|
143
|
+
downloads?: FeedDownloadInterface[];
|
|
138
144
|
sections?: FeedSectionInterface[];
|
|
139
145
|
}
|
|
140
146
|
interface InstructionItem {
|
|
@@ -150,9 +156,18 @@ interface InstructionItem {
|
|
|
150
156
|
thumbnail?: string;
|
|
151
157
|
mediaType?: "video" | "image" | "audio";
|
|
152
158
|
}
|
|
159
|
+
/** An extra file the teacher downloads/prints (zip, PDF, leader guide) — never part of the presented playlist. */
|
|
160
|
+
interface ContentDownload {
|
|
161
|
+
id?: string;
|
|
162
|
+
title: string;
|
|
163
|
+
url: string;
|
|
164
|
+
fileType?: string;
|
|
165
|
+
bytes?: number;
|
|
166
|
+
}
|
|
153
167
|
interface Instructions {
|
|
154
168
|
name?: string;
|
|
155
169
|
items: InstructionItem[];
|
|
170
|
+
downloads?: ContentDownload[];
|
|
156
171
|
}
|
|
157
172
|
interface MessageFileInterface {
|
|
158
173
|
id?: string;
|
|
@@ -380,6 +395,8 @@ declare class LessonsChurchProvider extends BaseProvider {
|
|
|
380
395
|
private getAddOnFiles;
|
|
381
396
|
private getAddOnCategories;
|
|
382
397
|
private getAddOnsByCategory;
|
|
398
|
+
/** Flatten feed download bundles into printable files, keeping playlist media (videos already in the run-of-show) out. */
|
|
399
|
+
private convertFeedDownloads;
|
|
383
400
|
getInstructions(path: string, _auth?: ContentProviderAuthData | null): Promise<Instructions | null>;
|
|
384
401
|
}
|
|
385
402
|
|
|
@@ -589,4 +606,4 @@ declare function getAvailableProviders(ids?: string[]): ProviderInfo[];
|
|
|
589
606
|
*/
|
|
590
607
|
declare const VERSION: string;
|
|
591
608
|
|
|
592
|
-
export { APlayProvider, type AuthType, B1ChurchProvider, BaseProvider, BibleProjectProvider, CbnProvider, type ContentFile, type ContentFolder, type ContentItem, type ContentProviderAuthData, type ContentProviderConfig, type CurrentPlan, type DeviceAuthorizationResponse, DeviceFlowHelper, type DeviceFlowPollResult, type DeviceFlowState, DropboxProvider, type EndpointValue, type EndpointsConfig, type FeedActionInterface, type FeedFileInterface, type FeedSectionInterface, type FeedVenueInterface, HighVoltageKidsProvider, type IProvider, type InstructionItem, type Instructions, JesusFilmProvider, LessonsChurchProvider, LifeChurchProvider, type MediaLicenseResult, type MediaLicenseStatus, type MessageFileInterface, OAuthHelper, type Plan, type PlanPresentation, type PlanSection, type PlanTimelineItem, PlanningCenterProvider, type ProviderCapabilities, type ProviderInfo, type ProviderLogos, SignPresenterProvider, TokenHelper, VERSION, type VenueActionInterface, type VenueActionsResponseInterface, type VenueSectionActionsInterface, authIsExpired, getAllProviders, getAvailableProviders, getProvider, getProviderConfig, isContentFile, isContentFolder, navigateToPath, registerProvider, setProviderSecret, toAuthData };
|
|
609
|
+
export { APlayProvider, type AuthType, B1ChurchProvider, BaseProvider, BibleProjectProvider, CbnProvider, type ContentDownload, type ContentFile, type ContentFolder, type ContentItem, type ContentProviderAuthData, type ContentProviderConfig, type CurrentPlan, type DeviceAuthorizationResponse, DeviceFlowHelper, type DeviceFlowPollResult, type DeviceFlowState, DropboxProvider, type EndpointValue, type EndpointsConfig, type FeedActionInterface, type FeedDownloadInterface, type FeedFileInterface, type FeedSectionInterface, type FeedVenueInterface, HighVoltageKidsProvider, type IProvider, type InstructionItem, type Instructions, JesusFilmProvider, LessonsChurchProvider, LifeChurchProvider, type MediaLicenseResult, type MediaLicenseStatus, type MessageFileInterface, OAuthHelper, type Plan, type PlanPresentation, type PlanSection, type PlanTimelineItem, PlanningCenterProvider, type ProviderCapabilities, type ProviderInfo, type ProviderLogos, SignPresenterProvider, TokenHelper, VERSION, type VenueActionInterface, type VenueActionsResponseInterface, type VenueSectionActionsInterface, authIsExpired, getAllProviders, getAvailableProviders, getProvider, getProviderConfig, isContentFile, isContentFolder, navigateToPath, registerProvider, setProviderSecret, toAuthData };
|
package/dist/index.d.ts
CHANGED
|
@@ -116,6 +116,11 @@ interface FeedFileInterface {
|
|
|
116
116
|
seconds?: number;
|
|
117
117
|
fileType?: string;
|
|
118
118
|
thumbnail?: string;
|
|
119
|
+
bytes?: number;
|
|
120
|
+
}
|
|
121
|
+
interface FeedDownloadInterface {
|
|
122
|
+
name?: string;
|
|
123
|
+
files?: FeedFileInterface[];
|
|
119
124
|
}
|
|
120
125
|
interface FeedActionInterface {
|
|
121
126
|
id?: string;
|
|
@@ -135,6 +140,7 @@ interface FeedVenueInterface {
|
|
|
135
140
|
lessonName?: string;
|
|
136
141
|
lessonDescription?: string;
|
|
137
142
|
lessonImage?: string;
|
|
143
|
+
downloads?: FeedDownloadInterface[];
|
|
138
144
|
sections?: FeedSectionInterface[];
|
|
139
145
|
}
|
|
140
146
|
interface InstructionItem {
|
|
@@ -150,9 +156,18 @@ interface InstructionItem {
|
|
|
150
156
|
thumbnail?: string;
|
|
151
157
|
mediaType?: "video" | "image" | "audio";
|
|
152
158
|
}
|
|
159
|
+
/** An extra file the teacher downloads/prints (zip, PDF, leader guide) — never part of the presented playlist. */
|
|
160
|
+
interface ContentDownload {
|
|
161
|
+
id?: string;
|
|
162
|
+
title: string;
|
|
163
|
+
url: string;
|
|
164
|
+
fileType?: string;
|
|
165
|
+
bytes?: number;
|
|
166
|
+
}
|
|
153
167
|
interface Instructions {
|
|
154
168
|
name?: string;
|
|
155
169
|
items: InstructionItem[];
|
|
170
|
+
downloads?: ContentDownload[];
|
|
156
171
|
}
|
|
157
172
|
interface MessageFileInterface {
|
|
158
173
|
id?: string;
|
|
@@ -380,6 +395,8 @@ declare class LessonsChurchProvider extends BaseProvider {
|
|
|
380
395
|
private getAddOnFiles;
|
|
381
396
|
private getAddOnCategories;
|
|
382
397
|
private getAddOnsByCategory;
|
|
398
|
+
/** Flatten feed download bundles into printable files, keeping playlist media (videos already in the run-of-show) out. */
|
|
399
|
+
private convertFeedDownloads;
|
|
383
400
|
getInstructions(path: string, _auth?: ContentProviderAuthData | null): Promise<Instructions | null>;
|
|
384
401
|
}
|
|
385
402
|
|
|
@@ -589,4 +606,4 @@ declare function getAvailableProviders(ids?: string[]): ProviderInfo[];
|
|
|
589
606
|
*/
|
|
590
607
|
declare const VERSION: string;
|
|
591
608
|
|
|
592
|
-
export { APlayProvider, type AuthType, B1ChurchProvider, BaseProvider, BibleProjectProvider, CbnProvider, type ContentFile, type ContentFolder, type ContentItem, type ContentProviderAuthData, type ContentProviderConfig, type CurrentPlan, type DeviceAuthorizationResponse, DeviceFlowHelper, type DeviceFlowPollResult, type DeviceFlowState, DropboxProvider, type EndpointValue, type EndpointsConfig, type FeedActionInterface, type FeedFileInterface, type FeedSectionInterface, type FeedVenueInterface, HighVoltageKidsProvider, type IProvider, type InstructionItem, type Instructions, JesusFilmProvider, LessonsChurchProvider, LifeChurchProvider, type MediaLicenseResult, type MediaLicenseStatus, type MessageFileInterface, OAuthHelper, type Plan, type PlanPresentation, type PlanSection, type PlanTimelineItem, PlanningCenterProvider, type ProviderCapabilities, type ProviderInfo, type ProviderLogos, SignPresenterProvider, TokenHelper, VERSION, type VenueActionInterface, type VenueActionsResponseInterface, type VenueSectionActionsInterface, authIsExpired, getAllProviders, getAvailableProviders, getProvider, getProviderConfig, isContentFile, isContentFolder, navigateToPath, registerProvider, setProviderSecret, toAuthData };
|
|
609
|
+
export { APlayProvider, type AuthType, B1ChurchProvider, BaseProvider, BibleProjectProvider, CbnProvider, type ContentDownload, type ContentFile, type ContentFolder, type ContentItem, type ContentProviderAuthData, type ContentProviderConfig, type CurrentPlan, type DeviceAuthorizationResponse, DeviceFlowHelper, type DeviceFlowPollResult, type DeviceFlowState, DropboxProvider, type EndpointValue, type EndpointsConfig, type FeedActionInterface, type FeedDownloadInterface, type FeedFileInterface, type FeedSectionInterface, type FeedVenueInterface, HighVoltageKidsProvider, type IProvider, type InstructionItem, type Instructions, JesusFilmProvider, LessonsChurchProvider, LifeChurchProvider, type MediaLicenseResult, type MediaLicenseStatus, type MessageFileInterface, OAuthHelper, type Plan, type PlanPresentation, type PlanSection, type PlanTimelineItem, PlanningCenterProvider, type ProviderCapabilities, type ProviderInfo, type ProviderLogos, SignPresenterProvider, TokenHelper, VERSION, type VenueActionInterface, type VenueActionsResponseInterface, type VenueSectionActionsInterface, authIsExpired, getAllProviders, getAvailableProviders, getProvider, getProviderConfig, isContentFile, isContentFolder, navigateToPath, registerProvider, setProviderSecret, toAuthData };
|
package/dist/index.js
CHANGED
|
@@ -286,6 +286,12 @@ function isMediaFile(filename) {
|
|
|
286
286
|
const lower = filename.toLowerCase();
|
|
287
287
|
return [...VIDEO_EXTENSIONS, ...IMAGE_EXTENSIONS, ...AUDIO_EXTENSIONS].some((ext) => lower.endsWith(ext));
|
|
288
288
|
}
|
|
289
|
+
function isPlaylistMedia(url, fileType, name) {
|
|
290
|
+
if (fileType?.startsWith("video/") || fileType?.startsWith("audio/") || fileType === "video" || fileType === "audio") return true;
|
|
291
|
+
const haystack = `${url} ${name || ""}`.toLowerCase();
|
|
292
|
+
if (haystack.includes("stream.mux.com") || haystack.includes("externalvideos/download")) return true;
|
|
293
|
+
return [...VIDEO_EXTENSIONS, ...AUDIO_EXTENSIONS].some((ext) => haystack.includes(ext));
|
|
294
|
+
}
|
|
289
295
|
function createFolder(id, title, path, thumbnail, isLeaf) {
|
|
290
296
|
return { type: "folder", id, title, path, thumbnail, isLeaf };
|
|
291
297
|
}
|
|
@@ -959,6 +965,18 @@ var LessonsChurchProvider = class extends BaseProvider {
|
|
|
959
965
|
const filtered = allAddOns.filter((a) => a.category === decodedCategory);
|
|
960
966
|
return filtered.map((addOn) => createFolder(addOn.id, addOn.name, `${currentPath}/${addOn.id}`, addOn.image, true));
|
|
961
967
|
}
|
|
968
|
+
/** Flatten feed download bundles into printable files, keeping playlist media (videos already in the run-of-show) out. */
|
|
969
|
+
convertFeedDownloads(bundles) {
|
|
970
|
+
const result = [];
|
|
971
|
+
for (const bundle of bundles || []) {
|
|
972
|
+
const files = (bundle.files || []).filter((f) => f.url && !isPlaylistMedia(f.url, f.fileType, f.name));
|
|
973
|
+
for (const file of files) {
|
|
974
|
+
const title = (files.length === 1 ? bundle.name || file.name : file.name || bundle.name) || "Download";
|
|
975
|
+
result.push({ id: file.id, title, url: file.url, fileType: file.fileType, bytes: file.bytes });
|
|
976
|
+
}
|
|
977
|
+
}
|
|
978
|
+
return result;
|
|
979
|
+
}
|
|
962
980
|
async getInstructions(path, _auth) {
|
|
963
981
|
const venueId = getSegment(path, 4);
|
|
964
982
|
if (venueId) {
|
|
@@ -970,7 +988,8 @@ var LessonsChurchProvider = class extends BaseProvider {
|
|
|
970
988
|
if (!planItemsResponse) return null;
|
|
971
989
|
const lessonImage = feedResponse?.lessonImage;
|
|
972
990
|
const sectionActionsMap = buildSectionActionsMap(actionsResponse, lessonImage, feedResponse);
|
|
973
|
-
|
|
991
|
+
const downloads = this.convertFeedDownloads(feedResponse?.downloads);
|
|
992
|
+
return { name: planItemsResponse.venueName, items: (planItemsResponse.items || []).map((item) => processInstructionItem(item, sectionActionsMap, lessonImage)), downloads: downloads.length > 0 ? downloads : void 0 };
|
|
974
993
|
}
|
|
975
994
|
const { segments } = parsePath(path);
|
|
976
995
|
if (segments[0] === "addons" && segments.length === 3) {
|
|
@@ -17740,7 +17759,10 @@ var GoCurriculumProvider = class extends BaseProvider {
|
|
|
17740
17759
|
if (!files) return null;
|
|
17741
17760
|
const collection = (await this.getData()).catalog.find((c) => c.id === segments[0]);
|
|
17742
17761
|
const lesson = collection?.lessons.find((l) => l.id === segments[1]);
|
|
17743
|
-
|
|
17762
|
+
const instructions = filesToInstructions(lesson?.name || "Lesson", files);
|
|
17763
|
+
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 }));
|
|
17764
|
+
if (downloads.length > 0) instructions.downloads = downloads;
|
|
17765
|
+
return instructions;
|
|
17744
17766
|
}
|
|
17745
17767
|
generateCodeVerifier() {
|
|
17746
17768
|
return this.oauthHelper.generateCodeVerifier();
|
|
@@ -17987,7 +18009,7 @@ function getAvailableProviders(ids) {
|
|
|
17987
18009
|
}
|
|
17988
18010
|
|
|
17989
18011
|
// src/index.ts
|
|
17990
|
-
var VERSION = true ? "0.
|
|
18012
|
+
var VERSION = true ? "0.10.0" : "dev";
|
|
17991
18013
|
export {
|
|
17992
18014
|
APlayProvider,
|
|
17993
18015
|
B1ChurchProvider,
|