@churchapps/content-providers 0.1.12 → 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.d.cts CHANGED
@@ -143,11 +143,39 @@ interface InstructionItem {
143
143
  children?: InstructionItem[];
144
144
  downloadUrl?: string;
145
145
  thumbnail?: string;
146
+ mediaType?: "video" | "image";
146
147
  }
147
148
  interface Instructions {
148
149
  name?: string;
149
150
  items: InstructionItem[];
150
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
+ }
151
179
  interface VenueActionInterface {
152
180
  id?: string;
153
181
  name?: string;
@@ -198,12 +226,17 @@ interface IProvider {
198
226
  exchangeCodeForTokens?(code: string, codeVerifier: string, redirectUri: string): Promise<ContentProviderAuthData | null>;
199
227
  initiateDeviceFlow?(): Promise<DeviceAuthorizationResponse | null>;
200
228
  pollDeviceFlowToken?(deviceCode: string): Promise<DeviceFlowPollResult>;
229
+ performLogin?(email: string, password: string): Promise<ContentProviderAuthData | null>;
201
230
  getPlaylist?(path: string, auth?: ContentProviderAuthData | null, resolution?: number): Promise<ContentFile[] | null>;
202
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;
203
235
  checkMediaLicense?(mediaId: string, auth?: ContentProviderAuthData | null): Promise<MediaLicenseResult | null>;
204
236
  }
205
237
 
206
238
  declare function detectMediaType(url: string, explicitType?: string): "video" | "image";
239
+ declare function isMediaFile(filename: string): boolean;
207
240
  declare function createFolder(id: string, title: string, path: string, thumbnail?: string, isLeaf?: boolean): ContentFolder;
208
241
  declare function createFile(id: string, title: string, url: string, options?: {
209
242
  mediaType?: "video" | "image";
@@ -370,7 +403,7 @@ declare class DeviceFlowHelper {
370
403
 
371
404
  declare class ApiHelper {
372
405
  createAuthHeaders(auth: ContentProviderAuthData | null | undefined): Record<string, string> | null;
373
- apiRequest<T>(config: ContentProviderConfig, _providerId: string, path: string, auth?: ContentProviderAuthData | null, method?: "GET" | "POST", body?: unknown): Promise<T | null>;
406
+ apiRequest<T>(config: ContentProviderConfig, providerId: string, path: string, auth?: ContentProviderAuthData | null, method?: "GET" | "POST", body?: unknown): Promise<T | null>;
374
407
  }
375
408
 
376
409
  /**
@@ -500,6 +533,9 @@ declare class B1ChurchProvider implements IProvider {
500
533
  pollDeviceFlowToken(deviceCode: string): Promise<DeviceFlowPollResult>;
501
534
  browse(path?: string | null, authData?: ContentProviderAuthData | null): Promise<ContentItem[]>;
502
535
  private fetchPlanImages;
536
+ private planTypeId;
537
+ setPairingData(data: unknown): void;
538
+ getCurrentPlan(_authData?: ContentProviderAuthData | null): Promise<CurrentPlan | null>;
503
539
  getInstructions(path: string, authData?: ContentProviderAuthData | null): Promise<Instructions | null>;
504
540
  private processInstructionItems;
505
541
  private findItemByPath;
@@ -510,6 +546,7 @@ declare class B1ChurchProvider implements IProvider {
510
546
 
511
547
  declare class DropboxProvider implements IProvider {
512
548
  private readonly oauthHelper;
549
+ private readonly apiHelper;
513
550
  readonly id = "dropbox";
514
551
  readonly name = "Dropbox";
515
552
  readonly logos: ProviderLogos;
@@ -533,6 +570,8 @@ declare class DropboxProvider implements IProvider {
533
570
  url: string;
534
571
  challengeMethod: string;
535
572
  }>;
573
+ /** For environments without Web Crypto (e.g. React Native): caller computes the challenge. */
574
+ buildAuthUrlFromChallenge(codeChallenge: string, redirectUri: string, state: string): string;
536
575
  exchangeCodeForTokens(code: string, codeVerifier: string, redirectUri: string): Promise<ContentProviderAuthData | null>;
537
576
  }
538
577
 
@@ -648,18 +687,10 @@ declare class JesusFilmProvider implements IProvider {
648
687
  supportsDeviceFlow(): boolean;
649
688
  }
650
689
 
651
- /**
652
- * Get a provider by ID.
653
- */
654
690
  declare function getProvider(providerId: string): IProvider | null;
655
- /**
656
- * Get all registered providers.
657
- */
658
691
  declare function getAllProviders(): IProvider[];
659
- /**
660
- * Register a custom provider.
661
- */
662
692
  declare function registerProvider(provider: IProvider): void;
693
+
663
694
  /**
664
695
  * Get provider configuration by ID (for backward compatibility).
665
696
  */
@@ -677,4 +708,4 @@ declare function getAvailableProviders(ids?: string[]): ProviderInfo[];
677
708
  */
678
709
  declare const VERSION = "0.0.5";
679
710
 
680
- 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
@@ -143,11 +143,39 @@ interface InstructionItem {
143
143
  children?: InstructionItem[];
144
144
  downloadUrl?: string;
145
145
  thumbnail?: string;
146
+ mediaType?: "video" | "image";
146
147
  }
147
148
  interface Instructions {
148
149
  name?: string;
149
150
  items: InstructionItem[];
150
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
+ }
151
179
  interface VenueActionInterface {
152
180
  id?: string;
153
181
  name?: string;
@@ -198,12 +226,17 @@ interface IProvider {
198
226
  exchangeCodeForTokens?(code: string, codeVerifier: string, redirectUri: string): Promise<ContentProviderAuthData | null>;
199
227
  initiateDeviceFlow?(): Promise<DeviceAuthorizationResponse | null>;
200
228
  pollDeviceFlowToken?(deviceCode: string): Promise<DeviceFlowPollResult>;
229
+ performLogin?(email: string, password: string): Promise<ContentProviderAuthData | null>;
201
230
  getPlaylist?(path: string, auth?: ContentProviderAuthData | null, resolution?: number): Promise<ContentFile[] | null>;
202
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;
203
235
  checkMediaLicense?(mediaId: string, auth?: ContentProviderAuthData | null): Promise<MediaLicenseResult | null>;
204
236
  }
205
237
 
206
238
  declare function detectMediaType(url: string, explicitType?: string): "video" | "image";
239
+ declare function isMediaFile(filename: string): boolean;
207
240
  declare function createFolder(id: string, title: string, path: string, thumbnail?: string, isLeaf?: boolean): ContentFolder;
208
241
  declare function createFile(id: string, title: string, url: string, options?: {
209
242
  mediaType?: "video" | "image";
@@ -370,7 +403,7 @@ declare class DeviceFlowHelper {
370
403
 
371
404
  declare class ApiHelper {
372
405
  createAuthHeaders(auth: ContentProviderAuthData | null | undefined): Record<string, string> | null;
373
- apiRequest<T>(config: ContentProviderConfig, _providerId: string, path: string, auth?: ContentProviderAuthData | null, method?: "GET" | "POST", body?: unknown): Promise<T | null>;
406
+ apiRequest<T>(config: ContentProviderConfig, providerId: string, path: string, auth?: ContentProviderAuthData | null, method?: "GET" | "POST", body?: unknown): Promise<T | null>;
374
407
  }
375
408
 
376
409
  /**
@@ -500,6 +533,9 @@ declare class B1ChurchProvider implements IProvider {
500
533
  pollDeviceFlowToken(deviceCode: string): Promise<DeviceFlowPollResult>;
501
534
  browse(path?: string | null, authData?: ContentProviderAuthData | null): Promise<ContentItem[]>;
502
535
  private fetchPlanImages;
536
+ private planTypeId;
537
+ setPairingData(data: unknown): void;
538
+ getCurrentPlan(_authData?: ContentProviderAuthData | null): Promise<CurrentPlan | null>;
503
539
  getInstructions(path: string, authData?: ContentProviderAuthData | null): Promise<Instructions | null>;
504
540
  private processInstructionItems;
505
541
  private findItemByPath;
@@ -510,6 +546,7 @@ declare class B1ChurchProvider implements IProvider {
510
546
 
511
547
  declare class DropboxProvider implements IProvider {
512
548
  private readonly oauthHelper;
549
+ private readonly apiHelper;
513
550
  readonly id = "dropbox";
514
551
  readonly name = "Dropbox";
515
552
  readonly logos: ProviderLogos;
@@ -533,6 +570,8 @@ declare class DropboxProvider implements IProvider {
533
570
  url: string;
534
571
  challengeMethod: string;
535
572
  }>;
573
+ /** For environments without Web Crypto (e.g. React Native): caller computes the challenge. */
574
+ buildAuthUrlFromChallenge(codeChallenge: string, redirectUri: string, state: string): string;
536
575
  exchangeCodeForTokens(code: string, codeVerifier: string, redirectUri: string): Promise<ContentProviderAuthData | null>;
537
576
  }
538
577
 
@@ -648,18 +687,10 @@ declare class JesusFilmProvider implements IProvider {
648
687
  supportsDeviceFlow(): boolean;
649
688
  }
650
689
 
651
- /**
652
- * Get a provider by ID.
653
- */
654
690
  declare function getProvider(providerId: string): IProvider | null;
655
- /**
656
- * Get all registered providers.
657
- */
658
691
  declare function getAllProviders(): IProvider[];
659
- /**
660
- * Register a custom provider.
661
- */
662
692
  declare function registerProvider(provider: IProvider): void;
693
+
663
694
  /**
664
695
  * Get provider configuration by ID (for backward compatibility).
665
696
  */
@@ -677,4 +708,4 @@ declare function getAvailableProviders(ids?: string[]): ProviderInfo[];
677
708
  */
678
709
  declare const VERSION = "0.0.5";
679
710
 
680
- 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 };