You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* feat: per-version file metadata client API
Replace the single `getFileMetadata` call with explicit per-version CRUD
matching the new backend endpoints.
- Add `Metadata` / `MetadataValue` / `METADATA_LIMITS` exports in `types/files`.
- New methods: `getFileVersionMetadata`, `updateFileVersionMetadata`,
`deleteFileVersionMetadata`. `metadata` re-added to `CreateItemProps`,
`UpdateItemProps`, and `createVersion` with the new typed shape.
- Update CLI test templates and CONTEXT.md docs.
- Unit tests cover URL/method/body for each new method and the createFile
metadata FormData path.
* chore: add changeset for per-version metadata API
* fix: encodeURIComponent for path segments in metadata methods
Per-version free-JSON metadata for files. Replaces the old single-endpoint `getFileMetadata` with three explicit version-scoped methods aligned with the new backend CRUD on `/item/:id/version/:tag/metadata`.
6
+
7
+
**New methods.**
8
+
9
+
-`getFileVersionMetadata(fileId, versionTag, params?)` — `GET /item/:id/version/:tag/metadata`. Returns `{}` when the version exists but has no metadata.
10
+
-`updateFileVersionMetadata(fileId, versionTag, metadata)` — `PUT …/metadata`. Replaces the version's metadata with the provided object.
11
+
-`deleteFileVersionMetadata(fileId, versionTag)` — `DELETE …/metadata`. Clears the version's metadata.
12
+
13
+
**New types and constants.**`Metadata = Record<string, MetadataValue>`, `MetadataValue = string | number | boolean | null`, and `METADATA_LIMITS` (200 fields, 50-char keys, 50-char values) are exported from the package root. `metadata` is now typed as `Metadata` everywhere it appears: `CreateItemProps`, `UpdateItemProps`, `createVersion`'s optional last argument.
14
+
15
+
**Breaking.**`getFileMetadata(itemId, params?)` is removed. It hit `GET /item/:id/metadata`, which has been deleted on the backend in favour of the version-scoped routes. Replace with `getFileVersionMetadata(fileId, versionTag, params?)` — the version tag is now required because metadata is per-version. To target the live version, pass the tag of the latest non-draft version (the equivalent of the old default behaviour).
`createFile`, `updateFile`, and `createVersion` continue to accept an optional `metadata` argument; the only change is the type — values can now be `string | number | boolean | null` instead of just `string`.
0 commit comments