@shapediver/viewer.shared.services 3.16.7 → 3.16.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/converter/Converter.d.ts +77 -77
- package/dist/converter/Converter.js +424 -424
- package/dist/converter/Converter.js.map +1 -1
- package/dist/dom-event-engine/DomEventEngine.d.ts +56 -56
- package/dist/dom-event-engine/DomEventEngine.js +275 -275
- package/dist/dom-event-engine/DomEventEngine.js.map +1 -1
- package/dist/dom-event-engine/IDomEventListener.d.ts +10 -10
- package/dist/dom-event-engine/IDomEventListener.js +2 -2
- package/dist/event-engine/EventEngine.d.ts +35 -35
- package/dist/event-engine/EventEngine.js +107 -107
- package/dist/event-engine/EventEngine.js.map +1 -1
- package/dist/event-engine/interfaces/ICallback.d.ts +4 -4
- package/dist/event-engine/interfaces/ICallback.js +2 -2
- package/dist/event-engine/interfaces/IListener.d.ts +5 -5
- package/dist/event-engine/interfaces/IListener.js +2 -2
- package/dist/http-client/HttpClient.d.ts +106 -106
- package/dist/http-client/HttpClient.js +375 -375
- package/dist/http-client/HttpClient.js.map +1 -1
- package/dist/http-client/HttpResponse.d.ts +5 -5
- package/dist/http-client/HttpResponse.js +2 -2
- package/dist/index.d.ts +43 -43
- package/dist/index.js +102 -102
- package/dist/input-validator/InputValidator.d.ts +10 -10
- package/dist/input-validator/InputValidator.d.ts.map +1 -1
- package/dist/input-validator/InputValidator.js +169 -169
- package/dist/input-validator/InputValidator.js.map +1 -1
- package/dist/logger/ErrorTypeGuards.d.ts +41 -41
- package/dist/logger/ErrorTypeGuards.js +158 -159
- package/dist/logger/ErrorTypeGuards.js.map +1 -1
- package/dist/logger/Logger.d.ts +63 -63
- package/dist/logger/Logger.js +179 -179
- package/dist/logger/Logger.js.map +1 -1
- package/dist/logger/ShapeDiverBackendErrors.d.ts +14 -14
- package/dist/logger/ShapeDiverBackendErrors.js +28 -28
- package/dist/logger/ShapeDiverError.d.ts +33 -33
- package/dist/logger/ShapeDiverError.js +43 -43
- package/dist/logger/ShapeDiverError.js.map +1 -1
- package/dist/logger/ShapeDiverViewerErrors.d.ts +87 -87
- package/dist/logger/ShapeDiverViewerErrors.d.ts.map +1 -1
- package/dist/logger/ShapeDiverViewerErrors.js +119 -119
- package/dist/logger/ShapeDiverViewerErrors.js.map +1 -1
- package/dist/parameter-utils/ParameterUtils.d.ts +3 -3
- package/dist/parameter-utils/ParameterUtils.d.ts.map +1 -1
- package/dist/parameter-utils/ParameterUtils.js +161 -161
- package/dist/parameter-utils/ParameterUtils.js.map +1 -1
- package/dist/performance-evaluator/PerformanceEvaluator.d.ts +65 -65
- package/dist/performance-evaluator/PerformanceEvaluator.js +125 -125
- package/dist/settings-engine/SettingsEngine.d.ts +43 -43
- package/dist/settings-engine/SettingsEngine.d.ts.map +1 -1
- package/dist/settings-engine/SettingsEngine.js +162 -162
- package/dist/settings-engine/SettingsEngine.js.map +1 -1
- package/dist/settings-engine/defaults/Defaults.d.ts +2 -2
- package/dist/settings-engine/defaults/Defaults.js +102 -102
- package/dist/settings-engine/defaults/FurnitureDefaults.d.ts +2 -2
- package/dist/settings-engine/defaults/FurnitureDefaults.js +158 -158
- package/dist/settings-engine/defaults/HighPerformanceDefaults.d.ts +2 -2
- package/dist/settings-engine/defaults/HighPerformanceDefaults.js +114 -114
- package/dist/settings-engine/defaults/JewelryDefaults.d.ts +2 -2
- package/dist/settings-engine/defaults/JewelryDefaults.js +91 -91
- package/dist/settings-engine/defaults/MedicalDefaults.d.ts +2 -2
- package/dist/settings-engine/defaults/MedicalDefaults.js +102 -102
- package/dist/settings-engine/defaults/TwoDimensionalDefaults.d.ts +2 -2
- package/dist/settings-engine/defaults/TwoDimensionalDefaults.js +83 -83
- package/dist/state-engine/ISessionGlobalAccessObjectDefinition.d.ts +21 -21
- package/dist/state-engine/ISessionGlobalAccessObjectDefinition.js +2 -2
- package/dist/state-engine/IViewportGlobalAccessObjectDefinition.d.ts +33 -33
- package/dist/state-engine/IViewportGlobalAccessObjectDefinition.js +2 -2
- package/dist/state-engine/StateEngine.d.ts +18 -18
- package/dist/state-engine/StateEngine.js +32 -32
- package/dist/state-engine/StatePromise.d.ts +13 -13
- package/dist/state-engine/StatePromise.js +55 -55
- package/dist/system-info/SystemInfo.d.ts +57 -57
- package/dist/system-info/SystemInfo.js +127 -127
- package/dist/system-info/SystemInfo.js.map +1 -1
- package/dist/type-check/TypeChecker.d.ts +6 -6
- package/dist/type-check/TypeChecker.js +19 -19
- package/dist/utilities/ObservableArray.d.ts +25 -25
- package/dist/utilities/ObservableArray.d.ts.map +1 -1
- package/dist/utilities/ObservableArray.js +64 -64
- package/dist/utilities/ObservableArray.js.map +1 -1
- package/dist/utilities/base64.d.ts +2 -2
- package/dist/utilities/base64.d.ts.map +1 -1
- package/dist/utilities/base64.js +21 -21
- package/dist/utilities/base64.js.map +1 -1
- package/dist/utilities/hashCreator.d.ts +7 -7
- package/dist/utilities/hashCreator.d.ts.map +1 -1
- package/dist/utilities/hashCreator.js +29 -29
- package/dist/utilities/hashCreator.js.map +1 -1
- package/dist/utilities/numberCleaner.d.ts +1 -1
- package/dist/utilities/numberCleaner.d.ts.map +1 -1
- package/dist/utilities/numberCleaner.js +8 -8
- package/dist/uuid-generator/UuidGenerator.d.ts +28 -28
- package/dist/uuid-generator/UuidGenerator.js +46 -46
- package/package.json +6 -6
|
@@ -1,36 +1,36 @@
|
|
|
1
|
-
import { IEvent, MainEventTypes } from "@shapediver/viewer.shared.types";
|
|
2
|
-
import { Logger } from "../logger/Logger";
|
|
3
|
-
import { UuidGenerator } from "../uuid-generator/UuidGenerator";
|
|
4
|
-
import { ICallback } from "./interfaces/ICallback";
|
|
5
|
-
export declare class EventEngine {
|
|
6
|
-
private static _instance;
|
|
7
|
-
private _eventListeners;
|
|
8
|
-
protected readonly _logger: Logger;
|
|
9
|
-
protected readonly _uuidGenerator: UuidGenerator;
|
|
10
|
-
private constructor();
|
|
11
|
-
static get instance(): EventEngine;
|
|
12
|
-
/**
|
|
13
|
-
* Adds a listener that listenes to the provided type. If no valid type is specified, an error is thrown.
|
|
14
|
-
*
|
|
15
|
-
* @param type the type of the event
|
|
16
|
-
* @param cb the callback that should be called
|
|
17
|
-
* @returns an unique token to be able to remove the listener
|
|
18
|
-
*/
|
|
19
|
-
addListener(type: string | MainEventTypes, cb: ICallback): string;
|
|
20
|
-
/**
|
|
21
|
-
* Emits the event to all callbacks that listen to the type.
|
|
22
|
-
*
|
|
23
|
-
* @param type the type of the event
|
|
24
|
-
* @param event the event to emit
|
|
25
|
-
*/
|
|
26
|
-
emitEvent(type: string | MainEventTypes, event: IEvent): void;
|
|
27
|
-
/**
|
|
28
|
-
* Removes a listener with the specified token.
|
|
29
|
-
*
|
|
30
|
-
* @param token the token of the listener
|
|
31
|
-
* @returns result of the targeted operation
|
|
32
|
-
*/
|
|
33
|
-
removeListener(token: string): boolean;
|
|
34
|
-
private convertTypeToString;
|
|
35
|
-
}
|
|
1
|
+
import { IEvent, MainEventTypes } from "@shapediver/viewer.shared.types";
|
|
2
|
+
import { Logger } from "../logger/Logger";
|
|
3
|
+
import { UuidGenerator } from "../uuid-generator/UuidGenerator";
|
|
4
|
+
import { ICallback } from "./interfaces/ICallback";
|
|
5
|
+
export declare class EventEngine {
|
|
6
|
+
private static _instance;
|
|
7
|
+
private _eventListeners;
|
|
8
|
+
protected readonly _logger: Logger;
|
|
9
|
+
protected readonly _uuidGenerator: UuidGenerator;
|
|
10
|
+
private constructor();
|
|
11
|
+
static get instance(): EventEngine;
|
|
12
|
+
/**
|
|
13
|
+
* Adds a listener that listenes to the provided type. If no valid type is specified, an error is thrown.
|
|
14
|
+
*
|
|
15
|
+
* @param type the type of the event
|
|
16
|
+
* @param cb the callback that should be called
|
|
17
|
+
* @returns an unique token to be able to remove the listener
|
|
18
|
+
*/
|
|
19
|
+
addListener(type: string | MainEventTypes, cb: ICallback): string;
|
|
20
|
+
/**
|
|
21
|
+
* Emits the event to all callbacks that listen to the type.
|
|
22
|
+
*
|
|
23
|
+
* @param type the type of the event
|
|
24
|
+
* @param event the event to emit
|
|
25
|
+
*/
|
|
26
|
+
emitEvent(type: string | MainEventTypes, event: IEvent): void;
|
|
27
|
+
/**
|
|
28
|
+
* Removes a listener with the specified token.
|
|
29
|
+
*
|
|
30
|
+
* @param token the token of the listener
|
|
31
|
+
* @returns result of the targeted operation
|
|
32
|
+
*/
|
|
33
|
+
removeListener(token: string): boolean;
|
|
34
|
+
private convertTypeToString;
|
|
35
|
+
}
|
|
36
36
|
//# sourceMappingURL=EventEngine.d.ts.map
|
|
@@ -1,108 +1,108 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.EventEngine = void 0;
|
|
4
|
-
const viewer_shared_types_1 = require("@shapediver/viewer.shared.types");
|
|
5
|
-
const Logger_1 = require("../logger/Logger");
|
|
6
|
-
const UuidGenerator_1 = require("../uuid-generator/UuidGenerator");
|
|
7
|
-
class EventEngine {
|
|
8
|
-
// #endregion Properties (4)
|
|
9
|
-
// #region Constructors (1)
|
|
10
|
-
constructor() {
|
|
11
|
-
this._logger = Logger_1.Logger.instance;
|
|
12
|
-
this._uuidGenerator = UuidGenerator_1.UuidGenerator.instance;
|
|
13
|
-
this._eventListeners = {};
|
|
14
|
-
for (const type in viewer_shared_types_1.EVENTTYPE) {
|
|
15
|
-
const subEventType = viewer_shared_types_1.EVENTTYPE[type];
|
|
16
|
-
this._eventListeners[type.toLowerCase()] = [];
|
|
17
|
-
for (const subtype in subEventType) {
|
|
18
|
-
this._eventListeners[subEventType[subtype]] = [];
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
// #endregion Constructors (1)
|
|
23
|
-
// #region Public Static Accessors (1)
|
|
24
|
-
static get instance() {
|
|
25
|
-
return this._instance || (this._instance = new this());
|
|
26
|
-
}
|
|
27
|
-
// #endregion Public Static Accessors (1)
|
|
28
|
-
// #region Public Methods (3)
|
|
29
|
-
/**
|
|
30
|
-
* Adds a listener that listenes to the provided type. If no valid type is specified, an error is thrown.
|
|
31
|
-
*
|
|
32
|
-
* @param type the type of the event
|
|
33
|
-
* @param cb the callback that should be called
|
|
34
|
-
* @returns an unique token to be able to remove the listener
|
|
35
|
-
*/
|
|
36
|
-
addListener(type, cb) {
|
|
37
|
-
var _a;
|
|
38
|
-
const typeString = this.convertTypeToString(type);
|
|
39
|
-
if (!typeString)
|
|
40
|
-
return "";
|
|
41
|
-
const token = this._uuidGenerator.create();
|
|
42
|
-
(_a = this._eventListeners[typeString]) === null || _a === void 0 ? void 0 : _a.push({ token, cb });
|
|
43
|
-
return token;
|
|
44
|
-
}
|
|
45
|
-
/**
|
|
46
|
-
* Emits the event to all callbacks that listen to the type.
|
|
47
|
-
*
|
|
48
|
-
* @param type the type of the event
|
|
49
|
-
* @param event the event to emit
|
|
50
|
-
*/
|
|
51
|
-
emitEvent(type, event) {
|
|
52
|
-
const typeString = this.convertTypeToString(type);
|
|
53
|
-
if (this._eventListeners[typeString] &&
|
|
54
|
-
this._eventListeners[typeString].length !== 0) {
|
|
55
|
-
const cbs = this._eventListeners[typeString].map((el) => el.cb);
|
|
56
|
-
for (let i = 0; i < cbs.length; i++) {
|
|
57
|
-
cbs[i](event);
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
if (typeString.includes("."))
|
|
61
|
-
this.emitEvent(typeString.substr(0, typeString.indexOf(".")), event);
|
|
62
|
-
}
|
|
63
|
-
/**
|
|
64
|
-
* Removes a listener with the specified token.
|
|
65
|
-
*
|
|
66
|
-
* @param token the token of the listener
|
|
67
|
-
* @returns result of the targeted operation
|
|
68
|
-
*/
|
|
69
|
-
removeListener(token) {
|
|
70
|
-
for (const type in viewer_shared_types_1.EVENTTYPE) {
|
|
71
|
-
const subEventType = viewer_shared_types_1.EVENTTYPE[type];
|
|
72
|
-
const typeLowerCase = type.toLowerCase();
|
|
73
|
-
for (let i = 0; i < this._eventListeners[typeLowerCase].length; i++) {
|
|
74
|
-
if (this._eventListeners[typeLowerCase][i].token === token) {
|
|
75
|
-
this._eventListeners[typeLowerCase].splice(i, 1);
|
|
76
|
-
return true;
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
for (const subtype in subEventType) {
|
|
80
|
-
for (let i = 0; i <
|
|
81
|
-
this._eventListeners[subEventType[subtype]].length; i++) {
|
|
82
|
-
if (this._eventListeners[subEventType[subtype]][i].token === token) {
|
|
83
|
-
this._eventListeners[subEventType[subtype]].splice(i, 1);
|
|
84
|
-
return true;
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
return false;
|
|
90
|
-
}
|
|
91
|
-
// #endregion Public Methods (3)
|
|
92
|
-
// #region Private Methods (1)
|
|
93
|
-
convertTypeToString(type) {
|
|
94
|
-
let typeString = "";
|
|
95
|
-
if (typeof type === "string")
|
|
96
|
-
typeString = type;
|
|
97
|
-
for (const mainType in viewer_shared_types_1.EVENTTYPE)
|
|
98
|
-
if (type === viewer_shared_types_1.EVENTTYPE[mainType])
|
|
99
|
-
typeString = mainType.toLowerCase();
|
|
100
|
-
if (!typeString || !this._eventListeners[typeString]) {
|
|
101
|
-
this._logger.warn("EventEngine.convertTypeToString: No valid type provided.");
|
|
102
|
-
return "";
|
|
103
|
-
}
|
|
104
|
-
return typeString;
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
exports.EventEngine = EventEngine;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.EventEngine = void 0;
|
|
4
|
+
const viewer_shared_types_1 = require("@shapediver/viewer.shared.types");
|
|
5
|
+
const Logger_1 = require("../logger/Logger");
|
|
6
|
+
const UuidGenerator_1 = require("../uuid-generator/UuidGenerator");
|
|
7
|
+
class EventEngine {
|
|
8
|
+
// #endregion Properties (4)
|
|
9
|
+
// #region Constructors (1)
|
|
10
|
+
constructor() {
|
|
11
|
+
this._logger = Logger_1.Logger.instance;
|
|
12
|
+
this._uuidGenerator = UuidGenerator_1.UuidGenerator.instance;
|
|
13
|
+
this._eventListeners = {};
|
|
14
|
+
for (const type in viewer_shared_types_1.EVENTTYPE) {
|
|
15
|
+
const subEventType = viewer_shared_types_1.EVENTTYPE[type];
|
|
16
|
+
this._eventListeners[type.toLowerCase()] = [];
|
|
17
|
+
for (const subtype in subEventType) {
|
|
18
|
+
this._eventListeners[subEventType[subtype]] = [];
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
// #endregion Constructors (1)
|
|
23
|
+
// #region Public Static Accessors (1)
|
|
24
|
+
static get instance() {
|
|
25
|
+
return this._instance || (this._instance = new this());
|
|
26
|
+
}
|
|
27
|
+
// #endregion Public Static Accessors (1)
|
|
28
|
+
// #region Public Methods (3)
|
|
29
|
+
/**
|
|
30
|
+
* Adds a listener that listenes to the provided type. If no valid type is specified, an error is thrown.
|
|
31
|
+
*
|
|
32
|
+
* @param type the type of the event
|
|
33
|
+
* @param cb the callback that should be called
|
|
34
|
+
* @returns an unique token to be able to remove the listener
|
|
35
|
+
*/
|
|
36
|
+
addListener(type, cb) {
|
|
37
|
+
var _a;
|
|
38
|
+
const typeString = this.convertTypeToString(type);
|
|
39
|
+
if (!typeString)
|
|
40
|
+
return "";
|
|
41
|
+
const token = this._uuidGenerator.create();
|
|
42
|
+
(_a = this._eventListeners[typeString]) === null || _a === void 0 ? void 0 : _a.push({ token, cb });
|
|
43
|
+
return token;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Emits the event to all callbacks that listen to the type.
|
|
47
|
+
*
|
|
48
|
+
* @param type the type of the event
|
|
49
|
+
* @param event the event to emit
|
|
50
|
+
*/
|
|
51
|
+
emitEvent(type, event) {
|
|
52
|
+
const typeString = this.convertTypeToString(type);
|
|
53
|
+
if (this._eventListeners[typeString] &&
|
|
54
|
+
this._eventListeners[typeString].length !== 0) {
|
|
55
|
+
const cbs = this._eventListeners[typeString].map((el) => el.cb);
|
|
56
|
+
for (let i = 0; i < cbs.length; i++) {
|
|
57
|
+
cbs[i](event);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
if (typeString.includes("."))
|
|
61
|
+
this.emitEvent(typeString.substr(0, typeString.indexOf(".")), event);
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Removes a listener with the specified token.
|
|
65
|
+
*
|
|
66
|
+
* @param token the token of the listener
|
|
67
|
+
* @returns result of the targeted operation
|
|
68
|
+
*/
|
|
69
|
+
removeListener(token) {
|
|
70
|
+
for (const type in viewer_shared_types_1.EVENTTYPE) {
|
|
71
|
+
const subEventType = viewer_shared_types_1.EVENTTYPE[type];
|
|
72
|
+
const typeLowerCase = type.toLowerCase();
|
|
73
|
+
for (let i = 0; i < this._eventListeners[typeLowerCase].length; i++) {
|
|
74
|
+
if (this._eventListeners[typeLowerCase][i].token === token) {
|
|
75
|
+
this._eventListeners[typeLowerCase].splice(i, 1);
|
|
76
|
+
return true;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
for (const subtype in subEventType) {
|
|
80
|
+
for (let i = 0; i <
|
|
81
|
+
this._eventListeners[subEventType[subtype]].length; i++) {
|
|
82
|
+
if (this._eventListeners[subEventType[subtype]][i].token === token) {
|
|
83
|
+
this._eventListeners[subEventType[subtype]].splice(i, 1);
|
|
84
|
+
return true;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
return false;
|
|
90
|
+
}
|
|
91
|
+
// #endregion Public Methods (3)
|
|
92
|
+
// #region Private Methods (1)
|
|
93
|
+
convertTypeToString(type) {
|
|
94
|
+
let typeString = "";
|
|
95
|
+
if (typeof type === "string")
|
|
96
|
+
typeString = type;
|
|
97
|
+
for (const mainType in viewer_shared_types_1.EVENTTYPE)
|
|
98
|
+
if (type === viewer_shared_types_1.EVENTTYPE[mainType])
|
|
99
|
+
typeString = mainType.toLowerCase();
|
|
100
|
+
if (!typeString || !this._eventListeners[typeString]) {
|
|
101
|
+
this._logger.warn("EventEngine.convertTypeToString: No valid type provided.");
|
|
102
|
+
return "";
|
|
103
|
+
}
|
|
104
|
+
return typeString;
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
exports.EventEngine = EventEngine;
|
|
108
108
|
//# sourceMappingURL=EventEngine.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EventEngine.js","sourceRoot":"","sources":["../../src/event-engine/EventEngine.ts"],"names":[],"mappings":";;;AAAA,yEAIyC;AACzC,6CAAwC;AACxC,mEAA8D;AAI9D,MAAa,WAAW;IAYvB,4BAA4B;IAE5B,2BAA2B;IAE3B;QAPmB,YAAO,GAAW,eAAM,CAAC,QAAQ,CAAC;QAClC,mBAAc,GAAkB,6BAAa,CAAC,QAAQ,CAAC;QAOzE,IAAI,CAAC,eAAe,GAAG,EAAE,CAAC;QAC1B,KAAK,MAAM,IAAI,IAAI,+BAAS,EAAE;
|
|
1
|
+
{"version":3,"file":"EventEngine.js","sourceRoot":"","sources":["../../src/event-engine/EventEngine.ts"],"names":[],"mappings":";;;AAAA,yEAIyC;AACzC,6CAAwC;AACxC,mEAA8D;AAI9D,MAAa,WAAW;IAYvB,4BAA4B;IAE5B,2BAA2B;IAE3B;QAPmB,YAAO,GAAW,eAAM,CAAC,QAAQ,CAAC;QAClC,mBAAc,GAAkB,6BAAa,CAAC,QAAQ,CAAC;QAOzE,IAAI,CAAC,eAAe,GAAG,EAAE,CAAC;QAC1B,KAAK,MAAM,IAAI,IAAI,+BAAS,EAAE,CAAC;YAC9B,MAAM,YAAY,GAAG,+BAAS,CAAC,IAA8B,CAAC,CAAC;YAC/D,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC,GAAG,EAAE,CAAC;YAC9C,KAAK,MAAM,OAAO,IAAI,YAAY,EAAE,CAAC;gBACpC,IAAI,CAAC,eAAe,CACnB,YAAY,CAAC,OAAoC,CAA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AC;QACD,OAAO,KAAK,CAAC;IACd,CAAC;IAED,gCAAgC;IAEhC,8BAA8B;IAEtB,mBAAmB,CAAC,IAA6B;QACxD,IAAI,UAAU,GAAW,EAAE,CAAC;QAC5B,IAAI,OAAO,IAAI,KAAK,QAAQ;YAAE,UAAU,GAAG,IAAI,CAAC;QAEhD,KAAK,MAAM,QAAQ,IAAI,+BAAS;YAC/B,IAAI,IAAI,KAAK,+BAAS,CAAC,QAAkC,CAAC;gBACzD,UAAU,GAAG,QAAQ,CAAC,WAAW,EAAE,CAAC;QAEtC,IAAI,CAAC,UAAU,IAAI,CAAC,IAAI,CAAC,eAAe,CAAC,UAAU,CAAC,EAAE,CAAC;YACtD,IAAI,CAAC,OAAO,CAAC,IAAI,CAChB,0DAA0D,CAC1D,CAAC;YACF,OAAO,EAAE,CAAC;QACX,CAAC;QAED,OAAO,UAAU,CAAC;IACnB,CAAC;CAGD;AAtJD,kCAsJC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { IEvent } from "@shapediver/viewer.shared.types";
|
|
2
|
-
export interface ICallback {
|
|
3
|
-
(event: IEvent): void;
|
|
4
|
-
}
|
|
1
|
+
import { IEvent } from "@shapediver/viewer.shared.types";
|
|
2
|
+
export interface ICallback {
|
|
3
|
+
(event: IEvent): void;
|
|
4
|
+
}
|
|
5
5
|
//# sourceMappingURL=ICallback.d.ts.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
//# sourceMappingURL=ICallback.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { ICallback } from "./ICallback";
|
|
2
|
-
export interface IListener {
|
|
3
|
-
cb: ICallback;
|
|
4
|
-
token: string;
|
|
5
|
-
}
|
|
1
|
+
import { ICallback } from "./ICallback";
|
|
2
|
+
export interface IListener {
|
|
3
|
+
cb: ICallback;
|
|
4
|
+
token: string;
|
|
5
|
+
}
|
|
6
6
|
//# sourceMappingURL=IListener.d.ts.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
//# sourceMappingURL=IListener.js.map
|
|
@@ -1,107 +1,107 @@
|
|
|
1
|
-
import { SdGeometryError as ShapeDiverBackendError } from "@shapediver/sdk.geometry-api-sdk-v2";
|
|
2
|
-
import { AxiosRequestConfig } from "axios";
|
|
3
|
-
import { HttpResponse } from "./HttpResponse";
|
|
4
|
-
export declare class HttpClient {
|
|
5
|
-
private readonly _logger;
|
|
6
|
-
private static _instance;
|
|
7
|
-
private _dataCache;
|
|
8
|
-
private _enableCaching;
|
|
9
|
-
private _excludedQueryParameters;
|
|
10
|
-
private _maxCacheSize;
|
|
11
|
-
private _sessionLoading;
|
|
12
|
-
private constructor();
|
|
13
|
-
static get instance(): HttpClient;
|
|
14
|
-
get enableCaching(): boolean;
|
|
15
|
-
set enableCaching(value: boolean);
|
|
16
|
-
get excludedQueryParameters(): string[];
|
|
17
|
-
set excludedQueryParameters(value: string[]);
|
|
18
|
-
get maxCacheSize(): number;
|
|
19
|
-
set maxCacheSize(value: number);
|
|
20
|
-
/**
|
|
21
|
-
* Add the data loading options from a session.
|
|
22
|
-
*
|
|
23
|
-
* @param sessionId
|
|
24
|
-
* @param callbacks
|
|
25
|
-
*/
|
|
26
|
-
addDataLoading(sessionId: string, callbacks: {
|
|
27
|
-
getAsset: (url: string) => Promise<[ArrayBuffer, string]>;
|
|
28
|
-
downloadTexture: (url: string) => Promise<[ArrayBuffer, string]>;
|
|
29
|
-
}): void;
|
|
30
|
-
/**
|
|
31
|
-
* Maps the geometry backend error to the corresponding viewer errors:
|
|
32
|
-
* - ResError is mapped to ShapeDiverGeometryBackendResponseError
|
|
33
|
-
* - ReqError is mapped to ShapeDiverGeometryBackendRequestError
|
|
34
|
-
*
|
|
35
|
-
* Other error types are thrown as is.
|
|
36
|
-
*
|
|
37
|
-
* @param e
|
|
38
|
-
*/
|
|
39
|
-
convertError(err: ShapeDiverBackendError | Error | unknown): Promise<unknown>;
|
|
40
|
-
/**
|
|
41
|
-
* Get the requested resource either as a download or from the cache.
|
|
42
|
-
* If available, the registered session loading is used for download.
|
|
43
|
-
* Textures are downloaded via a specific endpoint and can be converted in this step as well.
|
|
44
|
-
* Depending on the provided caching options, the requested resource might already be cached.
|
|
45
|
-
*
|
|
46
|
-
* @param href
|
|
47
|
-
* @param config
|
|
48
|
-
* @param textureLoading
|
|
49
|
-
* @param textureConversion
|
|
50
|
-
* @returns
|
|
51
|
-
*/
|
|
52
|
-
get(href: string, config?: AxiosRequestConfig, textureLoading?: boolean): Promise<HttpResponse<unknown>>;
|
|
53
|
-
/**
|
|
54
|
-
* Get the requested texture either as a download or from the cache.
|
|
55
|
-
* If the texture is not available, undefined is returned.
|
|
56
|
-
*
|
|
57
|
-
* @param href The URL of the texture to load.
|
|
58
|
-
* @returns Either the texture as a buffer and blob or undefined if the texture could not be loaded.
|
|
59
|
-
*/
|
|
60
|
-
loadTexture(href: string): Promise<HttpResponse<{
|
|
61
|
-
image?: HTMLImageElement;
|
|
62
|
-
buffer: ArrayBuffer;
|
|
63
|
-
blob: Blob;
|
|
64
|
-
}>>;
|
|
65
|
-
/**
|
|
66
|
-
* Add the data loading options from a session.
|
|
67
|
-
*
|
|
68
|
-
* @param sessionId
|
|
69
|
-
*/
|
|
70
|
-
removeDataLoading(sessionId: string): void;
|
|
71
|
-
/**
|
|
72
|
-
* Add
|
|
73
|
-
*
|
|
74
|
-
* @param key
|
|
75
|
-
* @param value
|
|
76
|
-
*/
|
|
77
|
-
private addToCache;
|
|
78
|
-
/**
|
|
79
|
-
* Calculate the current cache size from all resolved promises.
|
|
80
|
-
*
|
|
81
|
-
* @returns
|
|
82
|
-
*/
|
|
83
|
-
private calculateCacheSize;
|
|
84
|
-
/**
|
|
85
|
-
* Get the value of an object from the cache.
|
|
86
|
-
*
|
|
87
|
-
* @param key
|
|
88
|
-
* @returns
|
|
89
|
-
*/
|
|
90
|
-
private getFromCache;
|
|
91
|
-
/**
|
|
92
|
-
* Get the session id of the provided href.
|
|
93
|
-
*
|
|
94
|
-
* @param href
|
|
95
|
-
* @returns
|
|
96
|
-
*/
|
|
97
|
-
private getSessionId;
|
|
98
|
-
/**
|
|
99
|
-
* Convert the provided href to a data cache key.
|
|
100
|
-
* In this conversion the excludedQueryParameters are removed from the href.
|
|
101
|
-
*
|
|
102
|
-
* @param href
|
|
103
|
-
* @returns
|
|
104
|
-
*/
|
|
105
|
-
private hrefToDataKey;
|
|
106
|
-
}
|
|
1
|
+
import { SdGeometryError as ShapeDiverBackendError } from "@shapediver/sdk.geometry-api-sdk-v2";
|
|
2
|
+
import { AxiosRequestConfig } from "axios";
|
|
3
|
+
import { HttpResponse } from "./HttpResponse";
|
|
4
|
+
export declare class HttpClient {
|
|
5
|
+
private readonly _logger;
|
|
6
|
+
private static _instance;
|
|
7
|
+
private _dataCache;
|
|
8
|
+
private _enableCaching;
|
|
9
|
+
private _excludedQueryParameters;
|
|
10
|
+
private _maxCacheSize;
|
|
11
|
+
private _sessionLoading;
|
|
12
|
+
private constructor();
|
|
13
|
+
static get instance(): HttpClient;
|
|
14
|
+
get enableCaching(): boolean;
|
|
15
|
+
set enableCaching(value: boolean);
|
|
16
|
+
get excludedQueryParameters(): string[];
|
|
17
|
+
set excludedQueryParameters(value: string[]);
|
|
18
|
+
get maxCacheSize(): number;
|
|
19
|
+
set maxCacheSize(value: number);
|
|
20
|
+
/**
|
|
21
|
+
* Add the data loading options from a session.
|
|
22
|
+
*
|
|
23
|
+
* @param sessionId
|
|
24
|
+
* @param callbacks
|
|
25
|
+
*/
|
|
26
|
+
addDataLoading(sessionId: string, callbacks: {
|
|
27
|
+
getAsset: (url: string) => Promise<[ArrayBuffer, string]>;
|
|
28
|
+
downloadTexture: (url: string) => Promise<[ArrayBuffer, string]>;
|
|
29
|
+
}): void;
|
|
30
|
+
/**
|
|
31
|
+
* Maps the geometry backend error to the corresponding viewer errors:
|
|
32
|
+
* - ResError is mapped to ShapeDiverGeometryBackendResponseError
|
|
33
|
+
* - ReqError is mapped to ShapeDiverGeometryBackendRequestError
|
|
34
|
+
*
|
|
35
|
+
* Other error types are thrown as is.
|
|
36
|
+
*
|
|
37
|
+
* @param e
|
|
38
|
+
*/
|
|
39
|
+
convertError(err: ShapeDiverBackendError | Error | unknown): Promise<unknown>;
|
|
40
|
+
/**
|
|
41
|
+
* Get the requested resource either as a download or from the cache.
|
|
42
|
+
* If available, the registered session loading is used for download.
|
|
43
|
+
* Textures are downloaded via a specific endpoint and can be converted in this step as well.
|
|
44
|
+
* Depending on the provided caching options, the requested resource might already be cached.
|
|
45
|
+
*
|
|
46
|
+
* @param href
|
|
47
|
+
* @param config
|
|
48
|
+
* @param textureLoading
|
|
49
|
+
* @param textureConversion
|
|
50
|
+
* @returns
|
|
51
|
+
*/
|
|
52
|
+
get(href: string, config?: AxiosRequestConfig, textureLoading?: boolean): Promise<HttpResponse<unknown>>;
|
|
53
|
+
/**
|
|
54
|
+
* Get the requested texture either as a download or from the cache.
|
|
55
|
+
* If the texture is not available, undefined is returned.
|
|
56
|
+
*
|
|
57
|
+
* @param href The URL of the texture to load.
|
|
58
|
+
* @returns Either the texture as a buffer and blob or undefined if the texture could not be loaded.
|
|
59
|
+
*/
|
|
60
|
+
loadTexture(href: string): Promise<HttpResponse<{
|
|
61
|
+
image?: HTMLImageElement;
|
|
62
|
+
buffer: ArrayBuffer;
|
|
63
|
+
blob: Blob;
|
|
64
|
+
}>>;
|
|
65
|
+
/**
|
|
66
|
+
* Add the data loading options from a session.
|
|
67
|
+
*
|
|
68
|
+
* @param sessionId
|
|
69
|
+
*/
|
|
70
|
+
removeDataLoading(sessionId: string): void;
|
|
71
|
+
/**
|
|
72
|
+
* Add
|
|
73
|
+
*
|
|
74
|
+
* @param key
|
|
75
|
+
* @param value
|
|
76
|
+
*/
|
|
77
|
+
private addToCache;
|
|
78
|
+
/**
|
|
79
|
+
* Calculate the current cache size from all resolved promises.
|
|
80
|
+
*
|
|
81
|
+
* @returns
|
|
82
|
+
*/
|
|
83
|
+
private calculateCacheSize;
|
|
84
|
+
/**
|
|
85
|
+
* Get the value of an object from the cache.
|
|
86
|
+
*
|
|
87
|
+
* @param key
|
|
88
|
+
* @returns
|
|
89
|
+
*/
|
|
90
|
+
private getFromCache;
|
|
91
|
+
/**
|
|
92
|
+
* Get the session id of the provided href.
|
|
93
|
+
*
|
|
94
|
+
* @param href
|
|
95
|
+
* @returns
|
|
96
|
+
*/
|
|
97
|
+
private getSessionId;
|
|
98
|
+
/**
|
|
99
|
+
* Convert the provided href to a data cache key.
|
|
100
|
+
* In this conversion the excludedQueryParameters are removed from the href.
|
|
101
|
+
*
|
|
102
|
+
* @param href
|
|
103
|
+
* @returns
|
|
104
|
+
*/
|
|
105
|
+
private hrefToDataKey;
|
|
106
|
+
}
|
|
107
107
|
//# sourceMappingURL=HttpClient.d.ts.map
|