@verdocs/js-sdk 6.3.2 → 6.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +35 -1
- package/dist/index.d.ts +35 -1
- package/dist/index.js +45 -3
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +45 -4
- package/dist/index.mjs.map +1 -1
- package/dist/package.json +5 -4
- package/package.json +5 -4
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import axios from 'axios';
|
|
2
|
+
import axiosRetry from 'axios-retry';
|
|
2
3
|
|
|
3
4
|
const FIELD_TYPES = [
|
|
4
5
|
'textbox',
|
|
@@ -1253,6 +1254,8 @@ class VerdocsEndpoint {
|
|
|
1253
1254
|
this.clientID = options?.clientID ?? this.clientID;
|
|
1254
1255
|
this.persist = options?.persist ?? this.persist;
|
|
1255
1256
|
this.api = axios.create({ baseURL: this.baseURL, timeout: this.timeout });
|
|
1257
|
+
// Enable the module but not for any requests, only a few get this
|
|
1258
|
+
axiosRetry(this.api, { retries: 0 });
|
|
1256
1259
|
}
|
|
1257
1260
|
setDefault() {
|
|
1258
1261
|
globalThis$1[ENDPOINT_KEY] = this;
|
|
@@ -1623,7 +1626,10 @@ const getEnvelopeDocument = async (endpoint, documentId) => endpoint.api //
|
|
|
1623
1626
|
* Download a document directly.
|
|
1624
1627
|
*/
|
|
1625
1628
|
const downloadEnvelopeDocument = async (endpoint, documentId) => endpoint.api //
|
|
1626
|
-
.get(`/v2/envelope-documents/${documentId}?type=file`, {
|
|
1629
|
+
.get(`/v2/envelope-documents/${documentId}?type=file`, {
|
|
1630
|
+
responseType: 'blob',
|
|
1631
|
+
'axios-retry': { retries: 5, retryDelay: axiosRetry.linearDelay(3000) },
|
|
1632
|
+
})
|
|
1627
1633
|
.then((r) => r.data);
|
|
1628
1634
|
/**
|
|
1629
1635
|
* Get an envelope document's metadata, or the document itself. If no "type" parameter is specified,
|
|
@@ -1639,14 +1645,18 @@ const downloadEnvelopeDocument = async (endpoint, documentId) => endpoint.api //
|
|
|
1639
1645
|
* @apiSuccess string . The generated link.
|
|
1640
1646
|
*/
|
|
1641
1647
|
const getEnvelopeDocumentDownloadLink = async (endpoint, documentId) => endpoint.api //
|
|
1642
|
-
.get(`/v2/envelope-documents/${documentId}?type=download
|
|
1648
|
+
.get(`/v2/envelope-documents/${documentId}?type=download`, {
|
|
1649
|
+
'axios-retry': { retries: 5, retryDelay: axiosRetry.linearDelay(3000) },
|
|
1650
|
+
})
|
|
1643
1651
|
.then((r) => r.data);
|
|
1644
1652
|
/**
|
|
1645
1653
|
* Get a pre-signed preview link for an Envelope Document. This link expires quickly, so it should
|
|
1646
1654
|
* be accessed immediately and never shared. Content-Disposition will be set to "inline".
|
|
1647
1655
|
*/
|
|
1648
1656
|
const getEnvelopeDocumentPreviewLink = async (endpoint, documentId) => endpoint.api //
|
|
1649
|
-
.get(`/v2/envelope-documents/${documentId}?type=preview
|
|
1657
|
+
.get(`/v2/envelope-documents/${documentId}?type=preview`, {
|
|
1658
|
+
'axios-retry': { retries: 5, retryDelay: axiosRetry.linearDelay(3000) },
|
|
1659
|
+
})
|
|
1650
1660
|
.then((r) => r.data);
|
|
1651
1661
|
/**
|
|
1652
1662
|
* Cancel an Envelope.
|
|
@@ -3704,6 +3714,37 @@ const getWebhooks = (endpoint) => endpoint.api //
|
|
|
3704
3714
|
const setWebhooks = (endpoint, params) => endpoint.api //
|
|
3705
3715
|
.patch(`/v2/webhooks`, params)
|
|
3706
3716
|
.then((r) => r.data);
|
|
3717
|
+
/**
|
|
3718
|
+
* Rotate the secret key used to authenticate Webhooks. If a secret key has not yet been set,
|
|
3719
|
+
* it will be created. Until this is done, Webhook calls will not have a signature applied to
|
|
3720
|
+
* their headers. Please note that pending Webhook deliveries will not be affected until the
|
|
3721
|
+
* next Webhook is triggered.
|
|
3722
|
+
*
|
|
3723
|
+
* To authenticate a Webhook call, compute an HMAC-256 hash of the JSON payload `body` field
|
|
3724
|
+
* as follows:
|
|
3725
|
+
*
|
|
3726
|
+
* ```typescript
|
|
3727
|
+
* // NOTE: Hash the `body` field INSIDE the payload. In many frameworks the payload is also called
|
|
3728
|
+
* // `body`, which can be confusing.
|
|
3729
|
+
* const jsonBody = JSON.stringify(req.body.body);
|
|
3730
|
+
* const hash = createHmac('sha256', SECRET_KEY).update(jsonBody).digest('hex');
|
|
3731
|
+
* if (hash !== req.headers['x-webhook-signature']) {
|
|
3732
|
+
* // Handle error here
|
|
3733
|
+
* }
|
|
3734
|
+
*
|
|
3735
|
+
* // It is important to return a 200 status code anyway, to avoid the sender trying to resend
|
|
3736
|
+
* // the same data.
|
|
3737
|
+
* res.status(200).send();
|
|
3738
|
+
* ```
|
|
3739
|
+
*
|
|
3740
|
+
* @group Webhooks
|
|
3741
|
+
* @api PATCH /v2/webhooks Rotate Webhook secret key
|
|
3742
|
+
* @apiDescription Note that Webhooks cannot currently be deleted, but may be easily disabled by setting `active` to `false` and/or setting the `url` to an empty string.
|
|
3743
|
+
* @apiSuccess IWebhook . The updated Webhooks config for the caller's organization, including the secret_key.
|
|
3744
|
+
*/
|
|
3745
|
+
const rotateWebhookSecret = (endpoint) => endpoint.api //
|
|
3746
|
+
.put(`/v2/webhooks/rotate-secret`)
|
|
3747
|
+
.then((r) => r.data);
|
|
3707
3748
|
|
|
3708
|
-
export { ALL_PERMISSIONS, AtoB, Countries, DEFAULT_DISCLOSURES, DEFAULT_FIELD_HEIGHTS, DEFAULT_FIELD_WIDTHS, FIELD_TYPES, RolePermissions, VerdocsEndpoint, WEBHOOK_EVENTS, acceptOrganizationInvitation, addGroupMember, askQuestion, authenticate, blobToBase64, canAccessEnvelope, canPerformTemplateAction, cancelEnvelope, capitalize, changePassword, collapseEntitlements, convertToE164, createApiKey, createEnvelope, createField, createGroup, createInitials, createOrganization, createOrganizationContact, createOrganizationInvitation, createProfile, createSignature, createTemplate, createTemplateDocument, createTemplateFromSharepoint, createTemplateRole, declineOrganizationInvitation, decodeAccessTokenBody, decodeJWTBody, delegateRecipient, deleteApiKey, deleteEnvelopeFieldAttachment, deleteField, deleteGroup, deleteGroupMember, deleteOrganization, deleteOrganizationContact, deleteOrganizationInvitation, deleteOrganizationMember, deleteProfile, deleteTemplate, deleteTemplateDocument, deleteTemplateRole, downloadBlob, downloadEnvelopeDocument, downloadTemplateDocument, duplicateTemplate, envelopeIsActive, envelopeIsComplete, envelopeRecipientAgree, envelopeRecipientDecline, envelopeRecipientSubmit, fileToDataUrl, formatFullName, formatInitials, formatShortTimeAgo, fullNameToInitials, getActiveEntitlements, getApiKeys, getCountryByCode, getCurrentProfile, getEntitlements, getEnvelope, getEnvelopeDocument, getEnvelopeDocumentDownloadLink, getEnvelopeDocumentPageDisplayUri, getEnvelopeDocumentPreviewLink, getEnvelopeFile, getEnvelopes, getEnvelopesZip, getFieldsForRole, getGroup, getGroups, getInPersonLink, getKbaStep, getMatchingCountry, getMyUser, getNextRecipient, getNotifications, getOrganization, getOrganizationChildren, getOrganizationContacts, getOrganizationInvitation, getOrganizationInvitations, getOrganizationMembers, getOrganizationUsage, getPlusOneCountry, getProfiles, getRGB, getRGBA, getRLeft, getRTop, getRValue, getRecipientsWithActions, getRoleColor, getTemplate, getTemplateDocument, getTemplateDocumentDownloadLink, getTemplateDocumentFile, getTemplateDocumentPageDisplayUri, getTemplateDocumentPreviewLink, getTemplateDocumentThumbnail, getTemplates, getValidators, getWebhooks, hasRequiredPermissions, integerSequence, isAmericanSamoa, isCanada, isDominicanRepublic, isEnvelopeOwner, isEnvelopeRecipient, isFieldFilled, isFieldValid, isFrenchGuiana, isGuadeloupe, isMartinique, isMayotte, isPuertoRico, isValidEmail, isValidInput, isValidPhone, isValidRoleName, isValidTag, nameToRGBA, randomString, recipientCanAct, recipientHasAction, refreshToken, remindRecipient, rescale, resendOrganizationInvitation, resendVerification, resetPassword, resetRecipient, rotateApiKey, setWebhooks, sortFields, startSigningSession, submitKbaChallengeResponse, submitKbaIdentity, submitKbaPin, switchProfile, toggleTemplateStar, updateApiKey, updateEnvelope, updateEnvelopeField, updateField, updateGroup, updateOrganization, updateOrganizationContact, updateOrganizationInvitation, updateOrganizationLogo, updateOrganizationMember, updateOrganizationThumbnail, updateProfile, updateProfilePhoto, updateRecipient, updateTemplate, updateTemplateRole, uploadEnvelopeFieldAttachment, useCanAccessEnvelope, userCanAct, userCanBuildTemplate, userCanCancelEnvelope, userCanChangeOrgVisibility, userCanCreateOrgTemplate, userCanCreatePersonalTemplate, userCanCreatePublicTemplate, userCanCreateTemplate, userCanDeleteTemplate, userCanFinishEnvelope, userCanMakeTemplatePrivate, userCanMakeTemplatePublic, userCanMakeTemplateShared, userCanPreviewTemplate, userCanReadTemplate, userCanSendTemplate, userCanSignNow, userCanUpdateTemplate, userHasPermissions, userHasSharedTemplate, userIsEnvelopeOwner, userIsEnvelopeRecipient, userIsTemplateCreator, verifyEmail, verifySigner };
|
|
3749
|
+
export { ALL_PERMISSIONS, AtoB, Countries, DEFAULT_DISCLOSURES, DEFAULT_FIELD_HEIGHTS, DEFAULT_FIELD_WIDTHS, FIELD_TYPES, RolePermissions, VerdocsEndpoint, WEBHOOK_EVENTS, acceptOrganizationInvitation, addGroupMember, askQuestion, authenticate, blobToBase64, canAccessEnvelope, canPerformTemplateAction, cancelEnvelope, capitalize, changePassword, collapseEntitlements, convertToE164, createApiKey, createEnvelope, createField, createGroup, createInitials, createOrganization, createOrganizationContact, createOrganizationInvitation, createProfile, createSignature, createTemplate, createTemplateDocument, createTemplateFromSharepoint, createTemplateRole, declineOrganizationInvitation, decodeAccessTokenBody, decodeJWTBody, delegateRecipient, deleteApiKey, deleteEnvelopeFieldAttachment, deleteField, deleteGroup, deleteGroupMember, deleteOrganization, deleteOrganizationContact, deleteOrganizationInvitation, deleteOrganizationMember, deleteProfile, deleteTemplate, deleteTemplateDocument, deleteTemplateRole, downloadBlob, downloadEnvelopeDocument, downloadTemplateDocument, duplicateTemplate, envelopeIsActive, envelopeIsComplete, envelopeRecipientAgree, envelopeRecipientDecline, envelopeRecipientSubmit, fileToDataUrl, formatFullName, formatInitials, formatShortTimeAgo, fullNameToInitials, getActiveEntitlements, getApiKeys, getCountryByCode, getCurrentProfile, getEntitlements, getEnvelope, getEnvelopeDocument, getEnvelopeDocumentDownloadLink, getEnvelopeDocumentPageDisplayUri, getEnvelopeDocumentPreviewLink, getEnvelopeFile, getEnvelopes, getEnvelopesZip, getFieldsForRole, getGroup, getGroups, getInPersonLink, getKbaStep, getMatchingCountry, getMyUser, getNextRecipient, getNotifications, getOrganization, getOrganizationChildren, getOrganizationContacts, getOrganizationInvitation, getOrganizationInvitations, getOrganizationMembers, getOrganizationUsage, getPlusOneCountry, getProfiles, getRGB, getRGBA, getRLeft, getRTop, getRValue, getRecipientsWithActions, getRoleColor, getTemplate, getTemplateDocument, getTemplateDocumentDownloadLink, getTemplateDocumentFile, getTemplateDocumentPageDisplayUri, getTemplateDocumentPreviewLink, getTemplateDocumentThumbnail, getTemplates, getValidators, getWebhooks, hasRequiredPermissions, integerSequence, isAmericanSamoa, isCanada, isDominicanRepublic, isEnvelopeOwner, isEnvelopeRecipient, isFieldFilled, isFieldValid, isFrenchGuiana, isGuadeloupe, isMartinique, isMayotte, isPuertoRico, isValidEmail, isValidInput, isValidPhone, isValidRoleName, isValidTag, nameToRGBA, randomString, recipientCanAct, recipientHasAction, refreshToken, remindRecipient, rescale, resendOrganizationInvitation, resendVerification, resetPassword, resetRecipient, rotateApiKey, rotateWebhookSecret, setWebhooks, sortFields, startSigningSession, submitKbaChallengeResponse, submitKbaIdentity, submitKbaPin, switchProfile, toggleTemplateStar, updateApiKey, updateEnvelope, updateEnvelopeField, updateField, updateGroup, updateOrganization, updateOrganizationContact, updateOrganizationInvitation, updateOrganizationLogo, updateOrganizationMember, updateOrganizationThumbnail, updateProfile, updateProfilePhoto, updateRecipient, updateTemplate, updateTemplateRole, uploadEnvelopeFieldAttachment, useCanAccessEnvelope, userCanAct, userCanBuildTemplate, userCanCancelEnvelope, userCanChangeOrgVisibility, userCanCreateOrgTemplate, userCanCreatePersonalTemplate, userCanCreatePublicTemplate, userCanCreateTemplate, userCanDeleteTemplate, userCanFinishEnvelope, userCanMakeTemplatePrivate, userCanMakeTemplatePublic, userCanMakeTemplateShared, userCanPreviewTemplate, userCanReadTemplate, userCanSendTemplate, userCanSignNow, userCanUpdateTemplate, userHasPermissions, userHasSharedTemplate, userIsEnvelopeOwner, userIsEnvelopeRecipient, userIsTemplateCreator, verifyEmail, verifySigner };
|
|
3709
3750
|
//# sourceMappingURL=index.mjs.map
|