@tinycloud/operations 0.7.7-beta.12 → 0.7.7-beta.14

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.
@@ -1048,12 +1048,13 @@ function expandActionShortNames(service, actions) {
1048
1048
  return `${service}/${a}`;
1049
1049
  });
1050
1050
  }
1051
- var import_ms, import_sdk_services, DEFAULT_MANIFEST_SPACE, SERVICE_SHORT_TO_LONG, SERVICE_LONG_TO_SHORT, KEY_SEGMENT, KEY_APP_ID, KEY_PATH;
1051
+ var import_ms, import_sdk_services, import_resource, DEFAULT_MANIFEST_SPACE, SERVICE_SHORT_TO_LONG, SERVICE_LONG_TO_SHORT, KEY_SEGMENT, KEY_APP_ID, KEY_PATH;
1052
1052
  var init_manifest = __esm({
1053
1053
  "../sdk-core/src/manifest.ts"() {
1054
1054
  "use strict";
1055
1055
  import_ms = __toESM(require_ms(), 1);
1056
1056
  import_sdk_services = require("@tinycloud/sdk-services");
1057
+ import_resource = require("@tinycloud/sdk-services/encryption/resource");
1057
1058
  DEFAULT_MANIFEST_SPACE = "applications";
1058
1059
  SERVICE_SHORT_TO_LONG = Object.freeze({
1059
1060
  kv: "tinycloud.kv",
@@ -1100,10 +1101,9 @@ function isCapabilitySubset(requested, granted) {
1100
1101
  const grantedActions = matchingScope.flatMap(
1101
1102
  (entry) => expandActionShortNames(entry.service, entry.actions)
1102
1103
  );
1104
+ const namedKeyRequest = req.service === "tinycloud.encryption" && req.path.startsWith("urn:tinycloud:encryption:") && req.path.includes("/");
1103
1105
  const covered = requestedActions.every(
1104
- (requestedAction) => grantedActions.some(
1105
- (grantedAction) => actionContains(grantedAction, requestedAction)
1106
- )
1106
+ (requestedAction) => grantedActions.some((grantedAction) => namedKeyRequest ? grantedAction === requestedAction : actionContains(grantedAction, requestedAction))
1107
1107
  );
1108
1108
  if (!covered) {
1109
1109
  missing.push(cloneEntry(req));
@@ -1118,7 +1118,9 @@ function canonicalizeEntryScopeMatches(requested, granted) {
1118
1118
  if (normalizeSpace(requested.space ?? DEFAULT_MANIFEST_SPACE) !== normalizeSpace(granted.space ?? DEFAULT_MANIFEST_SPACE)) {
1119
1119
  return false;
1120
1120
  }
1121
- if (!pathContains(granted.path, requested.path)) {
1121
+ const namedKeyRequest = requested.service === "tinycloud.encryption" && requested.path.startsWith("urn:tinycloud:encryption:") && requested.path.includes("/");
1122
+ const coveredPath = namedKeyRequest ? (0, import_resource2.encryptionResourceContains)(granted.path, requested.path) : pathContains(granted.path, requested.path);
1123
+ if (!coveredPath) {
1122
1124
  return false;
1123
1125
  }
1124
1126
  if (!recapCaveatsEqual(requested.caveats, granted.caveats)) {
@@ -1188,11 +1190,12 @@ function cloneEntry(entry) {
1188
1190
  ...entry.expiry !== void 0 ? { expiry: entry.expiry } : {}
1189
1191
  };
1190
1192
  }
1191
- var EXPLICIT_ONLY_ACTIONS;
1193
+ var import_resource2, EXPLICIT_ONLY_ACTIONS;
1192
1194
  var init_capabilities = __esm({
1193
1195
  "../sdk-core/src/capabilities.ts"() {
1194
1196
  "use strict";
1195
1197
  init_manifest();
1198
+ import_resource2 = require("@tinycloud/sdk-services/encryption/resource");
1196
1199
  EXPLICIT_ONLY_ACTIONS = {
1197
1200
  "tinycloud.kv/sync": true,
1198
1201
  "tinycloud.kv/retain": true