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

syncano-server

Package Overview
Dependencies
Maintainers
2
Versions
99
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

syncano-server - npm Package Compare versions

Comparing version 1.0.1-6 to 1.0.1-7

26

lib/response.js

@@ -9,2 +9,8 @@ 'use strict';

var _lodash = require('lodash.get');
var _lodash2 = _interopRequireDefault(_lodash);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }

@@ -51,2 +57,6 @@

var responses = (0, _lodash2.default)(config, 'meta.metadata.response', {});
mapYamlResponsesToMethods(response, responses, config);
response.header = function (key, value) {

@@ -60,3 +70,2 @@ response._headers = _extends({}, response._headers, _defineProperty({}, key, value));

var status = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 200;
return new Response(config, JSON.stringify(content), status, 'application/json', response._headers);

@@ -68,2 +77,17 @@ };

function mapYamlResponsesToMethods(response, responses, config) {
Object.keys(responses).forEach(function (name) {
var _responses$name = responses[name],
_responses$name$mimet = _responses$name.mimetype,
mimetype = _responses$name$mimet === undefined ? 'application/json' : _responses$name$mimet,
_responses$name$exit_ = _responses$name.exit_code,
status = _responses$name$exit_ === undefined ? 200 : _responses$name$exit_;
var isJSON = mimetype === 'application/json';
response[name] = function (content) {
return new Response(config, isJSON ? JSON.stringify(content) : content, status, mimetype, response._headers);
};
});
}
module.exports = exports['default'];

2

package.json
{
"name": "syncano-server",
"version": "1.0.1-6",
"version": "1.0.1-7",
"description": "A library to intereact with the Syncano API on a server side.",

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

@@ -0,1 +1,3 @@

import get from 'lodash.get'
/**

@@ -38,2 +40,6 @@ * Unified response helper

const responses = get(config, 'meta.metadata.response', {})
mapYamlResponsesToMethods(response, responses, config)
response.header = (key, value) => {

@@ -48,4 +54,4 @@ response._headers = {

response.json = (content, status = 200) => {
return new Response(
response.json = (content, status = 200) =>
new Response(
config,

@@ -57,5 +63,22 @@ JSON.stringify(content),

)
}
return response
}
function mapYamlResponsesToMethods(response, responses, config) {
Object.keys(responses).forEach(name => {
const {mimetype = 'application/json', exit_code: status = 200} = responses[
name
]
const isJSON = mimetype === 'application/json'
response[name] = content =>
new Response(
config,
isJSON ? JSON.stringify(content) : content,
status,
mimetype,
response._headers
)
})
}
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