Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@anvilco/anvil

Package Overview
Dependencies
Maintainers
6
Versions
39
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@anvilco/anvil - npm Package Compare versions

Comparing version 2.9.4 to 2.10.0

.idea/inspectionProfiles/Project_Default.xml

150

CHANGELOG.md

@@ -10,18 +10,29 @@ # Changelog

## [v2.9.4](https://github.com/anvilco/node-anvil/compare/v2.9.3...v2.9.4)
## [v2.10.0](https://github.com/anvilco/node-anvil/compare/v2.9.4...v2.10.0)
### Merged
- Update the readme intro to be more informative [`#101`](https://github.com/anvilco/node-anvil/pull/101)
- Add initial Typescript support [`#102`](https://github.com/anvilco/node-anvil/pull/102)
## [v2.9.3](https://github.com/anvilco/node-anvil/compare/v2.9.2...v2.9.3)
### Commits
- Add JSDoc comments for some func params [`4c28568`](https://github.com/anvilco/node-anvil/commit/4c285686efb0c27549da97dae72ceb3ac5ad4b58)
- Move dist -> types, "types" in package.json [`627b5c1`](https://github.com/anvilco/node-anvil/commit/627b5c1734df38568a21ba7fb00cb34c5ff39065)
- Add typescript types [`8e25ca4`](https://github.com/anvilco/node-anvil/commit/8e25ca4e830ad80b9cdc4abe8a9a6ad8847f645d)
## [v2.9.4](https://github.com/anvilco/node-anvil/compare/v2.9.3...v2.9.4) - 2022-03-25
### Merged
- Upgrade dependencies [`#99`](https://github.com/anvilco/node-anvil/pull/99)
- Update the readme intro to be more informative [`#101`](https://github.com/anvilco/node-anvil/pull/101)
## [v2.9.2](https://github.com/anvilco/node-anvil/compare/v2.9.1...v2.9.2)
### Commits
- Update the intro to be more informative [`fffcbbc`](https://github.com/anvilco/node-anvil/commit/fffcbbc89910280a39c46036167d0c1d04a7ba2e)
## [v2.9.3](https://github.com/anvilco/node-anvil/compare/v2.2.0...v2.9.3) - 2022-03-25
### Merged
- Upgrade dependencies [`#99`](https://github.com/anvilco/node-anvil/pull/99)
- Bump mocha from 8.1.3 to 9.1.3 [`#70`](https://github.com/anvilco/node-anvil/pull/70)

@@ -48,73 +59,12 @@ - Bump sinon from 9.0.1 to 11.1.2 [`#66`](https://github.com/anvilco/node-anvil/pull/66)

- Bump glob-parent from 5.1.0 to 5.1.2 [`#49`](https://github.com/anvilco/node-anvil/pull/49)
### Commits
- Add HTML to PDF example script [`c64ea89`](https://github.com/anvilco/node-anvil/commit/c64ea89d96744e9eaa1764da1d88f774f71398c6)
- handle various error response structures better [`6e8f1c9`](https://github.com/anvilco/node-anvil/commit/6e8f1c95803178e1d259234b164c4276fcd30d43)
- handle errors even when was not supposed to be json [`d15a71a`](https://github.com/anvilco/node-anvil/commit/d15a71a8bac45e6f7c272e46d62ba85820d691c6)
## [v2.9.1](https://github.com/anvilco/node-anvil/compare/v2.9.0...v2.9.1)
### Merged
- Bump normalize-url from 4.5.0 to 4.5.1 [`#50`](https://github.com/anvilco/node-anvil/pull/50)
## [v2.9.0](https://github.com/anvilco/node-anvil/compare/v2.8.2...v2.9.0)
### Merged
- Adjust rate limiting dynamically based on API response [`#48`](https://github.com/anvilco/node-anvil/pull/48)
### Commits
- updated limiter package. will set the limits based on what the API tells us they are [`420f6bc`](https://github.com/anvilco/node-anvil/commit/420f6bc6c69bc89850495bf9c2430390fc0e3bad)
- added tests [`fdfea62`](https://github.com/anvilco/node-anvil/commit/fdfea62db1f0c4027ad11cb35b94e6fda05e460d)
- comments [`f9c775b`](https://github.com/anvilco/node-anvil/commit/f9c775b5a5c5f231c0d31e678b8538b82f37c3e7)
## [v2.8.2](https://github.com/anvilco/node-anvil/compare/v2.8.1...v2.8.2)
### Merged
- bump handlebars to 4.7.7 [`#47`](https://github.com/anvilco/node-anvil/pull/47)
- Bump hosted-git-info from 2.8.5 to 2.8.9 [`#46`](https://github.com/anvilco/node-anvil/pull/46)
- Bump lodash from 4.17.19 to 4.17.21 [`#45`](https://github.com/anvilco/node-anvil/pull/45)
## [v2.8.1](https://github.com/anvilco/node-anvil/compare/v2.8.0...v2.8.1) - 2021-04-01
### Merged
- [security] update lockfile to fix security vuln [`#42`](https://github.com/anvilco/node-anvil/pull/42)
### Commits
- update lockfile to fix security vuln [`4e21e59`](https://github.com/anvilco/node-anvil/commit/4e21e5933598e019c8178cb83ea6c1fb61389ffa)
## [v2.8.0](https://github.com/anvilco/node-anvil/compare/v2.7.2...v2.8.0) - 2021-04-01
### Merged
- Allow passing ratelimit options to the client [`#41`](https://github.com/anvilco/node-anvil/pull/41)
### Commits
- Add options to readme [`8eae1cb`](https://github.com/anvilco/node-anvil/commit/8eae1cb468158cf40f75567454bbdc17cf457b55)
- comment update [`b338322`](https://github.com/anvilco/node-anvil/commit/b3383222af2e0d53456e56d310bfe09b84a9bfec)
## [v2.7.2](https://github.com/anvilco/node-anvil/compare/v2.7.1...v2.7.2) - 2021-03-31
### Merged
- allow null values for forge update mutation [`#37`](https://github.com/anvilco/node-anvil/pull/37)
## [v2.7.1](https://github.com/anvilco/node-anvil/compare/v2.6.1...v2.7.1) - 2021-03-31
### Merged
- add forgeSubmit and removeWeldData [`#40`](https://github.com/anvilco/node-anvil/pull/40)
- Bump y18n from 4.0.0 to 4.0.1 [`#39`](https://github.com/anvilco/node-anvil/pull/39)
## [v2.6.1](https://github.com/anvilco/node-anvil/compare/v2.6.0...v2.6.1) - 2021-03-30
### Merged
- fix a bug that can happen when parsing errors in node client [`#38`](https://github.com/anvilco/node-anvil/pull/38)

@@ -124,76 +74,30 @@ - Update createEtchPacket example to use IRS W-4 / NDA [`#36`](https://github.com/anvilco/node-anvil/pull/36)

- v2.6.0 [`#33`](https://github.com/anvilco/node-anvil/pull/33)
### Commits
- Update the create-etch-packet example to use the same docs as demo [`43bc77d`](https://github.com/anvilco/node-anvil/commit/43bc77d766e59a9c9d713958dfa460a51b246190)
- Remove ids [`1ed959c`](https://github.com/anvilco/node-anvil/commit/1ed959cdb2f9aab78d21704b20699b3313b0c8ed)
- remove unsed var [`0d046bd`](https://github.com/anvilco/node-anvil/commit/0d046bd0e9ae0251dafec9f506ecf2453c7f8f60)
## [v2.6.0](https://github.com/anvilco/node-anvil/compare/v2.5.0...v2.6.0) - 2020-11-20
### Merged
- Add webhookURL to default createEtchPacket mutation [`#32`](https://github.com/anvilco/node-anvil/pull/32)
- v2.5.0 [`#31`](https://github.com/anvilco/node-anvil/pull/31)
## [v2.5.0](https://github.com/anvilco/node-anvil/compare/v2.4.0...v2.5.0) - 2020-11-10
### Merged
- Add generatePDF() function [`#30`](https://github.com/anvilco/node-anvil/pull/30)
- v2.4.0 [`#29`](https://github.com/anvilco/node-anvil/pull/29)
### Commits
- Add generate-pdf.js example with default data [`c1face8`](https://github.com/anvilco/node-anvil/commit/c1face8232650edacbc255f5148cc6871114270e)
- Add generatePDF function and related tests [`135a643`](https://github.com/anvilco/node-anvil/commit/135a643cb1b59e76bdfdcf2f8c09ff1bad10c37d)
- Add generatePDF docs to readme [`7ee5d09`](https://github.com/anvilco/node-anvil/commit/7ee5d0969e2f2bb2d54ae0a6c3899c487fa9a90a)
## [v2.4.0](https://github.com/anvilco/node-anvil/compare/v2.3.0...v2.4.0) - 2020-10-29
### Merged
- Add `signatureProvider` to `createEtchPacket` Mutation [`#28`](https://github.com/anvilco/node-anvil/pull/28)
- v2.3.0 [`#27`](https://github.com/anvilco/node-anvil/pull/27)
### Commits
- add signatureProvider to createEtchPacket mutation [`b599638`](https://github.com/anvilco/node-anvil/commit/b599638202a3fa7d1a739d82f32a1c19ee01f7fc)
## [v2.3.0](https://github.com/anvilco/node-anvil/compare/v2.2.0...v2.3.0) - 2020-10-16
### Merged
- Add getEtchPacket and downloadDocuments Methods [`#26`](https://github.com/anvilco/node-anvil/pull/26)
- Cut new version: v2.2.0 [`#25`](https://github.com/anvilco/node-anvil/pull/25)
### Commits
- Upgrade more [`951cdfa`](https://github.com/anvilco/node-anvil/commit/951cdfa9cdc69194f9e5ed72f10be167f8b18459)
- Update the create-etch-packet example to use the same docs as demo [`43bc77d`](https://github.com/anvilco/node-anvil/commit/43bc77d766e59a9c9d713958dfa460a51b246190)
- tests for downloadDocuments, generateEtchSignUrl, getEtchPacket [`dec02fb`](https://github.com/anvilco/node-anvil/commit/dec02fb1831b148a7b23ddee4c85453cfe1f6c75)
- add getEtchPacket query [`5f43011`](https://github.com/anvilco/node-anvil/commit/5f43011951caf7790c0c01d0933b14d5eb4dd38a)
- downloadDocuments docs [`33809da`](https://github.com/anvilco/node-anvil/commit/33809dacd59acb8bd591947902a7edcabaffb328)
## [v2.2.0](https://github.com/anvilco/node-anvil/compare/v2.1.0...v2.2.0) - 2020-09-28
## [v2.2.0](https://github.com/anvilco/node-anvil/compare/v1.0.3...v2.2.0) - 2020-09-29
### Merged
- Cut new version: v2.2.0 [`#25`](https://github.com/anvilco/node-anvil/pull/25)
- Add `aliasId` AND `routingOrder` to `createEtchPacket` mutation query response default [`#24`](https://github.com/anvilco/node-anvil/pull/24)
- rename `send` to `isDraft` (and flip the logic) in `createEtchPacket` [`#23`](https://github.com/anvilco/node-anvil/pull/23)
- no `organizationEid` allowed when calling via API key [`#22`](https://github.com/anvilco/node-anvil/pull/22)
- change `fillPayload` param to just `data` [`#21`](https://github.com/anvilco/node-anvil/pull/21)
- Fix file Upload related stuff to reflect server-side [`#20`](https://github.com/anvilco/node-anvil/pull/20)
- rename send to draft (and flip the logic) in createEtchPacket [`#23`](https://github.com/anvilco/node-anvil/pull/23)
- no organizationEid allowed when calling via API key [`#22`](https://github.com/anvilco/node-anvil/pull/22)
- change fillPayload param to just data [`#21`](https://github.com/anvilco/node-anvil/pull/21)
- Fix file upload related stuff to reflect reality [`#20`](https://github.com/anvilco/node-anvil/pull/20)
- Etch API Support for Embedded Signers [`#18`](https://github.com/anvilco/node-anvil/pull/18)
- Bump node-fetch from 2.6.0 to 2.6.1 [`#19`](https://github.com/anvilco/node-anvil/pull/19)
- Add support for GraphQL API, starting with `createEtchPacket` mutation [`#16`](https://github.com/anvilco/node-anvil/pull/16)
### Commits
- dependency upgrades: nodemon, mocha, and yargs due to dot-prop and yargs-parser vulnerabilities [`c118d23`](https://github.com/anvilco/node-anvil/commit/c118d234c4717a429b8ebda8c1f69e1002c11f56)
- added graphql folders. wrapping all request/responses in throttle and body parsing helper. tidied up a lot [`036c615`](https://github.com/anvilco/node-anvil/commit/036c615290fbd4c4d830dde6e8ea28275647ab64)
- getting the file uploads stuff more in line with the actual way the API expects things now [`2c7bab6`](https://github.com/anvilco/node-anvil/commit/2c7bab6d44c9893884c3e73a60792f0e84a936a7)
## [v2.1.0](https://github.com/anvilco/node-anvil/compare/v1.0.3...v2.1.0) - 2020-08-19
### Merged
- Add support for GraphQL API, starting with createEtchPacket [`#16`](https://github.com/anvilco/node-anvil/pull/16)
- v2.1.0 [`#14`](https://github.com/anvilco/node-anvil/pull/14)
- replace `request` with `node-fetch` [`#13`](https://github.com/anvilco/node-anvil/pull/13)

@@ -210,4 +114,4 @@ - Bump lodash from 4.17.15 to 4.17.19 [`#12`](https://github.com/anvilco/node-anvil/pull/12)

- don't need babel anymore [`2b9daad`](https://github.com/anvilco/node-anvil/commit/2b9daad80b47a82a5e3493e70b6341aad4bee18d)
- dependency upgrades: nodemon, mocha, and yargs due to dot-prop and yargs-parser vulnerabilities [`c118d23`](https://github.com/anvilco/node-anvil/commit/c118d234c4717a429b8ebda8c1f69e1002c11f56)
- bump deps to get minimist to >= 1.2.2 [`26e4cd1`](https://github.com/anvilco/node-anvil/commit/26e4cd1d9d2f3070309f85f3fb21e5f7cab484fa)
- added node-fetch. re-wrote to work with node-fetch. added support for stream. added example for it [`69b4d80`](https://github.com/anvilco/node-anvil/commit/69b4d80a1703e840b3c055c47c1af5f1ebb98799)

@@ -214,0 +118,0 @@ ## [v1.0.3](https://github.com/anvilco/node-anvil/compare/v1.0.2...v1.0.3) - 2020-02-05

{
"name": "@anvilco/anvil",
"version": "2.9.4",
"version": "2.10.0",
"description": "Anvil API Client",
"main": "src/index.js",
"types": "./types/index.d.ts",
"scripts": {

@@ -32,2 +33,3 @@ "test": "mocha --config ./test/mocha.js",

"devDependencies": {
"@types/node": "^17.0.23",
"auto-changelog": "^2.4.0",

@@ -52,2 +54,3 @@ "babel-eslint": "^10.0.3",

"sinon-chai": "^3.5.0",
"typescript": "^4.6.3",
"yargs": "^17.4.0"

@@ -54,0 +57,0 @@ },

@@ -13,13 +13,31 @@ const fs = require('fs')

/**
* @typedef AnvilOptions
* @type {Object}
* @property {string?} baseURL
* @property {string?} userAgent
* @property {number?} requestLimit
* @property {number?} requestLimitMS
* @property {string?} apiKey
* @property {string?} accessToken
*/
// Ignoring the below since they are dynamically created depepending on what's
// inside the `src/graphql` directory.
const {
mutations: {
// @ts-ignore
createEtchPacket: {
generateMutation: generateCreateEtchPacketMutation,
},
// @ts-ignore
forgeSubmit: {
generateMutation: generateForgeSubmitMutation,
},
// @ts-ignore
generateEtchSignUrl: {
generateMutation: generateEtchSignUrlMutation,
},
// @ts-ignore
removeWeldData: {

@@ -30,2 +48,3 @@ generateMutation: generateRemoveWeldDataMutation,

queries: {
// @ts-ignore
etchPacket: {

@@ -60,2 +79,5 @@ generateQuery: generateEtchPacketQuery,

// }
/**
* @param {AnvilOptions?} options
*/
constructor (options) {

@@ -92,2 +114,8 @@ if (!options) throw new Error('options are required')

/**
* @param {Object} options
* @param {number} options.tokens
* @param {number} options.intervalMs
* @private
*/
_setRateLimiter ({ tokens, intervalMs }) {

@@ -129,3 +157,3 @@ if (

*
* @param {string|Buffer|Stream-like-thing} pathOrStreamLikeThing - Either a string path to a file,
* @param {string|Buffer} pathOrStreamLikeThing - Either a string path to a file,
* a Buffer, or a Stream-like thing that is compatible with form-data as an append.

@@ -141,2 +169,3 @@ * @param {object} formDataAppendOptions - User can specify options to be passed to the form-data.append

if (typeof pathOrStreamLikeThing === 'string') {
// @ts-ignore
pathOrStreamLikeThing = fs.createReadStream(pathOrStreamLikeThing)

@@ -148,2 +177,10 @@ }

/**
* Runs the createEtchPacket mutation.
* @param {Object} data
* @param {Object} data.variables
* @param {string} data.responseQuery
* @param {any} data.mutation
* @returns {Promise<{data: *, errors: *, statusCode: *}>}
*/
createEtchPacket ({ variables, responseQuery, mutation }) {

@@ -159,2 +196,7 @@ return this.requestGraphQL(

/**
* @param {string} documentGroupEid
* @param {Object?} clientOptions
* @returns {Promise<{data: *, response: *, errors: *, statusCode: *}>}
*/
downloadDocuments (documentGroupEid, clientOptions = {}) {

@@ -176,2 +218,8 @@ const supportedDataTypes = [DATA_TYPE_STREAM, DATA_TYPE_BUFFER]

/**
* @param {string} pdfTemplateID
* @param {Object} payload
* @param {Object?} clientOptions
* @returns {Promise<{data: *, response: *, errors: *, statusCode: *}>}
*/
fillPDF (pdfTemplateID, payload, clientOptions = {}) {

@@ -200,2 +248,9 @@ const supportedDataTypes = [DATA_TYPE_STREAM, DATA_TYPE_BUFFER]

/**
* @param {Object} data
* @param {Object} data.variables
* @param {string} data.responseQuery
* @param {any} data.mutation
* @returns {Promise<{data: *, errors: *, statusCode: *}>}
*/
forgeSubmit ({ variables, responseQuery, mutation }) {

@@ -211,2 +266,7 @@ return this.requestGraphQL(

/**
* @param {Object} payload
* @param {Object?} clientOptions
* @returns {Promise<{data: *, response: *, errors: *, statusCode: *}>}
*/
generatePDF (payload, clientOptions = {}) {

@@ -235,2 +295,8 @@ const supportedDataTypes = [DATA_TYPE_STREAM, DATA_TYPE_BUFFER]

/**
* @param {Object} data
* @param {Object} data.variables
* @param {string} data.responseQuery
* @returns {Promise<{data: *, errors: *, statusCode: *}>}
*/
getEtchPacket ({ variables, responseQuery }) {

@@ -246,2 +312,7 @@ return this.requestGraphQL(

/**
* @param {Object} data
* @param {Object} data.variables
* @returns {Promise<{url: (*|string), errors: *, statusCode: *}>}
*/
async generateEtchSignUrl ({ variables }) {

@@ -263,2 +334,8 @@ const { statusCode, data, errors } = await this.requestGraphQL(

/**
* @param {Object} data
* @param {Object} data.variables
* @param {any} data.mutation
* @returns {Promise<{data: *, errors: *, statusCode: *}>}
*/
removeWeldData ({ variables, mutation }) {

@@ -274,2 +351,9 @@ return this.requestGraphQL(

/**
* @param {Object} data
* @param {any} data.query
* @param {Object?} data.variables
* @param {Object} clientOptions
* @returns {Promise<{data: *, errors: *, statusCode: *}>}
*/
async requestGraphQL ({ query, variables = {} }, clientOptions) {

@@ -302,2 +386,3 @@ // Some helpful resources on how this came to be:

if (filesMap.size) {
// @ts-ignore
const abortController = new AbortController()

@@ -359,2 +444,8 @@ const form = new FormData()

/**
* @param {string} url
* @param {Object} fetchOptions
* @param {Object} clientOptions
* @returns {Promise<{data: *, response: *, errors: *, statusCode: *}>}
*/
async requestREST (url, fetchOptions, clientOptions) {

@@ -389,2 +480,8 @@ const {

/**
* @param {string} url
* @param {Object} options
* @returns {Promise}
* @private
*/
_request (url, options) {

@@ -398,2 +495,8 @@ if (!url.startsWith(this.options.baseURL)) {

/**
* @param {CallableFunction} retryableRequestFn
* @param {Object?} clientOptions
* @returns {Promise<*>}
* @private
*/
_wrapRequest (retryableRequestFn, clientOptions = {}) {

@@ -467,3 +570,3 @@ return this._throttle(async (retry) => {

default:
console.warn('Using default response dataType of "json". Please specifiy a dataType.')
console.warn('Using default response dataType of "json". Please specify a dataType.')
data = await response.json()

@@ -481,2 +584,7 @@ break

/**
* @param {string} path
* @returns {string}
* @private
*/
_url (path) {

@@ -486,2 +594,10 @@ return this.options.baseURL + path

/**
* @param {Object} headerObject
* @param {Object} headerObject.options
* @param {Object} headerObject.headers
* @param {Object?} internalOptions
* @returns {*&{headers: {}}}
* @private
*/
_addHeaders ({ options: existingOptions, headers: newHeaders }, internalOptions = {}) {

@@ -508,2 +624,7 @@ const { headers: existingHeaders = {} } = existingOptions

/**
* @param {Object} options
* @returns {*}
* @private
*/
_addDefaultHeaders (options) {

@@ -523,2 +644,7 @@ const { userAgent } = this.options

/**
* @param {CallableFunction} fn
* @returns {Promise<*>}
* @private
*/
async _throttle (fn) {

@@ -542,3 +668,3 @@ // If this is one of the first requests being made, we'll want to dynamically

if (remainingRequests < 1) {
await sleep(this.requestLimitMS + failBufferMS)
await sleep(this.options.requestLimitMS + failBufferMS)
}

@@ -552,25 +678,9 @@ const retry = async (ms) => {

}
static _prepareGraphQLBase64 (data, options = {}) {
const { filename, mimetype } = options
if (!filename) {
throw new Error('options.filename must be provided for Base64 upload')
}
if (!mimetype) {
throw new Error('options.mimetype must be provided for Base64 upload')
}
if (options.bufferize) {
const buffer = Buffer.from(data, 'base64')
return this._prepareGraphQLBuffer(buffer, options)
}
return {
data,
filename,
mimetype,
}
}
}
/**
* @param {string} retryAfterSeconds
* @returns {number}
* @private
*/
function getRetryMS (retryAfterSeconds) {

@@ -580,2 +690,7 @@ return Math.round((Math.abs(parseFloat(retryAfterSeconds)) || 0) * 1000) + failBufferMS

/**
* @param {number} ms
* @returns {Promise<any>}
* @private
*/
function sleep (ms) {

@@ -582,0 +697,0 @@ return new Promise((resolve) => {

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