@fabricorg/sdui-release 0.7.0 → 0.7.2

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
@@ -139,10 +139,26 @@ interface WithheldCapability {
139
139
  name: string;
140
140
  };
141
141
  }
142
+ /** A view no versionless reference can address, because its capability publishes it at more than one version. */
143
+ interface UnaddressableView {
144
+ namespace: string;
145
+ reference: string;
146
+ versions: string[];
147
+ }
142
148
  interface DerivedGrants {
143
149
  grants: SduiAuthorizationGrants;
144
150
  /** Capabilities deliberately left out, so an absent navigation entry is explainable. */
145
151
  withheld: WithheldCapability[];
152
+ /**
153
+ * Views left out because a grant for them could not be honoured.
154
+ *
155
+ * A capability may publish one view at two versions; the reference grammar
156
+ * carries no version, so a grant naming it would be refused by validation
157
+ * as ambiguous and could never be routed by promotion. Emitting it anyway
158
+ * would hand validation a grant a route promotion would never have
159
+ * produced, so it is reported here instead.
160
+ */
161
+ unaddressable: UnaddressableView[];
146
162
  }
147
163
  interface DeriveGrantsOptions {
148
164
  /**
@@ -190,4 +206,4 @@ declare function deriveAuthorizationGrants(contracts: readonly UsageContract[],
190
206
  declare const SDUI_DOCUMENT_JSON_SCHEMA: PortableJsonSchema;
191
207
  declare const SDUI_RELEASE_JSON_SCHEMA: PortableJsonSchema;
192
208
 
193
- export { type ActorEntitlements, type DerivedGrants, ResolvedSduiComponentPack, SDUI_DOCUMENT_JSON_SCHEMA, SDUI_RELEASE_JSON_SCHEMA, SduiAuthorizationGrants, type SduiChannel, type SduiChannelCheck, type SduiChannelConformanceResult, type SduiChannelConformanceSubject, type SduiChannelConsumptionResult, SduiComponentPack, SduiDocument, SduiFragment, SduiRelease, SduiTokenSet, SduiValidationInput, SduiValidationResult, type WithheldCapability, assertSduiAuthorizationGrants, assertSduiComponentPack, assertSduiDocument, assertSduiFragment, assertSduiRelease, assertSduiReleaseIntegrity, assertSduiReleaseValid, assertSduiTokenSet, computeReleaseDigest, createSduiChannel, deriveAuthorizationGrants, parseCapabilityRef, runSduiChannelChecks, sduiChannelChecks, validateSduiRelease };
209
+ export { type ActorEntitlements, type DerivedGrants, ResolvedSduiComponentPack, SDUI_DOCUMENT_JSON_SCHEMA, SDUI_RELEASE_JSON_SCHEMA, SduiAuthorizationGrants, type SduiChannel, type SduiChannelCheck, type SduiChannelConformanceResult, type SduiChannelConformanceSubject, type SduiChannelConsumptionResult, SduiComponentPack, SduiDocument, SduiFragment, SduiRelease, SduiTokenSet, SduiValidationInput, SduiValidationResult, type UnaddressableView, type WithheldCapability, assertSduiAuthorizationGrants, assertSduiComponentPack, assertSduiDocument, assertSduiFragment, assertSduiRelease, assertSduiReleaseIntegrity, assertSduiReleaseValid, assertSduiTokenSet, computeReleaseDigest, createSduiChannel, deriveAuthorizationGrants, parseCapabilityRef, runSduiChannelChecks, sduiChannelChecks, validateSduiRelease };
package/dist/index.d.ts CHANGED
@@ -139,10 +139,26 @@ interface WithheldCapability {
139
139
  name: string;
140
140
  };
141
141
  }
142
+ /** A view no versionless reference can address, because its capability publishes it at more than one version. */
143
+ interface UnaddressableView {
144
+ namespace: string;
145
+ reference: string;
146
+ versions: string[];
147
+ }
142
148
  interface DerivedGrants {
143
149
  grants: SduiAuthorizationGrants;
144
150
  /** Capabilities deliberately left out, so an absent navigation entry is explainable. */
145
151
  withheld: WithheldCapability[];
152
+ /**
153
+ * Views left out because a grant for them could not be honoured.
154
+ *
155
+ * A capability may publish one view at two versions; the reference grammar
156
+ * carries no version, so a grant naming it would be refused by validation
157
+ * as ambiguous and could never be routed by promotion. Emitting it anyway
158
+ * would hand validation a grant a route promotion would never have
159
+ * produced, so it is reported here instead.
160
+ */
161
+ unaddressable: UnaddressableView[];
146
162
  }
147
163
  interface DeriveGrantsOptions {
148
164
  /**
@@ -190,4 +206,4 @@ declare function deriveAuthorizationGrants(contracts: readonly UsageContract[],
190
206
  declare const SDUI_DOCUMENT_JSON_SCHEMA: PortableJsonSchema;
191
207
  declare const SDUI_RELEASE_JSON_SCHEMA: PortableJsonSchema;
192
208
 
193
- export { type ActorEntitlements, type DerivedGrants, ResolvedSduiComponentPack, SDUI_DOCUMENT_JSON_SCHEMA, SDUI_RELEASE_JSON_SCHEMA, SduiAuthorizationGrants, type SduiChannel, type SduiChannelCheck, type SduiChannelConformanceResult, type SduiChannelConformanceSubject, type SduiChannelConsumptionResult, SduiComponentPack, SduiDocument, SduiFragment, SduiRelease, SduiTokenSet, SduiValidationInput, SduiValidationResult, type WithheldCapability, assertSduiAuthorizationGrants, assertSduiComponentPack, assertSduiDocument, assertSduiFragment, assertSduiRelease, assertSduiReleaseIntegrity, assertSduiReleaseValid, assertSduiTokenSet, computeReleaseDigest, createSduiChannel, deriveAuthorizationGrants, parseCapabilityRef, runSduiChannelChecks, sduiChannelChecks, validateSduiRelease };
209
+ export { type ActorEntitlements, type DerivedGrants, ResolvedSduiComponentPack, SDUI_DOCUMENT_JSON_SCHEMA, SDUI_RELEASE_JSON_SCHEMA, SduiAuthorizationGrants, type SduiChannel, type SduiChannelCheck, type SduiChannelConformanceResult, type SduiChannelConformanceSubject, type SduiChannelConsumptionResult, SduiComponentPack, SduiDocument, SduiFragment, SduiRelease, SduiTokenSet, SduiValidationInput, SduiValidationResult, type UnaddressableView, type WithheldCapability, assertSduiAuthorizationGrants, assertSduiComponentPack, assertSduiDocument, assertSduiFragment, assertSduiRelease, assertSduiReleaseIntegrity, assertSduiReleaseValid, assertSduiTokenSet, computeReleaseDigest, createSduiChannel, deriveAuthorizationGrants, parseCapabilityRef, runSduiChannelChecks, sduiChannelChecks, validateSduiRelease };
package/dist/index.js CHANGED
@@ -1080,6 +1080,7 @@ function deriveAuthorizationGrants(contracts, held, options = {}) {
1080
1080
  const views = [];
1081
1081
  const intents = [];
1082
1082
  const withheld = [];
1083
+ const unaddressable = [];
1083
1084
  for (const contract of contracts) {
1084
1085
  if (undeclared === "withhold" && !declaresAnyRequirement(contract)) {
1085
1086
  withheld.push({ namespace: contract.namespace, missing: { kind: "permission", name: "(none declared)" } });
@@ -1090,8 +1091,16 @@ function deriveAuthorizationGrants(contracts, held, options = {}) {
1090
1091
  withheld.push({ namespace: contract.namespace, missing });
1091
1092
  continue;
1092
1093
  }
1094
+ const versionsByReference = /* @__PURE__ */ new Map();
1093
1095
  for (const view of contract.views) {
1094
1096
  const reference = `capability://${contract.namespace}/${shortName(view.name, contract.namespace, "/")}`;
1097
+ versionsByReference.set(reference, /* @__PURE__ */ new Set([...versionsByReference.get(reference) ?? [], String(view.version)]));
1098
+ }
1099
+ for (const [reference, versions] of versionsByReference) {
1100
+ if (versions.size > 1) {
1101
+ unaddressable.push({ namespace: contract.namespace, reference, versions: [...versions].sort() });
1102
+ continue;
1103
+ }
1095
1104
  if (!bound || bound.views.has(reference)) views.push(reference);
1096
1105
  }
1097
1106
  const declaredActions = new Set(contract.actions.map((action) => action.actionId));
@@ -1103,7 +1112,8 @@ function deriveAuthorizationGrants(contracts, held, options = {}) {
1103
1112
  }
1104
1113
  return {
1105
1114
  grants: { views: [...new Set(views)].sort(), intents: [...new Set(intents)].sort() },
1106
- withheld: withheld.sort((left, right) => left.namespace < right.namespace ? -1 : left.namespace > right.namespace ? 1 : 0)
1115
+ withheld: withheld.sort((left, right) => left.namespace < right.namespace ? -1 : left.namespace > right.namespace ? 1 : 0),
1116
+ unaddressable: unaddressable.sort((left, right) => left.reference < right.reference ? -1 : left.reference > right.reference ? 1 : 0)
1107
1117
  };
1108
1118
  }
1109
1119
  function declaresAnyRequirement(contract) {