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

@blockfrost/blockfrost-utils

Package Overview
Dependencies
Maintainers
3
Versions
50
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@blockfrost/blockfrost-utils - npm Package Compare versions

Comparing version 1.0.0-alfa.4 to 1.0.0-alfa.5

5

lib/fastify.d.ts
/// <reference types="node" />
import type { FastifyError, FastifyRequest, FastifyReply } from 'fastify';
declare type FastifyErrorWithStatusCode = FastifyError & {
statusCode: NonNullable<FastifyError['statusCode']>;
};
export declare const notFoundHandler: (_request: FastifyRequest, reply: FastifyReply) => FastifyReply;

@@ -13,2 +16,4 @@ export declare const errorHandler: (error: FastifyError, request: FastifyRequest, reply: FastifyReply) => FastifyReply;

export declare const handle500: (reply: FastifyReply, error: unknown, request: FastifyRequest) => FastifyReply;
export declare const handleFastifyError: (reply: FastifyReply, error: FastifyErrorWithStatusCode) => FastifyReply;
export declare const handleInvalidAddress: (reply: FastifyReply) => FastifyReply<import("fastify").RawServerDefault, import("http").IncomingMessage, import("http").ServerResponse<import("http").IncomingMessage>, import("fastify/types/route").RouteGenericInterface, unknown, import("fastify").FastifySchema, import("fastify").FastifyTypeProviderDefault, unknown>;
export {};

18

lib/fastify.js
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.handleInvalidAddress = exports.handle500 = exports.handle415 = exports.handle404 = exports.handle403Custom = exports.handle403 = exports.handle402 = exports.handle400Custom = exports.handle400 = exports.errorHandler = exports.notFoundHandler = void 0;
exports.handleInvalidAddress = exports.handleFastifyError = exports.handle500 = exports.handle415 = exports.handle404 = exports.handle403Custom = exports.handle403 = exports.handle402 = exports.handle400Custom = exports.handle400 = exports.errorHandler = exports.notFoundHandler = void 0;
const notFoundHandler = (_request, reply) => {

@@ -32,3 +32,7 @@ return reply

}
// Fallback and handling of generic js errors
if (error.statusCode !== undefined) {
// Handle other Fastify errors with statusCode
return (0, exports.handleFastifyError)(reply, error);
}
// Handle generic js errors
return (0, exports.handle500)(reply, error, request);

@@ -114,2 +118,12 @@ };

exports.handle500 = handle500;
const handleFastifyError = (reply, error) => reply
.code(error.statusCode)
.header('Content-Type', 'application/json; charset=utf-8')
.send({
// error.name is always "FastifyError", use error.code to provide more info to a client (eg. FST_ERR_CTP_INVALID_MEDIA_TYPE)
error: error.name,
message: error.message,
status_code: error.statusCode,
});
exports.handleFastifyError = handleFastifyError;
const handleInvalidAddress = (reply) => {

@@ -116,0 +130,0 @@ return (0, exports.handle400Custom)(reply, 'Invalid address for this network or malformed address format.');

2

package.json
{
"name": "@blockfrost/blockfrost-utils",
"version": "1.0.0-alfa.4",
"version": "1.0.0-alfa.5",
"repository": "git@github.com:blockfrost/blockfrost-utils.git",

@@ -5,0 +5,0 @@ "license": "Apache-2.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