@odla-ai/chapter 0.26.0 → 0.26.1

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
@@ -70,6 +70,10 @@ interface ChapterNetworkTarget {
70
70
  name?: string;
71
71
  /** Absolute follower origin, e.g. `https://chapter.example.com`. */
72
72
  url: string;
73
+ /** Optional Cloudflare service-binding name for Worker-to-Worker delivery.
74
+ * The URL still defines the signed request origin; the binding only supplies
75
+ * the transport when a `workers.dev` subrequest cannot enter another Worker. */
76
+ binding?: string;
73
77
  /** Leader-vault key holding this follower's share secret. Defaults to
74
78
  * `network_share_<id-with-underscores>`. */
75
79
  secretName?: string;
@@ -112,6 +116,7 @@ interface ResolvedNetworkTarget {
112
116
  id: string;
113
117
  name: string;
114
118
  url: string;
119
+ binding?: string;
115
120
  secretName: string;
116
121
  fields?: Record<string, readonly string[]>;
117
122
  }
package/dist/index.d.ts CHANGED
@@ -70,6 +70,10 @@ interface ChapterNetworkTarget {
70
70
  name?: string;
71
71
  /** Absolute follower origin, e.g. `https://chapter.example.com`. */
72
72
  url: string;
73
+ /** Optional Cloudflare service-binding name for Worker-to-Worker delivery.
74
+ * The URL still defines the signed request origin; the binding only supplies
75
+ * the transport when a `workers.dev` subrequest cannot enter another Worker. */
76
+ binding?: string;
73
77
  /** Leader-vault key holding this follower's share secret. Defaults to
74
78
  * `network_share_<id-with-underscores>`. */
75
79
  secretName?: string;
@@ -112,6 +116,7 @@ interface ResolvedNetworkTarget {
112
116
  id: string;
113
117
  name: string;
114
118
  url: string;
119
+ binding?: string;
115
120
  secretName: string;
116
121
  fields?: Record<string, readonly string[]>;
117
122
  }
package/dist/index.js CHANGED
@@ -883,6 +883,7 @@ function formationFields(crm, formation) {
883
883
  // src/config.ts
884
884
  var SLUG = /^[a-z0-9][a-z0-9-]{1,62}$/;
885
885
  var FIELD = /^[a-z][a-zA-Z0-9_]*$/;
886
+ var BINDING = /^[A-Z][A-Z0-9_]{0,127}$/;
886
887
  function resolveNetwork(config, crm) {
887
888
  const seen = /* @__PURE__ */ new Set();
888
889
  const targets = [];
@@ -928,10 +929,17 @@ function resolveNetwork(config, crm) {
928
929
  if (!/^[a-zA-Z][a-zA-Z0-9_-]{1,127}$/.test(secretName)) {
929
930
  throw new Error(`defineChapter.network.targets.${target.id}.secretName: must be a vault-key identifier`);
930
931
  }
932
+ const binding = target.binding?.trim();
933
+ if (binding && !BINDING.test(binding)) {
934
+ throw new Error(
935
+ `defineChapter.network.targets.${target.id}.binding: must be an uppercase Worker binding identifier`
936
+ );
937
+ }
931
938
  targets.push({
932
939
  id: target.id,
933
940
  name: target.name?.trim() || target.id,
934
941
  url: url.origin,
942
+ ...binding ? { binding } : {},
935
943
  secretName,
936
944
  ...fields ? { fields } : {}
937
945
  });