Socket
Socket
Sign inDemoInstall

amatino

Package Overview
Dependencies
0
Maintainers
1
Versions
16
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.0.6 to 0.0.7

tests/alpha/entity.js

2

package.json
{
"name": "amatino",
"version": "0.0.6",
"version": "0.0.7",
"description": "Javascript Node.js bindings library for the Amatino API - Double entry accounting as a service",

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

@@ -11,3 +11,3 @@ /*

const HTTPS = require('http');
const API_HOSTNAME = "172.16.101.148"
const API_HOSTNAME = "api.amatino.io"
const USER_AGENT = 'Amatino Node.js Library';

@@ -17,2 +17,3 @@ const HEADER_SIGNATURE_KEY = 'X-Signature';

const TIMEOUT_MILLISECONDS = 1000;
const QUOTE_EXPRESSION = new RegExp(/(?<!")(\b\d+\b)(?!")/g);

@@ -29,2 +30,3 @@ class _ApiRequest {

) {
this._callback = callback;

@@ -43,11 +45,7 @@

} else {
fullPathCalc = path + urlParameters;
console.log(urlParameters);
fullPathCalc = path + urlParameters.queryString();
}
if (urlParameters != null) {
fullPathCalc += urlParameters.queryString();
}
const fullPath = fullPathCalc;
const headers = this._buildHeaders(session, bodyData, path);
const requestOptions = {

@@ -77,3 +75,4 @@ 'hostname': API_HOSTNAME,

try {
responseJson = JSON.parse(responseBody);
const quotedBody = responseBody.replace(QUOTE_EXPRESSION, '\"$&\"');
responseJson = JSON.parse(quotedBody);
} catch (error) {

@@ -119,5 +118,5 @@ const errorDescription = 'JSON parse failed. Body: ';

headers['Content-Type'] = 'application/json';
const contentLength = Buffer.byteLength(JSON.stringify(bodyData));
headers['Content-Length'] = contentLength;
headers['Content-Type'] = 'application/json';

@@ -124,0 +123,0 @@ return headers;

@@ -49,7 +49,9 @@ /*

) {
const requestTime = new Date().getTime();
const self = this;
this._requestCallbacks[requestTime] = callback;
let urlParameters = null;
if (queryString) {
urlParameters = UrlParameters.initFromRawString(queryString);
}
const _ = new ApiRequest(

@@ -59,4 +61,4 @@ this._session,

method,
queryString,
body,
urlParameters,
(error, responseData) => {

@@ -63,0 +65,0 @@ callback(error, responseData);

@@ -25,2 +25,6 @@ /*

id() {
return this._sessionId;
}
static createWithEmail(email, secret, callback) {

@@ -43,3 +47,3 @@

);
callback(null, Session);
callback(null, session);
return;

@@ -60,7 +64,15 @@ })

const requestTime = Math.floor(new Date() / 1000);
let message = null;
if (!bodyData) {
message = requestTime + path;
} else {
message = requestTime + path + JSON.stringify(bodyData);
}
const hmac = CRYPTO.createHmac(SIGNATURE_HASH, this._apiKey);
bodyJson = JSON.stringify(bodyData);
hmac.update(bodyJson);
return hmac.digest('base64');
hmac.update(message, 'utf8');
const signature = hmac.digest('base64');
return signature;
}

@@ -71,1 +83,28 @@

module.exports = Session;

@@ -19,2 +19,3 @@ /*

execute() {
return new Promise(resolve => {

@@ -21,0 +22,0 @@ let _ = AmatinoAlpha.createWithEmail(

const TestAlphaInitialise = require('./alpha/initialise.js');
const TestAlphaCreateEntity = require('./alpha/entity.js');
const testAlphaInitialise = new TestAlphaInitialise();
const testAlphaCreateEntity = new TestAlphaCreateEntity();
const testSequence = [
new TestAlphaInitialise(),
new TestAlphaInitialise()
new TestAlphaCreateEntity()
]
async function run(sequenceIndex) {
if (sequenceIndex >= (testSequence.length - 1)) {
if (sequenceIndex > (testSequence.length - 1)) {
return;

@@ -13,0 +15,0 @@ }

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc