@blaxel/core 0.2.0-dev9 → 0.2.0-preview2

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.
@@ -17,6 +17,18 @@ export type FileRequest = {
17
17
  isDirectory?: boolean;
18
18
  permissions?: string;
19
19
  };
20
+ export type FileWithContent = {
21
+ content?: string;
22
+ group?: string;
23
+ lastModified?: string;
24
+ owner?: string;
25
+ path?: string;
26
+ /**
27
+ * swagger:strfmt string
28
+ */
29
+ permissions?: string;
30
+ size?: number;
31
+ };
20
32
  export type PortMonitorRequest = {
21
33
  /**
22
34
  * URL to call when a new port is detected
@@ -117,7 +129,7 @@ export type GetFilesystemByPathResponses = {
117
129
  /**
118
130
  * Directory listing
119
131
  */
120
- 200: Directory;
132
+ 200: Directory | FileWithContent;
121
133
  };
122
134
  export type GetFilesystemByPathResponse = GetFilesystemByPathResponses[keyof GetFilesystemByPathResponses];
123
135
  export type PutFilesystemByPathData = {
@@ -382,7 +394,12 @@ export type GetProcessByIdentifierLogsData = {
382
394
  */
383
395
  identifier: string;
384
396
  };
385
- query?: never;
397
+ query?: {
398
+ /**
399
+ * Stream logs
400
+ */
401
+ stream?: boolean;
402
+ };
386
403
  url: '/process/{identifier}/logs';
387
404
  };
388
405
  export type GetProcessByIdentifierLogsErrors = {
@@ -405,6 +422,42 @@ export type GetProcessByIdentifierLogsResponses = {
405
422
  };
406
423
  };
407
424
  export type GetProcessByIdentifierLogsResponse = GetProcessByIdentifierLogsResponses[keyof GetProcessByIdentifierLogsResponses];
425
+ export type GetProcessByIdentifierLogsStreamData = {
426
+ body?: never;
427
+ path: {
428
+ /**
429
+ * Process identifier (PID or name)
430
+ */
431
+ identifier: string;
432
+ };
433
+ query?: {
434
+ /**
435
+ * Stream logs
436
+ */
437
+ stream?: boolean;
438
+ };
439
+ url: '/process/{identifier}/logs/stream';
440
+ };
441
+ export type GetProcessByIdentifierLogsStreamErrors = {
442
+ /**
443
+ * Process not found
444
+ */
445
+ 404: ErrorResponse;
446
+ /**
447
+ * Internal server error
448
+ */
449
+ 500: ErrorResponse;
450
+ };
451
+ export type GetProcessByIdentifierLogsStreamError = GetProcessByIdentifierLogsStreamErrors[keyof GetProcessByIdentifierLogsStreamErrors];
452
+ export type GetProcessByIdentifierLogsStreamResponses = {
453
+ /**
454
+ * Process logs
455
+ */
456
+ 200: {
457
+ [key: string]: string;
458
+ };
459
+ };
460
+ export type GetProcessByIdentifierLogsStreamResponse = GetProcessByIdentifierLogsStreamResponses[keyof GetProcessByIdentifierLogsStreamResponses];
408
461
  export type ClientOptions = {
409
462
  baseUrl: `${string}://localhost:8080` | (string & {});
410
463
  };
@@ -1,3 +1,4 @@
1
1
  "use strict";
2
+ /* eslint-disable */
2
3
  // This file is auto-generated by @hey-api/openapi-ts
3
4
  Object.defineProperty(exports, "__esModule", { value: true });
@@ -1 +1,2 @@
1
+ export { deleteFilesystemByPath, deleteNetworkProcessByPidMonitor, deleteProcessByIdentifier, deleteProcessByIdentifierKill, Directory, ErrorResponse, File, FileRequest, FileWithContent, getFilesystemByPath, getNetworkProcessByPidPorts, getProcess, getProcessByIdentifier, getProcessByIdentifierLogs, getProcessByIdentifierLogsStream, PortMonitorRequest, postNetworkProcessByPidMonitor, postProcess, ProcessKillRequest, ProcessRequest, ProcessResponse, putFilesystemByPath, SuccessResponse } from "./client/index.js";
1
2
  export * from "./sandbox.js";
@@ -14,4 +14,21 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
+ exports.putFilesystemByPath = exports.postProcess = exports.postNetworkProcessByPidMonitor = exports.getProcessByIdentifierLogsStream = exports.getProcessByIdentifierLogs = exports.getProcessByIdentifier = exports.getProcess = exports.getNetworkProcessByPidPorts = exports.getFilesystemByPath = exports.deleteProcessByIdentifierKill = exports.deleteProcessByIdentifier = exports.deleteNetworkProcessByPidMonitor = exports.deleteFilesystemByPath = void 0;
18
+ var index_js_1 = require("./client/index.js");
19
+ /* Export SDK functions */
20
+ Object.defineProperty(exports, "deleteFilesystemByPath", { enumerable: true, get: function () { return index_js_1.deleteFilesystemByPath; } });
21
+ Object.defineProperty(exports, "deleteNetworkProcessByPidMonitor", { enumerable: true, get: function () { return index_js_1.deleteNetworkProcessByPidMonitor; } });
22
+ Object.defineProperty(exports, "deleteProcessByIdentifier", { enumerable: true, get: function () { return index_js_1.deleteProcessByIdentifier; } });
23
+ Object.defineProperty(exports, "deleteProcessByIdentifierKill", { enumerable: true, get: function () { return index_js_1.deleteProcessByIdentifierKill; } });
24
+ Object.defineProperty(exports, "getFilesystemByPath", { enumerable: true, get: function () { return index_js_1.getFilesystemByPath; } });
25
+ Object.defineProperty(exports, "getNetworkProcessByPidPorts", { enumerable: true, get: function () { return index_js_1.getNetworkProcessByPidPorts; } });
26
+ Object.defineProperty(exports, "getProcess", { enumerable: true, get: function () { return index_js_1.getProcess; } });
27
+ Object.defineProperty(exports, "getProcessByIdentifier", { enumerable: true, get: function () { return index_js_1.getProcessByIdentifier; } });
28
+ Object.defineProperty(exports, "getProcessByIdentifierLogs", { enumerable: true, get: function () { return index_js_1.getProcessByIdentifierLogs; } });
29
+ Object.defineProperty(exports, "getProcessByIdentifierLogsStream", { enumerable: true, get: function () { return index_js_1.getProcessByIdentifierLogsStream; } });
30
+ Object.defineProperty(exports, "postNetworkProcessByPidMonitor", { enumerable: true, get: function () { return index_js_1.postNetworkProcessByPidMonitor; } });
31
+ Object.defineProperty(exports, "postProcess", { enumerable: true, get: function () { return index_js_1.postProcess; } });
32
+ Object.defineProperty(exports, "putFilesystemByPath", { enumerable: true, get: function () { return index_js_1.putFilesystemByPath; } });
17
33
  __exportStar(require("./sandbox.js"), exports);
34
+ // Re-export everything from client except ClientOptions to avoid conflict
@@ -0,0 +1,17 @@
1
+ import { Preview, Sandbox } from "../client/index.js";
2
+ export declare class SandboxPreview {
3
+ private preview;
4
+ constructor(preview: Preview);
5
+ get name(): string;
6
+ get metadata(): import("../client/types.gen.js").PreviewMetadata | undefined;
7
+ get spec(): import("../client/types.gen.js").PreviewSpec | undefined;
8
+ }
9
+ export declare class SandboxPreviews {
10
+ private sandbox;
11
+ constructor(sandbox: Sandbox);
12
+ get sandboxName(): string;
13
+ list(): Promise<SandboxPreview[]>;
14
+ create(preview: Preview): Promise<SandboxPreview>;
15
+ get(previewName: string): Promise<SandboxPreview>;
16
+ delete(previewName: string): Promise<Preview>;
17
+ }
@@ -0,0 +1,69 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SandboxPreviews = exports.SandboxPreview = void 0;
4
+ const index_js_1 = require("../client/index.js");
5
+ class SandboxPreview {
6
+ preview;
7
+ constructor(preview) {
8
+ this.preview = preview;
9
+ }
10
+ get name() {
11
+ return this.preview.metadata?.name ?? "";
12
+ }
13
+ get metadata() {
14
+ return this.preview.metadata;
15
+ }
16
+ get spec() {
17
+ return this.preview.spec;
18
+ }
19
+ }
20
+ exports.SandboxPreview = SandboxPreview;
21
+ class SandboxPreviews {
22
+ sandbox;
23
+ constructor(sandbox) {
24
+ this.sandbox = sandbox;
25
+ }
26
+ get sandboxName() {
27
+ return this.sandbox.metadata?.name ?? "";
28
+ }
29
+ async list() {
30
+ const { data } = await (0, index_js_1.listSandboxPreviews)({
31
+ path: {
32
+ sandboxName: this.sandboxName,
33
+ },
34
+ throwOnError: true,
35
+ });
36
+ return data.map((preview) => new SandboxPreview(preview));
37
+ }
38
+ async create(preview) {
39
+ const { data } = await (0, index_js_1.createSandboxPreview)({
40
+ path: {
41
+ sandboxName: this.sandboxName,
42
+ },
43
+ body: preview,
44
+ throwOnError: true,
45
+ });
46
+ return new SandboxPreview(data);
47
+ }
48
+ async get(previewName) {
49
+ const { data } = await (0, index_js_1.getSandboxPreview)({
50
+ path: {
51
+ sandboxName: this.sandboxName,
52
+ previewName,
53
+ },
54
+ throwOnError: true,
55
+ });
56
+ return new SandboxPreview(data);
57
+ }
58
+ async delete(previewName) {
59
+ const { data } = await (0, index_js_1.deleteSandboxPreview)({
60
+ path: {
61
+ sandboxName: this.sandboxName,
62
+ previewName,
63
+ },
64
+ throwOnError: true,
65
+ });
66
+ return data;
67
+ }
68
+ }
69
+ exports.SandboxPreviews = SandboxPreviews;
@@ -1,12 +1,14 @@
1
1
  import { Sandbox as SandboxModel } from "../client/index.js";
2
2
  import { SandboxFileSystem } from "./filesystem.js";
3
3
  import { SandboxNetwork } from "./network.js";
4
+ import { SandboxPreviews } from "./preview.js";
4
5
  import { SandboxProcess } from "./process.js";
5
6
  export declare class SandboxInstance {
6
7
  private sandbox;
7
8
  fs: SandboxFileSystem;
8
9
  network: SandboxNetwork;
9
10
  process: SandboxProcess;
11
+ previews: SandboxPreviews;
10
12
  constructor(sandbox: SandboxModel);
11
13
  get metadata(): import("../client/types.gen.js").Metadata | undefined;
12
14
  get status(): string | undefined;
@@ -5,17 +5,20 @@ const index_js_1 = require("../client/index.js");
5
5
  const logger_js_1 = require("../common/logger.js");
6
6
  const filesystem_js_1 = require("./filesystem.js");
7
7
  const network_js_1 = require("./network.js");
8
+ const preview_js_1 = require("./preview.js");
8
9
  const process_js_1 = require("./process.js");
9
10
  class SandboxInstance {
10
11
  sandbox;
11
12
  fs;
12
13
  network;
13
14
  process;
15
+ previews;
14
16
  constructor(sandbox) {
15
17
  this.sandbox = sandbox;
16
18
  this.fs = new filesystem_js_1.SandboxFileSystem(sandbox);
17
19
  this.network = new network_js_1.SandboxNetwork(sandbox);
18
20
  this.process = new process_js_1.SandboxProcess(sandbox);
21
+ this.previews = new preview_js_1.SandboxPreviews(sandbox);
19
22
  }
20
23
  get metadata() {
21
24
  return this.sandbox.metadata;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blaxel/core",
3
- "version": "0.2.0-dev9",
3
+ "version": "0.2.0-preview2",
4
4
  "description": "Blaxel Core SDK for TypeScript",
5
5
  "license": "MIT",
6
6
  "author": "Blaxel, INC (https://blaxel.ai)",