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

@devo/js-helper

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@devo/js-helper - npm Package Compare versions

Comparing version 1.0.1 to 1.0.3

.travis.yml

13

CHANGELOG.md

@@ -5,2 +5,15 @@ # Devo JavaScript SDK Helper Library

## Version 1.0.3
* Ignore trailing slash '/' in URLs.
* Do not validate credentials without URL.
## Version 1.0.2
Enabled [Travis-CI](https://travis-ci.com/DevoInc/js-helper).
## Version 1.0.1
Changed license to MIT in package.json.
## Version 1.0.0

@@ -7,0 +20,0 @@

10

lib/config.js

@@ -27,3 +27,7 @@ 'use strict';

this._mustSign = false;
this._url = credentials.url;
if (credentials.url && credentials.url.endsWith('/')) {
this._url = credentials.url.substring(0, credentials.url.length - 1);
} else {
this._url = credentials.url
}
if (credentials.token) {

@@ -129,2 +133,6 @@ this._token = credentials.token;

function validate(opc) {
if (opc.url.startsWith('undefined')) {
console.error('Invalid URL')
return false
}
if (!opc.body) {

@@ -131,0 +139,0 @@ console.error('No body')

2

package.json
{
"name": "@devo/js-helper",
"version": "1.0.1",
"version": "1.0.3",
"description": "Devo JavaScript helper library",

@@ -5,0 +5,0 @@ "author": "Devo Dev Team",

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

[![Build Status](https://api.travis-ci.com/DevoInc/js-helper.svg)](http://travis-ci.com/DevoInc/js-helper)
# Devo JavaScript SDK Helper Library.

@@ -2,0 +4,0 @@

@@ -7,12 +7,13 @@ 'use strict';

const FROM = '2018-07-09T09:00Z';
const TO = '2018-07-09T09:30Z';
const QUERY =
const dateFrom = '2018-07-09T09:00Z';
const dateTo = '2018-07-09T09:30Z';
const query =
'select eventdate, sessionid, level from demo.ecommerce.data';
const QUERY_ID = '1234566789';
const API_KEY =
const queryId = '1234566789';
const apiKey =
'fakekey';
const API_SECRET =
const apiSecret =
'fakesecret';
const TOKEN = 'faketoken';
const token = 'faketoken';
const url = 'http://test.test/test';

@@ -28,8 +29,9 @@ describe('Config validation', () => {

const opc = config.create({
apiKey: API_KEY,
apiSecret: API_SECRET,
url,
apiKey,
apiSecret,
}).parseQuery({
dateFrom: FROM,
dateTo: TO,
query: QUERY,
dateFrom,
dateTo,
query,
});

@@ -39,6 +41,6 @@ config.validate(opc).should.equal(true);

it('parses invalid config without auth', () => {
it('parses invalid config without url', () => {
const opc = config.create({}).parseQuery({
dateFrom: FROM,
dateTo: TO,
dateFrom,
dateTo,
queryId: '123456',

@@ -49,9 +51,18 @@ });

it('parses invalid config without auth', () => {
const opc = config.create({url}).parseQuery({
dateFrom,
dateTo,
queryId: '123456',
});
config.validate(opc).should.equal(false);
});
it('parses invalid config without query or queryId', () => {
const opc = config.create({
apiKey: API_KEY,
apiSecret: API_SECRET,
apiKey,
apiSecret,
}).parseQuery({
dateFrom: FROM,
dateTo: TO,
dateFrom,
dateTo,
});

@@ -63,8 +74,9 @@ config.validate(opc).should.equal(false);

const opc = config.create({
apiKey: API_KEY,
apiSecret: API_SECRET,
url,
apiKey,
apiSecret,
}).parseQuery({
dateFrom: FROM,
dateTo: TO,
query: QUERY,
dateFrom,
dateTo,
query,
});

@@ -76,7 +88,8 @@ config.validate(opc).should.equal(true);

const opc = config.create({
token: TOKEN,
url,
token,
}).parseQuery({
dateFrom: FROM,
dateTo: TO,
query: QUERY,
dateFrom,
dateTo,
query,
});

@@ -88,8 +101,9 @@ config.validate(opc).should.equal(true);

const opc = config.create({
apiKey: API_KEY,
apiSecret: API_SECRET,
url,
apiKey,
apiSecret,
}).parseQuery({
dateFrom: FROM,
dateTo: TO,
queryId: QUERY_ID,
dateFrom,
dateTo,
queryId,
});

@@ -101,11 +115,32 @@ config.validate(opc).should.equal(true);

const opc = config.create({
token: TOKEN,
url,
token,
}).parseQuery({
dateFrom: FROM,
dateTo: TO,
queryId: QUERY_ID,
dateFrom,
dateTo,
queryId,
});
config.validate(opc).should.equal(true);
});
it('parses URL that ends with and without /', () => {
const opc1 = config.create({
url: 'http://test.test/test/',
token,
}).parseQuery({
dateFrom,
dateTo,
queryId,
});
const opc2 = config.create({
url,
token,
}).parseQuery({
dateFrom,
dateTo,
queryId,
});
opc1.url.should.equal(opc2.url)
});
});
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