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

@shapediver/sdk.platform-api-sdk-v1

Package Overview
Dependencies
Maintainers
5
Versions
75
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@shapediver/sdk.platform-api-sdk-v1 - npm Package Compare versions

Comparing version 2.18.12 to 2.23.0

31

dist/api/SdPlatformSdkErrorMapping.js

@@ -21,2 +21,5 @@ "use strict";

}
function period(message) {
return message.endsWith(".") ? message : message + ".";
}
/**

@@ -40,31 +43,37 @@ * Maps the given error into a ShapeDiver API response error object.

if (data.error == "invalid_client") {
return new SdPlatformErrors_1.SdPlatformInvalidClientOAuthResponseError(`${data.error}. ${data.error_description}.`, axiosError.response.status, data.error, data.error_description, data.error_uri);
return new SdPlatformErrors_1.SdPlatformInvalidClientOAuthResponseError(`${period(data.error)} ${period(data.error_description)}`, axiosError.response.status, data.error, data.error_description, data.error_uri);
}
else if (data.error == "invalid_request") {
return new SdPlatformErrors_1.SdPlatformInvalidRequestOAuthResponseError(`${data.error}. ${data.error_description}.`, axiosError.response.status, data.error, data.error_description, data.error_uri);
return new SdPlatformErrors_1.SdPlatformInvalidRequestOAuthResponseError(`${period(data.error)} ${period(data.error_description)}`, axiosError.response.status, data.error, data.error_description, data.error_uri);
}
else if (data.error == "invalid_grant") {
return new SdPlatformErrors_1.SdPlatformInvalidGrantOAuthResponseError(`${data.error}. ${data.error_description}.`, axiosError.response.status, data.error, data.error_description, data.error_uri);
return new SdPlatformErrors_1.SdPlatformInvalidGrantOAuthResponseError(`${period(data.error)} ${period(data.error_description)}`, axiosError.response.status, data.error, data.error_description, data.error_uri);
}
else if (data.error == "unauthorized_client") {
return new SdPlatformErrors_1.SdPlatformUnauthorizedClientOAuthResponseError(`${data.error}. ${data.error_description}.`, axiosError.response.status, data.error, data.error_description, data.error_uri);
return new SdPlatformErrors_1.SdPlatformUnauthorizedClientOAuthResponseError(`${period(data.error)} ${period(data.error_description)}`, axiosError.response.status, data.error, data.error_description, data.error_uri);
}
else if (data.error == "unsupported_grant_type") {
return new SdPlatformErrors_1.SdPlatformUnsupportedGrantTypeClientOAuthResponseError(`${data.error}. ${data.error_description}.`, axiosError.response.status, data.error, data.error_description, data.error_uri);
return new SdPlatformErrors_1.SdPlatformUnsupportedGrantTypeClientOAuthResponseError(`${period(data.error)} ${period(data.error_description)}`, axiosError.response.status, data.error, data.error_description, data.error_uri);
}
return new SdPlatformErrors_1.SdPlatformOAuthResponseError(`${data.error}. ${data.error_description}.`, axiosError.response.status, data.error, data.error_description, data.error_uri);
return new SdPlatformErrors_1.SdPlatformOAuthResponseError(`${period(data.error)} ${period(data.error_description)}`, axiosError.response.status, data.error, data.error_description, data.error_uri);
}
else if (data && isResourceResponseError(data)) {
if (isValidationError(data)) {
return new SdPlatformErrors_1.SdPlatformValidationResponseError(`${data.error.message}. ${data.error.description}.`, axiosError.response.status, data.error.message, data.error.description, data.error.href, data.error.code, data.error.fields);
const fields = Object.entries(data.error.fields).reduce((acc, [key, value]) => {
acc[key] = Array.isArray(value) ? value : [value];
return acc;
}, {});
const fieldsMessage = Object.values(fields).map((msgs) => msgs.map(m => period(m)).join(" ")).join(" ");
const message = `${period(data.error.message)} ${period(data.error.description)}`;
return new SdPlatformErrors_1.SdPlatformValidationResponseError(fieldsMessage ? `${message} ${fieldsMessage}` : message, axiosError.response.status, data.error.message, data.error.description, data.error.href, data.error.code, fields);
}
switch (axiosError.response.status) {
case 404:
return new SdPlatformErrors_1.SdPlatformNotFoundResponseError(`${data.error.message}. ${data.error.description}.`, axiosError.response.status, data.error.message, data.error.description, data.error.href, data.error.code);
return new SdPlatformErrors_1.SdPlatformNotFoundResponseError(`${period(data.error.message)} ${period(data.error.description)}`, axiosError.response.status, data.error.message, data.error.description, data.error.href, data.error.code);
case 403:
return new SdPlatformErrors_1.SdPlatformForbiddenResponseError(`${data.error.message}. ${data.error.description}.`, axiosError.response.status, data.error.message, data.error.description, data.error.href, data.error.code);
return new SdPlatformErrors_1.SdPlatformForbiddenResponseError(`${period(data.error.message)} ${period(data.error.description)}`, axiosError.response.status, data.error.message, data.error.description, data.error.href, data.error.code);
case 401:
return new SdPlatformErrors_1.SdPlatformUnauthorizedResponseError(`${data.error.message}. ${data.error.description}.`, axiosError.response.status, data.error.message, data.error.description, data.error.href, data.error.code);
return new SdPlatformErrors_1.SdPlatformUnauthorizedResponseError(`${period(data.error.message)} ${period(data.error.description)}`, axiosError.response.status, data.error.message, data.error.description, data.error.href, data.error.code);
default:
return new SdPlatformErrors_1.SdPlatformResourceResponseError(`${data.error.message}. ${data.error.description}.`, axiosError.response.status, data.error.message, data.error.description, data.error.href, data.error.code);
return new SdPlatformErrors_1.SdPlatformResourceResponseError(`${period(data.error.message)} ${period(data.error.description)}`, axiosError.response.status, data.error.message, data.error.description, data.error.href, data.error.code);
}

@@ -71,0 +80,0 @@ }

{
"name": "@shapediver/sdk.platform-api-sdk-v1",
"version": "2.18.12",
"version": "2.23.0",
"description": "SDK to communicate with the Platform API version 1",

@@ -41,3 +41,3 @@ "keywords": [

"dependencies": {
"@shapediver/api.platform-api-dto-v1": "~2.18.12",
"@shapediver/api.platform-api-dto-v1": "~2.23.0",
"@shapediver/api.geometry-api-dto-v2": "~1.11.0",

@@ -44,0 +44,0 @@ "axios": "^0.26.1",

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