Socket
Socket
Sign inDemoInstall

@shapediver/sdk.geometry-api-sdk-core

Package Overview
Dependencies
Maintainers
5
Versions
26
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@shapediver/sdk.geometry-api-sdk-core - npm Package Compare versions

Comparing version 1.0.6 to 1.0.7

16

dist/api/ShapeDiverSdkApi.d.ts
import { SdkConfigInternal } from "../config/ShapeDiverSdkConfig";
export interface ShapeDiverSdkApiRequestHeaders {
export interface ShapeDiverSdkApiRequestOptions {
contentType: string;
authorization?: "disabled";
responseType: ShapeDiverSdkApiResponseType;
disableAuthorization?: boolean;
disableCustomHeaders?: boolean;
}

@@ -34,8 +36,8 @@ export declare enum ShapeDiverSdkApiResponseType {

private static convertErrorResponseData;
get<T>(url: string, requestHeaders?: ShapeDiverSdkApiRequestHeaders, responseType?: ShapeDiverSdkApiResponseType): Promise<T>;
post<T>(url: string, data?: any, requestHeaders?: ShapeDiverSdkApiRequestHeaders, responseType?: ShapeDiverSdkApiResponseType): Promise<T>;
put<T>(url: string, data?: any, requestHeaders?: ShapeDiverSdkApiRequestHeaders, responseType?: ShapeDiverSdkApiResponseType): Promise<T>;
patch<T>(url: string, data?: any, requestHeaders?: ShapeDiverSdkApiRequestHeaders, responseType?: ShapeDiverSdkApiResponseType): Promise<T>;
delete<T>(url: string, requestHeaders?: ShapeDiverSdkApiRequestHeaders, responseType?: ShapeDiverSdkApiResponseType): Promise<T>;
get<T>(url: string, options?: ShapeDiverSdkApiRequestOptions): Promise<T>;
post<T>(url: string, data?: any, options?: ShapeDiverSdkApiRequestOptions): Promise<T>;
put<T>(url: string, data?: any, options?: ShapeDiverSdkApiRequestOptions): Promise<T>;
patch<T>(url: string, data?: any, options?: ShapeDiverSdkApiRequestOptions): Promise<T>;
delete<T>(url: string, options?: ShapeDiverSdkApiRequestOptions): Promise<T>;
}
//# sourceMappingURL=ShapeDiverSdkApi.d.ts.map

@@ -35,11 +35,15 @@ "use strict";

}
buildRequestConfig(method, headers, data, responseType) {
buildRequestConfig(method, options, data) {
const request = {
method: method,
headers: Object.assign(Object.assign({}, this.config.headers), { "Content-Type": headers.contentType }),
responseType: responseType,
headers: {},
responseType: options.responseType,
data: undefined,
};
// Process HTTP authorization
if (headers.authorization === "disabled") {
// Process HTTP headers
if (!options.disableCustomHeaders)
request.headers = Object.assign({}, this.config.headers);
request.headers["Content-Type"] = options.contentType;
// Process HTTP authorization header
if (options.disableAuthorization) {
delete request.headers["Authorization"];

@@ -49,7 +53,6 @@ delete request.headers["authorization"]; // config.headers might use lower case

else if (this.config.jwt) {
// Add jwt if provided
request.headers["Authorization"] = "Bearer " + this.config.jwt;
}
// Set data and convert depending on content-type
if (headers.contentType === "application/json") {
if (options.contentType === "application/json") {
request.data = JSON.stringify(data);

@@ -129,5 +132,8 @@ }

}
get(url, requestHeaders = { contentType: "application/json" }, responseType = ShapeDiverSdkApiResponseType.JSON) {
get(url, options = {
contentType: "application/json",
responseType: ShapeDiverSdkApiResponseType.JSON,
}) {
return __awaiter(this, void 0, void 0, function* () {
const config = this.buildRequestConfig(Method.GET, requestHeaders, {}, responseType);
const config = this.buildRequestConfig(Method.GET, options, {});
try {

@@ -138,9 +144,12 @@ const response = yield (0, axios_1.default)(this.buildUrl(url), config);

catch (e) {
return yield ShapeDiverSdkApi.processError(e, responseType);
return yield ShapeDiverSdkApi.processError(e, options.responseType);
}
});
}
post(url, data = {}, requestHeaders = { contentType: "application/json" }, responseType = ShapeDiverSdkApiResponseType.JSON) {
post(url, data = {}, options = {
contentType: "application/json",
responseType: ShapeDiverSdkApiResponseType.JSON,
}) {
return __awaiter(this, void 0, void 0, function* () {
const config = this.buildRequestConfig(Method.POST, requestHeaders, data, responseType);
const config = this.buildRequestConfig(Method.POST, options, data);
try {

@@ -151,9 +160,12 @@ const response = yield (0, axios_1.default)(this.buildUrl(url), config);

catch (e) {
return yield ShapeDiverSdkApi.processError(e, responseType);
return yield ShapeDiverSdkApi.processError(e, options.responseType);
}
});
}
put(url, data = {}, requestHeaders = { contentType: "application/json" }, responseType = ShapeDiverSdkApiResponseType.JSON) {
put(url, data = {}, options = {
contentType: "application/json",
responseType: ShapeDiverSdkApiResponseType.JSON,
}) {
return __awaiter(this, void 0, void 0, function* () {
const config = this.buildRequestConfig(Method.PUT, requestHeaders, data, responseType);
const config = this.buildRequestConfig(Method.PUT, options, data);
try {

@@ -164,9 +176,12 @@ const response = yield (0, axios_1.default)(this.buildUrl(url), config);

catch (e) {
return yield ShapeDiverSdkApi.processError(e, responseType);
return yield ShapeDiverSdkApi.processError(e, options.responseType);
}
});
}
patch(url, data = {}, requestHeaders = { contentType: "application/json" }, responseType = ShapeDiverSdkApiResponseType.JSON) {
patch(url, data = {}, options = {
contentType: "application/json",
responseType: ShapeDiverSdkApiResponseType.JSON,
}) {
return __awaiter(this, void 0, void 0, function* () {
const config = this.buildRequestConfig(Method.PATCH, requestHeaders, data, responseType);
const config = this.buildRequestConfig(Method.PATCH, options, data);
try {

@@ -177,9 +192,12 @@ const response = yield (0, axios_1.default)(this.buildUrl(url), config);

catch (e) {
return yield ShapeDiverSdkApi.processError(e, responseType);
return yield ShapeDiverSdkApi.processError(e, options.responseType);
}
});
}
delete(url, requestHeaders = { contentType: "application/json" }, responseType = ShapeDiverSdkApiResponseType.JSON) {
delete(url, options = {
contentType: "application/json",
responseType: ShapeDiverSdkApiResponseType.JSON,
}) {
return __awaiter(this, void 0, void 0, function* () {
const config = this.buildRequestConfig(Method.DELETE, requestHeaders, {}, responseType);
const config = this.buildRequestConfig(Method.DELETE, options, {});
try {

@@ -190,3 +208,3 @@ const response = yield (0, axios_1.default)(this.buildUrl(url), config);

catch (e) {
return yield ShapeDiverSdkApi.processError(e, responseType);
return yield ShapeDiverSdkApi.processError(e, options.responseType);
}

@@ -193,0 +211,0 @@ });

@@ -15,5 +15,3 @@ /** ShapeDiver configuration object */

}
export declare type RequestHeader = {
[key: string]: string | number | Array<string | number>;
};
export declare type RequestHeader = Record<string, string>;
/** Private interface of the ShapeDiver configuration object */

@@ -30,4 +28,4 @@ export declare class SdkConfigInternal {

setConfigValue(type: ShapeDiverSdkConfigType, value: any): void;
static validateValue(type: ShapeDiverSdkConfigType, value: any, dataType: "string" | "string_keyed_object"): any;
static validateValue(type: ShapeDiverSdkConfigType, value: any, dataType: "string" | "string_map"): any;
}
//# sourceMappingURL=ShapeDiverSdkConfig.d.ts.map

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

case ShapeDiverSdkConfigType.REQUEST_HEADERS:
this._headers = SdkConfigInternal.validateValue(type, value, "string_keyed_object");
this._headers = SdkConfigInternal.validateValue(type, value, "string_map");
break;

@@ -57,5 +57,5 @@ default:

break;
case "string_keyed_object":
if (typeof value !== "object" || !Object.values(value).every(v => typeof v === "string" || typeof v === "number" || typeof v === "boolean" || Array.isArray(v)))
throw new ShapeDiverErrors_1.ShapeDiverError(`Invalid value for config-type '${type}': Value must be a string-keyed-object`);
case "string_map":
if (typeof value !== "object" || !Object.values(value).every(v => typeof v === "string"))
throw new ShapeDiverErrors_1.ShapeDiverError(`Invalid value for config-type '${type}': Value must be a string-map`);
break;

@@ -62,0 +62,0 @@ }

@@ -1,2 +0,2 @@

import { ShapeDiverSdkApi, ShapeDiverSdkApiRequestHeaders, ShapeDiverSdkApiResponseType } from "./api/ShapeDiverSdkApi";
import { ShapeDiverSdkApi, ShapeDiverSdkApiRequestOptions, ShapeDiverSdkApiResponseType } from "./api/ShapeDiverSdkApi";
import { BaseShapeDiverSdk } from "./BaseShapeDiverSdk";

@@ -6,3 +6,3 @@ import { ShapeDiverSdkConfig, ShapeDiverSdkConfigType } from "./config/ShapeDiverSdkConfig";

import { ShapeDiverError, ShapeDiverRequestError, ShapeDiverResponseError } from "./ShapeDiverErrors";
export { BaseResourceApi, BaseShapeDiverSdk, ShapeDiverError, ShapeDiverRequestError, ShapeDiverResponseError, ShapeDiverSdkApi, ShapeDiverSdkApiRequestHeaders, ShapeDiverSdkApiResponseType, ShapeDiverSdkConfig, ShapeDiverSdkConfigType, };
export { BaseResourceApi, BaseShapeDiverSdk, ShapeDiverError, ShapeDiverRequestError, ShapeDiverResponseError, ShapeDiverSdkApi, ShapeDiverSdkApiRequestOptions, ShapeDiverSdkApiResponseType, ShapeDiverSdkConfig, ShapeDiverSdkConfigType, };
//# sourceMappingURL=index.d.ts.map
{
"name": "@shapediver/sdk.geometry-api-sdk-core",
"version": "1.0.6",
"version": "1.0.7",
"description": "Core-library for SDK-packages to communicate with the Geometry API",

@@ -5,0 +5,0 @@ "keywords": [],

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