@shapediver/sdk.geometry-api-sdk-v2
Advanced tools
Comparing version 1.0.12 to 1.0.13
export * from "@shapediver/api.geometry-api-dto-v2"; | ||
export { ShapeDiverError, ShapeDiverRequestError, ShapeDiverResponseError, ShapeDiverSdkConfig, ShapeDiverSdkConfigType, } from "@shapediver/sdk.geometry-api-sdk-core"; | ||
export { ShapeDiverError, ShapeDiverRequestError, ShapeDiverSdkConfig, ShapeDiverSdkConfigType, } from "@shapediver/sdk.geometry-api-sdk-core"; | ||
export { ShapeDiverResponseError } from "./ShapeDiverErrors"; | ||
export { create, ShapeDiverSdk } from "./ShapeDiverSdk"; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -13,3 +13,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.ShapeDiverSdk = exports.create = exports.ShapeDiverSdkConfigType = exports.ShapeDiverResponseError = exports.ShapeDiverRequestError = exports.ShapeDiverError = void 0; | ||
exports.ShapeDiverSdk = exports.create = exports.ShapeDiverResponseError = exports.ShapeDiverSdkConfigType = exports.ShapeDiverRequestError = exports.ShapeDiverError = void 0; | ||
__exportStar(require("@shapediver/api.geometry-api-dto-v2"), exports); | ||
@@ -19,4 +19,5 @@ var sdk_geometry_api_sdk_core_1 = require("@shapediver/sdk.geometry-api-sdk-core"); | ||
Object.defineProperty(exports, "ShapeDiverRequestError", { enumerable: true, get: function () { return sdk_geometry_api_sdk_core_1.ShapeDiverRequestError; } }); | ||
Object.defineProperty(exports, "ShapeDiverResponseError", { enumerable: true, get: function () { return sdk_geometry_api_sdk_core_1.ShapeDiverResponseError; } }); | ||
Object.defineProperty(exports, "ShapeDiverSdkConfigType", { enumerable: true, get: function () { return sdk_geometry_api_sdk_core_1.ShapeDiverSdkConfigType; } }); | ||
var ShapeDiverErrors_1 = require("./ShapeDiverErrors"); | ||
Object.defineProperty(exports, "ShapeDiverResponseError", { enumerable: true, get: function () { return ShapeDiverErrors_1.ShapeDiverResponseError; } }); | ||
var ShapeDiverSdk_1 = require("./ShapeDiverSdk"); | ||
@@ -23,0 +24,0 @@ Object.defineProperty(exports, "create", { enumerable: true, get: function () { return ShapeDiverSdk_1.create; } }); |
@@ -14,2 +14,3 @@ "use strict"; | ||
const sdk_geometry_api_sdk_core_1 = require("@shapediver/sdk.geometry-api-sdk-core"); | ||
const utils_1 = require("../utils/utils"); | ||
class ShapeDiverAnalyticsApi extends sdk_geometry_api_sdk_core_1.BaseResourceApi { | ||
@@ -26,3 +27,3 @@ constructor(api) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
return yield this.api.put(this.buildAnalyticsUri() + "/session/model", body); | ||
return yield (0, utils_1.sendRequest)(() => __awaiter(this, void 0, void 0, function* () { return this.api.put(this.buildAnalyticsUri() + "/session/model", body); })); | ||
}); | ||
@@ -29,0 +30,0 @@ } |
@@ -14,2 +14,3 @@ "use strict"; | ||
const sdk_geometry_api_sdk_core_1 = require("@shapediver/sdk.geometry-api-sdk-core"); | ||
const utils_1 = require("../utils/utils"); | ||
class ShapeDiverAssetApi extends sdk_geometry_api_sdk_core_1.BaseResourceApi { | ||
@@ -27,3 +28,5 @@ constructor(api) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
return yield this.api.get(`${this.buildSessionUri(sessionId)}/export/${assetData}`, undefined, sdk_geometry_api_sdk_core_1.ShapeDiverSdkApiResponseType.DATA); | ||
return yield (0, utils_1.sendRequest)(() => __awaiter(this, void 0, void 0, function* () { | ||
return this.api.get(`${this.buildSessionUri(sessionId)}/export/${assetData}`, undefined, sdk_geometry_api_sdk_core_1.ShapeDiverSdkApiResponseType.DATA); | ||
})); | ||
}); | ||
@@ -39,3 +42,5 @@ } | ||
return __awaiter(this, void 0, void 0, function* () { | ||
return yield this.api.get(`${this.buildSessionUri(sessionId)}/output/${assetData}`, undefined, sdk_geometry_api_sdk_core_1.ShapeDiverSdkApiResponseType.DATA); | ||
return yield (0, utils_1.sendRequest)(() => __awaiter(this, void 0, void 0, function* () { | ||
return this.api.get(`${this.buildSessionUri(sessionId)}/output/${assetData}`, undefined, sdk_geometry_api_sdk_core_1.ShapeDiverSdkApiResponseType.DATA); | ||
})); | ||
}); | ||
@@ -51,3 +56,5 @@ } | ||
return __awaiter(this, void 0, void 0, function* () { | ||
return yield this.api.get(`${this.buildSessionUri(sessionId)}/texture/${assetData}`, undefined, sdk_geometry_api_sdk_core_1.ShapeDiverSdkApiResponseType.DATA); | ||
return yield (0, utils_1.sendRequest)(() => __awaiter(this, void 0, void 0, function* () { | ||
return this.api.get(`${this.buildSessionUri(sessionId)}/texture/${assetData}`, undefined, sdk_geometry_api_sdk_core_1.ShapeDiverSdkApiResponseType.DATA); | ||
})); | ||
}); | ||
@@ -63,3 +70,5 @@ } | ||
return __awaiter(this, void 0, void 0, function* () { | ||
return yield this.api.get(`${this.buildSessionUri(sessionId)}/gltf/${assetData}`, undefined, sdk_geometry_api_sdk_core_1.ShapeDiverSdkApiResponseType.DATA); | ||
return yield (0, utils_1.sendRequest)(() => __awaiter(this, void 0, void 0, function* () { | ||
return this.api.get(`${this.buildSessionUri(sessionId)}/gltf/${assetData}`, undefined, sdk_geometry_api_sdk_core_1.ShapeDiverSdkApiResponseType.DATA); | ||
})); | ||
}); | ||
@@ -75,3 +84,5 @@ } | ||
return __awaiter(this, void 0, void 0, function* () { | ||
return yield this.api.get(`${this.buildSessionUri(sessionId)}/usdz/${assetData}`, undefined, sdk_geometry_api_sdk_core_1.ShapeDiverSdkApiResponseType.DATA); | ||
return yield (0, utils_1.sendRequest)(() => __awaiter(this, void 0, void 0, function* () { | ||
return this.api.get(`${this.buildSessionUri(sessionId)}/usdz/${assetData}`, undefined, sdk_geometry_api_sdk_core_1.ShapeDiverSdkApiResponseType.DATA); | ||
})); | ||
}); | ||
@@ -78,0 +89,0 @@ } |
@@ -14,2 +14,3 @@ "use strict"; | ||
const sdk_geometry_api_sdk_core_1 = require("@shapediver/sdk.geometry-api-sdk-core"); | ||
const utils_1 = require("../utils/utils"); | ||
class ShapeDiverExportApi extends sdk_geometry_api_sdk_core_1.BaseResourceApi { | ||
@@ -27,3 +28,3 @@ constructor(api) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
return yield this.api.put(this.buildSessionUri(sessionId) + "/export", body); | ||
return yield (0, utils_1.sendRequest)(() => __awaiter(this, void 0, void 0, function* () { return this.api.put(this.buildSessionUri(sessionId) + "/export", body); })); | ||
}); | ||
@@ -39,3 +40,3 @@ } | ||
return __awaiter(this, void 0, void 0, function* () { | ||
return yield this.api.put(this.buildSessionUri(sessionId) + "/export/cache", body); | ||
return yield (0, utils_1.sendRequest)(() => __awaiter(this, void 0, void 0, function* () { return this.api.put(this.buildSessionUri(sessionId) + "/export/cache", body); })); | ||
}); | ||
@@ -51,3 +52,3 @@ } | ||
return __awaiter(this, void 0, void 0, function* () { | ||
return yield this.api.patch(this.buildModelUri(modelId) + "/export", body); | ||
return yield (0, utils_1.sendRequest)(() => __awaiter(this, void 0, void 0, function* () { return this.api.patch(this.buildModelUri(modelId) + "/export", body); })); | ||
}); | ||
@@ -54,0 +55,0 @@ } |
@@ -14,2 +14,3 @@ "use strict"; | ||
const sdk_geometry_api_sdk_core_1 = require("@shapediver/sdk.geometry-api-sdk-core"); | ||
const utils_1 = require("../utils/utils"); | ||
class ShapeDiverFileApi extends sdk_geometry_api_sdk_core_1.BaseResourceApi { | ||
@@ -27,3 +28,3 @@ constructor(api) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
return yield this.api.get(`${this.buildSessionUri(sessionId)}/file/${paramId}/list`); | ||
return yield (0, utils_1.sendRequest)(() => __awaiter(this, void 0, void 0, function* () { return this.api.get(`${this.buildSessionUri(sessionId)}/file/${paramId}/list`); })); | ||
}); | ||
@@ -40,3 +41,5 @@ } | ||
return __awaiter(this, void 0, void 0, function* () { | ||
return yield this.api.get(`${this.buildSessionUri(sessionId)}/file/${paramId}/${fileId}`, undefined, sdk_geometry_api_sdk_core_1.ShapeDiverSdkApiResponseType.DATA); | ||
return yield (0, utils_1.sendRequest)(() => __awaiter(this, void 0, void 0, function* () { | ||
return this.api.get(`${this.buildSessionUri(sessionId)}/file/${paramId}/${fileId}`, undefined, sdk_geometry_api_sdk_core_1.ShapeDiverSdkApiResponseType.DATA); | ||
})); | ||
}); | ||
@@ -53,3 +56,3 @@ } | ||
return __awaiter(this, void 0, void 0, function* () { | ||
return yield this.api.delete(`${this.buildSessionUri(sessionId)}/file/${paramId}/${fileId}`); | ||
return yield (0, utils_1.sendRequest)(() => __awaiter(this, void 0, void 0, function* () { return this.api.delete(`${this.buildSessionUri(sessionId)}/file/${paramId}/${fileId}`); })); | ||
}); | ||
@@ -65,3 +68,3 @@ } | ||
return __awaiter(this, void 0, void 0, function* () { | ||
return yield this.api.post(this.buildSessionUri(sessionId) + "/file/upload", body); | ||
return yield (0, utils_1.sendRequest)(() => __awaiter(this, void 0, void 0, function* () { return this.api.post(this.buildSessionUri(sessionId) + "/file/upload", body); })); | ||
}); | ||
@@ -68,0 +71,0 @@ } |
@@ -15,2 +15,3 @@ "use strict"; | ||
const sdk_geometry_api_sdk_core_1 = require("@shapediver/sdk.geometry-api-sdk-core"); | ||
const utils_1 = require("../utils/utils"); | ||
class ShapeDiverGltfApi extends sdk_geometry_api_sdk_core_1.BaseResourceApi { | ||
@@ -30,3 +31,5 @@ constructor(api) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
return yield this.api.post(`${this.buildSessionUri(sessionId)}/gltf?conversion=${queryConvert}`, body, { contentType: type }); | ||
return yield (0, utils_1.sendRequest)(() => __awaiter(this, void 0, void 0, function* () { | ||
return this.api.post(`${this.buildSessionUri(sessionId)}/gltf?conversion=${queryConvert}`, body, { contentType: type }); | ||
})); | ||
}); | ||
@@ -33,0 +36,0 @@ } |
@@ -14,2 +14,3 @@ "use strict"; | ||
const sdk_geometry_api_sdk_core_1 = require("@shapediver/sdk.geometry-api-sdk-core"); | ||
const utils_1 = require("../utils/utils"); | ||
class ShapeDiverModelApi extends sdk_geometry_api_sdk_core_1.BaseResourceApi { | ||
@@ -26,3 +27,3 @@ constructor(api) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
return yield this.api.get(this.buildModelUri(modelId)); | ||
return yield (0, utils_1.sendRequest)(() => __awaiter(this, void 0, void 0, function* () { return this.api.get(this.buildModelUri(modelId)); })); | ||
}); | ||
@@ -37,3 +38,3 @@ } | ||
return __awaiter(this, void 0, void 0, function* () { | ||
return yield this.api.post(this.commonPath, body); | ||
return yield (0, utils_1.sendRequest)(() => __awaiter(this, void 0, void 0, function* () { return this.api.post(this.commonPath, body); })); | ||
}); | ||
@@ -49,3 +50,3 @@ } | ||
return __awaiter(this, void 0, void 0, function* () { | ||
return yield this.api.put(this.buildModelUri(modelId), body); | ||
return yield (0, utils_1.sendRequest)(() => __awaiter(this, void 0, void 0, function* () { return this.api.put(this.buildModelUri(modelId), body); })); | ||
}); | ||
@@ -60,3 +61,3 @@ } | ||
return __awaiter(this, void 0, void 0, function* () { | ||
return yield this.api.delete(this.buildModelUri(modelId)); | ||
return yield (0, utils_1.sendRequest)(() => __awaiter(this, void 0, void 0, function* () { return this.api.delete(this.buildModelUri(modelId)); })); | ||
}); | ||
@@ -71,3 +72,3 @@ } | ||
return __awaiter(this, void 0, void 0, function* () { | ||
return yield this.api.get(this.buildModelUri(modelId) + "/config"); | ||
return yield (0, utils_1.sendRequest)(() => __awaiter(this, void 0, void 0, function* () { return this.api.get(this.buildModelUri(modelId) + "/config"); })); | ||
}); | ||
@@ -83,3 +84,3 @@ } | ||
return __awaiter(this, void 0, void 0, function* () { | ||
return yield this.api.post(this.buildModelUri(modelId) + "/config", body); | ||
return yield (0, utils_1.sendRequest)(() => __awaiter(this, void 0, void 0, function* () { return this.api.post(this.buildModelUri(modelId) + "/config", body); })); | ||
}); | ||
@@ -95,3 +96,3 @@ } | ||
return __awaiter(this, void 0, void 0, function* () { | ||
return yield this.api.patch(this.buildModelUri(modelId) + "/config", body); | ||
return yield (0, utils_1.sendRequest)(() => __awaiter(this, void 0, void 0, function* () { return this.api.patch(this.buildModelUri(modelId) + "/config", body); })); | ||
}); | ||
@@ -106,3 +107,5 @@ } | ||
return __awaiter(this, void 0, void 0, function* () { | ||
return yield this.api.get(this.buildModelUri(modelId) + "/file/download", undefined, sdk_geometry_api_sdk_core_1.ShapeDiverSdkApiResponseType.DATA); | ||
return yield (0, utils_1.sendRequest)(() => __awaiter(this, void 0, void 0, function* () { | ||
return this.api.get(this.buildModelUri(modelId) + "/file/download", undefined, sdk_geometry_api_sdk_core_1.ShapeDiverSdkApiResponseType.DATA); | ||
})); | ||
}); | ||
@@ -118,3 +121,3 @@ } | ||
return __awaiter(this, void 0, void 0, function* () { | ||
return yield this.api.patch(this.buildModelUri(modelId) + "/parameter/defval", body); | ||
return yield (0, utils_1.sendRequest)(() => __awaiter(this, void 0, void 0, function* () { return this.api.patch(this.buildModelUri(modelId) + "/parameter/defval", body); })); | ||
}); | ||
@@ -130,3 +133,3 @@ } | ||
return __awaiter(this, void 0, void 0, function* () { | ||
return yield this.api.patch(this.buildModelUri(modelId) + "/parameter", body); | ||
return yield (0, utils_1.sendRequest)(() => __awaiter(this, void 0, void 0, function* () { return this.api.patch(this.buildModelUri(modelId) + "/parameter", body); })); | ||
}); | ||
@@ -167,3 +170,3 @@ } | ||
queries.push("offset=" + offset); | ||
return yield this.api.get(this.buildModelUri(modelId) + "/computations?" + queries.join("&")); | ||
return yield (0, utils_1.sendRequest)(() => __awaiter(this, void 0, void 0, function* () { return this.api.get(this.buildModelUri(modelId) + "/computations?" + queries.join("&")); })); | ||
}); | ||
@@ -170,0 +173,0 @@ } |
@@ -14,2 +14,3 @@ "use strict"; | ||
const sdk_geometry_api_sdk_core_1 = require("@shapediver/sdk.geometry-api-sdk-core"); | ||
const utils_1 = require("../utils/utils"); | ||
class ShapeDiverOutputApi extends sdk_geometry_api_sdk_core_1.BaseResourceApi { | ||
@@ -27,3 +28,3 @@ constructor(api) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
return yield this.api.put(this.buildSessionUri(sessionId) + "/output", body); | ||
return yield (0, utils_1.sendRequest)(() => __awaiter(this, void 0, void 0, function* () { return this.api.put(this.buildSessionUri(sessionId) + "/output", body); })); | ||
}); | ||
@@ -39,3 +40,3 @@ } | ||
return __awaiter(this, void 0, void 0, function* () { | ||
return yield this.api.put(this.buildSessionUri(sessionId) + "/output/cache", body); | ||
return yield (0, utils_1.sendRequest)(() => __awaiter(this, void 0, void 0, function* () { return this.api.put(this.buildSessionUri(sessionId) + "/output/cache", body); })); | ||
}); | ||
@@ -51,3 +52,3 @@ } | ||
return __awaiter(this, void 0, void 0, function* () { | ||
return yield this.api.patch(this.buildModelUri(modelId) + "/output", body); | ||
return yield (0, utils_1.sendRequest)(() => __awaiter(this, void 0, void 0, function* () { return this.api.patch(this.buildModelUri(modelId) + "/output", body); })); | ||
}); | ||
@@ -54,0 +55,0 @@ } |
@@ -14,2 +14,3 @@ "use strict"; | ||
const sdk_geometry_api_sdk_core_1 = require("@shapediver/sdk.geometry-api-sdk-core"); | ||
const utils_1 = require("../utils/utils"); | ||
class ShapeDiverSdtfApi extends sdk_geometry_api_sdk_core_1.BaseResourceApi { | ||
@@ -27,3 +28,3 @@ constructor(api) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
return yield this.api.get(`${this.buildSessionUri(sessionId)}/sdtf/${namespace}/list`); | ||
return yield (0, utils_1.sendRequest)(() => __awaiter(this, void 0, void 0, function* () { return this.api.get(`${this.buildSessionUri(sessionId)}/sdtf/${namespace}/list`); })); | ||
}); | ||
@@ -39,3 +40,5 @@ } | ||
return __awaiter(this, void 0, void 0, function* () { | ||
return yield this.api.get(`${this.buildSessionUri(sessionId)}/sdtf/${sdtfId}`, undefined, sdk_geometry_api_sdk_core_1.ShapeDiverSdkApiResponseType.DATA); | ||
return yield (0, utils_1.sendRequest)(() => __awaiter(this, void 0, void 0, function* () { | ||
return this.api.get(`${this.buildSessionUri(sessionId)}/sdtf/${sdtfId}`, undefined, sdk_geometry_api_sdk_core_1.ShapeDiverSdkApiResponseType.DATA); | ||
})); | ||
}); | ||
@@ -51,3 +54,3 @@ } | ||
return __awaiter(this, void 0, void 0, function* () { | ||
return yield this.api.delete(`${this.buildSessionUri(sessionId)}/sdtf/${sdtfId}`); | ||
return yield (0, utils_1.sendRequest)(() => __awaiter(this, void 0, void 0, function* () { return this.api.delete(`${this.buildSessionUri(sessionId)}/sdtf/${sdtfId}`); })); | ||
}); | ||
@@ -63,3 +66,3 @@ } | ||
return __awaiter(this, void 0, void 0, function* () { | ||
return yield this.api.post(this.buildSessionUri(sessionId) + "/sdtf/upload", body); | ||
return yield (0, utils_1.sendRequest)(() => __awaiter(this, void 0, void 0, function* () { return this.api.post(this.buildSessionUri(sessionId) + "/sdtf/upload", body); })); | ||
}); | ||
@@ -66,0 +69,0 @@ } |
@@ -14,2 +14,3 @@ "use strict"; | ||
const sdk_geometry_api_sdk_core_1 = require("@shapediver/sdk.geometry-api-sdk-core"); | ||
const utils_1 = require("../utils/utils"); | ||
class ShapeDiverSessionApi extends sdk_geometry_api_sdk_core_1.BaseResourceApi { | ||
@@ -28,3 +29,3 @@ constructor(api) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
return yield this.api.post(this.buildModelUri(modelId) + "/ticket", body); | ||
return yield (0, utils_1.sendRequest)(() => __awaiter(this, void 0, void 0, function* () { return this.api.post(this.buildModelUri(modelId) + "/ticket", body); })); | ||
}); | ||
@@ -40,3 +41,3 @@ } | ||
return __awaiter(this, void 0, void 0, function* () { | ||
return yield this.api.post(this.buildTicketUri(ticket), request); | ||
return yield (0, utils_1.sendRequest)(() => __awaiter(this, void 0, void 0, function* () { return this.api.post(this.buildTicketUri(ticket), request); })); | ||
}); | ||
@@ -51,3 +52,3 @@ } | ||
return __awaiter(this, void 0, void 0, function* () { | ||
return yield this.api.get(this.buildSessionUri(sessionId) + "/default"); | ||
return yield (0, utils_1.sendRequest)(() => __awaiter(this, void 0, void 0, function* () { return this.api.get(this.buildSessionUri(sessionId) + "/default"); })); | ||
}); | ||
@@ -62,3 +63,3 @@ } | ||
return __awaiter(this, void 0, void 0, function* () { | ||
return yield this.api.post(this.buildSessionUri(sessionId) + "/close"); | ||
return yield (0, utils_1.sendRequest)(() => __awaiter(this, void 0, void 0, function* () { return this.api.post(this.buildSessionUri(sessionId) + "/close"); })); | ||
}); | ||
@@ -65,0 +66,0 @@ } |
@@ -14,2 +14,3 @@ "use strict"; | ||
const sdk_geometry_api_sdk_core_1 = require("@shapediver/sdk.geometry-api-sdk-core"); | ||
const utils_1 = require("../utils/utils"); | ||
class ShapeDiverSystemApi extends sdk_geometry_api_sdk_core_1.BaseResourceApi { | ||
@@ -27,3 +28,3 @@ constructor(api) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
return yield this.api.post(this.buildSessionUri(sessionId) + "/log/message", body); | ||
return yield (0, utils_1.sendRequest)(() => __awaiter(this, void 0, void 0, function* () { return this.api.post(this.buildSessionUri(sessionId) + "/log/message", body); })); | ||
}); | ||
@@ -40,3 +41,3 @@ } | ||
return __awaiter(this, void 0, void 0, function* () { | ||
return yield this.api.delete(`${this.buildSystemUri()}/model/${modelId}`); | ||
return yield (0, utils_1.sendRequest)(() => __awaiter(this, void 0, void 0, function* () { return this.api.delete(`${this.buildSystemUri()}/model/${modelId}`); })); | ||
}); | ||
@@ -51,3 +52,3 @@ } | ||
return __awaiter(this, void 0, void 0, function* () { | ||
return yield this.api.get(this.buildTicketUri(ticket)); | ||
return yield (0, utils_1.sendRequest)(() => __awaiter(this, void 0, void 0, function* () { return this.api.get(this.buildTicketUri(ticket)); })); | ||
}); | ||
@@ -62,3 +63,3 @@ } | ||
return __awaiter(this, void 0, void 0, function* () { | ||
return yield this.api.post(this.buildAuthGroupUri(), body); | ||
return yield (0, utils_1.sendRequest)(() => __awaiter(this, void 0, void 0, function* () { return this.api.post(this.buildAuthGroupUri(), body); })); | ||
}); | ||
@@ -65,0 +66,0 @@ } |
@@ -28,3 +28,8 @@ "use strict"; | ||
return __awaiter(this, void 0, void 0, function* () { | ||
return yield this.api.put(href, data, { contentType: type, authorization: "disabled" }); | ||
return yield (0, utils_1.sendRequest)(() => __awaiter(this, void 0, void 0, function* () { | ||
return this.api.put(href, data, { | ||
contentType: type, | ||
authorization: "disabled", | ||
}); | ||
})); | ||
}); | ||
@@ -44,3 +49,3 @@ } | ||
const startMsec = Date.now(); | ||
const dto = yield sdk.output.customize(sessionId, body); | ||
const dto = yield (0, utils_1.sendRequest)(() => __awaiter(this, void 0, void 0, function* () { return sdk.output.customize(sessionId, body); })); | ||
const waitMsec = Date.now() - startMsec; | ||
@@ -64,3 +69,3 @@ // Reduce the total max waiting time by the amount the customization-request took | ||
const startMsec = Date.now(); | ||
const dto = yield sdk.export.compute(sessionId, body); | ||
const dto = yield (0, utils_1.sendRequest)(() => __awaiter(this, void 0, void 0, function* () { return sdk.export.compute(sessionId, body); })); | ||
const waitMsec = Date.now() - startMsec; | ||
@@ -105,3 +110,3 @@ // Reduce the total max waiting time by the amount the compute-request took | ||
// Send cache request | ||
dto = yield sdk.output.getCache(sessionId, outputVersions); | ||
dto = yield (0, utils_1.sendRequest)(() => __awaiter(this, void 0, void 0, function* () { return sdk.output.getCache(sessionId, outputVersions); })); | ||
delay = ShapeDiverUtilsApi.getMaxOutputDelay(dto); | ||
@@ -145,3 +150,3 @@ } | ||
// Send cache request | ||
dto = yield sdk.export.getCache(sessionId, exportVersion); | ||
dto = yield (0, utils_1.sendRequest)(() => __awaiter(this, void 0, void 0, function* () { return sdk.export.getCache(sessionId, exportVersion); })); | ||
delay = ShapeDiverUtilsApi.getExportDelay(dto, exportId); | ||
@@ -148,0 +153,0 @@ } |
@@ -0,3 +1,8 @@ | ||
/** | ||
* Sends the given request, handles retries for the HTTP status 429, and maps | ||
* the response error object to its typed representation. | ||
*/ | ||
export declare function sendRequest<T>(call: () => Promise<T>): Promise<T>; | ||
/** Delays the response for the given number of milliseconds */ | ||
export declare function sleep(ms: number): Promise<void>; | ||
//# sourceMappingURL=utils.d.ts.map |
"use strict"; | ||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } | ||
return new (P || (P = Promise))(function (resolve, reject) { | ||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } | ||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } | ||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } | ||
step((generator = generator.apply(thisArg, _arguments || [])).next()); | ||
}); | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.sleep = void 0; | ||
exports.sleep = exports.sendRequest = void 0; | ||
const sdk_geometry_api_sdk_core_1 = require("@shapediver/sdk.geometry-api-sdk-core"); | ||
const ShapeDiverErrors_1 = require("../ShapeDiverErrors"); | ||
/** | ||
* Sends the given request, handles retries for the HTTP status 429, and maps | ||
* the response error object to its typed representation. | ||
*/ | ||
function sendRequest(call) { | ||
var _a; | ||
return __awaiter(this, void 0, void 0, function* () { | ||
while (true) { | ||
try { | ||
return yield call(); | ||
} | ||
catch (e) { | ||
if (e instanceof sdk_geometry_api_sdk_core_1.ShapeDiverResponseError) { | ||
/* Check for special response statuses */ | ||
if (e.status === 429) { | ||
// 429 Too Many Requests - Extract waiting time from Retry-After header if existing. | ||
const seconds = (_a = e.headers["retry-after"]) !== null && _a !== void 0 ? _a : 60; // default is 1 minute | ||
yield sleep(Number(seconds) * 1000); | ||
continue; | ||
} | ||
// Error mapping | ||
throw new ShapeDiverErrors_1.ShapeDiverResponseError(e); | ||
} | ||
else { | ||
// Not a response error -> something went wrong | ||
throw e; | ||
} | ||
} | ||
} | ||
}); | ||
} | ||
exports.sendRequest = sendRequest; | ||
/** Delays the response for the given number of milliseconds */ | ||
@@ -5,0 +48,0 @@ function sleep(ms) { |
{ | ||
"name": "@shapediver/sdk.geometry-api-sdk-v2", | ||
"version": "1.0.12", | ||
"version": "1.0.13", | ||
"description": "SDK to communicate with the Geometry View API version 2", | ||
@@ -55,5 +55,5 @@ "keywords": [ | ||
"dependencies": { | ||
"@shapediver/sdk.geometry-api-sdk-core": "^1.0.4", | ||
"@shapediver/api.geometry-api-dto-v2": "^1.1.2" | ||
"@shapediver/sdk.geometry-api-sdk-core": "^1.0.5", | ||
"@shapediver/api.geometry-api-dto-v2": "^1.1.4" | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
103346
63
1490