@blaxel/core 0.3.29-preview.319 → 0.3.29-preview.321
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/image/image.js +8 -0
- package/dist/cjs/image/image.test.js +16 -0
- package/dist/cjs/types/image/image.browser.d.ts +1 -0
- package/dist/cjs/types/image/image.d.ts +5 -0
- package/dist/cjs-browser/.tsbuildinfo +1 -1
- package/dist/cjs-browser/common/settings.js +2 -2
- package/dist/cjs-browser/image/image.test.js +16 -0
- package/dist/cjs-browser/types/image/image.browser.d.ts +1 -0
- package/dist/cjs-browser/types/image/image.d.ts +5 -0
- package/dist/esm/.tsbuildinfo +1 -1
- package/dist/esm/common/settings.js +2 -2
- package/dist/esm/image/image.js +8 -0
- package/dist/esm/image/image.test.js +16 -0
- package/dist/esm-browser/.tsbuildinfo +1 -1
- package/dist/esm-browser/common/settings.js +2 -2
- package/dist/esm-browser/image/image.test.js +16 -0
- package/package.json +1 -1
|
@@ -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.29-preview.
|
|
28
|
-
const BUILD_COMMIT = "
|
|
27
|
+
const BUILD_VERSION = "0.3.29-preview.321";
|
|
28
|
+
const BUILD_COMMIT = "c1f5d1cffc5e85565febbbe0737df89947f2caa5";
|
|
29
29
|
const BUILD_SENTRY_DSN = "https://fd5e60e1c9820e1eef5ccebb84a07127@o4508714045276160.ingest.us.sentry.io/4510465864564736";
|
|
30
30
|
const BLAXEL_API_VERSION = "2026-09-22";
|
|
31
31
|
// Bun < 1.3.11 never sends connection-level WINDOW_UPDATE: the pooled h2
|
package/dist/esm/image/image.js
CHANGED
|
@@ -23,6 +23,8 @@ const BUILD_UPLOAD_LABELS = [
|
|
|
23
23
|
"x-blaxel-build-cache",
|
|
24
24
|
];
|
|
25
25
|
const MAX_BUILD_UPLOAD_LABEL_VALUE = 64;
|
|
26
|
+
// The builder ignores a region that is not a resource name, so reject it here.
|
|
27
|
+
const BUILD_REGION_PATTERN = /^[a-z0-9][a-z0-9-]{0,62}$/;
|
|
26
28
|
// Reads an option that also has a deprecated `...Mb` spelling.
|
|
27
29
|
function buildSizeLabel(option, value, deprecatedValue, min, max) {
|
|
28
30
|
if (value !== undefined && deprecatedValue !== undefined) {
|
|
@@ -820,6 +822,12 @@ export class ImageInstance {
|
|
|
820
822
|
if (buildVolume !== undefined) {
|
|
821
823
|
buildLabels["x-blaxel-build-volume"] = buildVolume;
|
|
822
824
|
}
|
|
825
|
+
if (options.buildRegion !== undefined) {
|
|
826
|
+
if (typeof options.buildRegion !== "string" || !BUILD_REGION_PATTERN.test(options.buildRegion)) {
|
|
827
|
+
throw new Error("buildRegion must be a region name such as us-was-1");
|
|
828
|
+
}
|
|
829
|
+
buildLabels["x-blaxel-build-region"] = options.buildRegion;
|
|
830
|
+
}
|
|
823
831
|
// Prepare image for sandbox deployment (add sandbox-api and entrypoint)
|
|
824
832
|
const preparedImage = this._prepareForSandbox(sandboxVersion);
|
|
825
833
|
// Write the image folder
|
|
@@ -614,6 +614,17 @@ describe("ImageInstance.build worker resources", () => {
|
|
|
614
614
|
const { upload } = await buildWith({}, { "x-blaxel-auto-generated": "true", "x-blaxel-build-memory": "8192" }, "none");
|
|
615
615
|
expect(upload.headers["x-amz-meta-x-blaxel-build-memory"]).toBeUndefined();
|
|
616
616
|
});
|
|
617
|
+
it("sends the build region as a label and signed upload header", async () => {
|
|
618
|
+
const { create, upload } = await buildWith({ buildRegion: "us-was-1", buildMemory: 2048 });
|
|
619
|
+
expect(create.body.metadata?.labels?.["x-blaxel-build-region"]).toBe("us-was-1");
|
|
620
|
+
expect(upload.headers["x-amz-meta-x-blaxel-build-region"]).toBe("us-was-1");
|
|
621
|
+
expect(upload.headers["x-amz-meta-x-blaxel-build-memory"]).toBe("2048");
|
|
622
|
+
});
|
|
623
|
+
it("asks again when creating a sandbox does not sign the region", async () => {
|
|
624
|
+
const { upload } = await buildWith({ buildRegion: "us-was-1" }, undefined, "update");
|
|
625
|
+
expect(calls.filter((call) => call.url.includes("upload=true")).map((call) => call.method)).toEqual(["PUT", "POST", "PUT"]);
|
|
626
|
+
expect(upload.headers["x-amz-meta-x-blaxel-build-region"]).toBe("us-was-1");
|
|
627
|
+
});
|
|
617
628
|
it("still accepts the deprecated Mb spellings", async () => {
|
|
618
629
|
const { create, upload } = await buildWith({ buildMemoryMb: 8192, buildVolumeMb: 0 });
|
|
619
630
|
expect(create.body.metadata?.labels?.["x-blaxel-build-memory"]).toBe("8192");
|
|
@@ -642,6 +653,11 @@ describe("ImageInstance.build worker resources", () => {
|
|
|
642
653
|
[{ buildVolumeMb: -1 }, "buildVolumeMb must"],
|
|
643
654
|
[{ buildMemory: 2048, buildMemoryMb: 2048 }, "not both"],
|
|
644
655
|
[{ buildVolume: 0, buildVolumeMb: 0 }, "not both"],
|
|
656
|
+
[{ buildRegion: "" }, "buildRegion must"],
|
|
657
|
+
[{ buildRegion: "US-WAS-1" }, "buildRegion must"],
|
|
658
|
+
[{ buildRegion: " us-was-1" }, "buildRegion must"],
|
|
659
|
+
[{ buildRegion: "-us" }, "buildRegion must"],
|
|
660
|
+
[{ buildRegion: "a".repeat(64) }, "buildRegion must"],
|
|
645
661
|
])("rejects out-of-range %o before any request", async (options, option) => {
|
|
646
662
|
const fetchSpy = vi.fn();
|
|
647
663
|
vi.stubGlobal("fetch", fetchSpy);
|