@pageproof/sdk-pr 209.0.1571356073380 → 212.0.1570661936624

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 CHANGED
@@ -1,23 +1,5 @@
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
-
15
- ## 2.0.0-beta.101
16
-
17
- Released on the 17th of October 2019.
18
-
19
- - Bugfixes around workers dying part-way through processing a job.
20
-
21
3
  ## 2.0.0-beta.100
22
4
 
23
5
  Released on the 20th of September 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,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;
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 +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(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;
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(id){return this.client.request("reminders.delete",{reminderId:id})};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;
@@ -96,6 +96,50 @@ var TeamUsers = function (_API) {
96
96
  return this._setEnabled(email, false);
97
97
  };
98
98
 
99
+ /**
100
+ * Invite a new user to the team.
101
+ *
102
+ * @example <caption>Inviting single user</caption>
103
+ * await admin.team.users.invite('newuser@domain.com');
104
+ *
105
+ * @example <caption>Inviting multi users</caption>
106
+ * await admin.team.users.invite([
107
+ * 'newuser@domain.com',
108
+ * 'newuser1@domain.com'
109
+ * ]);
110
+ *
111
+ * @since v2.0.0-beta.101
112
+ * @param {string|array<string>} emailOrEmails The new email address or array of email addresses
113
+ * @returns {Promise}
114
+ */
115
+
116
+
117
+ TeamUsers.prototype.invite = function invite(emailOrEmails) {
118
+ return this.client.request('admin.team.users.invite', {
119
+ emails: [].concat(emailOrEmails)
120
+ });
121
+ };
122
+
123
+ /**
124
+ * Add a new user to the team, once user is agree to be in a team.
125
+ *
126
+ * @example <caption>Adding a user in to team</caption>
127
+ * await admin.team.users.add('UI34VRHP7CPBSOJI', 'TI34VRHP7CPBSOJI');
128
+ *
129
+ * @since v2.0.0-beta.101
130
+ * @param {string} userId The user id to be added into team
131
+ * @param {string} teamId The team id
132
+ * @returns {Promise}
133
+ */
134
+
135
+
136
+ TeamUsers.prototype.add = function add(userId, teamId) {
137
+ return this.client.request('admin.team.users.add', {
138
+ userId: userId,
139
+ teamId: teamId
140
+ });
141
+ };
142
+
99
143
  return TeamUsers;
100
144
  }(_API3.default);
101
145
 
@@ -171,10 +171,9 @@
171
171
  "body": ["email"]
172
172
  },
173
173
  "proofs.create": {
174
- "version": 2,
175
174
  "method": "POST",
176
175
  "path": "/api/proofs/create",
177
- "body": ["title", "dueDate", "description", "groupId", "reference", "reminders"]
176
+ "body": ["title", "dueDate", "description", "groupId", "reference"]
178
177
  },
179
178
  "proofs.normalize-workflow": {
180
179
  "method": "POST",
@@ -603,6 +602,17 @@
603
602
  "path": "/api/admin/setenabled",
604
603
  "body": ["email", "enabled"]
605
604
  },
605
+ "admin.team.users.invite": {
606
+ "version": 2,
607
+ "method": "POST",
608
+ "path": "/api/admin/member/invite",
609
+ "body": ["emails"]
610
+ },
611
+ "admin.team.users.add": {
612
+ "method": "POST",
613
+ "path": "/api/admin/member/add",
614
+ "body": ["userId", "teamId"]
615
+ },
606
616
  "admin.team.features.load": {
607
617
  "method": "GET",
608
618
  "path": "/api/admin/settings",
@@ -660,7 +670,7 @@
660
670
  "version": 2,
661
671
  "method": "POST",
662
672
  "path": "/api/reminders/delete",
663
- "body": ["reminderIds"]
673
+ "body": ["reminderId"]
664
674
  },
665
675
  "reminders.all": {
666
676
  "version": 2,