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 0.7.2-30 to 0.7.2-31

.nyc_output/193635526567d35ec4ebbe62c00c0b37.json

7

lib/response.js

@@ -34,3 +34,5 @@ 'use strict';

setTimeout(this._make.bind(this), 50);
if (content) {
this._make();
}
}

@@ -45,2 +47,3 @@

if (isLocal) {
console.log(args);
return args;

@@ -64,2 +67,4 @@ }

this._make();
return this;

@@ -66,0 +71,0 @@ }

2

lib/server.js

@@ -73,4 +73,4 @@ 'use strict';

event: event,
socket: socket,
response: _response2.default,
socket: socket.connect.bind(socket),
data: new Proxy(new _data2.default(), {

@@ -77,0 +77,0 @@ get: function get(target, className) {

@@ -7,6 +7,6 @@ 'use strict';

var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

@@ -30,5 +30,4 @@

* @example {@lang javascript}
* const Tags = socket('tags')
* const latestTags = await Tags.get('list', { sort: 'latest' })
* const createdTag = await Tags.post('create', { name: 'nature' })
* const latestTags = await socket.get('tags/list', { sort: 'latest' })
* const createdTag = await socket.post('tags/create', { name: 'nature' })
*/

@@ -45,26 +44,2 @@ var Socket = function (_QueryBuilder) {

_createClass(Socket, [{
key: 'url',
value: function url(endpoint) {
var _instance = this.instance,
instanceName = _instance.instanceName,
spaceHost = _instance.spaceHost;
return 'https://' + instanceName + '.' + spaceHost + '/' + this.socketName + '/' + endpoint + '/';
}
}, {
key: 'connect',
value: function connect(socketName) {
this.socketName = socketName;
return this;
}
}, {
key: 'parseBody',
value: function parseBody(body) {
var isBodyAnObject = (typeof body === 'undefined' ? 'undefined' : _typeof(body)) === 'object';
return isBodyAnObject ? JSON.stringify(_extends({}, body)) : body;
}
}, {
key: 'post',

@@ -77,5 +52,5 @@ value: function post(endpoint) {

return fetch(this.url(endpoint), _extends({
return fetch(this._url(endpoint), _extends({
method: 'POST',
body: this.parseBody(body)
body: this._parseBody(body)
}, options));

@@ -115,2 +90,19 @@ }

}
}, {
key: '_url',
value: function _url(endpoint) {
var _instance = this.instance,
instanceName = _instance.instanceName,
spaceHost = _instance.spaceHost;
return 'https://' + instanceName + '.' + spaceHost + '/' + endpoint + '/';
}
}, {
key: '_parseBody',
value: function _parseBody(body) {
var isBodyAnObject = (typeof body === 'undefined' ? 'undefined' : _typeof(body)) === 'object';
return isBodyAnObject ? JSON.stringify(_extends({}, body)) : body;
}
}]);

@@ -117,0 +109,0 @@

{
"name": "syncano-server",
"version": "0.7.2-30",
"version": "0.7.2-31",
"description": "A library to intereact with the Syncano API on a server side",

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

@@ -109,6 +109,4 @@ [![XO code style](https://img.shields.io/badge/code_style-XO-5ed9c7.svg)](https://github.com/sindresorhus/xo) [![CircleCI](https://circleci.com/gh/Syncano/syncano-server-js/tree/devel.svg?style=shield&circle-token=0340c11444db6f3dc227cf310f4d8ff1bd90dee8)](https://circleci.com/gh/Syncano/syncano-server-js/tree/devel)

```js
const Tags = socket('tags')
Tags.get('list', {sort: 'latest'}).then(latestTags => {})
Tags.post('create', {name: 'nature'}).then(createdTag => {})
const latestTags = await socket.get('tags/list', { sort: 'latest' })
const createdTag = await socket.post('tags/create', { name: 'nature' })
```

@@ -115,0 +113,0 @@

@@ -13,3 +13,5 @@ /**

setTimeout(this._make.bind(this), 50)
if (content) {
this._make()
}
}

@@ -22,2 +24,3 @@

if (isLocal) {
console.log(args)
return args

@@ -42,2 +45,4 @@ }

this._make()
return this

@@ -44,0 +49,0 @@ }

@@ -47,4 +47,4 @@ import Data from './data'

event,
socket,
response: Response,
socket: socket.connect.bind(socket),
data: new Proxy(new Data(), {

@@ -51,0 +51,0 @@ get(target, className) {

@@ -7,31 +7,12 @@ import QueryBuilder from './query-builder'

* @example {@lang javascript}
* const Tags = socket('tags')
* const latestTags = await Tags.get('list', { sort: 'latest' })
* const createdTag = await Tags.post('create', { name: 'nature' })
* const latestTags = await socket.get('tags/list', { sort: 'latest' })
* const createdTag = await socket.post('tags/create', { name: 'nature' })
*/
export default class Socket extends QueryBuilder {
url(endpoint) {
const {instanceName, spaceHost} = this.instance
return `https://${instanceName}.${spaceHost}/${this.socketName}/${endpoint}/`
}
connect(socketName) {
this.socketName = socketName
return this
}
parseBody(body) {
const isBodyAnObject = typeof body === 'object'
return isBodyAnObject ? JSON.stringify({...body}) : body
}
post(endpoint, body = {}, options = {}) {
const fetch = this.fetch.bind(this)
return fetch(this.url(endpoint), {
return fetch(this._url(endpoint), {
method: 'POST',
body: this.parseBody(body),
body: this._parseBody(body),
...options

@@ -56,2 +37,14 @@ })

}
_url(endpoint) {
const {instanceName, spaceHost} = this.instance
return `https://${instanceName}.${spaceHost}/${endpoint}/`
}
_parseBody(body) {
const isBodyAnObject = typeof body === 'object'
return isBodyAnObject ? JSON.stringify({...body}) : body
}
}
import should from 'should/as-function'
import Server from '../../src/server'
describe.only('Response', () => {
describe('Response', () => {
const {response} = new Server({

@@ -49,2 +49,3 @@ token: 'testKey',

res.header('X-TEST', 'Hello World')
should(res).have.property('_headers').which.is.deepEqual({

@@ -51,0 +52,0 @@ 'X-TEST': 'Hello World'

Sorry, the diff of this file is not supported yet

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