@churchapps/content-providers 0.6.1 → 0.7.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 +21 -9
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +20 -9
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.d.cts
CHANGED
|
@@ -271,6 +271,8 @@ declare class DeviceFlowHelper {
|
|
|
271
271
|
calculatePollDelay(baseInterval?: number, slowDownCount?: number): number;
|
|
272
272
|
}
|
|
273
273
|
|
|
274
|
+
declare const setProviderSecret: (providerId: string, secret: string) => void;
|
|
275
|
+
|
|
274
276
|
/** Base for providers; auth-flow methods are intentionally not here so consumers can feature-detect with `"method" in provider`. */
|
|
275
277
|
declare abstract class BaseProvider implements IProvider {
|
|
276
278
|
abstract readonly id: string;
|
|
@@ -575,4 +577,4 @@ declare function getAvailableProviders(ids?: string[]): ProviderInfo[];
|
|
|
575
577
|
*/
|
|
576
578
|
declare const VERSION: string;
|
|
577
579
|
|
|
578
|
-
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, getAllProviders, getAvailableProviders, getProvider, getProviderConfig, isContentFile, isContentFolder, navigateToPath, registerProvider, toAuthData };
|
|
580
|
+
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, getAllProviders, getAvailableProviders, getProvider, getProviderConfig, isContentFile, isContentFolder, navigateToPath, registerProvider, setProviderSecret, toAuthData };
|
package/dist/index.d.ts
CHANGED
|
@@ -271,6 +271,8 @@ declare class DeviceFlowHelper {
|
|
|
271
271
|
calculatePollDelay(baseInterval?: number, slowDownCount?: number): number;
|
|
272
272
|
}
|
|
273
273
|
|
|
274
|
+
declare const setProviderSecret: (providerId: string, secret: string) => void;
|
|
275
|
+
|
|
274
276
|
/** Base for providers; auth-flow methods are intentionally not here so consumers can feature-detect with `"method" in provider`. */
|
|
275
277
|
declare abstract class BaseProvider implements IProvider {
|
|
276
278
|
abstract readonly id: string;
|
|
@@ -575,4 +577,4 @@ declare function getAvailableProviders(ids?: string[]): ProviderInfo[];
|
|
|
575
577
|
*/
|
|
576
578
|
declare const VERSION: string;
|
|
577
579
|
|
|
578
|
-
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, getAllProviders, getAvailableProviders, getProvider, getProviderConfig, isContentFile, isContentFolder, navigateToPath, registerProvider, toAuthData };
|
|
580
|
+
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, getAllProviders, getAvailableProviders, getProvider, getProviderConfig, isContentFile, isContentFolder, navigateToPath, registerProvider, setProviderSecret, toAuthData };
|
package/dist/index.js
CHANGED
|
@@ -201,6 +201,13 @@ var ApiHelper = class {
|
|
|
201
201
|
}
|
|
202
202
|
};
|
|
203
203
|
|
|
204
|
+
// src/helpers/ProviderSecrets.ts
|
|
205
|
+
var secrets = {};
|
|
206
|
+
var setProviderSecret = (providerId, secret) => {
|
|
207
|
+
secrets[providerId] = secret;
|
|
208
|
+
};
|
|
209
|
+
var getProviderSecret = (providerId) => secrets[providerId] || "";
|
|
210
|
+
|
|
204
211
|
// src/providers/BaseProvider.ts
|
|
205
212
|
var BaseProvider = class {
|
|
206
213
|
constructor() {
|
|
@@ -16255,7 +16262,7 @@ function registerProvider(provider) {
|
|
|
16255
16262
|
|
|
16256
16263
|
// src/providers/goCurriculum/data.json
|
|
16257
16264
|
var data_default4 = {
|
|
16258
|
-
|
|
16265
|
+
catalog: []
|
|
16259
16266
|
};
|
|
16260
16267
|
|
|
16261
16268
|
// src/providers/goCurriculum/GoCurriculumProvider.ts
|
|
@@ -16276,7 +16283,10 @@ var GoCurriculumProvider = class extends BaseProvider {
|
|
|
16276
16283
|
apiBase: "https://gocurriculum.com",
|
|
16277
16284
|
oauthBase: "https://gocurriculum.com/oauth",
|
|
16278
16285
|
clientId: "Rdrvz9jz9nTNf8rCsbpuAgVLdoWHZmcjdmmrP0Bw",
|
|
16279
|
-
|
|
16286
|
+
// supplied at runtime via setProviderSecret("gocurriculum", ...) — never commit the value
|
|
16287
|
+
get clientSecret() {
|
|
16288
|
+
return getProviderSecret("gocurriculum");
|
|
16289
|
+
},
|
|
16280
16290
|
scopes: ["basic"]
|
|
16281
16291
|
};
|
|
16282
16292
|
this.data = data_default4;
|
|
@@ -16301,23 +16311,23 @@ var GoCurriculumProvider = class extends BaseProvider {
|
|
|
16301
16311
|
async browse(path, auth) {
|
|
16302
16312
|
if (!await this.verifyAuth(auth)) return [];
|
|
16303
16313
|
const { segments, depth } = parsePath(path);
|
|
16304
|
-
if (depth === 0) return this.data.
|
|
16305
|
-
const collection = this.data.
|
|
16314
|
+
if (depth === 0) return this.data.catalog.map((c) => createFolder(c.id, c.name, `/${c.id}`, c.thumbnail));
|
|
16315
|
+
const collection = this.data.catalog.find((c) => c.id === segments[0]);
|
|
16306
16316
|
if (!collection) return [];
|
|
16307
|
-
if (depth === 1) return collection.lessons.map((l) => createFolder(l.id, l.name, `/${collection.id}/${l.id}`, l.
|
|
16317
|
+
if (depth === 1) return collection.lessons.map((l) => createFolder(l.id, l.name, `/${collection.id}/${l.id}`, l.thumbnail || collection.thumbnail, true));
|
|
16308
16318
|
if (depth === 2) return this.getLessonFiles(collection, segments[1]);
|
|
16309
16319
|
return [];
|
|
16310
16320
|
}
|
|
16311
16321
|
getLessonFiles(collection, lessonId) {
|
|
16312
16322
|
const lesson = collection.lessons.find((l) => l.id === lessonId);
|
|
16313
16323
|
if (!lesson) return [];
|
|
16314
|
-
return lesson.
|
|
16324
|
+
return lesson.playlist.map((f) => createFile(slugify(f.file), f.title, f.url, { mediaType: detectMediaType(`${f.url} ${f.file}`, f.mediaType), thumbnail: f.thumbnail || lesson.thumbnail || collection.thumbnail, seconds: f.duration }));
|
|
16315
16325
|
}
|
|
16316
16326
|
async getPlaylist(path, auth, _resolution) {
|
|
16317
16327
|
if (!await this.verifyAuth(auth)) return null;
|
|
16318
16328
|
const { segments, depth } = parsePath(path);
|
|
16319
16329
|
if (depth !== 2) return null;
|
|
16320
|
-
const collection = this.data.
|
|
16330
|
+
const collection = this.data.catalog.find((c) => c.id === segments[0]);
|
|
16321
16331
|
if (!collection) return null;
|
|
16322
16332
|
const files = this.getLessonFiles(collection, segments[1]);
|
|
16323
16333
|
return files.length > 0 ? files : null;
|
|
@@ -16327,7 +16337,7 @@ var GoCurriculumProvider = class extends BaseProvider {
|
|
|
16327
16337
|
if (depth !== 2) return null;
|
|
16328
16338
|
const files = await this.getPlaylist(path, auth);
|
|
16329
16339
|
if (!files) return null;
|
|
16330
|
-
const collection = this.data.
|
|
16340
|
+
const collection = this.data.catalog.find((c) => c.id === segments[0]);
|
|
16331
16341
|
const lesson = collection?.lessons.find((l) => l.id === segments[1]);
|
|
16332
16342
|
return filesToInstructions(lesson?.name || "Lesson", files);
|
|
16333
16343
|
}
|
|
@@ -16430,7 +16440,7 @@ function getAvailableProviders(ids) {
|
|
|
16430
16440
|
}
|
|
16431
16441
|
|
|
16432
16442
|
// src/index.ts
|
|
16433
|
-
var VERSION = true ? "0.
|
|
16443
|
+
var VERSION = true ? "0.7.0" : "dev";
|
|
16434
16444
|
export {
|
|
16435
16445
|
APlayProvider,
|
|
16436
16446
|
B1ChurchProvider,
|
|
@@ -16456,6 +16466,7 @@ export {
|
|
|
16456
16466
|
isContentFolder,
|
|
16457
16467
|
navigateToPath,
|
|
16458
16468
|
registerProvider,
|
|
16469
|
+
setProviderSecret,
|
|
16459
16470
|
toAuthData
|
|
16460
16471
|
};
|
|
16461
16472
|
//# sourceMappingURL=index.js.map
|