docspring 4.0.0 → 4.2.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.
Files changed (116) hide show
  1. package/AGENTS.md +3 -2
  2. package/README.md +13 -1
  3. package/dist/ApiClient.js +2 -2
  4. package/dist/RequestSchemas.js +1231 -9
  5. package/dist/WebhookSignature.js +86 -0
  6. package/dist/api/Client.js +620 -38
  7. package/dist/index.js +238 -0
  8. package/dist/model/AddTemplateFieldsRequest.js +132 -0
  9. package/dist/model/AuthenticationCheck.js +1 -1
  10. package/dist/model/CombinedPdf.js +3 -3
  11. package/dist/model/CombinedPdfFiles.js +1 -1
  12. package/dist/model/CombinedPdfList.js +1 -1
  13. package/dist/model/CombinedPdfSource.js +1 -1
  14. package/dist/model/CombinedPdfSourceInput.js +1 -1
  15. package/dist/model/CombinedPdfSourcePdf.js +1 -1
  16. package/dist/model/CopyTemplateRequest.js +1 -1
  17. package/dist/model/CreateCombinedPdfRequest.js +2 -2
  18. package/dist/model/CreateCustomFileFromUploadRequest.js +1 -1
  19. package/dist/model/CreateFolderRequest.js +1 -1
  20. package/dist/model/CreateSignatureRequestEventRequest.js +1 -1
  21. package/dist/model/CreateSignatureRequestTokenRequest.js +1 -1
  22. package/dist/model/CreateSubmissionBatchRequest.js +15 -1
  23. package/dist/model/CreateSubmissionRequest.js +17 -3
  24. package/dist/model/CreateTemplatePreviewRequest.js +112 -0
  25. package/dist/model/CreateTemplateRequest.js +81 -4
  26. package/dist/model/CreateWebhookRequest.js +1 -1
  27. package/dist/model/CustomFile.js +1 -1
  28. package/dist/model/CustomFileList.js +1 -1
  29. package/dist/model/CustomFileSourcePdf.js +1 -1
  30. package/dist/model/ErrorCode.js +11 -1
  31. package/dist/model/ErrorDetail.js +2 -2
  32. package/dist/model/ErrorInfo.js +6 -6
  33. package/dist/model/ErrorResponse.js +1 -1
  34. package/dist/model/Field.js +1230 -0
  35. package/dist/model/FieldComparisonCondition.js +1 -1
  36. package/dist/model/FieldDependency.js +154 -0
  37. package/dist/model/FieldDependencyInput.js +154 -0
  38. package/dist/model/FieldEqualsCondition.js +1 -1
  39. package/dist/model/FieldGroup.js +206 -0
  40. package/dist/model/FieldGroupInput.js +180 -0
  41. package/dist/model/FieldGroupType.js +59 -0
  42. package/dist/model/FieldInCondition.js +1 -1
  43. package/dist/model/FieldInput.js +1012 -0
  44. package/dist/model/FieldOverride.js +1 -1
  45. package/dist/model/FieldPresenceCondition.js +1 -1
  46. package/dist/model/FieldRangeCondition.js +1 -1
  47. package/dist/model/FieldType.js +124 -0
  48. package/dist/model/Folder.js +1 -1
  49. package/dist/model/FolderList.js +1 -1
  50. package/dist/model/GenerateFilesFormat.js +54 -0
  51. package/dist/model/GenerateSubmissionFilesRequest.js +115 -0
  52. package/dist/model/GeneratedFile.js +1 -1
  53. package/dist/model/HtmlEngineOptions.js +1 -1
  54. package/dist/model/HtmlEngineOptionsInput.js +1 -1
  55. package/dist/model/MoveFolderRequest.js +1 -1
  56. package/dist/model/MoveTemplateRequest.js +1 -1
  57. package/dist/model/OutputFormat.js +59 -0
  58. package/dist/model/PageImage.js +220 -0
  59. package/dist/model/PageImages.js +155 -0
  60. package/dist/model/PredefinedField.js +183 -0
  61. package/dist/model/PredefinedFieldInput.js +183 -0
  62. package/dist/model/PublishTemplateVersionRequest.js +1 -1
  63. package/dist/model/RemoveTemplateFieldsRequest.js +114 -0
  64. package/dist/model/RenameFolderRequest.js +1 -1
  65. package/dist/model/ReorderTemplateFieldsRequest.js +114 -0
  66. package/dist/model/RestoreTemplateVersionRequest.js +1 -1
  67. package/dist/model/SignatureRequest.js +1 -1
  68. package/dist/model/SignatureRequestEvent.js +1 -1
  69. package/dist/model/SignatureRequestInput.js +1 -1
  70. package/dist/model/SignatureRequestToken.js +1 -1
  71. package/dist/model/Submission.js +84 -68
  72. package/dist/model/SubmissionAction.js +1 -1
  73. package/dist/model/SubmissionBatch.js +1 -1
  74. package/dist/model/SubmissionFiles.js +10 -1
  75. package/dist/model/SubmissionInput.js +17 -3
  76. package/dist/model/SubmissionList.js +5 -5
  77. package/dist/model/SubmissionSourcePdf.js +1 -1
  78. package/dist/model/SubmissionSummary.js +343 -0
  79. package/dist/model/SubmissionValidation.js +151 -0
  80. package/dist/model/Template.js +129 -56
  81. package/dist/model/TemplateActor.js +3 -3
  82. package/dist/model/TemplateDefaults.js +1 -1
  83. package/dist/model/TemplateDefaultsInput.js +1 -1
  84. package/dist/model/TemplateDiff.js +206 -0
  85. package/dist/model/TemplateDiffSummary.js +165 -0
  86. package/dist/model/TemplateDocument.js +36 -36
  87. package/dist/model/TemplateDocumentState.js +11 -1
  88. package/dist/model/TemplateDocumentSummary.js +152 -0
  89. package/dist/model/TemplateFieldChange.js +146 -0
  90. package/dist/model/TemplateFieldChanges.js +196 -0
  91. package/dist/model/TemplateFieldDependency.js +3 -3
  92. package/dist/model/TemplateFieldDependencyCondition.js +1 -1
  93. package/dist/model/TemplateFieldDependencyConditionInput.js +1 -1
  94. package/dist/model/TemplateFieldDependencyInput.js +3 -3
  95. package/dist/model/TemplateFieldMove.js +132 -0
  96. package/dist/model/TemplateFields.js +147 -0
  97. package/dist/model/TemplateModelCode.js +1 -1
  98. package/dist/model/TemplatePageImages.js +158 -0
  99. package/dist/model/TemplatePageProcessingStatus.js +1 -1
  100. package/dist/model/TemplatePreview.js +211 -0
  101. package/dist/model/TemplatePreviewState.js +64 -0
  102. package/dist/model/TemplateSourcePdf.js +1 -1
  103. package/dist/model/TemplateSummary.js +14 -288
  104. package/dist/model/TemplateSummaryList.js +1 -1
  105. package/dist/model/TemplateVersion.js +1 -1
  106. package/dist/model/UpdateSignatureRequestRequest.js +1 -1
  107. package/dist/model/UpdateTemplateDocumentRequest.js +33 -30
  108. package/dist/model/UpdateTemplateFieldsRequest.js +132 -0
  109. package/dist/model/UpdateTemplateRequest.js +84 -2
  110. package/dist/model/UpdateWebhookRequest.js +1 -1
  111. package/dist/model/UploadPresign.js +1 -1
  112. package/dist/model/UrlSourcePdf.js +1 -1
  113. package/dist/model/ValidateSubmissionRequest.js +226 -0
  114. package/dist/model/Webhook.js +1 -1
  115. package/dist/model/WebhookList.js +1 -1
  116. package/package.json +3 -2
package/AGENTS.md CHANGED
@@ -69,8 +69,9 @@ keeps it.
69
69
  (https://docspring.com/docs/webhooks/overview/). A webhook created with API v2 sends events in API v2's format
70
70
  (version 4).
71
71
  - Verify each request's `X-DocSpring-Signature` header before acting on it: an HMAC-SHA256 of `{t}.{raw body}` with the
72
- webhook's signing secret, computed over the raw body exactly as received
73
- (https://docspring.com/docs/webhooks/verifying-signatures/).
72
+ webhook's signing secret, where `t` must be within 5 minutes
73
+ (https://docspring.com/docs/webhooks/verifying-signatures/). Pass the raw body exactly as received, not parsed JSON,
74
+ to `verifyWebhookSignature(payload, signatureHeader, secret)` (exported by the package), which returns true or false.
74
75
  - No webhook is sent when a submission starts waiting for credits.
75
76
 
76
77
  ## Signature requests
package/README.md CHANGED
@@ -9,7 +9,7 @@ templates with your data, generates PDFs from HTML templates, combines PDFs and
9
9
  The code in this repository is generated from DocSpring's OpenAPI spec ([About this SDK](#about-this-sdk)). Issues and
10
10
  pull requests are welcome.
11
11
 
12
- Version 4.0.0.
12
+ Version 4.2.0.
13
13
 
14
14
  ## Install and configure
15
15
 
@@ -89,6 +89,7 @@ JavaScript code for every method.
89
89
 
90
90
  | Method | Description |
91
91
  | ------ | ----------- |
92
+ | [`addTemplateFields`](https://github.com/DocSpring/docspring-javascript/blob/main/docs/Client.md#addtemplatefields) | Add fields to a template |
92
93
  | [`copyTemplate`](https://github.com/DocSpring/docspring-javascript/blob/main/docs/Client.md#copytemplate) | Copy a template |
93
94
  | [`createCombinedPdf`](https://github.com/DocSpring/docspring-javascript/blob/main/docs/Client.md#createcombinedpdf) | Combine PDFs |
94
95
  | [`createCustomFileFromUpload`](https://github.com/DocSpring/docspring-javascript/blob/main/docs/Client.md#createcustomfilefromupload) | Create a custom file from an upload |
@@ -98,6 +99,7 @@ JavaScript code for every method.
98
99
  | [`createSubmission`](https://github.com/DocSpring/docspring-javascript/blob/main/docs/Client.md#createsubmission) | Generate a PDF |
99
100
  | [`createSubmissionBatch`](https://github.com/DocSpring/docspring-javascript/blob/main/docs/Client.md#createsubmissionbatch) | Generate PDFs in a batch |
100
101
  | [`createTemplate`](https://github.com/DocSpring/docspring-javascript/blob/main/docs/Client.md#createtemplate) | Create a template |
102
+ | [`createTemplatePreview`](https://github.com/DocSpring/docspring-javascript/blob/main/docs/Client.md#createtemplatepreview) | Preview a template with data |
101
103
  | [`createWebhook`](https://github.com/DocSpring/docspring-javascript/blob/main/docs/Client.md#createwebhook) | Create a webhook |
102
104
  | [`deleteCustomFile`](https://github.com/DocSpring/docspring-javascript/blob/main/docs/Client.md#deletecustomfile) | Delete a custom file |
103
105
  | [`deleteFolder`](https://github.com/DocSpring/docspring-javascript/blob/main/docs/Client.md#deletefolder) | Delete a folder |
@@ -105,6 +107,7 @@ JavaScript code for every method.
105
107
  | [`deleteWebhook`](https://github.com/DocSpring/docspring-javascript/blob/main/docs/Client.md#deletewebhook) | Delete a webhook |
106
108
  | [`expireCombinedPdf`](https://github.com/DocSpring/docspring-javascript/blob/main/docs/Client.md#expirecombinedpdf) | Expire a combined PDF |
107
109
  | [`expireSubmission`](https://github.com/DocSpring/docspring-javascript/blob/main/docs/Client.md#expiresubmission) | Expire a submission |
110
+ | [`generateSubmissionFiles`](https://github.com/DocSpring/docspring-javascript/blob/main/docs/Client.md#generatesubmissionfiles) | Generate more files |
108
111
  | [`generateSubmissionPreview`](https://github.com/DocSpring/docspring-javascript/blob/main/docs/Client.md#generatesubmissionpreview) | Generate a preview PDF |
109
112
  | [`getCombinedPdf`](https://github.com/DocSpring/docspring-javascript/blob/main/docs/Client.md#getcombinedpdf) | Get a combined PDF |
110
113
  | [`getCustomFile`](https://github.com/DocSpring/docspring-javascript/blob/main/docs/Client.md#getcustomfile) | Get a custom file |
@@ -114,28 +117,36 @@ JavaScript code for every method.
114
117
  | [`getSubmission`](https://github.com/DocSpring/docspring-javascript/blob/main/docs/Client.md#getsubmission) | Get a submission |
115
118
  | [`getSubmissionBatch`](https://github.com/DocSpring/docspring-javascript/blob/main/docs/Client.md#getsubmissionbatch) | Get a batch |
116
119
  | [`getTemplate`](https://github.com/DocSpring/docspring-javascript/blob/main/docs/Client.md#gettemplate) | Get a template |
120
+ | [`getTemplateDiff`](https://github.com/DocSpring/docspring-javascript/blob/main/docs/Client.md#gettemplatediff) | Compare a version of a template with the one before it |
117
121
  | [`getTemplateModelCode`](https://github.com/DocSpring/docspring-javascript/blob/main/docs/Client.md#gettemplatemodelcode) | Generate typed code for a template's submission data |
122
+ | [`getTemplatePageImages`](https://github.com/DocSpring/docspring-javascript/blob/main/docs/Client.md#gettemplatepageimages) | Get images of a template's pages |
123
+ | [`getTemplatePreview`](https://github.com/DocSpring/docspring-javascript/blob/main/docs/Client.md#gettemplatepreview) | Get a template preview |
118
124
  | [`getTemplateSchema`](https://github.com/DocSpring/docspring-javascript/blob/main/docs/Client.md#gettemplateschema) | Get the JSON Schema of a template's submission data |
119
125
  | [`getWebhook`](https://github.com/DocSpring/docspring-javascript/blob/main/docs/Client.md#getwebhook) | Get a webhook |
120
126
  | [`listCombinedPdfs`](https://github.com/DocSpring/docspring-javascript/blob/main/docs/Client.md#listcombinedpdfs) | List combined PDFs |
121
127
  | [`listCustomFiles`](https://github.com/DocSpring/docspring-javascript/blob/main/docs/Client.md#listcustomfiles) | List custom files |
122
128
  | [`listFolders`](https://github.com/DocSpring/docspring-javascript/blob/main/docs/Client.md#listfolders) | List folders |
123
129
  | [`listSubmissions`](https://github.com/DocSpring/docspring-javascript/blob/main/docs/Client.md#listsubmissions) | List submissions |
130
+ | [`listTemplateFields`](https://github.com/DocSpring/docspring-javascript/blob/main/docs/Client.md#listtemplatefields) | List a template's fields |
124
131
  | [`listTemplates`](https://github.com/DocSpring/docspring-javascript/blob/main/docs/Client.md#listtemplates) | List templates |
125
132
  | [`listTemplateSubmissions`](https://github.com/DocSpring/docspring-javascript/blob/main/docs/Client.md#listtemplatesubmissions) | List a template's submissions |
126
133
  | [`listWebhooks`](https://github.com/DocSpring/docspring-javascript/blob/main/docs/Client.md#listwebhooks) | List webhooks |
127
134
  | [`moveFolder`](https://github.com/DocSpring/docspring-javascript/blob/main/docs/Client.md#movefolder) | Move a folder |
128
135
  | [`moveTemplate`](https://github.com/DocSpring/docspring-javascript/blob/main/docs/Client.md#movetemplate) | Move a template to a folder |
129
136
  | [`publishTemplateVersion`](https://github.com/DocSpring/docspring-javascript/blob/main/docs/Client.md#publishtemplateversion) | Publish a template version |
137
+ | [`removeTemplateFields`](https://github.com/DocSpring/docspring-javascript/blob/main/docs/Client.md#removetemplatefields) | Remove fields from a template |
130
138
  | [`renameFolder`](https://github.com/DocSpring/docspring-javascript/blob/main/docs/Client.md#renamefolder) | Rename a folder |
139
+ | [`reorderTemplateFields`](https://github.com/DocSpring/docspring-javascript/blob/main/docs/Client.md#reordertemplatefields) | Reorder a template's fields |
131
140
  | [`restoreTemplateVersion`](https://github.com/DocSpring/docspring-javascript/blob/main/docs/Client.md#restoretemplateversion) | Restore a template version |
132
141
  | [`testAuthentication`](https://github.com/DocSpring/docspring-javascript/blob/main/docs/Client.md#testauthentication) | Test authentication |
133
142
  | [`updateSignatureRequest`](https://github.com/DocSpring/docspring-javascript/blob/main/docs/Client.md#updatesignaturerequest) | Update a signature request |
134
143
  | [`updateTemplate`](https://github.com/DocSpring/docspring-javascript/blob/main/docs/Client.md#updatetemplate) | Update a template |
135
144
  | [`updateTemplateDocument`](https://github.com/DocSpring/docspring-javascript/blob/main/docs/Client.md#updatetemplatedocument) | Replace a template's PDF |
145
+ | [`updateTemplateFields`](https://github.com/DocSpring/docspring-javascript/blob/main/docs/Client.md#updatetemplatefields) | Update a template's fields |
136
146
  | [`updateWebhook`](https://github.com/DocSpring/docspring-javascript/blob/main/docs/Client.md#updatewebhook) | Update a webhook |
137
147
  | [`uploadTemplate`](https://github.com/DocSpring/docspring-javascript/blob/main/docs/Client.md#uploadtemplate) | Create a PDF template from an uploaded PDF |
138
148
  | [`uploadTemplateDocument`](https://github.com/DocSpring/docspring-javascript/blob/main/docs/Client.md#uploadtemplatedocument) | Replace a template's PDF with an uploaded PDF |
149
+ | [`validateSubmission`](https://github.com/DocSpring/docspring-javascript/blob/main/docs/Client.md#validatesubmission) | Check a submission without creating it |
139
150
 
140
151
  ## Errors
141
152
 
@@ -170,6 +181,7 @@ On top of the generated code, we add:
170
181
  - A client constructor that reads your credentials, region and host from the environment.
171
182
  - A nested object that's null in a response is `null` (stock OpenAPI Generator makes it `undefined`).
172
183
  - A rejected call's `response` is an object with the response's status, headers and body. Stock OpenAPI Generator attaches superagent's response, which holds the request's `Authorization` header, so logging the error printed the API token.
184
+ - `verifyWebhookSignature(payload, signatureHeader, secret)` checks a webhook request's `X-DocSpring-Signature` header, with a `{ tolerance, now }` options object.
173
185
 
174
186
  Each release regenerates every file, so a change made only here would be lost in the next one. Issues and pull
175
187
  requests are welcome all the same: [open an issue](https://github.com/DocSpring/docspring-javascript/issues) or a pull request, or email
package/dist/ApiClient.js CHANGED
@@ -38,7 +38,7 @@ function responseInfo(response) {
38
38
 
39
39
  /**
40
40
  * @module ApiClient
41
- * @version 4.0.0
41
+ * @version 4.2.0
42
42
  */
43
43
 
44
44
  /**
@@ -88,7 +88,7 @@ var ApiClient = /*#__PURE__*/function () {
88
88
  * @default {}
89
89
  */
90
90
  this.defaultHeaders = {
91
- 'User-Agent': 'docspring-javascript-4.0.0'
91
+ 'User-Agent': 'docspring-javascript-4.2.0'
92
92
  };
93
93
 
94
94
  /**