@tinycloud/cli 1.0.0-beta.21 → 1.0.0-beta.22

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.js CHANGED
@@ -14003,6 +14003,7 @@ function targetMatcher(target) {
14003
14003
  function targetKind(target) {
14004
14004
  return target.kind;
14005
14005
  }
14006
+ var OWNER_SHARE_ACTIONS = /* @__PURE__ */ new Set(["tinycloud.kv/get", "tinycloud.kv/list", "tinycloud.kv/metadata", "tinycloud.kv/put"]);
14006
14007
  function assertSafeInput(input) {
14007
14008
  if (!/^[A-Za-z0-9_-]{16,128}$/.test(input.shareId)) throw new TypeError("addressed share id is invalid");
14008
14009
  if (!Number.isSafeInteger(input.byteLength) || input.byteLength < 0 || input.byteLength > SHARE_CONTENT_LIMIT) throw new TypeError("addressed content length is invalid");
@@ -14126,12 +14127,12 @@ function prepareAddressedShare(request) {
14126
14127
  throw new TypeError("addressed filename is invalid");
14127
14128
  }
14128
14129
  if (request.actions.length === 0 || request.policyActions.length === 0) throw new TypeError("addressed share actions are empty");
14130
+ if (request.policyActions.some((action) => !OWNER_SHARE_ACTIONS.has(action))) throw new TypeError("addressed share action is not supported");
14129
14131
  const target = normalizeShareTarget(request.target);
14130
14132
  if (target.kind === "bearer") throw new TypeError("addressed target is required");
14131
14133
  if (target.kind === "recipientDid") return { target };
14132
- if (target.kind === "emailDomain") {
14133
- if (!request.actions.every((action) => action === "read" || action === "list") || !request.policyActions.every((action) => action === "tinycloud.kv/get" || action === "tinycloud.kv/list" || action === "tinycloud.kv/metadata")) throw new TypeError("email-domain shares are view-only");
14134
- if (request.deliveryEmail !== void 0) throw new TypeError("email-domain shares are not emailed");
14134
+ if (target.kind === "emailDomain" && request.deliveryEmail !== void 0 && (request.deliveryEmail !== request.deliveryEmail.toLowerCase() || !request.deliveryEmail.endsWith(`@${target.domain}`))) {
14135
+ throw new TypeError("email-domain delivery address must be a lowercase mailbox at the domain");
14135
14136
  }
14136
14137
  return { target, credentialRequirement: mailboxCredentialCommitment(target) };
14137
14138
  }