@drej/opensandbox 0.1.2 → 0.1.3

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/control.d.ts CHANGED
@@ -6,10 +6,14 @@ export declare class OpenSandboxError extends Error {
6
6
  export declare class ControlClient {
7
7
  private baseUrl;
8
8
  private apiKey;
9
+ private signal?;
9
10
  constructor(options: {
10
11
  baseUrl: string;
11
12
  apiKey: string;
13
+ signal?: AbortSignal;
12
14
  });
15
+ /** Return a new `ControlClient` instance that passes `signal` to every fetch call. */
16
+ withSignal(signal: AbortSignal): ControlClient;
13
17
  private request;
14
18
  createSandbox(options: CreateSandboxOptions): Promise<Sandbox>;
15
19
  listSandboxes(options?: ListSandboxesOptions): Promise<Sandbox[]>;
package/dist/exec.d.ts CHANGED
@@ -1,11 +1,15 @@
1
- import type { SSEEvent, CodeContext, ExecuteCodeOptions, ExecuteCommandOptions, CommandStatus, FileInfo, FileReplacement, DirectoryEntry, Metrics } from "./types";
1
+ import type { SSEEvent, CodeContext, ExecuteCodeOptions, ExecuteCommandOptions, CommandStatus, FileInfo, FileReplacement, Metrics } from "./types";
2
2
  export declare class ExecClient {
3
3
  private baseUrl;
4
4
  private accessToken;
5
+ private signal?;
5
6
  constructor(options: {
6
7
  baseUrl?: string;
7
8
  accessToken: string;
9
+ signal?: AbortSignal;
8
10
  });
11
+ /** Return a new `ExecClient` instance that passes `signal` to every fetch call. */
12
+ withSignal(signal: AbortSignal): ExecClient;
9
13
  private get authHeader();
10
14
  private request;
11
15
  private streamRequest;
@@ -29,11 +33,11 @@ export declare class ExecClient {
29
33
  deleteFile(path: string): Promise<void>;
30
34
  setPermissions(path: string, mode: string): Promise<void>;
31
35
  moveFile(from: string, to: string): Promise<void>;
32
- searchFiles(pattern: string, dir?: string): Promise<string[]>;
36
+ searchFiles(pattern: string, path?: string): Promise<string[]>;
33
37
  replaceInFiles(replacements: FileReplacement[]): Promise<void>;
34
38
  uploadFile(path: string, content: Blob | BufferSource | string): Promise<void>;
35
39
  downloadFile(path: string): Promise<ReadableStream<Uint8Array>>;
36
- listDirectory(path: string, depth?: number): Promise<DirectoryEntry[]>;
40
+ listDirectory(path: string, depth?: number): Promise<FileInfo[]>;
37
41
  createDirectory(path: string): Promise<void>;
38
42
  deleteDirectory(path: string): Promise<void>;
39
43
  getMetrics(): Promise<Metrics>;
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
1
  export { ControlClient, OpenSandboxError } from "./control";
2
2
  export { ExecClient } from "./exec";
3
- export { SandboxState, SnapshotState, SSEEventType } from "./types";
4
- export type { Resources, ImageAuth, ImageSpec, Sandbox, SandboxStatus, CreateSandboxOptions, ListSandboxesOptions, Snapshot, ListSnapshotsOptions, SandboxEndpoint, DiagnosticLog, DiagnosticEvent, SSEEvent, CodeContext, ExecuteCodeOptions, ExecuteCommandOptions, CommandStatus, FileInfo, FileReplacement, DirectoryEntry, Metrics, } from "./types";
3
+ export { SandboxState, SnapshotState, SSEEventType, CodeLanguage } from "./types";
4
+ export type { Resources, ImageAuth, ImageSpec, Sandbox, SandboxStatus, CreateSandboxOptions, ListSandboxesOptions, Snapshot, ListSnapshotsOptions, SandboxEndpoint, DiagnosticLog, DiagnosticEvent, SSEEvent, CodeContext, ExecuteCodeOptions, ExecuteCommandOptions, CommandStatus, FileInfo, FileReplacement, Metrics, } from "./types";
package/dist/types.d.ts CHANGED
@@ -112,15 +112,23 @@ export interface SSEEvent {
112
112
  execution_time?: number;
113
113
  timestamp: number;
114
114
  }
115
+ export declare enum CodeLanguage {
116
+ Python = "python",
117
+ JavaScript = "javascript",
118
+ TypeScript = "typescript",
119
+ Go = "go",
120
+ Java = "java",
121
+ Bash = "bash"
122
+ }
115
123
  export interface CodeContext {
116
124
  id: string;
117
- language: string;
125
+ language: CodeLanguage;
118
126
  }
119
127
  export interface ExecuteCodeOptions {
120
128
  code: string;
121
129
  context?: {
122
130
  id: string;
123
- language: string;
131
+ language: CodeLanguage;
124
132
  };
125
133
  }
126
134
  export interface ExecuteCommandOptions {
@@ -139,16 +147,13 @@ export interface CommandStatus {
139
147
  }
140
148
  export interface FileInfo {
141
149
  path: string;
150
+ type: "file" | "directory" | "symlink";
142
151
  size: number;
143
- mode: string;
144
- modifiedAt: string;
145
- isDirectory: boolean;
146
- }
147
- export interface DirectoryEntry {
148
- name: string;
149
- path: string;
150
- isDirectory: boolean;
151
- size?: number;
152
+ mode: number;
153
+ modified_at: string;
154
+ created_at: string;
155
+ owner: string;
156
+ group: string;
152
157
  }
153
158
  export interface FileReplacement {
154
159
  path: string;
package/package.json CHANGED
@@ -1,18 +1,20 @@
1
1
  {
2
2
  "name": "@drej/opensandbox",
3
- "version": "0.1.2",
3
+ "version": "0.1.3",
4
4
  "main": "./src/index.ts",
5
5
  "types": "./dist/index.d.ts",
6
6
  "files": [
7
7
  "dist"
8
8
  ],
9
- "publishConfig": { "access": "public" },
9
+ "publishConfig": {
10
+ "access": "public"
11
+ },
10
12
  "scripts": {
11
13
  "typecheck": "bunx tsc --noEmit",
12
14
  "build:types": "tsc --project tsconfig.build.json"
13
15
  },
14
16
  "devDependencies": {
15
- "bun-types": "latest",
16
- "typescript": "latest"
17
+ "bun-types": "1.3.14",
18
+ "typescript": "6.0.3"
17
19
  }
18
20
  }