Refresh docs and client for backend-routed asset uploads.
CI / test (push) Successful in 5s

This updates developer docs and web demos to use backend upload endpoints, adds a client upload helper, and aligns integration tests with the no-direct-MinIO URL flow.

Made-with: Cursor
This commit is contained in:
2026-03-02 21:51:47 +00:00
parent e981a334ea
commit a666f1233d
9 changed files with 92 additions and 84 deletions
+11 -11
View File
@@ -36,7 +36,7 @@ bun run build
Integration tests in `test/integration.test.ts` cover both:
- Base flow: register, login, collection and feature CRUD
- Asset flow: create/link asset, request signed upload URL, and toggle visibility
- Asset flow: create/link asset, request backend upload URL, upload binary, and toggle visibility
## Public API (current)
@@ -77,7 +77,8 @@ Key methods:
- **Assets (new)**
- `createOrLinkAsset({...})` — create metadata or reuse existing asset by checksum/ext and link it to a feature
- `getAssetSignedUploadUrl(assetId, contentType?)` — get signed `PUT` URL for binary upload
- `getAssetSignedUploadUrl(assetId, contentType?)` — get backend upload endpoint (`PUT /v1/assets/{id}/upload`)
- `uploadAssetBinary(assetId, payload, contentType?)` — upload binary through backend endpoint
- `setAssetVisibility(assetId, isPublic)` — owner toggles public/private access
- `resolveRelativeLink(path)` — converts backend-relative asset links to absolute URLs for browser usage
@@ -98,8 +99,8 @@ Key methods:
6. For media upload:
- compute file checksum
- call `createOrLinkAsset`
- call `getAssetSignedUploadUrl`
- upload file to signed URL
- call `uploadAssetBinary` (or call `getAssetSignedUploadUrl` + manual `fetch`)
- upload file to backend endpoint
7. Render and share assets from `properties.assets` links.
8. Use `setAssetVisibility` to toggle sharing.
9. Use `importKeys`/`exportKeys` in profile settings UX.
@@ -169,13 +170,12 @@ const asset = await client.createOrLinkAsset({
isPublic: true,
});
// Upload binary to object storage through signed URL
const signed = await client.getAssetSignedUploadUrl(asset.asset.id, asset.asset.mimeType);
await fetch(signed.url, {
method: signed.method,
headers: asset.asset.mimeType ? { "Content-Type": asset.asset.mimeType } : undefined,
body: file,
});
// Upload binary through backend upload endpoint
await client.uploadAssetBinary(
asset.asset.id,
file,
asset.asset.mimeType || "application/octet-stream"
);
// Read shareable relative link from feature payload
const features = await client.listFeatures(created.id);