@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.d.cts CHANGED
@@ -1213,6 +1213,9 @@ interface BuilderLibraryValidationOptions {
1213
1213
  sourceType?: BuilderLibrarySourceType;
1214
1214
  sourceAppId?: string;
1215
1215
  targetAppId?: string;
1216
+ /** Chapter IDs a Built Not Found document may address. An empty or omitted
1217
+ * allowlist keeps the historical global-or-private-only behavior. */
1218
+ allowedChapterIds?: readonly string[];
1216
1219
  }
1217
1220
  /** A validated document or actionable strict-contract errors. */
1218
1221
  type BuilderLibraryValidationResult = {
@@ -1260,7 +1263,8 @@ interface BuilderLibraryReceipt {
1260
1263
  declare function canViewBuilderLibraryResource(resource: BuilderLibraryResource, viewer: BuilderLibraryViewer): boolean;
1261
1264
  /** Produce deterministic, published-only input for a site-building agent. */
1262
1265
  declare function buildBuilderLibraryManifest(documents: readonly BuilderLibraryDocument[], viewer: BuilderLibraryViewer, generatedAt?: number, limit?: number): BuilderLibraryManifest;
1263
- /** Build the exact signed layer for one peer; BNF-only material never crosses to a Chapter. */
1266
+ /** Build the exact signed layer for one peer; private and sibling material
1267
+ * never crosses to a Chapter. */
1264
1268
  declare function projectBuilderLibraryDelivery(document: BuilderLibraryDocument, target: BuilderLibraryTarget): BuilderLibraryDocument;
1265
1269
  /** Copy a Chapter item into global authority while preserving its exact origin. */
1266
1270
  declare function promoteBuilderLibraryResource(input: {
package/dist/index.d.ts CHANGED
@@ -1213,6 +1213,9 @@ interface BuilderLibraryValidationOptions {
1213
1213
  sourceType?: BuilderLibrarySourceType;
1214
1214
  sourceAppId?: string;
1215
1215
  targetAppId?: string;
1216
+ /** Chapter IDs a Built Not Found document may address. An empty or omitted
1217
+ * allowlist keeps the historical global-or-private-only behavior. */
1218
+ allowedChapterIds?: readonly string[];
1216
1219
  }
1217
1220
  /** A validated document or actionable strict-contract errors. */
1218
1221
  type BuilderLibraryValidationResult = {
@@ -1260,7 +1263,8 @@ interface BuilderLibraryReceipt {
1260
1263
  declare function canViewBuilderLibraryResource(resource: BuilderLibraryResource, viewer: BuilderLibraryViewer): boolean;
1261
1264
  /** Produce deterministic, published-only input for a site-building agent. */
1262
1265
  declare function buildBuilderLibraryManifest(documents: readonly BuilderLibraryDocument[], viewer: BuilderLibraryViewer, generatedAt?: number, limit?: number): BuilderLibraryManifest;
1263
- /** Build the exact signed layer for one peer; BNF-only material never crosses to a Chapter. */
1266
+ /** Build the exact signed layer for one peer; private and sibling material
1267
+ * never crosses to a Chapter. */
1264
1268
  declare function projectBuilderLibraryDelivery(document: BuilderLibraryDocument, target: BuilderLibraryTarget): BuilderLibraryDocument;
1265
1269
  /** Copy a Chapter item into global authority while preserving its exact origin. */
1266
1270
  declare function promoteBuilderLibraryResource(input: {
package/dist/index.js CHANGED
@@ -2462,8 +2462,8 @@ function validateBuilderLibraryDocument(value, options = {}) {
2462
2462
  if (sourceType === "chapter" && (resource.scope.kind !== "chapter" || resource.scope.chapterId !== sourceAppId)) {
2463
2463
  errors.push(`document.resources.${resource.id}: Chapter sources may author only their own chapter scope`);
2464
2464
  }
2465
- if (sourceType === "built_not_found" && resource.scope.kind === "chapter") {
2466
- errors.push(`document.resources.${resource.id}: Built Not Found sources may author only built_not_found or global scope`);
2465
+ if (sourceType === "built_not_found" && resource.scope.kind === "chapter" && !(options.allowedChapterIds ?? []).includes(resource.scope.chapterId)) {
2466
+ errors.push(`document.resources.${resource.id}: Built Not Found may target only configured Chapters`);
2467
2467
  }
2468
2468
  }
2469
2469
  if (errors.length) return { ok: false, errors };
@@ -2495,7 +2495,7 @@ function projectBuilderLibraryDelivery(document, target) {
2495
2495
  return {
2496
2496
  ...document,
2497
2497
  target,
2498
- resources: document.source.type === "built_not_found" ? document.resources.filter((resource) => resource.scope.kind === "global") : document.resources
2498
+ 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
2499
2499
  };
2500
2500
  }
2501
2501
  function promoteBuilderLibraryResource(input) {