@fabricorg/sdui-release 0.6.0 → 0.7.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/CHANGELOG.md +39 -5
- package/dist/index.cjs +25 -17
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +25 -17
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -677,6 +677,25 @@ function validateSduiRelease(input) {
|
|
|
677
677
|
...resolved.remote ? { remote: resolved.remote } : {}
|
|
678
678
|
});
|
|
679
679
|
}
|
|
680
|
+
const contractNamespaces = /* @__PURE__ */ new Set();
|
|
681
|
+
const distinctContracts = contracts.filter((contract) => {
|
|
682
|
+
if (contractNamespaces.has(contract.namespace)) {
|
|
683
|
+
add(
|
|
684
|
+
"ambiguous_capability_reference",
|
|
685
|
+
`contracts.${contract.namespace}`,
|
|
686
|
+
`contract for "${contract.namespace}" is supplied more than once`
|
|
687
|
+
);
|
|
688
|
+
return false;
|
|
689
|
+
}
|
|
690
|
+
contractNamespaces.add(contract.namespace);
|
|
691
|
+
return true;
|
|
692
|
+
});
|
|
693
|
+
const seenDocumentNamespaces = /* @__PURE__ */ new Set();
|
|
694
|
+
const distinctDocuments = input.contracts.filter((document) => {
|
|
695
|
+
if (seenDocumentNamespaces.has(document.capability.namespace)) return false;
|
|
696
|
+
seenDocumentNamespaces.add(document.capability.namespace);
|
|
697
|
+
return true;
|
|
698
|
+
});
|
|
680
699
|
{
|
|
681
700
|
for (const pack of resolvedPacks) {
|
|
682
701
|
const approved = input.assembly.componentPacks.find(
|
|
@@ -728,7 +747,7 @@ function validateSduiRelease(input) {
|
|
|
728
747
|
);
|
|
729
748
|
}
|
|
730
749
|
}
|
|
731
|
-
for (const document of
|
|
750
|
+
for (const document of distinctDocuments) {
|
|
732
751
|
const approved = input.assembly.capabilities.find(
|
|
733
752
|
(capability) => capability.namespace === document.capability.namespace && capability.usageContractDigest === computeUsageContractDocumentDigest(document)
|
|
734
753
|
);
|
|
@@ -748,22 +767,9 @@ function validateSduiRelease(input) {
|
|
|
748
767
|
}
|
|
749
768
|
}
|
|
750
769
|
const coreComponents = new Set(input.coreComponents ?? []);
|
|
751
|
-
const knownViews = buildKnownViews(
|
|
770
|
+
const knownViews = buildKnownViews(distinctContracts);
|
|
752
771
|
const grantedViews = buildGrantedReferences(input.grants.views, "grants.views");
|
|
753
772
|
const grantedIntents = buildGrantedReferences(input.grants.intents, "grants.intents");
|
|
754
|
-
const contractNamespaces = /* @__PURE__ */ new Set();
|
|
755
|
-
const distinctContracts = contracts.filter((contract) => {
|
|
756
|
-
if (contractNamespaces.has(contract.namespace)) {
|
|
757
|
-
add(
|
|
758
|
-
"ambiguous_capability_reference",
|
|
759
|
-
`contracts.${contract.namespace}`,
|
|
760
|
-
`contract for "${contract.namespace}" is supplied more than once`
|
|
761
|
-
);
|
|
762
|
-
return false;
|
|
763
|
-
}
|
|
764
|
-
contractNamespaces.add(contract.namespace);
|
|
765
|
-
return true;
|
|
766
|
-
});
|
|
767
773
|
const knownIntents = buildKnownActionIntents(distinctContracts, add, grantedIntents);
|
|
768
774
|
reportAmbiguousGrantedViews(distinctContracts, grantedViews, add);
|
|
769
775
|
for (const reference of grantedViews) {
|
|
@@ -782,11 +788,11 @@ function validateSduiRelease(input) {
|
|
|
782
788
|
add(
|
|
783
789
|
"mutation_bypass",
|
|
784
790
|
`grants.intents.${reference}`,
|
|
785
|
-
`release grants "${reference}", which no supplied capability declares as an intent; promotion would fail to route it`
|
|
791
|
+
`release grants "${reference}", which no supplied capability declares as an intent backed by a declared action; promotion would fail to route it`
|
|
786
792
|
);
|
|
787
793
|
}
|
|
788
794
|
}
|
|
789
|
-
validateIntentActionDeclarations(
|
|
795
|
+
validateIntentActionDeclarations(distinctContracts, add);
|
|
790
796
|
const fragmentGrants = /* @__PURE__ */ new Map();
|
|
791
797
|
for (const [fragmentId, declared] of Object.entries(input.grants.fragments ?? {})) {
|
|
792
798
|
for (const view of declared.views ?? []) {
|
|
@@ -1088,7 +1094,9 @@ function deriveAuthorizationGrants(contracts, held, options = {}) {
|
|
|
1088
1094
|
const reference = `capability://${contract.namespace}/${shortName(view.name, contract.namespace, "/")}`;
|
|
1089
1095
|
if (!bound || bound.views.has(reference)) views.push(reference);
|
|
1090
1096
|
}
|
|
1097
|
+
const declaredActions = new Set(contract.actions.map((action) => action.actionId));
|
|
1091
1098
|
for (const intent of actionIntentsOf(contract)) {
|
|
1099
|
+
if (!declaredActions.has(intent.actionId)) continue;
|
|
1092
1100
|
const reference = `capability://${contract.namespace}/${shortName(intent.name, contract.namespace, ".")}`;
|
|
1093
1101
|
if (!bound || bound.intents.has(reference)) intents.push(reference);
|
|
1094
1102
|
}
|