@blaxel/core 0.2.60 → 0.2.61-dev.59

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.
@@ -951,22 +951,6 @@ export const updatePolicy = (options) => {
951
951
  }
952
952
  });
953
953
  };
954
- /**
955
- * List pending invitations
956
- * Returns a list of all pending invitations in the workspace.
957
- */
958
- export const listAllPendingInvitations = (options) => {
959
- return (options?.client ?? _heyApiClient).get({
960
- security: [
961
- {
962
- scheme: 'bearer',
963
- type: 'http'
964
- }
965
- ],
966
- url: '/profile/invitations',
967
- ...options
968
- });
969
- };
970
954
  /**
971
955
  * List public ips
972
956
  * Returns a list of all public ips used in Blaxel..
@@ -1627,6 +1611,26 @@ export const getVolume = (options) => {
1627
1611
  ...options
1628
1612
  });
1629
1613
  };
1614
+ /**
1615
+ * Update volume
1616
+ * Updates a volume.
1617
+ */
1618
+ export const updateVolume = (options) => {
1619
+ return (options.client ?? _heyApiClient).put({
1620
+ security: [
1621
+ {
1622
+ scheme: 'bearer',
1623
+ type: 'http'
1624
+ }
1625
+ ],
1626
+ url: '/volumes/{volumeName}',
1627
+ ...options,
1628
+ headers: {
1629
+ 'Content-Type': 'application/json',
1630
+ ...options?.headers
1631
+ }
1632
+ });
1633
+ };
1630
1634
  /**
1631
1635
  * List accessible workspaces
1632
1636
  * Returns all workspaces the authenticated user has access to. Each workspace is a separate tenant with its own resources, team members, and billing.
@@ -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.60";
7
- const BUILD_COMMIT = "2c502afdeb7e7a53923997003a02788b8b7591d1";
6
+ const BUILD_VERSION = "0.2.61-dev.59";
7
+ const BUILD_COMMIT = "b31b3a72e9e909957f7eddddd81cff16cccddb26";
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;
@@ -158,6 +158,28 @@ export class SandboxInstance {
158
158
  const instance = new SandboxInstance(data);
159
159
  return instance;
160
160
  }
161
+ static async updateTtl(sandboxName, ttl) {
162
+ const sandbox = await SandboxInstance.get(sandboxName);
163
+ const body = { ...sandbox.sandbox, spec: { ...sandbox.spec, runtime: { ...sandbox.spec.runtime, ttl } } };
164
+ const { data } = await updateSandbox({
165
+ path: { sandboxName },
166
+ body,
167
+ throwOnError: true,
168
+ });
169
+ const instance = new SandboxInstance(data);
170
+ return instance;
171
+ }
172
+ static async updateLifecycle(sandboxName, lifecycle) {
173
+ const sandbox = await SandboxInstance.get(sandboxName);
174
+ const body = { ...sandbox.sandbox, spec: { ...sandbox.spec, lifecycle } };
175
+ const { data } = await updateSandbox({
176
+ path: { sandboxName },
177
+ body,
178
+ throwOnError: true,
179
+ });
180
+ const instance = new SandboxInstance(data);
181
+ return instance;
182
+ }
161
183
  static async createIfNotExists(sandbox) {
162
184
  try {
163
185
  return await SandboxInstance.create(sandbox);
@@ -1,5 +1,5 @@
1
1
  import { v4 as uuidv4 } from "uuid";
2
- import { createVolume, deleteVolume, getVolume, listVolumes } from "../client/index.js";
2
+ import { createVolume, deleteVolume, getVolume, listVolumes, updateVolume } from "../client/index.js";
3
3
  export class VolumeInstance {
4
4
  volume;
5
5
  constructor(volume) {
@@ -93,6 +93,69 @@ export class VolumeInstance {
93
93
  async delete() {
94
94
  return await VolumeInstance.delete(this.metadata.name);
95
95
  }
96
+ static async update(volumeName, updates) {
97
+ const volume = await VolumeInstance.get(volumeName);
98
+ let metadataUpdates = {};
99
+ let specUpdates = {};
100
+ if ('spec' in updates && 'metadata' in updates) {
101
+ // It's a Volume object - only include defined fields
102
+ if (updates.metadata) {
103
+ if (updates.metadata.displayName !== undefined)
104
+ metadataUpdates.displayName = updates.metadata.displayName;
105
+ if (updates.metadata.labels !== undefined)
106
+ metadataUpdates.labels = updates.metadata.labels;
107
+ }
108
+ if (updates.spec) {
109
+ if (updates.spec.size !== undefined)
110
+ specUpdates.size = updates.spec.size;
111
+ if (updates.spec.region !== undefined)
112
+ specUpdates.region = updates.spec.region;
113
+ if (updates.spec.template !== undefined)
114
+ specUpdates.template = updates.spec.template;
115
+ }
116
+ }
117
+ else {
118
+ // It's a VolumeCreateConfiguration - only include defined fields
119
+ if (updates.displayName !== undefined)
120
+ metadataUpdates.displayName = updates.displayName;
121
+ if (updates.labels !== undefined)
122
+ metadataUpdates.labels = updates.labels;
123
+ if (updates.size !== undefined)
124
+ specUpdates.size = updates.size;
125
+ if (updates.region !== undefined)
126
+ specUpdates.region = updates.region;
127
+ if (updates.template !== undefined)
128
+ specUpdates.template = updates.template;
129
+ }
130
+ const body = {
131
+ metadata: {
132
+ ...volume.metadata,
133
+ ...metadataUpdates,
134
+ },
135
+ spec: {
136
+ ...volume.spec,
137
+ ...specUpdates,
138
+ },
139
+ };
140
+ const { data } = await updateVolume({
141
+ path: { volumeName },
142
+ body,
143
+ throwOnError: true,
144
+ });
145
+ const newVolume = {
146
+ metadata: data.metadata,
147
+ spec: data.spec,
148
+ events: data.events,
149
+ state: data.state,
150
+ status: data.status,
151
+ terminatedAt: data.terminatedAt,
152
+ };
153
+ return new VolumeInstance(newVolume);
154
+ }
155
+ async update(updates) {
156
+ const updated = await VolumeInstance.update(this.metadata.name, updates);
157
+ return updated;
158
+ }
96
159
  static async createIfNotExists(config) {
97
160
  try {
98
161
  return await VolumeInstance.create(config);