@shapediver/viewer.session-engine.session-engine 3.8.15 → 3.9.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.
Files changed (84) hide show
  1. package/README.md +1 -1
  2. package/dist/implementation/OutputDelayException.d.ts.map +1 -1
  3. package/dist/implementation/OutputDelayException.js.map +1 -1
  4. package/dist/implementation/OutputLoader.d.ts +4 -4
  5. package/dist/implementation/OutputLoader.d.ts.map +1 -1
  6. package/dist/implementation/OutputLoader.js +52 -25
  7. package/dist/implementation/OutputLoader.js.map +1 -1
  8. package/dist/implementation/SessionData.d.ts +3 -3
  9. package/dist/implementation/SessionData.d.ts.map +1 -1
  10. package/dist/implementation/SessionData.js.map +1 -1
  11. package/dist/implementation/SessionEngine.d.ts +10 -10
  12. package/dist/implementation/SessionEngine.d.ts.map +1 -1
  13. package/dist/implementation/SessionEngine.js +654 -274
  14. package/dist/implementation/SessionEngine.js.map +1 -1
  15. package/dist/implementation/SessionOutputData.d.ts +3 -3
  16. package/dist/implementation/SessionOutputData.d.ts.map +1 -1
  17. package/dist/implementation/SessionOutputData.js.map +1 -1
  18. package/dist/implementation/SessionTreeNode.d.ts +2 -2
  19. package/dist/implementation/SessionTreeNode.d.ts.map +1 -1
  20. package/dist/implementation/SessionTreeNode.js.map +1 -1
  21. package/dist/implementation/dto/DrawingParameter.d.ts +7 -7
  22. package/dist/implementation/dto/DrawingParameter.d.ts.map +1 -1
  23. package/dist/implementation/dto/DrawingParameter.js +1 -1
  24. package/dist/implementation/dto/DrawingParameter.js.map +1 -1
  25. package/dist/implementation/dto/Export.d.ts +3 -3
  26. package/dist/implementation/dto/Export.d.ts.map +1 -1
  27. package/dist/implementation/dto/Export.js +18 -3
  28. package/dist/implementation/dto/Export.js.map +1 -1
  29. package/dist/implementation/dto/FileParameter.d.ts +4 -4
  30. package/dist/implementation/dto/FileParameter.d.ts.map +1 -1
  31. package/dist/implementation/dto/FileParameter.js +22 -14
  32. package/dist/implementation/dto/FileParameter.js.map +1 -1
  33. package/dist/implementation/dto/Output.d.ts +4 -4
  34. package/dist/implementation/dto/Output.d.ts.map +1 -1
  35. package/dist/implementation/dto/Output.js +5 -4
  36. package/dist/implementation/dto/Output.js.map +1 -1
  37. package/dist/implementation/dto/Parameter.d.ts +4 -4
  38. package/dist/implementation/dto/Parameter.d.ts.map +1 -1
  39. package/dist/implementation/dto/Parameter.js +9 -6
  40. package/dist/implementation/dto/Parameter.js.map +1 -1
  41. package/dist/implementation/dto/interaction/DraggingParameter.d.ts +5 -5
  42. package/dist/implementation/dto/interaction/DraggingParameter.d.ts.map +1 -1
  43. package/dist/implementation/dto/interaction/DraggingParameter.js +3 -2
  44. package/dist/implementation/dto/interaction/DraggingParameter.js.map +1 -1
  45. package/dist/implementation/dto/interaction/GumballParameter.d.ts +6 -6
  46. package/dist/implementation/dto/interaction/GumballParameter.d.ts.map +1 -1
  47. package/dist/implementation/dto/interaction/GumballParameter.js +3 -2
  48. package/dist/implementation/dto/interaction/GumballParameter.js.map +1 -1
  49. package/dist/implementation/dto/interaction/SelectionParameter.d.ts +5 -5
  50. package/dist/implementation/dto/interaction/SelectionParameter.d.ts.map +1 -1
  51. package/dist/implementation/dto/interaction/SelectionParameter.js +3 -2
  52. package/dist/implementation/dto/interaction/SelectionParameter.js.map +1 -1
  53. package/dist/index.d.ts +24 -24
  54. package/dist/index.d.ts.map +1 -1
  55. package/dist/index.js +4 -4
  56. package/dist/index.js.map +1 -1
  57. package/dist/interfaces/ISessionData.d.ts +2 -2
  58. package/dist/interfaces/ISessionData.d.ts.map +1 -1
  59. package/dist/interfaces/ISessionEngine.d.ts +8 -8
  60. package/dist/interfaces/ISessionEngine.d.ts.map +1 -1
  61. package/dist/interfaces/ISessionOutputData.d.ts +2 -2
  62. package/dist/interfaces/ISessionOutputData.d.ts.map +1 -1
  63. package/dist/interfaces/ISessionTreeNode.d.ts +1 -1
  64. package/dist/interfaces/ISessionTreeNode.d.ts.map +1 -1
  65. package/dist/interfaces/dto/IDrawingParameter.d.ts +2 -2
  66. package/dist/interfaces/dto/IDrawingParameter.d.ts.map +1 -1
  67. package/dist/interfaces/dto/IExport.d.ts +1 -1
  68. package/dist/interfaces/dto/IExport.d.ts.map +1 -1
  69. package/dist/interfaces/dto/IFileParameter.d.ts +1 -1
  70. package/dist/interfaces/dto/IFileParameter.d.ts.map +1 -1
  71. package/dist/interfaces/dto/IOutput.d.ts +3 -3
  72. package/dist/interfaces/dto/IOutput.d.ts.map +1 -1
  73. package/dist/interfaces/dto/IOutput.js.map +1 -1
  74. package/dist/interfaces/dto/IParameter.d.ts +1 -1
  75. package/dist/interfaces/dto/IParameter.d.ts.map +1 -1
  76. package/dist/interfaces/dto/interaction/IDraggingParameter.d.ts +3 -3
  77. package/dist/interfaces/dto/interaction/IDraggingParameter.d.ts.map +1 -1
  78. package/dist/interfaces/dto/interaction/IGumballParameter.d.ts +3 -3
  79. package/dist/interfaces/dto/interaction/IGumballParameter.d.ts.map +1 -1
  80. package/dist/interfaces/dto/interaction/IInteractionParameter.d.ts +2 -2
  81. package/dist/interfaces/dto/interaction/IInteractionParameter.d.ts.map +1 -1
  82. package/dist/interfaces/dto/interaction/ISelectionParameter.d.ts +3 -3
  83. package/dist/interfaces/dto/interaction/ISelectionParameter.d.ts.map +1 -1
  84. package/package.json +52 -52
@@ -22,23 +22,23 @@ var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (
22
22
  var _SessionEngine_customizationBusyModes, _SessionEngine_customizationProcess, _SessionEngine_parameterHistory, _SessionEngine_parameterHistoryCall, _SessionEngine_parameterHistoryForward;
23
23
  Object.defineProperty(exports, "__esModule", { value: true });
24
24
  exports.SessionEngine = void 0;
25
+ const sdk_geometry_api_sdk_v2_1 = require("@shapediver/sdk.geometry-api-sdk-v2");
25
26
  const viewer_settings_1 = require("@shapediver/viewer.settings");
27
+ const viewer_shared_node_tree_1 = require("@shapediver/viewer.shared.node-tree");
26
28
  const viewer_shared_services_1 = require("@shapediver/viewer.shared.services");
27
- const sdk_geometry_api_sdk_v2_1 = require("@shapediver/sdk.geometry-api-sdk-v2");
29
+ const viewer_shared_types_1 = require("@shapediver/viewer.shared.types");
28
30
  const DrawingParameter_1 = require("./dto/DrawingParameter");
29
31
  const Export_1 = require("./dto/Export");
30
32
  const FileParameter_1 = require("./dto/FileParameter");
33
+ const DraggingParameter_1 = require("./dto/interaction/DraggingParameter");
31
34
  const GumballParameter_1 = require("./dto/interaction/GumballParameter");
32
- const viewer_shared_types_1 = require("@shapediver/viewer.shared.types");
33
- const viewer_shared_node_tree_1 = require("@shapediver/viewer.shared.node-tree");
35
+ const SelectionParameter_1 = require("./dto/interaction/SelectionParameter");
34
36
  const Output_1 = require("./dto/Output");
37
+ const Parameter_1 = require("./dto/Parameter");
35
38
  const OutputDelayException_1 = require("./OutputDelayException");
36
39
  const OutputLoader_1 = require("./OutputLoader");
37
- const Parameter_1 = require("./dto/Parameter");
38
- const SelectionParameter_1 = require("./dto/interaction/SelectionParameter");
39
40
  const SessionData_1 = require("./SessionData");
40
41
  const SessionTreeNode_1 = require("./SessionTreeNode");
41
- const DraggingParameter_1 = require("./dto/interaction/DraggingParameter");
42
42
  /* eslint-disable @typescript-eslint/no-empty-function */
43
43
  class SessionEngine {
44
44
  // #endregion Properties (50)
@@ -60,7 +60,7 @@ class SessionEngine {
60
60
  this._parameters = {};
61
61
  this._performanceEvaluator = viewer_shared_services_1.PerformanceEvaluator.instance;
62
62
  this._sceneTree = viewer_shared_node_tree_1.Tree.instance;
63
- this._sessionEngineId = (viewer_shared_services_1.UuidGenerator.instance).create();
63
+ this._sessionEngineId = viewer_shared_services_1.UuidGenerator.instance.create();
64
64
  this._settingsEngine = new viewer_shared_services_1.SettingsEngine();
65
65
  this._stateEngine = viewer_shared_services_1.StateEngine.instance;
66
66
  this._uuidGenerator = viewer_shared_services_1.UuidGenerator.instance;
@@ -77,10 +77,10 @@ class SessionEngine {
77
77
  this._dataCache = {};
78
78
  this._excludeViewports = [];
79
79
  this._headers = {
80
- 'X-ShapeDiver-Origin': (viewer_shared_services_1.SystemInfo.instance).origin,
81
- 'X-ShapeDiver-SessionEngineId': this._sessionEngineId,
82
- 'X-ShapeDiver-BuildVersion': '',
83
- 'X-ShapeDiver-BuildDate': ''
80
+ "X-ShapeDiver-Origin": viewer_shared_services_1.SystemInfo.instance.origin,
81
+ "X-ShapeDiver-SessionEngineId": this._sessionEngineId,
82
+ "X-ShapeDiver-BuildVersion": "",
83
+ "X-ShapeDiver-BuildDate": "",
84
84
  };
85
85
  this._initialized = false;
86
86
  this._loadSdtf = false;
@@ -99,9 +99,12 @@ class SessionEngine {
99
99
  this._loadSdtf = properties.loadSdtf;
100
100
  this._modelStateId = properties.modelStateId;
101
101
  this._modelStateValidationMode = properties.modelStateValidationMode;
102
- this._throwOnCustomizationError = properties.throwOnCustomizationError !== undefined ? properties.throwOnCustomizationError : false;
103
- this._headers['X-ShapeDiver-BuildDate'] = properties.buildDate;
104
- this._headers['X-ShapeDiver-BuildVersion'] = properties.buildVersion;
102
+ this._throwOnCustomizationError =
103
+ properties.throwOnCustomizationError !== undefined
104
+ ? properties.throwOnCustomizationError
105
+ : false;
106
+ this._headers["X-ShapeDiver-BuildDate"] = properties.buildDate;
107
+ this._headers["X-ShapeDiver-BuildVersion"] = properties.buildVersion;
105
108
  this._outputLoader = new OutputLoader_1.OutputLoader(this);
106
109
  try {
107
110
  this._sdk = (0, sdk_geometry_api_sdk_v2_1.create)(this._modelViewUrl, this._jwtToken);
@@ -118,11 +121,13 @@ class SessionEngine {
118
121
  }
119
122
  set automaticSceneUpdate(value) {
120
123
  this._automaticSceneUpdate = value;
121
- value && this._closed === false ? this.addToSceneTree(this._node) : this.removeFromSceneTree(this._node);
124
+ value && this._closed === false
125
+ ? this.addToSceneTree(this._node)
126
+ : this.removeFromSceneTree(this._node);
122
127
  }
123
128
  get canUploadGLTF() {
124
129
  try {
125
- this.checkAvailability('gltf-upload');
130
+ this.checkAvailability("gltf-upload");
126
131
  return true;
127
132
  }
128
133
  catch (e) {
@@ -223,57 +228,90 @@ class SessionEngine {
223
228
  if (sections.session === undefined) {
224
229
  sections.session = {
225
230
  parameter: { displayname: false, order: false, hidden: false },
226
- export: { displayname: false, order: false, hidden: false }
231
+ export: { displayname: false, order: false, hidden: false },
227
232
  };
228
233
  }
229
234
  if (sections.session.parameter === undefined)
230
- sections.session.parameter = { displayname: false, order: false, hidden: false, value: false };
235
+ sections.session.parameter = {
236
+ displayname: false,
237
+ order: false,
238
+ hidden: false,
239
+ value: false,
240
+ };
231
241
  if (sections.session.export === undefined)
232
- sections.session.export = { displayname: false, order: false, hidden: false };
242
+ sections.session.export = {
243
+ displayname: false,
244
+ order: false,
245
+ hidden: false,
246
+ };
233
247
  if (sections.viewport === undefined)
234
- sections.viewport = { ar: false, scene: false, camera: false, light: false, environment: false, general: false, postprocessing: false };
248
+ sections.viewport = {
249
+ ar: false,
250
+ scene: false,
251
+ camera: false,
252
+ light: false,
253
+ environment: false,
254
+ general: false,
255
+ postprocessing: false,
256
+ };
235
257
  let config;
236
258
  if (response.viewer !== undefined) {
237
259
  config = response.viewer.config;
238
260
  }
239
261
  else {
240
- throw new viewer_shared_services_1.ShapeDiverViewerSettingsError('Session.applySettings: No config object available.');
262
+ throw new viewer_shared_services_1.ShapeDiverViewerSettingsError("Session.applySettings: No config object available.");
241
263
  }
242
264
  try {
243
265
  (0, viewer_settings_1.validate)(config);
244
266
  }
245
267
  catch (e) {
246
- throw new viewer_shared_services_1.ShapeDiverViewerSettingsError('Session.applySettings: Was not able to validate config object.');
268
+ throw new viewer_shared_services_1.ShapeDiverViewerSettingsError("Session.applySettings: Was not able to validate config object.");
247
269
  }
248
270
  const settings = (0, viewer_settings_1.convert)(config, viewer_settings_1.latestVersion);
249
271
  const exportMappingUid = {};
250
- if (sections.session.export.displayname || sections.session.export.order || sections.session.export.hidden)
272
+ if (sections.session.export.displayname ||
273
+ sections.session.export.order ||
274
+ sections.session.export.hidden)
251
275
  if (response.exports)
252
276
  for (const exportId in response.exports)
253
277
  if (response.exports[exportId].uid !== undefined)
254
- exportMappingUid[response.exports[exportId].uid] = exportId;
278
+ exportMappingUid[response.exports[exportId].uid] =
279
+ exportId;
255
280
  const currentSettings = this._settingsEngine.settings;
256
281
  // apply parameter settings
257
- if (sections.session.parameter.displayname || sections.session.parameter.order || sections.session.parameter.hidden || sections.session.parameter.value) {
282
+ if (sections.session.parameter.displayname ||
283
+ sections.session.parameter.order ||
284
+ sections.session.parameter.hidden ||
285
+ sections.session.parameter.value) {
258
286
  for (const p in this.parameters) {
259
287
  if (settings.session[p]) {
260
288
  if (sections.session.parameter.displayname)
261
- this.parameters[p].displayname = settings.session[p].displayname;
289
+ this.parameters[p].displayname =
290
+ settings.session[p].displayname;
262
291
  if (sections.session.parameter.order)
263
292
  this.parameters[p].order = settings.session[p].order;
264
293
  if (sections.session.parameter.hidden)
265
- this.parameters[p].hidden = settings.session[p].hidden || false;
294
+ this.parameters[p].hidden =
295
+ settings.session[p].hidden || false;
266
296
  }
267
- if (response.parameters && response.parameters[p] && !((this.parameters[p] instanceof FileParameter_1.FileParameter) || this.parameters[p].type.startsWith('s'))) {
297
+ if (response.parameters &&
298
+ response.parameters[p] &&
299
+ !(this.parameters[p] instanceof FileParameter_1.FileParameter ||
300
+ this.parameters[p].type.startsWith("s"))) {
268
301
  if (sections.session.parameter.value)
269
- this.parameters[p].value = response.parameters[p].defval !== undefined ? response.parameters[p].defval : this.parameters[p].value;
302
+ this.parameters[p].value =
303
+ response.parameters[p].defval !== undefined
304
+ ? response.parameters[p].defval
305
+ : this.parameters[p].value;
270
306
  }
271
307
  }
272
308
  }
273
309
  // apply export settings
274
- if (sections.session.export.displayname || sections.session.export.order || sections.session.export.hidden) {
310
+ if (sections.session.export.displayname ||
311
+ sections.session.export.order ||
312
+ sections.session.export.hidden) {
275
313
  for (const p in this.exports) {
276
- let idForSettings = '';
314
+ let idForSettings = "";
277
315
  if (settings.session[p]) {
278
316
  idForSettings = p;
279
317
  }
@@ -287,18 +325,22 @@ class SessionEngine {
287
325
  }
288
326
  if (settings.session[idForSettings]) {
289
327
  if (sections.session.export.displayname)
290
- this.exports[p].displayname = settings.session[idForSettings].displayname;
328
+ this.exports[p].displayname =
329
+ settings.session[idForSettings].displayname;
291
330
  if (sections.session.export.order)
292
- this.exports[p].order = settings.session[idForSettings].order;
331
+ this.exports[p].order =
332
+ settings.session[idForSettings].order;
293
333
  if (sections.session.export.hidden)
294
- this.exports[p].hidden = settings.session[idForSettings].hidden || false;
334
+ this.exports[p].hidden =
335
+ settings.session[idForSettings].hidden || false;
295
336
  }
296
337
  }
297
338
  }
298
339
  // apply ar settings
299
340
  if (sections.viewport.ar) {
300
341
  currentSettings.ar = settings.ar;
301
- currentSettings.general.transformation = settings.general.transformation;
342
+ currentSettings.general.transformation =
343
+ settings.general.transformation;
302
344
  }
303
345
  // apply camera settings
304
346
  if (sections.viewport.camera)
@@ -308,44 +350,71 @@ class SessionEngine {
308
350
  currentSettings.light = settings.light;
309
351
  // apply scene settings
310
352
  if (sections.viewport.scene) {
311
- currentSettings.environmentGeometry.gridColor = settings.environmentGeometry.gridColor;
312
- currentSettings.environmentGeometry.gridVisibility = settings.environmentGeometry.gridVisibility;
313
- currentSettings.environmentGeometry.groundPlaneColor = settings.environmentGeometry.groundPlaneColor;
314
- currentSettings.environmentGeometry.groundPlaneVisibility = settings.environmentGeometry.groundPlaneVisibility;
315
- currentSettings.environmentGeometry.groundPlaneShadowColor = settings.environmentGeometry.groundPlaneShadowColor;
316
- currentSettings.environmentGeometry.groundPlaneShadowVisibility = settings.environmentGeometry.groundPlaneShadowVisibility;
317
- currentSettings.environmentGeometry.contactShadowVisibility = settings.environmentGeometry.contactShadowVisibility;
318
- currentSettings.environmentGeometry.contactShadowHeight = settings.environmentGeometry.contactShadowHeight;
319
- currentSettings.environmentGeometry.contactShadowBlur = settings.environmentGeometry.contactShadowBlur;
320
- currentSettings.environmentGeometry.contactShadowOpacity = settings.environmentGeometry.contactShadowOpacity;
321
- currentSettings.environmentGeometry.contactShadowDarkness = settings.environmentGeometry.contactShadowDarkness;
353
+ currentSettings.environmentGeometry.gridColor =
354
+ settings.environmentGeometry.gridColor;
355
+ currentSettings.environmentGeometry.gridVisibility =
356
+ settings.environmentGeometry.gridVisibility;
357
+ currentSettings.environmentGeometry.groundPlaneColor =
358
+ settings.environmentGeometry.groundPlaneColor;
359
+ currentSettings.environmentGeometry.groundPlaneVisibility =
360
+ settings.environmentGeometry.groundPlaneVisibility;
361
+ currentSettings.environmentGeometry.groundPlaneShadowColor =
362
+ settings.environmentGeometry.groundPlaneShadowColor;
363
+ currentSettings.environmentGeometry.groundPlaneShadowVisibility =
364
+ settings.environmentGeometry.groundPlaneShadowVisibility;
365
+ currentSettings.environmentGeometry.contactShadowVisibility =
366
+ settings.environmentGeometry.contactShadowVisibility;
367
+ currentSettings.environmentGeometry.contactShadowHeight =
368
+ settings.environmentGeometry.contactShadowHeight;
369
+ currentSettings.environmentGeometry.contactShadowBlur =
370
+ settings.environmentGeometry.contactShadowBlur;
371
+ currentSettings.environmentGeometry.contactShadowOpacity =
372
+ settings.environmentGeometry.contactShadowOpacity;
373
+ currentSettings.environmentGeometry.contactShadowDarkness =
374
+ settings.environmentGeometry.contactShadowDarkness;
322
375
  currentSettings.rendering.shadows = settings.rendering.shadows;
323
- currentSettings.rendering.softShadows = settings.rendering.softShadows;
324
- currentSettings.rendering.automaticColorAdjustment = settings.rendering.automaticColorAdjustment;
325
- currentSettings.rendering.textureEncoding = settings.rendering.textureEncoding;
326
- currentSettings.rendering.outputEncoding = settings.rendering.outputEncoding;
327
- currentSettings.rendering.physicallyCorrectLights = settings.rendering.physicallyCorrectLights;
328
- currentSettings.rendering.toneMapping = settings.rendering.toneMapping;
329
- currentSettings.rendering.toneMappingExposure = settings.rendering.toneMappingExposure;
376
+ currentSettings.rendering.softShadows =
377
+ settings.rendering.softShadows;
378
+ currentSettings.rendering.automaticColorAdjustment =
379
+ settings.rendering.automaticColorAdjustment;
380
+ currentSettings.rendering.textureEncoding =
381
+ settings.rendering.textureEncoding;
382
+ currentSettings.rendering.outputEncoding =
383
+ settings.rendering.outputEncoding;
384
+ currentSettings.rendering.physicallyCorrectLights =
385
+ settings.rendering.physicallyCorrectLights;
386
+ currentSettings.rendering.toneMapping =
387
+ settings.rendering.toneMapping;
388
+ currentSettings.rendering.toneMappingExposure =
389
+ settings.rendering.toneMappingExposure;
330
390
  }
331
391
  if (sections.viewport.general) {
332
- currentSettings.general.commitParameters = settings.general.commitParameters;
392
+ currentSettings.general.commitParameters =
393
+ settings.general.commitParameters;
333
394
  currentSettings.general.pointSize = settings.general.pointSize;
334
- currentSettings.material.defaultMaterialColor = settings.material.defaultMaterialColor;
335
- currentSettings.material.materialOverrideType = settings.material.materialOverrideType;
395
+ currentSettings.material.defaultMaterialColor =
396
+ settings.material.defaultMaterialColor;
397
+ currentSettings.material.materialOverrideType =
398
+ settings.material.materialOverrideType;
336
399
  }
337
400
  // apply postprocessing settings
338
401
  if (sections.viewport.postprocessing)
339
402
  currentSettings.postprocessing = settings.postprocessing;
340
403
  // apply environment settings
341
404
  if (sections.viewport.environment) {
342
- currentSettings.environment.clearAlpha = settings.environment.clearAlpha;
343
- currentSettings.environment.clearColor = settings.environment.clearColor;
405
+ currentSettings.environment.clearAlpha =
406
+ settings.environment.clearAlpha;
407
+ currentSettings.environment.clearColor =
408
+ settings.environment.clearColor;
344
409
  currentSettings.environment.map = settings.environment.map;
345
- currentSettings.environment.mapAsBackground = settings.environment.mapAsBackground;
346
- currentSettings.environment.rotation = settings.environment.rotation;
347
- currentSettings.environment.blurriness = settings.environment.blurriness;
348
- currentSettings.environment.intensity = settings.environment.intensity;
410
+ currentSettings.environment.mapAsBackground =
411
+ settings.environment.mapAsBackground;
412
+ currentSettings.environment.rotation =
413
+ settings.environment.rotation;
414
+ currentSettings.environment.blurriness =
415
+ settings.environment.blurriness;
416
+ currentSettings.environment.intensity =
417
+ settings.environment.intensity;
349
418
  }
350
419
  }
351
420
  canGoBack() {
@@ -361,7 +430,8 @@ class SessionEngine {
361
430
  this.removeBusyMode(__classPrivateFieldGet(this, _SessionEngine_customizationProcess, "f"));
362
431
  for (const busyId of __classPrivateFieldGet(this, _SessionEngine_customizationBusyModes, "f")) {
363
432
  for (const r in this._stateEngine.viewportEngines) {
364
- if (this._stateEngine.viewportEngines[r] && this._stateEngine.viewportEngines[r].busy.includes(busyId))
433
+ if (this._stateEngine.viewportEngines[r] &&
434
+ this._stateEngine.viewportEngines[r].busy.includes(busyId))
365
435
  this._stateEngine.viewportEngines[r].busy.splice(this._stateEngine.viewportEngines[r].busy.indexOf(busyId), 1);
366
436
  }
367
437
  }
@@ -370,7 +440,7 @@ class SessionEngine {
370
440
  }
371
441
  close(retry = false) {
372
442
  return __awaiter(this, void 0, void 0, function* () {
373
- this.checkAvailability('close');
443
+ this.checkAvailability("close");
374
444
  try {
375
445
  this._httpClient.removeDataLoading(this._sessionId);
376
446
  yield this._sdk.session.close(this._sessionId);
@@ -395,8 +465,10 @@ class SessionEngine {
395
465
  // create a set of the current validated parameter values
396
466
  for (const parameterId in this.parameters) {
397
467
  // if the parameter has not been set, we do not include it in the parameter set if the omitSessionParameterValues flag is set
398
- if (!(omitSessionParameterValues === true && parameterValues[parameterId] === undefined)) {
399
- parameterSet[parameterId] = (' ' + this.parameters[parameterId].stringify(parameterValues[parameterId])).slice(1);
468
+ if (!(omitSessionParameterValues === true &&
469
+ parameterValues[parameterId] === undefined)) {
470
+ parameterSet[parameterId] = (" " +
471
+ this.parameters[parameterId].stringify(parameterValues[parameterId])).slice(1);
400
472
  }
401
473
  }
402
474
  }));
@@ -404,8 +476,7 @@ class SessionEngine {
404
476
  let imageData;
405
477
  let imageArrayBuffer;
406
478
  if (image) {
407
- promises.push(this.processImageInput(image)
408
- .then(result => {
479
+ promises.push(this.processImageInput(image).then((result) => {
409
480
  imageData = result === null || result === void 0 ? void 0 : result.imageData;
410
481
  imageArrayBuffer = result === null || result === void 0 ? void 0 : result.arrayBuffer;
411
482
  }));
@@ -413,9 +484,10 @@ class SessionEngine {
413
484
  // process the arScene input
414
485
  let arSceneId;
415
486
  if (arScene) {
416
- promises.push(this._converter.convertToArrayBuffer(arScene)
417
- .then(arSceneArrayBuffer => this._sdk.gltf.upload(this._sessionId, arSceneArrayBuffer, 'model/gltf-binary', sdk_geometry_api_sdk_v2_1.ShapeDiverRequestGltfUploadQueryConversion.SCENE))
418
- .then(arSceneResponseDto => {
487
+ promises.push(this._converter
488
+ .convertToArrayBuffer(arScene)
489
+ .then((arSceneArrayBuffer) => this._sdk.gltf.upload(this._sessionId, arSceneArrayBuffer, "model/gltf-binary", sdk_geometry_api_sdk_v2_1.ShapeDiverRequestGltfUploadQueryConversion.SCENE))
490
+ .then((arSceneResponseDto) => {
419
491
  var _a;
420
492
  arSceneId = (_a = arSceneResponseDto.gltf) === null || _a === void 0 ? void 0 : _a.sceneId;
421
493
  }));
@@ -427,7 +499,7 @@ class SessionEngine {
427
499
  parameters: parameterSet,
428
500
  data: data,
429
501
  image: imageData,
430
- arSceneId: arSceneId
502
+ arSceneId: arSceneId,
431
503
  });
432
504
  if (imageData && imageArrayBuffer)
433
505
  yield this._sdk.utils.uploadAsset(response.asset.modelState.href, imageArrayBuffer, response.asset.modelState.headers);
@@ -454,18 +526,31 @@ class SessionEngine {
454
526
  if (force === false) {
455
527
  let changes = false;
456
528
  for (const parameterId in this.parameters)
457
- if (this.parameters[parameterId].sessionValue !== this.parameters[parameterId].value)
529
+ if (this.parameters[parameterId].sessionValue !==
530
+ this.parameters[parameterId].value)
458
531
  changes = true;
459
532
  if (changes === false)
460
533
  return this.node;
461
534
  }
462
- const eventStart = { type: viewer_shared_types_1.TASK_TYPE.SESSION_CUSTOMIZATION, id: eventId, progress: 0, data: { sessionId: this.id }, status: 'Customizing session' };
535
+ const eventStart = {
536
+ type: viewer_shared_types_1.TASK_TYPE.SESSION_CUSTOMIZATION,
537
+ id: eventId,
538
+ progress: 0,
539
+ data: { sessionId: this.id },
540
+ status: "Customizing session",
541
+ };
463
542
  this._eventEngine.emitEvent(viewer_shared_services_1.EVENTTYPE.TASK.TASK_START, eventStart);
464
543
  const oldNode = this.node;
465
544
  __classPrivateFieldSet(this, _SessionEngine_customizationProcess, customizationId, "f");
466
545
  this._logger.debugLow(`Session(${this.id}).customize: Customizing session.`);
467
546
  this.addBusyMode(customizationId);
468
- const eventFileUpload = { type: viewer_shared_types_1.TASK_TYPE.SESSION_CUSTOMIZATION, id: eventId, progress: 0.1, data: { sessionId: this.id }, status: 'Uploading file parameters' };
547
+ const eventFileUpload = {
548
+ type: viewer_shared_types_1.TASK_TYPE.SESSION_CUSTOMIZATION,
549
+ id: eventId,
550
+ progress: 0.1,
551
+ data: { sessionId: this.id },
552
+ status: "Uploading file parameters",
553
+ };
469
554
  this._eventEngine.emitEvent(viewer_shared_services_1.EVENTTYPE.TASK.TASK_PROCESS, eventFileUpload);
470
555
  // upload file parameters
471
556
  yield this.uploadFileParameters();
@@ -478,14 +563,21 @@ class SessionEngine {
478
563
  for (const parameterId in this.parameters) {
479
564
  parameterSet[parameterId] = {
480
565
  value: this.parameters[parameterId].value,
481
- valueString: this.parameters[parameterId].stringify()
566
+ valueString: this.parameters[parameterId].stringify(),
482
567
  };
483
568
  }
484
569
  // update the session engine parameter values if everything succeeded
485
570
  for (const parameterId in this.parameters)
486
- this.parameterValues[parameterId] = parameterSet[parameterId].valueString;
571
+ this.parameterValues[parameterId] =
572
+ parameterSet[parameterId].valueString;
487
573
  this._logger.info(`Session(${this.id}).customize: Customizing session with parameters ${JSON.stringify(this.parameterValues)}.`);
488
- const eventRequest = { type: viewer_shared_types_1.TASK_TYPE.SESSION_CUSTOMIZATION, id: eventId, progress: 0.1, data: { sessionId: this.id }, status: 'Sending customization request' };
574
+ const eventRequest = {
575
+ type: viewer_shared_types_1.TASK_TYPE.SESSION_CUSTOMIZATION,
576
+ id: eventId,
577
+ progress: 0.1,
578
+ data: { sessionId: this.id },
579
+ status: "Sending customization request",
580
+ };
489
581
  this._eventEngine.emitEvent(viewer_shared_services_1.EVENTTYPE.TASK.TASK_PROCESS, eventRequest);
490
582
  const oldOutputVersions = this._outputLoader.getCurrentOutputVersions();
491
583
  const newNode = yield this.customizeInternal(() => __classPrivateFieldGet(this, _SessionEngine_customizationProcess, "f") !== customizationId, {
@@ -493,9 +585,9 @@ class SessionEngine {
493
585
  type: viewer_shared_types_1.TASK_TYPE.SESSION_CUSTOMIZATION,
494
586
  progressRange: {
495
587
  min: 0.1,
496
- max: 0.9
588
+ max: 0.9,
497
589
  },
498
- data: { sessionId: this.id }
590
+ data: { sessionId: this.id },
499
591
  });
500
592
  // OPTION TO SKIP - PART 2
501
593
  const cancelResult2 = this.cancelProcess(customizationId, eventId, viewer_shared_types_1.TASK_TYPE.SESSION_CUSTOMIZATION, 1, { sessionId: this.id });
@@ -503,17 +595,24 @@ class SessionEngine {
503
595
  return cancelResult2;
504
596
  this._warningCreator(this._responseDto.outputs, this._responseDto.exports, this._throwOnCustomizationError);
505
597
  const newOutputVersions = this._outputLoader.getCurrentOutputVersions();
506
- const eventSceneUpdate = { type: viewer_shared_types_1.TASK_TYPE.SESSION_CUSTOMIZATION, id: eventId, progress: 0.9, data: { sessionId: this.id }, status: 'Updating scene' };
598
+ const eventSceneUpdate = {
599
+ type: viewer_shared_types_1.TASK_TYPE.SESSION_CUSTOMIZATION,
600
+ id: eventId,
601
+ progress: 0.9,
602
+ data: { sessionId: this.id },
603
+ status: "Updating scene",
604
+ };
507
605
  this._eventEngine.emitEvent(viewer_shared_services_1.EVENTTYPE.TASK.TASK_PROCESS, eventSceneUpdate);
508
606
  // call the update callbacks
509
607
  if (waitForViewportUpdate === false) {
510
608
  for (const outputId in this.outputs) {
511
- if (oldOutputVersions[outputId] !== newOutputVersions[outputId]) {
609
+ if (oldOutputVersions[outputId] !==
610
+ newOutputVersions[outputId]) {
512
611
  this._eventEngine.emitEvent(viewer_shared_services_1.EVENTTYPE.OUTPUT.OUTPUT_UPDATED, {
513
612
  outputId: outputId,
514
613
  outputVersion: newOutputVersions[outputId],
515
- newNode: newNode.children.find(c => c.name === outputId),
516
- oldNode: oldNode.children.find(c => c.name === outputId)
614
+ newNode: newNode.children.find((c) => c.name === outputId),
615
+ oldNode: oldNode.children.find((c) => c.name === outputId),
517
616
  });
518
617
  }
519
618
  }
@@ -535,31 +634,42 @@ class SessionEngine {
535
634
  this._logger.debug(`Session(${this.id}).customize: Customization request finished, updating geometry.`);
536
635
  // set the session values to the current ones in all parameters
537
636
  for (const parameterId in this.parameters)
538
- this.parameters[parameterId].sessionValue = parameterSet[parameterId].value;
637
+ this.parameters[parameterId].sessionValue =
638
+ parameterSet[parameterId].value;
539
639
  // set the output content to what has been updated
540
640
  for (const outputId in this.outputs)
541
- this.outputs[outputId].updateOutput(newNode.children.find(c => c.name === outputId), oldNode.children.find(c => c.name === outputId));
641
+ this.outputs[outputId].updateOutput(newNode.children.find((c) => c.name === outputId), oldNode.children.find((c) => c.name === outputId));
542
642
  // set the export definitions
543
643
  for (const exportId in this.exports)
544
644
  this.exports[exportId].updateExport();
545
645
  this.node.excludeViewports = JSON.parse(JSON.stringify(this._excludeViewports));
546
646
  this.removeBusyMode(customizationId);
547
647
  this._logger.debug(`Session(${this.id}).customize: Session customized.`);
548
- this._eventEngine.emitEvent(viewer_shared_services_1.EVENTTYPE.SESSION.SESSION_CUSTOMIZED, { sessionId: this.id });
549
- const eventEnd = { type: viewer_shared_types_1.TASK_TYPE.SESSION_CUSTOMIZATION, id: eventId, progress: 1, data: { sessionId: this.id }, status: 'Session customized' };
648
+ this._eventEngine.emitEvent(viewer_shared_services_1.EVENTTYPE.SESSION.SESSION_CUSTOMIZED, {
649
+ sessionId: this.id,
650
+ });
651
+ const eventEnd = {
652
+ type: viewer_shared_types_1.TASK_TYPE.SESSION_CUSTOMIZATION,
653
+ id: eventId,
654
+ progress: 1,
655
+ data: { sessionId: this.id },
656
+ status: "Session customized",
657
+ };
550
658
  this._eventEngine.emitEvent(viewer_shared_services_1.EVENTTYPE.TASK.TASK_END, eventEnd);
551
659
  // update the viewports
552
660
  if (waitForViewportUpdate) {
553
661
  for (const r in this._stateEngine.viewportEngines)
554
- if (this._stateEngine.viewportEngines[r] && !this.excludeViewports.includes(this._stateEngine.viewportEngines[r].id))
662
+ if (this._stateEngine.viewportEngines[r] &&
663
+ !this.excludeViewports.includes(this._stateEngine.viewportEngines[r].id))
555
664
  this._stateEngine.viewportEngines[r].update(`SessionEngine(${this.id}).customize`);
556
665
  for (const outputId in this.outputs) {
557
- if (oldOutputVersions[outputId] !== newOutputVersions[outputId]) {
666
+ if (oldOutputVersions[outputId] !==
667
+ newOutputVersions[outputId]) {
558
668
  this._eventEngine.emitEvent(viewer_shared_services_1.EVENTTYPE.OUTPUT.OUTPUT_UPDATED, {
559
669
  outputId: outputId,
560
670
  outputVersion: newOutputVersions[outputId],
561
- newNode: newNode.children.find(c => c.name === outputId),
562
- oldNode: oldNode.children.find(c => c.name === outputId)
671
+ newNode: newNode.children.find((c) => c.name === outputId),
672
+ oldNode: oldNode.children.find((c) => c.name === outputId),
563
673
  });
564
674
  }
565
675
  }
@@ -572,14 +682,21 @@ class SessionEngine {
572
682
  if (!waitForViewportUpdate) {
573
683
  setTimeout(() => {
574
684
  for (const r in this._stateEngine.viewportEngines)
575
- if (this._stateEngine.viewportEngines[r] && !this.excludeViewports.includes(this._stateEngine.viewportEngines[r].id))
685
+ if (this._stateEngine.viewportEngines[r] &&
686
+ !this.excludeViewports.includes(this._stateEngine.viewportEngines[r].id))
576
687
  this._stateEngine.viewportEngines[r].update(`SessionEngine(${this.id}).customize`);
577
688
  }, 0);
578
689
  }
579
690
  return this.node;
580
691
  }
581
692
  catch (e) {
582
- const eventCancel = { type: viewer_shared_types_1.TASK_TYPE.SESSION_CUSTOMIZATION, id: eventId, progress: 1, data: { sessionId: this.id }, status: 'Session customization failed' };
693
+ const eventCancel = {
694
+ type: viewer_shared_types_1.TASK_TYPE.SESSION_CUSTOMIZATION,
695
+ id: eventId,
696
+ progress: 1,
697
+ data: { sessionId: this.id },
698
+ status: "Session customization failed",
699
+ };
583
700
  this._eventEngine.emitEvent(viewer_shared_services_1.EVENTTYPE.TASK.TASK_CANCEL, eventCancel);
584
701
  this.removeBusyMode(customizationId);
585
702
  throw this._httpClient.convertError(e);
@@ -589,26 +706,39 @@ class SessionEngine {
589
706
  customizeParallel(parameterValues, loadOutputs = true) {
590
707
  return __awaiter(this, void 0, void 0, function* () {
591
708
  const eventId = this._uuidGenerator.create();
592
- const eventStart = { type: viewer_shared_types_1.TASK_TYPE.SESSION_CUSTOMIZATION, id: eventId, progress: 0, data: { sessionId: this.id }, status: 'Customizing session' };
709
+ const eventStart = {
710
+ type: viewer_shared_types_1.TASK_TYPE.SESSION_CUSTOMIZATION,
711
+ id: eventId,
712
+ progress: 0,
713
+ data: { sessionId: this.id },
714
+ status: "Customizing session",
715
+ };
593
716
  this._eventEngine.emitEvent(viewer_shared_services_1.EVENTTYPE.TASK.TASK_START, eventStart);
594
717
  // upload file parameters
595
718
  yield this.uploadFileParameters(parameterValues);
596
719
  const parameterSet = {};
597
720
  // create a set of the current validated parameter values
598
721
  for (const parameterId in this.parameters)
599
- parameterSet[parameterId] = (' ' + this.parameters[parameterId].stringify(parameterValues[parameterId])).slice(1);
722
+ parameterSet[parameterId] = (" " +
723
+ this.parameters[parameterId].stringify(parameterValues[parameterId])).slice(1);
600
724
  const result = yield this.customizeSession(parameterSet, () => false, {
601
725
  eventId,
602
726
  type: viewer_shared_types_1.TASK_TYPE.SESSION_CUSTOMIZATION,
603
727
  progressRange: {
604
728
  min: 0.0,
605
- max: 1
729
+ max: 1,
606
730
  },
607
- data: { sessionId: this.id }
731
+ data: { sessionId: this.id },
608
732
  }, true, loadOutputs);
609
733
  if (result instanceof SessionTreeNode_1.SessionTreeNode)
610
734
  result.excludeViewports = JSON.parse(JSON.stringify(this._excludeViewports));
611
- const eventEnd = { type: viewer_shared_types_1.TASK_TYPE.SESSION_CUSTOMIZATION, id: eventId, progress: 1, data: { sessionId: this.id }, status: 'Session customized' };
735
+ const eventEnd = {
736
+ type: viewer_shared_types_1.TASK_TYPE.SESSION_CUSTOMIZATION,
737
+ id: eventId,
738
+ progress: 1,
739
+ data: { sessionId: this.id },
740
+ status: "Session customized",
741
+ };
612
742
  this._eventEngine.emitEvent(viewer_shared_services_1.EVENTTYPE.TASK.TASK_END, eventEnd);
613
743
  return result;
614
744
  });
@@ -619,7 +749,7 @@ class SessionEngine {
619
749
  try {
620
750
  // get the model state if it is not already a response
621
751
  let response;
622
- if (typeof modelState === 'string') {
752
+ if (typeof modelState === "string") {
623
753
  response = yield this._sdk.modelState.get(modelState);
624
754
  }
625
755
  else {
@@ -629,7 +759,8 @@ class SessionEngine {
629
759
  return new viewer_shared_node_tree_1.TreeNode();
630
760
  // read out the parameter values from the model state
631
761
  for (const parameterId in response.modelState.parameters)
632
- this.parameters[parameterId].value = response.modelState.parameters[parameterId];
762
+ this.parameters[parameterId].value =
763
+ response.modelState.parameters[parameterId];
633
764
  return this.customize();
634
765
  }
635
766
  catch (e) {
@@ -661,7 +792,8 @@ class SessionEngine {
661
792
  // adjust the parameters according to the last parameter set
662
793
  const lastParameterSet = __classPrivateFieldGet(this, _SessionEngine_parameterHistory, "f")[__classPrivateFieldGet(this, _SessionEngine_parameterHistory, "f").length - 1];
663
794
  for (const parameterId in lastParameterSet)
664
- this.parameters[parameterId].value = lastParameterSet[parameterId].value;
795
+ this.parameters[parameterId].value =
796
+ lastParameterSet[parameterId].value;
665
797
  // call the customization function with the parameterHistoryCall value set to true
666
798
  __classPrivateFieldSet(this, _SessionEngine_parameterHistoryCall, true, "f");
667
799
  const node = yield this.customize();
@@ -680,7 +812,8 @@ class SessionEngine {
680
812
  // get the last undone parameter set and apply the values to the parameters
681
813
  const lastParameterSet = __classPrivateFieldGet(this, _SessionEngine_parameterHistoryForward, "f").pop();
682
814
  for (const parameterId in lastParameterSet)
683
- this.parameters[parameterId].value = lastParameterSet[parameterId].value;
815
+ this.parameters[parameterId].value =
816
+ lastParameterSet[parameterId].value;
684
817
  // call the customization function with the parameterHistoryCall value set to true
685
818
  __classPrivateFieldSet(this, _SessionEngine_parameterHistoryCall, true, "f");
686
819
  const node = yield this.customize();
@@ -699,13 +832,13 @@ class SessionEngine {
699
832
  var _a, _b;
700
833
  return __awaiter(this, void 0, void 0, function* () {
701
834
  if (this._initialized === true)
702
- throw new viewer_shared_services_1.ShapeDiverViewerSessionError('Session.init: Session already initialized.');
835
+ throw new viewer_shared_services_1.ShapeDiverViewerSessionError("Session.init: Session already initialized.");
703
836
  try {
704
- this._performanceEvaluator.startSection('sessionResponse');
837
+ this._performanceEvaluator.startSection("sessionResponse");
705
838
  const parameterSet = {};
706
839
  // the slice here is done as a way for deep copying the string values
707
840
  for (const parameterNameOrId in parameterValues)
708
- parameterSet[parameterNameOrId] = (' ' + parameterValues[parameterNameOrId]).slice(1);
841
+ parameterSet[parameterNameOrId] = (" " + parameterValues[parameterNameOrId]).slice(1);
709
842
  if (this._ticket) {
710
843
  this._responseDto = yield this._sdk.session.init(this._ticket, parameterSet, this._modelStateId, this._modelStateValidationMode);
711
844
  }
@@ -714,11 +847,12 @@ class SessionEngine {
714
847
  }
715
848
  else {
716
849
  // we should never get here
717
- throw new viewer_shared_services_1.ShapeDiverViewerSessionError('Session.init: Initialization of session failed. Neither a ticket nor a guid are available.');
850
+ throw new viewer_shared_services_1.ShapeDiverViewerSessionError("Session.init: Initialization of session failed. Neither a ticket nor a guid are available.");
718
851
  }
719
- this._performanceEvaluator.endSection('sessionResponse');
852
+ this._performanceEvaluator.endSection("sessionResponse");
720
853
  this._viewerSettings = (_a = this._responseDto.viewer) === null || _a === void 0 ? void 0 : _a.config;
721
- this._viewerSettingsVersionBackend = this._responseDto.viewerSettingsVersion || viewer_settings_1.latestVersion;
854
+ this._viewerSettingsVersionBackend =
855
+ this._responseDto.viewerSettingsVersion || viewer_settings_1.latestVersion;
722
856
  this._sessionId = this._responseDto.sessionId;
723
857
  this._modelId = (_b = this._responseDto.model) === null || _b === void 0 ? void 0 : _b.id;
724
858
  this._modelState = this._responseDto.modelState;
@@ -728,9 +862,9 @@ class SessionEngine {
728
862
  });
729
863
  this._settingsEngine.loadSettings(this._viewerSettings);
730
864
  if (!this._sessionId)
731
- throw new viewer_shared_services_1.ShapeDiverViewerSessionError('Session.init: Initialization of session failed. ResponseDto did not have a sessionId.');
865
+ throw new viewer_shared_services_1.ShapeDiverViewerSessionError("Session.init: Initialization of session failed. ResponseDto did not have a sessionId.");
732
866
  if (!this._modelId)
733
- throw new viewer_shared_services_1.ShapeDiverViewerSessionError('Session.init: Initialization of session failed. ResponseDto did not have a model.id.');
867
+ throw new viewer_shared_services_1.ShapeDiverViewerSessionError("Session.init: Initialization of session failed. ResponseDto did not have a model.id.");
734
868
  this.updateResponseDto(this._responseDto, parameterSet);
735
869
  this._initialized = true;
736
870
  }
@@ -746,22 +880,36 @@ class SessionEngine {
746
880
  this.checkAvailability();
747
881
  // if there is already task event info, use it
748
882
  // this happens after a retry
749
- const eventId = taskEventInfo ? taskEventInfo.eventId : this._uuidGenerator.create();
750
- const eventType = taskEventInfo ? taskEventInfo.type : viewer_shared_types_1.TASK_TYPE.SESSION_OUTPUTS_LOADING;
751
- const eventData = taskEventInfo ? taskEventInfo.data : { sessionId: this.id };
752
- taskEventInfo = taskEventInfo ? taskEventInfo : {
753
- eventId,
754
- type: eventType,
755
- progressRange: {
756
- min: 0,
757
- max: 1
758
- },
759
- data: eventData
760
- };
883
+ const eventId = taskEventInfo
884
+ ? taskEventInfo.eventId
885
+ : this._uuidGenerator.create();
886
+ const eventType = taskEventInfo
887
+ ? taskEventInfo.type
888
+ : viewer_shared_types_1.TASK_TYPE.SESSION_OUTPUTS_LOADING;
889
+ const eventData = taskEventInfo
890
+ ? taskEventInfo.data
891
+ : { sessionId: this.id };
892
+ taskEventInfo = taskEventInfo
893
+ ? taskEventInfo
894
+ : {
895
+ eventId,
896
+ type: eventType,
897
+ progressRange: {
898
+ min: 0,
899
+ max: 1,
900
+ },
901
+ data: eventData,
902
+ };
761
903
  try {
762
904
  // send start event if this function was called initially
763
905
  if (!taskEventInfo) {
764
- const eventStart = { type: eventType, id: eventId, progress: 0, data: eventData, status: 'Loading cached outputs' };
906
+ const eventStart = {
907
+ type: eventType,
908
+ id: eventId,
909
+ progress: 0,
910
+ data: eventData,
911
+ status: "Loading cached outputs",
912
+ };
765
913
  this._eventEngine.emitEvent(viewer_shared_services_1.EVENTTYPE.TASK.TASK_START, eventStart);
766
914
  }
767
915
  // get the cached outputs
@@ -773,14 +921,20 @@ class SessionEngine {
773
921
  outputs[outputId] = new Output_1.Output(responseDto.outputs[outputId], this);
774
922
  }
775
923
  // process the output data
776
- const node = yield this._outputLoader.loadOutputs(((_a = this._responseDto.model) === null || _a === void 0 ? void 0 : _a.name) || 'model', outputs, {}, taskEventInfo, false);
924
+ const node = yield this._outputLoader.loadOutputs(((_a = this._responseDto.model) === null || _a === void 0 ? void 0 : _a.name) || "model", outputs, {}, taskEventInfo, false);
777
925
  // send the end event once done
778
- const eventEnd = { type: eventType, id: eventId, progress: 1, data: eventData, status: 'Loaded cached outputs' };
926
+ const eventEnd = {
927
+ type: eventType,
928
+ id: eventId,
929
+ progress: 1,
930
+ data: eventData,
931
+ status: "Loaded cached outputs",
932
+ };
779
933
  this._eventEngine.emitEvent(viewer_shared_services_1.EVENTTYPE.TASK.TASK_END, eventEnd);
780
934
  // create a mapping with a dictionary for the id of the outputs
781
935
  const outputNodeMapping = {};
782
936
  for (const outputId in outputMapping)
783
- outputNodeMapping[outputId] = node.children.find(n => n.name === outputId);
937
+ outputNodeMapping[outputId] = node.children.find((n) => n.name === outputId);
784
938
  return outputNodeMapping;
785
939
  }
786
940
  catch (e) {
@@ -804,7 +958,7 @@ class SessionEngine {
804
958
  const o = Object.assign({}, this._outputs);
805
959
  const of = Object.assign({}, this._outputsFreeze);
806
960
  try {
807
- const node = yield this._outputLoader.loadOutputs(((_a = this._responseDto.model) === null || _a === void 0 ? void 0 : _a.name) || 'model', o, of, taskEventInfo);
961
+ const node = yield this._outputLoader.loadOutputs(((_a = this._responseDto.model) === null || _a === void 0 ? void 0 : _a.name) || "model", o, of, taskEventInfo);
808
962
  node.data.push(new SessionData_1.SessionData(this._responseDto));
809
963
  if (cancelRequest())
810
964
  return node;
@@ -863,7 +1017,7 @@ class SessionEngine {
863
1017
  outputs[outputId] = new Output_1.Output(responseDto.outputs[outputId], this);
864
1018
  }
865
1019
  try {
866
- const node = yield this._outputLoader.loadOutputs(((_a = this._responseDto.model) === null || _a === void 0 ? void 0 : _a.name) || 'model', outputs, outputsFreeze, taskEventInfo);
1020
+ const node = yield this._outputLoader.loadOutputs(((_a = this._responseDto.model) === null || _a === void 0 ? void 0 : _a.name) || "model", outputs, outputsFreeze, taskEventInfo);
867
1021
  node.data.push(new SessionData_1.SessionData(responseDto));
868
1022
  return node;
869
1023
  }
@@ -900,7 +1054,7 @@ class SessionEngine {
900
1054
  }
901
1055
  requestExport(exportId, parameters, maxWaitTime, retry = false) {
902
1056
  return __awaiter(this, void 0, void 0, function* () {
903
- this.checkAvailability('export');
1057
+ this.checkAvailability("export");
904
1058
  try {
905
1059
  yield this.uploadFileParameters(parameters);
906
1060
  const requestParameterSet = this.cleanExportParameters(parameters);
@@ -920,29 +1074,54 @@ class SessionEngine {
920
1074
  const eventId = this._uuidGenerator.create();
921
1075
  // if the outputs are loaded, we treat this as a customization by sending the same events
922
1076
  const treatInternallyAsCustomization = loadOutputs === true && this._allowOutputLoading === true;
923
- this.checkAvailability('export');
1077
+ this.checkAvailability("export");
924
1078
  try {
925
1079
  if (treatInternallyAsCustomization) {
926
- const eventStart = { type: viewer_shared_types_1.TASK_TYPE.SESSION_CUSTOMIZATION, id: eventId, progress: 0, data: { sessionId: this.id }, status: 'Customizing session' };
1080
+ const eventStart = {
1081
+ type: viewer_shared_types_1.TASK_TYPE.SESSION_CUSTOMIZATION,
1082
+ id: eventId,
1083
+ progress: 0,
1084
+ data: { sessionId: this.id },
1085
+ status: "Customizing session",
1086
+ };
927
1087
  this._eventEngine.emitEvent(viewer_shared_services_1.EVENTTYPE.TASK.TASK_START, eventStart);
928
1088
  }
929
1089
  // activate the busy mode if outputs are loaded
930
- if (loadOutputs === true && this._allowOutputLoading === true &&
931
- body.outputs && Object.keys(body.outputs).length > 0) {
1090
+ if (loadOutputs === true &&
1091
+ this._allowOutputLoading === true &&
1092
+ body.outputs &&
1093
+ Object.keys(body.outputs).length > 0) {
932
1094
  processId = this._uuidGenerator.create();
933
1095
  this.addBusyMode(processId);
934
1096
  }
935
1097
  if (treatInternallyAsCustomization) {
936
- const eventFileUpload = { type: viewer_shared_types_1.TASK_TYPE.SESSION_CUSTOMIZATION, id: eventId, progress: 0.1, data: { sessionId: this.id }, status: 'Uploading file parameters' };
1098
+ const eventFileUpload = {
1099
+ type: viewer_shared_types_1.TASK_TYPE.SESSION_CUSTOMIZATION,
1100
+ id: eventId,
1101
+ progress: 0.1,
1102
+ data: { sessionId: this.id },
1103
+ status: "Uploading file parameters",
1104
+ };
937
1105
  this._eventEngine.emitEvent(viewer_shared_services_1.EVENTTYPE.TASK.TASK_PROCESS, eventFileUpload);
938
1106
  }
939
1107
  yield this.uploadFileParameters(body.parameters);
940
1108
  const requestParameterSet = this.cleanExportParameters(body.parameters);
941
1109
  if (treatInternallyAsCustomization) {
942
- const eventRequest = { type: viewer_shared_types_1.TASK_TYPE.SESSION_CUSTOMIZATION, id: eventId, progress: 0.1, data: { sessionId: this.id }, status: 'Sending customization request' };
1110
+ const eventRequest = {
1111
+ type: viewer_shared_types_1.TASK_TYPE.SESSION_CUSTOMIZATION,
1112
+ id: eventId,
1113
+ progress: 0.1,
1114
+ data: { sessionId: this.id },
1115
+ status: "Sending customization request",
1116
+ };
943
1117
  this._eventEngine.emitEvent(viewer_shared_services_1.EVENTTYPE.TASK.TASK_PROCESS, eventRequest);
944
1118
  }
945
- const responseDto = yield this._sdk.utils.submitAndWaitForExport(this._sdk, this._sessionId, { exports: body.exports, parameters: requestParameterSet, outputs: body.outputs, max_wait_time: body.max_wait_time }, maxWaitMsec);
1119
+ const responseDto = yield this._sdk.utils.submitAndWaitForExport(this._sdk, this._sessionId, {
1120
+ exports: body.exports,
1121
+ parameters: requestParameterSet,
1122
+ outputs: body.outputs,
1123
+ max_wait_time: body.max_wait_time,
1124
+ }, maxWaitMsec);
946
1125
  this.updateResponseDto(responseDto);
947
1126
  if (treatInternallyAsCustomization) {
948
1127
  yield this.updateOutputs({
@@ -950,12 +1129,18 @@ class SessionEngine {
950
1129
  type: viewer_shared_types_1.TASK_TYPE.SESSION_CUSTOMIZATION,
951
1130
  progressRange: {
952
1131
  min: 0.1,
953
- max: 0.9
1132
+ max: 0.9,
954
1133
  },
955
- data: { sessionId: this.id }
1134
+ data: { sessionId: this.id },
956
1135
  });
957
1136
  this._eventEngine.emitEvent(viewer_shared_services_1.EVENTTYPE.SESSION.SESSION_CUSTOMIZED, { sessionId: this.id });
958
- const eventEnd = { type: viewer_shared_types_1.TASK_TYPE.SESSION_CUSTOMIZATION, id: eventId, progress: 1, data: { sessionId: this.id }, status: 'Session customized' };
1137
+ const eventEnd = {
1138
+ type: viewer_shared_types_1.TASK_TYPE.SESSION_CUSTOMIZATION,
1139
+ id: eventId,
1140
+ progress: 1,
1141
+ data: { sessionId: this.id },
1142
+ status: "Session customized",
1143
+ };
959
1144
  this._eventEngine.emitEvent(viewer_shared_services_1.EVENTTYPE.TASK.TASK_END, eventEnd);
960
1145
  }
961
1146
  if (processId)
@@ -964,7 +1149,13 @@ class SessionEngine {
964
1149
  }
965
1150
  catch (e) {
966
1151
  if (treatInternallyAsCustomization) {
967
- const eventCancel = { type: viewer_shared_types_1.TASK_TYPE.SESSION_CUSTOMIZATION, id: eventId, progress: 1, data: { sessionId: this.id }, status: 'Session customization failed' };
1152
+ const eventCancel = {
1153
+ type: viewer_shared_types_1.TASK_TYPE.SESSION_CUSTOMIZATION,
1154
+ id: eventId,
1155
+ progress: 1,
1156
+ data: { sessionId: this.id },
1157
+ status: "Session customization failed",
1158
+ };
968
1159
  this._eventEngine.emitEvent(viewer_shared_services_1.EVENTTYPE.TASK.TASK_CANCEL, eventCancel);
969
1160
  }
970
1161
  if (processId)
@@ -976,20 +1167,37 @@ class SessionEngine {
976
1167
  }
977
1168
  resetSettings(sections) {
978
1169
  if (!this._responseDto)
979
- throw new viewer_shared_services_1.ShapeDiverViewerSessionError('Session.resetSettings: responseDto not available.');
1170
+ throw new viewer_shared_services_1.ShapeDiverViewerSessionError("Session.resetSettings: responseDto not available.");
980
1171
  sections = sections || {};
981
1172
  if (sections.session === undefined) {
982
1173
  sections.session = {
983
1174
  parameter: { displayname: true, order: true, hidden: true },
984
- export: { displayname: true, order: true, hidden: true }
1175
+ export: { displayname: true, order: true, hidden: true },
985
1176
  };
986
1177
  }
987
1178
  if (sections.session.parameter === undefined)
988
- sections.session.parameter = { displayname: true, order: true, hidden: true, value: true };
1179
+ sections.session.parameter = {
1180
+ displayname: true,
1181
+ order: true,
1182
+ hidden: true,
1183
+ value: true,
1184
+ };
989
1185
  if (sections.session.export === undefined)
990
- sections.session.export = { displayname: true, order: true, hidden: true };
1186
+ sections.session.export = {
1187
+ displayname: true,
1188
+ order: true,
1189
+ hidden: true,
1190
+ };
991
1191
  if (sections.viewport === undefined)
992
- sections.viewport = { ar: true, scene: true, camera: true, light: true, environment: true, general: true, postprocessing: true };
1192
+ sections.viewport = {
1193
+ ar: true,
1194
+ scene: true,
1195
+ camera: true,
1196
+ light: true,
1197
+ environment: true,
1198
+ general: true,
1199
+ postprocessing: true,
1200
+ };
993
1201
  return this.applySettings(this._responseDto, sections);
994
1202
  }
995
1203
  saveDefaultParameterValues() {
@@ -1007,7 +1215,7 @@ class SessionEngine {
1007
1215
  }
1008
1216
  saveDefaultParameters(retry = false) {
1009
1217
  return __awaiter(this, void 0, void 0, function* () {
1010
- this.checkAvailability('defaultparam', true);
1218
+ this.checkAvailability("defaultparam", true);
1011
1219
  try {
1012
1220
  yield this._sdk.model.setDefaultParams(this._modelId, this._parameterValues);
1013
1221
  return true;
@@ -1026,7 +1234,7 @@ class SessionEngine {
1026
1234
  */
1027
1235
  saveExportProperties(exports, retry = false) {
1028
1236
  return __awaiter(this, void 0, void 0, function* () {
1029
- this.checkAvailability('export-definition', true);
1237
+ this.checkAvailability("export-definition", true);
1030
1238
  try {
1031
1239
  yield this._sdk.export.updateDefinitions(this._modelId, exports);
1032
1240
  return true;
@@ -1045,7 +1253,7 @@ class SessionEngine {
1045
1253
  */
1046
1254
  saveOutputProperties(outputs, retry = false) {
1047
1255
  return __awaiter(this, void 0, void 0, function* () {
1048
- this.checkAvailability('output-definition', true);
1256
+ this.checkAvailability("output-definition", true);
1049
1257
  try {
1050
1258
  yield this._sdk.output.updateDefinitions(this._modelId, outputs);
1051
1259
  return true;
@@ -1064,7 +1272,7 @@ class SessionEngine {
1064
1272
  */
1065
1273
  saveParameterProperties(parameters, retry = false) {
1066
1274
  return __awaiter(this, void 0, void 0, function* () {
1067
- this.checkAvailability('parameter-definition', true);
1275
+ this.checkAvailability("parameter-definition", true);
1068
1276
  try {
1069
1277
  yield this._sdk.model.updateParameterDefinitions(this._modelId, parameters);
1070
1278
  return true;
@@ -1077,16 +1285,18 @@ class SessionEngine {
1077
1285
  }
1078
1286
  saveSettings(json, retry = false) {
1079
1287
  return __awaiter(this, void 0, void 0, function* () {
1080
- this.checkAvailability('configure', true);
1288
+ this.checkAvailability("configure", true);
1081
1289
  try {
1082
1290
  (0, viewer_settings_1.validate)(json, this._viewerSettingsVersion);
1083
1291
  // if viewer settings version is higher than backend settings version
1084
1292
  // convert to backend settings version
1085
- if (+this._viewerSettingsVersion > +this._viewerSettingsVersionBackend)
1293
+ if (+this._viewerSettingsVersion >
1294
+ +this._viewerSettingsVersionBackend)
1086
1295
  json = (0, viewer_settings_1.convert)(json, this._viewerSettingsVersionBackend);
1087
1296
  }
1088
1297
  catch (e) {
1089
- throw new viewer_shared_services_1.ShapeDiverViewerSettingsError('Session.saveSettings: Settings could not be validated. ' + e.message, e);
1298
+ throw new viewer_shared_services_1.ShapeDiverViewerSettingsError("Session.saveSettings: Settings could not be validated. " +
1299
+ e.message, e);
1090
1300
  }
1091
1301
  try {
1092
1302
  yield this._sdk.model.updateConfig(this._modelId, json);
@@ -1101,40 +1311,72 @@ class SessionEngine {
1101
1311
  saveUiProperties(saveInSettings = true) {
1102
1312
  return __awaiter(this, void 0, void 0, function* () {
1103
1313
  this._logger.debugLow(`Session(${this.id}).saveSessionProperties: Saving session properties.`);
1104
- // settings saving
1314
+ // settings saving
1105
1315
  this._saveSessionSettings();
1106
1316
  let properties = {};
1107
1317
  for (const p in this.parameters) {
1108
1318
  properties[p] = {
1109
- displayname: this.parameters[p].displayname !== undefined ? this.parameters[p].displayname : '',
1110
- hidden: this.parameters[p].hidden !== undefined ? this.parameters[p].hidden : false,
1111
- order: this.parameters[p].order !== undefined ? this.parameters[p].order : 0,
1112
- tooltip: this.parameters[p].tooltip !== undefined ? this.parameters[p].tooltip : '',
1319
+ displayname: this.parameters[p].displayname !== undefined
1320
+ ? this.parameters[p].displayname
1321
+ : "",
1322
+ hidden: this.parameters[p].hidden !== undefined
1323
+ ? this.parameters[p].hidden
1324
+ : false,
1325
+ order: this.parameters[p].order !== undefined
1326
+ ? this.parameters[p].order
1327
+ : 0,
1328
+ tooltip: this.parameters[p].tooltip !== undefined
1329
+ ? this.parameters[p].tooltip
1330
+ : "",
1113
1331
  };
1114
1332
  }
1115
- const responseP = Object.values(properties).length !== 0 ? yield this.saveParameterProperties(properties) : true;
1333
+ const responseP = Object.values(properties).length !== 0
1334
+ ? yield this.saveParameterProperties(properties)
1335
+ : true;
1116
1336
  properties = {};
1117
1337
  for (const e in this.exports) {
1118
1338
  properties[e] = {
1119
- displayname: this.exports[e].displayname !== undefined ? this.exports[e].displayname : '',
1120
- hidden: this.exports[e].hidden !== undefined ? this.exports[e].hidden : false,
1121
- order: this.exports[e].order !== undefined ? this.exports[e].order : 0,
1122
- tooltip: this.exports[e].tooltip !== undefined ? this.exports[e].tooltip : '',
1339
+ displayname: this.exports[e].displayname !== undefined
1340
+ ? this.exports[e].displayname
1341
+ : "",
1342
+ hidden: this.exports[e].hidden !== undefined
1343
+ ? this.exports[e].hidden
1344
+ : false,
1345
+ order: this.exports[e].order !== undefined
1346
+ ? this.exports[e].order
1347
+ : 0,
1348
+ tooltip: this.exports[e].tooltip !== undefined
1349
+ ? this.exports[e].tooltip
1350
+ : "",
1123
1351
  };
1124
1352
  }
1125
- const responseE = Object.values(properties).length !== 0 ? yield this.saveExportProperties(properties) : true;
1353
+ const responseE = Object.values(properties).length !== 0
1354
+ ? yield this.saveExportProperties(properties)
1355
+ : true;
1126
1356
  properties = {};
1127
1357
  for (const o in this.outputs) {
1128
1358
  properties[o] = {
1129
- displayname: this.outputs[o].displayname !== undefined ? this.outputs[o].displayname : '',
1130
- hidden: this.outputs[o].hidden !== undefined ? this.outputs[o].hidden : false,
1131
- order: this.outputs[o].order !== undefined ? this.outputs[o].order : 0,
1132
- tooltip: this.outputs[o].tooltip !== undefined ? this.outputs[o].tooltip : '',
1359
+ displayname: this.outputs[o].displayname !== undefined
1360
+ ? this.outputs[o].displayname
1361
+ : "",
1362
+ hidden: this.outputs[o].hidden !== undefined
1363
+ ? this.outputs[o].hidden
1364
+ : false,
1365
+ order: this.outputs[o].order !== undefined
1366
+ ? this.outputs[o].order
1367
+ : 0,
1368
+ tooltip: this.outputs[o].tooltip !== undefined
1369
+ ? this.outputs[o].tooltip
1370
+ : "",
1133
1371
  };
1134
1372
  }
1135
- const responseO = Object.values(properties).length !== 0 ? yield this.saveOutputProperties(properties) : true;
1373
+ const responseO = Object.values(properties).length !== 0
1374
+ ? yield this.saveOutputProperties(properties)
1375
+ : true;
1136
1376
  // save partial settings
1137
- const response = saveInSettings ? yield this.saveSettings(this._settingsEngine.settings) : true;
1377
+ const response = saveInSettings
1378
+ ? yield this.saveSettings(this._settingsEngine.settings)
1379
+ : true;
1138
1380
  if (response && responseP && responseO && responseE) {
1139
1381
  this._logger.debug(`Session(${this.id}).saveSessionProperties: Saved session properties.`);
1140
1382
  }
@@ -1162,11 +1404,23 @@ class SessionEngine {
1162
1404
  }
1163
1405
  updateOutputs(taskEventInfo, waitForViewportUpdate = false) {
1164
1406
  return __awaiter(this, void 0, void 0, function* () {
1165
- const eventId = taskEventInfo ? taskEventInfo.eventId : this._uuidGenerator.create();
1166
- const eventType = taskEventInfo ? taskEventInfo.type : viewer_shared_types_1.TASK_TYPE.SESSION_OUTPUTS_UPDATE;
1167
- const eventData = taskEventInfo ? taskEventInfo.data : { sessionId: this.id };
1407
+ const eventId = taskEventInfo
1408
+ ? taskEventInfo.eventId
1409
+ : this._uuidGenerator.create();
1410
+ const eventType = taskEventInfo
1411
+ ? taskEventInfo.type
1412
+ : viewer_shared_types_1.TASK_TYPE.SESSION_OUTPUTS_UPDATE;
1413
+ const eventData = taskEventInfo
1414
+ ? taskEventInfo.data
1415
+ : { sessionId: this.id };
1168
1416
  if (!taskEventInfo) {
1169
- const eventStart = { type: eventType, id: eventId, progress: 0, data: eventData, status: 'Updating outputs' };
1417
+ const eventStart = {
1418
+ type: eventType,
1419
+ id: eventId,
1420
+ progress: 0,
1421
+ data: eventData,
1422
+ status: "Updating outputs",
1423
+ };
1170
1424
  this._eventEngine.emitEvent(viewer_shared_services_1.EVENTTYPE.TASK.TASK_START, eventStart);
1171
1425
  }
1172
1426
  const customizationId = this._uuidGenerator.create();
@@ -1174,24 +1428,61 @@ class SessionEngine {
1174
1428
  __classPrivateFieldSet(this, _SessionEngine_customizationProcess, customizationId, "f");
1175
1429
  this._logger.debugLow(`Session(${this.id}).updateOutputs: Updating Outputs.`);
1176
1430
  this.addBusyMode(customizationId);
1177
- const eventRequest = { type: eventType, id: eventId, progress: taskEventInfo ? (taskEventInfo.progressRange.max - taskEventInfo.progressRange.min) * 0.1 + taskEventInfo.progressRange.min : 0.1, data: eventData, status: 'Loading outputs' };
1431
+ const eventRequest = {
1432
+ type: eventType,
1433
+ id: eventId,
1434
+ progress: taskEventInfo
1435
+ ? (taskEventInfo.progressRange.max -
1436
+ taskEventInfo.progressRange.min) *
1437
+ 0.1 +
1438
+ taskEventInfo.progressRange.min
1439
+ : 0.1,
1440
+ data: eventData,
1441
+ status: "Loading outputs",
1442
+ };
1178
1443
  this._eventEngine.emitEvent(viewer_shared_services_1.EVENTTYPE.TASK.TASK_PROCESS, eventRequest);
1179
1444
  const oldOutputVersions = this._outputLoader.getCurrentOutputVersions();
1180
1445
  const newNode = yield this.loadOutputs(() => __classPrivateFieldGet(this, _SessionEngine_customizationProcess, "f") !== customizationId, {
1181
1446
  eventId,
1182
1447
  type: eventType,
1183
1448
  progressRange: {
1184
- min: taskEventInfo ? (taskEventInfo.progressRange.max - taskEventInfo.progressRange.min) * 0.1 + taskEventInfo.progressRange.min : 0.1,
1185
- max: taskEventInfo ? (taskEventInfo.progressRange.max - taskEventInfo.progressRange.min) * 0.9 + taskEventInfo.progressRange.min : 0.9
1449
+ min: taskEventInfo
1450
+ ? (taskEventInfo.progressRange.max -
1451
+ taskEventInfo.progressRange.min) *
1452
+ 0.1 +
1453
+ taskEventInfo.progressRange.min
1454
+ : 0.1,
1455
+ max: taskEventInfo
1456
+ ? (taskEventInfo.progressRange.max -
1457
+ taskEventInfo.progressRange.min) *
1458
+ 0.9 +
1459
+ taskEventInfo.progressRange.min
1460
+ : 0.9,
1186
1461
  },
1187
- data: eventData
1462
+ data: eventData,
1188
1463
  });
1189
1464
  this._warningCreator(this._responseDto.outputs, this._responseDto.exports, this._throwOnCustomizationError);
1190
1465
  const newOutputVersions = this._outputLoader.getCurrentOutputVersions();
1191
- const eventSceneUpdate = { type: eventType, id: eventId, progress: taskEventInfo ? (taskEventInfo.progressRange.max - taskEventInfo.progressRange.min) * 0.9 + taskEventInfo.progressRange.min : 0.9, data: eventData, status: 'Updating scene' };
1466
+ const eventSceneUpdate = {
1467
+ type: eventType,
1468
+ id: eventId,
1469
+ progress: taskEventInfo
1470
+ ? (taskEventInfo.progressRange.max -
1471
+ taskEventInfo.progressRange.min) *
1472
+ 0.9 +
1473
+ taskEventInfo.progressRange.min
1474
+ : 0.9,
1475
+ data: eventData,
1476
+ status: "Updating scene",
1477
+ };
1192
1478
  this._eventEngine.emitEvent(viewer_shared_services_1.EVENTTYPE.TASK.TASK_PROCESS, eventSceneUpdate);
1193
1479
  // OPTION TO SKIP - PART 1
1194
- const cancelResult = this.cancelProcess(customizationId, eventId, eventType, taskEventInfo ? (taskEventInfo.progressRange.max - taskEventInfo.progressRange.min) * 1 + taskEventInfo.progressRange.min : 1, eventData, newNode);
1480
+ const cancelResult = this.cancelProcess(customizationId, eventId, eventType, taskEventInfo
1481
+ ? (taskEventInfo.progressRange.max -
1482
+ taskEventInfo.progressRange.min) *
1483
+ 1 +
1484
+ taskEventInfo.progressRange.min
1485
+ : 1, eventData, newNode);
1195
1486
  if (cancelResult)
1196
1487
  return cancelResult;
1197
1488
  // call the update callbacks
@@ -1201,14 +1492,19 @@ class SessionEngine {
1201
1492
  this._eventEngine.emitEvent(viewer_shared_services_1.EVENTTYPE.OUTPUT.OUTPUT_UPDATED, {
1202
1493
  outputId: outputId,
1203
1494
  outputVersion: newOutputVersions[outputId],
1204
- newNode: newNode.children.find(c => c.name === outputId),
1205
- oldNode: oldNode.children.find(c => c.name === outputId)
1495
+ newNode: newNode.children.find((c) => c.name === outputId),
1496
+ oldNode: oldNode.children.find((c) => c.name === outputId),
1206
1497
  });
1207
1498
  }
1208
1499
  }
1209
1500
  yield this.waitForUpdateCallbacks(newOutputVersions, oldOutputVersions, newNode, oldNode);
1210
1501
  // OPTION TO SKIP - PART 2
1211
- const cancelResult = this.cancelProcess(customizationId, eventId, eventType, taskEventInfo ? (taskEventInfo.progressRange.max - taskEventInfo.progressRange.min) * 1 + taskEventInfo.progressRange.min : 1, eventData, newNode);
1502
+ const cancelResult = this.cancelProcess(customizationId, eventId, eventType, taskEventInfo
1503
+ ? (taskEventInfo.progressRange.max -
1504
+ taskEventInfo.progressRange.min) *
1505
+ 1 +
1506
+ taskEventInfo.progressRange.min
1507
+ : 1, eventData, newNode);
1212
1508
  if (cancelResult)
1213
1509
  return cancelResult;
1214
1510
  }
@@ -1220,7 +1516,7 @@ class SessionEngine {
1220
1516
  this._logger.debug(`Session(${this.id}).updateOutputs: Updating outputs finished, updating geometry.`);
1221
1517
  // set the output content to what has been updated
1222
1518
  for (const outputId in this.outputs) {
1223
- this.outputs[outputId].updateOutput(newNode.children.find(c => c.name === outputId), oldNode.children.find(c => c.name === outputId));
1519
+ this.outputs[outputId].updateOutput(newNode.children.find((c) => c.name === outputId), oldNode.children.find((c) => c.name === outputId));
1224
1520
  }
1225
1521
  // set the export definitions
1226
1522
  for (const exportId in this.exports)
@@ -1229,27 +1525,39 @@ class SessionEngine {
1229
1525
  this.removeBusyMode(customizationId);
1230
1526
  this._logger.debug(`Session(${this.id}).updateOutputs: Updated outputs.`);
1231
1527
  if (!taskEventInfo) {
1232
- const eventEnd = { type: eventType, id: eventId, progress: 1, data: eventData, status: 'Outputs updated' };
1528
+ const eventEnd = {
1529
+ type: eventType,
1530
+ id: eventId,
1531
+ progress: 1,
1532
+ data: eventData,
1533
+ status: "Outputs updated",
1534
+ };
1233
1535
  this._eventEngine.emitEvent(viewer_shared_services_1.EVENTTYPE.TASK.TASK_END, eventEnd);
1234
1536
  }
1235
1537
  // update the viewports
1236
1538
  if (waitForViewportUpdate) {
1237
1539
  for (const r in this._stateEngine.viewportEngines)
1238
- if (this._stateEngine.viewportEngines[r] && !this.excludeViewports.includes(this._stateEngine.viewportEngines[r].id))
1540
+ if (this._stateEngine.viewportEngines[r] &&
1541
+ !this.excludeViewports.includes(this._stateEngine.viewportEngines[r].id))
1239
1542
  this._stateEngine.viewportEngines[r].update(`SessionEngine(${this.id}).updateOutputs`);
1240
1543
  for (const outputId in this.outputs) {
1241
1544
  if (oldOutputVersions[outputId] !== newOutputVersions[outputId]) {
1242
1545
  this._eventEngine.emitEvent(viewer_shared_services_1.EVENTTYPE.OUTPUT.OUTPUT_UPDATED, {
1243
1546
  outputId: outputId,
1244
1547
  outputVersion: newOutputVersions[outputId],
1245
- newNode: newNode.children.find(c => c.name === outputId),
1246
- oldNode: oldNode.children.find(c => c.name === outputId)
1548
+ newNode: newNode.children.find((c) => c.name === outputId),
1549
+ oldNode: oldNode.children.find((c) => c.name === outputId),
1247
1550
  });
1248
1551
  }
1249
1552
  }
1250
1553
  yield this.waitForUpdateCallbacks(newOutputVersions, oldOutputVersions, newNode, oldNode);
1251
1554
  // OPTION TO SKIP - PART 3
1252
- const cancelResult = this.cancelProcess(customizationId, eventId, eventType, taskEventInfo ? (taskEventInfo.progressRange.max - taskEventInfo.progressRange.min) * 1 + taskEventInfo.progressRange.min : 1, eventData, newNode);
1555
+ const cancelResult = this.cancelProcess(customizationId, eventId, eventType, taskEventInfo
1556
+ ? (taskEventInfo.progressRange.max -
1557
+ taskEventInfo.progressRange.min) *
1558
+ 1 +
1559
+ taskEventInfo.progressRange.min
1560
+ : 1, eventData, newNode);
1253
1561
  if (cancelResult)
1254
1562
  return cancelResult;
1255
1563
  }
@@ -1258,22 +1566,25 @@ class SessionEngine {
1258
1566
  }
1259
1567
  uploadFile(parameterId, data, type, retry = false) {
1260
1568
  return __awaiter(this, void 0, void 0, function* () {
1261
- this.checkAvailability('file-upload');
1569
+ this.checkAvailability("file-upload");
1262
1570
  try {
1263
1571
  const result = yield this._sdk.file.requestUpload(this._sessionId, {
1264
1572
  [parameterId]: {
1265
1573
  size: data.size,
1266
1574
  format: type,
1267
- filename: data.name === '' ? undefined : data.name
1268
- }
1575
+ filename: data.name === "" ? undefined : data.name,
1576
+ },
1269
1577
  });
1270
- if (result && result.asset && result.asset.file && result.asset.file[parameterId]) {
1578
+ if (result &&
1579
+ result.asset &&
1580
+ result.asset.file &&
1581
+ result.asset.file[parameterId]) {
1271
1582
  const fileAsset = result.asset.file[parameterId];
1272
1583
  yield this._sdk.utils.uploadAsset(fileAsset.href, yield data.arrayBuffer(), fileAsset.headers);
1273
1584
  return fileAsset.id;
1274
1585
  }
1275
1586
  else {
1276
- throw new viewer_shared_services_1.ShapeDiverViewerSessionError('Session.uploadFile: Upload reply has not the required format.');
1587
+ throw new viewer_shared_services_1.ShapeDiverViewerSessionError("Session.uploadFile: Upload reply has not the required format.");
1277
1588
  }
1278
1589
  }
1279
1590
  catch (e) {
@@ -1291,20 +1602,30 @@ class SessionEngine {
1291
1602
  */
1292
1603
  uploadFileParameters(parameterValues) {
1293
1604
  return __awaiter(this, void 0, void 0, function* () {
1294
- const parameterValueSet = parameterValues !== undefined ? this.getFileParameterSet(parameterValues) : undefined;
1605
+ const parameterValueSet = parameterValues !== undefined
1606
+ ? this.getFileParameterSet(parameterValues)
1607
+ : undefined;
1295
1608
  const fileParameterValues = {};
1296
1609
  // load file parameter first
1297
1610
  for (const parameterId in this.parameters) {
1298
1611
  if (this.parameters[parameterId] instanceof FileParameter_1.FileParameter) {
1299
- fileParameterValues[parameterId] = yield this.parameters[parameterId].upload(parameterValueSet ? parameterValueSet[parameterId] : undefined);
1612
+ fileParameterValues[parameterId] = yield (this.parameters[parameterId]).upload(parameterValueSet
1613
+ ? parameterValueSet[parameterId]
1614
+ : undefined);
1300
1615
  if (parameterValues) {
1301
- parameterValues[parameterId] = fileParameterValues[parameterId];
1616
+ parameterValues[parameterId] =
1617
+ fileParameterValues[parameterId];
1302
1618
  // if the parameter value of the file parameter was used, set the value to the parameter
1303
- if (parameterValues[parameterId] === undefined && this.parameters[parameterId].value !== fileParameterValues[parameterId])
1304
- this.parameters[parameterId].value = fileParameterValues[parameterId];
1619
+ if (parameterValues[parameterId] === undefined &&
1620
+ this.parameters[parameterId].value !==
1621
+ fileParameterValues[parameterId])
1622
+ this.parameters[parameterId].value =
1623
+ fileParameterValues[parameterId];
1305
1624
  }
1306
- else if (this.parameters[parameterId].value !== fileParameterValues[parameterId]) {
1307
- this.parameters[parameterId].value = fileParameterValues[parameterId];
1625
+ else if (this.parameters[parameterId].value !==
1626
+ fileParameterValues[parameterId]) {
1627
+ this.parameters[parameterId].value =
1628
+ fileParameterValues[parameterId];
1308
1629
  }
1309
1630
  }
1310
1631
  }
@@ -1313,11 +1634,11 @@ class SessionEngine {
1313
1634
  }
1314
1635
  uploadGLTF(blob, conversion = sdk_geometry_api_sdk_v2_1.ShapeDiverRequestGltfUploadQueryConversion.NONE, retry = false) {
1315
1636
  return __awaiter(this, void 0, void 0, function* () {
1316
- this.checkAvailability('gltf-upload');
1637
+ this.checkAvailability("gltf-upload");
1317
1638
  try {
1318
- const responseDto = yield this._sdk.gltf.upload(this._sessionId, yield blob.arrayBuffer(), 'model/gltf-binary', conversion);
1639
+ const responseDto = yield this._sdk.gltf.upload(this._sessionId, yield blob.arrayBuffer(), "model/gltf-binary", conversion);
1319
1640
  if (!responseDto || !responseDto.gltf || !responseDto.gltf.href)
1320
- throw new viewer_shared_services_1.ShapeDiverViewerSessionError('Session.uploadGLTF: Upload reply has not the required format.');
1641
+ throw new viewer_shared_services_1.ShapeDiverViewerSessionError("Session.uploadGLTF: Upload reply has not the required format.");
1321
1642
  return responseDto;
1322
1643
  }
1323
1644
  catch (e) {
@@ -1335,15 +1656,15 @@ class SessionEngine {
1335
1656
  for (const p in parameters) {
1336
1657
  sessionProperties[p] = {
1337
1658
  order: parameters[p].order || 0,
1338
- displayname: parameters[p].displayname || '',
1339
- hidden: parameters[p].hidden
1659
+ displayname: parameters[p].displayname || "",
1660
+ hidden: parameters[p].hidden,
1340
1661
  };
1341
1662
  }
1342
1663
  for (const e in exports) {
1343
1664
  sessionProperties[e] = {
1344
1665
  order: exports[e].order || 0,
1345
- displayname: exports[e].displayname || '',
1346
- hidden: exports[e].hidden
1666
+ displayname: exports[e].displayname || "",
1667
+ hidden: exports[e].hidden,
1347
1668
  };
1348
1669
  }
1349
1670
  this._settingsEngine.session = sessionProperties;
@@ -1354,44 +1675,61 @@ class SessionEngine {
1354
1675
  for (const outputId in outputs) {
1355
1676
  const outputObj = outputs[outputId];
1356
1677
  if ((throwError === false && outputObj.msg !== undefined) ||
1357
- (outputObj.status_collect && outputObj.status_collect !== sdk_geometry_api_sdk_v2_1.ShapeDiverResponseModelComputationStatus.SUCCESS) ||
1358
- (outputObj.status_computation && outputObj.status_computation !== sdk_geometry_api_sdk_v2_1.ShapeDiverResponseModelComputationStatus.SUCCESS)) {
1678
+ (outputObj.status_collect &&
1679
+ outputObj.status_collect !==
1680
+ sdk_geometry_api_sdk_v2_1.ShapeDiverResponseModelComputationStatus.SUCCESS) ||
1681
+ (outputObj.status_computation &&
1682
+ outputObj.status_computation !==
1683
+ sdk_geometry_api_sdk_v2_1.ShapeDiverResponseModelComputationStatus.SUCCESS)) {
1359
1684
  outputsWithIssues[outputId] = outputObj;
1360
1685
  }
1361
1686
  }
1362
1687
  for (const exportId in exports) {
1363
1688
  const exportObj = exports[exportId];
1364
1689
  if ((throwError === false && exportObj.msg !== undefined) ||
1365
- (exportObj.status_collect && exportObj.status_collect !== sdk_geometry_api_sdk_v2_1.ShapeDiverResponseModelComputationStatus.SUCCESS) ||
1366
- (exportObj.status_computation && exportObj.status_computation !== sdk_geometry_api_sdk_v2_1.ShapeDiverResponseModelComputationStatus.SUCCESS)) {
1690
+ (exportObj.status_collect &&
1691
+ exportObj.status_collect !==
1692
+ sdk_geometry_api_sdk_v2_1.ShapeDiverResponseModelComputationStatus.SUCCESS) ||
1693
+ (exportObj.status_computation &&
1694
+ exportObj.status_computation !==
1695
+ sdk_geometry_api_sdk_v2_1.ShapeDiverResponseModelComputationStatus.SUCCESS)) {
1367
1696
  exportsWithIssues[exportId] = exportObj;
1368
1697
  }
1369
1698
  }
1370
- if (Object.keys(outputsWithIssues).length > 0 || Object.keys(exportsWithIssues).length > 0) {
1699
+ if (Object.keys(outputsWithIssues).length > 0 ||
1700
+ Object.keys(exportsWithIssues).length > 0) {
1371
1701
  if (throwError) {
1372
- throw new viewer_shared_services_1.ShapeDiverViewerCustomizationError('There was at least one output or export with issues.', { outputs: outputsWithIssues, exports: exportsWithIssues });
1702
+ throw new viewer_shared_services_1.ShapeDiverViewerCustomizationError("There was at least one output or export with issues.", { outputs: outputsWithIssues, exports: exportsWithIssues });
1373
1703
  }
1374
1704
  else {
1375
1705
  // create warning messages for outputs
1376
1706
  for (const outputId in outputsWithIssues) {
1377
- let warning = '';
1707
+ let warning = "";
1378
1708
  if (outputsWithIssues[outputId].msg)
1379
1709
  warning += `\n\t- ${outputsWithIssues[outputId].msg}`;
1380
- if (outputsWithIssues[outputId].status_collect && outputsWithIssues[outputId].status_collect !== sdk_geometry_api_sdk_v2_1.ShapeDiverResponseModelComputationStatus.SUCCESS)
1710
+ if (outputsWithIssues[outputId].status_collect &&
1711
+ outputsWithIssues[outputId].status_collect !==
1712
+ sdk_geometry_api_sdk_v2_1.ShapeDiverResponseModelComputationStatus.SUCCESS)
1381
1713
  warning += `\n\t- status_collect is ${outputsWithIssues[outputId].status_collect}`;
1382
- if (outputsWithIssues[outputId].status_computation && outputsWithIssues[outputId].status_computation !== sdk_geometry_api_sdk_v2_1.ShapeDiverResponseModelComputationStatus.SUCCESS)
1714
+ if (outputsWithIssues[outputId].status_computation &&
1715
+ outputsWithIssues[outputId].status_computation !==
1716
+ sdk_geometry_api_sdk_v2_1.ShapeDiverResponseModelComputationStatus.SUCCESS)
1383
1717
  warning += `\n\t- status_computation is ${outputsWithIssues[outputId].status_computation}`;
1384
1718
  if (warning)
1385
1719
  this._logger.warn(`\nOutput(${outputId}):${warning}`);
1386
1720
  }
1387
1721
  // create warning messages for exports
1388
1722
  for (const exportId in exportsWithIssues) {
1389
- let warning = '';
1723
+ let warning = "";
1390
1724
  if (exportsWithIssues[exportId].msg)
1391
1725
  warning += `\n\t- ${exportsWithIssues[exportId].msg}`;
1392
- if (exportsWithIssues[exportId].status_collect && exportsWithIssues[exportId].status_collect !== sdk_geometry_api_sdk_v2_1.ShapeDiverResponseModelComputationStatus.SUCCESS)
1726
+ if (exportsWithIssues[exportId].status_collect &&
1727
+ exportsWithIssues[exportId].status_collect !==
1728
+ sdk_geometry_api_sdk_v2_1.ShapeDiverResponseModelComputationStatus.SUCCESS)
1393
1729
  warning += `\n\t- status_collect is ${exportsWithIssues[exportId].status_collect}`;
1394
- if (exportsWithIssues[exportId].status_computation && exportsWithIssues[exportId].status_computation !== sdk_geometry_api_sdk_v2_1.ShapeDiverResponseModelComputationStatus.SUCCESS)
1730
+ if (exportsWithIssues[exportId].status_computation &&
1731
+ exportsWithIssues[exportId].status_computation !==
1732
+ sdk_geometry_api_sdk_v2_1.ShapeDiverResponseModelComputationStatus.SUCCESS)
1395
1733
  warning += `\n\t- status_computation is ${exportsWithIssues[exportId].status_computation}`;
1396
1734
  if (warning)
1397
1735
  this._logger.warn(`\nExport(${exportId}):${warning}`);
@@ -1401,7 +1739,8 @@ class SessionEngine {
1401
1739
  }
1402
1740
  addBusyMode(busyId) {
1403
1741
  for (const r in this._stateEngine.viewportEngines) {
1404
- if (this._stateEngine.viewportEngines[r] && !this.excludeViewports.includes(r)) {
1742
+ if (this._stateEngine.viewportEngines[r] &&
1743
+ !this.excludeViewports.includes(r)) {
1405
1744
  this._stateEngine.viewportEngines[r].busy.push(busyId);
1406
1745
  __classPrivateFieldGet(this, _SessionEngine_customizationBusyModes, "f").push(busyId);
1407
1746
  }
@@ -1419,7 +1758,7 @@ class SessionEngine {
1419
1758
  id: eventId,
1420
1759
  progress: eventProgress,
1421
1760
  data: eventData,
1422
- status: 'The request was exceeded by another customization request'
1761
+ status: "The request was exceeded by another customization request",
1423
1762
  };
1424
1763
  this._eventEngine.emitEvent(viewer_shared_services_1.EVENTTYPE.TASK.TASK_CANCEL, eventCancel);
1425
1764
  this._logger.debug(`Session(${this.id}).cancelProcess: The request was was exceeded by another request.`);
@@ -1428,7 +1767,13 @@ class SessionEngine {
1428
1767
  else if (this._closed === true) {
1429
1768
  this.removeBusyMode(customizationId);
1430
1769
  this._logger.debug(`Session(${this.id}).cancelProcess: The session was closed during the request.`);
1431
- const eventCancel = { type: viewer_shared_types_1.TASK_TYPE.SESSION_CUSTOMIZATION, id: eventId, progress: 1, data: { sessionId: this.id }, status: 'The session was closed during the request.' };
1770
+ const eventCancel = {
1771
+ type: viewer_shared_types_1.TASK_TYPE.SESSION_CUSTOMIZATION,
1772
+ id: eventId,
1773
+ progress: 1,
1774
+ data: { sessionId: this.id },
1775
+ status: "The session was closed during the request.",
1776
+ };
1432
1777
  this._eventEngine.emitEvent(viewer_shared_services_1.EVENTTYPE.TASK.TASK_CANCEL, eventCancel);
1433
1778
  return new SessionTreeNode_1.SessionTreeNode();
1434
1779
  }
@@ -1436,14 +1781,14 @@ class SessionEngine {
1436
1781
  checkAvailability(action, checkForModelId = false) {
1437
1782
  var _a;
1438
1783
  if (!this._responseDto)
1439
- throw new viewer_shared_services_1.ShapeDiverViewerSessionError('Session.checkAvailability: responseDto not available.');
1784
+ throw new viewer_shared_services_1.ShapeDiverViewerSessionError("Session.checkAvailability: responseDto not available.");
1440
1785
  if (!this._sessionId)
1441
- throw new viewer_shared_services_1.ShapeDiverViewerSessionError('Session.checkAvailability: sessionId not available.');
1786
+ throw new viewer_shared_services_1.ShapeDiverViewerSessionError("Session.checkAvailability: sessionId not available.");
1442
1787
  if (checkForModelId && !this._modelId)
1443
- throw new viewer_shared_services_1.ShapeDiverViewerSessionError('Session.checkAvailability: modelId not available.');
1788
+ throw new viewer_shared_services_1.ShapeDiverViewerSessionError("Session.checkAvailability: modelId not available.");
1444
1789
  if (action && !this._responseDto.actions)
1445
- throw new viewer_shared_services_1.ShapeDiverViewerSessionError('Session.checkAvailability: actions not available.');
1446
- const responseDtoAction = (_a = this._responseDto.actions) === null || _a === void 0 ? void 0 : _a.find(a => a.name === action);
1790
+ throw new viewer_shared_services_1.ShapeDiverViewerSessionError("Session.checkAvailability: actions not available.");
1791
+ const responseDtoAction = (_a = this._responseDto.actions) === null || _a === void 0 ? void 0 : _a.find((a) => a.name === action);
1447
1792
  if (action && !responseDtoAction)
1448
1793
  throw new viewer_shared_services_1.ShapeDiverViewerSessionError(`Session.checkAvailability: action ${action} not available.`);
1449
1794
  }
@@ -1453,12 +1798,14 @@ class SessionEngine {
1453
1798
  for (const parameterIdOrName in parameters) {
1454
1799
  // we prioritize id, then name and then displayname
1455
1800
  // if there are two parameters with the same name or displayname, we take the one that is found first (no way for us to evaluate which one the user meant)
1456
- const parameterObject = Object.values(this._parameters).find(p => p.id === parameterIdOrName || p.name === parameterIdOrName || p.displayname === parameterIdOrName);
1801
+ const parameterObject = Object.values(this._parameters).find((p) => p.id === parameterIdOrName ||
1802
+ p.name === parameterIdOrName ||
1803
+ p.displayname === parameterIdOrName);
1457
1804
  // in case the key of the key value pair was neither the id, name or displayname, skip
1458
1805
  if (!parameterObject)
1459
1806
  continue;
1460
1807
  // copy into new dictionary
1461
- requestParameterSet[parameterObject.id] = (' ' + parameterObject.stringify(parameters[parameterIdOrName])).slice(1);
1808
+ requestParameterSet[parameterObject.id] = (" " + parameterObject.stringify(parameters[parameterIdOrName])).slice(1);
1462
1809
  }
1463
1810
  // seconds step, fill all other parameter values that are currently not set
1464
1811
  const currentParameters = this.parameterValues;
@@ -1467,7 +1814,7 @@ class SessionEngine {
1467
1814
  if (requestParameterSet[parameterId] !== undefined)
1468
1815
  continue;
1469
1816
  // deep copy into new dictionary
1470
- requestParameterSet[parameterId] = (' ' + currentParameters[parameterId]).slice(1);
1817
+ requestParameterSet[parameterId] = (" " + currentParameters[parameterId]).slice(1);
1471
1818
  }
1472
1819
  return requestParameterSet;
1473
1820
  }
@@ -1481,11 +1828,11 @@ class SessionEngine {
1481
1828
  const result = (0, viewer_shared_types_1.validateInteractionParameterSettings)(parameter.settings);
1482
1829
  if (result.success) {
1483
1830
  switch (parameter.settings.type) {
1484
- case 'selection':
1831
+ case "selection":
1485
1832
  return new SelectionParameter_1.SelectionParameter(parameter, this);
1486
- case 'gumball':
1833
+ case "gumball":
1487
1834
  return new GumballParameter_1.GumballParameter(parameter, this);
1488
- case 'dragging':
1835
+ case "dragging":
1489
1836
  return new DraggingParameter_1.DraggingParameter(parameter, this);
1490
1837
  }
1491
1838
  }
@@ -1501,11 +1848,11 @@ class SessionEngine {
1501
1848
  }
1502
1849
  customizeSession(parameters, cancelRequest, taskEventInfo, parallel = false, loadOutputs = true, retry = false) {
1503
1850
  return __awaiter(this, void 0, void 0, function* () {
1504
- this.checkAvailability('customize');
1851
+ this.checkAvailability("customize");
1505
1852
  try {
1506
- this._performanceEvaluator.startSection('sessionResponse');
1853
+ this._performanceEvaluator.startSection("sessionResponse");
1507
1854
  const responseDto = yield this._sdk.utils.submitAndWaitForCustomization(this._sdk, this._sessionId, parameters);
1508
- this._performanceEvaluator.endSection('sessionResponse');
1855
+ this._performanceEvaluator.endSection("sessionResponse");
1509
1856
  if (loadOutputs === true && this._allowOutputLoading === true) {
1510
1857
  if (cancelRequest())
1511
1858
  return new SessionTreeNode_1.SessionTreeNode();
@@ -1545,7 +1892,10 @@ class SessionEngine {
1545
1892
  const fileParameterSet = {};
1546
1893
  for (const parameterId in this.parameters) {
1547
1894
  if (this.parameters[parameterId] instanceof FileParameter_1.FileParameter) {
1548
- fileParameterSet[parameterId] = parameters[parameterId] !== undefined ? parameters[parameterId] : this.parameters[parameterId].value;
1895
+ fileParameterSet[parameterId] =
1896
+ parameters[parameterId] !== undefined
1897
+ ? parameters[parameterId]
1898
+ : this.parameters[parameterId].value;
1549
1899
  }
1550
1900
  }
1551
1901
  return fileParameterSet;
@@ -1556,18 +1906,18 @@ class SessionEngine {
1556
1906
  if (e.error === sdk_geometry_api_sdk_v2_1.ShapeDiverResponseErrorType.SESSION_GONE_ERROR) {
1557
1907
  // case 1: the session is no longer available
1558
1908
  // we try to re-initialize the session 3 times, if that does not work, we close it
1559
- this._logger.warn('The session has been closed, trying to re-initialize.');
1909
+ this._logger.warn("The session has been closed, trying to re-initialize.");
1560
1910
  if (this._sessionId)
1561
1911
  this._httpClient.removeDataLoading(this._sessionId);
1562
1912
  if (this._retryCounter < 3) {
1563
- // we retry this 3 times, the `retry` option in the init function is set to true and passed on
1913
+ // we retry this 3 times, the `retry` option in the init function is set to true and passed on
1564
1914
  this._retryCounter = retry ? this._retryCounter + 1 : 1;
1565
1915
  this._initialized = false;
1566
1916
  yield this.init(this.parameterValues, true);
1567
1917
  }
1568
1918
  else {
1569
1919
  // the retries were exceeded, we close the session
1570
- this._logger.warn('Tried to retry the connect multiple times, bearer token still not valid. Closing Session.');
1920
+ this._logger.warn("Tried to retry the connect multiple times, bearer token still not valid. Closing Session.");
1571
1921
  // eslint-disable-next-line no-empty
1572
1922
  try {
1573
1923
  yield this._closeOnFailure();
@@ -1583,11 +1933,11 @@ class SessionEngine {
1583
1933
  if (this._refreshJwtToken) {
1584
1934
  yield this.setJwtToken(yield this._refreshJwtToken());
1585
1935
  this._retryCounter = retry ? this._retryCounter + 1 : 1;
1586
- this._logger.warn('Re-trying with new bearer token.');
1936
+ this._logger.warn("Re-trying with new bearer token.");
1587
1937
  }
1588
1938
  else {
1589
1939
  // no bearer tokens are supplied, we close the session
1590
- this._logger.warn('No retry possible, no new bearer token was supplied. Closing Session.');
1940
+ this._logger.warn("No retry possible, no new bearer token was supplied. Closing Session.");
1591
1941
  // eslint-disable-next-line no-empty
1592
1942
  try {
1593
1943
  yield this._closeOnFailure();
@@ -1598,7 +1948,7 @@ class SessionEngine {
1598
1948
  }
1599
1949
  else {
1600
1950
  // the retries were exceeded, we close the session
1601
- this._logger.warn('Tried to retry the connect multiple times, bearer token still not valid. Closing Session.');
1951
+ this._logger.warn("Tried to retry the connect multiple times, bearer token still not valid. Closing Session.");
1602
1952
  // eslint-disable-next-line no-empty
1603
1953
  try {
1604
1954
  yield this._closeOnFailure();
@@ -1635,7 +1985,7 @@ class SessionEngine {
1635
1985
  if (image instanceof Promise) {
1636
1986
  imageString = yield image;
1637
1987
  }
1638
- else if (typeof image === 'function') {
1988
+ else if (typeof image === "function") {
1639
1989
  const result = image();
1640
1990
  if (result instanceof Promise) {
1641
1991
  imageString = yield result;
@@ -1647,15 +1997,15 @@ class SessionEngine {
1647
1997
  else {
1648
1998
  imageString = image;
1649
1999
  }
1650
- if (imageString.startsWith('data:')) {
2000
+ if (imageString.startsWith("data:")) {
1651
2001
  // case where the image is a data URL
1652
2002
  const { blob, arrayBuffer } = this._converter.dataURLtoBlob(imageString);
1653
2003
  return {
1654
2004
  imageData: {
1655
2005
  format: blob.type,
1656
- size: blob.size
2006
+ size: blob.size,
1657
2007
  },
1658
- arrayBuffer
2008
+ arrayBuffer,
1659
2009
  };
1660
2010
  }
1661
2011
  else {
@@ -1664,16 +2014,17 @@ class SessionEngine {
1664
2014
  return {
1665
2015
  imageData: {
1666
2016
  format: type,
1667
- size: arrayBuffer.byteLength
2017
+ size: arrayBuffer.byteLength,
1668
2018
  },
1669
- arrayBuffer
2019
+ arrayBuffer,
1670
2020
  };
1671
2021
  }
1672
2022
  });
1673
2023
  }
1674
2024
  removeBusyMode(busyId) {
1675
2025
  for (const r in this._stateEngine.viewportEngines) {
1676
- if (this._stateEngine.viewportEngines[r] && this._stateEngine.viewportEngines[r].busy.includes(busyId))
2026
+ if (this._stateEngine.viewportEngines[r] &&
2027
+ this._stateEngine.viewportEngines[r].busy.includes(busyId))
1677
2028
  this._stateEngine.viewportEngines[r].busy.splice(this._stateEngine.viewportEngines[r].busy.indexOf(busyId), 1);
1678
2029
  if (__classPrivateFieldGet(this, _SessionEngine_customizationBusyModes, "f").includes(busyId))
1679
2030
  __classPrivateFieldGet(this, _SessionEngine_customizationBusyModes, "f").splice(__classPrivateFieldGet(this, _SessionEngine_customizationBusyModes, "f").indexOf(busyId), 1);
@@ -1691,7 +2042,7 @@ class SessionEngine {
1691
2042
  */
1692
2043
  timeout(ms) {
1693
2044
  return __awaiter(this, void 0, void 0, function* () {
1694
- return new Promise(resolve => setTimeout(resolve, ms));
2045
+ return new Promise((resolve) => setTimeout(resolve, ms));
1695
2046
  });
1696
2047
  }
1697
2048
  updateResponseDto(responseDto, initialParameters) {
@@ -1702,24 +2053,33 @@ class SessionEngine {
1702
2053
  // convert parameters
1703
2054
  if (responseDto.parameters) {
1704
2055
  for (const parameterId in responseDto.parameters) {
1705
- this._responseDto.parameters = this._responseDto.parameters || {};
1706
- this._responseDto.parameters[parameterId] = this._responseDto.parameters[parameterId] || responseDto.parameters[parameterId];
2056
+ this._responseDto.parameters =
2057
+ this._responseDto.parameters || {};
2058
+ this._responseDto.parameters[parameterId] =
2059
+ this._responseDto.parameters[parameterId] ||
2060
+ responseDto.parameters[parameterId];
1707
2061
  }
1708
2062
  }
1709
2063
  // convert outputs
1710
2064
  if (responseDto.outputs) {
1711
2065
  for (const outputId in responseDto.outputs) {
1712
2066
  this._responseDto.outputs = this._responseDto.outputs || {};
1713
- if ('version' in responseDto.outputs[outputId] || !(this._responseDto.outputs[outputId] && 'version' in this._responseDto.outputs[outputId]))
1714
- this._responseDto.outputs[outputId] = responseDto.outputs[outputId];
2067
+ if ("version" in responseDto.outputs[outputId] ||
2068
+ !(this._responseDto.outputs[outputId] &&
2069
+ "version" in this._responseDto.outputs[outputId]))
2070
+ this._responseDto.outputs[outputId] =
2071
+ responseDto.outputs[outputId];
1715
2072
  }
1716
2073
  }
1717
2074
  // convert exports
1718
2075
  if (responseDto.exports) {
1719
2076
  for (const exportId in responseDto.exports) {
1720
2077
  this._responseDto.exports = this._responseDto.exports || {};
1721
- if ('version' in responseDto.exports[exportId] || !(this._responseDto.exports[exportId] && 'version' in this._responseDto.exports[exportId]))
1722
- this._responseDto.exports[exportId] = responseDto.exports[exportId];
2078
+ if ("version" in responseDto.exports[exportId] ||
2079
+ !(this._responseDto.exports[exportId] &&
2080
+ "version" in this._responseDto.exports[exportId]))
2081
+ this._responseDto.exports[exportId] =
2082
+ responseDto.exports[exportId];
1723
2083
  }
1724
2084
  }
1725
2085
  const parameterSet = {};
@@ -1728,22 +2088,35 @@ class SessionEngine {
1728
2088
  continue;
1729
2089
  this._responseDto.parameters[parameterId].id = parameterId;
1730
2090
  switch (true) {
1731
- case this._responseDto.parameters[parameterId].type === viewer_shared_types_1.PARAMETER_TYPE.BOOL:
2091
+ case this._responseDto.parameters[parameterId].type ===
2092
+ viewer_shared_types_1.PARAMETER_TYPE.BOOL:
1732
2093
  this.parameters[parameterId] = new Parameter_1.Parameter(this._responseDto.parameters[parameterId], this);
1733
2094
  break;
1734
- case this._responseDto.parameters[parameterId].type === viewer_shared_types_1.PARAMETER_TYPE.COLOR:
2095
+ case this._responseDto.parameters[parameterId].type ===
2096
+ viewer_shared_types_1.PARAMETER_TYPE.COLOR:
1735
2097
  this.parameters[parameterId] = new Parameter_1.Parameter(this._responseDto.parameters[parameterId], this);
1736
2098
  break;
1737
- case this._responseDto.parameters[parameterId].type === viewer_shared_types_1.PARAMETER_TYPE.FILE:
2099
+ case this._responseDto.parameters[parameterId].type ===
2100
+ viewer_shared_types_1.PARAMETER_TYPE.FILE:
1738
2101
  this.parameters[parameterId] = new FileParameter_1.FileParameter(this._responseDto.parameters[parameterId], this);
1739
2102
  break;
1740
- case this._responseDto.parameters[parameterId].type === viewer_shared_types_1.PARAMETER_TYPE.EVEN || this._responseDto.parameters[parameterId].type === viewer_shared_types_1.PARAMETER_TYPE.FLOAT || this._responseDto.parameters[parameterId].type === viewer_shared_types_1.PARAMETER_TYPE.INT || this._responseDto.parameters[parameterId].type === viewer_shared_types_1.PARAMETER_TYPE.ODD:
2103
+ case this._responseDto.parameters[parameterId].type ===
2104
+ viewer_shared_types_1.PARAMETER_TYPE.EVEN ||
2105
+ this._responseDto.parameters[parameterId].type ===
2106
+ viewer_shared_types_1.PARAMETER_TYPE.FLOAT ||
2107
+ this._responseDto.parameters[parameterId].type ===
2108
+ viewer_shared_types_1.PARAMETER_TYPE.INT ||
2109
+ this._responseDto.parameters[parameterId].type ===
2110
+ viewer_shared_types_1.PARAMETER_TYPE.ODD:
1741
2111
  this.parameters[parameterId] = new Parameter_1.Parameter(this._responseDto.parameters[parameterId], this);
1742
2112
  break;
1743
- case this._responseDto.parameters[parameterId].type === viewer_shared_types_1.PARAMETER_TYPE.INTERACTION:
1744
- this.parameters[parameterId] = this.createInteractionParameter(this._responseDto.parameters[parameterId]);
2113
+ case this._responseDto.parameters[parameterId].type ===
2114
+ viewer_shared_types_1.PARAMETER_TYPE.INTERACTION:
2115
+ this.parameters[parameterId] =
2116
+ this.createInteractionParameter(this._responseDto.parameters[parameterId]);
1745
2117
  break;
1746
- case this._responseDto.parameters[parameterId].type === viewer_shared_types_1.PARAMETER_TYPE.DRAWING:
2118
+ case this._responseDto.parameters[parameterId].type ===
2119
+ viewer_shared_types_1.PARAMETER_TYPE.DRAWING:
1747
2120
  this.parameters[parameterId] = new DrawingParameter_1.DrawingParameter(this._responseDto.parameters[parameterId], this);
1748
2121
  break;
1749
2122
  default:
@@ -1754,11 +2127,14 @@ class SessionEngine {
1754
2127
  if (initialParameters) {
1755
2128
  // check if the id is within the initial parameters
1756
2129
  if (initialParameters[parameterId] !== undefined) {
1757
- this.parameters[parameterId].value = initialParameters[parameterId];
2130
+ this.parameters[parameterId].value =
2131
+ initialParameters[parameterId];
1758
2132
  }
1759
2133
  // check if the name is within the initial parameters
1760
- else if (initialParameters[this.parameters[parameterId].name] !== undefined) {
1761
- this.parameters[parameterId].value = initialParameters[this.parameters[parameterId].name];
2134
+ else if (initialParameters[this.parameters[parameterId].name] !==
2135
+ undefined) {
2136
+ this.parameters[parameterId].value =
2137
+ initialParameters[this.parameters[parameterId].name];
1762
2138
  }
1763
2139
  // NOTE: At some point the checking may also be done with the displayname, this is the code for it
1764
2140
  // // check if the displayname is within the initial parameters
@@ -1768,16 +2144,20 @@ class SessionEngine {
1768
2144
  }
1769
2145
  parameterSet[parameterId] = {
1770
2146
  value: this.parameters[parameterId].value,
1771
- valueString: this.parameters[parameterId].stringify()
2147
+ valueString: this.parameters[parameterId].stringify(),
1772
2148
  };
1773
2149
  if (!this.initialized)
1774
- this.parameterValues[parameterId] = parameterSet[parameterId].valueString;
2150
+ this.parameterValues[parameterId] =
2151
+ parameterSet[parameterId].valueString;
1775
2152
  }
1776
2153
  // store the initialization as the first parameter set in the history
1777
2154
  if (!this.initialized)
1778
2155
  __classPrivateFieldGet(this, _SessionEngine_parameterHistory, "f").push(parameterSet);
1779
2156
  for (const exportId in this._responseDto.exports) {
1780
- if (this._responseDto.exports[exportId].type === sdk_geometry_api_sdk_v2_1.ShapeDiverResponseExportDefinitionType.EMAIL || this._responseDto.exports[exportId].type === sdk_geometry_api_sdk_v2_1.ShapeDiverResponseExportDefinitionType.DOWNLOAD) {
2157
+ if (this._responseDto.exports[exportId].type ===
2158
+ sdk_geometry_api_sdk_v2_1.ShapeDiverResponseExportDefinitionType.EMAIL ||
2159
+ this._responseDto.exports[exportId].type ===
2160
+ sdk_geometry_api_sdk_v2_1.ShapeDiverResponseExportDefinitionType.DOWNLOAD) {
1781
2161
  if (!this.exports[exportId]) {
1782
2162
  this._responseDto.exports[exportId].id = exportId;
1783
2163
  this.exports[exportId] = new Export_1.Export(this._responseDto.exports[exportId], this);
@@ -1792,10 +2172,10 @@ class SessionEngine {
1792
2172
  this._responseDto.outputs[outputId].id = outputId;
1793
2173
  if (this.outputsFreeze[outputId] === undefined)
1794
2174
  this.outputsFreeze[outputId] = false;
1795
- this.outputs[outputId] = new Output_1.Output(this._responseDto.outputs[outputId], this);
2175
+ this.outputs[outputId] = new Output_1.Output((this._responseDto.outputs[outputId]), this);
1796
2176
  }
1797
2177
  else {
1798
- this.outputs[outputId].updateOutputDefinition(this._responseDto.outputs[outputId]);
2178
+ this.outputs[outputId].updateOutputDefinition((this._responseDto.outputs[outputId]));
1799
2179
  }
1800
2180
  }
1801
2181
  }
@@ -1808,7 +2188,7 @@ class SessionEngine {
1808
2188
  // call the update callback functions on the outputs
1809
2189
  for (const outputId in this.outputs) {
1810
2190
  if (oldOutputVersions[outputId] !== newOutputVersions[outputId]) {
1811
- promises.push(this.outputs[outputId].triggerUpdateCallback(newNode.children.find(c => c.name === outputId), oldNode.children.find(c => c.name === outputId)));
2191
+ promises.push(this.outputs[outputId].triggerUpdateCallback(newNode.children.find((c) => c.name === outputId), oldNode.children.find((c) => c.name === outputId)));
1812
2192
  }
1813
2193
  }
1814
2194
  yield Promise.all(promises);