@phpsandbox/sdk 0.1.10 → 0.1.12
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 +1 -0
- package/dist/browser/phpsandbox-sdk.esm.js +22 -11
- package/dist/browser/phpsandbox-sdk.esm.min.js +10 -10
- package/dist/browser/phpsandbox-sdk.iife.js +22 -11
- package/dist/browser/phpsandbox-sdk.iife.min.js +10 -10
- package/dist/http.d.ts +6 -0
- package/dist/http.js +11 -0
- package/dist/index.js +4 -6
- package/dist/ports.d.ts +1 -0
- package/dist/ports.js +3 -0
- package/dist/runtime/rest.js +3 -2
- package/dist/runtime.d.ts +4 -0
- package/dist/runtime.js +3 -0
- package/docs/api-summary.md +1 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -195,6 +195,7 @@ await reader.cancel();
|
|
|
195
195
|
|
|
196
196
|
```ts
|
|
197
197
|
const currentPorts = await notebook.runtime.ports.list();
|
|
198
|
+
const futurePort = await notebook.runtime.ports.resolve(4848);
|
|
198
199
|
const currentMetrics = await notebook.runtime.metrics.current();
|
|
199
200
|
|
|
200
201
|
for await (const sample of notebook.runtime.metrics.watch({ signal })) {
|
|
@@ -1187,6 +1187,9 @@ var Ports = class {
|
|
|
1187
1187
|
list() {
|
|
1188
1188
|
return this.okra.invoke("container.opened-ports");
|
|
1189
1189
|
}
|
|
1190
|
+
resolve(port) {
|
|
1191
|
+
return this.okra.invoke("container.resolve-port", { port });
|
|
1192
|
+
}
|
|
1190
1193
|
watch(options = {}) {
|
|
1191
1194
|
return watchRuntimeTelemetry(this.okra, this.telemetry, "ports", "container.ports", (ports) => ports, options);
|
|
1192
1195
|
}
|
|
@@ -1219,6 +1222,9 @@ var RuntimePorts = class {
|
|
|
1219
1222
|
list() {
|
|
1220
1223
|
return this.ports.list();
|
|
1221
1224
|
}
|
|
1225
|
+
resolve(port) {
|
|
1226
|
+
return this.ports.resolve(port);
|
|
1227
|
+
}
|
|
1222
1228
|
watch(options = {}) {
|
|
1223
1229
|
return this.ports.watch(options);
|
|
1224
1230
|
}
|
|
@@ -19446,6 +19452,14 @@ var ServerInstance = class {
|
|
|
19446
19452
|
}
|
|
19447
19453
|
};
|
|
19448
19454
|
|
|
19455
|
+
// src/http.ts
|
|
19456
|
+
function authenticatedRequest(input, init) {
|
|
19457
|
+
return new Request(input, {
|
|
19458
|
+
...init,
|
|
19459
|
+
redirect: "manual"
|
|
19460
|
+
});
|
|
19461
|
+
}
|
|
19462
|
+
|
|
19449
19463
|
// src/runtime/rest.ts
|
|
19450
19464
|
var restActionRoutes = {
|
|
19451
19465
|
"runtime.ready": { method: "GET", path: "/runtime" },
|
|
@@ -19456,6 +19470,7 @@ var restActionRoutes = {
|
|
|
19456
19470
|
"container.stop": { method: "POST", path: "/runtime/container/stop" },
|
|
19457
19471
|
"container.set-php": { method: "PUT", path: "/runtime/container/php" },
|
|
19458
19472
|
"container.opened-ports": { method: "GET", path: "/runtime/container/ports" },
|
|
19473
|
+
"container.resolve-port": { method: "POST", path: "/runtime/container/ports/resolve" },
|
|
19459
19474
|
"container.stats": { method: "GET", path: "/runtime/container/stats" },
|
|
19460
19475
|
"terminal.list": { method: "GET", path: "/runtime/terminals" },
|
|
19461
19476
|
"shell.exec": { method: "POST", path: "/runtime/executions" },
|
|
@@ -19565,12 +19580,11 @@ var RestRuntimeInvoker = class {
|
|
|
19565
19580
|
Authorization: `Bearer ${this.ticket}`
|
|
19566
19581
|
};
|
|
19567
19582
|
const body = runtimeActionRequestBody(action, data, url2, headers);
|
|
19568
|
-
return
|
|
19583
|
+
return authenticatedRequest(url2, {
|
|
19569
19584
|
method: route.method,
|
|
19570
19585
|
headers,
|
|
19571
19586
|
body: route.method === "GET" ? void 0 : body,
|
|
19572
|
-
signal
|
|
19573
|
-
redirect: "error"
|
|
19587
|
+
signal
|
|
19574
19588
|
});
|
|
19575
19589
|
}
|
|
19576
19590
|
async refreshAuthorization() {
|
|
@@ -19900,10 +19914,9 @@ var ClientImplementation = class {
|
|
|
19900
19914
|
}
|
|
19901
19915
|
async stream(path) {
|
|
19902
19916
|
const response = await this.fetchResponse(
|
|
19903
|
-
|
|
19917
|
+
authenticatedRequest(new URL(path.replace(/^\//, ""), this.baseUrl), {
|
|
19904
19918
|
method: "GET",
|
|
19905
|
-
headers: this.headers
|
|
19906
|
-
redirect: "error"
|
|
19919
|
+
headers: this.headers
|
|
19907
19920
|
})
|
|
19908
19921
|
);
|
|
19909
19922
|
if (!response.ok) {
|
|
@@ -19916,9 +19929,8 @@ var ClientImplementation = class {
|
|
|
19916
19929
|
}
|
|
19917
19930
|
async sse(url2) {
|
|
19918
19931
|
const response = await this.fetchResponse(
|
|
19919
|
-
|
|
19932
|
+
authenticatedRequest(url2, {
|
|
19920
19933
|
method: "GET",
|
|
19921
|
-
redirect: "error",
|
|
19922
19934
|
headers: {
|
|
19923
19935
|
...this.headers,
|
|
19924
19936
|
"Accept": "text/event-stream"
|
|
@@ -19935,11 +19947,10 @@ var ClientImplementation = class {
|
|
|
19935
19947
|
}
|
|
19936
19948
|
async makeRequest(method, path, init) {
|
|
19937
19949
|
const response = await this.fetchResponse(
|
|
19938
|
-
|
|
19950
|
+
authenticatedRequest(new URL(path.replace(/^\//, ""), this.baseUrl), {
|
|
19939
19951
|
method,
|
|
19940
19952
|
...init,
|
|
19941
|
-
headers: this.headers
|
|
19942
|
-
redirect: "error"
|
|
19953
|
+
headers: this.headers
|
|
19943
19954
|
})
|
|
19944
19955
|
);
|
|
19945
19956
|
if (!response.ok) {
|