Skip to content

feat(js-sdk): expose snapshot name parameter in createSnapshot#1250

Open
Crunchyman-ralph wants to merge 1 commit intoe2b-dev:mainfrom
Crunchyman-ralph:feat/snapshot-name-support
Open

feat(js-sdk): expose snapshot name parameter in createSnapshot#1250
Crunchyman-ralph wants to merge 1 commit intoe2b-dev:mainfrom
Crunchyman-ralph:feat/snapshot-name-support

Conversation

@Crunchyman-ralph
Copy link
Copy Markdown

Summary

Fixes #1249

The REST API supports an optional name field when creating snapshots, but the JS SDK was sending an empty body and not exposing the parameter. This PR:

  • Adds SnapshotCreateOpts interface with optional name field
  • Forwards the name in the POST request body to the API
  • Exposes the names array from the API response in SnapshotInfo
  • Exports SnapshotCreateOpts from the package entry point

Changes

  • packages/js-sdk/src/sandbox/sandboxApi.ts — New SnapshotCreateOpts type, forward name in request body, return names in response
  • packages/js-sdk/src/sandbox/index.ts — Update instance method signature to use SnapshotCreateOpts
  • packages/js-sdk/src/index.ts — Export SnapshotCreateOpts

Usage

// Create a named snapshot
const snapshot = await sandbox.createSnapshot({ name: 'my-snapshot' })
console.log(snapshot.names) // ['team-slug/my-snapshot:default']

// Create sandbox from named snapshot
const sbx = await Sandbox.create('team-slug/my-snapshot')

Backwards compatible

  • SnapshotCreateOpts extends SandboxApiOpts, so existing code using SandboxApiOpts still works
  • name is optional — omitting it produces the same behavior as before
  • names is a new field on SnapshotInfo — existing code accessing snapshotId is unaffected

The REST API supports an optional `name` field when creating snapshots,
allowing named snapshots that are addressable via Sandbox.create().
The SDK was sending an empty body, silently ignoring any name passed
by the caller.

Changes:
- Add SnapshotCreateOpts interface extending SandboxApiOpts with
  optional `name` field
- Forward the name in the POST request body
- Expose `names` array from the API response in SnapshotInfo
- Export SnapshotCreateOpts from package entry
Copy link
Copy Markdown

@claude claude bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Claude Code Review

This pull request is from a fork — automated review is disabled. A repository maintainer can comment @claude review to run a one-time review.

@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Apr 1, 2026

⚠️ No Changeset found

Latest commit: 215332f

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

JS SDK: createSnapshot does not forward the 'name' parameter to the REST API

1 participant