Skip to content

v2.0.0-rc.9

Pre-release
Pre-release

Choose a tag to compare

@christianalfoni christianalfoni released this 13 Jun 08:03
· 97 commits to main since this release

πŸ“ DOCS

You can find the 2.0.0 RC docs at: https://fsnpxp-3000.csb.app/sdk

⚠️ These changes are additional to the previous rc.8 release!

πŸ—οΈ Infra

  • Fixed an issue with scheduling from our Universal Template

🚨 Breaking (typing)

Finding the correct terminology is always difficult, but we will keep iterating until we get it right:

// This is still considered a Sandbox and represents methods for interacting
// with the Sandbox VM. (type: Sandbox)
const sandbox = await sdk.sandboxes.resume('some-id')

// A session is explicitly creating a session (type: SandboxSession)
const session = await sandbox.createSession()

// There are now 3 ways of creating a CLIENT (type: SandboxClient):

// 1. Browser
import { connectToSandbox } from '@codesandbox/sdk/browser'
const client = await connectToSandbox(...)

// 2. Other Node environment
import { connectToSandbox } from '@codesandbox/sdk/node'
const client = await connectToSandbox(...)

// 3. Or connect in the same environment as the SDK
const sandbox = await sdk.sandboxes.resume('some-id')
// "Connect" creates both session and client for convenience
const client = await sandbox.connect(...)

⚠️ Deprecations

  • createBrowserSession is renamed to createSession as you can now connect to the Sandbox from both browser and node clients separate from your server and the SDK
  • sdk.sandboxes.fork is deprecated because it introduces yet another term to creating Sandboxes. Use create with an id to create a Sandbox

πŸš€ Features

  • You can now import connectToSandbox from @codesandbox/sdk/node to connect to a Sandbox from other Node environment separate from your server where SDK is used, like react-native
  • @codesandbox/pitcher-protocol is now removed as dependency and the types are moved to the SDK. Removing license dependency as well. @codesandbox/pitcher-client is still bundled into the browser client, but this will shortly be removed as well
  • When using an env option in the session we now write a ~/.private/.env file which is sourced on all terminals and commands created. This ensures we do not pass any private data from your server to clients connecting to the Sandbox
  • We are now passing the SDK version on the UserAgent of API requests, improving our ability to debug any issues

πŸ› Fixes

  • ws dependency is now replaced with isomorphic-ws to support Node-ish environments
  • Due to a typo there was a misunderstanding on the special private folder for user sessions. The folder name is ~/.private, NOT ~/private. This is now properly used for handling git and env variables
  • All requests from SDK now has 2min timeout, like the rest of our request flow in the API and infra
  • When using a Together.ai Api Key it is now properly handled by the CLI