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

@blockfrost/blockfrost-js

Package Overview
Dependencies
Maintainers
2
Versions
107
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@blockfrost/blockfrost-js - npm Package Compare versions

Comparing version 2.0.2 to 3.0.0-beta.1

lib/utils/errors.d.ts

7

lib/index.d.ts
import { components } from './types/OpenApi';
import { ErrorType } from './types';
import { BlockFrostAPI } from './BlockFrostAPI';
import { BlockFrostIPFS } from './BlockFrostIPFS';
import { parseAsset } from './utils/index';
import { BlockfrostClientError, BlockfrostServerError, BlockfrostGenericError } from './utils/errors';
declare type Responses = components['schemas'];
declare type Error = ErrorType;
export { BlockFrostAPI, BlockFrostIPFS, parseAsset };
export type { Responses, Error };
export { BlockFrostAPI, BlockFrostIPFS, parseAsset, BlockfrostClientError, BlockfrostServerError, BlockfrostGenericError, };
export type { Responses };
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.parseAsset = exports.BlockFrostIPFS = exports.BlockFrostAPI = void 0;
exports.BlockfrostGenericError = exports.BlockfrostServerError = exports.BlockfrostClientError = exports.parseAsset = exports.BlockFrostIPFS = exports.BlockFrostAPI = void 0;
const BlockFrostAPI_1 = require("./BlockFrostAPI");

@@ -10,1 +10,5 @@ Object.defineProperty(exports, "BlockFrostAPI", { enumerable: true, get: function () { return BlockFrostAPI_1.BlockFrostAPI; } });

Object.defineProperty(exports, "parseAsset", { enumerable: true, get: function () { return index_1.parseAsset; } });
const errors_1 = require("./utils/errors");
Object.defineProperty(exports, "BlockfrostClientError", { enumerable: true, get: function () { return errors_1.BlockfrostClientError; } });
Object.defineProperty(exports, "BlockfrostServerError", { enumerable: true, get: function () { return errors_1.BlockfrostServerError; } });
Object.defineProperty(exports, "BlockfrostGenericError", { enumerable: true, get: function () { return errors_1.BlockfrostGenericError; } });

@@ -9,2 +9,3 @@ import { AxiosError } from 'axios';

customBackend: string;
isTestnet: boolean;
};

@@ -11,0 +12,0 @@ declare type AdditionalOptions = {

import { ParseAssetResult } from '../types/utils';
import { ErrorType, ExtendedAxiosError, Headers, Options, ValidatedOptions, PaginationOptions, AdditionalEndpointOptions, AllMethodOptions } from '../types';
import { ExtendedAxiosError, Headers, Options, ValidatedOptions, PaginationOptions, AdditionalEndpointOptions, AllMethodOptions } from '../types';
import { BlockfrostClientError, BlockfrostGenericError, BlockfrostServerError } from './errors';
export declare const validateOptions: (options?: Options | undefined) => ValidatedOptions;
export declare const getHeaders: (projectId: string | undefined, userAgent?: string | undefined) => Headers | null;
export declare const handleError: (error: ExtendedAxiosError) => ErrorType;
export declare const handleError: (error: ExtendedAxiosError) => BlockfrostServerError | BlockfrostClientError | BlockfrostGenericError;
export declare const getAdditionalParams: (options?: AdditionalEndpointOptions | undefined) => AdditionalEndpointOptions;

@@ -7,0 +8,0 @@ export declare const getPaginationOptions: (options?: PaginationOptions | undefined) => PaginationOptions;

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

const config_1 = require("../config");
const errors_1 = require("./errors");
const validateOptions = (options) => {

@@ -57,7 +58,7 @@ var _a, _b, _c;

// system errors such as -3008 ENOTFOUND
return {
return new errors_1.BlockfrostClientError({
errno: error.errno,
code: error.code,
message: error.message, // getaddrinfo ENOTFOUND cardano-testnet.blockfrost.io'
};
});
}

@@ -68,3 +69,3 @@ if (error.response) {

// response.data is already properly formatted
return error.response.data;
return new errors_1.BlockfrostServerError(error.response.data);
}

@@ -74,7 +75,7 @@ // response.data may contain html output (eg. errors returned by nginx)

const statusText = error.response.statusText;
return {
return new errors_1.BlockfrostServerError({
status_code: statusCode,
message: `${statusCode}: ${statusText}`,
error: statusText,
};
});
}

@@ -85,10 +86,10 @@ else if (error.request) {

const errorName = (_c = jsonError.error) !== null && _c !== void 0 ? _c : 'Error';
return `${errorName}: ${message}`;
return new errors_1.BlockfrostGenericError(`${errorName}: ${message}`);
}
else if (error.message) {
return error.message;
return new errors_1.BlockfrostGenericError(error.message);
}
else {
// we shouldn't get here, but just to be safe...
return 'Unexpected error';
return new errors_1.BlockfrostGenericError('Unexpected error');
}

@@ -95,0 +96,0 @@ };

{
"name": "@blockfrost/blockfrost-js",
"version": "2.0.2",
"version": "3.0.0-beta.1",
"description": "A JavaScript/TypeScript SDK for interacting with the https://blockfrost.io API",

@@ -57,2 +57,3 @@ "keywords": [

"rimraf": "^3.0.2",
"serialize-error": "^8.1.0",
"ts-jest": "^27.0.3",

@@ -59,0 +60,0 @@ "ts-node": "10.1.0",

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