Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@shapediver/viewer.shared.services

Package Overview
Dependencies
Maintainers
5
Versions
216
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@shapediver/viewer.shared.services - npm Package Compare versions

Comparing version 1.9.0 to 1.10.1

dist/logger/ShapeDiverError.d.ts

1

dist/converter/Converter.d.ts

@@ -6,3 +6,2 @@ import { vec3 } from 'gl-matrix';

toColorArray(color: string): number[];
combineImages(redChannel?: HTMLImageElement, greenChannel?: HTMLImageElement, blueChannel?: HTMLImageElement): HTMLImageElement;
toColor(color: any, defColorString?: string): string;

@@ -9,0 +8,0 @@ toVec3(point: any): vec3;

@@ -13,3 +13,2 @@ "use strict";

const tsyringe_1 = require("tsyringe");
const SDError_1 = require("../logger/SDError");
let Converter = class Converter {

@@ -30,101 +29,2 @@ tinyColorToString(color) {

}
combineImages(redChannel, greenChannel, blueChannel) {
if (!redChannel && !greenChannel && !blueChannel)
throw new SDError_1.SDError('No channels provided.');
if (redChannel && greenChannel && blueChannel) {
if (redChannel.width !== greenChannel.width || redChannel.width !== blueChannel.width || redChannel.height !== greenChannel.height || redChannel.height !== blueChannel.height)
throw new SDError_1.SDError('Image sizes are different.');
const image = redChannel;
const canvas = document.createElement("canvas");
canvas.width = image.width;
canvas.height = image.height;
const ctx = canvas.getContext("2d");
ctx.drawImage(image, 0, 0);
const imageDataR = ctx.getImageData(0, 0, canvas.width, canvas.height);
ctx.drawImage(greenChannel, 0, 0);
const imageDataG = ctx.getImageData(0, 0, canvas.width, canvas.height);
ctx.drawImage(blueChannel, 0, 0);
const imageDataB = ctx.getImageData(0, 0, canvas.width, canvas.height);
for (let i = 0; i < imageDataR.data.length; i += 4) {
imageDataR.data[i + 1] = imageDataG.data[i + 1];
imageDataR.data[i + 2] = imageDataB.data[i + 2];
}
ctx.putImageData(imageDataR, 0, 0);
const resultImage = document.createElement('img');
resultImage.src = canvas.toDataURL();
return resultImage;
}
else if (redChannel && blueChannel || redChannel && greenChannel || blueChannel && greenChannel) {
let mainImage, secondImage;
if (!greenChannel) {
mainImage = redChannel;
secondImage = blueChannel;
}
else if (!blueChannel) {
mainImage = redChannel;
secondImage = greenChannel;
}
else {
mainImage = greenChannel;
secondImage = blueChannel;
}
if (mainImage.width !== secondImage.width || mainImage.height !== secondImage.height)
throw new SDError_1.SDError('Image sizes are different.');
const image = mainImage;
const canvas = document.createElement("canvas");
canvas.width = image.width;
canvas.height = image.height;
const ctx = canvas.getContext("2d");
ctx.drawImage(image, 0, 0);
const imageDataMain = ctx.getImageData(0, 0, canvas.width, canvas.height);
ctx.drawImage(mainImage, 0, 0);
const imageDataSecond = ctx.getImageData(0, 0, canvas.width, canvas.height);
ctx.drawImage(secondImage, 0, 0);
for (let i = 0; i < imageDataMain.data.length; i += 4) {
if (!redChannel) {
imageDataMain.data[i + 0] = 255;
imageDataMain.data[i + 2] = imageDataSecond.data[i + 2];
}
if (!greenChannel) {
imageDataMain.data[i + 1] = 255;
imageDataMain.data[i + 2] = imageDataSecond.data[i + 2];
}
if (!blueChannel) {
imageDataMain.data[i + 1] = imageDataSecond.data[i + 2];
imageDataMain.data[i + 2] = 255;
}
}
ctx.putImageData(imageDataMain, 0, 0);
const resultImage = document.createElement('img');
resultImage.src = canvas.toDataURL();
return resultImage;
}
else {
const image = (redChannel || blueChannel || greenChannel);
const canvas = document.createElement("canvas");
canvas.width = image.width;
canvas.height = image.height;
const ctx = canvas.getContext("2d");
ctx.drawImage(image, 0, 0);
const imageData = ctx.getImageData(0, 0, canvas.width, canvas.height);
for (let i = 0; i < imageData.data.length; i += 4) {
if (redChannel) {
imageData.data[i + 1] = 255;
imageData.data[i + 2] = 255;
}
if (greenChannel) {
imageData.data[i + 0] = 255;
imageData.data[i + 2] = 255;
}
if (blueChannel) {
imageData.data[i + 0] = 255;
imageData.data[i + 1] = 255;
}
}
ctx.putImageData(imageData, 0, 0);
const resultImage = document.createElement('img');
resultImage.src = canvas.toDataURL();
return resultImage;
}
}
toColor(color, defColorString = '#00fff7') {

@@ -131,0 +31,0 @@ if (!color || color === 'default')

@@ -30,3 +30,7 @@ "use strict";

this._cache = {};
axios_1.default.interceptors.response.use(response => { return response; }, error => { throw error; });
axios_1.default.interceptors.response.use(response => {
return response;
}, error => {
throw error;
});
}

@@ -33,0 +37,0 @@ get(url, config) {

@@ -17,5 +17,6 @@ import { EventEngine } from './event-engine/EventEngine';

import { Logger, LOGGINGLEVEL, LOGGINGTOPIC } from './logger/Logger';
import { SDError } from './logger/SDError';
import { MimeTypeUtils } from './mime-type-utils/MimeTypeUtils';
import { StatePromise } from './state-engine/StatePromise';
import { ShapeDiverViewerArError, ShapeDiverViewerCameraError, ShapeDiverViewerDataProcessingError, ShapeDiverViewerEnvironmentMapError, ShapeDiverViewerError, ShapeDiverViewerLightError, ShapeDiverViewerSessionError, ShapeDiverViewerSettingsError, ShapeDiverViewerUnknownError, ShapeDiverViewerValidationError, ShapeDiverViewerViewerError, ShapeDiverViewerWebGLError } from './logger/ShapeDiverViewerError';
import { ShapeDiverError as ShapeDiverBackendError } from '@shapediver/sdk.geometry-api-sdk-core';
export { EventEngine, EVENTTYPE, MAINEVENTTYPE, IEvent };

@@ -32,5 +33,5 @@ export { SettingsEngine };

export { InputValidator };
export { Logger, LOGGINGLEVEL, LOGGINGTOPIC, SDError };
export { Logger, LOGGINGLEVEL, LOGGINGTOPIC, ShapeDiverViewerError, ShapeDiverViewerDataProcessingError, ShapeDiverViewerEnvironmentMapError, ShapeDiverViewerWebGLError, ShapeDiverViewerSettingsError, ShapeDiverViewerSessionError, ShapeDiverViewerViewerError, ShapeDiverViewerUnknownError, ShapeDiverViewerArError, ShapeDiverViewerLightError, ShapeDiverViewerCameraError, ShapeDiverViewerValidationError, ShapeDiverBackendError };
export { PerformanceEvaluator };
export { MimeTypeUtils };
//# sourceMappingURL=index.d.ts.map
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.MimeTypeUtils = exports.PerformanceEvaluator = exports.SDError = exports.LOGGINGTOPIC = exports.LOGGINGLEVEL = exports.Logger = exports.InputValidator = exports.TypeChecker = exports.Converter = exports.UuidGenerator = exports.ImageLoader = exports.HttpClient = exports.DomEventEngine = exports.SystemInfo = exports.StatePromise = exports.StateEngine = exports.SettingsEngine = exports.EVENTTYPE = exports.EventEngine = void 0;
exports.MimeTypeUtils = exports.PerformanceEvaluator = exports.ShapeDiverBackendError = exports.ShapeDiverViewerValidationError = exports.ShapeDiverViewerCameraError = exports.ShapeDiverViewerLightError = exports.ShapeDiverViewerArError = exports.ShapeDiverViewerUnknownError = exports.ShapeDiverViewerViewerError = exports.ShapeDiverViewerSessionError = exports.ShapeDiverViewerSettingsError = exports.ShapeDiverViewerWebGLError = exports.ShapeDiverViewerEnvironmentMapError = exports.ShapeDiverViewerDataProcessingError = exports.ShapeDiverViewerError = exports.LOGGINGTOPIC = exports.LOGGINGLEVEL = exports.Logger = exports.InputValidator = exports.TypeChecker = exports.Converter = exports.UuidGenerator = exports.ImageLoader = exports.HttpClient = exports.DomEventEngine = exports.SystemInfo = exports.StatePromise = exports.StateEngine = exports.SettingsEngine = exports.EVENTTYPE = exports.EventEngine = void 0;
const EventEngine_1 = require("./event-engine/EventEngine");

@@ -34,4 +34,2 @@ Object.defineProperty(exports, "EventEngine", { enumerable: true, get: function () { return EventEngine_1.EventEngine; } });

Object.defineProperty(exports, "LOGGINGTOPIC", { enumerable: true, get: function () { return Logger_1.LOGGINGTOPIC; } });
const SDError_1 = require("./logger/SDError");
Object.defineProperty(exports, "SDError", { enumerable: true, get: function () { return SDError_1.SDError; } });
const MimeTypeUtils_1 = require("./mime-type-utils/MimeTypeUtils");

@@ -41,2 +39,17 @@ Object.defineProperty(exports, "MimeTypeUtils", { enumerable: true, get: function () { return MimeTypeUtils_1.MimeTypeUtils; } });

Object.defineProperty(exports, "StatePromise", { enumerable: true, get: function () { return StatePromise_1.StatePromise; } });
const ShapeDiverViewerError_1 = require("./logger/ShapeDiverViewerError");
Object.defineProperty(exports, "ShapeDiverViewerArError", { enumerable: true, get: function () { return ShapeDiverViewerError_1.ShapeDiverViewerArError; } });
Object.defineProperty(exports, "ShapeDiverViewerCameraError", { enumerable: true, get: function () { return ShapeDiverViewerError_1.ShapeDiverViewerCameraError; } });
Object.defineProperty(exports, "ShapeDiverViewerDataProcessingError", { enumerable: true, get: function () { return ShapeDiverViewerError_1.ShapeDiverViewerDataProcessingError; } });
Object.defineProperty(exports, "ShapeDiverViewerEnvironmentMapError", { enumerable: true, get: function () { return ShapeDiverViewerError_1.ShapeDiverViewerEnvironmentMapError; } });
Object.defineProperty(exports, "ShapeDiverViewerError", { enumerable: true, get: function () { return ShapeDiverViewerError_1.ShapeDiverViewerError; } });
Object.defineProperty(exports, "ShapeDiverViewerLightError", { enumerable: true, get: function () { return ShapeDiverViewerError_1.ShapeDiverViewerLightError; } });
Object.defineProperty(exports, "ShapeDiverViewerSessionError", { enumerable: true, get: function () { return ShapeDiverViewerError_1.ShapeDiverViewerSessionError; } });
Object.defineProperty(exports, "ShapeDiverViewerSettingsError", { enumerable: true, get: function () { return ShapeDiverViewerError_1.ShapeDiverViewerSettingsError; } });
Object.defineProperty(exports, "ShapeDiverViewerUnknownError", { enumerable: true, get: function () { return ShapeDiverViewerError_1.ShapeDiverViewerUnknownError; } });
Object.defineProperty(exports, "ShapeDiverViewerValidationError", { enumerable: true, get: function () { return ShapeDiverViewerError_1.ShapeDiverViewerValidationError; } });
Object.defineProperty(exports, "ShapeDiverViewerViewerError", { enumerable: true, get: function () { return ShapeDiverViewerError_1.ShapeDiverViewerViewerError; } });
Object.defineProperty(exports, "ShapeDiverViewerWebGLError", { enumerable: true, get: function () { return ShapeDiverViewerError_1.ShapeDiverViewerWebGLError; } });
const sdk_geometry_api_sdk_core_1 = require("@shapediver/sdk.geometry-api-sdk-core");
Object.defineProperty(exports, "ShapeDiverBackendError", { enumerable: true, get: function () { return sdk_geometry_api_sdk_core_1.ShapeDiverError; } });
//# sourceMappingURL=index.js.map

@@ -16,3 +16,3 @@ "use strict";

const Logger_1 = require("../logger/Logger");
const SDError_1 = require("../logger/SDError");
const ShapeDiverViewerError_1 = require("../logger/ShapeDiverViewerError");
const TypeChecker_1 = require("../type-check/TypeChecker");

@@ -28,5 +28,4 @@ let InputValidator = class InputValidator {

return;
const error = new SDError_1.SDError(`${scope}: Input could not be validated. ${value} is not of type ${type}.${defined === false ? ' (Can also be undefined)' : ''}`);
this._logger.warn(topic, error.message);
throw error;
const error = new ShapeDiverViewerError_1.ShapeDiverViewerValidationError(`${scope}: Input could not be validated. ${value} is not of type ${type}.${defined === false ? ' (Can also be undefined)' : ''}`, value, type);
throw this._logger.handleError(Logger_1.LOGGINGTOPIC.GENERAL, 'InputValidator.validateAndError', error);
}

@@ -33,0 +32,0 @@ validate(value, stringLiteral, defined = true, enumValues = []) {

@@ -0,1 +1,4 @@

import * as Sentry from '@sentry/browser';
import { ShapeDiverError as ShapeDiverBackendError } from '@shapediver/sdk.geometry-api-sdk-core';
import { ShapeDiverViewerError } from './ShapeDiverViewerError';
export declare enum LOGGINGLEVEL {

@@ -42,4 +45,5 @@ NONE = "none",

private canLog;
private sentryError;
private sentryBreadcrumb;
handleError(topic: LOGGINGTOPIC, scope: string, e: ShapeDiverBackendError | ShapeDiverViewerError | Error): void;
sentryError(topic: LOGGINGTOPIC, error: ShapeDiverBackendError | ShapeDiverViewerError | Error, msg?: string): void;
sentryBreadcrumb(topic: LOGGINGTOPIC, msg: string, level: Sentry.Severity): void;
debug(topic: LOGGINGTOPIC, msg: string): void;

@@ -50,9 +54,7 @@ debugHigh(topic: LOGGINGTOPIC, msg: string): void;

error(topic: LOGGINGTOPIC, error: Error, msg?: string, throwError?: boolean, notifySentry?: boolean): void;
httpError(topic: LOGGINGTOPIC, error: Error, msg: string, httpError: number, throwError?: boolean): void;
fatal(topic: LOGGINGTOPIC, msg: string, error: Error, throwError?: boolean): void;
info(topic: LOGGINGTOPIC, msg: string): void;
warn(topic: LOGGINGTOPIC, msg: string): void;
private httpErrorHelper;
private messageConstruction;
}
//# sourceMappingURL=Logger.d.ts.map

@@ -35,5 +35,6 @@ "use strict";

const viewer_shared_build_data_1 = require("@shapediver/viewer.shared.build-data");
const sdk_geometry_api_sdk_core_1 = require("@shapediver/sdk.geometry-api-sdk-core");
const UuidGenerator_1 = require("../uuid-generator/UuidGenerator");
const SDError_1 = require("./SDError");
const browser_1 = require("@sentry/browser");
const ShapeDiverViewerError_1 = require("./ShapeDiverViewerError");
var LOGGINGLEVEL;

@@ -76,35 +77,2 @@ (function (LOGGINGLEVEL) {

this._userId = this._uuidGenerator.create();
const oldConsoleDebug = console.debug;
console.debug = (...data) => {
if (data && Array.isArray(data) && typeof data[0] === 'string' && data[0].startsWith('THREE'))
return;
oldConsoleDebug(...data);
};
const oldConsoleInfo = console.info;
console.info = (...data) => {
if (data && Array.isArray(data) && typeof data[0] === 'string' && data[0].startsWith('THREE'))
return;
oldConsoleInfo(...data);
};
const oldConsoleLog = console.log;
console.log = (...data) => {
if (data && Array.isArray(data) && typeof data[0] === 'string' && data[0].startsWith('THREE'))
return;
oldConsoleLog(...data);
};
const oldConsoleWarn = console.warn;
console.warn = (...data) => {
if (data && Array.isArray(data) && typeof data[0] === 'string' && data[0].startsWith('THREE'))
return;
oldConsoleWarn(...data);
};
const oldConsoleError = console.error;
console.error = (...data) => {
if (data && Array.isArray(data) && typeof data[0] === 'string' && data[0].startsWith('THREE')) {
this.error(LOGGINGTOPIC.THREE, new SDError_1.SDError(data[0]), data[0]);
return;
}
;
oldConsoleError(...data);
};
const client = new browser_1.BrowserClient({

@@ -207,2 +175,18 @@ dsn: "https://0510990697b04b9da3ad07868e94e378@o363881.ingest.sentry.io/5828729",

}
handleError(topic, scope, e) {
if (e instanceof sdk_geometry_api_sdk_core_1.ShapeDiverError) {
throw e;
}
else if (e instanceof ShapeDiverViewerError_1.ShapeDiverViewerError) {
const messageProperty = e && e.message ? e.message : `An unknown issue occurred in ${scope}.`;
this.sentryError(topic, e, messageProperty);
throw e;
}
else if (e) {
const messageProperty = e.message ? e.message : `An unknown issue occurred in ${scope}.`;
const viewerError = new ShapeDiverViewerError_1.ShapeDiverViewerUnknownError(messageProperty, e);
this.sentryError(topic, viewerError, messageProperty);
throw viewerError;
}
}
sentryError(topic, error, msg) {

@@ -223,3 +207,8 @@ var _a;

this._sentryHub.setUser({ id: this._userId });
this._sentryHub.captureException(error);
if (error instanceof Error) {
this._sentryHub.captureException(error);
}
else {
this._sentryHub.captureMessage(error.message, Sentry.Severity.Error);
}
}

@@ -263,6 +252,2 @@ sentryBreadcrumb(topic, msg, level) {

}
httpError(topic, error, msg, httpError, throwError = false) {
this.sentryBreadcrumb(topic, msg, Sentry.Severity.Error);
this.httpErrorHelper(topic, msg, error, httpError, throwError, false);
}
fatal(topic, msg, error, throwError = false) {

@@ -286,244 +271,2 @@ this.sentryBreadcrumb(topic, msg, Sentry.Severity.Fatal);

}
httpErrorHelper(topic, msg, error, httpError, throwError = false, notifySentry = false) {
if (httpError.toString()[0] === '1') {
if (this.canLog(LOGGINGLEVEL.INFO) && this.showMessages === true)
switch (httpError) {
case 100:
this.info(topic, msg + '\n' + 'Http-Code ' + httpError + ': Continue. ' + error.message);
break;
case 101:
this.info(topic, msg + '\n' + 'Http-Code ' + httpError + ': Switching Protocols. ' + error.message);
break;
case 102:
this.info(topic, msg + '\n' + 'Http-Code ' + httpError + ': Processing. ' + error.message);
break;
case 103:
this.info(topic, msg + '\n' + 'Http-Code ' + httpError + ': Early Hints. ' + error.message);
break;
default:
this.info(topic, msg + '\n' + 'Http-Code ' + httpError + ': Unknown Informational Response. ' + error.message);
}
}
else if (httpError.toString()[0] === '2') {
if (this.canLog(LOGGINGLEVEL.INFO) && this.showMessages === true)
switch (httpError) {
case 200:
this.info(topic, msg + '\n' + 'Http-Code ' + httpError + ': OK. ' + error.message);
break;
case 201:
this.info(topic, msg + '\n' + 'Http-Code ' + httpError + ': Created. ' + error.message);
break;
case 202:
this.info(topic, msg + '\n' + 'Http-Code ' + httpError + ': Accepted. ' + error.message);
break;
case 203:
this.info(topic, msg + '\n' + 'Http-Code ' + httpError + ': Non-Authoritative Information. ' + error.message);
break;
case 204:
this.info(topic, msg + '\n' + 'Http-Code ' + httpError + ': No Content. ' + error.message);
break;
case 205:
this.info(topic, msg + '\n' + 'Http-Code ' + httpError + ': Reset Content. ' + error.message);
break;
case 206:
this.info(topic, msg + '\n' + 'Http-Code ' + httpError + ': Partial Content. ' + error.message);
break;
case 207:
this.info(topic, msg + '\n' + 'Http-Code ' + httpError + ': Multi-Status. ' + error.message);
break;
case 208:
this.info(topic, msg + '\n' + 'Http-Code ' + httpError + ': Already Reported. ' + error.message);
break;
case 226:
this.info(topic, msg + '\n' + 'Http-Code ' + httpError + ': IM Used. ' + error.message);
break;
default:
this.info(topic, msg + '\n' + 'Http-Code ' + httpError + ': Unknown Success Message. ' + error.message);
}
}
else if (httpError.toString()[0] === '3') {
if (this.canLog(LOGGINGLEVEL.WARN) && this.showMessages === true)
switch (httpError) {
case 300:
this.warn(topic, msg + '\n' + 'Http-Code ' + httpError + ': Multiple Choices. ' + error.message);
break;
case 301:
this.warn(topic, msg + '\n' + 'Http-Code ' + httpError + ': Moved Permanently. ' + error.message);
break;
case 302:
this.warn(topic, msg + '\n' + 'Http-Code ' + httpError + ': Found (Previously "Moved temporarily"). ' + error.message);
break;
case 303:
this.warn(topic, msg + '\n' + 'Http-Code ' + httpError + ': See Other. ' + error.message);
break;
case 304:
this.warn(topic, msg + '\n' + 'Http-Code ' + httpError + ': Not Modified. ' + error.message);
break;
case 305:
this.warn(topic, msg + '\n' + 'Http-Code ' + httpError + ': Use Proxy. ' + error.message);
break;
case 306:
this.warn(topic, msg + '\n' + 'Http-Code ' + httpError + ': Switch Proxy. ' + error.message);
break;
case 307:
this.warn(topic, msg + '\n' + 'Http-Code ' + httpError + ': Temporary Redirect. ' + error.message);
break;
case 308:
this.warn(topic, msg + '\n' + 'Http-Code ' + httpError + ': Permanent Redirect. ' + error.message);
break;
default:
this.warn(topic, msg + '\n' + 'Http-Code ' + httpError + ': Unknown Redirection Error. ' + error.message);
}
}
else if (httpError.toString()[0] === '4') {
if (this.canLog(LOGGINGLEVEL.ERROR) && this.showMessages === true)
switch (httpError) {
case 400:
this.error(topic, error, msg + '\n' + 'Http-Code ' + httpError + ': Bad Request. ' + error.message, throwError, notifySentry);
break;
case 401:
this.error(topic, error, msg + '\n' + 'Http-Code ' + httpError + ': Unauthorized. ' + error.message, throwError, notifySentry);
break;
case 402:
this.error(topic, error, msg + '\n' + 'Http-Code ' + httpError + ': Payment Required. ' + error.message, throwError, notifySentry);
break;
case 403:
this.error(topic, error, msg + '\n' + 'Http-Code ' + httpError + ': Forbidden. ' + error.message, throwError, notifySentry);
break;
case 404:
this.error(topic, error, msg + '\n' + 'Http-Code ' + httpError + ': Not Found. ' + error.message, throwError, notifySentry);
break;
case 405:
this.error(topic, error, msg + '\n' + 'Http-Code ' + httpError + ': Method Not Allowed. ' + error.message, throwError, notifySentry);
break;
case 406:
this.error(topic, error, msg + '\n' + 'Http-Code ' + httpError + ': Not Acceptable. ' + error.message, throwError, notifySentry);
break;
case 407:
this.error(topic, error, msg + '\n' + 'Http-Code ' + httpError + ': Proxy Authentication Required. ' + error.message, throwError, notifySentry);
break;
case 408:
this.error(topic, error, msg + '\n' + 'Http-Code ' + httpError + ': Request Timeout. ' + error.message, throwError, notifySentry);
break;
case 409:
this.error(topic, error, msg + '\n' + 'Http-Code ' + httpError + ': Conflict. ' + error.message, throwError, notifySentry);
break;
case 410:
this.error(topic, error, msg + '\n' + 'Http-Code ' + httpError + ': Gone. ' + error.message, throwError, notifySentry);
break;
case 411:
this.error(topic, error, msg + '\n' + 'Http-Code ' + httpError + ': Length Required. ' + error.message, throwError, notifySentry);
break;
case 412:
this.error(topic, error, msg + '\n' + 'Http-Code ' + httpError + ': Precondition Failed. ' + error.message, throwError, notifySentry);
break;
case 413:
this.error(topic, error, msg + '\n' + 'Http-Code ' + httpError + ': Payload Too Large. ' + error.message, throwError, notifySentry);
break;
case 414:
this.error(topic, error, msg + '\n' + 'Http-Code ' + httpError + ': URI Too Long. ' + error.message, throwError, notifySentry);
break;
case 415:
this.error(topic, error, msg + '\n' + 'Http-Code ' + httpError + ': Unsupported Media Type. ' + error.message, throwError, notifySentry);
break;
case 416:
this.error(topic, error, msg + '\n' + 'Http-Code ' + httpError + ': Range Not Satisfiable. ' + error.message, throwError, notifySentry);
break;
case 417:
this.error(topic, error, msg + '\n' + 'Http-Code ' + httpError + ': Expectation Failed. ' + error.message, throwError, notifySentry);
break;
case 421:
this.error(topic, error, msg + '\n' + 'Http-Code ' + httpError + ': Misdirected Request. ' + error.message, throwError, notifySentry);
break;
case 422:
this.error(topic, error, msg + '\n' + 'Http-Code ' + httpError + ': Unprocessable Entity. ' + error.message, throwError, notifySentry);
break;
case 423:
this.error(topic, error, msg + '\n' + 'Http-Code ' + httpError + ': Locked. ' + error.message, throwError, notifySentry);
break;
case 424:
this.error(topic, error, msg + '\n' + 'Http-Code ' + httpError + ': Failed Dependency. ' + error.message, throwError, notifySentry);
break;
case 425:
this.error(topic, error, msg + '\n' + 'Http-Code ' + httpError + ': Too Early. ' + error.message, throwError, notifySentry);
break;
case 426:
this.error(topic, error, msg + '\n' + 'Http-Code ' + httpError + ': Upgrade Required. ' + error.message, throwError, notifySentry);
break;
case 428:
this.error(topic, error, msg + '\n' + 'Http-Code ' + httpError + ': Precondition Required. ' + error.message, throwError, notifySentry);
break;
case 429:
this.error(topic, error, msg + '\n' + 'Http-Code ' + httpError + ': Too Many Requests. ' + error.message, throwError, notifySentry);
break;
case 431:
this.error(topic, error, msg + '\n' + 'Http-Code ' + httpError + ': Request Header Fields Too Large. ' + error.message, throwError, notifySentry);
break;
case 451:
this.error(topic, error, msg + '\n' + 'Http-Code ' + httpError + ': Unavailable For Legal Reasons. ' + error.message, throwError, notifySentry);
break;
case 418:
this.error(topic, error, msg + '\n' + 'Http-Code ' + httpError + ': I\'m a teapot. ' + error.message, throwError, notifySentry);
break;
case 420:
this.error(topic, error, msg + '\n' + 'Http-Code ' + httpError + ': Policy Not Fulfilled. ' + error.message, throwError, notifySentry);
break;
case 444:
this.error(topic, error, msg + '\n' + 'Http-Code ' + httpError + ': No Response. ' + error.message, throwError, notifySentry);
break;
case 449:
this.error(topic, error, msg + '\n' + 'Http-Code ' + httpError + ': The request should be retried after doing the appropriate action. ' + error.message, throwError, notifySentry);
break;
case 499:
this.error(topic, error, msg + '\n' + 'Http-Code ' + httpError + ': Client Closed Request. ' + error.message, throwError, notifySentry);
break;
default:
this.error(topic, error, msg + '\n' + 'Http-Code ' + httpError + ': Unknown Client Error. ' + error.message, throwError, notifySentry);
}
}
else if (httpError.toString()[0] === '5') {
if (this.canLog(LOGGINGLEVEL.INFO) && this.showMessages === true)
switch (httpError) {
case 500:
this.error(topic, error, msg + '\n' + 'Http-Code ' + httpError + ': Internal Server Error. ' + error.message, throwError, notifySentry);
break;
case 501:
this.error(topic, error, msg + '\n' + 'Http-Code ' + httpError + ': Not Implemented. ' + error.message, throwError, notifySentry);
break;
case 502:
this.error(topic, error, msg + '\n' + 'Http-Code ' + httpError + ': Bad Gateway. ' + error.message, throwError, notifySentry);
break;
case 503:
this.error(topic, error, msg + '\n' + 'Http-Code ' + httpError + ': Service Unavailable. ' + error.message, throwError, notifySentry);
break;
case 504:
this.error(topic, error, msg + '\n' + 'Http-Code ' + httpError + ': Gateway Timeout. ' + error.message, throwError, notifySentry);
break;
case 505:
this.error(topic, error, msg + '\n' + 'Http-Code ' + httpError + ': HTTP Version Not Supported. ' + error.message, throwError, notifySentry);
break;
case 506:
this.error(topic, error, msg + '\n' + 'Http-Code ' + httpError + ': Variant Also Negotiates. ' + error.message, throwError, notifySentry);
break;
case 507:
this.error(topic, error, msg + '\n' + 'Http-Code ' + httpError + ': Insufficient Storage. ' + error.message, throwError, notifySentry);
break;
case 508:
this.error(topic, error, msg + '\n' + 'Http-Code ' + httpError + ': Loop Detected. ' + error.message, throwError, notifySentry);
break;
case 510:
this.error(topic, error, msg + '\n' + 'Http-Code ' + httpError + ': Not Extended. ' + error.message, throwError, notifySentry);
break;
case 511:
this.error(topic, error, msg + '\n' + 'Http-Code ' + httpError + ': Network Authentication Required. ' + error.message, throwError, notifySentry);
break;
default:
this.error(topic, error, msg + '\n' + 'Http-Code ' + httpError + ': Unknown Server Error. ' + error.message, throwError, notifySentry);
}
}
else {
if (this.canLog(LOGGINGLEVEL.INFO) && this.showMessages === true)
this.error(topic, error, msg + '\n' + 'Http-Code ' + httpError + ': Unknown Error Code. ' + error.message, throwError, notifySentry);
}
}
messageConstruction(msg) {

@@ -530,0 +273,0 @@ return new Date().toISOString() + ': ' + msg;

@@ -14,3 +14,3 @@ import { ISettingsV3 } from '@shapediver/viewer.settings';

private readonly _settings;
private _version?;
private _settings_version?;
get ar(): IARSettings;

@@ -17,0 +17,0 @@ get camera(): ICameraSettings;

@@ -14,3 +14,3 @@ "use strict";

const Logger_1 = require("../logger/Logger");
const SDError_1 = require("../logger/SDError");
const ShapeDiverViewerError_1 = require("../logger/ShapeDiverViewerError");
let SettingsEngine = class SettingsEngine {

@@ -53,3 +53,3 @@ constructor() {

convertToTargetVersion() {
return viewer_settings_1.convert(this._settings, this._version || '3.0');
return viewer_settings_1.convert(this._settings, '3.0');
}

@@ -81,30 +81,37 @@ flatten() {

try {
viewer_settings_1.validate(json, '3.0');
this._version = '3.0';
viewer_settings_1.validate(json, '1.0');
this._settings_version = '1.0';
this._settings = viewer_settings_1.convert(json, '3.0');
this.cleanSettings(this._settings);
return;
}
catch (e) {
if (!(e.message && e.message.includes('The settings do have a different version than the target version.')))
this._logger.error(Logger_1.LOGGINGTOPIC.SETTINGS, new SDError_1.SDError(e.message, e), 'Settings could not be validated.', false, true);
}
catch (e) { }
try {
viewer_settings_1.validate(json, '2.0');
this._version = '2.0';
this._settings_version = '2.0';
this._settings = viewer_settings_1.convert(json, '3.0');
this.cleanSettings(this._settings);
return;
}
catch (e) { }
try {
viewer_settings_1.validate(json, '1.0');
this._version = '1.0';
viewer_settings_1.validate(json, '3.0');
this._settings_version = '3.0';
this._settings = viewer_settings_1.convert(json, '3.0');
this.cleanSettings(this._settings);
return;
}
catch (e) { }
catch (e) {
const error = new ShapeDiverViewerError_1.ShapeDiverViewerSettingsError('SettingsEngine.loadSettings: Settings could not be validated.', e);
throw this._logger.handleError(Logger_1.LOGGINGTOPIC.SETTINGS, `SettingsEngine.loadSettings`, error);
}
}
if (!this._version) {
this._version = '3.0';
else {
this._settings_version = '3.0';
this._settings = viewer_settings_1.DefaultsV3();
return;
}
else {
this._settings = viewer_settings_1.convert(json, '3.0');
this.cleanSettings(this._settings);
}
}
reset() {
this._settings_version = undefined;
this._settings = viewer_settings_1.DefaultsV3();

@@ -111,0 +118,0 @@ }

{
"name": "@shapediver/viewer.shared.services",
"version": "1.9.0",
"version": "1.10.1",
"description": "",

@@ -42,4 +42,5 @@ "keywords": [],

"@sentry/tracing": "^6.7.2",
"@shapediver/sdk.geometry-api-sdk-v2": "^1.0.11",
"@shapediver/viewer.settings": "*",
"@shapediver/viewer.shared.build-data": "^1.9.0",
"@shapediver/viewer.shared.build-data": "^1.10.1",
"@types/dompurify": "^2.3.1",

@@ -55,3 +56,3 @@ "@types/ua-parser-js": "^0.7.36",

},
"gitHead": "fe27c1e7a529779c4476b683101a5bf69c521d1b"
"gitHead": "513c269ddfe0719331a605a9c62de0b8a64328fd"
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc