Skip to the content.

Class and domain model

Structural TypeScript ports are shown as UML interfaces; domain records are type aliases, not runtime classes. Nullable fields and nonessential members are abbreviated. Entity arrows are logical references, not a claim of SQL foreign keys: only media_children.asset_id declares a foreign key in SCHEMA. Audit entityId/correlationId are loose references. SQLite additionally stores name reservations keyed by tenant/kind/name and migrates legacy blob_key/path columns. Dynamo uses ASSET#, CHILD#, JOB#, ENTITY#/AUDIT#, NAME# and CHILDLOOKUP# records plus tenant/kind and all-tenant asset indexes.

Legend: all drawn relationships are source-verified; branches are conditional execution paths. No inferred service is drawn.

classDiagram
  class MediaLibrary {
    ingest(input)
    registerRemoteAsset(input)
    materializeChild(assetId, role, recipe, options)
    runMaterializeJob(jobId)
    updateAssetMeta(id, meta)
    deleteAsset(id)
  }
  class CatalogStore {
    <<interface>>
    insertAsset(asset)
    listChildren(assetId)
    deleteAssetCascade(assetId)
  }
  class BlobStore {
    <<interface>>
    put(key, data, options)
    get(key)
    delete(key)
  }
  class JobStore {
    <<interface>>
    claimQueuedJob(jobId, claimed)
    finalizeRunningJob(jobId, expectedStartedAt, next)
  }
  class AuditStore {
    <<interface>>
    append(event)
  }
  class MediaAsset {
    <<type>>
    string id
    MediaTenant tenant
    MediaKind kind
    string name
    string path
    string sha256
    number byteSize
    object meta
  }
  class MediaChild {
    <<type>>
    string id
    string assetId
    TransformRecipe recipe
    ChildStatus status
    string variant
    string path
  }
  class JobRecord {
    <<type>>
    string id
    string assetId
    string childId
    JobStatus status
    number attempts
    string startedAt
  }
  class AuditEvent {
    <<type>>
    string entityId
    string entityType
    string correlationId
    object payload
  }
  MediaLibrary --> CatalogStore : injected
  MediaLibrary --> BlobStore : injected
  MediaLibrary --> JobStore : injected
  MediaLibrary --> AuditStore : injected
  MediaLibrary --> TransformerRegistry : injected
  TransformerRegistry --> MediaTransformer : resolves
  MediaTransformer <|.. ImageTransformer : implements
  CatalogStore <|.. SqliteCatalogStore
  CatalogStore <|.. DynamoCatalogStore
  BlobStore <|.. FsBlobStore
  BlobStore <|.. S3BlobStore
  JobStore <|.. SqliteJobStore
  JobStore <|.. DynamoJobStore
  AuditStore <|.. SqliteAuditStore
  AuditStore <|.. DynamoAuditStore
  MediaAsset "1" --> "0..*" MediaChild : assetId
  MediaChild "1" --> "0..*" JobRecord : childId
  MediaAsset "1" --> "0..*" JobRecord : assetId
  AuditStore --> AuditEvent : persists

Source evidence