@blaxel/core 0.2.49-dev.213 → 0.2.49-dev1
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/agents/index.d.ts +15 -0
- package/dist/agents/index.js +109 -0
- package/dist/authentication/apikey.d.ts +10 -0
- package/dist/authentication/apikey.js +24 -0
- package/dist/authentication/clientcredentials.d.ts +17 -0
- package/dist/authentication/clientcredentials.js +85 -0
- package/dist/authentication/credentials.d.ts +6 -0
- package/dist/authentication/credentials.js +17 -0
- package/dist/authentication/deviceMode.d.ts +15 -0
- package/dist/authentication/deviceMode.js +70 -0
- package/dist/authentication/index.d.ts +3 -0
- package/dist/authentication/index.js +62 -0
- package/dist/authentication/types.d.ts +9 -0
- package/dist/authentication/types.js +2 -0
- package/dist/cache/index.d.ts +1 -0
- package/dist/cache/index.js +26 -0
- package/dist/cjs/.tsbuildinfo +1 -1
- package/dist/cjs/agents/index.js +2 -2
- package/dist/cjs/authentication/clientcredentials.js +1 -4
- package/dist/cjs/client/responseInterceptor.js +53 -0
- package/dist/cjs/client/sdk.gen.js +143 -3
- package/dist/cjs/common/autoload.js +7 -0
- package/dist/cjs/common/env.js +3 -0
- package/dist/cjs/common/internal.js +0 -40
- package/dist/cjs/common/settings.js +2 -5
- package/dist/cjs/common/version.js +6 -0
- package/dist/cjs/common/webhook.js +101 -0
- package/dist/cjs/jobs/executions.js +119 -0
- package/dist/cjs/jobs/jobs.js +2 -2
- package/dist/cjs/sandbox/action.js +2 -1
- package/dist/cjs/sandbox/index.js +1 -0
- package/dist/cjs/sandbox/interpreter.js +400 -0
- package/dist/cjs/sandbox/sandbox.js +10 -67
- package/dist/cjs/tools/mcpTool.js +2 -6
- package/dist/cjs/types/client/responseInterceptor.d.ts +12 -0
- package/dist/cjs/types/client/sdk.gen.d.ts +41 -1
- package/dist/cjs/types/client/types.gen.d.ts +599 -16
- package/dist/cjs/types/common/internal.d.ts +0 -2
- package/dist/cjs/types/common/settings.d.ts +0 -1
- package/dist/cjs/types/common/version.d.ts +2 -0
- package/dist/cjs/types/common/webhook.d.ts +89 -0
- package/dist/cjs/types/jobs/executions.d.ts +42 -0
- package/dist/cjs/types/sandbox/client/sdk.gen.d.ts +1 -1
- package/dist/cjs/types/sandbox/index.d.ts +1 -0
- package/dist/cjs/types/sandbox/interpreter.d.ts +71 -0
- package/dist/cjs/types/sandbox/sandbox.d.ts +6 -12
- package/dist/cjs/types/sandbox/types.d.ts +0 -3
- package/dist/cjs-browser/.tsbuildinfo +1 -1
- package/dist/cjs-browser/agents/index.js +2 -2
- package/dist/cjs-browser/authentication/clientcredentials.js +1 -4
- package/dist/cjs-browser/client/responseInterceptor.js +53 -0
- package/dist/cjs-browser/client/sdk.gen.js +143 -3
- package/dist/cjs-browser/common/autoload.js +7 -0
- package/dist/cjs-browser/common/env.js +3 -0
- package/dist/cjs-browser/common/internal.js +0 -40
- package/dist/cjs-browser/common/settings.js +2 -5
- package/dist/cjs-browser/common/version.js +6 -0
- package/dist/cjs-browser/common/webhook.js +101 -0
- package/dist/cjs-browser/jobs/executions.js +119 -0
- package/dist/cjs-browser/jobs/jobs.js +2 -2
- package/dist/cjs-browser/sandbox/action.js +2 -1
- package/dist/cjs-browser/sandbox/index.js +1 -0
- package/dist/cjs-browser/sandbox/interpreter.js +400 -0
- package/dist/cjs-browser/sandbox/sandbox.js +10 -67
- package/dist/cjs-browser/tools/mcpTool.js +2 -6
- package/dist/cjs-browser/types/client/responseInterceptor.d.ts +12 -0
- package/dist/cjs-browser/types/client/sdk.gen.d.ts +41 -1
- package/dist/cjs-browser/types/client/types.gen.d.ts +599 -16
- package/dist/cjs-browser/types/common/internal.d.ts +0 -2
- package/dist/cjs-browser/types/common/settings.d.ts +0 -1
- package/dist/cjs-browser/types/common/version.d.ts +2 -0
- package/dist/cjs-browser/types/common/webhook.d.ts +89 -0
- package/dist/cjs-browser/types/jobs/executions.d.ts +42 -0
- package/dist/cjs-browser/types/sandbox/client/sdk.gen.d.ts +1 -1
- package/dist/cjs-browser/types/sandbox/index.d.ts +1 -0
- package/dist/cjs-browser/types/sandbox/interpreter.d.ts +71 -0
- package/dist/cjs-browser/types/sandbox/sandbox.d.ts +6 -12
- package/dist/cjs-browser/types/sandbox/types.d.ts +0 -3
- package/dist/client/authentication.d.ts +25 -0
- package/dist/client/authentication.js +15 -0
- package/dist/client/client.d.ts +2 -0
- package/dist/client/client.gen.d.ts +12 -0
- package/dist/client/client.gen.js +8 -0
- package/dist/{cjs/sandbox/websocket/index.js → client/client.js} +1 -1
- package/dist/client/index.d.ts +2 -0
- package/dist/client/index.js +19 -0
- package/dist/client/interceptors.d.ts +3 -0
- package/dist/client/interceptors.js +17 -0
- package/dist/client/sdk.gen.d.ts +499 -0
- package/dist/client/sdk.gen.js +1751 -0
- package/dist/client/types.gen.d.ts +4546 -0
- package/dist/client/types.gen.js +4 -0
- package/dist/common/autoload.d.ts +3 -0
- package/dist/common/autoload.js +27 -0
- package/dist/common/env.d.ts +5 -0
- package/dist/common/env.js +42 -0
- package/dist/common/errors.d.ts +1 -0
- package/dist/common/errors.js +17 -0
- package/dist/common/internal.d.ts +4 -0
- package/dist/common/internal.js +188 -0
- package/dist/common/internal.test.d.ts +1 -0
- package/dist/common/internal.test.js +39 -0
- package/dist/common/logger.d.ts +25 -0
- package/dist/common/logger.js +69 -0
- package/dist/common/node.d.ts +5 -0
- package/dist/common/node.js +26 -0
- package/dist/common/settings.d.ts +31 -0
- package/dist/common/settings.js +170 -0
- package/dist/esm/.tsbuildinfo +1 -1
- package/dist/esm/agents/index.js +3 -3
- package/dist/esm/authentication/clientcredentials.js +1 -4
- package/dist/esm/client/responseInterceptor.js +49 -0
- package/dist/esm/client/sdk.gen.js +132 -0
- package/dist/esm/common/autoload.js +7 -0
- package/dist/esm/common/env.js +3 -0
- package/dist/esm/common/internal.js +0 -38
- package/dist/esm/common/settings.js +2 -5
- package/dist/esm/common/version.js +3 -0
- package/dist/esm/common/webhook.js +97 -0
- package/dist/esm/jobs/executions.js +114 -0
- package/dist/esm/jobs/jobs.js +3 -3
- package/dist/esm/sandbox/action.js +3 -2
- package/dist/esm/sandbox/index.js +1 -0
- package/dist/esm/sandbox/interpreter.js +396 -0
- package/dist/esm/sandbox/sandbox.js +10 -67
- package/dist/esm/tools/mcpTool.js +3 -7
- package/dist/esm-browser/.tsbuildinfo +1 -1
- package/dist/esm-browser/agents/index.js +3 -3
- package/dist/esm-browser/authentication/clientcredentials.js +1 -4
- package/dist/esm-browser/client/responseInterceptor.js +49 -0
- package/dist/esm-browser/client/sdk.gen.js +132 -0
- package/dist/esm-browser/common/autoload.js +7 -0
- package/dist/esm-browser/common/env.js +3 -0
- package/dist/esm-browser/common/internal.js +0 -38
- package/dist/esm-browser/common/settings.js +2 -5
- package/dist/esm-browser/common/version.js +3 -0
- package/dist/esm-browser/common/webhook.js +97 -0
- package/dist/esm-browser/jobs/executions.js +114 -0
- package/dist/esm-browser/jobs/jobs.js +3 -3
- package/dist/esm-browser/sandbox/action.js +3 -2
- package/dist/esm-browser/sandbox/index.js +1 -0
- package/dist/esm-browser/sandbox/interpreter.js +396 -0
- package/dist/esm-browser/sandbox/sandbox.js +10 -67
- package/dist/esm-browser/tools/mcpTool.js +3 -7
- package/dist/index.browser.test.d.ts +1 -0
- package/dist/index.browser.test.js +45 -0
- package/dist/index.d.ts +17 -0
- package/dist/index.js +33 -0
- package/dist/jobs/index.d.ts +3 -0
- package/dist/jobs/index.js +19 -0
- package/dist/jobs/jobs.d.ts +13 -0
- package/dist/jobs/jobs.js +90 -0
- package/dist/jobs/start.d.ts +1 -0
- package/dist/jobs/start.js +66 -0
- package/dist/jobs/types.d.ts +3 -0
- package/dist/jobs/types.js +2 -0
- package/dist/mcp/client.d.ts +28 -0
- package/dist/mcp/client.js +247 -0
- package/dist/{cjs-browser/types/sandbox/websocket → mcp}/index.d.ts +1 -0
- package/dist/{cjs-browser/sandbox/websocket → mcp}/index.js +1 -0
- package/dist/mcp/server.d.ts +24 -0
- package/dist/mcp/server.js +213 -0
- package/dist/models/index.d.ts +8 -0
- package/dist/models/index.js +31 -0
- package/dist/sandbox/action.d.ts +19 -0
- package/dist/sandbox/action.js +84 -0
- package/dist/sandbox/client/client.gen.d.ts +12 -0
- package/dist/sandbox/client/client.gen.js +6 -0
- package/dist/sandbox/client/index.d.ts +2 -0
- package/dist/sandbox/client/index.js +19 -0
- package/dist/sandbox/client/sdk.gen.d.ts +101 -0
- package/dist/sandbox/client/sdk.gen.js +289 -0
- package/dist/sandbox/client/types.gen.d.ts +578 -0
- package/dist/sandbox/client/types.gen.js +3 -0
- package/dist/{cjs/types/sandbox/filesystem/filesystem-ws.d.ts → sandbox/filesystem/filesystem.d.ts} +6 -18
- package/dist/sandbox/filesystem/filesystem.js +276 -0
- package/dist/sandbox/filesystem/index.d.ts +2 -0
- package/dist/sandbox/filesystem/index.js +18 -0
- package/dist/sandbox/filesystem/types.d.ts +15 -0
- package/dist/sandbox/filesystem/types.js +2 -0
- package/dist/sandbox/index.d.ts +4 -0
- package/dist/sandbox/index.js +36 -0
- package/dist/sandbox/network/index.d.ts +1 -0
- package/dist/sandbox/network/index.js +17 -0
- package/dist/sandbox/network/network.d.ts +5 -0
- package/dist/sandbox/network/network.js +10 -0
- package/dist/sandbox/preview.d.ts +37 -0
- package/dist/sandbox/preview.js +148 -0
- package/dist/sandbox/process/index.d.ts +1 -0
- package/dist/sandbox/process/index.js +17 -0
- package/dist/sandbox/process/process.d.ts +24 -0
- package/dist/sandbox/process/process.js +189 -0
- package/dist/sandbox/sandbox.d.ts +33 -0
- package/dist/sandbox/sandbox.js +178 -0
- package/dist/sandbox/session.d.ts +27 -0
- package/dist/sandbox/session.js +123 -0
- package/dist/sandbox/types.d.ts +51 -0
- package/dist/sandbox/types.js +81 -0
- package/dist/telemetry/telemetry.d.ts +62 -0
- package/dist/telemetry/telemetry.js +80 -0
- package/dist/tools/index.d.ts +11 -0
- package/dist/tools/index.js +52 -0
- package/dist/tools/mcpTool.d.ts +28 -0
- package/dist/tools/mcpTool.js +218 -0
- package/dist/tools/types.d.ts +8 -0
- package/dist/tools/types.js +2 -0
- package/dist/tools/zodSchema.d.ts +9 -0
- package/dist/tools/zodSchema.js +50 -0
- package/dist/volume/index.d.ts +23 -0
- package/dist/volume/index.js +113 -0
- package/package.json +2 -2
- package/dist/cjs/sandbox/codegen/codegen-ws.js +0 -30
- package/dist/cjs/sandbox/filesystem/filesystem-ws.js +0 -106
- package/dist/cjs/sandbox/network/network-ws.js +0 -12
- package/dist/cjs/sandbox/process/process-ws.js +0 -139
- package/dist/cjs/sandbox/websocket/client.js +0 -269
- package/dist/cjs/types/sandbox/codegen/codegen-ws.d.ts +0 -10
- package/dist/cjs/types/sandbox/network/network-ws.d.ts +0 -7
- package/dist/cjs/types/sandbox/process/process-ws.d.ts +0 -27
- package/dist/cjs/types/sandbox/websocket/client.d.ts +0 -48
- package/dist/cjs/types/sandbox/websocket/index.d.ts +0 -1
- package/dist/cjs-browser/sandbox/codegen/codegen-ws.js +0 -30
- package/dist/cjs-browser/sandbox/filesystem/filesystem-ws.js +0 -106
- package/dist/cjs-browser/sandbox/network/network-ws.js +0 -12
- package/dist/cjs-browser/sandbox/process/process-ws.js +0 -139
- package/dist/cjs-browser/sandbox/websocket/client.js +0 -269
- package/dist/cjs-browser/types/sandbox/codegen/codegen-ws.d.ts +0 -10
- package/dist/cjs-browser/types/sandbox/filesystem/filesystem-ws.d.ts +0 -35
- package/dist/cjs-browser/types/sandbox/network/network-ws.d.ts +0 -7
- package/dist/cjs-browser/types/sandbox/process/process-ws.d.ts +0 -27
- package/dist/cjs-browser/types/sandbox/websocket/client.d.ts +0 -48
- package/dist/esm/sandbox/codegen/codegen-ws.js +0 -26
- package/dist/esm/sandbox/filesystem/filesystem-ws.js +0 -102
- package/dist/esm/sandbox/network/network-ws.js +0 -8
- package/dist/esm/sandbox/process/process-ws.js +0 -135
- package/dist/esm/sandbox/websocket/client.js +0 -265
- package/dist/esm/sandbox/websocket/index.js +0 -1
- package/dist/esm-browser/sandbox/codegen/codegen-ws.js +0 -26
- package/dist/esm-browser/sandbox/filesystem/filesystem-ws.js +0 -102
- package/dist/esm-browser/sandbox/network/network-ws.js +0 -8
- package/dist/esm-browser/sandbox/process/process-ws.js +0 -135
- package/dist/esm-browser/sandbox/websocket/client.js +0 -265
- package/dist/esm-browser/sandbox/websocket/index.js +0 -1
|
@@ -54,13 +54,10 @@ class ClientCredentials extends credentials_js_1.Credentials {
|
|
|
54
54
|
}
|
|
55
55
|
catch (error) {
|
|
56
56
|
if (retry > 0) {
|
|
57
|
-
console.error(`Authentication failed, retrying... (${4 - retry}/3)`, error);
|
|
58
57
|
await this.sleep(1000);
|
|
59
58
|
return this.processWithRetry(retry - 1);
|
|
60
59
|
}
|
|
61
|
-
|
|
62
|
-
const originalMessage = error instanceof Error ? error.message : String(error);
|
|
63
|
-
throw new Error(`Authentication failed after 4 attempts: ${originalMessage}`, { cause: error });
|
|
60
|
+
throw error;
|
|
64
61
|
}
|
|
65
62
|
}
|
|
66
63
|
async process() {
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Response interceptor that enhances authentication error messages (401/403)
|
|
4
|
+
* with a link to the authentication documentation.
|
|
5
|
+
*/
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.responseInterceptors = exports.authenticationErrorInterceptor = void 0;
|
|
8
|
+
/**
|
|
9
|
+
* Intercepts HTTP responses and adds authentication documentation
|
|
10
|
+
* to 401/403 error responses
|
|
11
|
+
*/
|
|
12
|
+
const authenticationErrorInterceptor = async (response) => {
|
|
13
|
+
// Only process authentication errors (401/403)
|
|
14
|
+
if (response.status !== 401 && response.status !== 403) {
|
|
15
|
+
return response;
|
|
16
|
+
}
|
|
17
|
+
// Clone the response so we can modify it
|
|
18
|
+
const clonedResponse = response.clone();
|
|
19
|
+
try {
|
|
20
|
+
// Read the original response body
|
|
21
|
+
const bodyText = await clonedResponse.text();
|
|
22
|
+
// Try to parse as JSON
|
|
23
|
+
let enhancedBody;
|
|
24
|
+
try {
|
|
25
|
+
const originalError = JSON.parse(bodyText);
|
|
26
|
+
// Create enhanced error with authentication documentation
|
|
27
|
+
const authError = {
|
|
28
|
+
...originalError,
|
|
29
|
+
documentation: "For more information on authentication, visit: https://docs.blaxel.ai/sdk-reference/introduction#how-authentication-works",
|
|
30
|
+
};
|
|
31
|
+
enhancedBody = JSON.stringify(authError);
|
|
32
|
+
}
|
|
33
|
+
catch {
|
|
34
|
+
// If not JSON, just append the documentation as text
|
|
35
|
+
enhancedBody = `${bodyText}\nFor more information on authentication, visit: https://docs.blaxel.ai/sdk-reference/introduction#how-authentication-works`;
|
|
36
|
+
}
|
|
37
|
+
// Create a new response with the enhanced body
|
|
38
|
+
return new Response(enhancedBody, {
|
|
39
|
+
status: response.status,
|
|
40
|
+
statusText: response.statusText,
|
|
41
|
+
headers: response.headers,
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
catch (error) {
|
|
45
|
+
// If anything fails, return the original response
|
|
46
|
+
console.error("Error processing authentication error response:", error);
|
|
47
|
+
return response;
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
exports.authenticationErrorInterceptor = authenticationErrorInterceptor;
|
|
51
|
+
exports.responseInterceptors = [
|
|
52
|
+
exports.authenticationErrorInterceptor,
|
|
53
|
+
];
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
// This file is auto-generated by @hey-api/openapi-ts
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.
|
|
5
|
-
exports.
|
|
6
|
-
exports.checkWorkspaceAvailability = exports.leaveWorkspace = exports.acceptWorkspaceInvitation = exports.declineWorkspaceInvitation = void 0;
|
|
4
|
+
exports.listModelRevisions = exports.updateModel = exports.getModel = exports.deleteModel = exports.createModel = exports.listModels = exports.listMcpHubDefinitions = exports.listLocations = exports.listJobRevisions = exports.getJobExecution = exports.deleteJobExecution = exports.createJobExecution = exports.listJobExecutions = exports.updateJob = exports.getJob = exports.deleteJob = exports.createJob = exports.listJobs = exports.getIntegrationConnectionModel = exports.listIntegrationConnectionModels = exports.getIntegrationConnectionModelEndpointConfigurations = exports.updateIntegrationConnection = exports.getIntegrationConnection = exports.deleteIntegrationConnection = exports.createIntegrationConnection = exports.listIntegrationConnections = exports.getIntegration = exports.deleteImageTag = exports.getImage = exports.deleteImage = exports.listImages = exports.listFunctionRevisions = exports.updateFunction = exports.getFunction = exports.deleteFunction = exports.createFunction = exports.listFunctions = exports.verifyCustomDomain = exports.updateCustomDomain = exports.getCustomDomain = exports.deleteCustomDomain = exports.createCustomDomain = exports.listCustomDomains = exports.getConfiguration = exports.listAgentRevisions = exports.updateAgent = exports.getAgent = exports.deleteAgent = exports.createAgent = exports.listAgents = void 0;
|
|
5
|
+
exports.listVolumes = exports.deleteVolumeTemplateVersion = exports.updateVolumeTemplate = exports.getVolumeTemplate = exports.deleteVolumeTemplate = exports.createVolumeTemplate = exports.listVolumeTemplates = exports.updateWorkspaceUserRole = exports.removeWorkspaceUser = exports.inviteWorkspaceUser = exports.listWorkspaceUsers = exports.getTemplate = exports.listTemplates = exports.deleteApiKeyForServiceAccount = exports.createApiKeyForServiceAccount = exports.listApiKeysForServiceAccount = exports.updateWorkspaceServiceAccount = exports.deleteWorkspaceServiceAccount = exports.createWorkspaceServiceAccount = exports.getWorkspaceServiceAccounts = exports.stopSandbox = exports.startSandbox = exports.deleteSandboxPreviewToken = exports.createSandboxPreviewToken = exports.listSandboxPreviewTokens = exports.updateSandboxPreview = exports.getSandboxPreview = exports.deleteSandboxPreview = exports.createSandboxPreview = exports.listSandboxPreviews = exports.updateSandbox = exports.getSandbox = exports.deleteSandbox = exports.createSandbox = exports.listSandboxes = exports.listSandboxHubDefinitions = exports.listPublicIps = exports.listAllPendingInvitations = exports.updatePrivateClusterHealth = exports.getPrivateClusterHealth = exports.updatePrivateCluster = exports.getPrivateCluster = exports.deletePrivateCluster = exports.createPrivateCluster = exports.listPrivateClusters = exports.updatePolicy = exports.getPolicy = exports.deletePolicy = exports.createPolicy = exports.listPolicies = void 0;
|
|
6
|
+
exports.checkWorkspaceAvailability = exports.leaveWorkspace = exports.acceptWorkspaceInvitation = exports.declineWorkspaceInvitation = exports.updateWorkspace = exports.getWorkspace = exports.deleteWorkspace = exports.createWorkspace = exports.listWorkspaces = exports.getVolume = exports.deleteVolume = exports.createVolume = void 0;
|
|
7
7
|
const client_gen_1 = require("./client.gen");
|
|
8
8
|
/**
|
|
9
9
|
* List all agents
|
|
@@ -334,6 +334,74 @@ const listFunctionRevisions = (options) => {
|
|
|
334
334
|
});
|
|
335
335
|
};
|
|
336
336
|
exports.listFunctionRevisions = listFunctionRevisions;
|
|
337
|
+
/**
|
|
338
|
+
* List images
|
|
339
|
+
* Returns a list of all images in the workspace grouped by repository with tags.
|
|
340
|
+
*/
|
|
341
|
+
const listImages = (options) => {
|
|
342
|
+
return (options?.client ?? client_gen_1.client).get({
|
|
343
|
+
security: [
|
|
344
|
+
{
|
|
345
|
+
scheme: 'bearer',
|
|
346
|
+
type: 'http'
|
|
347
|
+
}
|
|
348
|
+
],
|
|
349
|
+
url: '/images',
|
|
350
|
+
...options
|
|
351
|
+
});
|
|
352
|
+
};
|
|
353
|
+
exports.listImages = listImages;
|
|
354
|
+
/**
|
|
355
|
+
* Delete image by name
|
|
356
|
+
* Deletes an image by name.
|
|
357
|
+
*/
|
|
358
|
+
const deleteImage = (options) => {
|
|
359
|
+
return (options.client ?? client_gen_1.client).delete({
|
|
360
|
+
security: [
|
|
361
|
+
{
|
|
362
|
+
scheme: 'bearer',
|
|
363
|
+
type: 'http'
|
|
364
|
+
}
|
|
365
|
+
],
|
|
366
|
+
url: '/images/{resourceType}/{imageName}',
|
|
367
|
+
...options
|
|
368
|
+
});
|
|
369
|
+
};
|
|
370
|
+
exports.deleteImage = deleteImage;
|
|
371
|
+
/**
|
|
372
|
+
* Get image by name
|
|
373
|
+
* Returns an image by name.
|
|
374
|
+
*/
|
|
375
|
+
const getImage = (options) => {
|
|
376
|
+
return (options.client ?? client_gen_1.client).get({
|
|
377
|
+
security: [
|
|
378
|
+
{
|
|
379
|
+
scheme: 'bearer',
|
|
380
|
+
type: 'http'
|
|
381
|
+
}
|
|
382
|
+
],
|
|
383
|
+
url: '/images/{resourceType}/{imageName}',
|
|
384
|
+
...options
|
|
385
|
+
});
|
|
386
|
+
};
|
|
387
|
+
exports.getImage = getImage;
|
|
388
|
+
/**
|
|
389
|
+
* Delete image tag
|
|
390
|
+
* Deletes a specific tag from an image.
|
|
391
|
+
*/
|
|
392
|
+
const deleteImageTag = (options) => {
|
|
393
|
+
return (options.client ?? client_gen_1.client).delete({
|
|
394
|
+
security: [
|
|
395
|
+
{
|
|
396
|
+
scheme: 'bearer',
|
|
397
|
+
type: 'http'
|
|
398
|
+
}
|
|
399
|
+
],
|
|
400
|
+
url: '/images/{resourceType}/{imageName}/tags/{tagName}',
|
|
401
|
+
...options
|
|
402
|
+
});
|
|
403
|
+
};
|
|
404
|
+
exports.deleteImageTag = deleteImageTag;
|
|
337
405
|
/**
|
|
338
406
|
* List integrations connections
|
|
339
407
|
* Returns integration information by name.
|
|
@@ -588,6 +656,78 @@ const updateJob = (options) => {
|
|
|
588
656
|
});
|
|
589
657
|
};
|
|
590
658
|
exports.updateJob = updateJob;
|
|
659
|
+
/**
|
|
660
|
+
* List job executions
|
|
661
|
+
* Returns a list of all executions for a job by name.
|
|
662
|
+
*/
|
|
663
|
+
const listJobExecutions = (options) => {
|
|
664
|
+
return (options.client ?? client_gen_1.client).get({
|
|
665
|
+
security: [
|
|
666
|
+
{
|
|
667
|
+
scheme: 'bearer',
|
|
668
|
+
type: 'http'
|
|
669
|
+
}
|
|
670
|
+
],
|
|
671
|
+
url: '/jobs/{jobId}/executions',
|
|
672
|
+
...options
|
|
673
|
+
});
|
|
674
|
+
};
|
|
675
|
+
exports.listJobExecutions = listJobExecutions;
|
|
676
|
+
/**
|
|
677
|
+
* Create job execution
|
|
678
|
+
* Creates a new execution for a job by name.
|
|
679
|
+
*/
|
|
680
|
+
const createJobExecution = (options) => {
|
|
681
|
+
return (options.client ?? client_gen_1.client).post({
|
|
682
|
+
security: [
|
|
683
|
+
{
|
|
684
|
+
scheme: 'bearer',
|
|
685
|
+
type: 'http'
|
|
686
|
+
}
|
|
687
|
+
],
|
|
688
|
+
url: '/jobs/{jobId}/executions',
|
|
689
|
+
...options,
|
|
690
|
+
headers: {
|
|
691
|
+
'Content-Type': 'application/json',
|
|
692
|
+
...options?.headers
|
|
693
|
+
}
|
|
694
|
+
});
|
|
695
|
+
};
|
|
696
|
+
exports.createJobExecution = createJobExecution;
|
|
697
|
+
/**
|
|
698
|
+
* Delete job execution
|
|
699
|
+
* Stop an execution for a job by name.
|
|
700
|
+
*/
|
|
701
|
+
const deleteJobExecution = (options) => {
|
|
702
|
+
return (options.client ?? client_gen_1.client).delete({
|
|
703
|
+
security: [
|
|
704
|
+
{
|
|
705
|
+
scheme: 'bearer',
|
|
706
|
+
type: 'http'
|
|
707
|
+
}
|
|
708
|
+
],
|
|
709
|
+
url: '/jobs/{jobId}/executions/{executionId}',
|
|
710
|
+
...options
|
|
711
|
+
});
|
|
712
|
+
};
|
|
713
|
+
exports.deleteJobExecution = deleteJobExecution;
|
|
714
|
+
/**
|
|
715
|
+
* Get job execution
|
|
716
|
+
* Returns an execution for a job by name.
|
|
717
|
+
*/
|
|
718
|
+
const getJobExecution = (options) => {
|
|
719
|
+
return (options.client ?? client_gen_1.client).get({
|
|
720
|
+
security: [
|
|
721
|
+
{
|
|
722
|
+
scheme: 'bearer',
|
|
723
|
+
type: 'http'
|
|
724
|
+
}
|
|
725
|
+
],
|
|
726
|
+
url: '/jobs/{jobId}/executions/{executionId}',
|
|
727
|
+
...options
|
|
728
|
+
});
|
|
729
|
+
};
|
|
730
|
+
exports.getJobExecution = getJobExecution;
|
|
591
731
|
/**
|
|
592
732
|
* List job revisions
|
|
593
733
|
* Returns revisions for a job by name.
|
|
@@ -4,17 +4,24 @@ exports.initialize = initialize;
|
|
|
4
4
|
exports.authenticate = authenticate;
|
|
5
5
|
const client_gen_js_1 = require("../client/client.gen.js");
|
|
6
6
|
const interceptors_js_1 = require("../client/interceptors.js");
|
|
7
|
+
const responseInterceptor_js_1 = require("../client/responseInterceptor.js");
|
|
7
8
|
const client_gen_js_2 = require("../sandbox/client/client.gen.js");
|
|
8
9
|
const settings_js_1 = require("./settings.js");
|
|
9
10
|
client_gen_js_1.client.setConfig({
|
|
10
11
|
baseUrl: settings_js_1.settings.baseUrl,
|
|
11
12
|
});
|
|
13
|
+
// Register request interceptors
|
|
12
14
|
for (const interceptor of interceptors_js_1.interceptors) {
|
|
13
15
|
// @ts-expect-error - Interceptor is not typed
|
|
14
16
|
client_gen_js_1.client.interceptors.request.use(interceptor);
|
|
15
17
|
// @ts-expect-error - Interceptor is not typed
|
|
16
18
|
client_gen_js_2.client.interceptors.request.use(interceptor);
|
|
17
19
|
}
|
|
20
|
+
// Register response interceptors for authentication error handling
|
|
21
|
+
for (const interceptor of responseInterceptor_js_1.responseInterceptors) {
|
|
22
|
+
client_gen_js_1.client.interceptors.response.use(interceptor);
|
|
23
|
+
client_gen_js_2.client.interceptors.response.use(interceptor);
|
|
24
|
+
}
|
|
18
25
|
// Allow to set custom configuration for browser environment
|
|
19
26
|
function initialize(config) {
|
|
20
27
|
settings_js_1.settings.setConfig(config);
|
|
@@ -14,6 +14,7 @@ if (node_js_1.fs !== null) {
|
|
|
14
14
|
const configInfos = toml_1.default.parse(configFile);
|
|
15
15
|
for (const key in configInfos.env) {
|
|
16
16
|
configEnv[key] = configInfos.env[key];
|
|
17
|
+
process.env[key] = configInfos.env[key];
|
|
17
18
|
}
|
|
18
19
|
}
|
|
19
20
|
catch {
|
|
@@ -24,6 +25,7 @@ if (node_js_1.fs !== null) {
|
|
|
24
25
|
if (node_js_1.dotenv) {
|
|
25
26
|
const parsed = node_js_1.dotenv.parse(secretFile);
|
|
26
27
|
Object.assign(secretEnv, parsed);
|
|
28
|
+
Object.assign(process.env, parsed);
|
|
27
29
|
}
|
|
28
30
|
else {
|
|
29
31
|
// Simple .env parsing fallback when dotenv is not available
|
|
@@ -32,6 +34,7 @@ if (node_js_1.fs !== null) {
|
|
|
32
34
|
const match = line.match(/^([^=]+)=(.*)$/);
|
|
33
35
|
if (match) {
|
|
34
36
|
secretEnv[match[1].trim()] = match[2].trim();
|
|
37
|
+
process.env[match[1].trim()] = match[2].trim();
|
|
35
38
|
}
|
|
36
39
|
}
|
|
37
40
|
}
|
|
@@ -5,8 +5,6 @@ exports.getAlphanumericLimitedHash = getAlphanumericLimitedHash;
|
|
|
5
5
|
exports.getGlobalUniqueHash = getGlobalUniqueHash;
|
|
6
6
|
exports.pluralize = pluralize;
|
|
7
7
|
exports.getForcedUrl = getForcedUrl;
|
|
8
|
-
exports.getWorkloadTypeShort = getWorkloadTypeShort;
|
|
9
|
-
exports.generateInternalUrl = generateInternalUrl;
|
|
10
8
|
const env_js_1 = require("./env.js");
|
|
11
9
|
// Pure JS MD5 implementation that matches standard crypto MD5
|
|
12
10
|
function md5(input) {
|
|
@@ -188,41 +186,3 @@ function getForcedUrl(type, name) {
|
|
|
188
186
|
}
|
|
189
187
|
return null;
|
|
190
188
|
}
|
|
191
|
-
function getWorkloadTypeShort(type) {
|
|
192
|
-
const lowerType = type.toLowerCase();
|
|
193
|
-
switch (lowerType) {
|
|
194
|
-
case 'agent':
|
|
195
|
-
case 'agents':
|
|
196
|
-
return 'agt';
|
|
197
|
-
case 'mcp':
|
|
198
|
-
case 'mcps':
|
|
199
|
-
case 'function':
|
|
200
|
-
case 'functions':
|
|
201
|
-
return 'mcp';
|
|
202
|
-
case 'sandbox':
|
|
203
|
-
case 'sandboxes':
|
|
204
|
-
return 'sbx';
|
|
205
|
-
case 'job':
|
|
206
|
-
case 'jobs':
|
|
207
|
-
return 'job';
|
|
208
|
-
case 'model':
|
|
209
|
-
case 'models':
|
|
210
|
-
return 'mdl';
|
|
211
|
-
default:
|
|
212
|
-
// fallback to first 3 letters of type
|
|
213
|
-
return lowerType.substring(0, 3);
|
|
214
|
-
}
|
|
215
|
-
}
|
|
216
|
-
function generateInternalUrl(workspace, type, name, env, protocol, hostname, blCloud, workspaceId) {
|
|
217
|
-
if (blCloud && workspaceId) {
|
|
218
|
-
// New cloud format: bl-ENV-WORKLOAD_CALLED_NAME-WORKLOAD_TYPE_SHORT-WORKSPACE_ID
|
|
219
|
-
const workloadTypeShort = getWorkloadTypeShort(type);
|
|
220
|
-
const subdomain = `bl-${env}-${name}-${workloadTypeShort}-${workspaceId}`;
|
|
221
|
-
return `${protocol}://${subdomain}.${hostname}`;
|
|
222
|
-
}
|
|
223
|
-
else {
|
|
224
|
-
// Legacy format: bl-ENV-HASH.internalhostname
|
|
225
|
-
const hash = getGlobalUniqueHash(workspace, type, name);
|
|
226
|
-
return `${protocol}://bl-${env}-${hash}.${hostname}`;
|
|
227
|
-
}
|
|
228
|
-
}
|
|
@@ -10,7 +10,7 @@ function getPackageVersion() {
|
|
|
10
10
|
if (typeof require !== "undefined") {
|
|
11
11
|
// Try to require package.json (Node.js only, gracefully fails in browser)
|
|
12
12
|
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
|
13
|
-
const packageJson = {"version":"0.2.49
|
|
13
|
+
const packageJson = {"version":"0.2.49","commit":"3523e3d6b67057292fade1b12e304be6456fd2bc"};
|
|
14
14
|
return packageJson.version || "unknown";
|
|
15
15
|
}
|
|
16
16
|
else {
|
|
@@ -62,7 +62,7 @@ function getCommitHash() {
|
|
|
62
62
|
if (typeof require !== "undefined") {
|
|
63
63
|
// Try to require package.json and look for commit field (set during build)
|
|
64
64
|
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
|
65
|
-
const packageJson = {"version":"0.2.49
|
|
65
|
+
const packageJson = {"version":"0.2.49","commit":"3523e3d6b67057292fade1b12e304be6456fd2bc"};
|
|
66
66
|
// Check for commit in various possible locations
|
|
67
67
|
const commit = packageJson.commit || packageJson.buildInfo?.commit;
|
|
68
68
|
if (commit) {
|
|
@@ -165,9 +165,6 @@ class Settings {
|
|
|
165
165
|
get blCloud() {
|
|
166
166
|
return env_js_1.env.BL_CLOUD === "true";
|
|
167
167
|
}
|
|
168
|
-
get workspaceId() {
|
|
169
|
-
return env_js_1.env.BL_WORKSPACE_ID || "";
|
|
170
|
-
}
|
|
171
168
|
get generation() {
|
|
172
169
|
return env_js_1.env.BL_GENERATION || "";
|
|
173
170
|
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PACKAGE_COMMIT = exports.PACKAGE_VERSION = void 0;
|
|
4
|
+
// This file is auto-generated during build. Do not edit manually.
|
|
5
|
+
exports.PACKAGE_VERSION = "0.2.49";
|
|
6
|
+
exports.PACKAGE_COMMIT = "4548518514109c742457451a6eb36fa8d054eb9b";
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.verifyWebhookSignature = verifyWebhookSignature;
|
|
4
|
+
exports.verifyWebhookFromRequest = verifyWebhookFromRequest;
|
|
5
|
+
const crypto_1 = require("crypto");
|
|
6
|
+
/**
|
|
7
|
+
* Verify the HMAC-SHA256 signature of a webhook callback from async-sidecar
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```typescript
|
|
11
|
+
* import { verifyWebhookSignature } from '@blaxel/core';
|
|
12
|
+
*
|
|
13
|
+
* // In your Express endpoint
|
|
14
|
+
* app.post('/webhook', express.text({ type: 'application/json' }), (req, res) => {
|
|
15
|
+
* const isValid = verifyWebhookSignature({
|
|
16
|
+
* body: req.body,
|
|
17
|
+
* signature: req.headers['x-blaxel-signature'] as string,
|
|
18
|
+
* secret: process.env.CALLBACK_SECRET!
|
|
19
|
+
* });
|
|
20
|
+
*
|
|
21
|
+
* if (!isValid) {
|
|
22
|
+
* return res.status(401).json({ error: 'Invalid signature' });
|
|
23
|
+
* }
|
|
24
|
+
*
|
|
25
|
+
* const data = JSON.parse(req.body);
|
|
26
|
+
* // Process callback...
|
|
27
|
+
* });
|
|
28
|
+
* ```
|
|
29
|
+
*
|
|
30
|
+
* @param options - Verification options
|
|
31
|
+
* @returns true if the signature is valid, false otherwise
|
|
32
|
+
*/
|
|
33
|
+
function verifyWebhookSignature(options) {
|
|
34
|
+
const { body, signature, secret, timestamp, maxAge = 300 } = options;
|
|
35
|
+
if (!body || !signature || !secret) {
|
|
36
|
+
return false;
|
|
37
|
+
}
|
|
38
|
+
try {
|
|
39
|
+
// Verify timestamp if provided (prevents replay attacks)
|
|
40
|
+
if (timestamp) {
|
|
41
|
+
const requestTime = parseInt(timestamp, 10);
|
|
42
|
+
const currentTime = Math.floor(Date.now() / 1000);
|
|
43
|
+
const age = Math.abs(currentTime - requestTime);
|
|
44
|
+
if (isNaN(requestTime) || age > maxAge) {
|
|
45
|
+
return false;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
// Extract hex signature from "sha256=<hex>" format
|
|
49
|
+
const expectedSignature = signature.replace('sha256=', '');
|
|
50
|
+
// Compute HMAC-SHA256 signature
|
|
51
|
+
const hmac = (0, crypto_1.createHmac)('sha256', secret);
|
|
52
|
+
hmac.update(body);
|
|
53
|
+
const computedSignature = hmac.digest('hex');
|
|
54
|
+
// Timing-safe comparison to prevent timing attacks
|
|
55
|
+
return (0, crypto_1.timingSafeEqual)(Buffer.from(expectedSignature, 'hex'), Buffer.from(computedSignature, 'hex'));
|
|
56
|
+
}
|
|
57
|
+
catch {
|
|
58
|
+
// Invalid signature format or other error
|
|
59
|
+
return false;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Helper to verify webhook from Express request object
|
|
64
|
+
*
|
|
65
|
+
* @example
|
|
66
|
+
* ```typescript
|
|
67
|
+
* import { verifyWebhookFromRequest } from '@blaxel/core';
|
|
68
|
+
* import express from 'express';
|
|
69
|
+
*
|
|
70
|
+
* app.use(express.text({ type: 'application/json' }));
|
|
71
|
+
*
|
|
72
|
+
* app.post('/webhook', (req, res) => {
|
|
73
|
+
* if (!verifyWebhookFromRequest(req, process.env.CALLBACK_SECRET!)) {
|
|
74
|
+
* return res.status(401).json({ error: 'Invalid signature' });
|
|
75
|
+
* }
|
|
76
|
+
*
|
|
77
|
+
* const data = JSON.parse(req.body);
|
|
78
|
+
* console.log('Received callback:', data);
|
|
79
|
+
* res.json({ received: true });
|
|
80
|
+
* });
|
|
81
|
+
* ```
|
|
82
|
+
*
|
|
83
|
+
* @param request - Express request object (must use express.text() middleware)
|
|
84
|
+
* @param secret - The callback secret
|
|
85
|
+
* @param maxAge - Optional maximum age in seconds (default: 300)
|
|
86
|
+
* @returns true if the signature is valid, false otherwise
|
|
87
|
+
*/
|
|
88
|
+
function verifyWebhookFromRequest(request, secret, maxAge) {
|
|
89
|
+
const signature = request.headers['x-blaxel-signature'];
|
|
90
|
+
const timestamp = request.headers['x-blaxel-timestamp'];
|
|
91
|
+
if (typeof signature !== 'string') {
|
|
92
|
+
return false;
|
|
93
|
+
}
|
|
94
|
+
return verifyWebhookSignature({
|
|
95
|
+
body: request.body,
|
|
96
|
+
signature,
|
|
97
|
+
secret,
|
|
98
|
+
timestamp: typeof timestamp === 'string' ? timestamp : undefined,
|
|
99
|
+
maxAge
|
|
100
|
+
});
|
|
101
|
+
}
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.jobExecutions = exports.JobExecutionHelper = void 0;
|
|
4
|
+
const sdk_gen_js_1 = require("../client/sdk.gen.js");
|
|
5
|
+
const logger_js_1 = require("../common/logger.js");
|
|
6
|
+
const settings_js_1 = require("../common/settings.js");
|
|
7
|
+
/**
|
|
8
|
+
* JobExecutionHelper provides convenient methods for working with job executions
|
|
9
|
+
*/
|
|
10
|
+
class JobExecutionHelper {
|
|
11
|
+
jobName;
|
|
12
|
+
constructor(jobName) {
|
|
13
|
+
this.jobName = jobName;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Create a new job execution and return the execution ID
|
|
17
|
+
*/
|
|
18
|
+
async create(request) {
|
|
19
|
+
logger_js_1.logger.debug(`Creating execution for job: ${this.jobName}`);
|
|
20
|
+
const response = await (0, sdk_gen_js_1.createJobExecution)({
|
|
21
|
+
path: {
|
|
22
|
+
jobId: this.jobName,
|
|
23
|
+
},
|
|
24
|
+
body: request,
|
|
25
|
+
headers: settings_js_1.settings.headers,
|
|
26
|
+
});
|
|
27
|
+
if (!response.data) {
|
|
28
|
+
throw new Error("No response data returned from create job execution");
|
|
29
|
+
}
|
|
30
|
+
const execution = response.data;
|
|
31
|
+
if (!execution.metadata?.id) {
|
|
32
|
+
throw new Error("No execution ID returned from create job execution");
|
|
33
|
+
}
|
|
34
|
+
logger_js_1.logger.debug(`Created execution: ${execution.metadata.id}`);
|
|
35
|
+
return execution.metadata.id;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Get a specific job execution by ID
|
|
39
|
+
*/
|
|
40
|
+
async get(executionId) {
|
|
41
|
+
logger_js_1.logger.debug(`Getting execution ${executionId} for job: ${this.jobName}`);
|
|
42
|
+
const response = await (0, sdk_gen_js_1.getJobExecution)({
|
|
43
|
+
path: {
|
|
44
|
+
jobId: this.jobName,
|
|
45
|
+
executionId: executionId,
|
|
46
|
+
},
|
|
47
|
+
headers: settings_js_1.settings.headers,
|
|
48
|
+
});
|
|
49
|
+
if (!response.data) {
|
|
50
|
+
throw new Error(`Execution '${executionId}' not found for job '${this.jobName}'`);
|
|
51
|
+
}
|
|
52
|
+
return response.data;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* List all executions for the job
|
|
56
|
+
*/
|
|
57
|
+
async list() {
|
|
58
|
+
logger_js_1.logger.debug(`Listing executions for job: ${this.jobName}`);
|
|
59
|
+
const response = await (0, sdk_gen_js_1.listJobExecutions)({
|
|
60
|
+
path: {
|
|
61
|
+
jobId: this.jobName,
|
|
62
|
+
},
|
|
63
|
+
headers: settings_js_1.settings.headers,
|
|
64
|
+
});
|
|
65
|
+
return response.data ?? [];
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Get the status of a specific execution
|
|
69
|
+
*/
|
|
70
|
+
async getStatus(executionId) {
|
|
71
|
+
const execution = await this.get(executionId);
|
|
72
|
+
return execution.status ?? "UNKNOWN";
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Delete a specific job execution
|
|
76
|
+
*/
|
|
77
|
+
async delete(executionId) {
|
|
78
|
+
logger_js_1.logger.debug(`Deleting execution ${executionId} for job: ${this.jobName}`);
|
|
79
|
+
await (0, sdk_gen_js_1.deleteJobExecution)({
|
|
80
|
+
path: {
|
|
81
|
+
jobId: this.jobName,
|
|
82
|
+
executionId: executionId,
|
|
83
|
+
},
|
|
84
|
+
headers: settings_js_1.settings.headers,
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Wait for an execution to complete
|
|
89
|
+
* @param executionId The execution ID to wait for
|
|
90
|
+
* @param options.maxWait Maximum time to wait in milliseconds (default: 5 minutes)
|
|
91
|
+
* @param options.interval Polling interval in milliseconds (default: 2 seconds)
|
|
92
|
+
*/
|
|
93
|
+
async waitForCompletion(executionId, options = {}) {
|
|
94
|
+
const maxWait = options.maxWait ?? 300000; // 5 minutes default
|
|
95
|
+
const interval = options.interval ?? 2000; // 2 seconds default
|
|
96
|
+
const startTime = Date.now();
|
|
97
|
+
logger_js_1.logger.debug(`Waiting for execution ${executionId} to complete (max ${maxWait}ms)`);
|
|
98
|
+
while (Date.now() - startTime < maxWait) {
|
|
99
|
+
const execution = await this.get(executionId);
|
|
100
|
+
const status = execution.status;
|
|
101
|
+
// Terminal states
|
|
102
|
+
if (status === "COMPLETED" || status === "FAILED" || status === "CANCELLED") {
|
|
103
|
+
logger_js_1.logger.debug(`Execution ${executionId} finished with status: ${status}`);
|
|
104
|
+
return execution;
|
|
105
|
+
}
|
|
106
|
+
// Wait before polling again
|
|
107
|
+
await new Promise(resolve => setTimeout(resolve, interval));
|
|
108
|
+
}
|
|
109
|
+
throw new Error(`Execution ${executionId} did not complete within ${maxWait}ms`);
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
exports.JobExecutionHelper = JobExecutionHelper;
|
|
113
|
+
/**
|
|
114
|
+
* Factory function to create a JobExecutionHelper
|
|
115
|
+
*/
|
|
116
|
+
const jobExecutions = (jobName) => {
|
|
117
|
+
return new JobExecutionHelper(jobName);
|
|
118
|
+
};
|
|
119
|
+
exports.jobExecutions = jobExecutions;
|
|
@@ -20,8 +20,8 @@ class BlJob {
|
|
|
20
20
|
return new URL(`${settings_js_1.settings.runUrl}/${settings_js_1.settings.workspace}/jobs/${this.jobName}`);
|
|
21
21
|
}
|
|
22
22
|
get internalUrl() {
|
|
23
|
-
const
|
|
24
|
-
return new URL(
|
|
23
|
+
const hash = (0, internal_js_1.getGlobalUniqueHash)(settings_js_1.settings.workspace, "job", this.jobName);
|
|
24
|
+
return new URL(`${settings_js_1.settings.runInternalProtocol}://bl-${settings_js_1.settings.env}-${hash}.${settings_js_1.settings.runInternalHostname}`);
|
|
25
25
|
}
|
|
26
26
|
get forcedUrl() {
|
|
27
27
|
return (0, internal_js_1.getForcedUrl)('job', this.jobName);
|
|
@@ -48,7 +48,8 @@ class SandboxAction {
|
|
|
48
48
|
return this.sandbox.metadata?.url ?? `${settings_js_1.settings.runUrl}/${settings_js_1.settings.workspace}/sandboxes/${this.name}`;
|
|
49
49
|
}
|
|
50
50
|
get internalUrl() {
|
|
51
|
-
|
|
51
|
+
const hash = (0, internal_js_1.getGlobalUniqueHash)(settings_js_1.settings.workspace, "sandbox", this.name);
|
|
52
|
+
return `${settings_js_1.settings.runInternalProtocol}://bl-${settings_js_1.settings.env}-${hash}.${settings_js_1.settings.runInternalHostname}`;
|
|
52
53
|
}
|
|
53
54
|
get client() {
|
|
54
55
|
if (this.sandbox.forceUrl) {
|
|
@@ -36,4 +36,5 @@ __exportStar(require("./filesystem/index.js"), exports);
|
|
|
36
36
|
__exportStar(require("./codegen/index.js"), exports);
|
|
37
37
|
__exportStar(require("./sandbox.js"), exports);
|
|
38
38
|
__exportStar(require("./types.js"), exports);
|
|
39
|
+
__exportStar(require("./interpreter.js"), exports);
|
|
39
40
|
// Re-export everything from client except ClientOptions to avoid conflict
|