@celestoai/sdk 0.1.0 → 0.1.1
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/README.md +68 -22
- package/dist/chunk-4KVRJSVJ.js +177 -0
- package/dist/chunk-4KVRJSVJ.js.map +1 -0
- package/dist/chunk-N3HU6ONW.js +148 -0
- package/dist/chunk-N3HU6ONW.js.map +1 -0
- package/dist/chunk-OGMV3NFZ.js +164 -0
- package/dist/chunk-OGMV3NFZ.js.map +1 -0
- package/dist/computers/index.cjs +325 -0
- package/dist/computers/index.cjs.map +1 -0
- package/dist/computers/index.d.cts +107 -0
- package/dist/computers/index.d.ts +107 -0
- package/dist/computers/index.js +8 -0
- package/dist/computers/index.js.map +1 -0
- package/dist/config-BTTpuv_b.d.cts +25 -0
- package/dist/config-BTTpuv_b.d.ts +25 -0
- package/dist/gatekeeper/index.cjs +338 -0
- package/dist/gatekeeper/index.cjs.map +1 -0
- package/dist/gatekeeper/index.d.cts +104 -0
- package/dist/gatekeeper/index.d.ts +104 -0
- package/dist/gatekeeper/index.js +8 -0
- package/dist/gatekeeper/index.js.map +1 -0
- package/dist/index.cjs +511 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +31 -0
- package/dist/index.d.ts +31 -0
- package/dist/index.js +28 -0
- package/dist/index.js.map +1 -0
- package/package.json +11 -3
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,511 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/index.ts
|
|
21
|
+
var src_exports = {};
|
|
22
|
+
__export(src_exports, {
|
|
23
|
+
Celesto: () => Celesto,
|
|
24
|
+
CelestoApiError: () => CelestoApiError,
|
|
25
|
+
CelestoError: () => CelestoError,
|
|
26
|
+
CelestoNetworkError: () => CelestoNetworkError,
|
|
27
|
+
ComputersClient: () => ComputersClient,
|
|
28
|
+
GatekeeperClient: () => GatekeeperClient
|
|
29
|
+
});
|
|
30
|
+
module.exports = __toCommonJS(src_exports);
|
|
31
|
+
|
|
32
|
+
// src/core/config.ts
|
|
33
|
+
var DEFAULT_BASE_URL = "https://api.celesto.ai";
|
|
34
|
+
var buildRequestContext = (config) => ({
|
|
35
|
+
fetch: config.fetch ?? fetch,
|
|
36
|
+
baseUrl: config.baseUrl ?? DEFAULT_BASE_URL,
|
|
37
|
+
token: config.token ?? config.apiKey,
|
|
38
|
+
organizationId: config.organizationId,
|
|
39
|
+
userAgent: config.userAgent,
|
|
40
|
+
timeoutMs: config.timeoutMs,
|
|
41
|
+
headers: config.headers
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
// src/core/errors.ts
|
|
45
|
+
var CelestoError = class extends Error {
|
|
46
|
+
constructor(message) {
|
|
47
|
+
super(message);
|
|
48
|
+
this.name = "CelestoError";
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
var CelestoApiError = class extends CelestoError {
|
|
52
|
+
constructor(message, status, data, requestId) {
|
|
53
|
+
super(message);
|
|
54
|
+
this.name = "CelestoApiError";
|
|
55
|
+
this.status = status;
|
|
56
|
+
this.data = data;
|
|
57
|
+
this.requestId = requestId;
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
var CelestoNetworkError = class extends CelestoError {
|
|
61
|
+
constructor(message, cause) {
|
|
62
|
+
super(message);
|
|
63
|
+
this.name = "CelestoNetworkError";
|
|
64
|
+
this.cause = cause;
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
// src/core/http.ts
|
|
69
|
+
var joinUrl = (baseUrl, path) => {
|
|
70
|
+
const trimmedBase = baseUrl.endsWith("/") ? baseUrl.slice(0, -1) : baseUrl;
|
|
71
|
+
const normalizedPath = path.startsWith("/") ? path : `/${path}`;
|
|
72
|
+
return `${trimmedBase}${normalizedPath}`;
|
|
73
|
+
};
|
|
74
|
+
var buildQuery = (query) => {
|
|
75
|
+
if (!query) {
|
|
76
|
+
return "";
|
|
77
|
+
}
|
|
78
|
+
const params = new URLSearchParams();
|
|
79
|
+
for (const [key, value] of Object.entries(query)) {
|
|
80
|
+
if (value === void 0 || value === null) {
|
|
81
|
+
continue;
|
|
82
|
+
}
|
|
83
|
+
if (Array.isArray(value)) {
|
|
84
|
+
for (const item of value) {
|
|
85
|
+
params.append(key, String(item));
|
|
86
|
+
}
|
|
87
|
+
continue;
|
|
88
|
+
}
|
|
89
|
+
params.set(key, String(value));
|
|
90
|
+
}
|
|
91
|
+
const serialized = params.toString();
|
|
92
|
+
return serialized ? `?${serialized}` : "";
|
|
93
|
+
};
|
|
94
|
+
var parseResponseBody = async (response) => {
|
|
95
|
+
if (response.status === 204) {
|
|
96
|
+
return void 0;
|
|
97
|
+
}
|
|
98
|
+
const contentType = response.headers.get("content-type") ?? "";
|
|
99
|
+
if (contentType.includes("application/json")) {
|
|
100
|
+
return response.json();
|
|
101
|
+
}
|
|
102
|
+
return response.text();
|
|
103
|
+
};
|
|
104
|
+
var extractErrorMessage = (data, status) => {
|
|
105
|
+
if (data && typeof data === "object") {
|
|
106
|
+
const record = data;
|
|
107
|
+
if (typeof record.detail === "string") {
|
|
108
|
+
return record.detail;
|
|
109
|
+
}
|
|
110
|
+
if (typeof record.message === "string") {
|
|
111
|
+
return record.message;
|
|
112
|
+
}
|
|
113
|
+
if (typeof record.error === "string") {
|
|
114
|
+
return record.error;
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
return `Request failed with status ${status}`;
|
|
118
|
+
};
|
|
119
|
+
var request = async (ctx, options) => {
|
|
120
|
+
const url = `${joinUrl(ctx.baseUrl, options.path)}${buildQuery(options.query)}`;
|
|
121
|
+
const headers = {
|
|
122
|
+
...ctx.headers ?? {},
|
|
123
|
+
...options.headers ?? {}
|
|
124
|
+
};
|
|
125
|
+
if (ctx.token) {
|
|
126
|
+
headers.Authorization = `Bearer ${ctx.token}`;
|
|
127
|
+
}
|
|
128
|
+
if (ctx.organizationId) {
|
|
129
|
+
headers["X-Current-Organization"] = ctx.organizationId;
|
|
130
|
+
}
|
|
131
|
+
if (ctx.userAgent && !headers["User-Agent"]) {
|
|
132
|
+
headers["User-Agent"] = ctx.userAgent;
|
|
133
|
+
}
|
|
134
|
+
const init = {
|
|
135
|
+
method: options.method,
|
|
136
|
+
headers,
|
|
137
|
+
body: void 0,
|
|
138
|
+
signal: options.signal
|
|
139
|
+
};
|
|
140
|
+
if (options.body !== void 0) {
|
|
141
|
+
headers["Content-Type"] = headers["Content-Type"] ?? "application/json";
|
|
142
|
+
init.body = headers["Content-Type"].includes("application/json") ? JSON.stringify(options.body) : options.body;
|
|
143
|
+
}
|
|
144
|
+
let timeoutId;
|
|
145
|
+
let controller;
|
|
146
|
+
if (!options.signal && ctx.timeoutMs && ctx.timeoutMs > 0) {
|
|
147
|
+
controller = new AbortController();
|
|
148
|
+
timeoutId = setTimeout(() => controller?.abort(), ctx.timeoutMs);
|
|
149
|
+
init.signal = controller.signal;
|
|
150
|
+
}
|
|
151
|
+
try {
|
|
152
|
+
const response = await ctx.fetch(url, init);
|
|
153
|
+
const data = await parseResponseBody(response);
|
|
154
|
+
if (!response.ok) {
|
|
155
|
+
const message = extractErrorMessage(data, response.status);
|
|
156
|
+
throw new CelestoApiError(message, response.status, data, response.headers.get("x-request-id") ?? void 0);
|
|
157
|
+
}
|
|
158
|
+
return data;
|
|
159
|
+
} catch (err) {
|
|
160
|
+
if (err instanceof CelestoApiError) {
|
|
161
|
+
throw err;
|
|
162
|
+
}
|
|
163
|
+
const error = err instanceof Error ? err : new Error(String(err));
|
|
164
|
+
throw new CelestoNetworkError(error.message, error);
|
|
165
|
+
} finally {
|
|
166
|
+
if (timeoutId) {
|
|
167
|
+
clearTimeout(timeoutId);
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
};
|
|
171
|
+
|
|
172
|
+
// src/computers/client.ts
|
|
173
|
+
var toConnection = (payload) => {
|
|
174
|
+
if (!payload) {
|
|
175
|
+
return void 0;
|
|
176
|
+
}
|
|
177
|
+
const out = {};
|
|
178
|
+
if (payload.ssh != null) {
|
|
179
|
+
out.ssh = payload.ssh;
|
|
180
|
+
}
|
|
181
|
+
if (payload.access_url != null) {
|
|
182
|
+
out.accessUrl = payload.access_url;
|
|
183
|
+
}
|
|
184
|
+
return out;
|
|
185
|
+
};
|
|
186
|
+
var toComputerInfo = (payload) => ({
|
|
187
|
+
id: payload.id,
|
|
188
|
+
name: payload.name,
|
|
189
|
+
status: payload.status,
|
|
190
|
+
vcpus: payload.vcpus,
|
|
191
|
+
ramMb: payload.ram_mb,
|
|
192
|
+
image: payload.image,
|
|
193
|
+
connection: toConnection(payload.connection),
|
|
194
|
+
lastError: payload.last_error ?? null,
|
|
195
|
+
createdAt: payload.created_at,
|
|
196
|
+
stoppedAt: payload.stopped_at ?? null
|
|
197
|
+
});
|
|
198
|
+
var toExecResponse = (payload) => ({
|
|
199
|
+
exitCode: payload.exit_code,
|
|
200
|
+
stdout: payload.stdout,
|
|
201
|
+
stderr: payload.stderr
|
|
202
|
+
});
|
|
203
|
+
var computersPath = (path) => `/v1/computers${path}`;
|
|
204
|
+
var pickOverrides = (options) => ({
|
|
205
|
+
headers: options?.headers,
|
|
206
|
+
signal: options?.signal
|
|
207
|
+
});
|
|
208
|
+
var ComputersClient = class {
|
|
209
|
+
constructor(config) {
|
|
210
|
+
this.config = config;
|
|
211
|
+
}
|
|
212
|
+
async create(params = {}, options) {
|
|
213
|
+
const ctx = buildRequestContext(this.config);
|
|
214
|
+
const data = await request(ctx, {
|
|
215
|
+
method: "POST",
|
|
216
|
+
path: computersPath(""),
|
|
217
|
+
body: {
|
|
218
|
+
vcpus: params.cpus ?? 1,
|
|
219
|
+
ram_mb: params.memory ?? 1024,
|
|
220
|
+
image: params.image ?? "ubuntu-desktop-24.04"
|
|
221
|
+
},
|
|
222
|
+
...pickOverrides(options)
|
|
223
|
+
});
|
|
224
|
+
return toComputerInfo(data);
|
|
225
|
+
}
|
|
226
|
+
async list(options) {
|
|
227
|
+
const ctx = buildRequestContext(this.config);
|
|
228
|
+
const data = await request(ctx, {
|
|
229
|
+
method: "GET",
|
|
230
|
+
path: computersPath(""),
|
|
231
|
+
...pickOverrides(options)
|
|
232
|
+
});
|
|
233
|
+
return {
|
|
234
|
+
computers: data.computers.map(toComputerInfo),
|
|
235
|
+
count: data.count
|
|
236
|
+
};
|
|
237
|
+
}
|
|
238
|
+
async get(computerId, options) {
|
|
239
|
+
const ctx = buildRequestContext(this.config);
|
|
240
|
+
const data = await request(ctx, {
|
|
241
|
+
method: "GET",
|
|
242
|
+
path: computersPath(`/${encodeURIComponent(computerId)}`),
|
|
243
|
+
...pickOverrides(options)
|
|
244
|
+
});
|
|
245
|
+
return toComputerInfo(data);
|
|
246
|
+
}
|
|
247
|
+
async exec(computerId, command, params = {}, options) {
|
|
248
|
+
const ctx = buildRequestContext(this.config);
|
|
249
|
+
const data = await request(ctx, {
|
|
250
|
+
method: "POST",
|
|
251
|
+
path: computersPath(`/${encodeURIComponent(computerId)}/exec`),
|
|
252
|
+
body: {
|
|
253
|
+
command,
|
|
254
|
+
timeout: params.timeout ?? 30
|
|
255
|
+
},
|
|
256
|
+
...pickOverrides(options)
|
|
257
|
+
});
|
|
258
|
+
return toExecResponse(data);
|
|
259
|
+
}
|
|
260
|
+
async stop(computerId, options) {
|
|
261
|
+
const ctx = buildRequestContext(this.config);
|
|
262
|
+
const data = await request(ctx, {
|
|
263
|
+
method: "POST",
|
|
264
|
+
path: computersPath(`/${encodeURIComponent(computerId)}/stop`),
|
|
265
|
+
...pickOverrides(options)
|
|
266
|
+
});
|
|
267
|
+
return toComputerInfo(data);
|
|
268
|
+
}
|
|
269
|
+
async start(computerId, options) {
|
|
270
|
+
const ctx = buildRequestContext(this.config);
|
|
271
|
+
const data = await request(ctx, {
|
|
272
|
+
method: "POST",
|
|
273
|
+
path: computersPath(`/${encodeURIComponent(computerId)}/start`),
|
|
274
|
+
...pickOverrides(options)
|
|
275
|
+
});
|
|
276
|
+
return toComputerInfo(data);
|
|
277
|
+
}
|
|
278
|
+
async delete(computerId, options) {
|
|
279
|
+
const ctx = buildRequestContext(this.config);
|
|
280
|
+
const data = await request(ctx, {
|
|
281
|
+
method: "DELETE",
|
|
282
|
+
path: computersPath(`/${encodeURIComponent(computerId)}`),
|
|
283
|
+
...pickOverrides(options)
|
|
284
|
+
});
|
|
285
|
+
return toComputerInfo(data);
|
|
286
|
+
}
|
|
287
|
+
/**
|
|
288
|
+
* Get connection info for opening a WebSocket terminal session.
|
|
289
|
+
*
|
|
290
|
+
* Accepts either a computer ID (e.g. `cmp_xxx`) or a human-readable name.
|
|
291
|
+
* The name is resolved to the canonical ID via a GET call — the backend's
|
|
292
|
+
* WebSocket endpoint does not resolve names on its own.
|
|
293
|
+
*
|
|
294
|
+
* Returns the URL, headers, and first message needed to open the connection
|
|
295
|
+
* with any WebSocket library of your choice.
|
|
296
|
+
*
|
|
297
|
+
* @example
|
|
298
|
+
* ```ts
|
|
299
|
+
* const conn = await celesto.computers.getTerminalConnection("my-computer");
|
|
300
|
+
* const ws = new WebSocket(conn.url, { headers: conn.headers });
|
|
301
|
+
* ws.on("open", () => ws.send(conn.firstMessage));
|
|
302
|
+
* ws.on("message", (data) => process.stdout.write(data));
|
|
303
|
+
* ```
|
|
304
|
+
*/
|
|
305
|
+
async getTerminalConnection(computerIdOrName) {
|
|
306
|
+
const info = await this.get(computerIdOrName);
|
|
307
|
+
const ctx = buildRequestContext(this.config);
|
|
308
|
+
if (!ctx.token) {
|
|
309
|
+
throw new Error("A token is required for terminal connections");
|
|
310
|
+
}
|
|
311
|
+
const wsBase = ctx.baseUrl.replace(/^https:/i, "wss:").replace(/^http:/i, "ws:");
|
|
312
|
+
const url = `${wsBase}/v1/computers/${encodeURIComponent(info.id)}/terminal`;
|
|
313
|
+
const headers = {
|
|
314
|
+
Authorization: `Bearer ${ctx.token}`
|
|
315
|
+
};
|
|
316
|
+
if (ctx.organizationId) {
|
|
317
|
+
headers["X-Current-Organization"] = ctx.organizationId;
|
|
318
|
+
}
|
|
319
|
+
return {
|
|
320
|
+
url,
|
|
321
|
+
headers,
|
|
322
|
+
firstMessage: JSON.stringify({ token: ctx.token })
|
|
323
|
+
};
|
|
324
|
+
}
|
|
325
|
+
};
|
|
326
|
+
|
|
327
|
+
// src/gatekeeper/client.ts
|
|
328
|
+
var toConnectRequest = (payload) => ({
|
|
329
|
+
subject: payload.subject,
|
|
330
|
+
provider: payload.provider ?? "google_drive",
|
|
331
|
+
project_name: payload.projectName,
|
|
332
|
+
redirect_uri: payload.redirectUri
|
|
333
|
+
});
|
|
334
|
+
var toConnectResponse = (payload) => ({
|
|
335
|
+
status: payload.status,
|
|
336
|
+
oauthUrl: payload.oauth_url ?? void 0,
|
|
337
|
+
connectionId: payload.connection_id ?? void 0
|
|
338
|
+
});
|
|
339
|
+
var toConnection2 = (payload) => ({
|
|
340
|
+
id: payload.id,
|
|
341
|
+
subject: payload.subject,
|
|
342
|
+
provider: payload.provider,
|
|
343
|
+
projectId: payload.project_id,
|
|
344
|
+
accountEmail: payload.account_email ?? null,
|
|
345
|
+
scopes: payload.scopes ?? [],
|
|
346
|
+
status: payload.status,
|
|
347
|
+
createdAt: payload.created_at,
|
|
348
|
+
updatedAt: payload.updated_at,
|
|
349
|
+
lastUsedAt: payload.last_used_at ?? null,
|
|
350
|
+
accessRules: payload.access_rules ? {
|
|
351
|
+
version: payload.access_rules.version ?? "1",
|
|
352
|
+
allowedFolders: payload.access_rules.allowed_folders ?? [],
|
|
353
|
+
allowedFiles: payload.access_rules.allowed_files ?? [],
|
|
354
|
+
unrestricted: false
|
|
355
|
+
} : null
|
|
356
|
+
});
|
|
357
|
+
var toAccessRules = (payload) => ({
|
|
358
|
+
version: payload.version,
|
|
359
|
+
allowedFolders: payload.allowed_folders ?? [],
|
|
360
|
+
allowedFiles: payload.allowed_files ?? [],
|
|
361
|
+
unrestricted: payload.unrestricted
|
|
362
|
+
});
|
|
363
|
+
var toDriveFile = (payload) => ({
|
|
364
|
+
id: payload.id,
|
|
365
|
+
name: payload.name ?? null,
|
|
366
|
+
mimeType: payload.mime_type ?? null,
|
|
367
|
+
size: payload.size ?? null,
|
|
368
|
+
modifiedTime: payload.modified_time ?? null,
|
|
369
|
+
createdTime: payload.created_time ?? null,
|
|
370
|
+
webViewLink: payload.web_view_link ?? null,
|
|
371
|
+
iconLink: payload.icon_link ?? null,
|
|
372
|
+
thumbnailLink: payload.thumbnail_link ?? null,
|
|
373
|
+
parents: payload.parents ?? null,
|
|
374
|
+
driveId: payload.drive_id ?? null,
|
|
375
|
+
shared: payload.shared ?? null,
|
|
376
|
+
ownedByMe: payload.owned_by_me ?? null
|
|
377
|
+
});
|
|
378
|
+
var gatekeeperPath = (path) => `/v1/gatekeeper${path}`;
|
|
379
|
+
var pickOverrides2 = (options) => ({
|
|
380
|
+
headers: options?.headers,
|
|
381
|
+
signal: options?.signal
|
|
382
|
+
});
|
|
383
|
+
var GatekeeperClient = class {
|
|
384
|
+
constructor(config) {
|
|
385
|
+
this.config = config;
|
|
386
|
+
}
|
|
387
|
+
async connect(payload, options) {
|
|
388
|
+
const ctx = buildRequestContext(this.config);
|
|
389
|
+
const data = await request(ctx, {
|
|
390
|
+
method: "POST",
|
|
391
|
+
path: gatekeeperPath("/connect"),
|
|
392
|
+
body: toConnectRequest(payload),
|
|
393
|
+
...pickOverrides2(options)
|
|
394
|
+
});
|
|
395
|
+
return toConnectResponse(data);
|
|
396
|
+
}
|
|
397
|
+
async listConnections(params, options) {
|
|
398
|
+
const ctx = buildRequestContext(this.config);
|
|
399
|
+
const data = await request(ctx, {
|
|
400
|
+
method: "GET",
|
|
401
|
+
path: gatekeeperPath("/connections"),
|
|
402
|
+
query: {
|
|
403
|
+
project_name: params.projectName,
|
|
404
|
+
status_filter: params.statusFilter
|
|
405
|
+
},
|
|
406
|
+
...pickOverrides2(options)
|
|
407
|
+
});
|
|
408
|
+
return {
|
|
409
|
+
total: data.total,
|
|
410
|
+
data: data.data.map(toConnection2)
|
|
411
|
+
};
|
|
412
|
+
}
|
|
413
|
+
async getConnection(connectionId, options) {
|
|
414
|
+
const ctx = buildRequestContext(this.config);
|
|
415
|
+
const data = await request(ctx, {
|
|
416
|
+
method: "GET",
|
|
417
|
+
path: gatekeeperPath(`/connections/${connectionId}`),
|
|
418
|
+
...pickOverrides2(options)
|
|
419
|
+
});
|
|
420
|
+
return toConnection2(data);
|
|
421
|
+
}
|
|
422
|
+
async revokeConnection(params, options) {
|
|
423
|
+
const ctx = buildRequestContext(this.config);
|
|
424
|
+
return request(ctx, {
|
|
425
|
+
method: "DELETE",
|
|
426
|
+
path: gatekeeperPath("/connections"),
|
|
427
|
+
query: {
|
|
428
|
+
subject: params.subject,
|
|
429
|
+
project_name: params.projectName,
|
|
430
|
+
provider: params.provider
|
|
431
|
+
},
|
|
432
|
+
...pickOverrides2(options)
|
|
433
|
+
});
|
|
434
|
+
}
|
|
435
|
+
async listDriveFiles(params, options) {
|
|
436
|
+
const ctx = buildRequestContext(this.config);
|
|
437
|
+
const data = await request(ctx, {
|
|
438
|
+
method: "GET",
|
|
439
|
+
path: gatekeeperPath("/connectors/drive/files"),
|
|
440
|
+
query: {
|
|
441
|
+
project_name: params.projectName,
|
|
442
|
+
subject: params.subject,
|
|
443
|
+
page_size: params.pageSize,
|
|
444
|
+
page_token: params.pageToken,
|
|
445
|
+
folder_id: params.folderId,
|
|
446
|
+
query: params.query,
|
|
447
|
+
include_folders: params.includeFolders,
|
|
448
|
+
order_by: params.orderBy
|
|
449
|
+
},
|
|
450
|
+
...pickOverrides2(options)
|
|
451
|
+
});
|
|
452
|
+
return {
|
|
453
|
+
files: data.files.map(toDriveFile),
|
|
454
|
+
nextPageToken: data.next_page_token ?? null
|
|
455
|
+
};
|
|
456
|
+
}
|
|
457
|
+
async getAccessRules(connectionId, options) {
|
|
458
|
+
const ctx = buildRequestContext(this.config);
|
|
459
|
+
const data = await request(ctx, {
|
|
460
|
+
method: "GET",
|
|
461
|
+
path: gatekeeperPath(`/connections/${connectionId}/access-rules`),
|
|
462
|
+
...pickOverrides2(options)
|
|
463
|
+
});
|
|
464
|
+
return toAccessRules(data);
|
|
465
|
+
}
|
|
466
|
+
async updateAccessRules(params, options) {
|
|
467
|
+
const ctx = buildRequestContext(this.config);
|
|
468
|
+
const data = await request(ctx, {
|
|
469
|
+
method: "PUT",
|
|
470
|
+
path: gatekeeperPath("/connections/access-rules"),
|
|
471
|
+
query: {
|
|
472
|
+
subject: params.subject,
|
|
473
|
+
project_name: params.projectName,
|
|
474
|
+
provider: params.provider
|
|
475
|
+
},
|
|
476
|
+
body: {
|
|
477
|
+
allowed_folders: params.accessRules.allowedFolders ?? [],
|
|
478
|
+
allowed_files: params.accessRules.allowedFiles ?? []
|
|
479
|
+
},
|
|
480
|
+
...pickOverrides2(options)
|
|
481
|
+
});
|
|
482
|
+
return toAccessRules(data);
|
|
483
|
+
}
|
|
484
|
+
async clearAccessRules(connectionId, options) {
|
|
485
|
+
const ctx = buildRequestContext(this.config);
|
|
486
|
+
const data = await request(ctx, {
|
|
487
|
+
method: "DELETE",
|
|
488
|
+
path: gatekeeperPath(`/connections/${connectionId}/access-rules`),
|
|
489
|
+
...pickOverrides2(options)
|
|
490
|
+
});
|
|
491
|
+
return toAccessRules(data);
|
|
492
|
+
}
|
|
493
|
+
};
|
|
494
|
+
|
|
495
|
+
// src/index.ts
|
|
496
|
+
var Celesto = class {
|
|
497
|
+
constructor(config) {
|
|
498
|
+
this.gatekeeper = new GatekeeperClient(config);
|
|
499
|
+
this.computers = new ComputersClient(config);
|
|
500
|
+
}
|
|
501
|
+
};
|
|
502
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
503
|
+
0 && (module.exports = {
|
|
504
|
+
Celesto,
|
|
505
|
+
CelestoApiError,
|
|
506
|
+
CelestoError,
|
|
507
|
+
CelestoNetworkError,
|
|
508
|
+
ComputersClient,
|
|
509
|
+
GatekeeperClient
|
|
510
|
+
});
|
|
511
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../src/core/config.ts","../src/core/errors.ts","../src/core/http.ts","../src/computers/client.ts","../src/gatekeeper/client.ts"],"sourcesContent":["import { ComputersClient } from \"./computers\";\nimport { GatekeeperClient } from \"./gatekeeper\";\nimport type { ClientConfig } from \"./core/config\";\n\nexport { GatekeeperClient } from \"./gatekeeper\";\nexport type {\n GatekeeperAccessRules,\n GatekeeperAccessRulesParams,\n GatekeeperAccessRulesUpdate,\n GatekeeperConnectRequest,\n GatekeeperConnectResponse,\n GatekeeperConnection,\n GatekeeperDriveFile,\n GatekeeperDriveListParams,\n GatekeeperDriveListResponse,\n GatekeeperListConnectionsParams,\n GatekeeperListConnectionsResponse,\n GatekeeperRevokeParams,\n GatekeeperRevokeResponse,\n} from \"./gatekeeper\";\nexport { ComputersClient } from \"./computers\";\nexport type {\n ComputerConnectionInfo,\n ComputerExecResponse,\n ComputerInfo,\n ComputerListResponse,\n ComputerStatus,\n CreateComputerParams,\n ExecParams,\n TerminalConnectionInfo,\n} from \"./computers\";\nexport type { ClientConfig, RequestOverrides } from \"./core/config\";\nexport { CelestoError, CelestoApiError, CelestoNetworkError } from \"./core/errors\";\n\nexport class Celesto {\n readonly gatekeeper: GatekeeperClient;\n readonly computers: ComputersClient;\n\n constructor(config: ClientConfig) {\n this.gatekeeper = new GatekeeperClient(config);\n this.computers = new ComputersClient(config);\n }\n}\n","export type FetchLike = typeof fetch;\n\nexport interface ClientConfig {\n /** Base API URL, e.g. https://api.celesto.ai */\n baseUrl?: string;\n /** Bearer token (API key or JWT). */\n token?: string;\n /** Alias for token. */\n apiKey?: string;\n /** Organization ID to send as X-Current-Organization. */\n organizationId?: string;\n /** Optional user agent for server-side requests. */\n userAgent?: string;\n /** Default request timeout in milliseconds. */\n timeoutMs?: number;\n /** Override fetch implementation (useful for testing). */\n fetch?: FetchLike;\n /** Default headers to include in every request. */\n headers?: Record<string, string>;\n}\n\nexport interface RequestOptions {\n method: \"GET\" | \"POST\" | \"PUT\" | \"PATCH\" | \"DELETE\";\n path: string;\n query?: Record<string, string | number | boolean | undefined | null | (string | number | boolean)[]>;\n body?: unknown;\n headers?: Record<string, string>;\n signal?: AbortSignal;\n}\n\nexport interface RequestOverrides {\n headers?: Record<string, string>;\n signal?: AbortSignal;\n}\n\nexport interface RequestContext {\n fetch: FetchLike;\n baseUrl: string;\n token?: string;\n organizationId?: string;\n userAgent?: string;\n timeoutMs?: number;\n headers?: Record<string, string>;\n}\n\nexport const DEFAULT_BASE_URL = \"https://api.celesto.ai\";\n\nexport const buildRequestContext = (config: ClientConfig): RequestContext => ({\n fetch: config.fetch ?? fetch,\n baseUrl: config.baseUrl ?? DEFAULT_BASE_URL,\n token: config.token ?? config.apiKey,\n organizationId: config.organizationId,\n userAgent: config.userAgent,\n timeoutMs: config.timeoutMs,\n headers: config.headers,\n});\n","/** Base error for all Celesto SDK errors. */\nexport class CelestoError extends Error {\n constructor(message: string) {\n super(message);\n this.name = \"CelestoError\";\n }\n}\n\n/** Thrown when an API request returns a non-2xx HTTP status. */\nexport class CelestoApiError extends CelestoError {\n readonly status: number;\n readonly data: unknown;\n readonly requestId?: string;\n\n constructor(message: string, status: number, data: unknown, requestId?: string) {\n super(message);\n this.name = \"CelestoApiError\";\n this.status = status;\n this.data = data;\n this.requestId = requestId;\n }\n}\n\n/** Thrown when fetch() itself fails — DNS, network, timeout, abort. */\nexport class CelestoNetworkError extends CelestoError {\n readonly cause?: Error;\n\n constructor(message: string, cause?: Error) {\n super(message);\n this.name = \"CelestoNetworkError\";\n this.cause = cause;\n }\n}\n","import { CelestoApiError, CelestoNetworkError } from \"./errors\";\nimport { RequestContext, RequestOptions } from \"./config\";\n\nconst joinUrl = (baseUrl: string, path: string): string => {\n const trimmedBase = baseUrl.endsWith(\"/\") ? baseUrl.slice(0, -1) : baseUrl;\n const normalizedPath = path.startsWith(\"/\") ? path : `/${path}`;\n return `${trimmedBase}${normalizedPath}`;\n};\n\nconst buildQuery = (\n query?: RequestOptions[\"query\"],\n): string => {\n if (!query) {\n return \"\";\n }\n\n const params = new URLSearchParams();\n for (const [key, value] of Object.entries(query)) {\n if (value === undefined || value === null) {\n continue;\n }\n if (Array.isArray(value)) {\n for (const item of value) {\n params.append(key, String(item));\n }\n continue;\n }\n params.set(key, String(value));\n }\n\n const serialized = params.toString();\n return serialized ? `?${serialized}` : \"\";\n};\n\nconst parseResponseBody = async (response: Response): Promise<unknown> => {\n if (response.status === 204) {\n return undefined;\n }\n\n const contentType = response.headers.get(\"content-type\") ?? \"\";\n if (contentType.includes(\"application/json\")) {\n return response.json();\n }\n\n return response.text();\n};\n\nconst extractErrorMessage = (data: unknown, status: number): string => {\n if (data && typeof data === \"object\") {\n const record = data as Record<string, unknown>;\n if (typeof record.detail === \"string\") {\n return record.detail;\n }\n if (typeof record.message === \"string\") {\n return record.message;\n }\n if (typeof record.error === \"string\") {\n return record.error;\n }\n }\n return `Request failed with status ${status}`;\n};\n\nexport const request = async <T>(ctx: RequestContext, options: RequestOptions): Promise<T> => {\n const url = `${joinUrl(ctx.baseUrl, options.path)}${buildQuery(options.query)}`;\n\n const headers: Record<string, string> = {\n ...(ctx.headers ?? {}),\n ...(options.headers ?? {}),\n };\n\n if (ctx.token) {\n headers.Authorization = `Bearer ${ctx.token}`;\n }\n\n if (ctx.organizationId) {\n headers[\"X-Current-Organization\"] = ctx.organizationId;\n }\n\n if (ctx.userAgent && !headers[\"User-Agent\"]) {\n headers[\"User-Agent\"] = ctx.userAgent;\n }\n\n const init: RequestInit = {\n method: options.method,\n headers,\n body: undefined,\n signal: options.signal,\n };\n\n if (options.body !== undefined) {\n headers[\"Content-Type\"] = headers[\"Content-Type\"] ?? \"application/json\";\n init.body = headers[\"Content-Type\"].includes(\"application/json\")\n ? JSON.stringify(options.body)\n : (options.body as BodyInit);\n }\n\n let timeoutId: ReturnType<typeof setTimeout> | undefined;\n let controller: AbortController | undefined;\n\n if (!options.signal && ctx.timeoutMs && ctx.timeoutMs > 0) {\n controller = new AbortController();\n timeoutId = setTimeout(() => controller?.abort(), ctx.timeoutMs);\n init.signal = controller.signal;\n }\n\n try {\n const response = await ctx.fetch(url, init);\n const data = await parseResponseBody(response);\n\n if (!response.ok) {\n const message = extractErrorMessage(data, response.status);\n throw new CelestoApiError(message, response.status, data, response.headers.get(\"x-request-id\") ?? undefined);\n }\n\n return data as T;\n } catch (err) {\n if (err instanceof CelestoApiError) {\n throw err;\n }\n const error = err instanceof Error ? err : new Error(String(err));\n throw new CelestoNetworkError(error.message, error);\n } finally {\n if (timeoutId) {\n clearTimeout(timeoutId);\n }\n }\n};\n","import { buildRequestContext, ClientConfig, RequestOverrides } from \"../core/config\";\nimport { request } from \"../core/http\";\nimport {\n ComputerConnectionInfo,\n ComputerExecResponse,\n ComputerInfo,\n ComputerListResponse,\n ComputerStatus,\n CreateComputerParams,\n ExecParams,\n TerminalConnectionInfo,\n} from \"./types\";\n\ninterface ComputerConnectionInfoWire {\n ssh?: string | null;\n access_url?: string | null;\n}\n\ninterface ComputerInfoWire {\n id: string;\n name: string;\n status: ComputerStatus;\n vcpus: number;\n ram_mb: number;\n image: string;\n connection?: ComputerConnectionInfoWire | null;\n last_error?: string | null;\n created_at: string;\n stopped_at?: string | null;\n}\n\ninterface ComputerListResponseWire {\n computers: ComputerInfoWire[];\n count: number;\n}\n\ninterface ComputerExecResponseWire {\n exit_code: number;\n stdout: string;\n stderr: string;\n}\n\nconst toConnection = (\n payload: ComputerConnectionInfoWire | null | undefined,\n): ComputerConnectionInfo | undefined => {\n if (!payload) {\n return undefined;\n }\n const out: ComputerConnectionInfo = {};\n if (payload.ssh != null) {\n out.ssh = payload.ssh;\n }\n if (payload.access_url != null) {\n out.accessUrl = payload.access_url;\n }\n return out;\n};\n\nconst toComputerInfo = (payload: ComputerInfoWire): ComputerInfo => ({\n id: payload.id,\n name: payload.name,\n status: payload.status,\n vcpus: payload.vcpus,\n ramMb: payload.ram_mb,\n image: payload.image,\n connection: toConnection(payload.connection),\n lastError: payload.last_error ?? null,\n createdAt: payload.created_at,\n stoppedAt: payload.stopped_at ?? null,\n});\n\nconst toExecResponse = (payload: ComputerExecResponseWire): ComputerExecResponse => ({\n exitCode: payload.exit_code,\n stdout: payload.stdout,\n stderr: payload.stderr,\n});\n\nconst computersPath = (path: string): string => `/v1/computers${path}`;\n\nconst pickOverrides = (options?: RequestOverrides): RequestOverrides => ({\n headers: options?.headers,\n signal: options?.signal,\n});\n\n/**\n * Client for managing sandboxed computers (AI sandboxes).\n *\n * Provides create/list/get/exec/stop/start/delete over HTTP, plus\n * `getTerminalConnection()` which returns the URL and headers needed\n * to open a WebSocket terminal with any WS library of your choice.\n *\n * @example\n * ```ts\n * const celesto = new Celesto({ token: process.env.CELESTO_API_KEY });\n * const computer = await celesto.computers.create({ cpus: 2, memory: 2048 });\n * const result = await celesto.computers.exec(computer.id, \"uname -a\");\n * console.log(result.stdout);\n * await celesto.computers.delete(computer.id);\n * ```\n */\nexport class ComputersClient {\n private readonly config: ClientConfig;\n\n constructor(config: ClientConfig) {\n this.config = config;\n }\n\n async create(params: CreateComputerParams = {}, options?: RequestOverrides): Promise<ComputerInfo> {\n const ctx = buildRequestContext(this.config);\n const data = await request<ComputerInfoWire>(ctx, {\n method: \"POST\",\n path: computersPath(\"\"),\n body: {\n vcpus: params.cpus ?? 1,\n ram_mb: params.memory ?? 1024,\n image: params.image ?? \"ubuntu-desktop-24.04\",\n },\n ...pickOverrides(options),\n });\n return toComputerInfo(data);\n }\n\n async list(options?: RequestOverrides): Promise<ComputerListResponse> {\n const ctx = buildRequestContext(this.config);\n const data = await request<ComputerListResponseWire>(ctx, {\n method: \"GET\",\n path: computersPath(\"\"),\n ...pickOverrides(options),\n });\n return {\n computers: data.computers.map(toComputerInfo),\n count: data.count,\n };\n }\n\n async get(computerId: string, options?: RequestOverrides): Promise<ComputerInfo> {\n const ctx = buildRequestContext(this.config);\n const data = await request<ComputerInfoWire>(ctx, {\n method: \"GET\",\n path: computersPath(`/${encodeURIComponent(computerId)}`),\n ...pickOverrides(options),\n });\n return toComputerInfo(data);\n }\n\n async exec(\n computerId: string,\n command: string,\n params: ExecParams = {},\n options?: RequestOverrides,\n ): Promise<ComputerExecResponse> {\n const ctx = buildRequestContext(this.config);\n const data = await request<ComputerExecResponseWire>(ctx, {\n method: \"POST\",\n path: computersPath(`/${encodeURIComponent(computerId)}/exec`),\n body: {\n command,\n timeout: params.timeout ?? 30,\n },\n ...pickOverrides(options),\n });\n return toExecResponse(data);\n }\n\n async stop(computerId: string, options?: RequestOverrides): Promise<ComputerInfo> {\n const ctx = buildRequestContext(this.config);\n const data = await request<ComputerInfoWire>(ctx, {\n method: \"POST\",\n path: computersPath(`/${encodeURIComponent(computerId)}/stop`),\n ...pickOverrides(options),\n });\n return toComputerInfo(data);\n }\n\n async start(computerId: string, options?: RequestOverrides): Promise<ComputerInfo> {\n const ctx = buildRequestContext(this.config);\n const data = await request<ComputerInfoWire>(ctx, {\n method: \"POST\",\n path: computersPath(`/${encodeURIComponent(computerId)}/start`),\n ...pickOverrides(options),\n });\n return toComputerInfo(data);\n }\n\n async delete(computerId: string, options?: RequestOverrides): Promise<ComputerInfo> {\n const ctx = buildRequestContext(this.config);\n const data = await request<ComputerInfoWire>(ctx, {\n method: \"DELETE\",\n path: computersPath(`/${encodeURIComponent(computerId)}`),\n ...pickOverrides(options),\n });\n return toComputerInfo(data);\n }\n\n /**\n * Get connection info for opening a WebSocket terminal session.\n *\n * Accepts either a computer ID (e.g. `cmp_xxx`) or a human-readable name.\n * The name is resolved to the canonical ID via a GET call — the backend's\n * WebSocket endpoint does not resolve names on its own.\n *\n * Returns the URL, headers, and first message needed to open the connection\n * with any WebSocket library of your choice.\n *\n * @example\n * ```ts\n * const conn = await celesto.computers.getTerminalConnection(\"my-computer\");\n * const ws = new WebSocket(conn.url, { headers: conn.headers });\n * ws.on(\"open\", () => ws.send(conn.firstMessage));\n * ws.on(\"message\", (data) => process.stdout.write(data));\n * ```\n */\n async getTerminalConnection(computerIdOrName: string): Promise<TerminalConnectionInfo> {\n const info = await this.get(computerIdOrName);\n const ctx = buildRequestContext(this.config);\n\n if (!ctx.token) {\n throw new Error(\"A token is required for terminal connections\");\n }\n\n const wsBase = ctx.baseUrl.replace(/^https:/i, \"wss:\").replace(/^http:/i, \"ws:\");\n const url = `${wsBase}/v1/computers/${encodeURIComponent(info.id)}/terminal`;\n\n const headers: Record<string, string> = {\n Authorization: `Bearer ${ctx.token}`,\n };\n if (ctx.organizationId) {\n headers[\"X-Current-Organization\"] = ctx.organizationId;\n }\n\n return {\n url,\n headers,\n firstMessage: JSON.stringify({ token: ctx.token }),\n };\n }\n}\n","import { buildRequestContext, ClientConfig, RequestOverrides } from \"../core/config\";\nimport { request } from \"../core/http\";\nimport {\n GatekeeperAccessRules,\n GatekeeperAccessRulesParams,\n GatekeeperConnectRequest,\n GatekeeperConnectResponse,\n GatekeeperConnection,\n GatekeeperDriveFile,\n GatekeeperDriveListParams,\n GatekeeperDriveListResponse,\n GatekeeperListConnectionsParams,\n GatekeeperListConnectionsResponse,\n GatekeeperRevokeParams,\n GatekeeperRevokeResponse,\n} from \"./types\";\n\ninterface GatekeeperConnectRequestWire {\n subject: string;\n provider: string;\n project_name: string;\n redirect_uri?: string;\n}\n\ninterface GatekeeperConnectResponseWire {\n status: string;\n oauth_url?: string | null;\n connection_id?: string | null;\n}\n\ninterface GatekeeperConnectionWire {\n id: string;\n subject: string;\n provider: string;\n project_id: string;\n account_email?: string | null;\n scopes?: string[];\n status: string;\n created_at: string;\n updated_at: string;\n last_used_at?: string | null;\n access_rules?: {\n allowed_folders?: string[];\n allowed_files?: string[];\n version?: string;\n } | null;\n}\n\ninterface GatekeeperListConnectionsResponseWire {\n data: GatekeeperConnectionWire[];\n total: number;\n}\n\ninterface GatekeeperDriveFileWire {\n id: string;\n name?: string | null;\n mime_type?: string | null;\n size?: number | null;\n modified_time?: string | null;\n created_time?: string | null;\n web_view_link?: string | null;\n icon_link?: string | null;\n thumbnail_link?: string | null;\n parents?: string[] | null;\n drive_id?: string | null;\n shared?: boolean | null;\n owned_by_me?: boolean | null;\n}\n\ninterface GatekeeperDriveListResponseWire {\n files: GatekeeperDriveFileWire[];\n next_page_token?: string | null;\n}\n\ninterface GatekeeperAccessRulesResponseWire {\n version: string;\n allowed_folders: string[];\n allowed_files: string[];\n unrestricted: boolean;\n}\n\nconst toConnectRequest = (payload: GatekeeperConnectRequest): GatekeeperConnectRequestWire => ({\n subject: payload.subject,\n provider: payload.provider ?? \"google_drive\",\n project_name: payload.projectName,\n redirect_uri: payload.redirectUri,\n});\n\nconst toConnectResponse = (payload: GatekeeperConnectResponseWire): GatekeeperConnectResponse => ({\n status: payload.status,\n oauthUrl: payload.oauth_url ?? undefined,\n connectionId: payload.connection_id ?? undefined,\n});\n\nconst toConnection = (payload: GatekeeperConnectionWire): GatekeeperConnection => ({\n id: payload.id,\n subject: payload.subject,\n provider: payload.provider,\n projectId: payload.project_id,\n accountEmail: payload.account_email ?? null,\n scopes: payload.scopes ?? [],\n status: payload.status,\n createdAt: payload.created_at,\n updatedAt: payload.updated_at,\n lastUsedAt: payload.last_used_at ?? null,\n accessRules: payload.access_rules\n ? {\n version: payload.access_rules.version ?? \"1\",\n allowedFolders: payload.access_rules.allowed_folders ?? [],\n allowedFiles: payload.access_rules.allowed_files ?? [],\n unrestricted: false,\n }\n : null,\n});\n\nconst toAccessRules = (payload: GatekeeperAccessRulesResponseWire): GatekeeperAccessRules => ({\n version: payload.version,\n allowedFolders: payload.allowed_folders ?? [],\n allowedFiles: payload.allowed_files ?? [],\n unrestricted: payload.unrestricted,\n});\n\nconst toDriveFile = (payload: GatekeeperDriveFileWire): GatekeeperDriveFile => ({\n id: payload.id,\n name: payload.name ?? null,\n mimeType: payload.mime_type ?? null,\n size: payload.size ?? null,\n modifiedTime: payload.modified_time ?? null,\n createdTime: payload.created_time ?? null,\n webViewLink: payload.web_view_link ?? null,\n iconLink: payload.icon_link ?? null,\n thumbnailLink: payload.thumbnail_link ?? null,\n parents: payload.parents ?? null,\n driveId: payload.drive_id ?? null,\n shared: payload.shared ?? null,\n ownedByMe: payload.owned_by_me ?? null,\n});\n\nconst gatekeeperPath = (path: string): string => `/v1/gatekeeper${path}`;\n\nconst pickOverrides = (options?: RequestOverrides): RequestOverrides => ({\n headers: options?.headers,\n signal: options?.signal,\n});\n\nexport class GatekeeperClient {\n private readonly config: ClientConfig;\n\n constructor(config: ClientConfig) {\n this.config = config;\n }\n\n async connect(payload: GatekeeperConnectRequest, options?: RequestOverrides): Promise<GatekeeperConnectResponse> {\n const ctx = buildRequestContext(this.config);\n const data = await request<GatekeeperConnectResponseWire>(ctx, {\n method: \"POST\",\n path: gatekeeperPath(\"/connect\"),\n body: toConnectRequest(payload),\n ...pickOverrides(options),\n });\n return toConnectResponse(data);\n }\n\n async listConnections(params: GatekeeperListConnectionsParams, options?: RequestOverrides): Promise<GatekeeperListConnectionsResponse> {\n const ctx = buildRequestContext(this.config);\n const data = await request<GatekeeperListConnectionsResponseWire>(ctx, {\n method: \"GET\",\n path: gatekeeperPath(\"/connections\"),\n query: {\n project_name: params.projectName,\n status_filter: params.statusFilter,\n },\n ...pickOverrides(options),\n });\n\n return {\n total: data.total,\n data: data.data.map(toConnection),\n };\n }\n\n async getConnection(connectionId: string, options?: RequestOverrides): Promise<GatekeeperConnection> {\n const ctx = buildRequestContext(this.config);\n const data = await request<GatekeeperConnectionWire>(ctx, {\n method: \"GET\",\n path: gatekeeperPath(`/connections/${connectionId}`),\n ...pickOverrides(options),\n });\n return toConnection(data);\n }\n\n async revokeConnection(params: GatekeeperRevokeParams, options?: RequestOverrides): Promise<GatekeeperRevokeResponse> {\n const ctx = buildRequestContext(this.config);\n return request<GatekeeperRevokeResponse>(ctx, {\n method: \"DELETE\",\n path: gatekeeperPath(\"/connections\"),\n query: {\n subject: params.subject,\n project_name: params.projectName,\n provider: params.provider,\n },\n ...pickOverrides(options),\n });\n }\n\n async listDriveFiles(params: GatekeeperDriveListParams, options?: RequestOverrides): Promise<GatekeeperDriveListResponse> {\n const ctx = buildRequestContext(this.config);\n const data = await request<GatekeeperDriveListResponseWire>(ctx, {\n method: \"GET\",\n path: gatekeeperPath(\"/connectors/drive/files\"),\n query: {\n project_name: params.projectName,\n subject: params.subject,\n page_size: params.pageSize,\n page_token: params.pageToken,\n folder_id: params.folderId,\n query: params.query,\n include_folders: params.includeFolders,\n order_by: params.orderBy,\n },\n ...pickOverrides(options),\n });\n\n return {\n files: data.files.map(toDriveFile),\n nextPageToken: data.next_page_token ?? null,\n };\n }\n\n async getAccessRules(connectionId: string, options?: RequestOverrides): Promise<GatekeeperAccessRules> {\n const ctx = buildRequestContext(this.config);\n const data = await request<GatekeeperAccessRulesResponseWire>(ctx, {\n method: \"GET\",\n path: gatekeeperPath(`/connections/${connectionId}/access-rules`),\n ...pickOverrides(options),\n });\n return toAccessRules(data);\n }\n\n async updateAccessRules(params: GatekeeperAccessRulesParams, options?: RequestOverrides): Promise<GatekeeperAccessRules> {\n const ctx = buildRequestContext(this.config);\n const data = await request<GatekeeperAccessRulesResponseWire>(ctx, {\n method: \"PUT\",\n path: gatekeeperPath(\"/connections/access-rules\"),\n query: {\n subject: params.subject,\n project_name: params.projectName,\n provider: params.provider,\n },\n body: {\n allowed_folders: params.accessRules.allowedFolders ?? [],\n allowed_files: params.accessRules.allowedFiles ?? [],\n },\n ...pickOverrides(options),\n });\n return toAccessRules(data);\n }\n\n async clearAccessRules(connectionId: string, options?: RequestOverrides): Promise<GatekeeperAccessRules> {\n const ctx = buildRequestContext(this.config);\n const data = await request<GatekeeperAccessRulesResponseWire>(ctx, {\n method: \"DELETE\",\n path: gatekeeperPath(`/connections/${connectionId}/access-rules`),\n ...pickOverrides(options),\n });\n return toAccessRules(data);\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;AC6CO,IAAM,mBAAmB;AAEzB,IAAM,sBAAsB,CAAC,YAA0C;AAAA,EAC5E,OAAO,OAAO,SAAS;AAAA,EACvB,SAAS,OAAO,WAAW;AAAA,EAC3B,OAAO,OAAO,SAAS,OAAO;AAAA,EAC9B,gBAAgB,OAAO;AAAA,EACvB,WAAW,OAAO;AAAA,EAClB,WAAW,OAAO;AAAA,EAClB,SAAS,OAAO;AAClB;;;ACtDO,IAAM,eAAN,cAA2B,MAAM;AAAA,EACtC,YAAY,SAAiB;AAC3B,UAAM,OAAO;AACb,SAAK,OAAO;AAAA,EACd;AACF;AAGO,IAAM,kBAAN,cAA8B,aAAa;AAAA,EAKhD,YAAY,SAAiB,QAAgB,MAAe,WAAoB;AAC9E,UAAM,OAAO;AACb,SAAK,OAAO;AACZ,SAAK,SAAS;AACd,SAAK,OAAO;AACZ,SAAK,YAAY;AAAA,EACnB;AACF;AAGO,IAAM,sBAAN,cAAkC,aAAa;AAAA,EAGpD,YAAY,SAAiB,OAAe;AAC1C,UAAM,OAAO;AACb,SAAK,OAAO;AACZ,SAAK,QAAQ;AAAA,EACf;A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3B;AACF;;;ALzOO,IAAM,UAAN,MAAc;AAAA,EAInB,YAAY,QAAsB;AAChC,SAAK,aAAa,IAAI,iBAAiB,MAAM;AAC7C,SAAK,YAAY,IAAI,gBAAgB,MAAM;AAAA,EAC7C;AACF;","names":["toConnection","pickOverrides"]}
|
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { ComputersClient } from './computers/index.cjs';
|
|
2
|
+
export { ComputerConnectionInfo, ComputerExecResponse, ComputerInfo, ComputerListResponse, ComputerStatus, CreateComputerParams, ExecParams, TerminalConnectionInfo } from './computers/index.cjs';
|
|
3
|
+
import { GatekeeperClient } from './gatekeeper/index.cjs';
|
|
4
|
+
export { GatekeeperAccessRules, GatekeeperAccessRulesParams, GatekeeperAccessRulesUpdate, GatekeeperConnectRequest, GatekeeperConnectResponse, GatekeeperConnection, GatekeeperDriveFile, GatekeeperDriveListParams, GatekeeperDriveListResponse, GatekeeperListConnectionsParams, GatekeeperListConnectionsResponse, GatekeeperRevokeParams, GatekeeperRevokeResponse } from './gatekeeper/index.cjs';
|
|
5
|
+
import { C as ClientConfig } from './config-BTTpuv_b.cjs';
|
|
6
|
+
export { R as RequestOverrides } from './config-BTTpuv_b.cjs';
|
|
7
|
+
|
|
8
|
+
/** Base error for all Celesto SDK errors. */
|
|
9
|
+
declare class CelestoError extends Error {
|
|
10
|
+
constructor(message: string);
|
|
11
|
+
}
|
|
12
|
+
/** Thrown when an API request returns a non-2xx HTTP status. */
|
|
13
|
+
declare class CelestoApiError extends CelestoError {
|
|
14
|
+
readonly status: number;
|
|
15
|
+
readonly data: unknown;
|
|
16
|
+
readonly requestId?: string;
|
|
17
|
+
constructor(message: string, status: number, data: unknown, requestId?: string);
|
|
18
|
+
}
|
|
19
|
+
/** Thrown when fetch() itself fails — DNS, network, timeout, abort. */
|
|
20
|
+
declare class CelestoNetworkError extends CelestoError {
|
|
21
|
+
readonly cause?: Error;
|
|
22
|
+
constructor(message: string, cause?: Error);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
declare class Celesto {
|
|
26
|
+
readonly gatekeeper: GatekeeperClient;
|
|
27
|
+
readonly computers: ComputersClient;
|
|
28
|
+
constructor(config: ClientConfig);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export { Celesto, CelestoApiError, CelestoError, CelestoNetworkError, ClientConfig, ComputersClient, GatekeeperClient };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { ComputersClient } from './computers/index.js';
|
|
2
|
+
export { ComputerConnectionInfo, ComputerExecResponse, ComputerInfo, ComputerListResponse, ComputerStatus, CreateComputerParams, ExecParams, TerminalConnectionInfo } from './computers/index.js';
|
|
3
|
+
import { GatekeeperClient } from './gatekeeper/index.js';
|
|
4
|
+
export { GatekeeperAccessRules, GatekeeperAccessRulesParams, GatekeeperAccessRulesUpdate, GatekeeperConnectRequest, GatekeeperConnectResponse, GatekeeperConnection, GatekeeperDriveFile, GatekeeperDriveListParams, GatekeeperDriveListResponse, GatekeeperListConnectionsParams, GatekeeperListConnectionsResponse, GatekeeperRevokeParams, GatekeeperRevokeResponse } from './gatekeeper/index.js';
|
|
5
|
+
import { C as ClientConfig } from './config-BTTpuv_b.js';
|
|
6
|
+
export { R as RequestOverrides } from './config-BTTpuv_b.js';
|
|
7
|
+
|
|
8
|
+
/** Base error for all Celesto SDK errors. */
|
|
9
|
+
declare class CelestoError extends Error {
|
|
10
|
+
constructor(message: string);
|
|
11
|
+
}
|
|
12
|
+
/** Thrown when an API request returns a non-2xx HTTP status. */
|
|
13
|
+
declare class CelestoApiError extends CelestoError {
|
|
14
|
+
readonly status: number;
|
|
15
|
+
readonly data: unknown;
|
|
16
|
+
readonly requestId?: string;
|
|
17
|
+
constructor(message: string, status: number, data: unknown, requestId?: string);
|
|
18
|
+
}
|
|
19
|
+
/** Thrown when fetch() itself fails — DNS, network, timeout, abort. */
|
|
20
|
+
declare class CelestoNetworkError extends CelestoError {
|
|
21
|
+
readonly cause?: Error;
|
|
22
|
+
constructor(message: string, cause?: Error);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
declare class Celesto {
|
|
26
|
+
readonly gatekeeper: GatekeeperClient;
|
|
27
|
+
readonly computers: ComputersClient;
|
|
28
|
+
constructor(config: ClientConfig);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export { Celesto, CelestoApiError, CelestoError, CelestoNetworkError, ClientConfig, ComputersClient, GatekeeperClient };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import {
|
|
2
|
+
GatekeeperClient
|
|
3
|
+
} from "./chunk-4KVRJSVJ.js";
|
|
4
|
+
import {
|
|
5
|
+
ComputersClient
|
|
6
|
+
} from "./chunk-OGMV3NFZ.js";
|
|
7
|
+
import {
|
|
8
|
+
CelestoApiError,
|
|
9
|
+
CelestoError,
|
|
10
|
+
CelestoNetworkError
|
|
11
|
+
} from "./chunk-N3HU6ONW.js";
|
|
12
|
+
|
|
13
|
+
// src/index.ts
|
|
14
|
+
var Celesto = class {
|
|
15
|
+
constructor(config) {
|
|
16
|
+
this.gatekeeper = new GatekeeperClient(config);
|
|
17
|
+
this.computers = new ComputersClient(config);
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
export {
|
|
21
|
+
Celesto,
|
|
22
|
+
CelestoApiError,
|
|
23
|
+
CelestoError,
|
|
24
|
+
CelestoNetworkError,
|
|
25
|
+
ComputersClient,
|
|
26
|
+
GatekeeperClient
|
|
27
|
+
};
|
|
28
|
+
//# sourceMappingURL=index.js.map
|