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

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
@@ -15284,6 +15284,14 @@ function shareCliError(error) {
15284
15284
  const localKey = "localKey" in failure && failure.localKey === true;
15285
15285
  const profileHint = profileName === void 0 ? "" : `--profile ${profileName} `;
15286
15286
  const loginHint = localKey ? `\`tc ${profileHint}auth login --method local\`` : `\`tc ${profileHint}auth login --device --manifest builtin:share-publishing\` (or \`tc ${profileHint}enable share\`)`;
15287
+ if (failure.kind === "caveated-session") {
15288
+ const holder = profileName === void 0 ? "this session" : `profile ${profileName}'s session`;
15289
+ return new CLIError(
15290
+ "PERMISSION_DENIED",
15291
+ `${holder} carries signed restrictions (caveats) on the authority an anyone-with-link share needs, so it cannot create the share link; nothing was shared. Approve Share publishing without restrictions on a new, dedicated profile (any unused name): \`tc init --name publisher --key-only && tc --profile publisher enable share\``,
15292
+ 5
15293
+ );
15294
+ }
15287
15295
  if (failure.kind === "owner-space-unresolved") {
15288
15296
  return new CLIError("AUTH_REQUIRED", `a valid signed TinyCloud session is required; run ${loginHint}`, 3);
15289
15297
  }
@@ -17194,6 +17202,15 @@ function createShareAuthorityAdapters(input = {}) {
17194
17202
  if (resourceKind !== "exact" || files.length !== 1) throw new Error("native bearer publication requires one exact source file");
17195
17203
  const file2 = files[0];
17196
17204
  const resourcePath2 = `xyz.tinycloud.share/shares/${shareId}/${safeStorageFilename(targetInput.filename)}`;
17205
+ if (node.isSessionOnly) {
17206
+ const authority = node.sharing.preflightGenerate({ path: resourcePath2, actions: ["tinycloud.kv/get"], expiry: expiresAt });
17207
+ if (authority === "caveated") {
17208
+ throw new SharePublishAuthorityError({ kind: "caveated-session", profileName: activeProfileName2 });
17209
+ }
17210
+ if (authority === "not-covered") {
17211
+ throw new SharePublishAuthorityError({ kind: "scope-denied", capability: "sharing delegation", localKey, profileName: activeProfileName2 });
17212
+ }
17213
+ }
17197
17214
  const written = await node.kvForSpace(ownerSpaceId).put(resourcePath2, file2.bytes.slice(), {
17198
17215
  contentType: targetInput.mediaType ?? file2.mediaType ?? "application/octet-stream"
17199
17216
  });