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

webdetta

Package Overview
Dependencies
Maintainers
0
Versions
479
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

webdetta - npm Package Compare versions

Comparing version 0.0.54 to 0.0.55

src/sdk/api.js

2

package.json
{
"name": "webdetta",
"version": "0.0.54",
"version": "0.0.55",
"author": "Fedot Kriutchenko <fodyadev@gmail.com>",

@@ -5,0 +5,0 @@ "description": "",

import { safe } from '../common/func.js';
import rpcApiWs from '../rpc-api/ws.js';
import rpcApiHttp from '../rpc-api/http.js';
import { Api } from '../rpc-api/api.js';
import { SdkServer } from '../rpc-api/sdk.js';

@@ -42,23 +41,12 @@ import bytes from 'bytes';

wsApi: (path, { pool, onOpen, onClose, ctx, methods }) => {
const api = rpcApiWs({ pool, onOpen, onClose, methods });
wss.route(path, (req, ws) => ctx.call(api.upgrade(ws), req));
wsApi: (path, methods) => {
const api = Api.WS(methods);
wss.route(path, (req, ws) => api.upgrade(req, ws));
return instance;
},
httpApi: (path, { bodyLimit='50mb', ctx, methods }) => {
httpApi: (path, methods) => {
path = path.replace(/\/$/, '') + '/:name';
const api = rpcApiHttp(methods);
app.post(path, ...[
...(!bodyLimit ? [] : [
bodyParser.json({limit: bodyLimit}),
bodyParser.urlencoded({limit: bodyLimit, extended: true})
]),
async (req, res) => {
await ctx.call(req.ctx = {}, req, res);
if (res.headersSent) return;
const r = await api.processCall(req.ctx, req.params.name, req.body);
res.status(r.status).send(r.result);
}
]);
const api = Api.HTTP(methods);
app.post(path, bodyParser.json({limit: '50mb'}), api.processRequest);
return instance;

@@ -96,12 +84,4 @@ },

const { serverMethods, clientCode } = SdkServer(methods);
instance.httpHandler.get(path, (req, res) => {
const url = Object.assign(new URL('http://localhost'), {
host: req.headers.host,
protocol: isSecure ? 'wss:' : 'ws:',
pathname: path
});
res.contentType('text/javascript');
res.send(clientCode(url));
});
instance.wsApi(path, { ctx: () => {}, methods: serverMethods });
instance.httpHandler.get(path, SdkServer.httpHandler(clientCode));
instance.wsApi(path, { methods: serverMethods });
return instance;

@@ -108,0 +88,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