@blaxel/core 0.2.64-preview.74 → 0.2.65-dev.77
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.
- package/dist/cjs/.tsbuildinfo +1 -1
- package/dist/cjs/common/settings.js +2 -2
- package/dist/cjs/sandbox/preview.js +23 -0
- package/dist/cjs/tools/zodSchema.js +27 -19
- package/dist/cjs/types/client/types.gen.d.ts +5 -1
- package/dist/cjs/types/sandbox/client/types.gen.d.ts +11 -0
- package/dist/cjs/types/sandbox/preview.d.ts +1 -0
- package/dist/cjs/types/tools/zodSchema.d.ts +1 -1
- package/dist/cjs/volume/index.js +2 -0
- package/dist/cjs-browser/.tsbuildinfo +1 -1
- package/dist/cjs-browser/common/settings.js +2 -2
- package/dist/cjs-browser/sandbox/preview.js +23 -0
- package/dist/cjs-browser/tools/zodSchema.js +27 -19
- package/dist/cjs-browser/types/client/types.gen.d.ts +5 -1
- package/dist/cjs-browser/types/sandbox/client/types.gen.d.ts +11 -0
- package/dist/cjs-browser/types/sandbox/preview.d.ts +1 -0
- package/dist/cjs-browser/types/tools/zodSchema.d.ts +1 -1
- package/dist/cjs-browser/volume/index.js +2 -0
- package/dist/esm/.tsbuildinfo +1 -1
- package/dist/esm/common/settings.js +2 -2
- package/dist/esm/sandbox/preview.js +23 -0
- package/dist/esm/tools/zodSchema.js +27 -19
- package/dist/esm/volume/index.js +2 -0
- package/dist/esm-browser/.tsbuildinfo +1 -1
- package/dist/esm-browser/common/settings.js +2 -2
- package/dist/esm-browser/sandbox/preview.js +23 -0
- package/dist/esm-browser/tools/zodSchema.js +27 -19
- package/dist/esm-browser/volume/index.js +2 -0
- package/package.json +1 -1
|
@@ -3,8 +3,8 @@ import { authentication } from "../authentication/index.js";
|
|
|
3
3
|
import { env } from "../common/env.js";
|
|
4
4
|
import { fs, os, path } from "../common/node.js";
|
|
5
5
|
// Build info - these placeholders are replaced at build time by build:replace-imports
|
|
6
|
-
const BUILD_VERSION = "0.2.
|
|
7
|
-
const BUILD_COMMIT = "
|
|
6
|
+
const BUILD_VERSION = "0.2.65-dev.77";
|
|
7
|
+
const BUILD_COMMIT = "e860c9b3329ead5a36f8b3b0a31cd428e3fc513b";
|
|
8
8
|
const BUILD_SENTRY_DSN = "https://fd5e60e1c9820e1eef5ccebb84a07127@o4508714045276160.ingest.us.sentry.io/4510465864564736";
|
|
9
9
|
// Cache for config.yaml tracking value
|
|
10
10
|
let configTrackingValue = null;
|
|
@@ -139,6 +139,29 @@ export class SandboxPreviews {
|
|
|
139
139
|
},
|
|
140
140
|
throwOnError: true,
|
|
141
141
|
});
|
|
142
|
+
if (data.status === 'DELETING') {
|
|
143
|
+
await this.waitForDeletion(previewName);
|
|
144
|
+
}
|
|
142
145
|
return data;
|
|
143
146
|
}
|
|
147
|
+
async waitForDeletion(previewName, timeoutMs = 10000) {
|
|
148
|
+
console.log(`Waiting for preview deletion: ${previewName}`);
|
|
149
|
+
const pollInterval = 500; // Poll every 500ms
|
|
150
|
+
const startTime = Date.now();
|
|
151
|
+
while (Date.now() - startTime < timeoutMs) {
|
|
152
|
+
const { response } = await getSandboxPreview({
|
|
153
|
+
path: {
|
|
154
|
+
sandboxName: this.sandboxName,
|
|
155
|
+
previewName,
|
|
156
|
+
},
|
|
157
|
+
});
|
|
158
|
+
if (response.status === 404) {
|
|
159
|
+
return;
|
|
160
|
+
}
|
|
161
|
+
// Preview still exists, wait and retry
|
|
162
|
+
await new Promise(resolve => setTimeout(resolve, pollInterval));
|
|
163
|
+
}
|
|
164
|
+
// Timeout reached, but deletion was initiated
|
|
165
|
+
throw new Error(`Preview deletion timeout: ${previewName} is still in DELETING state after ${timeoutMs}ms`);
|
|
166
|
+
}
|
|
144
167
|
}
|
|
@@ -1,4 +1,21 @@
|
|
|
1
1
|
import z from "zod";
|
|
2
|
+
const jsonTypeToZod = (type, param) => {
|
|
3
|
+
switch (type) {
|
|
4
|
+
case "boolean":
|
|
5
|
+
return z.boolean();
|
|
6
|
+
case "number":
|
|
7
|
+
case "integer":
|
|
8
|
+
return z.number();
|
|
9
|
+
case "null":
|
|
10
|
+
return z.null();
|
|
11
|
+
case "array":
|
|
12
|
+
return z.array(schemaToZodSchema(param.items || {}));
|
|
13
|
+
case "object":
|
|
14
|
+
return schemaToZodSchema(param);
|
|
15
|
+
default:
|
|
16
|
+
return z.string();
|
|
17
|
+
}
|
|
18
|
+
};
|
|
2
19
|
/**
|
|
3
20
|
* Converts an array of `FunctionSchema` objects into a Zod schema for validation.
|
|
4
21
|
*
|
|
@@ -10,25 +27,16 @@ export const schemaToZodSchema = (schema) => {
|
|
|
10
27
|
if (schema.properties) {
|
|
11
28
|
Object.entries(schema.properties).forEach(([key, param]) => {
|
|
12
29
|
let zodType;
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
break;
|
|
24
|
-
case "array":
|
|
25
|
-
zodType = z.array(schemaToZodSchema(param.items || {}));
|
|
26
|
-
break;
|
|
27
|
-
case "object":
|
|
28
|
-
zodType = schemaToZodSchema(param);
|
|
29
|
-
break;
|
|
30
|
-
default:
|
|
31
|
-
zodType = z.string();
|
|
30
|
+
if (Array.isArray(param.type)) {
|
|
31
|
+
// Handle union types like ["null", "boolean"]
|
|
32
|
+
const types = param.type.map((t) => jsonTypeToZod(t, param));
|
|
33
|
+
zodType =
|
|
34
|
+
types.length === 1
|
|
35
|
+
? types[0]
|
|
36
|
+
: z.union(types);
|
|
37
|
+
}
|
|
38
|
+
else {
|
|
39
|
+
zodType = jsonTypeToZod(param.type ?? "string", param);
|
|
32
40
|
}
|
|
33
41
|
if (param.description) {
|
|
34
42
|
zodType = zodType.describe(param.description);
|
|
@@ -154,6 +154,8 @@ export class VolumeInstance {
|
|
|
154
154
|
status: data.status,
|
|
155
155
|
terminatedAt: data.terminatedAt,
|
|
156
156
|
};
|
|
157
|
+
// This is for safe update
|
|
158
|
+
await new Promise(resolve => setTimeout(resolve, 500));
|
|
157
159
|
return new VolumeInstance(newVolume);
|
|
158
160
|
}
|
|
159
161
|
async update(updates) {
|