feat: archive, recover and delete item versions#13
Merged
Conversation
Mirrors the new backend endpoints so SDK consumers (cloud components,
CLI, scripts) can manage version lifecycle without crafting URLs.
- listVersions(itemId, { archived })
- archiveVersion(itemId, versionTag)
- recoverVersion(itemId, versionTag)
- deleteVersion(itemId, versionTag) — requires the version to be
archived first; backend rejects otherwise
Both auth modes (accessToken query param and Bearer header) work
through the existing requestApi helper. HTTP-contract tests added.
smoratino-apogea
approved these changes
May 4, 2026
| * @returns The archived version. | ||
| */ | ||
| async archiveVersion(itemId: string, versionTag: string) { | ||
| return await this.#requestApi<ItemVersion>( |
Contributor
There was a problem hiding this comment.
I think encodeURIComponent() is missing in archiveVersion, recoverVersion, and deleteVersion
Addresses Sergio's review: archiveVersion, recoverVersion, deleteVersion and listVersions interpolated itemId / versionTag straight into the URL, so any tag with /, ?, # or whitespace would corrupt the path.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Mirrors the new backend endpoints for per-version lifecycle management so SDK consumers (cloud components, CLI, ad-hoc scripts) can archive, recover, list and permanently delete versions of an item without crafting URLs by hand.
Changes
EngineServicesClient:listVersions(itemId, { archived })—GET /item/:itemId/versions.archived: truereturns only archived,falsereturns only active, omitting it returns both.archiveVersion(itemId, versionTag)—PUT /item/:itemId/version/:versionTag/archive.recoverVersion(itemId, versionTag)—PUT /item/:itemId/version/:versionTag/recover.deleteVersion(itemId, versionTag)—DELETE /item/:itemId/version/:versionTag. Backend rejects unless the version is already archived.#requestApihelper, so both auth modes (accessToken in query string and Bearer header forPlatformClient) work without extra wiring.client.test.tscovering HTTP method, path, query params, bearer header behaviour and error propagation.Considerations
ItemVersiontype already extends aBasethat hasarchived?: boolean, so the response shape is unchanged.archiveVersionfirst, otherwise the backend returns400. Tested via the error-handling case.backend-api, cloud component templates) will pick this up via the normal version bump.