From 25a5e50c979a69a039918f9cef64c6bd876e9544 Mon Sep 17 00:00:00 2001 From: Richie McIlroy <33632126+richiemcilroy@users.noreply.github.com> Date: Thu, 7 May 2026 11:57:41 +0100 Subject: [PATCH 01/70] feat(web-domain): add Storage schemas and upload target models --- packages/web-domain/src/Storage.ts | 77 ++++++++++++++++++++++++++++++ 1 file changed, 77 insertions(+) create mode 100644 packages/web-domain/src/Storage.ts diff --git a/packages/web-domain/src/Storage.ts b/packages/web-domain/src/Storage.ts new file mode 100644 index 0000000000..21ebcaae74 --- /dev/null +++ b/packages/web-domain/src/Storage.ts @@ -0,0 +1,77 @@ +import { Schema } from "effect"; +import { UserId } from "./User.ts"; +import type { VideoId } from "./Video.ts"; + +export const StorageIntegrationId = Schema.String.pipe( + Schema.brand("StorageIntegrationId"), +); +export type StorageIntegrationId = typeof StorageIntegrationId.Type; + +export const StorageObjectId = Schema.String.pipe( + Schema.brand("StorageObjectId"), +); +export type StorageObjectId = typeof StorageObjectId.Type; + +export const StorageProvider = Schema.Literal("googleDrive"); +export type StorageProvider = typeof StorageProvider.Type; + +export const StorageIntegrationStatus = Schema.Literal( + "active", + "error", + "disconnected", +); +export type StorageIntegrationStatus = typeof StorageIntegrationStatus.Type; + +export class StorageIntegration extends Schema.Class( + "StorageIntegration", +)({ + id: StorageIntegrationId, + ownerId: UserId, + provider: StorageProvider, + displayName: Schema.String, + status: StorageIntegrationStatus, + active: Schema.Boolean, +}) {} + +export const S3PostUploadTarget = Schema.Struct({ + type: Schema.Literal("s3Post"), + url: Schema.String, + fields: Schema.Record({ key: Schema.String, value: Schema.String }), +}); + +export const PutUploadTarget = Schema.Struct({ + type: Schema.Literal("put"), + url: Schema.String, + headers: Schema.Record({ key: Schema.String, value: Schema.String }), +}); + +export const DriveResumableUploadTarget = Schema.Struct({ + type: Schema.Literal("driveResumable"), + url: Schema.String, + headers: Schema.Record({ key: Schema.String, value: Schema.String }), +}); + +export const UploadTarget = Schema.Union( + S3PostUploadTarget, + PutUploadTarget, + DriveResumableUploadTarget, +); +export type UploadTarget = typeof UploadTarget.Type; + +export class StorageError extends Schema.TaggedError()( + "StorageError", + { + cause: Schema.Unknown, + }, +) {} + +export type StorageObjectMetadata = { + videoId?: VideoId; + fileName?: string; + contentType?: string; + duration?: string; + bandwidth?: string; + resolution?: string; + videocodec?: string; + audiocodec?: string; +}; From 57b53950271c906f2a965c586619d571aa134f61 Mon Sep 17 00:00:00 2001 From: Richie McIlroy <33632126+richiemcilroy@users.noreply.github.com> Date: Thu, 7 May 2026 11:57:41 +0100 Subject: [PATCH 02/70] feat(web-domain): attach storage integration metadata to Video --- packages/web-domain/src/Video.ts | 4 +++- packages/web-domain/src/index.ts | 2 ++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/web-domain/src/Video.ts b/packages/web-domain/src/Video.ts index 9800867a0b..46ae238508 100644 --- a/packages/web-domain/src/Video.ts +++ b/packages/web-domain/src/Video.ts @@ -7,6 +7,7 @@ import { FolderId } from "./Folder.ts"; import { OrganisationId } from "./Organisation.ts"; import { PolicyDeniedError } from "./Policy.ts"; import { S3BucketId } from "./S3Bucket.ts"; +import { StorageIntegrationId, UploadTarget } from "./Storage.ts"; import { UserId } from "./User.ts"; export const VideoId = Schema.String.pipe(Schema.brand("VideoId")); @@ -32,6 +33,7 @@ export class Video extends Schema.Class