@fabricorg/sdui-release 0.5.0 → 0.6.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 +33 -0
- package/dist/index.cjs +27 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +27 -3
- package/dist/index.js.map +1 -1
- package/package.json +5 -5
package/dist/index.js
CHANGED
|
@@ -416,7 +416,9 @@ function buildKnownActionIntents(contracts, add, grantedIntents) {
|
|
|
416
416
|
const occurrences = /* @__PURE__ */ new Map();
|
|
417
417
|
for (const contract of contracts) {
|
|
418
418
|
const experience = contract.extensions?.["fabric.experience/v1"];
|
|
419
|
+
const declaredActions = new Set(contract.actions.map((action) => action.actionId));
|
|
419
420
|
for (const intent of experience?.actionIntents ?? []) {
|
|
421
|
+
if (!declaredActions.has(intent.actionId)) continue;
|
|
420
422
|
const shortName2 = intent.name.startsWith(`${contract.namespace}.`) ? intent.name.slice(contract.namespace.length + 1) : intent.name;
|
|
421
423
|
const reference = `${contract.namespace}/${shortName2}`;
|
|
422
424
|
if (grantedIntents === void 0 || grantedIntents.has(`capability://${reference}`)) {
|
|
@@ -749,18 +751,40 @@ function validateSduiRelease(input) {
|
|
|
749
751
|
const knownViews = buildKnownViews(contracts);
|
|
750
752
|
const grantedViews = buildGrantedReferences(input.grants.views, "grants.views");
|
|
751
753
|
const grantedIntents = buildGrantedReferences(input.grants.intents, "grants.intents");
|
|
752
|
-
const knownIntents = buildKnownActionIntents(contracts, add, grantedIntents);
|
|
753
|
-
reportAmbiguousGrantedViews(contracts, grantedViews, add);
|
|
754
754
|
const contractNamespaces = /* @__PURE__ */ new Set();
|
|
755
|
-
|
|
755
|
+
const distinctContracts = contracts.filter((contract) => {
|
|
756
756
|
if (contractNamespaces.has(contract.namespace)) {
|
|
757
757
|
add(
|
|
758
758
|
"ambiguous_capability_reference",
|
|
759
759
|
`contracts.${contract.namespace}`,
|
|
760
760
|
`contract for "${contract.namespace}" is supplied more than once`
|
|
761
761
|
);
|
|
762
|
+
return false;
|
|
762
763
|
}
|
|
763
764
|
contractNamespaces.add(contract.namespace);
|
|
765
|
+
return true;
|
|
766
|
+
});
|
|
767
|
+
const knownIntents = buildKnownActionIntents(distinctContracts, add, grantedIntents);
|
|
768
|
+
reportAmbiguousGrantedViews(distinctContracts, grantedViews, add);
|
|
769
|
+
for (const reference of grantedViews) {
|
|
770
|
+
const parsed = parseCapabilityRef(reference);
|
|
771
|
+
if (parsed && !knownViews.has(`${parsed.namespace}/${parsed.name}`)) {
|
|
772
|
+
add(
|
|
773
|
+
"unauthorized_data_ref",
|
|
774
|
+
`grants.views.${reference}`,
|
|
775
|
+
`release grants "${reference}", which no supplied capability publishes; promotion would fail to route it`
|
|
776
|
+
);
|
|
777
|
+
}
|
|
778
|
+
}
|
|
779
|
+
for (const reference of grantedIntents) {
|
|
780
|
+
const parsed = parseCapabilityRef(reference);
|
|
781
|
+
if (parsed && !knownIntents.has(`${parsed.namespace}/${parsed.name}`)) {
|
|
782
|
+
add(
|
|
783
|
+
"mutation_bypass",
|
|
784
|
+
`grants.intents.${reference}`,
|
|
785
|
+
`release grants "${reference}", which no supplied capability declares as an intent; promotion would fail to route it`
|
|
786
|
+
);
|
|
787
|
+
}
|
|
764
788
|
}
|
|
765
789
|
validateIntentActionDeclarations(contracts, add);
|
|
766
790
|
const fragmentGrants = /* @__PURE__ */ new Map();
|