Comparing version 1.0.0 to 1.0.1
'use strict'; | ||
const fetch = require('node-fetch'); | ||
class Dymo { | ||
@@ -17,17 +19,26 @@ constructor(options) { | ||
print(printerName, labelXml) { | ||
let encodedLabel = encodeURIComponent(labelXml), | ||
requestPayload = { | ||
labelXml: encodedLabel, | ||
printerName, | ||
labelSetXml: undefined, | ||
printParamsXml: undefined | ||
}; | ||
let label = `printerName=${encodeURIComponent(printerName)}&printParamsXml=&labelXml=${encodeURIComponent(labelXml)}&labelSetXml=`; | ||
return fetch(this.apiUrl, | ||
process.env.NODE_TLS_REJECT_UNAUTHORIZED = '0'; | ||
return fetch(`${this.apiUrl}/PrintLabel`, | ||
{ | ||
method: 'POST', | ||
body: JSON.stringify(requestPayload), | ||
headers: { 'Content-Type': 'application/x-www-form-urlencoded' } | ||
}); | ||
body: label, | ||
headers: { | ||
'Content-Type': 'application/x-www-form-urlencoded' | ||
} | ||
}) | ||
.then((response) => response.text()) | ||
.then((result) => result); | ||
} | ||
} | ||
getPrinters() { | ||
process.env.NODE_TLS_REJECT_UNAUTHORIZED = '0'; | ||
return fetch(`${this.apiUrl}/GetPrinters`) | ||
.then((response) => response.text()); | ||
} | ||
} | ||
module.exports = Dymo; |
{ | ||
"name": "dymojs", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"description": "A pure javascript library for printing labels on a Dymo Labelwriter printer from the browser or from nodejs.", | ||
@@ -16,3 +16,11 @@ "main": "lib/index.js", | ||
"author": "David Sandor", | ||
"license": "ISC" | ||
"license": "ISC", | ||
"devDependencies": { | ||
"chai": "^3.5.0", | ||
"mocha": "^3.2.0" | ||
}, | ||
"dependencies": { | ||
"form-data": "^2.1.2", | ||
"node-fetch": "^1.6.3" | ||
} | ||
} |
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
No README
QualityPackage does not have a README. This may indicate a failed publish or a low quality package.
Found 1 instance in 1 package
16294
6
99
0
91
2
2
2
+ Addedform-data@^2.1.2
+ Addednode-fetch@^1.6.3
+ Addedasynckit@0.4.0(transitive)
+ Addedcombined-stream@1.0.8(transitive)
+ Addeddelayed-stream@1.0.0(transitive)
+ Addedencoding@0.1.13(transitive)
+ Addedform-data@2.5.2(transitive)
+ Addediconv-lite@0.6.3(transitive)
+ Addedis-stream@1.1.0(transitive)
+ Addedmime-db@1.52.0(transitive)
+ Addedmime-types@2.1.35(transitive)
+ Addednode-fetch@1.7.3(transitive)
+ Addedsafe-buffer@5.2.1(transitive)
+ Addedsafer-buffer@2.1.2(transitive)