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

decl-api

Package Overview
Dependencies
Maintainers
1
Versions
23
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

decl-api - npm Package Compare versions

Comparing version 0.0.13 to 0.0.14

46

index.js

@@ -349,6 +349,9 @@ var Promise, assert, callActionFromReq, callActionFromReqAndRespond, checkConfig, checkConfigEntry, createExpressRestApi, createSocketIoApi, docs, enhanceJsonSchemaWithDefaults, getConfigDefaults, handleBooleanParam, handleNumberParam, handleParamType, normalizeAction, normalizeActions, normalizeParam, normalizeParams, normalizeType, path, sendErrorResponse, sendSuccessResponse, serveClient, stringifyApi, toJson, types, wrapActionResult, _, _socketBindings,

createSocketIoApi = (function(_this) {
return function(socket, actionsAndBindings, onError) {
return function(socket, actionsAndBindings, onError, checkPermissions) {
if (onError == null) {
onError = null;
}
if (checkPermissions == null) {
checkPermissions = null;
}
return socket.on('call', function(call) {

@@ -362,3 +365,3 @@ var actions, binding, foundBinding, _fn, _i, _len, _ref;

return function(actions, binding) {
var action, p, paramName, paramValue, params, result, _ref;
var action, hasPermissions, p, paramName, paramValue, params, result, _ref;
action = actions[call.action];

@@ -381,20 +384,33 @@ if (action != null) {

}
result = binding[call.action].apply(binding, params);
return Promise.resolve(result).then(function(result) {
var response;
response = wrapActionResult(action, result);
return socket.emit('callResult', {
id: call.id,
success: true,
result: response
if (checkPermissions != null) {
hasPermissions = checkPermissions(socket, action);
} else {
hasPermissions = true;
}
if (hasPermissions) {
result = binding[call.action].apply(binding, params);
return Promise.resolve(result).then(function(result) {
var response;
response = wrapActionResult(action, result);
return socket.emit('callResult', {
id: call.id,
success: true,
result: response
});
})["catch"](function(error) {
if (onError != null) {
onError(error);
}
return socket.emit('callResult', {
id: call.id,
success: false
});
});
})["catch"](function(error) {
if (onError != null) {
onError(error);
}
} else {
return socket.emit('callResult', {
id: call.id,
error: "permission denied",
success: false
});
});
}
}

@@ -401,0 +417,0 @@ };

{
"name": "decl-api",
"version": "0.0.13",
"version": "0.0.14",
"description": "declarative api definition for REST and real time apis",

@@ -5,0 +5,0 @@ "main": "index.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