@blaxel/core 0.3.7-preview.230 → 0.3.8-preview.232

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.
@@ -0,0 +1,149 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ApplicationInstance = void 0;
4
+ const uuid_1 = require("uuid");
5
+ const index_js_1 = require("../client/index.js");
6
+ const settings_js_1 = require("../common/settings.js");
7
+ class ApplicationInstance {
8
+ application;
9
+ constructor(application) {
10
+ this.application = application;
11
+ }
12
+ get metadata() {
13
+ return this.application.metadata;
14
+ }
15
+ get status() {
16
+ return this.application.status;
17
+ }
18
+ get spec() {
19
+ return this.application.spec;
20
+ }
21
+ get events() {
22
+ return this.application.events;
23
+ }
24
+ get name() {
25
+ return this.application.metadata.name;
26
+ }
27
+ static async create(config) {
28
+ const defaultName = `app-${(0, uuid_1.v4)().replace(/-/g, "").substring(0, 8)}`;
29
+ let body;
30
+ if ("spec" in config && "metadata" in config) {
31
+ body = config;
32
+ }
33
+ else {
34
+ const cfg = config;
35
+ body = {
36
+ metadata: {
37
+ name: cfg.name || defaultName,
38
+ displayName: cfg.displayName || cfg.name || defaultName,
39
+ labels: cfg.labels,
40
+ },
41
+ spec: {
42
+ enabled: cfg.enabled ?? true,
43
+ region: cfg.region || settings_js_1.settings.region,
44
+ image: cfg.image,
45
+ memory: cfg.memory,
46
+ port: cfg.port,
47
+ envs: cfg.envs,
48
+ },
49
+ };
50
+ }
51
+ if (!body.metadata) {
52
+ body.metadata = { name: defaultName };
53
+ }
54
+ if (!body.metadata.name) {
55
+ body.metadata.name = defaultName;
56
+ }
57
+ const { data } = await (0, index_js_1.createApplication)({
58
+ body,
59
+ throwOnError: true,
60
+ });
61
+ return new ApplicationInstance(data);
62
+ }
63
+ static async get(applicationName) {
64
+ const { data } = await (0, index_js_1.getApplication)({
65
+ path: { applicationName },
66
+ throwOnError: true,
67
+ });
68
+ return new ApplicationInstance(data);
69
+ }
70
+ static async list() {
71
+ const { data } = await (0, index_js_1.listApplications)({ throwOnError: true });
72
+ const items = Array.isArray(data) ? data : (data.data ?? []);
73
+ return items.map((app) => new ApplicationInstance(app));
74
+ }
75
+ static async delete(applicationName) {
76
+ const { data } = await (0, index_js_1.deleteApplication)({
77
+ path: { applicationName },
78
+ throwOnError: true,
79
+ });
80
+ return data;
81
+ }
82
+ async delete() {
83
+ return await ApplicationInstance.delete(this.metadata.name);
84
+ }
85
+ static async update(applicationName, updates) {
86
+ const existing = await ApplicationInstance.get(applicationName);
87
+ let body;
88
+ if ("spec" in updates && "metadata" in updates) {
89
+ body = {
90
+ metadata: {
91
+ ...existing.metadata,
92
+ ...updates.metadata,
93
+ },
94
+ spec: {
95
+ ...existing.spec,
96
+ ...updates.spec,
97
+ },
98
+ };
99
+ }
100
+ else {
101
+ const cfg = updates;
102
+ const metadataUpdates = {};
103
+ const specUpdates = {};
104
+ if (cfg.displayName !== undefined)
105
+ metadataUpdates.displayName = cfg.displayName;
106
+ if (cfg.labels !== undefined)
107
+ metadataUpdates.labels = cfg.labels;
108
+ if (cfg.enabled !== undefined)
109
+ specUpdates.enabled = cfg.enabled;
110
+ if (cfg.region !== undefined)
111
+ specUpdates.region = cfg.region;
112
+ if (cfg.image !== undefined)
113
+ specUpdates.image = cfg.image;
114
+ if (cfg.memory !== undefined)
115
+ specUpdates.memory = cfg.memory;
116
+ if (cfg.port !== undefined)
117
+ specUpdates.port = cfg.port;
118
+ if (cfg.envs !== undefined)
119
+ specUpdates.envs = cfg.envs;
120
+ body = {
121
+ metadata: {
122
+ ...existing.metadata,
123
+ ...metadataUpdates,
124
+ },
125
+ spec: {
126
+ ...existing.spec,
127
+ ...specUpdates,
128
+ },
129
+ };
130
+ }
131
+ const { data } = await (0, index_js_1.updateApplication)({
132
+ path: { applicationName },
133
+ body,
134
+ throwOnError: true,
135
+ });
136
+ return new ApplicationInstance(data);
137
+ }
138
+ async update(updates) {
139
+ return await ApplicationInstance.update(this.metadata.name, updates);
140
+ }
141
+ async listRevisions() {
142
+ const { data } = await (0, index_js_1.listApplicationRevisions)({
143
+ path: { applicationName: this.metadata.name },
144
+ throwOnError: true,
145
+ });
146
+ return data;
147
+ }
148
+ }
149
+ exports.ApplicationInstance = ApplicationInstance;
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ApplicationInstance = void 0;
4
+ var application_js_1 = require("./application.js");
5
+ Object.defineProperty(exports, "ApplicationInstance", { enumerable: true, get: function () { return application_js_1.ApplicationInstance; } });
@@ -30,8 +30,8 @@ function missingCredentialsMessage() {
30
30
  return "No Blaxel credentials found. Set the BL_API_KEY and BL_WORKSPACE environment variables, or run `bl login`.";
31
31
  }
32
32
  // Build info - these placeholders are replaced at build time by build:replace-imports
33
- const BUILD_VERSION = "0.3.7-preview.230";
34
- const BUILD_COMMIT = "110dd5983dfa658153d44e36dc9b02ffe6a90d77";
33
+ const BUILD_VERSION = "0.3.8-preview.232";
34
+ const BUILD_COMMIT = "984d0f21ad10014285117ebbbff73e62efd5cf98";
35
35
  const BUILD_SENTRY_DSN = "https://fd5e60e1c9820e1eef5ccebb84a07127@o4508714045276160.ingest.us.sentry.io/4510465864564736";
36
36
  const BLAXEL_API_VERSION = "2026-04-28";
37
37
  // Bun < 1.3.11 never sends connection-level WINDOW_UPDATE: the pooled h2
@@ -16,6 +16,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  require("./common/autoload");
18
18
  __exportStar(require("./agents/index.js"), exports);
19
+ __exportStar(require("./application/index.js"), exports);
19
20
  __exportStar(require("./client/client.js"), exports);
20
21
  __exportStar(require("./common/autoload.js"), exports);
21
22
  __exportStar(require("./common/env.js"), exports);
@@ -0,0 +1,29 @@
1
+ import type { Application as ApplicationModel, ApplicationSpec, AppRevision, Env } from "../client/index.js";
2
+ export type ApplicationCreateConfiguration = {
3
+ name?: string;
4
+ displayName?: string;
5
+ labels?: Record<string, string>;
6
+ enabled?: boolean;
7
+ region?: string;
8
+ image?: string;
9
+ memory?: number;
10
+ port?: number;
11
+ envs?: Env[];
12
+ };
13
+ export declare class ApplicationInstance {
14
+ private application;
15
+ constructor(application: ApplicationModel);
16
+ get metadata(): import("../client/types.gen.js").Metadata;
17
+ get status(): string | undefined;
18
+ get spec(): ApplicationSpec;
19
+ get events(): import("../client/types.gen.js").CoreEvents | undefined;
20
+ get name(): string;
21
+ static create(config: ApplicationCreateConfiguration | ApplicationModel): Promise<ApplicationInstance>;
22
+ static get(applicationName: string): Promise<ApplicationInstance>;
23
+ static list(): Promise<ApplicationInstance[]>;
24
+ static delete(applicationName: string): Promise<ApplicationModel>;
25
+ delete(): Promise<ApplicationModel>;
26
+ static update(applicationName: string, updates: ApplicationCreateConfiguration | ApplicationModel): Promise<ApplicationInstance>;
27
+ update(updates: ApplicationCreateConfiguration | ApplicationModel): Promise<ApplicationInstance>;
28
+ listRevisions(): Promise<AppRevision[]>;
29
+ }
@@ -0,0 +1,2 @@
1
+ export { ApplicationInstance } from "./application.js";
2
+ export type { ApplicationCreateConfiguration } from "./application.js";
@@ -1,5 +1,6 @@
1
1
  import './common/autoload';
2
2
  export * from "./agents/index.js";
3
+ export * from "./application/index.js";
3
4
  export * from "./client/client.js";
4
5
  export * from "./common/autoload.js";
5
6
  export * from "./common/env.js";