@blaxel/core 0.2.64-preview.74 → 0.2.64

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.
@@ -9,8 +9,8 @@ const index_js_1 = require("../authentication/index.js");
9
9
  const env_js_1 = require("../common/env.js");
10
10
  const node_js_1 = require("../common/node.js");
11
11
  // Build info - these placeholders are replaced at build time by build:replace-imports
12
- const BUILD_VERSION = "0.2.64-preview.74";
13
- const BUILD_COMMIT = "80ced0a6bfd2a6577a44fd8bedfe81fe25a0a8d4";
12
+ const BUILD_VERSION = "0.2.64";
13
+ const BUILD_COMMIT = "7443ee7bede975319d35683d26daf39073323b14";
14
14
  const BUILD_SENTRY_DSN = "https://fd5e60e1c9820e1eef5ccebb84a07127@o4508714045276160.ingest.us.sentry.io/4510465864564736";
15
15
  // Cache for config.yaml tracking value
16
16
  let configTrackingValue = null;
@@ -145,7 +145,30 @@ class SandboxPreviews {
145
145
  },
146
146
  throwOnError: true,
147
147
  });
148
+ if (data.status === 'DELETING') {
149
+ await this.waitForDeletion(previewName);
150
+ }
148
151
  return data;
149
152
  }
153
+ async waitForDeletion(previewName, timeoutMs = 10000) {
154
+ console.log(`Waiting for preview deletion: ${previewName}`);
155
+ const pollInterval = 500; // Poll every 500ms
156
+ const startTime = Date.now();
157
+ while (Date.now() - startTime < timeoutMs) {
158
+ const { response } = await (0, index_js_1.getSandboxPreview)({
159
+ path: {
160
+ sandboxName: this.sandboxName,
161
+ previewName,
162
+ },
163
+ });
164
+ if (response.status === 404) {
165
+ return;
166
+ }
167
+ // Preview still exists, wait and retry
168
+ await new Promise(resolve => setTimeout(resolve, pollInterval));
169
+ }
170
+ // Timeout reached, but deletion was initiated
171
+ throw new Error(`Preview deletion timeout: ${previewName} is still in DELETING state after ${timeoutMs}ms`);
172
+ }
150
173
  }
151
174
  exports.SandboxPreviews = SandboxPreviews;
@@ -1825,15 +1825,19 @@ export type Ports = Array<Port>;
1825
1825
  * Preview of a Resource
1826
1826
  */
1827
1827
  export type Preview = {
1828
+ events?: CoreEvents;
1828
1829
  metadata: PreviewMetadata;
1829
1830
  spec: PreviewSpec;
1831
+ status?: Status;
1830
1832
  };
1831
1833
  /**
1832
1834
  * Preview of a Resource
1833
1835
  */
1834
1836
  export type PreviewWritable = {
1837
+ events?: CoreEventsWritable;
1835
1838
  metadata: PreviewMetadataWritable;
1836
1839
  spec: PreviewSpecWritable;
1840
+ status?: Status;
1837
1841
  };
1838
1842
  /**
1839
1843
  * PreviewMetadata
@@ -2197,7 +2201,7 @@ export type RevisionMetadataWritable = {
2197
2201
  export type Sandbox = {
2198
2202
  events?: CoreEvents;
2199
2203
  /**
2200
- * Time in seconds until the sandbox is automatically deleted based on TTL and lifecycle policies. Only present for sandboxes with expiration configured.
2204
+ * Time in seconds until the sandbox is automatically deleted based on TTL and lifecycle policies. Only present for sandboxes with lifecycle configured.
2201
2205
  */
2202
2206
  readonly expiresIn?: number;
2203
2207
  /**
@@ -34,4 +34,5 @@ export declare class SandboxPreviews {
34
34
  createIfNotExists(preview: Preview): Promise<SandboxPreview>;
35
35
  get(previewName: string): Promise<SandboxPreview>;
36
36
  delete(previewName: string): Promise<Preview>;
37
+ private waitForDeletion;
37
38
  }
@@ -157,6 +157,8 @@ class VolumeInstance {
157
157
  status: data.status,
158
158
  terminatedAt: data.terminatedAt,
159
159
  };
160
+ // This is for safe update
161
+ await new Promise(resolve => setTimeout(resolve, 500));
160
162
  return new VolumeInstance(newVolume);
161
163
  }
162
164
  async update(updates) {