Database
Hooks
Guards and row updates the db plugin adds to each lifecycle step.
The db() plugin attaches guards and database updates to upload, multipart, download, and delete. Enable the feature, register the plugin — you do not wire these hooks yourself.
Your own guards and lifecycle hooks on each feature still run after the plugin's.
Access rules
The plugin resolves the caller's scope (configured in Setup) and rejects:
| Situation | Response |
|---|---|
| No scope (unauthenticated) | 401 |
| File owned by another scope | 403 |
| Expected row missing | 404 |
By feature
| Feature | Before | After |
|---|---|---|
| Upload | Reject if the key belongs to another scope | Row created or updated as pending |
| Upload confirm | Row must exist and match the caller | Promoted to active with verified size |
| Multipart | Same ownership check as upload | pending on start, active on complete, row removed on abort |
| Download | File must be active and owned | — |
| Delete | Row must exist and owned | Row updated per deleteMode |
Delete always removes the file from S3 through the normal api.delete path. The plugin only updates the database row afterward.
Multipart resume
To resume a large upload after a refresh, load the pending row with s3.db.objects.findPendingMultipart, map it with toPendingMultipartResume, and return it from a custom UploadStore on the client.
See API for store methods.