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.6 to 0.0.8

9

docs.js

@@ -132,2 +132,11 @@ var assert, declapi, genDocForParamDescription, genDocsForAction, genDocsForActions, genDocsForParam, genDocsForParams, genRestDocs, glueConcat, glueList, glueType, printAction, printParam, printParamlist, printType, _;

return _results;
})()) + '</ul>' : '') + "\n " + (param.items != null ? '<ul class="action-param-items">' + glueConcat((function() {
var _ref, _results;
_ref = param.items;
_results = [];
for (n in _ref) {
p = _ref[n];
_results.push(genDocsForParam(n, p));
}
return _results;
})()) + '</ul>' : '') + "\n</li>";

@@ -134,0 +143,0 @@ };

64

index.js

@@ -1,2 +0,2 @@

var Q, assert, callActionFromReq, callActionFromReqAndRespond, checkConfig, checkConfigEntry, createExpressRestApi, docs, enhanceWithDefaults, getConfigDefaults, handleBooleanParam, handleNumberParam, handleParamType, normalizeAction, normalizeActions, normalizeParam, normalizeParams, normalizeType, path, sendErrorResponse, sendSuccessResponse, serveClient, stringifyApi, toJson, types, wrapActionResult, _,
var Q, 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,
__indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; };

@@ -154,5 +154,7 @@

enhanceWithDefaults = function(def, config) {
enhanceJsonSchemaWithDefaults = function(def, config) {
var defaults;
defaults = getConfigDefaults(def);
assert(def.type === "object", "Expected def to be a config schema with type \"object\"");
assert(typeof def.properties === "object");
defaults = getConfigDefaults(def.properties);
config.__proto__ = defaults;

@@ -331,2 +333,55 @@ return config;

_socketBindings = null;
createSocketIoApi = (function(_this) {
return function(socket, actionsAndBindings, onError) {
if (onError == null) {
onError = null;
}
return socket.on('call', function(call) {
var actions, binding, foundBinding, _fn, _i, _len, _ref;
assert((call.action != null) && typeof call.action === "string");
assert((call.params != null) && Array.isArray(call.params));
assert(call.id != null ? typeof call.id === "string" || typeof call.id === "number" : true);
foundBinding = false;
_fn = (function(_this) {
return function(actions, binding) {
var action, result;
action = actions[call.action];
if (action != null) {
foundBinding = true;
result = binding[call.action].apply(binding, call.params);
return Q(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
});
});
}
};
})(this);
for (_i = 0, _len = actionsAndBindings.length; _i < _len; _i++) {
_ref = actionsAndBindings[_i], actions = _ref[0], binding = _ref[1];
_fn(actions, binding);
}
if (!foundBinding) {
if (onError != null) {
return onError(new Error("Could not find action \"" + call.action + "\"."));
}
}
});
};
})(this);
serveClient = function(req, res) {

@@ -358,3 +413,4 @@ return res.sendfile(path.resolve(__dirname, 'clients/decl-api-client.js'));

getConfigDefaults: getConfigDefaults,
enhanceWithDefaults: enhanceWithDefaults
enhanceJsonSchemaWithDefaults: enhanceJsonSchemaWithDefaults,
createSocketIoApi: createSocketIoApi
};

2

package.json
{
"name": "decl-api",
"version": "0.0.6",
"version": "0.0.8",
"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