@fastgpt-sdk/sandbox-adapter 0.0.40-beta.1 → 0.0.40-beta.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/adapters/SealosDevboxAdapter/index.d.ts +1 -0
- package/dist/index.cjs +11 -1
- package/dist/index.js +11 -1
- package/package.json +1 -1
|
@@ -37,6 +37,7 @@ export declare class SealosDevboxAdapter extends BaseSandboxAdapter {
|
|
|
37
37
|
private buildCreateRequest;
|
|
38
38
|
private removeUndefined;
|
|
39
39
|
private assertMutationSuccess;
|
|
40
|
+
private isNotFoundResponse;
|
|
40
41
|
getInfo(): Promise<SandboxInfo | null>;
|
|
41
42
|
ensureRunning(): Promise<void>;
|
|
42
43
|
create(): Promise<void>;
|
package/dist/index.cjs
CHANGED
|
@@ -45649,7 +45649,10 @@ class DevboxApi {
|
|
|
45649
45649
|
}
|
|
45650
45650
|
const res = await fetch(input, { ...init, headers });
|
|
45651
45651
|
const result = await res.json();
|
|
45652
|
-
return
|
|
45652
|
+
return {
|
|
45653
|
+
...result,
|
|
45654
|
+
code: result.code ?? res.status
|
|
45655
|
+
};
|
|
45653
45656
|
}
|
|
45654
45657
|
async create(req) {
|
|
45655
45658
|
return this.request(this.url("/api/v1/devbox"), {
|
|
@@ -45825,6 +45828,9 @@ class SealosDevboxAdapter extends BaseSandboxAdapter {
|
|
|
45825
45828
|
}
|
|
45826
45829
|
throw new Error(res.message || `Devbox ${action} failed with code ${res.code}`);
|
|
45827
45830
|
}
|
|
45831
|
+
isNotFoundResponse(res) {
|
|
45832
|
+
return res.code === 404 || String(res.message ?? "").toLowerCase().includes("not found");
|
|
45833
|
+
}
|
|
45828
45834
|
async getInfo() {
|
|
45829
45835
|
try {
|
|
45830
45836
|
const res = await this.api.info(this._id);
|
|
@@ -45899,6 +45905,10 @@ class SealosDevboxAdapter extends BaseSandboxAdapter {
|
|
|
45899
45905
|
try {
|
|
45900
45906
|
this._status = { state: "Stopping" };
|
|
45901
45907
|
const res = await this.api.stop(this._id);
|
|
45908
|
+
if (this.isNotFoundResponse(res)) {
|
|
45909
|
+
this._status = { state: "Stopped" };
|
|
45910
|
+
return;
|
|
45911
|
+
}
|
|
45902
45912
|
this.assertMutationSuccess(res, "stop");
|
|
45903
45913
|
this._status = { state: "Stopped" };
|
|
45904
45914
|
} catch (error) {
|
package/dist/index.js
CHANGED
|
@@ -45633,7 +45633,10 @@ class DevboxApi {
|
|
|
45633
45633
|
}
|
|
45634
45634
|
const res = await fetch(input, { ...init, headers });
|
|
45635
45635
|
const result = await res.json();
|
|
45636
|
-
return
|
|
45636
|
+
return {
|
|
45637
|
+
...result,
|
|
45638
|
+
code: result.code ?? res.status
|
|
45639
|
+
};
|
|
45637
45640
|
}
|
|
45638
45641
|
async create(req) {
|
|
45639
45642
|
return this.request(this.url("/api/v1/devbox"), {
|
|
@@ -45809,6 +45812,9 @@ class SealosDevboxAdapter extends BaseSandboxAdapter {
|
|
|
45809
45812
|
}
|
|
45810
45813
|
throw new Error(res.message || `Devbox ${action} failed with code ${res.code}`);
|
|
45811
45814
|
}
|
|
45815
|
+
isNotFoundResponse(res) {
|
|
45816
|
+
return res.code === 404 || String(res.message ?? "").toLowerCase().includes("not found");
|
|
45817
|
+
}
|
|
45812
45818
|
async getInfo() {
|
|
45813
45819
|
try {
|
|
45814
45820
|
const res = await this.api.info(this._id);
|
|
@@ -45883,6 +45889,10 @@ class SealosDevboxAdapter extends BaseSandboxAdapter {
|
|
|
45883
45889
|
try {
|
|
45884
45890
|
this._status = { state: "Stopping" };
|
|
45885
45891
|
const res = await this.api.stop(this._id);
|
|
45892
|
+
if (this.isNotFoundResponse(res)) {
|
|
45893
|
+
this._status = { state: "Stopped" };
|
|
45894
|
+
return;
|
|
45895
|
+
}
|
|
45886
45896
|
this.assertMutationSuccess(res, "stop");
|
|
45887
45897
|
this._status = { state: "Stopped" };
|
|
45888
45898
|
} catch (error) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fastgpt-sdk/sandbox-adapter",
|
|
3
|
-
"version": "0.0.40-beta.
|
|
3
|
+
"version": "0.0.40-beta.3",
|
|
4
4
|
"description": "Unified abstraction layer for cloud sandbox providers with adapter pattern and feature polyfilling",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.cjs",
|