@unikraft/cloud-plugin-sandbox-api 1.1.0-next.3 → 1.1.0-next.4
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 +13 -8
- package/dist/api/commands.gen.d.ts +5 -2
- package/dist/api/commands.gen.d.ts.map +1 -1
- package/dist/api/commands.gen.js +17 -14
- package/dist/api/commands.gen.js.map +1 -1
- package/dist/api/fs.gen.d.ts +5 -2
- package/dist/api/fs.gen.d.ts.map +1 -1
- package/dist/api/fs.gen.js +11 -8
- package/dist/api/fs.gen.js.map +1 -1
- package/dist/api/index.gen.d.ts +1 -1
- package/dist/api/index.gen.d.ts.map +1 -1
- package/dist/index.d.ts +10 -6
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +17 -10
- package/dist/index.js.map +1 -1
- package/dist/transport.d.ts +30 -0
- package/dist/transport.d.ts.map +1 -0
- package/dist/transport.js +14 -0
- package/dist/transport.js.map +1 -0
- package/package.json +4 -7
package/README.md
CHANGED
|
@@ -13,11 +13,13 @@ this package and creates the instance for you.
|
|
|
13
13
|
## Install
|
|
14
14
|
|
|
15
15
|
```sh
|
|
16
|
-
npm install @unikraft/cloud-plugin-sandbox-api
|
|
16
|
+
npm install @unikraft/cloud-plugin-sandbox-api
|
|
17
17
|
```
|
|
18
18
|
|
|
19
|
-
|
|
20
|
-
|
|
19
|
+
The package has no dependencies. Each generated class takes a `Transport`, an
|
|
20
|
+
object with `request()`, `bytes()` and `stream()`. The `ApiClient` of
|
|
21
|
+
`@unikraft/cloud` is one. If you want to use it as the transport, install the
|
|
22
|
+
SDK.
|
|
21
23
|
|
|
22
24
|
## Usage
|
|
23
25
|
|
|
@@ -25,12 +27,15 @@ The plugin runs inside a single instance and answers on that instance's plugin
|
|
|
25
27
|
route, so `baseUrl` is the full plugin endpoint rather than a metro root.
|
|
26
28
|
|
|
27
29
|
```ts
|
|
30
|
+
import { ApiClient } from "@unikraft/cloud/core/http";
|
|
28
31
|
import { SandboxPluginApi } from "@unikraft/cloud-plugin-sandbox-api";
|
|
29
32
|
|
|
30
|
-
const api = new SandboxPluginApi(
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
33
|
+
const api = new SandboxPluginApi(
|
|
34
|
+
new ApiClient({
|
|
35
|
+
baseUrl: `https://api.fra.unikraft.cloud/v1/instances/${uuid}/plugins/sandbox`,
|
|
36
|
+
token: process.env.UKC_TOKEN,
|
|
37
|
+
}),
|
|
38
|
+
);
|
|
34
39
|
```
|
|
35
40
|
|
|
36
41
|
The last path segment is whatever name the plugin was attached under in the
|
|
@@ -41,7 +46,7 @@ SDK build that URL for you, use `@unikraft/cloud` instead.
|
|
|
41
46
|
|
|
42
47
|
| Import | Carries |
|
|
43
48
|
| --- | --- |
|
|
44
|
-
| `@unikraft/cloud-plugin-sandbox-api` | `SandboxPluginApi`, `CommandsApi`, `FsApi`, `models` |
|
|
49
|
+
| `@unikraft/cloud-plugin-sandbox-api` | `SandboxPluginApi`, `CommandsApi`, `FsApi`, `models`, and the types `Transport`, `RequestArgs`, `CallOptions` |
|
|
45
50
|
| `@unikraft/cloud-plugin-sandbox-api/models` | The wire types |
|
|
46
51
|
|
|
47
52
|
`SandboxPluginApi` groups one client per resource:
|
|
@@ -1,10 +1,13 @@
|
|
|
1
|
-
import { ApiClient, type CallOptions } from "@unikraft/cloud/core/http";
|
|
2
1
|
import type * as models from "./models.gen.js";
|
|
2
|
+
import type { CallOptions, Transport } from "../transport.js";
|
|
3
3
|
/**
|
|
4
4
|
* Low-level "plumbing" client for the {@link https://unikraft.com|Unikraft
|
|
5
5
|
* Cloud} `commands` resource. Methods return the raw response envelope.
|
|
6
6
|
*/
|
|
7
|
-
export declare class CommandsApi
|
|
7
|
+
export declare class CommandsApi {
|
|
8
|
+
/** The transport every request of this resource goes through. */
|
|
9
|
+
readonly transport: Transport;
|
|
10
|
+
constructor(transport: Transport);
|
|
8
11
|
/**
|
|
9
12
|
* Delete Command by UUID
|
|
10
13
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"commands.gen.d.ts","sourceRoot":"","sources":["../../src/api/commands.gen.ts"],"names":[],"mappings":"AACA,OAAO,
|
|
1
|
+
{"version":3,"file":"commands.gen.d.ts","sourceRoot":"","sources":["../../src/api/commands.gen.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,MAAM,iBAAiB,CAAC;AAC/C,OAAO,KAAK,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE9D;;;GAGG;AACH,qBAAa,WAAW;IACtB,iEAAiE;IACjE,QAAQ,CAAC,SAAS,EAAE,SAAS,CAAC;IAE9B,YAAY,SAAS,EAAE,SAAS,EAE/B;IAED;;OAEG;IACH,mBAAmB,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,GAAE,WAAgB,GAAG,OAAO,CAAC,MAAM,CAAC,aAAa,CAAC,CAQzF;IAED;;OAEG;IACH,uBAAuB,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,GAAE,WAAgB,GAAG,OAAO,CAAC,MAAM,CAAC,aAAa,CAAC,CAQ7F;IAED;;OAEG;IACH,gBAAgB,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,GAAE,WAAgB,GAAG,OAAO,CAAC,MAAM,CAAC,kBAAkB,CAAC,CAQ3F;IAED;;OAEG;IACH,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,GAAE,WAAgB,GAAG,OAAO,CAAC,MAAM,CAAC,mBAAmB,CAAC,CAQ1F;IAED;;OAEG;IACH,gBAAgB,CACd,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,MAAM,CAAC,gBAAgB,EAC/B,MAAM,GAAE;QACN,KAAK,CAAC,EAAE,MAAM,CAAC;KAChB,GAAG,WAAgB,GACnB,OAAO,CAAC,UAAU,CAAC,CAcrB;IAED;;OAEG;IACH,YAAY,CAAC,MAAM,GAAE,WAAgB,GAAG,OAAO,CAAC,MAAM,CAAC,oBAAoB,CAAC,CAQ3E;IAED;;OAEG;IACH,UAAU,CACR,MAAM,EAAE;QACN,IAAI,EAAE,MAAM,CAAC,iBAAiB,CAAC;KAChC,GAAG,WAAW,GACd,OAAO,CAAC,MAAM,CAAC,kBAAkB,CAAC,CASpC;IAED;;OAEG;IACH,aAAa,CACX,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE;QACN,IAAI,EAAE,MAAM,CAAC,oBAAoB,CAAC;KACnC,GAAG,WAAW,GACd,OAAO,CAAC,MAAM,CAAC,aAAa,CAAC,CAS/B;IAED;;OAEG;IACH,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,GAAE,WAAgB,GAAG,OAAO,CAAC,MAAM,CAAC,aAAa,CAAC,CAQpF;IAED;;OAEG;IACH,yBAAyB,CACvB,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE;QACN,IAAI,EAAE,MAAM,CAAC,yBAAyB,CAAC;KACxC,GAAG,WAAW,GACd,OAAO,CAAC,MAAM,CAAC,aAAa,CAAC,CAS/B;IAED;;OAEG;IACH,iBAAiB,CACf,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE;QACN,IAAI,EAAE,MAAM,CAAC,mBAAmB,CAAC;KAClC,GAAG,WAAW,GACd,OAAO,CAAC,MAAM,CAAC,aAAa,CAAC,CAS/B;CACF"}
|
package/dist/api/commands.gen.js
CHANGED
|
@@ -1,15 +1,18 @@
|
|
|
1
|
-
// Code generated by openapi-gen; DO NOT EDIT.
|
|
2
|
-
import { ApiClient } from "@unikraft/cloud/core/http";
|
|
3
1
|
/**
|
|
4
2
|
* Low-level "plumbing" client for the {@link https://unikraft.com|Unikraft
|
|
5
3
|
* Cloud} `commands` resource. Methods return the raw response envelope.
|
|
6
4
|
*/
|
|
7
|
-
export class CommandsApi
|
|
5
|
+
export class CommandsApi {
|
|
6
|
+
/** The transport every request of this resource goes through. */
|
|
7
|
+
transport;
|
|
8
|
+
constructor(transport) {
|
|
9
|
+
this.transport = transport;
|
|
10
|
+
}
|
|
8
11
|
/**
|
|
9
12
|
* Delete Command by UUID
|
|
10
13
|
*/
|
|
11
14
|
deleteCommandByUuid(uuid, params = {}) {
|
|
12
|
-
return this.request({
|
|
15
|
+
return this.transport.request({
|
|
13
16
|
method: "DELETE",
|
|
14
17
|
path: `/commands/${encodeURIComponent(uuid)}`,
|
|
15
18
|
}, params);
|
|
@@ -18,7 +21,7 @@ export class CommandsApi extends ApiClient {
|
|
|
18
21
|
* Delete Command Logs
|
|
19
22
|
*/
|
|
20
23
|
deleteCommandLogsByUuid(uuid, params = {}) {
|
|
21
|
-
return this.request({
|
|
24
|
+
return this.transport.request({
|
|
22
25
|
method: "DELETE",
|
|
23
26
|
path: `/commands/${encodeURIComponent(uuid)}/logs`,
|
|
24
27
|
}, params);
|
|
@@ -27,7 +30,7 @@ export class CommandsApi extends ApiClient {
|
|
|
27
30
|
* Get Command by UUID
|
|
28
31
|
*/
|
|
29
32
|
getCommandByUuid(uuid, params = {}) {
|
|
30
|
-
return this.request({
|
|
33
|
+
return this.transport.request({
|
|
31
34
|
method: "GET",
|
|
32
35
|
path: `/commands/${encodeURIComponent(uuid)}`,
|
|
33
36
|
}, params);
|
|
@@ -36,7 +39,7 @@ export class CommandsApi extends ApiClient {
|
|
|
36
39
|
* Get Command Logs
|
|
37
40
|
*/
|
|
38
41
|
getCommandLogs(uuid, params = {}) {
|
|
39
|
-
return this.request({
|
|
42
|
+
return this.transport.request({
|
|
40
43
|
method: "GET",
|
|
41
44
|
path: `/commands/${encodeURIComponent(uuid)}/logs`,
|
|
42
45
|
}, params);
|
|
@@ -45,7 +48,7 @@ export class CommandsApi extends ApiClient {
|
|
|
45
48
|
* Get Raw Command Log
|
|
46
49
|
*/
|
|
47
50
|
getRawCommandLog(uuid, stream, params = {}) {
|
|
48
|
-
return this.bytes({
|
|
51
|
+
return this.transport.bytes({
|
|
49
52
|
method: "GET",
|
|
50
53
|
path: `/commands/${encodeURIComponent(uuid)}/logs/raw/${encodeURIComponent(stream)}`,
|
|
51
54
|
}, {
|
|
@@ -60,7 +63,7 @@ export class CommandsApi extends ApiClient {
|
|
|
60
63
|
* List Commands
|
|
61
64
|
*/
|
|
62
65
|
listCommands(params = {}) {
|
|
63
|
-
return this.request({
|
|
66
|
+
return this.transport.request({
|
|
64
67
|
method: "GET",
|
|
65
68
|
path: `/commands`,
|
|
66
69
|
}, params);
|
|
@@ -69,7 +72,7 @@ export class CommandsApi extends ApiClient {
|
|
|
69
72
|
* Start Command
|
|
70
73
|
*/
|
|
71
74
|
runCommand(params) {
|
|
72
|
-
return this.request({
|
|
75
|
+
return this.transport.request({
|
|
73
76
|
method: "POST",
|
|
74
77
|
path: `/commands`,
|
|
75
78
|
body: params.body,
|
|
@@ -79,7 +82,7 @@ export class CommandsApi extends ApiClient {
|
|
|
79
82
|
* Signal Command
|
|
80
83
|
*/
|
|
81
84
|
signalCommand(uuid, params) {
|
|
82
|
-
return this.request({
|
|
85
|
+
return this.transport.request({
|
|
83
86
|
method: "POST",
|
|
84
87
|
path: `/commands/${encodeURIComponent(uuid)}/signal`,
|
|
85
88
|
body: params.body,
|
|
@@ -89,7 +92,7 @@ export class CommandsApi extends ApiClient {
|
|
|
89
92
|
* Wait for Command
|
|
90
93
|
*/
|
|
91
94
|
waitForCommand(uuid, params = {}) {
|
|
92
|
-
return this.request({
|
|
95
|
+
return this.transport.request({
|
|
93
96
|
method: "POST",
|
|
94
97
|
path: `/commands/${encodeURIComponent(uuid)}/wait`,
|
|
95
98
|
}, params);
|
|
@@ -98,7 +101,7 @@ export class CommandsApi extends ApiClient {
|
|
|
98
101
|
* Wait for Command with Timeout
|
|
99
102
|
*/
|
|
100
103
|
waitForCommandWithTimeout(uuid, params) {
|
|
101
|
-
return this.request({
|
|
104
|
+
return this.transport.request({
|
|
102
105
|
method: "POST",
|
|
103
106
|
path: `/commands/${encodeURIComponent(uuid)}/wait_timeout`,
|
|
104
107
|
body: params.body,
|
|
@@ -108,7 +111,7 @@ export class CommandsApi extends ApiClient {
|
|
|
108
111
|
* Write Command Stdin
|
|
109
112
|
*/
|
|
110
113
|
writeCommandStdin(uuid, params) {
|
|
111
|
-
return this.request({
|
|
114
|
+
return this.transport.request({
|
|
112
115
|
method: "POST",
|
|
113
116
|
path: `/commands/${encodeURIComponent(uuid)}/stdin`,
|
|
114
117
|
body: params.body,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"commands.gen.js","sourceRoot":"","sources":["../../src/api/commands.gen.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"commands.gen.js","sourceRoot":"","sources":["../../src/api/commands.gen.ts"],"names":[],"mappings":"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"}
|
package/dist/api/fs.gen.d.ts
CHANGED
|
@@ -1,10 +1,13 @@
|
|
|
1
|
-
import { ApiClient, type CallOptions } from "@unikraft/cloud/core/http";
|
|
2
1
|
import type * as models from "./models.gen.js";
|
|
2
|
+
import type { CallOptions, Transport } from "../transport.js";
|
|
3
3
|
/**
|
|
4
4
|
* Low-level "plumbing" client for the {@link https://unikraft.com|Unikraft
|
|
5
5
|
* Cloud} `fs` resource. Methods return the raw response envelope.
|
|
6
6
|
*/
|
|
7
|
-
export declare class FsApi
|
|
7
|
+
export declare class FsApi {
|
|
8
|
+
/** The transport every request of this resource goes through. */
|
|
9
|
+
readonly transport: Transport;
|
|
10
|
+
constructor(transport: Transport);
|
|
8
11
|
/**
|
|
9
12
|
* Create Directory
|
|
10
13
|
*/
|
package/dist/api/fs.gen.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fs.gen.d.ts","sourceRoot":"","sources":["../../src/api/fs.gen.ts"],"names":[],"mappings":"AACA,OAAO,
|
|
1
|
+
{"version":3,"file":"fs.gen.d.ts","sourceRoot":"","sources":["../../src/api/fs.gen.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,MAAM,iBAAiB,CAAC;AAC/C,OAAO,KAAK,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE9D;;;GAGG;AACH,qBAAa,KAAK;IAChB,iEAAiE;IACjE,QAAQ,CAAC,SAAS,EAAE,SAAS,CAAC;IAE9B,YAAY,SAAS,EAAE,SAAS,EAE/B;IAED;;OAEG;IACH,eAAe,CACb,MAAM,EAAE;QACN,IAAI,EAAE,MAAM,CAAC,YAAY,CAAC;KAC3B,GAAG,WAAW,GACd,OAAO,CAAC,MAAM,CAAC,aAAa,CAAC,CAS/B;IAED;;OAEG;IACH,QAAQ,CACN,MAAM,EAAE;QACN,IAAI,EAAE,MAAM,CAAC,eAAe,CAAC;KAC9B,GAAG,WAAW,GACd,OAAO,CAAC,MAAM,CAAC,gBAAgB,CAAC,CASlC;IAED;;OAEG;IACH,WAAW,CACT,MAAM,EAAE;QACN,IAAI,EAAE,MAAM,CAAC,eAAe,CAAC;KAC9B,GAAG,WAAW,GACd,OAAO,CAAC,UAAU,CAAC,CASrB;IAED;;OAEG;IACH,UAAU,CACR,MAAM,EAAE;QACN,IAAI,EAAE,MAAM,CAAC,iBAAiB,CAAC;KAChC,GAAG,WAAW,GACd,OAAO,CAAC,MAAM,CAAC,aAAa,CAAC,CAS/B;IAED;;OAEG;IACH,SAAS,CACP,MAAM,EAAE;QACN,IAAI,EAAE,MAAM,CAAC,gBAAgB,CAAC;KAC/B,GAAG,WAAW,GACd,OAAO,CAAC,MAAM,CAAC,aAAa,CAAC,CAS/B;CACF"}
|
package/dist/api/fs.gen.js
CHANGED
|
@@ -1,15 +1,18 @@
|
|
|
1
|
-
// Code generated by openapi-gen; DO NOT EDIT.
|
|
2
|
-
import { ApiClient } from "@unikraft/cloud/core/http";
|
|
3
1
|
/**
|
|
4
2
|
* Low-level "plumbing" client for the {@link https://unikraft.com|Unikraft
|
|
5
3
|
* Cloud} `fs` resource. Methods return the raw response envelope.
|
|
6
4
|
*/
|
|
7
|
-
export class FsApi
|
|
5
|
+
export class FsApi {
|
|
6
|
+
/** The transport every request of this resource goes through. */
|
|
7
|
+
transport;
|
|
8
|
+
constructor(transport) {
|
|
9
|
+
this.transport = transport;
|
|
10
|
+
}
|
|
8
11
|
/**
|
|
9
12
|
* Create Directory
|
|
10
13
|
*/
|
|
11
14
|
createDirectory(params) {
|
|
12
|
-
return this.request({
|
|
15
|
+
return this.transport.request({
|
|
13
16
|
method: "POST",
|
|
14
17
|
path: `/fs/mkdir`,
|
|
15
18
|
body: params.body,
|
|
@@ -19,7 +22,7 @@ export class FsApi extends ApiClient {
|
|
|
19
22
|
* Read File
|
|
20
23
|
*/
|
|
21
24
|
readFile(params) {
|
|
22
|
-
return this.request({
|
|
25
|
+
return this.transport.request({
|
|
23
26
|
method: "POST",
|
|
24
27
|
path: `/fs/read`,
|
|
25
28
|
body: params.body,
|
|
@@ -29,7 +32,7 @@ export class FsApi extends ApiClient {
|
|
|
29
32
|
* Read Raw File
|
|
30
33
|
*/
|
|
31
34
|
readRawFile(params) {
|
|
32
|
-
return this.bytes({
|
|
35
|
+
return this.transport.bytes({
|
|
33
36
|
method: "POST",
|
|
34
37
|
path: `/fs/read_raw`,
|
|
35
38
|
body: params.body,
|
|
@@ -39,7 +42,7 @@ export class FsApi extends ApiClient {
|
|
|
39
42
|
* Upload File
|
|
40
43
|
*/
|
|
41
44
|
uploadFile(params) {
|
|
42
|
-
return this.request({
|
|
45
|
+
return this.transport.request({
|
|
43
46
|
method: "POST",
|
|
44
47
|
path: `/fs/upload`,
|
|
45
48
|
body: params.body,
|
|
@@ -49,7 +52,7 @@ export class FsApi extends ApiClient {
|
|
|
49
52
|
* Write File
|
|
50
53
|
*/
|
|
51
54
|
writeFile(params) {
|
|
52
|
-
return this.request({
|
|
55
|
+
return this.transport.request({
|
|
53
56
|
method: "POST",
|
|
54
57
|
path: `/fs/write`,
|
|
55
58
|
body: params.body,
|
package/dist/api/fs.gen.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fs.gen.js","sourceRoot":"","sources":["../../src/api/fs.gen.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"fs.gen.js","sourceRoot":"","sources":["../../src/api/fs.gen.ts"],"names":[],"mappings":"AAIA;;;GAGG;AACH,MAAM,OAAO,KAAK;IAChB,iEAAiE;IACxD,SAAS,CAAY;IAE9B,YAAY,SAAoB;QAC9B,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;IAC7B,CAAC;IAED;;OAEG;IACH,eAAe,CACb,MAEe;QAEf,OAAO,IAAI,CAAC,SAAS,CAAC,OAAO,CAC3B;YACE,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,WAAW;YACjB,IAAI,EAAE,MAAM,CAAC,IAAI;SAClB,EACD,MAAM,CACP,CAAC;IACJ,CAAC;IAED;;OAEG;IACH,QAAQ,CACN,MAEe;QAEf,OAAO,IAAI,CAAC,SAAS,CAAC,OAAO,CAC3B;YACE,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,UAAU;YAChB,IAAI,EAAE,MAAM,CAAC,IAAI;SAClB,EACD,MAAM,CACP,CAAC;IACJ,CAAC;IAED;;OAEG;IACH,WAAW,CACT,MAEe;QAEf,OAAO,IAAI,CAAC,SAAS,CAAC,KAAK,CACzB;YACE,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,cAAc;YACpB,IAAI,EAAE,MAAM,CAAC,IAAI;SAClB,EACD,MAAM,CACP,CAAC;IACJ,CAAC;IAED;;OAEG;IACH,UAAU,CACR,MAEe;QAEf,OAAO,IAAI,CAAC,SAAS,CAAC,OAAO,CAC3B;YACE,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,YAAY;YAClB,IAAI,EAAE,MAAM,CAAC,IAAI;SAClB,EACD,MAAM,CACP,CAAC;IACJ,CAAC;IAED;;OAEG;IACH,SAAS,CACP,MAEe;QAEf,OAAO,IAAI,CAAC,SAAS,CAAC,OAAO,CAC3B;YACE,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,WAAW;YACjB,IAAI,EAAE,MAAM,CAAC,IAAI;SAClB,EACD,MAAM,CACP,CAAC;IACJ,CAAC;CACF"}
|
package/dist/api/index.gen.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export type {
|
|
1
|
+
export type { CallOptions, RequestArgs, Transport } from "../transport.js";
|
|
2
2
|
export * as models from "./models.gen.js";
|
|
3
3
|
export { CommandsApi } from "./commands.gen.js";
|
|
4
4
|
export { FsApi } from "./fs.gen.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.gen.d.ts","sourceRoot":"","sources":["../../src/api/index.gen.ts"],"names":[],"mappings":"AAGA,YAAY,EAAE,
|
|
1
|
+
{"version":3,"file":"index.gen.d.ts","sourceRoot":"","sources":["../../src/api/index.gen.ts"],"names":[],"mappings":"AAGA,YAAY,EAAE,WAAW,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC3E,OAAO,KAAK,MAAM,MAAM,iBAAiB,CAAC;AAC1C,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,24 +1,28 @@
|
|
|
1
1
|
import { CommandsApi } from "./api/commands.gen.js";
|
|
2
2
|
import { FsApi } from "./api/fs.gen.js";
|
|
3
|
-
import type {
|
|
3
|
+
import type { Transport } from "./transport.js";
|
|
4
4
|
/**
|
|
5
5
|
* The porcelain layer in `@unikraft/cloud` derives the URL. Use this class
|
|
6
6
|
* only when you want the raw envelopes against an instance you already have.
|
|
7
7
|
*
|
|
8
8
|
* @example
|
|
9
|
+
* import { ApiClient } from "@unikraft/cloud/core/http";
|
|
9
10
|
* import { SandboxPluginApi } from "@unikraft/cloud-plugin-sandbox-api";
|
|
10
11
|
*
|
|
11
|
-
* const api = new SandboxPluginApi(
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
12
|
+
* const api = new SandboxPluginApi(
|
|
13
|
+
* new ApiClient({
|
|
14
|
+
* baseUrl: `https://api.fra.unikraft.cloud/v1/instances/${uuid}/plugins/sandbox`,
|
|
15
|
+
* token: process.env.UKC_TOKEN,
|
|
16
|
+
* }),
|
|
17
|
+
* );
|
|
15
18
|
*/
|
|
16
19
|
export declare class SandboxPluginApi {
|
|
17
20
|
/** The `commands` resource of this plugin. */
|
|
18
21
|
readonly commands: CommandsApi;
|
|
19
22
|
/** The `fs` resource of this plugin. */
|
|
20
23
|
readonly fs: FsApi;
|
|
21
|
-
constructor(
|
|
24
|
+
constructor(transport: Transport);
|
|
22
25
|
}
|
|
23
26
|
export * from "./api/index.gen.js";
|
|
27
|
+
export type { CallOptions, RequestArgs, Transport } from "./transport.js";
|
|
24
28
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAExC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAEhD;;;;;;;;;;;;;;GAcG;AACH,qBAAa,gBAAgB;IAC3B,8CAA8C;IAC9C,QAAQ,CAAC,QAAQ,EAAE,WAAW,CAAC;IAC/B,wCAAwC;IACxC,QAAQ,CAAC,EAAE,EAAE,KAAK,CAAC;IAEnB,YAAY,SAAS,EAAE,SAAS,EAU/B;CACF;AAED,cAAc,oBAAoB,CAAC;AACnC,YAAY,EAAE,WAAW,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
// Code generated by openapi-gen; DO NOT EDIT.
|
|
2
2
|
//
|
|
3
3
|
// The `sandbox` plugin API's "plumbing" layer: the generated clients, plus a
|
|
4
|
-
// container that groups them behind one transport
|
|
5
|
-
//
|
|
6
|
-
// it.
|
|
4
|
+
// container that groups them behind one transport. Everything here returns the
|
|
5
|
+
// response envelope exactly as the OpenAPI specification describes it.
|
|
7
6
|
import { CommandsApi } from "./api/commands.gen.js";
|
|
8
7
|
import { FsApi } from "./api/fs.gen.js";
|
|
9
8
|
/**
|
|
@@ -11,21 +10,29 @@ import { FsApi } from "./api/fs.gen.js";
|
|
|
11
10
|
* only when you want the raw envelopes against an instance you already have.
|
|
12
11
|
*
|
|
13
12
|
* @example
|
|
13
|
+
* import { ApiClient } from "@unikraft/cloud/core/http";
|
|
14
14
|
* import { SandboxPluginApi } from "@unikraft/cloud-plugin-sandbox-api";
|
|
15
15
|
*
|
|
16
|
-
* const api = new SandboxPluginApi(
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
16
|
+
* const api = new SandboxPluginApi(
|
|
17
|
+
* new ApiClient({
|
|
18
|
+
* baseUrl: `https://api.fra.unikraft.cloud/v1/instances/${uuid}/plugins/sandbox`,
|
|
19
|
+
* token: process.env.UKC_TOKEN,
|
|
20
|
+
* }),
|
|
21
|
+
* );
|
|
20
22
|
*/
|
|
21
23
|
export class SandboxPluginApi {
|
|
22
24
|
/** The `commands` resource of this plugin. */
|
|
23
25
|
commands;
|
|
24
26
|
/** The `fs` resource of this plugin. */
|
|
25
27
|
fs;
|
|
26
|
-
constructor(
|
|
27
|
-
|
|
28
|
-
|
|
28
|
+
constructor(transport) {
|
|
29
|
+
for (const method of ["request", "bytes", "stream"]) {
|
|
30
|
+
if (typeof transport[method] !== "function") {
|
|
31
|
+
throw new TypeError(`The transport has no ${method}() method. Pass an ApiClient from @unikraft/cloud/core/http, or an object with request(), bytes() and stream().`);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
this.commands = new CommandsApi(transport);
|
|
35
|
+
this.fs = new FsApi(transport);
|
|
29
36
|
}
|
|
30
37
|
}
|
|
31
38
|
export * from "./api/index.gen.js";
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,8CAA8C;AAC9C,EAAE;AACF,6EAA6E;AAC7E
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,8CAA8C;AAC9C,EAAE;AACF,6EAA6E;AAC7E,+EAA+E;AAC/E,uEAAuE;AACvE,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAIxC;;;;;;;;;;;;;;GAcG;AACH,MAAM,OAAO,gBAAgB;IAC3B,8CAA8C;IACrC,QAAQ,CAAc;IAC/B,wCAAwC;IAC/B,EAAE,CAAQ;IAEnB,YAAY,SAAoB;QAC9B,KAAK,MAAM,MAAM,IAAI,CAAC,SAAS,EAAE,OAAO,EAAE,QAAQ,CAAU,EAAE,CAAC;YAC7D,IAAI,OAAO,SAAS,CAAC,MAAM,CAAC,KAAK,UAAU,EAAE,CAAC;gBAC5C,MAAM,IAAI,SAAS,CACjB,wBAAwB,MAAM,iHAAiH,CAChJ,CAAC;YACJ,CAAC;QACH,CAAC;QACD,IAAI,CAAC,QAAQ,GAAG,IAAI,WAAW,CAAC,SAAS,CAAC,CAAC;QAC3C,IAAI,CAAC,EAAE,GAAG,IAAI,KAAK,CAAC,SAAS,CAAC,CAAC;IACjC,CAAC;CACF;AAED,cAAc,oBAAoB,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/** A value that can be serialised into a query string. */
|
|
2
|
+
export type QueryValue = string | number | boolean | Array<string | number | boolean> | undefined | null;
|
|
3
|
+
/** Per-call options accepted by every generated operation. */
|
|
4
|
+
export interface CallOptions {
|
|
5
|
+
/** Abort the request via an `AbortSignal`. */
|
|
6
|
+
signal?: AbortSignal;
|
|
7
|
+
/** Extra headers merged over the client defaults for this call only. */
|
|
8
|
+
headers?: Record<string, string>;
|
|
9
|
+
/** Override the base URL (e.g. to target a different metro) for this call. */
|
|
10
|
+
baseUrl?: string;
|
|
11
|
+
}
|
|
12
|
+
/** The shape of one request, as a generated operation hands it to the transport. */
|
|
13
|
+
export interface RequestArgs {
|
|
14
|
+
method: string;
|
|
15
|
+
path: string;
|
|
16
|
+
query?: Record<string, QueryValue>;
|
|
17
|
+
body?: unknown;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* What a generated class needs from the SDK: one method per response shape.
|
|
21
|
+
*/
|
|
22
|
+
export interface Transport {
|
|
23
|
+
/** Perform a request and return the parsed JSON envelope typed as `T`. */
|
|
24
|
+
request<T>(args: RequestArgs, options?: CallOptions): Promise<T>;
|
|
25
|
+
/** Perform a request whose response is a raw byte body and return it verbatim. */
|
|
26
|
+
bytes(args: RequestArgs, options?: CallOptions): Promise<Uint8Array>;
|
|
27
|
+
/** Perform a request whose response is a `text/event-stream` and yield each event's payload. */
|
|
28
|
+
stream<T>(args: RequestArgs, options?: CallOptions): AsyncGenerator<T, void, void>;
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=transport.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transport.d.ts","sourceRoot":"","sources":["../src/transport.ts"],"names":[],"mappings":"AAaA,0DAA0D;AAC1D,MAAM,MAAM,UAAU,GAClB,MAAM,GACN,MAAM,GACN,OAAO,GACP,KAAK,CAAC,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC,GAChC,SAAS,GACT,IAAI,CAAC;AAET,8DAA8D;AAC9D,MAAM,WAAW,WAAW;IAC1B,8CAA8C;IAC9C,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB,wEAAwE;IACxE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACjC,8EAA8E;IAC9E,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,oFAAoF;AACpF,MAAM,WAAW,WAAW;IAC1B,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;IACnC,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB;AAED;;GAEG;AACH,MAAM,WAAW,SAAS;IACxB,0EAA0E;IAC1E,OAAO,CAAC,CAAC,EAAE,IAAI,EAAE,WAAW,EAAE,OAAO,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;IACjE,kFAAkF;IAClF,KAAK,CAAC,IAAI,EAAE,WAAW,EAAE,OAAO,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;IACrE,gGAAgG;IAChG,MAAM,CAAC,CAAC,EAAE,IAAI,EAAE,WAAW,EAAE,OAAO,CAAC,EAAE,WAAW,GAAG,cAAc,CAAC,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;CACpF"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
// Code generated by openapi-gen; DO NOT EDIT.
|
|
2
|
+
//
|
|
3
|
+
// The contract between this package and the transport that carries its
|
|
4
|
+
// requests. `ApiClient` in `@unikraft/cloud/core/http` implements it, and any
|
|
5
|
+
// object with these three methods satisfies it, because the type is structural.
|
|
6
|
+
// This file imports nothing, so the package needs no dependency on the SDK.
|
|
7
|
+
//
|
|
8
|
+
// This is the only copy of the interface. The SDK's `ApiClient` satisfies it by
|
|
9
|
+
// shape, and the SDK's test suite checks that against the published plugin
|
|
10
|
+
// package. Widening is safe: a new optional parameter, a wider input type. A
|
|
11
|
+
// rename, a new required parameter, or a changed return type must reach
|
|
12
|
+
// `ApiClient` in the SDK as well, and every plugin package must be republished.
|
|
13
|
+
export {};
|
|
14
|
+
//# sourceMappingURL=transport.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transport.js","sourceRoot":"","sources":["../src/transport.ts"],"names":[],"mappings":"AAAA,8CAA8C;AAC9C,EAAE;AACF,uEAAuE;AACvE,8EAA8E;AAC9E,gFAAgF;AAChF,4EAA4E;AAC5E,EAAE;AACF,gFAAgF;AAChF,2EAA2E;AAC3E,6EAA6E;AAC7E,wEAAwE;AACxE,gFAAgF"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@unikraft/cloud-plugin-sandbox-api",
|
|
3
|
-
"version": "1.1.0-next.
|
|
3
|
+
"version": "1.1.0-next.4",
|
|
4
4
|
"description": "Generated TypeScript client for the Unikraft Cloud `sandbox` plugin API",
|
|
5
5
|
"license": "BSD-3-Clause",
|
|
6
6
|
"author": "Unikraft GmbH",
|
|
@@ -30,9 +30,6 @@
|
|
|
30
30
|
"typecheck": "tsc --noEmit",
|
|
31
31
|
"format": "biome format --write src"
|
|
32
32
|
},
|
|
33
|
-
"peerDependencies": {
|
|
34
|
-
"@unikraft/cloud": ">=0.2.0-0 <0.3.0"
|
|
35
|
-
},
|
|
36
33
|
"devDependencies": {
|
|
37
34
|
"@biomejs/biome": "^2.5.13",
|
|
38
35
|
"typescript": "^7.0.2"
|
|
@@ -41,8 +38,8 @@
|
|
|
41
38
|
"access": "public"
|
|
42
39
|
},
|
|
43
40
|
"unikraft": {
|
|
44
|
-
"specHash": "
|
|
45
|
-
"templatesHash": "
|
|
46
|
-
"configHash": "
|
|
41
|
+
"specHash": "fe2a902ae04c2934eb14f7e7db0f5e75f9598471532986f01a939229d38b06d4",
|
|
42
|
+
"templatesHash": "2cd15f41edf4803148ad4aea46301ee6ffd2988ddcbdbc8ea627d84f2662ab57",
|
|
43
|
+
"configHash": "3cd17acab3463937643a99378c396eee737da6d1c7e6638367535cdcd81cfbab"
|
|
47
44
|
}
|
|
48
45
|
}
|