Socket
Socket
Sign inDemoInstall

vweb-mvc

Package Overview
Dependencies
104
Maintainers
1
Versions
133
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.2.3 to 1.2.5

10

lib/controller/filter.d.ts
import 'vweb-core';
import Parameter from "./Parameter";
import Wrapper from "../session/wrapper";
import { Response, Request } from "express-serve-static-core";
import VWebSession from "../session/wrapper";
import { VWebRequest, VWebResponse } from "../model";
declare interface FilterOptions {
readonly request: Request;
readonly response: Response;
readonly session: Wrapper;
readonly request: VWebRequest;
readonly response: VWebResponse;
readonly session: VWebSession;
readonly handle: string;

@@ -10,0 +10,0 @@ readonly target: any;

import { HttpMessageConverter } from "./MessageConverter";
import Session from "../session/wrapper";
import * as Express from "express";
export declare interface Parameters {
_body: any;
_headers: any;
req: Express.Request;
context: any;
res: Express.Response;
session: Session;
cookie: any;
next: any;
_files?: {
[filename: string]: MultiFile;
};
[others: string]: any;
}
export default class Parameter {

@@ -15,3 +31,3 @@ readonly messageConverters: HttpMessageConverter[];

getBody(): any;
setMethod(method: any, parameters: any): void;
setMethod(method: string, parameters: Parameters): void;
set(name: any, value: any): void;

@@ -18,0 +34,0 @@ convert(name: any, value: any): any;

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

};
const paramWrap = req => {
const paramWrap = (req) => {
let requestParams = {};

@@ -21,0 +21,0 @@ {

@@ -1,11 +0,21 @@

import { Download } from "../model";
import { Download, VWebRequest, VWebResponse } from "../model";
import * as Express from "express";
export default class Response {
readonly req: any;
readonly res: any;
readonly req: VWebRequest;
readonly res: VWebResponse;
readonly controller: any;
readonly logger: any;
readonly begin: any;
readonly begin: number;
constructor(req: any, res: any, controller: any, logger: any);
contentType(contentType: string): this;
acceptable(data: {
[contentType: string]: Function;
}): void;
cookie(cookies: object, options?: Express.CookieOptions): any;
cookie(cookies: string, value: any, options?: Express.CookieOptions): any;
header(headers: object): any;
header(name: string, value?: any): any;
status(status: number): this;
send(model: any): void;
download({ content, filename }: Download): void;
download(download: Download): void;
json(model: any): void;

@@ -12,0 +22,0 @@ success(model: any): void;

@@ -21,2 +21,36 @@ "use strict";

}
contentType(contentType) {
return this.header('content-type', contentType);
}
acceptable(data) {
this.res.format(Object.assign({ default: () => {
this.status(406).send('Not Acceptable');
} }, data));
}
cookie(name, value, options) {
if (typeof name === 'string') {
this.res.cookie(name, value, options);
}
else {
Reflect.ownKeys(name).forEach((k) => {
this.res.cookie(k, name[k], options);
});
}
return this;
}
header(name, value) {
if (typeof name === 'string') {
this.res.set(name, value);
}
else {
Reflect.ownKeys(name).forEach((k) => {
this.res.header(k, name[k]);
});
}
return this;
}
status(status) {
this.res.status(status);
return this;
}
send(model) {

@@ -26,10 +60,9 @@ this.res.send(model);

}
download({ content, filename }) {
download(download) {
let { content, filename } = download;
this.res.attachment(filename);
if (content instanceof URL) {
let { protocol } = content;
let url = content.toString();
if (/^http/.test(protocol)) {
if (typeof content === 'string') {
if (/^http[s]:\/\/./.test(content.substring(0, 10))) {
let axios = require("axios");
axios.get(url, {
axios.get(content, {
headers: {

@@ -44,5 +77,5 @@ "User-Agent": `Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/106.${Math.random() * 100} Safari/537.${Math.random() * 100}`,

}
else {
else if (/^file:\/\/./.test(content.substring(0, 10))) {
try {
this.res.download(decodeURIComponent(url), filename);
this.res.download(decodeURIComponent(content).substring("file://".length), filename);
}

@@ -54,2 +87,5 @@ catch (e) {

}
else {
this.res.send(content);
}
}

@@ -56,0 +92,0 @@ else {

/// <reference types="node" />
import * as Express from "express";
import Session from "../session/wrapper";
export declare interface VWebRequest extends Express.Request {
session?: Session;
[prop: string]: any;
}
export declare interface VWebResponse extends Express.Response {
}
export declare class RestModel {

@@ -38,4 +46,4 @@ constructor();

readonly filename: string;
content: Buffer | string | URL | Array<any>;
constructor(filename: string, content: Buffer | string | URL | Array<any>);
content: Buffer | string;
constructor(filename: string, content: Buffer | string);
}

@@ -42,0 +50,0 @@ declare interface XlsxSheet {

{
"name": "vweb-mvc",
"version": "1.2.3",
"version": "1.2.5",
"description": "mvc ",

@@ -5,0 +5,0 @@ "main": "./lib/index",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc