@pageproof/sdk-pr 188.0.1564719085816 → 188.0.1588641260011

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 (264) hide show
  1. package/CHANGELOG.md +158 -0
  2. package/README.md +3 -0
  3. package/lib/adapters/AngularEnhancementAdapter.d.ts +75 -0
  4. package/lib/adapters/ClusterCryptoAdapter.d.ts +6 -0
  5. package/lib/adapters/ICacheAdapter.d.ts +51 -0
  6. package/lib/adapters/ICacheAdapter.production.d.ts +6 -0
  7. package/lib/adapters/ICryptoAdapter.d.ts +126 -0
  8. package/lib/adapters/ICryptoAdapter.js +1 -1
  9. package/lib/adapters/ICryptoAdapter.production.d.ts +6 -0
  10. package/lib/adapters/IEnhancementAdapter.d.ts +36 -0
  11. package/lib/adapters/IRequestAdapter.d.ts +6 -0
  12. package/lib/adapters/IRequestAdapter.production.d.ts +6 -0
  13. package/lib/adapters/IndexedDBCacheAdapter.d.ts +61 -0
  14. package/lib/adapters/NodeRequestAdapter.d.ts +47 -0
  15. package/lib/adapters/NodeRequestAdapter.js +1 -1
  16. package/lib/adapters/ProtobufAdapter.core.d.ts +12 -0
  17. package/lib/adapters/ProtobufAdapter.core.js +1 -0
  18. package/lib/adapters/ProtobufAdapter.d.ts +2 -0
  19. package/lib/adapters/ProtobufAdapter.js +1 -0
  20. package/lib/adapters/SchedulerCryptoAdapter.d.ts +109 -0
  21. package/lib/adapters/SchedulerCryptoAdapter.js +1 -1
  22. package/lib/adapters/SyncCryptoAdapter.d.ts +99 -0
  23. package/lib/adapters/SyncCryptoAdapter.js +1 -1
  24. package/lib/adapters/WorkerCryptoAdapter.d.ts +6 -0
  25. package/lib/adapters/XHRRequestAdapter.d.ts +35 -0
  26. package/lib/adapters/XHRRequestAdapter.js +1 -1
  27. package/lib/api/API.d.ts +13 -0
  28. package/lib/api/Accounts.d.ts +209 -0
  29. package/lib/api/Accounts.js +1 -1
  30. package/lib/api/AccountsSSO.d.ts +28 -0
  31. package/lib/api/Briefs.d.ts +97 -0
  32. package/lib/api/Comments.d.ts +199 -0
  33. package/lib/api/Comments.js +1 -1
  34. package/lib/api/Dashboard.d.ts +74 -0
  35. package/lib/api/DashboardGroups.d.ts +34 -0
  36. package/lib/api/DashboardGroups.js +1 -1
  37. package/lib/api/EmailProofs.d.ts +23 -0
  38. package/lib/api/EmailProofs.js +1 -0
  39. package/lib/api/Encryption.d.ts +29 -0
  40. package/lib/api/Files.d.ts +333 -0
  41. package/lib/api/GroupsOwners.d.ts +25 -0
  42. package/lib/api/GroupsWorkflows.d.ts +26 -0
  43. package/lib/api/Live.d.ts +26 -0
  44. package/lib/api/Preferences.d.ts +87 -0
  45. package/lib/api/Printing.d.ts +26 -0
  46. package/lib/api/Printing.js +1 -0
  47. package/lib/api/Profile.d.ts +78 -0
  48. package/lib/api/Proofs.d.ts +390 -0
  49. package/lib/api/Proofs.js +1 -1
  50. package/lib/api/ProofsAssets.d.ts +18 -0
  51. package/lib/api/ProofsAssets.js +1 -0
  52. package/lib/api/ProofsAssetsExtractedText.d.ts +14 -0
  53. package/lib/api/ProofsAssetsExtractedText.js +1 -0
  54. package/lib/api/ProofsAudit.d.ts +17 -0
  55. package/lib/api/ProofsCustomTools.d.ts +57 -0
  56. package/lib/api/ProofsCustomTools.js +1 -0
  57. package/lib/api/ProofsEditors.d.ts +109 -0
  58. package/lib/api/ProofsEditors.js +1 -1
  59. package/lib/api/ProofsGroups.d.ts +116 -0
  60. package/lib/api/ProofsGroups.js +1 -1
  61. package/lib/api/ProofsOwners.d.ts +58 -0
  62. package/lib/api/ProofsOwners.js +1 -1
  63. package/lib/api/ProofsReviewers.d.ts +32 -0
  64. package/lib/api/ProofsVersions.d.ts +57 -0
  65. package/lib/api/Reminders.d.ts +58 -0
  66. package/lib/api/Reminders.js +1 -1
  67. package/lib/api/Reports.d.ts +30 -0
  68. package/lib/api/Reports.js +1 -0
  69. package/lib/api/Sessions.d.ts +18 -0
  70. package/lib/api/Teams.d.ts +13 -0
  71. package/lib/api/Teams.js +1 -0
  72. package/lib/api/TeamsInvitations.d.ts +30 -0
  73. package/lib/api/TeamsInvitations.js +1 -0
  74. package/lib/api/Users.d.ts +31 -0
  75. package/lib/api/Workflows.d.ts +275 -0
  76. package/lib/api/Workflows.js +1 -1
  77. package/lib/api/WorkflowsSteps.d.ts +38 -0
  78. package/lib/api/admin/Admin.d.ts +13 -0
  79. package/lib/api/admin/Admin.js +2 -14
  80. package/lib/api/admin/Team.d.ts +41 -0
  81. package/lib/api/admin/Team.js +20 -8
  82. package/lib/api/admin/TeamCustomWebhooks.d.ts +16 -0
  83. package/lib/api/admin/TeamDashboard.d.ts +76 -0
  84. package/lib/api/admin/TeamFeatures.d.ts +39 -0
  85. package/lib/api/admin/TeamFeatures.js +11 -2
  86. package/lib/api/admin/TeamSCIM.d.ts +49 -0
  87. package/lib/api/admin/{Reports.js → TeamSCIM.js} +71 -30
  88. package/lib/api/admin/TeamUsers.d.ts +55 -0
  89. package/lib/api/admin/TeamUsers.js +24 -0
  90. package/lib/api/brian/Brian.d.ts +16 -0
  91. package/lib/bluffer/BlobBluffer.d.ts +71 -0
  92. package/lib/bluffer/BufferBluffer.d.ts +71 -0
  93. package/lib/bluffer/StringBluffer.d.ts +71 -0
  94. package/lib/bluffer/index.d.ts +6 -0
  95. package/lib/core/AdapterRepository.d.ts +83 -0
  96. package/lib/core/AdapterRepository.js +1 -1
  97. package/lib/core/Cache.d.ts +15 -0
  98. package/lib/core/PageProof.d.ts +322 -0
  99. package/lib/core/PageProof.js +1 -1
  100. package/lib/crypto/decryptBytes.d.ts +2 -0
  101. package/lib/crypto/decryptBytes.js +1 -0
  102. package/lib/crypto/decryptComment.d.ts +9 -0
  103. package/lib/crypto/decryptData.d.ts +10 -0
  104. package/lib/crypto/decryptFileBlock.d.ts +3 -0
  105. package/lib/crypto/decryptImage.d.ts +8 -0
  106. package/lib/crypto/decryptManagedPrivateKey.d.ts +3 -0
  107. package/lib/crypto/decryptPrivateKey.d.ts +3 -0
  108. package/lib/crypto/encryptComment.d.ts +8 -0
  109. package/lib/crypto/encryptFileBlock.d.ts +3 -0
  110. package/lib/crypto/encryptPrivateKey.d.ts +10 -0
  111. package/lib/crypto/envelopes.d.ts +17 -0
  112. package/lib/crypto/generateAuthorizationHeaders.d.ts +3 -0
  113. package/lib/crypto/generateKeyIV.d.ts +3 -0
  114. package/lib/crypto/generateKeyPair.d.ts +6 -0
  115. package/lib/crypto/generatePasswordHash.d.ts +7 -0
  116. package/lib/crypto/generateWrappedSymmetricKey.d.ts +3 -0
  117. package/lib/crypto/index.d.ts +18 -0
  118. package/lib/crypto/index.js +1 -1
  119. package/lib/crypto/util/byteStringBufferToArrayBuffer.d.ts +2 -0
  120. package/lib/crypto/util/byteStringBufferToArrayBuffer.js +15 -0
  121. package/lib/enum/CommentState.d.ts +7 -0
  122. package/lib/enum/Decision.d.ts +7 -0
  123. package/lib/enum/Decision.js +1 -0
  124. package/lib/enum/FileAssignee.d.ts +6 -0
  125. package/lib/enum/FileCategory.d.ts +7 -0
  126. package/lib/enum/FileStatus.d.ts +8 -0
  127. package/lib/enum/ImportProvider.d.ts +8 -0
  128. package/lib/enum/Preference.d.ts +7 -0
  129. package/lib/enum/PrintingCommentsType.d.ts +6 -0
  130. package/lib/enum/PrintingCommentsType.js +1 -0
  131. package/lib/enum/PrintingGroupingType.d.ts +5 -0
  132. package/lib/enum/PrintingGroupingType.js +1 -0
  133. package/lib/enum/PrintingLayoutType.d.ts +5 -0
  134. package/lib/enum/PrintingLayoutType.js +1 -0
  135. package/lib/enum/PrintingPageSizeType.d.ts +5 -0
  136. package/lib/enum/PrintingPageSizeType.js +1 -0
  137. package/lib/enum/ProofState.d.ts +18 -0
  138. package/lib/enum/ProofStatus.d.ts +11 -0
  139. package/lib/enum/ProofType.d.ts +5 -0
  140. package/lib/enum/ReminderAction.d.ts +4 -0
  141. package/lib/enum/ReminderRelativeTo.d.ts +4 -0
  142. package/lib/enum/ReportFieldType.d.ts +4 -0
  143. package/lib/enum/ReportFieldType.js +1 -0
  144. package/lib/enum/ResponseStatus.d.ts +35 -0
  145. package/lib/enum/WorkflowStepState.d.ts +7 -0
  146. package/lib/enum/WorkflowUserRole.d.ts +7 -0
  147. package/lib/enum/WorkflowUserState.d.ts +9 -0
  148. package/lib/enum/index.d.ts +17 -0
  149. package/lib/enum/index.js +1 -1
  150. package/lib/events/EventEmitter.d.ts +18 -0
  151. package/lib/index.d.ts +8 -0
  152. package/lib/models/Comment.d.ts +158 -0
  153. package/lib/models/Comment.js +1 -1
  154. package/lib/models/File.d.ts +76 -0
  155. package/lib/models/Pin.d.ts +43 -0
  156. package/lib/models/Pin.js +1 -1
  157. package/lib/models/PinFill.d.ts +16 -0
  158. package/lib/models/PinFill.js +1 -0
  159. package/lib/models/Preference.d.ts +44 -0
  160. package/lib/models/Proof.d.ts +389 -0
  161. package/lib/models/Proof.js +1 -1
  162. package/lib/models/ProofGroup.d.ts +52 -0
  163. package/lib/models/ProofGroup.js +1 -1
  164. package/lib/models/ProofVersion.d.ts +19 -0
  165. package/lib/models/Reminder.d.ts +44 -0
  166. package/lib/models/ReportConfiguration.d.ts +21 -0
  167. package/lib/models/ReportConfiguration.js +1 -0
  168. package/lib/models/ReportField.d.ts +41 -0
  169. package/lib/models/ReportField.js +1 -0
  170. package/lib/models/Session.d.ts +118 -0
  171. package/lib/models/Session.js +1 -1
  172. package/lib/models/TeamCommentFeatures.d.ts +12 -0
  173. package/lib/models/TeamCommentFeatures.js +1 -0
  174. package/lib/models/TeamEmailFeatures.d.ts +12 -0
  175. package/lib/models/TeamFeatures.d.ts +29 -0
  176. package/lib/models/TeamFeatures.js +1 -1
  177. package/lib/models/TeamInvitation.d.ts +21 -0
  178. package/lib/models/TeamInvitation.js +1 -0
  179. package/lib/models/TeamProofFeatures.d.ts +12 -0
  180. package/lib/models/TeamProofFeatures.js +1 -0
  181. package/lib/models/User.d.ts +115 -0
  182. package/lib/models/Workflow.d.ts +48 -0
  183. package/lib/models/WorkflowStep.d.ts +52 -0
  184. package/lib/models/WorkflowUser.d.ts +45 -0
  185. package/lib/models/index.d.ts +12 -0
  186. package/lib/models/transform.d.ts +19 -0
  187. package/lib/network/Request.d.ts +149 -0
  188. package/lib/network/Request.js +1 -1
  189. package/lib/network/Response.d.ts +54 -0
  190. package/lib/network/endpoints.json +137 -8
  191. package/lib/pageproof.js +1 -1
  192. package/lib/protobuf-adapter.js +2 -0
  193. package/lib/sync-crypto-adapter.js +1 -1
  194. package/lib/types/ApproverUserDefinition.d.ts +13 -0
  195. package/lib/types/Comment.d.ts +73 -0
  196. package/lib/types/CommentTokenDefinition.d.ts +38 -0
  197. package/lib/types/EditorUserDefinition.d.ts +13 -0
  198. package/lib/types/EncryptedComment.d.ts +13 -0
  199. package/lib/types/Endpoint.d.ts +29 -0
  200. package/lib/types/KeyIV.d.ts +13 -0
  201. package/lib/types/KeyPair.d.ts +13 -0
  202. package/lib/types/OwnerUserDefinition.d.ts +13 -0
  203. package/lib/types/PrintingJob.d.ts +10 -0
  204. package/lib/types/PrintingJob.js +1 -0
  205. package/lib/types/PrintingJobFilename.d.ts +10 -0
  206. package/lib/types/PrintingJobFilename.js +1 -0
  207. package/lib/types/PrintingJobOptions.d.ts +22 -0
  208. package/lib/types/PrintingJobOptions.js +1 -0
  209. package/lib/types/PrintingOption.d.ts +26 -0
  210. package/lib/types/PrintingOption.js +1 -0
  211. package/lib/types/ProofsWithEditorsDefinition.d.ts +4 -0
  212. package/lib/types/ProofsWithEditorsDefinition.js +1 -0
  213. package/lib/types/QueueItem.d.ts +13 -0
  214. package/lib/types/ReviewerUserDefinition.d.ts +13 -0
  215. package/lib/types/SSOLoginOption.d.ts +17 -0
  216. package/lib/types/TeamDashboardPagination.d.ts +13 -0
  217. package/lib/types/UserStatus.d.ts +14 -0
  218. package/lib/types/WorkflowStepDefinition.d.ts +13 -0
  219. package/lib/types/WorkflowUserDefinition.d.ts +26 -0
  220. package/lib/types/WrappedSymmetricKey.d.ts +13 -0
  221. package/lib/util/Scheduler.d.ts +93 -0
  222. package/lib/util/Scheduler.js +1 -1
  223. package/lib/util/arrayBufferToString.d.ts +2 -0
  224. package/lib/util/comments/convertToDraft.d.ts +5 -0
  225. package/lib/util/comments/extractMentions.d.ts +12 -0
  226. package/lib/util/comments/getCommentState.d.ts +2 -0
  227. package/lib/util/comments/linkStrategy.d.ts +2 -0
  228. package/lib/util/comments/parseComment.d.ts +3 -0
  229. package/lib/util/comments/renderHTML.d.ts +2 -0
  230. package/lib/util/comments/renderText.d.ts +2 -0
  231. package/lib/util/comments/v1-to-v2.d.ts +25 -0
  232. package/lib/util/comments/v2.d.ts +2 -0
  233. package/lib/util/concurrent.d.ts +2 -0
  234. package/lib/util/constants.d.ts +39 -0
  235. package/lib/util/creationToken.d.ts +1 -0
  236. package/lib/util/debug.d.ts +2 -0
  237. package/lib/util/exports.d.ts +14 -0
  238. package/lib/util/generateRandom.d.ts +6 -0
  239. package/lib/util/getContentLength.d.ts +3 -0
  240. package/lib/util/getPercentage.d.ts +3 -0
  241. package/lib/util/getTimezone.d.ts +3 -0
  242. package/lib/util/hasOwnProperty.d.ts +2 -0
  243. package/lib/util/id.d.ts +2 -0
  244. package/lib/util/isObject.d.ts +2 -0
  245. package/lib/util/removeHTMLEntities.d.ts +2 -0
  246. package/lib/util/sleep.d.ts +2 -0
  247. package/lib/util/sort.d.ts +8 -0
  248. package/lib/util/statusCodes.d.ts +4 -0
  249. package/lib/util/streamBlocks.d.ts +11 -0
  250. package/lib/util/stringToArrayBuffer.d.ts +2 -0
  251. package/lib/util/throttle.d.ts +2 -0
  252. package/lib/util/uuid.d.ts +3 -0
  253. package/lib/util/version.d.ts +2 -0
  254. package/lib/util/whatwgURL.d.ts +2 -0
  255. package/lib/util/whatwgURL.js +1 -0
  256. package/lib/worker/ClusterWorker.d.ts +1 -0
  257. package/lib/worker/CryptoWorker.d.ts +5 -0
  258. package/lib/worker/WebWorker.d.ts +1 -0
  259. package/lib/worker-crypto-adapter.js +1 -1
  260. package/lib/worker.b96ca36d.js +2 -0
  261. package/lib/xhr-request-adapter.js +1 -1
  262. package/package.json +11 -4
  263. package/lib/enum/ReportType.js +0 -1
  264. package/lib/worker.db4d8c84.js +0 -2
package/CHANGELOG.md CHANGED
@@ -1,5 +1,163 @@
1
1
  # Changelog
2
2
 
3
+ ## 2.0.0-beta.121
4
+
5
+ Released on the 20th of April 2020.
6
+
7
+ - [[#229](https://github.com/PageProofCom/sdk/pull/229)] Support for adding multiple editors on different proofs. See [ProofsEditors.bulkAdd](https://docs.pageproof.tech/@pageproof/sdk/beta/class/src/api/ProofsEditors.js~ProofsEditors.html#instance-method-bulkAdd).
8
+
9
+ ## 2.0.0-beta.120
10
+
11
+ Released on the 16th of March 2020.
12
+
13
+ - [[#225](https://github.com/PageProofCom/sdk/pull/225)] Amendment to how the proof status is calculated, when a proof has no workflow.
14
+
15
+ ## 2.0.0-beta.119
16
+
17
+ Released on the 13th of March 2020.
18
+
19
+ - [[#226](https://github.com/PageProofCom/sdk/pull/226)] Support for printing of proofs and the options available to do so. See [Printing](https://docs.pageproof.tech/@pageproof/sdk/beta/class/src/api/Printing.js)
20
+
21
+ ## 2.0.0-beta.118
22
+
23
+ Released on the 24th of February 2020.
24
+
25
+ - [[#223](https://github.com/PageProofCom/sdk/pull/223)] Support for owners to be able to return todo lists by themselves. See [Proofs.returnTodos](https://docs.pageproof.tech/@pageproof/sdk/beta/class/src/api/Proofs.js~Proofs.html#instance-method-returnTodos)
26
+
27
+ ## 2.0.0-beta.117
28
+
29
+ Released on the 13th of February 2020.
30
+
31
+ - [[#220](https://github.com/PageProofCom/sdk/pull/221)] Support for Custom Tools.
32
+
33
+ ## 2.0.0-beta.116
34
+
35
+ Released on the 10th of February 2020.
36
+
37
+ - Support for bot accounts assigning team ownership over proofs (via the team slug).
38
+
39
+ ## 2.0.0-beta.115
40
+
41
+ Released on the 20th of January 2020.
42
+
43
+ - [[#219](https://github.com/PageProofCom/sdk/pull/219)] Support for box-pin fill image (used internally for the Text Selection and Freehand Drawing tools).
44
+
45
+ ## 2.0.0-beta.114
46
+
47
+ Released on the 15th of January 2020.
48
+
49
+ - Support for passing referrer identifier during account registration.
50
+
51
+ ## 2.0.0-beta.111
52
+
53
+ Released on the 19th of December 2019.
54
+
55
+ - [[#214](https://github.com/PageProofCom/sdk/pull/214)] Support for retrieving extracted text from proofs. Currently only available in-app.
56
+
57
+ ## 2.0.0-beta.110
58
+
59
+ Released on the 5th of December 2019.
60
+
61
+ - [[#217](https://github.com/PageProofCom/sdk/pull/217)] Support for archiving/reopening a group. See [ProofsGroups.archive](https://docs.pageproof.tech/@pageproof/sdk/beta/class/src/api/ProofsGroups.js~ProofsGroups.html#instance-method-archive) See [ProofsGroups.reopen](https://docs.pageproof.tech/@pageproof/sdk/beta/class/src/api/ProofsGroups.js~ProofsGroups.html#instance-method-reopen).
62
+
63
+ ## 2.0.0-beta.109
64
+
65
+ Released on the 29th of November 2019
66
+
67
+ - Support for regenerating SCIM access tokens.
68
+
69
+ ## 2.0.0-beta.108
70
+
71
+ Released on the 28th of November 2019
72
+
73
+ - Support for SCIM.
74
+
75
+ ## 2.0.0-beta.106
76
+
77
+ Released on the 23rd of October 2019.
78
+
79
+ - Bugfixes around account activation.
80
+
81
+ ## 2.0.0-beta.105
82
+
83
+ Released on the 23rd of October 2019.
84
+
85
+ - Support for activating new accounts (without having to call `.register()` and then `.activate()`).
86
+
87
+ ## 2.0.0-beta.104
88
+
89
+ Released on the 22nd of October 2019.
90
+
91
+ - [[#212](https://github.com/PageProofCom/sdk/pull/212)] Support for inviting users into your team, and accepting/declining team invitations.
92
+
93
+ ## 2.0.0-beta.103
94
+
95
+ Released on the 18th of October 2019.
96
+
97
+ - [[#209](https://github.com/PageProofCom/sdk/pull/209)] Support for creating and deleting multiple reminders, as well as creating reminders when creating a proof.
98
+
99
+ ## 2.0.0-beta.102
100
+
101
+ Released on the 17th of October 2019.
102
+
103
+ - Fixes Node.js 8.x support.
104
+
105
+ ## 2.0.0-beta.101
106
+
107
+ Released on the 17th of October 2019.
108
+
109
+ - Bugfixes around workers dying part-way through processing a job.
110
+
111
+ ## 2.0.0-beta.100
112
+
113
+ Released on the 20th of September 2019.
114
+
115
+ - [[#203](https://github.com/PageProofCom/sdk/pull/203)] Adds support for proof references, which can be used to enhance integrations (via Zapier or deep integrations by SDK customers).
116
+
117
+ ## 2.0.0-beta.99
118
+
119
+ Released on the 12th of September 2019.
120
+
121
+ - [[#198](https://github.com/PageProofCom/sdk/pull/198)]
122
+ - Support for listing possible reports for the user. [Reports.listConfigurations](https://docs.pageproof.tech/@pageproof/sdk/beta/class/src/api/Reports.js~Reports.html#instance-method-listConfigurations).
123
+ - Support for creating a report for the user. [Reports.create](https://docs.pageproof.tech/@pageproof/sdk/beta/class/src/api/Reports.js~Reports.html#instance-method-create).
124
+
125
+ ## 2.0.0-beta.98
126
+
127
+ Released on the 6th of September 2019.
128
+
129
+ - [[#201](https://github.com/PageProofCom/sdk/pull/201)] Support for deleting a group, if it's empty. See [ProofsGroups.delete](https://docs.pageproof.tech/@pageproof/sdk/beta/class/src/api/ProofsGroups.js~ProofsGroups.html#instance-method-delete).
130
+
131
+ ## 2.0.0-beta.97
132
+
133
+ Released on the 3rd of September 2019.
134
+
135
+ - [[#195](https://github.com/PageProofCom/sdk/pull/195)] Support for adding owners on multiple proofs. See [ProofsOwners.add](https://docs.pageproof.tech/@pageproof/sdk/beta/class/src/api/ProofsOwners.js~ProofsOwners.html#instance-method-add).
136
+
137
+ ## 2.0.0-beta.96
138
+
139
+ Released on the 26th of August 2019.
140
+
141
+ - [[#197](https://github.com/PageProofCom/sdk/pull/197)] Administrators can now enable/disable editing of comments by other users in team features. See [TeamFeatures.comments](https://docs.pageproof.tech/@pageproof/sdk/beta/class/src/api/admin/TeamFeatures.js~TeamFeatures.html#instance-member-comments).
142
+
143
+ ## 2.0.0-beta.95
144
+
145
+ Released on the 20th of August 2019.
146
+
147
+ - [[#184](https://github.com/PageProofCom/sdk/pull/184)] Support for leaving your decision on a proof (aka. pressing your "finished" button). See [Proofs.finish](https://docs.pageproof.tech/@pageproof/sdk/beta/class/src/api/Proofs.js~Proofs.html#instance-method-finish).
148
+
149
+ ## 2.0.0-beta.94
150
+
151
+ Released on the 15th of August 2019.
152
+
153
+ - Improved error retrying for fatal errors in the NodeRequestAdapter.
154
+
155
+ ## 2.0.0-beta.93
156
+
157
+ Released on the 12th of August 2019.
158
+
159
+ - [[#190](https://github.com/PageProofCom/sdk/pull/190)] Support for setting a step id as starting point for the workflow. See [Workflows.setStartingStep](https://docs.pageproof.tech/@pageproof/sdk/beta/class/src/api/Workflows.js~Workflows.html#instance-method-setStartingStep).
160
+
3
161
  ## 2.0.0-beta.92
4
162
 
5
163
  Released on the 25th of July 2019.
package/README.md CHANGED
@@ -265,6 +265,8 @@ Name | Filename | Supported Environment | Supported
265
265
  [XHRRequestAdapter](./class/src/adapters/XHRRequestAdapter.js~XHRRequestAdapter.html) | `@pageproof/sdk/lib/xhr-request-adapter.js` | Browser | Yes
266
266
  [IndexedDBCacheAdapter](./class/src/adapters/IndexedDBCacheAdapter.js~IndexedDBCacheAdapter.html) | `@pageproof/sdk/lib/indexeddb-cache-adapter.js` | Browser | Yes
267
267
  [AngularEnhancementAdapter](./class/src/adapters/AngularEnhancementAdapter.js~AngularEnhancementAdapter.html) | `@pageproof/sdk/lib/angular-enhancement-adapter.js` | Browser | No (Experimental)
268
+ [ProtobufAdapter](./class/src/adapters/ProtobufAdapter.js~ProtobufAdapter.html) | `@pageproof/sdk/lib/protobuf-adapter.js` | Browser | No (Experimental)
269
+ [ProtobufAdapter](./class/src/adapters/ProtobufAdapter.js~ProtobufAdapter.html) | `@pageproof/sdk/lib/adapters/ProtobufAdapter.js` | Node.js | No (Experimental)
268
270
 
269
271
  The `SyncCryptoAdapter` is the only one we do not support, as it is a blocking adapter. You should *not* use this in
270
272
  production - it's only intended to be used within custom adapters you may write for a specific (officially unsupported)
@@ -307,6 +309,7 @@ Name | Namespace | Description | Admin-only | Stability
307
309
  [Proofs Groups Workflows API](./class/src/api/GroupsWorkflows.js~GroupsWorkflows.html) | `proofs.groups.workflows` | Used to add reviewers to proofs in a group. | No | Stable
308
310
  [Proofs Reminders API](./class/src/api/Reminders.js~Reminders.html) | `proofs.reminders` | Manage reminders on proof. | No | Experimental
309
311
  [Proofs Audit API](./class/src/api/ProofsAudit.js~ProofsAudit.html) | `proofs.audit` | View audit reports/summary/timeline. | No | Experimental
312
+ [Proofs Custom Tools API](./class/src/api/ProofsCustomTools.js~ProofsCustomTools.html) | `proofs.customTools` | Validate, update and retrieve proof custom tools. | No | Stable
310
313
  [Admin Reports API](./class/src/api/Reports.js~Reports.html) | `admin.reports` | Request reports to be emailed to you. | Yes | Stable
311
314
 
312
315
  The "admin-only" APIs are exposed through the
@@ -0,0 +1,75 @@
1
+ export default AngularEnhancementAdapter;
2
+ /**
3
+ * The Angular.js (v1) Enhancement adapter (browser only).
4
+ *
5
+ * This adapter ties directly into your Angular.js application to assist with keeping Angular up-to-date with bindings
6
+ * that might change based on the Promises which resolve from the SDK.
7
+ *
8
+ * Errors (from rejected Promises and uncaught exceptions) are automatically sent to the `$exceptionHandler` service.
9
+ * Depending on your setup, this feature can mean that SDK errors are sent to your error reporting service of choice.
10
+ *
11
+ * @example <caption>Pre-module initialization (recommended)</caption>
12
+ * import PageProof from '@pageproof/sdk';
13
+ * import AngularEnhancementAdapter from '@pageproof/sdk/lib/angular-enhancement-adapter';
14
+ *
15
+ * const app = angular.module('myApp', []);
16
+ * const client = new PageProof({
17
+ * adapters: [
18
+ * // ...
19
+ * new AngularEnhancementAdapter({
20
+ * module: app,
21
+ * }),
22
+ * ],
23
+ * });
24
+ *
25
+ * @example <caption>Post-module initialization (manual setup)</caption>
26
+ * import PageProof from '@pageproof/sdk';
27
+ * import AngularEnhancementAdapter from '@pageproof/sdk/lib/angular-enhancement-adapter';
28
+ *
29
+ * const app = angular.module('myApp');
30
+ * app.service('sdk', ($rootScope, $exceptionHandler) => {
31
+ * const client = new PageProof({
32
+ * adapters: [
33
+ * // ...
34
+ * new AngularEnhancementAdapter({
35
+ * $scope: $rootScope,
36
+ * $exceptionHandler,
37
+ * }),
38
+ * ],
39
+ * });
40
+ * return client;
41
+ * });
42
+ */
43
+ declare class AngularEnhancementAdapter extends IEnhancementAdapter {
44
+ /**
45
+ * @since v2.0.0-beta.17
46
+ * @param {object} options
47
+ * @param {angular.Module} [options.module] Your angular app/module
48
+ * @param {function} [options.$exceptionHandler] The $exceptionHandler service
49
+ * @param {object} [options.$scope] The $scope to re-digest
50
+ */
51
+ constructor(options: {
52
+ module?: any;
53
+ $exceptionHandler?: Function;
54
+ $scope?: any;
55
+ });
56
+ /** @private */
57
+ options: {
58
+ module: any;
59
+ $exceptionHandler: any;
60
+ $scope: any;
61
+ };
62
+ /** @private */
63
+ $scope: any;
64
+ /** @private */
65
+ $exceptionHandler: any;
66
+ /** @private */
67
+ onMethodReject({ rejected }: {
68
+ rejected: any;
69
+ }): void;
70
+ /** @private */
71
+ onMethodThrown({ error }: {
72
+ error: any;
73
+ }): void;
74
+ }
75
+ import IEnhancementAdapter from "./IEnhancementAdapter";
@@ -0,0 +1,6 @@
1
+ export default ClusterCryptoAdapter;
2
+ declare class ClusterCryptoAdapter extends SchedulerCryptoAdapter {
3
+ constructor(options?: {});
4
+ options: {};
5
+ }
6
+ import SchedulerCryptoAdapter from "./SchedulerCryptoAdapter";
@@ -0,0 +1,51 @@
1
+ export default ICacheAdapter;
2
+ declare class ICacheAdapter {
3
+ static __adapter__: string;
4
+ /**
5
+ * Stores a value into the backend cache by key.
6
+ *
7
+ * @abstract
8
+ * @param {string} key The key to store the value against
9
+ * @param {*} value The underlying value - can be any kind of value, it's up to the adapter to decide on whether it can be serialised, and how to do so. Reject the returning Promise if the value cannot be stored by the adapter.
10
+ * @returns {Promise}
11
+ */
12
+ set(): Promise<any>;
13
+ /**
14
+ * Checks whether or not a value exists in the backend cache by key.
15
+ *
16
+ * Do not reject the returning Promise value if the key isn't found. Instead, resolve either
17
+ * `true` or `false` based on it's existance. And leave rejections to failures etc...
18
+ *
19
+ * @abstract
20
+ * @param {string} key The key to check exists
21
+ * @returns {Promise<boolean>}
22
+ */
23
+ has(): Promise<boolean>;
24
+ /**
25
+ * Attempts to retrieve the value from the backend cache.
26
+ *
27
+ * Resolve the Promise only if;
28
+ * - The associated cache entry exists and is still valid
29
+ *
30
+ * Reject the Promise if;
31
+ * - The cache entry does not exist
32
+ * - The cache entry exists but is not valid
33
+ * - Any other failures
34
+ *
35
+ * @abstract
36
+ * @param {string} key The key
37
+ * @returns {Promise<*>}
38
+ */
39
+ get(): Promise<any>;
40
+ /**
41
+ * Force the backend cache to clear all the stored data.
42
+ *
43
+ * This method is never called by the SDK, for any reason, but it must be implemented for
44
+ * convenience to the SDK consumer. Allowing them to manually empty the cache mainly for debugging
45
+ * purposes.
46
+ *
47
+ * @abstract
48
+ * @returns {Promise}
49
+ */
50
+ clear(): Promise<any>;
51
+ }
@@ -0,0 +1,6 @@
1
+ export default ICacheAdapter;
2
+ /** @private */
3
+ declare function ICacheAdapter(): void;
4
+ declare namespace ICacheAdapter {
5
+ export const __adapter__: string;
6
+ }
@@ -0,0 +1,126 @@
1
+ export default ICryptoAdapter;
2
+ declare class ICryptoAdapter {
3
+ static __adapter__: string;
4
+ /**
5
+ * @abstract
6
+ * @param {string} data$ The encrypted (and encoded) data
7
+ * @param {string} envelope$ The envelope containing the key
8
+ * @param {string} privateKeyPEM The user's private key used to decrypt the envelope
9
+ * @param {string[]} before Any pre-processing to do on the encrypted data
10
+ * @param {string[]} after Any post-processing to do on the newly-decrypted data
11
+ * @returns {Promise<string>} The decrypted (and encoded) data
12
+ */
13
+ decryptBytes(): Promise<string>;
14
+ /**
15
+ * @abstract
16
+ * @param {string} comment$ The encrypted comment
17
+ * @param {string} envelope The comment envelope containing the key
18
+ * @param {string} privateKeyPEM The user's private key used to decrypt the envelope
19
+ * @returns {Promise<string>} The original, raw comment text
20
+ */
21
+ decryptComment(): Promise<string>;
22
+ /**
23
+ * @abstract
24
+ * @param {number} version The encryption version number
25
+ * @param {string} data$ The encrypted data
26
+ * @param {string} envelope$ The envelope to use for decrypting the data
27
+ * @param {string} privateKeyPEM The user's private key (in PEM format)
28
+ * @returns {Promise<string>} The decrypted data
29
+ */
30
+ decryptData(): Promise<string>;
31
+ /**
32
+ * @abstract
33
+ * @param {string} data$ The encrypted file block (and envelope)
34
+ * @param {string} privateKeyPEM The user's private key used to decrypt the embedded envelope
35
+ * @returns {Promise<string>} A base64 representation of the original block
36
+ */
37
+ decryptFileBlock(): Promise<string>;
38
+ /**
39
+ * @abstract
40
+ * @param {string} data$ The encrypted image (and envelope)
41
+ * @param {string} privateKeyPEM The user's private key used to decrypt the embedded envelope
42
+ * @returns {Promise<string>} A base64 representation of the original image
43
+ */
44
+ decryptImage(): Promise<string>;
45
+ /**
46
+ * @abstract
47
+ * @param {string} privateKey$ The user's encrypted private key
48
+ * @param {string} password The user's original password, used to decrypt the private key
49
+ * @returns {Promise<string>} The user's private key (in PEM format)
50
+ */
51
+ decryptPrivateKey(): Promise<string>;
52
+ /**
53
+ * @abstract
54
+ * @param {{key: string, iv: string}} keyIV The key & iv to encrypt the block with
55
+ * @param {string} fileBlockBase64 The base64 coded file block
56
+ * @returns {Promise<string>} The encrypted block, base64 encoded
57
+ */
58
+ encryptFileBlock(): Promise<string>;
59
+ /**
60
+ * @abstract
61
+ * @param {string} privateKeyPEM The user's private key (in PEM format)
62
+ * @param {string} password The user's original password, used to encrypt the private key
63
+ * @returns {Promise<string>} The user's encrypted private key
64
+ */
65
+ encryptPrivateKey(): Promise<string>;
66
+ /**
67
+ * @abstract
68
+ * @param {string} secret The secret to seal within an envelope
69
+ * @param {Array<string>} publicKeyPEMs The list of public keys to encrypt the envelope for
70
+ * @returns {Promise<string>} The full envelope
71
+ */
72
+ envelopeSeal(): Promise<string>;
73
+ /**
74
+ * @abstract
75
+ * @param {string} envelope The full envelope to unseal
76
+ * @param {string} privateKeyPEM The user's private key (in PEM format), used to decrypt the envelope
77
+ * @returns {Promise<string>} The secret within the envelope
78
+ */
79
+ envelopeUnseal(): Promise<string>;
80
+ /**
81
+ * @abstract
82
+ * @param {string} method The request method/verb (eg. GET, POST)
83
+ * @param {string} path The endpoint (pathname)
84
+ * @param {Session} session The Session object used to sign the request
85
+ * @returns {Promise<Object<string, string>>} The additional headers to add to the request for it to be signed
86
+ */
87
+ generateAuthorizationHeaders(): Promise<{
88
+ [x: string]: string;
89
+ }>;
90
+ /**
91
+ * @abstract
92
+ * @returns {Promise<KeyIV>} The randomly generated symmetric key and IV
93
+ */
94
+ generateKeyIV(): Promise<KeyIV>;
95
+ /**
96
+ * @abstract
97
+ * @returns {Promise<KeyPair>} The randomly generated asymmetric key pair
98
+ */
99
+ generateKeyPair(): Promise<KeyPair>;
100
+ /**
101
+ * @abstract
102
+ * @param {string} password The user's original password
103
+ * @returns {Promise<string>} The hashed password
104
+ */
105
+ generatePasswordHash(): Promise<string>;
106
+ /**
107
+ * @abstract
108
+ * @param {string} serverPublicKeyPEM The server's public key (in PEM format)
109
+ * @returns {Promise<WrappedSymmetricKey>} The wrapped symmetric key
110
+ */
111
+ generateWrappedSymmetricKey(): Promise<WrappedSymmetricKey>;
112
+ /**
113
+ * @abstract
114
+ * @param {string} privateKey$ The encrypted (and base64 encoded) private key
115
+ * @param {string} keyBase64 The key (base64 encoded) for decrypting the private key
116
+ * @returns {Promise<string>} The private pem (in PEM format)
117
+ */
118
+ decryptManagedPrivateKey(): Promise<string>;
119
+ /**
120
+ * @abstract
121
+ * @param {string} comment The raw comment text
122
+ * @param {Array<string>} publicKeyPEMs The public keys of recipients who can decrypt the comment (in PEM format)
123
+ * @returns {Promise<EncryptedComment>} The encrypted comment and envelope
124
+ */
125
+ encryptComment(): Promise<EncryptedComment>;
126
+ }
@@ -1 +1 @@
1
- "use strict";exports.__esModule=true;var _class,_temp;function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function")}}function notImplementedStub(name){return new Error(name+" is not implemented on ICryptoAdapter.")}var ICryptoAdapter=(_temp=_class=function(){function ICryptoAdapter(){_classCallCheck(this,ICryptoAdapter)}ICryptoAdapter.prototype.decryptComment=function decryptComment(){throw notImplementedStub("decryptComment(comment$: string, envelope: string, privateKeyPEM: string): Promise<string>")};ICryptoAdapter.prototype.decryptData=function decryptData(){throw notImplementedStub("decryptData(version: number, data$: string, envelope$: string, privateKeyPEM: string): Promise<string>")};ICryptoAdapter.prototype.decryptFileBlock=function decryptFileBlock(){throw notImplementedStub("decryptFileBlock(data$: string, privateKeyPEM: string): Promise<string>")};ICryptoAdapter.prototype.decryptImage=function decryptImage(){throw notImplementedStub("decryptImage(data$: string, privateKeyPEM: string): Promise<string>")};ICryptoAdapter.prototype.decryptPrivateKey=function decryptPrivateKey(){throw notImplementedStub("decryptPrivateKey(privateKey$: string, password: string): Promise<string>")};ICryptoAdapter.prototype.encryptFileBlock=function encryptFileBlock(){throw notImplementedStub("encryptFileBlock(keyIV: {key: string, iv: string}, fileBlockBase64: string): Promise<string>")};ICryptoAdapter.prototype.encryptPrivateKey=function encryptPrivateKey(){throw notImplementedStub("encryptPrivateKey(privateKeyPEM: string, password: string): Promise<string>")};ICryptoAdapter.prototype.envelopeSeal=function envelopeSeal(){throw notImplementedStub("envelopeSeal(secret: string, publicKeyPEMs: Array<string>): Promise<string>")};ICryptoAdapter.prototype.envelopeUnseal=function envelopeUnseal(){throw notImplementedStub("envelopeUnseal(envelope: string, privateKeyPEM: string): Promise<string>")};ICryptoAdapter.prototype.generateAuthorizationHeaders=function generateAuthorizationHeaders(){throw notImplementedStub("generateAuthorizationHeaders(method: string, path: string, session: Session): Promise<Object<string, string>>")};ICryptoAdapter.prototype.generateKeyIV=function generateKeyIV(){throw notImplementedStub("generateKeyIV(): Promise<{KeyIV}>")};ICryptoAdapter.prototype.generateKeyPair=function generateKeyPair(){throw notImplementedStub("generateKeyPair(): Promise<{KeyPair}>")};ICryptoAdapter.prototype.generatePasswordHash=function generatePasswordHash(){throw notImplementedStub("generatePasswordHash(password: string): Promise<string>")};ICryptoAdapter.prototype.generateWrappedSymmetricKey=function generateWrappedSymmetricKey(){throw notImplementedStub("generateWrappedSymmetricKey(serverPublicKeyPEM: string): Promise<WrappedSymmetricKey>")};ICryptoAdapter.prototype.decryptManagedPrivateKey=function decryptManagedPrivateKey(){throw notImplementedStub("decryptManagedPrivateKey(privateKey$: string, keyBase64: string): Promise<string>")};ICryptoAdapter.prototype.encryptComment=function encryptComment(){throw notImplementedStub("encryptComment(comment: string, publicKeyPEMs: Array<string>): Promise<EncryptedComment>")};return ICryptoAdapter}(),_class.__adapter__="ICryptoAdapter",_temp);exports.default=ICryptoAdapter;
1
+ "use strict";exports.__esModule=true;var _class,_temp;function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function")}}function notImplementedStub(name){return new Error(name+" is not implemented on ICryptoAdapter.")}var ICryptoAdapter=(_temp=_class=function(){function ICryptoAdapter(){_classCallCheck(this,ICryptoAdapter)}ICryptoAdapter.prototype.decryptBytes=function decryptBytes(){throw notImplementedStub("decryptBytes(comment$: string, envelope$: string, privateKeyPEM: string, before: string[], after: string[]): Promise<string>")};ICryptoAdapter.prototype.decryptComment=function decryptComment(){throw notImplementedStub("decryptComment(comment$: string, envelope: string, privateKeyPEM: string): Promise<string>")};ICryptoAdapter.prototype.decryptData=function decryptData(){throw notImplementedStub("decryptData(version: number, data$: string, envelope$: string, privateKeyPEM: string): Promise<string>")};ICryptoAdapter.prototype.decryptFileBlock=function decryptFileBlock(){throw notImplementedStub("decryptFileBlock(data$: string, privateKeyPEM: string): Promise<string>")};ICryptoAdapter.prototype.decryptImage=function decryptImage(){throw notImplementedStub("decryptImage(data$: string, privateKeyPEM: string): Promise<string>")};ICryptoAdapter.prototype.decryptPrivateKey=function decryptPrivateKey(){throw notImplementedStub("decryptPrivateKey(privateKey$: string, password: string): Promise<string>")};ICryptoAdapter.prototype.encryptFileBlock=function encryptFileBlock(){throw notImplementedStub("encryptFileBlock(keyIV: {key: string, iv: string}, fileBlockBase64: string): Promise<string>")};ICryptoAdapter.prototype.encryptPrivateKey=function encryptPrivateKey(){throw notImplementedStub("encryptPrivateKey(privateKeyPEM: string, password: string): Promise<string>")};ICryptoAdapter.prototype.envelopeSeal=function envelopeSeal(){throw notImplementedStub("envelopeSeal(secret: string, publicKeyPEMs: Array<string>): Promise<string>")};ICryptoAdapter.prototype.envelopeUnseal=function envelopeUnseal(){throw notImplementedStub("envelopeUnseal(envelope: string, privateKeyPEM: string): Promise<string>")};ICryptoAdapter.prototype.generateAuthorizationHeaders=function generateAuthorizationHeaders(){throw notImplementedStub("generateAuthorizationHeaders(method: string, path: string, session: Session): Promise<Object<string, string>>")};ICryptoAdapter.prototype.generateKeyIV=function generateKeyIV(){throw notImplementedStub("generateKeyIV(): Promise<{KeyIV}>")};ICryptoAdapter.prototype.generateKeyPair=function generateKeyPair(){throw notImplementedStub("generateKeyPair(): Promise<{KeyPair}>")};ICryptoAdapter.prototype.generatePasswordHash=function generatePasswordHash(){throw notImplementedStub("generatePasswordHash(password: string): Promise<string>")};ICryptoAdapter.prototype.generateWrappedSymmetricKey=function generateWrappedSymmetricKey(){throw notImplementedStub("generateWrappedSymmetricKey(serverPublicKeyPEM: string): Promise<WrappedSymmetricKey>")};ICryptoAdapter.prototype.decryptManagedPrivateKey=function decryptManagedPrivateKey(){throw notImplementedStub("decryptManagedPrivateKey(privateKey$: string, keyBase64: string): Promise<string>")};ICryptoAdapter.prototype.encryptComment=function encryptComment(){throw notImplementedStub("encryptComment(comment: string, publicKeyPEMs: Array<string>): Promise<EncryptedComment>")};return ICryptoAdapter}(),_class.__adapter__="ICryptoAdapter",_temp);exports.default=ICryptoAdapter;
@@ -0,0 +1,6 @@
1
+ export default ICryptoAdapter;
2
+ /** @private */
3
+ declare function ICryptoAdapter(): void;
4
+ declare namespace ICryptoAdapter {
5
+ export const __adapter__: string;
6
+ }
@@ -0,0 +1,36 @@
1
+ export default IEnhancementAdapter;
2
+ declare class IEnhancementAdapter {
3
+ static __adapter__: string;
4
+ /** @private */
5
+ onClientReady(client: any): void;
6
+ /** @abstract */
7
+ onMethodBefore(): void;
8
+ /** @abstract */
9
+ onMethodAfter(): void;
10
+ /** @abstract */
11
+ onMethodReject(): void;
12
+ /** @abstract */
13
+ onMethodResolve(): void;
14
+ /** @abstract */
15
+ onMethodFinally(): void;
16
+ /** @abstract */
17
+ onMethodThrown(): void;
18
+ /** @abstract */
19
+ onRequestBefore(): void;
20
+ /** @abstract */
21
+ onRequestAfter(): void;
22
+ /** @abstract */
23
+ onRequestReject(): void;
24
+ /** @abstract */
25
+ onRequestThrottled(): void;
26
+ /** @abstract */
27
+ onRequestRetry(): void;
28
+ /** @abstract */
29
+ onRequestUnauthorized(): void;
30
+ /** @private */
31
+ onRequestDeprecated(): void;
32
+ /** @abstract */
33
+ onRequestResolve(): void;
34
+ /** @abstract */
35
+ onRequestFinally(): void;
36
+ }
@@ -0,0 +1,6 @@
1
+ export default IRequestAdapter;
2
+ declare class IRequestAdapter {
3
+ static __adapter__: string;
4
+ /** @abstract */
5
+ send(): void;
6
+ }
@@ -0,0 +1,6 @@
1
+ export default IRequestAdapter;
2
+ /** @private */
3
+ declare function IRequestAdapter(): void;
4
+ declare namespace IRequestAdapter {
5
+ export const __adapter__: string;
6
+ }
@@ -0,0 +1,61 @@
1
+ export default IndexedDBCacheAdapter;
2
+ /**
3
+ * The IndexedDBCacheAdapter cache adapter (browsers only).
4
+ *
5
+ * This adapter makes use of the Indexed DB API in modern browsers. Indexed DB allows for large
6
+ * binary data storage for persistence. Adding this adapter speeds up most methods that make use of
7
+ * typically slow processes - like decryption. For example; loading comments is considerably faster
8
+ * when using a `ICacheAdapter` (in our naive tests, we found that it dropped loading ~100 comments
9
+ * down from 6s to 25ms).
10
+ *
11
+ * When using this adapter it's important you choose a database name which doesn't already exist.
12
+ * By default we name the database `@pageproof/sdk/adapters/IndexedDBCacheAdapter`. And while
13
+ * there's nothing wrong with leaving it as-is, you're free to name it however you wish.
14
+ *
15
+ * The database is fully managed by the PageProof SDK. By no means should you attempt to communicate
16
+ * with it directly. We expose a set of methods to make it easy to interact with, for your
17
+ * convenience.
18
+ *
19
+ * @example <caption>Basic usage</caption>
20
+ * const client = new PageProof({
21
+ * adapters: [
22
+ * // ...
23
+ * new IndexedDBCacheAdapter(),
24
+ * ],
25
+ * });
26
+ */
27
+ declare class IndexedDBCacheAdapter extends ICacheAdapter {
28
+ /**
29
+ * @param {object} [options]
30
+ * @param {string} [options.database] The name of the IndexedDB database
31
+ */
32
+ constructor(options?: {
33
+ database?: string;
34
+ });
35
+ /** @private */
36
+ options: {
37
+ database: string;
38
+ };
39
+ /** @private */
40
+ cache: any;
41
+ /** @private */
42
+ set(key: any, value: any): any;
43
+ /** @private */
44
+ has(key: any): any;
45
+ /** @private */
46
+ get(key: any): any;
47
+ /** @private */
48
+ clear(): any;
49
+ /**
50
+ * Purges any expired entries from the cache.
51
+ *
52
+ * This is unique to the IndexedDBCacheAdapter because it doesn't run using a backend service.
53
+ * The adapter automatically purges expired cache entries at launch, but not during runtime. You
54
+ * can manually call this method during the lifetime of your app to ensure the cache doesn't get
55
+ * too large, if you expect your app to run for long periods of time.
56
+ *
57
+ * @returns {Promise}
58
+ */
59
+ purge(): Promise<any>;
60
+ }
61
+ import ICacheAdapter from "./ICacheAdapter";
@@ -0,0 +1,47 @@
1
+ export default NodeRequestAdapter;
2
+ /**
3
+ * The Node.js request adapter (Node.js only).
4
+ *
5
+ * This {@link IRequestAdapter} uses an npm package called `superagent` (https://npmjs.org/package/superagent) to send
6
+ * requests to the PageProof API in a Node.js environment. It's recommended this adapter be used in cases like Electron
7
+ * (https://electron.atom.io) because it is not limited to the network constraints of browser renderers.
8
+ *
9
+ * The proxy capabilities in this adapter utilizes an npm package called `superagent-proxy`
10
+ * (https://npmjs.org/package/superagent-proxy) and `proxy-from-env` (https://npmjs.org/package/proxy-from-env) (which
11
+ * detects what proxy server to use based on various system settings). You can disable the automatic proxy detection by
12
+ * setting the `proxy` option to `false`.
13
+ *
14
+ * Note: This adapter does not yet support progress events.
15
+ *
16
+ * @example
17
+ * import PageProof from '@pageproof/sdk';
18
+ * import NodeRequestAdapter from '@pageproof/sdk/lib/adapters/NodeRequestAdapter';
19
+ *
20
+ * const client = new PageProof({
21
+ * adapters: [
22
+ * new NodeRequestAdapter({
23
+ * proxy: 'http://proxy.example.com:3128',
24
+ * // OR
25
+ * proxy: false, // to disable proxy detection
26
+ * }),
27
+ * ],
28
+ * });
29
+ */
30
+ declare class NodeRequestAdapter extends IRequestAdapter {
31
+ /**
32
+ * @param {object} [options]
33
+ * @param {string|boolean} [options.proxy] The proxy URL to send all requests through. This option is only required if you want to manually override the system level proxy settings. Setting this option to `false` will disable all proxy settings. Omitting the setting (which is set to `true` by default) will attempt to proxy requests using the system level proxy settings.
34
+ */
35
+ constructor(options?: {
36
+ proxy?: string | boolean;
37
+ });
38
+ /** @private */
39
+ options: {
40
+ proxy: string | boolean;
41
+ };
42
+ /** @private */
43
+ send(request: any, options?: {}, state?: {
44
+ attempt: number;
45
+ }): Promise<any>;
46
+ }
47
+ import IRequestAdapter from "./IRequestAdapter";
@@ -1 +1 @@
1
- "use strict";exports.__esModule=true;var _extends=Object.assign||function(target){for(var i=1;i<arguments.length;i++){var source=arguments[i];for(var key in source){if(Object.prototype.hasOwnProperty.call(source,key)){target[key]=source[key]}}}return target};var _superagent=require("superagent");var _superagent2=_interopRequireDefault(_superagent);var _superagentProxy=require("superagent-proxy");var _superagentProxy2=_interopRequireDefault(_superagentProxy);var _systemProxyUrl=require("system-proxy-url");var _IRequestAdapter2=require("./IRequestAdapter");var _IRequestAdapter3=_interopRequireDefault(_IRequestAdapter2);function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function")}}function _possibleConstructorReturn(self,call){if(!self){throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}return call&&(typeof call==="object"||typeof call==="function")?call:self}function _inherits(subClass,superClass){if(typeof superClass!=="function"&&superClass!==null){throw new TypeError("Super expression must either be null or a function, not "+typeof superClass)}subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,enumerable:false,writable:true,configurable:true}});if(superClass)Object.setPrototypeOf?Object.setPrototypeOf(subClass,superClass):subClass.__proto__=superClass}(0,_superagentProxy2.default)(_superagent2.default);var debug=require("debug")("NodeRequestAdapter");var defaultOptions={proxy:true};var cachedAutoProxyUrls={};function getAutoProxyUrl(host){if(!cachedAutoProxyUrls[host]){cachedAutoProxyUrls[host]=(0,_systemProxyUrl.getProxyUrlSync)(host)}return cachedAutoProxyUrls[host]}var NodeRequestAdapter=function(_IRequestAdapter){_inherits(NodeRequestAdapter,_IRequestAdapter);function NodeRequestAdapter(){var options=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};_classCallCheck(this,NodeRequestAdapter);var _this=_possibleConstructorReturn(this,_IRequestAdapter.call(this));_this.options=_extends({},defaultOptions,options);return _this}NodeRequestAdapter.prototype.send=function send(request){var _this2=this;var options=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};debug(request.method+" "+request.path);return new Promise(function(resolve,reject){var requestUrl=request.host+request.path+request.query;var proxyUrl=null;if(typeof _this2.options.proxy==="string"){proxyUrl=_this2.options.proxy}else if(_this2.options.proxy===true){proxyUrl=getAutoProxyUrl(request.host)}var method=request.method.toLowerCase();var headers=_extends({},request.headers);var chain=_superagent2.default[method](requestUrl).set(headers).send(request.body);if(proxyUrl){chain=chain.proxy(proxyUrl)}chain.on("progress",function(event){if(event.total){var callback=event.direction==="download"?"onDownloadProgress":"onUploadProgress";if(callback in options){options[callback](event.progress)}}}).end(function(err,response){if(err&&!response){reject(err)}else{debug(request.method+" "+request.path+" ("+response.statusCode+")");resolve({status:response.statusCode,headers:response.headers,body:response.text})}})})};return NodeRequestAdapter}(_IRequestAdapter3.default);exports.default=NodeRequestAdapter;
1
+ "use strict";exports.__esModule=true;var _extends=Object.assign||function(target){for(var i=1;i<arguments.length;i++){var source=arguments[i];for(var key in source){if(Object.prototype.hasOwnProperty.call(source,key)){target[key]=source[key]}}}return target};var _superagent=require("superagent");var _superagent2=_interopRequireDefault(_superagent);var _superagentProxy=require("superagent-proxy");var _superagentProxy2=_interopRequireDefault(_superagentProxy);var _systemProxyUrl=require("system-proxy-url");var _IRequestAdapter2=require("./IRequestAdapter");var _IRequestAdapter3=_interopRequireDefault(_IRequestAdapter2);var _sleep=require("../util/sleep");var _sleep2=_interopRequireDefault(_sleep);function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function")}}function _possibleConstructorReturn(self,call){if(!self){throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}return call&&(typeof call==="object"||typeof call==="function")?call:self}function _inherits(subClass,superClass){if(typeof superClass!=="function"&&superClass!==null){throw new TypeError("Super expression must either be null or a function, not "+typeof superClass)}subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,enumerable:false,writable:true,configurable:true}});if(superClass)Object.setPrototypeOf?Object.setPrototypeOf(subClass,superClass):subClass.__proto__=superClass}(0,_superagentProxy2.default)(_superagent2.default);var debug=require("debug")("NodeRequestAdapter");var defaultOptions={proxy:true};var cachedAutoProxyUrls={};function getAutoProxyUrl(host){if(!cachedAutoProxyUrls[host]){cachedAutoProxyUrls[host]=(0,_systemProxyUrl.getProxyUrlSync)(host)}return cachedAutoProxyUrls[host]}var NodeRequestAdapter=function(_IRequestAdapter){_inherits(NodeRequestAdapter,_IRequestAdapter);function NodeRequestAdapter(){var options=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};_classCallCheck(this,NodeRequestAdapter);var _this=_possibleConstructorReturn(this,_IRequestAdapter.call(this));_this.options=_extends({},defaultOptions,options);return _this}NodeRequestAdapter.prototype.send=function send(request){var _this2=this;var options=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};var state=arguments.length>2&&arguments[2]!==undefined?arguments[2]:{attempt:1};debug(request.method+" "+request.path+" (attempt: "+state.attempt+")");return new Promise(function(resolve,reject){var requestUrl=request.host+request.path+request.query;var proxyUrl=null;if(typeof _this2.options.proxy==="string"){proxyUrl=_this2.options.proxy}else if(_this2.options.proxy===true){proxyUrl=getAutoProxyUrl(request.host)}var method=request.method.toLowerCase();var headers=_extends({},request.headers);var chain=_superagent2.default[method](requestUrl).set(headers).send(request.body);if(proxyUrl){chain=chain.proxy(proxyUrl)}var body=void 0;chain.on("progress",function(event){if(event.total){var callback=event.direction==="download"?"onDownloadProgress":"onUploadProgress";if(callback in options){options[callback](event.progress)}}}).buffer(true).parse(function(response,cb){if(options.bluffer){var data=[];response.on("data",function(chunk){data.push(chunk)});response.on("end",function(){body=Buffer.concat(data);cb(null,response)})}else{response.setEncoding("utf-8");var _data="";response.on("data",function(chunk){_data+=chunk});response.on("end",function(){body=_data;cb(null,response)})}response.on("error",cb)}).end(function(err,response){if(err&&!response){if(err.errno&&method==="get"&&state.attempt<=5){state.attempt++;debug(request.method+" "+request.path+" failed with errno "+err.errno+", retrying");resolve((0,_sleep2.default)(1e3*state.attempt).then(function(){return _this2.send(request,options,state)}))}else{reject(err)}}else{debug(request.method+" "+request.path+" ("+response.statusCode+")");resolve({status:response.statusCode,headers:response.headers,body:body})}})})};return NodeRequestAdapter}(_IRequestAdapter3.default);exports.default=NodeRequestAdapter;