@odla-ai/chapter 0.40.2 → 0.41.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 CHANGED
@@ -2649,8 +2649,8 @@ function validateBuilderLibraryDocument(value, options = {}) {
2649
2649
  if (sourceType === "chapter" && (resource.scope.kind !== "chapter" || resource.scope.chapterId !== sourceAppId)) {
2650
2650
  errors.push(`document.resources.${resource.id}: Chapter sources may author only their own chapter scope`);
2651
2651
  }
2652
- if (sourceType === "built_not_found" && resource.scope.kind === "chapter") {
2653
- errors.push(`document.resources.${resource.id}: Built Not Found sources may author only built_not_found or global scope`);
2652
+ if (sourceType === "built_not_found" && resource.scope.kind === "chapter" && !(options.allowedChapterIds ?? []).includes(resource.scope.chapterId)) {
2653
+ errors.push(`document.resources.${resource.id}: Built Not Found may target only configured Chapters`);
2654
2654
  }
2655
2655
  }
2656
2656
  if (errors.length) return { ok: false, errors };
@@ -2682,7 +2682,7 @@ function projectBuilderLibraryDelivery(document, target) {
2682
2682
  return {
2683
2683
  ...document,
2684
2684
  target,
2685
- resources: document.source.type === "built_not_found" ? document.resources.filter((resource) => resource.scope.kind === "global") : document.resources
2685
+ resources: document.source.type === "built_not_found" ? document.resources.filter((resource) => resource.scope.kind === "global" || resource.scope.kind === "chapter" && resource.scope.chapterId === target.appId) : document.resources
2686
2686
  };
2687
2687
  }
2688
2688
  function promoteBuilderLibraryResource(input) {