Socket
Socket
Sign inDemoInstall

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

Package Overview
Dependencies
Maintainers
5
Versions
72
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.16.8 to 2.18.0

dist/util/SdWebhookSignature.d.ts

2

dist/api/SdPlatformRequestId.d.ts

@@ -125,2 +125,4 @@ /**

WebhookNotification = "webhook_notification",
WebhookModelComputation = "webhook_model_computation",
WebhookModelExport = "webhook_model_export",
ModelTransferRequestCreate = "model_transfer_request_create",

@@ -127,0 +129,0 @@ ModelTransferRequestDelete = "model_transfer_request_delete",

@@ -129,2 +129,4 @@ "use strict";

RequestId["WebhookNotification"] = "webhook_notification";
RequestId["WebhookModelComputation"] = "webhook_model_computation";
RequestId["WebhookModelExport"] = "webhook_model_export";
RequestId["ModelTransferRequestCreate"] = "model_transfer_request_create";

@@ -131,0 +133,0 @@ RequestId["ModelTransferRequestDelete"] = "model_transfer_request_delete";

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

function isResourceResponseError(response) {
return ("error" in response) && ("message" in response.error);
return ("error" in response) && (typeof response.error === "object") && ("message" in response.error);
}

@@ -19,2 +19,5 @@ function isValidationError(response) {

}
function isGeometryBackendResponseError(response) {
return ("error" in response) && ("desc" in response);
}
/**

@@ -24,3 +27,3 @@ * Maps the given error into a ShapeDiver API response error object.

function mapToApiError(error) {
var _a, _b;
var _a, _b, _c, _d, _e;
// Handle basic non-axios errors

@@ -34,2 +37,3 @@ if (!axios_1.default.isAxiosError(error))

if (axiosError.response.status >= 500) {
// TODO Alex: shouldn't it be data?.message here?
return new SdPlatformErrors_1.SdPlatformServerResponseError((_b = (_a = data === null || data === void 0 ? void 0 : data.error) === null || _a === void 0 ? void 0 : _a.message) !== null && _b !== void 0 ? _b : "Server Error.", axiosError.response.status);

@@ -70,2 +74,5 @@ }

}
else if (data && isGeometryBackendResponseError(data)) {
return new SdPlatformErrors_1.SdPlatformGeometryBackendResponseError(data.message || (data.desc || ((_c = data.error) !== null && _c !== void 0 ? _c : "")), (_d = data.error) !== null && _d !== void 0 ? _d : "", (_e = data.desc) !== null && _e !== void 0 ? _e : "");
}
else {

@@ -72,0 +79,0 @@ // Response was made but an unknown error object was received

@@ -5,2 +5,3 @@ import { SdPlatformSdkApi, SdPlatformSdkRequestConfig } from "../api/SdPlatformSdkApi";

import { SdPlatformPostResponse } from "@shapediver/api.platform-api-dto-v1";
import { ShapeDiverResponseDto } from "@shapediver/api.geometry-api-dto-v2";
export interface SdPlatformWebhookBasicAuth {

@@ -53,3 +54,38 @@ username: string;

notification(auth: SdPlatformWebhookTokenAuth, body: SdPlatformRequestWebhookNotification): Promise<SdPlatformPostResponse<SdPlatformResponseNotification>>;
/**
* Model computation webhook call - trigger a computation on a model.
* @param identifier - the webhook identifier of a user
* @param secret - the webhook secret of a user
* @param modelSlug - the slug of the model
* @param body - the body of the request, usually key value pair of model parameters
*
* {@link https://app.shapediver.com/api/documentation#/webhooks/630563fd0538d167bea7e9ddfa96be3c See Webhook Documentation}
*
* Mapping of parameters:
* - if the parameter’s displayname or name is “payload”, complete request body is used as a JSON string for this parameter.
* - if property of the request body name matches the parameter id, value of the property is used.
* - if parameter has "displayname" and body has property with the same name, value of the property is used. If parameter name contains dots, searched for corresponding nested property.
* - if parameter has "name" and body has property with the same name, value of the property is used. If parameter name contains dots, searched for corresponding nested property.
* - if no matching property is found by previous case, parameter from the request body is ignored.
*/
modelComputation(identifier: string, secret: string, modelSlug: string, body: object): Promise<ShapeDiverResponseDto>;
/**
* Model export webhook call - trigger an export on a model.
* @param identifier - the webhook identifier of a user
* @param secret - the webhook secret of a user
* @param modelSlug - the slug of the model
* @param exportId - the id of the export
* @param body - the body of the request, usually key value pair of model parameters
*
* {@link https://app.shapediver.com/api/documentation#/webhooks/630563fd0538d167bea7e9ddfa96be3c See Webhook Documentation}
*
* Mapping of parameters:
* - if the parameter’s displayname or name is “payload”, complete request body is used as a JSON string for this parameter.
* - if property of the request body name matches the parameter id, value of the property is used.
* - if parameter has "displayname" and body has property with the same name, value of the property is used. If parameter name contains dots, searched for corresponding nested property.
* - if parameter has "name" and body has property with the same name, value of the property is used. If parameter name contains dots, searched for corresponding nested property.
* - if no matching property is found by previous case, parameter from the request body is ignored.
*/
modelExport(identifier: string, secret: string, modelSlug: string, exportId: string, body: object): Promise<ShapeDiverResponseDto>;
}
//# sourceMappingURL=SdPlatformWebhookApi.d.ts.map

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

const SdPlatformRequestId_1 = require("../api/SdPlatformRequestId");
const SdWebhookSignature_1 = require("../util/SdWebhookSignature");
/**

@@ -66,4 +67,51 @@ * Webhook calls.

}
/**
* Model computation webhook call - trigger a computation on a model.
* @param identifier - the webhook identifier of a user
* @param secret - the webhook secret of a user
* @param modelSlug - the slug of the model
* @param body - the body of the request, usually key value pair of model parameters
*
* {@link https://app.shapediver.com/api/documentation#/webhooks/630563fd0538d167bea7e9ddfa96be3c See Webhook Documentation}
*
* Mapping of parameters:
* - if the parameter’s displayname or name is “payload”, complete request body is used as a JSON string for this parameter.
* - if property of the request body name matches the parameter id, value of the property is used.
* - if parameter has "displayname" and body has property with the same name, value of the property is used. If parameter name contains dots, searched for corresponding nested property.
* - if parameter has "name" and body has property with the same name, value of the property is used. If parameter name contains dots, searched for corresponding nested property.
* - if no matching property is found by previous case, parameter from the request body is ignored.
*/
modelComputation(identifier, secret, modelSlug, body) {
var path = this.__getPath(`${identifier}/${modelSlug}/output`);
const header = (0, SdWebhookSignature_1.createWebhookSignature)(secret, body);
return this.__api.post(SdPlatformRequestId_1.RequestId.WebhookModelComputation, path, body, this.__resolveRequestConfig({}), {
"X-WEBHOOK-SIGNATURE": header
});
}
/**
* Model export webhook call - trigger an export on a model.
* @param identifier - the webhook identifier of a user
* @param secret - the webhook secret of a user
* @param modelSlug - the slug of the model
* @param exportId - the id of the export
* @param body - the body of the request, usually key value pair of model parameters
*
* {@link https://app.shapediver.com/api/documentation#/webhooks/630563fd0538d167bea7e9ddfa96be3c See Webhook Documentation}
*
* Mapping of parameters:
* - if the parameter’s displayname or name is “payload”, complete request body is used as a JSON string for this parameter.
* - if property of the request body name matches the parameter id, value of the property is used.
* - if parameter has "displayname" and body has property with the same name, value of the property is used. If parameter name contains dots, searched for corresponding nested property.
* - if parameter has "name" and body has property with the same name, value of the property is used. If parameter name contains dots, searched for corresponding nested property.
* - if no matching property is found by previous case, parameter from the request body is ignored.
*/
modelExport(identifier, secret, modelSlug, exportId, body) {
var path = this.__getPath(`${identifier}/${modelSlug}/export/${exportId}`);
const header = (0, SdWebhookSignature_1.createWebhookSignature)(secret, body);
return this.__api.post(SdPlatformRequestId_1.RequestId.WebhookModelExport, path, body, this.__resolveRequestConfig({}), {
"X-WEBHOOK-SIGNATURE": header
});
}
}
exports.SdPlatformWebhookApi = SdPlatformWebhookApi;
//# sourceMappingURL=SdPlatformWebhookApi.js.map

@@ -17,2 +17,3 @@ export declare const ShapeDiverErrorType: {

readonly UnsupportedGrantTypeClientOAuthResponse: "sd_pb_sdk_unsupported_grant_type_oauth_response";
readonly GeometryBackendResponse: "sd_pb_sdk_gb_response";
};

@@ -166,5 +167,15 @@ export type ShapeDiverErrorType = typeof ShapeDiverErrorType[keyof typeof ShapeDiverErrorType];

* Please see https://datatracker.ietf.org/doc/html/rfc6749#section-5.2
*/ export declare class SdPlatformUnsupportedGrantTypeClientOAuthResponseError extends SdPlatformOAuthResponseError {
*/
export declare class SdPlatformUnsupportedGrantTypeClientOAuthResponseError extends SdPlatformOAuthResponseError {
readonly errorType: ShapeDiverErrorType;
}
/**
* Geometry backend response error forwarded by the platform backend
*/
export declare class SdPlatformGeometryBackendResponseError extends SdPlatformError {
readonly error: string;
readonly desc: string;
readonly errorType: ShapeDiverErrorType;
constructor(message: string, error: string, desc: string);
}
//# sourceMappingURL=SdPlatformErrors.d.ts.map
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.SdPlatformUnsupportedGrantTypeClientOAuthResponseError = exports.SdPlatformUnauthorizedClientOAuthResponseError = exports.SdPlatformInvalidGrantOAuthResponseError = exports.SdPlatformInvalidClientOAuthResponseError = exports.SdPlatformInvalidRequestOAuthResponseError = exports.SdPlatformOAuthResponseError = exports.SdPlatformValidationResponseError = exports.SdPlatformUnauthorizedResponseError = exports.SdPlatformForbiddenResponseError = exports.SdPlatformNotFoundResponseError = exports.SdPlatformResourceResponseError = exports.SdPlatformServerResponseError = exports.SdPlatformResponseError = exports.SdPlatformRequestError = exports.SdPlatformError = exports.ShapeDiverErrorType = void 0;
exports.SdPlatformGeometryBackendResponseError = exports.SdPlatformUnsupportedGrantTypeClientOAuthResponseError = exports.SdPlatformUnauthorizedClientOAuthResponseError = exports.SdPlatformInvalidGrantOAuthResponseError = exports.SdPlatformInvalidClientOAuthResponseError = exports.SdPlatformInvalidRequestOAuthResponseError = exports.SdPlatformOAuthResponseError = exports.SdPlatformValidationResponseError = exports.SdPlatformUnauthorizedResponseError = exports.SdPlatformForbiddenResponseError = exports.SdPlatformNotFoundResponseError = exports.SdPlatformResourceResponseError = exports.SdPlatformServerResponseError = exports.SdPlatformResponseError = exports.SdPlatformRequestError = exports.SdPlatformError = exports.ShapeDiverErrorType = void 0;
exports.ShapeDiverErrorType = {

@@ -20,2 +20,3 @@ Generic: "sd_pb_sdk_generic",

UnsupportedGrantTypeClientOAuthResponse: "sd_pb_sdk_unsupported_grant_type_oauth_response",
GeometryBackendResponse: "sd_pb_sdk_gb_response",
};

@@ -200,3 +201,4 @@ /**

* Please see https://datatracker.ietf.org/doc/html/rfc6749#section-5.2
*/ class SdPlatformUnsupportedGrantTypeClientOAuthResponseError extends SdPlatformOAuthResponseError {
*/
class SdPlatformUnsupportedGrantTypeClientOAuthResponseError extends SdPlatformOAuthResponseError {
constructor() {

@@ -208,2 +210,14 @@ super(...arguments);

exports.SdPlatformUnsupportedGrantTypeClientOAuthResponseError = SdPlatformUnsupportedGrantTypeClientOAuthResponseError;
/**
* Geometry backend response error forwarded by the platform backend
*/
class SdPlatformGeometryBackendResponseError extends SdPlatformError {
constructor(message, error, desc) {
super(message);
this.error = error;
this.desc = desc;
this.errorType = exports.ShapeDiverErrorType.GeometryBackendResponse;
}
}
exports.SdPlatformGeometryBackendResponseError = SdPlatformGeometryBackendResponseError;
//# sourceMappingURL=SdPlatformErrors.js.map

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

import { SdPlatformError, SdPlatformForbiddenResponseError, SdPlatformInvalidClientOAuthResponseError, SdPlatformInvalidGrantOAuthResponseError, SdPlatformInvalidRequestOAuthResponseError, SdPlatformNotFoundResponseError, SdPlatformOAuthResponseError, SdPlatformRequestError, SdPlatformResourceResponseError, SdPlatformResponseError, SdPlatformServerResponseError, SdPlatformUnauthorizedClientOAuthResponseError, SdPlatformUnauthorizedResponseError, SdPlatformUnsupportedGrantTypeClientOAuthResponseError, SdPlatformValidationResponseError } from "./SdPlatformErrors";
import { SdPlatformError, SdPlatformForbiddenResponseError, SdPlatformGeometryBackendResponseError, SdPlatformInvalidClientOAuthResponseError, SdPlatformInvalidGrantOAuthResponseError, SdPlatformInvalidRequestOAuthResponseError, SdPlatformNotFoundResponseError, SdPlatformOAuthResponseError, SdPlatformRequestError, SdPlatformResourceResponseError, SdPlatformResponseError, SdPlatformServerResponseError, SdPlatformUnauthorizedClientOAuthResponseError, SdPlatformUnauthorizedResponseError, SdPlatformUnsupportedGrantTypeClientOAuthResponseError, SdPlatformValidationResponseError } from "./SdPlatformErrors";
/** Type guard for all error types of the Geometry Backend SDK package. */

@@ -58,2 +58,6 @@ export declare function isPBError(e: any): e is (SdPlatformError & SdPlatformRequestError & SdPlatformResponseError & SdPlatformServerResponseError & SdPlatformResourceResponseError & SdPlatformNotFoundResponseError & SdPlatformForbiddenResponseError & SdPlatformUnauthorizedResponseError & SdPlatformValidationResponseError & SdPlatformOAuthResponseError & SdPlatformInvalidRequestOAuthResponseError & SdPlatformInvalidGrantOAuthResponseError & SdPlatformUnauthorizedClientOAuthResponseError & SdPlatformUnsupportedGrantTypeClientOAuthResponseError & SdPlatformInvalidClientOAuthResponseError);

export declare function isPBUnsupportedGrantTypeClientOAuthResponseError(e: any): e is SdPlatformUnsupportedGrantTypeClientOAuthResponseError;
/**
* Type guard for a Platform Backend SDK Geometry Backend response error.
*/
export declare function isPBGeometryBackendResponseError(e: any): e is SdPlatformGeometryBackendResponseError;
//# sourceMappingURL=SdPlatformErrorTypeGuards.d.ts.map
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.isPBUnsupportedGrantTypeClientOAuthResponseError = exports.isPBUnauthorizedClientOAuthResponseError = exports.isPBInvalidGrantOAuthResponseError = exports.isPBInvalidClientOAuthResponseError = exports.isPBInvalidRequestOAuthResponseError = exports.isPBOAuthResponseError = exports.isPBValidationResponseError = exports.isPBUnauthorizedResponseError = exports.isPBForbiddenResponseError = exports.isPBNotFoundResponseError = exports.isPBResourceResponseError = exports.isPBServerResponseError = exports.isPBResponseError = exports.isPBRequestError = exports.isPBGenericError = exports.isPBError = void 0;
exports.isPBGeometryBackendResponseError = exports.isPBUnsupportedGrantTypeClientOAuthResponseError = exports.isPBUnauthorizedClientOAuthResponseError = exports.isPBInvalidGrantOAuthResponseError = exports.isPBInvalidClientOAuthResponseError = exports.isPBInvalidRequestOAuthResponseError = exports.isPBOAuthResponseError = exports.isPBValidationResponseError = exports.isPBUnauthorizedResponseError = exports.isPBForbiddenResponseError = exports.isPBNotFoundResponseError = exports.isPBResourceResponseError = exports.isPBServerResponseError = exports.isPBResponseError = exports.isPBRequestError = exports.isPBGenericError = exports.isPBError = void 0;
const SdPlatformErrors_1 = require("./SdPlatformErrors");

@@ -42,2 +42,3 @@ /** Type guard for all error types of the Geometry Backend SDK package. */

SdPlatformErrors_1.ShapeDiverErrorType.UnsupportedGrantTypeClientOAuthResponse,
SdPlatformErrors_1.ShapeDiverErrorType.GeometryBackendResponse,
];

@@ -157,2 +158,11 @@ return e instanceof Error &&

exports.isPBUnsupportedGrantTypeClientOAuthResponseError = isPBUnsupportedGrantTypeClientOAuthResponseError;
/**
* Type guard for a Platform Backend SDK Geometry Backend response error.
*/
function isPBGeometryBackendResponseError(e) {
return e instanceof Error &&
"errorType" in e &&
e.errorType === SdPlatformErrors_1.ShapeDiverErrorType.GeometryBackendResponse;
}
exports.isPBGeometryBackendResponseError = isPBGeometryBackendResponseError;
//# sourceMappingURL=SdPlatformErrorTypeGuards.js.map

6

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

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

"dependencies": {
"@shapediver/api.platform-api-dto-v1": "~2.16.8",
"@shapediver/api.platform-api-dto-v1": "~2.18.0",
"@shapediver/api.geometry-api-dto-v2": "~1.11.0",
"axios": "^0.26.1",

@@ -51,2 +52,3 @@ "jwt-decode": "~3.1.2"

"lerna": "^6.6.2",
"ts-node": "~10.9.1",
"typescript": "~4.9.5"

@@ -53,0 +55,0 @@ },

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