@watasu/sdk 0.1.51 → 0.1.66
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 +9 -0
- package/dist/codeInterpreter.d.ts +17 -23
- package/dist/codeInterpreter.js +41 -48
- package/dist/connectionConfig.d.ts +21 -5
- package/dist/connectionConfig.js +46 -17
- package/dist/filesystem.d.ts +43 -0
- package/dist/filesystem.js +88 -1
- package/dist/git.d.ts +3 -0
- package/dist/git.js +27 -1
- package/dist/index.d.ts +1 -1
- package/dist/pty.d.ts +8 -3
- package/dist/sandbox.d.ts +62 -26
- package/dist/sandbox.js +148 -66
- package/dist/template.d.ts +2 -0
- package/dist/template.js +7 -1
- package/dist/volume.d.ts +12 -6
- package/dist/volume.js +22 -2
- package/package.json +1 -1
package/dist/template.d.ts
CHANGED
|
@@ -236,6 +236,8 @@ export declare class TemplateBase {
|
|
|
236
236
|
setEnvs(envs: Record<string, string>): TemplateBuilder;
|
|
237
237
|
skipCache(): TemplateBuilder;
|
|
238
238
|
toBuildSpec(): BuildSpec;
|
|
239
|
+
private toJSON;
|
|
240
|
+
private serialize;
|
|
239
241
|
private addPackages;
|
|
240
242
|
private requireDevContainerTemplate;
|
|
241
243
|
private addCopySource;
|
package/dist/template.js
CHANGED
|
@@ -167,7 +167,7 @@ export class TemplateBase {
|
|
|
167
167
|
return tags.map((item) => templateTag(record(item)));
|
|
168
168
|
}
|
|
169
169
|
static async toJSON(template) {
|
|
170
|
-
return
|
|
170
|
+
return template.toJSON();
|
|
171
171
|
}
|
|
172
172
|
static toDockerfile(template) {
|
|
173
173
|
return template.toDockerfile();
|
|
@@ -392,6 +392,12 @@ export class TemplateBase {
|
|
|
392
392
|
spec.ready_cmd = this.readyCmd;
|
|
393
393
|
return spec;
|
|
394
394
|
}
|
|
395
|
+
async toJSON(_computeHashes = true) {
|
|
396
|
+
return JSON.stringify(this.serialize());
|
|
397
|
+
}
|
|
398
|
+
serialize(_steps) {
|
|
399
|
+
return this.toBuildSpec();
|
|
400
|
+
}
|
|
395
401
|
addPackages(manager, packages) {
|
|
396
402
|
this.packages[manager] = [...(this.packages[manager] ?? []), ...packages];
|
|
397
403
|
}
|
package/dist/volume.d.ts
CHANGED
|
@@ -41,8 +41,11 @@ export interface VolumeEntryStat {
|
|
|
41
41
|
export interface VolumeApiParams extends ConnectionOpts {
|
|
42
42
|
team?: string;
|
|
43
43
|
}
|
|
44
|
-
export type
|
|
45
|
-
export declare
|
|
44
|
+
export type VolumeApiOpts = ConnectionOpts;
|
|
45
|
+
export declare class VolumeConnectionConfig extends ConnectionConfig {
|
|
46
|
+
readonly token?: string;
|
|
47
|
+
constructor(volume: Volume, opts?: VolumeApiOpts);
|
|
48
|
+
}
|
|
46
49
|
export interface VolumeListOpts extends ConnectionOpts {
|
|
47
50
|
team?: string;
|
|
48
51
|
}
|
|
@@ -66,7 +69,6 @@ export interface VolumeMetadataOpts extends ConnectionOpts {
|
|
|
66
69
|
export type VolumeAndToken = VolumeInfo & {
|
|
67
70
|
token: string;
|
|
68
71
|
};
|
|
69
|
-
export type VolumeApiOpts = ConnectionOpts;
|
|
70
72
|
export type VolumeMetadataOptions = Omit<VolumeMetadataOpts, keyof ConnectionOpts>;
|
|
71
73
|
export type VolumeWriteOptions = Omit<VolumeWriteFileOpts, keyof ConnectionOpts>;
|
|
72
74
|
/** Persistent volume that can be mounted into sandboxes and edited while detached. */
|
|
@@ -75,8 +77,12 @@ export declare class Volume {
|
|
|
75
77
|
readonly id: string;
|
|
76
78
|
readonly name: string;
|
|
77
79
|
readonly token?: string;
|
|
80
|
+
readonly domain?: string;
|
|
81
|
+
readonly debug?: boolean;
|
|
82
|
+
readonly proxy?: string;
|
|
78
83
|
private readonly config;
|
|
79
84
|
private readonly control;
|
|
85
|
+
constructor(volumeId: string, name: string, token: string, domain?: string, debug?: boolean, proxy?: string);
|
|
80
86
|
constructor(opts: {
|
|
81
87
|
volumeId: string;
|
|
82
88
|
name?: string;
|
|
@@ -87,13 +93,13 @@ export declare class Volume {
|
|
|
87
93
|
/** Create a persistent volume and return a connected SDK object. */
|
|
88
94
|
static create(name: string, opts?: VolumeApiParams): Promise<Volume>;
|
|
89
95
|
/** Connect to an existing volume by id or name. */
|
|
90
|
-
static connect(volumeId: string, opts?:
|
|
96
|
+
static connect(volumeId: string, opts?: VolumeApiOpts): Promise<Volume>;
|
|
91
97
|
/** Fetch metadata for an existing volume by id or name. */
|
|
92
|
-
static getInfo(volumeId: string, opts?:
|
|
98
|
+
static getInfo(volumeId: string, opts?: VolumeApiOpts): Promise<VolumeInfo>;
|
|
93
99
|
/** List volumes visible to the configured API key. */
|
|
94
100
|
static list(opts?: VolumeListOpts): Promise<VolumeInfo[]>;
|
|
95
101
|
/** Destroy a volume by id or name. Returns false when it does not exist. */
|
|
96
|
-
static destroy(volumeId: string, opts?:
|
|
102
|
+
static destroy(volumeId: string, opts?: VolumeApiOpts): Promise<boolean>;
|
|
97
103
|
/** Fetch this volume's latest metadata. */
|
|
98
104
|
getInfo(): Promise<VolumeInfo>;
|
|
99
105
|
/** Fetch metadata for a path inside this volume. */
|
package/dist/volume.js
CHANGED
|
@@ -10,21 +10,41 @@ export var VolumeFileType;
|
|
|
10
10
|
VolumeFileType["DIRECTORY"] = "directory";
|
|
11
11
|
VolumeFileType["SYMLINK"] = "symlink";
|
|
12
12
|
})(VolumeFileType || (VolumeFileType = {}));
|
|
13
|
-
export
|
|
13
|
+
export class VolumeConnectionConfig extends ConnectionConfig {
|
|
14
|
+
token;
|
|
15
|
+
constructor(volume, opts = {}) {
|
|
16
|
+
super(opts);
|
|
17
|
+
this.token = volume.token;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
14
20
|
/** Persistent volume that can be mounted into sandboxes and edited while detached. */
|
|
15
21
|
export class Volume {
|
|
16
22
|
volumeId;
|
|
17
23
|
id;
|
|
18
24
|
name;
|
|
19
25
|
token;
|
|
26
|
+
domain;
|
|
27
|
+
debug;
|
|
28
|
+
proxy;
|
|
20
29
|
config;
|
|
21
30
|
control;
|
|
22
|
-
constructor(
|
|
31
|
+
constructor(volumeOrOpts, name, token, domain, debug, proxy) {
|
|
32
|
+
const opts = typeof volumeOrOpts === 'string'
|
|
33
|
+
? {
|
|
34
|
+
volumeId: volumeOrOpts,
|
|
35
|
+
name,
|
|
36
|
+
token,
|
|
37
|
+
connectionConfig: new ConnectionConfig({ domain, debug, proxy }),
|
|
38
|
+
}
|
|
39
|
+
: volumeOrOpts;
|
|
23
40
|
this.volumeId = String(opts.volumeId);
|
|
24
41
|
this.id = this.volumeId;
|
|
25
42
|
this.name = opts.name ?? this.volumeId;
|
|
26
43
|
this.token = opts.token;
|
|
27
44
|
this.config = opts.connectionConfig;
|
|
45
|
+
this.domain = this.config.domain;
|
|
46
|
+
this.debug = this.config.debug;
|
|
47
|
+
this.proxy = this.config.proxy;
|
|
28
48
|
this.control = opts.control ?? new ControlClient(this.config);
|
|
29
49
|
}
|
|
30
50
|
/** Create a persistent volume and return a connected SDK object. */
|