@north-light/api 0.3.734 → 0.3.735
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.
|
@@ -83,5 +83,7 @@ export interface BlaxelClient {
|
|
|
83
83
|
/** Creates (or adopts) a private preview on `port` and returns its URL. */
|
|
84
84
|
ensurePreview(sandboxName: string, previewName: string, port: number): Promise<string>;
|
|
85
85
|
createPreviewToken(sandboxName: string, previewName: string, expiresAt: Date): Promise<PreviewToken>;
|
|
86
|
+
/** Deleting an absent preview (or one of an absent sandbox) is not an error. */
|
|
87
|
+
deletePreview(sandboxName: string, previewName: string): Promise<void>;
|
|
86
88
|
}
|
|
87
89
|
export declare function createBlaxelClient(config: BlaxelConfig): BlaxelClient;
|
|
@@ -143,5 +143,8 @@ export function createBlaxelClient(config) {
|
|
|
143
143
|
const spec = json.spec;
|
|
144
144
|
return { token: spec.token, expiresAt: spec.expiresAt };
|
|
145
145
|
},
|
|
146
|
+
async deletePreview(sandboxName, previewName) {
|
|
147
|
+
await call(`${control}/sandboxes/${encodeName(sandboxName)}/previews/${encodeName(previewName)}`, 'DELETE', undefined, [404]);
|
|
148
|
+
},
|
|
146
149
|
};
|
|
147
150
|
}
|
|
@@ -56,6 +56,7 @@ export function createBlaxelRunner(deps) {
|
|
|
56
56
|
// "Name taken" means an earlier start created it: the client adopts it, files and all. One on an older image is replaced.
|
|
57
57
|
let sandbox = await client.createSandbox(spec);
|
|
58
58
|
if (sandbox.image !== context.image) {
|
|
59
|
+
await client.deletePreview(name, VIEW_PREVIEW);
|
|
59
60
|
await client.deleteSandbox(name);
|
|
60
61
|
previewTokens.delete(name);
|
|
61
62
|
sandbox = await client.createSandbox(spec);
|
|
@@ -145,6 +146,8 @@ export function createBlaxelRunner(deps) {
|
|
|
145
146
|
}
|
|
146
147
|
},
|
|
147
148
|
async delete(nodeId) {
|
|
149
|
+
// Blaxel counts a preview against the account quota until the preview itself is deleted; deleting the sandbox alone leaks it.
|
|
150
|
+
await client.deletePreview(sandboxNameFor(nodeId), VIEW_PREVIEW);
|
|
148
151
|
await client.deleteSandbox(sandboxNameFor(nodeId));
|
|
149
152
|
previewTokens.delete(sandboxNameFor(nodeId));
|
|
150
153
|
},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@north-light/api",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.735",
|
|
4
4
|
"description": "Typed crtrd /v1 API contract — DTOs, route builders, the error contract, the CrtrClient, and the command-plugin manifest format. Zero runtime dependencies.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/api/index.js",
|