@tinycloud/sdk-core 3.1.0-beta.7 → 3.1.0-beta.9

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.
@@ -1396,8 +1396,17 @@ function canonicalizeRecapCaveats(caveats) {
1396
1396
  }
1397
1397
  return `[${branches.join(",")}]`;
1398
1398
  }
1399
+ var EXPLICIT_ONLY_ACTIONS = {
1400
+ "tinycloud.kv/sync": true,
1401
+ "tinycloud.kv/retain": true
1402
+ };
1403
+ function isExplicitOnlyAction(action) {
1404
+ return Object.prototype.hasOwnProperty.call(EXPLICIT_ONLY_ACTIONS, action);
1405
+ }
1399
1406
  function actionContains(grantedAction, requestedAction) {
1400
- if (grantedAction === "*" || grantedAction === requestedAction) return true;
1407
+ if (grantedAction === requestedAction) return true;
1408
+ if (isExplicitOnlyAction(requestedAction)) return false;
1409
+ if (grantedAction === "*") return true;
1401
1410
  if (!grantedAction.endsWith("/*")) return false;
1402
1411
  const service = grantedAction.slice(0, -2);
1403
1412
  return requestedAction === service || requestedAction.startsWith(`${service}/`);
@@ -5633,7 +5642,9 @@ var SharingService = class {
5633
5642
  if (delegation.allowSubDelegation === false) continue;
5634
5643
  if (!this.pathMatches(delegation.path || "", path)) continue;
5635
5644
  const delegationActions = delegation.actions || [];
5636
- if (!actions.every((action) => delegationActions.includes(action) || delegationActions.includes("*"))) {
5645
+ if (!actions.every(
5646
+ (action) => delegationActions.some((granted) => actionContains(granted, action))
5647
+ )) {
5637
5648
  continue;
5638
5649
  }
5639
5650
  if ((delegation.caveats?.length ?? 0) > 0) {