@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.
package/dist/index.cjs CHANGED
@@ -359,6 +359,7 @@ __export(index_exports, {
359
359
  isCapabilitySubset: () => isCapabilitySubset,
360
360
  isDigest: () => isDigest,
361
361
  isEvmAddress: () => isEvmAddress,
362
+ isExplicitOnlyAction: () => isExplicitOnlyAction,
362
363
  isNetworkId: () => import_sdk_services9.isNetworkId,
363
364
  isPlausibleOpenKeyActionId: () => isPlausibleOpenKeyActionId,
364
365
  isStorageFullError: () => import_sdk_services9.isStorageFullError,
@@ -8661,8 +8662,17 @@ function canonicalizeRecapCaveats(caveats) {
8661
8662
  }
8662
8663
  return `[${branches.join(",")}]`;
8663
8664
  }
8665
+ var EXPLICIT_ONLY_ACTIONS = {
8666
+ "tinycloud.kv/sync": true,
8667
+ "tinycloud.kv/retain": true
8668
+ };
8669
+ function isExplicitOnlyAction(action) {
8670
+ return Object.prototype.hasOwnProperty.call(EXPLICIT_ONLY_ACTIONS, action);
8671
+ }
8664
8672
  function actionContains(grantedAction, requestedAction) {
8665
- if (grantedAction === "*" || grantedAction === requestedAction) return true;
8673
+ if (grantedAction === requestedAction) return true;
8674
+ if (isExplicitOnlyAction(requestedAction)) return false;
8675
+ if (grantedAction === "*") return true;
8666
8676
  if (!grantedAction.endsWith("/*")) return false;
8667
8677
  const service = grantedAction.slice(0, -2);
8668
8678
  return requestedAction === service || requestedAction.startsWith(`${service}/`);
@@ -11345,7 +11355,9 @@ var SharingService = class {
11345
11355
  if (delegation.allowSubDelegation === false) continue;
11346
11356
  if (!this.pathMatches(delegation.path || "", path)) continue;
11347
11357
  const delegationActions = delegation.actions || [];
11348
- if (!actions.every((action) => delegationActions.includes(action) || delegationActions.includes("*"))) {
11358
+ if (!actions.every(
11359
+ (action) => delegationActions.some((granted) => actionContains(granted, action))
11360
+ )) {
11349
11361
  continue;
11350
11362
  }
11351
11363
  if ((delegation.caveats?.length ?? 0) > 0) {