@churchapps/content-provider-helper 0.0.3 → 0.0.4
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 +446 -361
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +73 -27
- package/dist/index.d.ts +73 -27
- package/dist/index.js +439 -359
- package/dist/index.js.map +1 -1
- package/package.json +55 -55
package/dist/index.d.cts
CHANGED
|
@@ -52,7 +52,6 @@ interface ContentFolder {
|
|
|
52
52
|
image?: string;
|
|
53
53
|
isLeaf?: boolean;
|
|
54
54
|
path: string;
|
|
55
|
-
providerData?: Record<string, unknown>;
|
|
56
55
|
}
|
|
57
56
|
interface ContentFile {
|
|
58
57
|
type: "file";
|
|
@@ -66,7 +65,10 @@ interface ContentFile {
|
|
|
66
65
|
decryptionKey?: string;
|
|
67
66
|
mediaId?: string;
|
|
68
67
|
pingbackUrl?: string;
|
|
69
|
-
|
|
68
|
+
seconds?: number;
|
|
69
|
+
loop?: boolean;
|
|
70
|
+
loopVideo?: boolean;
|
|
71
|
+
streamUrl?: string;
|
|
70
72
|
}
|
|
71
73
|
type ContentItem = ContentFolder | ContentFile;
|
|
72
74
|
declare function isContentFolder(item: ContentItem): item is ContentFolder;
|
|
@@ -156,7 +158,6 @@ interface ProviderCapabilities {
|
|
|
156
158
|
presentations: boolean;
|
|
157
159
|
playlist: boolean;
|
|
158
160
|
instructions: boolean;
|
|
159
|
-
expandedInstructions: boolean;
|
|
160
161
|
mediaLicensing: boolean;
|
|
161
162
|
}
|
|
162
163
|
type MediaLicenseStatus = "valid" | "expired" | "not_licensed" | "unknown";
|
|
@@ -181,7 +182,6 @@ interface IProvider {
|
|
|
181
182
|
getPresentations(path: string, auth?: ContentProviderAuthData | null): Promise<Plan | null>;
|
|
182
183
|
getPlaylist?(path: string, auth?: ContentProviderAuthData | null, resolution?: number): Promise<ContentFile[] | null>;
|
|
183
184
|
getInstructions?(path: string, auth?: ContentProviderAuthData | null): Promise<Instructions | null>;
|
|
184
|
-
getExpandedInstructions?(path: string, auth?: ContentProviderAuthData | null): Promise<Instructions | null>;
|
|
185
185
|
checkMediaLicense?(mediaId: string, auth?: ContentProviderAuthData | null): Promise<MediaLicenseResult | null>;
|
|
186
186
|
}
|
|
187
187
|
/**
|
|
@@ -196,7 +196,6 @@ interface IContentProvider {
|
|
|
196
196
|
getPresentations(path: string, auth?: ContentProviderAuthData | null): Promise<Plan | null>;
|
|
197
197
|
getPlaylist(path: string, auth?: ContentProviderAuthData | null, resolution?: number): Promise<ContentFile[] | null>;
|
|
198
198
|
getInstructions(path: string, auth?: ContentProviderAuthData | null): Promise<Instructions | null>;
|
|
199
|
-
getExpandedInstructions(path: string, auth?: ContentProviderAuthData | null): Promise<Instructions | null>;
|
|
200
199
|
requiresAuth(): boolean;
|
|
201
200
|
getCapabilities(): ProviderCapabilities;
|
|
202
201
|
checkMediaLicense(mediaId: string, auth?: ContentProviderAuthData | null): Promise<MediaLicenseResult | null>;
|
|
@@ -224,12 +223,15 @@ interface IAuthProvider {
|
|
|
224
223
|
}
|
|
225
224
|
|
|
226
225
|
declare function detectMediaType(url: string, explicitType?: string): "video" | "image";
|
|
227
|
-
declare function createFolder(id: string, title: string, path: string, image?: string,
|
|
226
|
+
declare function createFolder(id: string, title: string, path: string, image?: string, isLeaf?: boolean): ContentFolder;
|
|
228
227
|
declare function createFile(id: string, title: string, url: string, options?: {
|
|
229
228
|
mediaType?: "video" | "image";
|
|
230
229
|
image?: string;
|
|
231
230
|
muxPlaybackId?: string;
|
|
232
|
-
|
|
231
|
+
seconds?: number;
|
|
232
|
+
loop?: boolean;
|
|
233
|
+
loopVideo?: boolean;
|
|
234
|
+
streamUrl?: string;
|
|
233
235
|
}): ContentFile;
|
|
234
236
|
|
|
235
237
|
/**
|
|
@@ -268,19 +270,60 @@ declare function buildPath(segments: string[]): string;
|
|
|
268
270
|
*/
|
|
269
271
|
declare function appendToPath(basePath: string | null | undefined, segment: string): string;
|
|
270
272
|
|
|
273
|
+
/**
|
|
274
|
+
* Navigate to a specific item using a dot-notation path.
|
|
275
|
+
* Path format: "0.2.1" means items[0].children[2].children[1]
|
|
276
|
+
*/
|
|
277
|
+
declare function navigateToPath(instructions: Instructions, path: string): InstructionItem | null;
|
|
278
|
+
/**
|
|
279
|
+
* Generate a path string for an item given its position in the tree.
|
|
280
|
+
* Used when selecting an item to store its path.
|
|
281
|
+
*/
|
|
282
|
+
declare function generatePath(indices: number[]): string;
|
|
283
|
+
|
|
284
|
+
interface DurationEstimationConfig {
|
|
285
|
+
secondsPerImage: number;
|
|
286
|
+
wordsPerMinute: number;
|
|
287
|
+
}
|
|
288
|
+
declare const DEFAULT_DURATION_CONFIG: DurationEstimationConfig;
|
|
289
|
+
/**
|
|
290
|
+
* Count words in text (splits on whitespace)
|
|
291
|
+
*/
|
|
292
|
+
declare function countWords(text: string): number;
|
|
293
|
+
/**
|
|
294
|
+
* Estimate duration for image content
|
|
295
|
+
* @returns Duration in seconds (default: 15)
|
|
296
|
+
*/
|
|
297
|
+
declare function estimateImageDuration(config?: Partial<DurationEstimationConfig>): number;
|
|
298
|
+
/**
|
|
299
|
+
* Estimate duration for text content based on word count
|
|
300
|
+
* @param text - The text content
|
|
301
|
+
* @param config - Optional configuration overrides
|
|
302
|
+
* @returns Duration in seconds
|
|
303
|
+
*/
|
|
304
|
+
declare function estimateTextDuration(text: string, config?: Partial<DurationEstimationConfig>): number;
|
|
305
|
+
/**
|
|
306
|
+
* Estimate duration based on media type
|
|
307
|
+
* @param mediaType - "video" | "image" | "text"
|
|
308
|
+
* @param options - Text content or word count for text estimation
|
|
309
|
+
* @returns Duration in seconds (0 for video/unknown)
|
|
310
|
+
*/
|
|
311
|
+
declare function estimateDuration(mediaType: "video" | "image" | "text", options?: {
|
|
312
|
+
text?: string;
|
|
313
|
+
wordCount?: number;
|
|
314
|
+
config?: Partial<DurationEstimationConfig>;
|
|
315
|
+
}): number;
|
|
316
|
+
|
|
271
317
|
declare function presentationsToPlaylist(plan: Plan): ContentFile[];
|
|
272
|
-
declare function presentationsToInstructions(plan: Plan): Instructions;
|
|
273
318
|
declare function presentationsToExpandedInstructions(plan: Plan): Instructions;
|
|
274
319
|
declare function instructionsToPlaylist(instructions: Instructions): ContentFile[];
|
|
275
320
|
declare const expandedInstructionsToPlaylist: typeof instructionsToPlaylist;
|
|
276
321
|
declare function instructionsToPresentations(instructions: Instructions, planId?: string): Plan;
|
|
277
322
|
declare const expandedInstructionsToPresentations: typeof instructionsToPresentations;
|
|
278
|
-
declare function collapseInstructions(instructions: Instructions, maxDepth?: number): Instructions;
|
|
279
323
|
declare function playlistToPresentations(files: ContentFile[], planName?: string, sectionName?: string): Plan;
|
|
280
324
|
declare function playlistToInstructions(files: ContentFile[], venueName?: string): Instructions;
|
|
281
325
|
declare const playlistToExpandedInstructions: typeof playlistToInstructions;
|
|
282
326
|
|
|
283
|
-
declare const FormatConverters_collapseInstructions: typeof collapseInstructions;
|
|
284
327
|
declare const FormatConverters_expandedInstructionsToPlaylist: typeof expandedInstructionsToPlaylist;
|
|
285
328
|
declare const FormatConverters_expandedInstructionsToPresentations: typeof expandedInstructionsToPresentations;
|
|
286
329
|
declare const FormatConverters_instructionsToPlaylist: typeof instructionsToPlaylist;
|
|
@@ -289,10 +332,9 @@ declare const FormatConverters_playlistToExpandedInstructions: typeof playlistTo
|
|
|
289
332
|
declare const FormatConverters_playlistToInstructions: typeof playlistToInstructions;
|
|
290
333
|
declare const FormatConverters_playlistToPresentations: typeof playlistToPresentations;
|
|
291
334
|
declare const FormatConverters_presentationsToExpandedInstructions: typeof presentationsToExpandedInstructions;
|
|
292
|
-
declare const FormatConverters_presentationsToInstructions: typeof presentationsToInstructions;
|
|
293
335
|
declare const FormatConverters_presentationsToPlaylist: typeof presentationsToPlaylist;
|
|
294
336
|
declare namespace FormatConverters {
|
|
295
|
-
export {
|
|
337
|
+
export { FormatConverters_expandedInstructionsToPlaylist as expandedInstructionsToPlaylist, FormatConverters_expandedInstructionsToPresentations as expandedInstructionsToPresentations, FormatConverters_instructionsToPlaylist as instructionsToPlaylist, FormatConverters_instructionsToPresentations as instructionsToPresentations, FormatConverters_playlistToExpandedInstructions as playlistToExpandedInstructions, FormatConverters_playlistToInstructions as playlistToInstructions, FormatConverters_playlistToPresentations as playlistToPresentations, FormatConverters_presentationsToExpandedInstructions as presentationsToExpandedInstructions, FormatConverters_presentationsToPlaylist as presentationsToPlaylist };
|
|
296
338
|
}
|
|
297
339
|
|
|
298
340
|
interface FormatResolverOptions {
|
|
@@ -300,7 +342,7 @@ interface FormatResolverOptions {
|
|
|
300
342
|
}
|
|
301
343
|
interface ResolvedFormatMeta {
|
|
302
344
|
isNative: boolean;
|
|
303
|
-
sourceFormat?: "playlist" | "presentations" | "instructions"
|
|
345
|
+
sourceFormat?: "playlist" | "presentations" | "instructions";
|
|
304
346
|
isLossy: boolean;
|
|
305
347
|
}
|
|
306
348
|
declare class FormatResolver {
|
|
@@ -325,11 +367,6 @@ declare class FormatResolver {
|
|
|
325
367
|
data: Instructions | null;
|
|
326
368
|
meta: ResolvedFormatMeta;
|
|
327
369
|
}>;
|
|
328
|
-
getExpandedInstructions(path: string, auth?: ContentProviderAuthData | null): Promise<Instructions | null>;
|
|
329
|
-
getExpandedInstructionsWithMeta(path: string, auth?: ContentProviderAuthData | null): Promise<{
|
|
330
|
-
data: Instructions | null;
|
|
331
|
-
meta: ResolvedFormatMeta;
|
|
332
|
-
}>;
|
|
333
370
|
}
|
|
334
371
|
|
|
335
372
|
declare class OAuthHelper {
|
|
@@ -357,7 +394,7 @@ declare class DeviceFlowHelper {
|
|
|
357
394
|
|
|
358
395
|
declare class ApiHelper {
|
|
359
396
|
createAuthHeaders(auth: ContentProviderAuthData | null | undefined): Record<string, string> | null;
|
|
360
|
-
apiRequest<T>(config: ContentProviderConfig,
|
|
397
|
+
apiRequest<T>(config: ContentProviderConfig, _providerId: string, path: string, auth?: ContentProviderAuthData | null, method?: "GET" | "POST", body?: unknown): Promise<T | null>;
|
|
361
398
|
}
|
|
362
399
|
|
|
363
400
|
/**
|
|
@@ -378,7 +415,6 @@ declare abstract class ContentProvider implements IContentProvider, IAuthProvide
|
|
|
378
415
|
abstract getPresentations(path: string, auth?: ContentProviderAuthData | null): Promise<Plan | null>;
|
|
379
416
|
getPlaylist(path: string, auth?: ContentProviderAuthData | null, _resolution?: number): Promise<ContentFile[] | null>;
|
|
380
417
|
getInstructions(path: string, auth?: ContentProviderAuthData | null): Promise<Instructions | null>;
|
|
381
|
-
getExpandedInstructions(path: string, auth?: ContentProviderAuthData | null): Promise<Instructions | null>;
|
|
382
418
|
requiresAuth(): boolean;
|
|
383
419
|
getCapabilities(): ProviderCapabilities;
|
|
384
420
|
checkMediaLicense(_mediaId: string, _auth?: ContentProviderAuthData | null): Promise<MediaLicenseResult | null>;
|
|
@@ -399,12 +435,15 @@ declare abstract class ContentProvider implements IContentProvider, IAuthProvide
|
|
|
399
435
|
calculatePollDelay(baseInterval?: number, slowDownCount?: number): number;
|
|
400
436
|
protected createAuthHeaders(auth: ContentProviderAuthData | null | undefined): Record<string, string> | null;
|
|
401
437
|
protected apiRequest<T>(path: string, auth?: ContentProviderAuthData | null, method?: "GET" | "POST", body?: unknown): Promise<T | null>;
|
|
402
|
-
protected createFolder(id: string, title: string, path: string, image?: string,
|
|
438
|
+
protected createFolder(id: string, title: string, path: string, image?: string, isLeaf?: boolean): ContentFolder;
|
|
403
439
|
protected createFile(id: string, title: string, url: string, options?: {
|
|
404
440
|
mediaType?: "video" | "image";
|
|
405
441
|
image?: string;
|
|
406
442
|
muxPlaybackId?: string;
|
|
407
|
-
|
|
443
|
+
seconds?: number;
|
|
444
|
+
loop?: boolean;
|
|
445
|
+
loopVideo?: boolean;
|
|
446
|
+
streamUrl?: string;
|
|
408
447
|
}): ContentFile;
|
|
409
448
|
}
|
|
410
449
|
|
|
@@ -434,6 +473,8 @@ declare class APlayProvider implements IProvider {
|
|
|
434
473
|
private getLibraryFolders;
|
|
435
474
|
private getMediaFiles;
|
|
436
475
|
getPresentations(path: string, auth?: ContentProviderAuthData | null): Promise<Plan | null>;
|
|
476
|
+
getPlaylist(path: string, auth?: ContentProviderAuthData | null, _resolution?: number): Promise<ContentFile[] | null>;
|
|
477
|
+
getInstructions(path: string, auth?: ContentProviderAuthData | null): Promise<Instructions | null>;
|
|
437
478
|
checkMediaLicense(mediaId: string, auth?: ContentProviderAuthData | null): Promise<MediaLicenseResult | null>;
|
|
438
479
|
}
|
|
439
480
|
|
|
@@ -458,6 +499,8 @@ declare class SignPresenterProvider implements IProvider {
|
|
|
458
499
|
private getPlaylists;
|
|
459
500
|
private getMessages;
|
|
460
501
|
getPresentations(path: string, auth?: ContentProviderAuthData | null): Promise<Plan | null>;
|
|
502
|
+
getPlaylist(path: string, auth?: ContentProviderAuthData | null, _resolution?: number): Promise<ContentFile[] | null>;
|
|
503
|
+
getInstructions(path: string, auth?: ContentProviderAuthData | null): Promise<Instructions | null>;
|
|
461
504
|
}
|
|
462
505
|
|
|
463
506
|
/**
|
|
@@ -496,7 +539,6 @@ declare class LessonsChurchProvider implements IProvider {
|
|
|
496
539
|
private convertAddOnToFile;
|
|
497
540
|
getPresentations(path: string, _auth?: ContentProviderAuthData | null): Promise<Plan | null>;
|
|
498
541
|
getInstructions(path: string, _auth?: ContentProviderAuthData | null): Promise<Instructions | null>;
|
|
499
|
-
getExpandedInstructions(path: string, _auth?: ContentProviderAuthData | null): Promise<Instructions | null>;
|
|
500
542
|
private normalizeItemType;
|
|
501
543
|
private getEmbedUrl;
|
|
502
544
|
private convertVenueToPlan;
|
|
@@ -525,8 +567,9 @@ declare class B1ChurchProvider implements IProvider {
|
|
|
525
567
|
browse(path?: string | null, authData?: ContentProviderAuthData | null): Promise<ContentItem[]>;
|
|
526
568
|
getPresentations(path: string, authData?: ContentProviderAuthData | null): Promise<Plan | null>;
|
|
527
569
|
getInstructions(path: string, authData?: ContentProviderAuthData | null): Promise<Instructions | null>;
|
|
528
|
-
getExpandedInstructions(path: string, authData?: ContentProviderAuthData | null): Promise<Instructions | null>;
|
|
529
570
|
private processInstructionItems;
|
|
571
|
+
private findItemByPath;
|
|
572
|
+
private findPresentationByPath;
|
|
530
573
|
getPlaylist(path: string, authData?: ContentProviderAuthData | null, resolution?: number): Promise<ContentFile[] | null>;
|
|
531
574
|
}
|
|
532
575
|
|
|
@@ -558,6 +601,8 @@ declare class PlanningCenterProvider implements IProvider {
|
|
|
558
601
|
private convertSongToPresentation;
|
|
559
602
|
private convertMediaToPresentation;
|
|
560
603
|
private formatDate;
|
|
604
|
+
getPlaylist(path: string, auth?: ContentProviderAuthData | null, _resolution?: number): Promise<ContentFile[] | null>;
|
|
605
|
+
getInstructions(path: string, auth?: ContentProviderAuthData | null): Promise<Instructions | null>;
|
|
561
606
|
}
|
|
562
607
|
|
|
563
608
|
/**
|
|
@@ -583,6 +628,7 @@ declare class BibleProjectProvider implements IProvider {
|
|
|
583
628
|
private getVideoFile;
|
|
584
629
|
getPresentations(path: string, _auth?: ContentProviderAuthData | null): Promise<Plan | null>;
|
|
585
630
|
getPlaylist(path: string, _auth?: ContentProviderAuthData | null, _resolution?: number): Promise<ContentFile[] | null>;
|
|
631
|
+
getInstructions(path: string, _auth?: ContentProviderAuthData | null): Promise<Instructions | null>;
|
|
586
632
|
private slugify;
|
|
587
633
|
}
|
|
588
634
|
|
|
@@ -611,7 +657,7 @@ declare class HighVoltageKidsProvider implements IProvider {
|
|
|
611
657
|
private getLessonFiles;
|
|
612
658
|
getPresentations(path: string, _auth?: ContentProviderAuthData | null): Promise<Plan | null>;
|
|
613
659
|
getPlaylist(path: string, _auth?: ContentProviderAuthData | null, _resolution?: number): Promise<ContentFile[] | null>;
|
|
614
|
-
|
|
660
|
+
getInstructions(path: string, _auth?: ContentProviderAuthData | null): Promise<Instructions | null>;
|
|
615
661
|
private slugify;
|
|
616
662
|
private groupFilesIntoActions;
|
|
617
663
|
private getBaseName;
|
|
@@ -644,6 +690,6 @@ declare function getAvailableProviders(ids?: string[]): ProviderInfo[];
|
|
|
644
690
|
* @churchapps/content-provider-helper
|
|
645
691
|
* Helper classes for interacting with third party content providers
|
|
646
692
|
*/
|
|
647
|
-
declare const VERSION = "0.0.
|
|
693
|
+
declare const VERSION = "0.0.4";
|
|
648
694
|
|
|
649
|
-
export { APlayProvider, ApiHelper, type AuthType, B1ChurchProvider, BibleProjectProvider, type ContentFile, type ContentFolder, type ContentItem, ContentProvider, type ContentProviderAuthData, type ContentProviderConfig, type DeviceAuthorizationResponse, DeviceFlowHelper, type DeviceFlowPollResult, type DeviceFlowState, type FeedActionInterface, type FeedFileInterface, type FeedSectionInterface, type FeedVenueInterface, FormatConverters, FormatResolver, type FormatResolverOptions, HighVoltageKidsProvider, type IAuthProvider, type IContentProvider, type IProvider, type InstructionItem, type Instructions, LessonsChurchProvider, type MediaLicenseResult, type MediaLicenseStatus, OAuthHelper, type Plan, type PlanPresentation, type PlanSection, PlanningCenterProvider, type ProviderCapabilities, type ProviderInfo, type ProviderLogos, type ResolvedFormatMeta, SignPresenterProvider, TokenHelper, VERSION, type VenueActionInterface, type VenueActionsResponseInterface, type VenueSectionActionsInterface, appendToPath, buildPath,
|
|
695
|
+
export { APlayProvider, ApiHelper, type AuthType, B1ChurchProvider, BibleProjectProvider, type ContentFile, type ContentFolder, type ContentItem, ContentProvider, type ContentProviderAuthData, type ContentProviderConfig, DEFAULT_DURATION_CONFIG, type DeviceAuthorizationResponse, DeviceFlowHelper, type DeviceFlowPollResult, type DeviceFlowState, type DurationEstimationConfig, type FeedActionInterface, type FeedFileInterface, type FeedSectionInterface, type FeedVenueInterface, FormatConverters, FormatResolver, type FormatResolverOptions, HighVoltageKidsProvider, type IAuthProvider, type IContentProvider, type IProvider, type InstructionItem, type Instructions, LessonsChurchProvider, type MediaLicenseResult, type MediaLicenseStatus, OAuthHelper, type Plan, type PlanPresentation, type PlanSection, PlanningCenterProvider, type ProviderCapabilities, type ProviderInfo, type ProviderLogos, type ResolvedFormatMeta, SignPresenterProvider, TokenHelper, VERSION, type VenueActionInterface, type VenueActionsResponseInterface, type VenueSectionActionsInterface, appendToPath, buildPath, countWords, createFile, createFolder, detectMediaType, estimateDuration, estimateImageDuration, estimateTextDuration, expandedInstructionsToPlaylist, expandedInstructionsToPresentations, generatePath, getAllProviders, getAvailableProviders, getProvider, getProviderConfig, getSegment, instructionsToPlaylist, instructionsToPresentations, isContentFile, isContentFolder, navigateToPath, parsePath, playlistToExpandedInstructions, playlistToInstructions, playlistToPresentations, presentationsToExpandedInstructions, presentationsToPlaylist, registerProvider };
|
package/dist/index.d.ts
CHANGED
|
@@ -52,7 +52,6 @@ interface ContentFolder {
|
|
|
52
52
|
image?: string;
|
|
53
53
|
isLeaf?: boolean;
|
|
54
54
|
path: string;
|
|
55
|
-
providerData?: Record<string, unknown>;
|
|
56
55
|
}
|
|
57
56
|
interface ContentFile {
|
|
58
57
|
type: "file";
|
|
@@ -66,7 +65,10 @@ interface ContentFile {
|
|
|
66
65
|
decryptionKey?: string;
|
|
67
66
|
mediaId?: string;
|
|
68
67
|
pingbackUrl?: string;
|
|
69
|
-
|
|
68
|
+
seconds?: number;
|
|
69
|
+
loop?: boolean;
|
|
70
|
+
loopVideo?: boolean;
|
|
71
|
+
streamUrl?: string;
|
|
70
72
|
}
|
|
71
73
|
type ContentItem = ContentFolder | ContentFile;
|
|
72
74
|
declare function isContentFolder(item: ContentItem): item is ContentFolder;
|
|
@@ -156,7 +158,6 @@ interface ProviderCapabilities {
|
|
|
156
158
|
presentations: boolean;
|
|
157
159
|
playlist: boolean;
|
|
158
160
|
instructions: boolean;
|
|
159
|
-
expandedInstructions: boolean;
|
|
160
161
|
mediaLicensing: boolean;
|
|
161
162
|
}
|
|
162
163
|
type MediaLicenseStatus = "valid" | "expired" | "not_licensed" | "unknown";
|
|
@@ -181,7 +182,6 @@ interface IProvider {
|
|
|
181
182
|
getPresentations(path: string, auth?: ContentProviderAuthData | null): Promise<Plan | null>;
|
|
182
183
|
getPlaylist?(path: string, auth?: ContentProviderAuthData | null, resolution?: number): Promise<ContentFile[] | null>;
|
|
183
184
|
getInstructions?(path: string, auth?: ContentProviderAuthData | null): Promise<Instructions | null>;
|
|
184
|
-
getExpandedInstructions?(path: string, auth?: ContentProviderAuthData | null): Promise<Instructions | null>;
|
|
185
185
|
checkMediaLicense?(mediaId: string, auth?: ContentProviderAuthData | null): Promise<MediaLicenseResult | null>;
|
|
186
186
|
}
|
|
187
187
|
/**
|
|
@@ -196,7 +196,6 @@ interface IContentProvider {
|
|
|
196
196
|
getPresentations(path: string, auth?: ContentProviderAuthData | null): Promise<Plan | null>;
|
|
197
197
|
getPlaylist(path: string, auth?: ContentProviderAuthData | null, resolution?: number): Promise<ContentFile[] | null>;
|
|
198
198
|
getInstructions(path: string, auth?: ContentProviderAuthData | null): Promise<Instructions | null>;
|
|
199
|
-
getExpandedInstructions(path: string, auth?: ContentProviderAuthData | null): Promise<Instructions | null>;
|
|
200
199
|
requiresAuth(): boolean;
|
|
201
200
|
getCapabilities(): ProviderCapabilities;
|
|
202
201
|
checkMediaLicense(mediaId: string, auth?: ContentProviderAuthData | null): Promise<MediaLicenseResult | null>;
|
|
@@ -224,12 +223,15 @@ interface IAuthProvider {
|
|
|
224
223
|
}
|
|
225
224
|
|
|
226
225
|
declare function detectMediaType(url: string, explicitType?: string): "video" | "image";
|
|
227
|
-
declare function createFolder(id: string, title: string, path: string, image?: string,
|
|
226
|
+
declare function createFolder(id: string, title: string, path: string, image?: string, isLeaf?: boolean): ContentFolder;
|
|
228
227
|
declare function createFile(id: string, title: string, url: string, options?: {
|
|
229
228
|
mediaType?: "video" | "image";
|
|
230
229
|
image?: string;
|
|
231
230
|
muxPlaybackId?: string;
|
|
232
|
-
|
|
231
|
+
seconds?: number;
|
|
232
|
+
loop?: boolean;
|
|
233
|
+
loopVideo?: boolean;
|
|
234
|
+
streamUrl?: string;
|
|
233
235
|
}): ContentFile;
|
|
234
236
|
|
|
235
237
|
/**
|
|
@@ -268,19 +270,60 @@ declare function buildPath(segments: string[]): string;
|
|
|
268
270
|
*/
|
|
269
271
|
declare function appendToPath(basePath: string | null | undefined, segment: string): string;
|
|
270
272
|
|
|
273
|
+
/**
|
|
274
|
+
* Navigate to a specific item using a dot-notation path.
|
|
275
|
+
* Path format: "0.2.1" means items[0].children[2].children[1]
|
|
276
|
+
*/
|
|
277
|
+
declare function navigateToPath(instructions: Instructions, path: string): InstructionItem | null;
|
|
278
|
+
/**
|
|
279
|
+
* Generate a path string for an item given its position in the tree.
|
|
280
|
+
* Used when selecting an item to store its path.
|
|
281
|
+
*/
|
|
282
|
+
declare function generatePath(indices: number[]): string;
|
|
283
|
+
|
|
284
|
+
interface DurationEstimationConfig {
|
|
285
|
+
secondsPerImage: number;
|
|
286
|
+
wordsPerMinute: number;
|
|
287
|
+
}
|
|
288
|
+
declare const DEFAULT_DURATION_CONFIG: DurationEstimationConfig;
|
|
289
|
+
/**
|
|
290
|
+
* Count words in text (splits on whitespace)
|
|
291
|
+
*/
|
|
292
|
+
declare function countWords(text: string): number;
|
|
293
|
+
/**
|
|
294
|
+
* Estimate duration for image content
|
|
295
|
+
* @returns Duration in seconds (default: 15)
|
|
296
|
+
*/
|
|
297
|
+
declare function estimateImageDuration(config?: Partial<DurationEstimationConfig>): number;
|
|
298
|
+
/**
|
|
299
|
+
* Estimate duration for text content based on word count
|
|
300
|
+
* @param text - The text content
|
|
301
|
+
* @param config - Optional configuration overrides
|
|
302
|
+
* @returns Duration in seconds
|
|
303
|
+
*/
|
|
304
|
+
declare function estimateTextDuration(text: string, config?: Partial<DurationEstimationConfig>): number;
|
|
305
|
+
/**
|
|
306
|
+
* Estimate duration based on media type
|
|
307
|
+
* @param mediaType - "video" | "image" | "text"
|
|
308
|
+
* @param options - Text content or word count for text estimation
|
|
309
|
+
* @returns Duration in seconds (0 for video/unknown)
|
|
310
|
+
*/
|
|
311
|
+
declare function estimateDuration(mediaType: "video" | "image" | "text", options?: {
|
|
312
|
+
text?: string;
|
|
313
|
+
wordCount?: number;
|
|
314
|
+
config?: Partial<DurationEstimationConfig>;
|
|
315
|
+
}): number;
|
|
316
|
+
|
|
271
317
|
declare function presentationsToPlaylist(plan: Plan): ContentFile[];
|
|
272
|
-
declare function presentationsToInstructions(plan: Plan): Instructions;
|
|
273
318
|
declare function presentationsToExpandedInstructions(plan: Plan): Instructions;
|
|
274
319
|
declare function instructionsToPlaylist(instructions: Instructions): ContentFile[];
|
|
275
320
|
declare const expandedInstructionsToPlaylist: typeof instructionsToPlaylist;
|
|
276
321
|
declare function instructionsToPresentations(instructions: Instructions, planId?: string): Plan;
|
|
277
322
|
declare const expandedInstructionsToPresentations: typeof instructionsToPresentations;
|
|
278
|
-
declare function collapseInstructions(instructions: Instructions, maxDepth?: number): Instructions;
|
|
279
323
|
declare function playlistToPresentations(files: ContentFile[], planName?: string, sectionName?: string): Plan;
|
|
280
324
|
declare function playlistToInstructions(files: ContentFile[], venueName?: string): Instructions;
|
|
281
325
|
declare const playlistToExpandedInstructions: typeof playlistToInstructions;
|
|
282
326
|
|
|
283
|
-
declare const FormatConverters_collapseInstructions: typeof collapseInstructions;
|
|
284
327
|
declare const FormatConverters_expandedInstructionsToPlaylist: typeof expandedInstructionsToPlaylist;
|
|
285
328
|
declare const FormatConverters_expandedInstructionsToPresentations: typeof expandedInstructionsToPresentations;
|
|
286
329
|
declare const FormatConverters_instructionsToPlaylist: typeof instructionsToPlaylist;
|
|
@@ -289,10 +332,9 @@ declare const FormatConverters_playlistToExpandedInstructions: typeof playlistTo
|
|
|
289
332
|
declare const FormatConverters_playlistToInstructions: typeof playlistToInstructions;
|
|
290
333
|
declare const FormatConverters_playlistToPresentations: typeof playlistToPresentations;
|
|
291
334
|
declare const FormatConverters_presentationsToExpandedInstructions: typeof presentationsToExpandedInstructions;
|
|
292
|
-
declare const FormatConverters_presentationsToInstructions: typeof presentationsToInstructions;
|
|
293
335
|
declare const FormatConverters_presentationsToPlaylist: typeof presentationsToPlaylist;
|
|
294
336
|
declare namespace FormatConverters {
|
|
295
|
-
export {
|
|
337
|
+
export { FormatConverters_expandedInstructionsToPlaylist as expandedInstructionsToPlaylist, FormatConverters_expandedInstructionsToPresentations as expandedInstructionsToPresentations, FormatConverters_instructionsToPlaylist as instructionsToPlaylist, FormatConverters_instructionsToPresentations as instructionsToPresentations, FormatConverters_playlistToExpandedInstructions as playlistToExpandedInstructions, FormatConverters_playlistToInstructions as playlistToInstructions, FormatConverters_playlistToPresentations as playlistToPresentations, FormatConverters_presentationsToExpandedInstructions as presentationsToExpandedInstructions, FormatConverters_presentationsToPlaylist as presentationsToPlaylist };
|
|
296
338
|
}
|
|
297
339
|
|
|
298
340
|
interface FormatResolverOptions {
|
|
@@ -300,7 +342,7 @@ interface FormatResolverOptions {
|
|
|
300
342
|
}
|
|
301
343
|
interface ResolvedFormatMeta {
|
|
302
344
|
isNative: boolean;
|
|
303
|
-
sourceFormat?: "playlist" | "presentations" | "instructions"
|
|
345
|
+
sourceFormat?: "playlist" | "presentations" | "instructions";
|
|
304
346
|
isLossy: boolean;
|
|
305
347
|
}
|
|
306
348
|
declare class FormatResolver {
|
|
@@ -325,11 +367,6 @@ declare class FormatResolver {
|
|
|
325
367
|
data: Instructions | null;
|
|
326
368
|
meta: ResolvedFormatMeta;
|
|
327
369
|
}>;
|
|
328
|
-
getExpandedInstructions(path: string, auth?: ContentProviderAuthData | null): Promise<Instructions | null>;
|
|
329
|
-
getExpandedInstructionsWithMeta(path: string, auth?: ContentProviderAuthData | null): Promise<{
|
|
330
|
-
data: Instructions | null;
|
|
331
|
-
meta: ResolvedFormatMeta;
|
|
332
|
-
}>;
|
|
333
370
|
}
|
|
334
371
|
|
|
335
372
|
declare class OAuthHelper {
|
|
@@ -357,7 +394,7 @@ declare class DeviceFlowHelper {
|
|
|
357
394
|
|
|
358
395
|
declare class ApiHelper {
|
|
359
396
|
createAuthHeaders(auth: ContentProviderAuthData | null | undefined): Record<string, string> | null;
|
|
360
|
-
apiRequest<T>(config: ContentProviderConfig,
|
|
397
|
+
apiRequest<T>(config: ContentProviderConfig, _providerId: string, path: string, auth?: ContentProviderAuthData | null, method?: "GET" | "POST", body?: unknown): Promise<T | null>;
|
|
361
398
|
}
|
|
362
399
|
|
|
363
400
|
/**
|
|
@@ -378,7 +415,6 @@ declare abstract class ContentProvider implements IContentProvider, IAuthProvide
|
|
|
378
415
|
abstract getPresentations(path: string, auth?: ContentProviderAuthData | null): Promise<Plan | null>;
|
|
379
416
|
getPlaylist(path: string, auth?: ContentProviderAuthData | null, _resolution?: number): Promise<ContentFile[] | null>;
|
|
380
417
|
getInstructions(path: string, auth?: ContentProviderAuthData | null): Promise<Instructions | null>;
|
|
381
|
-
getExpandedInstructions(path: string, auth?: ContentProviderAuthData | null): Promise<Instructions | null>;
|
|
382
418
|
requiresAuth(): boolean;
|
|
383
419
|
getCapabilities(): ProviderCapabilities;
|
|
384
420
|
checkMediaLicense(_mediaId: string, _auth?: ContentProviderAuthData | null): Promise<MediaLicenseResult | null>;
|
|
@@ -399,12 +435,15 @@ declare abstract class ContentProvider implements IContentProvider, IAuthProvide
|
|
|
399
435
|
calculatePollDelay(baseInterval?: number, slowDownCount?: number): number;
|
|
400
436
|
protected createAuthHeaders(auth: ContentProviderAuthData | null | undefined): Record<string, string> | null;
|
|
401
437
|
protected apiRequest<T>(path: string, auth?: ContentProviderAuthData | null, method?: "GET" | "POST", body?: unknown): Promise<T | null>;
|
|
402
|
-
protected createFolder(id: string, title: string, path: string, image?: string,
|
|
438
|
+
protected createFolder(id: string, title: string, path: string, image?: string, isLeaf?: boolean): ContentFolder;
|
|
403
439
|
protected createFile(id: string, title: string, url: string, options?: {
|
|
404
440
|
mediaType?: "video" | "image";
|
|
405
441
|
image?: string;
|
|
406
442
|
muxPlaybackId?: string;
|
|
407
|
-
|
|
443
|
+
seconds?: number;
|
|
444
|
+
loop?: boolean;
|
|
445
|
+
loopVideo?: boolean;
|
|
446
|
+
streamUrl?: string;
|
|
408
447
|
}): ContentFile;
|
|
409
448
|
}
|
|
410
449
|
|
|
@@ -434,6 +473,8 @@ declare class APlayProvider implements IProvider {
|
|
|
434
473
|
private getLibraryFolders;
|
|
435
474
|
private getMediaFiles;
|
|
436
475
|
getPresentations(path: string, auth?: ContentProviderAuthData | null): Promise<Plan | null>;
|
|
476
|
+
getPlaylist(path: string, auth?: ContentProviderAuthData | null, _resolution?: number): Promise<ContentFile[] | null>;
|
|
477
|
+
getInstructions(path: string, auth?: ContentProviderAuthData | null): Promise<Instructions | null>;
|
|
437
478
|
checkMediaLicense(mediaId: string, auth?: ContentProviderAuthData | null): Promise<MediaLicenseResult | null>;
|
|
438
479
|
}
|
|
439
480
|
|
|
@@ -458,6 +499,8 @@ declare class SignPresenterProvider implements IProvider {
|
|
|
458
499
|
private getPlaylists;
|
|
459
500
|
private getMessages;
|
|
460
501
|
getPresentations(path: string, auth?: ContentProviderAuthData | null): Promise<Plan | null>;
|
|
502
|
+
getPlaylist(path: string, auth?: ContentProviderAuthData | null, _resolution?: number): Promise<ContentFile[] | null>;
|
|
503
|
+
getInstructions(path: string, auth?: ContentProviderAuthData | null): Promise<Instructions | null>;
|
|
461
504
|
}
|
|
462
505
|
|
|
463
506
|
/**
|
|
@@ -496,7 +539,6 @@ declare class LessonsChurchProvider implements IProvider {
|
|
|
496
539
|
private convertAddOnToFile;
|
|
497
540
|
getPresentations(path: string, _auth?: ContentProviderAuthData | null): Promise<Plan | null>;
|
|
498
541
|
getInstructions(path: string, _auth?: ContentProviderAuthData | null): Promise<Instructions | null>;
|
|
499
|
-
getExpandedInstructions(path: string, _auth?: ContentProviderAuthData | null): Promise<Instructions | null>;
|
|
500
542
|
private normalizeItemType;
|
|
501
543
|
private getEmbedUrl;
|
|
502
544
|
private convertVenueToPlan;
|
|
@@ -525,8 +567,9 @@ declare class B1ChurchProvider implements IProvider {
|
|
|
525
567
|
browse(path?: string | null, authData?: ContentProviderAuthData | null): Promise<ContentItem[]>;
|
|
526
568
|
getPresentations(path: string, authData?: ContentProviderAuthData | null): Promise<Plan | null>;
|
|
527
569
|
getInstructions(path: string, authData?: ContentProviderAuthData | null): Promise<Instructions | null>;
|
|
528
|
-
getExpandedInstructions(path: string, authData?: ContentProviderAuthData | null): Promise<Instructions | null>;
|
|
529
570
|
private processInstructionItems;
|
|
571
|
+
private findItemByPath;
|
|
572
|
+
private findPresentationByPath;
|
|
530
573
|
getPlaylist(path: string, authData?: ContentProviderAuthData | null, resolution?: number): Promise<ContentFile[] | null>;
|
|
531
574
|
}
|
|
532
575
|
|
|
@@ -558,6 +601,8 @@ declare class PlanningCenterProvider implements IProvider {
|
|
|
558
601
|
private convertSongToPresentation;
|
|
559
602
|
private convertMediaToPresentation;
|
|
560
603
|
private formatDate;
|
|
604
|
+
getPlaylist(path: string, auth?: ContentProviderAuthData | null, _resolution?: number): Promise<ContentFile[] | null>;
|
|
605
|
+
getInstructions(path: string, auth?: ContentProviderAuthData | null): Promise<Instructions | null>;
|
|
561
606
|
}
|
|
562
607
|
|
|
563
608
|
/**
|
|
@@ -583,6 +628,7 @@ declare class BibleProjectProvider implements IProvider {
|
|
|
583
628
|
private getVideoFile;
|
|
584
629
|
getPresentations(path: string, _auth?: ContentProviderAuthData | null): Promise<Plan | null>;
|
|
585
630
|
getPlaylist(path: string, _auth?: ContentProviderAuthData | null, _resolution?: number): Promise<ContentFile[] | null>;
|
|
631
|
+
getInstructions(path: string, _auth?: ContentProviderAuthData | null): Promise<Instructions | null>;
|
|
586
632
|
private slugify;
|
|
587
633
|
}
|
|
588
634
|
|
|
@@ -611,7 +657,7 @@ declare class HighVoltageKidsProvider implements IProvider {
|
|
|
611
657
|
private getLessonFiles;
|
|
612
658
|
getPresentations(path: string, _auth?: ContentProviderAuthData | null): Promise<Plan | null>;
|
|
613
659
|
getPlaylist(path: string, _auth?: ContentProviderAuthData | null, _resolution?: number): Promise<ContentFile[] | null>;
|
|
614
|
-
|
|
660
|
+
getInstructions(path: string, _auth?: ContentProviderAuthData | null): Promise<Instructions | null>;
|
|
615
661
|
private slugify;
|
|
616
662
|
private groupFilesIntoActions;
|
|
617
663
|
private getBaseName;
|
|
@@ -644,6 +690,6 @@ declare function getAvailableProviders(ids?: string[]): ProviderInfo[];
|
|
|
644
690
|
* @churchapps/content-provider-helper
|
|
645
691
|
* Helper classes for interacting with third party content providers
|
|
646
692
|
*/
|
|
647
|
-
declare const VERSION = "0.0.
|
|
693
|
+
declare const VERSION = "0.0.4";
|
|
648
694
|
|
|
649
|
-
export { APlayProvider, ApiHelper, type AuthType, B1ChurchProvider, BibleProjectProvider, type ContentFile, type ContentFolder, type ContentItem, ContentProvider, type ContentProviderAuthData, type ContentProviderConfig, type DeviceAuthorizationResponse, DeviceFlowHelper, type DeviceFlowPollResult, type DeviceFlowState, type FeedActionInterface, type FeedFileInterface, type FeedSectionInterface, type FeedVenueInterface, FormatConverters, FormatResolver, type FormatResolverOptions, HighVoltageKidsProvider, type IAuthProvider, type IContentProvider, type IProvider, type InstructionItem, type Instructions, LessonsChurchProvider, type MediaLicenseResult, type MediaLicenseStatus, OAuthHelper, type Plan, type PlanPresentation, type PlanSection, PlanningCenterProvider, type ProviderCapabilities, type ProviderInfo, type ProviderLogos, type ResolvedFormatMeta, SignPresenterProvider, TokenHelper, VERSION, type VenueActionInterface, type VenueActionsResponseInterface, type VenueSectionActionsInterface, appendToPath, buildPath,
|
|
695
|
+
export { APlayProvider, ApiHelper, type AuthType, B1ChurchProvider, BibleProjectProvider, type ContentFile, type ContentFolder, type ContentItem, ContentProvider, type ContentProviderAuthData, type ContentProviderConfig, DEFAULT_DURATION_CONFIG, type DeviceAuthorizationResponse, DeviceFlowHelper, type DeviceFlowPollResult, type DeviceFlowState, type DurationEstimationConfig, type FeedActionInterface, type FeedFileInterface, type FeedSectionInterface, type FeedVenueInterface, FormatConverters, FormatResolver, type FormatResolverOptions, HighVoltageKidsProvider, type IAuthProvider, type IContentProvider, type IProvider, type InstructionItem, type Instructions, LessonsChurchProvider, type MediaLicenseResult, type MediaLicenseStatus, OAuthHelper, type Plan, type PlanPresentation, type PlanSection, PlanningCenterProvider, type ProviderCapabilities, type ProviderInfo, type ProviderLogos, type ResolvedFormatMeta, SignPresenterProvider, TokenHelper, VERSION, type VenueActionInterface, type VenueActionsResponseInterface, type VenueSectionActionsInterface, appendToPath, buildPath, countWords, createFile, createFolder, detectMediaType, estimateDuration, estimateImageDuration, estimateTextDuration, expandedInstructionsToPlaylist, expandedInstructionsToPresentations, generatePath, getAllProviders, getAvailableProviders, getProvider, getProviderConfig, getSegment, instructionsToPlaylist, instructionsToPresentations, isContentFile, isContentFolder, navigateToPath, parsePath, playlistToExpandedInstructions, playlistToInstructions, playlistToPresentations, presentationsToExpandedInstructions, presentationsToPlaylist, registerProvider };
|