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

kequapp

Package Overview
Dependencies
Maintainers
1
Versions
65
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

kequapp - npm Package Compare versions

Comparing version 0.0.11 to 0.0.12

dist/router/render.d.ts

4

dist/body/create-get-body.d.ts

@@ -24,4 +24,4 @@ /// <reference types="node" />

required?: string[];
validate?: (body: BodyJson) => string | void;
postProcess?: (body: BodyJson) => BodyJson;
validate?(body: BodyJson): string | void;
postProcess?(body: BodyJson): BodyJson;
};

@@ -28,0 +28,0 @@ export declare type StaticFilesOptions = {

@@ -11,3 +11,3 @@ /// <reference types="node" />

(req: IncomingMessage, res: ServerResponse, override?: ConfigInput): void;
list: () => string[];
list(): string[];
}

@@ -53,7 +53,7 @@ export declare type Bundle = {

export declare type Logger = {
log: (...params: unknown[]) => unknown;
error: (...params: unknown[]) => unknown;
warn: (...params: unknown[]) => unknown;
debug: (...params: unknown[]) => unknown;
info: (...params: unknown[]) => unknown;
log(...params: unknown[]): void;
error(...params: unknown[]): void;
warn(...params: unknown[]): void;
debug(...params: unknown[]): void;
info(...params: unknown[]): void;
};

@@ -60,0 +60,0 @@ export declare type Renderer = (payload: unknown, bundle: Bundle) => Promise<void> | void;

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

res.setHeader('Content-Type', 'text/plain; charset=utf-8');
(0, request_processor_1.default)(_routes, config, {
(0, request_processor_1.default)(config, _routes, {
req,

@@ -39,0 +39,0 @@ res,

import { Route } from './create-router';
import { Bundle, Config } from '../main';
declare function requestProcessor(routes: Route[], config: Config, bundle: Bundle): Promise<void>;
declare function requestProcessor(config: Config, routes: Route[], bundle: Bundle): Promise<void>;
export default requestProcessor;

@@ -17,7 +17,7 @@ "use strict";

const path_params_1 = require("./path-params");
const render_1 = __importDefault(require("../render"));
const render_1 = __importDefault(require("./render"));
const main_1 = require("../main");
const sanitize_1 = require("../utils/sanitize");
function requestProcessor(routes, config, bundle) {
function requestProcessor(config, routes, bundle) {
return __awaiter(this, void 0, void 0, function* () {
const { errorHandler } = config;
const { req, res, url, logger } = bundle;

@@ -29,13 +29,25 @@ const pathname = (0, sanitize_1.sanitizePathname)(url.pathname);

const payload = yield lifecycle(route, bundle);
yield (0, render_1.default)(config, payload, bundle);
logger.debug(res.statusCode, req.method, pathname);
if (payload !== undefined) {
yield (0, render_1.default)(config, payload, bundle);
}
if (!res.writableEnded) {
throw main_1.Ex.InternalServerError('Response not finalized', {
pathname,
method: req.method
});
}
}
catch (error) {
const payload = yield errorHandler(error, bundle);
yield (0, render_1.default)(config, payload, bundle);
logger.debug(res.statusCode, req.method, pathname);
if (res.statusCode === 500) {
if (res.writableEnded) {
logger.error(error);
}
else {
const payload = yield config.errorHandler(error, bundle);
yield (0, render_1.default)(config, payload, bundle);
if (res.statusCode === 500) {
logger.error(error);
}
}
}
logger.debug(res.statusCode, req.method, pathname);
});

@@ -48,3 +60,6 @@ }

const payload = yield handle(bundle);
if (payload !== undefined || bundle.res.writableEnded) {
if (bundle.res.writableEnded) {
return;
}
else if (payload !== undefined) {
return payload;

@@ -51,0 +66,0 @@ }

{
"name": "kequapp",
"version": "0.0.11",
"version": "0.0.12",
"description": "Versatile, non-intrusive, tiny webapp framework",

@@ -5,0 +5,0 @@ "main": "dist/main.js",

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