@churchapps/content-providers 0.13.1 → 0.14.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 +140 -117
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +72 -1
- package/dist/index.d.ts +72 -1
- package/dist/index.js +139 -117
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -29,6 +29,7 @@ __export(index_exports, {
|
|
|
29
29
|
DropboxProvider: () => DropboxProvider,
|
|
30
30
|
FREESHOW_REST_PORT: () => FREESHOW_REST_PORT,
|
|
31
31
|
FreeShowProvider: () => FreeShowProvider,
|
|
32
|
+
GoCurriculumProvider: () => GoCurriculumProvider,
|
|
32
33
|
HighVoltageKidsProvider: () => HighVoltageKidsProvider,
|
|
33
34
|
JesusFilmProvider: () => JesusFilmProvider,
|
|
34
35
|
LessonsChurchProvider: () => LessonsChurchProvider,
|
|
@@ -12794,6 +12795,143 @@ var FreeShowProvider = class extends BaseProvider {
|
|
|
12794
12795
|
}
|
|
12795
12796
|
};
|
|
12796
12797
|
|
|
12798
|
+
// src/providers/goCurriculum/GoCurriculumProvider.ts
|
|
12799
|
+
var GROUPS = [
|
|
12800
|
+
{ id: "elementary", name: "Elementary" },
|
|
12801
|
+
{ id: "preschool", name: "Preschool" }
|
|
12802
|
+
];
|
|
12803
|
+
var CATALOG_TTL_MS = 60 * 60 * 1e3;
|
|
12804
|
+
async function loadFromFeed(groupId) {
|
|
12805
|
+
let url;
|
|
12806
|
+
try {
|
|
12807
|
+
url = JSON.parse(getProviderSecret("gocurriculumFeeds") || "{}")[groupId];
|
|
12808
|
+
} catch {
|
|
12809
|
+
return null;
|
|
12810
|
+
}
|
|
12811
|
+
if (!url) return null;
|
|
12812
|
+
const response = await fetch(url);
|
|
12813
|
+
return response.ok ? await response.json() : null;
|
|
12814
|
+
}
|
|
12815
|
+
var GoCurriculumProvider = class extends BaseProvider {
|
|
12816
|
+
constructor() {
|
|
12817
|
+
super(...arguments);
|
|
12818
|
+
this.oauthHelper = new OAuthHelper();
|
|
12819
|
+
this.verifiedTokens = /* @__PURE__ */ new Set();
|
|
12820
|
+
this.id = "gocurriculum";
|
|
12821
|
+
this.name = "Go Curriculum";
|
|
12822
|
+
this.logos = {
|
|
12823
|
+
light: "https://gocurriculum.com/wp-content/uploads/go-logo-curriculum-v2.png",
|
|
12824
|
+
dark: "https://gocurriculum.com/wp-content/uploads/go-logo-curriculum-v2.png"
|
|
12825
|
+
};
|
|
12826
|
+
this.config = {
|
|
12827
|
+
id: "gocurriculum",
|
|
12828
|
+
name: "Go Curriculum",
|
|
12829
|
+
apiBase: "https://gocurriculum.com",
|
|
12830
|
+
oauthBase: "https://gocurriculum.com/oauth",
|
|
12831
|
+
clientId: "Rdrvz9jz9nTNf8rCsbpuAgVLdoWHZmcjdmmrP0Bw",
|
|
12832
|
+
// supplied at runtime via setProviderSecret("gocurriculum", ...) — never commit the value
|
|
12833
|
+
get clientSecret() {
|
|
12834
|
+
return getProviderSecret("gocurriculum");
|
|
12835
|
+
},
|
|
12836
|
+
scopes: ["basic"]
|
|
12837
|
+
};
|
|
12838
|
+
this.data = {};
|
|
12839
|
+
this.dataFetchedAt = 0;
|
|
12840
|
+
this.loadCatalog = loadFromFeed;
|
|
12841
|
+
this.requiresAuth = true;
|
|
12842
|
+
this.authTypes = ["oauth_pkce"];
|
|
12843
|
+
this.capabilities = { browse: true, playlist: true, instructions: true, mediaLicensing: false };
|
|
12844
|
+
}
|
|
12845
|
+
setCatalogLoader(loader) {
|
|
12846
|
+
this.loadCatalog = loader;
|
|
12847
|
+
this.dataFetchedAt = 0;
|
|
12848
|
+
}
|
|
12849
|
+
async getData(groupId, auth) {
|
|
12850
|
+
if (Date.now() - this.dataFetchedAt >= CATALOG_TTL_MS) {
|
|
12851
|
+
await Promise.all(GROUPS.map(async (g) => {
|
|
12852
|
+
try {
|
|
12853
|
+
const data = await this.loadCatalog(g.id, auth);
|
|
12854
|
+
if (data) this.data[g.id] = data;
|
|
12855
|
+
} catch {
|
|
12856
|
+
}
|
|
12857
|
+
}));
|
|
12858
|
+
if (GROUPS.every((g) => this.data[g.id])) this.dataFetchedAt = Date.now();
|
|
12859
|
+
}
|
|
12860
|
+
return this.data[groupId];
|
|
12861
|
+
}
|
|
12862
|
+
async getCollection(segments, auth) {
|
|
12863
|
+
return (await this.getData(segments[0], auth))?.catalog.find((c) => c.id === segments[1]);
|
|
12864
|
+
}
|
|
12865
|
+
// what a server host returns to a device host's setCatalogLoader
|
|
12866
|
+
async getCatalog(groupId, auth) {
|
|
12867
|
+
if (!auth || !await this.verifyAuth(auth)) return null;
|
|
12868
|
+
return await this.getData(groupId, auth) || null;
|
|
12869
|
+
}
|
|
12870
|
+
// ponytail: any valid login unlocks everything for the pilot — per-tier (MemberPress) filtering waits on Go's membership endpoint
|
|
12871
|
+
async verifyAuth(auth) {
|
|
12872
|
+
const token = auth?.access_token;
|
|
12873
|
+
if (!token) return false;
|
|
12874
|
+
if (this.verifiedTokens.has(token)) return true;
|
|
12875
|
+
try {
|
|
12876
|
+
const response = await fetch(`${this.config.oauthBase}/me`, { method: "POST", headers: { "Content-Type": "application/x-www-form-urlencoded" }, body: new URLSearchParams({ access_token: token }).toString() });
|
|
12877
|
+
if (!response.ok) return false;
|
|
12878
|
+
this.verifiedTokens.add(token);
|
|
12879
|
+
return true;
|
|
12880
|
+
} catch {
|
|
12881
|
+
return false;
|
|
12882
|
+
}
|
|
12883
|
+
}
|
|
12884
|
+
async browse(path, auth) {
|
|
12885
|
+
if (!auth || !await this.verifyAuth(auth)) return [];
|
|
12886
|
+
const { segments, depth } = parsePath(path);
|
|
12887
|
+
if (depth === 0) return GROUPS.map((g) => createFolder(g.id, g.name, `/${g.id}`));
|
|
12888
|
+
if (depth === 1) return ((await this.getData(segments[0], auth))?.catalog || []).map((c) => createFolder(c.id, c.name, `/${segments[0]}/${c.id}`, c.thumbnail));
|
|
12889
|
+
const collection = await this.getCollection(segments, auth);
|
|
12890
|
+
if (!collection) return [];
|
|
12891
|
+
if (depth === 2) return collection.lessons.map((l) => createFolder(l.id, l.name, `/${segments[0]}/${collection.id}/${l.id}`, l.thumbnail || collection.thumbnail, true));
|
|
12892
|
+
if (depth === 3) return this.getLessonFiles(collection, segments[2]);
|
|
12893
|
+
return [];
|
|
12894
|
+
}
|
|
12895
|
+
getLessonFiles(collection, lessonId) {
|
|
12896
|
+
const lesson = collection.lessons.find((l) => l.id === lessonId);
|
|
12897
|
+
if (!lesson) return [];
|
|
12898
|
+
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 }));
|
|
12899
|
+
}
|
|
12900
|
+
async getPlaylist(path, auth, _resolution) {
|
|
12901
|
+
if (!auth || !await this.verifyAuth(auth)) return null;
|
|
12902
|
+
const { segments, depth } = parsePath(path);
|
|
12903
|
+
if (depth !== 3) return null;
|
|
12904
|
+
const collection = await this.getCollection(segments, auth);
|
|
12905
|
+
if (!collection) return null;
|
|
12906
|
+
const files = this.getLessonFiles(collection, segments[2]);
|
|
12907
|
+
return files.length > 0 ? files : null;
|
|
12908
|
+
}
|
|
12909
|
+
async getInstructions(path, auth) {
|
|
12910
|
+
const { segments, depth } = parsePath(path);
|
|
12911
|
+
if (depth !== 3) return null;
|
|
12912
|
+
const files = await this.getPlaylist(path, auth);
|
|
12913
|
+
if (!files || !auth) return null;
|
|
12914
|
+
const collection = await this.getCollection(segments, auth);
|
|
12915
|
+
const lesson = collection?.lessons.find((l) => l.id === segments[2]);
|
|
12916
|
+
const instructions = filesToInstructions(lesson?.name || "Lesson", files);
|
|
12917
|
+
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 }));
|
|
12918
|
+
if (downloads.length > 0) instructions.downloads = downloads;
|
|
12919
|
+
return instructions;
|
|
12920
|
+
}
|
|
12921
|
+
generateCodeVerifier() {
|
|
12922
|
+
return this.oauthHelper.generateCodeVerifier();
|
|
12923
|
+
}
|
|
12924
|
+
async buildAuthUrl(codeVerifier, redirectUri, state) {
|
|
12925
|
+
return this.oauthHelper.buildAuthUrl(this.config, codeVerifier, redirectUri, state || this.id);
|
|
12926
|
+
}
|
|
12927
|
+
buildAuthUrlFromChallenge(codeChallenge, redirectUri, state) {
|
|
12928
|
+
return this.oauthHelper.buildAuthUrlFromChallenge(this.config, codeChallenge, redirectUri, state);
|
|
12929
|
+
}
|
|
12930
|
+
async exchangeCodeForTokens(code, codeVerifier, redirectUri) {
|
|
12931
|
+
return this.oauthHelper.exchangeCodeForTokens(this.config, this.id, code, codeVerifier, redirectUri);
|
|
12932
|
+
}
|
|
12933
|
+
};
|
|
12934
|
+
|
|
12797
12935
|
// src/providers/lifeChurch/data.json
|
|
12798
12936
|
var data_default3 = {
|
|
12799
12937
|
generatedAt: "2026-05-09T20:14:53.089Z",
|
|
@@ -16601,122 +16739,6 @@ function registerProvider(provider) {
|
|
|
16601
16739
|
providerRegistry.set(provider.id, provider);
|
|
16602
16740
|
}
|
|
16603
16741
|
|
|
16604
|
-
// src/providers/goCurriculum/GoCurriculumProvider.ts
|
|
16605
|
-
var FEEDS = [
|
|
16606
|
-
{ id: "elementary", name: "Elementary", url: "https://dl.dropboxusercontent.com/scl/fi/xortbrs2nk49wemscubpu/data.json?rlkey=gnzxyrauhud7xtjlejrs8ysp7" },
|
|
16607
|
-
{ id: "preschool", name: "Preschool", url: "https://dl.dropboxusercontent.com/scl/fi/1cdovbglp5rpfmb9mdg2s/data.json?rlkey=miwsssb0o7i2wdijrdc7jjqcl" }
|
|
16608
|
-
];
|
|
16609
|
-
var CATALOG_TTL_MS = 60 * 60 * 1e3;
|
|
16610
|
-
var GoCurriculumProvider = class extends BaseProvider {
|
|
16611
|
-
constructor() {
|
|
16612
|
-
super(...arguments);
|
|
16613
|
-
this.oauthHelper = new OAuthHelper();
|
|
16614
|
-
this.verifiedTokens = /* @__PURE__ */ new Set();
|
|
16615
|
-
this.id = "gocurriculum";
|
|
16616
|
-
this.name = "Go Curriculum";
|
|
16617
|
-
this.logos = {
|
|
16618
|
-
light: "https://gocurriculum.com/wp-content/uploads/go-logo-curriculum-v2.png",
|
|
16619
|
-
dark: "https://gocurriculum.com/wp-content/uploads/go-logo-curriculum-v2.png"
|
|
16620
|
-
};
|
|
16621
|
-
this.config = {
|
|
16622
|
-
id: "gocurriculum",
|
|
16623
|
-
name: "Go Curriculum",
|
|
16624
|
-
apiBase: "https://gocurriculum.com",
|
|
16625
|
-
oauthBase: "https://gocurriculum.com/oauth",
|
|
16626
|
-
clientId: "Rdrvz9jz9nTNf8rCsbpuAgVLdoWHZmcjdmmrP0Bw",
|
|
16627
|
-
// supplied at runtime via setProviderSecret("gocurriculum", ...) — never commit the value
|
|
16628
|
-
get clientSecret() {
|
|
16629
|
-
return getProviderSecret("gocurriculum");
|
|
16630
|
-
},
|
|
16631
|
-
scopes: ["basic"]
|
|
16632
|
-
};
|
|
16633
|
-
this.data = {};
|
|
16634
|
-
this.dataFetchedAt = 0;
|
|
16635
|
-
this.requiresAuth = true;
|
|
16636
|
-
this.authTypes = ["oauth_pkce"];
|
|
16637
|
-
this.capabilities = { browse: true, playlist: true, instructions: true, mediaLicensing: false };
|
|
16638
|
-
}
|
|
16639
|
-
async getData(groupId) {
|
|
16640
|
-
if (Date.now() - this.dataFetchedAt >= CATALOG_TTL_MS) {
|
|
16641
|
-
await Promise.all(FEEDS.map(async (f) => {
|
|
16642
|
-
try {
|
|
16643
|
-
const response = await fetch(f.url);
|
|
16644
|
-
if (response.ok) this.data[f.id] = await response.json();
|
|
16645
|
-
} catch {
|
|
16646
|
-
}
|
|
16647
|
-
}));
|
|
16648
|
-
if (FEEDS.every((f) => this.data[f.id])) this.dataFetchedAt = Date.now();
|
|
16649
|
-
}
|
|
16650
|
-
return this.data[groupId];
|
|
16651
|
-
}
|
|
16652
|
-
async getCollection(segments) {
|
|
16653
|
-
return (await this.getData(segments[0]))?.catalog.find((c) => c.id === segments[1]);
|
|
16654
|
-
}
|
|
16655
|
-
// ponytail: any valid login unlocks everything for the pilot — per-tier (MemberPress) filtering waits on Go's membership endpoint
|
|
16656
|
-
async verifyAuth(auth) {
|
|
16657
|
-
const token = auth?.access_token;
|
|
16658
|
-
if (!token) return false;
|
|
16659
|
-
if (this.verifiedTokens.has(token)) return true;
|
|
16660
|
-
try {
|
|
16661
|
-
const response = await fetch(`${this.config.oauthBase}/me`, { method: "POST", headers: { "Content-Type": "application/x-www-form-urlencoded" }, body: new URLSearchParams({ access_token: token }).toString() });
|
|
16662
|
-
if (!response.ok) return false;
|
|
16663
|
-
this.verifiedTokens.add(token);
|
|
16664
|
-
return true;
|
|
16665
|
-
} catch {
|
|
16666
|
-
return false;
|
|
16667
|
-
}
|
|
16668
|
-
}
|
|
16669
|
-
async browse(path, auth) {
|
|
16670
|
-
if (!await this.verifyAuth(auth)) return [];
|
|
16671
|
-
const { segments, depth } = parsePath(path);
|
|
16672
|
-
if (depth === 0) return FEEDS.map((f) => createFolder(f.id, f.name, `/${f.id}`));
|
|
16673
|
-
if (depth === 1) return ((await this.getData(segments[0]))?.catalog || []).map((c) => createFolder(c.id, c.name, `/${segments[0]}/${c.id}`, c.thumbnail));
|
|
16674
|
-
const collection = await this.getCollection(segments);
|
|
16675
|
-
if (!collection) return [];
|
|
16676
|
-
if (depth === 2) return collection.lessons.map((l) => createFolder(l.id, l.name, `/${segments[0]}/${collection.id}/${l.id}`, l.thumbnail || collection.thumbnail, true));
|
|
16677
|
-
if (depth === 3) return this.getLessonFiles(collection, segments[2]);
|
|
16678
|
-
return [];
|
|
16679
|
-
}
|
|
16680
|
-
getLessonFiles(collection, lessonId) {
|
|
16681
|
-
const lesson = collection.lessons.find((l) => l.id === lessonId);
|
|
16682
|
-
if (!lesson) return [];
|
|
16683
|
-
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 }));
|
|
16684
|
-
}
|
|
16685
|
-
async getPlaylist(path, auth, _resolution) {
|
|
16686
|
-
if (!await this.verifyAuth(auth)) return null;
|
|
16687
|
-
const { segments, depth } = parsePath(path);
|
|
16688
|
-
if (depth !== 3) return null;
|
|
16689
|
-
const collection = await this.getCollection(segments);
|
|
16690
|
-
if (!collection) return null;
|
|
16691
|
-
const files = this.getLessonFiles(collection, segments[2]);
|
|
16692
|
-
return files.length > 0 ? files : null;
|
|
16693
|
-
}
|
|
16694
|
-
async getInstructions(path, auth) {
|
|
16695
|
-
const { segments, depth } = parsePath(path);
|
|
16696
|
-
if (depth !== 3) return null;
|
|
16697
|
-
const files = await this.getPlaylist(path, auth);
|
|
16698
|
-
if (!files) return null;
|
|
16699
|
-
const collection = await this.getCollection(segments);
|
|
16700
|
-
const lesson = collection?.lessons.find((l) => l.id === segments[2]);
|
|
16701
|
-
const instructions = filesToInstructions(lesson?.name || "Lesson", files);
|
|
16702
|
-
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 }));
|
|
16703
|
-
if (downloads.length > 0) instructions.downloads = downloads;
|
|
16704
|
-
return instructions;
|
|
16705
|
-
}
|
|
16706
|
-
generateCodeVerifier() {
|
|
16707
|
-
return this.oauthHelper.generateCodeVerifier();
|
|
16708
|
-
}
|
|
16709
|
-
async buildAuthUrl(codeVerifier, redirectUri, state) {
|
|
16710
|
-
return this.oauthHelper.buildAuthUrl(this.config, codeVerifier, redirectUri, state || this.id);
|
|
16711
|
-
}
|
|
16712
|
-
buildAuthUrlFromChallenge(codeChallenge, redirectUri, state) {
|
|
16713
|
-
return this.oauthHelper.buildAuthUrlFromChallenge(this.config, codeChallenge, redirectUri, state);
|
|
16714
|
-
}
|
|
16715
|
-
async exchangeCodeForTokens(code, codeVerifier, redirectUri) {
|
|
16716
|
-
return this.oauthHelper.exchangeCodeForTokens(this.config, this.id, code, codeVerifier, redirectUri);
|
|
16717
|
-
}
|
|
16718
|
-
};
|
|
16719
|
-
|
|
16720
16742
|
// src/providers/googledrive/GoogleDriveProvider.ts
|
|
16721
16743
|
var FOLDER_MIME = "application/vnd.google-apps.folder";
|
|
16722
16744
|
var MAX_PAGINATION_CALLS2 = 10;
|
|
@@ -17061,7 +17083,7 @@ function getAvailableProviders(ids) {
|
|
|
17061
17083
|
}
|
|
17062
17084
|
|
|
17063
17085
|
// src/index.ts
|
|
17064
|
-
var VERSION = true ? "0.
|
|
17086
|
+
var VERSION = true ? "0.14.0" : "dev";
|
|
17065
17087
|
// Annotate the CommonJS export names for ESM import in node:
|
|
17066
17088
|
0 && (module.exports = {
|
|
17067
17089
|
APlayProvider,
|
|
@@ -17073,6 +17095,7 @@ var VERSION = true ? "0.13.1" : "dev";
|
|
|
17073
17095
|
DropboxProvider,
|
|
17074
17096
|
FREESHOW_REST_PORT,
|
|
17075
17097
|
FreeShowProvider,
|
|
17098
|
+
GoCurriculumProvider,
|
|
17076
17099
|
HighVoltageKidsProvider,
|
|
17077
17100
|
JesusFilmProvider,
|
|
17078
17101
|
LessonsChurchProvider,
|