fireproof-storage / fireproof-storage/fireproof
Widen DocFiles to allow server-ref _files entries (uploadId-shaped)
- Dominant language
- TypeScript
- Stars
- 973
- Forks
- 58
- PR merge metrics
- No merged PRs in 30d
Description
## Problem
`DocFiles = Record` requires `cid` on every entry. This forces server-ref-shaped entries (e.g. `{uploadId, type, size, lastModified}` written by a hook that delegates byte storage to the server before the doc is persisted) to cast through `unknown` because there's no `cid` to provide at write time — the platform's URL minter (vibes.diy/api/svc/public/files-url-mint.ts) resolves the ref on read.
See [`vibes.diy/base/hooks/img-gen/use-img-gen.ts`](https://github.com/VibesDIY/vibes.diy/blob/jchris/imggen-files/vibes.diy/base/hooks/img-gen/use-img-gen.ts) on PR [#1629](https://github.com/VibesDIY/vibes.diy/pull/1629) for the call site.
## Proposal
Widen `DocFiles` to also accept a server-ref shape, e.g.:
```ts
type DocFileRef = { uploadId: string; type: string; size: number; lastModified?: number };
type DocFiles = Record;
```
Or make `cid` optional on `DocFileMeta` and let the storage layer resolve it from `uploadId` at read time when absent.
## Why it matters
Server-side asset upload (image gen, large files, audited uploads) is a common pattern in Fireproof apps where the client doesn't see the bytes — only the server does. Forcing every such doc to cast through `unknown` defeats the point of strict types on the put boundary.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.