@dreygur/td365
Advanced tools
Comparing version 1.0.5 to 1.0.6
@@ -7,2 +7,4 @@ import express from 'express'; | ||
// process.env.PROXY | ||
const auth: Auth = { | ||
@@ -9,0 +11,0 @@ "action": "authentication", |
@@ -11,2 +11,3 @@ "use strict"; | ||
const subscribe = () => subscriptions.forEach(subscription => ws.send(JSON.stringify(subscription))); | ||
const login = () => startListening(auth, subscriptions, allEvents, callback, secondCallBack); | ||
// On Error | ||
@@ -19,3 +20,3 @@ ws.on('error', console.error); | ||
// Subscribe | ||
subscribe(); | ||
// subscribe() | ||
}); | ||
@@ -25,7 +26,16 @@ // On Event/Response | ||
const event = JSON.parse(data.toString()); | ||
console.log(event); | ||
if (event.t === 'heartbeat') | ||
ws.send(JSON.stringify(event.d)); | ||
else if (event.t === 'authenticationResponse' && event.d.HasError) | ||
login(); | ||
else if (event.t === 'authenticationResponse' && !event.d.HasError) { | ||
subscribe(); | ||
secondCallBack(); | ||
} | ||
else | ||
callback(allEvents, event, subscribe); | ||
if (event.t === 'heartbeat') | ||
ws.send(JSON.stringify(event.d)); | ||
else | ||
callback(allEvents, event, subscribe); | ||
// Unnecessary But Asked by @jayeen28 | ||
@@ -32,0 +42,0 @@ if (event.t === 'authenticationResponse' && !event.d.HasError) { |
@@ -7,2 +7,3 @@ "use strict"; | ||
const axios_1 = __importDefault(require("axios")); | ||
const https_proxy_agent_1 = require("https-proxy-agent"); | ||
const BASE_URL = 'https://demo.tradedirect365.com'; | ||
@@ -17,2 +18,3 @@ async function request(path, cookie, reqBody) { | ||
method: 'POST', | ||
httpsAgent: new https_proxy_agent_1.HttpsProxyAgent(process.env.PROXY || ''), | ||
headers: { | ||
@@ -19,0 +21,0 @@ cookie, |
{ | ||
"name": "@dreygur/td365", | ||
"version": "1.0.5", | ||
"version": "1.0.6", | ||
"description": "A wraper for tradedirect365.com", | ||
@@ -32,2 +32,3 @@ "main": "lib/index.js", | ||
"express": "^4.18.2", | ||
"https-proxy-agent": "^7.0.1", | ||
"node-fetch": "^3.3.2", | ||
@@ -34,0 +35,0 @@ "ws": "^8.13.0" |
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
37666
865
6
2
1
+ Addedhttps-proxy-agent@^7.0.1
+ Addedagent-base@7.1.3(transitive)
+ Addeddebug@4.4.0(transitive)
+ Addedhttps-proxy-agent@7.0.6(transitive)