New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@integration-app/sdk

Package Overview
Dependencies
Maintainers
3
Versions
445
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@integration-app/sdk - npm Package Compare versions

Comparing version 0.1.24 to 0.1.25

6

data-composer.test.js

@@ -128,2 +128,8 @@ "use strict";

});
it('should extract locators from nested object string locator', () => {
expect((0, data_composer_1.transformToDataLocator)('$.name.firstName')).toEqual([
new data_composer_1.DataLocatorObjectProperty('name'),
new data_composer_1.DataLocatorObjectProperty('firstName'),
]);
});
it('should extract locators if root is array', () => {

@@ -130,0 +136,0 @@ expect((0, data_composer_1.transformToDataLocator)('$[5]')).toEqual([

95

errors.d.ts
export declare enum ErrorType {
INPUT = "input",
BAD_REQUEST = "bad_request",
ENDPOINT = "endpoint",
CONNECTION = "connection",
INTERNAL = "internal"
INTERNAL = "internal",
FLOW_CONFIGURATION = "flow_configuration",
FLOW_RUN = "flow_run"
}
export declare enum ErrorCode {
export declare enum ErrorKey {
NOT_FOUND = "not_found",
NOT_AUTHENTICATED = "not_authenticated",
ACCESS_DENIED = "access_denied"
ACCESS_DENIED = "access_denied",
CONNECTION_NOT_FOUND = "connection_not_found",
PERMANENT = "permanent",
TEMPORARY = "temporary"
}
export declare class BaseErrorData {
type: ErrorType;
code?: string;
key?: ErrorKey;
message: string;
detail?: string;
helpText?: string;
helpLink?: string;
causedByError?: BaseErrorData;
constructor(data: any);

@@ -28,4 +35,9 @@ }

connectionKey: string;
connectionId: string;
constructor(data: any);
}
export declare class ConnectionNotFoundErrorData extends BaseErrorData {
connectionId: string;
constructor(data: any);
}
export declare class FlowConfigurationErrorData extends BaseErrorData {

@@ -41,20 +53,52 @@ flowId: string;

}
export declare class InputErrorData extends BaseErrorData {
export declare class BadRequestErrorData extends BaseErrorData {
fields?: Record<string, string>;
constructor(data: any);
}
export declare type ErrorData = InputErrorData | InternalErrorData | ConnectionErrorData | EndpointErrorData;
export declare type ErrorData = BadRequestErrorData | InternalErrorData | ConnectionErrorData | EndpointErrorData;
declare class EngineErrorOptions {
key?: ErrorKey;
helpText?: string;
helpLink?: string;
causedByError?: BaseErrorData;
}
declare class BadRequestErrorOptions extends EngineErrorOptions {
fields?: Record<string, string>;
}
declare class FlowConfigurationErrorOptions extends BadRequestErrorOptions {
flowId?: string;
nodeId?: string;
}
declare class FlowRunErrorOptions extends EngineErrorOptions {
flowRunId?: string;
flowNodeRunId?: string;
nodeKey?: string;
}
declare class EndpointErrorOptions extends EngineErrorOptions {
endpointKey?: string;
}
declare class ConnectionErrorOptions extends EngineErrorOptions {
connectionKey?: string;
connectionId?: string;
}
declare class ConnectionNotFoundErrorOptions extends EngineErrorOptions {
connectionId?: string;
}
export declare class EngineError extends Error {
code: ErrorCode;
key: ErrorKey;
helpText?: string;
helpLink?: string;
causedByError?: BaseErrorData;
constructor(message: any, options?: EngineErrorOptions);
}
export declare class InternalError extends EngineError {
}
export declare class InputError extends EngineError {
export declare class BadRequestError extends EngineError {
fields?: Record<string, string>;
constructor(message: any, fields?: Record<string, string>);
constructor(message: any, options?: BadRequestErrorOptions);
}
export declare class FlowConfigurationError extends EngineError {
export declare class FlowConfigurationError extends BadRequestError {
flowId?: string;
nodeId?: string;
constructor(message: any, flowId?: string, nodeId?: string);
constructor(message: any, options?: FlowConfigurationErrorOptions);
}

@@ -64,21 +108,26 @@ export declare class FlowRunError extends EngineError {

flowNodeRunId?: string;
constructor(message: any, flowRunId?: string, flowNodeRunId?: string);
nodeKey?: string;
constructor(message: any, options?: FlowRunErrorOptions);
}
export declare class EndpointError extends EngineError {
endpointKey?: string;
constructor(message: any, endpointKey?: string);
constructor(message: any, options?: EndpointErrorOptions);
}
export declare class ConnectionError extends EngineError {
connectionKey?: string;
constructor(message: any, connectionKey?: string);
connectionId?: string;
constructor(message: any, options?: ConnectionErrorOptions);
}
export declare class NotFoundError extends InputError {
constructor(message: any);
export declare class NotFoundError extends BadRequestError {
constructor(message: any, options?: EngineErrorOptions);
}
export declare class ConnectionNotFoundError extends NotFoundError {
export declare class NotAuthenticatedError extends BadRequestError {
constructor(message: any, options?: EngineErrorOptions);
}
export declare class ConnectionNotFoundError extends BadRequestError {
connectionId?: string;
constructor(message: any, connectionId?: string);
constructor(message: any, options?: ConnectionNotFoundErrorOptions);
}
export declare class NotAuthenticatedError extends InputError {
constructor(message: any);
}
export declare function getErrorFromData(data: any): InternalError | BadRequestError | FlowRunError | EndpointError | ConnectionError;
export declare function extractEngineErrorData(error: Error): EndpointErrorData | ConnectionErrorData | ConnectionNotFoundErrorData | FlowConfigurationErrorData | FlowRunErrorData | BadRequestErrorData;
export {};
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.NotAuthenticatedError = exports.ConnectionNotFoundError = exports.NotFoundError = exports.ConnectionError = exports.EndpointError = exports.FlowRunError = exports.FlowConfigurationError = exports.InputError = exports.InternalError = exports.EngineError = exports.InputErrorData = exports.FlowRunErrorData = exports.FlowConfigurationErrorData = exports.ConnectionErrorData = exports.EndpointErrorData = exports.InternalErrorData = exports.BaseErrorData = exports.ErrorCode = exports.ErrorType = void 0;
exports.extractEngineErrorData = exports.getErrorFromData = exports.ConnectionNotFoundError = exports.NotAuthenticatedError = exports.NotFoundError = exports.ConnectionError = exports.EndpointError = exports.FlowRunError = exports.FlowConfigurationError = exports.BadRequestError = exports.InternalError = exports.EngineError = exports.BadRequestErrorData = exports.FlowRunErrorData = exports.FlowConfigurationErrorData = exports.ConnectionNotFoundErrorData = exports.ConnectionErrorData = exports.EndpointErrorData = exports.InternalErrorData = exports.BaseErrorData = exports.ErrorKey = exports.ErrorType = void 0;
const tslib_1 = require("tslib");
const lodash_1 = (0, tslib_1.__importDefault)(require("lodash"));
var ErrorType;
(function (ErrorType) {
ErrorType["INPUT"] = "input";
ErrorType["BAD_REQUEST"] = "bad_request";
ErrorType["ENDPOINT"] = "endpoint";
ErrorType["CONNECTION"] = "connection";
ErrorType["INTERNAL"] = "internal";
ErrorType["FLOW_CONFIGURATION"] = "flow_configuration";
ErrorType["FLOW_RUN"] = "flow_run";
})(ErrorType = exports.ErrorType || (exports.ErrorType = {}));
var ErrorCode;
(function (ErrorCode) {
ErrorCode["NOT_FOUND"] = "not_found";
ErrorCode["NOT_AUTHENTICATED"] = "not_authenticated";
ErrorCode["ACCESS_DENIED"] = "access_denied";
})(ErrorCode = exports.ErrorCode || (exports.ErrorCode = {}));
var ErrorKey;
(function (ErrorKey) {
ErrorKey["NOT_FOUND"] = "not_found";
ErrorKey["NOT_AUTHENTICATED"] = "not_authenticated";
ErrorKey["ACCESS_DENIED"] = "access_denied";
ErrorKey["CONNECTION_NOT_FOUND"] = "connection_not_found";
ErrorKey["PERMANENT"] = "permanent";
ErrorKey["TEMPORARY"] = "temporary";
})(ErrorKey = exports.ErrorKey || (exports.ErrorKey = {}));
class BaseErrorData {

@@ -27,5 +34,7 @@ constructor(data) {

type: this.type,
code: this.code,
key: this.key,
message: this.message,
detail: this.detail,
helpText: this.helpText,
helpLink: this.helpLink,
causedByError: this.causedByError,
} = data);

@@ -57,9 +66,18 @@ }

this.connectionKey = data.connectionKey;
this.connectionId = data.connectionId;
}
}
exports.ConnectionErrorData = ConnectionErrorData;
class ConnectionNotFoundErrorData extends BaseErrorData {
constructor(data) {
super(data);
this.type = ErrorType.BAD_REQUEST;
this.connectionId = data.connectionId;
}
}
exports.ConnectionNotFoundErrorData = ConnectionNotFoundErrorData;
class FlowConfigurationErrorData extends BaseErrorData {
constructor(data) {
super(data);
this.type = ErrorType.CONNECTION;
this.type = ErrorType.FLOW_CONFIGURATION;
this.flowId = data.flowId;

@@ -73,3 +91,3 @@ this.nodeId = data.nodeId;

super(data);
this.type = ErrorType.CONNECTION;
this.type = ErrorType.FLOW_RUN;
this.flowRunId = data.flowRunId;

@@ -80,11 +98,31 @@ this.flowNodeRunId = data.flowNodeRunId;

exports.FlowRunErrorData = FlowRunErrorData;
class InputErrorData extends BaseErrorData {
class BadRequestErrorData extends BaseErrorData {
constructor(data) {
super(data);
this.type = ErrorType.INPUT;
this.type = ErrorType.BAD_REQUEST;
this.fields = data.fields;
}
}
exports.InputErrorData = InputErrorData;
exports.BadRequestErrorData = BadRequestErrorData;
class EngineErrorOptions {
}
class BadRequestErrorOptions extends EngineErrorOptions {
}
class FlowConfigurationErrorOptions extends BadRequestErrorOptions {
}
class FlowRunErrorOptions extends EngineErrorOptions {
}
class EndpointErrorOptions extends EngineErrorOptions {
}
class ConnectionErrorOptions extends EngineErrorOptions {
}
class ConnectionNotFoundErrorOptions extends EngineErrorOptions {
}
class EngineError extends Error {
constructor(message, options = {}) {
super(message);
this.helpText = options.helpText;
this.helpLink = options.helpLink;
this.causedByError = options.causedByError;
}
}

@@ -95,14 +133,14 @@ exports.EngineError = EngineError;

exports.InternalError = InternalError;
class InputError extends EngineError {
constructor(message, fields) {
super(message);
this.fields = fields;
class BadRequestError extends EngineError {
constructor(message, options = {}) {
super(message, options);
this.fields = options.fields;
}
}
exports.InputError = InputError;
class FlowConfigurationError extends EngineError {
constructor(message, flowId, nodeId) {
super(message);
this.flowId = flowId;
this.nodeId = nodeId;
exports.BadRequestError = BadRequestError;
class FlowConfigurationError extends BadRequestError {
constructor(message, options = {}) {
super(message, options);
this.flowId = options.flowId;
this.nodeId = options.nodeId;
}

@@ -112,6 +150,7 @@ }

class FlowRunError extends EngineError {
constructor(message, flowRunId, flowNodeRunId) {
super(message);
this.flowRunId = flowRunId;
this.flowNodeRunId = flowNodeRunId;
constructor(message, options = {}) {
super(message, options);
this.flowRunId = options.flowRunId;
this.flowNodeRunId = options.flowNodeRunId;
this.nodeKey = options.nodeKey;
}

@@ -121,5 +160,5 @@ }

class EndpointError extends EngineError {
constructor(message, endpointKey) {
super(message);
this.endpointKey = endpointKey;
constructor(message, options = {}) {
super(message, options);
this.endpointKey = options.endpointKey;
}

@@ -129,29 +168,130 @@ }

class ConnectionError extends EngineError {
constructor(message, connectionKey) {
super(message);
this.connectionKey = connectionKey;
constructor(message, options = {}) {
super(message, options);
this.connectionKey = options.connectionKey;
this.connectionId = options.connectionId;
}
}
exports.ConnectionError = ConnectionError;
class NotFoundError extends InputError {
constructor(message) {
super(message);
this.code = ErrorCode.NOT_FOUND;
class NotFoundError extends BadRequestError {
constructor(message, options = {}) {
super(message, options);
this.key = ErrorKey.NOT_FOUND;
}
}
exports.NotFoundError = NotFoundError;
class ConnectionNotFoundError extends NotFoundError {
constructor(message, connectionId) {
super(message);
this.connectionId = connectionId;
class NotAuthenticatedError extends BadRequestError {
constructor(message, options = {}) {
super(message, options);
this.key = ErrorKey.ACCESS_DENIED;
}
}
exports.NotAuthenticatedError = NotAuthenticatedError;
class ConnectionNotFoundError extends BadRequestError {
constructor(message, options = {}) {
super(message, options);
this.key = ErrorKey.CONNECTION_NOT_FOUND;
this.connectionId = options.connectionId;
}
}
exports.ConnectionNotFoundError = ConnectionNotFoundError;
class NotAuthenticatedError extends InputError {
constructor(message) {
super(message);
this.code = ErrorCode.ACCESS_DENIED;
function getErrorFromData(data) {
if (!lodash_1.default.isPlainObject(data) || !data.type)
return null;
if (data.type === ErrorType.BAD_REQUEST &&
data.key === ErrorKey.CONNECTION_NOT_FOUND) {
return new ConnectionNotFoundError(data.message, data);
}
else if (data.type === ErrorType.CONNECTION) {
return new ConnectionError(data.message, data);
}
else if (data.type === ErrorType.ENDPOINT) {
return new EndpointError(data.message, data);
}
else if (data.type === ErrorType.BAD_REQUEST) {
return new BadRequestError(data.message, data);
}
else if (data.type === ErrorType.FLOW_CONFIGURATION) {
return new FlowConfigurationError(data.message, data);
}
else if (data.type === ErrorType.FLOW_RUN) {
return new FlowRunError(data.message, data);
}
else if (data.type === ErrorType.INTERNAL) {
return new InternalError(data.message, data);
}
else {
return null;
}
}
exports.NotAuthenticatedError = NotAuthenticatedError;
exports.getErrorFromData = getErrorFromData;
function extractEngineErrorData(error) {
if (error instanceof ConnectionNotFoundError) {
return new ConnectionNotFoundErrorData({
message: error.message,
key: error.key,
helpText: error.helpText,
helpLink: error.helpLink,
causedByError: error.causedByError,
connectionId: error.connectionId,
});
}
else if (error instanceof FlowConfigurationError) {
return new FlowConfigurationErrorData({
message: error.message,
key: error.key,
helpText: error.helpText,
helpLink: error.helpLink,
causedByError: error.causedByError,
flowId: error.flowId,
nodeId: error.nodeId,
});
}
else if (error instanceof FlowRunError) {
return new FlowRunErrorData({
message: error.message,
key: error.key,
helpText: error.helpText,
helpLink: error.helpLink,
causedByError: error.causedByError,
flowRunId: error.flowRunId,
flowNodeRunId: error.flowNodeRunId,
nodeKey: error.nodeKey,
});
}
else if (error instanceof EndpointError) {
return new EndpointErrorData({
message: error.message,
key: error.key,
helpText: error.helpText,
helpLink: error.helpLink,
causedByError: error.causedByError,
endpointKey: error.endpointKey,
});
}
else if (error instanceof ConnectionError) {
return new ConnectionErrorData({
message: error.message,
key: error.key,
helpText: error.helpText,
helpLink: error.helpLink,
causedByError: error.causedByError,
connectionKey: error.connectionKey,
});
}
else if (error instanceof BadRequestError) {
return new BadRequestErrorData({
message: error.message,
key: error.key,
helpText: error.helpText,
helpLink: error.helpLink,
causedByError: error.causedByError,
fields: error.fields,
});
}
else {
throw new InternalError(`Unknown error class. ${error.toString()}`);
}
}
exports.extractEngineErrorData = extractEngineErrorData;
//# sourceMappingURL=errors.js.map
{
"name": "@integration-app/sdk",
"version": "0.1.24",
"version": "0.1.25",
"description": "JavaScript SDK for Integration.app",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -177,2 +177,9 @@ import {

it('should extract locators from nested object string locator', () => {
expect(transformToDataLocator('$.name.firstName')).toEqual([
new DataLocatorObjectProperty('name'),
new DataLocatorObjectProperty('firstName'),
])
})
it('should extract locators if root is array', () => {

@@ -179,0 +186,0 @@ expect(transformToDataLocator('$[5]')).toEqual([

@@ -1,36 +0,19 @@

// TODO: define error types and use them for temp and perm errors
// export enum ConnectionTimeErrorType {
// PERMANENT = 'permanent', // happens when session expired
// TEMPORARY = 'temporary', // happens in any other case of error
// }
//
// export class ConnectionPermanentError extends Error {
// public timeType: string
//
// constructor(data) {
// super(data)
// this.timeType = ConnectionTimeErrorType.PERMANENT
// }
// }
//
// export class ConnectionTemporaryError extends Error {
// public timeType: string
//
// constructor(data) {
// super(data)
// this.timeType = ConnectionTimeErrorType.TEMPORARY
// }
// }
import _ from 'lodash'
export enum ErrorType {
INPUT = 'input', // Something is wrong with the input recevied by the Engine.
BAD_REQUEST = 'bad_request', // Something is wrong with the input received by the Engine.
ENDPOINT = 'endpoint', // Any error on the endpoint that endpoint did not designate as input-related.
CONNECTION = 'connection', // An error with the connection to an endpoint.
INTERNAL = 'internal', // Error within an engine (catch-all).
FLOW_CONFIGURATION = 'flow_configuration',
FLOW_RUN = 'flow_run',
}
export enum ErrorCode {
export enum ErrorKey {
NOT_FOUND = 'not_found',
NOT_AUTHENTICATED = 'not_authenticated',
ACCESS_DENIED = 'access_denied',
CONNECTION_NOT_FOUND = 'connection_not_found',
PERMANENT = 'permanent',
TEMPORARY = 'temporary',
}

@@ -40,5 +23,7 @@

public type: ErrorType
public code?: string
public key?: ErrorKey
public message: string
public detail?: string
public helpText?: string
public helpLink?: string
public causedByError?: BaseErrorData

@@ -52,5 +37,7 @@ constructor(data: any) {

type: this.type,
code: this.code,
key: this.key,
message: this.message,
detail: this.detail,
helpText: this.helpText,
helpLink: this.helpLink,
causedByError: this.causedByError,
} = data)

@@ -81,2 +68,3 @@ }

public connectionKey: string
public connectionId: string

@@ -87,5 +75,16 @@ constructor(data) {

this.connectionKey = data.connectionKey
this.connectionId = data.connectionId
}
}
export class ConnectionNotFoundErrorData extends BaseErrorData {
public connectionId: string
constructor(data) {
super(data)
this.type = ErrorType.BAD_REQUEST
this.connectionId = data.connectionId
}
}
export class FlowConfigurationErrorData extends BaseErrorData {

@@ -97,3 +96,3 @@ public flowId: string

super(data)
this.type = ErrorType.CONNECTION
this.type = ErrorType.FLOW_CONFIGURATION
this.flowId = data.flowId

@@ -110,3 +109,3 @@ this.nodeId = data.nodeId

super(data)
this.type = ErrorType.CONNECTION
this.type = ErrorType.FLOW_RUN
this.flowRunId = data.flowRunId

@@ -117,3 +116,3 @@ this.flowNodeRunId = data.flowNodeRunId

export class InputErrorData extends BaseErrorData {
export class BadRequestErrorData extends BaseErrorData {
public fields?: Record<string, string> // which input fields caused the error

@@ -123,3 +122,3 @@

super(data)
this.type = ErrorType.INPUT
this.type = ErrorType.BAD_REQUEST
this.fields = data.fields

@@ -130,3 +129,3 @@ }

export type ErrorData =
| InputErrorData
| BadRequestErrorData
| InternalErrorData

@@ -136,4 +135,49 @@ | ConnectionErrorData

class EngineErrorOptions {
public key?: ErrorKey
public helpText?: string
public helpLink?: string
public causedByError?: BaseErrorData
}
class BadRequestErrorOptions extends EngineErrorOptions {
public fields?: Record<string, string>
}
class FlowConfigurationErrorOptions extends BadRequestErrorOptions {
public flowId?: string
public nodeId?: string
}
class FlowRunErrorOptions extends EngineErrorOptions {
public flowRunId?: string
public flowNodeRunId?: string
public nodeKey?: string
}
class EndpointErrorOptions extends EngineErrorOptions {
public endpointKey?: string
}
class ConnectionErrorOptions extends EngineErrorOptions {
public connectionKey?: string
public connectionId?: string
}
class ConnectionNotFoundErrorOptions extends EngineErrorOptions {
public connectionId?: string
}
export class EngineError extends Error {
public code: ErrorCode
public key: ErrorKey
public helpText?: string
public helpLink?: string
public causedByError?: BaseErrorData
constructor(message, options: EngineErrorOptions = {}) {
super(message)
this.helpText = options.helpText
this.helpLink = options.helpLink
this.causedByError = options.causedByError
}
}

@@ -143,11 +187,19 @@

export class InputError extends EngineError {
constructor(message, public fields?: Record<string, string>) {
super(message)
export class BadRequestError extends EngineError {
public fields?: Record<string, string>
constructor(message, options: BadRequestErrorOptions = {}) {
super(message, options)
this.fields = options.fields
}
}
export class FlowConfigurationError extends EngineError {
constructor(message, public flowId?: string, public nodeId?: string) {
super(message)
export class FlowConfigurationError extends BadRequestError {
public flowId?: string
public nodeId?: string
constructor(message, options: FlowConfigurationErrorOptions = {}) {
super(message, options)
this.flowId = options.flowId
this.nodeId = options.nodeId
}

@@ -157,8 +209,11 @@ }

export class FlowRunError extends EngineError {
constructor(
message,
public flowRunId?: string,
public flowNodeRunId?: string,
) {
super(message)
public flowRunId?: string
public flowNodeRunId?: string
public nodeKey?: string
constructor(message, options: FlowRunErrorOptions = {}) {
super(message, options)
this.flowRunId = options.flowRunId
this.flowNodeRunId = options.flowNodeRunId
this.nodeKey = options.nodeKey
}

@@ -168,4 +223,7 @@ }

export class EndpointError extends EngineError {
constructor(message, public endpointKey?: string) {
super(message)
public endpointKey?: string
constructor(message, options: EndpointErrorOptions = {}) {
super(message, options)
this.endpointKey = options.endpointKey
}

@@ -175,25 +233,122 @@ }

export class ConnectionError extends EngineError {
constructor(message, public connectionKey?: string) {
super(message)
public connectionKey?: string
public connectionId?: string
constructor(message, options: ConnectionErrorOptions = {}) {
super(message, options)
this.connectionKey = options.connectionKey
this.connectionId = options.connectionId
}
}
export class NotFoundError extends InputError {
constructor(message) {
super(message)
this.code = ErrorCode.NOT_FOUND
export class NotFoundError extends BadRequestError {
constructor(message, options: EngineErrorOptions = {}) {
super(message, options)
this.key = ErrorKey.NOT_FOUND
}
}
export class ConnectionNotFoundError extends NotFoundError {
constructor(message, public connectionId?: string) {
super(message)
export class NotAuthenticatedError extends BadRequestError {
constructor(message, options: EngineErrorOptions = {}) {
super(message, options)
this.key = ErrorKey.ACCESS_DENIED
}
}
export class NotAuthenticatedError extends InputError {
constructor(message) {
super(message)
this.code = ErrorCode.ACCESS_DENIED
export class ConnectionNotFoundError extends BadRequestError {
public connectionId?: string
constructor(message, options: ConnectionNotFoundErrorOptions = {}) {
super(message, options)
this.key = ErrorKey.CONNECTION_NOT_FOUND
this.connectionId = options.connectionId
}
}
export function getErrorFromData(data: any) {
if (!_.isPlainObject(data) || !data.type) return null
if (
data.type === ErrorType.BAD_REQUEST &&
data.key === ErrorKey.CONNECTION_NOT_FOUND
) {
return new ConnectionNotFoundError(data.message, data)
} else if (data.type === ErrorType.CONNECTION) {
return new ConnectionError(data.message, data)
} else if (data.type === ErrorType.ENDPOINT) {
return new EndpointError(data.message, data)
} else if (data.type === ErrorType.BAD_REQUEST) {
return new BadRequestError(data.message, data)
} else if (data.type === ErrorType.FLOW_CONFIGURATION) {
return new FlowConfigurationError(data.message, data)
} else if (data.type === ErrorType.FLOW_RUN) {
return new FlowRunError(data.message, data)
} else if (data.type === ErrorType.INTERNAL) {
return new InternalError(data.message, data)
} else {
return null
}
}
export function extractEngineErrorData(error: Error) {
if (error instanceof ConnectionNotFoundError) {
return new ConnectionNotFoundErrorData({
message: error.message,
key: error.key,
helpText: error.helpText,
helpLink: error.helpLink,
causedByError: error.causedByError,
connectionId: error.connectionId,
})
} else if (error instanceof FlowConfigurationError) {
return new FlowConfigurationErrorData({
message: error.message,
key: error.key,
helpText: error.helpText,
helpLink: error.helpLink,
causedByError: error.causedByError,
flowId: error.flowId,
nodeId: error.nodeId,
})
} else if (error instanceof FlowRunError) {
return new FlowRunErrorData({
message: error.message,
key: error.key,
helpText: error.helpText,
helpLink: error.helpLink,
causedByError: error.causedByError,
flowRunId: error.flowRunId,
flowNodeRunId: error.flowNodeRunId,
nodeKey: error.nodeKey,
})
} else if (error instanceof EndpointError) {
return new EndpointErrorData({
message: error.message,
key: error.key,
helpText: error.helpText,
helpLink: error.helpLink,
causedByError: error.causedByError,
endpointKey: error.endpointKey,
})
} else if (error instanceof ConnectionError) {
return new ConnectionErrorData({
message: error.message,
key: error.key,
helpText: error.helpText,
helpLink: error.helpLink,
causedByError: error.causedByError,
connectionKey: error.connectionKey,
})
} else if (error instanceof BadRequestError) {
return new BadRequestErrorData({
message: error.message,
key: error.key,
helpText: error.helpText,
helpLink: error.helpLink,
causedByError: error.causedByError,
fields: error.fields,
})
} else {
throw new InternalError(`Unknown error class. ${error.toString()}`)
}
}

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