Files
hyperframes/packages/share/src/reviewAudience.mjs
T
terencechoandClaude Opus 5.5 f54b2227fd feat(share): extract shared review kernel for local hosts (#7134)
* feat(share): extract shared review kernel for local hosts

* fix: recover completed shares and integrate kernel checks

* fix: terminate ffprobe options before share media input

* fix: verify executable imports without matching JSDoc types

* build: budget the published sharing package

* fix: publish NodeNext-compatible sharing declarations

* fix: invalidate shared renders when linked media changes

* fix: reserve share progress before awaiting upload lock

* fix: copy share build inputs before image dependency install

* fix(share): preserve Desktop snapshots and support portable locks

* fix(share): restrict video uploads to trusted origins

* fix(share): preserve review state across recovery and uploads

* fix(share): preserve review title and feedback attribution

* fix(share): accept legacy review records safely

* build(share): update measured package size budget

* fix(share): preserve feedback cutoff across export retries

* docs(share): describe only the storage origins the signer uses

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-06 04:35:33 +00:00

25 lines
1.2 KiB
JavaScript

// @ts-check
import { ReviewFailed } from "./reviewClient.mjs";
/** @param {import("./types/reviewWire.js").ReviewEntitlements | null | undefined} entitlements
* @param {import("./types/share.js").AccessMode | undefined} chosen */
export function firstReviewAudience(entitlements, chosen) {
// An omitted field is the legacy server contract; explicit null is an unavailable read.
if (entitlements === undefined) return chosen ?? "team";
if (!entitlements) throw new ReviewFailed(503, "review_entitlement_unavailable");
const audience =
chosen ?? (entitlements.allowed_collaborative_access_modes.includes("team") ? "team" : null);
if (!audience)
throw new ReviewFailed(402, "review_public_consent_required", undefined, undefined, {
reason: "review_public_consent_required",
workspace_id: entitlements.workspace_id,
});
if (audience !== "private" && !entitlements.allowed_collaborative_access_modes.includes(audience))
throw new ReviewFailed(402, "review_subscription_required", undefined, undefined, {
reason: "review_subscription_required",
workspace_id: entitlements.workspace_id,
requested_feature: audience,
});
return audience;
}