mirror of
https://github.com/heygen-com/hyperframes.git
synced 2026-11-18 07:50:13 +00:00
* feat(cli): share rendered videos through unified reviews (#7135) * feat(share): attach editable project sources to reviews (#7137) * feat(share): measure local sharing outcomes (#7138) * feat(cli): stage the sixty-day publish transition (#7136) * feat(studio): share review pages from local preview (#7140) Advertise the CLI sharing bridge before bootstrapping it so standalone Studio does not request unsupported routes. Preserve origin and session checks. Budget the intended sharing artifact: clean main packs at 8,060,519 bytes versus 8,162,979 with sharing (8,169,168 in CI). Required policy and Unicode tables, bundled sharing code, and Studio controls account for the growth. Set the packed-only budget to 8,577,627, following the 5% headroom convention; retain the unpacked cap and all package checks. * fix(share): persist refusals and improve CLI retry feedback * fix(ci): restore render diagnostics and include sharing workspace * fix(cli): keep sharing owner error codes stable * fix(share): clarify update feedback and align audience changes * fix(share): clarify updates and avoid scratch-file rerenders * fix(cli): report active shares and preserve update channels * fix(cli): resolve update channel when checking registry * fix(ci): refresh sharing package budgets after rebase * fix(share): require consent before uploading project files
45 lines
2.4 KiB
TypeScript
45 lines
2.4 KiB
TypeScript
import { SourceIgnoreError, ownerOf, ReviewFailed, reviewSentence } from "@hyperframes/share";
|
|
import { ShareSourceError } from "./sources.js";
|
|
import { isAuthError } from "../auth/errors.js";
|
|
import { CliUsageError } from "../utils/commandResult.js";
|
|
|
|
const HINTS: Record<string, string> = {
|
|
review_upload_origins_required:
|
|
"Review video storage is not configured. Set HYPERFRAMES_REVIEW_UPLOAD_ORIGINS to the exact storage origins provided by your deployment.",
|
|
review_project_limit_reached:
|
|
"Your workspace has used its five free shared projects. Update an existing share, or manage and remove one to free a slot. Turning a link off does not free a slot.",
|
|
review_subscription_required:
|
|
"Workspace and invite-only sharing require a paid plan. On Free, choose --private (only you) or --public (anyone with the link), or upgrade your workspace plan.",
|
|
workspace_mismatch:
|
|
"This folder already shares into another workspace. Manage the existing share instead of changing its identity.",
|
|
review_binding_changed:
|
|
"The review linked to this folder changed. Run hyperframes share --status before trying again.",
|
|
manage_existing_audience:
|
|
"Manage this existing share to change its audience. Copying or updating a share preserves its settings.",
|
|
not_shared:
|
|
"This project has no shared review yet. Run hyperframes share with an explicit audience.",
|
|
};
|
|
export function shareError(error: unknown): { code: string; message: string; owner?: string } {
|
|
if (error instanceof SourceIgnoreError) return { code: error.code, message: error.message };
|
|
if (error instanceof CliUsageError) return { code: error.code, message: error.message };
|
|
if (error instanceof ShareSourceError)
|
|
return { code: "source_unavailable", message: error.message };
|
|
if (isAuthError(error))
|
|
return {
|
|
code: error.code.toLowerCase(),
|
|
message: `${error.message} ${error.hint ?? ""}`.trim(),
|
|
};
|
|
if (error instanceof ReviewFailed) {
|
|
const owner = error.status === 401 ? null : ownerOf(error.reason);
|
|
if (owner !== null) return { code: "owner_signed_out", owner, message: reviewSentence(error) };
|
|
return {
|
|
code: error.status === 401 ? "login_expired" : error.reason || "share_failed",
|
|
message: HINTS[error.reason] ?? reviewSentence(error),
|
|
};
|
|
}
|
|
return {
|
|
code: "share_failed",
|
|
message: error instanceof Error ? error.message : "Sharing failed. Try again.",
|
|
};
|
|
}
|