Open source Loom alternative. Beautiful, shareable screen recordings.
Rust appcapcossloommacnextjsnextjs15open-sourceossreactrecordrustscreen-capturescreen-recorderscreenshotsolidjstauritauri-apptypescriptvite
feat(actions): resolve video operations against Storage backends
Richie McIlroye6a5c3f9a021
diff --git a/apps/web/actions/loom.ts b/apps/web/actions/loom.tsindex 9e435651c..90ea4ab96 100644--- a/apps/web/actions/loom.ts+++ b/apps/web/actions/loom.ts@@ -4,19 +4,17 @@ import { randomUUID } from "node:crypto";import { db } from "@cap/database";import { getCurrentUser } from "@cap/database/auth/session";import { nanoId } from "@cap/database/helpers";-import {- importedVideos,- s3Buckets,- videos,- videoUploads,-} from "@cap/database/schema";+import { importedVideos, videos, videoUploads } from "@cap/database/schema";import { buildEnv, NODE_ENV, serverEnv } from "@cap/env";import { dub, userIsPro } from "@cap/utils";+import { Storage } from "@cap/web-backend";import type { Organisation } from "@cap/web-domain";import { Video } from "@cap/web-domain";import { and, eq } from "drizzle-orm";+import { Option } from "effect";import { revalidatePath } from "next/cache";import { start } from "workflow/api";+import { runPromise } from "@/lib/server";import { importLoomVideoWorkflow } from "@/workflows/import-loom-video";interface LoomUrlResponse {@@ -297,10 +295,9 @@ export async function importFromLoom({fetchLoomOEmbed(loomVideoId),]);- const [customBucket] = await db()- .select()- .from(s3Buckets)- .where(eq(s3Buckets.ownerId, user.id));+ const writable = await Storage.getWritableAccessForUser(user.id).pipe(+ runPromise,+ );const videoId = Video.VideoId.make(nanoId());const name =@@ -315,7 +312,8 @@ export async function importFromLoom({ownerId: user.id,orgId,source: { type: "webMP4" as const },- bucket: customBucket?.id,+ bucket: Option.getOrNull(writable.bucketId),+ storageIntegrationId: Option.getOrNull(writable.storageIntegrationId),public: serverEnv().CAP_VIDEOS_DEFAULT_PUBLIC,...(oembedMeta?.duration ? { duration: oembedMeta.duration } : {}),...(oembedMeta?.width ? { width: oembedMeta.width } : {}),@@ -353,7 +351,7 @@ export async function importFromLoom({videoId,userId: user.id,rawFileKey,- bucketId: customBucket?.id ?? null,+ bucketId: Option.getOrNull(writable.bucketId),loomDownloadUrl: downloadUrl,loomVideoId,},diff --git a/apps/web/actions/video/create-for-processing.ts b/apps/web/actions/video/create-for-processing.tsindex a2a6776f6..3bcc07857 100644--- a/apps/web/actions/video/create-for-processing.ts+++ b/apps/web/actions/video/create-for-processing.ts@@ -3,18 +3,17 @@import { db } from "@cap/database";import { getCurrentUser } from "@cap/database/auth/session";import { nanoId } from "@cap/database/helpers";-import { s3Buckets, videos, videoUploads } from "@cap/database/schema";+import { videos, videoUploads } from "@cap/database/schema";import { buildEnv, NODE_ENV, serverEnv } from "@cap/env";import { dub, userIsPro } from "@cap/utils";-import { S3Buckets } from "@cap/web-backend";+import { Storage as StorageService } from "@cap/web-backend";import {type Folder,type Organisation,- S3Bucket,+ type Storage,Video,} from "@cap/web-domain";-import { eq } from "drizzle-orm";-import { Effect, Option } from "effect";+import { Option } from "effect";import { revalidatePath } from "next/cache";import { runPromise } from "@/lib/server";@@ -22,10 +21,12 @@ export interface CreateForProcessingResult {id: Video.VideoId;rawFileKey: string;bucketId: string | null;+ storageIntegrationId: string | null;+ uploadTarget: Storage.UploadTarget;presignedPostData: {url: string;fields: Record<string, string>;- };+ } | null;}export async function createVideoForServerProcessing({@@ -47,11 +48,6 @@ export async function createVideoForServerProcessing({throw new Error("upgrade_required");}- const [customBucket] = await db()- .select()- .from(s3Buckets)- .where(eq(s3Buckets.ownerId, user.id));-const videoId = Video.VideoId.make(nanoId());const date = new Date();@@ -59,6 +55,21 @@ export async function createVideoForServerProcessing({month: "long",})} ${date.getFullYear()}`;+ const rawFileKey = `${user.id}/${videoId}/raw-upload.mp4`;++ const uploadResult = await StorageService.createUploadTargetForUser(+ user.id,+ rawFileKey,+ {+ contentType: "video/mp4",+ fields: {+ "x-amz-meta-userid": user.id,+ "x-amz-meta-duration": duration?.toString() ?? "",+ "x-amz-meta-resolution": resolution ?? "",+ },+ },+ ).pipe(runPromise);+await db().insert(videos).values({@@ -67,7 +78,8 @@ export async function createVideoForServerProcessing({ownerId: user.id,orgId,source: { type: "webMP4" as const },- bucket: customBucket?.id,+ bucket: Option.getOrNull(uploadResult.bucketId),+ storageIntegrationId: Option.getOrNull(uploadResult.storageIntegrationId),public: serverEnv().CAP_VIDEOS_DEFAULT_PUBLIC,...(folderId ? { folderId } : {}),});@@ -78,26 +90,6 @@ export async function createVideoForServerProcessing({processingProgress: 0,});- const rawFileKey = `${user.id}/${videoId}/raw-upload.mp4`;-- const bucketIdOption = Option.fromNullable(customBucket?.id).pipe(- Option.map((id) => S3Bucket.S3BucketId.make(id)),- );-- const presignedPostData = await Effect.gen(function* () {- const [bucket] = yield* S3Buckets.getBucketAccess(bucketIdOption);-- return yield* bucket.getPresignedPostUrl(rawFileKey, {- Fields: {- "Content-Type": "video/mp4",- "x-amz-meta-userid": user.id,- "x-amz-meta-duration": duration?.toString() ?? "",- "x-amz-meta-resolution": resolution ?? "",- },- Expires: 3600,- });- }).pipe(runPromise);-if (buildEnv.NEXT_PUBLIC_IS_CAP && NODE_ENV === "production") {await dub().links.create({@@ -117,7 +109,15 @@ export async function createVideoForServerProcessing({return {id: videoId,rawFileKey,- bucketId: customBucket?.id ?? null,- presignedPostData,+ bucketId: Option.getOrNull(uploadResult.bucketId),+ storageIntegrationId: Option.getOrNull(uploadResult.storageIntegrationId),+ uploadTarget: uploadResult.upload,+ presignedPostData:+ uploadResult.upload.type === "s3Post"+ ? {+ url: uploadResult.upload.url,+ fields: uploadResult.upload.fields,+ }+ : null,};}diff --git a/apps/web/actions/video/upload.ts b/apps/web/actions/video/upload.tsindex 040a5aca2..d749399f9 100644--- a/apps/web/actions/video/upload.ts+++ b/apps/web/actions/video/upload.ts@@ -3,14 +3,14 @@import { db } from "@cap/database";import { getCurrentUser } from "@cap/database/auth/session";import { nanoId } from "@cap/database/helpers";-import { s3Buckets, videos, videoUploads } from "@cap/database/schema";+import { videos, videoUploads } from "@cap/database/schema";import { buildEnv, NODE_ENV, serverEnv } from "@cap/env";import { dub, userIsPro } from "@cap/utils";-import { S3Buckets } from "@cap/web-backend";+import { Storage as StorageService } from "@cap/web-backend";import {type Folder,type Organisation,- S3Bucket,+ type User,Video,} from "@cap/web-domain";import { eq } from "drizzle-orm";@@ -27,7 +27,7 @@ async function getVideoUploadPresignedUrl({resolution,videoCodec,audioCodec,- bucketId,+ video,userId,}: {fileKey: string;@@ -35,14 +35,10 @@ async function getVideoUploadPresignedUrl({resolution?: string;videoCodec?: string;audioCodec?: string;- bucketId: string | undefined;- userId: string;+ video?: Video.Video;+ userId: User.UserId;}) {try {- const bucketIdOption = Option.fromNullable(bucketId).pipe(- Option.map((id) => S3Bucket.S3BucketId.make(id)),- );-const contentType = fileKey.endsWith(".aac")? "audio/aac": fileKey.endsWith(".webm")@@ -56,7 +52,6 @@ async function getVideoUploadPresignedUrl({: "video/mp2t";const Fields = {- "Content-Type": contentType,"x-amz-meta-userid": userId,"x-amz-meta-duration": duration ?? "","x-amz-meta-resolution": resolution ?? "",@@ -64,16 +59,36 @@ async function getVideoUploadPresignedUrl({"x-amz-meta-audiocodec": audioCodec ?? "",};- const presignedPostData = await Effect.gen(function* () {- const [bucket] = yield* S3Buckets.getBucketAccess(bucketIdOption);+ const result = await Effect.gen(function* () {+ if (video) {+ const upload = yield* StorageService.createUploadTargetForVideo(+ video,+ fileKey,+ {+ contentType,+ fields: Fields,+ },+ );+ return {+ upload,+ bucketId: video.bucketId,+ storageIntegrationId: video.storageIntegrationId,+ };+ }- return yield* bucket.getPresignedPostUrl(fileKey, {- Fields,- Expires: 1800,+ return yield* StorageService.createUploadTargetForUser(userId, fileKey, {+ contentType,+ fields: Fields,});}).pipe(runPromise);- return { presignedPostData };+ return {+ ...result,+ presignedPostData:+ result.upload.type === "s3Post"+ ? { url: result.upload.url, fields: result.upload.fields }+ : null,+ };} catch (error) {console.error("Error getting presigned URL:", error);throw new Error(@@ -114,11 +129,6 @@ export async function createVideoAndGetUploadUrl({if (!userIsPro(user) && duration && duration > 300)throw new Error("upgrade_required");- const [customBucket] = await db()- .select()- .from(s3Buckets)- .where(eq(s3Buckets.ownerId, user.id));-const date = new Date();const formattedDate = `${date.getDate()} ${date.toLocaleString("default", {month: "long",@@ -131,28 +141,50 @@ export async function createVideoAndGetUploadUrl({.where(eq(videos.id, videoId));if (existingVideo) {+ const existingVideoDomain = Video.Video.decodeSync({+ ...existingVideo,+ bucketId: existingVideo.bucket,+ storageIntegrationId: existingVideo.storageIntegrationId,+ createdAt: existingVideo.createdAt.toISOString(),+ updatedAt: existingVideo.updatedAt.toISOString(),+ metadata: existingVideo.metadata,+ });const fileKey = `${user.id}/${videoId}/${isScreenshot ? "screenshot/screen-capture.jpg" : "result.mp4"}`;- const { presignedPostData } = await getVideoUploadPresignedUrl({+ const { presignedPostData, upload } = await getVideoUploadPresignedUrl({fileKey,duration: duration?.toString(),resolution,videoCodec,audioCodec,- bucketId: existingVideo.bucket ?? customBucket?.id,+ video: existingVideoDomain,userId: user.id,});return {id: existingVideo.id,presignedPostData,+ uploadTarget: upload,};}}const idToUse = Video.VideoId.make(videoId || nanoId());+ const fileKey = `${user.id}/${idToUse}/${+ isScreenshot ? "screenshot/screen-capture.jpg" : "result.mp4"+ }`;+ const { presignedPostData, upload, bucketId, storageIntegrationId } =+ await getVideoUploadPresignedUrl({+ fileKey,+ duration: duration?.toString(),+ resolution,+ videoCodec,+ audioCodec,+ userId: user.id,+ });+const videoData = {id: idToUse,name: `Cap ${@@ -162,7 +194,8 @@ export async function createVideoAndGetUploadUrl({orgId,source: { type: "webMP4" as const },isScreenshot,- bucket: customBucket?.id,+ bucket: Option.getOrNull(bucketId),+ storageIntegrationId: Option.getOrNull(storageIntegrationId),public: serverEnv().CAP_VIDEOS_DEFAULT_PUBLIC,...(folderId ? { folderId } : {}),};@@ -174,19 +207,6 @@ export async function createVideoAndGetUploadUrl({videoId: idToUse,});- const fileKey = `${user.id}/${idToUse}/${- isScreenshot ? "screenshot/screen-capture.jpg" : "result.mp4"- }`;- const { presignedPostData } = await getVideoUploadPresignedUrl({- fileKey,- duration: duration?.toString(),- resolution,- videoCodec,- audioCodec,- bucketId: customBucket?.id,- userId: user.id,- });-if (buildEnv.NEXT_PUBLIC_IS_CAP && NODE_ENV === "production") {await dub().links.create({@@ -206,6 +226,7 @@ export async function createVideoAndGetUploadUrl({return {id: idToUse,presignedPostData,+ uploadTarget: upload,};} catch (error) {console.error("Error creating video and getting upload URL:", error);@@ -225,25 +246,27 @@ export async function deleteVideoResultFile({if (!user) throw new Error("Unauthorized");const [video] = await db()- .select({- id: videos.id,- ownerId: videos.ownerId,- bucketId: videos.bucket,- })+ .select().from(videos).where(eq(videos.id, videoId));if (!video) throw new Error("Video not found");if (video.ownerId !== user.id) throw new Error("Forbidden");- const bucketIdOption = Option.fromNullable(video.bucketId).pipe(- Option.map((id) => S3Bucket.S3BucketId.make(id)),- );+ const videoDomain = Video.Video.decodeSync({+ ...video,+ bucketId: video.bucket,+ storageIntegrationId: video.storageIntegrationId,+ createdAt: video.createdAt.toISOString(),+ updatedAt: video.updatedAt.toISOString(),+ metadata: video.metadata,+ });const fileKey = `${video.ownerId}/${video.id}/result.mp4`;const logContext = {videoId: video.id,ownerId: video.ownerId,- bucketId: video.bucketId ?? null,+ bucketId: video.bucket ?? null,+ storageIntegrationId: video.storageIntegrationId ?? null,fileKey,};@@ -261,7 +284,7 @@ export async function deleteVideoResultFile({try {await deleteResultObjectWithRetry({- bucketIdOption,+ video: videoDomain,fileKey,logContext,});@@ -282,16 +305,17 @@ export async function deleteVideoResultFile({}async function deleteResultObjectWithRetry({- bucketIdOption,+ video,fileKey,logContext,}: {- bucketIdOption: Option.Option<S3Bucket.S3BucketId>;+ video: Video.Video;fileKey: string;logContext: {videoId: Video.VideoId;ownerId: string;bucketId: string | null;+ storageIntegrationId: string | null;fileKey: string;};}) {@@ -301,7 +325,7 @@ async function deleteResultObjectWithRetry({attempt += 1;try {await Effect.gen(function* () {- const [bucket] = yield* S3Buckets.getBucketAccess(bucketIdOption);+ const [bucket] = yield* StorageService.getAccessForVideo(video);yield* bucket.deleteObject(fileKey);}).pipe(runPromise);return;diff --git a/apps/web/actions/videos/download.ts b/apps/web/actions/videos/download.tsindex 13acff323..902bbd4db 100644--- a/apps/web/actions/videos/download.ts+++ b/apps/web/actions/videos/download.ts@@ -3,11 +3,12 @@import { db } from "@cap/database";import { getCurrentUser } from "@cap/database/auth/session";import { videos } from "@cap/database/schema";-import { S3Buckets } from "@cap/web-backend";+import { Storage } from "@cap/web-backend";import type { Video } from "@cap/web-domain";import { eq } from "drizzle-orm";-import { Effect, Option } from "effect";+import { Effect } from "effect";import { runPromise } from "@/lib/server";+import { decodeStorageVideo } from "@/lib/video-storage";export async function downloadVideo(videoId: Video.VideoId) {const user = await getCurrentUser();@@ -36,8 +37,8 @@ export async function downloadVideo(videoId: Video.VideoId) {const videoKey = `${video.ownerId}/${videoId}/result.mp4`;const downloadUrl = await Effect.gen(function* () {- const [bucket] = yield* S3Buckets.getBucketAccess(- Option.fromNullable(video.bucket),+ const [bucket] = yield* Storage.getAccessForVideo(+ decodeStorageVideo(video),);return yield* bucket.getSignedObjectUrl(videoKey);}).pipe(runPromise);diff --git a/apps/web/actions/videos/edit-transcript.ts b/apps/web/actions/videos/edit-transcript.tsindex c6dcb9465..32ad3b622 100644--- a/apps/web/actions/videos/edit-transcript.ts+++ b/apps/web/actions/videos/edit-transcript.ts@@ -2,13 +2,14 @@import { db } from "@cap/database";import { getCurrentUser } from "@cap/database/auth/session";-import { s3Buckets, videos } from "@cap/database/schema";-import { S3Buckets } from "@cap/web-backend";+import { videos } from "@cap/database/schema";+import { Storage } from "@cap/web-backend";import type { Video } from "@cap/web-domain";import { eq } from "drizzle-orm";import { Option } from "effect";import { revalidatePath } from "next/cache";import { runPromise } from "@/lib/server";+import { decodeStorageVideo } from "@/lib/video-storage";export async function editTranscriptEntry(videoId: Video.VideoId,@@ -26,12 +27,8 @@ export async function editTranscriptEntry(const userId = user.id;const query = await db()- .select({- video: videos,- bucket: s3Buckets,- })+ .select({ video: videos }).from(videos)- .leftJoin(s3Buckets, eq(videos.bucket, s3Buckets.id)).where(eq(videos.id, videoId));if (query.length === 0) {@@ -52,8 +49,8 @@ export async function editTranscriptEntry(};}- const [bucket] = await S3Buckets.getBucketAccess(- Option.fromNullable(result.bucket?.id),+ const [bucket] = await Storage.getAccessForVideo(+ decodeStorageVideo(video),).pipe(runPromise);try {diff --git a/apps/web/actions/videos/get-available-translations.ts b/apps/web/actions/videos/get-available-translations.tsindex db9784018..e4c6f1308 100644--- a/apps/web/actions/videos/get-available-translations.ts+++ b/apps/web/actions/videos/get-available-translations.ts@@ -1,12 +1,13 @@"use server";import { db } from "@cap/database";-import { s3Buckets, videos } from "@cap/database/schema";-import { S3Buckets } from "@cap/web-backend";+import { videos } from "@cap/database/schema";+import { Storage } from "@cap/web-backend";import type { Video } from "@cap/web-domain";import { eq } from "drizzle-orm";-import { Effect, Option } from "effect";+import { Effect } from "effect";import { runPromise } from "@/lib/server";+import { decodeStorageVideo } from "@/lib/video-storage";import {type LanguageCode,SUPPORTED_LANGUAGES,@@ -37,12 +38,8 @@ export async function getAvailableTranslations(}const query = await db()- .select({- video: videos,- bucket: s3Buckets,- })+ .select({ video: videos }).from(videos)- .leftJoin(s3Buckets, eq(videos.bucket, s3Buckets.id)).where(eq(videos.id, videoId));if (query.length === 0 || !query[0]?.video) {@@ -59,8 +56,8 @@ export async function getAvailableTranslations(try {const result = await Effect.gen(function* () {- const [bucket] = yield* S3Buckets.getBucketAccess(- Option.fromNullable(query[0]?.bucket?.id),+ const [bucket] = yield* Storage.getAccessForVideo(+ decodeStorageVideo(video),);const listResult = yield* bucket.listObjects({diff --git a/apps/web/actions/videos/get-og-image.tsx b/apps/web/actions/videos/get-og-image.tsxindex cc10ffac5..468458faf 100644--- a/apps/web/actions/videos/get-og-image.tsx+++ b/apps/web/actions/videos/get-og-image.tsx@@ -1,11 +1,12 @@import { db } from "@cap/database";-import { s3Buckets, videos } from "@cap/database/schema";-import { S3Buckets } from "@cap/web-backend";+import { videos } from "@cap/database/schema";+import { Storage } from "@cap/web-backend";import type { Video } from "@cap/web-domain";import { eq } from "drizzle-orm";-import { Effect, Option } from "effect";+import { Effect } from "effect";import { ImageResponse } from "next/og";import { runPromise } from "@/lib/server";+import { decodeStorageVideo } from "@/lib/video-storage";export async function generateVideoOgImage(videoId: Video.VideoId) {const videoData = await getData(videoId);@@ -65,8 +66,8 @@ export async function generateVideoOgImage(videoId: Video.VideoId) {try {await Effect.gen(function* () {- const [bucket] = yield* S3Buckets.getBucketAccess(- Option.fromNullable(videoData.bucket?.id),+ const [bucket] = yield* Storage.getAccessForVideo(+ decodeStorageVideo(video),);screenshotUrl = yield* bucket.getSignedObjectUrl(screenshotKey);@@ -127,20 +128,22 @@ export async function generateVideoOgImage(videoId: Video.VideoId) {strokeLinecap="round"strokeLinejoin="round">+ <title>Play</title><polygon points="6 3 20 12 6 21 6 3"></polygon></svg></div>{screenshotUrl && (- <img+ <divstyle={{width: "100%",height: "100%",position: "absolute",- objectFit: "cover",+ backgroundImage: `url(${screenshotUrl})`,+ backgroundPosition: "center",+ backgroundSize: "cover",opacity: 0.4,zIndex: 1,}}- src={screenshotUrl}/>)}</div>@@ -154,12 +157,8 @@ export async function generateVideoOgImage(videoId: Video.VideoId) {async function getData(videoId: Video.VideoId) {const query = await db()- .select({- video: videos,- bucket: s3Buckets,- })+ .select({ video: videos }).from(videos)- .leftJoin(s3Buckets, eq(videos.bucket, s3Buckets.id)).where(eq(videos.id, videoId));const result = query[0];@@ -168,6 +167,5 @@ async function getData(videoId: Video.VideoId) {return {video: result.video,- bucket: result.bucket,};}diff --git a/apps/web/actions/videos/get-transcript.ts b/apps/web/actions/videos/get-transcript.tsindex 90b910f7d..d957b0767 100644--- a/apps/web/actions/videos/get-transcript.ts+++ b/apps/web/actions/videos/get-transcript.ts@@ -2,12 +2,13 @@import { db } from "@cap/database";import { getCurrentUser } from "@cap/database/auth/session";-import { s3Buckets, videos } from "@cap/database/schema";-import { S3Buckets } from "@cap/web-backend";+import { videos } from "@cap/database/schema";+import { Storage } from "@cap/web-backend";import type { Video } from "@cap/web-domain";import { eq } from "drizzle-orm";import { Effect, Option } from "effect";import { runPromise } from "@/lib/server";+import { decodeStorageVideo } from "@/lib/video-storage";export async function getTranscript(videoId: Video.VideoId,@@ -22,12 +23,8 @@ export async function getTranscript(}const query = await db()- .select({- video: videos,- bucket: s3Buckets,- })+ .select({ video: videos }).from(videos)- .leftJoin(s3Buckets, eq(videos.bucket, s3Buckets.id)).where(eq(videos.id, videoId));if (query.length === 0) {@@ -50,8 +47,8 @@ export async function getTranscript(try {const vttContent = await Effect.gen(function* () {- const [bucket] = yield* S3Buckets.getBucketAccess(- Option.fromNullable(result.bucket?.id),+ const [bucket] = yield* Storage.getAccessForVideo(+ decodeStorageVideo(video),);return yield* bucket.getObject(diff --git a/apps/web/actions/videos/translate-transcript.ts b/apps/web/actions/videos/translate-transcript.tsindex c52b4e53d..7ca24d4a1 100644--- a/apps/web/actions/videos/translate-transcript.ts+++ b/apps/web/actions/videos/translate-transcript.ts@@ -1,13 +1,14 @@"use server";import { db } from "@cap/database";-import { s3Buckets, videos } from "@cap/database/schema";-import { S3Buckets } from "@cap/web-backend";+import { videos } from "@cap/database/schema";+import { Storage } from "@cap/web-backend";import type { Video } from "@cap/web-domain";import { eq } from "drizzle-orm";import { Effect, Option } from "effect";import { GROQ_MODEL, getGroqClient } from "@/lib/groq-client";import { runPromise } from "@/lib/server";+import { decodeStorageVideo } from "@/lib/video-storage";import {type LanguageCode,SUPPORTED_LANGUAGES,@@ -46,12 +47,8 @@ export async function translateTranscript(}const query = await db()- .select({- video: videos,- bucket: s3Buckets,- })+ .select({ video: videos }).from(videos)- .leftJoin(s3Buckets, eq(videos.bucket, s3Buckets.id)).where(eq(videos.id, videoId));if (query.length === 0 || !query[0]?.video) {@@ -64,8 +61,8 @@ export async function translateTranscript(try {const existingTranslation = await Effect.gen(function* () {- const [bucket] = yield* S3Buckets.getBucketAccess(- Option.fromNullable(query[0]?.bucket?.id),+ const [bucket] = yield* Storage.getAccessForVideo(+ decodeStorageVideo(video),);return yield* bucket.getObject(translatedKey);}).pipe(runPromise);@@ -82,8 +79,8 @@ export async function translateTranscript(}const originalVtt = await Effect.gen(function* () {- const [bucket] = yield* S3Buckets.getBucketAccess(- Option.fromNullable(query[0]?.bucket?.id),+ const [bucket] = yield* Storage.getAccessForVideo(+ decodeStorageVideo(video),);return yield* bucket.getObject(`${video.ownerId}/${videoId}/transcription.vtt`,@@ -106,8 +103,8 @@ export async function translateTranscript(try {await Effect.gen(function* () {- const [bucket] = yield* S3Buckets.getBucketAccess(- Option.fromNullable(query[0]?.bucket?.id),+ const [bucket] = yield* Storage.getAccessForVideo(+ decodeStorageVideo(video),);yield* bucket.putObject(translatedKey, translatedVtt, {contentType: "text/vtt",