@shapediver/viewer.session-engine.session-engine 3.11.14 → 3.12.1
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/implementation/OutputLoader.d.ts +2 -2
- package/dist/implementation/OutputLoader.d.ts.map +1 -1
- package/dist/implementation/OutputLoader.js.map +1 -1
- package/dist/implementation/SessionData.d.ts +4 -4
- package/dist/implementation/SessionData.d.ts.map +1 -1
- package/dist/implementation/SessionData.js.map +1 -1
- package/dist/implementation/SessionEngine.d.ts +14 -12
- package/dist/implementation/SessionEngine.d.ts.map +1 -1
- package/dist/implementation/SessionEngine.js +101 -60
- package/dist/implementation/SessionEngine.js.map +1 -1
- package/dist/implementation/SessionOutputData.d.ts +4 -4
- package/dist/implementation/SessionOutputData.d.ts.map +1 -1
- package/dist/implementation/SessionOutputData.js.map +1 -1
- package/dist/implementation/dto/DrawingParameter.d.ts +2 -2
- package/dist/implementation/dto/DrawingParameter.d.ts.map +1 -1
- package/dist/implementation/dto/DrawingParameter.js.map +1 -1
- package/dist/implementation/dto/Export.d.ts +12 -12
- package/dist/implementation/dto/Export.d.ts.map +1 -1
- package/dist/implementation/dto/Export.js +3 -2
- package/dist/implementation/dto/Export.js.map +1 -1
- package/dist/implementation/dto/FileParameter.d.ts +2 -2
- package/dist/implementation/dto/FileParameter.d.ts.map +1 -1
- package/dist/implementation/dto/FileParameter.js.map +1 -1
- package/dist/implementation/dto/Output.d.ts +10 -10
- package/dist/implementation/dto/Output.d.ts.map +1 -1
- package/dist/implementation/dto/Output.js.map +1 -1
- package/dist/implementation/dto/Parameter.d.ts +5 -5
- package/dist/implementation/dto/Parameter.d.ts.map +1 -1
- package/dist/implementation/dto/Parameter.js.map +1 -1
- package/dist/implementation/dto/interaction/DraggingParameter.d.ts +2 -2
- package/dist/implementation/dto/interaction/DraggingParameter.d.ts.map +1 -1
- package/dist/implementation/dto/interaction/DraggingParameter.js.map +1 -1
- package/dist/implementation/dto/interaction/GumballParameter.d.ts +2 -2
- package/dist/implementation/dto/interaction/GumballParameter.d.ts.map +1 -1
- package/dist/implementation/dto/interaction/GumballParameter.js.map +1 -1
- package/dist/implementation/dto/interaction/SelectionParameter.d.ts +2 -2
- package/dist/implementation/dto/interaction/SelectionParameter.d.ts.map +1 -1
- package/dist/implementation/dto/interaction/SelectionParameter.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/interfaces/ISessionData.d.ts +2 -2
- package/dist/interfaces/ISessionData.d.ts.map +1 -1
- package/dist/interfaces/ISessionEngine.d.ts +12 -12
- package/dist/interfaces/ISessionEngine.d.ts.map +1 -1
- package/dist/interfaces/ISessionOutputData.d.ts +2 -2
- package/dist/interfaces/ISessionOutputData.d.ts.map +1 -1
- package/dist/interfaces/dto/IExport.d.ts +5 -5
- package/dist/interfaces/dto/IExport.d.ts.map +1 -1
- package/dist/interfaces/dto/IOutput.d.ts +8 -8
- package/dist/interfaces/dto/IOutput.d.ts.map +1 -1
- package/dist/interfaces/dto/IOutput.js.map +1 -1
- package/dist/interfaces/dto/IParameter.d.ts +2 -2
- package/dist/interfaces/dto/IParameter.d.ts.map +1 -1
- package/package.json +10 -11
|
@@ -96,6 +96,7 @@ class SessionEngine {
|
|
|
96
96
|
this._excludeViewports = properties.excludeViewports || [];
|
|
97
97
|
this._jwtToken = properties.jwtToken;
|
|
98
98
|
this._allowOutputLoading = properties.allowOutputLoading;
|
|
99
|
+
this._ignoreUnknownParams = properties.ignoreUnknownParams;
|
|
99
100
|
this._loadSdtf = properties.loadSdtf;
|
|
100
101
|
this._modelStateId = properties.modelStateId;
|
|
101
102
|
this._modelStateValidationMode = properties.modelStateValidationMode;
|
|
@@ -107,8 +108,13 @@ class SessionEngine {
|
|
|
107
108
|
this._headers["X-ShapeDiver-BuildVersion"] = properties.buildVersion;
|
|
108
109
|
this._outputLoader = new OutputLoader_1.OutputLoader(this);
|
|
109
110
|
try {
|
|
110
|
-
this.
|
|
111
|
-
|
|
111
|
+
this._sdkConfig = new sdk_geometry_api_sdk_v2_1.Configuration({
|
|
112
|
+
basePath: this._modelViewUrl,
|
|
113
|
+
accessToken: this._jwtToken,
|
|
114
|
+
baseOptions: {
|
|
115
|
+
headers: this._headers,
|
|
116
|
+
},
|
|
117
|
+
});
|
|
112
118
|
}
|
|
113
119
|
catch (e) {
|
|
114
120
|
throw this._httpClient.convertError(e);
|
|
@@ -389,8 +395,7 @@ class SessionEngine {
|
|
|
389
395
|
settings.rendering.toneMappingExposure;
|
|
390
396
|
}
|
|
391
397
|
if (sections.viewport.general) {
|
|
392
|
-
currentSettings.
|
|
393
|
-
settings.general.commitParameters;
|
|
398
|
+
currentSettings.configuration = settings.configuration;
|
|
394
399
|
currentSettings.general.pointSize = settings.general.pointSize;
|
|
395
400
|
currentSettings.material.defaultMaterialColor =
|
|
396
401
|
settings.material.defaultMaterialColor;
|
|
@@ -443,7 +448,7 @@ class SessionEngine {
|
|
|
443
448
|
this.checkAvailability("close");
|
|
444
449
|
try {
|
|
445
450
|
this._httpClient.removeDataLoading(this._sessionId);
|
|
446
|
-
yield this.
|
|
451
|
+
yield new sdk_geometry_api_sdk_v2_1.SessionApi(this._sdkConfig).closeSession(this._sessionId);
|
|
447
452
|
if (this._automaticSceneUpdate)
|
|
448
453
|
this.removeFromSceneTree(this._node);
|
|
449
454
|
this._closed = true;
|
|
@@ -485,24 +490,26 @@ class SessionEngine {
|
|
|
485
490
|
let arSceneId;
|
|
486
491
|
if (arScene) {
|
|
487
492
|
promises.push(this._converter
|
|
488
|
-
.
|
|
489
|
-
.then((
|
|
493
|
+
.convertToBlob(arScene)
|
|
494
|
+
.then((arSceneBlob) => new sdk_geometry_api_sdk_v2_1.GltfApi(this._sdkConfig).uploadGltf(this._sessionId, new File([arSceneBlob], "arScene.gltf", {
|
|
495
|
+
type: "model/gltf-binary",
|
|
496
|
+
}), sdk_geometry_api_sdk_v2_1.QueryGltfConversion.SCENE))
|
|
490
497
|
.then((arSceneResponseDto) => {
|
|
491
498
|
var _a;
|
|
492
|
-
arSceneId = (_a = arSceneResponseDto.gltf) === null || _a === void 0 ? void 0 : _a.sceneId;
|
|
499
|
+
arSceneId = (_a = arSceneResponseDto.data.gltf) === null || _a === void 0 ? void 0 : _a.sceneId;
|
|
493
500
|
}));
|
|
494
501
|
}
|
|
495
502
|
// wait for all promises to resolve
|
|
496
503
|
yield Promise.all(promises);
|
|
497
504
|
// create the model state
|
|
498
|
-
const response = yield this.
|
|
505
|
+
const response = (yield new sdk_geometry_api_sdk_v2_1.ModelStateApi(this._sdkConfig).createModelState(this._sessionId, {
|
|
499
506
|
parameters: parameterSet,
|
|
500
507
|
data: data,
|
|
501
508
|
image: imageData,
|
|
502
509
|
arSceneId: arSceneId,
|
|
503
|
-
});
|
|
510
|
+
})).data;
|
|
504
511
|
if (imageData && imageArrayBuffer)
|
|
505
|
-
yield this.
|
|
512
|
+
yield new sdk_geometry_api_sdk_v2_1.UtilsApi(this._sdkConfig).uploadAsset(response.asset.modelState.href, imageArrayBuffer, response.asset.modelState.headers);
|
|
506
513
|
return response.modelState.id;
|
|
507
514
|
}
|
|
508
515
|
catch (e) {
|
|
@@ -750,7 +757,7 @@ class SessionEngine {
|
|
|
750
757
|
// get the model state if it is not already a response
|
|
751
758
|
let response;
|
|
752
759
|
if (typeof modelState === "string") {
|
|
753
|
-
response = yield this.
|
|
760
|
+
response = (yield new sdk_geometry_api_sdk_v2_1.ModelStateApi(this._sdkConfig).getModelState(modelState)).data;
|
|
754
761
|
}
|
|
755
762
|
else {
|
|
756
763
|
response = modelState;
|
|
@@ -773,7 +780,14 @@ class SessionEngine {
|
|
|
773
780
|
return __awaiter(this, void 0, void 0, function* () {
|
|
774
781
|
this.checkAvailability();
|
|
775
782
|
try {
|
|
776
|
-
|
|
783
|
+
const response = yield new sdk_geometry_api_sdk_v2_1.FileApi(this._sdkConfig).getFileMetadata(this._sessionId, parameterId, fileId);
|
|
784
|
+
const { size, filename } = (0, sdk_geometry_api_sdk_v2_1.extractFileInfo)(response.headers);
|
|
785
|
+
return {
|
|
786
|
+
parameterId: parameterId,
|
|
787
|
+
id: fileId,
|
|
788
|
+
size: size,
|
|
789
|
+
filename: filename,
|
|
790
|
+
};
|
|
777
791
|
}
|
|
778
792
|
catch (e) {
|
|
779
793
|
yield this.handleError(e, retry);
|
|
@@ -788,7 +802,8 @@ class SessionEngine {
|
|
|
788
802
|
const id = modelStateId || this._modelStateId;
|
|
789
803
|
if (!id)
|
|
790
804
|
throw new viewer_shared_services_1.ShapeDiverViewerSessionError("Session.getModelState: No model state id available.");
|
|
791
|
-
|
|
805
|
+
const response = (yield new sdk_geometry_api_sdk_v2_1.ModelStateApi(this._sdkConfig).getModelState(id)).data;
|
|
806
|
+
return response;
|
|
792
807
|
}
|
|
793
808
|
catch (e) {
|
|
794
809
|
throw this._httpClient.convertError(e);
|
|
@@ -854,10 +869,10 @@ class SessionEngine {
|
|
|
854
869
|
for (const parameterNameOrId in parameterValues)
|
|
855
870
|
parameterSet[parameterNameOrId] = (" " + parameterValues[parameterNameOrId]).slice(1);
|
|
856
871
|
if (this._ticket) {
|
|
857
|
-
this._responseDto = yield this.
|
|
872
|
+
this._responseDto = (yield new sdk_geometry_api_sdk_v2_1.SessionApi(this._sdkConfig).createSessionByTicket(this._ticket, this._modelStateId, this._ignoreUnknownParams, this._modelStateValidationMode, parameterSet)).data;
|
|
858
873
|
}
|
|
859
874
|
else if (this._guid) {
|
|
860
|
-
this._responseDto = yield this.
|
|
875
|
+
this._responseDto = (yield new sdk_geometry_api_sdk_v2_1.SessionApi(this._sdkConfig).createSessionByModel(this._guid, this._modelStateId, this._ignoreUnknownParams, this._modelStateValidationMode, parameterSet)).data;
|
|
861
876
|
}
|
|
862
877
|
else {
|
|
863
878
|
// we should never get here
|
|
@@ -871,8 +886,24 @@ class SessionEngine {
|
|
|
871
886
|
this._modelId = (_b = this._responseDto.model) === null || _b === void 0 ? void 0 : _b.id;
|
|
872
887
|
this._modelState = this._responseDto.modelState;
|
|
873
888
|
this._httpClient.addDataLoading(this._sessionId, {
|
|
874
|
-
getAsset: this
|
|
875
|
-
|
|
889
|
+
getAsset: (url) => __awaiter(this, void 0, void 0, function* () {
|
|
890
|
+
const response = yield new sdk_geometry_api_sdk_v2_1.UtilsApi(this._sdkConfig).downloadAsset(url, {
|
|
891
|
+
responseType: "arraybuffer",
|
|
892
|
+
})[0];
|
|
893
|
+
return [
|
|
894
|
+
response.data,
|
|
895
|
+
response.headers["content-type"],
|
|
896
|
+
];
|
|
897
|
+
}),
|
|
898
|
+
downloadTexture: (url) => __awaiter(this, void 0, void 0, function* () {
|
|
899
|
+
const response = yield new sdk_geometry_api_sdk_v2_1.UtilsApi(this._sdkConfig).downloadImage(this._sessionId, url, {
|
|
900
|
+
responseType: "arraybuffer",
|
|
901
|
+
});
|
|
902
|
+
return [
|
|
903
|
+
response.data,
|
|
904
|
+
response.headers["content-type"],
|
|
905
|
+
];
|
|
906
|
+
}),
|
|
876
907
|
});
|
|
877
908
|
this._settingsEngine.loadSettings(this._viewerSettings);
|
|
878
909
|
if (!this._sessionId)
|
|
@@ -927,7 +958,7 @@ class SessionEngine {
|
|
|
927
958
|
this._eventEngine.emitEvent(viewer_shared_services_1.EVENTTYPE.TASK.TASK_START, eventStart);
|
|
928
959
|
}
|
|
929
960
|
// get the cached outputs
|
|
930
|
-
const responseDto = yield this.
|
|
961
|
+
const responseDto = (yield new sdk_geometry_api_sdk_v2_1.OutputApi(this._sdkConfig).getCachedOutputs(this._sessionId, outputMapping)).data;
|
|
931
962
|
// create atomic output api objects for them
|
|
932
963
|
const outputs = {};
|
|
933
964
|
for (const outputId in responseDto.outputs) {
|
|
@@ -995,7 +1026,7 @@ class SessionEngine {
|
|
|
995
1026
|
for (const output in o)
|
|
996
1027
|
outputMapping[output] = o[output].version;
|
|
997
1028
|
try {
|
|
998
|
-
const responseDto = yield this.
|
|
1029
|
+
const responseDto = (yield new sdk_geometry_api_sdk_v2_1.OutputApi(this._sdkConfig).getCachedOutputs(this._sessionId, outputMapping)).data;
|
|
999
1030
|
if (cancelRequest())
|
|
1000
1031
|
return new SessionTreeNode_1.SessionTreeNode();
|
|
1001
1032
|
this.updateResponseDto(responseDto);
|
|
@@ -1051,7 +1082,7 @@ class SessionEngine {
|
|
|
1051
1082
|
for (const output in outputs)
|
|
1052
1083
|
outputMapping[output] = outputs[output].version;
|
|
1053
1084
|
try {
|
|
1054
|
-
const responseDto = yield this.
|
|
1085
|
+
const responseDto = (yield new sdk_geometry_api_sdk_v2_1.OutputApi(this._sdkConfig).getCachedOutputs(this._sessionId, outputMapping)).data;
|
|
1055
1086
|
if (cancelRequest())
|
|
1056
1087
|
return new SessionTreeNode_1.SessionTreeNode();
|
|
1057
1088
|
this.updateResponseDto(responseDto);
|
|
@@ -1072,7 +1103,7 @@ class SessionEngine {
|
|
|
1072
1103
|
try {
|
|
1073
1104
|
yield this.uploadFileParameters(parameters);
|
|
1074
1105
|
const requestParameterSet = this.cleanExportParameters(parameters);
|
|
1075
|
-
const responseDto = yield this.
|
|
1106
|
+
const responseDto = yield new sdk_geometry_api_sdk_v2_1.UtilsApi(this._sdkConfig).submitAndWaitForExport(this._sessionId, { exports: [exportId], parameters: requestParameterSet }, maxWaitTime, this._ignoreUnknownParams);
|
|
1076
1107
|
this.updateResponseDto(responseDto);
|
|
1077
1108
|
return this.exports[exportId];
|
|
1078
1109
|
}
|
|
@@ -1130,12 +1161,12 @@ class SessionEngine {
|
|
|
1130
1161
|
};
|
|
1131
1162
|
this._eventEngine.emitEvent(viewer_shared_services_1.EVENTTYPE.TASK.TASK_PROCESS, eventRequest);
|
|
1132
1163
|
}
|
|
1133
|
-
const responseDto = yield this.
|
|
1164
|
+
const responseDto = yield new sdk_geometry_api_sdk_v2_1.UtilsApi(this._sdkConfig).submitAndWaitForExport(this._sessionId, {
|
|
1134
1165
|
exports: body.exports,
|
|
1135
1166
|
parameters: requestParameterSet,
|
|
1136
1167
|
outputs: body.outputs,
|
|
1137
1168
|
max_wait_time: body.max_wait_time,
|
|
1138
|
-
}, maxWaitMsec);
|
|
1169
|
+
}, maxWaitMsec, this._ignoreUnknownParams);
|
|
1139
1170
|
this.updateResponseDto(responseDto);
|
|
1140
1171
|
if (treatInternallyAsCustomization) {
|
|
1141
1172
|
yield this.updateOutputs({
|
|
@@ -1231,7 +1262,7 @@ class SessionEngine {
|
|
|
1231
1262
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1232
1263
|
this.checkAvailability("defaultparam", true);
|
|
1233
1264
|
try {
|
|
1234
|
-
yield this.
|
|
1265
|
+
yield new sdk_geometry_api_sdk_v2_1.ModelApi(this._sdkConfig).updateParameterDefaultValues(this._modelId, this._parameterValues);
|
|
1235
1266
|
return true;
|
|
1236
1267
|
}
|
|
1237
1268
|
catch (e) {
|
|
@@ -1250,7 +1281,7 @@ class SessionEngine {
|
|
|
1250
1281
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1251
1282
|
this.checkAvailability("export-definition", true);
|
|
1252
1283
|
try {
|
|
1253
|
-
yield this.
|
|
1284
|
+
yield new sdk_geometry_api_sdk_v2_1.ExportApi(this._sdkConfig).updateExportDefinitions(this._modelId, exports);
|
|
1254
1285
|
return true;
|
|
1255
1286
|
}
|
|
1256
1287
|
catch (e) {
|
|
@@ -1269,7 +1300,7 @@ class SessionEngine {
|
|
|
1269
1300
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1270
1301
|
this.checkAvailability("output-definition", true);
|
|
1271
1302
|
try {
|
|
1272
|
-
yield this.
|
|
1303
|
+
yield new sdk_geometry_api_sdk_v2_1.OutputApi(this._sdkConfig).updateOutputDefinitions(this._modelId, outputs);
|
|
1273
1304
|
return true;
|
|
1274
1305
|
}
|
|
1275
1306
|
catch (e) {
|
|
@@ -1288,7 +1319,7 @@ class SessionEngine {
|
|
|
1288
1319
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1289
1320
|
this.checkAvailability("parameter-definition", true);
|
|
1290
1321
|
try {
|
|
1291
|
-
yield this.
|
|
1322
|
+
yield new sdk_geometry_api_sdk_v2_1.ModelApi(this._sdkConfig).updateParameterDefinitions(this._modelId, parameters);
|
|
1292
1323
|
return true;
|
|
1293
1324
|
}
|
|
1294
1325
|
catch (e) {
|
|
@@ -1313,7 +1344,7 @@ class SessionEngine {
|
|
|
1313
1344
|
e.message, e);
|
|
1314
1345
|
}
|
|
1315
1346
|
try {
|
|
1316
|
-
yield this.
|
|
1347
|
+
yield new sdk_geometry_api_sdk_v2_1.ModelApi(this._sdkConfig).updateModelConfig(this._modelId, json);
|
|
1317
1348
|
return true;
|
|
1318
1349
|
}
|
|
1319
1350
|
catch (e) {
|
|
@@ -1405,8 +1436,8 @@ class SessionEngine {
|
|
|
1405
1436
|
this.checkAvailability();
|
|
1406
1437
|
this._jwtToken = value;
|
|
1407
1438
|
try {
|
|
1408
|
-
this.
|
|
1409
|
-
const responseDto = yield this.
|
|
1439
|
+
this._sdkConfig.accessToken = value;
|
|
1440
|
+
const responseDto = (yield new sdk_geometry_api_sdk_v2_1.SessionApi(this._sdkConfig).getSessionDefaults(this._sessionId)).data;
|
|
1410
1441
|
if (this._responseDto)
|
|
1411
1442
|
this._responseDto.actions = responseDto.actions;
|
|
1412
1443
|
}
|
|
@@ -1582,19 +1613,19 @@ class SessionEngine {
|
|
|
1582
1613
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1583
1614
|
this.checkAvailability("file-upload");
|
|
1584
1615
|
try {
|
|
1585
|
-
const result = yield this.
|
|
1616
|
+
const result = (yield new sdk_geometry_api_sdk_v2_1.FileApi(this._sdkConfig).uploadFile(this._sessionId, {
|
|
1586
1617
|
[parameterId]: {
|
|
1587
1618
|
size: data.size,
|
|
1588
1619
|
format: type,
|
|
1589
1620
|
filename: data.name === "" ? undefined : data.name,
|
|
1590
1621
|
},
|
|
1591
|
-
});
|
|
1622
|
+
})).data;
|
|
1592
1623
|
if (result &&
|
|
1593
1624
|
result.asset &&
|
|
1594
1625
|
result.asset.file &&
|
|
1595
1626
|
result.asset.file[parameterId]) {
|
|
1596
1627
|
const fileAsset = result.asset.file[parameterId];
|
|
1597
|
-
yield this.
|
|
1628
|
+
yield new sdk_geometry_api_sdk_v2_1.UtilsApi(this._sdkConfig).uploadAsset(fileAsset.href, yield data.arrayBuffer(), fileAsset.headers);
|
|
1598
1629
|
return fileAsset.id;
|
|
1599
1630
|
}
|
|
1600
1631
|
else {
|
|
@@ -1646,11 +1677,13 @@ class SessionEngine {
|
|
|
1646
1677
|
return fileParameterValues;
|
|
1647
1678
|
});
|
|
1648
1679
|
}
|
|
1649
|
-
uploadGLTF(blob, conversion = sdk_geometry_api_sdk_v2_1.
|
|
1680
|
+
uploadGLTF(blob, conversion = sdk_geometry_api_sdk_v2_1.QueryGltfConversion.NONE, retry = false) {
|
|
1650
1681
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1651
1682
|
this.checkAvailability("gltf-upload");
|
|
1652
1683
|
try {
|
|
1653
|
-
const responseDto = yield this.
|
|
1684
|
+
const responseDto = (yield new sdk_geometry_api_sdk_v2_1.GltfApi(this._sdkConfig).uploadGltf(this._sessionId, new File([blob], "model.gltf", {
|
|
1685
|
+
type: "model/gltf-binary",
|
|
1686
|
+
}), conversion)).data;
|
|
1654
1687
|
if (!responseDto || !responseDto.gltf || !responseDto.gltf.href)
|
|
1655
1688
|
throw new viewer_shared_services_1.ShapeDiverViewerSessionError("Session.uploadGLTF: Upload reply has not the required format.");
|
|
1656
1689
|
return responseDto;
|
|
@@ -1691,10 +1724,10 @@ class SessionEngine {
|
|
|
1691
1724
|
if ((throwError === false && outputObj.msg !== undefined) ||
|
|
1692
1725
|
(outputObj.status_collect &&
|
|
1693
1726
|
outputObj.status_collect !==
|
|
1694
|
-
sdk_geometry_api_sdk_v2_1.
|
|
1727
|
+
sdk_geometry_api_sdk_v2_1.ResComputationStatus.SUCCESS) ||
|
|
1695
1728
|
(outputObj.status_computation &&
|
|
1696
1729
|
outputObj.status_computation !==
|
|
1697
|
-
sdk_geometry_api_sdk_v2_1.
|
|
1730
|
+
sdk_geometry_api_sdk_v2_1.ResComputationStatus.SUCCESS)) {
|
|
1698
1731
|
outputsWithIssues[outputId] = outputObj;
|
|
1699
1732
|
}
|
|
1700
1733
|
}
|
|
@@ -1703,10 +1736,10 @@ class SessionEngine {
|
|
|
1703
1736
|
if ((throwError === false && exportObj.msg !== undefined) ||
|
|
1704
1737
|
(exportObj.status_collect &&
|
|
1705
1738
|
exportObj.status_collect !==
|
|
1706
|
-
sdk_geometry_api_sdk_v2_1.
|
|
1739
|
+
sdk_geometry_api_sdk_v2_1.ResComputationStatus.SUCCESS) ||
|
|
1707
1740
|
(exportObj.status_computation &&
|
|
1708
1741
|
exportObj.status_computation !==
|
|
1709
|
-
sdk_geometry_api_sdk_v2_1.
|
|
1742
|
+
sdk_geometry_api_sdk_v2_1.ResComputationStatus.SUCCESS)) {
|
|
1710
1743
|
exportsWithIssues[exportId] = exportObj;
|
|
1711
1744
|
}
|
|
1712
1745
|
}
|
|
@@ -1723,11 +1756,11 @@ class SessionEngine {
|
|
|
1723
1756
|
warning += `\n\t- ${outputsWithIssues[outputId].msg}`;
|
|
1724
1757
|
if (outputsWithIssues[outputId].status_collect &&
|
|
1725
1758
|
outputsWithIssues[outputId].status_collect !==
|
|
1726
|
-
sdk_geometry_api_sdk_v2_1.
|
|
1759
|
+
sdk_geometry_api_sdk_v2_1.ResComputationStatus.SUCCESS)
|
|
1727
1760
|
warning += `\n\t- status_collect is ${outputsWithIssues[outputId].status_collect}`;
|
|
1728
1761
|
if (outputsWithIssues[outputId].status_computation &&
|
|
1729
1762
|
outputsWithIssues[outputId].status_computation !==
|
|
1730
|
-
sdk_geometry_api_sdk_v2_1.
|
|
1763
|
+
sdk_geometry_api_sdk_v2_1.ResComputationStatus.SUCCESS)
|
|
1731
1764
|
warning += `\n\t- status_computation is ${outputsWithIssues[outputId].status_computation}`;
|
|
1732
1765
|
if (warning)
|
|
1733
1766
|
this._logger.warn(`\nOutput(${outputId}):${warning}`);
|
|
@@ -1739,11 +1772,11 @@ class SessionEngine {
|
|
|
1739
1772
|
warning += `\n\t- ${exportsWithIssues[exportId].msg}`;
|
|
1740
1773
|
if (exportsWithIssues[exportId].status_collect &&
|
|
1741
1774
|
exportsWithIssues[exportId].status_collect !==
|
|
1742
|
-
sdk_geometry_api_sdk_v2_1.
|
|
1775
|
+
sdk_geometry_api_sdk_v2_1.ResComputationStatus.SUCCESS)
|
|
1743
1776
|
warning += `\n\t- status_collect is ${exportsWithIssues[exportId].status_collect}`;
|
|
1744
1777
|
if (exportsWithIssues[exportId].status_computation &&
|
|
1745
1778
|
exportsWithIssues[exportId].status_computation !==
|
|
1746
|
-
sdk_geometry_api_sdk_v2_1.
|
|
1779
|
+
sdk_geometry_api_sdk_v2_1.ResComputationStatus.SUCCESS)
|
|
1747
1780
|
warning += `\n\t- status_computation is ${exportsWithIssues[exportId].status_computation}`;
|
|
1748
1781
|
if (warning)
|
|
1749
1782
|
this._logger.warn(`\nExport(${exportId}):${warning}`);
|
|
@@ -1865,7 +1898,7 @@ class SessionEngine {
|
|
|
1865
1898
|
this.checkAvailability("customize");
|
|
1866
1899
|
try {
|
|
1867
1900
|
this._performanceEvaluator.startSection("sessionResponse");
|
|
1868
|
-
const responseDto = yield this.
|
|
1901
|
+
const responseDto = yield new sdk_geometry_api_sdk_v2_1.UtilsApi(this._sdkConfig).submitAndWaitForOutput(this._sessionId, parameters, undefined, this._ignoreUnknownParams);
|
|
1869
1902
|
this._performanceEvaluator.endSection("sessionResponse");
|
|
1870
1903
|
if (loadOutputs === true && this._allowOutputLoading === true) {
|
|
1871
1904
|
if (cancelRequest())
|
|
@@ -1916,8 +1949,8 @@ class SessionEngine {
|
|
|
1916
1949
|
}
|
|
1917
1950
|
handleError(e, retry = false) {
|
|
1918
1951
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1919
|
-
if (
|
|
1920
|
-
if (e.
|
|
1952
|
+
if (e instanceof sdk_geometry_api_sdk_v2_1.ResponseError) {
|
|
1953
|
+
if (e.type === sdk_geometry_api_sdk_v2_1.ResErrorType.SESSION_GONE_ERROR) {
|
|
1921
1954
|
// case 1: the session is no longer available
|
|
1922
1955
|
// we try to re-initialize the session 3 times, if that does not work, we close it
|
|
1923
1956
|
this._logger.warn("The session has been closed, trying to re-initialize.");
|
|
@@ -1936,11 +1969,13 @@ class SessionEngine {
|
|
|
1936
1969
|
try {
|
|
1937
1970
|
yield this._closeOnFailure();
|
|
1938
1971
|
}
|
|
1939
|
-
catch (e) {
|
|
1972
|
+
catch (e) {
|
|
1973
|
+
/* empty */
|
|
1974
|
+
}
|
|
1940
1975
|
throw this._httpClient.convertError(e);
|
|
1941
1976
|
}
|
|
1942
1977
|
}
|
|
1943
|
-
else if (e.
|
|
1978
|
+
else if (e.type === sdk_geometry_api_sdk_v2_1.ResErrorType.JWT_VALIDATION_ERROR) {
|
|
1944
1979
|
// if any of the above errors occur, we try to get a new bearer token
|
|
1945
1980
|
// if we get a new one, we retry 3 times (by requiring new bearer tokens every time)
|
|
1946
1981
|
if (this._retryCounter < 3) {
|
|
@@ -1956,7 +1991,9 @@ class SessionEngine {
|
|
|
1956
1991
|
try {
|
|
1957
1992
|
yield this._closeOnFailure();
|
|
1958
1993
|
}
|
|
1959
|
-
catch (e) {
|
|
1994
|
+
catch (e) {
|
|
1995
|
+
/* empty */
|
|
1996
|
+
}
|
|
1960
1997
|
throw this._httpClient.convertError(e);
|
|
1961
1998
|
}
|
|
1962
1999
|
}
|
|
@@ -1967,7 +2004,9 @@ class SessionEngine {
|
|
|
1967
2004
|
try {
|
|
1968
2005
|
yield this._closeOnFailure();
|
|
1969
2006
|
}
|
|
1970
|
-
catch (e) {
|
|
2007
|
+
catch (e) {
|
|
2008
|
+
/* empty */
|
|
2009
|
+
}
|
|
1971
2010
|
throw this._httpClient.convertError(e);
|
|
1972
2011
|
}
|
|
1973
2012
|
}
|
|
@@ -2024,13 +2063,15 @@ class SessionEngine {
|
|
|
2024
2063
|
}
|
|
2025
2064
|
else {
|
|
2026
2065
|
// case where the image is a URL
|
|
2027
|
-
const
|
|
2066
|
+
const file = yield new sdk_geometry_api_sdk_v2_1.UtilsApi(this._sdkConfig).downloadImage(this._sessionId, imageString, {
|
|
2067
|
+
responseType: "arraybuffer",
|
|
2068
|
+
});
|
|
2028
2069
|
return {
|
|
2029
2070
|
imageData: {
|
|
2030
|
-
format: type,
|
|
2031
|
-
size:
|
|
2071
|
+
format: file.data.type,
|
|
2072
|
+
size: file.data.size,
|
|
2032
2073
|
},
|
|
2033
|
-
arrayBuffer,
|
|
2074
|
+
arrayBuffer: yield file.data.arrayBuffer(),
|
|
2034
2075
|
};
|
|
2035
2076
|
}
|
|
2036
2077
|
});
|
|
@@ -2169,15 +2210,15 @@ class SessionEngine {
|
|
|
2169
2210
|
__classPrivateFieldGet(this, _SessionEngine_parameterHistory, "f").push(parameterSet);
|
|
2170
2211
|
for (const exportId in this._responseDto.exports) {
|
|
2171
2212
|
if (this._responseDto.exports[exportId].type ===
|
|
2172
|
-
sdk_geometry_api_sdk_v2_1.
|
|
2213
|
+
sdk_geometry_api_sdk_v2_1.ResExportDefinitionType.EMAIL ||
|
|
2173
2214
|
this._responseDto.exports[exportId].type ===
|
|
2174
|
-
sdk_geometry_api_sdk_v2_1.
|
|
2215
|
+
sdk_geometry_api_sdk_v2_1.ResExportDefinitionType.DOWNLOAD) {
|
|
2175
2216
|
if (!this.exports[exportId]) {
|
|
2176
2217
|
this._responseDto.exports[exportId].id = exportId;
|
|
2177
2218
|
this.exports[exportId] = new Export_1.Export(this._responseDto.exports[exportId], this);
|
|
2178
2219
|
}
|
|
2179
2220
|
else {
|
|
2180
|
-
this.exports[exportId].
|
|
2221
|
+
this.exports[exportId].updateExport(this._responseDto.exports[exportId]);
|
|
2181
2222
|
}
|
|
2182
2223
|
}
|
|
2183
2224
|
}
|
|
@@ -2186,10 +2227,10 @@ class SessionEngine {
|
|
|
2186
2227
|
this._responseDto.outputs[outputId].id = outputId;
|
|
2187
2228
|
if (this.outputsFreeze[outputId] === undefined)
|
|
2188
2229
|
this.outputsFreeze[outputId] = false;
|
|
2189
|
-
this.outputs[outputId] = new Output_1.Output(
|
|
2230
|
+
this.outputs[outputId] = new Output_1.Output(this._responseDto.outputs[outputId], this);
|
|
2190
2231
|
}
|
|
2191
2232
|
else {
|
|
2192
|
-
this.outputs[outputId].updateOutputDefinition(
|
|
2233
|
+
this.outputs[outputId].updateOutputDefinition(this._responseDto.outputs[outputId]);
|
|
2193
2234
|
}
|
|
2194
2235
|
}
|
|
2195
2236
|
}
|