@blaxel/core 0.3.29 → 0.3.30-preview.324
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/client/sdk.gen.js +93 -4
- package/dist/cjs/common/lazyInit.js +8 -0
- package/dist/cjs/common/posthog.js +256 -0
- package/dist/cjs/common/settings.js +2 -2
- package/dist/cjs/types/client/sdk.gen.d.ts +26 -1
- package/dist/cjs/types/client/types.gen.d.ts +156 -2
- package/dist/cjs/types/common/posthog.d.ts +51 -0
- package/dist/cjs-browser/.tsbuildinfo +1 -1
- package/dist/cjs-browser/client/sdk.gen.js +93 -4
- package/dist/cjs-browser/common/lazyInit.js +8 -0
- package/dist/cjs-browser/common/posthog.js +256 -0
- package/dist/cjs-browser/common/settings.js +2 -2
- package/dist/cjs-browser/types/client/sdk.gen.d.ts +26 -1
- package/dist/cjs-browser/types/client/types.gen.d.ts +156 -2
- package/dist/cjs-browser/types/common/posthog.d.ts +51 -0
- package/dist/esm/.tsbuildinfo +1 -1
- package/dist/esm/client/sdk.gen.js +84 -0
- package/dist/esm/common/lazyInit.js +8 -0
- package/dist/esm/common/posthog.js +250 -0
- package/dist/esm/common/settings.js +2 -2
- package/dist/esm-browser/.tsbuildinfo +1 -1
- package/dist/esm-browser/client/sdk.gen.js +84 -0
- package/dist/esm-browser/common/lazyInit.js +8 -0
- package/dist/esm-browser/common/posthog.js +250 -0
- package/dist/esm-browser/common/settings.js +2 -2
- package/package.json +2 -2
|
@@ -1,10 +1,10 @@
|
|
|
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.
|
|
7
|
-
exports.checkWorkspaceAvailability = exports.leaveWorkspace = exports.updateWorkspace = exports.getWorkspace = exports.deleteWorkspace = exports.createWorkspace = exports.listWorkspaces = exports.getEgressIp = exports.deleteEgressIp = exports.createEgressIp = exports.listEgressIps = exports.getEgressGateway = exports.deleteEgressGateway = exports.createEgressGateway = exports.listEgressGateways = exports.getVpc = exports.deleteVpc = exports.createVpc = exports.listVpcs = exports.getVolumeByExternalId = exports.updateVolume = void 0;
|
|
4
|
+
exports.listImageShares = exports.getImage = exports.deleteImage = exports.createImage = exports.listImages = exports.cleanupImages = exports.listFunctionRevisions = exports.updateFunction = exports.getFunction = exports.deleteFunction = exports.createFunction = exports.listFunctions = exports.testFeatureFlag = exports.getWorkspaceFeatures = exports.listAllEgressIps = exports.getEgressGatewayUsage = exports.listAllEgressGateways = exports.getDriveJwks = exports.getDriveByExternalId = exports.deleteDriveFolder = exports.createDriveAccessToken = exports.updateDrive = exports.getDrive = exports.deleteDrive = exports.createDrive = exports.listDrives = exports.verifyCustomDomain = exports.unshareCustomDomain = exports.shareCustomDomain = exports.listCustomDomainShares = exports.updateCustomDomain = exports.getCustomDomain = exports.deleteCustomDomain = exports.createCustomDomain = exports.listCustomDomains = exports.getConfiguration = exports.getChangelog = exports.listApplicationRevisions = exports.createApplicationCustomDomain = exports.updateApplication = exports.getApplication = exports.deleteApplication = exports.createApplication = exports.listApplications = exports.listAgentRevisions = exports.updateAgent = exports.getAgent = exports.deleteAgent = exports.createAgent = exports.listAgents = void 0;
|
|
5
|
+
exports.forkSandbox = exports.archiveSandbox = exports.updateSandbox = exports.getSandbox = exports.deleteSandbox = exports.createSandbox = exports.listSandboxes = exports.listSandboxHubDefinitions = exports.listPublicIps = exports.getPolicyUsages = exports.updatePolicy = exports.getPolicy = exports.deletePolicy = exports.createPolicy = exports.listPolicies = exports.declineImageShare = exports.acceptImageShare = exports.listPendingImageShares = exports.listModelRevisions = exports.updateModel = exports.getModel = exports.deleteModel = exports.createModel = exports.listModels = exports.listMcpHubDefinitions = exports.listLocations = exports.listJobRevisions = exports.listJobExecutionTasks = 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.listImageTags = exports.unshareImage = exports.shareImage = void 0;
|
|
6
|
+
exports.updateVolumeTemplate = exports.getVolumeTemplate = exports.deleteVolumeTemplate = exports.createVolumeTemplate = exports.listVolumeTemplates = exports.updateWorkspaceUserRole = exports.removeWorkspaceUser = exports.inviteWorkspaceUser = exports.listWorkspaceUsers = exports.getTemplate = exports.listTemplates = exports.forkSnapshot = exports.getSnapshot = exports.deleteSnapshot = exports.createSnapshot = exports.listSnapshots = exports.deleteApiKeyForServiceAccount = exports.createApiKeyForServiceAccount = exports.listApiKeysForServiceAccount = exports.updateWorkspaceServiceAccount = exports.deleteWorkspaceServiceAccount = exports.createWorkspaceServiceAccount = exports.getWorkspaceServiceAccounts = exports.deleteSecret = exports.upsertSecret = exports.listSecrets = exports.deleteSecretByQuery = exports.getSandboxScheduleMetrics = exports.listSchedules = exports.listScheduleExecutions = exports.getSandboxByExternalId = exports.unarchiveSandbox = exports.restoreSandboxSnapshot = exports.deleteSandboxSnapshot = exports.createSandboxSnapshot = exports.listSandboxSnapshots = exports.updateSandboxSchedule = exports.getSandboxSchedule = exports.deleteSandboxSchedule = exports.createSandboxSchedule = exports.listSandboxSchedules = exports.listSandboxScheduleExecutions = exports.deleteSandboxPreviewToken = exports.createSandboxPreviewToken = exports.listSandboxPreviewTokens = exports.updateSandboxPreview = exports.getSandboxPreview = exports.deleteSandboxPreview = exports.createSandboxPreview = exports.listSandboxPreviews = void 0;
|
|
7
|
+
exports.checkWorkspaceAvailability = exports.leaveWorkspace = exports.updateWorkspace = exports.getWorkspace = exports.deleteWorkspace = exports.createWorkspace = exports.listWorkspaces = exports.getEgressIp = exports.deleteEgressIp = exports.createEgressIp = exports.listEgressIps = exports.getEgressGateway = exports.deleteEgressGateway = exports.createEgressGateway = exports.listEgressGateways = exports.getVpc = exports.deleteVpc = exports.createVpc = exports.listVpcs = exports.getVolumeByExternalId = exports.updateVolume = exports.getVolume = exports.deleteVolume = exports.createVolume = exports.listVolumes = exports.deleteVolumeTemplateVersion = void 0;
|
|
8
8
|
const client_gen_1 = require("./client.gen");
|
|
9
9
|
/**
|
|
10
10
|
* List all agents
|
|
@@ -544,6 +544,23 @@ const createDriveAccessToken = (options) => {
|
|
|
544
544
|
});
|
|
545
545
|
};
|
|
546
546
|
exports.createDriveAccessToken = createDriveAccessToken;
|
|
547
|
+
/**
|
|
548
|
+
* Delete a folder and its contents
|
|
549
|
+
* Deletes a folder and all its contents directly in drive storage. This is synchronous and non-atomic. If it times out or fails, some contents may have been deleted; retry the same path to finish cleanup. An absent folder succeeds. The drive root and internal metadata cannot be deleted.
|
|
550
|
+
*/
|
|
551
|
+
const deleteDriveFolder = (options) => {
|
|
552
|
+
return (options.client ?? client_gen_1.client).delete({
|
|
553
|
+
security: [
|
|
554
|
+
{
|
|
555
|
+
scheme: 'bearer',
|
|
556
|
+
type: 'http'
|
|
557
|
+
}
|
|
558
|
+
],
|
|
559
|
+
url: '/drives/{driveName}/folders',
|
|
560
|
+
...options
|
|
561
|
+
});
|
|
562
|
+
};
|
|
563
|
+
exports.deleteDriveFolder = deleteDriveFolder;
|
|
547
564
|
/**
|
|
548
565
|
* Get drive by external ID
|
|
549
566
|
* Returns a drive matching the given external ID. If no drive is found, returns 404.
|
|
@@ -2188,6 +2205,78 @@ const getSandboxScheduleMetrics = (options) => {
|
|
|
2188
2205
|
});
|
|
2189
2206
|
};
|
|
2190
2207
|
exports.getSandboxScheduleMetrics = getSandboxScheduleMetrics;
|
|
2208
|
+
/**
|
|
2209
|
+
* Delete secret by query
|
|
2210
|
+
* Deletes a secret by name (query parameter) from the workspace.
|
|
2211
|
+
*/
|
|
2212
|
+
const deleteSecretByQuery = (options) => {
|
|
2213
|
+
return (options.client ?? client_gen_1.client).delete({
|
|
2214
|
+
security: [
|
|
2215
|
+
{
|
|
2216
|
+
scheme: 'bearer',
|
|
2217
|
+
type: 'http'
|
|
2218
|
+
}
|
|
2219
|
+
],
|
|
2220
|
+
url: '/secrets',
|
|
2221
|
+
...options
|
|
2222
|
+
});
|
|
2223
|
+
};
|
|
2224
|
+
exports.deleteSecretByQuery = deleteSecretByQuery;
|
|
2225
|
+
/**
|
|
2226
|
+
* List secrets
|
|
2227
|
+
* Lists the secrets of the workspace. Values are write-only and never returned.
|
|
2228
|
+
*/
|
|
2229
|
+
const listSecrets = (options) => {
|
|
2230
|
+
return (options?.client ?? client_gen_1.client).get({
|
|
2231
|
+
security: [
|
|
2232
|
+
{
|
|
2233
|
+
scheme: 'bearer',
|
|
2234
|
+
type: 'http'
|
|
2235
|
+
}
|
|
2236
|
+
],
|
|
2237
|
+
url: '/secrets',
|
|
2238
|
+
...options
|
|
2239
|
+
});
|
|
2240
|
+
};
|
|
2241
|
+
exports.listSecrets = listSecrets;
|
|
2242
|
+
/**
|
|
2243
|
+
* Upsert secret
|
|
2244
|
+
* Creates or updates a secret by name. Each call stores a new immutable version; the latest version is the one resolved by the proxy.
|
|
2245
|
+
*/
|
|
2246
|
+
const upsertSecret = (options) => {
|
|
2247
|
+
return (options.client ?? client_gen_1.client).post({
|
|
2248
|
+
security: [
|
|
2249
|
+
{
|
|
2250
|
+
scheme: 'bearer',
|
|
2251
|
+
type: 'http'
|
|
2252
|
+
}
|
|
2253
|
+
],
|
|
2254
|
+
url: '/secrets',
|
|
2255
|
+
...options,
|
|
2256
|
+
headers: {
|
|
2257
|
+
'Content-Type': 'application/json',
|
|
2258
|
+
...options?.headers
|
|
2259
|
+
}
|
|
2260
|
+
});
|
|
2261
|
+
};
|
|
2262
|
+
exports.upsertSecret = upsertSecret;
|
|
2263
|
+
/**
|
|
2264
|
+
* Delete secret
|
|
2265
|
+
* Deletes a secret and all its versions from the workspace.
|
|
2266
|
+
*/
|
|
2267
|
+
const deleteSecret = (options) => {
|
|
2268
|
+
return (options.client ?? client_gen_1.client).delete({
|
|
2269
|
+
security: [
|
|
2270
|
+
{
|
|
2271
|
+
scheme: 'bearer',
|
|
2272
|
+
type: 'http'
|
|
2273
|
+
}
|
|
2274
|
+
],
|
|
2275
|
+
url: '/secrets/{secretName}',
|
|
2276
|
+
...options
|
|
2277
|
+
});
|
|
2278
|
+
};
|
|
2279
|
+
exports.deleteSecret = deleteSecret;
|
|
2191
2280
|
/**
|
|
2192
2281
|
* List service accounts
|
|
2193
2282
|
* Returns all service accounts in the workspace. Service accounts are machine identities for external systems to authenticate with Blaxel via OAuth or API keys.
|
|
@@ -37,6 +37,7 @@ exports.ensureAutoloaded = ensureAutoloaded;
|
|
|
37
37
|
const client_gen_js_1 = require("../client/client.gen.js");
|
|
38
38
|
const client_gen_js_2 = require("../sandbox/client/client.gen.js");
|
|
39
39
|
const controlPlaneFetch_js_1 = require("./controlPlaneFetch.js");
|
|
40
|
+
const posthog_js_1 = require("./posthog.js");
|
|
40
41
|
const sentry_js_1 = require("./sentry.js");
|
|
41
42
|
const settings_js_1 = require("./settings.js");
|
|
42
43
|
let autoloaded = false;
|
|
@@ -74,6 +75,13 @@ function ensureAutoloaded() {
|
|
|
74
75
|
client_gen_js_2.client.setConfig({ baseUrl: settings_js_1.settings.baseUrl });
|
|
75
76
|
// Initialize Sentry for SDK error tracking.
|
|
76
77
|
(0, sentry_js_1.initSentry)();
|
|
78
|
+
// Track SDK installation (fires once per new version).
|
|
79
|
+
try {
|
|
80
|
+
(0, posthog_js_1.trackSDKInstalled)();
|
|
81
|
+
}
|
|
82
|
+
catch {
|
|
83
|
+
// Silently ignore - telemetry should never break the SDK
|
|
84
|
+
}
|
|
77
85
|
// Background H2 connection warming (Node.js only)
|
|
78
86
|
const isNode = typeof process !== "undefined" && process.versions != null && process.versions.node != null;
|
|
79
87
|
/* eslint-disable */
|
|
@@ -0,0 +1,256 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.POSTHOG_FLUSH_BUDGET_MS = void 0;
|
|
4
|
+
exports.mergeTelemetryState = mergeTelemetryState;
|
|
5
|
+
exports.createSDKInstallTracker = createSDKInstallTracker;
|
|
6
|
+
exports.trackSDKInstalled = trackSDKInstalled;
|
|
7
|
+
const node_js_1 = require("../common/node.js");
|
|
8
|
+
const settings_js_1 = require("./settings.js");
|
|
9
|
+
// PostHog API key injected at build time via build:replace-imports
|
|
10
|
+
const BUILD_POSTHOG_KEY = "";
|
|
11
|
+
// PostHog API endpoint
|
|
12
|
+
const POSTHOG_HOST = "https://us.i.posthog.com";
|
|
13
|
+
/**
|
|
14
|
+
* How long a capture may stay outstanding.
|
|
15
|
+
*
|
|
16
|
+
* Node keeps the event loop alive while a fetch is pending, so this is what a
|
|
17
|
+
* short-lived script waits for before it can exit. A capture against
|
|
18
|
+
* us.i.posthog.com takes ~250-350ms end to end (DNS + TLS handshake + POST), so
|
|
19
|
+
* a second covers the happy path with headroom. The ceiling matters because a
|
|
20
|
+
* version is only recorded after a successful delivery: when the endpoint is
|
|
21
|
+
* unreachable every later run tries again, and networks that silently drop
|
|
22
|
+
* traffic rather than refusing it would otherwise pay the full timeout each
|
|
23
|
+
* time.
|
|
24
|
+
*/
|
|
25
|
+
exports.POSTHOG_FLUSH_BUDGET_MS = 1000;
|
|
26
|
+
/** The single per-language entry this SDK owns in the shared telemetry file. */
|
|
27
|
+
const SDK_STATE_KEY = "typescript";
|
|
28
|
+
let telemetryState = null;
|
|
29
|
+
/**
|
|
30
|
+
* Get the PostHog API key (injected at build time).
|
|
31
|
+
*/
|
|
32
|
+
function getPosthogKey() {
|
|
33
|
+
const key = BUILD_POSTHOG_KEY;
|
|
34
|
+
// If the placeholder was not replaced, treat as empty
|
|
35
|
+
if (!key || key.startsWith("__BUILD_")) {
|
|
36
|
+
return "";
|
|
37
|
+
}
|
|
38
|
+
return key;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Get the telemetry file path.
|
|
42
|
+
*/
|
|
43
|
+
function getTelemetryPath() {
|
|
44
|
+
if (node_js_1.os === null || node_js_1.path === null) {
|
|
45
|
+
return null;
|
|
46
|
+
}
|
|
47
|
+
try {
|
|
48
|
+
return node_js_1.path.join(node_js_1.os.homedir(), ".blaxel", "telemetry.json");
|
|
49
|
+
}
|
|
50
|
+
catch {
|
|
51
|
+
return null;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Load telemetry state from disk.
|
|
56
|
+
*/
|
|
57
|
+
function loadTelemetryState() {
|
|
58
|
+
if (telemetryState !== null) {
|
|
59
|
+
return telemetryState;
|
|
60
|
+
}
|
|
61
|
+
telemetryState = { distinct_id: "", sdks: {} };
|
|
62
|
+
if (node_js_1.fs === null) {
|
|
63
|
+
return telemetryState;
|
|
64
|
+
}
|
|
65
|
+
const telemetryPath = getTelemetryPath();
|
|
66
|
+
if (!telemetryPath) {
|
|
67
|
+
return telemetryState;
|
|
68
|
+
}
|
|
69
|
+
try {
|
|
70
|
+
const data = node_js_1.fs.readFileSync(telemetryPath, "utf8");
|
|
71
|
+
const parsed = JSON.parse(data);
|
|
72
|
+
telemetryState = {
|
|
73
|
+
...parsed,
|
|
74
|
+
distinct_id: parsed.distinct_id || "",
|
|
75
|
+
sdks: parsed.sdks || {},
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
catch {
|
|
79
|
+
// File doesn't exist or is invalid - use defaults
|
|
80
|
+
}
|
|
81
|
+
return telemetryState;
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Combine this process's telemetry snapshot with what is on disk right now.
|
|
85
|
+
*
|
|
86
|
+
* `~/.blaxel/telemetry.json` is shared with the CLI and the Python SDK, and
|
|
87
|
+
* each of them caches it in memory for the lifetime of its process. Writing
|
|
88
|
+
* this snapshot back wholesale would roll back anything the others recorded in
|
|
89
|
+
* the meantime, which makes them re-send their "Installed" event on every later
|
|
90
|
+
* run. Anything already on disk is at least as fresh as what is held here, so
|
|
91
|
+
* it wins, except for the fields this process actually owns.
|
|
92
|
+
*/
|
|
93
|
+
function mergeTelemetryState(onDisk, ours) {
|
|
94
|
+
const merged = { ...ours, ...onDisk };
|
|
95
|
+
// Only re-assert the one language entry this process owns. Writing back the
|
|
96
|
+
// whole cached map would roll back a newer version another SDK recorded
|
|
97
|
+
// after this process started, and that SDK would then re-send its
|
|
98
|
+
// "Installed" event.
|
|
99
|
+
const onDiskSdks = typeof onDisk.sdks === "object" && onDisk.sdks !== null ? onDisk.sdks : {};
|
|
100
|
+
const ownVersion = ours.sdks?.[SDK_STATE_KEY];
|
|
101
|
+
merged.sdks = {
|
|
102
|
+
...onDiskSdks,
|
|
103
|
+
...(ownVersion ? { [SDK_STATE_KEY]: ownVersion } : {}),
|
|
104
|
+
};
|
|
105
|
+
// distinct_id is shared by every writer, so the first one persisted wins.
|
|
106
|
+
// Replacing it would split the same user across two PostHog identities.
|
|
107
|
+
const onDiskId = typeof onDisk.distinct_id === "string" ? onDisk.distinct_id : "";
|
|
108
|
+
merged.distinct_id = onDiskId || ours.distinct_id;
|
|
109
|
+
return merged;
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Save telemetry state to disk, preserving concurrent writes from the CLI and
|
|
113
|
+
* the other SDK.
|
|
114
|
+
*/
|
|
115
|
+
function saveTelemetryState(state) {
|
|
116
|
+
if (node_js_1.fs === null || node_js_1.path === null || node_js_1.os === null) {
|
|
117
|
+
return;
|
|
118
|
+
}
|
|
119
|
+
const telemetryPath = getTelemetryPath();
|
|
120
|
+
if (!telemetryPath) {
|
|
121
|
+
return;
|
|
122
|
+
}
|
|
123
|
+
try {
|
|
124
|
+
const dir = node_js_1.path.dirname(telemetryPath);
|
|
125
|
+
if (!node_js_1.fs.existsSync(dir)) {
|
|
126
|
+
node_js_1.fs.mkdirSync(dir, { recursive: true });
|
|
127
|
+
}
|
|
128
|
+
// Re-read immediately before writing rather than trusting the snapshot
|
|
129
|
+
// loaded when this process started.
|
|
130
|
+
let onDisk = {};
|
|
131
|
+
try {
|
|
132
|
+
const parsed = JSON.parse(node_js_1.fs.readFileSync(telemetryPath, "utf8"));
|
|
133
|
+
if (typeof parsed === "object" && parsed !== null) {
|
|
134
|
+
onDisk = parsed;
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
catch {
|
|
138
|
+
// No readable file yet - this process's state is all there is.
|
|
139
|
+
}
|
|
140
|
+
const merged = mergeTelemetryState(onDisk, state);
|
|
141
|
+
node_js_1.fs.writeFileSync(telemetryPath, JSON.stringify(merged, null, 2), {
|
|
142
|
+
mode: 0o600,
|
|
143
|
+
});
|
|
144
|
+
// Adopt the persisted identity so events match what other writers use.
|
|
145
|
+
if (typeof merged.distinct_id === "string" && merged.distinct_id) {
|
|
146
|
+
state.distinct_id = merged.distinct_id;
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
catch {
|
|
150
|
+
// Silently fail
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
/**
|
|
154
|
+
* Generate a UUID v4 without external dependencies.
|
|
155
|
+
*/
|
|
156
|
+
function generateUUID() {
|
|
157
|
+
const bytes = new Uint8Array(16);
|
|
158
|
+
crypto.getRandomValues(bytes);
|
|
159
|
+
bytes[6] = (bytes[6] & 0x0f) | 0x40; // version 4
|
|
160
|
+
bytes[8] = (bytes[8] & 0x3f) | 0x80; // variant 10
|
|
161
|
+
const hex = Array.from(bytes)
|
|
162
|
+
.map((b) => b.toString(16).padStart(2, "0"))
|
|
163
|
+
.join("");
|
|
164
|
+
return `${hex.slice(0, 8)}-${hex.slice(8, 12)}-${hex.slice(12, 16)}-${hex.slice(16, 20)}-${hex.slice(20)}`;
|
|
165
|
+
}
|
|
166
|
+
/**
|
|
167
|
+
* Get or create a persistent distinct ID for PostHog events.
|
|
168
|
+
*/
|
|
169
|
+
function getDistinctID() {
|
|
170
|
+
const state = loadTelemetryState();
|
|
171
|
+
if (state.distinct_id) {
|
|
172
|
+
return state.distinct_id;
|
|
173
|
+
}
|
|
174
|
+
state.distinct_id = generateUUID();
|
|
175
|
+
saveTelemetryState(state);
|
|
176
|
+
return state.distinct_id;
|
|
177
|
+
}
|
|
178
|
+
/**
|
|
179
|
+
* Create an SDK install tracker. Exported from this internal module so delivery
|
|
180
|
+
* and deduplication behavior can be tested without build-time credentials.
|
|
181
|
+
*/
|
|
182
|
+
function createSDKInstallTracker(options) {
|
|
183
|
+
const pendingVersions = new Set();
|
|
184
|
+
return function track() {
|
|
185
|
+
const apiKey = options.getApiKey();
|
|
186
|
+
if (!apiKey || !options.isTrackingEnabled() || !options.isNode()) {
|
|
187
|
+
return;
|
|
188
|
+
}
|
|
189
|
+
const version = options.getVersion();
|
|
190
|
+
if (!version ||
|
|
191
|
+
version === "unknown" ||
|
|
192
|
+
version === "__BUILD_VERSION__") {
|
|
193
|
+
return;
|
|
194
|
+
}
|
|
195
|
+
const state = options.loadState();
|
|
196
|
+
const stateKey = SDK_STATE_KEY;
|
|
197
|
+
if (state.sdks?.[stateKey] === version || pendingVersions.has(version)) {
|
|
198
|
+
return;
|
|
199
|
+
}
|
|
200
|
+
pendingVersions.add(version);
|
|
201
|
+
return (async () => {
|
|
202
|
+
try {
|
|
203
|
+
const payload = {
|
|
204
|
+
api_key: apiKey,
|
|
205
|
+
event: "Installed SDK",
|
|
206
|
+
distinct_id: options.getDistinctId(),
|
|
207
|
+
timestamp: new Date().toISOString(),
|
|
208
|
+
properties: {
|
|
209
|
+
language: "typescript",
|
|
210
|
+
sdk: "core",
|
|
211
|
+
version,
|
|
212
|
+
},
|
|
213
|
+
};
|
|
214
|
+
const response = await options.fetch(`${POSTHOG_HOST}/capture/`, {
|
|
215
|
+
method: "POST",
|
|
216
|
+
headers: { "Content-Type": "application/json" },
|
|
217
|
+
body: JSON.stringify(payload),
|
|
218
|
+
signal: options.getSignal(),
|
|
219
|
+
});
|
|
220
|
+
if (!response.ok) {
|
|
221
|
+
return;
|
|
222
|
+
}
|
|
223
|
+
state.sdks ??= {};
|
|
224
|
+
state.sdks[stateKey] = version;
|
|
225
|
+
options.saveState(state);
|
|
226
|
+
}
|
|
227
|
+
catch {
|
|
228
|
+
// Telemetry must never break the SDK. A later call may retry.
|
|
229
|
+
}
|
|
230
|
+
finally {
|
|
231
|
+
pendingVersions.delete(version);
|
|
232
|
+
}
|
|
233
|
+
})();
|
|
234
|
+
};
|
|
235
|
+
}
|
|
236
|
+
const sdkInstallTracker = createSDKInstallTracker({
|
|
237
|
+
getApiKey: getPosthogKey,
|
|
238
|
+
isTrackingEnabled: () => settings_js_1.settings.tracking,
|
|
239
|
+
getVersion: () => settings_js_1.settings.version,
|
|
240
|
+
isNode: () => typeof process !== "undefined" && Boolean(process.versions?.node),
|
|
241
|
+
loadState: loadTelemetryState,
|
|
242
|
+
saveState: saveTelemetryState,
|
|
243
|
+
getDistinctId: getDistinctID,
|
|
244
|
+
fetch: (...args) => globalThis.fetch(...args),
|
|
245
|
+
getSignal: () => typeof AbortSignal !== "undefined" &&
|
|
246
|
+
typeof AbortSignal.timeout === "function"
|
|
247
|
+
? AbortSignal.timeout(exports.POSTHOG_FLUSH_BUDGET_MS)
|
|
248
|
+
: undefined,
|
|
249
|
+
});
|
|
250
|
+
/**
|
|
251
|
+
* Track SDK installation. Fires "Installed SDK" once per new version.
|
|
252
|
+
* Called during SDK autoload.
|
|
253
|
+
*/
|
|
254
|
+
function trackSDKInstalled() {
|
|
255
|
+
void sdkInstallTracker();
|
|
256
|
+
}
|
|
@@ -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.
|
|
34
|
-
const BUILD_COMMIT = "
|
|
33
|
+
const BUILD_VERSION = "0.3.30-preview.324";
|
|
34
|
+
const BUILD_COMMIT = "e88b0db8a85b1db102dfedce7af3e5f5ebae1f52";
|
|
35
35
|
const BUILD_SENTRY_DSN = "https://fd5e60e1c9820e1eef5ccebb84a07127@o4508714045276160.ingest.us.sentry.io/4510465864564736";
|
|
36
36
|
const BLAXEL_API_VERSION = "2026-09-22";
|
|
37
37
|
// Bun < 1.3.11 never sends connection-level WINDOW_UPDATE: the pooled h2
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Options as ClientOptions, TDataShape, Client } from '@hey-api/client-fetch';
|
|
2
|
-
import type { ListAgentsData, CreateAgentData, DeleteAgentData, GetAgentData, UpdateAgentData, ListAgentRevisionsData, ListApplicationsData, CreateApplicationData, DeleteApplicationData, GetApplicationData, UpdateApplicationData, CreateApplicationCustomDomainData, ListApplicationRevisionsData, GetChangelogData, GetConfigurationData, ListCustomDomainsData, CreateCustomDomainData, DeleteCustomDomainData, GetCustomDomainData, UpdateCustomDomainData, ListCustomDomainSharesData, ShareCustomDomainData, UnshareCustomDomainData, VerifyCustomDomainData, ListDrivesData, CreateDriveData, DeleteDriveData, GetDriveData, UpdateDriveData, CreateDriveAccessTokenData, GetDriveByExternalIdData, GetDriveJwksData, ListAllEgressGatewaysData, GetEgressGatewayUsageData, ListAllEgressIpsData, GetWorkspaceFeaturesData, TestFeatureFlagData, ListFunctionsData, CreateFunctionData, DeleteFunctionData, GetFunctionData, UpdateFunctionData, ListFunctionRevisionsData, CleanupImagesData, ListImagesData, CreateImageData, DeleteImageData, GetImageData, ListImageSharesData, ShareImageData, ShareImageResponse, UnshareImageData, ListImageTagsData, DeleteImageTagData, DeleteImageTagResponse, GetIntegrationData, ListIntegrationConnectionsData, CreateIntegrationConnectionData, DeleteIntegrationConnectionData, GetIntegrationConnectionData, UpdateIntegrationConnectionData, GetIntegrationConnectionModelEndpointConfigurationsData, ListIntegrationConnectionModelsData, GetIntegrationConnectionModelData, ListJobsData, CreateJobData, DeleteJobData, GetJobData, UpdateJobData, ListJobExecutionsData, CreateJobExecutionData, DeleteJobExecutionData, GetJobExecutionData, ListJobExecutionTasksData, ListJobRevisionsData, ListLocationsData, ListMcpHubDefinitionsData, ListModelsData, CreateModelData, DeleteModelData, GetModelData, UpdateModelData, ListModelRevisionsData, ListPendingImageSharesData, AcceptImageShareData, DeclineImageShareData, ListPoliciesData, CreatePolicyData, DeletePolicyData, GetPolicyData, UpdatePolicyData, GetPolicyUsagesData, ListPublicIpsData, ListSandboxHubDefinitionsData, ListSandboxesData, CreateSandboxData, DeleteSandboxData, GetSandboxData, UpdateSandboxData, ArchiveSandboxData, ForkSandboxData, ListSandboxPreviewsData, CreateSandboxPreviewData, DeleteSandboxPreviewData, GetSandboxPreviewData, UpdateSandboxPreviewData, ListSandboxPreviewTokensData, CreateSandboxPreviewTokenData, DeleteSandboxPreviewTokenData, ListSandboxScheduleExecutionsData, ListSandboxSchedulesData, CreateSandboxScheduleData, DeleteSandboxScheduleData, GetSandboxScheduleData, UpdateSandboxScheduleData, ListSandboxSnapshotsData, CreateSandboxSnapshotData, DeleteSandboxSnapshotData, RestoreSandboxSnapshotData, UnarchiveSandboxData, GetSandboxByExternalIdData, ListScheduleExecutionsData, ListSchedulesData, GetSandboxScheduleMetricsData, GetWorkspaceServiceAccountsData, CreateWorkspaceServiceAccountData, DeleteWorkspaceServiceAccountData, UpdateWorkspaceServiceAccountData, ListApiKeysForServiceAccountData, CreateApiKeyForServiceAccountData, DeleteApiKeyForServiceAccountData, ListSnapshotsData, CreateSnapshotData, DeleteSnapshotData, GetSnapshotData, ForkSnapshotData, ListTemplatesData, GetTemplateData, ListWorkspaceUsersData, InviteWorkspaceUserData, RemoveWorkspaceUserData, UpdateWorkspaceUserRoleData, ListVolumeTemplatesData, CreateVolumeTemplateData, DeleteVolumeTemplateData, GetVolumeTemplateData, UpdateVolumeTemplateData, DeleteVolumeTemplateVersionData, ListVolumesData, CreateVolumeData, DeleteVolumeData, GetVolumeData, UpdateVolumeData, GetVolumeByExternalIdData, ListVpcsData, CreateVpcData, DeleteVpcData, GetVpcData, ListEgressGatewaysData, CreateEgressGatewayData, DeleteEgressGatewayData, GetEgressGatewayData, ListEgressIpsData, CreateEgressIpData, DeleteEgressIpData, GetEgressIpData, ListWorkspacesData, CreateWorkspaceData, DeleteWorkspaceData, GetWorkspaceData, UpdateWorkspaceData, LeaveWorkspaceData, CheckWorkspaceAvailabilityData } from './types.gen.js';
|
|
2
|
+
import type { ListAgentsData, CreateAgentData, DeleteAgentData, GetAgentData, UpdateAgentData, ListAgentRevisionsData, ListApplicationsData, CreateApplicationData, DeleteApplicationData, GetApplicationData, UpdateApplicationData, CreateApplicationCustomDomainData, ListApplicationRevisionsData, GetChangelogData, GetConfigurationData, ListCustomDomainsData, CreateCustomDomainData, DeleteCustomDomainData, GetCustomDomainData, UpdateCustomDomainData, ListCustomDomainSharesData, ShareCustomDomainData, UnshareCustomDomainData, VerifyCustomDomainData, ListDrivesData, CreateDriveData, DeleteDriveData, GetDriveData, UpdateDriveData, CreateDriveAccessTokenData, DeleteDriveFolderData, GetDriveByExternalIdData, GetDriveJwksData, ListAllEgressGatewaysData, GetEgressGatewayUsageData, ListAllEgressIpsData, GetWorkspaceFeaturesData, TestFeatureFlagData, ListFunctionsData, CreateFunctionData, DeleteFunctionData, GetFunctionData, UpdateFunctionData, ListFunctionRevisionsData, CleanupImagesData, ListImagesData, CreateImageData, DeleteImageData, GetImageData, ListImageSharesData, ShareImageData, ShareImageResponse, UnshareImageData, ListImageTagsData, DeleteImageTagData, DeleteImageTagResponse, GetIntegrationData, ListIntegrationConnectionsData, CreateIntegrationConnectionData, DeleteIntegrationConnectionData, GetIntegrationConnectionData, UpdateIntegrationConnectionData, GetIntegrationConnectionModelEndpointConfigurationsData, ListIntegrationConnectionModelsData, GetIntegrationConnectionModelData, ListJobsData, CreateJobData, DeleteJobData, GetJobData, UpdateJobData, ListJobExecutionsData, CreateJobExecutionData, DeleteJobExecutionData, GetJobExecutionData, ListJobExecutionTasksData, ListJobRevisionsData, ListLocationsData, ListMcpHubDefinitionsData, ListModelsData, CreateModelData, DeleteModelData, GetModelData, UpdateModelData, ListModelRevisionsData, ListPendingImageSharesData, AcceptImageShareData, DeclineImageShareData, ListPoliciesData, CreatePolicyData, DeletePolicyData, GetPolicyData, UpdatePolicyData, GetPolicyUsagesData, ListPublicIpsData, ListSandboxHubDefinitionsData, ListSandboxesData, CreateSandboxData, DeleteSandboxData, GetSandboxData, UpdateSandboxData, ArchiveSandboxData, ForkSandboxData, ListSandboxPreviewsData, CreateSandboxPreviewData, DeleteSandboxPreviewData, GetSandboxPreviewData, UpdateSandboxPreviewData, ListSandboxPreviewTokensData, CreateSandboxPreviewTokenData, DeleteSandboxPreviewTokenData, ListSandboxScheduleExecutionsData, ListSandboxSchedulesData, CreateSandboxScheduleData, DeleteSandboxScheduleData, GetSandboxScheduleData, UpdateSandboxScheduleData, ListSandboxSnapshotsData, CreateSandboxSnapshotData, DeleteSandboxSnapshotData, RestoreSandboxSnapshotData, UnarchiveSandboxData, GetSandboxByExternalIdData, ListScheduleExecutionsData, ListSchedulesData, GetSandboxScheduleMetricsData, DeleteSecretByQueryData, ListSecretsData, UpsertSecretData, DeleteSecretData, GetWorkspaceServiceAccountsData, CreateWorkspaceServiceAccountData, DeleteWorkspaceServiceAccountData, UpdateWorkspaceServiceAccountData, ListApiKeysForServiceAccountData, CreateApiKeyForServiceAccountData, DeleteApiKeyForServiceAccountData, ListSnapshotsData, CreateSnapshotData, DeleteSnapshotData, GetSnapshotData, ForkSnapshotData, ListTemplatesData, GetTemplateData, ListWorkspaceUsersData, InviteWorkspaceUserData, RemoveWorkspaceUserData, UpdateWorkspaceUserRoleData, ListVolumeTemplatesData, CreateVolumeTemplateData, DeleteVolumeTemplateData, GetVolumeTemplateData, UpdateVolumeTemplateData, DeleteVolumeTemplateVersionData, ListVolumesData, CreateVolumeData, DeleteVolumeData, GetVolumeData, UpdateVolumeData, GetVolumeByExternalIdData, ListVpcsData, CreateVpcData, DeleteVpcData, GetVpcData, ListEgressGatewaysData, CreateEgressGatewayData, DeleteEgressGatewayData, GetEgressGatewayData, ListEgressIpsData, CreateEgressIpData, DeleteEgressIpData, GetEgressIpData, ListWorkspacesData, CreateWorkspaceData, DeleteWorkspaceData, GetWorkspaceData, UpdateWorkspaceData, LeaveWorkspaceData, CheckWorkspaceAvailabilityData } from './types.gen.js';
|
|
3
3
|
export type Options<TData extends TDataShape = TDataShape, ThrowOnError extends boolean = boolean> = ClientOptions<TData, ThrowOnError> & {
|
|
4
4
|
/**
|
|
5
5
|
* You can provide a client instance returned by `createClient()` instead of
|
|
@@ -165,6 +165,11 @@ export declare const createDriveAccessToken: <ThrowOnError extends boolean = fal
|
|
|
165
165
|
expires_in?: number;
|
|
166
166
|
token_type?: string;
|
|
167
167
|
}, unknown, ThrowOnError>;
|
|
168
|
+
/**
|
|
169
|
+
* Delete a folder and its contents
|
|
170
|
+
* Deletes a folder and all its contents directly in drive storage. This is synchronous and non-atomic. If it times out or fails, some contents may have been deleted; retry the same path to finish cleanup. An absent folder succeeds. The drive root and internal metadata cannot be deleted.
|
|
171
|
+
*/
|
|
172
|
+
export declare const deleteDriveFolder: <ThrowOnError extends boolean = false>(options: Options<DeleteDriveFolderData, ThrowOnError>) => import("@hey-api/client-fetch").RequestResult<void, unknown, ThrowOnError>;
|
|
168
173
|
/**
|
|
169
174
|
* Get drive by external ID
|
|
170
175
|
* Returns a drive matching the given external ID. If no drive is found, returns 404.
|
|
@@ -655,6 +660,26 @@ export declare const listSchedules: <ThrowOnError extends boolean = false>(optio
|
|
|
655
660
|
* Returns active sandbox and scheduling metrics for a UTC minute window. since is inclusive and until is exclusive. The default window is the last 24 hours and the maximum is 7 days. Execution status describes submission acceptance, not process completion. Execution totals begin accumulating when metrics collection is enabled and can lag recent firings briefly.
|
|
656
661
|
*/
|
|
657
662
|
export declare const getSandboxScheduleMetrics: <ThrowOnError extends boolean = false>(options?: Options<GetSandboxScheduleMetricsData, ThrowOnError>) => import("@hey-api/client-fetch").RequestResult<import("./types.gen.js").SandboxScheduleMetrics, unknown, ThrowOnError>;
|
|
663
|
+
/**
|
|
664
|
+
* Delete secret by query
|
|
665
|
+
* Deletes a secret by name (query parameter) from the workspace.
|
|
666
|
+
*/
|
|
667
|
+
export declare const deleteSecretByQuery: <ThrowOnError extends boolean = false>(options: Options<DeleteSecretByQueryData, ThrowOnError>) => import("@hey-api/client-fetch").RequestResult<import("./types.gen.js").Secret, unknown, ThrowOnError>;
|
|
668
|
+
/**
|
|
669
|
+
* List secrets
|
|
670
|
+
* Lists the secrets of the workspace. Values are write-only and never returned.
|
|
671
|
+
*/
|
|
672
|
+
export declare const listSecrets: <ThrowOnError extends boolean = false>(options?: Options<ListSecretsData, ThrowOnError>) => import("@hey-api/client-fetch").RequestResult<import("./types.gen.js").Secret[], unknown, ThrowOnError>;
|
|
673
|
+
/**
|
|
674
|
+
* Upsert secret
|
|
675
|
+
* Creates or updates a secret by name. Each call stores a new immutable version; the latest version is the one resolved by the proxy.
|
|
676
|
+
*/
|
|
677
|
+
export declare const upsertSecret: <ThrowOnError extends boolean = false>(options: Options<UpsertSecretData, ThrowOnError>) => import("@hey-api/client-fetch").RequestResult<import("./types.gen.js").Secret, unknown, ThrowOnError>;
|
|
678
|
+
/**
|
|
679
|
+
* Delete secret
|
|
680
|
+
* Deletes a secret and all its versions from the workspace.
|
|
681
|
+
*/
|
|
682
|
+
export declare const deleteSecret: <ThrowOnError extends boolean = false>(options: Options<DeleteSecretData, ThrowOnError>) => import("@hey-api/client-fetch").RequestResult<import("./types.gen.js").Secret, unknown, ThrowOnError>;
|
|
658
683
|
/**
|
|
659
684
|
* List service accounts
|
|
660
685
|
* Returns all service accounts in the workspace. Service accounts are machine identities for external systems to authenticate with Blaxel via OAuth or API keys.
|