@shapediver/sdk.geometry-api-sdk-v2
Advanced tools
Comparing version 1.5.1 to 1.6.0
@@ -18,3 +18,3 @@ import { ShapeDiverRequestCache, ShapeDiverRequestExport, ShapeDiverRequestExportDefinition, ShapeDiverResponseDto } from "@shapediver/api.geometry-api-dto-v2"; | ||
*/ | ||
getCache(sessionId: string, body: ShapeDiverRequestCache): Promise<ShapeDiverResponseDto>; | ||
getCache(sessionId: string, body: ShapeDiverRequestCache | ShapeDiverRequestExport): Promise<ShapeDiverResponseDto>; | ||
/** | ||
@@ -21,0 +21,0 @@ * Updates the definitions of the given exports. |
@@ -27,3 +27,5 @@ "use strict"; | ||
return __awaiter(this, void 0, void 0, function* () { | ||
return yield (0, utils_1.sendRequest)(() => __awaiter(this, void 0, void 0, function* () { return (yield this.api.put(this.buildSessionUri(sessionId) + "/export", body))[1]; })); | ||
return yield (0, utils_1.sendRequest)(() => __awaiter(this, void 0, void 0, function* () { | ||
return (yield this.api.put(this.buildSessionUri(sessionId) + "/export", body))[1]; | ||
})); | ||
}); | ||
@@ -39,3 +41,5 @@ } | ||
return __awaiter(this, void 0, void 0, function* () { | ||
return yield (0, utils_1.sendRequest)(() => __awaiter(this, void 0, void 0, function* () { return (yield this.api.put(this.buildSessionUri(sessionId) + "/export/cache", body))[1]; })); | ||
return yield (0, utils_1.sendRequest)(() => __awaiter(this, void 0, void 0, function* () { | ||
return (yield this.api.put(this.buildSessionUri(sessionId) + "/export/cache", body))[1]; | ||
})); | ||
}); | ||
@@ -51,3 +55,5 @@ } | ||
return __awaiter(this, void 0, void 0, function* () { | ||
return yield (0, utils_1.sendRequest)(() => __awaiter(this, void 0, void 0, function* () { return (yield this.api.patch(this.buildModelUri(modelId) + "/export", body))[1]; })); | ||
return yield (0, utils_1.sendRequest)(() => __awaiter(this, void 0, void 0, function* () { | ||
return (yield this.api.patch(this.buildModelUri(modelId) + "/export", body))[1]; | ||
})); | ||
}); | ||
@@ -63,3 +69,5 @@ } | ||
return __awaiter(this, void 0, void 0, function* () { | ||
return yield (0, utils_1.sendRequest)(() => __awaiter(this, void 0, void 0, function* () { return (yield this.api.get(this.buildSessionUri(sessionId) + "/export/" + exportId + "/list"))[1]; })); | ||
return yield (0, utils_1.sendRequest)(() => __awaiter(this, void 0, void 0, function* () { | ||
return (yield this.api.get(this.buildSessionUri(sessionId) + "/export/" + exportId + "/list"))[1]; | ||
})); | ||
}); | ||
@@ -66,0 +74,0 @@ } |
@@ -14,3 +14,3 @@ import { ShapeDiverRequestCustomization, ShapeDiverRequestExport, ShapeDiverRequestTicket, ShapeDiverResponseDto } from "@shapediver/api.geometry-api-dto-v2"; | ||
/** | ||
* Create a new session for a ShapeDiver Model. | ||
* Create a new session for a ShapeDiver Model via a ticket. | ||
* | ||
@@ -22,2 +22,9 @@ * @param ticket | ||
/** | ||
* Create a new session for a ShapeDiver Model. | ||
* | ||
* @param ticket | ||
* @param request - Optional customization or export request. | ||
*/ | ||
initForModel(modelId: string, request?: ShapeDiverRequestCustomization | ShapeDiverRequestExport): Promise<ShapeDiverResponseDto>; | ||
/** | ||
* Get the full description of a ShapeDiver Model. | ||
@@ -24,0 +31,0 @@ * |
@@ -28,7 +28,9 @@ "use strict"; | ||
return __awaiter(this, void 0, void 0, function* () { | ||
return yield (0, utils_1.sendRequest)(() => __awaiter(this, void 0, void 0, function* () { return (yield this.api.post(this.buildModelUri(modelId) + "/ticket", body))[1]; })); | ||
return yield (0, utils_1.sendRequest)(() => __awaiter(this, void 0, void 0, function* () { | ||
return (yield this.api.post(this.buildModelUri(modelId) + "/ticket", body))[1]; | ||
})); | ||
}); | ||
} | ||
/** | ||
* Create a new session for a ShapeDiver Model. | ||
* Create a new session for a ShapeDiver Model via a ticket. | ||
* | ||
@@ -44,2 +46,15 @@ * @param ticket | ||
/** | ||
* Create a new session for a ShapeDiver Model. | ||
* | ||
* @param ticket | ||
* @param request - Optional customization or export request. | ||
*/ | ||
initForModel(modelId, request) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
return yield (0, utils_1.sendRequest)(() => __awaiter(this, void 0, void 0, function* () { | ||
return (yield this.api.post(this.buildModelUri(modelId) + "/session", request))[1]; | ||
})); | ||
}); | ||
} | ||
/** | ||
* Get the full description of a ShapeDiver Model. | ||
@@ -51,3 +66,5 @@ * | ||
return __awaiter(this, void 0, void 0, function* () { | ||
return yield (0, utils_1.sendRequest)(() => __awaiter(this, void 0, void 0, function* () { return (yield this.api.get(this.buildSessionUri(sessionId) + "/default"))[1]; })); | ||
return yield (0, utils_1.sendRequest)(() => __awaiter(this, void 0, void 0, function* () { | ||
return (yield this.api.get(this.buildSessionUri(sessionId) + "/default"))[1]; | ||
})); | ||
}); | ||
@@ -62,3 +79,5 @@ } | ||
return __awaiter(this, void 0, void 0, function* () { | ||
return yield (0, utils_1.sendRequest)(() => __awaiter(this, void 0, void 0, function* () { return (yield this.api.post(this.buildSessionUri(sessionId) + "/close"))[1]; })); | ||
return yield (0, utils_1.sendRequest)(() => __awaiter(this, void 0, void 0, function* () { | ||
return (yield this.api.post(this.buildSessionUri(sessionId) + "/close"))[1]; | ||
})); | ||
}); | ||
@@ -65,0 +84,0 @@ } |
@@ -64,3 +64,4 @@ import { ShapeDiverRequestCustomization, ShapeDiverRequestExport, ShapeDiverResponseDto } from "@shapediver/api.geometry-api-dto-v2"; | ||
* @param dto | ||
* @param exportId | ||
* @param exportIds | ||
* @param outputIds | ||
* @param maxWaitMsec - Maximum duration to wait for result (in milliseconds), pass value < 0 to disable limit. | ||
@@ -71,5 +72,4 @@ * @returns | ||
/** | ||
* Get the maximum delay which was reported for output versions. | ||
* Get the maximum delay that was reported for output versions. | ||
* | ||
* @param dto | ||
* @returns maximum delay, -1 in case no delay was reported | ||
@@ -79,11 +79,10 @@ */ | ||
/** | ||
* Get the delay which was reported for the export. | ||
* Get the maximum delay that was reported for the exports. If outputs have been reported as | ||
* well, their delay time is included too. | ||
* | ||
* @param dto | ||
* @param exportId | ||
* @returns delay, -1 in case no delay was reported | ||
*/ | ||
private static getExportDelay; | ||
private static getMaxExportDelay; | ||
} | ||
export {}; | ||
//# sourceMappingURL=ShapeDiverUtilsApi.d.ts.map |
@@ -94,3 +94,3 @@ "use strict"; | ||
maxWaitMsec = (maxWaitMsec < 0) ? maxWaitMsec : Math.max(0, maxWaitMsec - waitMsec); | ||
return ShapeDiverUtilsApi.waitForExportResult(sdk, sessionId, dto, body.exports.id, maxWaitMsec); | ||
return ShapeDiverUtilsApi.waitForExportResult(sdk, sessionId, body, dto, maxWaitMsec); | ||
}); | ||
@@ -143,15 +143,10 @@ } | ||
* @param dto | ||
* @param exportId | ||
* @param exportIds | ||
* @param outputIds | ||
* @param maxWaitMsec - Maximum duration to wait for result (in milliseconds), pass value < 0 to disable limit. | ||
* @returns | ||
*/ | ||
static waitForExportResult(sdk, sessionId, dto, exportId, maxWaitMsec = -1) { | ||
static waitForExportResult(sdk, sessionId, body, dto, maxWaitMsec = -1) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
if (!dto.exports) | ||
throw new sdk_geometry_api_sdk_core_1.ShapeDiverError("The given DTO does not contain any exports"); | ||
// Build new cache request | ||
const exportVersion = { [exportId]: dto.exports[exportId].version }; | ||
if (!dto.exports) | ||
throw new sdk_geometry_api_sdk_core_1.ShapeDiverError(`Could not find any export with the id '${exportId}'`); | ||
let delay = ShapeDiverUtilsApi.getExportDelay(dto, exportId); | ||
let delay = ShapeDiverUtilsApi.getMaxExportDelay(dto, body); | ||
const startMsec = Date.now(); | ||
@@ -171,4 +166,4 @@ while (delay > 0) { | ||
// Send cache request | ||
dto = yield (0, utils_1.sendRequest)(() => __awaiter(this, void 0, void 0, function* () { return sdk.export.getCache(sessionId, exportVersion); })); | ||
delay = ShapeDiverUtilsApi.getExportDelay(dto, exportId); | ||
dto = yield (0, utils_1.sendRequest)(() => __awaiter(this, void 0, void 0, function* () { return sdk.export.getCache(sessionId, body); })); | ||
delay = ShapeDiverUtilsApi.getMaxExportDelay(dto, body); | ||
} | ||
@@ -179,5 +174,4 @@ return dto; | ||
/** | ||
* Get the maximum delay which was reported for output versions. | ||
* Get the maximum delay that was reported for output versions. | ||
* | ||
* @param dto | ||
* @returns maximum delay, -1 in case no delay was reported | ||
@@ -191,11 +185,18 @@ */ | ||
/** | ||
* Get the delay which was reported for the export. | ||
* Get the maximum delay that was reported for the exports. If outputs have been reported as | ||
* well, their delay time is included too. | ||
* | ||
* @param dto | ||
* @param exportId | ||
* @returns delay, -1 in case no delay was reported | ||
*/ | ||
static getExportDelay(dto, exportId) { | ||
var _a; | ||
return (_a = dto.exports[exportId].delay) !== null && _a !== void 0 ? _a : -1; | ||
static getMaxExportDelay(dto, body) { | ||
var _a, _b, _c; | ||
const exports = (Array.isArray(body.exports)) ? body.exports : [body.exports.id]; | ||
const outputs = (_a = body.outputs) !== null && _a !== void 0 ? _a : []; | ||
return Math.max(...Object.values((_b = dto.exports) !== null && _b !== void 0 ? _b : {}) | ||
.filter(e => exports.includes(e.id)) | ||
.map(e => e) | ||
.map(e => { var _a; return (_a = e.delay) !== null && _a !== void 0 ? _a : -1; }), ...Object.values((_c = dto.outputs) !== null && _c !== void 0 ? _c : {}) | ||
.filter(o => outputs.includes(o.id)) | ||
.map(o => o) | ||
.map(o => { var _a; return (_a = o.delay) !== null && _a !== void 0 ? _a : -1; })); | ||
} | ||
@@ -202,0 +203,0 @@ } |
{ | ||
"name": "@shapediver/sdk.geometry-api-sdk-v2", | ||
"version": "1.5.1", | ||
"version": "1.6.0", | ||
"description": "SDK to communicate with the Geometry API version 2", | ||
@@ -48,13 +48,13 @@ "keywords": [ | ||
"devDependencies": { | ||
"jest": "~29.5.0", | ||
"lerna": "~6.6.2", | ||
"typescript": "~4.9.5", | ||
"webpack": "~5.83.1", | ||
"webpack-cli": "~5.1.1", | ||
"webpack-dev-server": "~4.15.0" | ||
"jest": "~29.6.2", | ||
"lerna": "~7.1.5", | ||
"typescript": "~5.1.6", | ||
"webpack": "~5.88.2", | ||
"webpack-cli": "~5.1.4", | ||
"webpack-dev-server": "~4.15.1" | ||
}, | ||
"dependencies": { | ||
"@shapediver/sdk.geometry-api-sdk-core": "~1.3.0", | ||
"@shapediver/api.geometry-api-dto-v2": "~1.8.0" | ||
"@shapediver/sdk.geometry-api-sdk-core": "~1.3.1", | ||
"@shapediver/api.geometry-api-dto-v2": "~1.11.0" | ||
} | ||
} |
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
147895
2087
+ Added@shapediver/api.geometry-api-dto-v2@1.11.0(transitive)
- Removed@shapediver/api.geometry-api-dto-v2@1.8.1(transitive)