@blaxel/core 0.3.11-preview.246 → 0.3.11

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.
@@ -24,8 +24,8 @@ function missingCredentialsMessage() {
24
24
  return "No Blaxel credentials found. Set the BL_API_KEY and BL_WORKSPACE environment variables, or run `bl login`.";
25
25
  }
26
26
  // Build info - these placeholders are replaced at build time by build:replace-imports
27
- const BUILD_VERSION = "0.3.11-preview.246";
28
- const BUILD_COMMIT = "bc44c2710d06faf12313fd4782c1d65146338b0d";
27
+ const BUILD_VERSION = "0.3.11";
28
+ const BUILD_COMMIT = "2f0b2eea01b33051dbb8b73fed58f043aed16ed0";
29
29
  const BUILD_SENTRY_DSN = "https://fd5e60e1c9820e1eef5ccebb84a07127@o4508714045276160.ingest.us.sentry.io/4510465864564736";
30
30
  const BLAXEL_API_VERSION = "2026-04-28";
31
31
  // Bun < 1.3.11 never sends connection-level WINDOW_UPDATE: the pooled h2
@@ -0,0 +1,72 @@
1
+ import { describe, expect, it } from "vitest";
2
+ import { schemaToZodSchema } from "./zodSchema.js";
3
+ // zod v3 and v4 are both supported (see the "zod" range in package.json), so
4
+ // these assertions only rely on behaviour that is identical across the two.
5
+ describe("schemaToZodSchema", () => {
6
+ it("maps json types onto their zod counterparts", () => {
7
+ const schema = schemaToZodSchema({
8
+ type: "object",
9
+ properties: {
10
+ name: { type: "string", description: "the name" },
11
+ count: { type: "integer" },
12
+ ratio: { type: "number" },
13
+ enabled: { type: "boolean" },
14
+ tags: {
15
+ type: "array",
16
+ items: { type: "object", properties: { id: { type: "string" } } },
17
+ },
18
+ nested: { type: "object", properties: { id: { type: "string" } } },
19
+ },
20
+ required: ["name", "count"],
21
+ });
22
+ const parsed = schema.parse({
23
+ name: "tool",
24
+ count: 2,
25
+ ratio: 0.5,
26
+ enabled: true,
27
+ tags: [{ id: "a" }],
28
+ nested: { id: "x" },
29
+ });
30
+ expect(parsed).toEqual({
31
+ name: "tool",
32
+ count: 2,
33
+ ratio: 0.5,
34
+ enabled: true,
35
+ tags: [{ id: "a" }],
36
+ nested: { id: "x" },
37
+ });
38
+ });
39
+ it("keeps non-required properties optional", () => {
40
+ const schema = schemaToZodSchema({
41
+ type: "object",
42
+ properties: {
43
+ name: { type: "string" },
44
+ optional: { type: "string" },
45
+ },
46
+ required: ["name"],
47
+ });
48
+ expect(schema.parse({ name: "tool" })).toEqual({ name: "tool" });
49
+ expect(() => schema.parse({ optional: "value" })).toThrow();
50
+ });
51
+ it("turns a list of types into a union", () => {
52
+ const schema = schemaToZodSchema({
53
+ type: "object",
54
+ properties: {
55
+ value: { type: ["null", "boolean"] },
56
+ },
57
+ required: ["value"],
58
+ });
59
+ expect(schema.parse({ value: null })).toEqual({ value: null });
60
+ expect(schema.parse({ value: false })).toEqual({ value: false });
61
+ expect(() => schema.parse({ value: "nope" })).toThrow();
62
+ });
63
+ it("falls back to a string for unknown or missing types", () => {
64
+ const schema = schemaToZodSchema({
65
+ type: "object",
66
+ properties: { value: {} },
67
+ required: ["value"],
68
+ });
69
+ expect(schema.parse({ value: "anything" })).toEqual({ value: "anything" });
70
+ expect(() => schema.parse({ value: 1 })).toThrow();
71
+ });
72
+ });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blaxel/core",
3
- "version": "0.3.11-preview.246",
3
+ "version": "0.3.11",
4
4
  "description": "Blaxel Core SDK for TypeScript",
5
5
  "license": "MIT",
6
6
  "author": "Blaxel, INC (https://blaxel.ai)",
@@ -76,7 +76,7 @@
76
76
  "uuid": "^11.1.0",
77
77
  "ws": "^8.18.2",
78
78
  "yaml": "^2.7.1",
79
- "zod": "^3.24.3"
79
+ "zod": "^3.25.0 || ^4.0.0"
80
80
  },
81
81
  "devDependencies": {
82
82
  "@eslint/js": "^9.26.0",