Comparing version 0.0.3 to 0.0.4
{ | ||
"name": "alphatech", | ||
"version": "0.0.3", | ||
"version": "0.0.4", | ||
"description": "", | ||
@@ -20,5 +20,5 @@ "main": "index.js", | ||
"dependencies": { | ||
"axios": "^0.19.2", | ||
"file-type": "^14.3.0", | ||
"form-data": "^3.0.0", | ||
"got": "^11.1.2", | ||
"image-size": "^0.8.3", | ||
@@ -25,0 +25,0 @@ "mime": "^2.4.5" |
const { api } = require('../utils'); | ||
const { wrapper } = require('../wrapper'); | ||
module.exports.makePdf = wrapper(async function makePdf(content, options = {}) { | ||
const { path } = options; | ||
const { body } = await api.post('/pdf/make', { | ||
json: { | ||
path, | ||
content, | ||
}, | ||
responseType: 'json', | ||
module.exports.makePdf = wrapper(async function makePdf(content, params = {}) { | ||
const { data } = await api.post('/pdf/make', { | ||
...params, | ||
content, | ||
}); | ||
return body; | ||
return data; | ||
}); |
@@ -1,2 +0,2 @@ | ||
const got = require('got'); | ||
const axios = require('axios'); | ||
const { getFormData } = require('./get-form-data'); | ||
@@ -20,4 +20,7 @@ const { requestUpload } = require('./request-upload.js'); | ||
const { body, headers } = await got.post(signature.url, { | ||
body: form, | ||
const { data, headers } = await axios.post(signature.url, form, { | ||
headers: { | ||
...form.getHeaders(), | ||
'Content-Length': form.getLengthSync(), | ||
}, | ||
}); | ||
@@ -31,3 +34,3 @@ | ||
// local | ||
const matched = body.match(/(?<=<Etag>)(.*)(?=<\/Etag>)/); | ||
const matched = data.match(/(?<=<Etag>)(.*)(?=<\/Etag>)/); | ||
// eslint-disable-next-line no-unneeded-ternary | ||
@@ -34,0 +37,0 @@ [etag] = matched ? matched : []; |
const { api } = require('../utils'); | ||
module.exports.requestUpload = async function requestUpload(path, json) { | ||
const { body } = await api.post('/file/request-upload', { | ||
json: { | ||
path, | ||
...json, | ||
}, | ||
responseType: 'json', | ||
module.exports.requestUpload = async function requestUpload(path, params) { | ||
const { data } = await api.post('/file/request-upload', { | ||
...params, | ||
path, | ||
}); | ||
if (!body.signature) { | ||
if (!data.signature) { | ||
throw new Error('Upload request failed'); | ||
} | ||
return body; | ||
return data; | ||
}; |
@@ -1,12 +0,10 @@ | ||
const got = require('got'); | ||
const axios = require('axios'); | ||
const { getConfig } = require('../config'); | ||
module.exports.api = { | ||
post: function post(url, options) { | ||
post: function post(url, params) { | ||
const { domain, version, token, teamId } = getConfig(); | ||
return got.post(`${domain}${url}`, { | ||
...options, | ||
return axios.post(`${domain}${url}`, params, { | ||
headers: { | ||
...(options.headers || {}), | ||
'x-alphatech-javascript-version': version, | ||
@@ -13,0 +11,0 @@ authorization: `Bearer ${token}.${teamId}`, |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
6573
210
1
+ Addedaxios@^0.19.2
+ Addedaxios@0.19.2(transitive)
+ Addedfollow-redirects@1.5.10(transitive)
- Removedgot@^11.1.2
- Removed@sindresorhus/is@4.6.0(transitive)
- Removed@szmarczak/http-timer@4.0.6(transitive)
- Removed@types/cacheable-request@6.0.3(transitive)
- Removed@types/http-cache-semantics@4.0.4(transitive)
- Removed@types/keyv@3.1.4(transitive)
- Removed@types/node@22.9.3(transitive)
- Removed@types/responselike@1.0.3(transitive)
- Removedcacheable-lookup@5.0.4(transitive)
- Removedcacheable-request@7.0.4(transitive)
- Removedclone-response@1.0.3(transitive)
- Removeddecompress-response@6.0.0(transitive)
- Removeddefer-to-connect@2.0.1(transitive)
- Removedend-of-stream@1.4.4(transitive)
- Removedget-stream@5.2.0(transitive)
- Removedgot@11.8.6(transitive)
- Removedhttp-cache-semantics@4.1.1(transitive)
- Removedhttp2-wrapper@1.0.3(transitive)
- Removedjson-buffer@3.0.1(transitive)
- Removedkeyv@4.5.4(transitive)
- Removedlowercase-keys@2.0.0(transitive)
- Removedmimic-response@1.0.13.1.0(transitive)
- Removednormalize-url@6.1.0(transitive)
- Removedonce@1.4.0(transitive)
- Removedp-cancelable@2.1.1(transitive)
- Removedpump@3.0.2(transitive)
- Removedquick-lru@5.1.1(transitive)
- Removedresolve-alpn@1.2.1(transitive)
- Removedresponselike@2.0.1(transitive)
- Removedundici-types@6.19.8(transitive)
- Removedwrappy@1.0.2(transitive)