@blaxel/core 0.2.65-preview.78 → 0.2.65-preview.80
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/authentication/index.js +8 -4
- package/dist/cjs/common/settings.js +2 -2
- package/dist/cjs/sandbox/sandbox.js +4 -0
- package/dist/cjs/tools/zodSchema.js +27 -19
- package/dist/cjs/types/tools/zodSchema.d.ts +1 -1
- package/dist/cjs/volume/index.js +4 -0
- package/dist/cjs-browser/.tsbuildinfo +1 -1
- package/dist/cjs-browser/authentication/index.js +8 -4
- package/dist/cjs-browser/common/settings.js +2 -2
- package/dist/cjs-browser/sandbox/sandbox.js +4 -0
- package/dist/cjs-browser/tools/zodSchema.js +27 -19
- package/dist/cjs-browser/types/tools/zodSchema.d.ts +1 -1
- package/dist/cjs-browser/volume/index.js +4 -0
- package/dist/esm/.tsbuildinfo +1 -1
- package/dist/esm/authentication/index.js +8 -4
- package/dist/esm/common/settings.js +2 -2
- package/dist/esm/sandbox/sandbox.js +4 -0
- package/dist/esm/tools/zodSchema.js +27 -19
- package/dist/esm/volume/index.js +4 -0
- package/dist/esm-browser/.tsbuildinfo +1 -1
- package/dist/esm-browser/authentication/index.js +8 -4
- package/dist/esm-browser/common/settings.js +2 -2
- package/dist/esm-browser/sandbox/sandbox.js +4 -0
- package/dist/esm-browser/tools/zodSchema.js +27 -19
- package/dist/esm-browser/volume/index.js +4 -0
- package/package.json +1 -1
|
@@ -32,12 +32,16 @@ function getCredentials() {
|
|
|
32
32
|
const config = node_js_1.fs.readFileSync(node_js_1.path.join(homeDir, ".blaxel/config.yaml"), "utf8");
|
|
33
33
|
const configJson = yaml_1.default.parse(config);
|
|
34
34
|
const workspaceName = env_js_1.env.BL_WORKSPACE || configJson.context.workspace;
|
|
35
|
-
const
|
|
36
|
-
if
|
|
35
|
+
const workspace = configJson.workspaces.find((wk) => wk.name === workspaceName);
|
|
36
|
+
// Set BL_ENV from config.yaml workspace if not already set via env vars
|
|
37
|
+
if (!env_js_1.env.BL_ENV && workspace?.env) {
|
|
38
|
+
process.env.BL_ENV = workspace.env;
|
|
39
|
+
}
|
|
40
|
+
if (!workspace?.credentials) {
|
|
37
41
|
return null;
|
|
38
42
|
}
|
|
39
|
-
credentials.workspace = workspaceName;
|
|
40
|
-
return credentials;
|
|
43
|
+
workspace.credentials.workspace = workspaceName;
|
|
44
|
+
return workspace.credentials;
|
|
41
45
|
}
|
|
42
46
|
catch {
|
|
43
47
|
// If any error (e.g., running in browser), just return null
|
|
@@ -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.65-preview.
|
|
13
|
-
const BUILD_COMMIT = "
|
|
12
|
+
const BUILD_VERSION = "0.2.65-preview.80";
|
|
13
|
+
const BUILD_COMMIT = "73516f1cab04903455fcb759122e6b92d550032c";
|
|
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;
|
|
@@ -84,6 +84,10 @@ class SandboxInstance {
|
|
|
84
84
|
const ttl = sandbox.ttl;
|
|
85
85
|
const expires = sandbox.expires;
|
|
86
86
|
const region = sandbox.region || settings_js_1.settings.region;
|
|
87
|
+
if (!region) {
|
|
88
|
+
console.warn("SandboxInstance.create: 'region' is not set. In a future version, 'region' will be a required parameter. " +
|
|
89
|
+
"Please specify a region (e.g. 'us-pdx-1', 'eu-lon-1', 'us-was-1') in the sandbox configuration or set the BL_REGION environment variable.");
|
|
90
|
+
}
|
|
87
91
|
const lifecycle = sandbox.lifecycle;
|
|
88
92
|
const snapshotEnabled = sandbox.snapshotEnabled;
|
|
89
93
|
sandbox = {
|
|
@@ -5,6 +5,23 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.schemaToZodSchema = void 0;
|
|
7
7
|
const zod_1 = __importDefault(require("zod"));
|
|
8
|
+
const jsonTypeToZod = (type, param) => {
|
|
9
|
+
switch (type) {
|
|
10
|
+
case "boolean":
|
|
11
|
+
return zod_1.default.boolean();
|
|
12
|
+
case "number":
|
|
13
|
+
case "integer":
|
|
14
|
+
return zod_1.default.number();
|
|
15
|
+
case "null":
|
|
16
|
+
return zod_1.default.null();
|
|
17
|
+
case "array":
|
|
18
|
+
return zod_1.default.array((0, exports.schemaToZodSchema)(param.items || {}));
|
|
19
|
+
case "object":
|
|
20
|
+
return (0, exports.schemaToZodSchema)(param);
|
|
21
|
+
default:
|
|
22
|
+
return zod_1.default.string();
|
|
23
|
+
}
|
|
24
|
+
};
|
|
8
25
|
/**
|
|
9
26
|
* Converts an array of `FunctionSchema` objects into a Zod schema for validation.
|
|
10
27
|
*
|
|
@@ -16,25 +33,16 @@ const schemaToZodSchema = (schema) => {
|
|
|
16
33
|
if (schema.properties) {
|
|
17
34
|
Object.entries(schema.properties).forEach(([key, param]) => {
|
|
18
35
|
let zodType;
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
break;
|
|
30
|
-
case "array":
|
|
31
|
-
zodType = zod_1.default.array((0, exports.schemaToZodSchema)(param.items || {}));
|
|
32
|
-
break;
|
|
33
|
-
case "object":
|
|
34
|
-
zodType = (0, exports.schemaToZodSchema)(param);
|
|
35
|
-
break;
|
|
36
|
-
default:
|
|
37
|
-
zodType = zod_1.default.string();
|
|
36
|
+
if (Array.isArray(param.type)) {
|
|
37
|
+
// Handle union types like ["null", "boolean"]
|
|
38
|
+
const types = param.type.map((t) => jsonTypeToZod(t, param));
|
|
39
|
+
zodType =
|
|
40
|
+
types.length === 1
|
|
41
|
+
? types[0]
|
|
42
|
+
: zod_1.default.union(types);
|
|
43
|
+
}
|
|
44
|
+
else {
|
|
45
|
+
zodType = jsonTypeToZod(param.type ?? "string", param);
|
|
38
46
|
}
|
|
39
47
|
if (param.description) {
|
|
40
48
|
zodType = zodType.describe(param.description);
|
package/dist/cjs/volume/index.js
CHANGED
|
@@ -69,6 +69,10 @@ class VolumeInstance {
|
|
|
69
69
|
if (!volume.spec.region && settings_js_1.settings.region) {
|
|
70
70
|
volume.spec.region = settings_js_1.settings.region;
|
|
71
71
|
}
|
|
72
|
+
if (!volume.spec.region) {
|
|
73
|
+
console.warn("VolumeInstance.create: 'region' is not set. In a future version, 'region' will be a required parameter. " +
|
|
74
|
+
"Please specify a region (e.g. 'us-pdx-1', 'eu-lon-1', 'us-was-1') in the volume configuration or set the BL_REGION environment variable.");
|
|
75
|
+
}
|
|
72
76
|
const { data } = await (0, index_js_1.createVolume)({
|
|
73
77
|
body: volume,
|
|
74
78
|
throwOnError: true,
|