@pageproof/sdk-pr 92.0.1532911382561 → 94.0.1532494398420
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/CHANGELOG.md +0 -13
- package/README.md +0 -1
- package/lib/api/Comments.js +1 -1
- package/lib/api/Dashboard.js +1 -1
- package/lib/api/admin/Admin.js +1 -5
- package/lib/api/admin/Team.js +1 -5
- package/lib/api/admin/TeamUsers.js +1 -5
- package/lib/index.js +1 -5
- package/lib/network/endpoints.json +0 -6
- package/lib/pageproof.js +2 -2
- package/lib/worker-crypto-adapter.js +1 -1
- package/lib/{worker.35eb8871.js → worker.fe55ed12.js} +1 -1
- package/package.json +1 -1
- package/lib/api/DashboardGroups.js +0 -1
- package/lib/util/creationToken.js +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,18 +1,5 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
-
## 2.0.0-beta.47
|
|
4
|
-
|
|
5
|
-
Released on the 30th of July 2018.
|
|
6
|
-
|
|
7
|
-
- [[#92](https://github.com/PageProofCom/sdk/pull/92)] Support for loading active proof groups (known as "Collections"). See [DashboardGroups.current](https://docs.pageproof.tech/@pageproof/sdk/beta/class/src/api/DashboardGroups.js~DashboardGroups.html).
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
## 2.0.0-beta.46
|
|
11
|
-
|
|
12
|
-
Released on the 27th of July 2018.
|
|
13
|
-
|
|
14
|
-
- [[#94](https://github.com/PageProofCom/sdk/pull/94)] Support for creating comments and replies (`Comments.create`), parsing `@everyone` and `@all` mentions in comments, as well as some new options that can be used to help throttle how often callbacks are invoked (`onDecryptComments` and `onDecryptCommentsThrottleMs`) when decrypting comments, and catching decryption failures (`onDecryptError`). See [Comments.create](https://docs.pageproof.tech/@pageproof/sdk/beta/class/src/api/Comments.js~Comments.html#instance-method-create) and [Comments.load](https://docs.pageproof.tech/@pageproof/sdk/beta/class/src/api/Comments.js~Comments.html#instance-method-load).
|
|
15
|
-
|
|
16
3
|
## 2.0.0-beta.45
|
|
17
4
|
|
|
18
5
|
Released on the 5th of July 2018.
|
package/README.md
CHANGED
|
@@ -256,7 +256,6 @@ Name | Namespace | Description | Admin-only | Stability
|
|
|
256
256
|
[Accounts SSO API](./class/src/api/AccountsSSO.js~AccountsSSO.html) | `accounts.sso` | Used to login using a SSO provider. | No | Experimental
|
|
257
257
|
[Comments API](./class/src/api/Comments.js~Comments.html) | `comments` | Used to load comments. | No | Stable
|
|
258
258
|
[Dashboard API](./class/src/api/Dashboard.js~Dashboard.html) | `dashboard` | Used to load the authenticated user's dashboard & search for/filter proofs. | No | Stable
|
|
259
|
-
[Dashboard Groups API](./class/src/api/DashboardGroups.js~DashboardGroups.html) | `dashboard.groups` | Used to load proof groups | No | Experimental
|
|
260
259
|
[Files API](./class/src/api/Files.js~Files.html) | `files` | Used to upload & manage files. | No | Stable
|
|
261
260
|
[Profile API](./class/src/api/Profile.js~Profile.html) | `profile` | Manage your account details. | No | Experimental
|
|
262
261
|
[Proofs API](./class/src/api/Proofs.js~Proofs.html) | `proofs` | Used to create & manage proofs. | No | Stable
|
package/lib/api/Comments.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";exports.__esModule=true;var _API2=require("./API");var _API3=_interopRequireDefault(_API2);var _Comment=require("../models/Comment");var _Comment2=_interopRequireDefault(_Comment);var _CommentState=require("../enum/CommentState");var _CommentState2=_interopRequireDefault(_CommentState);var _constants=require("../util/constants");var _sort=require("../util/sort");var
|
|
1
|
+
"use strict";exports.__esModule=true;var _API2=require("./API");var _API3=_interopRequireDefault(_API2);var _Comment=require("../models/Comment");var _Comment2=_interopRequireDefault(_Comment);var _CommentState=require("../enum/CommentState");var _CommentState2=_interopRequireDefault(_CommentState);var _constants=require("../util/constants");var _sort=require("../util/sort");var _throttle=require("../util/throttle");var _throttle2=_interopRequireDefault(_throttle);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}function getCommentDataFromPages(pages){var comments=[];Object.keys(pages).forEach(function(pageNumber){pages[pageNumber].Comments.forEach(function(commentData){comments.push(commentData)})});return comments}var _sortPages=(0,_sort.sortObjectsByKey)("pageNumber");var _sortCreatedDateDESC=(0,_sort.sortObjectsByKey)("createdDate",true);var _sortCreatedDateASC=(0,_sort.sortObjectsByKey)("createdDate",false);var sortComments=(0,_sort.combineSort)(_sortPages,_sortCreatedDateDESC);var sortReplies=(0,_sort.combineSort)(_sortPages,_sortCreatedDateASC);function mapComments(commentsData){var comments=[];var replies=[];commentsData.forEach(function(commentData){var entity=(new _Comment2.default).fromComment(commentData);if(entity.parentCommentId){replies.push(entity)}else{comments.push(entity)}});comments.sort(sortComments);var commentIds=comments.map(function(c){return c.id});var sortByParentCommentIndex=(0,_sort.sortObjectsBy)(function(r){return commentIds.indexOf(r.parentCommentId)},true);replies.sort((0,_sort.combineSort)(sortReplies,sortByParentCommentIndex));return comments.concat(replies)}var Comments=function(_API){_inherits(Comments,_API);function Comments(){_classCallCheck(this,Comments);return _possibleConstructorReturn(this,_API.apply(this,arguments))}Comments.prototype._mark=function _mark(commentId,state,value){var _data;var field=void 0;switch(state){case _CommentState2.default.TODO:{field="change";break}case _CommentState2.default.DONE:{field="done";break}default:{throw new Error('Cannot mark comment state "'+state+'".')}}var data=(_data={commentId:commentId},_data[field]=value?1:0,_data);return this.client.request("comments.state.update",data).then(function(){return null})};Comments.prototype.mark=function mark(commentId,state){return this._mark(commentId,state,true)};Comments.prototype.unmark=function unmark(commentId,state){return this._mark(commentId,state,false)};Comments.prototype.load=function load(_options){var _this2=this;var options=typeof _options==="string"?{proofId:_options}:_options;var proofId=options.proofId,_options$pageNumber=options.pageNumber,pageNumber=_options$pageNumber===undefined?null:_options$pageNumber,_options$sinceDate=options.sinceDate,sinceDate=_options$sinceDate===undefined?null:_options$sinceDate,_options$async=options.async,async=_options$async===undefined?false:_options$async,_options$decrypt=options.decrypt,decrypt=_options$decrypt===undefined?true:_options$decrypt,onDecryptComment=options.onDecryptComment,onDecryptComments=options.onDecryptComments,_options$onDecryptCom=options.onDecryptCommentsThrottleMs,onDecryptCommentsThrottleMs=_options$onDecryptCom===undefined?1e3:_options$onDecryptCom,onDecryptError=options.onDecryptError;var sinceDateISO=sinceDate?sinceDate.toISOString().match(_constants.ISO_REGEX)[0]:_constants.DEFAULT_ISO_DATE;var payload={proofId:proofId,page:pageNumber,timestamp:sinceDateISO};return this.client.request(pageNumber!==null?"comments.load-page":"comments.load-all",payload).then(function(response){var comments=mapComments(response.data.Pages?getCommentDataFromPages(response.data.Pages):response.data);var wait=Promise.resolve();if(decrypt){var scheduled=[];var pendingBatch=[];var scheduleOnDecryptComments=onDecryptComments?(0,_throttle2.default)(function(){if(pendingBatch.length){onDecryptComments(pendingBatch);pendingBatch=[]}},onDecryptCommentsThrottleMs):function(){};var cached=Promise.all(comments.map(function(comment){return _this2.client.cache.auto(_constants.COMMENT_CACHE_PREFIX+comment.comment$,function(resolve){scheduled.push({comment:comment,resolve:resolve})}).then(function(rawComment){if(rawComment){comment.fromRawComment(rawComment)}return comment})}));wait=wait.then(function(){return cached});wait=wait.then(function(){var decrypted=scheduled.map(function(_ref){var comment=_ref.comment,resolve=_ref.resolve;return _this2.client.crypto().decryptComment(comment.comment$,comment.envelope,_this2.client.session.privateKeyPEM).then(function(rawComment){comment.fromRawComment(rawComment);resolve(rawComment);if(onDecryptComment){onDecryptComment(comment)}pendingBatch.push(comment);scheduleOnDecryptComments()}).catch(function(err){if(onDecryptError){onDecryptError(err,comment)}if(!async){return Promise.reject(err)}return undefined})});if(!async){return Promise.all(decrypted)}return null})}return wait.then(function(){return comments})})};Comments.prototype.create=function create(_ref2){var _this3=this;var raw=_ref2.raw,proofId=_ref2.proofId,pageNumber=_ref2.pageNumber,pin=_ref2.pin,mediaTime=_ref2.mediaTime,mediaDuration=_ref2.mediaDuration,parentCommentId=_ref2.parentCommentId,metadata=_ref2.metadata,state=_ref2.state;return this.client.crypto().encryptComment(raw,[this.client.session.serverPublicKeyPEM,this.client.session.publicKeyPEM]).then(function(_ref3){var envelope=_ref3.envelope,comment$=_ref3.comment$;return{proofId:proofId,page:pageNumber,envelope:envelope,encryptedComment:comment$,xy:JSON.stringify({x:pin.x,y:pin.y,x2:pin.x2,y2:pin.y2,time:mediaTime,duration:mediaDuration}),parent:parentCommentId,mentions:"",metadata:metadata?JSON.stringify(metadata):"{}",change:state===_CommentState2.default.TODO?"1":undefined,done:state===_CommentState2.default.DONE?"1":undefined}}).then(function(requestData){return _this3.client.request("comments.create",requestData).then(function(response){return(new _Comment2.default).fromComment(response.data).fromRawComment(raw)})})};return Comments}(_API3.default);exports.default=Comments;
|
package/lib/api/Dashboard.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";exports.__esModule=true;var _API2=require("./API");var _API3=_interopRequireDefault(_API2);var _Proof=require("../models/Proof");var _Proof2=_interopRequireDefault(_Proof);
|
|
1
|
+
"use strict";exports.__esModule=true;var _API2=require("./API");var _API3=_interopRequireDefault(_API2);var _Proof=require("../models/Proof");var _Proof2=_interopRequireDefault(_Proof);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}var TABS={inbox:"ProofIn",sent:"ProofOut",outbox:"ProofOutBox"};function transformTabs(data){var tabs={};Object.keys(TABS).forEach(function(name){tabs[name]=data[TABS[name]]});return tabs}function transformProofs(proofs){return(proofs||[]).map(function(proofData){return(new _Proof2.default).fromProof(proofData)})}var Dashboard=function(_API){_inherits(Dashboard,_API);function Dashboard(){_classCallCheck(this,Dashboard);return _possibleConstructorReturn(this,_API.apply(this,arguments))}Dashboard.prototype.inbox=function inbox(){return this._loadSingleTabProofs("inbox")};Dashboard.prototype.sent=function sent(){return this._loadSingleTabProofs("sent")};Dashboard.prototype.outbox=function outbox(){return this._loadSingleTabProofs("outbox")};Dashboard.prototype._loadSingleTabProofs=function _loadSingleTabProofs(name){return this.client.request("dashboard."+name).then(function(response){return transformTabs(response.data)}).then(function(dashboard){return dashboard[name]}).then(transformProofs)};Dashboard.prototype.search=function search(query){return this._loadSearchProofs({query:query})};Dashboard.prototype.everything=function everything(){return this._loadSearchProofs({all:1})};Dashboard.prototype.approved=function approved(){return this._loadSearchProofs({filterBy:70})};Dashboard.prototype.archived=function archived(){return this._loadSearchProofs({filterBy:100})};Dashboard.prototype._loadSearchProofs=function _loadSearchProofs(params){return this.client.request("dashboard.search",params).then(function(response){return transformProofs(response.data.Proofs)})};return Dashboard}(_API3.default);exports.default=Dashboard;
|
package/lib/api/admin/Admin.js
CHANGED
|
@@ -16,11 +16,7 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
|
|
|
16
16
|
|
|
17
17
|
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; }
|
|
18
18
|
|
|
19
|
-
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; }
|
|
20
|
-
* Unauthorized copying of this file, via any medium is strictly prohibited.
|
|
21
|
-
* Proprietary and confidential.
|
|
22
|
-
*/
|
|
23
|
-
|
|
19
|
+
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; }
|
|
24
20
|
|
|
25
21
|
var Admin = function (_API) {
|
|
26
22
|
_inherits(Admin, _API);
|
package/lib/api/admin/Team.js
CHANGED
|
@@ -16,11 +16,7 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
|
|
|
16
16
|
|
|
17
17
|
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; }
|
|
18
18
|
|
|
19
|
-
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; }
|
|
20
|
-
* Unauthorized copying of this file, via any medium is strictly prohibited.
|
|
21
|
-
* Proprietary and confidential.
|
|
22
|
-
*/
|
|
23
|
-
|
|
19
|
+
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; }
|
|
24
20
|
|
|
25
21
|
var Team = function (_API) {
|
|
26
22
|
_inherits(Team, _API);
|
|
@@ -16,11 +16,7 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
|
|
|
16
16
|
|
|
17
17
|
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; }
|
|
18
18
|
|
|
19
|
-
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; }
|
|
20
|
-
* Unauthorized copying of this file, via any medium is strictly prohibited.
|
|
21
|
-
* Proprietary and confidential.
|
|
22
|
-
*/
|
|
23
|
-
|
|
19
|
+
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; }
|
|
24
20
|
|
|
25
21
|
/** @private */
|
|
26
22
|
function transformResponseUsers(response) {
|
package/lib/index.js
CHANGED
|
@@ -27,11 +27,7 @@ function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj;
|
|
|
27
27
|
|
|
28
28
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
29
29
|
|
|
30
|
-
exports.default = _PageProof2.default;
|
|
31
|
-
* Unauthorized copying of this file, via any medium is strictly prohibited.
|
|
32
|
-
* Proprietary and confidential.
|
|
33
|
-
*/
|
|
34
|
-
|
|
30
|
+
exports.default = _PageProof2.default;
|
|
35
31
|
exports.Client = _PageProof2.default;
|
|
36
32
|
exports.Bluffer = _bluffer2.default;
|
|
37
33
|
exports.Enum = Enum;
|
|
@@ -58,12 +58,6 @@
|
|
|
58
58
|
"path": "/api/proofs/search",
|
|
59
59
|
"body": ["query", "all", "filterBy"]
|
|
60
60
|
},
|
|
61
|
-
"dashboard.groups.filter-by": {
|
|
62
|
-
"method": "GET",
|
|
63
|
-
"path": "/api/proofs/dashboard/groups",
|
|
64
|
-
"chain": ["filterBy"],
|
|
65
|
-
"trailing": true
|
|
66
|
-
},
|
|
67
61
|
"users.by-id": {
|
|
68
62
|
"method": "GET",
|
|
69
63
|
"path": "/api/users",
|