@blaxel/core 0.2.27 → 0.2.28

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -4,7 +4,7 @@ import { SandboxNetwork } from "./network/index.js";
4
4
  import { SandboxPreviews } from "./preview.js";
5
5
  import { SandboxProcess } from "./process/index.js";
6
6
  import { SandboxSessions } from "./session.js";
7
- import { SandboxConfiguration, SandboxCreateConfiguration, SessionWithToken } from "./types.js";
7
+ import { SandboxConfiguration, SandboxCreateConfiguration, SandboxUpdateMetadata, SessionWithToken } from "./types.js";
8
8
  export declare class SandboxInstance {
9
9
  private sandbox;
10
10
  fs: SandboxFileSystem;
@@ -25,6 +25,7 @@ export declare class SandboxInstance {
25
25
  static get(sandboxName: string): Promise<SandboxInstance>;
26
26
  static list(): Promise<SandboxInstance[]>;
27
27
  static delete(sandboxName: string): Promise<SandboxModel>;
28
+ static updateMetadata(sandboxName: string, metadata: SandboxUpdateMetadata): Promise<SandboxInstance>;
28
29
  static createIfNotExists(sandbox: SandboxModel | SandboxCreateConfiguration): Promise<SandboxInstance>;
29
30
  static fromSession(session: SessionWithToken): Promise<SandboxInstance>;
30
31
  }
@@ -123,6 +123,17 @@ class SandboxInstance {
123
123
  });
124
124
  return data;
125
125
  }
126
+ static async updateMetadata(sandboxName, metadata) {
127
+ const sandbox = await SandboxInstance.get(sandboxName);
128
+ const body = { ...sandbox.sandbox, metadata: { ...sandbox.metadata, ...metadata } };
129
+ const { data } = await (0, index_js_1.updateSandbox)({
130
+ path: { sandboxName },
131
+ body,
132
+ throwOnError: true,
133
+ });
134
+ const instance = new SandboxInstance(data);
135
+ return instance;
136
+ }
126
137
  static async createIfNotExists(sandbox) {
127
138
  try {
128
139
  return await SandboxInstance.create(sandbox);
@@ -20,6 +20,10 @@ export type SandboxConfiguration = {
20
20
  headers?: Record<string, string>;
21
21
  params?: Record<string, string>;
22
22
  } & Sandbox;
23
+ export type SandboxUpdateMetadata = {
24
+ labels?: Record<string, string>;
25
+ displayName?: string;
26
+ };
23
27
  export type SandboxCreateConfiguration = {
24
28
  name?: string;
25
29
  image?: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blaxel/core",
3
- "version": "0.2.27",
3
+ "version": "0.2.28",
4
4
  "description": "Blaxel Core SDK for TypeScript",
5
5
  "license": "MIT",
6
6
  "author": "Blaxel, INC (https://blaxel.ai)",