@pageproof/sdk-pr 212.0.1571269325944 → 212.0.1571620840080
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 +12 -0
- package/lib/api/Proofs.js +1 -1
- package/lib/api/Reminders.js +1 -1
- package/lib/api/Teams.js +1 -0
- package/lib/api/TeamsInvitations.js +1 -0
- package/lib/api/admin/Team.js +0 -29
- package/lib/api/admin/TeamUsers.js +2 -81
- package/lib/core/PageProof.js +1 -1
- package/lib/models/TeamInvitation.js +1 -0
- package/lib/network/endpoints.json +21 -14
- package/lib/pageproof.js +1 -1
- package/lib/util/Scheduler.js +1 -1
- package/lib/worker-crypto-adapter.js +1 -1
- package/package.json +1 -1
- package/lib/models/Teams.js +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 2.0.0-beta.103
|
|
4
|
+
|
|
5
|
+
Released on the 18th of October 2019.
|
|
6
|
+
|
|
7
|
+
- [[#209](https://github.com/PageProofCom/sdk/pull/209)] Support for creating and deleting multiple reminders, as well as creating reminders when creating a proof.
|
|
8
|
+
|
|
9
|
+
## 2.0.0-beta.102
|
|
10
|
+
|
|
11
|
+
Released on the 17th of October 2019.
|
|
12
|
+
|
|
13
|
+
- Fixes Node.js 8.x support.
|
|
14
|
+
|
|
3
15
|
## 2.0.0-beta.101
|
|
4
16
|
|
|
5
17
|
Released on the 17th of October 2019.
|
package/lib/api/Proofs.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";exports.__esModule=true;var _API2=require("./API");var _API3=_interopRequireDefault(_API2);var _ProofsOwners=require("./ProofsOwners");var _ProofsOwners2=_interopRequireDefault(_ProofsOwners);var _ProofsEditors=require("./ProofsEditors");var _ProofsEditors2=_interopRequireDefault(_ProofsEditors);var _ProofsReviewers=require("./ProofsReviewers");var _ProofsReviewers2=_interopRequireDefault(_ProofsReviewers);var _ProofsVersions=require("./ProofsVersions");var _ProofsVersions2=_interopRequireDefault(_ProofsVersions);var _ProofsGroups=require("./ProofsGroups");var _ProofsGroups2=_interopRequireDefault(_ProofsGroups);var _ProofsAudit=require("./ProofsAudit");var _ProofsAudit2=_interopRequireDefault(_ProofsAudit);var _Proof=require("../models/Proof");var _Proof2=_interopRequireDefault(_Proof);var _Reminders=require("./Reminders");var _Reminders2=_interopRequireDefault(_Reminders);var _FileStatus=require("../enum/FileStatus");var _FileStatus2=_interopRequireDefault(_FileStatus);var _constants=require("../util/constants");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 Proofs=function(_API){_inherits(Proofs,_API);function Proofs(client){_classCallCheck(this,Proofs);var _this=_possibleConstructorReturn(this,_API.call(this,client));_this.owners=new _ProofsOwners2.default(client);_this.editors=new _ProofsEditors2.default(client);_this.reviewers=new _ProofsReviewers2.default(client);_this.versions=new _ProofsVersions2.default(client);_this.groups=new _ProofsGroups2.default(client);_this.reminders=new _Reminders2.default(client);_this.audit=new _ProofsAudit2.default(client);return _this}Proofs.prototype.setWorkflow=function setWorkflow(proofId,workflowId){var _this2=this;return this.client.request("proofs.normalize-workflow",{proofId:proofId,workflowId:workflowId}).then(function(){return _this2.client.request("proofs.set-workflow",{proofId:proofId,workflowId:workflowId})})};Proofs.prototype.setTags=function setTags(proofId,tags){return this.client.request("proofs.set-tags",{relatedId:proofId,tag:tags.join(",")})};Proofs.prototype.deleteTag=function deleteTag(proofId,tag){return this.client.request("proofs.tag-delete",{relatedId:proofId,tag:tag})};Proofs.prototype.setFile=function setFile(proofId,fileId){var _this3=this;return this.client.request("proofs.set-file",{proofId:proofId,fileId:fileId}).then(function(){return _this3.client.request("proofs.distribute-file",{proofId:proofId})})};Proofs.prototype.create=function create(_ref){var _this4=this;var name=_ref.name,_ref$tags=_ref.tags,tags=_ref$tags===undefined?[]:_ref$tags,_ref$dueDate=_ref.dueDate,dueDate=_ref$dueDate===undefined?new Date(Date.now()+3*_constants.DAY_IN_MS):_ref$dueDate,messageToReviewers=_ref.messageToReviewers,workflow=_ref.workflow,file=_ref.file,group=_ref.group,reference=_ref.reference,_ref$start=_ref.start,start=_ref$start===undefined?true:_ref$start;var shouldStart=start&&!group;return this.client.request("proofs.create",{title:name,dueDate:dueDate.toISOString(),description:messageToReviewers,groupId:group?group.id:undefined,reference:reference}).then(function(response){var proof=(new _Proof2.default).fromProof(response.data);return Promise.all([proof,tags.length&&_this4.setTags(proof.id,tags),workflow&&_this4.setWorkflow(proof.id,workflow.id),file&&_this4.setFile(proof.id,file.id)])}).then(function(_ref2){var proof=_ref2[0];return Promise.resolve(shouldStart&&_this4.start(proof.id)).then(function(){return proof})}).then(function(proof){if(workflow){proof.workflowId=workflow.id}if(file){proof.fileId=file.id;proof.fileStatus=_FileStatus2.default.UPLOADING}proof.calculateState();return proof})};Proofs.prototype.archive=function archive(proofIdOrIds){return this.client.request("proofs.archive",{proofIds:proofIdOrIds})};Proofs.prototype.unarchive=function unarchive(proofId){return this.client.request("proofs.unarchive",{proofId:proofId})};Proofs.prototype.delete=function _delete(proofId){return this.client.request("proofs.delete",{proofId:proofId})};Proofs.prototype.finish=function finish(proofId,decision){return this.client.request("proofs.finish",{proofId:proofId,decision:decision})};Proofs.prototype.approve=function approve(proofId,message){return this.client.request("proofs.manual-approval",{proofId:proofId,message:message})};Proofs.prototype.withdrawApproval=function withdrawApproval(proofId,messageToSender){return this.client.request("proofs.withdraw-approval",{proofId:proofId,messageToSender:messageToSender})};Proofs.prototype.return=function _return(proofId){return this.client.request("proofs.return",{proofId:proofId})};Proofs.prototype.start=function start(proofId){return this.client.request("proofs.start",{proofId:proofId})};Proofs.prototype.removeEditor=function removeEditor(id){return this.client.request("proofs.remove-editor",{proofId:id})};Proofs.prototype.load=function load(proofId){return this.client.request("proofs.load",{proofId:proofId}).then(function(response){return(new _Proof2.default).fromProof(response.data)})};Proofs.prototype.lock=function lock(proofId){return this.client.request("proofs.lock",{proofId:proofId})};Proofs.prototype.unlock=function unlock(proofId){return this.client.request("proofs.unlock",{proofId:proofId})};Proofs.prototype.requestUnlock=function requestUnlock(proofId){return this.client.request("proofs.request-unlock",{proofId:proofId})};Proofs.prototype.requestAccess=function requestAccess(proofId){return this.client.request("proofs.request-access",{proofId:proofId})};Proofs.prototype.images=function images(proofId){return this.client.request("proofs.images",{proofId:proofId}).then(function(response){return response.data.proof.file})};Proofs.prototype.setMessageToReviewers=function setMessageToReviewers(proofId,messageToReviewers){return this.client.request("proofs.set-reviewers-message",{proofId:proofId,messageToReviewers:messageToReviewers})};return Proofs}(_API3.default);exports.default=Proofs;
|
|
1
|
+
"use strict";exports.__esModule=true;var _API2=require("./API");var _API3=_interopRequireDefault(_API2);var _ProofsOwners=require("./ProofsOwners");var _ProofsOwners2=_interopRequireDefault(_ProofsOwners);var _ProofsEditors=require("./ProofsEditors");var _ProofsEditors2=_interopRequireDefault(_ProofsEditors);var _ProofsReviewers=require("./ProofsReviewers");var _ProofsReviewers2=_interopRequireDefault(_ProofsReviewers);var _ProofsVersions=require("./ProofsVersions");var _ProofsVersions2=_interopRequireDefault(_ProofsVersions);var _ProofsGroups=require("./ProofsGroups");var _ProofsGroups2=_interopRequireDefault(_ProofsGroups);var _ProofsAudit=require("./ProofsAudit");var _ProofsAudit2=_interopRequireDefault(_ProofsAudit);var _Proof=require("../models/Proof");var _Proof2=_interopRequireDefault(_Proof);var _Reminders=require("./Reminders");var _Reminders2=_interopRequireDefault(_Reminders);var _FileStatus=require("../enum/FileStatus");var _FileStatus2=_interopRequireDefault(_FileStatus);var _constants=require("../util/constants");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 Proofs=function(_API){_inherits(Proofs,_API);function Proofs(client){_classCallCheck(this,Proofs);var _this=_possibleConstructorReturn(this,_API.call(this,client));_this.owners=new _ProofsOwners2.default(client);_this.editors=new _ProofsEditors2.default(client);_this.reviewers=new _ProofsReviewers2.default(client);_this.versions=new _ProofsVersions2.default(client);_this.groups=new _ProofsGroups2.default(client);_this.reminders=new _Reminders2.default(client);_this.audit=new _ProofsAudit2.default(client);return _this}Proofs.prototype.setWorkflow=function setWorkflow(proofId,workflowId){var _this2=this;return this.client.request("proofs.normalize-workflow",{proofId:proofId,workflowId:workflowId}).then(function(){return _this2.client.request("proofs.set-workflow",{proofId:proofId,workflowId:workflowId})})};Proofs.prototype.setTags=function setTags(proofId,tags){return this.client.request("proofs.set-tags",{relatedId:proofId,tag:tags.join(",")})};Proofs.prototype.deleteTag=function deleteTag(proofId,tag){return this.client.request("proofs.tag-delete",{relatedId:proofId,tag:tag})};Proofs.prototype.setFile=function setFile(proofId,fileId){var _this3=this;return this.client.request("proofs.set-file",{proofId:proofId,fileId:fileId}).then(function(){return _this3.client.request("proofs.distribute-file",{proofId:proofId})})};Proofs.prototype.create=function create(_ref){var _this4=this;var name=_ref.name,_ref$tags=_ref.tags,tags=_ref$tags===undefined?[]:_ref$tags,_ref$dueDate=_ref.dueDate,dueDate=_ref$dueDate===undefined?new Date(Date.now()+3*_constants.DAY_IN_MS):_ref$dueDate,messageToReviewers=_ref.messageToReviewers,workflow=_ref.workflow,file=_ref.file,group=_ref.group,reference=_ref.reference,reminders=_ref.reminders,_ref$start=_ref.start,start=_ref$start===undefined?true:_ref$start;var shouldStart=start&&!group;return this.client.request("proofs.create",{title:name,dueDate:dueDate.toISOString(),description:messageToReviewers,groupId:group?group.id:undefined,reference:reference,reminders:[].concat(reminders)}).then(function(response){var proof=(new _Proof2.default).fromProof(response.data);return Promise.all([proof,tags.length&&_this4.setTags(proof.id,tags),workflow&&_this4.setWorkflow(proof.id,workflow.id),file&&_this4.setFile(proof.id,file.id)])}).then(function(_ref2){var proof=_ref2[0];return Promise.resolve(shouldStart&&_this4.start(proof.id)).then(function(){return proof})}).then(function(proof){if(workflow){proof.workflowId=workflow.id}if(file){proof.fileId=file.id;proof.fileStatus=_FileStatus2.default.UPLOADING}proof.calculateState();return proof})};Proofs.prototype.archive=function archive(proofIdOrIds){return this.client.request("proofs.archive",{proofIds:proofIdOrIds})};Proofs.prototype.unarchive=function unarchive(proofId){return this.client.request("proofs.unarchive",{proofId:proofId})};Proofs.prototype.delete=function _delete(proofId){return this.client.request("proofs.delete",{proofId:proofId})};Proofs.prototype.finish=function finish(proofId,decision){return this.client.request("proofs.finish",{proofId:proofId,decision:decision})};Proofs.prototype.approve=function approve(proofId,message){return this.client.request("proofs.manual-approval",{proofId:proofId,message:message})};Proofs.prototype.withdrawApproval=function withdrawApproval(proofId,messageToSender){return this.client.request("proofs.withdraw-approval",{proofId:proofId,messageToSender:messageToSender})};Proofs.prototype.return=function _return(proofId){return this.client.request("proofs.return",{proofId:proofId})};Proofs.prototype.start=function start(proofId){return this.client.request("proofs.start",{proofId:proofId})};Proofs.prototype.removeEditor=function removeEditor(id){return this.client.request("proofs.remove-editor",{proofId:id})};Proofs.prototype.load=function load(proofId){return this.client.request("proofs.load",{proofId:proofId}).then(function(response){return(new _Proof2.default).fromProof(response.data)})};Proofs.prototype.lock=function lock(proofId){return this.client.request("proofs.lock",{proofId:proofId})};Proofs.prototype.unlock=function unlock(proofId){return this.client.request("proofs.unlock",{proofId:proofId})};Proofs.prototype.requestUnlock=function requestUnlock(proofId){return this.client.request("proofs.request-unlock",{proofId:proofId})};Proofs.prototype.requestAccess=function requestAccess(proofId){return this.client.request("proofs.request-access",{proofId:proofId})};Proofs.prototype.images=function images(proofId){return this.client.request("proofs.images",{proofId:proofId}).then(function(response){return response.data.proof.file})};Proofs.prototype.setMessageToReviewers=function setMessageToReviewers(proofId,messageToReviewers){return this.client.request("proofs.set-reviewers-message",{proofId:proofId,messageToReviewers:messageToReviewers})};return Proofs}(_API3.default);exports.default=Proofs;
|
package/lib/api/Reminders.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";exports.__esModule=true;var _API2=require("../api/API");var _API3=_interopRequireDefault(_API2);var _Reminder=require("../models/Reminder");var _Reminder2=_interopRequireDefault(_Reminder);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 mapReminders(reminders){return reminders.map(function(reminderData){return(new _Reminder2.default).fromReminder(reminderData)})}var Reminders=function(_API){_inherits(Reminders,_API);function Reminders(){_classCallCheck(this,Reminders);return _possibleConstructorReturn(this,_API.apply(this,arguments))}Reminders.prototype.add=function add(id,reminder){return this.client.request("reminders.add",{entityId:id,reminders:[{action:reminder.action,relativeTo:reminder.relativeTo,relativeDate:reminder.relativeDate,absoluteDate:reminder.absoluteDate}]}).then(function(response){var reminders=mapReminders(response.data);return reminders})};Reminders.prototype.update=function update(id,data){return this.client.request("reminders.update",{reminderId:id,relativeDate:data})};Reminders.prototype.delete=function _delete(
|
|
1
|
+
"use strict";exports.__esModule=true;var _API2=require("../api/API");var _API3=_interopRequireDefault(_API2);var _Reminder=require("../models/Reminder");var _Reminder2=_interopRequireDefault(_Reminder);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 mapReminders(reminders){return reminders.map(function(reminderData){return(new _Reminder2.default).fromReminder(reminderData)})}var Reminders=function(_API){_inherits(Reminders,_API);function Reminders(){_classCallCheck(this,Reminders);return _possibleConstructorReturn(this,_API.apply(this,arguments))}Reminders.prototype.add=function add(id,reminder){return this.client.request("reminders.add",{entityId:id,reminders:[{action:reminder.action,relativeTo:reminder.relativeTo,relativeDate:reminder.relativeDate,absoluteDate:reminder.absoluteDate}]}).then(function(response){var reminders=mapReminders(response.data);return reminders})};Reminders.prototype.update=function update(id,data){return this.client.request("reminders.update",{reminderId:id,relativeDate:data})};Reminders.prototype.delete=function _delete(idOrIds){return this.client.request("reminders.delete",{reminderIds:[].concat(idOrIds)})};Reminders.prototype.all=function all(id){return this.client.request("reminders.all",{entityId:id}).then(function(response){return mapReminders(response.data)})};return Reminders}(_API3.default);exports.default=Reminders;
|
package/lib/api/Teams.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";exports.__esModule=true;var _API2=require("./API");var _API3=_interopRequireDefault(_API2);var _TeamsInvitations=require("./TeamsInvitations");var _TeamsInvitations2=_interopRequireDefault(_TeamsInvitations);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 Teams=function(_API){_inherits(Teams,_API);function Teams(client){_classCallCheck(this,Teams);var _this=_possibleConstructorReturn(this,_API.call(this,client));_this.invitations=new _TeamsInvitations2.default(client);return _this}return Teams}(_API3.default);exports.default=Teams;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";exports.__esModule=true;var _API2=require("./API");var _API3=_interopRequireDefault(_API2);var _TeamInvitation=require("../models/TeamInvitation");var _TeamInvitation2=_interopRequireDefault(_TeamInvitation);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 TeamsInvitations=function(_API){_inherits(TeamsInvitations,_API);function TeamsInvitations(){_classCallCheck(this,TeamsInvitations);return _possibleConstructorReturn(this,_API.apply(this,arguments))}TeamsInvitations.prototype.info=function info(invitationId){return this.client.request("teams.invitations.info",{invitationId:invitationId}).then(function(response){return(new _TeamInvitation2.default).fromTeamInvitation(response.data)})};TeamsInvitations.prototype.accept=function accept(invitationId){return this.client.request("teams.invitations.accept",{invitationId:invitationId}).then(function(){return null})};TeamsInvitations.prototype.decline=function decline(invitationId){return this.client.request("teams.invitations.decline",{invitationId:invitationId}).then(function(){return null})};return TeamsInvitations}(_API3.default);exports.default=TeamsInvitations;
|
package/lib/api/admin/Team.js
CHANGED
|
@@ -22,10 +22,6 @@ var _TeamCustomWebhooks = require('./TeamCustomWebhooks');
|
|
|
22
22
|
|
|
23
23
|
var _TeamCustomWebhooks2 = _interopRequireDefault(_TeamCustomWebhooks);
|
|
24
24
|
|
|
25
|
-
var _Teams = require('../../models/Teams');
|
|
26
|
-
|
|
27
|
-
var _Teams2 = _interopRequireDefault(_Teams);
|
|
28
|
-
|
|
29
25
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
30
26
|
|
|
31
27
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
@@ -68,19 +64,6 @@ var Team = function (_API) {
|
|
|
68
64
|
return _this;
|
|
69
65
|
}
|
|
70
66
|
|
|
71
|
-
/**
|
|
72
|
-
* Loads the team data for anonymous user, who have got invitation to join a team.
|
|
73
|
-
*
|
|
74
|
-
* @example <caption>Load team data by anonymous user</caption>
|
|
75
|
-
* const teams = await client.team.load('<token>', 'inviteduser@mail.com')
|
|
76
|
-
*
|
|
77
|
-
* @since v2.0.0-beta.101
|
|
78
|
-
* @param {string} token The token send in inviting email
|
|
79
|
-
* @param {string} email The user email who got invitation
|
|
80
|
-
* @returns {Promise}
|
|
81
|
-
*/
|
|
82
|
-
|
|
83
|
-
|
|
84
67
|
/**
|
|
85
68
|
* The Admin Custom Webhooks API.
|
|
86
69
|
*
|
|
@@ -95,18 +78,6 @@ var Team = function (_API) {
|
|
|
95
78
|
*/
|
|
96
79
|
|
|
97
80
|
|
|
98
|
-
Team.prototype.load = function load(token, email) {
|
|
99
|
-
return this.client.request('team.info.load', {
|
|
100
|
-
token: token,
|
|
101
|
-
email: email
|
|
102
|
-
}).then(function (response) {
|
|
103
|
-
if (response.data) {
|
|
104
|
-
return new _Teams2.default().fromTeams(response.data);
|
|
105
|
-
}
|
|
106
|
-
return null;
|
|
107
|
-
});
|
|
108
|
-
};
|
|
109
|
-
|
|
110
81
|
return Team;
|
|
111
82
|
}(_API3.default);
|
|
112
83
|
|
|
@@ -10,10 +10,6 @@ var _User = require('../../models/User');
|
|
|
10
10
|
|
|
11
11
|
var _User2 = _interopRequireDefault(_User);
|
|
12
12
|
|
|
13
|
-
var _Accounts = require('../Accounts');
|
|
14
|
-
|
|
15
|
-
var _Accounts2 = _interopRequireDefault(_Accounts);
|
|
16
|
-
|
|
17
13
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
18
14
|
|
|
19
15
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
@@ -36,14 +32,10 @@ function transformResponseUsers(response) {
|
|
|
36
32
|
var TeamUsers = function (_API) {
|
|
37
33
|
_inherits(TeamUsers, _API);
|
|
38
34
|
|
|
39
|
-
|
|
40
|
-
function TeamUsers(client) {
|
|
35
|
+
function TeamUsers() {
|
|
41
36
|
_classCallCheck(this, TeamUsers);
|
|
42
37
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
_this.accounts = new _Accounts2.default(client);
|
|
46
|
-
return _this;
|
|
38
|
+
return _possibleConstructorReturn(this, _API.apply(this, arguments));
|
|
47
39
|
}
|
|
48
40
|
|
|
49
41
|
/**
|
|
@@ -52,14 +44,6 @@ var TeamUsers = function (_API) {
|
|
|
52
44
|
* @since v2.0.0-beta.13
|
|
53
45
|
* @returns {Promise<User>}
|
|
54
46
|
*/
|
|
55
|
-
|
|
56
|
-
/**
|
|
57
|
-
* The accounts API
|
|
58
|
-
*
|
|
59
|
-
* @type {Accounts}
|
|
60
|
-
*/
|
|
61
|
-
|
|
62
|
-
|
|
63
47
|
TeamUsers.prototype.enabled = function enabled() {
|
|
64
48
|
return this.client.request('admin.team.users.enabled').then(transformResponseUsers);
|
|
65
49
|
};
|
|
@@ -136,69 +120,6 @@ var TeamUsers = function (_API) {
|
|
|
136
120
|
});
|
|
137
121
|
};
|
|
138
122
|
|
|
139
|
-
/**
|
|
140
|
-
* Add a new user to the team, once user is agree to be in a team.
|
|
141
|
-
*
|
|
142
|
-
* @example <caption>Adding a user in to team</caption>
|
|
143
|
-
* await team.users.acceptInvite('useremail@domain.com', {
|
|
144
|
-
* authCode: 'fghFFT',
|
|
145
|
-
* token: 'jhgfsdgu6787368huju75765766t75kh877',
|
|
146
|
-
* password: '<password>'
|
|
147
|
-
* });
|
|
148
|
-
*
|
|
149
|
-
* @since v2.0.0-beta.101
|
|
150
|
-
* @param {string} email The user email address to be joined into a team
|
|
151
|
-
* @param {object} options The options
|
|
152
|
-
* @param {string} authCode The authentication code for new user (can be find from invitation email, if new user)
|
|
153
|
-
* @param {string} token The token string for team (also can be find from invitation email)
|
|
154
|
-
* @param {string} password Users password if a new user
|
|
155
|
-
* @returns {Promise}
|
|
156
|
-
*/
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
TeamUsers.prototype.acceptInvite = function acceptInvite(email, _ref) {
|
|
160
|
-
var _this2 = this;
|
|
161
|
-
|
|
162
|
-
var authCode = _ref.authCode,
|
|
163
|
-
token = _ref.token,
|
|
164
|
-
password = _ref.password,
|
|
165
|
-
_ref$isTemp = _ref.isTemp,
|
|
166
|
-
isTemp = _ref$isTemp === undefined ? false : _ref$isTemp;
|
|
167
|
-
|
|
168
|
-
if (password) {
|
|
169
|
-
return this.accounts._generateCredentials(password).then(function (_ref2) {
|
|
170
|
-
var passwordHash = _ref2[0],
|
|
171
|
-
keyPair = _ref2[1],
|
|
172
|
-
privateKeyPEM$ = _ref2[2];
|
|
173
|
-
return Promise.all([keyPair, _this2.client.request('team.users.invite.accept', {
|
|
174
|
-
email: email,
|
|
175
|
-
authCode: authCode,
|
|
176
|
-
token: token,
|
|
177
|
-
password: passwordHash,
|
|
178
|
-
privateKey: privateKeyPEM$,
|
|
179
|
-
publicKey: keyPair.publicKeyPEM,
|
|
180
|
-
isTemp: isTemp
|
|
181
|
-
})]);
|
|
182
|
-
}).then(function (_ref3) {
|
|
183
|
-
var keyPair = _ref3[0];
|
|
184
|
-
return Promise.all([keyPair, _this2.accounts.login(email, password, false)]);
|
|
185
|
-
}).then(function (_ref4) {
|
|
186
|
-
var keyPair = _ref4[0],
|
|
187
|
-
session = _ref4[1];
|
|
188
|
-
|
|
189
|
-
session.privateKeyPEM = keyPair.privateKeyPEM;
|
|
190
|
-
return session;
|
|
191
|
-
});
|
|
192
|
-
} else {
|
|
193
|
-
return this.client.request('team.users.invite.accept', {
|
|
194
|
-
email: email,
|
|
195
|
-
authCode: authCode,
|
|
196
|
-
token: token,
|
|
197
|
-
isTemp: isTemp
|
|
198
|
-
});
|
|
199
|
-
}
|
|
200
|
-
};
|
|
201
|
-
|
|
202
123
|
return TeamUsers;
|
|
203
124
|
}(_API3.default);
|
|
204
125
|
|
package/lib/core/PageProof.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";exports.__esModule=true;var _AdapterRepository=require("./AdapterRepository");var _AdapterRepository2=_interopRequireDefault(_AdapterRepository);var _Cache=require("./Cache");var _Cache2=_interopRequireDefault(_Cache);var _Request=require("../network/Request");var _Request2=_interopRequireDefault(_Request);var _Response=require("../network/Response");var _Response2=_interopRequireDefault(_Response);var _Accounts=require("../api/Accounts");var _Accounts2=_interopRequireDefault(_Accounts);var _Dashboard=require("../api/Dashboard");var _Dashboard2=_interopRequireDefault(_Dashboard);var _Users=require("../api/Users");var _Users2=_interopRequireDefault(_Users);var _Proofs=require("../api/Proofs");var _Proofs2=_interopRequireDefault(_Proofs);var _Briefs=require("../api/Briefs");var _Briefs2=_interopRequireDefault(_Briefs);var _Files=require("../api/Files");var _Files2=_interopRequireDefault(_Files);var _Admin=require("../api/admin/Admin");var _Admin2=_interopRequireDefault(_Admin);var
|
|
1
|
+
"use strict";exports.__esModule=true;var _AdapterRepository=require("./AdapterRepository");var _AdapterRepository2=_interopRequireDefault(_AdapterRepository);var _Cache=require("./Cache");var _Cache2=_interopRequireDefault(_Cache);var _Request=require("../network/Request");var _Request2=_interopRequireDefault(_Request);var _Response=require("../network/Response");var _Response2=_interopRequireDefault(_Response);var _Accounts=require("../api/Accounts");var _Accounts2=_interopRequireDefault(_Accounts);var _Dashboard=require("../api/Dashboard");var _Dashboard2=_interopRequireDefault(_Dashboard);var _Users=require("../api/Users");var _Users2=_interopRequireDefault(_Users);var _Proofs=require("../api/Proofs");var _Proofs2=_interopRequireDefault(_Proofs);var _Briefs=require("../api/Briefs");var _Briefs2=_interopRequireDefault(_Briefs);var _Files=require("../api/Files");var _Files2=_interopRequireDefault(_Files);var _Admin=require("../api/admin/Admin");var _Admin2=_interopRequireDefault(_Admin);var _Workflows=require("../api/Workflows");var _Workflows2=_interopRequireDefault(_Workflows);var _Preferences=require("../api/Preferences");var _Preferences2=_interopRequireDefault(_Preferences);var _Comments=require("../api/Comments");var _Comments2=_interopRequireDefault(_Comments);var _Profile=require("../api/Profile");var _Profile2=_interopRequireDefault(_Profile);var _Sessions=require("../api/Sessions");var _Sessions2=_interopRequireDefault(_Sessions);var _Encryption=require("../api/Encryption");var _Encryption2=_interopRequireDefault(_Encryption);var _Live=require("../api/Live");var _Live2=_interopRequireDefault(_Live);var _Brian=require("../api/brian/Brian");var _Brian2=_interopRequireDefault(_Brian);var _Session=require("../models/Session");var _Session2=_interopRequireDefault(_Session);var _EventEmitter=require("../events/EventEmitter");var _EventEmitter2=_interopRequireDefault(_EventEmitter);var _ResponseStatus=require("../enum/ResponseStatus");var _ResponseStatus2=_interopRequireDefault(_ResponseStatus);var _sleep=require("../util/sleep");var _sleep2=_interopRequireDefault(_sleep);var _constants=require("../util/constants");var _getTimezone=require("../util/getTimezone");var _getTimezone2=_interopRequireDefault(_getTimezone);var _Reports=require("../api/Reports");var _Reports2=_interopRequireDefault(_Reports);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")}}var debug=require("debug")("PageProof");var PageProof=function(){function PageProof(){var _ref=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{},_ref$options=_ref.options,options=_ref$options===undefined?{}:_ref$options,_ref$adapters=_ref.adapters,adapters=_ref$adapters===undefined?[]:_ref$adapters;_classCallCheck(this,PageProof);this.options=options;this.events=new _EventEmitter2.default;this.adapters=new _AdapterRepository2.default(adapters);this.cache=new _Cache2.default(this);this.accounts=new _Accounts2.default(this);this.comments=new _Comments2.default(this);this.dashboard=new _Dashboard2.default(this);this.files=new _Files2.default(this);this.profile=new _Profile2.default(this);this.proofs=new _Proofs2.default(this);this.briefs=new _Briefs2.default(this);this.users=new _Users2.default(this);this.workflows=new _Workflows2.default(this);this.preferences=new _Preferences2.default(this);this.sessions=new _Sessions2.default(this);this.encryption=new _Encryption2.default(this);this.live=new _Live2.default(this);this.reports=new _Reports2.default(this);this._init();this._registerCoreHooks();this._enhance()}PageProof.prototype._init=function _init(){var requestAdapter=this.adapters.getRequestAdapter();if(!this.options.endpoint){this.options.endpoint=requestAdapter.options.endpoint}if(!this.options.applicationId){this.options.applicationId=requestAdapter.options.applicationId}if(!this.options.subscriptionKey){this.options.subscriptionKey=requestAdapter.options.key||this.options.key}if(this.options.subscriptionKey&&!this.options.applicationId){throw new Error("You must provide an applicationId.")}};PageProof.prototype._registerCoreHooks=function _registerCoreHooks(){this.on("error.throttled",function(event){var ms=event.data.response.data.timeout;debug("Sleeping "+ms+"ms until rate limit resets");return(0,_sleep2.default)(ms)})};PageProof.prototype._enhance=function _enhance(){var _this=this;var adapters=this.adapters.getEnhancementAdapters();adapters.forEach(function(adapter){return adapter.onClientReady(_this)})};PageProof.prototype.setSession=function setSession(session){if(session&&!(session instanceof _Session2.default)){this.session=(new _Session2.default).fromJSON(session)}else{this.session=session||null}return this.session};PageProof.prototype.rawRequest=function rawRequest(_ref2,options){var method=_ref2.method,host=_ref2.host,path=_ref2.path,query=_ref2.query,body=_ref2.body,headers=_ref2.headers;var adapter=this.adapters.getRequestAdapter();return adapter.send({host:host,method:method,path:path,query:query,body:body,headers:headers,credentials:false},options)};PageProof.prototype.getRequestLocalEncodedMetadata=function getRequestLocalEncodedMetadata(){return[(0,_getTimezone2.default)()].map(function(value){return value!==null&&value!==undefined?encodeURIComponent(value):"#"}).join(":")};PageProof.prototype.request=function request(name,params,options){var _this2=this;var request=new _Request2.default(this.options.endpoint,name,params);var adapter=this.adapters.getRequestAdapter();var start=Promise.resolve();if(!request.endpoint.anonymous){if(!this.session){return Promise.reject(new Error("Cannot make call to endpoint ("+name+") when unauthorized."))}var crypto=this.adapters.getCryptoAdapter();start=crypto.generateAuthorizationHeaders(request.getMethod(),request.getPath(),this.session).then(function(headers){return request.addHeaders(headers)})}if(this.options.applicationId){request.addHeader(_constants.DEVICE_ID_HEADER,this.options.applicationId)}if(this.options.subscriptionKey){request.addHeader(_constants.SUBSCRIPTION_KEY_HEADER,this.options.subscriptionKey)}var localEncodedMetadata=this.getRequestLocalEncodedMetadata();if(localEncodedMetadata){request.addHeader(_constants.LOCAL_ENCODED_METADATA_HEADER,localEncodedMetadata)}var meta={request:request};return start.then(function(){var data=request.build();return _this2.events.emit("experimental.request.before",meta,true).then(function(){return data})}).then(function(data){return adapter.send(data,options)}).then(_Response2.default.parse).then(function(response){meta.response=response;_this2.events.emit("experimental.request.after",meta);if(response.code===_ResponseStatus2.default.ERROR_THROTTLED){var handlers=_this2.events.emit("error.throttled",meta);if(handlers.some(Boolean)){return Promise.all(handlers).then(function(){_this2.events.emit("experimental.request.retry",meta);return _this2.request(name,params,options)})}}if(response.code===_ResponseStatus2.default.ERROR_UNAUTHORISED){var sessionToken=_this2.session?_this2.session.token:null;return _this2.events.emit("error.unauthorized",meta,true).then(function(){if(_this2.session&&_this2.session.token!==sessionToken){return _this2.request(name,params,options)}return response})}if(response.deprecated){var message="The "+name+" API has been deprecated. "+(response.deprecated||"");_this2.events.emit("error.deprecated",{name:name,message:message})}return response}).then(function(response){try{if(response.error){_this2.events.emit("error.response",meta);var err=new Error(response.message+" ["+name+"]");err.response=response;err.request=request;return Promise.reject(err)}else{_this2.events.emit("experimental.request.resolve",meta);return Promise.resolve(response)}}finally{_this2.events.emit("experimental.request.finally",meta)}})};PageProof.prototype.admin=function admin(){if(!this.session){return Promise.reject(new Error("You must be logged in to use the Admin API."))}if(!this.session.user.isAdmin){return Promise.reject(new Error("The current user must be an administrator of a team or enterprise account."))}if(!this._admin){this._admin=Promise.resolve(new _Admin2.default(this))}return this._admin};PageProof.prototype.brian=function brian(){if(!this.session||this.session.userId!==_constants.BRIAN_USER_ID){return Promise.reject(new Error("You do not have permission to use this API."))}if(!this._brian){this._brian=Promise.resolve(new _Brian2.default(this))}return this._brian};PageProof.prototype.crypto=function crypto(){return this.adapters.getCryptoAdapter()};PageProof.prototype.on=function on(event,handler){return this.events.on(event,handler)};return PageProof}();exports.default=PageProof;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";exports.__esModule=true;var _transform=require("./transform");var _transform2=_interopRequireDefault(_transform);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")}}var teamInvitationSchema={name:"Name",logo:"Logo"};var TeamInvitation=function(){function TeamInvitation(){_classCallCheck(this,TeamInvitation)}TeamInvitation.prototype.fromTeamInvitation=function fromTeamInvitation(teamInvitationData){(0,_transform2.default)(this,teamInvitationSchema,teamInvitationData);return this};return TeamInvitation}();exports.default=TeamInvitation;
|
|
@@ -171,9 +171,10 @@
|
|
|
171
171
|
"body": ["email"]
|
|
172
172
|
},
|
|
173
173
|
"proofs.create": {
|
|
174
|
+
"version": 2,
|
|
174
175
|
"method": "POST",
|
|
175
176
|
"path": "/api/proofs/create",
|
|
176
|
-
"body": ["title", "dueDate", "description", "groupId", "reference"]
|
|
177
|
+
"body": ["title", "dueDate", "description", "groupId", "reference", "reminders"]
|
|
177
178
|
},
|
|
178
179
|
"proofs.normalize-workflow": {
|
|
179
180
|
"method": "POST",
|
|
@@ -608,18 +609,6 @@
|
|
|
608
609
|
"path": "/api/admin/member/invite",
|
|
609
610
|
"body": ["emails"]
|
|
610
611
|
},
|
|
611
|
-
"team.users.invite.accept": {
|
|
612
|
-
"method": "POST",
|
|
613
|
-
"path": "/api/teams/member/invite/accept",
|
|
614
|
-
"body": ["email", "token", "authCode", "password", "isTemp", "publicKey", "privateKey"],
|
|
615
|
-
"anonymous": true
|
|
616
|
-
},
|
|
617
|
-
"team.info.load": {
|
|
618
|
-
"method": "POST",
|
|
619
|
-
"path": "/api/teams/info/",
|
|
620
|
-
"body": ["email", "token"],
|
|
621
|
-
"anonymous": true
|
|
622
|
-
},
|
|
623
612
|
"admin.team.features.load": {
|
|
624
613
|
"method": "GET",
|
|
625
614
|
"path": "/api/admin/settings",
|
|
@@ -677,7 +666,7 @@
|
|
|
677
666
|
"version": 2,
|
|
678
667
|
"method": "POST",
|
|
679
668
|
"path": "/api/reminders/delete",
|
|
680
|
-
"body": ["
|
|
669
|
+
"body": ["reminderIds"]
|
|
681
670
|
},
|
|
682
671
|
"reminders.all": {
|
|
683
672
|
"version": 2,
|
|
@@ -712,5 +701,23 @@
|
|
|
712
701
|
"version": 2,
|
|
713
702
|
"method": "GET",
|
|
714
703
|
"path": "/api/reports/configurations"
|
|
704
|
+
},
|
|
705
|
+
"teams.invitations.info": {
|
|
706
|
+
"version": 2,
|
|
707
|
+
"method": "GET",
|
|
708
|
+
"path": "/api/teams/invitations/info",
|
|
709
|
+
"chain": ["invitationId"]
|
|
710
|
+
},
|
|
711
|
+
"teams.invitations.accept": {
|
|
712
|
+
"version": 2,
|
|
713
|
+
"method": "POST",
|
|
714
|
+
"path": "/api/teams/invitations/accept",
|
|
715
|
+
"chain": ["invitationId"]
|
|
716
|
+
},
|
|
717
|
+
"teams.invitations.decline": {
|
|
718
|
+
"version": 2,
|
|
719
|
+
"method": "POST",
|
|
720
|
+
"path": "/api/teams/invitations/decline",
|
|
721
|
+
"chain": ["invitationId"]
|
|
715
722
|
}
|
|
716
723
|
}
|