@churchapps/content-providers 0.1.13 → 0.2.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 +4252 -390
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +41 -11
- package/dist/index.d.ts +41 -11
- package/dist/index.js +4251 -390
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -149,6 +149,33 @@ interface Instructions {
|
|
|
149
149
|
name?: string;
|
|
150
150
|
items: InstructionItem[];
|
|
151
151
|
}
|
|
152
|
+
interface MessageFileInterface {
|
|
153
|
+
id?: string;
|
|
154
|
+
name?: string;
|
|
155
|
+
url?: string;
|
|
156
|
+
seconds?: number;
|
|
157
|
+
fileType?: string;
|
|
158
|
+
sort?: number;
|
|
159
|
+
loop?: boolean;
|
|
160
|
+
loopVideo?: boolean;
|
|
161
|
+
image?: string;
|
|
162
|
+
}
|
|
163
|
+
interface PlanTimelineItem {
|
|
164
|
+
id: string;
|
|
165
|
+
label?: string;
|
|
166
|
+
itemType?: string;
|
|
167
|
+
seconds?: number;
|
|
168
|
+
fileIds?: string[];
|
|
169
|
+
children?: PlanTimelineItem[];
|
|
170
|
+
}
|
|
171
|
+
interface CurrentPlan {
|
|
172
|
+
id: string;
|
|
173
|
+
title: string;
|
|
174
|
+
serviceDate?: string;
|
|
175
|
+
thumbnail?: string;
|
|
176
|
+
files: MessageFileInterface[];
|
|
177
|
+
timeline?: PlanTimelineItem[];
|
|
178
|
+
}
|
|
152
179
|
interface VenueActionInterface {
|
|
153
180
|
id?: string;
|
|
154
181
|
name?: string;
|
|
@@ -199,12 +226,17 @@ interface IProvider {
|
|
|
199
226
|
exchangeCodeForTokens?(code: string, codeVerifier: string, redirectUri: string): Promise<ContentProviderAuthData | null>;
|
|
200
227
|
initiateDeviceFlow?(): Promise<DeviceAuthorizationResponse | null>;
|
|
201
228
|
pollDeviceFlowToken?(deviceCode: string): Promise<DeviceFlowPollResult>;
|
|
229
|
+
performLogin?(email: string, password: string): Promise<ContentProviderAuthData | null>;
|
|
202
230
|
getPlaylist?(path: string, auth?: ContentProviderAuthData | null, resolution?: number): Promise<ContentFile[] | null>;
|
|
203
231
|
getInstructions?(path: string, auth?: ContentProviderAuthData | null): Promise<Instructions | null>;
|
|
232
|
+
getCurrentPlan?(auth?: ContentProviderAuthData | null): Promise<CurrentPlan | null>;
|
|
233
|
+
/** Hand opaque pairing data (provider-specific shape) to the provider so it can resolve its current plan. */
|
|
234
|
+
setPairingData?(data: unknown): void;
|
|
204
235
|
checkMediaLicense?(mediaId: string, auth?: ContentProviderAuthData | null): Promise<MediaLicenseResult | null>;
|
|
205
236
|
}
|
|
206
237
|
|
|
207
238
|
declare function detectMediaType(url: string, explicitType?: string): "video" | "image";
|
|
239
|
+
declare function isMediaFile(filename: string): boolean;
|
|
208
240
|
declare function createFolder(id: string, title: string, path: string, thumbnail?: string, isLeaf?: boolean): ContentFolder;
|
|
209
241
|
declare function createFile(id: string, title: string, url: string, options?: {
|
|
210
242
|
mediaType?: "video" | "image";
|
|
@@ -371,7 +403,7 @@ declare class DeviceFlowHelper {
|
|
|
371
403
|
|
|
372
404
|
declare class ApiHelper {
|
|
373
405
|
createAuthHeaders(auth: ContentProviderAuthData | null | undefined): Record<string, string> | null;
|
|
374
|
-
apiRequest<T>(config: ContentProviderConfig,
|
|
406
|
+
apiRequest<T>(config: ContentProviderConfig, providerId: string, path: string, auth?: ContentProviderAuthData | null, method?: "GET" | "POST", body?: unknown): Promise<T | null>;
|
|
375
407
|
}
|
|
376
408
|
|
|
377
409
|
/**
|
|
@@ -501,6 +533,9 @@ declare class B1ChurchProvider implements IProvider {
|
|
|
501
533
|
pollDeviceFlowToken(deviceCode: string): Promise<DeviceFlowPollResult>;
|
|
502
534
|
browse(path?: string | null, authData?: ContentProviderAuthData | null): Promise<ContentItem[]>;
|
|
503
535
|
private fetchPlanImages;
|
|
536
|
+
private planTypeId;
|
|
537
|
+
setPairingData(data: unknown): void;
|
|
538
|
+
getCurrentPlan(_authData?: ContentProviderAuthData | null): Promise<CurrentPlan | null>;
|
|
504
539
|
getInstructions(path: string, authData?: ContentProviderAuthData | null): Promise<Instructions | null>;
|
|
505
540
|
private processInstructionItems;
|
|
506
541
|
private findItemByPath;
|
|
@@ -511,6 +546,7 @@ declare class B1ChurchProvider implements IProvider {
|
|
|
511
546
|
|
|
512
547
|
declare class DropboxProvider implements IProvider {
|
|
513
548
|
private readonly oauthHelper;
|
|
549
|
+
private readonly apiHelper;
|
|
514
550
|
readonly id = "dropbox";
|
|
515
551
|
readonly name = "Dropbox";
|
|
516
552
|
readonly logos: ProviderLogos;
|
|
@@ -534,6 +570,8 @@ declare class DropboxProvider implements IProvider {
|
|
|
534
570
|
url: string;
|
|
535
571
|
challengeMethod: string;
|
|
536
572
|
}>;
|
|
573
|
+
/** For environments without Web Crypto (e.g. React Native): caller computes the challenge. */
|
|
574
|
+
buildAuthUrlFromChallenge(codeChallenge: string, redirectUri: string, state: string): string;
|
|
537
575
|
exchangeCodeForTokens(code: string, codeVerifier: string, redirectUri: string): Promise<ContentProviderAuthData | null>;
|
|
538
576
|
}
|
|
539
577
|
|
|
@@ -649,18 +687,10 @@ declare class JesusFilmProvider implements IProvider {
|
|
|
649
687
|
supportsDeviceFlow(): boolean;
|
|
650
688
|
}
|
|
651
689
|
|
|
652
|
-
/**
|
|
653
|
-
* Get a provider by ID.
|
|
654
|
-
*/
|
|
655
690
|
declare function getProvider(providerId: string): IProvider | null;
|
|
656
|
-
/**
|
|
657
|
-
* Get all registered providers.
|
|
658
|
-
*/
|
|
659
691
|
declare function getAllProviders(): IProvider[];
|
|
660
|
-
/**
|
|
661
|
-
* Register a custom provider.
|
|
662
|
-
*/
|
|
663
692
|
declare function registerProvider(provider: IProvider): void;
|
|
693
|
+
|
|
664
694
|
/**
|
|
665
695
|
* Get provider configuration by ID (for backward compatibility).
|
|
666
696
|
*/
|
|
@@ -678,4 +708,4 @@ declare function getAvailableProviders(ids?: string[]): ProviderInfo[];
|
|
|
678
708
|
*/
|
|
679
709
|
declare const VERSION = "0.0.5";
|
|
680
710
|
|
|
681
|
-
export { APlayProvider, ApiHelper, type AuthType, B1ChurchProvider, BibleProjectProvider, type ContentFile, type ContentFolder, type ContentItem, type ContentProviderAuthData, type ContentProviderConfig, DEFAULT_DURATION_CONFIG, type DeviceAuthorizationResponse, DeviceFlowHelper, type DeviceFlowPollResult, type DeviceFlowState, DropboxProvider, type DurationEstimationConfig, type EndpointValue, type EndpointsConfig, type FeedActionInterface, type FeedFileInterface, type FeedSectionInterface, type FeedVenueInterface, FormatConverters, FormatResolver, type FormatResolverOptions, HighVoltageKidsProvider, type IProvider, type InstructionItem, type Instructions, JesusFilmProvider, 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, generatePath, getAllProviders, getAvailableProviders, getProvider, getProviderConfig, getSegment, isContentFile, isContentFolder, navigateToPath, parsePath, registerProvider };
|
|
711
|
+
export { APlayProvider, ApiHelper, type AuthType, B1ChurchProvider, BibleProjectProvider, type ContentFile, type ContentFolder, type ContentItem, type ContentProviderAuthData, type ContentProviderConfig, type CurrentPlan, DEFAULT_DURATION_CONFIG, type DeviceAuthorizationResponse, DeviceFlowHelper, type DeviceFlowPollResult, type DeviceFlowState, DropboxProvider, type DurationEstimationConfig, type EndpointValue, type EndpointsConfig, type FeedActionInterface, type FeedFileInterface, type FeedSectionInterface, type FeedVenueInterface, FormatConverters, FormatResolver, type FormatResolverOptions, HighVoltageKidsProvider, type IProvider, type InstructionItem, type Instructions, JesusFilmProvider, LessonsChurchProvider, type MediaLicenseResult, type MediaLicenseStatus, type MessageFileInterface, OAuthHelper, type Plan, type PlanPresentation, type PlanSection, type PlanTimelineItem, 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, generatePath, getAllProviders, getAvailableProviders, getProvider, getProviderConfig, getSegment, isContentFile, isContentFolder, isMediaFile, navigateToPath, parsePath, registerProvider };
|
package/dist/index.d.ts
CHANGED
|
@@ -149,6 +149,33 @@ interface Instructions {
|
|
|
149
149
|
name?: string;
|
|
150
150
|
items: InstructionItem[];
|
|
151
151
|
}
|
|
152
|
+
interface MessageFileInterface {
|
|
153
|
+
id?: string;
|
|
154
|
+
name?: string;
|
|
155
|
+
url?: string;
|
|
156
|
+
seconds?: number;
|
|
157
|
+
fileType?: string;
|
|
158
|
+
sort?: number;
|
|
159
|
+
loop?: boolean;
|
|
160
|
+
loopVideo?: boolean;
|
|
161
|
+
image?: string;
|
|
162
|
+
}
|
|
163
|
+
interface PlanTimelineItem {
|
|
164
|
+
id: string;
|
|
165
|
+
label?: string;
|
|
166
|
+
itemType?: string;
|
|
167
|
+
seconds?: number;
|
|
168
|
+
fileIds?: string[];
|
|
169
|
+
children?: PlanTimelineItem[];
|
|
170
|
+
}
|
|
171
|
+
interface CurrentPlan {
|
|
172
|
+
id: string;
|
|
173
|
+
title: string;
|
|
174
|
+
serviceDate?: string;
|
|
175
|
+
thumbnail?: string;
|
|
176
|
+
files: MessageFileInterface[];
|
|
177
|
+
timeline?: PlanTimelineItem[];
|
|
178
|
+
}
|
|
152
179
|
interface VenueActionInterface {
|
|
153
180
|
id?: string;
|
|
154
181
|
name?: string;
|
|
@@ -199,12 +226,17 @@ interface IProvider {
|
|
|
199
226
|
exchangeCodeForTokens?(code: string, codeVerifier: string, redirectUri: string): Promise<ContentProviderAuthData | null>;
|
|
200
227
|
initiateDeviceFlow?(): Promise<DeviceAuthorizationResponse | null>;
|
|
201
228
|
pollDeviceFlowToken?(deviceCode: string): Promise<DeviceFlowPollResult>;
|
|
229
|
+
performLogin?(email: string, password: string): Promise<ContentProviderAuthData | null>;
|
|
202
230
|
getPlaylist?(path: string, auth?: ContentProviderAuthData | null, resolution?: number): Promise<ContentFile[] | null>;
|
|
203
231
|
getInstructions?(path: string, auth?: ContentProviderAuthData | null): Promise<Instructions | null>;
|
|
232
|
+
getCurrentPlan?(auth?: ContentProviderAuthData | null): Promise<CurrentPlan | null>;
|
|
233
|
+
/** Hand opaque pairing data (provider-specific shape) to the provider so it can resolve its current plan. */
|
|
234
|
+
setPairingData?(data: unknown): void;
|
|
204
235
|
checkMediaLicense?(mediaId: string, auth?: ContentProviderAuthData | null): Promise<MediaLicenseResult | null>;
|
|
205
236
|
}
|
|
206
237
|
|
|
207
238
|
declare function detectMediaType(url: string, explicitType?: string): "video" | "image";
|
|
239
|
+
declare function isMediaFile(filename: string): boolean;
|
|
208
240
|
declare function createFolder(id: string, title: string, path: string, thumbnail?: string, isLeaf?: boolean): ContentFolder;
|
|
209
241
|
declare function createFile(id: string, title: string, url: string, options?: {
|
|
210
242
|
mediaType?: "video" | "image";
|
|
@@ -371,7 +403,7 @@ declare class DeviceFlowHelper {
|
|
|
371
403
|
|
|
372
404
|
declare class ApiHelper {
|
|
373
405
|
createAuthHeaders(auth: ContentProviderAuthData | null | undefined): Record<string, string> | null;
|
|
374
|
-
apiRequest<T>(config: ContentProviderConfig,
|
|
406
|
+
apiRequest<T>(config: ContentProviderConfig, providerId: string, path: string, auth?: ContentProviderAuthData | null, method?: "GET" | "POST", body?: unknown): Promise<T | null>;
|
|
375
407
|
}
|
|
376
408
|
|
|
377
409
|
/**
|
|
@@ -501,6 +533,9 @@ declare class B1ChurchProvider implements IProvider {
|
|
|
501
533
|
pollDeviceFlowToken(deviceCode: string): Promise<DeviceFlowPollResult>;
|
|
502
534
|
browse(path?: string | null, authData?: ContentProviderAuthData | null): Promise<ContentItem[]>;
|
|
503
535
|
private fetchPlanImages;
|
|
536
|
+
private planTypeId;
|
|
537
|
+
setPairingData(data: unknown): void;
|
|
538
|
+
getCurrentPlan(_authData?: ContentProviderAuthData | null): Promise<CurrentPlan | null>;
|
|
504
539
|
getInstructions(path: string, authData?: ContentProviderAuthData | null): Promise<Instructions | null>;
|
|
505
540
|
private processInstructionItems;
|
|
506
541
|
private findItemByPath;
|
|
@@ -511,6 +546,7 @@ declare class B1ChurchProvider implements IProvider {
|
|
|
511
546
|
|
|
512
547
|
declare class DropboxProvider implements IProvider {
|
|
513
548
|
private readonly oauthHelper;
|
|
549
|
+
private readonly apiHelper;
|
|
514
550
|
readonly id = "dropbox";
|
|
515
551
|
readonly name = "Dropbox";
|
|
516
552
|
readonly logos: ProviderLogos;
|
|
@@ -534,6 +570,8 @@ declare class DropboxProvider implements IProvider {
|
|
|
534
570
|
url: string;
|
|
535
571
|
challengeMethod: string;
|
|
536
572
|
}>;
|
|
573
|
+
/** For environments without Web Crypto (e.g. React Native): caller computes the challenge. */
|
|
574
|
+
buildAuthUrlFromChallenge(codeChallenge: string, redirectUri: string, state: string): string;
|
|
537
575
|
exchangeCodeForTokens(code: string, codeVerifier: string, redirectUri: string): Promise<ContentProviderAuthData | null>;
|
|
538
576
|
}
|
|
539
577
|
|
|
@@ -649,18 +687,10 @@ declare class JesusFilmProvider implements IProvider {
|
|
|
649
687
|
supportsDeviceFlow(): boolean;
|
|
650
688
|
}
|
|
651
689
|
|
|
652
|
-
/**
|
|
653
|
-
* Get a provider by ID.
|
|
654
|
-
*/
|
|
655
690
|
declare function getProvider(providerId: string): IProvider | null;
|
|
656
|
-
/**
|
|
657
|
-
* Get all registered providers.
|
|
658
|
-
*/
|
|
659
691
|
declare function getAllProviders(): IProvider[];
|
|
660
|
-
/**
|
|
661
|
-
* Register a custom provider.
|
|
662
|
-
*/
|
|
663
692
|
declare function registerProvider(provider: IProvider): void;
|
|
693
|
+
|
|
664
694
|
/**
|
|
665
695
|
* Get provider configuration by ID (for backward compatibility).
|
|
666
696
|
*/
|
|
@@ -678,4 +708,4 @@ declare function getAvailableProviders(ids?: string[]): ProviderInfo[];
|
|
|
678
708
|
*/
|
|
679
709
|
declare const VERSION = "0.0.5";
|
|
680
710
|
|
|
681
|
-
export { APlayProvider, ApiHelper, type AuthType, B1ChurchProvider, BibleProjectProvider, type ContentFile, type ContentFolder, type ContentItem, type ContentProviderAuthData, type ContentProviderConfig, DEFAULT_DURATION_CONFIG, type DeviceAuthorizationResponse, DeviceFlowHelper, type DeviceFlowPollResult, type DeviceFlowState, DropboxProvider, type DurationEstimationConfig, type EndpointValue, type EndpointsConfig, type FeedActionInterface, type FeedFileInterface, type FeedSectionInterface, type FeedVenueInterface, FormatConverters, FormatResolver, type FormatResolverOptions, HighVoltageKidsProvider, type IProvider, type InstructionItem, type Instructions, JesusFilmProvider, 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, generatePath, getAllProviders, getAvailableProviders, getProvider, getProviderConfig, getSegment, isContentFile, isContentFolder, navigateToPath, parsePath, registerProvider };
|
|
711
|
+
export { APlayProvider, ApiHelper, type AuthType, B1ChurchProvider, BibleProjectProvider, type ContentFile, type ContentFolder, type ContentItem, type ContentProviderAuthData, type ContentProviderConfig, type CurrentPlan, DEFAULT_DURATION_CONFIG, type DeviceAuthorizationResponse, DeviceFlowHelper, type DeviceFlowPollResult, type DeviceFlowState, DropboxProvider, type DurationEstimationConfig, type EndpointValue, type EndpointsConfig, type FeedActionInterface, type FeedFileInterface, type FeedSectionInterface, type FeedVenueInterface, FormatConverters, FormatResolver, type FormatResolverOptions, HighVoltageKidsProvider, type IProvider, type InstructionItem, type Instructions, JesusFilmProvider, LessonsChurchProvider, type MediaLicenseResult, type MediaLicenseStatus, type MessageFileInterface, OAuthHelper, type Plan, type PlanPresentation, type PlanSection, type PlanTimelineItem, 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, generatePath, getAllProviders, getAvailableProviders, getProvider, getProviderConfig, getSegment, isContentFile, isContentFolder, isMediaFile, navigateToPath, parsePath, registerProvider };
|