@churchapps/content-providers 0.1.3 → 0.1.5

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
@@ -620,7 +620,7 @@ declare class HighVoltageKidsProvider implements IProvider {
620
620
  * / -> categories (Feature Films, Series, Collections)
621
621
  * /{category} -> list items in category
622
622
  * /{category}/{id} -> single video (feature film) or container children (series/collection)
623
- * /{category}/{containerId}/{videoId} -> single video within a container
623
+ * /{category}/{...containerIds}/{id} -> nested containers or single video (supports arbitrary depth)
624
624
  */
625
625
  declare class JesusFilmProvider implements IProvider {
626
626
  readonly id = "jesusfilm";
package/dist/index.d.ts CHANGED
@@ -620,7 +620,7 @@ declare class HighVoltageKidsProvider implements IProvider {
620
620
  * / -> categories (Feature Films, Series, Collections)
621
621
  * /{category} -> list items in category
622
622
  * /{category}/{id} -> single video (feature film) or container children (series/collection)
623
- * /{category}/{containerId}/{videoId} -> single video within a container
623
+ * /{category}/{...containerIds}/{id} -> nested containers or single video (supports arbitrary depth)
624
624
  */
625
625
  declare class JesusFilmProvider implements IProvider {
626
626
  readonly id = "jesusfilm";
package/dist/index.js CHANGED
@@ -12441,13 +12441,13 @@ var JesusFilmProvider = class {
12441
12441
  const { segments, depth } = parsePath(path);
12442
12442
  if (depth === 0) return this.getCategories();
12443
12443
  if (depth === 1) return this.getItemsInCategory(segments[0]);
12444
- if (depth === 2) {
12445
- const category = segments[0];
12446
- if (category === "feature-films") return this.getVideoFile(segments[1]);
12447
- return this.getContainerChildren(segments[1], category);
12448
- }
12449
- if (depth === 3) return this.getVideoFile(segments[2]);
12450
- return [];
12444
+ const category = segments[0];
12445
+ const lastId = segments[depth - 1];
12446
+ if (depth === 2 && category === "feature-films") return this.getVideoFile(lastId);
12447
+ const pathPrefix = "/" + segments.join("/");
12448
+ const children = await this.getContainerChildren(lastId, pathPrefix);
12449
+ if (children.length > 0) return children;
12450
+ return this.getVideoFile(lastId);
12451
12451
  }
12452
12452
  getCategories() {
12453
12453
  return [
@@ -12463,7 +12463,7 @@ var JesusFilmProvider = class {
12463
12463
  `/media-components?filter=master&subTypes=${subType}&languageIds=${LANGUAGE_ID}&limit=100`
12464
12464
  );
12465
12465
  return data._embedded.mediaComponents.map((item) => {
12466
- const isLeaf = item.componentType === "content";
12466
+ const isLeaf = item.containsCount === 0;
12467
12467
  return createFolder(
12468
12468
  item.mediaComponentId,
12469
12469
  item.title,
@@ -12496,7 +12496,7 @@ var JesusFilmProvider = class {
12496
12496
  })
12497
12497
  ];
12498
12498
  }
12499
- async getContainerChildren(containerId, category) {
12499
+ async getContainerChildren(containerId, pathPrefix) {
12500
12500
  const linksData = await this.fetchApi(
12501
12501
  `/media-component-links/${containerId}`
12502
12502
  );
@@ -12510,9 +12510,9 @@ var JesusFilmProvider = class {
12510
12510
  return childrenData._embedded.mediaComponents.map((item) => createFolder(
12511
12511
  item.mediaComponentId,
12512
12512
  item.title,
12513
- `/${category}/${containerId}/${item.mediaComponentId}`,
12513
+ `${pathPrefix}/${item.mediaComponentId}`,
12514
12514
  item.imageUrls.mobileCinematicHigh || item.imageUrls.videoStill || item.imageUrls.thumbnail,
12515
- true
12515
+ item.containsCount === 0
12516
12516
  ));
12517
12517
  }
12518
12518
  extractMuxPlaybackId(url) {
@@ -12523,10 +12523,13 @@ var JesusFilmProvider = class {
12523
12523
  const { segments, depth } = parsePath(path);
12524
12524
  if (depth < 1) return null;
12525
12525
  const category = segments[0];
12526
- if (depth === 3) {
12527
- const items = await this.getVideoFile(segments[2]);
12528
- if (items.length === 0) return null;
12529
- return items.filter((item) => item.type === "file");
12526
+ if (depth >= 3) {
12527
+ const lastId = segments[depth - 1];
12528
+ const items = await this.getVideoFile(lastId);
12529
+ const files2 = items.filter((item) => item.type === "file");
12530
+ if (files2.length > 0) return files2;
12531
+ const containerFiles = await this.fetchContainerVideoFiles(lastId);
12532
+ return containerFiles.length > 0 ? containerFiles : null;
12530
12533
  }
12531
12534
  if (depth === 2) {
12532
12535
  if (category === "feature-films") {
@@ -12542,7 +12545,7 @@ var JesusFilmProvider = class {
12542
12545
  const data = await this.fetchApi(
12543
12546
  `/media-components?filter=master&subTypes=${subType}&languageIds=${LANGUAGE_ID}&limit=100`
12544
12547
  );
12545
- const contentComponents = data._embedded.mediaComponents.filter((item) => item.componentType === "content");
12548
+ const contentComponents = data._embedded.mediaComponents.filter((item) => item.containsCount === 0);
12546
12549
  const files = await this.fetchVideoFiles(contentComponents);
12547
12550
  return files.length > 0 ? files : null;
12548
12551
  }
@@ -12581,7 +12584,14 @@ var JesusFilmProvider = class {
12581
12584
  `/media-components?ids=${idsParam}&languageIds=${LANGUAGE_ID}`
12582
12585
  );
12583
12586
  if (!childrenData._embedded?.mediaComponents) return [];
12584
- return this.fetchVideoFiles(childrenData._embedded.mediaComponents);
12587
+ const contentItems = childrenData._embedded.mediaComponents.filter((c) => c.containsCount === 0);
12588
+ const containerItems = childrenData._embedded.mediaComponents.filter((c) => c.containsCount > 0);
12589
+ const files = await this.fetchVideoFiles(contentItems);
12590
+ for (const container of containerItems) {
12591
+ const nested = await this.fetchContainerVideoFiles(container.mediaComponentId);
12592
+ files.push(...nested);
12593
+ }
12594
+ return files;
12585
12595
  }
12586
12596
  async buildVideoInstructions(mediaComponentId, category) {
12587
12597
  const items = await this.getVideoFile(mediaComponentId);
@@ -12656,7 +12666,7 @@ var JesusFilmProvider = class {
12656
12666
  const actionItems = await Promise.all(
12657
12667
  data._embedded.mediaComponents.map(async (component) => {
12658
12668
  let downloadUrl;
12659
- if (component.componentType === "content") {
12669
+ if (component.containsCount === 0) {
12660
12670
  try {
12661
12671
  const variant = await this.fetchApi(
12662
12672
  `/media-components/${component.mediaComponentId}/languages/${LANGUAGE_ID}?platform=web`
@@ -12694,7 +12704,12 @@ var JesusFilmProvider = class {
12694
12704
  if (category === "feature-films") return this.buildVideoInstructions(segments[1], category);
12695
12705
  return this.buildContainerInstructions(segments[1], category);
12696
12706
  }
12697
- if (depth === 3) return this.buildVideoInstructions(segments[2], category);
12707
+ if (depth >= 3) {
12708
+ const lastId = segments[depth - 1];
12709
+ const videoResult = await this.buildVideoInstructions(lastId, category);
12710
+ if (videoResult) return videoResult;
12711
+ return this.buildContainerInstructions(lastId, category);
12712
+ }
12698
12713
  return null;
12699
12714
  }
12700
12715
  supportsDeviceFlow() {