Media lifecycle activity
Activity notation is expressed with Mermaid flowchart decisions and start/end nodes (Mermaid has no native UML activity syntax). Validation failures exit the chosen request without advancing to catalog availability. Transfer is copy, not move: source survives; ready children may copy, jobs and prior audit history do not. Each item can fail/conflict independently. Site preparation and review are a separate CLI/manifest workflow, not a hidden stage in ordinary uploads.
Legend: all drawn relationships are source-verified; branches are conditional execution paths. No inferred service is drawn.
flowchart TB
S([Start]) --> E{"Entry path"}
E -->|Admin or direct upload| V["Authenticate and validate envelope / name"]
V --> O["Store original and catalog metadata / digest"]
E -->|Site manifest import| M["Sanitize source, probe facts, review manifest"]
M --> H["Check policy and sanitized SHA"]
H --> T["transferMedia: reserve target name and copy create-only"]
E -->|Backend transfer CLI| T
T --> K["Verify new target objects; preserve IDs and paths"]
K --> O2["Insert target rows; optional transfer audit"]
O --> I{"Raster image upload?"}
I -->|Yes| P["Attempt default t thumbnail"]
I -->|No| R["Catalog available"]
P --> R
O2 --> R
R --> X{"Operation"}
X -->|Read| B["Authenticated catalog; public object retrieval"]
X -->|Metadata update| U["Shallow merge metadata; normalize explicit tags; audit"]
X -->|Variant request| J["Validate recipe; enqueue child/job; run inline or SQS"]
J --> Q{"Result"}
Q -->|Success| C["Ready child and succeeded job"]
Q -->|Terminal error| F["Failed job; failed child or preserved prior ready variant"]
Q -->|Retryable fault| Y["Requeue; throw; SQS retry where configured"]
Y --> J
X -->|Transfer| T
X -->|Delete| D{"Fresh running lease?"}
D -->|Yes| R
D -->|No| Z["Cascade catalog; delete blobs; audit; optional invalidate"]
Z --> END([Deleted or partial-cleanup exception])
B --> R
U --> R
C --> R
F --> R
Source evidence
- core/admin/server/utils/media-service.ts:237 — export async function ingestMediaUpload
- packages/media/src/media-library.ts:241 — async ingest(
- packages/media-nuxt/runtime/server/api/media/ingest/complete.post.ts:29 — export default defineEventHandler
- packages/media/src/media-library.ts:631 — async runMaterializeJob(
- packages/media/src/media-library.ts:323 — async updateAssetMeta(
- packages/media/src/media-library.ts:891 — async deleteAsset(
- packages/media/src/transfer.ts:429 — export async function transferMedia
- scripts/site-media-io.js:98 — export function sanitizeSourceBytes
- packages/media/src/site-import.ts:95 — export async function importSiteMedia