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

@anvilco/anvil

Package Overview
Dependencies
Maintainers
5
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.2.0 to 2.3.0

src/graphql/queries/etchPacket.js

13

CHANGELOG.md

@@ -10,2 +10,15 @@ # Changelog

## [v2.3.0](https://github.com/anvilco/node-anvil/compare/v2.2.0...v2.3.0)
### 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
- 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

@@ -12,0 +25,0 @@

6

package.json
{
"name": "@anvilco/anvil",
"version": "2.2.0",
"version": "2.3.0",
"description": "Anvil API Client",

@@ -9,3 +9,3 @@ "main": "src/index.js",

"test:watch": "nodemon --signal SIGINT --watch test --watch src -x 'yarn test'",
"version": "auto-changelog -p --template keepachangelog && git add CHANGELOG.md"
"version": "auto-changelog -p --template keepachangelog && read -p \"\nAutomated changes made to CHANGELOG.md. Please make any necessary adjustments, then hit any key to continue.\n\" && git add CHANGELOG.md"
},

@@ -32,3 +32,3 @@ "repository": {

"devDependencies": {
"auto-changelog": "^1.16.2",
"auto-changelog": "^2.2.1",
"babel-eslint": "^10.0.3",

@@ -35,0 +35,0 @@ "bdd-lazy-var": "^2.5.4",

@@ -134,2 +134,10 @@ # Anvil API Client for Node

##### getEtchPacket(options)
Gets the details of an Etch Packet.
* `options` (Object) - An object with the following structure:
* `variables` (Object) - Requires `eid`
* `eid` (String) - your Etch Packet eid
* `responseQuery` (String) - _optional_ A GraphQL Query compliant query to use for the data desired in the query response. Can be left out to use default.
##### generateEtchSignUrl(options)

@@ -143,2 +151,15 @@

##### downloadDocuments(documentGroupEid[, options])
Returns a Buffer or Stream of the document group specified by the documentGroupEid in Zip file format.
* `documentGroupEid` (string) - the eid of the document group to download
* `options` (Object) - _optional_ Any additional options for the request
* `dataType` (Enum[String]) - _optional_ Set the type of the `data` value that is returned in the resolved `Promise`. Defaults to `'buffer'`, but `'stream'` is also supported.
* Returns a `Promise` that resolves to an `Object`
* `statusCode` (Number) - the HTTP status code, `200` is success
* `response` (Object) - the Response object resulting from the client's request to the Anvil app
* `data` (Buffer | Stream) - The raw binary data of the downloaded documents if success. Will be in the format of either a Buffer or a Stream, depending on `dataType` option supplied to the request.
* `errors` (Array of Objects) - Will be present if status >= 400. See Errors
* `message` (String)
### Class Methods

@@ -145,0 +166,0 @@

const mutations = require('./mutations')
const queries = require('./queries')
module.exports = {
mutations,
queries,
}

@@ -6,2 +6,3 @@

name
detailsURL
documentGroup {

@@ -19,2 +20,4 @@ id

email
status
signActionType
}

@@ -25,3 +28,3 @@ }

module.exports = {
getMutation: (responseQuery = defaultResponseQuery) => `
generateMutation: (responseQuery = defaultResponseQuery) => `
mutation CreateEtchPacket (

@@ -28,0 +31,0 @@ $name: String,

module.exports = {
getMutation: () => `
generateMutation: () => `
mutation GenerateEtchSignURL (

@@ -4,0 +4,0 @@ $signerEid: String!,

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

createEtchPacket: {
getMutation: getCreateEtchPacketMutation,
generateMutation: generateCreateEtchPacketMutation,
},
generateEtchSignUrl: {
getMutation: getGenerateEtchSignUrlMutation,
generateMutation: generateEtchSignUrlMutation,
},
},
queries: {
etchPacket: {
generateQuery: generateEtchPacketQuery,
},
},
} = require('./graphql')

@@ -115,3 +120,3 @@

{
query: mutation || getCreateEtchPacketMutation(responseQuery),
query: mutation || generateCreateEtchPacketMutation(responseQuery),
variables,

@@ -123,6 +128,16 @@ },

getEtchPacket ({ variables, responseQuery }) {
return this.requestGraphQL(
{
query: generateEtchPacketQuery(responseQuery),
variables,
},
{ dataType: DATA_TYPE_JSON },
)
}
async generateEtchSignUrl ({ variables }) {
const { statusCode, data, errors } = await this.requestGraphQL(
{
query: getGenerateEtchSignUrlMutation(),
query: generateEtchSignUrlMutation(),
variables,

@@ -140,2 +155,18 @@ },

downloadDocuments (documentGroupEid, clientOptions = {}) {
const supportedDataTypes = [DATA_TYPE_STREAM, DATA_TYPE_BUFFER]
const { dataType = DATA_TYPE_BUFFER } = clientOptions
if (dataType && !supportedDataTypes.includes(dataType)) {
throw new Error(`dataType must be one of: ${supportedDataTypes.join('|')}`)
}
return this.requestREST(
`/api/document-group/${documentGroupEid}.zip`,
{ method: 'GET' },
{
...clientOptions,
dataType,
},
)
}
async requestGraphQL ({ query, variables = {} }, clientOptions) {

@@ -142,0 +173,0 @@ // Some helpful resources on how this came to be:

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