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

sofa-api

Package Overview
Dependencies
Maintainers
4
Versions
120
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

sofa-api - npm Package Compare versions

Comparing version 0.14.0 to 0.15.0

31

index.js

@@ -484,5 +484,30 @@ 'use strict';

const defaultErrorHandler = (errors) => {
return new fetch.Response(JSON.stringify(errors[0]), {
status: 500,
headers: { 'Content-Type': 'application/json' },
var _a;
let status;
const headers = {
'Content-Type': 'application/json; charset=utf-8',
};
for (const error of errors) {
if (typeof error === 'object' && error != null && ((_a = error.extensions) === null || _a === void 0 ? void 0 : _a.http)) {
if (error.extensions.http.status &&
(!status || error.extensions.http.status > status)) {
status = error.extensions.http.status;
}
if (error.extensions.http.headers) {
Object.assign(headers, error.extensions.http.headers);
}
}
}
if (!status) {
status = 500;
}
if (errors.length === 1) {
return new fetch.Response(JSON.stringify(errors[0]), {
status,
headers,
});
}
return new fetch.Response(JSON.stringify({ errors }), {
status,
headers,
});

@@ -489,0 +514,0 @@ };

2

package.json
{
"name": "sofa-api",
"version": "0.14.0",
"version": "0.15.0",
"description": "Create REST APIs with GraphQL",

@@ -5,0 +5,0 @@ "sideEffects": false,

import { Request as IttyRequest, Router } from 'itty-router';
import type { Sofa } from './sofa';
export declare type ErrorHandler = (errors: ReadonlyArray<any>) => Response;
declare module 'graphql' {
interface GraphQLHTTPErrorExtensions {
status?: number;
headers?: Record<string, string>;
}
interface GraphQLErrorExtensions {
http?: GraphQLHTTPErrorExtensions;
}
}
declare type SofaRequest = IttyRequest & Request;
export declare function createRouter(sofa: Sofa): Router<SofaRequest, {}>;
export {};

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